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