summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2017-10-02 14:48:46 -0700
committerWei Wang <wvw@google.com>2017-10-03 10:21:32 -0700
commit4fa2c7c8b842f293f406f654c287271fc9fe41fe (patch)
tree06be51aed1b4105a5bea363ae84b74aeece9ff1f
parentbeb0bb8758a78a6a07832472db6f6f3b8b01c554 (diff)
downloadwahoo-4fa2c7c8b842f293f406f654c287271fc9fe41fe.tar.gz
Add UFS health information into board specific dumpstate
Test: Take bugreport Bug: 66967195 Change-Id: Id635b64f77d4a6fdc1ace2290f89adfdf86514a7 Merged-In: Id635b64f77d4a6fdc1ace2290f89adfdf86514a7 (cherry picked from commit 0db0037ca1a8015e26c45c0d45e9e5f1976a2881)
-rwxr-xr-xdumpstate/DumpstateDevice.cpp1
-rw-r--r--init.hardware.rc13
-rw-r--r--sepolicy/vendor/file.te1
-rw-r--r--sepolicy/vendor/genfs_contexts1
-rw-r--r--sepolicy/vendor/hal_dumpstate_impl.te2
5 files changed, 18 insertions, 0 deletions
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 310f45ad..efcf8bcf 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -185,6 +185,7 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model");
DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev");
DumpFileToFd(fd, "UFS size", "/sys/block/sda/size");
+ RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", "for f in $(find /sys/kernel/debug/ufshcd0 -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; fi; done"});
DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts");
DumpFileToFd(fd, "RPM Stats", "/d/rpm_stats");
DumpFileToFd(fd, "Power Management Stats", "/d/rpm_master_stats");
diff --git a/init.hardware.rc b/init.hardware.rc
index e11430e3..8ab2ba29 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -583,6 +583,19 @@ on property:sys.boot_completed=1
write /dev/cpuset/application/background/cpus 0-1
write /dev/cpuset/application/cpus 0-1,4-5
+ # UFS health
+ chmod 755 /sys/kernel/debug/ufshcd0
+ chown 644 /sys/kernel/debug/ufshcd0/err_state
+ chmod 644 /sys/kernel/debug/ufshcd0/power_mode
+ chmod 644 /sys/kernel/debug/ufshcd0/host_regs
+ chmod 644 /sys/kernel/debug/ufshcd0/show_hba
+ chmod 644 /sys/kernel/debug/ufshcd0/dump_device_desc
+ chmod 644 /sys/kernel/debug/ufshcd0/dump_health_desc
+ chmod 755 /sys/kernel/debug/ufshcd0/stats
+ chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats
+ chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats
+ chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats
+
on property:init.svc.per_mgr=running
start per_proxy
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index fc569b5a..2e41283c 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -27,6 +27,7 @@ type debugfs_usb, debugfs_type, fs_type;
type debugfs_wlan, debugfs_type, fs_type;
type debugfs_mdp, debugfs_type, fs_type;
type debugfs_icnss, debugfs_type, fs_type;
+type debugfs_ufs, debugfs_type, fs_type;
# /proc
type proc_wifi_dbg, fs_type;
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index fae60212..6acbe849 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -85,3 +85,4 @@ genfscon debugfs /msm_ipc_router u:object_r:debugfs_ipc:s0
genfscon debugfs /mdp u:object_r:debugfs_mdp:s0
genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0
genfscon debugfs /icnss u:object_r:debugfs_icnss:s0
+genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0
diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te
index 9512b223..32b875d2 100644
--- a/sepolicy/vendor/hal_dumpstate_impl.te
+++ b/sepolicy/vendor/hal_dumpstate_impl.te
@@ -45,6 +45,8 @@ allow hal_dumpstate_impl debugfs_icnss:dir r_dir_perms;
allow hal_dumpstate_impl debugfs_icnss:file r_file_perms;
allow hal_dumpstate_impl debugfs_ipc:file r_file_perms;
allow hal_dumpstate_impl proc_stat:file r_file_perms;
+allow hal_dumpstate_impl debugfs_ufs:dir r_dir_perms;
+allow hal_dumpstate_impl debugfs_ufs:file r_file_perms;
# Access to files for dumping
allow hal_dumpstate_impl sysfs:dir r_dir_perms;