acfreebsd.h revision 167805
1129198Scognet/****************************************************************************** 2129198Scognet * 3139735Simp * Name: acfreebsd.h - OS specific defines, etc. 4129198Scognet * $Revision: 1.25 $ 5129198Scognet * 6129198Scognet *****************************************************************************/ 7129198Scognet 8129198Scognet/****************************************************************************** 9129198Scognet * 10129198Scognet * 1. Copyright Notice 11129198Scognet * 12129198Scognet * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 13129198Scognet * All rights reserved. 14129198Scognet * 15129198Scognet * 2. License 16129198Scognet * 17129198Scognet * 2.1. This is your license from Intel Corp. under its intellectual property 18129198Scognet * rights. You may have additional license terms from the party that provided 19129198Scognet * you this software, covering your right to use that party's intellectual 20129198Scognet * property rights. 21129198Scognet * 22129198Scognet * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23129198Scognet * copy of the source code appearing in this file ("Covered Code") an 24129198Scognet * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25129198Scognet * base code distributed originally by Intel ("Original Intel Code") to copy, 26129198Scognet * make derivatives, distribute, use and display any portion of the Covered 27129198Scognet * Code in any form, with the right to sublicense such rights; and 28129198Scognet * 29129198Scognet * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30129198Scognet * license (with the right to sublicense), under only those claims of Intel 31129198Scognet * patents that are infringed by the Original Intel Code, to make, use, sell, 32129198Scognet * offer to sell, and import the Covered Code and derivative works thereof 33129198Scognet * solely to the minimum extent necessary to exercise the above copyright 34129198Scognet * license, and in no event shall the patent license extend to any additions 35129198Scognet * to or modifications of the Original Intel Code. No other license or right 36129198Scognet * is granted directly or by implication, estoppel or otherwise; 37129198Scognet * 38129198Scognet * The above copyright and patent license is granted only if the following 39129198Scognet * conditions are met: 40129198Scognet * 41129198Scognet * 3. Conditions 42129198Scognet * 43129198Scognet * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44129198Scognet * Redistribution of source code of any substantial portion of the Covered 45129198Scognet * Code or modification with rights to further distribute source must include 46129198Scognet * the above Copyright Notice, the above License, this list of Conditions, 47129198Scognet * and the following Disclaimer and Export Compliance provision. In addition, 48137975Scognet * Licensee must cause all Covered Code to which Licensee contributes to 49137975Scognet * contain a file documenting the changes Licensee made to create that Covered 50129198Scognet * Code and the date of any change. Licensee must include in that file the 51129198Scognet * documentation of any changes made by any predecessor Licensee. Licensee 52129198Scognet * must include a prominent statement that the modification is derived, 53129198Scognet * directly or indirectly, from Original Intel Code. 54129198Scognet * 55129198Scognet * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56129198Scognet * Redistribution of source code of any substantial portion of the Covered 57129198Scognet * Code or modification without rights to further distribute source must 58129198Scognet * include the following Disclaimer and Export Compliance provision in the 59129198Scognet * documentation and/or other materials provided with distribution. In 60129198Scognet * addition, Licensee may not authorize further sublicense of source of any 61129198Scognet * portion of the Covered Code, and must include terms to the effect that the 62129198Scognet * license from Licensee to its licensee is limited to the intellectual 63138525Scognet * property embodied in the software Licensee provides to its licensee, and 64140001Scognet * not to intellectual property embodied in modifications its licensee may 65137940Scognet * make. 66137940Scognet * 67137940Scognet * 3.3. Redistribution of Executable. Redistribution in executable form of any 68129198Scognet * substantial portion of the Covered Code or modification must reproduce the 69129198Scognet * above Copyright Notice, and the following Disclaimer and Export Compliance 70129198Scognet * provision in the documentation and/or other materials provided with the 71129198Scognet * distribution. 72278613Sian * 73129198Scognet * 3.4. Intel retains all right, title, and interest in and to the Original 74129198Scognet * Intel Code. 75129198Scognet * 76129198Scognet * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77129198Scognet * Intel shall be used in advertising or otherwise to promote the sale, use or 78129198Scognet * other dealings in products derived from or relating to the Covered Code 79129198Scognet * without prior written authorization from Intel. 80129198Scognet * 81129198Scognet * 4. Disclaimer and Export Compliance 82129198Scognet * 83129198Scognet * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84129198Scognet * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85196484Scognet * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86196484Scognet * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87129198Scognet * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88129198Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89129198Scognet * PARTICULAR PURPOSE. 90129198Scognet * 91129198Scognet * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92129198Scognet * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93129198Scognet * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94129198Scognet * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95129198Scognet * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96129198Scognet * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97129198Scognet * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98129198Scognet * LIMITED REMEDY. 99129198Scognet * 100129198Scognet * 4.3. Licensee shall not export, either directly or indirectly, any of this 101129198Scognet * software or system incorporating such software without first obtaining any 102129198Scognet * required license or other approval from the U. S. Department of Commerce or 103184205Sdes * any other agency or department of the United States Government. In the 104129198Scognet * event Licensee exports any such software from the United States or 105129198Scognet * re-exports any such software from a foreign destination, Licensee shall 106129198Scognet * ensure that the distribution and export/re-export of the software is in 107129198Scognet * compliance with all laws, regulations, orders, or other restrictions of the 108129198Scognet * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109129198Scognet * any of its subsidiaries will export/re-export any technical data, process, 110129198Scognet * software, or service, directly or indirectly, to any country for which the 111129198Scognet * United States government or any agency thereof requires an export license, 112129198Scognet * other governmental approval, or letter of assurance, without first obtaining 113129198Scognet * such license, approval or letter. 114129198Scognet * 115129198Scognet *****************************************************************************/ 116129198Scognet 117129198Scognet#ifndef __ACFREEBSD_H__ 118129198Scognet#define __ACFREEBSD_H__ 119129198Scognet 120129198Scognet 121129198Scognet/* FreeBSD uses GCC */ 122184205Sdes 123129198Scognet#include <contrib/dev/acpica/acgcc.h> 124129198Scognet#include <sys/types.h> 125129198Scognet#include <machine/acpica_machdep.h> 126129198Scognet 127129198Scognet#define ACPI_THREAD_ID pid_t 128129198Scognet#define ACPI_UINTPTR_T uintptr_t 129129198Scognet#define ACPI_USE_LOCAL_CACHE 130151316Sdavidxu#define __cdecl 131151316Sdavidxu 132129198Scognet#ifdef _KERNEL 133129198Scognet#include "opt_acpi.h" 134129198Scognet#endif 135129198Scognet 136151316Sdavidxu#ifdef ACPI_DEBUG 137151316Sdavidxu#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ 138151316Sdavidxu#define ACPI_DISASSEMBLER 139151316Sdavidxu#endif 140151316Sdavidxu 141129198Scognet#ifdef _KERNEL 142129198Scognet#include <sys/ctype.h> 143140001Scognet#include <sys/param.h> 144129198Scognet#include <sys/systm.h> 145129198Scognet#include <sys/libkern.h> 146129198Scognet#include <machine/stdarg.h> 147140001Scognet 148129198Scognet#ifdef DEBUGGER_THREADING 149129198Scognet#undef DEBUGGER_THREADING 150129198Scognet#endif /* DEBUGGER_THREADING */ 151129198Scognet 152129198Scognet#define DEBUGGER_THREADING 0 /* integrated with DDB */ 153129198Scognet 154129198Scognet#ifdef ACPI_DEBUG_OUTPUT 155129198Scognet#include "opt_ddb.h" 156129198Scognet#ifdef DDB 157129198Scognet#define ACPI_DEBUGGER 158129198Scognet#endif /* DDB */ 159129198Scognet#endif /* ACPI_DEBUG_OUTPUT */ 160129198Scognet 161129198Scognet#else /* _KERNEL */ 162129198Scognet 163129198Scognet/* Not building kernel code, so use libc */ 164129198Scognet#define ACPI_USE_STANDARD_HEADERS 165129198Scognet#define ACPI_FLUSH_CPU_CACHE() 166129198Scognet 167129198Scognet#if __STDC_HOSTED__ 168129198Scognet#include <ctype.h> 169129198Scognet#endif 170259329Sian 171129198Scognet#define __cli() 172129198Scognet#define __sti() 173129198Scognet 174129198Scognet#endif /* _KERNEL */ 175129198Scognet 176129198Scognet/* Always use FreeBSD code over our local versions */ 177129198Scognet#define ACPI_USE_SYSTEM_CLIBRARY 178129198Scognet 179129198Scognet#if defined(_KERNEL) && (__FreeBSD_version < 700020) 180129198Scognet/* Or strstr (used in debugging mode, also move to libkern) */ 181151316Sdavidxustatic __inline char * 182129198Scognetstrstr (char *s, char *find) 183129198Scognet{ 184278613Sian char c, sc; 185278613Sian size_t len; 186278613Sian 187278613Sian if ((c = *find++) != 0) { 188129198Scognet len = strlen (find); 189170291Sattilio do { 190129198Scognet do { 191129198Scognet if ((sc = *s++) == 0) 192129198Scognet return (NULL); 193236991Simp } while (sc != c); 194236991Simp } while (strncmp (s, find, len) != 0); 195129198Scognet s--; 196129198Scognet } 197129198Scognet return ((char *) s); 198129198Scognet} 199129198Scognet#endif /* _KERNEL */ 200129198Scognet 201129198Scognet#endif /* __ACFREEBSD_H__ */ 202129198Scognet