ibmvscsi.h 3.3 KB

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