freebsd_network: Change powerstate during busmaster if necessary.

It seems FreeBSD does the same (and drivers used to do this individually
but have not for some time.)

May help with quite a number of initialization-failed WiFi/ethernet tickets.
This commit is contained in:
Augustin Cavalier 2022-02-18 20:29:15 -05:00
parent 462fb495fa
commit 38d00b8d33

View File

@ -156,6 +156,10 @@ pci_set_command_bit(device_t dev, uint16_t bit)
int int
pci_enable_busmaster(device_t dev) pci_enable_busmaster(device_t dev)
{ {
// We do this a bit later than FreeBSD does.
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0)
pci_set_powerstate(dev, PCI_POWERSTATE_D0);
pci_set_command_bit(dev, PCI_command_master); pci_set_command_bit(dev, PCI_command_master);
return 0; return 0;
} }