ch9.h revision 934ec9495505d234b2c2fa284470c2f44aae9de9
1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ***   To edit the content of this header, modify the corresponding
11 ***   source file (e.g. under external/kernel-headers/original/) then
12 ***   run bionic/libc/kernel/tools/update_all.py
13 ***
14 ***   Any manual change here will be lost the next time this script will
15 ***   be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI__LINUX_USB_CH9_H
20#define _UAPI__LINUX_USB_CH9_H
21#include <linux/types.h>
22#include <asm/byteorder.h>
23#define USB_DIR_OUT 0
24#define USB_DIR_IN 0x80
25#define USB_TYPE_MASK (0x03 << 5)
26#define USB_TYPE_STANDARD (0x00 << 5)
27#define USB_TYPE_CLASS (0x01 << 5)
28#define USB_TYPE_VENDOR (0x02 << 5)
29#define USB_TYPE_RESERVED (0x03 << 5)
30#define USB_RECIP_MASK 0x1f
31#define USB_RECIP_DEVICE 0x00
32#define USB_RECIP_INTERFACE 0x01
33#define USB_RECIP_ENDPOINT 0x02
34#define USB_RECIP_OTHER 0x03
35#define USB_RECIP_PORT 0x04
36#define USB_RECIP_RPIPE 0x05
37#define USB_REQ_GET_STATUS 0x00
38#define USB_REQ_CLEAR_FEATURE 0x01
39#define USB_REQ_SET_FEATURE 0x03
40#define USB_REQ_SET_ADDRESS 0x05
41#define USB_REQ_GET_DESCRIPTOR 0x06
42#define USB_REQ_SET_DESCRIPTOR 0x07
43#define USB_REQ_GET_CONFIGURATION 0x08
44#define USB_REQ_SET_CONFIGURATION 0x09
45#define USB_REQ_GET_INTERFACE 0x0A
46#define USB_REQ_SET_INTERFACE 0x0B
47#define USB_REQ_SYNCH_FRAME 0x0C
48#define USB_REQ_SET_SEL 0x30
49#define USB_REQ_SET_ISOCH_DELAY 0x31
50#define USB_REQ_SET_ENCRYPTION 0x0D
51#define USB_REQ_GET_ENCRYPTION 0x0E
52#define USB_REQ_RPIPE_ABORT 0x0E
53#define USB_REQ_SET_HANDSHAKE 0x0F
54#define USB_REQ_RPIPE_RESET 0x0F
55#define USB_REQ_GET_HANDSHAKE 0x10
56#define USB_REQ_SET_CONNECTION 0x11
57#define USB_REQ_SET_SECURITY_DATA 0x12
58#define USB_REQ_GET_SECURITY_DATA 0x13
59#define USB_REQ_SET_WUSB_DATA 0x14
60#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
61#define USB_REQ_LOOPBACK_DATA_READ 0x16
62#define USB_REQ_SET_INTERFACE_DS 0x17
63#define USB_REQ_GET_PARTNER_PDO 20
64#define USB_REQ_GET_BATTERY_STATUS 21
65#define USB_REQ_SET_PDO 22
66#define USB_REQ_GET_VDM 23
67#define USB_REQ_SEND_VDM 24
68#define USB_DEVICE_SELF_POWERED 0
69#define USB_DEVICE_REMOTE_WAKEUP 1
70#define USB_DEVICE_TEST_MODE 2
71#define USB_DEVICE_BATTERY 2
72#define USB_DEVICE_B_HNP_ENABLE 3
73#define USB_DEVICE_WUSB_DEVICE 3
74#define USB_DEVICE_A_HNP_SUPPORT 4
75#define USB_DEVICE_A_ALT_HNP_SUPPORT 5
76#define USB_DEVICE_DEBUG_MODE 6
77#define TEST_J 1
78#define TEST_K 2
79#define TEST_SE0_NAK 3
80#define TEST_PACKET 4
81#define TEST_FORCE_EN 5
82#define USB_STATUS_TYPE_STANDARD 0
83#define USB_STATUS_TYPE_PTM 1
84#define USB_DEVICE_U1_ENABLE 48
85#define USB_DEVICE_U2_ENABLE 49
86#define USB_DEVICE_LTM_ENABLE 50
87#define USB_INTRF_FUNC_SUSPEND 0
88#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
89#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
90#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
91#define USB_INTRF_STAT_FUNC_RW_CAP 1
92#define USB_INTRF_STAT_FUNC_RW 2
93#define USB_ENDPOINT_HALT 0
94#define USB_DEV_STAT_U1_ENABLED 2
95#define USB_DEV_STAT_U2_ENABLED 3
96#define USB_DEV_STAT_LTM_ENABLED 4
97#define USB_DEVICE_BATTERY_WAKE_MASK 40
98#define USB_DEVICE_OS_IS_PD_AWARE 41
99#define USB_DEVICE_POLICY_MODE 42
100#define USB_PORT_PR_SWAP 43
101#define USB_PORT_GOTO_MIN 44
102#define USB_PORT_RETURN_POWER 45
103#define USB_PORT_ACCEPT_PD_REQUEST 46
104#define USB_PORT_REJECT_PD_REQUEST 47
105#define USB_PORT_PORT_PD_RESET 48
106#define USB_PORT_C_PORT_PD_CHANGE 49
107#define USB_PORT_CABLE_PD_RESET 50
108#define USB_DEVICE_CHARGING_POLICY 54
109struct usb_ctrlrequest {
110  __u8 bRequestType;
111  __u8 bRequest;
112  __le16 wValue;
113  __le16 wIndex;
114  __le16 wLength;
115} __attribute__((packed));
116#define USB_DT_DEVICE 0x01
117#define USB_DT_CONFIG 0x02
118#define USB_DT_STRING 0x03
119#define USB_DT_INTERFACE 0x04
120#define USB_DT_ENDPOINT 0x05
121#define USB_DT_DEVICE_QUALIFIER 0x06
122#define USB_DT_OTHER_SPEED_CONFIG 0x07
123#define USB_DT_INTERFACE_POWER 0x08
124#define USB_DT_OTG 0x09
125#define USB_DT_DEBUG 0x0a
126#define USB_DT_INTERFACE_ASSOCIATION 0x0b
127#define USB_DT_SECURITY 0x0c
128#define USB_DT_KEY 0x0d
129#define USB_DT_ENCRYPTION_TYPE 0x0e
130#define USB_DT_BOS 0x0f
131#define USB_DT_DEVICE_CAPABILITY 0x10
132#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
133#define USB_DT_WIRE_ADAPTER 0x21
134#define USB_DT_RPIPE 0x22
135#define USB_DT_CS_RADIO_CONTROL 0x23
136#define USB_DT_PIPE_USAGE 0x24
137#define USB_DT_SS_ENDPOINT_COMP 0x30
138#define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31
139#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
140#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
141#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
142#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
143#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
144struct usb_descriptor_header {
145  __u8 bLength;
146  __u8 bDescriptorType;
147} __attribute__((packed));
148struct usb_device_descriptor {
149  __u8 bLength;
150  __u8 bDescriptorType;
151  __le16 bcdUSB;
152  __u8 bDeviceClass;
153  __u8 bDeviceSubClass;
154  __u8 bDeviceProtocol;
155  __u8 bMaxPacketSize0;
156  __le16 idVendor;
157  __le16 idProduct;
158  __le16 bcdDevice;
159  __u8 iManufacturer;
160  __u8 iProduct;
161  __u8 iSerialNumber;
162  __u8 bNumConfigurations;
163} __attribute__((packed));
164#define USB_DT_DEVICE_SIZE 18
165#define USB_CLASS_PER_INTERFACE 0
166#define USB_CLASS_AUDIO 1
167#define USB_CLASS_COMM 2
168#define USB_CLASS_HID 3
169#define USB_CLASS_PHYSICAL 5
170#define USB_CLASS_STILL_IMAGE 6
171#define USB_CLASS_PRINTER 7
172#define USB_CLASS_MASS_STORAGE 8
173#define USB_CLASS_HUB 9
174#define USB_CLASS_CDC_DATA 0x0a
175#define USB_CLASS_CSCID 0x0b
176#define USB_CLASS_CONTENT_SEC 0x0d
177#define USB_CLASS_VIDEO 0x0e
178#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
179#define USB_CLASS_MISC 0xef
180#define USB_CLASS_APP_SPEC 0xfe
181#define USB_CLASS_VENDOR_SPEC 0xff
182#define USB_SUBCLASS_VENDOR_SPEC 0xff
183struct usb_config_descriptor {
184  __u8 bLength;
185  __u8 bDescriptorType;
186  __le16 wTotalLength;
187  __u8 bNumInterfaces;
188  __u8 bConfigurationValue;
189  __u8 iConfiguration;
190  __u8 bmAttributes;
191  __u8 bMaxPower;
192} __attribute__((packed));
193#define USB_DT_CONFIG_SIZE 9
194#define USB_CONFIG_ATT_ONE (1 << 7)
195#define USB_CONFIG_ATT_SELFPOWER (1 << 6)
196#define USB_CONFIG_ATT_WAKEUP (1 << 5)
197#define USB_CONFIG_ATT_BATTERY (1 << 4)
198struct usb_string_descriptor {
199  __u8 bLength;
200  __u8 bDescriptorType;
201  __le16 wData[1];
202} __attribute__((packed));
203struct usb_interface_descriptor {
204  __u8 bLength;
205  __u8 bDescriptorType;
206  __u8 bInterfaceNumber;
207  __u8 bAlternateSetting;
208  __u8 bNumEndpoints;
209  __u8 bInterfaceClass;
210  __u8 bInterfaceSubClass;
211  __u8 bInterfaceProtocol;
212  __u8 iInterface;
213} __attribute__((packed));
214#define USB_DT_INTERFACE_SIZE 9
215struct usb_endpoint_descriptor {
216  __u8 bLength;
217  __u8 bDescriptorType;
218  __u8 bEndpointAddress;
219  __u8 bmAttributes;
220  __le16 wMaxPacketSize;
221  __u8 bInterval;
222  __u8 bRefresh;
223  __u8 bSynchAddress;
224} __attribute__((packed));
225#define USB_DT_ENDPOINT_SIZE 7
226#define USB_DT_ENDPOINT_AUDIO_SIZE 9
227#define USB_ENDPOINT_NUMBER_MASK 0x0f
228#define USB_ENDPOINT_DIR_MASK 0x80
229#define USB_ENDPOINT_XFERTYPE_MASK 0x03
230#define USB_ENDPOINT_XFER_CONTROL 0
231#define USB_ENDPOINT_XFER_ISOC 1
232#define USB_ENDPOINT_XFER_BULK 2
233#define USB_ENDPOINT_XFER_INT 3
234#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
235#define USB_ENDPOINT_MAXP_MASK 0x07ff
236#define USB_EP_MAXP_MULT_SHIFT 11
237#define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT)
238#define USB_EP_MAXP_MULT(m) (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT)
239#define USB_ENDPOINT_INTRTYPE 0x30
240#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
241#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
242#define USB_ENDPOINT_SYNCTYPE 0x0c
243#define USB_ENDPOINT_SYNC_NONE (0 << 2)
244#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
245#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
246#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
247#define USB_ENDPOINT_USAGE_MASK 0x30
248#define USB_ENDPOINT_USAGE_DATA 0x00
249#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
250#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20
251struct usb_ssp_isoc_ep_comp_descriptor {
252  __u8 bLength;
253  __u8 bDescriptorType;
254  __le16 wReseved;
255  __le32 dwBytesPerInterval;
256} __attribute__((packed));
257#define USB_DT_SSP_ISOC_EP_COMP_SIZE 8
258struct usb_ss_ep_comp_descriptor {
259  __u8 bLength;
260  __u8 bDescriptorType;
261  __u8 bMaxBurst;
262  __u8 bmAttributes;
263  __le16 wBytesPerInterval;
264} __attribute__((packed));
265#define USB_DT_SS_EP_COMP_SIZE 6
266#define USB_SS_MULT(p) (1 + ((p) & 0x3))
267#define USB_SS_SSP_ISOC_COMP(p) ((p) & (1 << 7))
268struct usb_qualifier_descriptor {
269  __u8 bLength;
270  __u8 bDescriptorType;
271  __le16 bcdUSB;
272  __u8 bDeviceClass;
273  __u8 bDeviceSubClass;
274  __u8 bDeviceProtocol;
275  __u8 bMaxPacketSize0;
276  __u8 bNumConfigurations;
277  __u8 bRESERVED;
278} __attribute__((packed));
279struct usb_otg_descriptor {
280  __u8 bLength;
281  __u8 bDescriptorType;
282  __u8 bmAttributes;
283} __attribute__((packed));
284struct usb_otg20_descriptor {
285  __u8 bLength;
286  __u8 bDescriptorType;
287  __u8 bmAttributes;
288  __le16 bcdOTG;
289} __attribute__((packed));
290#define USB_OTG_SRP (1 << 0)
291#define USB_OTG_HNP (1 << 1)
292#define USB_OTG_ADP (1 << 2)
293#define OTG_STS_SELECTOR 0xF000
294struct usb_debug_descriptor {
295  __u8 bLength;
296  __u8 bDescriptorType;
297  __u8 bDebugInEndpoint;
298  __u8 bDebugOutEndpoint;
299} __attribute__((packed));
300struct usb_interface_assoc_descriptor {
301  __u8 bLength;
302  __u8 bDescriptorType;
303  __u8 bFirstInterface;
304  __u8 bInterfaceCount;
305  __u8 bFunctionClass;
306  __u8 bFunctionSubClass;
307  __u8 bFunctionProtocol;
308  __u8 iFunction;
309} __attribute__((packed));
310#define USB_DT_INTERFACE_ASSOCIATION_SIZE 8
311struct usb_security_descriptor {
312  __u8 bLength;
313  __u8 bDescriptorType;
314  __le16 wTotalLength;
315  __u8 bNumEncryptionTypes;
316} __attribute__((packed));
317struct usb_key_descriptor {
318  __u8 bLength;
319  __u8 bDescriptorType;
320  __u8 tTKID[3];
321  __u8 bReserved;
322  __u8 bKeyData[0];
323} __attribute__((packed));
324struct usb_encryption_descriptor {
325  __u8 bLength;
326  __u8 bDescriptorType;
327  __u8 bEncryptionType;
328#define USB_ENC_TYPE_UNSECURE 0
329#define USB_ENC_TYPE_WIRED 1
330#define USB_ENC_TYPE_CCM_1 2
331#define USB_ENC_TYPE_RSA_1 3
332  __u8 bEncryptionValue;
333  __u8 bAuthKeyIndex;
334} __attribute__((packed));
335struct usb_bos_descriptor {
336  __u8 bLength;
337  __u8 bDescriptorType;
338  __le16 wTotalLength;
339  __u8 bNumDeviceCaps;
340} __attribute__((packed));
341#define USB_DT_BOS_SIZE 5
342struct usb_dev_cap_header {
343  __u8 bLength;
344  __u8 bDescriptorType;
345  __u8 bDevCapabilityType;
346} __attribute__((packed));
347#define USB_CAP_TYPE_WIRELESS_USB 1
348struct usb_wireless_cap_descriptor {
349  __u8 bLength;
350  __u8 bDescriptorType;
351  __u8 bDevCapabilityType;
352  __u8 bmAttributes;
353#define USB_WIRELESS_P2P_DRD (1 << 1)
354#define USB_WIRELESS_BEACON_MASK (3 << 2)
355#define USB_WIRELESS_BEACON_SELF (1 << 2)
356#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
357#define USB_WIRELESS_BEACON_NONE (3 << 2)
358  __le16 wPHYRates;
359#define USB_WIRELESS_PHY_53 (1 << 0)
360#define USB_WIRELESS_PHY_80 (1 << 1)
361#define USB_WIRELESS_PHY_107 (1 << 2)
362#define USB_WIRELESS_PHY_160 (1 << 3)
363#define USB_WIRELESS_PHY_200 (1 << 4)
364#define USB_WIRELESS_PHY_320 (1 << 5)
365#define USB_WIRELESS_PHY_400 (1 << 6)
366#define USB_WIRELESS_PHY_480 (1 << 7)
367  __u8 bmTFITXPowerInfo;
368  __u8 bmFFITXPowerInfo;
369  __le16 bmBandGroup;
370  __u8 bReserved;
371} __attribute__((packed));
372#define USB_DT_USB_WIRELESS_CAP_SIZE 11
373#define USB_CAP_TYPE_EXT 2
374struct usb_ext_cap_descriptor {
375  __u8 bLength;
376  __u8 bDescriptorType;
377  __u8 bDevCapabilityType;
378  __le32 bmAttributes;
379#define USB_LPM_SUPPORT (1 << 1)
380#define USB_BESL_SUPPORT (1 << 2)
381#define USB_BESL_BASELINE_VALID (1 << 3)
382#define USB_BESL_DEEP_VALID (1 << 4)
383#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
384#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
385} __attribute__((packed));
386#define USB_DT_USB_EXT_CAP_SIZE 7
387#define USB_SS_CAP_TYPE 3
388struct usb_ss_cap_descriptor {
389  __u8 bLength;
390  __u8 bDescriptorType;
391  __u8 bDevCapabilityType;
392  __u8 bmAttributes;
393#define USB_LTM_SUPPORT (1 << 1)
394  __le16 wSpeedSupported;
395#define USB_LOW_SPEED_OPERATION (1)
396#define USB_FULL_SPEED_OPERATION (1 << 1)
397#define USB_HIGH_SPEED_OPERATION (1 << 2)
398#define USB_5GBPS_OPERATION (1 << 3)
399  __u8 bFunctionalitySupport;
400  __u8 bU1devExitLat;
401  __le16 bU2DevExitLat;
402} __attribute__((packed));
403#define USB_DT_USB_SS_CAP_SIZE 10
404#define CONTAINER_ID_TYPE 4
405struct usb_ss_container_id_descriptor {
406  __u8 bLength;
407  __u8 bDescriptorType;
408  __u8 bDevCapabilityType;
409  __u8 bReserved;
410  __u8 ContainerID[16];
411} __attribute__((packed));
412#define USB_DT_USB_SS_CONTN_ID_SIZE 20
413#define USB_SSP_CAP_TYPE 0xa
414struct usb_ssp_cap_descriptor {
415  __u8 bLength;
416  __u8 bDescriptorType;
417  __u8 bDevCapabilityType;
418  __u8 bReserved;
419  __le32 bmAttributes;
420#define USB_SSP_SUBLINK_SPEED_ATTRIBS (0x1f << 0)
421#define USB_SSP_SUBLINK_SPEED_IDS (0xf << 5)
422  __le16 wFunctionalitySupport;
423#define USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID (0xf)
424#define USB_SSP_MIN_RX_LANE_COUNT (0xf << 8)
425#define USB_SSP_MIN_TX_LANE_COUNT (0xf << 12)
426  __le16 wReserved;
427  __le32 bmSublinkSpeedAttr[1];
428#define USB_SSP_SUBLINK_SPEED_SSID (0xf)
429#define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4)
430#define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6)
431#define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8)
432#define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14)
433#define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16)
434} __attribute__((packed));
435#define USB_PD_POWER_DELIVERY_CAPABILITY 0x06
436#define USB_PD_BATTERY_INFO_CAPABILITY 0x07
437#define USB_PD_PD_CONSUMER_PORT_CAPABILITY 0x08
438#define USB_PD_PD_PROVIDER_PORT_CAPABILITY 0x09
439struct usb_pd_cap_descriptor {
440  __u8 bLength;
441  __u8 bDescriptorType;
442  __u8 bDevCapabilityType;
443  __u8 bReserved;
444  __le32 bmAttributes;
445#define USB_PD_CAP_BATTERY_CHARGING (1 << 1)
446#define USB_PD_CAP_USB_PD (1 << 2)
447#define USB_PD_CAP_PROVIDER (1 << 3)
448#define USB_PD_CAP_CONSUMER (1 << 4)
449#define USB_PD_CAP_CHARGING_POLICY (1 << 5)
450#define USB_PD_CAP_TYPE_C_CURRENT (1 << 6)
451#define USB_PD_CAP_PWR_AC (1 << 8)
452#define USB_PD_CAP_PWR_BAT (1 << 9)
453#define USB_PD_CAP_PWR_USE_V_BUS (1 << 14)
454  __le16 bmProviderPorts;
455  __le16 bmConsumerPorts;
456  __le16 bcdBCVersion;
457  __le16 bcdPDVersion;
458  __le16 bcdUSBTypeCVersion;
459} __attribute__((packed));
460struct usb_pd_cap_battery_info_descriptor {
461  __u8 bLength;
462  __u8 bDescriptorType;
463  __u8 bDevCapabilityType;
464  __u8 iBattery;
465  __u8 iSerial;
466  __u8 iManufacturer;
467  __u8 bBatteryId;
468  __u8 bReserved;
469  __le32 dwChargedThreshold;
470  __le32 dwWeakThreshold;
471  __le32 dwBatteryDesignCapacity;
472  __le32 dwBatteryLastFullchargeCapacity;
473} __attribute__((packed));
474struct usb_pd_cap_consumer_port_descriptor {
475  __u8 bLength;
476  __u8 bDescriptorType;
477  __u8 bDevCapabilityType;
478  __u8 bReserved;
479  __u8 bmCapabilities;
480#define USB_PD_CAP_CONSUMER_BC (1 << 0)
481#define USB_PD_CAP_CONSUMER_PD (1 << 1)
482#define USB_PD_CAP_CONSUMER_TYPE_C (1 << 2)
483  __le16 wMinVoltage;
484  __le16 wMaxVoltage;
485  __u16 wReserved;
486  __le32 dwMaxOperatingPower;
487  __le32 dwMaxPeakPower;
488  __le32 dwMaxPeakPowerTime;
489#define USB_PD_CAP_CONSUMER_UNKNOWN_PEAK_POWER_TIME 0xffff
490} __attribute__((packed));
491struct usb_pd_cap_provider_port_descriptor {
492  __u8 bLength;
493  __u8 bDescriptorType;
494  __u8 bDevCapabilityType;
495  __u8 bReserved1;
496  __u8 bmCapabilities;
497#define USB_PD_CAP_PROVIDER_BC (1 << 0)
498#define USB_PD_CAP_PROVIDER_PD (1 << 1)
499#define USB_PD_CAP_PROVIDER_TYPE_C (1 << 2)
500  __u8 bNumOfPDObjects;
501  __u8 bReserved2;
502  __le32 wPowerDataObject[];
503} __attribute__((packed));
504#define USB_PTM_CAP_TYPE 0xb
505struct usb_ptm_cap_descriptor {
506  __u8 bLength;
507  __u8 bDescriptorType;
508  __u8 bDevCapabilityType;
509} __attribute__((packed));
510#define USB_DT_USB_PTM_ID_SIZE 3
511#define USB_DT_USB_SSP_CAP_SIZE(ssac) (16 + ssac * 4)
512struct usb_wireless_ep_comp_descriptor {
513  __u8 bLength;
514  __u8 bDescriptorType;
515  __u8 bMaxBurst;
516  __u8 bMaxSequence;
517  __le16 wMaxStreamDelay;
518  __le16 wOverTheAirPacketSize;
519  __u8 bOverTheAirInterval;
520  __u8 bmCompAttributes;
521#define USB_ENDPOINT_SWITCH_MASK 0x03
522#define USB_ENDPOINT_SWITCH_NO 0
523#define USB_ENDPOINT_SWITCH_SWITCH 1
524#define USB_ENDPOINT_SWITCH_SCALE 2
525} __attribute__((packed));
526struct usb_handshake {
527  __u8 bMessageNumber;
528  __u8 bStatus;
529  __u8 tTKID[3];
530  __u8 bReserved;
531  __u8 CDID[16];
532  __u8 nonce[16];
533  __u8 MIC[8];
534} __attribute__((packed));
535struct usb_connection_context {
536  __u8 CHID[16];
537  __u8 CDID[16];
538  __u8 CK[16];
539} __attribute__((packed));
540enum usb_device_speed {
541  USB_SPEED_UNKNOWN = 0,
542  USB_SPEED_LOW,
543  USB_SPEED_FULL,
544  USB_SPEED_HIGH,
545  USB_SPEED_WIRELESS,
546  USB_SPEED_SUPER,
547  USB_SPEED_SUPER_PLUS,
548};
549enum usb_device_state {
550  USB_STATE_NOTATTACHED = 0,
551  USB_STATE_ATTACHED,
552  USB_STATE_POWERED,
553  USB_STATE_RECONNECTING,
554  USB_STATE_UNAUTHENTICATED,
555  USB_STATE_DEFAULT,
556  USB_STATE_ADDRESS,
557  USB_STATE_CONFIGURED,
558  USB_STATE_SUSPENDED
559};
560enum usb3_link_state {
561  USB3_LPM_U0 = 0,
562  USB3_LPM_U1,
563  USB3_LPM_U2,
564  USB3_LPM_U3
565};
566#define USB3_LPM_DISABLED 0x0
567#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
568#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
569#define USB3_LPM_DEVICE_INITIATED 0xFF
570struct usb_set_sel_req {
571  __u8 u1_sel;
572  __u8 u1_pel;
573  __le16 u2_sel;
574  __le16 u2_pel;
575} __attribute__((packed));
576#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
577#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
578#define USB_SELF_POWER_VBUS_MAX_DRAW 100
579#endif
580