system/boot: More cleanup and shuffling
* arm efi additions * cleanup some cpu headers which were oddly split between efi and bios_ia32 * Move calculate_cpu_conversion_factor over to arch_timer since it is timerish, and x86 only * Drop some duplicated code from efi start. Move hpet init code into efi timer/hpet code Change-Id: Ia4264a5690ba8c09417b06788febc4f572f111ce Reviewed-on: https://review.haiku-os.org/c/haiku/+/2259 Reviewed-by: Alex von Gluck IV <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
cc89f2de18
commit
d2986cb6d0
@@ -8,6 +8,8 @@
|
|||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
|
|
||||||
// memory layout
|
// memory layout
|
||||||
|
#define KERNEL_LOAD_BASE 0x80000000
|
||||||
|
|
||||||
#define KERNEL_BASE 0x80000000
|
#define KERNEL_BASE 0x80000000
|
||||||
#define KERNEL_SIZE 0x80000000
|
#define KERNEL_SIZE 0x80000000
|
||||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
# error This file is included from <boot/kernel_args.h> only
|
# error This file is included from <boot/kernel_args.h> only
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <util/FixedWidthPointer.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define _PACKED __attribute__((packed))
|
||||||
|
|
||||||
// kernel args
|
// kernel args
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int cpu_type;
|
int cpu_type;
|
||||||
@@ -18,9 +24,12 @@ typedef struct {
|
|||||||
int machine; // platform specific machine type
|
int machine; // platform specific machine type
|
||||||
|
|
||||||
// architecture specific
|
// architecture specific
|
||||||
uint32 phys_pgdir;
|
uint32 phys_pgdir;
|
||||||
uint32 vir_pgdir;
|
uint32 vir_pgdir;
|
||||||
uint32 next_pagetable;
|
uint32 next_pagetable;
|
||||||
} arch_kernel_args;
|
|
||||||
|
// needed for UEFI, otherwise kernel acpi support can't find ACPI root
|
||||||
|
FixedWidthPointer<void> acpi_root;
|
||||||
|
} _PACKED arch_kernel_args;
|
||||||
|
|
||||||
#endif /* KERNEL_ARCH_ARM_KERNEL_ARGS_H */
|
#endif /* KERNEL_ARCH_ARM_KERNEL_ARGS_H */
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void cpu_init(void);
|
|
||||||
|
|
||||||
void calculate_cpu_conversion_factor(uint8 channel);
|
void calculate_cpu_conversion_factor(uint8 channel);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ check_cpu_features()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
extern "C" void
|
void
|
||||||
cpu_init()
|
cpu_init()
|
||||||
{
|
{
|
||||||
if (check_cpu_features() != B_OK)
|
if (check_cpu_features() != B_OK)
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019-2020, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _BIOS_IA32_CPU_H
|
||||||
|
#define _BIOS_IA32_CPU_H
|
||||||
|
|
||||||
|
|
||||||
|
void cpu_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _BIOS_IA32_CPU_H */
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "apm.h"
|
#include "apm.h"
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "cpu.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "hpet.h"
|
#include "hpet.h"
|
||||||
#include "interrupts.h"
|
#include "interrupts.h"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <safemode.h>
|
#include <safemode.h>
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
#include <boot/menu.h>
|
#include <boot/menu.h>
|
||||||
|
#include <boot/arch/x86/arch_cpu.h>
|
||||||
#include <arch/x86/arch_acpi.h>
|
#include <arch/x86/arch_acpi.h>
|
||||||
#include <arch/x86/arch_hpet.h>
|
#include <arch/x86/arch_hpet.h>
|
||||||
#include <arch/x86/arch_system_info.h>
|
#include <arch/x86/arch_system_info.h>
|
||||||
@@ -40,13 +41,15 @@ hpet_init(void)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,5 +63,6 @@ hpet_init(void)
|
|||||||
void
|
void
|
||||||
arch_timer_init(void)
|
arch_timer_init(void)
|
||||||
{
|
{
|
||||||
|
calculate_cpu_conversion_factor(2);
|
||||||
hpet_init();
|
hpet_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,11 @@
|
|||||||
#include <boot/kernel_args.h>
|
#include <boot/kernel_args.h>
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <arch/x86/arch_cpu.h>
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void
|
void
|
||||||
cpu_init()
|
cpu_init()
|
||||||
{
|
{
|
||||||
calculate_cpu_conversion_factor(2);
|
|
||||||
|
|
||||||
gKernelArgs.num_cpus = 1;
|
gKernelArgs.num_cpus = 1;
|
||||||
// this will eventually be corrected later on
|
// this will eventually be corrected later on
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019-2020, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _EFI_CPU_H
|
||||||
|
#define _EFI_CPU_H
|
||||||
|
|
||||||
|
|
||||||
|
void cpu_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _EFI_CPU_H */
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
|
||||||
#include <boot/arch/x86/arch_cpu.h>
|
|
||||||
#include <boot/kernel_args.h>
|
#include <boot/kernel_args.h>
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include "arch_start.h"
|
#include "arch_start.h"
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "cpu.h"
|
||||||
#include "efi_platform.h"
|
#include "efi_platform.h"
|
||||||
#include "mmu.h"
|
#include "mmu.h"
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
@@ -195,12 +195,6 @@ efi_main(efi_handle image, efi_system_table *systemTable)
|
|||||||
// disable apm in case we ever load a 32-bit kernel...
|
// disable apm in case we ever load a 32-bit kernel...
|
||||||
gKernelArgs.platform_args.apm.version = 0;
|
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();
|
cpu_init();
|
||||||
acpi_init();
|
acpi_init();
|
||||||
timer_init();
|
timer_init();
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_start)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text 0x0 : {
|
||||||
|
_text = .;
|
||||||
|
*(.text.head)
|
||||||
|
*(.text)
|
||||||
|
*(.text.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.srodata)
|
||||||
|
*(.rodata*)
|
||||||
|
. = ALIGN(16);
|
||||||
|
}
|
||||||
|
_etext = .;
|
||||||
|
_text_size = . - _text;
|
||||||
|
.dynamic : { *(.dynamic) }
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
__ctor_list = .;
|
||||||
|
*(.ctors)
|
||||||
|
__ctor_end = .;
|
||||||
|
_data = .;
|
||||||
|
*(.sdata)
|
||||||
|
*(.data)
|
||||||
|
*(.data1)
|
||||||
|
*(.data.*)
|
||||||
|
*(.got.plt)
|
||||||
|
*(.got)
|
||||||
|
|
||||||
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
|
it all into .data: */
|
||||||
|
. = ALIGN(16);
|
||||||
|
_bss = .;
|
||||||
|
*(.sbss)
|
||||||
|
*(.scommon)
|
||||||
|
*(.dynbss)
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(16);
|
||||||
|
_bss_end = .;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rel.dyn : { *(.rel.dyn) }
|
||||||
|
.rel.plt : { *(.rel.plt) }
|
||||||
|
.rel.got : { *(.rel.got) }
|
||||||
|
.rel.data : { *(.rel.data) *(.rel.data*) }
|
||||||
|
_edata = .;
|
||||||
|
_data_size = . - _etext;
|
||||||
|
|
||||||
|
. = ALIGN(4096);
|
||||||
|
.dynsym : { *(.dynsym) }
|
||||||
|
. = ALIGN(4096);
|
||||||
|
.dynstr : { *(.dynstr) }
|
||||||
|
. = ALIGN(4096);
|
||||||
|
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
*(.rel.reloc)
|
||||||
|
*(.eh_frame)
|
||||||
|
*(.note.GNU-stack)
|
||||||
|
}
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user