Date: Thu, 1 Jul 2004 14:16:35 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 56210 for review Message-ID: <200407011416.i61EGZls080472@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=56210 Change 56210 by peter@peter_work on 2004/07/01 14:15:42 IFC @56209 Affected files ... .. //depot/projects/hammer/sys/amd64/acpica/acpi_machdep.c#14 integrate .. //depot/projects/hammer/sys/amd64/amd64/nexus.c#25 integrate .. //depot/projects/hammer/sys/boot/common/newvers.sh#3 integrate .. //depot/projects/hammer/sys/conf/NOTES#50 integrate .. //depot/projects/hammer/sys/conf/files#68 integrate .. //depot/projects/hammer/sys/conf/files.amd64#48 integrate .. //depot/projects/hammer/sys/conf/files.i386#34 integrate .. //depot/projects/hammer/sys/conf/files.ia64#19 integrate .. //depot/projects/hammer/sys/conf/kmod.mk#31 integrate .. //depot/projects/hammer/sys/conf/newvers.sh#11 integrate .. //depot/projects/hammer/sys/conf/options#43 integrate .. //depot/projects/hammer/sys/contrib/ipfilter/netinet/fil.c#6 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi.c#40 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_acad.c#13 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_button.c#9 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_cmbat.c#13 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_ec.c#23 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_if.m#1 branch .. //depot/projects/hammer/sys/dev/acpica/acpi_isab.c#7 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_lid.c#9 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_pci.c#14 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_pcib.c#19 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_pcib_acpi.c#9 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_powerres.c#11 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_quirk.c#1 branch .. //depot/projects/hammer/sys/dev/acpica/acpi_quirks#2 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_resource.c#12 integrate .. //depot/projects/hammer/sys/dev/acpica/acpivar.h#30 integrate .. //depot/projects/hammer/sys/dev/amr/amr.c#11 integrate .. //depot/projects/hammer/sys/dev/amr/amrvar.h#10 integrate .. //depot/projects/hammer/sys/dev/ata/ata-raid.c#18 integrate .. //depot/projects/hammer/sys/dev/digi/digi.c#14 integrate .. //depot/projects/hammer/sys/dev/firewire/fwohci_pci.c#25 integrate .. //depot/projects/hammer/sys/dev/pci/pci.c#22 integrate .. //depot/projects/hammer/sys/dev/pci/pci_pci.c#11 integrate .. //depot/projects/hammer/sys/dev/puc/puc.c#10 integrate .. //depot/projects/hammer/sys/dev/random/randomdev.c#16 integrate .. //depot/projects/hammer/sys/dev/rc/rc.c#11 integrate .. //depot/projects/hammer/sys/dev/sio/sio.c#37 integrate .. //depot/projects/hammer/sys/dev/uart/uart_tty.c#10 integrate .. //depot/projects/hammer/sys/dev/usb/uftdi.c#13 integrate .. //depot/projects/hammer/sys/dev/usb/ugen.c#16 integrate .. //depot/projects/hammer/sys/dev/usb/uhub.c#6 integrate .. //depot/projects/hammer/sys/dev/usb/usb_subr.c#12 integrate .. //depot/projects/hammer/sys/dev/usb/usbdevs#39 integrate .. //depot/projects/hammer/sys/dev/usb/usbdivar.h#4 integrate .. //depot/projects/hammer/sys/geom/geom_disk.c#26 integrate .. //depot/projects/hammer/sys/geom/geom_slice.c#16 integrate .. //depot/projects/hammer/sys/i386/acpica/acpi_asus.c#5 integrate .. //depot/projects/hammer/sys/i386/acpica/acpi_machdep.c#18 integrate .. //depot/projects/hammer/sys/i386/acpica/acpi_toshiba.c#9 integrate .. //depot/projects/hammer/sys/i386/conf/NOTES#44 integrate .. //depot/projects/hammer/sys/i386/i386/i686_mem.c#8 integrate .. //depot/projects/hammer/sys/i386/i386/mptable.c#13 integrate .. //depot/projects/hammer/sys/i386/i386/nexus.c#12 integrate .. //depot/projects/hammer/sys/i386/i386/pmap.c#41 integrate .. //depot/projects/hammer/sys/i386/include/pmap.h#16 integrate .. //depot/projects/hammer/sys/i386/isa/isa.c#4 integrate .. //depot/projects/hammer/sys/i386/isa/vesa.c#7 integrate .. //depot/projects/hammer/sys/i386/pci/pci_cfgreg.c#16 integrate .. //depot/projects/hammer/sys/i386/pci/pci_pir.c#5 integrate .. //depot/projects/hammer/sys/ia64/acpica/acpi_machdep.c#4 integrate .. //depot/projects/hammer/sys/ia64/ia64/nexus.c#3 integrate .. //depot/projects/hammer/sys/kern/kern_linker.c#17 integrate .. //depot/projects/hammer/sys/kern/link_elf_obj.c#45 integrate .. //depot/projects/hammer/sys/kern/subr_bus.c#22 integrate .. //depot/projects/hammer/sys/kern/subr_rman.c#7 integrate .. //depot/projects/hammer/sys/kern/subr_sleepqueue.c#7 integrate .. //depot/projects/hammer/sys/kern/subr_turnstile.c#9 integrate .. //depot/projects/hammer/sys/modules/Makefile#48 integrate .. //depot/projects/hammer/sys/modules/acpi/acpi/Makefile#5 integrate .. //depot/projects/hammer/sys/modules/acpi/acpi_asus/Makefile#2 integrate .. //depot/projects/hammer/sys/modules/acpi/acpi_toshiba/Makefile#2 integrate .. //depot/projects/hammer/sys/modules/acpi/acpi_video/Makefile#2 integrate .. //depot/projects/hammer/sys/modules/ahb/Makefile#1 branch .. //depot/projects/hammer/sys/netgraph/netgraph.h#8 integrate .. //depot/projects/hammer/sys/netgraph/ng_base.c#14 integrate .. //depot/projects/hammer/sys/netgraph/ng_device.c#7 integrate .. //depot/projects/hammer/sys/netgraph/ng_device.h#3 integrate .. //depot/projects/hammer/sys/pc98/conf/NOTES#29 integrate .. //depot/projects/hammer/sys/pc98/pc98/sio.c#26 integrate .. //depot/projects/hammer/sys/pci/if_dcreg.h#15 integrate .. //depot/projects/hammer/sys/powerpc/powermac/grackle.c#5 integrate .. //depot/projects/hammer/sys/powerpc/powermac/hrowpic.c#8 integrate .. //depot/projects/hammer/sys/powerpc/powermac/macio.c#7 integrate .. //depot/projects/hammer/sys/powerpc/powermac/maciovar.h#3 integrate .. //depot/projects/hammer/sys/powerpc/powermac/openpic_macio.c#5 integrate .. //depot/projects/hammer/sys/powerpc/powermac/uninorth.c#5 integrate .. //depot/projects/hammer/sys/powerpc/powerpc/openpic.c#8 integrate .. //depot/projects/hammer/sys/powerpc/powerpc/pmap.c#22 integrate .. //depot/projects/hammer/sys/powerpc/psim/iobus.c#5 integrate .. //depot/projects/hammer/sys/powerpc/psim/iobusvar.h#2 integrate .. //depot/projects/hammer/sys/powerpc/psim/openpic_iobus.c#4 integrate .. //depot/projects/hammer/sys/sparc64/ebus/ebus.c#11 integrate .. //depot/projects/hammer/sys/sparc64/fhc/fhc.c#2 integrate .. //depot/projects/hammer/sys/sparc64/pci/psycho.c#19 integrate .. //depot/projects/hammer/sys/sparc64/sbus/sbus.c#13 integrate .. //depot/projects/hammer/sys/sparc64/sparc64/iommu.c#16 integrate .. //depot/projects/hammer/sys/sparc64/sparc64/nexus.c#7 integrate .. //depot/projects/hammer/sys/sys/rman.h#4 integrate .. //depot/projects/hammer/sys/sys/tty.h#12 integrate .. //depot/projects/hammer/sys/tools/acpi_quirks2h.awk#2 integrate Differences ... ==== //depot/projects/hammer/sys/amd64/acpica/acpi_machdep.c#14 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_machdep.c,v 1.13 2004/04/21 02:10:58 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_machdep.c,v 1.14 2004/06/30 04:42:29 njl Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -56,3 +56,9 @@ intr_model = model; } + +int +acpi_machdep_quirks(int *quirks) +{ + return (0); +} ==== //depot/projects/hammer/sys/amd64/amd64/nexus.c#25 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.60 2004/06/03 20:22:48 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.61 2004/06/30 19:24:26 imp Exp $"); /* * This code implements a `root nexus' for Intel Architecture @@ -41,6 +41,7 @@ * and I/O memory address space. */ +#define __RMAN_RESOURCE_VISIBLE #include "opt_isa.h" #include <sys/param.h> ==== //depot/projects/hammer/sys/boot/common/newvers.sh#3 (text+ko) ==== @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: src/sys/boot/common/newvers.sh,v 1.4 2004/04/07 20:45:56 imp Exp $ +# $FreeBSD: src/sys/boot/common/newvers.sh,v 1.5 2004/07/01 06:40:12 ps Exp $ # $NetBSD: newvers.sh,v 1.1 1997/07/26 01:50:38 thorpej Exp $ # # Copyright (c) 1984, 1986, 1990, 1993 @@ -33,7 +33,7 @@ # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 LC_ALL=C; export LC_ALL -u=${USER-root} h=`hostname` t=`date` +u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` ==== //depot/projects/hammer/sys/conf/NOTES#50 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1236 2004/06/27 02:36:33 rwatson Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1238 2004/06/30 01:00:59 jhb Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -178,9 +178,18 @@ # and WITNESS options. options MUTEX_NOINLINE +# MUTEX_WAKE_ALL changes the mutex unlock algorithm to wake all waiters +# when a contested mutex is released rather than just awaking the highest +# priority waiter. +options MUTEX_WAKE_ALL + # SMP Debugging Options: # # MUTEX_DEBUG enables various extra assertions in the mutex code. +# SLEEPQUEUE_PROFILING enables rudimentary profiling of the hash table +# used to hold active sleep queues. +# TURNSTILE_PROFILING enables rudimentary profiling of the hash table +# used to hold active lock queues. # WITNESS enables the witness code which detects deadlocks and cycles # during locking operations. # WITNESS_DDB causes the witness code to drop into the kernel debugger if @@ -196,6 +205,10 @@ # MUTEX_PROFILING(9) for details. options MUTEX_PROFILING +# Profiling for internal hash tables. +options SLEEPQUEUE_PROFILING +options TURNSTILE_PROFILING + ##################################################################### # COMPATIBILITY OPTIONS ==== //depot/projects/hammer/sys/conf/files#68 (text+ko) ==== @@ -1,13 +1,13 @@ -# $FreeBSD: src/sys/conf/files,v 1.914 2004/06/28 16:22:20 imp Exp $ +# $FreeBSD: src/sys/conf/files,v 1.921 2004/06/30 14:52:49 imp Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # -acpi_quirks.h standard \ +acpi_quirks.h optional acpi \ dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ - no-obj no-implicit-rule \ + no-obj no-implicit-rule before-depend \ clean "acpi_quirks.h" aicasm optional ahc \ dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \ @@ -45,7 +45,7 @@ compile-with "${AWK} -f $S/tools/miidevs2h.awk $S/dev/mii/miidevs" \ no-obj no-implicit-rule before-depend \ clean "miidevs.h" -pccarddevs.h optional pccard \ +pccarddevs.h standard \ dependency "$S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ @@ -290,6 +290,7 @@ dev/acpica/acpi_pcib_acpi.c optional acpi pci dev/acpica/acpi_pcib_pci.c optional acpi pci dev/acpica/acpi_powerres.c optional acpi +dev/acpica/acpi_quirk.c optional acpi dev/acpica/acpi_resource.c optional acpi dev/acpica/acpi_thermal.c optional acpi dev/acpica/acpi_timer.c optional acpi ==== //depot/projects/hammer/sys/conf/files.amd64#48 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.amd64,v 1.37 2004/05/24 12:08:56 bde Exp $ +# $FreeBSD: src/sys/conf/files.amd64,v 1.38 2004/06/30 14:19:28 njl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -35,6 +35,7 @@ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # +dev/acpica/acpi_if.m standard amd64/acpica/OsdEnvironment.c optional acpi amd64/acpica/acpi_machdep.c optional acpi amd64/acpica/acpi_wakeup.c optional acpi ==== //depot/projects/hammer/sys/conf/files.i386#34 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.i386,v 1.494 2004/06/23 17:33:24 brooks Exp $ +# $FreeBSD: src/sys/conf/files.i386,v 1.495 2004/06/30 14:19:28 njl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -180,6 +180,7 @@ geom/geom_bsd_enc.c standard geom/geom_mbr.c standard geom/geom_mbr_enc.c standard +dev/acpica/acpi_if.m standard i386/acpica/OsdEnvironment.c optional acpi i386/acpica/acpi_asus.c optional acpi_asus acpi i386/acpica/acpi_machdep.c optional acpi ==== //depot/projects/hammer/sys/conf/files.ia64#19 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.ia64,v 1.68 2004/05/17 06:51:19 marcel Exp $ +# $FreeBSD: src/sys/conf/files.ia64,v 1.69 2004/06/30 14:19:28 njl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -75,6 +75,7 @@ geom/geom_gpt.c standard geom/geom_mbr.c standard geom/geom_mbr_enc.c standard +dev/acpica/acpi_if.m standard ia64/acpica/OsdEnvironment.c optional acpi ia64/acpica/acpi_machdep.c optional acpi ia64/acpica/acpi_wakeup.c optional acpi ==== //depot/projects/hammer/sys/conf/kmod.mk#31 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $FreeBSD: src/sys/conf/kmod.mk,v 1.162 2004/06/24 06:29:22 njl Exp $ +# $FreeBSD: src/sys/conf/kmod.mk,v 1.163 2004/06/29 18:56:14 njl Exp $ # # The include file <bsd.kmod.mk> handles installing Kernel Loadable Device # drivers (KLD's). @@ -293,7 +293,7 @@ MFILES?= kern/bus_if.m kern/device_if.m dev/iicbus/iicbb_if.m \ dev/iicbus/iicbus_if.m isa/isa_if.m \ libkern/iconv_converter_if.m \ - dev/eisa/eisa_if.m dev/mii/miibus_if.m \ + dev/acpica/acpi_if.m dev/eisa/eisa_if.m dev/mii/miibus_if.m \ dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ dev/usb/usb_if.m dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ ==== //depot/projects/hammer/sys/conf/newvers.sh#11 (text+ko) ==== @@ -28,7 +28,7 @@ # SUCH DAMAGE. # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 -# $FreeBSD: src/sys/conf/newvers.sh,v 1.61 2004/04/07 20:45:56 imp Exp $ +# $FreeBSD: src/sys/conf/newvers.sh,v 1.62 2004/07/01 06:40:12 ps Exp $ TYPE="FreeBSD" REVISION="5.2" @@ -81,7 +81,7 @@ fi touch version -v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` +v=`cat version` u=${USER-root} d=`pwd` h=${HOSTNAME-`hostname`} t=`date` i=`make -V KERN_IDENT` cat << EOF > vers.c $COPYRIGHT ==== //depot/projects/hammer/sys/conf/options#43 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.456 2004/06/27 02:36:33 rwatson Exp $ +# $FreeBSD: src/sys/conf/options,v 1.457 2004/06/29 02:30:12 jhb Exp $ # # On the handling of kernel options # @@ -110,6 +110,7 @@ SCHED_4BSD opt_sched.h SCHED_ULE opt_sched.h SHOW_BUSYBUFS +SLEEPQUEUE_PROFILING SPX_HACK SUIDDIR opt_suiddir.h MSGMNB opt_sysvipc.h @@ -134,6 +135,7 @@ SYSVSEM opt_sysvipc.h SYSVSHM opt_sysvipc.h SW_WATCHDOG opt_watchdog.h +TURNSTILE_PROFILING TTYHOG opt_tty.h VFS_AIO WLCACHE opt_wavelan.h ==== //depot/projects/hammer/sys/contrib/ipfilter/netinet/fil.c#6 (text+ko) ==== @@ -100,7 +100,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed"; -static const char rcsid[] = "@(#)$FreeBSD: src/sys/contrib/ipfilter/netinet/fil.c,v 1.38 2004/06/21 22:46:35 darrenr Exp $"; +static const char rcsid[] = "@(#)$FreeBSD: src/sys/contrib/ipfilter/netinet/fil.c,v 1.39 2004/06/29 03:39:06 darrenr Exp $"; #endif #ifndef _KERNEL @@ -2155,9 +2155,6 @@ ip_natsync(ifp); ip_statesync(ifp); } -# if defined(__FreeBSD_version) && (__FreeBSD_version >= 500043) - IFNET_RUNLOCK(); -# endif ip_natsync((struct ifnet *)-1); # if defined(__FreeBSD_version) && (__FreeBSD_version >= 500043) IFNET_RUNLOCK(); ==== //depot/projects/hammer/sys/dev/acpica/acpi.c#40 (text+ko) ==== @@ -26,9 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.167 2004/06/28 03:36:37 imp Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.173 2004/06/30 16:54:10 imp Exp $ */ +#define __RMAN_RESOURCE_VISIBLE #include "opt_acpi.h" #include <sys/param.h> #include <sys/kernel.h> @@ -52,6 +53,7 @@ #include <machine/bus.h> #include <sys/rman.h> #include <isa/isavar.h> +#include <isa/pnpvar.h> #include "acpi.h" #include <dev/acpica/acpivar.h> @@ -77,36 +79,20 @@ .d_name = "acpi", }; -#if __FreeBSD_version >= 500000 +/* Global mutex for locking access to the ACPI subsystem. */ struct mtx acpi_mutex; -#endif + +/* Bitmap of device quirks. */ +int acpi_quirks; /* Local pools for managing system resources for ACPI child devices. */ -struct rman acpi_rman_io, acpi_rman_mem; - -struct acpi_quirks { - char *OemId; - uint32_t OemRevision; - char *value; -}; - -#define ACPI_OEM_REV_ANY 0 - -static struct acpi_quirks acpi_quirks_table[] = { -#ifdef notyet - /* Bad PCI routing table. Used on some SuperMicro boards. */ - { "PTLTD ", 0x06040000, "pci_link" }, -#endif - - { NULL, 0, NULL } -}; +struct rman acpi_rman_io, acpi_rman_mem; static int acpi_modevent(struct module *mod, int event, void *junk); static void acpi_identify(driver_t *driver, device_t parent); static int acpi_probe(device_t dev); static int acpi_attach(device_t dev); static int acpi_shutdown(device_t dev); -static void acpi_quirks_set(void); static device_t acpi_add_child(device_t bus, int order, const char *name, int unit); static int acpi_print_child(device_t bus, device_t child); @@ -122,18 +108,25 @@ int rid, struct resource *r); static uint32_t acpi_isa_get_logicalid(device_t dev); static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); +static char *acpi_device_id_probe(device_t bus, device_t dev, char **ids); +static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, + ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters, + ACPI_BUFFER *ret); +static ACPI_STATUS acpi_device_walk_ns(device_t bus, device_t dev, + ACPI_OBJECT_TYPE type, UINT32 max_depth, + ACPI_WALK_CALLBACK user_fn, void *context, void **ret); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); static void acpi_probe_children(device_t bus); static int acpi_probe_order(ACPI_HANDLE handle, int *order); static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status); +static BOOLEAN acpi_MatchHid(ACPI_HANDLE h, const char *hid); static void acpi_shutdown_final(void *arg, int howto); static void acpi_enable_fixed_events(struct acpi_softc *sc); -static int acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw); -static ACPI_STATUS acpi_wake_limit(ACPI_HANDLE h, UINT32 level, void *context, - void **status); -static int acpi_wake_limit_walk(int sstate); +static int acpi_wake_sleep_prep(ACPI_HANDLE handle, int sstate); +static int acpi_wake_run_prep(ACPI_HANDLE handle, int sstate); +static int acpi_wake_prep_walk(int sstate); static int acpi_wake_sysctl_walk(device_t dev); static int acpi_wake_set_sysctl(SYSCTL_HANDLER_ARGS); static void acpi_system_eventhandler_sleep(void *arg, int state); @@ -174,6 +167,11 @@ DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + /* ACPI bus */ + DEVMETHOD(acpi_id_probe, acpi_device_id_probe), + DEVMETHOD(acpi_evaluate_object, acpi_device_eval_obj), + DEVMETHOD(acpi_walk_namespace, acpi_device_walk_ns), + /* ISA emulation */ DEVMETHOD(isa_pnp_probe, acpi_isa_pnp_probe), @@ -217,7 +215,7 @@ static int acpi_modevent(struct module *mod, int event, void *junk) { - switch(event) { + switch (event) { case MOD_LOAD: if (!cold) { printf("The ACPI driver cannot be loaded after boot.\n"); @@ -243,18 +241,17 @@ #ifdef ACPI_DEBUGGER char *debugpoint; #endif - static int error, started = 0; + static int started = 0; + int error, val; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); if (started) - return_VALUE (error); + return_VALUE (0); started = 1; -#if __FreeBSD_version >= 500000 /* Initialise the ACPI mutex */ mtx_init(&acpi_mutex, "ACPI global lock", NULL, MTX_DEF); -#endif /* * Set the globals from our tunables. This is needed because ACPI-CA @@ -286,13 +283,21 @@ if (ACPI_FAILURE(error = AcpiLoadTables())) { printf("ACPI: table load failed: %s\n", AcpiFormatException(error)); - return_VALUE(error); + AcpiTerminate(); + return_VALUE (error); } - /* Set up any quirks we have for this XSDT. */ - acpi_quirks_set(); - if (acpi_disabled("acpi")) + /* Set up any quirks we have for this system. */ + acpi_table_quirks(&acpi_quirks); + + /* If the user manually set the disabled hint to 0, override any quirk. */ + if (resource_int_value("acpi", 0, "disabled", &val) == 0 && val == 0) + acpi_quirks &= ~ACPI_Q_BROKEN; + if (acpi_quirks & ACPI_Q_BROKEN) { + printf("ACPI disabled by blacklist. Contact your BIOS vendor.\n"); + AcpiTerminate(); return_VALUE (AE_ERROR); + } return_VALUE (AE_OK); } @@ -535,7 +540,7 @@ /* Only enable S4BIOS by default if the FACS says it is available. */ if (AcpiGbl_FACS->S4Bios_f != 0) - sc->acpi_s4bios = 1; + sc->acpi_s4bios = 1; /* * Dispatch the default sleep state to devices. The lid switch is set @@ -628,60 +633,12 @@ /* Allow children to shutdown first. */ bus_generic_shutdown(dev); - /* Disable all wake GPEs not appropriate for reboot/poweroff. */ - acpi_wake_limit_walk(ACPI_STATE_S5); + /* Enable any GPEs that are able to power-on the system (i.e., RTC). */ + acpi_wake_prep_walk(ACPI_STATE_S5); + return (0); } -static void -acpi_quirks_set() -{ - XSDT_DESCRIPTOR *xsdt; - struct acpi_quirks *quirk; - char *env, *tmp; - int len; - - /* - * If the user loaded a custom table or disabled "quirks", leave - * the settings alone. - */ - len = 0; - if ((env = getenv("acpi_dsdt_load")) != NULL) { - /* XXX No strcasecmp but this is good enough. */ - if (*env == 'Y' || *env == 'y') - goto out; - freeenv(env); - } - if ((env = getenv("debug.acpi.disabled")) != NULL) { - if (strstr("quirks", env) != NULL) - goto out; - len = strlen(env); - } - - /* - * Search through our quirk table and concatenate the disabled - * values with whatever we find. - */ - xsdt = AcpiGbl_XSDT; - for (quirk = acpi_quirks_table; quirk->OemId; quirk++) { - if (!strncmp(xsdt->OemId, quirk->OemId, strlen(quirk->OemId)) && - (xsdt->OemRevision == quirk->OemRevision || - quirk->OemRevision == ACPI_OEM_REV_ANY)) { - len += strlen(quirk->value) + 2; - if ((tmp = malloc(len, M_TEMP, M_NOWAIT)) == NULL) - goto out; - sprintf(tmp, "%s %s", env ? env : "", quirk->value); - setenv("debug.acpi.disabled", tmp); - free(tmp, M_TEMP); - break; - } - } - -out: - if (env) - freeenv(env); -} - /* * Handle a new device being added */ @@ -786,6 +743,9 @@ case ACPI_IVAR_PRIVATE: *(void **)result = ad->ad_private; break; + case ACPI_IVAR_FLAGS: + *(int *)result = ad->ad_flags; + break; case ISA_IVAR_VENDORID: case ISA_IVAR_SERIAL: case ISA_IVAR_COMPATID: @@ -821,6 +781,9 @@ case ACPI_IVAR_PRIVATE: ad->ad_private = (void *)value; break; + case ACPI_IVAR_FLAGS: + ad->ad_flags = (int)value; + break; default: panic("bad ivar write request (%d)", index); return (ENOENT); @@ -969,19 +932,7 @@ return (bus_alloc_resource_any(dev, type, rid, RF_ACTIVE)); } -/* - * Handle ISA-like devices probing for a PnP ID to match. - */ -#define PNP_EISAID(s) \ - ((((s[0] - '@') & 0x1f) << 2) \ - | (((s[1] - '@') & 0x18) >> 3) \ - | (((s[1] - '@') & 0x07) << 13) \ - | (((s[2] - '@') & 0x1f) << 8) \ - | (PNP_HEXTONUM(s[4]) << 16) \ - | (PNP_HEXTONUM(s[3]) << 20) \ - | (PNP_HEXTONUM(s[6]) << 24) \ - | (PNP_HEXTONUM(s[5]) << 28)) - +/* Probe _HID and _CID for compatible ISA PNP ids. */ static uint32_t acpi_isa_get_logicalid(device_t dev) { @@ -1064,6 +1015,46 @@ return_VALUE (valid); } +static char * +acpi_device_id_probe(device_t bus, device_t dev, char **ids) +{ + ACPI_HANDLE h; + int i; + + h = acpi_get_handle(dev); + if (ids == NULL || h == NULL || acpi_get_type(dev) != ACPI_TYPE_DEVICE) + return (NULL); + + /* Try to match one of the array of IDs with a HID or CID. */ + for (i = 0; ids[i] != NULL; i++) { + if (acpi_MatchHid(h, ids[i])) + return (ids[i]); + } + return (NULL); +} + +static ACPI_STATUS +acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, + ACPI_OBJECT_LIST *parameters, ACPI_BUFFER *ret) +{ + ACPI_HANDLE h; + + if ((h = acpi_get_handle(dev)) == NULL) + return (AE_BAD_PARAMETER); + return (AcpiEvaluateObject(h, pathname, parameters, ret)); +} + +static ACPI_STATUS +acpi_device_walk_ns(device_t bus, device_t dev, ACPI_OBJECT_TYPE type, + UINT32 max_depth, ACPI_WALK_CALLBACK user_fn, void *context, void **ret) +{ + ACPI_HANDLE h; + + if ((h = acpi_get_handle(dev)) == NULL) + return (AE_BAD_PARAMETER); + return (AcpiWalkNamespace(type, h, max_depth, user_fn, context, ret)); +} + static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids) { @@ -1206,7 +1197,7 @@ bus = (device_t)context; if (ACPI_SUCCESS(AcpiGetType(handle, &type))) { - switch(type) { + switch (type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: @@ -1232,10 +1223,6 @@ acpi_set_handle(child, handle); AcpiAttachData(handle, acpi_fake_objhandler, child); - /* Check if the device can generate wake events. */ - if (ACPI_SUCCESS(AcpiEvaluateObject(handle, "_PRW", NULL, NULL))) - device_set_flags(child, ACPI_FLAG_WAKE_CAPABLE); - /* * Check that the device is present. If it's not present, * leave it disabled (so that we have a device_t attached to @@ -1409,8 +1396,8 @@ /* * Match a HID string against a handle */ -BOOLEAN -acpi_MatchHid(ACPI_HANDLE h, char *hid) +static BOOLEAN +acpi_MatchHid(ACPI_HANDLE h, const char *hid) { ACPI_DEVICE_INFO *devinfo; ACPI_BUFFER buf; @@ -1782,8 +1769,8 @@ sc->acpi_sstate = state; sc->acpi_sleep_disabled = 1; - /* Disable all wake GPEs not appropriate for this state. */ - acpi_wake_limit_walk(state); + /* Enable any GPEs as appropriate and requested by the user. */ + acpi_wake_prep_walk(state); /* Inform all devices that we are going to sleep. */ if (DEVICE_SUSPEND(root_bus) != 0) { @@ -1829,6 +1816,9 @@ break; } } + + /* Resume devices, re-enable GPEs and fixed events. */ + acpi_wake_prep_walk(state); AcpiLeaveSleepState((UINT8)state); DEVICE_RESUME(root_bus); sc->acpi_sstate = ACPI_STATE_S0; @@ -1860,10 +1850,6 @@ { struct acpi_prw_data prw; - /* Check that the device can wake the system. */ - if ((device_get_flags(dev) & ACPI_FLAG_WAKE_CAPABLE) == 0) - return (ENXIO); - /* Evaluate _PRW to find the GPE. */ if (acpi_parse_prw(acpi_get_handle(dev), &prw) != 0) return (ENXIO); @@ -1886,149 +1872,124 @@ ACPI_STATUS status; int flags; - /* Make sure the device supports waking the system. */ - flags = device_get_flags(dev); + /* Make sure the device supports waking the system and get the GPE. */ handle = acpi_get_handle(dev); - if ((flags & ACPI_FLAG_WAKE_CAPABLE) == 0 || handle == NULL) - return (ENXIO); - - /* Evaluate _PRW to find the GPE. */ if (acpi_parse_prw(handle, &prw) != 0) return (ENXIO); + flags = acpi_get_flags(dev); if (enable) { status = AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); if (ACPI_FAILURE(status)) { device_printf(dev, "enable wake failed\n"); return (ENXIO); } - device_set_flags(dev, flags | ACPI_FLAG_WAKE_ENABLED); + acpi_set_flags(dev, flags | ACPI_FLAG_WAKE_ENABLED); } else { status = AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); if (ACPI_FAILURE(status)) { device_printf(dev, "disable wake failed\n"); return (ENXIO); } - device_set_flags(dev, flags & ~ACPI_FLAG_WAKE_ENABLED); + acpi_set_flags(dev, flags & ~ACPI_FLAG_WAKE_ENABLED); } return (0); } -/* Configure a device's GPE appropriately for the new sleep state. */ -int -acpi_wake_sleep_prep(device_t dev, int sstate) +static int +acpi_wake_sleep_prep(ACPI_HANDLE handle, int sstate) { struct acpi_prw_data prw; - ACPI_HANDLE handle; - int flags; + device_t dev; - /* Check that this is an ACPI device and get its GPE. */ - flags = device_get_flags(dev); - handle = acpi_get_handle(dev); - if ((flags & ACPI_FLAG_WAKE_CAPABLE) == 0 || handle == NULL) - return (ENXIO); - - /* Evaluate _PRW to find the GPE. */ + /* Check that this is a wake-capable device and get its GPE. */ if (acpi_parse_prw(handle, &prw) != 0) return (ENXIO); + dev = acpi_get_device(handle); /* - * TBD: All Power Resources referenced by elements 2 through N - * of the _PRW object are put into the ON state. + * The destination sleep state must be less than (i.e., higher power) + * or equal to the value specified by _PRW. If this GPE cannot be + * enabled for the next sleep state, then disable it. If it can and + * the user requested it be enabled, turn on any required power resources + * and set _PSW. */ - - /* - * If the user requested that this device wake the system and the next - * sleep state is valid for this GPE, enable it and the device's wake - * capability. The sleep state must be less than (i.e., higher power) - * or equal to the value specified by _PRW. Return early, leaving - * the appropriate power resources enabled. - */ - if ((flags & ACPI_FLAG_WAKE_ENABLED) != 0 && - sstate <= prw.lowest_wake) { + if (sstate > prw.lowest_wake) { + AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); if (bootverbose) - device_printf(dev, "wake_prep enabled gpe %#x for state %d\n", - prw.gpe_bit, sstate); - AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + device_printf(dev, "wake_prep disabled wake for %s (S%d)\n", + acpi_name(handle), sstate); + } else if (dev && (acpi_get_flags(dev) & ACPI_FLAG_WAKE_ENABLED) != 0) { + acpi_pwr_wake_enable(handle, 1); acpi_SetInteger(handle, "_PSW", 1); - return (0); + if (bootverbose) + device_printf(dev, "wake_prep enabled for %s (S%d)\n", + acpi_name(handle), sstate); } - /* - * If the device wake was disabled or this sleep state is too low for - * this device, disable its wake capability and GPE. - */ - AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); - acpi_SetInteger(handle, "_PSW", 0); - if (bootverbose) - device_printf(dev, "wake_prep disabled gpe %#x for state %d\n", - prw.gpe_bit, sstate); - - /* - * TBD: All Power Resources referenced by elements 2 through N - * of the _PRW object are put into the OFF state. - */ - return (0); } -/* Re-enable GPEs after wake. */ -int -acpi_wake_run_prep(device_t dev) +static int +acpi_wake_run_prep(ACPI_HANDLE handle, int sstate) { struct acpi_prw_data prw; - ACPI_HANDLE handle; - int flags; + device_t dev; - /* Check that this is an ACPI device and get its GPE. */ - flags = device_get_flags(dev); - handle = acpi_get_handle(dev); - if ((flags & ACPI_FLAG_WAKE_CAPABLE) == 0 || handle == NULL) - return (ENXIO); - - /* Evaluate _PRW to find the GPE. */ + /* + * Check that this is a wake-capable device and get its GPE. Return + * now if the user didn't enable this device for wake. + */ if (acpi_parse_prw(handle, &prw) != 0) return (ENXIO); + dev = acpi_get_device(handle); + if (dev == NULL || (acpi_get_flags(dev) & ACPI_FLAG_WAKE_ENABLED) == 0) + return (0); /* - * TBD: Be sure all Power Resources referenced by elements 2 through N - * of the _PRW object are in the ON state. + * If this GPE couldn't be enabled for the previous sleep state, it was + * disabled before going to sleep so re-enable it. If it was enabled, + * clear _PSW and turn off any power resources it used. */ + if (sstate > prw.lowest_wake) { + AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + if (bootverbose) + device_printf(dev, "run_prep re-enabled %s\n", acpi_name(handle)); + } else { + acpi_SetInteger(handle, "_PSW", 0); + acpi_pwr_wake_enable(handle, 0); + if (bootverbose) + device_printf(dev, "run_prep cleaned up for %s\n", + acpi_name(handle)); + } - /* Disable wake capability and if the user requested, enable the GPE. */ - acpi_SetInteger(handle, "_PSW", 0); - if ((flags & ACPI_FLAG_WAKE_ENABLED) != 0) - AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); return (0); } static ACPI_STATUS -acpi_wake_limit(ACPI_HANDLE h, UINT32 level, void *context, void **status) +acpi_wake_prep(ACPI_HANDLE handle, UINT32 level, void *context, void **status) { - struct acpi_prw_data prw; - int *sstate; + int sstate; - /* It's ok not to have _PRW if the device can't wake the system. */ - if (acpi_parse_prw(h, &prw) != 0) - return (AE_OK); - - sstate = (int *)context; - if (*sstate > prw.lowest_wake) - AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); - + /* If suspending, run the sleep prep function, otherwise wake. */ + sstate = *(int *)context; + if (AcpiGbl_SystemAwakeAndRunning) + acpi_wake_sleep_prep(handle, sstate); + else + acpi_wake_run_prep(handle, sstate); return (AE_OK); } -/* Walk all system devices, disabling them if necessary for sstate. */ +/* Walk the tree rooted at acpi0 to prep devices for suspend/resume. */ static int -acpi_wake_limit_walk(int sstate) +acpi_wake_prep_walk(int sstate) { ACPI_HANDLE sb_handle; if (ACPI_SUCCESS(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) - AcpiWalkNamespace(ACPI_TYPE_ANY, sb_handle, 100, - acpi_wake_limit, &sstate, NULL); + AcpiWalkNamespace(ACPI_TYPE_DEVICE, sb_handle, 100, + acpi_wake_prep, &sstate, NULL); return (0); } @@ -2039,21 +2000,23 @@ int error, i, numdevs; device_t *devlist; device_t child; + ACPI_STATUS status; error = device_get_children(dev, &devlist, &numdevs); if (error != 0 || numdevs == 0) >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407011416.i61EGZls080472>