acpi: Add IORT helper functions
[coreboot2.git] / src / drivers / usb / usb_ch9.h
blobd45d0c5b0f963bd28b7c34a2918e5d1fde382fb9
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef USB_CH9_H
4 #define USB_CH9_H
6 #define USB_DIR_OUT 0 /* to device */
7 #define USB_DIR_IN 0x80 /* to host */
9 /*
10 * USB types, the second of three bRequestType fields
12 #define USB_TYPE_MASK (0x03 << 5)
13 #define USB_TYPE_STANDARD (0x00 << 5)
14 #define USB_TYPE_CLASS (0x01 << 5)
15 #define USB_TYPE_VENDOR (0x02 << 5)
16 #define USB_TYPE_RESERVED (0x03 << 5)
18 * USB recipients, the third of three bRequestType fields
20 #define USB_RECIP_MASK 0x1f
21 #define USB_RECIP_DEVICE 0x00
22 #define USB_RECIP_INTERFACE 0x01
23 #define USB_RECIP_ENDPOINT 0x02
24 #define USB_RECIP_OTHER 0x03
25 /* From Wireless USB 1.0 */
26 #define USB_RECIP_PORT 0x04
27 #define USB_RECIP_RPIPE 0x05
30 * Standard requests, for the bRequest field of a SETUP packet.
32 * These are qualified by the bRequestType field, so that for example
33 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
34 * by a GET_STATUS request.
36 #define USB_REQ_GET_STATUS 0x00
37 #define USB_REQ_CLEAR_FEATURE 0x01
38 #define USB_REQ_SET_FEATURE 0x03
39 #define USB_REQ_SET_ADDRESS 0x05
40 #define USB_REQ_GET_DESCRIPTOR 0x06
41 #define USB_REQ_SET_DESCRIPTOR 0x07
42 #define USB_REQ_GET_CONFIGURATION 0x08
43 #define USB_REQ_SET_CONFIGURATION 0x09
44 #define USB_REQ_GET_INTERFACE 0x0A
45 #define USB_REQ_SET_INTERFACE 0x0B
46 #define USB_REQ_SYNCH_FRAME 0x0C
48 #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
49 #define USB_REQ_GET_ENCRYPTION 0x0E
50 #define USB_REQ_RPIPE_ABORT 0x0E
51 #define USB_REQ_SET_HANDSHAKE 0x0F
52 #define USB_REQ_RPIPE_RESET 0x0F
53 #define USB_REQ_GET_HANDSHAKE 0x10
54 #define USB_REQ_SET_CONNECTION 0x11
55 #define USB_REQ_SET_SECURITY_DATA 0x12
56 #define USB_REQ_GET_SECURITY_DATA 0x13
57 #define USB_REQ_SET_WUSB_DATA 0x14
58 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15
59 #define USB_REQ_LOOPBACK_DATA_READ 0x16
60 #define USB_REQ_SET_INTERFACE_DS 0x17
62 #define USB_DT_DEBUG 0x0a
64 #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
67 * USB Packet IDs (PIDs)
70 /* token */
71 #define USB_PID_OUT 0xe1
72 #define USB_PID_IN 0x69
73 #define USB_PID_SOF 0xa5
74 #define USB_PID_SETUP 0x2d
75 /* handshake */
76 #define USB_PID_ACK 0xd2
77 #define USB_PID_NAK 0x5a
78 #define USB_PID_STALL 0x1e
79 #define USB_PID_NYET 0x96
80 /* data */
81 #define USB_PID_DATA0 0xc3
82 #define USB_PID_DATA1 0x4b
83 #define USB_PID_DATA2 0x87
84 #define USB_PID_MDATA 0x0f
85 /* Special */
86 #define USB_PID_PREAMBLE 0x3c
87 #define USB_PID_ERR 0x3c
88 #define USB_PID_SPLIT 0x78
89 #define USB_PID_PING 0xb4
90 #define USB_PID_UNDEF_0 0xf0
92 #define USB_PID_DATA_TOGGLE 0x88
94 struct usb_ctrlrequest {
95 u8 bRequestType;
96 u8 bRequest;
97 u16 wValue;
98 u16 wIndex;
99 u16 wLength;
100 } __packed;
102 struct usb_debug_descriptor {
103 u8 bLength;
104 u8 bDescriptorType;
106 /* bulk endpoints with 8 byte maxpacket */
107 u8 bDebugInEndpoint;
108 u8 bDebugOutEndpoint;
111 #endif