Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* ------------------------------------------------------------
0003  * ibmvscsi.h
0004  * (C) Copyright IBM Corporation 1994, 2003
0005  * Authors: Colin DeVilbiss (devilbis@us.ibm.com)
0006  *          Santiago Leon (santil@us.ibm.com)
0007  *          Dave Boutcher (sleddog@us.ibm.com)
0008  *
0009  * ------------------------------------------------------------
0010  * Emulation of a SCSI host adapter for Virtual I/O devices
0011  *
0012  * This driver allows the Linux SCSI peripheral drivers to directly
0013  * access devices in the hosting partition, either on an iSeries
0014  * hypervisor system or a converged hypervisor system.
0015  */
0016 #ifndef IBMVSCSI_H
0017 #define IBMVSCSI_H
0018 #include <linux/types.h>
0019 #include <linux/list.h>
0020 #include <linux/completion.h>
0021 #include <linux/interrupt.h>
0022 #include <scsi/viosrp.h>
0023 
0024 struct scsi_cmnd;
0025 struct Scsi_Host;
0026 
0027 /* Number of indirect bufs...the list of these has to fit in the
0028  * additional data of the srp_cmd struct along with the indirect
0029  * descriptor
0030  */
0031 #define MAX_INDIRECT_BUFS 10
0032 
0033 #define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
0034 #define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16
0035 #define IBMVSCSI_MAX_SECTORS_DEFAULT 256 /* 32 * 8 = default max I/O 32 pages */
0036 #define IBMVSCSI_MAX_CMDS_PER_LUN 64
0037 #define IBMVSCSI_MAX_LUN 32
0038 
0039 /* ------------------------------------------------------------
0040  * Data Structures
0041  */
0042 /* an RPA command/response transport queue */
0043 struct crq_queue {
0044     struct viosrp_crq *msgs;
0045     int size, cur;
0046     dma_addr_t msg_token;
0047     spinlock_t lock;
0048 };
0049 
0050 /* a unit of work for the hosting partition */
0051 struct srp_event_struct {
0052     union viosrp_iu *xfer_iu;
0053     struct scsi_cmnd *cmnd;
0054     struct list_head list;
0055     void (*done) (struct srp_event_struct *);
0056     struct viosrp_crq crq;
0057     struct ibmvscsi_host_data *hostdata;
0058     atomic_t free;
0059     union viosrp_iu iu;
0060     void (*cmnd_done) (struct scsi_cmnd *);
0061     struct completion comp;
0062     struct timer_list timer;
0063     union viosrp_iu *sync_srp;
0064     struct srp_direct_buf *ext_list;
0065     dma_addr_t ext_list_token;
0066 };
0067 
0068 /* a pool of event structs for use */
0069 struct event_pool {
0070     struct srp_event_struct *events;
0071     u32 size;
0072     int next;
0073     union viosrp_iu *iu_storage;
0074     dma_addr_t iu_token;
0075 };
0076 
0077 enum ibmvscsi_host_action {
0078     IBMVSCSI_HOST_ACTION_NONE = 0,
0079     IBMVSCSI_HOST_ACTION_RESET,
0080     IBMVSCSI_HOST_ACTION_REENABLE,
0081     IBMVSCSI_HOST_ACTION_UNBLOCK,
0082 };
0083 
0084 /* all driver data associated with a host adapter */
0085 struct ibmvscsi_host_data {
0086     struct list_head host_list;
0087     atomic_t request_limit;
0088     int client_migrated;
0089     enum ibmvscsi_host_action action;
0090     struct device *dev;
0091     struct event_pool pool;
0092     struct crq_queue queue;
0093     struct tasklet_struct srp_task;
0094     struct list_head sent;
0095     struct Scsi_Host *host;
0096     struct task_struct *work_thread;
0097     wait_queue_head_t work_wait_q;
0098     struct mad_adapter_info_data madapter_info;
0099     struct capabilities caps;
0100     dma_addr_t caps_addr;
0101     dma_addr_t adapter_info_addr;
0102 };
0103 
0104 #endif              /* IBMVSCSI_H */