From bb1325a30e94bf61d29fd324a53625253050d56c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 27 Jul 2009 16:23:08 +0000 Subject: [PATCH] [GSoC] [ARM] Patch by Johannes Wischert. Placeholder private headers for the kernel and libroot. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31820 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/arch/arm/arch_cpu.h | 101 +++++++ headers/private/kernel/arch/arm/arch_int.h | 17 ++ headers/private/kernel/arch/arm/arch_kernel.h | 32 +++ .../kernel/arch/arm/arch_kernel_args.h | 30 ++ .../kernel/arch/arm/arch_system_info.h | 12 + headers/private/kernel/arch/arm/arch_thread.h | 45 +++ .../kernel/arch/arm/arch_thread_types.h | 40 +++ .../kernel/arch/arm/arch_user_debugger.h | 17 ++ headers/private/kernel/arch/arm/arch_vm.h | 44 +++ .../kernel/arch/arm/arch_vm_translation_map.h | 26 ++ .../private/kernel/arch/arm/arch_vm_types.h | 8 + headers/private/kernel/arch/arm/omap3.h | 257 ++++++++++++++++++ headers/private/kernel/arch/arm/pxa270.h | 68 +++++ headers/private/kernel/arch/arm/reg.h | 42 +++ headers/private/kernel/arch/arm/uart.h | 46 ++++ .../system/arch/arm/arch_commpage_defs.h | 19 ++ headers/private/system/arch/arm/arch_config.h | 17 ++ headers/private/system/arch/arm/arch_elf.h | 55 ++++ .../system/arch/arm/arch_real_time_data.h | 18 ++ headers/private/system/arch/arm/asm_defs.h | 17 ++ 20 files changed, 911 insertions(+) create mode 100644 headers/private/kernel/arch/arm/arch_cpu.h create mode 100644 headers/private/kernel/arch/arm/arch_int.h create mode 100644 headers/private/kernel/arch/arm/arch_kernel.h create mode 100644 headers/private/kernel/arch/arm/arch_kernel_args.h create mode 100644 headers/private/kernel/arch/arm/arch_system_info.h create mode 100644 headers/private/kernel/arch/arm/arch_thread.h create mode 100644 headers/private/kernel/arch/arm/arch_thread_types.h create mode 100644 headers/private/kernel/arch/arm/arch_user_debugger.h create mode 100644 headers/private/kernel/arch/arm/arch_vm.h create mode 100644 headers/private/kernel/arch/arm/arch_vm_translation_map.h create mode 100644 headers/private/kernel/arch/arm/arch_vm_types.h create mode 100644 headers/private/kernel/arch/arm/omap3.h create mode 100644 headers/private/kernel/arch/arm/pxa270.h create mode 100644 headers/private/kernel/arch/arm/reg.h create mode 100644 headers/private/kernel/arch/arm/uart.h create mode 100644 headers/private/system/arch/arm/arch_commpage_defs.h create mode 100644 headers/private/system/arch/arm/arch_config.h create mode 100644 headers/private/system/arch/arm/arch_elf.h create mode 100644 headers/private/system/arch/arm/arch_real_time_data.h create mode 100644 headers/private/system/arch/arm/asm_defs.h diff --git a/headers/private/kernel/arch/arm/arch_cpu.h b/headers/private/kernel/arch/arm/arch_cpu.h new file mode 100644 index 0000000000..6c770a3ae9 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_cpu.h @@ -0,0 +1,101 @@ +/* +** 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 _ASSEMBLER + +#include +#include + +#endif // !_ASSEMBLER + + + +#ifndef _ASSEMBLER + +/* raw exception frames */ + + + +#warning ARM: check for missing regs/movem +struct iframe { + uint32 r0; + uint32 r1; + uint32 r2; + uint32 r3; + uint32 r4; + uint32 r5; + uint32 r6; + uint32 r7; + uint32 r8; + uint32 r9; + uint32 r10; + uint32 r11; + uint32 r12; + uint32 r13; + uint32 lr; + uint32 pc; + 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; +extern int arch_platform; +extern int arch_machine; + +#endif // !_ASSEMBLER + +#endif /* _KERNEL_ARCH_ARM_CPU_H */ diff --git a/headers/private/kernel/arch/arm/arch_int.h b/headers/private/kernel/arch/arm/arch_int.h new file mode 100644 index 0000000000..83d78e10e9 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_int.h @@ -0,0 +1,17 @@ +/* + * Copyright 2005-2009, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler + * Ingo Weinhold + * Johannes Wischert + */ +#ifndef _KERNEL_ARCH_M68K_INT_H +#define _KERNEL_ARCH_M68K_INT_H + +#include + +#define NUM_IO_VECTORS 256 +#warning "ARM: fix numm io vectors..." +#endif /* _KERNEL_ARCH_M68K_INT_H */ diff --git a/headers/private/kernel/arch/arm/arch_kernel.h b/headers/private/kernel/arch/arm/arch_kernel.h new file mode 100644 index 0000000000..0ec4625f74 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_kernel.h @@ -0,0 +1,32 @@ +/* +** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +#ifndef _KERNEL_ARCH_ARM_KERNEL_H +#define _KERNEL_ARCH_ARM_KERNEL_H + +#include +#warning "ARM:todo memory map is wrong" +// memory layout +#define KERNEL_BASE 0x80500000 +#define KERNEL_SIZE 0x80000000 +#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1)) + +/* +** User space layout is a little special: +** The user space does not completely cover the space not covered by the kernel. +** This is accomplished by starting user space at 1Mb and running to 64kb short of kernel space. +** The lower 1Mb reserved spot makes it easy to find null pointer references and guarantees a +** 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 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 */ diff --git a/headers/private/kernel/arch/arm/arch_kernel_args.h b/headers/private/kernel/arch/arm/arch_kernel_args.h new file mode 100644 index 0000000000..f328978359 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_kernel_args.h @@ -0,0 +1,30 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef KERNEL_ARCH_M68K_KERNEL_ARGS_H +#define KERNEL_ARCH_M68K_KERNEL_ARGS_H + +#ifndef KERNEL_BOOT_KERNEL_ARGS_H +# error This file is included from 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 + bool has_lpstop; //XXX: use bit flags + // architecture specific + uint64 cpu_frequency; + uint64 bus_frequency; + uint64 time_base_frequency; +} arch_kernel_args; + +#endif /* KERNEL_ARCH_M68K_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/arch/arm/arch_system_info.h b/headers/private/kernel/arch/arm/arch_system_info.h new file mode 100644 index 0000000000..9474aca50a --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_system_info.h @@ -0,0 +1,12 @@ +/* + * 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 + + +/* nothing to be seen here yet */ + + +#endif /* _KRENEL_ARCH_M68K_SYSTEM_INFO_H */ diff --git a/headers/private/kernel/arch/arm/arch_thread.h b/headers/private/kernel/arch/arm/arch_thread.h new file mode 100644 index 0000000000..6606e9a18a --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_thread.h @@ -0,0 +1,45 @@ +/* + * Copyright 2003-2006, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler + * Ingo Weinhold + * Johannes Wischert + */ +#ifndef _KERNEL_ARCH_ARM_THREAD_H +#define _KERNEL_ARCH_ARM_THREAD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +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..*/ +extern struct thread *gCurrentThread; + +extern inline struct thread * +arch_thread_get_current_thread(void) +{ + return gCurrentThread; +} + + +extern inline void +arch_thread_set_current_thread(struct thread *t) +{ + gCurrentThread = t; +} + +#ifdef __cplusplus +} +#endif + + +#endif /* _KERNEL_ARCH_ARM_THREAD_H */ diff --git a/headers/private/kernel/arch/arm/arch_thread_types.h b/headers/private/kernel/arch/arm/arch_thread_types.h new file mode 100644 index 0000000000..effd8dcda8 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_thread_types.h @@ -0,0 +1,40 @@ +/* +** Copyright 2001, Travis Geiselbrecht. All rights reserved. +** Distributed under the terms of the NewOS License. +*/ +#ifndef KERNEL_ARCH_ARM_THREAD_TYPES_H +#define KERNEL_ARCH_ARM_THREAD_TYPES_H + +#include + +#define IFRAME_TRACE_DEPTH 4 + +struct iframe_stack { + struct iframe *frames[IFRAME_TRACE_DEPTH]; + int32 index; +}; + +// architecture specific thread info +struct arch_thread { + void *sp; // stack pointer + void *interrupt_stack; + + // used to track interrupts on this thread + struct iframe_stack iframes; +}; + +struct arch_team { + // gcc treats empty structures as zero-length in C, but as if they contain + // a char in C++. So we have to put a dummy in to be able to use the struct + // from both in a consistent way. + char dummy; +}; + +struct arch_fork_arg { + // gcc treats empty structures as zero-length in C, but as if they contain + // a char in C++. So we have to put a dummy in to be able to use the struct + // from both in a consistent way. + char dummy; +}; + +#endif /* KERNEL_ARCH_M68K_THREAD_TYPES_H */ diff --git a/headers/private/kernel/arch/arm/arch_user_debugger.h b/headers/private/kernel/arch/arm/arch_user_debugger.h new file mode 100644 index 0000000000..765dbca178 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_user_debugger.h @@ -0,0 +1,17 @@ +/* + * 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 + + +struct arch_team_debug_info { + uint32 dummy; +}; + +struct arch_thread_debug_info { + uint32 dummy; +}; + +#endif // _KERNEL_ARCH_M68K_USER_DEBUGGER_H diff --git a/headers/private/kernel/arch/arm/arch_vm.h b/headers/private/kernel/arch/arm/arch_vm.h new file mode 100644 index 0000000000..9804ec4298 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_vm.h @@ -0,0 +1,44 @@ +/* + * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef ARCH_ARM_VM_H +#define ARCH_ARM_VM_H + +//#include + +/* This many pages will be read/written on I/O if possible */ + +#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 */ diff --git a/headers/private/kernel/arch/arm/arch_vm_translation_map.h b/headers/private/kernel/arch/arm/arch_vm_translation_map.h new file mode 100644 index 0000000000..b6f66559a7 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_vm_translation_map.h @@ -0,0 +1,26 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H +#define _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif +/* +void m68k_translation_map_change_asid(vm_translation_map *map); + +status_t m68k_map_address_range(addr_t virtualAddress, addr_t physicalAddress, + size_t size); +void m68k_unmap_address_range(addr_t virtualAddress, size_t size); +status_t m68k_remap_address_range(addr_t *virtualAddress, size_t size, + bool unmap); +*/ +#ifdef __cplusplus +} +#endif + +#endif /* _KERNEL_ARCH_M68K_VM_TRANSLATION_MAP_H */ diff --git a/headers/private/kernel/arch/arm/arch_vm_types.h b/headers/private/kernel/arch/arm/arch_vm_types.h new file mode 100644 index 0000000000..6f365c3756 --- /dev/null +++ b/headers/private/kernel/arch/arm/arch_vm_types.h @@ -0,0 +1,8 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_ARM_VM_TYPES_H +#define _KERNEL_ARCH_ARM_VM_TYPES_H + +#endif /* _KERNEL_ARCH_M68K_VM_TYPES_H */ diff --git a/headers/private/kernel/arch/arm/omap3.h b/headers/private/kernel/arch/arm/omap3.h new file mode 100644 index 0000000000..4a2534e6e0 --- /dev/null +++ b/headers/private/kernel/arch/arm/omap3.h @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2008 Travis Geiselbrecht + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef __PLATFORM_OMAP3_H +#define __PLATFORM_OMAP3_H + +#define SDRAM_BASE 0x80000000 + +#define L4_BASE 0x48000000 +#define L4_WKUP_BASE 0x48300000 +#define L4_PER_BASE 0x49000000 +#define L4_EMU_BASE 0x54000000 +#define GFX_BASE 0x50000000 +#define L3_BASE 0x68000000 +#define SMS_BASE 0x6C000000 +#define SDRC_BASE 0x6D000000 +#define GPMC_BASE 0x6E000000 +#define SCM_BASE 0x48002000 + +/* clocks */ +#define CM_CLKSEL_PER (L4_BASE + 0x5040) + +/* PRCM */ +#define CM_FCLKEN_IVA2 (L4_BASE + 0x4000) +#define CM_CLKEN_PLL_IVA2 (L4_BASE + 0x4004) +#define CM_IDLEST_PLL_IVA2 (L4_BASE + 0x4024) +#define CM_CLKSEL1_PLL_IVA2 (L4_BASE + 0x4040) +#define CM_CLKSEL2_PLL_IVA2 (L4_BASE + 0x4044) +#define CM_CLKEN_PLL_MPU (L4_BASE + 0x4904) +#define CM_IDLEST_PLL_MPU (L4_BASE + 0x4924) +#define CM_CLKSEL1_PLL_MPU (L4_BASE + 0x4940) +#define CM_CLKSEL2_PLL_MPU (L4_BASE + 0x4944) +#define CM_FCLKEN1_CORE (L4_BASE + 0x4a00) +#define CM_ICLKEN1_CORE (L4_BASE + 0x4a10) +#define CM_ICLKEN2_CORE (L4_BASE + 0x4a14) +#define CM_CLKSEL_CORE (L4_BASE + 0x4a40) +#define CM_FCLKEN_GFX (L4_BASE + 0x4b00) +#define CM_ICLKEN_GFX (L4_BASE + 0x4b10) +#define CM_CLKSEL_GFX (L4_BASE + 0x4b40) +#define CM_FCLKEN_WKUP (L4_BASE + 0x4c00) +#define CM_ICLKEN_WKUP (L4_BASE + 0x4c10) +#define CM_CLKSEL_WKUP (L4_BASE + 0x4c40) +#define CM_IDLEST_WKUP (L4_BASE + 0x4c20) +#define CM_CLKEN_PLL (L4_BASE + 0x4d00) +#define CM_IDLEST_CKGEN (L4_BASE + 0x4d20) +#define CM_CLKSEL1_PLL (L4_BASE + 0x4d40) +#define CM_CLKSEL2_PLL (L4_BASE + 0x4d44) +#define CM_CLKSEL3_PLL (L4_BASE + 0x4d48) +#define CM_FCLKEN_DSS (L4_BASE + 0x4e00) +#define CM_ICLKEN_DSS (L4_BASE + 0x4e10) +#define CM_CLKSEL_DSS (L4_BASE + 0x4e40) +#define CM_FCLKEN_CAM (L4_BASE + 0x4f00) +#define CM_ICLKEN_CAM (L4_BASE + 0x4f10) +#define CM_CLKSEL_CAM (L4_BASE + 0x4F40) +#define CM_FCLKEN_PER (L4_BASE + 0x5000) +#define CM_ICLKEN_PER (L4_BASE + 0x5010) +#define CM_CLKSEL_PER (L4_BASE + 0x5040) +#define CM_CLKSEL1_EMU (L4_BASE + 0x5140) + +#define PRM_CLKSEL (L4_BASE + 0x306d40) +#define PRM_RSTCTRL (L4_BASE + 0x307250) +#define PRM_CLKSRC_CTRL (L4_BASE + 0x307270) + +/* General Purpose Timers */ +#define OMAP34XX_GPT1 (L4_BASE + 0x318000) +#define OMAP34XX_GPT2 (L4_BASE + 0x1032000) +#define OMAP34XX_GPT3 (L4_BASE + 0x1034000) +#define OMAP34XX_GPT4 (L4_BASE + 0x1036000) +#define OMAP34XX_GPT5 (L4_BASE + 0x1038000) +#define OMAP34XX_GPT6 (L4_BASE + 0x103A000) +#define OMAP34XX_GPT7 (L4_BASE + 0x103C000) +#define OMAP34XX_GPT8 (L4_BASE + 0x103E000) +#define OMAP34XX_GPT9 (L4_BASE + 0x1040000) +#define OMAP34XX_GPT10 (L4_BASE + 0x86000) +#define OMAP34XX_GPT11 (L4_BASE + 0x88000) +#define OMAP34XX_GPT12 (L4_BASE + 0x304000) + +#define TIDR 0x00 +#define TIOCP_CFG 0x10 +#define TISTAT 0x14 +#define TISR 0x18 +#define TIER 0x1C +#define TWER 0x20 +#define TCLR 0x24 +#define TCRR 0x28 +#define TLDR 0x2C +#define TTGR 0x30 +#define TWPS 0x34 +#define TMAR 0x38 +#define TCAR1 0x3C +#define TSICR 0x40 +#define TCAR2 0x44 +#define TPIR 0x48 +#define TNIR 0x4C +#define TCVR 0x50 +#define TOCR 0x54 +#define TOWR 0x58 + +/* WatchDog Timers (1 secure, 3 GP) */ +#define WD1_BASE (0x4830C000) +#define WD2_BASE (0x48314000) +#define WD3_BASE (0x49030000) + +#define WIDR 0x00 +#define WD_SYSCONFIG 0x10 +#define WD_SYSSTATUS 0x14 +#define WISR 0x18 +#define WIER 0x1C +#define WCLR 0x24 +#define WCRR 0x28 +#define WLDR 0x2C +#define WTGR 0x30 +#define WWPS 0x34 +#define WSPR 0x48 + +#define W_PEND_WCLR (1<<0) +#define W_PEND_WCRR (1<<1) +#define W_PEND_WLDR (1<<2) +#define W_PEND_WTGR (1<<3) +#define W_PEND_WSPR (1<<4) + +#define WD_UNLOCK1 0xAAAA +#define WD_UNLOCK2 0x5555 + +/* 32KTIMER */ +#define TIMER32K_BASE (L4_BASE + 0x320000) +#define TIMER32K_REV (TIMER32K_BASE + 0x00) +#define TIMER32K_CR (TIMER32K_BASE + 0x10) + +/* UART */ +#define OMAP_UART1_BASE (L4_BASE + 0x6a000) +#define OMAP_UART2_BASE (L4_BASE + 0x6c000) +#define OMAP_UART3_BASE (L4_BASE + 0x01020000) + +#define UART_RHR 0 +#define UART_THR 0 +#define UART_DLL 0 +#define UART_IER 1 +#define UART_DLH 1 +#define UART_IIR 2 +#define UART_FCR 2 +#define UART_EFR 2 +#define UART_LCR 3 +#define UART_MCR 4 +#define UART_LSR 5 +#define UART_MSR 6 +#define UART_TCR 6 +#define UART_SPR 7 +#define UART_TLR 7 +#define UART_MDR1 8 +#define UART_MDR2 9 +#define UART_SFLSR 10 +#define UART_RESUME 11 +#define UART_TXFLL 10 +#define UART_TXFLH 11 +#define UART_SFREGL 12 +#define UART_SFREGH 13 +#define UART_RXFLL 12 +#define UART_RXFLH 13 +#define UART_BLR 14 +#define UART_UASR 14 +#define UART_ACREG 15 +#define UART_SCR 16 +#define UART_SSR 17 +#define UART_EBLR 18 +#define UART_MVR 19 +#define UART_SYSC 20 + +/* MPU INTC */ +#define INTC_BASE (L4_BASE + 0x200000) +#define INTC_REVISION (INTC_BASE + 0x000) +#define INTC_SYSCONFIG (INTC_BASE + 0x010) +#define INTC_SYSSTATUS (INTC_BASE + 0x014) +#define INTC_SIR_IRQ (INTC_BASE + 0x040) +#define INTC_SIR_FIQ (INTC_BASE + 0x044) +#define INTC_CONTROL (INTC_BASE + 0x048) +#define INTC_PROTECTION (INTC_BASE + 0x04C) +#define INTC_IDLE (INTC_BASE + 0x050) +#define INTC_IRQ_PRIORITY (INTC_BASE + 0x060) +#define INTC_FIQ_PRIORITY (INTC_BASE + 0x064) +#define INTC_THRESHOLD (INTC_BASE + 0x068) +#define INTC_ITR(n) (INTC_BASE + 0x080 + (n) * 0x20) +#define INTC_MIR(n) (INTC_BASE + 0x084 + (n) * 0x20) +#define INTC_MIR_CLEAR(n) (INTC_BASE + 0x088 + (n) * 0x20) +#define INTC_MIR_SET(n) (INTC_BASE + 0x08C + (n) * 0x20) +#define INTC_ISR_SET(n) (INTC_BASE + 0x090 + (n) * 0x20) +#define INTC_ISR_CLEAR(n) (INTC_BASE + 0x094 + (n) * 0x20) +#define INTC_PENDING_IRQ(n) (INTC_BASE + 0x098 + (n) * 0x20) +#define INTC_PENDING_FIQ(n) (INTC_BASE + 0x09C + (n) * 0x20) +#define INTC_ILR(n) (INTC_BASE + 0x100 + (n) * 4) + +/* interrupts */ +#define INT_VECTORS 96 +#define GPT2_IRQ 38 + +/* HS USB */ +#define USB_HS_BASE (L4_BASE + 0xab000) + +/* USB OTG */ +#define OTG_BASE (L4_BASE + 0xab400) + +#define OTG_REVISION (OTG_BASE + 0x00) +#define OTG_SYSCONFIG (OTG_BASE + 0x04) +#define OTG_SYSSTATUS (OTG_BASE + 0x08) +#define OTG_INTERFSEL (OTG_BASE + 0x0C) +#define OTG_SIMENABLE (OTG_BASE + 0x10) +#define OTG_FORCESTDBY (OTG_BASE + 0x14) + +/* I2C */ +#define I2C1_BASE (L4_BASE + 0x70000) +#define I2C2_BASE (L4_BASE + 0x72000) +#define I2C3_BASE (L4_BASE + 0x60000) + +#define I2C_REV (0x00) +#define I2C_IE (0x04) +#define I2C_STAT (0x08) +#define I2C_WE (0x0C) +#define I2C_SYSS (0x10) +#define I2C_BUF (0x14) +#define I2C_CNT (0x18) +#define I2C_DATA (0x1C) +#define I2C_SYSC (0x20) +#define I2C_CON (0x24) +#define I2C_OA0 (0x28) +#define I2C_SA (0x2C) +#define I2C_PSC (0x30) +#define I2C_SCLL (0x34) +#define I2C_SCLH (0x38) +#define I2C_SYSTEST (0x3C) +#define I2C_BUFSTAT (0x40) +#define I2C_OA1 (0x44) +#define I2C_OA2 (0x48) +#define I2C_OA3 (0x4C) +#define I2C_ACTOA (0x50) +#define I2C_SBLOCK (0x54) + +#endif + diff --git a/headers/private/kernel/arch/arm/pxa270.h b/headers/private/kernel/arch/arm/pxa270.h new file mode 100644 index 0000000000..ba89430986 --- /dev/null +++ b/headers/private/kernel/arch/arm/pxa270.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2008 Travis Geiselbrecht + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef __PLATFORM_OMAP3_H +#define __PLATFORM_OMAP3_H + +#define SDRAM_BASE 0xa2000000 + +/* UART */ +#define FFUART_BASE 0x40100000 +#define BTUART_BASE 0x40200000 +#define STUART_BASE 0x40700000 +#define CKEN 0x41300004 +#define UART_RHR 0 +#define UART_THR 0 +#define UART_DLL 0 +#define UART_IER 1 +#define UART_DLH 1 +#define UART_IIR 2 +#define UART_FCR 2 +#define UART_EFR 2 +#define UART_LCR 3 +#define UART_MCR 4 +#define UART_LSR 5 +#define UART_MSR 6 +#define UART_TCR 6 +#define UART_SPR 7 +#define UART_TLR 7 +#define UART_MDR1 8 +#define UART_MDR2 9 +#define UART_SFLSR 10 +#define UART_RESUME 11 +#define UART_TXFLL 10 +#define UART_TXFLH 11 +#define UART_SFREGL 12 +#define UART_SFREGH 13 +#define UART_RXFLL 12 +#define UART_RXFLH 13 +#define UART_BLR 14 +#define UART_UASR 14 +#define UART_ACREG 15 +#define UART_SCR 16 +#define UART_SSR 17 +#define UART_EBLR 18 +#define UART_MVR 19 +#define UART_SYSC 20 + +#endif + diff --git a/headers/private/kernel/arch/arm/reg.h b/headers/private/kernel/arch/arm/reg.h new file mode 100644 index 0000000000..30e9a59b50 --- /dev/null +++ b/headers/private/kernel/arch/arm/reg.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2008 Travis Geiselbrecht + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef __REG_H +#define __REG_H + +//#include + +/* low level macros for accessing memory mapped hardware registers */ +#define REG64(addr) ((volatile uint64 *)(addr)) +#define REG32(addr) ((volatile uint32 *)(addr)) +#define REG16(addr) ((volatile uint16 *)(addr)) +#define REG8(addr) ((volatile uint8 *)(addr)) + +#define RMWREG64(addr, startbit, width, val) *REG64(addr) = (*REG64(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit)) +#define RMWREG32(addr, startbit, width, val) *REG32(addr) = (*REG32(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit)) +#define RMWREG16(addr, startbit, width, val) *REG16(addr) = (*REG16(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit)) +#define RMWREG8(addr, startbit, width, val) *REG8(addr) = (*REG8(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit)) + +#define writel(v, a) (*REG32(a) = (v)) +#define readl(a) (*REG32(a)) + +#endif diff --git a/headers/private/kernel/arch/arm/uart.h b/headers/private/kernel/arch/arm/uart.h new file mode 100644 index 0000000000..a3edc7f825 --- /dev/null +++ b/headers/private/kernel/arch/arm/uart.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2008 Travis Geiselbrecht + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef __DEV_UART_H +#define __DEV_UART_H + +//#include +#ifdef __cplusplus +extern "C" { +#endif + + +void uart_init(void); +void uart_init_early(void); + +int uart_putc(int port, char c); +int uart_getc(int port, bool wait); +void uart_flush_tx(int port); +void uart_flush_rx(int port); +void uart_init_port(int port, uint baud); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/headers/private/system/arch/arm/arch_commpage_defs.h b/headers/private/system/arch/arm/arch_commpage_defs.h new file mode 100644 index 0000000000..57fb821e96 --- /dev/null +++ b/headers/private/system/arch/arm/arch_commpage_defs.h @@ -0,0 +1,19 @@ +/* + * Copyright 2007, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H +#define _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H + +#ifndef _SYSTEM_COMMPAGE_DEFS_H +# error Must not be included directly. Include instead! +#endif + +//#define COMMPAGE_ENTRY_M68K_SYSCALL (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 0) +//#define COMMPAGE_ENTRY_M68K_MEMCPY (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 1) + +/* 0xffff0000 colides with IO space mapped with TT1 on Atari */ +#warning ARM: determine good place for compage.. +#define ARCH_USER_COMMPAGE_ADDR (0xfeff0000) + +#endif /* _SYSTEM_ARCH_M68K_COMMPAGE_DEFS_H */ diff --git a/headers/private/system/arch/arm/arch_config.h b/headers/private/system/arch/arm/arch_config.h new file mode 100644 index 0000000000..a4f3ca740a --- /dev/null +++ b/headers/private/system/arch/arm/arch_config.h @@ -0,0 +1,17 @@ +/* + * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_ARM_CONFIG_H +#define _KERNEL_ARCH_ARM_CONFIG_H + + +#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE unsigned int + +#define STACK_GROWS_DOWNWARDS + +//#define ATOMIC_FUNCS_ARE_SYSCALLS +//#define ATOMIC64_FUNCS_ARE_SYSCALLS + + +#endif /* _KERNEL_ARCH_M68K_CONFIG_H */ diff --git a/headers/private/system/arch/arm/arch_elf.h b/headers/private/system/arch/arm/arch_elf.h new file mode 100644 index 0000000000..47d5f8fe58 --- /dev/null +++ b/headers/private/system/arch/arm/arch_elf.h @@ -0,0 +1,55 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef _KERNEL_ARCH_ARM_ELF_H +#define _KERNEL_ARCH_ARM_ELF_H + + + +/* ARM relocs. */ +#define R_ARM_NONE 0 /* No reloc */ +#define R_ARM_PC24 1 /* PC relative 26 bit branch */ +#define R_ARM_ABS32 2 /* Direct 32 bit */ +#define R_ARM_REL32 3 /* PC relative 32 bit */ +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 /* Direct 16 bit */ +#define R_ARM_ABS12 6 /* Direct 12 bit */ +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 /* Direct 8 bit */ +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* Copy symbol at runtime */ +#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ +#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ +#define R_ARM_RELATIVE 23 /* Adjust by program base */ +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32 26 /* 32 bit GOT entry */ +#define R_ARM_PLT32 27 /* 32 bit PLT address */ +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ +#define R_ARM_THM_PC9 103 /* thumb conditional branch */ +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + + + + + + +#endif /* _KERNEL_ARCH_M68K_ELF_H */ diff --git a/headers/private/system/arch/arm/arch_real_time_data.h b/headers/private/system/arch/arm/arch_real_time_data.h new file mode 100644 index 0000000000..de1ebf7148 --- /dev/null +++ b/headers/private/system/arch/arm/arch_real_time_data.h @@ -0,0 +1,18 @@ +/* + * Copyright 2006, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_REAL_TIME_DATA_H +#define _KERNEL_ARCH_REAL_TIME_DATA_H + +#include +#include + +#warning ARM: fix system_time() + +struct arch_real_time_data { + vint32 system_time_conversion_factor; + vint32 version; +}; + +#endif /* _KERNEL_ARCH_REAL_TIME_DATA_H */ diff --git a/headers/private/system/arch/arm/asm_defs.h b/headers/private/system/arch/arm/asm_defs.h new file mode 100644 index 0000000000..f7a5e477d3 --- /dev/null +++ b/headers/private/system/arch/arm/asm_defs.h @@ -0,0 +1,17 @@ +/* + * Copyright 2008, François Revol, revol@free.fr. + * Distributed under the terms of the MIT License. + */ +#ifndef SYSTEM_ARCH_ARM_ASM_DEFS_H +#define SYSTEM_ARCH_ARM_ASM_DEFS_H + + +#define SYMBOL(name) .global name; name +#define SYMBOL_END(name) 1: .size name, 1b - name +#define STATIC_FUNCTION(name) .type name, %function; name +#define FUNCTION(name) .global name; .type name, %function; name +#define FUNCTION_END(name) 1: .size name, 1b - name + + +#endif /* SYSTEM_ARCH_ARM_ASM_DEFS_H */ +