]> git.proxmox.com Git - mirror_edk2.git/commitdiff
A better template, with some build scripts, for ArmEbPkg. New libraries are just...
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 May 2010 18:28:48 +0000 (18:28 +0000)
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 May 2010 18:28:48 +0000 (18:28 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10493 6f19259b-4bc3-4df7-8a09-765794883524

27 files changed:
ArmEbPkg/ArmEbPkg.dsc
ArmEbPkg/ArmEbPkg.fdf [new file with mode: 0755]
ArmEbPkg/Bds/Bds.inf [new file with mode: 0755]
ArmEbPkg/Bds/BdsEntry.c [new file with mode: 0755]
ArmEbPkg/Bds/BdsEntry.h [new file with mode: 0755]
ArmEbPkg/Bds/FirmwareVolume.c [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_boot_from_ram.inc [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_convert_symbols.sh [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_dummy.axf [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_hw_setup.inc [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_load_symbols.inc [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_symbols_macros.inc [new file with mode: 0755]
ArmEbPkg/Debugger_scripts/rvi_unload_symbols.inc [new file with mode: 0755]
ArmEbPkg/Include/ArmEb/ArmEb.h [new file with mode: 0755]
ArmEbPkg/Include/ArmEb/ArmEbUart.h [new file with mode: 0755]
ArmEbPkg/Include/ArmEbUart.h [deleted file]
ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.c [new file with mode: 0755]
ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.inf [new file with mode: 0755]
ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.c
ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
ArmEbPkg/Library/SerialPortLib/SerialPortLib.c
ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
ArmEbPkg/Library/TimerLib/TimerLib.c [new file with mode: 0755]
ArmEbPkg/Library/TimerLib/TimerLib.inf [new file with mode: 0755]
ArmEbPkg/b.bat [new file with mode: 0755]
ArmEbPkg/ba.bat [new file with mode: 0755]
ArmEbPkg/build.sh [new file with mode: 0755]

index 2d21659d9f0161660b6f6e12dfeed0a82a813e52..c17e72979aff41a44efe8880e328a9326a5ff643 100644 (file)
   SUPPORTED_ARCHITECTURES        = ARM
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT
-#
-#  Add .fdf file after we get a critical mass of drivers ported over
-#  FLASH_DEFINITION               = ArmEbPkg/ArmEbPkg.fdf
-  DEFINE TARGET_HACK             = DEBUG
+  FLASH_DEFINITION               = ArmEbPkg/ArmEbPkg.fdf
 
 
 [LibraryClasses.common]
 !if $(BUILD_TARGETS) == RELEASE
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
 !else
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
+#  UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
 !endif
 
   ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
-  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
 
+  EfiResetSystemLib|ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
+  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
+  EblCmdLib|BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf
+  EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  
+  #
+  # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window 
+  # in the debugger will show load and unload commands for symbols. You can cut and paste this
+  # into the command window to load symbols. We should be able to use a script to do this, but
+  # the version of RVD I have does not support scipts accessing system memory.
+  #
+#  PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
+  PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf
+#  PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+
+  
   CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   DefaultExceptioHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
   PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
   
+  SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
+  
   RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
 
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
 
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
     
- # UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
-  UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
+
+  EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
 
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
 
-  SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
   
   #
   # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window 
 #  PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf
   PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
 
+  EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
+  
+  ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
+  DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+
+  SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
+  TimerLib|ArmEbPkg/Library/TimerLib/TimerLib.inf  
+  SerialPortLib|ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
+  GdbSerialLib|ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.inf
 
 
 [LibraryClasses.common.SEC]
   ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
   LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
+  PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
+  
+  # 1/123 faster than Stm or Vstm version
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+
+[LibraryClasses.common.DXE_CORE]
+  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+#  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
+
+  PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+  
 
 [LibraryClasses.common.DXE_DRIVER]
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+
+
+[LibraryClasses.common.UEFI_APPLICATION]
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+#  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
 
 [LibraryClasses.ARM]
+  #
+  # It is not possible to prevent the ARM compiler for generic intrinsic functions.
+  # This library provides the instrinsic functions generate by a given compiler.
+  # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
+  #
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
 
 
   XCODE:*_*_ARM_ARCHCC_FLAGS     == -arch armv7 -march=armv7
   XCODE:*_*_ARM_ARCHASM_FLAGS    == -arch armv7
   XCODE:*_*_ARM_ARCHDLINK_FLAGS  == -arch armv7
+  XCODE:RELEASE_*_*_CC_FLAGS     = -DMDEPKG_NDEBUG 
 
-  RVCT:*_*_ARM_ARCHCC_FLAGS     == --cpu 7-A
-  RVCT:*_*_ARM_ARCHASM_FLAGS    == --cpu 7-A
+  RVCT:*_*_ARM_ARCHCC_FLAGS  == --cpu Cortex-A8 --thumb
+  RVCT:*_*_ARM_ARCHASM_FLAGS == --cpu Cortex-A8 
+  RVCT:RELEASE_*_*_CC_FLAGS  = -DMDEPKG_NDEBUG 
 
 ################################################################################
 #
 #
 ################################################################################
 
+[PcdsFeatureFlag.common]
+  gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE
+  gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
+  gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
+  gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
+  
+  #
+  # Control what commands are supported from the UI
+  # Turn these on and off to add features or save size
+  #  
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE
+
+  gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
+  
+  gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
+  gArmTokenSpaceGuid.PcdCpuDxeProduceDebugSupport|FALSE
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
   
 [PcdsFixedAtBuild.common]
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmEb %a"
+  gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize|32
+  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|0
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
+  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
+  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
+  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
 
 # DEBUG_ASSERT_ENABLED       0x01
 # DEBUG_PRINT_ENABLED        0x02
 #  DEBUG_LOADFILE  0x00020000  // UNDI Driver
 #  DEBUG_EVENT     0x00080000  // Event messages
 #  DEBUG_ERROR     0x80000000  // Error
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000004
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
 
   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
+
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
   
   gEmbeddedTokenSpaceGuid.PcdPrePiTempMemorySize|0
   gEmbeddedTokenSpaceGuid.PcdPrePiBfvBaseAddress|0
   gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|0
   gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize|0
 
+#
+# Optional feature to help prevent EFI memory map fragments
+# Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
+# Values are in EFI Pages (4K). DXE Core will make sure that 
+# at least this much of each type of memory can be allocated 
+# from a single memory range. This way you only end up with
+# maximum of two fragements for each type in the memory map
+# (the memory used, and the free memory that was prereserved
+# but not used).
+#
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|40
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|3000
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|10
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
+
   gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0x80001000
   gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0x87FE0000 # stack at top of memory
   gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0x20000    # 128K stack
 
   gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x80000000
   gArmTokenSpaceGuid.PcdCpuResetAddress|0x80008000
+  
+  gEmbeddedTokenSpaceGuid.PcdTimerPeriod|100000
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|13000000
+  
+  #
+  # ARM Pcds
+  #
   gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000
 
 ################################################################################
 #
 ################################################################################
 [Components.common]
-  ArmEbPkg/Library/ResetSystemLib/ResetSystemLib.inf
-  ArmEbPkg/Library/SerialPortLib/SerialPortLib.inf
-#  Omap35xxPkg/Library/BeagleBoardTimerLib/BeagleBoardTimerLib.inf  
-#  Omap35xxPkg/Library/OmapLib/OmapLib.inf
-  
-#  Omap35xxPkg/Flash/Flash.inf
-#  Omap35xxPkg/MMCHSDxe/MMCHS.inf
-#  Omap35xxPkg/SmbusDxe/Smbus.inf
-#  Omap35xxPkg/Gpio/Gpio.inf
+  
+#
+# SEC
+#
   ArmEbPkg/Sec/Sec.inf
+
+#
+# DXE
+#
+  MdeModulePkg/Core/Dxe/DxeMain.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+      NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+#      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+      NULL|EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf    
+  }
+
+  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  
+  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
+  EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
+  
+  EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
   ArmEbPkg/InterruptDxe/InterruptDxe.inf
-#  Omap35xxPkg/TimerDxe/TimerDxe.inf 
-#  Omap35xxPkg/TPS65950Dxe/TPS65950.inf
+
+  #
+  # Semi-hosting filesystem
+  #
+  ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
+  
+  #
+  # FAT filesystem + GPT/MBR partitioning
+  #
+  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
+  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
   
   
+  #
+  # Application
+  #  
+  EmbeddedPkg/Ebl/Ebl.inf
+
+  #
+  # Bds
+  #
+  ArmEbPkg/Bds/Bds.inf  
+
+  #
+  # Example Application
+  #  
+  MdeModulePkg/Application/HelloWorld/HelloWorld.inf
 
diff --git a/ArmEbPkg/ArmEbPkg.fdf b/ArmEbPkg/ArmEbPkg.fdf
new file mode 100755 (executable)
index 0000000..d461871
--- /dev/null
@@ -0,0 +1,251 @@
+# FLASH layout file for ARM EB.
+#
+# Copyright (c) 2009 -  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.
+#
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into  the Flash Device Image.  Each FD section
+# defines one flash "device" image.  A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash"  image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+
+
+[FD.ArmEb_EFI]
+####BaseAddress   = 0x80208000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress  #The base address of the FLASH Device.
+BaseAddress   = 0x80008000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress  #The base address of the FLASH Device.
+Size          = 0x00080000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize         #The size in bytes of the FLASH Device
+ErasePolarity = 1
+BlockSize     = 0x40
+NumBlocks     = 0x2000
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+
+# 512 bytes of configuration header & 8 bytes of image header
+0x00000000|0x00000208
+
+0x00000208|0x0007FDF8
+gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
+FV = FVMAIN_COMPACT
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file.  This section also defines order the components and modules are positioned
+# within the image.  The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+[FV.FvMain]
+BlockSize          = 0x40
+NumBlocks          = 0         # This FV gets compressed so make it just big enough
+FvAlignment        = 8         # FV alignment and FV attributes setting.
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF MdeModulePkg/Core/Dxe/DxeMain.inf 
+
+  #
+  # PI DXE Drivers producing Architectural Protocols (EFI Services) 
+  #
+  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  
+  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
+   
+  INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
+
+  INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+  
+  #
+  # Semi-hosting filesystem
+  #
+  INF ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
+  
+  #
+  # FAT filesystem + GPT/MBR partitioning
+  #
+  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
+  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+
+  #
+  # UEFI application (Shell Embedded Boot Loader) 
+  #  
+  INF EmbeddedPkg/Ebl/Ebl.inf
+  
+
+  #
+  # Bds
+  #
+  INF ArmEbPkg/Bds/Bds.inf
+
+
+[FV.FVMAIN_COMPACT]
+FvAlignment        = 8
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF ArmEbPkg/Sec/Sec.inf
+
+  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
+    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
+      SECTION FV_IMAGE = FVMAIN
+    }
+  }
+
+
+################################################################################
+#
+# Rules are use with the [FV] section's module INF type to define
+# how an FFS file is created for a given INF file. The following Rule are the default
+# rules for the different module type. User can add the customized rules to define the
+# content of the FFS file.
+#
+################################################################################
+
+
+############################################################################
+# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section   # 
+############################################################################
+#
+#[Rule.Common.DXE_DRIVER]
+#  FILE DRIVER = $(NAMED_GUID) {
+#    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+#    COMPRESS PI_STD {
+#      GUIDED {
+#        PE32     PE32                    |.efi
+#        UI       STRING="$(MODULE_NAME)" Optional
+#        VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+#      }
+#    }
+#  }
+#
+############################################################################
+
+[Rule.Common.SEC]
+  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
+    TE  TE    Align = 8      |.efi
+  }
+
+[Rule.Common.PEI_CORE]
+  FILE PEI_CORE = $(NAMED_GUID) {
+    TE     TE           |.efi
+    UI     STRING ="$(MODULE_NAME)" Optional         
+  }
+
+[Rule.Common.PEIM]
+  FILE PEIM = $(NAMED_GUID) {
+     PEI_DEPEX PEI_DEPEX Optional        |.depex
+     PE32      PE32                      |.efi
+     UI       STRING="$(MODULE_NAME)" Optional         
+  }
+
+[Rule.Common.PEIM.TIANOCOMPRESSED]
+  FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
+    PEI_DEPEX PEI_DEPEX Optional         |.depex
+    GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
+      PE32      PE32                     |.efi
+      UI        STRING="$(MODULE_NAME)" Optional
+    }
+  }
+
+[Rule.Common.DXE_CORE]
+  FILE DXE_CORE = $(NAMED_GUID) {
+    PE32     PE32           |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+  }
+
+
+[Rule.Common.UEFI_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32         PE32                    |.efi
+    UI           STRING="$(MODULE_NAME)" Optional
+  }
+
+[Rule.Common.DXE_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32         PE32                    |.efi
+    UI           STRING="$(MODULE_NAME)" Optional
+  }
+
+[Rule.Common.DXE_RUNTIME_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32         PE32                    |.efi
+    UI           STRING="$(MODULE_NAME)" Optional
+  }
+
+
+[Rule.Common.UEFI_APPLICATION]
+  FILE APPLICATION = $(NAMED_GUID) {
+    UI     STRING ="$(MODULE_NAME)" Optional         
+    PE32   PE32                    |.efi
+  }
diff --git a/ArmEbPkg/Bds/Bds.inf b/ArmEbPkg/Bds/Bds.inf
new file mode 100755 (executable)
index 0000000..b9c152c
--- /dev/null
@@ -0,0 +1,71 @@
+\r
+#/** @file\r
+#  \r
+#    Component discription 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                      = ArmEbBds\r
+  FILE_GUID                      = B404835D-EB9F-41c6-BE0C-C815B4FE3437\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
+\r
+[FeaturePcd]  \r
+\r
+[FixedPcd]\r
+  gEmbeddedTokenSpaceGuid.PcdPrePiStackSize\r
+\r
+[Depex]\r
+  TRUE\r
diff --git a/ArmEbPkg/Bds/BdsEntry.c b/ArmEbPkg/Bds/BdsEntry.c
new file mode 100755 (executable)
index 0000000..8de4e7a
--- /dev/null
@@ -0,0 +1,246 @@
+/** @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
+\r
+EFI_HANDLE  mBdsImageHandle = NULL;\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
+  mBdsImageHandle = ImageHandle;\r
+\r
+  //\r
+  // Install protocol interface\r
+  //\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &mBdsImageHandle,\r
+                  &gEfiBdsArchProtocolGuid, &gBdsProtocol,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
+}\r
+\r
+\r
diff --git a/ArmEbPkg/Bds/BdsEntry.h b/ArmEbPkg/Bds/BdsEntry.h
new file mode 100755 (executable)
index 0000000..149acbe
--- /dev/null
@@ -0,0 +1,66 @@
+/** @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
diff --git a/ArmEbPkg/Bds/FirmwareVolume.c b/ArmEbPkg/Bds/FirmwareVolume.c
new file mode 100755 (executable)
index 0000000..142095f
--- /dev/null
@@ -0,0 +1,150 @@
+/** @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
diff --git a/ArmEbPkg/Debugger_scripts/rvi_boot_from_ram.inc b/ArmEbPkg/Debugger_scripts/rvi_boot_from_ram.inc
new file mode 100755 (executable)
index 0000000..6299a84
--- /dev/null
@@ -0,0 +1,21 @@
+//
+// 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.
+//
+error = continue
+unload
+error = abort
+
+setreg @CP15_CONTROL = 0x0005107E
+setreg @pc=0x80008208
+setreg @cpsr=0x000000D3
+dis/D
+readfile,raw,nowarn "ZZZZZZ/FV/BEAGLEBOARD_EFI.fd"=0x80008000
+
diff --git a/ArmEbPkg/Debugger_scripts/rvi_convert_symbols.sh b/ArmEbPkg/Debugger_scripts/rvi_convert_symbols.sh
new file mode 100755 (executable)
index 0000000..67fdfe1
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh\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
+IN=`/usr/bin/cygpath -u $1`\r
+OUT=`/usr/bin/cygpath -u $2`\r
+\r
+/usr/bin/sed -e "s/\/cygdrive\/\(.\)/load\/a\/ni\/np \"\1:/g" \\r
+             -e 's:\\:/:g' \\r
+             -e "s/^/load\/a\/ni\/np \"/g" \\r
+             -e "s/dll /dll\" \&/g" \\r
+              $IN | /usr/bin/sort.exe --key=3 --output=$OUT\r
+\r
diff --git a/ArmEbPkg/Debugger_scripts/rvi_dummy.axf b/ArmEbPkg/Debugger_scripts/rvi_dummy.axf
new file mode 100755 (executable)
index 0000000..17fabaa
Binary files /dev/null and b/ArmEbPkg/Debugger_scripts/rvi_dummy.axf differ
diff --git a/ArmEbPkg/Debugger_scripts/rvi_hw_setup.inc b/ArmEbPkg/Debugger_scripts/rvi_hw_setup.inc
new file mode 100755 (executable)
index 0000000..ea5f8ec
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// 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.
+//
+
+error = continue
+unload
+error = abort
+
+setreg @CP15_CONTROL = 0x0005107E
+setreg @cpsr=0x000000D3
+
+; General clock settings.
+setmem /32 0x48307270=0x00000080
+setmem /32 0x48306D40=0x00000003
+setmem /32 0x48005140=0x03020A50
+
+;Clock configuration
+setmem /32 0x48004A40=0x0000030A
+setmem /32 0x48004C40=0x00000015
+
+;DPLL3 (Core) settings
+setmem /32 0x48004D00=0x00370037
+setmem /32 0x48004D30=0x00000000
+setmem /32 0x48004D40=0x094C0C00
+
+;DPLL4 (Peripheral) settings
+setmem /32 0x48004D00=0x00370037
+setmem /32 0x48004D30=0x00000000
+setmem /32 0x48004D44=0x0001B00C
+setmem /32 0x48004D48=0x00000009
+
+;DPLL1 (MPU) settings
+setmem /32 0x48004904=0x00000037
+setmem /32 0x48004934=0x00000000
+setmem /32 0x48004940=0x0011F40C
+setmem /32 0x48004944=0x00000001
+setmem /32 0x48004948=0x00000000
+
+;RAM setup.
+setmem /16 0x6D000010=0x0000
+setmem /16 0x6D000040=0x0001
+setmem /16 0x6D000044=0x0100
+setmem /16 0x6D000048=0x0000
+setmem /32 0x6D000060=0x0000000A
+setmem /32 0x6D000070=0x00000081
+setmem /16 0x6D000040=0x0003
+setmem /32 0x6D000080=0x02D04011
+setmem /16 0x6D000084=0x0032
+setmem /16 0x6D00008C=0x0000
+setmem /32 0x6D00009C=0xBA9DC4C6
+setmem /32 0x6D0000A0=0x00012522
+setmem /32 0x6D0000A4=0x0004E201
+setmem /16 0x6D000040=0x0003
+setmem /32 0x6D0000B0=0x02D04011
+setmem /16 0x6D0000B4=0x0032
+setmem /16 0x6D0000BC=0x0000
+setmem /32 0x6D0000C4=0xBA9DC4C6
+setmem /32 0x6D0000C8=0x00012522
+setmem /32 0x6D0000D4=0x0004E201
\ No newline at end of file
diff --git a/ArmEbPkg/Debugger_scripts/rvi_load_symbols.inc b/ArmEbPkg/Debugger_scripts/rvi_load_symbols.inc
new file mode 100755 (executable)
index 0000000..e093ccb
--- /dev/null
@@ -0,0 +1,23 @@
+//\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
+include 'ZZZZZZ/rvi_symbols_macros.inc'\r
+\r
+macro write_symbols_file("ZZZZZZ/rvi_symbols.tmp", 0x00000000, 0x10000000)\r
+\r
+host "bash -o igncr ZZZZZZ/rvi_convert_symbols.sh ZZZZZZ/rvi_symbols.tmp ZZZZZZ/rvi_symbols.inc"\r
+include 'ZZZZZZ/rvi_symbols.inc'\r
+load /NI /NP 'ZZZZZZ/rvi_dummy.axf' ;.constdata\r
+unload rvi_dummy.axf\r
+delfile rvi_dummy.axf\r
+\r
+\r
diff --git a/ArmEbPkg/Debugger_scripts/rvi_symbols_macros.inc b/ArmEbPkg/Debugger_scripts/rvi_symbols_macros.inc
new file mode 100755 (executable)
index 0000000..97d465e
--- /dev/null
@@ -0,0 +1,194 @@
+//\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
+define /R int compare_guid(guid1, guid2)\r
+    unsigned char *guid1;\r
+    unsigned char *guid2;\r
+{\r
+    return strncmp(guid1, guid2, 16);\r
+}\r
+.\r
+\r
+define /R unsigned char * find_system_table(mem_start, mem_size)\r
+    unsigned char *mem_start;\r
+    unsigned long mem_size;\r
+{\r
+    unsigned char *mem_ptr;\r
+     \r
+    mem_ptr = mem_start + mem_size;\r
+    \r
+    do\r
+    {\r
+        mem_ptr -= 0x400000; // 4 MB\r
+        \r
+        if (strncmp(mem_ptr, "IBI SYST", 8) == 0)\r
+        {\r
+            return *(unsigned long *)(mem_ptr + 8); // EfiSystemTableBase\r
+        }        \r
+        \r
+    } while (mem_ptr > mem_start);\r
+    \r
+    return 0;\r
+}\r
+.\r
+\r
+define /R unsigned char * find_debug_info_table_header(system_table)\r
+    unsigned char *system_table;\r
+{\r
+    unsigned long configuration_table_entries;\r
+    unsigned char *configuration_table;\r
+    unsigned long index;\r
+    unsigned char debug_table_guid[16];\r
+    \r
+    // Fill in the debug table's guid\r
+    debug_table_guid[ 0] = 0x77;\r
+    debug_table_guid[ 1] = 0x2E;\r
+    debug_table_guid[ 2] = 0x15;\r
+    debug_table_guid[ 3] = 0x49;\r
+    debug_table_guid[ 4] = 0xDA;\r
+    debug_table_guid[ 5] = 0x1A;\r
+    debug_table_guid[ 6] = 0x64;\r
+    debug_table_guid[ 7] = 0x47;\r
+    debug_table_guid[ 8] = 0xB7;\r
+    debug_table_guid[ 9] = 0xA2;\r
+    debug_table_guid[10] = 0x7A;\r
+    debug_table_guid[11] = 0xFE;\r
+    debug_table_guid[12] = 0xFE;\r
+    debug_table_guid[13] = 0xD9;\r
+    debug_table_guid[14] = 0x5E;\r
+    debug_table_guid[15] = 0x8B;\r
+    \r
+    configuration_table_entries = *(unsigned long *)(system_table + 64);\r
+    configuration_table         = *(unsigned long *)(system_table + 68);\r
+    \r
+    for (index = 0; index < configuration_table_entries; index++)\r
+    {\r
+        if (compare_guid(configuration_table, debug_table_guid) == 0)\r
+        {\r
+            return *(unsigned long *)(configuration_table + 16);\r
+        }\r
+        \r
+        configuration_table += 20;\r
+    }\r
+    \r
+    return 0;\r
+}\r
+.\r
+\r
+define /R int valid_pe_header(header)\r
+        unsigned char *header;\r
+{\r
+    if ((header[0x00] == 'M') &&\r
+        (header[0x01] == 'Z') &&\r
+        (header[0x80] == 'P') &&\r
+        (header[0x81] == 'E'))\r
+    {\r
+        return 1;\r
+    }\r
+    \r
+    return 0;\r
+}\r
+.\r
+\r
+define /R unsigned long pe_headersize(header)\r
+        unsigned char *header;\r
+{\r
+    unsigned long *size;\r
+    \r
+    size = header + 0x00AC;\r
+    \r
+    return *size;\r
+}\r
+.\r
+\r
+define /R unsigned char *pe_filename(header)\r
+        unsigned char *header;\r
+{\r
+    unsigned long *debugOffset;\r
+    unsigned char *stringOffset;\r
+   \r
+    if (valid_pe_header(header))\r
+    {\r
+        debugOffset  = header + 0x0128;\r
+        stringOffset = header + *debugOffset + 0x002C;\r
+       \r
+        return stringOffset;\r
+    }\r
+   \r
+    return 0;\r
+}\r
+.\r
+\r
+define /R int char_is_valid(c)\r
+        unsigned char c;\r
+{\r
+    if (c >= 32 && c < 127)\r
+       return 1;\r
+\r
+    return 0;\r
+}\r
+.\r
+\r
+define /R write_symbols_file(filename, mem_start, mem_size)\r
+    unsigned char *filename;\r
+    unsigned char *mem_start;\r
+    unsigned long mem_size;    \r
+{\r
+    unsigned char *system_table;\r
+    unsigned char *debug_info_table_header;\r
+    unsigned char *debug_info_table;\r
+    unsigned long debug_info_table_size;\r
+    unsigned long index;\r
+    unsigned char *debug_image_info;\r
+    unsigned char *loaded_image_protocol;\r
+    unsigned char *image_base;\r
+    unsigned char *debug_filename;\r
+    unsigned long header_size;\r
+    int           status;\r
+    \r
+    system_table = find_system_table(mem_start, mem_size);\r
+    if (system_table == 0)\r
+    {\r
+        return;\r
+    }\r
+    \r
+    status = fopen(88, filename, "w");\r
+    \r
+    debug_info_table_header = find_debug_info_table_header(system_table);\r
+    \r
+    debug_info_table      = *(unsigned long *)(debug_info_table_header + 8);\r
+    debug_info_table_size = *(unsigned long *)(debug_info_table_header + 4);\r
+    \r
+    for (index = 0; index < (debug_info_table_size * 4); index += 4)\r
+    {\r
+        debug_image_info = *(unsigned long *)(debug_info_table + index); \r
+        \r
+        if (debug_image_info == 0)\r
+        {\r
+            break;\r
+        }\r
+        \r
+        loaded_image_protocol = *(unsigned long *)(debug_image_info + 4);\r
+        \r
+        image_base = *(unsigned long *)(loaded_image_protocol + 32);\r
+        \r
+        debug_filename = pe_filename(image_base);\r
+        header_size    = pe_headersize(image_base);\r
+    \r
+        $fprintf 88, "%s 0x%08x\n", debug_filename, image_base + header_size$;\r
+    }\r
+    \r
+    \r
+    fclose(88);\r
+}\r
+.\r
+\r
diff --git a/ArmEbPkg/Debugger_scripts/rvi_unload_symbols.inc b/ArmEbPkg/Debugger_scripts/rvi_unload_symbols.inc
new file mode 100755 (executable)
index 0000000..f85f442
--- /dev/null
@@ -0,0 +1,118 @@
+//\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
+error = continue\r
+\r
+unload\r
+\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+delfile 1\r
+\r
+error = abort\r
diff --git a/ArmEbPkg/Include/ArmEb/ArmEb.h b/ArmEbPkg/Include/ArmEb/ArmEb.h
new file mode 100755 (executable)
index 0000000..3084091
--- /dev/null
@@ -0,0 +1,19 @@
+/*++\r
+\r
+Copyright (c) 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
+#ifndef __ARM_EB_H__\r
+#define __ARM_EB_H__\r
+\r
+#include <ArmEb\ArmEbUart.h>\r
+\r
+#endif \r
diff --git a/ArmEbPkg/Include/ArmEb/ArmEbUart.h b/ArmEbPkg/Include/ArmEb/ArmEbUart.h
new file mode 100755 (executable)
index 0000000..642b83a
--- /dev/null
@@ -0,0 +1,75 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>\r
+Portions copyright (c) 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
+#ifndef __ARM_EB_UART_H__\r
+#define __ARM_EB_UART_H__\r
+\r
+\r
+#define SERIAL_PORT_MAX_TIMEOUT            100000000    // 100 seconds\r
+\r
+\r
+// EB constants\r
+#define EB_UART1_BASE   0x10009000\r
+\r
+// PL011 Registers\r
+#define UARTDR          0x000\r
+#define UARTRSR         0x004\r
+#define UARTECR         0x004\r
+#define UARTFR          0x018\r
+#define UARTILPR        0x020\r
+#define UARTIBRD        0x024\r
+#define UARTFBRD        0x028\r
+#define UARTLCR_H       0x02C\r
+#define UARTCR          0x030\r
+#define UARTIFLS        0x034\r
+#define UARTIMSC        0x038\r
+#define UARTRIS         0x03C\r
+#define UARTMIS         0x040\r
+#define UARTICR         0x044\r
+#define UARTDMACR       0x048\r
+\r
+// If the required baud rate is 115200 and UARTCLK = 24MHz then:\r
+// Baud Rate Divisor = (24×10^6)/(16×115200) = 13.020833\r
+// This means BRDI = 13 and BRDF = 0.020833\r
+// Therefore, fractional part, m = integer(0.020833×64) = integer(1.33331) = 1\r
+// Generated baud rate divider = 13+1/64 = 13.015625\r
+// Generated baud rate = (24×10^6)/(16×13.015625) = 115246.098\r
+// Error = (115246.098-115200)/115200 Ã— 100 = 0.04%\r
+#define UART_115200_IDIV    13\r
+#define UART_115200_FDIV    1\r
+\r
+// add more baud rates here as needed\r
+\r
+// data status bits\r
+#define UART_DATA_ERROR_MASK      0x0F00\r
+\r
+// status reg bits\r
+#define UART_STATUS_ERROR_MASK    0x0F\r
+\r
+// flag reg bits\r
+#define UART_TX_EMPTY_FLAG_MASK   0x80\r
+#define UART_RX_FULL_FLAG_MASK    0x40\r
+#define UART_TX_FULL_FLAG_MASK    0x20\r
+#define UART_RX_EMPTY_FLAG_MASK   0x10\r
+#define UART_BUSY_FLAG_MASK       0x08\r
+\r
+// control reg bits\r
+#define UART_CTSEN_CONTROL_MASK   0x8000\r
+#define UART_RTSEN_CONTROL_MASK   0x4000\r
+#define UART_RTS_CONTROL_MASK     0x0800\r
+#define UART_DTR_CONTROL_MASK     0x0400\r
+\r
+\r
+#endif \r
diff --git a/ArmEbPkg/Include/ArmEbUart.h b/ArmEbPkg/Include/ArmEbUart.h
deleted file mode 100644 (file)
index 642b83a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
-Portions copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>\r
-Portions copyright (c) 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
-#ifndef __ARM_EB_UART_H__\r
-#define __ARM_EB_UART_H__\r
-\r
-\r
-#define SERIAL_PORT_MAX_TIMEOUT            100000000    // 100 seconds\r
-\r
-\r
-// EB constants\r
-#define EB_UART1_BASE   0x10009000\r
-\r
-// PL011 Registers\r
-#define UARTDR          0x000\r
-#define UARTRSR         0x004\r
-#define UARTECR         0x004\r
-#define UARTFR          0x018\r
-#define UARTILPR        0x020\r
-#define UARTIBRD        0x024\r
-#define UARTFBRD        0x028\r
-#define UARTLCR_H       0x02C\r
-#define UARTCR          0x030\r
-#define UARTIFLS        0x034\r
-#define UARTIMSC        0x038\r
-#define UARTRIS         0x03C\r
-#define UARTMIS         0x040\r
-#define UARTICR         0x044\r
-#define UARTDMACR       0x048\r
-\r
-// If the required baud rate is 115200 and UARTCLK = 24MHz then:\r
-// Baud Rate Divisor = (24×10^6)/(16×115200) = 13.020833\r
-// This means BRDI = 13 and BRDF = 0.020833\r
-// Therefore, fractional part, m = integer(0.020833×64) = integer(1.33331) = 1\r
-// Generated baud rate divider = 13+1/64 = 13.015625\r
-// Generated baud rate = (24×10^6)/(16×13.015625) = 115246.098\r
-// Error = (115246.098-115200)/115200 Ã— 100 = 0.04%\r
-#define UART_115200_IDIV    13\r
-#define UART_115200_FDIV    1\r
-\r
-// add more baud rates here as needed\r
-\r
-// data status bits\r
-#define UART_DATA_ERROR_MASK      0x0F00\r
-\r
-// status reg bits\r
-#define UART_STATUS_ERROR_MASK    0x0F\r
-\r
-// flag reg bits\r
-#define UART_TX_EMPTY_FLAG_MASK   0x80\r
-#define UART_RX_FULL_FLAG_MASK    0x40\r
-#define UART_TX_FULL_FLAG_MASK    0x20\r
-#define UART_RX_EMPTY_FLAG_MASK   0x10\r
-#define UART_BUSY_FLAG_MASK       0x08\r
-\r
-// control reg bits\r
-#define UART_CTSEN_CONTROL_MASK   0x8000\r
-#define UART_RTSEN_CONTROL_MASK   0x4000\r
-#define UART_RTS_CONTROL_MASK     0x0800\r
-#define UART_DTR_CONTROL_MASK     0x0400\r
-\r
-\r
-#endif \r
diff --git a/ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.c b/ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.c
new file mode 100755 (executable)
index 0000000..8da3681
--- /dev/null
@@ -0,0 +1,84 @@
+/** @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 <ArmEb/ArmEb.h>
+
+RETURN_STATUS
+EFIAPI
+GdbSerialLibConstructor (
+  VOID
+  )
+{
+  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
+  )  
+{
+  return FALSE;
+}
+
+CHAR8
+EFIAPI
+GdbGetChar (
+  VOID
+  )
+{
+  return (CHAR8)0;
+}
+
+VOID
+EFIAPI
+GdbPutChar (
+  IN  CHAR8   Char
+  )
+{
+  return;
+}
+
+VOID
+GdbPutString (
+  IN CHAR8  *String
+  )
+{
+  while (*String != '\0') {
+    GdbPutChar (*String);
+    String++;
+  }
+}
+
+
+
+
diff --git a/ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.inf b/ArmEbPkg/Library/GdbSerialLib/GdbSerialLib.inf
new file mode 100755 (executable)
index 0000000..86c9dc9
--- /dev/null
@@ -0,0 +1,37 @@
+#/** @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                      = E8EA1309-2F14-428f-ABE3-7016CE4B4305
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = GdbSerialLib
+
+  CONSTRUCTOR                    = GdbSerialLibConstructor
+
+
+[Sources.common]
+  GdbSerialLib.c
+
+
+[Packages]
+  MdePkg/MdePkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  ArmEbPkg/ArmEbPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib   
+
index fa427b6ecca6d7903935db660b98bfca93f417a2..85f347f4d0082f129c180497a21d0dcb13ec44ef 100644 (file)
 #include <PiDxe.h>\r
 \r
 #include <Library/PcdLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/CacheMaintenanceLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/EfiResetSystemLib.h>\r
 \r
-#include <ArmEbUart.h>\r
+#include <ArmEb/ArmEb.h>\r
 \r
 /**\r
   Resets the entire platform.\r
index 92e132080fd68107c8e0f340220952a2db173be2..2dfa299dbdadd093d6e849c526574a9e10bb7538 100644 (file)
@@ -16,7 +16,7 @@
 [Defines]\r
   INF_VERSION                    = 0x00010005\r
   BASE_NAME                      = ArmEbResetSystemLib\r
-  FILE_GUID                      = DA6BF954-F0FF-4A1A-88D7-16560B9A9D20\r
+  FILE_GUID                      = CEFFA65C-B568-453e-9E11-B81AE683D035\r
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = EfiResetSystemLib\r
   ResetSystemLib.c\r
 \r
 [Packages]\r
-  ArmPkg/ArmPkg.dec\r
   MdePkg/MdePkg.dec\r
   EmbeddedPkg/EmbeddedPkg.dec\r
   ArmEbPkg/ArmEbPkg.dec\r
 \r
-[Pcd.common]\r
-  gArmTokenSpaceGuid.PcdCpuResetAddress\r
-  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress\r
-  \r
 [LibraryClasses]\r
   DebugLib\r
-  BeagleBoardSystemLib\r
index 8d292520e295ac51670c9fb698fe05cc4fc9023a..735c5ddab82a5b8dd7bac1bd609f8d59a65aface 100644 (file)
@@ -19,7 +19,8 @@
 #include <Library/SerialPortLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/IoLib.h>\r
-#include <ArmEbUart.h>\r
+\r
+#include <ArmEb/ArmEb.h>\r
 \r
 /*\r
 \r
index 6e889f7eb653d079b3078eda2958d46e424ad78f..298e7e78c068ffc2545e9b22e6f77a66efc53ad2 100644 (file)
@@ -16,7 +16,7 @@
 [Defines]\r
   INF_VERSION                    = 0x00010005\r
   BASE_NAME                      = ArmEbSerialPortLib\r
-  FILE_GUID                      = 3019EF69-DDE6-4E23-A511-1A8C0279345A\r
+  FILE_GUID                      = C653196A-3BE1-4ec7-850B-DB7E0A16150F\r
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = SerialPortLib\r
diff --git a/ArmEbPkg/Library/TimerLib/TimerLib.c b/ArmEbPkg/Library/TimerLib/TimerLib.c
new file mode 100755 (executable)
index 0000000..c2a2a90
--- /dev/null
@@ -0,0 +1,97 @@
+/** @file\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 <Base.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/TimerLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/IoLib.h>\r
+\r
+\r
+UINTN\r
+EFIAPI\r
+MicroSecondDelay (\r
+  IN  UINTN MicroSeconds\r
+  )\r
+{\r
+  UINT64  NanoSeconds;\r
+  \r
+  NanoSeconds = MultU64x32 (MicroSeconds, 1000);\r
+\r
+  while (NanoSeconds > (UINTN)-1) { \r
+    NanoSecondDelay((UINTN)-1);\r
+    NanoSeconds -= (UINTN)-1;\r
+  }\r
+\r
+  NanoSecondDelay (NanoSeconds);\r
+\r
+  return MicroSeconds;\r
+}\r
+\r
+UINTN\r
+EFIAPI\r
+NanoSecondDelay (\r
+  IN  UINTN NanoSeconds\r
+  )\r
+{\r
+  UINT32  Delay;\r
+  UINT32  StartTime;\r
+  UINT32  CurrentTime;\r
+  UINT32  ElapsedTime;\r
+\r
\r
+  Delay = (NanoSeconds / PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)) + 1;\r
+\r
+  StartTime = MmioRead32 (0);\r
+  do \r
+  {\r
+    CurrentTime = 0ULL;\r
+    ElapsedTime = CurrentTime - StartTime;\r
+  } while (ElapsedTime < Delay);\r
+\r
+  NanoSeconds = ElapsedTime * PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);\r
+\r
+  return NanoSeconds;\r
+}\r
+\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounter (\r
+  VOID\r
+  )\r
+{ \r
+  return (UINT64)0ULL;\r
+}\r
+\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounterProperties (\r
+  OUT UINT64  *StartValue,  OPTIONAL\r
+  OUT UINT64  *EndValue     OPTIONAL\r
+  )\r
+{\r
+  if (StartValue != NULL) {\r
+    // Timer starts with the reload value\r
+    *StartValue = (UINT64)0ULL;\r
+  }\r
+  \r
+  if (EndValue != NULL) {\r
+    // Timer counts up to 0xFFFFFFFF\r
+    *EndValue = 0xFFFFFFFF;\r
+  }\r
+  \r
+  return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);\r
+}\r
diff --git a/ArmEbPkg/Library/TimerLib/TimerLib.inf b/ArmEbPkg/Library/TimerLib/TimerLib.inf
new file mode 100755 (executable)
index 0000000..8f1697c
--- /dev/null
@@ -0,0 +1,44 @@
+#/** @file\r
+# Timer library implementation\r
+#\r
+# A non-functional instance of the Timer Library that can be used as a template\r
+#  for the implementation of a functional timer library instance. This library instance can\r
+#  also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer\r
+#  services as well as EBC modules that require timer services\r
+# Copyright (c) 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                      = ArmEbTimerLib\r
+  FILE_GUID                      = B2333114-328B-47cc-8E5E-F64E22E4B417\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = TimerLib \r
+\r
+[Sources.common]\r
+  TimerLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  EmbeddedPkg/EmbeddedPkg.dec\r
+  ArmEbPkg/ArmEbPkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
+  IoLib\r
+  BaseLib\r
+\r
+[Pcd]\r
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz\r
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds\r
+\r
diff --git a/ArmEbPkg/b.bat b/ArmEbPkg/b.bat
new file mode 100755 (executable)
index 0000000..adb2505
--- /dev/null
@@ -0,0 +1,50 @@
+@REM Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
+@REM This program and the accompanying materials
+@REM are licensed and made available under the terms and conditions of the BSD License
+@REM which accompanies this distribution.  The full text of the license may be found at
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+@REM
+
+@REM Example usage of this script. default is a DEBUG build
+@REM b
+@REM b clean
+@REM b release 
+@REM b release clean
+@REM b -v -y build.log
+
+ECHO OFF
+@REM Setup Build environment. Sets WORKSPACE and puts build in path
+CALL ..\edksetup.bat
+
+@REM Set for tools chain. Currently RVCT31
+SET TARGET_TOOLS=RVCT31
+SET TARGET=DEBUG
+\r
+@if /I "%1"=="RELEASE" (\r
+  @REM If 1st argument is release set TARGET to RELEASE and shift arguments to remove it \r
+  SET TARGET=RELEASE\r
+  shift /1\r
+)\r
+
+SET BUILD_ROOT=%WORKSPACE%\Build\ArmEb\%TARGET%_%TARGET_TOOLS%
+
+@REM Build the ARM EB firmware and creat an FD (FLASH Device) Image.
+CALL build -p ArmEbPkg\ArmEbPkg.dsc -a ARM -t RVCT31 -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
+@if ERRORLEVEL 1 goto Exit
+
+@if /I "%1"=="CLEAN" goto Clean\r
+
+
+ECHO Patching ..\Debugger_scripts ...
+SET DEBUGGER_SCRIPT=Debugger_scripts
+@for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
+  @CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW  %WORKSPACE%
+)
+
+:Exit
+EXIT /B
+
+:Clean
diff --git a/ArmEbPkg/ba.bat b/ArmEbPkg/ba.bat
new file mode 100755 (executable)
index 0000000..cd5eb50
--- /dev/null
@@ -0,0 +1,49 @@
+@REM Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
+@REM This program and the accompanying materials
+@REM are licensed and made available under the terms and conditions of the BSD License
+@REM which accompanies this distribution.  The full text of the license may be found at
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+@REM
+
+@REM Example usage of this script. default is a DEBUG build
+@REM b
+@REM b clean
+@REM b release 
+@REM b release clean
+@REM b -v -y build.log
+
+ECHO OFF
+@REM Setup Build environment. Sets WORKSPACE and puts build in path
+CALL ..\edksetup.bat
+
+@REM Set for tools chain. Currently ARMGCC
+SET TARGET_TOOLS=ARMGCC
+SET TARGET=DEBUG
+\r
+@if /I "%1"=="RELEASE" (\r
+  @REM If 1st argument is release set TARGET to RELEASE and shift arguments to remove it \r
+  SET TARGET=RELEASE\r
+  shift /1\r
+)\r
+
+SET BUILD_ROOT=%WORKSPACE%\Build\ArmEb\%TARGET%_%TARGET_TOOLS%
+
+@REM Build the Beagle Board firmware and creat an FD (FLASH Device) Image.
+CALL build -p ArmEbPkg\ArmEbPkg.dsc -a ARM -t %TARGET_TOOLS% -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
+@if ERRORLEVEL 1 goto Exit
+
+@if /I "%1"=="CLEAN" goto Clean\r
+
+ECHO Patching ..\Debugger_scripts ...
+SET DEBUGGER_SCRIPT=Debugger_scripts
+@for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
+  @CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW  %WORKSPACE%
+)
+
+:Exit
+EXIT /B
+
+:Clean
diff --git a/ArmEbPkg/build.sh b/ArmEbPkg/build.sh
new file mode 100755 (executable)
index 0000000..485936b
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/bash
+# 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.
+#
+
+set -e
+shopt -s nocasematch
+
+function process_debug_scripts {
+  if [[ -d $1 ]]; then
+    for filename in `ls $1`
+    do
+      sed -e "s@ZZZZZZ@$BUILD_ROOT@g" -e "s@WWWWWW@$WORKSPACE@g" \
+            "$1/$filename" \
+            > "$BUILD_ROOT/$filename"
+
+      #For ARMCYGWIN, we have to change /cygdrive/c to c:
+      if [[ $TARGET_TOOLS == RVCT31CYGWIN ]]
+      then
+        mv "$BUILD_ROOT/$filename" "$BUILD_ROOT/$filename"_temp
+        sed -e "s@/cygdrive/\(.\)@\1:@g" \
+              "$BUILD_ROOT/$filename"_temp \
+              > "$BUILD_ROOT/$filename"
+        rm -f "$BUILD_ROOT/$filename"_temp
+      fi
+    done
+  fi
+}
+
+
+#
+# Setup workspace if it is not set
+#
+if [ -z "$WORKSPACE" ]
+then
+  echo Initializing workspace
+  cd ..
+  export EDK_TOOLS_PATH=`pwd`/BaseTools
+  source edksetup.sh BaseTools
+else
+  echo Building from: $WORKSPACE
+fi
+
+#
+# Pick a default tool type for a given OS
+#
+case `uname` in
+  CYGWIN*) 
+      TARGET_TOOLS=RVCT31CYGWIN 
+      ;;
+  Linux*)  
+      # Not tested
+      TARGET_TOOLS=ARMGCC 
+      ;;
+  Darwin*) 
+      Major=$(uname -r | cut -f 1 -d '.')
+      if [[ $Major == 9 ]]
+      then
+        # Not supported by this open source project
+        TARGET_TOOLS=XCODE31
+      else 
+        TARGET_TOOLS=XCODE32
+      fi  
+      ;;
+esac
+
+TARGET=DEBUG
+for arg in "$@"
+do
+  if [[ $arg == RELEASE ]]; 
+  then
+    TARGET=RELEASE
+  fi
+done
+
+BUILD_ROOT=$WORKSPACE/Build/ArmEb/"$TARGET"_"$TARGET_TOOLS"
+
+if  [[ ! -e $EDK_TOOLS_PATH/Source/C/bin ]];
+then
+  # build the tools if they don't yet exist
+  echo Building tools: $EDK_TOOLS_PATH
+  make -C $EDK_TOOLS_PATH
+else
+  echo using prebuilt tools
+fi
+
+#
+# Build the edk2 ArmEb code
+#
+if [[ $TARGET == RELEASE ]]; then
+  build -p $WORKSPACE/ArmEbPkg/ArmEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET -D DEBUG_TARGET=RELEASE $2 $3 $4 $5 $6 $7 $8
+else
+  build -p $WORKSPACE/ArmEbPkg/ArmEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET $1 $2 $3 $4 $5 $6 $7 $8
+fi
+
+
+for arg in "$@"
+do
+  if [[ $arg == clean ]]; then
+    # no need to post process if we are doing a clean
+    exit
+  elif [[ $arg == cleanall ]]; then
+    make -C $EDK_TOOLS_PATH clean
+    exit
+    
+  fi
+done
+
+
+echo Creating debugger scripts
+process_debug_scripts $WORKSPACE/ArmEbPkg/Debugger_scripts
+