boot/arm: move system_time and spin to platform
Add fake implementation for system_time() Implement spin() using EFI boot services Change-Id: Ib69b851780bd03624ce4e19d725dd319f6640601 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4964 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
This commit is contained in:
parent
b50868d0d6
commit
acb424c8b7
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2013-2022 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef EFI_BOOT_PLATFORM_EFI_ARCH_CPU_H
|
||||
#define EFI_BOOT_PLATFORM_EFI_ARCH_CPU_H
|
||||
#ifndef BOOT_ARCH_CPU_H
|
||||
#define BOOT_ARCH_CPU_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
@ -17,9 +17,12 @@ extern "C" {
|
||||
status_t boot_arch_cpu_init(void);
|
||||
void arch_ucode_load(BootVolume& volume);
|
||||
|
||||
bigtime_t system_time();
|
||||
void spin(bigtime_t microseconds);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* EFI_BOOT_PLATFORM_EFI_ARCH_CPU_H */
|
||||
#endif /* BOOT_ARCH_CPU_H */
|
||||
|
@ -1,5 +1,7 @@
|
||||
SubDir HAIKU_TOP src system boot arch arm ;
|
||||
|
||||
UsePrivateHeaders [ FDirName kernel arch arm ] ;
|
||||
UsePrivateHeaders [ FDirName kernel boot arch arm ] ;
|
||||
UsePrivateHeaders [ FDirName kernel platform $(TARGET_BOOT_PLATFORM) ] ;
|
||||
|
||||
local librootGenericSources =
|
||||
|
@ -1,11 +1,14 @@
|
||||
/*
|
||||
* Copyright 2012-2020, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2012-2022, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ithamar R. Adema <ithamar@upgrade-android.com>
|
||||
*/
|
||||
|
||||
#include <boot/arch/arm/arch_cpu.h>
|
||||
#include <kernel/arch/arm/arch_cpu.h>
|
||||
|
||||
#include <OS.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stdio.h>
|
||||
@ -19,9 +22,9 @@
|
||||
|
||||
#define TRACE_CPU
|
||||
#ifdef TRACE_CPU
|
||||
# define TRACE(x) dprintf x
|
||||
# define TRACE(x...) dprintf(x)
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
# define TRACE(x...) ;
|
||||
#endif
|
||||
|
||||
|
||||
@ -81,14 +84,14 @@ check_cpu_features()
|
||||
break;
|
||||
}
|
||||
|
||||
TRACE(("%s: implementor=0x%x('%c'), arch=%d, variant=0x%x, part=0x%x, revision=0x%x\n",
|
||||
__func__, implementor, implementor, arch, variant, part, revision));
|
||||
TRACE("%s: implementor=0x%x('%c'), arch=%d, variant=0x%x, part=0x%x, revision=0x%x\n",
|
||||
__func__, implementor, implementor, arch, variant, part, revision);
|
||||
|
||||
return (arch < ARCH_ARM_v5) ? B_ERROR : B_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
status_t
|
||||
boot_arch_cpu_init(void)
|
||||
{
|
||||
status_t err = check_cpu_features();
|
||||
@ -101,26 +104,8 @@ boot_arch_cpu_init(void)
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
void
|
||||
arch_ucode_load(BootVolume& volume)
|
||||
{
|
||||
// NOP on arm currently
|
||||
}
|
||||
|
||||
|
||||
extern "C" bigtime_t
|
||||
system_time()
|
||||
{
|
||||
#warning Implement system_time in ARM bootloader!
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
spin(bigtime_t microseconds)
|
||||
{
|
||||
#warning Implment spin in ARM bootloader!
|
||||
//bigtime_t time = system_time();
|
||||
//while ((system_time() - time) < microseconds)
|
||||
// asm volatile ("nop;");
|
||||
}
|
||||
|
@ -4,7 +4,9 @@ SubDirHdrs $(HAIKU_TOP) src system boot platform efi ;
|
||||
|
||||
UseLibraryHeaders [ FDirName libfdt ] ;
|
||||
|
||||
UsePrivateHeaders [ FDirName kernel arch arm ] ;
|
||||
UsePrivateHeaders [ FDirName kernel platform ] ;
|
||||
UsePrivateHeaders [ FDirName kernel boot arch arm ] ;
|
||||
UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
||||
|
||||
local platform ;
|
||||
@ -21,6 +23,7 @@ for platform in [ MultiBootSubDirSetup efi ] {
|
||||
crt0-efi-$(TARGET_ARCH).S
|
||||
entry.S
|
||||
relocation_func.cpp
|
||||
arch_cpu.cpp
|
||||
arch_dtb.cpp
|
||||
arch_mmu.cpp
|
||||
arch_smp.cpp
|
||||
|
31
src/system/boot/platform/efi/arch/arm/arch_cpu.cpp
Normal file
31
src/system/boot/platform/efi/arch/arm/arch_cpu.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2012-2022, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "cpu.h"
|
||||
#include "efi_platform.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/arch/arm/arch_cpu.h>
|
||||
|
||||
|
||||
bigtime_t
|
||||
system_time()
|
||||
{
|
||||
#warning Implement system_time in ARM bootloader!
|
||||
static bigtime_t sSystemTimeCounter = 0;
|
||||
return sSystemTimeCounter++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spin(bigtime_t microseconds)
|
||||
{
|
||||
kBootServices->Stall(microseconds);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user