123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653 |
- /*++
- Copyright (c) 2013 Minoca Corp.
- This file is licensed under the terms of the GNU General Public License
- version 3. Alternative licensing terms are available. Contact
- info@minocacorp.com for details. See the LICENSE file at the root of this
- project for complete licensing information.
- Module Name:
- uefifw.h
- Abstract:
- This header contains base definitions for the UEFI firmware implementations.
- This header is internal to the firmware implementation and is not exposed
- to UEFI applications or drivers.
- Author:
- Evan Green 26-Feb-2014
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <minoca/uefi/uefi.h>
- #include "shortcut.h"
- //
- // --------------------------------------------------------------------- Macros
- //
- //
- // These macros convert to and from Binary Coded Decimal values.
- //
- #define EFI_BCD_TO_BINARY(_BcdValue) \
- ((((_BcdValue) >> 4) * 10) + ((_BcdValue) & 0x0F))
- #define EFI_BINARY_TO_BCD(_BinaryValue) \
- ((((_BinaryValue) / 10) << 4) | ((_BinaryValue) % 10))
- //
- // ---------------------------------------------------------------- Definitions
- //
- #ifndef NOTHING
- #define NOTHING
- #endif
- #define EFI_IDLE_LOOP_EVENT_GUID \
- { \
- 0x3C8D294C, 0x5FC3, 0x4451, \
- {0xBB, 0x31, 0xC4, 0xC0, 0x32, 0x29, 0x5E, 0x6C} \
- }
- #define EFI_DEFAULT_SHELL_FILE_GUID \
- { \
- 0x7C04A583, 0x9E3E, 0x4F1C, \
- {0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1} \
- }
- //
- // Define the default watchdog timer duration that gets set when handing
- // control to drivers and boot entries.
- //
- #define EFI_DEFAULT_WATCHDOG_DURATION (5 * 60)
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- typedef
- VOID
- (*EFI_PLATFORM_BEGIN_INTERRUPT) (
- UINT32 *InterruptNumber,
- VOID **InterruptContext
- );
- /*++
- Routine Description:
- This routine is called when an interrupts comes in. The platform code is
- responsible for reporting the interrupt number. Interrupts are disabled at
- the processor core at this point.
- Arguments:
- InterruptNumber - Supplies a pointer where interrupt line number will be
- returned.
- InterruptContext - Supplies a pointer where the platform can store a
- pointer's worth of context that will be passed back when ending the
- interrupt.
- Return Value:
- None.
- --*/
- typedef
- VOID
- (*EFI_PLATFORM_HANDLE_INTERRUPT) (
- UINT32 InterruptNumber,
- VOID *InterruptContext
- );
- /*++
- Routine Description:
- This routine is called to handle a platform interrupt.
- Arguments:
- InterruptNumber - Supplies the interrupt number that occurred.
- InterruptContext - Supplies the context returned by the interrupt
- controller when the interrupt began.
- Return Value:
- None.
- --*/
- typedef
- VOID
- (*EFI_PLATFORM_END_INTERRUPT) (
- UINT32 InterruptNumber,
- VOID *InterruptContext
- );
- /*++
- Routine Description:
- This routine is called to finish handling of a platform interrupt. This is
- where the End-Of-Interrupt would get sent to the interrupt controller.
- Arguments:
- InterruptNumber - Supplies the interrupt number that occurred.
- InterruptContext - Supplies the context returned by the interrupt
- controller when the interrupt began.
- Return Value:
- None.
- --*/
- typedef
- VOID
- (*EFI_PLATFORM_SERVICE_TIMER_INTERRUPT) (
- UINT32 InterruptNumber
- );
- /*++
- Routine Description:
- This routine is called to acknowledge a platform timer interrupt. This
- routine is responsible for quiescing the interrupt.
- Arguments:
- InterruptNumber - Supplies the interrupt number that occurred.
- Return Value:
- None.
- --*/
- typedef
- UINT64
- (*EFI_PLATFORM_READ_TIMER) (
- VOID
- );
- /*++
- Routine Description:
- This routine is called to read the current platform time value. The timer
- is assumed to be free running at a constant frequency, and should have a
- bit width as reported in the initialize function. The UEFI core will
- manage software bit extension out to 64 bits, this routine should just
- reporte the hardware timer value.
- Arguments:
- None.
- Return Value:
- Returns the hardware timer value.
- --*/
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Store the firmware version information.
- //
- extern UINT16 EfiVersionMajor;
- extern UINT16 EfiVersionMinor;
- extern UINT16 EfiVersionRevision;
- extern UINT8 EfiVersionRelease;
- extern UINT32 EfiEncodedVersion;
- extern UINT32 EfiVersionSerial;
- extern UINT32 EfiBuildTime;
- extern CHAR8 *EfiBuildString;
- extern CHAR8 *EfiProductName;
- extern CHAR8 *EfiBuildTimeString;
- //
- // Define some well known GUIDs.
- //
- extern EFI_GUID EfiAcpiTableGuid;
- extern EFI_GUID EfiAcpiTable1Guid;
- extern EFI_GUID EfiBlockIoProtocolGuid;
- extern EFI_GUID EfiDevicePathProtocolGuid;
- extern EFI_GUID EfiDiskIoProtocolGuid;
- extern EFI_GUID EfiDriverBindingProtocolGuid;
- extern EFI_GUID EfiEventExitBootServicesGuid;
- extern EFI_GUID EfiEventVirtualAddressChangeGuid;
- extern EFI_GUID EfiEventMemoryMapChangeGuid;
- extern EFI_GUID EfiEventReadyToBootGuid;
- extern EFI_GUID EfiFileInformationGuid;
- extern EFI_GUID EfiFirmwareVolume2ProtocolGuid;
- extern EFI_GUID EfiGlobalVariableGuid;
- extern EFI_GUID EfiGraphicsOutputProtocolGuid;
- extern EFI_GUID EfiLoadedImageProtocolGuid;
- extern EFI_GUID EfiLoadFileProtocolGuid;
- extern EFI_GUID EfiLoadFile2ProtocolGuid;
- extern EFI_GUID EfiPartitionTypeSystemPartitionGuid;
- extern EFI_GUID EfiSimpleFileSystemProtocolGuid;
- extern EFI_GUID EfiSimpleTextInputProtocolGuid;
- extern EFI_GUID EfiSimpleTextOutputProtocolGuid;
- //
- // -------------------------------------------------------- Function Prototypes
- //
- //
- // Define functions implemented by the platform-specific firmware, called by
- // the firmware core.
- //
- //
- // Debug transport routines
- //
- EFI_STATUS
- EfiPlatformDebugDeviceReset (
- UINT32 BaudRate
- );
- /*++
- Routine Description:
- This routine attempts to initialize the serial UART used for debugging.
- Arguments:
- BaudRate - Supplies the desired baud rate.
- Return Value:
- EFI_SUCCESS on success.
- EFI_DEVICE_ERROR if a device error occurred while resetting the device.
- EFI_UNSUPPORTED if the given baud rate cannot be achieved.
- --*/
- EFI_STATUS
- EfiPlatformDebugDeviceTransmit (
- VOID *Data,
- UINTN Size
- );
- /*++
- Routine Description:
- This routine transmits data from the host out through the debug device.
- Arguments:
- Data - Supplies a pointer to the data to write.
- Size - Supplies the size to write, in bytes.
- Return Value:
- EFI_SUCCESS on success.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
- EFI_STATUS
- EfiPlatformDebugDeviceReceive (
- VOID *Data,
- UINTN *Size
- );
- /*++
- Routine Description:
- This routine receives incoming data from the debug device.
- Arguments:
- Data - Supplies a pointer where the read data will be returned on success.
- Size - Supplies a pointer that on input contains the size of the receive
- buffer. On output, returns the number of bytes read.
- Return Value:
- EFI_SUCCESS on success.
- EFI_NOT_READY if there was no data to be read at the current time.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
- EFI_STATUS
- EfiPlatformDebugDeviceGetStatus (
- BOOLEAN *ReceiveDataAvailable
- );
- /*++
- Routine Description:
- This routine returns the current device status.
- Arguments:
- ReceiveDataAvailable - Supplies a pointer where a boolean will be returned
- indicating whether or not receive data is available.
- Return Value:
- EFI_SUCCESS on success.
- EFI_DEVICE_ERROR if a device error occurred.
- --*/
- VOID
- EfiPlatformDebugDeviceDisconnect (
- VOID
- );
- /*++
- Routine Description:
- This routine disconnects a device, taking it offline.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- //
- // Initialization routines
- //
- EFI_STATUS
- EfiPlatformInitialize (
- UINT32 Phase
- );
- /*++
- Routine Description:
- This routine performs platform-specific firmware initialization.
- Arguments:
- Phase - Supplies the iteration number this routine is being called on.
- Phase zero occurs very early, just after the debugger comes up.
- Phase one occurs a bit later, after timer and interrupt services are
- initialized. Phase two happens right before boot, after all platform
- devices have been enumerated.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfiPlatformGetInitialMemoryMap (
- EFI_MEMORY_DESCRIPTOR **Map,
- UINTN *MapSize
- );
- /*++
- Routine Description:
- This routine returns the initial platform memory map to the EFI core. The
- core maintains this memory map. The memory map returned does not need to
- take into account the firmware image itself or stack, the EFI core will
- reserve those regions automatically.
- Arguments:
- Map - Supplies a pointer where the array of memory descriptors constituting
- the initial memory map is returned on success. The EFI core will make
- a copy of these descriptors, so they can be in read-only or
- temporary memory.
- MapSize - Supplies a pointer where the number of elements in the initial
- memory map will be returned on success.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfiPlatformInitializeInterrupts (
- EFI_PLATFORM_BEGIN_INTERRUPT *BeginInterruptFunction,
- EFI_PLATFORM_HANDLE_INTERRUPT *HandleInterruptFunction,
- EFI_PLATFORM_END_INTERRUPT *EndInterruptFunction
- );
- /*++
- Routine Description:
- This routine initializes support for platform interrupts. Interrupts are
- assumed to be disabled at the processor now. This routine should enable
- interrupts at the procesor core.
- Arguments:
- BeginInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called when an interrupt occurs.
- HandleInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called to handle a platform-specific interurpt.
- NULL may be returned here.
- EndInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called to complete an interrupt.
- Return Value:
- EFI Status code.
- --*/
- VOID
- EfiPlatformTerminateInterrupts (
- VOID
- );
- /*++
- Routine Description:
- This routine terminates interrupt services in preparation for transitioning
- out of boot services.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- EFIAPI
- EFI_STATUS
- EfiPlatformSetWatchdogTimer (
- UINTN Timeout,
- UINT64 WatchdogCode,
- UINTN DataSize,
- CHAR16 *WatchdogData
- );
- /*++
- Routine Description:
- This routine sets the system's watchdog timer.
- Arguments:
- Timeout - Supplies the number of seconds to set the timer for.
- WatchdogCode - Supplies a numeric code to log on a watchdog timeout event.
- DataSize - Supplies the size of the watchdog data.
- WatchdogData - Supplies an optional buffer that includes a null-terminated
- string, optionally followed by additional binary data.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if the supplied watchdog code is invalid.
- EFI_UNSUPPORTED if there is no watchdog timer.
- EFI_DEVICE_ERROR if an error occurred accessing the device hardware.
- --*/
- EFI_STATUS
- EfiPlatformInitializeTimers (
- UINT32 *ClockTimerInterruptNumber,
- EFI_PLATFORM_SERVICE_TIMER_INTERRUPT *ClockTimerServiceRoutine,
- EFI_PLATFORM_READ_TIMER *ReadTimerRoutine,
- UINT64 *ReadTimerFrequency,
- UINT32 *ReadTimerWidth
- );
- /*++
- Routine Description:
- This routine initializes platform timer services. There are actually two
- different timer services returned in this routine. The periodic timer tick
- provides a periodic interrupt. The read timer provides a free running
- counter value. These are likely serviced by different timers. For the
- periodic timer tick, this routine should start the periodic interrupts
- coming in. The periodic rate of the timer can be anything reasonable, as
- the time counter will be used to count actual duration. The rate should be
- greater than twice the rollover rate of the time counter to ensure proper
- time accounting. Interrupts are disabled at the processor core for the
- duration of this routine.
- Arguments:
- ClockTimerInterruptNumber - Supplies a pointer where the interrupt line
- number of the periodic timer tick will be returned.
- ClockTimerServiceRoutine - Supplies a pointer where a pointer to a routine
- called when the periodic timer tick interrupt occurs will be returned.
- ReadTimerRoutine - Supplies a pointer where a pointer to a routine
- called to read the current timer value will be returned.
- ReadTimerFrequency - Supplies the frequency of the counter.
- ReadTimerWidth - Supplies a pointer where the read timer bit width will be
- returned.
- Return Value:
- EFI Status code.
- --*/
- VOID
- EfiPlatformTerminateTimers (
- VOID
- );
- /*++
- Routine Description:
- This routine terminates timer services in preparation for the termination
- of boot services.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- EFI_STATUS
- EfiPlatformEnumerateFirmwareVolumes (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates any firmware volumes the platform may have
- tucked away. The platform should load them into memory and call
- EfiCreateFirmwareVolume for each one.
- Arguments:
- None.
- Return Value:
- EFI Status code.
- --*/
- EFI_STATUS
- EfiPlatformEnumerateDevices (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates and connects any builtin devices the platform
- contains.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfiPlatformRuntimeInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine performs platform-specific firmware initialization in the
- runtime core driver. The runtime routines are in a separate binary from the
- firmware core routines as they need to be relocated for runtime. This
- routine should perform platform-specific initialization needed to provide
- the core runtime services.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- //
- // Variable services, implemented in the runtime core.
- //
- EFI_STATUS
- EfiPlatformReadNonVolatileData (
- VOID *Data,
- UINTN DataSize
- );
- /*++
- Routine Description:
- This routine reads the EFI variable data from non-volatile storage.
- Arguments:
- Data - Supplies a pointer where the platform returns the non-volatile
- data.
- DataSize - Supplies the size of the data to return.
- Return Value:
- EFI_SUCCESS if some data was successfully loaded.
- EFI_UNSUPPORTED if the platform does not have non-volatile storage. In this
- case the firmware core saves the non-volatile variables to a file on the
- EFI system partition, and the variable library hopes to catch the same
- variable buffer on reboots to see variable writes that happened at
- runtime.
- EFI_DEVICE_IO_ERROR if a device error occurred during the operation.
- Other error codes on other failures.
- --*/
- EFI_STATUS
- EfiPlatformWriteNonVolatileData (
- VOID *Data,
- UINTN DataSize
- );
- /*++
- Routine Description:
- This routine writes the EFI variable data to non-volatile storage.
- Arguments:
- Data - Supplies a pointer to the data to write.
- DataSize - Supplies the size of the data to write, in bytes.
- Return Value:
- EFI_SUCCESS if some data was successfully loaded.
- EFI_UNSUPPORTED if the platform does not have non-volatile storage. In this
- case the firmware core saves the non-volatile variables to a file on the
- EFI system partition, and the variable library hopes to catch the same
- variable buffer on reboots to see variable writes that happened at
- runtime.
- EFI_DEVICE_IO_ERROR if a device error occurred during the operation.
- Other error codes on other failures.
- --*/
- VOID
- EfiPlatformRuntimeExitBootServices (
- VOID
- );
- /*++
- Routine Description:
- This routine is called in the runtime core driver when the firmware is in
- the process of terminating boot services. The platform can do any work it
- needs to prepare for the imminent termination of boot services.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- EfiPlatformRuntimeVirtualAddressChange (
- VOID
- );
- /*++
- Routine Description:
- This routine is called in the runtime core driver when the firmware is
- converting to virtual address mode. It should convert any pointers it's
- got. This routine is called after ExitBootServices, so no EFI boot services
- are available.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- //
- // Define functions implemented by the UEFI core that platform functions can
- // call.
- //
- VOID
- EfiCoreMain (
- VOID *FirmwareBaseAddress,
- VOID *FirmwareLowestAddress,
- UINTN FirmwareSize,
- CHAR8 *FirmwareBinaryName,
- VOID *StackBase,
- UINTN StackSize
- );
- /*++
- Routine Description:
- This routine implements the entry point into the UEFI firmware. This
- routine is called by the platform firmware, and should be called as early
- as possible. It will perform callouts to allow the platform to initialize
- further.
- Arguments:
- FirmwareBaseAddress - Supplies the base address where the firmware was
- loaded into memory. Supply -1 to indicate that the image is loaded at
- its preferred base address and was not relocated.
- FirmwareLowestAddress - Supplies the lowest address where the firmware was
- loaded into memory.
- FirmwareSize - Supplies the size of the firmware image in memory, in bytes.
- FirmwareBinaryName - Supplies the name of the binary that's loaded, which
- is reported to the debugger for symbol loading.
- StackBase - Supplies the base (lowest) address of the stack.
- StackSize - Supplies the size in bytes of the stack. This should be at
- least 0x4000 bytes (16kB).
- Return Value:
- This routine does not return.
- --*/
- EFI_STATUS
- EfiCreateFirmwareVolume (
- EFI_PHYSICAL_ADDRESS BaseAddress,
- UINT64 Length,
- EFI_HANDLE ParentHandle,
- UINT32 AuthenticationStatus,
- EFI_HANDLE *BlockIoProtocol
- );
- /*++
- Routine Description:
- This routine creates a firmware volume out of the given memory buffer.
- Specifically, this function creates a handle and adds the Firmware Block
- I/O protocol and the Device Path protocol to it. The firmware volume
- protocol will then attach after noticing the block I/O protocol instance.
- Arguments:
- BaseAddress - Supplies the physical address of the firmware volume buffer.
- Length - Supplies the length of the firmware volume buffer in bytes.
- ParentHandle - Supplies an optional handle to a parent firmware volume this
- volume is being enumerated from.
- AuthenticationStatus - Supplies the authentication status of this volume if
- this volume came from another file and volume.
- BlockIoProtocol - Supplies an optional pointer where the created handle
- will be returned on success.
- Return Value:
- EFI_SUCCESS on success.
- EFI_VOLUME_CORRUPTED if the volume was not valid.
- EFI_OUT_OF_RESOURCES on allocation failure.
- --*/
- EFI_STATUS
- EfiCoreEnumerateRamDisk (
- EFI_PHYSICAL_ADDRESS Base,
- UINT64 Size
- );
- /*++
- Routine Description:
- This routine enumerates a RAM disk at the given address.
- Arguments:
- Base - Supplies the base physical address of the RAM disk.
- Size - Supplies the size of the RAM disk.
- Return Value:
- EFI Status code.
- --*/
- EFIAPI
- EFI_STATUS
- EfiCoreFlushVariableData (
- VOID
- );
- /*++
- Routine Description:
- This routine attempts to write variable data out to non-volatile storage.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- EFIAPI
- EFI_STATUS
- EfiAcpiInstallTable (
- VOID *AcpiTableBuffer,
- UINTN AcpiTableBufferSize,
- UINTN *TableKey
- );
- /*++
- Routine Description:
- This routine installs an ACPI table into the RSDT/XSDT.
- Arguments:
- AcpiTableBuffer - Supplies a pointer to the buffer containing the ACPI
- table to insert.
- AcpiTableBufferSize - Supplies the size in bytes of the ACPI table buffer.
- TableKey - Supplies a pointer where a key will be returned that refers
- to the table.
- Return Value:
- EFI status code.
- --*/
- EFIAPI
- EFI_STATUS
- EfiAcpiUninstallTable (
- UINTN TableKey
- );
- /*++
- Routine Description:
- This routine uninstalls a previously install ACPI table.
- Arguments:
- TableKey - Supplies the key returned when the table was installed.
- Return Value:
- EFI status code.
- --*/
- EFIAPI
- VOID
- EfiAcpiChecksumTable (
- VOID *Buffer,
- UINTN Size,
- UINTN ChecksumOffset
- );
- /*++
- Routine Description:
- This routine checksums an ACPI table.
- Arguments:
- Buffer - Supplies a pointer to the table to checksum.
- Size - Supplies the size of the table in bytes.
- ChecksumOffset - Supplies the offset of the 8 bit checksum field.
- Return Value:
- None.
- --*/
- EFIAPI
- VOID *
- EfiGetAcpiTable (
- UINT32 Signature,
- VOID *PreviousTable
- );
- /*++
- Routine Description:
- This routine attempts to find an ACPI description table with the given
- signature. This routine does not validate the checksum of the table.
- Arguments:
- Signature - Supplies the signature of the desired table.
- PreviousTable - Supplies an optional pointer to the table to start the
- search from.
- Return Value:
- Returns a pointer to the beginning of the header to the table if the table
- was found, or NULL if the table could not be located.
- --*/
- EFIAPI
- EFI_STATUS
- EfiSmbiosAddStructure (
- VOID *Table,
- ...
- );
- /*++
- Routine Description:
- This routine adds an SMBIOS structure to the SMBIOS table.
- Arguments:
- Table - Supplies a pointer to the table to add. A copy of this data will be
- made. The length of the table must be correctly filled in.
- ... - Supplies an array of pointers to strings to add to the end of the
- table. This list must be terminated with a NULL.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INSUFFICIENT_RESOURCES if a memory allocation failed.
- --*/
- EFI_STATUS
- EfiConvertCounterToEfiTime (
- INT64 Counter,
- EFI_TIME *EfiTime
- );
- /*++
- Routine Description:
- This routine converts from a second-based counter value to an EFI time
- structure.
- Arguments:
- Counter - Supplies the count of seconds since January 1, 2001 GMT.
- EfiTime - Supplies a pointer where the EFI time fields will be returned.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if the counter could not be converted.
- --*/
- EFI_STATUS
- EfiConvertEfiTimeToCounter (
- EFI_TIME *EfiTime,
- INT64 *Counter
- );
- /*++
- Routine Description:
- This routine converts from an EFI time structure into the number of seconds
- since January 1, 2001 GMT.
- Arguments:
- EfiTime - Supplies a pointer to the EFI time to convert.
- Counter - Supplies a pointer where the count of seconds will be returned
- on success.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if the counter could not be converted.
- --*/
- BOOLEAN
- EfiDivideUnsigned64 (
- UINT64 Dividend,
- UINT64 Divisor,
- UINT64 *QuotientOut,
- UINT64 *RemainderOut
- );
- /*++
- Routine Description:
- This routine performs a 64-bit divide of two unsigned numbers.
- Arguments:
- Dividend - Supplies the number that is going to be divided (the numerator).
- Divisor - Supplies the number to divide into (the denominator).
- QuotientOut - Supplies a pointer that receives the result of the divide.
- This parameter may be NULL.
- RemainderOut - Supplies a pointer that receives the remainder of the
- divide. This parameter may be NULL.
- Return Value:
- Returns TRUE if the operation was successful, or FALSE if there was an
- error (like divide by 0).
- --*/
- BOOLEAN
- EfiDivide64 (
- INT64 Dividend,
- INT64 Divisor,
- INT64 *QuotientOut,
- INT64 *RemainderOut
- );
- /*++
- Routine Description:
- This routine performs a 64-bit divide of two signed numbers.
- Arguments:
- Dividend - Supplies the number that is going to be divided (the numerator).
- Divisor - Supplies the number to divide into (the denominator).
- QuotientOut - Supplies a pointer that receives the result of the divide.
- This parameter may be NULL.
- RemainderOut - Supplies a pointer that receives the remainder of the
- divide. This parameter may be NULL.
- Return Value:
- Returns TRUE if the operation was successful, or FALSE if there was an
- error (like divide by 0).
- --*/
- //
- // Interrupt functions
- //
- BOOLEAN
- EfiDisableInterrupts (
- VOID
- );
- /*++
- Routine Description:
- This routine disables all interrupts on the current processor.
- Arguments:
- None.
- Return Value:
- TRUE if interrupts were previously enabled on the processor.
- FALSE if interrupts were not previously enabled on the processor.
- --*/
- VOID
- EfiEnableInterrupts (
- VOID
- );
- /*++
- Routine Description:
- This routine enables interrupts on the current processor.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- BOOLEAN
- EfiAreInterruptsEnabled (
- VOID
- );
- /*++
- Routine Description:
- This routine determines whether or not interrupts are currently enabled
- on the processor.
- Arguments:
- None.
- Return Value:
- TRUE if interrupts are enabled in the processor.
- FALSE if interrupts are globally disabled.
- --*/
- VOID
- EfiCoreInvalidateInstructionCacheRange (
- VOID *Address,
- UINTN Length
- );
- /*++
- Routine Description:
- This routine invalidates a region of memory in the instruction cache.
- Arguments:
- Address - Supplies the address to invalidate. If translation is enabled,
- this is a virtual address.
- Length - Supplies the number of bytes in the region to invalidate.
- Return Value:
- None.
- --*/
- BOOLEAN
- EfiIsAtRuntime (
- VOID
- );
- /*++
- Routine Description:
- This routine determines whether or not the system has gone through
- ExitBootServices.
- Arguments:
- None.
- Return Value:
- TRUE if the system has gone past ExitBootServices and is now in the
- Runtime phase.
- FALSE if the system is currently in the Boot phase.
- --*/
- //
- // I/O port functions (only applicable to PC platforms).
- //
- UINT8
- EfiIoPortIn8 (
- UINT16 Address
- );
- /*++
- Routine Description:
- This routine performs an 8-bit read from the given I/O port.
- Arguments:
- Address - Supplies the address to read from.
- Return Value:
- Returns the value at that address.
- --*/
- UINT16
- EfiIoPortIn16 (
- UINT16 Address
- );
- /*++
- Routine Description:
- This routine performs a 16-bit read from the given I/O port.
- Arguments:
- Address - Supplies the address to read from.
- Return Value:
- Returns the value at that address.
- --*/
- UINT32
- EfiIoPortIn32 (
- UINT16 Address
- );
- /*++
- Routine Description:
- This routine performs a 32-bit read from the given I/O port.
- Arguments:
- Address - Supplies the address to read from.
- Return Value:
- Returns the value at that address.
- --*/
- VOID
- EfiIoPortOut8 (
- UINT16 Address,
- UINT8 Value
- );
- /*++
- Routine Description:
- This routine performs an 8-bit write to the given I/O port.
- Arguments:
- Address - Supplies the address to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- VOID
- EfiIoPortOut16 (
- UINT16 Address,
- UINT16 Value
- );
- /*++
- Routine Description:
- This routine performs a 16-bit write to the given I/O port.
- Arguments:
- Address - Supplies the address to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- VOID
- EfiIoPortOut32 (
- UINT16 Address,
- UINT32 Value
- );
- /*++
- Routine Description:
- This routine performs a 32-bit write to the given I/O port.
- Arguments:
- Address - Supplies the address to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- //
- // Safe memory-mapped hardware register access functions
- //
- UINT32
- EfiReadRegister32 (
- VOID *RegisterAddress
- );
- /*++
- Routine Description:
- This routine performs a 32-bit memory register read. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to read.
- Return Value:
- Returns the value at the given register.
- --*/
- VOID
- EfiWriteRegister32 (
- VOID *RegisterAddress,
- UINT32 Value
- );
- /*++
- Routine Description:
- This routine performs a 32-bit memory register write. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- UINT16
- EfiReadRegister16 (
- VOID *RegisterAddress
- );
- /*++
- Routine Description:
- This routine performs a 16-bit memory register read. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to read.
- Return Value:
- Returns the value at the given register.
- --*/
- VOID
- EfiWriteRegister16 (
- VOID *RegisterAddress,
- UINT16 Value
- );
- /*++
- Routine Description:
- This routine performs a 16-bit memory register write. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- UINT8
- EfiReadRegister8 (
- VOID *RegisterAddress
- );
- /*++
- Routine Description:
- This routine performs an 8-bit memory register read. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to read.
- Return Value:
- Returns the value at the given register.
- --*/
- VOID
- EfiWriteRegister8 (
- VOID *RegisterAddress,
- UINT8 Value
- );
- /*++
- Routine Description:
- This routine performs an 8-bit memory register write. The given address
- is assumed to be mapped with an uncached attribute.
- Arguments:
- RegisterAddress - Supplies the virtual address of the register to write to.
- Value - Supplies the value to write.
- Return Value:
- None.
- --*/
- VOID
- EfiMemoryBarrier (
- VOID
- );
- /*++
- Routine Description:
- This routine provides a full memory barrier, ensuring that all memory
- accesses occurring before this function complete before any memory accesses
- after this function start.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- EfiDebugPrint (
- CHAR8 *Format,
- ...
- );
- /*++
- Routine Description:
- This routine prints to the debugger and console.
- Arguments:
- Format - Supplies a pointer to the format string.
- ... - Supplies the remaining arguments to the format string.
- Return Value:
- None.
- --*/
|