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,13 +72,19 @@ void efx_probe(struct net_device *netdev, enum efx_revision revision)
72 72
 	struct efx_nic *efx = netdev_priv(netdev);
73 73
 	struct pci_device *pci = container_of(netdev->dev,
74 74
 					      struct pci_device, dev);
75
+	unsigned int reg = PCI_BASE_ADDRESS_0;
76
+	uint32_t bar_low;
75 77
 
76 78
 	efx->netdev = netdev;
77 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 88
 	efx->membase = ioremap(efx->mmio_start, efx->mmio_len);
83 89
 
84 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,6 +142,7 @@ static void hunt_mcdi_copyin(struct hunt_nic *hunt,
142 142
 	hdr_len = sizeof(hdr);
143 143
 
144 144
 	memcpy(pdu, &hdr, hdr_len);
145
+	assert(inlen <= MCDI_CTL_SDU_LEN_MAX_V2);
145 146
 	memcpy(pdu + hdr_len, inbuf, inlen);
146 147
 
147 148
 	wmb();	/* Sync the data before ringing the doorbell */
@@ -1314,6 +1315,7 @@ const struct efx_nic_type hunt_nic_type = {
1314 1315
 
1315 1316
 static struct pci_device_id hunt_nics[] = {
1316 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 1321
 struct pci_driver hunt_driver __pci_driver = {

Loading…
Cancel
Save