tape_3590.c

来自「linux 内核源代码」· C语言 代码 · 共 1,767 行 · 第 1/4 页

C
1,767
字号
/* *  RDL: Read Device (buffered) log */static inttape_3590_erp_read_buf_log(struct tape_device *device,			   struct tape_request *request, struct irb *irb){	/*	 * We just do the basic error recovery at the moment (retry).	 * Perhaps in the future, we read the log and dump it somewhere...	 */	return tape_3590_erp_basic(device, request, irb, -EIO);}/* *  SWAP: Swap Devices */static inttape_3590_erp_swap(struct tape_device *device, struct tape_request *request,		   struct irb *irb){	/*	 * This error recovery should swap the tapes	 * if the original has a problem. The operation	 * should proceed with the new tape... this	 * should probably be done in user space!	 */	PRINT_WARN("(%s): Swap Tape Device!\n", device->cdev->dev.bus_id);	return tape_3590_erp_basic(device, request, irb, -EIO);}/* *  LBY: Long Busy */static inttape_3590_erp_long_busy(struct tape_device *device,			struct tape_request *request, struct irb *irb){	DBF_EVENT(6, "Device is busy\n");	return TAPE_IO_LONG_BUSY;}/* *  SPI: Special Intercept */static inttape_3590_erp_special_interrupt(struct tape_device *device,				struct tape_request *request, struct irb *irb){	return tape_3590_erp_basic(device, request, irb, -EIO);}/* *  RDA: Read Alternate */static inttape_3590_erp_read_alternate(struct tape_device *device,			     struct tape_request *request, struct irb *irb){	struct tape_3590_disc_data *data;	/*	 * The issued Read Backward or Read Previous command is not	 * supported by the device	 * The recovery action should be to issue another command:	 * Read Revious: if Read Backward is not supported	 * Read Backward: if Read Previous is not supported	 */	data = device->discdata;	if (data->read_back_op == READ_PREVIOUS) {		DBF_EVENT(2, "(%08x): No support for READ_PREVIOUS command\n",			  device->cdev_id);		data->read_back_op = READ_BACKWARD;	} else {		DBF_EVENT(2, "(%08x): No support for READ_BACKWARD command\n",			  device->cdev_id);		data->read_back_op = READ_PREVIOUS;	}	tape_3590_read_opposite(device, request);	return tape_3590_erp_retry(device, request, irb);}/* * Error Recovery read opposite */static inttape_3590_erp_read_opposite(struct tape_device *device,			    struct tape_request *request, struct irb *irb){	switch (request->op) {	case TO_RFO:		/*		 * We did read forward, but the data could not be read.		 * We will read backward and then skip forward again.		 */		tape_3590_read_opposite(device, request);		return tape_3590_erp_retry(device, request, irb);	case TO_RBA:		/* We tried to read forward and backward, but hat no success */		return tape_3590_erp_failed(device, request, irb, -EIO);		break;	default:		PRINT_WARN("read_opposite_recovery_called_with_op: %s\n",			   tape_op_verbose[request->op]);		return tape_3590_erp_failed(device, request, irb, -EIO);	}}/* * Print an MIM (Media Information  Message) (message code f0) */static voidtape_3590_print_mim_msg_f0(struct tape_device *device, struct irb *irb){	struct tape_3590_sense *sense;	sense = (struct tape_3590_sense *) irb->ecw;	/* Exception Message */	switch (sense->fmt.f70.emc) {	case 0x02:		PRINT_WARN("(%s): Data degraded\n", device->cdev->dev.bus_id);		break;	case 0x03:		PRINT_WARN("(%s): Data degraded in partion %i\n",			   device->cdev->dev.bus_id, sense->fmt.f70.mp);		break;	case 0x04:		PRINT_WARN("(%s): Medium degraded\n", device->cdev->dev.bus_id);		break;	case 0x05:		PRINT_WARN("(%s): Medium degraded in partition %i\n",			   device->cdev->dev.bus_id, sense->fmt.f70.mp);		break;	case 0x06:		PRINT_WARN("(%s): Block 0 Error\n", device->cdev->dev.bus_id);		break;	case 0x07:		PRINT_WARN("(%s): Medium Exception 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f70.md);		break;	default:		PRINT_WARN("(%s): MIM ExMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f70.emc);		break;	}	/* Service Message */	switch (sense->fmt.f70.smc) {	case 0x02:		PRINT_WARN("(%s): Reference Media maintenance procedure %i\n",			   device->cdev->dev.bus_id, sense->fmt.f70.md);		break;	default:		PRINT_WARN("(%s): MIM ServiceMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f70.smc);		break;	}}/* * Print an I/O Subsystem Service Information Message (message code f1) */static voidtape_3590_print_io_sim_msg_f1(struct tape_device *device, struct irb *irb){	struct tape_3590_sense *sense;	sense = (struct tape_3590_sense *) irb->ecw;	/* Exception Message */	switch (sense->fmt.f71.emc) {	case 0x01:		PRINT_WARN("(%s): Effect of failure is unknown\n",			   device->cdev->dev.bus_id);		break;	case 0x02:		PRINT_WARN("(%s): CU Exception - no performance impact\n",			   device->cdev->dev.bus_id);		break;	case 0x03:		PRINT_WARN("(%s): CU Exception on channel interface 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x04:		PRINT_WARN("(%s): CU Exception on device path 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x05:		PRINT_WARN("(%s): CU Exception on library path 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x06:		PRINT_WARN("(%s): CU Exception on node 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x07:		PRINT_WARN("(%s): CU Exception on partition 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	default:		PRINT_WARN("(%s): SIM ExMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.emc);	}	/* Service Message */	switch (sense->fmt.f71.smc) {	case 0x01:		PRINT_WARN("(%s): Repair impact is unknown\n",			   device->cdev->dev.bus_id);		break;	case 0x02:		PRINT_WARN("(%s): Repair will not impact cu performance\n",			   device->cdev->dev.bus_id);		break;	case 0x03:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable node "				   "0x%x on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable nodes "				   "(0x%x-0x%x) on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x04:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable cannel path "				   "0x%x on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable cannel paths "				   "(0x%x-0x%x) on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x05:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable device path "				   "0x%x on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable device paths "				   "(0x%x-0x%x) on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x06:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable library path "				   "0x%x on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable library paths "				   "(0x%x-0x%x) on CU\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x07:		PRINT_WARN("(%s): Repair will disable access to CU\n",			   device->cdev->dev.bus_id);		break;	default:		PRINT_WARN("(%s): SIM ServiceMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.smc);	}}/* * Print an Device Subsystem Service Information Message (message code f2) */static voidtape_3590_print_dev_sim_msg_f2(struct tape_device *device, struct irb *irb){	struct tape_3590_sense *sense;	sense = (struct tape_3590_sense *) irb->ecw;	/* Exception Message */	switch (sense->fmt.f71.emc) {	case 0x01:		PRINT_WARN("(%s): Effect of failure is unknown\n",			   device->cdev->dev.bus_id);		break;	case 0x02:		PRINT_WARN("(%s): DV Exception - no performance impact\n",			   device->cdev->dev.bus_id);		break;	case 0x03:		PRINT_WARN("(%s): DV Exception on channel interface 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x04:		PRINT_WARN("(%s): DV Exception on loader 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x05:		PRINT_WARN("(%s): DV Exception on message display 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.md[0]);		break;	case 0x06:		PRINT_WARN("(%s): DV Exception in tape path\n",			   device->cdev->dev.bus_id);		break;	case 0x07:		PRINT_WARN("(%s): DV Exception in drive\n",			   device->cdev->dev.bus_id);		break;	default:		PRINT_WARN("(%s): DSIM ExMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.emc);	}	/* Service Message */	switch (sense->fmt.f71.smc) {	case 0x01:		PRINT_WARN("(%s): Repair impact is unknown\n",			   device->cdev->dev.bus_id);		break;	case 0x02:		PRINT_WARN("(%s): Repair will not impact device performance\n",			   device->cdev->dev.bus_id);		break;	case 0x03:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable channel path "				   "0x%x on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable channel path "				   "(0x%x-0x%x) on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x04:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable interface 0x%x "				   "on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable interfaces "				   "(0x%x-0x%x) on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x05:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable loader 0x%x "				   "on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable loader "				   "(0x%x-0x%x) on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x07:		PRINT_WARN("(%s): Repair will disable access to DV\n",			   device->cdev->dev.bus_id);		break;	case 0x08:		if (sense->fmt.f71.mdf == 0)			PRINT_WARN("(%s): Repair will disable message "				   "display 0x%x on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1]);		else			PRINT_WARN("(%s): Repair will disable message "				   "displays (0x%x-0x%x) on DV\n",				   device->cdev->dev.bus_id,				   sense->fmt.f71.md[1], sense->fmt.f71.md[2]);		break;	case 0x09:		PRINT_WARN("(%s): Clean DV\n", device->cdev->dev.bus_id);		break;	default:		PRINT_WARN("(%s): DSIM ServiceMsg: 0x%02x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.smc);	}}/* * Print standard ERA Message */static voidtape_3590_print_era_msg(struct tape_device *device, struct irb *irb){	struct tape_3590_sense *sense;	sense = (struct tape_3590_sense *) irb->ecw;	if (sense->mc == 0)		return;	if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) {		if (tape_3590_msg[sense->mc] != NULL)			PRINT_WARN("(%s): %s\n", device->cdev->dev.bus_id,				   tape_3590_msg[sense->mc]);		else {			PRINT_WARN("(%s): Message Code 0x%x\n",				   device->cdev->dev.bus_id, sense->mc);		}		return;	}	if (sense->mc == 0xf0) {		/* Standard Media Information Message */		PRINT_WARN("(%s): MIM SEV=%i, MC=%02x, ES=%x/%x, "			   "RC=%02x-%04x-%02x\n", device->cdev->dev.bus_id,			   sense->fmt.f70.sev, sense->mc,			   sense->fmt.f70.emc, sense->fmt.f70.smc,			   sense->fmt.f70.refcode, sense->fmt.f70.mid,			   sense->fmt.f70.fid);		tape_3590_print_mim_msg_f0(device, irb);		return;	}	if (sense->mc == 0xf1) {		/* Standard I/O Subsystem Service Information Message */		PRINT_WARN("(%s): IOSIM SEV=%i, DEVTYPE=3590/%02x, "			   "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.sev,			   device->cdev->id.dev_model,			   sense->mc, sense->fmt.f71.emc,			   sense->fmt.f71.smc, sense->fmt.f71.refcode1,			   sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);		tape_3590_print_io_sim_msg_f1(device, irb);		return;	}	if (sense->mc == 0xf2) {		/* Standard Device Service Information Message */		PRINT_WARN("(%s): DEVSIM SEV=%i, DEVTYPE=3590/%02x, "			   "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",			   device->cdev->dev.bus_id, sense->fmt.f71.sev,			   device->cdev->id.dev_model,			   sense->mc, sense->fmt.f71.emc,			   sense->fmt.f71.smc, sense->fmt.f71.refcode1,			   sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);		tape_3590_print_dev_sim_msg_f2(device, irb);		return;	}	if (sense->mc == 0xf3) {		/* Standard Library Service Information Message */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?