.. | .. |
---|
6 | 6 | * GPL LICENSE SUMMARY |
---|
7 | 7 | * |
---|
8 | 8 | * Copyright(c) 2017 Intel Deutschland GmbH |
---|
9 | | - * Copyright(c) 2018 Intel Corporation |
---|
| 9 | + * Copyright (C) 2018-2020 Intel Corporation |
---|
10 | 10 | * |
---|
11 | 11 | * This program is free software; you can redistribute it and/or modify |
---|
12 | 12 | * it under the terms of version 2 of the GNU General Public License as |
---|
.. | .. |
---|
27 | 27 | * BSD LICENSE |
---|
28 | 28 | * |
---|
29 | 29 | * Copyright(c) 2017 Intel Deutschland GmbH |
---|
30 | | - * Copyright(c) 2018 Intel Corporation |
---|
| 30 | + * Copyright (C) 2018-2020 Intel Corporation |
---|
31 | 31 | * All rights reserved. |
---|
32 | 32 | * |
---|
33 | 33 | * Redistribution and use in source and binary forms, with or without |
---|
.. | .. |
---|
65 | 65 | #include "img.h" |
---|
66 | 66 | #include "fw/api/debug.h" |
---|
67 | 67 | #include "fw/api/paging.h" |
---|
| 68 | +#include "fw/api/power.h" |
---|
68 | 69 | #include "iwl-eeprom-parse.h" |
---|
| 70 | +#include "fw/acpi.h" |
---|
69 | 71 | |
---|
70 | 72 | struct iwl_fw_runtime_ops { |
---|
71 | 73 | int (*dump_start)(void *ctx); |
---|
72 | 74 | void (*dump_end)(void *ctx); |
---|
73 | 75 | bool (*fw_running)(void *ctx); |
---|
| 76 | + int (*send_hcmd)(void *ctx, struct iwl_host_cmd *host_cmd); |
---|
| 77 | + bool (*d3_debug_enable)(void *ctx); |
---|
74 | 78 | }; |
---|
75 | 79 | |
---|
76 | 80 | #define MAX_NUM_LMAC 2 |
---|
.. | .. |
---|
82 | 86 | u32 rxfifo1_size; |
---|
83 | 87 | } lmac[MAX_NUM_LMAC]; |
---|
84 | 88 | u32 rxfifo2_size; |
---|
| 89 | + u32 rxfifo2_control_size; |
---|
85 | 90 | u32 internal_txfifo_addr; |
---|
86 | 91 | u32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM]; |
---|
87 | 92 | }; |
---|
88 | 93 | |
---|
89 | | -enum iwl_fw_runtime_status { |
---|
90 | | - IWL_FWRT_STATUS_DUMPING = 0, |
---|
| 94 | +#define IWL_FW_RUNTIME_DUMP_WK_NUM 5 |
---|
| 95 | + |
---|
| 96 | +/** |
---|
| 97 | + * struct iwl_fwrt_dump_data - dump data |
---|
| 98 | + * @trig: trigger the worker was scheduled upon |
---|
| 99 | + * @fw_pkt: packet received from FW |
---|
| 100 | + */ |
---|
| 101 | +struct iwl_fwrt_dump_data { |
---|
| 102 | + union { |
---|
| 103 | + struct { |
---|
| 104 | + struct iwl_fw_ini_trigger_tlv *trig; |
---|
| 105 | + struct iwl_rx_packet *fw_pkt; |
---|
| 106 | + }; |
---|
| 107 | + struct { |
---|
| 108 | + const struct iwl_fw_dump_desc *desc; |
---|
| 109 | + bool monitor_only; |
---|
| 110 | + }; |
---|
| 111 | + }; |
---|
| 112 | +}; |
---|
| 113 | + |
---|
| 114 | +/** |
---|
| 115 | + * struct iwl_fwrt_wk_data - dump worker data struct |
---|
| 116 | + * @idx: index of the worker |
---|
| 117 | + * @wk: worker |
---|
| 118 | + */ |
---|
| 119 | +struct iwl_fwrt_wk_data { |
---|
| 120 | + u8 idx; |
---|
| 121 | + struct delayed_work wk; |
---|
| 122 | + struct iwl_fwrt_dump_data dump_data; |
---|
| 123 | +}; |
---|
| 124 | + |
---|
| 125 | +/** |
---|
| 126 | + * struct iwl_txf_iter_data - Tx fifo iterator data struct |
---|
| 127 | + * @fifo: fifo number |
---|
| 128 | + * @lmac: lmac number |
---|
| 129 | + * @fifo_size: fifo size |
---|
| 130 | + * @internal_txf: non zero if fifo is internal Tx fifo |
---|
| 131 | + */ |
---|
| 132 | +struct iwl_txf_iter_data { |
---|
| 133 | + int fifo; |
---|
| 134 | + int lmac; |
---|
| 135 | + u32 fifo_size; |
---|
| 136 | + u8 internal_txf; |
---|
91 | 137 | }; |
---|
92 | 138 | |
---|
93 | 139 | /** |
---|
.. | .. |
---|
97 | 143 | * @dev: device pointer |
---|
98 | 144 | * @ops: user ops |
---|
99 | 145 | * @ops_ctx: user ops context |
---|
100 | | - * @status: status flags |
---|
101 | 146 | * @fw_paging_db: paging database |
---|
102 | 147 | * @num_of_paging_blk: number of paging blocks |
---|
103 | 148 | * @num_of_pages_in_last_blk: number of pages in the last block |
---|
.. | .. |
---|
114 | 159 | const struct iwl_fw_runtime_ops *ops; |
---|
115 | 160 | void *ops_ctx; |
---|
116 | 161 | |
---|
117 | | - unsigned long status; |
---|
118 | | - |
---|
119 | 162 | /* Paging */ |
---|
120 | 163 | struct iwl_fw_paging fw_paging_db[NUM_OF_FW_PAGING_BLOCKS]; |
---|
121 | 164 | u16 num_of_paging_blk; |
---|
.. | .. |
---|
128 | 171 | |
---|
129 | 172 | /* debug */ |
---|
130 | 173 | struct { |
---|
131 | | - const struct iwl_fw_dump_desc *desc; |
---|
132 | | - const struct iwl_fw_dbg_trigger_tlv *trig; |
---|
133 | | - struct delayed_work wk; |
---|
| 174 | + struct iwl_fwrt_wk_data wks[IWL_FW_RUNTIME_DUMP_WK_NUM]; |
---|
| 175 | + unsigned long active_wks; |
---|
134 | 176 | |
---|
135 | 177 | u8 conf; |
---|
136 | 178 | |
---|
137 | 179 | /* ts of the beginning of a non-collect fw dbg data period */ |
---|
138 | | - unsigned long non_collect_ts_start[FW_DBG_TRIGGER_MAX - 1]; |
---|
| 180 | + unsigned long non_collect_ts_start[IWL_FW_INI_TIME_POINT_NUM]; |
---|
| 181 | + u32 *d3_debug_data; |
---|
| 182 | + u32 lmac_err_id[MAX_NUM_LMAC]; |
---|
| 183 | + u32 umac_err_id; |
---|
| 184 | + |
---|
| 185 | + struct iwl_txf_iter_data txf_iter_data; |
---|
| 186 | + |
---|
| 187 | + struct { |
---|
| 188 | + u8 type; |
---|
| 189 | + u8 subtype; |
---|
| 190 | + u32 lmac_major; |
---|
| 191 | + u32 lmac_minor; |
---|
| 192 | + u32 umac_major; |
---|
| 193 | + u32 umac_minor; |
---|
| 194 | + } fw_ver; |
---|
139 | 195 | } dump; |
---|
140 | 196 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
---|
141 | 197 | struct { |
---|
.. | .. |
---|
143 | 199 | u32 delay; |
---|
144 | 200 | u64 seq; |
---|
145 | 201 | } timestamp; |
---|
| 202 | + bool tpc_enabled; |
---|
146 | 203 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
---|
| 204 | +#ifdef CONFIG_ACPI |
---|
| 205 | + struct iwl_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM]; |
---|
| 206 | + u8 sar_chain_a_profile; |
---|
| 207 | + u8 sar_chain_b_profile; |
---|
| 208 | + struct iwl_geo_profile geo_profiles[ACPI_NUM_GEO_PROFILES]; |
---|
| 209 | + u32 geo_rev; |
---|
| 210 | + union iwl_ppag_table_cmd ppag_table; |
---|
| 211 | + u32 ppag_ver; |
---|
| 212 | +#endif |
---|
147 | 213 | }; |
---|
148 | 214 | |
---|
149 | 215 | void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans, |
---|
.. | .. |
---|
151 | 217 | const struct iwl_fw_runtime_ops *ops, void *ops_ctx, |
---|
152 | 218 | struct dentry *dbgfs_dir); |
---|
153 | 219 | |
---|
154 | | -void iwl_fw_runtime_exit(struct iwl_fw_runtime *fwrt); |
---|
| 220 | +static inline void iwl_fw_runtime_free(struct iwl_fw_runtime *fwrt) |
---|
| 221 | +{ |
---|
| 222 | + int i; |
---|
| 223 | + |
---|
| 224 | + kfree(fwrt->dump.d3_debug_data); |
---|
| 225 | + fwrt->dump.d3_debug_data = NULL; |
---|
| 226 | + |
---|
| 227 | + iwl_dbg_tlv_del_timers(fwrt->trans); |
---|
| 228 | + for (i = 0; i < IWL_FW_RUNTIME_DUMP_WK_NUM; i++) |
---|
| 229 | + cancel_delayed_work_sync(&fwrt->dump.wks[i].wk); |
---|
| 230 | +} |
---|
155 | 231 | |
---|
156 | 232 | void iwl_fw_runtime_suspend(struct iwl_fw_runtime *fwrt); |
---|
157 | 233 | |
---|
.. | .. |
---|
167 | 243 | void iwl_free_fw_paging(struct iwl_fw_runtime *fwrt); |
---|
168 | 244 | |
---|
169 | 245 | void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt); |
---|
| 246 | +int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt); |
---|
170 | 247 | |
---|
171 | 248 | #endif /* __iwl_fw_runtime_h__ */ |
---|