📄 drivertut7.html
字号:
structure and its associated members.
</td>
</tr>
</tbody></table><p>
<a name="PortingDevDrvsCurVersUNIX"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="drivertut7_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="drivertut7_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#PortUNIXDrvs"><img src="drivertut7_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#CheckDataStructs"><img src="drivertut7_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#PortIssueMethodRegIntrptRtns"><img src="drivertut7_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut8.html"><img src="drivertut7_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="drivertut7_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="drivertut7_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h2>
4.2 Updating Device Drivers to the Current Version of the Digital UNIX Operating System
</h2>
<p>
This section is for driver writers who have already written device
drivers for previous versions of the operating system.
</p><p>
The following list summarizes the issues you need to consider when
deciding whether to update device drivers written on previous versions
of the operating system to the current version of
Digital UNIX.
Although existing device drivers are binary compatible with the current
version of Digital UNIX, you might want to make these changes
to take advantage of the single binary module technology.
</p><ul>
<p></p><li>
Method for registering interrupt handlers
<p></p></li><li>
Method for registering block and character device driver interfaces
<p></p></li><li>
Use of the bus-specific option structure and structure snippet
<p></p></li><li>
Driver object files
<p></p></li><li>
Elimination of the
<tt>stanza.static</tt>
file fragment
<p></p></li><li>
Elimination of the
<tt>stanza.loadable</tt>
file fragment
<p></p></li><li>
Changes to the
<tt>files</tt>
file fragment
<p></p></li><li>
Elimination of the
<tt>config.file</tt>
file fragment
<p></p></li><li>
Method for configuring and unconfiguring controllers
<p></p></li><li>
Method for identifying bus, controller, and device information
<p></p></li><li>
Use of
<tt><var>name</var>_data.c </tt>files
<p></p></li><li>
Method for specifying device special file information
<p></p></li><li>
Use of device driver header file
</li></ul><p>
The following sections provide details on each of these issues.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut7.html#PortIssueListofRtnsRetired">Section 4.2.14</a>
lists the interfaces that will be retired in a future release of
Digital UNIX and the
replacement interface, if applicable.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut7.html#PortIssueListofStructsRetired">Section 4.2.15</a>
lists the data structures that will be retired in a future release of
Digital UNIX and the
replacement structure, if applicable.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut7.html#PortIssueListofstanzaFieldsRetired">Section 4.2.16</a>
lists the fields used in the
<tt>sysconfigtab</tt>
file fragment (formerly, the
<tt>stanza.static</tt>
and
<tt>stanza.loadable</tt>
file fragments) that will be retired in a future release of Digital UNIX.
<a name="PortIssueMethodRegIntrptRtns"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="drivertut7_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="drivertut7_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#PortUNIXDrvs"><img src="drivertut7_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#PortingDevDrvsCurVersUNIX"><img src="drivertut7_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#PortIssueMethodRegDrvRtns"><img src="drivertut7_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut8.html"><img src="drivertut7_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="drivertut7_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="drivertut7_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
4.2.1 Method for Registering Interrupt Handlers
</h3>
<p>
<a name="nx_id_161"></a>
In previous versions of the operating system, you could do the following:
</p><ul>
<p></p><li>
For drivers statically configured into the kernel
<p>
For statically configured drivers operating on the EISA bus, ISA bus,
TURBOchannel bus, and VMEbus, you could specify the associated interrupt
handlers in the
<tt>config.file</tt>
file fragment or target (system) configuration file.
</p><p></p></li><li>
For drivers statically or dynamically configured into the kernel
<p>
For statically or dynamically configured drivers operating on the PCI bus
and for dynamically configured drivers operating on the EISA bus, ISA
bus, and TURBOchannel bus you had to use the
<tt>handler</tt>
interfaces to register the associated interrupt handlers.
</p></li></ul><p>
</p><p>
Digital recommends that you register interrupt handlers for
statically and dynamically configured drivers operating on any
Digital-supported bus
(EISA, ISA, PCI, and TURBOchannel) by using the
<tt>ihandler_t</tt>
and
<tt>handler_intr_info</tt>
structures and by calling the
<tt>handler</tt>
interfaces.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut11.html#RegISIswithhandlerRtns">Section 7.1.6</a>
shows how to accomplish this task.
You typically register interrupt handlers in the driver's
<tt>probe</tt>
interface.
</p><p>
For the VMEbus, you call the
<tt>handler</tt>
interfaces, but instead of using the
<tt>handler_intr_info</tt>
structure, you use the
<tt>vme_handler_info</tt>
structure.
One of the members of the
<tt>vme_handler_info</tt>
structure is a
<tt>handler_intr_info</tt>
structure.
</p><p>
Because the method for registering interrupt handlers is through the
<tt>handler</tt>
interfaces, device drivers should no longer be calling the
<tt>enable_option</tt>
and
<tt>disable_option</tt>
interfaces.
The
<tt>enable_option</tt>
and
<tt>disable_option</tt>
interfaces will be retired in a future release of Digital UNIX.
<a name="PortIssueMethodRegDrvRtns"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="drivertut7_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="drivertut7_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#PortUNIXDrvs"><img src="drivertut7_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#PortIssueMethodRegIntrptRtns"><img src="drivertut7_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#PortIssueUseofOptionStruct"><img src="drivertut7_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut8.html"><img src="drivertut7_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="drivertut7_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="drivertut7_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
4.2.2 Method for Registering Character and Block Device Driver Interfaces
</h3>
<p>
<a name="nx_id_162"></a>
<a name="nx_id_163"></a>
In previous versions of the operating system, you could do the following:
</p><ul>
<p></p><li>
For drivers statically configured into the kernel
<p>
For the third-party device driver configuration model, you specified
the entry points for the I/O services interfaces (and other information)
for block and character device drivers in the
<tt>stanza.static</tt>
file fragment.
For the traditional model, you edited the
<tt>bdevsw</tt>
and/or
<tt>cdevsw</tt>
tables in the
<tt>conf.c</tt>
file with the entry points for the I/O services interfaces (and other
information) for block and character drivers.
</p><p></p></li><li>
For drivers dynamically configured into the kernel
<p>
For block device drivers, you added
the entry points for the I/O services interfaces (and other information)
to the
<tt>bdevsw</tt>
table by calling the
<tt>bdevsw_add</tt>
interface in the driver's
<tt>configure</tt>
interface.
</p><p>
For character device drivers, you added
the entry points I/O services interfaces (and other information) to the
<tt>cdevsw</tt>
table by calling the
<tt>cdevsw_add</tt>
interface in the driver's
<tt>configure</tt>
interface.
</p><p>
For block and character device drivers, you added
the entry points for the I/O services interfaces (and other information) to the
<tt>bdevsw</tt>
and
<tt>cdevsw</tt>
tables by calling the
<tt>dualdevsw_add</tt>
interface in the driver's
<tt>configure</tt>
interface.
</p><p></p></li><li>
For drivers statically or dynamically configured into the kernel
<p>
If you implemented the driver to be statically or dynamically
configured, you perform the tasks listed in the previous items.
</p></li></ul><p>
</p><p>
To register character and block driver entry points for statically or
dynamically configured drivers, you call the
<tt>devsw_add</tt>
interface.
You no longer specify a static driver's interfaces in the
<tt>stanza.static</tt>
file fragment.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut10.html#ReserveMajorNumber">Section 6.6.5.2</a>
discusses how to register character and block driver interfaces by calling
the
<tt>devsw_add</tt>
interface.
(The
<tt>stanza.static</tt>
file fragment is replaced by the
<tt>sysconfigtab</tt>
file fragment.)
</p><p>
The call to the
<tt>devsw_add</tt>
interface also reserves a major number (both block and character).
A device driver is responsible for determining if an open or close call is to
the block or character device by examining the
<tt><var>format</var></tt>
argument.
<a name="PortIssueUseofOptionStruct"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="drivertut7_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="drivertut7_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#PortUNIXDrvs"><img src="drivertut7_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#PortIssueMethodRegDrvRtns"><img src="drivertut7_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#PortIssueDevDrvObjFiles"><img src="drivertut7_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut8.html"><img src="drivertut7_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="drivertut7_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="drivertut7_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
4.2.3 Use of the Bus-Specific Option Structure and Structure Snippet
</h3>
<p>
<a name="nx_id_164"></a>
<a name="nx_id_165"></a>
In previous versions of the operating system,
the buses implemented on Alpha CPUs have an associated
bus-specific option data structure defined in the bus-specific header
file.
The following list identifies the option structures for the EISA, ISA,
PCI, and TURBOchannel buses that were supported in a previous version of
Digital UNIX:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -