Commit 6a1dcf3c authored by James Bottomley's avatar James Bottomley

Merge mulgrave.(none):/home/jejb/BK/scsi-misc-2.5

into mulgrave.(none):/home/jejb/BK/scsi-for-linus-2.5
parents 8428b10d 534a4bf2
......@@ -322,8 +322,6 @@ static Scsi_Request * osst_do_scsi(Scsi_Request *SRpnt, OS_Scsi_Tape *STp,
}
}
if (SRpnt->sr_device->scsi_level <= SCSI_2)
cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0;
init_completion(&STp->wait);
SRpnt->sr_use_sg = (bytes > (STp->buffer)->sg[0].length) ?
(STp->buffer)->use_sg : 0;
......
......@@ -798,6 +798,12 @@ int scsi_dispatch_cmd(Scsi_Cmnd * SCpnt)
serial_number = 1;
SCpnt->serial_number = serial_number;
SCpnt->pid = scsi_pid++;
/*
* If SCSI-2 or lower, store the LUN value in cmnd.
*/
if (SCpnt->device->scsi_level <= SCSI_2)
SCpnt->cmnd[1] = (SCpnt->cmnd[1] & 0x1f) |
(SCpnt->lun << 5 & 0xe0);
/*
* We will wait MIN_RESET_DELAY clock ticks after the last reset so
......
......@@ -108,9 +108,13 @@ static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB;
#define SDEBUG_SENSE_LEN 32
struct sdebug_dev_info {
Scsi_Device * sdp;
unsigned char sense_buff[SDEBUG_SENSE_LEN]; /* weak nexus */
unsigned int channel;
unsigned int target;
unsigned int lun;
struct Scsi_Host *host;
char reset;
char used;
};
static struct sdebug_dev_info * devInfop;
......@@ -154,7 +158,7 @@ static int resp_write(Scsi_Cmnd * SCpnt, int upper_blk, int block, int num,
static int resp_report_luns(unsigned char * cmd, unsigned char * buff,
int bufflen, struct sdebug_dev_info * devip);
static void timer_intr_handler(unsigned long);
static struct sdebug_dev_info * devInfoReg(Scsi_Device * sdp);
static struct sdebug_dev_info * devInfoReg(Scsi_Cmnd *scmd);
static void mk_sense_buffer(struct sdebug_dev_info * devip, int key,
int asc, int asq, int inbandLen);
static int check_reset(Scsi_Cmnd * SCpnt, struct sdebug_dev_info * devip);
......@@ -222,7 +226,7 @@ int scsi_debug_queuecommand(Scsi_Cmnd * SCpnt, done_funct_t done)
return schedule_resp(SCpnt, NULL, done, 0, 0);
}
if ((target > driver_template.this_id) || (SCpnt->lun != 0))
if (SCpnt->lun != 0)
return schedule_resp(SCpnt, NULL, done,
DID_NO_CONNECT << 16, 0);
#if 0
......@@ -230,14 +234,10 @@ int scsi_debug_queuecommand(Scsi_Cmnd * SCpnt, done_funct_t done)
(int)SCpnt->device->host->host_no, (int)SCpnt->device->id,
SCpnt->device, (int)*cmd);
#endif
if (NULL == SCpnt->device->hostdata) {
devip = devInfoReg(SCpnt->device);
if (NULL == devip)
return schedule_resp(SCpnt, NULL, done,
DID_NO_CONNECT << 16, 0);
SCpnt->device->hostdata = devip;
}
devip = SCpnt->device->hostdata;
devip = devInfoReg(SCpnt);
if (NULL == devip)
return schedule_resp(SCpnt, NULL, done,
DID_NO_CONNECT << 16, 0);
if ((SCSI_DEBUG_OPT_EVERY_NTH & scsi_debug_opts) &&
(scsi_debug_every_nth > 0) &&
......@@ -474,8 +474,8 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff,
int dev_id_num, len;
char dev_id_str[6];
dev_id_num = ((devip->sdp->host->host_no + 1) * 1000) +
devip->sdp->id;
dev_id_num = ((devip->host->host_no + 1) * 1000) +
devip->target;
len = snprintf(dev_id_str, 6, "%d", dev_id_num);
len = (len > 6) ? 6 : len;
if (0 == cmd[2]) { /* supported vital product data pages */
......@@ -870,21 +870,28 @@ static int scsi_debug_release(struct Scsi_Host * hpnt)
return 0;
}
static struct sdebug_dev_info * devInfoReg(Scsi_Device * sdp)
static struct sdebug_dev_info * devInfoReg(Scsi_Cmnd *scmd)
{
int k;
struct sdebug_dev_info * devip;
for (k = 0; k < scsi_debug_num_devs; ++k) {
devip = &devInfop[k];
if (devip->sdp == sdp)
if ((devip->channel == scmd->channel) &&
(devip->target == scmd->target) &&
(devip->lun == scmd->lun) &&
(devip->host == scmd->host))
return devip;
}
for (k = 0; k < scsi_debug_num_devs; ++k) {
devip = &devInfop[k];
if (NULL == devip->sdp) {
devip->sdp = sdp;
if (!devip->used) {
devip->channel = scmd->channel;
devip->target = scmd->target;
devip->lun = scmd->lun;
devip->host = scmd->host;
devip->reset = 1;
devip->used = 1;
memset(devip->sense_buff, 0, SDEBUG_SENSE_LEN);
devip->sense_buff[0] = 0x70;
return devip;
......@@ -934,19 +941,15 @@ static int scsi_debug_biosparam(Disk * disk, struct block_device * bdev,
static int scsi_debug_device_reset(Scsi_Cmnd * SCpnt)
{
Scsi_Device * sdp;
int k;
struct sdebug_dev_info * devip;
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
printk(KERN_INFO "scsi_debug: device_reset\n");
++num_dev_resets;
if (SCpnt && ((sdp = SCpnt->device))) {
for (k = 0; k < scsi_debug_num_devs; ++k) {
if (sdp->hostdata == (devInfop + k))
break;
}
if (k < scsi_debug_num_devs)
devInfop[k].reset = 1;
if (SCpnt) {
devip = devInfoReg(SCpnt);
if (devip)
devip->reset = 1;
}
return SUCCESS;
}
......@@ -960,9 +963,9 @@ static int scsi_debug_bus_reset(Scsi_Cmnd * SCpnt)
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
printk(KERN_INFO "scsi_debug: bus_reset\n");
++num_bus_resets;
if (SCpnt && ((sdp = SCpnt->device)) && ((hp = sdp->host))) {
if (SCpnt && ((sdp = SCpnt->device)) && ((hp = SCpnt->host))) {
for (k = 0; k < scsi_debug_num_devs; ++k) {
if (hp == devInfop[k].sdp->host)
if (hp == devInfop[k].host)
devInfop[k].reset = 1;
}
}
......
......@@ -502,6 +502,10 @@ static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
*/
scmd->owner = SCSI_OWNER_LOWLEVEL;
if (scmd->device->scsi_level <= SCSI_2)
scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
(scmd->lun << 5 & 0xe0);
if (host->can_queue) {
DECLARE_MUTEX_LOCKED(sem);
......@@ -610,9 +614,6 @@ static int scsi_request_sense(Scsi_Cmnd *scmd)
memcpy((void *) scmd->cmnd, (void *) generic_sense,
sizeof(generic_sense));
if (scmd->device->scsi_level <= SCSI_2)
scmd->cmnd[1] = scmd->lun << 5;
scsi_result = (!scmd->host->hostt->unchecked_isa_dma)
? &scsi_result0[0] : kmalloc(512, GFP_ATOMIC | GFP_DMA);
......@@ -839,9 +840,6 @@ static int scsi_eh_tur(Scsi_Cmnd *scmd)
memcpy((void *) scmd->cmnd, (void *) tur_command,
sizeof(tur_command));
if (scmd->device->scsi_level <= SCSI_2)
scmd->cmnd[1] = scmd->lun << 5;
/*
* zero the sense buffer. the scsi spec mandates that any
* untransferred sense data should be interpreted as being zero.
......@@ -1419,7 +1417,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
}
sreq->sr_cmnd[0] = ALLOW_MEDIUM_REMOVAL;
sreq->sr_cmnd[1] = (sdev->scsi_level <= SCSI_2) ? (sdev->lun << 5) : 0;
sreq->sr_cmnd[1] = 0;
sreq->sr_cmnd[2] = 0;
sreq->sr_cmnd[3] = 0;
sreq->sr_cmnd[4] = SCSI_REMOVAL_PREVENT;
......
......@@ -160,7 +160,7 @@ int scsi_set_medium_removal(Scsi_Device *dev, char state)
return 0;
scsi_cmd[0] = ALLOW_MEDIUM_REMOVAL;
scsi_cmd[1] = (dev->scsi_level <= SCSI_2) ? (dev->lun << 5) : 0;
scsi_cmd[1] = 0;
scsi_cmd[2] = 0;
scsi_cmd[3] = 0;
scsi_cmd[4] = state;
......@@ -297,12 +297,6 @@ int scsi_ioctl_send_command(Scsi_Device * dev, Scsi_Ioctl_Command * sic)
if(copy_from_user(buf, cmd_in + cmdlen, inlen))
goto error;
/*
* Set the lun field to the correct value.
*/
if (dev->scsi_level <= SCSI_2)
cmd[1] = (cmd[1] & 0x1f) | (dev->lun << 5);
switch (opcode) {
case FORMAT_UNIT:
timeout = FORMAT_UNIT_TIMEOUT;
......@@ -416,7 +410,6 @@ scsi_ioctl_get_pci(Scsi_Device * dev, void *arg)
int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
{
char scsi_cmd[MAX_COMMAND_SIZE];
char cmd_byte1;
/* No idea how this happens.... */
if (!dev)
......@@ -431,7 +424,6 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
if (!scsi_block_when_processing_errors(dev)) {
return -ENODEV;
}
cmd_byte1 = (dev->scsi_level <= SCSI_2) ? (dev->lun << 5) : 0;
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
......@@ -484,7 +476,7 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
return scsi_set_medium_removal(dev, SCSI_REMOVAL_ALLOW);
case SCSI_IOCTL_TEST_UNIT_READY:
scsi_cmd[0] = TEST_UNIT_READY;
scsi_cmd[1] = cmd_byte1;
scsi_cmd[1] = 0;
scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
scsi_cmd[4] = 0;
return ioctl_internal_command((Scsi_Device *) dev, scsi_cmd,
......@@ -492,7 +484,7 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
break;
case SCSI_IOCTL_START_UNIT:
scsi_cmd[0] = START_STOP;
scsi_cmd[1] = cmd_byte1;
scsi_cmd[1] = 0;
scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
scsi_cmd[4] = 1;
return ioctl_internal_command((Scsi_Device *) dev, scsi_cmd,
......@@ -500,7 +492,7 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
break;
case SCSI_IOCTL_STOP_UNIT:
scsi_cmd[0] = START_STOP;
scsi_cmd[1] = cmd_byte1;
scsi_cmd[1] = 0;
scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0;
scsi_cmd[4] = 0;
return ioctl_internal_command((Scsi_Device *) dev, scsi_cmd,
......
......@@ -291,15 +291,11 @@ __setup("max_scsi_report_luns=", scsi_report_luns_setup);
**/
static void scsi_unlock_floptical(Scsi_Request *sreq, unsigned char *result)
{
Scsi_Device *sdscan = sreq->sr_device;
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
printk(KERN_NOTICE "scsi: unlocking floptical drive\n");
scsi_cmd[0] = MODE_SENSE;
if (sdscan->scsi_level <= SCSI_2)
scsi_cmd[1] = (sdscan->lun << 5) & 0xe0;
else
scsi_cmd[1] = 0;
scsi_cmd[1] = 0;
scsi_cmd[2] = 0x2e;
scsi_cmd[3] = 0;
scsi_cmd[4] = 0x2a; /* size */
......@@ -611,8 +607,6 @@ unsigned char *scsi_get_evpd_page(Scsi_Device *sdev, Scsi_Request *sreq)
{
unsigned char *evpd_page;
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
int lun = sdev->lun;
int scsi_level = sdev->scsi_level;
int max_lgth = 255;
retry:
......@@ -629,10 +623,7 @@ unsigned char *scsi_get_evpd_page(Scsi_Device *sdev, Scsi_Request *sreq)
memset(scsi_cmd, 0, MAX_COMMAND_SIZE);
scsi_cmd[0] = INQUIRY;
if ((lun > 0) && (scsi_level <= SCSI_2))
scsi_cmd[1] = ((lun << 5) & 0xe0) | 0x01;
else
scsi_cmd[1] = 0x01; /* SCSI_3 and higher, don't touch */
scsi_cmd[1] = 0x01;
scsi_cmd[4] = max_lgth;
sreq->sr_cmd_len = 0;
sreq->sr_sense_buffer[0] = 0;
......@@ -870,8 +861,6 @@ int scsi_get_deviceid(Scsi_Device *sdev, Scsi_Request *sreq)
unsigned char *id_page;
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
int id_idx, scnt, ret;
int lun = sdev->lun;
int scsi_level = sdev->scsi_level;
int max_lgth = 255;
retry:
......@@ -888,10 +877,7 @@ int scsi_get_deviceid(Scsi_Device *sdev, Scsi_Request *sreq)
memset(scsi_cmd, 0, MAX_COMMAND_SIZE);
scsi_cmd[0] = INQUIRY;
if ((lun > 0) && (scsi_level <= SCSI_2))
scsi_cmd[1] = ((lun << 5) & 0xe0) | 0x01;
else
scsi_cmd[1] = 0x01; /* SCSI_3 and higher, don't touch */
scsi_cmd[1] = 0x01;
scsi_cmd[2] = 0x83;
scsi_cmd[4] = max_lgth;
sreq->sr_cmd_len = 0;
......@@ -977,8 +963,6 @@ int scsi_get_serialnumber(Scsi_Device *sdev, Scsi_Request *sreq)
{
unsigned char *serialnumber_page;
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
int lun = sdev->lun;
int scsi_level = sdev->scsi_level;
int max_lgth = 255;
retry:
......@@ -995,10 +979,7 @@ int scsi_get_serialnumber(Scsi_Device *sdev, Scsi_Request *sreq)
memset(scsi_cmd, 0, MAX_COMMAND_SIZE);
scsi_cmd[0] = INQUIRY;
if ((lun > 0) && (scsi_level <= SCSI_2))
scsi_cmd[1] = ((lun << 5) & 0xe0) | 0x01;
else
scsi_cmd[1] = 0x01; /* SCSI_3 and higher, don't touch */
scsi_cmd[1] = 0x01;
scsi_cmd[2] = 0x80;
scsi_cmd[4] = max_lgth;
sreq->sr_cmd_len = 0;
......@@ -1181,8 +1162,6 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result,
memset(scsi_cmd, 0, 6);
scsi_cmd[0] = INQUIRY;
if ((sdev->lun > 0) && (sdev->scsi_level <= SCSI_2))
scsi_cmd[1] = (sdev->lun << 5) & 0xe0;
scsi_cmd[4] = 36; /* issue conservative alloc_length */
sreq->sr_cmd_len = 0;
sreq->sr_data_direction = SCSI_DATA_READ;
......@@ -1230,8 +1209,6 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result,
if (possible_inq_resp_len > 36) { /* do additional INQUIRY */
memset(scsi_cmd, 0, 6);
scsi_cmd[0] = INQUIRY;
if ((sdev->lun > 0) && (sdev->scsi_level <= SCSI_2))
scsi_cmd[1] = (sdev->lun << 5) & 0xe0;
scsi_cmd[4] = (unsigned char) possible_inq_resp_len;
sreq->sr_cmd_len = 0;
sreq->sr_data_direction = SCSI_DATA_READ;
......
......@@ -402,8 +402,7 @@ static int sd_init_command(Scsi_Cmnd * SCpnt)
nbuff, (rq_data_dir(SCpnt->request) == WRITE) ?
"writing" : "reading", this_count, SCpnt->request->nr_sectors));
SCpnt->cmnd[1] = (SCpnt->device->scsi_level <= SCSI_2) ?
((SCpnt->lun << 5) & 0xe0) : 0;
SCpnt->cmnd[1] = 0;
if (((this_count > 0xff) || (block > 0x1fffff)) || SCpnt->device->ten) {
if (this_count > 0xffff)
......@@ -815,9 +814,7 @@ sd_spinup_disk(Scsi_Disk *sdkp, char *diskname,
while (retries < 3) {
cmd[0] = TEST_UNIT_READY;
cmd[1] = (sdp->scsi_level <= SCSI_2) ?
((sdp->lun << 5) & 0xe0) : 0;
memset((void *) &cmd[2], 0, 8);
memset((void *) &cmd[1], 0, 9);
SRpnt->sr_cmd_len = 0;
SRpnt->sr_sense_buffer[0] = 0;
......@@ -851,9 +848,7 @@ sd_spinup_disk(Scsi_Disk *sdkp, char *diskname,
printk(KERN_NOTICE "%s: Spinning up disk...",
diskname);
cmd[0] = START_STOP;
cmd[1] = (sdp->scsi_level <= SCSI_2) ?
((sdp->lun << 5) & 0xe0) : 0;
cmd[1] |= 1; /* Return immediately */
cmd[1] = 1; /* Return immediately */
memset((void *) &cmd[2], 0, 8);
cmd[4] = 1; /* Start spin cycle */
SRpnt->sr_cmd_len = 0;
......@@ -894,7 +889,6 @@ sd_read_cache_type(Scsi_Disk *sdkp, char *diskname,
Scsi_Request *SRpnt, unsigned char *buffer) {
unsigned char cmd[10];
Scsi_Device *sdp = sdkp->device;
int the_result, retries;
retries = 3;
......@@ -902,9 +896,7 @@ sd_read_cache_type(Scsi_Disk *sdkp, char *diskname,
memset((void *) &cmd[0], 0, 10);
cmd[0] = MODE_SENSE;
cmd[1] = (sdp->scsi_level <= SCSI_2) ?
((sdp->lun << 5) & 0xe0) : 0;
cmd[1] |= 0x08; /* DBD */
cmd[1] = 0x08; /* DBD */
cmd[2] = 0x08; /* current values, cache page */
cmd[4] = 128; /* allocation length */
......@@ -968,9 +960,7 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname,
retries = 3;
do {
cmd[0] = READ_CAPACITY;
cmd[1] = (sdp->scsi_level <= SCSI_2) ?
((sdp->lun << 5) & 0xe0) : 0;
memset((void *) &cmd[2], 0, 8);
memset((void *) &cmd[1], 0, 9);
memset((void *) buffer, 0, 8);
SRpnt->sr_cmd_len = 0;
......@@ -1090,7 +1080,6 @@ sd_do_mode_sense6(Scsi_Device *sdp, Scsi_Request *SRpnt,
memset((void *) &cmd[0], 0, 8);
cmd[0] = MODE_SENSE;
cmd[1] = (sdp->scsi_level <= SCSI_2) ? ((sdp->lun << 5) & 0xe0) : 0;
cmd[2] = modepage;
cmd[4] = len;
......@@ -1611,7 +1600,6 @@ static int sd_synchronize_cache(int index, int verbose)
unsigned char cmd[10] = { 0 };
cmd[0] = SYNCHRONIZE_CACHE;
cmd[1] = SDpnt->scsi_level <= SCSI_2 ? (SDpnt->lun << 5) & 0xe0 : 0;
/* leave the rest of the command zero to indicate
* flush everything */
scsi_wait_req(SRpnt, (void *)cmd, NULL, 0,
......
......@@ -705,10 +705,6 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
SRpnt->sr_request->rq_dev = sdp->i_rdev;
SRpnt->sr_sense_buffer[0] = 0;
SRpnt->sr_cmd_len = hp->cmd_len;
if (!(hp->flags & SG_FLAG_LUN_INHIBIT)) {
if (sdp->device->scsi_level <= SCSI_2)
cmnd[1] = (cmnd[1] & 0x1f) | (sdp->device->lun << 5);
}
SRpnt->sr_use_sg = srp->data.k_use_sg;
SRpnt->sr_sglist_len = srp->data.sglist_len;
SRpnt->sr_bufflen = srp->data.bufflen;
......
......@@ -336,9 +336,7 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
(rq_data_dir(SCpnt->request) == WRITE) ? "writing" : "reading",
this_count, SCpnt->request->nr_sectors));
SCpnt->cmnd[1] = (SCpnt->device->scsi_level <= SCSI_2) ?
((SCpnt->lun << 5) & 0xe0) : 0;
SCpnt->cmnd[1] = 0;
block = (unsigned int)SCpnt->request->sector / (s_size >> 9);
if (this_count > 0xffff)
......@@ -486,9 +484,7 @@ static void get_sectorsize(Scsi_CD *cd)
do {
cmd[0] = READ_CAPACITY;
cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun << 5) & 0xe0) : 0;
memset((void *) &cmd[2], 0, 8);
memset((void *) &cmd[1], 0, 9);
SRpnt->sr_request->rq_status = RQ_SCSI_BUSY; /* Mark as really busy */
SRpnt->sr_cmd_len = 0;
......@@ -599,8 +595,6 @@ void get_capabilities(Scsi_CD *cd)
}
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = MODE_SENSE;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun << 5) & 0xe0) : 0;
cgc.cmd[2] = 0x2a;
cgc.cmd[4] = 128;
cgc.buffer = buffer;
......@@ -678,13 +672,6 @@ void get_capabilities(Scsi_CD *cd)
*/
static int sr_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command *cgc)
{
Scsi_CD *cd = cdi->handle;
Scsi_Device *device = cd->device;
/* set the LUN */
if (device->scsi_level <= SCSI_2)
cgc->cmd[1] |= device->lun << 5;
if (cgc->timeout <= 0)
cgc->timeout = IOCTL_TIMEOUT;
......
......@@ -200,8 +200,6 @@ static int test_unit_ready(Scsi_CD *cd)
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_TEST_UNIT_READY;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.quiet = 1;
cgc.data_direction = SCSI_DATA_NONE;
cgc.timeout = IOCTL_TIMEOUT;
......@@ -215,8 +213,6 @@ int sr_tray_move(struct cdrom_device_info *cdi, int pos)
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_START_STOP_UNIT;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
cgc.data_direction = SCSI_DATA_NONE;
cgc.timeout = IOCTL_TIMEOUT;
......@@ -293,8 +289,6 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.cmd[2] = 0x40; /* I do want the subchannel info */
cgc.cmd[3] = 0x02; /* Give me medium catalog number info */
cgc.cmd[8] = 24;
......@@ -327,8 +321,6 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */
cgc.cmd[3] = speed & 0xff; /* LSB */
cgc.data_direction = SCSI_DATA_NONE;
......@@ -361,8 +353,6 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.cmd[8] = 12; /* LSB of length */
cgc.buffer = buffer;
cgc.buflen = 12;
......@@ -382,8 +372,6 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_tocentry *tocentry = (struct cdrom_tocentry *) arg;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((cd->device->lun) << 5) : 0;
cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0;
cgc.cmd[6] = tocentry->cdte_track;
cgc.cmd[8] = 12; /* LSB of length */
......@@ -411,8 +399,6 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_ti* ti = (struct cdrom_ti*)arg;
cgc.cmd[0] = GPCMD_PLAYAUDIO_TI;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[4] = ti->cdti_trk0;
cgc.cmd[5] = ti->cdti_ind0;
cgc.cmd[7] = ti->cdti_trk1;
......@@ -463,9 +449,7 @@ static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_READ_CD; /* READ_CD */
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[1] |= ((format & 7) << 2);
cgc.cmd[1] = ((format & 7) << 2);
cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff;
......@@ -521,8 +505,6 @@ static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = GPCMD_READ_10;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
cgc.cmd[4] = (unsigned char) (lba >> 8) & 0xff;
......
......@@ -124,9 +124,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength)
#endif
memset(&cgc, 0, sizeof(struct cdrom_generic_command));
cgc.cmd[0] = MODE_SELECT;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[1] |= (1 << 4);
cgc.cmd[1] = (1 << 4);
cgc.cmd[4] = 12;
modesel = (struct ccs_modesel_head *) buffer;
memset(modesel, 0, sizeof(*modesel));
......@@ -180,8 +178,6 @@ int sr_cd_check(struct cdrom_device_info *cdi)
case VENDOR_SCSI3:
cgc.cmd[0] = READ_TOC;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[8] = 12;
cgc.cmd[9] = 0x40;
cgc.buffer = buffer;
......@@ -210,9 +206,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
case VENDOR_NEC:{
unsigned long min, sec, frame;
cgc.cmd[0] = 0xde;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[1] |= 0x03;
cgc.cmd[1] = 0x03;
cgc.cmd[2] = 0xb0;
cgc.buffer = buffer;
cgc.buflen = 0x16;
......@@ -242,9 +236,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
/* we request some disc information (is it a XA-CD ?,
* where starts the last session ?) */
cgc.cmd[0] = 0xc7;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[1] |= 0x03;
cgc.cmd[1] = 0x03;
cgc.buffer = buffer;
cgc.buflen = 4;
cgc.quiet = 1;
......@@ -272,8 +264,6 @@ int sr_cd_check(struct cdrom_device_info *cdi)
case VENDOR_WRITER:
cgc.cmd[0] = READ_TOC;
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[8] = 0x04;
cgc.cmd[9] = 0x40;
cgc.buffer = buffer;
......@@ -291,8 +281,6 @@ int sr_cd_check(struct cdrom_device_info *cdi)
break;
}
cgc.cmd[0] = READ_TOC; /* Read TOC */
cgc.cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(cd->device->lun << 5) : 0;
cgc.cmd[6] = rc & 0x7f; /* number of last session */
cgc.cmd[8] = 0x0c;
cgc.cmd[9] = 0x40;
......
......@@ -381,8 +381,6 @@ static Scsi_Request *
}
}
if (SRpnt->sr_device->scsi_level <= SCSI_2)
cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0;
init_completion(&STp->wait);
SRpnt->sr_use_sg = STp->buffer->do_dio || (bytes > (STp->buffer)->frp[0].length);
if (SRpnt->sr_use_sg) {
......
......@@ -130,7 +130,7 @@ typedef struct sg_io_hdr
/* following flag values can be "or"-ed together */
#define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */
#define SG_FLAG_LUN_INHIBIT 2 /* default is overwrite lun in SCSI */
#define SG_FLAG_UNUSED_LUN_INHIBIT 2 /* default is overwrite lun in SCSI */
/* command block (when <= SCSI_2) */
#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */
#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment