From 297b60346df8beafee954a0fd7c2d64f33f3b9bc Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 11 May 2024 01:44:05 +0000
Subject: [PATCH] rtl8211F_led_control
---
kernel/include/scsi/scsi_host.h | 134 +++++++++++++++++++-------------------------
1 files changed, 59 insertions(+), 75 deletions(-)
diff --git a/kernel/include/scsi/scsi_host.h b/kernel/include/scsi/scsi_host.h
index 0c750a8..8c0d37f 100644
--- a/kernel/include/scsi/scsi_host.h
+++ b/kernel/include/scsi/scsi_host.h
@@ -12,7 +12,6 @@
#include <scsi/scsi.h>
#include <linux/android_kabi.h>
-struct request_queue;
struct block_device;
struct completion;
struct module;
@@ -23,30 +22,13 @@
struct Scsi_Host;
struct scsi_host_cmd_pool;
struct scsi_transport_template;
-struct blk_queue_tags;
-/*
- * The various choices mean:
- * NONE: Self evident. Host adapter is not capable of scatter-gather.
- * ALL: Means that the host adapter module can do scatter-gather,
- * and that there is no limit to the size of the table to which
- * we scatter/gather data. The value we set here is the maximum
- * single element sglist. To use chained sglists, the adapter
- * has to set a value beyond ALL (and correctly use the chain
- * handling API.
- * Anything else: Indicates the maximum number of chains that can be
- * used in one scatter-gather request.
- */
-#define SG_NONE 0
#define SG_ALL SG_CHUNK_SIZE
#define MODE_UNKNOWN 0x00
#define MODE_INITIATOR 0x01
#define MODE_TARGET 0x02
-
-#define DISABLE_CLUSTERING 0
-#define ENABLE_CLUSTERING 1
struct scsi_host_template {
struct module *module;
@@ -66,7 +48,8 @@
*
* Status: OPTIONAL
*/
- int (* ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+ int (*ioctl)(struct scsi_device *dev, unsigned int cmd,
+ void __user *arg);
#ifdef CONFIG_COMPAT
@@ -76,16 +59,22 @@
*
* Status: OPTIONAL
*/
- int (* compat_ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+ int (*compat_ioctl)(struct scsi_device *dev, unsigned int cmd,
+ void __user *arg);
#endif
+
+ int (*init_cmd_priv)(struct Scsi_Host *shost, struct scsi_cmnd *cmd);
+ int (*exit_cmd_priv)(struct Scsi_Host *shost, struct scsi_cmnd *cmd);
/*
* The queuecommand function is used to queue up a scsi
* command block to the LLDD. When the driver finished
* processing the command the done callback is invoked.
*
- * If queuecommand returns 0, then the HBA has accepted the
- * command. The done() function must be called on the command
+ * If queuecommand returns 0, then the driver has accepted the
+ * command. It must also push it to the HBA if the scsi_cmnd
+ * flag SCMD_LAST is set, or if the driver does not implement
+ * commit_rqs. The done() function must be called on the command
* when the driver has finished with it. (you may call done on the
* command before queuecommand returns, but in this case you
* *must* return 0 from queuecommand).
@@ -112,6 +101,16 @@
* STATUS: REQUIRED
*/
int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *);
+
+ /*
+ * The commit_rqs function is used to trigger a hardware
+ * doorbell after some requests have been queued with
+ * queuecommand, when an error is encountered before sending
+ * the request with SCMD_LAST set.
+ *
+ * STATUS: OPTIONAL
+ */
+ void (*commit_rqs)(struct Scsi_Host *, u16);
/*
* This is an error handling strategy routine. You don't need to
@@ -273,6 +272,13 @@
int (* map_queues)(struct Scsi_Host *shost);
/*
+ * Check if scatterlists need to be padded for DMA draining.
+ *
+ * Status: OPTIONAL
+ */
+ bool (* dma_need_drain)(struct request *rq);
+
+ /*
* This function determines the BIOS parameters for a given
* harddisk. These tend to be numbers that are made up by
* the host adapter. Parameters:
@@ -304,11 +310,7 @@
/*
* This is an optional routine that allows the transport to become
* involved when a scsi io timer fires. The return value tells the
- * timer routine how to finish the io timeout handling:
- * EH_HANDLED: I fixed the error, please complete the command
- * EH_RESET_TIMER: I need more time, reset the timer and
- * begin counting again
- * EH_DONE: Begin normal error recovery
+ * timer routine how to finish the io timeout handling.
*
* Status: OPTIONAL
*/
@@ -341,7 +343,7 @@
/*
* This determines if we will use a non-interrupt driven
* or an interrupt driven scheme. It is set to the maximum number
- * of simultaneous commands a given host adapter will accept.
+ * of simultaneous commands a single hw queue in HBA will accept.
*/
int can_queue;
@@ -367,10 +369,17 @@
unsigned int max_sectors;
/*
+ * Maximum size in bytes of a single segment.
+ */
+ unsigned int max_segment_size;
+
+ /*
* DMA scatter gather segment boundary limit. A segment crossing this
* boundary will be split in two.
*/
unsigned long dma_boundary;
+
+ unsigned long virt_boundary_mask;
/*
* This specifies "machine infinity" for host templates which don't
@@ -416,16 +425,6 @@
unsigned unchecked_isa_dma:1;
/*
- * True if this host adapter can make good use of clustering.
- * I originally thought that if the tablesize was large that it
- * was a waste of CPU cycles to prepare a cluster list, but
- * it works out that the Buslogic is faster if you use a smaller
- * number of segments (i.e. use clustering). I guess it is
- * inefficient.
- */
- unsigned use_clustering:1;
-
- /*
* True for emulated SCSI host adapters (e.g. ATAPI).
*/
unsigned emulated:1;
@@ -438,8 +437,8 @@
/* True if the controller does not support WRITE SAME */
unsigned no_write_same:1;
- /* True if the low-level driver supports blk-mq only */
- unsigned force_blk_mq:1;
+ /* True if the host uses host-wide tagspace */
+ unsigned host_tagset:1;
/*
* Countdown for host blocking with no commands outstanding.
@@ -507,7 +506,6 @@
unsigned long irq_flags; \
int rc; \
spin_lock_irqsave(shost->host_lock, irq_flags); \
- scsi_cmd_get_serial(shost, cmd); \
rc = func_name##_lck (cmd, cmd->scsi_done); \
spin_unlock_irqrestore(shost->host_lock, irq_flags); \
return rc; \
@@ -556,16 +554,9 @@
struct scsi_host_template *hostt;
struct scsi_transport_template *transportt;
- /*
- * Area to keep a shared tag map (if needed, will be
- * NULL if not).
- */
- union {
- struct blk_queue_tag *bqt;
- struct blk_mq_tag_set tag_set;
- };
+ /* Area to keep a shared tag map */
+ struct blk_mq_tag_set tag_set;
- atomic_t host_busy; /* commands actually active on low-level */
atomic_t host_blocked;
unsigned int host_failed; /* commands that failed.
@@ -613,24 +604,20 @@
short unsigned int sg_tablesize;
short unsigned int sg_prot_tablesize;
unsigned int max_sectors;
+ unsigned int max_segment_size;
unsigned long dma_boundary;
+ unsigned long virt_boundary_mask;
/*
* In scsi-mq mode, the number of hardware queues supported by the LLD.
*
* Note: it is assumed that each hardware queue has a queue depth of
* can_queue. In other words, the total queue depth per host
- * is nr_hw_queues * can_queue.
+ * is nr_hw_queues * can_queue. However, for when host_tagset is set,
+ * the total queue depth is can_queue.
*/
unsigned nr_hw_queues;
- /*
- * Used to assign serial numbers to the cmds.
- * Protected by the host lock.
- */
- unsigned long cmd_serial_number;
-
unsigned active_mode:2;
unsigned unchecked_isa_dma:1;
- unsigned use_clustering:1;
/*
* Host has requested that no further requests come through for the
@@ -657,17 +644,14 @@
/* The controller does not support WRITE SAME */
unsigned no_write_same:1;
- unsigned use_blk_mq:1;
- unsigned use_cmd_list:1;
+ /* True if the host uses host-wide tagspace */
+ unsigned host_tagset:1;
/* Host responded with short (<36 bytes) INQUIRY result */
unsigned short_inquiry:1;
- /*
- * Set "DBD" field in mode_sense caching mode page in case it is
- * mandatory by LLD standard.
- */
- unsigned set_dbd_for_caching:1;
+ /* The transport requires the LUN bits NOT to be stored in CDB[1] */
+ unsigned no_scsi2_lun_in_cdb:1;
/*
* Optional work queue to be utilized by the transport
@@ -679,9 +663,6 @@
* Task management function work queue
*/
struct workqueue_struct *tmf_work_q;
-
- /* The transport requires the LUN bits NOT to be stored in CDB[1] */
- unsigned no_scsi2_lun_in_cdb:1;
/*
* Value host_blocked counts down from
@@ -717,12 +698,14 @@
*/
struct device *dma_dev;
+ ANDROID_KABI_RESERVE(1);
+
/*
* We should ensure that this is aligned, both for better performance
* and also because some compilers (m68k) don't automatically force
* alignment to a long boundary.
*/
- unsigned long hostdata[0] /* Used for storage of host specific stuff */
+ unsigned long hostdata[] /* Used for storage of host specific stuff */
__attribute__ ((aligned (sizeof(unsigned long))));
};
@@ -757,11 +740,6 @@
shost->tmf_in_progress;
}
-static inline bool shost_use_blk_mq(struct Scsi_Host *shost)
-{
- return shost->use_blk_mq;
-}
-
extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
extern void scsi_flush_work(struct Scsi_Host *);
@@ -777,7 +755,8 @@
extern void scsi_host_put(struct Scsi_Host *t);
extern struct Scsi_Host *scsi_host_lookup(unsigned short);
extern const char *scsi_host_state_name(enum scsi_host_state);
-extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);
+extern void scsi_host_complete_all_commands(struct Scsi_Host *shost,
+ int status);
static inline int __must_check scsi_add_host(struct Scsi_Host *host,
struct device *dev)
@@ -802,6 +781,11 @@
extern void scsi_unblock_requests(struct Scsi_Host *);
extern void scsi_block_requests(struct Scsi_Host *);
+extern int scsi_host_block(struct Scsi_Host *shost);
+extern int scsi_host_unblock(struct Scsi_Host *shost, int new_state);
+
+void scsi_host_busy_iter(struct Scsi_Host *,
+ bool (*fn)(struct scsi_cmnd *, void *, bool), void *priv);
struct class_container;
--
Gitblit v1.6.2