123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- /*++
- Copyright (c) 2014 Minoca Corp. All Rights Reserved
- Module Name:
- runtime.c
- Abstract:
- This module implements platform-specific runtime code for the PandaBoard
- system.
- Author:
- Evan Green 19-Mar-2014
- Environment:
- Firmware
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <uefifw.h>
- #include "../pandafw.h"
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // ----------------------------------------------- Internal Function Prototypes
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Keep the GPIO address around just for the LEDs.
- //
- VOID *EfiOmap4Gpio1Address = (VOID *)OMAP4430_GPIO1_BASE;
- //
- // ------------------------------------------------------------------ Functions
- //
- 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.
- --*/
- {
- EFI_STATUS Status;
- EfipOmapI2cInitialize();
- Status = Omap4Twl6030InitializeMmcPower();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = Omap4Twl6030InitializeRtc();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- //
- // Take over the runtime services. The runtime library recomputes the
- // CRC so there's no need to do it here.
- //
- EfiRuntimeServices->GetTime = EfipOmap4GetTime;
- EfiRuntimeServices->SetTime = EfipOmap4SetTime;
- EfiRuntimeServices->GetWakeupTime = EfipOmap4GetWakeupTime;
- EfiRuntimeServices->SetWakeupTime = EfipOmap4SetWakeupTime;
- EfiRuntimeServices->ResetSystem = EfipOmap4ResetSystem;
- return EFI_SUCCESS;
- }
- 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.
- --*/
- {
- return EFI_UNSUPPORTED;
- }
- 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.
- --*/
- {
- return EFI_UNSUPPORTED;
- }
- 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.
- --*/
- {
- //
- // Turn on both LEDs just for fun.
- //
- WRITE_GPIO1_REGISTER(OmapGpioOutputSet, (1 << 7) | (1 << 8));
- return;
- }
- 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.
- --*/
- {
- //
- // Convert the I2C base for GetTime and friends, and convert the PRM
- // Device instance base for ResetSystem.
- //
- EfiConvertPointer(0, &EfiOmap4I2cBase);
- EfiConvertPointer(0, &EfiOmap4PrmDeviceBase);
- return;
- }
- //
- // --------------------------------------------------------- Internal Functions
- //
|