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 * Bootloader Messaging Interface (BMI)
28 * BMI is a very simple messaging interface used during initialization
29 * to read memory, write memory, execute code, and to define an
30 * application entry PC.
32 * It is used to download an application to AR6K, to provide
33 * patches to code that is already resident on AR6K, and generally
34 * to examine and modify state. The Host has an opportunity to use
35 * BMI only once during bootup. Once the Host issues a BMI_DONE
36 * command, this opportunity ends.
38 * The Host writes BMI requests to mailbox0, and reads BMI responses
39 * from mailbox0. BMI requests all begin with a command
40 * (see below for specific commands), and are followed by
41 * command-specific data.
44 * The Host can only issue a command once the Target gives it a
45 * "BMI Command Credit", using AR6K Counter #4. As soon as the
46 * Target has completed a command, it issues another BMI Command
47 * Credit (so the Host can issue the next command).
49 * BMI handles all required Target-side cache flushing.
53 /* Maximum data size used for BMI transfers */
54 #define BMI_DATASZ_MAX 256
58 #define BMI_NO_COMMAND 0
62 * Semantics: Host is done using BMI
64 * u32 command (BMI_DONE)
65 * Response format: none
68 #define BMI_READ_MEMORY 2
70 * Semantics: Host reads AR6K memory
72 * u32 command (BMI_READ_MEMORY)
74 * u32 length, at most BMI_DATASZ_MAX
79 #define BMI_WRITE_MEMORY 3
81 * Semantics: Host writes AR6K memory
83 * u32 command (BMI_WRITE_MEMORY)
85 * u32 length, at most BMI_DATASZ_MAX
87 * Response format: none
92 * Semantics: Causes AR6K to execute code
94 * u32 command (BMI_EXECUTE)
101 #define BMI_SET_APP_START 5
103 * Semantics: Set Target application starting address
105 * u32 command (BMI_SET_APP_START)
107 * Response format: none
110 #define BMI_READ_SOC_REGISTER 6
112 * Semantics: Read a 32-bit Target SOC register.
114 * u32 command (BMI_READ_REGISTER)
120 #define BMI_WRITE_SOC_REGISTER 7
122 * Semantics: Write a 32-bit Target SOC register.
124 * u32 command (BMI_WRITE_REGISTER)
128 * Response format: none
131 #define BMI_GET_TARGET_ID 8
132 #define BMI_GET_TARGET_INFO 8
134 * Semantics: Fetch the 4-byte Target information
136 * u32 command (BMI_GET_TARGET_ID/INFO)
137 * Response format1 (old firmware):
138 * u32 TargetVersionID
139 * Response format2 (newer firmware):
140 * u32 TARGET_VERSION_SENTINAL
141 * struct bmi_target_info;
144 PREPACK struct bmi_target_info {
145 u32 target_info_byte_count; /* size of this structure */
146 u32 target_ver; /* Target Version ID */
147 u32 target_type; /* Target type */
149 #define TARGET_VERSION_SENTINAL 0xffffffff
150 #define TARGET_TYPE_AR6001 1
151 #define TARGET_TYPE_AR6002 2
152 #define TARGET_TYPE_AR6003 3
155 #define BMI_ROMPATCH_INSTALL 9
157 * Semantics: Install a ROM Patch.
159 * u32 command (BMI_ROMPATCH_INSTALL)
160 * u32 Target ROM Address
161 * u32 Target RAM Address or Value (depending on Target Type)
163 * u32 Activate? 1-->activate;
164 * 0-->install but do not activate
169 #define BMI_ROMPATCH_UNINSTALL 10
171 * Semantics: Uninstall a previously-installed ROM Patch,
172 * automatically deactivating, if necessary.
174 * u32 command (BMI_ROMPATCH_UNINSTALL)
177 * Response format: none
180 #define BMI_ROMPATCH_ACTIVATE 11
182 * Semantics: Activate a list of previously-installed ROM Patches.
184 * u32 command (BMI_ROMPATCH_ACTIVATE)
186 * u32 PatchID[rompatch_count]
188 * Response format: none
191 #define BMI_ROMPATCH_DEACTIVATE 12
193 * Semantics: Deactivate a list of active ROM Patches.
195 * u32 command (BMI_ROMPATCH_DEACTIVATE)
197 * u32 PatchID[rompatch_count]
199 * Response format: none
203 #define BMI_LZ_STREAM_START 13
205 * Semantics: Begin an LZ-compressed stream of input
206 * which is to be uncompressed by the Target to an
207 * output buffer at address. The output buffer must
208 * be sufficiently large to hold the uncompressed
209 * output from the compressed input stream. This BMI
210 * command should be followed by a series of 1 or more
211 * BMI_LZ_DATA commands.
212 * u32 command (BMI_LZ_STREAM_START)
214 * Note: Not supported on all versions of ROM firmware.
217 #define BMI_LZ_DATA 14
219 * Semantics: Host writes AR6K memory with LZ-compressed
220 * data which is uncompressed by the Target. This command
221 * must be preceded by a BMI_LZ_STREAM_START command. A series
222 * of BMI_LZ_DATA commands are considered part of a single
223 * input stream until another BMI_LZ_STREAM_START is issued.
225 * u32 command (BMI_LZ_DATA)
226 * u32 length (of compressed data),
227 * at most BMI_DATASZ_MAX
228 * u8 CompressedData[length]
229 * Response format: none
230 * Note: Not supported on all versions of ROM firmware.
233 #endif /* __BMI_MSG_H__ */