Commit da55fd6f authored by Linus Torvalds's avatar Linus Torvalds

Manual merge

parents 77c99808 f615f385
This diff is collapsed.
......@@ -17,6 +17,7 @@
* thanks to Eric Gilmore
* and Rolf G. Tews
* for testing these extensively
* Paul Diefenbaugh : Added full ACPI support
*/
#include <linux/mm.h>
......@@ -29,6 +30,7 @@
#include <linux/smp_lock.h>
#include <linux/mc146818rtc.h>
#include <linux/compiler.h>
#include <linux/acpi.h>
#include <asm/io.h>
#include <asm/smp.h>
......@@ -1111,6 +1113,10 @@ static void __init setup_ioapic_ids_from_mpc (void)
unsigned char old_id;
unsigned long flags;
if (acpi_ioapic)
/* This gets done during IOAPIC enumeration for ACPI. */
return;
if (clustered_apic_mode)
/* We don't have a good way to do this yet - hack */
phys_id_present_map = (u_long) 0xf;
......@@ -1699,8 +1705,7 @@ void __init setup_IO_APIC(void)
printk("ENABLING IO-APIC IRQs\n");
/*
* Set up the IO-APIC IRQ routing table by parsing the MP-BIOS
* mptable:
* Set up IO-APIC IRQ routing.
*/
setup_ioapic_ids_from_mpc();
sync_Arb_IDs();
......@@ -1709,3 +1714,159 @@ void __init setup_IO_APIC(void)
check_timer();
print_IO_APIC();
}
/* --------------------------------------------------------------------------
ACPI-based IOAPIC Configuration
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_BOOT
#define IO_APIC_MAX_ID 15
int __init io_apic_get_unique_id (int ioapic, int apic_id)
{
struct IO_APIC_reg_00 reg_00;
static unsigned long apic_id_map = 0;
unsigned long flags;
int i = 0;
/*
* The P4 platform supports up to 256 APIC IDs on two separate APIC
* buses (one for LAPICs, one for IOAPICs), where predecessors only
* supports up to 16 on one shared APIC bus.
*
* TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
* advantage of new APIC bus architecture.
*/
if (!apic_id_map)
apic_id_map = phys_cpu_present_map;
spin_lock_irqsave(&ioapic_lock, flags);
*(int *)&reg_00 = io_apic_read(ioapic, 0);
spin_unlock_irqrestore(&ioapic_lock, flags);
if (apic_id >= IO_APIC_MAX_ID) {
printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
"%d\n", ioapic, apic_id, reg_00.ID);
apic_id = reg_00.ID;
}
/*
* Every APIC in a system must have a unique ID or we get lots of nice
* 'stuck on smp_invalidate_needed IPI wait' messages.
*/
if (apic_id_map & (1 << apic_id)) {
for (i = 0; i < IO_APIC_MAX_ID; i++) {
if (!(apic_id_map & (1 << i)))
break;
}
if (i == IO_APIC_MAX_ID)
panic("Max apic_id exceeded!\n");
printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
"trying %d\n", ioapic, apic_id, i);
apic_id = i;
}
apic_id_map |= (1 << apic_id);
if (reg_00.ID != apic_id) {
reg_00.ID = apic_id;
spin_lock_irqsave(&ioapic_lock, flags);
io_apic_write(ioapic, 0, *(int *)&reg_00);
*(int *)&reg_00 = io_apic_read(ioapic, 0);
spin_unlock_irqrestore(&ioapic_lock, flags);
/* Sanity check */
if (reg_00.ID != apic_id)
panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic);
}
printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
return apic_id;
}
int __init io_apic_get_version (int ioapic)
{
struct IO_APIC_reg_01 reg_01;
unsigned long flags;
spin_lock_irqsave(&ioapic_lock, flags);
*(int *)&reg_01 = io_apic_read(ioapic, 1);
spin_unlock_irqrestore(&ioapic_lock, flags);
return reg_01.version;
}
int __init io_apic_get_redir_entries (int ioapic)
{
struct IO_APIC_reg_01 reg_01;
unsigned long flags;
spin_lock_irqsave(&ioapic_lock, flags);
*(int *)&reg_01 = io_apic_read(ioapic, 1);
spin_unlock_irqrestore(&ioapic_lock, flags);
return reg_01.entries;
}
int io_apic_set_pci_routing (int ioapic, int pin, int irq)
{
struct IO_APIC_route_entry entry;
unsigned long flags;
if (!IO_APIC_IRQ(irq)) {
printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0/n",
ioapic);
return -EINVAL;
}
/*
* Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
* Note that we mask (disable) IRQs now -- these get enabled when the
* corresponding device driver registers for this IRQ.
*/
memset(&entry,0,sizeof(entry));
entry.delivery_mode = dest_LowestPrio;
entry.dest_mode = INT_DELIVERY_MODE;
entry.dest.logical.logical_dest = TARGET_CPUS;
entry.mask = 1; /* Disabled (masked) */
entry.trigger = 1; /* Level sensitive */
entry.polarity = 1; /* Low active */
add_pin_to_irq(irq, ioapic, pin);
entry.vector = assign_irq_vector(irq);
printk(KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
"IRQ %d)\n", ioapic,
mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq);
irq_desc[irq].handler = &ioapic_level_irq_type;
set_intr_gate(entry.vector, interrupt[irq]);
if (!ioapic && (irq < 16))
disable_8259A_irq(irq);
spin_lock_irqsave(&ioapic_lock, flags);
io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
spin_unlock_irqrestore(&ioapic_lock, flags);
return entry.vector;
}
#endif /*CONFIG_ACPI_BOOT*/
This diff is collapsed.
......@@ -916,17 +916,11 @@ void __init setup_arch(char **cmdline_p)
paging_init();
#ifdef CONFIG_ACPI_BOOT
/*
* Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
* Must do this after paging_init (due to reliance on fixmap, and thus
* the bootmem allocator) but before get_smp_config (to allow parsing
* of MADT).
* Parse the ACPI tables for possible boot-time SMP configuration.
*/
acpi_boot_init(*cmdline_p);
#endif
#ifdef CONFIG_X86_LOCAL_APIC
/*
* get boot-time SMP configuration:
*/
if (smp_found_config)
get_smp_config();
#endif
......
......@@ -2,73 +2,23 @@
#include <linux/acpi.h>
#include "pci.h"
extern void eisa_set_level_irq(int irq);
static int acpi_lookup_irq (
struct pci_dev *dev,
int assign)
static int __init pci_acpi_init(void)
{
int result = 0;
int irq = 0;
u8 pin;
/* TBD: Select IRQ from possible to improve routing performance. */
/* Find IRQ pin */
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (!pin) {
DBG(" -> no interrupt pin\n");
if (pcibios_scanned)
return 0;
}
pin = pin - 1;
result = acpi_prt_get_irq(dev, pin, &irq);
if (!irq)
result = -ENODEV;
if (0 != result) {
printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s\n",
'A'+pin, dev->slot_name);
return result;
}
/* only check for the IRQ */
if (!assign) {
printk(KERN_INFO "PCI: Found IRQ %d for device %s\n",
irq, dev->slot_name);
return 1;
}
dev->irq = irq;
/* also assign an IRQ */
if (irq && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
result = acpi_prt_set_irq(dev, pin, irq);
if (0 != result) {
printk(KERN_WARNING "PCI: Could not assign IRQ %d to device %s\n", irq, dev->slot_name);
return result;
}
eisa_set_level_irq(irq);
printk(KERN_INFO "PCI: Assigned IRQ %d for device %s\n", irq, dev->slot_name);
}
return 1;
}
static int __init pci_acpi_init(void)
{
if (!(pci_probe & PCI_NO_ACPI_ROUTING)) {
if (acpi_prts.count) {
if (!acpi_pci_irq_init()) {
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
printk(KERN_INFO "PCI: if you experience problems, try using option 'pci=noacpi'\n");
pci_use_acpi_routing = 1;
pci_lookup_irq = acpi_lookup_irq;
pcibios_scanned++;
pcibios_enable_irq = acpi_pci_irq_enable;
} else
printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n");
}
return 0;
}
arch_initcall(pci_acpi_init);
subsys_initcall(pci_acpi_init);
......@@ -27,6 +27,12 @@ struct pci_ops *pci_root_ops = NULL;
int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value) = NULL;
int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value) = NULL;
/*
* legacy, numa, and acpi all want to call pcibios_scan_root
* from their initcalls. This flag prevents that.
*/
int pcibios_scanned;
/*
* This interrupt-safe spinlock protects all accesses to PCI
* configuration space.
......@@ -201,6 +207,6 @@ int pcibios_enable_device(struct pci_dev *dev)
if ((err = pcibios_enable_resources(dev)) < 0)
return err;
pcibios_enable_irq(dev);
return 0;
return pcibios_enable_irq(dev);
}
......@@ -12,7 +12,6 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/acpi.h>
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/io_apic.h>
......@@ -22,7 +21,6 @@
#define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
#define PIRQ_VERSION 0x0100
int pci_use_acpi_routing = 0;
int broken_hp_bios_irq9;
static struct irq_routing_table *pirq_table;
......@@ -46,7 +44,7 @@ struct irq_router {
int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq, int new);
};
int (*pci_lookup_irq)(struct pci_dev * dev, int assign) = NULL;
int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
/*
* Search 0xf0000 -- 0xfffff for the PCI IRQ Routing Table.
......@@ -690,7 +688,7 @@ static int __init pcibios_irq_init(void)
{
DBG("PCI: IRQ init\n");
if (pci_lookup_irq)
if (pcibios_enable_irq)
return 0;
pirq_table = pirq_find_routing_table();
......@@ -712,7 +710,9 @@ static int __init pcibios_irq_init(void)
if (io_apic_assign_pci_irqs)
pirq_table = NULL;
}
pci_lookup_irq = pcibios_lookup_irq;
pcibios_enable_irq = pirq_enable_irq;
pcibios_fixup_irqs();
return 0;
}
......@@ -781,7 +781,7 @@ void __init pcibios_fixup_irqs(void)
* Still no IRQ? Try to lookup one...
*/
if (pin && !dev->irq)
pci_lookup_irq(dev, 0);
pcibios_lookup_irq(dev, 0);
}
}
......@@ -794,11 +794,11 @@ void pcibios_penalize_isa_irq(int irq)
pirq_penalty[irq] += 100;
}
void pcibios_enable_irq(struct pci_dev *dev)
int pirq_enable_irq(struct pci_dev *dev)
{
u8 pin;
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (pin && !pci_lookup_irq(dev, 1) && !dev->irq) {
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
char *msg;
if (io_apic_assign_pci_irqs)
msg = " Probably buggy MP table.";
......@@ -809,4 +809,6 @@ void pcibios_enable_irq(struct pci_dev *dev)
printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
'A' + pin - 1, dev->slot_name, msg);
}
return 0;
}
......@@ -42,11 +42,14 @@ static int __init pci_legacy_init(void)
return 0;
}
if (pcibios_scanned++)
return 0;
printk("PCI: Probing PCI hardware\n");
pci_root_bus = pcibios_scan_root(0);
if (!pci_use_acpi_routing)
pcibios_fixup_peer_bridges();
pcibios_fixup_peer_bridges();
return 0;
}
......
......@@ -104,6 +104,9 @@ static int __init pci_numa_init(void)
pci_config_read = pci_conf1_read;
pci_config_write = pci_conf1_write;
if (pcibios_scanned++)
return 0;
pci_root_bus = pcibios_scan_root(0);
if (clustered_apic_mode && (numnodes > 1)) {
for (quad = 1; quad < numnodes; ++quad) {
......
......@@ -66,10 +66,10 @@ struct irq_routing_table {
extern unsigned int pcibios_irq_mask;
extern int pci_use_acpi_routing;
extern int pcibios_scanned;
extern spinlock_t pci_config_lock;
void pcibios_fixup_irqs(void);
void pcibios_enable_irq(struct pci_dev *dev);
int pirq_enable_irq(struct pci_dev *dev);
extern int (*pci_lookup_irq)(struct pci_dev * dev, int assign);
extern int (*pcibios_enable_irq)(struct pci_dev *dev);
......@@ -12,6 +12,12 @@ CONFIG_ACPI
Management (APM) specification. If both ACPI and APM support
are configured, whichever is loaded first shall be used.
Add "acpi=off" to the kernel command line to disable this feature.
(Try "man bootparam" or see the documentation of your boot loader
about how to pass options to the kernel at boot time.)
----------
The ACPI SourceForge project contains the latest source code,
documentation, tools, mailing list subscription, and other
information. This project is available at:
......@@ -26,51 +32,28 @@ CONFIG_ACPI
available at:
<http://www.acpi.info>
CONFIG_ACPI_BOOT
This option enables the use of ACPI tables for obtaining various
boot-time configuration information such as system processors,
memory, and interrupt routing.
ACPI tables supercede legacy BIOS interfaces. For example, the
Multiple APIC Description Table (MADT) defined by the ACPI
Specification is a replacement for the MP Configuration Table
defined by the MultiProcessor Specification (MPS).
You can disable this feature on IA32 systems by adding "acpi_boot=off"
to your kernel command line. (Try "man bootparam" or see the
documentation of your boot loader about how to pass options to the
kernel at boot time.)
IA64 systems do not support legacy BIOS interfaces and thus rely
on ACPI tables to boot the system. No kernel command line options
are supported.
CONFIG_ACPI_INTERPRETER
The ACPI Interpreter (a.k.a. ACPI Core Subsystem) provides the
fundamental services required to parse the ACPI namespace, evaluate
control methods, and manage ACPI hardware and events. This
subsystem exposes kernel interfaces allowing higher level software
to manipulate ACPI defined hardware and software interfaces.
Add "acpi=off" to the kernel command line to disable this feature.
(Try "man bootparam" or see the documentation of your boot loader
about how to pass options to the kernel at boot time.)
CONFIG_ACPI_HT_ONLY
This option enables limited ACPI support -- just enough to
enumerate processors from the ACPI Multiple APIC Description
Table (MADT). Note that ACPI supports both logical (e.g. Hyper-
Threading) and physical processors, where the MultiProcessor
Specification (MPS) table only supports physical processors.
Note that this option will enlarge your kernel by about 100K.
Full ACPI support (CONFIG_ACPI) is preferred. Use this option
only if you wish to limit ACPI's role to processor enumeration.
CONFIG_ACPI_BUS
The ACPI Bus driver enumerates and manages devices in the ACPI
namespace in a manner similar to other bus drivers (e.g. PCI).
All ACPI device drivers rely on its services.
There is no command-line option to disable this, but the kernel
will fall back to the MPS table if the MADT is not present.
CONFIG_ACPI_AC
This driver adds support for the AC Adapter object, which indicates
whether a system is on AC, or not. Typically, only laptops have
this object, since desktops are always on AC.
whether a system is on AC, or not. Typically, only mobile systems
have this object, since desktops are always on AC.
CONFIG_ACPI_BATTERY
This driver adds support for battery information through
/proc/acpi/battery. If you have a laptop with a battery, say Y.
/proc/acpi/battery. If you have a mobile system with a battery,
say Y.
CONFIG_ACPI_BUTTON
This driver registers for events based on buttons, such as the
......@@ -79,21 +62,10 @@ CONFIG_ACPI_BUTTON
down the system. Until then, you can cat it, and see output when
a button is pressed.
CONFIG_ACPI_DEBUG
The ACPI driver can optionally report errors with a great deal
of verbosity. Saying Y enables these statements. This will increase
your kernel size by around 50K.
CONFIG_ACPI_EC
This driver is required on some systems for the proper operation of
the battery and thermal drivers. If you are compiling for a laptop,
say Y.
CONFIG_ACPI_PCI
This option enables ACPI-based enumeration and configuration of PCI
root bridge devices, including PCI interrupt routing (_PRT) support.
This is required on platforms that no longer support legacy tables
(e.g. MPS/PIR) or have erroneous table entries.
the battery and thermal drivers. If you are compiling for a
mobile system, say Y.
CONFIG_ACPI_PROCESSOR
This driver installs ACPI as the idle handler for Linux, and uses
......@@ -114,9 +86,8 @@ CONFIG_ACPI_SYSTEM
This driver will enable your system to shut down using ACPI, and
dump your ACPI DSDT table using /proc/acpi/dsdt.
CONFIG_ACPI_SLEEP
Enables low-level sleep support, allowing the platform to enter
and exit the S1-S4 states. Note that although the platform may
support this capability, full sleep support will not be viable
until drivers properly save/restore hardware context. (In other
words, use at your own risk!)
CONFIG_ACPI_DEBUG
The ACPI driver can optionally report errors with a great deal
of verbosity. Saying Y enables these statements. This will increase
your kernel size by around 50K.
#
# ACPI Configuration
#
if [ "$CONFIG_X86" = "y" ]; then
mainmenu_option next_comment
comment 'ACPI Support'
dep_bool 'ACPI Support' CONFIG_ACPI $CONFIG_PCI
bool 'ACPI Support' CONFIG_ACPI
if [ "$CONFIG_ACPI" = "y" ]; then
define_bool CONFIG_ACPI_BOOT y
define_bool CONFIG_ACPI_BUS y
define_bool CONFIG_ACPI_EC y
define_bool CONFIG_ACPI_INTERPRETER y
define_bool CONFIG_ACPI_PCI y
define_bool CONFIG_ACPI_POWER y
define_bool CONFIG_ACPI_SLEEP y
define_bool CONFIG_ACPI_SYSTEM y
tristate ' AC Adapter' CONFIG_ACPI_AC
tristate ' Battery' CONFIG_ACPI_BATTERY
tristate ' Button' CONFIG_ACPI_BUTTON
tristate ' Fan' CONFIG_ACPI_FAN
tristate ' Processor' CONFIG_ACPI_PROCESSOR
dep_tristate ' Thermal Zone' CONFIG_ACPI_THERMAL $CONFIG_ACPI_PROCESSOR
bool ' Debug Statements' CONFIG_ACPI_DEBUG
if [ "$CONFIG_X86_LOCAL_APIC" = "y" ]; then
bool 'CPU Enumeration Only' CONFIG_ACPI_HT_ONLY
fi
if [ "$CONFIG_ACPI_HT_ONLY" = "y" ]; then
define_bool CONFIG_ACPI_BOOT y
else
define_bool CONFIG_ACPI_BOOT y
define_bool CONFIG_ACPI_BUS y
define_bool CONFIG_ACPI_INTERPRETER y
define_bool CONFIG_ACPI_EC y
define_bool CONFIG_ACPI_POWER y
if [ "$CONFIG_PCI" = "y" ]; then
define_bool CONFIG_ACPI_PCI y
fi
define_bool CONFIG_ACPI_SLEEP y
define_bool CONFIG_ACPI_SYSTEM y
tristate ' AC Adapter' CONFIG_ACPI_AC
tristate ' Battery' CONFIG_ACPI_BATTERY
tristate ' Button' CONFIG_ACPI_BUTTON
tristate ' Fan' CONFIG_ACPI_FAN
tristate ' Processor' CONFIG_ACPI_PROCESSOR
dep_tristate ' Thermal Zone' CONFIG_ACPI_THERMAL $CONFIG_ACPI_PROCESSOR
bool ' Debug Statements' CONFIG_ACPI_DEBUG
fi
fi
endmenu
fi
if [ "$CONFIG_IA64" = "y" ]; then
if [ "$CONFIG_IA64_SGI_SN" = "y" ]; then
mainmenu_option next_comment
comment 'ACPI Support'
define_bool CONFIG_ACPI y
define_bool CONFIG_ACPI_EFI y
define_bool CONFIG_ACPI_BOOT y
define_bool CONFIG_ACPI_BUS n
define_bool CONFIG_ACPI_INTERPRETER n
define_bool CONFIG_ACPI_PCI n
define_bool CONFIG_ACPI_POWER n
define_bool CONFIG_ACPI_SYSTEM n
define_bool CONFIG_ACPI_BUTTON n
define_bool CONFIG_ACPI_FAN n
define_bool CONFIG_ACPI_PROCESSOR n
define_bool CONFIG_ACPI_THERMAL n
endmenu
fi
if [ "$CONFIG_IA64_HP_SIM" = "n" ]; then
mainmenu_option next_comment
comment 'ACPI Support'
if [ "$CONFIG_PCI" = "y" ]; then
define_bool CONFIG_ACPI_PCI y
fi
define_bool CONFIG_ACPI y
define_bool CONFIG_ACPI_EFI y
define_bool CONFIG_ACPI_BOOT y
define_bool CONFIG_ACPI_BUS y
define_bool CONFIG_ACPI_INTERPRETER y
define_bool CONFIG_ACPI_PCI y
define_bool CONFIG_ACPI_POWER y
define_bool CONFIG_ACPI_SYSTEM y
tristate ' Button' CONFIG_ACPI_BUTTON
......@@ -44,4 +80,5 @@ if [ "$CONFIG_IA64" = "y" ]; then
bool ' Debug Statements' CONFIG_ACPI_DEBUG
endmenu
fi
fi
......@@ -2,6 +2,8 @@
# Makefile for the Linux ACPI interpreter
#
O_TARGET := acpi.o
export ACPI_CFLAGS
ACPI_CFLAGS := -D_LINUX -I$(CURDIR)/include
......@@ -19,12 +21,12 @@ obj-y := acpi_ksyms.o
#
# ACPI Boot-Time Table Parsing
#
obj-$(CONFIG_ACPI_BOOT) += acpi_tables.o
obj-$(CONFIG_ACPI_BOOT) += tables.o
#
# ACPI Core Subsystem (Interpreter)
#
obj-$(CONFIG_ACPI_INTERPRETER) += acpi_osl.o acpi_utils.o \
obj-$(CONFIG_ACPI_INTERPRETER) += osl.o utils.o \
dispatcher/ events/ executer/ hardware/ \
namespace/ parser/ resources/ tables/ \
utilities/
......@@ -32,16 +34,16 @@ obj-$(CONFIG_ACPI_INTERPRETER) += acpi_osl.o acpi_utils.o \
#
# ACPI Bus and Device Drivers
#
obj-$(CONFIG_ACPI_BUS) += acpi_bus.o
obj-$(CONFIG_ACPI_AC) += acpi_ac.o
obj-$(CONFIG_ACPI_BATTERY) += acpi_battery.o
obj-$(CONFIG_ACPI_BUTTON) += acpi_button.o
obj-$(CONFIG_ACPI_EC) += acpi_ec.o
obj-$(CONFIG_ACPI_FAN) += acpi_fan.o
obj-$(CONFIG_ACPI_PCI) += acpi_pci_root.o acpi_pci_link.o
obj-$(CONFIG_ACPI_POWER) += acpi_power.o
obj-$(CONFIG_ACPI_PROCESSOR) += acpi_processor.o
obj-$(CONFIG_ACPI_THERMAL) += acpi_thermal.o
obj-$(CONFIG_ACPI_SYSTEM) += acpi_system.o
obj-$(CONFIG_ACPI_BUS) += bus.o
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o
obj-$(CONFIG_ACPI_EC) += ec.o
obj-$(CONFIG_ACPI_FAN) += fan.o
obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o
obj-$(CONFIG_ACPI_POWER) += power.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-$(CONFIG_ACPI_SYSTEM) += system.o
include $(TOPDIR)/Rules.make
/*
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 23 $)
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 26 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -27,6 +27,8 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -91,9 +93,6 @@ acpi_ac_get_state (
FS Interface (/proc)
-------------------------------------------------------------------------- */
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
struct proc_dir_entry *acpi_ac_dir = NULL;
static int
......@@ -114,7 +113,7 @@ acpi_ac_read_state (
if (!ac || (off != 0))
goto end;
if (0 != acpi_ac_get_state(ac)) {
if (acpi_ac_get_state(ac)) {
p += sprintf(p, "ERROR: Unable to read AC Adapter state\n");
goto end;
}
......@@ -215,7 +214,7 @@ acpi_ac_notify (
if (!ac)
return;
if (0 != acpi_bus_get_device(ac->handle, &device))
if (acpi_bus_get_device(ac->handle, &device))
return_VOID;
switch (event) {
......@@ -257,11 +256,11 @@ acpi_ac_add (
acpi_driver_data(device) = ac;
result = acpi_ac_get_state(ac);
if (0 != result)
if (result)
goto end;
result = acpi_ac_add_fs(device);
if (0 != result)
if (result)
goto end;
status = acpi_install_notify_handler(ac->handle,
......@@ -278,7 +277,7 @@ acpi_ac_add (
ac->state?"on-line":"off-line");
end:
if (0 != result) {
if (result) {
acpi_ac_remove_fs(device);
kfree(ac);
}
......@@ -324,7 +323,7 @@ acpi_ac_init (void)
ACPI_FUNCTION_TRACE("acpi_ac_init");
result = acpi_bus_register_driver(&acpi_ac_driver);
if (0 > result) {
if (result < 0) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
......@@ -341,7 +340,7 @@ acpi_ac_exit (void)
ACPI_FUNCTION_TRACE("acpi_ac_exit");
result = acpi_bus_unregister_driver(&acpi_ac_driver);
if (0 == result)
if (!result)
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VOID;
......
/*
* acpi_bus.h - ACPI Bus Driver ($Revision: 19 $)
* acpi_bus.h - ACPI Bus Driver ($Revision: 21 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -56,9 +56,7 @@ acpi_status acpi_evaluate_reference (acpi_handle, acpi_string, acpi_object_list
#include <linux/proc_fs.h>
#define ACPI_BUS_FILE_ROOT "acpi"
extern struct proc_dir_entry *acpi_root_dir;
extern FADT_DESCRIPTOR acpi_fadt;
enum acpi_bus_removal_type {
......
/*
* acpi_drivers.h ($Revision: 23 $)
* acpi_drivers.h ($Revision: 29 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -30,7 +30,6 @@
#include "acpi_bus.h"
#define ACPI_DRIVER_VERSION 0x20020404
#define ACPI_MAX_STRING 80
......@@ -148,41 +147,53 @@ void acpi_ec_exit (void);
PCI
-------------------------------------------------------------------------- */
#define ACPI_PCI_LINK_COMPONENT 0x00400000
#define ACPI_PCI_LINK_CLASS "irq_routing"
#define ACPI_PCI_LINK_HID "PNP0C0F"
#define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver"
#define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
#define ACPI_PCI_LINK_FILE_INFO "info"
#define ACPI_PCI_LINK_FILE_STATUS "state"
#ifdef CONFIG_ACPI_PCI
#define ACPI_PCI_ROOT_COMPONENT 0x00800000
#define ACPI_PCI_ROOT_CLASS "bridge"
#define ACPI_PCI_COMPONENT 0x00400000
/* ACPI PCI Root Bridge (pci_root.c) */
#define ACPI_PCI_ROOT_CLASS "pci_bridge"
#define ACPI_PCI_ROOT_HID "PNP0A03"
#define ACPI_PCI_ROOT_DRIVER_NAME "ACPI PCI Root Bridge Driver"
#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
#define ACPI_PCI_PRT_DEVICE_NAME "PCI Interrupt Routing Table"
int acpi_pci_root_init (void);
void acpi_pci_root_exit (void);
#ifdef CONFIG_ACPI_PCI
/* ACPI PCI Interrupt Link (pci_link.c) */
#define ACPI_PCI_LINK_CLASS "pci_irq_routing"
#define ACPI_PCI_LINK_HID "PNP0C0F"
#define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver"
#define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
#define ACPI_PCI_LINK_FILE_INFO "info"
#define ACPI_PCI_LINK_FILE_STATUS "state"
int acpi_pci_link_get_irq (struct acpi_prt_entry *entry, int *irq);
int acpi_pci_link_set_irq (struct acpi_prt_entry *entry, int irq);
int acpi_pci_link_check (void);
int acpi_pci_link_get_irq (acpi_handle handle, int index);
int acpi_pci_link_init (void);
void acpi_pci_link_exit (void);
int acpi_pci_root_init (void);
void acpi_pci_root_exit (void);
/* ACPI PCI Interrupt Routing (pci_irq.c) */
#endif
int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
/* ACPI PCI Device Binding (pci_bind.c) */
struct pci_bus;
int acpi_pci_bind (struct acpi_device *device);
int acpi_pci_bind_root (struct acpi_device *device, acpi_pci_id *id, struct pci_bus *bus);
#endif /*CONFIG_ACPI_PCI*/
/* --------------------------------------------------------------------------
Power Resource
-------------------------------------------------------------------------- */
#define ACPI_POWER_COMPONENT 0x01000000
#define ACPI_POWER_COMPONENT 0x00800000
#define ACPI_POWER_CLASS "power_resource"
#define ACPI_POWER_HID "ACPI_PWR"
#define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver"
......@@ -207,7 +218,7 @@ void acpi_power_exit (void);
Processor
-------------------------------------------------------------------------- */
#define ACPI_PROCESSOR_COMPONENT 0x02000000
#define ACPI_PROCESSOR_COMPONENT 0x01000000
#define ACPI_PROCESSOR_CLASS "processor"
#define ACPI_PROCESSOR_HID "ACPI_CPU"
#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver"
......@@ -230,7 +241,7 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
System
-------------------------------------------------------------------------- */
#define ACPI_SYSTEM_COMPONENT 0x04000000
#define ACPI_SYSTEM_COMPONENT 0x02000000
#define ACPI_SYSTEM_CLASS "system"
#define ACPI_SYSTEM_HID "ACPI_SYS"
#define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver"
......@@ -256,7 +267,7 @@ void acpi_system_exit (void);
Thermal Zone
-------------------------------------------------------------------------- */
#define ACPI_THERMAL_COMPONENT 0x08000000
#define ACPI_THERMAL_COMPONENT 0x04000000
#define ACPI_THERMAL_CLASS "thermal_zone"
#define ACPI_THERMAL_HID "ACPI_THM"
#define ACPI_THERMAL_DRIVER_NAME "ACPI Thermal Zone Driver"
......
/*
* acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 13 $)
* acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 15 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -80,9 +80,9 @@ EXPORT_SYMBOL(acpi_disable_event);
EXPORT_SYMBOL(acpi_clear_event);
EXPORT_SYMBOL(acpi_get_timer_duration);
EXPORT_SYMBOL(acpi_get_timer);
EXPORT_SYMBOL(acpi_hw_get_sleep_type_data);
EXPORT_SYMBOL(acpi_hw_bit_register_read);
EXPORT_SYMBOL(acpi_hw_bit_register_write);
EXPORT_SYMBOL(acpi_get_sleep_type_data);
EXPORT_SYMBOL(acpi_get_register);
EXPORT_SYMBOL(acpi_set_register);
EXPORT_SYMBOL(acpi_enter_sleep_state);
EXPORT_SYMBOL(acpi_get_system_info);
......
/*
* acpi_battery.c - ACPI Battery Driver ($Revision: 32 $)
* acpi_battery.c - ACPI Battery Driver ($Revision: 35 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -27,6 +27,8 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -162,7 +164,7 @@ acpi_battery_get_info (
end:
kfree(buffer.pointer);
if (0 == result)
if (!result)
(*bif) = (struct acpi_battery_info *) data.pointer;
return_VALUE(result);
......@@ -223,7 +225,7 @@ acpi_battery_get_status (
end:
kfree(buffer.pointer);
if (0 == result)
if (!result)
(*bst) = (struct acpi_battery_status *) data.pointer;
return_VALUE(result);
......@@ -277,11 +279,11 @@ acpi_battery_check (
return_VALUE(-EINVAL);
result = acpi_bus_get_device(battery->handle, &device);
if (0 != result)
if (result)
return_VALUE(result);
result = acpi_bus_get_status(device);
if (0 != result)
if (result)
return_VALUE(result);
/* Insertion? */
......@@ -293,7 +295,7 @@ acpi_battery_check (
/* Evalute _BIF to get certain static information */
result = acpi_battery_get_info(battery, &bif);
if (0 != result)
if (result)
return_VALUE(result);
battery->flags.power_unit = bif->power_unit;
......@@ -326,9 +328,6 @@ acpi_battery_check (
FS Interface (/proc)
-------------------------------------------------------------------------- */
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
struct proc_dir_entry *acpi_battery_dir = NULL;
static int
......@@ -362,7 +361,7 @@ acpi_battery_read_info (
/* Battery Info (_BIF) */
result = acpi_battery_get_info(battery, &bif);
if ((0 != result) || !bif) {
if (result || !bif) {
p += sprintf(p, "ERROR: Unable to read battery information\n");
goto end;
}
......@@ -465,7 +464,7 @@ acpi_battery_read_state (
/* Battery Status (_BST) */
result = acpi_battery_get_status(battery, &bst);
if ((0 != result) || !bst) {
if (result || !bst) {
p += sprintf(p, "ERROR: Unable to read battery status\n");
goto end;
}
......@@ -590,7 +589,7 @@ acpi_battery_write_alarm (
result = acpi_battery_set_alarm(battery,
simple_strtoul(alarm_string, NULL, 0));
if (0 != result)
if (result)
return_VALUE(result);
return_VALUE(count);
......@@ -693,7 +692,7 @@ acpi_battery_notify (
if (!battery)
return_VOID;
if (0 != acpi_bus_get_device(handle, &device))
if (acpi_bus_get_device(handle, &device))
return_VOID;
switch (event) {
......@@ -736,11 +735,11 @@ acpi_battery_add (
acpi_driver_data(device) = battery;
result = acpi_battery_check(battery);
if (0 != result)
if (result)
goto end;
result = acpi_battery_add_fs(device);
if (0 != result)
if (result)
goto end;
status = acpi_install_notify_handler(battery->handle,
......@@ -757,7 +756,7 @@ acpi_battery_add (
device->status.battery_present?"present":"absent");
end:
if (0 != result) {
if (result) {
acpi_battery_remove_fs(device);
kfree(battery);
}
......@@ -803,7 +802,7 @@ acpi_battery_init (void)
ACPI_FUNCTION_TRACE("acpi_battery_init");
result = acpi_bus_register_driver(&acpi_battery_driver);
if (0 > result) {
if (result < 0) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
......@@ -820,7 +819,7 @@ acpi_battery_exit (void)
ACPI_FUNCTION_TRACE("acpi_battery_exit");
result = acpi_bus_unregister_driver(&acpi_battery_driver);
if (0 == result)
if (!result)
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VOID;
......
/*
* acpi_bus.c - ACPI Bus Driver ($Revision: 66 $)
* acpi_bus.c - ACPI Bus Driver ($Revision: 77 $)
*
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
......@@ -47,9 +47,9 @@ MODULE_LICENSE("GPL");
#define PREFIX "ACPI: "
FADT_DESCRIPTOR acpi_fadt;
static u8 acpi_disabled = 0;
struct acpi_device *acpi_root = NULL;
struct proc_dir_entry *acpi_root_dir = NULL;
static u8 acpi_disabled;
struct acpi_device *acpi_root;
struct proc_dir_entry *acpi_root_dir;
#define STRUCT_TO_INT(s) (*((int*)&s))
......@@ -71,6 +71,8 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata =
{"ASUS ", "K7M ", 0x00001000, ACPI_TABLE_DSDT, less_than_or_equal, "Field beyond end of region", 0},
/* Intel 810 Motherboard? */
{"MNTRAL", "MO81010A", 0x00000012, ACPI_TABLE_DSDT, less_than_or_equal, "Field beyond end of region", 0},
/* Compaq Presario 711FR */
{"COMAPQ", "EAGLES", 0x06040000, ACPI_TABLE_DSDT, less_than_or_equal, "SCI issues (C2 disabled)", 0},
/* Compaq Presario 1700 */
{"PTLTD ", " DSDT ", 0x06040000, ACPI_TABLE_DSDT, less_than_or_equal, "Multiple problems", 1},
/* Sony FX120, FX140, FX150? */
......@@ -398,7 +400,7 @@ acpi_bus_get_power (
ACPI_FUNCTION_TRACE("acpi_bus_get_power");
result = acpi_bus_get_device(handle, &device);
if (0 != result)
if (result)
return_VALUE(result);
*state = ACPI_STATE_UNKNOWN;
......@@ -424,7 +426,7 @@ acpi_bus_get_power (
}
else if (device->power.flags.power_resources) {
result = acpi_power_get_inferred_state(device);
if (0 != result)
if (result)
return_VALUE(result);
}
......@@ -451,7 +453,7 @@ acpi_bus_set_power (
ACPI_FUNCTION_TRACE("acpi_bus_set_power");
result = acpi_bus_get_device(handle, &device);
if (0 != result)
if (result)
return_VALUE(result);
if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
......@@ -486,7 +488,7 @@ acpi_bus_set_power (
if (state < device->power.state) {
if (device->power.flags.power_resources) {
result = acpi_power_transition(device, state);
if (0 != result)
if (result)
goto end;
}
if (device->power.states[state].flags.explicit_set) {
......@@ -509,13 +511,13 @@ acpi_bus_set_power (
}
if (device->power.flags.power_resources) {
result = acpi_power_transition(device, state);
if (0 != result)
if (result)
goto end;
}
}
end:
if (0 != result)
if (result)
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
device->pnp.bus_id, state));
else
......@@ -893,7 +895,7 @@ acpi_bus_check_scope (
/* Status Change? */
result = acpi_bus_check_device(device, &status_changed);
if (0 != result)
if (result)
return_VALUE(result);
if (!status_changed)
......@@ -924,7 +926,7 @@ acpi_bus_notify (
ACPI_FUNCTION_TRACE("acpi_bus_notify");
if (0 != acpi_bus_get_device(handle, &device))
if (acpi_bus_get_device(handle, &device))
return_VOID;
switch (type) {
......@@ -1019,7 +1021,7 @@ acpi_bus_match (
return -EINVAL;
if (device->flags.hardware_id) {
if (0 != strstr(driver->ids, device->pnp.hardware_id))
if (strstr(driver->ids, device->pnp.hardware_id))
return 0;
}
......@@ -1048,12 +1050,13 @@ acpi_bus_match (
break;
case ACPI_TYPE_PACKAGE:
/* TBD: Support CID packages */
break;
}
if (!cid[0])
return -ENOENT;
if (0 != strstr(cid, device->pnp.hardware_id))
if (strstr(driver->ids, cid))
return 0;
}
......@@ -1083,7 +1086,7 @@ acpi_bus_driver_init (
return_VALUE(-ENOSYS);
result = driver->ops.add(device);
if (0 != result) {
if (result) {
device->driver = NULL;
acpi_driver_data(device) = NULL;
return_VALUE(result);
......@@ -1096,7 +1099,7 @@ acpi_bus_driver_init (
if (driver->ops.start) {
result = driver->ops.start(device);
if ((0 != result) && (driver->ops.remove))
if (result && driver->ops.remove)
driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
return_VALUE(result);
}
......@@ -1149,14 +1152,14 @@ acpi_bus_attach (
return_VALUE(-ENODEV);
result = acpi_bus_match(device, driver);
if (0 != result)
if (result)
return_VALUE(result);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n",
driver->name, device->pnp.bus_id));
result = acpi_bus_driver_init(device, driver);
if (0 != result)
if (result)
return_VALUE(result);
down(&acpi_bus_drivers_lock);
......@@ -1194,7 +1197,7 @@ acpi_bus_unattach (
return_VALUE(-ENOSYS);
result = driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
if (0 != result)
if (result)
return_VALUE(result);
device->driver = NULL;
......@@ -1233,11 +1236,11 @@ acpi_bus_find_driver (
driver = list_entry(entry, struct acpi_driver, node);
if (0 != acpi_bus_match(device, driver))
if (acpi_bus_match(device, driver))
continue;
result = acpi_bus_driver_init(device, driver);
if (0 == result)
if (!result)
++driver->references;
break;
......@@ -1431,7 +1434,7 @@ acpi_bus_add (
* present and properly initialized.
*/
result = acpi_bus_get_flags(device);
if (0 != result)
if (result)
goto end;
/*
......@@ -1446,7 +1449,7 @@ acpi_bus_add (
switch (type) {
case ACPI_BUS_TYPE_DEVICE:
result = acpi_bus_get_status(device);
if (0 != result)
if (result)
goto end;
break;
default:
......@@ -1535,7 +1538,7 @@ acpi_bus_add (
*/
if (device->flags.power_manageable) {
result = acpi_bus_get_power_flags(device);
if (0 != result)
if (result)
goto end;
}
......@@ -1545,7 +1548,7 @@ acpi_bus_add (
*/
if (device->flags.performance_manageable) {
result = acpi_bus_get_perf_flags(device);
if (0 != result)
if (result)
goto end;
}
......@@ -1655,7 +1658,7 @@ acpi_bus_add (
acpi_bus_find_driver(device);
end:
if (0 != result) {
if (result) {
kfree(device);
return_VALUE(result);
}
......@@ -1877,15 +1880,12 @@ acpi_blacklisted(void)
return blacklisted;
}
static int __init
acpi_bus_init_irq (void)
{
int result = 0;
acpi_status status = AE_OK;
acpi_object arg = {ACPI_TYPE_INTEGER};
acpi_object_list arg_list = {1, &arg};
int irq_model = 0;
char *message = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
......@@ -1894,28 +1894,25 @@ acpi_bus_init_irq (void)
* Let the system know what interrupt model we are using by
* evaluating the \_PIC object, if exists.
*/
result = acpi_get_interrupt_model(&irq_model);
if (0 != result)
return_VALUE(result);
switch (irq_model) {
case ACPI_INT_MODEL_PIC:
switch (acpi_irq_model) {
case ACPI_IRQ_MODEL_PIC:
message = "PIC";
break;
case ACPI_INT_MODEL_IOAPIC:
case ACPI_IRQ_MODEL_IOAPIC:
message = "IOAPIC";
break;
case ACPI_INT_MODEL_IOSAPIC:
case ACPI_IRQ_MODEL_IOSAPIC:
message = "IOSAPIC";
break;
default:
message = "UNKNOWN";
break;
printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
return_VALUE(-ENODEV);
}
printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
arg.integer.value = irq_model;
arg.integer.value = acpi_irq_model;
status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
......@@ -1998,12 +1995,14 @@ acpi_bus_init (void)
progress++;
/*
* [5] Register for all standard device notifications.
* [5] Get the system interrupt model and evaluate \_PIC.
*/
result = acpi_bus_init_irq();
if (0 != result)
if (result)
goto end;
progress++;
/*
* [6] Register for all standard device notifications.
*/
......@@ -2021,7 +2020,7 @@ acpi_bus_init (void)
*/
result = acpi_bus_add(&acpi_root, NULL, ACPI_ROOT_OBJECT,
ACPI_BUS_TYPE_SYSTEM);
if (0 != result)
if (result)
goto end;
progress++;
......@@ -2056,17 +2055,18 @@ acpi_bus_init (void)
/*
* [10] Enumerate devices in the ACPI namespace.
*/
result = acpi_bus_scan_fixed(acpi_root);
if (0 != result)
if (result)
goto end;
result = acpi_bus_scan(acpi_root);
if (0 != result)
if (result)
goto end;
end:
if (0 != result) {
/*
* Clean up if anything went awry.
*/
if (result) {
switch (progress) {
case 10:
case 9: remove_proc_entry("ACPI", NULL);
......@@ -2132,9 +2132,7 @@ acpi_init (void)
ACPI_FUNCTION_TRACE("acpi_init");
printk(KERN_INFO PREFIX "Bus Driver revision %08x\n",
ACPI_DRIVER_VERSION);
printk(KERN_INFO PREFIX "Core Subsystem revision %08x\n",
printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
ACPI_CA_VERSION);
/* Initial core debug level excludes drivers, so include them now */
......@@ -2153,7 +2151,7 @@ acpi_init (void)
#endif
result = acpi_bus_init();
if (0 != result)
if (result)
return_VALUE(result);
#ifdef CONFIG_PM
......@@ -2192,10 +2190,6 @@ acpi_setup(char *str)
return 1;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
subsys_initcall(acpi_init);
#endif
__setup("acpi=", acpi_setup);
/*
* acpi_button.c - ACPI Button Driver ($Revision: 24 $)
* acpi_button.c - ACPI Button Driver ($Revision: 29 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -27,6 +27,8 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -66,9 +68,6 @@ struct acpi_button {
FS Interface (/proc)
-------------------------------------------------------------------------- */
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
static struct proc_dir_entry *acpi_button_dir = NULL;
......@@ -128,17 +127,17 @@ acpi_button_add_fs (
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_LID:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
break;
}
......@@ -234,6 +233,10 @@ acpi_button_add (
acpi_status status = AE_OK;
struct acpi_button *button = NULL;
static struct acpi_device *power_button;
static struct acpi_device *sleep_button;
static struct acpi_device *lid_button;
ACPI_FUNCTION_TRACE("acpi_button_add");
if (!device)
......@@ -294,8 +297,40 @@ acpi_button_add (
goto end;
}
/*
* Ensure only one button of each type is used.
*/
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
if (!power_button)
power_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
if (!sleep_button)
sleep_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
case ACPI_BUTTON_TYPE_LID:
if (!lid_button)
lid_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
}
result = acpi_button_add_fs(device);
if (0 != result)
if (result)
goto end;
switch (button->type) {
......@@ -331,7 +366,7 @@ acpi_button_add (
acpi_device_name(device), acpi_device_bid(device));
end:
if (0 != result) {
if (result) {
acpi_button_remove_fs(device);
kfree(button);
}
......@@ -389,7 +424,7 @@ acpi_button_init (void)
ACPI_FUNCTION_TRACE("acpi_button_init");
result = acpi_bus_register_driver(&acpi_button_driver);
if (0 > result)
if (result < 0)
return_VALUE(-ENODEV);
return_VALUE(0);
......
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 79 $
* $Revision: 83 $
*
******************************************************************************/
......@@ -25,15 +25,11 @@
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "actables.h"
#include "acresrc.h"
#ifdef ENABLE_DEBUGGER
......@@ -47,7 +43,7 @@
* These object types map directly to the ACPI_TYPES
*/
ARGUMENT_INFO acpi_db_object_types [] =
static ARGUMENT_INFO acpi_db_object_types [] =
{ {"ANY"},
{"NUMBERS"},
{"STRINGS"},
......@@ -97,13 +93,13 @@ acpi_db_walk_for_references (
/* Check for match against the namespace node itself */
if (node == (void *) obj_desc) {
acpi_os_printf ("Object is a Node [%4.4s]\n", &node->name);
acpi_os_printf ("Object is a Node [%4.4s]\n", node->name.ascii);
}
/* Check for match against the object attached to the node */
if (acpi_ns_get_attached_object (node) == obj_desc) {
acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name);
acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, node->name.ascii);
}
return (AE_OK);
......@@ -135,7 +131,7 @@ acpi_db_find_references (
/* Search all nodes in namespace */
acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
(void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_references, (void *) obj_desc, NULL);
}
......@@ -275,8 +271,8 @@ acpi_db_set_method_breakpoint (
/* Get and verify the breakpoint address */
address = ACPI_STRTOUL (location, NULL, 16);
if (address <= op->aml_offset) {
acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->aml_offset);
if (address <= op->common.aml_offset) {
acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->common.aml_offset);
}
/* Save breakpoint in current walk */
......@@ -482,6 +478,7 @@ acpi_db_send_notify (
u32 value)
{
acpi_namespace_node *node;
acpi_status status;
/* Translate name to an Named object */
......@@ -499,7 +496,10 @@ acpi_db_send_notify (
/* Send the notify */
acpi_ev_queue_notify_request (node, value);
status = acpi_ev_queue_notify_request (node, value);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not queue notify\n");
}
break;
default:
......@@ -536,6 +536,7 @@ acpi_db_set_method_data (
u32 value;
acpi_walk_state *walk_state;
acpi_operand_object *obj_desc;
acpi_status status;
/* Validate Type_arg */
......@@ -578,12 +579,16 @@ acpi_db_set_method_data (
/* Set a method argument */
if (index > MTH_NUM_ARGS) {
if (index > MTH_MAX_ARG) {
acpi_os_printf ("Arg%d - Invalid argument name\n", index);
return;
}
acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
status = acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
return;
}
obj_desc = walk_state->arguments[index].object;
acpi_os_printf ("Arg%d: ", index);
......@@ -594,12 +599,16 @@ acpi_db_set_method_data (
/* Set a method local */
if (index > MTH_NUM_LOCALS) {
if (index > MTH_MAX_LOCAL) {
acpi_os_printf ("Local%d - Invalid local variable name\n", index);
return;
}
acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
status = acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
if (ACPI_FAILURE (status)) {
return;
}
obj_desc = walk_state->local_variables[index].object;
acpi_os_printf ("Local%d: ", index);
......@@ -678,6 +687,10 @@ acpi_db_walk_for_specific_objects (
case ACPI_TYPE_BUFFER:
acpi_os_printf (" Length %X", obj_desc->buffer.length);
break;
default:
/* Ignore other object types */
break;
}
}
......@@ -722,7 +735,7 @@ acpi_db_display_objects (
/* Walk the namespace from the root */
acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
(void) acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_specific_objects, (void *) &type, NULL);
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
......@@ -762,7 +775,7 @@ acpi_db_walk_and_match_name (
/* Wildcard support */
if ((requested_name[i] != '?') &&
(requested_name[i] != ((NATIVE_CHAR *) (&((acpi_namespace_node *) obj_handle)->name))[i])) {
(requested_name[i] != ((acpi_namespace_node *) obj_handle)->name.ascii[i])) {
/* No match, just exit */
return (AE_OK);
......@@ -812,7 +825,7 @@ acpi_db_find_name_in_namespace (
/* Walk the namespace from the root */
acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
(void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_and_match_name, name_arg, NULL);
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
......@@ -899,7 +912,8 @@ void
acpi_db_display_resources (
NATIVE_CHAR *object_arg)
{
#ifndef _IA16
#if ACPI_MACHINE_WIDTH != 16
acpi_operand_object *obj_desc;
acpi_status status;
acpi_buffer return_obj;
......@@ -964,7 +978,7 @@ acpi_db_display_resources (
}
else {
acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
}
status = acpi_set_current_resources (obj_desc, &return_obj);
......@@ -997,7 +1011,7 @@ acpi_db_display_resources (
}
else {
acpi_rs_dump_resource_list ((acpi_resource *) acpi_gbl_db_buffer);
acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
}
......@@ -1010,4 +1024,89 @@ acpi_db_display_resources (
}
typedef struct
{
u32 nodes;
u32 objects;
} ACPI_INTEGRITY_INFO;
/*******************************************************************************
*
* FUNCTION: Acpi_db_integrity_walk
*
* PARAMETERS: Callback from Walk_namespace
*
* RETURN: Status
*
* DESCRIPTION: Examine one NS node for valid values.
*
******************************************************************************/
acpi_status
acpi_db_integrity_walk (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
{
ACPI_INTEGRITY_INFO *info = (ACPI_INTEGRITY_INFO *) context;
acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
acpi_operand_object *object;
info->nodes++;
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
acpi_os_printf ("Invalid Descriptor Type for Node %p, Type = %X\n",
node, ACPI_GET_DESCRIPTOR_TYPE (node));
}
if (node->type > INTERNAL_TYPE_MAX) {
acpi_os_printf ("Invalid Object Type for Node %p, Type = %X\n",
node, node->type);
}
if (!acpi_ut_valid_acpi_name (node->name.integer)) {
acpi_os_printf ("Invalid Acpi_name for Node %p\n", node);
}
object = acpi_ns_get_attached_object (node);
if (object) {
info->objects++;
if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf ("Invalid Descriptor Type for Object %p, Type = %X\n",
object, ACPI_GET_DESCRIPTOR_TYPE (object));
}
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_check_integrity
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Check entire namespace for data structure integrity
*
******************************************************************************/
void
acpi_db_check_integrity (void)
{
ACPI_INTEGRITY_INFO info = {0,0};
/* Search all nodes in namespace */
(void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_integrity_walk, (void *) &info, NULL);
acpi_os_printf ("Verified %d namespace nodes with %d Objects\n", info.nodes, info.objects);
}
#endif /* ENABLE_DEBUGGER */
This diff is collapsed.
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 67 $
* $Revision: 73 $
*
******************************************************************************/
......@@ -25,12 +25,10 @@
#include "acpi.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
......@@ -61,7 +59,7 @@ acpi_db_get_pointer (
void *obj_ptr;
#ifdef _IA16
#if ACPI_MACHINE_WIDTH == 16
#include <stdio.h>
/* Have to handle 16-bit pointers of the form segment:offset */
......@@ -101,16 +99,16 @@ acpi_db_dump_parser_descriptor (
const acpi_opcode_info *info;
info = acpi_ps_get_opcode_info (op->opcode);
info = acpi_ps_get_opcode_info (op->common.aml_opcode);
acpi_os_printf ("Parser Op Descriptor:\n");
acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->opcode);
acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
ACPI_DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->value);
acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent);
acpi_os_printf ("%20.20s : %p\n", "Next_op", op->next);
acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->common.value.arg);
acpi_os_printf ("%20.20s : %p\n", "Parent", op->common.parent);
acpi_os_printf ("%20.20s : %p\n", "Next_op", op->common.next);
}
......@@ -190,7 +188,7 @@ acpi_db_decode_and_display_object (
goto dump_nte;
case ACPI_DESC_TYPE_INTERNAL:
case ACPI_DESC_TYPE_OPERAND:
/* This is a ACPI OPERAND OBJECT */
......@@ -266,7 +264,7 @@ acpi_db_decode_and_display_object (
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
acpi_os_printf ("\n_attached Object (%p):\n", obj_desc);
acpi_os_printf ("\nAttached Object (%p):\n", obj_desc);
if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) {
acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc);
return;
......@@ -307,8 +305,8 @@ acpi_db_decode_internal_object (
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:
acpi_os_printf (" %.8X%.8X", ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
......@@ -335,6 +333,11 @@ acpi_db_decode_internal_object (
acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
}
break;
default:
/* No additional display for other types */
break;
}
}
......@@ -379,7 +382,7 @@ acpi_db_display_internal_object (
case ACPI_DESC_TYPE_NAMED:
acpi_os_printf ("<Node> Name %4.4s Type-%s",
&((acpi_namespace_node *)obj_desc)->name,
((acpi_namespace_node *)obj_desc)->name.ascii,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
......@@ -391,11 +394,11 @@ acpi_db_display_internal_object (
break;
case ACPI_DESC_TYPE_INTERNAL:
case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type;
if (type > INTERNAL_TYPE_MAX) {
acpi_os_printf (" Type %x [Invalid Type]", type);
acpi_os_printf (" Type %hX [Invalid Type]", type);
return;
}
......@@ -517,13 +520,13 @@ acpi_db_display_method_info (
num_args = obj_desc->method.param_count;
concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Currently executing control method is [%4.4s]\n", &node->name);
acpi_os_printf ("Currently executing control method is [%4.4s]\n", node->name.ascii);
acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency);
root_op = start_op;
while (root_op->parent) {
root_op = root_op->parent;
while (root_op->common.parent) {
root_op = root_op->common.parent;
}
op = root_op;
......@@ -540,7 +543,7 @@ acpi_db_display_method_info (
/* Decode the opcode */
op_info = acpi_ps_get_opcode_info (op->opcode);
op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
switch (op_info->class) {
case AML_CLASS_ARGUMENT:
if (count_remaining) {
......@@ -604,7 +607,7 @@ acpi_db_display_locals (void)
obj_desc = walk_state->method_desc;
node = walk_state->method_node;
acpi_os_printf ("Local Variables for method [%4.4s]:\n", &node->name);
acpi_os_printf ("Local Variables for method [%4.4s]:\n", node->name.ascii);
for (i = 0; i < MTH_NUM_LOCALS; i++) {
obj_desc = walk_state->local_variables[i].object;
......@@ -650,7 +653,7 @@ acpi_db_display_arguments (void)
concurrency = obj_desc->method.concurrency;
acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
&node->name, num_args, concurrency);
node->name.ascii, num_args, concurrency);
for (i = 0; i < num_args; i++) {
obj_desc = walk_state->arguments[i].object;
......@@ -696,7 +699,7 @@ acpi_db_display_results (void)
}
acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
&node->name, num_results);
node->name.ascii, num_results);
for (i = 0; i < num_results; i++) {
obj_desc = walk_state->results->results.obj_desc[i];
......@@ -721,7 +724,6 @@ acpi_db_display_results (void)
void
acpi_db_display_calling_tree (void)
{
u32 i;
acpi_walk_state *walk_state;
acpi_namespace_node *node;
......@@ -735,10 +737,10 @@ acpi_db_display_calling_tree (void)
node = walk_state->method_node;
acpi_os_printf ("Current Control Method Call Tree\n");
for (i = 0; walk_state; i++) {
while (walk_state) {
node = walk_state->method_node;
acpi_os_printf (" [%4.4s]\n", &node->name);
acpi_os_printf (" [%4.4s]\n", node->name.ascii);
walk_state = walk_state->next;
}
......
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
* $Revision: 39 $
* $Revision: 41 $
*
******************************************************************************/
......@@ -25,15 +25,7 @@
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER
......@@ -41,7 +33,7 @@
ACPI_MODULE_NAME ("dbexec")
acpi_db_method_info acpi_gbl_db_method_info;
static acpi_db_method_info acpi_gbl_db_method_info;
/*******************************************************************************
......@@ -127,7 +119,7 @@ acpi_db_execute_method (
void
acpi_db_execute_setup (
acpi_db_method_info *info)
acpi_db_method_info *info)
{
/* Catenate the current scope to the supplied name */
......@@ -172,7 +164,8 @@ acpi_db_execute_setup (
******************************************************************************/
u32
acpi_db_get_outstanding_allocations (void)
acpi_db_get_outstanding_allocations (
void)
{
u32 outstanding = 0;
......@@ -309,7 +302,10 @@ acpi_db_method_thread (
/* Signal our completion */
acpi_os_signal_semaphore (info->thread_gate, 1);
status = acpi_os_signal_semaphore (info->thread_gate, 1);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not signal debugger semaphore\n");
}
}
......@@ -373,7 +369,10 @@ acpi_db_create_execution_threads (
acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
for (i = 0; i < (num_threads); i++) {
acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
status = acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
if (ACPI_FAILURE (status)) {
break;
}
}
/* Wait for all threads to complete */
......@@ -386,7 +385,7 @@ acpi_db_create_execution_threads (
/* Cleanup and exit */
acpi_os_delete_semaphore (thread_gate);
(void) acpi_os_delete_semaphore (thread_gate);
acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("All threads (%X) have completed\n", num_threads);
......
......@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 60 $
* $Revision: 63 $
*
******************************************************************************/
......@@ -28,8 +28,6 @@
#include "acpi.h"
#include "acdebug.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER
......@@ -167,7 +165,7 @@ acpi_db_open_debug_file (
*
******************************************************************************/
acpi_status
static acpi_status
acpi_db_load_table(
FILE *fp,
acpi_table_header **table_ptr,
......@@ -285,7 +283,7 @@ ae_local_load_table (
table_info.pointer = table_ptr;
status = acpi_tb_install_table (NULL, &table_info);
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
/* Free table allocated by Acpi_tb_get_table */
......@@ -371,7 +369,7 @@ acpi_db_load_acpi_table (
if (ACPI_FAILURE (status)) {
if (status == AE_ALREADY_EXISTS) {
acpi_os_printf ("Table %4.4s is already installed\n",
&acpi_gbl_db_table_ptr->signature);
acpi_gbl_db_table_ptr->signature);
}
else {
acpi_os_printf ("Could not install table, %s\n",
......@@ -382,7 +380,7 @@ acpi_db_load_acpi_table (
}
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
&acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
acpi_gbl_acpi_hardware_present = FALSE;
......
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
* $Revision: 22 $
* $Revision: 24 $
*
*****************************************************************************/
......@@ -25,15 +25,7 @@
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER
......@@ -54,11 +46,11 @@ typedef struct history_info
} HISTORY_INFO;
HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
u16 acpi_gbl_lo_history = 0;
u16 acpi_gbl_num_history = 0;
u16 acpi_gbl_next_history_index = 0;
u32 acpi_gbl_next_cmd_num = 1;
static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
static u16 acpi_gbl_lo_history = 0;
static u16 acpi_gbl_num_history = 0;
static u16 acpi_gbl_next_history_index = 0;
static u32 acpi_gbl_next_cmd_num = 1;
/*******************************************************************************
......
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 81 $
* $Revision: 86 $
*
******************************************************************************/
......@@ -25,10 +25,6 @@
#include "acpi.h"
#include "acparser.h"
#include "actables.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acdebug.h"
......@@ -67,6 +63,7 @@ enum acpi_ex_debugger_commands
CMD_HISTORY_EXE,
CMD_HISTORY_LAST,
CMD_INFORMATION,
CMD_INTEGRITY,
CMD_INTO,
CMD_LEVEL,
CMD_LIST,
......@@ -97,7 +94,7 @@ enum acpi_ex_debugger_commands
#define CMD_FIRST_VALID 2
const COMMAND_INFO acpi_gbl_db_commands[] =
static const COMMAND_INFO acpi_gbl_db_commands[] =
{ {"<NOT FOUND>", 0},
{"<NULL>", 0},
{"ALLOCATIONS", 0},
......@@ -120,6 +117,7 @@ const COMMAND_INFO acpi_gbl_db_commands[] =
{"!", 1},
{"!!", 0},
{"INFORMATION", 0},
{"INTEGRITY", 0},
{"INTO", 0},
{"LEVEL", 0},
{"LIST", 0},
......@@ -190,7 +188,7 @@ acpi_db_display_help (
switch (help_type[0])
{
case 'G':
acpi_os_printf ("\n_general-Purpose Commands\n\n");
acpi_os_printf ("\nGeneral-Purpose Commands\n\n");
acpi_os_printf ("Allocations Display list of current memory allocations\n");
acpi_os_printf ("Dump <Address>|<Namepath>\n");
acpi_os_printf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
......@@ -209,7 +207,7 @@ acpi_db_display_help (
return;
case 'N':
acpi_os_printf ("\n_namespace Access Commands\n\n");
acpi_os_printf ("\nNamespace Access Commands\n\n");
acpi_os_printf ("Debug <Namepath> [Arguments] Single Step a control method\n");
acpi_os_printf ("Event <F|G> <Value> Generate Acpi_event (Fixed/GPE)\n");
acpi_os_printf ("Execute <Namepath> [Arguments] Execute control method\n");
......@@ -227,7 +225,7 @@ acpi_db_display_help (
return;
case 'M':
acpi_os_printf ("\n_control Method Execution Commands\n\n");
acpi_os_printf ("\nControl Method Execution Commands\n\n");
acpi_os_printf ("Arguments (or Args) Display method arguments\n");
acpi_os_printf ("Breakpoint <Aml_offset> Set an AML execution breakpoint\n");
acpi_os_printf ("Call Run to next control method invocation\n");
......@@ -244,14 +242,14 @@ acpi_db_display_help (
return;
case 'F':
acpi_os_printf ("\n_file I/O Commands\n\n");
acpi_os_printf ("\nFile I/O Commands\n\n");
acpi_os_printf ("Close Close debug output file\n");
acpi_os_printf ("Open <Output Filename> Open a file for debug output\n");
acpi_os_printf ("Load <Input Filename> Load ACPI table from a file\n");
return;
default:
acpi_os_printf ("Unrecognized Command Class: %x\n", help_type);
acpi_os_printf ("Unrecognized Command Class: %X\n", help_type);
return;
}
}
......@@ -526,7 +524,7 @@ acpi_db_command_dispatch (
break;
case CMD_FIND:
acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
status = acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]);
break;
case CMD_GO:
......@@ -574,6 +572,10 @@ acpi_db_command_dispatch (
acpi_db_display_method_info (op);
break;
case CMD_INTEGRITY:
acpi_db_check_integrity ();
break;
case CMD_INTO:
if (op)
{
......@@ -623,7 +625,7 @@ acpi_db_command_dispatch (
break;
case CMD_METHODS:
acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
status = acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]);
break;
case CMD_NAMESPACE:
......@@ -636,7 +638,8 @@ acpi_db_command_dispatch (
break;
case CMD_OBJECT:
acpi_db_display_objects (ACPI_STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
ACPI_STRUPR (acpi_gbl_db_args[1]);
status = acpi_db_display_objects (acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
break;
case CMD_OPEN:
......@@ -668,11 +671,11 @@ acpi_db_command_dispatch (
break;
case CMD_STATS:
acpi_db_display_statistics (acpi_gbl_db_args[1]);
status = acpi_db_display_statistics (acpi_gbl_db_args[1]);
break;
case CMD_STOP:
return (AE_AML_ERROR);
return (AE_NOT_IMPLEMENTED);
case CMD_TABLES:
acpi_db_display_table_info (acpi_gbl_db_args[1]);
......@@ -722,6 +725,7 @@ acpi_db_command_dispatch (
return (AE_CTRL_TERMINATE);
case CMD_NOT_FOUND:
default:
acpi_os_printf ("Unknown Command\n");
return (AE_CTRL_TRUE);
}
......@@ -794,13 +798,11 @@ void
acpi_db_single_thread (
void)
{
acpi_status status;
acpi_gbl_method_executing = FALSE;
acpi_gbl_step_to_next_call = FALSE;
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
(void) acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
}
......@@ -847,8 +849,7 @@ acpi_db_user_commands (
/* Get the user input line */
acpi_os_get_line (acpi_gbl_db_line_buf);
(void) acpi_os_get_line (acpi_gbl_db_line_buf);
/* Check for single or multithreaded debug */
......@@ -882,7 +883,7 @@ acpi_db_user_commands (
* Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination
*/
acpi_terminate ();
status = acpi_terminate ();
return (status);
}
......
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 55 $
* $Revision: 59 $
*
******************************************************************************/
......@@ -26,8 +26,6 @@
#include <acpi.h>
#include <acdebug.h>
#include <amlcode.h>
#include <acparser.h>
#include <acnamesp.h>
#ifdef ENABLE_DEBUGGER
......@@ -38,7 +36,7 @@
/*
* Statistics subcommands
*/
ARGUMENT_INFO acpi_db_stat_types [] =
static ARGUMENT_INFO acpi_db_stat_types [] =
{ {"ALLOCATIONS"},
{"OBJECTS"},
{"MEMORY"},
......@@ -49,13 +47,13 @@ ARGUMENT_INFO acpi_db_stat_types [] =
{NULL} /* Must be null terminated */
};
#define CMD_ALLOCATIONS 0
#define CMD_OBJECTS 1
#define CMD_MEMORY 2
#define CMD_MISC 3
#define CMD_TABLES 4
#define CMD_SIZES 5
#define CMD_STACK 6
#define CMD_STAT_ALLOCATIONS 0
#define CMD_STAT_OBJECTS 1
#define CMD_STAT_MEMORY 2
#define CMD_STAT_MISC 3
#define CMD_STAT_TABLES 4
#define CMD_STAT_SIZES 5
#define CMD_STAT_STACK 6
/*******************************************************************************
......@@ -143,6 +141,9 @@ acpi_db_enumerate_object (
acpi_db_enumerate_object (obj_desc->thermal_zone.drv_handler);
acpi_db_enumerate_object (obj_desc->thermal_zone.addr_handler);
break;
default:
break;
}
}
......@@ -232,7 +233,7 @@ acpi_db_classify_one_object (
*
******************************************************************************/
acpi_status
void
acpi_db_count_namespace_objects (
void)
{
......@@ -249,10 +250,8 @@ acpi_db_count_namespace_objects (
acpi_gbl_node_type_count [i] = 0;
}
acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
(void) acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
FALSE, acpi_db_classify_one_object, NULL, NULL);
return (AE_OK);
}
#endif
......@@ -305,14 +304,14 @@ acpi_db_display_statistics (
switch (type)
{
#ifndef PARSER_ONLY
case CMD_ALLOCATIONS:
case CMD_STAT_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_ut_dump_allocation_info ();
#endif
break;
#endif
case CMD_TABLES:
case CMD_STAT_TABLES:
acpi_os_printf ("ACPI Table Information:\n\n");
if (acpi_gbl_DSDT)
......@@ -321,13 +320,13 @@ acpi_db_display_statistics (
}
break;
case CMD_OBJECTS:
case CMD_STAT_OBJECTS:
#ifndef PARSER_ONLY
acpi_db_count_namespace_objects ();
acpi_os_printf ("\n_objects defined in the current namespace:\n\n");
acpi_os_printf ("\nObjects defined in the current namespace:\n\n");
acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
......@@ -345,7 +344,7 @@ acpi_db_display_statistics (
#endif
break;
case CMD_MEMORY:
case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n");
......@@ -391,9 +390,9 @@ acpi_db_display_statistics (
break;
case CMD_MISC:
case CMD_STAT_MISC:
acpi_os_printf ("\n_miscellaneous Statistics:\n\n");
acpi_os_printf ("\nMiscellaneous Statistics:\n\n");
acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count);
acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count);
......@@ -407,9 +406,9 @@ acpi_db_display_statistics (
break;
case CMD_SIZES:
case CMD_STAT_SIZES:
acpi_os_printf ("\n_internal object sizes:\n\n");
acpi_os_printf ("\nInternal object sizes:\n\n");
acpi_os_printf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
acpi_os_printf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
......@@ -436,23 +435,29 @@ acpi_db_display_statistics (
acpi_os_printf ("\n");
acpi_os_printf ("Parse_object %3d\n", sizeof (acpi_parse_object));
acpi_os_printf ("Parse2_object %3d\n", sizeof (acpi_parse2_object));
acpi_os_printf ("Parse_object %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
acpi_os_printf ("Parse_object_named %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
acpi_os_printf ("Parse_object_asl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
acpi_os_printf ("Operand_object %3d\n", sizeof (acpi_operand_object));
acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node));
break;
case CMD_STACK:
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG)
size = acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer;
size = (u32) (acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer);
acpi_os_printf ("\n_subsystem Stack Usage:\n\n");
acpi_os_printf ("\nSubsystem Stack Usage:\n\n");
acpi_os_printf ("Entry Stack Pointer %X\n", acpi_gbl_entry_stack_pointer);
acpi_os_printf ("Lowest Stack Pointer %X\n", acpi_gbl_lowest_stack_pointer);
acpi_os_printf ("Stack Use %X (%d)\n", size, size);
acpi_os_printf ("Deepest Procedure Nesting %d\n", acpi_gbl_deepest_nesting);
#endif
break;
default:
break;
}
......
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 52 $
* $Revision: 55 $
*
******************************************************************************/
......@@ -28,9 +28,6 @@
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
#include "acdispat.h"
......@@ -87,7 +84,7 @@ acpi_db_dump_buffer (
u32 address)
{
acpi_os_printf ("\n_location %X:\n", address);
acpi_os_printf ("\nLocation %X:\n", address);
acpi_dbg_level |= ACPI_LV_TABLES;
acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
......@@ -259,7 +256,7 @@ acpi_db_second_pass_parse (
acpi_parse_object *root)
{
acpi_parse_object *op = root;
acpi_parse2_object *method;
acpi_parse_object *method;
acpi_parse_object *search_op;
acpi_parse_object *start_op;
acpi_status status = AE_OK;
......@@ -272,10 +269,11 @@ acpi_db_second_pass_parse (
acpi_os_printf ("Pass two parse ....\n");
while (op) {
if (op->opcode == AML_METHOD_OP) {
method = (acpi_parse2_object *) op;
if (op->common.aml_opcode == AML_METHOD_OP) {
method = op;
/* Create a new walk state for the parse */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
NULL, NULL, NULL);
......@@ -283,32 +281,32 @@ acpi_db_second_pass_parse (
return (AE_NO_MEMORY);
}
/* Init the Walk State */
walk_state->parser_state.aml =
walk_state->parser_state.aml_start = method->data;
walk_state->parser_state.aml_start = method->named.data;
walk_state->parser_state.aml_end =
walk_state->parser_state.pkg_end = method->data + method->length;
walk_state->parser_state.pkg_end = method->named.data + method->named.length;
walk_state->parser_state.start_scope = op;
walk_state->descending_callback = acpi_ds_load1_begin_op;
walk_state->ascending_callback = acpi_ds_load1_end_op;
/* Perform the AML parse */
status = acpi_ps_parse_aml (walk_state);
base_aml_offset = (method->value.arg)->aml_offset + 1;
start_op = (method->value.arg)->next;
base_aml_offset = (method->common.value.arg)->common.aml_offset + 1;
start_op = (method->common.value.arg)->common.next;
search_op = start_op;
while (search_op) {
search_op->aml_offset += base_aml_offset;
search_op->common.aml_offset += base_aml_offset;
search_op = acpi_ps_get_depth_next (start_op, search_op);
}
}
if (op->opcode == AML_REGION_OP) {
if (op->common.aml_opcode == AML_REGION_OP) {
/* TBD: [Investigate] this isn't quite the right thing to do! */
/*
*
......
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
* $Revision: 55 $
* $Revision: 59 $
*
******************************************************************************/
......@@ -25,12 +25,7 @@
#include "acpi.h"
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acevents.h"
#include "acinterp.h"
#include "acdebug.h"
......@@ -71,11 +66,12 @@ acpi_db_single_step (
/* Check for single-step breakpoint */
if (walk_state->method_breakpoint && (walk_state->method_breakpoint <= op->aml_offset)) {
if (walk_state->method_breakpoint &&
(walk_state->method_breakpoint <= op->common.aml_offset)) {
/* Check if the breakpoint has been reached or passed */
/* Hit the breakpoint, resume single step, reset breakpoint */
acpi_os_printf ("***Break*** at AML offset %X\n", op->aml_offset);
acpi_os_printf ("***Break*** at AML offset %X\n", op->common.aml_offset);
acpi_gbl_cm_single_step = TRUE;
acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0;
......@@ -83,8 +79,9 @@ acpi_db_single_step (
/* Check for user breakpoint (Must be on exact Aml offset) */
else if (walk_state->user_breakpoint && (walk_state->user_breakpoint == op->aml_offset)) {
acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->aml_offset);
else if (walk_state->user_breakpoint &&
(walk_state->user_breakpoint == op->common.aml_offset)) {
acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->common.aml_offset);
acpi_gbl_cm_single_step = TRUE;
acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0;
......@@ -95,7 +92,7 @@ acpi_db_single_step (
* Check if this is an opcode that we are interested in --
* namely, opcodes that have arguments
*/
if (op->opcode == AML_INT_NAMEDFIELD_OP) {
if (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
return (AE_OK);
}
......@@ -103,6 +100,10 @@ acpi_db_single_step (
case AML_CLASS_UNKNOWN:
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
return (AE_OK);
default:
/* All other opcodes -- continue */
break;
}
/*
......@@ -123,12 +124,12 @@ acpi_db_single_step (
*/
original_debug_level = acpi_dbg_level;
acpi_dbg_level &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
next = op->next;
op->next = NULL;
next = op->common.next;
op->common.next = NULL;
display_op = op;
parent_op = op->parent;
parent_op = op->common.parent;
if (parent_op) {
if ((walk_state->control_state) &&
(walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) {
......@@ -138,25 +139,25 @@ acpi_db_single_step (
* entire predicate can be displayed.
*/
while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) ||
(parent_op->opcode == AML_WHILE_OP)) {
if ((parent_op->common.aml_opcode == AML_IF_OP) ||
(parent_op->common.aml_opcode == AML_WHILE_OP)) {
display_op = parent_op;
break;
}
parent_op = parent_op->parent;
parent_op = parent_op->common.parent;
}
}
else {
while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) ||
(parent_op->opcode == AML_ELSE_OP) ||
(parent_op->opcode == AML_SCOPE_OP) ||
(parent_op->opcode == AML_METHOD_OP) ||
(parent_op->opcode == AML_WHILE_OP)) {
if ((parent_op->common.aml_opcode == AML_IF_OP) ||
(parent_op->common.aml_opcode == AML_ELSE_OP) ||
(parent_op->common.aml_opcode == AML_SCOPE_OP) ||
(parent_op->common.aml_opcode == AML_METHOD_OP) ||
(parent_op->common.aml_opcode == AML_WHILE_OP)) {
break;
}
display_op = parent_op;
parent_op = parent_op->parent;
parent_op = parent_op->common.parent;
}
}
}
......@@ -165,8 +166,8 @@ acpi_db_single_step (
acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX);
if ((op->opcode == AML_IF_OP) ||
(op->opcode == AML_WHILE_OP)) {
if ((op->common.aml_opcode == AML_IF_OP) ||
(op->common.aml_opcode == AML_WHILE_OP)) {
if (walk_state->control_state->common.value) {
acpi_os_printf ("Predicate = [True], IF block was executed\n");
}
......@@ -175,13 +176,13 @@ acpi_db_single_step (
}
}
else if (op->opcode == AML_ELSE_OP) {
else if (op->common.aml_opcode == AML_ELSE_OP) {
acpi_os_printf ("Predicate = [False], ELSE block was executed\n");
}
/* Restore everything */
op->next = next;
op->common.next = next;
acpi_os_printf ("\n");
acpi_dbg_level = original_debug_level;
}
......@@ -197,7 +198,7 @@ acpi_db_single_step (
* Check if this is a method call.
*/
if (acpi_gbl_step_to_next_call) {
if (op->opcode != AML_INT_METHODCALL_OP) {
if (op->common.aml_opcode != AML_INT_METHODCALL_OP) {
/* Not a method call, just keep executing */
return (AE_OK);
......@@ -212,7 +213,7 @@ acpi_db_single_step (
* If the next opcode is a method call, we will "step over" it
* by default.
*/
if (op->opcode == AML_INT_METHODCALL_OP) {
if (op->common.aml_opcode == AML_INT_METHODCALL_OP) {
acpi_gbl_cm_single_step = FALSE; /* No more single step while executing called method */
/* Set the breakpoint on/before the call, it will stop execution as soon as we return */
......@@ -261,7 +262,7 @@ acpi_db_single_step (
/* Get the user input line */
acpi_os_get_line (acpi_gbl_db_line_buf);
(void) acpi_os_get_line (acpi_gbl_db_line_buf);
}
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, walk_state, op);
......@@ -287,9 +288,11 @@ acpi_db_single_step (
*
******************************************************************************/
int
acpi_status
acpi_db_initialize (void)
{
acpi_status status;
/* Init globals */
......@@ -309,7 +312,7 @@ acpi_db_initialize (void)
acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
if (!acpi_gbl_db_buffer) {
return 0;
return (AE_NO_MEMORY);
}
ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
......@@ -327,12 +330,24 @@ acpi_db_initialize (void)
if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) {
/* These were created with one unit, grab it */
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not get debugger mutex\n");
return (status);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not get debugger mutex\n");
return (status);
}
/* Create the debug execution thread to execute commands */
acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
status = acpi_os_queue_for_execution (0, acpi_db_execute_thread, NULL);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not start debugger thread\n");
return (status);
}
}
if (!acpi_gbl_db_opt_verbose) {
......@@ -341,7 +356,7 @@ acpi_db_initialize (void)
acpi_gbl_db_opt_stats = FALSE;
}
return (0);
return (AE_OK);
}
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 81 $
* $Revision: 86 $
*
*****************************************************************************/
......@@ -30,8 +30,6 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
......@@ -78,7 +76,7 @@ acpi_ds_parse_method (
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** Named_obj=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle));
((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle));
/* Extract the method object from the method Node */
......@@ -112,7 +110,7 @@ acpi_ds_parse_method (
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name (op, node->name.integer);
op->node = node;
op->common.node = node;
/*
* Get a new Owner_id for objects created by this method. Namespace
......@@ -124,8 +122,7 @@ acpi_ds_parse_method (
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (owner_id,
NULL, NULL, NULL);
walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -152,8 +149,9 @@ acpi_ds_parse_method (
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
((acpi_namespace_node *) obj_handle)->name.ascii, obj_handle, op));
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
......@@ -348,8 +346,8 @@ acpi_ds_call_control_method (
this_walk_state->num_operands = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n",
next_walk_state));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Starting nested execution, newstate=%p\n", next_walk_state));
return_ACPI_STATUS (AE_OK);
......@@ -357,7 +355,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */
cleanup:
acpi_ds_terminate_control_method (next_walk_state);
(void) acpi_ds_terminate_control_method (next_walk_state);
acpi_ds_delete_walk_state (next_walk_state);
return_ACPI_STATUS (status);
......@@ -444,6 +442,10 @@ acpi_ds_terminate_control_method (
ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
if (!walk_state) {
return (AE_BAD_PARAMETER);
}
/* The current method object was saved in the walk state */
obj_desc = walk_state->method_desc;
......@@ -468,8 +470,14 @@ acpi_ds_terminate_control_method (
/* Signal completion of the execution of this method if necessary */
if (walk_state->method_desc->method.semaphore) {
acpi_os_signal_semaphore (
walk_state->method_desc->method.semaphore, 1);
status = acpi_os_signal_semaphore (
walk_state->method_desc->method.semaphore, 1);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
status = AE_OK;
/* Ignore error and continue cleanup */
}
}
/* Decrement the thread count on the method parse tree */
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 59 $
* $Revision: 61 $
*
******************************************************************************/
......@@ -25,9 +25,7 @@
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
......@@ -57,7 +55,7 @@
*
******************************************************************************/
acpi_status
void
acpi_ds_method_data_init (
acpi_walk_state *walk_state)
{
......@@ -90,7 +88,7 @@ acpi_ds_method_data_init (
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
return_VOID;
}
......@@ -100,14 +98,14 @@ acpi_ds_method_data_init (
*
* PARAMETERS: Walk_state - Current walk state object
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Delete method locals and arguments. Arguments are only
* deleted if this method was called from another method.
*
******************************************************************************/
acpi_status
void
acpi_ds_method_data_delete_all (
acpi_walk_state *walk_state)
{
......@@ -127,7 +125,7 @@ acpi_ds_method_data_delete_all (
/* Detach object (if present) and remove a reference */
acpi_ns_detach_object (&walk_state->local_variables[index]);
}
}
}
/* Detach the arguments */
......@@ -143,7 +141,7 @@ acpi_ds_method_data_delete_all (
}
}
return_ACPI_STATUS (AE_OK);
return_VOID;
}
......@@ -435,6 +433,9 @@ acpi_ds_method_data_get_value (
index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
......@@ -457,14 +458,14 @@ acpi_ds_method_data_get_value (
* Index - Which local_var or argument to delete
* Walk_state - Current walk state object
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
* a null into the stack slot after the object is deleted.
*
******************************************************************************/
acpi_status
void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
......@@ -482,7 +483,7 @@ acpi_ds_method_data_delete_value (
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
return_VOID;
}
/* Get the associated object */
......@@ -497,7 +498,7 @@ acpi_ds_method_data_delete_value (
node->object = NULL;
if ((object) &&
(ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_INTERNAL)) {
(ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
/*
* There is a valid object.
* Decrement the reference count by one to balance the
......@@ -506,7 +507,7 @@ acpi_ds_method_data_delete_value (
acpi_ut_remove_reference (object);
}
return_ACPI_STATUS (AE_OK);
return_VOID;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 28 $)
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 31 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -28,6 +28,8 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <asm/io.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -151,12 +153,12 @@ acpi_ec_read (
outb(ACPI_EC_COMMAND_READ, ec->command_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (0 != result)
if (result)
goto end;
outb(address, ec->data_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (0 != result)
if (result)
goto end;
*data = inb(ec->data_port);
......@@ -200,17 +202,17 @@ acpi_ec_write (
outb(ACPI_EC_COMMAND_WRITE, ec->command_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (0 != result)
if (result)
goto end;
outb(address, ec->data_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (0 != result)
if (result)
goto end;
outb(data, ec->data_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (0 != result)
if (result)
goto end;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
......@@ -259,7 +261,7 @@ acpi_ec_query (
outb(ACPI_EC_COMMAND_QUERY, ec->command_port);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (0 != result)
if (result)
goto end;
*data = inb(ec->data_port);
......@@ -342,7 +344,7 @@ acpi_ec_gpe_handler (
if (!(value & ACPI_EC_FLAG_SCI))
return;
if (0 != acpi_ec_query(ec, &value))
if (acpi_ec_query(ec, &value))
return;
query_data = kmalloc(sizeof(struct acpi_ec_query_data), GFP_ATOMIC);
......@@ -433,9 +435,6 @@ acpi_ec_space_handler (
FS Interface (/proc)
-------------------------------------------------------------------------- */
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
struct proc_dir_entry *acpi_ec_dir = NULL;
......@@ -566,7 +565,7 @@ acpi_ec_add (
}
result = acpi_ec_add_fs(device);
if (0 != result)
if (result)
goto end;
printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
......@@ -574,7 +573,7 @@ acpi_ec_add (
(u32) ec->gpe_bit);
end:
if (0 != result)
if (result)
kfree(ec);
return_VALUE(result);
......@@ -712,7 +711,7 @@ acpi_ec_init (void)
ACPI_FUNCTION_TRACE("acpi_ec_init");
result = acpi_bus_register_driver(&acpi_ec_driver);
if (0 > result) {
if (result < 0) {
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
......@@ -729,7 +728,7 @@ acpi_ec_exit (void)
ACPI_FUNCTION_TRACE("acpi_ec_exit");
result = acpi_bus_unregister_driver(&acpi_ec_driver);
if (0 == result)
if (!result)
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
return_VOID;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment