25 IA32_DESCRIPTOR *Idtr;
28 ASSERT (Idtr !=
NULL);
29 NewIdtTable =
AllocateZeroPool (
sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);
30 ASSERT (NewIdtTable !=
NULL);
31 Idtr->Base = (
UINTN)NewIdtTable;
32 Idtr->Limit = (UINT16)(
sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM - 1);
57 return MpServices.Protocol->GetNumberOfProcessors (MpServices.Protocol, NumberOfProcessors, NumberOfEnabledProcessors);
75 return MpServices.Protocol->WhoAmI (MpServices.Protocol, ProcessorNumber);
98 IN VOID *ProcedureArgument
101 return MpServices.Protocol->StartupThisAP (MpServices.Protocol, Procedure, ProcessorNumber,
NULL, TimeoutInMicroSeconds, ProcedureArgument,
NULL);
124 IN BOOLEAN SingleThread,
125 IN UINTN TimeoutInMicroSeconds,
126 IN VOID *ProcedureArgument
129 return MpServices.Protocol->StartupAllAPs (MpServices.Protocol, Procedure, SingleThread,
NULL, TimeoutInMicroSeconds, ProcedureArgument,
NULL);
145 return gBS->LocateProtocol (&gEfiMpServiceProtocolGuid,
NULL, (VOID **)&MpServices->Protocol);
165 UNIT_TEST_FRAMEWORK_HANDLE Framework;
170 TimerArchProtocol =
NULL;
173 DEBUG ((DEBUG_INFO,
"%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
178 Status =
InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION);
179 if (EFI_ERROR (Status)) {
180 DEBUG ((DEBUG_ERROR,
"Failed in InitUnitTestFramework. Status = %r\n", Status));
185 if (EFI_ERROR (Status)) {
186 DEBUG ((DEBUG_ERROR,
"Failed in AddCommonTestCase. Status = %r\n", Status));
193 gBS->LocateProtocol (&gEfiTimerArchProtocolGuid,
NULL, (VOID **)&TimerArchProtocol);
194 if (TimerArchProtocol !=
NULL) {
195 Status = TimerArchProtocol->GetTimerPeriod (TimerArchProtocol, &TimerPeriod);
197 if (TimerPeriod > 0) {
198 DEBUG ((DEBUG_INFO,
"HpetTimer has been dispatched. Disable HpetTimer.\n"));
199 Status = TimerArchProtocol->SetTimerPeriod (TimerArchProtocol, 0);
212 if ((TimerArchProtocol !=
NULL) && (TimerPeriod > 0)) {
213 DEBUG ((DEBUG_INFO,
"Restore HpetTimer after DxeCpuExceptionHandlerLib UnitTest.\n"));
214 Status = TimerArchProtocol->SetTimerPeriod (TimerArchProtocol, TimerPeriod);
EFI_STATUS AddCommonTestCase(IN UNIT_TEST_FRAMEWORK_HANDLE Framework)
EFI_STATUS MpServicesUnitTestWhoAmI(IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber)
EFI_STATUS MpServicesUnitTestStartupAllAPs(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
EFI_STATUS GetMpServices(OUT MP_SERVICES *MpServices)
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
EFI_STATUS EFIAPI CpuExceptionHandlerTestEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS MpServicesUnitTestStartupThisAP(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
VOID * InitializeBspIdt(VOID)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
EFI_STATUS EFIAPI RunAllTestSuites(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
EFI_STATUS EFIAPI FreeUnitTestFramework(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
EFI_STATUS EFIAPI InitUnitTestFramework(OUT UNIT_TEST_FRAMEWORK_HANDLE *FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *ShortTitle, IN CHAR8 *VersionString)
VOID EFIAPI AsmWriteIdtr(IN CONST IA32_DESCRIPTOR *Idtr)