Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Sep 1996 22:29:54 +0200 (MET DST)
From:      Stefan Esser <se@zpr.uni-koeln.de>
To:        Peter Hawkins <peter@palin.cc.monash.edu.au>
Cc:        hackers@freebsd.org
Subject:   Re: PCI PnP question
Message-ID:  <199609112029.WAA03498@x14.mi.uni-koeln.de>
In-Reply-To: <199609070837.SAA17623@palin.cc.monash.edu.au>
References:  <199609070837.SAA17623@palin.cc.monash.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Hawkins writes:

Hi Peter!

I'm feeling responsible for the PCI code in FreeBSD,
so I'll try to get you going ... :)

 > I'm writing a driver for a pci card, but every time I plug it in (regardless
 > of whether I load the kernal with the driver) I see that ed1 (my ethernet card)
 > fails at boottime (can't clear memory c8000). I'm not really a PC person so

Is this ed1 an ISA or another PCI card ?

The ED driver supports a number of different
cards, some of which need a memory region, 
others don't (they use rep inw/outw for the 
data transfer to the cards SRAM buffer).

Best if you do a VERBOSE boot (enter "-v" at
the boot prompt, and send me the output as 
written to /var/log/messages).

 > the vagaries of it's memory management are not things I follow well. I can't
 > find any way to adjust the way the bios allocates windows to pci devices
 > so I have to assume it doesn't overlap isa. I know this particular card requires

The PCI BIOS assigns non-overlapping port and
memory addresses to each card, as required by 
the hardware. If an ISA compatible PCI card
needs memory in the >640K hole, then it is the 
card BIOS or driver that knows about this.

PCI generally uses attach addresses higher than
256MB, most often in the >3GB quadrant, in order 
to not overlap with any legacy device.

 > 16k of memory. Can anyone enlighten me here and tell me how to avoid conflicts
 > (other than moving the card to another slot).

Please boot without the card (and send me the 
verbose boot log as described above).

Then insert the new PCI card and boot again,
possibly with the Ethernet card removed (hoping
the boot will succeed, then), again with "-v".

If the boot fails, then you'll have to write down 
the corresponding probe line, something like:

pci0:15:6: vendor=0x1234, device=0x0008, class=0x01, subclass=0x00 [no driver assigned]
	map(10): mem32(fec01008)
	map(14): io(4100)

 > Also does anyone know what the bios uses as a memory mapping strategy?

This is generally not of any interest (and not
published, nor guaranteed to be the same between
BIOS releases), since it suffices to have non-
overlapping regions for each device. The PCI specs
describe how the map registers decode the size of
the mapping, and the BIOS generally scans a PCI bus
in either ascending or descending slot number, giving
each device found a memory or port range adjusted 
to its size (i.e. a 4KB mapping will start on an
address that is a multiple of 4KB) ascending or 
descending from a known unused physical address.

In my system slots appear to be scanned from low to 
high numbers, and addresses are assigned going down 
from mem addr 0xfbfff000 and port 0xf000 (don't know 
why the port addresses assigned are so far apart):

Probing for devices on PCI bus 0:
	configuration mode 2 allows 16 devices.

chip0 <Intel 82424ZX (Saturn) cache DRAM controller> rev 4 on pci0:0

ncr0 <ncr 53c810 scsi> rev 1 int a irq 9 on pci0:1
	mapreg[10] type=1 addr=0000e800 size=0100.
	mapreg[14] type=0 addr=fbfef000 size=0100.
	reg20: virtual=0xf4288000 physical=0xfbfef000 size=0x100

chip1 <Intel 82378ZB PCI-ISA bridge> rev 3 on pci0:2

vga0 <Display device> rev 0 on pci0:5
	mapreg[10] type=0 addr=fb000000 size=800000.

ed1 <NE2000 compatible PCI Ethernet adapter> rev 0 int a irq 12 on pci0:6
	mapreg[10] type=1 addr=0000e400 size=0020.

pci0: uses 8388864 bytes of memory from fb000000 upto fbfef0ff.
pci0: uses 288 bytes of I/O space from e400 upto e8ff.

Regards, STefan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609112029.WAA03498>