LegacyBiosPlatform.h 27 KB

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