printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / devices / device_util.c
index c5a2f6406fa076130af4edafb1a7cae4faa58845..e44a02e428e51333ad073689a560f0dd3a201328 100644 (file)
@@ -149,6 +149,8 @@ struct device *dev_find_class(unsigned int class, struct device *from)
        return from;
 }
 
+/* Warning: This function uses a static buffer.  Don't call it more than once
+ * from the same print statement! */
 
 const char *dev_path(device_t dev)
 {
@@ -201,7 +203,7 @@ const char *dev_path(device_t dev)
                        sprintf(buffer, "CPU_BUS: %02x", dev->path.cpu_bus.id);
                        break;
                default:
-                       printk_err("Unknown device path type: %d\n", dev->path.type);
+                       printk(BIOS_ERR, "Unknown device path type: %d\n", dev->path.type);
                        break;
                }
        }
@@ -211,8 +213,7 @@ const char *dev_path(device_t dev)
 const char *bus_path(struct bus *bus)
 {
        static char buffer[BUS_PATH_MAX];
-       sprintf(buffer, "%s,%d",
-               dev_path(bus->dev), bus->link);
+       sprintf(buffer, "%s,%d", dev_path(bus->dev), bus->link);
        return buffer;
 }
 
@@ -252,7 +253,7 @@ int path_eq(struct device_path *path1, struct device_path *path2)
                        equal = (path1->cpu_bus.id == path2->cpu_bus.id);
                        break;
                default:
-                       printk_err("Uknown device type: %d\n", path1->type);
+                       printk(BIOS_ERR, "Uknown device type: %d\n", path1->type);
                        break;
                }
        }
@@ -354,7 +355,7 @@ struct resource *find_resource(device_t dev, unsigned index)
        /* See if there is a resource with the appropriate index */
        resource = probe_resource(dev, index);
        if (!resource) {
-               printk_emerg("%s missing resource: %02x\n",
+               printk(BIOS_EMERG, "%s missing resource: %02x\n",
                        dev_path(dev), index);
                die("");
        }
@@ -467,7 +468,7 @@ void report_resource_stored(device_t dev, struct resource *resource, const char
                        sprintf(buf, "bus %02x ", dev->link[0].secondary);
 #endif
                }
-               printk_debug(
+               printk(BIOS_DEBUG, 
                        "%s %02lx <- [0x%010Lx - 0x%010Lx] size 0x%08Lx gran 0x%02x %s%s%s\n",
                        dev_path(dev),
                        resource->index,
@@ -487,7 +488,7 @@ void search_bus_resources(struct bus *bus,
        for(curdev = bus->children; curdev; curdev = curdev->sibling) {
                int i;
                /* Ignore disabled devices */
-               if (!curdev->have_resources) continue;
+               if (!curdev->enabled) continue;
                for(i = 0; i < curdev->resources; i++) {
                        struct resource *resource = &curdev->resource[i];
                        /* If it isn't the right kind of resource ignore it */
@@ -514,7 +515,7 @@ void search_global_resources(
        for(curdev = all_devices; curdev; curdev = curdev->next) {
                int i;
                /* Ignore disabled devices */
-               if (!curdev->have_resources) continue;
+               if (!curdev->enabled) continue;
                for(i = 0; i < curdev->resources; i++) {
                        struct resource *resource = &curdev->resource[i];
                        /* If it isn't the right kind of resource ignore it */
@@ -556,7 +557,7 @@ void disable_children(struct bus *bus)
        }
 }
 
-void resource_tree(struct device *root, int debug_level, int depth)
+static void resource_tree(struct device *root, int debug_level, int depth)
 {
        int i = 0, link = 0;
        struct device *child;
@@ -566,10 +567,10 @@ void resource_tree(struct device *root, int debug_level, int depth)
                indent[i] = ' ';
        indent[i] = '\0';
 
-       do_printk(BIOS_DEBUG, "%s%s links %x child on link 0 %s\n",
-                 indent, dev_path(root), root->links,
-                 root->link[0].children ? dev_path(root->link[0].children) :
-                                         "NULL");
+       do_printk(BIOS_DEBUG, "%s%s links %x child on link 0", indent,
+                 dev_path(root), root->links);
+       do_printk(BIOS_DEBUG, " %s\n", root->link[0].children ?
+                 dev_path(root->link[0].children) : "NULL");
        for (i = 0; i < root->resources; i++) {
                do_printk(BIOS_DEBUG,
                          "%s%s resource base %llx size %llx align %d gran %d limit %llx flags %lx index %lx\n",