| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Huawei HiNIC PCI Express Linux driver |
|---|
| 3 | 4 | * Copyright(c) 2017 Huawei Technologies Co., Ltd |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|---|
| 12 | | - * for more details. |
|---|
| 13 | | - * |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #ifndef HINIC_HW_MGMT_H |
|---|
| .. | .. |
|---|
| 69 | 60 | }; |
|---|
| 70 | 61 | |
|---|
| 71 | 62 | enum hinic_comm_cmd { |
|---|
| 63 | + HINIC_COMM_CMD_START_FLR = 0x1, |
|---|
| 72 | 64 | HINIC_COMM_CMD_IO_STATUS_GET = 0x3, |
|---|
| 65 | + HINIC_COMM_CMD_DMA_ATTR_SET = 0x4, |
|---|
| 73 | 66 | |
|---|
| 74 | 67 | HINIC_COMM_CMD_CMDQ_CTXT_SET = 0x10, |
|---|
| 75 | 68 | HINIC_COMM_CMD_CMDQ_CTXT_GET = 0x11, |
|---|
| .. | .. |
|---|
| 83 | 76 | |
|---|
| 84 | 77 | HINIC_COMM_CMD_IO_RES_CLEAR = 0x29, |
|---|
| 85 | 78 | |
|---|
| 86 | | - HINIC_COMM_CMD_MAX = 0x32, |
|---|
| 79 | + HINIC_COMM_CMD_CEQ_CTRL_REG_WR_BY_UP = 0x33, |
|---|
| 80 | + |
|---|
| 81 | + HINIC_COMM_CMD_MSI_CTRL_REG_WR_BY_UP, |
|---|
| 82 | + HINIC_COMM_CMD_MSI_CTRL_REG_RD_BY_UP, |
|---|
| 83 | + |
|---|
| 84 | + HINIC_COMM_CMD_FAULT_REPORT = 0x37, |
|---|
| 85 | + |
|---|
| 86 | + HINIC_COMM_CMD_SET_LED_STATUS = 0x4a, |
|---|
| 87 | + |
|---|
| 88 | + HINIC_COMM_CMD_L2NIC_RESET = 0x4b, |
|---|
| 89 | + |
|---|
| 90 | + HINIC_COMM_CMD_PAGESIZE_SET = 0x50, |
|---|
| 91 | + |
|---|
| 92 | + HINIC_COMM_CMD_GET_BOARD_INFO = 0x52, |
|---|
| 93 | + |
|---|
| 94 | + HINIC_COMM_CMD_WATCHDOG_INFO = 0x56, |
|---|
| 95 | + |
|---|
| 96 | + HINIC_MGMT_CMD_SET_VF_RANDOM_ID = 0x61, |
|---|
| 97 | + |
|---|
| 98 | + HINIC_COMM_CMD_MAX, |
|---|
| 87 | 99 | }; |
|---|
| 88 | 100 | |
|---|
| 89 | 101 | enum hinic_mgmt_cb_state { |
|---|
| .. | .. |
|---|
| 116 | 128 | |
|---|
| 117 | 129 | struct hinic_pf_to_mgmt { |
|---|
| 118 | 130 | struct hinic_hwif *hwif; |
|---|
| 119 | | - |
|---|
| 131 | + struct hinic_hwdev *hwdev; |
|---|
| 120 | 132 | struct semaphore sync_msg_lock; |
|---|
| 121 | 133 | u16 sync_msg_id; |
|---|
| 122 | 134 | u8 *sync_msg_buf; |
|---|
| 135 | + void *mgmt_ack_buf; |
|---|
| 123 | 136 | |
|---|
| 124 | 137 | struct hinic_recv_msg recv_resp_msg_from_mgmt; |
|---|
| 125 | 138 | struct hinic_recv_msg recv_msg_from_mgmt; |
|---|
| .. | .. |
|---|
| 127 | 140 | struct hinic_api_cmd_chain *cmd_chain[HINIC_API_CMD_MAX]; |
|---|
| 128 | 141 | |
|---|
| 129 | 142 | struct hinic_mgmt_cb mgmt_cb[HINIC_MOD_MAX]; |
|---|
| 143 | + |
|---|
| 144 | + struct workqueue_struct *workq; |
|---|
| 145 | +}; |
|---|
| 146 | + |
|---|
| 147 | +struct hinic_mgmt_msg_handle_work { |
|---|
| 148 | + struct work_struct work; |
|---|
| 149 | + struct hinic_pf_to_mgmt *pf_to_mgmt; |
|---|
| 150 | + |
|---|
| 151 | + void *msg; |
|---|
| 152 | + u16 msg_len; |
|---|
| 153 | + |
|---|
| 154 | + enum hinic_mod_type mod; |
|---|
| 155 | + u8 cmd; |
|---|
| 156 | + u16 msg_id; |
|---|
| 157 | + int async_mgmt_to_pf; |
|---|
| 130 | 158 | }; |
|---|
| 131 | 159 | |
|---|
| 132 | 160 | void hinic_register_mgmt_msg_cb(struct hinic_pf_to_mgmt *pf_to_mgmt, |
|---|