ioapic: Properly log interrupt mode
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 25 Mar 2011 14:42:02 +0000 (22:42 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 25 Mar 2011 14:59:33 +0000 (22:59 +0800)
sys/kern/subr_bus.c
sys/platform/pc32/acpica5/acpi_madt.c
sys/platform/pc32/apic/ioapic_abi.c
sys/platform/pc32/apic/mpapic.c
sys/platform/pc64/acpica5/acpi_madt.c
sys/platform/pc64/apic/ioapic_abi.c
sys/platform/pc64/apic/mpapic.c
sys/sys/bus.h

index 06f94f7..caeaeca 100644 (file)
@@ -3385,3 +3385,35 @@ bus_data_generation_update(void)
 {
        bus_data_generation++;
 }
+
+const char *
+intr_str_polarity(enum intr_polarity pola)
+{
+       switch (pola) {
+       case INTR_POLARITY_LOW:
+               return "low";
+
+       case INTR_POLARITY_HIGH:
+               return "high";
+
+       case INTR_POLARITY_CONFORM:
+               return "conform";
+       }
+       return "unknown";
+}
+
+const char *
+intr_str_trigger(enum intr_trigger trig)
+{
+       switch (trig) {
+       case INTR_TRIGGER_EDGE:
+               return "edge";
+
+       case INTR_TRIGGER_LEVEL:
+               return "level";
+
+       case INTR_TRIGGER_CONFORM:
+               return "conform";
+       }
+       return "unknown";
+}
index ba2a6ed..a4aa924 100644 (file)
@@ -607,9 +607,9 @@ madt_ioapic_enum_callback(void *xarg, const struct acpi_madt_ent *ent)
                        return 0;
                }
 
-               MADT_VPRINTF("INTSRC irq %d -> gsi %u %c\n",
+               MADT_VPRINTF("INTSRC irq %d -> gsi %u %s/%s\n",
                             intsrc_ent->mint_src, intsrc_ent->mint_gsi,
-                            trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                            intr_str_trigger(trig), intr_str_polarity(pola));
                ioapic_intsrc(intsrc_ent->mint_src, intsrc_ent->mint_gsi,
                              trig, pola);
        } else if (ent->me_type == MADT_ENT_IOAPIC) {
index f552d2d..a2488e7 100644 (file)
@@ -686,8 +686,10 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
        map->im_pola = pola;
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d -> gsi %d %c\n", irq, map->im_gsi,
-                       map->im_trig == INTR_TRIGGER_LEVEL ? 'L' : 'E');
+               kprintf("IOAPIC: irq %d -> gsi %d %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola));
        }
 
        pin = ioapic_gsi_pin(map->im_gsi);
@@ -800,14 +802,14 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
 
        if (map->im_flags & IOAPIC_IMF_CONF) {
                if (trig != map->im_trig) {
-                       panic("ioapic_intr_config: trig %c -> %c\n",
-                             map->im_trig == INTR_TRIGGER_EDGE ? 'E' : 'L',
-                             trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                       panic("ioapic_intr_config: trig %s -> %s\n",
+                             intr_str_trigger(map->im_trig),
+                             intr_str_trigger(trig));
                }
                if (pola != map->im_pola) {
                        panic("ioapic_intr_config: pola %s -> %s\n",
-                             map->im_pola == INTR_POLARITY_HIGH ? "hi" : "lo",
-                             pola == INTR_POLARITY_HIGH ? "hi" : "lo");
+                             intr_str_polarity(map->im_pola),
+                             intr_str_polarity(pola));
                }
                return;
        }
@@ -817,11 +819,13 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
                return;
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d, gsi %d %c -> %c\n", irq, map->im_gsi,
-                       map->im_trig == INTR_TRIGGER_LEVEL ? 'L' : 'E',
-                       trig == INTR_TRIGGER_LEVEL ? 'L' : 'E');
+               kprintf("IOAPIC: irq %d, gsi %d %s/%s -> %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola),
+                       intr_str_trigger(trig),
+                       intr_str_polarity(pola));
        }
-
        map->im_trig = trig;
        map->im_pola = pola;
 
@@ -880,8 +884,10 @@ ioapic_abi_extint_irqmap(int irq)
        KKASSERT(map->im_gsi >= 0);
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d -> extint gsi %d E\n", irq,
-                       map->im_gsi);
+               kprintf("IOAPIC: irq %d -> extint gsi %d %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola));
        }
 
        pin = ioapic_gsi_pin(map->im_gsi);
index 0ac746d..3909627 100644 (file)
@@ -1349,17 +1349,15 @@ ioapic_intsrc(int irq, int gsi, enum intr_trigger trig, enum intr_polarity pola)
                }
                if (int_src->int_trig != trig) {
                        kprintf("IOAPIC: warning intsrc irq %d, trig "
-                               "%c -> %c\n", irq,
-                               int_src->int_trig == INTR_TRIGGER_EDGE
-                               ? 'E' : 'L',
-                               trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                               "%s -> %s\n", irq,
+                               intr_str_trigger(int_src->int_trig),
+                               intr_str_trigger(trig));
                }
                if (int_src->int_pola != pola) {
                        kprintf("IOAPIC: warning intsrc irq %d, pola "
                                "%s -> %s\n", irq,
-                               int_src->int_pola == INTR_POLARITY_HIGH
-                               ? "hi" : "lo",
-                               pola == INTR_POLARITY_HIGH ? "hi" : "lo");
+                               intr_str_polarity(int_src->int_pola),
+                               intr_str_polarity(pola));
                }
        }
        int_src->int_gsi = gsi;
