# Debugging with sysfs or debugfs nodes

There are various sysfs and debugfs nodes that can be used to identify the status or update the state.

debugfs should be mounted using the following command. This command makes the debugfs file system accessible for debug nodes.

mount -t debugfs none /sys/kernel/debug
    Copy to clipboard

**To obtain UFS state information**

| Required UFS state information | Command |
| --- | --- |
| Check PA/DL error count | `cat /sys/kernel/debug/ufshcd/1d84000.ufs/stats` |
| Read UFS gating delay, in ms | `cat /sys/devices/platform/soc@0/1d84000.ufs/clkgate_delay_ms` |
| Read UFS clocks current frequency at given point | `cat /sys/devices/platform/soc@0/1d84000.ufs/devfreq/1d84000.ufs/cur_freq` |
| Read UFS I/O scheduler details | `cat /sys/devices/platform/soc@0/1d84000.ufs/devfreq/1d84000.ufs/governor` |
| Read UFS min frequency during clock scale down | `cat /sys/devices/platform/soc@0/1d84000.ufs/devfreq/1d84000.ufs/min_freq` |
| Read UFS max frequency during clock scale up | `cat /sys/devices/platform/soc@0/1d84000.ufs/devfreq/1d84000.ufs/max_freq` |
| Read UFS device state ACTIVE or SLEEP<br>`cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/dev_pm` | Read UFS device state ACTIVE or SLEEP<br>`cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/dev_pm` |
| Read UFS gear information such as HS\_G3, HS\_G4 | `cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/gear` |
| Read UFS number of lanes | `cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/lane` |
| Read UFS link state, ACTIVE or HIBERN8 | `cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/link_state` |
| Read UFS rate information such as Rate A or B | `cat /sys/devices/platform/soc@0/1d84000.ufs/power_info/rate` |
| Read UFS device descriptor information | `ls /sys/devices/platform/soc@0/1d84000.ufs/device_descriptor` |
| Read UFS health descriptor information | `ls /sys/devices/platform/soc@0/1d84000.ufs/health_descriptor` |
| Read UFS runtime status information active or suspended | `cat /sys/devices/platform/soc@0/1d84000.ufs/power/runtime_status` |
| Find and/or modify the SPM/RPM level | `cat /sys/devices/platform/soc@0/1d84000.ufs/rpm_lvl`<br><br><br>`cat /sys/devices/platform/soc@0/1d84000.ufs/spm_lvl` |

**To obtain SD card state information**

| Required SD card state information | Command |
| --- | --- |
| Read SD card error stats information | `cat /sys/kernel/debug/mmc1/err_stats` |
| Read SD card latest error state details | `cat /sys/kernel/debug/mmc1/err_state` |
| Check the current running clock details | `cat /sys/kernel/debug/mmc1/clock` |
| Read the SD card runtime status information (active or suspended) | `cat /sys/devices/platform/soc@0/8804000.mmc/power/runtime_status` |
| Read SD card auto suspend delay time | `cat /sys/devices/platform/soc@0/8804000.mmc/power/autosuspend_delay_ms` |
| Read SD card runtime active time | `cat /sys/devices/platform/soc@0/8804000.mmc/power/runtime_active_time` |
| Read SD card runtime suspend time | `cat /sys/devices/platform/soc@0/8804000.mmc/power/runtime_suspended_time` |
| Read SD card uevent details | `cat /sys/devices/platform/soc@0/8804000.mmc/uevent` |

Last Published: Oct 02, 2024

[Previous Topic
Debug UFS issues](https://docs.qualcomm.com/bundle/publicresource/80-70015-6/topics/ufs-debugging.md)

Source: [https://docs.qualcomm.com/doc/80-70015-6/topic/ufs-sysfs-debugfs.html](https://docs.qualcomm.com/doc/80-70015-6/topic/ufs-sysfs-debugfs.html)