@@ -137,10 +137,10 @@ static bool ice_fwlog_supported(struct ice_fwlog *fwlog)
137137
138138/**
139139 * ice_aq_fwlog_get - Get the current firmware logging configuration (0xFF32)
140- * @hw : pointer to the HW structure
140+ * @fwlog : pointer to the fwlog structure
141141 * @cfg: firmware logging configuration to populate
142142 */
143- static int ice_aq_fwlog_get (struct ice_hw * hw , struct ice_fwlog_cfg * cfg )
143+ static int ice_aq_fwlog_get (struct ice_fwlog * fwlog , struct ice_fwlog_cfg * cfg )
144144{
145145 struct ice_aqc_fw_log_cfg_resp * fw_modules ;
146146 struct ice_aqc_fw_log * cmd ;
@@ -161,17 +161,17 @@ static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
161161
162162 cmd -> cmd_flags = ICE_AQC_FW_LOG_AQ_QUERY ;
163163
164- status = ice_aq_send_cmd ( hw , & desc , buf , ICE_AQ_MAX_BUF_LEN , NULL );
164+ status = fwlog -> send_cmd ( fwlog -> priv , & desc , buf , ICE_AQ_MAX_BUF_LEN );
165165 if (status ) {
166- dev_dbg (& hw -> fwlog . pdev -> dev , "Failed to get FW log configuration\n" );
166+ dev_dbg (& fwlog -> pdev -> dev , "Failed to get FW log configuration\n" );
167167 goto status_out ;
168168 }
169169
170170 module_id_cnt = le16_to_cpu (cmd -> ops .cfg .mdl_cnt );
171171 if (module_id_cnt < ICE_AQC_FW_LOG_ID_MAX ) {
172- dev_dbg (& hw -> fwlog . pdev -> dev , "FW returned less than the expected number of FW log module IDs\n" );
172+ dev_dbg (& fwlog -> pdev -> dev , "FW returned less than the expected number of FW log module IDs\n" );
173173 } else if (module_id_cnt > ICE_AQC_FW_LOG_ID_MAX ) {
174- dev_dbg (& hw -> fwlog . pdev -> dev , "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n" ,
174+ dev_dbg (& fwlog -> pdev -> dev , "FW returned more than expected number of FW log module IDs, setting module_id_cnt to software expected max %u\n" ,
175175 ICE_AQC_FW_LOG_ID_MAX );
176176 module_id_cnt = ICE_AQC_FW_LOG_ID_MAX ;
177177 }
@@ -201,7 +201,6 @@ static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
201201
202202/**
203203 * ice_fwlog_set_supported - Set if FW logging is supported by FW
204- * @hw: pointer to the HW struct
205204 * @fwlog: pointer to the fwlog structure
206205 *
207206 * If FW returns success to the ice_aq_fwlog_get call then it supports FW
@@ -210,7 +209,7 @@ static int ice_aq_fwlog_get(struct ice_hw *hw, struct ice_fwlog_cfg *cfg)
210209 * This function is only meant to be called during driver init to determine if
211210 * the FW support FW logging.
212211 */
213- static void ice_fwlog_set_supported (struct ice_hw * hw , struct ice_fwlog * fwlog )
212+ static void ice_fwlog_set_supported (struct ice_fwlog * fwlog )
214213{
215214 struct ice_fwlog_cfg * cfg ;
216215 int status ;
@@ -221,7 +220,7 @@ static void ice_fwlog_set_supported(struct ice_hw *hw, struct ice_fwlog *fwlog)
221220 if (!cfg )
222221 return ;
223222
224- status = ice_aq_fwlog_get (hw , cfg );
223+ status = ice_aq_fwlog_get (fwlog , cfg );
225224 if (status )
226225 dev_dbg (& fwlog -> pdev -> dev , "ice_aq_fwlog_get failed, FW logging is not supported on this version of FW, status %d\n" ,
227226 status );
@@ -235,26 +234,26 @@ static void ice_fwlog_set_supported(struct ice_hw *hw, struct ice_fwlog *fwlog)
235234 * ice_fwlog_init - Initialize FW logging configuration
236235 * @hw: pointer to the HW structure
237236 * @fwlog: pointer to the fwlog structure
238- * @pdev: pointer to the pci dev used in dev_warn()
237+ * @api: api structure to init fwlog
239238 *
240239 * This function should be called on driver initialization during
241240 * ice_init_hw().
242241 */
243242int ice_fwlog_init (struct ice_hw * hw , struct ice_fwlog * fwlog ,
244- struct pci_dev * pdev )
243+ struct ice_fwlog_api * api )
245244{
246245 /* only support fw log commands on PF 0 */
247246 if (hw -> bus .func )
248247 return - EINVAL ;
249248
250- ice_fwlog_set_supported ( hw , fwlog ) ;
251- fwlog -> pdev = pdev ;
249+ fwlog -> api = * api ;
250+ ice_fwlog_set_supported ( fwlog ) ;
252251
253252 if (ice_fwlog_supported (fwlog )) {
254253 int status ;
255254
256255 /* read the current config from the FW and store it */
257- status = ice_aq_fwlog_get (hw , & fwlog -> cfg );
256+ status = ice_aq_fwlog_get (fwlog , & fwlog -> cfg );
258257 if (status )
259258 return status ;
260259
@@ -307,7 +306,7 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
307306 * for the next driver load
308307 */
309308 fwlog -> cfg .options &= ~ICE_FWLOG_OPTION_ARQ_ENA ;
310- status = ice_fwlog_set (hw , & fwlog -> cfg );
309+ status = ice_fwlog_set (fwlog , & fwlog -> cfg );
311310 if (status )
312311 dev_warn (& fwlog -> pdev -> dev , "Unable to turn off FW logging, status: %d\n" ,
313312 status );
@@ -316,7 +315,7 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
316315
317316 pf -> ice_debugfs_pf_fwlog_modules = NULL ;
318317
319- status = ice_fwlog_unregister (hw , fwlog );
318+ status = ice_fwlog_unregister (fwlog );
320319 if (status )
321320 dev_warn (& fwlog -> pdev -> dev , "Unable to unregister FW logging, status: %d\n" ,
322321 status );
@@ -329,15 +328,16 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
329328
330329/**
331330 * ice_aq_fwlog_set - Set FW logging configuration AQ command (0xFF30)
332- * @hw : pointer to the HW structure
331+ * @fwlog : pointer to the fwlog structure
333332 * @entries: entries to configure
334333 * @num_entries: number of @entries
335334 * @options: options from ice_fwlog_cfg->options structure
336335 * @log_resolution: logging resolution
337336 */
338337static int
339- ice_aq_fwlog_set (struct ice_hw * hw , struct ice_fwlog_module_entry * entries ,
340- u16 num_entries , u16 options , u16 log_resolution )
338+ ice_aq_fwlog_set (struct ice_fwlog * fwlog ,
339+ struct ice_fwlog_module_entry * entries , u16 num_entries ,
340+ u16 options , u16 log_resolution )
341341{
342342 struct ice_aqc_fw_log_cfg_resp * fw_modules ;
343343 struct ice_aqc_fw_log * cmd ;
@@ -369,9 +369,8 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries,
369369 if (options & ICE_FWLOG_OPTION_UART_ENA )
370370 cmd -> cmd_flags |= ICE_AQC_FW_LOG_CONF_UART_EN ;
371371
372- status = ice_aq_send_cmd (hw , & desc , fw_modules ,
373- sizeof (* fw_modules ) * num_entries ,
374- NULL );
372+ status = fwlog -> send_cmd (fwlog -> priv , & desc , fw_modules ,
373+ sizeof (* fw_modules ) * num_entries );
375374
376375 kfree (fw_modules );
377376
@@ -380,7 +379,7 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries,
380379
381380/**
382381 * ice_fwlog_set - Set the firmware logging settings
383- * @hw : pointer to the HW structure
382+ * @fwlog : pointer to the fwlog structure
384383 * @cfg: config used to set firmware logging
385384 *
386385 * This function should be called whenever the driver needs to set the firmware
@@ -391,22 +390,22 @@ ice_aq_fwlog_set(struct ice_hw *hw, struct ice_fwlog_module_entry *entries,
391390 * ice_fwlog_register. Note, that ice_fwlog_register does not need to be called
392391 * for init.
393392 */
394- int ice_fwlog_set (struct ice_hw * hw , struct ice_fwlog_cfg * cfg )
393+ int ice_fwlog_set (struct ice_fwlog * fwlog , struct ice_fwlog_cfg * cfg )
395394{
396- if (!ice_fwlog_supported (& hw -> fwlog ))
395+ if (!ice_fwlog_supported (fwlog ))
397396 return - EOPNOTSUPP ;
398397
399- return ice_aq_fwlog_set (hw , cfg -> module_entries ,
398+ return ice_aq_fwlog_set (fwlog , cfg -> module_entries ,
400399 ICE_AQC_FW_LOG_ID_MAX , cfg -> options ,
401400 cfg -> log_resolution );
402401}
403402
404403/**
405404 * ice_aq_fwlog_register - Register PF for firmware logging events (0xFF31)
406- * @hw : pointer to the HW structure
405+ * @fwlog : pointer to the fwlog structure
407406 * @reg: true to register and false to unregister
408407 */
409- static int ice_aq_fwlog_register (struct ice_hw * hw , bool reg )
408+ static int ice_aq_fwlog_register (struct ice_fwlog * fwlog , bool reg )
410409{
411410 struct ice_aqc_fw_log * cmd ;
412411 struct libie_aq_desc desc ;
@@ -417,25 +416,24 @@ static int ice_aq_fwlog_register(struct ice_hw *hw, bool reg)
417416 if (reg )
418417 cmd -> cmd_flags = ICE_AQC_FW_LOG_AQ_REGISTER ;
419418
420- return ice_aq_send_cmd ( hw , & desc , NULL , 0 , NULL );
419+ return fwlog -> send_cmd ( fwlog -> priv , & desc , NULL , 0 );
421420}
422421
423422/**
424423 * ice_fwlog_register - Register the PF for firmware logging
425- * @hw: pointer to the HW structure
426424 * @fwlog: pointer to the fwlog structure
427425 *
428426 * After this call the PF will start to receive firmware logging based on the
429427 * configuration set in ice_fwlog_set.
430428 */
431- int ice_fwlog_register (struct ice_hw * hw , struct ice_fwlog * fwlog )
429+ int ice_fwlog_register (struct ice_fwlog * fwlog )
432430{
433431 int status ;
434432
435433 if (!ice_fwlog_supported (fwlog ))
436434 return - EOPNOTSUPP ;
437435
438- status = ice_aq_fwlog_register (hw , true);
436+ status = ice_aq_fwlog_register (fwlog , true);
439437 if (status )
440438 dev_dbg (& fwlog -> pdev -> dev , "Failed to register for firmware logging events over ARQ\n" );
441439 else
@@ -446,17 +444,16 @@ int ice_fwlog_register(struct ice_hw *hw, struct ice_fwlog *fwlog)
446444
447445/**
448446 * ice_fwlog_unregister - Unregister the PF from firmware logging
449- * @hw: pointer to the HW structure
450447 * @fwlog: pointer to the fwlog structure
451448 */
452- int ice_fwlog_unregister (struct ice_hw * hw , struct ice_fwlog * fwlog )
449+ int ice_fwlog_unregister (struct ice_fwlog * fwlog )
453450{
454451 int status ;
455452
456453 if (!ice_fwlog_supported (fwlog ))
457454 return - EOPNOTSUPP ;
458455
459- status = ice_aq_fwlog_register (hw , false);
456+ status = ice_aq_fwlog_register (fwlog , false);
460457 if (status )
461458 dev_dbg (& fwlog -> pdev -> dev , "Failed to unregister from firmware logging events over ARQ\n" );
462459 else
0 commit comments