📄 eata.c
字号:
if (inb(sh[j]->io_port + REG_AUX_STATUS) & IRQ_ASSERTED) printk("%s: abort, mbox %d, interrupt pending.\n", BN(j), i); if (SCarg->eh_state == SCSI_STATE_TIMEOUT) { SCarg->host_scribble = NULL; HD(j)->cp_stat[i] = FREE; printk("%s, abort, mbox %d, eh_state timeout, pid %ld.\n", BN(j), i, SCarg->pid); return SUCCESS; } return FAILED; } if (HD(j)->cp_stat[i] == IN_RESET) { printk("%s: abort, mbox %d is in reset.\n", BN(j), i); return FAILED; } if (HD(j)->cp_stat[i] == LOCKED) { printk("%s: abort, mbox %d is locked.\n", BN(j), i); return SUCCESS; } if (HD(j)->cp_stat[i] == READY || HD(j)->cp_stat[i] == ABORTING) { SCarg->result = DID_ABORT << 16; SCarg->host_scribble = NULL; HD(j)->cp_stat[i] = FREE; printk("%s, abort, mbox %d ready, DID_ABORT, pid %ld done.\n", BN(j), i, SCarg->pid); SCarg->scsi_done(SCarg); return SUCCESS; } panic("%s: abort, mbox %d, invalid cp_stat.\n", BN(j), i);}int eata2x_abort(Scsi_Cmnd *SCarg) { return do_abort(SCarg);}#endif /* new_eh_code */static inline int do_old_reset(Scsi_Cmnd *SCarg) { unsigned int i, j, time, k, c, limit = 0; int arg_done = FALSE; Scsi_Cmnd *SCpnt; j = ((struct hostdata *) SCarg->host->hostdata)->board_number; printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid); if (SCarg->host_scribble == NULL) printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid); if (SCarg->serial_number_at_timeout && (SCarg->serial_number != SCarg->serial_number_at_timeout)) { printk("%s: reset, pid %ld, reset not running.\n", BN(j), SCarg->pid); return SCSI_RESET_NOT_RUNNING; } if (HD(j)->in_reset) { printk("%s: reset, exit, already in reset.\n", BN(j)); return SCSI_RESET_ERROR; } if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { printk("%s: reset, exit, timeout error.\n", BN(j)); return SCSI_RESET_ERROR; } HD(j)->retries = 0; for (c = 0; c <= sh[j]->max_channel; c++) for (k = 0; k < sh[j]->max_id; k++) { HD(j)->target_redo[k][c] = TRUE; HD(j)->target_to[k][c] = 0; } for (i = 0; i < sh[j]->can_queue; i++) { if (HD(j)->cp_stat[i] == FREE) continue; if (HD(j)->cp_stat[i] == LOCKED) { HD(j)->cp_stat[i] = FREE; printk("%s: reset, locked mbox %d forced free.\n", BN(j), i); continue; } if (!(SCpnt = HD(j)->cp[i].SCpnt)) panic("%s: reset, mbox %d, SCpnt == NULL.\n", BN(j), i); if (HD(j)->cp_stat[i] == READY || HD(j)->cp_stat[i] == ABORTING) { HD(j)->cp_stat[i] = ABORTING; printk("%s: reset, mbox %d aborting, pid %ld.\n", BN(j), i, SCpnt->pid); } else { HD(j)->cp_stat[i] = IN_RESET; printk("%s: reset, mbox %d in reset, pid %ld.\n", BN(j), i, SCpnt->pid); } if (SCpnt->host_scribble == NULL) panic("%s: reset, mbox %d, garbled SCpnt.\n", BN(j), i); if (*(unsigned int *)SCpnt->host_scribble != i) panic("%s: reset, mbox %d, index mismatch.\n", BN(j), i); if (SCpnt->scsi_done == NULL) panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n", BN(j), i); if (SCpnt == SCarg) arg_done = TRUE; } if (do_dma(sh[j]->io_port, 0, RESET_PIO)) { printk("%s: reset, cannot reset, timeout error.\n", BN(j)); return SCSI_RESET_ERROR; } printk("%s: reset, board reset done, enabling interrupts.\n", BN(j));#if defined(DEBUG_RESET) do_trace = TRUE;#endif HD(j)->in_reset = TRUE; SPIN_UNLOCK IRQ_UNLOCK time = jiffies; while ((jiffies - time) < (10 * HZ) && limit++ < 200000) udelay(100L); IRQ_LOCK SPIN_LOCK printk("%s: reset, interrupts disabled, loops %d.\n", BN(j), limit); for (i = 0; i < sh[j]->can_queue; i++) { if (HD(j)->cp_stat[i] == IN_RESET) { SCpnt = HD(j)->cp[i].SCpnt; SCpnt->result = DID_RESET << 16; SCpnt->host_scribble = NULL; /* This mailbox is still waiting for its interrupt */ HD(j)->cp_stat[i] = LOCKED; printk("%s, reset, mbox %d locked, DID_RESET, pid %ld done.\n", BN(j), i, SCpnt->pid); } else if (HD(j)->cp_stat[i] == ABORTING) { SCpnt = HD(j)->cp[i].SCpnt; SCpnt->result = DID_RESET << 16; SCpnt->host_scribble = NULL; /* This mailbox was never queued to the adapter */ HD(j)->cp_stat[i] = FREE; printk("%s, reset, mbox %d aborting, DID_RESET, pid %ld done.\n", BN(j), i, SCpnt->pid); } else /* Any other mailbox has already been set free by interrupt */ continue; SCpnt->scsi_done(SCpnt); IRQ_LOCK } HD(j)->in_reset = FALSE; do_trace = FALSE; if (arg_done) { printk("%s: reset, exit, success.\n", BN(j)); return SCSI_RESET_SUCCESS; } else { printk("%s: reset, exit, wakeup.\n", BN(j)); return SCSI_RESET_PUNT; }}int eata2x_old_reset(Scsi_Cmnd *SCarg, unsigned int reset_flags) { int rtn; IRQ_FLAGS IRQ_LOCK_SAVE rtn = do_old_reset(SCarg); IRQ_UNLOCK_RESTORE return rtn;}#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,101)static inline int do_reset(Scsi_Cmnd *SCarg) { unsigned int i, j, time, k, c, limit = 0; int arg_done = FALSE; Scsi_Cmnd *SCpnt; j = ((struct hostdata *) SCarg->host->hostdata)->board_number; printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid); if (SCarg->host_scribble == NULL) printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid); if (HD(j)->in_reset) { printk("%s: reset, exit, already in reset.\n", BN(j)); return FAILED; } if (wait_on_busy(sh[j]->io_port, MAXLOOP)) { printk("%s: reset, exit, timeout error.\n", BN(j)); return FAILED; } HD(j)->retries = 0; for (c = 0; c <= sh[j]->max_channel; c++) for (k = 0; k < sh[j]->max_id; k++) { HD(j)->target_redo[k][c] = TRUE; HD(j)->target_to[k][c] = 0; } for (i = 0; i < sh[j]->can_queue; i++) { if (HD(j)->cp_stat[i] == FREE) continue; if (HD(j)->cp_stat[i] == LOCKED) { HD(j)->cp_stat[i] = FREE; printk("%s: reset, locked mbox %d forced free.\n", BN(j), i); continue; } if (!(SCpnt = HD(j)->cp[i].SCpnt)) panic("%s: reset, mbox %d, SCpnt == NULL.\n", BN(j), i); if (HD(j)->cp_stat[i] == READY || HD(j)->cp_stat[i] == ABORTING) { HD(j)->cp_stat[i] = ABORTING; printk("%s: reset, mbox %d aborting, pid %ld.\n", BN(j), i, SCpnt->pid); } else { HD(j)->cp_stat[i] = IN_RESET; printk("%s: reset, mbox %d in reset, pid %ld.\n", BN(j), i, SCpnt->pid); } if (SCpnt->host_scribble == NULL) panic("%s: reset, mbox %d, garbled SCpnt.\n", BN(j), i); if (*(unsigned int *)SCpnt->host_scribble != i) panic("%s: reset, mbox %d, index mismatch.\n", BN(j), i); if (SCpnt->scsi_done == NULL) panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n", BN(j), i); if (SCpnt == SCarg) arg_done = TRUE; } if (do_dma(sh[j]->io_port, 0, RESET_PIO)) { printk("%s: reset, cannot reset, timeout error.\n", BN(j)); return FAILED; } printk("%s: reset, board reset done, enabling interrupts.\n", BN(j));#if defined(DEBUG_RESET) do_trace = TRUE;#endif HD(j)->in_reset = TRUE; SPIN_UNLOCK IRQ_UNLOCK time = jiffies; while ((jiffies - time) < (10 * HZ) && limit++ < 200000) udelay(100L); IRQ_LOCK SPIN_LOCK printk("%s: reset, interrupts disabled, loops %d.\n", BN(j), limit); for (i = 0; i < sh[j]->can_queue; i++) { if (HD(j)->cp_stat[i] == IN_RESET) { SCpnt = HD(j)->cp[i].SCpnt; SCpnt->result = DID_RESET << 16; SCpnt->host_scribble = NULL; /* This mailbox is still waiting for its interrupt */ HD(j)->cp_stat[i] = LOCKED; printk("%s, reset, mbox %d locked, DID_RESET, pid %ld done.\n", BN(j), i, SCpnt->pid); } else if (HD(j)->cp_stat[i] == ABORTING) { SCpnt = HD(j)->cp[i].SCpnt; SCpnt->result = DID_RESET << 16; SCpnt->host_scribble = NULL; /* This mailbox was never queued to the adapter */ HD(j)->cp_stat[i] = FREE; printk("%s, reset, mbox %d aborting, DID_RESET, pid %ld done.\n", BN(j), i, SCpnt->pid); } else /* Any other mailbox has already been set free by interrupt */ continue; SCpnt->scsi_done(SCpnt); IRQ_LOCK } HD(j)->in_reset = FALSE; do_trace = FALSE; if (arg_done) printk("%s: reset, exit, pid %ld done.\n", BN(j), SCarg->pid); else printk("%s: reset, exit.\n", BN(j)); return SUCCESS;}int eata2x_reset(Scsi_Cmnd *SCarg) { return do_reset(SCarg);}#endif /* new_eh_code */int eata2x_biosparam(Disk *disk, kdev_t dev, int *dkinfo) { int size = disk->capacity; if (ext_tran || (scsicam_bios_param(disk, dev, dkinfo) < 0)) { dkinfo[0] = 255; dkinfo[1] = 63; dkinfo[2] = size / (dkinfo[0] * dkinfo[1]); }#if defined (DEBUG_GEOMETRY) printk ("%s: biosparam, head=%d, sec=%d, cyl=%d.\n", driver_name, dkinfo[0], dkinfo[1], dkinfo[2]);#endif return FALSE;}static void sort(unsigned long sk[], unsigned int da[], unsigned int n, unsigned int rev) { unsigned int i, j, k, y; unsigned long x; for (i = 0; i < n - 1; i++) { k = i; for (j = k + 1; j < n; j++) if (rev) { if (sk[j] > sk[k]) k = j; } else { if (sk[j] < sk[k]) k = j; } if (k != i) { x = sk[k]; sk[k] = sk[i]; sk[i] = x; y = da[k]; da[k] = da[i]; da[i] = y; } } return; }static inline int reorder(unsigned int j, unsigned long cursec, unsigned int ihdlr, unsigned int il[], unsigned int n_ready) { Scsi_Cmnd *SCpnt; struct mscp *cpp; unsigned int k, n; unsigned int rev = FALSE, s = TRUE, r = TRUE; unsigned int input_o
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -