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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? scsi.c

?? linux0.99源代碼用于研究linux操作系統(tǒng)
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *	scsi.c Copyright (C) 1992 Drew Eckhardt  *	generic mid-level SCSI driver by *		Drew Eckhardt  * *	<drew@colorado.edu> * *	Bug correction thanks go to :  *		Rik Faith <faith@cs.unc.edu> *		Tommy Thorn <tthorn> *		Thomas Wuensche <tw@fgb1.fgb.mw.tu-muenchen.de> *  *       Modified by Eric Youngdale eric@tantalus.nrl.navy.mil to *       add scatter-gather, multiple outstanding request, and other *       enhancements. */#include <asm/system.h>#include <linux/sched.h>#include <linux/timer.h>#include <linux/string.h>#include "../blk.h"#include "scsi.h"#include "hosts.h"/*static const char RCSid[] = "$Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/scsi.c,v 1.1 1992/07/24 06:27:38 root Exp root $";*/#define INTERNAL_ERROR (printk ("Internal error in file %s, line %d.\n", __FILE__, __LINE__), panic(""))static void scsi_done (Scsi_Cmnd *SCpnt);static int update_timeout (Scsi_Cmnd *, int);static void print_inquiry(unsigned char *data);static void scsi_times_out (Scsi_Cmnd * SCpnt);static int time_start;static int time_elapsed;/*	global variables : 	NR_SCSI_DEVICES is the number of SCSI devices we have detected, 	scsi_devices an array of these specifing the address for each 	(host, id, LUN)*/	int NR_SCSI_DEVICES=0;Scsi_Device * scsi_devices = NULL;static unsigned char generic_sense[6] = {REQUEST_SENSE, 0,0,0, 255, 0};/* We make this not static so that we can read the array with gdb. *//* static */ Scsi_Cmnd * last_cmnd = NULL;/* *	As the scsi do command functions are inteligent, and may need to  *	redo a command, we need to keep track of the last command  *	executed on each one. */#define WAS_RESET 	0x01#define WAS_TIMEDOUT 	0x02#define WAS_SENSE	0x04#define IS_RESETTING	0x08extern int last_reset[];/* *	This is the number  of clock ticks we should wait before we time out  *	and abort the command.  This is for  where the scsi.c module generates  *	the command, not where it originates from a higher level, in which *	case the timeout is specified there. * *	ABORT_TIMEOUT and RESET_TIMEOUT are the timeouts for RESET and ABORT *	respectively. */#ifdef DEBUG	#define SCSI_TIMEOUT 500#else	#define SCSI_TIMEOUT 100#endif#ifdef DEBUG	#define SENSE_TIMEOUT SCSI_TIMEOUT	#define ABORT_TIMEOUT SCSI_TIMEOUT	#define RESET_TIMEOUT SCSI_TIMEOUT#else	#define SENSE_TIMEOUT 50	#define RESET_TIMEOUT 50	#define ABORT_TIMEOUT 50	#define MIN_RESET_DELAY 25#endif/* The following devices are known not to tolerate a lun != 0 scan for   one reason or another.  Some will respond to all luns, others will   lock up. */     struct blist{       char * vendor;       char * model;       char * revision; /* Latest revision known to be bad.  Not used yet */     };#if 0static struct blist blacklist[] = {{"TANDBERG","TDC 3600","U07"},  /* Locks up if polled for lun != 0 */   {"SEAGATE","ST296","921"},   /* Responds to all lun */   {"NEWBURY","NDR3380S","2.10"},   /* Responds to all lun */   {NULL, NULL, NULL}};	static int blacklisted(char * response_data){  int i = 0;  for(i=0; 1; i++){    if(blacklist[i].vendor == NULL) return 0;    if(strncmp(blacklist[i].vendor, &response_data[8],	       strlen(blacklist[i].vendor))) continue;    if(strncmp(blacklist[i].model, &response_data[16],	       strlen(blacklist[i].model))) continue;    return 1;  };	};#endif/* *	As the actual SCSI command runs in the background, we must set up a  *	flag that tells scan_scsis() when the result it has is valid.   *	scan_scsis can set the_result to -1, and watch for it to become the  *	actual return code for that call.  the scan_scsis_done function() is  *	our user specified completion function that is passed on to the   *	scsi_do_cmd() function. */static volatile int in_scan = 0;static int the_result;static void scan_scsis_done (Scsi_Cmnd * SCpnt)	{	#ifdef DEBUG	printk ("scan_scsis_done(%d, %06x)\n\r", SCpnt->host, SCpnt->result);#endif		SCpnt->request.dev = 0xfffe;	}/* *	Detecting SCSI devices :	 *	We scan all present host adapter's busses,  from ID 0 to ID 6.   *	We use the INQUIRY command, determine device type, and pass the ID /  *	lun address of all sequential devices to the tape driver, all random  *	devices to the disk driver. */static void scan_scsis (void){  int host_nr , dev, lun, type;  unsigned char scsi_cmd [12];  unsigned char scsi_result [256];  Scsi_Cmnd  SCmd;    ++in_scan;  lun = 0;    SCmd.next = NULL;  SCmd.prev = NULL;  for (host_nr = 0; host_nr < max_scsi_hosts; ++host_nr)    if (scsi_hosts[host_nr].present)      {	host_queue[host_nr] = &SCmd;  /* We need this so that commands can					time out */	for (dev = 0; dev < 8; ++dev)	  if (scsi_hosts[host_nr].this_id != dev)	    for (lun = 0; lun < 8; ++lun)	      {		scsi_devices[NR_SCSI_DEVICES].host_no = host_nr;		scsi_devices[NR_SCSI_DEVICES].id = dev;		scsi_devices[NR_SCSI_DEVICES].lun = lun;		scsi_devices[NR_SCSI_DEVICES].index = NR_SCSI_DEVICES;		scsi_devices[NR_SCSI_DEVICES].device_wait = NULL;				scsi_cmd[0] = TEST_UNIT_READY;		scsi_cmd[1] = lun << 5;		scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;		scsi_cmd[4] = 0;		SCmd.host = host_nr;		SCmd.target = dev;		SCmd.lun = lun;		SCmd.request.dev = 0xffff; /* Mark not busy */		SCmd.use_sg  = 0;		scsi_do_cmd (&SCmd,			     (void *)  scsi_cmd, (void *) 			     scsi_result, 256,  scan_scsis_done, 			     SCSI_TIMEOUT + 400, 3);				while (SCmd.request.dev != 0xfffe);		if(SCmd.result) {		  if ((driver_byte(SCmd.result)  & DRIVER_SENSE) &&		      ((SCmd.sense_buffer[0] & 0x70) >> 4) == 7) {		    if (SCmd.sense_buffer[2] &0xe0)		      continue; /* No devices here... */		    if((SCmd.sense_buffer[2] & 0xf != NOT_READY) &&		       (SCmd.sense_buffer[2] & 0xf != UNIT_ATTENTION))		      continue;		  }		  else		    break;		};		/*		 * Build an INQUIRY command block.  		 */				scsi_cmd[0] = INQUIRY;		scsi_cmd[1] = (lun << 5) & 0xe0;		scsi_cmd[2] = 0;		scsi_cmd[3] = 0;		scsi_cmd[4] = 255;		scsi_cmd[5] = 0;				SCmd.request.dev = 0xffff; /* Mark not busy */				scsi_do_cmd (&SCmd,			     (void *)  scsi_cmd, (void *) 			     scsi_result, 256,  scan_scsis_done, 			     SCSI_TIMEOUT, 3);				while (SCmd.request.dev != 0xfffe);				the_result = SCmd.result;				if(the_result) break; 		/* skip other luns on this device */				if (!the_result)		  {		    scsi_devices[NR_SCSI_DEVICES].		      removable = (0x80 & 				   scsi_result[1]) >> 7;		    scsi_devices[NR_SCSI_DEVICES].		      changed = 0;		    scsi_devices[NR_SCSI_DEVICES].		      access_count = 0;		    scsi_devices[NR_SCSI_DEVICES].		      busy = 0;/*  *	Currently, all sequential devices are assumed to be tapes, *	all random devices disk, with the appropriate read only  *	flags set for ROM / WORM treated as RO. */ 		    switch (type = scsi_result[0])		      {		      case TYPE_TAPE :		      case TYPE_DISK :		      case TYPE_MOD :			scsi_devices[NR_SCSI_DEVICES].writeable = 1;			break;		      case TYPE_WORM :		      case TYPE_ROM :			scsi_devices[NR_SCSI_DEVICES].writeable = 0;			break;			default :			  type = -1;		      }		    scsi_devices[NR_SCSI_DEVICES].random = 		      (type == TYPE_TAPE) ? 0 : 1;		    scsi_devices[NR_SCSI_DEVICES].type = type;		    if (type != -1)		      {			print_inquiry(scsi_result);			switch(type){			case TYPE_TAPE:			  printk("Detected scsi tape st%d at scsi%d, id %d, lun %d\n", MAX_ST,				 host_nr , dev, lun); 			  if(NR_ST != -1) ++MAX_ST;			  break;			case TYPE_ROM:			  printk("Detected scsi CD-ROM sr%d at scsi%d, id %d, lun %d\n", MAX_SR,				 host_nr , dev, lun); 			  if(NR_SR != -1) ++MAX_SR;			  break;			case TYPE_DISK:			case TYPE_MOD:			  printk("Detected scsi disk sd%d at scsi%d, id %d, lun %d\n", MAX_SD,				 host_nr , dev, lun); 			  if(NR_SD != -1) ++MAX_SD;			  break;			default:			  break;			};			scsi_devices[NR_SCSI_DEVICES].scsi_level =			  scsi_result[2] & 0x07;			if (scsi_devices[NR_SCSI_DEVICES].scsi_level >= 2 ||			    (scsi_devices[NR_SCSI_DEVICES].scsi_level == 1 &&			     (scsi_result[3] & 0x0f) == 1))			  scsi_devices[NR_SCSI_DEVICES].scsi_level++;			/* These devices need this "key" to unlock the device			   so we can use it */			if(strncmp("INSITE", &scsi_result[8], 6) == 0 &&			   strncmp("Floptical   F*8I", &scsi_result[16], 16) == 0) {			  scsi_cmd[0] = MODE_SENSE;			  scsi_cmd[1] = (lun << 5) & 0xe0;			  scsi_cmd[2] = 0x2e;			  scsi_cmd[3] = 0;			  scsi_cmd[4] = 0x2a;			  scsi_cmd[5] = 0;					  SCmd.request.dev = 0xffff; /* Mark not busy */			  			  scsi_do_cmd (&SCmd,				       (void *)  scsi_cmd, (void *) 				       scsi_result, 0x2a,  scan_scsis_done, 				       SCSI_TIMEOUT, 3);					  while (SCmd.request.dev != 0xfffe);			};			++NR_SCSI_DEVICES;#if 0			/* Some scsi devices cannot be polled for lun != 0			   due to firmware bugs */			if(blacklisted(scsi_result)) break;#endif			/* Some scsi-1 peripherals do not handle lun != 0.			   I am assuming that scsi-2 peripherals do better */			if((scsi_result[2] & 0x07) == 1 && 			   (scsi_result[3] & 0x0f) == 0) break;			}		  }       /* if result == DID_OK ends */	      }       /* for lun ends */	host_queue[host_nr] = NULL;  /* No longer needed here */      }      	/* if present */      for (host_nr = 0; host_nr < max_scsi_hosts; ++host_nr)    if (scsi_hosts[host_nr].present)      if(host_queue[host_nr]) panic("host_queue not cleared");  printk("scsi : detected ");  if(NR_SD != -1)    printk("%d SCSI disk%s ", MAX_SD, (MAX_SD != 1) ? "s" : "");	   if(NR_ST != -1)    printk("%d tape%s ", MAX_ST, (MAX_ST != 1) ? "s" : "");  if(NR_SR != -1)    printk("%d CD-ROM drive%s ", MAX_SR, (MAX_SR != 1) ? "s" : "");  printk("total.\n");  in_scan = 0;}       /* scan_scsis  ends *//* *	Flag bits for the internal_timeout array  */#define NORMAL_TIMEOUT 0#define IN_ABORT 1#define IN_RESET 2/*	This is our time out function, called when the timer expires for a 	given host adapter.  It will attempt to abort the currently executing 	command, that failing perform a kernel panic.*/ static void scsi_times_out (Scsi_Cmnd * SCpnt)	{	 	switch (SCpnt->internal_timeout & (IN_ABORT | IN_RESET))		{		case NORMAL_TIMEOUT:			if (!in_scan)			      printk("SCSI host %d timed out - aborting command \r\n",				SCpnt->host);						if (!scsi_abort	(SCpnt, DID_TIME_OUT))				return;						case IN_ABORT:			printk("SCSI host %d abort() timed out - reseting \r\n",				SCpnt->host);			if (!scsi_reset (SCpnt)) 				return;		case IN_RESET:		case (IN_ABORT | IN_RESET):			printk("Unable to reset scsi host %d\r\n",SCpnt->host);			panic("");		default:			INTERNAL_ERROR;		}						}/* This function takes a quick look at a request, and decides if itcan be queued now, or if there would be a stall while waiting forsomething else to finish.  This routine assumes that interrupts areturned off when entering the routine.  It is the responsibilityof the calling code to ensure that this is the case. */Scsi_Cmnd * request_queueable (struct request * req, int index){  int host;  Scsi_Cmnd * SCpnt = NULL;  if ((index < 0) ||  (index > NR_SCSI_DEVICES))    panic ("Index number in allocate_device() is out of range.\n");    if (req && req->dev <= 0)    panic("Invalid device in allocate_device");    host = scsi_devices[index].host_no;  SCpnt = host_queue[host];    while(SCpnt){      if(SCpnt->target == scsi_devices[index].id &&	 SCpnt->lun == scsi_devices[index].lun)	if(SCpnt->request.dev < 0) break;      SCpnt = SCpnt->next;    };  if (!SCpnt) return NULL;  if (scsi_hosts[host].can_queue      && host_busy[host] >= scsi_hosts[host].can_queue) return NULL;  if (req) {    memcpy(&SCpnt->request, req, sizeof(struct request));    req->dev = -1;  } else    SCpnt->request.dev = 0xffff; /* Busy, but no request */  SCpnt->use_sg = 0;  /* Reset the scatter-gather flag */  return SCpnt;}/* This function returns a structure pointer that will be valid forthe device.  The wait parameter tells us whether we should wait forthe unit to become free or not.  We are also able to tell this routinenot to return a descriptor if the host is unable to accept any morecommands for the time being.  We need to keep in mind that there is noguarantee that the host remain not busy.  Keep in mind therequest_queueable function also knows the internal allocation schemeof the packets for each device */Scsi_Cmnd * allocate_device (struct request ** reqp, int index, int wait){  int host, dev = -1;  struct request * req = NULL;  Scsi_Cmnd * SCpnt = NULL;  Scsi_Cmnd * SCwait = NULL;  if ((index < 0) ||  (index > NR_SCSI_DEVICES))    panic ("Index number in allocate_device() is out of range.\n");    if (reqp) req = *reqp;  if (req && (dev = req->dev) <= 0)    panic("Invalid device in allocate_device");    host = scsi_devices[index].host_no;    while (1==1){    SCpnt = host_queue[host];    while(SCpnt){      if(SCpnt->target == scsi_devices[index].id &&	 SCpnt->lun == scsi_devices[index].lun) {	SCwait = SCpnt;	if(SCpnt->request.dev < 0) break;      };      SCpnt = SCpnt->next;    };    cli();    /* See if this request has already been queued by an interrupt routine */    if (req && ((req->dev < 0) || (req->dev != dev))) return NULL;    if (!SCpnt || SCpnt->request.dev >= 0)  /* Might have changed */      {	sti();	if(!wait) return NULL;	if (!SCwait) {	  printk("Attempt to allocate device index %d, target %d, lun %d\n",		 index, scsi_devices[index].id ,scsi_devices[index].lun);	  panic("No device found in allocate_device\n");	};	SCSI_SLEEP(&scsi_devices[SCwait->index].device_wait, 		   (SCwait->request.dev > 0));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91九色最新地址| 国产麻豆视频精品| 91麻豆国产福利在线观看| 国产精品无码永久免费888| 国产自产视频一区二区三区| 欧美日韩高清在线| 天天色天天操综合| 欧美高清精品3d| 精品综合免费视频观看| www国产亚洲精品久久麻豆| 亚洲国产精品尤物yw在线观看| 精品视频一区二区不卡| 亚洲超丰满肉感bbw| 日韩欧美电影一区| 激情文学综合网| 久久精品夜色噜噜亚洲a∨| 国产在线精品一区二区三区不卡 | 欧美一区二区久久| 精品一区二区三区在线播放视频 | av在线不卡观看免费观看| 亚洲视频中文字幕| 欧美精品1区2区3区| 国产精品综合av一区二区国产馆| 亚洲欧美日本韩国| 日韩欧美一二区| 色老汉av一区二区三区| 久久国内精品视频| 亚洲精品视频在线观看免费| 欧美一级在线免费| 色婷婷综合激情| 国产综合久久久久久久久久久久| 一区二区三区精品视频在线| 精品国产伦一区二区三区免费 | 91精品福利视频| 爽好多水快深点欧美视频| 欧美高清激情brazzers| 国产精品一区二区无线| 亚洲免费高清视频在线| 久久综合网色—综合色88| av综合在线播放| 韩国精品免费视频| 亚洲精品日日夜夜| 国产日产欧产精品推荐色| 国产毛片精品一区| 亚洲一区二区欧美日韩| 欧美一区二区三区公司| 91老师国产黑色丝袜在线| 免费在线观看成人| **欧美大码日韩| 欧美变态tickling挠脚心| 国产成人高清在线| 日韩国产在线观看一区| 国产精品乱码一区二三区小蝌蚪| 日韩欧美一区二区免费| 色综合色综合色综合色综合色综合 | 成人免费视频免费观看| 日日夜夜一区二区| 亚洲免费视频中文字幕| 久久伊99综合婷婷久久伊| 成人国产精品免费观看动漫| 国产精品一区二区你懂的| 五月天精品一区二区三区| 一区二区三区在线视频播放| 久久久久国产精品麻豆| 欧美性猛片aaaaaaa做受| 色婷婷国产精品| 国产成人精品免费看| 国产在线不卡一区| 日韩在线播放一区二区| 亚洲免费观看高清完整版在线观看 | 亚洲欧美另类图片小说| 欧美一二三区在线观看| 91麻豆精品国产91久久久使用方法| av一区二区不卡| 不卡大黄网站免费看| 国产一区二区导航在线播放| 免费观看久久久4p| 琪琪一区二区三区| 舔着乳尖日韩一区| 蜜臀av性久久久久蜜臀aⅴ四虎| 夜夜嗨av一区二区三区网页| 一区二区三区精品视频| 亚洲精选在线视频| 亚洲免费观看高清完整版在线 | 欧美日韩免费观看一区二区三区 | 久久久久久一级片| 久久久亚洲欧洲日产国码αv| 精品福利视频一区二区三区| 日韩一区和二区| 久久婷婷成人综合色| 久久久青草青青国产亚洲免观| 欧美久久久一区| 欧美一区二区三级| 精品少妇一区二区三区视频免付费 | 亚洲成人第一页| 亚洲午夜久久久久| 久久国产乱子精品免费女| 老色鬼精品视频在线观看播放| 国产精品盗摄一区二区三区| 亚洲精品视频一区| 亚洲成在人线在线播放| 蜜臀国产一区二区三区在线播放| 视频一区国产视频| 精品日产卡一卡二卡麻豆| 久久欧美一区二区| 国产精品久久久久久久久快鸭 | 亚洲图片另类小说| 国产精品电影院| 亚洲自拍偷拍网站| 五月激情丁香一区二区三区| 久色婷婷小香蕉久久| 成人精品高清在线| 69堂精品视频| 久久你懂得1024| 亚洲无人区一区| 久久99最新地址| 成年人国产精品| 欧美精品久久久久久久多人混战| 欧美电视剧在线看免费| 亚洲精品乱码久久久久久日本蜜臀| 亚洲一区二区三区小说| 亚洲自拍偷拍欧美| 紧缚捆绑精品一区二区| 99久久99久久久精品齐齐| 91精品国产综合久久福利| 国产肉丝袜一区二区| 亚洲国产日韩一级| 国产乱淫av一区二区三区 | 日韩精品一区二区三区四区| 国产精品卡一卡二卡三| 一区二区三区四区av| 国产精品一线二线三线| 欧美在线一区二区三区| 91超碰这里只有精品国产| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲一区在线免费观看| 成人高清免费观看| 日韩免费一区二区三区在线播放| 亚洲美女视频一区| 久久99久久久久| 免费成人在线网站| 欧美图片一区二区三区| 久久久www成人免费无遮挡大片| 日韩**一区毛片| av在线不卡观看免费观看| 国产清纯白嫩初高生在线观看91| 日本不卡在线视频| 欧美性大战久久| 亚洲视频图片小说| 国产麻豆视频一区| 欧美老人xxxx18| 亚洲欧洲日韩在线| 99国产欧美另类久久久精品| 精品美女一区二区三区| 日韩av一区二区三区| 日本高清免费不卡视频| 亚洲视频一区二区免费在线观看| 国产酒店精品激情| 久久久精品影视| 美女视频黄久久| 欧美日韩一区中文字幕| 亚洲天堂福利av| 成人中文字幕合集| 国产精品萝li| 国产成a人亚洲精| 国产日韩欧美一区二区三区乱码| 免费高清不卡av| 欧美tk—视频vk| 久久99这里只有精品| 2021国产精品久久精品| 精品一二三四在线| 91国产成人在线| 亚洲综合在线观看视频| 成人激情免费视频| 亚洲黄色在线视频| 日本伦理一区二区| 亚洲一区二区三区视频在线 | 一区二区三区自拍| 奇米精品一区二区三区在线观看 | 日韩欧美一区二区免费| 久久精品99久久久| 精品动漫一区二区三区在线观看 | 国产麻豆精品视频| 国产人成一区二区三区影院| 国产老肥熟一区二区三区| 欧美日韩国产系列| 久久91精品久久久久久秒播| 欧美本精品男人aⅴ天堂| 国产精品538一区二区在线| 欧美精品一区二区三区蜜桃视频| 国产精品99久久久| 欧美韩日一区二区三区四区| 黄色成人免费在线| 国产人久久人人人人爽| 国产精品99久久久久久似苏梦涵| 亚洲欧美另类小说| 欧美三级日韩在线| 国产成人超碰人人澡人人澡| 亚洲视频免费在线观看| 日韩一级免费观看|