The real change here is that paths can now be part of the node label

in dts. This gets rid of the ugly pcipath etc. properties. 

So, instead of

  somedevice {pcipath="1,0";};

We say pci@1,0{ etc. etc. };

As per my agreement I agree to document this in the design doc. 
The alix1c compiles but is untested, and will probably need some work. 
I will do these additional tasks on friday.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by:  Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

M    include/device/path.h
Add LPC path type, replacing SUPERIO path type, since SUPERIO is only
one type of LPC. Clean up tabbing in parts of the file (cosmetic).

M    mainboard/emulation/qemu-x86/dts
Modify this dts for the new path naming scheme.

M    device/pci_device.c
Change what used to be a BIOS_ERR (but is no longer) to a BIOS_NOTICE. 
The change is that the device tree includes more than just PCI devices, 
so finding a non-PCI device is no longer fatal; a notice is useful. 

M    device/device_util.c
Add string creation for PCI_BUS nad LPC.

M    northbridge/intel/i440bxemulation/dts
Add ID info for the chip. 

M    northbridge/intel/i440bxemulation/i440bx.c
Change initialization so it is explicitly for the .ops struct member. 

M    util/dtc/flattree.c
Add support for the new path naming scheme. 
I'm in the middle of this commit so I'll fix the hard-coded lengths 
next commit. 
Also delete dead code between #if 0 and /* and //

M    util/x86emu/vm86.c
comment out unused variables. these may someday be use, not ready
to delete them yet. 

M    Makefile
Change -O2 to -g. We need debugging on LAR far more than we need performance. 



git-svn-id: svn://coreboot.org/repository/coreboot-v3@593 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Ronald G. Minnich 2008-02-13 21:00:20 +00:00
commit 4a6a5313bf
9 changed files with 85 additions and 83 deletions

View file

@ -43,7 +43,7 @@ CFLAGS := -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
HOSTCC := gcc
HOSTCXX := g++
HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
HOSTCFLAGS := -Wall -Wstrict-prototypes -g -fomit-frame-pointer \
-Wno-unused -Wno-sign-compare
LEX := flex

View file

@ -221,6 +221,10 @@ const char *dev_path(struct device *dev)
sprintf(buffer, "PCI_DOMAIN: %04x",
dev->path.u.pci_domain.domain);
break;
case DEVICE_PATH_PCI_BUS:
sprintf(buffer, "PCI_BUS: %04x",
dev->path.u.pci_bus.bus);
break;
case DEVICE_PATH_APIC_CLUSTER:
sprintf(buffer, "APIC_CLUSTER: %01x",
dev->path.u.apic_cluster.cluster);
@ -232,6 +236,10 @@ const char *dev_path(struct device *dev)
sprintf(buffer, "CPU_BUS: %02x",
dev->path.u.cpu_bus.id);
break;
case DEVICE_PATH_LPC:
sprintf(buffer, "LPC: %02x",
dev->path.u.lpc.iobase);
break;
default:
printk(BIOS_ERR, "%s: Unknown device path type: %d\n",
dev->dtsname, dev->path.type);

View file

