[Midnightbsd-cvs] src [11286] sync with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Jul 4 09:30:56 EDT 2018
Revision: 11286
http://svnweb.midnightbsd.org/src/?rev=11286
Author: laffer1
Date: 2018-07-04 09:30:55 -0400 (Wed, 04 Jul 2018)
Log Message:
-----------
sync with freebsd
Modified Paths:
--------------
trunk/usr.sbin/acpi/Makefile
trunk/usr.sbin/acpi/Makefile.inc
trunk/usr.sbin/acpi/acpiconf/Makefile
trunk/usr.sbin/acpi/acpiconf/acpiconf.8
trunk/usr.sbin/acpi/acpiconf/acpiconf.c
trunk/usr.sbin/acpi/acpidb/Makefile
trunk/usr.sbin/acpi/acpidb/acpidb.8
trunk/usr.sbin/acpi/acpidb/acpidb.c
trunk/usr.sbin/acpi/acpidump/Makefile
trunk/usr.sbin/acpi/acpidump/acpi.c
trunk/usr.sbin/acpi/acpidump/acpi_user.c
trunk/usr.sbin/acpi/acpidump/acpidump.8
trunk/usr.sbin/acpi/iasl/Makefile
Property Changed:
----------------
trunk/usr.sbin/acpi/Makefile.inc
trunk/usr.sbin/acpi/acpiconf/acpiconf.8
trunk/usr.sbin/acpi/acpidb/acpidb.8
trunk/usr.sbin/acpi/acpidump/acpidump.8
trunk/usr.sbin/acpi/iasl/iasl.8
Modified: trunk/usr.sbin/acpi/Makefile
===================================================================
--- trunk/usr.sbin/acpi/Makefile 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/Makefile 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,6 +1,7 @@
+# $MidnightBSD$
# Makefile for acpi tools
-# $Id: Makefile,v 1.2 2012-12-31 21:54:15 laffer1 Exp $
-# $MidnightBSD$
+# $Id: Makefile,v 1.1 2000/07/14 18:16:22 iwasaki Exp $
+# $FreeBSD: stable/10/usr.sbin/acpi/Makefile 118643 2003-08-08 03:20:59Z njl $
SUBDIR= acpiconf acpidb acpidump iasl
Modified: trunk/usr.sbin/acpi/Makefile.inc
===================================================================
--- trunk/usr.sbin/acpi/Makefile.inc 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/Makefile.inc 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,5 +1,6 @@
-# $Id: Makefile.inc,v 1.3 2012-12-31 21:54:15 laffer1 Exp $
# $MidnightBSD$
+# $Id: Makefile.inc,v 1.1 2000/07/14 18:16:22 iwasaki Exp $
+# $FreeBSD: stable/10/usr.sbin/acpi/Makefile.inc 231845 2012-02-16 23:05:09Z jkim $
ACPICA_DIR= ${.CURDIR}/../../../sys/contrib/dev/acpica
CFLAGS+= -I${.CURDIR}/../../../sys
@@ -8,17 +9,18 @@
.include "${.CURDIR}/../../Makefile.inc"
.endif
-.PATH: ${ACPICA_DIR} \
- ${ACPICA_DIR}/common \
- ${ACPICA_DIR}/compiler \
- ${ACPICA_DIR}/debugger \
- ${ACPICA_DIR}/disassembler \
- ${ACPICA_DIR}/dispatcher \
- ${ACPICA_DIR}/events \
- ${ACPICA_DIR}/executer \
- ${ACPICA_DIR}/hardware \
- ${ACPICA_DIR}/namespace \
- ${ACPICA_DIR}/parser \
- ${ACPICA_DIR}/resources \
- ${ACPICA_DIR}/tables \
- ${ACPICA_DIR}/utilities
+.PATH: ${ACPICA_DIR} \
+ ${ACPICA_DIR}/common \
+ ${ACPICA_DIR}/compiler \
+ ${ACPICA_DIR}/components/debugger \
+ ${ACPICA_DIR}/components/disassembler \
+ ${ACPICA_DIR}/components/dispatcher \
+ ${ACPICA_DIR}/components/events \
+ ${ACPICA_DIR}/components/executer \
+ ${ACPICA_DIR}/components/hardware \
+ ${ACPICA_DIR}/components/namespace \
+ ${ACPICA_DIR}/components/parser \
+ ${ACPICA_DIR}/components/resources \
+ ${ACPICA_DIR}/components/tables \
+ ${ACPICA_DIR}/components/utilities \
+ ${ACPICA_DIR}/os_specific/service_layers
Property changes on: trunk/usr.sbin/acpi/Makefile.inc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/acpi/acpiconf/Makefile
===================================================================
--- trunk/usr.sbin/acpi/acpiconf/Makefile 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpiconf/Makefile 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,7 +1,9 @@
-# $Id: Makefile,v 1.3 2012-12-31 21:54:15 laffer1 Exp $
# $MidnightBSD$
+# $Id: Makefile,v 1.2 2000/07/14 18:16:25 iwasaki Exp $
+# $FreeBSD: stable/10/usr.sbin/acpi/acpiconf/Makefile 281075 2015-04-04 10:17:51Z dim $
PROG= acpiconf
MAN= acpiconf.8
+WARNS?= 3
.include <bsd.prog.mk>
Modified: trunk/usr.sbin/acpi/acpiconf/acpiconf.8
===================================================================
--- trunk/usr.sbin/acpi/acpiconf/acpiconf.8 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpiconf/acpiconf.8 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,5 +1,6 @@
+.\" $MidnightBSD$
.\"-
-.\" Copyright (c) 2000 Dag-Erling Co\xEFdan Sm\xF8rgrav
+.\" Copyright (c) 2000 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -25,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/acpi/acpiconf/acpiconf.8 288237 2015-09-25 22:19:35Z jkim $
.\"
-.Dd August 16, 2004
+.Dd September 22, 2015
.Dt ACPICONF 8
.Os
.Sh NAME
@@ -37,6 +38,7 @@
.Nm
.Op Fl h
.Op Fl i Ar batt
+.Op Fl k Ar ack
.Op Fl s Ar type
.Sh DESCRIPTION
The
@@ -49,6 +51,9 @@
Displays a summary of available options.
.It Fl i Ar batt
Get design information about the specified battery.
+.It Fl k Ar ack
+Ack or abort a pending suspend request using the argument provided.
+.Sy Most users should not use this option directly.
.It Fl s Ar type
Enters the specified sleep mode.
Recognized types are
@@ -58,11 +63,9 @@
(not implemented on most systems but similar to S1),
.Cm 3
(the CPU context is lost and memory context is preserved),
+and
.Cm 4
-(the CPU context is lost and memory context is stored to disk)
-and
-.Cm 5
-(soft off).
+(the CPU context is lost and memory context is stored to disk).
Sleep states may also be given as S1, S2, etc.
The supported states depend on BIOS implementation, including ACPI
byte code (AML).
Property changes on: trunk/usr.sbin/acpi/acpiconf/acpiconf.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/acpi/acpiconf/acpiconf.c
===================================================================
--- trunk/usr.sbin/acpi/acpiconf/acpiconf.c 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpiconf/acpiconf.c 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 Mitsuru IWASAKI <iwasaki at FreeBSD.org>
* All rights reserved.
@@ -23,8 +24,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: acpiconf.c,v 1.2 2012-12-31 21:54:15 laffer1 Exp $
- * $MidnightBSD$
+ * $Id: acpiconf.c,v 1.5 2000/08/08 14:12:19 iwasaki Exp $
+ * $FreeBSD: stable/10/usr.sbin/acpi/acpiconf/acpiconf.c 281389 2015-04-11 01:17:19Z jkim $
*/
#include <sys/param.h>
@@ -136,16 +137,30 @@
if (ioctl(acpifd, ACPIIO_BATT_GET_BATTINFO, &battio) == -1)
err(EX_IOERR, "get battery user info (%d) failed", num);
if (battio.battinfo.state != ACPI_BATT_STAT_NOT_PRESENT) {
- printf("State:\t\t\t");
- if (battio.battinfo.state == 0)
- printf("high ");
- if (battio.battinfo.state & ACPI_BATT_STAT_CRITICAL)
- printf("critical ");
- if (battio.battinfo.state & ACPI_BATT_STAT_DISCHARG)
- printf("discharging ");
- if (battio.battinfo.state & ACPI_BATT_STAT_CHARGING)
- printf("charging ");
- printf("\n");
+ const char *state;
+ switch (battio.battinfo.state & ACPI_BATT_STAT_BST_MASK) {
+ case 0:
+ state = "high";
+ break;
+ case ACPI_BATT_STAT_DISCHARG:
+ state = "discharging";
+ break;
+ case ACPI_BATT_STAT_CHARGING:
+ state = "charging";
+ break;
+ case ACPI_BATT_STAT_CRITICAL:
+ state = "critical";
+ break;
+ case ACPI_BATT_STAT_DISCHARG | ACPI_BATT_STAT_CRITICAL:
+ state = "critical discharging";
+ break;
+ case ACPI_BATT_STAT_CHARGING | ACPI_BATT_STAT_CRITICAL:
+ state = "critical charging";
+ break;
+ default:
+ state = "invalid";
+ }
+ printf("State:\t\t\t%s\n", state);
if (battio.battinfo.cap == -1)
printf("Remaining capacity:\tunknown\n");
else
Modified: trunk/usr.sbin/acpi/acpidb/Makefile
===================================================================
--- trunk/usr.sbin/acpi/acpidb/Makefile 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidb/Makefile 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,66 +1,79 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/acpi/acpidb/Makefile 306536 2016-09-30 22:40:58Z jkim $
PROG= acpidb
SRCS= acpidb.c
-SRCS+= osunixxf.c
-# debugger
-SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c \
- dbinput.c dbmethod.c dbnames.c dbstats.c dbutils.c \
- dbxface.c
+# common
+SRCS+= acfileio.c acgetline.c ahids.c ahuuids.c cmfsize.c
-# disassembler
-SRCS+= dmbuffer.c dmnames.c dmobject.c dmopcode.c dmresrc.c \
- dmresrcl.c dmresrcs.c dmutils.c dmwalk.c
+# components/debugger
+SRCS+= dbcmds.c dbconvert.c dbdisply.c dbexec.c dbfileio.c \
+ dbhistry.c dbinput.c dbmethod.c dbnames.c dbobject.c \
+ dbstats.c dbtest.c dbutils.c dbxface.c
-# events
+# components/disassembler
+SRCS+= dmbuffer.c dmcstyle.c dmdeferred.c dmnames.c dmopcode.c \
+ dmresrc.c dmresrcl.c dmresrcl2.c dmresrcs.c dmutils.c \
+ dmwalk.c
+
+# components/dispatcher
+SRCS+= dsargs.c dscontrol.c dsdebug.c dsfield.c dsinit.c \
+ dsmethod.c dsmthdat.c dsobject.c dsopcode.c dsutils.c \
+ dswexec.c dswload.c dswload2.c dswscope.c dswstate.c
+
+# components/events
SRCS+= evevent.c evglock.c evgpe.c evgpeblk.c evgpeinit.c \
- evgpeutil.c evmisc.c evregion.c evrgnini.c evsci.c \
- evxface.c evxfevnt.c evxfgpe.c evxfregn.c
+ evgpeutil.c evhandler.c evmisc.c evregion.c evrgnini.c \
+ evsci.c evxface.c evxfevnt.c evxfregn.c
-# hardware
-SRCS+= hwacpi.c hwgpe.c hwpci.c hwregs.c hwsleep.c hwvalid.c \
- hwxface.c
+# components/executer
+SRCS+= exconcat.c exconfig.c exconvrt.c excreate.c exdebug.c \
+ exdump.c exfield.c exfldio.c exmisc.c exmutex.c \
+ exnames.c exoparg1.c exoparg2.c exoparg3.c exoparg6.c \
+ exprep.c exregion.c exresnte.c exresolv.c exresop.c \
+ exstore.c exstoren.c exstorob.c exsystem.c extrace.c \
+ exutils.c
-# interpreter/dispatcher
-SRCS+= dsargs.c dscontrol.c dsfield.c dsinit.c dsmethod.c \
- dsmthdat.c dsobject.c dsopcode.c dsutils.c dswexec.c \
- dswload.c dswload2.c dswscope.c dswstate.c
+# components/hardware
+SRCS+= hwacpi.c hwesleep.c hwgpe.c hwpci.c hwregs.c hwsleep.c \
+ hwvalid.c hwxface.c hwxfsleep.c
-# interpreter/executer
-SRCS+= exconfig.c exconvrt.c excreate.c exdebug.c exdump.c \
- exfield.c exfldio.c exmisc.c exmutex.c exnames.c \
- exoparg1.c exoparg2.c exoparg3.c exoparg6.c exprep.c \
- exregion.c exresnte.c exresolv.c exresop.c exstore.c \
- exstoren.c exstorob.c exsystem.c exutils.c
+# components/namespace
+SRCS+= nsaccess.c nsalloc.c nsarguments.c nsconvert.c nsdump.c \
+ nseval.c nsinit.c nsload.c nsnames.c nsobject.c \
+ nsparse.c nspredef.c nsprepkg.c nsrepair.c nsrepair2.c \
+ nssearch.c nsutils.c nswalk.c nsxfeval.c nsxfname.c \
+ nsxfobj.c
-# interpreter/parser
-SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c \
- pstree.c psutils.c pswalk.c psxface.c
+# components/parser
+SRCS+= psargs.c psloop.c psobject.c psopcode.c psopinfo.c \
+ psparse.c psscope.c pstree.c psutils.c pswalk.c \
+ psxface.c
-# namespace
-SRCS+= nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c \
- nsload.c nsnames.c nsobject.c nsparse.c nspredef.c \
- nsrepair.c nsrepair2.c nssearch.c nsutils.c nswalk.c \
- nsxfeval.c nsxfname.c nsxfobj.c
+# components/resources
+SRCS+= rsaddr.c rscalc.c rscreate.c rsdump.c rsdumpinfo.c \
+ rsinfo.c rsio.c rsirq.c rslist.c rsmemory.c rsmisc.c \
+ rsserial.c rsutils.c rsxface.c
-# resources
-SRCS+= rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c \
- rsio.c rsirq.c rslist.c rsmemory.c rsmisc.c \
- rsutils.c rsxface.c
+# components/tables
+SRCS+= tbdata.c tbfadt.c tbfind.c tbinstal.c tbprint.c \
+ tbutils.c tbxface.c tbxfload.c
-# tables
-SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c \
- tbxfroot.c
+# components/utilities
+SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \
+ utcopy.c utdebug.c utdecode.c utdelete.c uterror.c \
+ uteval.c utexcep.c utglobal.c uthex.c utids.c utinit.c \
+ utlock.c utmath.c utmisc.c utmutex.c utnonansi.c \
+ utobject.c utosi.c utownerid.c utpredef.c utprint.c \
+ utresrc.c utstate.c utstring.c uttrack.c utuuid.c \
+ utxface.c utxferror.c utxfinit.c
-# utilities
-SRCS+= utalloc.c utcache.c utcopy.c utdebug.c utdecode.c \
- utdelete.c uteval.c utglobal.c utids.c utinit.c \
- utlock.c utmath.c utmisc.c utmutex.c utobject.c utosi.c \
- utresrc.c utstate.c uttrack.c utxface.c utxferror.c
+# os_specific/service_layers
+SRCS+= oslibcfs.c osunixxf.c
MAN= acpidb.8
-WARNS?= 2
+WARNS?= 3
CFLAGS+= -DACPI_EXEC_APP -fno-strict-aliasing
DPADD= ${LIBPTHREAD}
Modified: trunk/usr.sbin/acpi/acpidb/acpidb.8
===================================================================
--- trunk/usr.sbin/acpi/acpidb/acpidb.8 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidb/acpidb.8 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\"-
.\" Copyright (c) 2003 Nate Lawson
.\" All rights reserved.
@@ -25,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/acpi/acpidb/acpidb.8 130159 2004-06-06 17:49:57Z ru $
.\"
.Dd August 7, 2003
.Dt ACPIDB 8
Property changes on: trunk/usr.sbin/acpi/acpidb/acpidb.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/acpi/acpidb/acpidb.c
===================================================================
--- trunk/usr.sbin/acpi/acpidb/acpidb.c 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidb/acpidb.c 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2002 Mitsuru IWASAKI <iwasaki at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/acpi/acpidb/acpidb.c 306536 2016-09-30 22:40:58Z jkim $
*/
#include <sys/param.h>
@@ -43,13 +44,16 @@
#include <unistd.h>
#include <contrib/dev/acpica/include/acpi.h>
-#include <contrib/dev/acpica/tools/acpiexec/aecommon.h>
+#include <contrib/dev/acpica/include/accommon.h>
+#include <contrib/dev/acpica/include/acapps.h>
+#include <contrib/dev/acpica/include/acdebug.h>
+#include <contrib/dev/acpica/include/amlresrc.h>
/*
* Dummy DSDT Table Header
*/
-ACPI_TABLE_HEADER dummy_dsdt_table = {
+static ACPI_TABLE_HEADER dummy_dsdt_table = {
"DSDT", 123, 1, 123, "OEMID", "OEMTBLID", 1, "CRID", 1
};
@@ -57,7 +61,7 @@
* Region space I/O routines on virtual machine
*/
-int aml_debug_prompt = 1;
+static int aml_debug_prompt = 1;
struct ACPIRegionContent {
TAILQ_ENTRY(ACPIRegionContent) links;
@@ -67,10 +71,14 @@
};
TAILQ_HEAD(ACPIRegionContentList, ACPIRegionContent);
-struct ACPIRegionContentList RegionContentList;
+static struct ACPIRegionContentList RegionContentList;
static int aml_simulation_initialized = 0;
+ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer(void);
+void AeDoObjectOverrides(void);
+void AeTableOverride(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER **);
+
static void aml_simulation_init(void);
static int aml_simulate_regcontent_add(int regtype,
ACPI_PHYSICAL_ADDRESS addr,
@@ -85,19 +93,36 @@
static void aml_simulation_regload(const char *dumpfile);
static void aml_simulation_regdump(const char *dumpfile);
-/* Stubs to simplify linkage to the ACPI CA core subsystem. */
-ACPI_STATUS
-AeLocalGetRootPointer(void)
+/* Stubs to simplify linkage to the ACPICA core subsystem. */
+ACPI_PHYSICAL_ADDRESS
+AcpiOsGetRootPointer(void)
{
- return (AE_ERROR);
+ return (0);
}
void
+AeDoObjectOverrides(void)
+{
+}
+
+void
AeTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable)
{
}
+void
+MpSaveGpioInfo(ACPI_PARSE_OBJECT *Op, AML_RESOURCE *Resource,
+ UINT32 PinCount, UINT16 *PinList, char *DeviceName)
+{
+}
+
+void
+MpSaveSerialInfo(ACPI_PARSE_OBJECT *Op, AML_RESOURCE *Resource,
+ char *DeviceName)
+{
+}
+
static void
aml_simulation_init(void)
{
@@ -172,8 +197,8 @@
if (msg != NULL) {
printf("%s", msg);
}
- printf("(default: 0x%jx ", val);
- printf(" / %ju) >>", val);
+ printf("(default: 0x%jx ", (uintmax_t)val);
+ printf(" / %ju) >>", (uintmax_t)val);
fflush(stdout);
bzero(buf, sizeof buf);
@@ -358,10 +383,10 @@
load_dsdt(const char *dsdtfile)
{
char filetmp[PATH_MAX];
+ ACPI_NEW_TABLE_DESC *list;
u_int8_t *code;
struct stat sb;
- int fd, fd2;
- int error;
+ int dounlink, error, fd;
fd = open(dsdtfile, O_RDONLY, 0);
if (fd == -1) {
@@ -370,14 +395,17 @@
}
if (fstat(fd, &sb) == -1) {
perror("fstat");
+ close(fd);
return (-1);
}
code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0);
+ close(fd);
if (code == NULL) {
perror("mmap");
return (-1);
}
if ((error = AcpiInitializeSubsystem()) != AE_OK) {
+ munmap(code, (size_t)sb.st_size);
return (-1);
}
@@ -385,21 +413,30 @@
* make sure DSDT data contains table header or not.
*/
if (strncmp((char *)code, "DSDT", 4) == 0) {
- strncpy(filetmp, dsdtfile, sizeof(filetmp));
+ dounlink = 0;
+ strlcpy(filetmp, dsdtfile, sizeof(filetmp));
} else {
+ dounlink = 1;
mode_t mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
dummy_dsdt_table.Length = sizeof(ACPI_TABLE_HEADER) + sb.st_size;
- snprintf(filetmp, sizeof(filetmp), "%s.tmp", dsdtfile);
- fd2 = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
- if (fd2 == -1) {
+ if ((size_t)snprintf(filetmp, sizeof(filetmp), "%s.tmp",
+ dsdtfile) > sizeof(filetmp) - 1) {
+ fprintf(stderr, "file name too long\n");
+ munmap(code, (size_t)sb.st_size);
+ return (-1);
+ }
+ fd = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ if (fd == -1) {
perror("open");
+ munmap(code, (size_t)sb.st_size);
return (-1);
}
- write(fd2, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
+ write(fd, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
- write(fd2, code, sb.st_size);
- close(fd2);
+ write(fd, code, sb.st_size);
+ close(fd);
}
+ munmap(code, (size_t)sb.st_size);
/*
* Install the virtual machine version of address space handlers.
@@ -454,13 +491,14 @@
return (-1);
}
- AcpiDbGetTableFromFile(filetmp, NULL);
+ list = NULL;
+ AcGetAllTablesFromFile(filetmp, TRUE, &list);
- AcpiDbInitialize();
+ AcpiInitializeDebugger();
AcpiGbl_DebuggerConfiguration = 0;
AcpiDbUserCommands(':', NULL);
- if (strcmp(dsdtfile, filetmp) != 0) {
+ if (dounlink) {
unlink(filetmp);
}
Modified: trunk/usr.sbin/acpi/acpidump/Makefile
===================================================================
--- trunk/usr.sbin/acpi/acpidump/Makefile 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidump/Makefile 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,7 +1,9 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/acpi/acpidump/Makefile 281075 2015-04-04 10:17:51Z dim $
PROG= acpidump
MAN= acpidump.8
SRCS= acpi.c acpi_user.c acpidump.c
+WARNS?= 3
.include <bsd.prog.mk>
Modified: trunk/usr.sbin/acpi/acpidump/acpi.c
===================================================================
--- trunk/usr.sbin/acpi/acpidump/acpi.c 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidump/acpi.c 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 Doug Rabson
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki at FreeBSD.org>
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/acpi/acpidump/acpi.c 301141 2016-06-01 17:13:43Z truckman $
*/
#include <sys/param.h>
@@ -123,7 +124,32 @@
"Table of Devices",
};
+#define PRINTFLAG_END() printflag_end()
+
+static char pf_sep = '{';
+
static void
+printflag_end(void)
+{
+
+ if (pf_sep != '{') {
+ printf("}");
+ pf_sep = '{';
+ }
+ printf("\n");
+}
+
+static void
+printflag(uint64_t var, uint64_t mask, const char *name)
+{
+
+ if (var & mask) {
+ printf("%c%s", pf_sep, name);
+ pf_sep = ',';
+ }
+}
+
+static void
acpi_print_string(char *s, size_t length)
{
int c;
@@ -143,12 +169,18 @@
{
switch(gas->SpaceId) {
case ACPI_GAS_MEMORY:
- printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
- gas->BitOffset, gas->BitWidth);
+ if (gas->BitWidth <= 32)
+ printf("0x%08x:%u[%u] (Memory)",
+ (u_int)gas->Address, gas->BitOffset,
+ gas->BitWidth);
+ else
+ printf("0x%016jx:%u[%u] (Memory)",
+ (uintmax_t)gas->Address, gas->BitOffset,
+ gas->BitWidth);
break;
case ACPI_GAS_IO:
- printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
- gas->BitOffset, gas->BitWidth);
+ printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address,
+ gas->BitOffset, gas->BitWidth);
break;
case ACPI_GAS_PCI:
printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
@@ -169,7 +201,7 @@
case ACPI_GAS_DATATABLE:
case ACPI_GAS_FIXED:
default:
- printf("0x%08lx (?)", (u_long)gas->Address);
+ printf("0x%016jx (?)", (uintmax_t)gas->Address);
break;
}
}
@@ -340,12 +372,13 @@
acpi_print_mps_flags(mps_flags);
}
-const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override", "NMI",
- "Local APIC NMI", "Local APIC Override",
- "IO SAPIC", "Local SAPIC", "Platform Interrupt",
- "Local X2APIC", "Local X2APIC NMI" };
-const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT",
- "Corrected Platform Error" };
+static const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override",
+ "NMI", "Local APIC NMI",
+ "Local APIC Override", "IO SAPIC",
+ "Local SAPIC", "Platform Interrupt",
+ "Local X2APIC", "Local X2APIC NMI" };
+static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT",
+ "Corrected Platform Error" };
static void
acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
@@ -511,7 +544,7 @@
alloc = (ACPI_MCFG_ALLOCATION *)(mcfg + 1);
for (i = 0; i < entries; i++, alloc++) {
printf("\n");
- printf("\tBase Address=0x%016jx\n", alloc->Address);
+ printf("\tBase Address=0x%016jx\n", (uintmax_t)alloc->Address);
printf("\tSegment Group=0x%04x\n", alloc->PciSegment);
printf("\tStart Bus=%d\n", alloc->StartBusNumber);
printf("\tEnd Bus=%d\n", alloc->EndBusNumber);
@@ -528,16 +561,16 @@
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);
slit = (ACPI_TABLE_SLIT *)sdp;
- printf("\tLocality Count=%jd\n", slit->LocalityCount);
+ printf("\tLocality Count=%ju\n", (uintmax_t)slit->LocalityCount);
printf("\n\t ");
for (i = 0; i < slit->LocalityCount; i++)
- printf(" %3jd", i);
+ printf(" %3ju", (uintmax_t)i);
printf("\n\t +");
for (i = 0; i < slit->LocalityCount; i++)
printf("----");
printf("\n");
for (i = 0; i < slit->LocalityCount; i++) {
- printf("\t %3jd |", i);
+ printf("\t %3ju |", (uintmax_t)i);
for (j = 0; j < slit->LocalityCount; j++)
printf(" %3d",
slit->Entry[i * slit->LocalityCount + j]);
@@ -682,16 +715,24 @@
printf(END_COMMENT);
return;
}
+ if(sdp->Revision == 1){
+ printf("\tOLD TCPA spec log found. Dumping not supported.\n");
+ printf(END_COMMENT);
+ return;
+ }
vaddr = (unsigned char *)acpi_map_physical(paddr, len);
vend = vaddr + len;
while (vaddr != NULL) {
- if (vaddr + sizeof(struct TCPAevent) >= vend)
+ if ((vaddr + sizeof(struct TCPAevent) >= vend)||
+ (vaddr + sizeof(struct TCPAevent) < vaddr))
break;
event = (struct TCPAevent *)(void *)vaddr;
if (vaddr + event->event_size >= vend)
break;
+ if (vaddr + event->event_size < vaddr)
+ break;
if (event->event_type == 0 && event->event_size == 0)
break;
#if 0
@@ -720,7 +761,239 @@
printf(END_COMMENT);
}
+static const char *
+devscope_type2str(int type)
+{
+ static char typebuf[16];
+
+ switch (type) {
+ case 1:
+ return ("PCI Endpoint Device");
+ case 2:
+ return ("PCI Sub-Hierarchy");
+ case 3:
+ return ("IOAPIC");
+ case 4:
+ return ("HPET");
+ default:
+ snprintf(typebuf, sizeof(typebuf), "%d", type);
+ return (typebuf);
+ }
+}
+
+static int
+acpi_handle_dmar_devscope(void *addr, int remaining)
+{
+ char sep;
+ int pathlen;
+ ACPI_DMAR_PCI_PATH *path, *pathend;
+ ACPI_DMAR_DEVICE_SCOPE *devscope = addr;
+
+ if (remaining < (int)sizeof(ACPI_DMAR_DEVICE_SCOPE))
+ return (-1);
+
+ if (remaining < devscope->Length)
+ return (-1);
+
+ printf("\n");
+ printf("\t\tType=%s\n", devscope_type2str(devscope->EntryType));
+ printf("\t\tLength=%d\n", devscope->Length);
+ printf("\t\tEnumerationId=%d\n", devscope->EnumerationId);
+ printf("\t\tStartBusNumber=%d\n", devscope->Bus);
+
+ path = (ACPI_DMAR_PCI_PATH *)(devscope + 1);
+ pathlen = devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE);
+ pathend = path + pathlen / sizeof(ACPI_DMAR_PCI_PATH);
+ if (path < pathend) {
+ sep = '{';
+ printf("\t\tPath=");
+ do {
+ printf("%c%d:%d", sep, path->Device, path->Function);
+ sep=',';
+ path++;
+ } while (path < pathend);
+ printf("}\n");
+ }
+
+ return (devscope->Length);
+}
+
static void
+acpi_handle_dmar_drhd(ACPI_DMAR_HARDWARE_UNIT *drhd)
+{
+ char *cp;
+ int remaining, consumed;
+
+ printf("\n");
+ printf("\tType=DRHD\n");
+ printf("\tLength=%d\n", drhd->Header.Length);
+
+#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag)
+
+ printf("\tFlags=");
+ PRINTFLAG(drhd->Flags, INCLUDE_ALL);
+ PRINTFLAG_END();
+
+#undef PRINTFLAG
+
+ printf("\tSegment=%d\n", drhd->Segment);
+ printf("\tAddress=0x%016jx\n", (uintmax_t)drhd->Address);
+
+ remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT);
+ if (remaining > 0)
+ printf("\tDevice Scope:");
+ while (remaining > 0) {
+ cp = (char *)drhd + drhd->Header.Length - remaining;
+ consumed = acpi_handle_dmar_devscope(cp, remaining);
+ if (consumed <= 0)
+ break;
+ else
+ remaining -= consumed;
+ }
+}
+
+static void
+acpi_handle_dmar_rmrr(ACPI_DMAR_RESERVED_MEMORY *rmrr)
+{
+ char *cp;
+ int remaining, consumed;
+
+ printf("\n");
+ printf("\tType=RMRR\n");
+ printf("\tLength=%d\n", rmrr->Header.Length);
+ printf("\tSegment=%d\n", rmrr->Segment);
+ printf("\tBaseAddress=0x%016jx\n", (uintmax_t)rmrr->BaseAddress);
+ printf("\tLimitAddress=0x%016jx\n", (uintmax_t)rmrr->EndAddress);
+
+ remaining = rmrr->Header.Length - sizeof(ACPI_DMAR_RESERVED_MEMORY);
+ if (remaining > 0)
+ printf("\tDevice Scope:");
+ while (remaining > 0) {
+ cp = (char *)rmrr + rmrr->Header.Length - remaining;
+ consumed = acpi_handle_dmar_devscope(cp, remaining);
+ if (consumed <= 0)
+ break;
+ else
+ remaining -= consumed;
+ }
+}
+
+static void
+acpi_handle_dmar_atsr(ACPI_DMAR_ATSR *atsr)
+{
+ char *cp;
+ int remaining, consumed;
+
+ printf("\n");
+ printf("\tType=ATSR\n");
+ printf("\tLength=%d\n", atsr->Header.Length);
+
+#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag)
+
+ printf("\tFlags=");
+ PRINTFLAG(atsr->Flags, ALL_PORTS);
+ PRINTFLAG_END();
+
+#undef PRINTFLAG
+
+ printf("\tSegment=%d\n", atsr->Segment);
+
+ remaining = atsr->Header.Length - sizeof(ACPI_DMAR_ATSR);
+ if (remaining > 0)
+ printf("\tDevice Scope:");
+ while (remaining > 0) {
+ cp = (char *)atsr + atsr->Header.Length - remaining;
+ consumed = acpi_handle_dmar_devscope(cp, remaining);
+ if (consumed <= 0)
+ break;
+ else
+ remaining -= consumed;
+ }
+}
+
+static void
+acpi_handle_dmar_rhsa(ACPI_DMAR_RHSA *rhsa)
+{
+
+ printf("\n");
+ printf("\tType=RHSA\n");
+ printf("\tLength=%d\n", rhsa->Header.Length);
+ printf("\tBaseAddress=0x%016jx\n", (uintmax_t)rhsa->BaseAddress);
+ printf("\tProximityDomain=0x%08x\n", rhsa->ProximityDomain);
+}
+
+static int
+acpi_handle_dmar_remapping_structure(void *addr, int remaining)
+{
+ ACPI_DMAR_HEADER *hdr = addr;
+
+ if (remaining < (int)sizeof(ACPI_DMAR_HEADER))
+ return (-1);
+
+ if (remaining < hdr->Length)
+ return (-1);
+
+ switch (hdr->Type) {
+ case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ acpi_handle_dmar_drhd(addr);
+ break;
+ case ACPI_DMAR_TYPE_RESERVED_MEMORY:
+ acpi_handle_dmar_rmrr(addr);
+ break;
+ case ACPI_DMAR_TYPE_ROOT_ATS:
+ acpi_handle_dmar_atsr(addr);
+ break;
+ case ACPI_DMAR_TYPE_HARDWARE_AFFINITY:
+ acpi_handle_dmar_rhsa(addr);
+ break;
+ default:
+ printf("\n");
+ printf("\tType=%d\n", hdr->Type);
+ printf("\tLength=%d\n", hdr->Length);
+ break;
+ }
+ return (hdr->Length);
+}
+
+#ifndef ACPI_DMAR_X2APIC_OPT_OUT
+#define ACPI_DMAR_X2APIC_OPT_OUT (0x2)
+#endif
+
+static void
+acpi_handle_dmar(ACPI_TABLE_HEADER *sdp)
+{
+ char *cp;
+ int remaining, consumed;
+ ACPI_TABLE_DMAR *dmar;
+
+ printf(BEGIN_COMMENT);
+ acpi_print_sdt(sdp);
+ dmar = (ACPI_TABLE_DMAR *)sdp;
+ printf("\tHost Address Width=%d\n", dmar->Width + 1);
+
+#define PRINTFLAG(var, flag) printflag((var), ACPI_DMAR_## flag, #flag)
+
+ printf("\tFlags=");
+ PRINTFLAG(dmar->Flags, INTR_REMAP);
+ PRINTFLAG(dmar->Flags, X2APIC_OPT_OUT);
+ PRINTFLAG_END();
+
+#undef PRINTFLAG
+
+ remaining = sdp->Length - sizeof(ACPI_TABLE_DMAR);
+ while (remaining > 0) {
+ cp = (char *)sdp + sdp->Length - remaining;
+ consumed = acpi_handle_dmar_remapping_structure(cp, remaining);
+ if (consumed <= 0)
+ break;
+ else
+ remaining -= consumed;
+ }
+
+ printf(END_COMMENT);
+}
+
+static void
acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp)
{
@@ -739,7 +1012,7 @@
printf("\tProximity Domain=%d\n", mp->ProximityDomain);
}
-const char *srat_types[] = { "CPU", "Memory", "X2APIC" };
+static const char *srat_types[] = { "CPU", "Memory", "X2APIC" };
static void
acpi_print_srat(ACPI_SUBTABLE_HEADER *srat)
@@ -807,7 +1080,6 @@
ACPI_TABLE_RSDT *rsdt;
ACPI_TABLE_XSDT *xsdt;
int i, entries;
- u_long addr;
rsdt = (ACPI_TABLE_RSDT *)rsdp;
xsdt = (ACPI_TABLE_XSDT *)rsdp;
@@ -818,18 +1090,11 @@
for (i = 0; i < entries; i++) {
if (i > 0)
printf(", ");
- switch (addr_size) {
- case 4:
- addr = le32toh(rsdt->TableOffsetEntry[i]);
- break;
- case 8:
- addr = le64toh(xsdt->TableOffsetEntry[i]);
- break;
- default:
- addr = 0;
- }
- assert(addr != 0);
- printf("0x%08lx", addr);
+ if (addr_size == 4)
+ printf("0x%08x", le32toh(rsdt->TableOffsetEntry[i]));
+ else
+ printf("0x%016jx",
+ (uintmax_t)le64toh(xsdt->TableOffsetEntry[i]));
}
printf(" }\n");
printf(END_COMMENT);
@@ -845,7 +1110,6 @@
{
ACPI_TABLE_FADT *fadt;
const char *pm;
- char sep;
fadt = (ACPI_TABLE_FADT *)sdp;
printf(BEGIN_COMMENT);
@@ -905,25 +1169,17 @@
printf("\tDAY_ALRM=%d, MON_ALRM=%d, CENTURY=%d\n",
fadt->DayAlarm, fadt->MonthAlarm, fadt->Century);
-#define PRINTFLAG(var, flag) do { \
- if ((var) & ACPI_FADT_## flag) { \
- printf("%c%s", sep, #flag); sep = ','; \
- } \
-} while (0)
+#define PRINTFLAG(var, flag) printflag((var), ACPI_FADT_## flag, #flag)
printf("\tIAPC_BOOT_ARCH=");
- sep = '{';
PRINTFLAG(fadt->BootFlags, LEGACY_DEVICES);
PRINTFLAG(fadt->BootFlags, 8042);
PRINTFLAG(fadt->BootFlags, NO_VGA);
PRINTFLAG(fadt->BootFlags, NO_MSI);
PRINTFLAG(fadt->BootFlags, NO_ASPM);
- if (fadt->BootFlags != 0)
- printf("}");
- printf("\n");
+ PRINTFLAG_END();
printf("\tFlags=");
- sep = '{';
PRINTFLAG(fadt->Flags, WBINVD);
PRINTFLAG(fadt->Flags, WBINVD_FLUSH);
PRINTFLAG(fadt->Flags, C1_SUPPORTED);
@@ -944,8 +1200,7 @@
PRINTFLAG(fadt->Flags, REMOTE_POWER_ON);
PRINTFLAG(fadt->Flags, APIC_CLUSTER);
PRINTFLAG(fadt->Flags, APIC_PHYSICAL);
- if (fadt->Flags != 0)
- printf("}\n");
+ PRINTFLAG_END();
#undef PRINTFLAG
@@ -955,8 +1210,8 @@
printf(", RESET_VALUE=%#x\n", fadt->ResetValue);
}
if (acpi_get_fadt_revision(fadt) > 1) {
- printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs);
- printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt);
+ printf("\tX_FACS=0x%016jx, ", (uintmax_t)fadt->XFacs);
+ printf("X_DSDT=0x%016jx\n", (uintmax_t)fadt->XDsdt);
printf("\tX_PM1a_EVT_BLK=");
acpi_print_gas(&fadt->XPm1aEventBlock);
if (fadt->XPm1bEventBlock.Address != 0) {
@@ -1011,10 +1266,9 @@
printf("S4BIOS");
printf("\n");
- if (facs->XFirmwareWakingVector != 0) {
- printf("\tX_Firm_Wake_Vec=%08lx\n",
- (u_long)facs->XFirmwareWakingVector);
- }
+ if (facs->XFirmwareWakingVector != 0)
+ printf("\tX_Firm_Wake_Vec=%016jx\n",
+ (uintmax_t)facs->XFirmwareWakingVector);
printf("\tVersion=%u\n", facs->Version);
printf(END_COMMENT);
@@ -1064,8 +1318,8 @@
printf("\tRSDT=0x%08x, cksum=%u\n", rp->RsdtPhysicalAddress,
rp->Checksum);
} else {
- printf("\tXSDT=0x%08lx, length=%u, cksum=%u\n",
- (u_long)rp->XsdtPhysicalAddress, rp->Length,
+ printf("\tXSDT=0x%016jx, length=%u, cksum=%u\n",
+ (uintmax_t)rp->XsdtPhysicalAddress, rp->Length,
rp->ExtendedChecksum);
}
printf(END_COMMENT);
@@ -1085,17 +1339,12 @@
xsdt = (ACPI_TABLE_XSDT *)rsdp;
entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size;
for (i = 0; i < entries; i++) {
- switch (addr_size) {
- case 4:
+ if (addr_size == 4)
addr = le32toh(rsdt->TableOffsetEntry[i]);
- break;
- case 8:
+ else
addr = le64toh(xsdt->TableOffsetEntry[i]);
- break;
- default:
- assert((addr = 0));
- }
-
+ if (addr == 0)
+ continue;
sdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr);
if (acpi_checksum(sdp, sdp->Length)) {
warnx("RSDT entry %d (sig %.4s) is corrupt", i,
@@ -1118,6 +1367,8 @@
acpi_handle_srat(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_TCPA, 4))
acpi_handle_tcpa(sdp);
+ else if (!memcmp(sdp->Signature, ACPI_SIG_DMAR, 4))
+ acpi_handle_dmar(sdp);
else {
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);
@@ -1215,27 +1466,34 @@
void
aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
{
- char buf[PATH_MAX], tmpstr[PATH_MAX];
+ char buf[PATH_MAX], tmpstr[PATH_MAX], wrkdir[PATH_MAX];
+ const char *iname = "/acpdump.din";
+ const char *oname = "/acpdump.dsl";
const char *tmpdir;
- char *tmpext;
FILE *fp;
size_t len;
- int fd;
+ int fd, status;
+ pid_t pid;
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
tmpdir = _PATH_TMP;
- strncpy(tmpstr, tmpdir, sizeof(tmpstr));
- if (realpath(tmpstr, buf) == NULL) {
+ if (realpath(tmpdir, buf) == NULL) {
perror("realpath tmp dir");
return;
}
- strncpy(tmpstr, buf, sizeof(tmpstr));
- strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf));
- len = strlen(tmpstr);
- tmpext = tmpstr + len;
- strncpy(tmpext, "XXXXXX", sizeof(tmpstr) - len);
- fd = mkstemp(tmpstr);
+ len = sizeof(wrkdir) - strlen(iname);
+ if ((size_t)snprintf(wrkdir, len, "%s/acpidump.XXXXXX", buf) > len-1 ) {
+ fprintf(stderr, "$TMPDIR too long\n");
+ return;
+ }
+ if (mkdtemp(wrkdir) == NULL) {
+ perror("mkdtemp tmp working dir");
+ return;
+ }
+ assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname)
+ <= sizeof(tmpstr) - 1);
+ fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd < 0) {
perror("iasl tmp file");
return;
@@ -1244,7 +1502,7 @@
close(fd);
/* Run iasl -d on the temp file */
- if (fork() == 0) {
+ if ((pid = fork()) == 0) {
close(STDOUT_FILENO);
if (vflag == 0)
close(STDERR_FILENO);
@@ -1251,21 +1509,39 @@
execl("/usr/sbin/iasl", "iasl", "-d", tmpstr, NULL);
err(1, "exec");
}
+ if (pid > 0)
+ wait(&status);
+ if (unlink(tmpstr) < 0) {
+ perror("unlink");
+ goto out;
+ }
+ if (pid < 0) {
+ perror("fork");
+ goto out;
+ }
+ if (status != 0) {
+ fprintf(stderr, "iast exit status = %d\n", status);
+ }
- wait(NULL);
- unlink(tmpstr);
-
/* Dump iasl's output to stdout */
- strncpy(tmpext, "dsl", sizeof(tmpstr) - len);
+ assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname)
+ <= sizeof(tmpstr) -1);
fp = fopen(tmpstr, "r");
- unlink(tmpstr);
+ if (unlink(tmpstr) < 0) {
+ perror("unlink");
+ goto out;
+ }
if (fp == NULL) {
perror("iasl tmp file (read)");
- return;
+ goto out;
}
while ((len = fread(buf, 1, sizeof(buf), fp)) > 0)
fwrite(buf, 1, len, stdout);
fclose(fp);
+
+ out:
+ if (rmdir(wrkdir) < 0)
+ perror("rmdir");
}
void
@@ -1288,16 +1564,12 @@
xsdt = (ACPI_TABLE_XSDT *)rsdp;
entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size;
for (i = 0; i < entries; i++) {
- switch (addr_size) {
- case 4:
+ if (addr_size == 4)
addr = le32toh(rsdt->TableOffsetEntry[i]);
- break;
- case 8:
+ else
addr = le64toh(xsdt->TableOffsetEntry[i]);
- break;
- default:
- assert((addr = 0));
- }
+ if (addr == 0)
+ continue;
sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr);
if (last != NULL) {
if (sdt == last)
Modified: trunk/usr.sbin/acpi/acpidump/acpi_user.c
===================================================================
--- trunk/usr.sbin/acpi/acpidump/acpi_user.c 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidump/acpi_user.c 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 Doug Rabson
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki at FreeBSD.org>
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/acpi/acpidump/acpi_user.c 251186 2013-05-31 17:23:38Z jkim $
*/
#include <sys/param.h>
@@ -53,7 +54,7 @@
size_t size;
};
-LIST_HEAD(acpi_user_mapping_list, acpi_user_mapping) maplist;
+static LIST_HEAD(acpi_user_mapping_list, acpi_user_mapping) maplist;
static void
acpi_user_init(void)
Modified: trunk/usr.sbin/acpi/acpidump/acpidump.8
===================================================================
--- trunk/usr.sbin/acpi/acpidump/acpidump.8 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/acpidump/acpidump.8 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" ACPI (ACPI Package)
.\"
.\" Copyright (c) 1999 Doug Rabson <dfr at FreeBSD.org>
@@ -27,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/acpi/acpidump/acpidump.8 244525 2012-12-21 01:19:48Z neel $
.\"
.Dd February 14, 2005
.Dt ACPIDUMP 8
@@ -97,6 +98,7 @@
utility dumps contents of the following tables:
.Pp
.Bl -tag -offset indent -width 12345 -compact
+.It DMAR
.It DSDT
.It ECDT
.It FACS
Property changes on: trunk/usr.sbin/acpi/acpidump/acpidump.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/acpi/iasl/Makefile
===================================================================
--- trunk/usr.sbin/acpi/iasl/Makefile 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/iasl/Makefile 2018-07-04 13:30:55 UTC (rev 11286)
@@ -1,62 +1,77 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/acpi/iasl/Makefile 306536 2016-09-30 22:40:58Z jkim $
PROG= iasl
-SRCS= adfile.c adisasm.c adwalk.c
-SRCS+= osunixxf.c
# common
-SRCS+= dmextern.c dmrestag.c dmtable.c dmtbdump.c dmtbinfo.c \
+SRCS= acfileio.c adfile.c adisasm.c adwalk.c ahids.c \
+ ahpredef.c ahtable.c ahuuids.c cmfsize.c dmextern.c \
+ dmrestag.c dmtable.c dmtables.c dmtbdump.c dmtbinfo.c \
getopt.c
# compiler
-SRCS+= aslanalyze.c aslbtypes.c aslcodegen.c aslcompile.c \
- aslcompiler.y.h aslcompilerlex.c aslcompilerparse.c \
- aslerror.c aslfiles.c aslfold.c asllength.c \
- asllisting.c aslload.c asllookup.c aslmain.c aslmap.c \
- aslopcodes.c asloperands.c aslopt.c aslpredef.c \
- aslresource.c aslrestype1.c aslrestype1i.c \
- aslrestype2.c aslrestype2d.c aslrestype2e.c \
- aslrestype2q.c aslrestype2w.c aslstartup.c aslstubs.c \
- asltransform.c asltree.c aslutils.c asluuid.c \
- aslwalks.c dtcompile.c dtexpress.c dtfield.c dtio.c \
+SRCS+= aslanalyze.c aslascii.c aslbtypes.c aslcodegen.c \
+ aslcompile.c aslcompiler.y.h aslcompilerlex.c \
+ aslcompilerparse.c asldebug.c aslerror.c aslexternal.c \
+ aslfileio.c aslfiles.c aslfold.c aslhex.c asllength.c \
+ asllisting.c asllistsup.c aslload.c asllookup.c \
+ aslmain.c aslmap.c aslmapenter.c aslmapoutput.c \
+ aslmaputils.c aslmessages.c aslmethod.c aslnamesp.c \
+ asloffset.c aslopcodes.c asloperands.c aslopt.c \
+ asloptions.c aslpld.c aslpredef.c aslprepkg.c \
+ aslprintf.c aslprune.c aslresource.c aslrestype1.c \
+ aslrestype1i.c aslrestype2.c aslrestype2d.c \
+ aslrestype2e.c aslrestype2q.c aslrestype2s.c \
+ aslrestype2w.c aslstartup.c aslstubs.c asltransform.c \
+ asltree.c aslutils.c asluuid.c aslwalks.c aslxref.c \
+ aslxrefout.c dtcompile.c dtexpress.c dtfield.c dtio.c \
dtparser.y.h dtparserlex.c dtparserparse.c dtsubtable.c \
- dttable.c dttemplate.c dtutils.c
+ dttable.c dttable1.c dttable2.c dttemplate.c dtutils.c \
+ prexpress.c prmacros.c prparser.y.h prparserlex.c \
+ prparserparse.c prscan.c prutils.c
-# debugger
+# components/debugger
SRCS+= dbfileio.c
-# disassembler
-SRCS+= dmbuffer.c dmnames.c dmobject.c dmopcode.c dmresrc.c \
- dmresrcl.c dmresrcs.c dmutils.c dmwalk.c
+# components/disassembler
+SRCS+= dmbuffer.c dmcstyle.c dmdeferred.c dmnames.c dmopcode.c \
+ dmresrc.c dmresrcl.c dmresrcl2.c dmresrcs.c dmutils.c \
+ dmwalk.c
-# interpreter/dispatcher
+# components/dispatcher
SRCS+= dsargs.c dscontrol.c dsfield.c dsobject.c dsopcode.c \
dsutils.c dswexec.c dswload.c dswload2.c dswscope.c \
dswstate.c
-# interpreter/executer
-SRCS+= exconvrt.c excreate.c exdump.c exmisc.c exmutex.c \
- exnames.c exoparg1.c exoparg2.c exoparg3.c exoparg6.c \
- exprep.c exregion.c exresnte.c exresolv.c exresop.c \
+# components/executer
+SRCS+= exconcat.c exconvrt.c excreate.c exdump.c exmisc.c \
+ exmutex.c exnames.c exoparg1.c exoparg2.c exoparg3.c \
+ exoparg6.c exprep.c exresnte.c exresolv.c exresop.c \
exstore.c exstoren.c exstorob.c exsystem.c exutils.c
-# interpreter/parser
-SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c \
- pstree.c psutils.c pswalk.c
+# components/parser
+SRCS+= psargs.c psloop.c psobject.c psopcode.c psopinfo.c \
+ psparse.c psscope.c pstree.c psutils.c pswalk.c
-# namespace
+# components/namespace
SRCS+= nsaccess.c nsalloc.c nsdump.c nsnames.c nsobject.c \
- nsparse.c nssearch.c nsutils.c nswalk.c nsxfobj.c
+ nsparse.c nssearch.c nsutils.c nswalk.c
-# tables
-SRCS+= tbfadt.c tbinstal.c tbutils.c tbxface.c
+# components/tables
+SRCS+= tbdata.c tbfadt.c tbinstal.c tbprint.c tbutils.c \
+ tbxface.c tbxfload.c
-# utilities
-SRCS+= utalloc.c utcache.c utcopy.c utdebug.c utdecode.c \
- utdelete.c utglobal.c utinit.c utlock.c utmath.c \
- utmisc.c utmutex.c utobject.c utosi.c utresrc.c \
- utstate.c utxface.c utxferror.c
+# components/utilities
+SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \
+ utcopy.c utdebug.c utdecode.c utdelete.c uterror.c \
+ utexcep.c utglobal.c uthex.c utinit.c utlock.c utmath.c \
+ utmisc.c utmutex.c utnonansi.c utobject.c utownerid.c \
+ utpredef.c utprint.c utresrc.c utstate.c utstring.c \
+ utuuid.c utxface.c utxferror.c
+# os_specific/service_layers
+SRCS+= oslibcfs.c osunixxf.c
+
WARNS?= 2
MAN= iasl.8
@@ -64,29 +79,49 @@
CFLAGS+= -DACPI_ASL_COMPILER -I.
LFLAGS= -i -s
YFLAGS= -d
-DPADD= ${LIBPTHREAD}
-LDADD= -lpthread
-CLEANFILES= aslcompiler.y.h aslcompilerlex.c aslcompilerparse.c \
- aslcompilerparse.h dtparser.y.h dtparserlex.c \
- dtparserparse.c dtparserparse.h
+CLEANFILES= aslcompiler.y aslcompiler.y.h aslcompilerlex.c \
+ aslcompilerparse.c aslcompilerparse.h dtparser.y.h \
+ dtparserlex.c dtparserparse.c dtparserparse.h \
+ prparser.y.h prparserlex.c prparserparse.c \
+ prparserparse.h
-aslcompilerlex.c: aslcompiler.l
- ${LEX} ${LFLAGS} -PAslCompiler -o${.TARGET} ${.ALLSRC}
+PARSER= aslcstyle.y aslparser.y aslresources.y aslrules.y \
+ aslsupport.y asltokens.y asltypes.y
-aslcompilerparse.c: aslcompiler.y
- ${YACC} ${YFLAGS} -pAslCompiler -o${.TARGET} ${.ALLSRC}
+aslcompilerlex.c: aslcompiler.l aslsupport.l
+ ${LEX} ${LFLAGS} -PAslCompiler -o${.TARGET} \
+ ${ACPICA_DIR}/compiler/aslcompiler.l
-aslcompiler.y.h: aslcompilerparse.c
- mv -f aslcompilerparse.h ${.TARGET}
+aslcompiler.y: ${PARSER}
+ m4 -P -I${ACPICA_DIR}/compiler \
+ ${ACPICA_DIR}/compiler/aslparser.y > ${.TARGET}
+.ORDER: aslcompilerparse.c aslcompilerparse.h
+aslcompilerparse.c aslcompilerparse.h: aslcompiler.y
+ ${YACC} ${YFLAGS} -pAslCompiler -oaslcompilerparse.c ${.ALLSRC}
+
+aslcompiler.y.h: aslcompilerparse.h
+ ln -f ${.ALLSRC} ${.TARGET}
+
dtparserlex.c: dtparser.l
${LEX} ${LFLAGS} -PDtParser -o${.TARGET} ${.ALLSRC}
-dtparserparse.c: dtparser.y
- ${YACC} ${YFLAGS} -pDtParser -o${.TARGET} ${.ALLSRC}
+.ORDER: dtparserparse.c dtparserparse.h
+dtparserparse.c dtparserparse.h: dtparser.y
+ ${YACC} ${YFLAGS} -pDtParser -odtparserparse.c ${.ALLSRC}
-dtparser.y.h: dtparserparse.c
- mv -f dtparserparse.h ${.TARGET}
+dtparser.y.h: dtparserparse.h
+ ln -f ${.ALLSRC} ${.TARGET}
+prparserlex.c: prparser.l
+ ${LEX} ${LFLAGS} -PPrParser -o${.TARGET} ${.ALLSRC}
+
+.ORDER: prparserparse.c prparserparse.h
+prparserparse.c prparserparse.h: prparser.y
+ ${YACC} ${YFLAGS} -pPrParser -oprparserparse.c ${.ALLSRC}
+
+prparser.y.h: prparserparse.h
+ ln -f ${.ALLSRC} ${.TARGET}
+
.include <bsd.prog.mk>
Index: trunk/usr.sbin/acpi/iasl/iasl.8
===================================================================
--- trunk/usr.sbin/acpi/iasl/iasl.8 2018-07-04 13:29:47 UTC (rev 11285)
+++ trunk/usr.sbin/acpi/iasl/iasl.8 2018-07-04 13:30:55 UTC (rev 11286)
Property changes on: trunk/usr.sbin/acpi/iasl/iasl.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list