aboutsummaryrefslogtreecommitdiff
path: root/src/include/device/device.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-04-16 22:05:36 -0500
committerAaron Durbin <adurbin@chromium.org>2017-04-25 18:14:38 +0200
commite4d7abc0d448c7e805f2b48ed1251708d1f84c67 (patch)
tree4ca1014c9d972063e7b44c8a373072008c6015fa /src/include/device/device.h
parent4003950881af6fc4761aa0b177a3670d04ee9881 (diff)
lib: provide clearer devicetree semantics
The devicetree data structures have been available in more than just ramstage and romstage. In order to provide clearer and consistent semantics two new macros are provided: 1. DEVTREE_EARLY which is true when !ENV_RAMSTAGE 2. DEVTREE_CONST as a replacment for ROMSTAGE_CONST The ROMSTAGE_CONST attribute is used in the source code to mark the devicetree data structures as const in early stages even though it's not just romstage. Therefore, rename the attribute to DEVTREE_CONST as that's the actual usage. The only place where the usage was not devicetree related is console_loglevel, but the same name was used for consistency. Any stage that is not ramstage has the const C attribute applied when DEVTREE_CONST is used. Change-Id: Ibd51c2628dc8f68e0896974f7e4e7c8588d333ed Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/19333 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/include/device/device.h')
-rw-r--r--src/include/device/device.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index bb0d0ca8b8..7b4fce36ea 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -84,9 +84,9 @@ static inline void device_noop(struct device *dev) {}
struct bus {
- ROMSTAGE_CONST struct device *dev; /* This bridge device */
- ROMSTAGE_CONST struct device *children; /* devices behind this bridge */
- ROMSTAGE_CONST struct bus *next; /* The next bridge on this device */
+ DEVTREE_CONST struct device *dev; /* This bridge device */
+ DEVTREE_CONST struct device *children; /* devices behind this bridge */
+ DEVTREE_CONST struct bus *next; /* The next bridge on this device */
unsigned int bridge_ctrl; /* Bridge control register */
uint16_t bridge_cmd; /* Bridge command register */
unsigned char link_num; /* The index of this link */
@@ -113,12 +113,12 @@ struct pci_irq_info {
};
struct device {
- ROMSTAGE_CONST struct bus *bus; /* bus this device is on, for bridge
+ DEVTREE_CONST struct bus *bus; /* bus this device is on, for bridge
* devices, it is the up stream bus */
- ROMSTAGE_CONST struct device *sibling; /* next device on this bus */
+ DEVTREE_CONST struct device *sibling; /* next device on this bus */
- ROMSTAGE_CONST struct device *next; /* chain of all devices */
+ DEVTREE_CONST struct device *next; /* chain of all devices */
struct device_path path;
unsigned int vendor;
@@ -134,26 +134,26 @@ struct device {
u8 command;
/* Base registers for this device. I/O, MEM and Expansion ROM */
- ROMSTAGE_CONST struct resource *resource_list;
+ DEVTREE_CONST struct resource *resource_list;
/* links are (downstream) buses attached to the device, usually a leaf
* device with no children has 0 buses attached and a bridge has 1 bus
*/
- ROMSTAGE_CONST struct bus *link_list;
+ DEVTREE_CONST struct bus *link_list;
struct device_operations *ops;
-#ifndef __PRE_RAM__
+#if !DEVTREE_EARLY
struct chip_operations *chip_ops;
const char *name;
#endif
- ROMSTAGE_CONST void *chip_info;
+ DEVTREE_CONST void *chip_info;
};
/**
* This is the root of the device tree. The device tree is defined in the
* static.c file and is generated by the config tool at compile time.
*/
-extern ROMSTAGE_CONST struct device dev_root;
+extern DEVTREE_CONST struct device dev_root;
#ifndef __SIMPLE_DEVICE__
@@ -272,13 +272,13 @@ u32 find_pci_tolm(struct bus *bus);
#else /* vv __SIMPLE_DEVICE__ vv */
-ROMSTAGE_CONST struct device *dev_find_slot(unsigned int bus,
+DEVTREE_CONST struct device *dev_find_slot(unsigned int bus,
unsigned int devfn);
-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,
+DEVTREE_CONST struct device *dev_find_next_pci_device(
+ DEVTREE_CONST struct device *previous_dev);
+DEVTREE_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);
+DEVTREE_CONST struct device *dev_find_slot_pnp(u16 port, u16 device);
#endif