Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/linux/usb
File: ch11.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
/*
[1] Fix | Delete
* This file holds Hub protocol constants and data structures that are
[2] Fix | Delete
* defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
[3] Fix | Delete
*
[4] Fix | Delete
* It is used/shared between the USB core, the HCDs and couple of other USB
[5] Fix | Delete
* drivers.
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
#ifndef __LINUX_CH11_H
[9] Fix | Delete
#define __LINUX_CH11_H
[10] Fix | Delete
[11] Fix | Delete
#include <linux/types.h> /* __u8 etc */
[12] Fix | Delete
[13] Fix | Delete
/* This is arbitrary.
[14] Fix | Delete
* From USB 2.0 spec Table 11-13, offset 7, a hub can
[15] Fix | Delete
* have up to 255 ports. The most yet reported is 10.
[16] Fix | Delete
*
[17] Fix | Delete
* Current Wireless USB host hardware (Intel i1480 for example) allows
[18] Fix | Delete
* up to 22 devices to connect. Upcoming hardware might raise that
[19] Fix | Delete
* limit. Because the arrays need to add a bit for hub status data, we
[20] Fix | Delete
* use 31, so plus one evens out to four bytes.
[21] Fix | Delete
*/
[22] Fix | Delete
#define USB_MAXCHILDREN 31
[23] Fix | Delete
[24] Fix | Delete
/* See USB 3.1 spec Table 10-5 */
[25] Fix | Delete
#define USB_SS_MAXPORTS 15
[26] Fix | Delete
[27] Fix | Delete
/*
[28] Fix | Delete
* Hub request types
[29] Fix | Delete
*/
[30] Fix | Delete
[31] Fix | Delete
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
[32] Fix | Delete
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
[33] Fix | Delete
[34] Fix | Delete
/*
[35] Fix | Delete
* Port status type for GetPortStatus requests added in USB 3.1
[36] Fix | Delete
* See USB 3.1 spec Table 10-12
[37] Fix | Delete
*/
[38] Fix | Delete
#define HUB_PORT_STATUS 0
[39] Fix | Delete
#define HUB_PORT_PD_STATUS 1
[40] Fix | Delete
#define HUB_EXT_PORT_STATUS 2
[41] Fix | Delete
[42] Fix | Delete
/*
[43] Fix | Delete
* Hub class requests
[44] Fix | Delete
* See USB 2.0 spec Table 11-16
[45] Fix | Delete
*/
[46] Fix | Delete
#define HUB_CLEAR_TT_BUFFER 8
[47] Fix | Delete
#define HUB_RESET_TT 9
[48] Fix | Delete
#define HUB_GET_TT_STATE 10
[49] Fix | Delete
#define HUB_STOP_TT 11
[50] Fix | Delete
[51] Fix | Delete
/*
[52] Fix | Delete
* Hub class additional requests defined by USB 3.0 spec
[53] Fix | Delete
* See USB 3.0 spec Table 10-6
[54] Fix | Delete
*/
[55] Fix | Delete
#define HUB_SET_DEPTH 12
[56] Fix | Delete
#define HUB_GET_PORT_ERR_COUNT 13
[57] Fix | Delete
[58] Fix | Delete
/*
[59] Fix | Delete
* Hub Class feature numbers
[60] Fix | Delete
* See USB 2.0 spec Table 11-17
[61] Fix | Delete
*/
[62] Fix | Delete
#define C_HUB_LOCAL_POWER 0
[63] Fix | Delete
#define C_HUB_OVER_CURRENT 1
[64] Fix | Delete
[65] Fix | Delete
/*
[66] Fix | Delete
* Port feature numbers
[67] Fix | Delete
* See USB 2.0 spec Table 11-17
[68] Fix | Delete
*/
[69] Fix | Delete
#define USB_PORT_FEAT_CONNECTION 0
[70] Fix | Delete
#define USB_PORT_FEAT_ENABLE 1
[71] Fix | Delete
#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
[72] Fix | Delete
#define USB_PORT_FEAT_OVER_CURRENT 3
[73] Fix | Delete
#define USB_PORT_FEAT_RESET 4
[74] Fix | Delete
#define USB_PORT_FEAT_L1 5 /* L1 suspend */
[75] Fix | Delete
#define USB_PORT_FEAT_POWER 8
[76] Fix | Delete
#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
[77] Fix | Delete
#define USB_PORT_FEAT_C_CONNECTION 16
[78] Fix | Delete
#define USB_PORT_FEAT_C_ENABLE 17
[79] Fix | Delete
#define USB_PORT_FEAT_C_SUSPEND 18
[80] Fix | Delete
#define USB_PORT_FEAT_C_OVER_CURRENT 19
[81] Fix | Delete
#define USB_PORT_FEAT_C_RESET 20
[82] Fix | Delete
#define USB_PORT_FEAT_TEST 21
[83] Fix | Delete
#define USB_PORT_FEAT_INDICATOR 22
[84] Fix | Delete
#define USB_PORT_FEAT_C_PORT_L1 23
[85] Fix | Delete
[86] Fix | Delete
/*
[87] Fix | Delete
* Port feature selectors added by USB 3.0 spec.
[88] Fix | Delete
* See USB 3.0 spec Table 10-7
[89] Fix | Delete
*/
[90] Fix | Delete
#define USB_PORT_FEAT_LINK_STATE 5
[91] Fix | Delete
#define USB_PORT_FEAT_U1_TIMEOUT 23
[92] Fix | Delete
#define USB_PORT_FEAT_U2_TIMEOUT 24
[93] Fix | Delete
#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
[94] Fix | Delete
#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
[95] Fix | Delete
#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
[96] Fix | Delete
#define USB_PORT_FEAT_BH_PORT_RESET 28
[97] Fix | Delete
#define USB_PORT_FEAT_C_BH_PORT_RESET 29
[98] Fix | Delete
#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
[99] Fix | Delete
[100] Fix | Delete
#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
[101] Fix | Delete
[102] Fix | Delete
/* USB 3.0 hub remote wake mask bits, see table 10-14 */
[103] Fix | Delete
#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
[104] Fix | Delete
#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
[105] Fix | Delete
#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
[106] Fix | Delete
[107] Fix | Delete
/*
[108] Fix | Delete
* Hub Status and Hub Change results
[109] Fix | Delete
* See USB 2.0 spec Table 11-19 and Table 11-20
[110] Fix | Delete
* USB 3.1 extends the port status request and may return 4 additional bytes.
[111] Fix | Delete
* See USB 3.1 spec section 10.16.2.6 Table 10-12 and 10-15
[112] Fix | Delete
*/
[113] Fix | Delete
struct usb_port_status {
[114] Fix | Delete
__le16 wPortStatus;
[115] Fix | Delete
__le16 wPortChange;
[116] Fix | Delete
__le32 dwExtPortStatus;
[117] Fix | Delete
} __attribute__ ((packed));
[118] Fix | Delete
[119] Fix | Delete
/*
[120] Fix | Delete
* wPortStatus bit field
[121] Fix | Delete
* See USB 2.0 spec Table 11-21
[122] Fix | Delete
*/
[123] Fix | Delete
#define USB_PORT_STAT_CONNECTION 0x0001
[124] Fix | Delete
#define USB_PORT_STAT_ENABLE 0x0002
[125] Fix | Delete
#define USB_PORT_STAT_SUSPEND 0x0004
[126] Fix | Delete
#define USB_PORT_STAT_OVERCURRENT 0x0008
[127] Fix | Delete
#define USB_PORT_STAT_RESET 0x0010
[128] Fix | Delete
#define USB_PORT_STAT_L1 0x0020
[129] Fix | Delete
/* bits 6 to 7 are reserved */
[130] Fix | Delete
#define USB_PORT_STAT_POWER 0x0100
[131] Fix | Delete
#define USB_PORT_STAT_LOW_SPEED 0x0200
[132] Fix | Delete
#define USB_PORT_STAT_HIGH_SPEED 0x0400
[133] Fix | Delete
#define USB_PORT_STAT_TEST 0x0800
[134] Fix | Delete
#define USB_PORT_STAT_INDICATOR 0x1000
[135] Fix | Delete
/* bits 13 to 15 are reserved */
[136] Fix | Delete
[137] Fix | Delete
/*
[138] Fix | Delete
* Additions to wPortStatus bit field from USB 3.0
[139] Fix | Delete
* See USB 3.0 spec Table 10-10
[140] Fix | Delete
*/
[141] Fix | Delete
#define USB_PORT_STAT_LINK_STATE 0x01e0
[142] Fix | Delete
#define USB_SS_PORT_STAT_POWER 0x0200
[143] Fix | Delete
#define USB_SS_PORT_STAT_SPEED 0x1c00
[144] Fix | Delete
#define USB_PORT_STAT_SPEED_5GBPS 0x0000
[145] Fix | Delete
/* Valid only if port is enabled */
[146] Fix | Delete
/* Bits that are the same from USB 2.0 */
[147] Fix | Delete
#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
[148] Fix | Delete
USB_PORT_STAT_ENABLE | \
[149] Fix | Delete
USB_PORT_STAT_OVERCURRENT | \
[150] Fix | Delete
USB_PORT_STAT_RESET)
[151] Fix | Delete
[152] Fix | Delete
/*
[153] Fix | Delete
* Definitions for PORT_LINK_STATE values
[154] Fix | Delete
* (bits 5-8) in wPortStatus
[155] Fix | Delete
*/
[156] Fix | Delete
#define USB_SS_PORT_LS_U0 0x0000
[157] Fix | Delete
#define USB_SS_PORT_LS_U1 0x0020
[158] Fix | Delete
#define USB_SS_PORT_LS_U2 0x0040
[159] Fix | Delete
#define USB_SS_PORT_LS_U3 0x0060
[160] Fix | Delete
#define USB_SS_PORT_LS_SS_DISABLED 0x0080
[161] Fix | Delete
#define USB_SS_PORT_LS_RX_DETECT 0x00a0
[162] Fix | Delete
#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
[163] Fix | Delete
#define USB_SS_PORT_LS_POLLING 0x00e0
[164] Fix | Delete
#define USB_SS_PORT_LS_RECOVERY 0x0100
[165] Fix | Delete
#define USB_SS_PORT_LS_HOT_RESET 0x0120
[166] Fix | Delete
#define USB_SS_PORT_LS_COMP_MOD 0x0140
[167] Fix | Delete
#define USB_SS_PORT_LS_LOOPBACK 0x0160
[168] Fix | Delete
[169] Fix | Delete
/*
[170] Fix | Delete
* wPortChange bit field
[171] Fix | Delete
* See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
[172] Fix | Delete
* Bits 0 to 5 shown, bits 6 to 15 are reserved
[173] Fix | Delete
*/
[174] Fix | Delete
#define USB_PORT_STAT_C_CONNECTION 0x0001
[175] Fix | Delete
#define USB_PORT_STAT_C_ENABLE 0x0002
[176] Fix | Delete
#define USB_PORT_STAT_C_SUSPEND 0x0004
[177] Fix | Delete
#define USB_PORT_STAT_C_OVERCURRENT 0x0008
[178] Fix | Delete
#define USB_PORT_STAT_C_RESET 0x0010
[179] Fix | Delete
#define USB_PORT_STAT_C_L1 0x0020
[180] Fix | Delete
/*
[181] Fix | Delete
* USB 3.0 wPortChange bit fields
[182] Fix | Delete
* See USB 3.0 spec Table 10-11
[183] Fix | Delete
*/
[184] Fix | Delete
#define USB_PORT_STAT_C_BH_RESET 0x0020
[185] Fix | Delete
#define USB_PORT_STAT_C_LINK_STATE 0x0040
[186] Fix | Delete
#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
[187] Fix | Delete
[188] Fix | Delete
/*
[189] Fix | Delete
* USB 3.1 dwExtPortStatus field masks
[190] Fix | Delete
* See USB 3.1 spec 10.16.2.6.3 Table 10-15
[191] Fix | Delete
*/
[192] Fix | Delete
[193] Fix | Delete
#define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f
[194] Fix | Delete
#define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0
[195] Fix | Delete
#define USB_EXT_PORT_STAT_RX_LANES 0x00000f00
[196] Fix | Delete
#define USB_EXT_PORT_STAT_TX_LANES 0x0000f000
[197] Fix | Delete
[198] Fix | Delete
#define USB_EXT_PORT_RX_LANES(p) \
[199] Fix | Delete
(((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8)
[200] Fix | Delete
#define USB_EXT_PORT_TX_LANES(p) \
[201] Fix | Delete
(((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12)
[202] Fix | Delete
[203] Fix | Delete
/*
[204] Fix | Delete
* wHubCharacteristics (masks)
[205] Fix | Delete
* See USB 2.0 spec Table 11-13, offset 3
[206] Fix | Delete
*/
[207] Fix | Delete
#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
[208] Fix | Delete
#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
[209] Fix | Delete
#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
[210] Fix | Delete
#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
[211] Fix | Delete
[212] Fix | Delete
#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
[213] Fix | Delete
[214] Fix | Delete
#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
[215] Fix | Delete
#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
[216] Fix | Delete
#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
[217] Fix | Delete
#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
[218] Fix | Delete
[219] Fix | Delete
#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
[220] Fix | Delete
#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
[221] Fix | Delete
[222] Fix | Delete
struct usb_hub_status {
[223] Fix | Delete
__le16 wHubStatus;
[224] Fix | Delete
__le16 wHubChange;
[225] Fix | Delete
} __attribute__ ((packed));
[226] Fix | Delete
[227] Fix | Delete
/*
[228] Fix | Delete
* Hub Status & Hub Change bit masks
[229] Fix | Delete
* See USB 2.0 spec Table 11-19 and Table 11-20
[230] Fix | Delete
* Bits 0 and 1 for wHubStatus and wHubChange
[231] Fix | Delete
* Bits 2 to 15 are reserved for both
[232] Fix | Delete
*/
[233] Fix | Delete
#define HUB_STATUS_LOCAL_POWER 0x0001
[234] Fix | Delete
#define HUB_STATUS_OVERCURRENT 0x0002
[235] Fix | Delete
#define HUB_CHANGE_LOCAL_POWER 0x0001
[236] Fix | Delete
#define HUB_CHANGE_OVERCURRENT 0x0002
[237] Fix | Delete
[238] Fix | Delete
[239] Fix | Delete
/*
[240] Fix | Delete
* Hub descriptor
[241] Fix | Delete
* See USB 2.0 spec Table 11-13
[242] Fix | Delete
*/
[243] Fix | Delete
[244] Fix | Delete
#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
[245] Fix | Delete
#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
[246] Fix | Delete
#define USB_DT_HUB_NONVAR_SIZE 7
[247] Fix | Delete
#define USB_DT_SS_HUB_SIZE 12
[248] Fix | Delete
[249] Fix | Delete
/*
[250] Fix | Delete
* Hub Device descriptor
[251] Fix | Delete
* USB Hub class device protocols
[252] Fix | Delete
*/
[253] Fix | Delete
[254] Fix | Delete
#define USB_HUB_PR_FS 0 /* Full speed hub */
[255] Fix | Delete
#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
[256] Fix | Delete
#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
[257] Fix | Delete
#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
[258] Fix | Delete
#define USB_HUB_PR_SS 3 /* Super speed hub */
[259] Fix | Delete
[260] Fix | Delete
struct usb_hub_descriptor {
[261] Fix | Delete
__u8 bDescLength;
[262] Fix | Delete
__u8 bDescriptorType;
[263] Fix | Delete
__u8 bNbrPorts;
[264] Fix | Delete
__le16 wHubCharacteristics;
[265] Fix | Delete
__u8 bPwrOn2PwrGood;
[266] Fix | Delete
__u8 bHubContrCurrent;
[267] Fix | Delete
[268] Fix | Delete
/* 2.0 and 3.0 hubs differ here */
[269] Fix | Delete
union {
[270] Fix | Delete
struct {
[271] Fix | Delete
/* add 1 bit for hub status change; round to bytes */
[272] Fix | Delete
__u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
[273] Fix | Delete
__u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
[274] Fix | Delete
} __attribute__ ((packed)) hs;
[275] Fix | Delete
[276] Fix | Delete
struct {
[277] Fix | Delete
__u8 bHubHdrDecLat;
[278] Fix | Delete
__le16 wHubDelay;
[279] Fix | Delete
__le16 DeviceRemovable;
[280] Fix | Delete
} __attribute__ ((packed)) ss;
[281] Fix | Delete
} u;
[282] Fix | Delete
} __attribute__ ((packed));
[283] Fix | Delete
[284] Fix | Delete
/* port indicator status selectors, tables 11-7 and 11-25 */
[285] Fix | Delete
#define HUB_LED_AUTO 0
[286] Fix | Delete
#define HUB_LED_AMBER 1
[287] Fix | Delete
#define HUB_LED_GREEN 2
[288] Fix | Delete
#define HUB_LED_OFF 3
[289] Fix | Delete
[290] Fix | Delete
enum hub_led_mode {
[291] Fix | Delete
INDICATOR_AUTO = 0,
[292] Fix | Delete
INDICATOR_CYCLE,
[293] Fix | Delete
/* software blinks for attention: software, hardware, reserved */
[294] Fix | Delete
INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
[295] Fix | Delete
INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
[296] Fix | Delete
INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
[297] Fix | Delete
} __attribute__ ((packed));
[298] Fix | Delete
[299] Fix | Delete
/* Transaction Translator Think Times, in bits */
[300] Fix | Delete
#define HUB_TTTT_8_BITS 0x00
[301] Fix | Delete
#define HUB_TTTT_16_BITS 0x20
[302] Fix | Delete
#define HUB_TTTT_24_BITS 0x40
[303] Fix | Delete
#define HUB_TTTT_32_BITS 0x60
[304] Fix | Delete
[305] Fix | Delete
#endif /* __LINUX_CH11_H */
[306] Fix | Delete
[307] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function