Commit d0a6840a authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] usb-storage: convert spaces to tabs

This is a minor cleanup to convert 8 spaces into tabs.  There is no
functional change here.
parent 196ef4e6
......@@ -27,14 +27,14 @@
extern int datafab_transport(Scsi_Cmnd *srb, struct us_data *us);
struct datafab_info {
unsigned long sectors; // total sector count
unsigned long ssize; // sector size in bytes
char lun; // used for dual-slot readers
// the following aren't used yet
unsigned long sectors; // total sector count
unsigned long ssize; // sector size in bytes
char lun; // used for dual-slot readers
// the following aren't used yet
unsigned char sense_key;
unsigned long sense_asc; // additional sense code
unsigned long sense_ascq; // additional sense code qualifier
unsigned long sense_asc; // additional sense code
unsigned long sense_ascq; // additional sense code qualifier
};
#endif
......@@ -45,42 +45,42 @@ static void pdump (void *, int);
#define DRQ_STAT 0x08
struct freecom_udata {
u8 buffer[64]; /* Common command block. */
u8 buffer[64]; /* Common command block. */
};
typedef struct freecom_udata *freecom_udata_t;
/* All of the outgoing packets are 64 bytes long. */
struct freecom_cb_wrap {
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
u8 Atapi[12]; /* An ATAPI packet. */
u8 Filler[50]; /* Padding Data. */
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
u8 Atapi[12]; /* An ATAPI packet. */
u8 Filler[50]; /* Padding Data. */
};
struct freecom_xfer_wrap {
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
u32 Count; /* Number of bytes to transfer. */
u8 Pad[58];
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
u32 Count; /* Number of bytes to transfer. */
u8 Pad[58];
} __attribute__ ((packed));
struct freecom_ide_out {
u8 Type; /* Type + IDE register. */
u8 Pad;
u16 Value; /* Value to write. */
u8 Pad2[60];
u8 Type; /* Type + IDE register. */
u8 Pad;
u16 Value; /* Value to write. */
u8 Pad2[60];
};
struct freecom_ide_in {
u8 Type; /* Type | IDE register. */
u8 Pad[63];
u8 Type; /* Type | IDE register. */
u8 Pad[63];
};
struct freecom_status {
u8 Status;
u8 Reason;
u16 Count;
u8 Pad[60];
u8 Status;
u8 Reason;
u16 Count;
u8 Pad[60];
};
/* Freecom stuffs the interrupt status in the INDEX_STAT bit of the ide
......@@ -110,32 +110,32 @@ struct freecom_status {
static int
freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
unsigned int ipipe, unsigned int opipe, int count)
unsigned int ipipe, unsigned int opipe, int count)
{
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
(struct freecom_xfer_wrap *) extra->buffer;
int result;
fxfr->Type = FCM_PACKET_INPUT | 0x00;
fxfr->Timeout = 0; /* Short timeout for debugging. */
fxfr->Count = cpu_to_le32 (count);
memset (fxfr->Pad, 0, sizeof (fxfr->Pad));
US_DEBUGP("Read data Freecom! (c=%d)\n", count);
/* Issue the transfer command. */
result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
FCM_PACKET_LENGTH, NULL);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom readdata transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* Now transfer all of our blocks. */
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
(struct freecom_xfer_wrap *) extra->buffer;
int result;
fxfr->Type = FCM_PACKET_INPUT | 0x00;
fxfr->Timeout = 0; /* Short timeout for debugging. */
fxfr->Count = cpu_to_le32 (count);
memset (fxfr->Pad, 0, sizeof (fxfr->Pad));
US_DEBUGP("Read data Freecom! (c=%d)\n", count);
/* Issue the transfer command. */
result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
FCM_PACKET_LENGTH, NULL);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom readdata transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* Now transfer all of our blocks. */
US_DEBUGP("Start of read\n");
result = usb_stor_bulk_transfer_srb(us, ipipe, srb, count);
US_DEBUGP("freecom_readdata done!\n");
US_DEBUGP("freecom_readdata done!\n");
if (result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
......@@ -144,33 +144,33 @@ freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
static int
freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
int unsigned ipipe, unsigned int opipe, int count)
int unsigned ipipe, unsigned int opipe, int count)
{
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
(struct freecom_xfer_wrap *) extra->buffer;
int result;
fxfr->Type = FCM_PACKET_OUTPUT | 0x00;
fxfr->Timeout = 0; /* Short timeout for debugging. */
fxfr->Count = cpu_to_le32 (count);
memset (fxfr->Pad, 0, sizeof (fxfr->Pad));
US_DEBUGP("Write data Freecom! (c=%d)\n", count);
/* Issue the transfer command. */
result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
FCM_PACKET_LENGTH, NULL);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom writedata transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* Now transfer all of our blocks. */
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
(struct freecom_xfer_wrap *) extra->buffer;
int result;
fxfr->Type = FCM_PACKET_OUTPUT | 0x00;
fxfr->Timeout = 0; /* Short timeout for debugging. */
fxfr->Count = cpu_to_le32 (count);
memset (fxfr->Pad, 0, sizeof (fxfr->Pad));
US_DEBUGP("Write data Freecom! (c=%d)\n", count);
/* Issue the transfer command. */
result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
FCM_PACKET_LENGTH, NULL);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom writedata transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* Now transfer all of our blocks. */
US_DEBUGP("Start of write\n");
result = usb_stor_bulk_transfer_srb(us, opipe, srb, count);
US_DEBUGP("freecom_writedata done!\n");
US_DEBUGP("freecom_writedata done!\n");
if (result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
return USB_STOR_TRANSPORT_GOOD;
......@@ -182,54 +182,54 @@ freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
*/
int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
{
struct freecom_cb_wrap *fcb;
struct freecom_status *fst;
unsigned int ipipe, opipe; /* We need both pipes. */
int result;
struct freecom_cb_wrap *fcb;
struct freecom_status *fst;
unsigned int ipipe, opipe; /* We need both pipes. */
int result;
unsigned int partial;
int length;
freecom_udata_t extra;
int length;
freecom_udata_t extra;
extra = (freecom_udata_t) us->extra;
extra = (freecom_udata_t) us->extra;
fcb = (struct freecom_cb_wrap *) extra->buffer;
fst = (struct freecom_status *) extra->buffer;
fcb = (struct freecom_cb_wrap *) extra->buffer;
fst = (struct freecom_status *) extra->buffer;
US_DEBUGP("Freecom TRANSPORT STARTED\n");
US_DEBUGP("Freecom TRANSPORT STARTED\n");
/* Get handles for both transports. */
opipe = us->send_bulk_pipe;
ipipe = us->recv_bulk_pipe;
/* Get handles for both transports. */
opipe = us->send_bulk_pipe;
ipipe = us->recv_bulk_pipe;
/* The ATAPI Command always goes out first. */
fcb->Type = FCM_PACKET_ATAPI | 0x00;
fcb->Timeout = 0;
memcpy (fcb->Atapi, srb->cmnd, 12);
memset (fcb->Filler, 0, sizeof (fcb->Filler));
/* The ATAPI Command always goes out first. */
fcb->Type = FCM_PACKET_ATAPI | 0x00;
fcb->Timeout = 0;
memcpy (fcb->Atapi, srb->cmnd, 12);
memset (fcb->Filler, 0, sizeof (fcb->Filler));
US_DEBUG(pdump (srb->cmnd, 12));
US_DEBUG(pdump (srb->cmnd, 12));
/* Send it out. */
result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
FCM_PACKET_LENGTH, NULL);
/* Send it out. */
result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
FCM_PACKET_LENGTH, NULL);
/* The Freecom device will only fail if there is something wrong in
* USB land. It returns the status in its own registers, which
* come back in the bulk pipe. */
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("freecom transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* The Freecom device will only fail if there is something wrong in
* USB land. It returns the status in its own registers, which
* come back in the bulk pipe. */
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("freecom transport error\n");
return USB_STOR_TRANSPORT_ERROR;
}
/* There are times we can optimize out this status read, but it
* doesn't hurt us to always do it now. */
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
US_DEBUGP("foo Status result %d %u\n", result, partial);
/* There are times we can optimize out this status read, but it
* doesn't hurt us to always do it now. */
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
US_DEBUGP("foo Status result %d %u\n", result, partial);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
US_DEBUG(pdump ((void *) fst, partial));
US_DEBUG(pdump ((void *) fst, partial));
/* The firmware will time-out commands after 20 seconds. Some commands
* can legitimately take longer than this, so we use a different
......@@ -249,7 +249,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
memset (fcb->Atapi, 0, sizeof(fcb->Atapi));
memset (fcb->Filler, 0, sizeof (fcb->Filler));
/* Send it out. */
/* Send it out. */
result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
FCM_PACKET_LENGTH, NULL);
......@@ -263,31 +263,31 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
}
/* get the data */
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
US_DEBUGP("bar Status result %d %u\n", result, partial);
if (result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
return USB_STOR_TRANSPORT_ERROR;
US_DEBUG(pdump ((void *) fst, partial));
}
if (partial != 4)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & 1) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
/* The device might not have as much data available as we
* requested. If you ask for more than the device has, this reads
* and such will hang. */
US_DEBUGP("Device indicates that it has %d bytes available\n",
le16_to_cpu (fst->Count));
US_DEBUGP("SCSI requested %d\n", srb->request_bufflen);
/* Find the length we desire to read. */
if (partial != 4)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & 1) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
/* The device might not have as much data available as we
* requested. If you ask for more than the device has, this reads
* and such will hang. */
US_DEBUGP("Device indicates that it has %d bytes available\n",
le16_to_cpu (fst->Count));
US_DEBUGP("SCSI requested %d\n", srb->request_bufflen);
/* Find the length we desire to read. */
switch (srb->cmnd[0]) {
case INQUIRY:
case REQUEST_SENSE: /* 16 or 18 bytes? spec says 18, lots of devices only have 16 */
......@@ -305,97 +305,97 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
US_DEBUGP("Truncating request to match buffer length: %d\n", length);
}
/* What we do now depends on what direction the data is supposed to
* move in. */
switch (us->srb->sc_data_direction) {
case SCSI_DATA_READ:
/* Make sure that the status indicates that the device
* wants data as well. */
if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) {
US_DEBUGP("SCSI wants data, drive doesn't have any\n");
return USB_STOR_TRANSPORT_FAILED;
}
result = freecom_readdata (srb, us, ipipe, opipe, length);
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
US_DEBUGP("FCM: Waiting for status\n");
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
/* What we do now depends on what direction the data is supposed to
* move in. */
switch (us->srb->sc_data_direction) {
case SCSI_DATA_READ:
/* Make sure that the status indicates that the device
* wants data as well. */
if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) {
US_DEBUGP("SCSI wants data, drive doesn't have any\n");
return USB_STOR_TRANSPORT_FAILED;
}
result = freecom_readdata (srb, us, ipipe, opipe, length);
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
US_DEBUGP("FCM: Waiting for status\n");
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
US_DEBUG(pdump ((void *) fst, partial));
if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
if ((fst->Reason & 3) != 3) {
US_DEBUGP("Drive seems still hungry\n");
return USB_STOR_TRANSPORT_FAILED;
}
US_DEBUGP("Transfer happy\n");
break;
case SCSI_DATA_WRITE:
/* Make sure the status indicates that the device wants to
* send us data. */
/* !!IMPLEMENT!! */
result = freecom_writedata (srb, us, ipipe, opipe, length);
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
US_DEBUGP("FCM: Waiting for status\n");
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
if ((fst->Reason & 3) != 3) {
US_DEBUGP("Drive seems still hungry\n");
return USB_STOR_TRANSPORT_FAILED;
}
US_DEBUGP("Transfer happy\n");
break;
case SCSI_DATA_NONE:
/* Easy, do nothing. */
break;
default:
US_DEBUGP ("freecom unimplemented direction: %d\n",
us->srb->sc_data_direction);
// Return fail, SCSI seems to handle this better.
return USB_STOR_TRANSPORT_FAILED;
break;
}
return USB_STOR_TRANSPORT_GOOD;
if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
if ((fst->Reason & 3) != 3) {
US_DEBUGP("Drive seems still hungry\n");
return USB_STOR_TRANSPORT_FAILED;
}
US_DEBUGP("Transfer happy\n");
break;
case SCSI_DATA_WRITE:
/* Make sure the status indicates that the device wants to
* send us data. */
/* !!IMPLEMENT!! */
result = freecom_writedata (srb, us, ipipe, opipe, length);
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
US_DEBUGP("FCM: Waiting for status\n");
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
}
if ((fst->Reason & 3) != 3) {
US_DEBUGP("Drive seems still hungry\n");
return USB_STOR_TRANSPORT_FAILED;
}
US_DEBUGP("Transfer happy\n");
break;
case SCSI_DATA_NONE:
/* Easy, do nothing. */
break;
default:
US_DEBUGP ("freecom unimplemented direction: %d\n",
us->srb->sc_data_direction);
// Return fail, SCSI seems to handle this better.
return USB_STOR_TRANSPORT_FAILED;
break;
}
return USB_STOR_TRANSPORT_GOOD;
}
int
freecom_init (struct us_data *us)
{
int result;
int result;
char buffer[33];
/* Allocate a buffer for us. The upper usb transport code will
* free this for us when cleaning up. */
if (us->extra == NULL) {
us->extra = kmalloc (sizeof (struct freecom_udata),
GFP_KERNEL);
if (us->extra == NULL) {
US_DEBUGP("Out of memory\n");
return USB_STOR_TRANSPORT_ERROR;
}
}
/* Allocate a buffer for us. The upper usb transport code will
* free this for us when cleaning up. */
if (us->extra == NULL) {
us->extra = kmalloc (sizeof (struct freecom_udata),
GFP_KERNEL);
if (us->extra == NULL) {
US_DEBUGP("Out of memory\n");
return USB_STOR_TRANSPORT_ERROR;
}
}
result = usb_control_msg(us->pusb_dev, us->recv_ctrl_pipe,
0x4c, 0xc0, 0x4346, 0x0, buffer, 0x20, 3*HZ);
......@@ -424,15 +424,15 @@ freecom_init (struct us_data *us)
/* wait 3 seconds */
mdelay(3 * 1000);
return USB_STOR_TRANSPORT_GOOD;
return USB_STOR_TRANSPORT_GOOD;
}
int usb_stor_freecom_reset(struct us_data *us)
{
printk (KERN_CRIT "freecom reset called\n");
printk (KERN_CRIT "freecom reset called\n");
/* We don't really have this feature. */
return FAILED;
/* We don't really have this feature. */
return FAILED;
}
#ifdef CONFIG_USB_STORAGE_DEBUG
......
......@@ -34,11 +34,11 @@
* 2002-10-19: Removed the specialized transfer routines.
* (Alan Stern <stern@rowland.harvard.edu>)
* 2001-02-24: Removed lots of duplicate code and simplified the structure.
* (bjorn@haxx.se)
* (bjorn@haxx.se)
* 2002-01-16: Fixed endianness bug so it works on the ppc arch.
* (Luc Saillard <luc@saillard.org>)
* (Luc Saillard <luc@saillard.org>)
* 2002-01-17: All bitfields removed.
* (bjorn@haxx.se)
* (bjorn@haxx.se)
*/
......@@ -59,14 +59,14 @@
/* Timeout defines (in Seconds) */
#define ISD200_ENUM_BSY_TIMEOUT 35
#define ISD200_ENUM_BSY_TIMEOUT 35
#define ISD200_ENUM_DETECT_TIMEOUT 30
#define ISD200_DEFAULT_TIMEOUT 30
#define ISD200_DEFAULT_TIMEOUT 30
/* device flags */
#define DF_ATA_DEVICE 0x0001
#define DF_MEDIA_STATUS_ENABLED 0x0002
#define DF_REMOVABLE_MEDIA 0x0004
#define DF_ATA_DEVICE 0x0001
#define DF_MEDIA_STATUS_ENABLED 0x0002
#define DF_REMOVABLE_MEDIA 0x0004
/* capability bit definitions */
#define CAPABILITY_DMA 0x01
......@@ -82,46 +82,46 @@
#define ATA_ADDRESS_DEVHEAD_SLAVE 0x10
/* Action Select bits */
#define ACTION_SELECT_0 0x01
#define ACTION_SELECT_1 0x02
#define ACTION_SELECT_2 0x04
#define ACTION_SELECT_3 0x08
#define ACTION_SELECT_4 0x10
#define ACTION_SELECT_5 0x20
#define ACTION_SELECT_6 0x40
#define ACTION_SELECT_7 0x80
#define ACTION_SELECT_0 0x01
#define ACTION_SELECT_1 0x02
#define ACTION_SELECT_2 0x04
#define ACTION_SELECT_3 0x08
#define ACTION_SELECT_4 0x10
#define ACTION_SELECT_5 0x20
#define ACTION_SELECT_6 0x40
#define ACTION_SELECT_7 0x80
/* Register Select bits */
#define REG_ALTERNATE_STATUS 0x01
#define REG_DEVICE_CONTROL 0x01
#define REG_ERROR 0x02
#define REG_FEATURES 0x02
#define REG_SECTOR_COUNT 0x04
#define REG_SECTOR_NUMBER 0x08
#define REG_CYLINDER_LOW 0x10
#define REG_CYLINDER_HIGH 0x20
#define REG_DEVICE_HEAD 0x40
#define REG_STATUS 0x80
#define REG_COMMAND 0x80
#define REG_ALTERNATE_STATUS 0x01
#define REG_DEVICE_CONTROL 0x01
#define REG_ERROR 0x02
#define REG_FEATURES 0x02
#define REG_SECTOR_COUNT 0x04
#define REG_SECTOR_NUMBER 0x08
#define REG_CYLINDER_LOW 0x10
#define REG_CYLINDER_HIGH 0x20
#define REG_DEVICE_HEAD 0x40
#define REG_STATUS 0x80
#define REG_COMMAND 0x80
/* ATA error definitions not in <linux/hdreg.h> */
#define ATA_ERROR_MEDIA_CHANGE 0x20
#define ATA_ERROR_MEDIA_CHANGE 0x20
/* ATA command definitions not in <linux/hdreg.h> */
#define ATA_COMMAND_GET_MEDIA_STATUS 0xDA
#define ATA_COMMAND_MEDIA_EJECT 0xED
#define ATA_COMMAND_GET_MEDIA_STATUS 0xDA
#define ATA_COMMAND_MEDIA_EJECT 0xED
/* ATA drive control definitions */
#define ATA_DC_DISABLE_INTERRUPTS 0x02
#define ATA_DC_RESET_CONTROLLER 0x04
#define ATA_DC_REENABLE_CONTROLLER 0x00
#define ATA_DC_DISABLE_INTERRUPTS 0x02
#define ATA_DC_RESET_CONTROLLER 0x04
#define ATA_DC_REENABLE_CONTROLLER 0x00
/*
* General purpose return codes
*/
#define ISD200_ERROR -1
#define ISD200_GOOD 0
#define ISD200_ERROR -1
#define ISD200_GOOD 0
/*
* Transport return codes
......@@ -162,7 +162,7 @@ union ata_cdb {
unsigned char WriteData1F7;
unsigned char Reserved[3];
} generic;
struct {
unsigned char SignatureByte0;
unsigned char SignatureByte1;
......@@ -180,7 +180,7 @@ union ata_cdb {
unsigned char Reserved[3];
} read;
struct {
struct {
unsigned char SignatureByte0;
unsigned char SignatureByte1;
unsigned char ActionSelect;
......@@ -211,8 +211,8 @@ union ata_cdb {
/*
* DeviceType field
*/
#define DIRECT_ACCESS_DEVICE 0x00 /* disks */
#define DEVICE_REMOVABLE 0x80
#define DIRECT_ACCESS_DEVICE 0x00 /* disks */
#define DEVICE_REMOVABLE 0x80
struct inquiry_data {
unsigned char DeviceType;
......@@ -240,9 +240,9 @@ struct inquiry_data {
* ISD200 CONFIG data struct
*/
#define ATACFG_TIMING 0x0f
#define ATACFG_TIMING 0x0f
#define ATACFG_ATAPI_RESET 0x10
#define ATACFG_MASTER 0x20
#define ATACFG_MASTER 0x20
#define ATACFG_BLOCKSIZE 0xa0
#define ATACFGE_LAST_LUN 0x07
......@@ -255,12 +255,12 @@ struct inquiry_data {
#define CFG_CAPABILITY_SRST 0x01
struct isd200_config {
unsigned char EventNotification;
unsigned char ExternalClock;
unsigned char ATAInitTimeout;
unsigned char EventNotification;
unsigned char ExternalClock;
unsigned char ATAInitTimeout;
unsigned char ATAConfig;
unsigned char ATAMajorCommand;
unsigned char ATAMinorCommand;
unsigned char ATAMajorCommand;
unsigned char ATAMinorCommand;
unsigned char ATAExtraConfig;
unsigned char Capability;
}__attribute__ ((packed));
......@@ -309,7 +309,7 @@ struct read_block_limits {
* Sense Data Format
*/
#define SENSE_ERRCODE 0x7f
#define SENSE_ERRCODE 0x7f
#define SENSE_ERRCODE_VALID 0x80
#define SENSE_FLAG_SENSE_KEY 0x0f
#define SENSE_FLAG_BAD_LENGTH 0x20
......@@ -319,13 +319,13 @@ struct sense_data {
unsigned char ErrorCode;
unsigned char SegmentNumber;
unsigned char Flags;
unsigned char Information[4];
unsigned char AdditionalSenseLength;
unsigned char CommandSpecificInformation[4];
unsigned char AdditionalSenseCode;
unsigned char AdditionalSenseCodeQualifier;
unsigned char FieldReplaceableUnitCode;
unsigned char SenseKeySpecific[3];
unsigned char Information[4];
unsigned char AdditionalSenseLength;
unsigned char CommandSpecificInformation[4];
unsigned char AdditionalSenseCode;
unsigned char AdditionalSenseCodeQualifier;
unsigned char FieldReplaceableUnitCode;
unsigned char SenseKeySpecific[3];
} __attribute__ ((packed));
/*
......@@ -340,18 +340,18 @@ struct sense_data {
/**************************************************************************
* isd200_build_sense
*
*
* Builds an artificial sense buffer to report the results of a
* failed command.
*
*
* RETURNS:
* void
*/
*/
void isd200_build_sense(struct us_data *us, Scsi_Cmnd *srb)
{
struct isd200_info *info = (struct isd200_info *)us->extra;
struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0];
unsigned char error = info->ATARegs[IDE_ERROR_OFFSET];
struct isd200_info *info = (struct isd200_info *)us->extra;
struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0];
unsigned char error = info->ATARegs[IDE_ERROR_OFFSET];
if(error & ATA_ERROR_MEDIA_CHANGE) {
buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
......@@ -359,31 +359,31 @@ void isd200_build_sense(struct us_data *us, Scsi_Cmnd *srb)
buf->Flags = UNIT_ATTENTION;
buf->AdditionalSenseCode = 0;
buf->AdditionalSenseCodeQualifier = 0;
} else if(error & MCR_ERR) {
} else if(error & MCR_ERR) {
buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
buf->AdditionalSenseLength = 0xb;
buf->Flags = UNIT_ATTENTION;
buf->AdditionalSenseCode = 0;
buf->AdditionalSenseCodeQualifier = 0;
} else if(error & TRK0_ERR) {
} else if(error & TRK0_ERR) {
buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
buf->AdditionalSenseLength = 0xb;
buf->Flags = NOT_READY;
buf->AdditionalSenseCode = 0;
buf->AdditionalSenseCodeQualifier = 0;
} else if(error & ECC_ERR) {
} else if(error & ECC_ERR) {
buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
buf->AdditionalSenseLength = 0xb;
buf->Flags = DATA_PROTECT;
buf->AdditionalSenseCode = 0;
buf->AdditionalSenseCodeQualifier = 0;
} else {
} else {
buf->ErrorCode = 0;
buf->AdditionalSenseLength = 0;
buf->Flags = 0;
buf->AdditionalSenseCode = 0;
buf->AdditionalSenseCodeQualifier = 0;
}
}
}
......@@ -430,8 +430,8 @@ static int isd200_action( struct us_data *us, int action,
case ACTION_ENUM:
US_DEBUGP(" isd200_action(ENUM,0x%02x)\n",value);
ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2|
ACTION_SELECT_3|ACTION_SELECT_4|
ACTION_SELECT_5;
ACTION_SELECT_3|ACTION_SELECT_4|
ACTION_SELECT_5;
ata.generic.RegisterSelect = REG_DEVICE_HEAD;
ata.write.DeviceHeadByte = value;
srb.sc_data_direction = SCSI_DATA_NONE;
......@@ -440,7 +440,7 @@ static int isd200_action( struct us_data *us, int action,
case ACTION_RESET:
US_DEBUGP(" isd200_action(RESET)\n");
ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2|
ACTION_SELECT_3|ACTION_SELECT_4;
ACTION_SELECT_3|ACTION_SELECT_4;
ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
ata.write.DeviceControlByte = ATA_DC_RESET_CONTROLLER;
srb.sc_data_direction = SCSI_DATA_NONE;
......@@ -449,7 +449,7 @@ static int isd200_action( struct us_data *us, int action,
case ACTION_REENABLE:
US_DEBUGP(" isd200_action(REENABLE)\n");
ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2|
ACTION_SELECT_3|ACTION_SELECT_4;
ACTION_SELECT_3|ACTION_SELECT_4;
ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
ata.write.DeviceControlByte = ATA_DC_REENABLE_CONTROLLER;
srb.sc_data_direction = SCSI_DATA_NONE;
......@@ -493,12 +493,12 @@ static int isd200_action( struct us_data *us, int action,
/**************************************************************************
* isd200_read_regs
*
*
* Read ATA Registers
*
* RETURNS:
* ISD status code
*/
*/
int isd200_read_regs( struct us_data *us )
{
struct isd200_info *info = (struct isd200_info *)us->extra;
......@@ -512,10 +512,10 @@ int isd200_read_regs( struct us_data *us )
if (transferStatus != ISD200_TRANSPORT_GOOD) {
US_DEBUGP(" Error reading ATA registers\n");
retStatus = ISD200_ERROR;
} else {
} else {
US_DEBUGP(" Got ATA Register[IDE_ERROR_OFFSET] = 0x%x\n",
info->ATARegs[IDE_ERROR_OFFSET]);
}
}
return retStatus;
}
......@@ -649,12 +649,12 @@ static void isd200_log_config( struct isd200_info* info )
/**************************************************************************
* isd200_write_config
*
*
* Write the ISD200 Configuraton data
*
* RETURNS:
* ISD status code
*/
*/
int isd200_write_config( struct us_data *us )
{
struct isd200_info *info = (struct isd200_info *)us->extra;
......@@ -669,21 +669,21 @@ int isd200_write_config( struct us_data *us )
/* let's send the command via the control pipe */
result = usb_stor_ctrl_transfer(
us,
us->send_ctrl_pipe,
0x01,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
0x0000,
0x0002,
(void *) &info->ConfigData,
sizeof(info->ConfigData));
us,
us->send_ctrl_pipe,
0x01,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
0x0000,
0x0002,
(void *) &info->ConfigData,
sizeof(info->ConfigData));
if (result >= 0) {
US_DEBUGP(" ISD200 Config Data was written successfully\n");
} else {
} else {
US_DEBUGP(" Request to write ISD200 Config Data failed!\n");
retStatus = ISD200_ERROR;
}
}
US_DEBUGP("Leaving isd200_write_config %08X\n", retStatus);
return retStatus;
......@@ -692,12 +692,12 @@ int isd200_write_config( struct us_data *us )
/**************************************************************************
* isd200_read_config
*
*
* Reads the ISD200 Configuraton data
*
* RETURNS:
* ISD status code
*/
*/
int isd200_read_config( struct us_data *us )
{
struct isd200_info *info = (struct isd200_info *)us->extra;
......@@ -707,17 +707,17 @@ int isd200_read_config( struct us_data *us )
US_DEBUGP("Entering isd200_read_config\n");
/* read the configuration information from ISD200. Use this to */
/* determine what the special ATA CDB bytes are. */
/* determine what the special ATA CDB bytes are. */
result = usb_stor_ctrl_transfer(
us,
us->recv_ctrl_pipe,
0x02,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
0x0000,
0x0002,
(void *) &info->ConfigData,
sizeof(info->ConfigData));
us,
us->recv_ctrl_pipe,
0x02,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
0x0000,
0x0002,
(void *) &info->ConfigData,
sizeof(info->ConfigData));
if (result >= 0) {
......@@ -725,10 +725,10 @@ int isd200_read_config( struct us_data *us )
#ifdef CONFIG_USB_STORAGE_DEBUG
isd200_log_config(info);
#endif
} else {
} else {
US_DEBUGP(" Request to get ISD200 Config Data failed!\n");
retStatus = ISD200_ERROR;
}
}
US_DEBUGP("Leaving isd200_read_config %08X\n", retStatus);
return retStatus;
......@@ -737,12 +737,12 @@ int isd200_read_config( struct us_data *us )
/**************************************************************************
* isd200_atapi_soft_reset
*
*
* Perform an Atapi Soft Reset on the device
*
* RETURNS:
* NT status code
*/
*/
int isd200_atapi_soft_reset( struct us_data *us )
{
int retStatus = ISD200_GOOD;
......@@ -754,7 +754,7 @@ int isd200_atapi_soft_reset( struct us_data *us )
if (transferStatus != ISD200_TRANSPORT_GOOD) {
US_DEBUGP(" Error issuing Atapi Soft Reset\n");
retStatus = ISD200_ERROR;
}
}
US_DEBUGP("Leaving isd200_atapi_soft_reset %08X\n", retStatus);
return retStatus;
......@@ -763,12 +763,12 @@ int isd200_atapi_soft_reset( struct us_data *us )
/**************************************************************************
* isd200_srst
*
*
* Perform an SRST on the device
*
* RETURNS:
* ISD status code
*/
*/
int isd200_srst( struct us_data *us )
{
int retStatus = ISD200_GOOD;
......@@ -782,7 +782,7 @@ int isd200_srst( struct us_data *us )
if (transferStatus != ISD200_TRANSPORT_GOOD) {
US_DEBUGP(" Error issuing SRST\n");
retStatus = ISD200_ERROR;
} else {
} else {
/* delay 10ms to give the drive a chance to see it */
wait_ms(10);
......@@ -794,7 +794,7 @@ int isd200_srst( struct us_data *us )
/* delay 50ms to give the drive a chance to recover after SRST */
wait_ms(50);
}
}
}
US_DEBUGP("Leaving isd200_srst %08X\n", retStatus);
return retStatus;
......@@ -803,13 +803,13 @@ int isd200_srst( struct us_data *us )
/**************************************************************************
* isd200_try_enum
*
*
* Helper function for isd200_manual_enum(). Does ENUM and READ_STATUS
* and tries to analyze the status registers
*
* RETURNS:
* ISD status code
*/
*/
static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
int detect )
{
......@@ -908,13 +908,13 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
/**************************************************************************
* isd200_manual_enum
*
*
* Determines if the drive attached is an ATA or ATAPI and if it is a
* master or slave.
*
* RETURNS:
* ISD status code
*/
*/
int isd200_manual_enum(struct us_data *us)
{
struct isd200_info *info = (struct isd200_info *)us->extra;
......@@ -1078,15 +1078,15 @@ int isd200_get_inquiry_data( struct us_data *us )
us->proto_handler = usb_stor_transparent_scsi_command;
US_DEBUGP("Protocol changed to: %s\n", us->protocol_name);
/* Free driver structure */
/* Free driver structure */
if (us->extra != NULL) {
kfree(us->extra);
us->extra = NULL;
us->extra_destructor = NULL;
}
}
}
}
US_DEBUGP("Leaving isd200_get_inquiry_data %08X\n", retStatus);
......@@ -1096,12 +1096,12 @@ int isd200_get_inquiry_data( struct us_data *us )
/**************************************************************************
* isd200_data_copy
*
*
* Copy data into the srb request buffer. Use scatter gather if required.
*
* RETURNS:
* void
*/
*/
void isd200_data_copy(Scsi_Cmnd *srb, char * src, int length)
{
unsigned int len = length;
......@@ -1150,13 +1150,13 @@ void isd200_data_copy(Scsi_Cmnd *srb, char * src, int length)
/**************************************************************************
* isd200_scsi_to_ata
*
*
* Translate SCSI commands to ATA commands.
*
* RETURNS:
* TRUE if the command needs to be sent to the transport layer
* FALSE otherwise
*/
*/
int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
union ata_cdb * ataCdb)
{
......@@ -1321,7 +1321,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
if (info->DeviceFlags & DF_REMOVABLE_MEDIA) {
US_DEBUGP(" srb->cmnd[4] = 0x%X\n", srb->cmnd[4]);
ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
ataCdb->generic.TransferBlockSize = 1;
......@@ -1378,12 +1378,12 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
/**************************************************************************
* isd200_init_info
*
*
* Allocates (if necessary) and initializes the driver structure.
*
* RETURNS:
* ISD status code
*/
*/
int isd200_init_info(struct us_data *us)
{
int retStatus = ISD200_GOOD;
......@@ -1394,11 +1394,11 @@ int isd200_init_info(struct us_data *us)
US_DEBUGP("ERROR - kmalloc failure\n");
retStatus = ISD200_ERROR;
}
}
}
if (retStatus == ISD200_GOOD) {
memset(us->extra, 0, sizeof(struct isd200_info));
}
}
return(retStatus);
}
......@@ -1415,14 +1415,14 @@ int isd200_Initialization(struct us_data *us)
if (isd200_init_info(us) == ISD200_ERROR) {
US_DEBUGP("ERROR Initializing ISD200 Info struct\n");
} else {
} else {
/* Get device specific data */
if (isd200_get_inquiry_data(us) != ISD200_GOOD)
US_DEBUGP("ISD200 Initialization Failure\n");
else
US_DEBUGP("ISD200 Initialization complete\n");
}
}
return 0;
}
......
......@@ -53,7 +53,7 @@
#define US_SC_UFI 0x04 /* Floppy */
#define US_SC_8070 0x05 /* Removable media */
#define US_SC_SCSI 0x06 /* Transparent */
#define US_SC_ISD200 0x07 /* ISD200 ATA */
#define US_SC_ISD200 0x07 /* ISD200 ATA */
#define US_SC_MIN US_SC_RBC
#define US_SC_MAX US_SC_ISD200
......
......@@ -55,8 +55,7 @@
#define US_PR_SCM_ATAPI 0x80 /* SCM-ATAPI bridge */
#endif
#ifdef CONFIG_USB_STORAGE_SDDR09
#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for
SDDR-09 */
#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
#endif
#ifdef CONFIG_USB_STORAGE_SDDR55
#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
......@@ -64,15 +63,15 @@
#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
#ifdef CONFIG_USB_STORAGE_FREECOM
#define US_PR_FREECOM 0xf1 /* Freecom */
#define US_PR_FREECOM 0xf1 /* Freecom */
#endif
#ifdef CONFIG_USB_STORAGE_DATAFAB
#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
#endif
#ifdef CONFIG_USB_STORAGE_JUMPSHOT
#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
#endif
/*
......@@ -118,10 +117,10 @@ struct bulk_cs_wrap {
* usb_stor_bulk_transfer_xxx() return codes, in order of severity
*/
#define USB_STOR_XFER_GOOD 0 /* good transfer */
#define USB_STOR_XFER_SHORT 1 /* transfered less than expected */
#define USB_STOR_XFER_STALLED 2 /* endpoint stalled */
#define USB_STOR_XFER_ERROR 3 /* transfer died in the middle */
#define USB_STOR_XFER_GOOD 0 /* good transfer */
#define USB_STOR_XFER_SHORT 1 /* transfered less than expected */
#define USB_STOR_XFER_STALLED 2 /* endpoint stalled */
#define USB_STOR_XFER_ERROR 3 /* transfer died in the middle */
/*
* Transport return codes
......
......@@ -264,7 +264,7 @@ UNUSUAL_DEV( 0x054c, 0x0032, 0x0000, 0x9999,
/* Submitted by Nathan Babb <nathan@lexi.com> */
UNUSUAL_DEV( 0x054c, 0x006d, 0x0000, 0x9999,
"Sony",
"Sony",
"PEG Mass Storage",
US_SC_8070, US_PR_CBI, NULL,
US_FL_FIX_INQUIRY ),
......@@ -546,10 +546,10 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009,
/* aeb */
UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
"Feiya",
"5-in-1 Card Reader",
US_SC_SCSI, US_PR_BULK, NULL,
US_FL_FIX_CAPACITY ),
"Feiya",
"5-in-1 Card Reader",
US_SC_SCSI, US_PR_BULK, NULL,
US_FL_FIX_CAPACITY ),
UNUSUAL_DEV( 0x097a, 0x0001, 0x0000, 0x0001,
"Minds@Work",
......
......@@ -943,7 +943,7 @@ static void storage_disconnect(struct usb_interface *intf)
US_DEBUGP("storage_disconnect() called\n");
ss = usb_get_intfdata(intf);
ss = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
/* serious error -- we're attempting to disconnect an interface but
......
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