Writing Device Drivers for the Solaris OS
In this space you can help improve the Writing Device Drivers book. Please apply your expertise to make this book more understandable, more useful. Please clarify or add to the text, examples, or graphics.
I would appreciate your contributions on the wiki. Please be sure to note the Terms of Use of this site. Preferably, contributors should have a Sun Contributor Agreement (SCA) in place. Please do not use Quiet Save.
| Comments Welcome To make a comment on a page, log in, and then select Add>Comment from the menu near the top of the page. |
CommunityOne Deep Dive
Solaris Device Drivers [PDF], Max Bruning. Three-hour deep dive session given at CommunityOne West 2009. Topics include kernel architecture, device registers, interrupt handling, DMA, ioctl handling, fault management, timers and threads, STREAMS, GLDv3, SCSA, USB, and debugging drivers, including using MDB.
Debugging and Testing Tips
Hardening Solaris Device Drivers
Chapter 13, "Hardening Solaris Drivers," has been separated to give it more attention. All Solaris and OpenSolaris drivers must be hardened to a certain level. Documentation needs to be added on exactly what that minimum level is. Also, we should add information on how to harden specific types of drivers.
Drivers for Network Devices (GLD)
The GLD chapter, "Chapter 19, Drivers for Network Devices," needs a rewrite. The very first sentence, "Solaris network drivers are STREAMS-based." is not accurate. Perhaps this documentation is satisfactory for Solaris 10, but it is way out of date for OpenSolaris.
GLDv3 Porting Guide
The GLDv3 Porting Guide describes how to port drivers to from GLDv2 architecture to GLDv3 architecture. This porting guide is out of date and needs a rewrite.
Direct Memory Access (DMA)
The DMA chapter, "Chapter 9, Direct Memory Access (DMA)," has a comment from a community member that needs to be addressed.
Do you have ideas to help address CR 6552987:
"I did have issues with handling of partial DMA transfers, which I don't feel was explained that well in WDD. I got better examples from source code for other drivers in the OpenSolaris tree. That deserves some more text, especially dealing with dma windows, the fact that you can't reiterate over the dma cookies (requiring you to stash them yourself), and the fact that you have to deal with partial dma windows."
Can you help add information about ddi_umem_iosetup(9F) to the DMA chapter? CR 4630654
Comments (5)
Jun 25, 2009
pavel-p says:
Page 320, Writing Device Drivers • September 2008 5. Handle the interrupting de...Page 320, Writing Device Drivers • September 2008
5. Handle the interrupting device.
When the device finishes the data transfer, the driver generates an interrupt....
Should be:
5. Handle the interrupting device.
When the device finishes the data transfer, the device generates an interrupt....
Jun 25, 2009
Alta says:
Thank you, Pavel! I have just made this change, but it might be a week or two be...Thank you, Pavel! I have just made this change, but it might be a week or two before I get the change published.
Comments are welcome!
Jul 16, 2009
pavel-p says:
Another trivial: Code examples on pages 122,123 Writing Device Drivers • Septem...Another trivial:
Code examples on pages 122,123 Writing Device Drivers • September 2008, have several indentation issues.
e.g.
if (ddi_regs_map_setup(dip, CSR_REG, (caddr_t *)&(pio_p->csr), 0,
sizeof (Pio_csr), &dev_acc_attr, &pio_p->csr_handle) != DDI_SUCCESS){
some_code_not_indented_properly
}
thanks
Jul 14, 2009
pavel-p says:
Hi Alta, It would be great if "Writing Device Drivers" had a chapter covering P...Hi Alta,
It would be great if "Writing Device Drivers" had a chapter covering PCI device drivers, as well as a chapter on nexus drivers.
For instance, struct bus_ops is not mentioned anywhere.
thanks
Jul 17, 2009
Alta says:
I have always been told that we do not need to document nexus drivers in the Wri...I have always been told that we do not need to document nexus drivers in the Writing Device Drivers doc because only Sun writes them. I checked again, and this is the response I got:
The PCI-e nexus driver is primarily written by Sun/Solaris kernel internals team. We typically do not need to add information about writing nexus drivers. They are not in conformance to any standard DDI/DKI and provide no developer value unless it is a new system platform. The bus architecture driver should be implemented by our kernel team since the calls to the kernel, some protected, and some that do evolve, shields the folks writing to the DDI/DKI from experiencing the rapid changes and loss of ABI compatibility.
PCI device drivers for leaf node devices are covered in detail in the WDD. Specifically, the samples in there are all about character and block devices.