sdparm.h (sdparm-1.11.tgz) | : | sdparm.h (sdparm-1.12.tgz) | ||
---|---|---|---|---|
skipping to change at line 73 | skipping to change at line 73 | |||
#define MSP_SPC_CE 1 /* control extension */ | #define MSP_SPC_CE 1 /* control extension */ | |||
#define MSP_SPI_MC 1 | #define MSP_SPI_MC 1 | |||
#define MSP_SPI_STC 2 | #define MSP_SPI_STC 2 | |||
#define MSP_SPI_NS 3 | #define MSP_SPI_NS 3 | |||
#define MSP_SPI_RTC 4 | #define MSP_SPI_RTC 4 | |||
#define MSP_SAS_PCD 1 | #define MSP_SAS_PCD 1 | |||
#define MSP_SAS_SPC 2 | #define MSP_SAS_SPC 2 | |||
#define MSP_SAS_E_PHY 3 | #define MSP_SAS_E_PHY 3 | |||
#define MSP_SAS_OOB_M_C 4 /* OOB Management Control */ | #define MSP_SAS_OOB_M_C 4 /* OOB Management Control */ | |||
#define MSP_BACK_CTL 1 | #define MSP_BACK_CTL 1 | |||
#define MSP_SAT_PATA 0xf1 /* SAT PATA Control */ | #define MSP_SAT_AFC 0xf2 /* SAT ATA Feature Control [a,f2] */ | |||
#define MSP_SAT_POWER 0xf1 /* SAT ATA Power condition */ | #define MSP_SAT_PATA 0xf1 /* SAT PATA Control [a,f1] */ | |||
#define MSP_SAT_POWER 0xf1 /* SAT ATA Power condition [1a,f1] */ | ||||
#define MSP_DEV_CONF_EXT 1 /* device conf extension (ssc) */ | #define MSP_DEV_CONF_EXT 1 /* device conf extension (ssc) */ | |||
#define MSP_EXT_DEV_CAP 0x41 /* extended device capabilities (smc) */ | #define MSP_EXT_DEV_CAP 0x41 /* extended device capabilities (smc) */ | |||
#define MSP_ADC_TGT_DEV 0x1 | #define MSP_ADC_TGT_DEV 0x1 | |||
#define MSP_ADC_DT_DPP 0x2 | #define MSP_ADC_DT_DPP 0x2 | |||
#define MSP_ADC_LU 0x3 | #define MSP_ADC_LU 0x3 | |||
#define MSP_ADC_TD_SN 0x4 | #define MSP_ADC_TD_SN 0x4 | |||
#define MSP_SBC_LB_PROV 0x2 | #define MSP_SBC_LB_PROV 0x2 | |||
#define MSP_SSC_CDP 0xf0 | #define MSP_SSC_CDP 0xf0 | |||
#define MSP_SBC_APP_TAG 0x2 /* changed from 0xf0 to 0x2 sbc3r28 */ | #define MSP_SBC_APP_TAG 0x2 /* changed from 0xf0 to 0x2 sbc3r28 */ | |||
#define MSP_SPC_PS 0x1 /* power consumption */ | #define MSP_SPC_PS 0x1 /* power consumption */ | |||
#define MSP_SPC_CDLA 0x3 | #define MSP_SPC_CDLA 0x3 | |||
#define MSP_SPC_CDLB 0x4 | #define MSP_SPC_CDLB 0x4 | |||
#define MSP_SPC_CDT2A 0x7 /* spc6r ? */ | #define MSP_SPC_CDLT2A 0x7 /* spc6r01 */ | |||
#define MSP_SPC_CDT2B 0x8 /* spc6r ? */ | #define MSP_SPC_CDLT2B 0x8 /* spc6r01 */ | |||
#define MSP_SBC_IO_ADVI 0x5 | #define MSP_SBC_IO_ADVI 0x5 | |||
#define MSP_SBC_BACK_OP 0x6 | #define MSP_SBC_BACK_OP 0x6 | |||
#define MSP_ZB_D_CTL 0xf /* zbc2r04a */ | #define MSP_ZB_D_CTL 0xf /* zbc2r04a */ | |||
#define MODE_DATA_OVERHEAD 128 | #define MODE_DATA_OVERHEAD 128 | |||
#define EBUFF_SZ 256 | #define EBUFF_SZ 256 | |||
#define MAX_MP_IT_VAL 128 /* maximum number of items that can be */ | #define MAX_MP_IT_VAL 128 /* maximum number of items that can be */ | |||
/* changed in one invocation */ | /* changed in one invocation */ | |||
#define MAX_MODE_DATA_LEN 2048 | #define MAX_MODE_DATA_LEN 2048 | |||
/* VPD pages (fetched by INQUIRY command) */ | /* VPD pages (fetched by INQUIRY command) */ | |||
#define VPD_SUPPORTED_VPDS 0x0 | #define VPD_SUPPORTED_VPDS 0x0 | |||
#define VPD_UNIT_SERIAL_NUM 0x80 | #define VPD_UNIT_SERIAL_NUM 0x80 | |||
skipping to change at line 136 | skipping to change at line 137 | |||
#define VPD_LB_PROVISIONING 0xb2 /* SBC-3 */ | #define VPD_LB_PROVISIONING 0xb2 /* SBC-3 */ | |||
#define VPD_REFERRALS 0xb3 /* SBC-3 */ | #define VPD_REFERRALS 0xb3 /* SBC-3 */ | |||
#define VPD_AUTOMATION_DEV_SN 0xb3 /* SSC-3 */ | #define VPD_AUTOMATION_DEV_SN 0xb3 /* SSC-3 */ | |||
#define VPD_SUP_BLOCK_LENS 0xb4 /* sbc4r01 */ | #define VPD_SUP_BLOCK_LENS 0xb4 /* sbc4r01 */ | |||
#define VPD_DTDE_ADDRESS 0xb4 /* SSC-4 */ | #define VPD_DTDE_ADDRESS 0xb4 /* SSC-4 */ | |||
#define VPD_BLOCK_DEV_C_EXTENS 0xb5 /* sbc4r02 */ | #define VPD_BLOCK_DEV_C_EXTENS 0xb5 /* sbc4r02 */ | |||
#define VPD_LB_PROTECTION 0xb5 /* SSC-5 */ | #define VPD_LB_PROTECTION 0xb5 /* SSC-5 */ | |||
#define VPD_ZBC_DEV_CHARS 0xb6 /* zbc-r01b */ | #define VPD_ZBC_DEV_CHARS 0xb6 /* zbc-r01b */ | |||
#define VPD_BLOCK_LIMITS_EXT 0xb7 /* sbc4r08 */ | #define VPD_BLOCK_LIMITS_EXT 0xb7 /* sbc4r08 */ | |||
#define VPD_FORMAT_PRESETS 0xb8 /* sbc4r18 */ | #define VPD_FORMAT_PRESETS 0xb8 /* sbc4r18 */ | |||
#define VPD_CON_POS_RANGE 0xb9 /* 20-089r2 */ | ||||
#define VPD_NOT_STD_INQ -2 /* request for standard inquiry */ | #define VPD_NOT_STD_INQ -2 /* request for standard inquiry */ | |||
#define VPD_ASSOC_LU 0 | #define VPD_ASSOC_LU 0 | |||
#define VPD_ASSOC_TPORT 1 | #define VPD_ASSOC_TPORT 1 | |||
#define VPD_ASSOC_TDEVICE 2 | #define VPD_ASSOC_TDEVICE 2 | |||
/* values are 2**vpd_assoc */ | /* values are 2**vpd_assoc */ | |||
#define VPD_DI_SEL_LU 1 | #define VPD_DI_SEL_LU 1 | |||
#define VPD_DI_SEL_TPORT 2 | #define VPD_DI_SEL_TPORT 2 | |||
#define VPD_DI_SEL_TARGET 4 | #define VPD_DI_SEL_TARGET 4 | |||
skipping to change at line 199 | skipping to change at line 201 | |||
#define CMD_STOP 3 | #define CMD_STOP 3 | |||
#define CMD_LOAD 4 | #define CMD_LOAD 4 | |||
#define CMD_EJECT 5 | #define CMD_EJECT 5 | |||
#define CMD_UNLOCK 6 | #define CMD_UNLOCK 6 | |||
#define CMD_SENSE 7 | #define CMD_SENSE 7 | |||
#define CMD_SYNC 8 | #define CMD_SYNC 8 | |||
#define CMD_CAPACITY 9 | #define CMD_CAPACITY 9 | |||
#define CMD_SPEED 10 | #define CMD_SPEED 10 | |||
#define CMD_PROFILE 11 | #define CMD_PROFILE 11 | |||
/* squeeze two PDTs into one field */ | /* squeeze two PDTs into one field, must not use PDT_DISK as upper */ | |||
#define PDT_DISK_ZBC (PDT_DISK | (PDT_ZBC << 8)) | #define PDT_DISK_ZBC (PDT_DISK | (PDT_ZBC << 8)) | |||
/* Mainly command line options */ | /* Mainly command line options */ | |||
struct sdparm_opt_coll { | struct sdparm_opt_coll { | |||
bool dbd; | bool dbd; | |||
bool dummy; | bool dummy; | |||
bool examine; | bool examine; | |||
bool flexible; | bool flexible; | |||
bool inquiry; | bool inquiry; | |||
bool mode_6; /* false (default) for Mode Sense or Select(10) */ | bool mode_6; /* false (default) for Mode Sense or Select(10) */ | |||
skipping to change at line 290 | skipping to change at line 292 | |||
/* d_len_off + d_len_bytes */ | /* d_len_off + d_len_bytes */ | |||
bool have_desc_id; /* descriptor has 4 bit ID, byte 0, bits 3 to 0 */ | bool have_desc_id; /* descriptor has 4 bit ID, byte 0, bits 3 to 0 */ | |||
const char * name; | const char * name; | |||
}; | }; | |||
/* Template for each mode page, array populated in sdparm_data.c for generic | /* Template for each mode page, array populated in sdparm_data.c for generic | |||
* and transport mpages. Vendor mode pages found in sdparm_data_vendor.c . */ | * and transport mpages. Vendor mode pages found in sdparm_data_vendor.c . */ | |||
struct sdparm_mode_page_t { | struct sdparm_mode_page_t { | |||
int page; | int page; | |||
int subpage; | int subpage; | |||
int pdt_s; /* peripheral device type id, -1 is the default */ | int pdt_s; /* compound peripheral device type id, -1 is the default | |||
/* can have two, most common is: */ | * for fields defined in SPC (common to all PDTs). | |||
/* PDT_DISK | (PDT_ZBC << 8) */ | * Compound pdt_s may hold two PDTs. The most common | |||
* example is: | ||||
* PDT_DISK | (PDT_ZBC << 8) */ | ||||
int ro; /* read-only */ | int ro; /* read-only */ | |||
const char * acron; | const char * acron; | |||
const char * name; | const char * name; | |||
const struct sdparm_mode_descriptor_t * mp_desc; | const struct sdparm_mode_descriptor_t * mp_desc; | |||
/* non-NULL when mpage has descriptor format */ | /* non-NULL when mpage has descriptor format */ | |||
}; | }; | |||
/* Template for each VPD page, array populated in sdparm_data.c */ | /* Template for each VPD page, array populated in sdparm_data.c */ | |||
struct sdparm_vpd_page_t { | struct sdparm_vpd_page_t { | |||
int vpd_num; | int vpd_num; | |||
int subvalue; | int subvalue; | |||
int pdt_s; /* peripheral device type id, -1 is the default */ | int pdt_s; /* see pdt_s explanation above */ | |||
/* can have two, most common is: */ | ||||
/* PDT_DISK | (PDT_ZBC << 8) */ | ||||
const char * acron; | const char * acron; | |||
const char * name; | const char * name; | |||
}; | }; | |||
/* Template for each mode/VPD page vendor, array populated in | /* Template for each mode/VPD page vendor, array populated in | |||
* sdparm_data_vendor.c */ | * sdparm_data_vendor.c */ | |||
struct sdparm_vendor_name_t { | struct sdparm_vendor_name_t { | |||
int vendor_id; | int vendor_id; | |||
const char * acron; | const char * acron; | |||
const char * name; | const char * name; | |||
}; | }; | |||
/* Template for each mode page field (item), arrays for generic and each | /* Template for each mode page field (item), arrays for generic and each | |||
* transport populated in sdparm_data.c . Arrays for vendors populated | * transport populated in sdparm_data.c . Arrays for vendors populated | |||
* in sdparm_data_vendor.c */ | * in sdparm_data_vendor.c */ | |||
struct sdparm_mode_page_item { | struct sdparm_mode_page_item { | |||
const char * acron; | const char * acron; | |||
int pg_num; | int pg_num; | |||
int subpg_num; | int subpg_num; | |||
int pdt_s; /* peripheral device type or -1 (default) if not */ | int pdt_s; /* see pdt_s explanation above */ | |||
/* can have two, most common is: */ | ||||
/* PDT_DISK | (PDT_ZBC << 8) */ | ||||
int start_byte; | int start_byte; | |||
int start_bit; | int start_bit; | |||
int num_bits; | int num_bits; | |||
int flags; /* bit settings or-ed, see MF_* */ | int flags; /* bit settings or-ed, see MF_* */ | |||
const char * description; | const char * description; | |||
const char * extra; | const char * extra; | |||
}; | }; | |||
/* Command line arguments to --clear, --get= and --set= are parsed into | /* Command line arguments to --clear, --get= and --set= are parsed into | |||
* one or more instances of this structure. On the command line each | * one or more instances of this structure. On the command line each | |||
skipping to change at line 463 | skipping to change at line 463 | |||
/* | /* | |||
* Declarations for functions found in sdparm_cmd.c | * Declarations for functions found in sdparm_cmd.c | |||
*/ | */ | |||
const struct sdparm_command_t * sdp_build_cmd(const char * cmd_str, | const struct sdparm_command_t * sdp_build_cmd(const char * cmd_str, | |||
bool * rwp, int * argp); | bool * rwp, int * argp); | |||
void sdp_enumerate_commands(); | void sdp_enumerate_commands(); | |||
int sdp_process_cmd(int sg_fd, const struct sdparm_command_t * scmdp, | int sdp_process_cmd(int sg_fd, const struct sdparm_command_t * scmdp, | |||
int cmd_arg, int pdt, const struct sdparm_opt_coll * opts); | int cmd_arg, int pdt, const struct sdparm_opt_coll * opts); | |||
/* Must not have PDT_DISK as upper byte of mask */ | ||||
#define PDT_LOWER_MASK 0xff | #define PDT_LOWER_MASK 0xff | |||
#define PDT_UPPER_MASK (~PDT_LOWER_MASK) | #define PDT_UPPER_MASK (~PDT_LOWER_MASK) | |||
/* If PDT_DISK is present in l_pdt_s or r_pdt_s, then it must be the lower | /* Returns true if left argument is "equal" to the right argument. l_pdt_s | |||
* byte. For example: want PDT_DISK_ZBC [0x1400] to match either PDT_DISK | * is a compound PDT (SCSI Peripheral Device Type) or a negative number | |||
* [0x0] or PDT_ZBC [0x14]. */ | * which represents a wildcard (i.e. match anything). r_pdt_s has a similar | |||
static inline bool | * form. PDT values are 5 bits long (0 to 31) and a compound pdt_s is | |||
pdt_s_eq(int l_pdt_s, int r_pdt_s) | * formed by shifting the second (upper) PDT by eight bits to the left and | |||
{ | * OR-ing it with the first PDT. The pdt_s values must be defined so | |||
bool upper_l = !!(l_pdt_s & PDT_UPPER_MASK); | * PDT_DISK (0) is _not_ the upper value in a compound pdt_s. */ | |||
bool upper_r = !!(r_pdt_s & PDT_UPPER_MASK); | bool pdt_s_eq(int l_pdt_s, int r_pdt_s); | |||
if (!upper_l && !upper_r) | ||||
return l_pdt_s == r_pdt_s; | ||||
else if (upper_l && upper_r) | ||||
return (((PDT_UPPER_MASK & l_pdt_s) == (PDT_UPPER_MASK & r_pdt_s)) || | ||||
((PDT_LOWER_MASK & l_pdt_s) == (PDT_LOWER_MASK & r_pdt_s))); | ||||
else if (upper_l) | ||||
return (((PDT_LOWER_MASK & l_pdt_s) == r_pdt_s) || | ||||
((PDT_UPPER_MASK & l_pdt_s) >> 8) == r_pdt_s); | ||||
return (((PDT_LOWER_MASK & r_pdt_s) == l_pdt_s) || | ||||
((PDT_UPPER_MASK & r_pdt_s) >> 8) == l_pdt_s); | ||||
} | ||||
/* | /* | |||
* Declarations for functions that are port dependent | * Declarations for functions that are port dependent | |||
*/ | */ | |||
#ifdef SG_LIB_WIN32 | #ifdef SG_LIB_WIN32 | |||
int sg_do_wscan(char letter, int do_scan, int verbose); | int sg_do_wscan(char letter, int do_scan, int verbose); | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
35 lines changed or deleted | 24 lines changed or added |