summaryrefslogtreecommitdiff
path: root/Core/EM/UsbRecovery/UsbPeim.h
blob: b87ded6d7aeb2c7e45174bba13bee6e04f50e77a (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2007, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**         5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
//**********************************************************************
//
// $Header: /Alaska/SOURCE/Modules/USBRecovery/UsbPeim.h 8     11/24/12 5:43a Ryanchou $
//
// $Revision: 8 $
//
// $Date: 11/24/12 5:43a $
//
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/USBRecovery/UsbPeim.h $
// 
// 8     11/24/12 5:43a Ryanchou
// [TAG]  		EIP103990
// [Category]  	Improvement
// [Description]  	Synchronized with USB PEI module 4.6.3_USB_08.10.24.
// [Files]  		EhciPei.c, EhciPei.h, OhciPei.c, OhciPei.h, UhcPeim.c,
// BotPeim.c, BotPeim.h, PeiAtapi.c, UsbBotPeim.c, UsbBotPeim.h,
// HubPeim.c, UsbPeim.c, XhciPei.c, XhciPei.h, HubPeim.h, PeiUsbLib.c,
// PeiUsbLib.h, UsbPeim.h
// 
// 7     1/18/11 12:50a Ryanchou
// [TAG]  		EIP47931
// [Category]  	Improvement
// [Description]  	Added USB 3.0 hub support.
// [Files]  		EhciPei.c, EhciPei.h, HubPeim.c, HubPeim.h, OhciPei.c,
// OhciPei.h, UhcPeim.c, UhcPeim.h, usb.h, UsbHostController.h,
// UsbIoPeim.c, UsbPeim.c, UsbPeim.h, XhciPei.c, XhciPei.h
// 
// 6     10/11/10 4:51p Olegi
// XHCI support added.
// 
// 5     3/17/09 5:11p Olegi
// 
// 4     7/10/08 6:33p Michaela
// Updated to support OHCI controllers
//
// 3     4/16/07 1:03p Sivagarn
// - Updated as per coding standard review
// - In previous check-in, TIANO.H file is removed and AMIMAPPING.H file
// is included
//
// 2     3/28/07 3:07a Meenakshim
// Removed dependency on core source files..Added amimapping file.
//
// 1     9/22/06 4:06p Sivagarn
// - Initial Check-in
// - Included Recovery code in Source
// - Included appropriate headers for flies and functions
// - Updated copyright messages
//
//*****************************************************************************

//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
// Name:        UsbPeim.H
//
// Description: This file belongs to "Framework" and included here for
//              compatibility purposes. This file is modified by AMI to include
//              copyright message, appropriate header and integration code
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>

//
// This file contains 'Framework Code' and is licensed as such
// under the terms of your license agreement with Intel or your
// vendor.  This file may not be modified, except as allowed by
// additional terms of your license agreement.
//

/*++

   Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
   This software and associated documentation (if any) is furnished
   under a license and may only be used or copied in accordance
   with the terms of the license. Except as permitted by such
   license, no part of this software or documentation may be
   reproduced, stored in a retrieval system, or transmitted in any
   form or by any means without the express written consent of
   Intel Corporation.


   Module Name:

   UsbPeim.h

   Abstract:

   Usb Peim definition

   --*/

#ifndef _PEI_USB_PEIM_H
#define _PEI_USB_PEIM_H

#include "Efi.h"
#include "Pei.h"
#include "AmiMapping.h"
#include "AmiPeiLib.h"

#include "usb.h"

//
// Driver Produced PPI Prototypes
//
#include "Ppi\UsbIo.h"

//
// Driver Consumed PPI Prototypes
//
#include "Ppi\UsbHostController.h"

#define MAX_ROOT_PORT         2
#define MAX_ENDPOINT          16
#define HUB_TIME_OUT          3000
#define STALL_1_MILLI_SECOND  1000      // stall 1 ms


#define USB_SLOW_SPEED_DEVICE  0x01
#define USB_FULL_SPEED_DEVICE  0x02
#define USB_HIGH_SPEED_DEVICE  0x03
#define USB_SUPER_SPEED_DEVICE 0x04

//---------------------------------------------------------------------------
//      Values for InterfaceDescriptor.BaseClass
//---------------------------------------------------------------------------
#define BASE_CLASS_HID           0x03
#define BASE_CLASS_MASS_STORAGE  0x08
#define BASE_CLASS_HUB           0x09
//----------------------------------------------------------------------------

//---------------------------------------------------------------------------
//      Values for InterfaceDescriptor.Protocol
//---------------------------------------------------------------------------
#define PROTOCOL_KEYBOARD  0x01         // Keyboard device protocol
#define PROTOCOL_MOUSE     0x02         // Mouse device protocol?

// Mass storage related protocol equates
#define PROTOCOL_CBI         0x00       // Mass Storage Control/Bulk/Interrupt
                                        // with command completion interrupt
#define PROTOCOL_CBI_NO_INT  0x01       // MASS STORAGE Control/Bulk/Interrupt
                                        // with NO command completion interrupt
#define PROTOCOL_BOT         0x50       // Mass Storage Bulk-Only Transport
#define PROTOCOL_VENDOR      0xff       // Vendor specific mass protocol
//---------------------------------------------------------------------------

#define PEI_USB_DEVICE_SIGNATURE  EFI_SIGNATURE_32( 'U', 's', 'b', 'D' )
typedef struct
{
    UINTN Signature;
    PEI_USB_IO_PPI UsbIoPpi;
    EFI_PEI_PPI_DESCRIPTOR UsbIoPpiList;
    UINT8 DeviceAddress;
    UINT8 MaxPacketSize0;
    UINT8 DeviceSpeed;
    UINT8 DataToggle;
    UINT8 IsHub;
    UINT8 DownStreamPortNo;
    UINT8 Reserved[2];                       // Padding for IPF
    PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;
    UINT8 *ConfigurationData;
    EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;
    EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;
    EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc[MAX_ENDPOINT];
    UINT16 TransactionTranslator;
	UINT8  HubDepth;
} PEI_USB_DEVICE;

#define PEI_USB_DEVICE_FROM_THIS( a ) \
    PEI_CR( a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE )

//
// Peim UsbIo prototype
//

EFI_STATUS
PeiUsbControlTransfer (
    IN EFI_PEI_SERVICES       **PeiServices,
    IN PEI_USB_IO_PPI         *This,
    IN EFI_USB_DEVICE_REQUEST *Request,
    IN EFI_USB_DATA_DIRECTION Direction,
    IN UINT32                 Timeout,
    IN OUT VOID *Data         OPTIONAL,
    IN UINTN DataLength       OPTIONAL );

EFI_STATUS
PeiUsbBulkTransfer (
    IN EFI_PEI_SERVICES **PeiServices,
    IN PEI_USB_IO_PPI   *This,
    IN UINT8            DeviceEndpoint,
    IN OUT VOID         *Data,
    IN OUT UINTN        *DataLength,
    IN UINTN            Timeout );

EFI_STATUS
PeiUsbGetInterfaceDescriptor (
    IN EFI_PEI_SERVICES             **PeiServices,
    IN PEI_USB_IO_PPI               *This,
    IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor );

EFI_STATUS
PeiUsbGetEndpointDescriptor (
    IN EFI_PEI_SERVICES            **PeiServices,
    IN PEI_USB_IO_PPI              *This,
    IN UINT8                       EndpointIndex,
    IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor );

EFI_STATUS
PeiUsbPortReset (
    IN EFI_PEI_SERVICES **PeiServices,
    IN PEI_USB_IO_PPI   *This );

#endif

//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2007, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**         5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
//**********************************************************************