summaryrefslogtreecommitdiffstats
path: root/sys/amd64/pci
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-08-21 07:53:37 +0000
committerimp <imp@FreeBSD.org>2001-08-21 07:53:37 +0000
commit2037893300256f8f0330c31d51e6c741eb7de513 (patch)
tree3887aa3a169df8479d492495fe80c564795a9325 /sys/amd64/pci
parent12638a445de0d530b1977dd9894a5878ac70041c (diff)
downloadFreeBSD-src-2037893300256f8f0330c31d51e6c741eb7de513.zip
FreeBSD-src-2037893300256f8f0330c31d51e6c741eb7de513.tar.gz
The general conesnsus on irc was that pci bios for config registers
and such was just a bad idea and one that users should be forced to enable if they want it. This patch introduces a hw.pci.enable_pcibios tunable for those people. This does not impact the pcibios interrupt routing at all. Approved by: peter, msmith
Diffstat (limited to 'sys/amd64/pci')
-rw-r--r--sys/amd64/pci/pci_cfgreg.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index 3538969..1913075 100644
--- a/sys/amd64/pci/pci_cfgreg.c
+++ b/sys/amd64/pci/pci_cfgreg.c
@@ -55,6 +55,9 @@
static int cfgmech;
static int devmax;
static int usebios;
+static int enable_pcibios = 0;
+
+TUNABLE_INT("hw.pci.enable_pcibios", &enable_pcibios);
static int pci_cfgintr_unique(struct PIR_entry *pe, int pin);
static int pci_cfgintr_linked(struct PIR_entry *pe, int pin);
@@ -449,14 +452,34 @@ pcibios_cfgwrite(int bus, int slot, int func, int reg, int data, int bytes)
bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL));
}
+static u_int16_t
+pcibios_get_version(void)
+{
+ struct bios_regs args;
+
+ args.eax = PCIBIOS_BIOS_PRESENT;
+ if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)))
+ return (0x0000);
+ if (args.edx != 0x20494350)
+ return (0x0000);
+ return (args.ebx & 0xffff);
+}
+
/*
* Determine whether there is a PCI BIOS present
*/
static int
pcibios_cfgopen(void)
{
- /* check for a found entrypoint */
- return(PCIbios.entry != 0);
+ u_int16_t v = 0;
+
+ if (PCIbios.entry != 0 && enable_pcibios) {
+ v = pcibios_get_version();
+ if (v > 0)
+ printf("pcibios: BIOS version %x.%02x\n", (v & 0xff00) >> 8,
+ v & 0xff);
+ }
+ return (v > 0);
}
/*
OpenPOWER on IntegriCloud