]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/LegacyBiosPlatform.h
0d4827104a29e7cd9777f41b7ac5500912895853
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / LegacyBiosPlatform.h
1 /** @file
2 The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16
3 implementation with this EFI code. The EFI driver that produces
4 the Legacy BIOS protocol is generic and consumes this protocol.
5 A driver that matches the Legacy16 produces this protocol
6
7 Copyright (c) 2007 - 2009 Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 @par Revision Reference:
17 This protocol is defined in Framework for EFI Compatibility Support Module spec
18 Version 0.97.
19
20 **/
21
22 #ifndef _EFI_LEGACY_BIOS_PLATFORM_H_
23 #define _EFI_LEGACY_BIOS_PLATFORM_H_
24
25 ///
26 /// Legacy BIOS Platform depends on HDD_INFO and EFI_COMPATIBILITY16_TABLE that
27 /// are defined with the Legacy BIOS Protocol
28 ///
29 #include <Protocol/LegacyBios.h>
30
31 #define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
32 { \
33 0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 } \
34 }
35
36 typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;
37
38 /**
39 This enum specifies the Mode param values for GetPlatformInfo()
40 **/
41 typedef enum {
42 ///
43 /// This mode is invoked twice. The first invocation has LegacySegment and
44 /// LegacyOffset set to 0. The mode returns the MP table address in EFI memory and its size.
45 /// The second invocation has LegacySegment and LegacyOffset set to the location
46 /// in the 0xF0000 or 0xE0000 block to which the MP table is to be copied. The second
47 /// invocation allows any MP table address fix ups to occur in the EFI memory copy of the
48 /// MP table. The caller, not EfiGetPlatformBinaryMpTable, copies the modified MP
49 /// table to the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
50 ///
51 /// The function parameters associated with this mode are:
52 ///
53 /// Table Pointer to the MP table.
54 ///
55 /// TableSize Size in bytes of the MP table.
56 ///
57 /// Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
58 /// Bit 0 = 1 0xF0000 64 KB block.
59 /// Bit 1 = 1 0xE0000 64 KB block.
60 /// Multiple bits can be set.
61 ///
62 /// Alignment Bit mapped address alignment granularity.
63 /// The first nonzero bit from the right is the address granularity.
64 ///
65 // LegacySegment Segment where EfiCompatibility code will place the MP table.
66 ///
67 /// LegacyOffset Offset where EfiCompatibility code will place the MP table.
68 ///
69 /// The return values associated with this mode are:
70 ///
71 /// EFI_SUCCESS The MP table was returned.
72 ///
73 /// EFI_UNSUPPORTED The MP table is not supported on this platform.
74 ///
75 EfiGetPlatformBinaryMpTable = 0,
76 ///
77 /// This mode returns a block of data. The contents and usage is IBV or OEM defined.
78 /// OEMs or IBVs normally use this function for nonstandard Compatibility16 runtime soft
79 /// INTs. It is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if
80 /// they exist, into one coherent package that is understandable by the Compatibility16 code.
81 /// This function is invoked twice. The first invocation has LegacySegment and
82 /// LegacyOffset set to 0. The function returns the table address in EFI memory and its size.
83 /// The second invocation has LegacySegment and LegacyOffset set to the location
84 /// in the 0xF0000 or 0xE0000 block to which the data (table) is to be copied. The second
85 /// invocation allows any data (table) address fix ups to occur in the EFI memory copy of
86 /// the table. The caller, not GetOemIntData(), copies the modified data (table) to the
87 /// allocated region in 0xF0000 or 0xE0000 block after the second invocation.
88 ///
89 /// The function parameters associated with this mode are:
90 ///
91 /// Table Pointer to OEM legacy 16 bit code or data.
92 ///
93 /// TableSize Size of data.
94 ///
95 /// Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
96 /// Bit 0 = 1 0xF0000 64 KB block.
97 /// Bit 1 = 1 0xE0000 64 KB block.
98 /// Multiple bits can be set.
99 ///
100 /// Alignment Bit mapped address alignment granularity.
101 /// The first nonzero bit from the right is the address granularity.
102 ///
103 /// LegacySegment Segment where EfiCompatibility code will place the table or data.
104 ///
105 /// LegacyOffset Offset where EfiCompatibility code will place the table or data.
106 ///
107 /// The return values associated with this mode are:
108 ///
109 /// EFI_SUCCESS The data was returned successfully.
110 ///
111 /// EFI_UNSUPPORTED Oem INT is not supported on this platform.
112 ///
113 EfiGetPlatformBinaryOemIntData = 1,
114 ///
115 /// This mode returns a block of data. The contents and usage is IBV defined. OEMs or
116 /// IBVs normally use this mode for nonstandard Compatibility16 runtime 16 bit routines. It
117 /// is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if they
118 /// exist, into one coherent package that is understandable by the Compatibility16 code.
119 /// An example usage might be a legacy mobile BIOS that has a pre existing runtime
120 /// interface to return the battery status to calling applications.
121 /// This mode is invoked twice. The first invocation has LegacySegment and
122 /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
123 /// The second invocation has LegacySegment and LegacyOffset set to the location
124 /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
125 /// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
126 /// The caller, not EfiGetPlatformBinaryOem16Data, copies the modified table to
127 /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
128 ///
129 /// The function parameters associated with this mode are:
130 ///
131 /// Table Pointer to OEM legacy 16 bit code or data.
132 ///
133 /// TableSize Size of data.
134 ///
135 /// Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
136 /// Bit 0 = 1 0xF0000 64 KB block.
137 /// Bit 1 = 1 0xE0000 64 KB block.
138 /// Multiple bits can be set.
139 ///
140 /// Alignment Bit mapped address alignment granularity.
141 /// The first nonzero bit from the right is the address granularity.
142 ///
143 /// LegacySegment Segment where EfiCompatibility code will place the table or data.
144 ///
145 /// LegacyOffset Offset where EfiCompatibility code will place the table or data.
146 ///
147 /// The return values associated with this mode are:
148 ///
149 /// EFI_SUCCESS The data was returned successfully.
150 ///
151 /// EFI_UNSUPPORTED Oem16 is not supported on this platform.
152 ///
153 EfiGetPlatformBinaryOem16Data = 2,
154 ///
155 /// This mode returns a block of data. The contents and usage is IBV defined. OEMs or
156 /// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It
157 /// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they
158 /// exist, into one coherent package that is understandable by the Compatibility16 code.
159 /// An example usage might be a legacy mobile BIOS that has a pre existing runtime
160 /// interface to return the battery status to calling applications.
161 /// This mode is invoked twice. The first invocation has LegacySegment and
162 /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
163 ///
164 /// The second invocation has LegacySegment and LegacyOffset set to the location
165 /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
166 /// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
167 /// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to
168 /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..
169 ///
170 /// Note: There are two generic mechanisms by which this mode can be used.
171 /// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies
172 /// the data into the F0000 or E0000 block in the Compatibility16 code. The
173 /// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can
174 /// be viewed as two UINT16 entries.
175 /// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with
176 /// a pointer to the INT15 E820 region containing the 32 bit code. It returns
177 /// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,
178 /// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or
179 /// as a single UINT32 entry as determined by the IBV.
180 ///
181 /// The function parameters associated with this mode are:
182 ///
183 /// TableSize Size of data.
184 ///
185 /// Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.
186 /// Bit 0 = 1 0xF0000 64 KB block.
187 /// Bit 1 = 1 0xE0000 64 KB block.
188 /// Multiple bits can be set.
189 ///
190 /// Alignment Bit mapped address alignment granularity.
191 /// The first nonzero bit from the right is the address granularity.
192 ///
193 /// LegacySegment Segment where EfiCompatibility code will place the table or data.
194 ///
195 /// LegacyOffset Offset where EfiCompatibility code will place the table or data.
196 ///
197 /// The return values associated with this mode are:
198 /// EFI_SUCCESS The data was returned successfully.
199 /// EFI_UNSUPPORTED Oem32 is not supported on this platform.
200 ///
201 EfiGetPlatformBinaryOem32Data = 3,
202 ///
203 /// This mode returns a TPM binary image for the onboard TPM device.
204 ///
205 /// The function parameters associated with this mode are:
206 ///
207 /// Table TPM binary image for the onboard TPM device.
208 ///
209 /// TableSize Size of BinaryImage in bytes.
210 ///
211 /// Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
212 /// Bit 0 = 1 0xF0000 64 KB block.
213 /// Bit 1 = 1 0xE0000 64 KB block.
214 /// Multiple bits can be set.
215 ///
216 /// Alignment Bit mapped address alignment granularity.
217 /// The first nonzero bit from the right is the address granularity.
218 ///
219 /// LegacySegment Segment where EfiCompatibility code will place the table or data.
220 ///
221 /// LegacyOffset Offset where EfiCompatibility code will place the table or data.
222 ///
223 /// The return values associated with this mode are:
224 ///
225 /// EFI_SUCCESS BinaryImage is valid.
226 ///
227 /// EFI_UNSUPPORTED Mode is not supported on this platform.
228 ///
229 /// EFI_NOT_FOUND No BinaryImage was found.
230 ///
231 EfiGetPlatformBinaryTpmBinary = 4,
232 ///
233 /// The mode finds the Compatibility16 Rom Image.
234 ///
235 /// The function parameters associated with this mode are:
236 ///
237 /// System ROM image for the platform
238 ///
239 /// TableSize Size of Table in bytes
240 ///
241 /// Location Ignored
242 ///
243 /// Alignment Ignored
244 ///
245 /// LegacySegment Ignored
246 ///
247 /// LegacyOffset Ignored
248 ///
249 /// The return values associated with this mode are:
250 ///
251 /// EFI_SUCCESS ROM image found.
252 ///
253 /// EFI_NOT_FOUND ROM not found.
254 ///
255 EfiGetPlatformBinarySystemRom = 5,
256 ///
257 /// This mode returns the Base address of PciExpress memory mapped configuration
258 /// address space.
259 ///
260 /// The function parameters associated with this mode are:
261 ///
262 /// Table System ROM image for the platform
263 ///
264 /// TableSize Size of Table in bytes
265 ///
266 /// Location Ignored
267 ///
268 /// Alignment Ignored
269 ///
270 /// LegacySegment Ignored
271 ///
272 /// LegacyOffset Ignored
273 ///
274 /// The return values associated with this mode are:
275 ///
276 /// EFI_SUCCESS Address is valid.
277 ///
278 /// EFI_UNSUPPORTED System does not PciExpress.
279 ///
280 EfiGetPlatformPciExpressBase = 6,
281 ///
282 EfiGetPlatformPmmSize = 7,
283 ///
284 EfiGetPlatformEndOpromShadowAddr = 8,
285 ///
286 } EFI_GET_PLATFORM_INFO_MODE;
287
288 /**
289 This enum specifies the Mode param values for GetPlatformHandle()
290 **/
291 typedef enum {
292 ///
293 /// This mode returns the Compatibility16 policy for the device that should be the VGA
294 /// controller used during a Compatibility16 boot.
295 ///
296 /// The function parameters associated with this mode are:
297 ///
298 /// Type 0x00
299 ///
300 /// HandleBuffer Buffer of all VGA handles found.
301 ///
302 /// HandleCount Number of VGA handles found.
303 ///
304 /// AdditionalData NULL
305 ///
306 EfiGetPlatformVgaHandle = 0,
307 ///
308 /// This mode returns the Compatibility16 policy for the device that should be the IDE
309 /// controller used during a Compatibility16 boot.
310 ///
311 /// The function parameters associated with this mode are:
312 ///
313 /// Type 0x00
314 ///
315 /// HandleBuffer Buffer of all IDE handles found.
316 ///
317 /// HandleCount Number of IDE handles found
318 ///
319 /// AdditionalData Pointer to HddInfo.
320 /// Information about all onboard IDE controllers.
321 ///
322 EfiGetPlatformIdeHandle = 1,
323 ///
324 /// This mode returns the Compatibility16 policy for the device that should be the ISA bus
325 /// controller used during a Compatibility16 boot.
326 ///
327 /// The function parameters associated with this mode are:
328 ///
329 /// Type 0x00
330 ///
331 /// HandleBuffer Buffer of all ISA bus handles found.
332 ///
333 /// HandleCount Number of ISA bus handles found.
334 ///
335 /// AdditionalData NULL
336 ///
337 EfiGetPlatformIsaBusHandle = 2,
338 ///
339 /// This mode returns the Compatibility16 policy for the device that should be the USB
340 /// device used during a Compatibility16 boot.
341 ///
342 /// The function parameters associated with this mode are:
343 ///
344 /// Type 0x00
345 ///
346 /// HandleBuffer Buffer of all USB handles found.
347 ///
348 /// HandleCount Number of USB bus handles found.
349 ///
350 /// AdditionalData NULL
351 ///
352 EfiGetPlatformUsbHandle = 3
353 } EFI_GET_PLATFORM_HANDLE_MODE;
354
355 /**
356 This enum specifies the Mode param values for PlatformHooks()
357 Note: Any OEM defined hooks start with 0x8000
358 **/
359 typedef enum {
360 ///
361 /// This mode allows any preprocessing before scanning OpROMs.
362 ///
363 /// The function parameters associated with this mode are:
364 ///
365 /// Type 0
366 ///
367 /// DeviceHandle Handle of device OpROM is associated with.
368 ///
369 /// ShadowAddress Address where OpROM is shadowed.
370 ///
371 /// Compatibility16Table NULL
372 ///
373 /// AdditionalData NULL
374 ///
375 EfiPlatformHookPrepareToScanRom = 0,
376 ///
377 /// This mode shadows legacy OpROMS that may not have a physical device associated with
378 /// them. It returns EFI_SUCCESS if the ROM was shadowed.
379 ///
380 /// The function parameters associated with this mode are:
381 ///
382 /// Type 0
383 ///
384 /// DeviceHandle 0
385 ///
386 /// ShadowAddress First free OpROM area, after other OpROMs have been dispatched..
387 ///
388 /// Compatibility16Table Pointer to the Compatability16 Table.
389 ///
390 /// AdditionalData NULL
391 ///
392 EfiPlatformHookShadowServiceRoms= 1,
393 ///
394 /// This mode allows platform to perform any required operation after an OpROM has
395 /// completed its initialization.
396 ///
397 /// The function parameters associated with this mode are:
398 ///
399 /// Type 0
400 ///
401 /// DeviceHandle Handle of device OpROM is associated with.
402 ///
403 /// ShadowAddress Address where OpROM is shadowed.
404 ///
405 /// Compatibility16Table NULL
406 ///
407 /// AdditionalData NULL
408 ///
409 EfiPlatformHookAfterRomInit = 2
410 } EFI_GET_PLATFORM_HOOK_MODE;
411
412 ///
413 /// This IRQ has not been assigned to PCI.
414 ///
415 #define PCI_UNUSED 0x00
416 ///
417 /// This IRQ has been assigned to PCI.
418 ///
419 #define PCI_USED 0xFF
420 ///
421 /// This IRQ has been used by an SIO legacy device and cannot be used by PCI.
422 ///
423 #define LEGACY_USED 0xFE
424
425 #pragma pack(1)
426
427 typedef struct {
428 ///
429 /// IRQ for this entry.
430 ///
431 UINT8 Irq;
432 ///
433 /// Status of this IRQ.
434 ///
435 /// PCI_UNUSED 0x00. This IRQ has not been assigned to PCI.
436 ///
437 /// PCI_USED 0xFF. This IRQ has been assigned to PCI.
438 ///
439 /// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy
440 /// device and cannot be used by PCI.
441 ///
442 UINT8 Used;
443 } EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY;
444
445 //
446 // Define PIR table structures
447 //
448 #define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')
449
450 typedef struct {
451 ///
452 /// $PIR.
453 ///
454 UINT32 Signature;
455 ///
456 /// 0x00.
457 ///
458 UINT8 MinorVersion;
459 ///
460 /// 0x01 for table version 1.0.
461 ///
462 UINT8 MajorVersion;
463 ///
464 /// 0x20 + RoutingTableEntries * 0x10.
465 ///
466 UINT16 TableSize;
467 ///
468 /// PCI interrupt router bus.
469 ///
470 UINT8 Bus;
471 ///
472 /// PCI interrupt router device/function.
473 ///
474 UINT8 DevFun;
475 ///
476 /// If nonzero, bit map of IRQs reserved for PCI.
477 ///
478 UINT16 PciOnlyIrq;
479 ///
480 /// Vendor ID of a compatible PCI interrupt router.
481 ///
482 UINT16 CompatibleVid;
483 ///
484 /// Device ID of a compatible PCI interrupt router.
485 ///
486 UINT16 CompatibleDid;
487 ///
488 /// If nonzero, a value passed directly to the IRQ miniport\92s Initialize function.
489 ///
490 UINT32 Miniport;
491 ///
492 /// Reserved for future usage.
493 ///
494 UINT8 Reserved[11];
495 ///
496 /// This byte plus the sum of all other bytes in the LocalPirqTable equal 0x00.
497 ///
498 UINT8 Checksum;
499 } EFI_LEGACY_PIRQ_TABLE_HEADER;
500
501
502 typedef struct {
503 ///
504 /// IRQ for this entry.
505 ///
506 UINT8 Pirq;
507 ///
508 /// Status of this IRQ.
509 ///
510 /// PCI_UNUSED 0x00. This IRQ has not been assigned to PCI.
511 ///
512 /// PCI_USED 0xFF. This IRQ has been assigned to PCI.
513 ///
514 /// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy
515 /// device and cannot be used by PCI.
516 ///
517 UINT16 IrqMask;
518 } EFI_LEGACY_PIRQ_ENTRY;
519
520 typedef struct {
521 ///
522 /// PCI bus of the entry.
523 ///
524 UINT8 Bus;
525 ///
526 /// PCI device of this entry.
527 ///
528 UINT8 Device;
529 ///
530 /// An IBV value and IRQ mask for PIRQ pins A through D.
531 ///
532 EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];
533 ///
534 /// If nonzero, the slot number assigned by the board manufacturer.
535 ///
536 UINT8 Slot;
537 ///
538 /// Reserved for future use.
539 ///
540 UINT8 Reserved;
541 } EFI_LEGACY_IRQ_ROUTING_ENTRY;
542
543 #pragma pack()
544
545
546 /**
547 Finds the binary data or other platform information.
548
549 @param This Protocol instance pointer.
550 @param Mode Specifies what data to return. See See EFI_GET_PLATFORM_INFO_MODE enum.
551 @param Table Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
552 @param TableSize Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
553 @param Location Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
554 @param Alignment Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
555 @param LegacySegment Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
556 @param LegacyOffset Mode specific. See EFI_GET_PLATFORM_INFO_MODE enum.
557
558 @retval EFI_SUCCESS Data was returned successfully.
559 @retval EFI_UNSUPPORTED Mode is not supported on the platform.
560 @retval EFI_NOT_FOUND Binary image or table not found.
561
562 **/
563 typedef
564 EFI_STATUS
565 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO)(
566 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
567 IN EFI_GET_PLATFORM_INFO_MODE Mode,
568 OUT VOID **Table,
569 OUT UINTN *TableSize,
570 OUT UINTN *Location,
571 OUT UINTN *Alignment,
572 IN UINT16 LegacySegment,
573 IN UINT16 LegacyOffset
574 );
575
576 /**
577 Returns a buffer of handles for the requested subfunction.
578
579 @param This Protocol instance pointer.
580 @param Mode Specifies what handle to return. See EFI_GET_PLATFORM_HANDLE_MODE enum.
581 @param Type Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
582 @param HandleBuffer Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
583 @param HandleCount Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
584 @param AdditionalData Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
585
586 @retval EFI_SUCCESS Handle is valid
587 @retval EFI_UNSUPPORTED Mode is not supported on the platform.
588 @retval EFI_NOT_FOUND Handle is not known
589
590 **/
591 typedef
592 EFI_STATUS
593 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE)(
594 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
595 IN EFI_GET_PLATFORM_HANDLE_MODE Mode,
596 IN UINT16 Type,
597 OUT EFI_HANDLE **HandleBuffer,
598 OUT UINTN *HandleCount,
599 IN VOID **AdditionalData OPTIONAL
600 );
601
602 /**
603 Load and initialize the Legacy BIOS SMM handler.
604
605 @param This Protocol instance pointer.
606 @param EfiToLegacy16BootTable Pointer to Legacy16 boot table.
607
608 @retval EFI_SUCCESS SMM code loaded.
609 @retval EFI_DEVICE_ERROR SMM code failed to load
610
611 **/
612 typedef
613 EFI_STATUS
614 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT)(
615 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
616 IN VOID *EfiToLegacy16BootTable
617 );
618
619 /**
620 Allows platform to perform any required action after a LegacyBios operation.
621 Invokes the specific sub function specified by Mode.
622
623 @param This Protocol instance pointer.
624 @param Mode Specifies what handle to return. See EFI_GET_PLATFORM_HOOK_MODE enum.
625 @param Type Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
626 @param DeviceHandle Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
627 @param ShadowAddress Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
628 @param Compatibility16Table Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
629 @param AdditionalData Mode specific. See EFI_GET_PLATFORM_HOOK_MODE enum.
630
631 @retval EFI_SUCCESS The operation performed successfully, Mode specific.
632 @retval EFI_UNSUPPORTED Mode is not supported on the platform.
633
634 **/
635 typedef
636 EFI_STATUS
637 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS)(
638 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
639 IN EFI_GET_PLATFORM_HOOK_MODE Mode,
640 IN UINT16 Type,
641 IN EFI_HANDLE DeviceHandle, OPTIONAL
642 IN OUT UINTN *ShadowAddress, OPTIONAL
643 IN EFI_COMPATIBILITY16_TABLE *Compatibility16Table, OPTIONAL
644 OUT VOID **AdditionalData OPTIONAL
645 );
646
647 /**
648 Returns information associated with PCI IRQ routing.
649 This function returns the following information associated with PCI IRQ routing:
650 An IRQ routing table and number of entries in the table
651 The $PIR table and its size
652 A list of PCI IRQs and the priority order to assign them
653
654 @param This Protocol instance pointer.
655 @param RoutingTable Pointer to PCI IRQ Routing table.
656 This location is the $PIR table minus the header.
657 @param RoutingTableEntries Number of entries in table.
658 @param LocalPirqTable $PIR table
659 @param PirqTableSize $PIR table size
660 @param LocalIrqPriorityTable List of interrupts in priority order to assign
661 @param IrqPriorityTableEntries Number of entries in priority table
662
663 @retval EFI_SUCCESS Data was successfully returned.
664
665 **/
666 typedef
667 EFI_STATUS
668 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE)(
669 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
670 OUT VOID **RoutingTable,
671 OUT UINTN *RoutingTableEntries,
672 OUT VOID **LocalPirqTable, OPTIONAL
673 OUT UINTN *PirqTableSize, OPTIONAL
674 OUT VOID **LocalIrqPriorityTable, OPTIONAL
675 OUT UINTN *IrqPriorityTableEntries OPTIONAL
676 );
677
678 /**
679 Translates the given PIRQ accounting for bridge
680 This function translates the given PIRQ back through all buses, if required,
681 and returns the true PIRQ and associated IRQ.
682
683 @param This Protocol instance pointer.
684 @param PciBus PCI bus number for this device.
685 @param PciDevice PCI device number for this device.
686 @param PciFunction PCI function number for this device.
687 @param Pirq Input is PIRQ reported by device, output is true PIRQ.
688 @param PciIrq The IRQ already assigned to the PIRQ or the IRQ to be
689 assigned to the PIRQ.
690
691 @retval EFI_SUCCESS The PIRQ was translated.
692
693 **/
694 typedef
695 EFI_STATUS
696 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ)(
697 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
698 IN UINTN PciBus,
699 IN UINTN PciDevice,
700 IN UINTN PciFunction,
701 IN OUT UINT8 *Pirq,
702 OUT UINT8 *PciIrq
703 );
704
705 /**
706 Attempt to legacy boot the BootOption. If the EFI contexted has been
707 compromised this function will not return.
708
709 @param This Protocol instance pointer.
710 @param BbsDevicePath EFI Device Path from BootXXXX variable.
711 @param BbsTable Internal BBS table.
712 @param LoadOptionSize Size of LoadOption in size.
713 @param LoadOption LoadOption from BootXXXX variable
714 @param EfiToLegacy16BootTable Pointer to BootTable structure
715
716 @retval EFI_SUCCESS Ready to boot.
717
718 **/
719 typedef
720 EFI_STATUS
721 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT)(
722 IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This,
723 IN BBS_BBS_DEVICE_PATH *BbsDevicePath,
724 IN VOID *BbsTable,
725 IN UINT32 LoadOptionsSize,
726 IN VOID *LoadOptions,
727 IN VOID *EfiToLegacy16BootTable
728 );
729
730 /**
731 This protocol abstracts the platform portion of the traditional BIOS.
732 **/
733 struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
734 ///
735 /// Gets binary data or other platform information.
736 ///
737 EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO GetPlatformInfo;
738 ///
739 /// Returns a buffer of all handles matching the requested subfunction.
740 ///
741 EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE GetPlatformHandle;
742 ///
743 /// Loads and initializes the traditional BIOS SMM handler.
744 EFI_LEGACY_BIOS_PLATFORM_SMM_INIT SmmInit;
745 ///
746 /// Allows platform to perform any required actions after a LegacyBios operation.
747 ///
748 EFI_LEGACY_BIOS_PLATFORM_HOOKS PlatformHooks;
749 ///
750 /// Gets $PIR table.
751 EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE GetRoutingTable;
752 ///
753 /// Translates the given PIRQ to the final value after traversing any PCI bridges.
754 ///
755 EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ TranslatePirq;
756 ///
757 /// Final platform function before the system attempts to boot to a traditional OS.
758 ///
759 EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT PrepareToBoot;
760 };
761
762 extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
763
764 #endif