Skip to content
Browse files

personality module: Move media density to each personality

Fix MODE SENSE 'media type' where HP LTO reporting is different to IBM LTO

Media Type for HP:
0x00 -> Data
0x01 -> WORM
0x80 -> CD-ROM

Media Type for IBM:
0x18 -> Ultrium 1 Data
0x28 -> Ultrium 2 Data
0x38 -> Ultrium 3 Data
0x48 -> Ultrium 4 Data
0x58 -> Ultrium 5 Data
0x68 -> Ultrium 6 Data
0x3C -> Ultrium 3 WORM
0x4C -> Ultrium 4 WORM
0x5C -> Ultrium 5 WORM
0x6C -> Ultrium 6 WORM

Reported-by: David Major <david.major@oracle.com>
Signed-off-by: Mark Harvey <markh794@gmail.com>
  • Loading branch information...
1 parent c9b27e7 commit 3994118a111665f96943866643179f8211907eed @markh794 committed Mar 28, 2013
Showing with 397 additions and 180 deletions.
  1. +23 −0 usr/ait_pm.c
  2. +164 −0 usr/default_ssc_pm.c
  3. +38 −0 usr/hp_ultrium_pm.c
  4. +25 −0 usr/ibm_03592_pm.c
  5. +25 −0 usr/quantum_dlt_pm.c
  6. +8 −0 usr/ssc.h
  7. +30 −0 usr/stk9x40_pm.c
  8. +23 −0 usr/t10000_pm.c
  9. +37 −0 usr/ult3580_pm.c
  10. +21 −180 usr/vtltape.c
  11. +3 −0 usr/vtltape.h
