This patch converts the ISD200 and Jumpshot drivers to use the new DMA-safe buffer.
Greg, please apply.
I'd also like to take a moment to thank Alan Stern, who writes many of
these patches. Without his help, many of the improvements everyone has
seen over the 2.5.x series would not have been possible.
Matt
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.2086 -> 1.2087
# drivers/usb/storage/jumpshot.c 1.20 -> 1.21
# drivers/usb/storage/isd200.c 1.39 -> 1.40
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/14 [EMAIL PROTECTED] 1.2087
# Convert the ISD200 and Jumpshot drivers to using the DMA-safe buffer.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c Mon Jul 14 01:02:23 2003
+++ b/drivers/usb/storage/isd200.c Mon Jul 14 01:02:23 2003
@@ -280,6 +280,7 @@
/* maximum number of LUNs supported */
unsigned char MaxLUNs;
+ struct scsi_cmnd srb;
};
@@ -404,15 +405,15 @@
void* pointer, int value )
{
union ata_cdb ata;
- struct scsi_cmnd srb;
struct scsi_device srb_dev;
struct isd200_info *info = (struct isd200_info *)us->extra;
+ struct scsi_cmnd *srb = &info->srb;
int status;
memset(&ata, 0, sizeof(ata));
- memset(&srb, 0, sizeof(srb));
memset(&srb_dev, 0, sizeof(srb_dev));
- srb.device = &srb_dev;
+ srb->device = &srb_dev;
+ ++srb->serial_number;
ata.generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
ata.generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -425,9 +426,9 @@
ata.generic.RegisterSelect =
REG_CYLINDER_LOW | REG_CYLINDER_HIGH |
REG_STATUS | REG_ERROR;
- srb.sc_data_direction = SCSI_DATA_READ;
- srb.request_buffer = pointer;
- srb.request_bufflen = value;
+ srb->sc_data_direction = SCSI_DATA_READ;
+ srb->request_buffer = pointer;
+ srb->request_bufflen = value;
break;
case ACTION_ENUM:
@@ -437,7 +438,7 @@
ACTION_SELECT_5;
ata.generic.RegisterSelect = REG_DEVICE_HEAD;
ata.write.DeviceHeadByte = value;
- srb.sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = SCSI_DATA_NONE;
break;
case ACTION_RESET:
@@ -446,7 +447,7 @@
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;
+ srb->sc_data_direction = SCSI_DATA_NONE;
break;
case ACTION_REENABLE:
@@ -455,7 +456,7 @@
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;
+ srb->sc_data_direction = SCSI_DATA_NONE;
break;
case ACTION_SOFT_RESET:
@@ -464,16 +465,16 @@
ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
ata.write.DeviceHeadByte = info->DeviceHead;
ata.write.CommandByte = WIN_SRST;
- srb.sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = SCSI_DATA_NONE;
break;
case ACTION_IDENTIFY:
US_DEBUGP(" isd200_action(IDENTIFY)\n");
ata.generic.RegisterSelect = REG_COMMAND;
ata.write.CommandByte = WIN_IDENTIFY;
- srb.sc_data_direction = SCSI_DATA_READ;
- srb.request_buffer = (void *)&info->drive;
- srb.request_bufflen = sizeof(struct hd_driveid);
+ srb->sc_data_direction = SCSI_DATA_READ;
+ srb->request_buffer = (void *)&info->drive;
+ srb->request_bufflen = sizeof(struct hd_driveid);
break;
default:
@@ -481,9 +482,9 @@
break;
}
- memcpy(srb.cmnd, &ata, sizeof(ata.generic));
- srb.cmd_len = sizeof(ata.generic);
- status = usb_stor_Bulk_transport(&srb, us);
+ memcpy(srb->cmnd, &ata, sizeof(ata.generic));
+ srb->cmd_len = sizeof(ata.generic);
+ status = usb_stor_Bulk_transport(srb, us);
if (status == USB_STOR_TRANSPORT_GOOD)
status = ISD200_GOOD;
else {
@@ -834,7 +835,7 @@
int detect )
{
int status = ISD200_GOOD;
- unsigned char regs[8];
+ unsigned char *regs = us->iobuf;
unsigned long endTime;
struct isd200_info *info = (struct isd200_info *)us->extra;
int recheckAsMaster = FALSE;
@@ -856,7 +857,7 @@
break;
status = isd200_action( us, ACTION_READ_STATUS,
- regs, sizeof(regs) );
+ regs, 8 );
if ( status != ISD200_GOOD )
break;
diff -Nru a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c Mon Jul 14 01:02:23 2003
+++ b/drivers/usb/storage/jumpshot.c Mon Jul 14 01:02:23 2003
@@ -86,7 +86,6 @@
static int jumpshot_get_status(struct us_data *us)
{
- unsigned char reply;
int rc;
if (!us)
@@ -94,14 +93,14 @@
// send the setup
rc = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe,
- 0, 0xA0, 0, 7, &reply, 1);
+ 0, 0xA0, 0, 7, us->iobuf, 1);
if (rc != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
- if (reply != 0x50) {
+ if (us->iobuf[0] != 0x50) {
US_DEBUGP("jumpshot_get_status: 0x%2x\n",
- (unsigned short) (reply));
+ us->iobuf[0]);
return USB_STOR_TRANSPORT_ERROR;
}
@@ -115,7 +114,7 @@
unsigned char *dest,
int use_sg)
{
- unsigned char command[] = { 0, 0, 0, 0, 0, 0xe0, 0x20 };
+ unsigned char *command = us->iobuf;
unsigned char *buffer = NULL;
unsigned char *ptr;
unsigned char thistime;
@@ -154,7 +153,8 @@
command[3] = (sector >> 8) & 0xFF;
command[4] = (sector >> 16) & 0xFF;
- command[5] |= (sector >> 24) & 0x0F;
+ command[5] = 0xE0 | ((sector >> 24) & 0x0F);
+ command[6] = 0x20;
// send the setup + command
result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
@@ -199,7 +199,7 @@
unsigned char *src,
int use_sg)
{
- unsigned char command[7] = { 0, 0, 0, 0, 0, 0xE0, 0x30 };
+ unsigned char *command = us->iobuf;
unsigned char *buffer = NULL;
unsigned char *ptr;
unsigned char thistime;
@@ -240,7 +240,8 @@
command[3] = (sector >> 8) & 0xFF;
command[4] = (sector >> 16) & 0xFF;
- command[5] |= (sector >> 24) & 0x0F;
+ command[5] = 0xE0 | ((sector >> 24) & 0x0F);
+ command[6] = 0x30;
// send the setup + command
result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
@@ -291,13 +292,19 @@
static int jumpshot_id_device(struct us_data *us,
struct jumpshot_info *info)
{
- unsigned char command[2] = { 0xe0, 0xec };
- unsigned char reply[512];
+ unsigned char *command = us->iobuf;
+ unsigned char *reply;
int rc;
if (!us || !info)
return USB_STOR_TRANSPORT_ERROR;
+ command[0] = 0xE0;
+ command[1] = 0xEC;
+ reply = kmalloc(512, GFP_NOIO);
+ if (!reply)
+ return USB_STOR_TRANSPORT_ERROR;
+
// send the setup
rc = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
0, 0x20, 0, 6, command, 2);
@@ -305,20 +312,27 @@
if (rc != USB_STOR_XFER_GOOD) {
US_DEBUGP("jumpshot_id_device: Gah! "
"send_control for read_capacity failed\n");
- return rc;
+ rc = USB_STOR_TRANSPORT_ERROR;
+ goto leave;
}
// read the reply
rc = jumpshot_bulk_read(us, reply, sizeof(reply));
- if (rc != USB_STOR_XFER_GOOD)
- return USB_STOR_TRANSPORT_ERROR;
+ if (rc != USB_STOR_XFER_GOOD) {
+ rc = USB_STOR_TRANSPORT_ERROR;
+ goto leave;
+ }
info->sectors = ((u32)(reply[117]) << 24) |
((u32)(reply[116]) << 16) |
((u32)(reply[115]) << 8) |
((u32)(reply[114]) );
- return USB_STOR_TRANSPORT_GOOD;
+ rc = USB_STOR_TRANSPORT_GOOD;
+
+ leave:
+ kfree(reply);
+ return rc;
}
static int jumpshot_handle_mode_sense(struct us_data *us,
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
But where are the THEMES?! How do you expect me to use an OS without
themes?!
-- Stef
User Friendly, 10/9/1998
pgp00000.pgp
Description: PGP signature
