Subject: ahc and ServerWorks chipset
To: None <port-i386@netbsd.org>
From: Ben S. <bliss22@nebulous.org>
List: port-i386
Date: 08/31/2001 12:36:35
In may, paul hoffman posted about a problem he was having
spiffy new Dell system, which didn't get resolved.

I had the same problem on a Dell PowerEdge 2500 that has
the same ServerWorks CNB20HE chipset, and found out what
was going on.  This is using kernel source from the 1.5
tree.

The pci configuration looks like:

pci0 at mainbus0 bus 0
    pchb0 at pci0 dev 0 function 0
    pchb1 at pci0 dev 0 function 1
    pchb2 at pci0 dev 0 function 2
        ppb0 at pci2 dev 2 function 0
            ahc0 at pci3 dev 4 function 0
            ahc1 at pci3 dev 4 function 1     
    ...

When ahc tries to attach, the message is "unable to map
registers", because i/o space isn't enabled on bus pci3.
It was disabled for the pci-pci bridge ppb0, because its
parent host bridge pchb2 reports that i/o space is off.

I saw that the section that attached the pci-pci bridges 
for the Intel NX chipset ignored what was enabled on host
bridge, and used pci_bus_flags() instead.  I did the same:

diff -u -r1.18.4.1 pchb.c
--- pchb.c	2000/10/30 23:30:18	1.18.4.1
+++ pchb.c	2001/08/30 21:21:27
@@ -128,7 +128,7 @@
 		pba.pba_memt = pa->pa_memt;
 		pba.pba_dmat = pa->pa_dmat;
 		pba.pba_bus = pbnum;
-		pba.pba_flags = pa->pa_flags;
+		pba.pba_flags = pci_bus_flags();
 		pba.pba_pc = pa->pa_pc;
 		config_found(self, &pba, pchb_print);
 		break;

after which ahc worked!.  It's been running a couple
weeks now.  The same bit is slightly different in -current;
for all the host bridges, pba.pba_flags is inherited from
pa->pa_flags, and so the problem is there, too.

Seperate but related: one of the things i tried was
enabling PCIBIOS_BUS_FIXUP.  It didn't recurse through
pchb2; i think it needs:

diff -u -r1.1 pci_bus_fixup.c
--- pci_bus_fixup.c	1999/11/17 07:32:58	1.1
+++ pci_bus_fixup.c	2001/08/30 21:19:38
@@ -100,6 +100,7 @@
 			reg = pci_conf_read(pc, tag, PCI_CLASS_REG);
 			if (PCI_CLASS(reg) == PCI_CLASS_BRIDGE &&
 			    (PCI_SUBCLASS(reg) == PCI_SUBCLASS_BRIDGE_PCI ||
+			     PCI_SUBCLASS(reg) == PCI_SUBCLASS_BRIDGE_HOST ||
 			     PCI_SUBCLASS(reg) == PCI_SUBCLASS_BRIDGE_CARDBUS)) {
 				/* Assign the bridge #. */
 				bridge = bridge_cnt++;


I'm new to this stuff, so i wanted to see if the changes
seemed right.  I'll send-pr if it.

ben