1 1.1 christos /* $NetBSD: aml_region.h,v 1.1 2007/01/14 04:36:13 christos Exp $ */ 2 1.1 christos 3 1.1 christos /*- 4 1.1 christos * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki (at) FreeBSD.org> 5 1.1 christos * All rights reserved. 6 1.1 christos * 7 1.1 christos * Redistribution and use in source and binary forms, with or without 8 1.1 christos * modification, are permitted provided that the following conditions 9 1.1 christos * are met: 10 1.1 christos * 1. Redistributions of source code must retain the above copyright 11 1.1 christos * notice, this list of conditions and the following disclaimer. 12 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 christos * notice, this list of conditions and the following disclaimer in the 14 1.1 christos * documentation and/or other materials provided with the distribution. 15 1.1 christos * 16 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 1.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 1.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 1.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 1.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 1.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 1.1 christos * SUCH DAMAGE. 27 1.1 christos * 28 1.1 christos * Id: aml_region.h,v 1.5 2000/08/08 14:12:05 iwasaki Exp 29 1.1 christos * $FreeBSD: src/usr.sbin/acpi/amldb/aml/aml_region.h,v 1.2 2000/09/20 01:01:27 iwasaki Exp $ 30 1.1 christos */ 31 1.1 christos 32 1.1 christos #ifndef _AML_REGION_H_ 33 1.1 christos #define _AML_REGION_H_ 34 1.1 christos 35 1.1 christos /* 36 1.1 christos * Note that common part of region I/O is implemented in aml_common.c. 37 1.1 christos */ 38 1.1 christos 39 1.1 christos /* 40 1.1 christos * Debug macros for region I/O 41 1.1 christos */ 42 1.1 christos 43 1.1 christos #define AML_REGION_READ_DEBUG(regtype, flags, addr, bitoffset, bitlen) \ 44 1.1 christos AML_DEBUGPRINT("\n[aml_region_read(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ 45 1.1 christos regtype, flags, addr, bitoffset, bitlen) 46 1.1 christos 47 1.1 christos #define AML_REGION_READ_INTO_BUFFER_DEBUG(regtype, flags, \ 48 1.1 christos addr, bitoffset, bitlen) \ 49 1.1 christos AML_DEBUGPRINT("\n[aml_region_read_into_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ 50 1.1 christos regtype, flags, addr, bitoffset, bitlen) 51 1.1 christos 52 1.1 christos #define AML_REGION_WRITE_DEBUG(regtype, flags, value, \ 53 1.1 christos addr, bitoffset, bitlen) \ 54 1.1 christos AML_DEBUGPRINT("\n[aml_region_write(%d, %d, 0x%x, 0x%x, 0x%x, 0x%x)]\n",\ 55 1.1 christos regtype, flags, value, addr, bitoffset, bitlen) 56 1.1 christos 57 1.1 christos #define AML_REGION_WRITE_FROM_BUFFER_DEBUG(regtype, flags, \ 58 1.1 christos addr, bitoffset, bitlen) \ 59 1.1 christos AML_DEBUGPRINT("\n[aml_region_write_from_buffer(%d, %d, 0x%x, 0x%x, 0x%x)]\n",\ 60 1.1 christos regtype, flags, addr, bitoffset, bitlen) 61 1.1 christos 62 1.1 christos #define AML_REGION_BCOPY_DEBUG(regtype, flags, addr, bitoffset, bitlen, \ 63 1.1 christos dflags, daddr, dbitoffset, dbitlen) \ 64 1.1 christos AML_DEBUGPRINT("\n[aml_region_bcopy(%d, %d, 0x%x, 0x%x, 0x%x, %d, 0x%x, 0x%x, 0x%x)]\n",\ 65 1.1 christos regtype, flags, addr, bitoffset, bitlen, \ 66 1.1 christos dflags, daddr, dbitoffset, dbitlen) 67 1.1 christos 68 1.1 christos /* 69 1.1 christos * Region I/O subroutine 70 1.1 christos */ 71 1.1 christos 72 1.1 christos struct aml_environ; 73 1.1 christos 74 1.1 christos u_int32_t aml_region_read(struct aml_environ *, int, u_int32_t, 75 1.1 christos u_int32_t, u_int32_t, u_int32_t); 76 1.1 christos int aml_region_write(struct aml_environ *, int, u_int32_t, 77 1.1 christos u_int32_t, u_int32_t, u_int32_t, u_int32_t); 78 1.1 christos int aml_region_read_into_buffer(struct aml_environ *, int, 79 1.1 christos u_int32_t, u_int32_t, u_int32_t, 80 1.1 christos u_int32_t, u_int8_t *); 81 1.1 christos int aml_region_write_from_buffer(struct aml_environ *, int, 82 1.1 christos u_int32_t, u_int8_t *, u_int32_t, 83 1.1 christos u_int32_t, u_int32_t); 84 1.1 christos int aml_region_bcopy(struct aml_environ *, int, 85 1.1 christos u_int32_t, u_int32_t, u_int32_t, u_int32_t, 86 1.1 christos u_int32_t, u_int32_t, u_int32_t, u_int32_t); 87 1.1 christos 88 1.1 christos #ifndef _KERNEL 89 1.1 christos void aml_simulation_regdump(const char *); 90 1.1 christos extern int aml_debug_prompt_regoutput; 91 1.1 christos extern int aml_debug_prompt_reginput; 92 1.1 christos #endif /* !_KERNEL */ 93 1.1 christos 94 1.1 christos #endif /* !_AML_REGION_H_ */ 95