Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 1996 22:26:51 +0200 (MET DST)
From:      Stefan Esser <se@zpr.uni-koeln.de>
To:        Peter Hawkins <peter@palin.cc.monash.edu.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   PCI driver
Message-ID:  <199607222026.WAA03971@x14.mi.uni-koeln.de>
In-Reply-To: <199607201618.CAA25065@palin.cc.monash.edu.au>
References:  <199607201618.CAA25065@palin.cc.monash.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Hawkins writes:
 > I am looking to port the cyclom driver cy to PCI - has anyone got any
 > tips they can send me on porting a driver from ISA to PCI generally?
 > Is there any documentation you can recommend?

Hi!

I'm the maintainer of the PCI code, and I do
of course know how to port a driver to PCI.
And though I had thought about writing down
the necessary steps, I just didn't have the
time, yet.

You have to get rid of all references to the
isa_device struct. The interrupt handler has
got a different parameter (generally a pointer
to some parameter block for the device instance
that issued the interrupt, while ISA device 
interrupt handlers are called with a unit number).

And of course you have to recognize the device 
in the PCI probe phase and to write the attach
code, which will take care of mapping the 
device's registers to VM (for a memory mapped
device, the prefered method for PCI devices,
since not all PCI systems support the concept
of I/O ports) and of registering the interrupt
handler.

An example of how this is done is the NE2000
driver, which I recently modified for PCI
(/sys/i386/isa/if_ed.c + /sys/pci/if_ed_p.c).

Just use a context diff between the pre-PCI
version and the current version to see the 
changes to the existing ISA code and study
the if_ed_p.c file for a simple example of
the attach code.

I haven't looked into this in detail, but I
guess that converting the Cyclom driver is 
only a matter of half an hour ...

Let me know if you have got further questions.

Regards, STefan



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