This chapter describes:
The descriptions of the structures related to device drivers are presented in alphabetical order and in reference (man) page style. The descriptions can include the following sections.
This section lists the name of the structure along with a summary description of its purpose.
This section lists the header file, including the path, where the structure is defined.
This section takes the following approaches when describing structures:
This occurs when you need to understand or need to initialize all of the members of a structure. For example, the declaration of the driver structure is shown because driver writers initialize this structure in their device drivers.
This occurs when you need to understand or need to reference some of the members of a particular structure. For example, the members of the buf structure are shown in a table because the driver writer references only some of its members.
This occurs when the data structure is opaque. This means the members of the structure are manipulated by the Digital UNIX operating system. The driver writer does not manipulate or reference any of the members.
This section provides a short description of each member of the structure.
This section gives more details about the purpose of the structure.
This section lists related kernel interfaces, structures, system calls, and so forth.
Table 3-1 summarizes the structures that device drivers use.
Structure Name | Meaning |
buf | Describes arbitrary I/O. |
bus | Represents an instance of a bus entity to which other buses or controllers are logically attached. |
cfg_attr_t | Contains information for managing the loading and unloading of drivers. |
cfg_subsys_attr_t | Contains attribute information for drivers. |
controller | Contains members that store information about hardware resources and store data for communication between the kernel and the device driver. |
controller_config | Contains information needed to create a controller structure. |
DEVGEOMST | Stores disk device geometry. |
devget | Contains information about a device. |
device | Contains information that identifies the device. There is one device data structure for each device connected to the controller. |
device_config | Contains information needed to create a device structure. |
device_info_t | Is the top-level union that stores bus- and device-type information. |
disklabel | Stores disk device label information. |
driver | Defines driver entry points and other driver-specific information. You initialize this data structure in the device driver. |
dsent | Defines a device driver's entry points and other information. |
handler_intr_info | Contains interrupt handler information. |
ihandler_t | Contains information associated with device driver interrupt handling. |
item_list | Contains hardware platform-specific information. |
lock | Contains complex lock-specific information. |
port | Contains information about a port. |
pt_tbl | Stores a disk partition map. |
sel_queue | Defines a queue of select events. |
sg_entry | Contains bus address/byte count pairs. |
slock | Contains simple lock-specific information. |
task | Contains task-specific information. |
thread | Contains kernel threads-related information. |
uio | Describes I/O, either single vector or multiple vectors. |
v1_bustype_info_t | Stores bus information. |
v1_device_info_t | Is the top-level union that stores bus- and device-type information. |
v1_devtype_info_t | Stores device-type information. |
v1_disk_dev_info_t | Stores disk information. |
v1_tape_dev_info_t | Stores tape information. |
Describes arbitrary I/O
Member Name | Data Type |
b_flags | int |
b_forw | struct buf * |
b_back | struct buf * |
av_forw | struct buf * |
av_back | struct buf * |
b_bcount | int |
b_error | short |
b_dev | dev_t |
b_un.b_addr | caddr_t |
b_lblkno | daddr_t |
b_blkno | daddr_t |
b_resid | int |
b_iodone | void (*b_iodone) () |
b_proc | struct proc * |
Flag | Meaning |
B_READ | This flag is set if the operation is read and cleared if the operation is write. |
B_DONE | This flag is cleared when a request is passed to a driver strategy interface. The device driver writer must call iodone to mark a buffer as completed. |
B_ERROR | This flag specifies that an error occurred on this data transfer. Device drivers set this flag if an error occurs. |
B_BUSY | This flag indicates that the buffer is in use. |
B_PHYS | This flag indicates that the associated data is in user address space. |
The buf structures describe arbitrary I/O, but are usually associated with block I/O and physio. A systemwide pool of buf structures exists for block I/O; however, many device drivers also include locally defined buf structures.
Device drivers written for the ULTRIX operating system set the B_CALL flag in the b_flags member and a completion interface in the b_iodone member. At the completion of an I/O operation, the device driver on the ULTRIX operating system calls the iodone interface, which clears the B_CALL flag and then calls the completion interface set in the b_iodone member.
The Digital UNIX operating system does not define a B_CALL flag. The iodone interface checks the b_iodone member to determine if you specified a completion interface. If so, iodone clears b_iodone and then calls the specified completion interface. If you want to reuse this buf structure, you must reset the b_iodone member to a completion interface. In fact, it is good programming practice to reset all of the referenced members of a buf structure that you plan to reuse.
Represents an instance of a bus entity to which other buses or controllers are logically attached
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
bus_mbox | u_long * |
bus_hd | struct bus * |
nxt_bus | struct bus * |
ctlr_list | struct controller * |
bus_list | struct bus * |
bus_type | int |
bus_name | char * |
bus_num | int |
slot | int |
connect_bus | char * |
connect_num | int |
confl1 | int (*confl1)() |
confl2 | int (*confl2)() |
pname | char * |
port | struct port * |
intr | int (**intr)() |
alive | int |
framework | struct bus_framework * |
driver_name | char * |
bus_bridge_dma | void * |
private | void * [8] |
conn_priv | void * [8] |
rsvd |
The bus structure represents an instance of a bus entity. A bus is a real or imagined entity to which other buses or controllers are logically attached. All systems have at least one bus, the system bus, even though the bus may not actually exist physically. The term controller here refers both to devices that control slave devices (for example, disk or tape controllers) and to devices that stand alone (for example, terminal or network controllers).
controller, device, driver, handler_disable, handler_enable
Contains information for managing the loading and unloading of drivers
/usr/sys/include/sys/sysconfig.h
typedef struct cfg_attr { char name[CFG_ATTR_NAME_SZ]; uchar type; uchar operation; uint status; long index; union { struct { caddr_t val; ulong min_size; ulong max_size; void (*disposal)(); ulong val_size; } bin; struct { caddr_t val; ulong min_len; ulong max_len; void (*disposal)(); } str; struct { ulong val; ulong min_val; ulong max_val; } num; } attr; } cfg_attr_t;
Value | Meaning |
CFG_ATTR_STRTYPE | Data type is a null-terminated array of characters. |
CFG_ATTR_INTTYPE | Data type is a 32-bit signed integer. |
CFG_ATTR_UINTTYPE | Data type is a 32-bit unsigned integer. |
CFG_ATTR_LONGTYPE | Data type is a 64-bit signed integer. |
CFG_ATTR_ULONGTYPE | Data type is a 64-bit unsigned integer. |
CFG_ATTR_BINTYPE | Data type is an array of bytes. |
CFG_ATTR_UCHARTYPE | Data type is an 8-bit unsigned character. |
CFG_ATTR_USHORTTYPE | Data type is a 16-bit unsigned short integer. |
The following table describes the meaning of these constants.
Value | Meaning |
CFG_OP_CONFIGURE |
The
cfgmgr
framework configures the attribute.
This means the
cfgmgr
framework obtains a data value for the attribute from the
/etc/sysconfigtab
database.
The configure operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_CONFIGURE entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_CONFIGURE constant.) |
CFG_OP_QUERY |
The
cfgmgr
framework queries (reads) the attribute.
This means the driver cooperates with the
cfgmgr
framework to provide the value associated with the attribute as a result
of user-initiated query requests.
These requests are typically the result of the
sysconfig -q
command.
The query operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_QUERY entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_QUERY constant.) |
CFG_OP_RECONFIGURE |
The
cfgmgr
framework reconfigures the attribute.
This means the
cfgmgr
framework reconfigures the data value for the attribute.
This functionality allows a user to modify the attribute.
A reconfigure request is typically the result of the
sysconfig -r
command.
The reconfigure operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_RECONFIGURE entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_RECONFIGURE constant.) |
Value | Meaning |
CFG_ATTR_SUCCESS | Successful operation. |
CFG_ATTR_EEXISTS | The attribute you specified in the name member does not exist. |
CFG_ATTR_EOP | The attribute you specified in the name member does not support the operation. |
CFG_ATTR_ESUBSYS | The subsystem failed. |
CFG_ATTR_ESMALL | The value or size of the attribute you specified in the name member is too small. |
CFG_ATTR_ELARGE | The value or size of the attribute you specified in the name member is too large. |
CFG_ATTR_ETYPE | The data type that you specified for the attribute you specified in the name member is invalid or is a mismatch. |
CFG_ATTR_EINDEX | The index associated with the attribute that you specified in the name member is invalid. |
CFG_ATTR_EMEM | The cfgmgr framework could not allocate memory for the specified attribute. |
CFG_ATTR_ENOTNUMBER | The attribute that you specified in the member cannot be converted to a number. |
The cfg_attr_t data structure contains information for managing the configuring and unconfiguring of device drivers. The cfgmgr framework passes a pointer to this data structure to the device driver's configure interface. The device driver can parse this structure pointer to check the validity of the values associated with the driver's associated sysconfigtab file fragment and the /etc/sysconfigtab database.
cfg_subsys_attr_t, sysconfig.h, xxconfigure
Contains attribute information for drivers
/usr/sys/include/sys/sysconfig.h
typedef struct { char name[CFG_ATTR_NAME_SZ]; uchar type; uchar operation; caddr_t addr; ulong min_val; ulong max_val; ulong val_size; } cfg_subsys_attr_t;
Value | Meaning |
CFG_ATTR_STRTYPE | Data type is a null-terminated array of characters. |
CFG_ATTR_INTTYPE | Data type is a 32-bit signed integer. |
CFG_ATTR_UINTTYPE | Data type is a 32-bit unsigned integer. |
CFG_ATTR_LONGTYPE | Data type is a 64-bit signed integer. |
CFG_ATTR_ULONGTYPE | Data type is a 64-bit unsigned integer. |
CFG_ATTR_BINTYPE | Data type is an array of bytes. |
CFG_ATTR_UCHARTYPE | Data type is an 8-bit unsigned character. |
CFG_ATTR_USHORTTYPE | Data type is a 16-bit unsigned short integer. |
The following table describes the meaning of these constants.
Value | Meaning |
CFG_OP_CONFIGURE |
The
cfgmgr
framework configures the attribute.
This means the
cfgmgr
framework obtains a data value for the attribute from the
/etc/sysconfigtab
database.
The configure operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_CONFIGURE entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_CONFIGURE constant.) |
CFG_OP_QUERY |
The
cfgmgr
framework queries (reads) the attribute.
This means the driver cooperates with the
cfgmgr
framework to provide the value associated with the attribute as a result
of user-initiated query requests.
These requests are typically the result of the
sysconfig -q
command.
The query operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_QUERY entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_QUERY constant.) |
CFG_OP_RECONFIGURE |
The
cfgmgr
framework reconfigures the attribute.
This means the
cfgmgr
framework reconfigures the data value for the attribute.
This functionality allows a user to modify the attribute.
A reconfigure request is typically the result of the
sysconfig -r
command.
The reconfigure operation occurs when the cfgmgr framework calls the driver's configure interface at its CFG_OP_RECONFIGURE entry point. (That is, the optype argument of the driver's configure interface evaluates to the CFG_OP_RECONFIGURE constant.) |
Although the device driver's configure interface can initialize attributes that appear in the array with an operation code of CFG_OP_CONFIGURE, the cfgmgr framework overrides this initialization with the value specified in the /etc/sysconfigtab database.
The cfg_subsys_attr_t data structure contains information that device drivers use to describe a variety of attributes. Device driver writers declare and initialize an array of cfg_subsys_attr_t structures in their device drivers. The cfg_subsys_attr_t structure is a simplified version of the cfg_attr_t structure and is designed to save space in the kernel.
Contains members that store information about hardware resources and store data for communication between the kernel and the device driver
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
ctlr_mbox | u_long * |
bus_hd | struct bus * |
nxt_ctlr | struct controller * |
dev_list | struct device * |
driver | struct driver * |
ctlr_type | int |
ctlr_name | char * |
ctlr_num | int |
bus_name | char * |
bus_num | int |
rctlr | int |
slot | int |
alive | int |
pname | char * |
port | struct port * |
intr | int (**intr)() |
addr | caddr_t |
addr2 | caddr_t |
flags | int |
bus_priority | int |
ivnum | int |
priority | int |
cmd | int |
physaddr | caddr_t |
physaddr2 | caddr_t |
private | void * [8] |
conn_priv | void * [8] |
rsvd | void * [8] |
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.
Contains information needed to create a controller structure
/usr/sys/include/io/common/devdriver.h
struct controller_config { long revision; char subsystem_name[NAME_SIZE_REG]; char bus_name[NAME_SIZE_REG]; struct driver * devdriver; };
Third-party driver writers who write drivers that operate on non-Digital buses can select a string that might include the vendor and product names. The string could also include version and release numbers. This type of naming scheme reduces the chance of name conflicts with other vendors.
The controller_config structure contains the information needed to create a controller structure and integrate it into the system (hardware) configuration tree. To create a controller structure, you set the members of the controller_config structure to appropriate values and call the create_controller_struct interface. This interface takes as an argument a pointer to the filled-in controller_config structure.
controller, create_controller_struct, device_config, driver
Stores disk device geometry
/usr/sys/include/io/common/devio.h
typedef union devgeom { struct { unsigned long dev_size; unsigned short ntracks; unsigned short nsectors; unsigned short ncylinders; unsigned long attributes; unsigned long sector_size; unsigned long min_trans; unsigned long max_trans; unsigned long prefer_trans; } geom_info; unsigned char pad[108]; } DEVGEOMST;
The DEVGEOMST structure defines the size of tracks, cylinders, and sectors on the disk, plus device attributes and the number of bytes that can be transferred during a single I/O operation.
The DEVGETGEOM ioctl command uses this structure to return geometry information to the user data buffer. The device driver's open interface and the DEVGDEFPT ioctl command use DEVGEOMST to create a default partition map.
DEVGETGEOM, get_def_partitionmap
Contains information about a device
/usr/sys/include/io/common/devio.h
struct devget { short category; short bus; char interface[DEV_SIZE]; char device[DEV_SIZE]; short adpt_num; short nexus_num; short bus_num; short ctlr_num; short rctlr_num; short slave_num; char dev_name[DEV_SIZE]; short unit_num; unsigned soft_count; unsigned hard_count; long stat; long category_stat; };
The devget data structure contains information about a device. This information includes the general class of the device, the bus type associated with the device, and other device-related information. The DEVIOCGET ioctl command uses the devget structure to obtain generic device information.
Contains information that identifies the device. There is one device data structure for each device connected to the controller.
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
nxt_dev | struct device * |
ctlr_hd | struct controller * |
dev_type | char * |
dev_name | char * |
logunit | int |
unit | int |
ctlr_name | char * |
ctlr_num | int |
alive | int |
private | void * [8] |
conn_priv | void * [8] |
rsvd | void * [8] |
The device structure represents an instance of a device entity. A device is an entity that connects to and is controlled by a controller. A device does not connect directly to a bus.
Contains information needed to create a device structure
/usr/sys/include/io/common/devdriver.h
struct device_config { long revision; char device_type[NAME_SIZE_REG]; char device_name[NAME_SIZE_REG]; char controller_name[NAME_SIZE_REG]; int phys_unit_num; int logical_unit_number; int controller_num; };
Third-party driver writers who write drivers that operate on non-Digital devices can select a string that might include the vendor and product names. The string could also include version and release numbers. This type of naming scheme reduces the chance of name conflicts with other vendors. For example, the driver writers at EasyDriver Incorporated might specify edgd for an internally developed disk device.
Third-party driver writers who write drivers for non-Digital controllers can select a string that might include the vendor and product names. The string could also include version and release numbers. This type of naming scheme reduces the chance of name conflicts with other vendors. For example, the driver writers at EasyDriver Incorporated might specify edgc for an internally developed controller.
The device_config structure contains the information needed to create a device structure and integrate it into the system (hardware) configuration tree. To create a device structure, you set the members of the device_config structure to appropriate values and call the create_device_struct interface. This interface takes as an argument a pointer to the filled-in device_config structure.
controller, controller_config, create_device_struct, device
Is the top-level union that stores bus- and device-type information
/usr/sys/include/io/common/devgetinfo.h
typedef union device_info { int version; v1_device_info_t v1; uchar_t pad[1024]; } device_info_t;
The device_info_t union is the top-level definition of the information returned by the DEVGETINFO ioctl command. The first byte of the union stores the version number of the union definition. Currently, only Version 1 is supported.
The DEVGETINFO ioctl command queries the device for as much information as it can, initializes members of the appropriate data structures within the device_info_t union, then assigns the address of this union to the user's data buffer.
Stores disk device label information
/usr/sys/include/sys/disklabel.h
struct disklabel { u_int d_magic; short d_type; short d_subtype; char d_typename[16]; union { char un_d_packname[16]; struct { char *un_d_boot0; char *un_d_boot1; } un_b; } d_un; u_int d_secsize; u_int d_nsectors; u_int d_ntracks; u_int d_ncylinders; u_int d_secpercyl; u_int d_secperunit; u_short d_sparespertrack; u_short d_sparespercyl; u_int d_acylinders; u_short d_rpm; u_short d_interleave; u_short d_trackskew; u_short d_cylskew; u_int d_headswitch; u_int d_trkseek; u_int d_flags; u_int d_drivedata[NDDATA]; u_int d_spare[NSPARE]; u_int d_magic2; u_short d_checksum; u_short d_npartitions; u_int d_bbsize; u_int d_sbsize; struct partition { u_int p_size; u_int p_offset; u_int p_fsize; u_char p_fstype; u_char p_frag; u_short p_cpg; } d_partitions[MAXPARTITIONS]; };
Value | Meaning |
DTYPE_SMD | SMD, XSMD, VAX hp/up |
DTYPE_MSCP | MSCP |
DTYPE_DEC | DEC (rk, rl) |
DTYPE_SCSI | SCSI |
DTYPE_ESDI | ESDI interface |
DTYPE_ST506 | ST506 etc. |
DTYPE_FLOPPY | floppy diskette |
DTYPE_SWXCR | StorageWorks (RAID) |
Flag | Description |
D_REMOVABLE | Removable media |
D_ECC | Supports ECC |
D_RAMDISK | Disk emulator |
D_CHAIN | Supports back-to-back transfers |
D_DYNAM_GEOM | Dynamic geometry device |
Number of sectors in the partition
Starting offset of the sector
File system basic fragment size
One of the following file system types:
Type | Description |
FS_UNUSED | Unused |
FS_SWAP | Swap |
FS_V6 | Sixth edition |
FS_V7 | Seventh edition |
FS_SYSV | System V |
FS_V71K | Version 7, 1K blocks |
FS_V8 | 8th edition, 4K blocks |
FS_BSDFFS | 4.2BSD, fast file system |
FS_ADVFS | Digital Advanced File System |
FS_LSMpubl | Digital Logical Storage, public region |
FS_LSMpriv | Digital Logical Storage, private region |
FS_LSMsimp | Digital Logical Storage, simple disk |
Each disk has a label that includes information about the hardware disk geometry, file system partitions, and drive-specific information. The label is in block 0 or 1, possibly offset from the beginning to leave room for bootstrap information. A device driver uses the LABELSECTOR and LABELOFFSET constants to refer to the location of the label.
The disklabel structure is accessed by the disk device driver's open interface to set up the default geometry and partition 0 on the disk. The DIOCGDINFO and DIOCGPART ioctl commands use this structure to return the disklabel and partition structures; the DIOCSDINFO and DIOCWDINFO ioctl commands to set or write the contents of the structure.
DIOCGDINFO, DIOCGPART, DIOCSDINFO, DIOCWDINFO, readdisklabel, setdisklabel, writedisklabel
Defines driver entry points and other driver-specific information
/usr/sys/include/io/common/devdriver.h
struct driver { int (*probe)(); int (*slave)(); int (*cattach)(); int (*dattach)(); int (*go)(); caddr_t *addr_list; char *dev_name; struct device **dev_list; char *ctlr_name; struct controller **ctlr_list; short xclu; int addr1_size; int addr1_atype; int addr2_size; int addr2_atype; int (*ctlr_unattach)(); int (*dev_unattach)(); };
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.
Defines a device driver's entry points and other information
struct dsent { int (*d_open)(); int (*d_close)(); int (*d_strategy)(); int (*d_read)(); int (*d_write)(); int (*d_ioctl)(); int (*d_dump)(); int (*d_psize)(); int (*d_stop)(); int (*d_reset)(); int (*d_select)(); int (*d_mmap)(); int (*d_segmap)(); struct tty *d_ttys; int d_funnel; int d_bflags; int d_cflags; };
Value | Meaning |
DEV_FUNNEL |
Specifies that you want to funnel the device driver
because you have not made it SMP safe.
This means that the driver is forced to execute on a single (the
master) CPU.
Even if you funnel your device driver, you must follow the SMP locking conventions when accessing kernel data structures external to the driver. Typically, you use kernel interfaces that Digital supplies to indirectly access kernel data structures outside the driver. |
DEV_FUNNEL_NULL | Specifies that you do not want to funnel the device driver because you have made it SMP safe. This means that the driver can execute on multiple CPUs. You make a device driver SMP safe by using the simple or complex lock mechanism. |
Another flag specifies whether this character driver is an SVR4 DDI/DKI-compliant device driver. You set this member to the B_DDIDKI flag to indicate that this is an SVR4 DDI/DKI-compliant device driver.
The dsent data structure contains pointers to entry points for a specific driver's I/O services interfaces and other information. The system maintains a table (array) of these dsent structures (referred to as the device switch table) that contains pointers to entry points for the associated driver's I/O services interfaces for each block and character mode device that the system supports. In addition, the table can contain stubs for device driver entry points for block and character mode devices that do not exist or entry points not used by a device driver.
Both block and character device special files can access the same device driver entry. If the device driver does not support access by both block and character device special files, then the driver must perform the appropriate check in its open interface and return an error for the devices it does not support.
devsw_add, devsw_del, devsw_get
Contains interrupt handler information
/usr/sys/include/io/common/handler.h
Member Name | Data Type |
configuration_st | caddr_t |
intr | int (*intr) () |
param | caddr_t |
config_type | unsigned int |
The handler_intr_info structure contains interrupt handler information for device controllers connected to a bus. This generic structure makes device drivers more portable across different buses because it contains all of the necessary information to add an interrupt handler for any bus. Device driver writers set the ih_bus_info member of the ihandler_t structure to the filled-in handler_intr_info structure, usually in the driver's probe interface.
The bus and controller structures contain the bus- and controller-specific information that is not provided in handler_intr_info.
The handler_intr_info data structure is a direct copy of the tc_intr_info data structure that TURBOchannel bus device drivers use. The handler_intr_info structure provides binary compatibility with previously written TURBOchannel device drivers and source code compatibility across device drivers that operate on a variety of buses including TURBOchannel, PCI, EISA, and ISA buses.
handler_add, handler_del, handler_disable, handler_enable, ihandler_t
Contains information associated with device driver interrupt handling
/usr/sys/include/io/common/handler.h
Member Name | Data Type |
ih_id | ihandler_id_t |
ih_bus | struct bus * |
ih_bus_info | char * |
The ihandler_t structure contains information associated with device driver interrupt handling. This model of interrupt dispatching uses the bus as the means of interrupt dispatching for all drivers. For this reason, all of the information needed to register an interrupt is considered to be bus specific. As a result, no attempt is made to represent all the possible permutations within the ihandler_t data structure.
Device driver writers pass the ihandler_t structure to the handler_add interface in the driver's probe interface to specify how interrupt handlers are to be registered with the bus-specific interrupt dispatcher.
Device driver writers set the ih_bus_info member to the filled-in handler_intr_info structure, which contains the bus-specific information.
Contains hardware platform-specific information
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
function | u_long |
out_flags | u_int |
in_flags | u_int |
rtn_status | u_long |
next_function | struct item_list * |
input_data | u_long |
output_data | u_long |
Constant | Meaning |
GET_TC_SPEED | Requests that get_info return the TURBOchannel bus clock speed (in kilohertz) for this system. For example, get_info returns 250 for a 25-megahertz clock speed. You pass this constant only if a TURBOchannel bus is hardwired to the hardware platform. |
MOP_SYSID | Requests that get_info return the MOP system ID for the system that the drivier operates on. |
CONSOLE_2_DEV | Requests that get_info return the controller number associated with the controller that the system booted from. The get_info interface locates this controller by traversing the array of bus structures. |
DEV_2_CONSOLE | Requests that get_info return the boot device string for the console. The get_info interface constructs the boot device string from information contained in the devget structure. |
DEV_2_USER | Requests that get_info return the string that a user enters at the console terminal to boot the system. |
Status Code | Meaning |
INFO_RETURNED | The CPU platform that the driver operates on supports the system item associated with the function code you passed to the function member. This value indicates that the system item returned by get_info to the output_data member is valid. |
NOT_SUPPORTED | The CPU platform that the driver operates on does not support the system item associated with the code you passed to the function member; or, the CPU platform does not support the get_info interface. |
The item_list data structure contains platform-specific information. Device drivers obtain this platform-specific information by calling the get_info interface.
Contains complex lock-specific information
The lock structure is an opaque data structure; that is, its associated members are referenced and manipulated by the Digital UNIX operating system and not by the user of the complex lock mechanism. Therefore, this reference page omits a description of the lock structure's associated members.
The lock data structure is the complex lock structure that contains complex lock-specific information. A device driver writer using the complex lock method declares a pointer to a lock structure and passes its address to the associated lock interfaces.
The header file lock.h shows typedef statements that assign the alternate name lock_data_t for the complex lock structure and lock_t for a pointer to the complex lock structure.
lock_done, lock.h, lock_init, lock_read, lock_terminate, lock_try_read, lock_try_write, lock_write, slock
Contains information about a port
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
conf | int (*conf) () |
The port structure contains information about a port.
Stores a disk partition map
/usr/sys/include/sys/disklabel.h
struct pt_tbl { struct partition d_partitions[MAXPARTITIONS]; };
The pt_tbl structure contains a disk's partition map, which describes the partitions on the disk. The disk driver's open interface and the DIOCGDEFPT ioctl command use the pt_tbl structure to hold the disk's default partition map created by those interfaces. The disk driver's DIOCGCURPT and DIOCGDEFPT ioctl commands use the pt_tbl structure to return the current and default partition maps.
DIOCGCURPT, DIOCGDEFPT, disklabel
Defines a queue of select events
Member Name | Data Type |
links | struct queue_entry |
event | struct event * |
The sel_queue data structure provides device driver writers with a generic queue of select events. You must initialize the links member by calling the queue_init interface prior to using the select_enqueue and select_dequeue interfaces.
select.h, select_dequeue, select_enqueue
Contains bus address/byte count pairs
/usr/sys/include/io/common/devdriver.h
Member Name | Data Type |
ba | bus_addr_t |
bc | long |
The sg_entry data structure contains two members: ba and bc. These members represent a bus address/byte count pair for a contiguous block of an I/O buffer mapped onto a controller's bus memory space. The byte count indicates the number of bytes that the address is contiguously valid for on the controller's bus address space. Consider a list entry that has its ba member set to aaaa and its bc member set to nnnn. In this case, the device can perform a contiguous DMA data transfer starting at bus address aaaa and ending at bus address aaaa+nnnn-1.
The header file devdriver.h shows a typedef statement that assigns the alternate name sg_entry_t for a pointer to the sg_entry structure.
dma_get_curr_sgentry, dma_get_next_sgentry, dma_put_curr_sgentry, dma_put_prev_sgentry
Contains simple lock-specific information
The slock structure is an opaque data structure; that is, its associated members are referenced and manipulated by the Digital UNIX operating system and not by the user of the simple lock method. Therefore, this reference page omits a description of the slock structure's associated members.
The slock data structure is the simple spin lock structure that contains simple lock-specific information. The user of the simple lock method declares a slock structure by calling the decl_simple_lock_data interface. In subsequent calls to simple_lock, simple_lock_init, simple_lock_try, and simple_unlock, the caller passes the address of the previously declared slock structure.
The header file lock.h shows typedef statements that assign the alternate name simple_lock_data_t for the simple spin lock structure and simple_lock_t for a pointer to the simple spin lock structure.
decl_simple_lock_data, lock.h, lock, simple_lock, simple_lock_init, simple_lock_terminate, simple_lock_try, simple_unlock
Contains task-specific information
The task structure is an opaque data structure; that is, all of its associated members are referenced and manipulated by the Digital UNIX operating system and not by the user of kernel threads. Therefore, this reference page omits a description of the task structure's associated members.
The task data structure contains task-related information.
The header file task.h shows a typedef statement that assigns the alternate name task_t for a pointer to the task structure. Some of the kernel threads-related interfaces require that you pass a pointer to the task structure.
Contains kernel threads-related information
/usr/sys/include/kern/thread.h
Member Name | Data Type |
wait_result | kern_return_t |
The thread data structure contains kernel threads-related information. Device drivers typically use the wait_result member (along with the current_thread interface) to check for the result of the wait. The values associated with the member have the following meanings:
Value | Meaning |
THREAD_AWAKENED | The result of the assert wait is a normal wakeup. |
THREAD_TIMED_OUT | The specified timeout has expired. |
THREAD_INTERRUPTED | The wait condition was interrupted by the clear_wait interface. |
THREAD_SHOULD_TERMINATE | The result of the assert wait is that the current kernel thread should terminate. |
THREAD_RESTART | The current kernel thread should be restarted. |
The header file thread.h shows a typedef statement that assigns the alternate name thread_t for a pointer to the thread structure. Many of the kernel threads-related interfaces operate on these pointers to thread structures.
The thread structure is an opaque data structure; that is, all of its associated members (except for the wait_result member) are referenced and manipulated by the Digital UNIX operating system and not by the user of kernel threads.
clear_wait, current_thread, thread.h, thread_block, thread_set_timeout, thread_wakeup, thread_wakeup_one
Describes I/O, either single vector or multiple vectors
Member Name | Data Type |
uio_iov | struct iovec * |
uio_iovcnt | int |
uio_offset | off_t |
uio_segflg | enum uio_seg |
uio_resid | int |
uio_rw | enum uio_rw |
The uio structure describes I/O, either single vector or multiple vectors. Typically, device drivers do not manipulate the members of this structure. However, the structure is presented here for the purpose of understanding the uiomove kernel interface, which operates on the members of the uio structure.
Stores bus information
/usr/sys/include/io/common/devgetinfo.h
typedef struct v1_bustype_info { int adpt_num; int nexus_num; int bus_num; int ctlr_num; int rctlr_num; int slave_num; int unit_num; int pad0; union { v1_scsi_bus_info_t scsi; uchar_t busdata[DEV_BUS_LEN]; } bus; } v1_bustype_info_t;
The v1_bustype_info_t contains information about the bus type that is returned by the DEVGETINFO ioctl command.
Stores device information
/usr/sys/include/io/common/devgetinfo.h
typedef struct v1_device_info { int version; short category; short bus; char interface[DEV_STRING_SIZE]; char device[DEV_STRING_SIZE]; char dev_name[DEV_STRING_SIZE]; ulong_t soft_count; ulong_t hard_count; v1_devtype_info_t devinfo; v1_bustype_info_t businfo; uchar_t private[DEV_PRIVATE_LEN]; } v1_device_info_t;
The v1_device_info_t structure contains all the information returned to the user data buffer by the DEVGETINFO ioctl command. This structure is contained within the device_info_t structure so that the same interface can be used for various versions of the data structures.
device_info_t, v1_devtype_info_t, v1_bustype_info_t
Stores device-type information
/usr/sys/include/io/common/devgetinfo.h
typedef union v1_devtype_info { v1_disk_dev_info_t disk; v1_tape_dev_info_t tape; uchar_t devdata[DEV_TYPE_LEN]; } v1_devtype_info_t;
The v1_devtype_info_t union contains device-specific information returned by the DEVGETINFO ioctl command. It is a member of the device_info_t union, the top-level definition of the information returned to the user data buffer. The type of information in the union depends on the device type either disk, tape, or some other type of device for which no device-specific structure has been defined.
device_info_t, v1_disk_dev_info_t, v1_tape_dev_info_t
Stores disk information
/usr/sys/include/io/common/devgetinfo.h
typedef struct v1_disk_dev_info { ulong_t status; ulong_t capacity; ulong_t blocksz; uchar_t class; uchar_t part_num; uchar_t raid_level; uchar_t pad0; ushort_t media_changes; ushort_t pad1; union { struct { uchar_t density_code; uchar_t flags; } scsi; uchar_t archdata[DEV_ARCH_LEN]; } arch; } v1_disk_dev_info_t;
Class | Description |
DKDEV_CLS_UNKNOWN | Unknown class |
DKDEV_CLS_HARDDISK | Hard disk |
DKDEV_CLS_FLPY_GENERIC | Floppy diskette with no known density |
DKDEV_CLS_FLPY_3_DD2S | 3.5", 720KB, DD, 2-sided, 9 sectors |
DKDEV_CLS_FLPY_3_HD2S | 3.5", 1.44MB, HD, 2-sided, 18 sectors |
DKDEV_CLS_FLPY_3_ED2S | 3.5", 2.88MB, ED, 2-sided, 36 sectors |
DKDEV_CLS_FLPY_5_LD2S | 5.25", 360KB, LD, 2-sided, 9 sectors |
DKDEV_CLS_FLPY_5_DD1S | 5.25", 400KB, DD, 1-sided, 10 sectors |
DKDEV_CLS_FLPY_5_DD2S | 5.25", 720KB, DD, 2-sided, 9 sectors |
DKDEV_CLS_FLPY_5_HD2S | 5.25", 1.2MB, HD, 2-side, 15 sectors |
DKDEV_CLS_CDROM | CD-ROM |
DKDEV_CLS_WORM | Write once, read many times |
The v1_disk_dev_info_t structure contains information regarding the status of the device that is passed to the DEVGETINFO ioctl command.
Stores tape information
/usr/sys/include/io/common/devgetinfo.h
typedef struct v1_tape_dev_info { uint_t media_status; uint_t unit_status; long recordsz; long density_bpi; long density_bpi_wrt; long position; long fm_cnt; uchar_t class; uchar_t pad[7]; union { struct { uint_t blocking_factor; uchar_t valid_flags; uchar_t density_code; uchar_t buffered_mode; uchar_t speed; uchar_t compression_code; } scsi; uchar_t archdata[DEV_ARCH_LEN]; } arch; } v1_tape_dev_info_t;
Status Code | Meaning |
TPDEV_BOM | Beginning of medium (BOM) |
TPDEV_EOM | End of medium (EOM) |
TPDEV_RESERVED1 | Reserved |
TPDEV_WRTPROT | Write-protected |
TPDEV_BLANK | Blank media |
TPDEV_WRITTEN | Written since opened |
TPDEV_RESERVED2 | Reserved |
TPDEV_SOFTERR | Device soft error |
TPDEV_HARDERR | Device hard error |
TPDEV_DONE | Operation complete/Online |
TPDEV_RETRY | Retry |
TPDEV_ERASED | Erased |
TPDEV_TPMARK | Unexpected tape mark |
TPDEV_SHRTREC | Short record |
TPDEV_RDOPP | Read opposite |
TPDEV_RWDING | Rewinding |
TPDEV_POS_VALID | Tape position information is valid |
Status Code | Meaning |
TPDEV_READY | Device online and ready |
TPDEV_OFFLINE | Device not ready |
TPDEV_NO_EOM | No warning on EOM |
TPDEV_HAS_LOADER | Device has integral loader |
TPDEV_1FM_ONCLOSE | Write 1 filemark on close |
TPDEV_REW_ONCLOSE | Rewind on close |
TPDEV_COMPACTING | Density is compacted |
TPDEV_COMPRESSING | Compression enabled |
TPDEV_BUFFERED | Device is buffering data |
The v1_tape_dev_info_t structure contains information about the tape device that is returned by the DEVGETINFO ioctl command.