FreeBSD/sys/dev/pci/pci.c
/*
 * Restore MSI-X registers and table during resume.  If MSI-X is
 * enabled then walk the virtual table to restore the actual MSI-X
 * table.
 */
Restore MSI-X registers and table during resume.  If MSI-X is
enabled then walk the virtual table to restore the actual MSI-X
table.
Restore MSI - X registers and table during resume . If MSI - X is enabled then walk the virtual table to restore the actual MSI - X table .
static void
pci_resume_msix(device_t dev)
{
	struct pci_devinfo *dinfo = device_get_ivars(dev);
	struct pcicfg_msix *msix = &dinfo->cfg.msix;
	struct msix_table_entry *mte;
	struct msix_vector *mv;
	int i;
	if (msix->msix_alloc > 0) {
		for (i = 0; i < msix->msix_msgnum; i++)
			pci_mask_msix(dev, i);
		for (i = 0; i < msix->msix_table_len; i++) {
			mte = &msix->msix_table[i];
			if (mte->mte_vector == 0 || mte->mte_handlers == 0)
				continue;
			mv = &msix->msix_vectors[mte->mte_vector - 1];
			pci_enable_msix(dev, i, mv->mv_address, mv->mv_data);
			pci_unmask_msix(dev, i);
		}
	}
	pci_write_config(dev, msix->msix_location + PCIR_MSIX_CTRL,
	    msix->msix_ctrl, 2);
}
static void pci_resume_msix ( device_t dev ) { struct pci_devinfo * dinfo = device_get_ivars ( dev ) ; struct pcicfg_msix * msix = & dinfo -> cfg . msix ; struct msix_table_entry * mte ; struct msix_vector * mv ; int i ; if ( msix -> msix_alloc > 0 ) { for ( i = 0 ; i < msix -> msix_msgnum ; i ++ ) pci_mask_msix ( dev , i ) ; for ( i = 0 ; i < msix -> msix_table_len ; i ++ ) { mte = & msix -> msix_table [ i ] ; if ( mte -> mte_vector == 0 || mte -> mte_handlers == 0 ) continue ; mv = & msix -> msix_vectors [ mte -> mte_vector - 1 ] ; pci_enable_msix ( dev , i , mv -> mv_address , mv -> mv_data ) ; pci_unmask_msix ( dev , i ) ; } } pci_write_config ( dev , msix -> msix_location + PCIR_MSIX_CTRL , msix -> msix_ctrl , 2 ) ; }
Restore MSI-X registers and table during resume.
Restore MSI - X registers and table during resume .
/* First, mask all vectors. */ /* Second, program any messages with at least one handler. */