123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- /*++
- Copyright (c) 2015 Minoca Corp. All Rights Reserved
- Module Name:
- veyronfw.h
- Abstract:
- This header contains internal definitions for the Veyron firmware, which
- supports the Asus C201 Chromebook.
- Author:
- Evan Green 9-Jul-2015
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <minoca/soc/rk32xx.h>
- //
- // --------------------------------------------------------------------- Macros
- //
- #define RK32_READ_CRU(_Register) \
- EfiReadRegister32((VOID *)RK32_CRU_BASE + (_Register))
- #define RK32_WRITE_CRU(_Register, _Value) \
- EfiWriteRegister32((VOID *)RK32_CRU_BASE + (_Register), (_Value))
- #define RK32_READ_GRF(_Register) \
- EfiReadRegister32((VOID *)RK32_GRF_BASE + (_Register))
- #define RK32_WRITE_GRF(_Register, _Value) \
- EfiWriteRegister32((VOID *)RK32_GRF_BASE + (_Register), (_Value))
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // Do not use the last 16MB of RAM as it causes AHB errors during DMA
- // transations.
- //
- #define VEYRON_RAM_START 0x00000000
- #define VEYRON_RAM_SIZE 0xFE000000
- #define VEYRON_OSC_HERTZ 24000000
- #define VEYRON_ARM_CPU_HERTZ 1704000000
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Store a boolean used for debugging that disables the watchdog timer.
- //
- extern BOOLEAN EfiDisableWatchdog;
- //
- // The runtime stores a pointer to GPIO0 for system reset purposes.
- //
- extern VOID *EfiRk32Gpio0Base;
- //
- // The runtime stores a pointer to the I2C PMU for the RTC.
- //
- extern VOID *EfiRk32I2cPmuBase;
- //
- // Define a boolean indicating whether the firmware was loaded via SD or eMMC.
- //
- extern BOOLEAN EfiBootedViaSd;
- //
- // -------------------------------------------------------- Function Prototypes
- //
- EFI_STATUS
- EfipPlatformSetInterruptLineState (
- UINT32 LineNumber,
- BOOLEAN Enabled,
- BOOLEAN EdgeTriggered
- );
- /*++
- Routine Description:
- This routine enables or disables an interrupt line.
- Arguments:
- LineNumber - Supplies the line number to enable or disable.
- Enabled - Supplies a boolean indicating if the line should be enabled or
- disabled.
- EdgeTriggered - Supplies a boolean indicating if the interrupt is edge
- triggered (TRUE) or level triggered (FALSE).
- Return Value:
- EFI Status code.
- --*/
- EFI_STATUS
- EfipRk32GetPllClockFrequency (
- RK32_PLL_TYPE PllType,
- UINT32 *Frequency
- );
- /*++
- Routine Description:
- This routine returns the base PLL clock frequency of the given type.
- Arguments:
- PllType - Supplies the type of the PLL clock whose frequency is being
- queried.
- Frequency - Supplies a pointer that receives the PLL clock's frequency in
- Hertz.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipVeyronCreateSmbiosTables (
- VOID
- );
- /*++
- Routine Description:
- This routine creates the SMBIOS tables.
- Arguments:
- None.
- Return Value:
- EFI Status code.
- --*/
- EFI_STATUS
- EfipEnumerateRamDisks (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates any RAM disks embedded in the firmware.
- Arguments:
- None.
- Return Value:
- EFI Status code.
- --*/
- EFI_STATUS
- EfipVeyronEnumerateVideo (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates the display on the Veyron.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfipVeyronEnumerateSerial (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates the serial port on the Veyron RK3288 SoC.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- VOID
- EfipVeyronInitializeUart (
- VOID
- );
- /*++
- Routine Description:
- This routine completes any platform specific UART initialization steps.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- EFI_STATUS
- EfipSmpInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes and parks the second core on the RK32xx.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- EFI_STATUS
- EfipVeyronEnumerateSd (
- VOID
- );
- /*++
- Routine Description:
- This routine enumerates the SD card on the Veyron SoC.
- Arguments:
- None.
- Return Value:
- EFI status code.
- --*/
- VOID
- EfipVeyronUsbInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine performs any board-specific high speed USB initialization.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- EFI_STATUS
- EfipRk32I2cInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes the I2C device.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk32I2cWrite (
- UINT8 Chip,
- UINT32 Address,
- UINT32 AddressLength,
- VOID *Buffer,
- UINT32 Length
- );
- /*++
- Routine Description:
- This routine writes the given buffer out to the given i2c device.
- Arguments:
- Chip - Supplies the device to write to.
- Address - Supplies the address.
- AddressLength - Supplies the width of the address. Valid values are zero
- through two.
- Buffer - Supplies the buffer containing the data to write.
- Length - Supplies the length of the buffer in bytes.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk32I2cRead (
- UINT8 Chip,
- UINT32 Address,
- UINT32 AddressLength,
- VOID *Buffer,
- UINT32 Length
- );
- /*++
- Routine Description:
- This routine reads from the given i2c device into the given buffer.
- Arguments:
- Chip - Supplies the device to read from.
- Address - Supplies the address.
- AddressLength - Supplies the width of the address. Valid values are zero
- through two.
- Buffer - Supplies a pointer to the buffer where the read data will be
- returned.
- Length - Supplies the length of the buffer in bytes.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808InitializeRtc (
- VOID
- );
- /*++
- Routine Description:
- This routine enables the MMC power rails controlled by the TWL4030.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808ReadRtc (
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine reads the current time from the RK808.
- Arguments:
- Time - Supplies a pointer where the time is returned on success.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808ReadRtcWakeupTime (
- BOOLEAN *Enabled,
- BOOLEAN *Pending,
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine reads the wake alarm time from the RK808.
- Arguments:
- Enabled - Supplies a pointer where a boolean will be returned indicating if
- the wake time interrupt is enabled.
- Pending - Supplies a pointer where a boolean will be returned indicating if
- the wake alarm interrupt is pending and requires service.
- Time - Supplies a pointer where the time is returned on success.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808WriteRtc (
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine writes the current time to the RK808.
- Arguments:
- Time - Supplies a pointer to the new time to set.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808WriteRtcWakeupTime (
- BOOLEAN Enable,
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine writes the alarm time to the RK808.
- Arguments:
- Enable - Supplies a boolean enabling or disabling the wakeup timer.
- Time - Supplies an optional pointer to the time to set. This parameter is
- only optional if the enable parameter is FALSE.
- Return Value:
- Status code.
- --*/
- EFI_STATUS
- EfipRk808Shutdown (
- VOID
- );
- /*++
- Routine Description:
- This routine performs a system shutdown using the RK808.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- //
- // Runtime service functions
- //
- EFIAPI
- VOID
- EfipRk32ResetSystem (
- EFI_RESET_TYPE ResetType,
- EFI_STATUS ResetStatus,
- UINTN DataSize,
- VOID *ResetData
- );
- /*++
- Routine Description:
- This routine resets the entire platform.
- Arguments:
- ResetType - Supplies the type of reset to perform.
- ResetStatus - Supplies the status code for this reset.
- DataSize - Supplies the size of the reset data.
- ResetData - Supplies an optional pointer for reset types of cold, warm, or
- shutdown to a null-terminated string, optionally followed by additional
- binary data.
- Return Value:
- None. This routine does not return.
- --*/
- EFIAPI
- EFI_STATUS
- EfipRk32GetTime (
- EFI_TIME *Time,
- EFI_TIME_CAPABILITIES *Capabilities
- );
- /*++
- Routine Description:
- This routine returns the current time and dat information, and
- timekeeping capabilities of the hardware platform.
- Arguments:
- Time - Supplies a pointer where the current time will be returned.
- Capabilities - Supplies an optional pointer where the capabilities will be
- returned on success.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if the time parameter was NULL.
- EFI_DEVICE_ERROR if there was a hardware error accessing the device.
- --*/
- EFIAPI
- EFI_STATUS
- EfipRk32SetTime (
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine sets the current local time and date information.
- Arguments:
- Time - Supplies a pointer to the time to set.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if a time field is out of range.
- EFI_DEVICE_ERROR if there was a hardware error accessing the device.
- --*/
- EFIAPI
- EFI_STATUS
- EfipRk32GetWakeupTime (
- BOOLEAN *Enabled,
- BOOLEAN *Pending,
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine gets the current wake alarm setting.
- Arguments:
- Enabled - Supplies a pointer that receives a boolean indicating if the
- alarm is currently enabled or disabled.
- Pending - Supplies a pointer that receives a boolean indicating if the
- alarm signal is pending and requires acknowledgement.
- Time - Supplies a pointer that receives the current wake time.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if any parameter is NULL.
- EFI_DEVICE_ERROR if there was a hardware error accessing the device.
- EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
- --*/
- EFIAPI
- EFI_STATUS
- EfipRk32SetWakeupTime (
- BOOLEAN Enable,
- EFI_TIME *Time
- );
- /*++
- Routine Description:
- This routine sets the current wake alarm setting.
- Arguments:
- Enable - Supplies a boolean enabling or disabling the wakeup timer.
- Time - Supplies an optional pointer to the time to set. This parameter is
- only optional if the enable parameter is FALSE.
- Return Value:
- EFI_SUCCESS on success.
- EFI_INVALID_PARAMETER if a time field is out of range.
- EFI_DEVICE_ERROR if there was a hardware error accessing the device.
- EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
- --*/
|