Add initialization hook for chips
Add an init() function to the chip_operations which will be called
before bus enumeration. This allows to disable unused devices before
they get enumerated.
Change-Id: I63dd9cbfc7b5995ccafb7bf7a81dc71fc67906a0
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1623
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Marc Jones <marcj303@gmail.com>
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 1cd2a8b..b248aaf 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -16,6 +16,8 @@
/* Chip operations */
struct chip_operations {
void (*enable_dev)(struct device *dev);
+ void (*init)(void *chip_info);
+ unsigned int initialized : 1;
const char *name;
};
@@ -100,7 +102,7 @@
struct device_operations *ops;
#ifndef __PRE_RAM__
- const struct chip_operations *chip_ops;
+ struct chip_operations *chip_ops;
const char *name;
#endif
ROMSTAGE_CONST void *chip_info;
@@ -125,6 +127,7 @@
/* Generic device interface functions */
device_t alloc_dev(struct bus *parent, struct device_path *path);
+void dev_initialize_chips(void);
void dev_enumerate(void);
void dev_configure(void);
void dev_enable(void);