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