⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u14-34f.c

📁 GNU Mach 微内核源代码, 基于美国卡内基美隆大学的 Mach 研究项目
💻 C
📖 第 1 页 / 共 5 页
字号:
   IRQ_LOCK_SAVE   rtn = do_old_abort(SCarg);   IRQ_UNLOCK_RESTORE   return rtn;}#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,101)static inline int do_abort(Scsi_Cmnd *SCarg) {   unsigned int i, j;   j = ((struct hostdata *) SCarg->host->hostdata)->board_number;   if (SCarg->host_scribble == NULL) {      printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",             BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);      return SUCCESS;      }   i = *(unsigned int *)SCarg->host_scribble;   printk("%s: abort, mbox %d, target %d.%d:%d, pid %ld.\n",          BN(j), i, SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);   if (i >= sh[j]->can_queue)      panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {      printk("%s: abort, timeout error.\n", BN(j));      return FAILED;      }   if (HD(j)->cp_stat[i] == FREE) {      printk("%s: abort, mbox %d is free.\n", BN(j), i);      return SUCCESS;      }   if (HD(j)->cp_stat[i] == IN_USE) {      printk("%s: abort, mbox %d is in use.\n", BN(j), i);      if (SCarg != HD(j)->cp[i].SCpnt)         panic("%s: abort, mbox %d, SCarg %p, cp SCpnt %p.\n",               BN(j), i, SCarg, HD(j)->cp[i].SCpnt);      if (inb(sh[j]->io_port + REG_SYS_INTR) & 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 u14_34f_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 (wait_on_busy(sh[j]->io_port, MAXLOOP)) {      printk("%s: reset, cannot reset, timeout error.\n", BN(j));      return SCSI_RESET_ERROR;      }   outb(CMD_RESET, sh[j]->io_port + REG_LCL_INTR);   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 u14_34f_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 (wait_on_busy(sh[j]->io_port, MAXLOOP)) {      printk("%s: reset, cannot reset, timeout error.\n", BN(j));      return FAILED;      }   outb(CMD_RESET, sh[j]->io_port + REG_LCL_INTR);   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 u14_34f_reset(Scsi_Cmnd *SCarg) {   return do_reset(SCarg);}#endif /* new_eh_code */int u14_34f_biosparam(Disk *disk, kdev_t dev, int *dkinfo) {   unsigned int j = 0;   int size = disk->capacity;   dkinfo[0] = HD(j)->heads;   dkinfo[1] = HD(j)->sectors;   dkinfo[2] = size / (HD(j)->heads * HD(j)->sectors);   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)

⌨️ 快捷键说明

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