Subject: Re: CardBus PCI
To: None <mcr@sandelman.ottawa.on.ca>
From: Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>
List: tech-kern
Date: 04/23/2001 06:08:07
Hi,
Subject: Re: CardBus PCI
Message-ID: <200104222037.f3MKbq107575@marajade.sandelman.ottawa.on.ca>
$ The device is at http://www.magma.com/
$ The code does not compile yet.
Thanks!
$ Please send.
I attach next patch.
Regards!
---
Masanori Kanaoka kanaoka@ann.hi-ho.ne.jp
Index: pci_addr_fixup.c
===================================================================
RCS file: /ftp/cvs/syssrc/sys/arch/i386/pci/pci_addr_fixup.c,v
retrieving revision 1.7
diff -u -r1.7 pci_addr_fixup.c
--- pci_addr_fixup.c 2000/08/03 20:10:45 1.7
+++ pci_addr_fixup.c 2001/04/17 08:46:32
@@ -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 Do not fixup AGP device */
+ 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;
+
+ 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);
+}
+