]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
1. DxeIplPeim will locate Vector Handoff Table PPI and build GUIDed HOB if it has.
[mirror_edk2.git] / MdeModulePkg / Include / Library / CpuExceptionHandlerLib.h
index 6be32b23264e58830eb1d86eb7504c4c8755aa9d..16384f83168edcceecca6835110eeb25760f6e14 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
-  CPU Exception library provides the CPU exception handler.\r
+  CPU Exception library provides the default CPU interrupt/exception handler.\r
+  It also provides capability to register user interrupt/exception handler.\r
 \r
-  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2013, 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
 \r
 **/\r
 \r
-#ifndef __CPU_EXCEPTION_LIB_H__\r
-#define __CPU_EXCEPTION_LIB_H__\r
+#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__\r
+#define __CPU_EXCEPTION_HANDLER_LIB_H__\r
+\r
+#include <Ppi/VectorHandoffInfo.h>\r
+#include <Protocol/Cpu.h>\r
 \r
 /**\r
-  Setup CPU exception handlers.\r
\r
+  Initializes all CPU exceptions entries and provides the default exception handlers.\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
+  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
+\r
+  @param[in]  VectorInfo    Pointer to reserved vector list.\r
+  \r
+  @retval EFI_SUCCESS           CPU Exception Entries have been successfully initialized \r
+                                with default exception handlers.\r
+  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
+  @retval EFI_UNSUPPORTED       This function is not supported.\r
+\r
 **/\r
-VOID\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeCpuExceptionHandlers (\r
+  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL\r
+  );\r
+\r
+/**\r
+  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\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
+  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
+\r
+  @param[in]  VectorInfo    Pointer to reserved vector list.\r
+  \r
+  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized \r
+                                with default interrupt/exception handlers.\r
+  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
+  @retval EFI_UNSUPPORTED       This function is not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeCpuInterruptHandlers (\r
+  IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL\r
+  );\r
+\r
+/**\r
+  Registers a function to be called from the processor interrupt handler.\r
+\r
+  This function registers and enables the handler specified by InterruptHandler for a processor \r
+  interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
+  handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+  The installed handler is called once for each processor interrupt or exception.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
+  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+\r
+  @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
+  @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
+                                when a processor interrupt occurs. If this parameter is NULL, then the handler\r
+                                will be uninstalled.\r
+\r
+  @retval EFI_SUCCESS           The handler for the processor interrupt was successfully installed or uninstalled.\r
+  @retval EFI_ALREADY_STARTED   InterruptHandler is not NULL, and a handler for InterruptType was\r
+                                previously installed.\r
+  @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
+                                previously installed.\r
+  @retval EFI_UNSUPPORTED       The interrupt specified by InterruptType is not supported,\r
+                                or this function is not supported.\r
+*/\r
+EFI_STATUS\r
 EFIAPI\r
-SetupCpuExceptionHandlers (\r
-  VOID\r
+RegisterCpuInterruptHandler (\r
+  IN EFI_EXCEPTION_TYPE            InterruptType,\r
+  IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
   );\r
 \r
 #endif\r