2005-04-16 18:20:36 -04:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Name: aclinux.h - OS specific defines, etc.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2006-01-13 16:22:00 -05:00
|
|
|
* Copyright (C) 2000 - 2006, R. Byron Moore
|
2005-04-16 18:20:36 -04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ACLINUX_H__
|
|
|
|
#define __ACLINUX_H__
|
|
|
|
|
|
|
|
#define ACPI_USE_SYSTEM_CLIBRARY
|
|
|
|
#define ACPI_USE_DO_WHILE_0
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/kernel.h>
|
2006-10-03 00:00:00 -04:00
|
|
|
#include <linux/module.h>
|
2005-04-16 18:20:36 -04:00
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/atomic.h>
|
|
|
|
#include <asm/div64.h>
|
|
|
|
#include <asm/acpi.h>
|
2006-10-03 00:00:00 -04:00
|
|
|
#include <linux/slab.h>
|
2006-06-23 17:04:00 -04:00
|
|
|
#include <linux/spinlock_types.h>
|
2006-07-07 20:11:07 -04:00
|
|
|
#include <asm/current.h>
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2006-10-03 00:00:00 -04:00
|
|
|
/* Host-dependent types and defines */
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2006-10-03 00:00:00 -04:00
|
|
|
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
|
|
|
|
#define acpi_cache_t kmem_cache_t
|
2006-06-23 17:04:00 -04:00
|
|
|
#define acpi_spinlock spinlock_t *
|
2006-10-03 00:00:00 -04:00
|
|
|
#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
|
|
|
|
#define strtoul simple_strtoul
|
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617:
Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator). This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core. The new OSL
interfaces are shown below. See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions. Thanks to Alexey Starikovskiy.
acpi_os_create_cache
acpi_os_delete_cache
acpi_os_purge_cache
acpi_os_acquire_object
acpi_os_release_object
Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter. This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces. If
necessary, the OSL must determine this state by itself, a
simple and fast operation. Thanks to Alexey Starikovskiy.
Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater. According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer. Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.
Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length. It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.
Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device. The Device object is now correctly
overwritten. Previously, an error was returned.
ACPICA 20050624:
Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object. This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.
Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place. acpi_os_acquire_object is now similar to the
acpi_os_allocate interface. Thanks to Alexey Starikovskiy.
Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.
Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file. New files are listed below.
utilities/utcache.c /* Local cache interfaces */
utilities/utmutex.c /* Local mutex support */
utilities/utstate.c /* State object support */
parser/psloop.c /* Main AML parse loop */
Signed-off-by: Len Brown <len.brown@intel.com>
2005-06-24 00:00:00 -04:00
|
|
|
|
2005-11-17 13:07:00 -05:00
|
|
|
/* Full namespace pathname length limit - arbitrary */
|
|
|
|
#define ACPI_PATHNAME_MAX 256
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
#else /* !__KERNEL__ */
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#if defined(__ia64__) || defined(__x86_64__)
|
|
|
|
#define ACPI_MACHINE_WIDTH 64
|
|
|
|
#define COMPILER_DEPENDENT_INT64 long
|
|
|
|
#define COMPILER_DEPENDENT_UINT64 unsigned long
|
|
|
|
#else
|
|
|
|
#define ACPI_MACHINE_WIDTH 32
|
|
|
|
#define COMPILER_DEPENDENT_INT64 long long
|
|
|
|
#define COMPILER_DEPENDENT_UINT64 unsigned long long
|
|
|
|
#define ACPI_USE_NATIVE_DIVIDE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define __cdecl
|
|
|
|
#define ACPI_FLUSH_CPU_CACHE()
|
2005-08-05 00:44:28 -04:00
|
|
|
#endif /* __KERNEL__ */
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Linux uses GCC */
|
|
|
|
|
|
|
|
#include "acgcc.h"
|
|
|
|
|
2006-01-27 16:43:00 -05:00
|
|
|
#define acpi_cpu_flags unsigned long
|
|
|
|
|
2006-07-07 20:11:07 -04:00
|
|
|
#define acpi_thread_id struct task_struct *
|
2006-04-01 05:12:23 -05:00
|
|
|
|
2006-07-07 20:11:07 -04:00
|
|
|
static inline acpi_thread_id acpi_os_get_thread_id(void) { return current; }
|
2006-04-01 05:12:23 -05:00
|
|
|
|
2006-07-10 01:35:51 -04:00
|
|
|
/*
|
|
|
|
* The irqs_disabled() check is for resume from RAM.
|
|
|
|
* Interrupts are off during resume, just like they are for boot.
|
|
|
|
* However, boot has (system_state != SYSTEM_RUNNING)
|
|
|
|
* to quiet __might_sleep() in kmalloc() and resume does not.
|
|
|
|
*/
|
|
|
|
#include <acpi/actypes.h>
|
|
|
|
static inline void *acpi_os_allocate(acpi_size size) {
|
|
|
|
return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
|
|
|
}
|
|
|
|
static inline void *acpi_os_allocate_zeroed(acpi_size size) {
|
|
|
|
return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *acpi_os_acquire_object(acpi_cache_t * cache) {
|
|
|
|
return kmem_cache_zalloc(cache, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
|
|
|
|
#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
|
|
|
|
#define ACPI_FREE(a) kfree(a)
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
#endif /* __ACLINUX_H__ */
|