Data structures are the mechanism used to pass information between the Digital UNIX kernel and device driver interfaces. VMEbus device driver writers must understand the data structures described in Writing Device Drivers: Tutorial, particularly the members of the controller and driver structures that are specific to the VMEbus. The following sections describe the controller and driver structures.
The controller structure represents an instance of a controller entity, one that connects logically to a bus. A controller can control devices that are directly connected or can perform some other controlling operation, such as a network interface or terminal controller operation. Table 4-1 lists the members of the controller structure specific to the VMEbus and their associated data types.
Member Name | Data Type |
bus_priority | int |
ivnum | int |
priority | int |
The
bus_priority
member specifies
the configured VMEbus priority level of the device.
You (or the system manager) can specify the bus priority
by using the
priority
keyword.
Thus, the autoconfiguration software initializes the
bus_priority
member with the value that follows the
priority
keyword in the system configuration file.
For example, the autoconfiguration software initializes the
bus_priority
member to the value 3, based on the following entry in the system
configuration file:
bus vba0 at tc? slot? vector vbaerrors device xcm0 at vba0 csr 0xa000 priority 3 vector 0xc8
Note
For this version of Digital UNIX, you must specify the name of the interrupt service interface (ISI) following the vector keyword so that config executes successfully. You should still register the device's ISI by calling the handler interfaces because a future release of Digital UNIX will not require you to specify the ISI in the system configuration file.
The ivnum member specifies an interrupt vector number. Based on the previous example, the autoconfiguration software initializes the ivnum member to the value 0xc8. Note that the autoconfiguration software locates the interrupt vector number after the vector keyword.
The priority member specifies the system priority level (spl) to block interrupts from this device. Thus, the autoconfiguration software initializes the priority member with an appropriate value based on the value stored in the bus_priority member (if specified) and the system implementation. You use this value as an argument to the splx interface to block interrupts for the device.
The driver structure defines driver entry points and other driver-specific information. You declare and initialize an instance of this structure in the declarations section of the device driver. The bus configuration code uses the entry points defined in this structure during device autoconfiguration. The bus configuration code fills in the dev_list and ctlr_list arrays. The driver interfaces use these arrays (members of the device and controller structures) to get the structures for specific devices or controllers.
Table 4-2 lists the members of the driver structure specific to the VMEbus and their associated data types.
Member Name | Data Type |
addr1_size | int |
addr1_atype | int |
addr2_size | int |
addr2_atype | int |
The addr1_size member specifies the size (in bytes) of the first CSR area. This area is usually the control status register of the device. The addr1_atype member specifies the address space, access mode, transfer size, and swap mode of the first CSR area. Note that not all bus adapters use the transfer size.
The addr2_size member specifies the size (in bytes) of the second CSR area. This area is usually the data area that the system uses with devices that have two separate CSR areas. The addr2_atype member specifies the address space, access mode, transfer size, and swap mode of the second CSR area. Note that not all bus adapters use the transfer size.
You can set the addr1_atype and addr2_atype members to the bitwise inclusive OR of the valid bits described in Table 4-3. The /usr/sys/include/io/dec/vme/vbareg.h file defines these and other VMEbus-related bits.
Bit Category | Value | Meaning |
Swap mode bits | VME_BS_NOSWAP | Specifies no byte swapping. |
VME_BS_BYTE | Specifies byte swapping in bytes. | |
VME_BS_WORD | Specifies byte swapping in words. | |
VME_BS_LWORD | Specifies byte swapping in longwords. | |
VME_BS_QUAD | Specifies byte swapping in quadwords. | |
Address space bits | VME_A16 | Specifies a request for the 16-bit address space. |
VME_A24 | Specifies a request for the 24-bit address space. | |
VME_A32 | Specifies a request for the 32-bit address space. | |
VME_A64 | Specifies a request for the 64-bit address space. | |
Transfer size bits | VME_D08 | Specifies a request for the 8-bit data size. |
VME_D16 | Specifies a request for the 16-bit data size. | |
VME_D32 | Specifies a request for the 32-bit data size. | |
Access mode bits | VME_UDATA | Specifies user data. |
VME_UPROG | Specifies a user program. | |
VME_SDATA | Specifies supervisory data. | |
VME_SPROG | Specifies a supervisory program. | |
CPU allocation space bits | The default CPU allocation space is sparse space. To specify dense space, you use the VME_DENSE bit. |