/* SPDX-License-Identifier: GPL-2.0-only */ /**************************************************************************** * Driver for Solarflare network controllers and boards * Copyright 2005-2006 Fen Systems Ltd. * Copyright 2006-2013 Solarflare Communications Inc.
*/
#ifndef EF4_IO_H #define EF4_IO_H
#include <linux/io.h> #include <linux/spinlock.h>
/************************************************************************** * * NIC register I/O * ************************************************************************** * * Notes on locking strategy for the Falcon architecture: * * Many CSRs are very wide and cannot be read or written atomically. * Writes from the host are buffered by the Bus Interface Unit (BIU) * up to 128 bits. Whenever the host writes part of such a register, * the BIU collects the written value and does not write to the * underlying register until all 4 dwords have been written. A * similar buffering scheme applies to host access to the NIC's 64-bit * SRAM. * * Writes to different CSRs and 64-bit SRAM words must be serialised, * since interleaved access can result in lost writes. We use * ef4_nic::biu_lock for this. * * We also serialise reads from 128-bit CSRs and SRAM with the same * spinlock. This may not be necessary, but it doesn't really matter * as there are no such reads on the fast path. * * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are * 128-bit but are special-cased in the BIU to avoid the need for * locking in the host: * * - They are write-only. * - The semantics of writing to these registers are such that * replacing the low 96 bits with zero does not affect functionality. * - If the host writes to the last dword address of such a register * (i.e. the high 32 bits) the underlying register will always be * written. If the collector and the current write together do not * provide values for all 128 bits of the register, the low 96 bits * will be written as zero. * - If the host writes to the address of any other part of such a * register while the collector already holds values for some other * register, the write is discarded and the collector maintains its * current state. * * The EF10 architecture exposes very few registers to the host and * most of them are only 32 bits wide. The only exceptions are the MC * doorbell register pair, which has its own latching, and * TX_DESC_UPD, which works in a similar way to the Falcon * architecture.
*/
/* Write a 32-bit CSR or the last dword of a special 128-bit CSR */ staticinlinevoid ef4_writed(struct ef4_nic *efx, const ef4_dword_t *value, unsignedint reg)
{
netif_vdbg(efx, hw, efx->net_dev, "writing register %x with "EF4_DWORD_FMT"\n",
reg, EF4_DWORD_VAL(*value));
/* No lock required */
_ef4_writed(efx, value->u32[0], reg);
}
/* Write TIMER_COMMAND. This is a page-mapped 32-bit CSR, but a bug * in the BIU means that writes to TIMER_COMMAND[0] invalidate the * collector register.
*/ staticinlinevoid _ef4_writed_page_locked(struct ef4_nic *efx, const ef4_dword_t *value, unsignedint reg, unsignedint page)
{ unsignedlong flags __attribute__ ((unused));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.