]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBotPei / UsbPeim.h
CommitLineData
4b1bf81c 1/** @file\r
2Usb Peim definition.\r
3\r
4Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
5 \r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions\r
8of the BSD License which accompanies this distribution. The\r
9full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef _PEI_USB_PEIM_H_\r
18#define _PEI_USB_PEIM_H_\r
19\r
20\r
21#include <PiPei.h>\r
22\r
23#include <Ppi/UsbIo.h>\r
24#include <Ppi/UsbHostController.h>\r
25#include <Ppi/BlockIo.h>\r
26\r
27#include <Library/DebugLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/PcdLib.h>\r
30\r
31#include <IndustryStandard/Usb.h>\r
32\r
33#define MAX_ROOT_PORT 2\r
34#define MAX_ENDPOINT 16\r
35\r
36#define USB_SLOW_SPEED_DEVICE 0x01\r
37#define USB_FULL_SPEED_DEVICE 0x02\r
38\r
39#define PEI_USB_DEVICE_SIGNATURE SIGNATURE_32 ('U', 's', 'b', 'D')\r
40typedef struct {\r
41 UINTN Signature;\r
42 PEI_USB_IO_PPI UsbIoPpi;\r
43 EFI_PEI_PPI_DESCRIPTOR UsbIoPpiList;\r
44 UINT8 DeviceAddress;\r
45 UINT8 MaxPacketSize0;\r
46 UINT8 DeviceSpeed;\r
47 UINT8 DataToggle;\r
48 UINT8 IsHub;\r
49 UINT8 DownStreamPortNo;\r
50 UINT8 Reserved[2]; // Padding for IPF\r
51 UINTN AllocateAddress;\r
52 PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;\r
53 UINT8 ConfigurationData[1024];\r
54 EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;\r
55 EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;\r
56 EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc[MAX_ENDPOINT];\r
57} PEI_USB_DEVICE;\r
58\r
59#define PEI_USB_DEVICE_FROM_THIS(a) CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)\r
60\r
61\r
62/**\r
63 Submits control transfer to a target USB device.\r
64 \r
65 @param PeiServices The pointer of EFI_PEI_SERVICES.\r
66 @param This The pointer of PEI_USB_IO_PPI.\r
67 @param Request USB device request to send.\r
68 @param Direction Specifies the data direction for the data stage.\r
69 @param Timeout Indicates the maximum timeout, in millisecond.\r
70 @param Data Data buffer to be transmitted or received from USB device.\r
71 @param DataLength The size (in bytes) of the data buffer.\r
72\r
73 @retval EFI_SUCCESS Transfer was completed successfully.\r
74 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.\r
75 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
76 @retval EFI_TIMEOUT Transfer failed due to timeout.\r
77 @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.\r
78\r
79**/\r
80EFI_STATUS\r
81EFIAPI\r
82PeiUsbControlTransfer (\r
83 IN EFI_PEI_SERVICES **PeiServices,\r
84 IN PEI_USB_IO_PPI *This,\r
85 IN EFI_USB_DEVICE_REQUEST *Request,\r
86 IN EFI_USB_DATA_DIRECTION Direction,\r
87 IN UINT32 Timeout,\r
88 IN OUT VOID *Data, OPTIONAL\r
89 IN UINTN DataLength OPTIONAL\r
90 );\r
91\r
92/**\r
93 Submits bulk transfer to a bulk endpoint of a USB device.\r
94 \r
95 @param PeiServices The pointer of EFI_PEI_SERVICES.\r
96 @param This The pointer of PEI_USB_IO_PPI.\r
97 @param DeviceEndpoint Endpoint number and its direction in bit 7.\r
98 @param Data A pointer to the buffer of data to transmit \r
99 from or receive into.\r
100 @param DataLength The lenght of the data buffer.\r
101 @param Timeout Indicates the maximum time, in millisecond, which the\r
102 transfer is allowed to complete.\r
103\r
104 @retval EFI_SUCCESS The transfer was completed successfully.\r
105 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
106 @retval EFI_INVALID_PARAMETER Parameters are invalid.\r
107 @retval EFI_TIMEOUT The transfer failed due to timeout.\r
108 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
109\r
110**/\r
111EFI_STATUS\r
112EFIAPI\r
113PeiUsbBulkTransfer (\r
114 IN EFI_PEI_SERVICES **PeiServices,\r
115 IN PEI_USB_IO_PPI *This,\r
116 IN UINT8 DeviceEndpoint,\r
117 IN OUT VOID *Data,\r
118 IN OUT UINTN *DataLength,\r
119 IN UINTN Timeout\r
120 );\r
121\r
122/**\r
123 Get the usb interface descriptor.\r
124\r
125 @param PeiServices General-purpose services that are available to every PEIM.\r
126 @param This Indicates the PEI_USB_IO_PPI instance.\r
127 @param InterfaceDescriptor Request interface descriptor.\r
128\r
129\r
130 @retval EFI_SUCCESS Usb interface descriptor is obtained successfully.\r
131\r
132**/\r
133EFI_STATUS\r
134EFIAPI\r
135PeiUsbGetInterfaceDescriptor (\r
136 IN EFI_PEI_SERVICES **PeiServices,\r
137 IN PEI_USB_IO_PPI *This,\r
138 OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor\r
139 );\r
140\r
141/**\r
142 Get the usb endpoint descriptor.\r
143\r
144 @param PeiServices General-purpose services that are available to every PEIM.\r
145 @param This Indicates the PEI_USB_IO_PPI instance.\r
146 @param EndpointIndex The valid index of the specified endpoint.\r
147 @param EndpointDescriptor Request endpoint descriptor.\r
148\r
149 @retval EFI_SUCCESS Usb endpoint descriptor is obtained successfully.\r
150 @retval EFI_NOT_FOUND Usb endpoint descriptor is NOT found.\r
151\r
152**/\r
153EFI_STATUS\r
154EFIAPI\r
155PeiUsbGetEndpointDescriptor (\r
156 IN EFI_PEI_SERVICES **PeiServices,\r
157 IN PEI_USB_IO_PPI *This,\r
158 IN UINT8 EndpointIndex,\r
159 OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor\r
160 );\r
161\r
162/**\r
163 Reset the port and re-configure the usb device.\r
164\r
165 @param PeiServices General-purpose services that are available to every PEIM.\r
166 @param This Indicates the PEI_USB_IO_PPI instance.\r
167\r
168 @retval EFI_SUCCESS Usb device is reset and configured successfully.\r
169 @retval Others Other failure occurs.\r
170\r
171**/\r
172EFI_STATUS\r
173EFIAPI\r
174PeiUsbPortReset (\r
175 IN EFI_PEI_SERVICES **PeiServices,\r
176 IN PEI_USB_IO_PPI *This\r
177 );\r
178\r
179#endif\r