kernel arm: Quick style cleanup; No functional change
This commit is contained in:
@@ -100,7 +100,8 @@ void
|
|||||||
arch_cpu_sync_icache(void *address, size_t len)
|
arch_cpu_sync_icache(void *address, size_t len)
|
||||||
{
|
{
|
||||||
uint32 Rd = 0;
|
uint32 Rd = 0;
|
||||||
asm volatile ("mcr p15, 0, %[c7format], c7, c5, 0" : : [c7format] "r" (Rd) );
|
asm volatile ("mcr p15, 0, %[c7format], c7, c5, 0"
|
||||||
|
: : [c7format] "r" (Rd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +124,8 @@ arch_cpu_invalidate_TLB_range(addr_t start, addr_t end)
|
|||||||
{
|
{
|
||||||
int32 num_pages = end / B_PAGE_SIZE - start / B_PAGE_SIZE;
|
int32 num_pages = end / B_PAGE_SIZE - start / B_PAGE_SIZE;
|
||||||
while (num_pages-- >= 0) {
|
while (num_pages-- >= 0) {
|
||||||
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1" : : [c8format] "r" (start) );
|
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1"
|
||||||
|
: : [c8format] "r" (start) );
|
||||||
start += B_PAGE_SIZE;
|
start += B_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,8 +134,10 @@ arch_cpu_invalidate_TLB_range(addr_t start, addr_t end)
|
|||||||
void
|
void
|
||||||
arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
|
arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num_pages; i++)
|
for (int i = 0; i < num_pages; i++) {
|
||||||
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1" : : [c8format] "r" (pages[i]) );
|
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1":
|
||||||
|
: [c8format] "r" (pages[i]) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,7 +145,8 @@ void
|
|||||||
arch_cpu_global_TLB_invalidate(void)
|
arch_cpu_global_TLB_invalidate(void)
|
||||||
{
|
{
|
||||||
uint32 Rd = 0;
|
uint32 Rd = 0;
|
||||||
asm volatile ("mcr p15, 0, %[c8format], c8, c7, 0" : : [c8format] "r" (Rd) );
|
asm volatile ("mcr p15, 0, %[c8format], c8, c7, 0"
|
||||||
|
: : [c8format] "r" (Rd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,7 +197,8 @@ error:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHandler)
|
arch_cpu_user_strlcpy(char *to, const char *from,
|
||||||
|
size_t size, addr_t *faultHandler)
|
||||||
{
|
{
|
||||||
#warning WRITEME
|
#warning WRITEME
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ struct stack_frame {
|
|||||||
#define NUM_PREVIOUS_LOCATIONS 32
|
#define NUM_PREVIOUS_LOCATIONS 32
|
||||||
|
|
||||||
extern struct iframe_stack gBootFrameStack;
|
extern struct iframe_stack gBootFrameStack;
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static bool
|
static bool
|
||||||
already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 framePointer)
|
already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 framePointer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,4 +100,3 @@ arch_debug_console_init_settings(kernel_args *args)
|
|||||||
{
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,8 +347,9 @@ arch_elf_relocate_rela(struct elf_image_info *image,
|
|||||||
|
|
||||||
for (i = 0; i * (int)sizeof(struct Elf32_Rela) < rel_len; i++) {
|
for (i = 0; i * (int)sizeof(struct Elf32_Rela) < rel_len; i++) {
|
||||||
#if CHATTY
|
#if CHATTY
|
||||||
dprintf("looking at rel type %d, offset 0x%lx, sym 0x%lx, addend 0x%lx\n",
|
dprintf("looking at rel type %d, offset 0x%lx, "
|
||||||
ELF32_R_TYPE(rel[i].r_info), rel[i].r_offset, ELF32_R_SYM(rel[i].r_info), rel[i].r_addend);
|
"sym 0x%lx, addend 0x%lx\n", ELF32_R_TYPE(rel[i].r_info),
|
||||||
|
rel[i].r_offset, ELF32_R_SYM(rel[i].r_info), rel[i].r_addend);
|
||||||
#endif
|
#endif
|
||||||
switch (ELF32_R_TYPE(rel[i].r_info)) {
|
switch (ELF32_R_TYPE(rel[i].r_info)) {
|
||||||
#warning ARM:ADDOTHERREL
|
#warning ARM:ADDOTHERREL
|
||||||
@@ -363,9 +364,9 @@ arch_elf_relocate_rela(struct elf_image_info *image,
|
|||||||
if (vlErr < 0) {
|
if (vlErr < 0) {
|
||||||
dprintf("%s(): Failed to relocate "
|
dprintf("%s(): Failed to relocate "
|
||||||
"entry index %d, rel type %d, offset 0x%lx, sym 0x%lx, "
|
"entry index %d, rel type %d, offset 0x%lx, sym 0x%lx, "
|
||||||
"addend 0x%lx\n", __FUNCTION__, i, ELF32_R_TYPE(rel[i].r_info),
|
"addend 0x%lx\n", __FUNCTION__, i,
|
||||||
rel[i].r_offset, ELF32_R_SYM(rel[i].r_info),
|
ELF32_R_TYPE(rel[i].r_info), rel[i].r_offset,
|
||||||
rel[i].r_addend);
|
ELF32_R_SYM(rel[i].r_info), rel[i].r_addend);
|
||||||
return vlErr;
|
return vlErr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -382,12 +383,11 @@ arch_elf_relocate_rela(struct elf_image_info *image,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
dprintf("arch_elf_relocate_rela(): unhandled "
|
dprintf("arch_elf_relocate_rela(): unhandled "
|
||||||
"relocation type %d!\n",
|
"relocation type %d!\n", ELF32_R_TYPE(rel[i].r_info));
|
||||||
ELF32_R_TYPE(rel[i].r_info));
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning ARM: FIXME!!!!!!!
|
#warning ARM: FIXME!!!!!!!
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
#include <vm/VMAddressSpace.h>
|
#include <vm/VMAddressSpace.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#warning M68K: writeme!
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_ARCH_INT
|
//#define TRACE_ARCH_INT
|
||||||
#ifdef TRACE_ARCH_INT
|
#ifdef TRACE_ARCH_INT
|
||||||
@@ -99,13 +97,17 @@ arch_int_disable_io_interrupt(int irq)
|
|||||||
static void
|
static void
|
||||||
print_iframe(struct iframe *frame)
|
print_iframe(struct iframe *frame)
|
||||||
{
|
{
|
||||||
/*
|
#if 0
|
||||||
dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, frame->r1, frame->r2, frame->r3);
|
dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, frame->r1,
|
||||||
dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, frame->r5, frame->r6, frame->r7);
|
frame->r2, frame->r3);
|
||||||
dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, frame->r9, frame->r10, frame->r11);
|
dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, frame->r5,
|
||||||
dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, frame->r13, frame->a6, frame->a7);
|
frame->r6, frame->r7);
|
||||||
|
dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, frame->r9,
|
||||||
|
frame->r10, frame->r11);
|
||||||
|
dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, frame->r13,
|
||||||
|
frame->a6, frame->a7);
|
||||||
dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr);
|
dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr);
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
#warning ARM WRITEME
|
#warning ARM WRITEME
|
||||||
}
|
}
|
||||||
@@ -114,19 +116,21 @@ print_iframe(struct iframe *frame)
|
|||||||
status_t
|
status_t
|
||||||
arch_int_init(kernel_args *args)
|
arch_int_init(kernel_args *args)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
status_t err;
|
status_t err;
|
||||||
addr_t vbr;
|
addr_t vbr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr;
|
gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr;
|
||||||
|
|
||||||
/* fill in the vector table */
|
/* fill in the vector table */
|
||||||
// for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++)
|
for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++)
|
||||||
// gExceptionVectors[i] = &__m68k_exception_common;
|
gExceptionVectors[i] = &__m68k_exception_common;
|
||||||
|
|
||||||
// vbr = args->arch_args.phys_vbr;
|
vbr = args->arch_args.phys_vbr;
|
||||||
/* point VBR to the new table */
|
/* point VBR to the new table */
|
||||||
// asm volatile ("movec %0,%%vbr" : : "r"(vbr):);
|
asm volatile ("movec %0,%%vbr" : : "r"(vbr):);
|
||||||
|
#endif
|
||||||
#warning ARM WRITEME
|
#warning ARM WRITEME
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -159,5 +163,3 @@ arch_int_init_post_device_manager(struct kernel_args *args)
|
|||||||
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
#include <util/kernel_cpp.h>
|
#include <util/kernel_cpp.h>
|
||||||
|
|
||||||
/*
|
|
||||||
|
#if 0
|
||||||
static M68KPlatform *sM68KPlatform;
|
static M68KPlatform *sM68KPlatform;
|
||||||
|
|
||||||
|
|
||||||
@@ -29,11 +30,13 @@ M68KPlatform::M68KPlatform(platform_type platformType,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
M68KPlatform::~M68KPlatform()
|
M68KPlatform::~M68KPlatform()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
M68KPlatform *
|
M68KPlatform *
|
||||||
M68KPlatform::Default()
|
M68KPlatform::Default()
|
||||||
@@ -43,13 +46,12 @@ M68KPlatform::Default()
|
|||||||
|
|
||||||
|
|
||||||
// # pragma mark -
|
// # pragma mark -
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_platform_init(struct kernel_args *kernelArgs)
|
arch_platform_init(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
#warning ARM:WRITEME
|
#warning ARM:WRITEME
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,9 +59,9 @@ arch_platform_init(struct kernel_args *kernelArgs)
|
|||||||
status_t
|
status_t
|
||||||
arch_platform_init_post_vm(struct kernel_args *kernelArgs)
|
arch_platform_init_post_vm(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
return B_OK;
|
|
||||||
#warning ARM:WRITEME
|
#warning ARM:WRITEME
|
||||||
//sM68KPlatform->InitPostVM(kernelArgs);
|
//sM68KPlatform->InitPostVM(kernelArgs);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <arch/real_time_clock.h>
|
#include <arch/real_time_clock.h>
|
||||||
|
|
||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
#include <real_time_data.h>
|
#include <real_time_data.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,4 +43,3 @@ arch_smp_send_broadcast_ici()
|
|||||||
{
|
{
|
||||||
panic("called arch_smp_send_broadcast_ici\n");
|
panic("called arch_smp_send_broadcast_ici\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <arch_cpu.h>
|
#include <arch_cpu.h>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#warning M68K: writeme!
|
|
||||||
// Valid initial arch_thread state. We just memcpy() it when initializing
|
// Valid initial arch_thread state. We just memcpy() it when initializing
|
||||||
// a new thread structure.
|
// a new thread structure.
|
||||||
static struct arch_thread sInitialState;
|
static struct arch_thread sInitialState;
|
||||||
@@ -82,17 +82,20 @@ arch_thread_init_tls(Thread *thread)
|
|||||||
void
|
void
|
||||||
arch_thread_context_switch(Thread *from, Thread *to)
|
arch_thread_context_switch(Thread *from, Thread *to)
|
||||||
{
|
{
|
||||||
/* addr_t newPageDirectory;
|
#if 0
|
||||||
|
addr_t newPageDirectory;
|
||||||
|
|
||||||
newPageDirectory = (addr_t)m68k_next_page_directory(from, to);
|
newPageDirectory = (addr_t)m68k_next_page_directory(from, to);
|
||||||
|
|
||||||
if ((newPageDirectory % B_PAGE_SIZE) != 0)
|
if ((newPageDirectory % B_PAGE_SIZE) != 0)
|
||||||
panic("arch_thread_context_switch: bad pgdir 0x%lx\n", newPageDirectory);
|
panic("arch_thread_context_switch: bad pgdir 0x%lx\n",
|
||||||
|
newPageDirectory);
|
||||||
#warning M68K: export from arch_vm.c
|
#warning M68K: export from arch_vm.c
|
||||||
m68k_set_pgdir(newPageDirectory);
|
m68k_set_pgdir(newPageDirectory);
|
||||||
m68k_context_switch(&from->arch_info.sp, to->arch_info.sp);*/
|
m68k_context_switch(&from->arch_info.sp, to->arch_info.sp);
|
||||||
#warning ARM:WRITEME
|
#endif
|
||||||
|
|
||||||
|
#warning ARM:WRITEME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +109,8 @@ arch_thread_dump_info(void *info)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1, void *arg2)
|
arch_thread_enter_userspace(Thread *thread, addr_t entry,
|
||||||
|
void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
panic("arch_thread_enter_uspace(): not yet implemented\n");
|
panic("arch_thread_enter_uspace(): not yet implemented\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -145,7 +149,6 @@ arch_check_syscall_restart(Thread *thread)
|
|||||||
* arch_fork_arg structure to be passed to arch_restore_fork_frame().
|
* arch_fork_arg structure to be passed to arch_restore_fork_frame().
|
||||||
* Also makes sure to return the right value.
|
* Also makes sure to return the right value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_store_fork_frame(struct arch_fork_arg *arg)
|
arch_store_fork_frame(struct arch_fork_arg *arg)
|
||||||
{
|
{
|
||||||
@@ -159,9 +162,7 @@ arch_store_fork_frame(struct arch_fork_arg *arg)
|
|||||||
* This function does not return to the caller, but will enter userland
|
* This function does not return to the caller, but will enter userland
|
||||||
* in the child team at the same position where the parent team left of.
|
* in the child team at the same position where the parent team left of.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_restore_fork_frame(struct arch_fork_arg *arg)
|
arch_restore_fork_frame(struct arch_fork_arg *arg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ void
|
|||||||
arch_timer_set_hardware_timer(bigtime_t timeout)
|
arch_timer_set_hardware_timer(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
#warning ARM:WRITEME
|
#warning ARM:WRITEME
|
||||||
|
|
||||||
// M68KPlatform::Default()->SetHardwareTimer(timeout);
|
// M68KPlatform::Default()->SetHardwareTimer(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +39,7 @@ int
|
|||||||
arch_init_timer(kernel_args *args)
|
arch_init_timer(kernel_args *args)
|
||||||
{
|
{
|
||||||
#warning ARM:WRITEME
|
#warning ARM:WRITEME
|
||||||
|
|
||||||
return 0;
|
|
||||||
// M68KPlatform::Default()->InitTimer(args);
|
// M68KPlatform::Default()->InitTimer(args);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#warning ARM: WRITEME
|
#warning ARM: WRITEME
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_clear_team_debug_info(struct arch_team_debug_info *info)
|
arch_clear_team_debug_info(struct arch_team_debug_info *info)
|
||||||
{
|
{
|
||||||
@@ -65,7 +67,6 @@ arch_get_thread_debug_cpu_state(Thread *thread, debug_cpu_state *cpuState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_set_breakpoint(void *address)
|
arch_set_breakpoint(void *address)
|
||||||
{
|
{
|
||||||
@@ -93,6 +94,7 @@ arch_clear_watchpoint(void *address)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
arch_has_breakpoints(struct arch_team_debug_info *info)
|
arch_has_breakpoints(struct arch_team_debug_info *info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* Distributed under the terms of the NewOS License.
|
* Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
# define TRACE(x) ;
|
# define TRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#warning M68K: WRITEME
|
#warning ARM: WRITEME
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_vm_init(kernel_args *args)
|
arch_vm_init(kernel_args *args)
|
||||||
@@ -43,7 +45,7 @@ arch_vm_init2(kernel_args *args)
|
|||||||
// int i;
|
// int i;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
#warning M68K: disable TT0 and TT1, set up pmmu
|
#warning ARM: WRITEME
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -59,8 +61,7 @@ arch_vm_init_post_area(kernel_args *args)
|
|||||||
status_t
|
status_t
|
||||||
arch_vm_init_end(kernel_args *args)
|
arch_vm_init_end(kernel_args *args)
|
||||||
{
|
{
|
||||||
|
#warning ARM: WRITEME
|
||||||
#warning M68K: unset TT0 now
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ arch_vm_translation_map_init(kernel_args *args,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if B_HAIKU_PHYSICAL_BITS == 64 //IRA: Check all 64 bit code and adjust for ARM
|
#if B_HAIKU_PHYSICAL_BITS == 64 //IRA: Check 64 bit code and adjust for ARM
|
||||||
bool paeAvailable = x86_check_feature(IA32_FEATURE_PAE, FEATURE_COMMON);
|
bool paeAvailable = x86_check_feature(IA32_FEATURE_PAE, FEATURE_COMMON);
|
||||||
bool paeNeeded = false;
|
bool paeNeeded = false;
|
||||||
for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) {
|
for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) {
|
||||||
|
|||||||
@@ -20,35 +20,45 @@
|
|||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <arch/arm/reg.h>
|
#include <arch/arm/reg.h>
|
||||||
#include <arch/arm/uart.h>
|
#include <arch/arm/uart.h>
|
||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
//#include <target/debugconfig.h>
|
//#include <target/debugconfig.h>
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_UART BOARD_DEBUG_UART
|
#define DEBUG_UART BOARD_DEBUG_UART
|
||||||
|
|
||||||
|
|
||||||
struct uart_stat {
|
struct uart_stat {
|
||||||
addr_t base;
|
addr_t base;
|
||||||
uint shift;
|
uint shift;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct uart_stat uart[3] = {
|
static struct uart_stat uart[3] = {
|
||||||
{ BOARD_UART1_BASE, 2 },
|
{ BOARD_UART1_BASE, 2 },
|
||||||
{ BOARD_UART2_BASE, 2 },
|
{ BOARD_UART2_BASE, 2 },
|
||||||
{ BOARD_UART3_BASE, 2 },
|
{ BOARD_UART3_BASE, 2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline void write_uart_reg(int port, uint reg, unsigned char data)
|
static inline void write_uart_reg(int port, uint reg, unsigned char data)
|
||||||
{
|
{
|
||||||
*(volatile unsigned char *)(uart[port].base + (reg << uart[port].shift)) = data;
|
*(volatile unsigned char *)(uart[port].base + (reg << uart[port].shift))
|
||||||
|
= data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned char read_uart_reg(int port, uint reg)
|
static inline unsigned char read_uart_reg(int port, uint reg)
|
||||||
{
|
{
|
||||||
return *(volatile unsigned char *)(uart[port].base + (reg << uart[port].shift));
|
return *(volatile unsigned char *)(uart[port].base
|
||||||
|
+ (reg << uart[port].shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define LCR_8N1 0x03
|
#define LCR_8N1 0x03
|
||||||
|
|
||||||
#define FCR_FIFO_EN 0x01 /* Fifo enable */
|
#define FCR_FIFO_EN 0x01 /* Fifo enable */
|
||||||
@@ -87,6 +97,7 @@ static inline unsigned char read_uart_reg(int port, uint reg)
|
|||||||
|
|
||||||
#define V_NS16550_CLK (48000000) /* 48MHz (APLL96/2) */
|
#define V_NS16550_CLK (48000000) /* 48MHz (APLL96/2) */
|
||||||
|
|
||||||
|
|
||||||
int uart_debug_port(void)
|
int uart_debug_port(void)
|
||||||
{
|
{
|
||||||
return DEBUG_UART;
|
return DEBUG_UART;
|
||||||
@@ -111,6 +122,7 @@ void uart_init_port(int port, uint baud)
|
|||||||
// write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
|
// write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uart_init_early(void)
|
void uart_init_early(void)
|
||||||
{
|
{
|
||||||
#if BOARD_CPU_OMAP3
|
#if BOARD_CPU_OMAP3
|
||||||
@@ -129,28 +141,29 @@ void uart_init_early(void)
|
|||||||
#warning INTITIALIZE UART!!!!!
|
#warning INTITIALIZE UART!!!!!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
uart_init_port(DEBUG_UART, 115200);
|
uart_init_port(DEBUG_UART, 115200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uart_init(void)
|
void uart_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uart_putc(int port, char c )
|
int uart_putc(int port, char c )
|
||||||
{
|
{
|
||||||
|
while (!(read_uart_reg(port, UART_LSR) & (1<<6)));
|
||||||
while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last char to get out
|
// wait for the last char to get out
|
||||||
;
|
|
||||||
write_uart_reg(port, UART_THR, c);
|
write_uart_reg(port, UART_THR, c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uart_getc(int port, bool wait) /* returns -1 if no data available */
|
int uart_getc(int port, bool wait) /* returns -1 if no data available */
|
||||||
{
|
{
|
||||||
if (wait) {
|
if (wait) {
|
||||||
while (!(read_uart_reg(port, UART_LSR) & (1<<0))) // wait for data to show up in the rx fifo
|
while (!(read_uart_reg(port, UART_LSR) & (1<<0)));
|
||||||
;
|
// wait for data to show up in the rx fifo
|
||||||
} else {
|
} else {
|
||||||
if (!(read_uart_reg(port, UART_LSR) & (1<<0)))
|
if (!(read_uart_reg(port, UART_LSR) & (1<<0)))
|
||||||
return -1;
|
return -1;
|
||||||
@@ -158,12 +171,14 @@ int uart_getc(int port, bool wait) /* returns -1 if no data available */
|
|||||||
return read_uart_reg(port, UART_RHR);
|
return read_uart_reg(port, UART_RHR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uart_flush_tx(int port)
|
void uart_flush_tx(int port)
|
||||||
{
|
{
|
||||||
while (!(read_uart_reg(port, UART_LSR) & (1<<6))) // wait for the last char to get out
|
while (!(read_uart_reg(port, UART_LSR) & (1<<6)));
|
||||||
;
|
// wait for the last char to get out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uart_flush_rx(int port)
|
void uart_flush_rx(int port)
|
||||||
{
|
{
|
||||||
// empty the rx fifo
|
// empty the rx fifo
|
||||||
@@ -172,5 +187,3 @@ void uart_flush_rx(int port)
|
|||||||
(void)c;
|
(void)c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user