diff --git a/src/system/boot/platform/bios_ia32/hpet.h b/headers/private/kernel/boot/arch/x86/arch_hpet.h similarity index 78% rename from src/system/boot/platform/bios_ia32/hpet.h rename to headers/private/kernel/boot/arch/x86/arch_hpet.h index 124eef7fc8..7d98e8c587 100644 --- a/src/system/boot/platform/bios_ia32/hpet.h +++ b/headers/private/kernel/boot/arch/x86/arch_hpet.h @@ -2,8 +2,8 @@ * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. * Distributed under the terms of the MIT License. */ -#ifndef HPET_H -#define HPET_H +#ifndef BOOT_ARCH_HPET_H +#define BOOT_ARCH_HPET_H #include #include @@ -18,4 +18,4 @@ void hpet_init(void); } #endif -#endif /* HPET_H */ +#endif /* BOOT_ARCH_HPET_H */ diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile index 1f90ef1a3e..08939d5c91 100644 --- a/src/system/boot/arch/x86/Jamfile +++ b/src/system/boot/arch/x86/Jamfile @@ -5,6 +5,8 @@ local defines = $(DEFINES) ; local platform ; for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] { on $(platform) { + SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ; + DEFINES = $(defines) ; DEFINES += _BOOT_MODE ; @@ -43,6 +45,7 @@ for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] { $(kernelLibArchSpecificSources) $(librootOsArchSources) arch_cpu.cpp + arch_hpet.cpp : -std=c++11 # additional flags ; diff --git a/src/system/boot/platform/bios_ia32/hpet.cpp b/src/system/boot/arch/x86/arch_hpet.cpp similarity index 59% rename from src/system/boot/platform/bios_ia32/hpet.cpp rename to src/system/boot/arch/x86/arch_hpet.cpp index 72d9b583c8..ddc6c7bd6a 100644 --- a/src/system/boot/platform/bios_ia32/hpet.cpp +++ b/src/system/boot/arch/x86/arch_hpet.cpp @@ -1,4 +1,7 @@ /* + * Copyright 2021 Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License. + * * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. * Distributed under the terms of the MIT License. * @@ -7,27 +10,24 @@ */ -#include "mmu.h" #include "acpi.h" -#include "hpet.h" +#include "mmu.h" -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include + //#define TRACE_HPET #ifdef TRACE_HPET -# define TRACE(x) dprintf x +# define TRACE(x...) dprintf(x) #else -# define TRACE(x) ; +# define TRACE(x...) ; #endif @@ -35,21 +35,23 @@ void hpet_init(void) { // Try to find the HPET ACPI table. - TRACE(("hpet_init: Looking for HPET...\n")); + TRACE("hpet_init: Looking for HPET...\n"); acpi_hpet *hpet = (acpi_hpet *)acpi_find_table(ACPI_HPET_SIGNATURE); + // Clear hpet kernel args to known invalid state; + gKernelArgs.arch_args.hpet_phys = 0; + gKernelArgs.arch_args.hpet = NULL; + if (hpet == NULL) { // No HPET table in the RSDT. // Since there are no other methods for finding it, // assume we don't have one. - TRACE(("hpet_init: HPET not found.\n")); - gKernelArgs.arch_args.hpet_phys = 0; - gKernelArgs.arch_args.hpet = NULL; + TRACE("hpet_init: HPET not found.\n"); return; } - TRACE(("hpet_init: found HPET at 0x%" B_PRIx64 ".\n", - hpet->hpet_address.address)); + TRACE("hpet_init: found HPET at 0x%" B_PRIx64 ".\n", + hpet->hpet_address.address); gKernelArgs.arch_args.hpet_phys = hpet->hpet_address.address; gKernelArgs.arch_args.hpet = (void *)mmu_map_physical_memory( gKernelArgs.arch_args.hpet_phys, B_PAGE_SIZE, kDefaultPageFlags); diff --git a/src/system/boot/platform/bios_ia32/Jamfile b/src/system/boot/platform/bios_ia32/Jamfile index 6c44677fb9..ee59322252 100644 --- a/src/system/boot/platform/bios_ia32/Jamfile +++ b/src/system/boot/platform/bios_ia32/Jamfile @@ -40,7 +40,6 @@ for platform in [ MultiBootSubDirSetup bios_ia32 ] { support.S video.cpp apm.cpp - hpet.cpp interrupts.cpp interrupts_asm.S long.cpp diff --git a/src/system/boot/platform/bios_ia32/start.cpp b/src/system/boot/platform/bios_ia32/start.cpp index f3ddb7cf52..b5855f4c05 100644 --- a/src/system/boot/platform/bios_ia32/start.cpp +++ b/src/system/boot/platform/bios_ia32/start.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include "console.h" #include "cpu.h" #include "debug.h" -#include "hpet.h" #include "interrupts.h" #include "keyboard.h" #include "long.h" diff --git a/src/system/boot/platform/efi/arch/x86_64/arch_timer.cpp b/src/system/boot/platform/efi/arch/x86_64/arch_timer.cpp index 430f9aabef..07b39d4601 100644 --- a/src/system/boot/platform/efi/arch/x86_64/arch_timer.cpp +++ b/src/system/boot/platform/efi/arch/x86_64/arch_timer.cpp @@ -1,63 +1,19 @@ /* + * Copyright 2021 Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License. + * * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. -*/ + */ #include "arch_timer.h" -#include "mmu.h" -#include "acpi.h" - -#include -#include - -#include -#include -#include -#include #include -#include -#include -#include - -#include - -//#define TRACE_TIMER -#ifdef TRACE_TIMER -# define TRACE(x) dprintf x -#else -# define TRACE(x) ; -#endif - - -static void -hpet_init(void) -{ - // Try to find the HPET ACPI table. - TRACE(("hpet_init: Looking for HPET...\n")); - acpi_hpet *hpet = (acpi_hpet *)acpi_find_table(ACPI_HPET_SIGNATURE); - - // Clear hpet kernel args to known invalid state; - gKernelArgs.arch_args.hpet_phys = 0; - gKernelArgs.arch_args.hpet = NULL; - - if (hpet == NULL) { - // No HPET table in the RSDT. - // Since there are no other methods for finding it, - // assume we don't have one. - TRACE(("hpet_init: HPET not found.\n")); - return; - } - - TRACE(("hpet_init: found HPET at %x.\n", hpet->hpet_address.address)); - gKernelArgs.arch_args.hpet_phys = hpet->hpet_address.address; - gKernelArgs.arch_args.hpet = (void *)mmu_map_physical_memory( - gKernelArgs.arch_args.hpet_phys, B_PAGE_SIZE, EfiACPIReclaimMemory); -} +#include void diff --git a/src/system/boot/platform/pxe_ia32/Jamfile b/src/system/boot/platform/pxe_ia32/Jamfile index 65dc6ee154..5ea910175e 100644 --- a/src/system/boot/platform/pxe_ia32/Jamfile +++ b/src/system/boot/platform/pxe_ia32/Jamfile @@ -33,7 +33,6 @@ local bios_ia32_src = smp.cpp support.S video.cpp - hpet.cpp apm.cpp interrupts.cpp interrupts_asm.S