svn commit: r307338 - head/sys/boot/i386/libi386

Warner Losh imp at FreeBSD.org
Sat Oct 15 05:53:11 UTC 2016


Author: imp
Date: Sat Oct 15 05:53:09 2016
New Revision: 307338
URL: https://svnweb.freebsd.org/changeset/base/307338

Log:
  Create a pcibios-version environment FORTH word. This allows one to
  conditionally compile forth code before using the pcibios- words.

Modified:
  head/sys/boot/i386/libi386/biospci.c

Modified: head/sys/boot/i386/libi386/biospci.c
==============================================================================
--- head/sys/boot/i386/libi386/biospci.c	Sat Oct 15 01:41:28 2016	(r307337)
+++ head/sys/boot/i386/libi386/biospci.c	Sat Oct 15 05:53:09 2016	(r307338)
@@ -190,7 +190,6 @@ static struct pci_class
     {-1,	NULL,		NULL}
 };
 
-
 static void	biospci_enumerate(void);
 static void	biospci_addinfo(int devid, struct pci_class *pc, struct pci_subclass *psc, struct pci_progif *ppi);
 
@@ -199,6 +198,7 @@ struct pnphandler biospcihandler =
     "PCI BIOS",
     biospci_enumerate
 };
+static int biospci_version;
 
 #define PCI_BIOS_PRESENT	0xb101
 #define FIND_PCI_DEVICE		0xb102
@@ -254,7 +254,7 @@ biospci_detect(void)
     setenv("pcibios.config2", buf, 1);
     sprintf(buf, "%d", maxbus);
     setenv("pcibios.maxbus", buf, 1);
-
+    biospci_version = bcd2bin((version >> 8) & 0xf) * 10 + bcd2bin(version & 0xf);
 }
 
 static void
@@ -577,6 +577,8 @@ static void ficlCompilePciBios(FICL_SYST
     dictAppendWord(dp, "pcibios-find-devclass", ficlPciBiosFindDevclass, FW_DEFAULT);
     dictAppendWord(dp, "pcibios-find-device", ficlPciBiosFindDevice, FW_DEFAULT);
     dictAppendWord(dp, "pcibios-locator", ficlPciBiosLocator, FW_DEFAULT);
+
+    ficlSetEnv(pSys, "pcibios-version", biospci_version);
 }
 
 FICL_COMPILE_SET(ficlCompilePciBios);


More information about the svn-src-head mailing list