--- nono/vm/scsi.h 2026/04/29 17:04:32 1.1.1.3 +++ nono/vm/scsi.h 2026/04/29 17:04:39 1.1.1.5 @@ -1,6 +1,7 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once @@ -42,10 +43,10 @@ class SCSI }; // フェーズ文字列を返す - static const char * const GetPhaseName(int phase) { + static const char * GetPhaseName(int phase) { return GetPhaseName((Phase)phase); } - static const char * const GetPhaseName(Phase phase) { + static const char * GetPhaseName(Phase phase) { switch (phase) { case BusFree: return "BusFree"; case Arbitration: return "Arbitration"; @@ -57,10 +58,10 @@ class SCSI } // 情報転送フェーズ文字列を返す - static const char * const GetXferPhaseName(int xfer) { + static const char * GetXferPhaseName(int xfer) { return GetXferPhaseName((XferPhase)xfer); } - static const char * const GetXferPhaseName(XferPhase xfer) { + static const char * GetXferPhaseName(XferPhase xfer) { switch (xfer) { case DataOut: return "DataOut"; case DataIn: return "DataIn"; @@ -74,7 +75,7 @@ class SCSI } // デバイス種別 - enum DevType { + enum class DevType { None = 0, HD, }; @@ -175,6 +176,34 @@ class SCSI static const uint8 Identify = 0x80; // 0x80..0xff }; + // センスキー + struct SenseKey { + static const uint8 NoSense = 0x0; + static const uint8 RecoveredError = 0x1; + static const uint8 NotReady = 0x2; + static const uint8 MediumError = 0x3; + static const uint8 HardwareError = 0x4; + static const uint8 IllegalRequest = 0x5; + static const uint8 UnitAttention = 0x6; + static const uint8 DataProtect = 0x7; + static const uint8 BlankCheck = 0x8; + static const uint8 VendorSpecific = 0x9; + static const uint8 CopyAborted = 0xa; + static const uint8 AbortedCommand = 0xb; + static const uint8 Equal = 0xc; + static const uint8 VolumeOverflow = 0xd; + static const uint8 Miscompare = 0xe; + static const uint8 Reserved = 0xf; + }; + + // ASC/ASCQ + // 上位バイトが ASC、下位バイトが ASCQ を示す。 + struct ASC { + static const uint16 NoAdditionalSenseInformation = 0x0000; + static const uint16 InvalidCommandOperationCode = 0x2000; + static const uint16 InvalidFieldInCDB = 0x2400; + }; + // Mode Select(6) ヘッダ struct ModeParamHdr { uint8 mode_param_len; // バイト長 (このバイトを含まずこれ以降)