Lines Matching refs:mlxfw_dev
38 static int mlxfw_fsm_state_err(struct mlxfw_dev *mlxfw_dev, in mlxfw_fsm_state_err() argument
49 MLXFW_ERR_MSG(mlxfw_dev, extack, "general error", err); in mlxfw_fsm_state_err()
52 MLXFW_ERR_MSG(mlxfw_dev, extack, "component hash mismatch", err); in mlxfw_fsm_state_err()
55 MLXFW_ERR_MSG(mlxfw_dev, extack, "component not applicable", err); in mlxfw_fsm_state_err()
58 MLXFW_ERR_MSG(mlxfw_dev, extack, "unknown key", err); in mlxfw_fsm_state_err()
61 MLXFW_ERR_MSG(mlxfw_dev, extack, "authentication failed", err); in mlxfw_fsm_state_err()
64 MLXFW_ERR_MSG(mlxfw_dev, extack, "component was not signed", err); in mlxfw_fsm_state_err()
67 MLXFW_ERR_MSG(mlxfw_dev, extack, "key not applicable", err); in mlxfw_fsm_state_err()
70 MLXFW_ERR_MSG(mlxfw_dev, extack, "bad format", err); in mlxfw_fsm_state_err()
73 MLXFW_ERR_MSG(mlxfw_dev, extack, "pending reset", err); in mlxfw_fsm_state_err()
77 MLXFW_ERR_MSG(mlxfw_dev, extack, "unknown error", err); in mlxfw_fsm_state_err()
84 static int mlxfw_fsm_state_wait(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, in mlxfw_fsm_state_wait() argument
95 err = mlxfw_dev->ops->fsm_query_state(mlxfw_dev, fwhandle, in mlxfw_fsm_state_wait()
98 MLXFW_ERR_MSG(mlxfw_dev, extack, "FSM state query failed", err); in mlxfw_fsm_state_wait()
103 return mlxfw_fsm_state_err(mlxfw_dev, extack, fsm_state_err); in mlxfw_fsm_state_wait()
107 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_fsm_state_wait()
118 mlxfw_fsm_reactivate_err(struct mlxfw_dev *mlxfw_dev, in mlxfw_fsm_reactivate_err() argument
125 MLXFW_ERR_MSG(mlxfw_dev, extack, MXFW_REACT_PRFX msg, err) in mlxfw_fsm_reactivate_err()
166 static int mlxfw_fsm_reactivate(struct mlxfw_dev *mlxfw_dev, in mlxfw_fsm_reactivate() argument
173 if (!mlxfw_dev->ops->fsm_reactivate) in mlxfw_fsm_reactivate()
176 err = mlxfw_dev->ops->fsm_reactivate(mlxfw_dev, &status); in mlxfw_fsm_reactivate()
183 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_fsm_reactivate()
192 return mlxfw_fsm_reactivate_err(mlxfw_dev, extack, status); in mlxfw_fsm_reactivate()
195 static void mlxfw_status_notify(struct mlxfw_dev *mlxfw_dev, in mlxfw_status_notify() argument
199 devlink_flash_update_status_notify(mlxfw_dev->devlink, msg, comp_name, in mlxfw_status_notify()
207 static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev, in mlxfw_flash_component() argument
224 err = mlxfw_dev->ops->component_query(mlxfw_dev, comp->index, in mlxfw_flash_component()
228 MLXFW_ERR_MSG(mlxfw_dev, extack, "FSM component query failed", err); in mlxfw_flash_component()
234 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_component()
242 mlxfw_dbg(mlxfw_dev, "Component update\n"); in mlxfw_flash_component()
243 mlxfw_status_notify(mlxfw_dev, "Updating component", comp_name, 0, 0); in mlxfw_flash_component()
244 err = mlxfw_dev->ops->fsm_component_update(mlxfw_dev, fwhandle, in mlxfw_flash_component()
249 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_component()
253 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_component()
258 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle, in mlxfw_flash_component()
263 mlxfw_dbg(mlxfw_dev, "Component download\n"); in mlxfw_flash_component()
264 mlxfw_status_notify(mlxfw_dev, "Downloading component", in mlxfw_flash_component()
272 err = mlxfw_dev->ops->fsm_block_download(mlxfw_dev, fwhandle, in mlxfw_flash_component()
276 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_component()
280 mlxfw_status_notify(mlxfw_dev, "Downloading component", in mlxfw_flash_component()
285 mlxfw_dbg(mlxfw_dev, "Component verify\n"); in mlxfw_flash_component()
286 mlxfw_status_notify(mlxfw_dev, "Verifying component", comp_name, 0, 0); in mlxfw_flash_component()
287 err = mlxfw_dev->ops->fsm_component_verify(mlxfw_dev, fwhandle, in mlxfw_flash_component()
290 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_component()
295 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle, in mlxfw_flash_component()
302 mlxfw_dev->ops->fsm_cancel(mlxfw_dev, fwhandle); in mlxfw_flash_component()
306 static int mlxfw_flash_components(struct mlxfw_dev *mlxfw_dev, u32 fwhandle, in mlxfw_flash_components() argument
315 err = mlxfw_mfa2_file_component_count(mfa2_file, mlxfw_dev->psid, in mlxfw_flash_components()
316 mlxfw_dev->psid_size, in mlxfw_flash_components()
319 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_components()
327 comp = mlxfw_mfa2_file_component_get(mfa2_file, mlxfw_dev->psid, in mlxfw_flash_components()
328 mlxfw_dev->psid_size, i); in mlxfw_flash_components()
331 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_flash_components()
336 mlxfw_info(mlxfw_dev, "Flashing component type %d\n", in mlxfw_flash_components()
338 err = mlxfw_flash_component(mlxfw_dev, fwhandle, comp, in mlxfw_flash_components()
347 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev, in mlxfw_firmware_flash() argument
357 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_firmware_flash()
365 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_firmware_flash()
370 mlxfw_info(mlxfw_dev, "Initialize firmware flash process\n"); in mlxfw_firmware_flash()
371 mlxfw_status_notify(mlxfw_dev, "Initializing firmware flash process", in mlxfw_firmware_flash()
373 err = mlxfw_dev->ops->fsm_lock(mlxfw_dev, &fwhandle); in mlxfw_firmware_flash()
375 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_firmware_flash()
380 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle, in mlxfw_firmware_flash()
385 err = mlxfw_fsm_reactivate(mlxfw_dev, extack, &reactivate_supp); in mlxfw_firmware_flash()
389 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle, in mlxfw_firmware_flash()
394 err = mlxfw_flash_components(mlxfw_dev, fwhandle, mfa2_file, in mlxfw_firmware_flash()
399 mlxfw_dbg(mlxfw_dev, "Activate image\n"); in mlxfw_firmware_flash()
400 mlxfw_status_notify(mlxfw_dev, "Activating image", NULL, 0, 0); in mlxfw_firmware_flash()
401 err = mlxfw_dev->ops->fsm_activate(mlxfw_dev, fwhandle); in mlxfw_firmware_flash()
403 MLXFW_ERR_MSG(mlxfw_dev, extack, in mlxfw_firmware_flash()
408 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle, in mlxfw_firmware_flash()
413 mlxfw_dbg(mlxfw_dev, "Handle release\n"); in mlxfw_firmware_flash()
414 mlxfw_dev->ops->fsm_release(mlxfw_dev, fwhandle); in mlxfw_firmware_flash()
416 mlxfw_info(mlxfw_dev, "Firmware flash done\n"); in mlxfw_firmware_flash()
417 mlxfw_status_notify(mlxfw_dev, "Firmware flash done", NULL, 0, 0); in mlxfw_firmware_flash()
427 mlxfw_dev->ops->fsm_release(mlxfw_dev, fwhandle); in mlxfw_firmware_flash()