亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ncr5380.c

?? 內核是系統的心臟
?? C
?? 第 1 頁 / 共 5 頁
字號:
#endif

    /* 
     * The SCSI specification calls for a 250 ms timeout for the actual 
     * selection.
     */

    timeout = jiffies + 25; 

    /* 
     * XXX very interesting - we're seeing a bounce where the BSY we 
     * asserted is being reflected / still asserted (propogation delay?)
     * and it's detecting as true.  Sigh.
     */

    while ((jiffies < timeout) && !(NCR5380_read(STATUS_REG) & SR_BSY));

    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);

    if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
	cmd->result = DID_BAD_TARGET << 16;
	cmd->scsi_done(cmd);
	NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
#if (NDEBUG & NDEBUG_SELECTION)
	printk("scsi%d : target did not respond within 250ms\n", 
	    instance->host_no);
#endif
	return 0;
    } 

    /*
     * Since we followed the SCSI spec, and raised ATN while SEL 
     * was true but before BSY was false during selection, the information
     * transfer phase should be a MESSAGE OUT phase so that we can send the
     * IDENTIFY message.
     * 
     * If SCSI-II tagged queing is enabled, we also send a SIMPLE_QUEUE_TAG
     * message (2 bytes) with a tag ID that we increment with every command
     * until it wraps back to 0.
     *
     * XXX - it turns out that there are some broken SCSI-II devices,
     *	     which claim to support tagged queing but fail when more than
     *	     some number of commands are issued at once.
     */

    /* Wait for start of REQ/ACK handshake */
    while (!(NCR5380_read(STATUS_REG) & SR_REQ));

#if (NDEBUG & NDEBUG_SELECTION)
    printk("scsi%d : target %d selected, going into MESSAGE OUT phase.\n",
	instance->host_no, cmd->target);
#endif
    tmp[0] = IDENTIFY(((instance->irq == IRQ_NONE) ? 0 : 1), cmd->lun);
#ifdef SCSI2
    if (scsi_devices[cmd->index].tagged_queue && (tag != TAG_NONE)) {
	tmp[1] = SIMPLE_QUEUE_TAG;
	if (tag == TAG_NEXT) {
	    /* 0 is TAG_NONE, used to imply no tag for this command */
	    if (scsi_devices[cmd->index].current_tag == 0)
		scsi_devices[cmd->index].current_tag = 1;

	    cmd->tag = scsi_devices[cmd->index].current_tag;
	    scsi_devices[cmd->index].current_tag++;
	} else  
	    cmd->tag = (unsigned char) tag;

	tmp[2] = cmd->tag;
	hostdata->last_message = SIMPLE_QUEUE_TAG;
	len = 3;
    } else 
#endif /* def SCSI2 */
    {
	len = 1;
	cmd->tag=0;
    }

    /* Send message(s) */
    data = tmp;
    phase = PHASE_MSGOUT;
    NCR5380_transfer_pio(instance, &phase, &len, &data);
#if (NDEBUG & NDEBUG_SELECTION)
    printk("scsi%d : nexus established.\n", instance->host_no);
#endif
    /* XXX need to handle errors here */
    hostdata->connected = cmd;
#ifdef SCSI2
    if (!scsi_devices[cmd->index].tagged_queue)
#endif    
	hostdata->busy[cmd->target] |= (1 << cmd->lun);

    initialize_SCp(cmd);

    return 0;
}

/* 
 * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, 
 *      unsigned char *phase, int *count, unsigned char **data)
 *
 * Purpose : transfers data in given phase using polled I/O
 *
 * Inputs : instance - instance of driver, *phase - pointer to 
 *	what phase is expected, *count - pointer to number of 
 *	bytes to transfer, **data - pointer to data pointer.
 * 
 * Returns : -1 when different phase is enterred without transfering
 *	maximum number of bytes, 0 if all bytes or transfered or exit
 *	is in same phase.
 *
 * 	Also, *phase, *count, *data are modified in place.
 *
 * XXX Note : handling for bus free may be useful.
 */

