kernel/boot/efi: Continue breaking apart arch-specific code; hpet
* Move x86 hpet behind timer interface. * Add a few if x86,x86_64 macros to start.cpp. Change-Id: I583ec1b064785182e6d48dfbcd91b1bb2ead4b44 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1929 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
parent
9e15c9f153
commit
b482adb1bc
10
headers/private/kernel/boot/platform/efi/arch_timer.h
Normal file
10
headers/private/kernel/boot/platform/efi/arch_timer.h
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef ARCH_TIMER_H
|
||||
#define ARCH_TIMER_H
|
||||
|
||||
void arch_timer_init(void);
|
||||
|
||||
#endif /* ARCH_TIMER_H */
|
@ -27,9 +27,9 @@ local platform_src =
|
||||
mmu.cpp
|
||||
heap.cpp
|
||||
acpi.cpp
|
||||
timer.cpp
|
||||
menu.cpp
|
||||
devices.cpp
|
||||
hpet.cpp
|
||||
cpu.cpp
|
||||
smp.cpp
|
||||
serial.cpp
|
||||
|
30
src/system/boot/platform/efi/arch/arm/Jamfile
Normal file
30
src/system/boot/platform/efi/arch/arm/Jamfile
Normal file
@ -0,0 +1,30 @@
|
||||
SubDir HAIKU_TOP src system boot platform efi arch arm ;
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) src system boot platform efi ;
|
||||
|
||||
UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
||||
UseBuildFeatureHeaders gnuefi ;
|
||||
UseBuildFeatureHeaders gnuefi : headersProtocol ;
|
||||
UseBuildFeatureHeaders gnuefi : headersArch ;
|
||||
|
||||
local arch_src =
|
||||
#entry.S
|
||||
relocation_func.cpp
|
||||
#arch_smp.cpp
|
||||
#arch_mmu.cpp
|
||||
arch_timer.cpp
|
||||
;
|
||||
|
||||
BootMergeObject boot_platform_efi_arm.o :
|
||||
$(arch_src)
|
||||
;
|
||||
|
||||
Includes [ FGristFiles $(arch_src) ]
|
||||
:
|
||||
[ BuildFeatureAttribute gnuefi : headers ]
|
||||
[ BuildFeatureAttribute gnuefi : headersProtocol ]
|
||||
[ BuildFeatureAttribute gnuefi : headersArch ]
|
||||
;
|
||||
|
||||
Depends [ FGristFiles $(arch_src) ]
|
||||
: [ BuildFeatureAttribute gnuefi : libdir ] ;
|
33
src/system/boot/platform/efi/arch/arm/arch_timer.cpp
Normal file
33
src/system/boot/platform/efi/arch/arm/arch_timer.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright, 2019, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_timer.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <kernel.h>
|
||||
#include <safemode.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/menu.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//#define TRACE_TIMER
|
||||
#ifdef TRACE_TIMER
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
arch_timer_init(void)
|
||||
{
|
||||
// Stub
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void hpet_init(void);
|
||||
void arch_timer_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
@ -12,6 +12,7 @@ local arch_src =
|
||||
relocation_func.cpp
|
||||
arch_smp.cpp
|
||||
arch_mmu.cpp
|
||||
arch_timer.cpp
|
||||
;
|
||||
|
||||
BootMergeObject boot_platform_efi_x86_64.o :
|
||||
|
@ -7,11 +7,13 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_timer.h"
|
||||
|
||||
#include "mmu.h"
|
||||
#include "acpi.h"
|
||||
#include "hpet.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <kernel.h>
|
||||
#include <safemode.h>
|
||||
@ -23,15 +25,15 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//#define TRACE_HPET
|
||||
#ifdef TRACE_HPET
|
||||
//#define TRACE_TIMER
|
||||
#ifdef TRACE_TIMER
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
hpet_init(void)
|
||||
{
|
||||
// Try to find the HPET ACPI table.
|
||||
@ -53,3 +55,10 @@ hpet_init(void)
|
||||
gKernelArgs.arch_args.hpet = (void *)mmu_map_physical_memory(
|
||||
gKernelArgs.arch_args.hpet_phys, B_PAGE_SIZE, EfiACPIReclaimMemory);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_timer_init(void)
|
||||
{
|
||||
hpet_init();
|
||||
}
|
@ -203,7 +203,11 @@ mmu_post_efi_setup(UINTN memory_map_size, EFI_MEMORY_DESCRIPTOR *memory_map, UIN
|
||||
kRuntimeServices->SetVirtualAddressMap(memory_map_size, descriptor_size, descriptor_version, memory_map);
|
||||
|
||||
// Important. Make sure supervisor threads can fault on read only pages...
|
||||
#if defined(__x86_64__) || defined(__x86__)
|
||||
asm("mov %%rax, %%cr0" : : "a" ((1 << 31) | (1 << 16) | (1 << 5) | 1));
|
||||
#else
|
||||
#error Ensure supervisor threads can fault on read-only pages on this architecture!
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
#include "acpi.h"
|
||||
#include "console.h"
|
||||
#include "efi_platform.h"
|
||||
#include "hpet.h"
|
||||
#include "cpu.h"
|
||||
#include "mmu.h"
|
||||
#include "serial.h"
|
||||
#include "smp.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
extern void (*__ctor_list)(void);
|
||||
@ -88,8 +88,10 @@ convert_kernel_args()
|
||||
fix_address(gKernelArgs.edid_info);
|
||||
fix_address(gKernelArgs.debug_output);
|
||||
fix_address(gKernelArgs.boot_splash);
|
||||
#if defined(__x86_64__) || defined(__x86__)
|
||||
fix_address(gKernelArgs.arch_args.apic);
|
||||
fix_address(gKernelArgs.arch_args.hpet);
|
||||
#endif
|
||||
|
||||
convert_preloaded_image(static_cast<preloaded_elf64_image*>(
|
||||
gKernelArgs.kernel_image.Pointer()));
|
||||
@ -261,12 +263,14 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
|
||||
gKernelArgs.platform_args.apm.version = 0;
|
||||
|
||||
gKernelArgs.num_cpus = 1;
|
||||
#if defined(__x86_64__) || defined(__x86__)
|
||||
gKernelArgs.arch_args.hpet_phys = 0;
|
||||
gKernelArgs.arch_args.hpet = NULL;
|
||||
#endif
|
||||
|
||||
cpu_init();
|
||||
acpi_init();
|
||||
hpet_init();
|
||||
timer_init();
|
||||
smp_init();
|
||||
|
||||
main(&args);
|
||||
|
31
src/system/boot/platform/efi/timer.cpp
Normal file
31
src/system/boot/platform/efi/timer.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
|
||||
* Copyright 2004-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include "arch_timer.h"
|
||||
|
||||
|
||||
//#define TRACE_TIMER
|
||||
#ifdef TRACE_TIMER
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
timer_init(void)
|
||||
{
|
||||
arch_timer_init();
|
||||
}
|
23
src/system/boot/platform/efi/timer.h
Normal file
23
src/system/boot/platform/efi/timer.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef EFI_TIMER_H
|
||||
#define EFI_TIMER_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void timer_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* EFI_TIMER_H */
|
Loading…
Reference in New Issue
Block a user