VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/Library/CpuExceptionHandlerLib/LoongArch/SecPeiExceptionLib.c

最後變更 在這個檔案是 105670,由 vboxsync 提交於 8 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.7 KB
 
1/** @file SecPeiExceptionLib.c
2
3 LoongArch exception library implemenation for PEI and SEC modules.
4
5 Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8**/
9
10#include <Library/BaseLib.h>
11#include <Library/CpuLib.h>
12#include <Library/CpuExceptionHandlerLib.h>
13#include <Library/DebugLib.h>
14#include <Library/SerialPortLib.h>
15#include <Protocol/DebugSupport.h>
16#include <Register/LoongArch64/Csr.h>
17
18#include "ExceptionCommon.h"
19
20/**
21 Registers a function to be called from the processor interrupt or exception handler.
22
23 Always return EFI_UNSUPPORTED in the SEC exception initialization module.
24
25 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
26 are enabled and FALSE if interrupts are disabled.
27 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
28 when a processor interrupt occurs. If this parameter is NULL, then the handler
29 will be uninstalled.
30
31 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
32
33**/
34EFI_STATUS
35RegisterCpuInterruptHandler (
36 IN EFI_EXCEPTION_TYPE InterruptType,
37 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
38 )
39{
40 return EFI_UNSUPPORTED;
41}
42
43/**
44 Common exception handler.
45
46 @param ExceptionType Exception type.
47 @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
48
49**/
50VOID
51EFIAPI
52CommonExceptionHandler (
53 IN EFI_EXCEPTION_TYPE ExceptionType,
54 IN OUT EFI_SYSTEM_CONTEXT SystemContext
55 )
56{
57 EFI_EXCEPTION_TYPE InterruptType;
58
59 if (ExceptionType == EXCEPT_LOONGARCH_INT) {
60 //
61 // Interrupt
62 //
63 InterruptType = GetInterruptType (SystemContext);
64 if (InterruptType == EXCEPT_LOONGARCH_INT_IPI) {
65 //
66 // APs may wake up via IPI IRQ during the SEC or PEI phase, clear the IPI interrupt and
67 // perform the remaining work.
68 //
69 IpiInterruptHandler (InterruptType, SystemContext);
70 return;
71 } else {
72 ExceptionType = InterruptType;
73 }
74 } else {
75 //
76 // Exception
77 //
78 ExceptionType >>= CSR_ESTAT_EXC_SHIFT;
79 }
80
81 DefaultExceptionHandler (ExceptionType, SystemContext);
82}
83
84/**
85 Initializes all CPU exceptions entries and provides the default exception handlers.
86
87 Always return EFI_SUCCESS in the SEC exception initialization module.
88
89 @param[in] VectorInfo Pointer to reserved vector list.
90
91 @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
92 with default exception handlers.
93
94**/
95EFI_STATUS
96EFIAPI
97InitializeCpuExceptionHandlers (
98 IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
99 )
100{
101 return EFI_SUCCESS;
102}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette