hikey: Add UEFI sources for reference

UEFI needs to be built outside Android build system.
Please follow the instructions in README.

The sources correspond to:
https://github.com/96boards/edk2/commit/14eae0c12e71fd33c4c0fc51e4475e8db02566cf
https://github.com/96boards/arm-trusted-firmware/commit/e9b4909dcd75fc4ae7041cfb83d28ab9adb7afdf
https://github.com/96boards/l-loader/commit/6b784ad5c4ab00e2b1c6f53cd5f74054e5d00a78
https://git.linaro.org/uefi/uefi-tools.git/commit/abe618f8ab72034fff1ce46c9c006a2c6bd40a7e

Change-Id: Ieeefdb63e673e0c8e64e0a1f02c7bddc63b2c7fb
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c
new file mode 100755
index 0000000..dbbe68a
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c
@@ -0,0 +1,135 @@
+/** @file

+*

+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.

+*

+*  This program and the accompanying materials

+*  are licensed and made available under the terms and conditions of the BSD License

+*  which accompanies this distribution.  The full text of the license may be found at

+*  http://opensource.org/licenses/bsd-license.php

+*

+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+*

+**/

+

+#include <Library/IoLib.h>

+#include <Library/ArmPlatformLib.h>

+#include <Library/DebugLib.h>

+#include <Library/PcdLib.h>

+

+#include <Omap3530/Omap3530.h>

+#include <BeagleBoard.h>

+

+VOID

+PadConfiguration (

+  BEAGLEBOARD_REVISION Revision

+  );

+

+VOID

+ClockInit (

+  VOID

+  );

+

+/**

+  Detect board revision

+

+  @return Board revision

+**/

+BEAGLEBOARD_REVISION

+BeagleBoardGetRevision (

+  VOID

+  )

+{

+  UINT32 OldPinDir;

+  UINT32 Revision;

+

+  // Read GPIO 171, 172, 173

+  OldPinDir = MmioRead32 (GPIO6_BASE + GPIO_OE);

+  MmioWrite32(GPIO6_BASE + GPIO_OE, (OldPinDir | BIT11 | BIT12 | BIT13));

+  Revision = MmioRead32 (GPIO6_BASE + GPIO_DATAIN);

+

+  // Restore I/O settings

+  MmioWrite32 (GPIO6_BASE + GPIO_OE, OldPinDir);

+

+  return (BEAGLEBOARD_REVISION)((Revision >> 11) & 0x7);

+}

+

+/**

+  Return the current Boot Mode

+

+  This function returns the boot reason on the platform

+

+**/

+EFI_BOOT_MODE

+ArmPlatformGetBootMode (

+  VOID

+  )

+{

+  return BOOT_WITH_FULL_CONFIGURATION;

+}

+

+/**

+  Initialize controllers that must setup at the early stage

+

+  Some peripherals must be initialized in Secure World.

+  For example, some L2x0 requires to be initialized in Secure World

+

+**/

+RETURN_STATUS

+ArmPlatformInitialize (

+  IN  UINTN                     MpId

+  )

+{

+  BEAGLEBOARD_REVISION Revision;

+

+  Revision = BeagleBoardGetRevision();

+

+  // Set up Pin muxing.

+  PadConfiguration (Revision);

+

+  // Set up system clocking

+  ClockInit ();

+

+  // Turn off the functional clock for Timer 3

+  MmioAnd32 (CM_FCLKEN_PER, 0xFFFFFFFF ^ CM_ICLKEN_PER_EN_GPT3_ENABLE );

+  ArmDataSyncronizationBarrier ();

+

+  // Clear IRQs

+  MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);

+  ArmDataSyncronizationBarrier ();

+

+  return RETURN_SUCCESS;

+}

+

+/**

+  Initialize the system (or sometimes called permanent) memory

+

+  This memory is generally represented by the DRAM.

+

+**/

+VOID

+ArmPlatformInitializeSystemMemory (

+  VOID

+  )

+{

+  // We do not need to initialize the System Memory on RTSM

+}

+

+VOID

+ArmPlatformGetPlatformPpiList (

+  OUT UINTN                   *PpiListSize,

+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList

+  )

+{

+  *PpiListSize = 0;

+  *PpiList = NULL;

+}

+

+UINTN

+ArmPlatformGetCorePosition (

+  IN UINTN MpId

+  )

+{

+  return 1;

+}

+

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S
new file mode 100644
index 0000000..f157925
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S
@@ -0,0 +1,47 @@
+#

+#  Copyright (c) 2012-2013, ARM Limited. All rights reserved.

+#

+#  This program and the accompanying materials

+#  are licensed and made available under the terms and conditions of the BSD License

+#  which accompanies this distribution.  The full text of the license may be found at

+#  http://opensource.org/licenses/bsd-license.php

+#

+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+#

+#

+

+#include <AsmMacroIoLib.h>

+#include <AutoGen.h>

+

+.text

+.align 2

+

+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)

+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)

+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)

+

+GCC_ASM_IMPORT(ArmReadMpidr)

+

+//UINTN

+//ArmPlatformIsPrimaryCore (

+//  IN UINTN MpId

+//  );

+ASM_PFX(ArmPlatformIsPrimaryCore):

+  // BeagleBoard has a single core. We must always return 1.

+  mov   r0, #1

+  bx    lr

+

+ASM_PFX(ArmPlatformPeiBootAction):

+  bx    lr

+

+//UINTN

+//ArmPlatformGetPrimaryCoreMpId (

+//  VOID

+//  );

+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):

+  // The BeagleBoard is a uniprocessor platform. The MPIDR of primary core is

