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

📄 scsi.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 3 页
字号:
	devfs_handle_t de;      /* directory for the device      */	char type;	char scsi_level;	char vendor[8], model[16], rev[4];	unsigned char current_tag;	/* current tag */	unsigned char sync_min_period;	/* Not less than this period */	unsigned char sync_max_offset;	/* Not greater than this offset */	unsigned char queue_depth;	/* How deep a queue to use */	unsigned online:1;	unsigned writeable:1;	unsigned removable:1;	unsigned random:1;	unsigned has_cmdblocks:1;	unsigned changed:1;	/* Data invalid due to media change */	unsigned busy:1;	/* Used to prevent races */	unsigned lockable:1;	/* Able to prevent media removal */	unsigned borken:1;	/* Tell the Seagate driver to be 				 * painfully slow on this device */	unsigned tagged_supported:1;	/* Supports SCSI-II tagged queuing */	unsigned tagged_queue:1;	/* SCSI-II tagged queuing enabled */	unsigned disconnect:1;	/* can disconnect */	unsigned soft_reset:1;	/* Uses soft reset option */	unsigned sync:1;	/* Negotiate for sync transfers */	unsigned wide:1;	/* Negotiate for WIDE transfers */	unsigned single_lun:1;	/* Indicates we should only allow I/O to				 * one of the luns for the device at a 				 * time. */	unsigned was_reset:1;	/* There was a bus reset on the bus for 				 * this device */	unsigned expecting_cc_ua:1;	/* Expecting a CHECK_CONDITION/UNIT_ATTN					 * because we did a bus reset. */	unsigned device_blocked:1;	/* Device returned QUEUE_FULL. */	unsigned ten:1;		/* support ten byte read / write */	unsigned remap:1;	/* support remapping  */	unsigned starved:1;	/* unable to process commands because				   host busy */	// Flag to allow revalidate to succeed in sd_open	int allow_revalidate;};/* * The Scsi_Cmnd structure is used by scsi.c internally, and for communication * with low level drivers that support multiple outstanding commands. */typedef struct scsi_pointer {	char *ptr;		/* data pointer */	int this_residual;	/* left in this buffer */	struct scatterlist *buffer;	/* which buffer */	int buffers_residual;	/* how many buffers left */        dma_addr_t dma_handle;	volatile int Status;	volatile int Message;	volatile int have_data_in;	volatile int sent_command;	volatile int phase;} Scsi_Pointer;/* * This is essentially a slimmed down version of Scsi_Cmnd.  The point of * having this is that requests that are injected into the queue as result * of things like ioctls and character devices shouldn't be using a * Scsi_Cmnd until such a time that the command is actually at the head * of the queue and being sent to the driver. */struct scsi_request {	int     sr_magic;	int     sr_result;	/* Status code from lower level driver */	unsigned char sr_sense_buffer[SCSI_SENSE_BUFFERSIZE];		/* obtained by REQUEST SENSE						 * when CHECK CONDITION is						 * received on original command 						 * (auto-sense) */	struct Scsi_Host *sr_host;	Scsi_Device *sr_device;	Scsi_Cmnd *sr_command;	struct request sr_request;	/* A copy of the command we are				   working on */	unsigned sr_bufflen;	/* Size of data buffer */	void *sr_buffer;		/* Data buffer */	int sr_allowed;	unsigned char sr_data_direction;	unsigned char sr_cmd_len;	unsigned char sr_cmnd[MAX_COMMAND_SIZE];	void (*sr_done) (struct scsi_cmnd *);	/* Mid-level done function */	int sr_timeout_per_command;	unsigned short sr_use_sg;	/* Number of pieces of scatter-gather */	unsigned short sr_sglist_len;	/* size of malloc'd scatter-gather list */	unsigned sr_underflow;	/* Return error if less than				   this amount is transferred */};/* * FIXME(eric) - one of the great regrets that I have is that I failed to define * these structure elements as something like sc_foo instead of foo.  This would * make it so much easier to grep through sources and so forth.  I propose that * all new elements that get added to these structures follow this convention. * As time goes on and as people have the stomach for it, it should be possible to  * go back and retrofit at least some of the elements here with with the prefix. */struct scsi_cmnd {	int     sc_magic;/* private: */	/*	 * This information is private to the scsi mid-layer.  Wrapping it in a	 * struct private is a way of marking it in a sort of C++ type of way.	 */	struct Scsi_Host *host;	unsigned short state;	unsigned short owner;	Scsi_Device *device;	Scsi_Request *sc_request;	struct scsi_cmnd *next;	struct scsi_cmnd *reset_chain;	int eh_state;		/* Used for state tracking in error handlr */	void (*done) (struct scsi_cmnd *);	/* Mid-level done function */	/*	   A SCSI Command is assigned a nonzero serial_number when internal_cmnd	   passes it to the driver's queue command function.  The serial_number	   is cleared when scsi_done is entered indicating that the command has	   been completed.  If a timeout occurs, the serial number at the moment	   of timeout is copied into serial_number_at_timeout.  By subsequently	   comparing the serial_number and serial_number_at_timeout fields	   during abort or reset processing, we can detect whether the command	   has already completed.  This also detects cases where the command has	   completed and the SCSI Command structure has already being reused	   for another command, so that we can avoid incorrectly aborting or	   resetting the new command.	 */	unsigned long serial_number;	unsigned long serial_number_at_timeout;	int retries;	int allowed;	int timeout_per_command;	int timeout_total;	int timeout;	/*	 * We handle the timeout differently if it happens when a reset, 	 * abort, etc are in process. 	 */	unsigned volatile char internal_timeout;	struct scsi_cmnd *bh_next;	/* To enumerate the commands waiting 					   to be processed. *//* public: */	unsigned int target;	unsigned int lun;	unsigned int channel;	unsigned char cmd_len;	unsigned char old_cmd_len;	unsigned char sc_data_direction;	unsigned char sc_old_data_direction;	/* These elements define the operation we are about to perform */	unsigned char cmnd[MAX_COMMAND_SIZE];	unsigned request_bufflen;	/* Actual request size */	struct timer_list eh_timeout;	/* Used to time out the command. */	void *request_buffer;		/* Actual requested buffer */        void **bounce_buffers;		/* Array of bounce buffers when using scatter-gather */	/* These elements define the operation we ultimately want to perform */	unsigned char data_cmnd[MAX_COMMAND_SIZE];	unsigned short old_use_sg;	/* We save  use_sg here when requesting					 * sense info */	unsigned short use_sg;	/* Number of pieces of scatter-gather */	unsigned short sglist_len;	/* size of malloc'd scatter-gather list */	unsigned short abort_reason;	/* If the mid-level code requests an					 * abort, this is the reason. */	unsigned bufflen;	/* Size of data buffer */	void *buffer;		/* Data buffer */	unsigned underflow;	/* Return error if less than				   this amount is transferred */	unsigned old_underflow;	/* save underflow here when reusing the				 * command for error handling */	unsigned transfersize;	/* How much we are guaranteed to				   transfer with each SCSI transfer				   (ie, between disconnect / 				   reconnects.   Probably == sector				   size */	int resid;		/* Number of bytes requested to be				   transferred less actual number				   transferred (0 if not supported) */	struct request request;	/* A copy of the command we are				   working on */	unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];		/* obtained by REQUEST SENSE						 * when CHECK CONDITION is						 * received on original command 						 * (auto-sense) */	unsigned flags;	/*	 * Used to indicate that a command which has timed out also	 * completed normally.  Typically the completion function will	 * do nothing but set this flag in this instance because the	 * timeout handler is already running.	 */	unsigned done_late:1;	/* Low-level done function - can be used by low-level driver to point	 *        to completion function.  Not used by mid/upper level code. */	void (*scsi_done) (struct scsi_cmnd *);	/*	 * The following fields can be written to by the host specific code. 	 * Everything else should be left alone. 	 */	Scsi_Pointer SCp;	/* Scratchpad used by some host adapters */	unsigned char *host_scribble;	/* The host adapter is allowed to					   * call scsi_malloc and get some memory					   * and hang it here.     The host adapter					   * is also expected to call scsi_free					   * to release this memory.  (The memory					   * obtained by scsi_malloc is guaranteed					   * to be at an address < 16Mb). */	int result;		/* Status code from lower level driver */	unsigned char tag;	/* SCSI-II queued command tag */	unsigned long pid;	/* Process ID, starts at 0 */};/* *  Flag bit for the internal_timeout array */#define NORMAL_TIMEOUT 0/* * Definitions and prototypes used for scsi mid-level queue. */#define SCSI_MLQUEUE_HOST_BUSY   0x1055#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056#define SCSI_SLEEP(QUEUE, CONDITION) {		    \    if (CONDITION) {			            \	DECLARE_WAITQUEUE(wait, current);	    \	add_wait_queue(QUEUE, &wait);		    \	for(;;) {			            \	set_current_state(TASK_UNINTERRUPTIBLE);    \	if (CONDITION) {		            \            if (in_interrupt())	                    \	        panic("scsi: trying to call schedule() in interrupt" \		      ", file %s, line %d.\n", __FILE__, __LINE__);  \	    schedule();			\        }				\	else			        \	    break;      		\	}			        \	remove_wait_queue(QUEUE, &wait);\	current->state = TASK_RUNNING;	\    }; }#endif/* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically * adjust the settings for this buffer only.  This must remain at the end * of the file. * --------------------------------------------------------------------------- * Local variables: * c-indent-level: 4  * c-brace-imaginary-offset: 0 * c-brace-offset: -4 * c-argdecl-indent: 4 * c-label-offset: -4 * c-continued-statement-offset: 4 * c-continued-brace-offset: 0 * indent-tabs-mode: nil * tab-width: 8 * End: */

⌨️ 快捷键说明

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