[PATCH] fwts_devicetree: Add defines for common usage

Deb McLemore debmc at linux.vnet.ibm.com
Mon Sep 12 19:11:01 UTC 2016


Add defines for common usage across FWTS.

Signed-off-by: Deb McLemore <debmc at linux.vnet.ibm.com>
---
 src/lib/include/fwts_devicetree.h | 10 ++++++++++
 src/lib/src/fwts_devicetree.c     |  4 +---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/lib/include/fwts_devicetree.h b/src/lib/include/fwts_devicetree.h
index 7c67dc5..355c0ee 100644
--- a/src/lib/include/fwts_devicetree.h
+++ b/src/lib/include/fwts_devicetree.h
@@ -28,6 +28,16 @@
 #define FWTS_HAS_DEVICETREE 0
 #endif
 
+#define DT_FS_PATH "/sys/firmware/devicetree/base"
+#define DT_LINUX_PCI_DEVICES "/sys/bus/pci/devices"
+#define DT_PROPERTY_OPAL_PCI_SLOT "ibm,slot-label"
+#define DT_PROPERTY_OPAL_SLOT_LOC "ibm,slot-location-code"
+#define DT_PROPERTY_OPAL_PART_NUM "part-number"
+#define DT_PROPERTY_OPAL_SERIAL_NUM "serial-number"
+#define DT_PROPERTY_OPAL_MANUFACTURER_ID "manufacturer-id"
+#define DT_PROPERTY_OPAL_STATUS "status"
+#define DT_PROPERTY_OPAL_VENDOR "vendor"
+
 #if FWTS_HAS_DEVICETREE
 
 int fwts_devicetree_read(fwts_framework *fwts);
diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
index 5978ab9..94367de 100644
--- a/src/lib/src/fwts_devicetree.c
+++ b/src/lib/src/fwts_devicetree.c
@@ -23,8 +23,6 @@
 
 #include "fwts.h"
 
-static const char *devicetree_fs_path = "/sys/firmware/devicetree/base";
-
 int fwts_devicetree_read(fwts_framework *fwts)
 {
 	char *command, *data = NULL;
@@ -35,7 +33,7 @@ int fwts_devicetree_read(fwts_framework *fwts)
 	if (!fwts_firmware_has_features(FWTS_FW_FEATURE_DEVICETREE))
 		return FWTS_OK;
 
-	rc = asprintf(&command, "dtc -I fs -O dtb %s", devicetree_fs_path);
+	rc = asprintf(&command, "dtc -I fs -O dtb %s", DT_FS_PATH);
 	if (rc < 0)
 		return FWTS_ERROR;
 
-- 
2.7.4




More information about the fwts-devel mailing list