Deleted Added
full compact
acpi_video.c (126430) acpi_video.c (126560)
1/*-
2 * Copyright (c) 2002-2003 Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: acpi_vid.c,v 1.4 2003/10/13 10:07:36 taku Exp $
1/*-
2 * Copyright (c) 2002-2003 Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: acpi_vid.c,v 1.4 2003/10/13 10:07:36 taku Exp $
27 * $FreeBSD: head/sys/dev/acpica/acpi_video.c 126430 2004-03-01 08:12:56Z njl $
27 * $FreeBSD: head/sys/dev/acpica/acpi_video.c 126560 2004-03-03 18:34:42Z njl $
28 */
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/malloc.h>
33#include <sys/bus.h>
34#include <sys/power.h>
35#include <sys/queue.h>

--- 688 unchanged lines hidden (view full) ---

724 && ACPI_SUCCESS(AcpiGetType(h_dos, &t_dos))
725 && t_dos == ACPI_TYPE_METHOD);
726}
727
728static void
729vid_set_switch_policy(ACPI_HANDLE handle, UINT32 policy)
730{
731 ACPI_STATUS status;
28 */
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/malloc.h>
33#include <sys/bus.h>
34#include <sys/power.h>
35#include <sys/queue.h>

--- 688 unchanged lines hidden (view full) ---

724 && ACPI_SUCCESS(AcpiGetType(h_dos, &t_dos))
725 && t_dos == ACPI_TYPE_METHOD);
726}
727
728static void
729vid_set_switch_policy(ACPI_HANDLE handle, UINT32 policy)
730{
731 ACPI_STATUS status;
732 ACPI_OBJECT_LIST args;
733 ACPI_OBJECT arg1;
734
735 ACPI_ASSERTLOCK;
732
733 ACPI_ASSERTLOCK;
736 arg1.Type = ACPI_TYPE_INTEGER;
737 arg1.Integer.Value = policy;
738 args.Count = 1;
739 args.Pointer = &arg1;
740 status = AcpiEvaluateObject(handle, "_DOS", &args, NULL);
734
735 status = acpi_SetInteger(handle, "_DOS", policy);
741 if (ACPI_FAILURE(status))
742 printf("can't evaluate %s._DOS - %s\n",
743 acpi_name(handle), AcpiFormatException(status));
744}
745
746struct enum_callback_arg {
747 void (*callback)(ACPI_HANDLE, UINT32, void *);
748 void *context;

--- 6 unchanged lines hidden (view full) ---

755{
756 ACPI_STATUS status;
757 ACPI_OBJECT *tmp;
758 UINT32 adr;
759 struct enum_callback_arg *argset;
760 size_t i;
761
762 argset = context;
736 if (ACPI_FAILURE(status))
737 printf("can't evaluate %s._DOS - %s\n",
738 acpi_name(handle), AcpiFormatException(status));
739}
740
741struct enum_callback_arg {
742 void (*callback)(ACPI_HANDLE, UINT32, void *);
743 void *context;

--- 6 unchanged lines hidden (view full) ---

750{
751 ACPI_STATUS status;
752 ACPI_OBJECT *tmp;
753 UINT32 adr;
754 struct enum_callback_arg *argset;
755 size_t i;
756
757 argset = context;
763 status = acpi_EvaluateInteger(handle, "_ADR", &adr);
758 status = acpi_GetInteger(handle, "_ADR", &adr);
764 if (ACPI_SUCCESS(status)) {
765 for (i = 0; i < argset->dod_pkg->Package.Count; i++) {
766 tmp = &argset->dod_pkg->Package.Elements[i];
767 if (tmp != NULL && tmp->Type == ACPI_TYPE_INTEGER &&
768 (tmp->Integer.Value & DOD_DEVID_MASK) == adr) {
769 argset->callback(handle, tmp->Integer.Value,
770 argset->context);
771 (**(int**)retp)++;

--- 106 unchanged lines hidden (view full) ---

878
879 return (num);
880}
881
882static void
883vo_set_brightness(ACPI_HANDLE handle, int level)
884{
885 ACPI_STATUS status;
759 if (ACPI_SUCCESS(status)) {
760 for (i = 0; i < argset->dod_pkg->Package.Count; i++) {
761 tmp = &argset->dod_pkg->Package.Elements[i];
762 if (tmp != NULL && tmp->Type == ACPI_TYPE_INTEGER &&
763 (tmp->Integer.Value & DOD_DEVID_MASK) == adr) {
764 argset->callback(handle, tmp->Integer.Value,
765 argset->context);
766 (**(int**)retp)++;

--- 106 unchanged lines hidden (view full) ---

873
874 return (num);
875}
876
877static void
878vo_set_brightness(ACPI_HANDLE handle, int level)
879{
880 ACPI_STATUS status;
886 ACPI_OBJECT_LIST args;
887 ACPI_OBJECT arg1;
888
889 ACPI_ASSERTLOCK;
881
882 ACPI_ASSERTLOCK;
890 arg1.Type = ACPI_TYPE_INTEGER;
891 arg1.Integer.Value = level;
892 args.Count = 1;
893 args.Pointer = &arg1;
894 status = AcpiEvaluateObject(handle, "_BCM", &args, NULL);
883
884 status = acpi_SetInteger(handle, "_BCM", level);
895 if (ACPI_FAILURE(status))
896 printf("can't evaluate %s._BCM - %s\n",
897 acpi_name(handle), AcpiFormatException(status));
898}
899
900static UINT32
901vo_get_device_status(ACPI_HANDLE handle)
902{
903 UINT32 dcs = 0;
904 ACPI_STATUS status;
905
906 ACPI_ASSERTLOCK;
885 if (ACPI_FAILURE(status))
886 printf("can't evaluate %s._BCM - %s\n",
887 acpi_name(handle), AcpiFormatException(status));
888}
889
890static UINT32
891vo_get_device_status(ACPI_HANDLE handle)
892{
893 UINT32 dcs = 0;
894 ACPI_STATUS status;
895
896 ACPI_ASSERTLOCK;
907 status = acpi_EvaluateInteger(handle, "_DCS", &dcs);
897 status = acpi_GetInteger(handle, "_DCS", &dcs);
908 if (ACPI_FAILURE(status))
909 printf("can't evaluate %s._DCS - %s\n",
910 acpi_name(handle), AcpiFormatException(status));
911
912 return (dcs);
913}
914
915static UINT32
916vo_query_graphics_state(ACPI_HANDLE handle)
917{
918 UINT32 dgs = 0;
919 ACPI_STATUS status;
920
921 ACPI_ASSERTLOCK;
898 if (ACPI_FAILURE(status))
899 printf("can't evaluate %s._DCS - %s\n",
900 acpi_name(handle), AcpiFormatException(status));
901
902 return (dcs);
903}
904
905static UINT32
906vo_query_graphics_state(ACPI_HANDLE handle)
907{
908 UINT32 dgs = 0;
909 ACPI_STATUS status;
910
911 ACPI_ASSERTLOCK;
922 status = acpi_EvaluateInteger(handle, "_DGS", &dgs);
912 status = acpi_GetInteger(handle, "_DGS", &dgs);
923 if (ACPI_FAILURE(status))
924 printf("can't evaluate %s._DGS - %s\n",
925 acpi_name(handle), AcpiFormatException(status));
926
927 return (dgs);
928}
929
930static void
931vo_set_device_state(ACPI_HANDLE handle, UINT32 state)
932{
933 ACPI_STATUS status;
913 if (ACPI_FAILURE(status))
914 printf("can't evaluate %s._DGS - %s\n",
915 acpi_name(handle), AcpiFormatException(status));
916
917 return (dgs);
918}
919
920static void
921vo_set_device_state(ACPI_HANDLE handle, UINT32 state)
922{
923 ACPI_STATUS status;
934 ACPI_OBJECT_LIST args;
935 ACPI_OBJECT arg1;
936
937 ACPI_ASSERTLOCK;
924
925 ACPI_ASSERTLOCK;
938 arg1.Type = ACPI_TYPE_INTEGER;
939 arg1.Integer.Value = state;
940 args.Count = 1;
941 args.Pointer = &arg1;
942 status = AcpiEvaluateObject(handle, "_DSS", &args, NULL);
926
927 status = acpi_SetInteger(handle, "_DSS", state);
943 if (ACPI_FAILURE(status))
944 printf("can't evaluate %s._DSS - %s\n",
945 acpi_name(handle), AcpiFormatException(status));
946}
928 if (ACPI_FAILURE(status))
929 printf("can't evaluate %s._DSS - %s\n",
930 acpi_name(handle), AcpiFormatException(status));
931}