📄 eng_scsi.h
字号:
* try to find a block from dedicated spare pool first and then the global spare
* pool.
*/
#define REBUILD_POLICY_HOTSPARE_ENABLED bit( 0 )
/*
* if auto rebuild is enabled, and when a new block is available, engine will try
* to start rebuild automatically.
*/
#define REBUILD_POLICY_AUTO_ENABLED bit( 1 )
/*
* svucARRAY_COMMAND/acmdSAVE_MDD ? svucCONTROLLER_COMMAND/ccmdSAVE_DISK_MDD ?
* CDB_SAVE_DISK_MDD.Flags
*/
#define SAVEMDD_F_NONE 0
#define SAVEMDD_F_PREREAD bit( 0 ) /* this flag is reserved for internal usage
* ONLY! */
#define SAVEMDD_F_IMMEDIATELY bit( 1 ) /* force engine update MDD without delay */
/* CDB_SAVE_DISK_MDD.Control */
#define SAVEMDD_C_NORMAL 0 /* whatever */
#define SAVEMDD_C_CLEAR_BLOCK_MDD 1 /* clear block MDD */
#define SAVEMDD_C_CLEAR_DISK_MDD 2 /* clear disk MDD */
#define SAVEMDD_C_SAVE_BSL 3 /* to update BSL only */
#if defined(ENABLE_BBM)
#define SAVEMDD_C_SAVE_BBM 4 /* BBM update required */
#endif
#define SAVEMDD_C_RECONSTRUCT 5
#define SAVEMDD_C_CREATE_ARRAY 6
#if defined( _COMPILER_MS_C_COMPATIBLE )
#pragma pack( 1 )
#endif /* COMPILER_MS_C_COMPATIBLE */
typedef struct _CDB_SAVE_DISK_MDD
{
U8 OpCode; /* FIXED: svucCONTROLLER_COMMAND */
U8 SubOpCode; /* FIXED: ccmdSAVE_DISK_MDD */
U8 Flags; /* IN: see above SAVEMDD_F_xxx */
U8 Control; /* IN: see above SAVEMDD_C_xxx */
// U32 BlockIDBitmap; /* IN: blocks need to save MDD */
// U32 ArrayIDBitmap; /* IN: array ID map that requires generation inc. */
U8 BlockID; /* VOLATILE: current Block ID in processing, engine
* internal use */
U8 bFailCase; /* Engine internal use. */
U8 DiskID; /* Engine internal use. */
U8 bMDD; /* Engine internal use. */
} PACKED CDB_SAVE_DISK_MDD, buf_space * bpCDB_SAVE_DISK_MDD;
#define MAX_REBUILD_TARGETS 6
typedef struct _CDB_START_BGA
{
U8 OpCode; /* FIXED svucARRAY_COMMAND */
U8 SubOpCode; /* FIXED acmdBGA_START */
U8 Category; /* BGA_CAT_xxx */
union
{
U8 TargetBlock; /* for BGA_CAT_REBUILD */
U8 SyncKind; /* SYNC_KIND_xxx, for BGA_CAT_SYNC */
U8 InitKind; /* INIT_KIND_xxx, for BGA_CAT_INIT */
/* for migration, data payload is required */
} PACKED param;
U8 RebuildTargetCount; /* Usually it is 1 but more for RAID_MF */
U8 RebuildTargets[MAX_REBUILD_TARGETS-1];
}
PACKED CDB_START_BGA, buf_space * bpCDB_START_BGA;
#define BGA_CAT_REBUILD 0
#define BGA_CAT_INIT 1
#define BGA_CAT_SYNC 2
#define BGA_CAT_MIGRATION 3
#define BGA_CAT_REBUILD_DISKS 4
#define SYNC_KIND_NORMAL 0 /* normal sync (common sense) */
#define SYNC_KIND_CHECKONLY 1 /* consistency checking only, without fixing */
#define INIT_KIND_QUICK 0 /* quick initialization */
#define INIT_KIND_FULL_FOREGRND 1 /* full foreground initialization */
#define INIT_KIND_FULL_BACKGRND 2 /* full background initialization */
typedef struct _CDB_BGA_CONTROL
{
U8 OpCode; /* FIXED svucARRAY_COMMAND */
U8 SubOpCode; /* FIXED acmdBGA_CONTROL */
U8 Action; /* MT_ACT_xxx */
}
PACKED CDB_BGA_CONTROL, buf_space * bpCDB_BGA_CONTROL;
typedef struct _CDB_BLOCK_CONTROL
{
U8 OpCode; /* FIXED svucCONTROLLER_COMMAND */
U8 SubOpCode; /* FIXED ccmdBLOCK_CONTROL */
U8 Action; /* BC_ACT_xxx */
U8 Flags; /* BC_F_xxx */
union
{
U8 BlockID;
U8 DiskID; /* for BC_ACT_WIPEOUT_DISK_MDD */
} PACKED id;
union
{
struct
{
U8 DedicatedArrayID; /* 0xff if to make a global spare block */
} PACKED make_spare_block;
struct
{
U8 ArrayID;
U8 StreamID;
} PACKED add_block; /* for BC_ACT_ADD_TO_ARRAY */
struct
{
U8 Param1;
U8 Param2;
} PACKED generic;
} PACKED param;
}
PACKED CDB_BLOCK_CONTROL, buf_space * bpCDB_BLOCK_CONTROL;
typedef struct _SPLIT_BLOCK_PARAM
{
LBA wOffsetLBA;
} SPLIT_BLOCK_PARAM, buf_space * bpSPLIT_BLOCK_PARAM;
/* CDB_BLOCK_CONTROL.Flags */
#define BC_F_BRUTAL_FORCE 0x01 /* valid with BC_ACT_WIPEOUT_DISK_MDD */
/*
* make the specified block to be a spare block. the given block should be a
* free/spare/un-recognized disk.
*/
#define BC_ACT_MAKE_SPARE_BLOCK 0x00
/*
* make the specified block to be a free block. the given block should be a
* free/spare/un-recognized disk.
*/
#define BC_ACT_MAKE_FREE_BLOCK 0x01
/*
* wipe block MDD will remove the block from the disk. The given block should be
* free/spare/un-recognized disk.
*/
#define BC_ACT_WIPEOUT_BLOCK_MDD 0x02
/* wipe out disk MDD will remove all blocks existed on the disk */
#define BC_ACT_WIPEOUT_DISK_MDD 0x03
/*
* add a free/spare block into a critical redundant array. If a array dedicated
* spare block is to be added, it must be the spare of the given array.
*/
#define BC_ACT_ADD_TO_ARRAY 0x04
/*
* Following BC_ACT_xxx are reserved. It will be used when we are going to support
* multiple blocks per disk. MAKE_BLOCK_PARAM is used for data payload.
*/
#define BC_ACT_SPLIT_BLOCK 0x10
#define BC_ACT_DELETE_BLOCK 0x11
/*
-----------------------------------------------------------------------------------------
To remove a block, BC_ACT_WIPEOUT_BLOCK_MDD will be extended and used
-----------------------------------------------------------------------------------------
*/
typedef struct _CDB_INIT_CONFIG
{
U8 OpCode; /* FIXED svucCONTROLLER_COMMAND */
U8 SubOpCode; /* FIXED ccmdINIT_CONFIG */
U8 Flags; /* IN see below INIT_CONFIG_xxx, internal used */
U8 StartDiskID;
U8 EndDiskID;
U8 MDDFormat; /* engine internal usage. current processing MDD format */
U8 DiskID; /* engine internal usage. current disk ID in processing */
U8 bFailCase; /* engine internal usage. */
}
PACKED CDB_INIT_CONFIG, buf_space * bpCDB_INIT_CONFIG;
#define INIT_CONFIG_FIRST_READ bit( 0 )
typedef struct _CDB_PATROL_CONTROL
{
U8 OpCode; /* FIXED svucCONTROLLER_COMMAND */
U8 SubOpCode; /* FIXED ccmdPATROL_CONTROL */
U8 Action; /* IN MT_ACT_xxx */
U8 DiskID; /* IN */
}
PACKED CDB_PATROL_CONTROL, buf_space * bpCDB_PATROL_CONTROL;
#define GET_SET_CAPACITY_EXT 0x80
#define GET_SET_CAPACITY_VV 0x40
typedef struct _CDB_GET_SET_HDD_CAPACITY
{
U8 OpCode; /* FIXED svucCONTROLLER_COMMAND */
U8 SubOpCode; /* FIXED ccmdGET_SET_HDD_CAPACITY */
U8 DiskID;
U8 GetMax; /* 1 for get 0 for set */
U32 CapacityLow;
U32 CapacityHigh;
}
PACKED CDB_GET_SET_HDD_CAPACITY, buf_space * bpCDB_GET_SET_HDD_CAPACITY;
typedef struct _CDB_ARRAY_CONTROL
{
U8 OpCode; /* FIXED svucARRAY_COMMAND */
U8 SubOpCode; /* FIXED acmdARRAY_CONTROL */
U8 Action; /* AC_ACT_xxx */
U8 Flags; /* AC_F_xxx */
U32 StreamMap; /* valid when AC_ACT_REMOVE_STREAMS */
}
PACKED CDB_ARRAY_CONTROL, buf_space * bpCDB_ARRAY_CONTROL;
/*
-----------------------------------------------------------------------------------------
AC_F_xxx to be added
-----------------------------------------------------------------------------------------
*/
typedef struct _CDB_GLOBAL_INFO
{
U8 OpCode; /* svucCONTROLLER_COMMAND */
U8 SubOpCode; /* ccmdGET/SET_GLOBAL_CONFIG */
U8 PageCode;
U8 Control;
}
PACKED CDB_GLOBAL_INFO, buf_space * bpCDB_GLOBAL_INFO;
#if defined( _COMPILER_MS_C_COMPATIBLE )
#pragma pack()
#endif /* COMPILER_MS_C_COMPATIBLE */
/*
* During array plug-in, RAID engine won't automatically activate the array until
* it is fully functional. AC_ACT_ACTIVATE_ARRAY provides a choice to force engine
* to activate the array.
*/
#define AC_ACT_ACTIVATE_ARRAY 0x00
/*
* AC_ACT_UNMOUNT_ARRAY will clear all internal data structures of the given
* array. Usually this can be used before unplug an array. Since this operation is
* dangerous, AP should force OS to flush system cache data and remove the device
* before unmount an array.
*/
#define AC_ACT_UNMOUNT_ARRAY 0x01
#define AC_ACT_REMOVE_STREAMS 0x02
/* page codes for acmdGET/SET_GLOBAL_CONFIG */
#define GLOBAL_INFO_PAGE_CONTROLLER_INFO 0x00 /* read only: controller info */
#define GLOBAL_INFO_PAGE_SETTTING_PAGE 0x01 /* read/write: controller setting */
#define GLOBAL_INFO_PAGE_PHYSICAL_DRIVES 0x02 /* read only: physical drives */
#define GLOBAL_INFO_PAGE_BLOCKS 0x03 /* read only: logical blocks */
#define GLOBAL_INFO_PAGE_ARRAYS 0x04 /* read only: arrays */
#define GLOBAL_INFO_PAGE_CAPABILITIES 0x05 /* read only: CONTROLLER_CAPABILITIES */
#define GLOBAL_INFO_PAGE_PD_SETTING 0x06 /* read/write: physic disk setting */
#define GLOBAL_INFO_PAGE_ARRAYS_EX 0x07 /* read only: arrays */
#define GLOBAL_INFO_CONTROL_ALL 0xff
#define SMART_STATUS_NO_SMART 0
#define SMART_STATUS_OK 1
#define SMART_STATUS_ERROR 2
#define SMART_STATUS_NOT_SUPPORTED 3
typedef struct _PHYSICAL_DRIVE_INFO
{
U32 Flags; /* same as CAM_DISK.Flags */
U8 ChannelID;
U8 TargetID; /* can be used as port address defined in SATA II spec for
* port multiplier */
U8 AssociatedEnclosureID;
U8 CarrierIDInEnclosure;
U8 Features;
U8 PIOMode;
U8 MDMAMode;
U8 UDMAMode;
U32 wReserved1;
U64 MaximumLBA; /* This is definitely necessary */
U32 Cylinders; /* # of cyl */
U8 Heads; /* # of hd per cyl */
U8 Sectors; /* # of sctr per hd */
U8 SmartStatus; /* SMART_STATUS_xxx */
U8 bReserved[1];
U8 Model[24];
U8 SerialNo[24];
U8 FWVersion[16];
U8 DiskWriteCache; /* 1 for disk write back, 0 for write through */
U8 PatrolRunnable;
U8 bReserved1[2];
U32 wReserved[3];
}
PHYSICAL_DRIVE_INFO, buf_space * bpPHYSICAL_DRIVE_INFO;
typedef struct _LOGICAL_BLOCK_INFO
{
U16 Flags; /* same as BLOCK.blFlag */
U16 hReserved;
U8 bStream; /* valid if the block is assigned to an array */
U8 bDiskID;
U8 bArrayID; /* valid if the block is assigned to an array */
U8 bExtentIndex; /* the extent index on the disk, 0~MAX_BLOCK_PER_DISK-1 */
LBA StartLBA;
LBA Size;
U32 wReserved[4];
}
LOGICAL_BLOCK_INFO, buf_space * bpLOGICAL_BLOCK_INFO;
typedef struct _LOGICAL_DEVICE_INFO
{
U16 Flags; /* same as ARRAY.blFlag */
U16 hStripeBlockSize; /* stripe block size */
U8 RaidLevel; /* ARRAY.blRAID */
U8 bWidth;
U8 CacheMode; /* see LUN.CacheMode */
U8 DiskWriteCache; /* see LUN.DiskWriteCache */
U8 DiskReadLookahead; /* see LUN.DiskReadLookahead */
U8 Lookahead;
U8 Consolidation;
U8 TargetRaidLevel; /* If it's under conversion. */
U8 RealCacheMode; /* AP should check this field when CacheMode=LD_CM_AUTO*/
// U8 bReserved[3];
U8 PathId;
U8 TargetId;
U8 Lun;
LBA wSize; /* array size */
U8 Name[ARRAY_NAME_LENGTH];
U8 BlockIDs[LD_MAX_EXTENTS];
}
LOGICAL_DEVICE_INFO, buf_space * bpLOGICAL_DEVICE_INFO;
typedef struct _LOGICAL_DEVICE_INFO_EX
{
LOGICAL_DEVICE_INFO Basic;
U8 MfParityCount;
U8 MfSymmetric;
I16 MfShift;
U8 SubArrayCount;
U8 bReserved[3];
U32 BgaStartTime;
U32 BgaLastResumeTime;
U32 SectorSize;
U32 wReserved;
}
LOGICAL_DEVICE_INFO_EX, buf_space * bpLOGICAL_DEVICE_INFO_EX;
typedef struct _CONTROLLER_CAPABILITIES
{
U32 Reserved1;
U8 MaximumDiskSupported; /* MAX_DISK_SUPPORTED */
U8 MaximumExtentPerDisk; /* MAX_BLOCK_PER_DISK */
U8 MaximumLogicalDriveSupported; /* MAX_ARRAY_SUPPORTED */
U8 MaximumExtentPerLogicalDrive; /* MAX_STREAM_PER_ARRAY */
U8 MaximumPortSupported; /* MAX_PORT_SUPPORT */
U8 bReserved[3];
U32 Reserved2[13];
}
CONTROLLER_CAPABILITIES, buf_space * bpCONTROLLER_CAPABILITIES;
typedef struct _PHYSICAL_DRIVE_SETTING
{
U32 Flags; /* CAM_DISK.Flags */
U8 DiskWriteCacheEnabled;
U8 DiskReadLookaheadEnabled;
U8 DiskNCQEnabled;
U8 DiskTCQEnabled;
/*
// smart checking is now a global setting.
U8 SmartCheckEnabled;
*/
U32 Features; /* CAM_DEV_F_xxx */
U32 wReserved[5];
}
PHYSICAL_DRIVE_SETTING, buf_space * bpPHYSICAL_DRIVE_SETTING;
#define LD_STATUS_OPTIMAL 0
#define LD_STATUS_DEGRADE 1 /* Still have redundant data but lost at least one stream. */
#define LD_STATUS_OFFLINE 2
#define LD_STATUS_INVALID 3
#define LD_STATUS_CRITICAL 4 /* Don't have any redundant data. */
#define LD_STATE_NORMAL 0
#define LD_STATE_CONFIGURING 1
#define LD_BGA_NONE 0
#define LD_BGA_REBUILD 1
#define LD_BGA_FOREGRND_INIT 2
#define LD_BGA_BACKGRND_INIT 3
#define LD_BGA_CONSISTENCY_CHECK 4
#define LD_BGA_SYNC 5
#define LD_BGA_MIGRATION 6
#define LD_BGA_STATE_NONE 0
#define LD_BGA_STATE_RUNNING 1
#define LD_BGA_STATE_ABORTED 2
#define LD_BGA_STATE_PAUSED 3
#define LD_BGA_STATE_AUTOPAUSED 4
typedef struct _LOGICAL_DEVICE_STATUS
{
U8 Status; /* LD_STATUS_xxx */
U8 State; /* LD_STATE_xxx */
U8 Bga; /* LD_BGA_xxx */
U8 BgaState; /* LD_BGA_STATE_xxx */
U16 BgaPercentage; /* xx% */
U8 Reserved[2];
}
LOGICAL_DEVICE_STATUS, buf_space * bpLOGICAL_DEVICE_STATUS;
#define PDBG_READ_BLOCKS 0x00 /* CDB_DBG_DISK */
#define PDBG_WRITE_BLOCKS 0x01
#define PDBG_BREAK_ECC 0x02
#define PDBG_INJECT_ERROR 0x10 /* CDB_DBG_ERRINJ in eng_esl.h */
#define PDBG_ATA_PASSTHRU 0x11
#define PDBG_SATA_PASSTHRU 0x12
#define PDBG_READ_NVRAM 0x20 /* CDB_DBG_NVRAM */
#define PDBG_WRITE_NVRAM 0x21
#define PDBG_DUMP_DIMM 0x22
#define PDBG_WRITEBACKCACHE 0x30 /* CDB_DBG_DISK_SIMPLE */
#define PDBG_READLOOKAHEAD 0x31
#define PDBG_FLUSH_DISK 0x32
#define PDBG_IDENTIFY 0x33
#define PDBG_RESVSECTOR_LBA 0x34
#define PDBG_BSL_DUMP 0x35
#define PDBG_BBM_DUMP 0x36
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -