Subject: Re: Quick question about autoconf and the emuxki driver
To: Mark Kirby <>
From: Jochen Kunz <>
List: tech-kern
Date: 11/10/2004 18:21:09
On Wed, 10 Nov 2004 10:13:33 +0000
Mark Kirby <> wrote:

> Ok i understand what you are saying, but how does the pci bus driver
> know that the card has these functions, does it somehow ask the card
> what functions it has?=20
Yes. PCI devices have a "configuration space" where various informations
about the device is readable. (And some config items are writeable, eg.
to enable bus master operation for the device.) One information is
the device type. There are several pre defined PCI device types in the
PCI spec. So when the PCI bus driver reads a certain value out of a
certain PCI config register it knows immediately that the device is a
Ethernet card or VGA or ... or Firewire or ... There are generic groups
like the mentioned "miscellaneous input".

Don't confuse the device type with the PCI function. A PCI device is
described by bus-number,device-number,function-number. Each PCI slot has
a unique device-number in the range 0..31. This device-numbers are
defined by the main board hardware. (PCI bridge and wire routing on the
board) Usually PCI cards have only a single device at function-number 0.
Some cards have multiple devices in a single chip. In that case you
have PCI functions 0, 1, 2, ... at a single PCI device-number. There is
a max. of 8 functions per device. Each PCI function is a separate and
independent PCI device.

> I'm sorry these questions are elementary, the document by Jochen Kunz
> "Writing drivers for NetBSD" does not cover devices with multiple
> functions.
The different fuctions are a special property of the PCI bus and as my
document doesn't cover PCI yet... ;-)