acpica_machdep.h revision 252280
150476Speter/*-
220083Sache * Copyright (c) 2002 Mitsuru IWASAKI
320083Sache * All rights reserved.
420083Sache *
520083Sache * Redistribution and use in source and binary forms, with or without
620083Sache * modification, are permitted provided that the following conditions
720083Sache * are met:
820083Sache * 1. Redistributions of source code must retain the above copyright
920083Sache *    notice, this list of conditions and the following disclaimer.
1020083Sache * 2. Redistributions in binary form must reproduce the above copyright
1120083Sache *    notice, this list of conditions and the following disclaimer in the
1220083Sache *    documentation and/or other materials provided with the distribution.
1320083Sache *
1420083Sache * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1520083Sache * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1620083Sache * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1720083Sache * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1820083Sache * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1920083Sache * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2020083Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2120083Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2220083Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2320083Sache * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2420083Sache * SUCH DAMAGE.
2520083Sache *
2620083Sache * $FreeBSD: head/sys/i386/include/acpica_machdep.h 252280 2013-06-27 00:22:40Z jkim $
2720083Sache */
2820083Sache
2920083Sache/******************************************************************************
3020083Sache *
3120083Sache * Name: acpica_machdep.h - arch-specific defines, etc.
3220083Sache *       $Revision$
3320083Sache *
3420083Sache *****************************************************************************/
3520083Sache
3620083Sache#ifndef __ACPICA_MACHDEP_H__
3720083Sache#define	__ACPICA_MACHDEP_H__
3820083Sache
3920083Sache#ifdef _KERNEL
4020083Sache/*
4120083Sache * Calling conventions:
4220083Sache *
4320083Sache * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
4420083Sache * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
4520083Sache * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
4620083Sache * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
4720083Sache */
4820083Sache#define	ACPI_SYSTEM_XFACE
4920083Sache#define	ACPI_EXTERNAL_XFACE
5020083Sache#define	ACPI_INTERNAL_XFACE
5120083Sache#define	ACPI_INTERNAL_VAR_XFACE
5220083Sache
5320083Sache/* Asm macros */
5420083Sache
5520083Sache#define	ACPI_ASM_MACROS
5620083Sache#define	BREAKPOINT3
5720083Sache#define	ACPI_DISABLE_IRQS() disable_intr()
5820083Sache#define	ACPI_ENABLE_IRQS()  enable_intr()
5920083Sache
6020083Sache#define	ACPI_FLUSH_CPU_CACHE()	wbinvd()
6120083Sache
6274570Sache/* Section 5.2.9.1:  global lock acquire/release functions */
6320083Sacheextern int	acpi_acquire_global_lock(uint32_t *lock);
6420083Sacheextern int	acpi_release_global_lock(uint32_t *lock);
6520083Sache#define	ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)	do {			\
6654090Sache	(Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock));	\
6720083Sache} while (0)
6820083Sache#define	ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)	do {			\
6920083Sache	(Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock));	\
7074606Sache} while (0)
7120083Sache
7220083Sache/*! [Begin] no source code translation
7320083Sache *
7473361Sache * Math helper asm macros
7520083Sache */
7620083Sache#define	asm         __asm
7720083Sache#define	ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
7854090Sache        asm("divl %2;"        \
7953943Sache        :"=a"(q32), "=d"(r32) \
8053943Sache        :"r"(d32),            \
8153943Sache        "0"(n_lo), "1"(n_hi))
8253943Sache
8353943Sache
8453943Sache#define	ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
8553943Sache    asm("shrl   $1,%2;"             \
8653943Sache        "rcrl   $1,%3;"             \
8753943Sache        :"=r"(n_hi), "=r"(n_lo)     \
8853943Sache        :"0"(n_hi), "1"(n_lo))
8953943Sache
9053943Sache/*! [End] no source code translation !*/
9153943Sache
9253943Sachevoid	acpi_SetDefaultIntrModel(int model);
9353943Sachevoid	acpi_cpu_c1(void);
9453943Sachevoid	*acpi_map_table(vm_paddr_t pa, const char *sig);
9574413Sachevoid	acpi_unmap_table(void *table);
9653943Sachevm_paddr_t acpi_find_table(const char *sig);
9774413Sache
9853961Sache#endif /* _KERNEL */
9973361Sache
10073361Sache#endif /* __ACPICA_MACHDEP_H__ */
10173361Sache