Only print state change message for real state changes. When we set a

device in D0 to D0, that's a no-op, however the messages seem to be
confusing some people.  Eventually, these messages will be parked
behind a if (bootverbose).

# I don't think this will fix any real bugs...
This commit is contained in:
Warner Losh 2004-04-09 20:41:18 +00:00
parent d1006b25a9
commit bbecd97c0b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128075

View File

@ -1703,9 +1703,11 @@ pci_cfg_restore(device_t dev, struct pci_devinfo *dinfo)
*/
if (dinfo->cfg.hdrtype != 0)
return;
printf("pci%d:%d:%d: setting power state D0\n", dinfo->cfg.bus,
dinfo->cfg.slot, dinfo->cfg.func);
pci_set_powerstate(dev, PCI_POWERSTATE_D0);
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
printf("pci%d:%d:%d: setting power state D0\n", dinfo->cfg.bus,
dinfo->cfg.slot, dinfo->cfg.func);
pci_set_powerstate(dev, PCI_POWERSTATE_D0);
}
for (i = 0; i < dinfo->cfg.nummaps; i++)
pci_write_config(dev, PCIR_MAPS + i * 4, dinfo->cfg.bar[i], 4);
pci_write_config(dev, PCIR_BIOS, dinfo->cfg.bios, 4);
@ -1768,8 +1770,10 @@ pci_cfg_save(device_t dev, struct pci_devinfo *dinfo, int setstate)
*/
cls = pci_get_class(dev);
if (setstate && cls != PCIC_DISPLAY && cls != PCIC_MEMORY) {
pci_set_powerstate(dev, PCI_POWERSTATE_D3);
printf("pci%d:%d:%d: setting power state D3\n", dinfo->cfg.bus,
dinfo->cfg.slot, dinfo->cfg.func);
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) {
printf("pci%d:%d:%d: setting power state D3\n", dinfo->cfg.bus,
dinfo->cfg.slot, dinfo->cfg.func);
pci_set_powerstate(dev, PCI_POWERSTATE_D3);
}
}
}