16)) | FW_WR_FLOWID(ep->hwtid));
 
        flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
-       flowc->mnemval[0].val = cpu_to_be32(PCI_FUNC(ep->com.dev->rdev.lldi.pdev->devfn) << 8);
+       flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN
+                                           (ep->com.dev->rdev.lldi.pf));
        flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
        flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan);
        flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
 
        unsigned short i;
 
        lli.pdev = adap->pdev;
+       lli.pf = adap->fn;
        lli.l2t = adap->l2t;
        lli.tids = &adap->tids;
        lli.ports = adap->port;
                return err;
        }
 
-       /* We control everything through one PF */
-       func = PCI_FUNC(pdev->devfn);
-       if (func != ent->driver_data) {
-               pci_save_state(pdev);        /* to restore SR-IOV later */
-               goto sriov;
-       }
-
        err = pci_enable_device(pdev);
        if (err) {
                dev_err(&pdev->dev, "cannot enable PCI device\n");
                goto out_free_adapter;
        }
 
+       /* We control everything through one PF */
+       func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI));
+       if ((pdev->device == 0xa000 && func != 0) ||
+           func != ent->driver_data) {
+               pci_save_state(pdev);        /* to restore SR-IOV later */
+               err = 0;
+               goto out_unmap_bar0;
+       }
+
        adapter->pdev = pdev;
        adapter->pdev_dev = &pdev->dev;
        adapter->mbox = func;
        if (is_offload(adapter))
                attach_ulds(adapter);
 
-sriov:
 #ifdef CONFIG_PCI_IOV
        if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0)
                if (pci_enable_sriov(pdev, num_vf[func]) == 0)
 
        int dbfifo_int_thresh;               /* doorbell fifo int threshold */
        unsigned int sge_pktshift;           /* Padding between CPL and */
                                             /* packet data */
+       unsigned int pf;                     /* Physical Function we're using */
        bool enable_fw_ofld_conn;            /* Enable connection through fw */
                                             /* WR */
        bool ulptx_memwrite_dsgl;            /* use of T5 DSGL allowed */