Openvms VAX Device Support Manual
Total Page:16
File Type:pdf, Size:1020Kb
OpenVMS VAX Device Support Manual Order Number: AA–PWC8A–TE March 1994 This manual describes how to write a driver for a device connected to a VAX processor. It discusses the required and optional components of a driver and explains their functions. It details the requirements the operating system imposes upon driver code and includes guidelines for creating, loading, and debugging a driver that can run on OpenVMS uniprocessing and multiprocessing systems. Revision/Update Information: This manual supersedes the OpenVMS VAX Device Support Manual, Version 6.0. Software Version: OpenVMS VAX Version 6.1 Digital Equipment Corporation Maynard, Massachusetts March 1994 Digital Equipment Corporation makes no representations that the use of its products in the manner described in this publication will not infringe on existing or future patent rights, nor do the descriptions contained in this publication imply the granting of licenses to make, use, or sell equipment or software in accordance with the description. Possession, use, or copying of the software described in this publication is authorized only pursuant to a valid written license from Digital or an authorized sublicensor. © Digital Equipment Corporation 1994. All rights reserved. The postpaid Reader’s Comments forms at the end of this document request your critical evaluation to assist in preparing future documentation. The following are trademarks of Digital Equipment Corporation: BI, Bookreader, CI, CMI, DEC, DECnet, Digital, MASSBUS, MicroVAX, MSCP, NMI, OpenVMS, Q–bus, Q22–bus, SBI, TMSCP, TURBOchannel, UNIBUS, VAX, VAXBI, VAXcluster, VAX DOCUMENT, VAX MACRO, VAXstation, VMS, and the DIGITAL logo. The following are third-party trademarks: UNIX is a registered trademark licensed exclusively by X/Open Co. Ltd. Internet is a registered trademark of Internet, Inc. All other trademarks and registered trademarks are the property of their respective holders. ZK5502 This document is available on CD–ROM. This document was prepared using VAX DOCUMENT Version 2.1. Send Us Your Comments We welcome your comments on this or any other OpenVMS manual. If you have suggestions for improving a particular section or find any errors, please indicate the title, order number, chapter, section, and page number (if available). We also welcome more general comments. Your input is valuable in improving future releases of our documentation. You can send comments to us in the following ways: • Internet electronic mail: [email protected] • Fax: 603-881-0120 Attn: OpenVMS Documentation, ZKO3-4/U08 • A completed Reader’s Comments form (postage paid, if mailed in the United States), or a letter, via the postal service. Two Reader’s Comments forms are located at the back of each printed OpenVMS manual. Please send letters and forms to: Digital Equipment Corporation Information Design and Consulting OpenVMS Documentation 110 Spit Brook Road, ZKO3-4/U08 Nashua, NH 03062-2698 USA You may also use an online questionnaire to give us feedback. Print or edit the online file SYS$HELP:OPENVMSDOC_SURVEY.TXT. Send the completed online file by electronic mail to our Internet address, or send the completed hardcopy survey by fax or through the postal service. Thank you. Contents Preface ............................................................ xxi Part I OpenVMS VAX Device Driver Environment 1 Introduction to Device Drivers 1.1 Driver Functions ............................................ 1–2 1.2 Driver Components . ........................................ 1–2 1.2.1 Driver Tables ............................................ 1–2 1.2.2 Driver Routines . ........................................ 1–3 1.3 I/O Database ............................................... 1–4 1.3.1 Driver Tables ............................................ 1–4 1.3.2 Data Structures . ........................................ 1–4 1.3.3 I/O Request Packets ....................................... 1–6 1.4 Synchronization of Driver Activity ............................... 1–6 1.5 Driver Context .............................................. 1–7 1.5.1 Example of Driver Context-Switching . ....................... 1–8 1.6 Hardware Considerations ...................................... 1–9 1.6.1 Driver Dependency on VAX Processing Systems . ............... 1–10 1.6.1.1 Address Space ........................................ 1–10 1.6.1.2 VAX–11/780, VAX–11/785, and VAX 8600/8650 Systems . ....... 1–11 1.6.1.3 VAX–11/750 System .................................... 1–12 1.6.1.4 VAX–11/730 System .................................... 1–14 1.6.1.5 VAX 82x0/83x0, VAX 85x0/8700/88x0, and VAX 6000 Series Systems ............................................. 1–14 1.6.1.6 VAX 9000 Series System ................................ 1–17 1.6.1.7 VAX 7000 Series and VAX 10000 Series Systems .............. 1–19 1.6.1.8 MicroVAX 3400/3600/3900 Series, MicroVAX/VAXstation II, and VAX 4000 Series Systems ................................ 1–21 1.6.1.9 MicroVAX/VAXstation 3100 and VAXstation 3520/3540 Systems ............................................. 1–22 1.7 Programmed-I/O and Direct-Memory-Access Transfers ............... 1–24 1.7.1 Programmed I/O . ........................................ 1–24 1.7.2 Direct-Memory-Access I/O . ................................ 1–24 1.8 Buffered and Direct I/O ....................................... 1–25 1.9 Example of an I/O Request .................................... 1–26 v 2 Handling a $QIO Request 2.1 Driver Code for the LP11 Write Function ......................... 2–1 2.2 A User Process I/O Request .................................... 2–3 2.3 Device-Independent System I/O Preprocessing . ................... 2–3 2.4 Device-Dependent I/O Preprocessing by the Driver .................. 2–3 2.5 Queuing the I/O Request Packet to the Driver . ................... 2–4 2.6 Activating the Printer ........................................ 2–5 2.7 Waiting for a Device Interrupt .................................. 2–5 2.8 Handling Interrupts .......................................... 2–6 2.9 I/O Postprocessing by the Driver ................................ 2–6 2.10 System I/O Postprocessing . .................................... 2–7 3 Synchronization of I/O Request Processing 3.1 Interrupt Priority Levels . .................................... 3–1 3.1.1 Interrupt Service Routines .................................. 3–3 3.1.2 IPL Use During I/O Processing . ............................ 3–3 3.1.2.1 IPL 2 (IPL$_ASTDEL) .................................. 3–3 3.1.2.2 IPL 4 (IPL$_IOPOST) .................................. 3–4 3.1.2.3 IPL 8 to IPL 11 (Fork IPLs) . ............................ 3–5 3.1.2.4 IPL 20 to IPL 23 (Device IPLs) ........................... 3–5 3.1.2.5 IPL 31 (IPL$_POWER) ................................. 3–6 3.1.3 Additional IPLs .......................................... 3–6 3.1.3.1 IPL 3 (IPL$_RESCHED) ................................ 3–6 3.1.3.2 IPL 6 (IPL$_QUEUEAST) . ............................ 3–6 3.1.3.3 IPL 7 (IPL$_TIMERFORK) . ............................ 3–7 3.1.3.4 IPL 8 (IPL$_SYNCH) ................................... 3–7 3.1.3.5 IPL 11 (IPL$_MAILBOX) ................................ 3–7 3.1.3.6 IPL 14 (XDELTA Entry IPL) . ............................ 3–8 3.1.3.7 IPL 22 or IPL 24 (Interval Clock IPLs) . ................... 3–8 3.1.4 Modifying IPL in Driver Code . ............................ 3–8 3.1.4.1 Raising IPL .......................................... 3–9 3.1.4.2 Lowering IPL ......................................... 3–10 3.2 Spinlocks .................................................. 3–11 3.2.1 Fork Locks . ............................................ 3–14 3.2.2 Device Locks ............................................ 3–15 3.3 Device Driver Synchronization .................................. 3–15 3.3.1 Overview of the Synchronization of an I/O Operation . ........... 3–15 3.3.2 Synchronizing the Device Database ........................... 3–19 3.3.3 Synchronizing at Driver Fork Level ........................... 3–20 3.3.3.1 Forking and the System Fork Dispatcher ................... 3–21 3.3.3.2 Restrictions on Fork Processes ............................ 3–22 3.4 Resource Wait Queues ........................................ 3–23 3.4.1 Competing for a Controller’s Data Channel . ................... 3–23 4 Overview of I/O Processing 4.1 Preprocessing an I/O Request .................................. 4–4 4.1.1 Process I/O Channel Assignment . ............................ 4–5 4.1.2 Locating a Device Driver in the I/O Database ................... 4–5 4.1.2.1 Channel Request Block ................................. 4–5 4.1.2.2 Interrupt Dispatch Block ................................ 4–7 4.1.2.3 Device Data Block . .................................... 4–8 4.1.3 Validating the I/O Function ................................. 4–8 vi 4.1.4 Checking Process I/O Request Quotas . ....................... 4–8 4.1.5 Validating the I/O Status Block .............................. 4–8 4.1.6 Allocating and Setting Up an I/O Request Packet . ............... 4–8 4.1.7 FDT Processing . ........................................ 4–9 4.2 Handling Device Activity ...................................... 4–12 4.2.1 Creating a Driver Fork Process to Start I/O .................... 4–13 4.2.2 Activating a Device and Waiting for an Interrupt . ............... 4–14 4.2.3 Handling a Device Interrupt ................................ 4–15 4.2.4 Switching from Interrupt to Fork Process Context . ............... 4–15 4.2.5 Activating a Fork Process