/*
 * Note : this code is not as quick as it could be, however it 
 * IS 100% reliable, and for the actual data transfer where speed
 * counts, we will always do a pseudo DMA or DMA transfer.
 */

static int NCR5380_transfer_pio (struct Scsi_Host *instance, 
	unsigned char *phase, int *count, unsigned char **data) {
    NCR5380_local_declare();
    register unsigned char p = *phase, tmp;
    register int c = *count;
    register unsigned char *d = *data;
    NCR5380_setup(instance);

    /* 
     * The NCR5380 chip will only drive the SCSI bus when the 
     * phase specified in the appropriate bits of the TARGET COMMAND
     * REGISTER match the STATUS REGISTER
     */

    NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));

    do {
	/* 
	 * Wait for assertion of REQ, after which the phase bits will be 
	 * valid 
	 */
	while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ));

#if (NDEBUG & NDEBUG_HANDSHAKE)
	printk("scsi%d : REQ detected\n", instance->host_no);
#endif

	/* Check for phase mismatch */	
	if ((tmp & PHASE_MASK) != p) {
#if (NDEBUG & NDEBUG_PIO)
	    printk("scsi%d : phase mismatch\n", instance->host_no);
	    NCR5380_print_phase(instance);
#endif
	    break;
	}

	/* Do actual transfer from SCSI bus to / from memory */
	if (!(p & SR_IO)) 
	    NCR5380_write(OUTPUT_DATA_REG, *d);
	else 
	    *d = NCR5380_read(CURRENT_SCSI_DATA_REG);

	++d;

	/* 
	 * The SCSI standard suggests that in MSGOUT phase, the initiator
	 * should drop ATN on the last byte of the message phase
	 * after REQ has been asserted for the handshake but before
	 * the initiator raises ACK.
	 */

	if (!(p & SR_IO)) {
	    if (!((p & SR_MSG) && c > 1)) {
		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
		    ICR_ASSERT_DATA);
#if (NDEBUG & NDEBUG_PIO)
	NCR5380_print(instance);
#endif
		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
			ICR_ASSERT_DATA | ICR_ASSERT_ACK);
	    } else {
		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
		    ICR_ASSERT_DATA | ICR_ASSERT_ATN);
#if (NDEBUG & NDEBUG_PIO)
	NCR5380_print(instance);
#endif
		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
		    ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
	    }
	} else {
#if (NDEBUG & NDEBUG_PIO)
	NCR5380_print(instance);
#endif
	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
	}

	while (NCR5380_read(STATUS_REG) & SR_REQ);

#if (NDEBUG & NDEBUG_HANDSHAKE)
	    printk("scsi%d : req false, handshake complete\n", instance->host_no);
#endif

	if (!(p == PHASE_MSGOUT && c > 1))
	    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
	else
	    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
    } while (--c);

#if (NDEBUG & NDEBUG_PIO) 
    printk("scsi%d : residual %d\n", instance->host_no, c);
#endif

    *count = c;
    *data = d;
    tmp = NCR5380_read(STATUS_REG);
    if (tmp & SR_REQ)
	*phase = tmp & PHASE_MASK;
    else 
	*phase = PHASE_UNKNOWN;

    if (!c || (*phase == p))
	return 0;
    else 
	return -1;
}

#if defined(REAL_DMA) || defined(PSEUDO_DMA) || defined (REAL_DMA_POLL)
/* 
 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, 
 *      unsigned char *phase, int *count, unsigned char **data)
 *
 * Purpose : transfers data in given phase using either real
 *	or pseudo DMA.
 *
 * Inputs : instance - instance of driver, *phase - pointer to 
 *	what phase is expected, *count - pointer to number of 
 *	bytes to transfer, **data - pointer to data pointer.
 * 
 * Returns : -1 when different phase is enterred without transfering
 *	maximum number of bytes, 0 if all bytes or transfered or exit
 *	is in same phase.
 *
 * 	Also, *phase, *count, *data are modified in place.
 *
 */


