/* 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 EFX_IO_H #define EFX_IO_H
#include <linux/io.h> #include <linux/spinlock.h>
/************************************************************************** * * NIC register I/O * ************************************************************************** * * 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. * * The TX_DESC_UPD DMA descriptor pointer is 128-bits but is a special * case in the BIU to avoid the need for locking in the host: * * - It is write-only. * - The semantics of writing to this register is such that * replacing the low 96 bits with zero does not affect functionality. * - If the host writes to the last dword address of the 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.
*/
/* Hardware issue requires that only 64-bit naturally aligned writes * are seen by hardware. Its not strictly necessary to restrict to * x86_64 arch, but done for safety since unusual write combining behaviour * can break PIO.
*/ #ifdef CONFIG_X86_64 /* PIO is a win only if write-combining is possible */ #ifdef ioremap_wc #define EFX_USE_PIO 1 #endif #endif
/* Write a 32-bit CSR or the last dword of a special 128-bit CSR */ staticinlinevoid efx_writed(struct efx_nic *efx, const efx_dword_t *value, unsignedint reg)
{
netif_vdbg(efx, hw, efx->net_dev, "writing register %x with "EFX_DWORD_FMT"\n",
reg, EFX_DWORD_VAL(*value));
/* No lock required */
_efx_writed(efx, value->u32[0], reg);
}
/* Write a 128-bit CSR forming part of a table */ staticinlinevoid
efx_writeo_table(struct efx_nic *efx, const efx_oword_t *value, unsignedint reg, unsignedint index)
{
efx_writeo(efx, value, reg + index * sizeof(efx_oword_t));
}
/* Read a 128-bit CSR forming part of a table */ staticinlinevoid efx_reado_table(struct efx_nic *efx, efx_oword_t *value, unsignedint reg, unsignedint index)
{
efx_reado(efx, value, reg + index * sizeof(efx_oword_t));
}
/* default VI stride (step between per-VI registers) is 8K on EF10 and * 64K on EF100
*/ #define EFX_DEFAULT_VI_STRIDE 0x2000 #define EF100_DEFAULT_VI_STRIDE 0x10000
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.