@ -900,7 +900,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn)
printk(BIOS_SPEW, "%s: check dev %s \n", __func__,
(*list)->dtsname);
if ((*list)->path.type != DEVICE_PATH_PCI) {
printk(BIOS_ERR,
printk(BIOS_NOTICE,
"%s: child %s(%s) not a pci device: it's type %d\n",
__FUNCTION__, (*list)->dtsname, dev_path(*list),
(*list)->path.type);

View file

@ -21,14 +21,16 @@
enum device_path_type {
DEVICE_PATH_NONE = 0,
DEVICE_PATH_ROOT,
DEVICE_PATH_PCI_DOMAIN,
DEVICE_PATH_PCI_BUS,
DEVICE_PATH_PCI,
DEVICE_PATH_PNP,
DEVICE_PATH_I2C,
DEVICE_PATH_APIC,
DEVICE_PATH_PCI_DOMAIN,
DEVICE_PATH_APIC_CLUSTER,
DEVICE_PATH_CPU,
DEVICE_PATH_CPU_BUS,
DEVICE_PATH_LPC,
};
struct pci_domain_path
@ -36,6 +38,11 @@ struct pci_domain_path
unsigned domain;
};
struct pci_bus_path
{
unsigned bus;
};
struct pci_path
{
unsigned devfn;
@ -74,18 +81,25 @@ struct cpu_bus_path
unsigned id;
};
struct lpc_path
{
unsigned iobase;
};
struct device_path {
enum device_path_type type;
union {
struct pci_path pci;
struct pnp_path pnp;
struct i2c_path i2c;
struct apic_path apic;
struct pci_domain_path pci_domain;
struct pci_path pci;
struct pnp_path pnp;
struct i2c_path i2c;
struct apic_path apic;
struct pci_domain_path pci_domain;
struct pci_bus_path pci_bus;
struct apic_cluster_path apic_cluster;
struct cpu_path cpu;
struct cpu_bus_path cpu_bus;
struct cpu_path cpu;
struct cpu_bus_path cpu_bus;
struct lpc_path lpc;
} u;
};

View file

@ -21,24 +21,16 @@
/{
mainboard-vendor = "Emulation";
mainboard-name = "QEMU x86";
enabled;
constructor = "qemuvga_constructors";
cpus {
enabled;
};
domain0 {
cpus {};
domain@0 {
/config/("northbridge/intel/i440bxemulation/dts");
ops = "i440bxemulation_pcidomainops";
enabled;
pcidomain = "0";
device0,0 {
enabled;
pcipath = "0,0";
};
southbridge,intel,i82371eb {
/config/("southbridge/intel/i82371eb/dts");
pcipath = "1,0";
enabled;
bus@0 {
pci@0,0 {
};
pci@1,0 {
/config/("southbridge/intel/i82371eb/dts");
};
};
};
};

View file

@ -21,4 +21,5 @@
{
ramsize = "128";
constructor = "i440bx_constructors";
domainid = "0x8086, 0x7190";
};

View file

@ -81,10 +81,10 @@ struct device_operations i440bxemulation_pcidomainops = {
/* The plain PCI device uses the standard PCI operations. */
struct constructor i440bx_constructors[] = {
{.id = {.type = DEVICE_ID_PCI_DOMAIN,
.u = {.pci = {.vendor = 0x8086,.device = 0x7190}}},
&i440bxemulation_pcidomainops},
.u = {.pci_domain = {.vendor = 0x8086,.device = 0x7190}}},
.ops = &i440bxemulation_pcidomainops},
{.id = {.type = DEVICE_ID_PCI,
.u = {.pci = {.vendor = 0x8086,.device = 0x7190}}},
&default_pci_ops_bus},
.ops = &default_pci_ops_bus},
{.ops = 0},
};

View file

@ -521,6 +521,8 @@ static void coreboot_emit_special(FILE *e, struct node *tree)
int ops_set = 0;
int is_root = 0;
char *configname;
char *path;
int enabled = 1;
fprintf(f, "struct device dev_%s = {\n", tree->label);
/* special case -- the root has a distinguished path */
@ -529,6 +531,36 @@ static void coreboot_emit_special(FILE *e, struct node *tree)
fprintf(f, "\t.path = { .type = DEVICE_PATH_ROOT },\n");
}
/* from the node names (tree->name) we derive the path */
path = index(tree->name, '@');
if (path && path[1]) {
path++;
if (!strncmp(tree->name, "cpu", 3)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_CPU,.u={.cpu={ .id = %s }}},\n",
path);
}
if (!strncmp(tree->name, "bus", 3)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_BUS,.u={.pci_bus={ .bus = %s }}},\n",
path);
}
if (!strncmp(tree->name, "apic", 4)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_APIC,.u={.apic={ %s }}},\n",
path);
}
if (!strncmp(tree->name, "domain", 6)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = %s }}},\n",
path);
}
if (!strncmp(tree->name, "pci", 3)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI,.u={.pci={ .devfn = PCI_DEVFN(%s)}}},\n",
path);
}
if (!strncmp(tree->name, "lpc", 3)){
fprintf(f, "\t.path = {.type=DEVICE_PATH_SUPERIO,.u={.superio={.iobase=%s}}},\n",
path);
}
}
if (tree->config){
configname = clean(tree->label, 0);
printf("\t.device_configuration = &%s,\n", configname);
@ -564,20 +596,15 @@ static void coreboot_emit_special(FILE *e, struct node *tree)
* and some are just set directly into the code (e.g. ops_pci).
*/
for_each_property(tree, prop) {
if (streq(prop->name, "pcidomain")){
fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI_DOMAIN,.u={.pci_domain={ .domain = %s }}},\n",
prop->val.val);
}
if (streq(prop->name, "pcipath")){
fprintf(f, "\t.path = {.type=DEVICE_PATH_PCI,.u={.pci={ .devfn = PCI_DEVFN(%s)}}},\n",
prop->val.val);
}
/* to do: check the value, maybe. Kinda pointless though. */
if (streq(prop->name, "on_mainboard")){
fprintf(f, "\t.on_mainboard = 1,\n");
}
if (streq(prop->name, "enabled")){
fprintf(f, "\t.enabled = 1,\n");
enabled = 1;
}
if (streq(prop->name, "disabled")){
enabled = 0;
}
if (streq(prop->name, "config")){
@ -634,6 +661,7 @@ static void coreboot_emit_special(FILE *e, struct node *tree)
fprintf(f, "\t.ops = &default_dev_ops_root,\n");
fprintf(f, "\t.dtsname = \"%s\",\n", tree->label);
fprintf(f, "\t.enabled = %d\n", enabled);
fprintf(f, "};\n");
}
@ -796,18 +824,6 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi
struct node *child;
int seen_name_prop = 0;
FILE *f = etarget;
/*
treename = clean(tree->name, 0);
fprintf(f, "struct %s %s = {\n", treename, tree->label);
free(treename);
*/
#if 0
if (vi->flags & FTF_FULLPATH)
emit->string(etarget, tree->fullpath, 0);
else
emit->string(etarget, tree->name, 0);
#endif
/* here is the real action. What we have to do, given a -> config entry, is this:
* foreach property(tree->config)
* search for the property in this node's property list
@ -826,24 +842,13 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi
* the operator should take the node itself, not a string.
*/
printf("struct %s %s = {\n", structname, treelabel);
// emit->beginnode(etarget, treename);
#if 0
if (vi->flags & FTF_FULLPATH)
emit->string(etarget, tree->fullpath, 0);
else
emit->string(etarget, tree->name, 0);
#endif
for_each_config(tree, configprop) {
char *cleanname;
int found = 0;
if (streq(configprop->name, "constructor")) /* this is special */
continue;
#if 0
cleanname = clean(configprop->name, 0);
fprintf(f, "\tu32 %s = \n", cleanname);
free(cleanname);
#endif
for_each_property(tree, dtsprop) {
if (streq(dtsprop->name,configprop->name)){
emit->data(etarget, dtsprop);
@ -854,28 +859,8 @@ static void flatten_tree_emit_structinits(struct node *tree, struct emitter *emi
emit->data(etarget, configprop);
}
#if 0
if ((vi->flags & FTF_NAMEPROPS) && !seen_name_configprop) {
fprintf(f, "\tu8 %s[%d];\n", configprop->name, configprop->val.len);
}
#endif
emit->endnode(etarget, treelabel);
}
/*
for_each_property(tree, prop) {
if (streq(prop->name, "name"))
seen_name_prop = 1;
emit->data(etarget, prop);
}
*/
#if 0
if ((vi->flags & FTF_NAMEPROPS) && !seen_name_prop) {
fprintf(f, "\tu8 %s[%d]\n", prop->name, prop->data.len);
}
#endif
/*
emit->endnode(etarget, tree->label);
*/
/* now emit the device for this node, with sibling and child pointers etc. */
emit->special(f, tree);
@ -1253,7 +1238,7 @@ void dt_to_C(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
data_free(strbuf);
}
/* the label is not really used. So go ahead and make clean names for all labels */
/*Set up the clean label */
void
labeltree(struct node *tree)

View file

@ -559,7 +559,9 @@ int biosint(unsigned long intnumber,
void setup_realmode_idt(void)
{
extern unsigned char idthandle, end_idthandle;
#if 0
extern unsigned char debughandle, end_debughandle;
#endif
int i;
struct realidt *idts = (struct realidt *) 0;