3 static void ql_display_mb_sts(struct ql_adapter *qdev,
4 struct mbox_params *mbcp)
7 static char *err_sts[] = {
9 "Command Not Supported",
10 "Host Interface Error",
12 "Unused Completion Status",
14 "Command Parameter Error"};
16 QPRINTK(qdev, DRV, DEBUG, "%s.\n",
17 err_sts[mbcp->mbox_out[0] & 0x0000000f]);
18 for (i = 0; i < mbcp->out_count; i++)
19 QPRINTK(qdev, DRV, DEBUG, "mbox_out[%d] = 0x%.08x.\n",
20 i, mbcp->mbox_out[i]);
23 int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data)
26 /* wait for reg to come ready */
27 status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR);
30 /* set up for reg read */
31 ql_write32(qdev, PROC_ADDR, reg | PROC_ADDR_R);
32 /* wait for reg to come ready */
33 status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR);
37 *data = ql_read32(qdev, PROC_DATA);
42 int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data)
45 /* wait for reg to come ready */
46 status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR);
49 /* write the data to the data reg */
50 ql_write32(qdev, PROC_DATA, data);
51 /* trigger the write */
52 ql_write32(qdev, PROC_ADDR, reg);
53 /* wait for reg to come ready */
54 status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR);
61 int ql_soft_reset_mpi_risc(struct ql_adapter *qdev)
64 status = ql_write_mpi_reg(qdev, 0x00001010, 1);
68 static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp)
72 status = ql_sem_spinlock(qdev, SEM_PROC_REG_MASK);
75 for (i = 0; i < mbcp->out_count; i++) {
77 ql_read_mpi_reg(qdev, qdev->mailbox_out + i,
80 QPRINTK(qdev, DRV, ERR, "Failed mailbox read.\n");
84 ql_sem_unlock(qdev, SEM_PROC_REG_MASK); /* does flush too */
88 /* Wait for a single mailbox command to complete.
89 * Returns zero on success.
91 static int ql_wait_mbx_cmd_cmplt(struct ql_adapter *qdev)
97 value = ql_read32(qdev, STS);
100 mdelay(UDELAY_DELAY); /* 100ms */
105 /* Execute a single mailbox command.
106 * Caller must hold PROC_ADDR semaphore.
108 static int ql_exec_mb_cmd(struct ql_adapter *qdev, struct mbox_params *mbcp)
113 * Make sure there's nothing pending.
114 * This shouldn't happen.
116 if (ql_read32(qdev, CSR) & CSR_HRI)
119 status = ql_sem_spinlock(qdev, SEM_PROC_REG_MASK);
124 * Fill the outbound mailboxes.
126 for (i = 0; i < mbcp->in_count; i++) {
127 status = ql_write_mpi_reg(qdev, qdev->mailbox_in + i,
133 * Wake up the MPI firmware.
135 ql_write32(qdev, CSR, CSR_CMD_SET_H2R_INT);
137 ql_sem_unlock(qdev, SEM_PROC_REG_MASK);
141 /* We are being asked by firmware to accept
142 * a change to the port. This is only
143 * a change to max frame sizes (Tx/Rx), pause
144 * parameters, or loopback mode. We wake up a worker
145 * to handler processing this since a mailbox command
146 * will need to be sent to ACK the request.
148 static int ql_idc_req_aen(struct ql_adapter *qdev)
151 struct mbox_params *mbcp = &qdev->idc_mbc;
153 QPRINTK(qdev, DRV, ERR, "Enter!\n");
154 /* Get the status data and start up a thread to
155 * handle the request.
157 mbcp = &qdev->idc_mbc;
159 status = ql_get_mb_sts(qdev, mbcp);
161 QPRINTK(qdev, DRV, ERR,
162 "Could not read MPI, resetting ASIC!\n");
163 ql_queue_asic_error(qdev);
165 /* Begin polled mode early so
166 * we don't get another interrupt
167 * when we leave mpi_worker.
169 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16));
170 queue_delayed_work(qdev->workqueue, &qdev->mpi_idc_work, 0);
175 /* Process an inter-device event completion.
176 * If good, signal the caller's completion.
178 static int ql_idc_cmplt_aen(struct ql_adapter *qdev)
181 struct mbox_params *mbcp = &qdev->idc_mbc;
183 status = ql_get_mb_sts(qdev, mbcp);
185 QPRINTK(qdev, DRV, ERR,
186 "Could not read MPI, resetting RISC!\n");
187 ql_queue_fw_error(qdev);
189 /* Wake up the sleeping mpi_idc_work thread that is
190 * waiting for this event.
192 complete(&qdev->ide_completion);
197 static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp)
202 status = ql_get_mb_sts(qdev, mbcp);
204 QPRINTK(qdev, DRV, ERR,
205 "%s: Could not get mailbox status.\n", __func__);
209 qdev->link_status = mbcp->mbox_out[1];
210 QPRINTK(qdev, DRV, ERR, "Link Up.\n");
212 /* If we're coming back from an IDC event
213 * then set up the CAM and frame routing.
215 if (test_bit(QL_CAM_RT_SET, &qdev->flags)) {
216 status = ql_cam_route_initialize(qdev);
218 QPRINTK(qdev, IFUP, ERR,
219 "Failed to init CAM/Routing tables.\n");
222 clear_bit(QL_CAM_RT_SET, &qdev->flags);
225 /* Queue up a worker to check the frame
226 * size information, and fix it if it's not
229 if (!test_bit(QL_PORT_CFG, &qdev->flags)) {
230 QPRINTK(qdev, DRV, ERR, "Queue Port Config Worker!\n");
231 set_bit(QL_PORT_CFG, &qdev->flags);
232 /* Begin polled mode early so
233 * we don't get another interrupt
234 * when we leave mpi_worker dpc.
236 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16));
237 queue_delayed_work(qdev->workqueue,
238 &qdev->mpi_port_cfg_work, 0);
244 static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp)
250 status = ql_get_mb_sts(qdev, mbcp);
252 QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n");
257 static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp)
263 status = ql_get_mb_sts(qdev, mbcp);
265 QPRINTK(qdev, DRV, ERR, "SFP in AEN broken!\n");
267 QPRINTK(qdev, DRV, ERR, "SFP insertion detected.\n");
272 static int ql_sfp_out(struct ql_adapter *qdev, struct mbox_params *mbcp)
278 status = ql_get_mb_sts(qdev, mbcp);
280 QPRINTK(qdev, DRV, ERR, "SFP out AEN broken!\n");
282 QPRINTK(qdev, DRV, ERR, "SFP removal detected.\n");
287 static int ql_aen_lost(struct ql_adapter *qdev, struct mbox_params *mbcp)
293 status = ql_get_mb_sts(qdev, mbcp);
295 QPRINTK(qdev, DRV, ERR, "Lost AEN broken!\n");
298 QPRINTK(qdev, DRV, ERR, "Lost AEN detected.\n");
299 for (i = 0; i < mbcp->out_count; i++)
300 QPRINTK(qdev, DRV, ERR, "mbox_out[%d] = 0x%.08x.\n",
301 i, mbcp->mbox_out[i]);
308 static void ql_init_fw_done(struct ql_adapter *qdev, struct mbox_params *mbcp)
314 status = ql_get_mb_sts(qdev, mbcp);
316 QPRINTK(qdev, DRV, ERR, "Firmware did not initialize!\n");
318 QPRINTK(qdev, DRV, ERR, "Firmware Revision = 0x%.08x.\n",
320 status = ql_cam_route_initialize(qdev);
322 QPRINTK(qdev, IFUP, ERR,
323 "Failed to init CAM/Routing tables.\n");
327 /* Process an async event and clear it unless it's an
329 * This can get called iteratively from the mpi_work thread
330 * when events arrive via an interrupt.
331 * It also gets called when a mailbox command is polling for
332 * it's completion. */
333 static int ql_mpi_handler(struct ql_adapter *qdev, struct mbox_params *mbcp)
336 int orig_count = mbcp->out_count;
338 /* Just get mailbox zero for now. */
340 status = ql_get_mb_sts(qdev, mbcp);
342 QPRINTK(qdev, DRV, ERR,
343 "Could not read MPI, resetting ASIC!\n");
344 ql_queue_asic_error(qdev);
348 switch (mbcp->mbox_out[0]) {
350 /* This case is only active when we arrive here
351 * as a result of issuing a mailbox command to
354 case MB_CMD_STS_INTRMDT:
355 case MB_CMD_STS_GOOD:
356 case MB_CMD_STS_INVLD_CMD:
357 case MB_CMD_STS_XFC_ERR:
358 case MB_CMD_STS_CSUM_ERR:
360 case MB_CMD_STS_PARAM_ERR:
361 /* We can only get mailbox status if we're polling from an
362 * unfinished command. Get the rest of the status data and
363 * return back to the caller.
364 * We only end up here when we're polling for a mailbox
365 * command completion.
367 mbcp->out_count = orig_count;
368 status = ql_get_mb_sts(qdev, mbcp);
371 /* We are being asked by firmware to accept
372 * a change to the port. This is only
373 * a change to max frame sizes (Tx/Rx), pause
374 * parameters, or loopback mode.
377 status = ql_idc_req_aen(qdev);
380 /* Process and inbound IDC event.
381 * This will happen when we're trying to
382 * change tx/rx max frame size, change pause
383 * parameters or loopback mode.
387 status = ql_idc_cmplt_aen(qdev);
391 ql_link_up(qdev, mbcp);
395 ql_link_down(qdev, mbcp);
398 case AEN_FW_INIT_DONE:
399 /* If we're in process on executing the firmware,
400 * then convert the status to normal mailbox status.
402 if (mbcp->mbox_in[0] == MB_CMD_EX_FW) {
403 mbcp->out_count = orig_count;
404 status = ql_get_mb_sts(qdev, mbcp);
405 mbcp->mbox_out[0] = MB_CMD_STS_GOOD;
408 ql_init_fw_done(qdev, mbcp);
412 ql_sfp_in(qdev, mbcp);
415 case AEN_AEN_SFP_OUT:
416 ql_sfp_out(qdev, mbcp);
419 /* This event can arrive at boot time or after an
420 * MPI reset if the firmware failed to initialize.
422 case AEN_FW_INIT_FAIL:
423 /* If we're in process on executing the firmware,
424 * then convert the status to normal mailbox status.
426 if (mbcp->mbox_in[0] == MB_CMD_EX_FW) {
427 mbcp->out_count = orig_count;
428 status = ql_get_mb_sts(qdev, mbcp);
429 mbcp->mbox_out[0] = MB_CMD_STS_ERR;
432 QPRINTK(qdev, DRV, ERR,
433 "Firmware initialization failed.\n");
435 ql_queue_fw_error(qdev);
439 QPRINTK(qdev, DRV, ERR,
441 ql_queue_fw_error(qdev);
446 ql_aen_lost(qdev, mbcp);
450 /* Need to support AEN 8110 */
453 QPRINTK(qdev, DRV, ERR,
454 "Unsupported AE %.08x.\n", mbcp->mbox_out[0]);
455 /* Clear the MPI firmware status. */
458 ql_write32(qdev, CSR, CSR_CMD_CLR_R2PCI_INT);
459 /* Restore the original mailbox count to
460 * what the caller asked for. This can get
461 * changed when a mailbox command is waiting
462 * for a response and an AEN arrives and
465 mbcp->out_count = orig_count;
469 /* Execute a single mailbox command.
470 * mbcp is a pointer to an array of u32. Each
471 * element in the array contains the value for it's
472 * respective mailbox register.
474 static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
479 /* Begin polled mode for MPI */
480 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16));
482 /* Load the mailbox registers and wake up MPI RISC. */
483 status = ql_exec_mb_cmd(qdev, mbcp);
488 /* If we're generating a system error, then there's nothing
491 if (mbcp->mbox_in[0] == MB_CMD_MAKE_SYS_ERR)
494 /* Wait for the command to complete. We loop
495 * here because some AEN might arrive while
496 * we're waiting for the mailbox command to
497 * complete. If more than 5 arrive then we can
498 * assume something is wrong. */
501 /* Wait for the interrupt to come in. */
502 status = ql_wait_mbx_cmd_cmplt(qdev);
506 /* Process the event. If it's an AEN, it
507 * will be handled in-line or a worker
508 * will be spawned. If it's our completion
509 * we will catch it below.
511 status = ql_mpi_handler(qdev, mbcp);
515 /* It's either the completion for our mailbox
516 * command complete or an AEN. If it's our
517 * completion then get out.
519 if (((mbcp->mbox_out[0] & 0x0000f000) ==
521 ((mbcp->mbox_out[0] & 0x0000f000) ==
527 QPRINTK(qdev, DRV, ERR,
528 "Timed out waiting for mailbox complete.\n");
533 /* Now we can clear the interrupt condition
534 * and look at our status.
536 ql_write32(qdev, CSR, CSR_CMD_CLR_R2PCI_INT);
538 if (((mbcp->mbox_out[0] & 0x0000f000) !=
540 ((mbcp->mbox_out[0] & 0x0000f000) !=
541 MB_CMD_STS_INTRMDT)) {
542 ql_display_mb_sts(qdev, mbcp);
546 /* End polled mode for MPI */
547 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI);
552 /* Get MPI firmware version. This will be used for
553 * driver banner and for ethtool info.
554 * Returns zero on success.
556 int ql_mb_about_fw(struct ql_adapter *qdev)
558 struct mbox_params mbc;
559 struct mbox_params *mbcp = &mbc;
562 memset(mbcp, 0, sizeof(struct mbox_params));
567 mbcp->mbox_in[0] = MB_CMD_ABOUT_FW;
569 status = ql_mailbox_command(qdev, mbcp);
573 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
574 QPRINTK(qdev, DRV, ERR,
575 "Failed about firmware command\n");
579 /* Store the firmware version */
580 qdev->fw_rev_id = mbcp->mbox_out[1];
585 /* Get functional state for MPI firmware.
586 * Returns zero on success.
588 int ql_mb_get_fw_state(struct ql_adapter *qdev)
590 struct mbox_params mbc;
591 struct mbox_params *mbcp = &mbc;
594 memset(mbcp, 0, sizeof(struct mbox_params));
599 mbcp->mbox_in[0] = MB_CMD_GET_FW_STATE;
601 status = ql_mailbox_command(qdev, mbcp);
605 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
606 QPRINTK(qdev, DRV, ERR,
607 "Failed Get Firmware State.\n");
611 /* If bit zero is set in mbx 1 then the firmware is
612 * running, but not initialized. This should never
615 if (mbcp->mbox_out[1] & 1) {
616 QPRINTK(qdev, DRV, ERR,
617 "Firmware waiting for initialization.\n");
624 /* Send and ACK mailbox command to the firmware to
625 * let it continue with the change.
627 int ql_mb_idc_ack(struct ql_adapter *qdev)
629 struct mbox_params mbc;
630 struct mbox_params *mbcp = &mbc;
633 memset(mbcp, 0, sizeof(struct mbox_params));
638 mbcp->mbox_in[0] = MB_CMD_IDC_ACK;
639 mbcp->mbox_in[1] = qdev->idc_mbc.mbox_out[1];
640 mbcp->mbox_in[2] = qdev->idc_mbc.mbox_out[2];
641 mbcp->mbox_in[3] = qdev->idc_mbc.mbox_out[3];
642 mbcp->mbox_in[4] = qdev->idc_mbc.mbox_out[4];
644 status = ql_mailbox_command(qdev, mbcp);
648 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
649 QPRINTK(qdev, DRV, ERR,
650 "Failed IDC ACK send.\n");
656 /* Get link settings and maximum frame size settings
657 * for the current port.
658 * Most likely will block.
660 static int ql_mb_set_port_cfg(struct ql_adapter *qdev)
662 struct mbox_params mbc;
663 struct mbox_params *mbcp = &mbc;
666 memset(mbcp, 0, sizeof(struct mbox_params));
671 mbcp->mbox_in[0] = MB_CMD_SET_PORT_CFG;
672 mbcp->mbox_in[1] = qdev->link_config;
673 mbcp->mbox_in[2] = qdev->max_frame_size;
676 status = ql_mailbox_command(qdev, mbcp);
680 if (mbcp->mbox_out[0] == MB_CMD_STS_INTRMDT) {
681 QPRINTK(qdev, DRV, ERR,
682 "Port Config sent, wait for IDC.\n");
683 } else if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
684 QPRINTK(qdev, DRV, ERR,
685 "Failed Set Port Configuration.\n");
691 /* Get link settings and maximum frame size settings
692 * for the current port.
693 * Most likely will block.
695 static int ql_mb_get_port_cfg(struct ql_adapter *qdev)
697 struct mbox_params mbc;
698 struct mbox_params *mbcp = &mbc;
701 memset(mbcp, 0, sizeof(struct mbox_params));
706 mbcp->mbox_in[0] = MB_CMD_GET_PORT_CFG;
708 status = ql_mailbox_command(qdev, mbcp);
712 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
713 QPRINTK(qdev, DRV, ERR,
714 "Failed Get Port Configuration.\n");
717 QPRINTK(qdev, DRV, DEBUG,
718 "Passed Get Port Configuration.\n");
719 qdev->link_config = mbcp->mbox_out[1];
720 qdev->max_frame_size = mbcp->mbox_out[2];
725 /* IDC - Inter Device Communication...
726 * Some firmware commands require consent of adjacent FCOE
727 * function. This function waits for the OK, or a
728 * counter-request for a little more time.i
729 * The firmware will complete the request if the other
730 * function doesn't respond.
732 static int ql_idc_wait(struct ql_adapter *qdev)
734 int status = -ETIMEDOUT;
735 long wait_time = 1 * HZ;
736 struct mbox_params *mbcp = &qdev->idc_mbc;
738 /* Wait here for the command to complete
739 * via the IDC process.
742 wait_for_completion_timeout(&qdev->ide_completion,
745 QPRINTK(qdev, DRV, ERR,
749 /* Now examine the response from the IDC process.
750 * We might have a good completion or a request for
753 if (mbcp->mbox_out[0] == AEN_IDC_EXT) {
754 QPRINTK(qdev, DRV, ERR,
755 "IDC Time Extension from function.\n");
756 wait_time += (mbcp->mbox_out[1] >> 8) & 0x0000000f;
757 } else if (mbcp->mbox_out[0] == AEN_IDC_CMPLT) {
758 QPRINTK(qdev, DRV, ERR,
763 QPRINTK(qdev, DRV, ERR,
764 "IDC: Invalid State 0x%.04x.\n",
774 int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control)
776 struct mbox_params mbc;
777 struct mbox_params *mbcp = &mbc;
780 memset(mbcp, 0, sizeof(struct mbox_params));
785 mbcp->mbox_in[0] = MB_CMD_SET_MGMNT_TFK_CTL;
786 mbcp->mbox_in[1] = control;
788 status = ql_mailbox_command(qdev, mbcp);
792 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD)
795 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) {
796 QPRINTK(qdev, DRV, ERR,
797 "Command not supported by firmware.\n");
799 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) {
800 /* This indicates that the firmware is
801 * already in the state we are trying to
804 QPRINTK(qdev, DRV, ERR,
805 "Command parameters make no change.\n");
810 /* Returns a negative error code or the mailbox command status. */
811 static int ql_mb_get_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 *control)
813 struct mbox_params mbc;
814 struct mbox_params *mbcp = &mbc;
817 memset(mbcp, 0, sizeof(struct mbox_params));
823 mbcp->mbox_in[0] = MB_CMD_GET_MGMNT_TFK_CTL;
825 status = ql_mailbox_command(qdev, mbcp);
829 if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) {
830 *control = mbcp->mbox_in[1];
834 if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) {
835 QPRINTK(qdev, DRV, ERR,
836 "Command not supported by firmware.\n");
838 } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) {
839 QPRINTK(qdev, DRV, ERR,
840 "Failed to get MPI traffic control.\n");
846 int ql_wait_fifo_empty(struct ql_adapter *qdev)
849 u32 mgmnt_fifo_empty;
853 nic_fifo_empty = ql_read32(qdev, STS) & STS_NFE;
854 ql_mb_get_mgmnt_traffic_ctl(qdev, &mgmnt_fifo_empty);
855 mgmnt_fifo_empty &= MB_GET_MPI_TFK_FIFO_EMPTY;
856 if (nic_fifo_empty && mgmnt_fifo_empty)
859 } while (count-- > 0);
863 /* API called in work thread context to set new TX/RX
864 * maximum frame size values to match MTU.
866 static int ql_set_port_cfg(struct ql_adapter *qdev)
870 status = ql_mb_set_port_cfg(qdev);
874 status = ql_idc_wait(qdev);
878 /* The following routines are worker threads that process
879 * events that may sleep waiting for completion.
882 /* This thread gets the maximum TX and RX frame size values
883 * from the firmware and, if necessary, changes them to match
886 void ql_mpi_port_cfg_work(struct work_struct *work)
888 struct ql_adapter *qdev =
889 container_of(work, struct ql_adapter, mpi_port_cfg_work.work);
893 status = ql_mb_get_port_cfg(qdev);
896 QPRINTK(qdev, DRV, ERR,
897 "Bug: Failed to get port config data.\n");
901 if (qdev->link_config & CFG_JUMBO_FRAME_SIZE &&
902 qdev->max_frame_size ==
903 CFG_DEFAULT_MAX_FRAME_SIZE)
906 qdev->link_config |= CFG_JUMBO_FRAME_SIZE;
907 qdev->max_frame_size = CFG_DEFAULT_MAX_FRAME_SIZE;
908 status = ql_set_port_cfg(qdev);
910 QPRINTK(qdev, DRV, ERR,
911 "Bug: Failed to set port config data.\n");
915 clear_bit(QL_PORT_CFG, &qdev->flags);
918 ql_queue_fw_error(qdev);
922 /* Process an inter-device request. This is issues by
923 * the firmware in response to another function requesting
924 * a change to the port. We set a flag to indicate a change
925 * has been made and then send a mailbox command ACKing
926 * the change request.
928 void ql_mpi_idc_work(struct work_struct *work)
930 struct ql_adapter *qdev =
931 container_of(work, struct ql_adapter, mpi_idc_work.work);
933 struct mbox_params *mbcp = &qdev->idc_mbc;
936 aen = mbcp->mbox_out[1] >> 16;
940 QPRINTK(qdev, DRV, ERR,
941 "Bug: Unhandled IDC action.\n");
943 case MB_CMD_PORT_RESET:
944 case MB_CMD_SET_PORT_CFG:
947 /* Signal the resulting link up AEN
948 * that the frame routing and mac addr
951 set_bit(QL_CAM_RT_SET, &qdev->flags);
953 status = ql_mb_idc_ack(qdev);
956 QPRINTK(qdev, DRV, ERR,
957 "Bug: No pending IDC!\n");
962 void ql_mpi_work(struct work_struct *work)
964 struct ql_adapter *qdev =
965 container_of(work, struct ql_adapter, mpi_work.work);
966 struct mbox_params mbc;
967 struct mbox_params *mbcp = &mbc;
971 /* Begin polled mode for MPI */
972 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16));
974 while (ql_read32(qdev, STS) & STS_PI) {
975 memset(mbcp, 0, sizeof(struct mbox_params));
977 /* Don't continue if an async event
978 * did not complete properly.
980 err = ql_mpi_handler(qdev, mbcp);
985 /* End polled mode for MPI */
986 ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI);
988 ql_enable_completion_interrupt(qdev, 0);
991 void ql_mpi_reset_work(struct work_struct *work)
993 struct ql_adapter *qdev =
994 container_of(work, struct ql_adapter, mpi_reset_work.work);
995 cancel_delayed_work_sync(&qdev->mpi_work);
996 cancel_delayed_work_sync(&qdev->mpi_port_cfg_work);
997 cancel_delayed_work_sync(&qdev->mpi_idc_work);
998 ql_soft_reset_mpi_risc(qdev);