diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 6f3760247d4..4d88c999e18 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.50 1996/05/18 17:32:20 se Exp $ +** $Id: pci.c,v 1.51 1996/06/09 11:58:19 asami Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -77,6 +77,19 @@ **======================================================== */ +extern struct kern_devconf kdc_cpu0; + +struct kern_devconf kdc_pci0 = { + 0, 0, 0, /* filled in by dev_attach */ + "pci", 0, { MDDT_BUS, 0 }, + 0, 0, 0, BUS_EXTERNALLEN, + &kdc_cpu0, /* parent is the CPU */ + 0, /* no parentdata */ + DC_BUSY, /* busses are always busy */ + "PCI bus", + DC_CLS_BUS /* class */ +}; + struct pci_devconf { struct kern_devconf pdc_kdc; struct pci_info pdc_pi; @@ -140,6 +153,10 @@ pci_mfdev (int bus, int device); unsigned pci_max_burst_len = 3; /* 2=16Byte, 3=32Byte, 4=64Byte, ... */ unsigned pci_mechanism = 0; unsigned pci_maxdevice = 0; +unsigned pciroots = 0; /* XXX pcisupport.c increments this + * for the Orion host to PCI bridge + * UGLY hack ... :( Will be changed :) + */ static struct pcibus* pcibus; /*-------------------------------------------------------- @@ -151,15 +168,7 @@ static struct pcibus* pcibus; static int pci_conf_count; static int pci_info_done; -static struct pcicb pcibus0 = { - NULL, NULL, NULL, - { 0 }, - 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, /* real allocation */ - 0, 0xFFFF, /* iobase/limit */ - 0x2000000, 0xFFFFFFFFu, /* nonprefetch membase/limit */ - 0x2000000, 0xFFFFFFFFu /* prefetch membase/limit */ -}; +static int pcibusmax; static struct pcicb *pcicb; /*----------------------------------------------------------------- @@ -339,7 +348,7 @@ pci_bridge_config (void) /* ** Get the lowest available bus number. */ - pcicb->pcicb_bus = ++pcibus0.pcicb_subordinate; + pcicb->pcicb_bus = ++pcibusmax; /* ** and configure the bridge @@ -678,6 +687,7 @@ pci_bus_config (void) pdcp -> pdc_kdc.kdc_internalize = pci_internalize; pdcp -> pdc_kdc.kdc_datalen = PCI_EXTERNAL_LEN; + pdcp -> pdc_kdc.kdc_parent = &kdc_pci0; pdcp -> pdc_kdc.kdc_parentdata = &pdcp->pdc_pi; pdcp -> pdc_kdc.kdc_state = DC_UNKNOWN; pdcp -> pdc_kdc.kdc_description = name; @@ -927,19 +937,40 @@ void pci_configure() ** hello world .. */ - for (pcicb = &pcibus0; pcicb != NULL;) { - pci_bus_config (); + dev_attach(&kdc_pci0); - if (pcicb->pcicb_down) { - pcicb = pcicb->pcicb_down; - continue; - }; + pciroots = 1; + while (pciroots--) { - while (pcicb && !pcicb->pcicb_next) - pcicb = pcicb->pcicb_up; + pcicb = malloc (sizeof (struct pcicb), M_DEVBUF, M_WAITOK); + if (pcicb == NULL) { + return; + } + bzero (pcicb, sizeof (struct pcicb)); + pcicb->pcicb_bus = pcibusmax; + pcicb->pcicb_iolimit = 0xffff; + pcicb->pcicb_membase = 0x02000000; + pcicb->pcicb_p_membase = 0x02000000; + pcicb->pcicb_memlimit = 0xffffffff; + pcicb->pcicb_p_memlimit = 0xffffffff; - if (pcicb) - pcicb = pcicb->pcicb_next; + while (pcicb != NULL) { + pci_bus_config (); + + if (pcibusmax < pcicb->pcicb_bus) + (pcibusmax = pcicb->pcicb_bus); + + if (pcicb->pcicb_down) { + pcicb = pcicb->pcicb_down; + continue; + }; + + while (pcicb && !pcicb->pcicb_next) + pcicb = pcicb->pcicb_up; + + if (pcicb) + pcicb = pcicb->pcicb_next; + } } pci_conf_count++; } diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 6f3760247d4..4d88c999e18 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.50 1996/05/18 17:32:20 se Exp $ +** $Id: pci.c,v 1.51 1996/06/09 11:58:19 asami Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -77,6 +77,19 @@ **======================================================== */ +extern struct kern_devconf kdc_cpu0; + +struct kern_devconf kdc_pci0 = { + 0, 0, 0, /* filled in by dev_attach */ + "pci", 0, { MDDT_BUS, 0 }, + 0, 0, 0, BUS_EXTERNALLEN, + &kdc_cpu0, /* parent is the CPU */ + 0, /* no parentdata */ + DC_BUSY, /* busses are always busy */ + "PCI bus", + DC_CLS_BUS /* class */ +}; + struct pci_devconf { struct kern_devconf pdc_kdc; struct pci_info pdc_pi; @@ -140,6 +153,10 @@ pci_mfdev (int bus, int device); unsigned pci_max_burst_len = 3; /* 2=16Byte, 3=32Byte, 4=64Byte, ... */ unsigned pci_mechanism = 0; unsigned pci_maxdevice = 0; +unsigned pciroots = 0; /* XXX pcisupport.c increments this + * for the Orion host to PCI bridge + * UGLY hack ... :( Will be changed :) + */ static struct pcibus* pcibus; /*-------------------------------------------------------- @@ -151,15 +168,7 @@ static struct pcibus* pcibus; static int pci_conf_count; static int pci_info_done; -static struct pcicb pcibus0 = { - NULL, NULL, NULL, - { 0 }, - 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, /* real allocation */ - 0, 0xFFFF, /* iobase/limit */ - 0x2000000, 0xFFFFFFFFu, /* nonprefetch membase/limit */ - 0x2000000, 0xFFFFFFFFu /* prefetch membase/limit */ -}; +static int pcibusmax; static struct pcicb *pcicb; /*----------------------------------------------------------------- @@ -339,7 +348,7 @@ pci_bridge_config (void) /* ** Get the lowest available bus number. */ - pcicb->pcicb_bus = ++pcibus0.pcicb_subordinate; + pcicb->pcicb_bus = ++pcibusmax; /* ** and configure the bridge @@ -678,6 +687,7 @@ pci_bus_config (void) pdcp -> pdc_kdc.kdc_internalize = pci_internalize; pdcp -> pdc_kdc.kdc_datalen = PCI_EXTERNAL_LEN; + pdcp -> pdc_kdc.kdc_parent = &kdc_pci0; pdcp -> pdc_kdc.kdc_parentdata = &pdcp->pdc_pi; pdcp -> pdc_kdc.kdc_state = DC_UNKNOWN; pdcp -> pdc_kdc.kdc_description = name; @@ -927,19 +937,40 @@ void pci_configure() ** hello world .. */ - for (pcicb = &pcibus0; pcicb != NULL;) { - pci_bus_config (); + dev_attach(&kdc_pci0); - if (pcicb->pcicb_down) { - pcicb = pcicb->pcicb_down; - continue; - }; + pciroots = 1; + while (pciroots--) { - while (pcicb && !pcicb->pcicb_next) - pcicb = pcicb->pcicb_up; + pcicb = malloc (sizeof (struct pcicb), M_DEVBUF, M_WAITOK); + if (pcicb == NULL) { + return; + } + bzero (pcicb, sizeof (struct pcicb)); + pcicb->pcicb_bus = pcibusmax; + pcicb->pcicb_iolimit = 0xffff; + pcicb->pcicb_membase = 0x02000000; + pcicb->pcicb_p_membase = 0x02000000; + pcicb->pcicb_memlimit = 0xffffffff; + pcicb->pcicb_p_memlimit = 0xffffffff; - if (pcicb) - pcicb = pcicb->pcicb_next; + while (pcicb != NULL) { + pci_bus_config (); + + if (pcibusmax < pcicb->pcicb_bus) + (pcibusmax = pcicb->pcicb_bus); + + if (pcicb->pcicb_down) { + pcicb = pcicb->pcicb_down; + continue; + }; + + while (pcicb && !pcicb->pcicb_next) + pcicb = pcicb->pcicb_up; + + if (pcicb) + pcicb = pcicb->pcicb_next; + } } pci_conf_count++; } diff --git a/sys/pci/pcisupport.c b/sys/pci/pcisupport.c index 713ea036ec7..ea57e08e5dd 100644 --- a/sys/pci/pcisupport.c +++ b/sys/pci/pcisupport.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcisupport.c,v 1.32 1996/02/17 23:57:04 se Exp $ +** $Id: pcisupport.c,v 1.33 1996/04/07 17:32:36 bde Exp $ ** ** Device driver for DEC/INTEL PCI chipsets. ** @@ -51,6 +51,8 @@ #include #include +static void config_orion (pcici_t tag); + /*--------------------------------------------------------- ** ** Intel chipsets for 486 / Pentium processor @@ -128,9 +130,21 @@ chipset_probe (pcici_t tag, pcidi_t type) return ("Intel 82434NX (Neptune) PCI cache memory controller"); return ("Intel 82434LX (Mercury) PCI cache memory controller"); case 0x122d8086: - return ("Intel 82437 (Triton) PCI cache memory controller"); + return ("Intel 82437FX PCI cache memory controller"); case 0x122e8086: - return ("Intel 82371 (Triton) PCI-ISA bridge"); + return ("Intel 82371FB PCI-ISA bridge"); + case 0x12308086: + return ("Intel 82371FB IDE interface"); + case 0x70008086: + return ("Intel 82371SB PCI-ISA bridge"); + case 0x70108086: + return ("Intel 82371SB IDE interface"); + case 0x12378086: + return ("Intel 82440FX (Natoma) PCI and memory controller"); + case 0x84c48086: + return ("Intel 82450KX (Orion) PCI memory controller"); + case 0x84c58086: + return ("Intel 8245??? (Orion) host to PCI bridge"); case 0x04961039: return ("SiS 85c496"); case 0x04061039: @@ -581,6 +595,21 @@ writeconfig (pcici_t config_id, const struct condmsg *tbl) } } +#ifdef DUMPCONFIGSPACE +static void +dumpconfigspace (pcici_t tag) +{ + int reg; + printf ("configuration space registers:"); + for (reg = 0; reg < 0x100; reg+=4) { + if ((reg & 0x0f) == 0) + printf ("\n%02x:\t", reg); + printf ("%08x ", pci_conf_read (tag, reg)); + } + printf ("\n"); +} +#endif /* DUMPCONFIGSPACE */ + #endif /* PCI_QUIET */ static void @@ -616,6 +645,9 @@ chipset_attach (pcici_t config_id, int unit) case 0x122e8086: writeconfig (config_id, conf82371fb); break; + case 0x84c48086: /* Intel Orion */ + config_orion (config_id); + break; #if 0 case 0x00011011: /* DEC 21050 */ case 0x00221014: /* IBM xxx */ @@ -762,3 +794,21 @@ ign_probe (pcici_t tag, pcidi_t type) static void ign_attach (pcici_t tag, int unit) {} + +/*--------------------------------------------------------- +** +** special PCI chip set devices +** +**--------------------------------------------------------- +*/ + +extern unsigned pciroots; + +static void +config_orion (pcici_t tag) +{ + if (pci_conf_read (tag, 0x4A) > 0) { + pciroots++; + } +} +