DeviceInfoStruct

Contains specific information about a device attached to a host adapter bus.

Used By:CDM and HAM

Syntax

    typedef struct DeviceInfoStruct 
    { 
       LONG   deviceHandle;
       BYTE   deviceType;
       BYTE   unitNumber;
       BYTE   busID;
       BYTE   cardNo;
       LONG   attributeFlags;
       LONG   maxDataPerTransfer;
       LONG   maxLengthSGElement;
       BYTE   maxSGElements;
       BYTE   reserved[2];
       BYTE   elevatorThreshold;
       LONG   maxUnitsPerTransfer;
       WORD   haType;
       union 
       { 
          struct 
          { 
             BYTE   transferPeriodFactor;
             BYTE   offset;
          } SCSI;
          struct
          {
             BYTE   reserved[2];
          } other;      
       } timingInfo;
       union
       {
          struct InquiryInfoStruct    inquiryInfo;
          struct IdentifyInfoStruct   identifyInfo;
       } info;
    } DeviceInfoDef;
    

Fields

deviceHandle
A 1-LONG field containing a handle to a device. The HAM generates this handle during HAM_Scan_For_Devices (Function 0x01). This device handle is the token that HAM uses to identify and route I/O to a device. The CDM must provide this handle in the HACB in order to issue I/O to a target device. Without this handle, the HAM rejects the HACB because it cannot identify the target device.
deviceType
A 1-byte field containing a value representing the type of device that the inquiry data describes. NWPA uses the same codes for device types as SCSI. The following is NWPA's list of device types:

Value

Description

00

Direct access device (hard disk)

01

Sequential access device (tape)

02

Printer device

03

Processor device

04

Write once device (worm)

05

CD device

06

Scanner device

07

Optical memory device (MO)

08

Media changer device

09

Communication device

-1

Undefined type of device

unitNumber
A 1-byte field. For SCSI, this field contains the logical unit number (LUN) of the device. For SATA, this field contains the port multiplier. For IDE-ATA, this field indicates the number of the device as follows:

Value

Description

0x00

Master

0x01

Slave

NWPA treats the value in this field as a byte value.

busID
A 1-byte field. For SCSI, this field contains the device's SCSI ID. For SATA, this field contains the port number for the device. For IDE-ATA, this field contains a HAM-generated index that associates the IDE-ATA-controller channel (primary, secondary, tertiary, or quaternary) to the device.
cardNo
A 1-byte field containing the host adapter card number generated by the HAM.
attributeFlags
A 1-LONG field indicating the attributes associated with a device and the adapter to which it is attached. The following table describes each attribute and shows the bit that enables it:

Flag Bit (MSB) b31... (LSB) b0

Description

0x00000001

Bit 0 is the Max_Data_Per_Transfer_Flag. When set, it indicates that the adapter has a maximum number of bytes it can transfer per I/O request. The value for this maximum is found in the maxDataPerTransfer field.

When cleared, it indicates that the adapter can handle any transfer size the bus protocol can support.

0x00000002

Bit 1 is the Elevator_Off_Flag. When set, it disables automatic sorting of requests in NWPA's elevator filter. This task is then left either for the HAM/adapter, or it does not happen at all.

If the HAM chooses to turn off the elevator by setting this flag, chances for scatter/gather are almost nil. NWPA's scatter/gather filter groups requests while they are in the elevator. Disabling NWPA's elevator drastically decreases performance.

0x0000004

Bit 2 is the Scatter_Gather_Flag. When set, it indicates that the HAM/adapter supports scatter/gather requests. Then, if the Elevator_Off_Flag is cleared, the NWPA scatter/gather filter seeks opportunities to build scatter/gather requests.

When cleared, it indicates that the HAM/adapter does not support scatter/gather, and NWPA guarantees that the associated device's CDM-HAM I/O channel does not receive any scatter/gather requests.

Scatter/Gather is now mandatory in NWPA.

If this bit is cleared, maxLengthSGElement and maxSGElements are ignored.

0x00000008

