Subject: Re: How to write a driver for a new PCI device?
To: Brett Lymn <>
From: Eduardo E. Horvath <>
List: tech-kern
Date: 03/02/2000 09:21:57
[I dropped port-i386 from the list rather than add 3/4 of the other
port mailing lists.]

It's a good start, but most of that seems to be generic `how to write
a driver' stuff that should already be covered in the daemon book.

The two things we really need documented are how to use the bus_space*
and bus_dma* interfaces, and the specific bus-dependent details:

	How is a device identified?

	How are the registers (memory space/io space/config space)
		mapped in?

	How do you access the registers once they are mapped in?

	How do you set up DMA?

	How do you hook up your driver's interrupt handler?

	How do you enable your device's interrupts?

	What do you need to do to detach your driver?

	Architecture specific `gotcha's would also be nice.

That's not to say that the bus_space* stuff is not documented, but a
tutorial would be nice, and easier to plough through than the current

I suppose I could provide some of the SBus details.

(I can't help you with PCI since I haven't poked around in the guts
of the PCI framework enough yet.  Although that may change soon.)

P.S.  One thing that bugs me a bit about the current PCI framework is
that there's no way to make use of any information provided by Open
Firmware to simplify the probing and attach process.  Sort of forces
you to probe all slots.

Eduardo Horvath
	"I need to find a pithy new quote." -- me