From 71be41d19384b8ef206cd135904d54b75c0bd283 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Wed, 15 Aug 2001 21:30:08 +0000 Subject: [PATCH] make.base(i386 & alpha) make.base -- renamed OBJECTS to OBJECTS-1 to allow conditional compilation of objects ldscript.base -- realized that assignemnts to the location counter inside of sections are relative to their start so simplfied the code pirq_routing.h -- includeded types.h so we don't have suprises hardwaremain.c -- unconditionally included arch/smp/mpsec.h arch/i386/smp/Config introduced conitional on the compilation objects into the compilation process ioapic.c -- removed (now) unneeded ifdef around this file mpsec.c -- removed (now) unneeded ifdef around this file cpu/cpufixup.h -- Fix typo in the case when no cpufixup is needed. parts/framebuffer.h -- Added a missing semicolon. smp/atomic.h -- renamed second atmoic_inc to atomic_dec oops. tyan/guinnes/Config -- reordered the options so they are grouped a little better and said mptable.o is dependent on HAVE_MP_TABLE tyan/guiness/mainboard.c -- small change for clarity. northsouthbridge/sis/630/northbridge.c northsouthbridge/sis/630/southbridge.c -- Remove unused include of the now dead param.h NLBConfig.py -- Only include numeric options in the linker script -- Update to handle adding a condition for when to build objects --- src/arch/alpha/config/make.base | 4 +-- src/arch/i386/config/ldscript.base | 12 +++---- src/arch/i386/config/make.base | 4 +-- src/arch/i386/include/arch/pirq_routing.h | 2 ++ src/arch/i386/lib/hardwaremain.c | 4 +-- src/arch/i386/smp/Config | 6 ++-- src/arch/i386/smp/ioapic.c | 2 -- src/arch/i386/smp/mpspec.c | 3 -- src/include/cpu/cpufixup.h | 2 +- src/include/part/framebuffer.h | 2 +- src/include/smp/atomic.h | 2 +- src/mainboard/tyan/guiness/Config | 6 ++-- src/mainboard/tyan/guiness/mainboard.c | 2 +- src/northsouthbridge/sis/630/northbridge.c | 1 - src/northsouthbridge/sis/630/southbridge.c | 1 - util/config/NLBConfig.py | 42 +++++++++++++--------- 16 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/arch/alpha/config/make.base b/src/arch/alpha/config/make.base index cd4c5b5a83..a0d9c445de 100644 --- a/src/arch/alpha/config/make.base +++ b/src/arch/alpha/config/make.base @@ -16,8 +16,8 @@ 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 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 diff --git a/src/arch/i386/config/ldscript.base b/src/arch/i386/config/ldscript.base index b799346d5d..5ee73c1910 100644 --- a/src/arch/i386/config/ldscript.base +++ b/src/arch/i386/config/ldscript.base @@ -96,24 +96,20 @@ SECTIONS .heap (.): { _heap = .; /* Reserve 256K for the heap */ - . = . + ( HEAP_SIZE ); + . = HEAP_SIZE ; _eheap = .; } .stack (.) : { _stack = .; /* Reserve 64k stack for each possible cpu */ - . = . + ((MAX_CPUS) * (STACK_SIZE)); + . = ((MAX_CPUS) * (STACK_SIZE)); _estack = .; } - _lreset = _eldata; + _lreset = _ROMTOP; . = _lreset; - _deadspace = (_ROMTOP - _lreset); .reset (.) : AT (_lreset) { - . = . + _deadspace; - _reset_vector = .; *(.reset_vector) - _ereset_vector = . ; - . = . + (16 - (1 + (_ereset_vector - _reset_vector))); + . = 15 ; BYTE(0x00); } _elreset = _lreset + SIZEOF(.reset); diff --git a/src/arch/i386/config/make.base b/src/arch/i386/config/make.base index 6e4b7db5b7..121e48912a 100644 --- a/src/arch/i386/config/make.base +++ b/src/arch/i386/config/make.base @@ -38,8 +38,8 @@ makerule etags: $(SOURCES) ; etags $(SOURCES) makerule tags: $(SOURCES) ; gctags $(SOURCES) makerule documentation: $(SOURCES) ; doxygen LinuxBIOSDoc.config -makerule linuxbios.a : $(OBJECTS) ; rm -f linuxbios.a -addaction linuxbios.a ar cr linuxbios.a $(OBJECTS) +makerule linuxbios.a : $(OBJECTS-1) ; rm -f linuxbios.a +addaction linuxbios.a ar cr linuxbios.a $(OBJECTS-1) makerule crt0.s: crt0.S $(TOP)/src/cpu/p5/start32.inc ; $(CPP) $(CPPFLAGS) -I$(TOP)/src $< > crt0.s diff --git a/src/arch/i386/include/arch/pirq_routing.h b/src/arch/i386/include/arch/pirq_routing.h index de3cd78ad6..2e5fc09d70 100644 --- a/src/arch/i386/include/arch/pirq_routing.h +++ b/src/arch/i386/include/arch/pirq_routing.h @@ -1,6 +1,8 @@ #ifndef ARCH_PIRQ_ROUTING_H #define ARCH_PIRQ_ROUTING_H +#include + #define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24)) #define PIRQ_VERSION 0x0100 diff --git a/src/arch/i386/lib/hardwaremain.c b/src/arch/i386/lib/hardwaremain.c index 6f7ba10505..ef94e648dd 100644 --- a/src/arch/i386/lib/hardwaremain.c +++ b/src/arch/i386/lib/hardwaremain.c @@ -56,9 +56,7 @@ static char rcsid[] = "$Id$"; #include #include #include -#if defined(SMP) -#include -#endif +#include static int cpu_initialize(unsigned long totalram) diff --git a/src/arch/i386/smp/Config b/src/arch/i386/smp/Config index 9c1f39007f..29ccb32e59 100644 --- a/src/arch/i386/smp/Config +++ b/src/arch/i386/smp/Config @@ -1,3 +1,3 @@ -object mpspec.o -object ioapic.o -object start_stop.o +object mpspec.o HAVE_MP_TABLE +object ioapic.o IOAPIC +object start_stop.o SMP diff --git a/src/arch/i386/smp/ioapic.c b/src/arch/i386/smp/ioapic.c index a4256b0037..32214c738a 100644 --- a/src/arch/i386/smp/ioapic.c +++ b/src/arch/i386/smp/ioapic.c @@ -1,4 +1,3 @@ -#if defined(IOAPIC) #include #include @@ -134,4 +133,3 @@ void setup_ioapic(void) a->reg, a->value_low, a->value_high); } } -#endif /* IOAPIC */ diff --git a/src/arch/i386/smp/mpspec.c b/src/arch/i386/smp/mpspec.c index 5d1f3b31aa..ab403282c4 100644 --- a/src/arch/i386/smp/mpspec.c +++ b/src/arch/i386/smp/mpspec.c @@ -1,5 +1,3 @@ -#ifdef HAVE_MP_TABLE - #ifndef lint static char rcsid[] = "$Id$"; #endif @@ -240,4 +238,3 @@ void write_smp_table(void *v) } #endif /* 0 */ -#endif /* HAVE_MP_TABLE */ diff --git a/src/include/cpu/cpufixup.h b/src/include/cpu/cpufixup.h index 5f4206d52a..2fce7e45c8 100644 --- a/src/include/cpu/cpufixup.h +++ b/src/include/cpu/cpufixup.h @@ -11,7 +11,7 @@ # define cpufixup(totalram) p6_cpufixup(totalram) # endif #else -# define cpu_fixup(totalram) do {} while(0) +# define cpufixup(totalram) do {} while(0) #endif #endif /* CPU_CPUFIXUP_H */ diff --git a/src/include/part/framebuffer.h b/src/include/part/framebuffer.h index f0538ecee7..4d607708fc 100644 --- a/src/include/part/framebuffer.h +++ b/src/include/part/framebuffer.h @@ -2,7 +2,7 @@ #define PART_FRAMEBUFFER_H #ifdef HAVE_FRAMEBUFFER -void framebuffer_on(void) +void framebuffer_on(void); #else # define framebuffer_on() do {} while(0) #endif /* HAVE_FRAMEBUFFER */ diff --git a/src/include/smp/atomic.h b/src/include/smp/atomic.h index 496f052dd0..b36e0e2051 100644 --- a/src/include/smp/atomic.h +++ b/src/include/smp/atomic.h @@ -45,7 +45,7 @@ typedef struct { int counter; } atomic_t; * Atomically decrements @v by 1. Note that the guaranteed * useful range of an atomic_t is only 24 bits. */ -#define atomic_inc(v) (((v)->counter)--) +#define atomic_dec(v) (((v)->counter)--) #endif /* SMP */ diff --git a/src/mainboard/tyan/guiness/Config b/src/mainboard/tyan/guiness/Config index e105f3f65d..767199c86f 100644 --- a/src/mainboard/tyan/guiness/Config +++ b/src/mainboard/tyan/guiness/Config @@ -27,7 +27,7 @@ option ENABLE_FIXED_AND_VARIABLE_MTRRS object mainboard.o -object mptable.o +object mptable.o HAVE_MP_TABLE #object irq_tables.o #keyboard pc80 dir ../../../pc80 @@ -40,12 +40,12 @@ option SMBUS_MEM_DEVICE_INC=1 option SIO_BASE=0x2e option SMP=1 option IOAPIC=1 +option MAX_CPUS=2 +option HAVE_MP_TABLE=1 option USE_AMD_NDA_CODE=1 option FINAL_MAINBOARD_FIXUP=1 option HAVE_HARD_RESET=1 -option HAVE_MP_TABLE=1 option STACK_SIZE=0x10000 -option MAX_CPUS=2 option XIP_ROM_SIZE=0x8000 option XIP_ROM_BASE=0xffff8000 nooption MEMORY_HOLE diff --git a/src/mainboard/tyan/guiness/mainboard.c b/src/mainboard/tyan/guiness/mainboard.c index 8c9e43e8a4..8c1906978e 100644 --- a/src/mainboard/tyan/guiness/mainboard.c +++ b/src/mainboard/tyan/guiness/mainboard.c @@ -427,7 +427,7 @@ static void setup_pci_irq_to_isa_routing(void) * PIRQC -> 11 * PIRQD -> 3 */ - pci_write_config_word(dev, 0x56, 0x3ba5); + pci_write_config_word(dev, 0x56,(3 << 12)|(0xb << 8)|(0xa <<4)|(5 <<0)); } } diff --git a/src/northsouthbridge/sis/630/northbridge.c b/src/northsouthbridge/sis/630/northbridge.c index b9c993dc07..d4ec960da8 100644 --- a/src/northsouthbridge/sis/630/northbridge.c +++ b/src/northsouthbridge/sis/630/northbridge.c @@ -16,7 +16,6 @@ static char rcsid[] = #include #include #include -#include /* these functions query the hardware to figure out how much ram is in * the machine. They then place that information in the parameter block. diff --git a/src/northsouthbridge/sis/630/southbridge.c b/src/northsouthbridge/sis/630/southbridge.c index 64ecba15d3..9fdf8cf85f 100644 --- a/src/northsouthbridge/sis/630/southbridge.c +++ b/src/northsouthbridge/sis/630/southbridge.c @@ -16,7 +16,6 @@ static char rcsid[] = #include #include #include -#include #include void keyboard_on() diff --git a/util/config/NLBConfig.py b/util/config/NLBConfig.py index 6410c8278a..3139aa64bf 100644 --- a/util/config/NLBConfig.py +++ b/util/config/NLBConfig.py @@ -40,17 +40,17 @@ def add_main_rule_dependency(new_dependency): # this is a tuple, object name, source it depends on, # and an optional rule (can be empty) for actually building # the object -def addobject(object, sourcepath, rule): - objectrules.append([object, sourcepath, rule]) +def addobject(object, sourcepath, rule, condition): + objectrules.append([object, sourcepath, rule, condition]) # OK, let's face it, make sucks. # if you have a rule like this: # a.o: /some/long/path/a.c # make won't apply the .c.o rule. Toy! -def addobject_defaultrule(object, sourcepath): - defaultrule = "\t $(CC) -c $(CFLAGS) $<" - objectrules.append([object, sourcepath, defaultrule]) +def addobject_defaultrule(object, sourcepath, condition): + defaultrule = "\t $(CC) -c $(CFLAGS) -o $@ $<" + addobject(object, sourcepath, defaultrule, condition) # for all these functions, you need: # the dir that the Config file is in @@ -136,7 +136,7 @@ def keyboard(dir, keyboard_name): if (debug): print "KEYBOARD" keyboard_dir = os.path.join(treetop, 'src', keyboard_name) - addobject_defaultrule('keyboard.o', keyboard_dir) + addobject_defaultrule('keyboard.o', keyboard_dir,'') def cpu(dir, cpu_name): common_command_action(dir, 'cpu', cpu_name) @@ -165,7 +165,7 @@ def superio(dir, superio_name): # note that superio is w.r.t. treetop buildfullpath('superio', superio_name) dir = os.path.join(treetop, 'src', 'superio', superio_name) - addobject_defaultrule('superio.o', dir) + addobject_defaultrule('superio.o', dir,'') # commands are of the form: # superio_name [name=val]* @@ -186,11 +186,10 @@ def nsuperio(dir, superio_commands): superio_decl_name = re.sub("/", "_", superio_name) buildfullpath('superio', superio_name) dir = os.path.join(treetop, 'src', 'superio', superio_name) - defaultrule = "\t $(CC) -c $(CFLAGS) -o $@ $<" object="superio_%s.o" % superio_decl_name superio_source = dir + "/superio.c" - objectrules.append([object, superio_source, defaultrule]) - addobject_defaultrule('nsuperio.o', "") + addobject_defaultrule(object, superio_source,'') + addobject_defaultrule('nsuperio.o', "", '') rest = m.group(2) superio_cmds = ''; m = command_re.match(rest) @@ -230,8 +229,13 @@ def mainboardinit(dir, file): mainboardfilelist.append(file) print "Added mainboard init file: ", file -def object(dir, obj_name): - addobject_defaultrule(obj_name, dir) +def object(dir, command): + wspc = string.whitespace + command_re = re.compile("([^" + wspc + "]+)([" + wspc + "]([^" + wspc + "]*)|)") + m = command_re.match(command) + obj_name = m.group(1) + condition = m.group(3) + addobject_defaultrule(obj_name, dir, condition) # for eventual user-defined rules. # pattern is name : deps ; rule @@ -510,8 +514,9 @@ def writeldscript(path): keys = makeoptions.keys() keys.sort() for key in keys: - if makeoptions[key] : - file.write("%s = %s;\n" % (key, makeoptions[key])) + value = makeoptions[key] + if re.match("^(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)$", value): + file.write("%s = %s;\n" % (key, value)) ldlines = readfile(ldscriptbase) if (debug): @@ -581,9 +586,14 @@ def writemakefile(path): # print out all the object dependencies # There is ALWAYS a crt0.o - file.write("OBJECTS=crt0.o\n") + file.write("OBJECTS-1 := crt0.o\n") for i in range(len(objectrules)): - file.write("OBJECTS += %s\n" % (objectrules[i][0])) + obj_name = objectrules[i][0] + obj_cond = objectrules[i][3] + if not obj_cond : + file.write("OBJECTS-1 += %s\n" % (obj_name)) + else: + file.write("OBJECTS-$(%s) += %s\n" % (obj_cond, obj_name)) file.write("SOURCES=\n")