Skip to content

Commit

Permalink
Address some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkFire01 committed Sep 28, 2024
1 parent 49a1970 commit 25d36ee
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
32 changes: 16 additions & 16 deletions hal/halx86/acpi/madt.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ HALP_APIC_INFO_TABLE HalpApicInfoTable;
#define LAPIC_FLAG_ONLINE_CAPABLE 0x00000002
// Bits 2-31 are reserved.

static PROCESSOR_IDENTITY HalpStaticProcessorIdentity[MAXIMUM_PROCESSORS];
PPROCESSOR_IDENTITY HalpProcessorIdentity;
PROCESSOR_IDENTITY HalpProcessorIdentity[MAXIMUM_PROCESSORS];

extern ULONG HalpPicVectorRedirect[16];

ULONG
HalpGetCurrentProcessorHwID();
HalpGetCurrentProcessorHwID(VOID);

/* FUNCTIONS ******************************************************************/

Expand All @@ -45,17 +44,16 @@ HalpParseApicTables(
ACPI_SUBTABLE_HEADER *AcpiHeader;
ULONG_PTR TableEnd;

HalpProcessorIdentity = HalpStaticProcessorIdentity;
MadtTable = HalAcpiGetTable(LoaderBlock, APIC_SIGNATURE);
if (!MadtTable)
{
DPRINT("MADT table not found\n");
DPRINT1("MADT table not found\n");
return;
}

if (MadtTable->Header.Length < sizeof(*MadtTable))
{
DPRINT("Length is too short: %p, %u\n", MadtTable, MadtTable->Header.Length);
DPRINT1("Length is too short: %p, %u\n", MadtTable, MadtTable->Header.Length);
return;
}

Expand All @@ -71,13 +69,13 @@ HalpParseApicTables(
{
if (AcpiHeader->Length < sizeof(*AcpiHeader))
{
DPRINT("Length is too short: %p, %u\n", AcpiHeader, AcpiHeader->Length);
DPRINT1("Length is too short: %p, %u\n", AcpiHeader, AcpiHeader->Length);
return;
}

if ((ULONG_PTR)AcpiHeader + AcpiHeader->Length > TableEnd)
{
DPRINT("Length mismatch: %p, %u, %p\n",
DPRINT1("Length mismatch: %p, %u, %p\n",
AcpiHeader, AcpiHeader->Length, (PVOID)TableEnd);
return;
}
Expand All @@ -90,7 +88,7 @@ HalpParseApicTables(

if (AcpiHeader->Length != sizeof(*LocalApic))
{
DPRINT("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
DPRINT1("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
return;
}

Expand All @@ -104,9 +102,9 @@ HalpParseApicTables(
break;
}

if (HalpApicInfoTable.ProcessorCount == _countof(HalpStaticProcessorIdentity))
if (HalpApicInfoTable.ProcessorCount == MAXIMUM_PROCESSORS)
{
DPRINT(" Skipped: array is full\n");
DPRINT1(" Skipped: array is full\n");
// We assume ignoring this processor is acceptable, until proven otherwise.
break;
}
Expand All @@ -133,7 +131,7 @@ HalpParseApicTables(

if (AcpiHeader->Length != sizeof(*IoApic))
{
DPRINT("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
DPRINT1("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
return;
}

Expand All @@ -143,7 +141,7 @@ HalpParseApicTables(
// Ensure HalpApicInfoTable.IOAPICCount consistency.
if (HalpApicInfoTable.IoApicPA[IoApic->Id] != 0)
{
DPRINT("Id duplication: %p, %u\n", IoApic, IoApic->Id);
DPRINT1("Id duplication: %p, %u\n", IoApic, IoApic->Id);
return;
}

Expand All @@ -162,7 +160,7 @@ HalpParseApicTables(

if (AcpiHeader->Length != sizeof(*InterruptOverride))
{
DPRINT("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
DPRINT1("Type/Length mismatch: %p, %u\n", AcpiHeader, AcpiHeader->Length);
return;
}

Expand All @@ -176,15 +174,15 @@ HalpParseApicTables(

if (InterruptOverride->Bus != 0) // 0 = ISA
{
DPRINT("Invalid Bus: %p, %u\n", InterruptOverride, InterruptOverride->Bus);
DPRINT1("Invalid Bus: %p, %u\n", InterruptOverride, InterruptOverride->Bus);
return;
}

break;
}
default:
{
DPRINT(" UNIMPLEMENTED: Type %u, Length %u\n",
DPRINT1(" UNIMPLEMENTED: Type %u, Length %u\n",
AcpiHeader->Type, AcpiHeader->Length);
return;
}
Expand All @@ -198,6 +196,8 @@ HalpParseApicTables(
DPRINT("Length mismatch: %p, %p, %p\n", MadtTable, AcpiHeader, (PVOID)TableEnd);
return;
}

HalpPrintApicTables();
}

VOID
Expand Down
2 changes: 1 addition & 1 deletion hal/halx86/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ULONG ApicVersion;
UCHAR HalpVectorToIndex[256];

ULONG
HalpGetCurrentProcessorHwID()
HalpGetCurrentProcessorHwID(VOID)
{
return ApicRead(APIC_ID);
}
Expand Down
2 changes: 1 addition & 1 deletion hal/halx86/apic/apicsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <debug.h>


extern PPROCESSOR_IDENTITY HalpProcessorIdentity;
extern PROCESSOR_IDENTITY HalpProcessorIdentity[MAXIMUM_PROCESSORS];

/* INTERNAL FUNCTIONS *********************************************************/

Expand Down
3 changes: 1 addition & 2 deletions hal/halx86/apic/halinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
(HalpBuildType & PRCB_BUILD_UNIPROCESSOR) ? "UP" : "SMP",
(HalpBuildType & PRCB_BUILD_DEBUG) ? "DBG" : "REL");

/* This works as InitPhase0 happens before secondary processors are spun-up.*/
/* This works because InitPhase0 happens before secondary processors are spun-up */
HalpParseApicTables(LoaderBlock);
HalpPrintApicTables();

/* Enable clock interrupt handler */
HalpEnableInterruptHandler(IDT_INTERNAL,
Expand Down
2 changes: 1 addition & 1 deletion hal/halx86/pic/pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ HalpEndSoftwareInterrupt(IN KIRQL OldIrql,
IN PKTRAP_FRAME TrapFrame);

ULONG
HalpGetCurrentProcessorHwID()
HalpGetCurrentProcessorHwID(VOID)
{
return 0;
}
Expand Down

0 comments on commit 25d36ee

Please sign in to comment.