trying to get alpha back.

This commit is contained in:
Ronald G. Minnich 2002-07-16 23:16:31 +00:00
commit 166e7df814
13 changed files with 140 additions and 16 deletions

View file

@ -1,6 +1,9 @@
#include <boot/uniform_boot.h>
#include <ip_checksum.h>
#include <boot/elf.h>
#include <boot/elf_boot.h>
#include <arch/boot/hwrpb.h>
#include <string.h>
#include <printk.h>
/* 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);
}

View file

@ -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 */

View file

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

View file

@ -0,0 +1,2 @@
#define CPU_ENABLED 1 /* Processor is available */
#define CPU_BOOTPROCESSOR 2 /* Processor is the BP */

View file

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

View file

@ -2,17 +2,84 @@
#include <boot/elf.h>
#include <printk.h>
#include <subr.h>
#include <boot/linuxbios_table.h>
#include <arch/smp/smp.h>
#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,

View file

@ -36,6 +36,11 @@ static char rcsid[] = "$Id$";
#define MAX_PHYSICAL_CPUS MAX_CPUS
#endif
#if USE_ELF_BOOT
#include <rom/read_bytes.h>
#include <boot/elf.h>
#endif
#include <arch/io.h>
#include <arch/intel.h>
#include <pciconf.h>

View file

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

View file

@ -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 */
}

View file

@ -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);

View file

@ -2,5 +2,6 @@
void early_mainboard_init(void)
{
void enable_serial(void);
enable_serial();
}

View file

@ -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)
{

View file

@ -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 <target>.
#
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))