dumpstate: Collect PCIe link statistics
Collect PCIe link statistics in dump_pcie.sh script.
Move SELinux type declaration 'sysfs_pcie' here.
Test: adb bugreport && unzip bugreport*.zip &&
grep link_stats dumpstate_board.txt
Bug: 266561593
Change-Id: Iecf3a5a20892efb6d9cc9f4a5c322aafa76f8e7f
Signed-off-by: Doug Zobel <zobel@google.com>
diff --git a/pcie/dump_pcie.sh b/pcie/dump_pcie.sh
index 0d543d6..4546207 100644
--- a/pcie/dump_pcie.sh
+++ b/pcie/dump_pcie.sh
@@ -3,3 +3,9 @@
cat /dev/logbuffer_pcie0
echo "--- pcie1 dump ---"
cat /dev/logbuffer_pcie1
+
+echo "--- pcie link statistics ---"
+for f in /sys/devices/platform/*.pcie/link_stats/*
+do
+ echo "$f: `cat $f`"
+done
diff --git a/pcie/sepolicy/device.te b/pcie/sepolicy/device.te
index 8a471b0..934cdb4 100644
--- a/pcie/sepolicy/device.te
+++ b/pcie/sepolicy/device.te
@@ -1 +1,2 @@
type pcie_log_device, dev_type;
+type sysfs_pcie, sysfs_type, fs_type;
diff --git a/pcie/sepolicy/dump_pcie.te b/pcie/sepolicy/dump_pcie.te
index 6d490bc..30b2241 100644
--- a/pcie/sepolicy/dump_pcie.te
+++ b/pcie/sepolicy/dump_pcie.te
@@ -2,3 +2,6 @@
allow dump_pcie pcie_log_device:chr_file r_file_perms;
allow dump_pcie vendor_toolbox_exec:file execute_no_trans;
+
+allow dump_pcie sysfs:dir r_dir_perms;
+allow dump_pcie sysfs_pcie:file r_file_perms;