Data Structures For Drivers sata_cmd(9S) NAME sata_cmd - SATA cmd structure SYNOPSIS #include INTERFACE LEVEL Consolidation Private DESCRIPTION The sata_cmd structure specifies SATA command (ATA/ATAPI), data buffer address, DMA cookies needed for the command execution, time allocated for the command execution and additional information helping SATA HBA to set-up and perform requested operation. SATA HBA driver should use values set up in sata_cmd structure to program SATA device registers, in the HBA-specific manner. The ATA Device Control register is not specified in sata_cmd - SATA HBA driver should set it up according to the operational mode, i.e. interrupt enabled/disabled. If the READ/WRITE MULTIPLIER commands are specified in satacmd_cmd_reg field (a command is directed to the Port Multiplier rather than to an attached SATA device), SATA HBA driver has to update satacmd_sec_count_lsb, satacmd_lba_low_lsb, satacmd_lba_mid_lsb and satacmd_lba_high_lsb fields to values returned via command block registers (task file registers). Note: SATA HBA Framework works only with devices supporting LBA mode. STRUCTURE MEMBERS int satacmd_rev; /* Version */ struct_buf *satacmd_bp; /* Pointer to a buffer structure*/ uint32_t satacmd_flags /* Data transfer direction flag */ uint8_t satacmd_addr_type; /* addressing type: LBA, LBA28, LBA48 */ unit8_t satacmd_features_reg_ext; /* ATA features extended register */ uint8_t satacmd_sec_count_msb; /* sector count MSB (LBA48) */ uint8_t satacmd_lba_low_msb; /* LBA Low MSB (LBA48) */ uint8_t satacmd_lba_mid_msb; /* LBA Mid MSB (LBA48) */ uint8_t satacmd_lba_high_msb; /* LBA High MSB (LBA48) */ uint8_t satacmd_sec_count_lsb; /* sector count LSB */ uint8_t satacmd_lba_low_lsb; /* LBA Low LSB */ uint8_t satacmd_lba_mid_lsb; /* LBA Mid LSB */ uint8_t satacmd_lba_high_lsb; /* LBA High LSB */ uint8_t satacmd_device_reg; /* ATA device register & LBA28 MSB */ uint8_t satacmd_cmd_reg; /* ATA command register */ uint8_t satacmd_features_reg; /* ATA features register */ uint8_t satacmd_status_reg; /* ATA status reg at cmd completion */ uint8_t satacmd_error_reg; /* ATA error reg at cmd completion */ uint8_t satacmd_acdb_len; /* ATAPI cdb length */ uint8_t satacmd_acdb[SATA_ATAPI_MAX_CDB_LEN]; /* ATAPI cdb */ uint8_t *satacmd_arq_cdb; /* Ptr to pre-set request sense cdb */ uint8_t satacmd_rqsense[SATA_ATAPI_RQSENSE_LEN]; /* request sense buf */ struct sata_cmd *satacmd_rle_sata_cmd; /* Ptr to pre-set FPDMA error retrieval cmd */ int satacmd_num_dma_cookies; /* number of dma cookies */ ddi_dma_cookie_t *satacmd_dma_cookie_list; /* ptr to dma cookie list */ satacmd_rev Version of the sata_cmd structure. satacmd_bp Pointer to the sata buffer structure. The buffer is kernel addressable and has DMA resources already allocated, SATA HBA driver may use this buffer for either programmatic access, or as the DMA buffer, utilizing DMA cookies list specified in sata_cmd structure. satacmd_flags This field specifies data transfer direction (if data transfer is involved), command queuing type, and device reset state handling. SATA HBA driver may use it to set direction of the transfer without examining specified ATA command. SATA_DIR_READ Reading data from the attached device. SATA_DIR_WRITE Writing data to the attached device. SATA_DIR_NODATA_XFER There is no data transfer involved. SATA_QUEUE_STAG_CMD Simple-queue-tagged command. SATA_QUEUE_OTAG_CMD Ordered-queue-tagged command. scsi_pkt FLAG_HTAG and FLAG_HEAD tagged operations are translated into SATA_QUEUE_OTAG_CMD. SATA_QUEUED_CMD Native Command Queuing read/write command is specified. SATA_IGNORE_DEV_RESET_STATE Ignore device reset state; execute specified command. SATA_CLEAR_DEV_RESET_STATE Clear device reset state; execute specified command. satacmd_addr_type Addressing method used by the attached device. This field allows SATA HBA driver to correctly use other addressing information in sata_cmd structure: ATA_ADDR_LBA Legacy Logical Block Address addressing mode when 28-bit and 48-bit addressing modes are not supported by the device. ATA_ADDR_LBA28 28-bit LBA mode. ATA_ADDR_LBA48 48-bit LBA mode. satacmd_features_reg_ext The content of this field specifies device's ATA Feature Register Extended. satacmd_sec_count_msb Bits 15:8 of the sector count. Valid only when addressing mode indicates ATA_ADDR_LBA48 mode. satacmd_lba_low_msb Bits 31:24 of the LBA. Valid only when addressing mode indicates ATA_ADDR_LBA28 or ATA_ADDR_LBA48 mode. satacmd_lba_mid_msb Bits 39:32 of the LBA. Valid only when addressing mode indicates ATA_ADDR_LBA48 mode. satacmd_lba_high_msb Bits 47:40 of the LBA. Valid only when addressing mode indicates ATA_ADDR_LBA48 mode. satacmd_sec_count_lsb Bits 7:0 of the sector count. satacmd_lba_low_lsb Bits 7:0 of the LBA. satacmd_lba_mid_lsb Bits 8:15 of the LBA. satacmd_lba_high_lsb Bits 23:16 of the LBA. satacmd_device_reg Device addressing mode (LBA) and a bits 27:24 if 28-bit addressing mode (ATA_ADDR_LBA28) is used. See ATA/ATAPI spec for more detailed description. SATA HBA Framework supports only devices using LBA mode. satacmd_cmd_reg The content of this field specifies ATA/ATAPI command. satacmd_features_reg The content of this field specifies device's ATA Feature Register. satacmd_status_reg This field should be set by SATA HBA driver according to the the contents of the device's Status register when specified ATA/ATAPI command is completed or terminated by a device for any reason. satacmd_error_reg This field should be set by SATA HBA driver according to the contents of the device's Error register when specified ATA/ATAPI command is completed by a device with error. The sector count and lba fields of the sata_cmd structure should be also set-up by the SATA HBA driver to reflect the values in corresponding device registers. This information is used by SATA HBA framework to determine the cause of an error. satacmd_acdb_len The content of this field specifies the length in bytes of the ATAPI command in acdb field. If zero, there is no command in the acdb field. When ATAPI command is to be sent, other fields of the sata_cmd structure specify ATA PACKET command, the command to be sent via PACKET command is set in acdb field and acdb_len is set to the length of the ATAPI command (in bytes). satacmd_acdb The byte array containing ATAPI command Command Descriptor Block (CDB). satacmd_arq_cdb This is a pointer to the REQUEST SENSE CDB, i.e byte array containing REQUEST SENSE command descriptor block. SATA HBA driver has to use this command to retrieve request sense data if the previously sent ATAPI command. REQUEST SENSE command could be sent using the same ATA PACKET command that was used to send failed ATAPI command. Request sense data should be returned in rqsense array. satacmd_rqsense This is a byte array to be used for request sense data returned by REQUEST SENSE command. See arq_cdb description. satacmd_ rle_sata_cmd This is a pointer to the pre-set sata_cmd structure containing READ_LOG EXT command. SATA HBA driver may use this command to retrieve error information for a native queued command (READ FPDMA QUEUED command or WRITE FPDMA QUEUED command). satacmd_num_dma_cookies Number of DMA cookies necessary for the DMA transfer of a data to be read or written by the command specified in sata_cmd structure. satacmd_dma_cookie_list This is an array of the dma_cookie_t structures necessary for setting-up a DMA transfer of a data to be read or written by the command specified in sata_cmd structure. These cookies are managed by SATA HBA framework and SATA HBA driver should not try to free them. SEE ALSO sata_hba_tran(9S), sata_pkt(9S), sata_device(9S), sata_address(9S), sata_tran_start(9E)