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

📄 ahc.c

📁 ml-rsim 多处理器模拟器 支持类bsd操作系统
💻 C
📖 第 1 页 / 共 5 页
字号:
	      ahc->intr_seq_lat_done = 0;	      ahc->intr_seq_clr_done = 0;#ifdef AHC_TRACE	      YS__logmsg(ahc->scsi_me->nodeid,		      "[%i] %.0f: Sequencer Interrupt\n",		      ahc->scsi_me->mid, YS__Simtime);#endif	    }	  regs[INTSTAT] |= BAD_STATUS;	  scb->target_status = SCSI_CHECK;	  memcpy(regs + SCBARRAY, scb, AHC_REG_END - SCBARRAY);	  ahc->seq_pause = 1;	  break;	default:	  YS__errmsg(ahc->scsi_me->nodeid,		     "AHC[%i]: Unknown SCSI Bus Reply %i\n",		     ahc->scsi_me->mid, scb->req->reply_type);	  break;	}    }  lat = YS__Simtime - scb->start_time;  if (lat > ahc->request_complete_time_max)    ahc->request_complete_time_max = lat;  if (lat < ahc->request_complete_time_min)    ahc->request_complete_time_min = lat;  ahc->request_complete_time_avg += lat;  if (scb->status == SCB_BUSY)    {      ahc_queue_shiftin_head(ahc->qin_fifo, ahc->seq_scb);      ahc->regs[QINCNT] = ahc_queue_size(ahc->qin_fifo);    }  else    {      if (scb->queue_time > ahc->request_queue_time_max)	ahc->request_queue_time_max = scb->queue_time;      if (scb->queue_time < ahc->request_queue_time_min)	ahc->request_queue_time_min = scb->queue_time;      ahc->request_queue_time_avg += scb->queue_time;    }    if (scb->dma_segments != NULL)    free(scb->dma_segments);  scb->dma_segments = NULL;  if (scb->data != NULL)    free(scb->data);  scb->data = NULL;  scb->status = SCB_INACTIVE;  if (!(scb->control & TAG_ENB) &&      (ahc->pending[scb->tcl >> 4] == scb))    ahc->pending[scb->tcl >> 4] = NULL;  YS__PoolReturnObj(&YS__ScsiReqPool, scb->req);  scb->req = NULL;  return(0);}/*=========================================================================*//* Print configuration of an Adaptec SCSI controller.                      *//*=========================================================================*/void ahc_print_params(void *controller){  ahc_t *ahc = (ahc_t*)controller;  int nid    = ahc->scsi_me->scsi_bus->node_id;  YS__statmsg(nid, "Adaptec SCSI Controller Configuration\n");  YS__statmsg(nid, "  Number of SCBs: %i\n", ahc->max_scbs);  YS__statmsg(nid, "\n");}/*=========================================================================*//* Report statistics for an Adaptec SCSI controller.                       *//*=========================================================================*/void ahc_stat_report(void *controller){  ahc_t *ahc = (ahc_t*)controller;  int nid    = ahc->scsi_me->scsi_bus->node_id;  if (ahc->intr_seq_count > 0)    {      ahc->intr_seq_lat_avg /= ahc->intr_seq_count;      ahc->intr_seq_clr_avg /= ahc->intr_seq_count;      YS__statmsg(nid, "    Sequencer Interrupt:\n");      YS__statmsg(nid, "      %i Interrupts\n", ahc->intr_cmpl_count);      YS__statmsg(nid, "      Interrupt handler latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_seq_lat_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_seq_lat_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_seq_lat_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");      YS__statmsg(nid, "      Interrupt clear latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_seq_clr_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_seq_clr_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_seq_clr_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");    }  if (ahc->intr_cmpl_count > 0)    {      ahc->intr_cmpl_lat_avg /= ahc->intr_cmpl_count;      ahc->intr_cmpl_clr_avg /= ahc->intr_cmpl_count;      YS__statmsg(nid, "    Command Complete Interrupt:\n");      YS__statmsg(nid, "      %i Interrupts\n", ahc->intr_cmpl_count);      YS__statmsg(nid, "      Interrupt handler latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_cmpl_lat_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_cmpl_lat_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_cmpl_lat_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");      YS__statmsg(nid, "      Interrupt clear latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_cmpl_clr_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_cmpl_clr_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_cmpl_clr_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");    }  if (ahc->intr_scsi_count > 0)    {      ahc->intr_scsi_lat_avg /= ahc->intr_scsi_count;      ahc->intr_scsi_clr_avg /= ahc->intr_scsi_count;      YS__statmsg(nid, "    SCSI Interrupt:\n");      YS__statmsg(nid, "      %i Interrupts\n", ahc->intr_scsi_count);      YS__statmsg(nid, "      Interrupt handler latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_scsi_lat_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_scsi_lat_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_scsi_lat_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");      YS__statmsg(nid, "      Interrupt clear latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->intr_scsi_clr_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->intr_scsi_clr_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->intr_scsi_clr_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");    }  YS__statmsg(nid, "\n");  if (ahc->request_count > 0)    {      ahc->request_queue_time_avg    /= ahc->request_count;      ahc->request_connect_time_avg  /= ahc->request_count;      ahc->request_complete_time_avg /= ahc->request_count;            YS__statmsg(nid,	      "    %i Requests;  %i disconnected;  %i completed\n",	      ahc->request_count,	      ahc->request_disconnect_count,	      ahc->request_complete_count);      YS__statmsg(nid, "      Input Queue Latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->request_queue_time_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->request_queue_time_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->request_queue_time_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");      YS__statmsg(nid, "      Initial Connect Latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->request_connect_time_min * (double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->request_connect_time_avg * (double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->request_connect_time_max * (double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");      YS__statmsg(nid, "      Completion Latency:\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->request_complete_time_min*(double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->request_complete_time_avg*(double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->request_complete_time_max*(double)CPU_CLK_PERIOD/1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");    }  if (ahc->request_complete_count > 0)    {      ahc->request_total_time_avg /= ahc->request_complete_count;            YS__statmsg(nid,	      "      Total Latency (including output queue time):\n");      YS__statmsg(nid, "          Min: ");      PrintTime(ahc->request_total_time_min * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Avg: ");      PrintTime(ahc->request_total_time_avg * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, ";  Max: ");      PrintTime(ahc->request_total_time_max * (double)CPU_CLK_PERIOD / 1.0e12,		statfile[nid]);      YS__statmsg(nid, "\n");    }        YS__statmsg(nid, "\n");}/*=========================================================================*//* Clear statistics for one Adaptec SCSI controller.                       *//*=========================================================================*/void ahc_stat_clear(void *controller){  ahc_t *ahc = (ahc_t*)controller;  ahc->intr_seq_count     = 0;  ahc->intr_seq_start     = 0.0;  ahc->intr_seq_lat_done  = 1;  ahc->intr_seq_lat_max   = 0.0;  ahc->intr_seq_lat_avg   = 0.0;  ahc->intr_seq_lat_min   = MAXDOUBLE;  ahc->intr_seq_clr_done  = 1;  ahc->intr_seq_clr_max   = 0.0;  ahc->intr_seq_clr_avg   = 0.0;  ahc->intr_seq_clr_min   = MAXDOUBLE;    ahc->intr_cmpl_count    = 0;  ahc->intr_cmpl_start    = 0.0;  ahc->intr_cmpl_lat_done = 1;  ahc->intr_cmpl_lat_max  = 0.0;  ahc->intr_cmpl_lat_avg  = 0.0;  ahc->intr_cmpl_lat_min  = MAXDOUBLE;  ahc->intr_cmpl_clr_done = 1;  ahc->intr_cmpl_clr_max  = 0.0;  ahc->intr_cmpl_clr_avg  = 0.0;  ahc->intr_cmpl_clr_min  = MAXDOUBLE;    ahc->intr_scsi_count    = 0;  ahc->intr_scsi_start    = 0.0;  ahc->intr_scsi_lat_done = 1;  ahc->intr_scsi_lat_max  = 0.0;  ahc->intr_scsi_lat_avg  = 0.0;  ahc->intr_scsi_lat_min  = MAXDOUBLE;  ahc->intr_scsi_clr_done = 1;  ahc->intr_scsi_clr_max  = 0.0;  ahc->intr_scsi_clr_avg  = 0.0;  ahc->intr_scsi_clr_min  = MAXDOUBLE;  ahc->request_count             = 0;  ahc->request_disconnect_count  = 0;  ahc->request_complete_count    = 0;  ahc->request_queue_time_max    = 0.0;  ahc->request_queue_time_avg    = 0.0;  ahc->request_queue_time_min    = MAXDOUBLE;  ahc->request_connect_time_max  = 0.0;  ahc->request_connect_time_avg  = 0.0;  ahc->request_connect_time_min  = MAXDOUBLE;  ahc->request_complete_time_max = 0.0;  ahc->request_complete_time_avg = 0.0;  ahc->request_complete_time_min = MAXDOUBLE;  ahc->request_total_time_max    = 0.0;  ahc->request_total_time_avg    = 0.0;  ahc->request_total_time_min    = MAXDOUBLE;}/*=========================================================================*//* Dump debug information about AHC controller                             *//*=========================================================================*/void AHC_dmaseg_dump(ahc_dmaseg_t *seg, int nid){  YS__logmsg(nid, "    addr(0x%02x%02x%02x%02x), length(0x%02x%02x%02x%02x)\n",	     seg->addr3, seg->addr2, seg->addr1, seg->addr0,	     seg->length3, seg->length2, seg->length1, seg->length0);}void AHC_scb_dump(ahc_scb_t *scb, int nid){  int n;    YS__logmsg(nid, "  control(0x%02x),  tcl(0x%02x)\n",	     scb->control, scb->tcl);  YS__logmsg(nid, "  target_status(0x%02x),  sg_segment_count(%d)\n",	     scb->target_status, scb->sg_segment_count);  YS__logmsg(nid, "  sg_segment_ptr(0x%02x%02x%02x%02x)\n",	     scb->sg_segment_ptr3, scb->sg_segment_ptr2,	     scb->sg_segment_ptr1, scb->sg_segment_ptr0);    if (scb->dma_segments)    for (n = 0; n < scb->sg_segment_count; n++)      AHC_dmaseg_dump(&(scb->dma_segments[n]), nid);    YS__logmsg(nid,	     "  res_sg_segment_count(%d), res_data_count(0x%02x%02x%02x)\n",	     scb->res_sg_segment_count, scb->res_data_count2,	     scb->res_data_count1, scb->res_data_count0);  YS__logmsg(nid, "  data_ptr(0x%02x%02x%02x%02x)\n",	     scb->data_ptr3, scb->data_ptr2, scb->data_ptr1, scb->data_ptr0);  YS__logmsg(nid, "  data_count(0x%02x%02x%02x)\n",	     scb->data_count2, scb->data_count1, scb->data_count0);  YS__logmsg(nid, "  scsi_cmd_ptr(0x%02x%02x%02x%02x)\n",	     scb->scsi_cmd_ptr3, scb->scsi_cmd_ptr2,	     scb->scsi_cmd_ptr1, scb->scsi_cmd_ptr0);  YS__logmsg(nid, "  scsi_cmd_len(%d), tag(0x%02x), next(%d), prev(%d)\n",	     scb->scsi_cmd_len, scb->tag, scb->next, scb->prev);  YS__logmsg(nid, "  command(0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x)\n",	     scb->command[0],  scb->command[1],	     scb->command[2],  scb->command[3],	     scb->command[4],  scb->command[5],	     scb->command[6],  scb->command[7],	     scb->command[8],  scb->command[9],	     scb->command[10], scb->command[11],	     scb->command[12], scb->command[13],	     scb->command[14], scb->command[15]);  YS__logmsg(nid, "  write(%d), dma_addr(0x%x), dma_length(0x%x)\n",	     scb->write, scb->dma_addr, scb->dma_length);  YS__logmsg(nid, "  dma_sg_length(0x%x), dma_length_done(0x%x)\n",	     scb->dma_sg_length, scb->dma_length_done);}void ahc_dump(void *controller){  ahc_t *ahc = (ahc_t*)controller;  int nid    = ahc->scsi_me->scsi_bus->node_id;  int n;  YS__logmsg(nid, "\n============== AHC SCSI CONTROLLER ================\n");  YS__logmsg(nid, "seq_state(%d), sequencer scheduled: %s\n",	     ahc->seq_state, IsScheduled(ahc->sequencer) ? "yes" : "no");  for (n = 0; n < ahc->max_scbs; n++)    {      YS__logmsg(nid, "scb[%i]\n", n);      AHC_scb_dump(&(ahc->scbs[n]), nid);    }  YS__logmsg(nid, "qin_fifo size(%d)\n", ahc->qin_fifo.size);  for (n = ahc->qin_fifo.head; n != ahc->qin_fifo.tail; n = (n +1) & 0xff)    YS__logmsg(nid, "  %d ", ahc->qin_fifo.elements[n]);  YS__logmsg(nid, "\nqout_fifo size(%d)\n", ahc->qout_fifo.size);  for (n = ahc->qout_fifo.head; n != ahc->qout_fifo.tail; n = (n +1) & 0xff)    YS__logmsg(nid, "  %d ", ahc->qout_fifo.elements[n]);  YS__logmsg(nid, "\nreconnect_scbs size(%d)\n", ahc->reconnect_scbs.size);  for (n = ahc->reconnect_scbs.head;       n != ahc->reconnect_scbs.tail;       n = (n +1) & 0xff)    YS__logmsg(nid, "  %d ", ahc->reconnect_scbs.elements[n]);  YS__logmsg(nid, "\n");    for (n = 0; n < SCSI_WIDTH*8; n++)    {      if (ahc->pending[n] == NULL)	continue;      YS__logmsg(nid, "pend

⌨️ 快捷键说明

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