Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/bebb70be066b
branches:  netbsd-1-5
changeset: 489037:bebb70be066b
user:      soda <soda%NetBSD.org@localhost>
date:      Thu Aug 10 22:48:15 2000 +0000

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

When performing pci_config_dump:
Display the full value of 64-bit BARs.
Avoid displaying the upper 32 bits of 64-bit BARs as a separate 32-bit BAR.
  by Nathan J Williams <nathanw%netbsd.org@localhost>

Revisions pulled up:
 > cvs rdiff -r1.36 -r1.37 syssrc/sys/dev/pci/pci_subr.c

diffstat:

 sys/dev/pci/pci_subr.c |  63 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 45 insertions(+), 18 deletions(-)

diffs (163 lines):

diff -r 6cb9dc3c1f93 -r bebb70be066b sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c    Thu Aug 10 22:42:04 2000 +0000
+++ b/sys/dev/pci/pci_subr.c    Thu Aug 10 22:48:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_subr.c,v 1.35 2000/03/22 00:36:29 cgd Exp $        */
+/*     $NetBSD: pci_subr.c,v 1.35.4.1 2000/08/10 22:48:15 soda Exp $   */
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -52,7 +52,7 @@
 
 static void pci_conf_print_common __P((pci_chipset_tag_t, pcitag_t,
     const pcireg_t *regs));
-static void pci_conf_print_bar __P((pci_chipset_tag_t, pcitag_t, 
+static int pci_conf_print_bar __P((pci_chipset_tag_t, pcitag_t, 
     const pcireg_t *regs, int, const char *));
 static void pci_conf_print_regs __P((const pcireg_t *regs, int first,
     int pastlast));
@@ -528,7 +528,7 @@
        printf("    Cache Line Size: 0x%02x\n", PCI_CACHELINE(rval));
 }
 
-static void
+static int
 pci_conf_print_bar(pc, tag, regs, reg, name)
        pci_chipset_tag_t pc;
        pcitag_t tag;
@@ -536,8 +536,11 @@
        int reg;
        const char *name;
 {
-       int s;
+       int s, width;
        pcireg_t mask, rval;
+       pcireg_t mask64h, rval64h;
+       
+       width = 4;
 
        /*
         * Section 6.2.5.1, `Address Maps', tells us that:
@@ -564,6 +567,14 @@
                pci_conf_write(pc, tag, reg, 0xffffffff);
                mask = pci_conf_read(pc, tag, reg);
                pci_conf_write(pc, tag, reg, rval);
+               if (PCI_MAPREG_TYPE(rval) == PCI_MAPREG_TYPE_MEM &&
+                   PCI_MAPREG_MEM_TYPE(rval) == PCI_MAPREG_MEM_TYPE_64BIT) {
+                       rval64h = regs[o2i(reg + 4)];
+                       pci_conf_write(pc, tag, reg + 4, 0xffffffff);
+                       mask64h = pci_conf_read(pc, tag, reg + 4);
+                       pci_conf_write(pc, tag, reg + 4, rval64h);
+                       width = 8;
+               }
                splx(s);
        } else
                mask = 0;
@@ -574,8 +585,8 @@
        printf("\n      ");
        if (rval == 0) {
                printf("not implemented(?)\n");
-               return;
-       }
+               return width;
+       } 
        printf("type: ");
        if (PCI_MAPREG_TYPE(rval) == PCI_MAPREG_TYPE_MEM) {
                const char *type, *prefetch;
@@ -599,15 +610,31 @@
                else
                        prefetch = "non";
                printf("%s %sprefetchable memory\n", type, prefetch);
-               printf("      base: 0x%08x, size: 0x%08x\n",
-                   PCI_MAPREG_MEM_ADDR(rval),
-                   PCI_MAPREG_MEM_SIZE(mask));
+               switch (PCI_MAPREG_MEM_TYPE(rval)) {
+               case PCI_MAPREG_MEM_TYPE_64BIT:
+                       printf("      base: 0x%016llx, size: 0x%016llx\n",
+                           PCI_MAPREG_MEM64_ADDR(
+                               ((((long long) rval64h) << 32) | rval)),
+                           PCI_MAPREG_MEM64_SIZE(
+                               ((((long long) mask64h) << 32) | mask)));
+                       break;
+               case PCI_MAPREG_MEM_TYPE_32BIT:
+               case PCI_MAPREG_MEM_TYPE_32BIT_1M:
+               default:
+                       printf("      base: 0x%08x, size: 0x%08x\n",
+                           PCI_MAPREG_MEM_ADDR(rval),
+                           PCI_MAPREG_MEM_SIZE(mask));
+                       break;
+               }
+
        } else {
                printf("i/o\n");
                printf("      base: 0x%08x, size: 0x%08x\n",
                    PCI_MAPREG_IO_ADDR(rval),
                    PCI_MAPREG_IO_SIZE(mask));
        }
+
+       return width;
 }
 
 static void
@@ -641,11 +668,11 @@
        pcitag_t tag;
        const pcireg_t *regs;
 {
-       int off;
+       int off, width;
        pcireg_t rval;
 
-       for (off = PCI_MAPREG_START; off < PCI_MAPREG_END; off += 4)
-               pci_conf_print_bar(pc, tag, regs, off, NULL);
+       for (off = PCI_MAPREG_START; off < PCI_MAPREG_END; off += width)
+               width = pci_conf_print_bar(pc, tag, regs, off, NULL);
 
        printf("    Cardbus CIS Pointer: 0x%08x\n", regs[o2i(0x28)]);
 
@@ -685,7 +712,7 @@
                printf("(pin D)");
                break;
        default:
-               printf("(???)");
+               printf("(? ? ?)");
                break;
        }
        printf("\n");
@@ -735,7 +762,7 @@
        pcitag_t tag;
        const pcireg_t *regs;
 {
-       int off;
+       int off, width;
        pcireg_t rval;
 
        /*
@@ -747,8 +774,8 @@
         * respect to various standards. (XXX)
         */
 
-       for (off = 0x10; off < 0x18; off += 4)
-               pci_conf_print_bar(pc, tag, regs, off, NULL);
+       for (off = 0x10; off < 0x18; off += width)
+               width = pci_conf_print_bar(pc, tag, regs, off, NULL);
 
        printf("    Primary bus number: 0x%02x\n",
            (regs[o2i(0x18)] >> 0) & 0xff);
@@ -839,7 +866,7 @@
                printf("(pin D)");
                break;
        default:
-               printf("(???)");
+               printf("(? ? ?)");
                break;
        }
        printf("\n");
@@ -952,7 +979,7 @@
                printf("(pin D)");
                break;
        default:
-               printf("(???)");
+               printf("(? ? ?)");
                break;
        }
        printf("\n");



Home | Main Index | Thread Index | Old Index