UefiCpuPkg: Add dump interrupt type on LoongArch64

If the exception type is INT, we need to know which interrupt could not
be handled, so we added a method to dump them.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
This commit is contained in:
Chao Li 2024-12-18 11:27:10 +08:00 committed by mergify[bot]
parent 0fdffb71df
commit 2ece0790f7
3 changed files with 61 additions and 0 deletions

View File

@ -43,8 +43,24 @@ CONST CHAR8 *mExceptionNameStr[] = {
"#GCXC - Guest CSR Software/Hardware Change exception",
"#TBR - TLB refill exception" // !!! NOTICE: Because the TLB refill exception is not instructed in ECODE, so the TLB refill exception must be the last one!
};
CONST CHAR8 *mInterruptNameStr[] = {
"#SIP0 - Software interrupt 0",
"#SIP1 - Software interrupt 1",
"#IP0 - Hardware interrupt 0",
"#IP1 - Hardware interrupt 1",
"#IP2 - Hardware interrupt 2",
"#IP3 - Hardware interrupt 3",
"#IP4 - Hardware interrupt 4",
"#IP5 - Hardware interrupt 5",
"#IP6 - Hardware interrupt 6",
"#IP7 - Hardware interrupt 7",
"#PMC - Performance counter overflow interrupt",
"#TIMER - Timer interrupt",
"#IPI - Inter-Processor interrupt"
};
INTN mExceptionKnownNameNum = (sizeof (mExceptionNameStr) / sizeof (CHAR8 *));
INTN mInterruptKnownNameNum = (sizeof (mInterruptNameStr) / sizeof (CHAR8 *));
/**
Get ASCII format string exception name by exception type.
@ -66,6 +82,26 @@ GetExceptionNameStr (
}
}
/**
Get ASCII format string interrupt name by exception type.
@param InterruptType Interrupt type.
@return ASCII format string interrupt name.
**/
CONST CHAR8 *
GetInterruptNameStr (
IN EFI_EXCEPTION_TYPE InterruptType
)
{
if ((UINTN)InterruptType < mInterruptKnownNameNum) {
return mInterruptNameStr[InterruptType];
} else {
return mExceptionReservedStr;
}
}
/**
Prints a message to the serial port.

View File

@ -13,6 +13,7 @@
#define MAX_DEBUG_MESSAGE_LENGTH 0x100
extern INTN mExceptionKnownNameNum;
extern INTN mInterruptKnownNameNum;
/**
Get ASCII format string exception name by exception type.
@ -27,6 +28,19 @@ GetExceptionNameStr (
IN EFI_EXCEPTION_TYPE ExceptionType
);
/**
Get ASCII format string interrupt name by exception type.
@param InterruptType Interrupt type.
@return ASCII format string interrupt name.
**/
CONST CHAR8 *
GetInterruptNameStr (
IN EFI_EXCEPTION_TYPE InterruptType
);
/**
Prints a message to the serial port.

View File

@ -95,6 +95,17 @@ DumpCpuContext (
GetExceptionNameStr (ExceptionType)
);
//
// Dump interrupt type if the exception type is INT.
//
if (ExceptionType == EXCEPT_LOONGARCH_INT) {
InternalPrintMessage (
"\n!!!! Unhandled interrupt Type - %02x(%a) !!!!\n",
GetInterruptType (SystemContext),
GetInterruptNameStr (GetInterruptType (SystemContext))
);
}
//
// Dump TLB refill ERA and BADV
//