1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. 3 4 #include <linux/delay.h> 5 6 #include "hinic3_hw_comm.h" 7 #include "hinic3_hwdev.h" 8 #include "hinic3_hwif.h" 9 #include "hinic3_mbox.h" 10 11 int hinic3_func_reset(struct hinic3_hwdev *hwdev, u16 func_id, u64 reset_flag) 12 { 13 struct comm_cmd_func_reset func_reset = {}; 14 struct mgmt_msg_params msg_params = {}; 15 int err; 16 17 func_reset.func_id = func_id; 18 func_reset.reset_flag = reset_flag; 19 20 mgmt_msg_params_init_default(&msg_params, &func_reset, 21 sizeof(func_reset)); 22 23 err = hinic3_send_mbox_to_mgmt(hwdev, MGMT_MOD_COMM, 24 COMM_CMD_FUNC_RESET, &msg_params); 25 if (err || func_reset.head.status) { 26 dev_err(hwdev->dev, "Failed to reset func resources, reset_flag 0x%llx, err: %d, status: 0x%x\n", 27 reset_flag, err, func_reset.head.status); 28 return -EIO; 29 } 30 31 return 0; 32 } 33