[coreboot] New patch to review for coreboot: b5473f0 Add name field for device

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sat Oct 27 10:03:05 CEST 2012

Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1634


commit b5473f0627febc162ac6fe037fe3bb4e845d47be
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Wed Oct 10 23:14:28 2012 +0300

    Add name field for device
    The constant field "name" in chip_operations is common to multiple
    different devices within a chip and cannot reflect the actual device
    as found on the platform.
    The intention is that a driver sets dev->name as part of the device
    enumeration sequence with the detected hardware type and revision.
    The field is for debug print use only.
    Change-Id: Ib7bf90ba3c618ad0cb715d80d6a937ceaae0adcf
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
 src/devices/device_util.c   | 4 +++-
 src/include/device/device.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 5cf5eab..224c58e 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -230,7 +230,9 @@ const char *dev_path(device_t dev)
 const char *dev_name(device_t dev)
-	if (dev->chip_ops && dev->chip_ops->name)
+	if (dev->name)
+		return dev->name;
+	else if (dev->chip_ops && dev->chip_ops->name)
 		return dev->chip_ops->name;
 		return "unknown";
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 7e07dc1..6ab2db4 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -104,6 +104,7 @@ struct device {
 	struct device_operations *ops;
 #ifndef __PRE_RAM__
 	const struct chip_operations *chip_ops;
+	const char *name;
 	ROMSTAGE_CONST void *chip_info;

More information about the coreboot mailing list