From b8af5cd8da74645945c8ab7b63846f051c185f50 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 23 May 2020 13:11:51 +0200 Subject: Kernel: Simplify MP table parser a little bit more Get rid of the ConfigurationTableEntryLength enum and just look at the sizeof() for each entry type. --- Kernel/ACPI/MultiProcessorParser.cpp | 16 ++++++++-------- Kernel/ACPI/MultiProcessorParser.h | 11 ----------- 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'Kernel') diff --git a/Kernel/ACPI/MultiProcessorParser.cpp b/Kernel/ACPI/MultiProcessorParser.cpp index a292e8be60..80076181bc 100644 --- a/Kernel/ACPI/MultiProcessorParser.cpp +++ b/Kernel/ACPI/MultiProcessorParser.cpp @@ -73,30 +73,30 @@ void MultiProcessorParser::parse_configuration_table() #endif switch (entry->entry_type) { case ((u8)MultiProcessor::ConfigurationTableEntryType::Processor): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::Processor; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::Bus): m_bus_entries.append(*(const MultiProcessor::BusEntry*)entry); - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::Bus; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::BusEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::IOAPIC): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::IOAPIC; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOAPICEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::IO_Interrupt_Assignment): m_io_interrupt_assignment_entries.append(*(const MultiProcessor::IOInterruptAssignmentEntry*)entry); - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::IO_Interrupt_Assignment; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::IOInterruptAssignmentEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::Local_Interrupt_Assignment): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::Local_Interrupt_Assignment; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::LocalInterruptAssignmentEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::SystemAddressSpaceMapping): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::SystemAddressSpaceMapping; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::SystemAddressSpaceMappingEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::BusHierarchyDescriptor): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::BusHierarchyDescriptor; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::BusHierarchyDescriptorEntry); break; case ((u8)MultiProcessor::ConfigurationTableEntryType::CompatibilityBusAddressSpaceModifier): - entry = (MultiProcessor::EntryHeader*)(u32)entry + (u8)MultiProcessor::ConfigurationTableEntryLength::CompatibilityBusAddressSpaceModifier; + entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::CompatibilityBusAddressSpaceModifierEntry); break; default: ASSERT_NOT_REACHED(); diff --git a/Kernel/ACPI/MultiProcessorParser.h b/Kernel/ACPI/MultiProcessorParser.h index 9f3a05b385..19177896b4 100644 --- a/Kernel/ACPI/MultiProcessorParser.h +++ b/Kernel/ACPI/MultiProcessorParser.h @@ -78,17 +78,6 @@ enum class ConfigurationTableEntryType { CompatibilityBusAddressSpaceModifier = 130 }; -enum class ConfigurationTableEntryLength { - Processor = 20, - Bus = 8, - IOAPIC = 8, - IO_Interrupt_Assignment = 8, - Local_Interrupt_Assignment = 8, - SystemAddressSpaceMapping = 20, - BusHierarchyDescriptor = 8, - CompatibilityBusAddressSpaceModifier = 8 -}; - struct [[gnu::packed]] ExtEntryHeader { u8 entry_type; -- cgit v1.2.3