19#include "ExceptionCommon.h"
54 ExceptionType = InterruptType & CSR_ESTAT_EXC;
56 if (ExceptionType != 0) {
60 ExceptionType >>= CSR_ESTAT_EXC_SHIFT;
62 if (ExceptionType > EXCEPT_LOONGARCH_FPE) {
63 return EFI_UNSUPPORTED;
66 if ((InterruptHandler ==
NULL) && (ExceptionHandler[InterruptType] ==
NULL)) {
67 return EFI_INVALID_PARAMETER;
70 if ((InterruptHandler !=
NULL) && (ExceptionHandler[ExceptionType] !=
NULL)) {
71 return EFI_ALREADY_STARTED;
74 ExceptionHandler[ExceptionType] = InterruptHandler;
79 if (InterruptType > MAX_LOONGARCH_INTERRUPT) {
80 return EFI_UNSUPPORTED;
83 if ((InterruptHandler ==
NULL) && (ExternalInterruptHandler[InterruptType] ==
NULL)) {
84 return EFI_INVALID_PARAMETER;
87 if ((InterruptHandler !=
NULL) && (ExternalInterruptHandler[InterruptType] !=
NULL)) {
88 return EFI_ALREADY_STARTED;
91 ExternalInterruptHandler[InterruptType] = InterruptHandler;
113 if (ExceptionType == EXCEPT_LOONGARCH_INT) {
117 InterruptType = GetInterruptType (SystemContext);
118 if (InterruptType == 0xFF) {
119 ExceptionType = InterruptType;
121 if ((ExternalInterruptHandler !=
NULL) && (ExternalInterruptHandler[InterruptType] !=
NULL)) {
122 ExternalInterruptHandler[InterruptType](InterruptType, SystemContext);
126 }
else if (ExceptionType == EXCEPT_LOONGARCH_FPD) {
127 EnableFloatingPointUnits ();
134 ExceptionType >>= CSR_ESTAT_EXC_SHIFT;
135 if ((ExceptionHandler !=
NULL) && (ExceptionHandler[ExceptionType] !=
NULL)) {
136 ExceptionHandler[ExceptionType](ExceptionType, SystemContext);
144 if (
CsrRead (LOONGARCH_CSR_TLBRERA) & 0x1) {
145 ExceptionType = mExceptionKnownNameNum - 1;
VOID(EFIAPI * EFI_CPU_INTERRUPT_HANDLER)(IN CONST EFI_EXCEPTION_TYPE InterruptType, IN CONST EFI_SYSTEM_CONTEXT SystemContext)
UINTN EFIAPI CsrRead(IN UINT16 Select)
VOID DefaultExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS EFIAPI InitializeSeparateExceptionStacks(IN VOID *Buffer, IN OUT UINTN *BufferSize)
EFI_STATUS EFIAPI InitializeCpuExceptionHandlers(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL)
VOID EFIAPI CommonExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS RegisterCpuInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
VOID(EFIAPI * EFI_EXCEPTION_CALLBACK)(IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI InitializeFloatingPointUnits(VOID)