From a39b11168442a6437c293fa65e31fff636d6cd9c Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 12 Dec 2006 18:54:35 +0000 Subject: Automatically select between the "10" and "16" variants of command set, based on the device size. --- src/include/gpxe/scsi.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/include') diff --git a/src/include/gpxe/scsi.h b/src/include/gpxe/scsi.h index 4cc2b86de..9d5952dad 100644 --- a/src/include/gpxe/scsi.h +++ b/src/include/gpxe/scsi.h @@ -16,7 +16,9 @@ * @{ */ +#define SCSI_OPCODE_READ_10 0x28 /**< READ (10) */ #define SCSI_OPCODE_READ_16 0x88 /**< READ (16) */ +#define SCSI_OPCODE_WRITE_10 0x2a /**< WRITE (10) */ #define SCSI_OPCODE_WRITE_16 0x8a /**< WRITE (16) */ #define SCSI_OPCODE_READ_CAPACITY_10 0x25 /**< READ CAPACITY (10) */ #define SCSI_OPCODE_SERVICE_ACTION_IN 0x9e /**< SERVICE ACTION IN */ @@ -40,6 +42,28 @@ * @{ */ +/** A SCSI "READ (10)" CDB */ +struct scsi_cdb_read_10 { + /** Opcode (0x28) */ + uint8_t opcode; + /** Flags */ + uint8_t flags; + /** Start address + * + * This is a logical block number, in big-endian order. + */ + uint32_t lba; + /** Group number */ + uint8_t group; + /** Transfer length + * + * This is a logical block count, in big-endian order. + */ + uint16_t len; + /** Control byte */ + uint8_t control; +} __attribute__ (( packed )); + /** A SCSI "READ (16)" CDB */ struct scsi_cdb_read_16 { /** Opcode (0x88) */ @@ -62,6 +86,28 @@ struct scsi_cdb_read_16 { uint8_t control; } __attribute__ (( packed )); +/** A SCSI "WRITE (10)" CDB */ +struct scsi_cdb_write_10 { + /** Opcode (0x2a) */ + uint8_t opcode; + /** Flags */ + uint8_t flags; + /** Start address + * + * This is a logical block number, in big-endian order. + */ + uint32_t lba; + /** Group number */ + uint8_t group; + /** Transfer length + * + * This is a logical block count, in big-endian order. + */ + uint16_t len; + /** Control byte */ + uint8_t control; +} __attribute__ (( packed )); + /** A SCSI "WRITE (16)" CDB */ struct scsi_cdb_write_16 { /** Opcode (0x8a) */ @@ -143,7 +189,9 @@ struct scsi_capacity_16 { /** A SCSI Command Data Block */ union scsi_cdb { + struct scsi_cdb_read_10 read10; struct scsi_cdb_read_16 read16; + struct scsi_cdb_write_10 write10; struct scsi_cdb_write_16 write16; struct scsi_cdb_read_capacity_10 readcap10; struct scsi_cdb_read_capacity_16 readcap16; -- cgit v1.2.3-55-g7522