static int NCR5380_transfer_dma (struct Scsi_Host *instance, 
    unsigned char *phase, int *count, unsigned char **data) {
    NCR5380_local_declare();
    register int c = *count;
    register unsigned char p = *phase;
    register unsigned char *d = *data;
    unsigned char tmp;
    int foo;
#if defined(REAL_DMA_POLL)
    int cnt, toPIO;
    unsigned char saved_data = 0, overrun = 0, residue;
#endif

    struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
	instance->hostdata;

    NCR5380_setup(instance);

    if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) {
        *phase = tmp;
        return -1;
    }
#if defined(REAL_DMA) || defined(REAL_DMA_POLL) 
#ifdef READ_OVERRUNS
     if (p & SR_IO) {
       c -= 2;
     }
#endif
#if (NDEBUG & NDEBUG_DMA)
    printk("scsi%d : initializing DMA channel %d for %s, %d bytes %s %0x\n",
	instance->host_no, instance->dma_channel, (p & SR_IO) ? "reading" :
	"writing", c, (p & SR_IO) ? "to" : "from", (unsigned) d);
#endif
    hostdata->dma_len = (p & SR_IO) ?
	NCR5380_dma_read_setup(instance, d, c) : 
	NCR5380_dma_write_setup(instance, d, c);
#endif

    NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));

#ifdef REAL_DMA
    NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY);
#elif defined(REAL_DMA_POLL)
    NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
#else
    /*
     * Note : on my sample board, watch-dog timeouts occured when interrupts
     * were not disabled for the duration of a single DMA transfer, from 
     * before the setting of DMA mode to after transfer of the last byte.
     */

#if defined(PSEUDO_DMA) && !defined(UNSAFE)
    cli();
#endif
    NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
#endif /* def REAL_DMA */

