summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2009-01-19 21:20:22 +0000
committerStefan Reinauer <stepan@openbios.org>2009-01-19 21:20:22 +0000
commit269563a423f9291e84b5a93859a3e17767cf27a0 (patch)
treed7bfed265b6ade33667641589e85db06b5e337ee /util
parent0fd183ce72c44f42859924de5739c73c249e7df0 (diff)
First shot at factoring SMM code into generic parts and southbridge specific
parts. This should help to reduce the code duplication for Rudolf's K8/VIA SMM implementation... Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Joseph Smith <joe@settoplinux.org> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3870 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r--util/newconfig/config.g49
1 files changed, 49 insertions, 0 deletions
diff --git a/util/newconfig/config.g b/util/newconfig/config.g
index 93e36bbde2..294d407216 100644
--- a/util/newconfig/config.g
+++ b/util/newconfig/config.g
@@ -226,6 +226,9 @@ class romimage:
# driver files added by 'driver' directive
self.driverrules = {}
+ # smm object files added by 'smmobject' directive
+ self.smmobjectrules = {}
+
# loader scripts added by 'ldscript' directive
self.ldscripts = []
@@ -344,6 +347,9 @@ class romimage:
def adddriverrule(self, name):
self.addobjectdriver(self.driverrules, name)
+ def addsmmobjectrule(self, name):
+ self.addobjectdriver(self.smmobjectrules, name)
+
def getinitobjectrules(self):
return self.initobjectrules
@@ -371,6 +377,15 @@ class romimage:
return o
fatal("No such driver rule \"%s\"" % name)
+ def getsmmobjectrules(self):
+ return self.smmobjectrules
+
+ def getsmmobjectrule(self, name):
+ o = getdict(self.smmobjectrules, name)
+ if (o):
+ return o
+ fatal("No such smm object rule \"%s\"" % name)
+
def addldscript(self, path):
self.ldscripts.append(path)
@@ -1370,6 +1385,10 @@ def adddriver(driver_name):
global curimage
curimage.adddriverrule(driver_name)
+def addsmmobject(object_name):
+ global curimage
+ curimage.addsmmobjectrule(object_name)
+
def target(name):
global target_dir, target_name
print "Configuring TARGET %s" % name
@@ -1593,6 +1612,7 @@ parser Config:
token PRINT: 'print'
token REGISTER: 'register'
token ROMIMAGE: 'romimage'
+ token SMMOBJECT: 'smmobject'
token SOUTHBRIDGE: 'southbridge'
token SUPERIO: 'superio'
token TARGET: 'target'
@@ -1693,6 +1713,10 @@ parser Config:
rule driver<<C>>: DRIVER DIRPATH {{ if (C): adddriver(DIRPATH)}}
+ rule smmobject<<C>>:
+ SMMOBJECT DIRPATH {{ if (C): addsmmobject(DIRPATH)}}
+
+
rule dir<<C>>: DIR DIRPATH {{ if (C): dodir(DIRPATH, 'Config.lb') }}
rule default<<C>>: DEFAULT ID EQ value {{ if (C): setdefault(ID, value, 0) }}
@@ -1826,6 +1850,7 @@ parser Config:
| prtstmt<<C>> {{ return prtstmt }}
| register<<C>> {{ return register }}
| device<<C>> {{ return device }}
+ | smmobject<<C>> {{ return smmobject }}
# ENTRY for parsing Config.lb file
rule cfgfile: (uses<<1>>)*
@@ -2028,6 +2053,13 @@ def writeimagemakefile(image):
file.write("OBJECTS += %s\n" % (obj_name))
file.write("SOURCES += %s\n" % (obj_source))
+ for srule, smm in image.getsmmobjectrules().items():
+ s_name = smm[0]
+ s_source = smm[1]
+ file.write("SMM-OBJECTS += %s\n" % (s_name))
+ file.write("SOURCES += %s\n" % (s_source))
+
+
# for chip_target.c
file.write("OBJECTS += static.o\n")
file.write("SOURCES += static.c\n")
@@ -2104,6 +2136,23 @@ def writeimagemakefile(image):
file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")
#file.write("%s\n" % objrule[2])
+ file.write("\n# smmobjectrules:\n")
+ for irule, smm in image.getsmmobjectrules().items():
+ source = topify(smm[1])
+ type = smm[2]
+ if (type == 'S'):
+ # for .S, .o depends on .s
+ file.write("%s: %s.s\n" % (smm[0], smm[3]))
+ file.write("\t$(CC) -c $(CPU_OPT) -o $@ $<\n")
+ # and .s depends on .S
+ file.write("%s.s: %s\n" % (smm[3], source))
+ # Note: next 2 lines are ONE output line!
+ file.write("\t$(CPP) $(CPPFLAGS) $< ")
+ file.write(">$@.new && mv $@.new $@\n")
+ else:
+ file.write("%s: %s\n" % (smm[0], source))
+ file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")
+
# special rule for chip_target.c
file.write("static.o: static.c\n")
file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")