Exemple #1
0
/*
 * Transport Geometry Parameters mode page
 * SMC-3 7.3.4
 */
int add_mode_transport_geometry(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_TRANSPORT_GEOMETRY;
	subpcode = 0;
	size = 4;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_transport_geometry, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->description = mode_transport_geometry;

	return 0;
}
Exemple #2
0
int add_mode_power_condition(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_POWER_CONDITION;
	subpcode = 0;
	size = 0x26;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_power_condition, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->description = mode_power_condition;

	return 0;
}
Exemple #3
0
/*
 * READ/WRITE Error Recovery
 * SSC3-8.3.5
 */
int add_mode_page_rw_err_recovery(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	pcode = MODE_RW_ERROR_RECOVER;
	subpcode = 0;
	size = 12;

	mode_pg = &lu->mode_pg;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_rw_error_recover, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->description = mode_rw_error_recover;

	return 0;
}
Exemple #4
0
/*
 * Initialise structure data for mode pages.
 * - Allocate memory for each mode page & init to 0
 * - Set up size of mode page
 * - Set initial values of mode pages
 *
 * Return void  - Nothing
 */
static void init_ult_mode_pages(struct lu_phy_attr *lu, struct mode *m)
{
	struct mode *mp;

	MHVTL_DBG(3, "+++ Trace mode pages at %p +++", sm);

	mp = alloc_mode_page(m, 0x24, 0, 6);
	MHVTL_DBG(3, "smp: %p", mp);
}
Exemple #5
0
int add_mode_device_configuration_extention(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct priv_lu_ssc *ssc;
	struct ssc_personality_template *pm;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	/* Only for TAPE (SSC) devices */
	if (lu->ptype != TYPE_TAPE)
		return -ENOTTY;

	ssc = lu->lu_private;
	pm = ssc->pm;

	mode_pg = &lu->mode_pg;
	pcode = MODE_DEVICE_CONFIGURATION;
	subpcode = 0x01;
	size = 32;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
			mode_device_configuration_extension, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[5] = 0x02;	/* Short erase mode  - write EOD */

	/* default size of early warning */
	put_unaligned_be16(0, &mp->pcodePointer[6]);

	/* Update mode page bitmap to reflect changeable fields */
	if (pm->drive_supports_append_only_mode)
		mp->pcodePointerBitMap[5] |= 0xf0;
	if (pm->drive_supports_prog_early_warning) {
		mp->pcodePointerBitMap[6] |= 0xff;
		mp->pcodePointerBitMap[7] |= 0xff;
	}

	mp->description = mode_device_configuration_extension;

	return 0;
}
Exemple #6
0
/*
 * Initialise structure data for mode pages.
 * - Allocate memory for each mode page & init to 0
 * - Set up size of mode page
 * - Set initial values of mode pages
 *
 * Return void  - Nothing
 */
static void init_ait4_mode_pages(struct lu_phy_attr *lu, struct mode *m)
{
	struct mode *mp;

	MHVTL_DBG(3, "+++ Trace mode pages at %p +++", sm);

	mp = alloc_mode_page(m, 0x31, 0, 8);
	if (mp)
		mp->pcodePointer[2] = 0xf0;
		mp->pcodePointer[3] = 0x0a;
		mp->pcodePointer[4] = 0x40;
}
Exemple #7
0
/*
 * Initialise structure data for mode pages.
 * - Allocate memory for each mode page & init to 0
 * - Set up size of mode page
 * - Set initial values of mode pages
 *
 * Return void  - Nothing
 */
