Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | CPU exception handler library implemenation for SMM modules.
|
| 3 |
|
| 4 | Copyright (c) 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 |
|
| 15 | #include <PiSmm.h>
|
| 16 | #include "CpuExceptionCommon.h"
|
| 17 |
|
| 18 | CONST UINTN mDoFarReturnFlag = 1;
|
| 19 |
|
| 20 | /**
|
| 21 | Initializes all CPU exceptions entries and provides the default exception handlers.
|
| 22 |
|
| 23 | Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
|
| 24 | persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
|
| 25 | If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
|
| 26 | If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
|
| 27 |
|
| 28 | @param[in] VectorInfo Pointer to reserved vector list.
|
| 29 |
|
| 30 | @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
|
| 31 | with default exception handlers.
|
| 32 | @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
|
| 33 | @retval EFI_UNSUPPORTED This function is not supported.
|
| 34 |
|
| 35 | **/
|
| 36 | EFI_STATUS
|
| 37 | EFIAPI
|
| 38 | InitializeCpuExceptionHandlers (
|
| 39 | IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
|
| 40 | )
|
| 41 | {
|
| 42 | return InitializeCpuExceptionHandlersWorker (VectorInfo);
|
| 43 | }
|
| 44 |
|
| 45 | /**
|
| 46 | Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.
|
| 47 |
|
| 48 | Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
|
| 49 | persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
|
| 50 | If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
|
| 51 | If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
|
| 52 |
|
| 53 | @param[in] VectorInfo Pointer to reserved vector list.
|
| 54 |
|
| 55 | @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized
|
| 56 | with default interrupt/exception handlers.
|
| 57 | @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
|
| 58 | @retval EFI_UNSUPPORTED This function is not supported.
|
| 59 |
|
| 60 | **/
|
| 61 | EFI_STATUS
|
| 62 | EFIAPI
|
| 63 | InitializeCpuInterruptHandlers (
|
| 64 | IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
|
| 65 | )
|
| 66 | {
|
| 67 | return EFI_UNSUPPORTED;
|
| 68 | }
|
| 69 |
|
| 70 | /**
|
| 71 | Registers a function to be called from the processor interrupt handler.
|
| 72 |
|
| 73 | This function registers and enables the handler specified by InterruptHandler for a processor
|
| 74 | interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
|
| 75 | handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
|
| 76 | The installed handler is called once for each processor interrupt or exception.
|
| 77 | NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or
|
| 78 | InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.
|
| 79 |
|
| 80 | @param[in] InterruptType Defines which interrupt or exception to hook.
|
| 81 | @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
|
| 82 | when a processor interrupt occurs. If this parameter is NULL, then the handler
|
| 83 | will be uninstalled.
|
| 84 |
|
| 85 | @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
|
| 86 | @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
|
| 87 | previously installed.
|
| 88 | @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
|
| 89 | previously installed.
|
| 90 | @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported,
|
| 91 | or this function is not supported.
|
| 92 | **/
|
| 93 | EFI_STATUS
|
| 94 | EFIAPI
|
| 95 | RegisterCpuInterruptHandler (
|
| 96 | IN EFI_EXCEPTION_TYPE InterruptType,
|
| 97 | IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
| 98 | )
|
| 99 | {
|
| 100 | return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler);
|
| 101 | } |