create a dynamic region, which specifies the boot parameters

This commit is contained in:
Stefan Lankes 2011-04-13 07:04:50 -07:00
parent 0fbf2df5ac
commit 12fb2a60f2
5 changed files with 66 additions and 12 deletions

View file

@ -695,6 +695,9 @@ int arch_paging_init(void)
#endif #endif
#ifdef CONFIG_ROCKCREEK #ifdef CONFIG_ROCKCREEK
// map SCC's bootinfo
map_region(SCC_BOOTINFO, SCC_BOOTINFO, 1, MAP_KERNEL_SPACE);
// map SCC's configuration registers // 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); 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); kprintf("Map configuration registers at 0x%x\n", viraddr);

View file

@ -27,17 +27,18 @@
#ifdef CONFIG_ROCKCREEK #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... */ /* PSE bit for Pentium+ equals MPE (message buffer enable) flag in RCK! So, use it to create _PAGE_MPB symbol... */
#define _CR4_MPE 0x00000800 #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). * 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; int i, my_rank;
kprintf("Initialize Rock Creek!\n"); kprintf("Initialize Rock Creek!\n");
for(i=0; i<rcce_argc; i++) kprintf("address of the initrd: 0x%x\n", bootinfo->addr);
argv[i] = argv_strings[i]; kprintf("size of the initrd: %d\n", bootinfo->size);
if (RCCE_init(&rcce_argc, &rcce_argv) != RCCE_SUCCESS) kprintf("rcce argc = %d\n", bootinfo->argc);
for(i=0; i<bootinfo->argc; i++)
kprintf("rcce argv[%d] = %s\n", i, bootinfo->argv[i]);
if (RCCE_init(&bootinfo->argc, &bootinfo->argv) != RCCE_SUCCESS)
return -ENODEV; return -ENODEV;
my_rank = RCCE_ue(); my_rank = RCCE_ue();

View file

@ -35,7 +35,13 @@ scc_setup.bin: scc_setup.asm
reset_vector.bin: reset_vector.o reset_vector.bin: reset_vector.o
ld --oformat binary -Ttext 0 -melf_i386 -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 . cp ../metalsvm.elf .
$(CROSS_OBJCOPY) -j .mboot -j .text -j .data -j .rodata -j .bss -O binary metalsvm.elf metalsvm.bin $(CROSS_OBJCOPY) -j .mboot -j .text -j .data -j .rodata -j .bss -O binary metalsvm.elf metalsvm.bin
chmod a-x *.bin chmod a-x *.bin

39
tools/bootinfo.sh Executable file
View file

@ -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"

View file

@ -1,3 +1,4 @@
0x00080000 scc_bootinfo.bin
0x00090200 scc_setup.bin 0x00090200 scc_setup.bin
0x00100000 metalsvm.bin 0x00100000 metalsvm.bin
0x00400000 initrd.img 0x00400000 initrd.img