Add a 'hw.pci.mcfg' tunable. It can be set to 0 to disable memory-mapped

PCI config access.
This commit is contained in:
John Baldwin 2008-09-11 21:42:11 +00:00
parent 34ba28d182
commit 3591fea8b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182947
2 changed files with 12 additions and 0 deletions

View File

@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/mutex.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@ -60,6 +61,8 @@ static vm_offset_t pcie_base;
static int pcie_minbus, pcie_maxbus;
static uint32_t pcie_badslots;
static struct mtx pcicfg_mtx;
static int mcfg_enable = 1;
TUNABLE_INT("hw.pci.mcfg", &mcfg_enable);
/*
* Initialise access to PCI configuration space
@ -248,6 +251,9 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
uint32_t val1, val2;
int slot;
if (!mcfg_enable)
return (0);
if (minbus != 0)
return (0);

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/mutex.h>
#include <sys/malloc.h>
#include <sys/queue.h>
@ -81,6 +82,8 @@ static uint32_t pcie_badslots;
static int cfgmech;
static int devmax;
static struct mtx pcicfg_mtx;
static int mcfg_enable = 1;
TUNABLE_INT("hw.pci.mcfg", &mcfg_enable);
static uint32_t pci_docfgregread(int bus, int slot, int func, int reg,
int bytes);
@ -522,6 +525,9 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
uint32_t val1, val2;
int i, slot;
if (!mcfg_enable)
return (0);
if (minbus != 0)
return (0);