From 38d00b8d33364ae75d44f96e11a2f0ac982ccee8 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 18 Feb 2022 20:29:15 -0500 Subject: [PATCH] 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. --- src/libs/compat/freebsd_network/pci.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/compat/freebsd_network/pci.cpp b/src/libs/compat/freebsd_network/pci.cpp index cbf2b721a5..8de6ce8eb9 100644 --- a/src/libs/compat/freebsd_network/pci.cpp +++ b/src/libs/compat/freebsd_network/pci.cpp @@ -156,6 +156,10 @@ pci_set_command_bit(device_t dev, uint16_t bit) int 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); return 0; }