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