Deleted Added
sdiff udiff text old ( 184610 ) new ( 184824 )
full compact
1/* $FreeBSD: head/sys/dev/usb2/controller/usb2_bus.h 184824 2008-11-10 20:54:31Z thompsa $ */
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 _USB2_BUS_H_
28#define _USB2_BUS_H_
29
30/*
31 * The following structure defines the USB explore message sent to the
32 * USB explore process.
33 */
34
35struct usb2_bus_msg {
36 struct usb2_proc_msg hdr;
37 struct usb2_bus *bus;
38};
39
40/*
41 * The following structure defines the USB statistics structure.
42 */
43struct usb2_bus_stat {
44 uint32_t uds_requests[4];
45};
46
47/*
48 * The following structure defines an USB BUS. There is one USB BUS
49 * for every Host or Device controller.
50 */
51struct usb2_bus {
52 struct usb2_bus_stat stats_err;
53 struct usb2_bus_stat stats_ok;
54 struct usb2_process explore_proc;
55 struct usb2_bus_msg explore_msg[2];
56 struct usb2_bus_msg detach_msg[2];
57 struct mtx bus_mtx; /* This mutex protects the USB
58 * hardware */
59 struct usb2_perm perm;
60 struct usb2_xfer_queue intr_q;
61
62 device_t bdev; /* filled by HC driver */
63
64 struct usb2_dma_parent_tag dma_parent_tag[1];
65 struct usb2_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX];
66
67 struct usb2_bus_methods *methods; /* filled by HC driver */
68 struct usb2_device *devices[USB_MAX_DEVICES];
69
70 uint32_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
71 uint32_t transfer_count[4];
72 uint16_t isoc_time_last; /* in milliseconds */
73
74 uint8_t alloc_failed; /* Set if memory allocation failed. */
75 uint8_t driver_added_refcount; /* Current driver generation count */
76 uint8_t usbrev; /* USB revision. See "USB_REV_XXX". */
77
78 uint8_t devices_max; /* maximum number of USB devices */
79 uint8_t do_probe; /* set if USB BUS should be re-probed */
80
81 union {
82 struct usb2_hw_ep_scratch hw_ep_scratch[1];
83 struct usb2_temp_setup temp_setup[1];
84 uint8_t data[128];
85 } scratch[1];
86};
87
88#endif /* _USB2_BUS_H_ */