oce_mbox.c (231437) | oce_mbox.c (231879) |
---|---|
1/*- 2 * Copyright (C) 2012 Emulex 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 23 unchanged lines hidden (view full) --- 32 * freebsd-drivers@emulex.com 33 * 34 * Emulex 35 * 3333 Susan Street 36 * Costa Mesa, CA 92626 37 */ 38 39 | 1/*- 2 * Copyright (C) 2012 Emulex 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 23 unchanged lines hidden (view full) --- 32 * freebsd-drivers@emulex.com 33 * 34 * Emulex 35 * 3333 Susan Street 36 * Costa Mesa, CA 92626 37 */ 38 39 |
40/* $FreeBSD: head/sys/dev/oce/oce_mbox.c 231879 2012-02-17 13:55:17Z luigi $ */ |
|
40 | 41 |
41/* $FreeBSD: head/sys/dev/oce/oce_mbox.c 231437 2012-02-10 21:03:04Z luigi $ */ 42 43 | |
44#include "oce_if.h" 45 46 47/** 48 * @brief Reset (firmware) common function 49 * @param sc software handle to the device 50 * @returns 0 on success, ETIMEDOUT on failure 51 */ --- 88 unchanged lines hidden (view full) --- 140 } 141 142 device_printf(sc->dev, "Mailbox timed out\n"); 143 144 return ETIMEDOUT; 145} 146 147 | 42#include "oce_if.h" 43 44 45/** 46 * @brief Reset (firmware) common function 47 * @param sc software handle to the device 48 * @returns 0 on success, ETIMEDOUT on failure 49 */ --- 88 unchanged lines hidden (view full) --- 138 } 139 140 device_printf(sc->dev, "Mailbox timed out\n"); 141 142 return ETIMEDOUT; 143} 144 145 |
148 | |
149/** 150 * @brief Mailbox dispatch 151 * @param sc software handle to the device 152 * @param tmo_sec timeout in seconds 153 */ 154int 155oce_mbox_dispatch(POCE_SOFTC sc, uint32_t tmo_sec) 156{ --- 127 unchanged lines hidden (view full) --- 284 285 bcopy(fwcmd->params.rsp.fw_ver_str, sc->fw_version, 32); 286 287 return 0; 288} 289 290 291/** | 146/** 147 * @brief Mailbox dispatch 148 * @param sc software handle to the device 149 * @param tmo_sec timeout in seconds 150 */ 151int 152oce_mbox_dispatch(POCE_SOFTC sc, uint32_t tmo_sec) 153{ --- 127 unchanged lines hidden (view full) --- 281 282 bcopy(fwcmd->params.rsp.fw_ver_str, sc->fw_version, 32); 283 284 return 0; 285} 286 287 288/** |
289 * @brief Firmware will send gracious notifications during 290 * attach only after sending first mcc commnad. We 291 * use MCC queue only for getting async and mailbox 292 * for sending cmds. So to get gracious notifications 293 * atleast send one dummy command on mcc. 294 */ 295int 296oce_first_mcc_cmd(POCE_SOFTC sc) 297{ 298 struct oce_mbx *mbx; 299 struct oce_mq *mq = sc->mq; 300 struct mbx_get_common_fw_version *fwcmd; 301 uint32_t reg_value; 302 303 mbx = RING_GET_PRODUCER_ITEM_VA(mq->ring, struct oce_mbx); 304 bzero(mbx, sizeof(struct oce_mbx)); 305 306 fwcmd = (struct mbx_get_common_fw_version *)&mbx->payload; 307 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, 308 MBX_SUBSYSTEM_COMMON, 309 OPCODE_COMMON_GET_FW_VERSION, 310 MBX_TIMEOUT_SEC, 311 sizeof(struct mbx_get_common_fw_version), 312 OCE_MBX_VER_V0); 313 mbx->u0.s.embedded = 1; 314 mbx->payload_length = sizeof(struct mbx_get_common_fw_version); 315 bus_dmamap_sync(mq->ring->dma.tag, mq->ring->dma.map, 316 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); 317 RING_PUT(mq->ring, 1); 318 reg_value = (1 << 16) | mq->mq_id; 319 OCE_WRITE_REG32(sc, db, PD_MQ_DB, reg_value); 320 321 return 0; 322} 323 324/** |
|
292 * @brief Function to post a MBX to the mbox 293 * @param sc software handle to the device 294 * @param mbx pointer to the MBX to send 295 * @param mbxctx pointer to the mbx context structure 296 * @returns 0 on success, error on failure 297 */ 298int 299oce_mbox_post(POCE_SOFTC sc, struct oce_mbx *mbx, struct oce_mbx_ctx *mbxctx) --- 1023 unchanged lines hidden (view full) --- 1323 mbx.u0.s.sge_count = 1; 1324 1325 sgl = &mbx.payload.u0.u1.sgl[0]; 1326 sgl->pa_hi = upper_32_bits(pdma_mem->paddr); 1327 sgl->pa_lo = pdma_mem->paddr & 0xFFFFFFFF; 1328 sgl->length = payload_len; 1329 1330 /* post the command */ | 325 * @brief Function to post a MBX to the mbox 326 * @param sc software handle to the device 327 * @param mbx pointer to the MBX to send 328 * @param mbxctx pointer to the mbx context structure 329 * @returns 0 on success, error on failure 330 */ 331int 332oce_mbox_post(POCE_SOFTC sc, struct oce_mbx *mbx, struct oce_mbx_ctx *mbxctx) --- 1023 unchanged lines hidden (view full) --- 1356 mbx.u0.s.sge_count = 1; 1357 1358 sgl = &mbx.payload.u0.u1.sgl[0]; 1359 sgl->pa_hi = upper_32_bits(pdma_mem->paddr); 1360 sgl->pa_lo = pdma_mem->paddr & 0xFFFFFFFF; 1361 sgl->length = payload_len; 1362 1363 /* post the command */ |
1364 rc = oce_mbox_post(sc, &mbx, NULL); |
|
1331 if (rc) { 1332 device_printf(sc->dev, "Write FlashROM mbox post failed\n"); 1333 } else { 1334 rc = fwcmd->hdr.u0.rsp.status; 1335 } 1336 1337 return rc; 1338 --- 367 unchanged lines hidden --- | 1365 if (rc) { 1366 device_printf(sc->dev, "Write FlashROM mbox post failed\n"); 1367 } else { 1368 rc = fwcmd->hdr.u0.rsp.status; 1369 } 1370 1371 return rc; 1372 --- 367 unchanged lines hidden --- |