freebsd_network: drop PCI_x86

Change-Id: Ie185f63b56bc564b794e5900609fe9f0465de602
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6330
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
This commit is contained in:
Jérôme Duval 2023-04-11 11:01:45 +02:00 committed by waddlesplash
parent 3b91d73bce
commit 2982f45075
2 changed files with 10 additions and 34 deletions

View File

@ -10,7 +10,6 @@ extern "C" {
} }
#include <cstdlib> #include <cstdlib>
#include <PCI_x86.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <int.h> #include <int.h>
@ -421,18 +420,18 @@ bus_setup_intr(device_t dev, struct resource *res, int flags,
intr_wrapper, intr, 0); 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 // this is an msi, enable it
struct root_device_softc* root_softc = ((struct root_device_softc *)dev->root->softc); struct root_device_softc* root_softc = ((struct root_device_softc *)dev->root->softc);
if (root_softc->is_msi) { 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) { root_softc->pci_info.function) != B_OK) {
device_printf(dev, "enabling msi failed\n"); device_printf(dev, "enabling msi failed\n");
bus_teardown_intr(dev, res, intr); bus_teardown_intr(dev, res, intr);
return ENODEV; return ENODEV;
} }
} else if (root_softc->is_msix) { } 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) { root_softc->pci_info.function) != B_OK) {
device_printf(dev, "enabling msix failed\n"); device_printf(dev, "enabling msix failed\n");
bus_teardown_intr(dev, res, intr); 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; 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 // disable msi generation
pci_info *info = &root->pci_info; 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) { if (intr->filter != NULL) {

View File

@ -12,7 +12,6 @@ extern "C" {
} }
#include <PCI.h> #include <PCI.h>
#include <PCI_x86.h>
//#define DEBUG_PCI //#define DEBUG_PCI
@ -24,7 +23,6 @@ extern "C" {
pci_module_info *gPci; pci_module_info *gPci;
struct pci_x86_module_info *gPCIx86;
status_t status_t
@ -37,10 +35,6 @@ init_pci()
if (status != B_OK) if (status != B_OK)
return status; 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; return B_OK;
} }
@ -50,8 +44,6 @@ uninit_pci()
{ {
if (gPci != NULL) if (gPci != NULL)
put_module(B_PCI_MODULE_NAME); 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 int
pci_msi_count(device_t dev) pci_msi_count(device_t dev)
{ {
if (gPCIx86 == NULL)
return 0;
pci_info* info = get_device_pci_info(dev); 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 int
pci_alloc_msi(device_t dev, int *count) pci_alloc_msi(device_t dev, int *count)
{ {
if (gPCIx86 == NULL)
return ENODEV;
pci_info* info = get_device_pci_info(dev); pci_info* info = get_device_pci_info(dev);
uint8 startVector = 0; 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) { &startVector) != B_OK) {
return ENODEV; return ENODEV;
} }
@ -294,11 +280,8 @@ pci_alloc_msi(device_t dev, int *count)
int int
pci_release_msi(device_t dev) pci_release_msi(device_t dev)
{ {
if (gPCIx86 == NULL)
return ENODEV;
pci_info* info = get_device_pci_info(dev); 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_msi = false;
((struct root_device_softc *)dev->root->softc)->is_msix = false; ((struct root_device_softc *)dev->root->softc)->is_msix = false;
return EOK; return EOK;
@ -326,23 +309,17 @@ pci_msix_table_bar(device_t dev)
int int
pci_msix_count(device_t dev) pci_msix_count(device_t dev)
{ {
if (gPCIx86 == NULL)
return 0;
pci_info* info = get_device_pci_info(dev); 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 int
pci_alloc_msix(device_t dev, int *count) pci_alloc_msix(device_t dev, int *count)
{ {
if (gPCIx86 == NULL)
return ENODEV;
pci_info* info = get_device_pci_info(dev); pci_info* info = get_device_pci_info(dev);
uint8 startVector = 0; 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) { &startVector) != B_OK) {
return ENODEV; return ENODEV;
} }