index 1dd1ef5..97372eb 100644 (file)
@@ -606,9 +606,9 @@ madt_ioapic_enum_callback(void *xarg, const struct acpi_madt_ent *ent)
                        return 0;
                }
 
-               MADT_VPRINTF("INTSRC irq %d -> gsi %u %c\n",
+               MADT_VPRINTF("INTSRC irq %d -> gsi %u %s/%s\n",
                             intsrc_ent->mint_src, intsrc_ent->mint_gsi,
-                            trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                            intr_str_trigger(trig), intr_str_polarity(pola));
                ioapic_intsrc(intsrc_ent->mint_src, intsrc_ent->mint_gsi,
                              trig, pola);
        } else if (ent->me_type == MADT_ENT_IOAPIC) {
index 3179356..0e29226 100644 (file)
@@ -679,8 +679,10 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
        map->im_pola = pola;
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d -> gsi %d %c\n", irq, map->im_gsi,
-                       map->im_trig == INTR_TRIGGER_LEVEL ? 'L' : 'E');
+               kprintf("IOAPIC: irq %d -> gsi %d %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola));
        }
 
        pin = ioapic_gsi_pin(map->im_gsi);
@@ -793,14 +795,14 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
 
        if (map->im_flags & IOAPIC_IMF_CONF) {
                if (trig != map->im_trig) {
-                       panic("ioapic_intr_config: trig %c -> %c\n",
-                             map->im_trig == INTR_TRIGGER_EDGE ? 'E' : 'L',
-                             trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                       panic("ioapic_intr_config: trig %s -> %s\n",
+                             intr_str_trigger(map->im_trig),
+                             intr_str_trigger(trig));
                }
                if (pola != map->im_pola) {
                        panic("ioapic_intr_config: pola %s -> %s\n",
-                             map->im_pola == INTR_POLARITY_HIGH ? "hi" : "lo",
-                             pola == INTR_POLARITY_HIGH ? "hi" : "lo");
+                             intr_str_polarity(map->im_pola),
+                             intr_str_polarity(pola));
                }
                return;
        }
@@ -810,11 +812,13 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
                return;
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d, gsi %d %c -> %c\n", irq, map->im_gsi,
-                       map->im_trig == INTR_TRIGGER_LEVEL ? 'L' : 'E',
-                       trig == INTR_TRIGGER_LEVEL ? 'L' : 'E');
+               kprintf("IOAPIC: irq %d, gsi %d %s/%s -> %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola),
+                       intr_str_trigger(trig),
+                       intr_str_polarity(pola));
        }
-
        map->im_trig = trig;
        map->im_pola = pola;
 
@@ -873,8 +877,10 @@ ioapic_abi_extint_irqmap(int irq)
        KKASSERT(map->im_gsi >= 0);
 
        if (bootverbose) {
-               kprintf("IOAPIC: irq %d -> extint gsi %d E\n", irq,
-                       map->im_gsi);
+               kprintf("IOAPIC: irq %d -> extint gsi %d %s/%s\n",
+                       irq, map->im_gsi,
+                       intr_str_trigger(map->im_trig),
+                       intr_str_polarity(map->im_pola));
        }
 
        pin = ioapic_gsi_pin(map->im_gsi);
index 64d7878..a050742 100644 (file)
@@ -1411,17 +1411,15 @@ ioapic_intsrc(int irq, int gsi, enum intr_trigger trig, enum intr_polarity pola)
                }
                if (int_src->int_trig != trig) {
                        kprintf("IOAPIC: warning intsrc irq %d, trig "
-                               "%c -> %c\n", irq,
-                               int_src->int_trig == INTR_TRIGGER_EDGE
-                               ? 'E' : 'L',
-                               trig == INTR_TRIGGER_EDGE ? 'E' : 'L');
+                               "%s -> %s\n", irq,
+                               intr_str_trigger(int_src->int_trig),
+                               intr_str_trigger(trig));
                }
                if (int_src->int_pola != pola) {
                        kprintf("IOAPIC: warning intsrc irq %d, pola "
                                "%s -> %s\n", irq,
-                               int_src->int_pola == INTR_POLARITY_HIGH
-                               ? "hi" : "lo",
-                               pola == INTR_POLARITY_HIGH ? "hi" : "lo");
+                               intr_str_polarity(int_src->int_pola),
+                               intr_str_polarity(pola));
                }
        }
        int_src->int_gsi = gsi;
index 07c6e39..515ab93 100644 (file)
@@ -146,6 +146,9 @@ SLIST_HEAD(resource_list, resource_list_entry);
 #endif /* _KERNEL || _KERNEL_STRUCTURES */
 #ifdef _KERNEL
 
+const char     *intr_str_polarity(enum intr_polarity);
+const char     *intr_str_trigger(enum intr_trigger);
+
 /**
  * devctl hooks.  Typically one should use the devctl_notify
  * hook to send the message.  However, devctl_queue_data is also