xref: /netbsd-src/usr.sbin/acpitools/aml/aml_name.h (revision 3eb244d801190b3a7d8cd42193c38a77c1dbae1a)
1 /*	$NetBSD: aml_name.h,v 1.3 2011/07/17 20:54:55 joerg Exp $	*/
2 
3 /*-
4  * Copyright (c) 1999 Takanori Watanabe
5  * Copyright (c) 1999, 2000 Yasuo Yokoyama
6  * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  *	Id: aml_name.h,v 1.17 2000/08/16 18:14:54 iwasaki Exp
31  *	$FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_name.h,v 1.2 2000/11/09 06:24:45 iwasaki Exp $
32  */
33 
34 #ifndef _AML_NAME_H_
35 #define _AML_NAME_H_
36 
37 #include <stdarg.h>
38 
39 #include <aml/aml_obj.h>
40 
41 struct aml_name {
42 	char	name[4];
43 	union	aml_object *property;
44 	struct	aml_name *parent;
45 	struct	aml_name *brother;
46 	struct	aml_name *child;
47 	struct	aml_name *chain;
48 };
49 
50 #define AML_NAME_GROUP_ROOT		0
51 #define AML_NAME_GROUP_OS_DEFINED	1
52 #define AML_NAME_GROUP_IN_METHOD	2
53 
54 struct	aml_name_group {
55 	void	*id;			/* DSDT address or DBHANDLE */
56 	struct	aml_name *head;
57 	struct	aml_name_group *next;
58 };
59 
60 struct	aml_local_stack {
61 	struct	aml_name localvalue[8];
62 	struct	aml_name argumentvalue[7];
63 	struct	aml_name *temporary;
64 	struct	aml_local_stack *next;
65 };
66 
67 /* forward declarement */
68 struct aml_envrion;
69 
70 struct aml_name		*aml_get_rootname(void);
71 struct aml_name_group	*aml_new_name_group(void *);
72 void			 aml_delete_name_group(struct aml_name_group *);
73 
74 struct aml_name		*aml_find_from_namespace(struct aml_name *, const char *);
75 void			 aml_apply_foreach_found_objects(struct aml_name *,
76 			     char *, int (*)(struct aml_name *, va_list), ...);
77 struct aml_name		*aml_search_name(struct aml_environ *, const u_int8_t *);
78 struct aml_name		*aml_create_name(struct aml_environ *, const u_int8_t *);
79 
80 struct aml_local_stack	*aml_local_stack_create(void);
81 void			 aml_local_stack_push(struct aml_local_stack *);
82 struct aml_local_stack	*aml_local_stack_pop(void);
83 void			 aml_local_stack_delete(struct aml_local_stack *);
84 struct aml_name		*aml_local_stack_getLocalX(int);
85 struct aml_name		*aml_local_stack_getArgX(struct aml_local_stack *, int);
86 struct aml_name		*aml_create_local_object(void);
87 
88 extern struct	aml_name_group *name_group_list;
89 
90 #endif /* !_AML_NAME_H_ */
91