Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2008 21:22:16 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 133201 for review
Message-ID:  <200801132122.m0DLMGaI008173@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <taku@cent.saitama-u.ac.jp>
- * Copyright (c) 2004 Benjamin Close <Benjamin.Close@clearchain.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,33 +37,10 @@
 #include <sys/power.h>
 #include <sys/queue.h>
 #include <sys/sysctl.h>
-#ifdef __i386__
-#include <machine/vm86.h>
-#endif
 
 #include <contrib/dev/acpica/acpi.h>
 #include <dev/acpica/acpivar.h>
 
-#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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801132122.m0DLMGaI008173>