bnx2x_init.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /* bnx2x_init.h: Broadcom Everest network driver.
  2. * Structures and macroes needed during the initialization.
  3. *
  4. * Copyright (c) 2007-2009 Broadcom Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation.
  9. *
  10. * Maintained by: Eilon Greenstein <eilong@broadcom.com>
  11. * Written by: Eliezer Tamir
  12. * Modified by: Vladislav Zolotarov <vladz@broadcom.com>
  13. */
  14. #ifndef BNX2X_INIT_H
  15. #define BNX2X_INIT_H
  16. /* RAM0 size in bytes */
  17. #define STORM_INTMEM_SIZE_E1 0x5800
  18. #define STORM_INTMEM_SIZE_E1H 0x10000
  19. #define STORM_INTMEM_SIZE(bp) ((CHIP_IS_E1(bp) ? STORM_INTMEM_SIZE_E1 : \
  20. STORM_INTMEM_SIZE_E1H) / 4)
  21. /* Init operation types and structures */
  22. /* Common for both E1 and E1H */
  23. #define OP_RD 0x1 /* read single register */
  24. #define OP_WR 0x2 /* write single register */
  25. #define OP_IW 0x3 /* write single register using mailbox */
  26. #define OP_SW 0x4 /* copy a string to the device */
  27. #define OP_SI 0x5 /* copy a string using mailbox */
  28. #define OP_ZR 0x6 /* clear memory */
  29. #define OP_ZP 0x7 /* unzip then copy with DMAE */
  30. #define OP_WR_64 0x8 /* write 64 bit pattern */
  31. #define OP_WB 0x9 /* copy a string using DMAE */
  32. /* FPGA and EMUL specific operations */
  33. #define OP_WR_EMUL 0xa /* write single register on Emulation */
  34. #define OP_WR_FPGA 0xb /* write single register on FPGA */
  35. #define OP_WR_ASIC 0xc /* write single register on ASIC */
  36. /* Init stages */
  37. /* Never reorder stages !!! */
  38. #define COMMON_STAGE 0
  39. #define PORT0_STAGE 1
  40. #define PORT1_STAGE 2
  41. #define FUNC0_STAGE 3
  42. #define FUNC1_STAGE 4
  43. #define FUNC2_STAGE 5
  44. #define FUNC3_STAGE 6
  45. #define FUNC4_STAGE 7
  46. #define FUNC5_STAGE 8
  47. #define FUNC6_STAGE 9
  48. #define FUNC7_STAGE 10
  49. #define STAGE_IDX_MAX 11
  50. #define STAGE_START 0
  51. #define STAGE_END 1
  52. /* Indices of blocks */
  53. #define PRS_BLOCK 0
  54. #define SRCH_BLOCK 1
  55. #define TSDM_BLOCK 2
  56. #define TCM_BLOCK 3
  57. #define BRB1_BLOCK 4
  58. #define TSEM_BLOCK 5
  59. #define PXPCS_BLOCK 6
  60. #define EMAC0_BLOCK 7
  61. #define EMAC1_BLOCK 8
  62. #define DBU_BLOCK 9
  63. #define MISC_BLOCK 10
  64. #define DBG_BLOCK 11
  65. #define NIG_BLOCK 12
  66. #define MCP_BLOCK 13
  67. #define UPB_BLOCK 14
  68. #define CSDM_BLOCK 15
  69. #define USDM_BLOCK 16
  70. #define CCM_BLOCK 17
  71. #define UCM_BLOCK 18
  72. #define USEM_BLOCK 19
  73. #define CSEM_BLOCK 20
  74. #define XPB_BLOCK 21
  75. #define DQ_BLOCK 22
  76. #define TIMERS_BLOCK 23
  77. #define XSDM_BLOCK 24
  78. #define QM_BLOCK 25
  79. #define PBF_BLOCK 26
  80. #define XCM_BLOCK 27
  81. #define XSEM_BLOCK 28
  82. #define CDU_BLOCK 29
  83. #define DMAE_BLOCK 30
  84. #define PXP_BLOCK 31
  85. #define CFC_BLOCK 32
  86. #define HC_BLOCK 33
  87. #define PXP2_BLOCK 34
  88. #define MISC_AEU_BLOCK 35
  89. #define PGLUE_B_BLOCK 36
  90. #define IGU_BLOCK 37
  91. /* Returns the index of start or end of a specific block stage in ops array*/
  92. #define BLOCK_OPS_IDX(block, stage, end) \
  93. (2*(((block)*STAGE_IDX_MAX) + (stage)) + (end))
  94. struct raw_op {
  95. u32 op:8;
  96. u32 offset:24;
  97. u32 raw_data;
  98. };
  99. struct op_read {
  100. u32 op:8;
  101. u32 offset:24;
  102. u32 pad;
  103. };
  104. struct op_write {
  105. u32 op:8;
  106. u32 offset:24;
  107. u32 val;
  108. };
  109. struct op_string_write {
  110. u32 op:8;
  111. u32 offset:24;
  112. #ifdef __LITTLE_ENDIAN
  113. u16 data_off;
  114. u16 data_len;
  115. #else /* __BIG_ENDIAN */
  116. u16 data_len;
  117. u16 data_off;
  118. #endif
  119. };
  120. struct op_zero {
  121. u32 op:8;
  122. u32 offset:24;
  123. u32 len;
  124. };
  125. union init_op {
  126. struct op_read read;
  127. struct op_write write;
  128. struct op_string_write str_wr;
  129. struct op_zero zero;
  130. struct raw_op raw;
  131. };
  132. #endif /* BNX2X_INIT_H */