summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Framework/Protocol/LegacyBiosPlatform/LegacyBiosPlatform.h
blob: d727fe5bf251f4c4d61be1e187be3fa1dd16b386 (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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/*++

Copyright (c) 1999 - 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:

  LegacyBiosPlatform.h
    
Abstract:

  The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16 
  implementation with this EFI code. The EFI driver that produces 
  the Legacy BIOS protocol is generic and consumes this protocol.
  A driver that matches the Legacy16 produces this protocol
  
Revision History

  The EFI Legacy BIOS Platform Protocol is compliant with CSM spec 0.96.

--*/

#ifndef _EFI_LEGACY_BIOS_PLATFORM_H
#define _EFI_LEGACY_BIOS_PLATFORM_H

#define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
  { \
    0x783658a3, 0x4172, 0x4421, 0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 \
  }

EFI_FORWARD_DECLARATION (EFI_LEGACY_BIOS_PLATFORM_PROTOCOL);

#include "Tiano.h"
#include EFI_PROTOCOL_DEFINITION (LegacyBios)

#pragma pack(1)
//
// Define structures for GetOemIntData
//  Note:
//    OemIntDataElenent is an array of structures from 0 to Count-1.
//    RawData is an array of bytes from 0 to RamDataLength-1.
//
typedef struct {
  UINT16  Int;
  UINT16  Ax;
  UINT32  RawDataLength;
  UINT8   RawData[1];
} EFI_OEM_INT_DATA_ELEMENT;

typedef struct {
  UINT16                    Count;
  EFI_OEM_INT_DATA_ELEMENT  OemIntDataElement[1];
} EFI_OEM_INT_DATA;
#pragma pack()

typedef enum {
  EfiGetPlatformBinaryMpTable        = 0,
  EfiGetPlatformBinaryOemIntData     = 1,
  EfiGetPlatformBinaryOem16Data      = 2,
  EfiGetPlatformBinaryOem32Data      = 3,
  EfiGetPlatformBinaryTpmBinary      = 4,
  EfiGetPlatformBinarySystemRom      = 5,
  EfiGetPlatformPciExpressBase       = 6,
  EfiGetPlatformPmmSize              = 7,
  EfiGetPlatformEndOfOpromShadowAddr = 8
} EFI_GET_PLATFORM_INFO_MODE;

typedef enum {
  EfiGetPlatformVgaHandle       = 0,
  EfiGetPlatformIdeHandle       = 1,
  EfiGetPlatformIsaBusHandle    = 2,
  EfiGetPlatformUsbHandle       = 3
} EFI_GET_PLATFORM_HANDLE_MODE;

typedef enum {
  EfiPlatformHookPrepareToScanRom = 0,
  EfiPlatformHookShadowServiceRoms= 1,
  EfiPlatformHookAfterRomInit     = 2
} EFI_GET_PLATFORM_HOOK_MODE;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN EFI_GET_PLATFORM_INFO_MODE          Mode,
  OUT VOID                               **Table,
  OUT UINTN                              *TableSize,
  OUT UINTN                              *Location,
  OUT UINTN                              *Alignment,
  IN  UINT16                             LegacySegment,
  IN  UINT16                             LegacyOffset
  )
