patch-2.4.20 linux-2.4.20/drivers/usb/usb-uhci.c
Next file: linux-2.4.20/drivers/usb/usb-uhci.h
Previous file: linux-2.4.20/drivers/usb/usb-ohci.h
Back to the patch index
Back to the overall index
- Lines: 475
- Date:
Thu Nov 28 15:53:15 2002
- Orig file:
linux-2.4.19/drivers/usb/usb-uhci.c
- Orig date:
Fri Aug 2 17:39:45 2002
diff -urN linux-2.4.19/drivers/usb/usb-uhci.c linux-2.4.20/drivers/usb/usb-uhci.c
@@ -59,6 +59,8 @@
#include "usb-uhci.h"
#include "usb-uhci-debug.h"
+#include "hcd.h"
+
/*
* Version Information
*/
@@ -117,12 +119,12 @@
// Suppress HC interrupt error messages for 5s
#define ERROR_SUPPRESSION_TIME (HZ*5)
-_static int rh_submit_urb (urb_t *urb);
-_static int rh_unlink_urb (urb_t *urb);
+_static int rh_submit_urb (struct urb *urb);
+_static int rh_unlink_urb (struct urb *urb);
_static int delete_qh (uhci_t *s, uhci_desc_t *qh);
-_static int process_transfer (uhci_t *s, urb_t *urb, int mode);
-_static int process_interrupt (uhci_t *s, urb_t *urb);
-_static int process_iso (uhci_t *s, urb_t *urb, int force);
+_static int process_transfer (uhci_t *s, struct urb *urb, int mode);
+_static int process_interrupt (uhci_t *s, struct urb *urb);
+_static int process_iso (uhci_t *s, struct urb *urb, int force);
// How much URBs with ->next are walked
#define MAX_NEXT_COUNT 2048
@@ -168,7 +170,7 @@
}
/*-------------------------------------------------------------------*/
#ifdef CONFIG_USB_UHCI_HIGH_BANDWIDTH
-_static void enable_desc_loop(uhci_t *s, urb_t *urb)
+_static void enable_desc_loop(uhci_t *s, struct urb *urb)
{
unsigned long flags;
@@ -183,7 +185,7 @@
spin_unlock_irqrestore (&s->qh_lock, flags);
}
/*-------------------------------------------------------------------*/
-_static void disable_desc_loop(uhci_t *s, urb_t *urb)
+_static void disable_desc_loop(uhci_t *s, struct urb *urb)
{
unsigned long flags;
@@ -204,7 +206,7 @@
}
#endif
/*-------------------------------------------------------------------*/
-_static void queue_urb_unlocked (uhci_t *s, urb_t *urb)
+_static void queue_urb_unlocked (uhci_t *s, struct urb *urb)
{
struct list_head *p=&urb->urb_list;
#ifdef CONFIG_USB_UHCI_HIGH_BANDWIDTH
@@ -224,7 +226,7 @@
uhci_switch_timer_int(s);
}
/*-------------------------------------------------------------------*/
-_static void queue_urb (uhci_t *s, urb_t *urb)
+_static void queue_urb (uhci_t *s, struct urb *urb)
{
unsigned long flags=0;
@@ -233,7 +235,7 @@
spin_unlock_irqrestore (&s->urb_list_lock, flags);
}
/*-------------------------------------------------------------------*/
-_static void dequeue_urb (uhci_t *s, urb_t *urb)
+_static void dequeue_urb (uhci_t *s, struct urb *urb)
{
#ifdef CONFIG_USB_UHCI_HIGH_BANDWIDTH
int type;
@@ -698,7 +700,7 @@
// LOW LEVEL STUFF
// assembles QHs und TDs for control, bulk and iso
/*-------------------------------------------------------------------*/
-_static int uhci_submit_control_urb (urb_t *urb)
+_static int uhci_submit_control_urb (struct urb *urb)
{
uhci_desc_t *qh, *td;
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
@@ -815,7 +817,7 @@
// For queued bulk transfers, two additional QH helpers are allocated (nqh, bqh)
// Due to the linking with other bulk urbs, it has to be locked with urb_list_lock!
-_static int uhci_submit_bulk_urb (urb_t *urb, urb_t *bulk_urb)
+_static int uhci_submit_bulk_urb (struct urb *urb, struct urb *bulk_urb)
{
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
urb_priv_t *urb_priv = urb->hcpriv, *upriv, *bpriv=NULL;
@@ -977,7 +979,7 @@
looks a bit complicated because of all the bulk queueing goodies
*/
-_static void uhci_clean_transfer (uhci_t *s, urb_t *urb, uhci_desc_t *qh, int mode)
+_static void uhci_clean_transfer (uhci_t *s, struct urb *urb, uhci_desc_t *qh, int mode)
{
uhci_desc_t *bqh, *nqh, *prevqh, *prevtd;
int now;
@@ -1031,7 +1033,7 @@
urb, priv->prev_queued_urb, priv->next_queued_urb, qh, bqh, priv->next_qh);
if (mode != CLEAN_TRANSFER_DELETION_MARK) { // no work for cleanup at unlink-completion
- urb_t *nurb;
+ struct urb *nurb;
unsigned long flags;
nurb = priv->next_queued_urb;
@@ -1069,7 +1071,7 @@
}
/*-------------------------------------------------------------------*/
// Release bandwidth for Interrupt or Isoc. transfers
-_static void uhci_release_bandwidth(urb_t *urb)
+_static void uhci_release_bandwidth(struct urb *urb)
{
if (urb->bandwidth) {
switch (usb_pipetype(urb->pipe)) {
@@ -1085,11 +1087,11 @@
}
}
-_static void uhci_urb_dma_sync(uhci_t *s, urb_t *urb, urb_priv_t *urb_priv)
+_static void uhci_urb_dma_sync(uhci_t *s, struct urb *urb, urb_priv_t *urb_priv)
{
if (urb_priv->setup_packet_dma)
pci_dma_sync_single(s->uhci_pci, urb_priv->setup_packet_dma,
- sizeof(devrequest), PCI_DMA_TODEVICE);
+ sizeof(struct usb_ctrlrequest), PCI_DMA_TODEVICE);
if (urb_priv->transfer_buffer_dma)
pci_dma_sync_single(s->uhci_pci, urb_priv->transfer_buffer_dma,
@@ -1099,11 +1101,11 @@
PCI_DMA_TODEVICE);
}
-_static void uhci_urb_dma_unmap(uhci_t *s, urb_t *urb, urb_priv_t *urb_priv)
+_static void uhci_urb_dma_unmap(uhci_t *s, struct urb *urb, urb_priv_t *urb_priv)
{
if (urb_priv->setup_packet_dma) {
pci_unmap_single(s->uhci_pci, urb_priv->setup_packet_dma,
- sizeof(devrequest), PCI_DMA_TODEVICE);
+ sizeof(struct usb_ctrlrequest), PCI_DMA_TODEVICE);
urb_priv->setup_packet_dma = 0;
}
if (urb_priv->transfer_buffer_dma) {
@@ -1120,7 +1122,7 @@
mode: UNLINK_ASYNC_STORE_URB: unlink and move URB into unlinked list
UNLINK_ASYNC_DONT_STORE: unlink, don't move URB into unlinked list
*/
-_static int uhci_unlink_urb_async (uhci_t *s,urb_t *urb, int mode)
+_static int uhci_unlink_urb_async (uhci_t *s,struct urb *urb, int mode)
{
uhci_desc_t *qh;
urb_priv_t *urb_priv;
@@ -1165,7 +1167,7 @@
}
/*-------------------------------------------------------------------*/
// kills an urb by unlinking descriptors and waiting for at least one frame
-_static int uhci_unlink_urb_sync (uhci_t *s, urb_t *urb)
+_static int uhci_unlink_urb_sync (uhci_t *s, struct urb *urb)
{
uhci_desc_t *qh;
urb_priv_t *urb_priv;
@@ -1176,7 +1178,7 @@
if (urb->status == -EINPROGRESS) {
- // move descriptors out the the running chains, dequeue urb
+ // move descriptors out of the running chains, dequeue urb
uhci_unlink_urb_async(s, urb, UNLINK_ASYNC_DONT_STORE);
urb_priv = urb->hcpriv;
@@ -1229,7 +1231,7 @@
_static void uhci_cleanup_unlink(uhci_t *s, int force)
{
struct list_head *q;
- urb_t *urb;
+ struct urb *urb;
struct usb_device *dev;
int now, type;
urb_priv_t *urb_priv;
@@ -1239,7 +1241,7 @@
while (q != &s->urb_unlinked) {
- urb = list_entry (q, urb_t, urb_list);
+ urb = list_entry (q, struct urb, urb_list);
urb_priv = (urb_priv_t*)urb->hcpriv;
q = urb->urb_list.next;
@@ -1308,7 +1310,7 @@
}
/*-------------------------------------------------------------------*/
-_static int uhci_unlink_urb (urb_t *urb)
+_static int uhci_unlink_urb (struct urb *urb)
{
uhci_t *s;
unsigned long flags=0;
@@ -1341,9 +1343,9 @@
// In case of ASAP iso transfer, search the URB-list for already queued URBs
// for this EP and calculate the earliest start frame for the new
// URB (easy seamless URB continuation!)
-_static int find_iso_limits (urb_t *urb, unsigned int *start, unsigned int *end)
+_static int find_iso_limits (struct urb *urb, unsigned int *start, unsigned int *end)
{
- urb_t *u, *last_urb = NULL;
+ struct urb *u, *last_urb = NULL;
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
struct list_head *p;
int ret=-1;
@@ -1353,7 +1355,7 @@
p=s->urb_list.prev;
for (; p != &s->urb_list; p = p->prev) {
- u = list_entry (p, urb_t, urb_list);
+ u = list_entry (p, struct urb, urb_list);
// look for pending URBs with identical pipe handle
// works only because iso doesn't toggle the data bit!
if ((urb->pipe == u->pipe) && (urb->dev == u->dev) && (u->status == -EINPROGRESS)) {
@@ -1375,7 +1377,7 @@
/*-------------------------------------------------------------------*/
// adjust start_frame according to scheduling constraints (ASAP etc)
-_static int iso_find_start (urb_t *urb)
+_static int iso_find_start (struct urb *urb)
{
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
unsigned int now;
@@ -1433,7 +1435,7 @@
// ASAP-flag set implicitely
// if period==0, the transfer is only done once
-_static int uhci_submit_int_urb (urb_t *urb)
+_static int uhci_submit_int_urb (struct urb *urb)
{
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
urb_priv_t *urb_priv = urb->hcpriv;
@@ -1493,7 +1495,7 @@
return 0;
}
/*-------------------------------------------------------------------*/
-_static int uhci_submit_iso_urb (urb_t *urb)
+_static int uhci_submit_iso_urb (struct urb *urb)
{
uhci_t *s = (uhci_t*) urb->dev->bus->hcpriv;
urb_priv_t *urb_priv = urb->hcpriv;
@@ -1586,10 +1588,10 @@
/*-------------------------------------------------------------------*/
// returns: 0 (no transfer queued), urb* (this urb already queued)
-_static urb_t* search_dev_ep (uhci_t *s, urb_t *urb)
+_static struct urb* search_dev_ep (uhci_t *s, struct urb *urb)
{
struct list_head *p;
- urb_t *tmp;
+ struct urb *tmp;
unsigned int mask = usb_pipecontrol(urb->pipe) ? (~USB_DIR_IN) : (~0);
dbg("search_dev_ep:");
@@ -1597,7 +1599,7 @@
p=s->urb_list.next;
for (; p != &s->urb_list; p = p->next) {
- tmp = list_entry (p, urb_t, urb_list);
+ tmp = list_entry (p, struct urb, urb_list);
dbg("urb: %p", tmp);
// we can accept this urb if it is not queued at this time
// or if non-iso transfer requests should be scheduled for the same device and pipe
@@ -1610,13 +1612,13 @@
return 0;
}
/*-------------------------------------------------------------------*/
-_static int uhci_submit_urb (urb_t *urb)
+_static int uhci_submit_urb (struct urb *urb)
{
uhci_t *s;
urb_priv_t *urb_priv;
int ret = 0, type;
unsigned long flags;
- urb_t *queued_urb=NULL;
+ struct urb *queued_urb=NULL;
int bustime;
if (!urb->dev || !urb->dev->bus)
@@ -1683,7 +1685,7 @@
if (type == PIPE_CONTROL)
urb_priv->setup_packet_dma = pci_map_single(s->uhci_pci, urb->setup_packet,
- sizeof(devrequest), PCI_DMA_TODEVICE);
+ sizeof(struct usb_ctrlrequest), PCI_DMA_TODEVICE);
if (urb->transfer_buffer_length)
urb_priv->transfer_buffer_dma = pci_map_single(s->uhci_pci,
@@ -1770,7 +1772,7 @@
_static void uhci_check_timeouts(uhci_t *s)
{
struct list_head *p,*p2;
- urb_t *urb;
+ struct urb *urb;
int type;
p = s->urb_list.prev;
@@ -1780,7 +1782,7 @@
p2 = p;
p = p->prev;
- urb = list_entry (p2, urb_t, urb_list);
+ urb = list_entry (p2, struct urb, urb_list);
type = usb_pipetype (urb->pipe);
hcpriv = (urb_priv_t*)urb->hcpriv;
@@ -1878,7 +1880,7 @@
/*-------------------------------------------------------------------------*/
/* prepare Interrupt pipe transaction data; HUB INTERRUPT ENDPOINT */
-_static int rh_send_irq (urb_t *urb)
+_static int rh_send_irq (struct urb *urb)
{
int len = 1;
int i;
@@ -1905,12 +1907,12 @@
/*-------------------------------------------------------------------------*/
/* Virtual Root Hub INTs are polled by this timer every "intervall" ms */
-_static int rh_init_int_timer (urb_t *urb);
+_static int rh_init_int_timer (struct urb *urb);
_static void rh_int_timer_do (unsigned long ptr)
{
int len;
- urb_t *urb = (urb_t*) ptr;
+ struct urb *urb = (struct urb*) ptr;
uhci_t *uhci = urb->dev->bus->hcpriv;
if (uhci->rh.send) {
@@ -1927,7 +1929,7 @@
/*-------------------------------------------------------------------------*/
/* Root Hub INTs are polled by this timer, polling interval 20ms */
-_static int rh_init_int_timer (urb_t *urb)
+_static int rh_init_int_timer (struct urb *urb)
{
uhci_t *uhci = urb->dev->bus->hcpriv;
@@ -1961,12 +1963,12 @@
*************************/
-_static int rh_submit_urb (urb_t *urb)
+_static int rh_submit_urb (struct urb *urb)
{
struct usb_device *usb_dev = urb->dev;
uhci_t *uhci = usb_dev->bus->hcpriv;
unsigned int pipe = urb->pipe;
- devrequest *cmd = (devrequest *) urb->setup_packet;
+ struct usb_ctrlrequest *cmd = (struct usb_ctrlrequest *) urb->setup_packet;
void *data = urb->transfer_buffer;
int leni = urb->transfer_buffer_length;
int len = 0;
@@ -1992,10 +1994,10 @@
}
- bmRType_bReq = cmd->requesttype | cmd->request << 8;
- wValue = le16_to_cpu (cmd->value);
- wIndex = le16_to_cpu (cmd->index);
- wLength = le16_to_cpu (cmd->length);
+ bmRType_bReq = cmd->bRequestType | cmd->bRequest << 8;
+ wValue = le16_to_cpu (cmd->wValue);
+ wIndex = le16_to_cpu (cmd->wIndex);
+ wLength = le16_to_cpu (cmd->wLength);
for (i = 0; i < 8; i++)
uhci->rh.c_p_r[i] = 0;
@@ -2162,7 +2164,7 @@
}
/*-------------------------------------------------------------------------*/
-_static int rh_unlink_urb (urb_t *urb)
+_static int rh_unlink_urb (struct urb *urb)
{
uhci_t *uhci = urb->dev->bus->hcpriv;
@@ -2220,14 +2222,14 @@
unsigned long flags;
struct list_head *p;
struct list_head *p2;
- urb_t *urb;
+ struct urb *urb;
spin_lock_irqsave (&s->urb_list_lock, flags);
p = s->urb_list.prev;
while (p != &s->urb_list) {
p2 = p;
p = p->prev ;
- urb = list_entry (p2, urb_t, urb_list);
+ urb = list_entry (p2, struct urb, urb_list);
dbg("urb: %p, dev %p, %p", urb, usb_dev,urb->dev);
//urb->transfer_flags |=USB_ASYNC_UNLINK;
@@ -2277,7 +2279,7 @@
uhci_unlink_urb
};
-_static void correct_data_toggles(urb_t *urb)
+_static void correct_data_toggles(struct urb *urb)
{
usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), usb_pipeout (urb->pipe),
!usb_gettoggle (urb->dev, usb_pipeendpoint (urb->pipe), usb_pipeout (urb->pipe)));
@@ -2307,7 +2309,7 @@
* PROCESS_TRANSFER_DONT_UNLINK: QHs already unlinked (for async unlink_urb)
*/
-_static int process_transfer (uhci_t *s, urb_t *urb, int mode)
+_static int process_transfer (uhci_t *s, struct urb *urb, int mode)
{
int ret = 0;
urb_priv_t *urb_priv = urb->hcpriv;
@@ -2395,7 +2397,7 @@
if (usb_pipetype (urb->pipe) == PIPE_BULK ) { /* toggle correction for short bulk transfers (nonqueued/queued) */
urb_priv_t *priv=(urb_priv_t*)urb->hcpriv;
- urb_t *next_queued_urb=priv->next_queued_urb;
+ struct urb *next_queued_urb=priv->next_queued_urb;
if (next_queued_urb) {
urb_priv_t *next_priv=(urb_priv_t*)next_queued_urb->hcpriv;
@@ -2426,7 +2428,7 @@
return ret;
}
-_static int process_interrupt (uhci_t *s, urb_t *urb)
+_static int process_interrupt (uhci_t *s, struct urb *urb)
{
int i, ret = -EINPROGRESS;
urb_priv_t *urb_priv = urb->hcpriv;
@@ -2525,7 +2527,7 @@
// mode: PROCESS_ISO_REGULAR: processing only for done TDs, unlink TDs
// mode: PROCESS_ISO_FORCE: force processing, don't unlink TDs (already unlinked)
-_static int process_iso (uhci_t *s, urb_t *urb, int mode)
+_static int process_iso (uhci_t *s, struct urb *urb, int mode)
{
int i;
int ret = 0;
@@ -2594,9 +2596,9 @@
_static int process_urb (uhci_t *s, struct list_head *p)
{
int ret = 0;
- urb_t *urb;
+ struct urb *urb;
- urb=list_entry (p, urb_t, urb_list);
+ urb=list_entry (p, struct urb, urb_list);
//dbg("process_urb: found queued urb: %p", urb);
switch (usb_pipetype (urb->pipe)) {
@@ -2645,7 +2647,7 @@
#endif
if ((usb_pipetype (urb->pipe) != PIPE_INTERRUPT)) { // process_interrupt does completion on its own
- urb_t *next_urb = urb->next;
+ struct urb *next_urb = urb->next;
int is_ring = 0;
int contains_killed = 0;
int loop_count=0;
@@ -2952,6 +2954,7 @@
}
s->bus = bus;
+ bus->bus_name = dev->slot_name;
bus->hcpriv = s;
/* UHCI specs says devices must have 2 ports, but goes on to say */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)