1 /** @file
2   CPU Exception Handler library implementition with empty functions.
3 
4   Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 #include <PiPei.h>
15 #include <Library/CpuExceptionHandlerLib.h>
16 
17 /**
18   Initializes all CPU exceptions entries and provides the default exception handlers.
19 
20   Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
21   persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
22   If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
23   If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
24 
25   @param[in]  VectorInfo    Pointer to reserved vector list.
26 
27   @retval EFI_SUCCESS           CPU Exception Entries have been successfully initialized
28                                 with default exception handlers.
29   @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
30   @retval EFI_UNSUPPORTED       This function is not supported.
31 
32 **/
33 EFI_STATUS
34 EFIAPI
InitializeCpuExceptionHandlers(IN EFI_VECTOR_HANDOFF_INFO * VectorInfo OPTIONAL)35 InitializeCpuExceptionHandlers (
36   IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
37   )
38 {
39   return EFI_SUCCESS;
40 }
41 
42 /**
43   Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.
44 
45   Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
46   persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
47   If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
48   If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
49 
50   @param[in]  VectorInfo    Pointer to reserved vector list.
51 
52   @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized
53                                 with default interrupt/exception handlers.
54   @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
55   @retval EFI_UNSUPPORTED       This function is not supported.
56 
57 **/
58 EFI_STATUS
59 EFIAPI
InitializeCpuInterruptHandlers(IN EFI_VECTOR_HANDOFF_INFO * VectorInfo OPTIONAL)60 InitializeCpuInterruptHandlers (
61   IN EFI_VECTOR_HANDOFF_INFO       *VectorInfo OPTIONAL
62   )
63 {
64   return EFI_SUCCESS;
65 }
66 
67 /**
68   Registers a function to be called from the processor interrupt handler.
69 
70   This function registers and enables the handler specified by InterruptHandler for a processor
71   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
72   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
73   The installed handler is called once for each processor interrupt or exception.
74   NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or
75   InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.
76 
77   @param[in]  InterruptType     Defines which interrupt or exception to hook.
78   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
79                                 when a processor interrupt occurs. If this parameter is NULL, then the handler
80                                 will be uninstalled.
81 
82   @retval EFI_SUCCESS           The handler for the processor interrupt was successfully installed or uninstalled.
83   @retval EFI_ALREADY_STARTED   InterruptHandler is not NULL, and a handler for InterruptType was
84                                 previously installed.
85   @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
86                                 previously installed.
87   @retval EFI_UNSUPPORTED       The interrupt specified by InterruptType is not supported,
88                                 or this function is not supported.
89 **/
90 EFI_STATUS
91 EFIAPI
RegisterCpuInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType,IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)92 RegisterCpuInterruptHandler (
93   IN EFI_EXCEPTION_TYPE            InterruptType,
94   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler
95   )
96 {
97   return EFI_SUCCESS;
98 }
99 
100