ARM: Some header cleanup in preperation of more CPU support code...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40948 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
370e4a7059
commit
e59aab0981
@ -2,25 +2,15 @@
|
||||
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_M68K_CPU_H
|
||||
#define _KERNEL_ARCH_M68K_CPU_H
|
||||
#ifndef _KERNEL_ARCH_ARM_CPU_H
|
||||
#define _KERNEL_ARCH_ARM_CPU_H
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
#include <arch/arm/arch_thread_types.h>
|
||||
#include <kernel.h>
|
||||
|
||||
#endif // !_ASSEMBLER
|
||||
|
||||
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
/* raw exception frames */
|
||||
|
||||
|
||||
|
||||
#warning ARM: check for missing regs/movem
|
||||
struct iframe {
|
||||
uint32 r0;
|
||||
uint32 r1;
|
||||
@ -41,55 +31,9 @@ struct iframe {
|
||||
uint32 cpsr;
|
||||
} _PACKED;
|
||||
|
||||
|
||||
typedef struct arch_cpu_info {
|
||||
int null;
|
||||
} arch_cpu_info;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
//extern void sethid0(unsigned int val);
|
||||
//extern unsigned int getl2cr(void);
|
||||
//extern void setl2cr(unsigned int val);
|
||||
extern long long get_time_base(void);
|
||||
|
||||
//void __m68k_setup_system_time(vint32 *cvFactor);
|
||||
// defined in libroot: os/arch/system_time.c
|
||||
//int64 __m68k_get_time_base(void);
|
||||
// defined in libroot: os/arch/system_time_asm.S
|
||||
|
||||
extern void arm_context_switch(void **_oldStackPointer, void *newStackPointer);
|
||||
|
||||
extern bool arm_set_fault_handler(addr_t *handlerLocation, addr_t handler)
|
||||
__attribute__((noinline));
|
||||
|
||||
//extern bool m68k_is_hw_register_readable(addr_t address);
|
||||
//extern bool m68k_is_hw_register_writable(addr_t address, uint16 value);
|
||||
// defined in kernel: arch/m68k/cpu_asm.S
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
struct arm_cpu_ops {
|
||||
void (*flush_insn_pipeline)(void);
|
||||
void (*flush_atc_all)(void);
|
||||
void (*flush_atc_user)(void);
|
||||
void (*flush_atc_addr)(addr_t addr);
|
||||
void (*flush_dcache)(addr_t address, size_t len);
|
||||
void (*flush_icache)(addr_t address, size_t len);
|
||||
void (*idle)(void);
|
||||
};
|
||||
#warning ARM:check cpu_ops
|
||||
extern struct arm_cpu_ops cpu_ops;
|
||||
|
||||
//#define
|
||||
|
||||
|
||||
extern int arch_cpu_type;
|
||||
extern int arch_fpu_type;
|
||||
extern int arch_mmu_type;
|
||||
|
@ -7,11 +7,11 @@
|
||||
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
||||
* Johannes Wischert <johanneswi@gmail.com>
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_M68K_INT_H
|
||||
#define _KERNEL_ARCH_M68K_INT_H
|
||||
#ifndef _KERNEL_ARCH_ARM_INT_H
|
||||
#define _KERNEL_ARCH_ARM_INT_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#define NUM_IO_VECTORS 256
|
||||
#warning "ARM: fix numm io vectors..."
|
||||
#endif /* _KERNEL_ARCH_M68K_INT_H */
|
||||
|
||||
#endif /* _KERNEL_ARCH_ARM_INT_H */
|
||||
|
@ -6,10 +6,11 @@
|
||||
#define _KERNEL_ARCH_ARM_KERNEL_H
|
||||
|
||||
#include <arch/cpu.h>
|
||||
|
||||
// memory layout
|
||||
#define KERNEL_BASE 0x80000000
|
||||
#define KERNEL_SIZE 0x80000000
|
||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||
#define KERNEL_BASE 0x80000000
|
||||
#define KERNEL_SIZE 0x80000000
|
||||
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
|
||||
|
||||
/*
|
||||
** User space layout is a little special:
|
||||
@ -19,13 +20,13 @@
|
||||
** region wont be placed there. The 64kb region assures a user space thread cannot pass
|
||||
** a buffer into the kernel as part of a syscall that would cross into kernel space.
|
||||
*/
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
#define USER_BASE 0x100000
|
||||
#define USER_BASE_ANY USER_BASE
|
||||
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
|
||||
#define USER_TOP (USER_BASE + USER_SIZE)
|
||||
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
#define KERNEL_USER_DATA_BASE 0x6fff0000
|
||||
#define USER_STACK_REGION 0x70000000
|
||||
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
|
||||
|
||||
#endif /* _KERNEL_ARCH_ARM_KERNEL_H */
|
||||
|
@ -9,21 +9,15 @@
|
||||
# error This file is included from <boot/kernel_args.h> only
|
||||
#endif
|
||||
|
||||
#define _PACKED __attribute__((packed))
|
||||
|
||||
//#define MAX_VIRTUAL_RANGES_TO_KEEP 32
|
||||
|
||||
// kernel args
|
||||
typedef struct {
|
||||
int cpu_type;
|
||||
int fpu_type;
|
||||
int mmu_type;
|
||||
int platform;
|
||||
int machine; // platform specific machine type
|
||||
int cpu_type;
|
||||
int fpu_type;
|
||||
int mmu_type;
|
||||
int platform;
|
||||
int machine; // platform specific machine type
|
||||
|
||||
// architecture specific
|
||||
uint64 cpu_frequency;
|
||||
uint64 bus_frequency;
|
||||
uint64 time_base_frequency;
|
||||
uint32 phys_pgdir;
|
||||
uint32 vir_pgdir;
|
||||
} arch_kernel_args;
|
||||
|
@ -2,11 +2,9 @@
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_M68K_SYSTEM_INFO_H
|
||||
#define _KERNEL_ARCH_M68K_SYSTEM_INFO_H
|
||||
|
||||
#ifndef _KERNEL_ARCH_ARM_SYSTEM_INFO_H
|
||||
#define _KERNEL_ARCH_ARM_SYSTEM_INFO_H
|
||||
|
||||
/* nothing to be seen here yet */
|
||||
|
||||
|
||||
#endif /* _KRENEL_ARCH_M68K_SYSTEM_INFO_H */
|
||||
|
@ -20,8 +20,7 @@ void arm_push_iframe(struct iframe_stack *stack, struct iframe *frame);
|
||||
void arm_pop_iframe(struct iframe_stack *stack);
|
||||
struct iframe *arm_get_user_iframe(void);
|
||||
|
||||
/* as we won't support SMP on arm (yet?) we can use a global here */
|
||||
/*TODO SMP-ARMS are comming..*/
|
||||
/* TODO fix this global once we support SMP ARM... */
|
||||
extern Thread *gCurrentThread;
|
||||
|
||||
extern inline Thread *
|
||||
|
@ -37,4 +37,4 @@ struct arch_fork_arg {
|
||||
char dummy;
|
||||
};
|
||||
|
||||
#endif /* KERNEL_ARCH_M68K_THREAD_TYPES_H */
|
||||
#endif /* KERNEL_ARCH_ARM_THREAD_TYPES_H */
|
||||
|
@ -2,16 +2,13 @@
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_M68K_USER_DEBUGGER_H
|
||||
#define _KERNEL_ARCH_M68K_USER_DEBUGGER_H
|
||||
|
||||
#ifndef _KERNEL_ARCH_ARM_USER_DEBUGGER_H
|
||||
#define _KERNEL_ARCH_ARM_USER_DEBUGGER_H
|
||||
|
||||
struct arch_team_debug_info {
|
||||
uint32 dummy;
|
||||
};
|
||||
|
||||
struct arch_thread_debug_info {
|
||||
uint32 dummy;
|
||||
};
|
||||
|
||||
#endif // _KERNEL_ARCH_M68K_USER_DEBUGGER_H
|
||||
#endif // _KERNEL_ARCH_ARM_USER_DEBUGGER_H
|
||||
|
@ -5,40 +5,7 @@
|
||||
#ifndef ARCH_ARM_VM_H
|
||||
#define ARCH_ARM_VM_H
|
||||
|
||||
//#include <vm/vm_translation_map.h>
|
||||
|
||||
/* This many pages will be read/written on I/O if possible */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
#define NUM_IO_PAGES 4
|
||||
/* 16 kB */
|
||||
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
|
||||
struct arm_vm_ops {
|
||||
// void *(*arm_translation_map_get_pgdir)(vm_translation_map *map);
|
||||
/* status_t (*arch_vm_translation_map_init_map)(vm_translation_map *map, bool kernel);
|
||||
status_t (*arch_vm_translation_map_init_kernel_map_post_sem)(vm_translation_map *map);
|
||||
status_t (*arch_vm_translation_map_init)(kernel_args *args);
|
||||
status_t (*arch_vm_translation_map_init_post_area)(kernel_args *args);
|
||||
status_t (*arch_vm_translation_map_init_post_sem)(kernel_args *args);
|
||||
status_t (*arch_vm_translation_map_early_map)(kernel_args *ka, addr_t virtualAddress, addr_t physicalAddress,
|
||||
uint8 attributes, addr_t (*get_free_page)(kernel_args *));
|
||||
status_t (*arch_vm_translation_map_early_query)(addr_t va, addr_t *out_physical);*/
|
||||
// void (*m68k_set_pgdir)(void *);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct arm_vm_ops *get_vm_ops();
|
||||
|
||||
//extern void *arm_translation_map_get_pgdir(vm_translation_map *map);
|
||||
//extern void arm_set_pgdir(void *rt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARCH_M68K_VM_H */
|
||||
#endif /* ARCH_ARM_VM_H */
|
||||
|
@ -9,187 +9,13 @@
|
||||
|
||||
#include <arch/real_time_clock.h>
|
||||
|
||||
//#include <arch_platform.h>
|
||||
#include <real_time_clock.h>
|
||||
#include <real_time_data.h>
|
||||
#include <smp.h>
|
||||
/*
|
||||
typedef struct {
|
||||
uint8 second;
|
||||
uint8 minute;
|
||||
uint8 hour;
|
||||
uint8 day;
|
||||
uint8 month;
|
||||
uint8 year;
|
||||
uint8 century;
|
||||
} cmos_time;
|
||||
|
||||
|
||||
static uint32
|
||||
bcd_to_int(uint8 bcd)
|
||||
{
|
||||
uint32 numl;
|
||||
uint32 numh;
|
||||
|
||||
numl = bcd & 0x0f;
|
||||
numh = (bcd & 0xf0) >> 4;
|
||||
|
||||
return numh * 10 + numl;
|
||||
}
|
||||
|
||||
|
||||
static uint8
|
||||
int_to_bcd(uint32 number)
|
||||
{
|
||||
uint8 low;
|
||||
uint8 high;
|
||||
|
||||
if (number > 99)
|
||||
return 0;
|
||||
|
||||
high = number / 10;
|
||||
low = number % 10;
|
||||
|
||||
return (high << 4) | low;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
same_time(const cmos_time *time1, const cmos_time *time2)
|
||||
{
|
||||
return time1->second == time2->second
|
||||
&& time1->minute == time2->minute
|
||||
&& time1->hour == time2->hour
|
||||
&& time1->day == time2->day
|
||||
&& time1->month == time2->month
|
||||
&& time1->year == time2->year
|
||||
&& time1->century == time2->century;
|
||||
}
|
||||
|
||||
|
||||
static uint8
|
||||
cmos_read(uint8 addr)
|
||||
{
|
||||
return M68KPlatform::Default()->ReadRTCReg(addr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cmos_write(uint8 addr, uint8 data)
|
||||
{
|
||||
M68KPlatform::Default()->WriteRTCReg(addr, data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_24_hour_mode(void)
|
||||
{
|
||||
uint8 status_b;
|
||||
|
||||
status_b = cmos_read(0x0b);
|
||||
status_b |= 0x02;
|
||||
cmos_write(0x0b, status_b);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_cmos_clock(cmos_time *cmos)
|
||||
{
|
||||
set_24_hour_mode();
|
||||
|
||||
cmos->century = cmos_read(0x32);
|
||||
cmos->year = cmos_read(0x09);
|
||||
cmos->month = cmos_read(0x08);
|
||||
cmos->day = cmos_read(0x07);
|
||||
cmos->hour = cmos_read(0x04);
|
||||
cmos->minute = cmos_read(0x02);
|
||||
cmos->second = cmos_read(0x00);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
write_cmos_clock(cmos_time *cmos)
|
||||
{
|
||||
set_24_hour_mode();
|
||||
|
||||
cmos_write(0x32, cmos->century);
|
||||
cmos_write(0x09, cmos->year);
|
||||
cmos_write(0x08, cmos->month);
|
||||
cmos_write(0x07, cmos->day);
|
||||
cmos_write(0x04, cmos->hour);
|
||||
cmos_write(0x02, cmos->minute);
|
||||
cmos_write(0x00, cmos->second);
|
||||
}
|
||||
|
||||
|
||||
static uint32
|
||||
cmos_to_secs(const cmos_time *cmos)
|
||||
{
|
||||
struct tm t;
|
||||
t.tm_year = bcd_to_int(cmos->century) * 100 + bcd_to_int(cmos->year)
|
||||
- RTC_EPOCH_BASE_YEAR;
|
||||
t.tm_mon = bcd_to_int(cmos->month) - 1;
|
||||
t.tm_mday = bcd_to_int(cmos->day);
|
||||
t.tm_hour = bcd_to_int(cmos->hour);
|
||||
t.tm_min = bcd_to_int(cmos->minute);
|
||||
t.tm_sec = bcd_to_int(cmos->second);
|
||||
|
||||
return rtc_tm_to_secs(&t);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
secs_to_cmos(uint32 seconds, cmos_time *cmos)
|
||||
{
|
||||
int wholeYear;
|
||||
|
||||
struct tm t;
|
||||
rtc_secs_to_tm(seconds, &t);
|
||||
|
||||
wholeYear = t.tm_year + RTC_EPOCH_BASE_YEAR;
|
||||
|
||||
cmos->century = int_to_bcd(wholeYear / 100);
|
||||
cmos->year = int_to_bcd(wholeYear % 100);
|
||||
cmos->month = int_to_bcd(t.tm_mon + 1);
|
||||
cmos->day = int_to_bcd(t.tm_mday);
|
||||
cmos->hour = int_to_bcd(t.tm_hour);
|
||||
cmos->minute = int_to_bcd(t.tm_min);
|
||||
cmos->second = int_to_bcd(t.tm_sec);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
static spinlock sSetArchDataLock;
|
||||
*/
|
||||
status_t
|
||||
arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||
{
|
||||
/*
|
||||
// init the platform RTC service
|
||||
status_t error = M68KPlatform::Default()->InitRTC(args, data);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// init the arch specific part of the real_time_data
|
||||
data->arch_data.data[0].system_time_offset = 0;
|
||||
// cvFactor = 2^32 * 1000000 / tbFreq
|
||||
// => (tb * cvFactor) >> 32 = (tb * 2^32 * 1000000 / tbFreq) >> 32
|
||||
// = tb / tbFreq * 1000000 = time in us
|
||||
data->arch_data.system_time_conversion_factor
|
||||
= uint32((uint64(1) << 32) * 1000000
|
||||
/ args->arch_args.time_base_frequency);
|
||||
data->arch_data.version = 0;
|
||||
|
||||
// init spinlock
|
||||
sSetArchDataLock = 0;
|
||||
|
||||
// init system_time() conversion factor
|
||||
__m68k_setup_system_time(&data->arch_data.system_time_conversion_factor);
|
||||
*/
|
||||
#warning ARM:WRITEME
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -197,54 +23,23 @@ arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||
uint32
|
||||
arch_rtc_get_hw_time(void)
|
||||
{
|
||||
#warning ARM:WRITEME
|
||||
|
||||
return 0;
|
||||
//M68KPlatform::Default()->GetHardwareRTC();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_rtc_set_hw_time(uint32 seconds)
|
||||
{
|
||||
#warning ARM:WRITEME
|
||||
|
||||
// M68KPlatform::Default()->SetHardwareRTC(seconds);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_rtc_set_system_time_offset(struct real_time_data *data, bigtime_t offset)
|
||||
{
|
||||
/*
|
||||
cpu_status state = disable_interrupts();
|
||||
acquire_spinlock(&sSetArchDataLock);
|
||||
|
||||
int32 version = data->arch_data.version + 1;
|
||||
data->arch_data.data[version % 2].system_time_offset = offset;
|
||||
data->arch_data.version = version;
|
||||
|
||||
release_spinlock(&sSetArchDataLock);
|
||||
restore_interrupts(state);
|
||||
*/
|
||||
#warning ARM:WRITEME
|
||||
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
arch_rtc_get_system_time_offset(struct real_time_data *data)
|
||||
{
|
||||
#warning ARM:WRITEME
|
||||
/*
|
||||
int32 version;
|
||||
bigtime_t offset;
|
||||
do {
|
||||
version = data->arch_data.version;
|
||||
offset = data->arch_data.data[version % 2].system_time_offset;
|
||||
} while (version != data->arch_data.version);
|
||||
|
||||
return offset;
|
||||
*/
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,27 +12,13 @@
|
||||
#include <OS.h>
|
||||
|
||||
#include <arch_cpu.h>
|
||||
//#include <arch_platform.h>
|
||||
#include <arch/system_info.h>
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
|
||||
static uint64 sCPUClockFrequency;
|
||||
static uint64 sBusClockFrequency;
|
||||
static enum cpu_types sCPUType;
|
||||
static uint16 sCPURevision;
|
||||
|
||||
status_t
|
||||
arch_get_system_info(system_info *info, size_t size)
|
||||
{
|
||||
info->cpu_type = sCPUType;
|
||||
info->cpu_revision = sCPURevision;
|
||||
|
||||
info->cpu_clock_speed = sCPUClockFrequency;
|
||||
info->bus_clock_speed = sBusClockFrequency;
|
||||
|
||||
// info->platform_type = M68KPlatform::Default()->PlatformType();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -40,15 +26,5 @@ arch_get_system_info(system_info *info, size_t size)
|
||||
status_t
|
||||
arch_system_info_init(struct kernel_args *args)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
sCPUClockFrequency = args->arch_args.cpu_frequency;
|
||||
sBusClockFrequency = args->arch_args.bus_frequency;
|
||||
|
||||
sCPURevision = args->arch_args.cpu_type; //XXX
|
||||
#warning ARM:WRITEME
|
||||
// sCPUType = B_CPU_M68K;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user