bmi_msg.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. //------------------------------------------------------------------------------
  2. // <copyright file="bmi_msg.h" company="Atheros">
  3. // Copyright (c) 2004-2007 Atheros Corporation. All rights reserved.
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License version 2 as
  7. // published by the Free Software Foundation;
  8. //
  9. // Software distributed under the License is distributed on an "AS
  10. // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11. // implied. See the License for the specific language governing
  12. // rights and limitations under the License.
  13. //
  14. //
  15. //------------------------------------------------------------------------------
  16. //==============================================================================
  17. // Author(s): ="Atheros"
  18. //==============================================================================
  19. #ifndef __BMI_MSG_H__
  20. #define __BMI_MSG_H__
  21. /*
  22. * Bootloader Messaging Interface (BMI)
  23. *
  24. * BMI is a very simple messaging interface used during initialization
  25. * to read memory, write memory, execute code, and to define an
  26. * application entry PC.
  27. *
  28. * It is used to download an application to AR6K, to provide
  29. * patches to code that is already resident on AR6K, and generally
  30. * to examine and modify state. The Host has an opportunity to use
  31. * BMI only once during bootup. Once the Host issues a BMI_DONE
  32. * command, this opportunity ends.
  33. *
  34. * The Host writes BMI requests to mailbox0, and reads BMI responses
  35. * from mailbox0. BMI requests all begin with a command
  36. * (see below for specific commands), and are followed by
  37. * command-specific data.
  38. *
  39. * Flow control:
  40. * The Host can only issue a command once the Target gives it a
  41. * "BMI Command Credit", using AR6K Counter #4. As soon as the
  42. * Target has completed a command, it issues another BMI Command
  43. * Credit (so the Host can issue the next command).
  44. *
  45. * BMI handles all required Target-side cache flushing.
  46. */
  47. /* Maximum data size used for BMI transfers */
  48. #define BMI_DATASZ_MAX 256
  49. /* BMI Commands */
  50. #define BMI_NO_COMMAND 0
  51. #define BMI_DONE 1
  52. /*
  53. * Semantics: Host is done using BMI
  54. * Request format:
  55. * A_UINT32 command (BMI_DONE)
  56. * Response format: none
  57. */
  58. #define BMI_READ_MEMORY 2
  59. /*
  60. * Semantics: Host reads AR6K memory
  61. * Request format:
  62. * A_UINT32 command (BMI_READ_MEMORY)
  63. * A_UINT32 address
  64. * A_UINT32 length, at most BMI_DATASZ_MAX
  65. * Response format:
  66. * A_UINT8 data[length]
  67. */
  68. #define BMI_WRITE_MEMORY 3
  69. /*
  70. * Semantics: Host writes AR6K memory
  71. * Request format:
  72. * A_UINT32 command (BMI_WRITE_MEMORY)
  73. * A_UINT32 address
  74. * A_UINT32 length, at most BMI_DATASZ_MAX
  75. * A_UINT8 data[length]
  76. * Response format: none
  77. */
  78. #define BMI_EXECUTE 4
  79. /*
  80. * Semantics: Causes AR6K to execute code
  81. * Request format:
  82. * A_UINT32 command (BMI_EXECUTE)
  83. * A_UINT32 address
  84. * A_UINT32 parameter
  85. * Response format:
  86. * A_UINT32 return value
  87. */
  88. #define BMI_SET_APP_START 5
  89. /*
  90. * Semantics: Set Target application starting address
  91. * Request format:
  92. * A_UINT32 command (BMI_SET_APP_START)
  93. * A_UINT32 address
  94. * Response format: none
  95. */
  96. #define BMI_READ_SOC_REGISTER 6
  97. /*
  98. * Semantics: Read a 32-bit Target SOC register.
  99. * Request format:
  100. * A_UINT32 command (BMI_READ_REGISTER)
  101. * A_UINT32 address
  102. * Response format:
  103. * A_UINT32 value
  104. */
  105. #define BMI_WRITE_SOC_REGISTER 7
  106. /*
  107. * Semantics: Write a 32-bit Target SOC register.
  108. * Request format:
  109. * A_UINT32 command (BMI_WRITE_REGISTER)
  110. * A_UINT32 address
  111. * A_UINT32 value
  112. *
  113. * Response format: none
  114. */
  115. #define BMI_GET_TARGET_ID 8
  116. #define BMI_GET_TARGET_INFO 8
  117. /*
  118. * Semantics: Fetch the 4-byte Target information
  119. * Request format:
  120. * A_UINT32 command (BMI_GET_TARGET_ID/INFO)
  121. * Response format1 (old firmware):
  122. * A_UINT32 TargetVersionID
  123. * Response format2 (newer firmware):
  124. * A_UINT32 TARGET_VERSION_SENTINAL
  125. * struct bmi_target_info;
  126. */
  127. struct bmi_target_info {
  128. A_UINT32 target_info_byte_count; /* size of this structure */
  129. A_UINT32 target_ver; /* Target Version ID */
  130. A_UINT32 target_type; /* Target type */
  131. };
  132. #define TARGET_VERSION_SENTINAL 0xffffffff
  133. #define TARGET_TYPE_AR6001 1
  134. #define TARGET_TYPE_AR6002 2
  135. #define TARGET_TYPE_AR6003 3
  136. #define BMI_ROMPATCH_INSTALL 9
  137. /*
  138. * Semantics: Install a ROM Patch.
  139. * Request format:
  140. * A_UINT32 command (BMI_ROMPATCH_INSTALL)
  141. * A_UINT32 Target ROM Address
  142. * A_UINT32 Target RAM Address
  143. * A_UINT32 Size, in bytes
  144. * A_UINT32 Activate? 1-->activate;
  145. * 0-->install but do not activate
  146. * Response format:
  147. * A_UINT32 PatchID
  148. */
  149. #define BMI_ROMPATCH_UNINSTALL 10
  150. /*
  151. * Semantics: Uninstall a previously-installed ROM Patch,
  152. * automatically deactivating, if necessary.
  153. * Request format:
  154. * A_UINT32 command (BMI_ROMPATCH_UNINSTALL)
  155. * A_UINT32 PatchID
  156. *
  157. * Response format: none
  158. */
  159. #define BMI_ROMPATCH_ACTIVATE 11
  160. /*
  161. * Semantics: Activate a list of previously-installed ROM Patches.
  162. * Request format:
  163. * A_UINT32 command (BMI_ROMPATCH_ACTIVATE)
  164. * A_UINT32 rompatch_count
  165. * A_UINT32 PatchID[rompatch_count]
  166. *
  167. * Response format: none
  168. */
  169. #define BMI_ROMPATCH_DEACTIVATE 12
  170. /*
  171. * Semantics: Deactivate a list of active ROM Patches.
  172. * Request format:
  173. * A_UINT32 command (BMI_ROMPATCH_DEACTIVATE)
  174. * A_UINT32 rompatch_count
  175. * A_UINT32 PatchID[rompatch_count]
  176. *
  177. * Response format: none
  178. */
  179. #define BMI_LZ_STREAM_START 13
  180. /*
  181. * Semantics: Begin an LZ-compressed stream of input
  182. * which is to be uncompressed by the Target to an
  183. * output buffer at address. The output buffer must
  184. * be sufficiently large to hold the uncompressed
  185. * output from the compressed input stream. This BMI
  186. * command should be followed by a series of 1 or more
  187. * BMI_LZ_DATA commands.
  188. * A_UINT32 command (BMI_LZ_STREAM_START)
  189. * A_UINT32 address
  190. * Note: Not supported on all versions of ROM firmware.
  191. */
  192. #define BMI_LZ_DATA 14
  193. /*
  194. * Semantics: Host writes AR6K memory with LZ-compressed
  195. * data which is uncompressed by the Target. This command
  196. * must be preceded by a BMI_LZ_STREAM_START command. A series
  197. * of BMI_LZ_DATA commands are considered part of a single
  198. * input stream until another BMI_LZ_STREAM_START is issued.
  199. * Request format:
  200. * A_UINT32 command (BMI_LZ_DATA)
  201. * A_UINT32 length (of compressed data),
  202. * at most BMI_DATASZ_MAX
  203. * A_UINT8 CompressedData[length]
  204. * Response format: none
  205. * Note: Not supported on all versions of ROM firmware.
  206. */
  207. #endif /* __BMI_MSG_H__ */