Skip to contentSkip to conversation

ioapic: Implement polarity

PATCH In review Jan Kiszka 3 participants 3 messages May 15, 2011 – Jun 8, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/2 ioapic: Implement polarity

From: Jan Kiszka <[email protected]>

If the polarity bit is set in a redirection table entry, the input level simply has to inverted as it is low active in this case.

---
 hw/ioapic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/ioapic.c +3 -0
index 5916387..61991d7 100644
@@ -148,6 +148,9 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
         uint32_t mask = 1 << vector;
         uint64_t entry = s->ioredtbl[vector];
 
+        if (entry & (1 << IOAPIC_LVT_POLARITY_SHIFT)) {
+            level = !level;
+        }
         if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) ==
             IOAPIC_TRIGGER_LEVEL) {
             /* level triggered */
#1 lore raw
Quoted 4 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

If the polarity bit is set in a redirection table entry, the input level simply has to inverted as it is low active in this case.

Ping for this and
http://thread.gmane.org/gmane.comp.emulators.qemu/102459. Maybe even trivial, so CC'ing.

Jan

Quoted 22 lines
---
 hw/ioapic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/ioapic.c +3 -0
index 5916387..61991d7 100644
@@ -148,6 +148,9 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
         uint32_t mask = 1 << vector;
         uint64_t entry = s->ioredtbl[vector];
 
+        if (entry & (1 << IOAPIC_LVT_POLARITY_SHIFT)) {
+            level = !level;
+        }
         if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) ==
             IOAPIC_TRIGGER_LEVEL) {
             /* level triggered */
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux