diff --git a/Makefile.inc1 b/Makefile.inc1 index 4dcbc0f97d61..10696307f813 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -343,16 +343,15 @@ WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ SIZE="${XSIZE}" .if ${XCC:M/*} -XFLAGS= --sysroot=${WORLDTMP} .if defined(CROSS_BINUTILS_PREFIX) # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a # directory, but the compiler will look in the right place for it's # tools so we don't need to tell it where to look. .if exists(${CROSS_BINUTILS_PREFIX}) -XFLAGS+= -B${CROSS_BINUTILS_PREFIX} +BFLAGS+= -B${CROSS_BINUTILS_PREFIX} .endif .else -XFLAGS+= -B${WORLDTMP}/usr/bin +BFLAGS+= -B${WORLDTMP}/usr/bin .endif .if ${TARGET} == "arm" .if ${TARGET_ARCH:M*hf*} != "" @@ -369,6 +368,8 @@ DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XCFLAGS+= -target ${TARGET_TRIPLE} +XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS} +XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS} .endif .endif @@ -912,25 +913,25 @@ packageworld: .for dist in base ${EXTRA_DISTRIBUTIONS} .if defined(NO_ROOT) ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ - --exclude usr/lib/debug \ - @${DESTDIR}/${DISTDIR}/${dist}.meta + tar cvf - --exclude usr/lib/debug \ + @${DESTDIR}/${DISTDIR}/${dist}.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz .else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ - --exclude usr/lib/debug . + tar cvf - --exclude usr/lib/debug . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz .endif .endfor .for dist in ${DEBUG_DISTRIBUTIONS} . if defined(NO_ROOT) ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \ - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta + tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz . else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJLf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \ - usr/lib/debug + tar cvLf - usr/lib/debug | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz . endif .endfor @@ -1138,19 +1139,21 @@ distributekernel distributekernel.debug: packagekernel: .if defined(NO_ROOT) cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ - @${DESTDIR}/${DISTDIR}/kernel.meta + tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta + tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .endfor .else cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . + tar cvf - . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . + tar cvf - . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .endfor .endif @@ -1244,11 +1247,6 @@ _m4= lib/libohash \ usr.bin/m4 .endif -.if ${BOOTSTRAPPING} < 1000013 -_yacc= lib/liby \ - usr.bin/yacc -.endif - .if ${BOOTSTRAPPING} < 1000014 _crunch= usr.sbin/crunch .endif @@ -1270,6 +1268,11 @@ _lex= usr.bin/lex _awk= usr.bin/awk .endif +.if ${BOOTSTRAPPING} < 1001506 +_yacc= lib/liby \ + usr.bin/yacc +.endif + .if ${MK_BSNMP} != "no" _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif diff --git a/UPDATING b/UPDATING index 0fa66e051b58..5e144c45a86e 100644 --- a/UPDATING +++ b/UPDATING @@ -34,6 +34,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: 2015mmdd: Clang and llvm have been upgraded to 3.6.0 release. +20150217: + If you are running a -CURRENT kernel since r273872 (Oct 30th, 2014), + but before r278950, the RNG was not seeded properly. Immediately + upgrade the kernel to r278950 or later and regenerate any keys (e.g. + ssh keys or openssl keys) that were generated w/ a kernel from that + range. This does not effect programs that directly used /dev/random + or /dev/urandom. All userland uses of arc4random(3) are affected. + 20150210: The autofs(4) ABI was changed in order to restore binary compatibility with 10.1-RELEASE. The automountd(8) daemon needs to be rebuilt to work diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c index fdfe416804fc..a75dc02d5ad9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c @@ -36,7 +36,6 @@ #include #include #include -#include /* * In Solaris 10 GA, the only mechanism for communicating helper information @@ -62,9 +61,7 @@ static const char *olddevname = "/devices/pseudo/dtrace@0:helper"; static const char *modname; /* Name of this load object */ static int gen; /* DOF helper generation */ -#ifdef illumos extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ -#endif static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */ static void @@ -99,11 +96,7 @@ static void dtrace_dof_init(void) __attribute__ ((constructor)); static void dtrace_dof_init(void) { -#ifdef illumos dof_hdr_t *dof = &__SUNW_dof; -#else - dof_hdr_t *dof = NULL; -#endif #ifdef _LP64 Elf64_Ehdr *elf; #else @@ -118,17 +111,6 @@ dtrace_dof_init(void) #endif int fd; const char *p; -#ifndef illumos - Elf *e; - Elf_Scn *scn = NULL; - Elf_Data *dofdata = NULL; - dof_hdr_t *dof_next = NULL; - GElf_Shdr shdr; - int efd; - char *s; - size_t shstridx; - uint64_t aligned_filesz; -#endif if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) return; @@ -152,42 +134,6 @@ dtrace_dof_init(void) modname = lmp->l_name; else modname++; -#ifndef illumos - elf_version(EV_CURRENT); - if ((efd = open(lmp->l_name, O_RDONLY, 0)) < 0) { - dprintf(1, "couldn't open file for reading\n"); - return; - } - if ((e = elf_begin(efd, ELF_C_READ, NULL)) == NULL) { - dprintf(1, "elf_begin failed\n"); - close(efd); - return; - } - elf_getshdrstrndx(e, &shstridx); - dof = NULL; - while ((scn = elf_nextscn(e, scn)) != NULL) { - gelf_getshdr(scn, &shdr); - if (shdr.sh_type == SHT_SUNW_dof) { - s = elf_strptr(e, shstridx, shdr.sh_name); - if (s != NULL && strcmp(s, ".SUNW_dof") == 0) { - dofdata = elf_getdata(scn, NULL); - dof = dofdata->d_buf; - break; - } - } - } - if (dof == NULL) { - dprintf(1, "SUNW_dof section not found\n"); - elf_end(e); - close(efd); - return; - } - - while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) { - aligned_filesz = (shdr.sh_addralign == 0 ? dof->dofh_filesz : - roundup2(dof->dofh_filesz, shdr.sh_addralign)); - dof_next = (void *) ((char *) dof + aligned_filesz); -#endif if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 || dof->dofh_ident[DOF_ID_MAG1] != DOF_MAG_MAG1 || @@ -237,21 +183,12 @@ dtrace_dof_init(void) dprintf(1, "DTrace ioctl failed for DOF at %p", dof); else { dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof); -#ifndef illumos +#ifdef __FreeBSD__ gen = dh.gen; #endif } (void) close(fd); - -#ifndef illumos - /* End of while loop */ - dof = dof_next; - } - - elf_end(e); - (void) close(efd); -#endif } #ifdef illumos diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index c9e8e20d0b71..51bed72556d0 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -275,6 +275,9 @@ struct dtrace_hdl { int dt_cpp_argc; /* count of initialized cpp(1) arguments */ int dt_cpp_args; /* size of dt_cpp_argv[] array */ char *dt_ld_path; /* pathname of ld(1) to invoke if needed */ +#ifdef __FreeBSD__ + char *dt_objcopy_path; /* pathname of objcopy(1) to invoke if needed */ +#endif dt_list_t dt_lib_path; /* linked-list forming library search path */ uint_t dt_lazyload; /* boolean: set via -xlazyload */ uint_t dt_droptags; /* boolean: set via -xdroptags */ diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index 3991714086a7..ae41269afa16 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -281,7 +281,11 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); sym->st_value = 0; sym->st_size = dof->dofh_filesz; sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT); +#ifdef illumos sym->st_other = 0; +#else + sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN); +#endif sym->st_shndx = ESHDR_DOF; sym++; @@ -471,7 +475,11 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep) sym->st_value = 0; sym->st_size = dof->dofh_filesz; sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_OBJECT); +#ifdef illumos sym->st_other = 0; +#else + sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN); +#endif sym->st_shndx = ESHDR_DOF; sym++; @@ -711,11 +719,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd) shp = &elf_file.shdr[ESHDR_DOF]; shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */ -#ifdef illumos shp->sh_flags = SHF_ALLOC; -#else - shp->sh_flags = SHF_WRITE | SHF_ALLOC; -#endif shp->sh_type = SHT_SUNW_dof; shp->sh_offset = off; shp->sh_size = dof->dofh_filesz; @@ -1874,7 +1878,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, #endif (void) snprintf(drti, sizeof (drti), "/usr/lib%s/dtrace/drti.o", - use_32 ? "32":""); + use_32 ? "32" : ""); len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile, drti) + 1; @@ -1885,26 +1889,61 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, drti); #endif if ((status = system(cmd)) == -1) { - ret = dt_link_error(dtp, NULL, -1, NULL, + ret = dt_link_error(dtp, NULL, fd, NULL, "failed to run %s: %s", dtp->dt_ld_path, strerror(errno)); goto done; } if (WIFSIGNALED(status)) { - ret = dt_link_error(dtp, NULL, -1, NULL, + ret = dt_link_error(dtp, NULL, fd, NULL, "failed to link %s: %s failed due to signal %d", file, dtp->dt_ld_path, WTERMSIG(status)); goto done; } if (WEXITSTATUS(status) != 0) { - ret = dt_link_error(dtp, NULL, -1, NULL, + ret = dt_link_error(dtp, NULL, fd, NULL, "failed to link %s: %s exited with status %d\n", file, dtp->dt_ld_path, WEXITSTATUS(status)); goto done; } (void) close(fd); /* release temporary file */ + +#ifdef __FreeBSD__ + /* + * Now that we've linked drti.o, reduce the global __SUNW_dof + * symbol to a local symbol. This is needed to so that multiple + * generated object files (for different providers, for + * instance) can be linked together. This is accomplished using + * the -Blocal flag with Sun's linker, but GNU ld doesn't appear + * to have an equivalent option. + */ + asprintf(&cmd, "%s --localize-hidden %s", dtp->dt_objcopy_path, + file); + if ((status = system(cmd)) == -1) { + ret = dt_link_error(dtp, NULL, -1, NULL, + "failed to run %s: %s", dtp->dt_objcopy_path, + strerror(errno)); + free(cmd); + goto done; + } + free(cmd); + + if (WIFSIGNALED(status)) { + ret = dt_link_error(dtp, NULL, -1, NULL, + "failed to link %s: %s failed due to signal %d", + file, dtp->dt_objcopy_path, WTERMSIG(status)); + goto done; + } + + if (WEXITSTATUS(status) != 0) { + ret = dt_link_error(dtp, NULL, -1, NULL, + "failed to link %s: %s exited with status %d\n", + file, dtp->dt_objcopy_path, WEXITSTATUS(status)); + goto done; + } +#endif } else { (void) close(fd); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index b8b146732a89..c95224373bcd 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -785,6 +785,7 @@ const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */ #else const char *_dtrace_defcpp = "cpp"; /* default cpp(1) to invoke */ const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */ +const char *_dtrace_defobjcopy = "objcopy"; /* default objcopy(1) to invoke */ #endif const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */ @@ -1185,6 +1186,9 @@ dt_vopen(int version, int flags, int *errp, dtp->dt_cpp_argc = 1; dtp->dt_cpp_args = 1; dtp->dt_ld_path = strdup(_dtrace_defld); +#ifdef __FreeBSD__ + dtp->dt_objcopy_path = strdup(_dtrace_defobjcopy); +#endif dtp->dt_provmod = provmod; dtp->dt_vector = vector; dtp->dt_varg = arg; @@ -1193,6 +1197,9 @@ dt_vopen(int version, int flags, int *errp, if (dtp->dt_mods == NULL || dtp->dt_provs == NULL || dtp->dt_procs == NULL || dtp->dt_ld_path == NULL || +#ifdef __FreeBSD__ + dtp->dt_objcopy_path == NULL || +#endif dtp->dt_cpp_path == NULL || dtp->dt_cpp_argv == NULL) return (set_open_errno(dtp, errp, EDT_NOMEM)); @@ -1673,6 +1680,9 @@ dtrace_close(dtrace_hdl_t *dtp) free(dtp->dt_cpp_argv); free(dtp->dt_cpp_path); free(dtp->dt_ld_path); +#ifdef __FreeBSD__ + free(dtp->dt_objcopy_path); +#endif free(dtp->dt_mods); free(dtp->dt_provs); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c index e9164d09a857..758422e3407f 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c @@ -280,6 +280,28 @@ dt_opt_ld_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) return (0); } +#ifdef __FreeBSD__ +static int +dt_opt_objcopy_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) +{ + char *objcopy; + + if (arg == NULL) + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + + if (dtp->dt_pcb != NULL) + return (dt_set_errno(dtp, EDT_BADOPTCTX)); + + if ((objcopy = strdup(arg)) == NULL) + return (dt_set_errno(dtp, EDT_NOMEM)); + + free(dtp->dt_objcopy_path); + dtp->dt_objcopy_path = objcopy; + + return (0); +} +#endif + /*ARGSUSED*/ static int dt_opt_libdir(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) @@ -960,6 +982,9 @@ static const dt_option_t _dtrace_ctoptions[] = { { "linkmode", dt_opt_linkmode }, { "linktype", dt_opt_linktype }, { "nolibs", dt_opt_cflags, DTRACE_C_NOLIBS }, +#ifdef __FreeBSD__ + { "objcopypath", dt_opt_objcopy_path }, +#endif { "pgmax", dt_opt_pgmax }, { "pspec", dt_opt_cflags, DTRACE_C_PSPEC }, { "setenv", dt_opt_setenv, 1 }, diff --git a/etc/network.subr b/etc/network.subr index b8e06544ff90..73ed57536317 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -754,7 +754,7 @@ ipv6_down() IFS="$_ifs" for _inet6 in $inetList ; do # get rid of extraneous line - case $_inet in + case $_inet6 in inet6\ *) ;; *) continue ;; esac diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c index 5feab889154f..cebbaf9e344f 100644 --- a/lib/libc/rpc/clnt_dg.c +++ b/lib/libc/rpc/clnt_dg.c @@ -327,7 +327,7 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) struct sockaddr *sa; sigset_t mask; sigset_t newmask; - socklen_t inlen, salen; + socklen_t salen; ssize_t recvlen = 0; int kin_len, n, rpc_lock_value; u_int32_t xid; @@ -520,7 +520,6 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) goto call_again_same_xid; } } - inlen = (socklen_t)recvlen; /* * now decode and validate the response diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c index d7702f5913be..febc597c5d94 100644 --- a/lib/libc/rpc/rpc_soc.c +++ b/lib/libc/rpc/rpc_soc.c @@ -462,12 +462,10 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) u_int recvsz; { struct netbuf *svcaddr; - struct netconfig *nconf; CLIENT *cl; int len; cl = NULL; - nconf = NULL; svcaddr = NULL; if ((raddr->sun_len == 0) || ((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) || diff --git a/lib/libc/stdio/xprintf_float.c b/lib/libc/stdio/xprintf_float.c index b719aacc2fbd..ad17eb272032 100644 --- a/lib/libc/stdio/xprintf_float.c +++ b/lib/libc/stdio/xprintf_float.c @@ -168,7 +168,6 @@ __printf_render_float(struct __printf_io *io, const struct printf_info *pi, cons int realsz; /* field size expanded by dprec, sign, etc */ int dprec; /* a copy of prec if [diouxX], 0 otherwise */ char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */ - int prsize; /* max size of printed field */ int ret; /* return value accumulator */ char *decimal_point; /* locale specific decimal point */ int n2; /* XXX: for PRINTANDPAD */ @@ -344,8 +343,6 @@ __printf_render_float(struct __printf_io *io, const struct printf_info *pi, cons if (ox[1]) realsz += 2; - prsize = pi->width > realsz ? pi->width : realsz; - /* right-adjusting blank padding */ if (pi->pad != '0' && pi->left == 0) ret += __printf_pad(io, pi->width - realsz, 0); diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index 7380a7fb3f31..c818342dfb6d 100644 --- a/lib/libc/sys/mmap.2 +++ b/lib/libc/sys/mmap.2 @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd September 17, 2014 +.Dd February 18, 2015 .Dt MMAP 2 .Os .Sh NAME @@ -160,7 +160,7 @@ is specified, must be a multiple of the pagesize. If .Dv MAP_EXCL -is not specified, a successfull +is not specified, a successful .Dv MAP_FIXED request replaces any previous mappings for the process' pages in the range from @@ -225,7 +225,7 @@ it. You can test file fragmentation by observing the KB/t (kilobytes per transfer) results from an .Dq Li iostat 1 -while reading a large file sequentially, e.g.\& using +while reading a large file sequentially, e.g.,\& using .Dq Li dd if=filename of=/dev/null bs=32k . .Pp The @@ -448,17 +448,3 @@ was specified and insufficient memory was available. .Xr munmap 2 , .Xr getpagesize 3 , .Xr getpagesizes 3 -.Sh BUGS -The -.Fa len -argument -is limited to the maximum file size or available userland address -space. -Files may not be able to be made more than 1TB large on 32 bit systems -due to file systems restrictions and bugs, but address space is far more -restrictive. -Larger files may be possible on 64 bit systems. -.Pp -The previous documented limit of 2GB was a documentation bug. -That limit has not existed since -.Fx 2.2 . diff --git a/release/Makefile b/release/Makefile index 0a3f50972d15..e469307068dd 100644 --- a/release/Makefile +++ b/release/Makefile @@ -33,18 +33,12 @@ # with xz(1) (extremely time consuming) # WITH_CLOUDWARE: if set, build cloud hosting disk images with the release # TARGET/TARGET_ARCH: architecture of built release -# XZ_FLAGS: Additional arguments to pass to xz(1) -# XZ_THREADS: Number of xz(1) threads to use -# NO_XZTHREADS: Disable multi-threaded xz(1) compression # WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports DOCDIR?= /usr/doc RELNOTES_LANG?= en_US.ISO8859-1 -XZCMD?= /usr/bin/xz -XZ_FLAGS?= -XZ_THREADS?= .if !defined(TARGET) || empty(TARGET) TARGET= ${MACHINE} @@ -59,15 +53,6 @@ TARGET_ARCH= ${TARGET} IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} DISTDIR= dist -.if !defined(NO_XZTHREADS) && empty(XZ_THREADS) -XZ_THREADS= 0 -.else -XZ_THREADS= ${XZ_THREADS} -.endif -.if !empty(XZ_THREADS) -XZ_FLAGS+= -T ${XZ_THREADS} -.endif - # Define OSRELEASE by using newvars.sh .if !defined(OSRELEASE) || empty(OSRELEASE) .for _V in TYPE BRANCH REVISION @@ -158,16 +143,18 @@ kernel.txz: src.txz: mkdir -p ${DISTDIR}/usr ln -fs ${WORLDDIR} ${DISTDIR}/usr/src - cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ - --exclude .git --exclude @ --exclude usr/src/release/dist usr/src + cd ${DISTDIR} && tar cLvf - --exclude .svn --exclude .zfs \ + --exclude .git --exclude @ --exclude usr/src/release/dist usr/src | \ + ${XZ_CMD} > ${.OBJDIR}/src.txz ports.txz: mkdir -p ${DISTDIR}/usr ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports - cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ + cd ${DISTDIR} && tar cLvf - \ --exclude .git --exclude .svn \ --exclude usr/ports/distfiles --exclude usr/ports/packages \ - --exclude 'usr/ports/INDEX*' --exclude work usr/ports + --exclude 'usr/ports/INDEX*' --exclude work usr/ports | \ + ${XZ_CMD} > ${.OBJDIR}/ports.txz reldoc: cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ @@ -309,7 +296,7 @@ release-install: .for I in ${IMAGES} cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} . if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) - ${XZCMD} ${XZ_FLAGS} -k ${DESTDIR}/${OSRELEASE}-${I} + ${XZ_CMD} -k ${DESTDIR}/${OSRELEASE}-${I} . endif .endfor cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 diff --git a/release/Makefile.vm b/release/Makefile.vm index 34f31665fbce..50365f579eb3 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -101,7 +101,7 @@ vm-install: # the DESTDIR. . for FORMAT in ${VMFORMATS} # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. - ${XZCMD} ${XZ_FLAGS} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} + ${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} . endfor . endif cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \ diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index b84ee5357a89..45b82852f626 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -7404,7 +7404,7 @@ getdevid(struct cam_devitem *item) retry: ccb->ccb_h.func_code = XPT_DEV_ADVINFO; ccb->ccb_h.flags = CAM_DIR_IN; - ccb->cdai.flags = 0; + ccb->cdai.flags = CDAI_FLAG_NONE; ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID; ccb->cdai.bufsiz = item->device_id_len; if (item->device_id_len != 0) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index a43df822917b..407158ca5302 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -121,10 +121,7 @@ ${_YC:R}.o: ${_YC} .endfor # DTrace probe definitions -# libelf is currently needed for drti.o .if ${SRCS:M*.d} -LDADD+= -lelf -DPADD+= ${LIBELF} CFLAGS+= -I${.OBJDIR} .endif .for _DSRC in ${SRCS:M*.d:N*/*} diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index d84747e45767..cff4ea7b5bbc 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -131,6 +131,7 @@ LIBVMMAPI?= ${DESTDIR}${LIBDIR}/libvmmapi.a LIBWIND?= ${DESTDIR}${LIBDIR}/libwind.a LIBWRAP?= ${DESTDIR}${LIBDIR}/libwrap.a LIBXPG4?= ${DESTDIR}${LIBDIR}/libxpg4.a +LIBXO?= ${DESTDIR}${LIBDIR}/libxo.a LIBY?= ${DESTDIR}${LIBDIR}/liby.a LIBYPCLNT?= ${DESTDIR}${LIBDIR}/libypclnt.a LIBZ?= ${DESTDIR}${LIBDIR}/libz.a diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index ca77f859705f..0e85b9cb52dd 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -234,6 +234,15 @@ STRIP?= -s COMPRESS_CMD?= gzip -cn COMPRESS_EXT?= .gz +# Set XZ_THREADS to 1 to disable multi-threading. +XZ_THREADS?= 0 + +.if !empty(XZ_THREADS) +XZ_CMD?= xz -T ${XZ_THREADS} +.else +XZ_CMD?= xz +.endif + # Pointer to the top directory into which tests are installed. Should not be # overriden by Makefiles, but the user may choose to set this in src.conf(5). TESTSBASE?= /usr/tests diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 04e7b9de07b6..29b236e74dec 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -128,7 +128,10 @@ CWARNFLAGS+= -Wno-unknown-pragmas CLANG_NO_IAS= -no-integrated-as .endif CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\ - -mllvm -simplifycfg-dup-ret -mllvm -enable-gvn=false + -mllvm -simplifycfg-dup-ret -mllvm +.if ${COMPILER_VERSION} > 30400 +CLANG_OPT_SMALL+= -enable-gvn=false +.endif CFLAGS.clang+= -Qunused-arguments .if ${MACHINE_CPUARCH} == "sparc64" # Don't emit .cfi directives, since we must use GNU as on sparc64, for now. diff --git a/sys/amd64/amd64/ptrace_machdep.c b/sys/amd64/amd64/ptrace_machdep.c index c96fe263db92..4cd5bf286a0b 100644 --- a/sys/amd64/amd64/ptrace_machdep.c +++ b/sys/amd64/amd64/ptrace_machdep.c @@ -88,7 +88,8 @@ cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data) break; case PT_SETXSTATE: - if (data > cpu_max_ext_state_size) { + if (data < sizeof(struct savefpu) || + data > cpu_max_ext_state_size) { error = EINVAL; break; } diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c index 1719ec5b90ce..bd2422d1cac0 100644 --- a/sys/arm/arm/db_trace.c +++ b/sys/arm/arm/db_trace.c @@ -66,7 +66,7 @@ db_stack_trace_cmd(struct unwind_state *state) finished = false; while (!finished) { - finished = unwind_stack_one(state); + finished = unwind_stack_one(state, 0); /* Print the frame details */ sym = db_search_symbol(state->start_pc, DB_STGY_ANY, &offset); diff --git a/sys/arm/arm/unwind.c b/sys/arm/arm/unwind.c index 29f8200b5cb6..25fd20003ecf 100644 --- a/sys/arm/arm/unwind.c +++ b/sys/arm/arm/unwind.c @@ -33,9 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include "linker_if.h" + /* * Definitions for the instruction interpreter. * @@ -61,7 +64,7 @@ __FBSDID("$FreeBSD$"); * These are set in the linker script. Their addresses will be * either the start or end of the exception table or index. */ -extern int extab_start, extab_end, exidx_start, exidx_end; +extern int exidx_start, exidx_end; /* * Entry types. @@ -104,13 +107,47 @@ expand_prel31(uint32_t prel31) return ((int32_t)(prel31 & 0x7fffffffu) << 1) / 2; } +struct search_context { + uint32_t addr; + caddr_t exidx_start; + caddr_t exidx_end; +}; + +static int +module_search(linker_file_t lf, void *context) +{ + struct search_context *sc = context; + linker_symval_t symval; + c_linker_sym_t sym; + + if (lf->address <= (caddr_t)sc->addr && + (lf->address + lf->size) >= (caddr_t)sc->addr) { + if ((LINKER_LOOKUP_SYMBOL(lf, "__exidx_start", &sym) == 0 || + LINKER_LOOKUP_SYMBOL(lf, "exidx_start", &sym) == 0) && + LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) + sc->exidx_start = symval.value; + + if ((LINKER_LOOKUP_SYMBOL(lf, "__exidx_end", &sym) == 0 || + LINKER_LOOKUP_SYMBOL(lf, "exidx_end", &sym) == 0) && + LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) + sc->exidx_end = symval.value; + + if (sc->exidx_start != NULL && sc->exidx_end != NULL) + return (1); + panic("Invalid module %s, no unwind tables\n", lf->filename); + } + return (0); +} + /* * Perform a binary search of the index table to find the function * with the largest address that doesn't exceed addr. */ static struct unwind_idx * -find_index(uint32_t addr) +find_index(uint32_t addr, int search_modules) { + struct search_context sc; + caddr_t idx_start, idx_end; unsigned int min, mid, max; struct unwind_idx *start; struct unwind_idx *item; @@ -118,9 +155,23 @@ find_index(uint32_t addr) uint32_t func_addr; start = (struct unwind_idx *)&exidx_start; + idx_start = (caddr_t)&exidx_start; + idx_end = (caddr_t)&exidx_end; + + /* This may acquire a lock */ + if (search_modules) { + bzero(&sc, sizeof(sc)); + sc.addr = addr; + if (linker_file_foreach(module_search, &sc) != 0 && + sc.exidx_start != NULL && sc.exidx_end != NULL) { + start = (struct unwind_idx *)sc.exidx_start; + idx_start = sc.exidx_start; + idx_end = sc.exidx_end; + } + } min = 0; - max = (&exidx_end - &exidx_start) / 2; + max = (idx_end - idx_start) / sizeof(struct unwind_idx); while (min != max) { mid = min + (max - min + 1) / 2; @@ -332,7 +383,7 @@ unwind_tab(struct unwind_state *state) } int -unwind_stack_one(struct unwind_state *state) +unwind_stack_one(struct unwind_state *state, int can_lock) { struct unwind_idx *index; int finished; @@ -344,7 +395,7 @@ unwind_stack_one(struct unwind_state *state) state->start_pc = state->registers[PC]; /* Find the item to run */ - index = find_index(state->start_pc); + index = find_index(state->start_pc, can_lock); finished = 0; if (index->insn != EXIDX_CANTUNWIND) { diff --git a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c index 97256f71d73f..6fff6d80c203 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2012 Oleksandr Tymoshenko - * Copyright (c) 2012 Luiz Otavio O Souza. + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012-2015 Luiz Otavio O Souza * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -251,16 +251,14 @@ bcm_gpio_set_function(struct bcm_gpio_softc *sc, uint32_t pin, uint32_t f) static void bcm_gpio_set_pud(struct bcm_gpio_softc *sc, uint32_t pin, uint32_t state) { - uint32_t bank, offset; + uint32_t bank; /* Must be called with lock held. */ BCM_GPIO_LOCK_ASSERT(sc); - bank = pin / 32; - offset = pin - 32 * bank; - + bank = BCM_GPIO_BANK(pin); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), state); - BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), (1 << offset)); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), BCM_GPIO_MASK(pin)); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), 0); BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0); } @@ -438,29 +436,25 @@ static int bcm_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { struct bcm_gpio_softc *sc = device_get_softc(dev); - uint32_t bank, offset; + uint32_t bank, reg; int i; for (i = 0; i < sc->sc_gpio_npins; i++) { if (sc->sc_gpio_pins[i].gp_pin == pin) break; } - if (i >= sc->sc_gpio_npins) return (EINVAL); - /* We never write to read-only/reserved pins. */ if (bcm_gpio_pin_is_ro(sc, pin)) return (EINVAL); - - bank = pin / 32; - offset = pin - 32 * bank; - BCM_GPIO_LOCK(sc); + bank = BCM_GPIO_BANK(pin); if (value) - BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1 << offset)); + reg = BCM_GPIO_GPSET(bank); else - BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1 << offset)); + reg = BCM_GPIO_GPCLR(bank); + BCM_GPIO_WRITE(sc, reg, BCM_GPIO_MASK(pin)); BCM_GPIO_UNLOCK(sc); return (0); @@ -470,24 +464,20 @@ static int bcm_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) { struct bcm_gpio_softc *sc = device_get_softc(dev); - uint32_t bank, offset, reg_data; + uint32_t bank, reg_data; int i; for (i = 0; i < sc->sc_gpio_npins; i++) { if (sc->sc_gpio_pins[i].gp_pin == pin) break; } - if (i >= sc->sc_gpio_npins) return (EINVAL); - - bank = pin / 32; - offset = pin - 32 * bank; - + bank = BCM_GPIO_BANK(pin); BCM_GPIO_LOCK(sc); reg_data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); BCM_GPIO_UNLOCK(sc); - *val = (reg_data & (1 << offset)) ? 1 : 0; + *val = (reg_data & BCM_GPIO_MASK(pin)) ? 1 : 0; return (0); } @@ -496,30 +486,26 @@ static int bcm_gpio_pin_toggle(device_t dev, uint32_t pin) { struct bcm_gpio_softc *sc = device_get_softc(dev); - uint32_t bank, data, offset; + uint32_t bank, data, reg; int i; for (i = 0; i < sc->sc_gpio_npins; i++) { if (sc->sc_gpio_pins[i].gp_pin == pin) break; } - if (i >= sc->sc_gpio_npins) return (EINVAL); - /* We never write to read-only/reserved pins. */ if (bcm_gpio_pin_is_ro(sc, pin)) return (EINVAL); - - bank = pin / 32; - offset = pin - 32 * bank; - BCM_GPIO_LOCK(sc); + bank = BCM_GPIO_BANK(pin); data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); - if (data & (1 << offset)) - BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1 << offset)); + if (data & BCM_GPIO_MASK(pin)) + reg = BCM_GPIO_GPCLR(bank); else - BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1 << offset)); + reg = BCM_GPIO_GPSET(bank); + BCM_GPIO_WRITE(sc, reg, BCM_GPIO_MASK(pin)); BCM_GPIO_UNLOCK(sc); return (0); diff --git a/sys/arm/include/stack.h b/sys/arm/include/stack.h index c76ad660eac1..9721b0ca0403 100644 --- a/sys/arm/include/stack.h +++ b/sys/arm/include/stack.h @@ -55,6 +55,6 @@ struct unwind_state { #define LR 14 #define PC 15 -int unwind_stack_one(struct unwind_state *); +int unwind_stack_one(struct unwind_state *, int); #endif /* !_MACHINE_STACK_H_ */ diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 61b7a2f3f6e0..b4fe54371bd6 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -1140,6 +1140,7 @@ struct ccb_eng_exec { /* This structure must match SCSIIO size */ struct ccb_dev_advinfo { struct ccb_hdr ccb_h; uint32_t flags; +#define CDAI_FLAG_NONE 0x0 /* No flags set */ #define CDAI_FLAG_STORE 0x1 /* If set, action becomes store */ uint32_t buftype; /* IN: Type of data being requested */ /* NB: buftype is interpreted on a per-transport basis */ diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 9b50d7a64e64..7e6e226c39a8 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -3787,7 +3787,7 @@ dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_RCAPLONG; - cdai.flags |= CDAI_FLAG_STORE; + cdai.flags = CDAI_FLAG_STORE; cdai.bufsiz = rcap_len; cdai.buf = (uint8_t *)rcaplong; xpt_action((union ccb *)&cdai); diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index d35b99a6e4c2..223e0e413785 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -1007,7 +1007,7 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element_t *elm, xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; - cdai.flags = 0; + cdai.flags = CDAI_FLAG_NONE; cdai.bufsiz = MAXPATHLEN; cdai.buf = old_physpath; xpt_action((union ccb *)&cdai); @@ -1019,7 +1019,7 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element_t *elm, xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; - cdai.flags |= CDAI_FLAG_STORE; + cdai.flags = CDAI_FLAG_STORE; cdai.bufsiz = sbuf_len(args->physpath); cdai.buf = sbuf_data(args->physpath); xpt_action((union ccb *)&cdai); diff --git a/sys/cddl/dev/dtrace/arm/dtrace_isa.c b/sys/cddl/dev/dtrace/arm/dtrace_isa.c index 7d3dc2e03801..14adb4c3b5d7 100644 --- a/sys/cddl/dev/dtrace/arm/dtrace_isa.c +++ b/sys/cddl/dev/dtrace/arm/dtrace_isa.c @@ -69,9 +69,10 @@ void dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, uint32_t *intrpc) { - u_int32_t *frame, *lastframe; - int scp_offset; - int depth = 0; + struct unwind_state state; + register_t sp; + int scp_offset; + int depth = 0; pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller; if (intrpc != 0) @@ -79,23 +80,17 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, aframes++; - frame = (u_int32_t *)__builtin_frame_address(0);; - lastframe = NULL; - scp_offset = -(get_pc_str_offset() >> 2); + __asm __volatile("mov %0, sp" : "=&r" (sp)); - while ((frame != NULL) && (depth < pcstack_limit)) { - db_addr_t scp; -#if 0 - u_int32_t savecode; - int r; - u_int32_t *rp; -#endif + state.registers[FP] = (uint32_t)__builtin_frame_address(0); + state.registers[SP] = sp; + state.registers[LR] = (uint32_t)__builtin_return_address(0); + state.registers[PC] = (uint32_t)dtrace_getpcstack; - /* - * In theory, the SCP isn't guaranteed to be in the function - * that generated the stack frame. We hope for the best. - */ - scp = frame[FR_SCP]; + while (depth < pcstack_limit) { + int done; + + done = unwind_stack_one(&state, 1); if (aframes > 0) { aframes--; @@ -104,39 +99,10 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, } } else { - pcstack[depth++] = scp; + pcstack[depth++] = state.registers[PC]; } -#if 0 - savecode = ((u_int32_t *)scp)[scp_offset]; - if ((savecode & 0x0e100000) == 0x08000000) { - /* Looks like an STM */ - rp = frame - 4; - for (r = 10; r >= 0; r--) { - if (savecode & (1 << r)) { - /* register r == *rp-- */ - } - } - } -#endif - - /* - * Switch to next frame up - */ - if (frame[FR_RFP] == 0) - break; /* Top of stack */ - - lastframe = frame; - frame = (u_int32_t *)(frame[FR_RFP]); - - if (INKERNEL((int)frame)) { - /* staying in kernel */ - if (frame <= lastframe) { - /* bad frame pointer */ - break; - } - } - else + if (done) break; } @@ -176,55 +142,28 @@ dtrace_getarg(int arg, int aframes) int dtrace_getstackdepth(int aframes) { - u_int32_t *frame, *lastframe; - int scp_offset; - int depth = 1; + struct unwind_state state; + register_t sp; + int scp_offset; + int done = 0; + int depth = 1; - frame = (u_int32_t *)__builtin_frame_address(0);; - lastframe = NULL; - scp_offset = -(get_pc_str_offset() >> 2); + __asm __volatile("mov %0, sp" : "=&r" (sp)); - while (frame != NULL) { - db_addr_t scp; -#if 0 - u_int32_t savecode; - int r; - u_int32_t *rp; -#endif - - /* - * In theory, the SCP isn't guaranteed to be in the function - * that generated the stack frame. We hope for the best. - */ - scp = frame[FR_SCP]; + state.registers[FP] = (uint32_t)__builtin_frame_address(0); + state.registers[SP] = sp; + state.registers[LR] = (uint32_t)__builtin_return_address(0); + state.registers[PC] = (uint32_t)dtrace_getstackdepth; + do { + done = unwind_stack_one(&state, 1); depth++; - - /* - * Switch to next frame up - */ - if (frame[FR_RFP] == 0) - break; /* Top of stack */ - - lastframe = frame; - frame = (u_int32_t *)(frame[FR_RFP]); - - if (INKERNEL((int)frame)) { - /* staying in kernel */ - if (frame <= lastframe) { - /* bad frame pointer */ - break; - } - } - else - break; - } + } while (!done); if (depth < aframes) return 0; else return depth - aframes; - } ulong_t diff --git a/sys/conf/NOTES b/sys/conf/NOTES index b0f18d290fee..8b6a4c8b3c60 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -495,7 +495,7 @@ options KTRACE_REQUEST_POOL=101 options KTR options KTR_BOOT_ENTRIES=1024 options KTR_ENTRIES=(128*1024) -options KTR_COMPILE=(KTR_INTR|KTR_PROC) +options KTR_COMPILE=(KTR_ALL) options KTR_MASK=KTR_INTR options KTR_CPUMASK=0x3 options KTR_VERBOSE diff --git a/sys/conf/config.mk b/sys/conf/config.mk new file mode 100644 index 000000000000..b95b7814813c --- /dev/null +++ b/sys/conf/config.mk @@ -0,0 +1,54 @@ +# $FreeBSD$ +# +# Common code to marry kernel config(8) goo and module building goo. +# + +# Generate options files that otherwise would be built +# in substantially similar ways through the tree. Move +# the code here when they all produce identical results +# (or should) +.if !defined(KERNBUILDDIR) +opt_bpf.h: + echo "#define DEV_BPF 1" > ${.TARGET} +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} + @echo "#define TCP_OFFLOAD 1" >> ${.TARGET} +.endif +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.if ${MK_EISA} != "no" +opt_eisa.h: + @echo "#define DEV_EISA 1" > ${.TARGET} +.endif +opt_mrouting.h: + echo "#define MROUTING 1" > ${.TARGET} +opt_natm.h: + echo "#define NATM 1" > ${.TARGET} +opt_scsi.h: + echo "#define SCSI_DELAY 15000" > ${.TARGET} +opt_wlan.h: + echo "#define IEEE80211_DEBUG 1" > ${.TARGET} + echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} + echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} +KERN_OPTS.i386=NEW_PCIB DEV_PCI +KERN_OPTS.pc98=NEW_PCIB DEV_PCI +KERN_OPTS.amd64=NEW_PCIB DEV_PCI +KERN_OPTS.powerpc=NEW_PCIB DEV_PCI +KERN_OPTS=MROUTING NATM IEEE80211_DEBUG \ + IEEE80211_AMPDU_AGE IEEE80211_SUPPORT_MESH DEV_BPF \ + ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} +.if ${MK_INET_SUPPORT} != "no" +KERN_OPTS+= INET TCP_OFFLOAD +.endif +.if ${MK_INET6_SUPPORT} != "no" +KERN_OPTS+= INET6 +.endif +.if ${MK_EISA} != "no" +KERN_OPTS+= DEV_EISA +.endif +.else +KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u +.endif diff --git a/sys/conf/files b/sys/conf/files index c08e40c469ba..3bd8e978e8c1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -271,6 +271,7 @@ contrib/dev/acpica/components/debugger/dbtest.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbutils.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbxface.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmbuffer.c optional acpi acpi_debug +contrib/dev/acpica/components/disassembler/dmcstyle.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmdeferred.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmnames.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmopcode.c optional acpi acpi_debug diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 7fbccd1db4c0..9556e502fcbb 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -57,7 +57,7 @@ arm/arm/trap.c optional !armv6 arm/arm/trap-v6.c optional armv6 arm/arm/uio_machdep.c standard arm/arm/undefined.c standard -arm/arm/unwind.c optional ddb +arm/arm/unwind.c optional ddb | kdtrace_hooks arm/arm/vm_machdep.c standard arm/arm/vfp.c standard board_id.h standard \ diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 91d4f494d3c1..b6b01e572006 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -70,6 +70,7 @@ OBJCOPY?= objcopy # do this after bsd.own.mk. .include "kern.opts.mk" .include +.include "config.mk" .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S @@ -124,6 +125,7 @@ CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .if ${MACHINE_CPUARCH} == arm CFLAGS.clang+= -mllvm -arm-use-movt=0 CFLAGS.clang+= -mfpu=none +CFLAGS+= -funwind-tables .endif .if ${MACHINE_CPUARCH} == powerpc @@ -163,6 +165,11 @@ OBJS+= ${_firmw:C/\:.*$/.fwo/} .endfor .endif +# Conditionally include SRCS based on kernel config options. +.for _o in ${KERN_OPTS} +SRCS+=${SRCS.${_o}} +.endfor + OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if !defined(PROG) @@ -316,34 +323,6 @@ unload: ${KMODUNLOAD} -v ${PROG} .endif -# Generate options files that otherwise would be built -# in substantially similar ways through the tree. Move -# the code here when they all produce identical results -# (or should) -.if !defined(KERNBUILDDIR) -opt_bpf.h: - echo "#define DEV_BPF 1" > ${.TARGET} -.if ${MK_INET_SUPPORT} != "no" -opt_inet.h: - @echo "#define INET 1" > ${.TARGET} - @echo "#define TCP_OFFLOAD 1" >> ${.TARGET} -.endif -.if ${MK_INET6_SUPPORT} != "no" -opt_inet6.h: - @echo "#define INET6 1" > ${.TARGET} -.endif -opt_mrouting.h: - echo "#define MROUTING 1" > ${.TARGET} -opt_natm.h: - echo "#define NATM 1" > ${.TARGET} -opt_scsi.h: - echo "#define SCSI_DELAY 15000" > ${.TARGET} -opt_wlan.h: - echo "#define IEEE80211_DEBUG 1" > ${.TARGET} - echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} - echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} -.endif - .if defined(KERNBUILDDIR) .PATH: ${KERNBUILDDIR} CFLAGS+= -I${KERNBUILDDIR} diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 1c2b1edbae9c..0469af08e1ba 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,222 @@ +---------------------------------------- +04 February 2015. Summary of changes for version 20150204: + +This release is available at https://acpica.org/downloads + +ACPICA kernel-resident subsystem: + +Updated all ACPICA copyrights and signons to 2014. Added the 2014 +copyright to all module headers and signons, including the standard Linux +header. This affects virtually every file in the ACPICA core subsystem, +iASL compiler, all ACPICA utilities, and the test suites. + +Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues. +A raw gpe handling mechanism was created to allow better handling of GPE +storms that aren't easily managed by the normal handler. The raw handler +allows disabling/renabling of the the GPE so that interrupt storms can be +avoided in cases where events cannot be timely serviced. In this scenario, +handlers should use the AcpiSetGpe() API to disable/enable the GPE. This API +will leave the reference counts undisturbed, thereby preventing unintentional +clearing of the GPE when the intent in only to temporarily disable it. Raw +handlers allow enabling and disabling of a GPE by removing GPE register +locking. As such, raw handlers much provide their own locks while using +GPE API's to protect access to GPE data structures. +Lv Zheng + +Events: Always modify GPE registers under the GPE lock. +Applies GPE lock around AcpiFinishGpe() to protect access to GPE register +values. Reported as bug by joe.liu@apple.com. + +Unix makefiles: Separate option to disable optimizations and _FORTIFY_SOURCE. +This change removes the _FORTIFY_SOURCE flag from the NOOPT disable option and +creates a separate flag (NOFORTIFY) for this purpose. Some toolchains may +define _FORTIFY_SOURCE which leads redefined errors when building ACPICA. This +allows disabling the option without also having to disable optimazations. +David Box + + Current Release: + Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total + Debug Version: 199.2K Code, 82.4K Data, 281.6K Total + +---------------------------------------- +07 November 2014. Summary of changes for version 20141107: + +This release is available at https://acpica.org/downloads + +This release introduces and implements language extensions to ASL that +provide support for symbolic ("C-style") operators and expressions. These +language extensions are known collectively as ASL+. + + +1) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with disassembly of the UartSerialBus +macro. Changed "StopBitsNone" to the correct "StopBitsZero". David E. +Box. + +Disassembler: Fixed the Unicode macro support to add escape sequences. +All non-printable ASCII values are emitted as escape sequences, as well +as the standard escapes for quote and backslash. Ensures that the +disassembled macro can be correctly recompiled. + +iASL: Added Printf/Fprintf macros for formatted output. These macros are +translated to existing AML Concatenate and Store operations. Printf +writes to the ASL Debug object. Fprintf allows the specification of an +ASL name as the target. Only a single format specifier is required, %o, +since the AML interpreter dynamically converts objects to the required +type. David E. Box. + + (old) Store (Concatenate (Concatenate (Concatenate (Concatenate + (Concatenate (Concatenate (Concatenate ("", Arg0), + ": Unexpected value for "), Arg1), ", "), Arg2), + " at line "), Arg3), Debug) + + (new) Printf ("%o: Unexpected value for %o, %o at line %o", + Arg0, Arg1, Arg2, Arg3) + + (old) Store (Concatenate (Concatenate (Concatenate (Concatenate + ("", Arg1), ": "), Arg0), " Successful"), STR1) + + (new) Fprintf (STR1, "%o: %o Successful", Arg1, Arg0) + +iASL: Added debug options (-bp, -bt) to dynamically prune levels of the +ASL parse tree before the AML code is generated. This allows blocks of +ASL code to be removed in order to help locate and identify problem +devices and/or code. David E. Box. + +AcpiExec: Added support (-fi) for an optional namespace object +initialization file. This file specifies initial values for namespace +objects as necessary for debugging and testing different ASL code paths +that may be taken as a result of BIOS options. + + +2) Overview of symbolic operator support for ASL (ASL+) +------------------------------------------------------- + +As an extension to the ASL language, iASL implements support for symbolic +(C-style) operators for math and logical expressions. This can greatly +simplify ASL code as well as improve both readability and +maintainability. These language extensions can exist concurrently with +all legacy ASL code and expressions. + +The symbolic extensions are 100% compatible with existing AML +interpreters, since no new AML opcodes are created. To implement the +extensions, the iASL compiler transforms the symbolic expressions into +the legacy ASL/AML equivalents at compile time. + +Full symbolic expressions are supported, along with the standard C +precedence and associativity rules. + +Full disassembler support for the symbolic expressions is provided, and +creates an automatic migration path for existing ASL code to ASL+ code +via the disassembly process. By default, the disassembler now emits ASL+ +code with symbolic expressions. An option (-dl) is provided to force the +disassembler to emit legacy ASL code if desired. + +Below is the complete list of the currently supported symbolic operators +with examples. See the iASL User Guide for additional information. + + +ASL+ Syntax Legacy ASL Equivalent +----------- --------------------- + + // Math operators + +Z = X + Y Add (X, Y, Z) +Z = X - Y Subtract (X, Y, Z) +Z = X * Y Multiply (X, Y, Z) +Z = X / Y Divide (X, Y, , Z) +Z = X % Y Mod (X, Y, Z) +Z = X << Y ShiftLeft (X, Y, Z) +Z = X >> Y ShiftRight (X, Y, Z) +Z = X & Y And (X, Y, Z) +Z = X | Y Or (X, Y, Z) +Z = X ^ Y Xor (X, Y, Z) +Z = ~X Not (X, Z) +X++ Increment (X) +X-- Decrement (X) + + // Logical operators + +(X == Y) LEqual (X, Y) +(X != Y) LNotEqual (X, Y) +(X < Y) LLess (X, Y) +(X > Y) LGreater (X, Y) +(X <= Y) LLessEqual (X, Y) +(X >= Y) LGreaterEqual (X, Y) +(X && Y) LAnd (X, Y) +(X || Y) LOr (X, Y) +(!X) LNot (X) + + // Assignment and compound assignment operations + +X = Y Store (Y, X) +X += Y Add (X, Y, X) +X -= Y Subtract (X, Y, X) +X *= Y Multiply (X, Y, X) +X /= Y Divide (X, Y, , X) +X %= Y Mod (X, Y, X) +X <<= Y ShiftLeft (X, Y, X) +X >>= Y ShiftRight (X, Y, X) +X &= Y And (X, Y, X) +X |= Y Or (X, Y, X) +X ^= Y Xor (X, Y, X) + + +3) ASL+ Examples: +----------------- + +Legacy ASL: + If (LOr (LOr (LEqual (And (R510, 0x03FB), 0x02E0), LEqual ( + And (R520, 0x03FB), 0x02E0)), LOr (LEqual (And (R530, +0x03FB), + 0x02E0), LEqual (And (R540, 0x03FB), 0x02E0)))) + { + And (MEMB, 0xFFFFFFF0, SRMB) + Store (MEMB, Local2) + Store (PDBM, Local1) + And (PDBM, 0xFFFFFFFFFFFFFFF9, PDBM) + Store (SRMB, MEMB) + Or (PDBM, 0x02, PDBM) + } + +ASL+ version: + If (((R510 & 0x03FB) == 0x02E0) || + ((R520 & 0x03FB) == 0x02E0) || + ((R530 & 0x03FB) == 0x02E0) || + ((R540 & 0x03FB) == 0x02E0)) + { + SRMB = (MEMB & 0xFFFFFFF0) + Local2 = MEMB + Local1 = PDBM + PDBM &= 0xFFFFFFFFFFFFFFF9 + MEMB = SRMB + PDBM |= 0x02 + } + +Legacy ASL: + Store (0x1234, Local1) + Multiply (Add (Add (Local1, TEST), 0x20), Local2, Local3) + Multiply (Local2, Add (Add (Local1, TEST), 0x20), Local3) + Add (Local1, Add (TEST, Multiply (0x20, Local2)), Local3) + Store (Index (PKG1, 0x03), Local6) + Store (Add (Local3, Local2), Debug) + Add (Local1, 0x0F, Local2) + Add (Local1, Multiply (Local2, Local3), Local2) + Multiply (Add (Add (Local1, TEST), 0x20), ToBCD (Local1), Local3) + +ASL+ version: + Local1 = 0x1234 + Local3 = (((Local1 + TEST) + 0x20) * Local2) + Local3 = (Local2 * ((Local1 + TEST) + 0x20)) + Local3 = (Local1 + (TEST + (0x20 * Local2))) + Local6 = Index (PKG1, 0x03) + Debug = (Local3 + Local2) + Local2 = (Local1 + 0x0F) + Local2 = (Local1 + (Local2 * Local3)) + Local3 = (((Local1 + TEST) + 0x20) * ToBCD (Local1)) + + ---------------------------------------- 26 September 2014. Summary of changes for version 20140926: diff --git a/sys/contrib/dev/acpica/common/acgetline.c b/sys/contrib/dev/acpica/common/acgetline.c index f0948df7d4cf..712b4a3f7dd1 100644 --- a/sys/contrib/dev/acpica/common/acgetline.c +++ b/sys/contrib/dev/acpica/common/acgetline.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index ed5dc99bad3c..edf451323999 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index dd1a93dc8034..2212450320c5 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -357,8 +357,12 @@ AdAmlDisassemble ( AcpiDmDumpDataTable (Table); fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", Table->Signature); - fprintf (stderr, "Formatted output: %s - %u bytes\n", - DisasmFilename, CmGetFileSize (File)); + + if (File) + { + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, CmGetFileSize (File)); + } } else { @@ -376,8 +380,11 @@ AdAmlDisassemble ( { AcpiOsPrintf ("/**** Before second load\n"); - NsSetupNamespaceListing (File); - NsDisplayNamespace (); + if (File) + { + NsSetupNamespaceListing (File); + NsDisplayNamespace (); + } AcpiOsPrintf ("*****/\n"); } @@ -457,8 +464,11 @@ AdAmlDisassemble ( if (AslCompilerdebug) { AcpiOsPrintf ("/**** After second load and resource conversion\n"); - NsSetupNamespaceListing (File); - NsDisplayNamespace (); + if (File) + { + NsSetupNamespaceListing (File); + NsDisplayNamespace (); + } AcpiOsPrintf ("*****/\n"); AcpiDmDumpTree (AcpiGbl_ParseOpRoot); @@ -487,8 +497,11 @@ AdAmlDisassemble ( AcpiDmDumpDataTable (Table); fprintf (stderr, "Disassembly completed\n"); - fprintf (stderr, "ASL Output: %s - %u bytes\n", - DisasmFilename, CmGetFileSize (File)); + if (File) + { + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, CmGetFileSize (File)); + } if (Gbl_MapfileFlag) { @@ -507,7 +520,7 @@ AdAmlDisassemble ( ACPI_FREE (Table); } - if (OutToFile && File) + if (File) { if (AslCompilerdebug) /* Display final namespace, with transforms */ { @@ -544,12 +557,26 @@ AdDisassemblerHeader ( { time_t Timer; + time (&Timer); /* Header and input table info */ AcpiOsPrintf ("/*\n"); - AcpiOsPrintf (ACPI_COMMON_HEADER ("AML Disassembler", " * ")); + AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * ")); + + if (AcpiGbl_CstyleDisassembly) + { + AcpiOsPrintf ( + " * Disassembling to symbolic ASL+ operators\n" + " *\n"); + } + else + { + AcpiOsPrintf ( + " * Disassembling to non-symbolic legacy ASL operators\n" + " *\n"); + } AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); AcpiOsPrintf (" *\n"); diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c index df0222dfc32d..b1dcf87e5aa0 100644 --- a/sys/contrib/dev/acpica/common/adwalk.c +++ b/sys/contrib/dev/acpica/common/adwalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/ahids.c b/sys/contrib/dev/acpica/common/ahids.c index d272fdae8043..038d9f6e94e0 100644 --- a/sys/contrib/dev/acpica/common/ahids.c +++ b/sys/contrib/dev/acpica/common/ahids.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/ahpredef.c b/sys/contrib/dev/acpica/common/ahpredef.c index 4522ca698afa..a84353b3d166 100644 --- a/sys/contrib/dev/acpica/common/ahpredef.c +++ b/sys/contrib/dev/acpica/common/ahpredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/ahuuids.c b/sys/contrib/dev/acpica/common/ahuuids.c index ef53008d44da..a96ab8f4f577 100644 --- a/sys/contrib/dev/acpica/common/ahuuids.c +++ b/sys/contrib/dev/acpica/common/ahuuids.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/cmfsize.c b/sys/contrib/dev/acpica/common/cmfsize.c index 0f9b7385cf52..542b1508194d 100644 --- a/sys/contrib/dev/acpica/common/cmfsize.c +++ b/sys/contrib/dev/acpica/common/cmfsize.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c index f8362e14d4e1..0c262c40c3c9 100644 --- a/sys/contrib/dev/acpica/common/dmextern.c +++ b/sys/contrib/dev/acpica/common/dmextern.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index e1b435b725b8..c457658054e9 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 0b756537cb3f..d33d86ff4904 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 2f88a54e2311..399afa5e9cb6 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index cadb4c4e2c36..6a71c8a17251 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c index cf3eb593c0b7..b93156c022af 100644 --- a/sys/contrib/dev/acpica/common/getopt.c +++ b/sys/contrib/dev/acpica/common/getopt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index acd41bedbc9a..3c3eee8689e9 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslascii.c b/sys/contrib/dev/acpica/compiler/aslascii.c index f8a3980a09bd..e6b3311a3e83 100644 --- a/sys/contrib/dev/acpica/compiler/aslascii.c +++ b/sys/contrib/dev/acpica/compiler/aslascii.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslbtypes.c b/sys/contrib/dev/acpica/compiler/aslbtypes.c index 0ff8664f6f73..0ba219ae805d 100644 --- a/sys/contrib/dev/acpica/compiler/aslbtypes.c +++ b/sys/contrib/dev/acpica/compiler/aslbtypes.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -374,6 +374,12 @@ AnGetBtype ( UINT32 ThisNodeBtype = 0; + if (!Op) + { + AcpiOsPrintf ("Null Op in AnGetBtype\n"); + return (ACPI_UINT32_MAX); + } + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index b462d7beb920..541236a5b4f9 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,6 +107,12 @@ CgGenerateAmlOutput ( TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL); + + DbgPrint (ASL_TREE_OUTPUT, + "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr" + " Parent Child Next Flags AcTyp Final Col L\n", + 76, " "); + CgCloseTable (); } @@ -138,7 +144,8 @@ CgAmlWriteWalk ( DbgPrint (ASL_TREE_OUTPUT, "Final parse tree used for AML output:\n"); DbgPrint (ASL_TREE_OUTPUT, - "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr Child Parent Flags AcTyp Final Col L\n", + "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr" + " Parent Child Next Flags AcTyp Final Col L\n", 76, " "); } @@ -161,7 +168,8 @@ CgAmlWriteWalk ( } DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n", + "%08X %04X %04X %01X %04X %04X %04X %04X " + "%08X %08X %08X %08X %08X %08X %04X %02d %02d\n", /* 1 */ (UINT32) Op->Asl.Value.Integer, /* 2 */ Op->Asl.ParseOpcode, /* 3 */ Op->Asl.AmlOpcode, @@ -171,13 +179,14 @@ CgAmlWriteWalk ( /* 7 */ Op->Asl.AmlSubtreeLength, /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, /* 9 */ Op, - /* 10 */ Op->Asl.Child, - /* 11 */ Op->Asl.Parent, - /* 12 */ Op->Asl.CompileFlags, - /* 13 */ Op->Asl.AcpiBtype, - /* 14 */ Op->Asl.FinalAmlLength, - /* 15 */ Op->Asl.Column, - /* 16 */ Op->Asl.LineNumber); + /* 10 */ Op->Asl.Parent, + /* 11 */ Op->Asl.Child, + /* 12 */ Op->Asl.Next, + /* 13 */ Op->Asl.CompileFlags, + /* 14 */ Op->Asl.AcpiBtype, + /* 15 */ Op->Asl.FinalAmlLength, + /* 16 */ Op->Asl.Column, + /* 17 */ Op->Asl.LineNumber); /* Generate the AML for this node */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index b26c9e890466..cf37c6a032ce 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -118,10 +118,9 @@ CmDoCompile ( AslCompilerparse(); UtEndEvent (Event); - /* Check for parse errors */ + /* Check for parser-detected syntax errors */ - Status = AslCheckForErrorExit (); - if (ACPI_FAILURE (Status)) + if (Gbl_SyntaxError) { fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); LsDumpParseTree (); @@ -147,6 +146,13 @@ CmDoCompile ( Event = UtBeginEvent ("Flush source input"); CmFlushSourceCode (); + /* Prune the parse tree if requested (debug purposes only) */ + + if (Gbl_PruneParseTree) + { + AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType); + } + /* Optional parse tree dump, compiler debug output only */ LsDumpParseTree (); diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 1667d8fedf7c..7fb2088a0522 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -542,6 +542,27 @@ OptOptimizeNamePath ( ACPI_NAMESPACE_NODE *TargetNode); +/* + * aslprintf - Printf/Fprintf macros + */ +void +OpcDoPrintf ( + ACPI_PARSE_OBJECT *Op); + +void +OpcDoFprintf ( + ACPI_PARSE_OBJECT *Op); + + +/* + * aslprune - parse tree pruner + */ +void +AslPruneParseTree ( + UINT32 PruneDepth, + UINT32 Type); + + /* * aslcodegen - code generation */ @@ -683,6 +704,16 @@ ACPI_PARSE_OBJECT * TrCreateLeafNode ( UINT32 ParseOpcode); +ACPI_PARSE_OBJECT * +TrCreateAssignmentNode ( + ACPI_PARSE_OBJECT *Target, + ACPI_PARSE_OBJECT *Source); + +ACPI_PARSE_OBJECT * +TrCreateTargetOperand ( + ACPI_PARSE_OBJECT *OriginalOp, + ACPI_PARSE_OBJECT *ParentOp); + ACPI_PARSE_OBJECT * TrCreateValuedLeafNode ( UINT32 ParseOpcode, diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l index bbf41cd693ae..f831233234fc 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.l +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,7 +117,49 @@ NamePathTail [.]{NameSeg} else {yyterminate ();} } ";" { count (0); return(';'); } + /* ASL Extension: Standard C operators */ +"~" { count (3); return (PARSEOP_EXP_NOT); } +"!" { count (3); return (PARSEOP_EXP_LOGICAL_NOT); } +"*" { count (3); return (PARSEOP_EXP_MULTIPLY); } +"/" { count (3); return (PARSEOP_EXP_DIVIDE); } +"%" { count (3); return (PARSEOP_EXP_MODULO); } +"+" { count (3); return (PARSEOP_EXP_ADD); } +"-" { count (3); return (PARSEOP_EXP_SUBTRACT); } +">>" { count (3); return (PARSEOP_EXP_SHIFT_RIGHT); } +"<<" { count (3); return (PARSEOP_EXP_SHIFT_LEFT); } +"<" { count (3); return (PARSEOP_EXP_LESS); } +">" { count (3); return (PARSEOP_EXP_GREATER); } +"&" { count (3); return (PARSEOP_EXP_AND); } +"<=" { count (3); return (PARSEOP_EXP_LESS_EQUAL); } +">=" { count (3); return (PARSEOP_EXP_GREATER_EQUAL); } +"==" { count (3); return (PARSEOP_EXP_EQUAL); } +"!=" { count (3); return (PARSEOP_EXP_NOT_EQUAL); } +"|" { count (3); return (PARSEOP_EXP_OR); } +"&&" { count (3); return (PARSEOP_EXP_LOGICAL_AND); } +"||" { count (3); return (PARSEOP_EXP_LOGICAL_OR); } +"++" { count (3); return (PARSEOP_EXP_INCREMENT); } +"--" { count (3); return (PARSEOP_EXP_DECREMENT); } +"^ " { count (3); return (PARSEOP_EXP_XOR); } + + /* ASL Extension: Standard C assignment operators */ + +"=" { count (3); return (PARSEOP_EXP_EQUALS); } +"+=" { count (3); return (PARSEOP_EXP_ADD_EQ); } +"-=" { count (3); return (PARSEOP_EXP_SUB_EQ); } +"*=" { count (3); return (PARSEOP_EXP_MUL_EQ); } +"/=" { count (3); return (PARSEOP_EXP_DIV_EQ); } +"%=" { count (3); return (PARSEOP_EXP_MOD_EQ); } +"<<=" { count (3); return (PARSEOP_EXP_SHL_EQ); } +">>=" { count (3); return (PARSEOP_EXP_SHR_EQ); } +"&=" { count (3); return (PARSEOP_EXP_AND_EQ); } +"^=" { count (3); return (PARSEOP_EXP_XOR_EQ); } +"|=" { count (3); return (PARSEOP_EXP_OR_EQ); } + + + /* + * Begin standard ASL grammar + */ 0[xX]{HexDigitChar}+ | {DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); count (1); return (PARSEOP_INTEGER); } @@ -592,6 +634,44 @@ NamePathTail [.]{NameSeg} "Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } "Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } + /* ToPld macro */ + +"ToPLD" { count (0); return (PARSEOP_TOPLD); } + +"PLD_Revision" { count (0); return (PARSEOP_PLD_REVISION); } +"PLD_IgnoreColor" { count (0); return (PARSEOP_PLD_IGNORECOLOR); } +"PLD_Red" { count (0); return (PARSEOP_PLD_RED); } +"PLD_Green" { count (0); return (PARSEOP_PLD_GREEN); } +"PLD_Blue" { count (0); return (PARSEOP_PLD_BLUE); } +"PLD_Width" { count (0); return (PARSEOP_PLD_WIDTH); } +"PLD_Height" { count (0); return (PARSEOP_PLD_HEIGHT); } +"PLD_UserVisible" { count (0); return (PARSEOP_PLD_USERVISIBLE); } +"PLD_Dock" { count (0); return (PARSEOP_PLD_DOCK); } +"PLD_Lid" { count (0); return (PARSEOP_PLD_LID); } +"PLD_Panel" { count (0); return (PARSEOP_PLD_PANEL); } +"PLD_VerticalPosition" { count (0); return (PARSEOP_PLD_VERTICALPOSITION); } +"PLD_HorizontalPosition" { count (0); return (PARSEOP_PLD_HORIZONTALPOSITION); } +"PLD_Shape" { count (0); return (PARSEOP_PLD_SHAPE); } +"PLD_GroupOrientation" { count (0); return (PARSEOP_PLD_GROUPORIENTATION); } +"PLD_GroupToken" { count (0); return (PARSEOP_PLD_GROUPTOKEN); } +"PLD_GroupPosition" { count (0); return (PARSEOP_PLD_GROUPPOSITION); } +"PLD_Bay" { count (0); return (PARSEOP_PLD_BAY); } +"PLD_Ejectable" { count (0); return (PARSEOP_PLD_EJECTABLE); } +"PLD_EjectRequired" { count (0); return (PARSEOP_PLD_EJECTREQUIRED); } +"PLD_CabinetNumber" { count (0); return (PARSEOP_PLD_CABINETNUMBER); } +"PLD_CardCageNumber" { count (0); return (PARSEOP_PLD_CARDCAGENUMBER); } +"PLD_Reference" { count (0); return (PARSEOP_PLD_REFERENCE); } +"PLD_Rotation" { count (0); return (PARSEOP_PLD_ROTATION); } +"PLD_Order" { count (0); return (PARSEOP_PLD_ORDER); } +"PLD_Reserved" { count (0); return (PARSEOP_PLD_RESERVED); } +"PLD_VerticalOffset" { count (0); return (PARSEOP_PLD_VERTICALOFFSET); } +"PLD_HorizontalOffset" { count (0); return (PARSEOP_PLD_HORIZONTALOFFSET); } + + + /* printf debug macros */ +"printf" { count (0); return (PARSEOP_PRINTF); } +"fprintf" { count (0); return (PARSEOP_FPRINTF); } + /* Predefined compiler names */ "__DATE__" { count (0); return (PARSEOP___DATE__); } @@ -628,10 +708,6 @@ NamePathTail [.]{NameSeg} DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s); return (PARSEOP_NAMESTRING); } -"*" | -"/" { count (1); - AslCompilererror ("Parse error, expecting ASL keyword or name");} - . { count (1); sprintf (MsgBuffer, "Invalid character (0x%2.2X), expecting ASL keyword or name", diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index 94002816ebcc..f639eccf6129 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,8 +49,8 @@ * Compiler versions and names */ #define ASL_REVISION ACPI_CA_VERSION -#define ASL_COMPILER_NAME "ASL Optimizing Compiler" -#define AML_DISASSEMBLER_NAME "AML Disassembler" +#define ASL_COMPILER_NAME "ASL+ Optimizing Compiler" +#define AML_DISASSEMBLER_NAME "AML/ASL+ Disassembler" #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 7f25f9724942..9b8928cdb740 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -918,6 +918,8 @@ AslCompilererror ( const char *CompilerMessage) { + Gbl_SyntaxError++; + AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, diff --git a/sys/contrib/dev/acpica/compiler/aslfileio.c b/sys/contrib/dev/acpica/compiler/aslfileio.c index a4085757f181..cf726dd1c51f 100644 --- a/sys/contrib/dev/acpica/compiler/aslfileio.c +++ b/sys/contrib/dev/acpica/compiler/aslfileio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,8 @@ FlFileError ( UINT8 ErrorId) { - sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, - strerror (errno)); + sprintf (MsgBuffer, "\"%s\" (%s) - %s", Gbl_Files[FileId].Filename, + Gbl_Files[FileId].Description, strerror (errno)); AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); } @@ -98,6 +98,9 @@ FlOpenFile ( FILE *File; + Gbl_Files[FileId].Filename = Filename; + Gbl_Files[FileId].Handle = NULL; + File = fopen (Filename, Mode); if (!File) { @@ -105,8 +108,7 @@ FlOpenFile ( AslAbort (); } - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = File; + Gbl_Files[FileId].Handle = File; } diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 2c84c9e99d9d..63a8dbb50fbb 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -485,6 +485,8 @@ FlOpenAmlOutputFile ( 0, 0, 0, 0, NULL, NULL); return (AE_ERROR); } + + Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = Filename; } /* Open the output AML file in binary mode */ @@ -563,9 +565,14 @@ FlOpenMiscOutputFiles ( if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) { - AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, - 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); + /* + * A problem with freopen is that on error, + * we no longer have stderr. + */ + Gbl_DebugFlag = FALSE; + memcpy (stderr, stdout, sizeof (FILE)); + FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME); + AslAbort (); } AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); @@ -758,6 +765,26 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); } + /* Create/Open a map file if requested */ + + if (Gbl_MapfileFlag) + { + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_MAP); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + /* Open the hex file, text mode (closed at compiler exit) */ + + FlOpenFile (ASL_FILE_MAP_OUTPUT, Filename, "w+t"); + + AslCompilerSignon (ASL_FILE_MAP_OUTPUT); + AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); + } + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index 88042337cf5e..b8038ec12529 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 8106824fd8ef..c61b8ff30099 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,6 +127,7 @@ ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_SyntaxError, 0); /* Exception reporting */ @@ -173,6 +174,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE); #define HEX_OUTPUT_NONE 0 @@ -251,6 +253,8 @@ ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0) ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); +ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_PruneDepth, 0); +ASL_EXTERN UINT16 ASL_INIT_GLOBAL (Gbl_PruneType, 0); /* Static structures */ diff --git a/sys/contrib/dev/acpica/compiler/aslhex.c b/sys/contrib/dev/acpica/compiler/aslhex.c index 7eb678a9a2de..f24de1cd5446 100644 --- a/sys/contrib/dev/acpica/compiler/aslhex.c +++ b/sys/contrib/dev/acpica/compiler/aslhex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asllength.c b/sys/contrib/dev/acpica/compiler/asllength.c index 5b3f8a29c41a..618b63f4c2e5 100644 --- a/sys/contrib/dev/acpica/compiler/asllength.c +++ b/sys/contrib/dev/acpica/compiler/asllength.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index 865d646dda05..9c51a93ea03d 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asllistsup.c b/sys/contrib/dev/acpica/compiler/asllistsup.c index 7d121a375da0..694fbc87ea43 100644 --- a/sys/contrib/dev/acpica/compiler/asllistsup.c +++ b/sys/contrib/dev/acpica/compiler/asllistsup.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index 9d5117aa90b3..c8ae3adf7bd8 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __ASLLOAD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index 6f3f0c275304..a527a383dc58 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/compiler/asllookup.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 8c3d2d296e2d..d7ba1ae927de 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -187,13 +187,17 @@ Usage ( ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-dc ", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); + ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)"); ACPI_OPTION ("-e ", "Include ACPI table(s) for external symbol resolution"); ACPI_OPTION ("-fe ", "Specify external symbol declaration file"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); printf ("\nDebug Options:\n"); - ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)"); + ACPI_OPTION ("-bf", "Create debug file (full output) (*.txt)"); + ACPI_OPTION ("-bs", "Create debug file (parse tree only) (*.txt)"); + ACPI_OPTION ("-bp ", "Prune ASL parse tree"); + ACPI_OPTION ("-bt ", "Object type to be pruned from the parse tree"); ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); ACPI_OPTION ("-m ", "Set internal line buffer size (in Kbytes)"); ACPI_OPTION ("-n", "Parse only, no output generation"); diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index a4b4e670d2df..3d0e3272345a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -446,7 +446,38 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* XOR */ OP_TABLE_ENTRY (AML_BIT_XOR_OP, 0, 0, ACPI_BTYPE_INTEGER), /* ZERO */ OP_TABLE_ENTRY (AML_ZERO_OP, 0, 0, ACPI_BTYPE_INTEGER), - +/* TOPLD */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_INTEGER), +/* XFERSIZE_128 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* REVISION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* IGNORECOLOR */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* RED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* GREEN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* BLUE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* WIDTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* HEIGHT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* USERVISIBLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* DOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* LID */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* PANEL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* VERTICALPOSITION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* HORIZONTALPOSITION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* SHAPE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* GROUPORIENTATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* GROUPTOKEN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* GROUPPOSITION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* BAY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* EJECTABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* EJECTREQUIRED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* CABINETNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* CARDCAGENUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* REFERENCE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* ROTATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* ORDER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* RESERVED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* VERTICALOFFSET */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* HORIZONTALOFFSET */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), +/* PRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), +/* FPRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), /*! [End] no source code translation !*/ }; diff --git a/sys/contrib/dev/acpica/compiler/aslmapenter.c b/sys/contrib/dev/acpica/compiler/aslmapenter.c index 5dced39c8244..a75ff33905ff 100644 --- a/sys/contrib/dev/acpica/compiler/aslmapenter.c +++ b/sys/contrib/dev/acpica/compiler/aslmapenter.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslmapoutput.c b/sys/contrib/dev/acpica/compiler/aslmapoutput.c index 26d4fedfe0c7..622b1bdd7090 100644 --- a/sys/contrib/dev/acpica/compiler/aslmapoutput.c +++ b/sys/contrib/dev/acpica/compiler/aslmapoutput.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,7 +116,7 @@ const char *PolarityDecode[] = * RETURN: None * * DESCRIPTION: External interface. - * Create and open the mapfile and emit all of the collected + * Map file has already been opened. Emit all of the collected * hardware mapping information. Includes: GPIO information, * Serial information, and a dump of the entire ACPI device tree. * @@ -126,8 +126,6 @@ void MpEmitMappingInfo ( void) { - char *NewFilename; - /* Mapfile option enabled? */ @@ -136,22 +134,6 @@ MpEmitMappingInfo ( return; } - /* Create/Open a map file */ - - NewFilename = FlGenerateFilename (Gbl_OutputFilenamePrefix, - FILE_SUFFIX_MAP); - if (!NewFilename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, - 0, 0, 0, 0, NULL, NULL); - } - - /* Open the hex file, text mode (closed at compiler exit) */ - - FlOpenFile (ASL_FILE_MAP_OUTPUT, NewFilename, "w+t"); - AslCompilerSignon (ASL_FILE_MAP_OUTPUT); - AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT); - if (!Gbl_GpioList) { FlPrintFile (ASL_FILE_MAP_OUTPUT, @@ -630,9 +612,6 @@ MpNamespaceXrefBegin ( if (Op->Asl.Node == Info->TargetNode) { - DevicePathname = AcpiNsGetExternalPathname ( - Info->TargetNode); - while (ParentOp && (!ParentOp->Asl.Node)) { ParentOp = ParentOp->Asl.Parent; @@ -654,6 +633,8 @@ MpNamespaceXrefBegin ( DevicePathname, HidString); Info->References++; + + ACPI_FREE (DevicePathname); } } diff --git a/sys/contrib/dev/acpica/compiler/aslmaputils.c b/sys/contrib/dev/acpica/compiler/aslmaputils.c index f50c9ea68b5f..7b2e61185bb4 100644 --- a/sys/contrib/dev/acpica/compiler/aslmaputils.c +++ b/sys/contrib/dev/acpica/compiler/aslmaputils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.c b/sys/contrib/dev/acpica/compiler/aslmessages.c index da4c7365cbd0..12a4208eb75c 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.c +++ b/sys/contrib/dev/acpica/compiler/aslmessages.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index ba0c22b1d297..7a04a635245c 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslmethod.c b/sys/contrib/dev/acpica/compiler/aslmethod.c index 4e8535110d95..fa9216ea0b09 100644 --- a/sys/contrib/dev/acpica/compiler/aslmethod.c +++ b/sys/contrib/dev/acpica/compiler/aslmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslnamesp.c b/sys/contrib/dev/acpica/compiler/aslnamesp.c index 550c730bf5d0..720d39483652 100644 --- a/sys/contrib/dev/acpica/compiler/aslnamesp.c +++ b/sys/contrib/dev/acpica/compiler/aslnamesp.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asloffset.c b/sys/contrib/dev/acpica/compiler/asloffset.c index cbe69b21f306..14f7e9569df0 100644 --- a/sys/contrib/dev/acpica/compiler/asloffset.c +++ b/sys/contrib/dev/acpica/compiler/asloffset.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c index 76e2b058eeaa..d4dbbe329499 100644 --- a/sys/contrib/dev/acpica/compiler/aslopcodes.c +++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,10 +67,63 @@ static void OpcDoEisaId ( ACPI_PARSE_OBJECT *Op); +static void +OpcDoPld ( + ACPI_PARSE_OBJECT *Op); + static void OpcDoUuId ( ACPI_PARSE_OBJECT *Op); +static UINT8 * +OpcEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo); + + +/* ToPld strings */ + +static char *AslPldPanelList[] = +{ + "TOP", + "BOTTOM", + "LEFT", + "RIGHT", + "FRONT", + "BACK", + "UNKNOWN", + NULL +}; + +static char *AslPldVerticalPositionList[] = +{ + "UPPER", + "CENTER", + "LOWER", + NULL +}; + +static char *AslPldHorizontalPositionList[] = +{ + "LEFT", + "CENTER", + "RIGHT", + NULL +}; + +static char *AslPldShapeList[] = +{ + "ROUND", + "OVAL", + "SQUARE", + "VERTICALRECTANGLE", + "HORIZONTALRECTANGLE", + "VERTICALTRAPEZOID", + "HORIZONTALTRAPEZOID", + "UNKNOWN", + "CHAMFERED", + NULL +}; + /******************************************************************************* * @@ -651,11 +704,700 @@ OpcDoEisaId ( } +/******************************************************************************* + * + * FUNCTION: OpcEncodePldBuffer + * + * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) + * + * RETURN: Encode _PLD buffer suitable for return value from _PLD + * + * DESCRIPTION: Bit-packs a _PLD buffer struct. + * + ******************************************************************************/ + +static UINT8 * +OpcEncodePldBuffer ( + ACPI_PLD_INFO *PldInfo) +{ + UINT32 *Buffer; + UINT32 Dword; + + + Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); + if (!Buffer) + { + return (NULL); + } + + /* First 32 bits */ + + Dword = 0; + ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); + ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); + ACPI_PLD_SET_RED (&Dword, PldInfo->Red); + ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); + ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); + ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); + + /* Second 32 bits */ + + Dword = 0; + ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); + ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); + ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); + + /* Third 32 bits */ + + Dword = 0; + ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); + ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); + ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); + ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); + ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); + ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); + ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); + ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); + ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); + ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); + ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); + ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); + + /* Fourth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); + ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); + ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); + ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); + ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); + ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); + ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); + ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); + + if (PldInfo->Revision >= 2) + { + /* Fifth 32 bits */ + + Dword = 0; + ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); + ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); + ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); + } + + return (ACPI_CAST_PTR (UINT8, Buffer)); +} + + +/******************************************************************************* + * + * FUNCTION: OpcStrupr (strupr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert string to uppercase + * + * NOTE: This is not a POSIX function, so it appears here, not in utclib.c + * + ******************************************************************************/ + +static void +OpcStrupr ( + char *SrcString) +{ + char *String; + + + if (!SrcString) + { + return; + } + + /* Walk entire string, uppercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) toupper ((int) *String); + } + + return; +} + + +/******************************************************************************* + * + * FUNCTION: OpcFindName + * + * PARAMETERS: List - Array of char strings to be searched + * Name - Char string to string for + * Index - Index value to set if found + * + * RETURN: TRUE if any names matched, FALSE otherwise + * + * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to + * equivalent parameter value. + * + ******************************************************************************/ + +static BOOLEAN +OpcFindName ( + char **List, + char *Name, + UINT64 *Index) +{ + char *Str; + UINT32 i; + + + OpcStrupr (Name); + + for (i = 0, Str = List[0]; Str; i++, Str = List[i]) + { + if (!(ACPI_STRNCMP (Str, Name, ACPI_STRLEN (Name)))) + { + *Index = i; + return (TRUE); + } + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: OpcDoPld + * + * PARAMETERS: Op - Parse node + * + * RETURN: None + * + * DESCRIPTION: Convert ToPLD macro to 20-byte buffer + * + ******************************************************************************/ + +static void +OpcDoPld ( + ACPI_PARSE_OBJECT *Op) +{ + UINT8 *Buffer; + ACPI_PARSE_OBJECT *Node; + ACPI_PLD_INFO PldInfo; + ACPI_PARSE_OBJECT *NewOp; + + + if (!Op) + { + AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL); + return; + } + + if (Op->Asl.ParseOpcode != PARSEOP_TOPLD) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL); + return; + } + + Buffer = UtLocalCalloc (ACPI_PLD_BUFFER_SIZE); + if (!Buffer) + { + AslError(ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, Op, NULL); + return; + } + + ACPI_MEMSET (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); + + Node = Op->Asl.Child; + while (Node) + { + switch (Node->Asl.ParseOpcode) + { + case PARSEOP_PLD_REVISION: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 127) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_IGNORECOLOR: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 1) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_RED: + case PARSEOP_PLD_GREEN: + case PARSEOP_PLD_BLUE: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 255) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED) + { + PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN) + { + PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_BLUE */ + { + PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + break; + + case PARSEOP_PLD_WIDTH: + case PARSEOP_PLD_HEIGHT: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 65535) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH) + { + PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_HEIGHT */ + { + PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + case PARSEOP_PLD_USERVISIBLE: + case PARSEOP_PLD_DOCK: + case PARSEOP_PLD_LID: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 1) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE) + { + PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK) + { + PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else + { + PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + case PARSEOP_PLD_PANEL: + + if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) + { + if (Node->Asl.Child->Asl.Value.Integer > 6) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName(AslPldPanelList, + Node->Asl.Child->Asl.Value.String, + &Node->Asl.Child->Asl.Value.Integer)) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); + break; + } + } + + PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_VERTICALPOSITION: + + if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) + { + if (Node->Asl.Child->Asl.Value.Integer > 2) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName(AslPldVerticalPositionList, + Node->Asl.Child->Asl.Value.String, + &Node->Asl.Child->Asl.Value.Integer)) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); + break; + } + } + + PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_HORIZONTALPOSITION: + + if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) + { + if (Node->Asl.Child->Asl.Value.Integer > 2) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName(AslPldHorizontalPositionList, + Node->Asl.Child->Asl.Value.String, + &Node->Asl.Child->Asl.Value.Integer)) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); + break; + } + } + + PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_SHAPE: + + if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) + { + if (Node->Asl.Child->Asl.Value.Integer > 8) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + } + else /* PARSEOP_STRING */ + { + if (!OpcFindName(AslPldShapeList, + Node->Asl.Child->Asl.Value.String, + &Node->Asl.Child->Asl.Value.Integer)) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); + break; + } + } + + PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_GROUPORIENTATION: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 1) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_GROUPTOKEN: + case PARSEOP_PLD_GROUPPOSITION: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 255) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN) + { + PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_GROUPPOSITION */ + { + PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + case PARSEOP_PLD_BAY: + case PARSEOP_PLD_EJECTABLE: + case PARSEOP_PLD_EJECTREQUIRED: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 1) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY) + { + PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE) + { + PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_EJECTREQUIRED */ + { + PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + case PARSEOP_PLD_CABINETNUMBER: + case PARSEOP_PLD_CARDCAGENUMBER: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 255) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER) + { + PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_CARDCAGENUMBER */ + { + PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + case PARSEOP_PLD_REFERENCE: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 1) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_ROTATION: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 7) + { + switch (Node->Asl.Child->Asl.Value.Integer) + { + case 45: + + Node->Asl.Child->Asl.Value.Integer = 1; + break; + + case 90: + + Node->Asl.Child->Asl.Value.Integer = 2; + break; + + case 135: + + Node->Asl.Child->Asl.Value.Integer = 3; + break; + + case 180: + + Node->Asl.Child->Asl.Value.Integer = 4; + break; + + case 225: + + Node->Asl.Child->Asl.Value.Integer = 5; + break; + + case 270: + + Node->Asl.Child->Asl.Value.Integer = 6; + break; + + case 315: + + Node->Asl.Child->Asl.Value.Integer = 7; + break; + + default: + + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + } + + PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_ORDER: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 31) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer; + break; + + case PARSEOP_PLD_VERTICALOFFSET: + case PARSEOP_PLD_HORIZONTALOFFSET: + + if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + if (Node->Asl.Child->Asl.Value.Integer > 65535) + { + AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); + break; + } + + if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET) + { + PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; + } + else /* PARSEOP_PLD_HORIZONTALOFFSET */ + { + PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; + } + + break; + + default: + + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); + break; + } + + Node = Node->Asl.Next; + } + + Buffer = OpcEncodePldBuffer(&PldInfo); + + /* Change Op to a Buffer */ + + Op->Asl.ParseOpcode = PARSEOP_BUFFER; + Op->Common.AmlOpcode = AML_BUFFER_OP; + + /* Disable further optimization */ + + Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; + UtSetParseOpName (Op); + + /* Child node is the buffer length */ + + NewOp = TrAllocateNode (PARSEOP_INTEGER); + + NewOp->Asl.AmlOpcode = AML_BYTE_OP; + NewOp->Asl.Value.Integer = 20; + NewOp->Asl.Parent = Op; + + Op->Asl.Child = NewOp; + Op = NewOp; + + /* Peer to the child is the raw buffer data */ + + NewOp = TrAllocateNode (PARSEOP_RAW_DATA); + NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; + NewOp->Asl.AmlLength = 20; + NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); + NewOp->Asl.Parent = Op->Asl.Parent; + + Op->Asl.Next = NewOp; +} + + /******************************************************************************* * * FUNCTION: OpcDoUuId * - * PARAMETERS: Op - Parse node + * PARAMETERS: Op - Parse node * * RETURN: None * @@ -673,7 +1415,7 @@ OpcDoUuId ( ACPI_PARSE_OBJECT *NewOp; - InString = (char *) Op->Asl.Value.String; + InString = ACPI_CAST_PTR (char, Op->Asl.Value.String); Buffer = UtLocalCalloc (16); Status = AuValidateUuid (InString); @@ -712,7 +1454,7 @@ OpcDoUuId ( NewOp = TrAllocateNode (PARSEOP_RAW_DATA); NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; NewOp->Asl.AmlLength = 16; - NewOp->Asl.Value.String = (char *) Buffer; + NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); NewOp->Asl.Parent = Op->Asl.Parent; Op->Asl.Next = NewOp; @@ -723,7 +1465,7 @@ OpcDoUuId ( * * FUNCTION: OpcGenerateAmlOpcode * - * PARAMETERS: Op - Parse node + * PARAMETERS: Op - Parse node * * RETURN: None * @@ -737,7 +1479,6 @@ void OpcGenerateAmlOpcode ( ACPI_PARSE_OBJECT *Op) { - UINT16 Index; @@ -783,6 +1524,21 @@ OpcGenerateAmlOpcode ( OpcDoEisaId (Op); break; + case PARSEOP_PRINTF: + + OpcDoPrintf (Op); + break; + + case PARSEOP_FPRINTF: + + OpcDoFprintf (Op); + break; + + case PARSEOP_TOPLD: + + OpcDoPld (Op); + break; + case PARSEOP_TOUUID: OpcDoUuId (Op); diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index 8c6bfbd6f492..b2972d4a5d56 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 8e632925b230..1079f9ca1d27 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/compiler/aslopt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index 9c38371281e9..5868d984df43 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/compiler/asloptions.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -184,7 +184,7 @@ AslDoOptions ( } break; - case 'b': /* Debug output options */ + case 'b': /* Debug options */ switch (AcpiGbl_Optarg[0]) { @@ -193,10 +193,37 @@ AslDoOptions ( AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; PrParserdebug = 1; + Gbl_DebugFlag = TRUE; + break; + + case 'p': /* Prune ASL parse tree */ + + /* Get the required argument */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + + Gbl_PruneParseTree = TRUE; + Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); + break; + + case 's': + + Gbl_DebugFlag = TRUE; break; case 't': + /* Get the required argument */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + + Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); break; default: @@ -205,9 +232,6 @@ AslDoOptions ( return (-1); } - /* Produce debug output file */ - - Gbl_DebugFlag = TRUE; break; case 'c': @@ -250,6 +274,12 @@ AslDoOptions ( break; + case 'l': /* Use legacy ASL code (not ASL+) for disassembly */ + + Gbl_DoCompile = FALSE; + AcpiGbl_CstyleDisassembly = FALSE; + break; + default: printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); @@ -530,7 +560,6 @@ AslDoOptions ( Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; UtConvertBackslashes (Gbl_OutputFilenamePrefix); - Gbl_UseDefaultAmlFilename = FALSE; break; diff --git a/sys/contrib/dev/acpica/compiler/aslparser.y b/sys/contrib/dev/acpica/compiler/aslparser.y index b473041ac43b..223a49de5716 100644 --- a/sys/contrib/dev/acpica/compiler/aslparser.y +++ b/sys/contrib/dev/acpica/compiler/aslparser.y @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,7 +99,7 @@ AslLocalAllocate ( * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 86 +%expect 89 /*! [Begin] no source code translation */ diff --git a/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c index e436f8765c88..9a6778dc5917 100644 --- a/sys/contrib/dev/acpica/compiler/aslpredef.c +++ b/sys/contrib/dev/acpica/compiler/aslpredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslprepkg.c b/sys/contrib/dev/acpica/compiler/aslprepkg.c index 174bb823500a..37a58df3ecfc 100644 --- a/sys/contrib/dev/acpica/compiler/aslprepkg.c +++ b/sys/contrib/dev/acpica/compiler/aslprepkg.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslprintf.c b/sys/contrib/dev/acpica/compiler/aslprintf.c new file mode 100644 index 000000000000..c8647ea02e09 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslprintf.c @@ -0,0 +1,380 @@ +/****************************************************************************** + * + * Module Name: aslprintf - ASL Printf/Fprintf macro support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include "aslcompiler.y.h" +#include + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslprintf") + + +/* Local prototypes */ + +static void +OpcCreateConcatenateNode ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *Node); + +static void +OpcParsePrintf ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *DestOp); + + +/******************************************************************************* + * + * FUNCTION: OpcDoPrintf + * + * PARAMETERS: Op - printf parse node + * + * RETURN: None + * + * DESCRIPTION: Convert printf macro to a Store(..., Debug) AML operation. + * + ******************************************************************************/ + +void +OpcDoPrintf ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *DestOp; + + + /* Store destination is the Debug op */ + + DestOp = TrAllocateNode (PARSEOP_DEBUG); + DestOp->Asl.AmlOpcode = AML_DEBUG_OP; + DestOp->Asl.Parent = Op; + DestOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + + OpcParsePrintf (Op, DestOp); +} + + +/******************************************************************************* + * + * FUNCTION: OpcDoFprintf + * + * PARAMETERS: Op - fprintf parse node + * + * RETURN: None + * + * DESCRIPTION: Convert fprintf macro to a Store AML operation. + * + ******************************************************************************/ + +void +OpcDoFprintf ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *DestOp; + + + /* Store destination is the first argument of fprintf */ + + DestOp = Op->Asl.Child; + Op->Asl.Child = DestOp->Asl.Next; + DestOp->Asl.Next = NULL; + + OpcParsePrintf (Op, DestOp); +} + + +/******************************************************************************* + * + * FUNCTION: OpcParsePrintf + * + * PARAMETERS: Op - Printf parse node + * DestOp - Destination of Store operation + * + * RETURN: None + * + * DESCRIPTION: Convert printf macro to a Store AML operation. The printf + * macro parse tree is layed out as follows: + * + * Op - printf parse op + * Op->Child - Format string + * Op->Next - Format string arguments + * + ******************************************************************************/ + +static void +OpcParsePrintf ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *DestOp) +{ + char *Format; + char *StartPosition = NULL; + ACPI_PARSE_OBJECT *ArgNode; + ACPI_PARSE_OBJECT *NextNode; + UINT32 StringLength = 0; + char *NewString; + BOOLEAN StringToProcess = FALSE; + ACPI_PARSE_OBJECT *NewOp; + + + /* Get format string */ + + Format = ACPI_CAST_PTR (char, Op->Asl.Child->Asl.Value.String); + ArgNode = Op->Asl.Child->Asl.Next; + + /* + * Detach argument list so that we can use a NULL check to distinguish + * the first concatenation operation we need to make + */ + Op->Asl.Child = NULL; + + for (; *Format; ++Format) + { + if (*Format != '%') + { + if (!StringToProcess) + { + /* Mark the beginning of a string */ + + StartPosition = Format; + StringToProcess = TRUE; + } + + ++StringLength; + continue; + } + + /* Save string, if any, to new string object and concat it */ + + if (StringToProcess) + { + NewString = UtStringCacheCalloc (StringLength + 1); + ACPI_STRNCPY (NewString, StartPosition, StringLength); + + NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); + NewOp->Asl.Value.String = NewString; + NewOp->Asl.AmlOpcode = AML_STRING_OP; + NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; + NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + + OpcCreateConcatenateNode(Op, NewOp); + + StringLength = 0; + StringToProcess = FALSE; + } + + ++Format; + + /* + * We have a format parameter and will need an argument to go + * with it + */ + if (!ArgNode || + ArgNode->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + AslError(ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, NULL); + return; + } + + /* + * We do not support sub-specifiers of printf (flags, width, + * precision, length). For specifiers we only support %x/%X for + * hex or %s for strings. Also, %o for generic "acpi object". + */ + switch (*Format) + { + case 's': + + if (ArgNode->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) + { + AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgNode, + "String required"); + return; + } + + NextNode = ArgNode->Asl.Next; + ArgNode->Asl.Next = NULL; + OpcCreateConcatenateNode(Op, ArgNode); + ArgNode = NextNode; + continue; + + case 'X': + case 'x': + case 'o': + + NextNode = ArgNode->Asl.Next; + ArgNode->Asl.Next = NULL; + + /* + * Append an empty string if the first argument is + * not a string. This will implicitly conver the 2nd + * concat source to a string per the ACPI specification. + */ + if (!Op->Asl.Child) + { + NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); + NewOp->Asl.Value.String = ""; + NewOp->Asl.AmlOpcode = AML_STRING_OP; + NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; + NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + + OpcCreateConcatenateNode(Op, NewOp); + } + + OpcCreateConcatenateNode(Op, ArgNode); + ArgNode = NextNode; + break; + + default: + + AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Op, + "Unrecognized format specifier"); + continue; + } + } + + /* Process any remaining string */ + + if (StringToProcess) + { + NewString = UtStringCacheCalloc (StringLength + 1); + ACPI_STRNCPY (NewString, StartPosition, StringLength); + + NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); + NewOp->Asl.Value.String = NewString; + NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; + NewOp->Asl.AmlOpcode = AML_STRING_OP; + NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + + OpcCreateConcatenateNode(Op, NewOp); + } + + /* + * If we get here and there's no child node then Format + * was an empty string. Just make a no op. + */ + if (!Op->Asl.Child) + { + Op->Asl.ParseOpcode = PARSEOP_NOOP; + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, Op, + "Converted to NOOP"); + return; + } + + /* Check for erroneous extra arguments */ + + if (ArgNode && + ArgNode->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + AslError(ASL_WARNING, ASL_MSG_ARG_COUNT_HI, ArgNode, + "Extra arguments ignored"); + } + + /* Change Op to a Store */ + + Op->Asl.ParseOpcode = PARSEOP_STORE; + Op->Common.AmlOpcode = AML_STORE_OP; + Op->Asl.CompileFlags = 0; + + /* Disable further optimization */ + + Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; + UtSetParseOpName (Op); + + /* Set Store destination */ + + Op->Asl.Child->Asl.Next = DestOp; +} + + +/******************************************************************************* + * + * FUNCTION: OpcCreateConcatenateNode + * + * PARAMETERS: Op - Parse node + * Node - Parse node to be concatenated + * + * RETURN: None + * + * DESCRIPTION: Make Node the child of Op. If child node already exists, then + * concat child with Node and makes concat node the child of Op. + * + ******************************************************************************/ + +static void +OpcCreateConcatenateNode ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *Node) +{ + ACPI_PARSE_OBJECT *NewConcatOp; + + + if (!Op->Asl.Child) + { + Op->Asl.Child = Node; + Node->Asl.Parent = Op; + return; + } + + NewConcatOp = TrAllocateNode (PARSEOP_CONCATENATE); + NewConcatOp->Asl.AmlOpcode = AML_CONCAT_OP; + NewConcatOp->Asl.AcpiBtype = 0x7; + NewConcatOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + + /* First arg is child of Op*/ + + NewConcatOp->Asl.Child = Op->Asl.Child; + Op->Asl.Child->Asl.Parent = NewConcatOp; + + /* Second arg is Node */ + + NewConcatOp->Asl.Child->Asl.Next = Node; + Node->Asl.Parent = NewConcatOp; + + /* Third arg is Zero (not used) */ + + NewConcatOp->Asl.Child->Asl.Next->Asl.Next = + TrAllocateNode (PARSEOP_ZERO); + NewConcatOp->Asl.Child->Asl.Next->Asl.Next->Asl.Parent = + NewConcatOp; + + Op->Asl.Child = NewConcatOp; + NewConcatOp->Asl.Parent = Op; +} diff --git a/sys/contrib/dev/acpica/compiler/aslprune.c b/sys/contrib/dev/acpica/compiler/aslprune.c new file mode 100644 index 000000000000..1a36928a14d9 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslprune.c @@ -0,0 +1,239 @@ +/****************************************************************************** + * + * Module Name: aslprune - Parse tree prune utility + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include "aslcompiler.y.h" +#include + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslprune") + + +/* Local prototypes */ + +static ACPI_STATUS +PrTreePruneWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static void +PrPrintObjectAtLevel ( + UINT32 Level, + const char *ObjectName); + + +typedef struct acpi_prune_info +{ + UINT32 PruneLevel; + UINT16 ParseOpcode; + UINT16 Count; + +} ACPI_PRUNE_INFO; + + +/******************************************************************************* + * + * FUNCTION: AslPruneParseTree + * + * PARAMETERS: PruneDepth - Number of levels to prune + * Type - Prune type (Device, Method, etc.) + * + * RETURN: None + * + * DESCRIPTION: Prune off one or more levels of the ASL parse tree + * + ******************************************************************************/ + +void +AslPruneParseTree ( + UINT32 PruneDepth, + UINT32 Type) +{ + ACPI_PRUNE_INFO PruneObj; + + + PruneObj.PruneLevel = PruneDepth; + PruneObj.Count = 0; + + switch (Type) + { + case 0: + PruneObj.ParseOpcode = (UINT16) PARSEOP_DEVICE; + break; + + case 1: + PruneObj.ParseOpcode = (UINT16) PARSEOP_METHOD; + break; + + case 2: + PruneObj.ParseOpcode = (UINT16) PARSEOP_IF; + break; + + default: + AcpiOsPrintf ("Unsupported type: %u\n", Type); + return; + } + + AcpiOsPrintf ("Pruning parse tree, from depth %u\n", + PruneDepth); + + AcpiOsPrintf ("\nRemoving Objects:\n"); + + TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, + PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj)); + + AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count); +} + + +/******************************************************************************* + * + * FUNCTION: PrPrintObjectAtLevel + * + * PARAMETERS: Level - Current nesting level + * ObjectName - ACPI name for the object + * + * RETURN: None + * + * DESCRIPTION: Print object name with indent + * + ******************************************************************************/ + +static void +PrPrintObjectAtLevel ( + UINT32 Level, + const char *ObjectName) +{ + UINT32 i; + + + for (i = 0; i < Level; i++) + { + AcpiOsPrintf (" "); + } + + AcpiOsPrintf ("[%s] at Level [%u]\n", ObjectName, Level); +} + + +/******************************************************************************* + * + * FUNCTION: PrTreePruneWalk + * + * PARAMETERS: Parse tree walk callback + * + * RETURN: Status + * + * DESCRIPTION: Prune off one or more levels of the ASL parse tree + * + * Current objects that can be pruned are: Devices, Methods, and If/Else + * blocks. + * + ******************************************************************************/ + +static ACPI_STATUS +PrTreePruneWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_PRUNE_INFO *PruneObj = (ACPI_PRUNE_INFO *) Context; + + + /* We only care about objects below the Prune Level threshold */ + + if (Level <= PruneObj->PruneLevel) + { + return (AE_OK); + } + + if ((Op->Asl.ParseOpcode != PruneObj->ParseOpcode) && + !(Op->Asl.ParseOpcode == PARSEOP_ELSE && + PruneObj->ParseOpcode == PARSEOP_IF)) + { + return (AE_OK); + } + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_METHOD: + + AcpiOsPrintf ("Method"); + PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name); + Op->Asl.Child->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next = NULL; + PruneObj->Count++; + break; + + case PARSEOP_DEVICE: + + AcpiOsPrintf ("Device"); + PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name); + Op->Asl.Child->Asl.Next = NULL; + PruneObj->Count++; + break; + + case PARSEOP_IF: + case PARSEOP_ELSE: + + if (Op->Asl.ParseOpcode == PARSEOP_ELSE) + { + PrPrintObjectAtLevel(Level, "Else"); + Op->Asl.Child = NULL; + } + else + { + PrPrintObjectAtLevel(Level, "If"); + Op->Asl.Child->Asl.Next = NULL; + } + + PruneObj->Count++; + break; + + default: + + break; + } + + return (AE_OK); +} diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c index 3cedeedf061f..5f513d7adec6 100644 --- a/sys/contrib/dev/acpica/compiler/aslresource.c +++ b/sys/contrib/dev/acpica/compiler/aslresource.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c index 46bb1fa30fb1..4ac063528e28 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype1.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype1.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1i.c b/sys/contrib/dev/acpica/compiler/aslrestype1i.c index 6de7b93b3a78..36e2400cea76 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype1i.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype1i.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2.c b/sys/contrib/dev/acpica/compiler/aslrestype2.c index ec6067b2fb49..af93a9e90e1e 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2d.c b/sys/contrib/dev/acpica/compiler/aslrestype2d.c index 39b1f6b764a4..25cbed950a0d 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2d.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2d.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2e.c b/sys/contrib/dev/acpica/compiler/aslrestype2e.c index b39556342438..ddb7ea37a12c 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2e.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2e.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2q.c b/sys/contrib/dev/acpica/compiler/aslrestype2q.c index f79680f4a488..16398e5ec281 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2q.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2q.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2s.c b/sys/contrib/dev/acpica/compiler/aslrestype2s.c index 2be295b6e4e1..73680c2204ea 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2s.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2s.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2w.c b/sys/contrib/dev/acpica/compiler/aslrestype2w.c index 34c3e1e4515a..a9f4771fe105 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2w.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2w.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslrules.y b/sys/contrib/dev/acpica/compiler/aslrules.y index 2bc48db11f6a..67f0413d0726 100644 --- a/sys/contrib/dev/acpica/compiler/aslrules.y +++ b/sys/contrib/dev/acpica/compiler/aslrules.y @@ -6,7 +6,7 @@ NoEcho(' *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,6 +92,149 @@ DefinitionBlockTerm '{' TermList '}' {$$ = TrLinkChildren ($3,7,$4,$6,$8,$10,$12,$14,$18);} ; + /* + * ASL Extensions: C-style math/logical operators and expressions. + * The implementation transforms these operators into the standard + * AML opcodes and syntax. + * + * Supported operators and precedence rules (high-to-low) + * + * NOTE: The operator precedence and associativity rules are + * implemented by the tokens in asltokens.y + * + * (left-to-right): + * 1) ( ) expr++ expr-- + * + * (right-to-left): + * 2) ! ~ + * + * (left-to-right): + * 3) * / % + * 4) + - + * 5) >> << + * 6) < > <= >= + * 7) == != + * 8) & + * 9) ^ + * 10) | + * 11) && + * 12) || + * + * (right-to-left): + * 13) = += -= *= /= %= <<= >>= &= ^= |= + */ +Expression + + /* Unary operators */ + + : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafNode (PARSEOP_LNOT);} + TermArg {$$ = TrLinkChildren ($2,1,$3);} + | PARSEOP_EXP_NOT {$$ = TrCreateLeafNode (PARSEOP_NOT);} + TermArg {$$ = TrLinkChildren ($2,2,$3,TrCreateLeafNode (PARSEOP_ZERO));} + + | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} + {$$ = TrLinkChildren ($3,1,$1);} + | SuperName PARSEOP_EXP_DECREMENT {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + {$$ = TrLinkChildren ($3,1,$1);} + + /* Binary operators: math and logical */ + + | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), + TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + + | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + + | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS {$$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_NOT_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_LOGICAL_AND {$$ = TrCreateLeafNode (PARSEOP_LAND);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_OR {$$ = TrCreateLeafNode (PARSEOP_LOR);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + /* Parentheses */ + + | '(' TermArg ')' { $$ = $2;} + ; + +EqualsTerm + + /* All assignment-type operations */ + + : SuperName PARSEOP_EXP_EQUALS + TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + + | TermArg PARSEOP_EXP_ADD_EQ {$$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MUL_EQ {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHL_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHR_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SUB_EQ {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_AND_EQ {$$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_OR_EQ {$$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_XOR_EQ {$$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + ; + + /* ACPI 3.0 -- allow semicolons between terms */ TermList @@ -104,6 +247,7 @@ TermList Term : Object {} + | Expression {} | Type1Opcode {} | Type2Opcode {} | Type2IntegerOpcode {} @@ -211,7 +355,8 @@ Removed from TermArg due to reduce/reduce conflicts */ TermArg - : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + : Expression {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} @@ -305,6 +450,7 @@ Type2Opcode | RefOfTerm {} | SizeOfTerm {} | StoreTerm {} + | EqualsTerm {} | TimerTerm {} | WaitTerm {} | UserTerm {} @@ -362,6 +508,8 @@ Type2BufferOpcode /* "Type5" Opcodes */ Type2BufferOrStringOpcode : ConcatTerm {} + | PrintfTerm {} + | FprintfTerm {} | MidTerm {} ; @@ -387,6 +535,7 @@ Type4Opcode Type5Opcode : ResourceTemplateTerm {} | UnicodeTerm {} + | ToPLDTerm {} | ToUUIDTerm {} ; @@ -1370,6 +1519,86 @@ ToIntegerTerm error ')' {$$ = AslDoError(); yyclearin;} ; +PldKeyword + : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} + | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} + | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} + | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} + | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} + | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} + | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} + | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} + | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} + | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} + | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} + | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} + | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} + | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} + | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} + | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} + | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} + | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} + | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} + | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} + | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} + | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} + | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} + | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} + | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} + | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} + | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} + | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} + ; + +PldKeywordList + : {$$ = NULL;} + | PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkChildren ($1,1,$3);} + | PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkChildren ($1,1,$3);} + | PldKeywordList ',' /* Allows a trailing comma at list end */ + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} + ; + +ToPLDTerm + : PARSEOP_TOPLD '(' {$$ = TrCreateLeafNode (PARSEOP_TOPLD);} + PldKeywordList + ')' {$$ = TrLinkChildren ($3,1,$4);} + | PARSEOP_TOPLD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PrintfArgList + : {$$ = NULL;} + | TermArg {$$ = $1;} + | PrintfArgList ',' + TermArg {$$ = TrLinkPeerNode ($1, $3);} + ; + +PrintfTerm + : PARSEOP_PRINTF '(' {$$ = TrCreateLeafNode (PARSEOP_PRINTF);} + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($3,2,$4,$5);} + | PARSEOP_PRINTF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FprintfTerm + : PARSEOP_FPRINTF '(' {$$ = TrCreateLeafNode (PARSEOP_FPRINTF);} + TermArg ',' + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($3,3,$4,$6,$7);} + | PARSEOP_FPRINTF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + ToStringTerm : PARSEOP_TOSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOSTRING);} TermArg diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 56603be4c3cf..c8840b252151 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,6 +88,7 @@ AslInitializeGlobals ( /* Init compiler globals */ + Gbl_SyntaxError = 0; Gbl_CurrentColumn = 0; Gbl_CurrentLineNumber = 1; Gbl_LogicalLineNumber = 1; diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c index ff05d9ac064f..2259255d498b 100644 --- a/sys/contrib/dev/acpica/compiler/aslstubs.c +++ b/sys/contrib/dev/acpica/compiler/aslstubs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslsupport.l b/sys/contrib/dev/acpica/compiler/aslsupport.l index 7ea43a07dba7..b3149cf4dc82 100644 --- a/sys/contrib/dev/acpica/compiler/aslsupport.l +++ b/sys/contrib/dev/acpica/compiler/aslsupport.l @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,14 @@ typedef struct asl_file_node ASL_FILE_NODE *Gbl_IncludeFileStack = NULL; +/******************************************************************************* + * + * FUNCTION: AslParserCleanup + * + * Used to delete the current buffer + * + ******************************************************************************/ + void AslParserCleanup ( void) @@ -188,7 +196,8 @@ AslPopInputFileStack ( Fnode = Gbl_IncludeFileStack; - DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode); + DbgPrint (ASL_PARSE_OUTPUT, + "\nPop InputFile Stack, Fnode %p\n\n", Fnode); if (!Fnode) { @@ -248,11 +257,11 @@ AslPushInputFileStack ( Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); - Fnode->File = yyin; - Fnode->Next = Gbl_IncludeFileStack; - Fnode->State = YY_CURRENT_BUFFER; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; + Fnode->File = yyin; + Fnode->Next = Gbl_IncludeFileStack; + Fnode->State = YY_CURRENT_BUFFER; + Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; + Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; /* Push it on the stack */ @@ -263,7 +272,8 @@ AslPushInputFileStack ( State = yy_create_buffer (InputFile, YY_BUF_SIZE); yy_switch_to_buffer (State); - DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile); + DbgPrint (ASL_PARSE_OUTPUT, + "\nPush InputFile Stack, returning %p\n\n", InputFile); /* Reset the global line count and filename */ @@ -313,7 +323,7 @@ AslResetCurrentLineBuffer ( * * FUNCTION: AslInsertLineBuffer * - * PARAMETERS: SourceChar - One char from the input ASL source file + * PARAMETERS: SourceChar - One char from the input ASL source file * * RETURN: None * @@ -354,7 +364,8 @@ AslInsertLineBuffer ( *Gbl_LineBufPtr = (UINT8) SourceChar; Gbl_LineBufPtr++; - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) + if (Gbl_LineBufPtr > + (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) { #if 0 /* @@ -363,9 +374,9 @@ AslInsertLineBuffer ( */ sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize); AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); #endif AslResetCurrentLineBuffer (); @@ -384,12 +395,12 @@ AslInsertLineBuffer ( * * FUNCTION: count * - * PARAMETERS: yytext - Contains the matched keyword. - * Type - Keyword/Character type: - * 0 = anything except a keyword - * 1 = pseudo-keywords - * 2 = non-executable ASL keywords - * 3 = executable ASL keywords + * PARAMETERS: yytext - Contains the matched keyword. + * Type - Keyword/Character type: + * 0 = anything except a keyword + * 1 = pseudo-keywords + * 2 = non-executable ASL keywords + * 3 = executable ASL keywords * * RETURN: None * @@ -458,7 +469,7 @@ loop: /* Eat chars until end-of-comment */ - while ((c = input()) != '*' && c != EOF) + while (((c = input ()) != '*') && (c != EOF)) { AslInsertLineBuffer (c); c1 = c; @@ -476,16 +487,16 @@ loop: if ((c1 == '/') && (c == '*')) { AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_InputByteCount, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } /* Comment is closed only if the NEXT character is a slash */ AslInsertLineBuffer (c); - if ((c1 = input()) != '/' && c1 != EOF) + if (((c1 = input ()) != '/') && (c1 != EOF)) { unput(c1); goto loop; @@ -505,9 +516,9 @@ EarlyEOF: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); } @@ -534,7 +545,7 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); AslInsertLineBuffer ('/'); - while ((c = input()) != '\n' && c != EOF) + while (((c = input ()) != '\n') && (c != EOF)) { AslInsertLineBuffer (c); } @@ -682,9 +693,9 @@ DoCharacter: /* Unknown escape sequence issue warning, but use the character */ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); break; } break; @@ -709,9 +720,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -753,9 +764,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -797,9 +808,9 @@ DoCharacter: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); @@ -813,9 +824,9 @@ CompletedString: if (!CleanString) { AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); } @@ -829,8 +840,8 @@ BufferOverflow: /* Literal was too long */ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); return (FALSE); } diff --git a/sys/contrib/dev/acpica/compiler/aslsupport.y b/sys/contrib/dev/acpica/compiler/aslsupport.y index dfeca6e9b309..ba81b7d5ac07 100644 --- a/sys/contrib/dev/acpica/compiler/aslsupport.y +++ b/sys/contrib/dev/acpica/compiler/aslsupport.y @@ -6,7 +6,7 @@ NoEcho(' *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asltokens.y b/sys/contrib/dev/acpica/compiler/asltokens.y index c296fea30bec..511fa9bd53fb 100644 --- a/sys/contrib/dev/acpica/compiler/asltokens.y +++ b/sys/contrib/dev/acpica/compiler/asltokens.y @@ -6,7 +6,7 @@ NoEcho(' *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -376,6 +376,88 @@ NoEcho(' %token PARSEOP_XOR %token PARSEOP_ZERO +/* ToPld macro */ + +%token PARSEOP_TOPLD +%token PARSEOP_PLD_REVISION +%token PARSEOP_PLD_IGNORECOLOR +%token PARSEOP_PLD_RED +%token PARSEOP_PLD_GREEN +%token PARSEOP_PLD_BLUE +%token PARSEOP_PLD_WIDTH +%token PARSEOP_PLD_HEIGHT +%token PARSEOP_PLD_USERVISIBLE +%token PARSEOP_PLD_DOCK +%token PARSEOP_PLD_LID +%token PARSEOP_PLD_PANEL +%token PARSEOP_PLD_VERTICALPOSITION +%token PARSEOP_PLD_HORIZONTALPOSITION +%token PARSEOP_PLD_SHAPE +%token PARSEOP_PLD_GROUPORIENTATION +%token PARSEOP_PLD_GROUPTOKEN +%token PARSEOP_PLD_GROUPPOSITION +%token PARSEOP_PLD_BAY +%token PARSEOP_PLD_EJECTABLE +%token PARSEOP_PLD_EJECTREQUIRED +%token PARSEOP_PLD_CABINETNUMBER +%token PARSEOP_PLD_CARDCAGENUMBER +%token PARSEOP_PLD_REFERENCE +%token PARSEOP_PLD_ROTATION +%token PARSEOP_PLD_ORDER +%token PARSEOP_PLD_RESERVED +%token PARSEOP_PLD_VERTICALOFFSET +%token PARSEOP_PLD_HORIZONTALOFFSET + +/* + * C-style expression parser. These must appear after all of the + * standard ASL operators and keywords. + * + * Note: The order of these tokens implements the precedence rules + * (low precedence to high). See aslrules.y for an exhaustive list. + */ +%right PARSEOP_EXP_EQUALS + PARSEOP_EXP_ADD_EQ + PARSEOP_EXP_SUB_EQ + PARSEOP_EXP_MUL_EQ + PARSEOP_EXP_DIV_EQ + PARSEOP_EXP_MOD_EQ + PARSEOP_EXP_SHL_EQ + PARSEOP_EXP_SHR_EQ + PARSEOP_EXP_AND_EQ + PARSEOP_EXP_XOR_EQ + PARSEOP_EXP_OR_EQ + +%left PARSEOP_EXP_LOGICAL_OR +%left PARSEOP_EXP_LOGICAL_AND +%left PARSEOP_EXP_OR +%left PARSEOP_EXP_XOR +%left PARSEOP_EXP_AND +%left PARSEOP_EXP_EQUAL + PARSEOP_EXP_NOT_EQUAL +%left PARSEOP_EXP_GREATER + PARSEOP_EXP_LESS + PARSEOP_EXP_GREATER_EQUAL + PARSEOP_EXP_LESS_EQUAL +%left PARSEOP_EXP_SHIFT_RIGHT + PARSEOP_EXP_SHIFT_LEFT +%left PARSEOP_EXP_ADD + PARSEOP_EXP_SUBTRACT +%left PARSEOP_EXP_MULTIPLY + PARSEOP_EXP_DIVIDE + PARSEOP_EXP_MODULO + +%right PARSEOP_EXP_NOT + PARSEOP_EXP_LOGICAL_NOT + +%left PARSEOP_EXP_INCREMENT + PARSEOP_EXP_DECREMENT + +%token PARSEOP_PRINTF +%token PARSEOP_FPRINTF +/* Specific parentheses tokens are not used at this time */ + /* PARSEOP_EXP_PAREN_OPEN */ + /* PARSEOP_EXP_PAREN_CLOSE */ + /* * Special functions. These should probably stay at the end of this * table. diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c index 44b9f034025e..c46801b929c4 100644 --- a/sys/contrib/dev/acpica/compiler/asltransform.c +++ b/sys/contrib/dev/acpica/compiler/asltransform.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index a6e5f7398748..071231e4c3e5 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -446,6 +446,124 @@ TrSetEndLineNumber ( } +/******************************************************************************* + * + * FUNCTION: TrCreateAssignmentNode + * + * PARAMETERS: Target - Assignment target + * Source - Assignment source + * + * RETURN: Pointer to the new node. Aborts on allocation failure + * + * DESCRIPTION: Implements the C-style '=' operator. It changes the parse + * tree if possible to utilize the last argument of the math + * operators which is a target operand -- thus saving invocation + * of and additional Store() operator. An optimization. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrCreateAssignmentNode ( + ACPI_PARSE_OBJECT *Target, + ACPI_PARSE_OBJECT *Source) +{ + ACPI_PARSE_OBJECT *TargetOp; + ACPI_PARSE_OBJECT *SourceOp1; + ACPI_PARSE_OBJECT *SourceOp2; + ACPI_PARSE_OBJECT *Operator; + + + DbgPrint (ASL_PARSE_OUTPUT, + "\nTrCreateAssignmentNode Line [%u to %u] Source %s Target %s\n", + Source->Asl.LineNumber, Source->Asl.EndLine, + UtGetOpName (Source->Asl.ParseOpcode), + UtGetOpName (Target->Asl.ParseOpcode)); + + TrSetNodeFlags (Target, NODE_IS_TARGET); + + switch (Source->Asl.ParseOpcode) + { + /* + * Only these operators can be optimized because they have + * a target operand + */ + case PARSEOP_ADD: + case PARSEOP_AND: + case PARSEOP_DIVIDE: + case PARSEOP_MOD: + case PARSEOP_MULTIPLY: + case PARSEOP_NOT: + case PARSEOP_OR: + case PARSEOP_SHIFTLEFT: + case PARSEOP_SHIFTRIGHT: + case PARSEOP_SUBTRACT: + case PARSEOP_XOR: + + break; + + /* Otherwise, just create a normal Store operator */ + + default: + + goto CannotOptimize; + } + + /* + * Transform the parse tree such that the target is moved to the + * last operand of the operator + */ + SourceOp1 = Source->Asl.Child; + SourceOp2 = SourceOp1->Asl.Next; + + /* NOT only has one operand, but has a target */ + + if (Source->Asl.ParseOpcode == PARSEOP_NOT) + { + SourceOp2 = SourceOp1; + } + + /* DIVIDE has an extra target operand (remainder) */ + + if (Source->Asl.ParseOpcode == PARSEOP_DIVIDE) + { + SourceOp2 = SourceOp2->Asl.Next; + } + + TargetOp = SourceOp2->Asl.Next; + + /* + * Can't perform this optimization if there already is a target + * for the operator (ZERO is a "no target" placeholder). + */ + if (TargetOp->Asl.ParseOpcode != PARSEOP_ZERO) + { + goto CannotOptimize; + } + + /* Link in the target as the final operand */ + + SourceOp2->Asl.Next = Target; + Target->Asl.Parent = Source; + + return (Source); + + +CannotOptimize: + + Operator = TrAllocateNode (PARSEOP_STORE); + TrLinkChildren (Operator, 2, Source, Target); + + /* Set the appropriate line numbers for the new node */ + + Operator->Asl.LineNumber = Target->Asl.LineNumber; + Operator->Asl.LogicalLineNumber = Target->Asl.LogicalLineNumber; + Operator->Asl.LogicalByteOffset = Target->Asl.LogicalByteOffset; + Operator->Asl.Column = Target->Asl.Column; + + return (Operator); +} + + /******************************************************************************* * * FUNCTION: TrCreateLeafNode @@ -561,6 +679,81 @@ TrCreateConstantLeafNode ( } +/******************************************************************************* + * + * FUNCTION: TrCreateTargetOperand + * + * PARAMETERS: OriginalOp - Op to be copied + * + * RETURN: Pointer to the new node. Aborts on allocation failure + * + * DESCRIPTION: Copy an existing node (and subtree). Used in ASL+ (C-style) + * expressions where the target is the same as one of the + * operands. A new node and subtree must be created from the + * original so that the parse tree can be linked properly. + * + * NOTE: This code is specific to target operands that are the last + * operand in an ASL/AML operator. Meaning that the top-level + * parse Op in a possible subtree has a NULL Next pointer. + * This simplifies the recursion. + * + * Subtree example: + * DeRefOf (Local1) += 32 + * + * This gets converted to: + * Add (DeRefOf (Local1), 32, DeRefOf (Local1)) + * + * Each DeRefOf has a single child, Local1. Even more complex + * subtrees can be created via the Index and DeRefOf operators. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrCreateTargetOperand ( + ACPI_PARSE_OBJECT *OriginalOp, + ACPI_PARSE_OBJECT *ParentOp) +{ + ACPI_PARSE_OBJECT *Op; + + + if (!OriginalOp) + { + return (NULL); + } + + Op = TrGetNextNode (); + + /* Copy the pertinent values (omit link pointer fields) */ + + Op->Asl.Value = OriginalOp->Asl.Value; + Op->Asl.Filename = OriginalOp->Asl.Filename; + Op->Asl.LineNumber = OriginalOp->Asl.LineNumber; + Op->Asl.LogicalLineNumber = OriginalOp->Asl.LogicalLineNumber; + Op->Asl.LogicalByteOffset = OriginalOp->Asl.LogicalByteOffset; + Op->Asl.Column = OriginalOp->Asl.Column; + Op->Asl.Flags = OriginalOp->Asl.Flags; + Op->Asl.CompileFlags = OriginalOp->Asl.CompileFlags; + Op->Asl.AmlOpcode = OriginalOp->Asl.AmlOpcode; + Op->Asl.ParseOpcode = OriginalOp->Asl.ParseOpcode; + Op->Asl.Parent = ParentOp; + UtSetParseOpName (Op); + + /* Copy a possible subtree below this node */ + + if (OriginalOp->Asl.Child) + { + Op->Asl.Child = TrCreateTargetOperand (OriginalOp->Asl.Child, Op); + } + + if (OriginalOp->Asl.Next) /* Null for top-level node */ + { + Op->Asl.Next = TrCreateTargetOperand (OriginalOp->Asl.Next, ParentOp); + } + + return (Op); +} + + /******************************************************************************* * * FUNCTION: TrCreateValuedLeafNode diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 5f01c80785b5..4bd24da18e5a 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/asltypes.y b/sys/contrib/dev/acpica/compiler/asltypes.y index b9914531b4e3..3177d1d52a78 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.y +++ b/sys/contrib/dev/acpica/compiler/asltypes.y @@ -6,7 +6,7 @@ NoEcho(' *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -285,8 +285,14 @@ NoEcho(' %type ResourceMacroList %type ResourceMacroTerm %type ResourceTemplateTerm +%type PldKeyword +%type PldKeywordList +%type ToPLDTerm %type ToUUIDTerm %type UnicodeTerm +%type PrintfArgList +%type PrintfTerm +%type FprintfTerm /* Resource Descriptors */ @@ -379,3 +385,9 @@ NoEcho(' %type OptionalWordConst %type OptionalWordConstExpr %type OptionalXferSize + +/* + * C-style expression parser + */ +%type Expression +%type EqualsTerm diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 0ec4473c0547..7258daadc1bb 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -571,20 +571,36 @@ UtStringCacheCalloc ( { char *Buffer; ASL_CACHE_INFO *Cache; + UINT32 CacheSize = ASL_STRING_CACHE_SIZE; - if (Length > ASL_STRING_CACHE_SIZE) + if (Length > CacheSize) { - Buffer = UtLocalCalloc (Length); - return (Buffer); + CacheSize = Length; + + if (Gbl_StringCacheList) + { + Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); + + /* Link new cache buffer just following head of list */ + + Cache->Next = Gbl_StringCacheList->Next; + Gbl_StringCacheList->Next = Cache; + + /* Leave cache management pointers alone as they pertain to head */ + + Gbl_StringCount++; + Gbl_StringSize += Length; + + return (Cache->Buffer); + } } if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) { /* Allocate a new buffer */ - Cache = UtLocalCalloc (sizeof (Cache->Next) + - ASL_STRING_CACHE_SIZE); + Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); /* Link new cache buffer to head of list */ @@ -594,7 +610,7 @@ UtStringCacheCalloc ( /* Setup cache management pointers */ Gbl_StringCacheNext = Cache->Buffer; - Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE; + Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize; } Gbl_StringCount++; diff --git a/sys/contrib/dev/acpica/compiler/asluuid.c b/sys/contrib/dev/acpica/compiler/asluuid.c index 8ba9dd9cbbe6..4e345e9e5f6c 100644 --- a/sys/contrib/dev/acpica/compiler/asluuid.c +++ b/sys/contrib/dev/acpica/compiler/asluuid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/aslwalks.c b/sys/contrib/dev/acpica/compiler/aslwalks.c index 1ce5918faba7..c378f2df3104 100644 --- a/sys/contrib/dev/acpica/compiler/aslwalks.c +++ b/sys/contrib/dev/acpica/compiler/aslwalks.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -294,6 +294,13 @@ AnOperandTypecheckWalkEnd ( { RequiredBtypes = AnMapArgTypeToBtype (ArgType); + if (!ArgOp) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, + "Null ArgOp in argument loop"); + AslAbort (); + } + ThisNodeBtype = AnGetBtype (ArgOp); if (ThisNodeBtype == ACPI_UINT32_MAX) { diff --git a/sys/contrib/dev/acpica/compiler/aslxref.c b/sys/contrib/dev/acpica/compiler/aslxref.c index 3d73d27d6b03..cda7ccf68b39 100644 --- a/sys/contrib/dev/acpica/compiler/aslxref.c +++ b/sys/contrib/dev/acpica/compiler/aslxref.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -832,6 +832,8 @@ XfNamespaceLocateBegin ( if ((Op->Asl.Parent) && ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE) || + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)|| (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) { return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 69344b1d3f79..e94a2221f580 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTCOMPILE_C__ #define _DECLARE_DT_GLOBALS #include diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index dbf112593da6..307df3f14c53 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/dtexpress.c b/sys/contrib/dev/acpica/compiler/dtexpress.c index 59181f3308e8..90054c9fe3aa 100644 --- a/sys/contrib/dev/acpica/compiler/dtexpress.c +++ b/sys/contrib/dev/acpica/compiler/dtexpress.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTEXPRESS_C__ - #include #include #include "dtparser.y.h" diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index a19b985fe1f5..3b191abf45ad 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/compiler/dtfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTFIELD_C__ - #include #include diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index 1f5b62034e65..e840fc9ce0d6 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTIO_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/compiler/dtparser.l b/sys/contrib/dev/acpica/compiler/dtparser.l index c6578ef91fa7..c6c29ae6a917 100644 --- a/sys/contrib/dev/acpica/compiler/dtparser.l +++ b/sys/contrib/dev/acpica/compiler/dtparser.l @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/dtparser.y b/sys/contrib/dev/acpica/compiler/dtparser.y index 135eaae411b6..0271d78f2947 100644 --- a/sys/contrib/dev/acpica/compiler/dtparser.y +++ b/sys/contrib/dev/acpica/compiler/dtparser.y @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/dtsubtable.c b/sys/contrib/dev/acpica/compiler/dtsubtable.c index fc700cd77703..1e6a76a08c92 100644 --- a/sys/contrib/dev/acpica/compiler/dtsubtable.c +++ b/sys/contrib/dev/acpica/compiler/dtsubtable.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTSUBTABLE_C__ - #include #include diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index 56eb92299745..bc0cbd22ea3f 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTTABLE_C__ - /* Compile all complex data tables */ #include diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index cb3cafde7f7b..3fcf0814c18c 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 4011f087287b..0398d696df20 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 1cd281a86141..3635f1363614 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DTUTILS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/compiler/preprocess.h b/sys/contrib/dev/acpica/compiler/preprocess.h index 532203474af4..d064287733cc 100644 --- a/sys/contrib/dev/acpica/compiler/preprocess.h +++ b/sys/contrib/dev/acpica/compiler/preprocess.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prexpress.c b/sys/contrib/dev/acpica/compiler/prexpress.c index 886da89c477e..0f0d93881bf0 100644 --- a/sys/contrib/dev/acpica/compiler/prexpress.c +++ b/sys/contrib/dev/acpica/compiler/prexpress.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prmacros.c b/sys/contrib/dev/acpica/compiler/prmacros.c index ad7dfa0a9930..866d08943a4c 100644 --- a/sys/contrib/dev/acpica/compiler/prmacros.c +++ b/sys/contrib/dev/acpica/compiler/prmacros.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prparser.l b/sys/contrib/dev/acpica/compiler/prparser.l index 4fc45127aa6b..3150b69c01fa 100644 --- a/sys/contrib/dev/acpica/compiler/prparser.l +++ b/sys/contrib/dev/acpica/compiler/prparser.l @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prparser.y b/sys/contrib/dev/acpica/compiler/prparser.y index c7c1123852b9..20d6e6a0da0e 100644 --- a/sys/contrib/dev/acpica/compiler/prparser.y +++ b/sys/contrib/dev/acpica/compiler/prparser.y @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prscan.c b/sys/contrib/dev/acpica/compiler/prscan.c index ef5d52f65492..12e9b8e61d37 100644 --- a/sys/contrib/dev/acpica/compiler/prscan.c +++ b/sys/contrib/dev/acpica/compiler/prscan.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/compiler/prutils.c b/sys/contrib/dev/acpica/compiler/prutils.c index 92d810f6bddf..e36ea1d86824 100644 --- a/sys/contrib/dev/acpica/compiler/prutils.c +++ b/sys/contrib/dev/acpica/compiler/prutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbcmds.c b/sys/contrib/dev/acpica/components/debugger/dbcmds.c index f28ed2f54e00..c11451d3c972 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbcmds.c +++ b/sys/contrib/dev/acpica/components/debugger/dbcmds.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbconvert.c b/sys/contrib/dev/acpica/components/debugger/dbconvert.c index 1b23002428fd..f6c0286d2add 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbconvert.c +++ b/sys/contrib/dev/acpica/components/debugger/dbconvert.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -361,7 +361,9 @@ AcpiDbEncodePldBuffer ( Dword = 0; ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); - ACPI_PLD_SET_COLOR (&Dword, PldInfo->Color); + ACPI_PLD_SET_RED (&Dword, PldInfo->Red); + ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); + ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); /* Second 32 bits */ @@ -480,45 +482,47 @@ AcpiDbDumpPldBuffer ( /* First 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Revision", PldInfo->Revision); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_IgnoreColor", PldInfo->IgnoreColor); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Red", PldInfo->Red); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Green", PldInfo->Green); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Blue", PldInfo->Blue); /* Second 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Width", PldInfo->Width); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Height", PldInfo->Height); /* Third 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_UserVisible", PldInfo->UserVisible); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Dock", PldInfo->Dock); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Lid", PldInfo->Lid); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Panel", PldInfo->Panel); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalPosition", PldInfo->VerticalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalPosition", PldInfo->HorizontalPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Shape", PldInfo->Shape); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupOrientation", PldInfo->GroupOrientation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupToken", PldInfo->GroupToken); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupPosition", PldInfo->GroupPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Bay", PldInfo->Bay); /* Fourth 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Ejectable", PldInfo->Ejectable); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_EjectRequired", PldInfo->OspmEjectRequired); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CabinetNumber", PldInfo->CabinetNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CardCageNumber", PldInfo->CardCageNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Reference", PldInfo->Reference); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Rotation", PldInfo->Rotation); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Order", PldInfo->Order); /* Fifth 32-bit dword */ if (BufferDesc->Buffer.Length > 16) { - AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset); - AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalOffset", PldInfo->VerticalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); } ACPI_FREE (PldInfo); diff --git a/sys/contrib/dev/acpica/components/debugger/dbdisply.c b/sys/contrib/dev/acpica/components/debugger/dbdisply.c index 988ab83d3de0..507c2b0819ee 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/components/debugger/dbdisply.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -900,7 +900,7 @@ AcpiDbDisplayGpes ( GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NONE) { /* This GPE is not used (no method or handler), ignore it */ @@ -933,7 +933,7 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("RunOnly, "); } - switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) + switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) { case ACPI_GPE_DISPATCH_NONE: @@ -944,6 +944,7 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("Method"); break; + case ACPI_GPE_DISPATCH_HANDLER: AcpiOsPrintf ("Handler"); @@ -961,10 +962,15 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("Implicit Notify on %u devices", Count); break; + case ACPI_GPE_DISPATCH_RAW_HANDLER: + + AcpiOsPrintf ("RawHandler"); + break; + default: AcpiOsPrintf ("UNKNOWN: %X", - GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); + ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)); break; } diff --git a/sys/contrib/dev/acpica/components/debugger/dbexec.c b/sys/contrib/dev/acpica/components/debugger/dbexec.c index da907842e062..79c0ee976195 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/components/debugger/dbexec.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index 579d2acd5dd7..9bf0b2997aaf 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbhistry.c b/sys/contrib/dev/acpica/components/debugger/dbhistry.c index 4a6935bd67d9..e9457794a85a 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbhistry.c +++ b/sys/contrib/dev/acpica/components/debugger/dbhistry.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index 309bcc351fc6..297b9e9614ab 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index dc8a09a29a23..8f2e4dbb4a0f 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/components/debugger/dbmethod.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c index 4345f3a153cf..d749b1dad752 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbnames.c +++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbstats.c b/sys/contrib/dev/acpica/components/debugger/dbstats.c index 9430854200d2..ecedcf95d3a5 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbstats.c +++ b/sys/contrib/dev/acpica/components/debugger/dbstats.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbtest.c b/sys/contrib/dev/acpica/components/debugger/dbtest.c index fe7a33f76aaa..ab149845d968 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbtest.c +++ b/sys/contrib/dev/acpica/components/debugger/dbtest.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbutils.c b/sys/contrib/dev/acpica/components/debugger/dbutils.c index f321608cea64..5db98e1ca713 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbutils.c +++ b/sys/contrib/dev/acpica/components/debugger/dbutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/debugger/dbxface.c b/sys/contrib/dev/acpica/components/debugger/dbxface.c index b58ef4ecb6d8..8d2e0a8920e9 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbxface.c +++ b/sys/contrib/dev/acpica/components/debugger/dbxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c index 9e479fb8ad72..15b7e8753190 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,6 +79,51 @@ AcpiDmPldBuffer ( #define ACPI_BUFFER_BYTES_PER_LINE 8 +/* Strings for ToPld */ + +static char *DmPanelList[] = +{ + "TOP", + "BOTTOM", + "LEFT", + "RIGHT", + "FRONT", + "BACK", + "UNKNOWN", + NULL +}; + +static char *DmVerticalPositionList[] = +{ + "UPPER", + "CENTER", + "LOWER", + NULL +}; + +static char *DmHorizontalPositionList[] = +{ + "LEFT", + "CENTER", + "RIGHT", + NULL +}; + +static char *DmShapeList[] = +{ + "ROUND", + "OVAL", + "SQUARE", + "VERTICALRECTANGLE", + "HORIZONTALRECTANGLE", + "VERTICALTRAPEZOID", + "HORIZONTALTRAPEZOID", + "UNKNOWN", + "CHAMFERED", + NULL +}; + + /******************************************************************************* * * FUNCTION: AcpiDmDisasmByteList @@ -232,8 +277,9 @@ AcpiDmByteList ( break; case ACPI_DASM_PLD_METHOD: - +#if 0 AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); +#endif AcpiDmPldBuffer (Info->Level, ByteData, ByteCount); break; @@ -434,11 +480,12 @@ AcpiDmIsUnicodeBuffer ( return (FALSE); } - /* For each word, 1st byte must be ascii, 2nd byte must be zero */ + /* For each word, 1st byte must be ascii (1-0x7F), 2nd byte must be zero */ for (i = 0; i < (ByteCount - 2); i += 2) { - if ((!ACPI_IS_PRINT (ByteData[i])) || + if ((ByteData[i] == 0) || + (ByteData[i] > 0x7F) || (ByteData[(ACPI_SIZE) i + 1] != 0)) { return (FALSE); @@ -534,9 +581,14 @@ AcpiDmIsPldBuffer ( ACPI_PARSE_OBJECT *Op) { ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *SizeOp; ACPI_PARSE_OBJECT *ParentOp; + /* Buffer size is the buffer argument */ + + SizeOp = Op->Common.Value.Arg; + ParentOp = Op->Common.Parent; if (!ParentOp) { @@ -551,6 +603,9 @@ AcpiDmIsPldBuffer ( if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD)) { + /* Ignore the Size argument in the disassembly of this buffer op */ + + SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (TRUE); } @@ -573,6 +628,9 @@ AcpiDmIsPldBuffer ( if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD)) { + /* Ignore the Size argument in the disassembly of this buffer op */ + + SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (TRUE); } } @@ -582,6 +640,51 @@ AcpiDmIsPldBuffer ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmFindNameByIndex + * + * PARAMETERS: Index - Index of array to check + * List - Array to reference + * + * RETURN: String from List or empty string + * + * DESCRIPTION: Finds and returns the char string located at the given index + * position in List. + * + ******************************************************************************/ + +static char * +AcpiDmFindNameByIndex ( + UINT64 Index, + char **List) +{ + char *Str; + UINT32 i; + + + /* Bounds check */ + + Str = List[0]; + i = 0; + + while(Str) + { + i++; + Str = List[i]; + } + + if (Index >= i) + { + /* TBD: Add error msg */ + + return (""); + } + + return (List[Index]); +} + + /******************************************************************************* * * FUNCTION: AcpiDmPldBuffer @@ -596,9 +699,12 @@ AcpiDmIsPldBuffer ( * ******************************************************************************/ -#define ACPI_PLD_OUTPUT08 "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " " -#define ACPI_PLD_OUTPUT16 "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " " -#define ACPI_PLD_OUTPUT24 "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT08 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT08P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT16 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT16P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT24 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUTSTR "%*.s%-18s = \"%s\",\n", ACPI_MUL_4 (Level), " " static void AcpiDmPldBuffer ( @@ -625,47 +731,63 @@ AcpiDmPldBuffer ( return; } + AcpiOsPrintf ("\n"); + /* First 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Revision", PldInfo->Revision); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "IgnoreColor", PldInfo->IgnoreColor); - AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Revision", PldInfo->Revision); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_IgnoreColor", PldInfo->IgnoreColor); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Red", PldInfo->Red); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Green", PldInfo->Green); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Blue", PldInfo->Blue); /* Second 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width); - AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height); + AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Width", PldInfo->Width); + AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Height", PldInfo->Height); /* Third 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "UserVisible", PldInfo->UserVisible); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Dock", PldInfo->Dock); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Lid", PldInfo->Lid); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Panel", PldInfo->Panel); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "VerticalPosition", PldInfo->VerticalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "HorizontalPosition", PldInfo->HorizontalPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Shape", PldInfo->Shape); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupOrientation", PldInfo->GroupOrientation); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupToken", PldInfo->GroupToken); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupPosition", PldInfo->GroupPosition); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Bay", PldInfo->Bay); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_UserVisible", PldInfo->UserVisible); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Dock", PldInfo->Dock); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel", + AcpiDmFindNameByIndex(PldInfo->Panel, DmPanelList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition", + AcpiDmFindNameByIndex(PldInfo->VerticalPosition, DmVerticalPositionList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition", + AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, DmHorizontalPositionList)); + AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape", + AcpiDmFindNameByIndex(PldInfo->Shape, DmShapeList)); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay); /* Fourth 32-bit dword */ - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Ejectable", PldInfo->Ejectable); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "OspmEjectRequired", PldInfo->OspmEjectRequired); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "CabinetNumber", PldInfo->CabinetNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "CardCageNumber", PldInfo->CardCageNumber); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Reference", PldInfo->Reference); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Rotation", PldInfo->Rotation); - AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Order", PldInfo->Order); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Ejectable", PldInfo->Ejectable); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_EjectRequired", PldInfo->OspmEjectRequired); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CabinetNumber", PldInfo->CabinetNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CardCageNumber", PldInfo->CardCageNumber); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference); + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation); + + if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE) + { + AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order); + } + else + { + AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order); + } /* Fifth 32-bit dword */ if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE) { - AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset); - AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); } ACPI_FREE (PldInfo); @@ -692,6 +814,7 @@ AcpiDmUnicode ( UINT16 *WordData; UINT32 WordCount; UINT32 i; + int OutputValue; /* Extract the buffer info as a WORD buffer */ @@ -704,7 +827,23 @@ AcpiDmUnicode ( AcpiOsPrintf ("\""); for (i = 0; i < (WordCount - 1); i++) { - AcpiOsPrintf ("%c", (int) WordData[i]); + OutputValue = (int) WordData[i]; + + /* Handle values that must be escaped */ + + if ((OutputValue == '\"') || + (OutputValue == '\\')) + { + AcpiOsPrintf ("\\%c", OutputValue); + } + else if (!ACPI_IS_PRINT (OutputValue)) + { + AcpiOsPrintf ("\\x%2.2X", OutputValue); + } + else + { + AcpiOsPrintf ("%c", OutputValue); + } } AcpiOsPrintf ("\")"); diff --git a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c new file mode 100644 index 000000000000..b66dbeda3663 --- /dev/null +++ b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c @@ -0,0 +1,773 @@ +/******************************************************************************* + * + * Module Name: dmcstyle - Support for C-style operator disassembly + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include +#include +#include +#include +#include + +#ifdef ACPI_DISASSEMBLER + +#define _COMPONENT ACPI_CA_DEBUGGER + ACPI_MODULE_NAME ("dmcstyle") + + +/* Local prototypes */ + +static char * +AcpiDmGetCompoundSymbol ( + UINT16 AslOpcode); + +static void +AcpiDmPromoteTarget ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *Target); + +static BOOLEAN +AcpiDmIsValidTarget ( + ACPI_PARSE_OBJECT *Op); + +static BOOLEAN +AcpiDmIsTargetAnOperand ( + ACPI_PARSE_OBJECT *Target, + ACPI_PARSE_OBJECT *Operand, + BOOLEAN TopLevel); + + +/******************************************************************************* + * + * FUNCTION: AcpiDmCheckForSymbolicOpcode + * + * PARAMETERS: Op - Current parse object + * Walk - Current parse tree walk info + * + * RETURN: TRUE if opcode can be converted to symbolic, FALSE otherwise + * + * DESCRIPTION: This is the main code that implements disassembly of AML code + * to C-style operators. Called during descending phase of the + * parse tree walk. + * + ******************************************************************************/ + +BOOLEAN +AcpiDmCheckForSymbolicOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_OP_WALK_INFO *Info) +{ + char *OperatorSymbol = NULL; + ACPI_PARSE_OBJECT *Child1; + ACPI_PARSE_OBJECT *Child2; + ACPI_PARSE_OBJECT *Target; + + + /* Exit immediately if ASL+ not enabled */ + + if (!AcpiGbl_CstyleDisassembly) + { + return (FALSE); + } + + /* Get the first operand */ + + Child1 = AcpiPsGetArg (Op, 0); + if (!Child1) + { + return (FALSE); + } + + /* Get the second operand */ + + Child2 = Child1->Common.Next; + + /* Setup the operator string for this opcode */ + + switch (Op->Common.AmlOpcode) + { + case AML_ADD_OP: + OperatorSymbol = " + "; + break; + + case AML_SUBTRACT_OP: + OperatorSymbol = " - "; + break; + + case AML_MULTIPLY_OP: + OperatorSymbol = " * "; + break; + + case AML_DIVIDE_OP: + OperatorSymbol = " / "; + break; + + case AML_MOD_OP: + OperatorSymbol = " % "; + break; + + case AML_SHIFT_LEFT_OP: + OperatorSymbol = " << "; + break; + + case AML_SHIFT_RIGHT_OP: + OperatorSymbol = " >> "; + break; + + case AML_BIT_AND_OP: + OperatorSymbol = " & "; + break; + + case AML_BIT_OR_OP: + OperatorSymbol = " | "; + break; + + case AML_BIT_XOR_OP: + OperatorSymbol = " ^ "; + break; + + /* Logical operators, no target */ + + case AML_LAND_OP: + OperatorSymbol = " && "; + break; + + case AML_LEQUAL_OP: + OperatorSymbol = " == "; + break; + + case AML_LGREATER_OP: + OperatorSymbol = " > "; + break; + + case AML_LLESS_OP: + OperatorSymbol = " < "; + break; + + case AML_LOR_OP: + OperatorSymbol = " || "; + break; + + case AML_LNOT_OP: + /* + * Check for the LNOT sub-opcodes. These correspond to + * LNotEqual, LLessEqual, and LGreaterEqual. There are + * no actual AML opcodes for these operators. + */ + switch (Child1->Common.AmlOpcode) + { + case AML_LEQUAL_OP: + OperatorSymbol = " != "; + break; + + case AML_LGREATER_OP: + OperatorSymbol = " <= "; + break; + + case AML_LLESS_OP: + OperatorSymbol = " >= "; + break; + + default: + + /* Unary LNOT case, emit "!" immediately */ + + AcpiOsPrintf ("!"); + return (TRUE); + } + + Child1->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; + Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; + + /* Save symbol string in the next child (not peer) */ + + Child2 = AcpiPsGetArg (Child1, 0); + if (!Child2) + { + return (FALSE); + } + + Child2->Common.OperatorSymbol = OperatorSymbol; + return (TRUE); + +#ifdef INDEX_SUPPORT + case AML_INDEX_OP: + Child1->Common.OperatorSymbol = " ["; + Child2->Common.OperatorSymbol = "]"; + break; +#endif + + /* Unary operators */ + + case AML_DECREMENT_OP: + OperatorSymbol = "--"; + break; + + case AML_INCREMENT_OP: + OperatorSymbol = "++"; + break; + + case AML_BIT_NOT_OP: + case AML_STORE_OP: + OperatorSymbol = NULL; + break; + + default: + return (FALSE); + } + + if (Child1->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX) + { + return (TRUE); + } + + /* + * This is the key to how the disassembly of the C-style operators + * works. We save the operator symbol in the first child, thus + * deferring symbol output until after the first operand has been + * emitted. + */ + if (!Child1->Common.OperatorSymbol) + { + Child1->Common.OperatorSymbol = OperatorSymbol; + } + + /* + * Check for a valid target as the 3rd (or sometimes 2nd) operand + * + * Compound assignment operator support: + * Attempt to optimize constructs of the form: + * Add (Local1, 0xFF, Local1) + * to: + * Local1 += 0xFF + * + * Only the math operators and Store() have a target. + * Logicals have no target. + */ + switch (Op->Common.AmlOpcode) + { + case AML_ADD_OP: + case AML_SUBTRACT_OP: + case AML_MULTIPLY_OP: + case AML_DIVIDE_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + + /* Target is 3rd operand */ + + Target = Child2->Common.Next; + if (Op->Common.AmlOpcode == AML_DIVIDE_OP) + { + /* + * Divide has an extra target operand (Remainder). + * If this extra target is specified, it cannot be converted + * to a C-style operator + */ + if (AcpiDmIsValidTarget (Target)) + { + Child1->Common.OperatorSymbol = NULL; + return (FALSE); + } + + Target->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + Target = Target->Common.Next; + } + + /* Parser should ensure there is at least a placeholder target */ + + if (!Target) + { + return (FALSE); + } + + if (!AcpiDmIsValidTarget (Target)) + { + /* Not a valid target (placeholder only, from parser) */ + break; + } + + /* + * Promote the target up to the first child in the parse + * tree. This is done because the target will be output + * first, in the form: + * = Operands... + */ + AcpiDmPromoteTarget (Op, Target); + + /* + * Check for possible conversion to a "Compound Assignment". + * + * Determine if either operand is the same as the target + * and display compound assignment operator and other operand. + */ + if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || + (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) + { + Target->Common.OperatorSymbol = + AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + + /* Convert operator to compound assignment */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; + Child1->Common.OperatorSymbol = NULL; + return (TRUE); + } + + /* + * If we are within a C-style expression, emit an extra open + * paren. Implemented by examining the parent op. + */ + switch (Op->Common.Parent->Common.AmlOpcode) + { + case AML_ADD_OP: + case AML_SUBTRACT_OP: + case AML_MULTIPLY_OP: + case AML_DIVIDE_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + case AML_LAND_OP: + case AML_LEQUAL_OP: + case AML_LGREATER_OP: + case AML_LLESS_OP: + case AML_LOR_OP: + + Op->Common.DisasmFlags |= ACPI_PARSEOP_ASSIGNMENT; + AcpiOsPrintf ("("); + break; + + default: + break; + } + + /* Normal output for ASL/AML operators with a target operand */ + + Target->Common.OperatorSymbol = " = ("; + return (TRUE); + + /* Binary operators, no parens */ + + case AML_DECREMENT_OP: + case AML_INCREMENT_OP: + return (TRUE); + +#ifdef INDEX_SUPPORT + case AML_INDEX_OP: + + /* Target is optional, 3rd operand */ + + Target = Child2->Common.Next; + if (AcpiDmIsValidTarget (Target)) + { + AcpiDmPromoteTarget (Op, Target); + + if (!Target->Common.OperatorSymbol) + { + Target->Common.OperatorSymbol = " = "; + } + } + return (TRUE); +#endif + + case AML_STORE_OP: + /* + * Target is the 2nd operand. + * We know the target is valid, it is not optional. + * In the parse tree, simply swap the target with the + * source so that the target is processed first. + */ + Target = Child1->Common.Next; + AcpiDmPromoteTarget (Op, Target); + + if (!Target->Common.OperatorSymbol) + { + Target->Common.OperatorSymbol = " = "; + } + return (TRUE); + + case AML_BIT_NOT_OP: + + /* Target is optional, 2nd operand */ + + Target = Child1->Common.Next; + if (!Target) + { + return (FALSE); + } + + if (AcpiDmIsValidTarget (Target)) + { + /* Valid target, not a placeholder */ + + AcpiDmPromoteTarget (Op, Target); + Target->Common.OperatorSymbol = " = ~"; + } + else + { + /* No target. Emit this prefix operator immediately */ + + AcpiOsPrintf ("~"); + } + return (TRUE); + + default: + break; + } + + /* All other operators, emit an open paren */ + + AcpiOsPrintf ("("); + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmCloseOperator + * + * PARAMETERS: Op - Current parse object + * + * RETURN: None + * + * DESCRIPTION: Closes an operator by adding a closing parentheses if and + * when necessary. Called during ascending phase of the + * parse tree walk. + * + ******************************************************************************/ + +void +AcpiDmCloseOperator ( + ACPI_PARSE_OBJECT *Op) +{ + + /* Always emit paren if ASL+ disassembly disabled */ + + if (!AcpiGbl_CstyleDisassembly) + { + AcpiOsPrintf (")"); + return; + } + + /* Check if we need to add an additional closing paren */ + + switch (Op->Common.AmlOpcode) + { + case AML_ADD_OP: + case AML_SUBTRACT_OP: + case AML_MULTIPLY_OP: + case AML_DIVIDE_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + case AML_LAND_OP: + case AML_LEQUAL_OP: + case AML_LGREATER_OP: + case AML_LLESS_OP: + case AML_LOR_OP: + + /* Emit paren only if this is not a compound assignment */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND) + { + return; + } + + /* Emit extra close paren for assignment within an expression */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_ASSIGNMENT) + { + AcpiOsPrintf (")"); + } + break; + + + /* No need for parens for these */ + +#ifdef INDEX_SUPPORT + case AML_INDEX_OP: +#endif + case AML_DECREMENT_OP: + case AML_INCREMENT_OP: + case AML_LNOT_OP: + case AML_BIT_NOT_OP: + case AML_STORE_OP: + return; + + default: + + /* Always emit paren for non-ASL+ operators */ + break; + } + + AcpiOsPrintf (")"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGetCompoundSymbol + * + * PARAMETERS: AslOpcode + * + * RETURN: String containing the compound assignment symbol + * + * DESCRIPTION: Detect opcodes that can be converted to compound assignment, + * return the appropriate operator string. + * + ******************************************************************************/ + +static char * +AcpiDmGetCompoundSymbol ( + UINT16 AmlOpcode) +{ + char *Symbol; + + + switch (AmlOpcode) + { + case AML_ADD_OP: + Symbol = " += "; + break; + + case AML_SUBTRACT_OP: + Symbol = " -= "; + break; + + case AML_MULTIPLY_OP: + Symbol = " *= "; + break; + + case AML_DIVIDE_OP: + Symbol = " /= "; + break; + + case AML_MOD_OP: + Symbol = " %= "; + break; + + case AML_SHIFT_LEFT_OP: + Symbol = " <<= "; + break; + + case AML_SHIFT_RIGHT_OP: + Symbol = " >>= "; + break; + + case AML_BIT_AND_OP: + Symbol = " &= "; + break; + + case AML_BIT_OR_OP: + Symbol = " |= "; + break; + + case AML_BIT_XOR_OP: + Symbol = " ^= "; + break; + + default: + + /* No operator string for all other opcodes */ + return (NULL); + } + + return (Symbol); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmPromoteTarget + * + * PARAMETERS: Op - Operator parse object + * Target - Target associate with the Op + * + * RETURN: None + * + * DESCRIPTION: Transform the parse tree by moving the target up to the first + * child of the Op. + * + ******************************************************************************/ + +static void +AcpiDmPromoteTarget ( + ACPI_PARSE_OBJECT *Op, + ACPI_PARSE_OBJECT *Target) +{ + ACPI_PARSE_OBJECT *Child; + + + /* Link target directly to the Op as first child */ + + Child = Op->Common.Value.Arg; + Op->Common.Value.Arg = Target; + Target->Common.Next = Child; + + /* Find the last peer, it is linked to the target. Unlink it. */ + + while (Child->Common.Next != Target) + { + Child = Child->Common.Next; + } + + Child->Common.Next = NULL; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsValidTarget + * + * PARAMETERS: Target - Target Op from the parse tree + * + * RETURN: TRUE if the Target is real. FALSE if it is just a placeholder + * Op that was inserted by the parser. + * + * DESCRIPTION: Determine if a Target Op is a placeholder Op or a real Target. + * In other words, determine if the optional target is used or + * not. + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsValidTarget ( + ACPI_PARSE_OBJECT *Target) +{ + + if ((Target->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && + (Target->Common.Value.Arg == NULL)) + { + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsTargetAnOperand + * + * PARAMETERS: Target - Target associated with the expression + * Operand - An operand associated with expression + * + * RETURN: TRUE if expression can be converted to a compound assignment. + * FALSE otherwise. + * + * DESCRIPTION: Determine if the Target duplicates the operand, in order to + * detect if the expression can be converted to a compound + * assigment. (+=, *=, etc.) + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsTargetAnOperand ( + ACPI_PARSE_OBJECT *Target, + ACPI_PARSE_OBJECT *Operand, + BOOLEAN TopLevel) +{ + const ACPI_OPCODE_INFO *OpInfo; + BOOLEAN Same; + + + /* + * Opcodes must match. Note: ignoring the difference between nameseg + * and namepath for now. May be needed later. + */ + if (Target->Common.AmlOpcode != Operand->Common.AmlOpcode) + { + return (FALSE); + } + + /* Nodes should match, even if they are NULL */ + + if (Target->Common.Node != Operand->Common.Node) + { + return (FALSE); + } + + /* Determine if a child exists */ + + OpInfo = AcpiPsGetOpcodeInfo (Operand->Common.AmlOpcode); + if (OpInfo->Flags & AML_HAS_ARGS) + { + Same = AcpiDmIsTargetAnOperand (Target->Common.Value.Arg, + Operand->Common.Value.Arg, FALSE); + if (!Same) + { + return (FALSE); + } + } + + /* Check the next peer, as long as we are not at the top level */ + + if ((!TopLevel) && + Target->Common.Next) + { + Same = AcpiDmIsTargetAnOperand (Target->Common.Next, + Operand->Common.Next, FALSE); + if (!Same) + { + return (FALSE); + } + } + + /* Supress the duplicate operand at the top-level */ + + if (TopLevel) + { + Operand->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + } + return (TRUE); +} + +#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c index 9fa82b098a2b..9bf7451ed951 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmnames.c b/sys/contrib/dev/acpica/components/disassembler/dmnames.c index e0b8545d7334..07a90ffd9992 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmnames.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmobject.c b/sys/contrib/dev/acpica/components/disassembler/dmobject.c index 6df0ff51eef7..6559ec04bfec 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmobject.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmobject.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index e8f2c9752fdc..f2ef535a0966 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,7 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmopcode") + /* Local prototypes */ static void @@ -567,7 +568,6 @@ AcpiDmRegionFlags ( ACPI_PARSE_OBJECT *Op) { - /* The next Op contains the SpaceId */ Op = AcpiPsGetDepthNext (NULL, Op); @@ -637,7 +637,6 @@ AcpiDmMatchKeyword ( ACPI_PARSE_OBJECT *Op) { - if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE) { AcpiOsPrintf ("/* Unknown Match Keyword encoding */"); @@ -694,27 +693,27 @@ AcpiDmDisassembleOneOp ( case ACPI_DASM_LNOT_SUFFIX: - switch (Op->Common.AmlOpcode) + if (!AcpiGbl_CstyleDisassembly) { - case AML_LEQUAL_OP: + switch (Op->Common.AmlOpcode) + { + case AML_LEQUAL_OP: + AcpiOsPrintf ("LNotEqual"); + break; - AcpiOsPrintf ("LNotEqual"); - break; + case AML_LGREATER_OP: + AcpiOsPrintf ("LLessEqual"); + break; - case AML_LGREATER_OP: + case AML_LLESS_OP: + AcpiOsPrintf ("LGreaterEqual"); + break; - AcpiOsPrintf ("LLessEqual"); - break; - - case AML_LLESS_OP: - - AcpiOsPrintf ("LGreaterEqual"); - break; - - default: - - break; + default: + break; + } } + Op->Common.DisasmOpcode = 0; Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return; @@ -723,7 +722,6 @@ AcpiDmDisassembleOneOp ( break; } - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); /* The op and arguments */ @@ -845,7 +843,7 @@ AcpiDmDisassembleOneOp ( else if (AcpiDmIsPldBuffer (Op)) { Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD; - AcpiOsPrintf ("Buffer"); + AcpiOsPrintf ("ToPLD ("); } else { diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c index 04a6fbb02a5d..2a8147e820bd 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c index a6c38a8d169a..b0cf41e0c214 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index 452cde04b7be..ff5fabc64524 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c index 549c3d6b33da..31b68b2e853a 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/disassembler/dmutils.c b/sys/contrib/dev/acpica/components/disassembler/dmutils.c index bb9ef73c917f..bdc252e29ba2 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmutils.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -256,6 +256,13 @@ AcpiDmCommaIfListMember ( if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST) { + /* Exit if Target has been marked IGNORE */ + + if (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) + { + return (FALSE); + } + /* Check for a NULL target operand */ if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && @@ -279,7 +286,13 @@ AcpiDmCommaIfListMember ( return (FALSE); } - AcpiOsPrintf (", "); + /* Emit comma only if this is not a C-style operator */ + + if (!Op->Common.OperatorSymbol) + { + AcpiOsPrintf (", "); + } + return (TRUE); } diff --git a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c index 8021a9731864..43a11398cd9e 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -285,7 +285,8 @@ AcpiDmBlockType ( case AML_BUFFER_OP: if ((Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) || - (Op->Common.DisasmOpcode == ACPI_DASM_UUID)) + (Op->Common.DisasmOpcode == ACPI_DASM_UUID) || + (Op->Common.DisasmOpcode == ACPI_DASM_PLD_METHOD)) { return (BLOCK_NONE); } @@ -301,6 +302,17 @@ AcpiDmBlockType ( return (BLOCK_PAREN); + case AML_INT_METHODCALL_OP: + + if (Op->Common.Parent && + ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))) + { + /* This is a reference to a method, not an invocation */ + + return (BLOCK_NONE); + } + default: OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); @@ -477,13 +489,20 @@ AcpiDmDescendingOp ( * keep track of the current column. */ Info->Count++; - if (Info->Count /* +Info->LastLevel */ > 10) + if (Info->Count /* +Info->LastLevel */ > 12) { Info->Count = 0; AcpiOsPrintf ("\n"); AcpiDmIndent (Info->LastLevel + 1); } + /* If ASL+ is enabled, check for a C-style operator */ + + if (AcpiDmCheckForSymbolicOpcode (Op, Info)) + { + return (AE_OK); + } + /* Print the opcode name */ AcpiDmDisassembleOneOp (NULL, Info, Op); @@ -563,7 +582,6 @@ AcpiDmDescendingOp ( AcpiDmPredefinedDescription (Op); break; - case AML_NAME_OP: /* Check for _HID and related EISAID() */ @@ -572,13 +590,11 @@ AcpiDmDescendingOp ( AcpiOsPrintf (", "); break; - case AML_REGION_OP: AcpiDmRegionFlags (Op); break; - case AML_POWER_RES_OP: /* Mark the next two Ops as part of the parameter list */ @@ -591,7 +607,6 @@ AcpiDmDescendingOp ( NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); - case AML_PROCESSOR_OP: /* Mark the next three Ops as part of the parameter list */ @@ -607,20 +622,17 @@ AcpiDmDescendingOp ( NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); - case AML_MUTEX_OP: case AML_DATA_REGION_OP: AcpiOsPrintf (", "); return (AE_OK); - case AML_EVENT_OP: case AML_ALIAS_OP: return (AE_OK); - case AML_SCOPE_OP: case AML_DEVICE_OP: case AML_THERMAL_ZONE_OP: @@ -628,7 +640,6 @@ AcpiDmDescendingOp ( AcpiOsPrintf (")"); break; - default: AcpiOsPrintf ("*** Unhandled named opcode %X\n", @@ -825,9 +836,9 @@ AcpiDmAscendingOp ( { case BLOCK_PAREN: - /* Completed an op that has arguments, add closing paren */ + /* Completed an op that has arguments, add closing paren if needed */ - AcpiOsPrintf (")"); + AcpiDmCloseOperator (Op); if (Op->Common.AmlOpcode == AML_NAME_OP) { @@ -999,8 +1010,21 @@ AcpiDmAscendingOp ( { Info->Level++; } + + /* + * For ASL+, check for and emit a C-style symbol. If valid, the + * symbol string has been deferred until after the first operand + */ + if (AcpiGbl_CstyleDisassembly) + { + if (Op->Asl.OperatorSymbol) + { + AcpiOsPrintf ("%s", Op->Asl.OperatorSymbol); + Op->Asl.OperatorSymbol = NULL; + } + } + return (AE_OK); } - #endif /* ACPI_DISASSEMBLER */ diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsargs.c b/sys/contrib/dev/acpica/components/dispatcher/dsargs.c index fd7c7958b27e..254f704c96a7 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsargs.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsargs.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSARGS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c index c2fac77b8821..bb2315620320 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSCONTROL_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c index 262b63a4459a..d376bb1a3c03 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSFIELD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c b/sys/contrib/dev/acpica/components/dispatcher/dsinit.c index 6789fe413d6d..62f9bde97741 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSINIT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c index 1fd81738bc25..a687c7258060 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSMETHOD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c b/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c index 8e4555c2a9f2..4b998d94c6ab 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSMTHDAT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c b/sys/contrib/dev/acpica/components/dispatcher/dsobject.c index 04515fde6a58..106c6abe690c 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSOBJECT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c index fa225ce1d1bd..86fe26c328f3 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSOPCODE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c index cb1c84603fb6..f4f0f33b8c6b 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSUTILS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c index c6009fb159fb..f391fe0e022b 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSWEXEC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload.c b/sys/contrib/dev/acpica/components/dispatcher/dswload.c index eca145e384d3..8bc425a2595f 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSWLOAD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c index abcc1c3e74d7..472877494bb3 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSWLOAD2_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswscope.c b/sys/contrib/dev/acpica/components/dispatcher/dswscope.c index 5d2152b2fb4b..dc1fedc9b949 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswscope.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSWSCOPE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswstate.c b/sys/contrib/dev/acpica/components/dispatcher/dswstate.c index 4071d5f8226d..5211666acb25 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswstate.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __DSWSTATE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/events/evevent.c b/sys/contrib/dev/acpica/components/events/evevent.c index 3116ac61a7c6..45d227cbf565 100644 --- a/sys/contrib/dev/acpica/components/events/evevent.c +++ b/sys/contrib/dev/acpica/components/events/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/events/evglock.c b/sys/contrib/dev/acpica/components/events/evglock.c index 44c768a753b1..a9855c98aac3 100644 --- a/sys/contrib/dev/acpica/components/events/evglock.c +++ b/sys/contrib/dev/acpica/components/events/evglock.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/events/evgpe.c b/sys/contrib/dev/acpica/components/events/evgpe.c index 7d4a5d03d8ec..99043ad18787 100644 --- a/sys/contrib/dev/acpica/components/events/evgpe.c +++ b/sys/contrib/dev/acpica/components/events/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,18 +131,6 @@ AcpiEvEnableGpe ( ACPI_FUNCTION_TRACE (EvEnableGpe); - /* - * We will only allow a GPE to be enabled if it has either an associated - * method (_Lxx/_Exx) or a handler, or is using the implicit notify - * feature. Otherwise, the GPE will be immediately disabled by - * AcpiEvGpeDispatch the first time it fires. - */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_NONE) - { - return_ACPI_STATUS (AE_NO_HANDLER); - } - /* Clear the GPE (of stale events) */ Status = AcpiHwClearGpe (GpeEventInfo); @@ -153,7 +141,7 @@ AcpiEvEnableGpe ( /* Enable the requested GPE */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE_SAVE); return_ACPI_STATUS (Status); } @@ -243,7 +231,7 @@ AcpiEvRemoveGpeReference ( Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE_SAVE); } if (ACPI_FAILURE (Status)) @@ -383,7 +371,11 @@ AcpiEvGpeDetect ( { ACPI_STATUS Status; ACPI_GPE_BLOCK_INFO *GpeBlock; + ACPI_NAMESPACE_NODE *GpeDevice; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + UINT32 GpeNumber; + ACPI_GPE_HANDLER_INFO *GpeHandlerInfo; UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT8 EnabledStatusByte; UINT32 StatusReg; @@ -414,6 +406,8 @@ AcpiEvGpeDetect ( GpeBlock = GpeXruptList->GpeBlockListHead; while (GpeBlock) { + GpeDevice = GpeBlock->Node; + /* * Read all of the 8-bit GPE status and enable registers in this GPE * block, saving all of them. Find all currently active GP events. @@ -482,16 +476,55 @@ AcpiEvGpeDetect ( { /* Examine one GPE bit */ + GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * + ACPI_GPE_REGISTER_WIDTH) + j]; + GpeNumber = j + GpeRegisterInfo->BaseGpeNumber; + if (EnabledStatusByte & (1 << j)) { - /* - * Found an active GPE. Dispatch the event to a handler - * or method. - */ - IntStatus |= AcpiEvGpeDispatch (GpeBlock->Node, - &GpeBlock->EventInfo[((ACPI_SIZE) i * - ACPI_GPE_REGISTER_WIDTH) + j], - j + GpeRegisterInfo->BaseGpeNumber); + /* Invoke global event handler if present */ + + AcpiGpeCount++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, + GpeDevice, GpeNumber, + AcpiGbl_GlobalEventHandlerContext); + } + + /* Found an active GPE */ + + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_RAW_HANDLER) + { + /* Dispatch the event to a raw handler */ + + GpeHandlerInfo = GpeEventInfo->Dispatch.Handler; + + /* + * There is no protection around the namespace node + * and the GPE handler to ensure a safe destruction + * because: + * 1. The namespace node is expected to always + * exist after loading a table. + * 2. The GPE handler is expected to be flushed by + * AcpiOsWaitEventsComplete() before the + * destruction. + */ + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + IntStatus |= GpeHandlerInfo->Address ( + GpeDevice, GpeNumber, GpeHandlerInfo->Context); + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + } + else + { + /* + * Dispatch the event to a standard handler or + * method. + */ + IntStatus |= AcpiEvGpeDispatch (GpeDevice, + GpeEventInfo, GpeNumber); + } } } } @@ -527,8 +560,7 @@ AcpiEvAsynchExecuteGpeMethod ( void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; - ACPI_STATUS Status; - ACPI_GPE_EVENT_INFO *LocalGpeEventInfo; + ACPI_STATUS Status = AE_OK; ACPI_EVALUATE_INFO *Info; ACPI_GPE_NOTIFY_INFO *Notify; @@ -536,49 +568,9 @@ AcpiEvAsynchExecuteGpeMethod ( ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod); - /* Allocate a local GPE block */ - - LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO)); - if (!LocalGpeEventInfo) - { - ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, - "while handling a GPE")); - return_VOID; - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (LocalGpeEventInfo); - return_VOID; - } - - /* Must revalidate the GpeNumber/GpeBlock */ - - if (!AcpiEvValidGpeEvent (GpeEventInfo)) - { - Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - ACPI_FREE (LocalGpeEventInfo); - return_VOID; - } - - /* - * Take a snapshot of the GPE info for this level - we copy the info to - * prevent a race condition with RemoveHandler/RemoveBlock. - */ - ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo, - sizeof (ACPI_GPE_EVENT_INFO)); - - Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (LocalGpeEventInfo); - return_VOID; - } - /* Do the correct dispatch - normal method or implicit notify */ - switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) + switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) { case ACPI_GPE_DISPATCH_NOTIFY: /* @@ -592,7 +584,7 @@ AcpiEvAsynchExecuteGpeMethod ( * June 2012: Expand implicit notify mechanism to support * notifies on multiple device objects. */ - Notify = LocalGpeEventInfo->Dispatch.NotifyList; + Notify = GpeEventInfo->Dispatch.NotifyList; while (ACPI_SUCCESS (Status) && Notify) { Status = AcpiEvQueueNotifyRequest (Notify->DeviceNode, @@ -617,7 +609,7 @@ AcpiEvAsynchExecuteGpeMethod ( * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the * _Lxx/_Exx control method that corresponds to this GPE */ - Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode; + Info->PrefixNode = GpeEventInfo->Dispatch.MethodNode; Info->Flags = ACPI_IGNORE_RETURN_VALUE; Status = AcpiNsEvaluate (Info); @@ -628,23 +620,26 @@ AcpiEvAsynchExecuteGpeMethod ( { ACPI_EXCEPTION ((AE_INFO, Status, "while evaluating GPE method [%4.4s]", - AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); + AcpiUtGetNodeName (GpeEventInfo->Dispatch.MethodNode))); } break; default: - return_VOID; /* Should never happen */ + goto ErrorExit; /* Should never happen */ } /* Defer enabling of GPE until all notify handlers are done */ Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, - AcpiEvAsynchEnableGpe, LocalGpeEventInfo); - if (ACPI_FAILURE (Status)) + AcpiEvAsynchEnableGpe, GpeEventInfo); + if (ACPI_SUCCESS (Status)) { - ACPI_FREE (LocalGpeEventInfo); + return_VOID; } + +ErrorExit: + AcpiEvAsynchEnableGpe (GpeEventInfo); return_VOID; } @@ -668,11 +663,13 @@ AcpiEvAsynchEnableGpe ( void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; + ACPI_CPU_FLAGS Flags; + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); (void) AcpiEvFinishGpe (GpeEventInfo); + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - ACPI_FREE (GpeEventInfo); return; } @@ -713,7 +710,7 @@ AcpiEvFinishGpe ( /* * Enable this GPE, conditionally. This means that the GPE will - * only be physically enabled if the EnableForRun bit is set + * only be physically enabled if the EnableMask bit is set * in the EventInfo. */ (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); @@ -751,15 +748,6 @@ AcpiEvGpeDispatch ( ACPI_FUNCTION_TRACE (EvGpeDispatch); - /* Invoke global event handler if present */ - - AcpiGpeCount++; - if (AcpiGbl_GlobalEventHandler) - { - AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, GpeDevice, - GpeNumber, AcpiGbl_GlobalEventHandlerContext); - } - /* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution @@ -802,7 +790,7 @@ AcpiEvGpeDispatch ( * If there is neither a handler nor a method, leave the GPE * disabled. */ - switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) + switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) { case ACPI_GPE_DISPATCH_HANDLER: diff --git a/sys/contrib/dev/acpica/components/events/evgpeblk.c b/sys/contrib/dev/acpica/components/events/evgpeblk.c index e8f0d637f1c9..53528c6fcce5 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeblk.c +++ b/sys/contrib/dev/acpica/components/events/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -518,8 +518,9 @@ AcpiEvInitializeGpeBlock ( * Ignore GPEs that have no corresponding _Lxx/_Exx method * and GPEs that are used to wake the system */ - if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_NONE) || - ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) || + if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NONE) || + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_HANDLER) || + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_RAW_HANDLER) || (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) { continue; diff --git a/sys/contrib/dev/acpica/components/events/evgpeinit.c b/sys/contrib/dev/acpica/components/events/evgpeinit.c index d5e00e380bf8..0e53a1d67788 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeinit.c +++ b/sys/contrib/dev/acpica/components/events/evgpeinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -419,15 +419,17 @@ AcpiEvMatchGpeMethod ( return_ACPI_STATUS (AE_OK); } - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_HANDLER) + if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_HANDLER) || + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_RAW_HANDLER)) { /* If there is already a handler, ignore this GPE method */ return_ACPI_STATUS (AE_OK); } - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_METHOD) { /* diff --git a/sys/contrib/dev/acpica/components/events/evgpeutil.c b/sys/contrib/dev/acpica/components/events/evgpeutil.c index e2a44bc91b9d..1f0385935c99 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeutil.c +++ b/sys/contrib/dev/acpica/components/events/evgpeutil.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,60 +113,6 @@ AcpiEvWalkGpeList ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvValidGpeEvent - * - * PARAMETERS: GpeEventInfo - Info for this GPE - * - * RETURN: TRUE if the GpeEvent is valid - * - * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. - * Should be called only when the GPE lists are semaphore locked - * and not subject to change. - * - ******************************************************************************/ - -BOOLEAN -AcpiEvValidGpeEvent ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) -{ - ACPI_GPE_XRUPT_INFO *GpeXruptBlock; - ACPI_GPE_BLOCK_INFO *GpeBlock; - - - ACPI_FUNCTION_ENTRY (); - - - /* No need for spin lock since we are not changing any list elements */ - - /* Walk the GPE interrupt levels */ - - GpeXruptBlock = AcpiGbl_GpeXruptListHead; - while (GpeXruptBlock) - { - GpeBlock = GpeXruptBlock->GpeBlockListHead; - - /* Walk the GPE blocks on this interrupt level */ - - while (GpeBlock) - { - if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) && - (&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo)) - { - return (TRUE); - } - - GpeBlock = GpeBlock->Next; - } - - GpeXruptBlock = GpeXruptBlock->Next; - } - - return (FALSE); -} - - /******************************************************************************* * * FUNCTION: AcpiEvGetGpeDevice @@ -416,8 +362,10 @@ AcpiEvDeleteGpeHandlers ( GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j]; - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_HANDLER) + if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_HANDLER) || + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_RAW_HANDLER)) { /* Delete an installed handler block */ @@ -425,7 +373,7 @@ AcpiEvDeleteGpeHandlers ( GpeEventInfo->Dispatch.Handler = NULL; GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; } - else if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + else if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NOTIFY) { /* Delete the implicit notification device list */ diff --git a/sys/contrib/dev/acpica/components/events/evhandler.c b/sys/contrib/dev/acpica/components/events/evhandler.c index 73a2df284858..419936bc2f3e 100644 --- a/sys/contrib/dev/acpica/components/events/evhandler.c +++ b/sys/contrib/dev/acpica/components/events/evhandler.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVHANDLER_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/events/evmisc.c b/sys/contrib/dev/acpica/components/events/evmisc.c index a710b569f7ed..b1785436133b 100644 --- a/sys/contrib/dev/acpica/components/events/evmisc.c +++ b/sys/contrib/dev/acpica/components/events/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c index 8078bf92c49c..19ceb26dbd11 100644 --- a/sys/contrib/dev/acpica/components/events/evregion.c +++ b/sys/contrib/dev/acpica/components/events/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVREGION_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/events/evrgnini.c b/sys/contrib/dev/acpica/components/events/evrgnini.c index 14fea69261cd..2984e8c92491 100644 --- a/sys/contrib/dev/acpica/components/events/evrgnini.c +++ b/sys/contrib/dev/acpica/components/events/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVRGNINI_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/events/evsci.c b/sys/contrib/dev/acpica/components/events/evsci.c index 8688a31adf1a..70920a52bb22 100644 --- a/sys/contrib/dev/acpica/components/events/evsci.c +++ b/sys/contrib/dev/acpica/components/events/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/events/evxface.c b/sys/contrib/dev/acpica/components/events/evxface.c index cdb6fce2753d..6a4b25476493 100644 --- a/sys/contrib/dev/acpica/components/events/evxface.c +++ b/sys/contrib/dev/acpica/components/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVXFACE_C__ #define EXPORT_ACPI_INTERFACES #include @@ -53,6 +52,21 @@ #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxface") +#if (!ACPI_REDUCED_HARDWARE) + +/* Local prototypes */ + +static ACPI_STATUS +AcpiEvInstallGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + BOOLEAN IsRawHandler, + ACPI_GPE_HANDLER Address, + void *Context); + +#endif + /******************************************************************************* * @@ -823,27 +837,31 @@ ACPI_EXPORT_SYMBOL (AcpiRemoveFixedEventHandler) /******************************************************************************* * - * FUNCTION: AcpiInstallGpeHandler + * FUNCTION: AcpiEvInstallGpeHandler * * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT * defined GPEs) * GpeNumber - The GPE number within the GPE block * Type - Whether this GPE should be treated as an * edge- or level-triggered interrupt. + * IsRawHandler - Whether this GPE should be handled using + * the special GPE handler mode. * Address - Address of the handler * Context - Value passed to the handler on each GPE * * RETURN: Status * - * DESCRIPTION: Install a handler for a General Purpose Event. + * DESCRIPTION: Internal function to install a handler for a General Purpose + * Event. * ******************************************************************************/ -ACPI_STATUS -AcpiInstallGpeHandler ( +static ACPI_STATUS +AcpiEvInstallGpeHandler ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, + BOOLEAN IsRawHandler, ACPI_GPE_HANDLER Address, void *Context) { @@ -853,7 +871,7 @@ AcpiInstallGpeHandler ( ACPI_CPU_FLAGS Flags; - ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler); + ACPI_FUNCTION_TRACE (EvInstallGpeHandler); /* Parameter validation */ @@ -891,8 +909,10 @@ AcpiInstallGpeHandler ( /* Make sure that there isn't a handler there already */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_HANDLER) + if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_HANDLER) || + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_RAW_HANDLER)) { Status = AE_ALREADY_EXISTS; goto FreeAndExit; @@ -909,8 +929,10 @@ AcpiInstallGpeHandler ( * automatically during initialization, in which case it has to be * disabled now to avoid spurious execution of the handler. */ - if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || - (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && + if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == + ACPI_GPE_DISPATCH_METHOD) || + (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == + ACPI_GPE_DISPATCH_NOTIFY)) && GpeEventInfo->RuntimeCount) { Handler->OriginallyEnabled = TRUE; @@ -931,7 +953,8 @@ AcpiInstallGpeHandler ( /* Setup up dispatch flags to indicate handler (vs. method/notify) */ GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); - GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER); + GpeEventInfo->Flags |= (UINT8) (Type | (IsRawHandler ? + ACPI_GPE_DISPATCH_RAW_HANDLER : ACPI_GPE_DISPATCH_HANDLER)); AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); @@ -946,9 +969,89 @@ AcpiInstallGpeHandler ( goto UnlockAndExit; } + +/******************************************************************************* + * + * FUNCTION: AcpiInstallGpeHandler + * + * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT + * defined GPEs) + * GpeNumber - The GPE number within the GPE block + * Type - Whether this GPE should be treated as an + * edge- or level-triggered interrupt. + * Address - Address of the handler + * Context - Value passed to the handler on each GPE + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for a General Purpose Event. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Address, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler); + + + Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, FALSE, + Address, Context); + + return_ACPI_STATUS (Status); +} + ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler) +/******************************************************************************* + * + * FUNCTION: AcpiInstallGpeRawHandler + * + * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT + * defined GPEs) + * GpeNumber - The GPE number within the GPE block + * Type - Whether this GPE should be treated as an + * edge- or level-triggered interrupt. + * Address - Address of the handler + * Context - Value passed to the handler on each GPE + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for a General Purpose Event. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGpeRawHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Address, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallGpeRawHandler); + + + Status = AcpiEvInstallGpeHandler (GpeDevice, GpeNumber, Type, TRUE, + Address, Context); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallGpeRawHandler) + + /******************************************************************************* * * FUNCTION: AcpiRemoveGpeHandler @@ -1005,8 +1108,10 @@ AcpiRemoveGpeHandler ( /* Make sure that a handler is indeed installed */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != - ACPI_GPE_DISPATCH_HANDLER) + if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != + ACPI_GPE_DISPATCH_HANDLER) && + (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != + ACPI_GPE_DISPATCH_RAW_HANDLER)) { Status = AE_NOT_EXIST; goto UnlockAndExit; @@ -1023,6 +1128,7 @@ AcpiRemoveGpeHandler ( /* Remove the handler */ Handler = GpeEventInfo->Dispatch.Handler; + GpeEventInfo->Dispatch.Handler = NULL; /* Restore Method node (if any), set dispatch flags */ @@ -1036,8 +1142,10 @@ AcpiRemoveGpeHandler ( * enabled, it should be enabled at this point to restore the * post-initialization configuration. */ - if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || - (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && + if (((ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == + ACPI_GPE_DISPATCH_METHOD) || + (ACPI_GPE_DISPATCH_TYPE (Handler->OriginalFlags) == + ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { (void) AcpiEvAddGpeReference (GpeEventInfo); diff --git a/sys/contrib/dev/acpica/components/events/evxfevnt.c b/sys/contrib/dev/acpica/components/events/evxfevnt.c index abb0c0e4e48c..08507b36323f 100644 --- a/sys/contrib/dev/acpica/components/events/evxfevnt.c +++ b/sys/contrib/dev/acpica/components/events/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVXFEVNT_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/events/evxfgpe.c b/sys/contrib/dev/acpica/components/events/evxfgpe.c index c03f5c07d391..f09d56a4ae9f 100644 --- a/sys/contrib/dev/acpica/components/events/evxfgpe.c +++ b/sys/contrib/dev/acpica/components/events/evxfgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVXFGPE_C__ #define EXPORT_ACPI_INTERFACES #include @@ -148,7 +147,7 @@ AcpiEnableGpe ( GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (GpeEventInfo) { - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { Status = AcpiEvAddGpeReference (GpeEventInfo); @@ -222,12 +221,21 @@ ACPI_EXPORT_SYMBOL (AcpiDisableGpe) * RETURN: Status * * DESCRIPTION: Enable or disable an individual GPE. This function bypasses - * the reference count mechanism used in the AcpiEnableGpe and - * AcpiDisableGpe interfaces -- and should be used with care. + * the reference count mechanism used in the AcpiEnableGpe(), + * AcpiDisableGpe() interfaces. + * This API is typically used by the GPE raw handler mode driver + * to switch between the polling mode and the interrupt mode after + * the driver has enabled the GPE. + * The APIs should be invoked in this order: + * AcpiEnableGpe() <- Ensure the reference count > 0 + * AcpiSetGpe(ACPI_GPE_DISABLE) <- Enter polling mode + * AcpiSetGpe(ACPI_GPE_ENABLE) <- Leave polling mode + * AcpiDisableGpe() <- Decrease the reference count * - * Note: Typically used to disable a runtime GPE for short period of time, - * then re-enable it, without disturbing the existing reference counts. This - * is useful, for example, in the Embedded Controller (EC) driver. + * Note: If a GPE is shared by 2 silicon components, then both the drivers + * should support GPE polling mode or disabling the GPE for long period + * for one driver may break the other. So use it with care since all + * firmware _Lxx/_Exx handlers currently rely on the GPE interrupt mode. * ******************************************************************************/ @@ -262,7 +270,7 @@ AcpiSetGpe ( { case ACPI_GPE_ENABLE: - Status = AcpiEvEnableGpe (GpeEventInfo); + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); break; case ACPI_GPE_DISABLE: @@ -431,7 +439,7 @@ AcpiSetupGpeForWake ( * known as an "implicit notify". Note: The GPE is assumed to be * level-triggered (for windows compatibility). */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NONE) { /* @@ -446,7 +454,7 @@ AcpiSetupGpeForWake ( * If we already have an implicit notify on this GPE, add * this device to the notify list. */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NOTIFY) { /* Ensure that the device is not already in the list */ @@ -803,6 +811,44 @@ AcpiEnableAllRuntimeGpes ( ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes) +/****************************************************************************** + * + * FUNCTION: AcpiEnableAllWakeupGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Enable all "wakeup" GPEs and disable all of the other GPEs, in + * all GPE blocks. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableAllWakeupGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiEnableAllWakeupGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwEnableAllWakeupGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableAllWakeupGpes) + + /******************************************************************************* * * FUNCTION: AcpiInstallGpeBlock diff --git a/sys/contrib/dev/acpica/components/events/evxfregn.c b/sys/contrib/dev/acpica/components/events/evxfregn.c index eb53c0d852ff..8b0d80e348ef 100644 --- a/sys/contrib/dev/acpica/components/events/evxfregn.c +++ b/sys/contrib/dev/acpica/components/events/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EVXFREGN_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/executer/exconfig.c b/sys/contrib/dev/acpica/components/executer/exconfig.c index c3bb563fbf78..0627f997a9cc 100644 --- a/sys/contrib/dev/acpica/components/executer/exconfig.c +++ b/sys/contrib/dev/acpica/components/executer/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXCONFIG_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exconvrt.c b/sys/contrib/dev/acpica/components/executer/exconvrt.c index f2557c0239ff..50ccf266eec4 100644 --- a/sys/contrib/dev/acpica/components/executer/exconvrt.c +++ b/sys/contrib/dev/acpica/components/executer/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXCONVRT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/excreate.c b/sys/contrib/dev/acpica/components/executer/excreate.c index 224249dea1a1..a855f200a86d 100644 --- a/sys/contrib/dev/acpica/components/executer/excreate.c +++ b/sys/contrib/dev/acpica/components/executer/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXCREATE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exdebug.c b/sys/contrib/dev/acpica/components/executer/exdebug.c index ec8b5a00f5e6..5e98fd5598af 100644 --- a/sys/contrib/dev/acpica/components/executer/exdebug.c +++ b/sys/contrib/dev/acpica/components/executer/exdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXDEBUG_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exdump.c b/sys/contrib/dev/acpica/components/executer/exdump.c index 153b2c12fbed..998602251e71 100644 --- a/sys/contrib/dev/acpica/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/components/executer/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXDUMP_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exfield.c b/sys/contrib/dev/acpica/components/executer/exfield.c index 2b61790c0a9a..836a378c7bdd 100644 --- a/sys/contrib/dev/acpica/components/executer/exfield.c +++ b/sys/contrib/dev/acpica/components/executer/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXFIELD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exfldio.c b/sys/contrib/dev/acpica/components/executer/exfldio.c index 5586cad20080..c4d4019ce369 100644 --- a/sys/contrib/dev/acpica/components/executer/exfldio.c +++ b/sys/contrib/dev/acpica/components/executer/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXFLDIO_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exmisc.c b/sys/contrib/dev/acpica/components/executer/exmisc.c index b9b331d10d72..d4e1a3b74e56 100644 --- a/sys/contrib/dev/acpica/components/executer/exmisc.c +++ b/sys/contrib/dev/acpica/components/executer/exmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXMISC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exmutex.c b/sys/contrib/dev/acpica/components/executer/exmutex.c index c14d3c049798..cf82b04752d2 100644 --- a/sys/contrib/dev/acpica/components/executer/exmutex.c +++ b/sys/contrib/dev/acpica/components/executer/exmutex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXMUTEX_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exnames.c b/sys/contrib/dev/acpica/components/executer/exnames.c index af5aa7ec0d74..b2131650891d 100644 --- a/sys/contrib/dev/acpica/components/executer/exnames.c +++ b/sys/contrib/dev/acpica/components/executer/exnames.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXNAMES_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exoparg1.c b/sys/contrib/dev/acpica/components/executer/exoparg1.c index 849c442ed15f..dc35c1711a9e 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg1.c +++ b/sys/contrib/dev/acpica/components/executer/exoparg1.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXOPARG1_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exoparg2.c b/sys/contrib/dev/acpica/components/executer/exoparg2.c index b11035596bc0..da1eb6c63700 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg2.c +++ b/sys/contrib/dev/acpica/components/executer/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXOPARG2_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exoparg3.c b/sys/contrib/dev/acpica/components/executer/exoparg3.c index 79deb8757923..6d0fdd1eb048 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg3.c +++ b/sys/contrib/dev/acpica/components/executer/exoparg3.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXOPARG3_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exoparg6.c b/sys/contrib/dev/acpica/components/executer/exoparg6.c index 3191f66da912..4ff355c90044 100644 --- a/sys/contrib/dev/acpica/components/executer/exoparg6.c +++ b/sys/contrib/dev/acpica/components/executer/exoparg6.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXOPARG6_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exprep.c b/sys/contrib/dev/acpica/components/executer/exprep.c index bc270b8b6bc1..c949d8a95e79 100644 --- a/sys/contrib/dev/acpica/components/executer/exprep.c +++ b/sys/contrib/dev/acpica/components/executer/exprep.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXPREP_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exregion.c b/sys/contrib/dev/acpica/components/executer/exregion.c index 0b5c6fc56121..9deef50c6806 100644 --- a/sys/contrib/dev/acpica/components/executer/exregion.c +++ b/sys/contrib/dev/acpica/components/executer/exregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXREGION_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exresnte.c b/sys/contrib/dev/acpica/components/executer/exresnte.c index 2aeac6cfcf6f..99b64c2e79ba 100644 --- a/sys/contrib/dev/acpica/components/executer/exresnte.c +++ b/sys/contrib/dev/acpica/components/executer/exresnte.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXRESNTE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exresolv.c b/sys/contrib/dev/acpica/components/executer/exresolv.c index b2aa570b2869..32862a92d1bb 100644 --- a/sys/contrib/dev/acpica/components/executer/exresolv.c +++ b/sys/contrib/dev/acpica/components/executer/exresolv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXRESOLV_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exresop.c b/sys/contrib/dev/acpica/components/executer/exresop.c index e861c26f5060..5171f562012e 100644 --- a/sys/contrib/dev/acpica/components/executer/exresop.c +++ b/sys/contrib/dev/acpica/components/executer/exresop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXRESOP_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exstore.c b/sys/contrib/dev/acpica/components/executer/exstore.c index fe0cde83a907..e14ab9474e51 100644 --- a/sys/contrib/dev/acpica/components/executer/exstore.c +++ b/sys/contrib/dev/acpica/components/executer/exstore.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXSTORE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exstoren.c b/sys/contrib/dev/acpica/components/executer/exstoren.c index 803b2b68853b..cc56fbd4317e 100644 --- a/sys/contrib/dev/acpica/components/executer/exstoren.c +++ b/sys/contrib/dev/acpica/components/executer/exstoren.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXSTOREN_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exstorob.c b/sys/contrib/dev/acpica/components/executer/exstorob.c index 560a634869a9..c23831041f92 100644 --- a/sys/contrib/dev/acpica/components/executer/exstorob.c +++ b/sys/contrib/dev/acpica/components/executer/exstorob.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXSTOROB_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exsystem.c b/sys/contrib/dev/acpica/components/executer/exsystem.c index 790813c842af..aa661e747dc0 100644 --- a/sys/contrib/dev/acpica/components/executer/exsystem.c +++ b/sys/contrib/dev/acpica/components/executer/exsystem.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXSYSTEM_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/executer/exutils.c b/sys/contrib/dev/acpica/components/executer/exutils.c index 1958c19f53ef..a55b171e5fe1 100644 --- a/sys/contrib/dev/acpica/components/executer/exutils.c +++ b/sys/contrib/dev/acpica/components/executer/exutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __EXUTILS_C__ - /* * DEFINE_AML_GLOBALS is tested in amlcode.h * to determine whether certain global names should be "defined" or only diff --git a/sys/contrib/dev/acpica/components/hardware/hwacpi.c b/sys/contrib/dev/acpica/components/hardware/hwacpi.c index 947679589636..a91b66fa944e 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwacpi.c +++ b/sys/contrib/dev/acpica/components/hardware/hwacpi.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __HWACPI_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/hardware/hwesleep.c b/sys/contrib/dev/acpica/components/hardware/hwesleep.c index d125bccb372c..460b6ffaab00 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwesleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwesleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/hardware/hwgpe.c b/sys/contrib/dev/acpica/components/hardware/hwgpe.c index e00aeb24d761..9cc511eea031 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/components/hardware/hwgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,6 +58,11 @@ AcpiHwEnableWakeupGpeBlock ( ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context); +static ACPI_STATUS +AcpiHwGpeEnableWrite ( + UINT8 EnableMask, + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo); + /****************************************************************************** * @@ -128,13 +133,13 @@ AcpiHwLowSetGpe ( /* Set or clear just the bit that corresponds to this GPE */ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); - switch (Action) + switch (Action & ~ACPI_GPE_SAVE_MASK) { case ACPI_GPE_CONDITIONAL_ENABLE: - /* Only enable if the EnableForRun bit is set */ + /* Only enable if the corresponding EnableMask bit is set */ - if (!(RegisterBit & GpeRegisterInfo->EnableForRun)) + if (!(RegisterBit & GpeRegisterInfo->EnableMask)) { return (AE_BAD_PARAMETER); } @@ -160,6 +165,10 @@ AcpiHwLowSetGpe ( /* Write the updated enable mask */ Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + if (ACPI_SUCCESS (Status) && (Action & ACPI_GPE_SAVE_MASK)) + { + GpeRegisterInfo->EnableMask = (UINT8) EnableMask; + } return (Status); } @@ -243,7 +252,7 @@ AcpiHwGetGpeStatus ( /* GPE currently handled? */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER; @@ -291,6 +300,37 @@ AcpiHwGetGpeStatus ( } +/****************************************************************************** + * + * FUNCTION: AcpiHwGpeEnableWrite + * + * PARAMETERS: EnableMask - Bit mask to write to the GPE register + * GpeRegisterInfo - Gpe Register info + * + * RETURN: Status + * + * DESCRIPTION: Write the enable mask byte to the given GPE register. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwGpeEnableWrite ( + UINT8 EnableMask, + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo) +{ + ACPI_STATUS Status; + + + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + if (ACPI_SUCCESS (Status)) + { + GpeRegisterInfo->EnableMask = EnableMask; + } + + return (Status); +} + + /****************************************************************************** * * FUNCTION: AcpiHwDisableGpeBlock @@ -320,7 +360,7 @@ AcpiHwDisableGpeBlock ( { /* Disable all GPEs in this register */ - Status = AcpiHwWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); + Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]); if (ACPI_FAILURE (Status)) { return (Status); @@ -393,6 +433,7 @@ AcpiHwEnableRuntimeGpeBlock ( { UINT32 i; ACPI_STATUS Status; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; /* NOTE: assumes that all GPEs are currently disabled */ @@ -401,15 +442,16 @@ AcpiHwEnableRuntimeGpeBlock ( for (i = 0; i < GpeBlock->RegisterCount; i++) { - if (!GpeBlock->RegisterInfo[i].EnableForRun) + GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; + if (!GpeRegisterInfo->EnableForRun) { continue; } /* Enable all "runtime" GPEs in this register */ - Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForRun, - &GpeBlock->RegisterInfo[i].EnableAddress); + Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun, + GpeRegisterInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -442,21 +484,21 @@ AcpiHwEnableWakeupGpeBlock ( { UINT32 i; ACPI_STATUS Status; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; /* Examine each GPE Register within the block */ for (i = 0; i < GpeBlock->RegisterCount; i++) { - if (!GpeBlock->RegisterInfo[i].EnableForWake) - { - continue; - } + GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; - /* Enable all "wake" GPEs in this register */ - - Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForWake, - &GpeBlock->RegisterInfo[i].EnableAddress); + /* + * Enable all "wake" GPEs in this register and disable the + * remaining ones. + */ + Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake, + GpeRegisterInfo); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/sys/contrib/dev/acpica/components/hardware/hwpci.c b/sys/contrib/dev/acpica/components/hardware/hwpci.c index d14bf755987b..165d26c2ace4 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwpci.c +++ b/sys/contrib/dev/acpica/components/hardware/hwpci.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __HWPCI_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/hardware/hwregs.c b/sys/contrib/dev/acpica/components/hardware/hwregs.c index 155cb4936352..9d601c53af7e 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwregs.c +++ b/sys/contrib/dev/acpica/components/hardware/hwregs.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __HWREGS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/hardware/hwsleep.c b/sys/contrib/dev/acpica/components/hardware/hwsleep.c index d4b346b06a83..2bc434eda7f6 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwsleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/hardware/hwtimer.c b/sys/contrib/dev/acpica/components/hardware/hwtimer.c index 643cc6771b1a..39c9e5718732 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwtimer.c +++ b/sys/contrib/dev/acpica/components/hardware/hwtimer.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/hardware/hwvalid.c b/sys/contrib/dev/acpica/components/hardware/hwvalid.c index c8046cd0c2ac..ade53ad8fda0 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/components/hardware/hwvalid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __HWVALID_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/hardware/hwxface.c b/sys/contrib/dev/acpica/components/hardware/hwxface.c index 0ec2f5c96eef..fcd5c9e85269 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwxface.c +++ b/sys/contrib/dev/acpica/components/hardware/hwxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c b/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c index dfc712b34871..8d5ba97126c6 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/namespace/nsaccess.c b/sys/contrib/dev/acpica/components/namespace/nsaccess.c index d6f1800fe3ef..667b5afab8d2 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsaccess.c +++ b/sys/contrib/dev/acpica/components/namespace/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSACCESS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsalloc.c b/sys/contrib/dev/acpica/components/namespace/nsalloc.c index a107f7796ba0..2a1e09e20c28 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsalloc.c +++ b/sys/contrib/dev/acpica/components/namespace/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSALLOC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsarguments.c b/sys/contrib/dev/acpica/components/namespace/nsarguments.c index 98e831d7bf08..5d41bb012d1e 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsarguments.c +++ b/sys/contrib/dev/acpica/components/namespace/nsarguments.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/namespace/nsconvert.c b/sys/contrib/dev/acpica/components/namespace/nsconvert.c index 2b39776d650e..091c5ccde03b 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsconvert.c +++ b/sys/contrib/dev/acpica/components/namespace/nsconvert.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSCONVERT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsdump.c b/sys/contrib/dev/acpica/components/namespace/nsdump.c index ff1f10f94ebc..6140397bbe09 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/components/namespace/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSDUMP_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c b/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c index a130a03f75eb..05daaab1384f 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c +++ b/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSDUMPDV_C__ - #include diff --git a/sys/contrib/dev/acpica/components/namespace/nseval.c b/sys/contrib/dev/acpica/components/namespace/nseval.c index fa4465ba6941..ac1d9a93f8cd 100644 --- a/sys/contrib/dev/acpica/components/namespace/nseval.c +++ b/sys/contrib/dev/acpica/components/namespace/nseval.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSEVAL_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsinit.c b/sys/contrib/dev/acpica/components/namespace/nsinit.c index f40ff58341d8..847bf728dd90 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsinit.c +++ b/sys/contrib/dev/acpica/components/namespace/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSXFINIT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsload.c b/sys/contrib/dev/acpica/components/namespace/nsload.c index 71c3cfc66a70..c9b1174240bf 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsload.c +++ b/sys/contrib/dev/acpica/components/namespace/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSLOAD_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsnames.c b/sys/contrib/dev/acpica/components/namespace/nsnames.c index 2b1057ddf54d..edd651745a53 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsnames.c +++ b/sys/contrib/dev/acpica/components/namespace/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSNAMES_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsobject.c b/sys/contrib/dev/acpica/components/namespace/nsobject.c index 24d546727f90..8327b7602c4a 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsobject.c +++ b/sys/contrib/dev/acpica/components/namespace/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSOBJECT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsparse.c b/sys/contrib/dev/acpica/components/namespace/nsparse.c index 8e6bd0abb031..0f87fa197de0 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsparse.c +++ b/sys/contrib/dev/acpica/components/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSPARSE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nspredef.c b/sys/contrib/dev/acpica/components/namespace/nspredef.c index 66708709bfd0..d885e5ae4e12 100644 --- a/sys/contrib/dev/acpica/components/namespace/nspredef.c +++ b/sys/contrib/dev/acpica/components/namespace/nspredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/namespace/nsprepkg.c b/sys/contrib/dev/acpica/components/namespace/nsprepkg.c index 62c3847be88e..5940a9645813 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsprepkg.c +++ b/sys/contrib/dev/acpica/components/namespace/nsprepkg.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/namespace/nsrepair.c b/sys/contrib/dev/acpica/components/namespace/nsrepair.c index f26497cbc1e0..a1ffe25f5c0b 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsrepair.c +++ b/sys/contrib/dev/acpica/components/namespace/nsrepair.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSREPAIR_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsrepair2.c b/sys/contrib/dev/acpica/components/namespace/nsrepair2.c index 664e2810d4d2..410b009b589c 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsrepair2.c +++ b/sys/contrib/dev/acpica/components/namespace/nsrepair2.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSREPAIR2_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nssearch.c b/sys/contrib/dev/acpica/components/namespace/nssearch.c index e46403c54385..9f24f1cb6fab 100644 --- a/sys/contrib/dev/acpica/components/namespace/nssearch.c +++ b/sys/contrib/dev/acpica/components/namespace/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSSEARCH_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsutils.c b/sys/contrib/dev/acpica/components/namespace/nsutils.c index 7cb91b84ba87..d7320a625172 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/components/namespace/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSUTILS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nswalk.c b/sys/contrib/dev/acpica/components/namespace/nswalk.c index ce5ac9eddc5c..167499825025 100644 --- a/sys/contrib/dev/acpica/components/namespace/nswalk.c +++ b/sys/contrib/dev/acpica/components/namespace/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSWALK_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index 85749d66d32d..93226ef4ee42 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSXFEVAL_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfname.c b/sys/contrib/dev/acpica/components/namespace/nsxfname.c index d9595f1f7018..804ea9479dc6 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfname.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSXFNAME_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfobj.c b/sys/contrib/dev/acpica/components/namespace/nsxfobj.c index 545ee17b74bc..2481e7af430c 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfobj.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __NSXFOBJ_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/parser/psargs.c b/sys/contrib/dev/acpica/components/parser/psargs.c index 8f1089fb8f24..b2a86fe2b997 100644 --- a/sys/contrib/dev/acpica/components/parser/psargs.c +++ b/sys/contrib/dev/acpica/components/parser/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __PSARGS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/parser/psloop.c b/sys/contrib/dev/acpica/components/parser/psloop.c index 4a3ab9077be6..63b64abe66f1 100644 --- a/sys/contrib/dev/acpica/components/parser/psloop.c +++ b/sys/contrib/dev/acpica/components/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psobject.c b/sys/contrib/dev/acpica/components/parser/psobject.c index 11cf35a515e5..0ad37b97fd97 100644 --- a/sys/contrib/dev/acpica/components/parser/psobject.c +++ b/sys/contrib/dev/acpica/components/parser/psobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psopcode.c b/sys/contrib/dev/acpica/components/parser/psopcode.c index 85cb31d36f69..c2197780a850 100644 --- a/sys/contrib/dev/acpica/components/parser/psopcode.c +++ b/sys/contrib/dev/acpica/components/parser/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psopinfo.c b/sys/contrib/dev/acpica/components/parser/psopinfo.c index 6dbdfb619c23..e44bf7baf0cd 100644 --- a/sys/contrib/dev/acpica/components/parser/psopinfo.c +++ b/sys/contrib/dev/acpica/components/parser/psopinfo.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psparse.c b/sys/contrib/dev/acpica/components/parser/psparse.c index 52ccdec35f2a..aa978cc57cd4 100644 --- a/sys/contrib/dev/acpica/components/parser/psparse.c +++ b/sys/contrib/dev/acpica/components/parser/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psscope.c b/sys/contrib/dev/acpica/components/parser/psscope.c index c396422a6738..87e897e47abc 100644 --- a/sys/contrib/dev/acpica/components/parser/psscope.c +++ b/sys/contrib/dev/acpica/components/parser/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/pstree.c b/sys/contrib/dev/acpica/components/parser/pstree.c index 4dd99794fa7a..daec8f30a05d 100644 --- a/sys/contrib/dev/acpica/components/parser/pstree.c +++ b/sys/contrib/dev/acpica/components/parser/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __PSTREE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/parser/psutils.c b/sys/contrib/dev/acpica/components/parser/psutils.c index 1ef18bc6eab1..1a269a630dc3 100644 --- a/sys/contrib/dev/acpica/components/parser/psutils.c +++ b/sys/contrib/dev/acpica/components/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/pswalk.c b/sys/contrib/dev/acpica/components/parser/pswalk.c index 20f32d6ed6a5..044b0683af6c 100644 --- a/sys/contrib/dev/acpica/components/parser/pswalk.c +++ b/sys/contrib/dev/acpica/components/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/parser/psxface.c b/sys/contrib/dev/acpica/components/parser/psxface.c index d0922eee7d20..2927f4c677f6 100644 --- a/sys/contrib/dev/acpica/components/parser/psxface.c +++ b/sys/contrib/dev/acpica/components/parser/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __PSXFACE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsaddr.c b/sys/contrib/dev/acpica/components/resources/rsaddr.c index bcf76f54afed..f05c4fc383c5 100644 --- a/sys/contrib/dev/acpica/components/resources/rsaddr.c +++ b/sys/contrib/dev/acpica/components/resources/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSADDR_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rscalc.c b/sys/contrib/dev/acpica/components/resources/rscalc.c index dfeff39e87d8..38db8c1ed895 100644 --- a/sys/contrib/dev/acpica/components/resources/rscalc.c +++ b/sys/contrib/dev/acpica/components/resources/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSCALC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rscreate.c b/sys/contrib/dev/acpica/components/resources/rscreate.c index 38472725f617..c6461290f01d 100644 --- a/sys/contrib/dev/acpica/components/resources/rscreate.c +++ b/sys/contrib/dev/acpica/components/resources/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSCREATE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsdump.c b/sys/contrib/dev/acpica/components/resources/rsdump.c index 253347b85cde..ddae6e076346 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/components/resources/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSDUMP_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c b/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c index 6fa5cef3f50a..aab597aaf960 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c +++ b/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSDUMPINFO_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsinfo.c b/sys/contrib/dev/acpica/components/resources/rsinfo.c index fb60bfdc8a8e..f34b905aa0ef 100644 --- a/sys/contrib/dev/acpica/components/resources/rsinfo.c +++ b/sys/contrib/dev/acpica/components/resources/rsinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSINFO_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsio.c b/sys/contrib/dev/acpica/components/resources/rsio.c index 008f50423712..473fe36e03a0 100644 --- a/sys/contrib/dev/acpica/components/resources/rsio.c +++ b/sys/contrib/dev/acpica/components/resources/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSIO_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsirq.c b/sys/contrib/dev/acpica/components/resources/rsirq.c index 8a2223ff1dbd..cf91f3d144ba 100644 --- a/sys/contrib/dev/acpica/components/resources/rsirq.c +++ b/sys/contrib/dev/acpica/components/resources/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSIRQ_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rslist.c b/sys/contrib/dev/acpica/components/resources/rslist.c index 6934ad1e0114..82610585deb3 100644 --- a/sys/contrib/dev/acpica/components/resources/rslist.c +++ b/sys/contrib/dev/acpica/components/resources/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSLIST_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsmemory.c b/sys/contrib/dev/acpica/components/resources/rsmemory.c index 01089eea42b4..761a000c33d8 100644 --- a/sys/contrib/dev/acpica/components/resources/rsmemory.c +++ b/sys/contrib/dev/acpica/components/resources/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSMEMORY_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsmisc.c b/sys/contrib/dev/acpica/components/resources/rsmisc.c index 8194faf8e5bc..bc5b8037cf6d 100644 --- a/sys/contrib/dev/acpica/components/resources/rsmisc.c +++ b/sys/contrib/dev/acpica/components/resources/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSMISC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsserial.c b/sys/contrib/dev/acpica/components/resources/rsserial.c index dc3ffc251d79..00e18871c73c 100644 --- a/sys/contrib/dev/acpica/components/resources/rsserial.c +++ b/sys/contrib/dev/acpica/components/resources/rsserial.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSIRQ_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsutils.c b/sys/contrib/dev/acpica/components/resources/rsutils.c index c53a9643b072..c0e7b78955d1 100644 --- a/sys/contrib/dev/acpica/components/resources/rsutils.c +++ b/sys/contrib/dev/acpica/components/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSUTILS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/resources/rsxface.c b/sys/contrib/dev/acpica/components/resources/rsxface.c index d2138927a9d3..2fe3e6f175d6 100644 --- a/sys/contrib/dev/acpica/components/resources/rsxface.c +++ b/sys/contrib/dev/acpica/components/resources/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __RSXFACE_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/tables/tbdata.c b/sys/contrib/dev/acpica/components/tables/tbdata.c index 19991ce196cb..4ff62ddaedb3 100644 --- a/sys/contrib/dev/acpica/components/tables/tbdata.c +++ b/sys/contrib/dev/acpica/components/tables/tbdata.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBDATA_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbfadt.c b/sys/contrib/dev/acpica/components/tables/tbfadt.c index 56a3fbae325d..f35e217a2820 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/components/tables/tbfadt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBFADT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbfind.c b/sys/contrib/dev/acpica/components/tables/tbfind.c index b59a6c2ecd0c..30a5750d7919 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfind.c +++ b/sys/contrib/dev/acpica/components/tables/tbfind.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBFIND_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index b62e0e0531cd..2fe219d56a8e 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/components/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBINSTAL_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbprint.c b/sys/contrib/dev/acpica/components/tables/tbprint.c index 00b6f1aee1ac..8be1a9f83115 100644 --- a/sys/contrib/dev/acpica/components/tables/tbprint.c +++ b/sys/contrib/dev/acpica/components/tables/tbprint.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBPRINT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbutils.c b/sys/contrib/dev/acpica/components/tables/tbutils.c index e86e1d1f3cf3..8b8002540e71 100644 --- a/sys/contrib/dev/acpica/components/tables/tbutils.c +++ b/sys/contrib/dev/acpica/components/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBUTILS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/tables/tbxface.c b/sys/contrib/dev/acpica/components/tables/tbxface.c index 126d9ca3c2aa..7336b18903ba 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxface.c +++ b/sys/contrib/dev/acpica/components/tables/tbxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBXFACE_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/tables/tbxfload.c b/sys/contrib/dev/acpica/components/tables/tbxfload.c index da34e3d55a20..805bbaddd503 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfload.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBXFLOAD_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/tables/tbxfroot.c b/sys/contrib/dev/acpica/components/tables/tbxfroot.c index 885350ea2ef5..26babdbe4abf 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __TBXFROOT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utaddress.c b/sys/contrib/dev/acpica/components/utilities/utaddress.c index 77d3ecea5291..02d6110b7635 100644 --- a/sys/contrib/dev/acpica/components/utilities/utaddress.c +++ b/sys/contrib/dev/acpica/components/utilities/utaddress.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTADDRESS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utalloc.c b/sys/contrib/dev/acpica/components/utilities/utalloc.c index 70a813117851..99fb15a1623f 100644 --- a/sys/contrib/dev/acpica/components/utilities/utalloc.c +++ b/sys/contrib/dev/acpica/components/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTALLOC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utbuffer.c b/sys/contrib/dev/acpica/components/utilities/utbuffer.c index ee7f9e5a8315..862ac6ba2198 100644 --- a/sys/contrib/dev/acpica/components/utilities/utbuffer.c +++ b/sys/contrib/dev/acpica/components/utilities/utbuffer.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTBUFFER_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utcache.c b/sys/contrib/dev/acpica/components/utilities/utcache.c index f6c2d02a24ba..aa0161cf767b 100644 --- a/sys/contrib/dev/acpica/components/utilities/utcache.c +++ b/sys/contrib/dev/acpica/components/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTCACHE_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utcopy.c b/sys/contrib/dev/acpica/components/utilities/utcopy.c index 68e58ddc04fb..8a94ea61389d 100644 --- a/sys/contrib/dev/acpica/components/utilities/utcopy.c +++ b/sys/contrib/dev/acpica/components/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTCOPY_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utdebug.c b/sys/contrib/dev/acpica/components/utilities/utdebug.c index 33350ca92382..544450d37f52 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTDEBUG_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/utilities/utdecode.c b/sys/contrib/dev/acpica/components/utilities/utdecode.c index 9fd52077cd61..c1887ee2269e 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdecode.c +++ b/sys/contrib/dev/acpica/components/utilities/utdecode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTDECODE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utdelete.c b/sys/contrib/dev/acpica/components/utilities/utdelete.c index 60b456fa3bec..bc9ab70c7d98 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/components/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTDELETE_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/uterror.c b/sys/contrib/dev/acpica/components/utilities/uterror.c index 3c62b6201c91..35e9ce67dbb3 100644 --- a/sys/contrib/dev/acpica/components/utilities/uterror.c +++ b/sys/contrib/dev/acpica/components/utilities/uterror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTERROR_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/uteval.c b/sys/contrib/dev/acpica/components/utilities/uteval.c index a693c84f4a1f..b9d63b4552e4 100644 --- a/sys/contrib/dev/acpica/components/utilities/uteval.c +++ b/sys/contrib/dev/acpica/components/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTEVAL_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utexcep.c b/sys/contrib/dev/acpica/components/utilities/utexcep.c index c7f7b9c21521..2a38cfff27aa 100644 --- a/sys/contrib/dev/acpica/components/utilities/utexcep.c +++ b/sys/contrib/dev/acpica/components/utilities/utexcep.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTEXCEP_C__ #define EXPORT_ACPI_INTERFACES #define ACPI_DEFINE_EXCEPTION_TABLE diff --git a/sys/contrib/dev/acpica/components/utilities/utfileio.c b/sys/contrib/dev/acpica/components/utilities/utfileio.c index 936fa6fd01b9..bef66f6f1603 100644 --- a/sys/contrib/dev/acpica/components/utilities/utfileio.c +++ b/sys/contrib/dev/acpica/components/utilities/utfileio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/utilities/utglobal.c b/sys/contrib/dev/acpica/components/utilities/utglobal.c index 00aa77786310..1dfd3e1c606a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/components/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTGLOBAL_C__ #define EXPORT_ACPI_INTERFACES #define DEFINE_ACPI_GLOBALS diff --git a/sys/contrib/dev/acpica/components/utilities/uthex.c b/sys/contrib/dev/acpica/components/utilities/uthex.c index 80032317f28f..3486008a66c5 100644 --- a/sys/contrib/dev/acpica/components/utilities/uthex.c +++ b/sys/contrib/dev/acpica/components/utilities/uthex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTHEX_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utids.c b/sys/contrib/dev/acpica/components/utilities/utids.c index ca2a372b8510..7d314294aa0d 100644 --- a/sys/contrib/dev/acpica/components/utilities/utids.c +++ b/sys/contrib/dev/acpica/components/utilities/utids.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTIDS_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c index 6a07ef6ae895..fd7fba291201 100644 --- a/sys/contrib/dev/acpica/components/utilities/utinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTINIT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utlock.c b/sys/contrib/dev/acpica/components/utilities/utlock.c index 626a46f50d96..3903e99e87ef 100644 --- a/sys/contrib/dev/acpica/components/utilities/utlock.c +++ b/sys/contrib/dev/acpica/components/utilities/utlock.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTLOCK_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utmath.c b/sys/contrib/dev/acpica/components/utilities/utmath.c index c65317937f62..ce11f39fb89f 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmath.c +++ b/sys/contrib/dev/acpica/components/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTMATH_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c index 356b0ce877bb..d5d81ca11856 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/components/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTMISC_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utmutex.c b/sys/contrib/dev/acpica/components/utilities/utmutex.c index 546adab4bec8..c7b162be89bd 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/components/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTMUTEX_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utobject.c b/sys/contrib/dev/acpica/components/utilities/utobject.c index 398fae52e9fb..4c80c40a68eb 100644 --- a/sys/contrib/dev/acpica/components/utilities/utobject.c +++ b/sys/contrib/dev/acpica/components/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTOBJECT_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c index 6b618713da8e..6b225caa551e 100644 --- a/sys/contrib/dev/acpica/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/components/utilities/utosi.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTOSI_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utownerid.c b/sys/contrib/dev/acpica/components/utilities/utownerid.c index 70919fb61668..34c0024736c4 100644 --- a/sys/contrib/dev/acpica/components/utilities/utownerid.c +++ b/sys/contrib/dev/acpica/components/utilities/utownerid.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTOWNERID_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utpredef.c b/sys/contrib/dev/acpica/components/utilities/utpredef.c index 9dcbd546b294..a445f85ed9d1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utpredef.c +++ b/sys/contrib/dev/acpica/components/utilities/utpredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTPREDEF_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utprint.c b/sys/contrib/dev/acpica/components/utilities/utprint.c index 0c99079fc0dd..d870ad4f68ab 100644 --- a/sys/contrib/dev/acpica/components/utilities/utprint.c +++ b/sys/contrib/dev/acpica/components/utilities/utprint.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c index 3b549fea8438..65b23f198a0d 100644 --- a/sys/contrib/dev/acpica/components/utilities/utresrc.c +++ b/sys/contrib/dev/acpica/components/utilities/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTRESRC_C__ - #include #include #include @@ -300,7 +298,7 @@ const char *AcpiGbl_BpbDecode[] = const char *AcpiGbl_SbDecode[] = { - "StopBitsNone", + "StopBitsZero", "StopBitsOne", "StopBitsOnePlusHalf", "StopBitsTwo" diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c index 2fa8fd663129..d90d694d0c18 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstate.c +++ b/sys/contrib/dev/acpica/components/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTSTATE_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utstring.c b/sys/contrib/dev/acpica/components/utilities/utstring.c index 2e3ea03efd61..4cbf435059ec 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstring.c +++ b/sys/contrib/dev/acpica/components/utilities/utstring.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTSTRING_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c index 1447bc3c9770..5f208b5b5755 100644 --- a/sys/contrib/dev/acpica/components/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,8 +52,6 @@ * occurs in the body of AcpiUtFree. */ -#define __UTTRACK_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utuuid.c b/sys/contrib/dev/acpica/components/utilities/utuuid.c index b9c6a0947f58..8b3cb9920e4a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utuuid.c +++ b/sys/contrib/dev/acpica/components/utilities/utuuid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTUUID_C__ - #include #include diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c index 7ce79c080d92..aab747320c7a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxface.c +++ b/sys/contrib/dev/acpica/components/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTXFACE_C__ #define EXPORT_ACPI_INTERFACES #include @@ -621,7 +620,9 @@ AcpiDecodePldBuffer ( ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); - PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword); + PldInfo->Red = ACPI_PLD_GET_RED (&Dword); + PldInfo->Green = ACPI_PLD_GET_GREEN (&Dword); + PldInfo->Blue = ACPI_PLD_GET_BLUE (&Dword); /* Second 32-bit DWord */ diff --git a/sys/contrib/dev/acpica/components/utilities/utxferror.c b/sys/contrib/dev/acpica/components/utilities/utxferror.c index e5d308300ad0..89fc5164a05f 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxferror.c +++ b/sys/contrib/dev/acpica/components/utilities/utxferror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTXFERROR_C__ #define EXPORT_ACPI_INTERFACES #include diff --git a/sys/contrib/dev/acpica/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/components/utilities/utxfinit.c index 061ca19c0abe..36107cab18c2 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTXFINIT_C__ #define EXPORT_ACPI_INTERFACES #include @@ -54,6 +53,11 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxfinit") +/* For AcpiExec only */ +void +AeDoObjectOverrides ( + void); + /******************************************************************************* * @@ -309,6 +313,14 @@ AcpiInitializeObjects ( } } +#ifdef ACPI_EXEC_APP + /* + * This call implements the "initialization file" option for AcpiExec. + * This is the precise point that we want to perform the overrides. + */ + AeDoObjectOverrides (); +#endif + /* * Execute any module-level code that was detected during the table load * phase. Although illegal since ACPI 2.0, there are many machines that diff --git a/sys/contrib/dev/acpica/components/utilities/utxfmutex.c b/sys/contrib/dev/acpica/components/utilities/utxfmutex.c index dfa5225213de..559f4b45efbc 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfmutex.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define __UTXFMUTEX_C__ - #include #include #include diff --git a/sys/contrib/dev/acpica/include/acapps.h b/sys/contrib/dev/acpica/include/acapps.h index 5d46ff479e9d..7c4880a12d22 100644 --- a/sys/contrib/dev/acpica/include/acapps.h +++ b/sys/contrib/dev/acpica/include/acapps.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,7 +52,7 @@ /* Common info for tool signons */ #define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2014 Intel Corporation" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2015 Intel Corporation" #if ACPI_MACHINE_WIDTH == 64 #define ACPI_WIDTH "-64" diff --git a/sys/contrib/dev/acpica/include/acbuffer.h b/sys/contrib/dev/acpica/include/acbuffer.h index a36a980aa954..37f4170884d8 100644 --- a/sys/contrib/dev/acpica/include/acbuffer.h +++ b/sys/contrib/dev/acpica/include/acbuffer.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,7 +119,9 @@ typedef struct acpi_pld_info { UINT8 Revision; UINT8 IgnoreColor; - UINT32 Color; + UINT8 Red; + UINT8 Green; + UINT8 Blue; UINT16 Width; UINT16 Height; UINT8 UserVisible; @@ -165,8 +167,14 @@ typedef struct acpi_pld_info #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ -#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) -#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ +#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ + +#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ + +#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ /* Second 32-bit dword, bits 33:63 */ diff --git a/sys/contrib/dev/acpica/include/accommon.h b/sys/contrib/dev/acpica/include/accommon.h index dc6a9b41c1ae..e63943beaa10 100644 --- a/sys/contrib/dev/acpica/include/accommon.h +++ b/sys/contrib/dev/acpica/include/accommon.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index 69242ee61c12..46dbc31109cb 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index a85625731b08..f6305759a1d7 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 687991ed419a..34cf1f7a1f93 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -978,6 +978,19 @@ AcpiDmCheckResourceReference ( ACPI_WALK_STATE *WalkState); +/* + * dmcstyle + */ +BOOLEAN +AcpiDmCheckForSymbolicOpcode ( + ACPI_PARSE_OBJECT *Op, + ACPI_OP_WALK_INFO *Info); + +void +AcpiDmCloseOperator ( + ACPI_PARSE_OBJECT *Op); + + /* * acdisasm */ @@ -985,5 +998,4 @@ void AdDisassemblerHeader ( char *Filename); - #endif /* __ACDISASM_H__ */ diff --git a/sys/contrib/dev/acpica/include/acdispat.h b/sys/contrib/dev/acpica/include/acdispat.h index c4abebb55e8c..9364fe398444 100644 --- a/sys/contrib/dev/acpica/include/acdispat.h +++ b/sys/contrib/dev/acpica/include/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index 43c1d7cc5fd6..2ae0aca81a55 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,10 +197,6 @@ AcpiEvWalkGpeList ( ACPI_GPE_CALLBACK GpeWalkCallback, void *Context); -BOOLEAN -AcpiEvValidGpeEvent ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - ACPI_STATUS AcpiEvGetGpeDevice ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index aab6941a3c7e..7a3fdcb8eaff 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index a83f8c34b0eb..9b6e936ca6ac 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -309,6 +309,7 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_O ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_verbose); diff --git a/sys/contrib/dev/acpica/include/achware.h b/sys/contrib/dev/acpica/include/achware.h index 1b1331879983..6ab28b689fc6 100644 --- a/sys/contrib/dev/acpica/include/achware.h +++ b/sys/contrib/dev/acpica/include/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acinterp.h b/sys/contrib/dev/acpica/include/acinterp.h index b77864034b72..66463d6db8f7 100644 --- a/sys/contrib/dev/acpica/include/acinterp.h +++ b/sys/contrib/dev/acpica/include/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index d911985ed160..5f9b0f3076fd 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -520,6 +520,7 @@ typedef struct acpi_gpe_register_info UINT16 BaseGpeNumber; /* Base GPE number for this register */ UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ UINT8 EnableForRun; /* GPEs to keep enabled when running */ + UINT8 EnableMask; /* Current mask of enabled GPEs */ } ACPI_GPE_REGISTER_INFO; @@ -869,6 +870,7 @@ typedef union acpi_parse_value ACPI_DISASM_ONLY_MEMBERS (\ UINT8 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ + char *OperatorSymbol;/* Used for C-style operator name strings */\ char AmlOpName[16]) /* Op name (debug only) */ @@ -991,6 +993,8 @@ typedef struct acpi_parse_state #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 #define ACPI_PARSEOP_SPECIAL 0x10 +#define ACPI_PARSEOP_COMPOUND 0x20 +#define ACPI_PARSEOP_ASSIGNMENT 0x40 /***************************************************************************** diff --git a/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index 19a3e8e23542..b23d175221d0 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acnames.h b/sys/contrib/dev/acpica/include/acnames.h index 3297a732f200..6bb6bbf9df6a 100644 --- a/sys/contrib/dev/acpica/include/acnames.h +++ b/sys/contrib/dev/acpica/include/acnames.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 9fd3841c6c72..07e76b596649 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/include/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acobject.h b/sys/contrib/dev/acpica/include/acobject.h index c08c8272b0b8..b7b624b70302 100644 --- a/sys/contrib/dev/acpica/include/acobject.h +++ b/sys/contrib/dev/acpica/include/acobject.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acopcode.h b/sys/contrib/dev/acpica/include/acopcode.h index b968fc62a772..f4ba55d3cc21 100644 --- a/sys/contrib/dev/acpica/include/acopcode.h +++ b/sys/contrib/dev/acpica/include/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acoutput.h b/sys/contrib/dev/acpica/include/acoutput.h index 8f054ae11929..ab078091839f 100644 --- a/sys/contrib/dev/acpica/include/acoutput.h +++ b/sys/contrib/dev/acpica/include/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acparser.h b/sys/contrib/dev/acpica/include/acparser.h index 8d8adba1fcfd..4ad2ec27402b 100644 --- a/sys/contrib/dev/acpica/include/acparser.h +++ b/sys/contrib/dev/acpica/include/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acpi.h b/sys/contrib/dev/acpica/include/acpi.h index aab3dd3f125b..c57d4e332f7a 100644 --- a/sys/contrib/dev/acpica/include/acpi.h +++ b/sys/contrib/dev/acpica/include/acpi.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index 1a1aa1b0076f..21cac7a35b7e 100644 --- a/sys/contrib/dev/acpica/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/include/acpiosxf.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 93e9c1454174..26988ab9e816 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20140926 +#define ACPI_CA_VERSION 0x20150204 #include #include @@ -702,6 +702,15 @@ AcpiInstallGpeHandler ( ACPI_GPE_HANDLER Address, void *Context)) +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS +AcpiInstallGpeRawHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Address, + void *Context)) + ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiRemoveGpeHandler ( @@ -886,6 +895,11 @@ ACPI_STATUS AcpiEnableAllRuntimeGpes ( void)) +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS +AcpiEnableAllWakeupGpes ( + void)) + ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiGetGpeDevice ( diff --git a/sys/contrib/dev/acpica/include/acpredef.h b/sys/contrib/dev/acpica/include/acpredef.h index c41ab03b5440..c832f51ba355 100644 --- a/sys/contrib/dev/acpica/include/acpredef.h +++ b/sys/contrib/dev/acpica/include/acpredef.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acresrc.h b/sys/contrib/dev/acpica/include/acresrc.h index 5f7927450683..3b62275fded9 100644 --- a/sys/contrib/dev/acpica/include/acresrc.h +++ b/sys/contrib/dev/acpica/include/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acrestyp.h b/sys/contrib/dev/acpica/include/acrestyp.h index b0412aa63cca..971dd7210328 100644 --- a/sys/contrib/dev/acpica/include/acrestyp.h +++ b/sys/contrib/dev/acpica/include/acrestyp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/acstruct.h b/sys/contrib/dev/acpica/include/acstruct.h index 5a0baf4001b0..1de614ff5320 100644 --- a/sys/contrib/dev/acpica/include/acstruct.h +++ b/sys/contrib/dev/acpica/include/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index 2e3065865753..bc1574ddca98 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actbl.h b/sys/contrib/dev/acpica/include/actbl.h index 707511dc0093..6d7980827647 100644 --- a/sys/contrib/dev/acpica/include/actbl.h +++ b/sys/contrib/dev/acpica/include/actbl.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actbl1.h b/sys/contrib/dev/acpica/include/actbl1.h index a781056e1d54..66b3d0709380 100644 --- a/sys/contrib/dev/acpica/include/actbl1.h +++ b/sys/contrib/dev/acpica/include/actbl1.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h index 0f929eba4665..f8a027837f26 100644 --- a/sys/contrib/dev/acpica/include/actbl2.h +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actbl3.h b/sys/contrib/dev/acpica/include/actbl3.h index 2f98b37203a9..f7ae6704ecf5 100644 --- a/sys/contrib/dev/acpica/include/actbl3.h +++ b/sys/contrib/dev/acpica/include/actbl3.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 0444f5e14e12..c6f2170ce89b 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -743,11 +743,15 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 #define ACPI_GPE_CONDITIONAL_ENABLE 2 +#define ACPI_GPE_SAVE_MASK 4 + +#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK) +#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK) /* * GPE info flags - Per GPE * +-------+-+-+---+ - * | 7:4 |3|2|1:0| + * | 7:5 |4|3|2:0| * +-------+-+-+---+ * | | | | * | | | +-- Type of dispatch:to method, handler, notify, or none @@ -759,13 +763,15 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 #define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 #define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 -#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03 +#define ACPI_GPE_DISPATCH_RAW_HANDLER (UINT8) 0x04 +#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x07 +#define ACPI_GPE_DISPATCH_TYPE(flags) ((UINT8) ((flags) & ACPI_GPE_DISPATCH_MASK)) -#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04 +#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x08 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 -#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04 +#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x08 -#define ACPI_GPE_CAN_WAKE (UINT8) 0x08 +#define ACPI_GPE_CAN_WAKE (UINT8) 0x10 /* * Flags for GPE and Lock interfaces diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index 8031fd3734de..a651863c8837 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/amlcode.h b/sys/contrib/dev/acpica/include/amlcode.h index bc8c0b0d3dd0..03530b9d8050 100644 --- a/sys/contrib/dev/acpica/include/amlcode.h +++ b/sys/contrib/dev/acpica/include/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/amlresrc.h b/sys/contrib/dev/acpica/include/amlresrc.h index cd8b3b638c9e..b38028e60a19 100644 --- a/sys/contrib/dev/acpica/include/amlresrc.h +++ b/sys/contrib/dev/acpica/include/amlresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 8b8e890d0bcb..759a68ed636c 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/platform/acenvex.h b/sys/contrib/dev/acpica/include/platform/acenvex.h index a1de87ffee25..d08d03b04690 100644 --- a/sys/contrib/dev/acpica/include/platform/acenvex.h +++ b/sys/contrib/dev/acpica/include/platform/acenvex.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/platform/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index ab4dc9830fcd..f4ba48c1b5a8 100644 --- a/sys/contrib/dev/acpica/include/platform/acfreebsd.h +++ b/sys/contrib/dev/acpica/include/platform/acfreebsd.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/include/platform/acgcc.h b/sys/contrib/dev/acpica/include/platform/acgcc.h index 23db3248f520..2a274451faff 100644 --- a/sys/contrib/dev/acpica/include/platform/acgcc.h +++ b/sys/contrib/dev/acpica/include/platform/acgcc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c b/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c index 9f55cc7d9009..c24cca47b1ce 100644 --- a/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c +++ b/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c index d4febe283b2c..fcd5fbcca653 100644 --- a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c +++ b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 5771d4c6faa2..b33f462a9448 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -122,6 +122,7 @@ cardbus_detach(device_t cbdev) cardbus_detach_card(cbdev); #ifdef PCI_RES_BUS sc = device_get_softc(cbdev); + device_printf(cbdev, "Freeing up the allocatd bus\n"); (void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc->sc_bus); #endif return (0); @@ -180,6 +181,7 @@ cardbus_attach_card(device_t cbdev) sc = device_get_softc(cbdev); cardbus_detach_card(cbdev); /* detach existing cards */ + POWER_DISABLE_SOCKET(brdev, cbdev); /* Turn the socket off first */ POWER_ENABLE_SOCKET(brdev, cbdev); domain = pcib_get_domain(cbdev); bus = pcib_get_bus(cbdev); diff --git a/sys/dev/cxgb/cxgb_adapter.h b/sys/dev/cxgb/cxgb_adapter.h index 6f3abe7ee2eb..08ca6c1129b6 100644 --- a/sys/dev/cxgb/cxgb_adapter.h +++ b/sys/dev/cxgb/cxgb_adapter.h @@ -59,7 +59,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include struct adapter; struct sge_qset; @@ -251,7 +250,7 @@ struct sge_txq { bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; bus_dma_tag_t entry_tag; - struct mbuf_head sendq; + struct mbufq sendq; struct buf_ring *txq_mr; struct ifaltq *txq_ifq; diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 2b08183b0cd5..7f41656c606a 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -1117,9 +1117,10 @@ init_qset_cntxt(struct sge_qset *qs, u_int id) qs->txq[TXQ_CTRL].cntxt_id = FW_CTRL_SGEEC_START + id; qs->txq[TXQ_CTRL].token = FW_CTRL_TID_START + id; - mbufq_init(&qs->txq[TXQ_ETH].sendq); - mbufq_init(&qs->txq[TXQ_OFLD].sendq); - mbufq_init(&qs->txq[TXQ_CTRL].sendq); + /* XXX: a sane limit is needed instead of INT_MAX */ + mbufq_init(&qs->txq[TXQ_ETH].sendq, INT_MAX); + mbufq_init(&qs->txq[TXQ_OFLD].sendq, INT_MAX); + mbufq_init(&qs->txq[TXQ_CTRL].sendq, INT_MAX); } @@ -1820,8 +1821,8 @@ check_desc_avail(adapter_t *adap, struct sge_txq *q, * the control queue is only used for binding qsets which happens * at init time so we are guaranteed enough descriptors */ - if (__predict_false(!mbufq_empty(&q->sendq))) { -addq_exit: mbufq_tail(&q->sendq, m); + if (__predict_false(mbufq_len(&q->sendq))) { +addq_exit: (void )mbufq_enqueue(&q->sendq, m); return 1; } if (__predict_false(q->size - q->in_use < ndesc)) { @@ -1936,7 +1937,7 @@ again: reclaim_completed_tx_imm(q); } q->in_use++; } - if (!mbufq_empty(&q->sendq)) { + if (mbufq_len(&q->sendq)) { setbit(&qs->txq_stopped, TXQ_CTRL); if (should_restart_tx(q) && @@ -2319,7 +2320,7 @@ restart_offloadq(void *data, int npending) TXQ_LOCK(qs); again: cleaned = reclaim_completed_tx(qs, 16, TXQ_OFLD); - while ((m = mbufq_peek(&q->sendq)) != NULL) { + while ((m = mbufq_first(&q->sendq)) != NULL) { unsigned int gen, pidx; struct ofld_hdr *oh = mtod(m, struct ofld_hdr *); unsigned int ndesc = G_HDR_NDESC(oh->flags); @@ -2485,7 +2486,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int id, int nports, int irq_vec_idx, printf("error %d from alloc ring tx %i\n", ret, i); goto err; } - mbufq_init(&q->txq[i].sendq); + mbufq_init(&q->txq[i].sendq, INT_MAX); q->txq[i].gen = 1; q->txq[i].size = p->txq_size[i]; } @@ -3521,7 +3522,7 @@ t3_add_configured_sysctls(adapter_t *sc) CTLFLAG_RD, &qs->txq[TXQ_ETH].txq_mr->br_drops, "#tunneled packets dropped"); SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "sendqlen", - CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.qlen, + CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.mq_len, 0, "#tunneled packets waiting to be sent"); #if 0 SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "queue_pidx", diff --git a/sys/dev/cxgb/sys/mbufq.h b/sys/dev/cxgb/sys/mbufq.h deleted file mode 100644 index 5f546a6033bd..000000000000 --- a/sys/dev/cxgb/sys/mbufq.h +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - -Copyright (c) 2007-2008, Chelsio Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Neither the name of the Chelsio Corporation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -$FreeBSD$ - -***************************************************************************/ - -#ifndef CXGB_MBUFQ_H_ -#define CXGB_MBUFQ_H_ - -struct mbuf_head { - struct mbuf *head; - struct mbuf *tail; - uint32_t qlen; - uint32_t qsize; - struct mtx lock; -}; - -static __inline void -mbufq_init(struct mbuf_head *l) -{ - l->head = l->tail = NULL; - l->qlen = l->qsize = 0; -} - -static __inline int -mbufq_empty(struct mbuf_head *l) -{ - return (l->head == NULL); -} - -static __inline int -mbufq_len(struct mbuf_head *l) -{ - return (l->qlen); -} - -static __inline int -mbufq_size(struct mbuf_head *l) -{ - return (l->qsize); -} - -static __inline int -mbufq_head_size(struct mbuf_head *l) -{ - return (l->head ? l->head->m_pkthdr.len : 0); -} - -static __inline void -mbufq_tail(struct mbuf_head *l, struct mbuf *m) -{ - l->qlen++; - if (l->head == NULL) - l->head = m; - else - l->tail->m_nextpkt = m; - l->tail = m; - l->qsize += m->m_pkthdr.len; -} - -static __inline struct mbuf * -mbufq_dequeue(struct mbuf_head *l) -{ - struct mbuf *m; - - m = l->head; - if (m) { - if (m == l->tail) - l->head = l->tail = NULL; - else - l->head = m->m_nextpkt; - m->m_nextpkt = NULL; - l->qlen--; - l->qsize -= m->m_pkthdr.len; - } - - return (m); -} - -static __inline struct mbuf * -mbufq_peek(const struct mbuf_head *l) -{ - return (l->head); -} - -static __inline void -mbufq_append(struct mbuf_head *a, struct mbuf_head *b) -{ - if (a->tail) - a->tail->m_nextpkt = b->head; - if (b->tail) - a->tail = b->tail; - a->qlen += b->qlen; - a->qsize += b->qsize; - - -} -#endif /* CXGB_MBUFQ_H_ */ diff --git a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c index a4b67088db93..bdd746fcb44f 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c +++ b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c @@ -1088,7 +1088,7 @@ send_reset(struct toepcb *toep) req->cmd = CPL_ABORT_SEND_RST; if (tp->t_state == TCPS_SYN_SENT) - mbufq_tail(&toep->out_of_order_queue, m); /* defer */ + (void )mbufq_enqueue(&toep->out_of_order_queue, m); /* defer */ else l2t_send(sc, m, toep->tp_l2t); } diff --git a/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h b/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h index d821a0135456..167e36deb97d 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h +++ b/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h @@ -30,7 +30,7 @@ #define CXGB_TOEPCB_H_ #include #include -#include +#include #define TP_DATASENT (1 << 0) #define TP_TX_WAIT_IDLE (1 << 1) @@ -64,26 +64,26 @@ struct toepcb { struct inpcb *tp_inp; struct mbuf *tp_m_last; - struct mbuf_head wr_list; - struct mbuf_head out_of_order_queue; + struct mbufq wr_list; + struct mbufq out_of_order_queue; }; static inline void reset_wr_list(struct toepcb *toep) { - mbufq_init(&toep->wr_list); + mbufq_init(&toep->wr_list, INT_MAX); /* XXX: sane limit needed */ } static inline void enqueue_wr(struct toepcb *toep, struct mbuf *m) { - mbufq_tail(&toep->wr_list, m); + (void )mbufq_enqueue(&toep->wr_list, m); } static inline struct mbuf * peek_wr(const struct toepcb *toep) { - return (mbufq_peek(&toep->wr_list)); + return (mbufq_first(&toep->wr_list)); } static inline struct mbuf * diff --git a/sys/dev/iicbus/lm75.c b/sys/dev/iicbus/lm75.c index 52ab159e964b..2b9b1a362508 100644 --- a/sys/dev/iicbus/lm75.c +++ b/sys/dev/iicbus/lm75.c @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); /* LM75 registers. */ #define LM75_TEMP 0x0 +#define LM75_TEMP_MASK 0xff80 +#define LM75A_TEMP_MASK 0xffe0 #define LM75_CONF 0x1 #define LM75_CONF_FSHIFT 3 #define LM75_CONF_FAULT 0x18 @@ -132,7 +134,7 @@ lm75_read(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data, size_t len) { addr, IIC_M_RD, len, data }, }; - if (iicbus_transfer(dev, msg, 2) != 0) + if (iicbus_transfer(dev, msg, nitems(msg)) != 0) return (-1); return (0); @@ -145,7 +147,7 @@ lm75_write(device_t dev, uint32_t addr, uint8_t *data, size_t len) { addr, IIC_M_WR, len, data }, }; - if (iicbus_transfer(dev, msg, 1) != 0) + if (iicbus_transfer(dev, msg, nitems(msg)) != 0) return (-1); return (0); @@ -226,7 +228,8 @@ lm75_type_detect(struct lm75_softc *sc) */ lm75a = 0; for (i = 4; i <= 6; i++) { - if (lm75_read(sc->sc_dev, sc->sc_addr, i, &buf8, 1) < 0) + if (lm75_read(sc->sc_dev, sc->sc_addr, i, + &buf8, sizeof(buf8)) < 0) return (-1); if (buf8 != LM75_TEST_PATTERN && buf8 != 0xff) return (-1); @@ -286,16 +289,16 @@ lm75_start(void *xdev) /* Configuration parameters. */ SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "faults", - CTLFLAG_RW | CTLTYPE_UINT, dev, 0, + CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, dev, 0, lm75_faults_sysctl, "IU", "LM75 fault queue"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "mode", - CTLFLAG_RW | CTLTYPE_STRING, dev, 0, + CTLFLAG_RW | CTLTYPE_STRING | CTLFLAG_MPSAFE, dev, 0, lm75_mode_sysctl, "A", "LM75 mode"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "polarity", - CTLFLAG_RW | CTLTYPE_STRING, dev, 0, + CTLFLAG_RW | CTLTYPE_STRING | CTLFLAG_MPSAFE, dev, 0, lm75_pol_sysctl, "A", "LM75 OS polarity"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "shutdown", - CTLFLAG_RW | CTLTYPE_UINT, dev, 0, + CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, dev, 0, lm75_shutdown_sysctl, "IU", "LM75 shutdown"); } @@ -304,9 +307,9 @@ lm75_conf_read(struct lm75_softc *sc) { uint8_t buf8; - if (lm75_read(sc->sc_dev, sc->sc_addr, LM75_CONF, &buf8, 1) < 0) + if (lm75_read(sc->sc_dev, sc->sc_addr, LM75_CONF, + &buf8, sizeof(buf8)) < 0) return (-1); - sc->sc_conf = (uint32_t)buf8; return (0); @@ -319,8 +322,7 @@ lm75_conf_write(struct lm75_softc *sc) buf8[0] = LM75_CONF; buf8[1] = (uint8_t)sc->sc_conf & LM75_CONF_MASK; - - if (lm75_write(sc->sc_dev, sc->sc_addr, buf8, 2) < 0) + if (lm75_write(sc->sc_dev, sc->sc_addr, buf8, sizeof(buf8)) < 0) return (-1); return (0); @@ -331,20 +333,24 @@ lm75_temp_read(struct lm75_softc *sc, uint8_t reg, int *temp) { uint8_t buf8[2]; uint16_t buf; - int t; + int neg, t; - if (lm75_read(sc->sc_dev, sc->sc_addr, reg, buf8, 2) < 0) + if (lm75_read(sc->sc_dev, sc->sc_addr, reg, buf8, sizeof(buf8)) < 0) return (-1); - - buf = (buf8[0] << 8) | (buf8[1] & 0xff); - + buf = (uint16_t)((buf8[0] << 8) | (buf8[1] & 0xff)); /* * LM75 has a 9 bit ADC with resolution of 0.5 C per bit. * LM75A has an 11 bit ADC with resolution of 0.125 C per bit. * Temperature is stored with two's complement. */ - if (buf & LM75_NEG_BIT) - buf = ~buf + 1; + neg = 0; + if (buf & LM75_NEG_BIT) { + if (sc->sc_hwtype == HWTYPE_LM75A) + buf = ~(buf & LM75A_TEMP_MASK) + 1; + else + buf = ~(buf & LM75_TEMP_MASK) + 1; + neg = 1; + } *temp = ((int16_t)buf >> 8) * 10; t = 0; if (sc->sc_hwtype == HWTYPE_LM75A) { @@ -357,7 +363,7 @@ lm75_temp_read(struct lm75_softc *sc, uint8_t reg, int *temp) t += 500; t /= 100; *temp += t; - if (buf & LM75_NEG_BIT) + if (neg) *temp = -(*temp); *temp += TZ_ZEROC; @@ -370,6 +376,7 @@ lm75_temp_write(struct lm75_softc *sc, uint8_t reg, int temp) uint8_t buf8[3]; uint16_t buf; + temp = (temp - TZ_ZEROC) / 10; if (temp > LM75_MAX_TEMP) temp = LM75_MAX_TEMP; if (temp < LM75_MIN_TEMP) @@ -381,8 +388,7 @@ lm75_temp_write(struct lm75_softc *sc, uint8_t reg, int temp) buf8[0] = reg; buf8[1] = buf >> 8; buf8[2] = buf & 0xff; - - if (lm75_write(sc->sc_dev, sc->sc_addr, buf8, 3) < 0) + if (lm75_write(sc->sc_dev, sc->sc_addr, buf8, sizeof(buf8)) < 0) return (-1); return (0); diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index fecfff3adda3..f09e202389e7 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -3082,7 +3082,11 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; cdai.buftype = CDAI_TYPE_RCAPLONG; +#if __FreeBSD_version >= 1100061 + cdai.flags = CDAI_FLAG_NONE; +#else cdai.flags = 0; +#endif cdai.bufsiz = sizeof(rcap_buf); cdai.buf = (uint8_t *)&rcap_buf; xpt_action((union ccb *)&cdai); diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c index b2481e1c993c..831ecd263c77 100644 --- a/sys/dev/mps/mps_sas.c +++ b/sys/dev/mps/mps_sas.c @@ -3235,7 +3235,11 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path, cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.ccb_h.flags = CAM_DIR_IN; cdai.buftype = CDAI_TYPE_RCAPLONG; +#if __FreeBSD_version >= 1100061 + cdai.flags = CDAI_FLAG_NONE; +#else cdai.flags = 0; +#endif cdai.bufsiz = sizeof(rcap_buf); cdai.buf = (uint8_t *)&rcap_buf; xpt_action((union ccb *)&cdai); diff --git a/sys/dev/ofw/ofw_cpu.c b/sys/dev/ofw/ofw_cpu.c index 0432560281a8..59e49eea6485 100644 --- a/sys/dev/ofw/ofw_cpu.c +++ b/sys/dev/ofw/ofw_cpu.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static int ofw_cpulist_probe(device_t); static int ofw_cpulist_attach(device_t); @@ -244,6 +245,7 @@ ofw_cpu_attach(device_t dev) static int ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { + struct ofw_cpulist_softc *psc; struct ofw_cpu_softc *sc; sc = device_get_softc(dev); @@ -258,8 +260,65 @@ ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) return (0); } break; + case CPU_IVAR_CPUID_SIZE: + psc = device_get_softc(device_get_parent(dev)); + *result = psc->sc_addr_cells; + return (0); + case CPU_IVAR_CPUID: + if (sc->sc_reg_valid) { + *result = (uintptr_t)sc->sc_reg; + return (0); + } + break; } return (ENOENT); } +int +ofw_cpu_early_foreach(ofw_cpu_foreach_cb callback, boolean_t only_runnable) +{ + phandle_t node, child; + pcell_t addr_cells, reg[2]; + char status[16]; + u_int id; + int count, rv; + + count = 0; + id = 0; + + node = OF_finddevice("/cpus"); + if (node == -1) + return (-1); + + /* Find the number of cells in the cpu register */ + if (OF_getencprop(node, "#address-cells", &addr_cells, + sizeof(addr_cells)) < 0) + return (-1); + + for (child = OF_child(node); child != 0; child = OF_peer(child), id++) { + /* + * If we are filtering by runnable then limit to only + * those that have been enabled. + */ + if (only_runnable) { + status[0] = '\0'; + OF_getprop(child, "status", status, sizeof(status)); + if (status[0] != '\0' && strcmp(status, "okay") != 0) + continue; + } + + /* + * Check we have a register to identify the cpu + */ + rv = OF_getencprop(child, "reg", reg, + addr_cells * sizeof(cell_t)); + if (rv != addr_cells * sizeof(cell_t)) + continue; + + if (callback == NULL || callback(id, child, addr_cells, reg)) + count++; + } + + return (only_runnable ? count : id); +} diff --git a/sys/dev/ofw/ofw_cpu.h b/sys/dev/ofw/ofw_cpu.h new file mode 100644 index 000000000000..9ac91713e612 --- /dev/null +++ b/sys/dev/ofw/ofw_cpu.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2015 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_OFW_OFW_CPU_H_ +#define _DEV_OFW_OFW_CPU_H_ + +typedef boolean_t (*ofw_cpu_foreach_cb)(u_int, phandle_t, u_int, pcell_t *); +int ofw_cpu_early_foreach(ofw_cpu_foreach_cb, boolean_t); + +#endif /* _DEV_OFW_OFW_CPU_H_ */ diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index d3ebe528db04..03a8a1012db8 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -155,7 +155,7 @@ SYSCTL_INT(_hw_cbb, OID_AUTO, debug, CTLFLAG_RWTUN, &cbb_debug, 0, static void cbb_insert(struct cbb_softc *sc); static void cbb_removal(struct cbb_softc *sc); static uint32_t cbb_detect_voltage(device_t brdev); -static void cbb_cardbus_reset_power(device_t brdev, device_t child, int on); +static int cbb_cardbus_reset_power(device_t brdev, device_t child, int on); static int cbb_cardbus_io_open(device_t brdev, int win, uint32_t start, uint32_t end); static int cbb_cardbus_mem_open(device_t brdev, int win, @@ -958,12 +958,12 @@ cbb_do_power(device_t brdev) /* CardBus power functions */ /************************************************************************/ -static void +static int cbb_cardbus_reset_power(device_t brdev, device_t child, int on) { struct cbb_softc *sc = device_get_softc(brdev); - uint32_t b; - int delay, count; + uint32_t b, h; + int delay, count, zero_seen, func; /* * Asserting reset for 20ms is necessary for most bridges. For some @@ -1002,23 +1002,30 @@ cbb_cardbus_reset_power(device_t brdev, device_t child, int on) 0xfffffffful && --count >= 0); if (count < 0) device_printf(brdev, "Warning: Bus reset timeout\n"); + + /* + * Some cards (so far just an atheros card I have) seem to + * come out of reset in a funky state. They report they are + * multi-function cards, but have nonsense for some of the + * higher functions. So if the card claims to be MFDEV, and + * any of the higher functions' ID is 0, then we've hit the + * bug and we'll try again. + */ + h = PCIB_READ_CONFIG(brdev, b, 0, 0, PCIR_HDRTYPE, 1); + if ((h & PCIM_MFDEV) == 0) + return 0; + zero_seen = 0; + for (func = 1; func < 8; func++) { + h = PCIB_READ_CONFIG(brdev, b, 0, func, + PCIR_DEVVENDOR, 4); + if (h == 0) + zero_seen++; + } + if (!zero_seen) + return 0; + return (EINVAL); } -} - -static int -cbb_cardbus_power_enable_socket(device_t brdev, device_t child) -{ - struct cbb_softc *sc = device_get_softc(brdev); - int err; - - if (!CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) - return (ENODEV); - - err = cbb_do_power(brdev); - if (err) - return (err); - cbb_cardbus_reset_power(brdev, child, 1); - return (0); + return 0; } static int @@ -1029,6 +1036,30 @@ cbb_cardbus_power_disable_socket(device_t brdev, device_t child) return (0); } +static int +cbb_cardbus_power_enable_socket(device_t brdev, device_t child) +{ + struct cbb_softc *sc = device_get_softc(brdev); + int err, count; + + if (!CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) + return (ENODEV); + + count = 10; + do { + err = cbb_do_power(brdev); + if (err) + return (err); + err = cbb_cardbus_reset_power(brdev, child, 1); + if (err) { + device_printf(brdev, "Reset failed, trying again.\n"); + cbb_cardbus_power_disable_socket(brdev, child); + pause("cbbErr1", hz / 10); /* wait 100ms */ + } + } while (err != 0 && count-- > 0); + return (0); +} + /************************************************************************/ /* CardBus Resource */ /************************************************************************/ diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c index 6f6febbe2b23..2bb31f46dda0 100644 --- a/sys/dev/random/fortuna.c +++ b/sys/dev/random/fortuna.c @@ -298,8 +298,13 @@ random_fortuna_genrandom(uint8_t *buf, u_int bytecount) KASSERT((bytecount <= (1 << 20)), ("invalid single read request to fortuna of %d bytes", bytecount)); /* F&S - r = first-n-bytes(GenerateBlocks(ceil(n/16))) */ - blockcount = (bytecount + BLOCKSIZE - 1)/BLOCKSIZE; + blockcount = bytecount / BLOCKSIZE; random_fortuna_genblocks(buf, blockcount); + /* TODO: FIX! remove memcpy()! */ + if (bytecount % BLOCKSIZE > 0) { + random_fortuna_genblocks(temp, 1); + memcpy(buf + (blockcount * BLOCKSIZE), temp, bytecount % BLOCKSIZE); + } /* F&S - K = GenerateBlocks(2) */ random_fortuna_genblocks(temp, KEYSIZE/BLOCKSIZE); diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c index d6905e89e192..88e09af94cc8 100644 --- a/sys/dev/random/yarrow.c +++ b/sys/dev/random/yarrow.c @@ -432,6 +432,7 @@ reseed(u_int fastslow) void random_yarrow_read(uint8_t *buf, u_int bytecount) { + uint8_t tbuf[BLOCKSIZE]; u_int blockcount, i; /* Check for initial/final read requests */ @@ -448,8 +449,16 @@ random_yarrow_read(uint8_t *buf, u_int bytecount) yarrow_state.outputblocks = 0; } uint128_increment(&yarrow_state.counter.whole); - randomdev_encrypt(&yarrow_state.key, yarrow_state.counter.byte, buf, BLOCKSIZE); - buf += BLOCKSIZE; + if ((i + 1) * BLOCKSIZE > bytecount) { + /* TODO: FIX! remove memcpy()! */ + randomdev_encrypt(&yarrow_state.key, + yarrow_state.counter.byte, tbuf, BLOCKSIZE); + memcpy(buf, tbuf, bytecount - i * BLOCKSIZE); + } else { + randomdev_encrypt(&yarrow_state.key, + yarrow_state.counter.byte, buf, BLOCKSIZE); + buf += BLOCKSIZE; + } } mtx_unlock(&random_reseed_mtx); diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c index 783a047141be..27ecd414058c 100644 --- a/sys/dev/sfxge/common/efx_ev.c +++ b/sys/dev/sfxge/common/efx_ev.c @@ -577,9 +577,9 @@ efx_ev_mcdi( case MCDI_EVENT_CODE_CMDDONE: efx_mcdi_ev_cpl(enp, - MCDI_EV_FIELD(*eqp, CMDDONE_SEQ), - MCDI_EV_FIELD(*eqp, CMDDONE_DATALEN), - MCDI_EV_FIELD(*eqp, CMDDONE_ERRNO)); + MCDI_EV_FIELD(eqp, CMDDONE_SEQ), + MCDI_EV_FIELD(eqp, CMDDONE_DATALEN), + MCDI_EV_FIELD(eqp, CMDDONE_ERRNO)); break; case MCDI_EVENT_CODE_LINKCHANGE: { diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index cc3a6de68ea8..ad054b363eca 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -231,7 +231,7 @@ efx_mcdi_version( MC_CMD_ ## _field) #define MCDI_EV_FIELD(_eqp, _field) \ - EFX_QWORD_FIELD(*eqp, MCDI_EVENT_ ## _field) + EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field) #ifdef __cplusplus } diff --git a/sys/dev/sfxge/common/efx_regs_mcdi.h b/sys/dev/sfxge/common/efx_regs_mcdi.h index 8246f89d950f..9ee251303ca9 100644 --- a/sys/dev/sfxge/common/efx_regs_mcdi.h +++ b/sys/dev/sfxge/common/efx_regs_mcdi.h @@ -709,7 +709,9 @@ #define MC_CMD_GET_BOARD_CFG_IN_LEN 0 /* MC_CMD_GET_BOARD_CFG_OUT msgresponse */ -#define MC_CMD_GET_BOARD_CFG_OUT_LEN 96 +#define MC_CMD_GET_BOARD_CFG_OUT_LENMIN 96 +#define MC_CMD_GET_BOARD_CFG_OUT_LENMAX 136 +#define MC_CMD_GET_BOARD_CFG_OUT_LEN(num) (72+2*(num)) #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_TYPE_OFST 0 #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_OFST 4 #define MC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_LEN 32 @@ -729,7 +731,8 @@ #define MC_CMD_GET_BOARD_CFG_OUT_MAC_STRIDE_PORT1_OFST 68 #define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST 72 #define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN 2 -#define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_NUM 12 +#define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM 12 +#define MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM 32 /***********************************/ diff --git a/sys/dev/sfxge/common/siena_nic.c b/sys/dev/sfxge/common/siena_nic.c index b7d42de38530..eba0a181e2a8 100644 --- a/sys/dev/sfxge/common/siena_nic.c +++ b/sys/dev/sfxge/common/siena_nic.c @@ -276,7 +276,7 @@ siena_board_cfg( { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_mcdi_iface_t *emip = &(enp->en_u.siena.enu_mip); - uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LEN, + uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN, MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)]; efx_mcdi_req_t req; uint8_t *src; @@ -288,7 +288,7 @@ siena_board_cfg( req.emr_in_buf = NULL; req.emr_in_length = 0; req.emr_out_buf = outbuf; - req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LEN; + req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LENMIN; efx_mcdi_execute(enp, &req); @@ -297,7 +297,7 @@ siena_board_cfg( goto fail1; } - if (req.emr_out_length_used < MC_CMD_GET_BOARD_CFG_OUT_LEN) { + if (req.emr_out_length_used < MC_CMD_GET_BOARD_CFG_OUT_LENMIN) { rc = EMSGSIZE; goto fail2; } diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index e883ce1b9493..249293de14a3 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -587,7 +587,7 @@ siena_nvram_get_subtype( __out uint32_t *subtypep) { efx_mcdi_req_t req; - uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN]; + uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMAX]; efx_word_t *fw_list; int rc; @@ -605,17 +605,26 @@ siena_nvram_get_subtype( goto fail1; } - if (req.emr_out_length_used < MC_CMD_GET_BOARD_CFG_OUT_LEN) { + if (req.emr_out_length_used < MC_CMD_GET_BOARD_CFG_OUT_LENMIN) { rc = EMSGSIZE; goto fail2; } + if (req.emr_out_length_used < + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST + + (partn + 1) * sizeof(efx_word_t)) { + rc = ENOENT; + goto fail3; + } + fw_list = MCDI_OUT2(req, efx_word_t, GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST); *subtypep = EFX_WORD_FIELD(fw_list[partn], EFX_WORD_0); return (0); +fail3: + EFSYS_PROBE(fail3); fail2: EFSYS_PROBE(fail2); fail1: diff --git a/sys/dev/sfxge/common/siena_phy.c b/sys/dev/sfxge/common/siena_phy.c index 4189e23e027a..31b5c4637f83 100644 --- a/sys/dev/sfxge/common/siena_phy.c +++ b/sys/dev/sfxge/common/siena_phy.c @@ -122,7 +122,7 @@ siena_phy_link_ev( * Convert the LINKCHANGE speed enumeration into mbit/s, in the * same way as GET_LINK encodes the speed */ - switch (MCDI_EV_FIELD(*eqp, LINKCHANGE_SPEED)) { + switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) { case MCDI_EVENT_LINKCHANGE_SPEED_100M: speed = 100; break; @@ -137,11 +137,11 @@ siena_phy_link_ev( break; } - link_flags = MCDI_EV_FIELD(*eqp, LINKCHANGE_LINK_FLAGS); + link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS); siena_phy_decode_link_mode(enp, link_flags, speed, - MCDI_EV_FIELD(*eqp, LINKCHANGE_FCNTL), + MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL), &link_mode, &fcntl); - siena_phy_decode_cap(MCDI_EV_FIELD(*eqp, LINKCHANGE_LP_CAP), + siena_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP), &lp_cap_mask); /* diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h index 1c4e76a426e4..55b40bb2e501 100644 --- a/sys/dev/sfxge/sfxge.h +++ b/sys/dev/sfxge/sfxge.h @@ -259,6 +259,10 @@ struct sfxge_softc { struct mtx tx_lock __aligned(CACHE_LINE_SIZE); char tx_lock_name[SFXGE_LOCK_NAME_MAX]; #endif + + unsigned int evq_count; + unsigned int rxq_count; + unsigned int txq_count; }; #define SFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN) diff --git a/sys/dev/sfxge/sfxge_ev.c b/sys/dev/sfxge/sfxge_ev.c index af6fb98aa1c7..a8f6d5785b43 100644 --- a/sys/dev/sfxge/sfxge_ev.c +++ b/sys/dev/sfxge/sfxge_ev.c @@ -427,7 +427,7 @@ sfxge_ev_stat_update(struct sfxge_softc *sc) sc->ev_stats_update_time = now; /* Add event counts from each event queue in turn */ - for (index = 0; index < sc->intr.n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { evq = sc->evq[index]; SFXGE_EVQ_LOCK(evq); efx_ev_qstats_update(evq->common, sc->ev_stats); @@ -493,7 +493,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARGS) struct sfxge_intr *intr = &sc->intr; unsigned int moderation; int error; - int index; + unsigned int index; SFXGE_ADAPTER_LOCK(sc); @@ -513,7 +513,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARGS) sc->ev_moderation = moderation; if (intr->state == SFXGE_INTR_STARTED) { - for (index = 0; index < intr->n_alloc; index++) + for (index = 0; index < sc->evq_count; index++) sfxge_ev_qmoderate(sc, index, moderation); } } else { @@ -727,7 +727,7 @@ sfxge_ev_stop(struct sfxge_softc *sc) ("Interrupts not started")); /* Stop the event queue(s) */ - index = intr->n_alloc; + index = sc->evq_count; while (--index >= 0) sfxge_ev_qstop(sc, index); @@ -752,7 +752,7 @@ sfxge_ev_start(struct sfxge_softc *sc) return (rc); /* Start the event queues */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { if ((rc = sfxge_ev_qstart(sc, index)) != 0) goto fail; } @@ -853,9 +853,11 @@ sfxge_ev_fini(struct sfxge_softc *sc) sc->ev_moderation = 0; /* Tear down the event queue(s). */ - index = intr->n_alloc; + index = sc->evq_count; while (--index >= 0) sfxge_ev_qfini(sc, index); + + sc->evq_count = 0; } int @@ -869,6 +871,8 @@ sfxge_ev_init(struct sfxge_softc *sc) intr = &sc->intr; + sc->evq_count = intr->n_alloc; + KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); @@ -884,7 +888,7 @@ sfxge_ev_init(struct sfxge_softc *sc) /* * Initialize the event queue(s) - one per interrupt. */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { if ((rc = sfxge_ev_qinit(sc, index)) != 0) goto fail; } @@ -899,5 +903,6 @@ sfxge_ev_init(struct sfxge_softc *sc) while (--index >= 0) sfxge_ev_qfini(sc, index); + sc->evq_count = 0; return (rc); } diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c index 23101a5449d9..44d84910f186 100644 --- a/sys/dev/sfxge/sfxge_rx.c +++ b/sys/dev/sfxge/sfxge_rx.c @@ -939,13 +939,10 @@ sfxge_rx_qstart(struct sfxge_softc *sc, unsigned int index) void sfxge_rx_stop(struct sfxge_softc *sc) { - struct sfxge_intr *intr; int index; - intr = &sc->intr; - /* Stop the receive queue(s) */ - index = intr->n_alloc; + index = sc->rxq_count; while (--index >= 0) sfxge_rx_qstop(sc, index); @@ -987,7 +984,7 @@ sfxge_rx_start(struct sfxge_softc *sc) * Set up the scale table. Enable all hash types and hash insertion. */ for (index = 0; index < SFXGE_RX_SCALE_MAX; index++) - sc->rx_indir_table[index] = index % sc->intr.n_alloc; + sc->rx_indir_table[index] = index % sc->rxq_count; if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table, SFXGE_RX_SCALE_MAX)) != 0) goto fail; @@ -1000,7 +997,7 @@ sfxge_rx_start(struct sfxge_softc *sc) goto fail; /* Start the receive queue(s). */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->rxq_count; index++) { if ((rc = sfxge_rx_qstart(sc, index)) != 0) goto fail2; } @@ -1099,7 +1096,7 @@ sfxge_rx_qinit(struct sfxge_softc *sc, unsigned int index) efsys_mem_t *esmp; int rc; - KASSERT(index < sc->intr.n_alloc, ("index >= %d", sc->intr.n_alloc)); + KASSERT(index < sc->rxq_count, ("index >= %d", sc->rxq_count)); rxq = malloc(sizeof(struct sfxge_rxq), M_SFXGE, M_ZERO | M_WAITOK); rxq->sc = sc; @@ -1159,7 +1156,7 @@ sfxge_rx_stat_handler(SYSCTL_HANDLER_ARGS) /* Sum across all RX queues */ sum = 0; - for (index = 0; index < sc->intr.n_alloc; index++) + for (index = 0; index < sc->rxq_count; index++) sum += *(unsigned int *)((caddr_t)sc->rxq[index] + sfxge_rx_stats[id].offset); @@ -1190,14 +1187,13 @@ sfxge_rx_stat_init(struct sfxge_softc *sc) void sfxge_rx_fini(struct sfxge_softc *sc) { - struct sfxge_intr *intr; int index; - intr = &sc->intr; - - index = intr->n_alloc; + index = sc->rxq_count; while (--index >= 0) sfxge_rx_qfini(sc, index); + + sc->rxq_count = 0; } int @@ -1212,11 +1208,13 @@ sfxge_rx_init(struct sfxge_softc *sc) intr = &sc->intr; + sc->rxq_count = intr->n_alloc; + KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); /* Initialize the receive queue(s) - one per interrupt. */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->rxq_count; index++) { if ((rc = sfxge_rx_qinit(sc, index)) != 0) goto fail; } @@ -1230,5 +1228,6 @@ sfxge_rx_init(struct sfxge_softc *sc) while (--index >= 0) sfxge_rx_qfini(sc, index); + sc->rxq_count = 0; return (rc); } diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c index d726dac575a4..988e119d0012 100644 --- a/sys/dev/sfxge/sfxge_tx.c +++ b/sys/dev/sfxge/sfxge_tx.c @@ -649,7 +649,7 @@ sfxge_if_qflush(struct ifnet *ifp) sc = ifp->if_softc; - for (i = 0; i < SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); i++) + for (i = 0; i < sc->txq_count; i++) sfxge_tx_qdpl_flush(sc->txq[i]); } @@ -791,6 +791,7 @@ struct sfxge_tso_state { ssize_t nh_off; /* Offset of network header */ ssize_t tcph_off; /* Offset of TCP header */ unsigned header_len; /* Number of bytes of header */ + unsigned seg_size; /* TCP segment size */ }; static const struct ip *tso_iph(const struct sfxge_tso_state *tso) @@ -892,6 +893,7 @@ static void tso_start(struct sfxge_tso_state *tso, struct mbuf *mbuf) } tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off; + tso->seg_size = mbuf->m_pkthdr.tso_segsz; tso->seqnum = ntohl(tso_tcph(tso)->th_seq); @@ -1008,11 +1010,10 @@ static int tso_start_new_packet(struct sfxge_txq *txq, m_copydata(tso->mbuf, 0, tso->header_len, header); tsoh_th->th_seq = htonl(tso->seqnum); - tso->seqnum += tso->mbuf->m_pkthdr.tso_segsz; - if (tso->out_len > tso->mbuf->m_pkthdr.tso_segsz) { + tso->seqnum += tso->seg_size; + if (tso->out_len > tso->seg_size) { /* This packet will not finish the TSO burst. */ - ip_length = tso->header_len - tso->nh_off + - tso->mbuf->m_pkthdr.tso_segsz; + ip_length = tso->header_len - tso->nh_off + tso->seg_size; tsoh_th->th_flags &= ~(TH_FIN | TH_PUSH); } else { /* This packet will be the last in the TSO burst. */ @@ -1034,7 +1035,7 @@ static int tso_start_new_packet(struct sfxge_txq *txq, /* Make the header visible to the hardware. */ bus_dmamap_sync(txq->packet_dma_tag, map, BUS_DMASYNC_PREWRITE); - tso->packet_space = tso->mbuf->m_pkthdr.tso_segsz; + tso->packet_space = tso->seg_size; txq->tso_packets++; /* Form a descriptor for this header. */ @@ -1279,13 +1280,9 @@ sfxge_tx_stop(struct sfxge_softc *sc) { int index; - index = SFXGE_TX_SCALE(sc); + index = sc->txq_count; while (--index >= 0) - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); - - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM); - - sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM); + sfxge_tx_qstop(sc, index); /* Tear down the transmit module */ efx_tx_fini(sc->enp); @@ -1301,30 +1298,17 @@ sfxge_tx_start(struct sfxge_softc *sc) if ((rc = efx_tx_init(sc->enp)) != 0) return (rc); - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_NON_CKSUM)) != 0) - goto fail; - - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_CKSUM)) != 0) - goto fail2; - - for (index = 0; index < SFXGE_TX_SCALE(sc); index++) { - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + - index)) != 0) - goto fail3; + for (index = 0; index < sc->txq_count; index++) { + if ((rc = sfxge_tx_qstart(sc, index)) != 0) + goto fail; } return (0); -fail3: - while (--index >= 0) - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); - - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM); - -fail2: - sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM); - fail: + while (--index >= 0) + sfxge_tx_qstop(sc, index); + efx_tx_fini(sc->enp); return (rc); @@ -1535,9 +1519,7 @@ sfxge_tx_stat_handler(SYSCTL_HANDLER_ARGS) /* Sum across all TX queues */ sum = 0; - for (index = 0; - index < SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); - index++) + for (index = 0; index < sc->txq_count; index++) sum += *(unsigned long *)((caddr_t)sc->txq[index] + sfxge_tx_stats[id].offset); @@ -1570,12 +1552,11 @@ sfxge_tx_fini(struct sfxge_softc *sc) { int index; - index = SFXGE_TX_SCALE(sc); + index = sc->txq_count; while (--index >= 0) - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); + sfxge_tx_qfini(sc, index); - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); - sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM); + sc->txq_count = 0; } @@ -1591,6 +1572,12 @@ sfxge_tx_init(struct sfxge_softc *sc) KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); +#ifdef SFXGE_HAVE_MQ + sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc; +#else + sc->txq_count = SFXGE_TXQ_NTYPES; +#endif + sc->txqs_node = SYSCTL_ADD_NODE( device_get_sysctl_ctx(sc->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), @@ -1609,8 +1596,10 @@ sfxge_tx_init(struct sfxge_softc *sc) SFXGE_TXQ_IP_CKSUM, 0)) != 0) goto fail2; - for (index = 0; index < SFXGE_TX_SCALE(sc); index++) { - if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index, + for (index = 0; + index < sc->txq_count - SFXGE_TXQ_NTYPES + 1; + index++) { + if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NTYPES - 1 + index, SFXGE_TXQ_IP_TCP_UDP_CKSUM, index)) != 0) goto fail3; } @@ -1620,15 +1609,16 @@ sfxge_tx_init(struct sfxge_softc *sc) return (0); fail3: - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); - while (--index >= 0) sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); + sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); + fail2: sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM); fail: fail_txq_node: + sc->txq_count = 0; return (rc); } diff --git a/sys/dev/sfxge/sfxge_tx.h b/sys/dev/sfxge/sfxge_tx.h index 510cb3fae72e..ab001c111cb6 100644 --- a/sys/dev/sfxge/sfxge_tx.h +++ b/sys/dev/sfxge/sfxge_tx.h @@ -124,10 +124,8 @@ enum sfxge_txq_type { #ifdef SFXGE_HAVE_MQ #define SFXGE_TX_LOCK(txq) (&(txq)->lock) -#define SFXGE_TX_SCALE(sc) ((sc)->intr.n_alloc) #else #define SFXGE_TX_LOCK(txq) (&(txq)->sc->tx_lock) -#define SFXGE_TX_SCALE(sc) 1 #endif #define SFXGE_TXQ_LOCK_INIT(_txq, _ifname, _txq_index) \ diff --git a/sys/dev/spibus/spi.h b/sys/dev/spibus/spi.h index 170c90664fa9..0a7526271a57 100644 --- a/sys/dev/spibus/spi.h +++ b/sys/dev/spibus/spi.h @@ -1,4 +1,30 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2006 M. Warner Losh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ struct spi_command { void *tx_cmd; diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c index fc7831c7897f..178e125cb37c 100644 --- a/sys/dev/spibus/spibus.c +++ b/sys/dev/spibus/spibus.c @@ -1,3 +1,30 @@ +/*- + * Copyright (c) 2006 M. Warner Losh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + #include __FBSDID("$FreeBSD$"); diff --git a/sys/dev/spibus/spibusvar.h b/sys/dev/spibus/spibusvar.h index 3d5cac8215c6..9d4d4837cef2 100644 --- a/sys/dev/spibus/spibusvar.h +++ b/sys/dev/spibus/spibusvar.h @@ -1,4 +1,30 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2006 M. Warner Losh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ #define SPIBUS_IVAR(d) (struct spibus_ivar *) device_get_ivars(d) #define SPIBUS_SOFTC(d) (struct spibus_softc *) device_get_softc(d) diff --git a/sys/dev/xen/netfront/mbufq.h b/sys/dev/xen/netfront/mbufq.h deleted file mode 100644 index 0d6c60430ae6..000000000000 --- a/sys/dev/xen/netfront/mbufq.h +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - -Copyright (c) 2007, Chelsio Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Neither the name of the Chelsio Corporation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -$FreeBSD$ - -***************************************************************************/ - -#ifndef CXGB_MBUFQ_H_ -#define CXGB_MBUFQ_H_ - -struct mbuf_head { - struct mbuf *head; - struct mbuf *tail; - uint32_t qlen; - uint32_t qsize; - struct mtx lock; -}; - -static __inline void -mbufq_init(struct mbuf_head *l) -{ - l->head = l->tail = NULL; - l->qlen = l->qsize = 0; -} - -static __inline int -mbufq_empty(struct mbuf_head *l) -{ - return (l->head == NULL); -} - -static __inline int -mbufq_len(struct mbuf_head *l) -{ - return (l->qlen); -} - -static __inline int -mbufq_size(struct mbuf_head *l) -{ - return (l->qsize); -} - -static __inline int -mbufq_head_size(struct mbuf_head *l) -{ - return (l->head ? l->head->m_pkthdr.len : 0); -} - -static __inline void -mbufq_tail(struct mbuf_head *l, struct mbuf *m) -{ - l->qlen++; - if (l->head == NULL) - l->head = m; - else - l->tail->m_nextpkt = m; - l->tail = m; - l->qsize += m->m_pkthdr.len; -} - -static __inline struct mbuf * -mbufq_dequeue(struct mbuf_head *l) -{ - struct mbuf *m; - - m = l->head; - if (m) { - if (m == l->tail) - l->head = l->tail = NULL; - else - l->head = m->m_nextpkt; - m->m_nextpkt = NULL; - l->qlen--; - l->qsize -= m->m_pkthdr.len; - } - - return (m); -} - -static __inline struct mbuf * -mbufq_peek(struct mbuf_head *l) -{ - return (l->head); -} - -static __inline void -mbufq_append(struct mbuf_head *a, struct mbuf_head *b) -{ - if (a->tail) - a->tail->m_nextpkt = b->head; - if (b->tail) - a->tail = b->tail; - a->qlen += b->qlen; - a->qsize += b->qsize; - - -} -#endif /* CXGB_MBUFQ_H_ */ diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 8f401ac1ad96..b97af6239ce3 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -87,8 +88,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include "xenbus_if.h" /* Features supported by all backends. TSO and LRO can be negotiated */ @@ -277,7 +276,7 @@ struct netfront_info { int rx_ring_ref; uint8_t mac[ETHER_ADDR_LEN]; struct xn_chain_data xn_cdata; /* mbufs */ - struct mbuf_head xn_rx_batch; /* head of the batch queue */ + struct mbufq xn_rx_batch; /* batch queue */ int xn_if_flags; struct callout xn_stat_ch; @@ -837,7 +836,7 @@ network_alloc_rx_buffers(struct netfront_info *sc) m_new->m_len = m_new->m_pkthdr.len = MJUMPAGESIZE; /* queue the mbufs allocated */ - mbufq_tail(&sc->xn_rx_batch, m_new); + (void )mbufq_enqueue(&sc->xn_rx_batch, m_new); } /* @@ -973,7 +972,7 @@ xn_rxeof(struct netfront_info *np) RING_IDX i, rp; multicall_entry_t *mcl; struct mbuf *m; - struct mbuf_head rxq, errq; + struct mbufq rxq, errq; int err, pages_flipped = 0, work_to_do; do { @@ -981,8 +980,9 @@ xn_rxeof(struct netfront_info *np) if (!netfront_carrier_ok(np)) return; - mbufq_init(&errq); - mbufq_init(&rxq); + /* XXX: there should be some sane limit. */ + mbufq_init(&errq, INT_MAX); + mbufq_init(&rxq, INT_MAX); ifp = np->xn_ifp; @@ -1000,7 +1000,7 @@ xn_rxeof(struct netfront_info *np) if (__predict_false(err)) { if (m) - mbufq_tail(&errq, m); + (void )mbufq_enqueue(&errq, m); np->stats.rx_errors++; continue; } @@ -1022,7 +1022,7 @@ xn_rxeof(struct netfront_info *np) np->stats.rx_packets++; np->stats.rx_bytes += m->m_pkthdr.len; - mbufq_tail(&rxq, m); + (void )mbufq_enqueue(&rxq, m); np->rx.rsp_cons = i; } @@ -1046,8 +1046,7 @@ xn_rxeof(struct netfront_info *np) } } - while ((m = mbufq_dequeue(&errq))) - m_freem(m); + mbufq_drain(&errq); /* * Process all the mbufs after the remapping is complete. diff --git a/sys/i386/i386/ptrace_machdep.c b/sys/i386/i386/ptrace_machdep.c index 5cfeb4c299c7..e6248a2a605e 100644 --- a/sys/i386/i386/ptrace_machdep.c +++ b/sys/i386/i386/ptrace_machdep.c @@ -92,7 +92,8 @@ cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data) break; case PT_SETXSTATE: - if (data > cpu_max_ext_state_size) { + if (data < sizeof(union savefpu) || + data > cpu_max_ext_state_size) { error = EINVAL; break; } diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index 319414c70699..15bae04fb88e 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -121,10 +121,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) NDFREE(&nd, NDF_ONLY_PNBUF); /* Allocate memory for the FLF header. */ - if ((hdr = malloc(sizeof(*hdr), M_LINKER, M_WAITOK)) == NULL) { - error = ENOMEM; - goto out; - } + hdr = malloc(sizeof(*hdr), M_LINKER, M_WAITOK); /* Read the ELF header. */ if ((error = vn_rdwr(UIO_READ, nd.ni_vp, hdr, sizeof(*hdr), @@ -146,10 +143,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) } /* Allocate memory for all the section headers */ - if ((shdr = malloc(nbytes, M_LINKER, M_WAITOK)) == NULL) { - error = ENOMEM; - goto out; - } + shdr = malloc(nbytes, M_LINKER, M_WAITOK); /* Read all the section headers */ if ((error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)shdr, nbytes, @@ -171,11 +165,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) } /* Allocate memory to buffer the section header strings. */ - if ((shstrtab = malloc(shdr[hdr->e_shstrndx].sh_size, M_LINKER, - M_WAITOK)) == NULL) { - error = ENOMEM; - goto out; - } + shstrtab = malloc(shdr[hdr->e_shstrndx].sh_size, M_LINKER, M_WAITOK); /* Read the section header strings. */ if ((error = vn_rdwr(UIO_READ, nd.ni_vp, shstrtab, @@ -238,10 +228,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) * Allocate memory for the compressed CTF data, including * the header (which isn't compressed). */ - if ((raw = malloc(shdr[i].sh_size, M_LINKER, M_WAITOK)) == NULL) { - error = ENOMEM; - goto out; - } + raw = malloc(shdr[i].sh_size, M_LINKER, M_WAITOK); } else { /* * The CTF data is not compressed, so the ELF section @@ -254,10 +241,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) * Allocate memory to buffer the CTF data in it's decompressed * form. */ - if ((ctftab = malloc(sz, M_LINKER, M_WAITOK)) == NULL) { - error = ENOMEM; - goto out; - } + ctftab = malloc(sz, M_LINKER, M_WAITOK); /* * Read the CTF data into the raw buffer if compressed, or @@ -293,7 +277,9 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) zs.next_in = ((uint8_t *) raw) + sizeof(ctf_hdr); zs.avail_out = sz - sizeof(ctf_hdr); zs.next_out = ((uint8_t *) ctftab) + sizeof(ctf_hdr); - if ((ret = inflate(&zs, Z_FINISH)) != Z_STREAM_END) { + ret = inflate(&zs, Z_FINISH); + inflateEnd(&zs); + if (ret != Z_STREAM_END) { printf("%s(%d): zlib inflate returned %d\n", __func__, __LINE__, ret); error = EIO; goto out; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 31352e9737e6..42ca1efda41f 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -531,8 +531,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) break; case F_GETFL: - error = fget_unlocked(fdp, fd, - cap_rights_init(&rights, CAP_FCNTL), F_GETFL, &fp, NULL); + error = fget_fcntl(td, fd, + cap_rights_init(&rights, CAP_FCNTL), F_GETFL, &fp); if (error != 0) break; td->td_retval[0] = OFLAGS(fp->f_flag); @@ -540,8 +540,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) break; case F_SETFL: - error = fget_unlocked(fdp, fd, - cap_rights_init(&rights, CAP_FCNTL), F_SETFL, &fp, NULL); + error = fget_fcntl(td, fd, + cap_rights_init(&rights, CAP_FCNTL), F_SETFL, &fp); if (error != 0) break; do { @@ -568,8 +568,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) break; case F_GETOWN: - error = fget_unlocked(fdp, fd, - cap_rights_init(&rights, CAP_FCNTL), F_GETOWN, &fp, NULL); + error = fget_fcntl(td, fd, + cap_rights_init(&rights, CAP_FCNTL), F_GETOWN, &fp); if (error != 0) break; error = fo_ioctl(fp, FIOGETOWN, &tmp, td->td_ucred, td); @@ -579,8 +579,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) break; case F_SETOWN: - error = fget_unlocked(fdp, fd, - cap_rights_init(&rights, CAP_FCNTL), F_SETOWN, &fp, NULL); + error = fget_fcntl(td, fd, + cap_rights_init(&rights, CAP_FCNTL), F_SETOWN, &fp); if (error != 0) break; tmp = arg; @@ -602,7 +602,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) case F_SETLK: do_setlk: cap_rights_init(&rights, CAP_FLOCK); - error = fget_unlocked(fdp, fd, &rights, 0, &fp, NULL); + error = fget_unlocked(fdp, fd, &rights, &fp, NULL); if (error != 0) break; if (fp->f_type != DTYPE_VNODE) { @@ -691,7 +691,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) * that the closing thread was a bit slower and that the * advisory lock succeeded before the close. */ - error = fget_unlocked(fdp, fd, &rights, 0, &fp2, NULL); + error = fget_unlocked(fdp, fd, &rights, &fp2, NULL); if (error != 0) { fdrop(fp, td); break; @@ -710,7 +710,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) case F_GETLK: error = fget_unlocked(fdp, fd, - cap_rights_init(&rights, CAP_FLOCK), 0, &fp, NULL); + cap_rights_init(&rights, CAP_FLOCK), &fp, NULL); if (error != 0) break; if (fp->f_type != DTYPE_VNODE) { @@ -748,7 +748,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) arg = arg ? 128 * 1024: 0; /* FALLTHROUGH */ case F_READAHEAD: - error = fget_unlocked(fdp, fd, NULL, 0, &fp, NULL); + error = fget_unlocked(fdp, fd, NULL, &fp, NULL); if (error != 0) break; if (fp->f_type != DTYPE_VNODE) { @@ -2327,17 +2327,17 @@ finit(struct file *fp, u_int flag, short type, void *data, struct fileops *ops) int fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, - int needfcntl, struct file **fpp, cap_rights_t *haverightsp) + struct file **fpp, seq_t *seqp) { #ifdef CAPABILITIES - struct filedescent fde; + struct filedescent *fde; #endif struct fdescenttbl *fdt; struct file *fp; u_int count; #ifdef CAPABILITIES seq_t seq; - cap_rights_t *haverights; + cap_rights_t haverights; int error; #endif @@ -2355,28 +2355,23 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, for (;;) { #ifdef CAPABILITIES seq = seq_read(fd_seq(fdt, fd)); - fde = fdt->fdt_ofiles[fd]; + fde = &fdt->fdt_ofiles[fd]; + haverights = *cap_rights_fde(fde); + fp = fde->fde_file; if (!seq_consistent(fd_seq(fdt, fd), seq)) { cpu_spinwait(); continue; } - fp = fde.fde_file; #else fp = fdt->fdt_ofiles[fd].fde_file; #endif if (fp == NULL) return (EBADF); #ifdef CAPABILITIES - haverights = cap_rights_fde(&fde); if (needrightsp != NULL) { - error = cap_check(haverights, needrightsp); + error = cap_check(&haverights, needrightsp); if (error != 0) return (error); - if (cap_rights_is_set(needrightsp, CAP_FCNTL)) { - error = cap_fcntl_check_fde(&fde, needfcntl); - if (error != 0) - return (error); - } } #endif retry: @@ -2406,11 +2401,9 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, fdrop(fp, curthread); } *fpp = fp; - if (haverightsp != NULL) { + if (seqp != NULL) { #ifdef CAPABILITIES - *haverightsp = *haverights; -#else - CAP_ALL(haverightsp); + *seqp = seq; #endif } return (0); @@ -2431,11 +2424,11 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, */ static __inline int _fget(struct thread *td, int fd, struct file **fpp, int flags, - cap_rights_t *needrightsp, u_char *maxprotp) + cap_rights_t *needrightsp, seq_t *seqp) { struct filedesc *fdp; struct file *fp; - cap_rights_t haverights, needrights; + cap_rights_t needrights; int error; *fpp = NULL; @@ -2444,9 +2437,7 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, needrights = *needrightsp; else cap_rights_init(&needrights); - if (maxprotp != NULL) - cap_rights_set(&needrights, CAP_MMAP); - error = fget_unlocked(fdp, fd, &needrights, 0, &fp, &haverights); + error = fget_unlocked(fdp, fd, &needrights, &fp, seqp); if (error != 0) return (error); if (fp->f_ops == &badfileops) { @@ -2454,17 +2445,6 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, return (EBADF); } -#ifdef CAPABILITIES - /* - * If requested, convert capability rights to access flags. - */ - if (maxprotp != NULL) - *maxprotp = cap_rights_to_vmprot(&haverights); -#else /* !CAPABILITIES */ - if (maxprotp != NULL) - *maxprotp = VM_PROT_ALL; -#endif /* CAPABILITIES */ - /* * FREAD and FWRITE failure return EBADF as per POSIX. */ @@ -2506,8 +2486,31 @@ int fget_mmap(struct thread *td, int fd, cap_rights_t *rightsp, u_char *maxprotp, struct file **fpp) { + int error; +#ifndef CAPABILITIES + error = _fget(td, fd, fpp, 0, rightsp, NULL); + if (maxprotp != NULL) + *maxprotp = VM_PROT_ALL; +#else + struct filedesc *fdp = td->td_proc->p_fd; + seq_t seq; - return (_fget(td, fd, fpp, 0, rightsp, maxprotp)); + MPASS(cap_rights_is_set(rightsp, CAP_MMAP)); + for (;;) { + error = _fget(td, fd, fpp, 0, rightsp, &seq); + if (error != 0) + return (error); + /* + * If requested, convert capability rights to access flags. + */ + if (maxprotp != NULL) + *maxprotp = cap_rights_to_vmprot(cap_rights(fdp, fd)); + if (!fd_modified(fdp, fd, seq)) + break; + fdrop(*fpp, td); + } +#endif + return (error); } int @@ -2524,6 +2527,35 @@ fget_write(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp) return (_fget(td, fd, fpp, FWRITE, rightsp, NULL)); } +int +fget_fcntl(struct thread *td, int fd, cap_rights_t *rightsp, int needfcntl, + struct file **fpp) +{ + struct filedesc *fdp = td->td_proc->p_fd; +#ifndef CAPABILITIES + return (fget_unlocked(fdp, fd, rightsp, fpp, NULL)); +#else + int error; + seq_t seq; + + MPASS(cap_rights_is_set(rightsp, CAP_FCNTL)); + for (;;) { + error = fget_unlocked(fdp, fd, rightsp, fpp, &seq); + if (error != 0) + return (error); + error = cap_fcntl_check(fdp, fd, needfcntl); + if (!fd_modified(fdp, fd, seq)) + break; + fdrop(*fpp, td); + } + if (error != 0) { + fdrop(*fpp, td); + *fpp = NULL; + } + return (error); +#endif +} + /* * Like fget() but loads the underlying vnode, or returns an error if the * descriptor does not represent a vnode. Note that pipes use vnodes but diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 8dddc9b556f6..8fc1db945375 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1214,7 +1214,7 @@ getselfd_cap(struct filedesc *fdp, int fd, struct file **fpp) cap_rights_init(&rights, CAP_EVENT); - return (fget_unlocked(fdp, fd, &rights, 0, fpp, NULL)); + return (fget_unlocked(fdp, fd, &rights, fpp, NULL)); } /* diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index cbc465a80f48..64ba74da5ef5 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -358,9 +358,22 @@ kern_shmat(td, shmid, shmaddr, shmflg) if (shmmap_s == NULL) { shmmap_s = malloc(shminfo.shmseg * sizeof(struct shmmap_state), M_SHM, M_WAITOK); - for (i = 0; i < shminfo.shmseg; i++) - shmmap_s[i].shmid = -1; - p->p_vmspace->vm_shm = shmmap_s; + + /* + * If malloc() above sleeps, the Giant lock is + * temporarily dropped, which allows another thread to + * allocate shmmap_state and set vm_shm. Recheck + * vm_shm and free the new shmmap_state if another one + * is already allocated. + */ + if (p->p_vmspace->vm_shm != NULL) { + free(shmmap_s, M_SHM); + shmmap_s = p->p_vmspace->vm_shm; + } else { + for (i = 0; i < shminfo.shmseg; i++) + shmmap_s[i].shmid = -1; + p->p_vmspace->vm_shm = shmmap_s; + } } shmseg = shm_find_segment_by_shmid(shmid); if (shmseg == NULL) { @@ -826,8 +839,6 @@ shmrealloc(void) return; newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); - if (newsegs == NULL) - return; for (i = 0; i < shmalloced; i++) bcopy(&shmsegs[i], &newsegs[i], sizeof(newsegs[0])); for (; i < shminfo.shmmni; i++) { diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 373fcc31cae3..d9d0ccea288a 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1897,7 +1897,7 @@ ttyhook_register(struct tty **rtp, struct proc *p, int fd, /* Validate the file descriptor. */ fdp = p->p_fd; error = fget_unlocked(fdp, fd, cap_rights_init(&rights, CAP_TTYHOOK), - 0, &fp, NULL); + &fp, NULL); if (error != 0) return (error); if (fp->f_ops == &badfileops) { diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index bab8f50a25ee..a1a79152f657 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -112,11 +112,11 @@ CTASSERT(offsetof(struct mbuf, m_pktdat) % 8 == 0); #if defined(__LP64__) CTASSERT(offsetof(struct mbuf, m_dat) == 32); CTASSERT(sizeof(struct pkthdr) == 56); -CTASSERT(sizeof(struct struct_m_ext) == 48); +CTASSERT(sizeof(struct m_ext) == 48); #else CTASSERT(offsetof(struct mbuf, m_dat) == 24); CTASSERT(sizeof(struct pkthdr) == 48); -CTASSERT(sizeof(struct struct_m_ext) == 28); +CTASSERT(sizeof(struct m_ext) == 28); #endif /* diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index b0d849d93c80..83a7b991c836 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -156,7 +156,7 @@ getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, struct file *fp; int error; - error = fget_unlocked(fdp, fd, rightsp, 0, &fp, NULL); + error = fget_unlocked(fdp, fd, rightsp, &fp, NULL); if (error != 0) return (error); if (fp->f_type != DTYPE_SOCKET) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0f248199d0d4..14be379f274c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -4217,7 +4217,7 @@ getvnode(struct filedesc *fdp, int fd, cap_rights_t *rightsp, struct file **fpp) struct file *fp; int error; - error = fget_unlocked(fdp, fd, rightsp, 0, &fp, NULL); + error = fget_unlocked(fdp, fd, rightsp, &fp, NULL); if (error != 0) return (error); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7f917d6e5c6a..f4348b88098f 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -751,4 +751,8 @@ afterinstall: fi .endif +.include "${SYSDIR}/conf/config.mk" + +SUBDIR:= ${SUBDIR:u:O} + .include diff --git a/sys/modules/dpt/Makefile b/sys/modules/dpt/Makefile index 21b3b08ea397..ee588adb829f 100644 --- a/sys/modules/dpt/Makefile +++ b/sys/modules/dpt/Makefile @@ -11,24 +11,6 @@ SRCS= dpt_scsi.c dpt.h \ opt_cam.h opt_scsi.h \ device_if.h bus_if.h -.if ${MK_EISA} == "no" -# Create an empty opt_eisa.h in order to keep kmod.mk from linking in an -# existing one from KERNBUILDDIR which possibly has DEV_EISA defined so -# dpt.ko is always built without EISA support. -opt_eisa.h: - :> ${.TARGET} -.else -.if !defined(KERNBUILDDIR) -SRCS+= dpt_eisa.c eisa_if.h - -opt_eisa.h: - echo "#define DEV_EISA 1" > ${.TARGET} -.else -DEV_EISA!= sed -n '/DEV_EISA/p' ${KERNBUILDDIR}/opt_eisa.h -.if !empty(DEV_EISA) -SRCS+= dpt_eisa.c eisa_if.h -.endif -.endif -.endif +SRCS.DEV_EISA= dpt_eisa.c eisa_if.h .include diff --git a/sys/modules/ed/Makefile b/sys/modules/ed/Makefile index 723df349904a..427b99f973cd 100644 --- a/sys/modules/ed/Makefile +++ b/sys/modules/ed/Makefile @@ -8,10 +8,13 @@ SRCS+= if_ed_novell.c if_ed_wd80x3.c if_ed_rtl80x9.c isa_if.h .if ${MACHINE} == "pc98" SRCS+= if_ed_cbus.c .else -SRCS+= if_ed_isa.c if_ed_3c503.c if_ed_hpp.c if_ed_sic.c +SRCS+= if_ed_isa.c +SRCS.ED_HPP=if_ed_hpp.c +SRCS.ED_SIC=if_ed_sic.c +SRCS.ED_3C503=if_ed_3c503.c .endif SRCS+= if_ed_pccard.c pccarddevs.h card_if.h -SRCS+= if_ed_pci.c pci_if.h +SRCS.DEV_PCI=if_ed_pci.c pci_if.h SRCS+= opt_ed.h bus_if.h device_if.h miibus_if.h diff --git a/sys/modules/ep/Makefile b/sys/modules/ep/Makefile index 9f1dbee23a6d..df117abe8b9d 100644 --- a/sys/modules/ep/Makefile +++ b/sys/modules/ep/Makefile @@ -9,10 +9,7 @@ KMOD= if_ep SRCS= if_ep.c SRCS+= if_ep_pccard.c pccarddevs.h card_if.h SRCS+= if_ep_isa.c isa_if.h -.if ${MK_EISA} != "no" -SRCS+= if_ep_eisa.c eisa_if.h -.endif -#SRCS+= if_ep_mca.c +SRCS.DEV_EISA= if_ep_eisa.c eisa_if.h SRCS+= bus_if.h device_if.h .include diff --git a/sys/modules/if_gif/Makefile b/sys/modules/if_gif/Makefile index 3b3a172db753..4767ea65c353 100644 --- a/sys/modules/if_gif/Makefile +++ b/sys/modules/if_gif/Makefile @@ -7,13 +7,7 @@ SYSDIR?=${.CURDIR}/../.. KMOD= if_gif SRCS= if_gif.c opt_inet.h opt_inet6.h - -.if ${MK_INET_SUPPORT} != "no" -SRCS+= in_gif.c -.endif - -.if ${MK_INET6_SUPPORT} != "no" -SRCS+= in6_gif.c -.endif +SRCS.INET=in_gif.c +SRCS.INET6=in6_gif.c .include diff --git a/sys/modules/if_gre/Makefile b/sys/modules/if_gre/Makefile index b1d370a47ced..bb8ed0583fc4 100644 --- a/sys/modules/if_gre/Makefile +++ b/sys/modules/if_gre/Makefile @@ -6,13 +6,7 @@ SYSDIR?=${.CURDIR}/../.. KMOD= if_gre SRCS= if_gre.c opt_inet.h opt_inet6.h - -.if ${MK_INET_SUPPORT} != "no" -SRCS+= ip_gre.c -.endif - -.if ${MK_INET6_SUPPORT} != "no" -SRCS+= ip6_gre.c -.endif +SRCS.INET= ip_gre.c +SRCS.INET6= ip6_gre.c .include diff --git a/sys/modules/si/Makefile b/sys/modules/si/Makefile index df5361f26e8e..d2d436fdd569 100644 --- a/sys/modules/si/Makefile +++ b/sys/modules/si/Makefile @@ -3,8 +3,9 @@ .PATH: ${.CURDIR}/../../dev/si KMOD= si -SRCS= si.c si2_z280.c si3_t225.c si_eisa.c si_isa.c si_pci.c -SRCS+= bus_if.h device_if.h eisa_if.h isa_if.h pci_if.h +SRCS= si.c si2_z280.c si3_t225.c si_isa.c si_pci.c +SRCS+= bus_if.h device_if.h isa_if.h pci_if.h SRCS+= opt_compat.h opt_debug_si.h opt_eisa.h +SRCS.DEV_EISA=si_eisa.c eisa_if.h .include diff --git a/sys/modules/vx/Makefile b/sys/modules/vx/Makefile index 6012429fb023..2086dc8bf694 100644 --- a/sys/modules/vx/Makefile +++ b/sys/modules/vx/Makefile @@ -7,9 +7,7 @@ SYSDIR?=${.CURDIR}/../.. KMOD= if_vx SRCS= if_vx.c if_vx_pci.c -.if ${MK_EISA} != "no" -SRCS+= if_vx_eisa.c -.endif -SRCS+= device_if.h bus_if.h pci_if.h eisa_if.h +SRCS.DEV_EISA= if_vx_eisa.c eisa_if.h +SRCS+= device_if.h bus_if.h pci_if.h .include diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 4ed25a5f677f..40702920bee7 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); static struct igmp_ifinfo * igi_alloc_locked(struct ifnet *); static void igi_delete_locked(const struct ifnet *); -static void igmp_dispatch_queue(struct ifqueue *, int, const int); +static void igmp_dispatch_queue(struct mbufq *, int, const int); static void igmp_fasttimo_vnet(void); static void igmp_final_leave(struct in_multi *, struct igmp_ifinfo *); static int igmp_handle_state_change(struct in_multi *, @@ -122,15 +122,15 @@ static void igmp_v3_cancel_link_timers(struct igmp_ifinfo *); static void igmp_v3_dispatch_general_query(struct igmp_ifinfo *); static struct mbuf * igmp_v3_encap_report(struct ifnet *, struct mbuf *); -static int igmp_v3_enqueue_group_record(struct ifqueue *, +static int igmp_v3_enqueue_group_record(struct mbufq *, struct in_multi *, const int, const int, const int); -static int igmp_v3_enqueue_filter_change(struct ifqueue *, +static int igmp_v3_enqueue_filter_change(struct mbufq *, struct in_multi *); static void igmp_v3_process_group_timers(struct igmp_ifinfo *, - struct ifqueue *, struct ifqueue *, struct in_multi *, + struct mbufq *, struct mbufq *, struct in_multi *, const int); static int igmp_v3_merge_state_changes(struct in_multi *, - struct ifqueue *); + struct mbufq *); static void igmp_v3_suppress_group_record(struct in_multi *); static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS); static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS); @@ -475,15 +475,12 @@ sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS) * VIMAGE: Assumes the vnet pointer has been set. */ static void -igmp_dispatch_queue(struct ifqueue *ifq, int limit, const int loop) +igmp_dispatch_queue(struct mbufq *mq, int limit, const int loop) { struct mbuf *m; - for (;;) { - _IF_DEQUEUE(ifq, m); - if (m == NULL) - break; - CTR3(KTR_IGMPV3, "%s: dispatch %p from %p", __func__, ifq, m); + while ((m = mbufq_dequeue(mq)) != NULL) { + CTR3(KTR_IGMPV3, "%s: dispatch %p from %p", __func__, mq, m); if (loop) m->m_flags |= M_IGMP_LOOP; netisr_dispatch(NETISR_IGMP, m); @@ -579,13 +576,8 @@ igi_alloc_locked(/*const*/ struct ifnet *ifp) igi->igi_qi = IGMP_QI_INIT; igi->igi_qri = IGMP_QRI_INIT; igi->igi_uri = IGMP_URI_INIT; - SLIST_INIT(&igi->igi_relinmhead); - - /* - * Responses to general queries are subject to bounds. - */ - IFQ_SET_MAXLEN(&igi->igi_gq, IGMP_MAX_RESPONSE_PACKETS); + mbufq_init(&igi->igi_gq, IGMP_MAX_RESPONSE_PACKETS); LIST_INSERT_HEAD(&V_igi_head, igi, igi_link); @@ -683,7 +675,7 @@ igi_delete_locked(const struct ifnet *ifp) /* * Free deferred General Query responses. */ - _IF_DRAIN(&igi->igi_gq); + mbufq_drain(&igi->igi_gq); LIST_REMOVE(igi, igi_link); @@ -1643,8 +1635,8 @@ igmp_fasttimo(void) static void igmp_fasttimo_vnet(void) { - struct ifqueue scq; /* State-change packets */ - struct ifqueue qrq; /* Query response packets */ + struct mbufq scq; /* State-change packets */ + struct mbufq qrq; /* Query response packets */ struct ifnet *ifp; struct igmp_ifinfo *igi; struct ifmultiaddr *ifma; @@ -1705,12 +1697,8 @@ igmp_fasttimo_vnet(void) loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; uri_fasthz = IGMP_RANDOM_DELAY(igi->igi_uri * PR_FASTHZ); - - memset(&qrq, 0, sizeof(struct ifqueue)); - IFQ_SET_MAXLEN(&qrq, IGMP_MAX_G_GS_PACKETS); - - memset(&scq, 0, sizeof(struct ifqueue)); - IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); + mbufq_init(&qrq, IGMP_MAX_G_GS_PACKETS); + mbufq_init(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); } IF_ADDR_RLOCK(ifp); @@ -1809,7 +1797,7 @@ igmp_v1v2_process_group_timer(struct in_multi *inm, const int version) */ static void igmp_v3_process_group_timers(struct igmp_ifinfo *igi, - struct ifqueue *qrq, struct ifqueue *scq, + struct mbufq *qrq, struct mbufq *scq, struct in_multi *inm, const int uri_fasthz) { int query_response_timer_expired; @@ -2071,7 +2059,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifinfo *igi) */ inm->inm_sctimer = 0; inm->inm_timer = 0; - _IF_DRAIN(&inm->inm_scq); + mbufq_drain(&inm->inm_scq); } IF_ADDR_RUNLOCK(ifp); SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { @@ -2344,7 +2332,7 @@ static int igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi) { struct ifnet *ifp; - struct ifqueue *ifq; + struct mbufq *mq; int error, retval, syncstates; CTR4(KTR_IGMPV3, "%s: initial join %s on ifp %p(%s)", @@ -2418,9 +2406,9 @@ igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi) * Don't kick the timers if there is nothing to do, * or if an error occurred. */ - ifq = &inm->inm_scq; - _IF_DRAIN(ifq); - retval = igmp_v3_enqueue_group_record(ifq, inm, 1, + mq = &inm->inm_scq; + mbufq_drain(mq); + retval = igmp_v3_enqueue_group_record(mq, inm, 1, 0, 0); CTR2(KTR_IGMPV3, "%s: enqueue record = %d", __func__, retval); @@ -2500,7 +2488,7 @@ igmp_handle_state_change(struct in_multi *inm, struct igmp_ifinfo *igi) return (0); } - _IF_DRAIN(&inm->inm_scq); + mbufq_drain(&inm->inm_scq); retval = igmp_v3_enqueue_group_record(&inm->inm_scq, inm, 1, 0, 0); CTR2(KTR_IGMPV3, "%s: enqueue record = %d", __func__, retval); @@ -2569,7 +2557,7 @@ igmp_final_leave(struct in_multi *inm, struct igmp_ifinfo *igi) * TO_IN {} to be sent on the next fast timeout, * giving us an opportunity to merge reports. */ - _IF_DRAIN(&inm->inm_scq); + mbufq_drain(&inm->inm_scq); inm->inm_timer = 0; if (igi->igi_flags & IGIF_LOOPBACK) { inm->inm_scrv = 1; @@ -2647,7 +2635,7 @@ igmp_final_leave(struct in_multi *inm, struct igmp_ifinfo *igi) * no record(s) were appended. */ static int -igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, +igmp_v3_enqueue_group_record(struct mbufq *mq, struct in_multi *inm, const int is_state_change, const int is_group_query, const int is_source_query) { @@ -2737,7 +2725,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, * Generate the filter list changes using a separate function. */ if (is_filter_list_change) - return (igmp_v3_enqueue_filter_change(ifq, inm)); + return (igmp_v3_enqueue_filter_change(mq, inm)); if (type == IGMP_DO_NOTHING) { CTR3(KTR_IGMPV3, "%s: nothing to do for %s/%s", @@ -2767,7 +2755,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, * Note: Group records for G/GSR query responses MUST be sent * in their own packet. */ - m0 = ifq->ifq_tail; + m0 = mbufq_last(mq); if (!is_group_query && m0 != NULL && (m0->m_pkthdr.PH_vt.vt_nrecs + 1 <= IGMP_V3_REPORT_MAXRECS) && @@ -2778,7 +2766,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, m = m0; CTR1(KTR_IGMPV3, "%s: use existing packet", __func__); } else { - if (_IF_QFULL(ifq)) { + if (mbufq_full(mq)) { CTR1(KTR_IGMPV3, "%s: outbound queue full", __func__); return (-ENOMEM); } @@ -2891,7 +2879,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, if (m != m0) { CTR1(KTR_IGMPV3, "%s: enqueueing first packet", __func__); m->m_pkthdr.PH_vt.vt_nrecs = 1; - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); } else m->m_pkthdr.PH_vt.vt_nrecs++; @@ -2907,7 +2895,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, * Always try for a cluster first. */ while (nims != NULL) { - if (_IF_QFULL(ifq)) { + if (mbufq_full(mq)) { CTR1(KTR_IGMPV3, "%s: outbound queue full", __func__); return (-ENOMEM); } @@ -2970,7 +2958,7 @@ igmp_v3_enqueue_group_record(struct ifqueue *ifq, struct in_multi *inm, nbytes += (msrcs * sizeof(in_addr_t)); CTR1(KTR_IGMPV3, "%s: enqueueing next packet", __func__); - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); } return (nbytes); @@ -3010,7 +2998,7 @@ typedef enum { * no record(s) were appended. */ static int -igmp_v3_enqueue_filter_change(struct ifqueue *ifq, struct in_multi *inm) +igmp_v3_enqueue_filter_change(struct mbufq *mq, struct in_multi *inm) { static const int MINRECLEN = sizeof(struct igmp_grouprec) + sizeof(in_addr_t); @@ -3054,7 +3042,7 @@ igmp_v3_enqueue_filter_change(struct ifqueue *ifq, struct in_multi *inm) */ while (drt != REC_FULL) { do { - m0 = ifq->ifq_tail; + m0 = mbufq_last(mq); if (m0 != NULL && (m0->m_pkthdr.PH_vt.vt_nrecs + 1 <= IGMP_V3_REPORT_MAXRECS) && @@ -3201,7 +3189,7 @@ igmp_v3_enqueue_filter_change(struct ifqueue *ifq, struct in_multi *inm) */ m->m_pkthdr.PH_vt.vt_nrecs++; if (m != m0) - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); nbytes += npbytes; } while (nims != NULL); drt |= crt; @@ -3215,9 +3203,9 @@ igmp_v3_enqueue_filter_change(struct ifqueue *ifq, struct in_multi *inm) } static int -igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) +igmp_v3_merge_state_changes(struct in_multi *inm, struct mbufq *scq) { - struct ifqueue *gq; + struct mbufq *gq; struct mbuf *m; /* pending state-change */ struct mbuf *m0; /* copy of pending state-change */ struct mbuf *mt; /* last state-change in packet */ @@ -3240,13 +3228,13 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) gq = &inm->inm_scq; #ifdef KTR - if (gq->ifq_head == NULL) { + if (mbufq_first(gq) == NULL) { CTR2(KTR_IGMPV3, "%s: WARNING: queue for inm %p is empty", __func__, inm); } #endif - m = gq->ifq_head; + m = mbufq_first(gq); while (m != NULL) { /* * Only merge the report into the current packet if @@ -3257,7 +3245,7 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) * allocated clusters. */ domerge = 0; - mt = ifscq->ifq_tail; + mt = mbufq_last(scq); if (mt != NULL) { recslen = m_length(m, NULL); @@ -3269,7 +3257,7 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) domerge = 1; } - if (!domerge && _IF_QFULL(gq)) { + if (!domerge && mbufq_full(gq)) { CTR2(KTR_IGMPV3, "%s: outbound queue full, skipping whole packet %p", __func__, m); @@ -3282,7 +3270,7 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) if (!docopy) { CTR2(KTR_IGMPV3, "%s: dequeueing %p", __func__, m); - _IF_DEQUEUE(gq, m0); + m0 = mbufq_dequeue(gq); m = m0->m_nextpkt; } else { CTR2(KTR_IGMPV3, "%s: copying %p", __func__, m); @@ -3294,13 +3282,13 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq) } if (!domerge) { - CTR3(KTR_IGMPV3, "%s: queueing %p to ifscq %p)", - __func__, m0, ifscq); - _IF_ENQUEUE(ifscq, m0); + CTR3(KTR_IGMPV3, "%s: queueing %p to scq %p)", + __func__, m0, scq); + mbufq_enqueue(scq, m0); } else { struct mbuf *mtl; /* last mbuf of packet mt */ - CTR3(KTR_IGMPV3, "%s: merging %p with ifscq tail %p)", + CTR3(KTR_IGMPV3, "%s: merging %p with scq tail %p)", __func__, m0, mt); mtl = m_last(mt); @@ -3374,7 +3362,7 @@ igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi) /* * Slew transmission of bursts over 500ms intervals. */ - if (igi->igi_gq.ifq_head != NULL) { + if (mbufq_first(&igi->igi_gq) != NULL) { igi->igi_v3_timer = 1 + IGMP_RANDOM_DELAY( IGMP_RESPONSE_BURST_INTERVAL); V_interface_timers_running = 1; diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index c377e4905be1..93557f8f335b 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -523,12 +523,7 @@ in_getmulti(struct ifnet *ifp, const struct in_addr *group, inm->inm_ifma = ifma; inm->inm_refcount = 1; inm->inm_state = IGMP_NOT_MEMBER; - - /* - * Pending state-changes per group are subject to a bounds check. - */ - IFQ_SET_MAXLEN(&inm->inm_scq, IGMP_MAX_STATE_CHANGES); - + mbufq_init(&inm->inm_scq, IGMP_MAX_STATE_CHANGES); inm->inm_st[0].iss_fmode = MCAST_UNDEFINED; inm->inm_st[1].iss_fmode = MCAST_UNDEFINED; RB_INIT(&inm->inm_srcs); @@ -2983,7 +2978,7 @@ inm_print(const struct in_multi *inm) inm->inm_timer, inm_state_str(inm->inm_state), inm->inm_refcount, - inm->inm_scq.ifq_len); + inm->inm_scq.mq_len); printf("igi %p nsrc %lu sctimer %u scrv %u\n", inm->inm_igi, inm->inm_nsrc, diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index 16edeb142a75..ad0482e7318e 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -173,7 +173,6 @@ do { \ ifa_ref(&(ia)->ia_ifa); \ IN_IFADDR_RUNLOCK(); \ } while (0) -#endif /* * IP datagram reassembly. @@ -210,7 +209,7 @@ struct igmp_ifinfo { uint32_t igi_qri; /* IGMPv3 Query Response Interval (s) */ uint32_t igi_uri; /* IGMPv3 Unsolicited Report Interval (s) */ SLIST_HEAD(,in_multi) igi_relinmhead; /* released groups */ - struct ifqueue igi_gq; /* queue of general query responses */ + struct mbufq igi_gq; /* queue of general query responses */ }; #define IGIF_SILENT 0x00000001 /* Do not use IGMP on this ifp */ @@ -299,7 +298,7 @@ struct in_multi { struct ip_msource_tree inm_srcs; /* tree of sources */ u_long inm_nsrc; /* # of tree entries */ - struct ifqueue inm_scq; /* queue of pending + struct mbufq inm_scq; /* queue of pending * state-change packets */ struct timeval inm_lastgsrtv; /* Time of last G-S-R query */ uint16_t inm_sctimer; /* state-change timer */ @@ -343,8 +342,6 @@ ims_get_mode(const struct in_multi *inm, const struct ip_msource *ims, return (MCAST_UNDEFINED); } -#ifdef _KERNEL - #ifdef SYSCTL_DECL SYSCTL_DECL(_net_inet); SYSCTL_DECL(_net_inet_ip); @@ -425,12 +422,6 @@ void in_rtredirect(struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct sockaddr *, u_int); int in_rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); - -#if 0 -int in_rt_getifa(struct rt_addrinfo *, u_int fibnum); -int in_rtioctl(u_long, caddr_t, u_int); -int in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int); -#endif #endif /* _KERNEL */ /* INET6 stuff */ diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index dbdbbd8a2544..d872b8767a5a 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -479,7 +479,7 @@ in6_mc_get(struct ifnet *ifp, const struct in6_addr *group, inm->in6m_ifma = ifma; inm->in6m_refcount = 1; inm->in6m_state = MLD_NOT_MEMBER; - IFQ_SET_MAXLEN(&inm->in6m_scq, MLD_MAX_STATE_CHANGES); + mbufq_init(&inm->in6m_scq, MLD_MAX_STATE_CHANGES); inm->in6m_st[0].iss_fmode = MCAST_UNDEFINED; inm->in6m_st[1].iss_fmode = MCAST_UNDEFINED; @@ -1074,7 +1074,7 @@ in6m_purge(struct in6_multi *inm) inm->in6m_nsrc--; } /* Free state-change requests that might be queued. */ - _IF_DRAIN(&inm->in6m_scq); + mbufq_drain(&inm->in6m_scq); } /* @@ -2804,7 +2804,7 @@ in6m_print(const struct in6_multi *inm) inm->in6m_timer, in6m_state_str(inm->in6m_state), inm->in6m_refcount, - inm->in6m_scq.ifq_len); + mbufq_len(&inm->in6m_scq)); printf("mli %p nsrc %lu sctimer %u scrv %u\n", inm->in6m_mli, inm->in6m_nsrc, diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 1902487f4c21..51aa4668d83e 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -596,7 +596,6 @@ ip6_msource_cmp(const struct ip6_msource *a, const struct ip6_msource *b) return (memcmp(&a->im6s_addr, &b->im6s_addr, sizeof(struct in6_addr))); } RB_PROTOTYPE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp); -#endif /* _KERNEL */ /* * IPv6 multicast PCB-layer group filter descriptor. @@ -652,7 +651,7 @@ struct in6_multi { struct ip6_msource_tree in6m_srcs; /* tree of sources */ u_long in6m_nsrc; /* # of tree entries */ - struct ifqueue in6m_scq; /* queue of pending + struct mbufq in6m_scq; /* queue of pending * state-change packets */ struct timeval in6m_lastgsrtv; /* last G-S-R query */ uint16_t in6m_sctimer; /* state-change timer */ @@ -696,8 +695,6 @@ im6s_get_mode(const struct in6_multi *inm, const struct ip6_msource *ims, return (MCAST_UNDEFINED); } -#ifdef _KERNEL - /* * Lock macros for IPv6 layer multicast address lists. IPv6 lock goes * before link layer multicast locks in the lock order. In most cases, diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index d992d57de207..79e68c9fca04 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -106,7 +106,7 @@ static struct mld_ifinfo * mli_alloc_locked(struct ifnet *); static void mli_delete_locked(const struct ifnet *); static void mld_dispatch_packet(struct mbuf *); -static void mld_dispatch_queue(struct ifqueue *, int); +static void mld_dispatch_queue(struct mbufq *, int); static void mld_final_leave(struct in6_multi *, struct mld_ifinfo *); static void mld_fasttimo_vnet(void); static int mld_handle_state_change(struct in6_multi *, @@ -131,17 +131,17 @@ static void mld_v2_cancel_link_timers(struct mld_ifinfo *); static void mld_v2_dispatch_general_query(struct mld_ifinfo *); static struct mbuf * mld_v2_encap_report(struct ifnet *, struct mbuf *); -static int mld_v2_enqueue_filter_change(struct ifqueue *, +static int mld_v2_enqueue_filter_change(struct mbufq *, struct in6_multi *); -static int mld_v2_enqueue_group_record(struct ifqueue *, +static int mld_v2_enqueue_group_record(struct mbufq *, struct in6_multi *, const int, const int, const int, const int); static int mld_v2_input_query(struct ifnet *, const struct ip6_hdr *, struct mbuf *, const int, const int); static int mld_v2_merge_state_changes(struct in6_multi *, - struct ifqueue *); + struct mbufq *); static void mld_v2_process_group_timers(struct mld_ifinfo *, - struct ifqueue *, struct ifqueue *, + struct mbufq *, struct mbufq *, struct in6_multi *, const int); static int mld_v2_process_group_query(struct in6_multi *, struct mld_ifinfo *mli, int, struct mbuf *, const int); @@ -406,15 +406,12 @@ sysctl_mld_ifinfo(SYSCTL_HANDLER_ARGS) * VIMAGE: Assumes the vnet pointer has been set. */ static void -mld_dispatch_queue(struct ifqueue *ifq, int limit) +mld_dispatch_queue(struct mbufq *mq, int limit) { struct mbuf *m; - for (;;) { - _IF_DEQUEUE(ifq, m); - if (m == NULL) - break; - CTR3(KTR_MLD, "%s: dispatch %p from %p", __func__, ifq, m); + while ((m = mbufq_dequeue(mq)) != NULL) { + CTR3(KTR_MLD, "%s: dispatch %p from %p", __func__, mq, m); mld_dispatch_packet(m); if (--limit == 0) break; @@ -499,13 +496,8 @@ mli_alloc_locked(/*const*/ struct ifnet *ifp) mli->mli_qi = MLD_QI_INIT; mli->mli_qri = MLD_QRI_INIT; mli->mli_uri = MLD_URI_INIT; - SLIST_INIT(&mli->mli_relinmhead); - - /* - * Responses to general queries are subject to bounds. - */ - IFQ_SET_MAXLEN(&mli->mli_gq, MLD_MAX_RESPONSE_PACKETS); + mbufq_init(&mli->mli_gq, MLD_MAX_RESPONSE_PACKETS); LIST_INSERT_HEAD(&V_mli_head, mli, mli_link); @@ -598,7 +590,7 @@ mli_delete_locked(const struct ifnet *ifp) /* * Free deferred General Query responses. */ - _IF_DRAIN(&mli->mli_gq); + mbufq_drain(&mli->mli_gq); LIST_REMOVE(mli, mli_link); @@ -1326,8 +1318,8 @@ mld_fasttimo(void) static void mld_fasttimo_vnet(void) { - struct ifqueue scq; /* State-change packets */ - struct ifqueue qrq; /* Query response packets */ + struct mbufq scq; /* State-change packets */ + struct mbufq qrq; /* Query response packets */ struct ifnet *ifp; struct mld_ifinfo *mli; struct ifmultiaddr *ifma; @@ -1386,12 +1378,8 @@ mld_fasttimo_vnet(void) if (mli->mli_version == MLD_VERSION_2) { uri_fasthz = MLD_RANDOM_DELAY(mli->mli_uri * PR_FASTHZ); - - memset(&qrq, 0, sizeof(struct ifqueue)); - IFQ_SET_MAXLEN(&qrq, MLD_MAX_G_GS_PACKETS); - - memset(&scq, 0, sizeof(struct ifqueue)); - IFQ_SET_MAXLEN(&scq, MLD_MAX_STATE_CHANGE_PACKETS); + mbufq_init(&qrq, MLD_MAX_G_GS_PACKETS); + mbufq_init(&scq, MLD_MAX_STATE_CHANGE_PACKETS); } IF_ADDR_RLOCK(ifp); @@ -1503,7 +1491,7 @@ mld_v1_process_group_timer(struct mld_ifinfo *mli, struct in6_multi *inm) */ static void mld_v2_process_group_timers(struct mld_ifinfo *mli, - struct ifqueue *qrq, struct ifqueue *scq, + struct mbufq *qrq, struct mbufq *scq, struct in6_multi *inm, const int uri_fasthz) { int query_response_timer_expired; @@ -1711,7 +1699,7 @@ mld_v2_cancel_link_timers(struct mld_ifinfo *mli) /* * Free any pending MLDv2 state-change records. */ - _IF_DRAIN(&inm->in6m_scq); + mbufq_drain(&inm->in6m_scq); break; } } @@ -1950,7 +1938,7 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifinfo *mli, const int delay) { struct ifnet *ifp; - struct ifqueue *ifq; + struct mbufq *mq; int error, retval, syncstates; int odelay; #ifdef KTR @@ -2037,9 +2025,9 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifinfo *mli, * Don't kick the timers if there is nothing to do, * or if an error occurred. */ - ifq = &inm->in6m_scq; - _IF_DRAIN(ifq); - retval = mld_v2_enqueue_group_record(ifq, inm, 1, + mq = &inm->in6m_scq; + mbufq_drain(mq); + retval = mld_v2_enqueue_group_record(mq, inm, 1, 0, 0, (mli->mli_flags & MLIF_USEALLOW)); CTR2(KTR_MLD, "%s: enqueue record = %d", __func__, retval); @@ -2131,7 +2119,7 @@ mld_handle_state_change(struct in6_multi *inm, struct mld_ifinfo *mli) return (0); } - _IF_DRAIN(&inm->in6m_scq); + mbufq_drain(&inm->in6m_scq); retval = mld_v2_enqueue_group_record(&inm->in6m_scq, inm, 1, 0, 0, (mli->mli_flags & MLIF_USEALLOW)); @@ -2204,7 +2192,7 @@ mld_final_leave(struct in6_multi *inm, struct mld_ifinfo *mli) * TO_IN {} to be sent on the next fast timeout, * giving us an opportunity to merge reports. */ - _IF_DRAIN(&inm->in6m_scq); + mbufq_drain(&inm->in6m_scq); inm->in6m_timer = 0; inm->in6m_scrv = mli->mli_rv; CTR4(KTR_MLD, "%s: Leaving %s/%s with %d " @@ -2280,7 +2268,7 @@ mld_final_leave(struct in6_multi *inm, struct mld_ifinfo *mli) * no record(s) were appended. */ static int -mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, +mld_v2_enqueue_group_record(struct mbufq *mq, struct in6_multi *inm, const int is_state_change, const int is_group_query, const int is_source_query, const int use_block_allow) { @@ -2395,7 +2383,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, * Generate the filter list changes using a separate function. */ if (is_filter_list_change) - return (mld_v2_enqueue_filter_change(ifq, inm)); + return (mld_v2_enqueue_filter_change(mq, inm)); if (type == MLD_DO_NOTHING) { CTR3(KTR_MLD, "%s: nothing to do for %s/%s", @@ -2426,7 +2414,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, * Note: Group records for G/GSR query responses MUST be sent * in their own packet. */ - m0 = ifq->ifq_tail; + m0 = mbufq_last(mq); if (!is_group_query && m0 != NULL && (m0->m_pkthdr.PH_vt.vt_nrecs + 1 <= MLD_V2_REPORT_MAXRECS) && @@ -2438,7 +2426,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, m = m0; CTR1(KTR_MLD, "%s: use existing packet", __func__); } else { - if (_IF_QFULL(ifq)) { + if (mbufq_full(mq)) { CTR1(KTR_MLD, "%s: outbound queue full", __func__); return (-ENOMEM); } @@ -2551,7 +2539,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, if (m != m0) { CTR1(KTR_MLD, "%s: enqueueing first packet", __func__); m->m_pkthdr.PH_vt.vt_nrecs = 1; - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); } else m->m_pkthdr.PH_vt.vt_nrecs++; @@ -2567,7 +2555,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, * Always try for a cluster first. */ while (nims != NULL) { - if (_IF_QFULL(ifq)) { + if (mbufq_full(mq)) { CTR1(KTR_MLD, "%s: outbound queue full", __func__); return (-ENOMEM); } @@ -2626,7 +2614,7 @@ mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm, nbytes += (msrcs * sizeof(struct in6_addr)); CTR1(KTR_MLD, "%s: enqueueing next packet", __func__); - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); } return (nbytes); @@ -2666,7 +2654,7 @@ typedef enum { * no record(s) were appended. */ static int -mld_v2_enqueue_filter_change(struct ifqueue *ifq, struct in6_multi *inm) +mld_v2_enqueue_filter_change(struct mbufq *mq, struct in6_multi *inm) { static const int MINRECLEN = sizeof(struct mldv2_record) + sizeof(struct in6_addr); @@ -2712,7 +2700,7 @@ mld_v2_enqueue_filter_change(struct ifqueue *ifq, struct in6_multi *inm) */ while (drt != REC_FULL) { do { - m0 = ifq->ifq_tail; + m0 = mbufq_last(mq); if (m0 != NULL && (m0->m_pkthdr.PH_vt.vt_nrecs + 1 <= MLD_V2_REPORT_MAXRECS) && @@ -2856,7 +2844,7 @@ mld_v2_enqueue_filter_change(struct ifqueue *ifq, struct in6_multi *inm) */ m->m_pkthdr.PH_vt.vt_nrecs++; if (m != m0) - _IF_ENQUEUE(ifq, m); + mbufq_enqueue(mq, m); nbytes += npbytes; } while (nims != NULL); drt |= crt; @@ -2870,9 +2858,9 @@ mld_v2_enqueue_filter_change(struct ifqueue *ifq, struct in6_multi *inm) } static int -mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) +mld_v2_merge_state_changes(struct in6_multi *inm, struct mbufq *scq) { - struct ifqueue *gq; + struct mbufq *gq; struct mbuf *m; /* pending state-change */ struct mbuf *m0; /* copy of pending state-change */ struct mbuf *mt; /* last state-change in packet */ @@ -2895,13 +2883,13 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) gq = &inm->in6m_scq; #ifdef KTR - if (gq->ifq_head == NULL) { + if (mbufq_first(gq) == NULL) { CTR2(KTR_MLD, "%s: WARNING: queue for inm %p is empty", __func__, inm); } #endif - m = gq->ifq_head; + m = mbufq_first(gq); while (m != NULL) { /* * Only merge the report into the current packet if @@ -2912,7 +2900,7 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) * allocated clusters. */ domerge = 0; - mt = ifscq->ifq_tail; + mt = mbufq_last(scq); if (mt != NULL) { recslen = m_length(m, NULL); @@ -2924,7 +2912,7 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) domerge = 1; } - if (!domerge && _IF_QFULL(gq)) { + if (!domerge && mbufq_full(gq)) { CTR2(KTR_MLD, "%s: outbound queue full, skipping whole packet %p", __func__, m); @@ -2937,7 +2925,7 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) if (!docopy) { CTR2(KTR_MLD, "%s: dequeueing %p", __func__, m); - _IF_DEQUEUE(gq, m0); + m0 = mbufq_dequeue(gq); m = m0->m_nextpkt; } else { CTR2(KTR_MLD, "%s: copying %p", __func__, m); @@ -2949,9 +2937,9 @@ mld_v2_merge_state_changes(struct in6_multi *inm, struct ifqueue *ifscq) } if (!domerge) { - CTR3(KTR_MLD, "%s: queueing %p to ifscq %p)", - __func__, m0, ifscq); - _IF_ENQUEUE(ifscq, m0); + CTR3(KTR_MLD, "%s: queueing %p to scq %p)", + __func__, m0, scq); + mbufq_enqueue(scq, m0); } else { struct mbuf *mtl; /* last mbuf of packet mt */ @@ -3028,7 +3016,7 @@ mld_v2_dispatch_general_query(struct mld_ifinfo *mli) /* * Slew transmission of bursts over 500ms intervals. */ - if (mli->mli_gq.ifq_head != NULL) { + if (mbufq_first(&mli->mli_gq) != NULL) { mli->mli_v2_timer = 1 + MLD_RANDOM_DELAY( MLD_RESPONSE_BURST_INTERVAL); V_interface_timers_running6 = 1; diff --git a/sys/netinet6/mld6_var.h b/sys/netinet6/mld6_var.h index e62ec236ce5d..a4e001ce7014 100644 --- a/sys/netinet6/mld6_var.h +++ b/sys/netinet6/mld6_var.h @@ -52,7 +52,7 @@ struct mld_ifinfo { uint32_t mli_qri; /* MLDv2 Query Response Interval (s) */ uint32_t mli_uri; /* MLDv2 Unsolicited Report Interval (s) */ SLIST_HEAD(,in6_multi) mli_relinmhead; /* released groups */ - struct ifqueue mli_gq; /* queue of general query responses */ + struct mbufq mli_gq; /* queue of general query responses */ }; #define MLIF_SILENT 0x00000001 /* Do not use MLD on this ifp */ #define MLIF_USEALLOW 0x00000002 /* Use ALLOW/BLOCK for joins/leaves */ diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index aed2a5506b38..1a9e0bf553cd 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -134,25 +134,23 @@ static int pf_frag_compare(struct pf_fragment *, static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare); static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare); +static void pf_flush_fragments(void); static void pf_free_fragment(struct pf_fragment *); static void pf_remove_fragment(struct pf_fragment *); static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *, struct tcphdr *, int, sa_family_t); -struct pf_frent *pf_create_fragment(u_short *); -static struct pf_fragment * - pf_find_fragment(struct pf_fragment_cmp *key, +static struct pf_frent *pf_create_fragment(u_short *); +static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree); -static struct pf_fragment * - pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, u_short *); +static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *, + struct pf_frent *, u_short *); static int pf_isfull_fragment(struct pf_fragment *); -struct mbuf *pf_join_fragment(struct pf_fragment *); +static struct mbuf *pf_join_fragment(struct pf_fragment *); #ifdef INET static void pf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t); -static void pf_flush_fragments(void); static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *); -static struct mbuf * - pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **, - int, int, int *); +static struct mbuf *pf_fragcache(struct mbuf **, struct ip*, + struct pf_fragment **, int, int, int *); #endif /* INET */ #ifdef INET6 static int pf_reassemble6(struct mbuf **, struct ip6_hdr *, @@ -267,7 +265,6 @@ pf_purge_expired_fragments(void) PF_FRAG_UNLOCK(); } -#ifdef INET /* * Try to flush old fragments to make space for new ones */ @@ -292,7 +289,6 @@ pf_flush_fragments(void) break; } } -#endif /* INET */ /* Frees the fragments and all associated entries */ static void @@ -329,7 +325,6 @@ pf_free_fragment(struct pf_fragment *frag) pf_remove_fragment(frag); } -#ifdef INET static struct pf_fragment * pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree) { @@ -352,10 +347,8 @@ pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree) return (frag); } -#endif /* INET */ /* Removes a fragment from the fragment queue and frees the fragment */ - static void pf_remove_fragment(struct pf_fragment *frag) { @@ -373,7 +366,7 @@ pf_remove_fragment(struct pf_fragment *frag) } } -struct pf_frent * +static struct pf_frent * pf_create_fragment(u_short *reason) { struct pf_frent *frent; @@ -570,7 +563,7 @@ pf_isfull_fragment(struct pf_fragment *frag) return (1); } -struct mbuf * +static struct mbuf * pf_join_fragment(struct pf_fragment *frag) { struct mbuf *m, *m2; @@ -666,6 +659,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) DPFPRINTF(("complete: %p(%d)\n", m, ntohs(ip->ip_len))); return (PF_PASS); } +#endif /* INET */ #ifdef INET6 static int @@ -789,6 +783,7 @@ pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, } #endif /* INET6 */ +#ifdef INET static struct mbuf * pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff, int drop, int *nomem) @@ -1090,6 +1085,7 @@ pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff, m_freem(m); return (NULL); } +#endif /* INET */ #ifdef INET6 int @@ -1162,6 +1158,7 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag) } #endif /* INET6 */ +#ifdef INET int pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, struct pf_pdesc *pd) diff --git a/sys/ofed/drivers/infiniband/core/cma.c b/sys/ofed/drivers/infiniband/core/cma.c index d2064b69a6d8..f1d26cc41f6e 100644 --- a/sys/ofed/drivers/infiniband/core/cma.c +++ b/sys/ofed/drivers/infiniband/core/cma.c @@ -2558,8 +2558,10 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr) { struct rdma_id_private *id_priv; int ret; +#if defined(INET6) int ipv6only; size_t var_size = sizeof(int); +#endif if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6) return -EAFNOSUPPORT; @@ -3222,10 +3224,13 @@ static void cma_set_mgid(struct rdma_id_private *id_priv, unsigned char mc_map[MAX_ADDR_LEN]; struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; struct sockaddr_in *sin = (struct sockaddr_in *) addr; +#if defined(INET6) struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) addr; +#endif if (cma_any_addr(addr)) { memset(mgid, 0, sizeof *mgid); +#if defined(INET6) } else if ((addr->sa_family == AF_INET6) && ((be32_to_cpu(sin6->sin6_addr.s6_addr32[0]) & 0xFFF0FFFF) == 0xFF10A01B)) { @@ -3236,6 +3241,7 @@ static void cma_set_mgid(struct rdma_id_private *id_priv, if (id_priv->id.ps == RDMA_PS_UDP) mc_map[7] = 0x01; /* Use RDMA CM signature */ *mgid = *(union ib_gid *) (mc_map + 4); +#endif } else { ip_ib_mc_map(sin->sin_addr.s_addr, dev_addr->broadcast, mc_map); if (id_priv->id.ps == RDMA_PS_UDP) diff --git a/sys/ofed/include/linux/file.h b/sys/ofed/include/linux/file.h index b76a40865152..22a035f8dd4a 100644 --- a/sys/ofed/include/linux/file.h +++ b/sys/ofed/include/linux/file.h @@ -48,7 +48,7 @@ linux_fget(unsigned int fd) { struct file *file; - if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, + if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, &file, NULL) != 0) { return (NULL); } @@ -73,7 +73,7 @@ put_unused_fd(unsigned int fd) { struct file *file; - if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, + if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, &file, NULL) != 0) { return; } @@ -93,7 +93,7 @@ fd_install(unsigned int fd, struct linux_file *filp) { struct file *file; - if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, + if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, &file, NULL) != 0) { file = NULL; } diff --git a/sys/ofed/include/net/ip.h b/sys/ofed/include/net/ip.h index 0566ad45eb10..587ceb8d40dc 100644 --- a/sys/ofed/include/net/ip.h +++ b/sys/ofed/include/net/ip.h @@ -42,13 +42,17 @@ #include #include -#ifdef INET static inline void inet_get_local_port_range(int *low, int *high) { +#ifdef INET CURVNET_SET_QUIET(TD_TO_VNET(curthread)); *low = V_ipport_firstauto; *high = V_ipport_lastauto; CURVNET_RESTORE(); +#else + *low = IPPORT_EPHEMERALFIRST; /* 10000 */ + *high = IPPORT_EPHEMERALLAST; /* 65535 */ +#endif } static inline void @@ -79,6 +83,5 @@ ip_ib_mc_map(uint32_t addr, const unsigned char *bcast, char *buf) buf[18] = (addr >> 8) & 0xff; buf[19] = addr & 0xff; } -#endif #endif /* _LINUX_NET_IP_H_ */ diff --git a/sys/powerpc/powermac/atibl.c b/sys/powerpc/powermac/atibl.c index 6a12e2fc0b8c..3982bdf828a1 100644 --- a/sys/powerpc/powermac/atibl.c +++ b/sys/powerpc/powermac/atibl.c @@ -38,6 +38,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#ifndef PCI_VENDOR_ID_ATI +#define PCI_VENDOR_ID_ATI 0x1002 +#endif /* From the xf86-video-ati driver's radeon_reg.h */ #define RADEON_LVDS_GEN_CNTL 0x02d0 @@ -121,7 +126,9 @@ atibl_probe(device_t dev) if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) return (ENXIO); - if (strcmp(control, "ati") != 0) + if (strcmp(control, "ati") != 0 && + (strcmp(control, "mnca") != 0 || + pci_get_vendor(device_get_parent(dev)) != 0x1002)) return (ENXIO); device_set_desc(dev, "PowerBook backlight for ATI graphics"); @@ -162,14 +169,13 @@ atibl_pll_rreg(struct atibl_softc *sc, uint32_t reg) { uint32_t data, save, tmp; - bus_write_1(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX, - ((reg & 0x3f) | RADEON_PLL_WR_EN)); + bus_write_1(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX, (reg & 0x3f)); (void)bus_read_4(sc->sc_memr, RADEON_CLOCK_CNTL_DATA); (void)bus_read_4(sc->sc_memr, RADEON_CRTC_GEN_CNTL); data = bus_read_4(sc->sc_memr, RADEON_CLOCK_CNTL_DATA); - /* Only necessary on R300, bt won't hurt others. */ + /* Only necessary on R300, but won't hurt others. */ save = bus_read_4(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX); tmp = save & (~0x3f | RADEON_PLL_WR_EN); bus_write_4(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp); @@ -192,7 +198,7 @@ atibl_pll_wreg(struct atibl_softc *sc, uint32_t reg, uint32_t val) bus_write_4(sc->sc_memr, RADEON_CLOCK_CNTL_DATA, val); DELAY(5000); - /* Only necessary on R300, bt won't hurt others. */ + /* Only necessary on R300, but won't hurt others. */ save = bus_read_4(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX); tmp = save & (~0x3f | RADEON_PLL_WR_EN); bus_write_4(sc->sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp); diff --git a/sys/powerpc/powermac/nvbl.c b/sys/powerpc/powermac/nvbl.c index 12cc032fa5bf..fc7a3a9fb89f 100644 --- a/sys/powerpc/powermac/nvbl.c +++ b/sys/powerpc/powermac/nvbl.c @@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#define PCI_VENDOR_ID_NVIDIA 0x10de #define NVIDIA_BRIGHT_MIN (0x0ec) #define NVIDIA_BRIGHT_MAX (0x538) @@ -102,7 +105,8 @@ nvbl_probe(device_t dev) if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) return (ENXIO); - if (strcmp(control, "mnca") != 0) + if ((strcmp(control, "mnca") != 0) || + pci_get_vendor(device_get_parent(dev)) != PCI_VENDOR_ID_NVIDIA) return (ENXIO); device_set_desc(dev, "PowerBook backlight for nVidia graphics"); diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h index c16091e1504e..f159e376bba1 100644 --- a/sys/sys/cpu.h +++ b/sys/sys/cpu.h @@ -37,6 +37,8 @@ #define CPU_IVAR_PCPU 1 #define CPU_IVAR_NOMINAL_MHZ 2 +#define CPU_IVAR_CPUID_SIZE 3 +#define CPU_IVAR_CPUID 4 static __inline struct pcpu *cpu_get_pcpu(device_t dev) { @@ -54,6 +56,20 @@ static __inline int32_t cpu_get_nominal_mhz(device_t dev) return ((int32_t)v); } +static __inline const uint32_t *cpu_get_cpuid(device_t dev, size_t *count) +{ + uintptr_t v = 0; + if (BUS_READ_IVAR(device_get_parent(dev), dev, + CPU_IVAR_CPUID_SIZE, &v) != 0) + return (NULL); + *count = (size_t)v; + + if (BUS_READ_IVAR(device_get_parent(dev), dev, + CPU_IVAR_CPUID, &v) != 0) + return (NULL); + return ((const uint32_t *)v); +} + /* * CPU frequency control interface. */ diff --git a/sys/sys/file.h b/sys/sys/file.h index d102a871ee39..153885123704 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -230,6 +230,8 @@ int fget_read(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp); int fget_write(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp); +int fget_fcntl(struct thread *td, int fd, cap_rights_t *rightsp, + int needfcntl, struct file **fpp); int _fdrop(struct file *fp, struct thread *td); fo_rdwr_t invfo_rdwr; diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 9cef6aa5a0d9..4eef17b77b4a 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -169,7 +169,7 @@ void mountcheckdirs(struct vnode *olddp, struct vnode *newdp); /* Return a referenced file from an unlocked descriptor. */ int fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, - int needfcntl, struct file **fpp, cap_rights_t *haverightsp); + struct file **fpp, seq_t *seqp); /* Requires a FILEDESC_{S,X}LOCK held and returns without a ref. */ static __inline struct file * @@ -184,6 +184,13 @@ fget_locked(struct filedesc *fdp, int fd) return (fdp->fd_ofiles[fd].fde_file); } +static __inline bool +fd_modified(struct filedesc *fdp, int fd, seq_t seq) +{ + + return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq)); +} + #endif /* _KERNEL */ #endif /* !_SYS_FILEDESC_H_ */ diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 4729320e1115..e07111473eb4 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -65,8 +65,8 @@ * they are sensible. */ struct mbuf; -#define MHSIZE offsetof(struct mbuf, M_dat.M_databuf) -#define MPKTHSIZE offsetof(struct mbuf, M_dat.MH.MH_dat.MH_databuf) +#define MHSIZE offsetof(struct mbuf, m_dat) +#define MPKTHSIZE offsetof(struct mbuf, m_pktdat) #define MLEN ((int)(MSIZE - MHSIZE)) #define MHLEN ((int)(MSIZE - MPKTHSIZE)) #define MINCLSIZE (MHLEN + 1) @@ -160,7 +160,7 @@ struct pkthdr { * Compile-time assertions in uipc_mbuf.c test these values to ensure that * they are correct. */ -struct struct_m_ext { +struct m_ext { volatile u_int *ext_cnt; /* pointer to ref count info */ caddr_t ext_buf; /* start of buffer */ uint32_t ext_size; /* size of buffer, for ext_free */ @@ -211,19 +211,15 @@ struct mbuf { */ union { struct { - struct pkthdr MH_pkthdr; /* M_PKTHDR set */ + struct pkthdr m_pkthdr; /* M_PKTHDR set */ union { - struct struct_m_ext MH_ext; /* M_EXT set */ - char MH_databuf[0]; - } MH_dat; - } MH; - char M_databuf[0]; /* !M_PKTHDR, !M_EXT */ - } M_dat; + struct m_ext m_ext; /* M_EXT set */ + char m_pktdat[0]; + }; + }; + char m_dat[0]; /* !M_PKTHDR, !M_EXT */ + }; }; -#define m_pkthdr M_dat.MH.MH_pkthdr -#define m_ext M_dat.MH.MH_dat.MH_ext -#define m_pktdat M_dat.MH.MH_dat.MH_databuf -#define m_dat M_dat.M_databuf /* * mbuf flags of global significance and layer crossing. @@ -1194,8 +1190,6 @@ rt_m_getfib(struct mbuf *m) ((_m)->m_pkthdr.fibnum) = (_fib); \ } while (0) -#endif /* _KERNEL */ - #ifdef MBUF_PROFILING void m_profile(struct mbuf *m); #define M_PROFILE(m) m_profile(m) @@ -1203,5 +1197,102 @@ rt_m_getfib(struct mbuf *m) #define M_PROFILE(m) #endif +struct mbufq { + STAILQ_HEAD(, mbuf) mq_head; + int mq_len; + int mq_maxlen; +}; +static inline void +mbufq_init(struct mbufq *mq, int maxlen) +{ + + STAILQ_INIT(&mq->mq_head); + mq->mq_maxlen = maxlen; + mq->mq_len = 0; +} + +static inline struct mbuf * +mbufq_flush(struct mbufq *mq) +{ + struct mbuf *m; + + m = STAILQ_FIRST(&mq->mq_head); + STAILQ_INIT(&mq->mq_head); + mq->mq_len = 0; + return (m); +} + +static inline void +mbufq_drain(struct mbufq *mq) +{ + struct mbuf *m, *n; + + n = mbufq_flush(mq); + while ((m = n) != NULL) { + n = STAILQ_NEXT(m, m_stailqpkt); + m_freem(m); + } +} + +static inline struct mbuf * +mbufq_first(const struct mbufq *mq) +{ + + return (STAILQ_FIRST(&mq->mq_head)); +} + +static inline struct mbuf * +mbufq_last(const struct mbufq *mq) +{ + + return (STAILQ_LAST(&mq->mq_head, mbuf, m_stailqpkt)); +} + +static inline int +mbufq_full(const struct mbufq *mq) +{ + + return (mq->mq_len >= mq->mq_maxlen); +} + +static inline int +mbufq_len(const struct mbufq *mq) +{ + + return (mq->mq_len); +} + +static inline int +mbufq_enqueue(struct mbufq *mq, struct mbuf *m) +{ + + if (mbufq_full(mq)) + return (ENOBUFS); + STAILQ_INSERT_TAIL(&mq->mq_head, m, m_stailqpkt); + mq->mq_len++; + return (0); +} + +static inline struct mbuf * +mbufq_dequeue(struct mbufq *mq) +{ + struct mbuf *m; + + m = STAILQ_FIRST(&mq->mq_head); + if (m) { + STAILQ_REMOVE_HEAD(&mq->mq_head, m_stailqpkt); + mq->mq_len--; + } + return (m); +} + +static inline void +mbufq_prepend(struct mbufq *mq, struct mbuf *m) +{ + + STAILQ_INSERT_HEAD(&mq->mq_head, m, m_stailqpkt); + mq->mq_len++; +} +#endif /* _KERNEL */ #endif /* !_SYS_MBUF_H_ */ diff --git a/sys/sys/param.h b/sys/sys/param.h index c92ee7b168d1..00e0c5791f3b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100060 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100061 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index e65241938472..70c8d6bb3a07 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -55,8 +55,9 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SMP #include +#include +#ifdef SMP #include #include #endif diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c index 6194a127d73a..506c3f5b4338 100644 --- a/usr.bin/du/du.c +++ b/usr.bin/du/du.c @@ -376,7 +376,7 @@ linkchk(FTSENT *p) /* If the hash table is getting too full, enlarge it. */ if (number_entries > number_buckets * 10 && !stop_allocating) { new_size = number_buckets * 2; - new_buckets = malloc(new_size * sizeof(struct links_entry *)); + new_buckets = calloc(new_size, sizeof(struct links_entry *)); /* Try releasing the free list to see if that helps. */ if (new_buckets == NULL && free_list != NULL) { @@ -385,16 +385,13 @@ linkchk(FTSENT *p) free_list = le->next; free(le); } - new_buckets = malloc(new_size * - sizeof(new_buckets[0])); + new_buckets = calloc(new_size, sizeof(new_buckets[0])); } if (new_buckets == NULL) { stop_allocating = 1; warnx("No more memory for tracking hard links"); } else { - memset(new_buckets, 0, - new_size * sizeof(struct links_entry *)); for (i = 0; i < number_buckets; i++) { while (buckets[i] != NULL) { /* Remove entry from old bucket. */ diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c index c8d8e12355c9..4c0ddd056a64 100644 --- a/usr.bin/ministat/ministat.c +++ b/usr.bin/ministat/ministat.c @@ -329,10 +329,8 @@ PlotSet(struct dataset *ds, int val) else bar = 0; - if (pl->bar == NULL) { - pl->bar = malloc(sizeof(char *) * pl->num_datasets); - memset(pl->bar, 0, sizeof(char*) * pl->num_datasets); - } + if (pl->bar == NULL) + pl->bar = calloc(sizeof(char *), pl->num_datasets); if (pl->bar[bar] == NULL) { pl->bar[bar] = malloc(pl->width); memset(pl->bar[bar], 0, pl->width); diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index c22e49f62405..b4bd312b8078 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1093,47 +1093,6 @@ icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) } } -#ifndef BURN_BRIDGES -/* - * Dump IGMP statistics structure (pre 8.x kernel). - */ -static void -igmp_stats_live_old(const char *name) -{ - struct oigmpstat oigmpstat, zerostat; - size_t len = sizeof(oigmpstat); - - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.igmp.stats", &oigmpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - warn("sysctl: net.inet.igmp.stats"); - return; - } - - printf("%s:\n", name); - -#define p(f, m) if (oigmpstat.f || sflag <= 1) \ - printf(m, oigmpstat.f, plural(oigmpstat.f)) -#define py(f, m) if (oigmpstat.f || sflag <= 1) \ - printf(m, oigmpstat.f, oigmpstat.f != 1 ? "ies" : "y") - p(igps_rcv_total, "\t%u message%s received\n"); - p(igps_rcv_tooshort, "\t%u message%s received with too few bytes\n"); - p(igps_rcv_badsum, "\t%u message%s received with bad checksum\n"); - py(igps_rcv_queries, "\t%u membership quer%s received\n"); - py(igps_rcv_badqueries, - "\t%u membership quer%s received with invalid field(s)\n"); - p(igps_rcv_reports, "\t%u membership report%s received\n"); - p(igps_rcv_badreports, - "\t%u membership report%s received with invalid field(s)\n"); - p(igps_rcv_ourreports, -"\t%u membership report%s received for groups to which we belong\n"); - p(igps_snd_reports, "\t%u membership report%s sent\n"); -#undef p -#undef py -} -#endif /* !BURN_BRIDGES */ - /* * Dump IGMP statistics structure. */ @@ -1143,27 +1102,6 @@ igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) struct igmpstat igmpstat, zerostat; size_t len; -#ifndef BURN_BRIDGES - if (live) { - /* - * Detect if we are being run against a pre-IGMPv3 kernel. - * We cannot do this for a core file as the legacy - * struct igmpstat has no size field, nor does it - * export it in any readily-available symbols. - */ - len = 0; - if (sysctlbyname("net.inet.igmp.stats", NULL, &len, NULL, - 0) < 0) { - warn("sysctl: net.inet.igmp.stats"); - return; - } - if (len < sizeof(igmpstat)) { - igmp_stats_live_old(name); - return; - } - } -#endif /* !BURN_BRIDGES */ - len = sizeof(igmpstat); if (live) { if (zflag) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 30d843dfbd59..20b9fe017246 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -94,6 +94,8 @@ SUBDIR= adduser \ watchdogd \ zic +SUBDIR:= ${SUBDIR:Nifmcstat} + # NB: keep these sorted by MK_* knobs .if ${MK_ACCT} != "no" diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index 9df03bd7b154..d470a9bc8dfa 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -12,9 +12,9 @@ SRCS+= dbcmds.c dbconvert.c dbdisply.c dbexec.c dbfileio.c \ dbtest.c dbutils.c dbxface.c # components/disassembler -SRCS+= dmbuffer.c dmdeferred.c dmnames.c dmobject.c dmopcode.c \ - dmresrc.c dmresrcl.c dmresrcl2.c dmresrcs.c dmutils.c \ - dmwalk.c +SRCS+= dmbuffer.c dmcstyle.c dmdeferred.c dmnames.c dmobject.c \ + dmopcode.c dmresrc.c dmresrcl.c dmresrcl2.c dmresrcs.c \ + dmutils.c dmwalk.c # components/dispatcher SRCS+= dsargs.c dscontrol.c dsfield.c dsinit.c dsmethod.c \ diff --git a/usr.sbin/acpi/acpidb/acpidb.c b/usr.sbin/acpi/acpidb/acpidb.c index 3688cafd70cd..f49420f298d0 100644 --- a/usr.sbin/acpi/acpidb/acpidb.c +++ b/usr.sbin/acpi/acpidb/acpidb.c @@ -74,6 +74,7 @@ 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); @@ -98,6 +99,11 @@ AcpiOsGetRootPointer(void) return (0); } +void +AeDoObjectOverrides(void) +{ +} + void AeTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable) { diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile index 8f021a3d7e7a..7f6a1bde2b73 100644 --- a/usr.sbin/acpi/iasl/Makefile +++ b/usr.sbin/acpi/iasl/Makefile @@ -16,23 +16,24 @@ SRCS+= aslanalyze.c aslascii.c aslbtypes.c aslcodegen.c \ aslmapenter.c aslmapoutput.c aslmaputils.c \ aslmessages.c aslmethod.c aslnamesp.c asloffset.c \ aslopcodes.c asloperands.c aslopt.c asloptions.c \ - aslpredef.c aslprepkg.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 \ - dtcompile.c dtexpress.c dtfield.c dtio.c dtparser.y.h \ - dtparserlex.c dtparserparse.c dtsubtable.c dttable.c \ - dttemplate.c dtutils.c prexpress.c prmacros.c \ - prparser.y.h prparserlex.c prparserparse.c prscan.c \ - prutils.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 dtcompile.c \ + dtexpress.c dtfield.c dtio.c dtparser.y.h dtparserlex.c \ + dtparserparse.c dtsubtable.c dttable.c dttemplate.c \ + dtutils.c prexpress.c prmacros.c prparser.y.h \ + prparserlex.c prparserparse.c prscan.c prutils.c # components/debugger SRCS+= dbfileio.c # components/disassembler -SRCS+= dmbuffer.c dmdeferred.c dmnames.c dmopcode.c dmresrc.c \ - dmresrcl.c dmresrcl2.c dmresrcs.c dmutils.c dmwalk.c +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 dsfield.c dsobject.c dsopcode.c \ diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index d7c281c0fee7..bc054b8de45c 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -557,7 +557,8 @@ main(int argc, char *argv[]) if (finet) { if (SecureMode) { for (i = 0; i < *finet; i++) { - if (shutdown(finet[i+1], SHUT_RD) < 0) { + if (shutdown(finet[i+1], SHUT_RD) < 0 && + errno != ENOTCONN) { logerror("shutdown"); if (!Debug) die(0);