public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* request for comments on sg_request changes (again)
@ 2005-05-10 22:51 Markus Lidel
  0 siblings, 0 replies; only message in thread
From: Markus Lidel @ 2005-05-10 22:51 UTC (permalink / raw)
  To: SCSI Mailing List

Hello,

for some time i asked for comments on moving sg_request into a own header 
file into include/scsi/sg_request.h. Now this time i also have a real 
implementation :-)

OK, this is a part of the queuecommand function, which uses the 
sg_request to change some flags for the request:


#ifdef CONFIG_I2O_EXT_ADAPTEC
	if (c->adaptec) {
		u32 adpt_flags = 0;

		if (SCpnt->sc_request && SCpnt->sc_request->upper_private_data) {
			i2o_sg_io_hdr_t __user *usr_ptr =
			    ((Sg_request *) (SCpnt->sc_request->
					     upper_private_data))->header.
			    usr_ptr;

			if (usr_ptr)
				get_user(adpt_flags, &usr_ptr->flags);
		}

		switch (i2o_dev->lct_data.class_id) {
		case I2O_CLASS_EXECUTIVE:
		case I2O_CLASS_RANDOM_BLOCK_STORAGE:
			/* interpret flag has to be set for executive */
			adpt_flags ^= I2O_DPT_SG_FLAG_INTERPRET;
			break;

		default:
			break;
		}

		/*
		 * for Adaptec controllers we use the PRIVATE command, because
		 * the normal SCSI EXEC doesn't support all SCSI commands on
		 * all controllers (for example READ CAPACITY).
		 */
		if (sgl_offset == SGL_OFFSET_10)
			sgl_offset = SGL_OFFSET_12;
		cmd = I2O_CMD_PRIVATE << 24;
		writel(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC, mptr++);
		writel(adpt_flags | tid, mptr++);
	}
#endif


and here is the sg_request.h header:



static Scsi_Request *dummy_cmdp;

typedef struct sg_scatter_hold {
	unsigned short k_use_sg;
	unsigned short sglist_len;
	unsigned bufflen;
	unsigned b_malloc_len;
	void *buffer;
	char dio_in_use;
	unsigned char cmd_opcode;
} Sg_scatter_hold;

typedef struct sg_request {
	Scsi_Request *my_cmdp;
	struct sg_request *nextrp;
	struct sg_fd *parentfp;
	Sg_scatter_hold data;
	sg_io_hdr_t header;
	unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)];
	char res_used;
	char orphan;
	char sg_io_owned;
	volatile char done;
} Sg_request;


So please if you have anything against it, or know a better solution how 
a program could get some information to the LLD (at least 2 bits so far), 
please let me know...


Thank you very much in advance.


Best regards,



Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11

E-Mail: Markus.Lidel@shadowconnect.com
URL:    http://www.shadowconnect.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-10 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 22:51 request for comments on sg_request changes (again) Markus Lidel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox