csio_hw_chip.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * This file is part of the Chelsio FCoE driver for Linux.
  3. *
  4. * Copyright (c) 2008-2013 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef __CSIO_HW_CHIP_H__
  34. #define __CSIO_HW_CHIP_H__
  35. #include "csio_defs.h"
  36. /* Define MACRO values */
  37. #define CSIO_HW_T5 0x5000
  38. #define CSIO_T5_FCOE_ASIC 0x5600
  39. #define CSIO_HW_CHIP_MASK 0xF000
  40. #define T5_REGMAP_SIZE (332 * 1024)
  41. #define FW_FNAME_T5 "cxgb4/t5fw.bin"
  42. #define FW_CFG_NAME_T5 "cxgb4/t5-config.txt"
  43. #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
  44. #define CHELSIO_CHIP_FPGA 0x100
  45. #define CHELSIO_CHIP_VERSION(code) (((code) >> 12) & 0xf)
  46. #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
  47. #define CHELSIO_T5 0x5
  48. enum chip_type {
  49. T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
  50. T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1),
  51. T5_FIRST_REV = T5_A0,
  52. T5_LAST_REV = T5_A1,
  53. };
  54. static inline int csio_is_t5(uint16_t chip)
  55. {
  56. return (chip == CSIO_HW_T5);
  57. }
  58. /* Define MACRO DEFINITIONS */
  59. #define CSIO_DEVICE(devid, idx) \
  60. { PCI_VENDOR_ID_CHELSIO, (devid), PCI_ANY_ID, PCI_ANY_ID, 0, 0, (idx) }
  61. #include "t4fw_api.h"
  62. #include "t4fw_version.h"
  63. #define FW_VERSION(chip) ( \
  64. FW_HDR_FW_VER_MAJOR_G(chip##FW_VERSION_MAJOR) | \
  65. FW_HDR_FW_VER_MINOR_G(chip##FW_VERSION_MINOR) | \
  66. FW_HDR_FW_VER_MICRO_G(chip##FW_VERSION_MICRO) | \
  67. FW_HDR_FW_VER_BUILD_G(chip##FW_VERSION_BUILD))
  68. #define FW_INTFVER(chip, intf) (FW_HDR_INTFVER_##intf)
  69. struct fw_info {
  70. u8 chip;
  71. char *fs_name;
  72. char *fw_mod_name;
  73. struct fw_hdr fw_hdr;
  74. };
  75. /* Declare ENUMS */
  76. enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 };
  77. enum {
  78. MEMWIN_APERTURE = 2048,
  79. MEMWIN_BASE = 0x1b800,
  80. };
  81. /* Slow path handlers */
  82. struct intr_info {
  83. unsigned int mask; /* bits to check in interrupt status */
  84. const char *msg; /* message to print or NULL */
  85. short stat_idx; /* stat counter to increment or -1 */
  86. unsigned short fatal; /* whether the condition reported is fatal */
  87. };
  88. /* T4/T5 Chip specific ops */
  89. struct csio_hw;
  90. struct csio_hw_chip_ops {
  91. int (*chip_set_mem_win)(struct csio_hw *, uint32_t);
  92. void (*chip_pcie_intr_handler)(struct csio_hw *);
  93. uint32_t (*chip_flash_cfg_addr)(struct csio_hw *);
  94. int (*chip_mc_read)(struct csio_hw *, int, uint32_t,
  95. __be32 *, uint64_t *);
  96. int (*chip_edc_read)(struct csio_hw *, int, uint32_t,
  97. __be32 *, uint64_t *);
  98. int (*chip_memory_rw)(struct csio_hw *, u32, int, u32,
  99. u32, uint32_t *, int);
  100. void (*chip_dfs_create_ext_mem)(struct csio_hw *);
  101. };
  102. extern struct csio_hw_chip_ops t5_ops;
  103. #endif /* #ifndef __CSIO_HW_CHIP_H__ */