PPC: Preliminary untested boot support for Common Firmware Environment

CFE is used in the upcoming Amiga X-1000 dualcore PPC board.
* Largely inspired by the OF and U-Boot code.
* Still largely stubbed out.
* The loader builds but I don't have a machine to test it. Anyone interested?
This commit is contained in:
François Revol
2011-11-14 01:31:50 +01:00
parent 5247333d36
commit 478dc9887e
26 changed files with 2091 additions and 0 deletions
@@ -0,0 +1,54 @@
/*
* Copyright 2011, François Revol, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_PLATFORM_CFE_CFE_H
#define KERNEL_BOOT_PLATFORM_CFE_CFE_H
#include <SupportDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CFE_EPTSEAL 0x43464531 /* 'CFE1' */
#define CFE_MAGIC CFE_EPTSEAL
// cfe/include/cfe_timer.h
#define CFE_HZ 10
/* CFE sources declare this separately in cfe_api.h */
/* (let's hope it's always built-in,
unlike u-boot's API which never is... */
#define CFE_FLG_COLDSTART 0x00000000
#define CFE_FLG_WARMSTART 0x00000001
#define CFE_STDHANDLE_CONSOLE 0
int cfe_init(uint64 handle, uint64 entry);
int cfe_exit(int32 warm, int32 status);
uint64 cfe_getticks(void);
int cfe_enumdev(int idx, char *name, int namelen);
int cfe_getstdhandle(int flag);
int cfe_open(const char *name);
int cfe_close(int handle);
int cfe_readblk(int handle, int64 offset, void *buffer, int length);
int cfe_writeblk(int handle, int64 offset, const void *buffer, int length);
#define CFE_OK 0
#define CFE_ERR -1
status_t cfe_error(int32 err);
#ifdef __cplusplus
}
#endif
#endif /* KERNEL_BOOT_PLATFORM_CFE_CFE_H */
@@ -0,0 +1,38 @@
/*
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
*/
#ifndef KERNEL_BOOT_PLATFORM_CFE_ARCH_H
#define KERNEL_BOOT_PLATFORM_CFE_ARCH_H
#include <SupportDefs.h>
struct kernel_args;
#ifdef __cplusplus
extern "C" {
#endif
/* memory management */
extern status_t arch_set_callback(void);
extern void *arch_mmu_allocate(void *address, size_t size,
uint8 protection, bool exactAddress);
extern status_t arch_mmu_free(void *address, size_t size);
extern status_t arch_mmu_init(void);
/* CPU */
extern status_t boot_arch_cpu_init(void);
/* kernel start */
status_t arch_start_kernel(struct kernel_args *kernelArgs,
addr_t kernelEntry, addr_t kernelStackTop);
#ifdef __cplusplus
}
#endif
#endif /* KERNEL_BOOT_PLATFORM_CFE_ARCH_H */
@@ -0,0 +1,24 @@
/*
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
*/
#ifndef KERNEL_BOOT_PLATFORM_CFE_KERNEL_ARGS_H
#define KERNEL_BOOT_PLATFORM_CFE_KERNEL_ARGS_H
#ifndef KERNEL_BOOT_KERNEL_ARGS_H
# error This file is included from <boot/kernel_args.h> only
#endif
// must match SMP_MAX_CPUS in arch_smp.h
#define MAX_BOOT_CPUS 4
#define MAX_PHYSICAL_MEMORY_RANGE 4
#define MAX_PHYSICAL_ALLOCATED_RANGE 8
#define MAX_VIRTUAL_ALLOCATED_RANGE 32
typedef struct {
uint64 cfe_entry; // pointer but always 64bit
//XXX:char rtc_path[128];
} platform_kernel_args;
#endif /* KERNEL_BOOT_PLATFORM_CFE_KERNEL_ARGS_H */
@@ -0,0 +1,15 @@
/*
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
*/
#ifndef KERNEL_BOOT_PLATFORM_CFE_STAGE2_ARGS_H
#define KERNEL_BOOT_PLATFORM_CFE_STAGE2_ARGS_H
#ifndef KERNEL_BOOT_STAGE2_ARGS_H
# error This file is included from <boot/stage2_args.h> only
#endif
struct platform_stage2_args {
};
#endif /* KERNEL_BOOT_PLATFORM_CFE_STAGE2_ARGS_H */