summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-01-16 12:19:33 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-01-16 12:19:33 +0000
commitd3f83376d2ed784ca0a6ba3d8cd1fdaee338f1c4 (patch)
treef5da272fde15217209aa45ff8a07779656164933
parentf634d1677b30daf0327321f2f1f01ea3686f422c (diff)
parent6554ec17858060401cf0f52e78b57fec69f7842d (diff)
downloadillumos-joyent-release-20200116.tar.gz
[illumos-gate merge]release-20200116
commit 6554ec17858060401cf0f52e78b57fec69f7842d 12195 acpidump failed under EFI commit 00f7aa5b4350768e529a41a31488f44902224fcf 12186 The n2rng man page incorrectly refers to n2cp commit 005be40cf09c8b0bcf2de631893dae837ff4cb8a 12188 libfmd_adm: Wrong prerequisites for generated files commit b0858fdc3790ef1d1f955bd584621c6fd539050d 11522 illumos-gate has some runtime dependencies on Python 2.7 12192 python3 modules treat strings incorrectly
-rw-r--r--usr/src/Makefile.master2
-rw-r--r--usr/src/cmd/pyzfs/pyzfs.py2
-rw-r--r--usr/src/lib/fm/libfmd_adm/Makefile.com4
-rw-r--r--usr/src/lib/pylibbe/common/libbe_py.c10
-rw-r--r--usr/src/lib/pyzfs/common/ioctl.c6
-rw-r--r--usr/src/man/man7d/n2rng.7d68
-rw-r--r--usr/src/test/test-runner/cmd/run62
-rw-r--r--usr/src/uts/i86pc/dboot/dboot_elfload.c5
-rw-r--r--usr/src/uts/i86pc/dboot/dboot_startkern.c18
-rw-r--r--usr/src/uts/i86pc/os/fakebop.c183
-rw-r--r--usr/src/uts/intel/sys/bootinfo.h5
11 files changed, 199 insertions, 166 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index a0699583e5..a6e04e2229 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -289,6 +289,8 @@ INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
# python scripts to the proto area. This is overridden by makefiles to
# select to the correct version.
PYSHEBANG= $(PYTHON)
+$(BUILDPY3)PYSHEBANG= $(PYTHON3)
+$(BUILDPY2)PYSHEBANG= $(PYTHON)
#
# Python bakes the mtime of the .py file into the compiled .pyc and
diff --git a/usr/src/cmd/pyzfs/pyzfs.py b/usr/src/cmd/pyzfs/pyzfs.py
index 7df7d09bfe..efcb4e8842 100644
--- a/usr/src/cmd/pyzfs/pyzfs.py
+++ b/usr/src/cmd/pyzfs/pyzfs.py
@@ -1,4 +1,4 @@
-#!@PYTHON@ -S
+#!@PYTHON@ -Es
#
# CDDL HEADER START
#
diff --git a/usr/src/lib/fm/libfmd_adm/Makefile.com b/usr/src/lib/fm/libfmd_adm/Makefile.com
index 8e58527bef..6344075d73 100644
--- a/usr/src/lib/fm/libfmd_adm/Makefile.com
+++ b/usr/src/lib/fm/libfmd_adm/Makefile.com
@@ -65,10 +65,10 @@ fmd_rpc_adm.h: fmd_rpc_adm.x
../common/fmd_adm.c: fmd_rpc_adm.h
-fmd_rpc.c: fmd_rpc_adm.h
+fmd_rpc.c: fmd_rpc_adm.x
$(RPCGEN) -CMN -l -o $@ fmd_rpc_adm.x
-fmd_xdr.c: fmd_rpc_adm.h
+fmd_xdr.c: fmd_rpc_adm.x
$(RPCGEN) -CMN -c -o $@ fmd_rpc_adm.x
pics/%.o: ../$(MACH)/%.c
diff --git a/usr/src/lib/pylibbe/common/libbe_py.c b/usr/src/lib/pylibbe/common/libbe_py.c
index 6e35228128..6402e0daad 100644
--- a/usr/src/lib/pylibbe/common/libbe_py.c
+++ b/usr/src/lib/pylibbe/common/libbe_py.c
@@ -202,9 +202,15 @@ beCopy(PyObject *self, PyObject *args)
NULL, NULL));
}
while (PyDict_Next(beNameProperties, &pos, &pkey, &pvalue)) {
+#if PY_MAJOR_VERSION >= 3
+ if (!convertPyArgsToNvlist(&beProps, 2,
+ PyUnicode_AsUTF8(pkey),
+ PyUnicode_AsUTF8(pvalue))) {
+#else
if (!convertPyArgsToNvlist(&beProps, 2,
- PyBytes_AS_STRING(pkey),
- PyBytes_AS_STRING(pvalue))) {
+ PyString_AsString(pkey),
+ PyString_AsString(pvalue))) {
+#endif
nvlist_free(beProps);
nvlist_free(beAttrs);
return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,
diff --git a/usr/src/lib/pyzfs/common/ioctl.c b/usr/src/lib/pyzfs/common/ioctl.c
index 55c03fc2b8..a931a7bb69 100644
--- a/usr/src/lib/pyzfs/common/ioctl.c
+++ b/usr/src/lib/pyzfs/common/ioctl.c
@@ -144,7 +144,7 @@ dict2nvl(PyObject *d)
while (PyDict_Next(d, &pos, &key, &value)) {
#if PY_MAJOR_VERSION >= 3
- char *keystr = PyBytes_AsString(key);
+ char *keystr = PyUnicode_AsUTF8(key);
#else
char *keystr = PyString_AsString(key);
#endif
@@ -161,12 +161,12 @@ dict2nvl(PyObject *d)
} else if (value == Py_None) {
err = nvlist_add_boolean(nvl, keystr);
#if PY_MAJOR_VERSION >= 3
- } else if (PyBytes_Check(value)) {
+ } else if (PyUnicode_Check(value)) {
#else
} else if (PyString_Check(value)) {
#endif
#if PY_MAJOR_VERSION >= 3
- char *valstr = PyBytes_AsString(value);
+ char *valstr = PyUnicode_AsUTF8(value);
#else
char *valstr = PyString_AsString(value);
#endif
diff --git a/usr/src/man/man7d/n2rng.7d b/usr/src/man/man7d/n2rng.7d
index 881ef18348..e851b7bd9e 100644
--- a/usr/src/man/man7d/n2rng.7d
+++ b/usr/src/man/man7d/n2rng.7d
@@ -1,27 +1,24 @@
'\" te
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2020 Peter Tribble.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH N2RNG 7D "Apr 15, 2009"
+.TH N2RNG 7D "Jan 12, 2020"
.SH NAME
n2rng \- Ultra-SPARC T2 random number generator device driver
.SH DESCRIPTION
-.sp
-.LP
The \fBn2rng\fR device driver is a multi-threaded, loadable hardware driver
-supporting hardware assisted random numbers. This support is built into the
-Ultra-SPARC T2 CMT processor.
+supporting hardware assisted random numbers.
+This support is built into the Ultra-SPARC T2 and later processors.
.sp
.LP
The \fBn2rng\fR driver requires the presence of the Solaris Cryptographic
Framework to enable applications and kernel clients to access the provided
services.
.SH CONFIGURATION
-.sp
-.LP
You configure the \fBn2rng\fR driver by defining properties in
-\fB/platform/sun4v/kernel/drv/n2cp.conf\fR which override the default settings.
+\fB/platform/sun4v/kernel/drv/n2rng.conf\fR which override the default settings.
The following property is supported:
.sp
.ne 2
@@ -29,16 +26,16 @@ The following property is supported:
\fBnostats\fR
.ad
.RS 28n
-Disables the generation of statistics. The nostats property may be used to help
-prevent traffic analysis, however, this may inhibit support personnel.
+Disables the generation of statistics.
+The nostats property may be used to help prevent traffic analysis, however,
+this may inhibit support personnel.
.RE
.SH CRYPTO STATISTICS
-.sp
-.LP
-Solaris crypto drivers must implement statistics variables. Statistics are
-reported by \fBn2rng\fR using the \fBkstat\fR(7D) and \fBkstat\fR(9S)
-mechanisms. The \fBn2rng\fR driver maintains the following statistics:
+Solaris crypto drivers must implement statistics variables.
+Statistics reported by \fBn2rng\fR may be read using the \fBkstat\fR(1M)
+utility.
+The \fBn2rng\fR driver maintains the following statistics:
.sp
.ne 2
.na
@@ -67,12 +64,10 @@ Number of bytes read from the RNG device.
.RE
.SH KERNEL STATISTICS
-.sp
-.LP
-The \fBn2rng\fR driver tallies a set of kernel driver statistics when in the
-Control domain. Statistics are reported by \fBn2rng\fR using the
-\fBkstat\fR(7D) and \fBkstat\fR(9S) mechanisms. All statistics are maintained
-as unsigned, and all are 64 bits.
+The \fBn2rng\fR driver tallies a set of kernel driver statistics when in the
+Control domain.
+Statistics reported by \fBn2rng\fR may be read using the \fBkstat\fR(1M)
+utility.
.sp
.ne 2
.na
@@ -106,7 +101,7 @@ Bias setting for noise cell 1 of RNG \fIn\fR.
\fBrng(n)-cell1-entropy\fR
.ad
.RS 28n
-Entropy value for noise cell 1 of RNG n.
+Entropy value for noise cell 1 of RNG \fIn\fR.
.RE
.sp
@@ -121,7 +116,7 @@ Bias setting for noise cell 2 of RNG \fIn\fR.
.sp
.ne 2
.na
-\fBrng(n)-cell3-entropy\fR
+\fBrng(n)-cell2-entropy\fR
.ad
.RS 28n
Entropy value for noise cell 2 of RNG \fIn\fR.
@@ -133,33 +128,30 @@ Entropy value for noise cell 2 of RNG \fIn\fR.
\fBrng(n)-state\fR
.ad
.RS 28n
-State of rng number n (online, offline, error, health check).
+State of rng number n (online, offline, error, health check).
.RE
.SH FILES
-.sp
.ne 2
.na
-\fB\fB/platform/sun4v/kernel/drv/sparcv9/n2cp\fR\fR
+\fB/platform/sun4v/kernel/drv/sparcv9/n2rng\fR
.ad
.sp .6
.RS 4n
-64-bit ELF kernel driver.
+Device driver (SPARC)
.RE
.sp
.ne 2
.na
-\fB\fB/platform/sun4v/kernel/drv/n2rng.conf\fR\fR
+\fB/platform/sun4v/kernel/drv/n2rng.conf\fR
.ad
.sp .6
.RS 4n
-Configuration file.
+Driver configuration file
.RE
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -172,18 +164,8 @@ ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Architecture SPARC
_
-Interface stability Committed
+Interface stability Committed
.TE
.SH SEE ALSO
-.sp
-.LP
-\fBcryptoadm\fR(1M), \fBkstat\fR(1M), \fBprinters.conf\fR(4),
-\fBattributes\fR(5)
-.sp
-.LP
-\fISolaris Cryptographic Framework - Solaris Software Developer Collection\fR
-.sp
-.LP
-\fISolaris Security for Developer's Guide - Solaris Software Developer
-Collection\fR
+\fBcryptoadm\fR(1M), \fBkstat\fR(1M), \fBattributes\fR(5)
diff --git a/usr/src/test/test-runner/cmd/run b/usr/src/test/test-runner/cmd/run
index 1d6b4f2969..e1f1a15a35 100644
--- a/usr/src/test/test-runner/cmd/run
+++ b/usr/src/test/test-runner/cmd/run
@@ -17,7 +17,15 @@
# Copyright 2019 Joyent, Inc.
#
-import ConfigParser
+from __future__ import print_function
+import sys
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+ import configparser
+else:
+ import ConfigParser as configparser
+
import os
import logging
import platform
@@ -30,7 +38,8 @@ from select import select
from subprocess import PIPE
from subprocess import Popen
from sys import argv
-from sys import maxint
+from sys import exit
+from sys import maxsize
from threading import Timer
from time import time
@@ -145,7 +154,7 @@ class Output(object):
for easy sorting/merging later.
"""
fd = self.fileno()
- buf = os.read(fd, 4096)
+ buf = os.read(fd, 4096).decode()
if not buf:
return None
if '\n' not in buf:
@@ -259,26 +268,27 @@ class Cmd(object):
if needed. Run the command, and update the result object.
"""
if options.dryrun is True:
- print self
+ print(self)
return
privcmd = self.update_cmd_privs(self.pathname, self.user)
try:
old = os.umask(0)
if not os.path.isdir(self.outputdir):
- os.makedirs(self.outputdir, mode=0777)
+ os.makedirs(self.outputdir, mode=0o777)
os.umask(old)
- except OSError, e:
+ except OSError as e:
fail('%s' % e)
try:
self.result.starttime = time()
- proc = Popen(privcmd, stdout=PIPE, stderr=PIPE, stdin=PIPE)
+ proc = Popen(privcmd, stdout=PIPE, stderr=PIPE, stdin=PIPE,
+ universal_newlines=True)
proc.stdin.close()
# Allow a special timeout value of 0 to mean infinity
if int(self.timeout) == 0:
- self.timeout = maxint
+ self.timeout = maxsize
t = Timer(int(self.timeout), self.kill_cmd, [proc])
t.start()
self.result.stdout, self.result.stderr = self.collect_output(proc)
@@ -330,7 +340,7 @@ class Cmd(object):
logger.debug('%s%s%s' % (msga, pad, msgb))
lines = sorted(self.result.stdout + self.result.stderr,
- cmp=lambda x, y: cmp(x[0], y[0]))
+ key=lambda x: x[0])
for dt, line in lines:
logger.debug('%s %s' % (dt.strftime("%H:%M:%S.%f ")[:11], line))
@@ -338,15 +348,15 @@ class Cmd(object):
if len(self.result.stdout):
with open(os.path.join(self.outputdir, 'stdout'), 'w') as out:
for _, line in self.result.stdout:
- os.write(out.fileno(), '%s\n' % line)
+ out.write('%s\n' % line)
if len(self.result.stderr):
with open(os.path.join(self.outputdir, 'stderr'), 'w') as err:
for _, line in self.result.stderr:
- os.write(err.fileno(), '%s\n' % line)
+ err.write('%s\n' % line)
if len(self.result.stdout) and len(self.result.stderr):
with open(os.path.join(self.outputdir, 'merged'), 'w') as merged:
for _, line in lines:
- os.write(merged.fileno(), '%s\n' % line)
+ merged.write('%s\n' % line)
class Test(Cmd):
@@ -597,7 +607,7 @@ class TestRun(object):
in the 'DEFAULT' section. If the Test or TestGroup passes
verification, add it to the TestRun.
"""
- config = ConfigParser.RawConfigParser()
+ config = configparser.RawConfigParser()
if not len(config.read(options.runfile)):
fail("Coulnd't read config file %s" % options.runfile)
@@ -661,7 +671,7 @@ class TestRun(object):
defaults = dict([(prop, getattr(options, prop)) for prop, _ in
self.defaults])
- config = ConfigParser.RawConfigParser(defaults)
+ config = configparser.RawConfigParser(defaults)
for test in sorted(self.tests.keys()):
config.add_section(test)
@@ -690,14 +700,14 @@ class TestRun(object):
"""
done = False
components = 0
- tmp_dict = dict(self.tests.items() + self.testgroups.items())
+ tmp_dict = dict(list(self.tests.items()) + list(self.testgroups.items()))
total = len(tmp_dict)
base = self.outputdir
while not done:
l = []
components -= 1
- for testfile in tmp_dict.keys():
+ for testfile in list(tmp_dict.keys()):
uniq = '/'.join(testfile.split('/')[components:]).lstrip('/')
if uniq not in l:
l.append(uniq)
@@ -725,9 +735,9 @@ class TestRun(object):
if options.cmd is not 'wrconfig':
try:
old = os.umask(0)
- os.makedirs(self.outputdir, mode=0777)
+ os.makedirs(self.outputdir, mode=0o777)
os.umask(old)
- except OSError, e:
+ except OSError as e:
fail('%s' % e)
filename = os.path.join(self.outputdir, 'log')
@@ -763,17 +773,17 @@ class TestRun(object):
if Result.total is 0:
return
- print '\nResults Summary'
- for key in Result.runresults.keys():
+ print('\nResults Summary')
+ for key in list(Result.runresults.keys()):
if Result.runresults[key] is not 0:
- print '%s\t% 4d' % (key, Result.runresults[key])
+ print('%s\t% 4d' % (key, Result.runresults[key]))
m, s = divmod(time() - self.starttime, 60)
h, m = divmod(m, 60)
- print '\nRunning Time:\t%02d:%02d:%02d' % (h, m, s)
- print 'Percent passed:\t%.1f%%' % ((float(Result.runresults['PASS']) /
- float(Result.total)) * 100)
- print 'Log directory:\t%s' % self.outputdir
+ print('\nRunning Time:\t%02d:%02d:%02d' % (h, m, s))
+ print('Percent passed:\t%.1f%%' % ((float(Result.runresults['PASS']) /
+ float(Result.total)) * 100))
+ print('Log directory:\t%s' % self.outputdir)
def verify_file(pathname):
@@ -850,7 +860,7 @@ def find_tests(testrun, options):
def fail(retstr, ret=1):
- print '%s: %s' % (argv[0], retstr)
+ print('%s: %s' % (argv[0], retstr))
exit(ret)
diff --git a/usr/src/uts/i86pc/dboot/dboot_elfload.c b/usr/src/uts/i86pc/dboot/dboot_elfload.c
index c03f66145f..c929562d48 100644
--- a/usr/src/uts/i86pc/dboot/dboot_elfload.c
+++ b/usr/src/uts/i86pc/dboot/dboot_elfload.c
@@ -24,6 +24,9 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright 2020 Joyent, Inc.
+ */
#include <sys/types.h>
#include <sys/inttypes.h>
@@ -182,7 +185,7 @@ dboot_elfload64(uintptr_t file_image)
/* zero out bss */
if (shdr->sh_type == SHT_NOBITS) {
if (prom_debug)
- dboot_printf("zeroing BSS %lu bytes from "
+ dboot_printf("zeroing BSS %ld bytes from "
"physaddr 0x%" PRIx64
" (end=0x%" PRIx64 ")\n",
(ulong_t)shdr->sh_size,
diff --git a/usr/src/uts/i86pc/dboot/dboot_startkern.c b/usr/src/uts/i86pc/dboot/dboot_startkern.c
index 12b97be5e5..edd0093853 100644
--- a/usr/src/uts/i86pc/dboot/dboot_startkern.c
+++ b/usr/src/uts/i86pc/dboot/dboot_startkern.c
@@ -23,7 +23,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
@@ -1827,22 +1827,19 @@ dboot_multiboot_get_fwtables(void)
}
/*
- * The ACPI RSDP can be found by scanning the BIOS memory areas or
- * from the EFI system table. The boot loader may pass in the address
- * it found the ACPI tables at.
+ * The multiboot2 info contains a copy of the RSDP; stash a pointer to
+ * it (see find_rsdp() in fakebop).
*/
nacpitagp = (multiboot_tag_new_acpi_t *)
- dboot_multiboot2_find_tag(mb2_info,
- MULTIBOOT_TAG_TYPE_ACPI_NEW);
+ dboot_multiboot2_find_tag(mb2_info, MULTIBOOT_TAG_TYPE_ACPI_NEW);
oacpitagp = (multiboot_tag_old_acpi_t *)
- dboot_multiboot2_find_tag(mb2_info,
- MULTIBOOT_TAG_TYPE_ACPI_OLD);
+ dboot_multiboot2_find_tag(mb2_info, MULTIBOOT_TAG_TYPE_ACPI_OLD);
if (nacpitagp != NULL) {
- bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t)
+ bi->bi_acpi_rsdp_copy = (native_ptr_t)(uintptr_t)
&nacpitagp->mb_rsdp[0];
} else if (oacpitagp != NULL) {
- bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t)
+ bi->bi_acpi_rsdp_copy = (native_ptr_t)(uintptr_t)
&oacpitagp->mb_rsdp[0];
}
}
@@ -2355,6 +2352,7 @@ startup_kernel(void)
if (mb2_info != NULL)
DBG(mb2_info->mbi_total_size);
DBG(bi->bi_acpi_rsdp);
+ DBG(bi->bi_acpi_rsdp_copy);
DBG(bi->bi_smbios);
DBG(bi->bi_uefi_arch);
DBG(bi->bi_uefi_systab);
diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c
index 128f75f0c5..02fbeb1814 100644
--- a/usr/src/uts/i86pc/os/fakebop.c
+++ b/usr/src/uts/i86pc/os/fakebop.c
@@ -26,7 +26,7 @@
* Copyright (c) 2010, Intel Corporation.
* All rights reserved.
*
- * Copyright (c) 2019, Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -2271,18 +2271,22 @@ valid_rsdp(ACPI_TABLE_RSDP *rp)
* see ACPI 3.0 Spec, 5.2.5.1
*/
static ACPI_TABLE_RSDP *
-scan_rsdp(paddr_t start, paddr_t end)
+scan_rsdp(paddr_t *paddrp, size_t len)
{
- ssize_t len = end - start;
+ paddr_t paddr = *paddrp;
caddr_t ptr;
- ptr = vmap_phys(len, start);
+ ptr = vmap_phys(len, paddr);
+
while (len > 0) {
if (strncmp(ptr, ACPI_SIG_RSDP, strlen(ACPI_SIG_RSDP)) == 0 &&
- valid_rsdp((ACPI_TABLE_RSDP *)ptr))
+ valid_rsdp((ACPI_TABLE_RSDP *)ptr)) {
+ *paddrp = paddr;
return ((ACPI_TABLE_RSDP *)ptr);
+ }
ptr += ACPI_RSDP_SCAN_STEP;
+ paddr += ACPI_RSDP_SCAN_STEP;
len -= ACPI_RSDP_SCAN_STEP;
}
@@ -2290,43 +2294,67 @@ scan_rsdp(paddr_t start, paddr_t end)
}
/*
- * Refer to ACPI 3.0 Spec, section 5.2.5.1 to understand this function
+ * Locate the ACPI RSDP. We search in a particular order:
+ *
+ * - If the bootloader told us the location of the RSDP (via the EFI system
+ * table), try that first.
+ * - Otherwise, look in the EBDA and BIOS memory as per ACPI 5.2.5.1 (legacy
+ * case).
+ * - Finally, our bootloader may have a copy of the RSDP in its info: this might
+ * get freed after boot, so we always prefer to find the original RSDP first.
+ *
+ * Once found, we set acpi-root-tab property (a physical address) for the
+ * benefit of acpica, acpidump etc.
*/
+
static ACPI_TABLE_RSDP *
-find_rsdp()
+find_rsdp(struct xboot_info *xbp)
{
- ACPI_TABLE_RSDP *rsdp;
- uint64_t rsdp_val = 0;
- uint16_t *ebda_seg;
- paddr_t ebda_addr;
+ ACPI_TABLE_RSDP *rsdp = NULL;
+ paddr_t paddr = 0;
- /* check for "acpi-root-tab" property */
if (do_bsys_getproplen(NULL, "acpi-root-tab") == sizeof (uint64_t)) {
- (void) do_bsys_getprop(NULL, "acpi-root-tab", &rsdp_val);
- if (rsdp_val != 0) {
- rsdp = scan_rsdp(rsdp_val, rsdp_val + sizeof (*rsdp));
- if (rsdp != NULL) {
- if (kbm_debug) {
- bop_printf(NULL,
- "Using RSDP from bootloader: "
- "0x%p\n", (void *)rsdp);
- }
- return (rsdp);
- }
- }
+ (void) do_bsys_getprop(NULL, "acpi-root-tab", &paddr);
+ rsdp = scan_rsdp(&paddr, sizeof (*rsdp));
}
- /*
- * Get the EBDA segment and scan the first 1K
- */
- ebda_seg = (uint16_t *)vmap_phys(sizeof (uint16_t),
- ACPI_EBDA_PTR_LOCATION);
- ebda_addr = *ebda_seg << 4;
- rsdp = scan_rsdp(ebda_addr, ebda_addr + ACPI_EBDA_WINDOW_SIZE);
- if (rsdp == NULL)
- /* if EBDA doesn't contain RSDP, look in BIOS memory */
- rsdp = scan_rsdp(ACPI_HI_RSDP_WINDOW_BASE,
- ACPI_HI_RSDP_WINDOW_BASE + ACPI_HI_RSDP_WINDOW_SIZE);
+#ifndef __xpv
+ if (rsdp == NULL && xbp->bi_acpi_rsdp != NULL) {
+ paddr = (uintptr_t)xbp->bi_acpi_rsdp;
+ rsdp = scan_rsdp(&paddr, sizeof (*rsdp));
+ }
+#endif
+
+ if (rsdp == NULL) {
+ uint16_t *ebda_seg = (uint16_t *)vmap_phys(sizeof (uint16_t),
+ ACPI_EBDA_PTR_LOCATION);
+ paddr = *ebda_seg << 4;
+ rsdp = scan_rsdp(&paddr, ACPI_EBDA_WINDOW_SIZE);
+ }
+
+ if (rsdp == NULL) {
+ paddr = ACPI_HI_RSDP_WINDOW_BASE;
+ rsdp = scan_rsdp(&paddr, ACPI_HI_RSDP_WINDOW_SIZE);
+ }
+
+#ifndef __xpv
+ if (rsdp == NULL && xbp->bi_acpi_rsdp_copy != NULL) {
+ paddr = (uintptr_t)xbp->bi_acpi_rsdp_copy;
+ rsdp = scan_rsdp(&paddr, sizeof (*rsdp));
+ }
+#endif
+
+ if (rsdp == NULL) {
+ bop_printf(NULL, "no RSDP found!\n");
+ return (NULL);
+ }
+
+ if (kbm_debug)
+ bop_printf(NULL, "RSDP found at physical 0x%lx\n", paddr);
+
+ if (do_bsys_getproplen(NULL, "acpi-root-tab") != sizeof (uint64_t))
+ bsetprop64("acpi-root-tab", paddr);
+
return (rsdp);
}
@@ -2346,13 +2374,12 @@ map_fw_table(paddr_t table_addr)
}
static ACPI_TABLE_HEADER *
-find_fw_table(char *signature)
+find_fw_table(ACPI_TABLE_RSDP *rsdp, char *signature)
{
static int revision = 0;
static ACPI_TABLE_XSDT *xsdt;
static int len;
paddr_t xsdt_addr;
- ACPI_TABLE_RSDP *rsdp;
ACPI_TABLE_HEADER *tp;
paddr_t table_addr;
int n;
@@ -2370,40 +2397,42 @@ find_fw_table(char *signature)
* revision 1 and use the RSDT.
*/
if (revision == 0) {
- if ((rsdp = find_rsdp()) != NULL) {
- revision = rsdp->Revision;
+ if (rsdp == NULL)
+ return (NULL);
+
+ revision = rsdp->Revision;
+ /*
+ * ACPI 6.0 states that current revision is 2
+ * from acpi_table_rsdp definition:
+ * Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+
+ */
+ if (revision > 2)
+ revision = 2;
+ switch (revision) {
+ case 2:
/*
- * ACPI 6.0 states that current revision is 2
- * from acpi_table_rsdp definition:
- * Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+
+ * Use the XSDT unless BIOS is buggy and
+ * claims to be rev 2 but has a null XSDT
+ * address
*/
- if (revision > 2)
- revision = 2;
- switch (revision) {
- case 2:
- /*
- * Use the XSDT unless BIOS is buggy and
- * claims to be rev 2 but has a null XSDT
- * address
- */
- xsdt_addr = rsdp->XsdtPhysicalAddress;
- if (xsdt_addr != 0)
- break;
- /* FALLTHROUGH */
- case 0:
- /* treat RSDP rev 0 as revision 1 internally */
- revision = 1;
- /* FALLTHROUGH */
- case 1:
- /* use the RSDT for rev 0/1 */
- xsdt_addr = rsdp->RsdtPhysicalAddress;
- break;
- default:
- /* unknown revision */
- revision = 0;
+ xsdt_addr = rsdp->XsdtPhysicalAddress;
+ if (xsdt_addr != 0)
break;
- }
+ /* FALLTHROUGH */
+ case 0:
+ /* treat RSDP rev 0 as revision 1 internally */
+ revision = 1;
+ /* FALLTHROUGH */
+ case 1:
+ /* use the RSDT for rev 0/1 */
+ xsdt_addr = rsdp->RsdtPhysicalAddress;
+ break;
+ default:
+ /* unknown revision */
+ revision = 0;
+ break;
}
+
if (revision == 0)
return (NULL);
@@ -2840,6 +2869,7 @@ static void
build_firmware_properties(struct xboot_info *xbp)
{
ACPI_TABLE_HEADER *tp = NULL;
+ ACPI_TABLE_RSDP *rsdp;
#ifndef __xpv
if (xbp->bi_uefi_arch == XBI_UEFI_ARCH_64) {
@@ -2856,36 +2886,33 @@ build_firmware_properties(struct xboot_info *xbp)
bop_printf(NULL, "32-bit UEFI detected.\n");
}
- if (xbp->bi_acpi_rsdp != NULL) {
- bsetprop64("acpi-root-tab",
- (uint64_t)(uintptr_t)xbp->bi_acpi_rsdp);
- }
-
if (xbp->bi_smbios != NULL) {
bsetprop64("smbios-address",
(uint64_t)(uintptr_t)xbp->bi_smbios);
}
- if ((tp = find_fw_table(ACPI_SIG_MSCT)) != NULL)
+ rsdp = find_rsdp(xbp);
+
+ if ((tp = find_fw_table(rsdp, ACPI_SIG_MSCT)) != NULL)
msct_ptr = process_msct((ACPI_TABLE_MSCT *)tp);
else
msct_ptr = NULL;
- if ((tp = find_fw_table(ACPI_SIG_MADT)) != NULL)
+ if ((tp = find_fw_table(rsdp, ACPI_SIG_MADT)) != NULL)
process_madt((ACPI_TABLE_MADT *)tp);
if ((srat_ptr = (ACPI_TABLE_SRAT *)
- find_fw_table(ACPI_SIG_SRAT)) != NULL)
+ find_fw_table(rsdp, ACPI_SIG_SRAT)) != NULL)
process_srat(srat_ptr);
- if (slit_ptr = (ACPI_TABLE_SLIT *)find_fw_table(ACPI_SIG_SLIT))
+ if (slit_ptr = (ACPI_TABLE_SLIT *)find_fw_table(rsdp, ACPI_SIG_SLIT))
process_slit(slit_ptr);
- tp = find_fw_table(ACPI_SIG_MCFG);
+ tp = find_fw_table(rsdp, ACPI_SIG_MCFG);
#else /* __xpv */
enumerate_xen_cpus();
if (DOMAIN_IS_INITDOMAIN(xen_info))
- tp = find_fw_table(ACPI_SIG_MCFG);
+ tp = find_fw_table(rsdp, ACPI_SIG_MCFG);
#endif /* __xpv */
if (tp != NULL)
process_mcfg((ACPI_TABLE_MCFG *)tp);
diff --git a/usr/src/uts/intel/sys/bootinfo.h b/usr/src/uts/intel/sys/bootinfo.h
index fcc1f8ec17..ae68cf6622 100644
--- a/usr/src/uts/intel/sys/bootinfo.h
+++ b/usr/src/uts/intel/sys/bootinfo.h
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright 2020 Joyent, Inc.
+ */
+
#ifndef _SYS_BOOTINFO_H
#define _SYS_BOOTINFO_H
@@ -118,6 +122,7 @@ struct xboot_info {
native_ptr_t bi_mb_info; /* multiboot 1 or 2 info */
int bi_mb_version; /* multiboot version */
native_ptr_t bi_acpi_rsdp;
+ native_ptr_t bi_acpi_rsdp_copy;
native_ptr_t bi_smbios;
native_ptr_t bi_uefi_systab;
uefi_arch_type_t bi_uefi_arch;