ia64/xen-unstable

changeset 3839:d52b92174eee

bitkeeper revision 1.1207 (4212a4a3fSH5ORndkL3huFaCkLB62A)

Further USB Frontend tidying.

Signed-off-by: mark.williamson@cl.cam.ac.uk
author mwilli2@equilibrium.research
date Wed Feb 16 01:40:51 2005 +0000 (2005-02-16)
parents a58b3f082755
children 5e0509758416
files linux-2.6.10-xen-sparse/drivers/xen/usbfront/usbfront.c linux-2.6.10-xen-sparse/drivers/xen/usbfront/xhci.h
line diff
     1.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/usbfront/usbfront.c	Wed Feb 16 00:49:48 2005 +0000
     1.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/usbfront/usbfront.c	Wed Feb 16 01:40:51 2005 +0000
     1.3 @@ -1417,13 +1417,7 @@ static int alloc_xhci(void)
     1.4  		goto err_alloc_xhci;
     1.5  	}
     1.6  
     1.7 -	/* Reset here so we don't get any interrupts from an old setup */
     1.8 -	/*  or broken setup */
     1.9 -	//	reset_hc(xhci);
    1.10 -
    1.11 -
    1.12  	xhci->state = USBIF_STATE_CLOSED;
    1.13 -	xhci->is_suspended = 0;
    1.14  
    1.15  	spin_lock_init(&xhci->urb_remove_list_lock);
    1.16  	INIT_LIST_HEAD(&xhci->urb_remove_list);
     2.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/usbfront/xhci.h	Wed Feb 16 00:49:48 2005 +0000
     2.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/usbfront/xhci.h	Wed Feb 16 01:40:51 2005 +0000
     2.3 @@ -1,3 +1,15 @@
     2.4 +/******************************************************************************
     2.5 + * xhci.h
     2.6 + *
     2.7 + * Private definitions for the Xen Virtual USB Controller.  Based on
     2.8 + * drivers/usb/host/uhci.h from Linux.  Copyright for the imported content is
     2.9 + * retained by the original authors.
    2.10 + *
    2.11 + * Modifications are:
    2.12 + * Copyright (C) 2004 Intel Research Cambridge
    2.13 + * Copyright (C) 2004, 2005 Mark Williamson
    2.14 + */
    2.15 +
    2.16  #ifndef __LINUX_XHCI_H
    2.17  #define __LINUX_XHCI_H
    2.18  
    2.19 @@ -6,48 +18,19 @@
    2.20  #include <asm-xen/xen-public/io/usbif.h>
    2.21  #include <linux/spinlock.h>
    2.22  
    2.23 -#define XHCI_NUMFRAMES		1024	/* in the frame list [array] */
    2.24 -#define XHCI_MAX_SOF_NUMBER	2047	/* in an SOF packet */
    2.25 -#define CAN_SCHEDULE_FRAMES	1000	/* how far future frames can be scheduled */
    2.26 -
    2.27 -/* In the absence of actual hardware state, we maintain the current known state
    2.28 - * of the virtual hub ports in this data structure.
    2.29 - */
    2.30 -typedef struct
    2.31 -{
    2.32 -        unsigned int cs     :1;     /* Connection status.  do we really need this /and/ ccs? */
    2.33 +/* xhci_port_t - current known state of a virtual hub ports */
    2.34 +typedef struct {
    2.35 +        unsigned int cs     :1; /* Connection status.  do we really need this /and/ ccs? */
    2.36          unsigned int cs_chg :1; /* Connection status change.  */
    2.37 -        unsigned int pe     :1;     /* Port enable.               */
    2.38 +        unsigned int pe     :1; /* Port enable.               */
    2.39          unsigned int pe_chg :1; /* Port enable change.        */
    2.40 -        unsigned int ccs    :1;    /* Current connect status.    */
    2.41 -        unsigned int susp   :1;   /* Suspended.                 */
    2.42 -        unsigned int lsda   :1;   /* Low speed device attached. */
    2.43 -        unsigned int pr     :1;     /* Port reset.                */
    2.44 -        
    2.45 -    /* Device info? */
    2.46 +        unsigned int ccs    :1; /* Current connect status.    */
    2.47 +        unsigned int susp   :1; /* Suspended.                 */
    2.48 +        unsigned int lsda   :1; /* Low speed device attached. */
    2.49 +        unsigned int pr     :1; /* Port reset.                */
    2.50  } xhci_port_t;
    2.51  
    2.52 -struct xhci_frame_list {
    2.53 -	__u32 frame[XHCI_NUMFRAMES];
    2.54 -
    2.55 -	void *frame_cpu[XHCI_NUMFRAMES];
    2.56 -};
    2.57 -
    2.58 -struct urb_priv;
    2.59 -
    2.60 -#define xhci_status_bits(ctrl_sts)	(ctrl_sts & 0xFE0000)
    2.61 -#define xhci_actual_length(ctrl_sts)	((ctrl_sts + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */
    2.62 -
    2.63 -#define xhci_maxlen(token)	((token) >> 21)
    2.64 -#define xhci_expected_length(info) (((info >> 21) + 1) & TD_TOKEN_EXPLEN_MASK) /* 1-based */
    2.65 -#define xhci_toggle(token)	(((token) >> TD_TOKEN_TOGGLE_SHIFT) & 1)
    2.66 -#define xhci_endpoint(token)	(((token) >> 15) & 0xf)
    2.67 -#define xhci_devaddr(token)	(((token) >> 8) & 0x7f)
    2.68 -#define xhci_devep(token)	(((token) >> 8) & 0x7ff)
    2.69 -#define xhci_packetid(token)	((token) & TD_TOKEN_PID_MASK)
    2.70 -#define xhci_packetout(token)	(xhci_packetid(token) != USB_PID_IN)
    2.71 -#define xhci_packetin(token)	(xhci_packetid(token) == USB_PID_IN)
    2.72 -
    2.73 +/* struct virt_root_hub - state related to the virtual root hub */
    2.74  struct virt_root_hub {
    2.75  	struct usb_device *dev;
    2.76  	int devnum;		/* Address of Root Hub endpoint */
    2.77 @@ -59,15 +42,10 @@ struct virt_root_hub {
    2.78  	int c_p_r[8];
    2.79  	struct timer_list rh_int_timer;
    2.80          spinlock_t port_state_lock;
    2.81 -        xhci_port_t *ports;       /*  */
    2.82 +        xhci_port_t *ports;
    2.83  };
    2.84  
    2.85 -/*
    2.86 - * This describes the full xhci information.
    2.87 - *
    2.88 - * Note how the "proper" USB information is just
    2.89 - * a subset of what the full implementation needs.
    2.90 - */
    2.91 +/* struct xhci - contains the state associated with a single USB interface */
    2.92  struct xhci {
    2.93  
    2.94  #ifdef CONFIG_PROC_FS
    2.95 @@ -78,16 +56,14 @@ struct xhci {
    2.96  
    2.97          int evtchn;                        /* Interdom channel to backend */
    2.98          int irq;                           /* Bound to evtchn */
    2.99 -        int state;                         /* State of this USB interface */
   2.100 +        enum { USBIF_STATE_CONNECTED    = 2,
   2.101 +               USBIF_STATE_DISCONNECTED = 1,
   2.102 +               USBIF_STATE_CLOSED       = 0
   2.103 +        } state; /* State of this USB interface */
   2.104          unsigned long bandwidth;
   2.105 -        int handle;
   2.106  
   2.107  	struct usb_bus *bus;
   2.108  
   2.109 -	spinlock_t frame_list_lock;
   2.110 -	struct xhci_frame_list *fl;		/* P: xhci->frame_list_lock */
   2.111 -	int is_suspended;
   2.112 -
   2.113  	/* Main list of URB's currently controlled by this HC */
   2.114  	spinlock_t urb_list_lock;
   2.115  	struct list_head urb_list;		/* P: xhci->urb_list_lock */
   2.116 @@ -102,12 +78,12 @@ struct xhci {
   2.117  
   2.118  	struct virt_root_hub rh;	/* private data of the virtual root hub */
   2.119  
   2.120 -        spinlock_t response_lock;
   2.121 +        usbif_front_ring_t usb_ring;
   2.122  
   2.123 -        usbif_front_ring_t usb_ring;
   2.124 -        int usb_resp_cons;
   2.125 +        int awaiting_reset;
   2.126  };
   2.127  
   2.128 +/* per-URB private data structure for the host controller */
   2.129  struct urb_priv {
   2.130  	struct urb *urb;
   2.131          usbif_iso_t *schedule;
   2.132 @@ -122,7 +98,6 @@ struct urb_priv {
   2.133  
   2.134  	unsigned long inserttime;	/* In jiffies */
   2.135  
   2.136 -	struct list_head queue_list;	/* P: xhci->frame_list_lock */
   2.137  	struct list_head complete_list;	/* P: xhci->complete_list_lock */
   2.138  };
   2.139  
   2.140 @@ -140,8 +115,7 @@ struct urb_priv {
   2.141   *
   2.142   * #1 xhci->urb_list_lock
   2.143   * #2 urb->lock
   2.144 - * #3 xhci->urb_remove_list_lock, xhci->frame_list_lock, 
   2.145 - *   xhci->qh_remove_list_lock
   2.146 + * #3 xhci->urb_remove_list_lock
   2.147   * #4 xhci->complete_list_lock
   2.148   *
   2.149   * If you're going to grab 2 or more locks at once, ALWAYS grab the lock