STRUCT UFS_HBA(9)
β¨ NAME β¨
okay so welcome to struct ufs_hba(9) from the Kernel API Manual, bestie π this is the per adapter private structure β and yes, she is large. Like, main-character-energy large. Not me already being obsessed with how much private state one adapter can hold π«Ά.
πΈ SYNOPSIS πΈ
here's the struct in all its exact, character-for-character glory β code is the one thing we do not remix, periodt:
struct ufs_hba {
void __iomem *mmio_base;
struct utp_transfer_cmd_desc *ucdl_base_addr;
struct utp_transfer_req_desc *utrdl_base_addr;
struct utp_task_req_desc *utmrdl_base_addr;
struct utp_devman_cmd_desc *devman_ucd_base_addr;
dma_addr_t ucdl_dma_addr;
dma_addr_t utrdl_dma_addr;
dma_addr_t utmrdl_dma_addr;
dma_addr_t devman_ucd_dma_addr;
struct Scsi_Host *host;
struct device *dev;
struct scsi_device *ufs_device_wlun;
struct scsi_device *ufs_rpmb_wlun;
#ifdef CONFIG_SCSI_UFS_HWMON;
struct device *hwmon_device;
#endif;
enum ufs_dev_pwr_mode curr_dev_pwr_mode;
enum uic_link_state uic_link_state;
enum ufs_pm_level rpm_lvl;
enum ufs_pm_level spm_lvl;
enum ufs_pm_level pm_lvl_min;
int pm_op_in_progress;
u32 ahit;
unsigned long outstanding_tasks;
spinlock_t outstanding_lock;
unsigned long outstanding_reqs;
u32 capabilities;
int nutrs;
int nortt;
u32 mcq_capabilities;
int nutmrs;
u32 ufs_version;
const struct ufs_hba_variant_ops *vops;
struct ufs_hba_variant_params *vps;
void *priv;
#ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE;
size_t sg_entry_size;
#endif;
unsigned int irq;
bool is_irq_enabled;
enum ufs_ref_clk_freq dev_ref_clk_freq;
unsigned int quirks;
unsigned int dev_quirks;
struct blk_mq_tag_set tmf_tag_set;
struct request_queue *tmf_queue;
struct request **tmf_rqs;
struct uic_command *active_uic_cmd;
struct mutex uic_cmd_mutex;
struct completion *uic_async_done;
enum ufshcd_state ufshcd_state;
u32 eh_flags;
u32 intr_mask;
u16 ee_ctrl_mask;
u16 ee_drv_mask;
u16 ee_usr_mask;
struct mutex ee_ctrl_mutex;
bool is_powered;
bool shutting_down;
struct semaphore host_sem;
struct workqueue_struct *eh_wq;
struct work_struct eh_work;
struct work_struct eeh_work;
u32 errors;
u32 uic_error;
u32 saved_err;
u32 saved_uic_err;
struct ufs_stats ufs_stats;
bool force_reset;
bool silence_err_logs;
struct ufs_dev_cmd dev_cmd;
ktime_t last_dme_cmd_tstamp;
int nop_out_timeout;
struct ufs_dev_info dev_info;
bool auto_bkops_enabled;
struct ufs_vreg_info vreg_info;
struct list_head clk_list_head;
bool use_pm_opp;
int req_abort_count;
u32 lanes_per_direction;
struct ufs_pa_layer_attr pwr_info;
struct ufs_pwr_mode_info max_pwr_info;
struct ufs_clk_gating clk_gating;
u32 caps;
struct devfreq *devfreq;
struct ufs_clk_scaling clk_scaling;
bool is_sys_suspended;
enum bkops_status urgent_bkops_lvl;
bool is_urgent_bkops_lvl_checked;
struct mutex wb_mutex;
struct rw_semaphore clk_scaling_lock;
struct device bsg_dev;
struct request_queue *bsg_queue;
struct delayed_work rpm_dev_flush_recheck_work;
struct ufs_hba_monitor monitor;
#ifdef CONFIG_SCSI_UFS_CRYPTO;
union ufs_crypto_capabilities crypto_capabilities;
union ufs_crypto_cap_entry *crypto_cap_array;
u32 crypto_cfg_register;
struct blk_crypto_profile crypto_profile;
#endif;
#ifdef CONFIG_DEBUG_FS;
struct dentry *debugfs_root;
struct delayed_work debugfs_ee_work;
u32 debugfs_ee_rate_limit_ms;
#endif;
#ifdef CONFIG_SCSI_UFS_FAULT_INJECTION;
struct fault_attr trigger_eh_attr;
struct fault_attr timeout_attr;
#endif;
u32 luns_avail;
unsigned int nr_hw_queues;
unsigned int nr_queues[HCTX_MAX_TYPES];
bool complete_put;
bool scsi_host_added;
bool mcq_sup;
bool lsdb_sup;
bool mcq_enabled;
bool mcq_esi_enabled;
void __iomem *mcq_base;
struct ufs_hw_queue *uhq;
struct ufshcd_mcq_opr_info_t mcq_opr[OPR_MAX];
struct delayed_work ufs_rtc_update_work;
struct pm_qos_request pm_qos_req;
bool pm_qos_enabled;
struct mutex pm_qos_mutex;
int critical_health_count;
atomic_t dev_lvl_exception_count;
u64 dev_lvl_exception_id;
atomic_t dme_qos_notification;
struct kernfs_node *dme_qos_sysfs_handle;
u32 vcc_off_delay_us;
struct list_head rpmbs;
u8 host_preshoot_cap;
u8 host_deemphasis_cap;
u8 device_preshoot_cap;
u8 device_deemphasis_cap;
struct ufshcd_tx_eq_params tx_eq_params[UFS_HS_GEAR_MAX];
};
β¨ Members β¨
okay bestie, deep breath β this is the big one. every single field of struct ufs_hba, in order, no skips, no shortcuts. it's a lot but you're gonna eat π
mmio_baseβ UFSHCI base register address. the front door of the whole controller πucdl_base_addrβ UFS Command Descriptor base addressutrdl_base_addrβ UTP Transfer Request Descriptor base addressutmrdl_base_addrβ UTP Task Management Descriptor base addressdevman_ucd_base_addrβ UFS Command Descriptor base address for the reserved device management tag (has a larger response area) πucdl_dma_addrβ UFS Command Descriptor DMA addressutrdl_dma_addrβ UTRDL DMA addressutmrdl_dma_addrβ UTMRDL DMA addressdevman_ucd_dma_addrβ UFS Command Descriptor DMA address for the reserved device management taghostβ Scsi_Host instance of the driverdevβ device handleufs_device_wlunβ WLUN that controls the entire UFS device. main character WLUN ngl πufs_rpmb_wlunβ RPMB WLUN SCSI devicehwmon_deviceβ device instance registered with the hwmon core.curr_dev_pwr_modeβ active UFS device power mode.uic_link_stateβ active state of the link to the UFS device.rpm_lvlβ desired UFS power management level during runtime PM.spm_lvlβ desired UFS power management level during system PM.pm_lvl_minβ minimum supported power management level.pm_op_in_progressβ whether or not a PM operation is in progress.ahitβ value of Auto-Hibernate Idle Timer register.outstanding_tasksβ Bits representing outstanding task requestsoutstanding_lockβ Protects outstanding_reqs.outstanding_reqsβ Bits representing outstanding transfer requestscapabilitiesβ UFS Controller Capabilitiesnutrsβ Transfer Request Queue depth supported by controllernorttβ Max outstanding RTTs supported by controllermcq_capabilitiesβ UFS Multi Circular Queue capabilitiesnutmrsβ Task Management Queue depth supported by controllerufs_versionβ UFS Version to which controller compliesvopsβ pointer to variant specific operationsvpsβ pointer to variant specific parametersprivβ pointer to variant specific private datasg_entry_sizeβ size of struct ufshcd_sg_entry (may include variant fields)irqβ Irq number of the controlleris_irq_enabledβ whether or not the UFS controller interrupt is enabled.dev_ref_clk_freqβ reference clock frequencyquirksβ bitmask with information about deviations from the UFSHCI standard.dev_quirksβ bitmask with information about deviations from the UFS standard.tmf_tag_setβ TMF tag set.tmf_queueβ Used to allocate TMF tags.tmf_rqsβ array with pointers to TMF requests while these are in progress.active_uic_cmdβ pointer to active UIC command.uic_cmd_mutexβ mutex used for serializing UIC command processing.uic_async_doneβ completion used to wait for power mode or hibernation state changes.ufshcd_stateβ UFSHCD stateeh_flagsβ Error handling flagsintr_maskβ Interrupt Mask Bitsee_ctrl_maskβ Exception event control maskee_drv_maskβ Exception event mask for driveree_usr_maskβ Exception event mask for user (set via debugfs)ee_ctrl_mutexβ Used to serialize exception event information.is_poweredβ flag to check if HBA is poweredshutting_downβ flag to check if shutdown has been invokedhost_semβ semaphore used to serialize concurrent contextseh_wqβ Workqueue that eh_work works oneh_workβ Worker to handle UFS errors that require s/w attentioneeh_workβ Worker to handle exception eventserrorsβ HBA errorsuic_errorβ UFS interconnect layer error statussaved_errβ sticky error masksaved_uic_errβ sticky UIC error maskufs_statsβ various error countersforce_resetβ flag to force eh_work perform a full resetsilence_err_logsβ flag to silence error logs π€«dev_cmdβ ufs device management command informationlast_dme_cmd_tstampβ time stamp of the last completed DME commandnop_out_timeoutβ NOP OUT timeout valuedev_infoβ information about the UFS deviceauto_bkops_enabledβ to track whether bkops is enabled in devicevreg_infoβ UFS device voltage regulator informationclk_list_headβ UFS host controller clocks list node headuse_pm_oppβ Indicates whether OPP based scaling is used or notreq_abort_countβ number of times ufshcd_abort has been calledlanes_per_directionβ number of lanes per data direction between the UFS controller and the UFS device.pwr_infoβ holds current power modemax_pwr_infoβ keeps the device max valid pwmclk_gatingβ information related to clock gatingcapsβ bitmask with information about UFS controller capabilitiesdevfreqβ frequency scaling information owned by the devfreq coreclk_scalingβ frequency scaling information owned by the UFS driveris_sys_suspendedβ UFS device has been suspended because of system suspendurgent_bkops_lvlβ keeps track of urgent bkops level for deviceis_urgent_bkops_lvl_checkedβ keeps track if the urgent bkops level for device is known or not.wb_mutexβ used to serialize devfreq and sysfs write booster togglingclk_scaling_lockβ used to serialize device commands and clock scalingbsg_devβ struct device associated with the BSG queuebsg_queueβ BSG queue associated with the UFS controllerrpm_dev_flush_recheck_workβ used to suspend from RPM (runtime power management) after the UFS device has finished a WriteBooster buffer flush or auto BKOP.monitorβ statistics about UFS commandscrypto_capabilitiesβ Content of crypto capabilities register (0x100)crypto_cap_arrayβ Array of crypto capabilitiescrypto_cfg_registerβ Start of the crypto cfg arraycrypto_profileβ the crypto profile of this hba (if applicable)debugfs_rootβ UFS controller debugfs root directorydebugfs_ee_workβ used to restore ee_ctrl_mask after a delaydebugfs_ee_rate_limit_msβ user configurable delay after which to restore ee_ctrl_masktrigger_eh_attrβ fault attributes for the fault injection trigger EHtimeout_attrβ fault attributes for the timeout fault injection triggerluns_availβ number of regular and well known LUNs supported by the UFS devicenr_hw_queuesβ number of hardware queues configurednr_queuesβ number of Queues of different queue typescomplete_putβ whether or not to call ufshcd_rpm_put from inside ufshcd_resume_completescsi_host_addedβ indicates that scsi_add_host has been calledmcq_supβ is mcq supported by UFSHClsdb_supβ LSDBS capabilitymcq_enabledβ is mcq ready to accept requestsmcq_esi_enabledβ is mcq ESI configuredmcq_baseβ Multi circular queue registers base addressuhqβ array of supported hardware queuesmcq_oprβ MCQ operation and runtime registersufs_rtc_update_workβ A work for UFS RTC periodic updatepm_qos_reqβ PM QoS request handlepm_qos_enabledβ flag to check if pm qos is enabledpm_qos_mutexβ synchronizes PM QoS request and status updatescritical_health_countβ count of critical health exceptionsdev_lvl_exception_countβ count of device level exceptions since last resetdev_lvl_exception_idβ vendor specific information about the device level exception event.dme_qos_notificationβ Bitfield of pending DME Quality of Service (QoS) events. Bits[3:1] reflect the corresponding bits of UIC DME Error Code field within the Host Controller's UECDME register. Bit[0] is a flag indicating that the DME QoS Monitor has been reset by the host.dme_qos_sysfs_handleβ handle for 'dme_qos_notification' sysfs entryvcc_off_delay_usβ length of delay after VCC is powered offrpmbsβ list of OP-TEE RPMB devices (one per RPMB region)host_preshoot_capβ a bitfield to indicate supported PreShoot dBs of host's TX lanes, cache of host M-PHY TX_HS_PreShoot_Setting_Capability Attribute (ID 0x15)host_deemphasis_capβ a bitfield to indicate supported DeEmphasis dBs of host's TX lanes, cache of host M-PHY TX_HS_DeEmphasis_Setting_Capability Attribute (ID 0x12)device_preshoot_capβ a bitfield to indicate supported PreShoot dBs of device's TX lanes, cache of device M-PHY TX_HS_PreShoot_Setting_Capability Attribute (ID 0x15)device_deemphasis_capβ a bitfield to indicate supported DeEmphasis dBs of device's TX lanes, cache of device M-PHY TX_HS_DeEmphasis_Setting_Capability Attribute (ID 0x12)tx_eq_paramsβ TX Equalization settings
and that's the whole roster, bestie. every field accounted for, not a single one left on read π«Ά
π SEE ALSO π
the whole friend group, all in Kernel file ./include/ufs/ufshcd.h:
struct uic_command(9), struct ufshcd_lrb(9), struct ufs_query_req(9), struct ufs_query_res(9), struct ufs_query(9), struct ufs_dev_cmd(9), struct ufs_clk_info(9), struct tx_eqtr_iter(9), struct ufshcd_tx_eq_settings(9), struct ufshcd_tx_eqtr_data(9), struct ufshcd_tx_eqtr_record(9), struct ufshcd_tx_eq_params(9), struct ufs_hba_variant_ops(9), struct ufs_clk_gating(9), struct ufs_clk_scaling(9), struct ufs_event_hist(9), struct ufs_stats(9), enum ufshcd_state(9), enum ufshcd_pmc_policy(9), struct ufshcd_mcq_opr_info_t(9), struct ufs_hw_queue(9), ufshcd_rmwl(9), ufshcd_set_variant(9), ufshcd_get_variant(9)
that's the page, babes β¨ it lives in ./include/ufs, it's the October 2026 edition of struct ufs_hba(9) β go forth and slay your UFS driver debugging π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms