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