Initial checkin for supermicro p4dc6

This also includes a bunch of my pending work including
- Updated serial code so we can compile in different serial port speeds
- Updates to the build system so that:
  - Makefile.settings holds all of the settings of the config variables
  - ldoptions and cpuflags are generated automatically with perl scripts
  - src/config/Config holds all of the architecture neutral make file settings
- Initial work on the P4 including how to use cache as ram
- Update to the ioapic code for the P4 because it delivers irqs on the system
  bus instead of an out of band bus
- Updated version of printf that doesn't need an intermediate buffer
  - logbuf_subr now handles the case when we want to use a log buffer
- video_subr handles the preliminary code for writing to a video device.
- Pending changes for the L440GX are merged in as well (hopefully I haven't
  messed then up since they were written).
This commit is contained in:
Eric W. Biederman 2001-11-03 02:11:49 +00:00
commit a8151ba2cd
53 changed files with 2071 additions and 351 deletions

View file

@ -1,42 +1,19 @@
biosbase 0
rambase 0x8000
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: \(.*\)/\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
option USE_DEFAULT_LAYOUT=1
ldscript arch/alpha/config/ldscript.base USE_DEFAULT_LAYOUT
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
makerule linuxbios: linuxbios.a ; @rm -f biosobject
makerule etags: $(SOURCES) ; etags $(SOURCES)
makerule tags: $(SOURCES) ; ctags $(SOURCES)
makerule documentation: $(SOURCES) ; doxygen LinuxBIOSDoc.config
addaction linuxbios $(LINK)
addaction linuxbios nm -n linuxbios > linuxbios.map
makerule ldscript.ld : ldscript.options $(LDSUBSCRIPTS-1) ; echo "INCLUDE ldscript.options" > ldscript.ld ; for file in $(LDSUBSCRIPTS-1) ; do echo "INCLUDE $$file" >> ldscript.ld ; done
makerule linuxbios.a : $(OBJECTS-1) ; rm -f linuxbios.a
addaction linuxbios.a ar cr linuxbios.a $(OBJECTS-1)
makerule crt0.s: crt0.S ; $(CC) $(CPPFLAGS) -I$(TOP)/src -E $< > crt0.s
makerule crt0.o : crt0.s; $(CC) $(CPU_OPT) -c crt0.s
#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
makerule clean : ; rm -f linuxbios.* *.o mkrom xa? *~
addaction clean rm -f linuxbios crt0.s
addaction clean rm -f a.out *.s *.l
addaction clean rm -f TAGS tags
addaction clean rm -f docipl
addaction clean rm -f makerom
# do standard config files that the user need not specify
# for now, this is just 'lib', but it may be more later.
dir /src/arch/alpha
dir /src/lib
dir /src/boot
dir /src/rom
dir /util/makerom

View file

@ -26,9 +26,9 @@
CRT0_PARAMETERS
#if defined(SERIAL_CONSOLE) && defined(DEBUG)
#if defined(SERIAL_CONSOLE) && (DEFAULT_CONSOLE_LOGLEVEL >= 7)
TTYS0_TX_STRING($str_after_ram)
#endif /* defined(SERIAL_CONSOLE) && defined(DEBUG) */
#endif
/* clear boot_complete flag */
xorl %ebp, %ebp
@ -96,10 +96,9 @@ __main:
*/
intel_chip_post_macro(0xfe) /* post fe */
#if defined(SERIAL_CONSOLE) && defined(DEBUG)
#if defined(SERIAL_CONSOLE) && (DEFAULT_CONSOLE_LOGLEVEL >= 7)
TTYS0_TX_STRING($str_pre_main)
#endif /* defined(SERIAL_CONSOLE) && defined(DEBUG) */
#endif
/* memory is up. Let\'s do the rest in C -- much easier. */

View file

@ -6,63 +6,43 @@ option ROM_IMAGE_SIZE=65536
option MAX_CPUS=1
# Reserve 256K for the heap
option HEAP_SIZE=0x40000
# Reserve 64K for each stack
option STACK_SIZE=0x10000
# Reserve 8K for each stack
option STACK_SIZE=0x2000
# 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
option USE_DEFAULT_LAYOUT=1
ldscript arch/i386/config/ldscript.base USE_DEFAULT_LAYOUT
ldscript arch/i386/config/ldscript.cacheram USE_CACHE_RAM
# How do I add -mprefered-stack-boundary=2 if the compiler supports it?
# On x86 tt results in a code size reduction.
#
dir /src/config
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 ;
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 linuxbios linuxbios.strip
makerule linuxbios.o : crt0.o linuxbios.a $(LIBGCC_FILE_NAME) ; $(CC) -nostdlib -r -o $@ crt0.o linuxbios.a $(LIBGCC_FILE_NAME)
makerule ldscript.ld : ldoptions $(LDSUBSCRIPTS-1) ; echo "INCLUDE ldoptions" > ldscript.ld ; for file in $(LDSUBSCRIPTS-1) ; do echo "INCLUDE $$file" >> ldscript.ld ; done
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) ; ctags $(SOURCES)
makerule documentation: $(SOURCES) ; doxygen LinuxBIOSDoc.config
makerule linuxbios.a : $(OBJECTS-1) ; rm -f linuxbios.a
addaction linuxbios.a ar cr linuxbios.a $(OBJECTS-1)
makerule crt0.s: crt0.S ; $(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 $<
makerule clean : ; rm -f linuxbios.* vmlinux.* *.o mkrom xa? *~
addaction clean rm -f linuxbios romimage crt0.s
addaction clean rm -f a.out *.s *.l
addaction clean rm -f TAGS tags
addaction clean rm -f docipl
makerule vmlinux.bin.gz.block : vmlinux.bin.gz ; dd conv=sync bs=448k if=vmlinux.bin.gz of=vmlinux.bin.gz.block
makerule vmlinux.bin.gz: vmlinux.bin ;gzip -f -3 vmlinux.bin
makerule vmlinux.bin: $(LINUX)/vmlinux ; objcopy -O binary -R .note -R .comment -S $< vmlinux.bin
addaction clean rm -f romimage mkrom vmlinux.*
# do standard config files that the user need not specify
# for now, this is just 'lib', but it may be more later.
dir /src/arch/i386
dir /src/lib
dir /src/boot
dir /src/rom

View file

@ -1,4 +1,4 @@
object i386_subr.o
object params.o
object hardwaremain.o
object pirq_routing.o
object pirq_routing.o HAVE_PIRQ_TABLE

View file

@ -9,6 +9,10 @@
#include <string.h>
#include <arch/i386_subr.h>
#if defined(SMP) || defined(IOAPIC)
#define APIC 1
#endif
void cache_on(unsigned long totalram)
{
post_code(0x60);
@ -45,7 +49,7 @@ void interrupts_on()
* see the Intel mp1.4 spec, page A-3
*/
#if defined(SMP)
#if defined(APIC)
/* Only Pentium Pro and later have those MSR stuff */
unsigned long low, high;
@ -81,7 +85,7 @@ void interrupts_on()
| (APIC_LVT_REMOTE_IRR |APIC_SEND_PENDING |
APIC_DELIVERY_MODE_NMI)
);
#else /* SMP */
#else /* APIC */
#ifdef i686
/* Only Pentium Pro and later have those MSR stuff */
unsigned long low, high;
@ -92,7 +96,7 @@ void interrupts_on()
low &= ~APIC_BASE_MSR_ENABLE;
wrmsr(APIC_BASE_MSR, low, high);
#endif /* i686 */
#endif /* SMP */
#endif /* APIC */
printk_info("done.\n");
post_code(0x9b);
}

