Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1894 → Rev 1893

/trunk/boot/genarch/balloc.c
File deleted
/trunk/boot/genarch/balloc.h
File deleted
/trunk/boot/genarch/ofw_tree.h
37,17 → 37,15
typedef struct ofw_tree_node ofw_tree_node_t;
typedef struct ofw_tree_property ofw_tree_property_t;
 
/** Memory representation of OpenFirmware device tree node. */
struct ofw_tree_node {
ofw_tree_node_t *parent;
ofw_tree_node_t *peer;
ofw_tree_node_t *child;
 
unsigned properties; /**< Number of properties. */
unsigned properties;
ofw_tree_property_t *property;
};
 
/** Memory representation of OpenFirmware device tree node property. */
struct ofw_tree_property {
char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
size_t size;
/trunk/boot/genarch/ofw_tree.c
30,21 → 30,20
#include <ofw.h>
#include <types.h>
#include <string.h>
#include <balloc.h>
 
static ofw_tree_node_t *ofw_tree_node_alloc(void)
{
return balloc(sizeof(ofw_tree_node_t), sizeof(ofw_tree_node_t));
return NULL;
}
 
static ofw_tree_property_t *ofw_tree_properties_alloc(unsigned count)
{
return balloc(count * sizeof(ofw_tree_property_t), sizeof(ofw_tree_property_t));
return NULL;
}
 
static void * ofw_tree_space_alloc(size_t size)
{
return balloc(size, size);
return NULL;
}
 
/** Transfer information from one OpenFirmware node into its memory representation.
/trunk/boot/arch/sparc64/loader/Makefile
52,7 → 52,6
main.c \
../../../generic/printf.c \
../../../generic/string.c \
../../../genarch/balloc.c \
../../../genarch/ofw.c \
../../../genarch/ofw_tree.c \
ofwarch.c \
/trunk/boot/arch/sparc64/loader/main.c
30,9 → 30,7
#include <printf.h>
#include "asm.h"
#include "_components.h"
#include <balloc.h>
#include <ofw.h>
#include <ofw_tree.h>
#include "ofwarch.h"
#include <align.h>
 
85,12 → 83,12
for (i = 0; i < COMPONENTS; i++)
printf(" %P: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
 
void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
printf("\nCopying components\n");
unsigned int top = 0;
 
printf("\nCopying components\n");
bootinfo.taskmap.count = 0;
for (i = 0; i < COMPONENTS; i++) {
void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
printf(" %s...", components[i].name);
top = ALIGN_UP(top, PAGE_SIZE);
memcpy(base + top, components[i].start, components[i].size);
103,12 → 101,6
printf("done.\n");
}
 
balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top, PAGE_SIZE));
 
printf("\nCanonizing OpenFirmware device tree...");
bootinfo.ofw_root = ofw_tree_build();
printf("done.\n");
 
printf("\nBooting the kernel...\n");
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
}
/trunk/boot/arch/sparc64/loader/main.h
30,8 → 30,6
#define BOOT_sparc64_MAIN_H_
 
#include <ofw.h>
#include <ofw_tree.h>
#include <balloc.h>
#include <types.h>
 
#define TASKMAP_MAX_RECORDS 32
56,8 → 54,6
screen_t screen;
keyboard_t keyboard;
cpu_t cpu;
ballocs_t ballocs;
ofw_tree_node_t *ofw_root;
} bootinfo_t;
 
extern void start(void);
/trunk/kernel/arch/sparc64/src/sparc64.c
51,7 → 51,7
 
void arch_pre_main(void)
{
/* Copy init task info. */
/* Setup usermode */
init.cnt = bootinfo.taskmap.count;
uint32_t i;
60,10 → 60,6
init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr);
init.tasks[i].size = bootinfo.taskmap.tasks[i].size;
}
/* Copy boot allocations info. */
ballocs.base = bootinfo.ballocs.base;
ballocs.size = bootinfo.ballocs.size;
}
 
void arch_pre_mm_init(void)
/trunk/kernel/arch/sparc64/include/boot/boot.h
35,6 → 35,7
#ifndef KERN_sparc64_BOOT_H_
#define KERN_sparc64_BOOT_H_
 
 
#define VMA 0x400000
#define LMA VMA
 
41,10 → 42,8
#ifndef __ASM__
#ifndef __LINKER__
 
#include <config.h>
#include <arch/types.h>
#include <typedefs.h>
#include <genarch/ofw/ofw_tree.h>
 
#define TASKMAP_MAX_RECORDS 32
#define MEMMAP_MAX_RECORDS 32
87,10 → 86,6
uint32_t clock_frequency;
} processor_t;
 
/** Bootinfo structure.
*
* Must be in sync with bootinfo structure used by the boot loader.
*/
typedef struct {
taskmap_t taskmap;
memmap_t memmap;
97,8 → 92,6
screen_t screen;
keyboard_t keyboard;
processor_t processor;
ballocs_t ballocs;
ofw_tree_node_t *ofw_root;
} bootinfo_t;
 
extern bootinfo_t bootinfo;
/trunk/kernel/genarch/src/ofw/ofw_tree.c
File deleted
/trunk/kernel/genarch/include/ofw/ofw_tree.h
File deleted
/trunk/kernel/genarch/Makefile.inc
87,10 → 87,3
genarch/src/kbd/key.c \
genarch/src/kbd/scanc_sun.c
endif
 
 
## OpenFirmware Device Tree
ifeq ($(CONFIG_OFW_TREE), y)
GENARCH_SOURCES += \
genarch/src/ofw/ofw_tree,c
endif
/trunk/kernel/generic/include/config.h
55,17 → 55,7
init_task_t tasks[CONFIG_INIT_TASKS];
} init_t;
 
/** Boot allocations.
*
* Allocatations made by the boot that are meant to be used by the kernel
* are all recorded in the ballocs_t type.
*/
typedef struct {
uintptr_t base;
size_t size;
} ballocs_t;
 
typedef struct {
count_t cpu_count; /**< Number of processors detected. */
volatile count_t cpu_active; /**< Number of processors that are up and running. */
 
79,7 → 69,6
 
extern config_t config;
extern init_t init;
extern ballocs_t ballocs;
 
#endif
 
/trunk/kernel/generic/src/mm/frame.c
1077,9 → 1077,6
for (i = 0; i < init.cnt; i++)
frame_mark_unavailable(ADDR2PFN(KA2PA(init.tasks[i].addr)), SIZE2FRAMES(init.tasks[i].size));
 
if (ballocs.size)
frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)), SIZE2FRAMES(ballocs.size));
 
/* Black list first frame, as allocating NULL would
* fail in some places */
frame_mark_unavailable(0, 1);
/trunk/kernel/generic/src/main/main.c
94,12 → 94,6
0
};
 
/** Boot allocations. */
ballocs_t ballocs = {
.base = NULL,
.size = 0
};
 
context_t ctx;
 
/*
111,7 → 105,7
size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. */
size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */
 
uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */
uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */
 
void main_bsp(void);
void main_ap(void);
158,12 → 152,6
if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size))
config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size);
}
 
/* Avoid placing stack on top of boot allocations. */
if (ballocs.size) {
if (PA_overlaps(config.stack_base, config.stack_size, ballocs.base, ballocs.size))
config.stack_base = ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE);
}
if (config.stack_base < stack_safe)
config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE);