Subject: Re: Quick question about autoconf and the emuxki driver
To: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
From: Mark Kirby <mark@coris.org.uk>
List: tech-kern
Date: 11/11/2004 11:44:14
On Wednesday 10 November 2004 17:21, Jochen Kunz wrote:
> On Wed, 10 Nov 2004 10:13:33 +0000
>
> Mark Kirby <mark@coris.org.uk> 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?
>
> 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... ;-)

ahhh that makes it really clear.

Thanks to both of you for the great help.

I think i'm up to speed enough to make a 1st pass at midi support now.

Thanks again.

Mark