Specifications

Understanding the Kernel Environmen
t
9-9
uio_fmode The file status flags set by the value of the oflag argument speci-
fied when the file was opened with an open(2) system call. The
flags are defined in the file /usr/include/sys/file.h
uio_limit The maximum size in bytes of a file created by a process. This
limit is a tunable parameter. It will be a daddr_t for small offset
drivers and size64_t for large offset drivers
uio_resid The number of bytes that remain to be transferred
Normally, the routine uiomove(D3) handles the management of the uio(D4) struc-
tures for you; it determines the location of the data and does all of the copying. The
uio_resid field is typically the only field in the uio(D4) structure that is useful to
device drivers because it contains the number of bytes of data to be transferred. The
device driver should check to see that this number does not exceed the number that the
driver can handle in one operation. Because the data to be transferred might not be contig-
uous in memory, an array of iovec(D4) structures is needed.
The adapter Structure 9
The adapter structure is a control structure that is a part of the kernel configuration sub-
system in the kernel address space. The purpose of the adapter structure is to define each
adapter in the system.
An adapter is a hardware set which connects one or more device controllers to the com-
puter system. An adapter might or might not consume a slot. An adapter always has an I/O
address and might perform DMA and generate interrupts. An example is the HSA.
As the kernel image is created, the kernel build tools create an array of adapter struc-
tures based on information located in the Sadapters(4) file.
Later, as a part of the kernel configuration during start up, the kernel uses the device
switch table to invoke the driver’s init(D2) and start(D2) entry points. In turn,
these routines use the adapter definition to read such hardware characteristics as the
adapter’s standard I/O address range.
The adapter structure is defined in /usr/include/sys/adapter.h as follows:
typedef struct generic_adapter {
u_char adapter_name[A_NAMESZ]; /* for display/verification */
long adapter_type; /* unique adapter code */
u_char adapter_no; /* logical adapter no. (0 relative) */
u_char cpu; /* assigned CPU */
u_char bus; /* bus location */
u_char itype; /* assigned interrupt type */
paddr_t sio_address; /* assigned standard I/Oaddr(phys) */
paddr_t bus_address; /* assigned bus I/O addr (phys) */
vaddr_t v_sio_address; /* mapped standard I/O add(virtual) */
vaddr_t v_bus_address; /* mapped bus I/O addr (virtual) */
u_char slot; /* slot location (one relative) */
u_char dma; /* assigned dma/bus request lev */
u_char ilev; /* assigned interrupt level */
u_char ivec; /* assigned interrupt vector */