From owner-p4-projects@FreeBSD.ORG Sun Jan 13 21:22:16 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BB51216A419; Sun, 13 Jan 2008 21:22:16 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 681A216A417 for ; Sun, 13 Jan 2008 21:22:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4DA7613C447 for ; Sun, 13 Jan 2008 21:22:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0DLMG8h008177 for ; Sun, 13 Jan 2008 21:22:16 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0DLMGaI008173 for perforce@freebsd.org; Sun, 13 Jan 2008 21:22:16 GMT (envelope-from jhb@freebsd.org) Date: Sun, 13 Jan 2008 21:22:16 GMT Message-Id: <200801132122.m0DLMGaI008173@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 133201 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jan 2008 21:22:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=133201 Change 133201 by jhb@jhb_mutex on 2008/01/13 21:22:13 Move the DPMS patches out of the acpi_video(4) driver and into a new i386-only dpms(4) module/driver. Affected files ... .. //depot/projects/power/notes#13 edit .. //depot/projects/power/sys/dev/acpica/acpi_video.c#7 edit .. //depot/user/jhb/acpipci/conf/files.i386#97 edit .. //depot/user/jhb/acpipci/i386/isa/dpms.c#1 add .. //depot/user/jhb/acpipci/modules/Makefile#98 edit .. //depot/user/jhb/acpipci/modules/dpms/Makefile#1 add Differences ... ==== //depot/projects/power/notes#13 (text+ko) ==== @@ -72,8 +72,6 @@ Other stuff: -- Make the DPMS support in acpi_video a separate driver that attaches to - vgapci0 - Automated idle device power management - Basic idea is that when a device is idle for a specified amount of time, it should power down into D1 or D2. For example, NICs can power down ==== //depot/projects/power/sys/dev/acpica/acpi_video.c#7 (text+ko) ==== @@ -1,6 +1,5 @@ /*- * Copyright (c) 2002-2003 Taku YAMAMOTO - * Copyright (c) 2004 Benjamin Close * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,33 +37,10 @@ #include #include #include -#ifdef __i386__ -#include -#endif #include #include -#ifdef __i386__ -#define USE_DPMS - -/* - * VESA DPMS States - */ -#define DPMS_ON 0x00 -#define DPMS_STANDBY 0x01 -#define DPMS_SUSPEND 0x02 -#define DPMS_OFF 0x04 -#define DPMS_REDUCEDON 0x08 - -#define VBE_DPMS_FUNCTION 0x4F10 -#define VBE_DPMS_GET_SUPPORTED_STATES 0x00 -#define VBE_DPMS_GET_STATE 0x02 -#define VBE_DPMS_SET_STATE 0x01 -#define VBE_MAJORVERSION_MASK 0x0F -#define VBE_MINORVERSION_MASK 0xF0 -#endif - /* ACPI video extension driver. */ struct acpi_video_output { ACPI_HANDLE handle; @@ -90,10 +66,6 @@ ACPI_HANDLE handle; struct acpi_video_output_queue vid_outputs; eventhandler_tag vid_pwr_evh; -#ifdef USE_DPMS - int vid_dpms_supported_states; - int vid_dpms_initial_state; -#endif }; /* interfaces */ @@ -103,8 +75,6 @@ static int acpi_video_attach(device_t); static int acpi_video_detach(device_t); static int acpi_video_shutdown(device_t); -static int acpi_video_suspend(device_t); -static int acpi_video_resume(device_t); static void acpi_video_notify_handler(ACPI_HANDLE, UINT32, void *); static void acpi_video_power_profile(void *); static void acpi_video_bind_outputs(struct acpi_video_softc *); @@ -126,11 +96,6 @@ static UINT32 vo_get_device_status(ACPI_HANDLE); static UINT32 vo_get_graphics_state(ACPI_HANDLE); static void vo_set_device_state(ACPI_HANDLE, UINT32); -#ifdef USE_DPMS -static int dpms_get_supported_states(int *); -static int dpms_get_current_state(int *); -static int dpms_set_state(int); -#endif /* events */ #define VID_NOTIFY_SWITCHED 0x80 @@ -184,8 +149,6 @@ DEVMETHOD(device_attach, acpi_video_attach), DEVMETHOD(device_detach, acpi_video_detach), DEVMETHOD(device_shutdown, acpi_video_shutdown), - DEVMETHOD(device_resume, acpi_video_resume), - DEVMETHOD(device_suspend, acpi_video_suspend), { 0, 0 } }; @@ -301,13 +264,6 @@ acpi_video_power_profile(sc); -#ifdef USE_DPMS - if (dpms_get_supported_states(&sc->vid_dpms_supported_states) == 0) - dpms_get_current_state(&sc->vid_dpms_initial_state); - else - sc->vid_dpms_supported_states = -1; -#endif - return (0); } @@ -345,32 +301,6 @@ return (0); } -static int -acpi_video_suspend(device_t dev) -{ - struct acpi_video_softc *sc; - - sc = device_get_softc(dev); -#ifdef USE_DPMS - if (sc->vid_dpms_supported_states != -1) - dpms_set_state(DPMS_OFF); -#endif - return (0); -} - -static int -acpi_video_resume(device_t dev) -{ - struct acpi_video_softc *sc; - - sc = device_get_softc(dev); -#ifdef USE_DPMS - if (sc->vid_dpms_supported_states != -1) - dpms_set_state(sc->vid_dpms_initial_state); -#endif - return (0); -} - static void acpi_video_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context) { @@ -1008,48 +938,3 @@ printf("can't evaluate %s._DSS - %s\n", acpi_name(handle), AcpiFormatException(status)); } - -#ifdef USE_DPMS -static int -dpms_call_bios(int subfunction, int *bh) -{ - struct vm86frame vmf; - int error; - - bzero(&vmf, sizeof(vmf)); - vmf.vmf_ax = VBE_DPMS_FUNCTION; - vmf.vmf_bl = subfunction; - vmf.vmf_bh = *bh; - vmf.vmf_es = 0; - vmf.vmf_di = 0; - error = vm86_intcall(0x10, &vmf); - if (error == 0 && (vmf.vmf_eax & 0xffff) != 0x004f) - error = ENXIO; - if (error == 0) - *bh = vmf.vmf_bh; - return (error); -} - -static int -dpms_get_supported_states(int *states) -{ - - *states = 0; - return (dpms_call_bios(VBE_DPMS_GET_SUPPORTED_STATES, states)); -} - -static int -dpms_get_current_state(int *state) -{ - - *state = 0; - return (dpms_call_bios(VBE_DPMS_GET_STATE, state)); -} - -static int -dpms_set_state(int state) -{ - - return (dpms_call_bios(VBE_DPMS_SET_STATE, &state)); -} -#endif ==== //depot/user/jhb/acpipci/conf/files.i386#97 (text+ko) ==== @@ -346,6 +346,7 @@ i386/isa/atpic.c standard #i386/isa/atpic_vector.s standard i386/isa/clock.c standard +i386/isa/dpms.c optional dpms i386/isa/elcr.c standard i386/isa/elink.c optional ep | ie i386/isa/isa.c optional isa ==== //depot/user/jhb/acpipci/modules/Makefile#98 (text+ko) ==== @@ -70,6 +70,7 @@ dcons_crom \ de \ ${_digi} \ + ${_dpms} \ ${_dpt} \ ${_drm} \ dummynet \ @@ -380,6 +381,7 @@ _cpufreq= cpufreq _cs= cs _digi= digi +_dpms= dpms _drm= drm _ed= ed _elink= elink