+++ /dev/null
-/* $NetBSD: acpi_func.h,v 1.2 2006/05/14 21:55:38 elad Exp $ */\r
-\r
-/*-\r
- * Copyright (c) 2002 Mitsuru IWASAKI\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * $FreeBSD: src/sys/ia64/include/acpica_machdep.h,v 1.4 2004/10/11 05:39:15 njl Exp $\r
- */\r
-\r
-/******************************************************************************\r
- *\r
- * Name: acpica_machdep.h - arch-specific defines, etc.\r
- * $Revision: 1.2 $\r
- *\r
- *****************************************************************************/\r
-\r
-#ifndef _IA64_ACPI_FUNC_H_\r
-#define _IA64_ACPI_FUNC_H_\r
-\r
-#include <machine/cpufunc.h>\r
-#include <machine/atomic.h>\r
-\r
-/* Asm macros */\r
-\r
-#define ACPI_ASM_MACROS\r
-#define BREAKPOINT3\r
-#define ACPI_DISABLE_IRQS() disable_intr()\r
-#define ACPI_ENABLE_IRQS() enable_intr()\r
-\r
-#define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */\r
-\r
-\r
-/* Section 5.2.9.1: global lock acquire/release functions */\r
-extern int acpi_acquire_global_lock(uint32_t *lock);\r
-extern int acpi_release_global_lock(uint32_t *lock);\r
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \\r
- ((Acq) = acpi_acquire_global_lock(GLptr))\r
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \\r
- ((Acq) = acpi_release_global_lock(GLptr))\r
-\r
-\r
-/* Section 5.2.9.1: global lock acquire/release functions */\r
-#define GL_ACQUIRED (-1)\r
-#define GL_BUSY 0\r
-#define GL_BIT_PENDING 0x1\r
-#define GL_BIT_OWNED 0x2\r
-#define GL_BIT_MASK (GL_BIT_PENDING | GL_BIT_OWNED)\r
-\r
-/*\r
- * Acquire the global lock. If busy, set the pending bit. The caller\r
- * will wait for notification from the BIOS that the lock is available\r
- * and then attempt to acquire it again.\r
- */\r
-int\r
-acpi_acquire_global_lock(uint32_t *lock)\r
-{\r
- uint32_t new, old;\r
-\r
- do {\r
- old = *lock;\r
- new = ((old & ~GL_BIT_MASK) | GL_BIT_OWNED) |\r
- ((old >> 1) & GL_BIT_PENDING);\r
- } while (atomic_cmpset_acq_int(lock, old, new) == 0);\r
-\r
- return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);\r
-}\r
-\r
-/*\r
- * Release the global lock, returning whether there is a waiter pending.\r
- * If the BIOS set the pending bit, OSPM must notify the BIOS when it\r
- * releases the lock.\r
- */\r
-int\r
-acpi_release_global_lock(uint32_t *lock)\r
-{\r
- uint32_t new, old;\r
-\r
- do {\r
- old = *lock;\r
- new = old & ~GL_BIT_MASK;\r
- } while (atomic_cmpset_rel_int(lock, old, new) == 0);\r
-\r
- return (old & GL_BIT_PENDING);\r
-}\r
-\r
-#endif /* _IA64_ACPI_FUNC_H_ */\r