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 <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]>
This commit is contained in:
committed by
waddlesplash
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef EFI_BOOT_PLATFORM_EFI_ARCH_CPU_H
|
#ifndef BOOT_ARCH_CPU_H
|
||||||
#define EFI_BOOT_PLATFORM_EFI_ARCH_CPU_H
|
#define BOOT_ARCH_CPU_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
@@ -17,9 +17,12 @@ extern "C" {
|
|||||||
status_t boot_arch_cpu_init(void);
|
status_t boot_arch_cpu_init(void);
|
||||||
void arch_ucode_load(BootVolume& volume);
|
void arch_ucode_load(BootVolume& volume);
|
||||||
|
|
||||||
|
bigtime_t system_time();
|
||||||
|
void spin(bigtime_t microseconds);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#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 ;
|
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) ] ;
|
UsePrivateHeaders [ FDirName kernel platform $(TARGET_BOOT_PLATFORM) ] ;
|
||||||
|
|
||||||
local librootGenericSources =
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Ithamar R. Adema <[email protected]>
|
* Ithamar R. Adema <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boot/arch/arm/arch_cpu.h>
|
||||||
|
#include <kernel/arch/arm/arch_cpu.h>
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
#include <boot/stdio.h>
|
#include <boot/stdio.h>
|
||||||
@@ -19,9 +22,9 @@
|
|||||||
|
|
||||||
#define TRACE_CPU
|
#define TRACE_CPU
|
||||||
#ifdef TRACE_CPU
|
#ifdef TRACE_CPU
|
||||||
# define TRACE(x) dprintf x
|
# define TRACE(x...) dprintf(x)
|
||||||
#else
|
#else
|
||||||
# define TRACE(x) ;
|
# define TRACE(x...) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -81,14 +84,14 @@ check_cpu_features()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("%s: implementor=0x%x('%c'), arch=%d, variant=0x%x, part=0x%x, revision=0x%x\n",
|
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));
|
__func__, implementor, implementor, arch, variant, part, revision);
|
||||||
|
|
||||||
return (arch < ARCH_ARM_v5) ? B_ERROR : B_OK;
|
return (arch < ARCH_ARM_v5) ? B_ERROR : B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" status_t
|
status_t
|
||||||
boot_arch_cpu_init(void)
|
boot_arch_cpu_init(void)
|
||||||
{
|
{
|
||||||
status_t err = check_cpu_features();
|
status_t err = check_cpu_features();
|
||||||
@@ -101,26 +104,8 @@ boot_arch_cpu_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void
|
void
|
||||||
arch_ucode_load(BootVolume& volume)
|
arch_ucode_load(BootVolume& volume)
|
||||||
{
|
{
|
||||||
// NOP on arm currently
|
// 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 ] ;
|
UseLibraryHeaders [ FDirName libfdt ] ;
|
||||||
|
|
||||||
|
UsePrivateHeaders [ FDirName kernel arch arm ] ;
|
||||||
UsePrivateHeaders [ FDirName kernel platform ] ;
|
UsePrivateHeaders [ FDirName kernel platform ] ;
|
||||||
|
UsePrivateHeaders [ FDirName kernel boot arch arm ] ;
|
||||||
UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
||||||
|
|
||||||
local platform ;
|
local platform ;
|
||||||
@@ -21,6 +23,7 @@ for platform in [ MultiBootSubDirSetup efi ] {
|
|||||||
crt0-efi-$(TARGET_ARCH).S
|
crt0-efi-$(TARGET_ARCH).S
|
||||||
entry.S
|
entry.S
|
||||||
relocation_func.cpp
|
relocation_func.cpp
|
||||||
|
arch_cpu.cpp
|
||||||
arch_dtb.cpp
|
arch_dtb.cpp
|
||||||
arch_mmu.cpp
|
arch_mmu.cpp
|
||||||
arch_smp.cpp
|
arch_smp.cpp
|
||||||
|
|||||||
@@ -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, [email protected]. 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user