]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: Added ARM Aarch64 architecture support
authorHarry Liebel <Harry.Liebel@arm.com>
Mon, 29 Jul 2013 09:52:18 +0000 (09:52 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 29 Jul 2013 09:52:18 +0000 (09:52 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14513 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/AArch64/ProcessorBind.h [new file with mode: 0644]
MdePkg/Include/Protocol/DebugSupport.h
MdePkg/Include/Uefi/UefiBaseType.h
MdePkg/Include/Uefi/UefiSpec.h
MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
new file mode 100644 (file)
index 0000000..72d38ec
--- /dev/null
@@ -0,0 +1,135 @@
+/** @file\r
+  Processor or Compiler specific defines and types for AArch64.\r
+\r
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  Portions copyright (c) 2011 - 2013, ARM Ltd. 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 __PROCESSOR_BIND_H__\r
+#define __PROCESSOR_BIND_H__\r
+\r
+///\r
+/// Define the processor type so other code can make processor based choices\r
+///\r
+#define MDE_CPU_AARCH64\r
+\r
+//\r
+// Make sure we are using the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+#pragma pack()\r
+#endif\r
+\r
+#if _MSC_EXTENSIONS\r
+  //\r
+  // use Microsoft* C complier dependent interger width types\r
+  //\r
+  typedef unsigned __int64    UINT64;\r
+  typedef __int64             INT64;\r
+  typedef unsigned __int32    UINT32;\r
+  typedef __int32             INT32;\r
+  typedef unsigned short      UINT16;\r
+  typedef unsigned short      CHAR16;\r
+  typedef short               INT16;\r
+  typedef unsigned char       BOOLEAN;\r
+  typedef unsigned char       UINT8;\r
+  typedef char                CHAR8;\r
+  typedef char                INT8;\r
+#else\r
+  //\r
+  // Assume standard AARCH64 alignment.\r
+  typedef unsigned long long  UINT64;\r
+  typedef long long           INT64;\r
+  typedef unsigned int        UINT32;\r
+  typedef int                 INT32;\r
+  typedef unsigned short      UINT16;\r
+  typedef unsigned short      CHAR16;\r
+  typedef short               INT16;\r
+  typedef unsigned char       BOOLEAN;\r
+  typedef unsigned char       UINT8;\r
+  typedef char                CHAR8;\r
+  typedef char                INT8;\r
+#endif\r
+\r
+///\r
+/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,\r
+/// 8 bytes on supported 64-bit processor instructions)\r
+///\r
+typedef UINT64  UINTN;\r
+\r
+///\r
+/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,\r
+/// 8 bytes on supported 64-bit processor instructions)\r
+///\r
+typedef INT64   INTN;\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+\r
+///\r
+/// A value of native width with the highest bit set.\r
+///\r
+#define MAX_BIT      0x8000000000000000\r
+\r
+///\r
+/// A value of native width with the two highest bits set.\r
+///\r
+#define MAX_2_BITS   0xC000000000000000\r
+\r
+///\r
+/// Maximum legal AARCH64  address\r
+///\r
+#define MAX_ADDRESS  0xFFFFFFFFFFFFFFFF\r
+\r
+///\r
+/// The stack alignment required for AARCH64\r
+///\r
+#define CPU_STACK_ALIGNMENT  16\r
+\r
+//\r
+// Modifier to ensure that all protocol member functions and EFI intrinsics\r
+// use the correct C calling convention. All protocol member functions and\r
+// EFI intrinsics are required to modify their member functions with EFIAPI.\r
+//\r
+#define EFIAPI\r
+\r
+#if defined(__GNUC__)\r
+  ///\r
+  /// For GNU assembly code, .global or .globl can declare global symbols.\r
+  /// Define this macro to unify the usage.\r
+  ///\r
+  #define ASM_GLOBAL .globl\r
+\r
+  #define GCC_ASM_EXPORT(func__)  \\r
+         .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\\r
+         .type ASM_PFX(func__), %function\r
+\r
+  #define GCC_ASM_IMPORT(func__)  \\r
+         .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r
+\r
+#endif\r
+\r
+/**\r
+  Return the pointer to the first instruction of a function given a function pointer.\r
+  On ARM CPU architectures, these two pointer values are the same,\r
+  so the implementation of this macro is very simple.\r
+\r
+  @param  FunctionPointer   A pointer to a function.\r
+\r
+  @return The pointer to the first instruction of a function given a function pointer.\r
+\r
+**/\r
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
+\r
+#endif\r
index 8ba6c4909bddf6d03f2f72e971328d8bffbb5102..52c4042bacee3a457b53059e3a7d81332642a1da 100644 (file)
@@ -1,11 +1,13 @@
 /** @file\r
 /** @file\r
-  DebugSupport protocol and supporting definitions as defined in the UEFI2.0\r
+  DebugSupport protocol and supporting definitions as defined in the UEFI2.4\r
   specification.\r
 \r
   The DebugSupport protocol is used by source level debuggers to abstract the\r
   processor and handle context save and restore operations.\r
 \r
 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
   specification.\r
 \r
   The DebugSupport protocol is used by source level debuggers to abstract the\r
   processor and handle context save and restore operations.\r
 \r
 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
+\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -517,6 +519,97 @@ typedef struct {
   UINT32  IFAR;\r
 } EFI_SYSTEM_CONTEXT_ARM;\r
 \r
   UINT32  IFAR;\r
 } EFI_SYSTEM_CONTEXT_ARM;\r
 \r
+\r
+///\r
+///  AARCH64 processor exception types.\r
+///\r
+#define EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS    0\r
+#define EXCEPT_AARCH64_IRQ                       1\r
+#define EXCEPT_AARCH64_FIQ                       2\r
+#define EXCEPT_AARCH64_SERROR                    3\r
+\r
+///\r
+/// For coding convenience, define the maximum valid ARM exception.\r
+///\r
+#define MAX_AARCH64_EXCEPTION EXCEPT_AARCH64_SERROR\r
+\r
+typedef struct {\r
+  // General Purpose Registers\r
+  UINT64  X0;\r
+  UINT64  X1;\r
+  UINT64  X2;\r
+  UINT64  X3;\r
+  UINT64  X4;\r
+  UINT64  X5;\r
+  UINT64  X6;\r
+  UINT64  X7;\r
+  UINT64  X8;\r
+  UINT64  X9;\r
+  UINT64  X10;\r
+  UINT64  X11;\r
+  UINT64  X12;\r
+  UINT64  X13;\r
+  UINT64  X14;\r
+  UINT64  X15;\r
+  UINT64  X16;\r
+  UINT64  X17;\r
+  UINT64  X18;\r
+  UINT64  X19;\r
+  UINT64  X20;\r
+  UINT64  X21;\r
+  UINT64  X22;\r
+  UINT64  X23;\r
+  UINT64  X24;\r
+  UINT64  X25;\r
+  UINT64  X26;\r
+  UINT64  X27;\r
+  UINT64  X28;\r
+  UINT64  FP;   // x29 - Frame pointer\r
+  UINT64  LR;   // x30 - Link Register\r
+  UINT64  SP;   // x31 - Stack pointer\r
+\r
+  // FP/SIMD Registers\r
+  UINT64  V0[2];\r
+  UINT64  V1[2];\r
+  UINT64  V2[2];\r
+  UINT64  V3[2];\r
+  UINT64  V4[2];\r
+  UINT64  V5[2];\r
+  UINT64  V6[2];\r
+  UINT64  V7[2];\r
+  UINT64  V8[2];\r
+  UINT64  V9[2];\r
+  UINT64  V10[2];\r
+  UINT64  V11[2];\r
+  UINT64  V12[2];\r
+  UINT64  V13[2];\r
+  UINT64  V14[2];\r
+  UINT64  V15[2];\r
+  UINT64  V16[2];\r
+  UINT64  V17[2];\r
+  UINT64  V18[2];\r
+  UINT64  V19[2];\r
+  UINT64  V20[2];\r
+  UINT64  V21[2];\r
+  UINT64  V22[2];\r
+  UINT64  V23[2];\r
+  UINT64  V24[2];\r
+  UINT64  V25[2];\r
+  UINT64  V26[2];\r
+  UINT64  V27[2];\r
+  UINT64  V28[2];\r
+  UINT64  V29[2];\r
+  UINT64  V30[2];\r
+  UINT64  V31[2];\r
+\r
+  UINT64  ELR;  // Exception Link Register\r
+  UINT64  SPSR; // Saved Processor Status Register\r
+  UINT64  FPSR; // Floating Point Status Register\r
+  UINT64  ESR;  // Exception syndrome register\r
+  UINT64  FAR;  // Fault Address Register\r
+} EFI_SYSTEM_CONTEXT_AARCH64;\r
+\r
+\r
 ///\r
 /// Universal EFI_SYSTEM_CONTEXT definition.\r
 ///\r
 ///\r
 /// Universal EFI_SYSTEM_CONTEXT definition.\r
 ///\r
@@ -526,6 +619,7 @@ typedef union {
   EFI_SYSTEM_CONTEXT_X64  *SystemContextX64;\r
   EFI_SYSTEM_CONTEXT_IPF  *SystemContextIpf;\r
   EFI_SYSTEM_CONTEXT_ARM  *SystemContextArm;\r
   EFI_SYSTEM_CONTEXT_X64  *SystemContextX64;\r
   EFI_SYSTEM_CONTEXT_IPF  *SystemContextIpf;\r
   EFI_SYSTEM_CONTEXT_ARM  *SystemContextArm;\r
+  EFI_SYSTEM_CONTEXT_AARCH64  *SystemContextAArch64;\r
 } EFI_SYSTEM_CONTEXT;\r
 \r
 //\r
 } EFI_SYSTEM_CONTEXT;\r
 \r
 //\r
@@ -566,7 +660,8 @@ typedef enum {
   IsaX64  = IMAGE_FILE_MACHINE_X64,            ///< 0x8664\r
   IsaIpf  = IMAGE_FILE_MACHINE_IA64,           ///< 0x0200\r
   IsaEbc  = IMAGE_FILE_MACHINE_EBC,            ///< 0x0EBC\r
   IsaX64  = IMAGE_FILE_MACHINE_X64,            ///< 0x8664\r
   IsaIpf  = IMAGE_FILE_MACHINE_IA64,           ///< 0x0200\r
   IsaEbc  = IMAGE_FILE_MACHINE_EBC,            ///< 0x0EBC\r
-  IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  ///< 0x01c2\r
+  IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED, ///< 0x01c2\r
+  IsaAArch64  = IMAGE_FILE_MACHINE_ARM64       ///< 0xAA64\r
 } EFI_INSTRUCTION_SET_ARCHITECTURE;\r
 \r
 \r
 } EFI_INSTRUCTION_SET_ARCHITECTURE;\r
 \r
 \r
index 3c14ea5a6440eb07ebefdd8feb4e1df4d2d4ee7c..b505e7de1e1a19f067901d679b68f5f9d7bd2916 100644 (file)
@@ -2,6 +2,8 @@
   Defines data types and constants introduced in UEFI.\r
 \r
 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   Defines data types and constants introduced in UEFI.\r
 \r
 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
+\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -241,6 +243,11 @@ typedef union {
 ///\r
 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED  0x01C2\r
 \r
 ///\r
 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED  0x01C2\r
 \r
+///\r
+/// PE32+ Machine type for AARCH64 A64 images.\r
+///\r
+#define EFI_IMAGE_MACHINE_AARCH64  0xAA64\r
+\r
 \r
 #if   defined (MDE_CPU_IA32)\r
 \r
 \r
 #if   defined (MDE_CPU_IA32)\r
 \r
@@ -270,6 +277,13 @@ typedef union {
 \r
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) \r
 \r
 \r
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) \r
 \r
+#elif defined (MDE_CPU_AARCH64)\r
+\r
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
+  (((Machine) == EFI_IMAGE_MACHINE_AARCH64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
+\r
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)\r
+\r
 #elif defined (MDE_CPU_EBC)\r
 \r
 ///\r
 #elif defined (MDE_CPU_EBC)\r
 \r
 ///\r
index 0dbabd8d630e1e30986921454502c7b3aab09dd9..887b68cf0558cd0d1c025d3a0b7730916e1647c1 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Include file that supports UEFI.\r
 \r
 /** @file\r
   Include file that supports UEFI.\r
 \r
-  This include file must contain things defined in the UEFI 2.3 specification.\r
-  If a code construct is defined in the UEFI 2.3 specification it must be included\r
+  This include file must contain things defined in the UEFI 2.4 specification.\r
+  If a code construct is defined in the UEFI 2.4 specification it must be included\r
   by this include file.\r
 \r
 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
   by this include file.\r
 \r
 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
@@ -1732,6 +1732,7 @@ EFI_STATUS
 // EFI Runtime Services Table\r
 //\r
 #define EFI_SYSTEM_TABLE_SIGNATURE      SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')\r
 // EFI Runtime Services Table\r
 //\r
 #define EFI_SYSTEM_TABLE_SIGNATURE      SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')\r
+#define EFI_2_40_SYSTEM_TABLE_REVISION  ((2 << 16) | (40))\r
 #define EFI_2_31_SYSTEM_TABLE_REVISION  ((2 << 16) | (31))\r
 #define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))\r
 #define EFI_2_20_SYSTEM_TABLE_REVISION  ((2 << 16) | (20))\r
 #define EFI_2_31_SYSTEM_TABLE_REVISION  ((2 << 16) | (31))\r
 #define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))\r
 #define EFI_2_20_SYSTEM_TABLE_REVISION  ((2 << 16) | (20))\r
@@ -2083,6 +2084,7 @@ typedef struct {
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"\r
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"\r
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"\r
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"\r
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"\r
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"\r
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"\r
 \r
 #if   defined (MDE_CPU_IA32)\r
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32\r
 \r
 #if   defined (MDE_CPU_IA32)\r
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32\r
@@ -2093,6 +2095,8 @@ typedef struct {
 #elif defined (MDE_CPU_EBC)\r
 #elif defined (MDE_CPU_ARM)\r
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_ARM\r
 #elif defined (MDE_CPU_EBC)\r
 #elif defined (MDE_CPU_ARM)\r
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_ARM\r
+#elif defined (MDE_CPU_AARCH64)\r
+  #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64\r
 #else\r
   #error Unknown Processor Type\r
 #endif\r
 #else\r
   #error Unknown Processor Type\r
 #endif\r
index 0bdfb438e8402a181d545ac8d3ba868d39a1b03a..e4f597888a22b0500ac8fc03cfac44551af74089 100644 (file)
@@ -27,7 +27,7 @@
 \r
 \r
 #\r
 \r
 \r
 #\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64\r
 #\r
 \r
 [Sources.IA32]\r
 #\r
 \r
 [Sources.IA32]\r
@@ -45,6 +45,9 @@
 [Sources.ARM]\r
   ArmCache.c\r
 \r
 [Sources.ARM]\r
   ArmCache.c\r
 \r
+[Sources.AARCH64]\r
+  ArmCache.c\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
index 21a81ec8a419e63cb78f96440cee5d6780276f2e..e88ebc63c5698ae3d725c1b288f4e8750c6d8288 100644 (file)
@@ -28,7 +28,7 @@
 \r
 \r
 #\r
 \r
 \r
 #\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64\r
 #\r
 \r
 [Sources]\r
 #\r
 \r
 [Sources]\r
@@ -54,6 +54,9 @@
 [Sources.ARM]\r
   IoLibArm.c\r
 \r
 [Sources.ARM]\r
   IoLibArm.c\r
 \r
+[Sources.AARCH64]\r
+  IoLibArm.c\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
index 3de6ff5aea799e3d74b60d4b7def92de69b5f68a..7f05d01c77356354288208760947887a60c5280d 100644 (file)
@@ -44,6 +44,9 @@
 [Includes.ARM]\r
   Include/Arm\r
 \r
 [Includes.ARM]\r
   Include/Arm\r
 \r
+[Includes.AARCH64]\r
+  Include/AArch64\r
+\r
 [LibraryClasses]\r
   ##  @libraryclass  Provides most usb APIs to support the Hid requests defined in Usb Hid 1.1 spec\r
   #                  and the standard requests defined in Usb 1.1 spec.\r
 [LibraryClasses]\r
   ##  @libraryclass  Provides most usb APIs to support the Hid requests defined in Usb Hid 1.1 spec\r
   #                  and the standard requests defined in Usb 1.1 spec.\r
index 092a67de8e93cf140b2d5c2c8e41581288af45fd..fa1e6d71cff700291672162dff305bfbe90bad6a 100644 (file)
@@ -20,7 +20,7 @@
   PLATFORM_VERSION               = 1.03\r
   DSC_SPECIFICATION              = 0x00010005\r
   OUTPUT_DIRECTORY               = Build/Mde\r
   PLATFORM_VERSION               = 1.03\r
   DSC_SPECIFICATION              = 0x00010005\r
   OUTPUT_DIRECTORY               = Build/Mde\r
-  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|EBC|ARM\r
+  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|EBC|ARM|AARCH64\r
   BUILD_TARGETS                  = DEBUG|RELEASE\r
   SKUID_IDENTIFIER               = DEFAULT\r
 \r
   BUILD_TARGETS                  = DEBUG|RELEASE\r
   SKUID_IDENTIFIER               = DEFAULT\r
 \r