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