+  // always the MPIDR of the calling CPU.

+  b   ASM_PFX(ArmReadMpidr)

+

+ASM_FUNCTION_REMOVE_IF_UNREFERENCED

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm
new file mode 100644
index 0000000..86906c8
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm
@@ -0,0 +1,53 @@
+//

+//  Copyright (c) 2012-2013, ARM Limited. All rights reserved.

+//

+//  This program and the accompanying materials

+//  are licensed and made available under the terms and conditions of the BSD License

+//  which accompanies this distribution.  The full text of the license may be found at

+//  http://opensource.org/licenses/bsd-license.php

+//

+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+//

+//

+

+#include <AsmMacroIoLib.h>

+#include <Base.h>

+

+#include <AutoGen.h>

+

+  INCLUDE AsmMacroIoLib.inc

+

+  EXPORT    ArmPlatformPeiBootAction

+  EXPORT    ArmPlatformIsPrimaryCore

+  EXPORT    ArmPlatformGetPrimaryCoreMpId

+

+  IMPORT    ArmReadMpidr

+

+  AREA BeagleBoardHelper, CODE, READONLY

+

+//UINTN

+//ArmPlatformIsPrimaryCore (

+//  IN UINTN MpId

+//  );

+ArmPlatformIsPrimaryCore FUNCTION

+  // BeagleBoard has a single core. We must always return 1.

+  mov   r0, #1

+  bx    lr

+  ENDFUNC

+

+ArmPlatformPeiBootAction FUNCTION

+  bx    lr

+  ENDFUNC

+

+//UINTN

+//ArmPlatformGetPrimaryCoreMpId (

+//  VOID

+//  );

+ArmPlatformGetPrimaryCoreMpId FUNCTION

+  // The BeagleBoard is a uniprocessor platform. The MPIDR of primary core is

+  // always the MPIDR of the calling CPU.

+  b     ArmReadMpidr

+  ENDFUNC

+

+  END

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
new file mode 100755
index 0000000..b1139a4
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
@@ -0,0 +1,54 @@
+#/* @file

+#  Copyright (c) 2011-2013, ARM Limited. All rights reserved.

+#

+#  This program and the accompanying materials

+#  are licensed and made available under the terms and conditions of the BSD License

+#  which accompanies this distribution.  The full text of the license may be found at

+#  http://opensource.org/licenses/bsd-license.php

+#

+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+#

+#*/

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = BeagleBoardLib

+  FILE_GUID                      = 736343a0-1d96-11e0-aaaa-0002a5d5c51b

+  MODULE_TYPE                    = BASE

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = ArmPlatformLib

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  ArmPkg/ArmPkg.dec

+  ArmPlatformPkg/ArmPlatformPkg.dec

+  Omap35xxPkg/Omap35xxPkg.dec

+  BeagleBoardPkg/BeagleBoardPkg.dec

+

+[LibraryClasses]

+  IoLib

+  ArmLib

+  MemoryAllocationLib

+

+[Sources.common]

+  BeagleBoardHelper.asm  | RVCT

+  BeagleBoardHelper.S    | GCC

+  BeagleBoard.c

+  BeagleBoardMem.c

+  PadConfiguration.c

+  Clock.c

+  BeagleBoardHelper.S    | GCC

+  BeagleBoardHelper.asm  | RVCT

+

+[FeaturePcd]

+  gEmbeddedTokenSpaceGuid.PcdCacheEnable

+

+[FixedPcd]

+  gArmTokenSpaceGuid.PcdFdBaseAddress

+  gArmTokenSpaceGuid.PcdFdSize

+

+  gArmTokenSpaceGuid.PcdSystemMemoryBase

+  gArmTokenSpaceGuid.PcdSystemMemorySize

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardMem.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardMem.c
new file mode 100755
index 0000000..b77b069
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardMem.c
@@ -0,0 +1,84 @@
+/** @file

+*

+*  Copyright (c) 2011, ARM Limited. All rights reserved.

+*

+*  This program and the accompanying materials

+*  are licensed and made available under the terms and conditions of the BSD License

+*  which accompanies this distribution.  The full text of the license may be found at

+*  http://opensource.org/licenses/bsd-license.php

+*

+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+*

+**/

+

+#include <Library/ArmPlatformLib.h>

+#include <Library/DebugLib.h>

+#include <Library/PcdLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/IoLib.h>

+

+#include <BeagleBoard.h>

+

+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          4

+

+/**

+  Return the Virtual Memory Map of your platform

+

+  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.

+

+  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-

+                                    Virtual Memory mapping. This array must be ended by a zero-filled

+                                    entry

+

+**/

+VOID

+ArmPlatformGetVirtualMemoryMap (

+  IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap

+  )

+{

+  ARM_MEMORY_REGION_ATTRIBUTES  CacheAttributes;

+  UINTN                         Index = 0;

+  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;

+

+  ASSERT(VirtualMemoryMap != NULL);

+

+  VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));

+  if (VirtualMemoryTable == NULL) {

+    return;

+  }

+

+  if (FeaturePcdGet(PcdCacheEnable) == TRUE) {

+    CacheAttributes = DDR_ATTRIBUTES_CACHED;

+  } else {

+    CacheAttributes = DDR_ATTRIBUTES_UNCACHED;

+  }

+

+  // ReMap (Either NOR Flash or DRAM)

+  VirtualMemoryTable[Index].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);

+  VirtualMemoryTable[Index].VirtualBase  = PcdGet64 (PcdSystemMemoryBase);

+  VirtualMemoryTable[Index].Length       = PcdGet64 (PcdSystemMemorySize);

+  VirtualMemoryTable[Index].Attributes   = CacheAttributes;

+

+  // SOC Registers. L3 interconnects

+  VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L3_PHYSICAL_BASE;

+  VirtualMemoryTable[Index].VirtualBase  = SOC_REGISTERS_L3_PHYSICAL_BASE;

+  VirtualMemoryTable[Index].Length       = SOC_REGISTERS_L3_PHYSICAL_LENGTH;

+  VirtualMemoryTable[Index].Attributes   = SOC_REGISTERS_L3_ATTRIBUTES;

+

+  // SOC Registers. L4 interconnects

+  VirtualMemoryTable[++Index].PhysicalBase = SOC_REGISTERS_L4_PHYSICAL_BASE;

+  VirtualMemoryTable[Index].VirtualBase  = SOC_REGISTERS_L4_PHYSICAL_BASE;

+  VirtualMemoryTable[Index].Length       = SOC_REGISTERS_L4_PHYSICAL_LENGTH;

+  VirtualMemoryTable[Index].Attributes   = SOC_REGISTERS_L4_ATTRIBUTES;

+

+  // End of Table

+  VirtualMemoryTable[++Index].PhysicalBase = 0;

+  VirtualMemoryTable[Index].VirtualBase  = 0;

+  VirtualMemoryTable[Index].Length       = 0;

+  VirtualMemoryTable[Index].Attributes   = (ARM_MEMORY_REGION_ATTRIBUTES)0;

+

+  ASSERT((Index + 1) == MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);

+

+  *VirtualMemoryMap = VirtualMemoryTable;

+}

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/Clock.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/Clock.c
new file mode 100755
index 0000000..6ca48e0
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/Clock.c
@@ -0,0 +1,69 @@
+/** @file

+

+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD License

+  which accompanies this distribution.  The full text of the license may be found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+#include <Library/IoLib.h>

+#include <Library/DebugLib.h>

+

+#include <Omap3530/Omap3530.h>

+

+VOID

+ClockInit (

+  VOID

+  )

+{

+  //DPLL1 - DPLL4 are configured part of Configuration header which OMAP3 ROM parses.

+

+  // Enable PLL5 and set to 120 MHz as a reference clock.

+  MmioWrite32 (CM_CLKSEL4_PLL, CM_CLKSEL_PLL_MULT(120) | CM_CLKSEL_PLL_DIV(13));

+  MmioWrite32 (CM_CLKSEL5_PLL, CM_CLKSEL_DIV_120M(1));

+  MmioWrite32 (CM_CLKEN2_PLL, CM_CLKEN_FREQSEL_075_100 | CM_CLKEN_ENABLE);

+

+  // Turn on functional & interface clocks to the USBHOST power domain

+  MmioOr32(CM_FCLKEN_USBHOST, CM_FCLKEN_USBHOST_EN_USBHOST2_ENABLE

+                              | CM_FCLKEN_USBHOST_EN_USBHOST1_ENABLE);

+  MmioOr32(CM_ICLKEN_USBHOST, CM_ICLKEN_USBHOST_EN_USBHOST_ENABLE);

+

+  // Turn on functional & interface clocks to the USBTLL block.

+  MmioOr32(CM_FCLKEN3_CORE, CM_FCLKEN3_CORE_EN_USBTLL_ENABLE);

+  MmioOr32(CM_ICLKEN3_CORE, CM_ICLKEN3_CORE_EN_USBTLL_ENABLE);

+

+  // Turn on functional & interface clocks to MMC1 and I2C1 modules.

+  MmioOr32(CM_FCLKEN1_CORE, CM_FCLKEN1_CORE_EN_MMC1_ENABLE

+                            | CM_FCLKEN1_CORE_EN_I2C1_ENABLE);

+  MmioOr32(CM_ICLKEN1_CORE, CM_ICLKEN1_CORE_EN_MMC1_ENABLE

+                            | CM_ICLKEN1_CORE_EN_I2C1_ENABLE);

+

+  // Turn on functional & interface clocks to various Peripherals.

+  MmioOr32(CM_FCLKEN_PER, CM_FCLKEN_PER_EN_UART3_ENABLE

+                          | CM_FCLKEN_PER_EN_GPT4_ENABLE

+                          | CM_FCLKEN_PER_EN_GPIO2_ENABLE

+                          | CM_FCLKEN_PER_EN_GPIO3_ENABLE

+                          | CM_FCLKEN_PER_EN_GPIO4_ENABLE

+                          | CM_FCLKEN_PER_EN_GPIO5_ENABLE

+                          | CM_FCLKEN_PER_EN_GPIO6_ENABLE);

+  MmioOr32(CM_ICLKEN_PER, CM_ICLKEN_PER_EN_UART3_ENABLE

+                          | CM_ICLKEN_PER_EN_GPT3_ENABLE

+                          | CM_ICLKEN_PER_EN_GPT4_ENABLE

+                          | CM_ICLKEN_PER_EN_GPIO2_ENABLE

+                          | CM_ICLKEN_PER_EN_GPIO3_ENABLE

+                          | CM_ICLKEN_PER_EN_GPIO4_ENABLE

+                          | CM_ICLKEN_PER_EN_GPIO5_ENABLE

+                          | CM_ICLKEN_PER_EN_GPIO6_ENABLE);

+

+  // Turn on functional & inteface clocks to various wakeup modules.

+  MmioOr32(CM_FCLKEN_WKUP, CM_FCLKEN_WKUP_EN_GPIO1_ENABLE

+                           | CM_FCLKEN_WKUP_EN_WDT2_ENABLE);

+  MmioOr32(CM_ICLKEN_WKUP, CM_ICLKEN_WKUP_EN_GPIO1_ENABLE

+                           | CM_ICLKEN_WKUP_EN_WDT2_ENABLE);

+}

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c
new file mode 100755
index 0000000..e6f7cc5
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c
@@ -0,0 +1,322 @@
+/** @file

+

+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD License

+  which accompanies this distribution.  The full text of the license may be found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+#include <PiPei.h>

+#include <Library/IoLib.h>

+#include <Library/DebugLib.h>

+#include <Omap3530/Omap3530.h>

+#include <BeagleBoard.h>

+

+#define NUM_PINS_SHARED 232

+#define NUM_PINS_ABC 6

+#define NUM_PINS_XM 12

+

+PAD_CONFIGURATION PadConfigurationTableShared[] = {

+  //Pin,           MuxMode,    PullConfig,                      InputEnable

+  { SDRC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D16,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D17,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D18,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D19,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D20,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D21,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D22,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D23,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D24,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D25,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D26,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D27,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D28,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D29,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D30,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_D31,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_CLK,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_DQS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_CKE0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { SDRC_CKE1,     MUXMODE7,   PULL_DISABLED,                INPUT  },

+  { SDRC_DQS1,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_DQS2,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { SDRC_DQS3,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_A1,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A2,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A3,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A4,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A5,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A6,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A7,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A8,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A9,       MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_A10,      MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NCS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NCS1,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { GPMC_NCS2,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { GPMC_NCS3,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { GPMC_NCS4,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { GPMC_NCS5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_NCS6,     MUXMODE1,   PULL_DISABLED,                INPUT  },

+  { GPMC_NCS7,     MUXMODE1,   PULL_UP_SELECTED,             INPUT  },

+  { GPMC_CLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_NADV_ALE, MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NOE,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NWE,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NBE0_CLE, MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { GPMC_NBE1,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_NWP,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { GPMC_WAIT0,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { GPMC_WAIT1,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { GPMC_WAIT2,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { GPMC_WAIT3,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { DSS_PCLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_HSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_PSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_ACBIAS,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA0,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA1,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA2,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA3,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA4,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA6,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA7,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA8,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA9,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA10,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA11,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA12,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA13,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA14,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA15,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA16,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA17,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { CAM_HS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },

+  { CAM_VS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },

+  { CAM_XCLKA,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { CAM_PCLK,      MUXMODE0,   PULL_UP_SELECTED,             INPUT },

+  { CAM_FLD,       MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { CAM_D0,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D1,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D2,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D3,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D4,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D5,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D6,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D7,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D8,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D9,        MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D10,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_D11,       MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CAM_XCLKB,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { CAM_WEN,       MUXMODE4,   PULL_DISABLED,                INPUT  },

+  { CAM_STROBE,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { CSI2_DX0,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CSI2_DY0,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CSI2_DX1,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { CSI2_DY1,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCBSP2_FSX,    MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCBSP2_CLKX,   MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCBSP2_DR,     MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCBSP2_DX,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { MMC1_CLK,      MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { MMC1_CMD,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT1,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT2,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT3,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT4,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT5,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT6,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC1_DAT7,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_CLK,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_CMD,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT0,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT1,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT2,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT3,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT4,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT5,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT6,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MMC2_DAT7,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MCBSP3_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP3_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP3_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP3_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { UART2_CTS,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { UART2_RTS,     MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { UART2_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { UART2_RX,      MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { UART1_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { UART1_RTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { UART1_CTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { UART1_RX,      MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCBSP4_CLKX,   MUXMODE1,   PULL_DISABLED,                INPUT  },

+  { MCBSP4_DR,     MUXMODE1,   PULL_DISABLED,                INPUT  },

+  { MCBSP4_DX,     MUXMODE1,   PULL_DISABLED,                INPUT  },

+  { MCBSP4_FSX,    MUXMODE1,   PULL_DISABLED,                INPUT  },

+  { MCBSP1_CLKR,   MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP1_FSR,    MUXMODE4,   PULL_UP_SELECTED,             OUTPUT },

+  { MCBSP1_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP1_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP1_CLKS,   MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { MCBSP1_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCBSP1_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { UART3_CTS_RCTX,MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },

+  { UART3_RTS_SD,  MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { UART3_RX_IRRX, MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { UART3_TX_IRTX, MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { HSUSB0_CLK,    MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_STP,    MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },

+  { HSUSB0_DIR,    MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_NXT,    MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA0,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA1,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA2,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA3,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA4,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA5,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA6,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { HSUSB0_DATA7,  MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { I2C1_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { I2C1_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { I2C2_SCL,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { I2C2_SDA,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { I2C3_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { I2C3_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { HDQ_SIO,       MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCSPI1_CLK,    MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI1_SIMO,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI1_SOMI,   MUXMODE0,   PULL_DISABLED,                INPUT  },

+  { MCSPI1_CS0,    MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },

+  { MCSPI1_CS1,    MUXMODE0,   PULL_UP_SELECTED,                 OUTPUT },

+  { MCSPI1_CS2,    MUXMODE4,   PULL_DISABLED,                OUTPUT },

+  { MCSPI1_CS3,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI2_CLK,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI2_SIMO,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI2_SOMI,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI2_CS0,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { MCSPI2_CS1,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { SYS_NIRQ,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },

+  { SYS_CLKOUT2,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_CLK,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },

+  { ETK_CTL,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },

+  { ETK_D0,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D1,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D2,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D3,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D4,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D5,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D6,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D7,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D8,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D9,        MUXMODE4,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D10,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },

+  { ETK_D11,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },

+  { ETK_D12,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D13,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D14,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },

+  { ETK_D15,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  }

+};

+

+PAD_CONFIGURATION PadConfigurationTableAbc[] = {

+  { DSS_DATA18,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA19,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA20,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA21,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA22,    MUXMODE0,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA23,    MUXMODE0,   PULL_DISABLED,                OUTPUT }

+};

+

+PAD_CONFIGURATION PadConfigurationTableXm[] = {

+  { DSS_DATA18,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA19,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA20,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA21,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA22,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { DSS_DATA23,    MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT0,     MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT1,     MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT3,     MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT4,     MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT5,     MUXMODE3,   PULL_DISABLED,                OUTPUT },

+  { SYS_BOOT6,     MUXMODE3,   PULL_DISABLED,                OUTPUT }

+};

+

+VOID

+PadConfiguration (

+  BEAGLEBOARD_REVISION Revision

+  )

+{

+  UINTN             Index;

+  UINT16            PadConfiguration;

+  PAD_CONFIGURATION *BoardConfiguration;

+  UINTN             NumPinsToConfigure;

+

+  for (Index = 0; Index < NUM_PINS_SHARED; Index++) {

+    // Set up Pad configuration for particular pin.

+    PadConfiguration =  (PadConfigurationTableShared[Index].MuxMode << MUXMODE_OFFSET);

+    PadConfiguration |= (PadConfigurationTableShared[Index].PullConfig << PULL_CONFIG_OFFSET);

+    PadConfiguration |= (PadConfigurationTableShared[Index].InputEnable << INPUTENABLE_OFFSET);

+

+    // Configure the pin with specific Pad configuration.

+    MmioWrite16(PadConfigurationTableShared[Index].Pin, PadConfiguration);

+  }

+

+  if (Revision == REVISION_XM) {

+    BoardConfiguration = PadConfigurationTableXm;

+    NumPinsToConfigure = NUM_PINS_XM;

+  } else {

+    BoardConfiguration = PadConfigurationTableAbc;

+    NumPinsToConfigure = NUM_PINS_ABC;

+  }

+

+  for (Index = 0; Index < NumPinsToConfigure; Index++) {

+    //Set up Pad configuration for particular pin.

+    PadConfiguration =  (BoardConfiguration[Index].MuxMode << MUXMODE_OFFSET);

+    PadConfiguration |= (BoardConfiguration[Index].PullConfig << PULL_CONFIG_OFFSET);

+    PadConfiguration |= (BoardConfiguration[Index].InputEnable << INPUTENABLE_OFFSET);

+

+    //Configure the pin with specific Pad configuration.

+    MmioWrite16(BoardConfiguration[Index].Pin, PadConfiguration);

+  }

+}

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
new file mode 100644
index 0000000..46204a4
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
@@ -0,0 +1,299 @@
+/** @file

+  Add custom commands for BeagleBoard development.

+

+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD License

+  which accompanies this distribution.  The full text of the license may be found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+#include <PiDxe.h>

+#include <Library/ArmLib.h>

+#include <Library/CacheMaintenanceLib.h>

+#include <Library/EblCmdLib.h>

+#include <Library/BaseLib.h>

+#include <Library/DebugLib.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiRuntimeServicesTableLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/UefiLib.h>

+#include <Library/PcdLib.h>

+#include <Library/EfiFileLib.h>

+#include <Library/ArmDisassemblerLib.h>

+#include <Library/PeCoffGetEntryPointLib.h>

+#include <Library/PerformanceLib.h>

+#include <Library/TimerLib.h>

+

+#include <Guid/DebugImageInfoTable.h>

+

+#include <Protocol/DebugSupport.h>

+#include <Protocol/LoadedImage.h>

+

+/**

+  Simple arm disassembler via a library

+

+  Argv[0] - symboltable

+  Argv[1] - Optional quoted format string

+  Argv[2] - Optional flag

+

+  @param  Argc   Number of command arguments in Argv

+  @param  Argv   Array of strings that represent the parsed command line.

+                 Argv[0] is the command name

+

+  @return EFI_SUCCESS

+

+**/

+EFI_STATUS

+EblSymbolTable (

+  IN UINTN  Argc,

+  IN CHAR8  **Argv

+  )

+{

+  EFI_STATUS                        Status;

+  EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugImageTableHeader = NULL;

+  EFI_DEBUG_IMAGE_INFO              *DebugTable;

+  UINTN                             Entry;

+  CHAR8                             *Format;

+  CHAR8                             *Pdb;

+  UINT32                            PeCoffSizeOfHeaders;

+  UINT32                            ImageBase;

+  BOOLEAN                           Elf;

+

+  // Need to add lots of error checking on the passed in string

+  // Default string is for RealView debugger or gdb depending on toolchain used.

+  if (Argc > 1) {

+    Format = Argv[1];

+  } else {

+#if __GNUC__

+    // Assume gdb

+    Format = "add-symbol-file %a 0x%x";

+#else

+    // Default to RVCT

+    Format = "load /a /ni /np %a &0x%x";

+#endif

+  }

+  Elf = (Argc > 2) ? FALSE : TRUE;

+

+  Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&DebugImageTableHeader);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  DebugTable = DebugImageTableHeader->EfiDebugImageInfoTable;

+  if (DebugTable == NULL) {

+    return EFI_SUCCESS;

+  }

+

+  for (Entry = 0; Entry < DebugImageTableHeader->TableSize; Entry++, DebugTable++) {

+    if (DebugTable->NormalImage != NULL) {

+      if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {

+        ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;

+        PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)ImageBase);

+        Pdb = PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);