Bit 3 is the Boot_Device_Flag. When set, it indicates that this device is the boot device. If the HAM can determine the boot device, it has the option to set this bit. If the HAM cannot make the determination, this flag should be cleared. This flag only applies to RISC architectures and is machine-specific. Even then, it only applies in cases where knowing the boot device is necessary.

0x00000010

Bit 4 is the Below_16MB_Flag. When set, it indicates that the adapter is limited to only 16 MB of address space.

When cleared, it indicates that the adapter is not limited to only 16 MB of address space.

0x00000020

Bit 5 is the Scatter_Gather_Granularity_Flag. When set, it indicates that the adapter's transfer granularity per scatter/gather element is at byte resolution.

When cleared, it indicates that the adapter's transfer granularity per scatter/gather element is at sector resolution.

0x00000040

Bit 6 is the Auto_Error_Sense_Flag. When set, it indicates that auto error sense is active for the corresponding device.

When cleared, it indicates that auto error sense is inactive.

0x00000080

Bit 7 is the Private_Public_Flag. When set, it indicates the corresponding device is private.

When cleared, it indicates the corresponding device is public.

0x00000100

Bit 8 is the Hardware_Verify_Flag. When set, it indicates that the corresponding device can do hardware verifies on write commands.

When cleared, it indicates that the corresponding device does not support hardware verifies on write commands.

Setting this bit is the responsibility of the CDM.

0x00000200

Bit 9 is the Max_Units_Per_Transfer_Flag. When set, it indicates that the adapter has a maximum number of units it can transfer per I/O request. The value for this maximum is found in the MaxUnitsPerTransfer field.

When cleared, it indicates that the adapter can handle any unit transfer amount the bus protocol can support.

0x00000400

Bit 10 is the Elevator_Threshold_Flag. When set, it indicates that the elevatorThreshold field is valid.

When cleared, it indicates that the elevatorThreshold field is not valid.

0x00000800

Bit 11 is the Timing_Info_Flag. When set, it indicates that the fields of the timingInfo union are valid.

0x00001000

Bit 12 is the Handicapped_Read_Flag. When set, it indicates that if this device is mirrored, it will not be given read requests, provided that it is mirrored with a non-handicapped device. If all devices are handicapped, this device can still receive read requests. This flag is used to increase read performance if the mirrored devices are of differing response times.

0x00002000

Bit 13 is the Virtual_Device_Flag. When set, the device is a virtual device and requires no interrupts to complete message directly to this device. This bit is specifically for those HAMs that present a virtual device, which in turn sends I/O to another device (controlled by another driver), in order to complete the I/O for this device.

b13..b31

These bits (MSB) are reserved.

maxDataPerTransfer
A 1-LONG field indicating the maximum number of bytes that the adapter can transfer per I/O request.

If a transfer size limit exists for the adapter, the HAM must place the byte limit in this field and set the Max_Data_Per_Transfer_Flag.

If the adapter can handle any transfer size the bus protocol supports, the HAM should set this field to zero and clear the Max_Data_Per_Transfer_Flag.

maxLengthSGElement
A 1-LONG field where the HAM indicates the maximum size, in bytes, of a single scatter/gather element supported by the adapter for the target device.
maxSGElements
A 1-byte field containing a value corresponding to the maximum number of scatter/gather elements the adapter can handle per request for the target device
reserved
A 2-byte field reserved by NWPA.
elevatorThreshold
A 1-byte field that indicates the maximum number of requests the device, adapter, and HAM driver can process at a given time. The Elevator_Threshold_Flag must be set to indicate the validity of this field.

If the Elevator_Threshold_Flag is cleared, any value in this field is ignored.

This field has a minimum of 2 and defaults to 3. This value can be adjusted dynamically using HAI_Object_Update.

For a more detailed explanation, see the Remarks section for this structure.

maxUnitsPerTransfer
A 1-LONG field indicating the maximum number of units (that is, sectors) that the adapter can transfer per I/O request.

If a unit transfer limit exists for the adapter, the HAM must place the unit limit in this field and set the Max_Units_Per_Transfer_Flag.

If the adapter can handle any unit transfer amount the bus protocol supports, the HAM should set this field to zero and clear the Max_Units_Per_Transfer_Flag.

