Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/arch/i386/pci Pull up to netbsd-1-5 branch



details:   https://anonhg.NetBSD.org/src/rev/85bbb396baea
branches:  netbsd-1-5
changeset: 489035:85bbb396baea
user:      soda <soda%NetBSD.org@localhost>
date:      Thu Aug 10 22:31:24 2000 +0000

description:
Pull up to netbsd-1-5 branch
Approved by: thorpej

add several debug printf which can be enabled by PIIX_DEBUG.

Revision pulled up:
 > cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/piix.c

diffstat:

 sys/arch/i386/pci/piix.c |  51 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 2 deletions(-)

diffs (106 lines):

diff -r e8c90c73532b -r 85bbb396baea sys/arch/i386/pci/piix.c
--- a/sys/arch/i386/pci/piix.c  Thu Aug 10 22:29:58 2000 +0000
+++ b/sys/arch/i386/pci/piix.c  Thu Aug 10 22:31:24 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: piix.c,v 1.1 1999/11/17 01:21:20 thorpej Exp $ */
+/*     $NetBSD: piix.c,v 1.1.8.1 2000/08/10 22:31:24 soda Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -82,9 +82,18 @@
 #include <i386/pci/piixreg.h>
 #include <i386/pci/piixvar.h>
 
+#ifdef PIIX_DEBUG
+#define        DPRINTF(arg) printf arg
+#else
+#define        DPRINTF(arg)
+#endif
+
 int    piix_getclink __P((pciintr_icu_handle_t, int, int *));
 int    piix_get_intr __P((pciintr_icu_handle_t, int, int *));
 int    piix_set_intr __P((pciintr_icu_handle_t, int, int));
+#ifdef PIIX_DEBUG
+void   piix_pir_dump __P((struct piix_handle *));
+#endif
 
 const struct pciintr_icu piix_pci_icu = {
        piix_getclink,
@@ -118,6 +127,9 @@
                return (1);
        }
 
+#ifdef PIIX_DEBUG
+       piix_pir_dump(ph);
+#endif
        *ptagp = &piix_pci_icu;
        *phandp = ph;
        return (0);
@@ -128,19 +140,23 @@
        pciintr_icu_handle_t v;
        int link, *clinkp;
 {
+       DPRINTF(("PIIX link value 0x%x: ", link));
 
        /* Pattern 1: simple. */
        if (PIIX_LEGAL_LINK(link - 1)) {
                *clinkp = link - 1;
+               DPRINTF(("PIRQ %d (simple)\n", *clinkp));
                return (0);
        }
 
        /* Pattern 2: configuration register offset */
        if (link >= 0x60 && link <= 0x63) {
                *clinkp = link - 0x60;
+               DPRINTF(("PIRQ %d (register offset)\n", *clinkp));
                return (0);
        }
 
+       DPRINTF(("bogus IRQ selection source\n"));
        return (1);
 }
 
@@ -159,7 +175,7 @@
        reg = pci_conf_read(ph->ph_pc, ph->ph_tag, PIIX_CFG_PIRQ);
        shift = clink << 3;
        if ((reg >> shift) & PIIX_CFG_PIRQ_NONE)
-               *irqp = 0xff;
+               *irqp = I386_PCI_INTERRUPT_LINE_NO_CONNECTION;
        else
                *irqp = PIIX_PIRQ(reg, clink);
 
@@ -235,3 +251,34 @@
 
        return (0);
 }
+
+#ifdef PIIX_DEBUG
+void
+piix_pir_dump(ph)
+       struct piix_handle *ph;
+{
+       int i, irq;
+       pcireg_t irqs = pci_conf_read(ph->ph_pc, ph->ph_tag, PIIX_CFG_PIRQ);
+       u_int8_t elcr[2];
+
+       elcr[0] = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, 0);
+       elcr[1] = bus_space_read_1(ph->ph_iot, ph->ph_elcr_ioh, 1);
+
+       for (i = 0; i < 4; i++) {
+               irq = PIIX_PIRQ(irqs, i);
+               if (irq & PIIX_CFG_PIRQ_NONE)
+                       printf("PIIX PIRQ %d: irq none (0x%x)\n", i, irq);
+               else
+                       printf("PIIX PIRQ %d: irq %d\n", i, irq);
+       }
+       printf("PIIX irq:");
+       for (i = 0; i < 16; i++)
+               printf(" %2d", i);
+       printf("\n");
+       printf(" trigger:");
+       for (i = 0; i < 16; i++)
+               printf("  %c", (elcr[(i & 8) ? 1 : 0] & (1 << (i & 7))) ?
+                      'L' : 'E');
+       printf("\n");
+}
+#endif /* PIIX_DEBUG */



Home | Main Index | Thread Index | Old Index