diff options
author | Max Tottenham <mtottenh@akamai.com> | 2024-01-25 10:00:50 -0500 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2024-01-26 15:59:34 +0100 |
commit | 82faf1d5c8b25375b9029f2d6668135e62455a8c (patch) | |
tree | b272a5171b796d9e34a793be56611b3afc41ac16 /src/hw/blockcmd.h | |
parent | 3f082f38bf0050270dc65abf256f7014f6c0c4a8 (diff) | |
download | seabios-82faf1d5c8b25375b9029f2d6668135e62455a8c.tar.gz |
Add LBA 64bit support for reads beyond 2TB.
When booting from a >2TB drive/filesystem, it's possible what the
kernel/bootloader may be updated and written out at an LBA address
beyond what is normally accessible by the READ(10) SCSI commands.
If this happens to the kernel grub will fail to boot the kernel
as it will call into the BIOS with an LBA address >2TB, and the
BIOS will return an error. Per the SCSI spec, >2TB drives should
return 0XFFFFFFFF, and a READ CAPACITY(16) command should be issued
to determine the full size of the drive, READ(16) commands can then
be used in order to read data at LBA addresses beyond 2TB (64 bit
LBA addresses)
Signed-off-by: Max Tottenham <mtottenh@akamai.com>
Message-ID: <20240125150050.3775834-2-mtottenh@akamai.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'src/hw/blockcmd.h')
-rw-r--r-- | src/hw/blockcmd.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/hw/blockcmd.h b/src/hw/blockcmd.h index f18543ed..2683186c 100644 --- a/src/hw/blockcmd.h +++ b/src/hw/blockcmd.h @@ -18,6 +18,16 @@ struct cdb_rwdata_10 { u8 pad[6]; } PACKED; +#define CDB_CMD_READ_16 0x88 +#define CDB_CMD_WRITE_16 0x8A +struct cdb_rwdata_16 { + u8 command; + u8 flags; + u64 lba; + u32 count; + u16 reserved_14; +} PACKED; + #define CDB_CMD_READ_CAPACITY 0x25 struct cdb_read_capacity { @@ -32,6 +42,23 @@ struct cdbres_read_capacity { u32 blksize; } PACKED; + +#define CDB_CMD_SERVICE_ACTION_IN 0x9E +#define CDB_CMD_SAI_READ_CAPACITY_16 0x10 +struct cdb_sai_read_capacity_16 { + u8 command; + u8 flags; + u64 lba; //marked as obsolete? + u32 len; + u16 reserved_14; +} PACKED; + +struct cdbres_read_capacity_16 { + u64 sectors; + u32 blksize; + u8 reserved_12[20]; +} PACKED; + #define CDB_CMD_TEST_UNIT_READY 0x00 #define CDB_CMD_INQUIRY 0x12 #define CDB_CMD_REQUEST_SENSE 0x03 |