2 * Copyright (c) 2012-2016 Solarflare Communications Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * The views and conclusions contained in the software and documentation are
27 * those of the authors and should not be interpreted as representing official
28 * policies, either expressed or implied, of the FreeBSD Project.
35 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
37 __checkReturn efx_rc_t
40 __in efx_intr_type_t type
,
41 __in efsys_mem_t
*esmp
)
43 _NOTE(ARGUNUSED(enp
, type
, esmp
))
65 ef10_intr_disable_unlocked(
72 static __checkReturn efx_rc_t
73 efx_mcdi_trigger_interrupt(
75 __in
unsigned int level
)
78 uint8_t payload
[MAX(MC_CMD_TRIGGER_INTERRUPT_IN_LEN
,
79 MC_CMD_TRIGGER_INTERRUPT_OUT_LEN
)];
82 EFSYS_ASSERT(enp
->en_family
== EFX_FAMILY_HUNTINGTON
||
83 enp
->en_family
== EFX_FAMILY_MEDFORD
);
85 if (level
>= enp
->en_nic_cfg
.enc_intr_limit
) {
90 (void) memset(payload
, 0, sizeof (payload
));
91 req
.emr_cmd
= MC_CMD_TRIGGER_INTERRUPT
;
92 req
.emr_in_buf
= payload
;
93 req
.emr_in_length
= MC_CMD_TRIGGER_INTERRUPT_IN_LEN
;
94 req
.emr_out_buf
= payload
;
95 req
.emr_out_length
= MC_CMD_TRIGGER_INTERRUPT_OUT_LEN
;
97 MCDI_IN_SET_DWORD(req
, TRIGGER_INTERRUPT_IN_INTR_LEVEL
, level
);
99 efx_mcdi_execute(enp
, &req
);
101 if (req
.emr_rc
!= 0) {
112 EFSYS_PROBE1(fail1
, efx_rc_t
, rc
);
117 __checkReturn efx_rc_t
120 __in
unsigned int level
)
122 efx_nic_cfg_t
*encp
= &(enp
->en_nic_cfg
);
125 if (encp
->enc_bug41750_workaround
) {
127 * bug 41750: Test interrupts don't work on Greenport
128 * bug 50084: Test interrupts don't work on VFs
134 if ((rc
= efx_mcdi_trigger_interrupt(enp
, level
)) != 0)
142 EFSYS_PROBE1(fail1
, efx_rc_t
, rc
);
148 ef10_intr_status_line(
150 __out boolean_t
*fatalp
,
151 __out
uint32_t *qmaskp
)
155 EFSYS_ASSERT(enp
->en_family
== EFX_FAMILY_HUNTINGTON
||
156 enp
->en_family
== EFX_FAMILY_MEDFORD
);
158 /* Read the queue mask and implicitly acknowledge the interrupt. */
159 EFX_BAR_READD(enp
, ER_DZ_BIU_INT_ISR_REG
, &dword
, B_FALSE
);
160 *qmaskp
= EFX_DWORD_FIELD(dword
, EFX_DWORD_0
);
162 EFSYS_PROBE1(qmask
, uint32_t, *qmaskp
);
168 ef10_intr_status_message(
170 __in
unsigned int message
,
171 __out boolean_t
*fatalp
)
173 EFSYS_ASSERT(enp
->en_family
== EFX_FAMILY_HUNTINGTON
||
174 enp
->en_family
== EFX_FAMILY_MEDFORD
);
176 _NOTE(ARGUNUSED(enp
, message
))
178 /* EF10 fatal errors are reported via events */
186 /* EF10 fatal errors are reported via events */
187 _NOTE(ARGUNUSED(enp
))
194 _NOTE(ARGUNUSED(enp
))
197 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */