]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add Aarch64 support to EdkCompatibilityPkg.
authorHarry Liebel <Harry.Liebel@arm.com>
Thu, 8 Aug 2013 08:55:02 +0000 (08:55 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 8 Aug 2013 08:55:02 +0000 (08:55 +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@14533 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
EdkCompatibilityPkg/Foundation/Efi/Include/EfiImage.h
EdkCompatibilityPkg/Foundation/Efi/Protocol/DebugSupport/DebugSupport.h
EdkCompatibilityPkg/Foundation/Include/AArch64/EfiBind.h [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Include/AArch64/EfiPeOptionalHeader.h [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Include/AArch64/TianoBind.h [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.inf
EdkCompatibilityPkg/Foundation/Library/Dxe/Include/AArch64/ProcDep.h [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/AArch64/PerformancePrimitives.c [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Arm/PerformancePrimitives.c
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.inf

index 90f7b75b478c5e41c1fef641fed289f01d3c211f..070821449e47619e4c0caf54407ed5b53964b3fd 100644 (file)
@@ -49,6 +49,7 @@ Abstract:
 #define EFI_IMAGE_MACHINE_IA64      0x0200\r
 #define EFI_IMAGE_MACHINE_X64       0x8664\r
 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED       0x01c2\r
+#define EFI_IMAGE_MACHINE_AARCH64   0xAA64\r
 \r
 //\r
 // #define EFI_IMAGE_MACHINE_FCODE     0xfc0d\r
index 2249a12a859eed5d88f7c3bf70cd38690f6f0676..dea02dc03f6958eba1d7aa0fc68d927bf03553c4 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+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
 Module Name:\r
 \r
@@ -17,10 +17,10 @@ Abstract:
 \r
   DebugSupport protocol and supporting definitions as defined in the EFI 1.1\r
   specification.\r
-  \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
+\r
 --*/\r
 \r
 #ifndef _DEBUG_SUPPORT_H_\r
@@ -205,7 +205,7 @@ typedef struct {
   UINT8   Xmm7[16];\r
 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
   //\r
-  // NOTE: UEFI 2.0 spec definition as follows. It should be updated \r
+  // NOTE: UEFI 2.0 spec definition as follows. It should be updated\r
   // after spec update.\r
   //\r
   UINT8   Reserved11[14 * 16];\r
@@ -534,11 +534,12 @@ VOID
 // Machine type definition\r
 //\r
 typedef enum {\r
-  IsaIa32 = EFI_IMAGE_MACHINE_IA32,\r
-  IsaX64  = EFI_IMAGE_MACHINE_X64,\r
-  IsaIpf  = EFI_IMAGE_MACHINE_IA64,\r
-  IsaEbc  = EFI_IMAGE_MACHINE_EBC,\r
-  IsaArm  = EFI_IMAGE_MACHINE_ARMTHUMB_MIXED\r
+  IsaIa32       = EFI_IMAGE_MACHINE_IA32,\r
+  IsaX64        = EFI_IMAGE_MACHINE_X64,\r
+  IsaIpf        = EFI_IMAGE_MACHINE_IA64,\r
+  IsaEbc        = EFI_IMAGE_MACHINE_EBC,\r
+  IsaArm        = EFI_IMAGE_MACHINE_ARMTHUMB_MIXED,\r
+  IsaAArch64    = EFI_IMAGE_MACHINE_AARCH64\r
 } EFI_INSTRUCTION_SET_ARCHITECTURE;\r
 \r
 EFI_FORWARD_DECLARATION (EFI_DEBUG_SUPPORT_PROTOCOL);\r
diff --git a/EdkCompatibilityPkg/Foundation/Include/AArch64/EfiBind.h b/EdkCompatibilityPkg/Foundation/Include/AArch64/EfiBind.h
new file mode 100644 (file)
index 0000000..f8db906
--- /dev/null
@@ -0,0 +1,143 @@
+/** @file\r
+\r
+  Copyright (c) 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
+Module Name:\r
+\r
+  EfiBind.h\r
+\r
+Abstract:\r
+\r
+  Processor or Compiler specific defines and types for AArch64.\r
+  We are using the ANSI C 2000 _t type definitions for basic types.\r
+  This it technically a violation of the coding standard, but they\r
+  are used to make EfiTypes.h portable. Code other than EfiTypes.h\r
+  should never use any ANSI C 2000 _t integer types.\r
+\r
+**/\r
+\r
+\r
+#ifndef _EFI_BIND_H_\r
+#define _EFI_BIND_H_\r
+\r
+\r
+#define EFI_DRIVER_ENTRY_POINT(InitFunction)\r
+#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r
+\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
+\r
+//\r
+// Assume standard AArch64 alignment.\r
+// BugBug: Need to check portability of long long\r
+//\r
+typedef unsigned long long  uint64_t;\r
+typedef long long           int64_t;\r
+typedef unsigned int        uint32_t;\r
+typedef int                 int32_t;\r
+typedef unsigned short      uint16_t;\r
+typedef short               int16_t;\r
+typedef unsigned char       uint8_t;\r
+typedef signed char         int8_t;\r
+\r
+//\r
+// Native integer size in stdint.h\r
+//\r
+typedef uint64_t  uintn_t;\r
+typedef int64_t   intn_t;\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+#define EFI_MAX_BIT       0x8000000000000000\r
+#define MAX_2_BITS        0xC000000000000000\r
+\r
+//\r
+// Maximum legal AArch64 address\r
+//\r
+#define EFI_MAX_ADDRESS   0xFFFFFFFFFFFFFFFF\r
+\r
+//\r
+//  Bad pointer value to use in check builds.\r
+//  if you see this value you are using uninitialized or free'ed data\r
+//\r
+#define EFI_BAD_POINTER          0xAFAFAFAFAFAFAFAF\r
+#define EFI_BAD_POINTER_AS_BYTE  0xAF\r
+\r
+#define EFI_DEADLOOP()    { volatile UINTN __iii; __iii = 1; while (__iii); }\r
+\r
+//\r
+// For real hardware, just put in a halt loop. Don't do a while(1) because the\r
+// compiler will optimize away the rest of the function following, so that you run out in\r
+// the weeds if you skip over it with a debugger.\r
+//\r
+#define EFI_BREAKPOINT EFI_DEADLOOP()\r
+\r
+\r
+//\r
+// Memory Fence forces serialization, and is needed to support out of order\r
+//  memory transactions. The Memory Fence is mainly used to make sure IO\r
+//  transactions complete in a deterministic sequence, and to syncronize locks\r
+//  an other MP code. Currently no memory fencing is required.\r
+//\r
+#define MEMORY_FENCE()\r
+\r
+//\r
+// Some compilers don't support the forward reference construct:\r
+//  typedef struct XXXXX. The forward reference is required for\r
+//  ANSI compatibility.\r
+//\r
+// The following macro provide a workaround for such cases.\r
+//\r
+\r
+\r
+#ifdef EFI_NO_INTERFACE_DECL\r
+  #define EFI_FORWARD_DECLARATION(x)\r
+#else\r
+  #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
+#endif\r
+\r
+\r
+//\r
+// Some C compilers optimize the calling conventions to increase performance.\r
+// _EFIAPI is used to make all public APIs follow the standard C calling\r
+// convention.\r
+//\r
+#define _EFIAPI\r
+\r
+\r
+\r
+//\r
+// For symbol name in GNU assembly code, an extra "_" is necessary\r
+//\r
+#if defined(__GNUC__)\r
+  ///\r
+  /// Private worker functions for ASM_PFX()\r
+  ///\r
+  #define _CONCATENATE(a, b)  __CONCATENATE(a, b)\r
+  #define __CONCATENATE(a, b) a ## b\r
+\r
+  ///\r
+  /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r
+  /// on symbols in assembly language.\r
+  ///\r
+  #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r
+\r
+#endif\r
+\r
+#endif\r
+\r
diff --git a/EdkCompatibilityPkg/Foundation/Include/AArch64/EfiPeOptionalHeader.h b/EdkCompatibilityPkg/Foundation/Include/AArch64/EfiPeOptionalHeader.h
new file mode 100644 (file)
index 0000000..bb5df54
--- /dev/null
@@ -0,0 +1,39 @@
+/** @file\r
+\r
+  Copyright (c) 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
+Module Name:\r
+\r
+  EfiPeOptionalHeader.h\r
+\r
+Abstract:\r
+  Defines the optional header in the PE image per the PE specification.  This\r
+  file must be included only from within EfiImage.h since\r
+  EFI_IMAGE_DATA_DIRECTORY and EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES are defined\r
+  there.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_PE_OPTIONAL_HEADER_H_\r
+#define _EFI_PE_OPTIONAL_HEADER_H_\r
+\r
+#define EFI_IMAGE_MACHINE_TYPE (EFI_IMAGE_MACHINE_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
+#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC\r
+typedef EFI_IMAGE_OPTIONAL_HEADER64     EFI_IMAGE_OPTIONAL_HEADER;\r
+typedef EFI_IMAGE_NT_HEADERS64          EFI_IMAGE_NT_HEADERS;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Foundation/Include/AArch64/TianoBind.h b/EdkCompatibilityPkg/Foundation/Include/AArch64/TianoBind.h
new file mode 100644 (file)
index 0000000..f669928
--- /dev/null
@@ -0,0 +1,32 @@
+/** @file\r
+\r
+  Copyright (c) 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
+Module Name:\r
+\r
+  TianoBind.h\r
+\r
+Abstract:\r
+\r
+  Tiano's Processor or Compiler specific defines and types for AArch64\r
+  besides EfiBind.h.\r
+\r
+--*/\r
+\r
+#ifndef _TIANO_BIND_H_\r
+#define _TIANO_BIND_H_\r
+\r
+#include <EfiBind.h>\r
+\r
+#define EFI_DXE_ENTRY_POINT(InitFunction)\r
+#define EFI_SMI_HANDLER_ENTRY_POINT(InitFunction)\r
+\r
+#endif\r
index 4f15892447f62d7ce1620d2cecd620ae0d68cecd..afc72f1679caa44d18b20cf0f85f306bb4f99d6a 100644 (file)
@@ -47,6 +47,9 @@ COMPONENT_TYPE  = LIBRARY
   \r
 [sources.ARM]\r
   Dummy.c\r
+\r
+[sources.AARCH64]\r
+  Dummy.c\r
   \r
 [includes.common]\r
   $(EDK_SOURCE)/Foundation\r
@@ -69,6 +72,9 @@ COMPONENT_TYPE  = LIBRARY
 [libraries.ARM]\r
   CompilerIntrinsicsLib\r
 \r
+[libraries.AArch64]\r
+  CompilerIntrinsicsLib\r
+\r
 [nmake.common]\r
 \r
 [nmake.ia32,nmake.x64]\r
index de2835332004b8f44972ee119522dd738a00075a..885e52cb20b0af2de99ed286f7069df19ef639e1 100644 (file)
@@ -58,6 +58,9 @@ COMPONENT_TYPE  = LIBRARY
 [sources.ARM]\r
   Ebc/PerformancePrimitives.c\r
 \r
+[sources.AArch64]\r
+  Ebc/PerformancePrimitives.c\r
+\r
 \r
 [includes.common]\r
   $(EDK_SOURCE)/Foundation\r
@@ -88,8 +91,11 @@ COMPONENT_TYPE  = LIBRARY
 \r
 [libraries.ipf]\r
   CpuIA64Lib\r
-  \r
-[libraries.ARM]
-  CompilerIntrinsicsLib
+\r
+[libraries.ARM]\r
+  CompilerIntrinsicsLib\r
+\r
+[libraries.AArch64]\r
+  CompilerIntrinsicsLib\r
 \r
 [nmake.common]\r
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/AArch64/ProcDep.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/AArch64/ProcDep.h
new file mode 100644 (file)
index 0000000..bd9b6cd
--- /dev/null
@@ -0,0 +1,26 @@
+/** @file\r
+\r
+  Copyright (c) 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
+Module Name:\r
+\r
+  ProcDep.h\r
+\r
+Abstract:\r
+\r
+  AArch64 specific Runtime Lib code. At this time there is none.\r
+\r
+--*/\r
+\r
+#ifndef _PROC_DEP_H_\r
+#define _PROC_DEP_H_\r
+\r
+#endif\r
index 722c9a966408fe06756f6762ade7b0389d3f0f9e..07b02b76565dc43b4dc65f7fb195b77209a4773f 100644 (file)
@@ -74,6 +74,11 @@ COMPONENT_TYPE  = LIBRARY
   EfiZeroMem.c\r
   Math.c\r
 \r
+[sources.AArch64]\r
+  EfiCopyMem.c\r
+  EfiSetMem.c\r
+  EfiZeroMem.c\r
+  Math.c\r
 \r
 [includes.common]\r
   $(EDK_SOURCE)/Foundation\r
@@ -94,7 +99,10 @@ COMPONENT_TYPE  = LIBRARY
 [libraries.common]\r
   EdkFrameworkGuidLib\r
 \r
-[libraries.ARM]
-  CompilerIntrinsicsLib
+[libraries.ARM]\r
+  CompilerIntrinsicsLib\r
+\r
+[libraries.AArch64]\r
+  CompilerIntrinsicsLib\r
 \r
 [nmake.common]\r
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/AArch64/PerformancePrimitives.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/AArch64/PerformancePrimitives.c
new file mode 100644 (file)
index 0000000..9f82065
--- /dev/null
@@ -0,0 +1,48 @@
+/** @file\r
+\r
+  Copyright (c) 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
+Module Name:\r
+\r
+  PerformancePrimitives.c\r
+\r
+Abstract:\r
+\r
+  Support for Performance library\r
+\r
+--*/\r
+\r
+#include "TianoCommon.h"\r
+\r
+EFI_STATUS\r
+GetTimerValue (\r
+  OUT UINT64    *TimerValue\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Get timer value.\r
+\r
+Arguments:\r
+\r
+  TimerValue  - Pointer to the returned timer value\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS - Successfully got timer value\r
+\r
+--*/\r
+{\r
+  // CPU does not have a timer for AArch64 ...\r
+  ASSERT (FALSE);\r
+  return EFI_SUCCESS;\r
+}\r
index 6b8995e0ddfb62853287b6c5daec9592c37af035..aeb08713a3eae990ce9aaabe5cdc2396a11e133d 100755 (executable)
@@ -1,13 +1,14 @@
-/*++\r
+/** @file\r
+\r
+  Copyright (c) 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
-Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>                                                         \r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  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
 Module Name:\r
 \r
@@ -20,7 +21,6 @@ Abstract:
 --*/\r
 \r
 #include "TianoCommon.h"\r
-#include "CpuIA32.h"\r
 \r
 EFI_STATUS\r
 GetTimerValue (\r
index 16abf04b55f5f0c79fcc2785c8a3d1ad5c5b7639..6ac8794fc23a551119af6628290569eb4a2776f5 100644 (file)
@@ -71,10 +71,13 @@ COMPONENT_TYPE    = LIBRARY
   Ipf/Ia_64Gen.h\r
   Ipf/HwAccess.s\r
   Ipf/PeiServicePointer.c\r
-  \r
+\r
 [sources.ARM]\r
   Arm/PerformancePrimitives.c\r
-    \r
+\r
+[sources.AArch64]\r
+  AArch64/PerformancePrimitives.c\r
+\r
 [libraries.common]\r
   EdkGuidLib\r
   EfiCommonLib\r