- rename some functions
git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@69 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
0b681a49c0
commit
61907132a8
7 changed files with 132 additions and 64 deletions
|
@ -25,7 +25,7 @@
|
|||
#include <asm/pci.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/rck.h>
|
||||
#include <asm/scc.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -51,7 +51,7 @@ void gdt_install(void);
|
|||
inline static int system_init(void)
|
||||
{
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
rck_init();
|
||||
scc_init();
|
||||
#endif
|
||||
gdt_install();
|
||||
#ifdef CONFIG_PCI
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* 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
|
99
arch/x86/include/asm/scc.h
Normal file
99
arch/x86/include/asm/scc.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
/* Symbols for CRB addresses */
|
||||
#define CRB_X0_Y0 0xe0000000
|
||||
#define CRB_X1_Y0 0xe1000000
|
||||
#define CRB_X2_Y0 0xe2000000
|
||||
#define CRB_X3_Y0 0xe3000000
|
||||
#define CRB_X4_Y0 0xe4000000
|
||||
#define CRB_X5_Y0 0xe5000000
|
||||
#define CRB_X0_Y1 0xe6000000
|
||||
#define CRB_X1_Y1 0xe7000000
|
||||
#define CRB_X2_Y1 0xe8000000
|
||||
#define CRB_X3_Y1 0xe9000000
|
||||
#define CRB_X4_Y1 0xea000000
|
||||
#define CRB_X5_Y1 0xeb000000
|
||||
#define CRB_X0_Y2 0xec000000
|
||||
#define CRB_X1_Y2 0xed000000
|
||||
#define CRB_X2_Y2 0xee000000
|
||||
#define CRB_X3_Y2 0xef000000
|
||||
#define CRB_X4_Y2 0xf0000000
|
||||
#define CRB_X5_Y2 0xf1000000
|
||||
#define CRB_X0_Y3 0xf2000000
|
||||
#define CRB_X1_Y3 0xf3000000
|
||||
#define CRB_X2_Y3 0xf4000000
|
||||
#define CRB_X3_Y3 0xf5000000
|
||||
#define CRB_X4_Y3 0xf6000000
|
||||
#define CRB_X5_Y3 0xf7000000
|
||||
#define CRB_OWN 0xf8000000
|
||||
|
||||
/* Symbols for CRB sub-addresses */
|
||||
#define GLCFG0 0x010
|
||||
#define GLCFG1 0x018
|
||||
#define L2CFG0 0x020
|
||||
#define L2CFG1 0x028
|
||||
#define SENSOR 0x040
|
||||
#define GCBCFG 0x080
|
||||
#define MYTILEID 0x100
|
||||
#define LOCK0 0x200
|
||||
#define LOCK1 0x400
|
||||
#define LUT0 0x00800
|
||||
#define LUT1 0x01000
|
||||
|
||||
#define NUM_ROWS 4
|
||||
#define NUM_COLS 6
|
||||
#define NUM_CORES 2
|
||||
#define CRB_ADDR(x,y) (CRB_X0_Y0+(0x01000000*x)+(0x01000000*NUM_COLS*y))
|
||||
#define MPB_ADDR(x,y,z) (MPB_X0_Y0+(0x01000000*x)+(0x01000000*NUM_COLS*y)+(MPBSIZE*z))
|
||||
|
||||
#define TID(x,y) ((y<<4)+x)
|
||||
#define X_TID(tid) (tid&0x0f)
|
||||
#define Y_TID(tid) (tid>>4)
|
||||
|
||||
#define PID(x,y,core) ((NUM_CORES*NUM_COLS*y)+(NUM_CORES*x)+core)
|
||||
#define X_PID(pid) ((pid/NUM_CORES)-(NUM_COLS*Y_PID(pid)))
|
||||
#define Y_PID(pid) ((pid/NUM_CORES)/NUM_COLS)
|
||||
#define Z_PID(pid) (pid%NUM_CORES)
|
||||
|
||||
#define SCC_PMEM_REGIONS 2
|
||||
|
||||
typedef struct {
|
||||
uint32_t low;
|
||||
uint32_t high;
|
||||
} mem_region_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t pid;
|
||||
mem_region_t private_mem[SCC_PMEM_REGIONS];
|
||||
} scc_info_t;
|
||||
|
||||
extern scc_info_t scc_info;
|
||||
|
||||
int scc_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
C_source = rck.c syscall.c gdt.c kb.c timer.c irq.c isrs.c idt.c vga.c multiboot.c pci.c
|
||||
C_source = scc.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 string.asm
|
||||
|
||||
OBJS += $(patsubst %.c, %.o, $(filter %.c, $(C_source)))
|
||||
|
|
|
@ -18,24 +18,32 @@
|
|||
*/
|
||||
|
||||
#include <metalsvm/stdio.h>
|
||||
#include <asm/rck.h>
|
||||
#include <asm/scc.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
|
||||
rck_info_t rck_info;
|
||||
scc_info_t scc_info;
|
||||
|
||||
int rck_init(void)
|
||||
int scc_init(void)
|
||||
{
|
||||
int tmp, x, y, z;
|
||||
|
||||
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));
|
||||
tmp = *((int*) (CRB_OWN+MYTILEID));
|
||||
x=(tmp>>3) & 0x0f; // bits 06:03
|
||||
y=(tmp>>7) & 0x0f; // bits 10:07
|
||||
z=(tmp ) & 0x07; // bits 02:00
|
||||
scc_info.pid = PID(x, y, z);
|
||||
kprintf("SCC Processor Id: %d\n", scc_info.pid);
|
||||
|
||||
/* default values for 16 GB of System Memory */
|
||||
rck_info.pmem_low = 0x00;
|
||||
rck_info.pmem_high = 0x13FFFFFF;
|
||||
scc_info.private_mem[0].low = 0x00;
|
||||
scc_info.private_mem[0].high = 0x13FFFFFF;
|
||||
scc_info.private_mem[1].low = 0xFF000000;
|
||||
scc_info.private_mem[1].high = 0xFFFFFFFF;
|
||||
|
||||
while(1);
|
||||
|
||||
return 0;
|
|
@ -193,6 +193,7 @@ int main(void)
|
|||
kprintf("Here is MetalSVM %s\n", METALSVM_VERSION);
|
||||
|
||||
system_init();
|
||||
while(1);
|
||||
irq_init();
|
||||
timer_init();
|
||||
#ifdef CONFIG_KEYBOARD
|
||||
|
@ -206,6 +207,9 @@ int main(void)
|
|||
|
||||
kprintf("Kernel starts at %p and ends at %p\n", &kernel_start, &kernel_end);
|
||||
|
||||
while(1)
|
||||
;
|
||||
|
||||
detect_cpu_frequency();
|
||||
kprintf("Processor frequency: %d MHz\n", get_cpu_frequency()/1000000);
|
||||
kprintf("Total memory: %u MBytes\n", atomic_int32_read(&total_pages)/((1024*1024)/PAGE_SIZE));
|
||||
|
|
18
mm/memory.c
18
mm/memory.c
|
@ -26,7 +26,7 @@
|
|||
#include <asm/multiboot.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/rck.h>
|
||||
#include <asm/scc.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -114,13 +114,15 @@ int mmu_init(void)
|
|||
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);
|
||||
for(i=0; i< SCC_PMEM_REGIONS; i++){
|
||||
addr = scc_info.private_mem[i].low;
|
||||
|
||||
while(addr < scc_info.private_mem[i].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 supports only Multiboot or the RockCreek processor!
|
||||
|
|
Loading…
Add table
Reference in a new issue