From 166e7df8146bc8292f97ded17a6c1d48a8446697 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 16 Jul 2002 23:16:31 +0000 Subject: [PATCH] trying to get alpha back. --- src/arch/alpha/boot/boot.c | 22 ++++++-- src/arch/alpha/config/ldscript.base | 28 +++++++-- src/arch/alpha/config/make.base | 5 ++ src/arch/alpha/include/arch/smp/smp.h | 2 + src/arch/alpha/lib/Config | 2 +- src/arch/alpha/lib/hardwaremain.c | 75 +++++++++++++++++++++++-- src/arch/i386/lib/hardwaremain.c | 5 ++ src/include/boot/elf.h | 2 +- src/lib/linuxbiosmain.c | 7 +++ src/lib/newpci.c | 2 +- src/mainboard/compaq/ds10/mainboard.c | 1 + src/rom/tsunami_tigbus_rom_fill_inbuf.c | 1 + util/config/NLBConfig.py | 4 ++ 13 files changed, 140 insertions(+), 16 deletions(-) create mode 100644 src/arch/alpha/include/arch/smp/smp.h diff --git a/src/arch/alpha/boot/boot.c b/src/arch/alpha/boot/boot.c index 367fe6bc75..deb455b074 100644 --- a/src/arch/alpha/boot/boot.c +++ b/src/arch/alpha/boot/boot.c @@ -1,6 +1,9 @@ -#include +#include #include +#include #include +#include +#include /* FIXME remove the hardcodes * MAX_ASM, CMD_LINE, SYSNAME, CYCLE_FREQ, CPU, SYS_VARIATION, SYS_TYPE @@ -127,7 +130,7 @@ static struct boot_data { }, }; - +#ifdef OLD_DS10 static struct { struct uniform_boot_header header; struct { @@ -153,6 +156,7 @@ static struct { .command_line = HWRPB_COMMAND_LINE, }; +#endif static unsigned long hwrpb_compute_checksum(struct hwrpb_struct *hwrpb) { unsigned long sum = 0, *l; @@ -162,7 +166,7 @@ static unsigned long hwrpb_compute_checksum(struct hwrpb_struct *hwrpb) } - +#ifdef OLD_DS10 void *get_ube_pointer(unsigned long totalram) { /* Set the amount of RAM I have */ @@ -176,6 +180,16 @@ void *get_ube_pointer(unsigned long totalram) return &ube_all; } +#else +void prepare_hwrpb(unsigned long totalram) +{ + /* Set the amount of RAM I have */ + boot_data.mem_cluster[1].numpages = (totalram >> 3) - + boot_data.mem_cluster[1].start_pfn; + boot_data.hwrpb.chksum = 0; + boot_data.hwrpb.chksum = hwrpb_compute_checksum(&boot_data.hwrpb); +} +#endif int elf_check_arch(Elf_ehdr *ehdr) { @@ -192,6 +206,6 @@ void jmp_to_elf_entry(void *entry, void *ptr) kernel_entry = entry; /* Jump to kernel */ - kernel_entry(ptr); + kernel_entry((void *)ptr); } diff --git a/src/arch/alpha/config/ldscript.base b/src/arch/alpha/config/ldscript.base index bf71358aa1..ecab418396 100644 --- a/src/arch/alpha/config/ldscript.base +++ b/src/arch/alpha/config/ldscript.base @@ -14,11 +14,23 @@ SECTIONS *(.text) _etext = .; } : kernel - .rodata : { - _rodata = .; - *(.rodata); - _erodata = .; - } : kernel + +/* streams starts here */ + _ltext = LOADADDR(.text); + _eltext = LOADADDR(.text) + SIZEOF(.text); + .rodata . : AT(_eltext){ + _rodata = .; + . = ALIGN(4); + streams = . ; + *(.rodata.streams) + estreams = .; + *(.rodata) + *(.rodata.*) + _erodata = .; + } + +/* streams ends here */ + . = _RAMBASE; /* Global data */ @@ -65,6 +77,12 @@ SECTIONS . = ALIGN(8); _estack = .; } + /* The ram segment + * This is all address of the memory resident copy of linuxBIOS. + */ + _ram_seg = _text; + _eram_seg = _eheap; + /DISCARD/ : { /* Comment sections */ diff --git a/src/arch/alpha/config/make.base b/src/arch/alpha/config/make.base index 1c733dbf9f..a7c2be044e 100644 --- a/src/arch/alpha/config/make.base +++ b/src/arch/alpha/config/make.base @@ -4,10 +4,15 @@ rambase 0x8000 option USE_DEFAULT_LAYOUT=1 ldscript arch/alpha/config/ldscript.base USE_DEFAULT_LAYOUT +option MAX_CPUS=1 + makedefine LINK = ld -T ldscript.ld -o $@ crt0.o linuxbios.a makerule all : linuxbios.rom ; makerule linuxbios.rom: linuxbios.strip makerom ; ./makerom -l0x310000 -i7 -v linuxbios.strip -o linuxbios.rom +dir /src/cpu/ev6 +dir /src/config +dir /src/boot #makerule makerom: $(TOP)/util/makerom/makerom.c $(TOP)/util/makerom/compress.c ; $(CC) -o makerom $(TOP)/util/makerom/makerom.c $(TOP)/util/makerom/compress.c diff --git a/src/arch/alpha/include/arch/smp/smp.h b/src/arch/alpha/include/arch/smp/smp.h new file mode 100644 index 0000000000..e80a54dacc --- /dev/null +++ b/src/arch/alpha/include/arch/smp/smp.h @@ -0,0 +1,2 @@ +#define CPU_ENABLED 1 /* Processor is available */ +#define CPU_BOOTPROCESSOR 2 /* Processor is the BP */ diff --git a/src/arch/alpha/lib/Config b/src/arch/alpha/lib/Config index 02e6d884cd..0d989c558e 100644 --- a/src/arch/alpha/lib/Config +++ b/src/arch/alpha/lib/Config @@ -1,6 +1,6 @@ object hardwaremain.o -makedefine OBJECTS+= __divqu.o __remqu.o __divlu.o __remlu.o +makedefine OBJECTS-+= __divqu.o __remqu.o __divlu.o __remlu.o makerule __divqu.o: $(TOP)/src/arch/alpha/lib/divide.S; $(CC) $(CFLAGS) -DDIV -c -o __divqu.o $< makerule __remqu.o: $(TOP)/src/arch/alpha/lib/divide.S; $(CC) $(CFLAGS) -DREM -c -o __remqu.o $< diff --git a/src/arch/alpha/lib/hardwaremain.c b/src/arch/alpha/lib/hardwaremain.c index d4f8af19cd..e2dcc61103 100644 --- a/src/arch/alpha/lib/hardwaremain.c +++ b/src/arch/alpha/lib/hardwaremain.c @@ -2,17 +2,84 @@ #include #include #include +#include +#include + +#define LINUXBIOS + +static unsigned long processor_map[MAX_CPUS]; +void early_mainboard_init(void); + +void write_tables(struct mem_range *mem) +{ + unsigned long low_table_start, low_table_end; + unsigned long rom_table_start, rom_table_end; + + rom_table_start = 0xf0000; + rom_table_end = 0xf0000; + /* Start low addr at 16 bytes instead of 0 because of a buglet + * in the generic linux bunzip code, as it tests for the a20 line. + */ + low_table_start = 0; + low_table_end = 16; + +#ifdef ALPHA_SMP + /* copy the smp block to address 0 */ + post_code(0x96); + /* The smp table must be in 0-1K, 639K-640K, or 960K-1M */ + low_table_end = write_smp_table(low_table_end, processor_map); + + /* Don't write anything in the traditional x86 BIOS data segment */ + if (low_table_end < 0x500) { + low_table_end = 0x500; + } +#endif + /* The linuxbios table must be in 0-4K or 960K-1M */ + write_linuxbios_table( + processor_map, mem, + low_table_start, low_table_end, + rom_table_start, rom_table_end); +} + void hardwaremain(unsigned long signature, unsigned long memsize, unsigned long cpu_speed) { + extern void linuxbiosmain( + unsigned long membase, + unsigned long totalram); + void prepare_hwrpb(unsigned long totalram); + + early_mainboard_init(); displayinit(); - printk_info("\n\nsignature=0x%016lx memsize=0x%016lx cpu_speed=0x%016lx\n", - signature, memsize, cpu_speed); - elfboot(memsize >> 10 /* In kilobytes */); - printk_err("\n after elfboot\n"); + printk_info("\n\nsignature=0x%016lx memsize=0x%016lx " + "cpu_speed=0x%016lx\n", + signature, memsize, cpu_speed); + +#ifdef OLD_DS10 + elfboot(memsize >> 10 /* In kilobytes */); + printk_err("\n after elfboot\n"); +#else + processor_map[0] = CPU_ENABLED; + + /* Set up hwrpb */ + prepare_hwrpb(memsize); + + /* Now that we have collected all of our information + * write our configuration tables. + */ + write_tables(memsize); + + +#ifdef LINUXBIOS + printk_info("Jumping to linuxbiosmain()...\n"); + // we could go to argc, argv, for main but it seems like overkill. + post_code(0xed); + linuxbiosmain(0, memsize); +#endif /* LINUXBIOS */ +#endif } void fatal_error(unsigned long exception_handler, unsigned long exception_at, diff --git a/src/arch/i386/lib/hardwaremain.c b/src/arch/i386/lib/hardwaremain.c index 0fb8066a55..1a0972abea 100644 --- a/src/arch/i386/lib/hardwaremain.c +++ b/src/arch/i386/lib/hardwaremain.c @@ -36,6 +36,11 @@ static char rcsid[] = "$Id$"; #define MAX_PHYSICAL_CPUS MAX_CPUS #endif +#if USE_ELF_BOOT +#include +#include +#endif + #include #include #include diff --git a/src/include/boot/elf.h b/src/include/boot/elf.h index d7e9e03467..e914b84b17 100644 --- a/src/include/boot/elf.h +++ b/src/include/boot/elf.h @@ -390,7 +390,7 @@ typedef Elf64_Phdr Elf_phdr; #endif extern int elf_check_arch(Elf_ehdr *ehdr); -extern void jmp_to_elf_entry(void *entry, unsigned long buffer); +extern void jmp_to_elf_entry(void *entry, void * buffer); struct stream; struct lb_memory; extern int elfload(struct stream *stream, struct lb_memory *mem, diff --git a/src/lib/linuxbiosmain.c b/src/lib/linuxbiosmain.c index 37c4ab9a6e..c067139586 100644 --- a/src/lib/linuxbiosmain.c +++ b/src/lib/linuxbiosmain.c @@ -174,11 +174,18 @@ int linuxbiosmain(unsigned long base, unsigned long totalram) * As of 2.4.0-test4 the linux parameter page isn't hardwired to be * at 0x90000 anymore. */ + +// CPP SUCKS +// if (ARCH == i386) fails here! +#if defined(i586) || defined(i686) || defined (i786) || defined(i386) /* move 0 to ebx. This is for SMP support. Jump to kernel */ __asm__ __volatile__("movl $0x90000, %%esi\n\t" "movl $0, %%ebx\n\t" "ljmp $0x10, %0\n\t" :: "i" (0x100000)); +#else + printk_error("UH OH\n"); +#endif return 0; /* It should not ever return */ } diff --git a/src/lib/newpci.c b/src/lib/newpci.c index 61dee907c3..622eaf1b90 100644 --- a/src/lib/newpci.c +++ b/src/lib/newpci.c @@ -842,7 +842,7 @@ void handle_superio(int pass, struct superio *all_superio[], int nsuperio) { int i; - struct superio *s; + struct superio *s = 0; printk_debug("handle_superio start, s %p nsuperio %d s->super %p\n", s, nsuperio, s->super); diff --git a/src/mainboard/compaq/ds10/mainboard.c b/src/mainboard/compaq/ds10/mainboard.c index 08b76bfff0..3c35ed14b6 100644 --- a/src/mainboard/compaq/ds10/mainboard.c +++ b/src/mainboard/compaq/ds10/mainboard.c @@ -2,5 +2,6 @@ void early_mainboard_init(void) { + void enable_serial(void); enable_serial(); } diff --git a/src/rom/tsunami_tigbus_rom_fill_inbuf.c b/src/rom/tsunami_tigbus_rom_fill_inbuf.c index 46fde3d8ed..09fd138d31 100644 --- a/src/rom/tsunami_tigbus_rom_fill_inbuf.c +++ b/src/rom/tsunami_tigbus_rom_fill_inbuf.c @@ -33,6 +33,7 @@ static int init_bytes(void) printk_debug("%6d:%s() - TIG_KERNEL_START:0x%08x\n", __LINE__, __FUNCTION__, TIG_KERNEL_START); + return 0; } static void fini_bytes(void) { diff --git a/util/config/NLBConfig.py b/util/config/NLBConfig.py index 8802bab566..718ef60304 100644 --- a/util/config/NLBConfig.py +++ b/util/config/NLBConfig.py @@ -445,6 +445,8 @@ def driver(dir, command): # makerule_re = re.compile(r'([^:\s]+)\s*:\s*([^;]*?)\s*;\s*(.*)') def makerule(dir, rule): + if (debug): + print "makerule " , rule (target, dependencies, action) = match(makerule_re, rule) # Each rule created by makerule will be printed to the Makefile # with a comment which shows the config file from whence it came. @@ -455,6 +457,8 @@ def makerule(dir, rule): # Add an action to an existing rule designated by . # def addaction(dir, rule): + if (debug): + print "addaction " , rule (target, action) = match(splitargs_re, rule) if not makebaserules.has_key(target): warning("Need 'makerule %s ...' before addaction" % (target))