/*++

  Routine Description:
    Return a System ROM image for the platform

  Arguments:
    This                   - Protocol instance pointer.
    Mode                   - Specifies what data to return
    Table                  - Pointer to MP table.
    TableSize              - Size in bytes of table.
    Location               - Legacy region requested
                               0x00 = Any location
                               Bit 0 = 0xF0000 region
                               Bit 1 = 0xE0000 region
                               Multiple bits can be set
    Alignment              - Address alignment for allocation.
                             Bit mapped. First non-zero bit from right
                             is alignment.
                             
    LegacySegment          - Segment in LegacyBios where Table is stored
    LegacyOffset           - Offset in LegacyBios where Table is stored

  Returns:
    EFI_SUCCESS     - Data was returned successfully.
    EFI_UNSUPPORTED - Mode is not supported on the platform.
    EFI_NOT_FOUND   - Binary image or table not found.

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN EFI_GET_PLATFORM_HANDLE_MODE        Mode,
  IN UINT16                              Type,
  OUT EFI_HANDLE                         **HandleBuffer,
  OUT UINTN                              *HandleCount,
  IN  VOID                               **AdditionalData OPTIONAL
  )
/*++

  Routine Description:
    Return the Legacy16 policy for which device should be the VGA controller
    used during a Legacy16 boot.

  Arguments:
    This             - Protocol instance pointer.
    Mode             - Specifies what handle to return.
    Type             - Type from Device Path for Handle to represent.
    HandleBuffer     - Handles of the device/controller in priority order 
                       with HandleBuffer[0] highest priority.
    HandleCount      - Number of handles in the buffer.
    AdditionalData   - Mode specific.


  Returns:
    EFI_SUCCESS     - Handle is valid
    EFI_UNSUPPORTED - Mode is not supported on the platform.
    EFI_NOT_FOUND   - Handle is not known

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN  VOID                               *EfiToLegacy16BootTable
  );

/*++

  Routine Description:
    Load and initialize the Legacy BIOS SMM handler.

  Arguments:
    This                   - Protocol instance pointer.
    EfiToLegacy16BootTable - Pointer to Legacy16 boot table.
  Returns:
    EFI_SUCCESS      - SMM code loaded.
    EFI_DEVICE_ERROR - SMM code failed to load

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN EFI_GET_PLATFORM_HOOK_MODE          Mode,
  IN UINT16                              Type,
  IN  EFI_HANDLE                         DeviceHandle,
  IN  OUT UINTN                          *ShadowAddress,
  IN  EFI_COMPATIBILITY16_TABLE          * Compatibility16Table,
  IN  VOID                               **AdditionalData OPTIONAL
  )
/*++

  Routine Description:
    Prepare to scan a ROM. 

  Arguments:
    This                   - Protocol instance pointer.
    Handle                 - Device handle
    ShadowAddress          - Address that ROM is shadowed at prior to 
                             initialization or first free ROM address,
                             depending upon mode.
    Compatibility16Table   - Pointer to Compatibility16Table.
    AdditionalData   - Mode specific.
      

  Returns:
    EFI_SUCCESS     - RomImage is valid
    EFI_UNSUPPORTED - Mode is not supported on the platform or platform 
                      policy is to not install this OPROM.
--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  OUT VOID                               **RoutingTable,
  OUT UINTN                              *RoutingTableEntries,
  OUT VOID                               **LocalPirqTable, OPTIONAL
  OUT UINTN                              *PirqTableSize, OPTIONAL
  OUT VOID                               **LocalIrqPriorityTable, OPTIONAL
  OUT UINTN                              *IrqPriorityTableEntries OPTIONAL
  )
/*++

  Routine Description:
      1. List of IRQ routing entries and number of entries.
      2. Pointer to Entire $PIR table and length.
      3. List of IRQs to assign to PCI in priority.

  Arguments:
    This                - Protocol instance pointer.
    RoutingTable        - Pointer to PCI IRQ Routing table.
    RoutingTableEntries - Number of entries in table.
    LocalPirqTable         - $PIR table
    PirqTableSize          - $PIR table size
    LocalIrqPriorityTable  - List of interrupts in priority order to assign
    IrqPriorityTableEntries- Number of entries in priority table

  Returns:
    EFI_SUCCESS   - Table pointer returned

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN  UINTN                              PciBus,
  IN  UINTN                              PciDevice,
  IN  UINTN                              PciFunction,
  IN  OUT UINT8                          *Pirq,
  OUT UINT8                              *PciIrq
  )
/*++

  Routine Description:
    Translate the PIRQ reported by the PCI device into the true PIRQ 
    from the internal IRQ routing information and IRQ assigned or to be
    assigned to device.

  Arguments:                           
    This        - Protocol instance pointer.
                  Base as defined below is the bus,device, function in
                  IRQ routing table.
    PciBus      - Base Bus for this device.
    PciDevice   - Base Device for this device.
    PciFunction - Base Function for this device.
    Pirq        - Input is PIRQ reported by device, output is true PIRQ.
    PciIrq      - The IRQ already assigned to the PIRQ or the IRQ to be
                  assigned to the PIRQ.

  Returns:
    EFI_SUCCESS  - Irq translated

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
  IN  BBS_BBS_DEVICE_PATH                * BbsDevicePath,
  IN  VOID                               *BbsTable,
  IN  UINT32                             LoadOptionsSize,
  IN  VOID                               *LoadOptions,
  IN  VOID                               *EfiToLegacy16BootTable
  )
/*++

  Routine Description:
    Attempt to legacy boot the BootOption. If the EFI contexted has been 
    compromised this function will not return.

  Arguments:
    This                      - Protocol instance pointer.
    BbsDevicePath             - EFI Device Path from BootXXXX variable.
    BbsTable                  - Internal BBS table.
    LoadOptionSize            - Size of LoadOption in size.
    LoadOption                - LoadOption from BootXXXX variable
    EfiToLegacy16BootTable    - Pointer to BootTable structure

  Returns:
    EFI_SUCCESS     - Removable media not present

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PERFORM_PLATFORM_TPM_TASKS) (
  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This
  )
/*++

  Routine Description:
    Perform platform-related TPM tasks.

  Arguments:
    This            - Protocol instance pointer.

  Returns:
    EFI_SUCCESS     - Successfully performed the TPM tasks or TCG service not found.
    Others          - Failed to perform the TPM tasks.

--*/
;

typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
  EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO    GetPlatformInfo;
  EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE  GetPlatformHandle;
  EFI_LEGACY_BIOS_PLATFORM_SMM_INIT             SmmInit;
  EFI_LEGACY_BIOS_PLATFORM_HOOKS                PlatformHooks;
  EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE    GetRoutingTable;
  EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ       TranslatePirq;
  EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT      PrepareToBoot;
  EFI_LEGACY_BIOS_PLATFORM_PERFORM_PLATFORM_TPM_TASKS   PerformPlatformTpmTasks;
} EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;

extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;

#endif