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

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

?? ncr5380.c

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

    /* 
     * Insert the cmd into the issue queue. Note that REQUEST SENSE 
     * commands are added to the head of the queue since any command will
     * clear the contingent allegience condition that exists and the 
     * sense data is only guranteed to be valid while the condition exists.
     */

    cli();
    if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
	cmd->host_scribble = (unsigned char *) hostdata->issue_queue;
	hostdata->issue_queue = cmd;
    } else {
	for (tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp->host_scribble; 
		tmp = (Scsi_Cmnd *) tmp->host_scribble);
	tmp->host_scribble = (unsigned char *) cmd;
    }
#if (NDEBUG & NDEBUG_QUEUES)
    printk("scsi%d : command added to %s of queue\n", instance->host_no,
	(cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
#endif

/* Run the coroutine if it isn't allready running. */
    run_main();
    return 0;
}

/*
 * Function : NCR5380_main (void) 
 *
 * Purpose : NCR5380_main is a corroutine that runs as long as more work can 
 *	be done on the NCR5380 host adapters in a system.  Both 
 *	NCR5380_queue_command() and NCR5380_intr() will try to start it 
 *	in case it is not running.
 * 
 * NOTE : NCR5380_main exits with interrupts *disabled*, the caller should 
 *  reenable them.  This prevents rentrancy and kernel stack overflow.
 */ 	
    
static void NCR5380_main (void) {
    Scsi_Cmnd *tmp, *prev;
    struct Scsi_Host *instance;
    struct NCR5380_hostdata *hostdata;
    int done;

    /*
     * We run (with interrupts disabled) until we're sure that none of 
     * the host adapters have anything that can be done, at which point 
     * we set main_running to 0 and exit.
     *
     * Interrupts are enabled before doing various other internal 
     * instructions, after we've decided that we need to run through
     * the loop again.
     *
     * this should prevent any race conditions.
     */

    do {
	cli(); /* Freeze request queues */
	done = 1;
	for (instance = first_instance; instance && instance->hostt == the_template; 
	    instance=instance->next) {
	    hostdata = (struct NCR5380_hostdata *) instance->hostdata;
	    cli();
	    if (!hostdata->connected) {
#if (NDEBUG & NDEBUG_MAIN)
		printk("scsi%d : not connected\n", instance->host_no);
#endif
		/*
		 * Search through the issue_queue for a command destined
		 * for a target that's not busy.
		 */
		for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, 
		    prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) 
		    tmp->host_scribble) 

		    /*  When we find one, remove it from the issue queue. */
		    if (!(hostdata->busy[tmp->target] & (1 << tmp->lun))) {
			    if (prev)
				prev->host_scribble = tmp->host_scribble;
			    else
				hostdata->issue_queue = (Scsi_Cmnd *) tmp->host_scribble;
			tmp->host_scribble = NULL;

			/* renable interrupts after finding one */
			sti();

			/* 
			 * Attempt to establish an I_T_L nexus here. 
			 * On success, instance->hostdata->connected is set.
			 * On failure, we must add the command back to the
			 *   issue queue so we can keep trying.	
			 */
#if (NDEBUG & (NDEBUG_MAIN | NDEBUG_QUEUES))
			printk("scsi%d : main() : command for target %d lun %d removed from issue_queue\n",
			    instance->host_no, tmp->target, tmp->lun);
#endif
    			/* 
    			 * REQUEST SENSE commands are issued without tagged
    			 * queueing, even on SCSI-II devices because the 
    			 * contingent alligence condition exists for the 
    			 * entire unit.
    			 */
    			
			if (!NCR5380_select(instance, tmp, 
			    (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : 
			    TAG_NEXT)) {
			    break;
			} else {
			    cli();
			    tmp->host_scribble = (unsigned char *) 
				hostdata->issue_queue;
			    hostdata->issue_queue = tmp;
			    sti();
#if (NDEBUG & (NDEBUG_MAIN | NDEBUG_QUEUES))
			printk("scsi%d : main(): select() failed, returned to issue_queue\n",
			    instance->host_no);
#endif
			}
		    } /* if target/lun is not busy */
	    } /* if (!hostdata->connected) */
		
	    if (hostdata->connected 
#ifdef REAL_DMA
		&& !hostdata->dmalen
#endif
#ifdef USLEEP
		&& (!hostdata->time_expires || hostdata->time_expires >= jiffies)
#endif
		) {
		sti();
#if (NDEBUG & NDEBUG_MAIN)
		printk("scsi%d : main() : performing information transfer\n",
			instance->host_no);
#endif
		NCR5380_information_transfer(instance);
#if (NDEBUG & NDEBUG_MAIN)
		printk("scsi%d : main() : done set false\n", instance->host_no);
#endif
		done = 0;
	    } else 
		break;
	} /* for instance */
    } while (!done);
    main_running = 0;
}

