summaryrefslogtreecommitdiffstats
path: root/sys/dev/oce/oce_mbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/oce/oce_mbox.c')
-rw-r--r--sys/dev/oce/oce_mbox.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/sys/dev/oce/oce_mbox.c b/sys/dev/oce/oce_mbox.c
index 7ca3d41..07107a2 100644
--- a/sys/dev/oce/oce_mbox.c
+++ b/sys/dev/oce/oce_mbox.c
@@ -37,10 +37,8 @@
*/
-
/* $FreeBSD$ */
-
#include "oce_if.h"
@@ -145,7 +143,6 @@ oce_mbox_wait(POCE_SOFTC sc, uint32_t tmo_sec)
}
-
/**
* @brief Mailbox dispatch
* @param sc software handle to the device
@@ -289,6 +286,42 @@ oce_get_fw_version(POCE_SOFTC sc)
/**
+ * @brief Firmware will send gracious notifications during
+ * attach only after sending first mcc commnad. We
+ * use MCC queue only for getting async and mailbox
+ * for sending cmds. So to get gracious notifications
+ * atleast send one dummy command on mcc.
+ */
+int
+oce_first_mcc_cmd(POCE_SOFTC sc)
+{
+ struct oce_mbx *mbx;
+ struct oce_mq *mq = sc->mq;
+ struct mbx_get_common_fw_version *fwcmd;
+ uint32_t reg_value;
+
+ mbx = RING_GET_PRODUCER_ITEM_VA(mq->ring, struct oce_mbx);
+ bzero(mbx, sizeof(struct oce_mbx));
+
+ fwcmd = (struct mbx_get_common_fw_version *)&mbx->payload;
+ mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
+ MBX_SUBSYSTEM_COMMON,
+ OPCODE_COMMON_GET_FW_VERSION,
+ MBX_TIMEOUT_SEC,
+ sizeof(struct mbx_get_common_fw_version),
+ OCE_MBX_VER_V0);
+ mbx->u0.s.embedded = 1;
+ mbx->payload_length = sizeof(struct mbx_get_common_fw_version);
+ bus_dmamap_sync(mq->ring->dma.tag, mq->ring->dma.map,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+ RING_PUT(mq->ring, 1);
+ reg_value = (1 << 16) | mq->mq_id;
+ OCE_WRITE_REG32(sc, db, PD_MQ_DB, reg_value);
+
+ return 0;
+}
+
+/**
* @brief Function to post a MBX to the mbox
* @param sc software handle to the device
* @param mbx pointer to the MBX to send
@@ -1328,6 +1361,7 @@ oce_mbox_write_flashrom(POCE_SOFTC sc, uint32_t optype,uint32_t opcode,
sgl->length = payload_len;
/* post the command */
+ rc = oce_mbox_post(sc, &mbx, NULL);
if (rc) {
device_printf(sc->dev, "Write FlashROM mbox post failed\n");
} else {
OpenPOWER on IntegriCloud