diff --git a/arch/x86/mm/page.c b/arch/x86/mm/page.c index 533f4a5c..b8c37884 100644 --- a/arch/x86/mm/page.c +++ b/arch/x86/mm/page.c @@ -695,6 +695,9 @@ int arch_paging_init(void) #endif #ifdef CONFIG_ROCKCREEK + // map SCC's bootinfo + map_region(SCC_BOOTINFO, SCC_BOOTINFO, 1, MAP_KERNEL_SPACE); + // map SCC's configuration registers viraddr = map_region(CRB_X0_Y0, CRB_X0_Y0, (CRB_OWN-CRB_X0_Y0+16*1024*1024)/PAGE_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE); kprintf("Map configuration registers at 0x%x\n", viraddr); diff --git a/arch/x86/scc/scc_init.c b/arch/x86/scc/scc_init.c index 02b6057f..1f7d0c5a 100644 --- a/arch/x86/scc/scc_init.c +++ b/arch/x86/scc/scc_init.c @@ -27,17 +27,18 @@ #ifdef CONFIG_ROCKCREEK +typedef struct { + uint32_t addr; // address of the initrd + uint32_t size; // size of the initrd + int32_t argc; // number of RCCE arguments + char** argv; // RCCE arguments +} bootinfo_t; + +static bootinfo_t* bootinfo = (bootinfo_t*) SCC_BOOTINFO; + /* PSE bit for Pentium+ equals MPE (message buffer enable) flag in RCK! So, use it to create _PAGE_MPB symbol... */ #define _CR4_MPE 0x00000800 -/* - * Workaround to create a suitable argv array - */ -static char* argv_strings[] = {"MetalSVM", "1", "533", "0"}; -static char* argv[4] = {[0 ... 3] = NULL}; -static char** rcce_argv = argv; -static int rcce_argc = 4; - /* * This is the modified MPB program, which is part of the RCCE distribution (src/mpb.c). * @@ -77,9 +78,13 @@ int scc_init(void) int i, my_rank; kprintf("Initialize Rock Creek!\n"); - for(i=0; iaddr); + kprintf("size of the initrd: %d\n", bootinfo->size); + kprintf("rcce argc = %d\n", bootinfo->argc); + for(i=0; iargc; i++) + kprintf("rcce argv[%d] = %s\n", i, bootinfo->argv[i]); + + if (RCCE_init(&bootinfo->argc, &bootinfo->argv) != RCCE_SUCCESS) return -ENODEV; my_rank = RCCE_ue(); diff --git a/tools/Makefile b/tools/Makefile index 38d44d7f..cde604ef 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -35,7 +35,13 @@ scc_setup.bin: scc_setup.asm reset_vector.bin: reset_vector.o ld --oformat binary -Ttext 0 -melf_i386 -o $@ $< -SCC: scc_setup.bin reset_vector.bin +scc_bootinfo.asm: bootinfo.sh + ./bootinfo.sh 0x00400000 initrd.img 1 533 0 > scc_bootinfo.asm + +scc_bootinfo.bin: scc_bootinfo.asm + $(NASM) $(NASMFLAGS) -o $@ $< + +SCC: scc_bootinfo.bin scc_setup.bin reset_vector.bin cp ../metalsvm.elf . $(CROSS_OBJCOPY) -j .mboot -j .text -j .data -j .rodata -j .bss -O binary metalsvm.elf metalsvm.bin chmod a-x *.bin diff --git a/tools/bootinfo.sh b/tools/bootinfo.sh new file mode 100755 index 00000000..7e308278 --- /dev/null +++ b/tools/bootinfo.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# +IMAGESIZE=$(stat -c%s "$2") +NCORES=$3 +ORG=0x80000 +echo "[BITS 16]" +echo "SECTION .data" +echo "ORG $ORG" +echo "addr DD $1 ; start addresss of the initrd" +echo "size DD $IMAGESIZE ; size of the initrd" + +shift +shift +shift +ARGC=`expr $# + 2` + +echo "argc DD $ARGC" +echo "argv DD Largv" +echo "Largv EQU \$" +echo -n " DD name, ncores" +for i in $* +do + echo -n ", L$i" +done +echo "" + +echo "name EQU \$" +echo " DB \"MetalSVM\", 0" +echo "ncores EQU \$" +echo " DB \"$NCORES\", 0" + +for i in $* +do + echo "L$i EQU \$" + echo " DB \"$i\", 0" +done + +echo "gap:" +echo "TIMES 4096-(\$-\$\$) DB 0" diff --git a/tools/load.map b/tools/load.map index d759ed64..6263ab88 100644 --- a/tools/load.map +++ b/tools/load.map @@ -1,3 +1,4 @@ +0x00080000 scc_bootinfo.bin 0x00090200 scc_setup.bin 0x00100000 metalsvm.bin 0x00400000 initrd.img