Date: Fri, 22 Jun 2007 15:54:06 GMT From: Rui Paulo <rpaulo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 122156 for review Message-ID: <200706221554.l5MFs6mQ019032@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122156 Change 122156 by rpaulo@rpaulo_epsilon on 2007/06/22 15:53:07 IFC Affected files ... .. //depot/projects/soc2007/rpaulo-macbook/conf/files.sparc64#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/conf/files.sun4v#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpi.c#7 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpiio.h#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpivar.h#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/ahb/ahb.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/if_ndis/if_ndis_usb.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/mpt/mpt_cam.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pci/hda/hdac.c#7 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pcm/feeder.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pcm/sound.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/sound/usb/uaudio.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/syscons/scgfbrndr.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ehci.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ehci_pci.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/hid.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_aue.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_axe.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_cdce.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_cue.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_kue.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_rue.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_rum.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_udav.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_ural.c#6 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ohci.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ohci_pci.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/sl811hs.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/slhci_pccard.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uark.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ubsa.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ubser.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ucom.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ucycom.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/udbp.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ufm.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ufoma.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uftdi.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uhci_pci.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uhid.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uhub.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uipaq.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ukbd.c#7 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ulpt.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/umass.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/umct.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/umodem.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/ums.c#10 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uplcom.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/urio.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb.h#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb_mem.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb_port.h#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb_quirks.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb_quirks.h#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usb_subr.c#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usbdevs#8 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usbdi.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/usbdi_util.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uscanner.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uvisor.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/uvscom.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/fs/tmpfs/tmpfs_subr.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/fs/tmpfs/tmpfs_vnops.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/geom/part/g_part.c#6 integrate .. //depot/projects/soc2007/rpaulo-macbook/geom/part/g_part.h#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/geom/part/g_part_mbr.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/i386/acpica/acpi_machdep.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/kern/kern_conf.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/kern/subr_unit.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/kern/vfs_cache.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/modules/slhci/Makefile#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/net/bpf.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/netgraph/bluetooth/drivers/ubt/ng_ubt.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/ip_fw2.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp.h#9 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_asconf.c#7 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_bsd_addr.c#6 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_indata.c#11 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_indata.h#7 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_input.c#11 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_output.c#11 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_pcb.c#11 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_timer.c#8 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_uio.h#8 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_usrreq.c#10 integrate .. //depot/projects/soc2007/rpaulo-macbook/netinet/sctputil.c#11 integrate .. //depot/projects/soc2007/rpaulo-macbook/powerpc/powerpc/busdma_machdep.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pci.c#2 delete .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pci.h#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pci_if.m#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pcib.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pcib_subr.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/ofw_pcibus.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/sparc64/pci/psycho.c#4 integrate .. //depot/projects/soc2007/rpaulo-macbook/sys/priv.h#5 integrate .. //depot/projects/soc2007/rpaulo-macbook/ufs/ffs/ffs_softdep.c#3 integrate .. //depot/projects/soc2007/rpaulo-macbook/ufs/ufs/ufs_inode.c#2 integrate .. //depot/projects/soc2007/rpaulo-macbook/vm/vm_pageout.c#6 integrate Differences ... ==== //depot/projects/soc2007/rpaulo-macbook/conf/files.sparc64#4 (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.sparc64,v 1.90 2007/06/16 21:48:48 marius Exp $ +# $FreeBSD: src/sys/conf/files.sparc64,v 1.91 2007/06/18 21:49:42 marius Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -81,7 +81,6 @@ sparc64/isa/isa_dma.c optional isa sparc64/isa/ofw_isa.c optional ebus | isa sparc64/pci/apb.c optional pci -sparc64/pci/ofw_pci.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci ==== //depot/projects/soc2007/rpaulo-macbook/conf/files.sun4v#3 (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.sun4v,v 1.9 2007/06/11 00:38:06 marcel Exp $ +# $FreeBSD: src/sys/conf/files.sun4v,v 1.10 2007/06/18 21:49:42 marius Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -47,7 +47,6 @@ sparc64/sparc64/gdb_machdep.c optional gdb sun4v/sun4v/hv_pci.c optional pci sun4v/sun4v/trap_trace.S optional trap_tracing -sparc64/pci/ofw_pci.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci ==== //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpi.c#7 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.239 2007/06/15 18:02:33 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.240 2007/06/21 22:50:37 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -136,6 +136,7 @@ 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 ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, int state); static void acpi_shutdown_final(void *arg, int howto); static void acpi_enable_fixed_events(struct acpi_softc *sc); static int acpi_wake_sleep_prep(ACPI_HANDLE handle, int sstate); @@ -410,6 +411,7 @@ sc = device_get_softc(dev); sc->acpi_dev = dev; + callout_init(&sc->susp_force_to, TRUE); error = ENXIO; @@ -592,7 +594,7 @@ /* Pick the first valid sleep state for the sleep button default. */ sc->acpi_sleep_button_sx = ACPI_S_STATES_MAX + 1; - for (state = ACPI_STATE_S1; state < ACPI_STATE_S5; state++) + for (state = ACPI_STATE_S1; state <= ACPI_STATE_S4; state++) if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) { sc->acpi_sleep_button_sx = state; break; @@ -2118,7 +2120,151 @@ return (acpi_SetInteger(ACPI_ROOT_OBJECT, "_PIC", model)); } +/* + * DEPRECATED. This interface has serious deficiencies and will be + * removed. + * + * Immediately enter the sleep state. In the old model, acpiconf(8) ran + * rc.suspend and rc.resume so we don't have to notify devd(8) to do this. + */ +ACPI_STATUS +acpi_SetSleepState(struct acpi_softc *sc, int state) +{ + static int once; + + if (!once) { + printf( +"warning: acpi_SetSleepState() deprecated, need to update your software\n"); + once = 1; + } + return (acpi_EnterSleepState(sc, state)); +} + static void +acpi_sleep_force(void *arg) +{ + struct acpi_softc *sc; + + printf("acpi: suspend request timed out, forcing sleep now\n"); + sc = arg; + if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate))) + printf("acpi: force sleep state S%d failed\n", sc->acpi_next_sstate); +} + +/* + * Request that the system enter the given suspend state. All /dev/apm + * devices and devd(8) will be notified. Userland then has a chance to + * save state and acknowledge the request. The system sleeps once all + * acks are in. + */ +int +acpi_ReqSleepState(struct acpi_softc *sc, int state) +{ + struct apm_clone_data *clone; + + if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5) + return (EINVAL); + + /* S5 (soft-off) should be entered directly with no waiting. */ + if (state == ACPI_STATE_S5) { + if (ACPI_SUCCESS(acpi_EnterSleepState(sc, state))) + return (0); + else + return (ENXIO); + } + + /* If a suspend request is already in progress, just return. */ + ACPI_LOCK(acpi); + if (sc->acpi_next_sstate != 0) { + ACPI_UNLOCK(acpi); + return (0); + } + + /* Record the pending state and notify all apm devices. */ + sc->acpi_next_sstate = state; + STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) { + clone->notify_status = APM_EV_NONE; + if ((clone->flags & ACPI_EVF_DEVD) == 0) { + selwakeuppri(&clone->sel_read, PZERO); + KNOTE_UNLOCKED(&clone->sel_read.si_note, 0); + } + } + + /* Now notify devd(8) also. */ + acpi_UserNotify("Suspend", ACPI_ROOT_OBJECT, state); + + /* + * Set a timeout to fire if userland doesn't ack the suspend request + * in time. This way we still eventually go to sleep if we were + * overheating or running low on battery, even if userland is hung. + * We cancel this timeout once all userland acks are in or the + * suspend request is aborted. + */ + callout_reset(&sc->susp_force_to, 10 * hz, acpi_sleep_force, sc); + ACPI_UNLOCK(acpi); + return (0); +} + +/* + * Acknowledge (or reject) a pending sleep state. The caller has + * prepared for suspend and is now ready for it to proceed. If the + * error argument is non-zero, it indicates suspend should be cancelled + * and gives an errno value describing why. Once all votes are in, + * we suspend the system. + */ +int +acpi_AckSleepState(struct apm_clone_data *clone, int error) +{ + struct acpi_softc *sc; + int ret, sleeping; + + /* If no pending sleep state, return an error. */ + ACPI_LOCK(acpi); + sc = clone->acpi_sc; + if (sc->acpi_next_sstate == 0) { + ACPI_UNLOCK(acpi); + return (ENXIO); + } + + /* Caller wants to abort suspend process. */ + if (error) { + sc->acpi_next_sstate = 0; + callout_stop(&sc->susp_force_to); + printf("acpi: listener on %s cancelled the pending suspend\n", + devtoname(clone->cdev)); + ACPI_UNLOCK(acpi); + return (0); + } + + /* + * Mark this device as acking the suspend request. Then, walk through + * all devices, seeing if they agree yet. We only count devices that + * are writable since read-only devices couldn't ack the request. + */ + clone->notify_status = APM_EV_ACKED; + sleeping = TRUE; + STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) { + if ((clone->flags & ACPI_EVF_WRITE) != 0 && + clone->notify_status != APM_EV_ACKED) { + sleeping = FALSE; + break; + } + } + + /* If all devices have voted "yes", we will suspend now. */ + if (sleeping) + callout_stop(&sc->susp_force_to); + ACPI_UNLOCK(acpi); + ret = 0; + if (sleeping) { + if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate))) + ret = ENODEV; + } + + return (ret); +} + +static void acpi_sleep_enable(void *arg) { @@ -2134,12 +2280,12 @@ }; /* - * Set the system sleep state + * Enter the desired system sleep state. * * Currently we support S1-S5 but S4 is only S4BIOS */ -ACPI_STATUS -acpi_SetSleepState(struct acpi_softc *sc, int state) +static ACPI_STATUS +acpi_EnterSleepState(struct acpi_softc *sc, int state) { ACPI_STATUS status; UINT8 TypeA; @@ -2148,14 +2294,13 @@ ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); + /* Re-entry once we're suspending is not allowed. */ status = AE_OK; ACPI_LOCK(acpi); if (sc->acpi_sleep_disabled) { - if (sc->acpi_sstate != ACPI_STATE_S0) - status = AE_ERROR; ACPI_UNLOCK(acpi); printf("acpi: suspend request ignored (not ready yet)\n"); - return (status); + return (AE_ERROR); } sc->acpi_sleep_disabled = 1; ACPI_UNLOCK(acpi); @@ -2251,6 +2396,7 @@ * Back out state according to how far along we got in the suspend * process. This handles both the error and success cases. */ + sc->acpi_next_sstate = 0; if (slp_state >= ACPI_SS_GPE_SET) { acpi_wake_prep_walk(state); sc->acpi_sstate = ACPI_STATE_S0; @@ -2264,7 +2410,10 @@ /* Allow another sleep request after a while. */ if (state != ACPI_STATE_S5) - timeout(acpi_sleep_enable, (caddr_t)sc, hz * ACPI_MINIMUM_AWAKETIME); + timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME); + + /* Run /etc/rc.resume after we are back. */ + acpi_UserNotify("Resume", ACPI_ROOT_OBJECT, state); mtx_unlock(&Giant); return_ACPI_STATUS (status); @@ -2574,11 +2723,15 @@ static void acpi_system_eventhandler_sleep(void *arg, int state) { + int ret; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); - if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX) - acpi_SetSleepState((struct acpi_softc *)arg, state); + /* Request that the system prepare to enter the given suspend state. */ + ret = acpi_ReqSleepState((struct acpi_softc *)arg, state); + if (ret != 0) + printf("acpi: request to enter state S%d failed (err %d)\n", + state, ret); return_VOID; } @@ -2840,7 +2993,20 @@ /* Core system ioctls. */ switch (cmd) { - case ACPIIO_SETSLPSTATE: + case ACPIIO_REQSLPSTATE: + state = *(int *)addr; + if (state != ACPI_STATE_S5) + error = acpi_ReqSleepState(sc, state); + else { + printf("power off via acpi ioctl not supported\n"); + error = ENXIO; + } + break; + case ACPIIO_ACKSLPSTATE: + error = *(int *)addr; + error = acpi_AckSleepState(sc->acpi_clone, error); + break; + case ACPIIO_SETSLPSTATE: /* DEPRECATED */ error = EINVAL; state = *(int *)addr; if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX) @@ -3171,7 +3337,8 @@ goto out; } - acpi_SetSleepState(sc, acpi_state); + if (ACPI_FAILURE(acpi_EnterSleepState(sc, acpi_state))) + error = ENXIO; break; default: error = EINVAL; ==== //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpiio.h#2 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpiio.h,v 1.16 2005/10/23 00:16:41 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpiio.h,v 1.17 2007/06/21 22:50:37 njl Exp $ */ #ifndef _ACPIIO_H_ @@ -33,7 +33,13 @@ /* * Core ACPI subsystem ioctls */ -#define ACPIIO_SETSLPSTATE _IOW('P', 3, int) +#define ACPIIO_SETSLPSTATE _IOW('P', 3, int) /* DEPRECATED */ + +/* Request S1-5 sleep state. User is notified and then sleep proceeds. */ +#define ACPIIO_REQSLPSTATE _IOW('P', 4, int) + +/* Allow suspend to continue (0) or abort it (errno). */ +#define ACPIIO_ACKSLPSTATE _IOW('P', 5, int) struct acpi_battinfo { int cap; /* percent */ ==== //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpivar.h#4 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.106 2007/06/15 18:02:34 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.107 2007/06/21 22:50:37 njl Exp $ */ #ifndef _ACPIVAR_H_ @@ -39,12 +39,14 @@ #include <sys/ktr.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/selinfo.h> #include <sys/sx.h> #include <sys/sysctl.h> #include <machine/bus.h> #include <machine/resource.h> +struct apm_clone_data; struct acpi_softc { device_t acpi_dev; struct cdev *acpi_dev_t; @@ -76,6 +78,11 @@ bus_dmamap_t acpi_wakemap; vm_offset_t acpi_wakeaddr; vm_paddr_t acpi_wakephys; + + int acpi_next_sstate; /* Next suspend Sx state. */ + struct apm_clone_data *acpi_clone; /* Pseudo-dev for devd(8). */ + STAILQ_HEAD(,apm_clone_data) apm_cdevs; /* All apm/apmctl/acpi cdevs. */ + struct callout susp_force_to; /* Force suspend if no acks. */ }; struct acpi_device { @@ -89,6 +96,22 @@ struct resource_list ad_rl; }; +/* Track device (/dev/{apm,apmctl} and /dev/acpi) notification status. */ +struct apm_clone_data { + STAILQ_ENTRY(apm_clone_data) entries; + struct cdev *cdev; + int flags; +#define ACPI_EVF_NONE 0 /* /dev/apm semantics */ +#define ACPI_EVF_DEVD 1 /* /dev/acpi is handled via devd(8) */ +#define ACPI_EVF_WRITE 2 /* Device instance is opened writable. */ + int notify_status; +#define APM_EV_NONE 0 /* Device not yet aware of pending sleep. */ +#define APM_EV_NOTIFIED 1 /* Device saw next sleep state. */ +#define APM_EV_ACKED 2 /* Device agreed sleep can occur. */ + struct acpi_softc *acpi_sc; + struct selinfo sel_read; +}; + #define ACPI_PRW_MAX_POWERRES 8 struct acpi_prw_data { @@ -304,6 +327,8 @@ ACPI_RESOURCE *res); ACPI_STATUS acpi_OverrideInterruptLevel(UINT32 InterruptNumber); ACPI_STATUS acpi_SetIntrModel(int model); +int acpi_ReqSleepState(struct acpi_softc *sc, int state); +int acpi_AckSleepState(struct apm_clone_data *clone, int error); ACPI_STATUS acpi_SetSleepState(struct acpi_softc *sc, int state); int acpi_wake_init(device_t dev, int type); int acpi_wake_set_enable(device_t dev, int enable); ==== //depot/projects/soc2007/rpaulo-macbook/dev/ahb/ahb.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ahb/ahb.c,v 1.42 2007/06/17 05:55:46 scottl Exp $ + * $FreeBSD: src/sys/dev/ahb/ahb.c,v 1.43 2007/06/17 15:21:09 scottl Exp $ */ #include <sys/param.h> @@ -409,7 +409,7 @@ */ ahb = malloc(sizeof(struct ahb_softc), M_DEVBUF, M_NOWAIT | M_ZERO); if (!ahb) { - printf("ahb%ld: cannot malloc!\n", unit); + device_printf(dev, "cannot malloc!\n"); return (NULL); } SLIST_INIT(&ahb->free_ecbs); ==== //depot/projects/soc2007/rpaulo-macbook/dev/if_ndis/if_ndis_usb.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.8 2007/06/12 15:37:19 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.9 2007/06/18 22:24:32 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -69,10 +69,9 @@ MODULE_DEPEND(ndis, usb, 1, 1, 1); -static int ndisusb_match (device_t); -static int ndisusb_attach (device_t); -static struct resource_list *ndis_get_resource_list - (device_t, device_t); +static device_probe_t ndisusb_match; +static device_attach_t ndisusb_attach; +static bus_get_resource_list_t ndis_get_resource_list; extern int ndisdrv_modevent (module_t, int, void *); extern int ndis_attach (device_t); @@ -108,22 +107,25 @@ DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); -USB_MATCH(ndisusb) +static int +ndisusb_match(device_t self) { - USB_MATCH_START(ndisusb, uaa); + struct usb_attach_arg *uaa = device_get_ivars(self); if (windrv_lookup(0, "USB Bus") == NULL) - return(UMATCH_NONE); + return (UMATCH_NONE); if (uaa->iface != NULL) - return(UMATCH_NONE); + return (UMATCH_NONE); - return(UMATCH_NONE); + return (UMATCH_NONE); } -USB_ATTACH(ndisusb) +static int +ndisusb_attach(device_t self) { - USB_ATTACH_START(ndisusb, dummy, uaa); + struct ndisusb_softc *dummy = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); struct ndis_softc *sc; driver_object *drv; @@ -146,9 +148,7 @@ } static struct resource_list * -ndis_get_resource_list(dev, child) - device_t dev; - device_t child; +ndis_get_resource_list(device_t dev, device_t child) { struct ndis_softc *sc; ==== //depot/projects/soc2007/rpaulo-macbook/dev/mpt/mpt_cam.c#5 (text+ko) ==== @@ -94,7 +94,7 @@ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.59 2007/06/17 05:55:51 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.60 2007/06/18 18:28:43 scottl Exp $"); #include <dev/mpt/mpt.h> #include <dev/mpt/mpt_cam.h> @@ -323,7 +323,7 @@ /* * Create the device queue for our SIM(s). */ - devq = cam_simq_alloc(1); + devq = cam_simq_alloc(maxq); if (devq == NULL) { mpt_prt(mpt, "Unable to allocate CAM SIMQ!\n"); error = ENOMEM; @@ -334,7 +334,7 @@ * Construct our SIM entry. */ mpt->sim = - mpt_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, 1, 1, devq); + mpt_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, 1, maxq, devq); if (mpt->sim == NULL) { mpt_prt(mpt, "Unable to allocate CAM SIM!\n"); cam_simq_free(devq); @@ -374,7 +374,7 @@ * Create a "bus" to export all hidden disks to CAM. */ mpt->phydisk_sim = - mpt_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, 1, 1, devq); + mpt_sim_alloc(mpt_action, mpt_poll, "mpt", mpt, 1, maxq, devq); if (mpt->phydisk_sim == NULL) { mpt_prt(mpt, "Unable to allocate Physical Disk CAM SIM!\n"); error = ENOMEM; ==== //depot/projects/soc2007/rpaulo-macbook/dev/sound/pci/hda/hdac.c#7 (text+ko) ==== @@ -80,10 +80,10 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20070611_0045" +#define HDA_DRV_TEST_REV "20070619_0045" #define HDA_WIDGET_PARSER_REV 1 -SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/hda/hdac.c,v 1.41 2007/06/14 11:13:38 ariff Exp $"); +SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/hda/hdac.c,v 1.42 2007/06/18 22:39:27 ariff Exp $"); #define HDA_BOOTVERBOSE(stmt) do { \ if (bootverbose != 0 || snd_verbose > 3) { \ @@ -257,6 +257,7 @@ /* Uniwill ? */ #define UNIWILL_VENDORID 0x1584 #define UNIWILL_9075_SUBVENDOR HDA_MODEL_CONSTRUCT(UNIWILL, 0x9075) +#define UNIWILL_9080_SUBVENDOR HDA_MODEL_CONSTRUCT(UNIWILL, 0x9080) /* Misc constants.. */ @@ -635,6 +636,8 @@ 0, 0, -1, 20, { 21, -1 }, -1 }, { ACER_3681WXM_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, 0, 0, -1, 20, { 21, -1 }, -1 }, + { UNIWILL_9080_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, + 0, 0, -1, 20, { 21, -1 }, -1 }, { MSI_MS1034_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL, 0, 0, -1, 20, { 27, -1 }, -1 }, /* ==== //depot/projects/soc2007/rpaulo-macbook/dev/sound/pcm/feeder.c#4 (text+ko) ==== @@ -28,7 +28,7 @@ #include "feeder_if.h" -SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.43 2007/06/16 03:37:28 ariff Exp $"); +SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.44 2007/06/17 15:53:11 ariff Exp $"); MALLOC_DEFINE(M_FEEDER, "feeder", "pcm feeder"); @@ -117,7 +117,7 @@ /* initialize unit numbering */ snd_unit_init(); if (snd_unit < 0 || snd_unit > PCMMAXUNIT) - snd_unit = 0; + snd_unit = -1; if (snd_maxautovchans < 0 || snd_maxautovchans > SND_MAXVCHANS) ==== //depot/projects/soc2007/rpaulo-macbook/dev/sound/pcm/sound.c#4 (text+ko) ==== @@ -35,17 +35,22 @@ #include "feeder_if.h" -SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/sound.c,v 1.116 2007/06/16 03:37:28 ariff Exp $"); +SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/sound.c,v 1.119 2007/06/17 19:02:05 ariff Exp $"); devclass_t pcm_devclass; int pcm_veto_load = 1; #ifdef USING_DEVFS -int snd_unit = 0; +int snd_unit = -1; TUNABLE_INT("hw.snd.default_unit", &snd_unit); #endif +static int snd_unit_auto = 0; +TUNABLE_INT("hw.snd.default_auto", &snd_unit_auto); +SYSCTL_INT(_hw_snd, OID_AUTO, default_auto, CTLFLAG_RW, + &snd_unit_auto, 0, "assign default unit to a newly attached device"); + int snd_maxautovchans = 16; /* XXX: a tunable implies that we may need more than one sound channel before the system can change a sysctl (/etc/sysctl.conf), do we really need @@ -801,6 +806,9 @@ pcm_unlock(d); + if (snd_unit < 0 || snd_unit_auto != 0) + snd_unit = device_get_unit(dev); + return (0); } @@ -1199,8 +1207,10 @@ if (snd_unit == device_get_unit(dev)) { /* - * Reassign default unit to the next available dev. + * Reassign default unit to the next available dev, but + * first, reset snd_unit to something ridiculous. */ + snd_unit = -1; for (i = 0; pcm_devclass != NULL && i < devclass_get_maxunit(pcm_devclass); i++) { if (device_get_unit(dev) == i) ==== //depot/projects/soc2007/rpaulo-macbook/dev/sound/usb/uaudio.c#5 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: uaudio.c,v 1.91 2004/11/05 17:46:14 kent Exp $ */ -/* $FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.34 2007/06/16 03:37:28 ariff Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.36 2007/06/20 05:11:37 imp Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -98,6 +98,7 @@ #include "feeder_if.h" #endif +#include <dev/usb/usb_port.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> @@ -117,8 +118,8 @@ #endif /* #define UAUDIO_MULTIPLE_ENDPOINTS */ #ifdef USB_DEBUG -#define DPRINTF(x) do { if (uaudiodebug) logprintf x; } while (0) -#define DPRINTFN(n,x) do { if (uaudiodebug>(n)) logprintf x; } while (0) +#define DPRINTF(x) do { if (uaudiodebug) printf x; } while (0) +#define DPRINTFN(n,x) do { if (uaudiodebug>(n)) printf x; } while (0) int uaudiodebug = 0; #if defined(__FreeBSD__) SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); @@ -913,17 +914,17 @@ int cc, i, first; cc = UGETW(cl->wChannelConfig); - logprintf("cluster: bNrChannels=%u wChannelConfig=0x%.4x", + printf("cluster: bNrChannels=%u wChannelConfig=0x%.4x", cl->bNrChannels, cc); first = TRUE; for (i = 0; cc != 0; i++) { if (cc & 1) { - logprintf("%c%s", first ? '<' : ',', channel_names[i]); + printf("%c%s", first ? '<' : ',', channel_names[i]); first = FALSE; } cc = cc >> 1; } - logprintf("> iChannelNames=%u", cl->iChannelNames); + printf("> iChannelNames=%u", cl->iChannelNames); } #endif @@ -2353,79 +2354,79 @@ if (iot[i].d.desc == NULL) continue; - logprintf("id %d:\t", i); + printf("id %d:\t", i); switch (iot[i].d.desc->bDescriptorSubtype) { case UDESCSUB_AC_INPUT: - logprintf("AC_INPUT type=%s\n", uaudio_get_terminal_name + printf("AC_INPUT type=%s\n", uaudio_get_terminal_name (UGETW(iot[i].d.it->wTerminalType))); - logprintf("\t"); + printf("\t"); cluster = uaudio_get_cluster(i, iot); uaudio_dump_cluster(&cluster); - logprintf("\n"); + printf("\n"); break; case UDESCSUB_AC_OUTPUT: - logprintf("AC_OUTPUT type=%s ", uaudio_get_terminal_name + printf("AC_OUTPUT type=%s ", uaudio_get_terminal_name (UGETW(iot[i].d.ot->wTerminalType))); - logprintf("src=%d\n", iot[i].d.ot->bSourceId); + printf("src=%d\n", iot[i].d.ot->bSourceId); break; case UDESCSUB_AC_MIXER: - logprintf("AC_MIXER src="); + printf("AC_MIXER src="); for (j = 0; j < iot[i].d.mu->bNrInPins; j++) - logprintf("%d ", iot[i].d.mu->baSourceId[j]); - logprintf("\n\t"); + printf("%d ", iot[i].d.mu->baSourceId[j]); + printf("\n\t"); cluster = uaudio_get_cluster(i, iot); uaudio_dump_cluster(&cluster); - logprintf("\n"); + printf("\n"); break; case UDESCSUB_AC_SELECTOR: - logprintf("AC_SELECTOR src="); + printf("AC_SELECTOR src="); for (j = 0; j < iot[i].d.su->bNrInPins; j++) - logprintf("%d ", iot[i].d.su->baSourceId[j]); - logprintf("\n"); + printf("%d ", iot[i].d.su->baSourceId[j]); + printf("\n"); break; case UDESCSUB_AC_FEATURE: - logprintf("AC_FEATURE src=%d\n", iot[i].d.fu->bSourceId); + printf("AC_FEATURE src=%d\n", iot[i].d.fu->bSourceId); break; case UDESCSUB_AC_PROCESSING: - logprintf("AC_PROCESSING src="); + printf("AC_PROCESSING src="); for (j = 0; j < iot[i].d.pu->bNrInPins; j++) - logprintf("%d ", iot[i].d.pu->baSourceId[j]); - logprintf("\n\t"); + printf("%d ", iot[i].d.pu->baSourceId[j]); + printf("\n\t"); cluster = uaudio_get_cluster(i, iot); uaudio_dump_cluster(&cluster); - logprintf("\n"); + printf("\n"); break; case UDESCSUB_AC_EXTENSION: - logprintf("AC_EXTENSION src="); + printf("AC_EXTENSION src="); for (j = 0; j < iot[i].d.eu->bNrInPins; j++) - logprintf("%d ", iot[i].d.eu->baSourceId[j]); - logprintf("\n\t"); + printf("%d ", iot[i].d.eu->baSourceId[j]); + printf("\n\t"); cluster = uaudio_get_cluster(i, iot); uaudio_dump_cluster(&cluster); - logprintf("\n"); + printf("\n"); break; default: - logprintf("unknown audio control (subtype=%d)\n", + printf("unknown audio control (subtype=%d)\n", iot[i].d.desc->bDescriptorSubtype); } for (j = 0; j < iot[i].inputs_size; j++) { int k; - logprintf("\tinput%d: ", j); + printf("\tinput%d: ", j); tml = iot[i].inputs[j]; if (tml == NULL) { - logprintf("NULL\n"); + printf("NULL\n"); continue; } for (k = 0; k < tml->size; k++) - logprintf("%s ", uaudio_get_terminal_name + printf("%s ", uaudio_get_terminal_name (tml->terminals[k])); - logprintf("\n"); + printf("\n"); } - logprintf("\toutput: "); + printf("\toutput: "); tml = iot[i].output; for (j = 0; j < tml->size; j++) - logprintf("%s ", uaudio_get_terminal_name(tml->terminals[j])); - logprintf("\n"); + printf("%s ", uaudio_get_terminal_name(tml->terminals[j])); + printf("\n"); } #endif ==== //depot/projects/soc2007/rpaulo-macbook/dev/syscons/scgfbrndr.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/syscons/scgfbrndr.c,v 1.23 2005/09/28 14:54:07 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/syscons/scgfbrndr.c,v 1.24 2007/06/18 22:15:17 marius Exp $"); #include "opt_syscons.h" #include "opt_gfb.h" @@ -105,12 +105,38 @@ #endif /* SC_NO_MODE_CHANGE */ #ifndef SC_NO_CUTPASTE - +#ifdef __sparc64__ +static u_char mouse_pointer[22 * 2] = { + 0x00, 0x00, /* ............ */ + 0x80, 0x00, /* *........... */ + 0xc0, 0x00, /* **.......... */ + 0xe0, 0x00, /* ***......... */ + 0xf0, 0x00, /* ****........ */ + 0xf8, 0x00, /* *****....... */ + 0xfc, 0x00, /* ******...... */ + 0xfe, 0x00, /* *******..... */ + 0xff, 0x00, /* ********.... */ + 0xff, 0x80, /* *********... */ + 0xfc, 0xc0, /* ******..**.. */ + 0xdc, 0x00, /* **.***...... */ + 0x8e, 0x00, /* *...***..... */ + 0x0e, 0x00, /* ....***..... */ + 0x07, 0x00, /* .....***.... */ + 0x04, 0x00, /* .....*...... */ + 0x00, 0x00, /* ............ */ + 0x00, 0x00, /* ............ */ + 0x00, 0x00, /* ............ */ + 0x00, 0x00, /* ............ */ + 0x00, 0x00, /* ............ */ + 0x00, 0x00 /* ............ */ +}; +#else static u_char mouse_pointer[16] = { 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 }; #endif +#endif static void gfb_nop(scr_stat *scp) @@ -317,6 +343,10 @@ static void gfb_mouse(scr_stat *scp, int x, int y, int on) { +#ifdef __sparc64__ + (*vidsw[scp->sc->adapter]->putm)(scp->sc->adp, x, y, + mouse_pointer, on ? 0xffffffff : 0x0, 22, 12); +#else int i, pos; if (on) { @@ -337,6 +367,7 @@ if (x < scp->ysize - 1) (*scp->rndr->draw)(scp, pos + scp->xsize, i, FALSE); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706221554.l5MFs6mQ019032>