Specifications

Red Hat Enterprise Linux to Oracle Solaris Porting Guide
62
Best Practices for Porting Device Drivers and Kernel Modules
The porting of device drivers from one platform to the other might not be an easy job, because of one
or more of the following reasons:
To enhance functionality, in newer versions of an operating system, new members get added to the
kernel data structures accessed by drivers, or the size of existing members gets redefined.
The calling or return syntax of kernel functions gets changed.
Driver developers do not use existing kernel functions when they are available, but instead they rely
more on undocumented side effects. The issue arises particularly when these functions and their
behavior are not maintained in the next release of an operating system.
Architecture-specific code is scattered throughout the driver, when it should have been isolated.
Isolating the portable code from nonportable helps reduce porting issues.
The Oracle Solaris DDI and DKI enable you to write platform-independent device drivers, that is,
drivers which work on any machine that runs Oracle Solaris. These binary-compatible drivers enable
you to more easily integrate any third-party hardware and software into any machine that runs Oracle
Solaris. The DDI and DKI are architecture-independent, which enables the same driver to work across
a diverse set of machine architectures (SPARC as well as x86).
The primary goal of the DDI and DKI is to facilitate both source and binary portability across
successive releases of the operating systems on a particular machine. Based on your hardware and
software support metric requirements, to achieve the goal of source and binary compatibility, the
functions, routines, and structures specified in the DDI and DKI must be used taking the following
facts into consideration.
The DDI and DKI consist of several sections:
Oracle Solaris SPARC-specific DDI: These interfaces are specific to the SPARC processor and
might not be available on other processors supported by Oracle Solaris.
Oracle Solaris x86-specific DDI: These interfaces are specific to the x86 processor and might not
be available on other processors supported by Oracle Solaris.
Oracle Solaris DDI: These interfaces are specific to Oracle Solaris.
DKI-only: These interfaces are part of System V Release 4 and might not be supported in future
releases of System V. There are only two interfaces in this class: segmap and
hat_getkpfnum.
DDI/DKI Architecture Independent: These interfaces are supported on all implementations of
System V Release 4.
Drivers that use only kernel facilities that are part of the DDI/DKI are known as
DDI/DKI-compliant device drivers.