openpower:dreport: add PHAL device tree debug data to BMC dump

1. Generate attribute list to a file and append the file to
the dump.

2. Append the device tree blob file to the dump

3. Append export device tree file to the dump

4. Append attributes_info.db file to the dump

Tested
root@ever8bmc:/tmp/test/obmcdump_00000000_1648657576# ls -lah DEVTREE
-r--r-----    1 root     root      840.0K Mar 30 16:26 DEVTREE
root@ever8bmc:/tmp/test/obmcdump_00000000_1648657576# ls -lah attributes_info.db
-rw-r--r--    1 root     root       10.4K Mar 30 16:26 attributes_info.db
root@ever8bmc:/tmp/test/obmcdump_00000000_1648657576# ls -lah PHAL_devtree.txt
-rw-r--r--    1 root     root        2.2M Mar 30 16:26 PHAL_devtree.txt

Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I3b60f136e04be2ed44349c9c91fe3858dd78a91a
diff --git a/tools/dreport.d/openpower.d/plugins.d/phal_devtree b/tools/dreport.d/openpower.d/plugins.d/phal_devtree
new file mode 100644
index 0000000..abcdb98
--- /dev/null
+++ b/tools/dreport.d/openpower.d/plugins.d/phal_devtree
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# config: 234 25
+# @brief: Collect PHAL devtree debug data
+#
+
+. $DREPORT_INCLUDE/functions
+
+attributes="/usr/bin/attributes"
+attr_list_file_name="PHAL_devtree.txt"
+
+#export attributes list to attribute_list.txt
+if [ -x $attributes ]; then
+    add_cmd_output "$attributes export" "$attr_list_file_name" "Attribute list"
+fi
+
+#copy PHAL device tree file to dump
+devtree_file_name="/media/hostfw/running/DEVTREE"
+if [ -f "$devtree_file_name" ]; then
+    add_copy_file "$devtree_file_name" "device tree"
+fi
+
+
+#copy PHAL export device tree to dump
+exp_dev_tree="/var/lib/phal/exportdevtree"
+if [ -f "$exp_dev_tree" ]; then
+    add_copy_file "$exp_dev_tree" "export device tree"
+fi
+
+#copy attribues info db to dump
+attr_info_db="/usr/share/pdata/attributes_info.db"
+if [ -f "$attr_info_db" ]; then
+    add_copy_file "$attr_info_db" "attribute info db"
+fi