+++ /dev/null
-\r
-#/** @file\r
-#\r
-# Component description file for Bds module\r
-#\r
-# Copyright (c) 2009, Apple Inc. All rights reserved.<BR>\r
-#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BeagleBoardBds\r
- FILE_GUID = 934431fe-5745-402e-913d-17b4434eb0f3\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
-\r
- ENTRY_POINT = BdsInitialize\r
-\r
-[Sources.common]\r
- BdsEntry.c\r
- FirmwareVolume.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- EmbeddedPkg/EmbeddedPkg.dec\r
-\r
-[LibraryClasses]\r
- DevicePathLib\r
- BaseLib\r
- HobLib\r
- UefiRuntimeServicesTableLib\r
- ReportStatusCodeLib\r
- PerformanceLib\r
- DxeServicesTableLib\r
- MemoryAllocationLib\r
- UefiLib\r
- UefiBootServicesTableLib\r
- BaseMemoryLib\r
- DebugLib\r
- PrintLib\r
- UefiDriverEntryPoint\r
-\r
-[Guids]\r
-\r
-\r
-[Protocols]\r
- gEfiBdsArchProtocolGuid\r
- gEfiSimpleTextInProtocolGuid\r
- gEfiSimpleTextOutProtocolGuid\r
- gEfiSerialIoProtocolGuid\r
- gEfiDevicePathProtocolGuid\r
- gEfiSimpleFileSystemProtocolGuid\r
- gEfiUsbIoProtocolGuid\r
- gEfiFirmwareVolume2ProtocolGuid\r
-\r
-[Depex]\r
- TRUE\r
+++ /dev/null
-/** @file\r
- The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements\r
- of the UEFI specification as it is designed to implement an embedded systmes\r
- propriatary boot scheme.\r
-\r
- This template assume a DXE driver produces a SerialIo protocol not using the EFI\r
- driver module and it will attempt to connect a console on top of this.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "BdsEntry.h"\r
-\r
-\r
-BOOLEAN gConsolePresent = FALSE;\r
-\r
-EFI_BDS_ARCH_PROTOCOL gBdsProtocol = {\r
- BdsEntry,\r
-};\r
-\r
-\r
-\r
-\r
-/**\r
- This function uses policy data from the platform to determine what operating\r
- system or system utility should be loaded and invoked. This function call\r
- also optionally make the use of user input to determine the operating system\r
- or system utility to be loaded and invoked. When the DXE Core has dispatched\r
- all the drivers on the dispatch queue, this function is called. This\r
- function will attempt to connect the boot devices required to load and invoke\r
- the selected operating system or system utility. During this process,\r
- additional firmware volumes may be discovered that may contain addition DXE\r
- drivers that can be dispatched by the DXE Core. If a boot device cannot be\r
- fully connected, this function calls the DXE Service Dispatch() to allow the\r
- DXE drivers from any newly discovered firmware volumes to be dispatched.\r
- Then the boot device connection can be attempted again. If the same boot\r
- device connection operation fails twice in a row, then that boot device has\r
- failed, and should be skipped. This function should never return.\r
-\r
- @param This The EFI_BDS_ARCH_PROTOCOL instance.\r
-\r
- @return None.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BdsEntry (\r
- IN EFI_BDS_ARCH_PROTOCOL *This\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN NoHandles;\r
- EFI_HANDLE *Buffer;\r
- EFI_HANDLE FvHandle;\r
- EFI_HANDLE ImageHandle;\r
- EFI_HANDLE UsbDeviceHandle;\r
- EFI_GUID NameGuid;\r
- UINTN Size;\r
- UINTN HandleCount;\r
- UINTN OldHandleCount;\r
- EFI_HANDLE *HandleBuffer;\r
- UINTN Index;\r
- EFI_DEVICE_PATH_PROTOCOL *LoadImageDevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL *FileSystemDevicePath;\r
-\r
- PERF_END (NULL, "DXE", NULL, 0);\r
- PERF_START (NULL, "BDS", NULL, 0);\r
-\r
-\r
- //\r
- // Now do the EFI stuff\r
- //\r
- Size = 0x100;\r
- gST->FirmwareVendor = AllocateRuntimePool (Size);\r
- ASSERT (gST->FirmwareVendor != NULL);\r
-\r
- UnicodeSPrint (gST->FirmwareVendor, Size, L"BeagleBoard EFI %a %a", __DATE__, __TIME__);\r
-\r
- //\r
- // Now we need to setup the EFI System Table with information about the console devices.\r
- // This code is normally in the console spliter driver on platforms that support multiple\r
- // consoles at the same time\r
- //\r
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextOutProtocolGuid, NULL, &NoHandles, &Buffer);\r
- if (!EFI_ERROR (Status)) {\r
- // Use the first SimpleTextOut we find and update the EFI System Table\r
- gST->ConsoleOutHandle = Buffer[0];\r
- gST->StandardErrorHandle = Buffer[0];\r
- Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextOutProtocolGuid, (VOID **)&gST->ConOut);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- gST->StdErr = gST->ConOut;\r
-\r
- gST->ConOut->OutputString (gST->ConOut, L"BDS: Console Started!!!!\n\r");\r
- FreePool (Buffer);\r
-\r
- gConsolePresent = TRUE;\r
- }\r
-\r
-\r
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleTextInProtocolGuid, NULL, &NoHandles, &Buffer);\r
- if (!EFI_ERROR (Status)) {\r
- // Use the first SimpleTextIn we find and update the EFI System Table\r
- gST->ConsoleInHandle = Buffer[0];\r
- Status = gBS->HandleProtocol (Buffer[0], &gEfiSimpleTextInProtocolGuid, (VOID **)&gST->ConIn);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- FreePool (Buffer);\r
- }\r
-\r
- //\r
- // We now have EFI Consoles up and running. Print () will work now. DEBUG () and ASSERT () worked\r
- // prior to this point as they were configured to use a more primative output scheme.\r
- //\r
-\r
- //\r
- //Perform Connect\r
- //\r
- HandleCount = 0;\r
- while (1) {\r
- OldHandleCount = HandleCount;\r
- Status = gBS->LocateHandleBuffer (\r
- AllHandles,\r
- NULL,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
- if (EFI_ERROR (Status)) {\r
- break;\r
- }\r
-\r
- if (HandleCount == OldHandleCount) {\r
- break;\r
- }\r
-\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);\r
- }\r
- }\r
-\r
- EfiSignalEventReadyToBoot ();\r
-\r
- //Locate handles for SimpleFileSystem protocol\r
- Status = gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiSimpleFileSystemProtocolGuid,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
- if (!EFI_ERROR(Status)) {\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- //Get the device path\r
- FileSystemDevicePath = DevicePathFromHandle(HandleBuffer[Index]);\r
- if (FileSystemDevicePath == NULL) {\r
- continue;\r
- }\r
-\r
- //Check if UsbIo is on any handles in the device path.\r
- Status = gBS->LocateDevicePath(&gEfiUsbIoProtocolGuid, &FileSystemDevicePath, &UsbDeviceHandle);\r
- if (EFI_ERROR(Status)) {\r
- continue;\r
- }\r
-\r
- //Check if Usb stick has a magic EBL file.\r
- LoadImageDevicePath = FileDevicePath(HandleBuffer[Index], L"Ebl.efi");\r
- Status = gBS->LoadImage (TRUE, gImageHandle, LoadImageDevicePath, NULL, 0, &ImageHandle);\r
- if (EFI_ERROR(Status)) {\r
- continue;\r
- }\r
-\r
- //Boot to Shell on USB stick.\r
- Status = gBS->StartImage (ImageHandle, NULL, NULL);\r
- if (EFI_ERROR(Status)) {\r
- continue;\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Normal UEFI behavior is to process Globally Defined Variables as defined in Chapter 3\r
- // (Boot Manager) of the UEFI specification. For this embedded system we don't do this.\r
- //\r
-\r
- //\r
- // Search all the FVs for an application with a UI Section of Ebl. A .FDF file can be used\r
- // to control the names of UI sections in an FV.\r
- //\r
- Status = FindApplicationMatchingUiSection (L"Ebl", &FvHandle, &NameGuid);\r
- if (!EFI_ERROR (Status)) {\r
-\r
- //Boot to Shell.\r
- Status = LoadPeCoffSectionFromFv (FvHandle, &NameGuid);\r
-\r
- if (EFI_ERROR(Status)) {\r
- DEBUG((EFI_D_ERROR, "Boot from Shell failed. Status: %r\n", Status));\r
- }\r
- }\r
-\r
- //\r
- // EFI does not define the behaviour if all boot attemps fail and the last one returns.\r
- // So we make a policy choice to reset the system since this BDS does not have a UI.\r
- //\r
- gRT->ResetSystem (EfiResetShutdown, Status, 0, NULL);\r
-\r
- return ;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BdsInitialize (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Install protocol interface\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &ImageHandle,\r
- &gEfiBdsArchProtocolGuid, &gBdsProtocol,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return Status;\r
-}\r
-\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __BDS_ENTRY_H__\r
-#define __BDS_ENTRY_H__\r
-\r
-#include <PiDxe.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DxeServicesTableLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/HobLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/PerformanceLib.h>\r
-\r
-#include <Protocol/Bds.h>\r
-#include <Protocol/SerialIo.h>\r
-#include <Protocol/FirmwareVolume2.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/SimpleTextOut.h>\r
-#include <Protocol/EmbeddedDevice.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/SimpleFileSystem.h>\r
-#include <Protocol/UsbIo.h>\r
-\r
-\r
-EFI_STATUS\r
-LoadPeCoffSectionFromFv (\r
- IN EFI_HANDLE FvHandle,\r
- IN EFI_GUID *NameGuid\r
- );\r
-\r
-EFI_STATUS\r
-FindApplicationMatchingUiSection (\r
- IN CHAR16 *UiString,\r
- OUT EFI_HANDLE *FvHandle,\r
- OUT EFI_GUID *NameGuid\r
- );\r
-\r
-VOID\r
-EFIAPI\r
-BdsEntry (\r
- IN EFI_BDS_ARCH_PROTOCOL *This\r
- );\r
-\r
-#endif\r
-\r
+++ /dev/null
-/** @file\r
- The entry of the embedded BDS. This BDS does not follow the Boot Manager requirements\r
- of the UEFI specification as it is designed to implement an embedded systmes\r
- propriatary boot scheme.\r
-\r
- This template assume a DXE driver produces a SerialIo protocol not using the EFI\r
- driver module and it will attempt to connect a console on top of this.\r
-\r
-\r
- Copyright (c) 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "BdsEntry.h"\r
-\r
-\r
-EFI_STATUS\r
-FindApplicationMatchingUiSection (\r
- IN CHAR16 *UiString,\r
- OUT EFI_HANDLE *FvHandle,\r
- OUT EFI_GUID *NameGuid\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS NextStatus;\r
- UINTN NoHandles;\r
- EFI_HANDLE *Buffer;\r
- UINTN Index;\r
- EFI_FV_FILETYPE FileType;\r
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
- VOID *Key;\r
- EFI_FV_FILE_ATTRIBUTES Attributes;\r
- UINTN Size;\r
- UINTN UiStringLen;\r
- CHAR16 *UiSection;\r
- UINT32 Authentication;\r
-\r
-\r
- UiStringLen = 0;\r
- if (UiString != NULL) {\r
- DEBUG ((DEBUG_ERROR, "UiString %s\n", UiString));\r
- UiStringLen = StrLen (UiString);\r
- }\r
-\r
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Buffer);\r
- if (!EFI_ERROR (Status)) {\r
- for (Index = 0; Index < NoHandles; Index++) {\r
- Status = gBS->HandleProtocol (Buffer[Index], &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);\r
- if (!EFI_ERROR (Status)) {\r
- Key = AllocatePool (Fv->KeySize);\r
- ASSERT (Key != NULL);\r
- ZeroMem (Key, Fv->KeySize);\r
-\r
- FileType = EFI_FV_FILETYPE_APPLICATION;\r
-\r
- do {\r
- NextStatus = Fv->GetNextFile (Fv, Key, &FileType, NameGuid, &Attributes, &Size);\r
- if (!EFI_ERROR (NextStatus)) {\r
- if (UiString == NULL) {\r
- //\r
- // If UiString is NULL match first application we find.\r
- //\r
- *FvHandle = Buffer[Index];\r
- FreePool (Key);\r
- return Status;\r
- }\r
-\r
- UiSection = NULL;\r
- Status = Fv->ReadSection (\r
- Fv,\r
- NameGuid,\r
- EFI_SECTION_USER_INTERFACE,\r
- 0,\r
- (VOID **)&UiSection,\r
- &Size,\r
- &Authentication\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- if (StrnCmp (UiString, UiSection, UiStringLen) == 0) {\r
- //\r
- // We found a UiString match.\r
- //\r
- *FvHandle = Buffer[Index];\r
- FreePool (Key);\r
- FreePool (UiSection);\r
- return Status;\r
- }\r
- FreePool (UiSection);\r
- }\r
- }\r
- } while (!EFI_ERROR (NextStatus));\r
-\r
- FreePool (Key);\r
- }\r
- }\r
-\r
- FreePool (Buffer);\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-\r
-EFI_DEVICE_PATH *\r
-FvFileDevicePath (\r
- IN EFI_HANDLE FvHandle,\r
- IN EFI_GUID *NameGuid\r
- )\r
-{\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode;\r
-\r
- DevicePath = DevicePathFromHandle (FvHandle);\r
-\r
- EfiInitializeFwVolDevicepathNode (&NewNode, NameGuid);\r
-\r
- return AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&NewNode);\r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-LoadPeCoffSectionFromFv (\r
- IN EFI_HANDLE FvHandle,\r
- IN EFI_GUID *NameGuid\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_HANDLE ImageHandle;\r
-\r
- DevicePath = FvFileDevicePath (FvHandle, NameGuid);\r
-\r
- Status = gBS->LoadImage (TRUE, gImageHandle, DevicePath, NULL, 0, &ImageHandle);\r
- if (!EFI_ERROR (Status)) {\r
- PERF_END (NULL, "BDS", NULL, 0);\r
- Status = gBS->StartImage (ImageHandle, NULL, NULL);\r
- }\r
-\r
- return Status;\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Add custom commands for BeagleBoard development.\r
-\r
- Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/CacheMaintenanceLib.h>\r
-#include <Library/EblCmdLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/EfiFileLib.h>\r
-#include <Library/ArmDisassemblerLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/PerformanceLib.h>\r
-#include <Library/TimerLib.h>\r
-\r
-#include <Guid/DebugImageInfoTable.h>\r
-\r
-#include <Protocol/DebugSupport.h>\r
-#include <Protocol/LoadedImage.h>\r
-\r
-/**\r
- Simple arm disassembler via a library\r
-\r
- Argv[0] - symboltable\r
- Argv[1] - Optional quoted format string\r
- Argv[2] - Optional flag\r
-\r
- @param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line.\r
- Argv[0] is the command name\r
-\r
- @return EFI_SUCCESS\r
-\r
-**/\r
-EFI_STATUS\r
-EblSymbolTable (\r
- IN UINTN Argc,\r
- IN CHAR8 **Argv\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugImageTableHeader = NULL;\r
- EFI_DEBUG_IMAGE_INFO *DebugTable;\r
- UINTN Entry;\r
- CHAR8 *Format;\r
- CHAR8 *Pdb;\r
- UINT32 PeCoffSizeOfHeaders;\r
- UINT32 ImageBase;\r
- BOOLEAN Elf;\r
-\r
- // Need to add lots of error checking on the passed in string\r
- // Default string is for RealView debugger or gdb depending on toolchain used.\r
- if (Argc > 1) {\r
- Format = Argv[1];\r
- } else {\r
-#if __GNUC__\r
- // Assume gdb\r
- Format = "add-symbol-file %a 0x%x";\r
-#else\r
- // Default to RVCT\r
- Format = "load /a /ni /np %a &0x%x";\r
-#endif\r
- }\r
- Elf = (Argc > 2) ? FALSE : TRUE;\r
-\r
- Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&DebugImageTableHeader);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- DebugTable = DebugImageTableHeader->EfiDebugImageInfoTable;\r
- if (DebugTable == NULL) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- for (Entry = 0; Entry < DebugImageTableHeader->TableSize; Entry++, DebugTable++) {\r
- if (DebugTable->NormalImage != NULL) {\r
- if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {\r
- ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;\r
- PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)ImageBase);\r
- Pdb = PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);\r
- if (Pdb != NULL) {\r
- if (Elf) {\r
- // ELF and Mach-O images don't include the header so the linked address does not include header\r
- ImageBase += PeCoffSizeOfHeaders;\r
- }\r
- AsciiPrint (Format, Pdb, ImageBase);\r
- AsciiPrint ("\n");\r
- } else {\r
- }\r
- }\r
- }\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Simple arm disassembler via a library\r
-\r
- Argv[0] - disasm\r
- Argv[1] - Address to start disassembling from\r
- ARgv[2] - Number of instructions to disassembly (optional)\r
-\r
- @param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line.\r
- Argv[0] is the command name\r
-\r
- @return EFI_SUCCESS\r
-\r
-**/\r
-EFI_STATUS\r
-EblDisassembler (\r
- IN UINTN Argc,\r
- IN CHAR8 **Argv\r
- )\r
-{\r
- UINT8 *Ptr, *CurrentAddress;\r
- UINT32 Address;\r
- UINT32 Count;\r
- CHAR8 Buffer[80];\r
- UINT32 ItBlock;\r
-\r
- if (Argc < 2) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Address = AsciiStrHexToUintn (Argv[1]);\r
- Count = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 20;\r
-\r
- Ptr = (UINT8 *)(UINTN)Address;\r
- ItBlock = 0;\r
- do {\r
- CurrentAddress = Ptr;\r
- DisassembleInstruction (&Ptr, TRUE, TRUE, &ItBlock, Buffer, sizeof (Buffer));\r
- AsciiPrint ("0x%08x: %a\n", CurrentAddress, Buffer);\r
- } while (Count-- > 0);\r
-\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-CHAR8 *\r
-ImageHandleToPdbFileName (\r
- IN EFI_HANDLE Handle\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
- CHAR8 *Pdb;\r
- CHAR8 *StripLeading;\r
-\r
- Status = gBS->HandleProtocol (Handle, &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImage);\r
- if (EFI_ERROR (Status)) {\r
- return "";\r
- }\r
-\r
- Pdb = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);\r
- StripLeading = AsciiStrStr (Pdb, "\\ARM\\");\r
- if (StripLeading == NULL) {\r
- StripLeading = AsciiStrStr (Pdb, "/ARM/");\r
- if (StripLeading == NULL) {\r
- return Pdb;\r
- }\r
- }\r
- // Hopefully we hacked off the unneeded part\r
- return (StripLeading + 5);\r
-}\r
-\r
-\r
-CHAR8 *mTokenList[] = {\r
- "SEC",\r
- "PEI",\r
- "DXE",\r
- "BDS",\r
- NULL\r
-};\r
-\r
-/**\r
- Simple arm disassembler via a library\r
-\r
- Argv[0] - disasm\r
- Argv[1] - Address to start disassembling from\r
- ARgv[2] - Number of instructions to disassembly (optional)\r
-\r
- @param Argc Number of command arguments in Argv\r
- @param Argv Array of strings that represent the parsed command line.\r
- Argv[0] is the command name\r
-\r
- @return EFI_SUCCESS\r
-\r
-**/\r
-EFI_STATUS\r
-EblPerformance (\r
- IN UINTN Argc,\r
- IN CHAR8 **Argv\r
- )\r
-{\r
- UINTN Key;\r
- CONST VOID *Handle;\r
- CONST CHAR8 *Token, *Module;\r
- UINT64 Start, Stop, TimeStamp;\r
- UINT64 Delta, TicksPerSecond, Milliseconds, Microseconds;\r
- UINTN Index;\r
-\r
- TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);\r
-\r
- Key = 0;\r
- do {\r
- Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);\r
- if (Key != 0) {\r
- if (AsciiStriCmp ("StartImage:", Token) == 0) {\r
- if (Stop == 0) {\r
- // The entry for EBL is still running so the stop time will be zero. Skip it\r
- AsciiPrint (" running %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
- } else {\r
- Delta = Stop - Start;\r
- Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);\r
- AsciiPrint ("%10ld us %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
- }\r
- }\r
- }\r
- } while (Key != 0);\r
-\r
- AsciiPrint ("\n");\r
-\r
- TimeStamp = 0;\r
- Key = 0;\r
- do {\r
- Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);\r
- if (Key != 0) {\r
- for (Index = 0; mTokenList[Index] != NULL; Index++) {\r
- if (AsciiStriCmp (mTokenList[Index], Token) == 0) {\r
- Delta = Stop - Start;\r
- TimeStamp += Delta;\r
- Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);\r
- AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);\r
- break;\r
- }\r
- }\r
- }\r
- } while (Key != 0);\r
-\r
- AsciiPrint ("Total Time = %ld ms\n\n", DivU64x64Remainder (MultU64x32 (TimeStamp, 1000), TicksPerSecond, NULL));\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =\r
-{\r
- {\r
- "disasm address [count]",\r
- " disassemble count instructions",\r
- NULL,\r
- EblDisassembler\r
- },\r
- {\r
- "performance",\r
- " Display boot performance info",\r
- NULL,\r
- EblPerformance\r
- },\r
- {\r
- "symboltable [\"format string\"] [PECOFF]",\r
- " show symbol table commands for debugger",\r
- NULL,\r
- EblSymbolTable\r
- }\r
-};\r
-\r
-\r
-VOID\r
-EblInitializeExternalCmd (\r
- VOID\r
- )\r
-{\r
- EblAddCommands (mLibCmdTemplate, sizeof (mLibCmdTemplate)/sizeof (EBL_COMMAND_TABLE));\r
- return;\r
-}\r
+++ /dev/null
-#/** @file\r
-# Component description file for the entry point to a EFIDXE Drivers\r
-#\r
-# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification\r
-# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>\r
-#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BeagleBoardEblCmdLib\r
- FILE_GUID = ea62bdc3-1063-425f-8851-98cb47f213a8\r
- MODULE_TYPE = UEFI_DRIVER\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = EblCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
-\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
- EblCmdLib.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- EmbeddedPkg/EmbeddedPkg.dec\r
- ArmPkg/ArmPkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- DebugLib\r
- ArmDisassemblerLib\r
- PerformanceLib\r
- TimerLib\r
-\r
-[Protocols]\r
- gEfiDebugSupportProtocolGuid\r
- gEfiLoadedImageProtocolGuid\r
-\r
-[Guids]\r
- gEfiDebugImageInfoTableGuid\r
+++ /dev/null
-/** @file\r
- Basic serial IO abstaction for GDB\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <Library/GdbSerialLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/OmapLib.h>\r
-#include <Omap3530/Omap3530.h>\r
-\r
-RETURN_STATUS\r
-EFIAPI\r
-GdbSerialLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- return RETURN_SUCCESS;\r
-}\r
-\r
-RETURN_STATUS\r
-EFIAPI\r
-GdbSerialInit (\r
- IN UINT64 BaudRate,\r
- IN UINT8 Parity,\r
- IN UINT8 DataBits,\r
- IN UINT8 StopBits\r
- )\r
-{\r
- return RETURN_SUCCESS;\r
-}\r
-\r
-BOOLEAN\r
-EFIAPI\r
-GdbIsCharAvailable (\r
- VOID\r
- )\r
-{\r
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;\r
-\r
- if ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_NOT_EMPTY) {\r
- return TRUE;\r
- } else {\r
- return FALSE;\r
- }\r
-}\r
-\r
-CHAR8\r
-EFIAPI\r
-GdbGetChar (\r
- VOID\r
- )\r
-{\r
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;\r
- UINT32 RBR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_RBR_REG;\r
- CHAR8 Char;\r
-\r
- while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY);\r
- Char = MmioRead8(RBR);\r
-\r
- return Char;\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-GdbPutChar (\r
- IN CHAR8 Char\r
- )\r
-{\r
- UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;\r
- UINT32 THR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_THR_REG;\r
-\r
- while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY);\r
- MmioWrite8(THR, Char);\r
-}\r
-\r
-VOID\r
-GdbPutString (\r
- IN CHAR8 *String\r
- )\r
-{\r
- while (*String != '\0') {\r
- GdbPutChar (*String);\r
- String++;\r
- }\r
-}\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#/** @file\r
-#\r
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = GdbSerialLib\r
- FILE_GUID = E2423349-EF5D-439B-95F5-8B8D8E3B443F\r
- MODULE_TYPE = UEFI_DRIVER\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = GdbSerialLib\r
-\r
- CONSTRUCTOR = GdbSerialLibConstructor\r
-\r
-\r
-[Sources.common]\r
- GdbSerialLib.c\r
-\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- EmbeddedPkg/EmbeddedPkg.dec\r
- Omap35xxPkg/Omap35xxPkg.dec\r
-\r
-[LibraryClasses]\r
- DebugLib\r
- IoLib\r
- OmapLib\r
-\r
-[FixedPcd]\r
- gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart\r
-\r
+++ /dev/null
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-.text\r
-.align 3\r
-\r
-.globl ASM_PFX(CEntryPoint)\r
-GCC_ASM_EXPORT(_ModuleEntryPoint)\r
-\r
-ASM_PFX(_ModuleEntryPoint):\r
-\r
- //Disable L2 cache\r
- mrc p15, 0, r0, c1, c0, 1 // read Auxiliary Control Register\r
- bic r0, r0, #0x00000002 // disable L2 cache\r
- mcr p15, 0, r0, c1, c0, 1 // store Auxiliary Control Register\r
-\r
- //Enable Strict alignment checking & Instruction cache\r
- mrc p15, 0, r0, c1, c0, 0\r
- bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */\r
- bic r0, r0, #0x00000005 /* clear bits 0, 2 (---- -C-M) */\r
- orr r0, r0, #0x00000002 /* set bit 1 (A) Align */\r
- orr r0, r0, #0x00001000 /* set bit 12 (I) enable I-Cache */\r
- mcr p15, 0, r0, c1, c0, 0\r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- mcr p10,#0x7,r0,c8,c0,#0 // msr FPEXC,r0 in ARM assembly\r
-\r
-\r
- // Set CPU vectors to start of DRAM\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- // Fill vector table with branchs to current pc (jmp $)\r
- ldr r1, ShouldNeverGetHere\r
- movs r2, #0\r
-FillVectors:\r
- str r1, [r0, r2]\r
- adds r2, r2, #4\r
- cmp r2, #32\r
- bne FillVectors\r
-\r
- /* before we call C code, lets setup the stack pointer in internal RAM */\r
-stack_pointer_setup:\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work\r
- // when it runs from FLASH.\r
- //\r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) /* stack base arg2 */\r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) /* stack size arg3 */\r
- add r4, r2, r3\r
-\r
- //Enter SVC mode and set up SVC stack pointer\r
- mov r0,#0x13|0x80|0x40\r
- msr CPSR_c,r0\r
- mov r13,r4\r
-\r
- // Call C entry point\r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) /* memory size arg1 */\r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) /* memory size arg0 */\r
- blx ASM_PFX(CEntryPoint) /* Assume C code is thumb */\r
-\r
-ShouldNeverGetHere:\r
- /* _CEntryPoint should never return */\r
- b ShouldNeverGetHere\r
-\r
+++ /dev/null
-//------------------------------------------------------------------------------\r
-//\r
-// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-//\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-//------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
- INCLUDE AsmMacroIoLib.inc\r
-\r
- IMPORT CEntryPoint\r
- EXPORT _ModuleEntryPoint\r
-\r
- PRESERVE8\r
- AREA ModuleEntryPoint, CODE, READONLY\r
-\r
-\r
-_ModuleEntryPoint\r
-\r
- //Disable L2 cache\r
- mrc p15, 0, r0, c1, c0, 1 // read Auxiliary Control Register\r
- bic r0, r0, #0x00000002 // disable L2 cache\r
- mcr p15, 0, r0, c1, c0, 1 // store Auxiliary Control Register\r
-\r
- //Enable Strict alignment checking & Instruction cache\r
- mrc p15, 0, r0, c1, c0, 0\r
- bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */\r
- bic r0, r0, #0x00000005 /* clear bits 0, 2 (---- -C-M) */\r
- orr r0, r0, #0x00000002 /* set bit 1 (A) Align */\r
- orr r0, r0, #0x00001000 /* set bit 12 (I) enable I-Cache */\r
- mcr p15, 0, r0, c1, c0, 0\r
-\r
- // Enable NEON register in case folks want to use them for optimizations (CopyMem)\r
- mrc p15, 0, r0, c1, c0, 2\r
- orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)\r
- mcr p15, 0, r0, c1, c0, 2\r
- mov r0, #0x40000000 // Set EN bit in FPEXC\r
- msr FPEXC,r0\r
-\r
- // Set CPU vectors to start of DRAM\r
- LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base\r
- mcr p15, 0, r0, c12, c0, 0\r
- isb // Sync changes to control registers\r
-\r
- // Fill vector table with branchs to current pc (jmp $)\r
- ldr r1, ShouldNeverGetHere\r
- movs r2, #0\r
-FillVectors\r
- str r1, [r0, r2]\r
- adds r2, r2, #4\r
- cmp r2, #32\r
- bne FillVectors\r
-\r
- /* before we call C code, lets setup the stack pointer in internal RAM */\r
-stack_pointer_setup\r
-\r
- //\r
- // Set stack based on PCD values. Need to do it this way to make C code work\r
- // when it runs from FLASH.\r
- //\r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2\r
- LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3\r
- add r4, r2, r3\r
-\r
- //Enter SVC mode and set up SVC stack pointer\r
- mov r5,#0x13|0x80|0x40\r
- msr CPSR_c,r5\r
- mov r13,r4\r
-\r
- // Call C entry point\r
- LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1\r
- LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory start arg0\r
- blx CEntryPoint // Assume C code is thumb\r
-\r
-ShouldNeverGetHere\r
- /* _CEntryPoint should never return */\r
- b ShouldNeverGetHere\r
-\r
- END\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Library/ArmLib.h>\r
-#include <Library/PrePiLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-// DDR attributes\r
-#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK\r
-#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED\r
-\r
-// SoC registers. L3 interconnects\r
-#define SOC_REGISTERS_L3_PHYSICAL_BASE 0x68000000\r
-#define SOC_REGISTERS_L3_PHYSICAL_LENGTH 0x08000000\r
-#define SOC_REGISTERS_L3_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE\r
-\r
-// SoC registers. L4 interconnects\r
-#define SOC_REGISTERS_L4_PHYSICAL_BASE 0x48000000\r
-#define SOC_REGISTERS_L4_PHYSICAL_LENGTH 0x08000000\r
-#define SOC_REGISTERS_L4_ATTRIBUTES ARM_MEMORY_REGION_ATTRIBUTE_DEVICE\r
-\r
-VOID\r
-InitCache (\r
- IN UINT32 MemoryBase,\r
- IN UINT32 MemoryLength\r
- )\r
-{\r
- UINT32 CacheAttributes;\r
- ARM_MEMORY_REGION_DESCRIPTOR MemoryTable[5];\r
- VOID *TranslationTableBase;\r
- UINTN TranslationTableSize;\r
-\r
- if (FeaturePcdGet(PcdCacheEnable) == TRUE) {\r
- CacheAttributes = DDR_ATTRIBUTES_CACHED;\r
- } else {\r
- CacheAttributes = DDR_ATTRIBUTES_UNCACHED;\r
- }\r
-\r
- // DDR\r
- MemoryTable[0].PhysicalBase = MemoryBase;\r
- MemoryTable[0].VirtualBase = MemoryBase;\r
- MemoryTable[0].Length = MemoryLength;\r
- MemoryTable[0].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;\r
-\r
- // SOC Registers. L3 interconnects\r
- MemoryTable[1].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE;\r
- MemoryTable[1].VirtualBase = SOC_REGISTERS_L3_PHYSICAL_BASE;\r
- MemoryTable[1].Length = SOC_REGISTERS_L3_PHYSICAL_LENGTH;\r
- MemoryTable[1].Attributes = SOC_REGISTERS_L3_ATTRIBUTES;\r
-\r
- // SOC Registers. L4 interconnects\r
- MemoryTable[2].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE;\r
- MemoryTable[2].VirtualBase = SOC_REGISTERS_L4_PHYSICAL_BASE;\r
- MemoryTable[2].Length = SOC_REGISTERS_L4_PHYSICAL_LENGTH;\r
- MemoryTable[2].Attributes = SOC_REGISTERS_L4_ATTRIBUTES;\r
-\r
- // End of Table\r
- MemoryTable[3].PhysicalBase = 0;\r
- MemoryTable[3].VirtualBase = 0;\r
- MemoryTable[3].Length = 0;\r
- MemoryTable[3].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;\r
-\r
- ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);\r
-\r
- BuildMemoryAllocationHob((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData);\r
-}\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/IoLib.h>\r
-#include <Library/DebugLib.h>\r
-\r
-#include <Omap3530/Omap3530.h>\r
-\r
-VOID\r
-ClockInit (\r
- VOID\r
- )\r
-{\r
- //DPLL1 - DPLL4 are configured part of Configuration header which OMAP3 ROM parses.\r
-\r
- // Enable PLL5 and set to 120 MHz as a reference clock.\r
- MmioWrite32 (CM_CLKSEL4_PLL, CM_CLKSEL_PLL_MULT(120) | CM_CLKSEL_PLL_DIV(13));\r
- MmioWrite32 (CM_CLKSEL5_PLL, CM_CLKSEL_DIV_120M(1));\r
- MmioWrite32 (CM_CLKEN2_PLL, CM_CLKEN_FREQSEL_075_100 | CM_CLKEN_ENABLE);\r
-\r
- // Turn on functional & interface clocks to the USBHOST power domain\r
- MmioOr32(CM_FCLKEN_USBHOST, CM_FCLKEN_USBHOST_EN_USBHOST2_ENABLE\r
- | CM_FCLKEN_USBHOST_EN_USBHOST1_ENABLE);\r
- MmioOr32(CM_ICLKEN_USBHOST, CM_ICLKEN_USBHOST_EN_USBHOST_ENABLE);\r
-\r
- // Turn on functional & interface clocks to the USBTLL block.\r
- MmioOr32(CM_FCLKEN3_CORE, CM_FCLKEN3_CORE_EN_USBTLL_ENABLE);\r
- MmioOr32(CM_ICLKEN3_CORE, CM_ICLKEN3_CORE_EN_USBTLL_ENABLE);\r
-\r
- // Turn on functional & interface clocks to MMC1 and I2C1 modules.\r
- MmioOr32(CM_FCLKEN1_CORE, CM_FCLKEN1_CORE_EN_MMC1_ENABLE\r
- | CM_FCLKEN1_CORE_EN_I2C1_ENABLE);\r
- MmioOr32(CM_ICLKEN1_CORE, CM_ICLKEN1_CORE_EN_MMC1_ENABLE\r
- | CM_ICLKEN1_CORE_EN_I2C1_ENABLE);\r
-\r
- // Turn on functional & interface clocks to various Peripherals.\r
- MmioOr32(CM_FCLKEN_PER, CM_FCLKEN_PER_EN_UART3_ENABLE\r
- | CM_FCLKEN_PER_EN_GPT3_ENABLE\r
- | CM_FCLKEN_PER_EN_GPT4_ENABLE\r
- | CM_FCLKEN_PER_EN_GPIO2_ENABLE\r
- | CM_FCLKEN_PER_EN_GPIO3_ENABLE\r
- | CM_FCLKEN_PER_EN_GPIO4_ENABLE\r
- | CM_FCLKEN_PER_EN_GPIO5_ENABLE\r
- | CM_FCLKEN_PER_EN_GPIO6_ENABLE);\r
- MmioOr32(CM_ICLKEN_PER, CM_ICLKEN_PER_EN_UART3_ENABLE\r
- | CM_ICLKEN_PER_EN_GPT3_ENABLE\r
- | CM_ICLKEN_PER_EN_GPT4_ENABLE\r
- | CM_ICLKEN_PER_EN_GPIO2_ENABLE\r
- | CM_ICLKEN_PER_EN_GPIO3_ENABLE\r
- | CM_ICLKEN_PER_EN_GPIO4_ENABLE\r
- | CM_ICLKEN_PER_EN_GPIO5_ENABLE\r
- | CM_ICLKEN_PER_EN_GPIO6_ENABLE);\r
-\r
- // Turn on functional & inteface clocks to various wakeup modules.\r
- MmioOr32(CM_FCLKEN_WKUP, CM_FCLKEN_WKUP_EN_GPIO1_ENABLE\r
- | CM_FCLKEN_WKUP_EN_WDT2_ENABLE);\r
- MmioOr32(CM_ICLKEN_WKUP, CM_ICLKEN_WKUP_EN_GPIO1_ENABLE\r
- | CM_ICLKEN_WKUP_EN_WDT2_ENABLE);\r
-}\r
+++ /dev/null
-/** @file\r
- LZMA Decompress Library header file\r
-\r
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __LZMA_DECOMPRESS_H___\r
-#define __LZMA_DECOMPRESS_H___\r
-\r
-/**\r
- Examines a GUIDed section and returns the size of the decoded buffer and the\r
- size of an scratch buffer required to actually decode the data in a GUIDed section.\r
-\r
- Examines a GUIDed section specified by InputSection.\r
- If GUID for InputSection does not match the GUID that this handler supports,\r
- then RETURN_UNSUPPORTED is returned.\r
- If the required information can not be retrieved from InputSection,\r
- then RETURN_INVALID_PARAMETER is returned.\r
- If the GUID of InputSection does match the GUID that this handler supports,\r
- then the size required to hold the decoded buffer is returned in OututBufferSize,\r
- the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field\r
- from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.\r
-\r
- If InputSection is NULL, then ASSERT().\r
- If OutputBufferSize is NULL, then ASSERT().\r
- If ScratchBufferSize is NULL, then ASSERT().\r
- If SectionAttribute is NULL, then ASSERT().\r
-\r
-\r
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
- @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required\r
- if the buffer specified by InputSection were decoded.\r
- @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space\r
- if the buffer specified by InputSection were decoded.\r
- @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes\r
- field of EFI_GUID_DEFINED_SECTION in the PI Specification.\r
-\r
- @retval RETURN_SUCCESS The information about InputSection was returned.\r
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
- @retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-LzmaGuidedSectionGetInfo (\r
- IN CONST VOID *InputSection,\r
- OUT UINT32 *OutputBufferSize,\r
- OUT UINT32 *ScratchBufferSize,\r
- OUT UINT16 *SectionAttribute\r
- );\r
-\r
-/**\r
- Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.\r
-\r
- Decodes the GUIDed section specified by InputSection.\r
- If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.\r
- If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.\r
- If the GUID of InputSection does match the GUID that this handler supports, then InputSection\r
- is decoded into the buffer specified by OutputBuffer and the authentication status of this\r
- decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the\r
- data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise,\r
- the decoded data will be placed in caller allocated buffer specified by OutputBuffer.\r
-\r
- If InputSection is NULL, then ASSERT().\r
- If OutputBuffer is NULL, then ASSERT().\r
- If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().\r
- If AuthenticationStatus is NULL, then ASSERT().\r
-\r
-\r
- @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
- @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation.\r
- @param[out] ScratchBuffer A caller allocated buffer that may be required by this function\r
- as a scratch buffer to perform the decode operation.\r
- @param[out] AuthenticationStatus\r
- A pointer to the authentication status of the decoded output buffer.\r
- See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI\r
- section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must\r
- never be set by this handler.\r
-\r
- @retval RETURN_SUCCESS The buffer specified by InputSection was decoded.\r
- @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
- @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-LzmaGuidedSectionExtraction (\r
- IN CONST VOID *InputSection,\r
- OUT VOID **OutputBuffer,\r
- OUT VOID *ScratchBuffer, OPTIONAL\r
- OUT UINT32 *AuthenticationStatus\r
- );\r
-\r
-#endif // __LZMADECOMPRESS_H__\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Omap3530/Omap3530.h>\r
-\r
-#define NUM_PINS 238\r
-\r
-PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = {\r
- //Pin, MuxMode, PullConfig, InputEnable\r
- { SDRC_D0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D2, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D3, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D4, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D5, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D6, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D7, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D8, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D9, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D10, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D11, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D12, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D13, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D14, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D15, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D16, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D17, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D18, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D19, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D20, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D21, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D22, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D23, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D24, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D25, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D26, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D27, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D28, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D29, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D30, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_D31, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_CLK, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_DQS0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_CKE0, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { SDRC_CKE1, MUXMODE7, PULL_DISABLED, INPUT },\r
- { SDRC_DQS1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_DQS2, MUXMODE0, PULL_DISABLED, INPUT },\r
- { SDRC_DQS3, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_A1, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A2, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A3, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A4, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A5, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A6, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A7, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A8, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A9, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_A10, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_D0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D2, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D3, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D4, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D5, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D6, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D7, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D8, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D9, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D10, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D11, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D12, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D13, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D14, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_D15, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NCS0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NCS1, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { GPMC_NCS2, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { GPMC_NCS3, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { GPMC_NCS4, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { GPMC_NCS5, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_NCS6, MUXMODE1, PULL_DISABLED, INPUT },\r
- { GPMC_NCS7, MUXMODE1, PULL_UP_SELECTED, INPUT },\r
- { GPMC_CLK, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_NADV_ALE, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NOE, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NWE, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NBE0_CLE, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { GPMC_NBE1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_NWP, MUXMODE0, PULL_DISABLED, INPUT },\r
- { GPMC_WAIT0, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { GPMC_WAIT1, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { GPMC_WAIT2, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { GPMC_WAIT3, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { DSS_PCLK, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_HSYNC, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_PSYNC, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_ACBIAS, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA0, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA1, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA2, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA3, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA4, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA5, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA6, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA7, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA8, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA9, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA10, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA11, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA12, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA13, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA14, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA15, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA16, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA17, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA18, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA19, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA20, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA21, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA22, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { DSS_DATA23, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { CAM_HS, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { CAM_VS, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { CAM_XCLKA, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { CAM_PCLK, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { CAM_FLD, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { CAM_D0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D2, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D3, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D4, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D5, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D6, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D7, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D8, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D9, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D10, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_D11, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CAM_XCLKB, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { CAM_WEN, MUXMODE4, PULL_DISABLED, INPUT },\r
- { CAM_STROBE, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { CSI2_DX0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CSI2_DY0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CSI2_DX1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { CSI2_DY1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCBSP2_FSX, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCBSP2_CLKX, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCBSP2_DR, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCBSP2_DX, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { MMC1_CLK, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { MMC1_CMD, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT0, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT1, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT2, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT3, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT4, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT5, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT6, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC1_DAT7, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MMC2_CLK, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_CMD, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT0, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT1, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT2, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT3, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT4, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT5, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT6, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MMC2_DAT7, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MCBSP3_DX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP3_DR, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP3_CLKX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP3_FSX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { UART2_CTS, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { UART2_RTS, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { UART2_TX, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { UART2_RX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { UART1_TX, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { UART1_RTS, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { UART1_CTS, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { UART1_RX, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCBSP4_CLKX, MUXMODE1, PULL_DISABLED, INPUT },\r
- { MCBSP4_DR, MUXMODE1, PULL_DISABLED, INPUT },\r
- { MCBSP4_DX, MUXMODE1, PULL_DISABLED, INPUT },\r
- { MCBSP4_FSX, MUXMODE1, PULL_DISABLED, INPUT },\r
- { MCBSP1_CLKR, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP1_FSR, MUXMODE4, PULL_UP_SELECTED, OUTPUT },\r
- { MCBSP1_DX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP1_DR, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP1_CLKS, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MCBSP1_FSX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCBSP1_CLKX, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { UART3_CTS_RCTX,MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { UART3_RTS_SD, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { UART3_RX_IRRX, MUXMODE0, PULL_DISABLED, INPUT },\r
- { UART3_TX_IRTX, MUXMODE0, PULL_DISABLED, OUTPUT },\r
- { HSUSB0_CLK, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_STP, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { HSUSB0_DIR, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_NXT, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA0, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA1, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA2, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA3, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA4, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA5, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA6, MUXMODE0, PULL_DISABLED, INPUT },\r
- { HSUSB0_DATA7, MUXMODE0, PULL_DISABLED, INPUT },\r
- { I2C1_SCL, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { I2C1_SDA, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { I2C2_SCL, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { I2C2_SDA, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { I2C3_SCL, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { I2C3_SDA, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { HDQ_SIO, MUXMODE4, PULL_UP_SELECTED, OUTPUT },\r
- { MCSPI1_CLK, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MCSPI1_SIMO, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { MCSPI1_SOMI, MUXMODE0, PULL_DISABLED, INPUT },\r
- { MCSPI1_CS0, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { MCSPI1_CS1, MUXMODE0, PULL_UP_SELECTED, OUTPUT },\r
- { MCSPI1_CS2, MUXMODE4, PULL_DISABLED, OUTPUT },\r
- { MCSPI1_CS3, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { MCSPI2_CLK, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { MCSPI2_SIMO, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { MCSPI2_SOMI, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { MCSPI2_CS0, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { MCSPI2_CS1, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { SYS_NIRQ, MUXMODE0, PULL_UP_SELECTED, INPUT },\r
- { SYS_CLKOUT2, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { ETK_CLK, MUXMODE3, PULL_UP_SELECTED, OUTPUT },\r
- { ETK_CTL, MUXMODE3, PULL_UP_SELECTED, OUTPUT },\r
- { ETK_D0, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D1, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D2, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D3, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D4, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D5, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D6, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D7, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D8, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D9, MUXMODE4, PULL_UP_SELECTED, INPUT },\r
- { ETK_D10, MUXMODE3, PULL_UP_SELECTED, OUTPUT },\r
- { ETK_D11, MUXMODE3, PULL_UP_SELECTED, OUTPUT },\r
- { ETK_D12, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D13, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D14, MUXMODE3, PULL_UP_SELECTED, INPUT },\r
- { ETK_D15, MUXMODE3, PULL_UP_SELECTED, INPUT }\r
-};\r
-\r
-VOID\r
-PadConfiguration (\r
- VOID\r
- )\r
-{\r
- UINTN Index;\r
- UINT16 PadConfiguration;\r
- UINTN NumPinsToConfigure = sizeof(PadConfigurationTable)/sizeof(PAD_CONFIGURATION);\r
-\r
- for (Index = 0; Index < NumPinsToConfigure; Index++) {\r
- //Set up Pad configuration for particular pin.\r
- PadConfiguration = (PadConfigurationTable[Index].MuxMode << MUXMODE_OFFSET);\r
- PadConfiguration |= (PadConfigurationTable[Index].PullConfig << PULL_CONFIG_OFFSET);\r
- PadConfiguration |= (PadConfigurationTable[Index].InputEnable << INPUTENABLE_OFFSET);\r
-\r
- //Configure the pin with specific Pad configuration.\r
- MmioWrite16(PadConfigurationTable[Index].Pin, PadConfiguration);\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- C Entry point for the SEC. First C code after the reset vector.\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/PrePiLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/OmapLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/DebugAgentLib.h>\r
-\r
-#include <Ppi/GuidedSectionExtraction.h>\r
-#include <Guid/LzmaDecompress.h>\r
-#include <Omap3530/Omap3530.h>\r
-\r
-#include "LzmaDecompress.h"\r
-\r
-VOID\r
-PadConfiguration (\r
- VOID\r
- );\r
-\r
-VOID\r
-ClockInit (\r
- VOID\r
- );\r
-\r
-\r
-VOID\r
-TimerInit (\r
- VOID\r
- )\r
-{\r
- UINTN Timer = FixedPcdGet32(PcdOmap35xxFreeTimer);\r
- UINT32 TimerBaseAddress = TimerBase(Timer);\r
-\r
- // Set source clock for GPT3 & GPT4 to SYS_CLK\r
- MmioOr32 (CM_CLKSEL_PER, CM_CLKSEL_PER_CLKSEL_GPT3_SYS | CM_CLKSEL_PER_CLKSEL_GPT4_SYS);\r
-\r
- // Set count & reload registers\r
- MmioWrite32 (TimerBaseAddress + GPTIMER_TCRR, 0x00000000);\r
- MmioWrite32 (TimerBaseAddress + GPTIMER_TLDR, 0x00000000);\r
-\r
- // Disable interrupts\r
- MmioWrite32 (TimerBaseAddress + GPTIMER_TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_DISABLE | TIER_MAT_IT_DISABLE);\r
-\r
- // Start Timer\r
- MmioWrite32 (TimerBaseAddress + GPTIMER_TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);\r
-\r
- //Disable OMAP Watchdog timer (WDT2)\r
- MmioWrite32 (WDTIMER2_BASE + WSPR, 0xAAAA);\r
- DEBUG ((EFI_D_ERROR, "Magic delay to disable watchdog timers properly.\n"));\r
- MmioWrite32 (WDTIMER2_BASE + WSPR, 0x5555);\r
-}\r
-\r
-VOID\r
-UartInit (\r
- VOID\r
- )\r
-{\r
- UINTN Uart = FixedPcdGet32(PcdOmap35xxConsoleUart);\r
- UINT32 UartBaseAddress = UartBase(Uart);\r
-\r
- // Set MODE_SELECT=DISABLE before trying to initialize or modify DLL, DLH registers.\r
- MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_DISABLE);\r
-\r
- // Put device in configuration mode.\r
- MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_ENABLE);\r
-\r
- // Programmable divisor N = 48Mhz/16/115200 = 26\r
- MmioWrite32 (UartBaseAddress + UART_DLL_REG, 3000000/FixedPcdGet64 (PcdUartDefaultBaudRate)); // low divisor\r
- MmioWrite32 (UartBaseAddress + UART_DLH_REG, 0); // high divisor\r
-\r
- // Enter into UART operational mode.\r
- MmioWrite32 (UartBaseAddress + UART_LCR_REG, UART_LCR_DIV_EN_DISABLE | UART_LCR_CHAR_LENGTH_8);\r
-\r
- // Force DTR and RTS output to active\r
- MmioWrite32 (UartBaseAddress + UART_MCR_REG, UART_MCR_RTS_FORCE_ACTIVE | UART_MCR_DTR_FORCE_ACTIVE);\r
-\r
- // Clear & enable fifos\r
- MmioWrite32 (UartBaseAddress + UART_FCR_REG, UART_FCR_TX_FIFO_CLEAR | UART_FCR_RX_FIFO_CLEAR | UART_FCR_FIFO_ENABLE);\r
-\r
- // Restore MODE_SELECT\r
- MmioWrite32 (UartBaseAddress + UART_MDR1_REG, UART_MDR1_MODE_SELECT_UART_16X);\r
-}\r
-\r
-VOID\r
-InitCache (\r
- IN UINT32 MemoryBase,\r
- IN UINT32 MemoryLength\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-ExtractGuidedSectionLibConstructor (\r
- VOID\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-LzmaDecompressLibConstructor (\r
- VOID\r
- );\r
-\r
-\r
-VOID\r
-CEntryPoint (\r
- IN VOID *MemoryBase,\r
- IN UINTN MemorySize,\r
- IN VOID *StackBase,\r
- IN UINTN StackSize\r
- )\r
-{\r
- VOID *HobBase;\r
-\r
- // Build a basic HOB list\r
- HobBase = (VOID *)(UINTN)(FixedPcdGet32(PcdEmbeddedFdBaseAddress) + FixedPcdGet32(PcdEmbeddedFdSize));\r
- CreateHobList (MemoryBase, MemorySize, HobBase, StackBase);\r
-\r
- //Set up Pin muxing.\r
- PadConfiguration ();\r
-\r
- // Set up system clocking\r
- ClockInit ();\r
-\r
-\r
- // Enable program flow prediction, if supported.\r
- ArmEnableBranchPrediction ();\r
-\r
- // Initialize CPU cache\r
- InitCache ((UINT32)MemoryBase, (UINT32)MemorySize);\r
-\r
- // Add memory allocation hob for relocated FD\r
- BuildMemoryAllocationHob (FixedPcdGet32(PcdEmbeddedFdBaseAddress), FixedPcdGet32(PcdEmbeddedFdSize), EfiBootServicesData);\r
-\r
- // Add the FVs to the hob list\r
- BuildFvHob (PcdGet32(PcdFlashFvMainBase), PcdGet32(PcdFlashFvMainSize));\r
-\r
- // Start talking\r
- UartInit ();\r
-\r
- InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, NULL, NULL);\r
- SaveAndSetDebugTimerInterrupt (TRUE);\r
-\r
- DEBUG ((EFI_D_ERROR, "UART Enabled\n"));\r
-\r
- // Start up a free running timer so that the timer lib will work\r
- TimerInit ();\r
-\r
- // SEC phase needs to run library constructors by hand.\r
- ExtractGuidedSectionLibConstructor ();\r
- LzmaDecompressLibConstructor ();\r
-\r
- // Build HOBs to pass up our version of stuff the DXE Core needs to save space\r
- BuildPeCoffLoaderHob ();\r
- BuildExtractSectionHob (\r
- &gLzmaCustomDecompressGuid,\r
- LzmaGuidedSectionGetInfo,\r
- LzmaGuidedSectionExtraction\r
- );\r
-\r
- // Assume the FV that contains the SEC (our code) also contains a compressed FV.\r
- DecompressFirstFv ();\r
-\r
- // Load the DXE Core and transfer control to it\r
- LoadDxeCoreFromFv (NULL, 0);\r
-\r
- // DXE Core should always load and never return\r
- ASSERT (FALSE);\r
-}\r
-\r
+++ /dev/null
-\r
-#/** @file\r
-# SEC - Reset vector code that jumps to C and loads DXE core\r
-#\r
-# Copyright (c) 2008, Apple Inc. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BeagleBoardSec\r
- FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8\r
- MODULE_TYPE = SEC\r
- VERSION_STRING = 1.0\r
-\r
-\r
-[Sources.ARM]\r
- Arm/ModuleEntryPoint.S | GCC\r
- Arm/ModuleEntryPoint.asm | RVCT\r
-\r
-[Sources.ARM]\r
- Sec.c\r
- Cache.c\r
- PadConfiguration.c\r
- Clock.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- EmbeddedPkg/EmbeddedPkg.dec\r
- ArmPkg/ArmPkg.dec\r
- Omap35xxPkg/Omap35xxPkg.dec\r
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- DebugLib\r
- ArmLib\r
- IoLib\r
- ExtractGuidedSectionLib\r
- LzmaDecompressLib\r
- OmapLib\r
- PeCoffGetEntryPointLib\r
- DebugAgentLib\r
- MemoryAllocationLib\r
- PrePiHobListPointerLib\r
-\r
-[FeaturePcd]\r
- gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
-\r
-[FixedPcd]\r
- gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate\r
- gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress\r
- gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize\r
- gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase\r
- gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize\r
- gEmbeddedTokenSpaceGuid.PcdPrePiStackSize\r
- gEmbeddedTokenSpaceGuid.PcdPrePiStackBase\r
- gEmbeddedTokenSpaceGuid.PcdMemoryBase\r
- gEmbeddedTokenSpaceGuid.PcdMemorySize\r
-\r
- gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart\r
- gOmap35xxTokenSpaceGuid.PcdOmap35xxFreeTimer\r
-\r
- gArmTokenSpaceGuid.PcdCpuVectorBaseAddress\r
-\r