Subject: How to enable PCI devices?
To: None <tech-kern@netbsd.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: tech-kern
Date: 03/07/2003 12:40:00
Hi.

I am working on the MD code for port-ofppc to support the Motorola
PowerStack II.=20
I got the PCI attachment going, but the drivers for PCI devices don't
work, as the Openfirmware disables all PCI devices besides the PCI-ISA
bridge. (I don't have a working ISA attachment jet.) From dmesg:

powerstackII0 at mainbus0: IBM 27-82660 PCI Bridge, rev. 0x02
pci0 at powerstackII0 bus 0
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pcib0 at pci0 dev 11 function 0
pcib0:
pcib0: vendor 0x10ad product 0x0565 (rev. 0x10)
pciide0 at pci0 dev 11 function 1: Symphony Labs 82C105 IDE controller
(rev. 0x05)
pciide0: device disabled (at device)
siop0 at pci0 dev 12 function 0: Symbios Logic 53c825a (fast wide scsi)
siop0: unable to map device registers
tlp0 at pci0 dev 14 function 0: DECchip 21140A Ethernet, pass 2.2
: unable to map device registers
vendor 0x1013 product 0x00b8 (VGA display) at pci0 dev 18 function 0 not
configured

The device registers can't be maped as the bits PCI_COMMAND_IO_ENABLE
and PCI_COMMAND_MEM_ENABLE in the device PCI_COMMAND_STATUS_REG are
cleard by the Openfirmware. pci_probe_device() checks this bits via
pci_conf_read() and clears them in the device pci_attach_args that are
supplied to the device driver during match / attach. The device driver
in turn uses this pci_attach_args to do a pci_mapreg_map().
pci_mapreg_map() cheks the bits if mapping is allowed and fails if not.
Thus the pci drivers can't map the device registers and therefore fail.=20

Now the question of the day is: What is the proper way to get the PCI
devices enabled?
Some settings in the Openfirmware to get the Openfirmware to enable the
device?
Some MD code, e.g. in powerstackII_pci_attach_hook(), that walks through
the PCI config space and enables all devices by setting
PCI_COMMAND_IO_ENABLE and PCI_COMMAND_MEM_ENABLE?
Some MI code to call somewhere?
???=20
--=20


tsch=FC=DF,
       Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/