Subject: Re: PCI configuration problem
To: None <martin@duskware.de, tech-kern@netbsd.org>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 01/10/2001 17:42:25
	--ELM979107227-819-1_
	Content-Transfer-Encoding: 7bit
	Content-Type: text/plain; charset=US-ASCII

	I'm not sure this is a driver issue or a general bug:

	I've added a PCI ISDN card to my sparc64 system (U5). I don't know if I have
	to tell OF about this (and if so, how), so I just rebooted.

No, OFW should proble the PCI slot itself and load any
Fcode drivers on the card.  If there is no Fcode then
it will read whatever information is available from PCI
config space.

	I don't have docs about the card, so I don't realy know what the various
	BARs are, but the driver worked on i386. 

I'm not certain that the OFW will configure BARs...

	Part of the dump (full dump below):

	vendor 0x108e product 0x5000 (PCI bridge, revision 0x11) at ? dev 1 function 0 (tag 0x800, intrtag 0x800, intrswiz 0, intrpin 0, i/o on, mem on, no quirks): vendor 0x108e product 0x5000 (rev. 0x11)
	pci1 at simba0 bus 2
	pci1: i/o space, memory space enabled
	isic0 at pci1 dev 1 function 0: PCI configuration registers:
	  Common header:
	    0x00: 0x0a001244 0x02800002 0x02800002 0x00000000

	    Vendor ID: 0x1244
	    Device ID: 0x0a00
	    Command register: 0x0002
	      I/O space accesses: off
	      Memory space accesses: on

	    [...]

	    Base address register at 0x14
	      type: 32-bit i/o
	      base: 0x00000400, size: 0x00000020

	Now I'm trying to map BAR 0x14 in io space, but: I/O space accesses: off.

I/O space access is off by default.  The drivers need to turn it on to use
I/O space.

	So the pci_attach_arg I get has pa->pa_flags without the io enabled bit and
	pci_mapreg_map fails accordingly. (The other errors included in the dump
	are because of my idiotic try to map this io space BAR in mem space).

That probably won't work since cacheing is different between
I/O space and memory space.

	So, is this a failure of the firmware? An error in the pci bridge code?
	Did I miss something?

All you should need to do is tweak the bit in the PCI
config register to turn I/O space on.  The psycho/sabre/simba
code should be turning on I/O space.  If you have another
PCI-PCI bridge then it may need to be modified to turn on
PCI I/O space.

Eduardo