linux/drivers/net
Jacob Keller 0ce50c7066 ice: introduce function for reading from flash modules
When reading from the flash memory of the device, the ice driver has two
interfaces available to it. First, it can use a mediated interface via
firmware that allows specifying a module ID. This allows reading from
specific modules of the active flash bank.

The second interface available is to perform flat reads. This allows
complete access to the entire flash. However, using it requires the
software to handle calculating module location and interpret pointer
addresses.

While most data required is accessible through the convenient first
interface, certain flash contents are not. This includes the CSS header
information associated with the Option ROM and NVM banks, as well as any
access to the "inactive" banks used as scratch space for performing
flash updates.

In order to access all of the relevant flash contents, software must use
the flat reads. Rather than forcing all flows to perform flat read
calculations, introduce a new abstraction for reading from the flash:
ice_read_flash_module. This function provides an abstraction for reading
from either the active or inactive flash bank at the requested module.
This interface is very similar to the abstraction provided via firmware,
but allows access to additional modules, as well as providing
a mechanism to request access to both flash banks.

At first glance, it might make sense for this abstraction to allow
specifying precisely which bank (1st or 2nd) the caller wishes to read.
This is simpler to implement but more difficult to use. In practice,
most callers only know whether they want the active bank, or the
inactive bank. Rather than force callers to determine for themselves
which bank to read from, implement ice_read_flash_module in terms of
"active" vs "inactive". This significantly simplifies the implementation
at the caller level and is a more useful abstraction over the flash
contents.

Make use of this new interface to refactor reading of the main NVM
version information. Instead of using the firmware's mediated ShadowRAM
function, use the ice_read_flash_module abstraction.

To do this, notice that most reads of the NVM are going to be in 2-byte
word chunks. To simplify using ice_read_flash_module for this case,
ice_read_nvm_module is introduced. This is a simple wrapper around
ice_read_flash_module which takes the correct pointer address for the
NVM bank, and forces the 2-byte word format onto the caller.

When reading the NVM versions, some fields are read from the Shadow RAM.
The Shadow RAM is the first 64KB of flash memory, and is populated
during device load. Most fields are copied from a section within the
active NVM bank. In order to read this data from both the active and
inactive NVM banks, we need to read not from the first 64KB of flash,
but instead from the correct offset into the NVM bank. Introduce
ice_read_nvm_sr_copy for this purpose. This function wraps around
ice_read_nvm_module and has the same interface as the ice_read_sr_word,
with the exception of allowing the caller to specify whether to read the
active or inactive flash bank.

With this change, it is now trivial to refactor ice_get_nvm_ver_info to
read using the software mediated ice_read_flash_module interface instead
of relying on the firmware mediated interface. This will be used in the
following change to implement support for stored versions in the devlink
info report.

Additionally, the overall ice_read_flash_module interface will be used
and extended to support all three major flash banks, and additionally to
support reading the flash image security revision information.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-02-05 11:35:41 -08:00
..
appletalk
arcnet arcnet: use new tasklet API 2021-02-02 15:51:17 -08:00
bonding
caif caif_virtio: use new tasklet API 2021-02-02 15:51:17 -08:00
can
dsa net: dsa: xrs700x: Correctly address device over I2C 2021-02-04 19:09:47 -08:00
ethernet ice: introduce function for reading from flash modules 2021-02-05 11:35:41 -08:00
fddi
fjes
hamradio
hippi
hyperv hv_netvsc: Load and store the proper (NBL_HASH_INFO) per-packet info 2021-02-04 20:37:04 -08:00
ieee802154
ipa net: ipa: expand last transaction check 2021-02-02 17:42:36 -08:00
ipvlan
mdio
netdevsim net: Do not call fib6_info_hw_flags_set() when IPv6 is disabled 2021-02-02 17:45:59 -08:00
pcs
phy net: mdiobus: Prevent spike on MDIO bus reset signal 2021-02-03 17:28:05 -08:00
plip
ppp ppp: use new tasklet API 2021-02-02 15:51:18 -08:00
slip
team
usb r8152: adjust the flow of power cut for RTL8153B 2021-02-04 20:36:51 -08:00
vmxnet3 vmxnet3: Remove buf_info from device accessible structures 2021-01-29 21:07:03 -08:00
wan
wireguard
wireless
xen-netback
bareudp.c udp: call udp_encap_enable for v6 sockets when enabling encap 2021-02-04 18:37:14 -08:00
dummy.c
eql.c
geneve.c
gtp.c gtp: update rx_length_errors for abnormally short packets 2021-02-04 09:29:58 -08:00
ifb.c ifb: use new tasklet API 2021-02-02 15:51:18 -08:00
Kconfig
LICENSE.SRC
loopback.c net-loopback: set lo dev initial state to UP 2021-02-04 18:37:08 -08:00
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mhi_net.c net: mhi: Get rid of local rx queue count 2021-01-29 19:42:06 -08:00
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c
virtio_net.c
vrf.c
vsockmon.c
vxlan.c
xen-netfront.c drivers: net: xen-netfront: Simplify the calculation of variables 2021-02-04 10:55:24 -08:00