- some cpu and platform fixes.

- we'll just use decimal chip number (68030, ...) to identify cpu, fpu, and mmu for simplicity.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26041 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-06-20 02:11:45 +00:00
parent 7d5d19dfab
commit a3dc7ef06c
5 changed files with 75 additions and 51 deletions

View File

@ -357,9 +357,9 @@ struct m68k_cpu_ops {
void (*flush_insn_pipeline)(void); void (*flush_insn_pipeline)(void);
void (*flush_atc_all)(void); void (*flush_atc_all)(void);
void (*flush_atc_user)(void); void (*flush_atc_user)(void);
void (*flush_atc_addr)(void *addr); void (*flush_atc_addr)(addr_t addr);
void (*flush_dcache)(void *address, size_t len); void (*flush_dcache)(addr_t address, size_t len);
void (*flush_icache)(void *address, size_t len); void (*flush_icache)(addr_t address, size_t len);
void (*idle)(void); void (*idle)(void);
}; };
@ -376,6 +376,10 @@ extern struct m68k_cpu_ops cpu_ops;
#define tlbie(addr) asm volatile("tlbie %0" :: "r" (addr)) #define tlbie(addr) asm volatile("tlbie %0" :: "r" (addr))
#endif #endif
#if 0
// XXX: not used: we just use decimal chip number, like 68030
// m68k processor version. // m68k processor version.
enum m68k_processor_version { enum m68k_processor_version {
/* those two we don't support */ /* those two we don't support */
@ -410,6 +414,7 @@ enum m68k_mmu_version {
MMU_68060 = 0x0600, MMU_68060 = 0x0600,
MMU_MASK = 0x0F00 MMU_MASK = 0x0F00
}; };
#endif
extern int arch_cpu_type; extern int arch_cpu_type;
extern int arch_fpu_type; extern int arch_fpu_type;

View File

@ -15,9 +15,9 @@
// kernel args // kernel args
typedef struct { typedef struct {
int cpu_type; int cpu_type; // decimal: 68030, ...
int fpu_type; int fpu_type; // decimal: 68030, ...
int mmu_type; int mmu_type; // decimal: 68030, ...
int platform; int platform;
bool has_lpstop; //XXX: use bit flags bool has_lpstop; //XXX: use bit flags
// architecture specific // architecture specific

View File

@ -20,7 +20,7 @@ extern "C" {
/* from arch_030_asm.S */ /* from arch_030_asm.S */
extern void flush_insn_pipeline_030(void); extern void flush_insn_pipeline_030(void);
extern void flush_atc_all_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 #ifdef __cplusplus
} }
@ -31,7 +31,7 @@ extern void flush_atc_addr_030(void *addr);
#define CACHELINE 16 #define CACHELINE 16
static void static void
sync_icache_030(void *address, size_t len) sync_icache_030(addr_t address, size_t len)
{ {
int l, off; int l, off;
char *p; char *p;

View File

@ -23,11 +23,6 @@ extern struct m68k_cpu_ops cpu_ops_060;
struct m68k_cpu_ops cpu_ops; struct m68k_cpu_ops cpu_ops;
int cpu_type;
int fpu_type;
int mmu_type;
int platform;
status_t status_t
arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu) 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 status_t
arch_cpu_init(kernel_args *args) arch_cpu_init(kernel_args *args)
{ {
cpu_type = args->arch_args.cpu_type; arch_cpu_type = args->arch_args.cpu_type;
fpu_type = args->arch_args.fpu_type; arch_fpu_type = args->arch_args.fpu_type;
mmu_type = args->arch_args.mmu_type; arch_mmu_type = args->arch_args.mmu_type;
platform = args->arch_args.platform; 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) { switch (arch_cpu_type) {
case CPU_68020: case 68020:
case CPU_68030: case 68030:
cpu_ops.flush_insn_pipeline = cpu_ops_030.flush_insn_pipeline; 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_all = cpu_ops_030.flush_atc_all;
cpu_ops.flush_atc_user = cpu_ops_030.flush_atc_user; 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_atc_addr = cpu_ops_030.flush_atc_addr;
cpu_ops.flush_cache_line = cpu_ops_030.flush_cache_line; cpu_ops.flush_dcache = cpu_ops_030.flush_dcache;
cpu_ops.idle = cpu_ops_030.idle; // NULL cpu_ops.flush_icache = cpu_ops_030.flush_icache;
//cpu_ops. = cpu_ops_030.; cpu_ops.idle = cpu_ops_030.idle; // NULL
break; break;
#ifdef SUPPORTS_040 #ifdef SUPPORTS_040
case CPU_68040: case 68040:
cpu_ops.flush_insn_pipeline = cpu_ops_040.flush_insn_pipeline; 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_all = cpu_ops_040.flush_atc_all;
cpu_ops.flush_atc_user = cpu_ops_040.flush_atc_user; 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_atc_addr = cpu_ops_040.flush_atc_addr;
cpu_ops.flush_cache_line = cpu_ops_040.flush_cache_line; cpu_ops.flush_dcache = cpu_ops_040.flush_dcache;
cpu_ops.idle = cpu_ops_040.idle; // NULL cpu_ops.flush_icache = cpu_ops_040.flush_icache;
//cpu_ops. = cpu_ops_040.; cpu_ops.idle = cpu_ops_040.idle; // NULL
break; break;
#endif #endif
#ifdef SUPPORTS_060 #ifdef SUPPORTS_060
case CPU_68060: case 68060:
cpu_ops.flush_insn_pipeline = cpu_ops_060.flush_insn_pipeline; 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_all = cpu_ops_060.flush_atc_all;
cpu_ops.flush_atc_user = cpu_ops_060.flush_atc_user; 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_atc_addr = cpu_ops_060.flush_atc_addr;
cpu_ops.flush_cache_line = cpu_ops_060.flush_cache_line; cpu_ops.flush_dcache = cpu_ops_060.flush_dcache;
cpu_ops.idle = cpu_ops_060.idle; cpu_ops.flush_icache = cpu_ops_060.flush_icache;
//cpu_ops. = cpu_ops_060.; cpu_ops.idle = cpu_ops_060.idle;
break; break;
#endif #endif
default: default:
panic("unknown cpu_type 0x%08lx\n", args->arch_args.cpu_type); panic("unknown cpu_type %d\n", arch_cpu_type);
} }
return B_OK; return B_OK;
} }
@ -106,7 +109,7 @@ arch_cpu_init_post_modules(kernel_args *args)
void void
arch_cpu_sync_icache(void *address, size_t len) arch_cpu_sync_icache(void *address, size_t len)
{ {
cpu_ops.flush_icache(address, len); cpu_ops.flush_icache((addr_t)address, len);
} }

View File

@ -76,7 +76,7 @@ using BPrivate::M68KApple;
// constructor // constructor
M68KApple::M68KApple() M68KApple::M68KApple()
: M68KPlatform(M68K_PLATFORM_OPEN_FIRMWARE), : M68KPlatform(M68K_PLATFORM_MAC),
fRTC(-1) fRTC(-1)
{ {
} }
@ -134,12 +134,14 @@ M68KApple::SerialDebugPutChar(char c)
void void
M68KApple::ShutDown(bool reboot) M68KApple::ShutDown(bool reboot)
{ {
#if 0
if (reboot) { if (reboot) {
of_interpret("reset-all", 0, 0); of_interpret("reset-all", 0, 0);
} else { } else {
// not standardized, so it might fail // not standardized, so it might fail
of_interpret("shut-down", 0, 0); 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 #warning M68K: switch platform from kernel args
// only Atari supported for now // only Atari supported for now
if (true) switch (args->arch_args.platform) {
sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; 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); return sM68KPlatform->Init(kernelArgs);
} }