Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef __LINUX_CH11_H |
| 8 | #define __LINUX_CH11_H |
| 9 | #include <linux/types.h> |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 10 | #define USB_MAXCHILDREN 31 |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 11 | #define USB_SS_MAXPORTS 15 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 12 | #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 13 | #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 14 | #define HUB_PORT_STATUS 0 |
| 15 | #define HUB_PORT_PD_STATUS 1 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 16 | #define HUB_EXT_PORT_STATUS 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 17 | #define HUB_CLEAR_TT_BUFFER 8 |
| 18 | #define HUB_RESET_TT 9 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 19 | #define HUB_GET_TT_STATE 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 20 | #define HUB_STOP_TT 11 |
| 21 | #define HUB_SET_DEPTH 12 |
| 22 | #define HUB_GET_PORT_ERR_COUNT 13 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 23 | #define C_HUB_LOCAL_POWER 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 24 | #define C_HUB_OVER_CURRENT 1 |
| 25 | #define USB_PORT_FEAT_CONNECTION 0 |
| 26 | #define USB_PORT_FEAT_ENABLE 1 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 27 | #define USB_PORT_FEAT_SUSPEND 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 28 | #define USB_PORT_FEAT_OVER_CURRENT 3 |
| 29 | #define USB_PORT_FEAT_RESET 4 |
| 30 | #define USB_PORT_FEAT_L1 5 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 31 | #define USB_PORT_FEAT_POWER 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 32 | #define USB_PORT_FEAT_LOWSPEED 9 |
| 33 | #define USB_PORT_FEAT_C_CONNECTION 16 |
| 34 | #define USB_PORT_FEAT_C_ENABLE 17 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 35 | #define USB_PORT_FEAT_C_SUSPEND 18 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 36 | #define USB_PORT_FEAT_C_OVER_CURRENT 19 |
| 37 | #define USB_PORT_FEAT_C_RESET 20 |
| 38 | #define USB_PORT_FEAT_TEST 21 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 39 | #define USB_PORT_FEAT_INDICATOR 22 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 40 | #define USB_PORT_FEAT_C_PORT_L1 23 |
| 41 | #define USB_PORT_FEAT_LINK_STATE 5 |
| 42 | #define USB_PORT_FEAT_U1_TIMEOUT 23 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 43 | #define USB_PORT_FEAT_U2_TIMEOUT 24 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 44 | #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 |
| 45 | #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 |
| 46 | #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 47 | #define USB_PORT_FEAT_BH_PORT_RESET 28 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 48 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 |
| 49 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 |
| 50 | #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 51 | #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 52 | #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) |
| 53 | #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) |
| 54 | struct usb_port_status { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | __le16 wPortStatus; |
| 56 | __le16 wPortChange; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 57 | __le32 dwExtPortStatus; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 58 | } __attribute__((packed)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 59 | #define USB_PORT_STAT_CONNECTION 0x0001 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 60 | #define USB_PORT_STAT_ENABLE 0x0002 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 61 | #define USB_PORT_STAT_SUSPEND 0x0004 |
| 62 | #define USB_PORT_STAT_OVERCURRENT 0x0008 |
| 63 | #define USB_PORT_STAT_RESET 0x0010 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 64 | #define USB_PORT_STAT_L1 0x0020 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 65 | #define USB_PORT_STAT_POWER 0x0100 |
| 66 | #define USB_PORT_STAT_LOW_SPEED 0x0200 |
| 67 | #define USB_PORT_STAT_HIGH_SPEED 0x0400 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 68 | #define USB_PORT_STAT_TEST 0x0800 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 69 | #define USB_PORT_STAT_INDICATOR 0x1000 |
| 70 | #define USB_PORT_STAT_LINK_STATE 0x01e0 |
| 71 | #define USB_SS_PORT_STAT_POWER 0x0200 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 72 | #define USB_SS_PORT_STAT_SPEED 0x1c00 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 73 | #define USB_PORT_STAT_SPEED_5GBPS 0x0000 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 74 | #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE | USB_PORT_STAT_OVERCURRENT | USB_PORT_STAT_RESET) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 75 | #define USB_SS_PORT_LS_U0 0x0000 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 76 | #define USB_SS_PORT_LS_U1 0x0020 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 77 | #define USB_SS_PORT_LS_U2 0x0040 |
| 78 | #define USB_SS_PORT_LS_U3 0x0060 |
| 79 | #define USB_SS_PORT_LS_SS_DISABLED 0x0080 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 80 | #define USB_SS_PORT_LS_RX_DETECT 0x00a0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 81 | #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0 |
| 82 | #define USB_SS_PORT_LS_POLLING 0x00e0 |
| 83 | #define USB_SS_PORT_LS_RECOVERY 0x0100 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 84 | #define USB_SS_PORT_LS_HOT_RESET 0x0120 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 85 | #define USB_SS_PORT_LS_COMP_MOD 0x0140 |
| 86 | #define USB_SS_PORT_LS_LOOPBACK 0x0160 |
| 87 | #define USB_PORT_STAT_C_CONNECTION 0x0001 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 88 | #define USB_PORT_STAT_C_ENABLE 0x0002 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 89 | #define USB_PORT_STAT_C_SUSPEND 0x0004 |
| 90 | #define USB_PORT_STAT_C_OVERCURRENT 0x0008 |
| 91 | #define USB_PORT_STAT_C_RESET 0x0010 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 92 | #define USB_PORT_STAT_C_L1 0x0020 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 93 | #define USB_PORT_STAT_C_BH_RESET 0x0020 |
| 94 | #define USB_PORT_STAT_C_LINK_STATE 0x0040 |
| 95 | #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 96 | #define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f |
| 97 | #define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0 |
| 98 | #define USB_EXT_PORT_STAT_RX_LANES 0x00000f00 |
| 99 | #define USB_EXT_PORT_STAT_TX_LANES 0x0000f000 |
Christopher Ferris | a981e2e | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 100 | #define USB_EXT_PORT_RX_LANES(p) (((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8) |
| 101 | #define USB_EXT_PORT_TX_LANES(p) (((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 102 | #define HUB_CHAR_LPSM 0x0003 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 103 | #define HUB_CHAR_COMMON_LPSM 0x0000 |
| 104 | #define HUB_CHAR_INDV_PORT_LPSM 0x0001 |
| 105 | #define HUB_CHAR_NO_LPSM 0x0002 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 106 | #define HUB_CHAR_COMPOUND 0x0004 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 107 | #define HUB_CHAR_OCPM 0x0018 |
| 108 | #define HUB_CHAR_COMMON_OCPM 0x0000 |
| 109 | #define HUB_CHAR_INDV_PORT_OCPM 0x0008 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 110 | #define HUB_CHAR_NO_OCPM 0x0010 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 111 | #define HUB_CHAR_TTTT 0x0060 |
| 112 | #define HUB_CHAR_PORTIND 0x0080 |
| 113 | struct usb_hub_status { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 114 | __le16 wHubStatus; |
| 115 | __le16 wHubChange; |
| 116 | } __attribute__((packed)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 117 | #define HUB_STATUS_LOCAL_POWER 0x0001 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 118 | #define HUB_STATUS_OVERCURRENT 0x0002 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 119 | #define HUB_CHANGE_LOCAL_POWER 0x0001 |
| 120 | #define HUB_CHANGE_OVERCURRENT 0x0002 |
| 121 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 122 | #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 123 | #define USB_DT_HUB_NONVAR_SIZE 7 |
| 124 | #define USB_DT_SS_HUB_SIZE 12 |
| 125 | #define USB_HUB_PR_FS 0 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 126 | #define USB_HUB_PR_HS_NO_TT 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 127 | #define USB_HUB_PR_HS_SINGLE_TT 1 |
| 128 | #define USB_HUB_PR_HS_MULTI_TT 2 |
| 129 | #define USB_HUB_PR_SS 3 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 130 | struct usb_hub_descriptor { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 131 | __u8 bDescLength; |
| 132 | __u8 bDescriptorType; |
| 133 | __u8 bNbrPorts; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 134 | __le16 wHubCharacteristics; |
| 135 | __u8 bPwrOn2PwrGood; |
| 136 | __u8 bHubContrCurrent; |
| 137 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 138 | struct { |
| 139 | __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; |
| 140 | __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; |
| 141 | } __attribute__((packed)) hs; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 142 | struct { |
| 143 | __u8 bHubHdrDecLat; |
| 144 | __le16 wHubDelay; |
| 145 | __le16 DeviceRemovable; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 146 | } __attribute__((packed)) ss; |
| 147 | } u; |
| 148 | } __attribute__((packed)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 149 | #define HUB_LED_AUTO 0 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 150 | #define HUB_LED_AMBER 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 151 | #define HUB_LED_GREEN 2 |
| 152 | #define HUB_LED_OFF 3 |
| 153 | enum hub_led_mode { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 154 | INDICATOR_AUTO = 0, |
| 155 | INDICATOR_CYCLE, |
| 156 | INDICATOR_GREEN_BLINK, |
| 157 | INDICATOR_GREEN_BLINK_OFF, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 158 | INDICATOR_AMBER_BLINK, |
| 159 | INDICATOR_AMBER_BLINK_OFF, |
| 160 | INDICATOR_ALT_BLINK, |
| 161 | INDICATOR_ALT_BLINK_OFF |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 162 | } __attribute__((packed)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 163 | #define HUB_TTTT_8_BITS 0x00 |
| 164 | #define HUB_TTTT_16_BITS 0x20 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 165 | #define HUB_TTTT_24_BITS 0x40 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 166 | #define HUB_TTTT_32_BITS 0x60 |
| 167 | #endif |