]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
ArmPkg: Change use of EFI_D_* to DEBUG_*
[mirror_edk2.git] / ArmPkg / Library / ArmExceptionLib / ArmExceptionLib.c
index e8ea1f159d65f12da970c10ed2e410553198189d..245e848e3f48784ca85b9d3bfc20a5da807b2809 100644 (file)
@@ -2,16 +2,10 @@
 *  Main file supporting the SEC Phase for Versatile Express\r
 *\r
 *  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2021, Arm Limited. All rights reserved.<BR>\r
 *  Copyright (c) 2016 HP Development Company, L.P.\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
+*  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 *\r
 **/\r
 \r
@@ -100,7 +94,7 @@ InitializeCpuExceptionHandlers(
 \r
   Status = EFI_SUCCESS;\r
 \r
-  // if we are requested to copy exceptin handlers to another location\r
+  // if we are requested to copy exception handlers to another location\r
   if (gArmRelocateVectorTable) {\r
 \r
     VectorBase = PcdGet64(PcdCpuVectorBaseAddress);\r
@@ -137,7 +131,7 @@ InitializeCpuExceptionHandlers(
 }\r
 \r
 /**\r
-Copies exception handlers to the speciifed address.\r
+Copies exception handlers to the specified address.\r
 \r
 Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
 persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
@@ -259,7 +253,8 @@ RETURN_STATUS
 RegisterCpuInterruptHandler(\r
   IN EFI_EXCEPTION_TYPE             ExceptionType,\r
   IN EFI_CPU_INTERRUPT_HANDLER      ExceptionHandler\r
-  ) {\r
+  )\r
+{\r
   if (ExceptionType > gMaxExceptionNumber) {\r
     return RETURN_UNSUPPORTED;\r
   }\r
@@ -314,9 +309,41 @@ CommonCExceptionHandler(
     }\r
   }\r
   else {\r
-    DEBUG((EFI_D_ERROR, "Unknown exception type %d\n", ExceptionType));\r
+    DEBUG((DEBUG_ERROR, "Unknown exception type %d\n", ExceptionType));\r
     ASSERT(FALSE);\r
   }\r
 \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