29 #define NXHAL_VERSION 1
73 rsp = netxen_poll_rsp(adapter);
105 memset(&cmd, 0,
sizeof(cmd));
108 netxen_issue_cmd(adapter, &cmd);
111 "Can't get template size %d\n", cmd.
rsp.cmd);
114 adapter->
mdump.md_template_size = cmd.
rsp.arg2;
115 adapter->
mdump.md_template_ver = cmd.
rsp.arg3;
126 size = adapter->
mdump.md_template_size;
129 dev_err(&adapter->
pdev->dev,
"Can not capture Minidump "
130 "template. Invalid template size.\n");
137 dev_err(&adapter->
pdev->dev,
"Unable to allocate dmable memory for template.\n");
142 memset(&cmd, 0,
sizeof(cmd));
145 cmd.
req.arg1 =
LSD(md_template_addr);
146 cmd.
req.arg2 =
MSD(md_template_addr);
148 netxen_issue_cmd(adapter, &cmd);
153 dev_err(&adapter->
pdev->dev,
"Failed to get minidump template, "
154 "err_code : %d, requested_size : %d, actual_size : %d\n ",
155 cmd.
rsp.cmd, size, cmd.
rsp.arg2);
165 u32 *buff = adapter->
mdump.md_template;
171 sum = (sum & 0xFFFFFFFF) + (sum >> 32) ;
180 u32 *
template, *tmp_buf;
182 err = netxen_get_minidump_template_size(adapter);
184 adapter->
mdump.fw_supports_md = 0;
188 "Flashed firmware version does not support minidump, "
189 "minimum version required is [ %u.%u.%u ].\n ",
196 if (!adapter->
mdump.md_template_size) {
197 dev_err(&adapter->
pdev->dev,
"Error : Invalid template size "
198 ",should be non-zero.\n");
201 adapter->
mdump.md_template =
204 if (!adapter->
mdump.md_template) {
205 dev_err(&adapter->
pdev->dev,
"Unable to allocate memory "
206 "for minidump template.\n");
210 err = netxen_get_minidump_template(adapter);
213 adapter->
mdump.fw_supports_md = 0;
217 if (netxen_check_template_checksum(adapter)) {
218 dev_err(&adapter->
pdev->dev,
"Minidump template checksum Error\n");
224 tmp_buf = (
u32 *) adapter->
mdump.md_template;
225 template = (
u32 *) adapter->
mdump.md_template;
226 for (
i = 0;
i < adapter->
mdump.md_template_size/
sizeof(
u32);
i++)
229 adapter->
mdump.md_template;
231 adapter->
mdump.fw_supports_md = 1;
232 adapter->
mdump.md_enabled = 0;
250 memset(&cmd, 0,
sizeof(cmd));
257 netxen_issue_cmd(adapter, &cmd);
271 memset(&cmd, 0,
sizeof(cmd));
273 cmd.
req.arg1 = speed;
276 return netxen_issue_cmd(adapter, &cmd);
293 dma_addr_t hostrq_phys_addr, cardrsp_phys_addr;
296 int i, nrds_rings, nsds_rings;
313 rq_size, &hostrq_phys_addr);
319 rsp_size, &cardrsp_phys_addr);
351 for (i = 0; i < nrds_rings; i++) {
364 for (i = 0; i < nsds_rings; i++) {
373 phys_addr = hostrq_phys_addr;
374 memset(&cmd, 0,
sizeof(cmd));
375 cmd.
req.arg1 = (
u32)(phys_addr >> 32);
376 cmd.
req.arg2 = (
u32)(phys_addr & 0xffffffff);
379 err = netxen_issue_cmd(adapter, &cmd);
382 "Failed to create rx ctx in firmware%d\n", err);
430 memset(&cmd, 0,
sizeof(cmd));
436 if (netxen_issue_cmd(adapter, &cmd)) {
438 "%s: Failed to destroy rx ctx in firmware\n",
449 void *rq_addr, *rsp_addr;
461 rq_size, &rq_phys_addr);
467 rsp_size, &rsp_phys_addr);
473 memset(rq_addr, 0, rq_size);
476 memset(rsp_addr, 0, rsp_size);
500 phys_addr = rq_phys_addr;
501 memset(&cmd, 0,
sizeof(cmd));
502 cmd.
req.arg1 = (
u32)(phys_addr >> 32);
503 cmd.
req.arg2 = ((
u32)phys_addr & 0xffffffff);
506 err = netxen_issue_cmd(adapter, &cmd);
520 "Failed to create tx ctx in firmware%d\n", err);
537 memset(&cmd, 0,
sizeof(cmd));
542 if (netxen_issue_cmd(adapter, &cmd)) {
544 "%s: Failed to destroy tx ctx in firmware\n",
555 memset(&cmd, 0,
sizeof(cmd));
561 rcode = netxen_issue_cmd(adapter, &cmd);
578 memset(&cmd, 0,
sizeof(cmd));
583 rcode = netxen_issue_cmd(adapter, &cmd);
590 static u64 ctx_addr_sig_regs[][3] = {
597 #define CRB_CTX_ADDR_REG_LO(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][0])
598 #define CRB_CTX_ADDR_REG_HI(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][2])
599 #define CRB_CTX_SIGNATURE_REG(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][1])
601 #define lower32(x) ((u32)((x) & 0xffffffff))
602 #define upper32(x) ((u32)(((u64)(x) >> 32) & 0xffffffff))
721 hwctx = recv_ctx->
hwctx;
782 dev_err(&pdev->
dev,
"failed to allocate hw context\n");
789 recv_ctx->
hwctx->cmd_consumer_offset =
800 dev_err(&pdev->
dev,
"%s: failed to allocate tx desc ring\n",
815 "%s: failed to allocate rds ring [%d]\n",
825 recv_crb_registers[port].crb_rcv_producer[ring]);
836 "%s: failed to allocate sds ring [%d]\n",
846 recv_crb_registers[port].crb_sts_consumer[ring]);
850 recv_crb_registers[port].sw_int_mask[ring]);
858 err = nx_fw_cmd_create_rx_ctx(adapter);
861 err = nx_fw_cmd_create_tx_ctx(adapter);
865 err = netxen_init_old_ctx(adapter);
892 nx_fw_cmd_destroy_rx_ctx(adapter);
893 nx_fw_cmd_destroy_tx_ctx(adapter);