summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-05-03 13:52:29 +0000
committerphk <phk@FreeBSD.org>1997-05-03 13:52:29 +0000
commitf6c0c05b6bf509c55d41781b4f88c890ee2c365f (patch)
tree2c18324d5d585aff67987a3f08b26d2a1bbc700b /sys/dev
parentd4a32b53a4f4af15893ae40e53ab9c12647f1f5c (diff)
downloadFreeBSD-src-f6c0c05b6bf509c55d41781b4f88c890ee2c365f.zip
FreeBSD-src-f6c0c05b6bf509c55d41781b4f88c890ee2c365f.tar.gz
Initialize PCI/CardBus bridges.
Tested on: HP Omnibook 800 / TI PCI1130 Reviewed by: se
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/pci.c93
1 files changed, 53 insertions, 40 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 96a71e8..4456fe6 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** $Id: pci.c,v 1.69 1997/04/23 19:43:20 se Exp $
+** $Id: pci.c,v 1.70 1997/04/26 11:46:18 peter Exp $
**
** General subroutines for the PCI bus.
** pci_configure ()
@@ -472,52 +472,65 @@ static void pci_attach (int bus, int dev, int func,
** and update the pcicb fields.
*/
- for (reg=PCI_MAP_REG_START;reg<PCI_MAP_REG_END;reg+=4) {
+ data = pci_conf_read(tag, PCI_CLASS_REG);
+ data &= (PCI_CLASS_MASK|PCI_SUBCLASS_MASK);
+ switch (data) {
+ case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI:
+ break;
+ case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_CARDBUS: {
u_int map, addr, size;
+ map = pci_conf_read(tag, PCI_CARDBUS_SOCKET_REG);
+ pci_conf_write (tag, PCI_CARDBUS_SOCKET_REG, 0xffffffff);
+ size = pci_conf_read(tag, PCI_CARDBUS_SOCKET_REG);
+ size = (~size) + 1;
+ addr = pci_memalloc (pcicb, map, size);
+ pci_conf_write (tag, PCI_CARDBUS_SOCKET_REG, addr);
+ pcicb->pcicb_mamount += size;
+ break;
+ }
+ default:
+ for (reg=PCI_MAP_REG_START;reg<PCI_MAP_REG_END;reg+=4) {
+ u_int map, addr, size;
- data = pci_conf_read(tag, PCI_CLASS_REG);
- switch (data & (PCI_CLASS_MASK|PCI_SUBCLASS_MASK)) {
- case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI:
- continue;
- };
-
- map = pci_conf_read (tag, reg);
- if (!(map & PCI_MAP_MEMORY_ADDRESS_MASK))
- continue;
- pci_conf_write (tag, reg, 0xffffffff);
- data = pci_conf_read (tag, reg);
- pci_conf_write (tag, reg, map);
+ map = pci_conf_read (tag, reg);
+ if (!(map & PCI_MAP_MEMORY_ADDRESS_MASK))
+ continue;
- switch (data & 7) {
+ pci_conf_write (tag, reg, 0xffffffff);
+ data = pci_conf_read (tag, reg);
+ pci_conf_write (tag, reg, map);
- default:
- continue;
- case 1:
- case 5:
- addr = map & PCI_MAP_IO_ADDRESS_MASK;
- size = -(data & PCI_MAP_IO_ADDRESS_MASK);
- size &= ~(addr ^ -addr);
+ switch (data & 7) {
- pci_register_io (pcicb, addr, addr+size-1);
- pcicb->pcicb_pamount += size;
- break;
+ default:
+ continue;
+ case 1:
+ case 5:
+ addr = map & PCI_MAP_IO_ADDRESS_MASK;
+ size = -(data & PCI_MAP_IO_ADDRESS_MASK);
+ size &= ~(addr ^ -addr);
+
+ pci_register_io (pcicb, addr, addr+size-1);
+ pcicb->pcicb_pamount += size;
+ break;
- case 0:
- case 2:
- case 4:
- size = -(data & PCI_MAP_MEMORY_ADDRESS_MASK);
- addr = map & PCI_MAP_MEMORY_ADDRESS_MASK;
- if (addr >= 0x100000) {
- pci_register_memory (pcicb, addr, addr+size-1);
- pcicb->pcicb_mamount += size;
- };
- break;
- };
- if (bootverbose)
- printf ("\tmapreg[%02x] type=%d addr=%08x size=%04x.\n",
- reg, map&7, addr, size);
- };
+ case 0:
+ case 2:
+ case 4:
+ size = -(data & PCI_MAP_MEMORY_ADDRESS_MASK);
+ addr = map & PCI_MAP_MEMORY_ADDRESS_MASK;
+ if (addr >= 0x100000) {
+ pci_register_memory (pcicb, addr, addr+size-1);
+ pcicb->pcicb_mamount += size;
+ };
+ break;
+ }
+ if (bootverbose)
+ printf ("\tmapreg[%02x] type=%d addr=%08x size=%04x.\n",
+ reg, map&7, addr, size);
+ }
+ }
/*
** attach device
OpenPOWER on IntegriCloud