1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. 3 // 4 // 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. 8 // 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. 16 // 17 // 18 // 19 // Author(s): ="Atheros" 20 //------------------------------------------------------------------------------ 21 22 #ifndef __BMI_MSG_H__ 23 #define __BMI_MSG_H__ 24 25 #ifndef ATH_TARGET 26 #include "athstartpack.h" 27 #endif 28 29 /* 30 * Bootloader Messaging Interface (BMI) 31 * 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. 35 * 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. 41 * 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. 46 * 47 * Flow control: 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). 52 * 53 * BMI handles all required Target-side cache flushing. 54 */ 55 56 57 /* Maximum data size used for BMI transfers */ 58 #define BMI_DATASZ_MAX 256 59 60 /* BMI Commands */ 61 62 #define BMI_NO_COMMAND 0 63 64 #define BMI_DONE 1 65 /* 66 * Semantics: Host is done using BMI 67 * Request format: 68 * u32 command (BMI_DONE) 69 * Response format: none 70 */ 71 72 #define BMI_READ_MEMORY 2 73 /* 74 * Semantics: Host reads AR6K memory 75 * Request format: 76 * u32 command (BMI_READ_MEMORY) 77 * u32 address 78 * u32 length, at most BMI_DATASZ_MAX 79 * Response format: 80 * u8 data[length] 81 */ 82 83 #define BMI_WRITE_MEMORY 3 84 /* 85 * Semantics: Host writes AR6K memory 86 * Request format: 87 * u32 command (BMI_WRITE_MEMORY) 88 * u32 address 89 * u32 length, at most BMI_DATASZ_MAX 90 * u8 data[length] 91 * Response format: none 92 */ 93 94 #define BMI_EXECUTE 4 95 /* 96 * Semantics: Causes AR6K to execute code 97 * Request format: 98 * u32 command (BMI_EXECUTE) 99 * u32 address 100 * u32 parameter 101 * Response format: 102 * u32 return value 103 */ 104 105 #define BMI_SET_APP_START 5 106 /* 107 * Semantics: Set Target application starting address 108 * Request format: 109 * u32 command (BMI_SET_APP_START) 110 * u32 address 111 * Response format: none 112 */ 113 114 #define BMI_READ_SOC_REGISTER 6 115 /* 116 * Semantics: Read a 32-bit Target SOC register. 117 * Request format: 118 * u32 command (BMI_READ_REGISTER) 119 * u32 address 120 * Response format: 121 * u32 value 122 */ 123 124 #define BMI_WRITE_SOC_REGISTER 7 125 /* 126 * Semantics: Write a 32-bit Target SOC register. 127 * Request format: 128 * u32 command (BMI_WRITE_REGISTER) 129 * u32 address 130 * u32 value 131 * 132 * Response format: none 133 */ 134 135 #define BMI_GET_TARGET_ID 8 136 #define BMI_GET_TARGET_INFO 8 137 /* 138 * Semantics: Fetch the 4-byte Target information 139 * Request format: 140 * u32 command (BMI_GET_TARGET_ID/INFO) 141 * Response format1 (old firmware): 142 * u32 TargetVersionID 143 * Response format2 (newer firmware): 144 * u32 TARGET_VERSION_SENTINAL 145 * struct bmi_target_info; 146 */ 147 148 PREPACK struct bmi_target_info { 149 u32 target_info_byte_count; /* size of this structure */ 150 u32 target_ver; /* Target Version ID */ 151 u32 target_type; /* Target type */ 152 } POSTPACK; 153 #define TARGET_VERSION_SENTINAL 0xffffffff 154 #define TARGET_TYPE_AR6001 1 155 #define TARGET_TYPE_AR6002 2 156 #define TARGET_TYPE_AR6003 3 157 158 159 #define BMI_ROMPATCH_INSTALL 9 160 /* 161 * Semantics: Install a ROM Patch. 162 * Request format: 163 * u32 command (BMI_ROMPATCH_INSTALL) 164 * u32 Target ROM Address 165 * u32 Target RAM Address or Value (depending on Target Type) 166 * u32 Size, in bytes 167 * u32 Activate? 1-->activate; 168 * 0-->install but do not activate 169 * Response format: 170 * u32 PatchID 171 */ 172 173 #define BMI_ROMPATCH_UNINSTALL 10 174 /* 175 * Semantics: Uninstall a previously-installed ROM Patch, 176 * automatically deactivating, if necessary. 177 * Request format: 178 * u32 command (BMI_ROMPATCH_UNINSTALL) 179 * u32 PatchID 180 * 181 * Response format: none 182 */ 183 184 #define BMI_ROMPATCH_ACTIVATE 11 185 /* 186 * Semantics: Activate a list of previously-installed ROM Patches. 187 * Request format: 188 * u32 command (BMI_ROMPATCH_ACTIVATE) 189 * u32 rompatch_count 190 * u32 PatchID[rompatch_count] 191 * 192 * Response format: none 193 */ 194 195 #define BMI_ROMPATCH_DEACTIVATE 12 196 /* 197 * Semantics: Deactivate a list of active ROM Patches. 198 * Request format: 199 * u32 command (BMI_ROMPATCH_DEACTIVATE) 200 * u32 rompatch_count 201 * u32 PatchID[rompatch_count] 202 * 203 * Response format: none 204 */ 205 206 207 #define BMI_LZ_STREAM_START 13 208 /* 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 * u32 command (BMI_LZ_STREAM_START) 217 * u32 address 218 * Note: Not supported on all versions of ROM firmware. 219 */ 220 221 #define BMI_LZ_DATA 14 222 /* 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. 228 * Request format: 229 * u32 command (BMI_LZ_DATA) 230 * u32 length (of compressed data), 231 * at most BMI_DATASZ_MAX 232 * u8 CompressedData[length] 233 * Response format: none 234 * Note: Not supported on all versions of ROM firmware. 235 */ 236 237 #ifndef ATH_TARGET 238 #include "athendpack.h" 239 #endif 240 241 #endif /* __BMI_MSG_H__ */ 242