static void init_ult_encr_mode_pages(struct lu_phy_attr *lu, struct mode *m)
{
	struct mode *mp;

	MHVTL_DBG(3, "+++ Trace mode pages at %p +++", sm);

	/* Vendor Unique (IBM Ultrium)
	 * Page 151, table 118
	 * Advise ENCRYPTION Capable device
	 */
	mp = alloc_mode_page(m, 0x24, 0, 6);
	if (mp)
		mp->pcodePointer[5] = ENCR_C;
}
Exemple #8
0
int add_mode_device_configuration(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	struct priv_lu_ssc *ssc;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	ssc = (struct priv_lu_ssc *)lu->lu_private;
	mode_pg = &lu->mode_pg;
	pcode = MODE_DEVICE_CONFIGURATION;
	subpcode = 0;
	size = 16;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_device_configuration, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[7] = 0x64;	/* Write delay (100mS intervals) */
	mp->pcodePointer[8] = 0x40;	/* Block Identifiers supported */
	mp->pcodePointer[10] = 0x18;	/* Enable EOD & Sync at early warning */
	mp->pcodePointer[14] = ssc->configCompressionFactor;
	mp->pcodePointer[15] = 0x80;	/* WTRE (WORM handling) */

	mp->pcodePointerBitMap[14] = 0xff;	/* Compression is changeable */

	/* Set pointer for compressionFactor to correct location in
	 * mode page struct
	 */
	ssc->compressionFactor = &mp->pcodePointer[14];

	mp->description = mode_device_configuration;

	return 0;
}
Exemple #9
0
/*
 * Device Capabilities mode page:
 * SMC-3 7.3.2
 */
