Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool acpi = false, apic = false, hpet = false;
- /* Try to parse the ACPI tables */
- rsdp_t *rddp = find_rsdp();
- if (rsdp)
- {
- acpi = true;
- < Parse the HPET table >
- if (There is an HPET)
- {
- hpet = true;
- }
- < Parse the MADT >
- if (There are multiple processors and APICs)
- {
- goto mp;
- }
- else if (There is an APIC, but not multiple processors)
- {
- apic = true;
- goto up;
- }
- }
- /* Try to parse the MP tables */
- mp_table_ptr_t *mp_table_ptr = find_mp_table_ptr();
- if (mp_table_ptr)
- {
- goto mp;
- }
- /* If there's no ACPI or MP tables, we're uniprocessor, but use CPUID to detect an APIC */
- < Detect an APIC >
- if (There is an APIC)
- {
- apic = true;
- }
- /* Uniprocessor HAL */
- up:
- if (acpi)
- {
- if (apic)
- {
- if (hpet)
- {
- < Load the ACPI APIC and HPET HAL >
- }
- else
- {
- < Load the ACPI APIC and APIC timer HAL >
- }
- }
- else
- {
- < Load the ACPI 8259 and PIT HAL >
- }
- }
- else
- {
- if (apic)
- {
- < Load the legacy APIC and APIC timer HAL >
- }
- else
- {
- < Load the legacy 8259 and PIT HAL >
- }
- }
- /* Multiprocessor */
- mp:
- if (acpi)
- {
- if (hpet)
- {
- < Load the ACPI APIC and HPET HAL >
- }
- else
- {
- < Load the ACPI APIC and APIC timer HAL >
- }
- }
- else
- {
- < Load the legacy APIC and APIC timer HAL >
- }
Advertisement
Add Comment
Please, Sign In to add comment