xref: /netbsd-src/usr.sbin/acpitools/aml/aml_amlmem.c (revision 53e202c131d0a3f9c7bc2bad453b5dbd42e86fba)
1*53e202c1Schristos /*	$NetBSD: aml_amlmem.c,v 1.1 2007/01/14 04:36:13 christos Exp $	*/
2*53e202c1Schristos 
3*53e202c1Schristos /*-
4*53e202c1Schristos  * Copyright (c) 1999, 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
5*53e202c1Schristos  * All rights reserved.
6*53e202c1Schristos  *
7*53e202c1Schristos  * Redistribution and use in source and binary forms, with or without
8*53e202c1Schristos  * modification, are permitted provided that the following conditions
9*53e202c1Schristos  * are met:
10*53e202c1Schristos  * 1. Redistributions of source code must retain the above copyright
11*53e202c1Schristos  *    notice, this list of conditions and the following disclaimer.
12*53e202c1Schristos  * 2. Redistributions in binary form must reproduce the above copyright
13*53e202c1Schristos  *    notice, this list of conditions and the following disclaimer in the
14*53e202c1Schristos  *    documentation and/or other materials provided with the distribution.
15*53e202c1Schristos  *
16*53e202c1Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*53e202c1Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*53e202c1Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*53e202c1Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*53e202c1Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*53e202c1Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*53e202c1Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*53e202c1Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*53e202c1Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*53e202c1Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*53e202c1Schristos  * SUCH DAMAGE.
27*53e202c1Schristos  *
28*53e202c1Schristos  *	Id: aml_amlmem.c,v 1.15 2000/08/09 14:47:43 iwasaki Exp
29*53e202c1Schristos  *	$FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_amlmem.c,v 1.2 2000/11/09 06:24:45 iwasaki Exp $
30*53e202c1Schristos  */
31*53e202c1Schristos #include <sys/cdefs.h>
32*53e202c1Schristos __RCSID("$NetBSD: aml_amlmem.c,v 1.1 2007/01/14 04:36:13 christos Exp $");
33*53e202c1Schristos 
34*53e202c1Schristos /*
35*53e202c1Schristos  * AML Namespace Memory Management
36*53e202c1Schristos  */
37*53e202c1Schristos 
38*53e202c1Schristos #include <sys/param.h>
39*53e202c1Schristos 
40*53e202c1Schristos #include <acpi_common.h>
41*53e202c1Schristos #include <aml/aml_env.h>
42*53e202c1Schristos #include <aml/aml_memman.h>
43*53e202c1Schristos #include <aml/aml_name.h>
44*53e202c1Schristos 
45*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_namestr, _aml_namestr_storage);
46*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_num, _aml_num_storage);
47*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_string, _aml_string_storage);
48*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_buffer, _aml_buffer_storage);
49*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_package, _aml_package_storage);
50*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_field, _aml_field_storage);
51*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_method, _aml_method_storage);
52*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_mutex, _aml_mutex_storage);
53*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_opregion, _aml_opregion_storage);
54*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_powerres, _aml_powerres_storage);
55*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_processor, _aml_processor_storage);
56*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_bufferfield, _aml_bufferfield_storage);
57*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_event, _aml_event_storage);
58*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(enum aml_objtype, _aml_objtype_storage);
59*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_name, _aml_name_storage);
60*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_name_group, _aml_name_group_storage);
61*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_objref, _aml_objref_storage);
62*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_regfield, _aml_regfield_storage);
63*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_environ, _aml_environ_storage);
64*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_local_stack, _aml_local_stack_storage);
65*53e202c1Schristos MEMMAN_INITIALSTORAGE_DESC(struct aml_mutex_queue, _aml_mutex_queue_storage);
66*53e202c1Schristos 
67*53e202c1Schristos struct	memman_blockman aml_blockman[] = {
68*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_namestr), _aml_namestr_storage),
69*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_num), _aml_num_storage),
70*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_string), _aml_string_storage),
71*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_buffer), _aml_buffer_storage),
72*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_package), _aml_package_storage),
73*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_field), _aml_field_storage),
74*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_method), _aml_method_storage),
75*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_mutex), _aml_mutex_storage),
76*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_opregion), _aml_opregion_storage),
77*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_powerres), _aml_powerres_storage),
78*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_processor), _aml_processor_storage),
79*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_bufferfield), _aml_bufferfield_storage),
80*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_event), _aml_event_storage),
81*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(enum aml_objtype), _aml_objtype_storage),
82*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_name), _aml_name_storage),
83*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_name_group), _aml_name_group_storage),
84*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_objref), _aml_objref_storage),
85*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_regfield), _aml_regfield_storage),
86*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_environ), _aml_environ_storage),
87*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_local_stack), _aml_local_stack_storage),
88*53e202c1Schristos 	MEMMAN_MEMBLOCK_DESC(sizeof(struct aml_mutex_queue), _aml_mutex_queue_storage),
89*53e202c1Schristos };
90*53e202c1Schristos 
91*53e202c1Schristos struct	memman_histogram aml_histogram[MEMMAN_HISTOGRAM_SIZE];
92*53e202c1Schristos 
93*53e202c1Schristos static struct	memman _aml_memman = MEMMAN_MEMMANAGER_DESC(aml_blockman, 21,
94*53e202c1Schristos     aml_histogram, 1);
95*53e202c1Schristos 
96*53e202c1Schristos struct	memman *aml_memman = &_aml_memman;
97*53e202c1Schristos 
98