- first steps to intialize the a Rock Creek system
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@59 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
3131e0a9bf
commit
2a6664f01a
5 changed files with 111 additions and 3 deletions
|
@ -24,6 +24,9 @@
|
|||
#ifdef CONFIG_PCI
|
||||
#include <asm/pci.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/rck.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -47,6 +50,9 @@ void gdt_install(void);
|
|||
|
||||
inline static int system_init(void)
|
||||
{
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
rck_init();
|
||||
#endif
|
||||
gdt_install();
|
||||
#ifdef CONFIG_PCI
|
||||
pci_init();
|
||||
|
|
45
arch/x86/include/asm/rck.h
Normal file
45
arch/x86/include/asm/rck.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
|
||||
* RWTH Aachen University
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of MetalSVM.
|
||||
*/
|
||||
#ifndef __ARCH_RCK_H__
|
||||
#define __ARCH_RCK_H__
|
||||
|
||||
#include <metalsvm/stddef.h>
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
|
||||
#define RCK_TILEID_CONFIG 0x0100
|
||||
#define RCK_GCU_CONFIG 0x0080
|
||||
|
||||
#define RCK_TILEID_SUBID(id) (id|0x07)
|
||||
#define RCK_TILEID_X(id) ((id >> 3) | 0x0F)
|
||||
#define RCK_TILEID_Y(id) ((id >> 7) | 0x0F)
|
||||
|
||||
typedef struct {
|
||||
uint32_t tile_id;
|
||||
uint32_t pmem_low;
|
||||
uint32_t pmem_high;
|
||||
} rck_info_t;
|
||||
|
||||
extern rck_info_t rck_info;
|
||||
|
||||
int rck_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
C_source = syscall.c gdt.c kb.c timer.c irq.c isrs.c idt.c vga.c multiboot.c pci.c
|
||||
C_source = rck.c syscall.c gdt.c kb.c timer.c irq.c isrs.c idt.c vga.c multiboot.c pci.c
|
||||
ASM_source = entry.asm
|
||||
|
||||
OBJS += $(patsubst %.c, %.o, $(filter %.c, $(C_source)))
|
||||
|
|
44
arch/x86/kernel/rck.c
Normal file
44
arch/x86/kernel/rck.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
|
||||
* RWTH Aachen University
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of MetalSVM.
|
||||
*/
|
||||
|
||||
#include <metalsvm/stdio.h>
|
||||
#include <asm/rck.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
|
||||
rck_info_t rck_info;
|
||||
|
||||
int rck_init(void)
|
||||
{
|
||||
kprintf("Initialize Rock Creek!\n");
|
||||
|
||||
rck_info.tile_id = inportl(RCK_TILEID_CONFIG);
|
||||
kprintf("Core is running on %x (%2d, %2d)\n", rck_info.tile_id, RCK_TILEID_X(rck_info.tile_id),
|
||||
RCK_TILEID_Y(rck_info.tile_id), RCK_TILEID_SUBID(rck_info.tile_id));
|
||||
|
||||
/* default values for 16 GB of System Memory */
|
||||
rck_info.pmem_low = 0x00;
|
||||
rck_info.pmem_high = 0x13FFFFFF;
|
||||
while(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
17
mm/memory.c
17
mm/memory.c
|
@ -25,6 +25,9 @@
|
|||
#ifdef CONFIG_MULTIBOOT
|
||||
#include <asm/multiboot.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/rck.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 0 => free
|
||||
|
@ -79,6 +82,7 @@ int mmu_init(void)
|
|||
{
|
||||
size_t kernel_size;
|
||||
unsigned int i;
|
||||
size_t addr;
|
||||
|
||||
/* set whole address space as occupied */
|
||||
memset(bitmap, 0xFF, sizeof(uint8_t)*BITMAP_SIZE);
|
||||
|
@ -91,8 +95,8 @@ int mmu_init(void)
|
|||
while (mmap < mmap_end) {
|
||||
if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) {
|
||||
/* set the available memory as "unused" */
|
||||
size_t addr = mmap->addr;
|
||||
size_t end_addr = addr + mmap->len;
|
||||
addr = mmap->addr;
|
||||
|
||||
while (addr < end_addr) {
|
||||
page_clear_mark(addr / PAGE_SIZE);
|
||||
|
@ -107,8 +111,17 @@ int mmu_init(void)
|
|||
kputs("Unable to initialize the memory management subsystem\n");
|
||||
while(1) ;
|
||||
}
|
||||
#elif defined(CONFIG_ROCKCREEK)
|
||||
addr = rck_info.pmem_low;
|
||||
|
||||
while(addr < rck_info.pmem_high) {
|
||||
page_clear_mark(addr / PAGE_SIZE);
|
||||
addr += PAGE_SIZE;
|
||||
atomic_int32_inc(&total_pages);
|
||||
atomic_int32_inc(&total_available_pages);
|
||||
}
|
||||
#else
|
||||
#error Currently, MetalSVM needs multiboot!
|
||||
#error Currently, MetalSVM supports only Multiboot or the RockCreek processor!
|
||||
#endif
|
||||
|
||||
/* kernel is aligned to page size */
|
||||
|
|
Loading…
Add table
Reference in a new issue