+        if (Pdb != NULL) {

+          if (Elf) {

+            // ELF and Mach-O images don't include the header so the linked address does not include header

+            ImageBase += PeCoffSizeOfHeaders;

+          }

+          AsciiPrint (Format, Pdb, ImageBase);

+          AsciiPrint ("\n");

+        } else {

+        }

+      }

+    }

+  }

+

+  return EFI_SUCCESS;

+}

+

+

+/**

+  Simple arm disassembler via a library

+

+  Argv[0] - disasm

+  Argv[1] - Address to start disassembling from

+  ARgv[2] - Number of instructions to disassembly (optional)

+

+  @param  Argc   Number of command arguments in Argv

+  @param  Argv   Array of strings that represent the parsed command line.

+                 Argv[0] is the command name

+

+  @return EFI_SUCCESS

+

+**/

+EFI_STATUS

+EblDisassembler (

+  IN UINTN  Argc,

+  IN CHAR8  **Argv

+  )

+{

+  UINT8   *Ptr, *CurrentAddress;

+  UINT32  Address;

+  UINT32  Count;

+  CHAR8   Buffer[80];

+  UINT32  ItBlock;

+

+  if (Argc < 2) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Address = AsciiStrHexToUintn (Argv[1]);

+  Count   = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 20;

+

+  Ptr = (UINT8 *)(UINTN)Address;

+  ItBlock = 0;

+  do {

+    CurrentAddress = Ptr;

+    DisassembleInstruction (&Ptr, TRUE, TRUE, &ItBlock, Buffer, sizeof (Buffer));

+    AsciiPrint ("0x%08x: %a\n", CurrentAddress, Buffer);

+  } while (Count-- > 0);

+

+

+  return EFI_SUCCESS;

+}

+

+

+CHAR8 *

+ImageHandleToPdbFileName (

+  IN  EFI_HANDLE    Handle

+  )

+{

+  EFI_STATUS                  Status;

+  EFI_LOADED_IMAGE_PROTOCOL   *LoadedImage;

+  CHAR8                       *Pdb;

+  CHAR8                       *StripLeading;

+

+  Status = gBS->HandleProtocol (Handle, &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImage);

+  if (EFI_ERROR (Status)) {

+    return "";

+  }

+

+  Pdb = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);

+  StripLeading = AsciiStrStr (Pdb, "\\ARM\\");

+  if (StripLeading == NULL) {

+    StripLeading = AsciiStrStr (Pdb, "/ARM/");

+    if (StripLeading == NULL) {

+      return Pdb;

+    }

+  }

+  // Hopefully we hacked off the unneeded part

+  return (StripLeading + 5);

+}

+

+

+CHAR8 *mTokenList[] = {

+  "SEC",

+  "PEI",

+  "DXE",

+  "BDS",

+  NULL

+};

+

+/**

+  Simple arm disassembler via a library

+

+  Argv[0] - disasm

+  Argv[1] - Address to start disassembling from

+  ARgv[2] - Number of instructions to disassembly (optional)

+

+  @param  Argc   Number of command arguments in Argv

+  @param  Argv   Array of strings that represent the parsed command line.

+                 Argv[0] is the command name

+

+  @return EFI_SUCCESS

+

+**/

+EFI_STATUS

+EblPerformance (

+  IN UINTN  Argc,

+  IN CHAR8  **Argv

+  )

+{

+  UINTN       Key;

+  CONST VOID  *Handle;

+  CONST CHAR8 *Token, *Module;

+  UINT64      Start, Stop, TimeStamp;

+  UINT64      Delta, TicksPerSecond, Milliseconds, Microseconds;

+  UINTN       Index;

+

+  TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);

+

+  Key       = 0;

+  do {

+    Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);

+    if (Key != 0) {

+      if (AsciiStriCmp ("StartImage:", Token) == 0) {

+        if (Stop == 0) {

+          // The entry for EBL is still running so the stop time will be zero. Skip it

+          AsciiPrint ("   running     %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));

+        } else {

+          Delta = Stop - Start;

+          Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);

+          AsciiPrint ("%10ld us  %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));

+        }

+      }

+    }

+  } while (Key != 0);

+

+  AsciiPrint ("\n");

+

+  TimeStamp = 0;

+  Key       = 0;

+  do {

+    Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);

+    if (Key != 0) {

+      for (Index = 0; mTokenList[Index] != NULL; Index++) {

+        if (AsciiStriCmp (mTokenList[Index], Token) == 0) {

+          Delta = Stop - Start;

+          TimeStamp += Delta;

+          Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);

+          AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);

+          break;

+        }

+      }

+    }

+  } while (Key != 0);

+

+  AsciiPrint ("Total Time = %ld ms\n\n", DivU64x64Remainder (MultU64x32 (TimeStamp, 1000), TicksPerSecond, NULL));

+

+  return EFI_SUCCESS;

+}

+

+

+GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =

+{

+  {

+    "disasm address [count]",

+    " disassemble count instructions",

+    NULL,

+    EblDisassembler

+  },

+  {

+    "performance",

+    " Display boot performance info",

+    NULL,

+    EblPerformance

+  },

+  {

+    "symboltable [\"format string\"] [PECOFF]",

+    " show symbol table commands for debugger",

+    NULL,

+    EblSymbolTable

+  }

+};

+

+

+VOID

