[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

Upgrading Privileged-Code Applications on OpenVMS Alpha and OpenVMS I64 Systems


Previous Contents Index


Chapter 4
Modifying Device Drivers to Support 64-Bit Addressing

This chapter describes how to modify customer-written device drivers to support 64-bit addresses.

For more information about the data structures and routines described in this chapter, see Appendix A and Appendix B.

4.1 Recommendations for Modifying Device Drivers

Before you can modify a device driver to support 64-bit addresses, your driver must recompile and relink without errors on OpenVMS Alpha Version 7.0. See Chapter 2. If you are using OpenVMS-supplied FDT routines, supporting 64-bit addresses can be automatic or easily obtained. Device drivers written in C are usually easier to modify than drivers written in MACRO-32. Drives using direct I/O are usually easier to modify than those using buffered I/O.

When your device driver runs successfully as a 32-bit addressable driver on OpenVMS Alpha Version 7.0, you can modify it to support 64-bit addresses as follows:

  • Select the functions that you want to support 64-bit functions.
  • Follow your IRP$L_QIO_P1 value and promote all references to 64-bit addresses.
  • Declare 64-bit support for the I/O function.

The remaining sections in this chapter provide more information about these recommendations.

4.2 Mixed Pointer Environment in C

OpenVMS Alpha 64-bit addressing support for mixed pointers includes the following features:

  • OpenVMS Alpha 64-bit virtual address space layout that applies to all processes. (There are no special 64-bit processes or 32-bit processes.)
  • 64-bit pointer support for addressing the entire 64-bit OpenVMS Alpha address space layout including P0, P1, and P2 address spaces and S0/S1, S2, and page table address spaces.
  • 32-bit pointer compatibility for addressing P0, P1, and S0/S1 address spaces.
  • Many new 64-bit system services which support P0, P1, and P2 space addresses.
  • Many existing system services enhanced to support 64-bit addressing.
  • 32-bit sign-extension checking for all arguments passed to 32-bit pointer only system serivces.
  • C and MACRO-32 macros for handling 64-bit addresses.

To support 64-bit addresses in device drivers, you must use the new version (V5.2) of the DEC C compiler as follows:

  • Compile your device driver using /POINTER_SIZE=32


    $ CC/STANDARD=RELAXED_ANSI89 -     /INSTRUCTION=NOFLOATING_POINT -     /EXTERN=STRICT -     /POINTER_SIZE=32 -     LRDRIVER+SYS$LIBRARY:SYS$LIB_C.TLB/LIBRARY 
  • #pragma __required_pointer_size 32|64
  • 64-bit pointer types are defined by header files; e.g.


    #include <far_pointers.h> VOID_PQ  user_va;  /* 64-bit "void *" */ ... #include <ptedef.h> PTE *    svapte;   /* 32-bit pointer to a PTE */ PTE_PQ   va_pte;   /* Quadword pointer to a PTE */ PTE_PPQ  vapte_p;  /* Quadword pointer to a                     * quadword pointer to a PTE */ 
  • Pointer size truncation warning


    p0_va = p2_va; ^ %CC-W-MAYLOSEDATA, In this statement, "p2_va" has    a larger data size than "short pointer to char"

4.3 $QIO Support for 64-Bit Addresses

The $QIO and $QIOW system services accept the following arguments:


$QIO[W] efn,chan,func,iosb,astadr,astprm,p1,p2,p3,p4,p5,p6 

These services have a 64-bit friendly interface (as described in OpenVMS Alpha Guide to 64-Bit Addressing and VLM Features)1, which allows these services to support 64-bit addresses.

Table 4-1 summarizes the changes to the data types of the $QIO and $QIOW system service arguments to accommodate 64-bit addresses.

Table 4-1 $QIO [W] Argument Changes
Argument Prior Type New Type Description
efn Unsigned longword - Event flag number. Unchanged.
chan Unsigned word - Channel number. Unchanged.
func Unsigned longword - I/O function code. Unchanged.
iosb 32-bit pointer 1 64-bit pointer Pointer to a quadword I/O status block (IOSB). The IOSB format is unchanged.
astadr 32-bit pointer 1 64-bit pointer Procedure value of the caller's AST routine. On Alpha systems, the procedure value is a pointer to the procedure descriptor.
astprm Unsigned longword 2 Quadword Argument value for the AST routine.
P1 Longword 2 Quadword Device-dependent argument. Often P1 is a buffer address.
P2 Longword 2 Quadword Device-dependent argument. Only the low-order 32-bits will be used by system-supplied FDT routines that use P2 as the buffer size.
P3 Longword 2 Quadword Device-dependent argument.
P4 Longword 2 Quadword Device-dependent argument.
P5 Longword 2 Quadword Device-dependent argument.
P6 Longword 2 Quadword Device-dependent argument. Sometimes P6 is used to contain the address of a diagnostic buffer.

132-bit pointer was sign-extended to 64 bits as required by the HP OpenVMS Calling Standard.
232-bit longword value was sign-extended to 64 bits as required by the HP OpenVMS Calling Standard.

Usually the $QIO P1 argument specifies a buffer address. All the system-supplied upper-level FDT routines that support the read and write functions use this convention. The P1 argument determines whether the caller of the $QIO service requires 64-bit support. If the $QIO system service rejects a 64-bit I/O request, the following fatal system error status is returned:


SS$_NOT64DEVFUNC  64-bit address not supported by device for this function 

This fatal condition value is returned under the following circumstances:

  • The caller has specified a 64-bit virtual address in the P1 device dependent argument, but the device driver does not support 64-bit addresses with the requested I/O function.
  • The caller has specified a 64-bit address for a diagnostic buffer, but the device driver does not support 64-bit addresses for diagnostic buffers.
  • Some device drivers may also return this condition value when 64-bit buffer addresses are passed using the P2 through P6 arguments and the driver does not support a 64-bit address with the requested I/O function.

For more information about the $QIO, $QIOW, and $SYNCH system services, see the HP OpenVMS System Services Reference Manual: GETUTC--Z.

Note

1 This manual has been archived but is available on the OpenVMS Documentation CD-ROM. This information has also been included in the OpenVMS Programming Concepts Manual, Volume I.

4.4 Declaring Support for 64-Bit Addresses in Drivers

Device drivers declare that they can support a 64-bit address by individual function. The details vary depending on the language used to code the initialization of the driver's Function Decision Table.


Previous Next Contents Index