From 2982f45075f9cd41f2f3a5bc3c3451d671add507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 11 Apr 2023 11:01:45 +0200 Subject: [PATCH] freebsd_network: drop PCI_x86 Change-Id: Ie185f63b56bc564b794e5900609fe9f0465de602 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6330 Reviewed-by: Fredrik Holmqvist --- src/libs/compat/freebsd_network/bus.cpp | 11 ++++----- src/libs/compat/freebsd_network/pci.cpp | 33 ++++--------------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/libs/compat/freebsd_network/bus.cpp b/src/libs/compat/freebsd_network/bus.cpp index 08dfa926ec..b0b601285b 100644 --- a/src/libs/compat/freebsd_network/bus.cpp +++ b/src/libs/compat/freebsd_network/bus.cpp @@ -10,7 +10,6 @@ extern "C" { } #include -#include #include #include @@ -421,18 +420,18 @@ bus_setup_intr(device_t dev, struct resource *res, int flags, intr_wrapper, intr, 0); } - if (status == B_OK && res->r_bustag == BUS_SPACE_TAG_MSI && gPCIx86 != NULL) { + if (status == B_OK && res->r_bustag == BUS_SPACE_TAG_MSI) { // this is an msi, enable it struct root_device_softc* root_softc = ((struct root_device_softc *)dev->root->softc); if (root_softc->is_msi) { - if (gPCIx86->enable_msi(root_softc->pci_info.bus, root_softc->pci_info.device, + if (gPci->enable_msi(root_softc->pci_info.bus, root_softc->pci_info.device, root_softc->pci_info.function) != B_OK) { device_printf(dev, "enabling msi failed\n"); bus_teardown_intr(dev, res, intr); return ENODEV; } } else if (root_softc->is_msix) { - if (gPCIx86->enable_msix(root_softc->pci_info.bus, root_softc->pci_info.device, + if (gPci->enable_msix(root_softc->pci_info.bus, root_softc->pci_info.device, root_softc->pci_info.function) != B_OK) { device_printf(dev, "enabling msix failed\n"); bus_teardown_intr(dev, res, intr); @@ -462,10 +461,10 @@ bus_teardown_intr(device_t dev, struct resource *res, void *arg) struct root_device_softc *root = (struct root_device_softc *)dev->root->softc; - if ((root->is_msi || root->is_msix) && gPCIx86 != NULL) { + if (root->is_msi || root->is_msix) { // disable msi generation pci_info *info = &root->pci_info; - gPCIx86->disable_msi(info->bus, info->device, info->function); + gPci->disable_msi(info->bus, info->device, info->function); } if (intr->filter != NULL) { diff --git a/src/libs/compat/freebsd_network/pci.cpp b/src/libs/compat/freebsd_network/pci.cpp index f1badca066..a3f827fcff 100644 --- a/src/libs/compat/freebsd_network/pci.cpp +++ b/src/libs/compat/freebsd_network/pci.cpp @@ -12,7 +12,6 @@ extern "C" { } #include -#include //#define DEBUG_PCI @@ -24,7 +23,6 @@ extern "C" { pci_module_info *gPci; -struct pci_x86_module_info *gPCIx86; status_t @@ -37,10 +35,6 @@ init_pci() if (status != B_OK) return status; - // if it fails we just don't support x86 specific features (like MSIs) - if (get_module(B_PCI_X86_MODULE_NAME, (module_info **)&gPCIx86) != B_OK) - gPCIx86 = NULL; - return B_OK; } @@ -50,8 +44,6 @@ uninit_pci() { if (gPci != NULL) put_module(B_PCI_MODULE_NAME); - if (gPCIx86 != NULL) - put_module(B_PCI_X86_MODULE_NAME); } @@ -264,23 +256,17 @@ pci_find_extcap(device_t dev, int capability, int *capreg) int pci_msi_count(device_t dev) { - if (gPCIx86 == NULL) - return 0; - pci_info* info = get_device_pci_info(dev); - return gPCIx86->get_msi_count(info->bus, info->device, info->function); + return gPci->get_msi_count(info->bus, info->device, info->function); } int pci_alloc_msi(device_t dev, int *count) { - if (gPCIx86 == NULL) - return ENODEV; - pci_info* info = get_device_pci_info(dev); uint8 startVector = 0; - if (gPCIx86->configure_msi(info->bus, info->device, info->function, *count, + if (gPci->configure_msi(info->bus, info->device, info->function, *count, &startVector) != B_OK) { return ENODEV; } @@ -294,11 +280,8 @@ pci_alloc_msi(device_t dev, int *count) int pci_release_msi(device_t dev) { - if (gPCIx86 == NULL) - return ENODEV; - pci_info* info = get_device_pci_info(dev); - gPCIx86->unconfigure_msi(info->bus, info->device, info->function); + gPci->unconfigure_msi(info->bus, info->device, info->function); ((struct root_device_softc *)dev->root->softc)->is_msi = false; ((struct root_device_softc *)dev->root->softc)->is_msix = false; return EOK; @@ -326,23 +309,17 @@ pci_msix_table_bar(device_t dev) int pci_msix_count(device_t dev) { - if (gPCIx86 == NULL) - return 0; - pci_info* info = get_device_pci_info(dev); - return gPCIx86->get_msix_count(info->bus, info->device, info->function); + return gPci->get_msix_count(info->bus, info->device, info->function); } int pci_alloc_msix(device_t dev, int *count) { - if (gPCIx86 == NULL) - return ENODEV; - pci_info* info = get_device_pci_info(dev); uint8 startVector = 0; - if (gPCIx86->configure_msix(info->bus, info->device, info->function, *count, + if (gPci->configure_msix(info->bus, info->device, info->function, *count, &startVector) != B_OK) { return ENODEV; }