int add_mode_device_capabilities(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_DEVICE_CAPABILITIES;
	subpcode = 0;
	size = 20;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_device_capabilities, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[2] = 0x0f;
	mp->pcodePointer[3] = 0x07;
	mp->pcodePointer[4] = 0x0f;
	mp->pcodePointer[5] = 0x0f;
	mp->pcodePointer[6] = 0x0f;
	mp->pcodePointer[7] = 0x0f;
	/* [8-11] -> reserved */
	mp->pcodePointer[12] = 0x00;
	mp->pcodePointer[13] = 0x00;
	mp->pcodePointer[14] = 0x00;
	mp->pcodePointer[15] = 0x00;
	/* [16-19] -> reserved */

	mp->description = mode_device_capabilities;

	return 0;
}
Exemple #10
0
int add_mode_element_address_assignment(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	static struct smc_priv *smc_slots;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;
	uint8_t *p;

	mode_pg = &lu->mode_pg;
	smc_slots = (struct smc_priv *)lu->lu_private;
	pcode = MODE_ELEMENT_ADDRESS;
	subpcode = 0;
	size = 20;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_element_address, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	p = mp->pcodePointer;

	p[0] = pcode;
	p[1] = size - sizeof(p[0]) - sizeof(p[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	put_unaligned_be16(START_PICKER, &p[2]); /* First transport. */
	put_unaligned_be16(smc_slots->num_picker, &p[4]);
	put_unaligned_be16(START_STORAGE, &p[6]); /* First storage */
	put_unaligned_be16(smc_slots->num_storage, &p[8]);
	put_unaligned_be16(START_MAP, &p[10]); /* First i/e address */
	put_unaligned_be16(smc_slots->num_map, &p[12]);
	put_unaligned_be16(START_DRIVE, &p[14]); /* First Drives */
	put_unaligned_be16(smc_slots->num_drives, &p[16]);

	mp->description = mode_element_address;

	return 0;
}
Exemple #11
0
int add_mode_data_compression(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_DATA_COMPRESSION;
	subpcode = 0;
	size = 16;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_data_compression, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[2] = 0xc0;	/* Set data compression enable */
	mp->pcodePointer[3] = 0x80;	/* Set data decompression enable */
	put_unaligned_be32(COMPRESSION_TYPE, &mp->pcodePointer[4]);
	put_unaligned_be32(COMPRESSION_TYPE, &mp->pcodePointer[8]);

	/* Changeable fields */
	mp->pcodePointerBitMap[2] = 0xc0; /* DCE & DCC */
	mp->pcodePointerBitMap[3] = 0x80; /* DDE bit */
	put_unaligned_be32(0xffffffff, &mp->pcodePointer[4]); /* Comp alg */
	put_unaligned_be32(0xffffffff, &mp->pcodePointer[8]); /* De-comp alg */

	mp->description = mode_data_compression;

	return 0;
}
Exemple #12
0
/*
 * Initialise structure data for mode pages.
 * - Allocate memory for each mode page & init to 0
 * - Set up size of mode page
 * - Set initial values of mode pages
 *
 * Return void  - Nothing
 */
int add_mode_vendor_25h_mode_pages(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;	/* Mode Page list */
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_VENDOR_SPECIFIC_25H;
	subpcode = 0;
	size = 32;

	/* Vendor Unique (IBM Ultrium)
	 * Page 151, table 118
	 * Advise ENCRYPTION Capable device
	 */
	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_vendor_25h, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[5] = 1;	/* LEOP to maximize medium capacity */
	mp->pcodePointer[6] = 1;	/* Early Warning */

	mp->description = mode_vendor_25h;

	return 0;
}
Exemple #13
0
int add_mode_encryption_mode_attribute(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_ENCRYPTION_MODE;
	subpcode = 0x20;
	size = 9;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_encryption_mode, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	/* Application Managed Encryption */
	mp->pcodePointer[5] = 0x03;	/* Encryption Solution Method */
	mp->pcodePointer[6] = 0x01;	/* Key Path */
	mp->pcodePointer[7] = 0x01;	/* Default Encruption State */
	mp->pcodePointer[8] = 0x00;	/* Desnity Reporting */

	mp->description = mode_encryption_mode;

	return 0;
}
Exemple #14
0
int add_mode_ait_device_configuration(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_AIT_DEVICE_CONFIGURATION;
	subpcode = 0;
	size = 8;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_ait_device_configuration, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[2] = 0xf0;
	mp->pcodePointer[3] = 0x0a;
	mp->pcodePointer[4] = 0x40;

	mp->description = mode_ait_device_configuration;

	return 0;
}
Exemple #15
0
/*
 * Disconnect / Reconnect
 * SPC3-7.4.8
 */
int add_mode_disconnect_reconnect(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_DISCONNECT_RECONNECT;
	subpcode = 0;
	size = 12;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_disconnect_reconnect, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[2] = 50;	/* Buffer full ratio */
	mp->pcodePointer[3] = 50;	/* Buffer empty ratio */
	mp->pcodePointer[10] = 4;

	mp->description = mode_disconnect_reconnect;

	return 0;
}
Exemple #16
0
/*
 * Behavior Configuration Mode Page
 * IBM Ultrium SCSI Reference - 9th Edition
 */
int add_mode_behavior_configuration(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_BEHAVIOR_CONFIGURATION;
	subpcode = 0;
	size = 10;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_behaviour_configuration, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[3] = 0; /* Clean Behavior */
	mp->pcodePointer[4] = 0; /* WORM Behavior */

	mp->description = mode_behaviour_configuration;

	return 0;
}
Exemple #17
0
int add_mode_medium_configuration(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_MEDIUM_CONFIGURATION;
	subpcode = 0;
	size = 32;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_medium_configuration, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[4] = 0x01;	/* WORM mode label restrictions */
	mp->pcodePointer[5] = 0x01;	/* WORM mode filemark restrictions */

	mp->description = mode_medium_configuration;

	return 0;
}
Exemple #18
0
int add_mode_information_exception(struct lu_phy_attr *lu)
{
	struct list_head *mode_pg;
	struct mode *mp;
	uint8_t pcode;
	uint8_t subpcode;
	uint8_t size;

	mode_pg = &lu->mode_pg;
	pcode = MODE_INFORMATION_EXCEPTION;
	subpcode = 0;
	size = 12;

	MHVTL_DBG(3, "Adding mode page %s (%02x/%02x)",
				mode_information_exception, pcode, subpcode);

	mp = alloc_mode_page(mode_pg, pcode, subpcode, size);
	if (!mp)
		return -ENOMEM;

	mp->pcodePointer[0] = pcode;
	mp->pcodePointer[1] = size
				 - sizeof(mp->pcodePointer[0])
				 - sizeof(mp->pcodePointer[1]);

	/* And copy pcode/size into bitmap structure */
	mp->pcodePointerBitMap[0] = mp->pcodePointer[0];
	mp->pcodePointerBitMap[1] = mp->pcodePointer[1];

	mp->pcodePointer[2] = 0x08;
	mp->pcodePointer[3] = 0x03;

	mp->description = mode_information_exception;

	return 0;
}