Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [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) 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 9 | * Copyright(c) 2014 Intel Mobile Communications GmbH |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of version 2 of the GNU General Public License as |
| 13 | * published by the Free Software Foundation. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 23 | * USA |
| 24 | * |
| 25 | * The full GNU General Public License is included in this distribution |
| 26 | * in the file called COPYING. |
| 27 | * |
| 28 | * Contact Information: |
| 29 | * Intel Linux Wireless <ilw@linux.intel.com> |
| 30 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 31 | * |
| 32 | * BSD LICENSE |
| 33 | * |
| 34 | * Copyright(c) 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 35 | * Copyright(c) 2014 Intel Mobile Communications GmbH |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 36 | * All rights reserved. |
| 37 | * |
| 38 | * Redistribution and use in source and binary forms, with or without |
| 39 | * modification, are permitted provided that the following conditions |
| 40 | * are met: |
| 41 | * |
| 42 | * * Redistributions of source code must retain the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer. |
| 44 | * * Redistributions in binary form must reproduce the above copyright |
| 45 | * notice, this list of conditions and the following disclaimer in |
| 46 | * the documentation and/or other materials provided with the |
| 47 | * distribution. |
| 48 | * * Neither the name Intel Corporation nor the names of its |
| 49 | * contributors may be used to endorse or promote products derived |
| 50 | * from this software without specific prior written permission. |
| 51 | * |
| 52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 53 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 54 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 55 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 56 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 57 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 58 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 59 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 60 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 61 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 62 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 63 | *****************************************************************************/ |
| 64 | |
| 65 | #ifndef __fw_error_dump_h__ |
| 66 | #define __fw_error_dump_h__ |
| 67 | |
| 68 | #include <linux/types.h> |
| 69 | |
| 70 | #define IWL_FW_ERROR_DUMP_BARKER 0x14789632 |
| 71 | |
| 72 | /** |
| 73 | * enum iwl_fw_error_dump_type - types of data in the dump file |
| 74 | * @IWL_FW_ERROR_DUMP_SRAM: |
Emmanuel Grumbach | 473ad71 | 2014-07-08 19:44:25 +0300 | [diff] [blame] | 75 | * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0 |
Emmanuel Grumbach | 7b445f3 | 2014-03-20 11:08:19 +0200 | [diff] [blame] | 76 | * @IWL_FW_ERROR_DUMP_RXF: |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 77 | * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as |
| 78 | * &struct iwl_fw_error_dump_txcmd packets |
Emmanuel Grumbach | 06ddbf5 | 2014-06-02 08:34:53 +0300 | [diff] [blame] | 79 | * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info |
| 80 | * info on the device / firmware. |
Emmanuel Grumbach | c2d2020 | 2014-06-01 08:05:52 +0300 | [diff] [blame] | 81 | * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor |
Emmanuel Grumbach | 67c65f2 | 2014-06-26 11:27:51 +0300 | [diff] [blame] | 82 | * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several |
| 83 | * sections like this in a single file. |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 84 | */ |
| 85 | enum iwl_fw_error_dump_type { |
| 86 | IWL_FW_ERROR_DUMP_SRAM = 0, |
Emmanuel Grumbach | 473ad71 | 2014-07-08 19:44:25 +0300 | [diff] [blame] | 87 | IWL_FW_ERROR_DUMP_CSR = 1, |
Emmanuel Grumbach | 7b445f3 | 2014-03-20 11:08:19 +0200 | [diff] [blame] | 88 | IWL_FW_ERROR_DUMP_RXF = 2, |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 89 | IWL_FW_ERROR_DUMP_TXCMD = 3, |
Emmanuel Grumbach | 06ddbf5 | 2014-06-02 08:34:53 +0300 | [diff] [blame] | 90 | IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4, |
Emmanuel Grumbach | c2d2020 | 2014-06-01 08:05:52 +0300 | [diff] [blame] | 91 | IWL_FW_ERROR_DUMP_FW_MONITOR = 5, |
Emmanuel Grumbach | 67c65f2 | 2014-06-26 11:27:51 +0300 | [diff] [blame] | 92 | IWL_FW_ERROR_DUMP_PRPH = 6, |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 93 | |
| 94 | IWL_FW_ERROR_DUMP_MAX, |
| 95 | }; |
| 96 | |
| 97 | /** |
| 98 | * struct iwl_fw_error_dump_data - data for one type |
| 99 | * @type: %enum iwl_fw_error_dump_type |
Emmanuel Grumbach | d484927 | 2014-06-24 14:34:28 +0300 | [diff] [blame] | 100 | * @len: the length starting from %data |
| 101 | * @data: the data itself |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 102 | */ |
| 103 | struct iwl_fw_error_dump_data { |
| 104 | __le32 type; |
| 105 | __le32 len; |
| 106 | __u8 data[]; |
Emmanuel Grumbach | 7b445f3 | 2014-03-20 11:08:19 +0200 | [diff] [blame] | 107 | } __packed; |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * struct iwl_fw_error_dump_file - the layout of the header of the file |
| 111 | * @barker: must be %IWL_FW_ERROR_DUMP_BARKER |
| 112 | * @file_len: the length of all the file starting from %barker |
| 113 | * @data: array of %struct iwl_fw_error_dump_data |
| 114 | */ |
| 115 | struct iwl_fw_error_dump_file { |
| 116 | __le32 barker; |
| 117 | __le32 file_len; |
| 118 | u8 data[0]; |
Emmanuel Grumbach | 7b445f3 | 2014-03-20 11:08:19 +0200 | [diff] [blame] | 119 | } __packed; |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 120 | |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 121 | /** |
| 122 | * struct iwl_fw_error_dump_txcmd - TX command data |
| 123 | * @cmdlen: original length of command |
| 124 | * @caplen: captured length of command (may be less) |
| 125 | * @data: captured command data, @caplen bytes |
| 126 | */ |
| 127 | struct iwl_fw_error_dump_txcmd { |
| 128 | __le32 cmdlen; |
| 129 | __le32 caplen; |
| 130 | u8 data[]; |
| 131 | } __packed; |
| 132 | |
Emmanuel Grumbach | 06ddbf5 | 2014-06-02 08:34:53 +0300 | [diff] [blame] | 133 | enum iwl_fw_error_dump_family { |
| 134 | IWL_FW_ERROR_DUMP_FAMILY_7 = 7, |
| 135 | IWL_FW_ERROR_DUMP_FAMILY_8 = 8, |
| 136 | }; |
| 137 | |
| 138 | /** |
| 139 | * struct iwl_fw_error_dump_info - info on the device / firmware |
| 140 | * @device_family: the family of the device (7 / 8) |
| 141 | * @hw_step: the step of the device |
| 142 | * @fw_human_readable: human readable FW version |
| 143 | * @dev_human_readable: name of the device |
| 144 | * @bus_human_readable: name of the bus used |
| 145 | */ |
| 146 | struct iwl_fw_error_dump_info { |
| 147 | __le32 device_family; |
| 148 | __le32 hw_step; |
| 149 | u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ]; |
| 150 | u8 dev_human_readable[64]; |
| 151 | u8 bus_human_readable[8]; |
| 152 | } __packed; |
| 153 | |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 154 | /** |
Emmanuel Grumbach | c544e9c | 2014-06-26 09:54:23 +0300 | [diff] [blame] | 155 | * struct iwl_fw_error_dump_fw_mon - FW monitor data |
Emmanuel Grumbach | c2d2020 | 2014-06-01 08:05:52 +0300 | [diff] [blame] | 156 | * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer |
| 157 | * @fw_mon_base_ptr: base pointer of the data |
| 158 | * @fw_mon_cycle_cnt: number of wrap arounds |
| 159 | * @reserved: for future use |
| 160 | * @data: captured data |
| 161 | */ |
Emmanuel Grumbach | c544e9c | 2014-06-26 09:54:23 +0300 | [diff] [blame] | 162 | struct iwl_fw_error_dump_fw_mon { |
Emmanuel Grumbach | c2d2020 | 2014-06-01 08:05:52 +0300 | [diff] [blame] | 163 | __le32 fw_mon_wr_ptr; |
| 164 | __le32 fw_mon_base_ptr; |
| 165 | __le32 fw_mon_cycle_cnt; |
| 166 | __le32 reserved[3]; |
| 167 | u8 data[]; |
| 168 | } __packed; |
| 169 | |
| 170 | /** |
Emmanuel Grumbach | 67c65f2 | 2014-06-26 11:27:51 +0300 | [diff] [blame] | 171 | * struct iwl_fw_error_dump_prph - periphery registers data |
| 172 | * @prph_start: address of the first register in this chunk |
| 173 | * @data: the content of the registers |
| 174 | */ |
| 175 | struct iwl_fw_error_dump_prph { |
| 176 | __le32 prph_start; |
| 177 | __le32 data[]; |
| 178 | }; |
| 179 | |
| 180 | /** |
Emmanuel Grumbach | 1fa1605 | 2014-06-05 13:50:31 +0300 | [diff] [blame] | 181 | * iwl_fw_error_next_data - advance fw error dump data pointer |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 182 | * @data: previous data block |
| 183 | * Returns: next data block |
| 184 | */ |
| 185 | static inline struct iwl_fw_error_dump_data * |
Emmanuel Grumbach | 1fa1605 | 2014-06-05 13:50:31 +0300 | [diff] [blame] | 186 | iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data) |
Johannes Berg | 4d07500 | 2014-04-24 10:41:31 +0200 | [diff] [blame] | 187 | { |
| 188 | return (void *)(data->data + le32_to_cpu(data->len)); |
| 189 | } |
| 190 | |
Emmanuel Grumbach | 1bd3cbc | 2014-03-18 21:15:06 +0200 | [diff] [blame] | 191 | #endif /* __fw_error_dump_h__ */ |