[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


A    TURBOchannel-Specific Reference Information

This appendix describes the following TURBOchannel-specific information:

Refer to Writing Device Drivers: Reference for reference information on header files, kernel interfaces, ioctls, global variables, data structures, and driver interfaces that are not bus specific.


[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


A.1    Conventions for Reference Pages

The following sections describe the conventions used for:


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.1.1    Conventions for Header File

The description of the header file associated with TURBOchannel device drivers can include the following sections.


Name

This section lists the name of the header file along with a summary description of its contents.


Location

This section presents the pathname for the header file. The pathname makes it easier for you to locate specific header files.


Description

This section briefly describes the contents of the header file.


When to Include

This section explains when to include a header file for block and character drivers.


Of Special Interest

This section lists specific structures, macros, constant values, and so forth that are of interest to device driver writers.


Related Information

This section lists related kernel interfaces, structures, system calls, and so forth.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.1.2    Conventions for Kernel Interfaces

The descriptions of the kernel interfaces associated with TURBOchannel device drivers are presented as reference pages in alphabetical order. The descriptions can include the following sections.


Name

This section lists the name of the kernel interface, along with a summary description of its purpose. In general, there is one interface described for each reference page. However, in some cases it makes sense to describe more than one interface on the same page if the interfaces are related. When this occurs, this section lists the names of all the interfaces it describes.


Synopsis

This section shows the kernel interface function definition. The style used is that of the function definition, not the function call. This book assumes that you understand how to interpret the function definition and how to write an appropriate call for a specific interface. The following example shows these conventions:

int copyin (user_src, kernel_dest, bcount)
caddr_t user_src;
caddr_t kernel_dest;
u_int bcount;

The kernel interface function definition gives you the following information:

This book uses the word kernel ``interface'' instead of kernel ``routine'' or kernel ``macro.''


Arguments

This section provides descriptions for the arguments associated with a given kernel interface. In most cases, argument descriptions begin with the word specifies to indicate that you pass the argument (with some specified value) to the kernel interface. If the type of the argument appears as a void *, the argument description states that you must define the type.


Description

This section contains explanations of the tasks performed by the kernel interface.


Notes

This section discusses information that falls into the following categories:


Cautions

This section provides information of particular importance when you use the kernel interface. In many cases, the text in this section alerts you to anything that might cause a panic.


Errors

This section provides the possible error constants a given kernel interface can return, along with a short description of the error.


Side Effects

This section describes special processing performed by the kernel interface. For example, the Side Effects section for the uiomove kernel interface describes the members of the uio structure that it can update.


Return Values

This section describes the return values that a given kernel interface can return. In most cases, if the kernel interface returns an error value, this value is described in the Return Values section.


Related Information

This section lists related kernel interfaces, structures, system calls, and so forth.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.1.3    Conventions for Data Structure

The description of the data structure associated with TURBOchannel device drivers is presented as a reference page. The description includes the following sections.


Name

This section lists the name of the structure along with a summary description of its purpose.


Include File

This section lists the header file, including the path, where the structure is defined.


Synopsis

This section considers the following when describing structures:


Members

This section provides a short description of each member of the structure.


Description

This section gives more details about the purpose of the structure.


Related Information

This section lists related kernel interfaces, structures, system calls, and so forth.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.1.4    Conventions for Device Driver Interfaces

The descriptions of the device driver interfaces associated with TURBOchannel device drivers are presented as reference pages in alphabetical order. The descriptions can include the following sections.


Name

This section lists the name of the driver interface along with a summary description of its purpose. In general, there is one interface described for each reference page. However, in some cases it makes sense to describe more than one interface on the same page if the interfaces are related. When this occurs, this section lists the names of all the interfaces it describes.


Entry Point

This section lists the structure or file where you specify the entry for the device driver interface.


Synopsis

This section shows the device driver interface function definition. The style used is that of the function definition, not the function call. This book assumes that you understand how to interpret the function definition and how to write an appropriate call for a specific interface. The presentation shown in the following example is of the function definition:

int xxprobe (addr, ctlr)
io_handle_t addr;
struct controller *ctlr;

The previous interface function definition gives you the following information:


Arguments

This section provides descriptions for the arguments associated with a given driver interface. In most cases, argument descriptions begin with the word specifies to indicate that the driver writer passes the argument (with some specified value) to the driver interface.


Description

This section contains explanations of the tasks performed by the driver interface.


Notes

This section contains information about the driver interface pertinent to the device driver writer.


Return Values

This section describes the values that a given driver interface can return.


Related Information

This section lists related kernel interfaces, structures, system calls, and so forth.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.2    Header File

The /usr/sys/include/io/dec/tc/tc.h file is the only header file used exclusively by TURBOchannel device drivers.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc.h

Contains definitions for TURBOchannel bus support


Location

/usr/sys/include/io/dec/tc/tc.h


Description

The tc.h file contains constants, bit values, and data structures related to the TURBOchannel bus.


When to Include

You include this file in block and character device drivers that connect to the TURBOchannel bus.


Of Special Interest

Items of interest to device driver writers are:


Related Information

tc_addr_to_name, tc_isolate_memerr, tc_module_name, tc_option_control


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.3    Kernel Interfaces

Table A-1 lists the kernel interfaces specific to TURBOchannel device drivers, along with short descriptions of their purpose.

Note

The following lists the header files that device drivers use most frequently:

#include <sys/types.h>
#include <sys/errno.h>
#include <io/common/devdriver.h>
#include <sys/uio.h>
#include <machine/cpu.h>
#include <sys/conf.h>
#include <sys/sysconfig.h>

Table A-1: Summary Description of Kernel Interfaces Specific to TURBOchannel Device Drivers

Kernel Interface Summary Description
tc_addr_to_name Returns the option module name.
tc_isolate_memerr Logs memory-related errors.
tc_module_name Determines the name of a specific option module.
tc_option_control Enables and disables various bus options.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc_addr_to_name

Returns the option module name


Synopsis

int tc_addr_to_name (io_handle, cp)
io_handle_t io_handle;
char *cp;


Arguments

io_handle
Specifies an I/O handle that you can use to reference a device register or memory located in bus address space (either I/O space or memory space). For tc_addr_to_name, the I/O handle identifies the location in bus address space where the option module name resides.

cp
Specifies a pointer to a character array to be filled in with the option module name. You must declare the cp array to be of the size cp[TC_ROMNAMLEN + 1] to ensure that the character array is large enough to store the module name.


Description

The tc_addr_to_name interface fills in the character array cp with the ASCII string of the TURBOchannel option's module name referred to by the base address addr. In the tc_module_name interface, you pass a pointer to a controller structure, which is not valid in the driver's xxprobe interface. Therefore, use tc_addr_to_name rather than tc_module_name in a driver's xxprobe interface.


Return Values

This interface returns a value of -1 if it is unable to use the cp pointer you passed. The interface returns zero (0) on success.


Related Information

tc_module_name


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc_isolate_memerr

Logs memory-related errors


Synopsis

int tc_isolate_memerr (memerr_status)
struct tc_memerr_status *memerr_status;


Arguments

memerr_status
Specifies a pointer to a tc_memerr_status data structure. This data structure contains such information as the physical address of the error, a flag to indicate whether to log the error, and so forth.


Description

The tc_isolate_memerr interface logs memory-related errors associated with devices that operate on the TURBOchannel bus. The mechanism for logging these errors is the tc_memerr_status data structure.

The tc_isolate_memerr interface checks the virtual address of the error (the va member of the tc_memerr_status structure). If the address equals the value zero (0), the interface uses the physical address (the pa member of the tc_memerr_status structure) to form a virtual address.

The tc_isolate_memerr interface calls a system-specific interface, which determines the exact error based on the virtual address and the physical address. If the log member of the tc_memerr_status structure is set to TC_LOG_MEMERR, the system-specific interface logs the error in the same manner as a memory error is logged when it comes directly into the CPU.


Example

See Section 5.3 for a code example of the tc_isolate_memerr interface.


Return Values

The tc_isolate_memerr interface returns a value of -1 if the supplied physical address is invalid or if the system-specific interface does not exist.


Related Information

tc_memerr_status


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc_module_name

Determines the name of a specific option module


Synopsis

int tc_module_name (ctlr_p, cp)
struct controller *ctlr_p;
char *cp;


Arguments

ctlr_p
Specifies a pointer to a controller structure.

cp
Specifies a pointer to a character array to be filled in by tc_module_name. You must declare the cp array to be of the size cp[TC_ROMNAMLEN + 1] to ensure that the character array is large enough to store the module name.


Description

The tc_module_name interface fills in the character array cp with the ASCII string of the TURBOchannel option's module name referred to by the pointer to the controller structure.


Example

See Section 5.1 for a code example of the tc_module_name interface.


Return Values

The tc_module_name interface returns a value of -1 if it was unable to use the cp pointer you passed.


Related Information

tc_addr_to_name


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc_option_control

Enables and disables various bus options


Synopsis

int tc_option_control (ctlr_p, flags)
struct controller *ctlr_p;
int flags;


Arguments

ctlr_p
Specifies a pointer to a controller structure.

flags
Specifies the options to be enabled or disabled or the requests option status. The following table lists and describes the flags:
Value Meaning
SLOT_PARITY Enables or disables parity for the specified option.
SLOT_BLOCKMODE Enables or disables block mode transfers for the specified option.
SLOT_MAPREGS Enables or disables use of map registers for address translation for the specified module.
SLOT_STATUS Requests current state of preceding flags; do not change current settings.


Description

The tc_option_control interface enables or disables various slot-specific options. Use the SLOT_PARITY, SLOT_BLOCKMODE, and SLOT_MAPREGS flags to change option settings. A call to the tc_option_control interface returns the state of the option settings after execution. To find out what the option settings are without changing any of the settings, use the SLOT_STATUS flag.


Return Values

The return value of this interface is the current state of flags after completion of the operations requested by the call to tc_option_control.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.4    Data Structure

Table A-2 lists the data structure specific to TURBOchannel device drivers, along with a short description of its contents.

Table A-2: Summary Description of Data Structure Specific to TURBOchannel Device Drivers

Structure Name Meaning
tc_memerr_status Contains information on logging memory errors.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


tc_memerr_status

Contains information on logging memory errors


Include File

/usr/sys/include/io/dec/tc/tc.h


Synopsis

Member Name Data Type
pa caddr_t
va caddr_t
log int
blocksize int
errtype u_int


Members

pa
Specifies the physical address of the error.

va
Specifies the virtual address of the error.

log
Specifies whether to log the error. You can pass one of the following flags:
Value Meaning
TC_NOLOG_MEMERR Do not log the error.
TC_LOG_MEMERR Log the error.

blocksize
Specifies the size of the direct memory access (DMA) block.

errtype
Specifies the error type. You can set this member to one of the following error constants:
Value Meaning
TC_MEMERR_NOERROR No error occurred.
TC_MEMERR_TRANS A transient parity error occurred.
TC_MEMERR_SOFT A soft parity error occurred.
TC_MEMERR_HARD A hard parity error occurred.


Description

The tc_isolate_memerr interface uses the tc_memerr_status data structure to obtain error information associated with devices that operate on the TURBOchannel bus.


Related Information

tc_isolate_memerr


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


A.5    Device Driver Interfaces

Table A-3 lists the device driver interfaces specific to TURBOchannel device drivers, along with short descriptions of their contents.

Table A-3: Summary Description of Driver Interfaces Specific to TURBOchannel Device Drivers

Driver Interface Summary Description
xxprobe Determines whether the device exists.
xxslave Checks that the device is valid for this controller.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


xxprobe

Determines whether the device exists


Entry Point

The driver structure


Synopsis

int xxprobe (bus_io_handle, ctlr)
io_handle_t bus_io_handle;
struct controller *ctlr;


Arguments

bus_io_handle
Specifies an I/O handle that you can use to reference a device register located in the TURBOchannel bus address space. The TURBOchannel bus configuration code passes this I/O handle to the driver's xxprobe interface during device autoconfiguration. You can perform standard C mathematical operations (addition and subtraction only) on the I/O handle. For example, you can add an offset to or subtract an offset from the I/O handle.

ctlr
Specifies a pointer to the controller structure associated with this device. The bus configuration code passes this pointer to the driver's xxprobe interface. The device driver can reference hardware resources and other information contained in the controller structure pointer.


Description

A TURBOchannel bus device driver's xxprobe interface performs tasks necessary to determine if the device exists and is functional on a given system. The xxprobe interface typically registers a driver's interrupt handlers by using the ihandler_t and handler_intr_info structures and by calling the handler_add and handler_enable interfaces.

Other tasks that the xxprobe interface performs vary as follows, depending on whether the device driver is statically or dynamically configured into the kernel:

The arguments you pass to the probe interface differ according to the bus on which the driver operates. The Synopsis section shows the arguments associated with a probe interface for a TURBOchannel bus.


Notes

Device drivers pass the I/O handle to the following categories of interfaces, which are discussed in Writing Device Drivers: Tutorial. These interfaces can process the I/O handle to access the desired bus address space.


Return Values

The xxprobe interface returns a nonzero value if the probe operation is successful. It returns the value zero (0) to indicate that the driver did not complete the probe operation.


Related Information

xxslave

Writing Device Drivers: Reference: controller structure


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Chapter] [Index] [Help]


xxslave

Checks that the device is valid for this controller


Entry Point

The driver structure


Synopsis

int xxslave (device, bus_io_handle)
struct device *device;
io_handle_t bus_io_handle;


Arguments

device
Specifies a pointer to a device structure for this device. The bus configuration code passes this pointer to the driver's slave interface. The device driver can reference such information as the logical unit number of the device, whether the device is functional, and the bus number the device resides on.

bus_io_handle
Specifies an I/O handle that you can use to reference a device register located in the TURBOchannel bus address space. The TURBOchannel bus configuration code passes this I/O handle to the driver's xxslave interface during device autoconfiguration. You can perform standard C mathematical operations (addition and subtraction only) on the I/O handle. For example, you can add an offset to or subtract an offset from the I/O handle.


Description

A device driver's xxslave interface is called only for a controller that has slave devices connected to it. This interface is called once for each slave attached to the controller.

The arguments you pass to the slave interface differ according to the bus on which the driver operates. The Synopsis section shows the arguments associated with a slave interface for a TURBOchannel bus.


Notes

Device drivers pass the I/O handle to the following categories of interfaces, which are discussed in Writing Device Drivers: Tutorial. These interfaces can process the I/O handle to access the desired bus address space.


Return Values

The xxslave interface returns a nonzero value if the device is present.


Related Information

xxprobe

Writing Device Drivers: Reference: device structure