Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
| 6 | * GPL LICENSE SUMMARY |
| 7 | * |
| 8 | * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 22 | * USA |
| 23 | * |
| 24 | * The full GNU General Public License is included in this distribution |
| 25 | * in the file called LICENSE.GPL. |
| 26 | * |
| 27 | * Contact Information: |
| 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
| 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 30 | * |
| 31 | * BSD LICENSE |
| 32 | * |
| 33 | * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. |
| 34 | * All rights reserved. |
| 35 | * |
| 36 | * Redistribution and use in source and binary forms, with or without |
| 37 | * modification, are permitted provided that the following conditions |
| 38 | * are met: |
| 39 | * |
| 40 | * * Redistributions of source code must retain the above copyright |
| 41 | * notice, this list of conditions and the following disclaimer. |
| 42 | * * Redistributions in binary form must reproduce the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer in |
| 44 | * the documentation and/or other materials provided with the |
| 45 | * distribution. |
| 46 | * * Neither the name Intel Corporation nor the names of its |
| 47 | * contributors may be used to endorse or promote products derived |
| 48 | * from this software without specific prior written permission. |
| 49 | * |
| 50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 61 | * |
| 62 | *****************************************************************************/ |
| 63 | #ifndef __IWL_TESTMODE_H__ |
| 64 | #define __IWL_TESTMODE_H__ |
| 65 | |
| 66 | #include <linux/types.h> |
| 67 | |
| 68 | |
Wey-Yi Guy | 4466320 | 2011-06-24 09:02:44 -0700 | [diff] [blame] | 69 | /* |
| 70 | * Commands from user space to kernel space(IWL_TM_CMD_ID_APP2DEV_XX) and |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 71 | * from and kernel space to user space(IWL_TM_CMD_ID_DEV2APP_XX). |
Wey-Yi Guy | 4466320 | 2011-06-24 09:02:44 -0700 | [diff] [blame] | 72 | * The command ID is carried with IWL_TM_ATTR_COMMAND. |
| 73 | * |
| 74 | * @IWL_TM_CMD_APP2DEV_UCODE: |
| 75 | * commands from user application to the uCode, |
| 76 | * the actual uCode host command ID is carried with |
| 77 | * IWL_TM_ATTR_UCODE_CMD_ID |
| 78 | * |
| 79 | * @IWL_TM_CMD_APP2DEV_REG_READ32: |
| 80 | * @IWL_TM_CMD_APP2DEV_REG_WRITE32: |
| 81 | * @IWL_TM_CMD_APP2DEV_REG_WRITE8: |
| 82 | * commands from user applicaiton to access register |
| 83 | * |
| 84 | * @IWL_TM_CMD_APP2DEV_GET_DEVICENAME: retrieve device name |
| 85 | * @IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: load initial uCode image |
| 86 | * @IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: perform calibration |
| 87 | * @IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: load runtime uCode image |
| 88 | * @IWL_TM_CMD_APP2DEV_GET_EEPROM: request EEPROM data |
| 89 | * @IWL_TM_CMD_APP2DEV_FIXRATE_REQ: set fix MCS |
| 90 | * commands fom user space for pure driver level operations |
| 91 | * |
| 92 | * @IWL_TM_CMD_APP2DEV_BEGIN_TRACE: |
| 93 | * @IWL_TM_CMD_APP2DEV_END_TRACE: |
| 94 | * @IWL_TM_CMD_APP2DEV_READ_TRACE: |
| 95 | * commands fom user space for uCode trace operations |
| 96 | * |
| 97 | * @IWL_TM_CMD_DEV2APP_SYNC_RSP: |
| 98 | * commands from kernel space to carry the synchronous response |
| 99 | * to user application |
| 100 | * @IWL_TM_CMD_DEV2APP_UCODE_RX_PKT: |
| 101 | * commands from kernel space to multicast the spontaneous messages |
| 102 | * to user application |
| 103 | * @IWL_TM_CMD_DEV2APP_EEPROM_RSP: |
| 104 | * commands from kernel space to carry the eeprom response |
| 105 | * to user application |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 106 | */ |
| 107 | enum iwl_tm_cmd_t { |
Wey-Yi Guy | 4466320 | 2011-06-24 09:02:44 -0700 | [diff] [blame] | 108 | IWL_TM_CMD_APP2DEV_UCODE = 1, |
| 109 | IWL_TM_CMD_APP2DEV_REG_READ32 = 2, |
| 110 | IWL_TM_CMD_APP2DEV_REG_WRITE32 = 3, |
| 111 | IWL_TM_CMD_APP2DEV_REG_WRITE8 = 4, |
| 112 | IWL_TM_CMD_APP2DEV_GET_DEVICENAME = 5, |
| 113 | IWL_TM_CMD_APP2DEV_LOAD_INIT_FW = 6, |
| 114 | IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB = 7, |
| 115 | IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW = 8, |
| 116 | IWL_TM_CMD_APP2DEV_GET_EEPROM = 9, |
| 117 | IWL_TM_CMD_APP2DEV_FIXRATE_REQ = 10, |
| 118 | IWL_TM_CMD_APP2DEV_BEGIN_TRACE = 11, |
| 119 | IWL_TM_CMD_APP2DEV_END_TRACE = 12, |
| 120 | IWL_TM_CMD_APP2DEV_READ_TRACE = 13, |
| 121 | IWL_TM_CMD_DEV2APP_SYNC_RSP = 14, |
| 122 | IWL_TM_CMD_DEV2APP_UCODE_RX_PKT = 15, |
| 123 | IWL_TM_CMD_DEV2APP_EEPROM_RSP = 16, |
| 124 | IWL_TM_CMD_MAX = 17, |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 125 | }; |
| 126 | |
Wey-Yi Guy | 4466320 | 2011-06-24 09:02:44 -0700 | [diff] [blame] | 127 | /* |
| 128 | * Atrribute filed in testmode command |
| 129 | * See enum iwl_tm_cmd_t. |
| 130 | * |
| 131 | * @IWL_TM_ATTR_NOT_APPLICABLE: |
| 132 | * The attribute is not applicable or invalid |
| 133 | * @IWL_TM_ATTR_COMMAND: |
| 134 | * From user space to kernel space: |
| 135 | * the command either destines to ucode, driver, or register; |
| 136 | * From kernel space to user space: |
| 137 | * the command either carries synchronous response, |
| 138 | * or the spontaneous message multicast from the device; |
| 139 | * |
| 140 | * @IWL_TM_ATTR_UCODE_CMD_ID: |
| 141 | * @IWL_TM_ATTR_UCODE_CMD_DATA: |
| 142 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE, |
| 143 | * The mandatory fields are : |
| 144 | * IWL_TM_ATTR_UCODE_CMD_ID for recognizable command ID; |
| 145 | * IWL_TM_ATTR_COMMAND_FLAG for the flags of the commands; |
| 146 | * The optional fields are: |
| 147 | * IWL_TM_ATTR_UCODE_CMD_DATA for the actual command payload |
| 148 | * to the ucode |
| 149 | * |
| 150 | * @IWL_TM_ATTR_REG_OFFSET: |
| 151 | * @IWL_TM_ATTR_REG_VALUE8: |
| 152 | * @IWL_TM_ATTR_REG_VALUE32: |
| 153 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_XXX, |
| 154 | * The mandatory fields are: |
| 155 | * IWL_TM_ATTR_REG_OFFSET for the offset of the target register; |
| 156 | * IWL_TM_ATTR_REG_VALUE8 or IWL_TM_ATTR_REG_VALUE32 for value |
| 157 | * |
| 158 | * @IWL_TM_ATTR_SYNC_RSP: |
| 159 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_SYNC_RSP, |
| 160 | * The mandatory fields are: |
| 161 | * IWL_TM_ATTR_SYNC_RSP for the data content responding to the user |
| 162 | * application command |
| 163 | * |
| 164 | * @IWL_TM_ATTR_UCODE_RX_PKT: |
| 165 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_UCODE_RX_PKT, |
| 166 | * The mandatory fields are: |
| 167 | * IWL_TM_ATTR_UCODE_RX_PKT for the data content multicast to the user |
| 168 | * application |
| 169 | * |
| 170 | * @IWL_TM_ATTR_EEPROM: |
| 171 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM, |
| 172 | * The mandatory fields are: |
| 173 | * IWL_TM_ATTR_EEPROM for the data content responging to the user |
| 174 | * application |
| 175 | * |
| 176 | * @IWL_TM_ATTR_TRACE_ADDR: |
| 177 | * @IWL_TM_ATTR_TRACE_SIZE: |
| 178 | * @IWL_TM_ATTR_TRACE_DUMP: |
| 179 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE, |
| 180 | * The mandatory fields are: |
| 181 | * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address |
| 182 | * IWL_TM_ATTR_MEM_TRACE_SIZE for the trace buffer size |
| 183 | * IWL_TM_ATTR_MEM_TRACE_DUMP for the trace dump |
| 184 | * |
| 185 | * @IWL_TM_ATTR_FIXRATE: |
| 186 | * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ, |
| 187 | * The mandatory fields are: |
| 188 | * IWL_TM_ATTR_FIXRATE for the fixed rate |
| 189 | * |
| 190 | */ |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 191 | enum iwl_tm_attr_t { |
Wey-Yi Guy | 4466320 | 2011-06-24 09:02:44 -0700 | [diff] [blame] | 192 | IWL_TM_ATTR_NOT_APPLICABLE = 0, |
| 193 | IWL_TM_ATTR_COMMAND = 1, |
| 194 | IWL_TM_ATTR_UCODE_CMD_ID = 2, |
| 195 | IWL_TM_ATTR_UCODE_CMD_DATA = 3, |
| 196 | IWL_TM_ATTR_REG_OFFSET = 4, |
| 197 | IWL_TM_ATTR_REG_VALUE8 = 5, |
| 198 | IWL_TM_ATTR_REG_VALUE32 = 6, |
| 199 | IWL_TM_ATTR_SYNC_RSP = 7, |
| 200 | IWL_TM_ATTR_UCODE_RX_PKT = 8, |
| 201 | IWL_TM_ATTR_EEPROM = 9, |
| 202 | IWL_TM_ATTR_TRACE_ADDR = 10, |
| 203 | IWL_TM_ATTR_TRACE_SIZE = 11, |
| 204 | IWL_TM_ATTR_TRACE_DUMP = 12, |
| 205 | IWL_TM_ATTR_FIXRATE = 13, |
| 206 | IWL_TM_ATTR_MAX = 14, |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 207 | }; |
| 208 | |
Wey-Yi Guy | 7a4e528 | 2011-05-06 10:21:28 -0700 | [diff] [blame] | 209 | /* uCode trace buffer */ |
Wey-Yi Guy | 49b7210 | 2011-05-30 10:29:37 -0700 | [diff] [blame] | 210 | #define TRACE_BUFF_SIZE_MAX 0x200000 |
| 211 | #define TRACE_BUFF_SIZE_MIN 0x20000 |
| 212 | #define TRACE_BUFF_SIZE_DEF TRACE_BUFF_SIZE_MIN |
Wey-Yi Guy | 7a4e528 | 2011-05-06 10:21:28 -0700 | [diff] [blame] | 213 | #define TRACE_BUFF_PADD 0x2000 |
Wey-Yi Guy | eb64dca | 2011-05-31 08:03:02 -0700 | [diff] [blame] | 214 | #define TRACE_CHUNK_SIZE (PAGE_SIZE - 1024) |
Cindy H. Kao | 4613e72 | 2011-05-06 10:40:15 -0700 | [diff] [blame] | 215 | |
| 216 | #endif |