Browse Source

[sfc] Add support for X25xx adapters

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.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Martin Habets 6 years ago
parent
commit
af1860711a
2 changed files with 11 additions and 3 deletions
  1. 9
    3
      src/drivers/net/sfc/efx_common.c
  2. 2
    0
      src/drivers/net/sfc/sfc_hunt.c

+ 9
- 3
src/drivers/net/sfc/efx_common.c View File

72
 	struct efx_nic *efx = netdev_priv(netdev);
72
 	struct efx_nic *efx = netdev_priv(netdev);
73
 	struct pci_device *pci = container_of(netdev->dev,
73
 	struct pci_device *pci = container_of(netdev->dev,
74
 					      struct pci_device, dev);
74
 					      struct pci_device, dev);
75
+	unsigned int reg = PCI_BASE_ADDRESS_0;
76
+	uint32_t bar_low;
75
 
77
 
76
 	efx->netdev = netdev;
78
 	efx->netdev = netdev;
77
 	efx->revision = revision;
79
 	efx->revision = revision;
78
 
80
 
79
-	/* MMIO bar */
80
-	efx->mmio_start = pci_bar_start(pci, PCI_BASE_ADDRESS_2);
81
-	efx->mmio_len = pci_bar_size(pci, PCI_BASE_ADDRESS_2);
81
+	/* Find the memory bar to use */
82
+	pci_read_config_dword(pci, reg, &bar_low);
83
+	if ((bar_low & PCI_BASE_ADDRESS_IO_MASK) == PCI_BASE_ADDRESS_SPACE_IO)
84
+		reg = PCI_BASE_ADDRESS_2;
85
+
86
+	efx->mmio_start = pci_bar_start(pci, reg);
87
+	efx->mmio_len = pci_bar_size(pci, reg);
82
 	efx->membase = ioremap(efx->mmio_start, efx->mmio_len);
88
 	efx->membase = ioremap(efx->mmio_start, efx->mmio_len);
83
 
89
 
84
 	DBGCP(efx, "BAR of %lx bytes at phys %lx mapped at %p\n",
90
 	DBGCP(efx, "BAR of %lx bytes at phys %lx mapped at %p\n",

+ 2
- 0
src/drivers/net/sfc/sfc_hunt.c View File

142
 	hdr_len = sizeof(hdr);
142
 	hdr_len = sizeof(hdr);
143
 
143
 
144
 	memcpy(pdu, &hdr, hdr_len);
144
 	memcpy(pdu, &hdr, hdr_len);
145
+	assert(inlen <= MCDI_CTL_SDU_LEN_MAX_V2);
145
 	memcpy(pdu + hdr_len, inbuf, inlen);
146
 	memcpy(pdu + hdr_len, inbuf, inlen);
146
 
147
 
147
 	wmb();	/* Sync the data before ringing the doorbell */
148
 	wmb();	/* Sync the data before ringing the doorbell */
1314
 
1315
 
1315
 static struct pci_device_id hunt_nics[] = {
1316
 static struct pci_device_id hunt_nics[] = {
1316
 	PCI_ROM(0x1924, 0x0a03, "SFC9220", "Solarflare SFN8xxx Adapter", 0),
1317
 	PCI_ROM(0x1924, 0x0a03, "SFC9220", "Solarflare SFN8xxx Adapter", 0),
1318
+	PCI_ROM(0x1924, 0x0b03, "SFC9250", "Solarflare X25xx Adapter", 0),
1317
 };
1319
 };
1318
 
1320
 
1319
 struct pci_driver hunt_driver __pci_driver = {
1321
 struct pci_driver hunt_driver __pci_driver = {

Loading…
Cancel
Save