5 * Copyright (c) 2004-2007 Atheros Communications Inc.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation;
13 * Software distributed under the License is distributed on an "AS
14 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
15 * implied. See the License for the specific language governing
16 * rights and limitations under the License.
23 * Bootloader Messaging Interface (BMI)
25 * BMI is a very simple messaging interface used during initialization
26 * to read memory, write memory, execute code, and to define an
27 * application entry PC.
29 * It is used to download an application to AR6K, to provide
30 * patches to code that is already resident on AR6K, and generally
31 * to examine and modify state. The Host has an opportunity to use
32 * BMI only once during bootup. Once the Host issues a BMI_DONE
33 * command, this opportunity ends.
35 * The Host writes BMI requests to mailbox0, and reads BMI responses
36 * from mailbox0. BMI requests all begin with a command
37 * (see below for specific commands), and are followed by
38 * command-specific data.
41 * The Host can only issue a command once the Target gives it a
42 * "BMI Command Credit", using AR6K Counter #4. As soon as the
43 * Target has completed a command, it issues another BMI Command
44 * Credit (so the Host can issue the next command).
46 * BMI handles all required Target-side cache flushing.
50 /* Maximum data size used for BMI transfers */
51 #define BMI_DATASZ_MAX 32
55 #define BMI_NO_COMMAND 0
59 * Semantics: Host is done using BMI
61 * A_UINT32 command (BMI_DONE)
62 * Response format: none
65 #define BMI_READ_MEMORY 2
67 * Semantics: Host reads AR6K memory
69 * A_UINT32 command (BMI_READ_MEMORY)
71 * A_UINT32 length, at most BMI_DATASZ_MAX
73 * A_UINT8 data[length]
76 #define BMI_WRITE_MEMORY 3
78 * Semantics: Host writes AR6K memory
80 * A_UINT32 command (BMI_WRITE_MEMORY)
82 * A_UINT32 length, at most BMI_DATASZ_MAX
83 * A_UINT8 data[length]
84 * Response format: none
89 * Semantics: Causes AR6K to execute code
91 * A_UINT32 command (BMI_EXECUTE)
95 * A_UINT32 return value
98 #define BMI_SET_APP_START 5
100 * Semantics: Set Target application starting address
102 * A_UINT32 command (BMI_SET_APP_START)
104 * Response format: none
107 #define BMI_READ_SOC_REGISTER 6
109 * Semantics: Read a 32-bit Target SOC register.
111 * A_UINT32 command (BMI_READ_REGISTER)
117 #define BMI_WRITE_SOC_REGISTER 7
119 * Semantics: Write a 32-bit Target SOC register.
121 * A_UINT32 command (BMI_WRITE_REGISTER)
125 * Response format: none
128 #define BMI_GET_TARGET_ID 8
129 #define BMI_GET_TARGET_INFO 8
131 * Semantics: Fetch the 4-byte Target information
133 * A_UINT32 command (BMI_GET_TARGET_ID/INFO)
134 * Response format1 (old firmware):
135 * A_UINT32 TargetVersionID
136 * Response format2 (newer firmware):
137 * A_UINT32 TARGET_VERSION_SENTINAL
138 * struct bmi_target_info;
141 struct bmi_target_info
{
142 A_UINT32 target_info_byte_count
; /* size of this structure */
143 A_UINT32 target_ver
; /* Target Version ID */
144 A_UINT32 target_type
; /* Target type */
146 #define TARGET_VERSION_SENTINAL 0xffffffff
147 #define TARGET_TYPE_AR6001 1
148 #define TARGET_TYPE_AR6002 2
151 #define BMI_ROMPATCH_INSTALL 9
153 * Semantics: Install a ROM Patch.
155 * A_UINT32 command (BMI_ROMPATCH_INSTALL)
156 * A_UINT32 Target ROM Address
157 * A_UINT32 Target RAM Address
158 * A_UINT32 Size, in bytes
159 * A_UINT32 Activate? 1-->activate;
160 * 0-->install but do not activate
165 #define BMI_ROMPATCH_UNINSTALL 10
167 * Semantics: Uninstall a previously-installed ROM Patch,
168 * automatically deactivating, if necessary.
170 * A_UINT32 command (BMI_ROMPATCH_UNINSTALL)
173 * Response format: none
176 #define BMI_ROMPATCH_ACTIVATE 11
178 * Semantics: Activate a list of previously-installed ROM Patches.
180 * A_UINT32 command (BMI_ROMPATCH_ACTIVATE)
181 * A_UINT32 rompatch_count
182 * A_UINT32 PatchID[rompatch_count]
184 * Response format: none
187 #define BMI_ROMPATCH_DEACTIVATE 12
189 * Semantics: Deactivate a list of active ROM Patches.
191 * A_UINT32 command (BMI_ROMPATCH_DEACTIVATE)
192 * A_UINT32 rompatch_count
193 * A_UINT32 PatchID[rompatch_count]
195 * Response format: none
199 #endif /* __BMI_MSG_H__ */