1e948693eSPhilip Paeps /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni *
4929c7febSAndrew Rybchenko * Copyright (c) 2007-2016 Solarflare Communications Inc.
53c838a9fSAndrew Rybchenko * All rights reserved.
6e948693eSPhilip Paeps *
7e948693eSPhilip Paeps * Redistribution and use in source and binary forms, with or without
83c838a9fSAndrew Rybchenko * modification, are permitted provided that the following conditions are met:
9e948693eSPhilip Paeps *
103c838a9fSAndrew Rybchenko * 1. Redistributions of source code must retain the above copyright notice,
113c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer.
123c838a9fSAndrew Rybchenko * 2. Redistributions in binary form must reproduce the above copyright notice,
133c838a9fSAndrew Rybchenko * this list of conditions and the following disclaimer in the documentation
143c838a9fSAndrew Rybchenko * and/or other materials provided with the distribution.
153c838a9fSAndrew Rybchenko *
163c838a9fSAndrew Rybchenko * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
173c838a9fSAndrew Rybchenko * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
183c838a9fSAndrew Rybchenko * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
193c838a9fSAndrew Rybchenko * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
203c838a9fSAndrew Rybchenko * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
213c838a9fSAndrew Rybchenko * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
223c838a9fSAndrew Rybchenko * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
233c838a9fSAndrew Rybchenko * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
243c838a9fSAndrew Rybchenko * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
253c838a9fSAndrew Rybchenko * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
263c838a9fSAndrew Rybchenko * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273c838a9fSAndrew Rybchenko *
283c838a9fSAndrew Rybchenko * The views and conclusions contained in the software and documentation are
293c838a9fSAndrew Rybchenko * those of the authors and should not be interpreted as representing official
303c838a9fSAndrew Rybchenko * policies, either expressed or implied, of the FreeBSD Project.
31e948693eSPhilip Paeps */
32e948693eSPhilip Paeps
335dee87d7SPhilip Paeps #include <sys/cdefs.h>
34e948693eSPhilip Paeps #include "efx.h"
35e948693eSPhilip Paeps #include "efx_impl.h"
36e948693eSPhilip Paeps
37460cb568SAndrew Rybchenko __checkReturn efx_rc_t
efx_sram_buf_tbl_set(__in efx_nic_t * enp,__in uint32_t id,__in efsys_mem_t * esmp,__in size_t n)38e948693eSPhilip Paeps efx_sram_buf_tbl_set(
39e948693eSPhilip Paeps __in efx_nic_t *enp,
40e948693eSPhilip Paeps __in uint32_t id,
41e948693eSPhilip Paeps __in efsys_mem_t *esmp,
42e948693eSPhilip Paeps __in size_t n)
43e948693eSPhilip Paeps {
44e948693eSPhilip Paeps efx_qword_t qword;
45e948693eSPhilip Paeps uint32_t start = id;
46e948693eSPhilip Paeps uint32_t stop = start + n;
47e948693eSPhilip Paeps efsys_dma_addr_t addr;
48e948693eSPhilip Paeps efx_oword_t oword;
49e948693eSPhilip Paeps unsigned int count;
50460cb568SAndrew Rybchenko efx_rc_t rc;
51e948693eSPhilip Paeps
52e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
53e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
54e948693eSPhilip Paeps
55d5f7db37SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
563c5bf8f1SAndrew Rybchenko if (enp->en_family == EFX_FAMILY_HUNTINGTON ||
57d5f7db37SAndrew Rybchenko enp->en_family == EFX_FAMILY_MEDFORD ||
58d5f7db37SAndrew Rybchenko enp->en_family == EFX_FAMILY_MEDFORD2) {
593c838a9fSAndrew Rybchenko /*
603c838a9fSAndrew Rybchenko * FIXME: the efx_sram_buf_tbl_*() functionality needs to be
613c838a9fSAndrew Rybchenko * pulled inside the Falcon/Siena queue create/destroy code,
623c838a9fSAndrew Rybchenko * and then the original functions can be removed (see bug30834
633c838a9fSAndrew Rybchenko * comment #1). But, for now, we just ensure that they are
643c5bf8f1SAndrew Rybchenko * no-ops for EF10, to allow bringing up existing drivers
653c838a9fSAndrew Rybchenko * without modification.
663c838a9fSAndrew Rybchenko */
673c838a9fSAndrew Rybchenko
683c838a9fSAndrew Rybchenko return (0);
693c838a9fSAndrew Rybchenko }
70d5f7db37SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
713c838a9fSAndrew Rybchenko
72e948693eSPhilip Paeps if (stop >= EFX_BUF_TBL_SIZE) {
73e948693eSPhilip Paeps rc = EFBIG;
74e948693eSPhilip Paeps goto fail1;
75e948693eSPhilip Paeps }
76e948693eSPhilip Paeps
77e948693eSPhilip Paeps /* Add the entries into the buffer table */
78e948693eSPhilip Paeps addr = EFSYS_MEM_ADDR(esmp);
79e948693eSPhilip Paeps for (id = start; id != stop; id++) {
80e948693eSPhilip Paeps EFX_POPULATE_QWORD_5(qword,
81e948693eSPhilip Paeps FRF_AZ_IP_DAT_BUF_SIZE, 0, FRF_AZ_BUF_ADR_REGION, 0,
82e948693eSPhilip Paeps FRF_AZ_BUF_ADR_FBUF_DW0,
83e948693eSPhilip Paeps (uint32_t)((addr >> 12) & 0xffffffff),
84e948693eSPhilip Paeps FRF_AZ_BUF_ADR_FBUF_DW1,
85e948693eSPhilip Paeps (uint32_t)((addr >> 12) >> 32),
86e948693eSPhilip Paeps FRF_AZ_BUF_OWNER_ID_FBUF, 0);
87e948693eSPhilip Paeps
88e948693eSPhilip Paeps EFX_BAR_TBL_WRITEQ(enp, FR_AZ_BUF_FULL_TBL,
89e948693eSPhilip Paeps id, &qword);
90e948693eSPhilip Paeps
91e948693eSPhilip Paeps addr += EFX_BUF_SIZE;
92e948693eSPhilip Paeps }
93e948693eSPhilip Paeps
94e948693eSPhilip Paeps EFSYS_PROBE2(buf, uint32_t, start, uint32_t, stop - 1);
95e948693eSPhilip Paeps
96e948693eSPhilip Paeps /* Flush the write buffer */
97e948693eSPhilip Paeps EFX_POPULATE_OWORD_2(oword, FRF_AZ_BUF_UPD_CMD, 1,
98e948693eSPhilip Paeps FRF_AZ_BUF_CLR_CMD, 0);
99e948693eSPhilip Paeps EFX_BAR_WRITEO(enp, FR_AZ_BUF_TBL_UPD_REG, &oword);
100e948693eSPhilip Paeps
101e948693eSPhilip Paeps /* Poll for the last entry being written to the buffer table */
102e948693eSPhilip Paeps EFSYS_ASSERT3U(id, ==, stop);
103e948693eSPhilip Paeps addr -= EFX_BUF_SIZE;
104e948693eSPhilip Paeps
105e948693eSPhilip Paeps count = 0;
106e948693eSPhilip Paeps do {
107e948693eSPhilip Paeps EFSYS_PROBE1(wait, unsigned int, count);
108e948693eSPhilip Paeps
109e948693eSPhilip Paeps /* Spin for 1 ms */
110e948693eSPhilip Paeps EFSYS_SPIN(1000);
111e948693eSPhilip Paeps
112e948693eSPhilip Paeps EFX_BAR_TBL_READQ(enp, FR_AZ_BUF_FULL_TBL,
113e948693eSPhilip Paeps id - 1, &qword);
114e948693eSPhilip Paeps
115e948693eSPhilip Paeps if (EFX_QWORD_FIELD(qword, FRF_AZ_BUF_ADR_FBUF_DW0) ==
116e948693eSPhilip Paeps (uint32_t)((addr >> 12) & 0xffffffff) &&
117e948693eSPhilip Paeps EFX_QWORD_FIELD(qword, FRF_AZ_BUF_ADR_FBUF_DW1) ==
118e948693eSPhilip Paeps (uint32_t)((addr >> 12) >> 32))
119e948693eSPhilip Paeps goto verify;
120e948693eSPhilip Paeps
121e948693eSPhilip Paeps } while (++count < 100);
122e948693eSPhilip Paeps
123e948693eSPhilip Paeps rc = ETIMEDOUT;
124e948693eSPhilip Paeps goto fail2;
125e948693eSPhilip Paeps
126e948693eSPhilip Paeps verify:
127e948693eSPhilip Paeps /* Verify the rest of the entries in the buffer table */
128e948693eSPhilip Paeps while (--id != start) {
129e948693eSPhilip Paeps addr -= EFX_BUF_SIZE;
130e948693eSPhilip Paeps
131e948693eSPhilip Paeps /* Read the buffer table entry */
132e948693eSPhilip Paeps EFX_BAR_TBL_READQ(enp, FR_AZ_BUF_FULL_TBL,
133e948693eSPhilip Paeps id - 1, &qword);
134e948693eSPhilip Paeps
135e948693eSPhilip Paeps if (EFX_QWORD_FIELD(qword, FRF_AZ_BUF_ADR_FBUF_DW0) !=
136e948693eSPhilip Paeps (uint32_t)((addr >> 12) & 0xffffffff) ||
137e948693eSPhilip Paeps EFX_QWORD_FIELD(qword, FRF_AZ_BUF_ADR_FBUF_DW1) !=
138e948693eSPhilip Paeps (uint32_t)((addr >> 12) >> 32)) {
139e948693eSPhilip Paeps rc = EFAULT;
140e948693eSPhilip Paeps goto fail3;
141e948693eSPhilip Paeps }
142e948693eSPhilip Paeps }
143e948693eSPhilip Paeps
144e948693eSPhilip Paeps return (0);
145e948693eSPhilip Paeps
146e948693eSPhilip Paeps fail3:
147e948693eSPhilip Paeps EFSYS_PROBE(fail3);
148e948693eSPhilip Paeps
149e948693eSPhilip Paeps id = stop;
150e948693eSPhilip Paeps
151e948693eSPhilip Paeps fail2:
152e948693eSPhilip Paeps EFSYS_PROBE(fail2);
153e948693eSPhilip Paeps
154e948693eSPhilip Paeps EFX_POPULATE_OWORD_4(oword, FRF_AZ_BUF_UPD_CMD, 0,
155e948693eSPhilip Paeps FRF_AZ_BUF_CLR_CMD, 1, FRF_AZ_BUF_CLR_END_ID, id - 1,
156e948693eSPhilip Paeps FRF_AZ_BUF_CLR_START_ID, start);
157e948693eSPhilip Paeps EFX_BAR_WRITEO(enp, FR_AZ_BUF_TBL_UPD_REG, &oword);
158e948693eSPhilip Paeps
159e948693eSPhilip Paeps fail1:
160460cb568SAndrew Rybchenko EFSYS_PROBE1(fail1, efx_rc_t, rc);
161e948693eSPhilip Paeps
162e948693eSPhilip Paeps return (rc);
163e948693eSPhilip Paeps }
164e948693eSPhilip Paeps
165e948693eSPhilip Paeps void
efx_sram_buf_tbl_clear(__in efx_nic_t * enp,__in uint32_t id,__in size_t n)166e948693eSPhilip Paeps efx_sram_buf_tbl_clear(
167e948693eSPhilip Paeps __in efx_nic_t *enp,
168e948693eSPhilip Paeps __in uint32_t id,
169e948693eSPhilip Paeps __in size_t n)
170e948693eSPhilip Paeps {
171e948693eSPhilip Paeps efx_oword_t oword;
172e948693eSPhilip Paeps uint32_t start = id;
173e948693eSPhilip Paeps uint32_t stop = start + n;
174e948693eSPhilip Paeps
175e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
176e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
177e948693eSPhilip Paeps
178d5f7db37SAndrew Rybchenko #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
1793c5bf8f1SAndrew Rybchenko if (enp->en_family == EFX_FAMILY_HUNTINGTON ||
180d5f7db37SAndrew Rybchenko enp->en_family == EFX_FAMILY_MEDFORD ||
181d5f7db37SAndrew Rybchenko enp->en_family == EFX_FAMILY_MEDFORD2) {
1823c838a9fSAndrew Rybchenko /*
1833c838a9fSAndrew Rybchenko * FIXME: the efx_sram_buf_tbl_*() functionality needs to be
1843c838a9fSAndrew Rybchenko * pulled inside the Falcon/Siena queue create/destroy code,
1853c838a9fSAndrew Rybchenko * and then the original functions can be removed (see bug30834
1863c838a9fSAndrew Rybchenko * comment #1). But, for now, we just ensure that they are
1873c5bf8f1SAndrew Rybchenko * no-ops for EF10, to allow bringing up existing drivers
1883c838a9fSAndrew Rybchenko * without modification.
1893c838a9fSAndrew Rybchenko */
1903c838a9fSAndrew Rybchenko
1913c838a9fSAndrew Rybchenko return;
1923c838a9fSAndrew Rybchenko }
193d5f7db37SAndrew Rybchenko #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
1943c838a9fSAndrew Rybchenko
195e948693eSPhilip Paeps EFSYS_ASSERT3U(stop, <, EFX_BUF_TBL_SIZE);
196e948693eSPhilip Paeps
197e948693eSPhilip Paeps EFSYS_PROBE2(buf, uint32_t, start, uint32_t, stop - 1);
198e948693eSPhilip Paeps
199e948693eSPhilip Paeps EFX_POPULATE_OWORD_4(oword, FRF_AZ_BUF_UPD_CMD, 0,
200e948693eSPhilip Paeps FRF_AZ_BUF_CLR_CMD, 1, FRF_AZ_BUF_CLR_END_ID, stop - 1,
201e948693eSPhilip Paeps FRF_AZ_BUF_CLR_START_ID, start);
202e948693eSPhilip Paeps EFX_BAR_WRITEO(enp, FR_AZ_BUF_TBL_UPD_REG, &oword);
203e948693eSPhilip Paeps }
204e948693eSPhilip Paeps
205e948693eSPhilip Paeps #if EFSYS_OPT_DIAG
206e948693eSPhilip Paeps
207e948693eSPhilip Paeps static void
efx_sram_byte_increment_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)208e948693eSPhilip Paeps efx_sram_byte_increment_set(
209e948693eSPhilip Paeps __in size_t row,
210e948693eSPhilip Paeps __in boolean_t negate,
211e948693eSPhilip Paeps __out efx_qword_t *eqp)
212e948693eSPhilip Paeps {
213e948693eSPhilip Paeps size_t offset = row * FR_AZ_SRM_DBG_REG_STEP;
214e948693eSPhilip Paeps unsigned int index;
215e948693eSPhilip Paeps
216e948693eSPhilip Paeps _NOTE(ARGUNUSED(negate))
217e948693eSPhilip Paeps
218e948693eSPhilip Paeps for (index = 0; index < sizeof (efx_qword_t); index++)
219e948693eSPhilip Paeps eqp->eq_u8[index] = offset + index;
220e948693eSPhilip Paeps }
221e948693eSPhilip Paeps
222e948693eSPhilip Paeps static void
efx_sram_all_the_same_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)223e948693eSPhilip Paeps efx_sram_all_the_same_set(
224e948693eSPhilip Paeps __in size_t row,
225e948693eSPhilip Paeps __in boolean_t negate,
226e948693eSPhilip Paeps __out efx_qword_t *eqp)
227e948693eSPhilip Paeps {
228e948693eSPhilip Paeps _NOTE(ARGUNUSED(row))
229e948693eSPhilip Paeps
230e948693eSPhilip Paeps if (negate)
231e948693eSPhilip Paeps EFX_SET_QWORD(*eqp);
232e948693eSPhilip Paeps else
233e948693eSPhilip Paeps EFX_ZERO_QWORD(*eqp);
234e948693eSPhilip Paeps }
235e948693eSPhilip Paeps
236e948693eSPhilip Paeps static void
efx_sram_bit_alternate_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)237e948693eSPhilip Paeps efx_sram_bit_alternate_set(
238e948693eSPhilip Paeps __in size_t row,
239e948693eSPhilip Paeps __in boolean_t negate,
240e948693eSPhilip Paeps __out efx_qword_t *eqp)
241e948693eSPhilip Paeps {
242e948693eSPhilip Paeps _NOTE(ARGUNUSED(row))
243e948693eSPhilip Paeps
244e948693eSPhilip Paeps EFX_POPULATE_QWORD_2(*eqp,
245e948693eSPhilip Paeps EFX_DWORD_0, (negate) ? 0x55555555 : 0xaaaaaaaa,
246e948693eSPhilip Paeps EFX_DWORD_1, (negate) ? 0x55555555 : 0xaaaaaaaa);
247e948693eSPhilip Paeps }
248e948693eSPhilip Paeps
249e948693eSPhilip Paeps static void
efx_sram_byte_alternate_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)250e948693eSPhilip Paeps efx_sram_byte_alternate_set(
251e948693eSPhilip Paeps __in size_t row,
252e948693eSPhilip Paeps __in boolean_t negate,
253e948693eSPhilip Paeps __out efx_qword_t *eqp)
254e948693eSPhilip Paeps {
255e948693eSPhilip Paeps _NOTE(ARGUNUSED(row))
256e948693eSPhilip Paeps
257e948693eSPhilip Paeps EFX_POPULATE_QWORD_2(*eqp,
258e948693eSPhilip Paeps EFX_DWORD_0, (negate) ? 0x00ff00ff : 0xff00ff00,
259e948693eSPhilip Paeps EFX_DWORD_1, (negate) ? 0x00ff00ff : 0xff00ff00);
260e948693eSPhilip Paeps }
261e948693eSPhilip Paeps
262e948693eSPhilip Paeps static void
efx_sram_byte_changing_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)263e948693eSPhilip Paeps efx_sram_byte_changing_set(
264e948693eSPhilip Paeps __in size_t row,
265e948693eSPhilip Paeps __in boolean_t negate,
266e948693eSPhilip Paeps __out efx_qword_t *eqp)
267e948693eSPhilip Paeps {
268e948693eSPhilip Paeps size_t offset = row * FR_AZ_SRM_DBG_REG_STEP;
269e948693eSPhilip Paeps unsigned int index;
270e948693eSPhilip Paeps
271e948693eSPhilip Paeps for (index = 0; index < sizeof (efx_qword_t); index++) {
272e948693eSPhilip Paeps uint8_t byte;
273e948693eSPhilip Paeps
274e948693eSPhilip Paeps if (offset / 256 == 0)
275e948693eSPhilip Paeps byte = (uint8_t)((offset % 257) % 256);
276e948693eSPhilip Paeps else
277e948693eSPhilip Paeps byte = (uint8_t)(~((offset - 8) % 257) % 256);
278e948693eSPhilip Paeps
279e948693eSPhilip Paeps eqp->eq_u8[index] = (negate) ? ~byte : byte;
280e948693eSPhilip Paeps }
281e948693eSPhilip Paeps }
282e948693eSPhilip Paeps
283e948693eSPhilip Paeps static void
efx_sram_bit_sweep_set(__in size_t row,__in boolean_t negate,__out efx_qword_t * eqp)284e948693eSPhilip Paeps efx_sram_bit_sweep_set(
285e948693eSPhilip Paeps __in size_t row,
286e948693eSPhilip Paeps __in boolean_t negate,
287e948693eSPhilip Paeps __out efx_qword_t *eqp)
288e948693eSPhilip Paeps {
289e948693eSPhilip Paeps size_t offset = row * FR_AZ_SRM_DBG_REG_STEP;
290e948693eSPhilip Paeps
291e948693eSPhilip Paeps if (negate) {
292e948693eSPhilip Paeps EFX_SET_QWORD(*eqp);
293e948693eSPhilip Paeps EFX_CLEAR_QWORD_BIT(*eqp, (offset / sizeof (efx_qword_t)) % 64);
294e948693eSPhilip Paeps } else {
295e948693eSPhilip Paeps EFX_ZERO_QWORD(*eqp);
296e948693eSPhilip Paeps EFX_SET_QWORD_BIT(*eqp, (offset / sizeof (efx_qword_t)) % 64);
297e948693eSPhilip Paeps }
298e948693eSPhilip Paeps }
299e948693eSPhilip Paeps
3003c838a9fSAndrew Rybchenko efx_sram_pattern_fn_t __efx_sram_pattern_fns[] = {
301e948693eSPhilip Paeps efx_sram_byte_increment_set,
302e948693eSPhilip Paeps efx_sram_all_the_same_set,
303e948693eSPhilip Paeps efx_sram_bit_alternate_set,
304e948693eSPhilip Paeps efx_sram_byte_alternate_set,
305e948693eSPhilip Paeps efx_sram_byte_changing_set,
306e948693eSPhilip Paeps efx_sram_bit_sweep_set
307e948693eSPhilip Paeps };
308e948693eSPhilip Paeps
309460cb568SAndrew Rybchenko __checkReturn efx_rc_t
efx_sram_test(__in efx_nic_t * enp,__in efx_pattern_type_t type)310e948693eSPhilip Paeps efx_sram_test(
311e948693eSPhilip Paeps __in efx_nic_t *enp,
312e948693eSPhilip Paeps __in efx_pattern_type_t type)
313e948693eSPhilip Paeps {
314e948693eSPhilip Paeps efx_sram_pattern_fn_t func;
315e948693eSPhilip Paeps
316e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
317e948693eSPhilip Paeps
318e948693eSPhilip Paeps EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
319e948693eSPhilip Paeps
320e948693eSPhilip Paeps EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_RX));
321e948693eSPhilip Paeps EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_TX));
322e948693eSPhilip Paeps EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_EV));
323e948693eSPhilip Paeps
324b7875d2cSAndrew Rybchenko /* SRAM testing is only available on Siena. */
325b7875d2cSAndrew Rybchenko if (enp->en_family != EFX_FAMILY_SIENA)
326b7875d2cSAndrew Rybchenko return (0);
327b7875d2cSAndrew Rybchenko
328e948693eSPhilip Paeps /* Select pattern generator */
329e948693eSPhilip Paeps EFSYS_ASSERT3U(type, <, EFX_PATTERN_NTYPES);
330e948693eSPhilip Paeps func = __efx_sram_pattern_fns[type];
331e948693eSPhilip Paeps
332b7875d2cSAndrew Rybchenko return (siena_sram_test(enp, func));
333e948693eSPhilip Paeps }
334e948693eSPhilip Paeps
335e948693eSPhilip Paeps #endif /* EFSYS_OPT_DIAG */
336