xref: /netbsd-src/usr.sbin/acpitools/aml/aml_region.h (revision 53e202c131d0a3f9c7bc2bad453b5dbd42e86fba)
1 /*	$NetBSD: aml_region.h,v 1.1 2007/01/14 04:36:13 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 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_region.h,v 1.5 2000/08/08 14:12:05 iwasaki Exp
29  *	$FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_region.h,v 1.2 2000/09/20 01:01:27 iwasaki Exp $
30  */
31 
32 #ifndef _AML_REGION_H_
33 #define _AML_REGION_H_
34 
35 /*
36  * Note that common part of region I/O is implemented in aml_common.c.
37  */
38 
39 /*
40  * Debug macros for region I/O
41  */
42 
43 #define AML_REGION_READ_DEBUG(regtype, flags, addr, bitoffset, bitlen)	\
44   AML_DEBUGPRINT("\n[aml_region_read(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\
45     regtype, flags, addr, bitoffset, bitlen)
46 
47 #define AML_REGION_READ_INTO_BUFFER_DEBUG(regtype, flags,		\
48 					  addr, bitoffset, bitlen)	\
49   AML_DEBUGPRINT("\n[aml_region_read_into_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\
50     regtype, flags, addr, bitoffset, bitlen)
51 
52 #define AML_REGION_WRITE_DEBUG(regtype, flags, value,			\
53 			       addr, bitoffset, bitlen)			\
54   AML_DEBUGPRINT("\n[aml_region_write(%d, %d, 0x%x, 0x%x, 0x%x, 0x%x)]\n",\
55     regtype, flags, value, addr, bitoffset, bitlen)
56 
57 #define AML_REGION_WRITE_FROM_BUFFER_DEBUG(regtype, flags,		\
58 					   addr, bitoffset, bitlen)	\
59   AML_DEBUGPRINT("\n[aml_region_write_from_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\
60     regtype, flags, addr, bitoffset, bitlen)
61 
62 #define AML_REGION_BCOPY_DEBUG(regtype, flags, addr, bitoffset, bitlen,	\
63 			       dflags, daddr, dbitoffset, dbitlen)	\
64   AML_DEBUGPRINT("\n[aml_region_bcopy(%d, %d, 0x%x, 0x%x, 0x%x, %d, 0x%x, 0x%x, 0x%x)]\n",\
65     regtype, flags, addr, bitoffset, bitlen,				\
66     dflags, daddr, dbitoffset, dbitlen)
67 
68 /*
69  * Region I/O subroutine
70  */
71 
72 struct aml_environ;
73 
74 u_int32_t	 aml_region_read(struct aml_environ *, int, u_int32_t,
75 				 u_int32_t, u_int32_t, u_int32_t);
76 int		 aml_region_write(struct aml_environ *, int, u_int32_t,
77 				  u_int32_t, u_int32_t, u_int32_t, u_int32_t);
78 int		 aml_region_read_into_buffer(struct aml_environ *, int,
79 					     u_int32_t, u_int32_t, u_int32_t,
80 					     u_int32_t, u_int8_t *);
81 int		 aml_region_write_from_buffer(struct aml_environ *, int,
82 					      u_int32_t, u_int8_t *, u_int32_t,
83 					      u_int32_t, u_int32_t);
84 int		 aml_region_bcopy(struct aml_environ *, int,
85 				  u_int32_t, u_int32_t, u_int32_t, u_int32_t,
86 				  u_int32_t, u_int32_t, u_int32_t, u_int32_t);
87 
88 #ifndef _KERNEL
89 void	aml_simulation_regdump(const char *);
90 extern int	aml_debug_prompt_regoutput;
91 extern int	aml_debug_prompt_reginput;
92 #endif /* !_KERNEL */
93 
94 #endif /* !_AML_REGION_H_ */
95