Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi - Add an acpi_evaluate_string() to evaluate str...
details: https://anonhg.NetBSD.org/src/rev/c746ecc397ae
branches: trunk
changeset: 515607:c746ecc397ae
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Sep 29 18:13:48 2001 +0000
description:
- Add an acpi_evaluate_string() to evaluate string objects.
- In acpi_print(), try to evaluate the _STR object, and print
it if the device is not configured.
- Make this compile without ACPI_DEBUG, from Masanori Kanaoka.
diffstat:
sys/dev/acpi/acpi.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++--
sys/dev/acpi/acpivar.h | 3 +-
2 files changed, 54 insertions(+), 4 deletions(-)
diffs (102 lines):
diff -r d4a1cfdef34a -r c746ecc397ae sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Sat Sep 29 17:52:10 2001 +0000
+++ b/sys/dev/acpi/acpi.c Sat Sep 29 18:13:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.3 2001/09/29 05:39:14 thorpej Exp $ */
+/* $NetBSD: acpi.c,v 1.4 2001/09/29 18:13:48 thorpej Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -414,7 +414,9 @@
void **status)
{
struct acpi_make_devnode_state *state = context;
+#ifdef ACPI_DEBUG
struct acpi_softc *sc = state->softc;
+#endif
struct acpi_scope *as = state->scope;
struct acpi_devnode *ad;
ACPI_OBJECT_TYPE type;
@@ -474,9 +476,17 @@
acpi_print(void *aux, const char *pnp)
{
struct acpi_attach_args *aa = aux;
+ char *str;
- if (pnp)
- printf("%s at %s", aa->aa_node->ad_devinfo.HardwareId, pnp);
+ if (pnp) {
+ printf("%s ", aa->aa_node->ad_devinfo.HardwareId);
+ if (acpi_eval_string(aa->aa_node->ad_handle,
+ "_STR", &str) == AE_OK) {
+ printf("[%s] ", str);
+ AcpiOsFree(str);
+ }
+ printf("at %s", pnp);
+ }
return (UNCONF);
}
@@ -596,6 +606,45 @@
}
/*
+ * acpi_eval_string:
+ *
+ * Evaluage a (Unicode) string object.
+ */
+ACPI_STATUS
+acpi_eval_string(ACPI_HANDLE handle, char *path, char **stringp)
+{
+ ACPI_STATUS rv;
+ ACPI_BUFFER buf;
+ ACPI_OBJECT param;
+
+ if (handle == NULL)
+ handle = ACPI_ROOT_OBJECT;
+
+ buf.Pointer = NULL;
+ buf.Length = 0;
+
+ rv = AcpiEvaluateObject(handle, path, NULL, &buf);
+ if (rv != AE_BUFFER_OVERFLOW)
+ return (rv);
+
+ buf.Pointer = AcpiOsAllocate(buf.Length);
+ if (buf.Pointer == NULL)
+ return (AE_NO_MEMORY);
+
+ rv = AcpiEvaluateObject(handle, path, NULL, &buf);
+ if (rv == AE_OK) {
+ if (param.Type == ACPI_TYPE_STRING) {
+ *stringp = buf.Pointer;
+ return (AE_OK);
+ }
+ rv = AE_TYPE;
+ }
+
+ AcpiOsFree(buf.Pointer);
+ return (rv);
+}
+
+/*
* acpi_get:
*
* Fetch data info the specified (empty) ACPI buffer.
diff -r d4a1cfdef34a -r c746ecc397ae sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h Sat Sep 29 17:52:10 2001 +0000
+++ b/sys/dev/acpi/acpivar.h Sat Sep 29 18:13:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.2 2001/09/29 05:34:00 thorpej Exp $ */
+/* $NetBSD: acpivar.h,v 1.3 2001/09/29 18:13:48 thorpej Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -245,6 +245,7 @@
int acpi_probe(void);
ACPI_STATUS acpi_eval_integer(ACPI_HANDLE, char *, int *);
+ACPI_STATUS acpi_eval_string(ACPI_HANDLE, char *, char **);
ACPI_STATUS acpi_get(ACPI_HANDLE, ACPI_BUFFER *,
ACPI_STATUS (*)(ACPI_HANDLE, ACPI_BUFFER *));
Home |
Main Index |
Thread Index |
Old Index