FreeBSD/sys/dev/pci/pci.c
/*
 * Restore MSI registers during resume.  If MSI is enabled then
 * restore the data and address registers in addition to the control
 * register.
 */
Restore MSI registers during resume.  If MSI is enabled then
restore the data and address registers in addition to the control
register.
Restore MSI registers during resume . If MSI is enabled then restore the data and address registers in addition to the control register .
static void
pci_resume_msi(device_t dev)
{
	struct pci_devinfo *dinfo = device_get_ivars(dev);
	struct pcicfg_msi *msi = &dinfo->cfg.msi;
	uint64_t address;
	uint16_t data;
	if (msi->msi_ctrl & PCIM_MSICTRL_MSI_ENABLE) {
		address = msi->msi_addr;
		data = msi->msi_data;
		pci_write_config(dev, msi->msi_location + PCIR_MSI_ADDR,
		    address & 0xffffffff, 4);
		if (msi->msi_ctrl & PCIM_MSICTRL_64BIT) {
			pci_write_config(dev, msi->msi_location +
			    PCIR_MSI_ADDR_HIGH, address >> 32, 4);
			pci_write_config(dev, msi->msi_location +
			    PCIR_MSI_DATA_64BIT, data, 2);
		} else
			pci_write_config(dev, msi->msi_location + PCIR_MSI_DATA,
			    data, 2);
	}
	pci_write_config(dev, msi->msi_location + PCIR_MSI_CTRL, msi->msi_ctrl,
	    2);
}
static void pci_resume_msi ( device_t dev ) { struct pci_devinfo * dinfo = device_get_ivars ( dev ) ; struct pcicfg_msi * msi = & dinfo -> cfg . msi ; uint64_t address ; uint16_t data ; if ( msi -> msi_ctrl & PCIM_MSICTRL_MSI_ENABLE ) { address = msi -> msi_addr ; data = msi -> msi_data ; pci_write_config ( dev , msi -> msi_location + PCIR_MSI_ADDR , address & 0xffffffff , 4 ) ; if ( msi -> msi_ctrl & PCIM_MSICTRL_64BIT ) { pci_write_config ( dev , msi -> msi_location + PCIR_MSI_ADDR_HIGH , address >> 32 , 4 ) ; pci_write_config ( dev , msi -> msi_location + PCIR_MSI_DATA_64BIT , data , 2 ) ; } else pci_write_config ( dev , msi -> msi_location + PCIR_MSI_DATA , data , 2 ) ; } pci_write_config ( dev , msi -> msi_location + PCIR_MSI_CTRL , msi -> msi_ctrl , 2 ) ; }
Restore MSI registers during resume.
Restore MSI registers during resume .