]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
ArmPkg/ArmExceptionLib: Add implementation of new API
[mirror_edk2.git] / ArmPkg / Library / ArmExceptionLib / ArmExceptionLib.c
index 5977a3e8fae137dbbb9d085fdea112e659c16460..cebb26a4ce4cab81b735913eb55902df1dcdc909 100644 (file)
@@ -26,6 +26,7 @@
 #include <Library/DebugLib.h>\r
 #include <Library/DefaultExceptionHandlerLib.h>\r
 \r
+STATIC\r
 RETURN_STATUS\r
 CopyExceptionHandlers(\r
   IN  PHYSICAL_ADDRESS        BaseAddress\r
@@ -66,9 +67,9 @@ extern UINTN                    gDebuggerNoHandlerValue;
 // library we cannot represent this in a PCD since PCDs are evaluated on\r
 // a per-module basis.\r
 #if defined(ARM_RELOCATE_VECTORS)\r
-BOOLEAN gArmRelocateVectorTable = TRUE;\r
+STATIC CONST BOOLEAN gArmRelocateVectorTable = TRUE;\r
 #else\r
-BOOLEAN gArmRelocateVectorTable = FALSE;\r
+STATIC CONST BOOLEAN gArmRelocateVectorTable = FALSE;\r
 #endif\r
 \r
 \r
@@ -102,7 +103,7 @@ InitializeCpuExceptionHandlers(
   // if we are requested to copy exceptin handlers to another location\r
   if (gArmRelocateVectorTable) {\r
 \r
-    VectorBase = PcdGet32(PcdCpuVectorBaseAddress);\r
+    VectorBase = PcdGet64(PcdCpuVectorBaseAddress);\r
     Status = CopyExceptionHandlers(VectorBase);\r
 \r
   }\r
@@ -117,7 +118,7 @@ InitializeCpuExceptionHandlers(
     // for encapsulated FVs.\r
     ASSERT(((UINTN)ExceptionHandlersStart & gExceptionVectorAlignmentMask) == 0);\r
 \r
-    // We do not copy the Exception Table at PcdGet32(PcdCpuVectorBaseAddress). We just set Vector\r
+    // We do not copy the Exception Table at PcdGet64(PcdCpuVectorBaseAddress). We just set Vector\r
     // Base Address to point into CpuDxe code.\r
     VectorBase = (UINTN)ExceptionHandlersStart;\r
 \r
@@ -151,6 +152,7 @@ with default exception handlers.
 @retval EFI_UNSUPPORTED       This function is not supported.\r
 \r
 **/\r
+STATIC\r
 RETURN_STATUS\r
 CopyExceptionHandlers(\r
   IN  PHYSICAL_ADDRESS        BaseAddress\r
@@ -318,3 +320,36 @@ CommonCExceptionHandler(
 \r
   DefaultExceptionHandler(ExceptionType, SystemContext);\r
 }\r
+\r
+/**\r
+  Initializes all CPU exceptions entries with optional extra initializations.\r
+\r
+  By default, this method should include all functionalities implemented by\r
+  InitializeCpuExceptionHandlers(), plus extra initialization works, if any.\r
+  This could be done by calling InitializeCpuExceptionHandlers() directly\r
+  in this method besides the extra works.\r
+\r
+  InitData is optional and its use and content are processor arch dependent.\r
+  The typical usage of it is to convey resources which have to be reserved\r
+  elsewhere and are necessary for the extra initializations of exception.\r
+\r
+  @param[in]  VectorInfo    Pointer to reserved vector list.\r
+  @param[in]  InitData      Pointer to data optional for extra initializations\r
+                            of exception.\r
+\r
+  @retval EFI_SUCCESS             The exceptions have been successfully\r
+                                  initialized.\r
+  @retval EFI_INVALID_PARAMETER   VectorInfo or InitData contains invalid\r
+                                  content.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeCpuExceptionHandlersEx (\r
+  IN EFI_VECTOR_HANDOFF_INFO            *VectorInfo OPTIONAL,\r
+  IN CPU_EXCEPTION_INIT_DATA            *InitData OPTIONAL\r
+  )\r
+{\r
+  return InitializeCpuExceptionHandlers (VectorInfo);\r
+}\r
+\r