Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Introduce acpi_eval_reference_handle() --



details:   https://anonhg.NetBSD.org/src/rev/bb2be06bef82
branches:  trunk
changeset: 750907:bb2be06bef82
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Jan 18 18:06:31 2010 +0000

description:
Introduce acpi_eval_reference_handle() --

an utility function to evaluate reference handles from package elements.

ok jmcneill@, pgoyette@

diffstat:

 sys/dev/acpi/acpi.c    |  36 ++++++++++++++++++++++++++++++++++--
 sys/dev/acpi/acpivar.h |   3 ++-
 2 files changed, 36 insertions(+), 3 deletions(-)

diffs (74 lines):

diff -r bec5263f3ad8 -r bb2be06bef82 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon Jan 18 17:53:35 2010 +0000
+++ b/sys/dev/acpi/acpi.c       Mon Jan 18 18:06:31 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.145 2010/01/18 17:34:37 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.146 2010/01/18 18:06:31 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.145 2010/01/18 17:34:37 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.146 2010/01/18 18:06:31 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -1251,6 +1251,38 @@
 }
 
 /*
+ * acpi_eval_reference_handle:
+ *
+ *     Evaluate a reference handle from an element in a package.
+ */
+ACPI_STATUS
+acpi_eval_reference_handle(ACPI_OBJECT *elm, ACPI_HANDLE *handle)
+{
+
+       if (elm == NULL || handle == NULL)
+               return AE_BAD_PARAMETER;
+
+       switch (elm->Type) {
+
+       case ACPI_TYPE_ANY:
+       case ACPI_TYPE_LOCAL_REFERENCE:
+
+               if (elm->Reference.Handle == NULL)
+                       return AE_NULL_ENTRY;
+
+               *handle = elm->Reference.Handle;
+
+               return AE_OK;
+
+       case ACPI_TYPE_STRING:
+               return AcpiGetHandle(NULL, elm->String.Pointer, handle);
+
+       default:
+               return AE_TYPE;
+       }
+}
+
+/*
  * acpi_foreach_package_object:
  *
  *     Iterate over all objects in a in a packages and pass then all
diff -r bec5263f3ad8 -r bb2be06bef82 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h    Mon Jan 18 17:53:35 2010 +0000
+++ b/sys/dev/acpi/acpivar.h    Mon Jan 18 18:06:31 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpivar.h,v 1.38 2009/11/29 21:32:50 cegger Exp $      */
+/*     $NetBSD: acpivar.h,v 1.39 2010/01/18 18:06:31 jruoho Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -271,6 +271,7 @@
                    ACPI_INTEGER arg);
 ACPI_STATUS    acpi_eval_string(ACPI_HANDLE, const char *, char **);
 ACPI_STATUS    acpi_eval_struct(ACPI_HANDLE, const char *, ACPI_BUFFER *);
+ACPI_STATUS    acpi_eval_reference_handle(ACPI_OBJECT *, ACPI_HANDLE *);
 
 ACPI_STATUS    acpi_foreach_package_object(ACPI_OBJECT *,
                    ACPI_STATUS (*)(ACPI_OBJECT *, void *), void *);



Home | Main Index | Thread Index | Old Index