Skip to contentSkip to conversation

pl061: fix wrong calculation of GPIOMIS register

PATCH Applied Victor CLEMENT 3 participants 3 messages Jun 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pl061: fix wrong calculation of GPIOMIS register

The masked interrupt status register should be the state of the interrupt after masking.
There should be a logical AND instead of a logical OR between the interrupt status and the interrupt mask.

---

See ARM PrimeCell GPIO manual below
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0190b/I36092.html

---
 hw/gpio/pl061.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/pl061.c +1 -1
index bd03e99..4ba730b 100644
@@ -173,7 +173,7 @@ static uint64_t pl061_read(void *opaque, hwaddr offset,
     case 0x414: /* Raw interrupt status */
         return s->istate;
     case 0x418: /* Masked interrupt status */
-        return s->istate | s->im;
+        return s->istate & s->im;
     case 0x420: /* Alternate function select */
         return s->afsel;
     case 0x500: /* 2mA drive */
Signature · 1 line
2.3.7
Reviewed-by on v1 1/1
#1 lore raw

gpio: prefix on subject line (in addition to pl061:)

Quoted 7 lines · Victor CLEMENT

The masked interrupt status register should be the state of the interrupt after masking.
There should be a logical AND instead of a logical OR between the interrupt status and the interrupt mask.

So this makes sense to me, given that the code uses ->im with & operation for the actual interrupt pin calculation. That | result in original code makes little sense.

With just the subject line change:

Quoted 25 lines

---

See ARM PrimeCell GPIO manual below
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0190b/I36092.html

---
 hw/gpio/pl061.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/pl061.c +1 -2
index bd03e99..4ba730b 100644
@@ -173,7 +173,7 @@ static uint64_t pl061_read(void *opaque, hwaddr offset,
     case 0x414: /* Raw interrupt status */
         return s->istate;
     case 0x418: /* Masked interrupt status */
-        return s->istate | s->im;
+        return s->istate & s->im;
     case 0x420: /* Alternate function select */
         return s->afsel;
     case 0x500: /* 2mA drive */
--

2.3.7