linux/include/ufs/ufshcd.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Universal Flash Storage Host controller driver
 * Copyright (C) 2011-2013 Samsung India Software Operations
 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 *
 * Authors:
 *	Santosh Yaraganavi <[email protected]>
 *	Vinayak Holikatti <[email protected]>
 */

#ifndef _UFSHCD_H
#define _UFSHCD_H

#include <linux/bitfield.h>
#include <linux/blk-crypto-profile.h>
#include <linux/blk-mq.h>
#include <linux/devfreq.h>
#include <linux/fault-inject.h>
#include <linux/msi.h>
#include <linux/pm_runtime.h>
#include <linux/dma-direction.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <ufs/unipro.h>
#include <ufs/ufs.h>
#include <ufs/ufs_quirks.h>
#include <ufs/ufshci.h>

#define UFSHCD

struct scsi_device;
struct ufs_hba;

enum dev_cmd_type {};

enum ufs_event_type {};

/**
 * struct uic_command - UIC command structure
 * @command: UIC command
 * @argument1: UIC command argument 1
 * @argument2: UIC command argument 2
 * @argument3: UIC command argument 3
 * @cmd_active: Indicate if UIC command is outstanding
 * @done: UIC command completion
 */
struct uic_command {};

/* Used to differentiate the power management options */
enum ufs_pm_op {};

/* Host <-> Device UniPro Link state */
enum uic_link_state {};

#define ufshcd_is_link_off(hba)
#define ufshcd_is_link_active(hba)
#define ufshcd_is_link_hibern8(hba)
#define ufshcd_is_link_broken(hba)
#define ufshcd_set_link_off(hba)
#define ufshcd_set_link_active(hba)
#define ufshcd_set_link_hibern8(hba)
#define ufshcd_set_link_broken(hba)

#define ufshcd_set_ufs_dev_active(h)
#define ufshcd_set_ufs_dev_sleep(h)
#define ufshcd_set_ufs_dev_poweroff(h)
#define ufshcd_set_ufs_dev_deepsleep(h)
#define ufshcd_is_ufs_dev_active(h)
#define ufshcd_is_ufs_dev_sleep(h)
#define ufshcd_is_ufs_dev_poweroff(h)
#define ufshcd_is_ufs_dev_deepsleep(h)

/*
 * UFS Power management levels.
 * Each level is in increasing order of power savings, except DeepSleep
 * which is lower than PowerDown with power on but not PowerDown with
 * power off.
 */
enum ufs_pm_level {};

struct ufs_pm_lvl_states {};

/**
 * struct ufshcd_lrb - local reference block
 * @utr_descriptor_ptr: UTRD address of the command
 * @ucd_req_ptr: UCD address of the command
 * @ucd_rsp_ptr: Response UPIU address for this command
 * @ucd_prdt_ptr: PRDT address of the command
 * @utrd_dma_addr: UTRD dma address for debug
 * @ucd_prdt_dma_addr: PRDT dma address for debug
 * @ucd_rsp_dma_addr: UPIU response dma address for debug
 * @ucd_req_dma_addr: UPIU request dma address for debug
 * @cmd: pointer to SCSI command
 * @scsi_status: SCSI status of the command
 * @command_type: SCSI, UFS, Query.
 * @task_tag: Task tag of the command
 * @lun: LUN of the command
 * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
 * @issue_time_stamp: time stamp for debug purposes (CLOCK_MONOTONIC)
 * @issue_time_stamp_local_clock: time stamp for debug purposes (local_clock)
 * @compl_time_stamp: time stamp for statistics (CLOCK_MONOTONIC)
 * @compl_time_stamp_local_clock: time stamp for debug purposes (local_clock)
 * @crypto_key_slot: the key slot to use for inline crypto (-1 if none)
 * @data_unit_num: the data unit number for the first block for inline crypto
 * @req_abort_skip: skip request abort task flag
 */
struct ufshcd_lrb {};

/**
 * struct ufs_query_req - parameters for building a query request
 * @query_func: UPIU header query function
 * @upiu_req: the query request data
 */
struct ufs_query_req {};

/**
 * struct ufs_query_resp - UPIU QUERY
 * @response: device response code
 * @upiu_res: query response data
 */
struct ufs_query_res {};

