Date: Sat, 15 Feb 2020 15:05:25 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r357966 - in projects/clang1000-import: crypto/openssh sys/amd64/amd64 sys/arm64/arm64 sys/compat/cloudabi sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/co... Message-ID: <202002151505.01FF5P6O036121@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Feb 15 15:05:25 2020 New Revision: 357966 URL: https://svnweb.freebsd.org/changeset/base/357966 Log: Merge ^/head r357931 through r357965. Modified: projects/clang1000-import/crypto/openssh/FREEBSD-upgrade projects/clang1000-import/crypto/openssh/FREEBSD-vendor projects/clang1000-import/sys/amd64/amd64/pmap.c projects/clang1000-import/sys/amd64/amd64/trap.c projects/clang1000-import/sys/arm64/arm64/gicv3_its.c projects/clang1000-import/sys/compat/cloudabi/cloudabi_file.c projects/clang1000-import/sys/contrib/dev/acpica/changes.txt projects/clang1000-import/sys/contrib/dev/acpica/common/adisasm.c projects/clang1000-import/sys/contrib/dev/acpica/common/dmtables.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslanalyze.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompile.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompiler.h projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslexternal.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslload.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.h projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmethod.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslparseop.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslprimaries.y projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslrules.y projects/clang1000-import/sys/contrib/dev/acpica/compiler/asltransform.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslutils.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslxref.c projects/clang1000-import/sys/contrib/dev/acpica/compiler/cvparser.c projects/clang1000-import/sys/contrib/dev/acpica/components/events/evevent.c projects/clang1000-import/sys/contrib/dev/acpica/components/events/evxfgpe.c projects/clang1000-import/sys/contrib/dev/acpica/components/hardware/hwgpe.c projects/clang1000-import/sys/contrib/dev/acpica/components/hardware/hwsleep.c projects/clang1000-import/sys/contrib/dev/acpica/components/namespace/nsnames.c projects/clang1000-import/sys/contrib/dev/acpica/components/namespace/nsxfname.c projects/clang1000-import/sys/contrib/dev/acpica/components/tables/tbxface.c projects/clang1000-import/sys/contrib/dev/acpica/components/utilities/utobject.c projects/clang1000-import/sys/contrib/dev/acpica/include/acconvert.h projects/clang1000-import/sys/contrib/dev/acpica/include/achware.h projects/clang1000-import/sys/contrib/dev/acpica/include/acmacros.h projects/clang1000-import/sys/contrib/dev/acpica/include/acpixf.h projects/clang1000-import/sys/contrib/dev/acpica/include/actbl1.h projects/clang1000-import/sys/contrib/dev/acpica/include/actypes.h projects/clang1000-import/sys/fs/tmpfs/tmpfs_vfsops.c projects/clang1000-import/sys/i386/i386/trap.c projects/clang1000-import/sys/kern/kern_descrip.c projects/clang1000-import/sys/kern/kern_event.c projects/clang1000-import/sys/kern/kern_tc.c projects/clang1000-import/sys/kern/subr_capability.c projects/clang1000-import/sys/kern/subr_coverage.c projects/clang1000-import/sys/kern/sys_capability.c projects/clang1000-import/sys/kern/vfs_acl.c projects/clang1000-import/sys/kern/vfs_extattr.c projects/clang1000-import/sys/kern/vfs_lookup.c projects/clang1000-import/sys/kern/vfs_subr.c projects/clang1000-import/sys/kern/vfs_syscalls.c projects/clang1000-import/sys/kern/vfs_vnops.c projects/clang1000-import/sys/mips/include/pcpu.h projects/clang1000-import/sys/netinet/sctp_syscalls.c projects/clang1000-import/sys/sys/_cscan_atomic.h projects/clang1000-import/sys/sys/atomic_common.h projects/clang1000-import/sys/sys/capsicum.h projects/clang1000-import/sys/vm/vm_mmap.c projects/clang1000-import/sys/vm/vm_page.c projects/clang1000-import/sys/vm/vm_pageout.c projects/clang1000-import/sys/x86/x86/mp_x86.c Directory Properties: projects/clang1000-import/ (props changed) projects/clang1000-import/crypto/openssh/ (props changed) projects/clang1000-import/sys/contrib/dev/acpica/ (props changed) Modified: projects/clang1000-import/crypto/openssh/FREEBSD-upgrade ============================================================================== --- projects/clang1000-import/crypto/openssh/FREEBSD-upgrade Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/crypto/openssh/FREEBSD-upgrade Sat Feb 15 15:05:25 2020 (r357966) @@ -5,7 +5,7 @@ pretty fast once you're done with this checklist. 01) Download the latest OpenSSH-portable tarball and signature from - OpenBSD (ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/). + OpenBSD (https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/). 02) Verify the signature: Modified: projects/clang1000-import/crypto/openssh/FREEBSD-vendor ============================================================================== --- projects/clang1000-import/crypto/openssh/FREEBSD-vendor Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/crypto/openssh/FREEBSD-vendor Sat Feb 15 15:05:25 2020 (r357966) @@ -1,6 +1,6 @@ # $FreeBSD$ Project: Portable OpenSSH ProjectURL: http://www.openssh.com/portable.html -Version: 5.2p1 +Version: 7.9p1 License: BSD Maintainer: des Modified: projects/clang1000-import/sys/amd64/amd64/pmap.c ============================================================================== --- projects/clang1000-import/sys/amd64/amd64/pmap.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/amd64/amd64/pmap.c Sat Feb 15 15:05:25 2020 (r357966) @@ -796,7 +796,7 @@ again: PV_STAT(i = 0); for (p = &pmap_invl_gen_head;; p = prev.next) { PV_STAT(i++); - prevl = atomic_load_ptr(&p->next); + prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { PV_STAT(atomic_add_long(&invl_start_restart, 1)); lock_delay(&lda); @@ -903,7 +903,7 @@ pmap_delayed_invl_finish_u(void) again: for (p = &pmap_invl_gen_head; p != NULL; p = (void *)prevl) { - prevl = atomic_load_ptr(&p->next); + prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { PV_STAT(atomic_add_long(&invl_finish_restart, 1)); lock_delay(&lda); @@ -954,7 +954,7 @@ DB_SHOW_COMMAND(di_queue, pmap_di_queue) for (p = &pmap_invl_gen_head, first = true; p != NULL; p = pn, first = false) { - nextl = atomic_load_ptr(&p->next); + nextl = (uintptr_t)atomic_load_ptr(&p->next); pn = (void *)(nextl & ~PMAP_INVL_GEN_NEXT_INVALID); td = first ? NULL : __containerof(p, struct thread, td_md.md_invl_gen); Modified: projects/clang1000-import/sys/amd64/amd64/trap.c ============================================================================== --- projects/clang1000-import/sys/amd64/amd64/trap.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/amd64/amd64/trap.c Sat Feb 15 15:05:25 2020 (r357966) @@ -932,7 +932,7 @@ trap_user_dtrace(struct trapframe *frame, int (**hookp { int (*hook)(struct trapframe *); - hook = (int (*)(struct trapframe *))atomic_load_ptr(hookp); + hook = atomic_load_ptr(hookp); enable_intr(); if (hook != NULL) return ((hook)(frame) == 0); @@ -1075,7 +1075,7 @@ amd64_syscall_ret_flush_l1d_check(int error) if (error != EEXIST && error != EAGAIN && error != EXDEV && error != ENOENT && error != ENOTCONN && error != EINPROGRESS) { - p = (void *)atomic_load_ptr(&syscall_ret_l1d_flush); + p = atomic_load_ptr(&syscall_ret_l1d_flush); if (p != NULL) p(); } Modified: projects/clang1000-import/sys/arm64/arm64/gicv3_its.c ============================================================================== --- projects/clang1000-import/sys/arm64/arm64/gicv3_its.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/arm64/arm64/gicv3_its.c Sat Feb 15 15:05:25 2020 (r357966) @@ -547,7 +547,7 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) { void *conf_table; - conf_table = (void *)atomic_load_ptr((uintptr_t *)&conf_base); + conf_table = atomic_load_ptr(&conf_base); if (conf_table == NULL) { conf_table = contigmalloc(LPI_CONFTAB_SIZE, M_GICV3_ITS, M_WAITOK, 0, LPI_CONFTAB_MAX_ADDR, @@ -556,8 +556,7 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) if (atomic_cmpset_ptr((uintptr_t *)&conf_base, (uintptr_t)NULL, (uintptr_t)conf_table) == 0) { contigfree(conf_table, LPI_CONFTAB_SIZE, M_GICV3_ITS); - conf_table = - (void *)atomic_load_ptr((uintptr_t *)&conf_base); + conf_table = atomic_load_ptr(&conf_base); } } sc->sc_conf_base = conf_table; Modified: projects/clang1000-import/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- projects/clang1000-import/sys/compat/cloudabi/cloudabi_file.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/compat/cloudabi/cloudabi_file.c Sat Feb 15 15:05:25 2020 (r357966) @@ -214,7 +214,7 @@ cloudabi_sys_file_open(struct thread *td, fds.fs_rights_base | fds.fs_rights_inheriting, &rights); if (error != 0) return (error); - cap_rights_set(&rights, CAP_LOOKUP); + cap_rights_set_one(&rights, CAP_LOOKUP); /* Convert rights to corresponding access mode. */ read = (fds.fs_rights_base & (CLOUDABI_RIGHT_FD_READ | @@ -227,7 +227,7 @@ cloudabi_sys_file_open(struct thread *td, /* Convert open flags. */ if ((uap->oflags & CLOUDABI_O_CREAT) != 0) { fflags |= O_CREAT; - cap_rights_set(&rights, CAP_CREATE); + cap_rights_set_one(&rights, CAP_CREATE); } if ((uap->oflags & CLOUDABI_O_DIRECTORY) != 0) fflags |= O_DIRECTORY; @@ -235,7 +235,7 @@ cloudabi_sys_file_open(struct thread *td, fflags |= O_EXCL; if ((uap->oflags & CLOUDABI_O_TRUNC) != 0) { fflags |= O_TRUNC; - cap_rights_set(&rights, CAP_FTRUNCATE); + cap_rights_set_one(&rights, CAP_FTRUNCATE); } if ((fds.fs_flags & CLOUDABI_FDFLAG_APPEND) != 0) fflags |= O_APPEND; @@ -244,12 +244,12 @@ cloudabi_sys_file_open(struct thread *td, if ((fds.fs_flags & (CLOUDABI_FDFLAG_SYNC | CLOUDABI_FDFLAG_DSYNC | CLOUDABI_FDFLAG_RSYNC)) != 0) { fflags |= O_SYNC; - cap_rights_set(&rights, CAP_FSYNC); + cap_rights_set_one(&rights, CAP_FSYNC); } if ((uap->dirfd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) == 0) fflags |= O_NOFOLLOW; if (write && (fflags & (O_APPEND | O_TRUNC)) == 0) - cap_rights_set(&rights, CAP_SEEK); + cap_rights_set_one(&rights, CAP_SEEK); /* Allocate new file descriptor. */ error = falloc_noinstall(td, &fp); Modified: projects/clang1000-import/sys/contrib/dev/acpica/changes.txt ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/changes.txt Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/changes.txt Sat Feb 15 15:05:25 2020 (r357966) @@ -1,4 +1,102 @@ ---------------------------------------- +14 February 2020. Summary of changes for version 20200214: + + +1) ACPICA kernel-resident subsystem: + +Enable sleep button on ACPI legacy wake: Hibernation (S4) is triggered +in a guest when it receives a sleep trigger from the hypervisor. When the +guest resumes from this power state, it does not see the SleepEnabled +bit. In other words, the sleepHibernation (S4) is triggered in a guest +when it receives a sleep trigger from the hypervisor. When the guest +resumes from this power state, it does not see the SleepEnabled bit. In +other words, the sleep button is not enabled on waking from an S4 state. +This causes subsequent invocation of sleep state to fail since the +guest.button is not enabled on waking from an S4 state. This causes +subsequent invocation of sleep state to fail in the guest. Fix this +problem by enabling the sleep button in ACPI legacy wake. From Anchal +Agarwal <anchalag@amazon.com>. + +Implemented a new external interface, AcpiAnyGpeStatusSet (). To be used +for checking the status bits of all enabled GPEs in one go. It is needed +to distinguish spurious SCIs from genuine ones when deciding whether or +not to wake up the system from suspend-to-idle. + +Generic Makefiles: replace HOST name with ACPI_HOST: Some machines may be +using HOST in their environment to represent the host name for their +machines. Avoid this problem by renaming this variable from HOST to +ACPI_HOST. + +MSVC 2017 project files: Enable multiprocessor generation to improve +build performance. + +Added a macro to get the byte width of a Generic Address structure. New +ACPI_ACCESS_BYTE_WIDTH is in addition to the existing +ACPI_ACCESS_BIT_WIDTH. From Mika Westerberg. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Implemented full support for the (optional, rarely used) ReturnType +and ParameterTypesList for the Method, Function, and External operators. +For Method declarations, the number of individual ParameterTypes must +match the declaration of the number of arguments (NumArgs). This also +Fixes a problem with the External operator where extra/extraneous bytes +were emitted in the AML code if the optional ReturnType/ParameterTypes +were specified for a MethodObj declaration. +New error message: +1) Method NumArgs count does not match length of ParameterTypes list + +iASL: Implemented detection of type mismatches between External +declarations and named object declarations. Also, detect type mismatches +between multiple External declarations of the same Name. +New error messages: +1) Type mismatch between external declaration and actual object +declaration detected +2) Type mismatch between multiple external declarations detected + +iASL: Implemented new error messages for External operators that specify +a ReturnType and/or ParameterTypesList for any object type other than +control methods (MethodObj). +New error messages: +1) Return type is only allowed for Externals declared as MethodObj +2) Parameter type is only allowed for Externals declared as MethodObj + +iASL: Implemented two new remark/warning messages for ASL code that +creates named objects from within a control method. This is very +inefficient since the named object must be created and deleted each time +the method is executed. +New messages: +1) Creation of named objects within a method is highly inefficient, use +globals or method local variables instead (remark) +2) Static OperationRegion should be declared outside control method +(warning) + +iASL: Improved illegal forward reference detection by adding support to +detect forward-reference method invocations. + +iASL: Detect and issue an error message for NameStrings that contain too +many individual NameSegs (>255). This is an AML limitation that is +defined in the ACPI specification. +New message: +1) NameString contains too many NameSegs (>255) + +acpidump: windows: use GetSystemFirmwareTable API for all tables except +SSDT. By using this API, acpidump is able to get all tables in the XSDT + +iASL: Removed unused parser file and updated msvc2017 project files. +Removed the obsolete AslCompiler.y from the repository. + +iASL: msvc2017: Fixed macros in the file dependency list to prevent +unnecessary rebuilds. Replace %(Directory) with %(RelativeDir). + +Disassembler: Prevent spilling error messages to the output file. All +errors are directed to the console instead. These error messages +prevented re-compilation of the resulting disassembled ASL output file +(.DSL). + + +---------------------------------------- 10 January 2020. Summary of changes for version 20200110: @@ -8845,8 +8943,8 @@ much larger code and data size. Fix build error under Bison-2.4. -Dissasembler: Enhanced FADT support. Added decoding of the Boot -Architecture +Disassembler: Enhanced FADT support. Added decoding of the Boot +Architecture flags. Now decode all flags, regardless of the FADT version. Flag output includes the FADT version which first defined each flag. Modified: projects/clang1000-import/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/common/adisasm.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/common/adisasm.c Sat Feb 15 15:05:25 2020 (r357966) @@ -156,6 +156,7 @@ #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acapps.h> +#include <contrib/dev/acpica/include/acconvert.h> #define _COMPONENT ACPI_TOOLS @@ -379,8 +380,6 @@ AdAmlDisassemble ( Status = AE_ERROR; goto Cleanup; } - - AcpiOsRedirectOutput (File); } *OutFilename = DisasmFilename; @@ -467,6 +466,11 @@ AdDisassembleOneTable ( if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) { + if (File) + { + AcpiOsRedirectOutput (File); + } + AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); /* This is a "Data Table" (non-AML table) */ @@ -489,6 +493,10 @@ AdDisassembleOneTable ( return (AE_OK); } + /* Initialize the converter output file */ + + ASL_CV_INIT_FILETREE(Table, File); + /* * This is an AML table (DSDT or SSDT). * Always parse the tables, only option is what to display @@ -499,6 +507,13 @@ AdDisassembleOneTable ( AcpiOsPrintf ("Could not parse ACPI tables, %s\n", AcpiFormatException (Status)); return (Status); + } + + /* Redirect output for code generation and debugging output */ + + if (File) + { + AcpiOsRedirectOutput (File); } /* Debug output, namespace and parse tree */ Modified: projects/clang1000-import/sys/contrib/dev/acpica/common/dmtables.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/common/dmtables.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/common/dmtables.c Sat Feb 15 15:05:25 2020 (r357966) @@ -506,7 +506,6 @@ AdParseTable ( AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); - ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength); AcpiUtSetIntegerWidth (Table->Revision); Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslanalyze.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Feb 15 15:05:25 2020 (r357966) @@ -151,6 +151,7 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> #include "aslcompiler.y.h" +#include <contrib/dev/acpica/include/acnamesp.h> #include <string.h> @@ -421,6 +422,7 @@ AnCheckMethodReturnValue ( { ACPI_PARSE_OBJECT *OwningOp; ACPI_NAMESPACE_NODE *Node; + char *ExternalPath; Node = ArgOp->Asl.Node; @@ -435,18 +437,19 @@ AnCheckMethodReturnValue ( /* Examine the parent op of this method */ OwningOp = Node->Op; + ExternalPath = AcpiNsGetNormalizedPathname (Node, TRUE); + if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL) { /* Method NEVER returns a value */ - AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName); + AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, ExternalPath); } else if (OwningOp->Asl.CompileFlags & OP_METHOD_SOME_NO_RETVAL) { /* Method SOMETIMES returns a value, SOMETIMES not */ - AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, - Op, Op->Asl.ExternalName); + AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, ExternalPath); } else if (!(ThisNodeBtype & RequiredBtypes)) { @@ -469,6 +472,11 @@ AnCheckMethodReturnValue ( AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); } + } + + if (ExternalPath) + { + ACPI_FREE (ExternalPath); } } Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Feb 15 15:05:25 2020 (r357966) @@ -647,7 +647,7 @@ void AslCompilerFileHeader ( UINT32 FileId) { - struct tm *NewTime; + char *NewTime; time_t Aclock; char *Prefix = ""; @@ -691,13 +691,17 @@ AslCompilerFileHeader ( /* Compilation header with timestamp */ - (void) time (&Aclock); - NewTime = localtime (&Aclock); + Aclock = time (NULL); + NewTime = ctime (&Aclock); FlPrintFile (FileId, - "%sCompilation of \"%s\" - %s%s\n", - Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), - Prefix); + "%sCompilation of \"%s\" -", + Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename); + + if (NewTime) + { + FlPrintFile (FileId, " %s%s\n", NewTime, Prefix); + } switch (FileId) { Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Feb 15 15:05:25 2020 (r357966) @@ -373,7 +373,16 @@ MtMethodAnalysisWalkEnd ( UINT32 Level, void *Context); +UINT32 +MtProcessTypeOp ( + ACPI_PARSE_OBJECT *TypeOp); +UINT8 +MtProcessParameterTypeList ( + ACPI_PARSE_OBJECT *ParamTypeOp, + UINT32 *TypeList); + + /* * aslbtypes - bitfield data types */ @@ -1233,9 +1242,13 @@ UtDumpBasicOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level); -void * -UtGetParentMethod ( +ACPI_NAMESPACE_NODE * +UtGetParentMethodNode ( ACPI_NAMESPACE_NODE *Node); + +ACPI_PARSE_OBJECT * +UtGetParentMethodOp ( + ACPI_PARSE_OBJECT *Op); BOOLEAN UtNodeIsDescendantOf ( Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslexternal.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslexternal.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslexternal.c Sat Feb 15 15:05:25 2020 (r357966) @@ -192,12 +192,54 @@ ExDoExternal ( ACPI_PARSE_OBJECT *Prev; ACPI_PARSE_OBJECT *Next; ACPI_PARSE_OBJECT *ArgCountOp; + ACPI_PARSE_OBJECT *TypeOp; + ACPI_PARSE_OBJECT *ExternTypeOp = Op->Asl.Child->Asl.Next; + UINT32 ExternType; + UINT8 ParamCount = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS; + UINT32 ParamTypes[ACPI_METHOD_NUM_ARGS]; + ExternType = AnMapObjTypeToBtype (ExternTypeOp); + + /* + * The parser allows optional parameter return types regardless of the + * type. Check object type keyword emit error if optional parameter/return + * types exist. + * + * Check the parameter return type + */ + TypeOp = ExternTypeOp->Asl.Next; + if (TypeOp->Asl.Child) + { + /* Ignore the return type for now. */ + + (void) MtProcessTypeOp (TypeOp->Asl.Child); + if (ExternType != ACPI_BTYPE_METHOD) + { + sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType)); + AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_RET_TYPE, TypeOp, + AslGbl_MsgBuffer); + } + } + + /* Check the parameter types */ + + TypeOp = TypeOp->Asl.Next; + if (TypeOp->Asl.Child) + { + ParamCount = MtProcessParameterTypeList (TypeOp->Asl.Child, ParamTypes); + if (ExternType != ACPI_BTYPE_METHOD) + { + sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType)); + AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_PARAM_TYPE, TypeOp, + AslGbl_MsgBuffer); + } + } + ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next; ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST; - ArgCountOp->Asl.Value.Integer = 0; + ArgCountOp->Asl.Value.Integer = ParamCount; UtSetParseOpName (ArgCountOp); /* Create new list node of arbitrary type */ Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslload.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslload.c Sat Feb 15 15:05:25 2020 (r357966) @@ -196,6 +196,15 @@ LdCheckSpecialNames ( ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op); +static ACPI_STATUS +LdAnalyzeExternals ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op, + ACPI_OBJECT_TYPE ExternalOpType, + ACPI_OBJECT_TYPE ObjectType, + ACPI_WALK_STATE *WalkState); + + /******************************************************************************* * * FUNCTION: LdLoadNamespace @@ -575,7 +584,8 @@ LdNamespace1Begin ( /* Check for a possible illegal forward reference */ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) + (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || + (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) { /* * Op->Asl.Namepath will be NULL for these opcodes. @@ -591,7 +601,8 @@ LdNamespace1Begin ( * We only want references to named objects: * Store (2, WXYZ) -> Attempt to resolve the name */ - if (OpInfo->Class == AML_CLASS_NAMED_OBJECT) + if ((Op->Asl.ParseOpcode != PARSEOP_METHODCALL) && + (OpInfo->Class == AML_CLASS_NAMED_OBJECT)) { return (AE_OK); } @@ -899,58 +910,26 @@ LdNamespace1Begin ( Node->Type = (UINT8) ObjectType; Status = AE_OK; } - else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && - (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) + else if ((Node->Flags & ANOBJ_IS_EXTERNAL) || + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { - /* - * Allow one create on an object or segment that was - * previously declared External - */ - Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; - - /* Just retyped a node, probably will need to open a scope */ - - if (AcpiNsOpensScope (ObjectType)) + Status = LdAnalyzeExternals (Node, Op, ActualObjectType, + ObjectType, WalkState); + if (ACPI_FAILURE (Status)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) + if (Status == AE_ERROR) { - return_ACPI_STATUS (Status); + /* + * The use of AE_ERROR here indicates that there was a + * compiler error emitted in LdAnalyzeExternals which + * means that the caller should proceed to the next Op + * for analysis of subsequent parse objects. + */ + Status = AE_OK; } + return_ACPI_STATUS (Status); } - - Status = AE_OK; } - else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) - { - /* - * Allow externals in same scope as the definition of the - * actual object. Similar to C. Allows multiple definition - * blocks that refer to each other in the same file. - */ - Status = AE_OK; - } - else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && - (ObjectType == ACPI_TYPE_ANY)) - { - /* Allow update of externals of unknown type. */ - - if (AcpiNsOpensScope (ActualObjectType)) - { - Node->Type = (UINT8) ActualObjectType; - Status = AE_OK; - } - else - { - sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, - AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); - return_ACPI_STATUS (AE_OK); - } - } else { /* Valid error, object already exists */ @@ -1013,15 +992,17 @@ FinishNode: * Set the actual data type if appropriate (EXTERNAL term only) * As of 11/19/2019, ASL External() does not support parameter * counts. When an External method is loaded, the parameter count is - * unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS - * indicates that the parameter count for this method is unknown. - * This information is used in ASL cross reference to help determine the - * parameter count through method calls. + * recorded in the external's arg count parameter. The parameter count may + * or may not be known in the declaration. If the value of this node turns + * out to be ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS, it indicates that + * we do not know the parameter count and that we must look at the usage of + * the External method call to get this information. */ if (ActualObjectType != ACPI_TYPE_ANY) { Node->Type = (UINT8) ActualObjectType; - Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS; + Node->Value = (UINT32) + Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; } if (Op->Asl.ParseOpcode == PARSEOP_METHOD) @@ -1034,6 +1015,145 @@ FinishNode: } return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: LdAnalyzeExternals + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * ExternalOpType - Type of ExternalOp + * ObjectType - Type of Declared object + * WalkState - Current WalkState + * + * RETURN: Status + * + * DESCRIPTION: Node and Op represents an identically named object declaration + * that is either declared by the ASL external keyword or declared + * by operators that declare named objects (i.e. Name, Device, + * OperationRegion, and etc.). This function ensures that the + * declarations do not contradict each other. + * + ******************************************************************************/ + +static ACPI_STATUS +LdAnalyzeExternals ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op, + ACPI_OBJECT_TYPE ExternalOpType, + ACPI_OBJECT_TYPE ObjectType, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_OK; + ACPI_OBJECT_TYPE ActualExternalOpType; + ACPI_OBJECT_TYPE ActualOpType; + ACPI_PARSE_OBJECT *ExternalOp; + ACPI_PARSE_OBJECT *ActualOp; + + + /* + * The declaration represented by Node and Op must have the same type. + * The type of the external Op is represented by ExternalOpType. However, + * the type of the pre-existing declaration depends on whether if Op + * is an external declaration or an actual declaration. + */ + if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) + { + ActualExternalOpType = ExternalOpType; + ActualOpType = Node->Type; + } + else + { + ActualExternalOpType = Node->Type; + ActualOpType = ObjectType; + } + + if ((ActualOpType != ACPI_TYPE_ANY) && + (ActualExternalOpType != ACPI_TYPE_ANY) && + (ActualExternalOpType != ActualOpType)) + { + if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && + Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) + { + AslDualParseOpError (ASL_ERROR, + ASL_MSG_DUPLICATE_EXTERN_MISMATCH, Op, NULL, + ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, Node->Op, NULL); + } + else + { + if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && + Node->Op->Asl.ParseOpcode != PARSEOP_EXTERNAL) + { + ExternalOp = Op; + ActualOp = Node->Op; + } + else + { + ExternalOp = Node->Op; + ActualOp = Op; + } + AslDualParseOpError (ASL_ERROR, + ASL_MSG_DECLARATION_TYPE_MISMATCH, ExternalOp, NULL, + ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ActualOp, NULL); + } + } + + if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) + { + /* + * Allow one create on an object or segment that was + * previously declared External + */ + Node->Flags &= ~ANOBJ_IS_EXTERNAL; + Node->Type = (UINT8) ObjectType; + + /* Just retyped a node, probably will need to open a scope */ + + if (AcpiNsOpensScope (ObjectType)) + { + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + Status = AE_OK; + } + else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + { + /* + * Allow externals in same scope as the definition of the + * actual object. Similar to C. Allows multiple definition + * blocks that refer to each other in the same file. + */ + Status = AE_OK; + } + else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && + (ObjectType == ACPI_TYPE_ANY)) + { + /* Allow update of externals of unknown type. */ + + if (AcpiNsOpensScope (ExternalOpType)) + { + Node->Type = (UINT8) ExternalOpType; + Status = AE_OK; + } + else + { + sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, + AcpiUtGetTypeName (Node->Type)); + AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); + Status = AE_ERROR; + } + } + + return (Status); } Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Feb 15 15:05:25 2020 (r357966) @@ -320,7 +320,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", /* ASL_MSG_SEEK */ "Could not seek file", /* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", -/* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized", +/* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized due to creation of named objects within", /* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", /* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", /* ASL_MSG_STRING_LENGTH */ "String literal too long", @@ -370,7 +370,16 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer", /* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.", /* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)", -/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:" +/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:", +/* ASL_MSG_EXTERN_INVALID_RET_TYPE */ "Return type is only allowed for Externals declared as MethodObj", +/* ASL_MSG_EXTERN_INVALID_PARAM_TYPE */ "Parameter type is only allowed for Externals declared as MethodObj", +/* ASL_MSG_NAMED_OBJECT_CREATION */ "Creation of named objects within a method is highly inefficient, use globals or method local variables instead", +/* ASL_MSG_ARG_COUNT_MISMATCH */ "Method NumArgs count does not match length of ParameterTypes list", +/* ASL_MSG_STATIC_OPREGION_IN_METHOD */ "Static OperationRegion should be declared outside control method", +/* ASL_MSG_DECLARATION_TYPE_MISMATCH */ "Type mismatch between external declaration and actual object declaration detected", +/* ASL_MSG_TYPE_MISMATCH_FOUND_HERE */ "Actual object declaration:", +/* ASL_MSG_DUPLICATE_EXTERN_MISMATCH */ "Type mismatch between multiple external declarations detected", +/* ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:", }; /* Table compiler */ Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Feb 15 15:05:25 2020 (r357966) @@ -373,6 +373,16 @@ typedef enum ASL_MSG_LEGACY_PROCESSOR_OP, ASL_MSG_NAMESTRING_LENGTH, ASL_MSG_CASE_FOUND_HERE, + ASL_MSG_EXTERN_INVALID_RET_TYPE, + ASL_MSG_EXTERN_INVALID_PARAM_TYPE, + ASL_MSG_NAMED_OBJECT_CREATION, + ASL_MSG_ARG_COUNT_MISMATCH, + ASL_MSG_STATIC_OPREGION_IN_METHOD, + ASL_MSG_DECLARATION_TYPE_MISMATCH, + ASL_MSG_TYPE_MISMATCH_FOUND_HERE, + ASL_MSG_DUPLICATE_EXTERN_MISMATCH, + ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, + /* These messages are used by the Data Table compiler only */ Modified: projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmethod.c ============================================================================== --- projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Feb 15 15:03:26 2020 (r357965) +++ projects/clang1000-import/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Feb 15 15:05:25 2020 (r357966) @@ -151,6 +151,7 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> #include "aslcompiler.y.h" +#include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/amlcode.h> @@ -166,7 +167,11 @@ MtCheckNamedObjectInMethod ( ACPI_PARSE_OBJECT *Op, ASL_METHOD_INFO *MethodInfo); +static void +MtCheckStaticOperationRegionInMethod ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * * FUNCTION: MtMethodAnalysisWalkBegin @@ -197,7 +202,6 @@ MtMethodAnalysisWalkBegin ( char ArgName[] = "Arg0"; ACPI_PARSE_OBJECT *ArgNode; ACPI_PARSE_OBJECT *NextType; - ACPI_PARSE_OBJECT *NextParamType; UINT8 ActualArgs = 0; BOOLEAN HidExists; BOOLEAN AdrExists; @@ -282,50 +286,35 @@ MtMethodAnalysisWalkBegin ( Next = Next->Asl.Next; NextType = Next->Asl.Child; - while (NextType) - { - /* Get and map each of the ReturnTypes */ - MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType); - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextType = NextType->Asl.Next; - } + MethodInfo->ValidReturnTypes = MtProcessTypeOp (NextType); /* Get the ParameterType node */ Next = Next->Asl.Next; NextType = Next->Asl.Child; - while (NextType) + if (!NextType) { - if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - NextParamType = NextType->Asl.Child; - while (NextParamType) - { - MethodInfo->ValidArgTypes[ActualArgs] |= - AnMapObjTypeToBtype (NextParamType); - - NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - NextParamType = NextParamType->Asl.Next; - } - } - else - { - MethodInfo->ValidArgTypes[ActualArgs] = - AnMapObjTypeToBtype (NextType); - - NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - ActualArgs++; - } - - NextType = NextType->Asl.Next; + /* + * The optional parameter types list was omitted at the source + * level. Use the Argument count parameter instead. + */ + ActualArgs = MethodInfo->NumArguments; } + else + { + ActualArgs = MtProcessParameterTypeList (NextType, + MethodInfo->ValidArgTypes); + } if ((MethodInfo->NumArguments) && (MethodInfo->NumArguments != ActualArgs)) { - /* error: Param list did not match number of args */ + sprintf (AslGbl_MsgBuffer, + "Length = %u", ActualArgs); + AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_MISMATCH, + Op->Asl.Child->Asl.Next, AslGbl_MsgBuffer); } /* Allow numarguments == 0 for Function() */ @@ -576,6 +565,8 @@ MtMethodAnalysisWalkBegin ( AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); } + + MtCheckStaticOperationRegionInMethod (Op); break; case PARSEOP_NAME: @@ -630,6 +621,71 @@ MtMethodAnalysisWalkBegin ( /******************************************************************************* * + * FUNCTION: MtProcessTypeOp + * + * PARAMETERS: Op - Op representing a btype + * + * RETURN: Btype represented by Op + * + * DESCRIPTION: Process a parse object that represents single parameter type or + * a return type in method, function, and external declarations. + * + ******************************************************************************/ + +UINT32 +MtProcessTypeOp ( + ACPI_PARSE_OBJECT *TypeOp) +{ + UINT32 Btype = ACPI_BTYPE_ANY; + + + while (TypeOp) + { + Btype |= AnMapObjTypeToBtype (TypeOp); + TypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + TypeOp = TypeOp->Asl.Next; + } + + return (Btype); +} + + +/******************************************************************************* + * + * FUNCTION: MtProcessParameterTypeList + * + * PARAMETERS: Op - Op representing a btype + * + * RETURN: Btype represented by Op + * + * DESCRIPTION: Process a parse object that represents a parameter type list in + * method, function, and external declarations. + * + ******************************************************************************/ + +UINT8 +MtProcessParameterTypeList ( + ACPI_PARSE_OBJECT *ParamTypeOp, + UINT32 *TypeList) +{ + UINT8 ParameterCount = 0; + + + while (ParamTypeOp) + { + TypeList[ParameterCount] = + MtProcessTypeOp (ParamTypeOp->Asl.Child); + + ParameterCount++; + ParamTypeOp = ParamTypeOp->Asl.Next; + } + + return (ParameterCount); +} + + +/******************************************************************************* + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002151505.01FF5P6O036121>