From 1d5d0ae92d95410f20bc6daab7a47e129fb2547a Mon Sep 17 00:00:00 2001 From: andrewfish Date: Tue, 1 Feb 2011 05:41:42 +0000 Subject: Add ArmPlatformPkg from ARM Ltd. patch. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11291 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/Documentation/ArmPlatformPkg.txt | 41 +++++ .../Documentation/ArmRealViewRTSMInstructions.txt | 33 ++++ .../Documentation/ArmVExpressInstructions.txt | 176 +++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 ArmPlatformPkg/Documentation/ArmPlatformPkg.txt create mode 100644 ArmPlatformPkg/Documentation/ArmRealViewRTSMInstructions.txt create mode 100644 ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt (limited to 'ArmPlatformPkg/Documentation') diff --git a/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt b/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt new file mode 100644 index 0000000000..49152722d4 --- /dev/null +++ b/ArmPlatformPkg/Documentation/ArmPlatformPkg.txt @@ -0,0 +1,41 @@ +Porting UEFI to a ARM platform +------------------------------ +1. Create the new platform directory under ArmPlatformPkg + +2. Create its DSC and FDF files into this new directory. These files can be copied from ArmVExpress-CTA9x4.dsc and ArmVExpress-CTA9x4.fdf; and adapted following the requirement of your platform. + +3. Set up the PCDs required by ArmPlatformPkg in your FDF or DSC files + +PCD Description +gArmTokenSpaceGuid.PcdSecureFdBaseAddress : Base address of your Secure Firmware +gArmTokenSpaceGuid.PcdSecureFdSize : Size in byte of your Secure Firmware gEmbeddedTokenSpaceGuid. +PcdEmbeddedFdBaseAddress : Base Address of your Non-Secure Firmware gEmbeddedTokenSpaceGuid. +PcdEmbeddedFdSize : Size in bytes of your Non-Secure Firmware +gArmTokenSpaceGuid.PcdL2x0ControllerBase : Base Address of your L2x0 controller +gArmTokenSpaceGuid.PcdGicDistributorBase : Base address of the Distributor of your General Interrupt Controller gArmTokenSpaceGuid. +PcdGicInterruptInterfaceBase : Base address of the Interface of your General Interrupt Controller gArmVExpressTokenSpaceGuid. +PcdCPUCoresSecStackBase : Top of Secure Stack for Secure World gArmVExpressTokenSpaceGuid. +PcdCPUCoreSecStackSize : Size of the stack for each of the 4 CPU cores gArmVExpressTokenSpaceGuid. +PcdCPUCoresSecMonStackBase : Top of Stack for Monitor World gArmVExpressTokenSpaceGuid. +PcdCPUCoreSecMonStackSize : Size of the stack for each of the 4 CPU cores gArmVExpressTokenSpaceGuid. +PcdCPUCoresNonSecStackBase : Top of SEC Stack for Normal World gArmVExpressTokenSpaceGuid. +PcdCPUCoresNonSecStackSize : Size of the stack for each of the 4 CPU Cores gArmVExpressTokenSpaceGuid. +PcdPeiServicePtrAddr : Cached value of PeiServicesTable + +4. Implement 'ArmPlatformLib' for your platform following the interface defined by ArmPlatformPkg\Include\Library\ArmPlatformLib.h. + +Functions to implement: + +VOID ArmPlatformIsMemoryInitialized(VOID); +VOID ArmPlatformInitializeBootMemory(VOID); +VOID ArmPlatformInitializeSystemMemory(VOID); +VOID ArmPlatformBootRemapping(VOID); +UINTN ArmPlatformTrustzoneSupported(VOID); +VOID ArmPlatformTrustzoneInit(VOID); +VOID ArmPlatformGetPeiMemory ( + OUT UINTN* PeiMemoryBase, + OUT UINTN* PeiMemorySize); +VOID ArmPlatformGetVirtualMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap); +VOID ArmPlatformGetEfiMemoryMap ( + OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap) diff --git a/ArmPlatformPkg/Documentation/ArmRealViewRTSMInstructions.txt b/ArmPlatformPkg/Documentation/ArmRealViewRTSMInstructions.txt new file mode 100644 index 0000000000..890f0fb2e6 --- /dev/null +++ b/ArmPlatformPkg/Documentation/ArmRealViewRTSMInstructions.txt @@ -0,0 +1,33 @@ +============================================== += ARM RealView Emulation Board Documentation = +============================================== + + +Howto build UEFI RealView EB for RealTime System Model +------------------------------------------------------ + +1. Set up the environment. And build the EDK2’s tools +export EDK_TOOLS_PATH=`pwd`/BaseTools +. edksetup.sh `pwd`/BaseTools/ +make -C $EDK_TOOLS_PATH + +2. Build the ARM RealView EB UEFI Firmware +build -a ARM -p ArmPlatformPkg/ArmRealViewEBPkg/ArmRealViewEb-RTSM-A8.dsc -t RVCT + + +Howto test UEFI RealView EB on RealTime System Model - Example Cortex A8 +------------------------------------------------------------------------ + + 1. Build 'ArmRealViewEb-RTSM-A8.dsc' + + 2. To Run ArmRealViewEbPkg on the RTSM + 1. Start RealView Debugger + 2. Target > "Connect to Target" + 3. Add RTSM + 4. Configure this new RTSM. + 5. Choose CortexA8 + 6. Setup the 'fname' of baseboard.flashldr_0 with your FD file (eg: c:\dev\edk2\Build\ArmRealViewEb-RTSM-A8\DEBUG_RVCT\FV\ARMREALVIEWEB_EFI.fd) + 7. Turn use_s8 to TRUE in baseboard.sp810_sysctrl + 8. Turn uart_enable to TRUE in baseboard.uart_0 + 4. Connect a telnet client to the port 5000 of your localhost + 5. Launch the program \ No newline at end of file diff --git a/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt b/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt new file mode 100644 index 0000000000..db901c4936 --- /dev/null +++ b/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt @@ -0,0 +1,176 @@ +======================================= += ARM Versatile Express Documentation = +======================================= + +Status +------ +Build and Run on EDK2 Subversion revision 11251 +Requirements +- RVCTv3 (untested) or RVCTv4 or ARMGCC (Code Sourcery q201009) +- Using Ubuntu: gcc, make, uuid-dev +- Using Cygwin: gcc, make, e2fsprogs (needed for uuid.h) + +Serial Terminal settings +- Baud Rates: 38400 +- Data: 8 bit +- Parity: None +- Flow Control: None + + +Use ICE debugger with Versatile Express +--------------------------------------- +Prior to use ICE debugger with Versatile Express, you will need to update the version of the ICE's firmware. +If you have not installed RealView 4.0 SP3, do it. +Open "RealView ICE Update" and "Install Firmware Update ...". Install "[ARM_INSTALL_PATH]\RVI\Firmware\3.4\11\ARM-RVI-3.4.0-25-base.rvi" and "[ARM_INSTALL_PATH]\RVI\Firmware\3.4\22\ARM-RVI-3.4.59-59-patch.rvi". + + +Howto build UEFI Versatile Express +---------------------------------- +For Cygwin +---------- + +For the first time +****************** +1. Get EDK2 from Tianocore Subversion repository +svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 edk2 --username guest + +2. Get FatPkg from EDK2 SVN repository: +cd edk2 +svn co https://edk2-fatdriver2.svn.sourceforge.net/svnroot/edk2-fatdriver2/trunk/FatPkg FatPkg --username guest + +3. Set up the environment. And build the EDK2’s tools +export EDK_TOOLS_PATH=`pwd`/BaseTools +. edksetup.sh `pwd`/BaseTools/ +make -C $EDK_TOOLS_PATH + +4. Build the ARM Versatile Express UEFI Firmware +build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t RVCTCYGWIN + +5. Edit the ARM Versatile Express configuration file config.txt to declare the location of the UEFI firmware in NOR Flash +TOTALIMAGES: 5 ;Number of Images (Max : 32) +NOR0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE +NOR0ADDRESS: BOOT ;Image Flash Address +NOR0FILE: \SOFTWARE\bm_v209.axf ;Image File Name +NOR1UPDATE: AUTO ;IMAGE UPDATE:NONE/AUTO/FORCE +NOR1ADDRESS: 44000000 ;Image Flash Address +NOR1FILE: \SOFTWARE\sec_uefi.bin ;Image File Name +NOR1LOAD: 0 ;Image Load Address +NOR1ENTRY: 0 ;Image Entry Point +NOR2UPDATE: AUTO ;IMAGE UPDATE:NONE/AUTO/FORCE +NOR2ADDRESS: 45000000 ;Image Flash Address +NOR2FILE: \SOFTWARE\uefi.bin ;Image File Name +NOR2LOAD: 45000000 ;Image Load Address +NOR2ENTRY: 45000000 ;Image Entry Point +NOR3UPDATE: AUTO ;IMAGE UPDATE:NONE/AUTO/FORCE +NOR3ADDRESS: 46000000 ;Image Flash Address +NOR3FILE: \SOFTWARE\kernel.bin ;Image File Name +NOR3LOAD: 46000000 ;Image Load Address +NOR3ENTRY: 46000000 ;Image Entry Point +NOR4UPDATE: AUTO ;IMAGE UPDATE:NONE/AUTO/FORCE +NOR4ADDRESS: 40000000 ;Image Flash Address +NOR4NAME: BOOTSCRIPT ;Image Name +NOR4FILE: \SOFTWARE\bootscr.txt ;Image File Name + +6. To select second NOR Flash as a booting device, replace in the ARM Versatile Express file \SITE1\HBI0191B\board.txt: +SCC: 0x004 0x00001F09 +By: +SCC: 0x004 0x10001F09 + +7. Copy Build/ArmVExpress-CTA9x4/DEBUG_RVCTCYGWIN/FV/SEC_ARMVEXPRESS_EFI.fd to the ARM Versatile Express mass storage (available when the board is connected through USB to your host machine) under the folder SOTWARE and name sec_uefi.bin. Example for cygwin: +cp Build/ArmVExpress-CTA9x4/DEBUG_RVCTCYGWIN/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin + +8. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. + +9. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger +readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_RVCTCYGWIN\FV\ARMVEXPRESS_EFI.fd"=0x80000000 + +10. Resume the execution from RealView Debugger + +For all subsequent times +************************ +1. Build ARM Versatile Express UEFI Firmware +build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t RVCTCYGWIN + +2. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. + +3. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger +readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_RVCTCYGWIN\FV\ARMVEXPRESS_EFI.fd"=0x80000000 + +4. Resume the execution + + +For RealView Compiler Toolchain on Windows +------------------------------------------ +The command line window needs to be the one from Visual Studio to get the environment variables required to get some development tools (the windows compiler for BaseTools and `nmake`). +The EDK2 toolchain name for ARM RealView Compiler Toolchain under a Windows environment is `RVCT`. The EDK2 build system will automatically pick up the RVCT toolchain defined in your PATH. If you want to use a specific version, set the environment variable 'RVCT_TOOLS_PATH': +set RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH] + + +For RealView Compiler Toolchain on Linux +---------------------------------------- +The EDK2 toolchain name for ARM RealView under a Linux environment is `RVCTLINUX`. The EDK2 build system will automatically pick up the RVCT toolchain defined in your PATH. If you want to use a specific version, set the environment variable 'RVCT_TOOLS_PATH': +export RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH] + + +For ARM GNU GCC on Linux +------------------------ +The EDK2 toolchain name for ARM RealView under a Linux environment is `ARMGCC`. EDK2 requires Bash Shell to be built on Linux. +The ARMGCC toolchain is expected to be found in your PATH. ARM Edk2 has been tested with 'CodeSourcery G++ Lite 2010.09-51 - EABI Version'. +If you decide to use a specific version, set the environment variable 'ARMGCC_TOOLS_PATH': +export ARMGCC_TOOLS_PATH=[YOUR_CODESOURCERY_TOOLCHAIN_PATH] +Example: +export ARMGCC_TOOLS_PATH=/Work/arm-2010.09/bin/ +Compiling UEFI ArmVE as a standalone firmware +The full ArmVe UEFI firmware can be written into NOR Flash to allow the entire boot sequence to be done after a cold boot. + + +To support the standalone mode: +------------------------------- +build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t RVCTCYGWIN -D EDK2_ARMVE_STANDALONE=1 +ARMVEXPRESS_EFI.fd is required to be copied into the ARM Versatile Express board: +cp Build/ArmVExpress-CTA9x4-Standalone/DEBUG_RVCTCYGWIN/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin +cp Build/ArmVExpress-CTA9x4-Standalone/DEBUG_RVCTCYGWIN/FV/ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/uefi.bin + + +Trustzone Support +----------------- +ArmVE's UEFI supports booting Trustzone (two worlds: Secure and Normal Worlds) and No Trustzone (one world: the CPU remains in Secure World) supports. Trustzone support is enabled by Enabling SMC TZASC in the Test Chip SCC Register 1. This register can only be changed by editing the configuration file of your Versatile Express board: E:\SITE1\HBI0191B\board.txt Changing: +SCC: 0x004 0x10001F09 +For: +SCC: 0x004 0x10003F09 + + +Booting Linux +------------- +ArmVe's BDS expects a Linux kernel at 0x46000000 (2nd NOR Flash). This location is also defined in the config.txt file of the motherboard (same file as the one that defines UEFI firmwares location). The Linux kernel at this location is a copy of \SOFTWARE\kernel.bin as refered in config.txt. +To boot on a different kernel, you will need to edit [EDK2_ROOT]\ArmVePkg\Bds\BdsEntry.c +#define LINUX_KERNEL L"VenHw(02118005-9DA7-443a-92D5-781F022AEDBB)/MemoryMapped(0,0x46000000,0x462F0000)" +#define FDT 0 +#define LINUX_ATAG "rdinit=/bin/ash debug earlyprintk console=ttyAMA0,38400 mem=1G" +The macros LINUX_KERNEL and FDT expect a UEFI Device Path. + +Example of UEFI Device Path: + +// Load FDT binary from the Firmware Volume (mapped at 0x80000000) +#define LINUX_KERNEL L"MemoryMapped(11,0x80000000,0x6FEFFFFF)\\zImage.fdt" + +// Linux Kernel from a SD Card +#define LINUX_KERNEL L"VenHw(621B6FA5-4DC1-476F-B9D8-52C557D81070)/HD(1,MBR,0x00000000,0xF9,0x3C8907)\\boot\\zImage.fdt" + +// Kernel from SATA HD - Partition 2 +#define LINUX_KERNEL L"Acpi(PNP0A03,0)/Pci(0|0)/Pci(0|0)/Pci(5|0)/Pci(0|0)/Sata(0,0,0)/HD(2,MBR,0x00076730,0x1F21BF,0x1F21BF)\\boot\\zImage.fdt" + +// Kernel from NOR Flash +#define LINUX_KERNEL L"VenHw(02118005-9DA7-443a-92D5-781F022AEDBB)/MemoryMapped(0,0x46000000,0x462F0000)" + + +UEFI Memory Maps for ARM Versatile Express +------------------------------------------ +Figure 1: EFI Memory Map in the Temporary Memory +See ArmVExpressMemoryMaps_TemporaryMemoryMap.png + +Figure 2: CPU Core stack in the Temporary Memory +See ArmVExpressMemoryMaps_TemporaryStack.png + +Figure 3: EFI Memory Map in the Permanent Memory +See ArmVExpressMemoryMaps_PermanentMemoryMap.png -- cgit v1.2.3