Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/pci - fixup only #0 bus --> fixup maxbus.



details:   https://anonhg.NetBSD.org/src/rev/c95e8cead53d
branches:  trunk
changeset: 508981:c95e8cead53d
user:      kanaoka <kanaoka%NetBSD.org@localhost>
date:      Mon Apr 23 19:15:29 2001 +0000

description:
- fixup only #0 bus --> fixup maxbus.
 - Don't pciaddr_do_resource_allocate if device is AGP
   to avoid conflict.

diffstat:

 sys/arch/i386/pci/pci_addr_fixup.c |  38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r 51fdfea4a6da -r c95e8cead53d sys/arch/i386/pci/pci_addr_fixup.c
--- a/sys/arch/i386/pci/pci_addr_fixup.c        Mon Apr 23 18:09:27 2001 +0000
+++ b/sys/arch/i386/pci/pci_addr_fixup.c        Mon Apr 23 19:15:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_addr_fixup.c,v 1.7 2000/08/03 20:10:45 nathanw Exp $       */
+/*     $NetBSD: pci_addr_fixup.c,v 1.8 2001/04/23 19:15:29 kanaoka Exp $       */
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi.  All rights reserved.
@@ -61,6 +61,8 @@
 bus_addr_t pciaddr_ioaddr __P((u_int32_t));
 void   pciaddr_print_devid __P((pci_chipset_tag_t, pcitag_t));
 
+int    device_is_agp __P((pci_chipset_tag_t, pcitag_t));
+
 #define PCIADDR_MEM_START      0x0
 #define PCIADDR_MEM_END                0xffffffff
 #define PCIADDR_PORT_START     0x0
@@ -149,8 +151,7 @@
         */
        PCIBIOS_PRINTV((verbose_header, "PCIBIOS fixup stage"));
        pciaddr.nbogus = 0;
-       /* XXX bus #0 only. */
-       pci_device_foreach(pc, 0, pciaddr_resource_allocate);
+       pci_device_foreach(pc, maxbus, pciaddr_resource_allocate);
        PCIBIOS_PRINTV((verbose_footer, pciaddr.nbogus));
 
 }
@@ -290,6 +291,10 @@
        
        if (*addr) /* no need to allocate */
                return (0);
+
+       /* XXX Don't allocate if device is AGP device to avoid conflict. */
+       if (device_is_agp(pc, tag)) 
+               return (0);
        
        start = type == PCI_MAPREG_TYPE_MEM ? pciaddr.mem_alloc_start
                : pciaddr.port_alloc_start;
@@ -374,3 +379,30 @@
        printf("%03d:%02d:%d 0x%04x 0x%04x ", bus, device, function, 
               PCI_VENDOR(id), PCI_PRODUCT(id));
 }
+
+int
+device_is_agp(pc, tag)
+       pci_chipset_tag_t pc;
+       pcitag_t tag;
+{
+       pcireg_t class, status, rval;
+       int off;
+
+       /* Check AGP device. */
+       class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+       if (PCI_CLASS(class) == PCI_CLASS_DISPLAY) {
+               status = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+               if (status & PCI_STATUS_CAPLIST_SUPPORT) {
+                       rval = pci_conf_read(pc, tag, PCI_CAPLISTPTR_REG);
+                       for (off = PCI_CAPLIST_PTR(rval);
+                           off != 0;
+                           off = PCI_CAPLIST_NEXT(rval) ) {
+                               rval = pci_conf_read(pc, tag, off);
+                               if (PCI_CAPLIST_CAP(rval) == PCI_CAP_AGP) 
+                                       return (1);
+                       }
+               }
+       }
+       return (0);
+}
+



Home | Main Index | Thread Index | Old Index