[coreboot-gerrit] Patch set updated for coreboot: 8498c59 devicetree: Remove dev_find_slot_on_smbus()

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Fri Feb 27 17:52:31 CET 2015


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/8543

-gerrit

commit 8498c591505a4cb8612d2260bc368afa21fde057
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Fri Feb 27 17:05:18 2015 +0200

    devicetree: Remove dev_find_slot_on_smbus()
    
    Dynamically assigned bus numbers can shift as hardware configuration
    changes. This approach also has dependency to the order in which
    devices are listed in devicetree.cb files.
    
    Furthermore, it is not possible to write generic i2c device drivers
    if bus number is used as part of the slave device.
    
    Change-Id: I2489f5d7656c0057db33a6498ef72635f89f486c
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/device/device_romstage.c | 24 ------------------------
 src/device/device_util.c     | 23 -----------------------
 src/device/root_device.c     | 20 +-------------------
 src/include/device/device.h  |  3 ---
 4 files changed, 1 insertion(+), 69 deletions(-)

diff --git a/src/device/device_romstage.c b/src/device/device_romstage.c
index b28dedf..3715989 100644
--- a/src/device/device_romstage.c
+++ b/src/device/device_romstage.c
@@ -55,30 +55,6 @@ ROMSTAGE_CONST struct device *dev_find_next_pci_device(
 }
 
 /**
- * Given an SMBus bus and a device number, find the device structure.
- *
- * @param bus The bus number.
- * @param addr A device number.
- * @return Pointer to the device structure (if found), 0 otherwise.
- */
-ROMSTAGE_CONST struct device *dev_find_slot_on_smbus(unsigned int bus,
-							unsigned int addr)
-{
-	ROMSTAGE_CONST struct device *dev, *result;
-
-	result = 0;
-	for (dev = all_devices; dev; dev = dev->next) {
-		if ((dev->path.type == DEVICE_PATH_I2C) &&
-		    (dev->bus->secondary == bus) &&
-		    (dev->path.i2c.device == addr)) {
-			result = dev;
-			break;
-		}
-	}
-	return result;
-}
-
-/**
  * Given a PnP port and a device number, find the device structure.
  *
  * @param port The I/O port.
diff --git a/src/device/device_util.c b/src/device/device_util.c
index d970429..bd783c7 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -71,29 +71,6 @@ struct device *dev_find_slot(unsigned int bus, unsigned int devfn)
 }
 
 /**
- * Given an SMBus bus and a device number, find the device structure.
- *
- * @param bus The bus number.
- * @param addr A device number.
- * @return Pointer to the device structure (if found), 0 otherwise.
- */
-struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr)
-{
-	struct device *dev, *result;
-
-	result = 0;
-	for (dev = all_devices; dev; dev = dev->next) {
-		if ((dev->path.type == DEVICE_PATH_I2C) &&
-		    (dev->bus->secondary == bus) &&
-		    (dev->path.i2c.device == addr)) {
-			result = dev;
-			break;
-		}
-	}
-	return result;
-}
-
-/**
  * Given a PnP port and a device number, find the device structure.
  *
  * @param port The I/O port.
diff --git a/src/device/root_device.c b/src/device/root_device.c
index 860df42..a5ecf0e 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -80,28 +80,10 @@ void scan_smbus(device_t bus)
 {
 	device_t child;
 	struct bus *link;
-	static int smbus_max = 0;
 
 	printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
 
-	for (link = bus->link_list; link; link = link->next) {
-		for (child = link->children; child; child = child->sibling) {
-
-			link->secondary = ++smbus_max;
-
-			if (child->chip_ops && child->chip_ops->enable_dev)
-				child->chip_ops->enable_dev(child);
-
-			if (child->ops && child->ops->enable)
-				child->ops->enable(child);
-
-			printk(BIOS_DEBUG, "smbus: %s[%d]->", dev_path(child->bus->dev),
-			       child->bus->link_num);
-
-			printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
-			       child->enabled ? "enabled" : "disabled");
-		}
-	}
+	max = scan_static_bus(bus, max);
 
 	printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
 }
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 0ead7e2..a18055e 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -193,7 +193,6 @@ device_t alloc_find_dev(struct bus *parent, struct device_path *path);
 device_t dev_find_device (u16 vendor, u16 device, device_t from);
 device_t dev_find_class (unsigned int class, device_t from);
 device_t dev_find_slot (unsigned int bus, unsigned int devfn);
-device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr);
 device_t dev_find_slot_pnp(u16 port, u16 device);
 device_t dev_find_lapic(unsigned apic_id);
 int dev_count_cpu(void);
@@ -260,8 +259,6 @@ u32 find_pci_tolm(struct bus *bus);
 
 ROMSTAGE_CONST struct device *dev_find_next_pci_device(
 						ROMSTAGE_CONST struct device *previous_dev);
-ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus,
-							unsigned int addr);
 ROMSTAGE_CONST struct device * dev_find_slot_pnp(u16 port, u16 device);
 
 #endif



More information about the coreboot-gerrit mailing list