[ipxe-devel] [PATCH] sfc: Add support for X25xx adapters

Geert Stappers geert.stappers at hendrikx-itc.nl
Fri Aug 10 08:44:16 UTC 2018


On Mon, Jun 18, 2018 at 11:41:38AM +0100, Martin Habets wrote:
( and there was "ping request" on tuesday 2018-08-07 )
> The first adapters in this family are X2522-10, X2522-25, X2541 and X2542.
> 
> These no longer use PCI BAR 0 for I/O, but use that for memory.
> In other words, BAR 2 on SFN8xxx adapters now becomes BAR 0.
> ---
>  src/drivers/net/sfc/efx_common.c |   12 +++++++++---
>  src/drivers/net/sfc/sfc_hunt.c   |    2 ++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/drivers/net/sfc/efx_common.c b/src/drivers/net/sfc/efx_common.c
> index 79a994355d02..40388770789a 100644
> --- a/src/drivers/net/sfc/efx_common.c
> +++ b/src/drivers/net/sfc/efx_common.c
> @@ -72,13 +72,19 @@ void efx_probe(struct net_device *netdev, enum efx_revision revision)
>  	struct efx_nic *efx = netdev_priv(netdev);
>  	struct pci_device *pci = container_of(netdev->dev,
>  					      struct pci_device, dev);
> +	unsigned int reg = PCI_BASE_ADDRESS_0;
> +	uint32_t bar_low;
>  
>  	efx->netdev = netdev;
>  	efx->revision = revision;
>  
> -	/* MMIO bar */
> -	efx->mmio_start = pci_bar_start(pci, PCI_BASE_ADDRESS_2);
> -	efx->mmio_len = pci_bar_size(pci, PCI_BASE_ADDRESS_2);
> +	/* Find the memory bar to use */
> +	pci_read_config_dword(pci, reg, &bar_low);
> +	if ((bar_low & PCI_BASE_ADDRESS_IO_MASK) == PCI_BASE_ADDRESS_SPACE_IO)
> +		reg = PCI_BASE_ADDRESS_2;
> +
> +	efx->mmio_start = pci_bar_start(pci, reg);
> +	efx->mmio_len = pci_bar_size(pci, reg);
>  	efx->membase = ioremap(efx->mmio_start, efx->mmio_len);
>  
>  	DBGCP(efx, "BAR of %lx bytes at phys %lx mapped at %p\n",

That matches the commit message


> diff --git a/src/drivers/net/sfc/sfc_hunt.c b/src/drivers/net/sfc/sfc_hunt.c
> index 25780ffd8e3a..dd5f7043f1ce 100644
> --- a/src/drivers/net/sfc/sfc_hunt.c
> +++ b/src/drivers/net/sfc/sfc_hunt.c
> @@ -142,6 +142,7 @@ static void hunt_mcdi_copyin(struct hunt_nic *hunt,
>  	hdr_len = sizeof(hdr);
>  
>  	memcpy(pdu, &hdr, hdr_len);
> +	assert(inlen <= MCDI_CTL_SDU_LEN_MAX_V2);
>  	memcpy(pdu + hdr_len, inbuf, inlen);
>  
>  	wmb();	/* Sync the data before ringing the doorbell */

I think that should go into a seperate patch / commit.


> @@ -1314,6 +1315,7 @@ const struct efx_nic_type hunt_nic_type = {
>  
>  static struct pci_device_id hunt_nics[] = {
>  	PCI_ROM(0x1924, 0x0a03, "SFC9220", "Solarflare SFN8xxx Adapter", 0),
> +	PCI_ROM(0x1924, 0x0b03, "SFC9250", "Solarflare X25xx Adapter", 0),
>  };
>  
>  struct pci_driver hunt_driver __pci_driver = {

The actual new NIC


Cheers
Geert Stappers
(echoing the ping from tuesday)



More information about the ipxe-devel mailing list