4 * Copyright (c) 1999 Takanori Watanabe
5 * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Id: aml_obj.h,v 1.15 2000/08/09 14:47:43 iwasaki Exp
30 * $FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_obj.h,v 1.1 2000/08/24 09:33:08 takawata Exp $
36 #include <sys/queue.h>
63 enum aml_objtype type
; /* =aml_t_namestr */
68 enum aml_objtype type
;
75 enum aml_objtype type
; /* =aml_t_num */
81 enum aml_objtype type
;
83 union aml_object
**objects
;
87 enum aml_objtype type
; /* =aml_t_string */
93 enum aml_objtype type
; /* =aml_t_buffer */
95 u_int8_t
*data
; /* This should be free when
96 * this object is free.
107 enum fieldtype ftype
; /* f_t_field */
108 u_int8_t
*regname
; /* Namestring */
112 enum fieldtype ftype
; /* f_t_index */
118 enum fieldtype ftype
; /* f_t_bank */
125 enum aml_objtype type
;
127 int bitoffset
; /* Not Byte offset but bitoffset */
130 enum fieldtype ftype
;
137 struct aml_bufferfield
{
138 enum aml_objtype type
; /* aml_t_bufferfield */
141 u_int8_t
*origin
; /* This should not be free
142 * when this object is free
143 * (Within Buffer object)
148 enum aml_objtype type
;
149 int argnum
; /* Not argnum but argnum|frag */
154 struct aml_powerres
{
155 enum aml_objtype type
;
160 struct aml_processor
{
161 enum aml_objtype type
;
167 struct aml_mutex_queue
{
168 STAILQ_ENTRY(aml_mutex_queue
) entry
;
172 enum aml_objtype type
;
174 volatile void *cookie
; /* In kernel, struct proc? */
175 STAILQ_HEAD(, aml_mutex_queue
) queue
;
179 enum aml_objtype type
;
180 struct aml_name
*nameref
;
181 union aml_object
*ref
;
182 int offset
; /* of aml_buffer.data or aml_package.objects. */
183 /* if negative value, not ready to dereference for element access. */
184 unsigned deref
; /* indicates whether dereffenced or not */
185 unsigned alias
; /* true if this is an alias object reference */
188 struct aml_regfield
{
189 enum aml_objtype type
;
198 enum aml_objtype type
; /* aml_t_event */
203 enum aml_objtype type
;
205 struct aml_processor proc
;
206 struct aml_powerres pres
;
207 struct aml_opregion opregion
;
208 struct aml_method meth
;
209 struct aml_field field
;
210 struct aml_mutex mutex
;
211 struct aml_namestr nstr
;
212 struct aml_buffer buffer
;
213 struct aml_bufferfield bfld
;
214 struct aml_package package
;
215 struct aml_string str
;
216 struct aml_objref objref
;
217 struct aml_event event
;
218 struct aml_regfield regfield
;
221 union aml_object
*aml_copy_object(struct aml_environ
*,
223 union aml_object
*aml_alloc_object(enum aml_objtype
,
225 void aml_free_objectcontent(union aml_object
*);
226 void aml_free_object(union aml_object
**);
227 void aml_realloc_object(union aml_object
*, int);
229 #endif /* !_AML_OBJ_H_ */