main.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 PCI_DEVICE_ID_IBM_CORSA 0x04F0
  23. #define PCI_DEVICE_ID_IBM_FLASH_GT 0x0600
  24. /* Since there is only one target, make it 0 */
  25. #define CXLFLASH_TARGET 0
  26. #define CXLFLASH_MAX_CDB_LEN 16
  27. /* Really only one target per bus since the Texan is directly attached */
  28. #define CXLFLASH_MAX_NUM_TARGETS_PER_BUS 1
  29. #define CXLFLASH_MAX_NUM_LUNS_PER_TARGET 65536
  30. #define CXLFLASH_PCI_ERROR_RECOVERY_TIMEOUT (120 * HZ)
  31. #define NUM_FC_PORTS CXLFLASH_NUM_FC_PORTS /* ports per AFU */
  32. /* FC defines */
  33. #define FC_MTIP_CMDCONFIG 0x010
  34. #define FC_MTIP_STATUS 0x018
  35. #define FC_PNAME 0x300
  36. #define FC_CONFIG 0x320
  37. #define FC_CONFIG2 0x328
  38. #define FC_STATUS 0x330
  39. #define FC_ERROR 0x380
  40. #define FC_ERRCAP 0x388
  41. #define FC_ERRMSK 0x390
  42. #define FC_CNT_CRCERR 0x538
  43. #define FC_CRC_THRESH 0x580
  44. #define FC_MTIP_CMDCONFIG_ONLINE 0x20ULL
  45. #define FC_MTIP_CMDCONFIG_OFFLINE 0x40ULL
  46. #define FC_MTIP_STATUS_MASK 0x30ULL
  47. #define FC_MTIP_STATUS_ONLINE 0x20ULL
  48. #define FC_MTIP_STATUS_OFFLINE 0x10ULL
  49. /* TIMEOUT and RETRY definitions */
  50. /* AFU command timeout values */
  51. #define MC_AFU_SYNC_TIMEOUT 5 /* 5 secs */
  52. /* AFU command room retry limit */
  53. #define MC_ROOM_RETRY_CNT 10
  54. /* FC CRC clear periodic timer */
  55. #define MC_CRC_THRESH 100 /* threshold in 5 mins */
  56. #define FC_PORT_STATUS_RETRY_CNT 100 /* 100 100ms retries = 10 seconds */
  57. #define FC_PORT_STATUS_RETRY_INTERVAL_US 100000 /* microseconds */
  58. /* VPD defines */
  59. #define CXLFLASH_VPD_LEN 256
  60. #define WWPN_LEN 16
  61. #define WWPN_BUF_LEN (WWPN_LEN + 1)
  62. enum undo_level {
  63. UNDO_NOOP = 0,
  64. FREE_IRQ,
  65. UNMAP_ONE,
  66. UNMAP_TWO,
  67. UNMAP_THREE
  68. };
  69. struct dev_dependent_vals {
  70. u64 max_sectors;
  71. u64 flags;
  72. #define CXLFLASH_NOTIFY_SHUTDOWN 0x0000000000000001ULL
  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. #endif /* _CXLFLASH_MAIN_H */