summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.h
blob: 4545d71c6a0c6ea5e450aa0c10b80578c3aeb66f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*++

Copyright (c) 2006, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

  Module Name:

    Hub.h
    
  Abstract:

    Constants definitions for Usb Hub

  Revision History

--*/

#ifndef _HUB_H
#define _HUB_H

//
// Hub feature numbers
//
#define C_HUB_LOCAL_POWER   0
#define C_HUB_OVER_CURRENT  1

//
// Hub class code & sub class code
//
#define CLASS_CODE_HUB      0x09
#define SUB_CLASS_CODE_HUB  0

//
// Hub Status & Hub Change bit masks
//
#define HUB_STATUS_LOCAL_POWER  0x0001
#define HUB_STATUS_OVERCURRENT  0x0002

#define HUB_CHANGE_LOCAL_POWER  0x0001
#define HUB_CHANGE_OVERCURRENT  0x0002

//
// Hub Characteristics
//
#define HUB_CHAR_LPSM     0x0003
#define HUB_CHAR_COMPOUND 0x0004
#define HUB_CHAR_OCPM     0x0018

//
// Hub specific request
//
#define HUB_CLEAR_FEATURE               0x01
#define HUB_CLEAR_FEATURE_REQ_TYPE      0x20

#define HUB_CLEAR_FEATURE_PORT          0x01
#define HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23

#define HUB_GET_BUS_STATE               0x02
#define HUB_GET_BUS_STATE_REQ_TYPE      0xA3

#define HUB_GET_DESCRIPTOR              0x06
#define HUB_GET_DESCRIPTOR_REQ_TYPE     0xA0

#define HUB_GET_HUB_STATUS              0x00
#define HUB_GET_HUB_STATUS_REQ_TYPE     0xA0

#define HUB_GET_PORT_STATUS             0x00
#define HUB_GET_PORT_STATUS_REQ_TYPE    0xA3

#define HUB_SET_DESCRIPTOR              0x07
#define HUB_SET_DESCRIPTOR_REQ_TYPE     0x20

#define HUB_SET_HUB_FEATURE             0x03
#define HUB_SET_HUB_FEATURE_REQ_TYPE    0x20

#define HUB_SET_PORT_FEATURE            0x03
#define HUB_SET_PORT_FEATURE_REQ_TYPE   0x23

#pragma pack(1)
typedef struct usb_hub_status {
  UINT16  HubStatus;
  UINT16  HubChange;
} EFI_USB_HUB_STATUS;
#pragma pack()

EFI_STATUS
HubGetPortStatus (
  IN  EFI_USB_IO_PROTOCOL     *UsbIo,
  IN  UINT8                   Port,
  OUT UINT32                  *PortStatus
  );

EFI_STATUS
HubSetPortFeature (
  IN EFI_USB_IO_PROTOCOL     *UsbIo,
  IN UINT8                   Port,
  IN UINT8                   Value
  );

EFI_STATUS
HubSetHubFeature (
  IN EFI_USB_IO_PROTOCOL     *UsbIo,
  IN UINT8                   Value
  );

EFI_STATUS
HubGetHubStatus (
  IN  EFI_USB_IO_PROTOCOL     *UsbIo,
  OUT UINT32                  *HubStatus
  );

EFI_STATUS
HubClearPortFeature (
  IN EFI_USB_IO_PROTOCOL     *UsbIo,
  IN UINT8                   Port,
  IN UINT8                   Value
  );

EFI_STATUS
HubClearHubFeature (
  IN EFI_USB_IO_PROTOCOL     *UsbIo,
  IN UINT8                   Value
  );

EFI_STATUS
GetHubDescriptor (
  IN  EFI_USB_IO_PROTOCOL        *UsbIo,
  IN  UINTN                      DescriptorSize,
  OUT EFI_USB_HUB_DESCRIPTOR     *HubDescriptor
  );

#endif