Commit e35ad7ae authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-scsi.bkbits.net/scsi-for-linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 9a11cf9e 4075c99a
...@@ -1297,7 +1297,6 @@ Scsi_Host_Template aic7xxx_driver_template = { ...@@ -1297,7 +1297,6 @@ Scsi_Host_Template aic7xxx_driver_template = {
*/ */
.max_sectors = 8192, .max_sectors = 8192,
#endif #endif
#if defined CONFIG_HIGHIO
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
/* Assume RedHat Distribution with its different HIGHIO conventions. */ /* Assume RedHat Distribution with its different HIGHIO conventions. */
.can_dma_32 = 1, .can_dma_32 = 1,
...@@ -1305,7 +1304,6 @@ Scsi_Host_Template aic7xxx_driver_template = { ...@@ -1305,7 +1304,6 @@ Scsi_Host_Template aic7xxx_driver_template = {
#else #else
.highmem_io = 1, .highmem_io = 1,
#endif #endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
.name = "aic7xxx", .name = "aic7xxx",
.slave_alloc = ahc_linux_slave_alloc, .slave_alloc = ahc_linux_slave_alloc,
......
...@@ -166,6 +166,9 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -166,6 +166,9 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahc->flags |= AHC_39BIT_ADDRESSING; ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask = ahc->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0); (bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
} else {
ahc_pci_set_dma_mask(pdev, 0xffffffffULL);
ahc->platform_data->hw_dma_mask = 0xffffffffULL;
} }
#endif #endif
ahc->dev_softc = pci; ahc->dev_softc = pci;
......
...@@ -16,15 +16,15 @@ ...@@ -16,15 +16,15 @@
Copyright 1992 - 2002 Kai Makisara / Willem Riede Copyright 1992 - 2002 Kai Makisara / Willem Riede
email Kai.Makisara@metla.fi / osst@riede.org email Kai.Makisara@metla.fi / osst@riede.org
$Header: /home/cvsroot/Driver/osst.c,v 1.65 2001/11/11 20:38:56 riede Exp $ $Header: /home/cvsroot/Driver/osst.c,v 1.68 2002/12/23 16:33:36 riede Exp $
Microscopic alterations - Rik Ling, 2000/12/21 Microscopic alterations - Rik Ling, 2000/12/21
Last st.c sync: Tue Oct 15 22:01:04 2002 by makisara Last st.c sync: Tue Oct 15 22:01:04 2002 by makisara
Some small formal changes - aeb, 950809 Some small formal changes - aeb, 950809
*/ */
static const char * cvsid = "$Id: osst.c,v 1.65 2001/11/11 20:38:56 riede Exp $"; static const char * cvsid = "$Id: osst.c,v 1.68 2002/12/23 16:33:36 riede Exp $";
const char * osst_version = "0.99.0p5"; const char * osst_version = "0.99.0";
/* The "failure to reconnect" firmware bug */ /* The "failure to reconnect" firmware bug */
#define OSST_FW_NEED_POLL_MIN 10601 /*(107A)*/ #define OSST_FW_NEED_POLL_MIN 10601 /*(107A)*/
...@@ -470,7 +470,7 @@ static void osst_init_aux(OS_Scsi_Tape * STp, int frame_type, int frame_seq_numb ...@@ -470,7 +470,7 @@ static void osst_init_aux(OS_Scsi_Tape * STp, int frame_type, int frame_seq_numb
*/ */
static int osst_verify_frame(OS_Scsi_Tape * STp, int frame_seq_number, int quiet) static int osst_verify_frame(OS_Scsi_Tape * STp, int frame_seq_number, int quiet)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
os_aux_t * aux = STp->buffer->aux; os_aux_t * aux = STp->buffer->aux;
os_partition_t * par = &(aux->partition); os_partition_t * par = &(aux->partition);
ST_partstat * STps = &(STp->ps[STp->partition]); ST_partstat * STps = &(STp->ps[STp->partition]);
...@@ -676,7 +676,7 @@ static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsi ...@@ -676,7 +676,7 @@ static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsi
long startwait = jiffies; long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached onstream wait for medium\n", name); printk(OSST_DEB_MSG "%s:D: Reached onstream wait for medium\n", name);
#endif #endif
...@@ -748,7 +748,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -748,7 +748,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
int result = 0; int result = 0;
int delay = OSST_WAIT_WRITE_COMPLETE; int delay = OSST_WAIT_WRITE_COMPLETE;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached onstream flush drive buffer (write filemark)\n", name); printk(OSST_DEB_MSG "%s:D: Reached onstream flush drive buffer (write filemark)\n", name);
#endif #endif
...@@ -778,7 +778,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -778,7 +778,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to) static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to)
{ {
long startwait = jiffies; long startwait = jiffies;
char *name = tape_name(STp); char * name = tape_name(STp);
#if DEBUG #if DEBUG
char notyetprinted = 1; char notyetprinted = 1;
#endif #endif
...@@ -841,7 +841,7 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo ...@@ -841,7 +841,7 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo
int retval = 0; int retval = 0;
#if DEBUG #if DEBUG
os_aux_t * aux = STp->buffer->aux; os_aux_t * aux = STp->buffer->aux;
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
/* TODO: Error handling */ /* TODO: Error handling */
...@@ -888,10 +888,12 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo ...@@ -888,10 +888,12 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo
STp->first_frame_position++; STp->first_frame_position++;
#if DEBUG #if DEBUG
if (debugging) { if (debugging) {
char sig[8]; int i;
for (i=0;i<4;i++)
sig[i] = aux->application_sig[i]<32?'^':aux->application_sig[i];
sig[4] = '\0';
printk(OSST_DEB_MSG printk(OSST_DEB_MSG
"%s:D: AUX: %c%c%c%c UpdFrCt#%d Wpass#%d %s FrSeq#%d LogBlk#%d Qty=%d Sz=%d\n", name, "%s:D: AUX: %s UpdFrCt#%d Wpass#%d %s FrSeq#%d LogBlk#%d Qty=%d Sz=%d\n", name, sig,
aux->application_sig[0], aux->application_sig[1],
aux->application_sig[2], aux->application_sig[3],
ntohl(aux->update_frame_cntr), ntohs(aux->partition.wrt_pass_cntr), ntohl(aux->update_frame_cntr), ntohs(aux->partition.wrt_pass_cntr),
aux->frame_type==1?"EOD":aux->frame_type==2?"MARK": aux->frame_type==1?"EOD":aux->frame_type==2?"MARK":
aux->frame_type==8?"HEADR":aux->frame_type==0x80?"DATA":"FILL", aux->frame_type==8?"HEADR":aux->frame_type==0x80?"DATA":"FILL",
...@@ -913,7 +915,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -913,7 +915,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
int retval = 0; int retval = 0;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
if (STps->rw != ST_READING) { /* Initialize read operation */ if (STps->rw != ST_READING) { /* Initialize read operation */
...@@ -947,7 +949,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -947,7 +949,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame_seq_number, int quiet) static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame_seq_number, int quiet)
{ {
ST_partstat * STps = &(STp->ps[STp->partition]); ST_partstat * STps = &(STp->ps[STp->partition]);
char *name = tape_name(STp); char * name = tape_name(STp);
int cnt = 0, int cnt = 0,
bad = 0, bad = 0,
past = 0, past = 0,
...@@ -1073,7 +1075,7 @@ static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in ...@@ -1073,7 +1075,7 @@ static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in
static int osst_seek_logical_blk(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int logical_blk_num) static int osst_seek_logical_blk(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int logical_blk_num)
{ {
ST_partstat * STps = &(STp->ps[STp->partition]); ST_partstat * STps = &(STp->ps[STp->partition]);
char *name = tape_name(STp); char * name = tape_name(STp);
int retries = 0; int retries = 0;
int frame_seq_estimate, ppos_estimate, move; int frame_seq_estimate, ppos_estimate, move;
...@@ -1183,7 +1185,7 @@ static int osst_get_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -1183,7 +1185,7 @@ static int osst_get_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{ {
int sector; int sector;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG printk(OSST_DEB_MSG
"%s:D: Positioned at ppos %d, frame %d, lbn %d, file %d, blk %d, %cptr %d, eof %d\n", "%s:D: Positioned at ppos %d, frame %d, lbn %d, file %d, blk %d, %cptr %d, eof %d\n",
...@@ -1216,7 +1218,7 @@ static int osst_seek_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int sect ...@@ -1216,7 +1218,7 @@ static int osst_seek_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int sect
offset = (sector & OSST_SECTOR_MASK) << OSST_SECTOR_SHIFT, offset = (sector & OSST_SECTOR_MASK) << OSST_SECTOR_SHIFT,
r; r;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Seeking sector %d in frame %d at offset %d\n", printk(OSST_DEB_MSG "%s:D: Seeking sector %d in frame %d at offset %d\n",
name, sector, frame, offset); name, sector, frame, offset);
...@@ -1285,7 +1287,7 @@ static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request ** ...@@ -1285,7 +1287,7 @@ static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request **
- (nframes + pending - 1); - (nframes + pending - 1);
int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num) int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num)
- (nframes + pending - 1) * blks_per_frame; - (nframes + pending - 1) * blks_per_frame;
char *name = tape_name(STp); char * name = tape_name(STp);
long startwait = jiffies; long startwait = jiffies;
#if DEBUG #if DEBUG
int dbg = debugging; int dbg = debugging;
...@@ -1471,7 +1473,7 @@ static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, ...@@ -1471,7 +1473,7 @@ static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
char *name = tape_name(STp); char * name = tape_name(STp);
int expected = 0; int expected = 0;
int attempts = 1000 / skip; int attempts = 1000 / skip;
int flag = 1; int flag = 1;
...@@ -1574,7 +1576,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, ...@@ -1574,7 +1576,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
{ {
Scsi_Request * SRpnt = * aSRpnt; Scsi_Request * SRpnt = * aSRpnt;
ST_partstat * STps = & STp->ps[STp->partition]; ST_partstat * STps = & STp->ps[STp->partition];
char *name = tape_name(STp); char * name = tape_name(STp);
int retval = 0; int retval = 0;
int rw_state; int rw_state;
unsigned int frame, skip; unsigned int frame, skip;
...@@ -1650,7 +1652,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, ...@@ -1650,7 +1652,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
static int osst_space_over_filemarks_backward(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, static int osst_space_over_filemarks_backward(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
int mt_op, int mt_count) int mt_op, int mt_count)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
int cnt; int cnt;
int last_mark_ppos = -1; int last_mark_ppos = -1;
...@@ -1751,7 +1753,7 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque ...@@ -1751,7 +1753,7 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque
{ {
int cnt = 0; int cnt = 0;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached space_over_filemarks_forward_slow %d %d\n", name, mt_op, mt_count); printk(OSST_DEB_MSG "%s:D: Reached space_over_filemarks_forward_slow %d %d\n", name, mt_op, mt_count);
#endif #endif
...@@ -1803,8 +1805,8 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque ...@@ -1803,8 +1805,8 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque
static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
int mt_op, int mt_count) int mt_op, int mt_count)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
int cnt = 0, int cnt = 0,
next_mark_ppos = -1; next_mark_ppos = -1;
#if DEBUG #if DEBUG
...@@ -1954,8 +1956,8 @@ static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Reque ...@@ -1954,8 +1956,8 @@ static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Reque
static void osst_set_retries(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int retries) static void osst_set_retries(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int retries)
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt = * aSRpnt; Scsi_Request * SRpnt = * aSRpnt;
char *name = tape_name(STp); char * name = tape_name(STp);
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = MODE_SELECT; cmd[0] = MODE_SELECT;
...@@ -1989,7 +1991,7 @@ static int osst_write_filemark(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -1989,7 +1991,7 @@ static int osst_write_filemark(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
int this_mark_ppos = STp->first_frame_position; int this_mark_ppos = STp->first_frame_position;
int this_mark_lbn = STp->logical_blk_num; int this_mark_lbn = STp->logical_blk_num;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
if (STp->raw) return 0; if (STp->raw) return 0;
...@@ -2015,7 +2017,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -2015,7 +2017,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{ {
int result; int result;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
if (STp->raw) return 0; if (STp->raw) return 0;
...@@ -2036,7 +2038,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -2036,7 +2038,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
#if DEBUG #if DEBUG
printk(OSST_DEB_MSG "%s:D: Reached onstream write filler group %d\n", name, where); printk(OSST_DEB_MSG "%s:D: Reached onstream write filler group %d\n", name, where);
...@@ -2061,7 +2063,7 @@ static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int whe ...@@ -2061,7 +2063,7 @@ static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int whe
static int __osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) static int __osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
int result; int result;
#if DEBUG #if DEBUG
...@@ -2090,7 +2092,7 @@ static int osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int loc ...@@ -2090,7 +2092,7 @@ static int osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int loc
{ {
os_header_t * header; os_header_t * header;
int result; int result;
char *name = tape_name(STp); char * name = tape_name(STp);
#if DEBUG #if DEBUG
printk(OSST_DEB_MSG "%s:D: Writing tape header\n", name); printk(OSST_DEB_MSG "%s:D: Writing tape header\n", name);
...@@ -2175,7 +2177,7 @@ static int osst_reset_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -2175,7 +2177,7 @@ static int osst_reset_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int ppos) static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int ppos)
{ {
char *name = tape_name(STp); char * name = tape_name(STp);
os_header_t * header; os_header_t * header;
os_aux_t * aux; os_aux_t * aux;
char id_string[8]; char id_string[8];
...@@ -2352,10 +2354,10 @@ static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in ...@@ -2352,10 +2354,10 @@ static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in
static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{ {
int position, ppos; int position, ppos;
int first, last; int first, last;
int valid = 0; int valid = 0;
char *name = tape_name(STp); char * name = tape_name(STp);
position = osst_get_frame_position(STp, aSRpnt); position = osst_get_frame_position(STp, aSRpnt);
...@@ -2408,14 +2410,14 @@ static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) ...@@ -2408,14 +2410,14 @@ static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_verify_position(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) static int osst_verify_position(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{ {
int frame_position = STp->first_frame_position; int frame_position = STp->first_frame_position;
int frame_seq_numbr = STp->frame_seq_number; int frame_seq_numbr = STp->frame_seq_number;
int logical_blk_num = STp->logical_blk_num; int logical_blk_num = STp->logical_blk_num;
int halfway_frame = STp->frame_in_buffer; int halfway_frame = STp->frame_in_buffer;
int read_pointer = STp->buffer->read_pointer; int read_pointer = STp->buffer->read_pointer;
int prev_mark_ppos = -1; int prev_mark_ppos = -1;
int actual_mark_ppos, i, n; int actual_mark_ppos, i, n;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Verify that the tape is really the one we think before writing\n", name); printk(OSST_DEB_MSG "%s:D: Verify that the tape is really the one we think before writing\n", name);
#endif #endif
...@@ -2484,8 +2486,8 @@ static unsigned int osst_parse_firmware_rev (const char * str) ...@@ -2484,8 +2486,8 @@ static unsigned int osst_parse_firmware_rev (const char * str)
static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
char *name = tape_name(STp); char * name = tape_name(STp);
Scsi_Request * SRpnt = * aSRpnt; Scsi_Request * SRpnt = * aSRpnt;
osst_mode_parameter_header_t * header; osst_mode_parameter_header_t * header;
osst_block_size_page_t * bs; osst_block_size_page_t * bs;
osst_capabilities_page_t * cp; osst_capabilities_page_t * cp;
...@@ -2655,7 +2657,7 @@ static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) ...@@ -2655,7 +2657,7 @@ static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
static int cross_eof(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int forward) static int cross_eof(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int forward)
{ {
int result; int result;
char *name = tape_name(STp); char * name = tape_name(STp);
#if DEBUG #if DEBUG
if (debugging) if (debugging)
...@@ -2692,7 +2694,7 @@ static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) ...@@ -2692,7 +2694,7 @@ static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
char mybuf[24]; char mybuf[24];
char * olddata = STp->buffer->b_data; char * olddata = STp->buffer->b_data;
int oldsize = STp->buffer->buffer_size; int oldsize = STp->buffer->buffer_size;
char *name = tape_name(STp); char * name = tape_name(STp);
if (STp->ready != ST_READY) return (-EIO); if (STp->ready != ST_READY) return (-EIO);
...@@ -2765,8 +2767,8 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in ...@@ -2765,8 +2767,8 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
ST_partstat * STps; ST_partstat * STps;
int result = 0; int result = 0;
int pp = (ppos == 3000 && !skip)? 0 : ppos; int pp = (ppos == 3000 && !skip)? 0 : ppos;
char *name = tape_name(STp); char * name = tape_name(STp);
if (STp->ready != ST_READY) return (-EIO); if (STp->ready != ST_READY) return (-EIO);
...@@ -2824,12 +2826,12 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in ...@@ -2824,12 +2826,12 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in
/* Flush the write buffer (never need to write if variable blocksize). */ /* Flush the write buffer (never need to write if variable blocksize). */
static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
{ {
int offset, transfer, blks = 0; int offset, transfer, blks = 0;
int result = 0; int result = 0;
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt = *aSRpnt; Scsi_Request * SRpnt = *aSRpnt;
ST_partstat * STps; ST_partstat * STps;
char *name = tape_name(STp); char * name = tape_name(STp);
if ((STp->buffer)->writing) { if ((STp->buffer)->writing) {
if (SRpnt == (STp->buffer)->last_SRpnt) if (SRpnt == (STp->buffer)->last_SRpnt)
...@@ -2954,10 +2956,10 @@ static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) ...@@ -2954,10 +2956,10 @@ static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
seek_next is true. */ seek_next is true. */
static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int seek_next) static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int seek_next)
{ {
ST_partstat * STps; ST_partstat * STps;
int backspace = 0, result = 0; int backspace = 0, result = 0;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
/* /*
...@@ -3017,10 +3019,10 @@ static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int see ...@@ -3017,10 +3019,10 @@ static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int see
static int osst_write_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int synchronous) static int osst_write_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int synchronous)
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
int blks; int blks;
#if DEBUG #if DEBUG
char *name = tape_name(STp); char * name = tape_name(STp);
#endif #endif
if ((!STp-> raw) && (STp->first_frame_position == 0xbae)) { /* _must_ preserve buffer! */ if ((!STp-> raw) && (STp->first_frame_position == 0xbae)) { /* _must_ preserve buffer! */
...@@ -3139,16 +3141,16 @@ static void reset_state(OS_Scsi_Tape *STp) ...@@ -3139,16 +3141,16 @@ static void reset_state(OS_Scsi_Tape *STp)
/* Write command */ /* Write command */
static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos)
{ {
ssize_t total, retval = 0; ssize_t total, retval = 0;
ssize_t i, do_count, blks, transfer; ssize_t i, do_count, blks, transfer;
int write_threshold; int write_threshold;
int doing_write = 0; int doing_write = 0;
const char *b_point; const char * b_point;
Scsi_Request * SRpnt = NULL; Scsi_Request * SRpnt = NULL;
ST_mode * STm; ST_mode * STm;
ST_partstat * STps; ST_partstat * STps;
OS_Scsi_Tape * STp = filp->private_data; OS_Scsi_Tape * STp = filp->private_data;
char *name = tape_name(STp); char * name = tape_name(STp);
if (down_interruptible(&STp->lock)) if (down_interruptible(&STp->lock))
...@@ -3468,14 +3470,14 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name ...@@ -3468,14 +3470,14 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name
/* Read command */ /* Read command */
static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos) static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
{ {
ssize_t total, retval = 0; ssize_t total, retval = 0;
ssize_t i, transfer; ssize_t i, transfer;
int special; int special;
ST_mode * STm; ST_mode * STm;
ST_partstat * STps; ST_partstat * STps;
Scsi_Request *SRpnt = NULL; Scsi_Request * SRpnt = NULL;
OS_Scsi_Tape * STp = filp->private_data; OS_Scsi_Tape * STp = filp->private_data;
char *name = tape_name(STp); char * name = tape_name(STp);
if (down_interruptible(&STp->lock)) if (down_interruptible(&STp->lock))
...@@ -3523,8 +3525,7 @@ static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *p ...@@ -3523,8 +3525,7 @@ static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *p
goto out; goto out;
} }
if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && !do_door_lock(STp, 1))
!osst_int_ioctl(STp, &SRpnt, MTLOCK, 0))
STp->door_locked = ST_LOCKED_AUTO; STp->door_locked = ST_LOCKED_AUTO;
STps = &(STp->ps[STp->partition]); STps = &(STp->ps[STp->partition]);
...@@ -3683,10 +3684,10 @@ static void osst_log_options(OS_Scsi_Tape *STp, ST_mode *STm, char *name) ...@@ -3683,10 +3684,10 @@ static void osst_log_options(OS_Scsi_Tape *STp, ST_mode *STm, char *name)
static int osst_set_options(OS_Scsi_Tape *STp, long options) static int osst_set_options(OS_Scsi_Tape *STp, long options)
{ {
int value; int value;
long code; long code;
ST_mode *STm; ST_mode * STm;
char *name = tape_name(STp); char * name = tape_name(STp);
STm = &(STp->modes[STp->current_mode]); STm = &(STp->modes[STp->current_mode]);
if (!STm->defined) { if (!STm->defined) {
...@@ -3839,16 +3840,16 @@ static int osst_set_options(OS_Scsi_Tape *STp, long options) ...@@ -3839,16 +3840,16 @@ static int osst_set_options(OS_Scsi_Tape *STp, long options)
/* Internal ioctl function */ /* Internal ioctl function */
static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned int cmd_in, unsigned long arg) static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned int cmd_in, unsigned long arg)
{ {
int timeout; int timeout;
long ltmp; long ltmp;
int i, ioctl_result; int i, ioctl_result;
int chg_eof = TRUE; int chg_eof = TRUE;
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt = * aSRpnt; Scsi_Request * SRpnt = * aSRpnt;
ST_partstat * STps; ST_partstat * STps;
int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num; int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num;
int datalen = 0, direction = SCSI_DATA_NONE; int datalen = 0, direction = SCSI_DATA_NONE;
char *name = tape_name(STp); char * name = tape_name(STp);
if (STp->ready != ST_READY && cmd_in != MTLOAD) { if (STp->ready != ST_READY && cmd_in != MTLOAD) {
if (STp->ready == ST_NO_TAPE) if (STp->ready == ST_NO_TAPE)
...@@ -4208,15 +4209,15 @@ static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned i ...@@ -4208,15 +4209,15 @@ static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned i
static int os_scsi_tape_open(struct inode * inode, struct file * filp) static int os_scsi_tape_open(struct inode * inode, struct file * filp)
{ {
unsigned short flags; unsigned short flags;
int i, b_size, new_session = FALSE, retval = 0; int i, b_size, new_session = FALSE, retval = 0;
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt; Scsi_Request * SRpnt;
OS_Scsi_Tape * STp; OS_Scsi_Tape * STp;
ST_mode * STm; ST_mode * STm;
ST_partstat * STps; ST_partstat * STps;
char *name; char * name;
int dev = TAPE_NR(inode->i_rdev); int dev = TAPE_NR(inode->i_rdev);
int mode = TAPE_MODE(inode->i_rdev); int mode = TAPE_MODE(inode->i_rdev);
write_lock(&os_scsi_tapes_lock); write_lock(&os_scsi_tapes_lock);
if (dev >= osst_max_dev || os_scsi_tapes == NULL || if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
...@@ -4267,44 +4268,32 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4267,44 +4268,32 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
STp->raw = TAPE_IS_RAW(inode->i_rdev); STp->raw = TAPE_IS_RAW(inode->i_rdev);
if (STp->raw) if (STp->raw)
STp->header_ok = 0; STp->header_ok = 0;
#if 0
/* Allocate a buffer for this user */
need_dma_buffer = STp->restr_dma;
for (i=0; i < osst_nbr_buffers; i++)
if (!osst_buffers[i]->in_use &&
(!need_dma_buffer || osst_buffers[i]->dma))
break;
if (i >= osst_nbr_buffers) {
STp->buffer = new_tape_buffer(FALSE, need_dma_buffer);
if (STp->buffer == NULL) {
printk(KERN_WARNING "%s:W: Can't allocate tape buffer.\n", name);
retval = (-EBUSY);
goto err_out;
}
}
else
STp->buffer = osst_buffers[i];
#endif /* now pre_allocated */
/* Allocate data segments for this device's tape buffer */ /* Allocate data segments for this device's tape buffer */
if (!enlarge_buffer(STp->buffer, STp->restr_dma)) { if (!enlarge_buffer(STp->buffer, STp->restr_dma)) {
printk(KERN_ERR "%s:E: Unable to allocate memory segments for tape buffer.\n", name); printk(KERN_ERR "%s:E: Unable to allocate memory segments for tape buffer.\n", name);
retval = (-EOVERFLOW); retval = (-EOVERFLOW);
goto err_out; goto err_out;
} }
(STp->buffer)->writing = 0; if (STp->buffer->buffer_size >= OS_FRAME_SIZE) {
(STp->buffer)->syscall_result = 0; for (i = 0, b_size = 0;
#if 0 (i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE);
(STp->buffer)->use_sg = STp->device->host->sg_tablesize; b_size += STp->buffer->sg[i++].length);
STp->buffer->aux = (os_aux_t *) (page_address(STp->buffer->sg[i].page) + OS_DATA_SIZE - b_size);
/* Compute the usable buffer size for this SCSI adapter */ #if DEBUG
if (!(STp->buffer)->use_sg) printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name,
(STp->buffer)->buffer_size = (STp->buffer)->sg[0].length; STp->buffer->b_data, page_address(STp->buffer->sg[0].page));
else { printk(OSST_DEB_MSG "%s:D: AUX points to %p in segment %d at %p\n", name,
for (i=0, (STp->buffer)->buffer_size = 0; i < (STp->buffer)->use_sg && STp->buffer->aux, i, page_address(STp->buffer->sg[i].page));
i < (STp->buffer)->sg_segs; i++)
(STp->buffer)->buffer_size += (STp->buffer)->sg[i].length;
}
#endif #endif
} else {
STp->buffer->aux = NULL; /* this had better never happen! */
printk(KERN_NOTICE "%s:A: Framesize %d too large for buffer.\n", name, OS_FRAME_SIZE);
retval = (-EIO);
goto err_out;
}
STp->buffer->writing = 0;
STp->buffer->syscall_result = 0;
STp->dirty = 0; STp->dirty = 0;
for (i=0; i < ST_NBR_PARTITIONS; i++) { for (i=0; i < ST_NBR_PARTITIONS; i++) {
STps = &(STp->ps[i]); STps = &(STp->ps[i]);
...@@ -4410,7 +4399,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4410,7 +4399,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
i = STp->first_frame_position; i = STp->first_frame_position;
if (STp->header_ok && i == osst_get_frame_position(STp, &SRpnt)) { if (STp->header_ok && i == osst_get_frame_position(STp, &SRpnt)) {
if (STp->door_locked == ST_UNLOCKED) { if (STp->door_locked == ST_UNLOCKED) {
if (osst_int_ioctl(STp, &SRpnt, MTLOCK, 0)) if (do_door_lock(STp, 1))
printk(KERN_INFO "%s:I: Can't lock drive door\n", name); printk(KERN_INFO "%s:I: Can't lock drive door\n", name);
else else
STp->door_locked = ST_LOCKED_AUTO; STp->door_locked = ST_LOCKED_AUTO;
...@@ -4512,24 +4501,6 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4512,24 +4501,6 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
osst_configure_onstream(STp, &SRpnt); osst_configure_onstream(STp, &SRpnt);
if (STp->buffer->buffer_size >= OS_FRAME_SIZE) {
for (i = 0, b_size = 0;
(i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE);
b_size += STp->buffer->sg[i++].length);
STp->buffer->aux = (os_aux_t *) (page_address(STp->buffer->sg[i].page) + OS_DATA_SIZE - b_size);
#if DEBUG
printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name,
STp->buffer->b_data, page_address(STp->buffer->sg[0].page));
printk(OSST_DEB_MSG "%s:D: AUX points to %p in segment %d at %p\n", name,
STp->buffer->aux, i, page_address(STp->buffer->sg[i].page));
#endif
} else {
STp->buffer->aux = NULL; /* this had better never happen! */
printk(KERN_NOTICE "%s:A: Framesize %d too large for buffer.\n", name, OS_FRAME_SIZE);
retval = (-EIO);
goto err_out;
}
STp->block_size = STp->raw ? OS_FRAME_SIZE : ( STp->block_size = STp->raw ? OS_FRAME_SIZE : (
(STm->default_blksize > 0) ? STm->default_blksize : OS_DATA_SIZE); (STm->default_blksize > 0) ? STm->default_blksize : OS_DATA_SIZE);
STp->buffer->buffer_blocks = STp->raw ? 1 : OS_DATA_SIZE / STp->block_size; STp->buffer->buffer_blocks = STp->raw ? 1 : OS_DATA_SIZE / STp->block_size;
...@@ -4569,7 +4540,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4569,7 +4540,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
* properly position the tape and check the ADR headers * properly position the tape and check the ADR headers
*/ */
if (STp->door_locked == ST_UNLOCKED) { if (STp->door_locked == ST_UNLOCKED) {
if (osst_int_ioctl(STp, &SRpnt, MTLOCK, 0)) if (do_door_lock(STp, 1))
printk(KERN_INFO "%s:I: Can't lock drive door\n", name); printk(KERN_INFO "%s:I: Can't lock drive door\n", name);
else else
STp->door_locked = ST_LOCKED_AUTO; STp->door_locked = ST_LOCKED_AUTO;
...@@ -4597,12 +4568,12 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4597,12 +4568,12 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
/* Flush the tape buffer before close */ /* Flush the tape buffer before close */
static int os_scsi_tape_flush(struct file * filp) static int os_scsi_tape_flush(struct file * filp)
{ {
int result = 0, result2; int result = 0, result2;
OS_Scsi_Tape * STp = filp->private_data; OS_Scsi_Tape * STp = filp->private_data;
ST_mode * STm = &(STp->modes[STp->current_mode]); ST_mode * STm = &(STp->modes[STp->current_mode]);
ST_partstat * STps = &(STp->ps[STp->partition]); ST_partstat * STps = &(STp->ps[STp->partition]);
Scsi_Request *SRpnt = NULL; Scsi_Request * SRpnt = NULL;
char *name = tape_name(STp); char * name = tape_name(STp);
if (file_count(filp) > 1) if (file_count(filp) > 1)
return 0; return 0;
...@@ -4727,13 +4698,13 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp) ...@@ -4727,13 +4698,13 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
static int osst_ioctl(struct inode * inode,struct file * file, static int osst_ioctl(struct inode * inode,struct file * file,
unsigned int cmd_in, unsigned long arg) unsigned int cmd_in, unsigned long arg)
{ {
int i, cmd_nr, cmd_type, retval = 0; int i, cmd_nr, cmd_type, retval = 0;
unsigned int blk; unsigned int blk;
ST_mode *STm; ST_mode * STm;
ST_partstat *STps; ST_partstat * STps;
Scsi_Request *SRpnt = NULL; Scsi_Request * SRpnt = NULL;
OS_Scsi_Tape *STp = file->private_data; OS_Scsi_Tape * STp = file->private_data;
char *name = tape_name(STp); char * name = tape_name(STp);
if (down_interruptible(&STp->lock)) if (down_interruptible(&STp->lock))
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -4813,6 +4784,8 @@ static int osst_ioctl(struct inode * inode,struct file * file, ...@@ -4813,6 +4784,8 @@ static int osst_ioctl(struct inode * inode,struct file * file,
i = mtc.mt_op == MTREW || mtc.mt_op == MTOFFL || i = mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
mtc.mt_op == MTRETEN || mtc.mt_op == MTEOM || mtc.mt_op == MTRETEN || mtc.mt_op == MTEOM ||
mtc.mt_op == MTLOCK || mtc.mt_op == MTLOAD || mtc.mt_op == MTLOCK || mtc.mt_op == MTLOAD ||
mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM ||
mtc.mt_op == MTCOMPRESSION; mtc.mt_op == MTCOMPRESSION;
} }
i = osst_flush_buffer(STp, &SRpnt, i); i = osst_flush_buffer(STp, &SRpnt, i);
...@@ -5123,8 +5096,9 @@ static int enlarge_buffer(OSST_buffer *STbuffer, int need_dma) ...@@ -5123,8 +5096,9 @@ static int enlarge_buffer(OSST_buffer *STbuffer, int need_dma)
"osst :D: Expanded tape buffer (%d bytes, %d->%d segments, dma: %d, at: %p).\n", "osst :D: Expanded tape buffer (%d bytes, %d->%d segments, dma: %d, at: %p).\n",
got, STbuffer->orig_sg_segs, STbuffer->sg_segs, need_dma, STbuffer->b_data); got, STbuffer->orig_sg_segs, STbuffer->sg_segs, need_dma, STbuffer->b_data);
printk(OSST_DEB_MSG printk(OSST_DEB_MSG
"osst :D: segment sizes: first %d, last %d bytes.\n", "osst :D: segment sizes: first %d at %p, last %d bytes at %p.\n",
STbuffer->sg[0].length, STbuffer->sg[segs-1].length); STbuffer->sg[0].length, page_address(STbuffer->sg[0].page),
STbuffer->sg[segs-1].length, page_address(STbuffer->sg[segs-1].page));
} }
#endif #endif
...@@ -5410,12 +5384,12 @@ static struct osst_support_data support_list[] = { ...@@ -5410,12 +5384,12 @@ static struct osst_support_data support_list[] = {
static int osst_attach(Scsi_Device * SDp) static int osst_attach(Scsi_Device * SDp)
{ {
OS_Scsi_Tape * tpnt; OS_Scsi_Tape * tpnt;
ST_mode * STm; ST_mode * STm;
ST_partstat * STps; ST_partstat * STps;
OSST_buffer *buffer; OSST_buffer * buffer;
struct gendisk *drive; struct gendisk * drive;
int i, mode, dev_num; int i, mode, dev_num;
if (SDp->type != TYPE_TAPE || !osst_supports(SDp)) if (SDp->type != TYPE_TAPE || !osst_supports(SDp))
return 1; return 1;
......
...@@ -172,8 +172,7 @@ void scsi_times_out(Scsi_Cmnd *scmd) ...@@ -172,8 +172,7 @@ void scsi_times_out(Scsi_Cmnd *scmd)
* see whether the host or the device is offline. * see whether the host or the device is offline.
* *
* Return value: * Return value:
* FALSE when dev was taken offline by error recovery. TRUE OK to * 0 when dev was taken offline by error recovery. 1 OK to proceed.
* proceed.
**/ **/
int scsi_block_when_processing_errors(Scsi_Device *sdev) int scsi_block_when_processing_errors(Scsi_Device *sdev)
{ {
...@@ -1157,7 +1156,7 @@ static void scsi_eh_offline_sdevs(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost) ...@@ -1157,7 +1156,7 @@ static void scsi_eh_offline_sdevs(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_TIMEOUT)) if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_TIMEOUT))
scmd->result |= (DRIVER_TIMEOUT << 24); scmd->result |= (DRIVER_TIMEOUT << 24);
scmd->device->online = FALSE; scmd->device->online = 0;
scsi_eh_finish_cmd(scmd, shost); scsi_eh_finish_cmd(scmd, shost);
} }
return; return;
...@@ -1222,7 +1221,7 @@ int scsi_decide_disposition(Scsi_Cmnd *scmd) ...@@ -1222,7 +1221,7 @@ int scsi_decide_disposition(Scsi_Cmnd *scmd)
* if the device is offline, then we clearly just pass the result back * if the device is offline, then we clearly just pass the result back
* up to the top level. * up to the top level.
*/ */
if (scmd->device->online == FALSE) { if (!scmd->device->online) {
SCSI_LOG_ERROR_RECOVERY(5, printk("%s: device offline - report" SCSI_LOG_ERROR_RECOVERY(5, printk("%s: device offline - report"
" as SUCCESS\n", " as SUCCESS\n",
__FUNCTION__)); __FUNCTION__));
......
...@@ -1060,7 +1060,7 @@ void scsi_request_fn(request_queue_t * q) ...@@ -1060,7 +1060,7 @@ void scsi_request_fn(request_queue_t * q)
*/ */
void scsi_block_requests(struct Scsi_Host * SHpnt) void scsi_block_requests(struct Scsi_Host * SHpnt)
{ {
SHpnt->host_self_blocked = TRUE; SHpnt->host_self_blocked = 1;
} }
/* /*
...@@ -1087,7 +1087,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt) ...@@ -1087,7 +1087,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
{ {
Scsi_Device *SDloop; Scsi_Device *SDloop;
SHpnt->host_self_blocked = FALSE; SHpnt->host_self_blocked = 0;
/* Now that we are unblocked, try to start the queues. */ /* Now that we are unblocked, try to start the queues. */
list_for_each_entry(SDloop, &SHpnt->my_devices, siblings) list_for_each_entry(SDloop, &SHpnt->my_devices, siblings)
scsi_queue_next_request(SDloop->request_queue, NULL); scsi_queue_next_request(SDloop->request_queue, NULL);
......
...@@ -537,9 +537,20 @@ static int sd_ioctl(struct inode * inode, struct file * filp, ...@@ -537,9 +537,20 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
return sd_hdio_getgeo(bdev, (struct hd_geometry *)arg); return sd_hdio_getgeo(bdev, (struct hd_geometry *)arg);
} }
error = scsi_cmd_ioctl(bdev, cmd, arg); /*
if (error != -ENOTTY) * Send SCSI addressing ioctls directly to mid level, send other
return error; * ioctls to block level and then onto mid level if they can't be
* resolved.
*/
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
case SCSI_IOCTL_GET_BUS_NUMBER:
return scsi_ioctl(sdp, cmd, (void *)arg);
default:
error = scsi_cmd_ioctl(bdev, cmd, arg);
if (error != -ENOTTY)
return error;
}
return scsi_ioctl(sdp, cmd, (void *)arg); return scsi_ioctl(sdp, cmd, (void *)arg);
} }
......
...@@ -434,6 +434,17 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, ...@@ -434,6 +434,17 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
unsigned long arg) unsigned long arg)
{ {
struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk);
struct scsi_device *sdev = cd->device;
/*
* Send SCSI addressing ioctls directly to mid level, send other
* ioctls to cdrom/block level.
*/
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
case SCSI_IOCTL_GET_BUS_NUMBER:
return scsi_ioctl(sdev, cmd, (void *)arg);
}
return cdrom_ioctl(&cd->cdi, inode, cmd, arg); return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
} }
......
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