/*
 * Function : void NCR5380_intr (int irq)
 * 
 * Purpose : handle interrupts, restablishing I_T_L or I_T_L_Q nexuses
 *	from the disconnected queue, and restarting NCR5380_main() 
 *	as required.
 *
 * Inputs : int irq, irq that caused this interrupt.
 *
 */

static void NCR5380_intr (int irq) {
    NCR5380_local_declare(); 
    struct Scsi_Host *instance;
    int done;
    unsigned char basr;
#if (NDEBUG & NDEBUG_INTR)
    printk("scsi : NCR5380 irq %d triggered\n", irq);
#endif
    do {
	done = 1;
	for (instance = first_instance; instance && (instance->hostt == 
	    the_template); instance = instance->next)
	    if (instance->irq == irq) {
		
		/* Look for pending interrupts */
		NCR5380_setup(instance);
		basr = NCR5380_read(BUS_AND_STATUS_REG);
		/* XXX dispatch to appropriate routine if found and done=0 */
		if (basr & BASR_IRQ) {
#if (NDEBUG & NDEBUG_INTR)
		    NCR5380_print(instance);
#endif
		    if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == 
			(SR_SEL | SR_IO)) {
			done = 0;
			sti();
#if (NDEBUG & NDEBUG_INTR)
			printk("scsi%d : SEL interrupt\n", instance->host_no);
#endif
			NCR5380_reselect(instance);
			(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
		    } else if (basr & 
			BASR_PARITY_ERROR) {
#if (NDEBUG & NDEBUG_INTR)
			printk("scsi%d : PARITY interrupt\n", instance->host_no);
#endif
			(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
		    } else {
/*  
 * XXX the rest of the interrupt conditions should *only* occur during a 
 * DMA transfer, which I haven't gotten arround to fixing yet.
 */

#if defined(REAL_DMA)
		    /*
		     * We should only get PHASE MISMATCH and EOP interrupts
		     * if we have DMA enabled, so do a sanity check based on
		     * the current setting of the MODE register.
		     */

			if ((NCR5380_read(MODE_REG) & MR_DMA) && ((basr & 
			    BASR_END_DMA_TRANSFER) || 
			    !(basr & BASR_PHASE_MATCH))) {
			    int transfered;

			    if (!hostdata->connected) 
				panic("scsi%d : recieved end of DMA interrupt with no connected cmd\n",
				    instance->hostno);

			    transfered = (hostdata->dmalen - NCR5380_dma_residual(instance));
			    hostdata->connected->SCp.this_residual -= transferred;
			    hostdata->connected->SCp.ptr += transferred;
			    hostdata->dmalen = 0;

			    (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);

			    while (NCR5380_read(BUS_AND_STATUS_REG) & 
				BASR_ACK));

			    NCR5380_write(MODE_REG, MR_BASE);
			    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
			}
#else
#if (NDEBUG & NDEBUG_INTR)
		    printk("scsi : unknown interrupt, BASR 0x%X, MR 0x%X, SR 0x%x\n", basr, NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
#endif
		    (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
#endif
		    } 
		} /* if BASR_IRQ */
		if (!done) 
		    run_main();
	    } /* if (instance->irq == irq) */
    } while (!done);
}

/* 
 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 
 *	int tag);
 *
 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
 *	including ARBITRATION, SELECTION, and initial message out for 
 *	IDENTIFY and queue messages. 
 *
 * Inputs : instance - instantiation of the 5380 driver on which this 
 * 	target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 
 *	new tag, TAG_NONE for untagged queueing, otherwise set to the tag for 
 *	the command that is presently connected.
 * 
 * Returns : -1 if selection could not execute for some reason,
 *	0 if selection succeeeded or failed because the target 
 * 	did not respond.
 *
 * Side effects : 
 * 	If bus busy, arbitration failed, etc, NCR5380_select() will exit 
 *		with registers as they should have been on entry - ie
 *		SELECT_ENABLE will be set appropriately, the NCR5380
 *		will cease to drive any SCSI bus signals.
 *
 *	If successful : I_T_L or I_T_L_Q nexus will be established, 
 *		instance->connected will be set to cmd.  
 * 		SELECT interrupt will be disabled.
 *
 *	If failed (no target) : cmd->scsi_done() will be called, and the 
 *		cmd->result host byte set to DID_BAD_TARGET.
 */

static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
    int tag) {
    NCR5380_local_declare();
    struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata*) 
	instance->hostdata;
    unsigned char tmp[3], phase;
    unsigned char *data;
    int len;
    unsigned long timeout;
    NCR5380_setup(instance);

#if defined (NDEBUG) && (NDEBUG & NDEBUG_ARBITRATION) 
    NCR5380_print(instance);
    printk("scsi%d : starting arbitration, id = %d\n", instance->host_no,
	instance->this_id);
#endif

    /* 
     * Set the phase bits to 0, otherwise the NCR5380 won't drive the 
     * data bus during SELECTION.
     */

    NCR5380_write(TARGET_COMMAND_REG, 0);

    /* Start arbitration */ 
    NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
    NCR5380_write(MODE_REG, MR_ARBITRATE);

    /* Wait for arbitration logic to complete */
    while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS));

#if (NDEBUG & NDEBUG_ARBITRATION) 
    printk("scsi%d : arbitration complete\n", instance->host_no);
/* Avoid GCC 2.4.5 asm needs to many reloads error */
    __asm__("nop");
#endif

    /* 
     * The arbitration delay is 2.2us, but this is a minimum and there is 
     * no maximum so we can safely sleep for ceil(2.2) usecs to accomodate
     * the integral nature of udelay().
     *
     */

    udelay(3);

    /* Check for lost arbitration */
    if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
	(NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) ||
	(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
	NCR5380_write(MODE_REG, MR_BASE); 
#if (NDEBUG & NDEBUG_ARBITRATION)
    printk("scsi%d : lost arbitration, deasserting MR_ARBITRATE\n", 
	instance->host_no);
#endif
	return -1;
    }

    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_SEL);
    
    if (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) {
	NCR5380_write(MODE_REG, MR_BASE);
	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
#if (NDEBUG & NDEBUG_ARBITRATION)
    printk("scsi%d : lost arbitration, deasserting ICR_ASSERT_SEL\n", 
	instance->host_no);
#endif
	return -1;
    }

    /* 
     * Again, bus clear + bus settle time is 1.2us, however, this is 
     * a minimum so we'll udelay ceil(1.2)
     */

    udelay(2);	

#if (NDEBUG & NDEBUG_ARBITRATION)
    printk("scsi%d : won arbitration\n", instance->host_no);
#endif

    /* 
     * Now that we have won arbitration, start Selection process, asserting 
     * the host and target ID's on the SCSI bus.
     */

    NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->target)));

    /* 
     * Raise ATN while SEL is true before BSY goes false from arbitration,
     * since this is the only way to gurantee that we'll get a MESSAGE OUT
     * phase immediately after selection.
     */

    NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY | 
	ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL ));
    NCR5380_write(MODE_REG, MR_BASE);

    /* 
     * Reselect interrupts must be turned off prior to the dropping of BSY,
     * otherwise we will trigger an interrupt.
     */
    NCR5380_write(SELECT_ENABLE_REG, 0);

    /* Reset BSY */
    NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA | 
	ICR_ASSERT_ATN | ICR_ASSERT_SEL));

    /* 
     * Something wierd happens when we cease to drive BSY - looks
     * like the board/chip is letting us do another read before the 
     * appropriate propogation delay has expired, and we're confusing
     * a BSY signal from ourselves as the target's response to SELECTION.
     *
     * A small delay (the 'C++' frontend breaks the pipeline with an
     * unecessary jump, making it work on my 386-33/Trantor T128, the
     * tighter 'C' code breaks and requires this) solves the problem - 
     * the 1 us delay is arbitrary, and only used because this delay will 
     * be the same on other platforms and since it works here, it should 
     * work there.
     */

    udelay(1);

