hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
....@@ -6,7 +6,7 @@
66 * GPL LICENSE SUMMARY
77 *
88 * Copyright(c) 2017 Intel Deutschland GmbH
9
- * Copyright(c) 2018 Intel Corporation
9
+ * Copyright (C) 2018-2020 Intel Corporation
1010 *
1111 * This program is free software; you can redistribute it and/or modify
1212 * it under the terms of version 2 of the GNU General Public License as
....@@ -27,7 +27,7 @@
2727 * BSD LICENSE
2828 *
2929 * Copyright(c) 2017 Intel Deutschland GmbH
30
- * Copyright(c) 2018 Intel Corporation
30
+ * Copyright (C) 2018-2020 Intel Corporation
3131 * All rights reserved.
3232 *
3333 * Redistribution and use in source and binary forms, with or without
....@@ -65,12 +65,16 @@
6565 #include "img.h"
6666 #include "fw/api/debug.h"
6767 #include "fw/api/paging.h"
68
+#include "fw/api/power.h"
6869 #include "iwl-eeprom-parse.h"
70
+#include "fw/acpi.h"
6971
7072 struct iwl_fw_runtime_ops {
7173 int (*dump_start)(void *ctx);
7274 void (*dump_end)(void *ctx);
7375 bool (*fw_running)(void *ctx);
76
+ int (*send_hcmd)(void *ctx, struct iwl_host_cmd *host_cmd);
77
+ bool (*d3_debug_enable)(void *ctx);
7478 };
7579
7680 #define MAX_NUM_LMAC 2
....@@ -82,12 +86,54 @@
8286 u32 rxfifo1_size;
8387 } lmac[MAX_NUM_LMAC];
8488 u32 rxfifo2_size;
89
+ u32 rxfifo2_control_size;
8590 u32 internal_txfifo_addr;
8691 u32 internal_txfifo_size[TX_FIFO_INTERNAL_MAX_NUM];
8792 };
8893
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;
91137 };
92138
93139 /**
....@@ -97,7 +143,6 @@
97143 * @dev: device pointer
98144 * @ops: user ops
99145 * @ops_ctx: user ops context
100
- * @status: status flags
101146 * @fw_paging_db: paging database
102147 * @num_of_paging_blk: number of paging blocks
103148 * @num_of_pages_in_last_blk: number of pages in the last block
....@@ -114,8 +159,6 @@
114159 const struct iwl_fw_runtime_ops *ops;
115160 void *ops_ctx;
116161
117
- unsigned long status;
118
-
119162 /* Paging */
120163 struct iwl_fw_paging fw_paging_db[NUM_OF_FW_PAGING_BLOCKS];
121164 u16 num_of_paging_blk;
....@@ -128,14 +171,27 @@
128171
129172 /* debug */
130173 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;
134176
135177 u8 conf;
136178
137179 /* 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;
139195 } dump;
140196 #ifdef CONFIG_IWLWIFI_DEBUGFS
141197 struct {
....@@ -143,7 +199,17 @@
143199 u32 delay;
144200 u64 seq;
145201 } timestamp;
202
+ bool tpc_enabled;
146203 #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
147213 };
148214
149215 void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
....@@ -151,7 +217,17 @@
151217 const struct iwl_fw_runtime_ops *ops, void *ops_ctx,
152218 struct dentry *dbgfs_dir);
153219
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
+}
155231
156232 void iwl_fw_runtime_suspend(struct iwl_fw_runtime *fwrt);
157233
....@@ -167,5 +243,6 @@
167243 void iwl_free_fw_paging(struct iwl_fw_runtime *fwrt);
168244
169245 void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt);
246
+int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt);
170247
171248 #endif /* __iwl_fw_runtime_h__ */