tape_3590.c
来自「LINUX 2.6.17.4的源码」· C语言 代码 · 共 1,302 行 · 第 1/3 页
C
1,302 行
struct irb *irb, int rc){ DBF_EVENT(3, "Error Recovery failed for %s\n", tape_op_verbose[request->op]); tape_dump_sense_dbf(device, request, irb); return rc;}/* * Error Recovery do retry */static inline inttape_3590_erp_retry(struct tape_device *device, struct tape_request *request, struct irb *irb){ DBF_EVENT(2, "Retry: %s\n", tape_op_verbose[request->op]); tape_dump_sense_dbf(device, request, irb); return TAPE_IO_RETRY;}/* * Handle unsolicited interrupts */static inttape_3590_unsolicited_irq(struct tape_device *device, struct irb *irb){ if (irb->scsw.dstat == DEV_STAT_CHN_END) /* Probably result of halt ssch */ return TAPE_IO_PENDING; else if (irb->scsw.dstat == 0x85) /* Device Ready -> check medium state */ tape_3590_schedule_work(device, TO_MSEN); else if (irb->scsw.dstat & DEV_STAT_ATTENTION) tape_3590_schedule_work(device, TO_READ_ATTMSG); else { DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id); PRINT_WARN("Unsolicited IRQ (Device End) caught.\n"); tape_dump_sense(device, NULL, irb); } return TAPE_IO_SUCCESS;}/* * Basic Recovery routine */static inttape_3590_erp_basic(struct tape_device *device, struct tape_request *request, struct irb *irb, int rc){ struct tape_3590_sense *sense; sense = (struct tape_3590_sense *) irb->ecw; switch (sense->bra) { case SENSE_BRA_PER: return tape_3590_erp_failed(device, request, irb, rc); case SENSE_BRA_CONT: return tape_3590_erp_succeded(device, request); case SENSE_BRA_RE: return tape_3590_erp_retry(device, request, irb); case SENSE_BRA_DRE: return tape_3590_erp_failed(device, request, irb, rc); default: PRINT_ERR("Unknown BRA %x - This should not happen!\n", sense->bra); BUG(); return TAPE_IO_STOP; }}/* * 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){ /* FIXME: how about WAITING for a minute ? */ PRINT_WARN("(%s): Device is busy! Please wait a minute!\n", device->cdev->dev.bus_id); return tape_3590_erp_basic(device, request, irb, -EBUSY);}/* * 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;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?