• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  *   Copyright (c) International Business Machines  Corp., 2001
4  *
5  *   This program is free software;  you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or
8  *   (at your option) any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13  *   the GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program;  if not, write to the Free Software
17  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19 */
20 //extern struct usb_bus *usb_alloc_bus(struct usb_operations *);
21 extern void usb_connect(struct usb_device *dev);
22 extern int usb_new_device(struct usb_device *dev);
23 extern void usb_free_bus(struct usb_bus *bus);
24 extern void usb_register_bus(struct usb_bus *bus);
25 extern void usb_deregister_bus(struct usb_bus *bus);
26 extern int usb_hcd_pci_probe(struct pci_dev *, const struct pci_device_id *);
27 extern void usb_hcd_pci_remove(struct pci_dev *);
28 extern int usb_hcd_pci_suspend(struct pci_dev *, u32);
29 extern int usb_hcd_pci_resume(struct pci_dev *);
30 
31 #ifndef usb_operations
32 	struct usb_operations {
33 	        int (*allocate)(struct usb_device *);
34 	        int (*deallocate)(struct usb_device *);
35 	        int (*get_frame_number) (struct usb_device *dev);
36 	        int (*submit_urb) (struct urb *urb);
37 	        int (*unlink_urb) (struct urb *urb);
38 
39 		/* allocate dma-consistent buffer for URB_DMA_NOMAPPING */
40 	        void *(*buffer_alloc)(struct usb_bus *bus, size_t size,
41         	                int mem_flags,
42         	                dma_addr_t *dma);
43         	void (*buffer_free)(struct usb_bus *bus, size_t size,
44                 	        void *addr, dma_addr_t dma);
45 	};
46 #endif
47 
48 #ifndef usb_hcd
49 	struct usb_hcd {
50 		struct usb_bus          self;           /* hcd is-a bus */
51 	        const char              *product_desc;  /* product/vendor string */
52 	        const char              *description;   /* "ehci-hcd" etc */
53 	        struct timer_list       rh_timer;       /* drives root hub */
54 	        struct list_head        dev_list;       /* devices on this bus */
55 	        struct work_struct      work;
56 	        struct hc_driver        *driver;        /* hw-specific hooks */
57 	        int                     irq;            /* irq allocated */
58 	        void                    *regs;          /* device memory/io */
59 	        struct device           *controller;    /* handle to hardware */
60 	        struct pci_dev          *pdev;          /* pci is typical */
61 	        int                     region;         /* pci region for regs */
62 	        u32                     pci_state [16]; /* for PM state save */
63 	        atomic_t                resume_count;   /* multiple resumes issue */
64 	        struct pci_pool         *pool [4];
65 	        int                     state;
66 	};
67 #endif
68 
69 
70 #ifndef hc_driver
71 	struct hc_driver {
72 		const char      *description;   /* "ehci-hcd" etc */
73         	void    (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
74 	        int     flags;
75         	int     (*start) (struct usb_hcd *hcd);
76         	int     (*suspend) (struct usb_hcd *hcd, __u32 state);
77         	int     (*resume) (struct usb_hcd *hcd);
78         	void    (*stop) (struct usb_hcd *hcd);
79         	int     (*get_frame_number) (struct usb_hcd *hcd);
80         	struct usb_hcd  *(*hcd_alloc) (void);
81         	void            (*hcd_free) (struct usb_hcd *hcd);
82 	        int     (*urb_enqueue) (struct usb_hcd *hcd, struct urb *urb,
83 				int mem_flags);
84         	int     (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb);
85         	void            (*free_config) (struct usb_hcd *hcd,
86                                 struct usb_device *dev);
87 
88 		int     (*hub_status_data) (struct usb_hcd *hcd, char *buf);
89 		int     (*hub_control) (struct usb_hcd *hcd,
90                                 u16 typeReq, u16 wValue, u16 wIndex,
91                                 char *buf, u16 wLength);
92 	};
93 #endif
94 
95 #ifndef USB_MAXBUS
96 	#define USB_MAXBUS              64
97 #endif
98 
99 struct tusb_user {
100 	struct usb_bus		*bus;
101 	struct usb_device	*dev;
102 	struct pci_dev		*pdev;
103 };
104 typedef struct tusb_user tusb_user_t;
105 
106