haType
A 1-WORD field to contain a value representing the adapter type this HAM supports. The following is a list of possible values:

Value

Description

1

HAM supports SCSI adapters

2

HAM supports IDE-ATA adapters

3

HAM supports custom adapters

4

HAM supports SATA (Serial ATA) adapters

transferPeriodFactor
A 1-byte field that reports the synchronous transfer period factor, which is the minimum time allowed between leading edges of successive REQ pulses and of successive ACK pulses. This field applies to SCSI devices only and is not used for other device types.
offset
A 1-byte field that is the maximum number of REQ pulses allowed to be outstanding before the leading edge or its corresponding ACK pulse is received at the target. Defined values for this field are:

Value

Description

00h

Asynchronous transfer.

FFh

Infinite (No limit to the number of outstanding pulses, which means that memory is fast enough to keep up with synchronous transfer).

This field applies to SCSI devices only and is not used for other device types, and is valid only if the Timing_Info_Flag is set.

inquiryInfo
For SCSI, the information in InquiryInfoStruct is identical to the 36-byte information returned by the standard INQUIRY command. For a hacbType = 3 device, inquiryInfo contains the UpdateInfoStruct. For other interface types, InquiryInfoStruct must be defined to contain information that is identical to the data returned by interface's equivalent INQUIRY command.
identifyInfo
For IDE-ATA and SATA (Serial ATA), the information in InquiryInfoStruct is identical to the 512-byte information returned by the IDENTIFY DEVICE command. For ATAPI, the information in InquiryInfoStruct is identical to the 512-byte information returned by the IDENTIFY PACKET DEVICE command.

Remarks

The HAM maintains an instance of this structure for each device it supports and is responsible for filling in field information when it receives a HAM_Return_Device_Info (Function 0x02) command. The HAM determines the information for some of the fields by probing the hardware (such as unitNumber, busID, etc.). The information for the remaining fields (such as deviceHandle) is generated by the HAM.

The HAM uses the information in this structure to report a device and set its attributes.

The CDM uses this structure to obtain device information to determine if it will bind to the device. When a device comes online that is of the type for which a CDM has registered, the Media Manager calls that CDM's CDM_Inquiry, passing it a pointer to this structure. It is from this structure that a CDM can determine a device's type and obtain its handle for routing I/O.

The elevatorThreshold field . In NWPA, an elevator refers to the way requests are moved up and down. After NWPA receives a request, it places the request into its elevator in LBA order (elevator sorting). When NWPA notices that the LBA ranges of two requests are consecutive and the target adapter driver has indicated that it supports the scatter/gather action, it attempts to combine them into a single request.

Simultaneously, NWPA checks the number of requests that have been sent to the particular device and have not yet been completed (outstanding requests) to ensure (if possible) that this number meets the amount specified by the driver's elevatorThreshold value for this device. This value represents the maximum number of requests that NWPA keeps outstanding at the HAM driver and might more properly be defined as a device request threshold. If the number of outstanding requests falls below the elevator threshold level and there are requests pending in the elevator, NWPA sends the HAM driver enough requests to meet the elevator threshold or until the elevator is exhausted, whichever comes first. The elevator threshold was implemented primarily for RAID and adapters or devices that support command pipelining.

If the elevator threshold is set too high, it might not be possible to combine requests because so many requests are being sent to the driver. However, leaving the requests in the elevator for as long as possible increases the opportunity for NWPA to create scatter/gather requests. Because it is more cost effective for a driver to process a single, large request than many smaller requests that total the same data transfer size (due to error checking, bookkeeping, general request handling, and the amount of ISR time in which interrupts are disabled), you should allow NWPA as many scatter/gather opportunities as possible.

Conversely, the elevator threshold should be set to the number of requests that the adapter and HAM driver can process simultaneously for the particular device. If the elevator threshold is set too low, the adapter might spend unnecessary idle time while waiting for requests to process (which is referred to as starving the adapter).

Because the optimum value of the elevator threshold is dependent upon adapter capabilities, NWPA allows the adapter driver to specify this value. You might need to use various combinations of reads and writes in real-world configurations and data sets to discover the best value.