Add parameter CpuExceptionData for InitializeCpuExceptionHandlersWorker().

Cc: Michael Kinney <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Feng Tian <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <[email protected]>
---
 .../Library/CpuExceptionHandlerLib/CpuExceptionCommon.h   |  6 ++++--
 UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c  |  7 ++++++-
 .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c        | 15 +++++++++------
 UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c  |  7 ++++++-
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index 0757aef..812469b 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -134,7 +134,8 @@ DumpCpuContent (
 /**
   Internal worker function to initialize exception handler.
 
-  @param[in]  VectorInfo    Pointer to reserved vector list.
+  @param[in]      VectorInfo            Pointer to reserved vector list.
+  @param[in, out] ExceptionHandlerData  Pointer to exception handler data.
   
   @retval EFI_SUCCESS           CPU Exception Entries have been successfully 
initialized 
                                 with default exception handlers.
@@ -144,7 +145,8 @@ DumpCpuContent (
 **/
 EFI_STATUS
 InitializeCpuExceptionHandlersWorker (
-  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
+  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL,
+  IN OUT EXCEPTION_HANDLER_DATA    *ExceptionHandlerData
   );
 
 /**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
index 6d16336..92de04c 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
@@ -21,6 +21,8 @@ CONST UINTN    mDoFarReturnFlag  = 0;
 
 extern SPIN_LOCK                   mDisplayMessageSpinLock;
 extern EFI_CPU_INTERRUPT_HANDLER   *mExternalInterruptHandler;
+extern RESERVED_VECTORS_DATA       mReservedVectorsData[CPU_EXCEPTION_NUM];
+extern EFI_CPU_INTERRUPT_HANDLER   
mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
 EXCEPTION_HANDLER_DATA      mExceptionHandlerData;
 
 /**
@@ -45,7 +47,10 @@ InitializeCpuExceptionHandlers (
   IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
   )
 {
-  return InitializeCpuExceptionHandlersWorker (VectorInfo);
+  mExceptionHandlerData.ReservedVectors          = mReservedVectorsData;
+  mExceptionHandlerData.ExternalInterruptHandler = 
mExternalInterruptHandlerTable;
+  InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
+  return InitializeCpuExceptionHandlersWorker (VectorInfo, 
&mExceptionHandlerData);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index d1291aa..1f77f64 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -1,7 +1,7 @@
 /** @file
   CPU Exception Library provides DXE/SMM CPU common exception handler.
 
-Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available 
under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -201,7 +201,8 @@ UpdateIdtTable (
 /**
   Internal worker function to initialize exception handler.
 
-  @param[in]  VectorInfo    Pointer to reserved vector list.
+  @param[in]      VectorInfo            Pointer to reserved vector list.
+  @param[in, out] ExceptionHandlerData  Pointer to exception handler data.
   
   @retval EFI_SUCCESS           CPU Exception Entries have been successfully 
initialized 
                                 with default exception handlers.
@@ -211,7 +212,8 @@ UpdateIdtTable (
 **/
 EFI_STATUS
 InitializeCpuExceptionHandlersWorker (
-  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
+  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL,
+  IN OUT EXCEPTION_HANDLER_DATA    *ExceptionHandlerData
   )
 {
   EFI_STATUS                       Status;
@@ -219,11 +221,12 @@ InitializeCpuExceptionHandlersWorker (
   UINTN                            IdtEntryCount;
   EXCEPTION_HANDLER_TEMPLATE_MAP   TemplateMap;
   IA32_IDT_GATE_DESCRIPTOR         *IdtTable;
+  RESERVED_VECTORS_DATA            *ReservedVectors;
 
-  mReservedVectors = mReservedVectorsData;
-  SetMem ((VOID *) mReservedVectors, sizeof (RESERVED_VECTORS_DATA) * 
CPU_EXCEPTION_NUM, 0xff);
+  ReservedVectors = ExceptionHandlerData->ReservedVectors;
+  SetMem ((VOID *) ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * 
CPU_EXCEPTION_NUM, 0xff);
   if (VectorInfo != NULL) {
-    Status = ReadAndVerifyVectorInfo (VectorInfo, mReservedVectors, 
CPU_EXCEPTION_NUM);
+    Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, 
CPU_EXCEPTION_NUM);
     if (EFI_ERROR (Status)) {
       return EFI_INVALID_PARAMETER;
     }
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
index 3f9d001..b88305d 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c
@@ -17,6 +17,8 @@
 
 CONST UINTN   mDoFarReturnFlag   = 1; 
 
+extern RESERVED_VECTORS_DATA       mReservedVectorsData[CPU_EXCEPTION_NUM];
+extern EFI_CPU_INTERRUPT_HANDLER   
mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
 EXCEPTION_HANDLER_DATA      mExceptionHandlerData;
 /**
   Initializes all CPU exceptions entries and provides the default exception 
handlers.
@@ -40,7 +42,10 @@ InitializeCpuExceptionHandlers (
   IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
   )
 {
-  return InitializeCpuExceptionHandlersWorker (VectorInfo);
+  mExceptionHandlerData.ReservedVectors          = mReservedVectorsData;
+  mExceptionHandlerData.ExternalInterruptHandler = 
mExternalInterruptHandlerTable;
+  InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
+  return InitializeCpuExceptionHandlersWorker (VectorInfo, 
&mExceptionHandlerData);
 }
 
 /**
-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to