u32
qlcnic_issue_cmd(struct qlcnic_adapter *adapter,
- u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd)
+ u32 pci_fn, u32 version, u32 arg1, u32 arg2, u32 arg3, u32 cmd,
+ u32 *rd_args[3])
{
u32 rsp;
u32 signature;
rcode = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
dev_err(&pdev->dev, "failed card response code:0x%x\n",
rcode);
+ } else if (rsp == QLCNIC_CDRP_RSP_OK) {
+ if (rd_args[1])
+ *rd_args[1] = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
+ if (rd_args[2])
+ *rd_args[2] = QLCRD32(adapter, QLCNIC_ARG3_CRB_OFFSET);
}
+ if (rd_args[0])
+ *rd_args[0] = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
/* Release semaphore */
qlcnic_api_unlock(adapter);
int err, i;
u16 temp_size;
void *tmp_addr;
- u32 version, csum, *template, *tmp_buf;
+ u32 version, csum, *template, *tmp_buf, rsp;
+ u32 *rd_args[3];
struct qlcnic_hardware_context *ahw;
struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl;
dma_addr_t tmp_addr_t = 0;
ahw = adapter->ahw;
+ rd_args[0] = &rsp;
+ rd_args[1] = (u32 *) &temp_size;
+ rd_args[2] = &version;
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
0,
0,
0,
- QLCNIC_CDRP_CMD_TEMP_SIZE);
+ QLCNIC_CDRP_CMD_TEMP_SIZE,
+ rd_args);
if (err != QLCNIC_RCODE_SUCCESS) {
- err = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
dev_info(&adapter->pdev->dev,
- "Can't get template size %d\n", err);
+ "Can't get template size %d\n", rsp);
err = -EIO;
return err;
}
- version = QLCRD32(adapter, QLCNIC_ARG3_CRB_OFFSET);
- temp_size = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
if (!temp_size)
return -EIO;
"Can't get memory for FW dump template\n");
return -ENOMEM;
}
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
LSD(tmp_addr_t),
MSD(tmp_addr_t),
temp_size,
- QLCNIC_CDRP_CMD_GET_TEMP_HDR);
+ QLCNIC_CDRP_CMD_GET_TEMP_HDR,
+ rd_args);
if (err != QLCNIC_RCODE_SUCCESS) {
dev_err(&adapter->pdev->dev,
int
qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu)
{
+ u32 *rd_args[3];
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
+ memset(rd_args, 0, sizeof(rd_args));
if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) {
if (qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
recv_ctx->context_id,
mtu,
0,
- QLCNIC_CDRP_CMD_SET_MTU)) {
+ QLCNIC_CDRP_CMD_SET_MTU,
+ rd_args)) {
dev_err(&adapter->pdev->dev, "Failed to set mtu\n");
return -EIO;
u8 i, nrds_rings, nsds_rings;
size_t rq_size, rsp_size;
u32 cap, reg, val, reg2;
+ u32 *rd_args[3];
int err;
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
}
phys_addr = hostrq_phys_addr;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
(u32)(phys_addr >> 32),
(u32)(phys_addr & 0xffffffff),
rq_size,
- QLCNIC_CDRP_CMD_CREATE_RX_CTX);
+ QLCNIC_CDRP_CMD_CREATE_RX_CTX,
+ rd_args);
if (err) {
dev_err(&adapter->pdev->dev,
"Failed to create rx ctx in firmware%d\n", err);
static void
qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter)
{
+ u32 *rd_args[3];
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
+ memset(rd_args, 0, sizeof(rd_args));
if (qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
recv_ctx->context_id,
QLCNIC_DESTROY_CTX_RESET,
0,
- QLCNIC_CDRP_CMD_DESTROY_RX_CTX)) {
+ QLCNIC_CDRP_CMD_DESTROY_RX_CTX,
+ rd_args)) {
dev_err(&adapter->pdev->dev,
"Failed to destroy rx ctx in firmware\n");
void *rq_addr, *rsp_addr;
size_t rq_size, rsp_size;
u32 temp;
+ u32 *rd_args[3];
int err;
u64 phys_addr;
dma_addr_t rq_phys_addr, rsp_phys_addr;
prq_cds->ring_size = cpu_to_le32(tx_ring->num_desc);
phys_addr = rq_phys_addr;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
(u32)(phys_addr >> 32),
((u32)phys_addr & 0xffffffff),
rq_size,
- QLCNIC_CDRP_CMD_CREATE_TX_CTX);
+ QLCNIC_CDRP_CMD_CREATE_TX_CTX,
+ rd_args);
if (err == QLCNIC_RCODE_SUCCESS) {
temp = le32_to_cpu(prsp->cds_ring.host_producer_crb);
static void
qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
{
+ u32 *rd_args[3];
+
+ memset(rd_args, 0, sizeof(rd_args));
if (qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
adapter->tx_context_id,
QLCNIC_DESTROY_CTX_RESET,
0,
- QLCNIC_CDRP_CMD_DESTROY_TX_CTX)) {
+ QLCNIC_CDRP_CMD_DESTROY_TX_CTX,
+ rd_args)) {
dev_err(&adapter->pdev->dev,
"Failed to destroy tx ctx in firmware\n");
int
qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config)
{
+ u32 *rd_args[3];
+
+ memset(rd_args, 0, sizeof(rd_args));
return qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
config,
0,
0,
- QLCNIC_CDRP_CMD_CONFIG_PORT);
+ QLCNIC_CDRP_CMD_CONFIG_PORT,
+ rd_args);
}
int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
{
int err;
- u32 arg1;
+ u32 arg1, rd_arg1, rd_arg2;
+ u32 *rd_args[3];
arg1 = adapter->ahw->pci_func | BIT_8;
+ rd_args[0] = &rd_arg1;
+ rd_args[1] = &rd_arg2;
+ rd_args[2] = 0;
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
arg1,
0,
0,
- QLCNIC_CDRP_CMD_MAC_ADDRESS);
+ QLCNIC_CDRP_CMD_MAC_ADDRESS,
+ rd_args);
if (err == QLCNIC_RCODE_SUCCESS)
- qlcnic_fetch_mac(adapter, QLCNIC_ARG1_CRB_OFFSET,
- QLCNIC_ARG2_CRB_OFFSET, 0, mac);
+ qlcnic_fetch_mac(adapter, rd_arg1, rd_arg2, 0, mac);
else {
dev_err(&adapter->pdev->dev,
"Failed to get mac address%d\n", err);
dma_addr_t nic_dma_t;
struct qlcnic_info *nic_info;
void *nic_info_addr;
+ u32 *rd_args[3];
size_t nic_size = sizeof(struct qlcnic_info);
nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
memset(nic_info_addr, 0, nic_size);
nic_info = nic_info_addr;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
MSD(nic_dma_t),
LSD(nic_dma_t),
(func_id << 16 | nic_size),
- QLCNIC_CDRP_CMD_GET_NIC_INFO);
+ QLCNIC_CDRP_CMD_GET_NIC_INFO,
+ rd_args);
if (err == QLCNIC_RCODE_SUCCESS) {
npar_info->pci_func = le16_to_cpu(nic_info->pci_func);
int err = -EIO;
dma_addr_t nic_dma_t;
void *nic_info_addr;
+ u32 *rd_args[3];
struct qlcnic_info *nic_info;
size_t nic_size = sizeof(struct qlcnic_info);
nic_info->min_tx_bw = cpu_to_le16(nic->min_tx_bw);
nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw);
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
MSD(nic_dma_t),
LSD(nic_dma_t),
((nic->pci_func << 16) | nic_size),
- QLCNIC_CDRP_CMD_SET_NIC_INFO);
+ QLCNIC_CDRP_CMD_SET_NIC_INFO,
+ rd_args);
if (err != QLCNIC_RCODE_SUCCESS) {
dev_err(&adapter->pdev->dev,
struct qlcnic_pci_info *pci_info)
{
int err = 0, i;
+ u32 *rd_args[3];
dma_addr_t pci_info_dma_t;
struct qlcnic_pci_info *npar;
void *pci_info_addr;
memset(pci_info_addr, 0, pci_size);
npar = pci_info_addr;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
MSD(pci_info_dma_t),
LSD(pci_info_dma_t),
pci_size,
- QLCNIC_CDRP_CMD_GET_PCI_INFO);
+ QLCNIC_CDRP_CMD_GET_PCI_INFO,
+ rd_args);
if (err == QLCNIC_RCODE_SUCCESS) {
for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++, pci_info++) {
{
int err = -EIO;
u32 arg1;
+ u32 *rd_args[3];
if (adapter->op_mode != QLCNIC_MGMT_FUNC ||
!(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE))
arg1 = id | (enable_mirroring ? BIT_4 : 0);
arg1 |= pci_func << 8;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
arg1,
0,
0,
- QLCNIC_CDRP_CMD_SET_PORTMIRRORING);
+ QLCNIC_CDRP_CMD_SET_PORTMIRRORING,
+ rd_args);
if (err != QLCNIC_RCODE_SUCCESS) {
dev_err(&adapter->pdev->dev,
dma_addr_t stats_dma_t;
void *stats_addr;
u32 arg1;
+ u32 *rd_args[3];
int err;
if (esw_stats == NULL)
arg1 = func | QLCNIC_STATS_VERSION << 8 | QLCNIC_STATS_PORT << 12;
arg1 |= rx_tx << 15 | stats_size << 16;
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
arg1,
MSD(stats_dma_t),
LSD(stats_dma_t),
- QLCNIC_CDRP_CMD_GET_ESWITCH_STATS);
+ QLCNIC_CDRP_CMD_GET_ESWITCH_STATS,
+ rd_args);
if (!err) {
stats = stats_addr;
{
u32 arg1;
+ u32 *rd_args[3];
if (adapter->op_mode != QLCNIC_MGMT_FUNC)
return -EIO;
arg1 = port | QLCNIC_STATS_VERSION << 8 | func_esw << 12;
arg1 |= BIT_14 | rx_tx << 15;
+ memset(rd_args, 0, sizeof(rd_args));
return qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
arg1,
0,
0,
- QLCNIC_CDRP_CMD_GET_ESWITCH_STATS);
+ QLCNIC_CDRP_CMD_GET_ESWITCH_STATS,
+ rd_args);
err_ret:
dev_err(&adapter->pdev->dev, "Invalid argument func_esw=%d port=%d"
u32 *arg1, u32 *arg2)
{
int err = -EIO;
+ u32 *rd_args[3];
u8 pci_func;
pci_func = (*arg1 >> 8);
+ rd_args[0] = arg1;
+ rd_args[1] = arg2;
+ rd_args[2] = 0;
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
*arg1,
0,
0,
- QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG);
+ QLCNIC_CDRP_CMD_GET_ESWITCH_PORT_CONFIG,
+ rd_args);
if (err == QLCNIC_RCODE_SUCCESS) {
- *arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
- *arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
dev_info(&adapter->pdev->dev,
"eSwitch port config for pci func %d\n", pci_func);
} else {
{
int err = -EIO;
u32 arg1, arg2 = 0;
+ u32 *rd_args[3];
u8 pci_func;
if (adapter->op_mode != QLCNIC_MGMT_FUNC)
return err;
}
+ memset(rd_args, 0, sizeof(rd_args));
err = qlcnic_issue_cmd(adapter,
adapter->ahw->pci_func,
adapter->fw_hal_version,
arg1,
arg2,
0,
- QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH);
+ QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH,
+ rd_args);
if (err != QLCNIC_RCODE_SUCCESS) {
dev_err(&adapter->pdev->dev,