Deleted Added
full compact
efx_mcdi.c (250460) efx_mcdi.c (278839)
1/*-
2 * Copyright 2008-2009 Solarflare Communications Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright 2008-2009 Solarflare Communications Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/efx_mcdi.c 250460 2013-05-10 16:41:26Z eadler $");
27__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/efx_mcdi.c 278839 2015-02-16 06:12:04Z arybchik $");
28
29#include "efsys.h"
30#include "efx.h"
31#include "efx_types.h"
32#include "efx_regs.h"
33#include "efx_regs_mcdi.h"
34#include "efx_impl.h"
35
36#if EFSYS_OPT_MCDI
37
38/* Shared memory layout */
39
40#define MCDI_P1_DBL_OFST 0x0
41#define MCDI_P2_DBL_OFST 0x1
42#define MCDI_P1_PDU_OFST 0x2
43#define MCDI_P2_PDU_OFST 0x42
44#define MCDI_P1_REBOOT_OFST 0x1fe
45#define MCDI_P2_REBOOT_OFST 0x1ff
46
28
29#include "efsys.h"
30#include "efx.h"
31#include "efx_types.h"
32#include "efx_regs.h"
33#include "efx_regs_mcdi.h"
34#include "efx_impl.h"
35
36#if EFSYS_OPT_MCDI
37
38/* Shared memory layout */
39
40#define MCDI_P1_DBL_OFST 0x0
41#define MCDI_P2_DBL_OFST 0x1
42#define MCDI_P1_PDU_OFST 0x2
43#define MCDI_P2_PDU_OFST 0x42
44#define MCDI_P1_REBOOT_OFST 0x1fe
45#define MCDI_P2_REBOOT_OFST 0x1ff
46
47/* A reboot/assertion causes the MCDI status word to be set after the
47/*
48 * A reboot/assertion causes the MCDI status word to be set after the
48 * command word is set or a REBOOT event is sent. If we notice a reboot
49 * via these mechanisms then wait 10ms for the status word to be set.
50 */
51#define MCDI_STATUS_SLEEP_US 10000
52
53 void
54efx_mcdi_request_start(
55 __in efx_nic_t *enp,

--- 398 unchanged lines hidden (view full) ---

454 if (emrp != NULL && emip->emi_ev_cpl) {
455 emip->emi_pending_req = NULL;
456
457 emrp->emr_out_length_used = 0;
458 emrp->emr_rc = rc;
459 ++emip->emi_aborted;
460 }
461
49 * command word is set or a REBOOT event is sent. If we notice a reboot
50 * via these mechanisms then wait 10ms for the status word to be set.
51 */
52#define MCDI_STATUS_SLEEP_US 10000
53
54 void
55efx_mcdi_request_start(
56 __in efx_nic_t *enp,

--- 398 unchanged lines hidden (view full) ---

455 if (emrp != NULL && emip->emi_ev_cpl) {
456 emip->emi_pending_req = NULL;
457
458 emrp->emr_out_length_used = 0;
459 emrp->emr_rc = rc;
460 ++emip->emi_aborted;
461 }
462
462 /* Since we're running in parallel with a request, consume the
463 /*
464 * Since we're running in parallel with a request, consume the
463 * status word before dropping the lock.
464 */
465 if (rc == EIO || rc == EINTR) {
466 EFSYS_SPIN(MCDI_STATUS_SLEEP_US);
467 (void) efx_mcdi_poll_reboot(enp);
468 }
469
470 EFSYS_UNLOCK(enp->en_eslp, state);

--- 266 unchanged lines hidden ---
465 * status word before dropping the lock.
466 */
467 if (rc == EIO || rc == EINTR) {
468 EFSYS_SPIN(MCDI_STATUS_SLEEP_US);
469 (void) efx_mcdi_poll_reboot(enp);
470 }
471
472 EFSYS_UNLOCK(enp->en_eslp, state);

--- 266 unchanged lines hidden ---