Linux Audio

Check our new training course

Loading...
v3.1
 
  1/* ------------------------------------------------------------
  2 * ibmvscsi.h
  3 * (C) Copyright IBM Corporation 1994, 2003
  4 * Authors: Colin DeVilbiss (devilbis@us.ibm.com)
  5 *          Santiago Leon (santil@us.ibm.com)
  6 *          Dave Boutcher (sleddog@us.ibm.com)
  7 *
  8 * This program is free software; you can redistribute it and/or modify
  9 * it under the terms of the GNU General Public License as published by
 10 * the Free Software Foundation; either version 2 of the License, or
 11 * (at your option) any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 21 * USA
 22 *
 23 * ------------------------------------------------------------
 24 * Emulation of a SCSI host adapter for Virtual I/O devices
 25 *
 26 * This driver allows the Linux SCSI peripheral drivers to directly
 27 * access devices in the hosting partition, either on an iSeries
 28 * hypervisor system or a converged hypervisor system.
 29 */
 30#ifndef IBMVSCSI_H
 31#define IBMVSCSI_H
 32#include <linux/types.h>
 33#include <linux/list.h>
 34#include <linux/completion.h>
 35#include <linux/interrupt.h>
 36#include "viosrp.h"
 37
 38struct scsi_cmnd;
 39struct Scsi_Host;
 40
 41/* Number of indirect bufs...the list of these has to fit in the
 42 * additional data of the srp_cmd struct along with the indirect
 43 * descriptor
 44 */
 45#define MAX_INDIRECT_BUFS 10
 46
 47#define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
 48#define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16
 49#define IBMVSCSI_MAX_SECTORS_DEFAULT 256 /* 32 * 8 = default max I/O 32 pages */
 50#define IBMVSCSI_MAX_CMDS_PER_LUN 64
 
 51
 52/* ------------------------------------------------------------
 53 * Data Structures
 54 */
 55/* an RPA command/response transport queue */
 56struct crq_queue {
 57	struct viosrp_crq *msgs;
 58	int size, cur;
 59	dma_addr_t msg_token;
 60	spinlock_t lock;
 61};
 62
 63/* a unit of work for the hosting partition */
 64struct srp_event_struct {
 65	union viosrp_iu *xfer_iu;
 66	struct scsi_cmnd *cmnd;
 67	struct list_head list;
 68	void (*done) (struct srp_event_struct *);
 69	struct viosrp_crq crq;
 70	struct ibmvscsi_host_data *hostdata;
 71	atomic_t free;
 72	union viosrp_iu iu;
 73	void (*cmnd_done) (struct scsi_cmnd *);
 74	struct completion comp;
 75	struct timer_list timer;
 76	union viosrp_iu *sync_srp;
 77	struct srp_direct_buf *ext_list;
 78	dma_addr_t ext_list_token;
 79};
 80
 81/* a pool of event structs for use */
 82struct event_pool {
 83	struct srp_event_struct *events;
 84	u32 size;
 85	int next;
 86	union viosrp_iu *iu_storage;
 87	dma_addr_t iu_token;
 88};
 89
 
 
 
 
 
 
 
 90/* all driver data associated with a host adapter */
 91struct ibmvscsi_host_data {
 
 92	atomic_t request_limit;
 93	int client_migrated;
 94	int reset_crq;
 95	int reenable_crq;
 96	struct device *dev;
 97	struct event_pool pool;
 98	struct crq_queue queue;
 99	struct tasklet_struct srp_task;
100	struct list_head sent;
101	struct Scsi_Host *host;
102	struct task_struct *work_thread;
103	wait_queue_head_t work_wait_q;
104	struct mad_adapter_info_data madapter_info;
105	struct capabilities caps;
106	dma_addr_t caps_addr;
107	dma_addr_t adapter_info_addr;
108};
109
110/* routines for managing a command/response queue */
111void ibmvscsi_handle_crq(struct viosrp_crq *crq,
112			 struct ibmvscsi_host_data *hostdata);
113
114struct ibmvscsi_ops {
115	int (*init_crq_queue)(struct crq_queue *queue,
116			      struct ibmvscsi_host_data *hostdata,
117			      int max_requests);
118	void (*release_crq_queue)(struct crq_queue *queue,
119				  struct ibmvscsi_host_data *hostdata,
120				  int max_requests);
121	int (*reset_crq_queue)(struct crq_queue *queue,
122			       struct ibmvscsi_host_data *hostdata);
123	int (*reenable_crq_queue)(struct crq_queue *queue,
124				  struct ibmvscsi_host_data *hostdata);
125	int (*send_crq)(struct ibmvscsi_host_data *hostdata,
126		       u64 word1, u64 word2);
127	int (*resume) (struct ibmvscsi_host_data *hostdata);
128};
129
130extern struct ibmvscsi_ops iseriesvscsi_ops;
131extern struct ibmvscsi_ops rpavscsi_ops;
132
133#endif				/* IBMVSCSI_H */
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/* ------------------------------------------------------------
  3 * ibmvscsi.h
  4 * (C) Copyright IBM Corporation 1994, 2003
  5 * Authors: Colin DeVilbiss (devilbis@us.ibm.com)
  6 *          Santiago Leon (santil@us.ibm.com)
  7 *          Dave Boutcher (sleddog@us.ibm.com)
  8 *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  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>
 22#include <scsi/viosrp.h>
 23
 24struct scsi_cmnd;
 25struct 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
 33#define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
 34#define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16
 35#define IBMVSCSI_MAX_SECTORS_DEFAULT 256 /* 32 * 8 = default max I/O 32 pages */
 36#define IBMVSCSI_MAX_CMDS_PER_LUN 64
 37#define IBMVSCSI_MAX_LUN 32
 38
 39/* ------------------------------------------------------------
 40 * Data Structures
 41 */
 42/* an RPA command/response transport queue */
 43struct 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 */
 51struct 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;
 62	struct timer_list timer;
 63	union viosrp_iu *sync_srp;
 64	struct srp_direct_buf *ext_list;
 65	dma_addr_t ext_list_token;
 66};
 67
 68/* a pool of event structs for use */
 69struct 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
 77enum ibmvscsi_host_action {
 78	IBMVSCSI_HOST_ACTION_NONE = 0,
 79	IBMVSCSI_HOST_ACTION_RESET,
 80	IBMVSCSI_HOST_ACTION_REENABLE,
 81	IBMVSCSI_HOST_ACTION_UNBLOCK,
 82};
 83
 84/* all driver data associated with a host adapter */
 85struct ibmvscsi_host_data {
 86	struct list_head host_list;
 87	atomic_t request_limit;
 88	int client_migrated;
 89	enum ibmvscsi_host_action action;
 
 90	struct device *dev;
 91	struct event_pool pool;
 92	struct crq_queue queue;
 93	struct tasklet_struct srp_task;
 94	struct list_head sent;
 95	struct Scsi_Host *host;
 96	struct task_struct *work_thread;
 97	wait_queue_head_t work_wait_q;
 98	struct mad_adapter_info_data madapter_info;
 99	struct capabilities caps;
100	dma_addr_t caps_addr;
101	dma_addr_t adapter_info_addr;
102};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
104#endif				/* IBMVSCSI_H */