#if (NDEBUG & NDEBUG_SELECTION)
    printk("scsi%d : selecting target %d\n", instance->host_no, cmd->target);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩三级在线| 91香蕉视频在线| 亚洲综合色丁香婷婷六月图片| 91精品久久久久久久91蜜桃| 成人在线视频一区| 精品一区二区日韩| 一区二区三区鲁丝不卡| 日本一区二区免费在线| 91精品国产色综合久久不卡电影| 91丨porny丨国产入口| 精品在线播放午夜| 五月激情综合婷婷| 中文字幕欧美一| 国产亚洲综合在线| 日韩一级二级三级精品视频| 在线精品国精品国产尤物884a| 不卡的av电影在线观看| 精品一二三四在线| 秋霞电影网一区二区| 国产精品久久久久三级| 欧美日韩免费不卡视频一区二区三区| 丰满少妇在线播放bd日韩电影| 蜜桃视频在线观看一区| 亚洲国产精品久久久男人的天堂| 国产精品美女久久福利网站| 国产亚洲一区二区三区四区| 日韩欧美成人一区二区| 精品99999| 制服.丝袜.亚洲.另类.中文| 欧美色网一区二区| 91小视频免费看| www.日韩精品| 成人黄色大片在线观看| 高清视频一区二区| 国产米奇在线777精品观看| 久久精品免费观看| 蜜臀a∨国产成人精品| 日韩和欧美一区二区三区| 性做久久久久久免费观看欧美| 亚洲国产va精品久久久不卡综合| 一区二区三区资源| 一区二区三区美女| 亚洲成av人影院在线观看网| 午夜成人在线视频| 日韩和欧美一区二区三区| 蜜桃精品视频在线| 久久成人麻豆午夜电影| 精品无人码麻豆乱码1区2区| 激情深爱一区二区| 国产成人综合亚洲91猫咪| 国产成人在线看| 美女免费视频一区二区| 丝袜亚洲另类丝袜在线| 中文字幕第一区| 中文字幕一区在线观看| 亚洲欧美精品午睡沙发| 一卡二卡欧美日韩| 丝袜美腿一区二区三区| 日韩亚洲欧美在线| 久久综合狠狠综合久久激情| 国产午夜精品在线观看| 亚洲精选视频在线| 五月综合激情网| 极品少妇一区二区三区精品视频| 国产精品 日产精品 欧美精品| 欧美一级片在线| 欧美日韩免费视频| 日韩区在线观看| 国产欧美日韩在线视频| 自拍偷拍亚洲综合| 亚洲成av人片一区二区| 国产在线精品免费| 99久久精品免费看| 制服丝袜国产精品| 中文无字幕一区二区三区| 亚洲综合av网| 黄页视频在线91| 色成人在线视频| 精品美女被调教视频大全网站| 国产精品萝li| 日韩有码一区二区三区| 国产成人一区在线| 欧美三级蜜桃2在线观看| 亚洲精品一区二区三区99| 一区二区中文字幕在线| 日韩精品电影一区亚洲| 国产99久久久国产精品潘金| 欧美日韩久久一区二区| 久久久国产精品麻豆| 亚洲午夜日本在线观看| 国产成人午夜精品影院观看视频| 欧美日韩一级黄| 国产精品视频在线看| 日韩av一级片| 91小视频免费看| 精品1区2区在线观看| 亚洲成人自拍偷拍| 成人av高清在线| 欧美一区二区三区影视| 一区二区中文视频| 国产精品1区2区| 欧美裸体一区二区三区| 亚洲欧美在线视频观看| 国产乱码精品一品二品| 555夜色666亚洲国产免| 亚洲精品视频观看| 成人黄色小视频在线观看| 日韩欧美成人一区二区| 亚洲高清在线视频| 97国产一区二区| 国产欧美精品一区| 精品亚洲国产成人av制服丝袜| 欧美日韩国产免费| 亚洲精品国产一区二区精华液| 国产在线不卡一区| 69久久夜色精品国产69蝌蚪网| 亚洲免费资源在线播放| 成人精品鲁一区一区二区| 26uuu亚洲综合色| 免费欧美在线视频| 欧美精品1区2区| 一区二区三区免费观看| 一本色道久久综合亚洲aⅴ蜜桃| 国产亚洲一区二区三区四区| 精品一区二区三区香蕉蜜桃 | 久久国产精品露脸对白| 91网站在线播放| 中文字幕精品综合| 国内成人免费视频| 欧美变态凌虐bdsm| 日本不卡高清视频| 777色狠狠一区二区三区| 日韩中文字幕不卡| 欧美一区日韩一区| 视频一区视频二区中文字幕| 欧美日韩国产电影| 性欧美大战久久久久久久久| 8v天堂国产在线一区二区| 日韩不卡一区二区三区| 日韩丝袜情趣美女图片| 国内成+人亚洲+欧美+综合在线| 久久日韩精品一区二区五区| 国产在线一区二区综合免费视频| 26uuu成人网一区二区三区| 国产一区二区三区四区五区美女| 精品奇米国产一区二区三区| 国内精品视频一区二区三区八戒| 久久综合九色综合久久久精品综合| 国产精品一区二区三区乱码| 中文av一区二区| 91丨九色丨蝌蚪富婆spa| 一区二区三区日韩欧美| 欧美日韩国产综合久久| 97se亚洲国产综合自在线观| www.亚洲激情.com| 一区二区三区精品视频在线| 欧美亚洲综合色| 日韩黄色片在线观看| www国产精品av| 成人免费毛片嘿嘿连载视频| 亚洲激情在线播放| 欧美浪妇xxxx高跟鞋交| 极品少妇xxxx偷拍精品少妇| 中文字幕一区二| 欧美色欧美亚洲另类二区| 久久99国产精品久久99| 国产精品毛片高清在线完整版 | 日韩欧美国产综合在线一区二区三区| 另类综合日韩欧美亚洲| 国产日产欧美一区二区视频| 色婷婷久久久亚洲一区二区三区| 亚洲成人av福利| 久久综合色综合88| 91麻豆国产福利在线观看| 蜜臀99久久精品久久久久久软件| 国产女主播一区| 7777精品伊人久久久大香线蕉 | 懂色av一区二区三区免费观看| 亚洲人成在线播放网站岛国| 91精品国产高清一区二区三区蜜臀| 福利电影一区二区| 亚洲一二三四区| 久久久99久久精品欧美| 久久综合久色欧美综合狠狠| 日韩精品色哟哟| 欧美国产综合色视频| 欧美日韩日日摸| 国产成人丝袜美腿| 亚洲成人第一页| 中文字幕不卡在线观看| 欧美精品黑人性xxxx| 成人高清在线视频| 美女视频黄久久| 亚洲图片有声小说| 国产目拍亚洲精品99久久精品| 欧美三级韩国三级日本一级| 成人午夜视频免费看| 日本成人在线看| 亚洲在线免费播放| 国产精品美女久久久久久|