123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- /*++
- Copyright (c) 2014 Minoca Corp. All Rights Reserved
- Module Name:
- main.c
- Abstract:
- This module implements the entry point for the UEFI firmware running on top
- of the TI PandaBoard.
- Author:
- Evan Green 27-Feb-2014
- Environment:
- Firmware
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <uefifw.h>
- #include "dev/omap4.h"
- #include "pandafw.h"
- //
- // ---------------------------------------------------------------- Definitions
- //
- #define FIRMWARE_IMAGE_NAME "pandafw.elf"
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // ----------------------------------------------- Internal Function Prototypes
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Variables defined in the linker script that mark the start and end of the
- // image.
- //
- extern INT8 _end;
- extern INT8 __executable_start;
- //
- // Store a pointer to the GPIO register blocks.
- //
- VOID *EfiOmap4Gpio1Address = (VOID *)OMAP4430_GPIO1_BASE;
- VOID *EfiOmap4Gpio2Address = (VOID *)OMAP4430_GPIO2_BASE;
- //
- // Store a boolean used for debugging that disables the watchdog timer.
- //
- BOOLEAN EfiDisableWatchdog = FALSE;
- //
- // ------------------------------------------------------------------ Functions
- //
- VOID
- EfiPandaBoardMain (
- VOID *TopOfStack,
- UINTN StackSize
- )
- /*++
- Routine Description:
- This routine is the C entry point for the firmware.
- Arguments:
- TopOfStack - Supplies the top of the stack that has been set up for the
- loader.
- StackSize - Supplies the total size of the stack set up for the loader, in
- bytes.
- Return Value:
- This routine does not return.
- --*/
- {
- UINTN FirmwareSize;
- //
- // Initialize UEFI enough to get into the debugger.
- //
- FirmwareSize = (UINTN)&_end - (UINTN)&__executable_start;
- EfiCoreMain((VOID *)-1,
- &__executable_start,
- FirmwareSize,
- FIRMWARE_IMAGE_NAME,
- TopOfStack - StackSize,
- StackSize);
- return;
- }
- 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 Status;
- if (Phase == 0) {
- if (EfiDisableWatchdog != FALSE) {
- EfiPlatformSetWatchdogTimer(0, 0, 0, NULL);
- }
- EfipOmap4InitializePowerAndClocks();
- } else if (Phase == 1) {
- EfipOmap4UsbInitialize();
- Status = EfipSmpInitialize();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = EfipPandaCreateSmbiosTables();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
- return EFI_SUCCESS;
- }
- 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 Status;
- Status = EfipPandaEnumerateSd();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- EfipPandaEnumerateVideo();
- EfipPandaEnumerateSerial();
- Status = EfipEnumerateRamDisks();
- if (EFI_ERROR(Status)) {
- return Status;
- }
- return EFI_SUCCESS;
- }
- //
- // --------------------------------------------------------- Internal Functions
- //
|