2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* acpi.h - ACPI Interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_ACPI_H
|
|
|
|
#define _LINUX_ACPI_H
|
|
|
|
|
2005-06-07 06:50:09 +08:00
|
|
|
|
2005-05-27 16:21:50 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _LINUX
|
|
|
|
#define _LINUX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
|
|
|
#include <acpi/acpi_bus.h>
|
|
|
|
#include <acpi/acpi_drivers.h>
|
2006-06-23 17:03:19 +08:00
|
|
|
#include <acpi/acpi_numa.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/acpi.h>
|
|
|
|
|
|
|
|
|
2005-08-25 00:07:20 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
enum acpi_irq_model_id {
|
|
|
|
ACPI_IRQ_MODEL_PIC = 0,
|
|
|
|
ACPI_IRQ_MODEL_IOAPIC,
|
|
|
|
ACPI_IRQ_MODEL_IOSAPIC,
|
2006-12-23 01:50:04 +08:00
|
|
|
ACPI_IRQ_MODEL_PLATFORM,
|
2005-04-17 06:20:36 +08:00
|
|
|
ACPI_IRQ_MODEL_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
extern enum acpi_irq_model_id acpi_irq_model;
|
|
|
|
|
|
|
|
enum acpi_interrupt_id {
|
|
|
|
ACPI_INTERRUPT_PMI = 1,
|
|
|
|
ACPI_INTERRUPT_INIT,
|
|
|
|
ACPI_INTERRUPT_CPEI,
|
|
|
|
ACPI_INTERRUPT_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ACPI_SPACE_MEM 0
|
|
|
|
|
|
|
|
enum acpi_address_range_id {
|
|
|
|
ACPI_ADDRESS_RANGE_MEMORY = 1,
|
|
|
|
ACPI_ADDRESS_RANGE_RESERVED = 2,
|
|
|
|
ACPI_ADDRESS_RANGE_ACPI = 3,
|
|
|
|
ACPI_ADDRESS_RANGE_NVS = 4,
|
|
|
|
ACPI_ADDRESS_RANGE_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Table Handlers */
|
|
|
|
|
2007-02-03 00:48:22 +08:00
|
|
|
typedef int (*acpi_table_handler) (struct acpi_table_header *table);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-11 10:35:47 +08:00
|
|
|
typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
|
|
|
|
unsigned long acpi_find_rsdp (void);
|
|
|
|
int acpi_boot_init (void);
|
|
|
|
int acpi_boot_table_init (void);
|
|
|
|
int acpi_numa_init (void);
|
|
|
|
|
|
|
|
int acpi_table_init (void);
|
2007-02-03 00:48:22 +08:00
|
|
|
int acpi_table_parse (char *id, acpi_table_handler handler);
|
2007-02-11 11:17:07 +08:00
|
|
|
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
|
|
|
|
int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
|
2007-02-11 10:35:47 +08:00
|
|
|
int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
|
|
|
|
int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
|
2007-02-03 00:48:22 +08:00
|
|
|
int acpi_parse_mcfg (struct acpi_table_header *header);
|
2007-02-03 00:48:22 +08:00
|
|
|
void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
|
2007-02-03 00:48:22 +08:00
|
|
|
void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* the following four functions are architecture-dependent */
|
2006-06-23 17:03:19 +08:00
|
|
|
#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
|
|
|
|
#define NR_NODE_MEMBLKS MAX_NUMNODES
|
|
|
|
#define acpi_numa_slit_init(slit) do {} while (0)
|
|
|
|
#define acpi_numa_processor_affinity_init(pa) do {} while (0)
|
|
|
|
#define acpi_numa_memory_affinity_init(ma) do {} while (0)
|
|
|
|
#define acpi_numa_arch_fixup() do {} while (0)
|
|
|
|
#else
|
2005-04-17 06:20:36 +08:00
|
|
|
void acpi_numa_slit_init (struct acpi_table_slit *slit);
|
2007-02-03 00:48:22 +08:00
|
|
|
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
|
|
|
|
void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
|
2005-04-17 06:20:36 +08:00
|
|
|
void acpi_numa_arch_fixup(void);
|
2006-06-23 17:03:19 +08:00
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
|
|
|
/* Arch dependent functions for cpu hotplug support */
|
|
|
|
int acpi_map_lsapic(acpi_handle handle, int *pcpu);
|
|
|
|
int acpi_unmap_lsapic(int cpu);
|
|
|
|
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
|
|
|
|
2005-04-28 15:25:58 +08:00
|
|
|
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
|
|
|
|
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
extern int acpi_mp_config;
|
|
|
|
|
2007-02-03 00:48:22 +08:00
|
|
|
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
|
2005-06-24 08:35:56 +08:00
|
|
|
extern int pci_mmcfg_config_num;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-02-21 10:27:58 +08:00
|
|
|
extern int sbf_port;
|
|
|
|
extern unsigned long acpi_video_flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-25 00:07:20 +08:00
|
|
|
#else /* !CONFIG_ACPI */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define acpi_mp_config 0
|
|
|
|
|
2005-08-25 00:07:20 +08:00
|
|
|
#endif /* !CONFIG_ACPI */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-10-01 07:03:00 +08:00
|
|
|
int acpi_register_gsi (u32 gsi, int triggering, int polarity);
|
2005-04-17 06:20:36 +08:00
|
|
|
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function undoes the effect of one call to acpi_register_gsi().
|
|
|
|
* If this matches the last registration, any IRQ resources for gsi
|
|
|
|
* are freed.
|
|
|
|
*/
|
|
|
|
void acpi_unregister_gsi (u32 gsi);
|
|
|
|
|
2005-08-26 00:27:09 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct acpi_prt_entry {
|
|
|
|
struct list_head node;
|
|
|
|
struct acpi_pci_id id;
|
|
|
|
u8 pin;
|
|
|
|
struct {
|
|
|
|
acpi_handle handle;
|
|
|
|
u32 index;
|
|
|
|
} link;
|
|
|
|
u32 irq;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_prt_list {
|
|
|
|
int count;
|
|
|
|
struct list_head entries;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pci_dev;
|
|
|
|
|
|
|
|
int acpi_pci_irq_enable (struct pci_dev *dev);
|
2005-04-01 13:07:31 +08:00
|
|
|
void acpi_penalize_isa_irq(int irq, int active);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void acpi_pci_irq_disable (struct pci_dev *dev);
|
|
|
|
|
|
|
|
struct acpi_pci_driver {
|
|
|
|
struct acpi_pci_driver *next;
|
|
|
|
int (*add)(acpi_handle handle);
|
|
|
|
void (*remove)(acpi_handle handle);
|
|
|
|
};
|
|
|
|
|
|
|
|
int acpi_pci_register_driver(struct acpi_pci_driver *driver);
|
|
|
|
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
|
|
|
|
|
2005-08-26 00:27:09 +08:00
|
|
|
#endif /* CONFIG_ACPI */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_EC
|
|
|
|
|
|
|
|
extern int ec_read(u8 addr, u8 *val);
|
|
|
|
extern int ec_write(u8 addr, u8 val);
|
2006-09-06 00:12:24 +08:00
|
|
|
extern int ec_transaction(u8 command,
|
|
|
|
const u8 *wdata, unsigned wdata_len,
|
|
|
|
u8 *rdata, unsigned rdata_len);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#endif /*CONFIG_ACPI_EC*/
|
|
|
|
|
|
|
|
extern int acpi_blacklisted(void);
|
|
|
|
extern void acpi_bios_year(char *s);
|
|
|
|
|
|
|
|
#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
|
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set highest legal C-state
|
|
|
|
* 0: C0 okay, but not C1
|
|
|
|
* 1: C1 okay, but not C2
|
|
|
|
* 2: C2 okay, but not C3 etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern unsigned int max_cstate;
|
|
|
|
|
|
|
|
static inline unsigned int acpi_get_cstate_limit(void)
|
|
|
|
{
|
|
|
|
return max_cstate;
|
|
|
|
}
|
|
|
|
static inline void acpi_set_cstate_limit(unsigned int new_limit)
|
|
|
|
{
|
|
|
|
max_cstate = new_limit;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
|
|
|
|
static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_NUMA
|
|
|
|
int acpi_get_pxm(acpi_handle handle);
|
2006-06-27 17:53:31 +08:00
|
|
|
int acpi_get_node(acpi_handle *handle);
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
|
|
|
static inline int acpi_get_pxm(acpi_handle handle)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2006-06-27 17:53:31 +08:00
|
|
|
static inline int acpi_get_node(acpi_handle *handle)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
2006-06-27 17:53:31 +08:00
|
|
|
extern int acpi_paddr_to_node(u64 start_addr, u64 size);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern int pnpacpi_disabled;
|
|
|
|
|
2005-07-30 16:18:00 +08:00
|
|
|
#else /* CONFIG_ACPI */
|
|
|
|
|
|
|
|
static inline int acpi_boot_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int acpi_boot_table_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-05-27 16:21:50 +08:00
|
|
|
#endif /* CONFIG_ACPI */
|
|
|
|
#endif /*_LINUX_ACPI_H*/
|