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>
diff --git a/src/device/device_simple.c b/src/device/device_simple.c
index 828e99b..2cacb4a 100644
--- a/src/device/device_simple.c
+++ b/src/device/device_simple.c
@@ -24,7 +24,7 @@
 #include <device/resource.h>
 
 /** Linked list of ALL devices */
-ROMSTAGE_CONST struct device * ROMSTAGE_CONST all_devices = &dev_root;
+DEVTREE_CONST struct device * DEVTREE_CONST all_devices = &dev_root;
 
 /**
  * Given a PCI bus and a devfn number, find the device structure.
@@ -33,10 +33,10 @@
  * @param devfn A device/function number.
  * @return Pointer to the device structure (if found), 0 otherwise.
  */
-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, *result;
+	DEVTREE_CONST struct device *dev, *result;
 
 	result = 0;
 	for (dev = all_devices; dev; dev = dev->next) {
@@ -56,10 +56,10 @@
  * @param previous_dev A pointer to a PCI device structure.
  * @return Pointer to the next device structure (if found), 0 otherwise.
  */
-ROMSTAGE_CONST struct device *dev_find_next_pci_device(
-		ROMSTAGE_CONST struct device *previous_dev)
+DEVTREE_CONST struct device *dev_find_next_pci_device(
+		DEVTREE_CONST struct device *previous_dev)
 {
-	ROMSTAGE_CONST struct device *dev, *result;
+	DEVTREE_CONST struct device *dev, *result;
 
 	if (previous_dev == NULL)
 		previous_dev = all_devices;
@@ -81,10 +81,10 @@
  * @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,
+DEVTREE_CONST struct device *dev_find_slot_on_smbus(unsigned int bus,
 							unsigned int addr)
 {
-	ROMSTAGE_CONST struct device *dev, *result;
+	DEVTREE_CONST struct device *dev, *result;
 
 	result = 0;
 	for (dev = all_devices; dev; dev = dev->next) {
@@ -105,9 +105,9 @@
  * @param device Logical device number.
  * @return Pointer to the device structure (if found), 0 otherwise.
  */
-ROMSTAGE_CONST struct device *dev_find_slot_pnp(u16 port, u16 device)
+DEVTREE_CONST struct device *dev_find_slot_pnp(u16 port, u16 device)
 {
-	ROMSTAGE_CONST struct device *dev;
+	DEVTREE_CONST struct device *dev;
 
 	for (dev = all_devices; dev; dev = dev->next) {
 		if ((dev->path.type == DEVICE_PATH_PNP) &&