> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Debug with sysfs or debugfs nodes

To identify the status or update the state, use the `sysfs` and `debugfs` nodes.

Mount `debugfs` to ensure that the `debugfs` file system is accessible for the debug nodes.

```bash theme={null}
mount -t debugfs none /sys/kernel/debug
```

## UFS device state commands

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

## SD card state commands

Before running the SD card state commands, identify the MMC host controller instance# and its physical address.

1. Enumerate MMC Host Controllers.

   ```bash theme={null}
   ls -l /sys/class/mmc_host
   ```

2. Identify the MMC physical address.

   ```bash theme={null}
   readlink -f /sys/class/mmc_host/mmc*
   ```

| 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/<mmc_addr>.mmc/power/runtime_status` |
| Read SD card auto suspend delay time | `cat /sys/devices/platform/soc@0/<mmc_addr>.mmc/power/autosuspend_delay_ms` |
| Read SD card runtime active time | `cat /sys/devices/platform/soc@0/<mmc_addr>.mmc/power/runtime_active_time` |
| Read SD card runtime suspend time | `cat /sys/devices/platform/soc@0/<mmc_addr>.mmc/power/runtime_suspended_time` |
| Read SD card uevent details | `cat /sys/devices/platform/soc@0/<mmc_addr>.mmc/uevent` |

## NVMe state commands

| Required NVMe card state information | Command |
| - | - |
| View device model name | `cat /sys/class/nvme/nvme0/model` |
| View device serial number | `cat /sys/class/nvme/nvme0/serial` |
| View current firmware version | `cat /sys/class/nvme/nvme0/firmware_rev` |
| View namespace identifier | `cat /sys/class/nvme/nvme0/nvme0n1/nsid` |
| View namespace size | `cat /sys/class/nvme/nvme0/nvme0n1/size` |
| View the offset in bytes to align the start of the NVMe namespace to the optimal I/O boundary | `cat /sys/class/nvme/nvme0/nvme0n1/alignment_offset` |
| View queue depth | `cat /sys/class/nvme/nvme0/queue_count` |

## eMMC node commands

| Description | Command |
| - | - |
| eMMC error stats information | `cat /sys/kernel/debug/mmc0/err_stats` |
| eMMC latest error state details | `cat /sys/kernel/debug/mmc0/err_state` |
| Current running clock details of an eMMC | `cat /sys/kernel/debug/mmc0/clock` |
| eMMC runtime status information | `cat /sys/devices/platform/soc@0/<sdhci_addr>.mmc/power/runtime_status` |
| eMMC auto suspend delay time | `cat /sys/devices/platform/soc@0/<sdhci_addr>.mmc/power/autosuspend_delay_ms` |
| eMMC runtime active time | `cat /sys/devices/platform/soc@0/<sdhci_addr>.mmc/power/runtime_active_time` |
| eMMC runtime suspend time | `cat /sys/devices/platform/soc@0/<sdhci_addr>.mmc/power/runtime_suspended_time` |
| eMMC uevent details | `cat /sys/devices/platform/soc@0/<sdhci_addr>.mmc/uevent` |

<Note>
  Update the `<sdhci_address>` values based on the SDHCI physical address of the chip products.

  Example:

  * Qualcomm Dragonwing™ IQ-615: `7c4000`
  * Qualcomm Dragonwing™ IQ-8275: `87c4000`
  * Qualcomm Dragonwing™ IQ-9075: `7c4000`
</Note>