+EblInitializeExternalCmd (

+  VOID

+  )

+{

+  EblAddCommands (mLibCmdTemplate, sizeof (mLibCmdTemplate)/sizeof (EBL_COMMAND_TABLE));

+  return;

+}

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf b/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
new file mode 100644
index 0000000..a79448c
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
@@ -0,0 +1,53 @@
+#/** @file

+# Component description file for the entry point to a EFIDXE Drivers

+#

+# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification

+# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>

+#

+#  This program and the accompanying materials

+#  are licensed and made available under the terms and conditions of the BSD License

+#  which accompanies this distribution. The full text of the license may be found at

+#  http://opensource.org/licenses/bsd-license.php

+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+#

+#

+#**/

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = BeagleBoardEblCmdLib

+  FILE_GUID                      = ea62bdc3-1063-425f-8851-98cb47f213a8

+  MODULE_TYPE                    = UEFI_DRIVER

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = EblCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER

+

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC

+#

+

+[Sources.common]

+  EblCmdLib.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  ArmPkg/ArmPkg.dec

+

+[LibraryClasses]

+  BaseLib

+  DebugLib

+  ArmDisassemblerLib

+  PerformanceLib

+  TimerLib

+

+[Protocols]

+ gEfiDebugSupportProtocolGuid

+ gEfiLoadedImageProtocolGuid

+

+[Guids]

+ gEfiDebugImageInfoTableGuid

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.c
new file mode 100644
index 0000000..82a2957
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.c
@@ -0,0 +1,103 @@
+/** @file

+  Basic serial IO abstaction for GDB

+

+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD License

+  which accompanies this distribution.  The full text of the license may be found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+#include <Uefi.h>

+#include <Library/GdbSerialLib.h>

+#include <Library/PcdLib.h>

+#include <Library/IoLib.h>

+#include <Library/DebugLib.h>

+#include <Library/OmapLib.h>

+#include <Omap3530/Omap3530.h>

+

+RETURN_STATUS

+EFIAPI

+GdbSerialLibConstructor (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  return RETURN_SUCCESS;

+}

+

+RETURN_STATUS

+EFIAPI

+GdbSerialInit (

+  IN UINT64     BaudRate,

+  IN UINT8      Parity,

+  IN UINT8      DataBits,

+  IN UINT8      StopBits

+  )

+{

+  return RETURN_SUCCESS;

+}

+

+BOOLEAN

+EFIAPI

+GdbIsCharAvailable (

+  VOID

+  )

+{

+  UINT32 LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;

+

+  if ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_NOT_EMPTY) {

+    return TRUE;

+  } else {

+    return FALSE;

+  }

+}

+

+CHAR8

+EFIAPI

+GdbGetChar (

+  VOID

+  )

+{

+  UINT32  LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;

+  UINT32  RBR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_RBR_REG;

+  CHAR8   Char;

+

+  while ((MmioRead8(LSR) & UART_LSR_RX_FIFO_E_MASK) == UART_LSR_RX_FIFO_E_EMPTY);

+  Char = MmioRead8(RBR);

+

+  return Char;

+}

+

+VOID

+EFIAPI

+GdbPutChar (

+  IN  CHAR8   Char

+  )

+{

+  UINT32  LSR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_LSR_REG;

+  UINT32  THR = UartBase(PcdGet32(PcdOmap35xxConsoleUart)) + UART_THR_REG;

+

+  while ((MmioRead8(LSR) & UART_LSR_TX_FIFO_E_MASK) == UART_LSR_TX_FIFO_E_NOT_EMPTY);

+  MmioWrite8(THR, Char);

+}

+

+VOID

+GdbPutString (

+  IN CHAR8  *String

+  )

+{

+  while (*String != '\0') {

+    GdbPutChar (*String);

+    String++;

+  }

+}

+

+

+

+

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.inf b/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.inf
new file mode 100644
index 0000000..a06acf1
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/GdbSerialLib/GdbSerialLib.inf
@@ -0,0 +1,41 @@
+#/** @file

+#

+#  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>

+#  This program and the accompanying materials

+#  are licensed and made available under the terms and conditions of the BSD License

+#  which accompanies this distribution.  The full text of the license may be found at

+#  http://opensource.org/licenses/bsd-license.php

+#

+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+#

+#**/

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = GdbSerialLib

+  FILE_GUID                      = E2423349-EF5D-439B-95F5-8B8D8E3B443F

+  MODULE_TYPE                    = UEFI_DRIVER

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = GdbSerialLib

+

+  CONSTRUCTOR                    = GdbSerialLibConstructor

+

+

+[Sources.common]

+  GdbSerialLib.c

+

+

+[Packages]

+  MdePkg/MdePkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  Omap35xxPkg/Omap35xxPkg.dec

+

+[LibraryClasses]

+  DebugLib

+  IoLib

+  OmapLib

+

+[FixedPcd]

+  gOmap35xxTokenSpaceGuid.PcdOmap35xxConsoleUart

