1 | /* $FreeBSD$ */ |
---|
2 | /*- |
---|
3 | * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions |
---|
7 | * are met: |
---|
8 | * 1. Redistributions of source code must retain the above copyright |
---|
9 | * notice, this list of conditions and the following disclaimer. |
---|
10 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
11 | * notice, this list of conditions and the following disclaimer in the |
---|
12 | * documentation and/or other materials provided with the distribution. |
---|
13 | * |
---|
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
24 | * SUCH DAMAGE. |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef _USB_BUS_H_ |
---|
28 | #define _USB_BUS_H_ |
---|
29 | |
---|
30 | struct usb_fs_privdata; |
---|
31 | |
---|
32 | /* |
---|
33 | * The following structure defines the USB explore message sent to the USB |
---|
34 | * explore process. |
---|
35 | */ |
---|
36 | |
---|
37 | struct usb_bus_msg { |
---|
38 | struct usb_proc_msg hdr; |
---|
39 | struct usb_bus *bus; |
---|
40 | }; |
---|
41 | |
---|
42 | /* |
---|
43 | * The following structure defines the USB statistics structure. |
---|
44 | */ |
---|
45 | struct usb_bus_stat { |
---|
46 | uint32_t uds_requests[4]; |
---|
47 | }; |
---|
48 | |
---|
49 | /* |
---|
50 | * The following structure defines an USB BUS. There is one USB BUS |
---|
51 | * for every Host or Device controller. |
---|
52 | */ |
---|
53 | struct usb_bus { |
---|
54 | struct usb_bus_stat stats_err; |
---|
55 | struct usb_bus_stat stats_ok; |
---|
56 | #ifndef __rtems__ |
---|
57 | struct root_hold_token *bus_roothold; |
---|
58 | #endif /* __rtems__ */ |
---|
59 | /* |
---|
60 | * There are two callback processes. One for Giant locked |
---|
61 | * callbacks. One for non-Giant locked callbacks. This should |
---|
62 | * avoid congestion and reduce response time in most cases. |
---|
63 | */ |
---|
64 | struct usb_process giant_callback_proc; |
---|
65 | struct usb_process non_giant_callback_proc; |
---|
66 | |
---|
67 | /* Explore process */ |
---|
68 | struct usb_process explore_proc; |
---|
69 | |
---|
70 | /* Control request process */ |
---|
71 | struct usb_process control_xfer_proc; |
---|
72 | |
---|
73 | struct usb_bus_msg explore_msg[2]; |
---|
74 | struct usb_bus_msg detach_msg[2]; |
---|
75 | struct usb_bus_msg attach_msg[2]; |
---|
76 | struct usb_bus_msg suspend_msg[2]; |
---|
77 | struct usb_bus_msg resume_msg[2]; |
---|
78 | struct usb_bus_msg reset_msg[2]; |
---|
79 | struct usb_bus_msg shutdown_msg[2]; |
---|
80 | #if USB_HAVE_UGEN |
---|
81 | struct usb_bus_msg cleanup_msg[2]; |
---|
82 | LIST_HEAD(,usb_fs_privdata) pd_cleanup_list; |
---|
83 | #endif |
---|
84 | /* |
---|
85 | * This mutex protects the USB hardware: |
---|
86 | */ |
---|
87 | struct mtx bus_mtx; |
---|
88 | struct usb_xfer_queue intr_q; |
---|
89 | struct usb_callout power_wdog; /* power management */ |
---|
90 | |
---|
91 | device_t parent; |
---|
92 | device_t bdev; /* filled by HC driver */ |
---|
93 | |
---|
94 | #if USB_HAVE_BUSDMA |
---|
95 | struct usb_dma_parent_tag dma_parent_tag[1]; |
---|
96 | struct usb_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX]; |
---|
97 | #endif |
---|
98 | struct usb_bus_methods *methods; /* filled by HC driver */ |
---|
99 | struct usb_device **devices; |
---|
100 | |
---|
101 | struct ifnet *ifp; /* only for USB Packet Filter */ |
---|
102 | |
---|
103 | usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ |
---|
104 | usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; |
---|
105 | |
---|
106 | uint16_t isoc_time_last; /* in milliseconds */ |
---|
107 | |
---|
108 | uint8_t alloc_failed; /* Set if memory allocation failed. */ |
---|
109 | uint8_t driver_added_refcount; /* Current driver generation count */ |
---|
110 | enum usb_revision usbrev; /* USB revision. See "USB_REV_XXX". */ |
---|
111 | |
---|
112 | uint8_t devices_max; /* maximum number of USB devices */ |
---|
113 | uint8_t do_probe; /* set if USB should be re-probed */ |
---|
114 | uint8_t no_explore; /* don't explore USB ports */ |
---|
115 | uint8_t dma_bits; /* number of DMA address lines */ |
---|
116 | }; |
---|
117 | |
---|
118 | #endif /* _USB_BUS_H_ */ |
---|