View file

@ -1,4 +1,3 @@
#ifdef HAVE_PIRQ_TABLE
#include <printk.h>
#include <pci.h>
#include <arch/pirq_routing.h>
@ -61,5 +60,3 @@ void copy_pirq_routing_table(void)
memcpy((char *) RTABLE_DEST, &intel_irq_routing_table, intel_irq_routing_table.size);
printk_info("done.\n");
}
#endif /* HAVE_PIRQ_TABLE */

View file

@ -0,0 +1,6 @@
jmp set_memory_size_out
set_memory_size:
RETSP
set_memory_size_out:

View file

@ -24,61 +24,6 @@ struct ioapicreg ioapicregvalues[] = {
#define NMI (4 << 8)
#define SMI (2 << 8)
#define INT (1 << 8)
#if 0 /* L440GX */
{0x00, DISABLED, NONE},
{0x01, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x59, ALL},
{0x02, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x51, ALL},
{0x03, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x61, NONE},
{0x04, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x69, ALL},
{0x05, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x71, NONE},
{0x06, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x79, NONE},
{0x07, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x81, NONE},
{0x08, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x89, ALL},
{0x09, DISABLED, NONE},
{0x0a, DISABLED, NONE},
{0x0b, DISABLED, NONE},
{0x0c, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x91, ALL},
{0x0d, DISABLED, NONE},
{0x0e, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x99, ALL},
{0x0f, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xa1, ALL},
{0x10, DISABLED, NONE},
{0x11, DISABLED, NONE},
{0x12, DISABLED, NONE},
{0x13, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0xa9, ALL},
{0x14, DISABLED, NONE},
{0x15, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0xb1, ALL},
{0x16, DISABLED, NONE},
{0x17, DISABLED, NONE}
#endif
#if 0 /* tyan guinness */
/* mask, trigger, polarity, destination, delivery, vector */
{0x00, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|ExtINT|0x0, ALL},
{0x01, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x1, ALL},
{0x02, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x0, ALL},
{0x03, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x3, ALL},
{0x04, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x4, ALL},
{0x05, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x5, ALL},
{0x06, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x6, ALL},
{0x07, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x7, ALL},
{0x08, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x8, ALL},
{0x09, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0x9, ALL},
{0x0a, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xa, ALL},
{0x0b, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xb, ALL},
{0x0c, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xc, ALL},
{0x0d, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xd, ALL},
{0x0e, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xe, ALL},
{0x0f, ENABLED|TRIGGER_EDGE|POLARITY_HIGH|LOGICAL_DEST|INT|0xf, ALL},
{0x10, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0x10, ALL},
{0x11, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0x11, ALL},
{0x12, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0x12, ALL},
{0x13, ENABLED|TRIGGER_LEVEL|POLARITY_LOW|LOGICAL_DEST|INT|0x13, ALL},
{0x14, DISABLED, NONE},
{0x14, DISABLED, NONE},
{0x15, DISABLED, NONE},
{0x16, DISABLED, NONE},
{0x17, DISABLED, NONE},
#endif
#if 1
/* mask, trigger, polarity, destination, delivery, vector */
{0x00, DISABLED, NONE},
{0x01, DISABLED, NONE},
@ -105,7 +50,6 @@ struct ioapicreg ioapicregvalues[] = {
{0x15, DISABLED, NONE},
{0x16, DISABLED, NONE},
{0x17, DISABLED, NONE},
#endif
};
void setup_ioapic(void)
@ -117,6 +61,13 @@ void setup_ioapic(void)
struct ioapicreg *a = ioapicregvalues;
l = (unsigned long *) nvram;
#if defined(i786)
/* For the pentium 4 and above apic deliver their interrupts
* on the front side bus, enable that.
*/
l[0] = 0x03;
l[4] = 1;
#endif /* i786 */
for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]);
i++, a++) {
l[0] = (a->reg * 2) + 0x10;