scsi_tgt_if.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * SCSI target kernel/user interface
  3. *
  4. * Copyright (C) 2005 FUJITA Tomonori <tomof@acm.org>
  5. * Copyright (C) 2005 Mike Christie <michaelc@cs.wisc.edu>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. */
  22. #ifndef __SCSI_TARGET_IF_H
  23. #define __SCSI_TARGET_IF_H
  24. /* user -> kernel */
  25. #define TGT_UEVENT_CMD_RSP 0x0001
  26. #define TGT_UEVENT_TSK_MGMT_RSP 0x0002
  27. /* kernel -> user */
  28. #define TGT_KEVENT_CMD_REQ 0x1001
  29. #define TGT_KEVENT_CMD_DONE 0x1002
  30. #define TGT_KEVENT_TSK_MGMT_REQ 0x1003
  31. struct tgt_event_hdr {
  32. uint16_t version;
  33. uint16_t status;
  34. uint16_t type;
  35. uint16_t len;
  36. } __attribute__ ((aligned (sizeof(uint64_t))));
  37. struct tgt_event {
  38. struct tgt_event_hdr hdr;
  39. union {
  40. /* user-> kernel */
  41. struct {
  42. int host_no;
  43. uint32_t len;
  44. int result;
  45. aligned_u64 uaddr;
  46. uint8_t rw;
  47. aligned_u64 tag;
  48. } cmd_rsp;
  49. struct {
  50. int host_no;
  51. aligned_u64 mid;
  52. int result;
  53. } tsk_mgmt_rsp;
  54. /* kernel -> user */
  55. struct {
  56. int host_no;
  57. uint32_t data_len;
  58. uint8_t scb[16];
  59. uint8_t lun[8];
  60. int attribute;
  61. aligned_u64 tag;
  62. } cmd_req;
  63. struct {
  64. int host_no;
  65. aligned_u64 tag;
  66. int result;
  67. } cmd_done;
  68. struct {
  69. int host_no;
  70. int function;
  71. aligned_u64 tag;
  72. uint8_t lun[8];
  73. aligned_u64 mid;
  74. } tsk_mgmt_req;
  75. } p;
  76. } __attribute__ ((aligned (sizeof(uint64_t))));
  77. #define TGT_RING_SIZE (1UL << 16)
  78. #endif