efilib.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. #ifndef _EFILIB_INCLUDE_
  2. #define _EFILIB_INCLUDE_
  3. /*++
  4. Copyright (c) 2000 Intel Corporation
  5. Module Name:
  6. efilib.h
  7. Abstract:
  8. EFI library functions
  9. Revision History
  10. --*/
  11. #include "efidebug.h"
  12. #include "efipart.h"
  13. #include "efilibplat.h"
  14. #include "efilink.h"
  15. #include "efirtlib.h"
  16. #include "efistdarg.h"
  17. #include "pci22.h"
  18. #include "libsmbios.h"
  19. //
  20. // Public read-only data in the EFI library
  21. //
  22. extern EFI_SYSTEM_TABLE *ST;
  23. #define gST ST
  24. extern EFI_BOOT_SERVICES *BS;
  25. #define gBS BS
  26. extern EFI_RUNTIME_SERVICES *RT;
  27. #define gRT RT
  28. extern EFI_GUID gEfiDevicePathProtocolGuid;
  29. #define DevicePathProtocol gEfiDevicePathProtocolGuid
  30. extern EFI_GUID gEfiDevicePathToTextProtocolGuid;
  31. #define DevicePathToTextProtocol gEfiDevicePathToTextProtocolGuid
  32. extern EFI_GUID gEfiDevicePathFromTextProtocolGuid;
  33. #define DevicePathFromTextProtocol gEfiDevicePathFromTextProtocolGuid
  34. extern EFI_GUID gEfiLoadedImageProtocolGuid;
  35. #define LoadedImageProtocol gEfiLoadedImageProtocolGuid
  36. extern EFI_GUID gEfiSimpleTextInProtocolGuid;
  37. #define TextInProtocol gEfiSimpleTextInProtocolGuid
  38. extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
  39. #define TextOutProtocol gEfiSimpleTextOutProtocolGuid
  40. extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
  41. #define GraphicsOutputProtocol gEfiGraphicsOutputProtocolGuid
  42. extern EFI_GUID gEfiEdidDiscoveredProtocolGuid;
  43. #define EdidDiscoveredProtocol gEfiEdidDiscoveredProtocolGuid
  44. extern EFI_GUID gEfiEdidActiveProtocolGuid;
  45. #define EdidActiveProtocol gEfiEdidActiveProtocolGuid
  46. extern EFI_GUID gEfiEdidOverrideProtocolGuid;
  47. #define EdidOverrideProtocol gEfiEdidOverrideProtocolGuid
  48. extern EFI_GUID gEfiBlockIoProtocolGuid;
  49. #define BlockIoProtocol gEfiBlockIoProtocolGuid
  50. extern EFI_GUID gEfiBlockIo2ProtocolGuid;
  51. #define BlockIo2Protocol gEfiBlockIo2ProtocolGuid
  52. extern EFI_GUID gEfiDiskIoProtocolGuid;
  53. #define DiskIoProtocol gEfiDiskIoProtocolGuid
  54. extern EFI_GUID gEfiDiskIo2ProtocolGuid;
  55. #define DiskIo2Protocol gEfiDiskIo2ProtocolGuid
  56. extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
  57. #define FileSystemProtocol gEfiSimpleFileSystemProtocolGuid
  58. extern EFI_GUID gEfiLoadFileProtocolGuid;
  59. #define LoadFileProtocol gEfiLoadFileProtocolGuid
  60. extern EFI_GUID gEfiDeviceIoProtocolGuid;
  61. #define DeviceIoProtocol gEfiDeviceIoProtocolGuid
  62. extern EFI_GUID VariableStoreProtocol;
  63. extern EFI_GUID LegacyBootProtocol;
  64. extern EFI_GUID gEfiUnicodeCollationProtocolGuid;
  65. #define UnicodeCollationProtocol gEfiUnicodeCollationProtocolGuid
  66. extern EFI_GUID gEfiSerialIoProtocolGuid;
  67. #define SerialIoProtocol gEfiSerialIoProtocolGuid
  68. extern EFI_GUID VgaClassProtocol;
  69. extern EFI_GUID TextOutSpliterProtocol;
  70. extern EFI_GUID ErrorOutSpliterProtocol;
  71. extern EFI_GUID TextInSpliterProtocol;
  72. extern EFI_GUID gEfiSimpleNetworkProtocolGuid;
  73. #define SimpleNetworkProtocol gEfiSimpleNetworkProtocolGuid
  74. extern EFI_GUID gEfiPxeBaseCodeProtocolGuid;
  75. #define PxeBaseCodeProtocol gEfiPxeBaseCodeProtocolGuid
  76. extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid;
  77. #define PxeCallbackProtocol gEfiPxeBaseCodeCallbackProtocolGuid
  78. extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid;
  79. #define NetworkInterfaceIdentifierProtocol gEfiNetworkInterfaceIdentifierProtocolGuid
  80. extern EFI_GUID gEFiUiInterfaceProtocolGuid;
  81. #define UiProtocol gEFiUiInterfaceProtocolGuid
  82. extern EFI_GUID InternalShellProtocol;
  83. extern EFI_GUID gEfiPciIoProtocolGuid;
  84. #define PciIoProtocol gEfiPciIoProtocolGuid
  85. extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;
  86. extern EFI_GUID gEfiDriverBindingProtocolGuid;
  87. #define DriverBindingProtocol gEfiDriverBindingProtocolGuid
  88. extern EFI_GUID gEfiComponentNameProtocolGuid;
  89. #define ComponentNameProtocol gEfiComponentNameProtocolGuid
  90. extern EFI_GUID gEfiComponentName2ProtocolGuid;
  91. #define ComponentName2Protocol gEfiComponentName2ProtocolGuid
  92. extern EFI_GUID gEfiHashProtocolGuid;
  93. #define HashProtocol gEfiHashProtocolGuid
  94. extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid;
  95. #define PlatformDriverOverrideProtocol gEfiPlatformDriverOverrideProtocolGuid
  96. extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid;
  97. #define BusSpecificDriverOverrideProtocol gEfiBusSpecificDriverOverrideProtocolGuid
  98. extern EFI_GUID gEfiDriverFamilyOverrideProtocolGuid;
  99. #define DriverFamilyOverrideProtocol gEfiDriverFamilyOverrideProtocolGuid
  100. extern EFI_GUID gEfiEbcProtocolGuid;
  101. extern EFI_GUID gEfiGlobalVariableGuid;
  102. #define EfiGlobalVariable gEfiGlobalVariableGuid
  103. extern EFI_GUID gEfiFileInfoGuid;
  104. #define GenericFileInfo gEfiFileInfoGuid
  105. extern EFI_GUID gEfiFileSystemInfoGuid;
  106. #define FileSystemInfo gEfiFileSystemInfoGuid
  107. extern EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid;
  108. #define FileSystemVolumeLabelInfo gEfiFileSystemVolumeLabelInfoIdGuid
  109. extern EFI_GUID gEfiPcAnsiGuid;
  110. #define PcAnsiProtocol gEfiPcAnsiGuid
  111. extern EFI_GUID gEfiVT100Guid;
  112. #define Vt100Protocol gEfiVT100Guid
  113. extern EFI_GUID gEfiVT100PlusGuid;
  114. extern EFI_GUID gEfiVTUTF8Guid;
  115. extern EFI_GUID NullGuid;
  116. extern EFI_GUID UnknownDevice;
  117. extern EFI_GUID EfiPartTypeSystemPartitionGuid;
  118. extern EFI_GUID EfiPartTypeLegacyMbrGuid;
  119. extern EFI_GUID MpsTableGuid;
  120. extern EFI_GUID AcpiTableGuid;
  121. extern EFI_GUID SMBIOSTableGuid;
  122. extern EFI_GUID SalSystemTableGuid;
  123. extern EFI_GUID SimplePointerProtocol;
  124. extern EFI_GUID AbsolutePointerProtocol;
  125. //
  126. // EFI Variable strings
  127. //
  128. #define LOAD_OPTION_ACTIVE 0x00000001
  129. #define VarLanguageCodes L"LangCodes"
  130. #define VarLanguage L"Lang"
  131. #define VarTimeout L"Timeout"
  132. #define VarConsoleInp L"ConIn"
  133. #define VarConsoleOut L"ConOut"
  134. #define VarErrorOut L"ErrOut"
  135. #define VarBootOption L"Boot%04x"
  136. #define VarBootOrder L"BootOrder"
  137. #define VarBootNext L"BootNext"
  138. #define VarBootCurrent L"BootCurrent"
  139. #define VarDriverOption L"Driver%04x"
  140. #define VarDriverOrder L"DriverOrder"
  141. #define VarConsoleInpDev L"ConInDev"
  142. #define VarConsoleOutDev L"ConOutDev"
  143. #define VarErrorOutDev L"ErrOutDev"
  144. #define LanguageCodeEnglish "eng"
  145. extern EFI_DEVICE_PATH RootDevicePath[];
  146. extern EFI_DEVICE_PATH EndDevicePath[];
  147. extern EFI_DEVICE_PATH EndInstanceDevicePath[];
  148. //
  149. // Other public data in the EFI library
  150. //
  151. extern EFI_MEMORY_TYPE PoolAllocationType;
  152. //
  153. // STATIC - Name is internal to the module
  154. // INTERNAL - Name is internal to the component (i.e., directory)
  155. // BOOTSERVCE - Name of a boot service function
  156. //
  157. #define STATIC
  158. #define INTERNAL
  159. #define BOOTSERVICE
  160. //
  161. // Prototypes
  162. //
  163. VOID
  164. InitializeLib (
  165. IN EFI_HANDLE ImageHandle,
  166. IN EFI_SYSTEM_TABLE *SystemTable
  167. );
  168. VOID
  169. InitializeUnicodeSupport (
  170. CHAR8 *LangCode
  171. );
  172. VOID
  173. EFIDebugVariable (
  174. VOID
  175. );
  176. INTN
  177. GetShellArgcArgv(
  178. EFI_HANDLE ImageHandle,
  179. CHAR16 **Argv[] /* Statically allocated */
  180. );
  181. VOID
  182. SetCrc (
  183. IN OUT EFI_TABLE_HEADER *Hdr
  184. );
  185. VOID
  186. SetCrcAltSize (
  187. IN UINTN Size,
  188. IN OUT EFI_TABLE_HEADER *Hdr
  189. );
  190. BOOLEAN
  191. CheckCrc (
  192. IN UINTN MaxSize,
  193. IN OUT EFI_TABLE_HEADER *Hdr
  194. );
  195. BOOLEAN
  196. CheckCrcAltSize (
  197. IN UINTN MaxSize,
  198. IN UINTN Size,
  199. IN OUT EFI_TABLE_HEADER *Hdr
  200. );
  201. UINT32
  202. CalculateCrc (
  203. UINT8 *pt,
  204. UINTN Size
  205. );
  206. VOID
  207. ZeroMem (
  208. IN VOID *Buffer,
  209. IN UINTN Size
  210. );
  211. VOID
  212. SetMem (
  213. IN VOID *Buffer,
  214. IN UINTN Size,
  215. IN UINT8 Value
  216. );
  217. VOID
  218. CopyMem (
  219. IN VOID *Dest,
  220. IN CONST VOID *Src,
  221. IN UINTN len
  222. );
  223. INTN
  224. CompareMem (
  225. IN CONST VOID *Dest,
  226. IN CONST VOID *Src,
  227. IN UINTN len
  228. );
  229. INTN
  230. StrCmp (
  231. IN CONST CHAR16 *s1,
  232. IN CONST CHAR16 *s2
  233. );
  234. INTN
  235. StrnCmp (
  236. IN CONST CHAR16 *s1,
  237. IN CONST CHAR16 *s2,
  238. IN UINTN len
  239. );
  240. INTN
  241. StriCmp (
  242. IN CONST CHAR16 *s1,
  243. IN CONST CHAR16 *s2
  244. );
  245. VOID
  246. StrLwr (
  247. IN CHAR16 *Str
  248. );
  249. VOID
  250. StrUpr (
  251. IN CHAR16 *Str
  252. );
  253. VOID
  254. StrCpy (
  255. IN CHAR16 *Dest,
  256. IN CONST CHAR16 *Src
  257. );
  258. VOID
  259. StrCat (
  260. IN CHAR16 *Dest,
  261. IN CONST CHAR16 *Src
  262. );
  263. UINTN
  264. StrLen (
  265. IN CONST CHAR16 *s1
  266. );
  267. UINTN
  268. StrSize (
  269. IN CONST CHAR16 *s1
  270. );
  271. CHAR16 *
  272. StrDuplicate (
  273. IN CONST CHAR16 *Src
  274. );
  275. UINTN
  276. strlena (
  277. IN CONST CHAR8 *s1
  278. );
  279. UINTN
  280. strcmpa (
  281. IN CONST CHAR8 *s1,
  282. IN CONST CHAR8 *s2
  283. );
  284. UINTN
  285. strncmpa (
  286. IN CONST CHAR8 *s1,
  287. IN CONST CHAR8 *s2,
  288. IN UINTN len
  289. );
  290. UINTN
  291. xtoi (
  292. CONST CHAR16 *str
  293. );
  294. UINTN
  295. Atoi (
  296. CONST CHAR16 *str
  297. );
  298. BOOLEAN
  299. MetaMatch (
  300. IN CHAR16 *String,
  301. IN CHAR16 *Pattern
  302. );
  303. BOOLEAN
  304. MetaiMatch (
  305. IN CHAR16 *String,
  306. IN CHAR16 *Pattern
  307. );
  308. UINT64
  309. LShiftU64 (
  310. IN UINT64 Operand,
  311. IN UINTN Count
  312. );
  313. UINT64
  314. RShiftU64 (
  315. IN UINT64 Operand,
  316. IN UINTN Count
  317. );
  318. UINT64
  319. MultU64x32 (
  320. IN UINT64 Multiplicand,
  321. IN UINTN Multiplier
  322. );
  323. UINT64
  324. DivU64x32 (
  325. IN UINT64 Dividend,
  326. IN UINTN Divisor,
  327. OUT UINTN *Remainder OPTIONAL
  328. );
  329. VOID
  330. InitializeLock (
  331. IN OUT FLOCK *Lock,
  332. IN EFI_TPL Priority
  333. );
  334. VOID
  335. AcquireLock (
  336. IN FLOCK *Lock
  337. );
  338. VOID
  339. ReleaseLock (
  340. IN FLOCK *Lock
  341. );
  342. INTN
  343. CompareGuid(
  344. IN EFI_GUID *Guid1,
  345. IN EFI_GUID *Guid2
  346. );
  347. VOID *
  348. AllocatePool (
  349. IN UINTN Size
  350. );
  351. VOID *
  352. AllocateZeroPool (
  353. IN UINTN Size
  354. );
  355. VOID *
  356. ReallocatePool (
  357. IN VOID *OldPool,
  358. IN UINTN OldSize,
  359. IN UINTN NewSize
  360. );
  361. VOID
  362. FreePool (
  363. IN VOID *p
  364. );
  365. VOID
  366. Output (
  367. IN CHAR16 *Str
  368. );
  369. VOID
  370. Input (
  371. IN CHAR16 *Prompt OPTIONAL,
  372. OUT CHAR16 *InStr,
  373. IN UINTN StrLen
  374. );
  375. VOID
  376. IInput (
  377. IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut,
  378. IN SIMPLE_INPUT_INTERFACE *ConIn,
  379. IN CHAR16 *Prompt OPTIONAL,
  380. OUT CHAR16 *InStr,
  381. IN UINTN StrLen
  382. );
  383. UINTN
  384. Print (
  385. IN CHAR16 *fmt,
  386. ...
  387. );
  388. UINTN
  389. VPrint (
  390. IN CHAR16 *fmt,
  391. va_list args
  392. );
  393. UINTN
  394. SPrint (
  395. OUT CHAR16 *Str,
  396. IN UINTN StrSize,
  397. IN CHAR16 *fmt,
  398. ...
  399. );
  400. UINTN
  401. VSPrint (
  402. OUT CHAR16 *Str,
  403. IN UINTN StrSize,
  404. IN CHAR16 *fmt,
  405. va_list args
  406. );
  407. CHAR16 *
  408. VPoolPrint (
  409. IN CHAR16 *fmt,
  410. va_list args
  411. );
  412. CHAR16 *
  413. PoolPrint (
  414. IN CHAR16 *fmt,
  415. ...
  416. );
  417. typedef struct {
  418. CHAR16 *str;
  419. UINTN len;
  420. UINTN maxlen;
  421. } POOL_PRINT;
  422. CHAR16 *
  423. CatPrint (
  424. IN OUT POOL_PRINT *Str,
  425. IN CHAR16 *fmt,
  426. ...
  427. );
  428. UINTN
  429. PrintAt (
  430. IN UINTN Column,
  431. IN UINTN Row,
  432. IN CHAR16 *fmt,
  433. ...
  434. );
  435. UINTN
  436. IPrint (
  437. IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out,
  438. IN CHAR16 *fmt,
  439. ...
  440. );
  441. UINTN
  442. IPrintAt (
  443. IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out,
  444. IN UINTN Column,
  445. IN UINTN Row,
  446. IN CHAR16 *fmt,
  447. ...
  448. );
  449. UINTN
  450. APrint (
  451. IN CHAR8 *fmt,
  452. ...
  453. );
  454. VOID
  455. ValueToHex (
  456. IN CHAR16 *Buffer,
  457. IN UINT64 v
  458. );
  459. VOID
  460. ValueToString (
  461. IN CHAR16 *Buffer,
  462. IN BOOLEAN Comma,
  463. IN INT64 v
  464. );
  465. VOID
  466. FloatToString (
  467. IN CHAR16 *Buffer,
  468. IN BOOLEAN Comma,
  469. IN double v
  470. );
  471. VOID
  472. TimeToString (
  473. OUT CHAR16 *Buffer,
  474. IN EFI_TIME *Time
  475. );
  476. VOID
  477. GuidToString (
  478. OUT CHAR16 *Buffer,
  479. IN EFI_GUID *Guid
  480. );
  481. VOID
  482. StatusToString (
  483. OUT CHAR16 *Buffer,
  484. EFI_STATUS Status
  485. );
  486. VOID
  487. DumpHex (
  488. IN UINTN Indent,
  489. IN UINTN Offset,
  490. IN UINTN DataSize,
  491. IN VOID *UserData
  492. );
  493. BOOLEAN
  494. GrowBuffer(
  495. IN OUT EFI_STATUS *Status,
  496. IN OUT VOID **Buffer,
  497. IN UINTN BufferSize
  498. );
  499. EFI_MEMORY_DESCRIPTOR *
  500. LibMemoryMap (
  501. OUT UINTN *NoEntries,
  502. OUT UINTN *MapKey,
  503. OUT UINTN *DescriptorSize,
  504. OUT UINT32 *DescriptorVersion
  505. );
  506. VOID *
  507. LibGetVariable (
  508. IN CHAR16 *Name,
  509. IN EFI_GUID *VendorGuid
  510. );
  511. VOID *
  512. LibGetVariableAndSize (
  513. IN CHAR16 *Name,
  514. IN EFI_GUID *VendorGuid,
  515. OUT UINTN *VarSize
  516. );
  517. EFI_STATUS
  518. LibDeleteVariable (
  519. IN CHAR16 *VarName,
  520. IN EFI_GUID *VarGuid
  521. );
  522. EFI_STATUS
  523. LibSetNVVariable (
  524. IN CHAR16 *VarName,
  525. IN EFI_GUID *VarGuid,
  526. IN UINTN DataSize,
  527. IN VOID *Data
  528. );
  529. EFI_STATUS
  530. LibSetVariable (
  531. IN CHAR16 *VarName,
  532. IN EFI_GUID *VarGuid,
  533. IN UINTN DataSize,
  534. IN VOID *Data
  535. );
  536. EFI_STATUS
  537. LibInsertToTailOfBootOrder (
  538. IN UINT16 BootOption,
  539. IN BOOLEAN OnlyInsertIfEmpty
  540. );
  541. EFI_STATUS
  542. LibLocateProtocol (
  543. IN EFI_GUID *ProtocolGuid,
  544. OUT VOID **Interface
  545. );
  546. EFI_STATUS
  547. LibLocateHandle (
  548. IN EFI_LOCATE_SEARCH_TYPE SearchType,
  549. IN EFI_GUID *Protocol OPTIONAL,
  550. IN VOID *SearchKey OPTIONAL,
  551. IN OUT UINTN *NoHandles,
  552. OUT EFI_HANDLE **Buffer
  553. );
  554. EFI_STATUS
  555. LibLocateHandleByDiskSignature (
  556. IN UINT8 MBRType,
  557. IN UINT8 SignatureType,
  558. IN VOID *Signature,
  559. IN OUT UINTN *NoHandles,
  560. OUT EFI_HANDLE **Buffer
  561. );
  562. EFI_STATUS
  563. LibInstallProtocolInterfaces (
  564. IN OUT EFI_HANDLE *Handle,
  565. ...
  566. );
  567. VOID
  568. LibUninstallProtocolInterfaces (
  569. IN EFI_HANDLE Handle,
  570. ...
  571. );
  572. EFI_STATUS
  573. LibReinstallProtocolInterfaces (
  574. IN OUT EFI_HANDLE *Handle,
  575. ...
  576. );
  577. EFI_EVENT
  578. LibCreateProtocolNotifyEvent (
  579. IN EFI_GUID *ProtocolGuid,
  580. IN EFI_TPL NotifyTpl,
  581. IN EFI_EVENT_NOTIFY NotifyFunction,
  582. IN VOID *NotifyContext,
  583. OUT VOID *Registration
  584. );
  585. EFI_STATUS
  586. WaitForSingleEvent (
  587. IN EFI_EVENT Event,
  588. IN UINT64 Timeout OPTIONAL
  589. );
  590. VOID
  591. WaitForEventWithTimeout (
  592. IN EFI_EVENT Event,
  593. IN UINTN Timeout,
  594. IN UINTN Row,
  595. IN UINTN Column,
  596. IN CHAR16 *String,
  597. IN EFI_INPUT_KEY TimeoutKey,
  598. OUT EFI_INPUT_KEY *Key
  599. );
  600. EFI_FILE_HANDLE
  601. LibOpenRoot (
  602. IN EFI_HANDLE DeviceHandle
  603. );
  604. EFI_FILE_INFO *
  605. LibFileInfo (
  606. IN EFI_FILE_HANDLE FHand
  607. );
  608. EFI_FILE_SYSTEM_INFO *
  609. LibFileSystemInfo (
  610. IN EFI_FILE_HANDLE FHand
  611. );
  612. EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
  613. LibFileSystemVolumeLabelInfo (
  614. IN EFI_FILE_HANDLE FHand
  615. );
  616. BOOLEAN
  617. ValidMBR(
  618. IN MASTER_BOOT_RECORD *Mbr,
  619. IN EFI_BLOCK_IO *BlkIo
  620. );
  621. BOOLEAN
  622. LibMatchDevicePaths (
  623. IN EFI_DEVICE_PATH *Multi,
  624. IN EFI_DEVICE_PATH *Single
  625. );
  626. EFI_DEVICE_PATH *
  627. LibDuplicateDevicePathInstance (
  628. IN EFI_DEVICE_PATH *DevPath
  629. );
  630. EFI_DEVICE_PATH *
  631. DevicePathFromHandle (
  632. IN EFI_HANDLE Handle
  633. );
  634. EFI_DEVICE_PATH *
  635. DevicePathInstance (
  636. IN OUT EFI_DEVICE_PATH **DevicePath,
  637. OUT UINTN *Size
  638. );
  639. UINTN
  640. DevicePathInstanceCount (
  641. IN EFI_DEVICE_PATH *DevicePath
  642. );
  643. EFI_DEVICE_PATH *
  644. AppendDevicePath (
  645. IN EFI_DEVICE_PATH *Src1,
  646. IN EFI_DEVICE_PATH *Src2
  647. );
  648. EFI_DEVICE_PATH *
  649. AppendDevicePathNode (
  650. IN EFI_DEVICE_PATH *Src1,
  651. IN EFI_DEVICE_PATH *Src2
  652. );
  653. EFI_DEVICE_PATH*
  654. AppendDevicePathInstance (
  655. IN EFI_DEVICE_PATH *Src,
  656. IN EFI_DEVICE_PATH *Instance
  657. );
  658. EFI_DEVICE_PATH *
  659. FileDevicePath (
  660. IN EFI_HANDLE Device OPTIONAL,
  661. IN CHAR16 *FileName
  662. );
  663. UINTN
  664. DevicePathSize (
  665. IN EFI_DEVICE_PATH *DevPath
  666. );
  667. EFI_DEVICE_PATH *
  668. DuplicateDevicePath (
  669. IN EFI_DEVICE_PATH *DevPath
  670. );
  671. EFI_DEVICE_PATH *
  672. UnpackDevicePath (
  673. IN EFI_DEVICE_PATH *DevPath
  674. );
  675. EFI_STATUS
  676. LibDevicePathToInterface (
  677. IN EFI_GUID *Protocol,
  678. IN EFI_DEVICE_PATH *FilePath,
  679. OUT VOID **Interface
  680. );
  681. CHAR16 *
  682. DevicePathToStr (
  683. EFI_DEVICE_PATH *DevPath
  684. );
  685. //
  686. // BugBug: I need my own include files
  687. //
  688. typedef struct {
  689. UINT8 Register;
  690. UINT8 Function;
  691. UINT8 Device;
  692. UINT8 Bus;
  693. UINT32 Reserved;
  694. } EFI_ADDRESS;
  695. typedef union {
  696. UINT64 Address;
  697. EFI_ADDRESS EfiAddress;
  698. } EFI_PCI_ADDRESS_UNION;
  699. EFI_STATUS
  700. PciFindDeviceClass (
  701. IN OUT EFI_PCI_ADDRESS_UNION *Address,
  702. IN UINT8 BaseClass,
  703. IN UINT8 SubClass
  704. );
  705. EFI_STATUS
  706. PciFindDevice (
  707. IN OUT EFI_PCI_ADDRESS_UNION *DeviceAddress,
  708. IN UINT16 VendorId,
  709. IN UINT16 DeviceId,
  710. IN OUT PCI_TYPE00 *Pci
  711. );
  712. //
  713. // SIMPLE_READ_FILE object used to access files
  714. //
  715. typedef VOID *SIMPLE_READ_FILE;
  716. EFI_STATUS
  717. OpenSimpleReadFile (
  718. IN BOOLEAN BootPolicy,
  719. IN VOID *SourceBuffer OPTIONAL,
  720. IN UINTN SourceSize,
  721. IN OUT EFI_DEVICE_PATH **FilePath,
  722. OUT EFI_HANDLE *DeviceHandle,
  723. OUT SIMPLE_READ_FILE *SimpleReadHandle
  724. );
  725. EFI_STATUS
  726. ReadSimpleReadFile (
  727. IN SIMPLE_READ_FILE SimpleReadHandle,
  728. IN UINTN Offset,
  729. IN OUT UINTN *ReadSize,
  730. OUT VOID *Buffer
  731. );
  732. VOID
  733. CloseSimpleReadFile (
  734. IN SIMPLE_READ_FILE SimpleReadHandle
  735. );
  736. VOID
  737. InitializeGuid (
  738. VOID
  739. );
  740. UINT8
  741. DecimaltoBCD(
  742. IN UINT8 DecValue
  743. );
  744. UINT8
  745. BCDtoDecimal(
  746. IN UINT8 BcdValue
  747. );
  748. EFI_STATUS
  749. LibGetSystemConfigurationTable(
  750. IN EFI_GUID *TableGuid,
  751. IN OUT VOID **Table
  752. );
  753. BOOLEAN
  754. LibIsValidTextGraphics (
  755. IN CHAR16 Graphic,
  756. OUT CHAR8 *PcAnsi, OPTIONAL
  757. OUT CHAR8 *Ascii OPTIONAL
  758. );
  759. BOOLEAN
  760. IsValidAscii (
  761. IN CHAR16 Ascii
  762. );
  763. BOOLEAN
  764. IsValidEfiCntlChar (
  765. IN CHAR16 c
  766. );
  767. CHAR16 *
  768. LibGetUiString (
  769. IN EFI_HANDLE Handle,
  770. IN UI_STRING_TYPE StringType,
  771. IN ISO_639_2 *LangCode,
  772. IN BOOLEAN ReturnDevicePathStrOnMismatch
  773. );
  774. CHAR8*
  775. LibGetSmbiosString (
  776. IN SMBIOS_STRUCTURE_POINTER *Smbios,
  777. IN UINT16 StringNumber
  778. );
  779. EFI_STATUS
  780. LibGetSmbiosSystemGuidAndSerialNumber (
  781. IN EFI_GUID *SystemGuid,
  782. OUT CHAR8 **SystemSerialNumber
  783. );
  784. EFI_STATUS
  785. InitializeGlobalIoDevice (
  786. IN EFI_DEVICE_PATH *DevicePath,
  787. IN EFI_GUID *Protocol,
  788. IN CHAR8 *ErrorStr,
  789. OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs
  790. );
  791. UINT32
  792. ReadPort (
  793. IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
  794. IN EFI_IO_WIDTH Width,
  795. IN UINTN Port
  796. );
  797. UINT32
  798. WritePort (
  799. IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
  800. IN EFI_IO_WIDTH Width,
  801. IN UINTN Port,
  802. IN UINTN Data
  803. );
  804. UINT32
  805. ReadPciConfig (
  806. IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
  807. IN EFI_IO_WIDTH Width,
  808. IN UINTN Port
  809. );
  810. UINT32
  811. WritePciConfig (
  812. IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
  813. IN EFI_IO_WIDTH Width,
  814. IN UINTN Port,
  815. IN UINTN Data
  816. );
  817. extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs;
  818. #define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte)
  819. #define inp(_Port) (UINT8)ReadPort(GlobalIoFncs, IO_UINT8, (UINTN)_Port)
  820. #define outpw(_Port, _DataByte) (UINT16)WritePort(GlobalIoFncs, IO_UINT16, (UINTN)_Port, (UINTN)_DataByte)
  821. #define inpw(_Port) (UINT16)ReadPort(GlobalIoFncs, IO_UINT16, (UINTN)_Port)
  822. #define outpd(_Port, _DataByte) (UINT32)WritePort(GlobalIoFncs, IO_UINT32, (UINTN)_Port, (UINTN)_DataByte)
  823. #define inpd(_Port) (UINT32)ReadPort(GlobalIoFncs, IO_UINT32, (UINTN)_Port)
  824. #define writepci8(_Addr, _DataByte) (UINT8)WritePciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr, (UINTN)_DataByte)
  825. #define readpci8(_Addr) (UINT8)ReadPciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr)
  826. #define writepci16(_Addr, _DataByte) (UINT16)WritePciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr, (UINTN)_DataByte)
  827. #define readpci16(_Addr) (UINT16)ReadPciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr)
  828. #define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte)
  829. #define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr)
  830. #define Pause() WaitForSingleEvent (ST->ConIn->WaitForKey, 0)
  831. #define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode))
  832. #endif