4.1 The controller Structure Members Specific to the VMEbus
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 represents the configured VMEbus priority level of the device. You (or the system manager) can specify the bus priority by using the VBA_Option entry in the /etc/sysconfigtab file or a sysconfigtab file fragment. (Section 4.3 describes the VBA_Option entry.) The autoconfiguration software initializes the bus_priority member of the controller structure with the value specified for the Bus_Priority field of VBA_Option. For example, the autoconfiguration software initializes the bus_priority member to the value 3, based on the following entry in /etc/sysconfigtab:
VBA_Option = ..., Vector - 0xc8, Bus_Priority - 3, ...
The ivnum member represents an interrupt vector
number, which is initialized based on the Vector field of
VBA_Option.
Given the
example VBA_Option line above, the
autoconfiguration software initializes the ivnum member
to the value 0xc8.
The priority member represents the system
priority level (SPL) of the last interrupt handler installed using the
handler_add interface.
(SPL values can be specified in calls to the splx
interface to block interrupts for a device.)
Table 4-2 lists the members of the driver structure specific to the VMEbus and their associated data
types.
4.2 The driver Structure Members Specific to the VMEbus
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.
| 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.
The VBA_Option entry you place in the
/etc/sysconfigtab file or a
sysconfigtab file fragment has the following general
form:
The data following the dash (-) is the data for the specified field.
The comma (,) separates the fields within VBA_Option.
ASCII data fields are enclosed in single quotes (').
Table 4-4 describes in detail the
fields that make up a VBA_Option entry.
4.3 The VBA_Option VMEbus Configuration Structure
The major VMEbus-specific component of the device driver configuration
process described in the tutorial is the requirement to supply VMEbus
configuration information in the /etc/sysconfigtab file
or a /sysconfigtab file fragment. You do this by
specifying a VBA_Option entry that describes the driver
and its VMEbus configuration.
VBA_Option = Manufact_Name - 'XXXXXXXX',
Product_Name - 'XXXXXXXX',
Bus_Instance - n,
Driver_Name - xx,
Driver_Instance - n,
Csr1 - n, Csr2 - n,
Vector - 0xnnnn, Bus_Priority - n,
Type - C, Adpt_Config - N
You supply the VBA_Option information on a contiguous line
with no newline characters inserted. (Line breaks were added above for
clarity.)
The device driver requires the bus autoconfiguration code to map eight (8)
bytes of VMEbus address at address 0x00800000 in A24 User Data Mode address
space into CPU I/O space. You do this by specifying the address to
Csr1, while also specifying values for
addr1_size and
addr1_atype in the
driver's driver data structure. From this information,
the bus configuration code creates a mapped I/O space address (I/O handle),
which is passed to the driver's probe interface,
dmaexprobe, and stored in the addr
member of the driver's controller data structure. The
driver then can use this I/O handle to access its device control and status
registers.
No VMEbus-to-CPU I/O space mapping is required for a second address, so in
this example zero
(0) is specified for Csr2. Correspondingly, zero
(0) would be specified for the addr2_size member
in the driver's driver data structure.
The Vector and Bus_Priority parameters
indicate that the driver needs to add and enable interrupt handlers to
vector 0xF0 with a VMEbus interrupt request level of 1. The specified
vector and bus priority are passed to the device driver in the
controller structure members ivnum
and bus_priority. The device driver then installs two
interrupt handlers at 0xF0 and 0xF1.
The device driver requires no device register or memory mapping by the
autoconfiguration software, so zero (0) is specified for
Csr1 and Csr2.
The Vector and Bus_Priority parameters
indicate that the driver needs to add and enable an interrupt handler to
vector 0x1150 with a VMEbus interrupt request level of 7. The specified
vector and bus priority are passed to the device driver in the
controller structure members ivnum
and bus_priority. The device driver then installs an
interrupt handler at 0x1150.
4.3.1 Example: dmaex Driver Configuration
The following VBA_Option entry is included in the
/etc/sysconfigtab file or a
sysconfigtab file fragment to provide VMEbus
configuration information for the /dev/dmaex example
driver used in this manual. (Line breaks have been added for clarity.)
VBA_Option = Manufact_Name - 'Digital', Product_Name - 'DMAEX Driver',
Bus_Instance - 0, Driver_Name - dmaex, Driver_Instance - 0,
Csr1 - 0x00800000, Csr2 - 0x0, Vector - 0xF0,
Bus_Priority - 1, Type - C, Adpt_Config - N
This entry indicates that the manufacturer is Digital and that the product
is the DMAEX driver. The bus instance number is 0, indicating the driver is
being installed on the first instance of the VMEbus, bus
vba0. The driver name is dmaex. The
driver instance is 0, indicating the driver is controlling the first
instance of the hardware device, dmaex0.
4.3.2 Example: vb Driver Configuration
The following VBA_Option entry is included in the
/etc/sysconfigtab file or a
sysconfigtab file fragment to provide VMEbus
configuration information for the VMEbus Backplane (vb)
Network Driver supported by Digital UNIX. (Line breaks have been added for
clarity.)
VBA_Option = Manufact_Name - 'Digital',
Product_Name - 'VME Backplane Network Driver',
Bus_Instance - 0, Driver_Name - vb, Driver_Instance - 0,
Csr1 - 0, Csr2 - 0, Vector - 0x1150, Bus_Priority - 7,
Type - C, Adpt_Config - N
This entry indicates that the manufacturer is Digital and that
the product is the VMEbus Backplane Network Driver.
The bus instance number is 0, indicating the driver is
being installed on the first instance of the VMEbus, bus
vba0. The driver name is vb. The
driver instance is 0, indicating the driver is controlling the first
instance of the hardware device, vb0.