]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intelxl] Use function-level reset instead of PFGEN_CTRL.PFSWR
authorMichael Brown <mcb30@ipxe.org>
Thu, 17 Mar 2022 13:45:31 +0000 (13:45 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 8 Aug 2022 15:43:36 +0000 (16:43 +0100)
Remove knowledge of the PFGEN_CTRL register (which changes location
between XL710 and E810 register maps), and instead use PCIe FLR to
reset the physical function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/intelxl.c
src/drivers/net/intelxl.h
src/drivers/net/intelxlvf.c
src/drivers/net/intelxlvf.h

index 9d11f64588ef5ac9d86b5e894279abbae8703f02..20db51acf737ae721dd365443e7c53c946b61a04 100644 (file)
@@ -44,31 +44,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
-/******************************************************************************
- *
- * Device reset
- *
- ******************************************************************************
- */
-
-/**
- * Reset hardware
- *
- * @v intelxl          Intel device
- * @ret rc             Return status code
- */
-static int intelxl_reset ( struct intelxl_nic *intelxl ) {
-       uint32_t pfgen_ctrl;
-
-       /* Perform a global software reset */
-       pfgen_ctrl = readl ( intelxl->regs + INTELXL_PFGEN_CTRL );
-       writel ( ( pfgen_ctrl | INTELXL_PFGEN_CTRL_PFSWR ),
-                intelxl->regs + INTELXL_PFGEN_CTRL );
-       mdelay ( INTELXL_RESET_DELAY_MS );
-
-       return 0;
-}
-
 /******************************************************************************
  *
  * MAC address
@@ -1704,9 +1679,17 @@ static int intelxl_probe ( struct pci_device *pci ) {
        dma_set_mask_64bit ( intelxl->dma );
        netdev->dma = intelxl->dma;
 
-       /* Reset the NIC */
-       if ( ( rc = intelxl_reset ( intelxl ) ) != 0 )
-               goto err_reset;
+       /* Locate PCI Express capability */
+       intelxl->exp = pci_find_capability ( pci, PCI_CAP_ID_EXP );
+       if ( ! intelxl->exp ) {
+               DBGC ( intelxl, "INTELXL %p missing PCIe capability\n",
+                      intelxl );
+               rc = -ENXIO;
+               goto err_exp;
+       }
+
+       /* Reset the function via PCIe FLR */
+       pci_reset ( pci, intelxl->exp );
 
        /* Get function number, port number and base queue number */
        pffunc_rid = readl ( intelxl->regs + INTELXL_PFFUNC_RID );
@@ -1787,8 +1770,8 @@ static int intelxl_probe ( struct pci_device *pci ) {
        intelxl_msix_disable ( intelxl, pci );
  err_msix:
  err_fetch_mac:
-       intelxl_reset ( intelxl );
- err_reset:
+       pci_reset ( pci, intelxl->exp );
+ err_exp:
        iounmap ( intelxl->regs );
  err_ioremap:
        netdev_nullify ( netdev );
@@ -1816,7 +1799,7 @@ static void intelxl_remove ( struct pci_device *pci ) {
        intelxl_msix_disable ( intelxl, pci );
 
        /* Reset the NIC */
-       intelxl_reset ( intelxl );
+       pci_reset ( pci, intelxl->exp );
 
        /* Free network device */
        iounmap ( intelxl->regs );
index f3b81e6ada4a3874ffbd2149da249dfbe8a266c6..f3588bd34abcb46df55f9ae6500814bba5e05eba 100644 (file)
@@ -985,13 +985,6 @@ intelxl_init_ring ( struct intelxl_ring *ring, unsigned int count, size_t len,
        INTELXL_QINT_TQCTL_NEXTQ_TYPE ( 0x1 )           /**< Transmit queue */
 #define INTELXL_QINT_TQCTL_CAUSE_ENA   0x40000000UL    /**< Enable */
 
-/** PF Control Register */
-#define INTELXL_PFGEN_CTRL 0x092400
-#define INTELXL_PFGEN_CTRL_PFSWR       0x00000001UL    /**< Software Reset */
-
-/** Time to delay for device reset, in milliseconds */
-#define INTELXL_RESET_DELAY_MS 100
-
 /** Function Requester ID Information Register */
 #define INTELXL_PFFUNC_RID 0x09c000
 #define INTELXL_PFFUNC_RID_FUNC_NUM(x) \
index b5957a53b62f9b30cbee0704a0c65ba7dec82f87..e0e7dc61030504471dafa20bfcb73fa12f390a60 100644 (file)
@@ -122,7 +122,7 @@ static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) {
                goto err_command;
 
        /* Wait for minimum reset time */
-       mdelay ( INTELXL_RESET_DELAY_MS );
+       mdelay ( INTELXLVF_RESET_DELAY_MS );
 
        /* Wait for reset to take effect */
        if ( ( rc = intelxlvf_reset_wait_teardown ( intelxl ) ) != 0 )
index ffcae56746b184afcab2787b6ac71c358ecc2d30..cf449a744df73495069ac56ebd600b09207833b3 100644 (file)
@@ -64,6 +64,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define INTELXLVF_VFGEN_RSTAT_VFR_STATE(x) ( (x) & 0x3 )
 #define INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE 0x2
 
+/** Minimum time to wait for reset to complete */
+#define INTELXLVF_RESET_DELAY_MS 100
+
 /** Maximum time to wait for reset to complete */
 #define INTELXLVF_RESET_MAX_WAIT_MS 1000