scsi
Index
This class serves as a base class for implementing IDE (ATA) bus drivers.
One particularity of this class is that IDE bus is very speed-critical.
At the other hand, the driver implements very lowlevel operations which
are called quite often. OOP_DoMethod() call is not fast enough, and in
order to circumvent this limitation, additionally to normal OOP API
IDE bus drivers offer two additional non-standard interfaces. Internally
they are implemented as library-alike function table plus driver-specific
data. For the purpose of some performance optimizations the function
table is private to ata.device and managed entirely by the base class.
Driver classes have access only to data portion.
These interfaces are documented below.
Unit class is private to ata.device. Instances of this class represent
devices connected to IDE buses, and can be used to obtain information
about these devices.
DMA interface is optional, and is needed in order to support DMA data
transfers.
Function table for the interface consists of the following functions:
BOOL dma_Setup(void *obj, APTR buffer, IPTR size, BOOL read)
- Prepare the controller to DMA data transfer. The last argument is
TRUE for read operation and FALSE for write. The function should
return TRUE for success or FALSE for failure.
VOID dma_Start(void *obj)
- Start DMA transfer.
VOID dma_End(void *obj, APTR buffer, IPTR size, BOOL read)
- End DMA transfer and perform post-transfer cleanup of the given region.
ULONG dma_Result(void *obj)
- Get resulting status of the operation. The function should return 0
for successful completion or error code to be passed up to ata.device
caller in io_Result field of the IORequest.
PIO interface is responsible for accessing I/O registers on the IDE
bus, as well as performing PIO-mode 16- and 32-bit data transfers.
This interface is mandatory and must be implemented by the driver,
however some functions are optional. They can be either omitted
entirely from the function table, or set to NULL pointers.
Control functions table for the interface consists of the following
functions (listed in their order in the array):
VOID scsi_out(void *obj, UBYTE val, UWORD offset)
- Write byte into primary register bank with the given offset.
UBYTE scsi_in(void *obj, UWORD offset)
- Read byte from primary register bank with the given offset.
VOID scsi_out_alt(void *obj, UBYTE val, UWORD offset)
- Write byte into alternate register bank with the given offset.
This function is optional.
UBYTE scsi_in_alt(void *obj, UWORD offset)
- Read byte from alternate register bank with the given offset.
This function is optional.
Transfer functions table for the interface consists of the following
functions (listed in their order in the array):
VOID scsi_outsw(void *obj, APTR address, ULONG count)
- Perform 16-bit PIO data write operation from the given memory
region of the given size.
VOID scsi_insw(void *obj, APTR address, ULONG count)
- Perform 16-bit PIO data read operation into the given memory
region of the given size.
VOID scsi_outsl(void *obj, APTR address, ULONG count)
- Perform 32-bit PIO data write operation from the given memory
region of the given size. This function is optional.
UBYTE scsi_insl(void *obj, APTR address, ULONG count)
- Perform 32-bit PIO data read operation into the given memory
region of the given size. This function is optional.
Specifies control functions table for building PIO interface object.
The function table is an array of function pointers terminated
by -1 value. The terminator must be present for purpose of
binary compatibility with future extensions.
This function table is mandatory to be implemented by the driver.
Tells whether the bus driver implements moHidd_SCSIBus_SetXferMode method.
Current version of ata.device does not use this attribute, and it is
considered reserved.
Specifies size of DMA interface data structure.
Specifies function table for building DMA interface object. If not supplied,
the bus is considered not DMA-capable.
Returns a pointer to OOP object of private unit class, representing
a master drive on the bus, or NULL if there's no master device.
Specifies size of PIO interface data structure.
Specifies transfers function table for building PIO interface object.
The function table is an array of function pointers terminated
by -1 value. The terminator must be present for purpose of
binary compatibility with future extensions.
This function table is mandatory to be implemented by the driver.
Returns a pointer to OOP object of private unit class, representing
a slave drive on the bus, or NULL if there's no master device.
When queried, tells whether the bus supports 32-bit PIO data transfers.
When set, enables or disables 32-bit mode for PIO data transfers.
Tells whether the bus currently uses 80-conductor cable.
This attribute actually makes difference only for DMA modes. If
your bus driver returns FALSE, ata.device will not use modes
higher than UDMA2 on the bus.
Tells whether the bus supports DMA transfers.
Tells whether the bus supports alternate registers bank
(scsi_AltControl and scsi_AltStatus).
Tells which transfer modes are currently configured for use with the drive.
The returned value is a bitmask of the same flags as for
aoHidd_SCSIUnit_XferModes attribute.
Currently ata.device does not distinguish between PIO modes and does not
set any bit for them. Absence of DMA mode flags automatically means that
PIO mode is used.
Tells maximum allowed number of sectors for multisector transfer.
Tells which transfer modes are supported by this device. The returned value
is a bitwise combination of the following flags (see include/hidd/ata.h):
AF_XFER_PIO(x) - PIO mode number x (0 - 4)
AF_XFER_MDMA(x) - multiword DMA mode number x (0 - 2)
AF_XFER_UDMA(x) - Ultra DMA mode number x (0 - 6)
AF_XFER_48BIT - LBA48 block addressing
AF_XFER_RWMILTI - Multisector PIO
AF_XFER_PACKET - ATAPI
AF_XFER_LBA - LBA28 block addressing
AF_XFER_PIO32 - 32-bit PIO
32-bit PIO is actually controller's property and not drive's property.
Because of this AF_XFER_PIO32 flag can never be returned by this attribute.
Nevertheless, it can be returned by aoHidd_SCSIUnit_ConfiguredModes
attribute.
APTR OOP_DoMethod(OOP_Object *obj, struct pHidd_SCSIBus_GetDMAInterface *Msg);
APTR HIDD_SCSIBus_GetDMAInterface(void);
Instantiates encapsulated DMA interface object and returns its
pointer.
A pointer to opaque DMA interface object or NULL upon failure or
if DMA is not supported by this bus.
This method should be overloaded by driver subclasses in order to
initialize data portion of the interface object.
APTR OOP_DoMethod(OOP_Object *obj, struct pHidd_SCSIBus_GetPIOInterface *Msg);
APTR HIDD_SCSIBus_GetPIOInterface(void);
Instantiates encapsulated PIO interface object and returns its
pointer.
A pointer to opaque PIO interface object or NULL in case of failure.
This method should be overloaded by driver subclasses in order to
initialize data portion of the interface object.
APTR OOP_DoMethod(OOP_Object *obj, struct pHidd_SCSIBus_SetXferMode *Msg);
APTR HIDD_SCSIBus_SetXferMode(UBYTE unit, scsi_XferMode mode);
Sets the desired transfer mode for the given drive on the bus controller.
unit - drive number (0 for master and 1 for slave)
mode - Mode number (see hidd/ata.h)
TRUE if successful or FALSE if the desired mode is not supported
by the hardware.
The default implementation is provided for drivers not supporting
DMA and always returns FALSE if the caller attempts to set any of
DMA modes.
Current version of ata.device does not use this method, and it is
considered reserved.
APTR OOP_DoMethod(OOP_Object *obj, struct pHidd_SCSIBus_Shutdown *Msg);
APTR HIDD_SCSIBus_Shutdown(void);
Instantly shutdown all activity on the bus.
This method is called by ata.device during system reset handler execution.
|
|