ibmvscsi.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  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. *
  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. struct scsi_cmnd;
  24. struct Scsi_Host;
  25. /* Number of indirect bufs...the list of these has to fit in the
  26. * additional data of the srp_cmd struct along with the indirect
  27. * descriptor
  28. */
  29. #define MAX_INDIRECT_BUFS 10
  30. #define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
  31. #define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16
  32. #define IBMVSCSI_MAX_SECTORS_DEFAULT 256 /* 32 * 8 = default max I/O 32 pages */
  33. #define IBMVSCSI_MAX_CMDS_PER_LUN 64
  34. #define IBMVSCSI_MAX_LUN 32
  35. /* ------------------------------------------------------------
  36. * Data Structures
  37. */
  38. /* an RPA command/response transport queue */
  39. struct crq_queue {
  40. struct viosrp_crq *msgs;
  41. int size, cur;
  42. dma_addr_t msg_token;
  43. spinlock_t lock;
  44. };
  45. /* a unit of work for the hosting partition */
  46. struct srp_event_struct {
  47. union viosrp_iu *xfer_iu;
  48. struct scsi_cmnd *cmnd;
  49. struct list_head list;
  50. void (*done) (struct srp_event_struct *);
  51. struct viosrp_crq crq;
  52. struct ibmvscsi_host_data *hostdata;
  53. atomic_t free;
  54. union viosrp_iu iu;
  55. void (*cmnd_done) (struct scsi_cmnd *);
  56. struct completion comp;
  57. struct timer_list timer;
  58. union viosrp_iu *sync_srp;
  59. struct srp_direct_buf *ext_list;
  60. dma_addr_t ext_list_token;
  61. };
  62. /* a pool of event structs for use */
  63. struct event_pool {
  64. struct srp_event_struct *events;
  65. u32 size;
  66. int next;
  67. union viosrp_iu *iu_storage;
  68. dma_addr_t iu_token;
  69. };
  70. enum ibmvscsi_host_action {
  71. IBMVSCSI_HOST_ACTION_NONE = 0,
  72. IBMVSCSI_HOST_ACTION_RESET,
  73. IBMVSCSI_HOST_ACTION_REENABLE,
  74. IBMVSCSI_HOST_ACTION_UNBLOCK,
  75. };
  76. /* all driver data associated with a host adapter */
  77. struct ibmvscsi_host_data {
  78. struct list_head host_list;
  79. atomic_t request_limit;
  80. int client_migrated;
  81. enum ibmvscsi_host_action action;
  82. struct device *dev;
  83. struct event_pool pool;
  84. struct crq_queue queue;
  85. struct tasklet_struct srp_task;
  86. struct list_head sent;
  87. struct Scsi_Host *host;
  88. struct task_struct *work_thread;
  89. wait_queue_head_t work_wait_q;
  90. struct mad_adapter_info_data madapter_info;
  91. struct capabilities caps;
  92. dma_addr_t caps_addr;
  93. dma_addr_t adapter_info_addr;
  94. };
  95. #endif /* IBMVSCSI_H */