boot/x86: move HPET initialization to arch folder
Change-Id: Iac3f4923f132c4c3328fde5af1dad75af5b2efbd Reviewed-on: https://review.haiku-os.org/c/haiku/+/4864 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
8d743ebd60
commit
367beefadc
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
|
* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef HPET_H
|
#ifndef BOOT_ARCH_HPET_H
|
||||||
#define HPET_H
|
#define BOOT_ARCH_HPET_H
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <arch/x86/arch_hpet.h>
|
#include <arch/x86/arch_hpet.h>
|
||||||
@@ -18,4 +18,4 @@ void hpet_init(void);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* HPET_H */
|
#endif /* BOOT_ARCH_HPET_H */
|
||||||
@@ -5,6 +5,8 @@ local defines = $(DEFINES) ;
|
|||||||
local platform ;
|
local platform ;
|
||||||
for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
|
for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
|
||||||
on $(platform) {
|
on $(platform) {
|
||||||
|
SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ;
|
||||||
|
|
||||||
DEFINES = $(defines) ;
|
DEFINES = $(defines) ;
|
||||||
DEFINES += _BOOT_MODE ;
|
DEFINES += _BOOT_MODE ;
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
|
|||||||
$(kernelLibArchSpecificSources)
|
$(kernelLibArchSpecificSources)
|
||||||
$(librootOsArchSources)
|
$(librootOsArchSources)
|
||||||
arch_cpu.cpp
|
arch_cpu.cpp
|
||||||
|
arch_hpet.cpp
|
||||||
: -std=c++11 # additional flags
|
: -std=c++11 # additional flags
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
+19
-17
@@ -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.
|
* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
@@ -7,27 +10,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "mmu.h"
|
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
#include "hpet.h"
|
#include "mmu.h"
|
||||||
|
|
||||||
#include <KernelExport.h>
|
|
||||||
|
|
||||||
#include <kernel.h>
|
|
||||||
#include <safemode.h>
|
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
#include <boot/menu.h>
|
#include <boot/arch/x86/arch_cpu.h>
|
||||||
#include <arch/x86/arch_acpi.h>
|
#include <boot/arch/x86/arch_hpet.h>
|
||||||
#include <arch/x86/arch_hpet.h>
|
#include <kernel/arch/x86/arch_acpi.h>
|
||||||
#include <arch/x86/arch_system_info.h>
|
#include <kernel/arch/x86/arch_hpet.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_HPET
|
//#define TRACE_HPET
|
||||||
#ifdef TRACE_HPET
|
#ifdef TRACE_HPET
|
||||||
# define TRACE(x) dprintf x
|
# define TRACE(x...) dprintf(x)
|
||||||
#else
|
#else
|
||||||
# define TRACE(x) ;
|
# define TRACE(x...) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -35,21 +35,23 @@ void
|
|||||||
hpet_init(void)
|
hpet_init(void)
|
||||||
{
|
{
|
||||||
// Try to find the HPET ACPI table.
|
// 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);
|
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) {
|
if (hpet == NULL) {
|
||||||
// No HPET table in the RSDT.
|
// No HPET table in the RSDT.
|
||||||
// Since there are no other methods for finding it,
|
// Since there are no other methods for finding it,
|
||||||
// assume we don't have one.
|
// assume we don't have one.
|
||||||
TRACE(("hpet_init: HPET not found.\n"));
|
TRACE("hpet_init: HPET not found.\n");
|
||||||
gKernelArgs.arch_args.hpet_phys = 0;
|
|
||||||
gKernelArgs.arch_args.hpet = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("hpet_init: found HPET at 0x%" B_PRIx64 ".\n",
|
TRACE("hpet_init: found HPET at 0x%" B_PRIx64 ".\n",
|
||||||
hpet->hpet_address.address));
|
hpet->hpet_address.address);
|
||||||
gKernelArgs.arch_args.hpet_phys = 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 = (void *)mmu_map_physical_memory(
|
||||||
gKernelArgs.arch_args.hpet_phys, B_PAGE_SIZE, kDefaultPageFlags);
|
gKernelArgs.arch_args.hpet_phys, B_PAGE_SIZE, kDefaultPageFlags);
|
||||||
@@ -40,7 +40,6 @@ for platform in [ MultiBootSubDirSetup bios_ia32 ] {
|
|||||||
support.S
|
support.S
|
||||||
video.cpp
|
video.cpp
|
||||||
apm.cpp
|
apm.cpp
|
||||||
hpet.cpp
|
|
||||||
interrupts.cpp
|
interrupts.cpp
|
||||||
interrupts_asm.S
|
interrupts_asm.S
|
||||||
long.cpp
|
long.cpp
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <arch/x86/arch_cpu.h>
|
#include <arch/x86/arch_cpu.h>
|
||||||
|
|
||||||
#include <boot/arch/x86/arch_cpu.h>
|
#include <boot/arch/x86/arch_cpu.h>
|
||||||
|
#include <boot/arch/x86/arch_hpet.h>
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
#include <boot/heap.h>
|
#include <boot/heap.h>
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
@@ -21,7 +22,6 @@
|
|||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "hpet.h"
|
|
||||||
#include "interrupts.h"
|
#include "interrupts.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "long.h"
|
#include "long.h"
|
||||||
|
|||||||
@@ -1,63 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||||
|
* Released under the terms of the MIT License.
|
||||||
|
*
|
||||||
* Copyright 2008, Dustin Howett, [email protected]. All rights reserved.
|
* Copyright 2008, Dustin Howett, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||||
* Distributed under the terms of the NewOS License.
|
* Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "arch_timer.h"
|
#include "arch_timer.h"
|
||||||
|
|
||||||
#include "mmu.h"
|
|
||||||
#include "acpi.h"
|
|
||||||
|
|
||||||
#include <KernelExport.h>
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
|
|
||||||
#include <kernel.h>
|
|
||||||
#include <safemode.h>
|
|
||||||
#include <boot/stage2.h>
|
|
||||||
#include <boot/menu.h>
|
|
||||||
#include <boot/arch/x86/arch_cpu.h>
|
#include <boot/arch/x86/arch_cpu.h>
|
||||||
#include <arch/x86/arch_acpi.h>
|
#include <boot/arch/x86/arch_hpet.h>
|
||||||
#include <arch/x86/arch_hpet.h>
|
|
||||||
#include <arch/x86/arch_system_info.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
//#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ local bios_ia32_src =
|
|||||||
smp.cpp
|
smp.cpp
|
||||||
support.S
|
support.S
|
||||||
video.cpp
|
video.cpp
|
||||||
hpet.cpp
|
|
||||||
apm.cpp
|
apm.cpp
|
||||||
interrupts.cpp
|
interrupts.cpp
|
||||||
interrupts_asm.S
|
interrupts_asm.S
|
||||||
|
|||||||
Reference in New Issue
Block a user