/**
 * struct ufs_query - holds relevant data structures for query request
 * @request: request upiu and function
 * @descriptor: buffer for sending/receiving descriptor
 * @response: response upiu and response
 */
struct ufs_query {};

/**
 * struct ufs_dev_cmd - all assosiated fields with device management commands
 * @type: device management command type - Query, NOP OUT
 * @lock: lock to allow one command at a time
 * @complete: internal commands completion
 * @query: Device management query information
 */
struct ufs_dev_cmd {};

/**
 * struct ufs_clk_info - UFS clock related info
 * @list: list headed by hba->clk_list_head
 * @clk: clock node
 * @name: clock name
 * @max_freq: maximum frequency supported by the clock
 * @min_freq: min frequency that can be used for clock scaling
 * @curr_freq: indicates the current frequency that it is set to
 * @keep_link_active: indicates that the clk should not be disabled if
 *		      link is active
 * @enabled: variable to check against multiple enable/disable
 */
struct ufs_clk_info {};

enum ufs_notify_change_status {};

struct ufs_pa_layer_attr {};

struct ufs_pwr_mode_info {};

/**
 * struct ufs_hba_variant_ops - variant specific callbacks
 * @name: variant name
 * @max_num_rtt: maximum RTT supported by the host
 * @init: called when the driver is initialized
 * @exit: called to cleanup everything done in init
 * @get_ufs_hci_version: called to get UFS HCI version
 * @clk_scale_notify: notifies that clks are scaled up/down
 * @setup_clocks: called before touching any of the controller registers
 * @hce_enable_notify: called before and after HCE enable bit is set to allow
 *                     variant specific Uni-Pro initialization.
 * @link_startup_notify: called before and after Link startup is carried out
 *                       to allow variant specific Uni-Pro initialization.
 * @pwr_change_notify: called before and after a power mode change
 *			is carried out to allow vendor spesific capabilities
 *			to be set.
 * @setup_xfer_req: called before any transfer request is issued
 *                  to set some things
 * @setup_task_mgmt: called before any task management request is issued
 *                  to set some things
 * @hibern8_notify: called around hibern8 enter/exit
 * @apply_dev_quirks: called to apply device specific quirks
 * @fixup_dev_quirks: called to modify device specific quirks
 * @suspend: called during host controller PM callback
 * @resume: called during host controller PM callback
 * @dbg_register_dump: used to dump controller debug information
 * @phy_initialization: used to initialize phys
 * @device_reset: called to issue a reset pulse on the UFS device
 * @config_scaling_param: called to configure clock scaling parameters
 * @program_key: program or evict an inline encryption key
 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT
 * @event_notify: called to notify important events
 * @reinit_notify: called to notify reinit of UFSHCD during max gear switch
 * @mcq_config_resource: called to configure MCQ platform resources
 * @get_hba_mac: reports maximum number of outstanding commands supported by
 *	the controller. Should be implemented for UFSHCI 4.0 or later
 *	controllers that are not compliant with the UFSHCI 4.0 specification.
 * @op_runtime_config: called to config Operation and runtime regs Pointers
 * @get_outstanding_cqs: called to get outstanding completion queues
 * @config_esi: called to config Event Specific Interrupt
 * @config_scsi_dev: called to configure SCSI device parameters
 */
struct ufs_hba_variant_ops {};

/* clock gating state  */
enum clk_gating_state {};

/**
 * struct ufs_clk_gating - UFS clock gating related info
 * @gate_work: worker to turn off clocks after some delay as specified in
 * delay_ms
 * @ungate_work: worker to turn on clocks that will be used in case of
 * interrupt context
 * @state: the current clocks state
 * @delay_ms: gating delay in ms
 * @is_suspended: clk gating is suspended when set to 1 which can be used
 * during suspend/resume
 * @delay_attr: sysfs attribute to control delay_attr
 * @enable_attr: sysfs attribute to enable/disable clock gating
 * @is_enabled: Indicates the current status of clock gating
 * @is_initialized: Indicates whether clock gating is initialized or not
 * @active_reqs: number of requests that are pending and should be waited for
 * completion before gating clocks.
 * @clk_gating_workq: workqueue for clock gating work.
 */
struct ufs_clk_gating {};

/**
 * struct ufs_clk_scaling - UFS clock scaling related data
 * @active_reqs: number of requests that are pending. If this is zero when
 * devfreq ->target() function is called then schedule "suspend_work" to
 * suspend devfreq.
 * @tot_busy_t: Total busy time in current polling window
 * @window_start_t: Start time (in jiffies) of the current polling window
 * @busy_start_t: Start time of current busy period
 * @enable_attr: sysfs attribute to enable/disable clock scaling
 * @saved_pwr_info: UFS power mode may also be changed during scaling and this
 * one keeps track of previous power mode.
 * @workq: workqueue to schedule devfreq suspend/resume work
 * @suspend_work: worker to suspend devfreq
 * @resume_work: worker to resume devfreq
 * @target_freq: frequency requested by devfreq framework
 * @min_gear: lowest HS gear to scale down to
 * @is_enabled: tracks if scaling is currently enabled or not, controlled by
 *		clkscale_enable sysfs node
 * @is_allowed: tracks if scaling is currently allowed or not, used to block
 *		clock scaling which is not invoked from devfreq governor
 * @is_initialized: Indicates whether clock scaling is initialized or not
 * @is_busy_started: tracks if busy period has started or not
 * @is_suspended: tracks if devfreq is suspended or not
 */
struct ufs_clk_scaling {};

#define UFS_EVENT_HIST_LENGTH
/**
 * struct ufs_event_hist - keeps history of errors
 * @pos: index to indicate cyclic buffer position
 * @val: cyclic buffer for registers value
 * @tstamp: cyclic buffer for time stamp
 * @cnt: error counter
 */
struct ufs_event_hist {};

/**
 * struct ufs_stats - keeps usage/err statistics
 * @last_intr_status: record the last interrupt status.
 * @last_intr_ts: record the last interrupt timestamp.
 * @hibern8_exit_cnt: Counter to keep track of number of exits,
 *		reset this after link-startup.
 * @last_hibern8_exit_tstamp: Set time after the hibern8 exit.
 *		Clear after the first successful command completion.
 * @event: array with event history.
 */
struct ufs_stats {};

/**
 * enum ufshcd_state - UFS host controller state
 * @UFSHCD_STATE_RESET: Link is not operational. Postpone SCSI command
 *	processing.
 * @UFSHCD_STATE_OPERATIONAL: The host controller is operational and can process
 *	SCSI commands.
 * @UFSHCD_STATE_EH_SCHEDULED_NON_FATAL: The error handler has been scheduled.
 *	SCSI commands may be submitted to the controller.
 * @UFSHCD_STATE_EH_SCHEDULED_FATAL: The error handler has been scheduled. Fail
 *	newly submitted SCSI commands with error code DID_BAD_TARGET.
 * @UFSHCD_STATE_ERROR: An unrecoverable error occurred, e.g. link recovery
 *	failed. Fail all SCSI commands with error code DID_ERROR.
 */
enum ufshcd_state {};

enum ufshcd_quirks {};

enum ufshcd_caps {};

struct ufs_hba_variant_params {};

struct ufs_hba_monitor {};

/**
 * struct ufshcd_res_info_t - MCQ related resource regions
 *
 * @name: resource name
 * @resource: pointer to resource region
 * @base: register base address
 */
struct ufshcd_res_info {};

enum ufshcd_res {};

/**
 * struct ufshcd_mcq_opr_info_t - Operation and Runtime registers
 *
 * @offset: Doorbell Address Offset
 * @stride: Steps proportional to queue [0...31]
 * @base: base address
 */
struct ufshcd_mcq_opr_info_t {};

enum ufshcd_mcq_opr {};

/**
 * struct ufs_hba - per adapter private structure
 * @mmio_base: UFSHCI base register address
 * @ucdl_base_addr: UFS Command Descriptor base address
 * @utrdl_base_addr: UTP Transfer Request Descriptor base address
 * @utmrdl_base_addr: UTP Task Management Descriptor base address
 * @ucdl_dma_addr: UFS Command Descriptor DMA address
 * @utrdl_dma_addr: UTRDL DMA address
 * @utmrdl_dma_addr: UTMRDL DMA address
 * @host: Scsi_Host instance of the driver
 * @dev: device handle
 * @ufs_device_wlun: WLUN that controls the entire UFS device.
 * @hwmon_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_op_in_progress: whether or not a PM operation is in progress.
 * @ahit: value of Auto-Hibernate Idle Timer register.
 * @lrb: local reference block
 * @outstanding_tasks: Bits representing outstanding task requests
 * @outstanding_lock: Protects @outstanding_reqs.
 * @outstanding_reqs: Bits representing outstanding transfer requests
 * @capabilities: UFS Controller Capabilities
 * @mcq_capabilities: UFS Multi Circular Queue capabilities
 * @nutrs: Transfer Request Queue depth supported by controller
 * @nortt - Max outstanding RTTs supported by controller
 * @nutmrs: Task Management Queue depth supported by controller
 * @reserved_slot: Used to submit device commands. Protected by @dev_cmd.lock.
 * @ufs_version: UFS Version to which controller complies
 * @vops: pointer to variant specific operations
 * @vps: pointer to variant specific parameters
 * @priv: pointer to variant specific private data
 * @sg_entry_size: size of struct ufshcd_sg_entry (may include variant fields)
 * @irq: Irq number of the controller
 * @is_irq_enabled: whether or not the UFS controller interrupt is enabled.
 * @dev_ref_clk_freq: reference clock frequency
 * @quirks: 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: handle of active UIC command
 * @uic_cmd_mutex: mutex for UIC command
 * @uic_async_done: completion used during UIC processing
 * @ufshcd_state: UFSHCD state
 * @eh_flags: Error handling flags
 * @intr_mask: Interrupt Mask Bits
 * @ee_ctrl_mask: Exception event control mask
 * @ee_drv_mask: Exception event mask for driver
 * @ee_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 powered
 * @shutting_down: flag to check if shutdown has been invoked
 * @host_sem: semaphore used to serialize concurrent contexts
 * @eh_wq: Workqueue that eh_work works on
 * @eh_work: Worker to handle UFS errors that require s/w attention
 * @eeh_work: Worker to handle exception events
 * @errors: HBA errors
 * @uic_error: UFS interconnect layer error status
 * @saved_err: sticky error mask
 * @saved_uic_err: sticky UIC error mask
 * @ufs_stats: various error counters
 * @force_reset: flag to force eh_work perform a full reset
 * @force_pmc: flag to force a power mode change
 * @silence_err_logs: flag to silence error logs
 * @dev_cmd: ufs device management command information
 * @last_dme_cmd_tstamp: time stamp of the last completed DME command
 * @nop_out_timeout: NOP OUT timeout value
 * @dev_info: information about the UFS device
 * @auto_bkops_enabled: to track whether bkops is enabled in device
 * @vreg_info: UFS device voltage regulator information
 * @clk_list_head: UFS host controller clocks list node head
 * @use_pm_opp: Indicates whether OPP based scaling is used or not
 * @req_abort_count: number of times ufshcd_abort() has been called
 * @lanes_per_direction: number of lanes per data direction between the UFS
 *	controller and the UFS device.
 * @pwr_info: holds current power mode
 * @max_pwr_info: keeps the device max valid pwm
 * @clk_gating: information related to clock gating
 * @caps: bitmask with information about UFS controller capabilities
 * @devfreq: frequency scaling information owned by the devfreq core
 * @clk_scaling: frequency scaling information owned by the UFS driver
 * @system_suspending: system suspend has been started and system resume has
 *	not yet finished.
 * @is_sys_suspended: UFS device has been suspended because of system suspend
 * @urgent_bkops_lvl: keeps track of urgent bkops level for device
 * @is_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 toggling
 * @clk_scaling_lock: used to serialize device commands and clock scaling
 * @desc_size: descriptor sizes reported by device
 * @scsi_block_reqs_cnt: reference counting for scsi block requests
 * @bsg_dev: struct device associated with the BSG queue
 * @bsg_queue: BSG queue associated with the UFS controller
 * @rpm_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 commands
 * @crypto_capabilities: Content of crypto capabilities register (0x100)
 * @crypto_cap_array: Array of crypto capabilities
 * @crypto_cfg_register: Start of the crypto cfg array
 * @crypto_profile: the crypto profile of this hba (if applicable)
 * @debugfs_root: UFS controller debugfs root directory
 * @debugfs_ee_work: used to restore ee_ctrl_mask after a delay
 * @debugfs_ee_rate_limit_ms: user configurable delay after which to restore
 *	ee_ctrl_mask
 * @luns_avail: number of regular and well known LUNs supported by the UFS
 *	device
 * @nr_hw_queues: number of hardware queues configured
 * @nr_queues: number of Queues of different queue types
 * @complete_put: whether or not to call ufshcd_rpm_put() from inside
 *	ufshcd_resume_complete()
 * @ext_iid_sup: is EXT_IID is supported by UFSHC
 * @mcq_sup: is mcq supported by UFSHC
 * @mcq_enabled: is mcq ready to accept requests
 * @res: array of resource info of MCQ registers
 * @mcq_base: Multi circular queue registers base address
 * @uhq: array of supported hardware queues
 * @dev_cmd_queue: Queue for issuing device management commands
 * @mcq_opr: MCQ operation and runtime registers
 * @ufs_rtc_update_work: A work for UFS RTC periodic update
 * @pm_qos_req: PM QoS request handle
 * @pm_qos_enabled: flag to check if pm qos is enabled
 */
