summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-03-26 19:57:34 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-03-26 19:57:34 -0700
commit2e3fcbcc3b0eb9b96d2912cdac920f0ae8d1c8f2 (patch)
treeffe2151148277118c5e91830532ec4a5157a6fac /include
parent22093997ac9220d3c606313efbf4ce564962d095 (diff)
parent8db816c6f176321e42254badd5c1a8df8bfcfdb4 (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "Updates to the usual drivers (scsi_debug, ufs, lpfc, st, fnic, mpi3mr, mpt3sas) and the removal of cxlflash. The only non-trivial core change is an addition to unit attention handling to recognize UAs for power on/reset and new media so the tape driver can use it" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (107 commits) scsi: st: Tighten the page format heuristics with MODE SELECT scsi: st: ERASE does not change tape location scsi: st: Fix array overflow in st_setup() scsi: target: tcm_loop: Fix wrong abort tag scsi: lpfc: Restore clearing of NLP_UNREG_INP in ndlp->nlp_flag scsi: hisi_sas: Fixed failure to issue vendor specific commands scsi: fnic: Remove unnecessary NUL-terminations scsi: fnic: Remove redundant flush_workqueue() calls scsi: core: Use a switch statement when attaching VPD pages scsi: ufs: renesas: Add initialization code for R-Car S4-8 ES1.2 scsi: ufs: renesas: Add reusable functions scsi: ufs: renesas: Refactor 0x10ad/0x10af PHY settings scsi: ufs: renesas: Remove register control helper function scsi: ufs: renesas: Add register read to remove save/set/restore scsi: ufs: renesas: Replace init data by init code scsi: ufs: dt-bindings: renesas,ufs: Add calibration data scsi: mpi3mr: Task Abort EH Support scsi: storvsc: Don't report the host packet status as the hv status scsi: isci: Make most module parameters static scsi: megaraid_sas: Make most module parameters static ...
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libiscsi_tcp.h16
-rw-r--r--include/scsi/scsi_device.h9
-rw-r--r--include/scsi/scsi_proto.h4
-rw-r--r--include/trace/events/scsi.h4
-rw-r--r--include/trace/events/target.h4
-rw-r--r--include/uapi/scsi/cxlflash_ioctl.h276
-rw-r--r--include/ufs/ufs.h1
-rw-r--r--include/ufs/ufshcd.h22
8 files changed, 38 insertions, 298 deletions
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 7c8ba9d7378b..ef53d4bea28a 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -15,7 +15,6 @@
struct iscsi_tcp_conn;
struct iscsi_segment;
struct sk_buff;
-struct ahash_request;
typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *,
struct iscsi_segment *);
@@ -27,7 +26,7 @@ struct iscsi_segment {
unsigned int total_size;
unsigned int total_copied;
- struct ahash_request *hash;
+ u32 *crcp;
unsigned char padbuf[ISCSI_PAD_LEN];
unsigned char recv_digest[ISCSI_DIGEST_SIZE];
unsigned char digest[ISCSI_DIGEST_SIZE];
@@ -61,8 +60,8 @@ struct iscsi_tcp_conn {
* stop to terminate */
/* control data */
struct iscsi_tcp_recv in; /* TCP receive context */
- /* CRC32C (Rx) LLD should set this is they do not offload */
- struct ahash_request *rx_hash;
+ /* CRC32C (Rx) LLD should set this if they do not offload */
+ u32 *rx_crcp;
};
struct iscsi_tcp_task {
@@ -99,18 +98,15 @@ extern void iscsi_tcp_segment_unmap(struct iscsi_segment *segment);
extern void iscsi_segment_init_linear(struct iscsi_segment *segment,
void *data, size_t size,
- iscsi_segment_done_fn_t *done,
- struct ahash_request *hash);
+ iscsi_segment_done_fn_t *done, u32 *crcp);
extern int
iscsi_segment_seek_sg(struct iscsi_segment *segment,
struct scatterlist *sg_list, unsigned int sg_count,
unsigned int offset, size_t size,
- iscsi_segment_done_fn_t *done,
- struct ahash_request *hash);
+ iscsi_segment_done_fn_t *done, u32 *crcp);
/* digest helpers */
-extern void iscsi_tcp_dgst_header(struct ahash_request *hash, const void *hdr,
- size_t hdrlen,
+extern void iscsi_tcp_dgst_header(const void *hdr, size_t hdrlen,
unsigned char digest[ISCSI_DIGEST_SIZE]);
extern struct iscsi_cls_conn *
iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size,
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 7acd0ec82bb0..68dd49947d04 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -247,6 +247,9 @@ struct scsi_device {
unsigned int queue_stopped; /* request queue is quiesced */
bool offline_already; /* Device offline message logged */
+ unsigned int ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */
+ unsigned int ua_por_ctr; /* Counter for Power On / Reset UAs */
+
atomic_t disk_events_disable_depth; /* disable depth for disk events */
DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
@@ -684,6 +687,12 @@ static inline int scsi_device_busy(struct scsi_device *sdev)
return sbitmap_weight(&sdev->budget_map);
}
+/* Macros to access the UNIT ATTENTION counters */
+#define scsi_get_ua_new_media_ctr(sdev) \
+ ((const unsigned int)(sdev->ua_new_media_ctr))
+#define scsi_get_ua_por_ctr(sdev) \
+ ((const unsigned int)(sdev->ua_por_ctr))
+
#define MODULE_ALIAS_SCSI_DEVICE(type) \
MODULE_ALIAS("scsi:t-" __stringify(type) "*")
#define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"
diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
index 70e1262b2e20..aeca37816506 100644
--- a/include/scsi/scsi_proto.h
+++ b/include/scsi/scsi_proto.h
@@ -33,8 +33,8 @@
#define INQUIRY 0x12
#define RECOVER_BUFFERED_DATA 0x14
#define MODE_SELECT 0x15
-#define RESERVE 0x16
-#define RELEASE 0x17
+#define RESERVE_6 0x16
+#define RELEASE_6 0x17
#define COPY 0x18
#define ERASE 0x19
#define MODE_SENSE 0x1a
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index 05f1945ed204..bf6cc98d9122 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -29,8 +29,8 @@
scsi_opcode_name(INQUIRY), \
scsi_opcode_name(RECOVER_BUFFERED_DATA), \
scsi_opcode_name(MODE_SELECT), \
- scsi_opcode_name(RESERVE), \
- scsi_opcode_name(RELEASE), \
+ scsi_opcode_name(RESERVE_6), \
+ scsi_opcode_name(RELEASE_6), \
scsi_opcode_name(COPY), \
scsi_opcode_name(ERASE), \
scsi_opcode_name(MODE_SENSE), \
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
index a13cbf2b3405..7e2e20ba26f1 100644
--- a/include/trace/events/target.h
+++ b/include/trace/events/target.h
@@ -31,8 +31,8 @@
scsi_opcode_name(INQUIRY), \
scsi_opcode_name(RECOVER_BUFFERED_DATA), \
scsi_opcode_name(MODE_SELECT), \
- scsi_opcode_name(RESERVE), \
- scsi_opcode_name(RELEASE), \
+ scsi_opcode_name(RESERVE_6), \
+ scsi_opcode_name(RELEASE_6), \
scsi_opcode_name(COPY), \
scsi_opcode_name(ERASE), \
scsi_opcode_name(MODE_SENSE), \
diff --git a/include/uapi/scsi/cxlflash_ioctl.h b/include/uapi/scsi/cxlflash_ioctl.h
deleted file mode 100644
index 513da47aa5ab..000000000000
--- a/include/uapi/scsi/cxlflash_ioctl.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
-/*
- * CXL Flash Device Driver
- *
- * Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation
- * Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
- *
- * Copyright (C) 2015 IBM Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _CXLFLASH_IOCTL_H
-#define _CXLFLASH_IOCTL_H
-
-#include <linux/types.h>
-
-/*
- * Structure and definitions for all CXL Flash ioctls
- */
-#define CXLFLASH_WWID_LEN 16
-
-/*
- * Structure and flag definitions CXL Flash superpipe ioctls
- */
-
-#define DK_CXLFLASH_VERSION_0 0
-
-struct dk_cxlflash_hdr {
- __u16 version; /* Version data */
- __u16 rsvd[3]; /* Reserved for future use */
- __u64 flags; /* Input flags */
- __u64 return_flags; /* Returned flags */
-};
-
-/*
- * Return flag definitions available to all superpipe ioctls
- *
- * Similar to the input flags, these are grown from the bottom-up with the
- * intention that ioctl-specific return flag definitions would grow from the
- * top-down, allowing the two sets to co-exist. While not required/enforced
- * at this time, this provides future flexibility.
- */
-#define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL
-#define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL
-#define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL
-
-/*
- * General Notes:
- * -------------
- * The 'context_id' field of all ioctl structures contains the context
- * identifier for a context in the lower 32-bits (upper 32-bits are not
- * to be used when identifying a context to the AFU). That said, the value
- * in its entirety (all 64-bits) is to be treated as an opaque cookie and
- * should be presented as such when issuing ioctls.
- */
-
-/*
- * DK_CXLFLASH_ATTACH Notes:
- * ------------------------
- * Read/write access permissions are specified via the O_RDONLY, O_WRONLY,
- * and O_RDWR flags defined in the fcntl.h header file.
- *
- * A valid adapter file descriptor (fd >= 0) is only returned on the initial
- * attach (successful) of a context. When a context is shared(reused), the user
- * is expected to already 'know' the adapter file descriptor associated with the
- * context.
- */
-#define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL
-
-struct dk_cxlflash_attach {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 num_interrupts; /* Requested number of interrupts */
- __u64 context_id; /* Returned context */
- __u64 mmio_size; /* Returned size of MMIO area */
- __u64 block_size; /* Returned block size, in bytes */
- __u64 adap_fd; /* Returned adapter file descriptor */
- __u64 last_lba; /* Returned last LBA on the device */
- __u64 max_xfer; /* Returned max transfer size, blocks */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-struct dk_cxlflash_detach {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context to detach */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-struct dk_cxlflash_udirect {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context to own physical resources */
- __u64 rsrc_handle; /* Returned resource handle */
- __u64 last_lba; /* Returned last LBA on the device */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-#define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL
-
-struct dk_cxlflash_uvirtual {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context to own virtual resources */
- __u64 lun_size; /* Requested size, in 4K blocks */
- __u64 rsrc_handle; /* Returned resource handle */
- __u64 last_lba; /* Returned last LBA of LUN */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-struct dk_cxlflash_release {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context owning resources */
- __u64 rsrc_handle; /* Resource handle to release */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-struct dk_cxlflash_resize {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context owning resources */
- __u64 rsrc_handle; /* Resource handle of LUN to resize */
- __u64 req_size; /* New requested size, in 4K blocks */
- __u64 last_lba; /* Returned last LBA of LUN */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-struct dk_cxlflash_clone {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id_src; /* Context to clone from */
- __u64 context_id_dst; /* Context to clone to */
- __u64 adap_fd_src; /* Source context adapter fd */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-#define DK_CXLFLASH_VERIFY_SENSE_LEN 18
-#define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL
-
-struct dk_cxlflash_verify {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 context_id; /* Context owning resources to verify */
- __u64 rsrc_handle; /* Resource handle of LUN */
- __u64 hint; /* Reasons for verify */
- __u64 last_lba; /* Returned last LBA of device */
- __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN]; /* SCSI sense data */
- __u8 pad[6]; /* Pad to next 8-byte boundary */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-#define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL
-
-struct dk_cxlflash_recover_afu {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u64 reason; /* Reason for recovery request */
- __u64 context_id; /* Context to recover / updated ID */
- __u64 mmio_size; /* Returned size of MMIO area */
- __u64 adap_fd; /* Returned adapter file descriptor */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-#define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN
-#define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL
-#define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL
-#define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL
-
-struct dk_cxlflash_manage_lun {
- struct dk_cxlflash_hdr hdr; /* Common fields */
- __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN]; /* Page83 WWID, NAA-6 */
- __u64 reserved[8]; /* Rsvd, future use */
-};
-
-union cxlflash_ioctls {
- struct dk_cxlflash_attach attach;
- struct dk_cxlflash_detach detach;
- struct dk_cxlflash_udirect udirect;
- struct dk_cxlflash_uvirtual uvirtual;
- struct dk_cxlflash_release release;
- struct dk_cxlflash_resize resize;
- struct dk_cxlflash_clone clone;
- struct dk_cxlflash_verify verify;
- struct dk_cxlflash_recover_afu recover_afu;
- struct dk_cxlflash_manage_lun manage_lun;
-};
-
-#define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls))
-
-#define CXL_MAGIC 0xCA
-#define CXL_IOWR(_n, _s) _IOWR(CXL_MAGIC, _n, struct _s)
-
-/*
- * CXL Flash superpipe ioctls start at base of the reserved CXL_MAGIC
- * region (0x80) and grow upwards.
- */
-#define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach)
-#define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect)
-#define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release)
-#define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach)
-#define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify)
-#define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu)
-#define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun)
-#define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual)
-#define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize)
-#define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone)
-
-/*
- * Structure and flag definitions CXL Flash host ioctls
- */
-
-#define HT_CXLFLASH_VERSION_0 0
-
-struct ht_cxlflash_hdr {
- __u16 version; /* Version data */
- __u16 subcmd; /* Sub-command */
- __u16 rsvd[2]; /* Reserved for future use */
- __u64 flags; /* Input flags */
- __u64 return_flags; /* Returned flags */
-};
-
-/*
- * Input flag definitions available to all host ioctls
- *
- * These are grown from the bottom-up with the intention that ioctl-specific
- * input flag definitions would grow from the top-down, allowing the two sets
- * to co-exist. While not required/enforced at this time, this provides future
- * flexibility.
- */
-#define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL
-#define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL
-
-#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001
-#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002
-#define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003
-
-struct ht_cxlflash_lun_provision {
- struct ht_cxlflash_hdr hdr; /* Common fields */
- __u16 port; /* Target port for provision request */
- __u16 reserved16[3]; /* Reserved for future use */
- __u64 size; /* Size of LUN (4K blocks) */
- __u64 lun_id; /* SCSI LUN ID */
- __u8 wwid[CXLFLASH_WWID_LEN];/* Page83 WWID, NAA-6 */
- __u64 max_num_luns; /* Maximum number of LUNs provisioned */
- __u64 cur_num_luns; /* Current number of LUNs provisioned */
- __u64 max_cap_port; /* Total capacity for port (4K blocks) */
- __u64 cur_cap_port; /* Current capacity for port (4K blocks) */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-#define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144 /* 256K */
-#define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12
-struct ht_cxlflash_afu_debug {
- struct ht_cxlflash_hdr hdr; /* Common fields */
- __u8 reserved8[4]; /* Reserved for future use */
- __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN]; /* AFU subcommand,
- * (pass through)
- */
- __u64 data_ea; /* Data buffer effective address */
- __u32 data_len; /* Data buffer length */
- __u32 reserved32; /* Reserved for future use */
- __u64 reserved[8]; /* Reserved for future use */
-};
-
-union cxlflash_ht_ioctls {
- struct ht_cxlflash_lun_provision lun_provision;
- struct ht_cxlflash_afu_debug afu_debug;
-};
-
-#define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls))
-
-/*
- * CXL Flash host ioctls start at the top of the reserved CXL_MAGIC
- * region (0xBF) and grow downwards.
- */
-#define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision)
-#define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug)
-
-
-#endif /* ifndef _CXLFLASH_IOCTL_H */
diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
index f151feb0ca8c..8a24ed59ec46 100644
--- a/include/ufs/ufs.h
+++ b/include/ufs/ufs.h
@@ -419,6 +419,7 @@ enum {
MASK_EE_TOO_LOW_TEMP = BIT(4),
MASK_EE_WRITEBOOSTER_EVENT = BIT(5),
MASK_EE_PERFORMANCE_THROTTLING = BIT(6),
+ MASK_EE_HEALTH_CRITICAL = BIT(9),
};
#define MASK_EE_URGENT_TEMP (MASK_EE_TOO_HIGH_TEMP | MASK_EE_TOO_LOW_TEMP)
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 8bf31e6ca4e5..e3909cc691b2 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -336,6 +336,7 @@ struct ufs_pwr_mode_info {
* @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
+ * @freq_to_gear_speed: called to map clock frequency to the max supported gear speed
*/
struct ufs_hba_variant_ops {
const char *name;
@@ -344,8 +345,8 @@ struct ufs_hba_variant_ops {
void (*exit)(struct ufs_hba *);
u32 (*get_ufs_hci_version)(struct ufs_hba *);
int (*set_dma_mask)(struct ufs_hba *);
- int (*clk_scale_notify)(struct ufs_hba *, bool,
- enum ufs_notify_change_status);
+ int (*clk_scale_notify)(struct ufs_hba *, bool, unsigned long,
+ enum ufs_notify_change_status);
int (*setup_clocks)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
int (*hce_enable_notify)(struct ufs_hba *,
@@ -353,9 +354,9 @@ struct ufs_hba_variant_ops {
int (*link_startup_notify)(struct ufs_hba *,
enum ufs_notify_change_status);
int (*pwr_change_notify)(struct ufs_hba *,
- enum ufs_notify_change_status status,
- struct ufs_pa_layer_attr *desired_pwr_mode,
- struct ufs_pa_layer_attr *final_params);
+ enum ufs_notify_change_status status,
+ const struct ufs_pa_layer_attr *desired_pwr_mode,
+ struct ufs_pa_layer_attr *final_params);
void (*setup_xfer_req)(struct ufs_hba *hba, int tag,
bool is_scsi_cmd);
void (*setup_task_mgmt)(struct ufs_hba *, int, u8);
@@ -384,6 +385,7 @@ struct ufs_hba_variant_ops {
unsigned long *ocqs);
int (*config_esi)(struct ufs_hba *hba);
void (*config_scsi_dev)(struct scsi_device *sdev);
+ u32 (*freq_to_gear_speed)(struct ufs_hba *hba, unsigned long freq);
};
/* clock gating state */
@@ -448,6 +450,8 @@ struct ufs_clk_gating {
* one keeps track of previous power mode.
* @target_freq: frequency requested by devfreq framework
* @min_gear: lowest HS gear to scale down to
+ * @wb_gear: enable Write Booster when HS gear scales above or equal to it, else
+ * disable Write Booster
* @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
@@ -471,6 +475,7 @@ struct ufs_clk_scaling {
struct ufs_pa_layer_attr saved_pwr_info;
unsigned long target_freq;
u32 min_gear;
+ u32 wb_gear;
bool is_enabled;
bool is_allowed;
bool is_initialized;
@@ -962,6 +967,7 @@ enum ufshcd_mcq_opr {
* @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
+ * @critical_health_count: count of critical health exceptions
*/
struct ufs_hba {
void __iomem *mmio_base;
@@ -1130,6 +1136,8 @@ struct ufs_hba {
struct delayed_work ufs_rtc_update_work;
struct pm_qos_request pm_qos_req;
bool pm_qos_enabled;
+
+ int critical_health_count;
};
/**
@@ -1368,6 +1376,8 @@ extern int ufshcd_system_thaw(struct device *dev);
extern int ufshcd_system_restore(struct device *dev);
#endif
+extern int ufshcd_dme_reset(struct ufs_hba *hba);
+extern int ufshcd_dme_enable(struct ufs_hba *hba);
extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
int agreed_gear,
int adapt_val);
@@ -1425,7 +1435,7 @@ static inline int ufshcd_dme_peer_get(struct ufs_hba *hba,
return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER);
}
-static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info)
+static inline bool ufshcd_is_hs_mode(const struct ufs_pa_layer_attr *pwr_info)
{
return (pwr_info->pwr_rx == FAST_MODE ||
pwr_info->pwr_rx == FASTAUTO_MODE) &&