more chip stuff

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@990 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Greg Watson 2003-07-21 04:20:08 +00:00
parent 54b3d233ed
commit 8275bad6f6
5 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,4 @@
object device.o object device.o
object device_util.o object device_util.o
object pci_device.o object pci_device.o
object chip.o

View File

@ -10,6 +10,15 @@
void void
chip_configure(struct chip *root, enum chip_pass pass) chip_configure(struct chip *root, enum chip_pass pass)
{ {
while (root) { struct chip *c;
for (c = root; c; c = c->next) {
if (root->control && root->control->enable)
root->control->enable(root, pass);
}
for (c = root; c; c = c->next) {
if (root->children)
chip_configure(root->children, pass);
} }
} }

View File

@ -6,6 +6,11 @@
*/ */
/* some of the types of resources chips can control */ /* some of the types of resources chips can control */
#ifndef CHIP_CONFIGURE
#define CHIP_CONFIGURE(chip, pass) chip_configure(chip, pass)
#else
#define CHIP_CONFIGURE(chip, pass)
#endif
struct com_ports { struct com_ports {
unsigned int enable,baud, base, irq; unsigned int enable,baud, base, irq;
@ -24,6 +29,7 @@ struct lpt_ports {
enum chip_pass { enum chip_pass {
CHIP_PRE_CONSOLE, CHIP_PRE_CONSOLE,
CHIP_PRE_PCI,
CHIP_PRE_DEVICE_ENUMERATE, CHIP_PRE_DEVICE_ENUMERATE,
CHIP_PRE_DEVICE_CONFIGURE, CHIP_PRE_DEVICE_CONFIGURE,
CHIP_PRE_DEVICE_ENABLE, CHIP_PRE_DEVICE_ENABLE,
@ -59,5 +65,5 @@ struct chip {
void *chip_info; /* the dreaded "void *" */ void *chip_info; /* the dreaded "void *" */
}; };
extern struct chip *root; extern struct chip root;
extern void chip_configure(struct chip *, enum chip_pass); extern void chip_configure(struct chip *, enum chip_pass);

View File

@ -34,7 +34,7 @@ end
## ##
southbridge winbond/w83c553 end southbridge winbond/w83c553 end
superio NSC/pc97307 superio NSC/pc97307
register "com1={1} com2={1} floppy=0 lpt=1 keyboard=1 hwmonitor=1" register ".com1={1}, .lpt={0}, .port=SIO_COM1_BASE"
end end
## ##

View File

@ -580,7 +580,7 @@ class partobj:
if (self.chipconfig): if (self.chipconfig):
debug.info(debug.gencode, "gencode: chipconfig(%d)" % self.instance) debug.info(debug.gencode, "gencode: chipconfig(%d)" % self.instance)
file.write("#include \"%s/chip.h\"\n" % self.dir) file.write("#include \"%s/chip.h\"\n" % self.dir)
file.write("extern struct superio_control %s_control;\n" % \ file.write("extern struct chip_control %s_control;\n" % \
self.flatten_name) self.flatten_name)
file.write("struct %s_config %s_config_%d" % (\ file.write("struct %s_config %s_config_%d" % (\
self.flatten_name ,\ self.flatten_name ,\
@ -590,7 +590,7 @@ class partobj:
file.write("\t= {\n") file.write("\t= {\n")
for i in self.registercode: for i in self.registercode:
file.write( "\t %s" % i) file.write( "\t %s" % i)
file.write("\t}\n") file.write("\t};\n")
else: else:
file.write(";") file.write(";")
file.write("\n"); file.write("\n");
@ -616,7 +616,7 @@ class partobj:
self.flatten_name ) self.flatten_name )
# generate the pointer to the isntance # generate the pointer to the isntance
# of the chip struct # of the chip struct
file.write(" .chip_config = (void *) &%s_config_%d,\n" %\ file.write(" .chip_info = (void *) &%s_config_%d,\n" %\
(self.flatten_name, self.instance )) (self.flatten_name, self.instance ))
file.write("};\n") file.write("};\n")
@ -1510,7 +1510,7 @@ def writeimagemakefile(image):
file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n") file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")
#file.write("%s\n" % objrule[2]) #file.write("%s\n" % objrule[2])
# special rule for chips_target.c # special rule for chip_target.c
file.write("chip_%s.o: chip_%s.c\n" % (target_name, target_name)) file.write("chip_%s.o: chip_%s.c\n" % (target_name, target_name))
file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n") file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")
@ -1632,7 +1632,7 @@ def dumptree(part, lvl):
debug.info(debug.dumptree, "DONE DUMPTREE") debug.info(debug.dumptree, "DONE DUMPTREE")
def writecode(image): def writecode(image):
filename = os.path.join(img_dir, "chips_%s.c" % target_name) filename = os.path.join(img_dir, "chip_%s.c" % target_name)
print "Creating", filename print "Creating", filename
file = open(filename, 'w+') file = open(filename, 'w+')
# gen all the forward references # gen all the forward references
@ -1642,7 +1642,7 @@ def writecode(image):
file.write("struct chip ") file.write("struct chip ")
while (i <= image.numparts()): while (i <= image.numparts()):
if (i): if (i):
file.write("cdev%d "% i) file.write(", dev%d"% i)
else: else:
file.write("root") file.write("root")
i = i + 1 i = i + 1