* grub-core/disk/scsi.c (grub_scsi_read_capacity): Renamed to ...
(grub_scsi_read_capacity10): ... this. (grub_scsi_read_capacity16): New function. (grub_scsi_open): Use read_capacity16 if read_capacity10 returned 0xffffffff. Fix off-by-one error. * include/grub/scsi.h (grub_scsi): Rename size to last_block and make it 64-bit unsigned. * include/grub/scsicmd.h (grub_scsi_read_capacity): Rename to ... (grub_scsi_read_capacity10): ... this. (grub_scsi_read_capacity_data): Rename to ... (grub_scsi_read_capacity10_data): ... this. Rename size to last_block. (grub_scsi_read_capacity16): New struct. (grub_scsi_read_capacity16_data): Likewise. (grub_scsi_cmd_t): Rename grub_scsi_cmd_read_capacity to grub_scsi_cmd_read_capacity10. New command grub_scsi_cmd_read_capacity16.
This commit is contained in:
parent
bc8d0f45a5
commit
9c08ad8707
4 changed files with 102 additions and 18 deletions
|
@ -94,11 +94,11 @@ struct grub_scsi
|
|||
/* Set to 0 when not removable, 1 when removable. */
|
||||
int removable;
|
||||
|
||||
/* Size of the device in blocks. */
|
||||
int size;
|
||||
/* Size of the device in blocks - 1. */
|
||||
grub_uint64_t last_block;
|
||||
|
||||
/* Size of one block. */
|
||||
int blocksize;
|
||||
grub_uint32_t blocksize;
|
||||
|
||||
/* Device-specific data. */
|
||||
void *data;
|
||||
|
|
|
@ -85,7 +85,7 @@ struct grub_scsi_request_sense_data
|
|||
/* there can be additional sense field */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity
|
||||
struct grub_scsi_read_capacity10
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 reserved */
|
||||
|
@ -97,12 +97,29 @@ struct grub_scsi_read_capacity
|
|||
grub_uint16_t pad; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity_data
|
||||
struct grub_scsi_read_capacity10_data
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t last_block;
|
||||
grub_uint32_t blocksize;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity16
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 0x10 */
|
||||
grub_uint64_t logical_block_addr; /* only if PMI=1 */
|
||||
grub_uint32_t alloc_len;
|
||||
grub_uint8_t PMI;
|
||||
grub_uint8_t control;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity16_data
|
||||
{
|
||||
grub_uint64_t last_block;
|
||||
grub_uint32_t blocksize;
|
||||
grub_uint8_t pad[20];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read10
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
|
@ -170,11 +187,12 @@ typedef enum
|
|||
grub_scsi_cmd_test_unit_ready = 0x00,
|
||||
grub_scsi_cmd_request_sense = 0x03,
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_read_capacity = 0x25,
|
||||
grub_scsi_cmd_read_capacity10 = 0x25,
|
||||
grub_scsi_cmd_read10 = 0x28,
|
||||
grub_scsi_cmd_write10 = 0x2a,
|
||||
grub_scsi_cmd_read16 = 0x88,
|
||||
grub_scsi_cmd_write16 = 0x8a,
|
||||
grub_scsi_cmd_read_capacity16 = 0x9e,
|
||||
grub_scsi_cmd_read12 = 0xa8,
|
||||
grub_scsi_cmd_write12 = 0xaa,
|
||||
} grub_scsi_cmd_t;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue