This set of changes gets us here.

Phase 1: done
Phase 2: early setup ...
Phase 2: done
Phase 3: Enumerating buses...
qemu-x86 enable_dev done
dev_phase3_scan: scanning Root Device
scan_static_bus for root(Root Device)
cpus: Unknown device path type: 0
cpus() enabled
i440bxemulation_enable_dev: 
i440bxemulation_enable_dev: DONE
northbridge_intel_i440bxemulation() enabled
northbridge_intel_i440bxemulation() scanning...
dev_phase3_scan: scanning 
pci_scan_bus start
PCI: pci_scan_bus for bus 00
PCI: scan devfn 0x0 to 0xff
PCI: devfn 0x0
PCI: pci_scan_bus pci_scan_get_dev returns dev <NULL>

Change dts compiler to emit a new struct member, dtsname, for devices,
so we can get actual useful names for things. 

Several mods and printks added. 

printk(BIOS_SPEW
gives no output for reasons I don't understand. 

Next in line is bringing back v2 support for pci, but not doing it the
way v2 does it. 

note the cpus() printk above. cpus don't have a valid path yet. 

We still need to work out the dts syntax for systems with multiple links
(opteron)

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@163 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Ronald G. Minnich 2007-03-01 09:20:25 +00:00
parent 9d7f9f93cf
commit 7f949f70f5
10 changed files with 60 additions and 54 deletions

View file

@ -496,27 +496,27 @@ void phase4_assign_resources(struct bus *bus)
{ {
struct device *curdev; struct device *curdev;
printk(BIOS_SPEW, "%s assign_resources, bus %d link: %d\n", printk(BIOS_SPEW, "%s(%s) assign_resources, bus %d link: %d\n",
dev_path(bus->dev), bus->secondary, bus->link); bus->dev->dtsname, dev_path(bus->dev), bus->secondary, bus->link);
for(curdev = bus->children; curdev; curdev = curdev->sibling) { for(curdev = bus->children; curdev; curdev = curdev->sibling) {
if (!curdev->enabled || !curdev->resources) { if (!curdev->enabled || !curdev->resources) {
continue; continue;
} }
if (!curdev->ops) { if (!curdev->ops) {
printk(BIOS_ERR, "%s missing ops\n", printk(BIOS_ERR, "%s(%s) missing ops\n",
dev_path(curdev)); curdev->dtsname, dev_path(curdev));
continue; continue;
} }
if (!curdev->ops->phase4_set_resources) { if (!curdev->ops->phase4_set_resources) {
printk(BIOS_ERR, "%s ops has no missing phase4_set_resources\n", printk(BIOS_ERR, "%s(%s) ops has no missing phase4_set_resources\n",
dev_path(curdev)); curdev->dtsname, dev_path(curdev));
continue; continue;
} }
curdev->ops->phase4_set_resources(curdev); curdev->ops->phase4_set_resources(curdev);
} }
printk(BIOS_SPEW, "%s assign_resources, bus %d link: %d\n", printk(BIOS_SPEW, "%s(%s) assign_resources, bus %d link: %d\n",
dev_path(bus->dev), bus->secondary, bus->link); bus->dev->dtsname, dev_path(bus->dev), bus->secondary, bus->link);
} }
/** /**
@ -543,11 +543,11 @@ void dev_phase5(struct device *dev)
return; return;
} }
if (!dev->ops) { if (!dev->ops) {
printk(BIOS_ERR, "%s missing ops\n", dev_path(dev)); printk(BIOS_ERR, "%s: %s(%s) missing ops\n", __FUNCTION__, dev->dtsname, dev_path(dev));
return; return;
} }
if (!dev->ops->phase5_enable_resources) { if (!dev->ops->phase5_enable_resources) {
printk(BIOS_ERR, "%s ops are missing phase5_enable_resources\n", dev_path(dev)); printk(BIOS_ERR, "%s: %s(%s) ops are missing phase5_enable_resources\n", __FUNCTION__, dev->dtsname, dev_path(dev));
return; return;
} }
dev->ops->phase5_enable_resources(dev); dev->ops->phase5_enable_resources(dev);
@ -613,11 +613,13 @@ void dev_phase2(void)
post_code(0x41); post_code(0x41);
printk(BIOS_INFO, "Phase 2: early setup ...\n"); printk(BIOS_INFO, "Phase 2: early setup ...\n");
for(dev = all_devices; dev; dev = dev->next) { for(dev = all_devices; dev; dev = dev->next) {
if (dev->ops && dev->ops->phase1) printk(BIOS_SPEW, "%s: dev %s: ", __FUNCTION__, dev->dtsname);
{ if (dev->ops && dev->ops->phase1) {
printk(BIOS_DEBUG, "%s phase2\n", dev_path(dev)); printk(BIOS_SPEW, "Calling phase2 ..");
dev->ops->phase2(dev); dev->ops->phase2(dev);
printk(BIOS_SPEW, " DONE");
} }
printk(BIOS_SPEW, "\n");
} }
post_code(0x4e); post_code(0x4e);
printk(BIOS_INFO, "Phase 2: done\n"); printk(BIOS_INFO, "Phase 2: done\n");
@ -647,7 +649,8 @@ unsigned int dev_phase3_scan(struct device * busdevice, unsigned int max)
!busdevice->ops || !busdevice->ops ||
!busdevice->ops->phase3_scan) !busdevice->ops->phase3_scan)
{ {
printk(BIOS_INFO, "%s: busdevice %p enabled %d ops %p\n" , printk(BIOS_INFO, "%s: %s: busdevice %p enabled %d ops %p\n" , __FUNCTION__,
busdevice->dtsname,
busdevice, busdevice ? busdevice->enabled : NULL, busdevice, busdevice ? busdevice->enabled : NULL,
busdevice ? busdevice->ops : NULL); busdevice ? busdevice->ops : NULL);
printk(BIOS_INFO, "%s: can not scan from here, returning %d\n", __FUNCTION__, max); printk(BIOS_INFO, "%s: can not scan from here, returning %d\n", __FUNCTION__, max);

View file

@ -196,7 +196,7 @@ const char *dev_path(struct device * dev)
sprintf(buffer, "CPU_BUS: %02x", dev->path.u.cpu_bus.id); sprintf(buffer, "CPU_BUS: %02x", dev->path.u.cpu_bus.id);
break; break;
default: default:
printk(BIOS_ERR, "Unknown device path type: %d\n", dev->path.type); printk(BIOS_ERR, "%s: Unknown device path type: %d\n", dev->dtsname, dev->path.type);
break; break;
} }
} }

View file

@ -129,7 +129,7 @@ unsigned pci_find_next_capability(struct device * dev, unsigned cap, unsigned la
int this_cap; int this_cap;
pos &= ~3; pos &= ~3;
this_cap = pci_read_config8(dev, pos + PCI_CAP_LIST_ID); this_cap = pci_read_config8(dev, pos + PCI_CAP_LIST_ID);
printk(BIOS_SPEW,"Capability: 0x%02x @ 0x%02x\n", cap, pos); printk(BIOS_SPEW-2,"Capability: 0x%02x @ 0x%02x\n", cap, pos);
if (this_cap == 0xff) { if (this_cap == 0xff) {
break; break;
} }
@ -794,7 +794,7 @@ static void set_pci_ops(struct device *dev)
(driver->device == dev->device)) (driver->device == dev->device))
{ {
dev->ops = driver->ops; dev->ops = driver->ops;
printk(BIOS_SPEW,"%s [%04x/%04x] %sops\n", printk(BIOS_SPEW-2,"%s [%04x/%04x] %sops\n",
dev_path(dev), dev_path(dev),
driver->vendor, driver->device, driver->vendor, driver->device,
(driver->ops->phase3_scan?"bus ":"")); (driver->ops->phase3_scan?"bus ":""));
@ -916,7 +916,7 @@ struct device * pci_probe_dev(struct device * dev, struct bus *bus, unsigned dev
if ( (id == 0xffffffff) || (id == 0x00000000) || if ( (id == 0xffffffff) || (id == 0x00000000) ||
(id == 0x0000ffff) || (id == 0xffff0000)) (id == 0x0000ffff) || (id == 0xffff0000))
{ {
printk(BIOS_SPEW,"PCI: devfn 0x%x, bad id 0x%x\n", devfn, id); printk(BIOS_SPEW-2,"PCI: devfn 0x%x, bad id 0x%x\n", devfn, id);
return NULL; return NULL;
} }
dev = alloc_dev(bus, &dummy.path); dev = alloc_dev(bus, &dummy.path);
@ -1027,6 +1027,7 @@ unsigned int pci_scan_bus(struct bus *bus,
struct device * old_devices; struct device * old_devices;
struct device * child; struct device * child;
printk(BIOS_DEBUG, "%s start\n", __func__);
#if PCI_BUS_SEGN_BITS #if PCI_BUS_SEGN_BITS
printk(BIOS_DEBUG,"PCI: pci_scan_bus for bus %04x:%02x\n", bus->secondary >> 8, bus->secondary & 0xff); printk(BIOS_DEBUG,"PCI: pci_scan_bus for bus %04x:%02x\n", bus->secondary >> 8, bus->secondary & 0xff);
#else #else
@ -1037,19 +1038,23 @@ unsigned int pci_scan_bus(struct bus *bus,
bus->children = 0; bus->children = 0;
post_code(0x24); post_code(0x24);
printk(BIOS_SPEW-2,"PCI: scan devfn 0x%x to 0x%x\n", min_devfn, max_devfn);
/* probe all devices/functions on this bus with some optimization for /* probe all devices/functions on this bus with some optimization for
* non-existence and single funcion devices * non-existence and single funcion devices
*/ */
for (devfn = min_devfn; devfn <= max_devfn; devfn++) { for (devfn = min_devfn; devfn <= max_devfn; devfn++) {
struct device * dev; struct device * dev;
printk(BIOS_SPEW-2,"PCI: devfn 0x%x\n", devfn);
/* First thing setup the device structure */ /* First thing setup the device structure */
dev = pci_scan_get_dev(&old_devices, devfn); dev = pci_scan_get_dev(&old_devices, devfn);
printk(BIOS_SPEW-2,"PCI: pci_scan_bus pci_scan_get_dev returns dev %s\n", dev->dtsname);
/* See if a device is present and setup the device /* See if a device is present and setup the device
* structure. * structure.
*/ */
dev = pci_probe_dev(dev, bus, devfn); dev = pci_probe_dev(dev, bus, devfn);
printk(BIOS_SPEW-2,"PCI: pci_scan_bus pci_probe_dev returns dev %s\n", dev->dtsname);
/* if this is not a multi function device, /* if this is not a multi function device,
* or the device is not present don't waste * or the device is not present don't waste
@ -1062,6 +1067,7 @@ unsigned int pci_scan_bus(struct bus *bus,
devfn += 0x07; devfn += 0x07;
} }
} }
printk(BIOS_SPEW-2,"PCI: Done for loop\n");
post_code(0x25); post_code(0x25);
/* Die if any leftover Static devices are are found. /* Die if any leftover Static devices are are found.
@ -1116,7 +1122,7 @@ unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
u32 buses; u32 buses;
u16 cr; u16 cr;
printk(BIOS_SPEW,"%s for %s\n", __func__, dev_path(dev)); printk(BIOS_SPEW-2,"%s for %s\n", __func__, dev_path(dev));
bus = &dev->link[0]; bus = &dev->link[0];
bus->dev = dev; bus->dev = dev;
@ -1164,7 +1170,8 @@ unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
pci_write_config32(dev, PCI_PRIMARY_BUS, buses); pci_write_config32(dev, PCI_PRIMARY_BUS, buses);
pci_write_config16(dev, PCI_COMMAND, cr); pci_write_config16(dev, PCI_COMMAND, cr);
printk(BIOS_SPEW,"%s returns max %d\n", __func__, max); printk(BIOS_DEBUG, "%s DONE\n", __func__);
printk(BIOS_SPEW-2,"%s returns max %d\n", __func__, max);
return max; return max;
} }
@ -1194,10 +1201,10 @@ void pci_level_irq(unsigned char intNum)
{ {
unsigned short intBits = inb(0x4d0) | (((unsigned) inb(0x4d1)) << 8); unsigned short intBits = inb(0x4d0) | (((unsigned) inb(0x4d1)) << 8);
printk(BIOS_SPEW,"%s: current ints are 0x%x\n", __func__, intBits); printk(BIOS_SPEW-2,"%s: current ints are 0x%x\n", __func__, intBits);
intBits |= (1 << intNum); intBits |= (1 << intNum);
printk(BIOS_SPEW,"%s: try to set ints 0x%x\n", __func__, intBits); printk(BIOS_SPEW-2,"%s: try to set ints 0x%x\n", __func__, intBits);
// Write new values // Write new values
outb((unsigned char) intBits, 0x4d0); outb((unsigned char) intBits, 0x4d0);

View file

@ -98,7 +98,7 @@ unsigned int scan_static_bus(struct device * busdevice, unsigned int max)
struct device * child; struct device * child;
unsigned link; unsigned link;
printk(BIOS_INFO, "%s for %s\n", __func__, dev_path(busdevice)); printk(BIOS_INFO, "%s for %s(%s)\n", __func__, busdevice->dtsname, dev_path(busdevice));
for(link = 0; link < busdevice->links; link++) { for(link = 0; link < busdevice->links; link++) {
/* for smbus bus enumerate */ /* for smbus bus enumerate */
@ -115,24 +115,23 @@ unsigned int scan_static_bus(struct device * busdevice, unsigned int max)
child->ops->phase5_enable_resources(child); child->ops->phase5_enable_resources(child);
} }
if (child->path.type == DEVICE_PATH_I2C) { if (child->path.type == DEVICE_PATH_I2C) {
printk(BIOS_DEBUG, "smbus: %s[%d]->", printk(BIOS_DEBUG, "smbus: %s(%s)[%d]->",
dev_path(child->bus->dev), child->bus->link ); child->dtsname, dev_path(child->bus->dev), child->bus->link );
} }
printk(BIOS_DEBUG, "%s %s\n", printk(BIOS_DEBUG, "%s(%s) %s\n",
dev_path(child), child->dtsname, dev_path(child), child->enabled?"enabled": "disabled");
child->enabled?"enabled": "disabled");
} }
} }
for(link = 0; link < busdevice->links; link++) { for(link = 0; link < busdevice->links; link++) {
for(child = busdevice->link[link].children; child; child = child->sibling) { for(child = busdevice->link[link].children; child; child = child->sibling) {
if (!child->ops || !child->ops->phase3_scan) if (!child->ops || !child->ops->phase3_scan)
continue; continue;
printk(BIOS_INFO, "%s scanning...\n", dev_path(child)); printk(BIOS_INFO, "%s(%s) scanning...\n", child->dtsname, dev_path(child));
max = dev_phase3_scan(child, max); max = dev_phase3_scan(child, max);
} }
} }
printk(BIOS_INFO, "%s for %s done\n", __func__, dev_path(busdevice)); printk(BIOS_INFO, "%s for %s(%s) done\n", __func__, busdevice->dtsname, dev_path(busdevice));
return max; return max;
} }

View file

@ -20,11 +20,11 @@
/* Safe for inclusion in assembly */ /* Safe for inclusion in assembly */
#ifndef MAXIMUM_CONSOLE_LOGLEVEL #ifndef MAXIMUM_CONSOLE_LOGLEVEL
#define MAXIMUM_CONSOLE_LOGLEVEL 9 #define MAXIMUM_CONSOLE_LOGLEVEL 10
#endif #endif
#ifndef DEFAULT_CONSOLE_LOGLEVEL #ifndef DEFAULT_CONSOLE_LOGLEVEL
#define DEFAULT_CONSOLE_LOGLEVEL 9 /* anything MORE serious than BIOS_SPEW */ #define DEFAULT_CONSOLE_LOGLEVEL 10 /* anything MORE serious than BIOS_SPEW */
#endif #endif
#ifndef ASM_CONSOLE_LOGLEVEL #ifndef ASM_CONSOLE_LOGLEVEL

View file

@ -102,6 +102,7 @@ struct device {
struct device * next; /* chain of all devices */ struct device * next; /* chain of all devices */
struct device_path path; struct device_path path;
char * dtsname; /* the name from the dts */
unsigned vendor; unsigned vendor;
unsigned device; unsigned device;
unsigned int class; /* 3 bytes: (base,sub,prog-if) */ unsigned int class; /* 3 bytes: (base,sub,prog-if) */

View file

@ -56,7 +56,7 @@ $(obj)/statictree.o: $(obj)/statictree.c
$(Q)$(CC) $(CFLAGS) $(LINUXBIOSINCLUDE) -c -o $(obj)/statictree.o $(obj)/statictree.c $(Q)$(CC) $(CFLAGS) $(LINUXBIOSINCLUDE) -c -o $(obj)/statictree.o $(obj)/statictree.c
$(obj)/statictree.c: mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc $(obj)/statictree.c: mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts >$(obj)/statictree.c 2>/dev/null $(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts >$(obj)/statictree.c
STAGE2_CHIPSET_OBJ = STAGE2_CHIPSET_OBJ =
# chipset # chipset

View file

@ -1,36 +1,29 @@
/{ /{
config="mainboard,emulation,qemu-x86"; config="mainboard,emulation,qemu-x86";
enabled;
cpus { cpus {
emulation,qemu-x86@0{
enabled; enabled;
on_mainboard; };
device_type = "cpu"; northbridge,intel,i440bxemulation{
name = "emulation,qemu-x86"; enabled;
pcidomain = "0";
ops="i440bxemulation,pcidomainops";
/* the I/O stuff */
northbridge,intel,440bx{
config="northbridge,intel,i440bxemulation"; config="northbridge,intel,i440bxemulation";
pcipath = "0,0"; pcipath = "0,0";
southbridge,intel,piix4{ /* southbridge,intel,piix4{
pcipath = "0,0";
enabled;
}; };
*/
}; };
};
};
}; };
%% %%
extern struct device_operations i440bxemulation_pcidomainops;
struct mainboard_emulation_qemu_x86_config root = { struct mainboard_emulation_qemu_x86_config root = {
.nothing = 1, .nothing = 1,
}; };
struct northbridge_intel_i440bx_config northbridge_intel_i440bxemulation = {
struct northbridge_intel_i440bx_config northbridge_intel_440bx = {
.ramsize = CONFIG_NORTHBRIDGE_INTEL_I440BXEMULATION_RAMSIZE, .ramsize = CONFIG_NORTHBRIDGE_INTEL_I440BXEMULATION_RAMSIZE,
}; };

View file

@ -41,6 +41,7 @@ static void i440bxemulation_enable_dev(struct device *dev)
pci_set_method(dev); pci_set_method(dev);
} }
*/ */
printk(BIOS_INFO, "%s: DONE\n", __FUNCTION__);
} }
struct chip_operations northbridge_intel_i440bxemulation_ops = { struct chip_operations northbridge_intel_i440bxemulation_ops = {

View file

@ -564,6 +564,8 @@ static void linuxbios_emit_special(FILE *e, struct node *tree)
if ((! ops_set) && is_root) if ((! ops_set) && is_root)
fprintf(f, "\t.ops = &default_dev_ops_root,\n"); fprintf(f, "\t.ops = &default_dev_ops_root,\n");
fprintf(f, "\t.dtsname = \"%s\",\n", tree->label);
fprintf(f, "};\n"); fprintf(f, "};\n");
} }