struct ufs_hba {};

/**
 * struct ufs_hw_queue - per hardware queue structure
 * @mcq_sq_head: base address of submission queue head pointer
 * @mcq_sq_tail: base address of submission queue tail pointer
 * @mcq_cq_head: base address of completion queue head pointer
 * @mcq_cq_tail: base address of completion queue tail pointer
 * @sqe_base_addr: submission queue entry base address
 * @sqe_dma_addr: submission queue dma address
 * @cqe_base_addr: completion queue base address
 * @cqe_dma_addr: completion queue dma address
 * @max_entries: max number of slots in this hardware queue
 * @id: hardware queue ID
 * @sq_tp_slot: current slot to which SQ tail pointer is pointing
 * @sq_lock: serialize submission queue access
 * @cq_tail_slot: current slot to which CQ tail pointer is pointing
 * @cq_head_slot: current slot to which CQ head pointer is pointing
 * @cq_lock: Synchronize between multiple polling instances
 * @sq_mutex: prevent submission queue concurrent access
 */
struct ufs_hw_queue {};

#define MCQ_QCFG_SIZE

static inline unsigned int ufshcd_mcq_opr_offset(struct ufs_hba *hba,
		enum ufshcd_mcq_opr opr, int idx)
{}

static inline unsigned int ufshcd_mcq_cfg_offset(unsigned int reg, int idx)
{}

#ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE
static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba)
{}

static inline void ufshcd_set_sg_entry_size(struct ufs_hba *hba, size_t sg_entry_size)
{}
#else
static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba)
{
	return sizeof(struct ufshcd_sg_entry);
}

#define ufshcd_set_sg_entry_size
#endif

static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba)
{}

/* Returns true if clocks can be gated. Otherwise false */
static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba)
{}
static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba)
{}
static inline int ufshcd_is_clkscaling_supported(struct ufs_hba *hba)
{}
static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba)
{}
static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba)
{}

static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba)
{}

static inline bool ufshcd_can_aggressive_pc(struct ufs_hba *hba)
{}

static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
{}

static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
{}

static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba)
{}

static inline bool ufshcd_enable_wb_if_scaling_up(struct ufs_hba *hba)
{}

#define ufsmcq_writel(hba, val, reg)
#define ufsmcq_readl(hba, reg)

#define ufsmcq_writelx(hba, val, reg)
#define ufsmcq_readlx(hba, reg)

#define ufshcd_writel(hba, val, reg)
#define ufshcd_readl(hba, reg)

/**
 * ufshcd_rmwl - perform read/modify/write for a controller register
 * @hba: per adapter instance
 * @mask: mask to apply on read value
 * @val: actual value to write
 * @reg: register address
 */
static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
{}

void ufshcd_enable_irq(struct ufs_hba *hba);
void ufshcd_disable_irq(struct ufs_hba *hba);
int ufshcd_alloc_host(struct device *, struct ufs_hba **);
void ufshcd_dealloc_host(struct ufs_hba *);
int ufshcd_hba_enable(struct ufs_hba *hba);
int ufshcd_init(struct ufs_hba *, void __iomem *, unsigned int);
int ufshcd_link_recovery(struct ufs_hba *hba);
int ufshcd_make_hba_operational(struct ufs_hba *hba);
void ufshcd_remove(struct ufs_hba *);
int ufshcd_uic_hibern8_enter(struct ufs_hba *hba);
int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
void ufshcd_delay_us(unsigned long us, unsigned long tolerance);
void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk);
void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val);
void ufshcd_hba_stop(struct ufs_hba *hba);
void ufshcd_schedule_eh_work(struct ufs_hba *hba);
void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
unsigned int ufshcd_mcq_queue_cfg_addr(struct ufs_hba *hba);
u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
					 struct ufs_hw_queue *hwq);
void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
void ufshcd_mcq_enable_esi(struct ufs_hba *hba);
void ufshcd_mcq_enable(struct ufs_hba *hba);
void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg);

int ufshcd_opp_config_clks(struct device *dev, struct opp_table *opp_table,
			   struct dev_pm_opp *opp, void *data,
			   bool scaling_down);
/**
 * ufshcd_set_variant - set variant specific data to the hba
 * @hba: per adapter instance
 * @variant: pointer to variant specific data
 */
static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant)
{}

/**
 * ufshcd_get_variant - get variant specific data from the hba
 * @hba: per adapter instance
 */
static inline void *ufshcd_get_variant(struct ufs_hba *hba)
{}

#ifdef CONFIG_PM
extern int ufshcd_runtime_suspend(struct device *dev);
extern int ufshcd_runtime_resume(struct device *dev);
#endif
#ifdef CONFIG_PM_SLEEP
extern int ufshcd_system_suspend(struct device *dev);
extern int ufshcd_system_resume(struct device *dev);
extern int ufshcd_system_freeze(struct device *dev);
extern int ufshcd_system_thaw(struct device *dev);
extern int ufshcd_system_restore(struct device *dev);
#endif

extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
				      int agreed_gear,
				      int adapt_val);
extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
			       u8 attr_set, u32 mib_val, u8 peer);
extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
			       u32 *mib_val, u8 peer);
extern int ufshcd_config_pwr_mode(struct ufs_hba *hba,
			struct ufs_pa_layer_attr *desired_pwr_mode);
extern int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode);

/* UIC command interfaces for DME primitives */
#define DME_LOCAL
#define DME_PEER
#define ATTR_SET_NOR
#define ATTR_SET_ST

static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel,
				 u32 mib_val)
{}

static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel,
				    u32 mib_val)
{}

static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel,
				      u32 mib_val)
{}

static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel,
					 u32 mib_val)
{}

static inline int ufshcd_dme_get(struct ufs_hba *hba,
				 u32 attr_sel, u32 *mib_val)
{}

static inline int ufshcd_dme_peer_get(struct ufs_hba *hba,
				      u32 attr_sel, u32 *mib_val)
{}

static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info)
{}

static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba)
{}

void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
void ufshcd_fixup_dev_quirks(struct ufs_hba *hba,
			     const struct ufs_dev_quirk *fixups);
#define SD_ASCII_STD
#define SD_RAW
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
			    u8 **buf, bool ascii);

void ufshcd_hold(struct ufs_hba *hba);
void ufshcd_release(struct ufs_hba *hba);

void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value);

int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg);

int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);

int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
				     struct utp_upiu_req *rsp_upiu, struct ufs_ehs *ehs_req,
				     struct ufs_ehs *ehs_rsp, int sg_cnt,
				     struct scatterlist *sg_list, enum dma_data_direction dir);
int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable);
int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable);
int ufshcd_suspend_prepare(struct device *dev);
int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm);
void ufshcd_resume_complete(struct device *dev);
bool ufshcd_is_hba_active(struct ufs_hba *hba);
void ufshcd_pm_qos_init(struct ufs_hba *hba);
void ufshcd_pm_qos_exit(struct ufs_hba *hba);

/* Wrapper functions for safely calling variant operations */
static inline int ufshcd_vops_init(struct ufs_hba *hba)
{}

static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba)
{}

extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];

int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
		     const char *prefix);

int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask);
int ufshcd_write_ee_control(struct ufs_hba *hba);
int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,
			     const u16 *other_mask, u16 set, u16 clr);

#endif /* End of Header */