Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* ------------------------------------------------------------ |
| 3 | * ibmvscsi.h |
| 4 | * (C) Copyright IBM Corporation 1994, 2003 |
| 5 | * Authors: Colin DeVilbiss ([email protected]) |
| 6 | * Santiago Leon ([email protected]) |
| 7 | * Dave Boutcher ([email protected]) |
| 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * ------------------------------------------------------------ |
| 10 | * Emulation of a SCSI host adapter for Virtual I/O devices |
| 11 | * |
| 12 | * This driver allows the Linux SCSI peripheral drivers to directly |
| 13 | * access devices in the hosting partition, either on an iSeries |
| 14 | * hypervisor system or a converged hypervisor system. |
| 15 | */ |
| 16 | #ifndef IBMVSCSI_H |
| 17 | #define IBMVSCSI_H |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/list.h> |
| 20 | #include <linux/completion.h> |
| 21 | #include <linux/interrupt.h> |
Bryant G. Ly | 88a678b | 2016-06-28 17:05:35 -0500 | [diff] [blame] | 22 | #include <scsi/viosrp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | struct scsi_cmnd; |
| 25 | struct Scsi_Host; |
| 26 | |
| 27 | /* Number of indirect bufs...the list of these has to fit in the |
| 28 | * additional data of the srp_cmd struct along with the indirect |
| 29 | * descriptor |
| 30 | */ |
| 31 | #define MAX_INDIRECT_BUFS 10 |
| 32 | |
Robert Jennings | a897ff2 | 2007-03-28 12:45:46 -0500 | [diff] [blame] | 33 | #define IBMVSCSI_MAX_REQUESTS_DEFAULT 100 |
Robert Jennings | 7912a0a | 2008-07-24 04:35:27 +1000 | [diff] [blame] | 34 | #define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16 |
| 35 | #define IBMVSCSI_MAX_SECTORS_DEFAULT 256 /* 32 * 8 = default max I/O 32 pages */ |
Brian King | 742d25b | 2007-05-29 15:46:14 -0500 | [diff] [blame] | 36 | #define IBMVSCSI_MAX_CMDS_PER_LUN 64 |
Laurent Vivier | 3467a14 | 2015-11-09 17:49:09 +0100 | [diff] [blame] | 37 | #define IBMVSCSI_MAX_LUN 32 |
Robert Jennings | a897ff2 | 2007-03-28 12:45:46 -0500 | [diff] [blame] | 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | /* ------------------------------------------------------------ |
| 40 | * Data Structures |
| 41 | */ |
| 42 | /* an RPA command/response transport queue */ |
| 43 | struct crq_queue { |
| 44 | struct viosrp_crq *msgs; |
| 45 | int size, cur; |
| 46 | dma_addr_t msg_token; |
| 47 | spinlock_t lock; |
| 48 | }; |
| 49 | |
| 50 | /* a unit of work for the hosting partition */ |
| 51 | struct srp_event_struct { |
| 52 | union viosrp_iu *xfer_iu; |
| 53 | struct scsi_cmnd *cmnd; |
| 54 | struct list_head list; |
| 55 | void (*done) (struct srp_event_struct *); |
| 56 | struct viosrp_crq crq; |
| 57 | struct ibmvscsi_host_data *hostdata; |
| 58 | atomic_t free; |
| 59 | union viosrp_iu iu; |
| 60 | void (*cmnd_done) (struct scsi_cmnd *); |
| 61 | struct completion comp; |
Brian King | 3d0e91f | 2007-06-13 17:12:26 -0500 | [diff] [blame] | 62 | struct timer_list timer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | union viosrp_iu *sync_srp; |
FUJITA Tomonori | ef26567 | 2006-03-26 03:57:14 +0900 | [diff] [blame] | 64 | struct srp_direct_buf *ext_list; |
James Bottomley | 4dddbc2 | 2005-09-06 17:11:54 -0500 | [diff] [blame] | 65 | dma_addr_t ext_list_token; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | /* a pool of event structs for use */ |
| 69 | struct event_pool { |
| 70 | struct srp_event_struct *events; |
| 71 | u32 size; |
| 72 | int next; |
| 73 | union viosrp_iu *iu_storage; |
| 74 | dma_addr_t iu_token; |
| 75 | }; |
| 76 | |
| 77 | /* all driver data associated with a host adapter */ |
| 78 | struct ibmvscsi_host_data { |
Tyrel Datwyler | 32d6e4b | 2016-12-07 16:04:35 -0600 | [diff] [blame] | 79 | struct list_head host_list; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | atomic_t request_limit; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 81 | int client_migrated; |
Brian King | 0f33ece | 2010-06-17 13:56:00 -0500 | [diff] [blame] | 82 | int reset_crq; |
| 83 | int reenable_crq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | struct device *dev; |
| 85 | struct event_pool pool; |
| 86 | struct crq_queue queue; |
| 87 | struct tasklet_struct srp_task; |
| 88 | struct list_head sent; |
| 89 | struct Scsi_Host *host; |
Brian King | 0f33ece | 2010-06-17 13:56:00 -0500 | [diff] [blame] | 90 | struct task_struct *work_thread; |
| 91 | wait_queue_head_t work_wait_q; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | struct mad_adapter_info_data madapter_info; |
Brian King | 126c5cc | 2009-06-08 16:19:08 -0500 | [diff] [blame] | 93 | struct capabilities caps; |
| 94 | dma_addr_t caps_addr; |
| 95 | dma_addr_t adapter_info_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | }; |
| 97 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | #endif /* IBMVSCSI_H */ |