main.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * CXL Flash Device Driver
  3. *
  4. * Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation
  5. * Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
  6. *
  7. * Copyright (C) 2015 IBM Corporation
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #ifndef _CXLFLASH_MAIN_H
  15. #define _CXLFLASH_MAIN_H
  16. #include <linux/list.h>
  17. #include <linux/types.h>
  18. #include <scsi/scsi.h>
  19. #include <scsi/scsi_device.h>
  20. #define CXLFLASH_NAME "cxlflash"
  21. #define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter"
  22. #define CXLFLASH_DRIVER_DATE "(August 13, 2015)"
  23. #define PCI_DEVICE_ID_IBM_CORSA 0x04F0
  24. #define PCI_DEVICE_ID_IBM_FLASH_GT 0x0600
  25. /* Since there is only one target, make it 0 */
  26. #define CXLFLASH_TARGET 0
  27. #define CXLFLASH_MAX_CDB_LEN 16
  28. /* Really only one target per bus since the Texan is directly attached */
  29. #define CXLFLASH_MAX_NUM_TARGETS_PER_BUS 1
  30. #define CXLFLASH_MAX_NUM_LUNS_PER_TARGET 65536
  31. #define CXLFLASH_PCI_ERROR_RECOVERY_TIMEOUT (120 * HZ)
  32. #define NUM_FC_PORTS CXLFLASH_NUM_FC_PORTS /* ports per AFU */
  33. /* FC defines */
  34. #define FC_MTIP_CMDCONFIG 0x010
  35. #define FC_MTIP_STATUS 0x018
  36. #define FC_PNAME 0x300
  37. #define FC_CONFIG 0x320
  38. #define FC_CONFIG2 0x328
  39. #define FC_STATUS 0x330
  40. #define FC_ERROR 0x380
  41. #define FC_ERRCAP 0x388
  42. #define FC_ERRMSK 0x390
  43. #define FC_CNT_CRCERR 0x538
  44. #define FC_CRC_THRESH 0x580
  45. #define FC_MTIP_CMDCONFIG_ONLINE 0x20ULL
  46. #define FC_MTIP_CMDCONFIG_OFFLINE 0x40ULL
  47. #define FC_MTIP_STATUS_MASK 0x30ULL
  48. #define FC_MTIP_STATUS_ONLINE 0x20ULL
  49. #define FC_MTIP_STATUS_OFFLINE 0x10ULL
  50. /* TIMEOUT and RETRY definitions */
  51. /* AFU command timeout values */
  52. #define MC_AFU_SYNC_TIMEOUT 5 /* 5 secs */
  53. /* AFU command room retry limit */
  54. #define MC_ROOM_RETRY_CNT 10
  55. /* FC CRC clear periodic timer */
  56. #define MC_CRC_THRESH 100 /* threshold in 5 mins */
  57. #define FC_PORT_STATUS_RETRY_CNT 100 /* 100 100ms retries = 10 seconds */
  58. #define FC_PORT_STATUS_RETRY_INTERVAL_US 100000 /* microseconds */
  59. /* VPD defines */
  60. #define CXLFLASH_VPD_LEN 256
  61. #define WWPN_LEN 16
  62. #define WWPN_BUF_LEN (WWPN_LEN + 1)
  63. enum undo_level {
  64. RELEASE_CONTEXT = 0,
  65. FREE_IRQ,
  66. UNMAP_ONE,
  67. UNMAP_TWO,
  68. UNMAP_THREE,
  69. UNDO_START
  70. };
  71. struct dev_dependent_vals {
  72. u64 max_sectors;
  73. };
  74. struct asyc_intr_info {
  75. u64 status;
  76. char *desc;
  77. u8 port;
  78. u8 action;
  79. #define CLR_FC_ERROR 0x01
  80. #define LINK_RESET 0x02
  81. #define SCAN_HOST 0x04
  82. };
  83. #ifndef CONFIG_CXL_EEH
  84. #define cxl_perst_reloads_same_image(_a, _b) do { } while (0)
  85. #endif
  86. #endif /* _CXLFLASH_MAIN_H */