summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2021-09-10 20:08:23 +0300
committerToomas Soome <tsoome@me.com>2021-09-12 21:04:38 +0300
commit402e3d8a452bf2d05e0aca13e1ef518c8a91d796 (patch)
tree84668c7caf66e5e8230542f0cc4f168b95afad74
parent190f051b526c1526e05ff7b598df8690980548b2 (diff)
downloadillumos-joyent-402e3d8a452bf2d05e0aca13e1ef518c8a91d796.tar.gz
14066 loader.efi: want inb and outb
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Andy Fiddaman <andy@omnios.org> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/common/misc.c61
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/biospci.c43
3 files changed, 56 insertions, 50 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index 2463627c7b..5d1cb29b2c 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -34,4 +34,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2021.09.02.1
+BOOT_VERSION = $(LOADER_VERSION)-2021.09.11.1
diff --git a/usr/src/boot/sys/boot/common/misc.c b/usr/src/boot/sys/boot/common/misc.c
index 9b938afdf8..ef21ad4db2 100644
--- a/usr/src/boot/sys/boot/common/misc.c
+++ b/usr/src/boot/sys/boot/common/misc.c
@@ -25,11 +25,13 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <stand.h>
#include <bootstrap.h>
+#ifndef BOOT2
+#include <machine/cpufunc.h>
+#include "ficl.h"
+#endif
/*
* Concatenate the (argc) elements of (argv) into a single string, and return
@@ -55,7 +57,7 @@ unargv(int argc, char *argv[])
if (i < (argc - 1))
strcat(cp, " ");
}
-
+
return(cp);
}
@@ -67,7 +69,7 @@ strlenout(vm_offset_t src)
{
char c;
size_t len;
-
+
for (len = 0; ; len++) {
archsw.arch_copyout(src++, &c, 1);
if (c == 0)
@@ -83,7 +85,7 @@ char *
strdupout(vm_offset_t str)
{
char *result, *cp;
-
+
result = malloc(strlenout(str) + 1);
for (cp = result; ;cp++) {
archsw.arch_copyout(str++, cp, 1);
@@ -181,7 +183,7 @@ hexdump(caddr_t region, size_t len)
pager_open();
for (line = region; line < (region + len); line += 16) {
emit("%08lx ", (long) line);
-
+
for (x = 0; x < 16; x++) {
if ((line + x) < (region + len)) {
emit("%02x ", *(u_int8_t *)(line + x));
@@ -217,3 +219,50 @@ dev_cleanup(void)
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
}
+
+#ifndef BOOT2
+/*
+ * outb ( port# c -- )
+ * Store a byte to I/O port number port#
+ */
+static void
+ficlOutb(ficlVm *pVM)
+{
+ uint8_t c;
+ uint32_t port;
+
+ port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM));
+ c = ficlStackPopInteger(ficlVmGetDataStack(pVM));
+ outb(port, c);
+}
+
+/*
+ * inb ( port# -- c )
+ * Fetch a byte from I/O port number port#
+ */
+static void
+ficlInb(ficlVm *pVM)
+{
+ uint8_t c;
+ uint32_t port;
+
+ port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM));
+ c = inb(port);
+ ficlStackPushInteger(ficlVmGetDataStack(pVM), c);
+}
+
+static void
+ficlCompileCpufunc(ficlSystem *pSys)
+{
+ ficlDictionary *dp = ficlSystemGetDictionary(pSys);
+
+ FICL_SYSTEM_ASSERT(pSys, dp);
+
+ (void) ficlDictionarySetPrimitive(dp, "outb", ficlOutb,
+ FICL_WORD_DEFAULT);
+ (void) ficlDictionarySetPrimitive(dp, "inb", ficlInb,
+ FICL_WORD_DEFAULT);
+}
+
+FICL_COMPILE_SET(ficlCompileCpufunc);
+#endif
diff --git a/usr/src/boot/sys/boot/i386/libi386/biospci.c b/usr/src/boot/sys/boot/i386/libi386/biospci.c
index 4c75fa310f..828cc87fa1 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biospci.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biospci.c
@@ -612,46 +612,3 @@ ficlCompilePciBios(ficlSystem *pSys)
}
FICL_COMPILE_SET(ficlCompilePciBios);
-
-/*
- * outb ( port# c -- )
- * Store a byte to I/O port number port#
- */
-static void
-ficlOutb(ficlVm *pVM)
-{
- uint8_t c;
- uint32_t port;
-
- port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM));
- c = ficlStackPopInteger(ficlVmGetDataStack(pVM));
- outb(port, c);
-}
-
-/*
- * inb ( port# -- c )
- * Fetch a byte from I/O port number port#
- */
-static void
-ficlInb(ficlVm *pVM)
-{
- uint8_t c;
- uint32_t port;
-
- port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM));
- c = inb(port);
- ficlStackPushInteger(ficlVmGetDataStack(pVM), c);
-}
-
-static void
-ficlCompileCpufunc(ficlSystem *pSys)
-{
- ficlDictionary *dp = ficlSystemGetDictionary(pSys);
-
- FICL_SYSTEM_ASSERT(pSys, dp);
-
- ficlDictionarySetPrimitive(dp, "outb", ficlOutb, FICL_WORD_DEFAULT);
- ficlDictionarySetPrimitive(dp, "inb", ficlInb, FICL_WORD_DEFAULT);
-}
-
-FICL_COMPILE_SET(ficlCompileCpufunc);