View
23 usr/ait_pm.c
@@ -64,6 +64,28 @@ static struct density_info density_ait4 = {
0x17d6, 0x50, 1, 400, medium_density_code_ait4,
"SONY", "AIT-4", "Adv Intellgent Tape" };
+static struct name_to_media_info media_info[] = {
+ {"AIT1", Media_AIT1,
+ media_type_unknown, medium_density_code_ait1},
+ {"AIT1 Clean", Media_AIT1_CLEAN,
+ media_type_unknown, medium_density_code_ait1},
+ {"AIT2", Media_AIT2,
+ media_type_unknown, medium_density_code_ait2},
+ {"AIT2 Clean", Media_AIT2_CLEAN,
+ media_type_unknown, medium_density_code_ait2},
+ {"AIT3", Media_AIT3,
+ media_type_unknown, medium_density_code_ait3},
+ {"AIT3 Clean", Media_AIT3_CLEAN,
+ media_type_unknown, medium_density_code_ait3},
+ {"AIT4", Media_AIT4,
+ media_type_unknown, medium_density_code_ait4},
+ {"AIT4 Clean", Media_AIT4_CLEAN,
+ media_type_unknown, medium_density_code_ait4},
+ {"AIT4 WORM", Media_AIT4_WORM,
+ media_type_unknown, medium_density_code_ait4},
+ {"", 0, 0, 0},
+};
+
static uint8_t clear_ait_WORM(struct list_head *l)
{
uint8_t *smp_dp;
@@ -335,6 +357,7 @@ static struct ssc_personality_template ssc_pm = {
.set_compression = set_ait_compression,
.media_load = ait_media_load,
.cleaning_media = ait_cleaning,
+ .media_handling = media_info,
};
void init_ait1_ssc(struct lu_phy_attr *lu)
View
164 usr/default_ssc_pm.c
@@ -52,6 +52,169 @@ static struct density_info density_default = {
1024, 127, 1, 500, medium_density_code_unknown,
"mhVTL", "DEFAULT", "linuxVTL" };
+static struct name_to_media_info media_info[] = {
+ {"Undefined", Media_undefined,
+ media_type_unknown, medium_density_code_unknown},
+
+ /* Ultrium media */
+ {"LTO1", Media_LTO1,
+ media_type_lto1_data, medium_density_code_lto1},
+ {"LTO1 Clean", Media_LTO1_CLEAN,
+ media_type_lto1_data, medium_density_code_lto1},
+ {"LTO2", Media_LTO2,
+ media_type_lto2_data, medium_density_code_lto2},
+ {"LTO2 Clean", Media_LTO2_CLEAN,
+ media_type_lto2_data, medium_density_code_lto2},
+ {"LTO3", Media_LTO3,
+ media_type_lto3_data, medium_density_code_lto3},
+ {"LTO3 Clean", Media_LTO3_CLEAN,
+ media_type_lto3_data, medium_density_code_lto3},
+ {"LTO3 WORM", Media_LTO3_WORM,
+ media_type_lto3_worm, medium_density_code_lto3_WORM},
+ {"LTO4", Media_LTO4,
+ media_type_lto4_data, medium_density_code_lto4},
+ {"LTO4 Clean", Media_LTO4_CLEAN,
+ media_type_lto4_data, medium_density_code_lto4},
+ {"LTO4 WORM", Media_LTO4_WORM,
+ media_type_lto4_worm, medium_density_code_lto4_WORM},
+ {"LTO5", Media_LTO5,
+ media_type_lto5_data, medium_density_code_lto5},
+ {"LTO5 Clean", Media_LTO5_CLEAN,
+ media_type_lto5_data, medium_density_code_lto5},
+ {"LTO5 WORM", Media_LTO5_WORM,
+ media_type_lto5_worm, medium_density_code_lto5_WORM},
+ {"LTO6", Media_LTO6,
+ media_type_lto6_data, medium_density_code_lto6},
+ {"LTO6 Clean", Media_LTO6_CLEAN,
+ media_type_lto6_data, medium_density_code_lto6},
+ {"LTO6 WORM", Media_LTO6_WORM,
+ media_type_lto6_worm, medium_density_code_lto6_WORM},
+
+ /* IBM 03592 media */
+ {"03592 JA", Media_3592_JA,
+ media_type_unknown, medium_density_code_j1a},
+ {"03592 JA Clean", Media_3592_JA_CLEAN,
+ media_type_unknown, medium_density_code_j1a},
+ {"03592 JA WORM", Media_3592_JW,
+ media_type_unknown, medium_density_code_j1a},
+
+ {"03592 JB", Media_3592_JB,
+ media_type_unknown, medium_density_code_e05},
+ {"03592 JB Clean", Media_3592_JB_CLEAN,
+ media_type_unknown, medium_density_code_e05},
+ {"03592 JB ENCR", Media_3592_JB,
+ media_type_unknown, medium_density_code_e05_ENCR},
+
+ {"03592 JC", Media_3592_JX,
+ media_type_unknown, medium_density_code_e06},
+ {"03592 JC Clean", Media_3592_JX_CLEAN,
+ media_type_unknown, medium_density_code_e06},
+ {"03592 JC ENCR", Media_3592_JX,
+ media_type_unknown, medium_density_code_e06_ENCR},
+
+ /* AIT media */
+ {"AIT1", Media_AIT1,
+ media_type_unknown, medium_density_code_ait1},
+ {"AIT1 Clean", Media_AIT1_CLEAN,
+ media_type_unknown, medium_density_code_ait1},
+ {"AIT2", Media_AIT2,
+ media_type_unknown, medium_density_code_ait2},
+ {"AIT2 Clean", Media_AIT2_CLEAN,
+ media_type_unknown, medium_density_code_ait2},
+ {"AIT3", Media_AIT3,
+ media_type_unknown, medium_density_code_ait3},
+ {"AIT3 Clean", Media_AIT3_CLEAN,
+ media_type_unknown, medium_density_code_ait3},
+ {"AIT4", Media_AIT4,
+ media_type_unknown, medium_density_code_ait4},
+ {"AIT4 Clean", Media_AIT4_CLEAN,
+ media_type_unknown, medium_density_code_ait4},
+ {"AIT4 WORM", Media_AIT4_WORM,
+ media_type_unknown, medium_density_code_ait4},
+
+ /* STK 9x40 media */
+ {"9840A", Media_9840A,
+ media_type_unknown, medium_density_code_9840A},
+ {"9840A Clean", Media_9840A_CLEAN,
+ media_type_unknown, medium_density_code_9840A},
+ {"9840B", Media_9840B,
+ media_type_unknown, medium_density_code_9840B},
+ {"9840B Clean", Media_9840B_CLEAN,
+ media_type_unknown, medium_density_code_9840B},
+ {"9840C", Media_9840C,
+ media_type_unknown, medium_density_code_9840C},
+ {"9840C Clean", Media_9840C_CLEAN,
+ media_type_unknown, medium_density_code_9840C},
+ {"9840D", Media_9840D,
+ media_type_unknown, medium_density_code_9840D},
+ {"9840D Clean", Media_9840D_CLEAN,
+ media_type_unknown, medium_density_code_9840D},
+
+ {"9940A", Media_9940A,
+ media_type_unknown, medium_density_code_9940A},
+ {"9940A Clean", Media_9940A_CLEAN,
+ media_type_unknown, medium_density_code_9940A},
+ {"9940B", Media_9940B,
+ media_type_unknown, medium_density_code_9940B},
+ {"9940B Clean", Media_9940B_CLEAN,
+ media_type_unknown, medium_density_code_9940B},
+
+ /* STK T10000 media */
+ {"T10KA", Media_T10KA,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KA WORM", Media_T10KA_WORM,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KA Clean", Media_T10KA_CLEAN,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KB", Media_T10KB,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KB WORM", Media_T10KB_WORM,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KB Clean", Media_T10KB_CLEAN,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KC", Media_T10KC,
+ media_type_unknown, medium_density_code_10kC},
+ {"T10KC WORM", Media_T10KC_WORM,
+ media_type_unknown, medium_density_code_10kC},
+ {"T10KC Clean", Media_T10KC_CLEAN,
+ media_type_unknown, medium_density_code_10kC},
+
+ /* Quantum DLT / SDLT media */
+ {"DLT2", Media_DLT2,
+ media_type_unknown, medium_density_code_dlt2},
+ {"DLT3", Media_DLT3,
+ media_type_unknown, medium_density_code_dlt3},
+ {"DLT4", Media_DLT4,
+ media_type_unknown, medium_density_code_dlt4},
+ {"SDLT", Media_SDLT,
+ media_type_unknown, medium_density_code_sdlt},
+ {"SDLT 220", Media_SDLT220,
+ media_type_unknown, medium_density_code_220},
+ {"SDLT 320", Media_SDLT320,
+ media_type_unknown, medium_density_code_320},
+ {"SDLT 320 Clean", Media_SDLT320_CLEAN,
+ media_type_unknown, medium_density_code_320},
+ {"SDLT 600", Media_SDLT600,
+ media_type_unknown, medium_density_code_600},
+ {"SDLT 600 Clean", Media_SDLT600_CLEAN,
+ media_type_unknown, medium_density_code_600},
+ {"SDLT 600 WORM", Media_SDLT600_WORM,
+ media_type_unknown, medium_density_code_600},
+
+ /* 4MM DAT media */
+ {"DDS1", Media_DDS1,
+ media_type_unknown, medium_density_code_DDS1},
+ {"DDS2", Media_DDS2,
+ media_type_unknown, medium_density_code_DDS2},
+ {"DDS3", Media_DDS3,
+ media_type_unknown, medium_density_code_DDS3},
+ {"DDS4", Media_DDS4,
+ media_type_unknown, medium_density_code_DDS4},
+ {"DDS5", Media_DDS5,
+ media_type_unknown, medium_density_code_DDS5},
+ {"", 0, 0, 0},
+};
+
static uint8_t clear_default_comp(struct list_head *l)
{
MHVTL_DBG(3, "+++ Trace +++");
@@ -242,6 +405,7 @@ static struct ssc_personality_template ssc_pm = {
.set_WORM = set_default_WORM,
.media_load = default_media_load,
.cleaning_media = default_cleaning,
+ .media_handling = media_info,
};
void init_default_ssc(struct lu_phy_attr *lu)
View
38 usr/hp_ultrium_pm.c
@@ -67,6 +67,42 @@ static struct density_info density_lto6 = {
18441, 127, 2176, 3200000, medium_density_code_lto6,
"LTO-CVE", "U-616", "Ultrium 6/16T" };
+static struct name_to_media_info media_info[] = {
+ {"LTO1", Media_LTO1,
+ media_type_hp_lto_data, medium_density_code_lto1},
+ {"LTO1 Clean", Media_LTO1_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto1},
+ {"LTO2", Media_LTO2,
+ media_type_hp_lto_data, medium_density_code_lto2},
+ {"LTO2 Clean", Media_LTO2_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto2},
+ {"LTO3", Media_LTO3,
+ media_type_hp_lto_data, medium_density_code_lto3},
+ {"LTO3 Clean", Media_LTO3_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto3},
+ {"LTO3 WORM", Media_LTO3_WORM,
+ media_type_hp_lto_worm, medium_density_code_lto3_WORM},
+ {"LTO4", Media_LTO4,
+ media_type_hp_lto_data, medium_density_code_lto4},
+ {"LTO4 Clean", Media_LTO4_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto4},
+ {"LTO4 WORM", Media_LTO4_WORM,
+ media_type_hp_lto_worm, medium_density_code_lto4_WORM},
+ {"LTO5", Media_LTO5,
+ media_type_hp_lto_data, medium_density_code_lto5},
+ {"LTO5 Clean", Media_LTO5_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto5},
+ {"LTO5 WORM", Media_LTO5_WORM,
+ media_type_hp_lto_worm, medium_density_code_lto5_WORM},
+ {"LTO6", Media_LTO6,
+ media_type_hp_lto_data, medium_density_code_lto6},
+ {"LTO6 Clean", Media_LTO6_CLEAN,
+ media_type_hp_lto_data, medium_density_code_lto6},
+ {"LTO6 WORM", Media_LTO6_WORM,
+ media_type_hp_lto_worm, medium_density_code_lto6_WORM},
+ {"", 0, 0, 0},
+};
+
static uint8_t clear_ult_compression(struct list_head *m)
{
MHVTL_DBG(3, "+++ Trace mode pages at %p +++", m);
@@ -400,6 +436,8 @@ static struct ssc_personality_template ssc_pm = {
.set_compression = set_ult_compression,
.media_load = hp_media_load,
.cleaning_media = hp_cleaning,
+ .media_handling = media_info,
+
};
void init_hp_ult_1(struct lu_phy_attr *lu)
View
25 usr/ibm_03592_pm.c
@@ -61,6 +61,30 @@ static struct density_info density_e06 = {
0x348c, 0x0d, 0x480, 0x7a120, medium_density_code_e06,
"IBM", "3592A3", "" };
+static struct name_to_media_info media_info[] = {
+ {"03592 JA", Media_3592_JA,
+ media_type_unknown, medium_density_code_j1a},
+ {"03592 JA Clean", Media_3592_JA_CLEAN,
+ media_type_unknown, medium_density_code_j1a},
+ {"03592 JA WORM", Media_3592_JW,
+ media_type_unknown, medium_density_code_j1a},
+
+ {"03592 JB", Media_3592_JB,
+ media_type_unknown, medium_density_code_e05},
+ {"03592 JB Clean", Media_3592_JB_CLEAN,
+ media_type_unknown, medium_density_code_e05},
+ {"03592 JB ENCR", Media_3592_JB,
+ media_type_unknown, medium_density_code_e05_ENCR},
+
+ {"03592 JC", Media_3592_JX,
+ media_type_unknown, medium_density_code_e06},
+ {"03592 JC Clean", Media_3592_JX_CLEAN,
+ media_type_unknown, medium_density_code_e06},
+ {"03592 JC ENCR", Media_3592_JX,
+ media_type_unknown, medium_density_code_e06_ENCR},
+ {"", 0, 0, 0},
+};
+
static uint8_t valid_encryption_media_E06(struct scsi_cmd *cmd)
{
uint8_t *sam_stat = &cmd->dbuf_p->sam_stat;
@@ -369,6 +393,7 @@ static struct ssc_personality_template ssc_pm = {
.set_WORM = set_3592_WORM,
.media_load = ibm_media_load,
.cleaning_media = ibm_cleaning,
+ .media_handling = media_info,
};
void init_3592_j1a(struct lu_phy_attr *lu)
View
25 usr/quantum_dlt_pm.c
@@ -71,6 +71,30 @@ static struct density_info density_sdlt600 = {
15142, 640, 1502, 80000, medium_density_code_600,
"DLT-CVE", "U-516", "SDLT 600" };
+static struct name_to_media_info media_info[] = {
+ {"DLT2", Media_DLT2,
+ media_type_unknown, medium_density_code_dlt2},
+ {"DLT3", Media_DLT3,
+ media_type_unknown, medium_density_code_dlt3},
+ {"DLT4", Media_DLT4,
+ media_type_unknown, medium_density_code_dlt4},
+ {"SDLT", Media_SDLT,
+ media_type_unknown, medium_density_code_sdlt},
+ {"SDLT 220", Media_SDLT220,
+ media_type_unknown, medium_density_code_220},
+ {"SDLT 320", Media_SDLT320,
+ media_type_unknown, medium_density_code_320},
+ {"SDLT 320 Clean", Media_SDLT320_CLEAN,
+ media_type_unknown, medium_density_code_320},
+ {"SDLT 600", Media_SDLT600,
+ media_type_unknown, medium_density_code_600},
+ {"SDLT 600 Clean", Media_SDLT600_CLEAN,
+ media_type_unknown, medium_density_code_600},
+ {"SDLT 600 WORM", Media_SDLT600_WORM,
+ media_type_unknown, medium_density_code_600},
+ {"", 0, 0, 0},
+};
+
static uint8_t clear_dlt_compression(struct list_head *m)
{
MHVTL_DBG(3, "+++ Trace mode pages at %p +++", m);
@@ -383,6 +407,7 @@ static struct ssc_personality_template ssc_pm = {
.set_compression = set_dlt_compression,
.media_load = dlt_media_load,
.cleaning_media = dlt_cleaning,
+ .media_handling = media_info,
};
void init_dlt7000_ssc(struct lu_phy_attr *lu)
View
8 usr/ssc.h
@@ -17,6 +17,13 @@
#define EARLY_WARNING_SZ 1024 * 1024 * 2 /* 2M EW size */
#define PROG_EARLY_WARNING_SZ 1024 * 1024 * 3 /* 3M Prog EW size */
+struct name_to_media_info {
+ char *name;
+ int media_type;
+ int mode_media_type;
+ int media_density;
+};
+
struct ssc_personality_template {
char *name;
int drive_type;
@@ -30,6 +37,7 @@ struct ssc_personality_template {
uint32_t drive_ANSI_VERSION:5;
struct density_info *native_drive_density;
+ struct name_to_media_info *media_handling;
struct lu_phy_attr *lu;
View
30 usr/stk9x40_pm.c
@@ -73,6 +73,35 @@ static struct density_info density_9940B = {
0, 127, 576, 0x30d40, medium_density_code_9940B,
"STK", "P-200", "PeakCapacity 200 GB" };
+static struct name_to_media_info media_info[] = {
+ {"9840A", Media_9840A,
+ media_type_unknown, medium_density_code_9840A},
+ {"9840A Clean", Media_9840A_CLEAN,
+ media_type_unknown, medium_density_code_9840A},
+ {"9840B", Media_9840B,
+ media_type_unknown, medium_density_code_9840B},
+ {"9840B Clean", Media_9840B_CLEAN,
+ media_type_unknown, medium_density_code_9840B},
+ {"9840C", Media_9840C,
+ media_type_unknown, medium_density_code_9840C},
+ {"9840C Clean", Media_9840C_CLEAN,
+ media_type_unknown, medium_density_code_9840C},
+ {"9840D", Media_9840D,
+ media_type_unknown, medium_density_code_9840D},
+ {"9840D Clean", Media_9840D_CLEAN,
+ media_type_unknown, medium_density_code_9840D},
+
+ {"9940A", Media_9940A,
+ media_type_unknown, medium_density_code_9940A},
+ {"9940A Clean", Media_9940A_CLEAN,
+ media_type_unknown, medium_density_code_9940A},
+ {"9940B", Media_9940B,
+ media_type_unknown, medium_density_code_9940B},
+ {"9940B Clean", Media_9940B_CLEAN,
+ media_type_unknown, medium_density_code_9940B},
+ {"", 0, 0, 0},
+};
+
/*
* Returns true if blk header has correct encryption key data
*/
@@ -323,6 +352,7 @@ static struct ssc_personality_template ssc_pm = {
.set_WORM = set_9840_WORM,
.media_load = T9840_media_load,
.cleaning_media = T9840_cleaning,
+ .media_handling = media_info,
};
#define INQUIRY_LEN 74
View
23 usr/t10000_pm.c
@@ -61,6 +61,28 @@ static struct density_info density_t10kC = {
0, 127, 0x600, 0x30000, medium_density_code_10kC,
"STK", "T2 - 5000", "T1 - 5000 GB" };
+static struct name_to_media_info media_info[] = {
+ {"T10KA", Media_T10KA,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KA WORM", Media_T10KA_WORM,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KA Clean", Media_T10KA_CLEAN,
+ media_type_unknown, medium_density_code_10kA},
+ {"T10KB", Media_T10KB,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KB WORM", Media_T10KB_WORM,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KB Clean", Media_T10KB_CLEAN,
+ media_type_unknown, medium_density_code_10kB},
+ {"T10KC", Media_T10KC,
+ media_type_unknown, medium_density_code_10kC},
+ {"T10KC WORM", Media_T10KC_WORM,
+ media_type_unknown, medium_density_code_10kC},
+ {"T10KC Clean", Media_T10KC_CLEAN,
+ media_type_unknown, medium_density_code_10kC},
+ {"", 0, 0, 0},
+};
+
/*
* Returns true if blk header has correct encryption key data
*/
@@ -312,6 +334,7 @@ static struct ssc_personality_template ssc_pm = {
.set_WORM = set_t10k_WORM,
.media_load = t10k_media_load,
.cleaning_media = t10k_cleaning,
+ .media_handling = media_info,
};
#define INQUIRY_LEN 74
View
37 usr/ult3580_pm.c
@@ -67,6 +67,42 @@ static struct density_info density_lto6 = {
18441, 127, 2176, 3200000, medium_density_code_lto6,
"LTO-CVE", "U-616", "Ultrium 6/16T" };
+static struct name_to_media_info media_info[] = {
+ {"LTO1", Media_LTO1,
+ media_type_lto1_data, medium_density_code_lto1},
+ {"LTO1 Clean", Media_LTO1_CLEAN,
+ media_type_lto1_data, medium_density_code_lto1},
+ {"LTO2", Media_LTO2,
+ media_type_lto2_data, medium_density_code_lto2},
+ {"LTO2 Clean", Media_LTO2_CLEAN,
+ media_type_lto2_data, medium_density_code_lto2},
+ {"LTO3", Media_LTO3,
+ media_type_lto3_data, medium_density_code_lto3},
+ {"LTO3 Clean", Media_LTO3_CLEAN,
+ media_type_lto3_data, medium_density_code_lto3},
+ {"LTO3 WORM", Media_LTO3_WORM,
+ media_type_lto3_worm, medium_density_code_lto3_WORM},
+ {"LTO4", Media_LTO4,
+ media_type_lto4_data, medium_density_code_lto4},
+ {"LTO4 Clean", Media_LTO4_CLEAN,
+ media_type_lto4_data, medium_density_code_lto4},
+ {"LTO4 WORM", Media_LTO4_WORM,
+ media_type_lto4_worm, medium_density_code_lto4_WORM},
+ {"LTO5", Media_LTO5,
+ media_type_lto5_data, medium_density_code_lto5},
+ {"LTO5 Clean", Media_LTO5_CLEAN,
+ media_type_lto5_data, medium_density_code_lto5},
+ {"LTO5 WORM", Media_LTO5_WORM,
+ media_type_lto5_worm, medium_density_code_lto5_WORM},
+ {"LTO6", Media_LTO6,
+ media_type_lto6_data, medium_density_code_lto6},
+ {"LTO6 Clean", Media_LTO6_CLEAN,
+ media_type_lto6_data, medium_density_code_lto6},
+ {"LTO6 WORM", Media_LTO6_WORM,
+ media_type_lto6_worm, medium_density_code_lto6_WORM},
+ {"", 0, 0, 0},
+};
+
static uint8_t clear_ult_compression(struct list_head *m)
{
MHVTL_DBG(3, "+++ Trace mode pages at %p +++", m);
@@ -382,6 +418,7 @@ static struct ssc_personality_template ssc_pm = {
.set_compression = set_ult_compression,
.media_load = ult_media_load,
.cleaning_media = ult_cleaning,
+ .media_handling = media_info,
};
void init_ult3580_td1(struct lu_phy_attr *lu)
View
201 usr/vtltape.c
@@ -243,173 +243,6 @@ static struct tape_drives_table {
{ NULL, NULL},
};
-static struct media_name_index_table {
- char *name;
- int media_type;
- int mode_media_type;
- int media_density;
-} media_info[] = {
- {"Undefined", Media_undefined,
- media_type_unknown, medium_density_code_unknown},
-
- /* Ultrium media */
- {"LTO1", Media_LTO1,
- media_type_lto1_data, medium_density_code_lto1},
- {"LTO1 Clean", Media_LTO1_CLEAN,
- media_type_lto1_data, medium_density_code_lto1},
- {"LTO2", Media_LTO2,
- media_type_lto2_data, medium_density_code_lto2},
- {"LTO2 Clean", Media_LTO2_CLEAN,
- media_type_lto2_data, medium_density_code_lto2},
- {"LTO3", Media_LTO3,
- media_type_lto3_data, medium_density_code_lto3},
- {"LTO3 Clean", Media_LTO3_CLEAN,
- media_type_lto3_data, medium_density_code_lto3},
- {"LTO3 WORM", Media_LTO3_WORM,
- media_type_lto3_worm, medium_density_code_lto3_WORM},
- {"LTO4", Media_LTO4,
- media_type_lto4_data, medium_density_code_lto4},
- {"LTO4 Clean", Media_LTO4_CLEAN,
- media_type_lto4_data, medium_density_code_lto4},
- {"LTO4 WORM", Media_LTO4_WORM,
- media_type_lto4_worm, medium_density_code_lto4_WORM},
- {"LTO5", Media_LTO5,
- media_type_lto5_data, medium_density_code_lto5},
- {"LTO5 Clean", Media_LTO5_CLEAN,
- media_type_lto5_data, medium_density_code_lto5},
- {"LTO5 WORM", Media_LTO5_WORM,
- media_type_lto5_worm, medium_density_code_lto5_WORM},
- {"LTO6", Media_LTO6,
- media_type_lto6_data, medium_density_code_lto6},
- {"LTO6 Clean", Media_LTO6_CLEAN,
- media_type_lto6_data, medium_density_code_lto6},
- {"LTO6 WORM", Media_LTO6_WORM,
- media_type_lto6_worm, medium_density_code_lto6_WORM},
-
- /* IBM 03592 media */
- {"03592 JA", Media_3592_JA,
- media_type_unknown, medium_density_code_j1a},
- {"03592 JA Clean", Media_3592_JA_CLEAN,
- media_type_unknown, medium_density_code_j1a},
- {"03592 JA WORM", Media_3592_JW,
- media_type_unknown, medium_density_code_j1a},
-
- {"03592 JB", Media_3592_JB,
- media_type_unknown, medium_density_code_e05},
- {"03592 JB Clean", Media_3592_JB_CLEAN,
- media_type_unknown, medium_density_code_e05},
- {"03592 JB ENCR", Media_3592_JB,
- media_type_unknown, medium_density_code_e05_ENCR},
-
- {"03592 JC", Media_3592_JX,
- media_type_unknown, medium_density_code_e06},
- {"03592 JC Clean", Media_3592_JX_CLEAN,
- media_type_unknown, medium_density_code_e06},
- {"03592 JC ENCR", Media_3592_JX,
- media_type_unknown, medium_density_code_e06_ENCR},
-
- /* AIT media */
- {"AIT1", Media_AIT1,
- media_type_unknown, medium_density_code_ait1},
- {"AIT1 Clean", Media_AIT1_CLEAN,
- media_type_unknown, medium_density_code_ait1},
- {"AIT2", Media_AIT2,
- media_type_unknown, medium_density_code_ait2},
- {"AIT2 Clean", Media_AIT2_CLEAN,
- media_type_unknown, medium_density_code_ait2},
- {"AIT3", Media_AIT3,
- media_type_unknown, medium_density_code_ait3},
- {"AIT3 Clean", Media_AIT3_CLEAN,
- media_type_unknown, medium_density_code_ait3},
- {"AIT4", Media_AIT4,
- media_type_unknown, medium_density_code_ait4},
- {"AIT4 Clean", Media_AIT4_CLEAN,
- media_type_unknown, medium_density_code_ait4},
- {"AIT4 WORM", Media_AIT4_WORM,
- media_type_unknown, medium_density_code_ait4},
-
- /* STK 9x40 media */
- {"9840A", Media_9840A,
- media_type_unknown, medium_density_code_9840A},
- {"9840A Clean", Media_9840A_CLEAN,
- media_type_unknown, medium_density_code_9840A},
- {"9840B", Media_9840B,
- media_type_unknown, medium_density_code_9840B},
- {"9840B Clean", Media_9840B_CLEAN,
- media_type_unknown, medium_density_code_9840B},
- {"9840C", Media_9840C,
- media_type_unknown, medium_density_code_9840C},
- {"9840C Clean", Media_9840C_CLEAN,
- media_type_unknown, medium_density_code_9840C},
- {"9840D", Media_9840D,
- media_type_unknown, medium_density_code_9840D},
- {"9840D Clean", Media_9840D_CLEAN,
- media_type_unknown, medium_density_code_9840D},
-
- {"9940A", Media_9940A,
- media_type_unknown, medium_density_code_9940A},
- {"9940A Clean", Media_9940A_CLEAN,
- media_type_unknown, medium_density_code_9940A},
- {"9940B", Media_9940B,
- media_type_unknown, medium_density_code_9940B},
- {"9940B Clean", Media_9940B_CLEAN,
- media_type_unknown, medium_density_code_9940B},
-
- /* STK T10000 media */
- {"T10KA", Media_T10KA,
- media_type_unknown, medium_density_code_10kA},
- {"T10KA WORM", Media_T10KA_WORM,
- media_type_unknown, medium_density_code_10kA},
- {"T10KA Clean", Media_T10KA_CLEAN,
- media_type_unknown, medium_density_code_10kA},
- {"T10KB", Media_T10KB,
- media_type_unknown, medium_density_code_10kB},
- {"T10KB WORM", Media_T10KB_WORM,
- media_type_unknown, medium_density_code_10kB},
- {"T10KB Clean", Media_T10KB_CLEAN,
- media_type_unknown, medium_density_code_10kB},
- {"T10KC", Media_T10KC,
- media_type_unknown, medium_density_code_10kC},
- {"T10KC WORM", Media_T10KC_WORM,
- media_type_unknown, medium_density_code_10kC},
- {"T10KC Clean", Media_T10KC_CLEAN,
- media_type_unknown, medium_density_code_10kC},
-
- /* Quantum DLT / SDLT media */
- {"DLT2", Media_DLT2,
- media_type_unknown, medium_density_code_dlt2},
- {"DLT3", Media_DLT3,
- media_type_unknown, medium_density_code_dlt3},
- {"DLT4", Media_DLT4,
- media_type_unknown, medium_density_code_dlt4},
- {"SDLT", Media_SDLT,
- media_type_unknown, medium_density_code_sdlt},
- {"SDLT 220", Media_SDLT220,
- media_type_unknown, medium_density_code_220},
- {"SDLT 320", Media_SDLT320,
- media_type_unknown, medium_density_code_320},
- {"SDLT 320 Clean", Media_SDLT320_CLEAN,
- media_type_unknown, medium_density_code_320},
- {"SDLT 600", Media_SDLT600,
- media_type_unknown, medium_density_code_600},
- {"SDLT 600 Clean", Media_SDLT600_CLEAN,
- media_type_unknown, medium_density_code_600},
- {"SDLT 600 WORM", Media_SDLT600_WORM,
- media_type_unknown, medium_density_code_600},
-
- /* 4MM DAT media */
- {"DDS1", Media_DDS1,
- media_type_unknown, medium_density_code_DDS1},
- {"DDS2", Media_DDS2,
- media_type_unknown, medium_density_code_DDS2},
- {"DDS3", Media_DDS3,
- media_type_unknown, medium_density_code_DDS3},
- {"DDS4", Media_DDS4,
- media_type_unknown, medium_density_code_DDS4},
- {"DDS5", Media_DDS5,
- media_type_unknown, medium_density_code_DDS5},
-};
-
static void (*drive_init)(struct lu_phy_attr *) = init_default_ssc;
static void usage(char *progname) {
@@ -437,52 +270,55 @@ mk_sense_short_block(uint32_t requested, uint32_t processed, uint8_t *sense_vali
put_unaligned_be32(difference, &sense[3]);
}
-static int lookup_media_int(char *s)
+static int lookup_media_int(struct name_to_media_info *media_info, char *s)
{
unsigned int i;
MHVTL_DBG(2, "looking for media type %s", s);
- for (i = 0; i < ARRAY_SIZE(media_info); i++)
+ for (i = 0; media_info[i].media_density != 0; i++)
if (!strcmp(media_info[i].name, s))
return media_info[i].media_type;
return Media_undefined;
}
-static const char *lookup_density_name(int den)
+static const char *lookup_density_name(
+ struct name_to_media_info *media_info,
+ int den)
{
unsigned int i;
MHVTL_DBG(2, "looking for density type 0x%02x", den);
- for (i = 0; i < ARRAY_SIZE(media_info); i++)
+ for (i = 0; media_info[i].media_density != 0; i++)
if (media_info[i].media_density == den)
return media_info[i].name;
return "(UNKNOWN density)";
}
-static const char *lookup_media_type(int med)
+static const char *lookup_media_type(struct name_to_media_info *media_info,
+ int med)
{
unsigned int i;
MHVTL_DBG(2, "looking for media type 0x%02x", med);
- for (i = 0; i < ARRAY_SIZE(media_info); i++)
+ for (i = 0; media_info[i].media_density != 0; i++)
if (media_info[i].media_type == med)
return media_info[i].name;
return "(UNKNOWN media type)";
}
-int lookup_mode_media_type(int med)
+int lookup_mode_media_type(struct name_to_media_info *media_info, int med)
{
unsigned int i;
MHVTL_DBG(2, "looking for mode media type for 0x%02x", med);
- for (i = 0; i < ARRAY_SIZE(media_info); i++) {
+ for (i = 0; media_info[i].media_density != 0; i++) {
MHVTL_DBG(3, "%s : 0x%02x mode media type 0x%02x",
media_info[i].name,
media_info[i].media_type,
@@ -1729,7 +1565,9 @@ static int loadTape(char *PCL, uint8_t *sam_stat)
sizeof(mam.MediumSerialNumber) - 1);
MHVTL_DBG(1, "Media type '%s' loaded with S/No. : %s",
- lookup_media_type(mam.MediaType), mam.MediumSerialNumber);
+ lookup_media_type(lu_ssc.pm->media_handling,
+ mam.MediaType),
+ mam.MediumSerialNumber);
lu_ssc.max_capacity = 0L;
@@ -1885,11 +1723,13 @@ static int loadTape(char *PCL, uint8_t *sam_stat)
MHVTL_DBG(1, "Media is%s writable", (OK_to_write) ? "" : " not");
modeBlockDescriptor[0] = mam.MediumDensityCode;
- lu->mode_media_type = lookup_mode_media_type(mam.MediaType);
+ lu->mode_media_type = lookup_mode_media_type(lu_ssc.pm->media_handling,
+ mam.MediaType);
MHVTL_DBG(1, "Setting MediumDensityCode to %s (0x%02x)"
" Media type: 0x%02x",
- lookup_density_name(mam.MediumDensityCode),
+ lookup_density_name(lu_ssc.pm->media_handling,
+ mam.MediumDensityCode),
mam.MediumDensityCode,
lu->mode_media_type);
@@ -1902,7 +1742,8 @@ static int loadTape(char *PCL, uint8_t *sam_stat)
update_TapeAlert(lu, fg);
MHVTL_ERR("Tape %s failed to load with type '%s' in drive type '%s'",
PCL,
- lookup_media_type(mam.MediaType),
+ lookup_media_type(lu_ssc.pm->media_handling,
+ mam.MediaType),
lu_ssc.pm->name);
lu_ssc.tapeLoaded = TAPE_UNLOADED;
lu_ssc.pm->media_load(lu, TAPE_UNLOADED);
@@ -2218,7 +2059,7 @@ int add_drive_media_list(struct lu_phy_attr *lu, int status, char *s)
den_list = &lu_tape->supported_media_list;
MHVTL_DBG(2, "Adding %s, status: 0x%02x", s, status);
- media_type = lookup_media_int(s);
+ media_type = lookup_media_int(lu_tape->pm->media_handling, s);
m_detail = check_media_can_load(den_list, media_type);
if (m_detail) {
View
3 usr/vtltape.h
@@ -157,6 +157,9 @@ struct blk_header {
#define media_type_lto5_worm 0x5c
#define media_type_lto6_data 0x68
#define media_type_lto6_worm 0x6c
+#define media_type_hp_lto_data 0x00
+#define media_type_hp_lto_worm 0x01
+#define media_type_hp_lto_cd 0x80
#define LZO 1 /* Using lzo compression libraries */
#define ZLIB 2 /* Using zlib compression libraries */

0 comments on commit 3994118

Please sign in to comment.
Something went wrong with that request. Please try again.