mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Chances for the new superio setup. pci.h has new structs.
newpci.c has some new functions. asus config is fixed for i386 stuff. NLBconfig has a new command (nsuperio) and will take arch, mainboard, or target as the first command. sis 950 superio has changes for the new superio model
This commit is contained in:
parent
4abb0055ef
commit
b1e09fa054
17 changed files with 304 additions and 31 deletions
|
@ -58,7 +58,11 @@ void intel_main()
|
||||||
#ifdef FINAL_MAINBOARD_FIXUP
|
#ifdef FINAL_MAINBOARD_FIXUP
|
||||||
void final_mainboard_fixup(void);
|
void final_mainboard_fixup(void);
|
||||||
#endif /* FINAL_MAINBOARD_FIXUP */
|
#endif /* FINAL_MAINBOARD_FIXUP */
|
||||||
|
#ifdef USE_NEW_SUPERIO_INTERFACE
|
||||||
|
extern struct superio *all_superio;
|
||||||
|
extern int nsuperio;
|
||||||
|
extern void handle_superio(int pass, struct superio *s, int nsuperio);
|
||||||
|
#endif
|
||||||
#ifdef CONFIGURE_L2_CACHE
|
#ifdef CONFIGURE_L2_CACHE
|
||||||
int intel_l2_configure();
|
int intel_l2_configure();
|
||||||
#endif /* CONFIGURE_L2_CACHE */
|
#endif /* CONFIGURE_L2_CACHE */
|
||||||
|
@ -98,7 +102,9 @@ void intel_main()
|
||||||
printk(KERN_INFO "Finding PCI confiuration type...\n");
|
printk(KERN_INFO "Finding PCI confiuration type...\n");
|
||||||
pci_set_method();
|
pci_set_method();
|
||||||
post_code(0x5f);
|
post_code(0x5f);
|
||||||
|
#ifdef USE_NEW_SUPERIO_INTERFACE
|
||||||
|
handle_superio(0, all_superio, nsuperio);
|
||||||
|
#endif
|
||||||
printk(KERN_INFO "Scanning PCI bus...");
|
printk(KERN_INFO "Scanning PCI bus...");
|
||||||
pci_enumerate();
|
pci_enumerate();
|
||||||
post_code(0x66);
|
post_code(0x66);
|
||||||
|
@ -150,14 +156,21 @@ void intel_main()
|
||||||
intel_display_cpuid();
|
intel_display_cpuid();
|
||||||
intel_mtrr_check();
|
intel_mtrr_check();
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_KEYBOARD
|
#ifndef NO_KEYBOARD
|
||||||
|
|
||||||
keyboard_on();
|
keyboard_on();
|
||||||
#endif /* NO_KEYBOARD */
|
#endif /* NO_KEYBOARD */
|
||||||
|
|
||||||
|
#ifndef USE_NEW_SUPERIO_INTERFACE
|
||||||
#ifdef MUST_ENABLE_FLOPPY
|
#ifdef MUST_ENABLE_FLOPPY
|
||||||
enable_floppy();
|
enable_floppy();
|
||||||
post_code(0x95);
|
post_code(0x95);
|
||||||
#endif /* MUST_ENABLE_FLOPPY */
|
#endif /* MUST_ENABLE_FLOPPY */
|
||||||
|
#endif
|
||||||
|
#ifdef USE_NEW_SUPERIO_INTERFACE
|
||||||
|
handle_superio(1, all_superio, nsuperio);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
/* copy the smp block to address 0 */
|
/* copy the smp block to address 0 */
|
||||||
|
@ -194,6 +207,10 @@ void intel_main()
|
||||||
|
|
||||||
#endif /* MAINBOARD_FIXUP_IN_CHARGE */
|
#endif /* MAINBOARD_FIXUP_IN_CHARGE */
|
||||||
|
|
||||||
|
#ifdef USE_NEW_SUPERIO_INTERFACE
|
||||||
|
handle_superio(2, all_superio, nsuperio);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LINUXBIOS
|
#ifdef LINUXBIOS
|
||||||
printk(KERN_INFO "Jumping to linuxbiosmain()...\n");
|
printk(KERN_INFO "Jumping to linuxbiosmain()...\n");
|
||||||
// we could go to argc, argv, for main but it seems like overkill.
|
// we could go to argc, argv, for main but it seems like overkill.
|
||||||
|
@ -201,3 +218,5 @@ void intel_main()
|
||||||
linuxbiosmain(0, totalram);
|
linuxbiosmain(0, totalram);
|
||||||
#endif /* LINUXBIOS */
|
#endif /* LINUXBIOS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -439,4 +439,68 @@ unsigned char intel_conf_readb(unsigned long port);
|
||||||
|
|
||||||
#include <pciconf.h>
|
#include <pciconf.h>
|
||||||
|
|
||||||
|
/* linkages from devices of a type (e.g. superio devices)
|
||||||
|
* to the actual physical PCI device. This type is used in an array of
|
||||||
|
* structs built by NLBConfig.py. We owe this idea to Plan 9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct superio;
|
||||||
|
|
||||||
|
struct superio_control {
|
||||||
|
void (*pre_pci_init)(struct superio *s);
|
||||||
|
void (*init)(struct superio *s);
|
||||||
|
void (*finishup)(struct superio *s);
|
||||||
|
unsigned int defaultport; /* the defaultport. Can be overridden
|
||||||
|
* by commands in config
|
||||||
|
*/
|
||||||
|
// This is the print name for debugging
|
||||||
|
char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct com_ports {
|
||||||
|
unsigned int enable,baud, base, irq;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct superio {
|
||||||
|
struct superio_control *super; // the ops for the device.
|
||||||
|
unsigned int port; // if non-zero, overrides the default port
|
||||||
|
// com ports. This is not done as an array (yet).
|
||||||
|
// We think it's easier to set up from python if it is not an array.
|
||||||
|
struct com_ports com1, com2, com3, com4;
|
||||||
|
/* flags for each device type. Unsigned int. */
|
||||||
|
// low order bit ALWAYS means enable. Next bit means to enable
|
||||||
|
// DMA, if it exists.
|
||||||
|
unsigned int ide, floppy, lpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct southbridge;
|
||||||
|
|
||||||
|
struct southbridge_control {
|
||||||
|
void (*pre_pci_init)(struct southbridge *s);
|
||||||
|
void (*init)(struct southbridge *s);
|
||||||
|
void (*finishup)(struct southbridge *s);
|
||||||
|
// this is the vendor and device id
|
||||||
|
unsigned int vendor, device;
|
||||||
|
// This is the print name for debugging
|
||||||
|
char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct southbridge {
|
||||||
|
struct pci_dev *device; // the device.
|
||||||
|
struct southbridge_control *southbridge; // the ops for the device.
|
||||||
|
unsigned int devfn; /* the devfn.
|
||||||
|
* if devfn is known, the device can be
|
||||||
|
* configured for PCI discovery.
|
||||||
|
* this is needed for some devices such as acer m1535
|
||||||
|
*/
|
||||||
|
/* flags for each device type. Unsigned int. */
|
||||||
|
// low order bit ALWAYS means enable. Next bit means to enable
|
||||||
|
// DMA, if it exists.
|
||||||
|
unsigned int ide;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* PCI_H */
|
#endif /* PCI_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -785,3 +785,92 @@ void pci_enable()
|
||||||
// now enable everything.
|
// now enable everything.
|
||||||
enable_resources(&pci_root);
|
enable_resources(&pci_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
handle_superio(int pass, struct superio *s, int nsuperio)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
printk(KERN_INFO "handle_superio start, s %p nsuperio %d s->super %p\n",
|
||||||
|
s, nsuperio, s->super);
|
||||||
|
for(i = 0; i < nsuperio; i++, s++){
|
||||||
|
|
||||||
|
if (!s->super)
|
||||||
|
continue;
|
||||||
|
printk(KERN_INFO "handle_superio: Pass %d, Superio %s\n", pass,
|
||||||
|
s->super->name);
|
||||||
|
// need to have both pre_pci_init and devfn defined.
|
||||||
|
if (s->super->pre_pci_init && (pass == 0)) {
|
||||||
|
printk(KERN_INFO " Call pre_pci_init\n");
|
||||||
|
s->super->pre_pci_init(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (s->super->init && (pass == 1))
|
||||||
|
{
|
||||||
|
printk(KERN_INFO " Call init\n");
|
||||||
|
s->super->init(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (s->super->finishup && (pass == 2))
|
||||||
|
{
|
||||||
|
printk(KERN_INFO " Call finishup\n");
|
||||||
|
s->super->finishup(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printk(KERN_INFO "handle_superio done\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
handle_southbridge(int pass, struct southbridge *s, int nsouthbridge)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < nsouthbridge; i++, s++){
|
||||||
|
|
||||||
|
if (!s->southbridge)
|
||||||
|
continue;
|
||||||
|
printk(KERN_INFO "handle_southbridge: Pass %d, Superio %s\n", pass,
|
||||||
|
s->southbridge->name);
|
||||||
|
|
||||||
|
// need to have both pre_pci_init and devfn defined.
|
||||||
|
if (s->southbridge->pre_pci_init && (pass == 0) && (s->devfn)) {
|
||||||
|
printk(KERN_INFO " Call pre_pci_init\n");
|
||||||
|
s->southbridge->pre_pci_init(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// first, have to set up any device not set up.
|
||||||
|
// policy: we ignore the devfn here. First, it's in the pcidev, and
|
||||||
|
// second, it's really only to be used BEFORE pci config is done.
|
||||||
|
if (! s->device)
|
||||||
|
s->device = pci_find_device(s->southbridge->vendor,
|
||||||
|
s->southbridge->device, 0);
|
||||||
|
|
||||||
|
if (! s->device) { // not there!
|
||||||
|
printk(KERN_INFO " No such device\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// problem. We have to handle multiple devices of same type.
|
||||||
|
// We don't do this yet. One way is to mark the pci device used at
|
||||||
|
// this point, i.e.
|
||||||
|
// s->device->inuse = 1
|
||||||
|
// and then continue looking if the device is in use.
|
||||||
|
// For now, let's get this basic thing to work.
|
||||||
|
if (s->southbridge->init && (pass == 1)) {
|
||||||
|
printk(KERN_INFO " Call init\n");
|
||||||
|
s->southbridge->init(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (s->southbridge->finishup && (pass == 2)) {
|
||||||
|
printk(KERN_INFO " Call finishup\n");
|
||||||
|
s->southbridge->finishup(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge acer/m1631
|
northbridge acer/m1631
|
||||||
southbridge acer/m1535
|
southbridge acer/m1535
|
||||||
superio acer/m1535
|
superio acer/m1535
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch alpha
|
||||||
northbridge alpha/tsunami
|
northbridge alpha/tsunami
|
||||||
southbridge acer/m1543
|
southbridge acer/m1543
|
||||||
#southbridge...
|
#southbridge...
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge intel/440bx
|
northbridge intel/440bx
|
||||||
southbridge intel/piix4e
|
southbridge intel/piix4e
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge intel/440gx
|
northbridge intel/440gx
|
||||||
southbridge intel/piix4e
|
southbridge intel/piix4e
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge intel/440bx
|
northbridge intel/440bx
|
||||||
southbridge intel/piix4e
|
southbridge intel/piix4e
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge intel/440bx
|
northbridge intel/440bx
|
||||||
southbridge intel/piix4e
|
southbridge intel/piix4e
|
||||||
superio winbond/w83977ef
|
superio winbond/w83977ef
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
arch i386
|
||||||
northsouthbridge sis/630
|
northsouthbridge sis/630
|
||||||
superio sis/950
|
# superio sis/950
|
||||||
|
nsuperio sis/950 com1={1} floppy=1 lpt=1
|
||||||
|
|
||||||
option ENABLE_FIXED_AND_VARIABLE_MTRRS
|
option ENABLE_FIXED_AND_VARIABLE_MTRRS
|
||||||
option FINAL_MAINBOARD_FIXUP
|
option FINAL_MAINBOARD_FIXUP
|
||||||
|
|
|
@ -15,5 +15,7 @@ final_mainboard_fixup(void)
|
||||||
"Winfast 6300 (and similar)...");
|
"Winfast 6300 (and similar)...");
|
||||||
|
|
||||||
final_southbridge_fixup();
|
final_southbridge_fixup();
|
||||||
|
#ifndef USE_NEW_SUPERIO_INTERFACE
|
||||||
final_superio_fixup();
|
final_superio_fixup();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northsouthbridge sis/630
|
northsouthbridge sis/630
|
||||||
superio sis/950
|
superio sis/950
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northsouthbridge sis/730
|
northsouthbridge sis/730
|
||||||
superio sis/950
|
superio sis/950
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge via/vt8601
|
northbridge via/vt8601
|
||||||
southbridge via/vt82c686
|
southbridge via/vt82c686
|
||||||
superio via/vt82c686
|
superio via/vt82c686
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
arch i386
|
||||||
northbridge via/vt8601
|
northbridge via/vt8601
|
||||||
southbridge via/vt82c686
|
southbridge via/vt82c686
|
||||||
superio via/vt82c686
|
superio via/vt82c686
|
||||||
|
|
|
@ -7,9 +7,10 @@ static char rcsid[] = "$Id$";
|
||||||
#define PNP_COM2_DEVICE 0x2
|
#define PNP_COM2_DEVICE 0x2
|
||||||
|
|
||||||
#include <subr.h>
|
#include <subr.h>
|
||||||
|
#include <pci.h>
|
||||||
#include <cpu/p5/io.h>
|
#include <cpu/p5/io.h>
|
||||||
|
|
||||||
void
|
static void
|
||||||
enter_pnp(void)
|
enter_pnp(void)
|
||||||
{
|
{
|
||||||
// unlock it XXX make this a subr at some point
|
// unlock it XXX make this a subr at some point
|
||||||
|
@ -19,7 +20,7 @@ enter_pnp(void)
|
||||||
outb(0x55, 0x2e);
|
outb(0x55, 0x2e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
exit_pnp(void)
|
exit_pnp(void)
|
||||||
{
|
{
|
||||||
/* all done. */
|
/* all done. */
|
||||||
|
@ -28,8 +29,8 @@ exit_pnp(void)
|
||||||
outb(2, 0x2f);
|
outb(2, 0x2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MUST_ENABLE_FLOPPY
|
|
||||||
void
|
static void
|
||||||
enable_floppy(void)
|
enable_floppy(void)
|
||||||
{
|
{
|
||||||
/* now set the LDN to floppy LDN */
|
/* now set the LDN to floppy LDN */
|
||||||
|
@ -40,9 +41,9 @@ enable_floppy(void)
|
||||||
outb(0x30, 0x2e);
|
outb(0x30, 0x2e);
|
||||||
outb(0x1, 0x2f);
|
outb(0x1, 0x2f);
|
||||||
}
|
}
|
||||||
#endif /* MUST_ENABLE_FLOPPY */
|
|
||||||
|
|
||||||
void
|
|
||||||
|
static void
|
||||||
enable_com(int com)
|
enable_com(int com)
|
||||||
{
|
{
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
|
@ -61,8 +62,8 @@ enable_com(int com)
|
||||||
outb(b, 0x2f);
|
outb(b, 0x2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MUST_ENABLE_LPT
|
|
||||||
void
|
static void
|
||||||
enable_lpt(void)
|
enable_lpt(void)
|
||||||
{
|
{
|
||||||
/* now set the LDN to floppy LDN */
|
/* now set the LDN to floppy LDN */
|
||||||
|
@ -73,23 +74,37 @@ enable_lpt(void)
|
||||||
outb(0x30, 0x2e);
|
outb(0x30, 0x2e);
|
||||||
outb(0x1, 0x2f);
|
outb(0x1, 0x2f);
|
||||||
}
|
}
|
||||||
#endif /* MUST_ENABLE_LPT */
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
final_superio_fixup(void)
|
finishup(struct superio *s)
|
||||||
{
|
{
|
||||||
enter_pnp();
|
enter_pnp();
|
||||||
|
|
||||||
#ifdef MUST_ENABLE_FLOPPY
|
// don't fool with IDE just yet ...
|
||||||
|
if (s->floppy)
|
||||||
enable_floppy();
|
enable_floppy();
|
||||||
#endif /* MUST_ENABLE_LPT */
|
|
||||||
|
|
||||||
|
if (s->com1.enable)
|
||||||
enable_com(PNP_COM1_DEVICE);
|
enable_com(PNP_COM1_DEVICE);
|
||||||
|
if (s->com2.enable)
|
||||||
enable_com(PNP_COM2_DEVICE);
|
enable_com(PNP_COM2_DEVICE);
|
||||||
|
|
||||||
#ifdef MUST_ENABLE_LPT
|
if (s->lpt)
|
||||||
enable_lpt();
|
enable_lpt();
|
||||||
#endif /* MUST_ENABLE_LPT */
|
|
||||||
|
|
||||||
exit_pnp();
|
exit_pnp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct superio_control superio_sis_950_control = {
|
||||||
|
(void *)0, (void *)0, finishup, 0x2e, "SiS 950"
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
final_superio_fixup(void)
|
||||||
|
{
|
||||||
|
superio_sis_950.finishup((struct superio *) 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,11 @@ import string
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
|
|
||||||
|
# device variables
|
||||||
|
superio_decls = '';
|
||||||
|
superio_devices = [];
|
||||||
|
numsuperio = 0;
|
||||||
|
|
||||||
# Architecture variables
|
# Architecture variables
|
||||||
arch = '';
|
arch = '';
|
||||||
makebase = '';
|
makebase = '';
|
||||||
|
@ -159,6 +164,55 @@ def superio(dir, superio_name):
|
||||||
dir = os.path.join(treetop, 'src', '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]*
|
||||||
|
def nsuperio(dir, superio_commands):
|
||||||
|
global superio_decls, superio_devices, numsuperio, outputdir
|
||||||
|
# need python code to bust this into separate words ...
|
||||||
|
wspc = string.whitespace
|
||||||
|
rest = "(.*)"
|
||||||
|
w = "[" + wspc + "]*"
|
||||||
|
name = "([^" + wspc + "]*)"
|
||||||
|
# break into name + commands
|
||||||
|
pat = name + w + rest + w
|
||||||
|
# print "pat :", pat, ":", rule
|
||||||
|
command_re = re.compile(pat)
|
||||||
|
m = command_re.match(superio_commands)
|
||||||
|
# note that superio is w.r.t. treetop
|
||||||
|
superio_name = m.group(1);
|
||||||
|
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', "")
|
||||||
|
rest = m.group(2)
|
||||||
|
superio_cmds = '';
|
||||||
|
m = command_re.match(rest)
|
||||||
|
cmd = m.group(1)
|
||||||
|
rest = m.group(2)
|
||||||
|
while (cmd):
|
||||||
|
superio_cmds = superio_cmds + ", ." + cmd
|
||||||
|
m = command_re.match(rest)
|
||||||
|
cmd = m.group(1)
|
||||||
|
rest = m.group(2)
|
||||||
|
# now build the declaration
|
||||||
|
decl = '';
|
||||||
|
decl = "extern struct superio_control superio_"
|
||||||
|
decl = decl + superio_decl_name + "_control; \n"
|
||||||
|
decl = decl + "struct superio superio_" + superio_decl_name
|
||||||
|
decl = decl + "= { "
|
||||||
|
decl = decl + "&superio_" + superio_decl_name+ "_control"
|
||||||
|
decl = decl + superio_cmds + "};\n"
|
||||||
|
superio_decls = superio_decls + decl;
|
||||||
|
superio_devices.append("&superio_" + superio_decl_name);
|
||||||
|
# note that we're using the new interface
|
||||||
|
option(dir, "USE_NEW_SUPERIO_INTERFACE")
|
||||||
|
numsuperio = numsuperio + 1
|
||||||
|
|
||||||
|
|
||||||
# arg, what's a good way to do this ...
|
# arg, what's a good way to do this ...
|
||||||
# basically raminit can have a whole list of files. That's why
|
# basically raminit can have a whole list of files. That's why
|
||||||
# this is a list.
|
# this is a list.
|
||||||
|
@ -206,9 +260,9 @@ def addaction(dir, rule):
|
||||||
m = command_re.match(rule)
|
m = command_re.match(rule)
|
||||||
rulename = m.group(1)
|
rulename = m.group(1)
|
||||||
actions = m.group(2)
|
actions = m.group(2)
|
||||||
print "rulename :", rulename
|
# print "rulename :", rulename
|
||||||
print " actions ", actions, "\n"
|
# print " actions ", actions, "\n"
|
||||||
print "rules[rulename]=", makebaserules[rulename], "\n"
|
# print "rules[rulename]=", makebaserules[rulename], "\n"
|
||||||
makebaserules[rulename].append(actions)
|
makebaserules[rulename].append(actions)
|
||||||
|
|
||||||
# add a dependency
|
# add a dependency
|
||||||
|
@ -302,6 +356,7 @@ command_actions = {
|
||||||
'northsouthbridge' : northsouthbridge,
|
'northsouthbridge' : northsouthbridge,
|
||||||
'pcibridge' : pcibridge,
|
'pcibridge' : pcibridge,
|
||||||
'superio' : superio,
|
'superio' : superio,
|
||||||
|
'nsuperio' : nsuperio,
|
||||||
'object' : object,
|
'object' : object,
|
||||||
'linux' : linux,
|
'linux' : linux,
|
||||||
'raminit' : raminit,
|
'raminit' : raminit,
|
||||||
|
@ -352,8 +407,11 @@ def doconfigfile(dir, filename):
|
||||||
verb = command.group(1)
|
verb = command.group(1)
|
||||||
args = command.group(3)
|
args = command.group(3)
|
||||||
|
|
||||||
if ((arch == '') and (verb != 'arch')):
|
if ((arch == '') and (
|
||||||
print "arch must be the first command not ", verb, "\n"
|
(verb != 'arch') and (verb != 'mainboard') and
|
||||||
|
(verb != 'target')) ):
|
||||||
|
print "arch, target, or mainboard must be "
|
||||||
|
print "the first commands not ", verb, "\n"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if command_actions.has_key(verb):
|
if command_actions.has_key(verb):
|
||||||
command_actions[verb](dir, args)
|
command_actions[verb](dir, args)
|
||||||
|
@ -474,6 +532,8 @@ def writemakefile(path):
|
||||||
for i in range(len(makebaserules[z]) - 1):
|
for i in range(len(makebaserules[z]) - 1):
|
||||||
file.write("\t%s\n" % makebaserules[z][i+1])
|
file.write("\t%s\n" % makebaserules[z][i+1])
|
||||||
for i in range(len(objectrules)):
|
for i in range(len(objectrules)):
|
||||||
|
source = objectrules[i][1]
|
||||||
|
if (source[-2:] != '.c'): # no suffix. Build name.
|
||||||
base = objectrules[i][0]
|
base = objectrules[i][0]
|
||||||
base = base[0:len(base)-2]
|
base = base[0:len(base)-2]
|
||||||
source = os.path.join(objectrules[i][1], base)
|
source = os.path.join(objectrules[i][1], base)
|
||||||
|
@ -491,6 +551,17 @@ def writemakefile(path):
|
||||||
# except IOError:
|
# except IOError:
|
||||||
# print "File open and write failed for ", makefilepath
|
# print "File open and write failed for ", makefilepath
|
||||||
|
|
||||||
|
def writesuperiofile(path):
|
||||||
|
superiofile = os.path.join(path, "nsuperio.c")
|
||||||
|
file = open(superiofile, 'w+')
|
||||||
|
file.write("#include <pci.h>\n")
|
||||||
|
file.write(superio_decls)
|
||||||
|
file.write("struct superio *all_superio[] = {");
|
||||||
|
for i in range(len(superio_devices)):
|
||||||
|
file.write("%s,\n" %superio_devices[i])
|
||||||
|
file.write("};\n")
|
||||||
|
file.write("unsigned long nsuperio = %d;\n" % numsuperio)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# MAIN
|
# MAIN
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
|
@ -526,3 +597,4 @@ doconfigfile(treetop, sys.argv[1])
|
||||||
writemakefile(outputdir)
|
writemakefile(outputdir)
|
||||||
writeldscript(outputdir)
|
writeldscript(outputdir)
|
||||||
writecrt0(outputdir)
|
writecrt0(outputdir)
|
||||||
|
writesuperiofile(outputdir)
|
||||||
|
|
Loading…
Add table
Reference in a new issue