pci_ids.h --- Added new ids.

boot.c  -- Modified to compile even with -fPIC
generic_sdram.inc -- split out generic_sdram_enable.inc -- Some chipsets
    don't need that enable logic.
Added serial_fill_inbuf.c
Removed unused 440gx/param.h sis/630/param.h
Modified: make.base crt0.base ldscript.base mainboard/Config and NLBConfig.py

In NLBConfig.py added the directive mainboardinit (a variant of raminit.inc)
  This allows us to remove hardcodes in crt0.S updated every mainboard/Config to
  reflect the current state of the hardcodes, and the split of generic_sdram.inc
  In crt0.S we should have the bare minimum code in assembly needed to get to C code.

mkrom is no longer needed.
This commit is contained in:
Eric W. Biederman 2001-08-07 23:41:49 +00:00
commit ebccffe3d0
31 changed files with 256 additions and 150 deletions

View file

@ -1,9 +1,11 @@
biosbase 0
rambase 0x8000
makedefine LINK = ld -T ldscript.ld -o $@ crt0.o linuxbios.a
makedefine CPPFLAGS= -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include $(CPUFLAGS)
makedefine CC:=gcc
makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)\`include/gp")
makedefine CPPFLAGS= -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
makedefine CFLAGS= $(CPU_OPT) $(CPPFLAGS) -O2 -nostdinc -nostdlib -fno-builtin -Wall
makedefine CC=cc
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
makerule linuxbios.strip: linuxbios ; objcopy -O binary -R .note -R .comment -S linuxbios linuxbios.strip

View file

@ -1,2 +1,3 @@
dir boot
dir lib
dir smp

View file

@ -85,8 +85,12 @@ void jmp_to_elf_entry(void *entry, void *ube)
/* Jump to kernel */
__asm__ __volatile__(
"pushl %0\n\t"
"pushl %1\n\t"
"pushl %2\n\t"
"popl %%ebx\n\t"
"popl %%eax\n\t"
"ret\n\t"
:: "g" (entry), "a"(type), "b"(ube));
:: "g" (entry), "g"(type), "g"(ube));
}

View file

@ -3,8 +3,8 @@
*
*/
#include <asm.h>
#include <intel.h>
#include <arch/asm.h>
#include <arch/intel.h>
#include <pciconf.h>
/*
@ -24,25 +24,22 @@
#include <cpu/p5/start32.inc>
#include <pc80/i8259.inc>
CRT0_PARAMETERS
#ifdef INTEL_PPRO_MTRR
/* Turn on mtrr for faster boot */
#include <cpu/p6/earlymtrr.inc>
#endif /* INTEL_PPRO_MTRR */
/*
* Copy data into RAM and clear the BSS. Since these segments
* isn\'t really that big we just copy/clear using bytes, not
* double words.
*/
intel_chip_post_macro(0x11) /* post 11 */
#ifdef SERIAL_CONSOLE
#if defined(SERIAL_CONSOLE) && defined(DEBUG)
TTYS0_TX_STRING($str_after_ram)
#endif /* SERIAL_CONSOLE */
#endif /* defined(SERIAL_CONSOLE) && defined(DEBUG) */
/* clear boot_complete flag */
xorl %ebp, %ebp
__main:
/*
* Copy data into RAM and clear the BSS. Since these segments
* isn\'t really that big we just copy/clear using bytes, not
* double words.
*/
intel_chip_post_macro(0x11) /* post 11 */
cld /* clear direction flag */
@ -57,10 +54,6 @@ CRT0_PARAMETERS
.Lnodata:
intel_chip_post_macro(0x12) /* post 12 */
#ifdef SERIAL_CONSOLE
TTYS0_TX_STRING($str_after_ram)
#endif /* SERIAL_CONSOLE */
/** clear stack */
leal EXT(_stack), %edi
movl $EXT(_estack), %ecx
@ -79,25 +72,44 @@ CRT0_PARAMETERS
stosb
.Lnobss:
/*
* Now we are finished. Memory is up, data is copied and
* bss is cleared. Now we call the main routine and
* let it do the rest.
*/
intel_chip_post_macro(0xfe) /* post fe */
#ifdef SERIAL_CONSOLE
TTYS0_TX_STRING($str_pre_main)
#endif /* SERIAL_CONSOLE */
/* memory is up. Let\'s do the rest in C -- much easier. */
/* set new stack */
movl $_estack, %esp
#ifdef SMP
movl $APIC_DEFAULT_BASE, %edi
movl APIC_ID(%edi), %eax
shrl $24, %eax
movl $STACK_SIZE, %ebx
mull %ebx
subl %eax, %esp
#endif
/* push the boot_complete flag */
pushl %ebp
/* Save the stack location */
movl %esp, %ebp
/*
* Now we are finished. Memory is up, data is copied and
* bss is cleared. Now we call the main routine and
* let it do the rest.
*/
intel_chip_post_macro(0xfe) /* post fe */
#if defined(SERIAL_CONSOLE) && defined(DEBUG)
TTYS0_TX_STRING($str_pre_main)
#endif /* defined(SERIAL_CONSOLE) && defined(DEBUG) */
/* memory is up. Let\'s do the rest in C -- much easier. */
intel_chip_post_macro(0xfd) /* post fe */
call EXT(intel_main)
/* Resort the stack location */
movl %ebp, %esp
/* The boot_complete flag has already been pushed */
call EXT(hardwaremain)
/*NOTREACHED*/
.Lhlt:
intel_chip_post_macro(0xee) /* post fe */
@ -109,3 +121,17 @@ str_after_ram: .string "Ram Initialize?\r\n"
str_after_copy: .string "after copy?\r\n"
str_pre_main: .string "before main\r\n"
newline: .string "\r\n"
.section ".reset_vector"
.code16
.globl EXT(reset_vector)
EXT(reset_vector):
#if _ROMBASE >= 0xffff0000
jmp EXT(_start)
#elif (_ROMBASE < 0x100000)
ljmp $((_ROMBASE & 0xf0000)>>4),$EXT(_start_offset);
#else
#error _ROMBASE is an unsupported value
#endif

View file

@ -9,6 +9,9 @@
* _ROMBASE
* : linuxbios text
* : readonly text
*
* _ROMTOP : The top of the rom used where we
* need to put the reset vector.
*/
/*
* Bootstrap code for the STPC Consumer
@ -18,6 +21,9 @@
*
*/
_ROMTOP = (_ROMBASE >= 0xffff0000)? 0xfffffff0 : 0xffff0;
_start_offset = _start & 0xffff;
gdtptr_offset = gdtptr & 0xffff;
/*
* Written by Johan Rydberg, based on work by Daniel Kahlin.
* Rewritten by Eric Biederman
@ -28,13 +34,6 @@
*/
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
/* oh, barf. This wont work if all you use is .o's. -- RGM */
/* These are now set by the config tool
_RAMBASE = 0x04000;
_ROMBASE = 0x80000;
*/
/*
* Entry point is not really nececary, since the mkrom(8)
@ -49,18 +48,21 @@ SECTIONS
* First we place the code and read only data (typically const declared).
* This get placed in rom.
*/
.text _ROMBASE : {
. = _ROMBASE;
.text (.) : {
_text = .;
*(.text);
*(.text.*)
_etext = .;
}
.rodata (.) : {
.rodata (.) : {
_rodata = .;
*(.rodata);
*(.rodata)
_erodata = .;
}
. = _RAMBASE;
/*
* After the code we place initialized data (typically initialized
* global variables). This gets copied into ram by startup code.
@ -68,17 +70,15 @@ SECTIONS
* whereas __data_loadstart and __data_loadend shows where in rom to
* copy from.
*/
.data (.): AT (_erodata) {
.data (.): AT(_erodata) {
_data = .;
*(.data)
*(.sdata)
*(.sdata2)
*(.got)
_edata = .;
}
_ldata = LOADADDR(.data);
_eldata = LOADADDR(.data) + SIZEOF(.data);
_eldata = LOADADDR(.data) + SIZEOF(.data);
/*
* bss does not contain data, it is just a space that should be zero
* initialized on startup. (typically uninitialized global variables)
@ -96,21 +96,28 @@ SECTIONS
.heap (.): {
_heap = .;
/* Reserve 256K for the heap */
. = . + 0x40000;
. = . + ( HEAP_SIZE );
_eheap = .;
}
.stack (.) : {
_stack = .;
/* Resever 64k for the stack */
. = . + 0x10000;
/* Reserve 64k stack for each possible cpu */
. = . + ((MAX_CPUS) * (STACK_SIZE));
_estack = .;
}
_lreset = _eldata;
. = _lreset;
_deadspace = (_ROMTOP - _lreset);
.reset (.) : AT (_lreset) {
. = . + _deadspace;
_reset_vector = .;
*(.reset_vector)
_ereset_vector = . ;
. = . + (16 - (1 + (_ereset_vector - _reset_vector)));
BYTE(0x00);
}
_elreset = _lreset + SIZEOF(.reset);
/DISCARD/ : {
*(*)
}
}
/*
* This provides the start and end address for the whole image
*/
_image = LOADADDR(.text);
_eimage = LOADADDR(.data) + SIZEOF(.data);
/* EOF */

View file

@ -1,25 +1,47 @@
biosbase 0xf0000
rambase 0x4000
makedefine LINK = ld -T ldscript.ld -o $@ crt0.o linuxbios.a
makedefine CPPFLAGS= -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include $(CPUFLAGS)
makedefine CFLAGS= $(CPU_OPT) $(CPPFLAGS) -O2 -nostdinc -nostdlib -fno-builtin -Wall
makedefine CC=cc
option _ROMBASE=0xf0000
option _RAMBASE=0x4000
option ROM_IMAGE_SIZE=65536
# By default we only have one cpu
option MAX_CPUS=1
# Reserve 256K for the heap
option HEAP_SIZE=0x40000
# Reserve 64K for each stack
option STACK_SIZE=0x10000
# By default on x86 we have a memory hole between 640K and 1MB
option MEMORY_HOLE=1
makedefine CC:=gcc
makedefine CPP:= gcc -x assembler-with-cpp -DASSEMBLY -E
makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -O2 -nostdinc -nostdlib -fno-builtin -Wall
makerule all : romimage ;
makerule floppy : all ; mcopy -o romimage a:
makerule romimage : linuxbios.rom vmlinux.bin.gz.block ; cat vmlinux.bin.gz.block linuxbios.rom > romimage
makerule linuxbios.rom: linuxbios.strip mkrom ; ./mkrom -s 64 -f -o linuxbios.rom linuxbios.strip
makerule linuxbios.rom: linuxbios.strip ;
addaction linuxbios.rom export size=`ls -l linuxbios.strip | (read p c u g size r ; echo $$size)` ; \
addaction linuxbios.rom echo $$size ; \
addaction linuxbios.rom dd if=linuxbios.strip of=linuxbios.rom bs=1 seek=`expr $(ROM_IMAGE_SIZE) - $$size`
makerule linuxbios.strip: linuxbios ; objcopy -O binary -R .note -R .comment -S linuxbios linuxbios.strip
makerule linuxbios: linuxbios.a vmlinux.bin.gz ; @rm -f biosobject
makerule linuxbios.o : crt0.o linuxbios.a $(LIBGCC_FILE_NAME) ; $(CC) -nostdlib -r -o $@ crt0.o linuxbios.a $(LIBGCC_FILE_NAME)
makerule linuxbios: linuxbios.o ldscript.ld ; $(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld linuxbios.o
addaction linuxbios nm -n linuxbios > linuxbios.map
makerule etags: $(SOURCES) ; etags $(SOURCES)
makerule tags: $(SOURCES) ; gctags $(SOURCES)
makerule documentation: $(SOURCES) ; doxygen LinuxBIOSDoc.config
addaction linuxbios $(LINK)
addaction linuxbios nm -n linuxbios > linuxbios.map
makerule linuxbios.a : $(OBJECTS) ; rm -f linuxbios.a
addaction linuxbios.a ar cr linuxbios.a $(OBJECTS)
makerule crt0.s: crt0.S ; $(CC) $(CPPFLAGS) -I$(TOP)/src -E $< > crt0.s
makerule crt0.s: crt0.S $(TOP)/src/cpu/p5/start32.inc ; $(CPP) $(CPPFLAGS) -I$(TOP)/src $< > crt0.s
makerule crt0.o : crt0.s; $(CC) $(CPU_OPT) -c crt0.s
makerule mkrom: $(TOP)/mkrom/mkrom.c ; $(CC) -o mkrom $<