Improved passing of scan codes to the emulated keyboards;
Fixed Sound Blaster 16 and earlier CD-ROM volume registers (and made them no longer default to 0); Serial mouse now resets the FIFO before sending the ID, fixes mouse detection after clipping and moving the mouse; Rewritten CD-ROM and SCSI disk Mode Select handling and changed things regarding Mode Sense as well, also fixes emulator segmentation faults when anything attempts to do a Mode Select; Fixed the Microsoft InPort mouse emulation (used the Bochs code as reference for the polling/state update code), now it actually moves; The PCjr initialization now sets the XT scan code table, makes the keyboard actually work on the PCjr again; Several bugfixes regarding the Read CD commands, fixes CD Audio in digital mode on Windows ME; Finally properly fixed the regular CD Audio MSF/LBA conversion mess; Applied all applicable PCem commits.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Emulation of SCSI fixed and removable disks.
|
||||
*
|
||||
* Version: @(#)scsi_disk.c 1.0.12 2018/01/06
|
||||
* Version: @(#)scsi_disk.c 1.0.13 2018/01/13
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -137,319 +137,22 @@ uint8_t scsi_hd_command_flags[0x100] = {
|
||||
};
|
||||
|
||||
|
||||
uint64_t scsi_hd_mode_sense_page_flags[HDD_NUM] = { (1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F),
|
||||
(1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F) };
|
||||
uint64_t scsi_hd_mode_sense_page_flags = (1LL << 0x03) | (1LL << 0x04) | (1LL << 0x30) | (1LL << 0x3F);
|
||||
|
||||
/* This should be done in a better way but for time being, it's been done this way so it's not as huge and more readable. */
|
||||
const uint8_t scsi_hd_mode_sense_pages_default[HDD_NUM][0x40][0x40] =
|
||||
{
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
static const mode_sense_pages_t scsi_hd_mode_sense_pages_default =
|
||||
{ { [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } }
|
||||
};
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }
|
||||
} };
|
||||
|
||||
uint8_t scsi_hd_mode_sense_pages_changeable[HDD_NUM][0x40][0x40] =
|
||||
{
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
static const mode_sense_pages_t scsi_hd_mode_sense_pages_changeable =
|
||||
{ { [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } }
|
||||
};
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }
|
||||
} };
|
||||
|
||||
uint8_t scsi_hd_mode_sense_pages_saved[HDD_NUM][0x40][0x40] =
|
||||
{
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } },
|
||||
{ [0x03] = { 0x03, 0x16, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
[0x04] = { 0x04, 0x16, 0, 0x10, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0, 0 },
|
||||
[0x30] = { 0xB0, 0x16, '8', '6', 'B', 'o', 'x', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } }
|
||||
};
|
||||
static mode_sense_pages_t scsi_hd_mode_sense_pages_saved[HDD_NUM];
|
||||
|
||||
|
||||
#ifdef ENABLE_SCSI_DISK_LOG
|
||||
@@ -472,8 +175,6 @@ scsi_hd_log(const char *fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
int scsi_hd_mode_select_terminate(uint8_t id, int force);
|
||||
|
||||
/* Translates ATAPI status (ERR_STAT flag) to SCSI status. */
|
||||
int scsi_hd_err_stat_to_scsi(uint8_t id)
|
||||
{
|
||||
@@ -516,7 +217,6 @@ int find_hdd_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun)
|
||||
void scsi_disk_insert(uint8_t id)
|
||||
{
|
||||
shdc[id].unit_attention = (hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? 1 : 0;
|
||||
scsi_hd_mode_select_terminate(id, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -591,6 +291,37 @@ void build_scsi_hd_map(void)
|
||||
}
|
||||
}
|
||||
|
||||
void scsi_hd_mode_sense_load(uint8_t id)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
int i;
|
||||
memset(&scsi_hd_mode_sense_pages_saved[id], 0, sizeof(mode_sense_pages_t));
|
||||
for (i = 0; i < 0x3f; i++) {
|
||||
if (scsi_hd_mode_sense_pages_default.pages[i][1] != 0)
|
||||
memcpy(scsi_hd_mode_sense_pages_saved[id].pages[i], scsi_hd_mode_sense_pages_default.pages[i], scsi_hd_mode_sense_pages_default.pages[i][1] + 2);
|
||||
}
|
||||
swprintf(file_name, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
f = plat_fopen(nvr_path(file_name), L"rb");
|
||||
if (f) {
|
||||
fread(scsi_hd_mode_sense_pages_saved[id].pages[0x30], 1, 0x18, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void scsi_hd_mode_sense_save(uint8_t id)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
swprintf(file_name, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = plat_fopen(nvr_path(file_name), L"wb");
|
||||
if (f) {
|
||||
fwrite(scsi_hd_mode_sense_pages_saved[id].pages[0x30], 1, 0x18, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
int scsi_hd_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len)
|
||||
{
|
||||
@@ -616,13 +347,13 @@ uint8_t scsi_hd_mode_sense_read(uint8_t id, uint8_t page_control, uint8_t page,
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
return scsi_hd_mode_sense_pages_saved[id][page][pos];
|
||||
return scsi_hd_mode_sense_pages_saved[id].pages[page][pos];
|
||||
break;
|
||||
case 1:
|
||||
return scsi_hd_mode_sense_pages_changeable[id][page][pos];
|
||||
return scsi_hd_mode_sense_pages_changeable.pages[page][pos];
|
||||
break;
|
||||
case 2:
|
||||
return scsi_hd_mode_sense_pages_default[id][page][pos];
|
||||
return scsi_hd_mode_sense_pages_default.pages[page][pos];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -659,7 +390,7 @@ uint32_t scsi_hd_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type
|
||||
{
|
||||
if ((type == GPMODE_ALL_PAGES) || (type == i))
|
||||
{
|
||||
if (scsi_hd_mode_sense_page_flags[id] & (1LL << shdc[id].current_page_code))
|
||||
if (scsi_hd_mode_sense_page_flags & (1LL << shdc[id].current_page_code))
|
||||
{
|
||||
buf[pos++] = scsi_hd_mode_sense_read(id, page_control, i, 0);
|
||||
msplen = scsi_hd_mode_sense_read(id, page_control, i, 1);
|
||||
@@ -676,265 +407,6 @@ uint32_t scsi_hd_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type
|
||||
return pos;
|
||||
}
|
||||
|
||||
void scsi_hd_mode_sense_load(uint8_t id)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t temp[512];
|
||||
memset(temp, 0, 1024);
|
||||
swprintf(temp, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = plat_fopen(nvr_path(temp), L"rb");
|
||||
if (!f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fread(scsi_hd_mode_sense_pages_saved[id][0x30], 1, 0x18, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void scsi_hd_mode_sense_save(uint8_t id)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t temp[512];
|
||||
memset(temp, 0, 1024);
|
||||
swprintf(temp, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = plat_fopen(nvr_path(temp), L"wb");
|
||||
if (!f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fwrite(scsi_hd_mode_sense_pages_saved[id][0x30], 1, 0x18, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
int scsi_hd_mode_select_init(uint8_t id, uint8_t command, uint16_t pl_length, uint8_t do_save)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case GPCMD_MODE_SELECT_6:
|
||||
shdc[id].current_page_len = 4;
|
||||
break;
|
||||
case GPCMD_MODE_SELECT_10:
|
||||
shdc[id].current_page_len = 8;
|
||||
break;
|
||||
default:
|
||||
scsi_hd_log("SCSI HDD %i: Attempting to initialize MODE SELECT with unrecognized command: %02X\n", id, command);
|
||||
return -1;
|
||||
}
|
||||
if (pl_length == 0)
|
||||
{
|
||||
scsi_hd_log("SCSI HDD %i: Attempting to initialize MODE SELECT with zero parameter list length: %02X\n", id, command);
|
||||
return -2;
|
||||
}
|
||||
shdc[id].current_page_pos = 0;
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_HEADER;
|
||||
shdc[id].total_length = pl_length;
|
||||
shdc[id].written_length = 0;
|
||||
shdc[id].do_page_save = do_save;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_hd_mode_select_terminate(uint8_t id, int force)
|
||||
{
|
||||
if (((shdc[id].written_length >= shdc[id].total_length) || force) && (shdc[id].mode_select_phase != MODE_SELECT_PHASE_IDLE))
|
||||
{
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT terminate: %i\n", id, force);
|
||||
shdc[id].current_page_pos = shdc[id].current_page_len = shdc[id].block_descriptor_len = 0;
|
||||
shdc[id].total_length = shdc[id].written_length = 0;
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_IDLE;
|
||||
if (force)
|
||||
{
|
||||
scsi_hd_mode_sense_load(id);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int scsi_hd_mode_select_header(uint8_t id, uint8_t val)
|
||||
{
|
||||
if (shdc[id].current_page_pos == 0)
|
||||
{
|
||||
shdc[id].block_descriptor_len = 0;
|
||||
}
|
||||
else if (shdc[id].current_page_pos == (shdc[id].current_page_len - 2))
|
||||
{
|
||||
if (shdc[id].current_page_len == 8)
|
||||
{
|
||||
shdc[id].block_descriptor_len |= ((uint16_t) val) << 8;
|
||||
scsi_hd_log("SCSI HDD %i: Position: %02X, value: %02X, block descriptor length: %02X\n", id, shdc[id].current_page_pos, val, shdc[id].block_descriptor_len);
|
||||
}
|
||||
}
|
||||
else if (shdc[id].current_page_pos == (shdc[id].current_page_len - 1))
|
||||
{
|
||||
shdc[id].block_descriptor_len |= (uint16_t) val;
|
||||
scsi_hd_log("SCSI HDD %i: Position: %02X, value: %02X, block descriptor length: %02X\n", id, shdc[id].current_page_pos, val, shdc[id].block_descriptor_len);
|
||||
}
|
||||
|
||||
shdc[id].current_page_pos++;
|
||||
|
||||
if (shdc[id].current_page_pos >= shdc[id].current_page_len)
|
||||
{
|
||||
shdc[id].current_page_pos = 0;
|
||||
if (shdc[id].block_descriptor_len)
|
||||
{
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_BLOCK_DESC;
|
||||
}
|
||||
else
|
||||
{
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_PAGE_HEADER;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_hd_mode_select_block_desc(uint8_t id)
|
||||
{
|
||||
shdc[id].current_page_pos++;
|
||||
if (shdc[id].current_page_pos >= 8)
|
||||
{
|
||||
shdc[id].current_page_pos = 0;
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_PAGE_HEADER;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void scsi_hd_invalid_field_pl(uint8_t id);
|
||||
|
||||
int scsi_hd_mode_select_page_header(uint8_t id, uint8_t val)
|
||||
{
|
||||
if (shdc[id].current_page_pos == 0)
|
||||
{
|
||||
shdc[id].current_page_code = val & 0x3f;
|
||||
if (!(scsi_hd_mode_sense_page_flags[id] & (1LL << shdc[id].current_page_code)))
|
||||
{
|
||||
scsi_hd_log("SCSI HDD %i: Trying to modify an unimplemented page: %02X\n", id, shdc[id].current_page_code);
|
||||
scsi_hd_mode_select_terminate(id, 1);
|
||||
scsi_hd_invalid_field_pl(id);
|
||||
}
|
||||
shdc[id].current_page_pos++;
|
||||
}
|
||||
else if (shdc[id].current_page_pos == 1)
|
||||
{
|
||||
shdc[id].current_page_pos = 0;
|
||||
shdc[id].current_page_len = val;
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_PAGE;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scsi_hd_mode_select_page(uint8_t id, uint8_t val)
|
||||
{
|
||||
if (scsi_hd_mode_sense_pages_changeable[id][shdc[id].current_page_code][shdc[id].current_page_pos + 2] != 0xFF)
|
||||
{
|
||||
if (val != scsi_hd_mode_sense_pages_saved[id][shdc[id].current_page_code][shdc[id].current_page_pos + 2])
|
||||
{
|
||||
/* Trying to change an unchangeable value. */
|
||||
scsi_hd_log("SCSI HDD %i: Trying to change an unchangeable value: [%02X][%02X] = %02X (new: %02X)\n", id, shdc[id].current_page_code, shdc[id].current_page_pos + 2, scsi_hd_mode_sense_pages_saved[id][shdc[id].current_page_code][shdc[id].current_page_pos + 2], val);
|
||||
scsi_hd_mode_select_terminate(id, 1);
|
||||
scsi_hd_invalid_field_pl(id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shdc[id].current_page_code == 0xE)
|
||||
{
|
||||
if ((shdc[id].current_page_pos == 6) || (shdc[id].current_page_pos == 8))
|
||||
{
|
||||
if (val > 3)
|
||||
{
|
||||
/* Trying to set an unsupported audio channel. */
|
||||
scsi_hd_log("SCSI HDD %i: Trying to set an unsupported value: [%02X][%02X] = %02X (new: %02X)\n", id, shdc[id].current_page_code, shdc[id].current_page_pos, scsi_hd_mode_sense_pages_saved[id][shdc[id].current_page_code][shdc[id].current_page_pos + 2], val);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
scsi_hd_mode_sense_pages_saved[id][shdc[id].current_page_code][shdc[id].current_page_pos + 2] = val;
|
||||
}
|
||||
shdc[id].current_page_pos++;
|
||||
if (shdc[id].current_page_pos >= shdc[id].current_page_len)
|
||||
{
|
||||
shdc[id].current_page_pos = 0;
|
||||
shdc[id].mode_select_phase = MODE_SELECT_PHASE_PAGE_HEADER;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void scsi_hd_command_complete(uint8_t id);
|
||||
|
||||
int scsi_hd_mode_select_write(uint8_t id, uint8_t val)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret2 = 0;
|
||||
|
||||
if (id > HDD_NUM)
|
||||
{
|
||||
scsi_hd_log("MODE SELECT: attempted write to wrong SCSI HDD drive\n", val);
|
||||
return -6;
|
||||
}
|
||||
|
||||
if (shdc[id].total_length == 0)
|
||||
{
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT: attempted write when not initialized (%02X)\n", id, val);
|
||||
return -3;
|
||||
}
|
||||
|
||||
shdc[id].written_length++;
|
||||
|
||||
switch (shdc[id].mode_select_phase)
|
||||
{
|
||||
case MODE_SELECT_PHASE_IDLE:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT idle (%02X)\n", id, val);
|
||||
ret = 1;
|
||||
break;
|
||||
case MODE_SELECT_PHASE_HEADER:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT header (%02X)\n", id, val);
|
||||
ret = scsi_hd_mode_select_header(id, val);
|
||||
break;
|
||||
case MODE_SELECT_PHASE_BLOCK_DESC:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT block descriptor (%02X)\n", id, val);
|
||||
ret = scsi_hd_mode_select_block_desc(id);
|
||||
break;
|
||||
case MODE_SELECT_PHASE_PAGE_HEADER:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT page header (%02X)\n", id, val);
|
||||
ret = scsi_hd_mode_select_page_header(id, val);
|
||||
break;
|
||||
case MODE_SELECT_PHASE_PAGE:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT page (%02X)\n", id, val);
|
||||
ret = scsi_hd_mode_select_page(id, val);
|
||||
if (shdc[id].mode_select_phase == MODE_SELECT_PHASE_PAGE_HEADER)
|
||||
{
|
||||
if (shdc[id].do_page_save && (scsi_hd_mode_sense_pages_default[id][shdc[id].current_page_code][0] & 0x80))
|
||||
{
|
||||
scsi_hd_log("SCSI HDD %i: Page %i finished, saving it...\n", id, shdc[id].current_page_code);
|
||||
scsi_hd_mode_sense_save(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
scsi_hd_log("SCSI HDD %i: MODE SELECT unknown phase (%02X)\n", id, val);
|
||||
ret = -4;
|
||||
break;
|
||||
}
|
||||
|
||||
/* On termination, override the return value, but only if it is 1. */
|
||||
ret2 = scsi_hd_mode_select_terminate(id, 0);
|
||||
if (ret2)
|
||||
{
|
||||
scsi_hd_command_complete(id);
|
||||
}
|
||||
if (ret2 && (ret == 1))
|
||||
{
|
||||
ret = -5;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void scsi_hd_update_request_length(uint8_t id, int len, int block_len)
|
||||
{
|
||||
/* For media access commands, make sure the requested DRQ length matches the block length. */
|
||||
@@ -1695,73 +1167,47 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
||||
block_desc = ((cdb[1] >> 3) & 1) ? 0 : 1;
|
||||
|
||||
if (cdb[0] == GPCMD_MODE_SENSE_6)
|
||||
{
|
||||
len = cdb[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (cdb[8] | (cdb[7] << 8));
|
||||
}
|
||||
|
||||
shdc[id].current_page_code = cdb[2] & 0x3F;
|
||||
|
||||
#if 0
|
||||
if (!(scsi_hd_mode_sense_page_flags[id] & (1LL << shdc[id].current_page_code)))
|
||||
{
|
||||
scsi_hd_invalid_field(id);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
alloc_length = len;
|
||||
|
||||
shdc[id].temp_buffer = (uint8_t *) malloc(65536);
|
||||
memset(shdc[id].temp_buffer, 0, 65536);
|
||||
|
||||
if (cdb[0] == GPCMD_MODE_SENSE_6)
|
||||
{
|
||||
if (cdb[0] == GPCMD_MODE_SENSE_6) {
|
||||
len = scsi_hd_mode_sense(id, shdc[id].temp_buffer, 4, cdb[2], block_desc);
|
||||
if (len > alloc_length)
|
||||
{
|
||||
len = alloc_length;
|
||||
}
|
||||
shdc[id].temp_buffer[0] = len - 1;
|
||||
shdc[id].temp_buffer[1] = 0;
|
||||
if (block_desc)
|
||||
{
|
||||
shdc[id].temp_buffer[3] = 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = scsi_hd_mode_sense(id, shdc[id].temp_buffer, 8, cdb[2], block_desc);
|
||||
if (len > alloc_length)
|
||||
{
|
||||
len = alloc_length;
|
||||
}
|
||||
shdc[id].temp_buffer[0]=(len - 2) >> 8;
|
||||
shdc[id].temp_buffer[1]=(len - 2) & 255;
|
||||
shdc[id].temp_buffer[2] = 0;
|
||||
if (block_desc)
|
||||
{
|
||||
if (block_desc) {
|
||||
shdc[id].temp_buffer[6] = 0;
|
||||
shdc[id].temp_buffer[7] = 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (len > alloc_length)
|
||||
{
|
||||
len = alloc_length;
|
||||
}
|
||||
else if (len < alloc_length)
|
||||
{
|
||||
alloc_length = len;
|
||||
}
|
||||
|
||||
if ((*BufLen == -1) || (alloc_length < *BufLen))
|
||||
{
|
||||
*BufLen = alloc_length;
|
||||
}
|
||||
|
||||
scsi_hd_log("SCSI HDD %i: Reading mode page: %02X...\n", id, cdb[2]);
|
||||
|
||||
@@ -1773,21 +1219,18 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
||||
scsi_hd_set_phase(id, SCSI_PHASE_DATA_OUT);
|
||||
|
||||
if (cdb[0] == GPCMD_MODE_SELECT_6)
|
||||
{
|
||||
len = cdb[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
len = (cdb[7] << 8) | cdb[8];
|
||||
}
|
||||
|
||||
if ((*BufLen == -1) || (len < *BufLen))
|
||||
{
|
||||
*BufLen = len;
|
||||
}
|
||||
|
||||
scsi_hd_mode_select_init(id, cdb[0], len, cdb[1] & 1);
|
||||
|
||||
shdc[id].total_length = len;
|
||||
shdc[id].do_page_save = cdb[1] & 1;
|
||||
|
||||
shdc[id].current_page_pos = 0;
|
||||
|
||||
scsi_hd_data_command_finish(id, len, len, len, 1);
|
||||
return;
|
||||
|
||||
@@ -2093,10 +1536,8 @@ void scsi_hd_phase_data_in(uint8_t id)
|
||||
|
||||
void scsi_hd_phase_data_out(uint8_t id)
|
||||
{
|
||||
int ret = 0;
|
||||
uint8_t *hdbufferb = SCSIDevices[hdd[id].scsi_id][hdd[id].scsi_lun].CmdBuffer;
|
||||
|
||||
int in_data_length = 0;
|
||||
int i;
|
||||
|
||||
int32_t *BufLen = &SCSIDevices[hdd[id].scsi_id][hdd[id].scsi_lun].BufferLength;
|
||||
@@ -2106,6 +1547,14 @@ void scsi_hd_phase_data_out(uint8_t id)
|
||||
|
||||
uint32_t c, h, s;
|
||||
|
||||
uint16_t block_desc_len;
|
||||
uint16_t pos;
|
||||
|
||||
uint8_t error = 0;
|
||||
uint8_t page, page_len;
|
||||
|
||||
uint8_t hdr_len, val, old_val, ch;
|
||||
|
||||
if (!*BufLen)
|
||||
{
|
||||
scsi_hd_set_phase(id, SCSI_PHASE_STATUS);
|
||||
@@ -2167,22 +1616,51 @@ void scsi_hd_phase_data_out(uint8_t id)
|
||||
break;
|
||||
case GPCMD_MODE_SELECT_6:
|
||||
case GPCMD_MODE_SELECT_10:
|
||||
in_data_length = *BufLen;
|
||||
if (shdc[id].current_cdb[0] == GPCMD_MODE_SELECT_10)
|
||||
hdr_len = 8;
|
||||
else
|
||||
hdr_len = 4;
|
||||
|
||||
for (i = 0; i < in_data_length; i++)
|
||||
{
|
||||
ret = scsi_hd_mode_select_write(id, hdbufferb[i]);
|
||||
ret = scsi_hd_mode_select_return(id, ret);
|
||||
if (ret == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (ret == -2)
|
||||
{
|
||||
scsi_hd_callback(id);
|
||||
return;
|
||||
block_desc_len = hdbufferb[6];
|
||||
block_desc_len <<= 8;
|
||||
block_desc_len |= hdbufferb[7];
|
||||
|
||||
pos = hdr_len + block_desc_len;
|
||||
|
||||
while(1) {
|
||||
page = hdbufferb[pos] & 0x3F;
|
||||
page_len = hdbufferb[pos + 1];
|
||||
|
||||
pos += 2;
|
||||
|
||||
if (!(scsi_hd_mode_sense_page_flags & (1LL << ((uint64_t) page))))
|
||||
error |= 1;
|
||||
else {
|
||||
for (i = 0; i < page_len; i++) {
|
||||
ch = scsi_hd_mode_sense_pages_changeable.pages[page][i + 2];
|
||||
val = hdbufferb[pos + i];
|
||||
old_val = scsi_hd_mode_sense_pages_saved[id].pages[page][i + 2];
|
||||
if (val != old_val) {
|
||||
if (ch)
|
||||
scsi_hd_mode_sense_pages_saved[id].pages[page][i + 2] = val;
|
||||
else
|
||||
error |= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pos += page_len;
|
||||
|
||||
val = scsi_hd_mode_sense_pages_default.pages[page][0] & 0x80;
|
||||
if (shdc[id].do_page_save && val)
|
||||
scsi_hd_mode_sense_save(id);
|
||||
|
||||
if (pos >= shdc[id].total_length)
|
||||
break;
|
||||
}
|
||||
|
||||
if (error)
|
||||
scsi_hd_invalid_field_pl(id);
|
||||
break;
|
||||
default:
|
||||
fatal("SCSI HDD %i: Bad Command for phase 2 (%02X)\n", shdc[id].current_cdb[0]);
|
||||
|
||||
Reference in New Issue
Block a user