Hello I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well. TIA & Cheers
On Tue, 25 Jan 2005 15:00:37 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Hello I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
TIA & Cheers
Good Luck, I'm familiar with Sys V UNIX drivers and I've tried to look at the Linux kernel driver code. It is very different. The USB code in particular is very difficult to navigate, so don't use that as a reference unless you have to. I don't think the kernel has a PCI driver concept. They do have IDE, SATA, USB, SCSI, Video, Serial etc. So what subsystem is your driver for? Also, can your driver be converted into kernel module? If so, that really is the best way to go. FYI: I know the libata driver (for SATA drives) is newly written for 2.6 and supports DMA. Unfortunately it is layered below the SCSI layer, so the upper level interface is not very generic, but the lower level PCI interaction may be a good reference for you. FYI2: When SGI wanted to port XFS to linux, they first tried it with there own people. They were able to succeed from a purely technical perspective, but were unable to get mainline kernel acceptance. Finally they brought in a trusted Linux Kernel Developer as a consultant to rework the code. (ie. the kernel developers have become very picky about the structure of code being formally added to the kernel.) Greg -- Greg Freemyer
Greg Freemyer wrote:
On Tue, 25 Jan 2005 15:00:37 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Hello I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
TIA & Cheers
Good Luck,
I'm familiar with Sys V UNIX drivers and I've tried to look at the Linux kernel driver code. It is very different. The USB code in particular is very difficult to navigate, so don't use that as a reference unless you have to.
I don't think the kernel has a PCI driver concept.
They do have IDE, SATA, USB, SCSI, Video, Serial etc.
So what subsystem is your driver for?
Also, can your driver be converted into kernel module? If so, that really is the best way to go.
FYI: I know the libata driver (for SATA drives) is newly written for 2.6 and supports DMA. Unfortunately it is layered below the SCSI layer, so the upper level interface is not very generic, but the lower level PCI interaction may be a good reference for you.
FYI2: When SGI wanted to port XFS to linux, they first tried it with there own people. They were able to succeed from a purely technical perspective, but were unable to get mainline kernel acceptance. Finally they brought in a trusted Linux Kernel Developer as a consultant to rework the code. (ie. the kernel developers have become very picky about the structure of code being formally added to the kernel.)
Greg
Thanks for the input. Our PCI device is meant to accept four channels of analog signals, perform some A/D magic and jam the values into RAM so a user process can access them and perform some further analysis. I don't expect the Linux kernel group to ever see this code. We want to load a module at boot time and let the needed process perform open/read/write/ioctl/close on the appropriate /dev/whatever.
On Tue, 25 Jan 2005 15:57:00 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Greg Freemyer wrote:
On Tue, 25 Jan 2005 15:00:37 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Hello I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
TIA & Cheers
Good Luck,
I'm familiar with Sys V UNIX drivers and I've tried to look at the Linux kernel driver code. It is very different. The USB code in particular is very difficult to navigate, so don't use that as a reference unless you have to.
I don't think the kernel has a PCI driver concept.
They do have IDE, SATA, USB, SCSI, Video, Serial etc.
So what subsystem is your driver for?
Also, can your driver be converted into kernel module? If so, that really is the best way to go.
FYI: I know the libata driver (for SATA drives) is newly written for 2.6 and supports DMA. Unfortunately it is layered below the SCSI layer, so the upper level interface is not very generic, but the lower level PCI interaction may be a good reference for you.
FYI2: When SGI wanted to port XFS to linux, they first tried it with there own people. They were able to succeed from a purely technical perspective, but were unable to get mainline kernel acceptance. Finally they brought in a trusted Linux Kernel Developer as a consultant to rework the code. (ie. the kernel developers have become very picky about the structure of code being formally added to the kernel.)
Greg
Thanks for the input. Our PCI device is meant to accept four channels of analog signals, perform some A/D magic and jam the values into RAM so a user process can access them and perform some further analysis. I don't expect the Linux kernel group to ever see this code. We want to load a module at boot time and let the needed process perform open/read/write/ioctl/close on the appropriate /dev/whatever.
Sounds like as simple of a driver as you could get. :-) Are you going to handle interrupts? Sleeps due to slow response (like a disk seek, or slow magic ). If I were you I would get Linux Device Drivers, 2nd Edition. Unfortunately it is for 2.4, not 2.6 and the module API changed I believe. That book has some sample 2.4 drivers. Then I would join the kernelnewbies mailing list so you have a good place to ask easy questions. (The LKML list users don't seem to respond to average users/questions.) And as I said, I would look at libata for my PCI interface logic. Just be sure not to try to re-use too much of it. (ie. It will be overly complex for what you are trying to do.) Another place you might look is IDE-TAPE, it is an older drvier that was ported from 2.4. Unfortunately, the above is about the end of my knowledge. :-( HTH Greg -- Greg Freemyer
Greg Freemyer wrote:
On Tue, 25 Jan 2005 15:57:00 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Greg Freemyer wrote:
On Tue, 25 Jan 2005 15:00:37 -0800, Pierre Patino <pierre@cruzio.com> wrote:
Hello I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
TIA & Cheers
Good Luck,
I'm familiar with Sys V UNIX drivers and I've tried to look at the Linux kernel driver code. It is very different. The USB code in particular is very difficult to navigate, so don't use that as a reference unless you have to.
I don't think the kernel has a PCI driver concept.
They do have IDE, SATA, USB, SCSI, Video, Serial etc.
So what subsystem is your driver for?
Also, can your driver be converted into kernel module? If so, that really is the best way to go.
FYI: I know the libata driver (for SATA drives) is newly written for 2.6 and supports DMA. Unfortunately it is layered below the SCSI layer, so the upper level interface is not very generic, but the lower level PCI interaction may be a good reference for you.
FYI2: When SGI wanted to port XFS to linux, they first tried it with there own people. They were able to succeed from a purely technical perspective, but were unable to get mainline kernel acceptance. Finally they brought in a trusted Linux Kernel Developer as a consultant to rework the code. (ie. the kernel developers have become very picky about the structure of code being formally added to the kernel.)
Greg
Thanks for the input. Our PCI device is meant to accept four channels of analog signals, perform some A/D magic and jam the values into RAM so a user process can access them and perform some further analysis. I don't expect the Linux kernel group to ever see this code. We want to load a module at boot time and let the needed process perform open/read/write/ioctl/close on the appropriate /dev/whatever.
Sounds like as simple of a driver as you could get. :-)
Are you going to handle interrupts?
Sleeps due to slow response (like a disk seek, or slow magic ).
If I were you I would get Linux Device Drivers, 2nd Edition.
Unfortunately it is for 2.4, not 2.6 and the module API changed I believe.
That book has some sample 2.4 drivers.
Then I would join the kernelnewbies mailing list so you have a good place to ask easy questions. (The LKML list users don't seem to respond to average users/questions.)
And as I said, I would look at libata for my PCI interface logic. Just be sure not to try to re-use too much of it. (ie. It will be overly complex for what you are trying to do.)
Another place you might look is IDE-TAPE, it is an older drvier that was ported from 2.4.
Unfortunately, the above is about the end of my knowledge. :-(
HTH Greg
Yes your inputs have helped. I've got the book too. There is interrupt management since the card has a buffer which must be emptied periodically. I've been grepping through sourceforge and have found some chunks of code. Hopefully the 2.6 API is not too different. I didn't know about kernelnewbies. Thanks
On Wednesday 26 January 2005 00:00, Pierre Patino wrote:
I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
I would recommend one of the kernel hackers lists for issues like this. You might want to check http://www.kernel.org/ (and of course the FAQs there). CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SUSE Linux Products GmbH Nuernberg, Germany
Stefan Hundhammer wrote:
On Wednesday 26 January 2005 00:00, Pierre Patino wrote:
I've been tasked to port a PCI device from Solaris to Linux. I know something about Solaris drivers and next to nothing about Linux drivers. Can someone point me to their favorite example of a PCI driver that they used as a starting point? There's a fair bit of DMA involved as well.
I'd suggest you the following book:Linux Device Drivers, 2nd Edition http://www.oreilly.com/catalog/linuxdrive2/ the 2nd Edition is also fully available on-line (as pdf): http://www.xml.com/ldd/chapter/book/index.html Ciao Giovanni
participants (4)
-
Giovanni Racciu
-
Greg Freemyer
-
Pierre Patino
-
Stefan Hundhammer