Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1893 → Rev 1894

/trunk/kernel/genarch/include/ofw/ofw_tree.h
0,0 → 1,56
/*
* Copyright (C) 2006 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef KERN_OFW_TREE_H_
#define KERN_OFW_TREE_H_
 
#include <arch/types.h>
 
#define OFW_TREE_PROPERTY_MAX_NAMELEN 32
 
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. */
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;
void *value;
};
 
#endif
/trunk/kernel/genarch/Makefile.inc
87,3 → 87,10
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/genarch/src/ofw/ofw_tree.c
0,0 → 1,39
/*
* Copyright (C) 2006 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup ofw
* @{
*/
/**
* @file
* @brief OpenFirmware device tree navigation.
*
*/
 
/** @}
*/
/trunk/kernel/generic/include/config.h
55,7 → 55,17
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. */
 
69,6 → 79,7
 
extern config_t config;
extern init_t init;
extern ballocs_t ballocs;
 
#endif
 
/trunk/kernel/generic/src/main/main.c
94,6 → 94,12
0
};
 
/** Boot allocations. */
ballocs_t ballocs = {
.base = NULL,
.size = 0
};
 
context_t ctx;
 
/*
105,7 → 111,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);
152,6 → 158,12
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);
/trunk/kernel/generic/src/mm/frame.c
1077,6 → 1077,9
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/arch/sparc64/include/boot/boot.h
35,7 → 35,6
#ifndef KERN_sparc64_BOOT_H_
#define KERN_sparc64_BOOT_H_
 
 
#define VMA 0x400000
#define LMA VMA
 
42,8 → 41,10
#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
86,6 → 87,10
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;
92,6 → 97,8
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/arch/sparc64/src/sparc64.c
51,7 → 51,7
 
void arch_pre_main(void)
{
/* Setup usermode */
/* Copy init task info. */
init.cnt = bootinfo.taskmap.count;
uint32_t i;
60,6 → 60,10
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)