/branches/tracing/boot/arch/ppc32/loader/debug.inc |
---|
File deleted |
/branches/tracing/boot/arch/ppc32/loader/_link.ld.in |
---|
1,9 → 1,9 |
OUTPUT_FORMAT("elf32-powerpc") |
OUTPUT_ARCH(powerpc:common) |
ENTRY(start) |
OUTPUT_FORMAT("elf32-powerpc") |
OUTPUT_ARCH(powerpc:common) |
ENTRY(start) |
SECTIONS { |
.boot 0x10000000: AT (0) { |
.boot 0x01000000: AT (0) { |
*(BOOTSTRAP); |
*(REALMODE); |
*(.text); |
10,12 → 10,12 |
*(.rodata); |
*(.rodata.*); |
*(.data); /* initialized data */ |
*(.data); /* initialized data */ |
*(.sdata); |
*(.sdata2); |
*(.sbss); |
*(.bss); /* uninitialized static variables */ |
*(COMMON); /* global variables */ |
*(.bss); /* uninitialized static variables */ |
*(COMMON); /* global variables */ |
[[COMPONENTS]] |
} |
} |
/branches/tracing/boot/arch/ppc32/loader/asm.S |
---|
28,8 → 28,26 |
#include "asm.h" |
#include "regname.h" |
#include "debug.inc" |
.macro SMC_COHERENCY addr |
dcbst 0, \addr |
sync |
icbi 0, \addr |
sync |
isync |
.endm |
.macro FLUSH_DCACHE addr |
dcbst 0, \addr |
sync |
isync |
.endm |
.macro TLB_FLUSH reg |
tlbie \reg |
addi \reg, \reg, 0x1000 |
.endm |
.text |
.global halt |
140,9 → 158,6 |
real_mode: |
DEBUG_INIT |
DEBUG_real_mode |
# copy kernel to proper location |
# |
# r5 = trans (pa) |
163,14 → 178,13 |
mtctr r31 |
lwz r29, 0(r5) |
DEBUG_INIT |
DEBUG_copy_loop |
copy_loop: |
lwz r28, 0(r29) |
stw r28, 0(r30) |
SMC_COHERENCY r30 |
addi r29, r29, 4 |
addi r30, r30, 4 |
subi r6, r6, 4 |
180,15 → 194,11 |
bdnz copy_loop |
DEBUG_end_copy_loop |
addi r5, r5, 4 |
b page_copy |
copy_end: |
DEBUG_segments |
# initially fill segment registers |
li r31, 0 |
196,7 → 206,7 |
li r29, 8 |
mtctr r29 |
li r30, 0 # ASID 0 (VSIDs 0 .. 7) |
seg_fill_uspace: |
mtsrin r30, r31 |
220,8 → 230,6 |
# invalidate block address translation registers |
DEBUG_bat |
li r30, 0 |
mtspr ibat0u, r30 |
251,8 → 259,6 |
# create empty Page Hash Table |
# on top of memory, size 64 KB |
DEBUG_pht |
lwz r31, 0(r3) # r31 = memory size |
lis r30, 65536@h |
274,6 → 280,7 |
# write zeroes |
stw r29, 0(r31) |
FLUSH_DCACHE r31 |
addi r31, r31, 4 |
subi r30, r30, 4 |
282,8 → 289,6 |
beq clear_end |
bdnz pht_clear |
DEBUG_end_pht_clear |
clear_end: |
291,8 → 296,6 |
# create BAT identity mapping |
DEBUG_mapping |
lwz r31, 0(r3) # r31 = memory size |
lis r29, 0x0002 |
315,8 → 318,6 |
bdnz bat_mask |
DEBUG_bat_mask |
andi. r31, r31, 0x07ff # mask = mask & 0x07ff (BAT can map up to 256 MB) |
li r29, 2 |
336,16 → 337,90 |
mtspr dbat0l, r30 |
no_bat: |
#endif |
DEBUG_tlb |
# flush TLB |
tlbia |
li r31, 0 |
sync |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
TLB_FLUSH r31 |
eieio |
tlbsync |
sync |
DEBUG_prepare |
# start the kernel |
# |
# pc = KERNEL_START_ADDR |
373,8 → 448,6 |
sync |
isync |
DEBUG_rfi |
rfi |
.align PAGE_WIDTH |
/branches/tracing/boot/arch/ppc32/loader/regname.h |
---|
208,11 → 208,13 |
#define hid0 1008 |
/* MSR bits */ |
#define msr_ir (1 << 4) |
#define msr_dr (1 << 5) |
#define msr_dr (1 << 4) |
#define msr_ir (1 << 5) |
#define msr_pr (1 << 14) |
#define msr_ee (1 << 15) |
/* HID0 bits */ |
#define hid0_sten (1 << 24) |
#define hid0_ice (1 << 15) |
#define hid0_dce (1 << 14) |
#define hid0_icfi (1 << 11) |
/branches/tracing/boot/arch/ppc32/loader/main.c |
---|
32,6 → 32,8 |
#include "_components.h" |
#include <ofw.h> |
#include <align.h> |
#include <macros.h> |
#include <string.h> |
#define HEAP_GAP 1024000 |
72,16 → 74,16 |
} |
} |
char *release = RELEASE; |
char *release = STRING(RELEASE); |
#ifdef REVISION |
char *revision = ", revision " REVISION; |
char *revision = ", revision " STRING(REVISION); |
#else |
char *revision = ""; |
#endif |
#ifdef TIMESTAMP |
char *timestamp = "\nBuilt on " TIMESTAMP; |
char *timestamp = "\nBuilt on " STRING(TIMESTAMP); |
#else |
char *timestamp = ""; |
#endif |
89,7 → 91,7 |
/** Print version information. */ |
static void version_print(void) |
{ |
printf("HelenOS PPC32 Bootloader\nRelease %s%s%s\nCopyright (c) 2006 HelenOS project\n", release, revision, timestamp); |
printf("HelenOS PPC32 Bootloader\nRelease %s%s%s\nCopyright (c) 2006 HelenOS project\n\n", release, revision, timestamp); |
} |
void bootstrap(void) |
107,25 → 109,29 |
check_align(&trans, "translation table"); |
if (!ofw_memmap(&bootinfo.memmap)) { |
printf("Error: unable to get memory map, halting.\n"); |
printf("Error: Unable to get memory map, halting.\n"); |
halt(); |
} |
if (bootinfo.memmap.total == 0) { |
printf("Error: no memory detected, halting.\n"); |
printf("Error: No memory detected, halting.\n"); |
halt(); |
} |
if (!ofw_screen(&bootinfo.screen)) |
printf("Warning: unable to get screen properties.\n"); |
printf("Warning: Unable to get screen properties.\n"); |
if (!ofw_keyboard(&bootinfo.keyboard)) |
printf("Warning: unable to get keyboard properties.\n"); |
if (!ofw_macio(&bootinfo.macio)) |
printf("Warning: Unable to get macio properties.\n"); |
printf("\nDevice statistics\n"); |
printf(" screen at %L, resolution %dx%d, %d bpp (scanline %d bytes)\n", bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
printf(" keyboard at %L (size %d bytes)\n", bootinfo.keyboard.addr, bootinfo.keyboard.size); |
printf("Device statistics\n"); |
if (bootinfo.screen.addr) |
printf(" screen at %L, resolution %dx%d, %d bpp (scanline %d bytes)\n", bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
if (bootinfo.macio.addr) |
printf(" macio at %L (size %d bytes)\n", bootinfo.macio.addr, bootinfo.macio.size); |
void *real_mode_pa = ofw_translate(&real_mode); |
void *trans_pa = ofw_translate(&trans); |
void *bootinfo_pa = ofw_translate(&bootinfo); |
161,6 → 167,9 |
if (j == 0) { |
bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = (void *) (pages << PAGE_WIDTH); |
bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size; |
strncpy(bootinfo.taskmap.tasks[bootinfo.taskmap.count].name, |
components[i].name, BOOTINFO_TASK_NAME_BUFLEN); |
bootinfo.taskmap.count++; |
} |
} |
172,6 → 181,8 |
fix_overlap(&trans, &trans_pa, "translation table", &top); |
fix_overlap(&bootinfo, &bootinfo_pa, "boot info", &top); |
ofw_setup_palette(); |
printf("\nBooting the kernel...\n"); |
jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa, (void *) bootinfo.screen.addr, bootinfo.screen.scanline); |
} |
/branches/tracing/boot/arch/ppc32/loader/main.h |
---|
33,9 → 33,17 |
#define TASKMAP_MAX_RECORDS 32 |
/** Size of buffer for storing task name in task_t. */ |
#define BOOTINFO_TASK_NAME_BUFLEN 32 |
/** Struct holding information about single loaded task. */ |
typedef struct { |
/** Address where the task was placed. */ |
void *addr; |
/** Size of the task's binary. */ |
unsigned int size; |
/** Task name. */ |
char name[BOOTINFO_TASK_NAME_BUFLEN]; |
} task_t; |
typedef struct { |
47,7 → 55,7 |
memmap_t memmap; |
taskmap_t taskmap; |
screen_t screen; |
keyboard_t keyboard; |
macio_t macio; |
} bootinfo_t; |
extern void start(void); |
/branches/tracing/boot/arch/ppc32/loader/ofwarch.c |
---|
48,22 → 48,24 |
} |
} |
int ofw_keyboard(keyboard_t *keyboard) |
int ofw_macio(macio_t *macio) |
{ |
char device_name[BUF_SIZE]; |
if (ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) |
if ((ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0) |
&& (ofw_get_property(ofw_aliases, "mac-io", device_name, sizeof(device_name)) <= 0)) |
return false; |
phandle device = ofw_find_device(device_name); |
if (device == -1) |
return false; |
pci_reg_t macio; |
if (ofw_get_property(device, "assigned-addresses", &macio, sizeof(macio)) <= 0) |
pci_reg_t pci_reg; |
if (ofw_get_property(device, "assigned-addresses", &pci_reg, sizeof(pci_reg)) <= 0) |
return false; |
keyboard->addr = (void *) macio.addr.addr_lo; |
keyboard->size = macio.size_lo; |
macio->addr = (void *) pci_reg.addr.addr_lo; |
macio->size = pci_reg.size_lo; |
return true; |
} |
/branches/tracing/boot/arch/ppc32/loader/Makefile |
---|
27,7 → 27,7 |
# |
include ../../../../version |
include ../../../Makefile.config |
-include ../../../../Makefile.config |
## Toolchain configuration |
# |
57,16 → 57,8 |
OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
endif |
CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../../genarch -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=powerpc -msoft-float -m32 -pipe |
CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -I../../../genarch -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=powerpc -msoft-float -m32 -pipe |
ifdef REVISION |
CFLAGS += "-DREVISION=\"$(REVISION)\"" |
endif |
ifdef TIMESTAMP |
CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
endif |
SOURCES = \ |
main.c \ |
ofwarch.c \ |
73,6 → 65,7 |
_components.c \ |
../../../genarch/ofw.c \ |
../../../generic/printf.c \ |
../../../generic/string.c \ |
asm.S \ |
boot.S |
83,7 → 76,7 |
$(USPACEDIR)/app/init/init \ |
$(USPACEDIR)/srv/devmap/devmap \ |
$(USPACEDIR)/srv/rd/rd \ |
$(USPACEDIR)/srv/vfs/vfs |
$(USPACEDIR)/srv/vfs/vfs |
ifeq ($(RDFMT),tmpfs) |
COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs |
endif |