Commit da55fd6f authored by Linus Torvalds's avatar Linus Torvalds

Manual merge

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