+

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c b/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
new file mode 100644
index 0000000..6b7879b
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -0,0 +1,165 @@
+/** @file

+  Do a generic Cold Reset for OMAP3550 and BeagleBoard specific Warm reset

+

+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>

+

+  This program and the accompanying materials

+  are licensed and made available under the terms and conditions of the BSD License

+  which accompanies this distribution.  The full text of the license may be found at

+  http://opensource.org/licenses/bsd-license.php

+

+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+

+#include <Uefi.h>

+

+#include <Library/ArmLib.h>

+#include <Library/CacheMaintenanceLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/IoLib.h>

+#include <Library/PcdLib.h>

+#include <Library/DebugLib.h>

+#include <Library/UefiBootServicesTableLib.h>

+

+#include <Omap3530/Omap3530.h>

+

+

+VOID

+ShutdownEfi (

+  VOID

+  )

+{

+  EFI_STATUS              Status;

+  UINTN                   MemoryMapSize;

+  EFI_MEMORY_DESCRIPTOR   *MemoryMap;

+  UINTN                   MapKey;

+  UINTN                   DescriptorSize;

+  UINTN                   DescriptorVersion;

+  UINTN                   Pages;

+

+  MemoryMap = NULL;

+  MemoryMapSize = 0;

+  do {

+    Status = gBS->GetMemoryMap (

+                    &MemoryMapSize,

+                    MemoryMap,

+                    &MapKey,

+                    &DescriptorSize,

+                    &DescriptorVersion

+                    );

+    if (Status == EFI_BUFFER_TOO_SMALL) {

+

+      Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;

+      MemoryMap = AllocatePages (Pages);

+

+      //

+      // Get System MemoryMap

+      //

+      Status = gBS->GetMemoryMap (

+                      &MemoryMapSize,

+                      MemoryMap,

+                      &MapKey,

+                      &DescriptorSize,

+                      &DescriptorVersion

+                      );

+      // Don't do anything between the GetMemoryMap() and ExitBootServices()

+      if (!EFI_ERROR (Status)) {

+        Status = gBS->ExitBootServices (gImageHandle, MapKey);

+        if (EFI_ERROR (Status)) {

+          FreePages (MemoryMap, Pages);

+          MemoryMap = NULL;

+          MemoryMapSize = 0;

+        }

+      }

+    }

+  } while (EFI_ERROR (Status));

+

+  //Clean and invalidate caches.

+  WriteBackInvalidateDataCache();

+  InvalidateInstructionCache();

+

+  //Turning off Caches and MMU

+  ArmDisableDataCache ();

+  ArmDisableInstructionCache ();

+  ArmDisableMmu ();

+}

+

+typedef

+VOID

+(EFIAPI *CALL_STUB)(

+  VOID

+);

+

+

+/**

+  Resets the entire platform.

+

+  @param  ResetType             The type of reset to perform.

+  @param  ResetStatus           The status code for the reset.

+  @param  DataSize              The size, in bytes, of WatchdogData.

+  @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or

+                                EfiResetShutdown the data buffer starts with a Null-terminated

+                                Unicode string, optionally followed by additional binary data.

+

+**/

+EFI_STATUS

+EFIAPI

+LibResetSystem (

+  IN EFI_RESET_TYPE   ResetType,

+  IN EFI_STATUS       ResetStatus,

+  IN UINTN            DataSize,

+  IN CHAR16           *ResetData OPTIONAL

+  )

+{

+  CALL_STUB   StartOfFv;

+

+  if (ResetData != NULL) {

+    DEBUG((EFI_D_ERROR, "%s", ResetData));

+  }

+

+  ShutdownEfi ();

+

+  switch (ResetType) {

+  case EfiResetWarm:

+    //Perform warm reset of the system by jumping to the begining of the FV

+    StartOfFv = (CALL_STUB)(UINTN)PcdGet64 (PcdFvBaseAddress);

+    StartOfFv ();

+    break;

+  case EfiResetCold:

+  case EfiResetShutdown:

+  default:

+    //Perform cold reset of the system.

+    MmioOr32 (PRM_RSTCTRL, RST_DPLL3);

+    while ((MmioRead32(PRM_RSTST) & GLOBAL_COLD_RST) != 0x1);

+    break;

+  }

+

+  // If the reset didn't work, return an error.

+  ASSERT (FALSE);

+  return EFI_DEVICE_ERROR;

+}

+

+

+

+/**

+  Initialize any infrastructure required for LibResetSystem () to function.

+

+  @param  ImageHandle   The firmware allocated handle for the EFI image.

+  @param  SystemTable   A pointer to the EFI System Table.

+

+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.

+

+**/

+EFI_STATUS

+EFIAPI

+LibInitializeResetSystem (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  return EFI_SUCCESS;

+}

+

diff --git a/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.inf b/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.inf
new file mode 100644
index 0000000..64638cb
--- /dev/null
+++ b/uefi/linaro-edk2/BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -0,0 +1,49 @@
+#/** @file

+# Reset System lib to make it easy to port new platforms

+#

+# Copyright (c) 2008, Apple Inc. All rights reserved.<BR>

+#

+#  This program and the accompanying materials

+#  are licensed and made available under the terms and conditions of the BSD License

+#  which accompanies this distribution. The full text of the license may be found at

+#  http://opensource.org/licenses/bsd-license.php

+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+#

+#

+#**/

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = BeagleBoardResetSystemLib

+  FILE_GUID                      = 781371a2-3fdd-41d4-96a1-7b34cbc9e895

+  MODULE_TYPE                    = BASE

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = EfiResetSystemLib

+

+

+[Sources.common]

+  ResetSystemLib.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+  ArmPkg/ArmPkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  Omap35xxPkg/Omap35xxPkg.dec

+

+[Pcd.common]

+  gArmTokenSpaceGuid.PcdCpuResetAddress

+  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress

+

+[LibraryClasses]

+  DebugLib

+  ArmLib

+  CacheMaintenanceLib

+  MemoryAllocationLib

+  UefiRuntimeServicesTableLib

+  TimerLib

+  UefiLib

+  UefiBootServicesTableLib

+

+[Pcd]

+  gArmTokenSpaceGuid.PcdFvBaseAddress