acpica_machdep.h revision 197439
136307Sphk/*-
226419Sache * Copyright (c) 2002 Mitsuru IWASAKI
326419Sache * All rights reserved.
426419Sache *
526419Sache * Redistribution and use in source and binary forms, with or without
626419Sache * modification, are permitted provided that the following conditions
726419Sache * are met:
836307Sphk * 1. Redistributions of source code must retain the above copyright
936307Sphk *    notice, this list of conditions and the following disclaimer.
1036307Sphk * 2. Redistributions in binary form must reproduce the above copyright
1136307Sphk *    notice, this list of conditions and the following disclaimer in the
1236307Sphk *    documentation and/or other materials provided with the distribution.
1336307Sphk *
1436307Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1536307Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1636307Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1736307Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1836307Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1936307Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2026419Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2126419Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2226419Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2336307Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2436307Sphk * SUCH DAMAGE.
2536307Sphk *
2636307Sphk * $FreeBSD: head/sys/i386/include/acpica_machdep.h 197439 2009-09-23 15:42:35Z jhb $
2736307Sphk */
2836307Sphk
2936307Sphk/******************************************************************************
3036307Sphk *
3136307Sphk * Name: acpica_machdep.h - arch-specific defines, etc.
3236307Sphk *       $Revision$
3336307Sphk *
3436307Sphk *****************************************************************************/
3526419Sache
3626419Sache#ifndef __ACPICA_MACHDEP_H__
3726419Sache#define	__ACPICA_MACHDEP_H__
3836307Sphk
3936307Sphk#ifdef _KERNEL
4036307Sphk/*
4136307Sphk * Calling conventions:
4236307Sphk *
4336307Sphk * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
4436307Sphk * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
4526419Sache * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
4626419Sache * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
4726419Sache */
4836307Sphk#define	ACPI_SYSTEM_XFACE
4936307Sphk#define	ACPI_EXTERNAL_XFACE
5036307Sphk#define	ACPI_INTERNAL_XFACE
5136307Sphk#define	ACPI_INTERNAL_VAR_XFACE
5236307Sphk
5336307Sphk/* Asm macros */
5436307Sphk
5526419Sache#define	ACPI_ASM_MACROS
5626419Sache#define	BREAKPOINT3
5726419Sache#define	ACPI_DISABLE_IRQS() disable_intr()
5826419Sache#define	ACPI_ENABLE_IRQS()  enable_intr()
5926419Sache
6026419Sache#define	ACPI_FLUSH_CPU_CACHE()	wbinvd()
6126419Sache
6226419Sache/* Section 5.2.9.1:  global lock acquire/release functions */
6326419Sacheextern int	acpi_acquire_global_lock(uint32_t *lock);
6426419Sacheextern int	acpi_release_global_lock(uint32_t *lock);
6526419Sache#define	ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)	do {			\
6626419Sache	(Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock));	\
6726419Sache} while (0)
6826419Sache#define	ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)	do {			\
6926419Sache	(Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock));	\
7026419Sache} while (0)
7126419Sache
7226419Sache/*! [Begin] no source code translation
7326419Sache *
7426419Sache * Math helper asm macros
7526419Sache */
7626419Sache#define	asm         __asm
7726419Sache#define	ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
7826419Sache        asm("divl %2;"        \
79        :"=a"(q32), "=d"(r32) \
80        :"r"(d32),            \
81        "0"(n_lo), "1"(n_hi))
82
83
84#define	ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
85    asm("shrl   $1,%2;"             \
86        "rcrl   $1,%3;"             \
87        :"=r"(n_hi), "=r"(n_lo)     \
88        :"0"(n_hi), "1"(n_lo))
89
90/*! [End] no source code translation !*/
91#endif /* _KERNEL */
92
93#define	ACPI_MACHINE_WIDTH             32
94#define	COMPILER_DEPENDENT_INT64       long long
95#define	COMPILER_DEPENDENT_UINT64      unsigned long long
96#define	ACPI_USE_NATIVE_DIVIDE
97
98void	acpi_SetDefaultIntrModel(int model);
99void	acpi_cpu_c1(void);
100void	*acpi_map_table(vm_paddr_t pa, const char *sig);
101void	acpi_unmap_table(void *table);
102vm_paddr_t acpi_find_table(const char *sig);
103
104#endif /* __ACPICA_MACHDEP_H__ */
105