fix a stupid bug in malloc.
add debug printks. make dtc put 'root' as the first_node, instead of making the last node be the first node .... much happier in linuxbios. sprintf is broken ... dammit. I hope someone will fix it. I've got about another week of full-time I can spend on this and then I go back to part time. So I'm going to need some help soon. other fixups, and also, make the dts conform to the needs of the device tree. So we have a domain0 and a device (0,0) that is the north. Mostly things are working, but we're STILL not getting any memory in the LB tables from the north. The device tree is a bitch. 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@175 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
21ac13289a
commit
53283b1e36
9 changed files with 91 additions and 18 deletions
|
|
@ -90,6 +90,8 @@ struct device * alloc_dev(struct bus *parent, struct device_path *path)
|
|||
{
|
||||
struct device * dev, *child;
|
||||
int link;
|
||||
static char thissucks[64];
|
||||
static int fuck = 0;
|
||||
|
||||
// spin_lock(&dev_lock);
|
||||
|
||||
|
|
@ -128,6 +130,21 @@ struct device * alloc_dev(struct bus *parent, struct device_path *path)
|
|||
*last_dev_p = dev;
|
||||
last_dev_p = &dev->next;
|
||||
|
||||
/* give the device a name */
|
||||
dev -> dtsname = malloc(32);
|
||||
if (dev->dtsname == 0) {
|
||||
die("DEV: out of memory.\n");
|
||||
}
|
||||
sprintf(thissucks, "dynamic %s", dev_path(dev));
|
||||
printk(BIOS_INFO, "thissucks is %s dev is %p dev->dtsname is %p\n", thissucks, dev, dev->dtsname);
|
||||
sprintf(dev->dtsname, "dynamic %s", dev_path(dev));
|
||||
printk(BIOS_INFO, "after sprintf dtsname is %s\n", dev->dtsname);
|
||||
memcpy(dev->dtsname, thissucks, strlen(thissucks));
|
||||
printk(BIOS_INFO, "after strcpy dtsname is %s\n", dev->dtsname);
|
||||
/* FUCK. sprintf doesn't work. */
|
||||
dev->dtsname[0] = '0' + fuck++;
|
||||
dev->dtsname[1] = 0;
|
||||
|
||||
// spin_unlock(&dev_lock);
|
||||
return dev;
|
||||
}
|
||||
|
|
@ -154,13 +171,15 @@ static void read_resources(struct bus *bus)
|
|||
{
|
||||
struct device *curdev;
|
||||
|
||||
printk(BIOS_SPEW, "%s read_resources bus %d link: %d\n",
|
||||
printk(BIOS_SPEW, "%s: %s(%s) read_resources bus %d link: %d\n", __func__, bus->dev->dtsname,
|
||||
dev_path(bus->dev), bus->secondary, bus->link);
|
||||
|
||||
/* Walk through all of the devices and find which resources they need. */
|
||||
for(curdev = bus->children; curdev; curdev = curdev->sibling) {
|
||||
unsigned links;
|
||||
int i;
|
||||
printk(BIOS_SPEW, "%s: %s(%s) have_resources %d enabled %d\n", __func__, bus->dev->dtsname,
|
||||
dev_path(bus->dev), curdev->have_resources, curdev->enabled);
|
||||
if (curdev->have_resources) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -168,8 +187,8 @@ static void read_resources(struct bus *bus)
|
|||
continue;
|
||||
}
|
||||
if (!curdev->ops || !curdev->ops->phase4_read_resources) {
|
||||
printk(BIOS_ERR, "%s missing phase4_read_resources\n",
|
||||
dev_path(curdev));
|
||||
printk(BIOS_ERR, "%s: %s(%s) missing phase4_read_resources\n", __func__,
|
||||
curdev->dtsname, dev_path(curdev));
|
||||
continue;
|
||||
}
|
||||
curdev->ops->phase4_read_resources(curdev);
|
||||
|
|
@ -194,7 +213,7 @@ static void read_resources(struct bus *bus)
|
|||
}
|
||||
}
|
||||
}
|
||||
printk(BIOS_SPEW, "%s read_resources bus %d link: %d done\n",
|
||||
printk(BIOS_SPEW, "%s: %s(%s) read_resources bus %d link: %d done\n", __func__, bus->dev->dtsname,
|
||||
dev_path(bus->dev), bus->secondary, bus->link);
|
||||
}
|
||||
|
||||
|
|
@ -659,7 +678,7 @@ unsigned int dev_phase3_scan(struct device * busdevice, unsigned int max)
|
|||
do_phase3 = 1;
|
||||
while(do_phase3) {
|
||||
int link;
|
||||
printk(BIOS_INFO, "%s: scanning %s\n", __FUNCTION__, dev_path(busdevice));
|
||||
printk(BIOS_INFO, "%s: scanning %s(%s)\n", __FUNCTION__, busdevice->dtsname, dev_path(busdevice));
|
||||
new_max = busdevice->ops->phase3_scan(busdevice, max);
|
||||
do_phase3 = 0;
|
||||
for(link = 0; link < busdevice->links; link++) {
|
||||
|
|
@ -837,3 +856,15 @@ void dev_phase6(void)
|
|||
printk(BIOS_INFO, "Phase 6: Devices initialized.\n");
|
||||
}
|
||||
|
||||
|
||||
void show_all_devs(void) {
|
||||
|
||||
struct device *dev;
|
||||
|
||||
printk(BIOS_INFO, "show all devs..\n");
|
||||
for(dev = all_devices; dev; dev = dev->next) {
|
||||
printk(BIOS_SPEW, "%s(%s): enabled %d have_resources %d initialized %d\n",
|
||||
dev->dtsname, dev_path(dev), dev->enabled, dev->have_resources, dev->initialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,12 +505,17 @@ void search_global_resources(
|
|||
resource_search_t search, void *gp)
|
||||
{
|
||||
struct device *curdev;
|
||||
printk(BIOS_SPEW-2, "%s: mask %x type %x \n", __func__, type_mask, type);
|
||||
for(curdev = all_devices; curdev; curdev = curdev->next) {
|
||||
int i;
|
||||
printk(BIOS_SPEW, "%s: dev %s, have_resources %d #resources %d\n", __func__, curdev->dtsname,
|
||||
curdev->have_resources, curdev->resources);
|
||||
/* Ignore disabled devices */
|
||||
if (!curdev->have_resources) continue;
|
||||
for(i = 0; i < curdev->resources; i++) {
|
||||
struct resource *resource = &curdev->resource[i];
|
||||
printk(BIOS_SPEW, "%s: dev %s, resource %d, flags %x\n", __func__, curdev->dtsname,
|
||||
i, resource->flags);
|
||||
/* If it isn't the right kind of resource ignore it */
|
||||
if ((resource->flags & type_mask) != type) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ void pci_dev_enable_resources(struct device *dev)
|
|||
command = pci_read_config16(dev, PCI_COMMAND);
|
||||
command |= dev->command;
|
||||
command |= (PCI_COMMAND_PARITY + PCI_COMMAND_SERR); /* error check */
|
||||
printk(BIOS_DEBUG,"%s cmd <- %02x\n", dev_path(dev), command);
|
||||
printk(BIOS_DEBUG,"%s: %s(%s) cmd <- %02x\n", __func__, dev->dtsname, dev_path(dev), command);
|
||||
pci_write_config16(dev, PCI_COMMAND, command);
|
||||
}
|
||||
|
||||
|
|
@ -781,6 +781,7 @@ static void set_pci_ops(struct device *dev)
|
|||
{
|
||||
struct pci_driver *driver;
|
||||
if (dev->ops) {
|
||||
printk(BIOS_INFO, "%s: dev %p(%s) already has ops %p\n", __func__, dev, dev->dtsname, dev->ops);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -829,6 +830,7 @@ static void set_pci_ops(struct device *dev)
|
|||
dev->class >> 8, dev->hdr_type);
|
||||
}
|
||||
}
|
||||
printk(BIOS_INFO, "%s: dev %p(%s) set ops to %p\n", __func__, dev, dev->dtsname, dev->ops);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -851,12 +853,15 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn)
|
|||
{
|
||||
struct device *dev;
|
||||
dev = 0;
|
||||
printk(BIOS_INFO, "%s: list is %p, *list is %p\n", __func__, list, *list);
|
||||
for(; *list; list = &(*list)->sibling) {
|
||||
printk(BIOS_INFO, "%s: check dev %s \n", __func__, (*list)->dtsname);
|
||||
if ((*list)->path.type != DEVICE_PATH_PCI) {
|
||||
printk(BIOS_ERR,"%s: child %s not a pci device: it's type %d\n", __FUNCTION__,
|
||||
dev_path(*list), (*list)->path.type);
|
||||
printk(BIOS_ERR,"%s: child %s(%s) not a pci device: it's type %d\n", __FUNCTION__,
|
||||
(*list)->dtsname, dev_path(*list), (*list)->path.type);
|
||||
continue;
|
||||
}
|
||||
printk(BIOS_INFO, "%s: check dev %s it has devfn 0x%x\n", __func__, (*list)->dtsname, (*list)->path.u.pci.devfn);
|
||||
if ((*list)->path.u.pci.devfn == devfn) {
|
||||
/* Unlink from the list */
|
||||
dev = *list;
|
||||
|
|
@ -1027,7 +1032,7 @@ unsigned int pci_scan_bus(struct bus *bus,
|
|||
struct device * old_devices;
|
||||
struct device * child;
|
||||
|
||||
printk(BIOS_DEBUG, "%s start\n", __func__);
|
||||
printk(BIOS_DEBUG, "%s start bus %p, bus->dev %p\n", __func__, bus, bus->dev);
|
||||
#if PCI_BUS_SEGN_BITS
|
||||
printk(BIOS_DEBUG,"PCI: pci_scan_bus for bus %04x:%02x\n", bus->secondary >> 8, bus->secondary & 0xff);
|
||||
#else
|
||||
|
|
@ -1035,6 +1040,7 @@ unsigned int pci_scan_bus(struct bus *bus,
|
|||
#endif
|
||||
|
||||
old_devices = bus->children;
|
||||
printk(BIOS_DEBUG, "%s: old_devices %p, dev for this bus %p(%s)\n", __func__, old_devices, bus->dev, bus->dev->dtsname);
|
||||
bus->children = 0;
|
||||
|
||||
post_code(0x24);
|
||||
|
|
@ -1049,12 +1055,12 @@ unsigned int pci_scan_bus(struct bus *bus,
|
|||
/* First thing setup the device structure */
|
||||
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);
|
||||
printk(BIOS_SPEW-2,"PCI: pci_scan_bus pci_scan_get_dev returns dev %s\n", dev ? dev->dtsname :"None (no dev in tree yet)");
|
||||
/* See if a device is present and setup the device
|
||||
* structure.
|
||||
*/
|
||||
dev = pci_probe_dev(dev, bus, devfn);
|
||||
printk(BIOS_SPEW-2,"PCI: pci_scan_bus pci_probe_dev returns dev %s\n", dev->dtsname);
|
||||
printk(BIOS_SPEW-2,"PCI: pci_scan_bus pci_probe_dev returns dev %p(%s)\n", dev, dev->dtsname);
|
||||
|
||||
/* if this is not a multi function device,
|
||||
* or the device is not present don't waste
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue