diff --git a/headers/private/kernel/arch/m68k/arch_cpu.h b/headers/private/kernel/arch/m68k/arch_cpu.h index 0145d8ca35..4a8560012a 100644 --- a/headers/private/kernel/arch/m68k/arch_cpu.h +++ b/headers/private/kernel/arch/m68k/arch_cpu.h @@ -357,9 +357,9 @@ struct m68k_cpu_ops { void (*flush_insn_pipeline)(void); void (*flush_atc_all)(void); void (*flush_atc_user)(void); - void (*flush_atc_addr)(void *addr); - void (*flush_dcache)(void *address, size_t len); - void (*flush_icache)(void *address, size_t len); + 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); }; @@ -376,6 +376,10 @@ extern struct m68k_cpu_ops cpu_ops; #define tlbie(addr) asm volatile("tlbie %0" :: "r" (addr)) #endif +#if 0 + +// XXX: not used: we just use decimal chip number, like 68030 + // m68k processor version. enum m68k_processor_version { /* those two we don't support */ @@ -410,6 +414,7 @@ enum m68k_mmu_version { MMU_68060 = 0x0600, MMU_MASK = 0x0F00 }; +#endif extern int arch_cpu_type; extern int arch_fpu_type; diff --git a/headers/private/kernel/arch/m68k/arch_kernel_args.h b/headers/private/kernel/arch/m68k/arch_kernel_args.h index fb7c8e637b..51563cd0c4 100644 --- a/headers/private/kernel/arch/m68k/arch_kernel_args.h +++ b/headers/private/kernel/arch/m68k/arch_kernel_args.h @@ -15,9 +15,9 @@ // kernel args typedef struct { - int cpu_type; - int fpu_type; - int mmu_type; + int cpu_type; // decimal: 68030, ... + int fpu_type; // decimal: 68030, ... + int mmu_type; // decimal: 68030, ... int platform; bool has_lpstop; //XXX: use bit flags // architecture specific diff --git a/src/system/kernel/arch/m68k/arch_030_cpu.cpp b/src/system/kernel/arch/m68k/arch_030_cpu.cpp index 4fa7e11c0c..3c83f262c7 100644 --- a/src/system/kernel/arch/m68k/arch_030_cpu.cpp +++ b/src/system/kernel/arch/m68k/arch_030_cpu.cpp @@ -20,7 +20,7 @@ extern "C" { /* from arch_030_asm.S */ extern void flush_insn_pipeline_030(void); extern void flush_atc_all_030(void); -extern void flush_atc_addr_030(void *addr); +extern void flush_atc_addr_030(addr_t addr); #ifdef __cplusplus } @@ -31,7 +31,7 @@ extern void flush_atc_addr_030(void *addr); #define CACHELINE 16 static void -sync_icache_030(void *address, size_t len) +sync_icache_030(addr_t address, size_t len) { int l, off; char *p; diff --git a/src/system/kernel/arch/m68k/arch_cpu.cpp b/src/system/kernel/arch/m68k/arch_cpu.cpp index d26e20ebad..8534954e3c 100644 --- a/src/system/kernel/arch/m68k/arch_cpu.cpp +++ b/src/system/kernel/arch/m68k/arch_cpu.cpp @@ -23,11 +23,6 @@ extern struct m68k_cpu_ops cpu_ops_060; struct m68k_cpu_ops cpu_ops; -int cpu_type; -int fpu_type; -int mmu_type; -int platform; - status_t arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu) { @@ -45,47 +40,55 @@ arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu) status_t arch_cpu_init(kernel_args *args) { - cpu_type = args->arch_args.cpu_type; - fpu_type = args->arch_args.fpu_type; - mmu_type = args->arch_args.mmu_type; - platform = args->arch_args.platform; + arch_cpu_type = args->arch_args.cpu_type; + arch_fpu_type = args->arch_args.fpu_type; + arch_mmu_type = args->arch_args.mmu_type; + arch_platform = args->arch_args.platform; + void (*flush_insn_pipeline)(void); + void (*flush_atc_all)(void); + void (*flush_atc_user)(void); + void (*flush_atc_addr)(void *addr); + void (*flush_dcache)(void *address, size_t len); + void (*flush_icache)(void *address, size_t len); + void (*idle)(void); - switch (cpu_type) { - case CPU_68020: - case CPU_68030: - cpu_ops.flush_insn_pipeline = cpu_ops_030.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_030.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_030.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_030.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_030.flush_cache_line; - cpu_ops.idle = cpu_ops_030.idle; // NULL - //cpu_ops. = cpu_ops_030.; - break; + switch (arch_cpu_type) { + case 68020: + case 68030: + cpu_ops.flush_insn_pipeline = cpu_ops_030.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_030.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_030.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_030.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_030.flush_dcache; + cpu_ops.flush_icache = cpu_ops_030.flush_icache; + cpu_ops.idle = cpu_ops_030.idle; // NULL + break; #ifdef SUPPORTS_040 - case CPU_68040: - cpu_ops.flush_insn_pipeline = cpu_ops_040.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_040.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_040.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_040.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_040.flush_cache_line; - cpu_ops.idle = cpu_ops_040.idle; // NULL - //cpu_ops. = cpu_ops_040.; - break; + case 68040: + cpu_ops.flush_insn_pipeline = cpu_ops_040.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_040.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_040.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_040.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_040.flush_dcache; + cpu_ops.flush_icache = cpu_ops_040.flush_icache; + cpu_ops.idle = cpu_ops_040.idle; // NULL + break; #endif #ifdef SUPPORTS_060 - case CPU_68060: - cpu_ops.flush_insn_pipeline = cpu_ops_060.flush_insn_pipeline; - cpu_ops.flush_atc_all = cpu_ops_060.flush_atc_all; - cpu_ops.flush_atc_user = cpu_ops_060.flush_atc_user; - cpu_ops.flush_atc_addr = cpu_ops_060.flush_atc_addr; - cpu_ops.flush_cache_line = cpu_ops_060.flush_cache_line; - cpu_ops.idle = cpu_ops_060.idle; - //cpu_ops. = cpu_ops_060.; + case 68060: + cpu_ops.flush_insn_pipeline = cpu_ops_060.flush_insn_pipeline; + cpu_ops.flush_atc_all = cpu_ops_060.flush_atc_all; + cpu_ops.flush_atc_user = cpu_ops_060.flush_atc_user; + cpu_ops.flush_atc_addr = cpu_ops_060.flush_atc_addr; + cpu_ops.flush_dcache = cpu_ops_060.flush_dcache; + cpu_ops.flush_icache = cpu_ops_060.flush_icache; + cpu_ops.idle = cpu_ops_060.idle; break; #endif - default: - panic("unknown cpu_type 0x%08lx\n", args->arch_args.cpu_type); + default: + panic("unknown cpu_type %d\n", arch_cpu_type); } + return B_OK; } @@ -106,7 +109,7 @@ arch_cpu_init_post_modules(kernel_args *args) void arch_cpu_sync_icache(void *address, size_t len) { - cpu_ops.flush_icache(address, len); + cpu_ops.flush_icache((addr_t)address, len); } diff --git a/src/system/kernel/arch/m68k/arch_platform.cpp b/src/system/kernel/arch/m68k/arch_platform.cpp index 93c7f49195..4c39028f8e 100644 --- a/src/system/kernel/arch/m68k/arch_platform.cpp +++ b/src/system/kernel/arch/m68k/arch_platform.cpp @@ -76,7 +76,7 @@ using BPrivate::M68KApple; // constructor M68KApple::M68KApple() - : M68KPlatform(M68K_PLATFORM_OPEN_FIRMWARE), + : M68KPlatform(M68K_PLATFORM_MAC), fRTC(-1) { } @@ -134,12 +134,14 @@ M68KApple::SerialDebugPutChar(char c) void M68KApple::ShutDown(bool reboot) { +#if 0 if (reboot) { of_interpret("reset-all", 0, 0); } else { // not standardized, so it might fail of_interpret("shut-down", 0, 0); } +#endif } @@ -279,8 +281,22 @@ arch_platform_init(struct kernel_args *kernelArgs) { #warning M68K: switch platform from kernel args // only Atari supported for now - if (true) - sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; + switch (args->arch_args.platform) { + case M68K_PLATFORM_AMIGA: + sM68KPlatform = new(sM68KPlatformBuffer) M68KAmiga; + break; + case M68K_PLATFORM_ATARI: + sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; + break; + case M68K_PLATFORM_MAC: + sM68KPlatform = new(sM68KPlatformBuffer) M68KApple; + break; + case M68K_PLATFORM_NEXT: + sM68KPlatform = new(sM68KPlatformBuffer) M68KNext; + break; + default: + panic("unknown platform d\n", args->arch_args.platform); + } return sM68KPlatform->Init(kernelArgs); }