efilib.h 21 KB

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