Commit 5062d6c9 authored by Linus Torvalds's avatar Linus Torvalds

Automerge

parents 95519b26 86aeb1b8
......@@ -65,7 +65,7 @@ rename: no yes (all) (see below)
readlink: no no
follow_link: no no
truncate: no yes (see below)
setattr: yes if ATTR_SIZE
setattr: no yes
permission: yes no
getattr: (see below)
revalidate: no (see below)
......
......@@ -116,3 +116,10 @@ FS_LITTER is gone - just remove it from fs_flags.
FS_SINGLE is gone (actually, that had happened back when ->get_sb()
went in - and hadn't been documented ;-/). Just remove it from fs_flags
(and see ->get_sb() entry for other actions).
---
[mandatory]
->setattr() is called without BKL now. Caller _always_ holds ->i_sem, so
watch for ->i_sem-grabbing code that might be used by your ->setattr().
Callers of notify_change() need ->i_sem now.
......@@ -48,6 +48,10 @@
#define PREFIX "ACPI: "
extern struct acpi_boot_flags acpi_boot;
int acpi_mp_config = 0;
/* --------------------------------------------------------------------------
Boot-time Configuration
......@@ -104,13 +108,15 @@ static int total_cpus __initdata = 0;
/* From mpparse.c */
extern void __init MP_processor_info(struct mpc_config_processor *);
extern void __init MP_ioapic_info (struct mpc_config_ioapic *);
extern void __init MP_lintsrc_info(struct mpc_config_lintsrc *);
int __init
acpi_parse_lapic (
acpi_table_entry_header *header)
{
struct acpi_table_lapic *cpu = NULL;
struct mpc_config_processor proc_entry;
struct mpc_config_processor processor;
cpu = (struct acpi_table_lapic*) header;
if (!cpu)
......@@ -134,21 +140,21 @@ acpi_parse_lapic (
* the processor ID. Processor features aren't present in
* the table.
*/
proc_entry.mpc_type = MP_PROCESSOR;
proc_entry.mpc_apicid = cpu->id;
proc_entry.mpc_cpuflag = CPU_ENABLED;
processor.mpc_type = MP_PROCESSOR;
processor.mpc_apicid = cpu->id;
processor.mpc_cpuflag = CPU_ENABLED;
if (cpu->id == boot_cpu_physical_apicid) {
/* TBD: Circular reference trying to establish BSP */
proc_entry.mpc_cpuflag |= CPU_BOOTPROCESSOR;
processor.mpc_cpuflag |= CPU_BOOTPROCESSOR;
}
proc_entry.mpc_cpufeature = (boot_cpu_data.x86 << 8)
processor.mpc_cpufeature = (boot_cpu_data.x86 << 8)
| (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
proc_entry.mpc_featureflag = boot_cpu_data.x86_capability[0];
proc_entry.mpc_reserved[0] = 0;
proc_entry.mpc_reserved[1] = 0;
proc_entry.mpc_apicver = 0x10; /* integrated APIC */
processor.mpc_featureflag = boot_cpu_data.x86_capability[0];
processor.mpc_reserved[0] = 0;
processor.mpc_reserved[1] = 0;
processor.mpc_apicver = 0x10; /* Integrated APIC */
MP_processor_info(&proc_entry);
MP_processor_info(&processor);
total_cpus++;
......@@ -184,7 +190,7 @@ acpi_parse_lapic_nmi (
acpi_table_print_madt_entry(header);
/* TBD: Support local APIC NMI entries */
/* TBD: Support lapic_nmi entries */
return 0;
}
......@@ -199,18 +205,102 @@ acpi_parse_ioapic (
acpi_table_entry_header *header)
{
struct acpi_table_ioapic *ioapic = NULL;
/*
struct mpc_config_ioapic mp_ioapic;
struct IO_APIC_reg_01 reg_01;
*/
ioapic = (struct acpi_table_ioapic*) header;
if (!ioapic)
return -EINVAL;
acpi_table_print_madt_entry(header);
/*
* Cobble up an entry for the IOAPIC (just as we do for LAPIC entries).
* Note that we aren't doing anything with ioapic->vector, and
* mpc_apicver gets read directly from ioapic.
*/
/*
* TBD: Complete I/O APIC support.
*
mp_ioapic.mpc_type = MP_IOAPIC;
mp_ioapic.mpc_apicid = ioapic->id;
mp_ioapic.mpc_flags = MPC_APIC_USABLE;
mp_ioapic.mpc_apicaddr = ioapic->address;
set_fixmap_nocache(nr_ioapics + FIX_IO_APIC_BASE_0,
mp_ioapic.mpc_apicaddr);
printk("mapped IOAPIC to %08lx (%08lx)\n",
__fix_to_virt(nr_ioapics), mp_ioapic.mpc_apicaddr);
*(int *)&reg_01 = io_apic_read(nr_ioapics, 1);
mp_ioapic.mpc_apicver = reg_01.version;
MP_ioapic_info(&mp_ioapic);
*/
return 0;
}
int __init
acpi_parse_int_src_ovr (
acpi_table_entry_header *header)
{
struct acpi_table_int_src_ovr *int_src_ovr = NULL;
/*
struct mpc_config_intsrc my_intsrc;
int i = 0;
*/
int_src_ovr = (struct acpi_table_int_src_ovr*) header;
if (!int_src_ovr)
return -EINVAL;
acpi_table_print_madt_entry(header);
/* TBD: Support ioapic entries */
/*
* TBD: Complete I/O APIC support.
*
my_intsrc.mpc_type = MP_INTSRC;
my_intsrc.mpc_irqtype = mp_INT;
my_intsrc.mpc_irqflag = *(unsigned short*)(&(int_src_ovr->flags));
my_intsrc.mpc_srcbus = int_src_ovr->bus;
my_intsrc.mpc_srcbusirq = int_src_ovr->bus_irq;
my_intsrc.mpc_dstapic = 0;
my_intsrc.mpc_dstirq = int_src_ovr->global_irq;
for (i = 0; i < mp_irq_entries; i++) {
if (mp_irqs[i].mpc_srcbusirq == my_intsrc.mpc_srcbusirq) {
mp_irqs[i] = my_intsrc;
break;
}
}
*/
return 0;
}
int __init
acpi_parse_nmi_src (
acpi_table_entry_header *header)
{
struct acpi_table_nmi_src *nmi_src = NULL;
nmi_src = (struct acpi_table_nmi_src*) header;
if (!nmi_src)
return -EINVAL;
acpi_table_print_madt_entry(header);
/* TBD: Support nimsrc entries */
return 0;
}
#endif /*CONFIG_X86_IO_APIC*/
......@@ -288,14 +378,115 @@ acpi_find_rsdp (
}
#endif /*CONFIG_ACPI_BOOT*/
int __init
acpi_boot_init (
char *cmdline)
{
int result = 0;
/* Initialize the ACPI boot-time table parser */
result = acpi_table_init(cmdline);
if (0 != result)
return result;
#ifdef CONFIG_X86_LOCAL_APIC
#ifdef CONFIG_X86_IO_APIC
/*
* MADT
* ----
* Parse the Multiple APIC Description Table (MADT), if exists.
* Note that this table provides platform SMP configuration
* information -- the successor to MPS tables.
*/
if (!acpi_boot.madt) {
printk(KERN_INFO PREFIX "MADT parsing disabled via command-line\n");
return 0;
}
result = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
if (0 == result) {
printk(KERN_WARNING PREFIX "MADT not present\n");
return 0;
}
else if (0 > result) {
printk(KERN_ERR PREFIX "Error parsing MADT\n");
return result;
}
else if (1 < result)
printk(KERN_WARNING PREFIX "Multiple MADT tables exist\n");
/* Local APIC */
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
if (0 > result) {
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
return result;
}
result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
if (1 > result) {
printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries!\n");
return -ENODEV;
}
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
if (0 > result) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
return result;
}
/* I/O APIC */
result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
if (1 > result) {
printk(KERN_ERR PREFIX "Error parsing MADT - no IOAPIC entries!\n");
return -ENODEV;
}
acpi_mp_config = 1;
/*
* TBD: Complete I/O APIC support.
*
construct_default_ACPI_table();
*/
result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
if (0 > result) {
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
return result;
}
result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
if (0 > result) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
return result;
}
/* Make boot-up look pretty */
printk("%d CPUs total\n", total_cpus);
#endif /*CONFIG_X86_IO_APIC*/
#endif /*CONFIG_X86_LOCAL_APIC*/
#ifdef CONFIG_SERIAL_ACPI
/*
* TBD: Need phased approach to table parsing (only do those absolutely
* required during boot-up). Recommend expanding concept of fix-
* feature devices (ACPI Bus driver) to include table-based devices
* such as serial ports, EC, SMBus, etc.
*/
/* acpi_table_parse(ACPI_SPCR, acpi_parse_spcr);*/
#endif /*CONFIG_SERIAL_ACPI*/
return 0;
}
#endif /*CONFIG_ACPI_BOOT*/
/* --------------------------------------------------------------------------
PCI Interrupt Routing Support
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PCI
int __init
acpi_get_interrupt_model (
int *type)
......@@ -304,15 +495,13 @@ acpi_get_interrupt_model (
return -EINVAL;
#ifdef CONFIG_X86_IO_APIC
if (io_apic_assign_pci_irqs)
*type = ACPI_PCI_ROUTING_IOAPIC;
else
*type = ACPI_INT_MODEL_IOAPIC;
#else
*type = ACPI_INT_MODEL_PIC;
#endif
*type = ACPI_PCI_ROUTING_PIC;
return 0;
}
#endif
/* --------------------------------------------------------------------------
......
......@@ -18,6 +18,8 @@ wakeup_code:
addw $(wakeup_data - wakeup_code) >> 4, %ax
movw %ax, %ds
movw %ax, %ss
mov $(wakeup_stack - wakeup_data), %sp # Private stack is needed for ASUS board
# set up page table
movl (real_save_cr3 - wakeup_data), %eax
......
......@@ -14,7 +14,6 @@
#include <linux/mm.h>
#include <linux/irq.h>
#include <linux/acpi.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/config.h>
......@@ -24,6 +23,7 @@
#include <linux/mc146818rtc.h>
#include <asm/smp.h>
#include <asm/acpi.h>
#include <asm/mtrr.h>
#include <asm/mpspec.h>
#include <asm/pgalloc.h>
......@@ -31,9 +31,6 @@
/* Have we found an MP table */
int smp_found_config;
/* Have we found an ACPI MADT table */
int acpi_found_madt = 0;
/*
* Various Linux-internal data structures created from the
* MP-table.
......@@ -41,8 +38,6 @@ int acpi_found_madt = 0;
int apic_version [MAX_APICS];
int mp_bus_id_to_type [MAX_MP_BUSSES];
int mp_bus_id_to_node [MAX_MP_BUSSES];
int mp_bus_id_to_local [MAX_MP_BUSSES];
int quad_local_to_mp_bus_id [NR_CPUS/4][4];
int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
int mp_current_pci_id;
......@@ -69,19 +64,6 @@ static unsigned int num_processors;
/* Bitmask of physically existing CPUs */
unsigned long phys_cpu_present_map;
/* ACPI MADT entry parsing functions */
#ifdef CONFIG_ACPI_BOOT
extern struct acpi_boot_flags acpi_boot;
#ifdef CONFIG_X86_LOCAL_APIC
extern int acpi_parse_lapic (acpi_table_entry_header *header);
extern int acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header);
extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header);
#endif /*CONFIG_X86_LOCAL_APIC*/
#ifdef CONFIG_X86_IO_APIC
extern int acpi_parse_ioapic (acpi_table_entry_header *header);
#endif /*CONFIG_X86_IO_APIC*/
#endif /*CONFIG_ACPI_BOOT*/
/*
* Intel MP BIOS table parsing routines:
*/
......@@ -139,7 +121,7 @@ static char __init *mpc_family(int family,int model)
return n;
}
/*
/*
* Have to match translation table entries to main table entries by counter
* hence the mpc_record variable .... can't see a less disgusting way of
* doing this ....
......@@ -255,17 +237,13 @@ void __init MP_processor_info (struct mpc_config_processor *m)
static void __init MP_bus_info (struct mpc_config_bus *m)
{
char str[7];
int quad;
memcpy(str, m->mpc_bustype, 6);
str[6] = 0;
if (clustered_apic_mode) {
quad = translation_table[mpc_record]->trans_quad;
mp_bus_id_to_node[m->mpc_busid] = quad;
mp_bus_id_to_local[m->mpc_busid] = translation_table[mpc_record]->trans_local;
quad_local_to_mp_bus_id[quad][translation_table[mpc_record]->trans_local] = m->mpc_busid;
printk("Bus #%d is %s (node %d)\n", m->mpc_busid, str, quad);
mp_bus_id_to_node[m->mpc_busid] = translation_table[mpc_record]->trans_quad;
printk("Bus #%d is %s (node %d)\n", m->mpc_busid, str, mp_bus_id_to_node[m->mpc_busid]);
} else {
Dprintk("Bus #%d is %s\n", m->mpc_busid, str);
}
......@@ -342,14 +320,13 @@ static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m)
static void __init MP_translation_info (struct mpc_config_translation *m)
{
printk("Translation: record %d, type %d, quad %d, global %d, local %d\n", mpc_record, m->trans_type, m->trans_quad, m->trans_global, m->trans_local);
printk("Translation: record %d, type %d, quad %d, global %d, local %d\n", mpc_record, m->trans_type,
m->trans_quad, m->trans_global, m->trans_local);
if (mpc_record >= MAX_MPC_ENTRY)
printk("MAX_MPC_ENTRY exceeded!\n");
else
translation_table[mpc_record] = m; /* stash this for later */
if (m->trans_quad+1 > numnodes)
numnodes = m->trans_quad+1;
}
/*
......@@ -439,11 +416,11 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
printk("APIC at: 0x%lX\n",mpc->mpc_lapic);
/*
* Save the local APIC address, it might be non-default,
* but only if we're not using the ACPI tables
/*
* Save the local APIC address (it might be non-default), but only
* if we're not using the ACPI tables.
*/
if (!acpi_found_madt)
if (!acpi_mp_config)
mp_lapic_addr = mpc->mpc_lapic;
if (clustered_apic_mode && mpc->mpc_oemptr) {
......@@ -464,7 +441,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
(struct mpc_config_processor *)mpt;
/* ACPI may already have provided this one for us */
if (!acpi_found_madt)
if (!acpi_mp_config)
MP_processor_info(m);
mpt += sizeof(*m);
count += sizeof(*m);
......@@ -515,6 +492,10 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
}
++mpc_record;
}
if (clustered_apic_mode && nr_ioapics > 2) {
/* don't initialise IO apics on secondary quads */
nr_ioapics = 2;
}
if (!num_processors)
printk(KERN_ERR "SMP mptable: no processors registered!\n");
return num_processors;
......@@ -686,20 +667,6 @@ void __init get_smp_config (void)
{
struct intel_mp_floating *mpf = mpf_found;
#ifdef CONFIG_ACPI_BOOT
/*
* Check if the MADT exists, and if so, use it to get processor
* information (ACPI_MADT_LAPIC). The MADT supports the concept
* of both logical (e.g. HT) and physical processor(s); where the
* MPS only supports physical.
*/
if (acpi_boot.madt) {
acpi_found_madt = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
if (acpi_found_madt > 0)
acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
}
#endif /*CONFIG_ACPI_BOOT*/
printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification);
if (mpf->mpf_feature2 & (1<<7)) {
printk(" IMCR and PIC compatibility mode.\n");
......
......@@ -540,6 +540,18 @@ static void __init pirq_find_router(void)
pirq_router_dev->slot_name);
}
static struct irq_info *pirq_get_info(struct pci_dev *dev)
{
struct irq_routing_table *rt = pirq_table;
int entries = (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info);
struct irq_info *info;
for (info = rt->slots; entries--; info++)
if (info->bus == dev->bus->number && PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn))
return info;
return NULL;
}
static void pcibios_test_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
{
}
......@@ -557,55 +569,77 @@ static int acpi_lookup_irq (
/* TBD: Select IRQ from possible to improve routing performance. */
result = acpi_prt_get_irq(dev, pin, &irq);
if ((0 != result) || !irq) {
printk(KERN_ERR "PCI: Unable to resolve IRQ for device %s\n",
dev->slot_name);
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;
}
printk(KERN_INFO "PCI: Found IRQ %d for device %s\n", irq,
dev->slot_name);
dev->irq = irq;
pirq_penalty[irq]++;
if (!assign) {
/* only check for the IRQ */
printk(KERN_INFO "PCI: Found IRQ %d for device %s\n", irq,
dev->slot_name);
return 1;
}
/* 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;
}
#endif /* CONFIG_ACPI_PCI */
static struct irq_info *pirq_get_info(struct pci_dev *dev)
static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
{
struct irq_routing_table *rt = pirq_table;
int entries = (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info);
u8 pin;
struct irq_info *info;
for (info = rt->slots; entries--; info++)
if (info->bus == dev->bus->number && PCI_SLOT(info->devfn) == PCI_SLOT(dev->devfn))
return info;
return NULL;
}
static int pirq_lookup_irq(struct pci_dev *dev, u8 pin, int assign)
{
int i, pirq, newirq;
int irq = 0;
u32 mask;
struct irq_router *r = pirq_router;
struct irq_info *info;
int newirq, pirq, i, irq = 0;
struct pci_dev *dev2;
char *msg = NULL;
u32 mask;
if (!pirq_table)
/* Find IRQ pin */
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (!pin) {
DBG(" -> no interrupt pin\n");
return 0;
}
pin = pin - 1;
#ifdef CONFIG_ACPI_PCI
/* Use ACPI to lookup IRQ */
if (pci_use_acpi_routing)
return acpi_lookup_irq(dev, pin, assign);
#endif
/* Find IRQ routing entry */
if (!pirq_table)
return 0;
DBG("IRQ for %s:%d", dev->slot_name, pin);
info = pirq_get_info(dev);
if (!info) {
DBG(" -> not found in routing table\n");
return 0;
}
pirq = info->irq[pin].link;
mask = info->irq[pin].bitmap;
if (!pirq) {
......@@ -629,10 +663,6 @@ static int pirq_lookup_irq(struct pci_dev *dev, u8 pin, int assign)
* reported by the device if possible.
*/
newirq = dev->irq;
if (!((1 << newirq) & mask)) {
if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0;
else printk(KERN_WARNING "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n", newirq, dev->slot_name);
}
if (!newirq && assign) {
for (i = 0; i < 16; i++) {
if (!(mask & (1 << i)))
......@@ -651,8 +681,7 @@ static int pirq_lookup_irq(struct pci_dev *dev, u8 pin, int assign)
irq = pirq & 0xf;
DBG(" -> hardcoded IRQ %d\n", irq);
msg = "Hardcoded";
} else if ( r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) {
} else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq))) {
DBG(" -> got IRQ %d\n", irq);
msg = "Found";
} else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
......@@ -686,9 +715,7 @@ static int pirq_lookup_irq(struct pci_dev *dev, u8 pin, int assign)
continue;
if (info->irq[pin].link == pirq) {
/* We refuse to override the dev->irq information. Give a warning! */
if ( dev2->irq && dev2->irq != irq && \
(!(pci_probe & PCI_USE_PIRQ_MASK) || \
((1 << dev2->irq) & mask)) ) {
if (dev2->irq && dev2->irq != irq) {
printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n",
dev2->slot_name, dev2->irq, irq);
continue;
......@@ -702,38 +729,20 @@ static int pirq_lookup_irq(struct pci_dev *dev, u8 pin, int assign)
return 1;
}
static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
{
u8 pin;
/* Find IRQ routing entry */
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (!pin) {
DBG("PCI: %s: no interrupt pin\n", dev->slot_name);
return 0;
}
pin -= 1;
#ifdef CONFIG_ACPI_PCI
if (pci_use_acpi_routing)
return acpi_lookup_irq(dev, pin, assign);
else
#endif
return pirq_lookup_irq(dev, pin, assign);
}
void __init pcibios_irq_init(void)
{
DBG("PCI: IRQ init\n");
#ifdef CONFIG_ACPI_PCI
if (acpi_prts.count && !(pci_probe & PCI_NO_ACPI_ROUTING)) {
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
pci_use_acpi_routing = 1;
return;
if (!(pci_probe & PCI_NO_ACPI_ROUTING)) {
if (acpi_prts.count) {
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
pci_use_acpi_routing = 1;
return;
}
else
printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n");
}
if (!acpi_prts.count)
printk(KERN_INFO "PCI: Invalid acpi_prts [%d]\n", acpi_prts.count);
#endif
pirq_table = pirq_find_routing_table();
......
......@@ -1033,6 +1033,16 @@ CONFIG_XMON
Include in-kernel hooks for the xmon kernel monitor/debugger
supported by the PPC port.
Include BDI2000 debugger support
CONFIG_BDI_SWITCH
Include in-kernel support for the Abatron BDI2000 debugger.
Add additional CFLAGS to the kernel build
CONFIG_MORE_COMPILE_OPTIONS
If you want to add additional CFLAGS to the kernel build, such as
-g for KGDB, XMON or the BDI2000, enable this option and then
enter what you would like to add in the next question.
CONFIG_ADVANCED_OPTIONS
This option will enable prompting for a variety of advanced kernel
configuration options. These options can cause the kernel to not
......
This diff is collapsed.
......@@ -52,49 +52,45 @@ void power_save(void);
unsigned long zero_paged_on;
unsigned long powersave_nap;
int idled(void)
void default_idle(void)
{
int do_power_save = 0;
if (cur_cpu_spec[smp_processor_id()]->cpu_features & CPU_FTR_CAN_DOZE)
do_power_save = 1;
/* endless loop with no priority at all */
for (;;) {
#ifdef CONFIG_PPC_ISERIES
if (!current->need_resched) {
/* Turn off the run light */
run_light_on(0);
yield_shared_processor();
}
HMT_low();
if (!current->need_resched) {
/* Turn off the run light */
run_light_on(0);
yield_shared_processor();
}
HMT_low();
#endif
#ifdef CONFIG_SMP
if (!do_power_save) {
if (!need_resched()) {
set_thread_flag(TIF_POLLING_NRFLAG);
while (!test_thread_flag(TIF_NEED_RESCHED))
barrier();
clear_thread_flag(TIF_POLLING_NRFLAG);
}
if (!do_power_save) {
if (!need_resched()) {
set_thread_flag(TIF_POLLING_NRFLAG);
while (!test_thread_flag(TIF_NEED_RESCHED))
barrier();
clear_thread_flag(TIF_POLLING_NRFLAG);
}
}
#endif
if (do_power_save && !need_resched())
power_save();
if (do_power_save && !need_resched())
power_save();
if (need_resched()) {
run_light_on(1);
schedule();
}
if (need_resched()) {
run_light_on(1);
schedule();
}
#ifdef CONFIG_PPC_ISERIES
else {
run_light_on(0);
yield_shared_processor();
HMT_low();
}
#endif /* CONFIG_PPC_ISERIES */
else {
run_light_on(0);
yield_shared_processor();
HMT_low();
}
return 0;
#endif /* CONFIG_PPC_ISERIES */
}
/*
......@@ -103,7 +99,8 @@ int idled(void)
*/
int cpu_idle(void)
{
idled();
for (;;)
default_idle();
return 0;
}
......
......@@ -79,6 +79,10 @@ extern unsigned char __res[];
extern unsigned long ret_to_user_hook;
extern unsigned long mm_ptov (unsigned long paddr);
extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle);
extern void consistent_free(void *vaddr);
extern void consistent_sync(void *vaddr, size_t size, int direction);
EXPORT_SYMBOL(clear_page);
EXPORT_SYMBOL(do_signal);
EXPORT_SYMBOL(do_syscall_trace);
......
......@@ -20,6 +20,7 @@
#include <linux/sched.h>
#include <asm/atomic.h>
#include <asm/semaphore.h>
#include <asm/errno.h>
/*
* Atomically update sem->count.
......
......@@ -594,8 +594,8 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
info.si_signo = signr;
info.si_errno = 0;
info.si_code = SI_USER;
info.si_pid = current->p_pptr->pid;
info.si_uid = current->p_pptr->uid;
info.si_pid = current->parent->pid;
info.si_uid = current->parent->uid;
}
/* If the (new) signal is now blocked, requeue it. */
......@@ -634,7 +634,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
case SIGSTOP:
current->state = TASK_STOPPED;
current->exit_code = signr;
if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
if (!(current->parent->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
notify_parent(current, SIGCHLD);
schedule();
continue;
......
......@@ -22,6 +22,7 @@
* 2 of the License, or (at your option) any later version.
*
*/
#include <asm/tlbflush.h>
extern void mapin_ram(void);
extern void bat_mapin_ram(void);
......
......@@ -28,6 +28,7 @@
#include <linux/types.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
......@@ -56,6 +57,70 @@ void setbat(int index, unsigned long virt, unsigned long phys,
#define p_mapped_by_bats(x) (0UL)
#endif /* HAVE_BATS */
pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *ret;
if ((ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL)
clear_page(ret);
return ret;
}
void pgd_free(pgd_t *pgd)
{
free_page((unsigned long)pgd);
}
pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
{
pte_t *pte;
extern int mem_init_done;
extern void *early_get_page(void);
int timeout = 0;
if (mem_init_done) {
while ((pte = (pte_t *) __get_free_page(GFP_KERNEL)) == NULL
&& ++timeout < 10) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ);
}
} else
pte = (pte_t *) early_get_page();
if (pte != NULL)
clear_page(pte);
return pte;
}
struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *pte;
int timeout = 0;
#ifdef CONFIG_HIGHPTE
int flags = GFP_KERNEL | __GFP_HIGHMEM;
#else
int flags = GFP_KERNEL;
#endif
while ((pte = alloc_pages(flags, 0)) == NULL) {
if (++timeout >= 10)
return NULL;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ);
}
clear_highpage(pte);
return pte;
}
void pte_free_kernel(pte_t *pte)
{
free_page((unsigned long)pte);
}
void pte_free(struct page *pte)
{
__free_page(pte);
}
#ifndef CONFIG_PPC_ISERIES
void *
ioremap(unsigned long addr, unsigned long size)
......
......@@ -9,7 +9,7 @@ export ACPI_CFLAGS
ACPI_CFLAGS := -D_LINUX -I$(CURDIR)/include
ifdef CONFIG_ACPI_DEBUG
ACPI_CFLAGS += -DACPI_DEBUG -Wno-unused
ACPI_CFLAGS += -DACPI_DEBUG
endif
EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
/*
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 22 $)
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 23 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -296,6 +296,7 @@ acpi_ac_remove (
struct acpi_ac *ac = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_remove");
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
......
/*
* acpi_battery.c - ACPI Battery Driver ($Revision: 31 $)
* acpi_battery.c - ACPI Battery Driver ($Revision: 32 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -112,8 +112,9 @@ acpi_battery_get_info (
struct acpi_battery *battery,
struct acpi_battery_info **bif)
{
int result = 0;
acpi_status status = 0;
acpi_buffer buffer = {0, NULL};
acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
ACPI_BATTERY_FORMAT_BIF};
acpi_buffer data = {0, NULL};
......@@ -126,9 +127,11 @@ acpi_battery_get_info (
/* Evalute _BIF */
status = acpi_evaluate(battery->handle, "_BIF", NULL, &buffer);
if (ACPI_FAILURE(status))
status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BIF\n"));
return_VALUE(-ENODEV);
}
package = (acpi_object *) buffer.pointer;
......@@ -136,29 +139,33 @@ acpi_battery_get_info (
status = acpi_extract_package(package, &format, &data);
if (status != AE_BUFFER_OVERFLOW) {
kfree(buffer.pointer);
return_VALUE(-ENODEV);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n"));
result = -ENODEV;
goto end;
}
data.pointer = kmalloc(data.length, GFP_KERNEL);
if (!data.pointer) {
kfree(buffer.pointer);
return_VALUE(-ENOMEM);
result = -ENOMEM;
goto end;
}
memset(data.pointer, 0, data.length);
status = acpi_extract_package(package, &format, &data);
if (ACPI_FAILURE(status)) {
kfree(buffer.pointer);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n"));
kfree(data.pointer);
return_VALUE(-ENODEV);
result = -ENODEV;
goto end;
}
end:
kfree(buffer.pointer);
(*bif) = data.pointer;
if (0 == result)
(*bif) = (struct acpi_battery_info *) data.pointer;
return_VALUE(0);
return_VALUE(result);
}
static int
......@@ -166,8 +173,9 @@ acpi_battery_get_status (
struct acpi_battery *battery,
struct acpi_battery_status **bst)
{
int result = 0;
acpi_status status = 0;
acpi_buffer buffer = {0, NULL};
acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST),
ACPI_BATTERY_FORMAT_BST};
acpi_buffer data = {0, NULL};
......@@ -180,9 +188,11 @@ acpi_battery_get_status (
/* Evalute _BST */
status = acpi_evaluate(battery->handle, "_BST", NULL, &buffer);
if (ACPI_FAILURE(status))
status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n"));
return_VALUE(-ENODEV);
}
package = (acpi_object *) buffer.pointer;
......@@ -190,29 +200,33 @@ acpi_battery_get_status (
status = acpi_extract_package(package, &format, &data);
if (status != AE_BUFFER_OVERFLOW) {
kfree(buffer.pointer);
return_VALUE(-ENODEV);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n"));
result = -ENODEV;
goto end;
}
data.pointer = kmalloc(data.length, GFP_KERNEL);
if (!data.pointer) {
kfree(buffer.pointer);
return_VALUE(-ENOMEM);
result = -ENOMEM;
goto end;
}
memset(data.pointer, 0, data.length);
status = acpi_extract_package(package, &format, &data);
if (ACPI_FAILURE(status)) {
kfree(buffer.pointer);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n"));
kfree(data.pointer);
return_VALUE(-ENODEV);
result = -ENODEV;
goto end;
}
end:
kfree(buffer.pointer);
(*bst) = data.pointer;
if (0 == result)
(*bst) = (struct acpi_battery_status *) data.pointer;
return_VALUE(0);
return_VALUE(result);
}
......@@ -328,7 +342,7 @@ acpi_battery_read_info (
{
int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) data;
struct acpi_battery_info *bif = 0;
struct acpi_battery_info *bif = NULL;
char *units = "?";
char *p = page;
int len = 0;
......@@ -403,8 +417,7 @@ acpi_battery_read_info (
bif->oem_info);
end:
if (bif)
kfree(bif);
kfree(bif);
len = (p - page);
if (len <= off+count) *eof = 1;
......@@ -490,8 +503,7 @@ acpi_battery_read_state (
(u32) bst->present_voltage);
end:
if (bst)
kfree(bst);
kfree(bst);
len = (p - page);
if (len <= off+count) *eof = 1;
......
This diff is collapsed.
/*
* acpi_bus.h - ACPI Bus Driver ($Revision: 17 $)
* acpi_bus.h - ACPI Bus Driver ($Revision: 19 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -96,8 +96,9 @@ typedef int (*acpi_op_stop) (struct acpi_device *device, int type);
typedef int (*acpi_op_suspend) (struct acpi_device *device, int state);
typedef int (*acpi_op_resume) (struct acpi_device *device, int state);
typedef int (*acpi_op_scan) (struct acpi_device *device);
typedef int (*acpi_op_bind) (struct acpi_device *device);
struct acpi_driver_ops {
struct acpi_device_ops {
acpi_op_add add;
acpi_op_remove remove;
acpi_op_lock lock;
......@@ -106,6 +107,7 @@ struct acpi_driver_ops {
acpi_op_suspend suspend;
acpi_op_resume resume;
acpi_op_scan scan;
acpi_op_bind bind;
};
struct acpi_driver {
......@@ -114,7 +116,7 @@ struct acpi_driver {
char class[80];
int references;
char *ids; /* Supported Hardware IDs */
struct acpi_driver_ops ops;
struct acpi_device_ops ops;
};
enum acpi_blacklist_predicates
......@@ -157,14 +159,18 @@ struct acpi_device_status {
/* Flags */
struct acpi_device_flags {
u8 dynamic_status:1;
u8 compatible_ids:1;
u8 removable:1;
u8 ejectable:1;
u8 lockable:1;
u8 suprise_removal_ok:1;
u8 power_manageable:1;
u8 performance_manageable:1;
u32 dynamic_status:1;
u32 hardware_id:1;
u32 compatible_ids:1;
u32 bus_address:1;
u32 unique_id:1;
u32 removable:1;
u32 ejectable:1;
u32 lockable:1;
u32 suprise_removal_ok:1;
u32 power_manageable:1;
u32 performance_manageable:1;
u32 reserved:21;
};
......@@ -206,13 +212,13 @@ struct acpi_device_pnp {
/* Power Management */
struct acpi_device_power_flags {
u8 explicit_get:1; /* _PSC present? */
u8 power_resources:1; /* Power resources */
u8 inrush_current:1; /* Serialize Dx->D0 */
u8 wake_capable:1; /* Wakeup supported? */
u8 wake_enabled:1; /* Enabled for wakeup */
u8 power_removed:1; /* Optimize Dx->D0 */
u8 reserved:2;
u32 explicit_get:1; /* _PSC present? */
u32 power_resources:1; /* Power resources */
u32 inrush_current:1; /* Serialize Dx->D0 */
u32 wake_capable:1; /* Wakeup supported? */
u32 wake_enabled:1; /* Enabled for wakeup */
u32 power_removed:1; /* Optimize Dx->D0 */
u32 reserved:26;
};
struct acpi_device_power_state {
......@@ -270,6 +276,7 @@ struct acpi_device {
struct acpi_device_power power;
struct acpi_device_perf performance;
struct acpi_device_dir dir;
struct acpi_device_ops ops;
struct acpi_driver *driver;
void *driver_data;
#ifdef CONFIG_LDM
......
/*
* acpi_button.c - ACPI Button Driver ($Revision: 22 $)
* acpi_button.c - ACPI Button Driver ($Revision: 24 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -69,7 +69,7 @@ struct acpi_button {
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
struct proc_dir_entry *acpi_button_dir = NULL;
static struct proc_dir_entry *acpi_button_dir = NULL;
static int
......@@ -81,7 +81,6 @@ acpi_button_read_info (
int *eof,
void *data)
{
int result = 0;
struct acpi_button *button = (struct acpi_button *) data;
char *p = page;
int len = 0;
......@@ -111,22 +110,42 @@ acpi_button_add_fs (
struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
button = acpi_driver_data(device);
if (!acpi_button_dir) {
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
if (!acpi_device_dir(device))
return_VALUE(-ENODEV);
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_LID:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
break;
}
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device))
return_VALUE(-ENODEV);
/* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device));
......@@ -227,37 +246,46 @@ acpi_button_add (
button->device = device;
button->handle = device->handle;
sprintf(acpi_device_class(device), "%s", ACPI_BUTTON_CLASS);
acpi_driver_data(device) = button;
/*
* Determine the button type (via hid), as fixed-feature buttons
* need to be handled a bit differently than generic-space.
*/
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
button->type = ACPI_BUTTON_TYPE_POWERF;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_POWERF);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
button->type = ACPI_BUTTON_TYPE_SLEEPF;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
button->type = ACPI_BUTTON_TYPE_POWER;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_POWER);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
button->type = ACPI_BUTTON_TYPE_POWERF;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_POWERF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
button->type = ACPI_BUTTON_TYPE_SLEEP;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_SLEEP);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
button->type = ACPI_BUTTON_TYPE_SLEEPF;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
button->type = ACPI_BUTTON_TYPE_LID;
sprintf(acpi_device_name(device), "%s",
ACPI_BUTTON_DEVICE_NAME_LID);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
}
else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
......
/*
* acpi_drivers.h ($Revision: 17 $)
* acpi_drivers.h ($Revision: 23 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -30,7 +30,7 @@
#include "acpi_bus.h"
#define ACPI_DRIVER_VERSION 0x20020308
#define ACPI_DRIVER_VERSION 0x20020404
#define ACPI_MAX_STRING 80
......@@ -84,26 +84,32 @@
-------------------------------------------------------------------------- */
#define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_HID_LID "PNP0C0D"
#define ACPI_BUTTON_HID_POWER "PNP0C0C"
#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
#define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button"
#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button"
#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button"
#define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button"
#define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
#define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_FILE_INFO "info"
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
#define ACPI_BUTTON_SUBCLASS_POWER "power"
#define ACPI_BUTTON_HID_POWER "PNP0C0C"
#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
#define ACPI_BUTTON_TYPE_POWER 0x01
#define ACPI_BUTTON_TYPE_POWERF 0x02
#define ACPI_BUTTON_SUBCLASS_SLEEP "sleep"
#define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB"
#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)"
#define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)"
#define ACPI_BUTTON_TYPE_SLEEP 0x03
#define ACPI_BUTTON_TYPE_SLEEPF 0x04
#define ACPI_BUTTON_SUBCLASS_LID "lid"
#define ACPI_BUTTON_HID_LID "PNP0C0D"
#define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
#define ACPI_BUTTON_TYPE_LID 0x05
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
/* --------------------------------------------------------------------------
......@@ -217,7 +223,7 @@ void acpi_power_exit (void);
#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
int acpi_processor_set_limit(acpi_handle handle, int flags, int *state);
int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
/* --------------------------------------------------------------------------
......
/*
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 27 $)
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 28 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -345,7 +345,7 @@ acpi_ec_gpe_handler (
if (0 != acpi_ec_query(ec, &value))
return;
query_data = kmalloc(sizeof(struct acpi_ec_query_data), GFP_KERNEL);
query_data = kmalloc(sizeof(struct acpi_ec_query_data), GFP_ATOMIC);
if (!query_data)
return;
query_data->handle = ec->handle;
......
/*
* acpi_osl.c - OS-dependent functions ($Revision: 65 $)
* acpi_osl.c - OS-dependent functions ($Revision: 69 $)
*
* Copyright (C) 2000 Andrew Henroid
* Copyright (C) 2001 Andrew Grover
......@@ -125,13 +125,13 @@ acpi_os_vprintf(const NATIVE_CHAR *fmt, va_list args)
}
void *
acpi_os_allocate(u32 size)
acpi_os_allocate(ACPI_SIZE size)
{
return kmalloc(size, GFP_KERNEL);
}
void *
acpi_os_callocate(u32 size)
acpi_os_callocate(ACPI_SIZE size)
{
void *ptr = acpi_os_allocate(size);
if (ptr)
......@@ -148,21 +148,22 @@ acpi_os_free(void *ptr)
acpi_status
acpi_os_get_root_pointer(u32 flags, ACPI_PHYSICAL_ADDRESS *phys_addr)
acpi_os_get_root_pointer(u32 flags, ACPI_POINTER *addr)
{
#ifndef CONFIG_ACPI_EFI
if (ACPI_FAILURE(acpi_find_root_pointer(flags, phys_addr))) {
if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) {
printk(KERN_ERR PREFIX "System description tables not found\n");
return AE_NOT_FOUND;
}
#else /*CONFIG_ACPI_EFI*/
addr->pointer_type = ACPI_PHYSICAL_POINTER;
if (efi.acpi20)
*phys_addr = (ACPI_PHYSICAL_ADDRESS) efi.acpi20;
addr->pointer.physical = (ACPI_PHYSICAL_ADDRESS) efi.acpi20;
else if (efi.acpi)
*phys_addr = (ACPI_PHYSICAL_ADDRESS) efi.acpi;
addr->pointer.physical = (ACPI_PHYSICAL_ADDRESS) efi.acpi;
else {
printk(KERN_ERR PREFIX "System description tables not found\n");
*phys_addr = 0;
addr->pointer.physical = 0;
return AE_NOT_FOUND;
}
#endif /*CONFIG_ACPI_EFI*/
......@@ -171,7 +172,7 @@ acpi_os_get_root_pointer(u32 flags, ACPI_PHYSICAL_ADDRESS *phys_addr)
}
acpi_status
acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, u32 size, void **virt)
acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, ACPI_SIZE size, void **virt)
{
if (phys > ULONG_MAX) {
printk(KERN_ERR PREFIX "Cannot map memory that high\n");
......@@ -189,7 +190,7 @@ acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, u32 size, void **virt)
}
void
acpi_os_unmap_memory(void *virt, u32 size)
acpi_os_unmap_memory(void *virt, ACPI_SIZE size)
{
iounmap(virt);
}
......@@ -441,14 +442,14 @@ acpi_os_load_module (
ACPI_FUNCTION_TRACE ("os_load_module");
if (!module_name)
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
if (0 > request_module(module_name)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to load module [%s].\n", module_name));
return AE_ERROR;
return_ACPI_STATUS (AE_ERROR);
}
return AE_OK;
return_ACPI_STATUS (AE_OK);
}
acpi_status
......@@ -481,7 +482,7 @@ acpi_os_queue_exec (
strcpy(current->comm, "kacpidpc");
if (!dpc || !dpc->function)
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Executing function [%p(%p)].\n", dpc->function, dpc->context));
......@@ -489,7 +490,7 @@ acpi_os_queue_exec (
kfree(dpc);
return 1;
return_ACPI_STATUS (AE_OK);
}
static void
......@@ -504,7 +505,7 @@ acpi_os_schedule_exec (
dpc = (ACPI_OS_DPC*)context;
if (!dpc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
return;
return_VOID;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context));
......@@ -515,6 +516,7 @@ acpi_os_schedule_exec (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to kernel_thread() failed.\n"));
acpi_os_free(dpc);
}
return_VOID;
}
acpi_status
......@@ -531,7 +533,7 @@ acpi_os_queue_for_execution(
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling function [%p(%p)] for deferred execution.\n", function, context));
if (!function)
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
/*
* Queue via DPC:
......@@ -554,7 +556,7 @@ acpi_os_queue_for_execution(
*/
dpc = kmalloc(sizeof(ACPI_OS_DPC), GFP_ATOMIC);
if (!dpc)
return AE_NO_MEMORY;
return_ACPI_STATUS (AE_NO_MEMORY);
dpc->function = function;
dpc->context = context;
......@@ -578,7 +580,7 @@ acpi_os_queue_for_execution(
*/
dpc = kmalloc(sizeof(ACPI_OS_DPC), GFP_KERNEL);
if (!dpc)
return AE_NO_MEMORY;
return_ACPI_STATUS (AE_NO_MEMORY);
dpc->function = function;
dpc->context = context;
......@@ -587,7 +589,7 @@ acpi_os_queue_for_execution(
break;
}
return status;
return_ACPI_STATUS (status);
}
......@@ -603,7 +605,7 @@ acpi_os_create_semaphore(
sem = acpi_os_callocate(sizeof(struct semaphore));
if (!sem)
return AE_NO_MEMORY;
return_ACPI_STATUS (AE_NO_MEMORY);
sema_init(sem, initial_units);
......@@ -611,7 +613,7 @@ acpi_os_create_semaphore(
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating semaphore[%p|%d].\n", *handle, initial_units));
return AE_OK;
return_ACPI_STATUS (AE_OK);
}
......@@ -631,13 +633,13 @@ acpi_os_delete_semaphore(
ACPI_FUNCTION_TRACE ("os_delete_semaphore");
if (!sem)
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting semaphore[%p].\n", handle));
acpi_os_free(sem); sem = NULL;
return AE_OK;
return_ACPI_STATUS (AE_OK);
}
......@@ -663,10 +665,10 @@ acpi_os_wait_semaphore(
ACPI_FUNCTION_TRACE ("os_wait_semaphore");
if (!sem || (units < 1))
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
if (units > 1)
return AE_SUPPORT;
return_ACPI_STATUS (AE_SUPPORT);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
......@@ -724,7 +726,7 @@ acpi_os_wait_semaphore(
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
}
return status;
return_ACPI_STATUS (status);
}
......@@ -741,16 +743,16 @@ acpi_os_signal_semaphore(
ACPI_FUNCTION_TRACE ("os_signal_semaphore");
if (!sem || (units < 1))
return AE_BAD_PARAMETER;
return_ACPI_STATUS (AE_BAD_PARAMETER);
if (units > 1)
return AE_SUPPORT;
return_ACPI_STATUS (AE_SUPPORT);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Signaling semaphore[%p|%d]\n", handle, units));
up(sem);
return AE_OK;
return_ACPI_STATUS (AE_OK);
}
u32
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* acpi_system.c - ACPI System Driver ($Revision: 40 $)
* acpi_system.c - ACPI System Driver ($Revision: 45 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -31,6 +31,7 @@
#include <linux/spinlock.h>
#include <linux/poll.h>
#include <linux/delay.h>
#include <linux/sysrq.h>
#include <linux/pm.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
......@@ -86,9 +87,8 @@ static void
acpi_power_off (void)
{
acpi_enter_sleep_state_prep(ACPI_STATE_S5);
acpi_disable_irqs();
ACPI_DISABLE_IRQS();
acpi_enter_sleep_state(ACPI_STATE_S5);
acpi_disable_irqs();
}
#endif /*CONFIG_PM*/
......@@ -123,7 +123,7 @@ acpi_system_restore_state (
device_resume(RESUME_POWER_ON);
/* enable interrupts once again */
acpi_enable_irqs();
ACPI_ENABLE_IRQS();
/* restore device context */
device_resume(RESUME_RESTORE_STATE);
......@@ -200,7 +200,7 @@ acpi_system_save_state(
* But, we want it done early, so we don't get any suprises during
* the device suspend sequence.
*/
acpi_disable_irqs();
ACPI_DISABLE_IRQS();
/* Unconditionally turn off devices.
* Obvious if we enter a sleep state.
......@@ -304,7 +304,7 @@ acpi_suspend (
return status;
/* disable interrupts and flush caches */
acpi_disable_irqs();
ACPI_DISABLE_IRQS();
wbinvd();
/* perform OS-specific sleep actions */
......@@ -318,7 +318,7 @@ acpi_suspend (
acpi_leave_sleep_state(state);
/* make sure interrupts are enabled */
acpi_enable_irqs();
ACPI_ENABLE_IRQS();
/* reset firmware waking vector */
acpi_set_firmware_waking_vector((ACPI_PHYSICAL_ADDRESS) 0);
......@@ -570,7 +570,6 @@ acpi_system_read_debug (
{
char *p = page;
int size = 0;
u32 var;
if (off != 0)
goto end;
......@@ -607,7 +606,6 @@ acpi_system_write_debug (
void *data)
{
char debug_string[12] = {'\0'};
u32 *pvar;
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
......@@ -1126,6 +1124,23 @@ acpi_system_remove_fs (
Driver Interface
-------------------------------------------------------------------------- */
#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_PM)
/* Simple wrapper calling power down function. */
static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
struct kbd_struct *kbd, struct tty_struct *tty)
{
acpi_power_off();
}
struct sysrq_key_op sysrq_acpi_poweroff_op = {
handler: &acpi_sysrq_power_off,
help_msg: "Off",
action_msg: "Power Off\n"
};
#endif /* CONFIG_MAGIC_SYSRQ */
static int
acpi_system_add (
struct acpi_device *device)
......@@ -1168,8 +1183,10 @@ acpi_system_add (
#ifdef CONFIG_PM
/* Install the soft-off (S5) handler. */
if (system->states[ACPI_STATE_S5])
if (system->states[ACPI_STATE_S5]) {
pm_power_off = acpi_power_off;
register_sysrq_key('o', &sysrq_acpi_poweroff_op);
}
#endif
end:
......@@ -1196,8 +1213,10 @@ acpi_system_remove (
#ifdef CONFIG_PM
/* Remove the soft-off (S5) handler. */
if (system->states[ACPI_STATE_S5])
if (system->states[ACPI_STATE_S5]) {
unregister_sysrq_key('o', &sysrq_acpi_poweroff_op);
pm_power_off = NULL;
}
#endif
acpi_system_remove_fs(device);
......
/*
* acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 33 $)
* acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 36 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -78,7 +78,6 @@ struct acpi_thermal_state {
u8 passive:1;
u8 active:1;
u8 reserved:4;
int passive_index; /* a.k.a. limit state */
int active_index;
};
......@@ -467,15 +466,23 @@ acpi_thermal_passive (
*/
if (tz->temperature >= passive->temperature) {
trend = (passive->tc1 * (tz->temperature - tz->last_temperature)) + (passive->tc2 * (tz->temperature - passive->temperature));
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", trend, passive->tc1, tz->temperature, tz->last_temperature, passive->tc2, tz->temperature, passive->temperature));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n",
trend, passive->tc1, tz->temperature,
tz->last_temperature, passive->tc2,
tz->temperature, passive->temperature));
/* Heating up? */
if (trend > 0)
for (i=0; i<passive->devices.count; i++)
acpi_processor_set_limit(passive->devices.handles[i], ACPI_PROCESSOR_LIMIT_INCREMENT, &tz->state.passive_index);
acpi_processor_set_thermal_limit(
passive->devices.handles[i],
ACPI_PROCESSOR_LIMIT_INCREMENT);
/* Cooling off? */
else if (trend < 0)
for (i=0; i<passive->devices.count; i++)
acpi_processor_set_limit(passive->devices.handles[i], ACPI_PROCESSOR_LIMIT_DECREMENT, &tz->state.passive_index);
acpi_processor_set_thermal_limit(
passive->devices.handles[i],
ACPI_PROCESSOR_LIMIT_DECREMENT);
}
/*
......@@ -487,10 +494,13 @@ acpi_thermal_passive (
*/
else if (tz->trips.passive.flags.enabled) {
for (i=0; i<passive->devices.count; i++)
acpi_processor_set_limit(passive->devices.handles[i], ACPI_PROCESSOR_LIMIT_DECREMENT, &tz->state.passive_index);
if (0 == tz->state.passive_index) {
result = acpi_processor_set_thermal_limit(
passive->devices.handles[i],
ACPI_PROCESSOR_LIMIT_DECREMENT);
if (1 == result) {
tz->trips.passive.flags.enabled = 0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling passive cooling (zone is cool)\n"));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Disabling passive cooling (zone is cool)\n"));
}
}
......@@ -671,7 +681,7 @@ acpi_thermal_check (
if (timer_pending(&(tz->timer)))
mod_timer(&(tz->timer), (HZ * sleep_time) / 1000);
else {
tz->timer.data = (u32) tz;
tz->timer.data = (unsigned long) tz;
tz->timer.function = acpi_thermal_run;
tz->timer.expires = jiffies + (HZ * sleep_time) / 1000;
add_timer(&(tz->timer));
......@@ -720,7 +730,7 @@ acpi_thermal_read_state (
if (tz->state.hot)
p += sprintf(p, "hot ");
if (tz->state.passive)
p += sprintf(p, "passive[%d] ", tz->state.passive_index);
p += sprintf(p, "passive ");
if (tz->state.active)
p += sprintf(p, "active[%d]", tz->state.active_index);
p += sprintf(p, "\n");
......@@ -810,9 +820,10 @@ acpi_thermal_read_trip_points (
tz->trips.passive.tc1,
tz->trips.passive.tc2,
tz->trips.passive.tsp);
for (j=0; j<tz->trips.passive.devices.count; j++)
p += sprintf(p, "0x%p ",
tz->trips.passive.devices.handles[j]);
for (j=0; j<tz->trips.passive.devices.count; j++) {
p += sprintf(p, "0x%p ", tz->trips.passive.devices.handles[j]);
}
p += sprintf(p, "\n");
}
......
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 66 $
* $Revision: 67 $
*
******************************************************************************/
......@@ -298,6 +298,7 @@ acpi_db_decode_internal_object (
if (!obj_desc) {
acpi_os_printf (" Uninitialized\n");
return;
}
......@@ -420,10 +421,10 @@ acpi_db_display_internal_object (
break;
case AML_LOCAL_OP:
acpi_os_printf ("[Local%d]", obj_desc->reference.offset);
acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
acpi_os_printf (" %p", obj_desc);
acpi_os_printf ("%p", obj_desc);
acpi_db_decode_internal_object (obj_desc);
}
break;
......@@ -432,7 +433,7 @@ acpi_db_display_internal_object (
acpi_os_printf ("[Arg%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
acpi_os_printf (" %p", obj_desc);
acpi_os_printf ("%p", obj_desc);
acpi_db_decode_internal_object (obj_desc);
}
break;
......@@ -467,7 +468,6 @@ acpi_db_display_internal_object (
break;
}
acpi_os_printf ("\n");
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 59 $
* $Revision: 60 $
*
******************************************************************************/
......@@ -308,27 +308,14 @@ ae_local_load_table (
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_load_acpi_table
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
#ifdef ACPI_APPLICATION
acpi_status
acpi_db_load_acpi_table (
acpi_db_get_acpi_table (
NATIVE_CHAR *filename)
{
#ifdef ACPI_APPLICATION
FILE *fp;
acpi_status status;
u32 table_length;
acpi_status status;
/* Open the file */
......@@ -350,7 +337,35 @@ acpi_db_load_acpi_table (
return (status);
}
/* Attempt to recognize and install the table */
return (AE_OK);
}
#endif
/*******************************************************************************
*
* FUNCTION: Acpi_db_load_acpi_table
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
acpi_status
acpi_db_load_acpi_table (
NATIVE_CHAR *filename) {
#ifdef ACPI_APPLICATION
acpi_status status;
status = acpi_db_get_acpi_table (filename);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Attempt to recognize and install the table */
status = ae_local_load_table (acpi_gbl_db_table_ptr);
if (ACPI_FAILURE (status)) {
......
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 51 $
* $Revision: 52 $
*
******************************************************************************/
......@@ -151,7 +151,7 @@ acpi_db_dump_object (
case ACPI_TYPE_BUFFER:
acpi_os_printf ("[Buffer] = ");
acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
break;
......
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 79 $
* $Revision: 81 $
*
*****************************************************************************/
......@@ -77,7 +77,7 @@ acpi_ds_parse_method (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** 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));
/* Extract the method object from the method Node */
......@@ -111,7 +111,7 @@ acpi_ds_parse_method (
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name (op, node->name);
acpi_ps_set_name (op, node->name.integer);
op->node = node;
/*
......@@ -152,7 +152,7 @@ acpi_ds_parse_method (
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
acpi_ps_delete_parse_tree (op);
......@@ -414,7 +414,6 @@ acpi_ds_restart_control_method (
walk_state->method_call_op, return_desc, walk_state->return_used,
walk_state->results, walk_state));
return_ACPI_STATUS (AE_OK);
}
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 58 $
* $Revision: 59 $
*
******************************************************************************/
......@@ -72,10 +72,10 @@ acpi_ds_method_data_init (
for (i = 0; i < MTH_NUM_ARGS; i++) {
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
NAMEOF_ARG_NTE);
walk_state->arguments[i].name |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
walk_state->arguments[i].name.integer |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
......@@ -84,10 +84,10 @@ acpi_ds_method_data_init (
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name,
NAMEOF_LOCAL_NTE);
walk_state->local_variables[i].name |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 73 $
* $Revision: 74 $
*
*****************************************************************************/
......@@ -54,7 +54,9 @@
acpi_status
acpi_ds_execute_arguments (
acpi_namespace_node *node,
acpi_operand_object *extra_desc)
acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start)
{
acpi_status status;
acpi_parse_object *op;
......@@ -66,17 +68,16 @@ acpi_ds_execute_arguments (
/*
* Allocate a new parser op to be the root of the parsed
* Buffer_field tree
* Allocate a new parser op to be the root of the parsed tree
*/
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Node for use in Acpi_ps_parse_aml */
op->node = acpi_ns_get_parent_node (node);
op->node = scope_node;
/* Create and initialize a new parser state */
......@@ -85,8 +86,8 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 1);
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
......@@ -94,7 +95,7 @@ acpi_ds_execute_arguments (
walk_state->parse_flags = 0;
/* Pass1: Parse the entire Buffer_field declaration */
/* Pass1: Parse the entire declaration */
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
......@@ -102,7 +103,7 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (status);
}
/* Get and init the actual Field_unit Op created above */
/* Get and init the Op created above */
arg = op->value.arg;
op->node = node;
......@@ -111,12 +112,12 @@ acpi_ds_execute_arguments (
/* Evaluate the address and length arguments for the Buffer Field */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
op->node = acpi_ns_get_parent_node (node);
op->node = scope_node;
/* Create and initialize a new parser state */
......@@ -125,8 +126,8 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 3);
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, NULL, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
......@@ -178,7 +179,102 @@ acpi_ds_get_buffer_field_arguments (
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, extra_desc);
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
return_ACPI_STATUS (status);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_get_buffer_arguments
*
* PARAMETERS: Obj_desc - A valid Bufferobject
*
* RETURN: Status.
*
* DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
acpi_status
acpi_ds_get_buffer_arguments (
acpi_operand_object *obj_desc)
{
acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_buffer_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS (AE_OK);
}
/* Get the Buffer node */
node = obj_desc->buffer.node;
if (!node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in buffer %p\n", obj_desc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer JIT Init\n"));
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, node,
obj_desc->buffer.aml_length, obj_desc->buffer.aml_start);
return_ACPI_STATUS (status);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_get_package_arguments
*
* PARAMETERS: Obj_desc - A valid Packageobject
*
* RETURN: Status.
*
* DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
acpi_status
acpi_ds_get_package_arguments (
acpi_operand_object *obj_desc)
{
acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_package_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS (AE_OK);
}
/* Get the Package node */
node = obj_desc->package.node;
if (!node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in package %p\n", obj_desc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package JIT Init\n"));
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, node,
obj_desc->package.aml_length, obj_desc->package.aml_start);
return_ACPI_STATUS (status);
}
......@@ -202,7 +298,7 @@ acpi_ds_get_region_arguments (
{
acpi_namespace_node *node;
acpi_status status;
acpi_operand_object *region_obj2;
acpi_operand_object *extra_desc;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
......@@ -212,22 +308,23 @@ acpi_ds_get_region_arguments (
return_ACPI_STATUS (AE_OK);
}
region_obj2 = acpi_ns_get_secondary_object (obj_desc);
if (!region_obj2) {
extra_desc = acpi_ns_get_secondary_object (obj_desc);
if (!extra_desc) {
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the AML pointer (method object) and region node */
/* Get the Region node */
node = obj_desc->region.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
(char *) &node->name, region_obj2->extra.aml_start));
(char *) &node->name, extra_desc->extra.aml_start));
status = acpi_ds_execute_arguments (node, region_obj2);
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
return_ACPI_STATUS (status);
}
......@@ -306,7 +403,7 @@ acpi_ds_eval_buffer_field_operands (
next_op = op->value.arg;
/* Acpi_evaluate/create the address and length operands */
/* Evaluate/create the address and length operands */
status = acpi_ds_create_operands (walk_state, next_op);
if (ACPI_FAILURE (status)) {
......@@ -556,7 +653,7 @@ acpi_ds_eval_region_operands (
next_op = next_op->next;
/* Acpi_evaluate/create the address and length operands */
/* Evaluate/create the address and length operands */
status = acpi_ds_create_operands (walk_state, next_op);
if (ACPI_FAILURE (status)) {
......@@ -610,6 +707,95 @@ acpi_ds_eval_region_operands (
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_eval_data_object_operands
*
* PARAMETERS: Op - A valid Data_object Op object
*
* RETURN: Status
*
* DESCRIPTION: Get the operands and complete the following data objec types:
* Buffer
* Package
*
****************************************************************************/
acpi_status
acpi_ds_eval_data_object_operands (
acpi_walk_state *walk_state,
acpi_parse_object *op,
acpi_operand_object *obj_desc)
{
acpi_status status;
acpi_operand_object *arg_desc;
u32 length;
ACPI_FUNCTION_TRACE ("Ds_eval_data_object_operands");
/* The first operand (for all of these data objects) is the length */
status = acpi_ds_create_operand (walk_state, op->value.arg, 1);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Extract length operand */
arg_desc = walk_state->operands [walk_state->num_operands - 1];
length = (u32) arg_desc->integer.value;
/* Cleanup for length operand */
acpi_ds_obj_stack_pop (1, walk_state);
acpi_ut_remove_reference (arg_desc);
/*
* Create the actual data object
*/
switch (op->opcode) {
case AML_BUFFER_OP:
status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc);
break;
default:
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
if (ACPI_SUCCESS (status)) {
/*
* Return the object in the Walk_state, unless the parent is a package --
* in this case, the return object will be stored in the parse tree
* for the package.
*/
if ((!op->parent) ||
((op->parent->opcode != AML_PACKAGE_OP) &&
(op->parent->opcode != AML_VAR_PACKAGE_OP) &&
(op->parent->opcode != AML_NAME_OP))) {
walk_state->result_obj = obj_desc;
}
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ds_exec_begin_control_op
......
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 88 $
* $Revision: 89 $
*
******************************************************************************/
......@@ -133,7 +133,11 @@ acpi_ds_is_result_used (
case AML_CLASS_NAMED_OBJECT:
if ((op->parent->opcode == AML_REGION_OP) ||
(op->parent->opcode == AML_DATA_REGION_OP)) {
(op->parent->opcode == AML_DATA_REGION_OP) ||
(op->parent->opcode == AML_PACKAGE_OP) ||
(op->parent->opcode == AML_VAR_PACKAGE_OP) ||
(op->parent->opcode == AML_BUFFER_OP) ||
(op->parent->opcode == AML_INT_EVAL_SUBTREE_OP)) {
/*
* These opcodes allow Term_arg(s) as operands and therefore
* the operands can be method calls. The result is used.
......@@ -144,11 +148,12 @@ acpi_ds_is_result_used (
goto result_not_used;
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
default:
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
goto result_used;
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 89 $
* $Revision: 90 $
*
*****************************************************************************/
......@@ -498,6 +498,50 @@ acpi_ds_exec_end_op (
break;
case AML_TYPE_CREATE_OBJECT:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Create_object (Buffer/Package) Op=%p\n", op));
switch (op->parent->opcode) {
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
walk_state->operands[0] = (void *) op->parent->node;
walk_state->num_operands = 1;
status = acpi_ds_create_node (walk_state, op->parent->node, op->parent);
if (ACPI_FAILURE (status)) {
break;
}
/* Fall through */
case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op, acpi_ns_get_attached_object (op->parent->node));
break;
default:
status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
break;
}
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (status) &&
walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
......@@ -167,7 +167,7 @@ acpi_ds_load1_begin_op (
/* Initialize */
((acpi_parse2_object *)op)->name = node->name;
((acpi_parse2_object *)op)->name = node->name.integer;
/*
* Put the Node in the "op" object that the parser uses, so we
......@@ -381,7 +381,7 @@ acpi_ds_load2_begin_op (
/* Initialize the new op */
((acpi_parse2_object *)op)->name = node->name;
((acpi_parse2_object *)op)->name = node->name.integer;
*out_op = op;
}
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
* $Revision: 47 $
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 48 $
*
*****************************************************************************/
......@@ -34,6 +33,40 @@
ACPI_MODULE_NAME ("evmisc")
/*******************************************************************************
*
* FUNCTION: Acpi_ev_is_notify_object
*
* PARAMETERS: Node - Node to check
*
* RETURN: TRUE if notifies allowed on this object
*
* DESCRIPTION: Check type of node for a object that supports notifies.
*
* TBD: This could be replaced by a flag bit in the node.
*
******************************************************************************/
u8
acpi_ev_is_notify_object (
acpi_namespace_node *node)
{
switch (node->type) {
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
/*
* These are the ONLY objects that can receive ACPI notifications
*/
return (TRUE);
default:
return (FALSE);
}
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_get_gpe_register_index
......
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.
......@@ -96,7 +96,7 @@ acpi_free (
acpi_status
acpi_find_root_pointer (
u32 flags,
ACPI_PHYSICAL_ADDRESS *rsdp_physical_address);
ACPI_POINTER *rsdp_address);
acpi_status
acpi_load_tables (
......
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