#if (NDEBUG & NDEBUG_DMA) & 0
    printk("scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG));
#endif

    if (p & SR_IO)
	NCR5380_write(START_DMA_INITIATOR_RECIEVE_REG, 0);
    else {
	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
	NCR5380_write(START_DMA_SEND_REG, 0);
    }

#if defined(REAL_DMA_POLL)
    do {
	tmp = NCR5380_read(BUS_AND_STATUS_REG);
    } while ((tmp & BASR_PHASE_MATCH) && !(tmp & (BASR_BUSY_ERROR | 
	BASR_END_DMA_TRANSFER)));

/*
  At this point, either we've completed DMA, or we have a phase mismatch,
  or we've unexpectedly lost BUSY (which is a real error).

  For write DMAs, we want to wait until the last byte has been
  transferred out over the bus before we turn off DMA mode.  Alas, there
  seems to be no terribly good way of doing this on a 5380 under all
  conditions.  For non-scatter-gather operations, we can wait until REQ
  and ACK both go false, or until a phase mismatch occurs.  Gather-writes
  are nastier, since the device will be expecting more data than we
  are prepared to send it, and REQ will remain asserted.  On a 53C8[01] we
  could test LAST BIT SENT to assure transfer (I imagine this is precisely
  why this signal was added to the newer chips) but on the older 538[01]
  this signal does not exist.  The workaround for this lack is a watchdog;
  we bail out of the wait-loop after a modest amount of wait-time if
  the usual exit conditions are not met.  Not a terribly clean or
  correct solution :-%

  Reads are equally tricky due to a nasty characteristic of the NCR5380.
  If the chip is in DMA mode for an READ, it will respond to a target's
  REQ by latching the SCSI data into the INPUT DATA register and asserting
  ACK, even if it has _already_ been notified by the DMA controller that
  the current DMA transfer has completed!  If the NCR5380 is then taken
  out of DMA mode, this already-acknowledged byte is lost.

  This is not a problem for "one DMA transfer per command" reads, because
  the situation will never arise... either all of the data is DMA'ed
  properly, or the target switches to MESSAGE IN phase to signal a
  disconnection (either operation bringing the DMA to a clean halt).
  However, in order to handle scatter-reads, we must work around the
  problem.  The chosen fix is to DMA N-2 bytes, then check for the
  condition before taking the NCR5380 out of DMA mode.  One or two extra
  bytes are tranferred via PIO as necessary to fill out the original
  request.
*/

    if (p & SR_IO) {
#ifdef READ_OVERRUNS
      udelay(10);
      if (((NCR5380_read(BUS_AND_STATUS_REG) & (BASR_PHASE_MATCH|BASR_ACK)) ==
           (BASR_PHASE_MATCH | BASR_ACK))) {
        saved_data = NCR5380_read(INPUT_DATA_REGISTER);
        overrun = 1;
      }
#endif
    } else {
      int limit = 100;
      while (((tmp = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_ACK) ||
            (NCR5380_read(STATUS_REG) & SR_REQ)) {
        if (!(tmp & BASR_PHASE_MATCH)) break;
        if (--limit < 0) break;
      }
    }


#if (NDEBUG & NDEBUG_DMA)
    printk("scsi%d : polled DMA transfer complete, basr 0x%X, sr 0x%X\n",
	   instance->host_no, tmp, NCR5380_read(STATUS_REG));
#endif

    NCR5380_write(MODE_REG, MR_BASE);
    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);

    residue = NCR5380_dma_residual(instance);
    c -= residue;
    *count -= c;
    *data += c;
    *phase = NCR5380_read(STATUS_REG) & PHASE_MASK;

#ifdef READ_OVERRUNS
    if (*phase == p && (p & SR_IO) && residue == 0) {
      if (overrun) {
#if (NDEBUG & NDEBUG_DMA)
        printk("Got an input overrun, using saved byte\n");
#endif
        **data = saved_data;
        *data += 1;
        *count -= 1;
        cnt = toPIO = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品资源在线看| 欧美一区二区三区爱爱| 懂色av中文字幕一区二区三区| 精品一区二区三区免费毛片爱| 日韩制服丝袜av| 日韩高清在线一区| 欧美a级理论片| 免费欧美日韩国产三级电影| 日本va欧美va精品发布| 精品亚洲免费视频| 国产一区 二区| 国产91丝袜在线18| 国产成人午夜精品影院观看视频 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 精品视频在线看| 在线播放中文字幕一区| 日韩视频一区二区三区在线播放 | 亚洲与欧洲av电影| 天天综合网天天综合色| 免费高清视频精品| 国产一区二区三区四| 不卡欧美aaaaa| 91天堂素人约啪| 欧美亚男人的天堂| 欧美成人精品福利| 日本一区二区在线不卡| 亚洲色图20p| 午夜精品免费在线| 国产一区二区三区国产| 91在线观看一区二区| 欧美精品黑人性xxxx| 2020国产成人综合网| 亚洲欧美一区二区三区极速播放| 亚洲综合精品自拍| 久久99国产精品久久| 99久久免费视频.com| 欧美人妇做爰xxxⅹ性高电影| 欧美日韩国产天堂| xnxx国产精品| 亚洲激情中文1区| 日本网站在线观看一区二区三区 | 欧美剧情片在线观看| 337p粉嫩大胆噜噜噜噜噜91av | 成人一区二区三区在线观看| 91啪九色porn原创视频在线观看| 欧美精品丝袜中出| 国产女主播在线一区二区| 亚洲一区二区三区自拍| 激情成人综合网| 欧美中文字幕一区| 久久久久久久综合色一本| 亚洲黄色性网站| 精品无人码麻豆乱码1区2区| 欧洲日韩一区二区三区| 精品少妇一区二区三区免费观看| 亚洲色图色小说| 国产伦精品一区二区三区免费迷| 色爱区综合激月婷婷| 久久久国际精品| 天天色综合天天| 99re这里只有精品6| 精品国产91久久久久久久妲己 | 国产成人av一区二区三区在线观看| 色8久久人人97超碰香蕉987| 久久精品人人做人人综合| 日韩—二三区免费观看av| 91精选在线观看| 国产精品久久久久久亚洲毛片| 美女久久久精品| 欧美在线影院一区二区| 亚洲国产经典视频| 经典三级视频一区| 欧美一二三四在线| 亚洲成人免费影院| 99re热视频这里只精品| 久久精品夜夜夜夜久久| 久久av资源网| 91精品国产色综合久久不卡蜜臀 | 国产精品色呦呦| 久久se这里有精品| 欧美精品在线一区二区三区| 亚洲三级理论片| 国产高清精品久久久久| 欧美一区二区日韩| 石原莉奈在线亚洲三区| 欧美三级乱人伦电影| 亚洲免费观看高清完整版在线观看 | 国产精品人妖ts系列视频| 免费在线观看日韩欧美| caoporn国产精品| 国产亚洲va综合人人澡精品| 蜜桃一区二区三区在线观看| 欧美狂野另类xxxxoooo| 亚洲图片欧美色图| 欧美视频一区在线| 亚洲精品国产无天堂网2021 | 日韩免费看网站| 青娱乐精品视频| 欧美一区二区免费| 麻豆国产欧美一区二区三区| 日韩一区二区三区四区| 日本伊人精品一区二区三区观看方式 | 欧美日本在线视频| 五月激情综合色| 欧美午夜一区二区| 亚洲成a人在线观看| 欧美精品第1页| 日韩激情视频网站| 精品少妇一区二区三区| 免费欧美在线视频| 精品国产91久久久久久久妲己| 国产综合久久久久久久久久久久 | 国产在线精品一区二区夜色| 欧美岛国在线观看| 国产精品12区| 最新国产成人在线观看| 91久久精品一区二区三| 亚洲综合色婷婷| 欧美精品乱码久久久久久按摩| 亚洲777理论| 精品久久久影院| 韩国毛片一区二区三区| 国产精品你懂的在线欣赏| 99re8在线精品视频免费播放| 久久精品国产精品亚洲综合| 久久―日本道色综合久久| 国产91清纯白嫩初高中在线观看| 自拍偷拍欧美精品| 欧亚洲嫩模精品一区三区| 日韩不卡免费视频| 久久久夜色精品亚洲| av电影天堂一区二区在线| 夜夜嗨av一区二区三区| 日韩一区二区三区av| 丁香桃色午夜亚洲一区二区三区| 中文字幕在线不卡视频| 精品视频1区2区| 精品在线观看视频| 亚洲欧美另类在线| 欧美一级精品大片| 成人黄色a**站在线观看| 亚洲第一精品在线| 久久精品一区八戒影视| 欧美综合天天夜夜久久| 九色|91porny| 亚洲欧洲精品一区二区三区不卡| 精品视频一区三区九区| 国产成人在线网站| 亚洲午夜久久久久久久久电影网| 精品99999| 欧美优质美女网站| 欧美日韩和欧美的一区二区| 免费欧美日韩国产三级电影| 久久精品视频一区二区| 91麻豆免费观看| 久久国产欧美日韩精品| 中文字幕一区不卡| 欧美一区二区三区的| 在线观看www91| 国内精品在线播放| 亚洲美女电影在线| 日韩欧美一区中文| 91麻豆国产自产在线观看| 精彩视频一区二区| 亚洲国产美女搞黄色| 国产精品三级电影| 欧美一级片在线| 日本大香伊一区二区三区| 国产成人综合视频| 免费在线观看不卡| 亚洲国产中文字幕在线视频综合| 国产女主播一区| 精品免费99久久| 欧美日韩在线播放一区| 国产精品一二三| 久久国产麻豆精品| 日日夜夜精品视频天天综合网| 中文字幕亚洲不卡| 国产日韩精品久久久| 日韩一级欧美一级| 在线播放欧美女士性生活| 91老师片黄在线观看| 国产精品系列在线观看| 伦理电影国产精品| 亚洲国产欧美在线人成| 亚洲精品成人天堂一二三| 国产欧美视频一区二区| 精品嫩草影院久久| 91精品国产综合久久久久| 欧美在线小视频| 色综合久久久网| 99国产欧美另类久久久精品| 国产成人av电影在线播放| 久久精品国产成人一区二区三区| 亚洲香肠在线观看| 亚洲天堂免费在线观看视频| 国产精品国产精品国产专区不片| 国产视频在线观看一区二区三区 | 欧美精三区欧美精三区| 欧美视频一区在线观看|