1 //------------------------------------------------------------------------------
2 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
5 // Permission to use, copy, modify, and/or distribute this software for any
6 // purpose with or without fee is hereby granted, provided that the above
7 // copyright notice and this permission notice appear in all copies.
9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 // Author(s): ="Atheros"
20 //------------------------------------------------------------------------------
26 #include "athstartpack.h"
30 * Bootloader Messaging Interface (BMI)
32 * BMI is a very simple messaging interface used during initialization
33 * to read memory, write memory, execute code, and to define an
34 * application entry PC.
36 * It is used to download an application to AR6K, to provide
37 * patches to code that is already resident on AR6K, and generally
38 * to examine and modify state. The Host has an opportunity to use
39 * BMI only once during bootup. Once the Host issues a BMI_DONE
40 * command, this opportunity ends.
42 * The Host writes BMI requests to mailbox0, and reads BMI responses
43 * from mailbox0. BMI requests all begin with a command
44 * (see below for specific commands), and are followed by
45 * command-specific data.
48 * The Host can only issue a command once the Target gives it a
49 * "BMI Command Credit", using AR6K Counter #4. As soon as the
50 * Target has completed a command, it issues another BMI Command
51 * Credit (so the Host can issue the next command).
53 * BMI handles all required Target-side cache flushing.
57 /* Maximum data size used for BMI transfers */
58 #define BMI_DATASZ_MAX 256
62 #define BMI_NO_COMMAND 0
66 * Semantics: Host is done using BMI
68 * A_UINT32 command (BMI_DONE)
69 * Response format: none
72 #define BMI_READ_MEMORY 2
74 * Semantics: Host reads AR6K memory
76 * A_UINT32 command (BMI_READ_MEMORY)
78 * A_UINT32 length, at most BMI_DATASZ_MAX
80 * A_UINT8 data[length]
83 #define BMI_WRITE_MEMORY 3
85 * Semantics: Host writes AR6K memory
87 * A_UINT32 command (BMI_WRITE_MEMORY)
89 * A_UINT32 length, at most BMI_DATASZ_MAX
90 * A_UINT8 data[length]
91 * Response format: none
96 * Semantics: Causes AR6K to execute code
98 * A_UINT32 command (BMI_EXECUTE)
102 * A_UINT32 return value
105 #define BMI_SET_APP_START 5
107 * Semantics: Set Target application starting address
109 * A_UINT32 command (BMI_SET_APP_START)
111 * Response format: none
114 #define BMI_READ_SOC_REGISTER 6
116 * Semantics: Read a 32-bit Target SOC register.
118 * A_UINT32 command (BMI_READ_REGISTER)
124 #define BMI_WRITE_SOC_REGISTER 7
126 * Semantics: Write a 32-bit Target SOC register.
128 * A_UINT32 command (BMI_WRITE_REGISTER)
132 * Response format: none
135 #define BMI_GET_TARGET_ID 8
136 #define BMI_GET_TARGET_INFO 8
138 * Semantics: Fetch the 4-byte Target information
140 * A_UINT32 command (BMI_GET_TARGET_ID/INFO)
141 * Response format1 (old firmware):
142 * A_UINT32 TargetVersionID
143 * Response format2 (newer firmware):
144 * A_UINT32 TARGET_VERSION_SENTINAL
145 * struct bmi_target_info;
148 PREPACK struct bmi_target_info {
149 A_UINT32 target_info_byte_count; /* size of this structure */
150 A_UINT32 target_ver; /* Target Version ID */
151 A_UINT32 target_type; /* Target type */
153 #define TARGET_VERSION_SENTINAL 0xffffffff
154 #define TARGET_TYPE_AR6001 1
155 #define TARGET_TYPE_AR6002 2
156 #define TARGET_TYPE_AR6003 3
159 #define BMI_ROMPATCH_INSTALL 9
161 * Semantics: Install a ROM Patch.
163 * A_UINT32 command (BMI_ROMPATCH_INSTALL)
164 * A_UINT32 Target ROM Address
165 * A_UINT32 Target RAM Address or Value (depending on Target Type)
166 * A_UINT32 Size, in bytes
167 * A_UINT32 Activate? 1-->activate;
168 * 0-->install but do not activate
173 #define BMI_ROMPATCH_UNINSTALL 10
175 * Semantics: Uninstall a previously-installed ROM Patch,
176 * automatically deactivating, if necessary.
178 * A_UINT32 command (BMI_ROMPATCH_UNINSTALL)
181 * Response format: none
184 #define BMI_ROMPATCH_ACTIVATE 11
186 * Semantics: Activate a list of previously-installed ROM Patches.
188 * A_UINT32 command (BMI_ROMPATCH_ACTIVATE)
189 * A_UINT32 rompatch_count
190 * A_UINT32 PatchID[rompatch_count]
192 * Response format: none
195 #define BMI_ROMPATCH_DEACTIVATE 12
197 * Semantics: Deactivate a list of active ROM Patches.
199 * A_UINT32 command (BMI_ROMPATCH_DEACTIVATE)
200 * A_UINT32 rompatch_count
201 * A_UINT32 PatchID[rompatch_count]
203 * Response format: none
207 #define BMI_LZ_STREAM_START 13
209 * Semantics: Begin an LZ-compressed stream of input
210 * which is to be uncompressed by the Target to an
211 * output buffer at address. The output buffer must
212 * be sufficiently large to hold the uncompressed
213 * output from the compressed input stream. This BMI
214 * command should be followed by a series of 1 or more
215 * BMI_LZ_DATA commands.
216 * A_UINT32 command (BMI_LZ_STREAM_START)
218 * Note: Not supported on all versions of ROM firmware.
221 #define BMI_LZ_DATA 14
223 * Semantics: Host writes AR6K memory with LZ-compressed
224 * data which is uncompressed by the Target. This command
225 * must be preceded by a BMI_LZ_STREAM_START command. A series
226 * of BMI_LZ_DATA commands are considered part of a single
227 * input stream until another BMI_LZ_STREAM_START is issued.
229 * A_UINT32 command (BMI_LZ_DATA)
230 * A_UINT32 length (of compressed data),
231 * at most BMI_DATASZ_MAX
232 * A_UINT8 CompressedData[length]
233 * Response format: none
234 * Note: Not supported on all versions of ROM firmware.
238 #include "athendpack.h"
241 #endif /* __BMI_MSG_H__ */