167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Name: acfreebsd.h - OS specific defines, etc.
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith#ifndef __ACFREEBSD_H__
45206117Sjkim#define __ACFREEBSD_H__
4667754Smsmith
4767754Smsmith
4877424Smsmith/* FreeBSD uses GCC */
4977424Smsmith
50193341Sjkim#include <contrib/dev/acpica/include/platform/acgcc.h>
51131440Smarks#include <sys/types.h>
5277424Smsmith
53252280Sjkim#ifdef __LP64__
54252280Sjkim#define ACPI_MACHINE_WIDTH      64
55252280Sjkim#else
56252280Sjkim#define ACPI_MACHINE_WIDTH      32
57252280Sjkim#endif
58252280Sjkim
59252280Sjkim#define COMPILER_DEPENDENT_INT64        int64_t
60252280Sjkim#define COMPILER_DEPENDENT_UINT64       uint64_t
61252280Sjkim
62206117Sjkim#define ACPI_UINTPTR_T      uintptr_t
63167802Sjkim
64206117Sjkim#define ACPI_USE_DO_WHILE_0
65206117Sjkim#define ACPI_USE_LOCAL_CACHE
66252280Sjkim#define ACPI_USE_NATIVE_DIVIDE
67206117Sjkim#define ACPI_USE_SYSTEM_CLIBRARY
68126372Snjl
69126372Snjl#ifdef _KERNEL
70193267Sjkim
7167754Smsmith#include <sys/ctype.h>
7267754Smsmith#include <sys/param.h>
7367754Smsmith#include <sys/systm.h>
7467754Smsmith#include <sys/libkern.h>
75252280Sjkim#include <machine/acpica_machdep.h>
7677424Smsmith#include <machine/stdarg.h>
7767754Smsmith
78193267Sjkim#include "opt_acpi.h"
79167802Sjkim
80206117Sjkim#define ACPI_MUTEX_TYPE     ACPI_OSL_MUTEX
81167802Sjkim
82193267Sjkim#ifdef ACPI_DEBUG
83206117Sjkim#define ACPI_DEBUG_OUTPUT   /* for backward compatibility */
84206117Sjkim#define ACPI_DISASSEMBLER
85193267Sjkim#endif
86193267Sjkim
87126372Snjl#ifdef ACPI_DEBUG_OUTPUT
8877424Smsmith#include "opt_ddb.h"
8977424Smsmith#ifdef DDB
90206117Sjkim#define ACPI_DEBUGGER
9177424Smsmith#endif /* DDB */
92102550Siwasaki#endif /* ACPI_DEBUG_OUTPUT */
9367754Smsmith
94193267Sjkim#ifdef DEBUGGER_THREADING
95193267Sjkim#undef DEBUGGER_THREADING
96193267Sjkim#endif /* DEBUGGER_THREADING */
97193267Sjkim
98206117Sjkim#define DEBUGGER_THREADING  0   /* integrated with DDB */
99193267Sjkim
10077424Smsmith#else /* _KERNEL */
10177424Smsmith
102131440Smarks#if __STDC_HOSTED__
103131440Smarks#include <ctype.h>
104131440Smarks#endif
105131440Smarks
106212761Sjkim#define ACPI_CAST_PTHREAD_T(pthread)    ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread))
10777424Smsmith
108206117Sjkim#define ACPI_USE_STANDARD_HEADERS
109193730Sjkim
110206117Sjkim#define ACPI_FLUSH_CPU_CACHE()
111206117Sjkim#define __cdecl
11277424Smsmith
11377424Smsmith#endif /* _KERNEL */
11477424Smsmith
11569450Smsmith#endif /* __ACFREEBSD_H__ */
116