xref: /netbsd-src/usr.sbin/acpitools/aml/aml_name.h (revision 3eb244d801190b3a7d8cd42193c38a77c1dbae1a)
1*3eb244d8Sjoerg /*	$NetBSD: aml_name.h,v 1.3 2011/07/17 20:54:55 joerg Exp $	*/
253e202c1Schristos 
353e202c1Schristos /*-
453e202c1Schristos  * Copyright (c) 1999 Takanori Watanabe
553e202c1Schristos  * Copyright (c) 1999, 2000 Yasuo Yokoyama
653e202c1Schristos  * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
753e202c1Schristos  * All rights reserved.
853e202c1Schristos  *
953e202c1Schristos  * Redistribution and use in source and binary forms, with or without
1053e202c1Schristos  * modification, are permitted provided that the following conditions
1153e202c1Schristos  * are met:
1253e202c1Schristos  * 1. Redistributions of source code must retain the above copyright
1353e202c1Schristos  *    notice, this list of conditions and the following disclaimer.
1453e202c1Schristos  * 2. Redistributions in binary form must reproduce the above copyright
1553e202c1Schristos  *    notice, this list of conditions and the following disclaimer in the
1653e202c1Schristos  *    documentation and/or other materials provided with the distribution.
1753e202c1Schristos  *
1853e202c1Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1953e202c1Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2053e202c1Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2153e202c1Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2253e202c1Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2353e202c1Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2453e202c1Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2553e202c1Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2653e202c1Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2753e202c1Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2853e202c1Schristos  * SUCH DAMAGE.
2953e202c1Schristos  *
3053e202c1Schristos  *	Id: aml_name.h,v 1.17 2000/08/16 18:14:54 iwasaki Exp
3153e202c1Schristos  *	$FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_name.h,v 1.2 2000/11/09 06:24:45 iwasaki Exp $
3253e202c1Schristos  */
3353e202c1Schristos 
3453e202c1Schristos #ifndef _AML_NAME_H_
3553e202c1Schristos #define _AML_NAME_H_
3653e202c1Schristos 
37*3eb244d8Sjoerg #include <stdarg.h>
3853e202c1Schristos 
3953e202c1Schristos #include <aml/aml_obj.h>
4053e202c1Schristos 
4153e202c1Schristos struct aml_name {
4253e202c1Schristos 	char	name[4];
4353e202c1Schristos 	union	aml_object *property;
4453e202c1Schristos 	struct	aml_name *parent;
4553e202c1Schristos 	struct	aml_name *brother;
4653e202c1Schristos 	struct	aml_name *child;
4753e202c1Schristos 	struct	aml_name *chain;
4853e202c1Schristos };
4953e202c1Schristos 
5053e202c1Schristos #define AML_NAME_GROUP_ROOT		0
5153e202c1Schristos #define AML_NAME_GROUP_OS_DEFINED	1
5253e202c1Schristos #define AML_NAME_GROUP_IN_METHOD	2
5353e202c1Schristos 
5453e202c1Schristos struct	aml_name_group {
557ac7d15dSdogcow 	void	*id;			/* DSDT address or DBHANDLE */
5653e202c1Schristos 	struct	aml_name *head;
5753e202c1Schristos 	struct	aml_name_group *next;
5853e202c1Schristos };
5953e202c1Schristos 
6053e202c1Schristos struct	aml_local_stack {
6153e202c1Schristos 	struct	aml_name localvalue[8];
6253e202c1Schristos 	struct	aml_name argumentvalue[7];
6353e202c1Schristos 	struct	aml_name *temporary;
6453e202c1Schristos 	struct	aml_local_stack *next;
6553e202c1Schristos };
6653e202c1Schristos 
6753e202c1Schristos /* forward declarement */
6853e202c1Schristos struct aml_envrion;
6953e202c1Schristos 
7053e202c1Schristos struct aml_name		*aml_get_rootname(void);
717ac7d15dSdogcow struct aml_name_group	*aml_new_name_group(void *);
7253e202c1Schristos void			 aml_delete_name_group(struct aml_name_group *);
7353e202c1Schristos 
7453e202c1Schristos struct aml_name		*aml_find_from_namespace(struct aml_name *, const char *);
7553e202c1Schristos void			 aml_apply_foreach_found_objects(struct aml_name *,
7653e202c1Schristos 			     char *, int (*)(struct aml_name *, va_list), ...);
7753e202c1Schristos struct aml_name		*aml_search_name(struct aml_environ *, const u_int8_t *);
7853e202c1Schristos struct aml_name		*aml_create_name(struct aml_environ *, const u_int8_t *);
7953e202c1Schristos 
8053e202c1Schristos struct aml_local_stack	*aml_local_stack_create(void);
8153e202c1Schristos void			 aml_local_stack_push(struct aml_local_stack *);
8253e202c1Schristos struct aml_local_stack	*aml_local_stack_pop(void);
8353e202c1Schristos void			 aml_local_stack_delete(struct aml_local_stack *);
8453e202c1Schristos struct aml_name		*aml_local_stack_getLocalX(int);
8553e202c1Schristos struct aml_name		*aml_local_stack_getArgX(struct aml_local_stack *, int);
8653e202c1Schristos struct aml_name		*aml_create_local_object(void);
8753e202c1Schristos 
8853e202c1Schristos extern struct	aml_name_group *name_group_list;
8953e202c1Schristos 
9053e202c1Schristos #endif /* !_AML_NAME_H_ */
91