isd200.c (7a9787e1eba95a166265e6a260cf30af04ef0a99) | isd200.c (32d5493eb83a217c3b1eba4b98cd6d19864f71a8) |
---|---|
1/* Transport & Protocol Driver for In-System Design, Inc. ISD200 ASIC 2 * 3 * Current development and maintenance: 4 * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se) 5 * 6 * Developed with the assistance of: 7 * (C) 2002 Alan Stern <stern@rowland.org> 8 * --- 30 unchanged lines hidden (view full) --- 39 * (bjorn@haxx.se) 40 */ 41 42 43/* Include files */ 44 45#include <linux/jiffies.h> 46#include <linux/errno.h> | 1/* Transport & Protocol Driver for In-System Design, Inc. ISD200 ASIC 2 * 3 * Current development and maintenance: 4 * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se) 5 * 6 * Developed with the assistance of: 7 * (C) 2002 Alan Stern <stern@rowland.org> 8 * --- 30 unchanged lines hidden (view full) --- 39 * (bjorn@haxx.se) 40 */ 41 42 43/* Include files */ 44 45#include <linux/jiffies.h> 46#include <linux/errno.h> |
47#include <linux/module.h> |
|
47#include <linux/slab.h> 48#include <linux/hdreg.h> 49#include <linux/scatterlist.h> 50 51#include <scsi/scsi.h> 52#include <scsi/scsi_cmnd.h> 53#include <scsi/scsi_device.h> 54 55#include "usb.h" 56#include "transport.h" 57#include "protocol.h" 58#include "debug.h" 59#include "scsiglue.h" | 48#include <linux/slab.h> 49#include <linux/hdreg.h> 50#include <linux/scatterlist.h> 51 52#include <scsi/scsi.h> 53#include <scsi/scsi_cmnd.h> 54#include <scsi/scsi_device.h> 55 56#include "usb.h" 57#include "transport.h" 58#include "protocol.h" 59#include "debug.h" 60#include "scsiglue.h" |
60#include "isd200.h" | |
61 62 | 61 62 |
63static int isd200_Initialization(struct us_data *us); 64 65 66/* 67 * The table of devices 68 */ 69#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ 70 vendorName, productName, useProtocol, useTransport, \ 71 initFunction, flags) \ 72{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 73 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 74 75struct usb_device_id isd200_usb_ids[] = { 76# include "unusual_isd200.h" 77 { } /* Terminating entry */ 78}; 79MODULE_DEVICE_TABLE(usb, isd200_usb_ids); 80 81#undef UNUSUAL_DEV 82#undef USUAL_DEV 83 84/* 85 * The flags table 86 */ 87#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ 88 vendor_name, product_name, use_protocol, use_transport, \ 89 init_function, Flags) \ 90{ \ 91 .vendorName = vendor_name, \ 92 .productName = product_name, \ 93 .useProtocol = use_protocol, \ 94 .useTransport = use_transport, \ 95 .initFunction = init_function, \ 96} 97 98static struct us_unusual_dev isd200_unusual_dev_list[] = { 99# include "unusual_isd200.h" 100 { } /* Terminating entry */ 101}; 102 103#undef UNUSUAL_DEV 104#undef USUAL_DEV 105 106 |
|
63/* Timeout defines (in Seconds) */ 64 65#define ISD200_ENUM_BSY_TIMEOUT 35 66#define ISD200_ENUM_DETECT_TIMEOUT 30 67#define ISD200_DEFAULT_TIMEOUT 30 68 69/* device flags */ 70#define DF_ATA_DEVICE 0x0001 --- 1442 unchanged lines hidden (view full) --- 1513 1514 return retStatus; 1515} 1516 1517/************************************************************************** 1518 * Initialization for the ISD200 1519 */ 1520 | 107/* Timeout defines (in Seconds) */ 108 109#define ISD200_ENUM_BSY_TIMEOUT 35 110#define ISD200_ENUM_DETECT_TIMEOUT 30 111#define ISD200_DEFAULT_TIMEOUT 30 112 113/* device flags */ 114#define DF_ATA_DEVICE 0x0001 --- 1442 unchanged lines hidden (view full) --- 1557 1558 return retStatus; 1559} 1560 1561/************************************************************************** 1562 * Initialization for the ISD200 1563 */ 1564 |
1521int isd200_Initialization(struct us_data *us) | 1565static int isd200_Initialization(struct us_data *us) |
1522{ 1523 US_DEBUGP("ISD200 Initialization...\n"); 1524 1525 /* Initialize ISD200 info struct */ 1526 1527 if (isd200_init_info(us) == ISD200_ERROR) { 1528 US_DEBUGP("ERROR Initializing ISD200 Info struct\n"); 1529 } else { --- 14 unchanged lines hidden (view full) --- 1544 * 1545 * This protocol and transport are for ATA devices connected to an ISD200 1546 * ASIC. An ATAPI device that is conected as a slave device will be 1547 * detected in the driver initialization function and the protocol will 1548 * be changed to an ATAPI protocol (Transparent SCSI). 1549 * 1550 */ 1551 | 1566{ 1567 US_DEBUGP("ISD200 Initialization...\n"); 1568 1569 /* Initialize ISD200 info struct */ 1570 1571 if (isd200_init_info(us) == ISD200_ERROR) { 1572 US_DEBUGP("ERROR Initializing ISD200 Info struct\n"); 1573 } else { --- 14 unchanged lines hidden (view full) --- 1588 * 1589 * This protocol and transport are for ATA devices connected to an ISD200 1590 * ASIC. An ATAPI device that is conected as a slave device will be 1591 * detected in the driver initialization function and the protocol will 1592 * be changed to an ATAPI protocol (Transparent SCSI). 1593 * 1594 */ 1595 |
1552void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) | 1596static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) |
1553{ 1554 int sendToTransport = 1, orig_bufflen; 1555 union ata_cdb ataCdb; 1556 1557 /* Make sure driver was initialized */ 1558 1559 if (us->extra == NULL) 1560 US_DEBUGP("ERROR Driver not initialized\n"); --- 4 unchanged lines hidden (view full) --- 1565 sendToTransport = isd200_scsi_to_ata(srb, us, &ataCdb); 1566 1567 /* send the command to the transport layer */ 1568 if (sendToTransport) 1569 isd200_invoke_transport(us, srb, &ataCdb); 1570 1571 isd200_srb_set_bufflen(srb, orig_bufflen); 1572} | 1597{ 1598 int sendToTransport = 1, orig_bufflen; 1599 union ata_cdb ataCdb; 1600 1601 /* Make sure driver was initialized */ 1602 1603 if (us->extra == NULL) 1604 US_DEBUGP("ERROR Driver not initialized\n"); --- 4 unchanged lines hidden (view full) --- 1609 sendToTransport = isd200_scsi_to_ata(srb, us, &ataCdb); 1610 1611 /* send the command to the transport layer */ 1612 if (sendToTransport) 1613 isd200_invoke_transport(us, srb, &ataCdb); 1614 1615 isd200_srb_set_bufflen(srb, orig_bufflen); 1616} |
1617 1618static int isd200_probe(struct usb_interface *intf, 1619 const struct usb_device_id *id) 1620{ 1621 struct us_data *us; 1622 int result; 1623 1624 result = usb_stor_probe1(&us, intf, id, 1625 (id - isd200_usb_ids) + isd200_unusual_dev_list); 1626 if (result) 1627 return result; 1628 1629 us->protocol_name = "ISD200 ATA/ATAPI"; 1630 us->proto_handler = isd200_ata_command; 1631 1632 result = usb_stor_probe2(us); 1633 return result; 1634} 1635 1636static struct usb_driver isd200_driver = { 1637 .name = "ums-isd200", 1638 .probe = isd200_probe, 1639 .disconnect = usb_stor_disconnect, 1640 .suspend = usb_stor_suspend, 1641 .resume = usb_stor_resume, 1642 .reset_resume = usb_stor_reset_resume, 1643 .pre_reset = usb_stor_pre_reset, 1644 .post_reset = usb_stor_post_reset, 1645 .id_table = isd200_usb_ids, 1646 .soft_unbind = 1, 1647}; 1648 1649static int __init isd200_init(void) 1650{ 1651 return usb_register(&isd200_driver); 1652} 1653 1654static void __exit isd200_exit(void) 1655{ 1656 usb_deregister(&isd200_driver); 1657} 1658 1659module_init(isd200_init); 1660module_exit(isd200_exit); |
|