diff --git a/[refs] b/[refs] index 74a0925fedb3..5ebb444b43e1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d0302bc62af7983040ea1cd1b5dd2b36e1a6a509 +refs/heads/master: 3fe0313e6ec572e6bb3f9d247316a834336db4be diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 136f02842de9..e0f346d201ed 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -139,7 +139,6 @@ and is between 256 and 4096 characters. It is defined in the file ht -- run only enough ACPI to enable Hyper Threading strict -- Be less tolerant of platforms that are not strictly ACPI specification compliant. - rsdt -- prefer RSDT over (default) XSDT See also Documentation/power/pm.txt, pci=noacpi @@ -221,17 +220,14 @@ and is between 256 and 4096 characters. It is defined in the file Bits in debug_level correspond to a level in ACPI_DEBUG_PRINT statements, e.g., ACPI_DEBUG_PRINT((ACPI_DB_INFO, ... - The debug_level mask defaults to "info". See - Documentation/acpi/debug.txt for more information about - debug layers and levels. + See Documentation/acpi/debug.txt for more information + about debug layers and levels. - Enable processor driver info messages: - acpi.debug_layer=0x20000000 - Enable PCI/PCI interrupt routing info messages: - acpi.debug_layer=0x400000 Enable AML "Debug" output, i.e., stores to the Debug object while interpreting AML: acpi.debug_layer=0xffffffff acpi.debug_level=0x2 + Enable PCI/PCI interrupt routing info messages: + acpi.debug_layer=0x400000 acpi.debug_level=0x4 Enable all messages related to ACPI hardware: acpi.debug_layer=0x2 acpi.debug_level=0xffffffff diff --git a/trunk/Documentation/sound/alsa/ALSA-Configuration.txt b/trunk/Documentation/sound/alsa/ALSA-Configuration.txt index 394d7d378dc7..3cd2ad958176 100644 --- a/trunk/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/trunk/Documentation/sound/alsa/ALSA-Configuration.txt @@ -1063,7 +1063,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. STAC9227/9228/9229/927x ref Reference board - ref-no-jd Reference board without HP/Mic jack detection 3stack D965 3stack 5stack D965 5stack + SPDIF dell-3stack Dell Dimension E520 @@ -1077,7 +1076,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. STAC92HD73* ref Reference board - no-jd BIOS setup but without jack-detection dell-m6-amic Dell desktops/laptops with analog mics dell-m6-dmic Dell desktops/laptops with digital mics dell-m6 Dell desktops/laptops with both type of mics diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index fbc8fa58d56d..c42a567e010c 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -4529,7 +4529,7 @@ S: Maintained USB VIDEO CLASS P: Laurent Pinchart M: laurent.pinchart@skynet.be -L: linux-uvc-devel@lists.berlios.de (subscribers-only) +L: linux-uvc-devel@lists.berlios.de L: video4linux-list@redhat.com W: http://linux-uvc.berlios.de S: Maintained diff --git a/trunk/Makefile b/trunk/Makefile index 71e98e9e6acd..4c8d79710b84 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 28 -EXTRAVERSION = +EXTRAVERSION = -rc9 NAME = Erotic Pickled Herring # *DOCUMENTATION* diff --git a/trunk/arch/ia64/include/asm/acpi-ext.h b/trunk/arch/ia64/include/asm/acpi-ext.h index 7f8362b379eb..734d137dda6e 100644 --- a/trunk/arch/ia64/include/asm/acpi-ext.h +++ b/trunk/arch/ia64/include/asm/acpi-ext.h @@ -14,6 +14,7 @@ #define _ASM_IA64_ACPI_EXT_H #include +#include extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length); diff --git a/trunk/arch/ia64/include/asm/sn/acpi.h b/trunk/arch/ia64/include/asm/sn/acpi.h index fd480db25565..9ce2801cbd57 100644 --- a/trunk/arch/ia64/include/asm/sn/acpi.h +++ b/trunk/arch/ia64/include/asm/sn/acpi.h @@ -9,6 +9,8 @@ #ifndef _ASM_IA64_SN_ACPI_H #define _ASM_IA64_SN_ACPI_H +#include "acpi/acglobal.h" + extern int sn_acpi_rev; #define SN_ACPI_BASE_SUPPORT() (sn_acpi_rev >= 0x20101) diff --git a/trunk/arch/ia64/kernel/acpi.c b/trunk/arch/ia64/kernel/acpi.c index c19b686db9b8..bd7acc71e8a9 100644 --- a/trunk/arch/ia64/kernel/acpi.c +++ b/trunk/arch/ia64/kernel/acpi.c @@ -65,7 +65,6 @@ EXPORT_SYMBOL(pm_idle); void (*pm_power_off) (void); EXPORT_SYMBOL(pm_power_off); -u32 acpi_rsdt_forced; unsigned int acpi_cpei_override; unsigned int acpi_cpei_phys_cpuid; diff --git a/trunk/arch/ia64/sn/kernel/io_acpi_init.c b/trunk/arch/ia64/sn/kernel/io_acpi_init.c index c5a214026a77..bc610a6c7851 100644 --- a/trunk/arch/ia64/sn/kernel/io_acpi_init.c +++ b/trunk/arch/ia64/sn/kernel/io_acpi_init.c @@ -13,6 +13,7 @@ #include #include "xtalk/hubdev.h" #include +#include /* @@ -63,7 +64,6 @@ static acpi_status __init sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; u64 addr; struct hubdev_info *hubdev; struct hubdev_info *hubdev_ptr; @@ -77,12 +77,11 @@ sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret) status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, &sn_uuid, &buffer); if (ACPI_FAILURE(status)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR "sn_acpi_hubdev_init: acpi_get_vendor_resource() " - "(0x%x) failed for: %s\n", status, - (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "(0x%x) failed for: ", status); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); return AE_OK; /* Continue walking namespace */ } @@ -90,12 +89,11 @@ sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret) vendor = &resource->data.vendor_typed; if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != sizeof(struct hubdev_info *)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR - "sn_acpi_hubdev_init: Invalid vendor data length: " - "%d for: %s\n", - vendor->byte_length, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ", + vendor->byte_length); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); goto exit; } @@ -122,7 +120,6 @@ sn_get_bussoft_ptr(struct pci_bus *bus) { u64 addr; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; acpi_handle handle; struct pcibus_bussoft *prom_bussoft_ptr; struct acpi_resource *resource; @@ -134,11 +131,11 @@ sn_get_bussoft_ptr(struct pci_bus *bus) status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, &sn_uuid, &buffer); if (ACPI_FAILURE(status)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR "%s: " - "acpi_get_vendor_resource() failed (0x%x) for: %s\n", - __func__, status, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "acpi_get_vendor_resource() failed (0x%x) for: ", + __func__, status); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); return NULL; } resource = buffer.pointer; @@ -171,7 +168,6 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info, { u64 addr; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct sn_irq_info *irq_info, *irq_info_prom; struct pcidev_info *pcidev_ptr, *pcidev_prom_ptr; struct acpi_resource *resource; @@ -186,11 +182,11 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info, status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, &sn_uuid, &buffer); if (ACPI_FAILURE(status)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR - "%s: acpi_get_vendor_resource() failed (0x%x) for: %s\n", - __func__, status, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "%s: acpi_get_vendor_resource() failed (0x%x) for: ", + __func__, status); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); return 1; } @@ -198,12 +194,11 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info, vendor = &resource->data.vendor_typed; if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != sizeof(struct pci_devdev_info *)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR - "%s: Invalid vendor data length: %d for: %s\n", - __func__, vendor->byte_length, - (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "%s: Invalid vendor data length: %d for: ", + __func__, vendor->byte_length); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); ret = 1; goto exit; } @@ -244,9 +239,6 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle) acpi_handle parent; int slot; acpi_status status; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - - acpi_get_name(device_handle, ACPI_FULL_PATHNAME, &name_buffer); /* * Do an upward search to find the root bus device, and @@ -257,8 +249,9 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle) status = acpi_get_parent(child, &parent); if (ACPI_FAILURE(status)) { printk(KERN_ERR "%s: acpi_get_parent() failed " - "(0x%x) for: %s\n", __func__, status, - (char *)name_buffer.pointer); + "(0x%x) for: ", __func__, status); + acpi_ns_print_node_pathname(child, NULL); + printk("\n"); panic("%s: Unable to find host devfn\n", __func__); } if (parent == rootbus_handle) @@ -266,20 +259,22 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle) child = parent; } if (!child) { - printk(KERN_ERR "%s: Unable to find root bus for: %s\n", - __func__, (char *)name_buffer.pointer); + printk(KERN_ERR "%s: Unable to find root bus for: ", + __func__); + acpi_ns_print_node_pathname(device_handle, NULL); + printk("\n"); BUG(); } status = acpi_evaluate_integer(child, METHOD_NAME__ADR, NULL, &adr); if (ACPI_FAILURE(status)) { - printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: %s\n", - __func__, status, (char *)name_buffer.pointer); + printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: ", + __func__, status); + acpi_ns_print_node_pathname(child, NULL); + printk("\n"); panic("%s: Unable to find host devfn\n", __func__); } - kfree(name_buffer.pointer); - slot = (adr >> 16) & 0xffff; function = adr & 0xffff; devfn = PCI_DEVFN(slot, function); @@ -305,28 +300,27 @@ find_matching_device(acpi_handle handle, u32 lvl, void *context, void **rv) int function; int slot; struct sn_pcidev_match *info = context; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); if (ACPI_SUCCESS(status)) { status = acpi_get_parent(handle, &parent); if (ACPI_FAILURE(status)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR - "%s: acpi_get_parent() failed (0x%x) for: %s\n", - __func__, status, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "%s: acpi_get_parent() failed (0x%x) for: ", + __func__, status); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); return AE_OK; } status = acpi_evaluate_integer(parent, METHOD_NAME__BBN, NULL, &bbn); if (ACPI_FAILURE(status)) { - acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer); printk(KERN_ERR - "%s: Failed to find _BBN in parent of: %s\n", - __func__, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "%s: Failed to find _BBN in parent of: ", + __func__); + acpi_ns_print_node_pathname(handle, NULL); + printk("\n"); return AE_OK; } @@ -356,27 +350,24 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, acpi_handle rootbus_handle; unsigned long long segment; acpi_status status; - struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle; status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, &segment); if (ACPI_SUCCESS(status)) { if (segment != pci_domain_nr(dev)) { - acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME, - &name_buffer); printk(KERN_ERR - "%s: Segment number mismatch, 0x%llx vs 0x%x for: %s\n", - __func__, segment, pci_domain_nr(dev), - (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + "%s: Segment number mismatch, 0x%llx vs 0x%x for: ", + __func__, segment, pci_domain_nr(dev)); + acpi_ns_print_node_pathname(rootbus_handle, NULL); + printk("\n"); return 1; } } else { - acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME, &name_buffer); - printk(KERN_ERR "%s: Unable to get __SEG from: %s\n", - __func__, (char *)name_buffer.pointer); - kfree(name_buffer.pointer); + printk(KERN_ERR "%s: Unable to get __SEG from: ", + __func__); + acpi_ns_print_node_pathname(rootbus_handle, NULL); + printk("\n"); return 1; } diff --git a/trunk/arch/ia64/sn/kernel/io_common.c b/trunk/arch/ia64/sn/kernel/io_common.c index 0d4ffa4da1da..8a924a5661dd 100644 --- a/trunk/arch/ia64/sn/kernel/io_common.c +++ b/trunk/arch/ia64/sn/kernel/io_common.c @@ -26,6 +26,7 @@ #include #include #include +#include "acpi/acglobal.h" extern void sn_init_cpei_timer(void); extern void register_sn_procfs(void); @@ -472,7 +473,7 @@ sn_io_early_init(void) { struct acpi_table_header *header = NULL; - acpi_get_table(ACPI_SIG_DSDT, 1, &header); + acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); BUG_ON(header == NULL); sn_acpi_rev = header->oem_revision; } @@ -504,7 +505,7 @@ sn_io_early_init(void) { struct acpi_table_header *header; - (void)acpi_get_table(ACPI_SIG_DSDT, 1, &header); + (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", header->oem_revision); } diff --git a/trunk/arch/mips/include/asm/byteorder.h b/trunk/arch/mips/include/asm/byteorder.h index 33790b9e0cc0..2988d29a0867 100644 --- a/trunk/arch/mips/include/asm/byteorder.h +++ b/trunk/arch/mips/include/asm/byteorder.h @@ -50,8 +50,9 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x) static inline __attribute_const__ __u64 __arch_swab64(__u64 x) { __asm__( - " dsbh %0, %1\n" - " dshd %0, %0" + " dsbh %0, %1 \n" + " dshd %0, %0 \n" + " drotr %0, %0, 32 \n" : "=r" (x) : "r" (x)); diff --git a/trunk/arch/mips/include/asm/elf.h b/trunk/arch/mips/include/asm/elf.h index d58f128aa747..a8eac1697b3d 100644 --- a/trunk/arch/mips/include/asm/elf.h +++ b/trunk/arch/mips/include/asm/elf.h @@ -232,7 +232,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; */ #ifdef __MIPSEB__ #define ELF_DATA ELFDATA2MSB -#elif defined(__MIPSEL__) +#elif __MIPSEL__ #define ELF_DATA ELFDATA2LSB #endif #define ELF_ARCH EM_MIPS diff --git a/trunk/arch/parisc/include/asm/tlbflush.h b/trunk/arch/parisc/include/asm/tlbflush.h index 1f6fd4fc05b9..b72ec66db699 100644 --- a/trunk/arch/parisc/include/asm/tlbflush.h +++ b/trunk/arch/parisc/include/asm/tlbflush.h @@ -44,12 +44,9 @@ static inline void flush_tlb_mm(struct mm_struct *mm) { BUG_ON(mm == &init_mm); /* Should never happen */ -#if 1 || defined(CONFIG_SMP) +#ifdef CONFIG_SMP flush_tlb_all(); #else - /* FIXME: currently broken, causing space id and protection ids - * to go out of sync, resulting in faults on userspace accesses. - */ if (mm) { if (mm->context != 0) free_sid(mm->context); diff --git a/trunk/arch/x86/Kconfig.cpu b/trunk/arch/x86/Kconfig.cpu index 8e99073b9e0f..b815664fe370 100644 --- a/trunk/arch/x86/Kconfig.cpu +++ b/trunk/arch/x86/Kconfig.cpu @@ -520,7 +520,6 @@ config X86_PTRACE_BTS bool "Branch Trace Store" default y depends on X86_DEBUGCTLMSR - depends on BROKEN help This adds a ptrace interface to the hardware's branch trace store. diff --git a/trunk/arch/x86/kernel/acpi/boot.c b/trunk/arch/x86/kernel/acpi/boot.c index 39ae3d0e3a4a..4c51a2f8fd31 100644 --- a/trunk/arch/x86/kernel/acpi/boot.c +++ b/trunk/arch/x86/kernel/acpi/boot.c @@ -47,7 +47,7 @@ #endif static int __initdata acpi_force = 0; -u32 acpi_rsdt_forced; + #ifdef CONFIG_ACPI int acpi_disabled = 0; #else @@ -1359,17 +1359,6 @@ static void __init acpi_process_madt(void) "Invalid BIOS MADT, disabling ACPI\n"); disable_acpi(); } - } else { - /* - * ACPI found no MADT, and so ACPI wants UP PIC mode. - * In the event an MPS table was found, forget it. - * Boot with "acpi=off" to use MPS on such a system. - */ - if (smp_found_config) { - printk(KERN_WARNING PREFIX - "No APIC-table, disabling MPS\n"); - smp_found_config = 0; - } } #endif return; @@ -1794,10 +1783,6 @@ static int __init parse_acpi(char *arg) disable_acpi(); acpi_ht = 1; } - /* acpi=rsdt use RSDT instead of XSDT */ - else if (strcmp(arg, "rsdt") == 0) { - acpi_rsdt_forced = 1; - } /* "acpi=noirq" disables ACPI interrupt routing */ else if (strcmp(arg, "noirq") == 0) { acpi_noirq_set(); diff --git a/trunk/arch/x86/kernel/acpi/cstate.c b/trunk/arch/x86/kernel/acpi/cstate.c index a4805b3b4095..c2502eb9aa83 100644 --- a/trunk/arch/x86/kernel/acpi/cstate.c +++ b/trunk/arch/x86/kernel/acpi/cstate.c @@ -56,7 +56,6 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */ static short mwait_supported[ACPI_PROCESSOR_MAX_POWER]; #define MWAIT_SUBSTATE_MASK (0xf) -#define MWAIT_CSTATE_MASK (0xf) #define MWAIT_SUBSTATE_SIZE (4) #define CPUID_MWAIT_LEAF (5) @@ -99,8 +98,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); /* Check whether this particular cx_type (in CST) is supported or not */ - cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) & - MWAIT_CSTATE_MASK) + 1; + cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1; edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; diff --git a/trunk/arch/x86/kernel/amd_iommu.c b/trunk/arch/x86/kernel/amd_iommu.c index 0a60d60ed036..a7b6dec6fc3f 100644 --- a/trunk/arch/x86/kernel/amd_iommu.c +++ b/trunk/arch/x86/kernel/amd_iommu.c @@ -235,9 +235,8 @@ static int iommu_completion_wait(struct amd_iommu *iommu) status &= ~MMIO_STATUS_COM_WAIT_INT_MASK; writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET); - if (unlikely(i == EXIT_LOOP_COUNT)) - panic("AMD IOMMU: Completion wait loop failed\n"); - + if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit())) + printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n"); out: spin_unlock_irqrestore(&iommu->lock, flags); diff --git a/trunk/arch/x86/kernel/amd_iommu_init.c b/trunk/arch/x86/kernel/amd_iommu_init.c index c6cc22815d35..30ae2701b3df 100644 --- a/trunk/arch/x86/kernel/amd_iommu_init.c +++ b/trunk/arch/x86/kernel/amd_iommu_init.c @@ -427,10 +427,6 @@ static u8 * __init alloc_command_buffer(struct amd_iommu *iommu) memcpy_toio(iommu->mmio_base + MMIO_CMD_BUF_OFFSET, &entry, sizeof(entry)); - /* set head and tail to zero manually */ - writel(0x00, iommu->mmio_base + MMIO_CMD_HEAD_OFFSET); - writel(0x00, iommu->mmio_base + MMIO_CMD_TAIL_OFFSET); - iommu_feature_enable(iommu, CONTROL_CMDBUF_EN); return cmd_buf; @@ -1078,8 +1074,7 @@ int __init amd_iommu_init(void) goto free; /* IOMMU rlookup table - find the IOMMU for a specific device */ - amd_iommu_rlookup_table = (void *)__get_free_pages( - GFP_KERNEL | __GFP_ZERO, + amd_iommu_rlookup_table = (void *)__get_free_pages(GFP_KERNEL, get_order(rlookup_table_size)); if (amd_iommu_rlookup_table == NULL) goto free; diff --git a/trunk/arch/x86/kernel/cpu/mcheck/mce_64.c b/trunk/arch/x86/kernel/cpu/mcheck/mce_64.c index 1c838032fd37..4b031a4ac856 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/mce_64.c @@ -510,9 +510,12 @@ static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c) */ void __cpuinit mcheck_init(struct cpuinfo_x86 *c) { + static cpumask_t mce_cpus = CPU_MASK_NONE; + mce_cpu_quirks(c); if (mce_dont_init || + cpu_test_and_set(smp_processor_id(), mce_cpus) || !mce_available(c)) return; diff --git a/trunk/arch/x86/kernel/microcode_core.c b/trunk/arch/x86/kernel/microcode_core.c index c4b5b24e0217..82fb2809ce32 100644 --- a/trunk/arch/x86/kernel/microcode_core.c +++ b/trunk/arch/x86/kernel/microcode_core.c @@ -272,18 +272,13 @@ static struct attribute_group mc_attr_group = { .name = "microcode", }; -static void __microcode_fini_cpu(int cpu) +static void microcode_fini_cpu(int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + mutex_lock(µcode_mutex); microcode_ops->microcode_fini_cpu(cpu); uci->valid = 0; -} - -static void microcode_fini_cpu(int cpu) -{ - mutex_lock(µcode_mutex); - __microcode_fini_cpu(cpu); mutex_unlock(µcode_mutex); } @@ -311,16 +306,12 @@ static int microcode_resume_cpu(int cpu) * to this cpu (a bit of paranoia): */ if (microcode_ops->collect_cpu_info(cpu, &nsig)) { - __microcode_fini_cpu(cpu); - printk(KERN_ERR "failed to collect_cpu_info for resuming cpu #%d\n", - cpu); + microcode_fini_cpu(cpu); return -1; } - if ((nsig.sig != uci->cpu_sig.sig) || (nsig.pf != uci->cpu_sig.pf)) { - __microcode_fini_cpu(cpu); - printk(KERN_ERR "cached ucode doesn't match the resuming cpu #%d\n", - cpu); + if (memcmp(&nsig, &uci->cpu_sig, sizeof(nsig))) { + microcode_fini_cpu(cpu); /* Should we look for a new ucode here? */ return 1; } diff --git a/trunk/arch/x86/kernel/microcode_intel.c b/trunk/arch/x86/kernel/microcode_intel.c index a8e62792d171..622dc4a21784 100644 --- a/trunk/arch/x86/kernel/microcode_intel.c +++ b/trunk/arch/x86/kernel/microcode_intel.c @@ -155,7 +155,6 @@ static DEFINE_SPINLOCK(microcode_update_lock); static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) { struct cpuinfo_x86 *c = &cpu_data(cpu_num); - unsigned long flags; unsigned int val[2]; memset(csig, 0, sizeof(*csig)); @@ -175,16 +174,11 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) csig->pf = 1 << ((val[1] >> 18) & 7); } - /* serialize access to the physical write to MSR 0x79 */ - spin_lock_irqsave(µcode_update_lock, flags); - wrmsr(MSR_IA32_UCODE_REV, 0, 0); /* see notes above for revision 1.07. Apparent chip bug */ sync_core(); /* get the current revision from MSR 0x8B */ rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev); - spin_unlock_irqrestore(µcode_update_lock, flags); - pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", csig->sig, csig->pf, csig->rev); diff --git a/trunk/arch/x86/kernel/pci-gart_64.c b/trunk/arch/x86/kernel/pci-gart_64.c index a35eaa379ff6..ba7ad83e20a8 100644 --- a/trunk/arch/x86/kernel/pci-gart_64.c +++ b/trunk/arch/x86/kernel/pci-gart_64.c @@ -745,8 +745,10 @@ void __init gart_iommu_init(void) unsigned long scratch; long i; - if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) + if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) { + printk(KERN_INFO "PCI-GART: No AMD GART found.\n"); return; + } #ifndef CONFIG_AGP_AMD64 no_agp = 1; diff --git a/trunk/drivers/acpi/Makefile b/trunk/drivers/acpi/Makefile index 5d23c13ac7d4..3c0c93300f12 100644 --- a/trunk/drivers/acpi/Makefile +++ b/trunk/drivers/acpi/Makefile @@ -2,8 +2,15 @@ # Makefile for the Linux ACPI interpreter # -ccflags-y := -Os -ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT +export ACPI_CFLAGS + +ACPI_CFLAGS := -Os + +ifdef CONFIG_ACPI_DEBUG + ACPI_CFLAGS += -DACPI_DEBUG_OUTPUT +endif + +EXTRA_CFLAGS += $(ACPI_CFLAGS) # # ACPI Boot-Time Table Parsing @@ -15,13 +22,9 @@ obj-$(CONFIG_X86) += blacklist.o # ACPI Core Subsystem (Interpreter) # obj-y += osl.o utils.o reboot.o\ - acpica/ - -# sleep related files -obj-y += wakeup.o -obj-y += main.o -obj-$(CONFIG_ACPI_SLEEP) += proc.o - + dispatcher/ events/ executer/ hardware/ \ + namespace/ parser/ resources/ tables/ \ + utilities/ # # ACPI Bus and Device Drivers @@ -32,6 +35,7 @@ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif +obj-y += sleep/ obj-y += bus.o glue.o obj-y += scan.o # Keep EC driver first. Initialization of others depend on it. diff --git a/trunk/drivers/acpi/acpica/Makefile b/trunk/drivers/acpi/acpica/Makefile deleted file mode 100644 index 3f23298ee3fd..000000000000 --- a/trunk/drivers/acpi/acpica/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# Makefile for ACPICA Core interpreter -# - -ccflags-y := -Os -ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT - -obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ - dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ - dsinit.o - -obj-y += evevent.o evregion.o evsci.o evxfevnt.o \ - evmisc.o evrgnini.o evxface.o evxfregn.o \ - evgpe.o evgpeblk.o - -obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ - exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ - excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ - exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o - -obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o - -obj-$(ACPI_FUTURE_USAGE) += hwtimer.o - -obj-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ - nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ - nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ - nsparse.o nspredef.o - -obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o - -obj-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ - psopcode.o psscope.o psutils.o psxface.o - -obj-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ - rscalc.o rsirq.o rsmemory.o rsutils.o - -obj-$(ACPI_FUTURE_USAGE) += rsdump.o - -obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o - -obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ - utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ - utstate.o utmutex.o utobject.o utresrc.o diff --git a/trunk/drivers/acpi/acpica/accommon.h b/trunk/drivers/acpi/acpica/accommon.h deleted file mode 100644 index 3b20786cbb0d..000000000000 --- a/trunk/drivers/acpi/acpica/accommon.h +++ /dev/null @@ -1,63 +0,0 @@ -/****************************************************************************** - * - * Name: accommon.h - Common include files for generation of ACPICA source - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 - 2008, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#ifndef __ACCOMMON_H__ -#define __ACCOMMON_H__ - -/* - * Common set of includes for all ACPICA source files. - * We put them here because we don't want to duplicate them - * in the the source code again and again. - * - * Note: The order of these include files is important. - */ -#include "acconfig.h" /* Global configuration constants */ -#include "acmacros.h" /* C macros */ -#include "aclocal.h" /* Internal data types */ -#include "acobject.h" /* ACPI internal object */ -#include "acstruct.h" /* Common structures */ -#include "acglobal.h" /* All global variables */ -#include "achware.h" /* Hardware defines and interfaces */ -#include "acutils.h" /* Utility interfaces */ - -#endif /* __ACCOMMON_H__ */ diff --git a/trunk/drivers/acpi/acpica/hwregs.c b/trunk/drivers/acpi/acpica/hwregs.c deleted file mode 100644 index 4dc43b018517..000000000000 --- a/trunk/drivers/acpi/acpica/hwregs.c +++ /dev/null @@ -1,353 +0,0 @@ - -/******************************************************************************* - * - * Module Name: hwregs - Read/write access functions for the various ACPI - * control and status registers. - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2008, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" - -#define _COMPONENT ACPI_HARDWARE -ACPI_MODULE_NAME("hwregs") - -/******************************************************************************* - * - * FUNCTION: acpi_hw_clear_acpi_status - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Clears all fixed and general purpose status bits - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ -acpi_status acpi_hw_clear_acpi_status(void) -{ - acpi_status status; - acpi_cpu_flags lock_flags = 0; - - ACPI_FUNCTION_TRACE(hw_clear_acpi_status); - - ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", - ACPI_BITMASK_ALL_FIXED_STATUS, - (u16) acpi_gbl_FADT.xpm1a_event_block.address)); - - lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - - status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); - if (ACPI_FAILURE(status)) { - goto unlock_and_exit; - } - - /* Clear the fixed events */ - - if (acpi_gbl_FADT.xpm1b_event_block.address) { - status = acpi_write(ACPI_BITMASK_ALL_FIXED_STATUS, - &acpi_gbl_FADT.xpm1b_event_block); - if (ACPI_FAILURE(status)) { - goto unlock_and_exit; - } - } - - /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - - status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); - - unlock_and_exit: - acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_hw_get_register_bit_mask - * - * PARAMETERS: register_id - Index of ACPI Register to access - * - * RETURN: The bitmask to be used when accessing the register - * - * DESCRIPTION: Map register_id into a register bitmask. - * - ******************************************************************************/ - -struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) -{ - ACPI_FUNCTION_ENTRY(); - - if (register_id > ACPI_BITREG_MAX) { - ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", - register_id)); - return (NULL); - } - - return (&acpi_gbl_bit_register_info[register_id]); -} - -/****************************************************************************** - * - * FUNCTION: acpi_hw_register_read - * - * PARAMETERS: register_id - ACPI Register ID - * return_value - Where the register value is returned - * - * RETURN: Status and the value read. - * - * DESCRIPTION: Read from the specified ACPI register - * - ******************************************************************************/ -acpi_status -acpi_hw_register_read(u32 register_id, u32 * return_value) -{ - u32 value1 = 0; - u32 value2 = 0; - acpi_status status; - - ACPI_FUNCTION_TRACE(hw_register_read); - - switch (register_id) { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - - status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_event_block); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* PM1B is optional */ - - status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_event_block); - value1 |= value2; - break; - - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - - status = acpi_read(&value1, &acpi_gbl_xpm1a_enable); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* PM1B is optional */ - - status = acpi_read(&value2, &acpi_gbl_xpm1b_enable); - value1 |= value2; - break; - - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_control_block); - if (ACPI_FAILURE(status)) { - goto exit; - } - - status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_control_block); - value1 |= value2; - break; - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - status = acpi_read(&value1, &acpi_gbl_FADT.xpm2_control_block); - break; - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - status = acpi_read(&value1, &acpi_gbl_FADT.xpm_timer_block); - break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - status = - acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); - break; - - default: - ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id)); - status = AE_BAD_PARAMETER; - break; - } - - exit: - - if (ACPI_SUCCESS(status)) { - *return_value = value1; - } - - return_ACPI_STATUS(status); -} - -/****************************************************************************** - * - * FUNCTION: acpi_hw_register_write - * - * PARAMETERS: register_id - ACPI Register ID - * Value - The value to write - * - * RETURN: Status - * - * DESCRIPTION: Write to the specified ACPI register - * - * NOTE: In accordance with the ACPI specification, this function automatically - * preserves the value of the following bits, meaning that these bits cannot be - * changed via this interface: - * - * PM1_CONTROL[0] = SCI_EN - * PM1_CONTROL[9] - * PM1_STATUS[11] - * - * ACPI References: - * 1) Hardware Ignored Bits: When software writes to a register with ignored - * bit fields, it preserves the ignored bit fields - * 2) SCI_EN: OSPM always preserves this bit position - * - ******************************************************************************/ - -acpi_status acpi_hw_register_write(u32 register_id, u32 value) -{ - acpi_status status; - u32 read_value; - - ACPI_FUNCTION_TRACE(hw_register_write); - - switch (register_id) { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - - /* Perform a read first to preserve certain bits (per ACPI spec) */ - - status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, - &read_value); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, - read_value); - - /* Now we can write the data */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm1a_event_block); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* PM1B is optional */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm1b_event_block); - break; - - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - - status = acpi_write(value, &acpi_gbl_xpm1a_enable); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* PM1B is optional */ - - status = acpi_write(value, &acpi_gbl_xpm1b_enable); - break; - - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - /* - * Perform a read first to preserve certain bits (per ACPI spec) - */ - status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, - &read_value); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, - read_value); - - /* Now we can write the data */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block); - if (ACPI_FAILURE(status)) { - goto exit; - } - - status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block); - break; - - case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block); - break; - - case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block); - break; - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); - break; - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block); - break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - /* SMI_CMD is currently always in IO space */ - - status = - acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); - break; - - default: - status = AE_BAD_PARAMETER; - break; - } - - exit: - return_ACPI_STATUS(status); -} diff --git a/trunk/drivers/acpi/battery.c b/trunk/drivers/acpi/battery.c index 65132f920459..1423b0c0cd2e 100644 --- a/trunk/drivers/acpi/battery.c +++ b/trunk/drivers/acpi/battery.c @@ -471,7 +471,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) static int acpi_battery_update(struct acpi_battery *battery) { - int result, old_present = acpi_battery_present(battery); + int result; result = acpi_battery_get_status(battery); if (result) return result; @@ -482,8 +482,7 @@ static int acpi_battery_update(struct acpi_battery *battery) return 0; } #endif - if (!battery->update_time || - old_present != acpi_battery_present(battery)) { + if (!battery->update_time) { result = acpi_battery_get_info(battery); if (result) return result; diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index 765fd1c56cd6..7edf6d913c13 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -688,6 +688,14 @@ void __init acpi_early_init(void) if (acpi_disabled) return; + /* + * ACPI CA initializes acpi_dbg_level to non-zero, which means + * we get debug output merely by turning on CONFIG_ACPI_DEBUG. + * Turn it off so we don't get output unless the user specifies + * acpi.debug_level. + */ + acpi_dbg_level = 0; + printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); /* enable workarounds, unless strict ACPI spec. compliance */ diff --git a/trunk/drivers/acpi/cm_sbs.c b/trunk/drivers/acpi/cm_sbs.c index 332fe4b21708..307963bd1043 100644 --- a/trunk/drivers/acpi/cm_sbs.c +++ b/trunk/drivers/acpi/cm_sbs.c @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include ACPI_MODULE_NAME("cm_sbs"); #define ACPI_AC_CLASS "ac_adapter" diff --git a/trunk/drivers/acpi/debug.c b/trunk/drivers/acpi/debug.c index 20223cbd0d1c..c48396892008 100644 --- a/trunk/drivers/acpi/debug.c +++ b/trunk/drivers/acpi/debug.c @@ -9,6 +9,7 @@ #include #include #include +#include #define _COMPONENT ACPI_SYSTEM_COMPONENT ACPI_MODULE_NAME("debug"); diff --git a/trunk/drivers/acpi/dispatcher/Makefile b/trunk/drivers/acpi/dispatcher/Makefile new file mode 100644 index 000000000000..eb7e602a83cd --- /dev/null +++ b/trunk/drivers/acpi/dispatcher/Makefile @@ -0,0 +1,9 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ + dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ + dsinit.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/dsfield.c b/trunk/drivers/acpi/dispatcher/dsfield.c similarity index 99% rename from trunk/drivers/acpi/acpica/dsfield.c rename to trunk/drivers/acpi/dispatcher/dsfield.c index 53e27bc5a734..f988a5e7d2b4 100644 --- a/trunk/drivers/acpi/acpica/dsfield.c +++ b/trunk/drivers/acpi/dispatcher/dsfield.c @@ -42,12 +42,11 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acparser.h" +#include +#include +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsfield") diff --git a/trunk/drivers/acpi/acpica/dsinit.c b/trunk/drivers/acpi/dispatcher/dsinit.c similarity index 98% rename from trunk/drivers/acpi/acpica/dsinit.c rename to trunk/drivers/acpi/dispatcher/dsinit.c index eb144b13d8fa..949f7c75029e 100644 --- a/trunk/drivers/acpi/acpica/dsinit.c +++ b/trunk/drivers/acpi/dispatcher/dsinit.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsinit") diff --git a/trunk/drivers/acpi/acpica/dsmethod.c b/trunk/drivers/acpi/dispatcher/dsmethod.c similarity index 98% rename from trunk/drivers/acpi/acpica/dsmethod.c rename to trunk/drivers/acpi/dispatcher/dsmethod.c index 14b8b8ed8023..279a5a60a0dd 100644 --- a/trunk/drivers/acpi/acpica/dsmethod.c +++ b/trunk/drivers/acpi/dispatcher/dsmethod.c @@ -42,14 +42,11 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#ifdef ACPI_DISASSEMBLER +#include +#include +#include +#include #include -#endif #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") @@ -415,9 +412,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { status = obj_desc->method.implementation(next_walk_state); - if (status == AE_OK) { - status = AE_CTRL_TERMINATE; - } } return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/acpica/dsmthdat.c b/trunk/drivers/acpi/dispatcher/dsmthdat.c similarity index 99% rename from trunk/drivers/acpi/acpica/dsmthdat.c rename to trunk/drivers/acpi/dispatcher/dsmthdat.c index da0f5468184c..d03f81bd1bcb 100644 --- a/trunk/drivers/acpi/acpica/dsmthdat.c +++ b/trunk/drivers/acpi/dispatcher/dsmthdat.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmthdat") diff --git a/trunk/drivers/acpi/acpica/dsobject.c b/trunk/drivers/acpi/dispatcher/dsobject.c similarity index 99% rename from trunk/drivers/acpi/acpica/dsobject.c rename to trunk/drivers/acpi/dispatcher/dsobject.c index 15c628e6aa00..4f08e599d07e 100644 --- a/trunk/drivers/acpi/acpica/dsobject.c +++ b/trunk/drivers/acpi/dispatcher/dsobject.c @@ -42,12 +42,11 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsobject") diff --git a/trunk/drivers/acpi/acpica/dsopcode.c b/trunk/drivers/acpi/dispatcher/dsopcode.c similarity index 96% rename from trunk/drivers/acpi/acpica/dsopcode.c rename to trunk/drivers/acpi/dispatcher/dsopcode.c index 0c3b4dd60e8a..69fae5905bb8 100644 --- a/trunk/drivers/acpi/acpica/dsopcode.c +++ b/trunk/drivers/acpi/dispatcher/dsopcode.c @@ -43,14 +43,13 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" -#include "actables.h" +#include +#include +#include +#include +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsopcode") @@ -1141,27 +1140,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, op->common.aml_opcode, walk_state)); switch (op->common.aml_opcode) { - case AML_WHILE_OP: - - /* - * If this is an additional iteration of a while loop, continue. - * There is no need to allocate a new control state. - */ - if (walk_state->control_state) { - if (walk_state->control_state->control.aml_predicate_start - == (walk_state->parser_state.aml - 1)) { - - /* Reset the state to start-of-loop */ - - walk_state->control_state->common.state = - ACPI_CONTROL_CONDITIONAL_EXECUTING; - break; - } - } - - /*lint -fallthrough */ - case AML_IF_OP: + case AML_WHILE_OP: /* * IF/WHILE: Create a new control state to manage these @@ -1263,36 +1243,13 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); - control_state = walk_state->control_state; - if (control_state->common.value) { + if (walk_state->control_state->common.value) { - /* Predicate was true, the body of the loop was just executed */ + /* Predicate was true, go back and evaluate it again! */ - /* - * This loop counter mechanism allows the interpreter to escape - * possibly infinite loops. This can occur in poorly written AML - * when the hardware does not respond within a while loop and the - * loop does not implement a timeout. - */ - control_state->control.loop_count++; - if (control_state->control.loop_count > - ACPI_MAX_LOOP_ITERATIONS) { - status = AE_AML_INFINITE_LOOP; - break; - } - - /* - * Go back and evaluate the predicate and maybe execute the loop - * another time - */ status = AE_CTRL_PENDING; - walk_state->aml_last_while = - control_state->control.aml_predicate_start; - break; } - /* Predicate was false, terminate this while loop */ - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); @@ -1300,6 +1257,9 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, control_state = acpi_ut_pop_generic_state(&walk_state->control_state); + + walk_state->aml_last_while = + control_state->control.aml_predicate_start; acpi_ut_delete_generic_state(control_state); break; diff --git a/trunk/drivers/acpi/acpica/dsutils.c b/trunk/drivers/acpi/dispatcher/dsutils.c similarity index 99% rename from trunk/drivers/acpi/acpica/dsutils.c rename to trunk/drivers/acpi/dispatcher/dsutils.c index dabc23a46176..b398982f0d8b 100644 --- a/trunk/drivers/acpi/acpica/dsutils.c +++ b/trunk/drivers/acpi/dispatcher/dsutils.c @@ -42,13 +42,12 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acdebug.h" +#include +#include +#include +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsutils") diff --git a/trunk/drivers/acpi/acpica/dswexec.c b/trunk/drivers/acpi/dispatcher/dswexec.c similarity index 99% rename from trunk/drivers/acpi/acpica/dswexec.c rename to trunk/drivers/acpi/dispatcher/dswexec.c index 350e6656bc89..396fe12078cd 100644 --- a/trunk/drivers/acpi/acpica/dswexec.c +++ b/trunk/drivers/acpi/dispatcher/dswexec.c @@ -43,13 +43,12 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acdebug.h" +#include +#include +#include +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dswexec") diff --git a/trunk/drivers/acpi/acpica/dswload.c b/trunk/drivers/acpi/dispatcher/dswload.c similarity index 99% rename from trunk/drivers/acpi/acpica/dswload.c rename to trunk/drivers/acpi/dispatcher/dswload.c index 3023ceaa8d54..dff7a3e445a8 100644 --- a/trunk/drivers/acpi/acpica/dswload.c +++ b/trunk/drivers/acpi/dispatcher/dswload.c @@ -42,13 +42,12 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" +#include +#include +#include +#include +#include +#include #ifdef ACPI_ASL_COMPILER #include diff --git a/trunk/drivers/acpi/acpica/dswscope.c b/trunk/drivers/acpi/dispatcher/dswscope.c similarity index 99% rename from trunk/drivers/acpi/acpica/dswscope.c rename to trunk/drivers/acpi/dispatcher/dswscope.c index 908645e72f03..9e6073265873 100644 --- a/trunk/drivers/acpi/acpica/dswscope.c +++ b/trunk/drivers/acpi/dispatcher/dswscope.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acdispat.h" +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dswscope") diff --git a/trunk/drivers/acpi/acpica/dswstate.c b/trunk/drivers/acpi/dispatcher/dswstate.c similarity index 99% rename from trunk/drivers/acpi/acpica/dswstate.c rename to trunk/drivers/acpi/dispatcher/dswstate.c index 40f92bf7dce5..b00d4af791aa 100644 --- a/trunk/drivers/acpi/acpica/dswstate.c +++ b/trunk/drivers/acpi/dispatcher/dswstate.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dswstate") diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 8dfcbb8aff73..30f3ef236ecb 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -42,6 +42,7 @@ #include #include #include +#include #define ACPI_EC_CLASS "embedded_controller" #define ACPI_EC_DEVICE_NAME "Embedded Controller" @@ -369,7 +370,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t, * Note: samsung nv5000 doesn't work with ec burst mode. * http://bugzilla.kernel.org/show_bug.cgi?id=4980 */ -static int acpi_ec_burst_enable(struct acpi_ec *ec) +int acpi_ec_burst_enable(struct acpi_ec *ec) { u8 d; struct transaction t = {.command = ACPI_EC_BURST_ENABLE, @@ -379,7 +380,7 @@ static int acpi_ec_burst_enable(struct acpi_ec *ec) return acpi_ec_transaction(ec, &t, 0); } -static int acpi_ec_burst_disable(struct acpi_ec *ec) +int acpi_ec_burst_disable(struct acpi_ec *ec) { struct transaction t = {.command = ACPI_EC_BURST_DISABLE, .wdata = NULL, .rdata = NULL, @@ -755,15 +756,10 @@ static acpi_status acpi_ec_register_query_methods(acpi_handle handle, u32 level, void *context, void **return_value) { - char node_name[5]; - struct acpi_buffer buffer = { sizeof(node_name), node_name }; + struct acpi_namespace_node *node = handle; struct acpi_ec *ec = context; int value = 0; - acpi_status status; - - status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); - - if (ACPI_SUCCESS(status) && sscanf(node_name, "_Q%x", &value) == 1) { + if (sscanf(node->name.ascii, "_Q%x", &value) == 1) { acpi_ec_add_query_handler(ec, value, handle, NULL, NULL); } return AE_OK; @@ -982,9 +978,9 @@ static const struct acpi_device_id ec_device_ids[] = { int __init acpi_ec_ecdt_probe(void) { + int ret; acpi_status status; struct acpi_table_ecdt *ecdt_ptr; - acpi_handle dummy; boot_ec = make_acpi_ec(); if (!boot_ec) @@ -1010,31 +1006,30 @@ int __init acpi_ec_ecdt_probe(void) boot_ec->gpe = ecdt_ptr->gpe; boot_ec->handle = ACPI_ROOT_OBJECT; acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); - /* Add some basic check against completely broken table */ - if (boot_ec->data_addr != boot_ec->command_addr) - goto install; - /* fall through */ + } else { + /* This workaround is needed only on some broken machines, + * which require early EC, but fail to provide ECDT */ + acpi_handle x; + printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); + status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, + boot_ec, NULL); + /* Check that acpi_get_devices actually find something */ + if (ACPI_FAILURE(status) || !boot_ec->handle) + goto error; + /* We really need to limit this workaround, the only ASUS, + * which needs it, has fake EC._INI method, so use it as flag. + * Keep boot_ec struct as it will be needed soon. + */ + if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) + return -ENODEV; } - /* This workaround is needed only on some broken machines, - * which require early EC, but fail to provide ECDT */ - printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); - status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, - boot_ec, NULL); - /* Check that acpi_get_devices actually find something */ - if (ACPI_FAILURE(status) || !boot_ec->handle) - goto error; - /* We really need to limit this workaround, the only ASUS, - * which needs it, has fake EC._INI method, so use it as flag. - * Keep boot_ec struct as it will be needed soon. - */ - if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy))) - return -ENODEV; -install: - if (!ec_install_handlers(boot_ec)) { + + ret = ec_install_handlers(boot_ec); + if (!ret) { first_ec = boot_ec; return 0; } -error: + error: kfree(boot_ec); boot_ec = NULL; return -ENODEV; diff --git a/trunk/drivers/acpi/events/Makefile b/trunk/drivers/acpi/events/Makefile new file mode 100644 index 000000000000..d29f2ee449cc --- /dev/null +++ b/trunk/drivers/acpi/events/Makefile @@ -0,0 +1,9 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := evevent.o evregion.o evsci.o evxfevnt.o \ + evmisc.o evrgnini.o evxface.o evxfregn.o \ + evgpe.o evgpeblk.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/evevent.c b/trunk/drivers/acpi/events/evevent.c similarity index 96% rename from trunk/drivers/acpi/acpica/evevent.c rename to trunk/drivers/acpi/events/evevent.c index 803edd9e3f6a..c56c5c6ea77b 100644 --- a/trunk/drivers/acpi/acpica/evevent.c +++ b/trunk/drivers/acpi/events/evevent.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acevents.h" +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evevent") @@ -73,8 +72,8 @@ acpi_status acpi_ev_initialize_events(void) /* * Initialize the Fixed and General Purpose Events. This is done prior to - * enabling SCIs to prevent interrupts from occurring before the handlers - * are installed. + * enabling SCIs to prevent interrupts from occurring before the handlers are + * installed. */ status = acpi_ev_fixed_event_initialize(); if (ACPI_FAILURE(status)) { @@ -193,8 +192,8 @@ static acpi_status acpi_ev_fixed_event_initialize(void) acpi_status status; /* - * Initialize the structure that keeps track of fixed event handlers and - * enable the fixed events. + * Initialize the structure that keeps track of fixed event handlers + * and enable the fixed events. */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { acpi_gbl_fixed_event_handlers[i].handler = NULL; @@ -238,7 +237,7 @@ u32 acpi_ev_fixed_event_detect(void) /* * Read the fixed feature status and enable registers, as all the cases - * depend on their values. Ignore errors here. + * depend on their values. Ignore errors here. */ (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status); (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable); @@ -292,8 +291,8 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) status_register_id, 1); /* - * Make sure we've got a handler. If not, report an error. The event is - * disabled to prevent further interrupts. + * Make sure we've got a handler. If not, report an error. + * The event is disabled to prevent further interrupts. */ if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. diff --git a/trunk/drivers/acpi/acpica/evgpe.c b/trunk/drivers/acpi/events/evgpe.c similarity index 94% rename from trunk/drivers/acpi/acpica/evgpe.c rename to trunk/drivers/acpi/events/evgpe.c index f345ced36477..f45c74fe745e 100644 --- a/trunk/drivers/acpi/acpica/evgpe.c +++ b/trunk/drivers/acpi/events/evgpe.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evgpe") @@ -126,7 +125,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, (1 << (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); - /* 1) Disable case. Simply clear all enable bits */ + /* 1) Disable case. Simply clear all enable bits */ if (type == ACPI_GPE_DISABLE) { ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, @@ -135,7 +134,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, return_ACPI_STATUS(AE_OK); } - /* 2) Enable case. Set/Clear the appropriate enable bits */ + /* 2) Enable case. Set/Clear the appropriate enable bits */ switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: @@ -296,7 +295,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) * * FUNCTION: acpi_ev_get_gpe_event_info * - * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 + * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 * gpe_number - Raw GPE number * * RETURN: A GPE event_info struct. NULL if not a valid GPE @@ -373,7 +372,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * - * DESCRIPTION: Detect if any GP events have occurred. This function is + * DESCRIPTION: Detect if any GP events have occurred. This function is * executed at interrupt level. * ******************************************************************************/ @@ -401,8 +400,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) /* * We need to obtain the GPE lock for both the data structs and registers - * Note: Not necessary to obtain the hardware lock, since the GPE - * registers are owned by the gpe_lock. + * Note: Not necessary to obtain the hardware lock, since the GPE registers + * are owned by the gpe_lock. */ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); @@ -411,8 +410,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* - * Read all of the 8-bit GPE status and enable registers in this GPE - * block, saving all of them. Find all currently active GP events. + * Read all of the 8-bit GPE status and enable registers + * in this GPE block, saving all of them. + * Find all currently active GP events. */ for (i = 0; i < gpe_block->register_count; i++) { @@ -423,8 +423,10 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) /* Read the Status Register */ status = - acpi_read(&status_reg, - &gpe_register_info->status_address); + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &status_reg, + &gpe_register_info-> + status_address); if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -432,8 +434,10 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) /* Read the Enable Register */ status = - acpi_read(&enable_reg, - &gpe_register_info->enable_address); + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &enable_reg, + &gpe_register_info-> + enable_address); if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -523,8 +527,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); /* - * Take a snapshot of the GPE info for this level - we copy the info to - * prevent a race condition with remove_handler/remove_block. + * Take a snapshot of the GPE info for this level - we copy the + * info to prevent a race condition with remove_handler/remove_block. */ ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, sizeof(struct acpi_gpe_event_info)); @@ -535,8 +539,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) } /* - * Must check for control method type dispatch one more time to avoid a - * race with ev_gpe_install_handler + * Must check for control method type dispatch one more + * time to avoid race with ev_gpe_install_handler */ if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { @@ -580,8 +584,8 @@ static void acpi_ev_asynch_enable_gpe(void *context) if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { /* - * GPE is level-triggered, we clear the GPE status bit after handling - * the event. + * GPE is level-triggered, we clear the GPE status bit after + * handling the event. */ status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { @@ -620,7 +624,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) acpi_os_gpe_count(gpe_number); /* - * If edge-triggered, clear the GPE status bit now. Note that + * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == @@ -646,8 +650,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) /* * Invoke the installed handler (at interrupt level) - * Ignore return status for now. - * TBD: leave GPE disabled on error? + * Ignore return status for now. TBD: leave GPE disabled on error? */ (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> dispatch. @@ -705,7 +708,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) gpe_number)); /* - * Disable the GPE. The GPE will remain disabled until the ACPICA + * Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or a handler is installed. */ status = acpi_ev_disable_gpe(gpe_event_info); diff --git a/trunk/drivers/acpi/acpica/evgpeblk.c b/trunk/drivers/acpi/events/evgpeblk.c similarity index 94% rename from trunk/drivers/acpi/acpica/evgpeblk.c rename to trunk/drivers/acpi/events/evgpeblk.c index 484cc0565d5b..73c058e2f5c2 100644 --- a/trunk/drivers/acpi/acpica/evgpeblk.c +++ b/trunk/drivers/acpi/events/evgpeblk.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evgpeblk") @@ -125,7 +124,6 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) * FUNCTION: acpi_ev_walk_gpe_list * * PARAMETERS: gpe_walk_callback - Routine called for each GPE block - * Context - Value passed to callback * * RETURN: Status * @@ -133,8 +131,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) * ******************************************************************************/ -acpi_status -acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context) +acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; @@ -157,13 +154,8 @@ acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context) /* One callback per GPE block */ - status = - gpe_walk_callback(gpe_xrupt_info, gpe_block, - context); + status = gpe_walk_callback(gpe_xrupt_info, gpe_block); if (ACPI_FAILURE(status)) { - if (status == AE_CTRL_END) { /* Callback abort */ - status = AE_OK; - } goto unlock_and_exit; } @@ -194,8 +186,7 @@ acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context) acpi_status acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, - void *context) + struct acpi_gpe_block_info *gpe_block) { struct acpi_gpe_event_info *gpe_event_info; u32 i; @@ -318,17 +309,17 @@ acpi_ev_save_method_info(acpi_handle obj_handle, (gpe_block->block_base_number + (gpe_block->register_count * 8)))) { /* - * Not valid for this GPE block, just ignore it. However, it may be - * valid for a different GPE block, since GPE0 and GPE1 methods both - * appear under \_GPE. + * Not valid for this GPE block, just ignore it + * However, it may be valid for a different GPE block, since GPE0 and GPE1 + * methods both appear under \_GPE. */ return_ACPI_STATUS(AE_OK); } /* - * Now we can add this information to the gpe_event_info block for use - * during dispatch of this GPE. Default type is RUNTIME, although this may - * change when the _PRW methods are executed later. + * Now we can add this information to the gpe_event_info block + * for use during dispatch of this GPE. Default type is RUNTIME, although + * this may change when the _PRW methods are executed later. */ gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; @@ -403,8 +394,8 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, gpe_block = gpe_info->gpe_block; /* - * The _PRW object must return a package, we are only interested in the - * first element + * The _PRW object must return a package, we are only interested + * in the first element */ obj_desc = pkg_desc->package.elements[0]; @@ -443,7 +434,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, /* * Is this GPE within this block? * - * TRUE if and only if these conditions are true: + * TRUE iff these conditions are true: * 1) The GPE devices match. * 2) The GPE index(number) is within the range of the Gpe Block * associated with the GPE device. @@ -466,7 +457,6 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, if (ACPI_FAILURE(status)) { goto cleanup; } - status = acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE); @@ -486,9 +476,9 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, * RETURN: A GPE interrupt block * * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt - * block per unique interrupt level used for GPEs. Should be - * called only when the GPE lists are semaphore locked and not - * subject to change. + * block per unique interrupt level used for GPEs. + * Should be called only when the GPE lists are semaphore locked + * and not subject to change. * ******************************************************************************/ @@ -618,9 +608,8 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) * * FUNCTION: acpi_ev_install_gpe_block * - * PARAMETERS: gpe_block - New GPE block - * interrupt_number - Xrupt to be associated with this - * GPE block + * PARAMETERS: gpe_block - New GPE block + * interrupt_number - Xrupt to be associated with this GPE block * * RETURN: Status * @@ -677,7 +666,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, * * FUNCTION: acpi_ev_delete_gpe_block * - * PARAMETERS: gpe_block - Existing GPE block + * PARAMETERS: gpe_block - Existing GPE block * * RETURN: Status * @@ -699,8 +688,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) /* Disable all GPEs in this block */ - status = - acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL); + status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); if (!gpe_block->previous && !gpe_block->next) { @@ -727,9 +715,6 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) acpi_os_release_lock(acpi_gbl_gpe_lock, flags); } - acpi_current_gpe_count -= - gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH; - /* Free the gpe_block */ ACPI_FREE(gpe_block->register_info); @@ -801,9 +786,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) /* * Initialize the GPE Register and Event structures. A goal of these - * tables is to hide the fact that there are two separate GPE register - * sets in a given GPE hardware block, the status registers occupy the - * first half, and the enable registers occupy the second half. + * tables is to hide the fact that there are two separate GPE register sets + * in a given GPE hardware block, the status registers occupy the first half, + * and the enable registers occupy the second half. */ this_register = gpe_register_info; this_event = gpe_event_info; @@ -831,8 +816,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ACPI_GPE_REGISTER_WIDTH; this_register->enable_address.bit_width = ACPI_GPE_REGISTER_WIDTH; - this_register->status_address.bit_offset = 0; - this_register->enable_address.bit_offset = 0; + this_register->status_address.bit_offset = + ACPI_GPE_REGISTER_WIDTH; + this_register->enable_address.bit_offset = + ACPI_GPE_REGISTER_WIDTH; /* Init the event_info for each GPE within this register */ @@ -845,14 +832,18 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) /* Disable all GPEs within this register */ - status = acpi_write(0x00, &this_register->enable_address); + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, + &this_register-> + enable_address); if (ACPI_FAILURE(status)) { goto error_exit; } /* Clear any pending GPE events within this register */ - status = acpi_write(0xFF, &this_register->status_address); + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, + &this_register-> + status_address); if (ACPI_FAILURE(status)) { goto error_exit; } @@ -965,9 +956,6 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, gpe_device->name.ascii, gpe_block->register_count, interrupt_number)); - /* Update global count of currently available GPEs */ - - acpi_current_gpe_count += register_count * ACPI_GPE_REGISTER_WIDTH; return_ACPI_STATUS(AE_OK); } @@ -1067,7 +1055,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, /* Enable all valid runtime GPEs found above */ - status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL); + status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", gpe_block)); diff --git a/trunk/drivers/acpi/acpica/evmisc.c b/trunk/drivers/acpi/events/evmisc.c similarity index 93% rename from trunk/drivers/acpi/acpica/evmisc.c rename to trunk/drivers/acpi/events/evmisc.c index 5f893057bcc6..1d5670be729a 100644 --- a/trunk/drivers/acpi/acpica/evmisc.c +++ b/trunk/drivers/acpi/events/evmisc.c @@ -42,15 +42,18 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evmisc") +/* Pointer to FACS needed for the Global Lock */ +static struct acpi_table_facs *facs = NULL; + /* Local prototypes */ + static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); static u32 acpi_ev_global_lock_handler(void *context); @@ -149,9 +152,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, break; default: - /* All other types are not supported */ - return (AE_TYPE); } } @@ -192,8 +193,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, acpi_ut_delete_generic_state(notify_info); } } else { - /* There is no notify handler (per-device or system) for this device */ - + /* + * There is no notify handler (per-device or system) for this device. + */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No notify handler for Notify (%4.4s, %X) node %p\n", acpi_ut_get_node_name(node), notify_value, @@ -227,8 +229,9 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) ACPI_FUNCTION_ENTRY(); /* - * We will invoke a global notify handler if installed. This is done - * _before_ we invoke the per-device handler attached to the device. + * We will invoke a global notify handler if installed. + * This is done _before_ we invoke the per-device handler attached + * to the device. */ if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { @@ -296,7 +299,7 @@ static u32 acpi_ev_global_lock_handler(void *context) * If we don't get it now, it will be marked pending and we will * take another interrupt when it becomes free. */ - ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired); + ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); if (acquired) { /* Got the lock, now wake all threads waiting for it */ @@ -333,27 +336,34 @@ acpi_status acpi_ev_init_global_lock_handler(void) ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); - /* Attempt installation of the global lock handler */ + status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + acpi_gbl_global_lock_present = TRUE; status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, acpi_ev_global_lock_handler, NULL); /* - * If the global lock does not exist on this platform, the attempt to - * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). - * Map to AE_OK, but mark global lock as not present. Any attempt to - * actually use the global lock will be flagged with an error. + * If the global lock does not exist on this platform, the attempt + * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick) + * Map to AE_OK, but mark global lock as not present. + * Any attempt to actually use the global lock will be flagged + * with an error. */ if (status == AE_NO_HARDWARE_RESPONSE) { ACPI_ERROR((AE_INFO, "No response from Global Lock hardware, disabling lock")); acpi_gbl_global_lock_present = FALSE; - return_ACPI_STATUS(AE_OK); + status = AE_OK; } - acpi_gbl_global_lock_present = TRUE; return_ACPI_STATUS(status); } @@ -452,8 +462,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) } /* - * Make sure that a global lock actually exists. If not, just treat the - * lock as a standard mutex. + * Make sure that a global lock actually exists. If not, just treat + * the lock as a standard mutex. */ if (!acpi_gbl_global_lock_present) { acpi_gbl_global_lock_acquired = TRUE; @@ -462,7 +472,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) /* Attempt to acquire the actual hardware lock */ - ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired); + ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); if (acquired) { /* We got the lock */ @@ -526,7 +536,7 @@ acpi_status acpi_ev_release_global_lock(void) /* Allow any thread to release the lock */ - ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); + ACPI_RELEASE_GLOBAL_LOCK(facs, pending); /* * If the pending bit was set, we must write GBL_RLS to the control @@ -572,8 +582,8 @@ void acpi_ev_terminate(void) if (acpi_gbl_events_initialized) { /* - * Disable all event-related functionality. In all cases, on error, - * print a message but obviously we don't abort. + * Disable all event-related functionality. + * In all cases, on error, print a message but obviously we don't abort. */ /* Disable all fixed events */ @@ -589,7 +599,7 @@ void acpi_ev_terminate(void) /* Disable all GPEs in all GPE blocks */ - status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); + status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); /* Remove SCI handler */ @@ -607,7 +617,7 @@ void acpi_ev_terminate(void) /* Deallocate all handler objects installed within GPE info structs */ - status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL); + status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers); /* Return to original mode if necessary */ diff --git a/trunk/drivers/acpi/acpica/evregion.c b/trunk/drivers/acpi/events/evregion.c similarity index 91% rename from trunk/drivers/acpi/acpica/evregion.c rename to trunk/drivers/acpi/events/evregion.c index 665c0887ab4d..236fbd1ca438 100644 --- a/trunk/drivers/acpi/acpica/evregion.c +++ b/trunk/drivers/acpi/events/evregion.c @@ -42,15 +42,22 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evregion") +#define ACPI_NUM_DEFAULT_SPACES 4 +static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { + ACPI_ADR_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_DATA_TABLE +}; /* Local prototypes */ + static acpi_status acpi_ev_reg_run(acpi_handle obj_handle, u32 level, void *context, void **return_value); @@ -59,17 +66,6 @@ static acpi_status acpi_ev_install_handler(acpi_handle obj_handle, u32 level, void *context, void **return_value); -/* These are the address spaces that will get default handlers */ - -#define ACPI_NUM_DEFAULT_SPACES 4 - -static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_DATA_TABLE -}; - /******************************************************************************* * * FUNCTION: acpi_ev_install_region_handlers @@ -95,19 +91,18 @@ acpi_status acpi_ev_install_region_handlers(void) } /* - * All address spaces (PCI Config, EC, SMBus) are scope dependent and - * registration must occur for a specific device. + * All address spaces (PCI Config, EC, SMBus) are scope dependent + * and registration must occur for a specific device. * - * In the case of the system memory and IO address spaces there is - * currently no device associated with the address space. For these we - * use the root. + * In the case of the system memory and IO address spaces there is currently + * no device associated with the address space. For these we use the root. * - * We install the default PCI config space handler at the root so that - * this space is immediately available even though the we have not - * enumerated all the PCI Root Buses yet. This is to conform to the ACPI - * specification which states that the PCI config space must be always - * available -- even though we are nowhere near ready to find the PCI root - * buses at this point. + * We install the default PCI config space handler at the root so + * that this space is immediately available even though the we have + * not enumerated all the PCI Root Buses yet. This is to conform + * to the ACPI specification which states that the PCI config + * space must be always available -- even though we are nowhere + * near ready to find the PCI root buses at this point. * * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler * has already been installed (via acpi_install_address_space_handler). @@ -165,11 +160,12 @@ acpi_status acpi_ev_initialize_op_regions(void) return_ACPI_STATUS(status); } - /* Run the _REG methods for op_regions in each default address space */ - + /* + * Run the _REG methods for op_regions in each default address space + */ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { - /* - * TBD: Make sure handler is the DEFAULT handler, otherwise + + /* TBD: Make sure handler is the DEFAULT handler, otherwise * _REG will have already been run. */ status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, @@ -322,13 +318,13 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, } /* - * It may be the case that the region has never been initialized. + * It may be the case that the region has never been initialized * Some types of regions require special init code */ if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { - - /* This region has not been initialized yet, do it */ - + /* + * This region has not been initialized yet, do it + */ region_setup = handler_desc->address_space.setup; if (!region_setup) { @@ -343,9 +339,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, } /* - * We must exit the interpreter because the region setup will - * potentially execute control methods (for example, the _REG method - * for this region) + * We must exit the interpreter because the region + * setup will potentially execute control methods + * (e.g., _REG method for this region) */ acpi_ex_exit_interpreter(); @@ -368,8 +364,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, return_ACPI_STATUS(status); } - /* Region initialization may have been completed by region_setup */ - + /* + * Region initialization may have been completed by region_setup + */ if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; @@ -524,8 +521,8 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, } /* - * If the region has been activated, call the setup handler with - * the deactivate notification + * If the region has been activated, call the setup handler + * with the deactivate notification */ if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { region_setup = handler_obj->address_space.setup; @@ -671,8 +668,8 @@ acpi_ev_install_handler(acpi_handle obj_handle, } /* - * We only care about regions and objects that are allowed to have - * address space handlers + * We only care about regions.and objects + * that are allowed to have address space handlers */ if ((node->type != ACPI_TYPE_DEVICE) && (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { @@ -713,9 +710,9 @@ acpi_ev_install_handler(acpi_handle obj_handle, /* * Since the object we found it on was a device, then it * means that someone has already installed a handler for - * the branch of the namespace from this device on. Just + * the branch of the namespace from this device on. Just * bail out telling the walk routine to not traverse this - * branch. This preserves the scoping rule for handlers. + * branch. This preserves the scoping rule for handlers. */ return (AE_CTRL_DEPTH); } @@ -726,8 +723,9 @@ acpi_ev_install_handler(acpi_handle obj_handle, } /* - * As long as the device didn't have a handler for this space we - * don't care about it. We just ignore it and proceed. + * As long as the device didn't have a handler for this + * space we don't care about it. We just ignore it and + * proceed. */ return (AE_OK); } @@ -735,14 +733,16 @@ acpi_ev_install_handler(acpi_handle obj_handle, /* Object is a Region */ if (obj_desc->region.space_id != handler_obj->address_space.space_id) { - - /* This region is for a different address space, just ignore it */ - + /* + * This region is for a different address space + * -- just ignore it + */ return (AE_OK); } /* - * Now we have a region and it is for the handler's address space type. + * Now we have a region and it is for the handler's address + * space type. * * First disconnect region for any previous handler (if any) */ @@ -786,8 +786,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, ACPI_FUNCTION_TRACE(ev_install_space_handler); /* - * This registration is valid for only the types below and the root. This - * is where the default handlers get placed. + * This registration is valid for only the types below + * and the root. This is where the default handlers + * get placed. */ if ((node->type != ACPI_TYPE_DEVICE) && (node->type != ACPI_TYPE_PROCESSOR) && @@ -847,8 +848,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* - * The attached device object already exists. Make sure the handler - * is not already installed. + * The attached device object already exists. + * Make sure the handler is not already installed. */ handler_obj = obj_desc->device.handler; @@ -863,8 +864,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, handler) { /* * It is (relatively) OK to attempt to install the SAME - * handler twice. This can easily happen with the - * PCI_Config space. + * handler twice. This can easily happen + * with PCI_Config space. */ status = AE_SAME_HANDLER; goto unlock_and_exit; @@ -924,8 +925,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, /* * Install the handler * - * At this point there is no existing handler. Just allocate the object - * for the handler and link it into the list. + * At this point there is no existing handler. + * Just allocate the object for the handler and link it + * into the list. */ handler_obj = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); @@ -998,10 +1000,11 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, ACPI_FUNCTION_TRACE(ev_execute_reg_methods); /* - * Run all _REG methods for all Operation Regions for this space ID. This - * is a separate walk in order to handle any interdependencies between - * regions and _REG methods. (i.e. handlers must be installed for all - * regions of this Space ID before we can run any _REG methods) + * Run all _REG methods for all Operation Regions for this + * space ID. This is a separate walk in order to handle any + * interdependencies between regions and _REG methods. (i.e. handlers + * must be installed for all regions of this Space ID before we + * can run any _REG methods) */ status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, @@ -1039,8 +1042,8 @@ acpi_ev_reg_run(acpi_handle obj_handle, } /* - * We only care about regions.and objects that are allowed to have address - * space handlers + * We only care about regions.and objects + * that are allowed to have address space handlers */ if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { return (AE_OK); @@ -1059,9 +1062,10 @@ acpi_ev_reg_run(acpi_handle obj_handle, /* Object is a Region */ if (obj_desc->region.space_id != space_id) { - - /* This region is for a different address space, just ignore it */ - + /* + * This region is for a different address space + * -- just ignore it + */ return (AE_OK); } diff --git a/trunk/drivers/acpi/acpica/evrgnini.c b/trunk/drivers/acpi/events/evrgnini.c similarity index 95% rename from trunk/drivers/acpi/acpica/evrgnini.c rename to trunk/drivers/acpi/events/evrgnini.c index f3f1fb45c3dc..6b94b38df07d 100644 --- a/trunk/drivers/acpi/acpica/evrgnini.c +++ b/trunk/drivers/acpi/events/evrgnini.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evrgnini") @@ -234,9 +233,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, if (ACPI_FAILURE(status)) { if (status == AE_SAME_HANDLER) { /* - * It is OK if the handler is already installed on the - * root bridge. Still need to return a context object - * for the new PCI_Config operation region, however. + * It is OK if the handler is already installed on the root + * bridge. Still need to return a context object for the + * new PCI_Config operation region, however. */ status = AE_OK; } else { @@ -273,8 +272,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, } /* - * For PCI_Config space access, we need the segment, bus, device and - * function numbers. Acquire them here. + * For PCI_Config space access, we need the segment, bus, + * device and function numbers. Acquire them here. * * Find the parent device object. (This allows the operation region to be * within a subscope under the device, such as a control method.) @@ -290,16 +289,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, } /* - * Get the PCI device and function numbers from the _ADR object contained - * in the parent's scope. + * Get the PCI device and function numbers from the _ADR object + * contained in the parent's scope. */ status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node, &pci_value); /* - * The default is zero, and since the allocation above zeroed the data, - * just do nothing on failure. + * The default is zero, and since the allocation above zeroed + * the data, just do nothing on failure. */ if (ACPI_SUCCESS(status)) { pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value)); @@ -383,8 +382,9 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) struct acpi_compatible_id_list *cid; u32 i; - /* Get the _HID and check for a PCI Root Bridge */ - + /* + * Get the _HID and check for a PCI Root Bridge + */ status = acpi_ut_execute_HID(node, &hid); if (ACPI_FAILURE(status)) { return (FALSE); @@ -394,8 +394,10 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) return (TRUE); } - /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */ - + /* + * The _HID did not match. + * Get the _CID and check for a PCI Root Bridge + */ status = acpi_ut_execute_CID(node, &cid); if (ACPI_FAILURE(status)) { return (FALSE); @@ -514,9 +516,9 @@ acpi_ev_default_region_setup(acpi_handle handle, * Get the appropriate address space handler for a newly * created region. * - * This also performs address space specific initialization. For + * This also performs address space specific initialization. For * example, PCI regions must have an _ADR object that contains - * a PCI address in the scope of the definition. This address is + * a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * * MUTEX: Interpreter should be unlocked, because we may run the _REG @@ -570,7 +572,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, if (ACPI_SUCCESS(status)) { /* * The _REG method is optional and there can be only one per region - * definition. This will be executed when the handler is attached + * definition. This will be executed when the handler is attached * or removed */ region_obj2->extra.method_REG = method_node; @@ -668,8 +670,10 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, } } - /* This node does not have the handler we need; Pop up one level */ - + /* + * This node does not have the handler we need; + * Pop up one level + */ node = acpi_ns_get_parent_node(node); } diff --git a/trunk/drivers/acpi/acpica/evsci.c b/trunk/drivers/acpi/events/evsci.c similarity index 95% rename from trunk/drivers/acpi/acpica/evsci.c rename to trunk/drivers/acpi/events/evsci.c index 567b356c85af..2a8b77877610 100644 --- a/trunk/drivers/acpi/acpica/evsci.c +++ b/trunk/drivers/acpi/events/evsci.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acevents.h" +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evsci") @@ -116,8 +115,10 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) * if this interrupt handler is installed, ACPI is enabled. */ - /* GPEs: Check for and dispatch any GPEs that have occurred */ - + /* + * GPEs: + * Check for and dispatch any GPEs that have occurred + */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); return_UINT32(interrupt_handled); @@ -157,11 +158,11 @@ u32 acpi_ev_install_sci_handler(void) * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not * installed to begin with * - * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be + * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be * taken. * * Note: It doesn't seem important to disable all events or set the event - * enable registers to their original values. The OS should disable + * enable registers to their original values. The OS should disable * the SCI interrupt level when the handler is removed, so no more * events will come in. * diff --git a/trunk/drivers/acpi/acpica/evxface.c b/trunk/drivers/acpi/events/evxface.c similarity index 99% rename from trunk/drivers/acpi/acpica/evxface.c rename to trunk/drivers/acpi/events/evxface.c index 3aca9010a11e..94a6efe020be 100644 --- a/trunk/drivers/acpi/acpica/evxface.c +++ b/trunk/drivers/acpi/events/evxface.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" -#include "acinterp.h" +#include +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evxface") @@ -268,7 +267,7 @@ acpi_install_notify_handler(acpi_handle device, /* * Root Object: * Registering a notify handler on the root object indicates that the - * caller wishes to receive notifications for all objects. Note that + * caller wishes to receive notifications for all objects. Note that * only one global handler can be regsitered (per notify type). */ if (device == ACPI_ROOT_OBJECT) { diff --git a/trunk/drivers/acpi/acpica/evxfevnt.c b/trunk/drivers/acpi/events/evxfevnt.c similarity index 81% rename from trunk/drivers/acpi/acpica/evxfevnt.c rename to trunk/drivers/acpi/events/evxfevnt.c index 35485e4b60a6..41554f736b68 100644 --- a/trunk/drivers/acpi/acpica/evxfevnt.c +++ b/trunk/drivers/acpi/events/evxfevnt.c @@ -42,19 +42,13 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evxfevnt") -/* Local prototypes */ -acpi_status -acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context); - /******************************************************************************* * * FUNCTION: acpi_enable @@ -66,7 +60,6 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, * DESCRIPTION: Transfers the system into ACPI mode. * ******************************************************************************/ - acpi_status acpi_enable(void) { acpi_status status = AE_OK; @@ -168,8 +161,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) } /* - * Enable the requested fixed event (by writing a one to the enable - * register bit) + * Enable the requested fixed event (by writing a one to the + * enable register bit) */ status = acpi_set_register(acpi_gbl_fixed_event_info[event]. @@ -350,8 +343,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags) } /* - * Disable the requested fixed event (by writing a zero to the enable - * register bit) + * Disable the requested fixed event (by writing a zero to the + * enable register bit) */ status = acpi_set_register(acpi_gbl_fixed_event_info[event]. @@ -403,8 +396,8 @@ acpi_status acpi_clear_event(u32 event) } /* - * Clear the requested fixed event (By writing a one to the status - * register bit) + * Clear the requested fixed event (By writing a one to the + * status register bit) */ status = acpi_set_register(acpi_gbl_fixed_event_info[event]. @@ -724,148 +717,3 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) } ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) - -/******************************************************************************* - * - * FUNCTION: acpi_get_gpe_device - * - * PARAMETERS: Index - System GPE index (0-current_gpe_count) - * gpe_device - Where the parent GPE Device is returned - * - * RETURN: Status - * - * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL - * gpe device indicates that the gpe number is contained in one of - * the FADT-defined gpe blocks. Otherwise, the GPE block device. - * - ******************************************************************************/ -acpi_status -acpi_get_gpe_device(u32 index, acpi_handle *gpe_device) -{ - struct acpi_gpe_device_info info; - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_get_gpe_device); - - if (!gpe_device) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - if (index >= acpi_current_gpe_count) { - return_ACPI_STATUS(AE_NOT_EXIST); - } - - /* Setup and walk the GPE list */ - - info.index = index; - info.status = AE_NOT_EXIST; - info.gpe_device = NULL; - info.next_block_base_index = 0; - - status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - *gpe_device = info.gpe_device; - return_ACPI_STATUS(info.status); -} - -ACPI_EXPORT_SYMBOL(acpi_get_gpe_device) - -/******************************************************************************* - * - * FUNCTION: acpi_ev_get_gpe_device - * - * PARAMETERS: GPE_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE - * block device. NULL if the GPE is one of the FADT-defined GPEs. - * - ******************************************************************************/ -acpi_status -acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context) -{ - struct acpi_gpe_device_info *info = context; - - /* Increment Index by the number of GPEs in this block */ - - info->next_block_base_index += - (gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH); - - if (info->index < info->next_block_base_index) { - /* - * The GPE index is within this block, get the node. Leave the node - * NULL for the FADT-defined GPEs - */ - if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) { - info->gpe_device = gpe_block->node; - } - - info->status = AE_OK; - return (AE_CTRL_END); - } - - return (AE_OK); -} - -/****************************************************************************** - * - * FUNCTION: acpi_disable_all_gpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Disable and clear all GPEs in all GPE blocks - * - ******************************************************************************/ - -acpi_status acpi_disable_all_gpes(void) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_disable_all_gpes); - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_hw_disable_all_gpes(); - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - - return_ACPI_STATUS(status); -} - -/****************************************************************************** - * - * FUNCTION: acpi_enable_all_runtime_gpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks - * - ******************************************************************************/ - -acpi_status acpi_enable_all_runtime_gpes(void) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_enable_all_runtime_gpes); - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_hw_enable_all_runtime_gpes(); - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - - return_ACPI_STATUS(status); -} diff --git a/trunk/drivers/acpi/acpica/evxfregn.c b/trunk/drivers/acpi/events/evxfregn.c similarity index 99% rename from trunk/drivers/acpi/acpica/evxfregn.c rename to trunk/drivers/acpi/events/evxfregn.c index 479e7a3721be..e8750807e57d 100644 --- a/trunk/drivers/acpi/acpica/evxfregn.c +++ b/trunk/drivers/acpi/events/evxfregn.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" +#include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evxfregn") diff --git a/trunk/drivers/acpi/executer/Makefile b/trunk/drivers/acpi/executer/Makefile new file mode 100644 index 000000000000..e09998aa012f --- /dev/null +++ b/trunk/drivers/acpi/executer/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ + exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ + excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ + exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/exconfig.c b/trunk/drivers/acpi/executer/exconfig.c similarity index 99% rename from trunk/drivers/acpi/acpica/exconfig.c rename to trunk/drivers/acpi/executer/exconfig.c index 932bbc26aa04..74da6fa52ef1 100644 --- a/trunk/drivers/acpi/acpica/exconfig.c +++ b/trunk/drivers/acpi/executer/exconfig.c @@ -42,11 +42,10 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "actables.h" -#include "acdispat.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exconfig") diff --git a/trunk/drivers/acpi/acpica/exconvrt.c b/trunk/drivers/acpi/executer/exconvrt.c similarity index 99% rename from trunk/drivers/acpi/acpica/exconvrt.c rename to trunk/drivers/acpi/executer/exconvrt.c index 0be10188316e..1d1f35adddde 100644 --- a/trunk/drivers/acpi/acpica/exconvrt.c +++ b/trunk/drivers/acpi/executer/exconvrt.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exconvrt") diff --git a/trunk/drivers/acpi/acpica/excreate.c b/trunk/drivers/acpi/executer/excreate.c similarity index 99% rename from trunk/drivers/acpi/acpica/excreate.c rename to trunk/drivers/acpi/executer/excreate.c index a57ad2564ab0..ad09696d5069 100644 --- a/trunk/drivers/acpi/acpica/excreate.c +++ b/trunk/drivers/acpi/executer/excreate.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("excreate") diff --git a/trunk/drivers/acpi/acpica/exdump.c b/trunk/drivers/acpi/executer/exdump.c similarity index 99% rename from trunk/drivers/acpi/acpica/exdump.c rename to trunk/drivers/acpi/executer/exdump.c index aa313574b0df..d087a7d28aa5 100644 --- a/trunk/drivers/acpi/acpica/exdump.c +++ b/trunk/drivers/acpi/executer/exdump.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exdump") diff --git a/trunk/drivers/acpi/acpica/exfield.c b/trunk/drivers/acpi/executer/exfield.c similarity index 99% rename from trunk/drivers/acpi/acpica/exfield.c rename to trunk/drivers/acpi/executer/exfield.c index a352d0233857..3e440d84226a 100644 --- a/trunk/drivers/acpi/acpica/exfield.c +++ b/trunk/drivers/acpi/executer/exfield.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exfield") diff --git a/trunk/drivers/acpi/acpica/exfldio.c b/trunk/drivers/acpi/executer/exfldio.c similarity index 98% rename from trunk/drivers/acpi/acpica/exfldio.c rename to trunk/drivers/acpi/executer/exfldio.c index ef58ac4e687b..9ff9d1f4615d 100644 --- a/trunk/drivers/acpi/acpica/exfldio.c +++ b/trunk/drivers/acpi/executer/exfldio.c @@ -42,11 +42,10 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acevents.h" -#include "acdispat.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exfldio") @@ -499,13 +498,14 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, + "I/O to Data Register: ValuePtr %p\n", + value)); + if (read_write == ACPI_READ) { /* Read the datum from the data_register */ - ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Read from Data Register\n")); - status = acpi_ex_extract_from_field(obj_desc->index_field. data_obj, value, @@ -513,10 +513,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, } else { /* Write the datum to the data_register */ - ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Write to Data Register: Value %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(*value))); - status = acpi_ex_insert_into_field(obj_desc->index_field. data_obj, value, diff --git a/trunk/drivers/acpi/acpica/exmisc.c b/trunk/drivers/acpi/executer/exmisc.c similarity index 99% rename from trunk/drivers/acpi/acpica/exmisc.c rename to trunk/drivers/acpi/executer/exmisc.c index 6b0747ac683b..efb191340059 100644 --- a/trunk/drivers/acpi/acpica/exmisc.c +++ b/trunk/drivers/acpi/executer/exmisc.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "amlresrc.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exmisc") diff --git a/trunk/drivers/acpi/acpica/exmutex.c b/trunk/drivers/acpi/executer/exmutex.c similarity index 99% rename from trunk/drivers/acpi/acpica/exmutex.c rename to trunk/drivers/acpi/executer/exmutex.c index d301c1f363ef..a8bf3d713e28 100644 --- a/trunk/drivers/acpi/acpica/exmutex.c +++ b/trunk/drivers/acpi/executer/exmutex.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "acevents.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exmutex") diff --git a/trunk/drivers/acpi/acpica/exnames.c b/trunk/drivers/acpi/executer/exnames.c similarity index 99% rename from trunk/drivers/acpi/acpica/exnames.c rename to trunk/drivers/acpi/executer/exnames.c index ffdae122d94a..817e67be3697 100644 --- a/trunk/drivers/acpi/acpica/exnames.c +++ b/trunk/drivers/acpi/executer/exnames.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exnames") diff --git a/trunk/drivers/acpi/acpica/exoparg1.c b/trunk/drivers/acpi/executer/exoparg1.c similarity index 99% rename from trunk/drivers/acpi/acpica/exoparg1.c rename to trunk/drivers/acpi/executer/exoparg1.c index b530480cc7d5..f622f9eac8a1 100644 --- a/trunk/drivers/acpi/acpica/exoparg1.c +++ b/trunk/drivers/acpi/executer/exoparg1.c @@ -43,12 +43,11 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exoparg1") diff --git a/trunk/drivers/acpi/acpica/exoparg2.c b/trunk/drivers/acpi/executer/exoparg2.c similarity index 99% rename from trunk/drivers/acpi/acpica/exoparg2.c rename to trunk/drivers/acpi/executer/exoparg2.c index 0b4f513ca885..368def5dffce 100644 --- a/trunk/drivers/acpi/acpica/exoparg2.c +++ b/trunk/drivers/acpi/executer/exoparg2.c @@ -42,11 +42,10 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acinterp.h" -#include "acevents.h" -#include "amlcode.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exoparg2") diff --git a/trunk/drivers/acpi/acpica/exoparg3.c b/trunk/drivers/acpi/executer/exoparg3.c similarity index 98% rename from trunk/drivers/acpi/acpica/exoparg3.c rename to trunk/drivers/acpi/executer/exoparg3.c index c6520bbf882b..9cb4197681af 100644 --- a/trunk/drivers/acpi/acpica/exoparg3.c +++ b/trunk/drivers/acpi/executer/exoparg3.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "acparser.h" -#include "amlcode.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exoparg3") diff --git a/trunk/drivers/acpi/acpica/exoparg6.c b/trunk/drivers/acpi/executer/exoparg6.c similarity index 99% rename from trunk/drivers/acpi/acpica/exoparg6.c rename to trunk/drivers/acpi/executer/exoparg6.c index ae43f7670a6c..67d48737af53 100644 --- a/trunk/drivers/acpi/acpica/exoparg6.c +++ b/trunk/drivers/acpi/executer/exoparg6.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "acparser.h" -#include "amlcode.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exoparg6") diff --git a/trunk/drivers/acpi/acpica/exprep.c b/trunk/drivers/acpi/executer/exprep.c similarity index 99% rename from trunk/drivers/acpi/acpica/exprep.c rename to trunk/drivers/acpi/executer/exprep.c index 33c66eb3ae39..5d438c32989d 100644 --- a/trunk/drivers/acpi/acpica/exprep.c +++ b/trunk/drivers/acpi/executer/exprep.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exprep") diff --git a/trunk/drivers/acpi/acpica/exregion.c b/trunk/drivers/acpi/executer/exregion.c similarity index 99% rename from trunk/drivers/acpi/acpica/exregion.c rename to trunk/drivers/acpi/executer/exregion.c index 76ec8ff903b8..7a41c409ae4d 100644 --- a/trunk/drivers/acpi/acpica/exregion.c +++ b/trunk/drivers/acpi/executer/exregion.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acinterp.h" +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exregion") diff --git a/trunk/drivers/acpi/acpica/exresnte.c b/trunk/drivers/acpi/executer/exresnte.c similarity index 98% rename from trunk/drivers/acpi/acpica/exresnte.c rename to trunk/drivers/acpi/executer/exresnte.c index a063a74006f6..423ad3635f3d 100644 --- a/trunk/drivers/acpi/acpica/exresnte.c +++ b/trunk/drivers/acpi/executer/exresnte.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exresnte") diff --git a/trunk/drivers/acpi/acpica/exresolv.c b/trunk/drivers/acpi/executer/exresolv.c similarity index 99% rename from trunk/drivers/acpi/acpica/exresolv.c rename to trunk/drivers/acpi/executer/exresolv.c index 3673d2b2c4ac..89571b92a522 100644 --- a/trunk/drivers/acpi/acpica/exresolv.c +++ b/trunk/drivers/acpi/executer/exresolv.c @@ -43,11 +43,10 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exresolv") diff --git a/trunk/drivers/acpi/acpica/exresop.c b/trunk/drivers/acpi/executer/exresop.c similarity index 99% rename from trunk/drivers/acpi/acpica/exresop.c rename to trunk/drivers/acpi/executer/exresop.c index 3c3802764bfb..0bb82593da72 100644 --- a/trunk/drivers/acpi/acpica/exresop.c +++ b/trunk/drivers/acpi/executer/exresop.c @@ -43,11 +43,10 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exresop") diff --git a/trunk/drivers/acpi/acpica/exstore.c b/trunk/drivers/acpi/executer/exstore.c similarity index 99% rename from trunk/drivers/acpi/acpica/exstore.c rename to trunk/drivers/acpi/executer/exstore.c index 7c6d7e53e41e..3318df4cbd98 100644 --- a/trunk/drivers/acpi/acpica/exstore.c +++ b/trunk/drivers/acpi/executer/exstore.c @@ -43,11 +43,10 @@ */ #include -#include "accommon.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exstore") diff --git a/trunk/drivers/acpi/acpica/exstoren.c b/trunk/drivers/acpi/executer/exstoren.c similarity index 99% rename from trunk/drivers/acpi/acpica/exstoren.c rename to trunk/drivers/acpi/executer/exstoren.c index 145d15305f70..eef61a00803e 100644 --- a/trunk/drivers/acpi/acpica/exstoren.c +++ b/trunk/drivers/acpi/executer/exstoren.c @@ -44,9 +44,8 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exstoren") diff --git a/trunk/drivers/acpi/acpica/exstorob.c b/trunk/drivers/acpi/executer/exstorob.c similarity index 99% rename from trunk/drivers/acpi/acpica/exstorob.c rename to trunk/drivers/acpi/executer/exstorob.c index 67340cc70142..9a75ff09fb0c 100644 --- a/trunk/drivers/acpi/acpica/exstorob.c +++ b/trunk/drivers/acpi/executer/exstorob.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acinterp.h" +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exstorob") diff --git a/trunk/drivers/acpi/acpica/exsystem.c b/trunk/drivers/acpi/executer/exsystem.c similarity index 99% rename from trunk/drivers/acpi/acpica/exsystem.c rename to trunk/drivers/acpi/executer/exsystem.c index 3d00b9357233..68990f1df371 100644 --- a/trunk/drivers/acpi/acpica/exsystem.c +++ b/trunk/drivers/acpi/executer/exsystem.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acinterp.h" +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exsystem") diff --git a/trunk/drivers/acpi/acpica/exutils.c b/trunk/drivers/acpi/executer/exutils.c similarity index 99% rename from trunk/drivers/acpi/acpica/exutils.c rename to trunk/drivers/acpi/executer/exutils.c index 32b85d68e756..86c03880b523 100644 --- a/trunk/drivers/acpi/acpica/exutils.c +++ b/trunk/drivers/acpi/executer/exutils.c @@ -59,9 +59,8 @@ #define DEFINE_AML_GLOBALS #include -#include "accommon.h" -#include "acinterp.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exutils") diff --git a/trunk/drivers/acpi/hardware/Makefile b/trunk/drivers/acpi/hardware/Makefile new file mode 100644 index 000000000000..438ad373b9ad --- /dev/null +++ b/trunk/drivers/acpi/hardware/Makefile @@ -0,0 +1,9 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := hwacpi.o hwgpe.o hwregs.o hwsleep.o + +obj-$(ACPI_FUTURE_USAGE) += hwtimer.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/hwacpi.c b/trunk/drivers/acpi/hardware/hwacpi.c similarity index 99% rename from trunk/drivers/acpi/acpica/hwacpi.c rename to trunk/drivers/acpi/hardware/hwacpi.c index a9d4fea4167f..816894ea839e 100644 --- a/trunk/drivers/acpi/acpica/hwacpi.c +++ b/trunk/drivers/acpi/hardware/hwacpi.c @@ -43,7 +43,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwacpi") diff --git a/trunk/drivers/acpi/acpica/hwgpe.c b/trunk/drivers/acpi/hardware/hwgpe.c similarity index 86% rename from trunk/drivers/acpi/acpica/hwgpe.c rename to trunk/drivers/acpi/hardware/hwgpe.c index 2013b66745d2..0b80db9d9197 100644 --- a/trunk/drivers/acpi/acpica/hwgpe.c +++ b/trunk/drivers/acpi/hardware/hwgpe.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acevents.h" +#include #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwgpe") @@ -52,8 +51,7 @@ ACPI_MODULE_NAME("hwgpe") /* Local prototypes */ static acpi_status acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, - void *context); + struct acpi_gpe_block_info *gpe_block); /****************************************************************************** * @@ -82,7 +80,8 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) /* Get current value of the enable register that contains this GPE */ - status = acpi_read(&enable_mask, &gpe_register_info->enable_address); + status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask, + &gpe_register_info->enable_address); if (ACPI_FAILURE(status)) { return (status); } @@ -96,7 +95,9 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) /* Write the updated enable mask */ - status = acpi_write(enable_mask, &gpe_register_info->enable_address); + status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask, + &gpe_register_info->enable_address); + return (status); } @@ -131,8 +132,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) /* Write the entire GPE (runtime) enable register */ - status = acpi_write(gpe_register_info->enable_for_run, - &gpe_register_info->enable_address); + status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run, + &gpe_register_info->enable_address); return (status); } @@ -165,8 +166,9 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) * Write a one to the appropriate bit in the status register to * clear this GPE. */ - status = acpi_write(register_bit, - &gpe_event_info->register_info->status_address); + status = acpi_hw_low_level_write(8, register_bit, + &gpe_event_info->register_info-> + status_address); return (status); } @@ -225,7 +227,9 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, /* GPE currently active (status bit == 1)? */ - status = acpi_read(&in_byte, &gpe_register_info->status_address); + status = + acpi_hw_low_level_read(8, &in_byte, + &gpe_register_info->status_address); if (ACPI_FAILURE(status)) { goto unlock_and_exit; } @@ -256,8 +260,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, ******************************************************************************/ acpi_status -acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context) +acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { u32 i; acpi_status status; @@ -268,9 +272,9 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, /* Disable all GPEs in this register */ - status = - acpi_write(0x00, - &gpe_block->register_info[i].enable_address); + status = acpi_hw_low_level_write(8, 0x00, + &gpe_block->register_info[i]. + enable_address); if (ACPI_FAILURE(status)) { return (status); } @@ -293,8 +297,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, ******************************************************************************/ acpi_status -acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context) +acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { u32 i; acpi_status status; @@ -305,9 +309,9 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, /* Clear status on all GPEs in this register */ - status = - acpi_write(0xFF, - &gpe_block->register_info[i].status_address); + status = acpi_hw_low_level_write(8, 0xFF, + &gpe_block->register_info[i]. + status_address); if (ACPI_FAILURE(status)) { return (status); } @@ -331,8 +335,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, ******************************************************************************/ acpi_status -acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context) +acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, + struct acpi_gpe_block_info * gpe_block) { u32 i; acpi_status status; @@ -348,9 +352,12 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, /* Enable all "runtime" GPEs in this register */ - status = acpi_write(gpe_block->register_info[i].enable_for_run, - &gpe_block->register_info[i]. - enable_address); + status = + acpi_hw_low_level_write(8, + gpe_block->register_info[i]. + enable_for_run, + &gpe_block->register_info[i]. + enable_address); if (ACPI_FAILURE(status)) { return (status); } @@ -375,8 +382,7 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, static acpi_status acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, - void *context) + struct acpi_gpe_block_info *gpe_block) { u32 i; acpi_status status; @@ -390,9 +396,11 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, /* Enable all "wake" GPEs in this register */ - status = acpi_write(gpe_block->register_info[i].enable_for_wake, - &gpe_block->register_info[i]. - enable_address); + status = acpi_hw_low_level_write(8, + gpe_block->register_info[i]. + enable_for_wake, + &gpe_block->register_info[i]. + enable_address); if (ACPI_FAILURE(status)) { return (status); } @@ -419,8 +427,8 @@ acpi_status acpi_hw_disable_all_gpes(void) ACPI_FUNCTION_TRACE(hw_disable_all_gpes); - status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); - status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); + status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); + status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); return_ACPI_STATUS(status); } @@ -442,7 +450,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); - status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL); + status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); return_ACPI_STATUS(status); } @@ -464,6 +472,6 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); - status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL); + status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/acpica/hwxface.c b/trunk/drivers/acpi/hardware/hwregs.c similarity index 62% rename from trunk/drivers/acpi/acpica/hwxface.c rename to trunk/drivers/acpi/hardware/hwregs.c index ae597c0ab53f..ddf792adcf96 100644 --- a/trunk/drivers/acpi/acpica/hwxface.c +++ b/trunk/drivers/acpi/hardware/hwregs.c @@ -1,9 +1,10 @@ -/****************************************************************************** +/******************************************************************************* * - * Module Name: hwxface - Public ACPICA hardware interfaces + * Module Name: hwregs - Read/write access functions for the various ACPI + * control and status registers. * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 - 2008, Intel Corp. @@ -43,208 +44,209 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_HARDWARE -ACPI_MODULE_NAME("hwxface") +ACPI_MODULE_NAME("hwregs") -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: acpi_reset + * FUNCTION: acpi_hw_clear_acpi_status * * PARAMETERS: None * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Set reset register in memory or IO space. Note: Does not - * support reset register in PCI config space, this must be - * handled separately. + * DESCRIPTION: Clears all fixed and general purpose status bits + * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ -acpi_status acpi_reset(void) +acpi_status acpi_hw_clear_acpi_status(void) { - struct acpi_generic_address *reset_reg; acpi_status status; + acpi_cpu_flags lock_flags = 0; + + ACPI_FUNCTION_TRACE(hw_clear_acpi_status); + + ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", + ACPI_BITMASK_ALL_FIXED_STATUS, + (u16) acpi_gbl_FADT.xpm1a_event_block.address)); - ACPI_FUNCTION_TRACE(acpi_reset); + lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - reset_reg = &acpi_gbl_FADT.reset_register; + status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } - /* Check if the reset register is supported */ + /* Clear the fixed events */ - if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || - !reset_reg->address) { - return_ACPI_STATUS(AE_NOT_EXIST); + if (acpi_gbl_FADT.xpm1b_event_block.address) { + status = + acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS, + &acpi_gbl_FADT.xpm1b_event_block); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } } - /* Write the reset value to the reset register */ + /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg); + status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); + + unlock_and_exit: + acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_reset) - -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: acpi_read + * FUNCTION: acpi_get_sleep_type_data * - * PARAMETERS: Value - Where the value is returned - * Reg - GAS register structure + * PARAMETERS: sleep_state - Numeric sleep state + * *sleep_type_a - Where SLP_TYPa is returned + * *sleep_type_b - Where SLP_TYPb is returned * - * RETURN: Status + * RETURN: Status - ACPI status * - * DESCRIPTION: Read from either memory or IO space. + * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep + * state. * ******************************************************************************/ -acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) + +acpi_status +acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) { - u32 width; - u64 address; - acpi_status status; + acpi_status status = AE_OK; + struct acpi_evaluate_info *info; - ACPI_FUNCTION_NAME(acpi_read); + ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); - /* - * Must have a valid pointer to a GAS structure, and - * a non-zero address within. However, don't return an error - * because the PM1A/B code must not fail if B isn't present. - */ - if (!reg) { - return (AE_OK); + /* Validate parameters */ + + if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Allocate the evaluation information block */ - ACPI_MOVE_64_TO_64(&address, ®->address); - if (!address) { - return (AE_OK); + info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); + if (!info) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + info->pathname = + ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); + + /* Evaluate the namespace object containing the values for this state */ + + status = acpi_ns_evaluate(info); + if (ACPI_FAILURE(status)) { + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "%s while evaluating SleepState [%s]\n", + acpi_format_exception(status), + info->pathname)); + + goto cleanup; } - /* Supported widths are 8/16/32 */ + /* Must have a return object */ - width = reg->bit_width; - if ((width != 8) && (width != 16) && (width != 32)) { - return (AE_SUPPORT); + if (!info->return_object) { + ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", + info->pathname)); + status = AE_NOT_EXIST; } - /* Initialize entire 32-bit return value to zero */ + /* It must be of type Package */ - *value = 0; + else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { + ACPI_ERROR((AE_INFO, + "Sleep State return object is not a Package")); + status = AE_AML_OPERAND_TYPE; + } /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient + * The package must have at least two elements. NOTE (March 2005): This + * goes against the current ACPI spec which defines this object as a + * package with one encoded DWORD element. However, existing practice + * by BIOS vendors seems to be to have 2 or more elements, at least + * one per sleep type (A/B). */ - switch (reg->space_id) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: + else if (info->return_object->package.count < 2) { + ACPI_ERROR((AE_INFO, + "Sleep State return package does not have at least two elements")); + status = AE_AML_NO_OPERAND; + } - status = acpi_os_read_memory((acpi_physical_address) address, - value, width); - break; + /* The first two elements must both be of type Integer */ - case ACPI_ADR_SPACE_SYSTEM_IO: + else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) + != ACPI_TYPE_INTEGER) || + (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) + != ACPI_TYPE_INTEGER)) { + ACPI_ERROR((AE_INFO, + "Sleep State return package elements are not both Integers (%s, %s)", + acpi_ut_get_object_type_name(info->return_object-> + package.elements[0]), + acpi_ut_get_object_type_name(info->return_object-> + package.elements[1]))); + status = AE_AML_OPERAND_TYPE; + } else { + /* Valid _Sx_ package size, type, and value */ - status = - acpi_os_read_port((acpi_io_address) address, value, width); - break; + *sleep_type_a = (u8) + (info->return_object->package.elements[0])->integer.value; + *sleep_type_b = (u8) + (info->return_object->package.elements[1])->integer.value; + } - default: - ACPI_ERROR((AE_INFO, - "Unsupported address space: %X", reg->space_id)); - return (AE_BAD_PARAMETER); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "While evaluating SleepState [%s], bad Sleep object %p type %s", + info->pathname, info->return_object, + acpi_ut_get_object_type_name(info-> + return_object))); } - ACPI_DEBUG_PRINT((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *value, width, ACPI_FORMAT_UINT64(address), - acpi_ut_get_region_name(reg->space_id))); + acpi_ut_remove_reference(info->return_object); - return (status); + cleanup: + ACPI_FREE(info); + return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_read) +ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: acpi_write + * FUNCTION: acpi_hw_get_register_bit_mask * - * PARAMETERS: Value - To be written - * Reg - GAS register structure + * PARAMETERS: register_id - Index of ACPI Register to access * - * RETURN: Status + * RETURN: The bitmask to be used when accessing the register * - * DESCRIPTION: Write to either memory or IO space. + * DESCRIPTION: Map register_id into a register bitmask. * ******************************************************************************/ -acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) +struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { - u32 width; - u64 address; - acpi_status status; - - ACPI_FUNCTION_NAME(acpi_write); - - /* - * Must have a valid pointer to a GAS structure, and - * a non-zero address within. However, don't return an error - * because the PM1A/B code must not fail if B isn't present. - */ - if (!reg) { - return (AE_OK); - } - - /* Get a local copy of the address. Handles possible alignment issues */ - - ACPI_MOVE_64_TO_64(&address, ®->address); - if (!address) { - return (AE_OK); - } - - /* Supported widths are 8/16/32 */ - - width = reg->bit_width; - if ((width != 8) && (width != 16) && (width != 32)) { - return (AE_SUPPORT); - } - - /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient - */ - switch (reg->space_id) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - status = acpi_os_write_memory((acpi_physical_address) address, - value, width); - break; - - case ACPI_ADR_SPACE_SYSTEM_IO: - - status = acpi_os_write_port((acpi_io_address) address, value, - width); - break; + ACPI_FUNCTION_ENTRY(); - default: - ACPI_ERROR((AE_INFO, - "Unsupported address space: %X", reg->space_id)); - return (AE_BAD_PARAMETER); + if (register_id > ACPI_BITREG_MAX) { + ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", + register_id)); + return (NULL); } - ACPI_DEBUG_PRINT((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - value, width, ACPI_FORMAT_UINT64(address), - acpi_ut_get_region_name(reg->space_id))); - - return (status); + return (&acpi_gbl_bit_register_info[register_id]); } -ACPI_EXPORT_SYMBOL(acpi_write) - /******************************************************************************* * - * FUNCTION: acpi_get_register_unlocked + * FUNCTION: acpi_get_register * * PARAMETERS: register_id - ID of ACPI bit_register to access * return_value - Value that was read from the register @@ -252,16 +254,17 @@ ACPI_EXPORT_SYMBOL(acpi_write) * RETURN: Status and the value read from specified Register. Value * returned is normalized to bit0 (is shifted all the way right) * - * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock. + * DESCRIPTION: ACPI bit_register read function. * ******************************************************************************/ -acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) + +acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) { u32 register_value = 0; struct acpi_bit_register_info *bit_reg_info; acpi_status status; - ACPI_FUNCTION_TRACE(acpi_get_register_unlocked); + ACPI_FUNCTION_TRACE(acpi_get_register); /* Get the info structure corresponding to the requested ACPI Register */ @@ -293,31 +296,14 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked) - -/******************************************************************************* - * - * FUNCTION: acpi_get_register - * - * PARAMETERS: register_id - ID of ACPI bit_register to access - * return_value - Value that was read from the register - * - * RETURN: Status and the value read from specified Register. Value - * returned is normalized to bit0 (is shifted all the way right) - * - * DESCRIPTION: ACPI bit_register read function. - * - ******************************************************************************/ -acpi_status acpi_get_register(u32 register_id, u32 *return_value) +acpi_status acpi_get_register(u32 register_id, u32 * return_value) { acpi_status status; acpi_cpu_flags flags; - flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); status = acpi_get_register_unlocked(register_id, return_value); acpi_os_release_lock(acpi_gbl_hardware_lock, flags); - - return (status); + return status; } ACPI_EXPORT_SYMBOL(acpi_get_register) @@ -384,9 +370,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value) bit_reg_info-> access_bit_mask); if (value) { - status = - acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, - (u16) value); + status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, + (u16) value); register_value = 0; } break; @@ -474,120 +459,399 @@ acpi_status acpi_set_register(u32 register_id, u32 value) ACPI_EXPORT_SYMBOL(acpi_set_register) -/******************************************************************************* +/****************************************************************************** * - * FUNCTION: acpi_get_sleep_type_data + * FUNCTION: acpi_hw_register_read * - * PARAMETERS: sleep_state - Numeric sleep state - * *sleep_type_a - Where SLP_TYPa is returned - * *sleep_type_b - Where SLP_TYPb is returned + * PARAMETERS: register_id - ACPI Register ID + * return_value - Where the register value is returned * - * RETURN: Status - ACPI status + * RETURN: Status and the value read. * - * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep - * state. + * DESCRIPTION: Read from the specified ACPI register * ******************************************************************************/ acpi_status -acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) +acpi_hw_register_read(u32 register_id, u32 * return_value) { - acpi_status status = AE_OK; - struct acpi_evaluate_info *info; + u32 value1 = 0; + u32 value2 = 0; + acpi_status status; - ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); + ACPI_FUNCTION_TRACE(hw_register_read); - /* Validate parameters */ + switch (register_id) { + case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } + status = + acpi_hw_low_level_read(16, &value1, + &acpi_gbl_FADT.xpm1a_event_block); + if (ACPI_FAILURE(status)) { + goto exit; + } - /* Allocate the evaluation information block */ + /* PM1B is optional */ - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_ACPI_STATUS(AE_NO_MEMORY); - } + status = + acpi_hw_low_level_read(16, &value2, + &acpi_gbl_FADT.xpm1b_event_block); + value1 |= value2; + break; - info->pathname = - ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - /* Evaluate the namespace object containing the values for this state */ + status = + acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { + goto exit; + } - status = acpi_ns_evaluate(info); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "%s while evaluating SleepState [%s]\n", - acpi_format_exception(status), - info->pathname)); + /* PM1B is optional */ - goto cleanup; + status = + acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable); + value1 |= value2; + break; + + case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ + + status = + acpi_hw_low_level_read(16, &value1, + &acpi_gbl_FADT.xpm1a_control_block); + if (ACPI_FAILURE(status)) { + goto exit; + } + + status = + acpi_hw_low_level_read(16, &value2, + &acpi_gbl_FADT.xpm1b_control_block); + value1 |= value2; + break; + + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + status = + acpi_hw_low_level_read(8, &value1, + &acpi_gbl_FADT.xpm2_control_block); + break; + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + status = + acpi_hw_low_level_read(32, &value1, + &acpi_gbl_FADT.xpm_timer_block); + break; + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + status = + acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); + break; + + default: + ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id)); + status = AE_BAD_PARAMETER; + break; } - /* Must have a return object */ + exit: - if (!info->return_object) { - ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", - info->pathname)); - status = AE_NOT_EXIST; + if (ACPI_SUCCESS(status)) { + *return_value = value1; } - /* It must be of type Package */ + return_ACPI_STATUS(status); +} - else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { - ACPI_ERROR((AE_INFO, - "Sleep State return object is not a Package")); - status = AE_AML_OPERAND_TYPE; +/****************************************************************************** + * + * FUNCTION: acpi_hw_register_write + * + * PARAMETERS: register_id - ACPI Register ID + * Value - The value to write + * + * RETURN: Status + * + * DESCRIPTION: Write to the specified ACPI register + * + * NOTE: In accordance with the ACPI specification, this function automatically + * preserves the value of the following bits, meaning that these bits cannot be + * changed via this interface: + * + * PM1_CONTROL[0] = SCI_EN + * PM1_CONTROL[9] + * PM1_STATUS[11] + * + * ACPI References: + * 1) Hardware Ignored Bits: When software writes to a register with ignored + * bit fields, it preserves the ignored bit fields + * 2) SCI_EN: OSPM always preserves this bit position + * + ******************************************************************************/ + +acpi_status acpi_hw_register_write(u32 register_id, u32 value) +{ + acpi_status status; + u32 read_value; + + ACPI_FUNCTION_TRACE(hw_register_write); + + switch (register_id) { + case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ + + /* Perform a read first to preserve certain bits (per ACPI spec) */ + + status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, + &read_value); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1a_event_block); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* PM1B is optional */ + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1b_event_block); + break; + + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ + + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* PM1B is optional */ + + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable); + break; + + case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ + + /* + * Perform a read first to preserve certain bits (per ACPI spec) + */ + status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, + &read_value); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1a_control_block); + if (ACPI_FAILURE(status)) { + goto exit; + } + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1b_control_block); + break; + + case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1a_control_block); + break; + + case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ + + status = + acpi_hw_low_level_write(16, value, + &acpi_gbl_FADT.xpm1b_control_block); + break; + + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + status = + acpi_hw_low_level_write(8, value, + &acpi_gbl_FADT.xpm2_control_block); + break; + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + status = + acpi_hw_low_level_write(32, value, + &acpi_gbl_FADT.xpm_timer_block); + break; + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + /* SMI_CMD is currently always in IO space */ + + status = + acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); + break; + + default: + status = AE_BAD_PARAMETER; + break; } + exit: + return_ACPI_STATUS(status); +} + +/****************************************************************************** + * + * FUNCTION: acpi_hw_low_level_read + * + * PARAMETERS: Width - 8, 16, or 32 + * Value - Where the value is returned + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Read from either memory or IO space. + * + ******************************************************************************/ + +acpi_status +acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) +{ + u64 address; + acpi_status status; + + ACPI_FUNCTION_NAME(hw_low_level_read); + /* - * The package must have at least two elements. NOTE (March 2005): This - * goes against the current ACPI spec which defines this object as a - * package with one encoded DWORD element. However, existing practice - * by BIOS vendors seems to be to have 2 or more elements, at least - * one per sleep type (A/B). + * Must have a valid pointer to a GAS structure, and + * a non-zero address within. However, don't return an error + * because the PM1A/B code must not fail if B isn't present. */ - else if (info->return_object->package.count < 2) { - ACPI_ERROR((AE_INFO, - "Sleep State return package does not have at least two elements")); - status = AE_AML_NO_OPERAND; + if (!reg) { + return (AE_OK); } - /* The first two elements must both be of type Integer */ + /* Get a local copy of the address. Handles possible alignment issues */ - else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) - != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) - != ACPI_TYPE_INTEGER)) { + ACPI_MOVE_64_TO_64(&address, ®->address); + if (!address) { + return (AE_OK); + } + *value = 0; + + /* + * Two address spaces supported: Memory or IO. + * PCI_Config is not supported here because the GAS struct is insufficient + */ + switch (reg->space_id) { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + + status = acpi_os_read_memory((acpi_physical_address) address, + value, width); + break; + + case ACPI_ADR_SPACE_SYSTEM_IO: + + status = + acpi_os_read_port((acpi_io_address) address, value, width); + break; + + default: ACPI_ERROR((AE_INFO, - "Sleep State return package elements are not both Integers (%s, %s)", - acpi_ut_get_object_type_name(info->return_object-> - package.elements[0]), - acpi_ut_get_object_type_name(info->return_object-> - package.elements[1]))); - status = AE_AML_OPERAND_TYPE; - } else { - /* Valid _Sx_ package size, type, and value */ + "Unsupported address space: %X", reg->space_id)); + return (AE_BAD_PARAMETER); + } - *sleep_type_a = (u8) - (info->return_object->package.elements[0])->integer.value; - *sleep_type_b = (u8) - (info->return_object->package.elements[1])->integer.value; + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *value, width, ACPI_FORMAT_UINT64(address), + acpi_ut_get_region_name(reg->space_id))); + + return (status); +} + +/****************************************************************************** + * + * FUNCTION: acpi_hw_low_level_write + * + * PARAMETERS: Width - 8, 16, or 32 + * Value - To be written + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Write to either memory or IO space. + * + ******************************************************************************/ + +acpi_status +acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) +{ + u64 address; + acpi_status status; + + ACPI_FUNCTION_NAME(hw_low_level_write); + + /* + * Must have a valid pointer to a GAS structure, and + * a non-zero address within. However, don't return an error + * because the PM1A/B code must not fail if B isn't present. + */ + if (!reg) { + return (AE_OK); } - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "While evaluating SleepState [%s], bad Sleep object %p type %s", - info->pathname, info->return_object, - acpi_ut_get_object_type_name(info-> - return_object))); + /* Get a local copy of the address. Handles possible alignment issues */ + + ACPI_MOVE_64_TO_64(&address, ®->address); + if (!address) { + return (AE_OK); } - acpi_ut_remove_reference(info->return_object); + /* + * Two address spaces supported: Memory or IO. + * PCI_Config is not supported here because the GAS struct is insufficient + */ + switch (reg->space_id) { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: - cleanup: - ACPI_FREE(info); - return_ACPI_STATUS(status); -} + status = acpi_os_write_memory((acpi_physical_address) address, + value, width); + break; -ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) + case ACPI_ADR_SPACE_SYSTEM_IO: + + status = acpi_os_write_port((acpi_io_address) address, value, + width); + break; + + default: + ACPI_ERROR((AE_INFO, + "Unsupported address space: %X", reg->space_id)); + return (AE_BAD_PARAMETER); + } + + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + value, width, ACPI_FORMAT_UINT64(address), + acpi_ut_get_region_name(reg->space_id))); + + return (status); +} diff --git a/trunk/drivers/acpi/acpica/hwsleep.c b/trunk/drivers/acpi/hardware/hwsleep.c similarity index 91% rename from trunk/drivers/acpi/acpica/hwsleep.c rename to trunk/drivers/acpi/hardware/hwsleep.c index a2af2a4f2f26..25dccdf179b9 100644 --- a/trunk/drivers/acpi/acpica/hwsleep.c +++ b/trunk/drivers/acpi/hardware/hwsleep.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "actables.h" +#include #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwsleep") @@ -53,19 +52,31 @@ ACPI_MODULE_NAME("hwsleep") * * FUNCTION: acpi_set_firmware_waking_vector * - * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode + * PARAMETERS: physical_address - Physical address of ACPI real mode * entry point. * * RETURN: Status * - * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS + * DESCRIPTION: Access function for the firmware_waking_vector field in FACS * ******************************************************************************/ acpi_status -acpi_set_firmware_waking_vector(u32 physical_address) +acpi_set_firmware_waking_vector(acpi_physical_address physical_address) { + struct acpi_table_facs *facs; + acpi_status status; + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); + /* Get the FACS */ + + status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* * According to the ACPI specification 2.0c and later, the 64-bit @@ -74,16 +85,10 @@ acpi_set_firmware_waking_vector(u32 physical_address) * Protected Mode. Some systems (for example HP dv5-1004nr) are known * to fail to resume if the 64-bit vector is used. */ + if (facs->version >= 1) + facs->xfirmware_waking_vector = 0; - /* Set the 32-bit vector */ - - acpi_gbl_FACS->firmware_waking_vector = physical_address; - - /* Clear the 64-bit vector if it exists */ - - if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { - acpi_gbl_FACS->xfirmware_waking_vector = 0; - } + facs->firmware_waking_vector = (u32)physical_address; return_ACPI_STATUS(AE_OK); } @@ -92,39 +97,48 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) /******************************************************************************* * - * FUNCTION: acpi_set_firmware_waking_vector64 + * FUNCTION: acpi_get_firmware_waking_vector * - * PARAMETERS: physical_address - 64-bit physical address of ACPI protected - * mode entry point. + * PARAMETERS: *physical_address - Where the contents of + * the firmware_waking_vector field of + * the FACS will be returned. * - * RETURN: Status + * RETURN: Status, vector * - * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if - * it exists in the table. + * DESCRIPTION: Access function for the firmware_waking_vector field in FACS * ******************************************************************************/ +#ifdef ACPI_FUTURE_USAGE acpi_status -acpi_set_firmware_waking_vector64(u64 physical_address) +acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) { - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); - + struct acpi_table_facs *facs; + acpi_status status; - /* Determine if the 64-bit vector actually exists */ + ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); - if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { - return_ACPI_STATUS(AE_NOT_EXIST); + if (!physical_address) { + return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Clear 32-bit vector, set the 64-bit X_ vector */ + /* Get the FACS */ - acpi_gbl_FACS->firmware_waking_vector = 0; - acpi_gbl_FACS->xfirmware_waking_vector = physical_address; + status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Get the vector */ + *physical_address = (acpi_physical_address)facs->firmware_waking_vector; return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) - +ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) +#endif /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_prep diff --git a/trunk/drivers/acpi/acpica/hwtimer.c b/trunk/drivers/acpi/hardware/hwtimer.c similarity index 99% rename from trunk/drivers/acpi/acpica/hwtimer.c rename to trunk/drivers/acpi/hardware/hwtimer.c index b7f522c8f023..b53d575491b9 100644 --- a/trunk/drivers/acpi/acpica/hwtimer.c +++ b/trunk/drivers/acpi/hardware/hwtimer.c @@ -43,7 +43,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwtimer") diff --git a/trunk/drivers/acpi/namespace/Makefile b/trunk/drivers/acpi/namespace/Makefile new file mode 100644 index 000000000000..371a2daf837f --- /dev/null +++ b/trunk/drivers/acpi/namespace/Makefile @@ -0,0 +1,12 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := nsaccess.o nsload.o nssearch.o nsxfeval.o \ + nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ + nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ + nsparse.o nspredef.o + +obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/nsaccess.c b/trunk/drivers/acpi/namespace/nsaccess.c similarity index 98% rename from trunk/drivers/acpi/acpica/nsaccess.c rename to trunk/drivers/acpi/namespace/nsaccess.c index 88303ebe924c..c39a7f68b889 100644 --- a/trunk/drivers/acpi/acpica/nsaccess.c +++ b/trunk/drivers/acpi/namespace/nsaccess.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsaccess") @@ -166,8 +165,11 @@ acpi_status acpi_ns_root_initialize(void) obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; + +#ifndef ACPI_DUMP_APP obj_desc->method.implementation = acpi_ut_osi_implementation; +#endif #endif break; @@ -519,11 +521,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, } /* - * Search namespace for each segment of the name. Loop through and + * Search namespace for each segment of the name. Loop through and * verify (or add to the namespace) each name segment. * * The object type is significant only at the last name - * segment. (We don't care about the types along the path, only + * segment. (We don't care about the types along the path, only * the type of the final target object.) */ this_search_type = ACPI_TYPE_ANY; @@ -589,10 +591,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, * segments). */ if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { - if (!this_node->object) { - return_ACPI_STATUS(AE_NOT_EXIST); - } - if (acpi_ns_opens_scope (((struct acpi_namespace_node *)this_node-> object)->type)) { diff --git a/trunk/drivers/acpi/acpica/nsalloc.c b/trunk/drivers/acpi/namespace/nsalloc.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsalloc.c rename to trunk/drivers/acpi/namespace/nsalloc.c index f976d848fe82..3a1740ac2edc 100644 --- a/trunk/drivers/acpi/acpica/nsalloc.c +++ b/trunk/drivers/acpi/namespace/nsalloc.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsalloc") diff --git a/trunk/drivers/acpi/acpica/nsdump.c b/trunk/drivers/acpi/namespace/nsdump.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsdump.c rename to trunk/drivers/acpi/namespace/nsdump.c index 0da33c8e9ba2..cc0ae39440e4 100644 --- a/trunk/drivers/acpi/acpica/nsdump.c +++ b/trunk/drivers/acpi/namespace/nsdump.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsdump") diff --git a/trunk/drivers/acpi/acpica/nsdumpdv.c b/trunk/drivers/acpi/namespace/nsdumpdv.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsdumpdv.c rename to trunk/drivers/acpi/namespace/nsdumpdv.c index 41994fe7fbb8..428f50fde11a 100644 --- a/trunk/drivers/acpi/acpica/nsdumpdv.c +++ b/trunk/drivers/acpi/namespace/nsdumpdv.c @@ -42,7 +42,6 @@ */ #include -#include "accommon.h" /* TBD: This entire module is apparently obsolete and should be removed */ @@ -50,7 +49,7 @@ ACPI_MODULE_NAME("nsdumpdv") #ifdef ACPI_OBSOLETE_FUNCTIONS #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -#include "acnamesp.h" +#include /******************************************************************************* * * FUNCTION: acpi_ns_dump_one_device diff --git a/trunk/drivers/acpi/acpica/nseval.c b/trunk/drivers/acpi/namespace/nseval.c similarity index 81% rename from trunk/drivers/acpi/acpica/nseval.c rename to trunk/drivers/acpi/namespace/nseval.c index 0f3d5f9b5966..4cdf03ac2b46 100644 --- a/trunk/drivers/acpi/acpica/nseval.c +++ b/trunk/drivers/acpi/namespace/nseval.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nseval") @@ -90,7 +89,6 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) /* Initialize the return value to an invalid object */ info->return_object = NULL; - info->param_count = 0; /* * Get the actual namespace node for the target object. Handles these cases: @@ -143,17 +141,41 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) return_ACPI_STATUS(AE_NULL_OBJECT); } - /* Count the number of arguments being passed to the method */ + /* + * Calculate the number of arguments being passed to the method + */ + info->param_count = 0; if (info->parameters) { - while (info->parameters[info->param_count]) { - if (info->param_count > ACPI_METHOD_MAX_ARG) { - return_ACPI_STATUS(AE_LIMIT); - } + while (info->parameters[info->param_count]) info->param_count++; - } } + /* + * Warning if too few or too many arguments have been passed by the + * caller. We don't want to abort here with an error because an + * incorrect number of arguments may not cause the method to fail. + * However, the method will fail if there are too few arguments passed + * and the method attempts to use one of the missing ones. + */ + + if (info->param_count < info->obj_desc->method.param_count) { + ACPI_WARNING((AE_INFO, + "Insufficient arguments - " + "method [%4.4s] needs %d, found %d", + acpi_ut_get_node_name(info->resolved_node), + info->obj_desc->method.param_count, + info->param_count)); + } else if (info->param_count > + info->obj_desc->method.param_count) { + ACPI_WARNING((AE_INFO, + "Excess arguments - " + "method [%4.4s] needs %d, found %d", + acpi_ut_get_node_name(info-> + resolved_node), + info->obj_desc->method.param_count, + info->param_count)); + } ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", ACPI_LV_INFO, _COMPONENT); @@ -242,13 +264,32 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) } } - /* - * Check input argument count against the ASL-defined count for a method. - * Also check predefined names: argument count and return value against - * the ACPI specification. Some incorrect return value types are repaired. - */ - (void)acpi_ns_check_predefined_names(node, info->param_count, - status, &info->return_object); + /* Validation of return values for ACPI-predefined methods and objects */ + + if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) { + /* + * If this is the first evaluation, check the return value. This + * ensures that any warnings will only be emitted during the very + * first evaluation of the object. + */ + if (!(node->flags & ANOBJ_EVALUATED)) { + /* + * Check for a predefined ACPI name. If found, validate the + * returned object. + * + * Note: Ignore return status for now, emit warnings if there are + * problems with the returned object. May change later to abort + * the method on invalid return object. + */ + (void)acpi_ns_check_predefined_names(node, + info-> + return_object); + } + + /* Mark the node as having been evaluated */ + + node->flags |= ANOBJ_EVALUATED; + } /* Check if there is a return value that must be dealt with */ diff --git a/trunk/drivers/acpi/acpica/nsinit.c b/trunk/drivers/acpi/namespace/nsinit.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsinit.c rename to trunk/drivers/acpi/namespace/nsinit.c index 13501cb81863..e4c57510d798 100644 --- a/trunk/drivers/acpi/acpica/nsinit.c +++ b/trunk/drivers/acpi/namespace/nsinit.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acdispat.h" -#include "acinterp.h" +#include +#include +#include #include #define _COMPONENT ACPI_NAMESPACE diff --git a/trunk/drivers/acpi/acpica/nsload.c b/trunk/drivers/acpi/namespace/nsload.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsload.c rename to trunk/drivers/acpi/namespace/nsload.c index a0ba9e12379e..a4a412b7c029 100644 --- a/trunk/drivers/acpi/acpica/nsload.c +++ b/trunk/drivers/acpi/namespace/nsload.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acdispat.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsload") diff --git a/trunk/drivers/acpi/acpica/nsnames.c b/trunk/drivers/acpi/namespace/nsnames.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsnames.c rename to trunk/drivers/acpi/namespace/nsnames.c index ae3dc10a7e81..42a39a7c96e9 100644 --- a/trunk/drivers/acpi/acpica/nsnames.c +++ b/trunk/drivers/acpi/namespace/nsnames.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "amlcode.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsnames") diff --git a/trunk/drivers/acpi/acpica/nsobject.c b/trunk/drivers/acpi/namespace/nsobject.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsobject.c rename to trunk/drivers/acpi/namespace/nsobject.c index 08a97a57f8f9..15fe09e24f71 100644 --- a/trunk/drivers/acpi/acpica/nsobject.c +++ b/trunk/drivers/acpi/namespace/nsobject.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsobject") diff --git a/trunk/drivers/acpi/acpica/nsparse.c b/trunk/drivers/acpi/namespace/nsparse.c similarity index 98% rename from trunk/drivers/acpi/acpica/nsparse.c rename to trunk/drivers/acpi/namespace/nsparse.c index b9e8d0070b6f..a82271a9dbb3 100644 --- a/trunk/drivers/acpi/acpica/nsparse.c +++ b/trunk/drivers/acpi/namespace/nsparse.c @@ -42,11 +42,10 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acdispat.h" -#include "actables.h" +#include +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsparse") diff --git a/trunk/drivers/acpi/acpica/nspredef.c b/trunk/drivers/acpi/namespace/nspredef.c similarity index 76% rename from trunk/drivers/acpi/acpica/nspredef.c rename to trunk/drivers/acpi/namespace/nspredef.c index 452703290d35..0f17cf0898c9 100644 --- a/trunk/drivers/acpi/acpica/nspredef.c +++ b/trunk/drivers/acpi/namespace/nspredef.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acpredef.h" +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nspredef") @@ -73,7 +72,7 @@ ACPI_MODULE_NAME("nspredef") /* Local prototypes */ static acpi_status acpi_ns_check_package(char *pathname, - union acpi_operand_object **return_object_ptr, + union acpi_operand_object *return_object, const union acpi_predefined_info *predefined); static acpi_status @@ -83,18 +82,13 @@ acpi_ns_check_package_elements(char *pathname, static acpi_status acpi_ns_check_object_type(char *pathname, - union acpi_operand_object **return_object_ptr, + union acpi_operand_object *return_object, u32 expected_btypes, u32 package_index); static acpi_status acpi_ns_check_reference(char *pathname, union acpi_operand_object *return_object); -static acpi_status -acpi_ns_repair_object(u32 expected_btypes, - u32 package_index, - union acpi_operand_object **return_object_ptr); - /* * Names for the types that can be returned by the predefined objects. * Used for warning messages. Must be in the same order as the ACPI_RTYPEs @@ -114,8 +108,8 @@ static const char *acpi_rtype_names[] = { * FUNCTION: acpi_ns_check_predefined_names * * PARAMETERS: Node - Namespace node for the method/object - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object + * return_object - Object returned from the evaluation of this + * method/object * * RETURN: Status * @@ -125,11 +119,8 @@ static const char *acpi_rtype_names[] = { acpi_status acpi_ns_check_predefined_names(struct acpi_namespace_node *node, - u32 user_param_count, - acpi_status return_status, - union acpi_operand_object **return_object_ptr) + union acpi_operand_object *return_object) { - union acpi_operand_object *return_object = *return_object_ptr; acpi_status status = AE_OK; const union acpi_predefined_info *predefined; char *pathname; @@ -137,6 +128,12 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, /* Match the name for this method/object against the predefined list */ predefined = acpi_ns_check_for_predefined_name(node); + if (!predefined) { + + /* Name was not one of the predefined names */ + + return (AE_OK); + } /* Get the full pathname to the object, for use in error messages */ @@ -146,37 +143,10 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, } /* - * Check that the parameter count for this method matches the ASL - * definition. For predefined names, ensure that both the caller and - * the method itself are in accordance with the ACPI specification. + * Check that the parameter count for this method is in accordance + * with the ACPI specification. */ - acpi_ns_check_parameter_count(pathname, node, user_param_count, - predefined); - - /* If not a predefined name, we cannot validate the return object */ - - if (!predefined) { - goto exit; - } - - /* If the method failed, we cannot validate the return object */ - - if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { - goto exit; - } - - /* - * Only validate the return value on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. - */ - if (node->flags & ANOBJ_EVALUATED) { - goto exit; - } - - /* Mark the node as having been successfully evaluated */ - - node->flags |= ANOBJ_EVALUATED; + acpi_ns_check_parameter_count(pathname, node, predefined); /* * If there is no return value, check if we require a return value for @@ -201,7 +171,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, * We have a return value, but if one wasn't expected, just exit, this is * not a problem * - * For example, if the "Implicit Return" feature is enabled, methods will + * For example, if "Implicit return value" is enabled, methods will * always return a value */ if (!predefined->info.expected_btypes) { @@ -212,7 +182,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, * Check that the type of the return object is what is expected for * this predefined name */ - status = acpi_ns_check_object_type(pathname, return_object_ptr, + status = acpi_ns_check_object_type(pathname, return_object, predefined->info.expected_btypes, ACPI_NOT_PACKAGE); if (ACPI_FAILURE(status)) { @@ -223,12 +193,11 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) { status = - acpi_ns_check_package(pathname, return_object_ptr, - predefined); + acpi_ns_check_package(pathname, return_object, predefined); } exit: - if (pathname != predefined->info.name) { + if (pathname) { ACPI_FREE(pathname); } @@ -241,7 +210,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, * * PARAMETERS: Pathname - Full pathname to the node (for error msgs) * Node - Namespace node for the method/object - * user_param_count - Number of args passed in by the caller * Predefined - Pointer to entry in predefined name table * * RETURN: None @@ -255,76 +223,32 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, void acpi_ns_check_parameter_count(char *pathname, struct acpi_namespace_node *node, - u32 user_param_count, const union acpi_predefined_info *predefined) { u32 param_count; u32 required_params_current; u32 required_params_old; - /* Methods have 0-7 parameters. All other types have zero. */ - + /* + * Check that the ASL-defined parameter count is what is expected for + * this predefined name. + * + * Methods have 0-7 parameters. All other types have zero. + */ param_count = 0; if (node->type == ACPI_TYPE_METHOD) { param_count = node->object->method.param_count; } - /* Argument count check for non-predefined methods/objects */ - - if (!predefined) { - /* - * Warning if too few or too many arguments have been passed by the - * caller. An incorrect number of arguments may not cause the method - * to fail. However, the method will fail if there are too few - * arguments and the method attempts to use one of the missing ones. - */ - if (user_param_count < param_count) { - ACPI_WARNING((AE_INFO, - "%s: Insufficient arguments - needs %d, found %d", - pathname, param_count, user_param_count)); - } else if (user_param_count > param_count) { - ACPI_WARNING((AE_INFO, - "%s: Excess arguments - needs %d, found %d", - pathname, param_count, user_param_count)); - } - return; - } - - /* Allow two different legal argument counts (_SCP, etc.) */ + /* Validate parameter count - allow two different legal counts (_SCP) */ required_params_current = predefined->info.param_count & 0x0F; required_params_old = predefined->info.param_count >> 4; - if (user_param_count != ACPI_UINT32_MAX) { - - /* Validate the user-supplied parameter count */ - - if ((user_param_count != required_params_current) && - (user_param_count != required_params_old)) { - ACPI_WARNING((AE_INFO, - "%s: Parameter count mismatch - caller passed %d, ACPI requires %d", - pathname, user_param_count, - required_params_current)); - } - } - - /* - * Only validate the argument count on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. - */ - if (node->flags & ANOBJ_EVALUATED) { - return; - } - - /* - * Check that the ASL-defined parameter count is what is expected for - * this predefined name. - */ if ((param_count != required_params_current) && (param_count != required_params_old)) { ACPI_WARNING((AE_INFO, - "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", + "%s: Parameter count mismatch - ASL declared %d, expected %d", pathname, param_count, required_params_current)); } } @@ -383,8 +307,8 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct * FUNCTION: acpi_ns_check_package * * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object + * return_object - Object returned from the evaluation of a + * method or object * Predefined - Pointer to entry in predefined name table * * RETURN: Status @@ -396,10 +320,9 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct static acpi_status acpi_ns_check_package(char *pathname, - union acpi_operand_object **return_object_ptr, + union acpi_operand_object *return_object, const union acpi_predefined_info *predefined) { - union acpi_operand_object *return_object = *return_object_ptr; const union acpi_predefined_info *package; union acpi_operand_object *sub_package; union acpi_operand_object **elements; @@ -485,7 +408,7 @@ acpi_ns_check_package(char *pathname, * elements must be of the same type */ for (i = 0; i < count; i++) { - status = acpi_ns_check_object_type(pathname, elements, + status = acpi_ns_check_object_type(pathname, *elements, package->ret_info. object_type1, i); if (ACPI_FAILURE(status)) { @@ -518,7 +441,7 @@ acpi_ns_check_package(char *pathname, status = acpi_ns_check_object_type(pathname, - elements, + *elements, package-> ret_info3. object_type[i], @@ -531,7 +454,7 @@ acpi_ns_check_package(char *pathname, status = acpi_ns_check_object_type(pathname, - elements, + *elements, package-> ret_info3. tail_object_type, @@ -548,7 +471,7 @@ acpi_ns_check_package(char *pathname, /* First element is the (Integer) count of sub-packages to follow */ - status = acpi_ns_check_object_type(pathname, elements, + status = acpi_ns_check_object_type(pathname, *elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { return (status); @@ -586,7 +509,7 @@ acpi_ns_check_package(char *pathname, /* Each sub-object must be of type Package */ status = - acpi_ns_check_object_type(pathname, &sub_package, + acpi_ns_check_object_type(pathname, sub_package, ACPI_RTYPE_PACKAGE, i); if (ACPI_FAILURE(status)) { return (status); @@ -644,8 +567,12 @@ acpi_ns_check_package(char *pathname, for (j = 0; j < expected_count; j++) { status = acpi_ns_check_object_type(pathname, - &sub_elements[j], - package->ret_info2.object_type[j], j); + sub_elements + [j], + package-> + ret_info2. + object_type + [j], j); if (ACPI_FAILURE(status)) { return (status); } @@ -684,7 +611,7 @@ acpi_ns_check_package(char *pathname, status = acpi_ns_check_object_type(pathname, - sub_elements, + *sub_elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { @@ -781,7 +708,7 @@ acpi_ns_check_package_elements(char *pathname, * The second group can have a count of zero. */ for (i = 0; i < count1; i++) { - status = acpi_ns_check_object_type(pathname, this_element, + status = acpi_ns_check_object_type(pathname, *this_element, type1, i); if (ACPI_FAILURE(status)) { return (status); @@ -790,7 +717,7 @@ acpi_ns_check_package_elements(char *pathname, } for (i = 0; i < count2; i++) { - status = acpi_ns_check_object_type(pathname, this_element, + status = acpi_ns_check_object_type(pathname, *this_element, type2, (i + count1)); if (ACPI_FAILURE(status)) { return (status); @@ -806,8 +733,8 @@ acpi_ns_check_package_elements(char *pathname, * FUNCTION: acpi_ns_check_object_type * * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object + * return_object - Object return from the execution of this + * method/object * expected_btypes - Bitmap of expected return type(s) * package_index - Index of object within parent package (if * applicable - ACPI_NOT_PACKAGE otherwise) @@ -821,10 +748,9 @@ acpi_ns_check_package_elements(char *pathname, static acpi_status acpi_ns_check_object_type(char *pathname, - union acpi_operand_object **return_object_ptr, + union acpi_operand_object *return_object, u32 expected_btypes, u32 package_index) { - union acpi_operand_object *return_object = *return_object_ptr; acpi_status status = AE_OK; u32 return_btype; char type_buffer[48]; /* Room for 5 types */ @@ -888,14 +814,6 @@ acpi_ns_check_object_type(char *pathname, /* Is the object one of the expected types? */ if (!(return_btype & expected_btypes)) { - - /* Type mismatch -- attempt repair of the returned object */ - - status = acpi_ns_repair_object(expected_btypes, package_index, - return_object_ptr); - if (ACPI_SUCCESS(status)) { - return (status); - } goto type_error_exit; } @@ -980,86 +898,3 @@ acpi_ns_check_reference(char *pathname, return (AE_AML_OPERAND_TYPE); } - -/******************************************************************************* - * - * FUNCTION: acpi_ns_repair_object - * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * package_index - Used to determine if target is in a package - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if repair was successful. - * - * DESCRIPTION: Attempt to repair/convert a return object of a type that was - * not expected. - * - ******************************************************************************/ - -static acpi_status -acpi_ns_repair_object(u32 expected_btypes, - u32 package_index, - union acpi_operand_object **return_object_ptr) -{ - union acpi_operand_object *return_object = *return_object_ptr; - union acpi_operand_object *new_object; - acpi_size length; - - switch (ACPI_GET_OBJECT_TYPE(return_object)) { - case ACPI_TYPE_BUFFER: - - if (!(expected_btypes & ACPI_RTYPE_STRING)) { - return (AE_AML_OPERAND_TYPE); - } - - /* - * Have a Buffer, expected a String, convert. Use a to_string - * conversion, no transform performed on the buffer data. The best - * example of this is the _BIF method, where the string data from - * the battery is often (incorrectly) returned as buffer object(s). - */ - length = 0; - while ((length < return_object->buffer.length) && - (return_object->buffer.pointer[length])) { - length++; - } - - /* Allocate a new string object */ - - new_object = acpi_ut_create_string_object(length); - if (!new_object) { - return (AE_NO_MEMORY); - } - - /* - * Copy the raw buffer data with no transform. String is already NULL - * terminated at Length+1. - */ - ACPI_MEMCPY(new_object->string.pointer, - return_object->buffer.pointer, length); - - /* Install the new return object */ - - acpi_ut_remove_reference(return_object); - *return_object_ptr = new_object; - - /* - * If the object is a package element, we need to: - * 1. Decrement the reference count of the orignal object, it was - * incremented when building the package - * 2. Increment the reference count of the new object, it will be - * decremented when releasing the package - */ - if (package_index != ACPI_NOT_PACKAGE) { - acpi_ut_remove_reference(return_object); - acpi_ut_add_reference(new_object); - } - return (AE_OK); - - default: - break; - } - - return (AE_AML_OPERAND_TYPE); -} diff --git a/trunk/drivers/acpi/acpica/nssearch.c b/trunk/drivers/acpi/namespace/nssearch.c similarity index 99% rename from trunk/drivers/acpi/acpica/nssearch.c rename to trunk/drivers/acpi/namespace/nssearch.c index 6fea13f3f52d..a9a80bf811b3 100644 --- a/trunk/drivers/acpi/acpica/nssearch.c +++ b/trunk/drivers/acpi/namespace/nssearch.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nssearch") diff --git a/trunk/drivers/acpi/acpica/nsutils.c b/trunk/drivers/acpi/namespace/nsutils.c similarity index 98% rename from trunk/drivers/acpi/acpica/nsutils.c rename to trunk/drivers/acpi/namespace/nsutils.c index 3e1149bf4aa5..b0817e1127b1 100644 --- a/trunk/drivers/acpi/acpica/nsutils.c +++ b/trunk/drivers/acpi/namespace/nsutils.c @@ -43,10 +43,9 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "amlcode.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsutils") @@ -315,15 +314,9 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) * * strlen() + 1 covers the first name_seg, which has no path separator */ - if (acpi_ns_valid_root_prefix(*next_external_char)) { + if (acpi_ns_valid_root_prefix(next_external_char[0])) { info->fully_qualified = TRUE; next_external_char++; - - /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ - - while (acpi_ns_valid_root_prefix(*next_external_char)) { - next_external_char++; - } } else { /* * Handle Carat prefixes diff --git a/trunk/drivers/acpi/acpica/nswalk.c b/trunk/drivers/acpi/namespace/nswalk.c similarity index 99% rename from trunk/drivers/acpi/acpica/nswalk.c rename to trunk/drivers/acpi/namespace/nswalk.c index 200895fa2728..3c905ce26d7d 100644 --- a/trunk/drivers/acpi/acpica/nswalk.c +++ b/trunk/drivers/acpi/namespace/nswalk.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nswalk") diff --git a/trunk/drivers/acpi/acpica/nsxfeval.c b/trunk/drivers/acpi/namespace/nsxfeval.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsxfeval.c rename to trunk/drivers/acpi/namespace/nsxfeval.c index 22a7171ac1ed..a085cc39c055 100644 --- a/trunk/drivers/acpi/acpica/nsxfeval.c +++ b/trunk/drivers/acpi/namespace/nsxfeval.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsxfeval") diff --git a/trunk/drivers/acpi/acpica/nsxfname.c b/trunk/drivers/acpi/namespace/nsxfname.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsxfname.c rename to trunk/drivers/acpi/namespace/nsxfname.c index 9589fea24997..5efa4e7ddb0b 100644 --- a/trunk/drivers/acpi/acpica/nsxfname.c +++ b/trunk/drivers/acpi/namespace/nsxfname.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsxfname") diff --git a/trunk/drivers/acpi/acpica/nsxfobj.c b/trunk/drivers/acpi/namespace/nsxfobj.c similarity index 99% rename from trunk/drivers/acpi/acpica/nsxfobj.c rename to trunk/drivers/acpi/namespace/nsxfobj.c index 1c7efc15225f..2b375ee80cef 100644 --- a/trunk/drivers/acpi/acpica/nsxfobj.c +++ b/trunk/drivers/acpi/namespace/nsxfobj.c @@ -43,8 +43,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsxfobj") diff --git a/trunk/drivers/acpi/numa.c b/trunk/drivers/acpi/numa.c index c5e292aab0e3..25ceae9191ef 100644 --- a/trunk/drivers/acpi/numa.c +++ b/trunk/drivers/acpi/numa.c @@ -29,6 +29,7 @@ #include #include #include +#include #define ACPI_NUMA 0x80000000 #define _COMPONENT ACPI_NUMA diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 6729a4992f2b..c8111424dcb8 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -726,7 +726,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); if (!dpc) - return AE_NO_MEMORY; + return_ACPI_STATUS(AE_NO_MEMORY); dpc->function = function; dpc->context = context; @@ -747,7 +747,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, status = AE_ERROR; kfree(dpc); } - return status; + return_ACPI_STATUS(status); } acpi_status acpi_os_execute(acpi_execute_type type, diff --git a/trunk/drivers/acpi/parser/Makefile b/trunk/drivers/acpi/parser/Makefile new file mode 100644 index 000000000000..db24ee09cf11 --- /dev/null +++ b/trunk/drivers/acpi/parser/Makefile @@ -0,0 +1,8 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := psargs.o psparse.o psloop.o pstree.o pswalk.o \ + psopcode.o psscope.o psutils.o psxface.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/psargs.c b/trunk/drivers/acpi/parser/psargs.c similarity index 99% rename from trunk/drivers/acpi/acpica/psargs.c rename to trunk/drivers/acpi/parser/psargs.c index b161f3544b51..d830b29b85b1 100644 --- a/trunk/drivers/acpi/acpica/psargs.c +++ b/trunk/drivers/acpi/parser/psargs.c @@ -42,11 +42,10 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" +#include +#include +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psargs") diff --git a/trunk/drivers/acpi/acpica/psloop.c b/trunk/drivers/acpi/parser/psloop.c similarity index 99% rename from trunk/drivers/acpi/acpica/psloop.c rename to trunk/drivers/acpi/parser/psloop.c index c5f6ce19a401..4647039a0d8a 100644 --- a/trunk/drivers/acpi/acpica/psloop.c +++ b/trunk/drivers/acpi/parser/psloop.c @@ -50,10 +50,9 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" +#include +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psloop") diff --git a/trunk/drivers/acpi/acpica/psopcode.c b/trunk/drivers/acpi/parser/psopcode.c similarity index 99% rename from trunk/drivers/acpi/acpica/psopcode.c rename to trunk/drivers/acpi/parser/psopcode.c index 3bc3a60194d6..f425ab30eae8 100644 --- a/trunk/drivers/acpi/acpica/psopcode.c +++ b/trunk/drivers/acpi/parser/psopcode.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acopcode.h" -#include "amlcode.h" +#include +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psopcode") diff --git a/trunk/drivers/acpi/acpica/psparse.c b/trunk/drivers/acpi/parser/psparse.c similarity index 97% rename from trunk/drivers/acpi/acpica/psparse.c rename to trunk/drivers/acpi/parser/psparse.c index 70838e9b608c..68e932f215ea 100644 --- a/trunk/drivers/acpi/acpica/psparse.c +++ b/trunk/drivers/acpi/parser/psparse.c @@ -51,12 +51,11 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include +#include +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psparse") @@ -448,22 +447,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); - if (!walk_state->parser_state.aml) { - return_ACPI_STATUS(AE_NULL_OBJECT); - } - /* Create and initialize a new thread state */ thread = acpi_ut_create_thread_state(); if (!thread) { - if (walk_state->method_desc) { - - /* Executing a control method - additional cleanup */ - - acpi_ds_terminate_control_method( - walk_state->method_desc, walk_state); - } - acpi_ds_delete_walk_state(walk_state); return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/trunk/drivers/acpi/acpica/psscope.c b/trunk/drivers/acpi/parser/psscope.c similarity index 99% rename from trunk/drivers/acpi/acpica/psscope.c rename to trunk/drivers/acpi/parser/psscope.c index 2feca5ca9581..ee50e67c9443 100644 --- a/trunk/drivers/acpi/acpica/psscope.c +++ b/trunk/drivers/acpi/parser/psscope.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acparser.h" +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psscope") diff --git a/trunk/drivers/acpi/acpica/pstree.c b/trunk/drivers/acpi/parser/pstree.c similarity index 99% rename from trunk/drivers/acpi/acpica/pstree.c rename to trunk/drivers/acpi/parser/pstree.c index 4d3389118ec3..1dd355ddd182 100644 --- a/trunk/drivers/acpi/acpica/pstree.c +++ b/trunk/drivers/acpi/parser/pstree.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("pstree") diff --git a/trunk/drivers/acpi/acpica/psutils.c b/trunk/drivers/acpi/parser/psutils.c similarity index 99% rename from trunk/drivers/acpi/acpica/psutils.c rename to trunk/drivers/acpi/parser/psutils.c index e636e078ad3d..7cf1f65cd5bb 100644 --- a/trunk/drivers/acpi/acpica/psutils.c +++ b/trunk/drivers/acpi/parser/psutils.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "amlcode.h" +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psutils") diff --git a/trunk/drivers/acpi/acpica/pswalk.c b/trunk/drivers/acpi/parser/pswalk.c similarity index 98% rename from trunk/drivers/acpi/acpica/pswalk.c rename to trunk/drivers/acpi/parser/pswalk.c index 78b8b791f2ae..8b86ad5a3201 100644 --- a/trunk/drivers/acpi/acpica/pswalk.c +++ b/trunk/drivers/acpi/parser/pswalk.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acparser.h" +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("pswalk") diff --git a/trunk/drivers/acpi/acpica/psxface.c b/trunk/drivers/acpi/parser/psxface.c similarity index 90% rename from trunk/drivers/acpi/acpica/psxface.c rename to trunk/drivers/acpi/parser/psxface.c index ff06032c0f06..270469aae842 100644 --- a/trunk/drivers/acpi/acpica/psxface.c +++ b/trunk/drivers/acpi/parser/psxface.c @@ -42,11 +42,9 @@ */ #include -#include "accommon.h" -#include "acparser.h" -#include "acdispat.h" -#include "acinterp.h" -#include "amlcode.h" +#include +#include +#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psxface") @@ -280,38 +278,6 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) goto cleanup; } - /* Invoke an internal method if necessary */ - - if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { - status = info->obj_desc->method.implementation(walk_state); - info->return_object = walk_state->return_desc; - - /* Cleanup states */ - - acpi_ds_scope_stack_clear(walk_state); - acpi_ps_cleanup_scope(&walk_state->parser_state); - acpi_ds_terminate_control_method(walk_state->method_desc, - walk_state); - acpi_ds_delete_walk_state(walk_state); - goto cleanup; - } - - /* - * Start method evaluation with an implicit return of zero. - * This is done for Windows compatibility. - */ - if (acpi_gbl_enable_interpreter_slack) { - walk_state->implicit_return_obj = - acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); - if (!walk_state->implicit_return_obj) { - status = AE_NO_MEMORY; - acpi_ds_delete_walk_state(walk_state); - goto cleanup; - } - - walk_state->implicit_return_obj->integer.value = 0; - } - /* Parse the AML */ status = acpi_ps_parse_aml(walk_state); diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 1c6e73c7865e..e52ad91ce2dc 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -796,6 +796,10 @@ static int irqrouter_resume(struct sys_device *dev) struct list_head *node = NULL; struct acpi_pci_link *link = NULL; + + /* Make sure SCI is enabled again (Apple firmware bug?) */ + acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1); + list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { @@ -908,7 +912,7 @@ static int __init acpi_irq_nobalance_set(char *str) __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); -static int __init acpi_irq_balance_set(char *str) +int __init acpi_irq_balance_set(char *str) { acpi_irq_balance = 1; return 1; diff --git a/trunk/drivers/acpi/power.c b/trunk/drivers/acpi/power.c index c926e7d4a0d6..bb7d50dd2818 100644 --- a/trunk/drivers/acpi/power.c +++ b/trunk/drivers/acpi/power.c @@ -139,8 +139,6 @@ static int acpi_power_get_state(acpi_handle handle, int *state) { acpi_status status = AE_OK; unsigned long long sta = 0; - char node_name[5]; - struct acpi_buffer buffer = { sizeof(node_name), node_name }; if (!handle || !state) @@ -153,10 +151,8 @@ static int acpi_power_get_state(acpi_handle handle, int *state) *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON: ACPI_POWER_RESOURCE_STATE_OFF; - acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", - node_name, + acpi_ut_get_node_name(handle), *state ? "on" : "off")); return 0; diff --git a/trunk/drivers/acpi/reboot.c b/trunk/drivers/acpi/reboot.c index 93f91142d7ad..a6b662c00b67 100644 --- a/trunk/drivers/acpi/reboot.c +++ b/trunk/drivers/acpi/reboot.c @@ -42,7 +42,7 @@ void acpi_reboot(void) case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_IO: printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); - acpi_reset(); + acpi_hw_low_level_write(8, reset_value, rr); break; } /* Wait ten seconds */ diff --git a/trunk/drivers/acpi/resources/Makefile b/trunk/drivers/acpi/resources/Makefile new file mode 100644 index 000000000000..8de4f69dfa09 --- /dev/null +++ b/trunk/drivers/acpi/resources/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ + rscalc.o rsirq.o rsmemory.o rsutils.o + +obj-$(ACPI_FUTURE_USAGE) += rsdump.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/rsaddr.c b/trunk/drivers/acpi/resources/rsaddr.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsaddr.c rename to trunk/drivers/acpi/resources/rsaddr.c index 1e437bfd8db5..7f96332822bf 100644 --- a/trunk/drivers/acpi/acpica/rsaddr.c +++ b/trunk/drivers/acpi/resources/rsaddr.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsaddr") diff --git a/trunk/drivers/acpi/acpica/rscalc.c b/trunk/drivers/acpi/resources/rscalc.c similarity index 99% rename from trunk/drivers/acpi/acpica/rscalc.c rename to trunk/drivers/acpi/resources/rscalc.c index 52865ee6bc77..8eaaecf92009 100644 --- a/trunk/drivers/acpi/acpica/rscalc.c +++ b/trunk/drivers/acpi/resources/rscalc.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscalc") diff --git a/trunk/drivers/acpi/acpica/rscreate.c b/trunk/drivers/acpi/resources/rscreate.c similarity index 99% rename from trunk/drivers/acpi/acpica/rscreate.c rename to trunk/drivers/acpi/resources/rscreate.c index 9eb3a2a68408..c0bbfa2c4193 100644 --- a/trunk/drivers/acpi/acpica/rscreate.c +++ b/trunk/drivers/acpi/resources/rscreate.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscreate") diff --git a/trunk/drivers/acpi/acpica/rsdump.c b/trunk/drivers/acpi/resources/rsdump.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsdump.c rename to trunk/drivers/acpi/resources/rsdump.c index 3f0ca5a12d34..6bbbb7b8941a 100644 --- a/trunk/drivers/acpi/acpica/rsdump.c +++ b/trunk/drivers/acpi/resources/rsdump.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsdump") diff --git a/trunk/drivers/acpi/acpica/rsinfo.c b/trunk/drivers/acpi/resources/rsinfo.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsinfo.c rename to trunk/drivers/acpi/resources/rsinfo.c index 77b25fdb459c..3f0a1fedbe0e 100644 --- a/trunk/drivers/acpi/acpica/rsinfo.c +++ b/trunk/drivers/acpi/resources/rsinfo.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsinfo") diff --git a/trunk/drivers/acpi/acpica/rsio.c b/trunk/drivers/acpi/resources/rsio.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsio.c rename to trunk/drivers/acpi/resources/rsio.c index 35a49aa95609..b66d42e7402e 100644 --- a/trunk/drivers/acpi/acpica/rsio.c +++ b/trunk/drivers/acpi/resources/rsio.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsio") diff --git a/trunk/drivers/acpi/acpica/rsirq.c b/trunk/drivers/acpi/resources/rsirq.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsirq.c rename to trunk/drivers/acpi/resources/rsirq.c index 2e0256983aa6..a8805efc0366 100644 --- a/trunk/drivers/acpi/acpica/rsirq.c +++ b/trunk/drivers/acpi/resources/rsirq.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsirq") diff --git a/trunk/drivers/acpi/acpica/rslist.c b/trunk/drivers/acpi/resources/rslist.c similarity index 99% rename from trunk/drivers/acpi/acpica/rslist.c rename to trunk/drivers/acpi/resources/rslist.c index 1b1dbc69f087..b78c7e797a19 100644 --- a/trunk/drivers/acpi/acpica/rslist.c +++ b/trunk/drivers/acpi/resources/rslist.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rslist") diff --git a/trunk/drivers/acpi/acpica/rsmemory.c b/trunk/drivers/acpi/resources/rsmemory.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsmemory.c rename to trunk/drivers/acpi/resources/rsmemory.c index ddc76cebdc92..63b21abd90bb 100644 --- a/trunk/drivers/acpi/acpica/rsmemory.c +++ b/trunk/drivers/acpi/resources/rsmemory.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsmemory") diff --git a/trunk/drivers/acpi/acpica/rsmisc.c b/trunk/drivers/acpi/resources/rsmisc.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsmisc.c rename to trunk/drivers/acpi/resources/rsmisc.c index 5bc49a553284..96a6c0353255 100644 --- a/trunk/drivers/acpi/acpica/rsmisc.c +++ b/trunk/drivers/acpi/resources/rsmisc.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acresrc.h" +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsmisc") diff --git a/trunk/drivers/acpi/acpica/rsutils.c b/trunk/drivers/acpi/resources/rsutils.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsutils.c rename to trunk/drivers/acpi/resources/rsutils.c index bc03d5966829..f7b3bcd59ba7 100644 --- a/trunk/drivers/acpi/acpica/rsutils.c +++ b/trunk/drivers/acpi/resources/rsutils.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acresrc.h" +#include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsutils") diff --git a/trunk/drivers/acpi/acpica/rsxface.c b/trunk/drivers/acpi/resources/rsxface.c similarity index 99% rename from trunk/drivers/acpi/acpica/rsxface.c rename to trunk/drivers/acpi/resources/rsxface.c index 69a2aa5b5d83..f59f4c4e034c 100644 --- a/trunk/drivers/acpi/acpica/rsxface.c +++ b/trunk/drivers/acpi/resources/rsxface.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acresrc.h" -#include "acnamesp.h" +#include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsxface") diff --git a/trunk/drivers/acpi/sbshc.c b/trunk/drivers/acpi/sbshc.c index 0619734895b2..e53e590252c0 100644 --- a/trunk/drivers/acpi/sbshc.c +++ b/trunk/drivers/acpi/sbshc.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index c54d7b6c4066..39b7233c3485 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -10,6 +10,7 @@ #include #include +#include /* for acpi_ex_eisa_id_to_string() */ #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME("scan"); diff --git a/trunk/drivers/acpi/sleep/Makefile b/trunk/drivers/acpi/sleep/Makefile new file mode 100644 index 000000000000..f1fb888c2d29 --- /dev/null +++ b/trunk/drivers/acpi/sleep/Makefile @@ -0,0 +1,5 @@ +obj-y := wakeup.o +obj-y += main.o +obj-$(CONFIG_ACPI_SLEEP) += proc.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/main.c b/trunk/drivers/acpi/sleep/main.c similarity index 98% rename from trunk/drivers/acpi/main.c rename to trunk/drivers/acpi/sleep/main.c index d8242772de92..28a691cc625e 100644 --- a/trunk/drivers/acpi/main.c +++ b/trunk/drivers/acpi/sleep/main.c @@ -107,7 +107,7 @@ static bool set_sci_en_on_resume; */ static int acpi_pm_disable_gpes(void) { - acpi_disable_all_gpes(); + acpi_hw_disable_all_gpes(); return 0; } @@ -135,7 +135,7 @@ static int acpi_pm_prepare(void) int error = __acpi_pm_prepare(); if (!error) - acpi_disable_all_gpes(); + acpi_hw_disable_all_gpes(); return error; } @@ -267,7 +267,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) * (like wakeup GPE) haven't handler, this can avoid such GPE misfire. * acpi_leave_sleep_state will reenable specific GPEs later */ - acpi_disable_all_gpes(); + acpi_hw_disable_all_gpes(); local_irq_restore(flags); printk(KERN_DEBUG "Back to C!\n"); @@ -436,7 +436,7 @@ static void acpi_hibernation_leave(void) static void acpi_pm_enable_gpes(void) { - acpi_enable_all_runtime_gpes(); + acpi_hw_enable_all_runtime_gpes(); } static struct platform_hibernation_ops acpi_hibernation_ops = { @@ -622,7 +622,7 @@ static void acpi_power_off_prepare(void) { /* Prepare to power off the system */ acpi_sleep_prepare(ACPI_STATE_S5); - acpi_disable_all_gpes(); + acpi_hw_disable_all_gpes(); } static void acpi_power_off(void) @@ -671,7 +671,7 @@ int __init acpi_sleep_init(void) sleep_states[ACPI_STATE_S4] = 1; printk(" S4"); if (!nosigcheck) { - acpi_get_table(ACPI_SIG_FACS, 1, + acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, (struct acpi_table_header **)&facs); if (facs) s4_hardware_signature = diff --git a/trunk/drivers/acpi/proc.c b/trunk/drivers/acpi/sleep/proc.c similarity index 92% rename from trunk/drivers/acpi/proc.c rename to trunk/drivers/acpi/sleep/proc.c index 428c911dba08..4dbc2271acf5 100644 --- a/trunk/drivers/acpi/proc.c +++ b/trunk/drivers/acpi/sleep/proc.c @@ -28,6 +28,8 @@ static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) { int i; + ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show"); + for (i = 0; i <= ACPI_STATE_S5; i++) { if (sleep_states[i]) { seq_printf(seq, "S%d ", i); @@ -84,44 +86,49 @@ acpi_system_write_sleep(struct file *file, #ifdef HAVE_ACPI_LEGACY_ALARM -static u32 cmos_bcd_read(int offset, int rtc_control); - static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) { u32 sec, min, hr; u32 day, mo, yr, cent = 0; - u32 today = 0; unsigned char rtc_control = 0; unsigned long flags; + ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show"); + spin_lock_irqsave(&rtc_lock, flags); + sec = CMOS_READ(RTC_SECONDS_ALARM); + min = CMOS_READ(RTC_MINUTES_ALARM); + hr = CMOS_READ(RTC_HOURS_ALARM); rtc_control = CMOS_READ(RTC_CONTROL); - sec = cmos_bcd_read(RTC_SECONDS_ALARM, rtc_control); - min = cmos_bcd_read(RTC_MINUTES_ALARM, rtc_control); - hr = cmos_bcd_read(RTC_HOURS_ALARM, rtc_control); /* If we ever get an FACP with proper values... */ - if (acpi_gbl_FADT.day_alarm) { + if (acpi_gbl_FADT.day_alarm) /* ACPI spec: only low 6 its should be cared */ day = CMOS_READ(acpi_gbl_FADT.day_alarm) & 0x3F; - if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - day = bcd2bin(day); - } else - day = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control); + else + day = CMOS_READ(RTC_DAY_OF_MONTH); if (acpi_gbl_FADT.month_alarm) - mo = cmos_bcd_read(acpi_gbl_FADT.month_alarm, rtc_control); - else { - mo = cmos_bcd_read(RTC_MONTH, rtc_control); - today = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control); - } + mo = CMOS_READ(acpi_gbl_FADT.month_alarm); + else + mo = CMOS_READ(RTC_MONTH); if (acpi_gbl_FADT.century) - cent = cmos_bcd_read(acpi_gbl_FADT.century, rtc_control); + cent = CMOS_READ(acpi_gbl_FADT.century); - yr = cmos_bcd_read(RTC_YEAR, rtc_control); + yr = CMOS_READ(RTC_YEAR); spin_unlock_irqrestore(&rtc_lock, flags); + if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + sec = bcd2bin(sec); + min = bcd2bin(min); + hr = bcd2bin(hr); + day = bcd2bin(day); + mo = bcd2bin(mo); + yr = bcd2bin(yr); + cent = bcd2bin(cent); + } + /* we're trusting the FADT (see above) */ if (!acpi_gbl_FADT.century) /* If we're not trusting the FADT, we should at least make it @@ -146,20 +153,6 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) else yr += cent * 100; - /* - * Show correct dates for alarms up to a month into the future. - * This solves issues for nearly all situations with the common - * 30-day alarm clocks in PC hardware. - */ - if (day < today) { - if (mo < 12) { - mo += 1; - } else { - mo = 1; - yr += 1; - } - } - seq_printf(seq, "%4.4u-", yr); (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day); @@ -234,11 +227,13 @@ acpi_system_write_alarm(struct file *file, int adjust = 0; unsigned char rtc_control = 0; + ACPI_FUNCTION_TRACE("acpi_system_write_alarm"); + if (count > sizeof(alarm_string) - 1) - return -EINVAL; + return_VALUE(-EINVAL); if (copy_from_user(alarm_string, buffer, count)) - return -EFAULT; + return_VALUE(-EFAULT); alarm_string[count] = '\0'; @@ -339,7 +334,7 @@ acpi_system_write_alarm(struct file *file, result = 0; end: - return result ? result : count; + return_VALUE(result ? result : count); } #endif /* HAVE_ACPI_LEGACY_ALARM */ diff --git a/trunk/drivers/acpi/sleep.h b/trunk/drivers/acpi/sleep/sleep.h similarity index 100% rename from trunk/drivers/acpi/sleep.h rename to trunk/drivers/acpi/sleep/sleep.h diff --git a/trunk/drivers/acpi/wakeup.c b/trunk/drivers/acpi/sleep/wakeup.c similarity index 96% rename from trunk/drivers/acpi/wakeup.c rename to trunk/drivers/acpi/sleep/wakeup.c index 2d34806d45dd..dea4c23df764 100644 --- a/trunk/drivers/acpi/wakeup.c +++ b/trunk/drivers/acpi/sleep/wakeup.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "sleep.h" #define _COMPONENT ACPI_SYSTEM_COMPONENT @@ -27,6 +28,8 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) { struct list_head *node, *next; + ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_prep"); + spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = container_of(node, @@ -58,6 +61,7 @@ void acpi_enable_wakeup_device(u8 sleep_state) * Caution: this routine must be invoked when interrupt is disabled * Refer ACPI2.0: P212 */ + ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = @@ -99,6 +103,8 @@ void acpi_disable_wakeup_device(u8 sleep_state) { struct list_head *node, *next; + ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device"); + spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = diff --git a/trunk/drivers/acpi/system.c b/trunk/drivers/acpi/system.c index 391d0358a592..6e4107f82403 100644 --- a/trunk/drivers/acpi/system.c +++ b/trunk/drivers/acpi/system.c @@ -192,6 +192,65 @@ static struct attribute_group interrupt_stats_attr_group = { }; static struct kobj_attribute *counter_attrs; +static int count_num_gpes(void) +{ + int count = 0; + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + struct acpi_gpe_block_info *gpe_block; + acpi_cpu_flags flags; + + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); + + gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; + while (gpe_xrupt_info) { + gpe_block = gpe_xrupt_info->gpe_block_list_head; + while (gpe_block) { + count += gpe_block->register_count * + ACPI_GPE_REGISTER_WIDTH; + gpe_block = gpe_block->next; + } + gpe_xrupt_info = gpe_xrupt_info->next; + } + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); + + return count; +} + +static int get_gpe_device(int index, acpi_handle *handle) +{ + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + struct acpi_gpe_block_info *gpe_block; + acpi_cpu_flags flags; + struct acpi_namespace_node *node; + + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); + + gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; + while (gpe_xrupt_info) { + gpe_block = gpe_xrupt_info->gpe_block_list_head; + node = gpe_block->node; + while (gpe_block) { + index -= gpe_block->register_count * + ACPI_GPE_REGISTER_WIDTH; + if (index < 0) { + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); + /* return NULL if it's FADT GPE */ + if (node->type != ACPI_TYPE_DEVICE) + *handle = NULL; + else + *handle = node; + return 0; + } + node = gpe_block->node; + gpe_block = gpe_block->next; + } + gpe_xrupt_info = gpe_xrupt_info->next; + } + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); + + return -ENODEV; +} + static void delete_gpe_attr_array(void) { struct event_counter *tmp = all_counters; @@ -250,7 +309,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) goto end; if (index < num_gpes) { - result = acpi_get_gpe_device(index, handle); + result = get_gpe_device(index, handle); if (result) { ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, "Invalid GPE 0x%x\n", index)); @@ -377,7 +436,7 @@ void acpi_irq_stats_init(void) if (all_counters) return; - num_gpes = acpi_current_gpe_count; + num_gpes = count_num_gpes(); num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), diff --git a/trunk/drivers/acpi/tables/Makefile b/trunk/drivers/acpi/tables/Makefile new file mode 100644 index 000000000000..7385efa61622 --- /dev/null +++ b/trunk/drivers/acpi/tables/Makefile @@ -0,0 +1,7 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/tbfadt.c b/trunk/drivers/acpi/tables/tbfadt.c similarity index 67% rename from trunk/drivers/acpi/acpica/tbfadt.c rename to trunk/drivers/acpi/tables/tbfadt.c index 3636e4f8fb73..2817158fb6a1 100644 --- a/trunk/drivers/acpi/acpica/tbfadt.c +++ b/trunk/drivers/acpi/tables/tbfadt.c @@ -42,16 +42,15 @@ */ #include -#include "accommon.h" -#include "actables.h" +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbfadt") /* Local prototypes */ -static inline void +static void inline acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, - u8 space_id, u8 byte_width, u64 address); + u8 byte_width, u64 address); static void acpi_tb_convert_fadt(void); @@ -61,10 +60,9 @@ static void acpi_tb_validate_fadt(void); typedef struct acpi_fadt_info { char *name; - u8 address64; - u8 address32; + u8 target; + u8 source; u8 length; - u8 default_length; u8 type; } acpi_fadt_info; @@ -73,61 +71,37 @@ typedef struct acpi_fadt_info { #define ACPI_FADT_SEPARATE_LENGTH 2 static struct acpi_fadt_info fadt_info_table[] = { - {"Pm1aEventBlock", - ACPI_FADT_OFFSET(xpm1a_event_block), + {"Pm1aEventBlock", ACPI_FADT_OFFSET(xpm1a_event_block), ACPI_FADT_OFFSET(pm1a_event_block), - ACPI_FADT_OFFSET(pm1_event_length), - ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ - ACPI_FADT_REQUIRED}, + ACPI_FADT_OFFSET(pm1_event_length), ACPI_FADT_REQUIRED}, - {"Pm1bEventBlock", - ACPI_FADT_OFFSET(xpm1b_event_block), + {"Pm1bEventBlock", ACPI_FADT_OFFSET(xpm1b_event_block), ACPI_FADT_OFFSET(pm1b_event_block), - ACPI_FADT_OFFSET(pm1_event_length), - ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ - 0}, + ACPI_FADT_OFFSET(pm1_event_length), 0}, - {"Pm1aControlBlock", - ACPI_FADT_OFFSET(xpm1a_control_block), + {"Pm1aControlBlock", ACPI_FADT_OFFSET(xpm1a_control_block), ACPI_FADT_OFFSET(pm1a_control_block), - ACPI_FADT_OFFSET(pm1_control_length), - ACPI_PM1_REGISTER_WIDTH, - ACPI_FADT_REQUIRED}, + ACPI_FADT_OFFSET(pm1_control_length), ACPI_FADT_REQUIRED}, - {"Pm1bControlBlock", - ACPI_FADT_OFFSET(xpm1b_control_block), + {"Pm1bControlBlock", ACPI_FADT_OFFSET(xpm1b_control_block), ACPI_FADT_OFFSET(pm1b_control_block), - ACPI_FADT_OFFSET(pm1_control_length), - ACPI_PM1_REGISTER_WIDTH, - 0}, + ACPI_FADT_OFFSET(pm1_control_length), 0}, - {"Pm2ControlBlock", - ACPI_FADT_OFFSET(xpm2_control_block), + {"Pm2ControlBlock", ACPI_FADT_OFFSET(xpm2_control_block), ACPI_FADT_OFFSET(pm2_control_block), - ACPI_FADT_OFFSET(pm2_control_length), - ACPI_PM2_REGISTER_WIDTH, - ACPI_FADT_SEPARATE_LENGTH}, + ACPI_FADT_OFFSET(pm2_control_length), ACPI_FADT_SEPARATE_LENGTH}, - {"PmTimerBlock", - ACPI_FADT_OFFSET(xpm_timer_block), + {"PmTimerBlock", ACPI_FADT_OFFSET(xpm_timer_block), ACPI_FADT_OFFSET(pm_timer_block), - ACPI_FADT_OFFSET(pm_timer_length), - ACPI_PM_TIMER_WIDTH, - ACPI_FADT_REQUIRED}, + ACPI_FADT_OFFSET(pm_timer_length), ACPI_FADT_REQUIRED}, - {"Gpe0Block", - ACPI_FADT_OFFSET(xgpe0_block), + {"Gpe0Block", ACPI_FADT_OFFSET(xgpe0_block), ACPI_FADT_OFFSET(gpe0_block), - ACPI_FADT_OFFSET(gpe0_block_length), - 0, - ACPI_FADT_SEPARATE_LENGTH}, + ACPI_FADT_OFFSET(gpe0_block_length), ACPI_FADT_SEPARATE_LENGTH}, - {"Gpe1Block", - ACPI_FADT_OFFSET(xgpe1_block), + {"Gpe1Block", ACPI_FADT_OFFSET(xgpe1_block), ACPI_FADT_OFFSET(gpe1_block), - ACPI_FADT_OFFSET(gpe1_block_length), - 0, - ACPI_FADT_SEPARATE_LENGTH} + ACPI_FADT_OFFSET(gpe1_block_length), ACPI_FADT_SEPARATE_LENGTH} }; #define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) @@ -148,9 +122,9 @@ static struct acpi_fadt_info fadt_info_table[] = { * ******************************************************************************/ -static inline void +static void inline acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, - u8 space_id, u8 byte_width, u64 address) + u8 byte_width, u64 address) { /* @@ -161,10 +135,10 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, /* All other fields are byte-wide */ - generic_address->space_id = space_id; - generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); + generic_address->space_id = ACPI_ADR_SPACE_SYSTEM_IO; + generic_address->bit_width = byte_width << 3; generic_address->bit_offset = 0; - generic_address->access_width = 0; /* Access width ANY */ + generic_address->access_width = 0; } /******************************************************************************* @@ -251,8 +225,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) */ if (length > sizeof(struct acpi_table_fadt)) { ACPI_WARNING((AE_INFO, - "FADT (revision %u) is longer than ACPI 2.0 version, " - "truncating length 0x%X to 0x%zX", + "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%zX", table->revision, (unsigned)length, sizeof(struct acpi_table_fadt))); } @@ -271,6 +244,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) * 2) Validate some of the important values within the FADT */ acpi_tb_convert_fadt(); + acpi_tb_validate_fadt(); } /******************************************************************************* @@ -304,36 +278,22 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) static void acpi_tb_convert_fadt(void) { - u8 pm1_register_bit_width; - u8 pm1_register_byte_width; - struct acpi_generic_address *target64; + u8 pm1_register_length; + struct acpi_generic_address *target; u32 i; /* Update the local FADT table header length */ acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); - /* - * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. - * Later code will always use the X 64-bit field. Also, check for an - * address mismatch between the 32-bit and 64-bit address fields - * (FIRMWARE_CTRL/X_FIRMWARE_CTRL, DSDT/X_DSDT) which would indicate - * the presence of two FACS or two DSDT tables. - */ + /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */ + if (!acpi_gbl_FADT.Xfacs) { acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; - } else if (acpi_gbl_FADT.facs && - (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { - ACPI_WARNING((AE_INFO, - "32/64 FACS address mismatch in FADT - two FACS tables!")); } if (!acpi_gbl_FADT.Xdsdt) { acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; - } else if (acpi_gbl_FADT.dsdt && - (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { - ACPI_WARNING((AE_INFO, - "32/64 DSDT address mismatch in FADT - two DSDT tables!")); } /* @@ -352,23 +312,18 @@ static void acpi_tb_convert_fadt(void) } /* - * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" - * generic address structures as necessary. Later code will always use - * the 64-bit address structures. + * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X" + * generic address structures as necessary. */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { - target64 = + target = ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, - fadt_info_table[i].address64); + fadt_info_table[i].target); - /* Expand only if the 64-bit X target is null */ + /* Expand only if the X target is null */ - if (!target64->address) { - - /* The space_id is always I/O for the 32-bit legacy address fields */ - - acpi_tb_init_generic_address(target64, - ACPI_ADR_SPACE_SYSTEM_IO, + if (!target->address) { + acpi_tb_init_generic_address(target, *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, fadt_info_table @@ -377,63 +332,10 @@ static void acpi_tb_convert_fadt(void) &acpi_gbl_FADT, fadt_info_table [i]. - address32)); - } - } - - /* Validate FADT values now, before we make any changes */ - - acpi_tb_validate_fadt(); - - /* - * Optionally check all register lengths against the default values and - * update them if they are incorrect. - */ - if (acpi_gbl_use_default_register_widths) { - for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { - target64 = - ACPI_ADD_PTR(struct acpi_generic_address, - &acpi_gbl_FADT, - fadt_info_table[i].address64); - - /* - * If a valid register (Address != 0) and the (default_length > 0) - * (Not a GPE register), then check the width against the default. - */ - if ((target64->address) && - (fadt_info_table[i].default_length > 0) && - (fadt_info_table[i].default_length != - target64->bit_width)) { - ACPI_WARNING((AE_INFO, - "Invalid length for %s: %d, using default %d", - fadt_info_table[i].name, - target64->bit_width, - fadt_info_table[i]. - default_length)); - - /* Incorrect size, set width to the default */ - - target64->bit_width = - fadt_info_table[i].default_length; - } + source)); } } - /* - * Get the length of the individual PM1 registers (enable and status). - * Each register is defined to be (event block length / 2). - */ - pm1_register_bit_width = - (u8)ACPI_DIV_2(acpi_gbl_FADT.xpm1a_event_block.bit_width); - pm1_register_byte_width = (u8)ACPI_DIV_8(pm1_register_bit_width); - - /* - * Adjust the lengths of the PM1 Event Blocks so that they can be used to - * access the PM1 status register(s). Use (width / 2) - */ - acpi_gbl_FADT.xpm1a_event_block.bit_width = pm1_register_bit_width; - acpi_gbl_FADT.xpm1b_event_block.bit_width = pm1_register_bit_width; - /* * Calculate separate GAS structs for the PM1 Enable registers. * These addresses do not appear (directly) in the FADT, so it is @@ -454,14 +356,14 @@ static void acpi_tb_convert_fadt(void) " PM1_EVT_LEN (%u)\n", acpi_gbl_FADT.xpm1a_event_block.bit_width, acpi_gbl_FADT.pm1_event_length); + pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length); /* The PM1A register block is required */ acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, - acpi_gbl_FADT.xpm1a_event_block.space_id, - pm1_register_byte_width, + pm1_register_length, (acpi_gbl_FADT.xpm1a_event_block.address + - pm1_register_byte_width)); + pm1_register_length)); /* Don't forget to copy space_id of the GAS */ acpi_gbl_xpm1a_enable.space_id = acpi_gbl_FADT.xpm1a_event_block.space_id; @@ -477,10 +379,9 @@ static void acpi_tb_convert_fadt(void) acpi_gbl_FADT.xpm1b_event_block.bit_width, acpi_gbl_FADT.pm1_event_length); acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, - acpi_gbl_FADT.xpm1b_event_block.space_id, - pm1_register_byte_width, + pm1_register_length, (acpi_gbl_FADT.xpm1b_event_block. - address + pm1_register_byte_width)); + address + pm1_register_length)); /* Don't forget to copy space_id of the GAS */ acpi_gbl_xpm1b_enable.space_id = acpi_gbl_FADT.xpm1b_event_block.space_id; @@ -510,63 +411,26 @@ static void acpi_tb_convert_fadt(void) static void acpi_tb_validate_fadt(void) { - char *name; u32 *address32; struct acpi_generic_address *address64; u8 length; u32 i; - /* - * Check for FACS and DSDT address mismatches. An address mismatch between - * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and - * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. - */ - if (acpi_gbl_FADT.facs && - (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { - ACPI_WARNING((AE_INFO, - "32/64X FACS address mismatch in FADT - " - "two FACS tables! %8.8X/%8.8X%8.8X", - acpi_gbl_FADT.facs, - ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); - } - - if (acpi_gbl_FADT.dsdt && - (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { - ACPI_WARNING((AE_INFO, - "32/64X DSDT address mismatch in FADT - " - "two DSDT tables! %8.8X/%8.8X%8.8X", - acpi_gbl_FADT.dsdt, - ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); - } - /* Examine all of the 64-bit extended address fields (X fields) */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { - /* - * Generate pointers to the 32-bit and 64-bit addresses, get the - * register length (width), and the register name - */ - address64 = ACPI_ADD_PTR(struct acpi_generic_address, - &acpi_gbl_FADT, - fadt_info_table[i].address64); + + /* Generate pointers to the 32-bit and 64-bit addresses and get the length */ + + address64 = + ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, + fadt_info_table[i].target); address32 = ACPI_ADD_PTR(u32, &acpi_gbl_FADT, - fadt_info_table[i].address32); + fadt_info_table[i].source); length = *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, fadt_info_table[i].length); - name = fadt_info_table[i].name; - - /* - * For each extended field, check for length mismatch between the - * legacy length field and the corresponding 64-bit X length field. - */ - if (address64 && (address64->bit_width != ACPI_MUL_8(length))) { - ACPI_WARNING((AE_INFO, - "32/64X length mismatch in %s: %d/%d", - name, ACPI_MUL_8(length), - address64->bit_width)); - } if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { /* @@ -575,8 +439,8 @@ static void acpi_tb_validate_fadt(void) */ if (!address64->address || !length) { ACPI_ERROR((AE_INFO, - "Required field %s has zero address and/or length: %8.8X%8.8X/%X", - name, + "Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X", + fadt_info_table[i].name, ACPI_FORMAT_UINT64(address64-> address), length)); @@ -589,8 +453,8 @@ static void acpi_tb_validate_fadt(void) if ((address64->address && !length) || (!address64->address && length)) { ACPI_WARNING((AE_INFO, - "Optional field %s has zero address or length: %8.8X%8.8X/%X", - name, + "Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X", + fadt_info_table[i].name, ACPI_FORMAT_UINT64(address64-> address), length)); @@ -602,8 +466,8 @@ static void acpi_tb_validate_fadt(void) if (address64->address && *address32 && (address64->address != (u64) * address32)) { ACPI_ERROR((AE_INFO, - "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 64X", - name, *address32, + "32/64X address mismatch in \"%s\": [%8.8X] [%8.8X%8.8X], using 64X", + fadt_info_table[i].name, *address32, ACPI_FORMAT_UINT64(address64->address))); } } diff --git a/trunk/drivers/acpi/acpica/tbfind.c b/trunk/drivers/acpi/tables/tbfind.c similarity index 99% rename from trunk/drivers/acpi/acpica/tbfind.c rename to trunk/drivers/acpi/tables/tbfind.c index 1054dfd49207..531584defbb8 100644 --- a/trunk/drivers/acpi/acpica/tbfind.c +++ b/trunk/drivers/acpi/tables/tbfind.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "actables.h" +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbfind") diff --git a/trunk/drivers/acpi/acpica/tbinstal.c b/trunk/drivers/acpi/tables/tbinstal.c similarity index 99% rename from trunk/drivers/acpi/acpica/tbinstal.c rename to trunk/drivers/acpi/tables/tbinstal.c index 37374b21969d..18747ce8dd2f 100644 --- a/trunk/drivers/acpi/acpica/tbinstal.c +++ b/trunk/drivers/acpi/tables/tbinstal.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "actables.h" +#include +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbinstal") diff --git a/trunk/drivers/acpi/acpica/tbutils.c b/trunk/drivers/acpi/tables/tbutils.c similarity index 95% rename from trunk/drivers/acpi/acpica/tbutils.c rename to trunk/drivers/acpi/tables/tbutils.c index 9684cc827930..0cc92ef5236f 100644 --- a/trunk/drivers/acpi/acpica/tbutils.c +++ b/trunk/drivers/acpi/tables/tbutils.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "actables.h" +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbutils") @@ -112,30 +111,6 @@ acpi_tb_check_xsdt(acpi_physical_address address) return AE_OK; } -/******************************************************************************* - * - * FUNCTION: acpi_tb_initialize_facs - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global - * for accessing the Global Lock and Firmware Waking Vector - * - ******************************************************************************/ - -acpi_status acpi_tb_initialize_facs(void) -{ - acpi_status status; - - status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &acpi_gbl_FACS)); - return status; -} - /******************************************************************************* * * FUNCTION: acpi_tb_tables_loaded @@ -445,8 +420,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) /* Differentiate between RSDT and XSDT root tables */ - if (rsdp->revision > 1 && rsdp->xsdt_physical_address - && !acpi_rsdt_forced) { + if (rsdp->revision > 1 && rsdp->xsdt_physical_address) { /* * Root table is an XSDT (64-bit physical addresses). We must use the * XSDT if the revision is > 1 and the XSDT pointer is present, as per diff --git a/trunk/drivers/acpi/acpica/tbxface.c b/trunk/drivers/acpi/tables/tbxface.c similarity index 99% rename from trunk/drivers/acpi/acpica/tbxface.c rename to trunk/drivers/acpi/tables/tbxface.c index c3e841f3cde9..fd7770aa1061 100644 --- a/trunk/drivers/acpi/acpica/tbxface.c +++ b/trunk/drivers/acpi/tables/tbxface.c @@ -43,9 +43,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "actables.h" +#include +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbxface") diff --git a/trunk/drivers/acpi/acpica/tbxfroot.c b/trunk/drivers/acpi/tables/tbxfroot.c similarity index 99% rename from trunk/drivers/acpi/acpica/tbxfroot.c rename to trunk/drivers/acpi/tables/tbxfroot.c index b7fc8dd43341..2d157e0f98d2 100644 --- a/trunk/drivers/acpi/acpica/tbxfroot.c +++ b/trunk/drivers/acpi/tables/tbxfroot.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "actables.h" +#include #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbxfroot") diff --git a/trunk/drivers/acpi/utilities/Makefile b/trunk/drivers/acpi/utilities/Makefile new file mode 100644 index 000000000000..88eff14c4894 --- /dev/null +++ b/trunk/drivers/acpi/utilities/Makefile @@ -0,0 +1,9 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ + utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ + utstate.o utmutex.o utobject.o utcache.o utresrc.o + +EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/acpica/utalloc.c b/trunk/drivers/acpi/utilities/utalloc.c similarity index 99% rename from trunk/drivers/acpi/acpica/utalloc.c rename to trunk/drivers/acpi/utilities/utalloc.c index 7580f6b3069e..241c535c1753 100644 --- a/trunk/drivers/acpi/acpica/utalloc.c +++ b/trunk/drivers/acpi/utilities/utalloc.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acdebug.h" +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utalloc") diff --git a/trunk/drivers/acpi/utilities/utcache.c b/trunk/drivers/acpi/utilities/utcache.c new file mode 100644 index 000000000000..245fa80cf600 --- /dev/null +++ b/trunk/drivers/acpi/utilities/utcache.c @@ -0,0 +1,314 @@ +/****************************************************************************** + * + * Module Name: utcache - local cache allocation routines + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2008, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include + +#define _COMPONENT ACPI_UTILITIES +ACPI_MODULE_NAME("utcache") +#ifdef ACPI_USE_LOCAL_CACHE +/******************************************************************************* + * + * FUNCTION: acpi_os_create_cache + * + * PARAMETERS: cache_name - Ascii name for the cache + * object_size - Size of each cached object + * max_depth - Maximum depth of the cache (in objects) + * return_cache - Where the new cache object is returned + * + * RETURN: Status + * + * DESCRIPTION: Create a cache object + * + ******************************************************************************/ +acpi_status +acpi_os_create_cache(char *cache_name, + u16 object_size, + u16 max_depth, struct acpi_memory_list ** return_cache) +{ + struct acpi_memory_list *cache; + + ACPI_FUNCTION_ENTRY(); + + if (!cache_name || !return_cache || (object_size < 16)) { + return (AE_BAD_PARAMETER); + } + + /* Create the cache object */ + + cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); + if (!cache) { + return (AE_NO_MEMORY); + } + + /* Populate the cache object and return it */ + + ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); + cache->link_offset = 8; + cache->list_name = cache_name; + cache->object_size = object_size; + cache->max_depth = max_depth; + + *return_cache = cache; + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_purge_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache. + * + ******************************************************************************/ + +acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) +{ + char *next; + + ACPI_FUNCTION_ENTRY(); + + if (!cache) { + return (AE_BAD_PARAMETER); + } + + /* Walk the list of objects in this cache */ + + while (cache->list_head) { + + /* Delete and unlink one cached state object */ + + next = *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *)cache-> + list_head)[cache-> + link_offset]))); + ACPI_FREE(cache->list_head); + + cache->list_head = next; + cache->current_depth--; + } + + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_delete_cache + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: Status + * + * DESCRIPTION: Free all objects within the requested cache and delete the + * cache object. + * + ******************************************************************************/ + +acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) +{ + acpi_status status; + + ACPI_FUNCTION_ENTRY(); + + /* Purge all objects in the cache */ + + status = acpi_os_purge_cache(cache); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* Now we can delete the cache object */ + + ACPI_FREE(cache); + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_release_object + * + * PARAMETERS: Cache - Handle to cache object + * Object - The object to be released + * + * RETURN: None + * + * DESCRIPTION: Release an object to the specified cache. If cache is full, + * the object is deleted. + * + ******************************************************************************/ + +acpi_status +acpi_os_release_object(struct acpi_memory_list * cache, void *object) +{ + acpi_status status; + + ACPI_FUNCTION_ENTRY(); + + if (!cache || !object) { + return (AE_BAD_PARAMETER); + } + + /* If cache is full, just free this object */ + + if (cache->current_depth >= cache->max_depth) { + ACPI_FREE(object); + ACPI_MEM_TRACKING(cache->total_freed++); + } + + /* Otherwise put this object back into the cache */ + + else { + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { + return (status); + } + + /* Mark the object as cached */ + + ACPI_MEMSET(object, 0xCA, cache->object_size); + ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED); + + /* Put the object at the head of the cache list */ + + *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *)object)[cache-> + link_offset]))) = + cache->list_head; + cache->list_head = object; + cache->current_depth++; + + (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); + } + + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_os_acquire_object + * + * PARAMETERS: Cache - Handle to cache object + * + * RETURN: the acquired object. NULL on error + * + * DESCRIPTION: Get an object from the specified cache. If cache is empty, + * the object is allocated. + * + ******************************************************************************/ + +void *acpi_os_acquire_object(struct acpi_memory_list *cache) +{ + acpi_status status; + void *object; + + ACPI_FUNCTION_NAME(os_acquire_object); + + if (!cache) { + return (NULL); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { + return (NULL); + } + + ACPI_MEM_TRACKING(cache->requests++); + + /* Check the cache first */ + + if (cache->list_head) { + + /* There is an object available, use it */ + + object = cache->list_head; + cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char, + &(((char *) + object)[cache-> + link_offset]))); + + cache->current_depth--; + + ACPI_MEM_TRACKING(cache->hits++); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Object %p from %s cache\n", object, + cache->list_name)); + + status = acpi_ut_release_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { + return (NULL); + } + + /* Clear (zero) the previously used Object */ + + ACPI_MEMSET(object, 0, cache->object_size); + } else { + /* The cache is empty, create a new object */ + + ACPI_MEM_TRACKING(cache->total_allocated++); + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + if ((cache->total_allocated - cache->total_freed) > + cache->max_occupied) { + cache->max_occupied = + cache->total_allocated - cache->total_freed; + } +#endif + + /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ + + status = acpi_ut_release_mutex(ACPI_MTX_CACHES); + if (ACPI_FAILURE(status)) { + return (NULL); + } + + object = ACPI_ALLOCATE_ZEROED(cache->object_size); + if (!object) { + return (NULL); + } + } + + return (object); +} +#endif /* ACPI_USE_LOCAL_CACHE */ diff --git a/trunk/drivers/acpi/acpica/utcopy.c b/trunk/drivers/acpi/utilities/utcopy.c similarity index 99% rename from trunk/drivers/acpi/acpica/utcopy.c rename to trunk/drivers/acpi/utilities/utcopy.c index b0dcfd3c872a..5b2f7c27b705 100644 --- a/trunk/drivers/acpi/acpica/utcopy.c +++ b/trunk/drivers/acpi/utilities/utcopy.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_UTILITIES diff --git a/trunk/drivers/acpi/acpica/utdebug.c b/trunk/drivers/acpi/utilities/utdebug.c similarity index 89% rename from trunk/drivers/acpi/acpica/utdebug.c rename to trunk/drivers/acpi/utilities/utdebug.c index 38821f53042c..fd66ecb6741e 100644 --- a/trunk/drivers/acpi/acpica/utdebug.c +++ b/trunk/drivers/acpi/utilities/utdebug.c @@ -42,7 +42,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utdebug") @@ -137,7 +136,7 @@ static const char *acpi_ut_trim_function_name(const char *function_name) /******************************************************************************* * - * FUNCTION: acpi_debug_print + * FUNCTION: acpi_ut_debug_print * * PARAMETERS: requested_debug_level - Requested debug print level * line_number - Caller's line number (for error output) @@ -155,11 +154,11 @@ static const char *acpi_ut_trim_function_name(const char *function_name) ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print(u32 requested_debug_level, - u32 line_number, - const char *function_name, - const char *module_name, - u32 component_id, const char *format, ...) +acpi_ut_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + const char *module_name, + u32 component_id, const char *format, ...) { acpi_thread_id thread_id; va_list args; @@ -206,11 +205,11 @@ acpi_debug_print(u32 requested_debug_level, va_end(args); } -ACPI_EXPORT_SYMBOL(acpi_debug_print) +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) /******************************************************************************* * - * FUNCTION: acpi_debug_print_raw + * FUNCTION: acpi_ut_debug_print_raw * * PARAMETERS: requested_debug_level - Requested debug print level * line_number - Caller's line number @@ -227,11 +226,11 @@ ACPI_EXPORT_SYMBOL(acpi_debug_print) * ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print_raw(u32 requested_debug_level, - u32 line_number, - const char *function_name, - const char *module_name, - u32 component_id, const char *format, ...) +acpi_ut_debug_print_raw(u32 requested_debug_level, + u32 line_number, + const char *function_name, + const char *module_name, + u32 component_id, const char *format, ...) { va_list args; @@ -245,7 +244,7 @@ acpi_debug_print_raw(u32 requested_debug_level, va_end(args); } -ACPI_EXPORT_SYMBOL(acpi_debug_print_raw) +ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) /******************************************************************************* * @@ -271,9 +270,9 @@ acpi_ut_trace(u32 line_number, acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr(); - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s\n", acpi_gbl_fn_entry_str); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s\n", acpi_gbl_fn_entry_str); } ACPI_EXPORT_SYMBOL(acpi_ut_trace) @@ -302,9 +301,10 @@ acpi_ut_trace_ptr(u32 line_number, acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr(); - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %p\n", acpi_gbl_fn_entry_str, pointer); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %p\n", acpi_gbl_fn_entry_str, + pointer); } /******************************************************************************* @@ -333,9 +333,10 @@ acpi_ut_trace_str(u32 line_number, acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr(); - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %s\n", acpi_gbl_fn_entry_str, string); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %s\n", acpi_gbl_fn_entry_str, + string); } /******************************************************************************* @@ -364,9 +365,10 @@ acpi_ut_trace_u32(u32 line_number, acpi_gbl_nesting_level++; acpi_ut_track_stack_ptr(); - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %08X\n", acpi_gbl_fn_entry_str, integer); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %08X\n", acpi_gbl_fn_entry_str, + integer); } /******************************************************************************* @@ -391,9 +393,9 @@ acpi_ut_exit(u32 line_number, const char *module_name, u32 component_id) { - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s\n", acpi_gbl_fn_exit_str); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s\n", acpi_gbl_fn_exit_str); acpi_gbl_nesting_level--; } @@ -424,16 +426,17 @@ acpi_ut_status_exit(u32 line_number, { if (ACPI_SUCCESS(status)) { - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, - component_id, "%s %s\n", acpi_gbl_fn_exit_str, - acpi_format_exception(status)); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %s\n", + acpi_gbl_fn_exit_str, + acpi_format_exception(status)); } else { - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, - component_id, "%s ****Exception****: %s\n", - acpi_gbl_fn_exit_str, - acpi_format_exception(status)); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s ****Exception****: %s\n", + acpi_gbl_fn_exit_str, + acpi_format_exception(status)); } acpi_gbl_nesting_level--; @@ -464,10 +467,10 @@ acpi_ut_value_exit(u32 line_number, u32 component_id, acpi_integer value) { - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, - ACPI_FORMAT_UINT64(value)); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %8.8X%8.8X\n", + acpi_gbl_fn_exit_str, ACPI_FORMAT_UINT64(value)); acpi_gbl_nesting_level--; } @@ -496,9 +499,9 @@ acpi_ut_ptr_exit(u32 line_number, const char *module_name, u32 component_id, u8 *ptr) { - acpi_debug_print(ACPI_LV_FUNCTIONS, - line_number, function_name, module_name, component_id, - "%s %p\n", acpi_gbl_fn_exit_str, ptr); + acpi_ut_debug_print(ACPI_LV_FUNCTIONS, + line_number, function_name, module_name, + component_id, "%s %p\n", acpi_gbl_fn_exit_str, ptr); acpi_gbl_nesting_level--; } diff --git a/trunk/drivers/acpi/acpica/utdelete.c b/trunk/drivers/acpi/utilities/utdelete.c similarity index 99% rename from trunk/drivers/acpi/acpica/utdelete.c rename to trunk/drivers/acpi/utilities/utdelete.c index a0be9e39531e..d197c6b29e17 100644 --- a/trunk/drivers/acpi/acpica/utdelete.c +++ b/trunk/drivers/acpi/utilities/utdelete.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" +#include +#include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utdelete") diff --git a/trunk/drivers/acpi/acpica/uteval.c b/trunk/drivers/acpi/utilities/uteval.c similarity index 99% rename from trunk/drivers/acpi/acpica/uteval.c rename to trunk/drivers/acpi/utilities/uteval.c index da9450bc60f7..352747e49c7a 100644 --- a/trunk/drivers/acpi/acpica/uteval.c +++ b/trunk/drivers/acpi/utilities/uteval.c @@ -42,9 +42,8 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acinterp.h" +#include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("uteval") @@ -130,7 +129,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) /* The interface is supported */ - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_CTRL_TERMINATE); } } @@ -144,13 +143,13 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) /* The interface is supported */ - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_CTRL_TERMINATE); } /* The interface is not supported */ return_desc->integer.value = 0; - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_CTRL_TERMINATE); } /******************************************************************************* diff --git a/trunk/drivers/acpi/acpica/utglobal.c b/trunk/drivers/acpi/utilities/utglobal.c similarity index 99% rename from trunk/drivers/acpi/acpica/utglobal.c rename to trunk/drivers/acpi/utilities/utglobal.c index a3ab9d9da299..670551b95e56 100644 --- a/trunk/drivers/acpi/acpica/utglobal.c +++ b/trunk/drivers/acpi/utilities/utglobal.c @@ -44,11 +44,11 @@ #define DEFINE_ACPI_GLOBALS #include -#include "accommon.h" -#include "acnamesp.h" +#include +ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) #define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utglobal") + ACPI_MODULE_NAME("utglobal") /******************************************************************************* * @@ -64,7 +64,7 @@ u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; /* Debug switch - layer (component) mask */ -u32 acpi_dbg_layer = 0; +u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; u32 acpi_gbl_nesting_level = 0; /* Debugger globals */ @@ -352,7 +352,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "PCI_Config", "EmbeddedControl", "SMBus", - "SystemCMOS", + "CMOS", "PCIBARTarget", "DataTable" }; @@ -756,7 +756,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_gpe_xrupt_list_head = NULL; acpi_gbl_gpe_fadt_blocks[0] = NULL; acpi_gbl_gpe_fadt_blocks[1] = NULL; - acpi_current_gpe_count = 0; /* Global handlers */ @@ -772,7 +771,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_global_lock_mutex = NULL; acpi_gbl_global_lock_acquired = FALSE; acpi_gbl_global_lock_handle = 0; - acpi_gbl_global_lock_present = FALSE; /* Miscellaneous variables */ @@ -817,7 +815,5 @@ acpi_status acpi_ut_init_globals(void) return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) ACPI_EXPORT_SYMBOL(acpi_dbg_level) ACPI_EXPORT_SYMBOL(acpi_dbg_layer) -ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) diff --git a/trunk/drivers/acpi/acpica/utinit.c b/trunk/drivers/acpi/utilities/utinit.c similarity index 98% rename from trunk/drivers/acpi/acpica/utinit.c rename to trunk/drivers/acpi/utilities/utinit.c index a54ca84eb362..cae515fc02d3 100644 --- a/trunk/drivers/acpi/acpica/utinit.c +++ b/trunk/drivers/acpi/utilities/utinit.c @@ -42,10 +42,9 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" -#include "acevents.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utinit") diff --git a/trunk/drivers/acpi/acpica/utmath.c b/trunk/drivers/acpi/utilities/utmath.c similarity index 99% rename from trunk/drivers/acpi/acpica/utmath.c rename to trunk/drivers/acpi/utilities/utmath.c index c9f682d640ef..c927324fdd26 100644 --- a/trunk/drivers/acpi/acpica/utmath.c +++ b/trunk/drivers/acpi/utilities/utmath.c @@ -42,7 +42,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmath") diff --git a/trunk/drivers/acpi/acpica/utmisc.c b/trunk/drivers/acpi/utilities/utmisc.c similarity index 97% rename from trunk/drivers/acpi/acpica/utmisc.c rename to trunk/drivers/acpi/utilities/utmisc.c index c1f7f4e1a72d..9089a158a874 100644 --- a/trunk/drivers/acpi/acpica/utmisc.c +++ b/trunk/drivers/acpi/utilities/utmisc.c @@ -44,8 +44,7 @@ #include #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") @@ -1017,7 +1016,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, /******************************************************************************* * - * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info + * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) @@ -1030,7 +1029,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -acpi_error(const char *module_name, u32 line_number, const char *format, ...) +acpi_ut_error(const char *module_name, u32 line_number, const char *format, ...) { va_list args; @@ -1043,8 +1042,8 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...) } void ACPI_INTERNAL_VAR_XFACE -acpi_exception(const char *module_name, - u32 line_number, acpi_status status, const char *format, ...) +acpi_ut_exception(const char *module_name, + u32 line_number, acpi_status status, const char *format, ...) { va_list args; @@ -1057,8 +1056,11 @@ acpi_exception(const char *module_name, va_end(args); } +EXPORT_SYMBOL(acpi_ut_exception); + void ACPI_INTERNAL_VAR_XFACE -acpi_warning(const char *module_name, u32 line_number, const char *format, ...) +acpi_ut_warning(const char *module_name, + u32 line_number, const char *format, ...) { va_list args; @@ -1071,7 +1073,7 @@ acpi_warning(const char *module_name, u32 line_number, const char *format, ...) } void ACPI_INTERNAL_VAR_XFACE -acpi_info(const char *module_name, u32 line_number, const char *format, ...) +acpi_ut_info(const char *module_name, u32 line_number, const char *format, ...) { va_list args; @@ -1086,8 +1088,3 @@ acpi_info(const char *module_name, u32 line_number, const char *format, ...) acpi_os_printf("\n"); va_end(args); } - -ACPI_EXPORT_SYMBOL(acpi_error) -ACPI_EXPORT_SYMBOL(acpi_exception) -ACPI_EXPORT_SYMBOL(acpi_warning) -ACPI_EXPORT_SYMBOL(acpi_info) diff --git a/trunk/drivers/acpi/acpica/utmutex.c b/trunk/drivers/acpi/utilities/utmutex.c similarity index 99% rename from trunk/drivers/acpi/acpica/utmutex.c rename to trunk/drivers/acpi/utilities/utmutex.c index 14eb52c4d647..7331dde9e1b3 100644 --- a/trunk/drivers/acpi/acpica/utmutex.c +++ b/trunk/drivers/acpi/utilities/utmutex.c @@ -42,7 +42,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmutex") diff --git a/trunk/drivers/acpi/acpica/utobject.c b/trunk/drivers/acpi/utilities/utobject.c similarity index 99% rename from trunk/drivers/acpi/acpica/utobject.c rename to trunk/drivers/acpi/utilities/utobject.c index 4279ed3a8782..c354e7a42bcd 100644 --- a/trunk/drivers/acpi/acpica/utobject.c +++ b/trunk/drivers/acpi/utilities/utobject.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "acnamesp.h" +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utobject") diff --git a/trunk/drivers/acpi/acpica/utresrc.c b/trunk/drivers/acpi/utilities/utresrc.c similarity index 99% rename from trunk/drivers/acpi/acpica/utresrc.c rename to trunk/drivers/acpi/utilities/utresrc.c index 91b7c00236f4..c3e3e1308edc 100644 --- a/trunk/drivers/acpi/acpica/utresrc.c +++ b/trunk/drivers/acpi/utilities/utresrc.c @@ -42,8 +42,7 @@ */ #include -#include "accommon.h" -#include "amlresrc.h" +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utresrc") diff --git a/trunk/drivers/acpi/acpica/utstate.c b/trunk/drivers/acpi/utilities/utstate.c similarity index 99% rename from trunk/drivers/acpi/acpica/utstate.c rename to trunk/drivers/acpi/utilities/utstate.c index 0440c958f5a4..63a6d3d77d88 100644 --- a/trunk/drivers/acpi/acpica/utstate.c +++ b/trunk/drivers/acpi/utilities/utstate.c @@ -42,7 +42,6 @@ */ #include -#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utstate") diff --git a/trunk/drivers/acpi/acpica/utxface.c b/trunk/drivers/acpi/utilities/utxface.c similarity index 97% rename from trunk/drivers/acpi/acpica/utxface.c rename to trunk/drivers/acpi/utilities/utxface.c index 078a22728c6b..c198a4d40583 100644 --- a/trunk/drivers/acpi/acpica/utxface.c +++ b/trunk/drivers/acpi/utilities/utxface.c @@ -42,11 +42,9 @@ */ #include -#include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acdebug.h" -#include "actables.h" +#include +#include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utxface") @@ -149,16 +147,6 @@ acpi_status acpi_enable_subsystem(u32 flags) } } - /* - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ - status = acpi_tb_initialize_facs(); - if (ACPI_FAILURE(status)) { - ACPI_WARNING((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS(status); - } - /* * Install the default op_region handlers. These are installed unless * other handlers have already been installed via the diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index f261737636da..baa441929720 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -482,7 +481,6 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) int status = AE_OK; union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - int state; arg0.integer.value = level; @@ -491,10 +489,6 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL); device->brightness->curr = level; - for (state = 2; state < device->brightness->count; state++) - if (level == device->brightness->levels[state]) - device->backlight->props.brightness = state - 2; - return status; } @@ -631,16 +625,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) return status; } -/* - * Simple comparison function used to sort backlight levels. - */ - -static int -acpi_video_cmp_level(const void *a, const void *b) -{ - return *(int *)a - *(int *)b; -} - /* * Arg: * device : video output device (LCD, CRT, ..) @@ -692,10 +676,6 @@ acpi_video_init_brightness(struct acpi_video_device *device) count++; } - /* don't sort the first two brightness levels */ - sort(&br->levels[2], count - 2, sizeof(br->levels[2]), - acpi_video_cmp_level, NULL); - if (count < 2) goto out_free_levels; diff --git a/trunk/drivers/acpi/video_detect.c b/trunk/drivers/acpi/video_detect.c index 50e3d2dbf3af..f022eb6f5637 100644 --- a/trunk/drivers/acpi/video_detect.c +++ b/trunk/drivers/acpi/video_detect.c @@ -234,7 +234,7 @@ EXPORT_SYMBOL(acpi_video_display_switch_support); * To force that backlight or display output switching is processed by vendor * specific acpi drivers or video.ko driver. */ -static int __init acpi_backlight(char *str) +int __init acpi_backlight(char *str) { if (str == NULL || *str == '\0') return 1; @@ -250,7 +250,7 @@ static int __init acpi_backlight(char *str) } __setup("acpi_backlight=", acpi_backlight); -static int __init acpi_display_output(char *str) +int __init acpi_display_output(char *str) { if (str == NULL || *str == '\0') return 1; diff --git a/trunk/drivers/ata/libata-acpi.c b/trunk/drivers/ata/libata-acpi.c index 246987f0b88c..c012307d0ba6 100644 --- a/trunk/drivers/ata/libata-acpi.c +++ b/trunk/drivers/ata/libata-acpi.c @@ -19,6 +19,12 @@ #include "libata.h" #include +#include +#include +#include +#include +#include +#include enum { ATA_ACPI_FILTER_SETXFER = 1 << 0, diff --git a/trunk/drivers/ata/pata_acpi.c b/trunk/drivers/ata/pata_acpi.c index 8b77a9802df1..e2e332d8ff95 100644 --- a/trunk/drivers/ata/pata_acpi.c +++ b/trunk/drivers/ata/pata_acpi.c @@ -13,6 +13,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include diff --git a/trunk/drivers/block/cciss.c b/trunk/drivers/block/cciss.c index 9f7c543cc04b..9364dc554257 100644 --- a/trunk/drivers/block/cciss.c +++ b/trunk/drivers/block/cciss.c @@ -1693,11 +1693,6 @@ static int rebuild_lun_table(ctlr_info_t *h, int first_time) for (i = 0; i <= h->highest_lun; i++) { int j; drv_found = 0; - - /* skip holes in the array from already deleted drives */ - if (h->drv[i].raid_level == -1) - continue; - for (j = 0; j < num_luns; j++) { memcpy(&lunid, &ld_buff->LUN[j][0], 4); lunid = le32_to_cpu(lunid); diff --git a/trunk/drivers/char/tpm/tpm_bios.c b/trunk/drivers/char/tpm/tpm_bios.c index ed306eb1057f..68f052b42ed7 100644 --- a/trunk/drivers/char/tpm/tpm_bios.c +++ b/trunk/drivers/char/tpm/tpm_bios.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include "tpm.h" #define TCG_EVENT_NAME_LEN_MAX 255 diff --git a/trunk/drivers/cpuidle/governors/menu.c b/trunk/drivers/cpuidle/governors/menu.c index f1df59f59a37..8d7cf3f31450 100644 --- a/trunk/drivers/cpuidle/governors/menu.c +++ b/trunk/drivers/cpuidle/governors/menu.c @@ -15,14 +15,12 @@ #include #define BREAK_FUZZ 4 /* 4 us */ -#define PRED_HISTORY_PCT 50 struct menu_device { int last_state_idx; unsigned int expected_us; unsigned int predicted_us; - unsigned int current_predicted_us; unsigned int last_measured_us; unsigned int elapsed_us; }; @@ -49,12 +47,6 @@ static int menu_select(struct cpuidle_device *dev) data->expected_us = (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; - /* Recalculate predicted_us based on prediction_history_pct */ - data->predicted_us *= PRED_HISTORY_PCT; - data->predicted_us += (100 - PRED_HISTORY_PCT) * - data->current_predicted_us; - data->predicted_us /= 100; - /* find the deepest idle state that satisfies our constraints */ for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { struct cpuidle_state *s = &dev->states[i]; @@ -105,7 +97,7 @@ static void menu_reflect(struct cpuidle_device *dev) measured_us = -1; /* Predict time until next break event */ - data->current_predicted_us = max(measured_us, data->last_measured_us); + data->predicted_us = max(measured_us, data->last_measured_us); if (last_idle_us + BREAK_FUZZ < data->expected_us - target->exit_latency) { diff --git a/trunk/drivers/edac/edac_device.c b/trunk/drivers/edac/edac_device.c index 4041e9143283..5fcd3d89c75d 100644 --- a/trunk/drivers/edac/edac_device.c +++ b/trunk/drivers/edac/edac_device.c @@ -394,12 +394,6 @@ static void edac_device_workq_function(struct work_struct *work_req) mutex_lock(&device_ctls_mutex); - /* If we are being removed, bail out immediately */ - if (edac_dev->op_state == OP_OFFLINE) { - mutex_unlock(&device_ctls_mutex); - return; - } - /* Only poll controllers that are running polled and have a check */ if ((edac_dev->op_state == OP_RUNNING_POLL) && (edac_dev->edac_check != NULL)) { @@ -591,14 +585,14 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev) /* mark this instance as OFFLINE */ edac_dev->op_state = OP_OFFLINE; + /* clear workq processing on this instance */ + edac_device_workq_teardown(edac_dev); + /* deregister from global list */ del_edac_device_from_global_list(edac_dev); mutex_unlock(&device_ctls_mutex); - /* clear workq processing on this instance */ - edac_device_workq_teardown(edac_dev); - /* Tear down the sysfs entries for this instance */ edac_device_remove_sysfs(edac_dev); diff --git a/trunk/drivers/gpu/drm/i915/i915_dma.c b/trunk/drivers/gpu/drm/i915/i915_dma.c index afa8a12cd009..553dd4bc3075 100644 --- a/trunk/drivers/gpu/drm/i915/i915_dma.c +++ b/trunk/drivers/gpu/drm/i915/i915_dma.c @@ -717,7 +717,7 @@ static int i915_getparam(struct drm_device *dev, void *data, value = dev->pci_device; break; case I915_PARAM_HAS_GEM: - value = dev_priv->has_gem; + value = 1; break; default: DRM_ERROR("Unknown parameter %d\n", param->param); @@ -830,14 +830,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) dev_priv->regs = ioremap(base, size); -#ifdef CONFIG_HIGHMEM64G - /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */ - dev_priv->has_gem = 0; -#else - /* enable GEM by default */ - dev_priv->has_gem = 1; -#endif - i915_gem_load(dev); /* Init HWS */ diff --git a/trunk/drivers/gpu/drm/i915/i915_drv.h b/trunk/drivers/gpu/drm/i915/i915_drv.h index b3cc4731aa7c..adc972cc6bfc 100644 --- a/trunk/drivers/gpu/drm/i915/i915_drv.h +++ b/trunk/drivers/gpu/drm/i915/i915_drv.h @@ -106,8 +106,6 @@ struct intel_opregion { typedef struct drm_i915_private { struct drm_device *dev; - int has_gem; - void __iomem *regs; drm_local_map_t *sarea; diff --git a/trunk/drivers/gpu/drm/i915/i915_gem.c b/trunk/drivers/gpu/drm/i915/i915_gem.c index 24fe8c10b4b2..ad672d854828 100644 --- a/trunk/drivers/gpu/drm/i915/i915_gem.c +++ b/trunk/drivers/gpu/drm/i915/i915_gem.c @@ -2309,14 +2309,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, } obj_priv = obj->driver_private; - /* Don't count being on the flushing list against the object being - * done. Otherwise, a buffer left on the flushing list but not getting - * flushed (because nobody's flushing that domain) won't ever return - * unbusy and get reused by libdrm's bo cache. The other expected - * consumer of this interface, OpenGL's occlusion queries, also specs - * that the objects get unbusy "eventually" without any interference. - */ - args->busy = obj_priv->active && obj_priv->last_rendering_seqno != 0; + args->busy = obj_priv->active; drm_gem_object_unreference(obj); mutex_unlock(&dev->struct_mutex); diff --git a/trunk/drivers/gpu/drm/radeon/radeon_irq.c b/trunk/drivers/gpu/drm/radeon/radeon_irq.c index 8289e16419a8..99be11418ac2 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_irq.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_irq.c @@ -44,7 +44,7 @@ void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state) else dev_priv->irq_enable_reg &= ~mask; - if (dev->irq_enabled) + if (!dev->irq_enabled) RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg); } @@ -57,7 +57,7 @@ static void r500_vbl_irq_set_state(struct drm_device *dev, u32 mask, int state) else dev_priv->r500_disp_irq_reg &= ~mask; - if (dev->irq_enabled) + if (!dev->irq_enabled) RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg); } diff --git a/trunk/drivers/ide/cs5530.c b/trunk/drivers/ide/cs5530.c index d8ede85fe17f..53f079cc00af 100644 --- a/trunk/drivers/ide/cs5530.c +++ b/trunk/drivers/ide/cs5530.c @@ -81,12 +81,11 @@ static u8 cs5530_udma_filter(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; ide_drive_t *mate = ide_get_pair_dev(drive); - u16 *mateid; + u16 *mateid = mate->id; u8 mask = hwif->ultra_mask; if (mate == NULL) goto out; - mateid = mate->id; if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { if ((mateid[ATA_ID_FIELD_VALID] & 4) && diff --git a/trunk/drivers/ide/ide-acpi.c b/trunk/drivers/ide/ide-acpi.c index 9e8d52a4f306..244a8a052ce8 100644 --- a/trunk/drivers/ide/ide-acpi.c +++ b/trunk/drivers/ide/ide-acpi.c @@ -18,6 +18,12 @@ #include #include +#include +#include +#include +#include +#include +#include #define REGS_PER_GTF 7 struct taskfile_array { diff --git a/trunk/drivers/ide/sc1200.c b/trunk/drivers/ide/sc1200.c index ec7f766ef5e4..f1a8758e3a99 100644 --- a/trunk/drivers/ide/sc1200.c +++ b/trunk/drivers/ide/sc1200.c @@ -104,12 +104,11 @@ static u8 sc1200_udma_filter(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; ide_drive_t *mate = ide_get_pair_dev(drive); - u16 *mateid; + u16 *mateid = mate->id; u8 mask = hwif->ultra_mask; if (mate == NULL) goto out; - mateid = mate->id; if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { if ((mateid[ATA_ID_FIELD_VALID] & 4) && diff --git a/trunk/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index ab7c8e4a61f9..ac89a5deaca2 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -208,18 +208,15 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) */ /* IO operations when bitmap is stored near all superblocks */ -static struct page *read_sb_page(mddev_t *mddev, long offset, - struct page *page, - unsigned long index, int size) +static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long index) { /* choose a good rdev and read the page from there */ mdk_rdev_t *rdev; struct list_head *tmp; + struct page *page = alloc_page(GFP_KERNEL); sector_t target; - if (!page) - page = alloc_page(GFP_KERNEL); if (!page) return ERR_PTR(-ENOMEM); @@ -230,9 +227,7 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, target = rdev->sb_start + offset + index * (PAGE_SIZE/512); - if (sync_page_io(rdev->bdev, target, - roundup(size, bdev_hardsect_size(rdev->bdev)), - page, READ)) { + if (sync_page_io(rdev->bdev, target, PAGE_SIZE, page, READ)) { page->index = index; attach_page_buffers(page, NULL); /* so that free_buffer will * quietly no-op */ @@ -549,9 +544,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) bitmap->sb_page = read_page(bitmap->file, 0, bitmap, bytes); } else { - bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, - NULL, - 0, sizeof(bitmap_super_t)); + bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0); } if (IS_ERR(bitmap->sb_page)) { err = PTR_ERR(bitmap->sb_page); @@ -964,16 +957,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) */ page = bitmap->sb_page; offset = sizeof(bitmap_super_t); - read_sb_page(bitmap->mddev, bitmap->offset, - page, - index, count); } else if (file) { page = read_page(file, index, bitmap, count); offset = 0; } else { - page = read_sb_page(bitmap->mddev, bitmap->offset, - NULL, - index, count); + page = read_sb_page(bitmap->mddev, bitmap->offset, index); offset = 0; } if (IS_ERR(page)) { /* read error */ diff --git a/trunk/drivers/media/dvb/b2c2/Kconfig b/trunk/drivers/media/dvb/b2c2/Kconfig index b34301d56cd2..73dc2ee9b014 100644 --- a/trunk/drivers/media/dvb/b2c2/Kconfig +++ b/trunk/drivers/media/dvb/b2c2/Kconfig @@ -9,11 +9,11 @@ config DVB_B2C2_FLEXCOP select DVB_STV0297 if !DVB_FE_CUSTOMISE select DVB_BCM3510 if !DVB_FE_CUSTOMISE select DVB_LGDT330X if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE select DVB_S5H1420 if !DVB_FE_CUSTOMISE select DVB_TUNER_ITD1000 if !DVB_FE_CUSTOMISE select DVB_ISL6421 if !DVB_FE_CUSTOMISE select DVB_CX24123 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE help Support for the digital TV receiver chip made by B2C2 Inc. included in Technisats PCI cards and USB boxes. diff --git a/trunk/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/trunk/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 5cded3708541..a127a4175c40 100644 --- a/trunk/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/trunk/drivers/media/dvb/b2c2/flexcop-fe-tuner.c @@ -628,14 +628,12 @@ int flexcop_frontend_init(struct flexcop_device *fc) } /* try the cable dvb (stv0297) */ - fc->fc_i2c_adap[0].no_base_addr = 1; fc->fe = dvb_attach(stv0297_attach, &alps_tdee4_stv0297_config, i2c); if (fc->fe != NULL) { fc->dev_type = FC_CABLE; fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; goto fe_found; } - fc->fc_i2c_adap[0].no_base_addr = 0; /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */ fc->fe = dvb_attach(mt312_attach, diff --git a/trunk/drivers/media/dvb/b2c2/flexcop-i2c.c b/trunk/drivers/media/dvb/b2c2/flexcop-i2c.c index f13783f08f0f..43a112ec6d44 100644 --- a/trunk/drivers/media/dvb/b2c2/flexcop-i2c.c +++ b/trunk/drivers/media/dvb/b2c2/flexcop-i2c.c @@ -47,12 +47,8 @@ static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c, int len = r100.tw_sm_c_100.total_bytes, /* remember total_bytes is buflen-1 */ ret; + r100.tw_sm_c_100.no_base_addr_ack_error = i2c->no_base_addr; ret = flexcop_i2c_operation(i2c->fc, &r100); - if (ret != 0) { - deb_i2c("Retrying operation\n"); - r100.tw_sm_c_100.no_base_addr_ack_error = i2c->no_base_addr; - ret = flexcop_i2c_operation(i2c->fc, &r100); - } if (ret != 0) { deb_i2c("read failed. %d\n", ret); return ret; diff --git a/trunk/drivers/media/dvb/bt8xx/Kconfig b/trunk/drivers/media/dvb/bt8xx/Kconfig index 27edb0ece587..7e9c090fc04e 100644 --- a/trunk/drivers/media/dvb/bt8xx/Kconfig +++ b/trunk/drivers/media/dvb/bt8xx/Kconfig @@ -8,7 +8,7 @@ config DVB_BT8XX select DVB_OR51211 if !DVB_FE_CUSTOMISE select DVB_LGDT330X if !DVB_FE_CUSTOMISE select DVB_ZL10353 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE help Support for PCI cards based on the Bt8xx PCI bridge. Examples are the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards, diff --git a/trunk/drivers/media/dvb/dvb-usb/Kconfig b/trunk/drivers/media/dvb/dvb-usb/Kconfig index 49f7b20c25d6..62b68c291d99 100644 --- a/trunk/drivers/media/dvb/dvb-usb/Kconfig +++ b/trunk/drivers/media/dvb/dvb-usb/Kconfig @@ -24,8 +24,8 @@ config DVB_USB_A800 tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" depends on DVB_USB select DVB_DIB3000MC + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE select DVB_PLL if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE help Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver. @@ -34,7 +34,7 @@ config DVB_USB_DIBUSB_MB depends on DVB_USB select DVB_PLL if !DVB_FE_CUSTOMISE select DVB_DIB3000MB - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE help Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by DiBcom () equipped with a DiB3000M-B demodulator. @@ -55,7 +55,7 @@ config DVB_USB_DIBUSB_MC tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" depends on DVB_USB select DVB_DIB3000MC - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE help Support for USB2.0 DVB-T receivers based on reference designs made by DiBcom () equipped with a DiB3000M-C/P demodulator. @@ -73,11 +73,11 @@ config DVB_USB_DIB0700 select DVB_DIB7000M select DVB_DIB3000MC select DVB_S5H1411 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MT2266 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE select DVB_TUNER_DIB0070 - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE help Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The USB bridge is also present in devices having the DiB7700 DVB-T-USB @@ -95,7 +95,7 @@ config DVB_USB_UMT_010 depends on DVB_USB select DVB_PLL if !DVB_FE_CUSTOMISE select DVB_DIB3000MC - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE help Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. @@ -107,11 +107,11 @@ config DVB_USB_CXUSB select DVB_LGDT330X if !DVB_FE_CUSTOMISE select DVB_MT352 if !DVB_FE_CUSTOMISE select DVB_ZL10353 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE select DVB_DIB7000P if !DVB_FE_CUSTOMISE select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMIZE help Say Y here to support the Conexant USB2.0 hybrid reference design. Currently, only DVB and ATSC modes are supported, analog mode @@ -124,9 +124,9 @@ config DVB_USB_M920X tristate "Uli m920x DVB-T USB2.0 support" depends on DVB_USB select DVB_MT352 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_TDA827X if !DVB_FE_CUSTOMISE select DVB_TDA1004X if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMIZE help Say Y here to support the MSI Mega Sky 580 USB2.0 DVB-T receiver. Currently, only devices with a product id of @@ -137,7 +137,7 @@ config DVB_USB_GL861 tristate "Genesys Logic GL861 USB2.0 support" depends on DVB_USB select DVB_ZL10353 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE help Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0 receiver with USB ID 0db0:5581. @@ -146,7 +146,7 @@ config DVB_USB_AU6610 tristate "Alcor Micro AU6610 USB2.0 support" depends on DVB_USB select DVB_ZL10353 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE help Say Y here to support the Sigmatek DVB-110 DVB-T USB2.0 receiver. @@ -198,8 +198,8 @@ config DVB_USB_NOVA_T_USB2 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" depends on DVB_USB select DVB_DIB3000MC + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE select DVB_PLL if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE help Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver. @@ -235,8 +235,8 @@ config DVB_USB_OPERA1 config DVB_USB_AF9005 tristate "Afatech AF9005 DVB-T USB1.1 support" depends on DVB_USB && EXPERIMENTAL - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE help Say Y here to support the Afatech AF9005 based DVB-T USB1.1 receiver and the TerraTec Cinergy T USB XE (Rev.1) @@ -284,7 +284,7 @@ config DVB_USB_DTV5100 tristate "AME DTV-5100 USB2.0 DVB-T support" depends on DVB_USB select DVB_ZL10353 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE help Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver. @@ -293,9 +293,9 @@ config DVB_USB_AF9015 depends on DVB_USB && EXPERIMENTAL select DVB_AF9013 select DVB_PLL if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_TDA18271 if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE help Say Y here to support the Afatech AF9015 based DVB-T USB2.0 receiver diff --git a/trunk/drivers/media/dvb/dvb-usb/dib0700_devices.c b/trunk/drivers/media/dvb/dvb-usb/dib0700_devices.c index 391732788911..f28d3ae59e04 100644 --- a/trunk/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/trunk/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -446,13 +446,13 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) == NULL ? -ENODEV : 0; } -#define DEFAULT_RC_INTERVAL 50 +#define DEFAULT_RC_INTERVAL 150 static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; /* Number of keypresses to ignore before start repeating */ -#define RC_REPEAT_DELAY 6 -#define RC_REPEAT_DELAY_V1_20 10 +#define RC_REPEAT_DELAY 2 +#define RC_REPEAT_DELAY_V1_20 5 diff --git a/trunk/drivers/media/dvb/ttpci/Kconfig b/trunk/drivers/media/dvb/ttpci/Kconfig index 401a04effc06..867027ceab3e 100644 --- a/trunk/drivers/media/dvb/ttpci/Kconfig +++ b/trunk/drivers/media/dvb/ttpci/Kconfig @@ -106,7 +106,7 @@ config DVB_BUDGET_CI select DVB_TDA1004X if !DVB_FE_CUSTOMISE select DVB_LNBP21 if !DVB_FE_CUSTOMISE select DVB_TDA10023 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_TDA827X if !DVB_FE_CUSTOMISE select VIDEO_IR help Support for simple SAA7146 based DVB cards diff --git a/trunk/drivers/media/video/compat_ioctl32.c b/trunk/drivers/media/video/compat_ioctl32.c index 0ea85a05e5c0..e6ca4012b5f0 100644 --- a/trunk/drivers/media/video/compat_ioctl32.c +++ b/trunk/drivers/media/video/compat_ioctl32.c @@ -831,7 +831,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) { int ret = -ENOIOCTLCMD; - if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) + if (!file->f_op->ioctl) return ret; switch (cmd) { diff --git a/trunk/drivers/media/video/cx18/Kconfig b/trunk/drivers/media/video/cx18/Kconfig index 8940b5387dec..ef48565de7f1 100644 --- a/trunk/drivers/media/video/cx18/Kconfig +++ b/trunk/drivers/media/video/cx18/Kconfig @@ -9,7 +9,7 @@ config VIDEO_CX18 select VIDEO_CX2341X select VIDEO_CS5345 select DVB_S5H1409 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE ---help--- This is a video4linux driver for Conexant cx23418 based PCI combo video recorder devices. diff --git a/trunk/drivers/media/video/cx23885/Kconfig b/trunk/drivers/media/video/cx23885/Kconfig index 00f1e2e8889e..8c1b7fa47a41 100644 --- a/trunk/drivers/media/video/cx23885/Kconfig +++ b/trunk/drivers/media/video/cx23885/Kconfig @@ -11,16 +11,16 @@ config VIDEO_CX23885 select VIDEO_CX25840 select VIDEO_CX2341X select DVB_DIB7000P if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MT2131 if !DVB_FE_CUSTOMISE select DVB_S5H1409 if !DVB_FE_CUSTOMISE select DVB_S5H1411 if !DVB_FE_CUSTOMISE select DVB_LGDT330X if !DVB_FE_CUSTOMISE select DVB_ZL10353 if !DVB_FE_CUSTOMISE - select DVB_TDA10048 if !DVB_FE_CUSTOMIZE - select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMIZE select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMIZE select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE + select DVB_TDA10048 if !DVB_FE_CUSTOMIZE ---help--- This is a video4linux driver for Conexant 23885 based TV cards. diff --git a/trunk/drivers/media/video/cx88/Kconfig b/trunk/drivers/media/video/cx88/Kconfig index b0f837588e01..0b9e5fac6239 100644 --- a/trunk/drivers/media/video/cx88/Kconfig +++ b/trunk/drivers/media/video/cx88/Kconfig @@ -56,12 +56,12 @@ config VIDEO_CX88_DVB select DVB_NXT200X if !DVB_FE_CUSTOMISE select DVB_CX24123 if !DVB_FE_CUSTOMISE select DVB_ISL6421 if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE select DVB_S5H1411 if !DVB_FE_CUSTOMISE select DVB_CX24116 if !DVB_FE_CUSTOMISE select DVB_STV0299 if !DVB_FE_CUSTOMISE select DVB_STV0288 if !DVB_FE_CUSTOMISE select DVB_STB6000 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE ---help--- This adds support for DVB/ATSC cards based on the Conexant 2388x chip. diff --git a/trunk/drivers/media/video/em28xx/em28xx-video.c b/trunk/drivers/media/video/em28xx/em28xx-video.c index 4ea1f1e04897..610f535a257c 100644 --- a/trunk/drivers/media/video/em28xx/em28xx-video.c +++ b/trunk/drivers/media/video/em28xx/em28xx-video.c @@ -549,11 +549,10 @@ static int em28xx_config(struct em28xx *dev) static void em28xx_config_i2c(struct em28xx *dev) { struct v4l2_routing route; - int zero = 0; route.input = INPUT(dev->ctl_input)->vmux; route.output = 0; - em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, &zero); + em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL); em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); } diff --git a/trunk/drivers/media/video/gspca/gspca.c b/trunk/drivers/media/video/gspca/gspca.c index 02a6e9ef0337..748a87e82e44 100644 --- a/trunk/drivers/media/video/gspca/gspca.c +++ b/trunk/drivers/media/video/gspca/gspca.c @@ -1264,10 +1264,10 @@ static int vidioc_s_jpegcomp(struct file *file, void *priv, struct gspca_dev *gspca_dev = priv; int ret; - if (!gspca_dev->sd_desc->set_jcomp) - return -EINVAL; if (mutex_lock_interruptible(&gspca_dev->usb_lock)) return -ERESTARTSYS; + if (!gspca_dev->sd_desc->set_jcomp) + return -EINVAL; ret = gspca_dev->sd_desc->set_jcomp(gspca_dev, jpegcomp); mutex_unlock(&gspca_dev->usb_lock); return ret; diff --git a/trunk/drivers/media/video/pvrusb2/Kconfig b/trunk/drivers/media/video/pvrusb2/Kconfig index 854c2a885358..19eb274c9cd0 100644 --- a/trunk/drivers/media/video/pvrusb2/Kconfig +++ b/trunk/drivers/media/video/pvrusb2/Kconfig @@ -42,7 +42,7 @@ config VIDEO_PVRUSB2_DVB select DVB_S5H1411 if !DVB_FE_CUSTOMISE select DVB_TDA10048 if !DVB_FE_CUSTOMIZE select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE ---help--- diff --git a/trunk/drivers/media/video/saa7134/Kconfig b/trunk/drivers/media/video/saa7134/Kconfig index fc2164e28e76..7021bbf5897b 100644 --- a/trunk/drivers/media/video/saa7134/Kconfig +++ b/trunk/drivers/media/video/saa7134/Kconfig @@ -34,9 +34,9 @@ config VIDEO_SAA7134_DVB select DVB_NXT200X if !DVB_FE_CUSTOMISE select DVB_TDA10086 if !DVB_FE_CUSTOMISE select DVB_TDA826X if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_TDA827X if !DVB_FE_CUSTOMISE select DVB_ISL6421 if !DVB_FE_CUSTOMISE - select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMIZE - select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMIZE + select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE ---help--- This adds support for DVB cards based on the Philips saa7134 chip. diff --git a/trunk/drivers/message/fusion/mptscsih.c b/trunk/drivers/message/fusion/mptscsih.c index ee090413e598..d62fd4f6b52e 100644 --- a/trunk/drivers/message/fusion/mptscsih.c +++ b/trunk/drivers/message/fusion/mptscsih.c @@ -2008,9 +2008,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) return FAILED; } - /* make sure we have no outstanding commands at this stage */ - mptscsih_flush_running_cmds(hd); - ioc = hd->ioc; printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n", ioc->name, SCpnt); diff --git a/trunk/drivers/misc/Kconfig b/trunk/drivers/misc/Kconfig index d9aac2e65391..fee7304102af 100644 --- a/trunk/drivers/misc/Kconfig +++ b/trunk/drivers/misc/Kconfig @@ -428,10 +428,10 @@ config EEEPC_LAPTOP tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" depends on X86 depends on ACPI + depends on BACKLIGHT_CLASS_DEVICE + depends on HWMON depends on EXPERIMENTAL - select BACKLIGHT_CLASS_DEVICE - select HWMON - select RFKILL + depends on RFKILL ---help--- This driver supports the Fn-Fx keys on Eee PC laptops. It also adds the ability to switch camera/wlan on/off. diff --git a/trunk/drivers/misc/fujitsu-laptop.c b/trunk/drivers/misc/fujitsu-laptop.c index 65dc41540c62..a7dd3e9fb79d 100644 --- a/trunk/drivers/misc/fujitsu-laptop.c +++ b/trunk/drivers/misc/fujitsu-laptop.c @@ -3,7 +3,6 @@ /* Copyright (C) 2007,2008 Jonathan Woithe Copyright (C) 2008 Peter Gruber - Copyright (C) 2008 Tony Vroon Based on earlier work: Copyright (C) 2003 Shane Spencer Adrian Yee @@ -66,11 +65,8 @@ #include #include #include -#ifdef CONFIG_LEDS_CLASS -#include -#endif -#define FUJITSU_DRIVER_VERSION "0.5.0" +#define FUJITSU_DRIVER_VERSION "0.4.3" #define FUJITSU_LCD_N_LEVELS 8 @@ -87,24 +83,6 @@ #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 -/* FUNC interface - command values */ -#define FUNC_RFKILL 0x1000 -#define FUNC_LEDS 0x1001 -#define FUNC_BUTTONS 0x1002 -#define FUNC_BACKLIGHT 0x1004 - -/* FUNC interface - responses */ -#define UNSUPPORTED_CMD 0x80000000 - -#ifdef CONFIG_LEDS_CLASS -/* FUNC interface - LED control */ -#define FUNC_LED_OFF 0x1 -#define FUNC_LED_ON 0x30001 -#define KEYBOARD_LAMPS 0x100 -#define LOGOLAMP_POWERON 0x2000 -#define LOGOLAMP_ALWAYS 0x4000 -#endif - /* Hotkey details */ #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ #define KEY2_CODE 0x411 @@ -155,6 +133,7 @@ struct fujitsu_t { static struct fujitsu_t *fujitsu; static int use_alt_lcd_levels = -1; +static int disable_brightness_keys = -1; static int disable_brightness_adjust = -1; /* Device used to access other hotkeys on the laptop */ @@ -166,9 +145,8 @@ struct fujitsu_hotkey_t { struct platform_device *pf_device; struct kfifo *fifo; spinlock_t fifo_lock; - int rfkill_state; - int logolamp_registered; - int kblamps_registered; + + unsigned int irb; /* info about the pressed buttons */ }; static struct fujitsu_hotkey_t *fujitsu_hotkey; @@ -176,139 +154,12 @@ static struct fujitsu_hotkey_t *fujitsu_hotkey; static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, void *data); -#ifdef CONFIG_LEDS_CLASS -static enum led_brightness logolamp_get(struct led_classdev *cdev); -static void logolamp_set(struct led_classdev *cdev, - enum led_brightness brightness); - -struct led_classdev logolamp_led = { - .name = "fujitsu::logolamp", - .brightness_get = logolamp_get, - .brightness_set = logolamp_set -}; - -static enum led_brightness kblamps_get(struct led_classdev *cdev); -static void kblamps_set(struct led_classdev *cdev, - enum led_brightness brightness); - -struct led_classdev kblamps_led = { - .name = "fujitsu::kblamps", - .brightness_get = kblamps_get, - .brightness_set = kblamps_set -}; -#endif - #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG static u32 dbg_level = 0x03; #endif static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); -/* Fujitsu ACPI interface function */ - -static int call_fext_func(int cmd, int arg0, int arg1, int arg2) -{ - acpi_status status = AE_OK; - union acpi_object params[4] = { - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER } - }; - struct acpi_object_list arg_list = { 4, ¶ms[0] }; - struct acpi_buffer output; - union acpi_object out_obj; - acpi_handle handle = NULL; - - status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle); - if (ACPI_FAILURE(status)) { - vdbg_printk(FUJLAPTOP_DBG_ERROR, - "FUNC interface is not present\n"); - return -ENODEV; - } - - params[0].integer.value = cmd; - params[1].integer.value = arg0; - params[2].integer.value = arg1; - params[3].integer.value = arg2; - - output.length = sizeof(out_obj); - output.pointer = &out_obj; - - status = acpi_evaluate_object(handle, NULL, &arg_list, &output); - if (ACPI_FAILURE(status)) { - vdbg_printk(FUJLAPTOP_DBG_WARN, - "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n", - cmd, arg0, arg1, arg2); - return -ENODEV; - } - - if (out_obj.type != ACPI_TYPE_INTEGER) { - vdbg_printk(FUJLAPTOP_DBG_WARN, - "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) did not " - "return an integer\n", - cmd, arg0, arg1, arg2); - return -ENODEV; - } - - vdbg_printk(FUJLAPTOP_DBG_TRACE, - "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n", - cmd, arg0, arg1, arg2, (int)out_obj.integer.value); - return out_obj.integer.value; -} - -#ifdef CONFIG_LEDS_CLASS -/* LED class callbacks */ - -static void logolamp_set(struct led_classdev *cdev, - enum led_brightness brightness) -{ - if (brightness >= LED_FULL) { - call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); - call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON); - } else if (brightness >= LED_HALF) { - call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); - call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF); - } else { - call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF); - } -} - -static void kblamps_set(struct led_classdev *cdev, - enum led_brightness brightness) -{ - if (brightness >= LED_FULL) - call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON); - else - call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF); -} - -static enum led_brightness logolamp_get(struct led_classdev *cdev) -{ - enum led_brightness brightness = LED_OFF; - int poweron, always; - - poweron = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0); - if (poweron == FUNC_LED_ON) { - brightness = LED_HALF; - always = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0); - if (always == FUNC_LED_ON) - brightness = LED_FULL; - } - return brightness; -} - -static enum led_brightness kblamps_get(struct led_classdev *cdev) -{ - enum led_brightness brightness = LED_OFF; - - if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON) - brightness = LED_FULL; - - return brightness; -} -#endif - /* Hardware access for LCD brightness control */ static int set_lcd_level(int level) @@ -412,34 +263,44 @@ static int get_max_brightness(void) return fujitsu->max_brightness; } +static int get_lcd_level_alt(void) +{ + unsigned long long state = 0; + acpi_status status = AE_OK; + + vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLS\n"); + + status = + acpi_evaluate_integer(fujitsu->acpi_handle, "GBLS", NULL, &state); + if (status < 0) + return status; + + fujitsu->brightness_level = state & 0x0fffffff; + + if (state & 0x80000000) + fujitsu->brightness_changed = 1; + else + fujitsu->brightness_changed = 0; + + return fujitsu->brightness_level; +} + /* Backlight device stuff */ static int bl_get_brightness(struct backlight_device *b) { - return get_lcd_level(); + if (use_alt_lcd_levels) + return get_lcd_level_alt(); + else + return get_lcd_level(); } static int bl_update_status(struct backlight_device *b) { - int ret; - if (b->props.power == 4) - ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3); - else - ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0); - if (ret != 0) - vdbg_printk(FUJLAPTOP_DBG_ERROR, - "Unable to adjust backlight power, error code %i\n", - ret); - if (use_alt_lcd_levels) - ret = set_lcd_level_alt(b->props.brightness); + return set_lcd_level_alt(b->props.brightness); else - ret = set_lcd_level(b->props.brightness); - if (ret != 0) - vdbg_printk(FUJLAPTOP_DBG_ERROR, - "Unable to adjust LCD brightness, error code %i\n", - ret); - return ret; + return set_lcd_level(b->props.brightness); } static struct backlight_ops fujitsubl_ops = { @@ -483,7 +344,10 @@ static ssize_t show_lcd_level(struct device *dev, int ret; - ret = get_lcd_level(); + if (use_alt_lcd_levels) + ret = get_lcd_level_alt(); + else + ret = get_lcd_level(); if (ret < 0) return ret; @@ -508,71 +372,52 @@ static ssize_t store_lcd_level(struct device *dev, if (ret < 0) return ret; - ret = get_lcd_level(); + if (use_alt_lcd_levels) + ret = get_lcd_level_alt(); + else + ret = get_lcd_level(); if (ret < 0) return ret; return count; } -static ssize_t -ignore_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - return count; -} +/* Hardware access for hotkey device */ -static ssize_t -show_lid_state(struct device *dev, - struct device_attribute *attr, char *buf) +static int get_irb(void) { - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) - return sprintf(buf, "unknown\n"); - if (fujitsu_hotkey->rfkill_state & 0x100) - return sprintf(buf, "open\n"); - else - return sprintf(buf, "closed\n"); -} + unsigned long long state = 0; + acpi_status status = AE_OK; -static ssize_t -show_dock_state(struct device *dev, - struct device_attribute *attr, char *buf) -{ - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) - return sprintf(buf, "unknown\n"); - if (fujitsu_hotkey->rfkill_state & 0x200) - return sprintf(buf, "docked\n"); - else - return sprintf(buf, "undocked\n"); + vdbg_printk(FUJLAPTOP_DBG_TRACE, "Get irb\n"); + + status = + acpi_evaluate_integer(fujitsu_hotkey->acpi_handle, "GIRB", NULL, + &state); + if (status < 0) + return status; + + fujitsu_hotkey->irb = state; + + return fujitsu_hotkey->irb; } static ssize_t -show_radios_state(struct device *dev, - struct device_attribute *attr, char *buf) +ignore_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) - return sprintf(buf, "unknown\n"); - if (fujitsu_hotkey->rfkill_state & 0x20) - return sprintf(buf, "on\n"); - else - return sprintf(buf, "killed\n"); + return count; } static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store); static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed, ignore_store); static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); -static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store); -static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store); -static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store); static struct attribute *fujitsupf_attributes[] = { &dev_attr_brightness_changed.attr, &dev_attr_max_brightness.attr, &dev_attr_lcd_level.attr, - &dev_attr_lid.attr, - &dev_attr_dock.attr, - &dev_attr_radios.attr, NULL }; @@ -590,16 +435,24 @@ static struct platform_driver fujitsupf_driver = { static void dmi_check_cb_common(const struct dmi_system_id *id) { acpi_handle handle; + int have_blnf; printk(KERN_INFO "fujitsu-laptop: Identified laptop model '%s'.\n", id->ident); + have_blnf = ACPI_SUCCESS + (acpi_get_handle(NULL, "\\_SB.PCI0.GFX0.LCD.BLNF", &handle)); if (use_alt_lcd_levels == -1) { - if (ACPI_SUCCESS(acpi_get_handle(NULL, - "\\_SB.PCI0.LPCB.FJEX.SBL2", &handle))) - use_alt_lcd_levels = 1; - else - use_alt_lcd_levels = 0; - vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as " - "%i\n", use_alt_lcd_levels); + vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detecting usealt\n"); + use_alt_lcd_levels = 1; + } + if (disable_brightness_keys == -1) { + vdbg_printk(FUJLAPTOP_DBG_TRACE, + "auto-detecting disable_keys\n"); + disable_brightness_keys = have_blnf ? 1 : 0; + } + if (disable_brightness_adjust == -1) { + vdbg_printk(FUJLAPTOP_DBG_TRACE, + "auto-detecting disable_adjust\n"); + disable_brightness_adjust = have_blnf ? 0 : 1; } } @@ -728,14 +581,19 @@ static int acpi_fujitsu_add(struct acpi_device *device) /* do config (detect defaults) */ use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0; + disable_brightness_keys = disable_brightness_keys == 1 ? 1 : 0; disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; vdbg_printk(FUJLAPTOP_DBG_INFO, - "config: [alt interface: %d], [adjust disable: %d]\n", - use_alt_lcd_levels, disable_brightness_adjust); + "config: [alt interface: %d], [key disable: %d], [adjust disable: %d]\n", + use_alt_lcd_levels, disable_brightness_keys, + disable_brightness_adjust); if (get_max_brightness() <= 0) fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS; - get_lcd_level(); + if (use_alt_lcd_levels) + get_lcd_level_alt(); + else + get_lcd_level(); return result; @@ -786,23 +644,43 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) case ACPI_FUJITSU_NOTIFY_CODE1: keycode = 0; oldb = fujitsu->brightness_level; - get_lcd_level(); + get_lcd_level(); /* the alt version always yields changed */ newb = fujitsu->brightness_level; vdbg_printk(FUJLAPTOP_DBG_TRACE, "brightness button event [%i -> %i (%i)]\n", oldb, newb, fujitsu->brightness_changed); - if (oldb < newb) { + if (oldb == newb && fujitsu->brightness_changed) { + keycode = 0; + if (disable_brightness_keys != 1) { + if (oldb == 0) { + acpi_bus_generate_proc_event + (fujitsu->dev, + ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, + 0); + keycode = KEY_BRIGHTNESSDOWN; + } else if (oldb == + (fujitsu->max_brightness) - 1) { + acpi_bus_generate_proc_event + (fujitsu->dev, + ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, + 0); + keycode = KEY_BRIGHTNESSUP; + } + } + } else if (oldb < newb) { if (disable_brightness_adjust != 1) { if (use_alt_lcd_levels) set_lcd_level_alt(newb); else set_lcd_level(newb); } - acpi_bus_generate_proc_event(fujitsu->dev, - ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, 0); - keycode = KEY_BRIGHTNESSUP; + if (disable_brightness_keys != 1) { + acpi_bus_generate_proc_event(fujitsu->dev, + ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, 0); + keycode = KEY_BRIGHTNESSUP; + } } else if (oldb > newb) { if (disable_brightness_adjust != 1) { if (use_alt_lcd_levels) @@ -810,9 +688,13 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) else set_lcd_level(newb); } - acpi_bus_generate_proc_event(fujitsu->dev, - ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, 0); - keycode = KEY_BRIGHTNESSDOWN; + if (disable_brightness_keys != 1) { + acpi_bus_generate_proc_event(fujitsu->dev, + ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, 0); + keycode = KEY_BRIGHTNESSDOWN; + } + } else { + keycode = KEY_UNKNOWN; } break; default: @@ -889,8 +771,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) input->id.bustype = BUS_HOST; input->id.product = 0x06; input->dev.parent = &device->dev; - - set_bit(EV_KEY, input->evbit); + input->evbit[0] = BIT(EV_KEY); set_bit(fujitsu->keycode1, input->keybit); set_bit(fujitsu->keycode2, input->keybit); set_bit(fujitsu->keycode3, input->keybit); @@ -922,44 +803,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) printk(KERN_ERR "_INI Method failed\n"); } - i = 0; - while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 - && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) - ; /* No action, result is discarded */ + i = 0; /* Discard hotkey ringbuffer */ + while (get_irb() != 0 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) ; vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); - fujitsu_hotkey->rfkill_state = - call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); - - /* Suspect this is a keymap of the application panel, print it */ - printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", - call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0)); - - #ifdef CONFIG_LEDS_CLASS - if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { - result = led_classdev_register(&fujitsu->pf_device->dev, - &logolamp_led); - if (result == 0) { - fujitsu_hotkey->logolamp_registered = 1; - } else { - printk(KERN_ERR "fujitsu-laptop: Could not register " - "LED handler for logo lamp, error %i\n", result); - } - } - - if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) && - (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) { - result = led_classdev_register(&fujitsu->pf_device->dev, - &kblamps_led); - if (result == 0) { - fujitsu_hotkey->kblamps_registered = 1; - } else { - printk(KERN_ERR "fujitsu-laptop: Could not register " - "LED handler for keyboard lamps, error %i\n", result); - } - } - #endif - return result; end: @@ -1005,15 +852,16 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, input = fujitsu_hotkey->input; - fujitsu_hotkey->rfkill_state = - call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); + vdbg_printk(FUJLAPTOP_DBG_TRACE, "Hotkey event\n"); switch (event) { case ACPI_FUJITSU_NOTIFY_CODE1: i = 0; - while ((irb = - call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0 - && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) { + while ((irb = get_irb()) != 0 + && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) { + vdbg_printk(FUJLAPTOP_DBG_TRACE, "GIRB result [%x]\n", + irb); + switch (irb & 0x4ff) { case KEY1_CODE: keycode = fujitsu->keycode1; @@ -1187,15 +1035,6 @@ static int __init fujitsu_init(void) goto fail_hotkey1; } - /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */ - - if (!acpi_video_backlight_support()) { - if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3) - fujitsu->bl_device->props.power = 4; - else - fujitsu->bl_device->props.power = 0; - } - printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION " successfully loaded.\n"); @@ -1235,14 +1074,6 @@ static int __init fujitsu_init(void) static void __exit fujitsu_cleanup(void) { - #ifdef CONFIG_LEDS_CLASS - if (fujitsu_hotkey->logolamp_registered != 0) - led_classdev_unregister(&logolamp_led); - - if (fujitsu_hotkey->kblamps_registered != 0) - led_classdev_unregister(&kblamps_led); - #endif - sysfs_remove_group(&fujitsu->pf_device->dev.kobj, &fujitsupf_attribute_group); platform_device_unregister(fujitsu->pf_device); @@ -1267,6 +1098,9 @@ module_exit(fujitsu_cleanup); module_param(use_alt_lcd_levels, uint, 0644); MODULE_PARM_DESC(use_alt_lcd_levels, "Use alternative interface for lcd_levels (needed for Lifebook s6410)."); +module_param(disable_brightness_keys, uint, 0644); +MODULE_PARM_DESC(disable_brightness_keys, + "Disable brightness keys (eg. if they are already handled by the generic ACPI_VIDEO device)."); module_param(disable_brightness_adjust, uint, 0644); MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG @@ -1274,13 +1108,12 @@ module_param_named(debug, dbg_level, uint, 0644); MODULE_PARM_DESC(debug, "Sets debug level bit-mask"); #endif -MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon"); +MODULE_AUTHOR("Jonathan Woithe, Peter Gruber"); MODULE_DESCRIPTION("Fujitsu laptop extras support"); MODULE_VERSION(FUJITSU_DRIVER_VERSION); MODULE_LICENSE("GPL"); MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*"); -MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*"); MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*"); static struct pnp_device_id pnp_ids[] = { diff --git a/trunk/drivers/misc/panasonic-laptop.c b/trunk/drivers/misc/panasonic-laptop.c index f30db367c82e..4a1bc64485d5 100644 --- a/trunk/drivers/misc/panasonic-laptop.c +++ b/trunk/drivers/misc/panasonic-laptop.c @@ -241,6 +241,8 @@ static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val) }; acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_pcc_write_sset"); + status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, ¶ms, NULL); @@ -252,6 +254,8 @@ static inline int acpi_pcc_get_sqty(struct acpi_device *device) unsigned long long s; acpi_status status; + ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty"); + status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, NULL, &s); if (ACPI_SUCCESS(status)) @@ -270,6 +274,8 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf) union acpi_object *hkey = NULL; int i; + ACPI_FUNCTION_TRACE("acpi_pcc_retrieve_biosdata"); + status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0, &buffer); if (ACPI_FAILURE(status)) { @@ -495,6 +501,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) int key_code, hkey_num; unsigned long long result; + ACPI_FUNCTION_TRACE("acpi_pcc_generate_keyinput"); + rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY, NULL, &result); if (!ACPI_SUCCESS(rc)) { @@ -530,6 +538,8 @@ static void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data) { struct pcc_acpi *pcc = (struct pcc_acpi *) data; + ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_notify"); + switch (event) { case HKEY_NOTIFY: acpi_pcc_generate_keyinput(pcc); @@ -544,6 +554,8 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc) { int i, rc; + ACPI_FUNCTION_TRACE("acpi_pcc_init_input"); + pcc->input_dev = input_allocate_device(); if (!pcc->input_dev) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -585,6 +597,8 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) struct pcc_acpi *pcc = acpi_driver_data(device); acpi_status status = AE_OK; + ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume"); + if (device == NULL || pcc == NULL) return -EINVAL; @@ -602,6 +616,8 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) struct pcc_acpi *pcc; int num_sifr, result; + ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_add"); + if (!device) return -EINVAL; @@ -698,6 +714,8 @@ static int __init acpi_pcc_init(void) { int result = 0; + ACPI_FUNCTION_TRACE("acpi_pcc_init"); + if (acpi_disabled) return -ENODEV; @@ -715,6 +733,8 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) { struct pcc_acpi *pcc = acpi_driver_data(device); + ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_remove"); + if (!device || !pcc) return -EINVAL; @@ -737,6 +757,8 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) static void __exit acpi_pcc_exit(void) { + ACPI_FUNCTION_TRACE("acpi_pcc_exit"); + acpi_bus_unregister_driver(&acpi_pcc_driver); } diff --git a/trunk/drivers/misc/sony-laptop.c b/trunk/drivers/misc/sony-laptop.c index 537959d07148..571b211608d1 100644 --- a/trunk/drivers/misc/sony-laptop.c +++ b/trunk/drivers/misc/sony-laptop.c @@ -935,17 +935,14 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) static acpi_status sony_walk_callback(acpi_handle handle, u32 level, void *context, void **return_value) { - struct acpi_device_info *info; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_namespace_node *node; + union acpi_operand_object *operand; - if (ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) { - info = buffer.pointer; + node = (struct acpi_namespace_node *)handle; + operand = (union acpi_operand_object *)node->object; - printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", - (char *)&info->name, info->param_count); - - kfree(buffer.pointer); - } + printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", node->name.ascii, + (u32) operand->method.param_count); return AE_OK; } diff --git a/trunk/drivers/misc/tc1100-wmi.c b/trunk/drivers/misc/tc1100-wmi.c index b4a4aa9ee482..f25e4c974dcf 100644 --- a/trunk/drivers/misc/tc1100-wmi.c +++ b/trunk/drivers/misc/tc1100-wmi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/drivers/misc/thinkpad_acpi.c b/trunk/drivers/misc/thinkpad_acpi.c index 3478453eba7a..899766e16fa8 100644 --- a/trunk/drivers/misc/thinkpad_acpi.c +++ b/trunk/drivers/misc/thinkpad_acpi.c @@ -76,6 +76,7 @@ #include #include +#include #include diff --git a/trunk/drivers/net/ppp_generic.c b/trunk/drivers/net/ppp_generic.c index 714a23035de1..7e857e938adb 100644 --- a/trunk/drivers/net/ppp_generic.c +++ b/trunk/drivers/net/ppp_generic.c @@ -116,7 +116,6 @@ struct ppp { unsigned long last_xmit; /* jiffies when last pkt sent 9c */ unsigned long last_recv; /* jiffies when last pkt rcvd a0 */ struct net_device *dev; /* network interface device a4 */ - int closing; /* is device closing down? a8 */ #ifdef CONFIG_PPP_MULTILINK int nxchan; /* next channel to send something on */ u32 nxseq; /* next sequence number to send */ @@ -996,7 +995,7 @@ ppp_xmit_process(struct ppp *ppp) struct sk_buff *skb; ppp_xmit_lock(ppp); - if (!ppp->closing) { + if (ppp->dev) { ppp_push(ppp); while (!ppp->xmit_pending && (skb = skb_dequeue(&ppp->file.xq))) @@ -1464,7 +1463,8 @@ static inline void ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) { ppp_recv_lock(ppp); - if (!ppp->closing) + /* ppp->dev == 0 means interface is closing down */ + if (ppp->dev) ppp_receive_frame(ppp, skb, pch); else kfree_skb(skb); @@ -2498,16 +2498,18 @@ init_ppp_file(struct ppp_file *pf, int kind) */ static void ppp_shutdown_interface(struct ppp *ppp) { + struct net_device *dev; + mutex_lock(&all_ppp_mutex); - /* This will call dev_close() for us. */ ppp_lock(ppp); - if (!ppp->closing) { - ppp->closing = 1; - ppp_unlock(ppp); - unregister_netdev(ppp->dev); - } else - ppp_unlock(ppp); - + dev = ppp->dev; + ppp->dev = NULL; + ppp_unlock(ppp); + /* This will call dev_close() for us. */ + if (dev) { + unregister_netdev(dev); + free_netdev(dev); + } cardmap_set(&all_ppp_units, ppp->file.index, NULL); ppp->file.dead = 1; ppp->owner = NULL; @@ -2552,7 +2554,7 @@ static void ppp_destroy_interface(struct ppp *ppp) if (ppp->xmit_pending) kfree_skb(ppp->xmit_pending); - free_netdev(ppp->dev); + kfree(ppp); } /* @@ -2614,7 +2616,7 @@ ppp_connect_channel(struct channel *pch, int unit) if (pch->file.hdrlen > ppp->file.hdrlen) ppp->file.hdrlen = pch->file.hdrlen; hdrlen = pch->file.hdrlen + 2; /* for protocol bytes */ - if (hdrlen > ppp->dev->hard_header_len) + if (ppp->dev && hdrlen > ppp->dev->hard_header_len) ppp->dev->hard_header_len = hdrlen; list_add_tail(&pch->clist, &ppp->channels); ++ppp->n_channels; diff --git a/trunk/drivers/pci/hotplug/acpi_pcihp.c b/trunk/drivers/pci/hotplug/acpi_pcihp.c index 2c981cbb0719..e17ef54f0efc 100644 --- a/trunk/drivers/pci/hotplug/acpi_pcihp.c +++ b/trunk/drivers/pci/hotplug/acpi_pcihp.c @@ -33,6 +33,7 @@ #include #include #include +#include #define MY_NAME "acpi_pcihp" diff --git a/trunk/drivers/pci/hotplug/acpiphp.h b/trunk/drivers/pci/hotplug/acpiphp.h index 9bcb6cbd5aa9..f9e244da30ae 100644 --- a/trunk/drivers/pci/hotplug/acpiphp.h +++ b/trunk/drivers/pci/hotplug/acpiphp.h @@ -113,7 +113,7 @@ struct acpiphp_slot { u8 device; /* pci device# */ - unsigned long long sun; /* ACPI _SUN (slot unique number) */ + u32 sun; /* ACPI _SUN (slot unique number) */ u32 flags; /* see below */ }; diff --git a/trunk/drivers/pci/hotplug/acpiphp_core.c b/trunk/drivers/pci/hotplug/acpiphp_core.c index 43c10bd261b4..95b536a23d25 100644 --- a/trunk/drivers/pci/hotplug/acpiphp_core.c +++ b/trunk/drivers/pci/hotplug/acpiphp_core.c @@ -337,7 +337,7 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; acpiphp_slot->slot = slot; - snprintf(name, SLOT_NAME_SIZE, "%llu", slot->acpi_slot->sun); + snprintf(name, SLOT_NAME_SIZE, "%u", slot->acpi_slot->sun); retval = pci_hp_register(slot->hotplug_slot, acpiphp_slot->bridge->pci_bus, diff --git a/trunk/drivers/pci/hotplug/acpiphp_glue.c b/trunk/drivers/pci/hotplug/acpiphp_glue.c index 3affc6472e65..955aae4071f7 100644 --- a/trunk/drivers/pci/hotplug/acpiphp_glue.c +++ b/trunk/drivers/pci/hotplug/acpiphp_glue.c @@ -255,13 +255,13 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) bridge->nr_slots++; - dbg("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n", + dbg("found ACPI PCI Hotplug slot %d at PCI %04x:%02x:%02x\n", slot->sun, pci_domain_nr(bridge->pci_bus), bridge->pci_bus->number, slot->device); retval = acpiphp_register_hotplug_slot(slot); if (retval) { if (retval == -EBUSY) - warn("Slot %llu already registered by another " + warn("Slot %d already registered by another " "hotplug driver\n", slot->sun); else warn("acpiphp_register_hotplug_slot failed " diff --git a/trunk/drivers/pci/hotplug/ibmphp_core.c b/trunk/drivers/pci/hotplug/ibmphp_core.c index 633e743442ac..c892daae74d6 100644 --- a/trunk/drivers/pci/hotplug/ibmphp_core.c +++ b/trunk/drivers/pci/hotplug/ibmphp_core.c @@ -1402,6 +1402,10 @@ static int __init ibmphp_init(void) goto error; } + /* lock ourselves into memory with a module + * count of -1 so that no one can unload us. */ + module_put(THIS_MODULE); + exit: return rc; @@ -1419,3 +1423,4 @@ static void __exit ibmphp_exit(void) } module_init(ibmphp_init); +module_exit(ibmphp_exit); diff --git a/trunk/drivers/pci/hotplug/pciehp.h b/trunk/drivers/pci/hotplug/pciehp.h index 7072952ea1d2..b2801a7ee37f 100644 --- a/trunk/drivers/pci/hotplug/pciehp.h +++ b/trunk/drivers/pci/hotplug/pciehp.h @@ -217,6 +217,7 @@ struct hpc_ops { #ifdef CONFIG_ACPI #include #include +#include #include static inline int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev) diff --git a/trunk/drivers/pci/hotplug/pciehp_core.c b/trunk/drivers/pci/hotplug/pciehp_core.c index 39cf248d24e3..4b23bc39b11e 100644 --- a/trunk/drivers/pci/hotplug/pciehp_core.c +++ b/trunk/drivers/pci/hotplug/pciehp_core.c @@ -432,19 +432,18 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ goto err_out_release_ctlr; } - /* Check if slot is occupied */ t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); - t_slot->hpc_ops->get_adapter_status(t_slot, &value); - if (value) { - if (pciehp_force) - pciehp_enable_slot(t_slot); - } else { - /* Power off slot if not occupied */ - if (POWER_CTRL(ctrl)) { - rc = t_slot->hpc_ops->power_off_slot(t_slot); - if (rc) - goto err_out_free_ctrl_slot; - } + + t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ + if (value && pciehp_force) { + rc = pciehp_enable_slot(t_slot); + if (rc) /* -ENODEV: shouldn't happen, but deal with it */ + value = 0; + } + if ((POWER_CTRL(ctrl)) && !value) { + rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ + if (rc) + goto err_out_free_ctrl_slot; } return 0; diff --git a/trunk/drivers/pci/pci-acpi.c b/trunk/drivers/pci/pci-acpi.c index 9d976d51d406..ae5ec76dca77 100644 --- a/trunk/drivers/pci/pci-acpi.c +++ b/trunk/drivers/pci/pci-acpi.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include diff --git a/trunk/drivers/pci/pcie/aer/aerdrv_core.c b/trunk/drivers/pci/pcie/aer/aerdrv_core.c index aac7006949f1..dfc63d01f20a 100644 --- a/trunk/drivers/pci/pcie/aer/aerdrv_core.c +++ b/trunk/drivers/pci/pcie/aer/aerdrv_core.c @@ -252,7 +252,7 @@ static void report_resume(struct pci_dev *dev, void *data) if (!dev->driver || !dev->driver->err_handler || - !dev->driver->err_handler->resume) + !dev->driver->err_handler->slot_reset) return; err_handler = dev->driver->err_handler; diff --git a/trunk/drivers/pnp/pnpacpi/core.c b/trunk/drivers/pnp/pnpacpi/core.c index 2834846a185d..383e47c392a4 100644 --- a/trunk/drivers/pnp/pnpacpi/core.c +++ b/trunk/drivers/pnp/pnpacpi/core.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "../base.h" #include "pnpacpi.h" diff --git a/trunk/drivers/rtc/rtc-isl1208.c b/trunk/drivers/rtc/rtc-isl1208.c index 054e05294af8..2cd77ab8fc66 100644 --- a/trunk/drivers/rtc/rtc-isl1208.c +++ b/trunk/drivers/rtc/rtc-isl1208.c @@ -328,13 +328,6 @@ isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) int sr; u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; - /* The clock has an 8 bit wide bcd-coded register (they never learn) - * for the year. tm_year is an offset from 1900 and we are interested - * in the 2000-2099 range, so any value less than 100 is invalid. - */ - if (tm->tm_year < 100) - return -EINVAL; - regs[ISL1208_REG_SC] = bin2bcd(tm->tm_sec); regs[ISL1208_REG_MN] = bin2bcd(tm->tm_min); regs[ISL1208_REG_HR] = bin2bcd(tm->tm_hour) | ISL1208_REG_HR_MIL; diff --git a/trunk/drivers/scsi/aacraid/linit.c b/trunk/drivers/scsi/aacraid/linit.c index 94acbeed4e7c..162cd927d94b 100644 --- a/trunk/drivers/scsi/aacraid/linit.c +++ b/trunk/drivers/scsi/aacraid/linit.c @@ -175,8 +175,8 @@ static struct aac_driver_ident aac_drivers[] = { { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Boxster/PERC3DiB) */ { aac_rx_init, "aacraid", "ADAPTEC ", "catapult ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* catapult */ { aac_rx_init, "aacraid", "ADAPTEC ", "tomcat ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* tomcat */ - { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2120S ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec 2120S (Crusader) */ - { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec 2200S (Vulcan) */ + { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2120S ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2120S (Crusader) */ + { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan) */ { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan-2m) */ { aac_rx_init, "aacraid", "Legend ", "Legend S220 ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S220 (Legend Crusader) */ { aac_rx_init, "aacraid", "Legend ", "Legend S230 ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S230 (Legend Vulcan) */ diff --git a/trunk/drivers/scsi/ibmvscsi/ibmvstgt.c b/trunk/drivers/scsi/ibmvscsi/ibmvstgt.c index e2dd6a45924a..2a5b29d12172 100644 --- a/trunk/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/trunk/drivers/scsi/ibmvscsi/ibmvstgt.c @@ -864,23 +864,21 @@ static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id) INIT_WORK(&vport->crq_work, handle_crq); - err = scsi_add_host(shost, target->dev); + err = crq_queue_create(&vport->crq_queue, target); if (err) goto free_srp_target; - err = scsi_tgt_alloc_queue(shost); + err = scsi_add_host(shost, target->dev); if (err) - goto remove_host; + goto destroy_queue; - err = crq_queue_create(&vport->crq_queue, target); + err = scsi_tgt_alloc_queue(shost); if (err) - goto free_queue; + goto destroy_queue; return 0; -free_queue: - scsi_tgt_free_queue(shost); -remove_host: - scsi_remove_host(shost); +destroy_queue: + crq_queue_destroy(target); free_srp_target: srp_target_free(target); put_host: diff --git a/trunk/drivers/scsi/libiscsi.c b/trunk/drivers/scsi/libiscsi.c index 3fdee7370ccc..801c7cf54d2e 100644 --- a/trunk/drivers/scsi/libiscsi.c +++ b/trunk/drivers/scsi/libiscsi.c @@ -489,6 +489,12 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, if (!__kfifo_get(session->cmdpool.queue, (void*)&task, sizeof(void*))) return NULL; + + if ((hdr->opcode == (ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE)) && + hdr->ttt == RESERVED_ITT) { + conn->ping_task = task; + conn->last_ping = jiffies; + } } /* * released in complete pdu for task we expect a response for, and @@ -697,11 +703,6 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); if (!task) iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); - else if (!rhdr) { - /* only track our nops */ - conn->ping_task = task; - conn->last_ping = jiffies; - } } static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr, diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index 148d3af92aef..fa45a1a66867 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -648,8 +648,8 @@ static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd) struct request *req = cmd->request; unsigned long flags; - spin_lock_irqsave(q->queue_lock, flags); scsi_unprep_request(req); + spin_lock_irqsave(q->queue_lock, flags); blk_requeue_request(q, req); spin_unlock_irqrestore(q->queue_lock, flags); diff --git a/trunk/drivers/w1/w1_io.c b/trunk/drivers/w1/w1_io.c index 5139c25ca962..0d15b0eaf79a 100644 --- a/trunk/drivers/w1/w1_io.c +++ b/trunk/drivers/w1/w1_io.c @@ -356,9 +356,7 @@ int w1_reset_select_slave(struct w1_slave *sl) w1_write_8(sl->master, W1_SKIP_ROM); else { u8 match[9] = {W1_MATCH_ROM, }; - u64 rn = le64_to_cpu(*((u64*)&sl->reg_num)); - - memcpy(&match[1], &rn, 8); + memcpy(&match[1], (u8 *)&sl->reg_num, 8); w1_write_block(sl->master, match, 9); } return 0; diff --git a/trunk/fs/9p/fid.c b/trunk/fs/9p/fid.c index 2a983d49d19c..3031e3233dd6 100644 --- a/trunk/fs/9p/fid.c +++ b/trunk/fs/9p/fid.c @@ -45,7 +45,7 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) struct v9fs_dentry *dent; P9_DPRINTK(P9_DEBUG_VFS, "fid %d dentry %s\n", - fid->fid, dentry->d_name.name); + fid->fid, dentry->d_iname); dent = dentry->d_fsdata; if (!dent) { @@ -79,7 +79,7 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, u32 uid, int any) struct p9_fid *fid, *ret; P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n", - dentry->d_name.name, dentry, uid, any); + dentry->d_iname, dentry, uid, any); dent = (struct v9fs_dentry *) dentry->d_fsdata; ret = NULL; if (dent) { diff --git a/trunk/fs/9p/v9fs.c b/trunk/fs/9p/v9fs.c index 332b5ff02fec..24eb01087b6d 100644 --- a/trunk/fs/9p/v9fs.c +++ b/trunk/fs/9p/v9fs.c @@ -160,7 +160,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses) v9ses->flags |= V9FS_ACCESS_ANY; else { v9ses->flags |= V9FS_ACCESS_SINGLE; - v9ses->uid = simple_strtoul(s, &e, 10); + v9ses->uid = simple_strtol(s, &e, 10); if (*e != '\0') v9ses->uid = ~0; } diff --git a/trunk/fs/9p/vfs_dentry.c b/trunk/fs/9p/vfs_dentry.c index 06dcc7c4f234..f9534f18df0a 100644 --- a/trunk/fs/9p/vfs_dentry.c +++ b/trunk/fs/9p/vfs_dentry.c @@ -52,8 +52,7 @@ static int v9fs_dentry_delete(struct dentry *dentry) { - P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, - dentry); + P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); return 1; } @@ -70,8 +69,7 @@ static int v9fs_dentry_delete(struct dentry *dentry) static int v9fs_cached_dentry_delete(struct dentry *dentry) { struct inode *inode = dentry->d_inode; - P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, - dentry); + P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); if(!inode) return 1; @@ -90,8 +88,7 @@ void v9fs_dentry_release(struct dentry *dentry) struct v9fs_dentry *dent; struct p9_fid *temp, *current_fid; - P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, - dentry); + P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); dent = dentry->d_fsdata; if (dent) { list_for_each_entry_safe(current_fid, temp, &dent->fidlist, diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index 2dfcf5487efe..8314d3f43b71 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -963,8 +963,7 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer, if (buflen > PATH_MAX) buflen = PATH_MAX; - P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name, - dentry); + P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); retval = v9fs_readlink(dentry, link, buflen); @@ -1023,8 +1022,7 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) { char *s = nd_get_link(nd); - P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name, - IS_ERR(s) ? "" : s); + P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name, s); if (!IS_ERR(s)) __putname(s); } diff --git a/trunk/drivers/acpi/acpica/acconfig.h b/trunk/include/acpi/acconfig.h similarity index 98% rename from trunk/drivers/acpi/acpica/acconfig.h rename to trunk/include/acpi/acconfig.h index e6777fb883d2..29feee27f0ea 100644 --- a/trunk/drivers/acpi/acpica/acconfig.h +++ b/trunk/include/acpi/acconfig.h @@ -61,6 +61,10 @@ * */ +/* Current ACPICA subsystem version in YYYYMMDD format */ + +#define ACPI_CA_VERSION 0x20080926 + /* * OS name, used for the _OS object. The _OS object is essentially obsolete, * but there is a large base of ASL/AML code in existing machines that check @@ -115,10 +119,6 @@ #define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 -/* Maximum number of While() loop iterations before forced abort */ - -#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF - /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) diff --git a/trunk/drivers/acpi/acpica/acdebug.h b/trunk/include/acpi/acdebug.h similarity index 100% rename from trunk/drivers/acpi/acpica/acdebug.h rename to trunk/include/acpi/acdebug.h diff --git a/trunk/include/acpi/acdisasm.h b/trunk/include/acpi/acdisasm.h new file mode 100644 index 000000000000..0c1ed387073c --- /dev/null +++ b/trunk/include/acpi/acdisasm.h @@ -0,0 +1,445 @@ +/****************************************************************************** + * + * Name: acdisasm.h - AML disassembler + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2008, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACDISASM_H__ +#define __ACDISASM_H__ + +#include "amlresrc.h" + +#define BLOCK_NONE 0 +#define BLOCK_PAREN 1 +#define BLOCK_BRACE 2 +#define BLOCK_COMMA_LIST 4 +#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" + +struct acpi_external_list { + char *path; + char *internal_path; + struct acpi_external_list *next; + u32 value; + u16 length; + u8 type; +}; + +extern struct acpi_external_list *acpi_gbl_external_list; + +typedef const struct acpi_dmtable_info { + u8 opcode; + u8 offset; + char *name; + +} acpi_dmtable_info; + +/* + * Values for Opcode above. + * Note: 0-7 must not change, used as a flag shift value + */ +#define ACPI_DMT_FLAG0 0 +#define ACPI_DMT_FLAG1 1 +#define ACPI_DMT_FLAG2 2 +#define ACPI_DMT_FLAG3 3 +#define ACPI_DMT_FLAG4 4 +#define ACPI_DMT_FLAG5 5 +#define ACPI_DMT_FLAG6 6 +#define ACPI_DMT_FLAG7 7 +#define ACPI_DMT_FLAGS0 8 +#define ACPI_DMT_FLAGS2 9 +#define ACPI_DMT_UINT8 10 +#define ACPI_DMT_UINT16 11 +#define ACPI_DMT_UINT24 12 +#define ACPI_DMT_UINT32 13 +#define ACPI_DMT_UINT56 14 +#define ACPI_DMT_UINT64 15 +#define ACPI_DMT_STRING 16 +#define ACPI_DMT_NAME4 17 +#define ACPI_DMT_NAME6 18 +#define ACPI_DMT_NAME8 19 +#define ACPI_DMT_CHKSUM 20 +#define ACPI_DMT_SPACEID 21 +#define ACPI_DMT_GAS 22 +#define ACPI_DMT_ASF 23 +#define ACPI_DMT_DMAR 24 +#define ACPI_DMT_HEST 25 +#define ACPI_DMT_HESTNTFY 26 +#define ACPI_DMT_HESTNTYP 27 +#define ACPI_DMT_MADT 28 +#define ACPI_DMT_SRAT 29 +#define ACPI_DMT_EXIT 30 +#define ACPI_DMT_SIG 31 + +typedef +void (*acpi_dmtable_handler) (struct acpi_table_header * table); + +struct acpi_dmtable_data { + char *signature; + struct acpi_dmtable_info *table_info; + acpi_dmtable_handler table_handler; + char *name; +}; + +struct acpi_op_walk_info { + u32 level; + u32 last_level; + u32 count; + u32 bit_offset; + u32 flags; + struct acpi_walk_state *walk_state; +}; + +typedef +acpi_status(*asl_walk_callback) (union acpi_parse_object * op, + u32 level, void *context); + +struct acpi_resource_tag { + u32 bit_index; + char *tag; +}; + +/* Strings used for decoding flags to ASL keywords */ + +extern const char *acpi_gbl_word_decode[]; +extern const char *acpi_gbl_irq_decode[]; +extern const char *acpi_gbl_lock_rule[]; +extern const char *acpi_gbl_access_types[]; +extern const char *acpi_gbl_update_rules[]; +extern const char *acpi_gbl_match_ops[]; + +extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; +extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; +extern struct acpi_dmtable_info acpi_dm_table_info_bert[]; +extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; +extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_dmar2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; +extern struct acpi_dmtable_info acpi_dm_table_info_einj[]; +extern struct acpi_dmtable_info acpi_dm_table_info_einj0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_erst[]; +extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; +extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; +extern struct acpi_dmtable_info acpi_dm_table_info_header[]; +extern struct acpi_dmtable_info acpi_dm_table_info_hest[]; +extern struct acpi_dmtable_info acpi_dm_table_info_hest9[]; +extern struct acpi_dmtable_info acpi_dm_table_info_hest_notify[]; +extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt3[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt4[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt9[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt10[]; +extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; +extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; +extern struct acpi_dmtable_info acpi_dm_table_info_slic[]; +extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; +extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; +extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; +extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[]; +extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; +extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; +extern struct acpi_dmtable_info acpi_dm_table_info_srat2[]; +extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; +extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; + +/* + * dmtable + */ +void acpi_dm_dump_data_table(struct acpi_table_header *table); + +acpi_status +acpi_dm_dump_table(u32 table_length, + u32 table_offset, + void *table, + u32 sub_table_length, struct acpi_dmtable_info *info); + +void acpi_dm_line_header(u32 offset, u32 byte_length, char *name); + +void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value); + +/* + * dmtbdump + */ +void acpi_dm_dump_asf(struct acpi_table_header *table); + +void acpi_dm_dump_cpep(struct acpi_table_header *table); + +void acpi_dm_dump_dmar(struct acpi_table_header *table); + +void acpi_dm_dump_einj(struct acpi_table_header *table); + +void acpi_dm_dump_erst(struct acpi_table_header *table); + +void acpi_dm_dump_fadt(struct acpi_table_header *table); + +void acpi_dm_dump_hest(struct acpi_table_header *table); + +void acpi_dm_dump_mcfg(struct acpi_table_header *table); + +void acpi_dm_dump_madt(struct acpi_table_header *table); + +u32 acpi_dm_dump_rsdp(struct acpi_table_header *table); + +void acpi_dm_dump_rsdt(struct acpi_table_header *table); + +void acpi_dm_dump_slit(struct acpi_table_header *table); + +void acpi_dm_dump_srat(struct acpi_table_header *table); + +void acpi_dm_dump_xsdt(struct acpi_table_header *table); + +/* + * dmwalk + */ +void +acpi_dm_disassemble(struct acpi_walk_state *walk_state, + union acpi_parse_object *origin, u32 num_opcodes); + +void +acpi_dm_walk_parse_tree(union acpi_parse_object *op, + asl_walk_callback descending_callback, + asl_walk_callback ascending_callback, void *context); + +/* + * dmopcode + */ +void +acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state, + struct acpi_op_walk_info *info, + union acpi_parse_object *op); + +void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc); + +u32 acpi_dm_list_type(union acpi_parse_object *op); + +void acpi_dm_method_flags(union acpi_parse_object *op); + +void acpi_dm_field_flags(union acpi_parse_object *op); + +void acpi_dm_address_space(u8 space_id); + +void acpi_dm_region_flags(union acpi_parse_object *op); + +void acpi_dm_match_op(union acpi_parse_object *op); + +u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op); + +void acpi_dm_comma_if_field_member(union acpi_parse_object *op); + +/* + * dmnames + */ +u32 acpi_dm_dump_name(char *name); + +acpi_status +acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state, + union acpi_parse_object *op); + +void acpi_dm_namestring(char *name); + +/* + * dmobject + */ +void +acpi_dm_display_internal_object(union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state); + +void acpi_dm_display_arguments(struct acpi_walk_state *walk_state); + +void acpi_dm_display_locals(struct acpi_walk_state *walk_state); + +void +acpi_dm_dump_method_info(acpi_status status, + struct acpi_walk_state *walk_state, + union acpi_parse_object *op); + +/* + * dmbuffer + */ +void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count); + +void +acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op); + +void acpi_dm_is_eisa_id(union acpi_parse_object *op); + +void acpi_dm_eisa_id(u32 encoded_id); + +u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op); + +u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); + +/* + * dmresrc + */ +void acpi_dm_dump_integer8(u8 value, char *name); + +void acpi_dm_dump_integer16(u16 value, char *name); + +void acpi_dm_dump_integer32(u32 value, char *name); + +void acpi_dm_dump_integer64(u64 value, char *name); + +void +acpi_dm_resource_template(struct acpi_op_walk_info *info, + union acpi_parse_object *op, + u8 * byte_data, u32 byte_count); + +acpi_status acpi_dm_is_resource_template(union acpi_parse_object *op); + +void acpi_dm_indent(u32 level); + +void acpi_dm_bit_list(u16 mask); + +void acpi_dm_decode_attribute(u8 attribute); + +void acpi_dm_descriptor_name(void); + +/* + * dmresrcl + */ +void +acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); + +void +acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); + +void +acpi_dm_extended_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); + +void +acpi_dm_memory24_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_memory32_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_generic_register_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_interrupt_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_vendor_large_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); + +/* + * dmresrcs + */ +void +acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); + +void +acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); + +void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); + +void +acpi_dm_fixed_io_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_start_dependent_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_end_dependent_descriptor(union aml_resource *resource, + u32 length, u32 level); + +void +acpi_dm_vendor_small_descriptor(union aml_resource *resource, + u32 length, u32 level); + +/* + * dmutils + */ +void acpi_dm_add_to_external_list(char *path, u8 type, u32 value); + +/* + * dmrestag + */ +void acpi_dm_find_resources(union acpi_parse_object *root); + +void +acpi_dm_check_resource_reference(union acpi_parse_object *op, + struct acpi_walk_state *walk_state); + +#endif /* __ACDISASM_H__ */ diff --git a/trunk/drivers/acpi/acpica/acdispat.h b/trunk/include/acpi/acdispat.h similarity index 100% rename from trunk/drivers/acpi/acpica/acdispat.h rename to trunk/include/acpi/acdispat.h diff --git a/trunk/drivers/acpi/acpica/acevents.h b/trunk/include/acpi/acevents.h similarity index 97% rename from trunk/drivers/acpi/acpica/acevents.h rename to trunk/include/acpi/acevents.h index 07e20135f01b..d5d099bf349c 100644 --- a/trunk/drivers/acpi/acpica/acevents.h +++ b/trunk/include/acpi/acevents.h @@ -93,13 +93,11 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, */ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); -acpi_status -acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context); +acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback); acpi_status acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, - void *context); + struct acpi_gpe_block_info *gpe_block); acpi_status acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, diff --git a/trunk/include/acpi/acexcep.h b/trunk/include/acpi/acexcep.h index eda04546cdf6..84f5cb242863 100644 --- a/trunk/include/acpi/acexcep.h +++ b/trunk/include/acpi/acexcep.h @@ -153,9 +153,8 @@ #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML) #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML) #define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML) -#define AE_AML_INFINITE_LOOP (acpi_status) (0x0021 | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0021 +#define AE_CODE_AML_MAX 0x0020 /* * Internal exceptions used for control @@ -176,8 +175,6 @@ #define AE_CODE_CTRL_MAX 0x000D -/* Exception strings for acpi_format_exception */ - #ifdef DEFINE_ACPI_GLOBALS /* @@ -270,7 +267,6 @@ char const *acpi_gbl_exception_names_aml[] = { "AE_AML_CIRCULAR_REFERENCE", "AE_AML_BAD_RESOURCE_LENGTH", "AE_AML_ILLEGAL_ADDRESS", - "AE_AML_INFINITE_LOOP" }; char const *acpi_gbl_exception_names_ctrl[] = { diff --git a/trunk/drivers/acpi/acpica/acglobal.h b/trunk/include/acpi/acglobal.h similarity index 97% rename from trunk/drivers/acpi/acpica/acglobal.h rename to trunk/include/acpi/acglobal.h index ddb40f5c68fc..15dda46b70d1 100644 --- a/trunk/drivers/acpi/acpica/acglobal.h +++ b/trunk/include/acpi/acglobal.h @@ -102,12 +102,6 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); */ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); -/* - * Optionally use default values for the ACPI register widths. Set this to - * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. - */ -ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); - /***************************************************************************** * * Debug support @@ -146,7 +140,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; */ ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; -ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; +extern u8 acpi_gbl_permanent_mmap; /* These addresses are calculated from FADT address values */ @@ -332,7 +326,6 @@ ACPI_EXTERN struct acpi_fixed_event_handler ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; -ACPI_EXTERN u32 acpi_current_gpe_count; /***************************************************************************** * diff --git a/trunk/drivers/acpi/acpica/achware.h b/trunk/include/acpi/achware.h similarity index 89% rename from trunk/drivers/acpi/acpica/achware.h rename to trunk/include/acpi/achware.h index 58c69dc49ab4..97a72b193276 100644 --- a/trunk/drivers/acpi/acpica/achware.h +++ b/trunk/include/acpi/achware.h @@ -44,7 +44,11 @@ #ifndef __ACHWARE_H__ #define __ACHWARE_H__ -/* Values for the _SST predefined method */ +/* PM Timer ticks per second (HZ) */ + +#define PM_TIMER_FREQUENCY 3579545 + +/* Values for the _SST reserved method */ #define ACPI_SST_INDICATOR_OFF 0 #define ACPI_SST_WORKING 1 @@ -52,6 +56,8 @@ #define ACPI_SST_SLEEPING 3 #define ACPI_SST_SLEEP_CONTEXT 4 +/* Prototypes */ + /* * hwacpi - high level functions */ @@ -69,6 +75,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value); acpi_status acpi_hw_register_write(u32 register_id, u32 value); +acpi_status +acpi_hw_low_level_read(u32 width, + u32 * value, struct acpi_generic_address *reg); + +acpi_status +acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg); + acpi_status acpi_hw_clear_acpi_status(void); /* @@ -81,13 +94,13 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); acpi_status acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context); + struct acpi_gpe_block_info *gpe_block); acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info); acpi_status acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context); + struct acpi_gpe_block_info *gpe_block); acpi_status acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, @@ -101,8 +114,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void); acpi_status acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, - void *context); + struct acpi_gpe_block_info *gpe_block); #ifdef ACPI_FUTURE_USAGE /* diff --git a/trunk/drivers/acpi/acpica/acinterp.h b/trunk/include/acpi/acinterp.h similarity index 100% rename from trunk/drivers/acpi/acpica/acinterp.h rename to trunk/include/acpi/acinterp.h diff --git a/trunk/drivers/acpi/acpica/aclocal.h b/trunk/include/acpi/aclocal.h similarity index 95% rename from trunk/drivers/acpi/acpica/aclocal.h rename to trunk/include/acpi/aclocal.h index 492d02761bb7..ecab527cf78e 100644 --- a/trunk/drivers/acpi/acpica/aclocal.h +++ b/trunk/include/acpi/aclocal.h @@ -46,6 +46,8 @@ /* acpisrc:struct_defs -- for acpisrc conversion */ +#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ +#define ACPI_DO_NOT_WAIT 0 #define ACPI_SERIALIZED 0xFF typedef u32 acpi_mutex_handle; @@ -118,6 +120,11 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { #define ACPI_MAX_LOCK 1 #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 +/* Owner IDs are used to track namespace nodes for selective deletion */ + +typedef u8 acpi_owner_id; +#define ACPI_OWNER_ID_MAX 0xFF + /* This Thread ID means that the mutex is not in use (unlocked) */ #define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0 @@ -158,6 +165,11 @@ typedef enum { ACPI_IMODE_EXECUTE = 0x03 } acpi_interpreter_mode; +union acpi_name_union { + u32 integer; + char ascii[4]; +}; + /* * The Namespace Node describes a named object that appears in the AML. * descriptor_type is used to differentiate between internal descriptors. @@ -204,6 +216,26 @@ struct acpi_namespace_node { #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ +/* + * ACPI Table Descriptor. One per ACPI table + */ +struct acpi_table_desc { + acpi_physical_address address; + struct acpi_table_header *pointer; + u32 length; /* Length fixed at 32 bits */ + union acpi_name_union signature; + acpi_owner_id owner_id; + u8 flags; +}; + +/* Flags for above */ + +#define ACPI_TABLE_ORIGIN_UNKNOWN (0) +#define ACPI_TABLE_ORIGIN_MAPPED (1) +#define ACPI_TABLE_ORIGIN_ALLOCATED (2) +#define ACPI_TABLE_ORIGIN_MASK (3) +#define ACPI_TABLE_IS_LOADED (4) + /* One internal RSDT for table management */ struct acpi_internal_rsdt { @@ -234,6 +266,15 @@ struct acpi_ns_search_data { struct acpi_namespace_node *node; }; +/* + * Predefined Namespace items + */ +struct acpi_predefined_names { + char *name; + u8 type; + char *val; +}; + /* Object types used during package copies */ #define ACPI_COPY_TYPE_SIMPLE 0 @@ -446,15 +487,10 @@ struct acpi_gpe_walk_info { struct acpi_gpe_block_info *gpe_block; }; -struct acpi_gpe_device_info { - u32 index; - u32 next_block_base_index; - acpi_status status; - struct acpi_namespace_node *gpe_device; -}; - -typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info, - struct acpi_gpe_block_info *gpe_block, void *context); +typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * + gpe_xrupt_info, + struct acpi_gpe_block_info * + gpe_block); /* Information about each particular fixed event */ @@ -530,7 +566,6 @@ struct acpi_control_state { union acpi_parse_object *predicate_op; u8 *aml_predicate_start; /* Start of if/while predicate */ u8 *package_end; /* End of if/while block */ - u32 loop_count; /* While() loop counter */ }; /* @@ -636,12 +671,6 @@ union acpi_parse_value { union acpi_parse_object *arg; /* arguments and contained ops */ }; -#ifdef ACPI_DISASSEMBLER -#define ACPI_DISASM_ONLY_MEMBERS(a) a; -#else -#define ACPI_DISASM_ONLY_MEMBERS(a) -#endif - #define ACPI_PARSE_COMMON \ union acpi_parse_object *parent; /* Parent op */\ u8 descriptor_type; /* To differentiate various internal objs */\ @@ -761,6 +790,9 @@ struct acpi_parse_state { * ****************************************************************************/ +#define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" + struct acpi_bit_register_info { u8 parent_register; u8 bit_position; @@ -987,4 +1019,26 @@ struct acpi_debug_mem_block { #define ACPI_MEM_LIST_MAX 1 #define ACPI_NUM_MEM_LISTS 2 +struct acpi_memory_list { + char *list_name; + void *list_head; + u16 object_size; + u16 max_depth; + u16 current_depth; + u16 link_offset; + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Statistics for debug memory tracking only */ + + u32 total_allocated; + u32 total_freed; + u32 max_occupied; + u32 total_size; + u32 current_total_size; + u32 requests; + u32 hits; +#endif +}; + #endif /* __ACLOCAL_H__ */ diff --git a/trunk/drivers/acpi/acpica/acmacros.h b/trunk/include/acpi/acmacros.h similarity index 83% rename from trunk/drivers/acpi/acpica/acmacros.h rename to trunk/include/acpi/acmacros.h index c57286a3aceb..a597207e2835 100644 --- a/trunk/drivers/acpi/acpica/acmacros.h +++ b/trunk/include/acpi/acmacros.h @@ -44,6 +44,23 @@ #ifndef __ACMACROS_H__ #define __ACMACROS_H__ +/* + * Data manipulation macros + */ +#define ACPI_LOWORD(l) ((u16)(u32)(l)) +#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) +#define ACPI_LOBYTE(l) ((u8)(u16)(l)) +#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) + +#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) +#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) +#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) +#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) + +/* Size calculation */ + +#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) + /* * Extract data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below. @@ -58,6 +75,39 @@ #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) +/* + * Pointer manipulation + */ +#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) +#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b))) +#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b))) + +/* Pointer/Integer type conversions */ + +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i) +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) +#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) +#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) +#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) + +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#define ACPI_COMPARE_NAME(a, b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) +#else +#define ACPI_COMPARE_NAME(a, b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) +#endif + +/* + * Full 64-bit integer must be available on both 32-bit and 64-bit platforms + */ +struct acpi_integer_overlay { + u32 lo_dword; + u32 hi_dword; +}; + +#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword) +#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword) + /* * printf() format helpers */ @@ -159,7 +209,7 @@ /* * The hardware does not support unaligned transfers. We must move the * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. (Little-endian move) + * the destination (or both) is/are unaligned. (Little-endian move) */ /* 16-bit source, 16/32/64 destination */ @@ -307,6 +357,12 @@ {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type} #endif +#ifdef ACPI_DISASSEMBLER +#define ACPI_DISASM_ONLY_MEMBERS(a) a; +#else +#define ACPI_DISASM_ONLY_MEMBERS(a) +#endif + #define ARG_TYPE_WIDTH 5 #define ARG_1(x) ((u32)(x)) #define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) @@ -332,16 +388,32 @@ #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) +#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) +/* + * Module name is include in both debug and non-debug versions primarily for + * error messages. The __FILE__ macro is not very useful for this, because it + * often includes the entire pathname to the module + */ +#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; +#else +#define ACPI_MODULE_NAME(name) +#endif + /* * Ascii error messages can be configured out */ #ifndef ACPI_NO_ERROR_MESSAGES +#define AE_INFO _acpi_module_name, __LINE__ /* * Error reporting. Callers module and line number are inserted by AE_INFO, * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */ +#define ACPI_INFO(plist) acpi_ut_info plist +#define ACPI_WARNING(plist) acpi_ut_warning plist +#define ACPI_EXCEPTION(plist) acpi_ut_exception plist +#define ACPI_ERROR(plist) acpi_ut_error plist #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); @@ -349,18 +421,50 @@ /* No error messages */ +#define ACPI_INFO(plist) +#define ACPI_WARNING(plist) +#define ACPI_EXCEPTION(plist) +#define ACPI_ERROR(plist) #define ACPI_ERROR_NAMESPACE(s, e) #define ACPI_ERROR_METHOD(s, n, p, e) -#endif /* ACPI_NO_ERROR_MESSAGES */ +#endif /* * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT +/* + * Common parameters used for debug output functions: + * line number, function name, module(file) name, component ID + */ +#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT + /* * Function entry tracing */ + +/* + * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, + * define it now. This is the case where there the compiler does not support + * a __func__ macro or equivalent. + */ +#ifndef ACPI_GET_FUNCTION_NAME +#define ACPI_GET_FUNCTION_NAME _acpi_function_name +/* + * The Name parameter should be the procedure name as a quoted string. + * The function name is also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __func__. + */ +#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; + +#else +/* Compiler supports __func__ (or equivalent) -- Ignore this macro */ + +#define ACPI_FUNCTION_NAME(name) +#endif + #ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ @@ -480,6 +584,15 @@ #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) #define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) +/* + * Master debug print macros + * Print iff: + * 1) Debug print for the current component is enabled + * 2) Debug error level or trace level for the print statement is enabled + */ +#define ACPI_DEBUG_PRINT(plist) acpi_ut_debug_print plist +#define ACPI_DEBUG_PRINT_RAW(plist) acpi_ut_debug_print_raw plist + #else /* * This is the non-debug case -- make everything go away, @@ -490,6 +603,7 @@ #define ACPI_DEBUG_DEFINE(a) do { } while(0) #define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) +#define ACPI_FUNCTION_NAME(a) do { } while(0) #define ACPI_FUNCTION_TRACE(a) do { } while(0) #define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0) #define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0) @@ -505,6 +619,8 @@ #define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0) #define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0) #define ACPI_DUMP_BUFFER(a, b) do { } while(0) +#define ACPI_DEBUG_PRINT(pl) do { } while(0) +#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0) #define return_VOID return #define return_ACPI_STATUS(s) return(s) @@ -513,7 +629,7 @@ #define return_UINT32(s) return(s) #define return_PTR(s) return(s) -#endif /* ACPI_DEBUG_OUTPUT */ +#endif /* * Some code only gets executed when the debugger is built in. diff --git a/trunk/drivers/acpi/acpica/acnamesp.h b/trunk/include/acpi/acnamesp.h similarity index 98% rename from trunk/drivers/acpi/acpica/acnamesp.h rename to trunk/include/acpi/acnamesp.h index 46cb5b46d280..db4e6f677855 100644 --- a/trunk/drivers/acpi/acpica/acnamesp.h +++ b/trunk/include/acpi/acnamesp.h @@ -182,9 +182,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); */ acpi_status acpi_ns_check_predefined_names(struct acpi_namespace_node *node, - u32 user_param_count, - acpi_status return_status, - union acpi_operand_object **return_object); + union acpi_operand_object *return_object); const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct acpi_namespace_node @@ -193,7 +191,6 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct void acpi_ns_check_parameter_count(char *pathname, struct acpi_namespace_node *node, - u32 user_param_count, const union acpi_predefined_info *info); /* diff --git a/trunk/drivers/acpi/acpica/acobject.h b/trunk/include/acpi/acobject.h similarity index 100% rename from trunk/drivers/acpi/acpica/acobject.h rename to trunk/include/acpi/acobject.h diff --git a/trunk/drivers/acpi/acpica/acopcode.h b/trunk/include/acpi/acopcode.h similarity index 100% rename from trunk/drivers/acpi/acpica/acopcode.h rename to trunk/include/acpi/acopcode.h diff --git a/trunk/include/acpi/acoutput.h b/trunk/include/acpi/acoutput.h index 5c823d5ab783..09d33c7740f0 100644 --- a/trunk/include/acpi/acoutput.h +++ b/trunk/include/acpi/acoutput.h @@ -45,9 +45,9 @@ #define __ACOUTPUT_H__ /* - * Debug levels and component IDs. These are used to control the - * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a - * per-component basis and a per-exception-type basis. + * Debug levels and component IDs. These are used to control the + * granularity of the output of the DEBUG_PRINT macro -- on a per- + * component basis and a per-exception-type basis. */ /* Component IDs are used in the global "DebugLayer" */ @@ -69,10 +69,8 @@ #define ACPI_COMPILER 0x00001000 #define ACPI_TOOLS 0x00002000 -#define ACPI_EXAMPLE 0x00004000 -#define ACPI_DRIVER 0x00008000 -#define ACPI_ALL_COMPONENTS 0x0000FFFF +#define ACPI_ALL_COMPONENTS 0x00003FFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) /* Component IDs reserved for ACPI drivers */ @@ -80,7 +78,7 @@ #define ACPI_ALL_DRIVERS 0xFFFF0000 /* - * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros + * Raw debug output levels, do not use these in the DEBUG_PRINT macros */ #define ACPI_LV_INIT 0x00000001 #define ACPI_LV_DEBUG_OBJECT 0x00000002 @@ -174,99 +172,8 @@ /* Defaults for debug_level, debug and normal */ -#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO) +#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) -#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) -/* - * Module name is included in both debug and non-debug versions primarily for - * error messages. The __FILE__ macro is not very useful for this, because it - * often includes the entire pathname to the module - */ -#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; -#else -#define ACPI_MODULE_NAME(name) -#endif - -/* - * Ascii error messages can be configured out - */ -#ifndef ACPI_NO_ERROR_MESSAGES -#define AE_INFO _acpi_module_name, __LINE__ - -/* - * Error reporting. Callers module and line number are inserted by AE_INFO, - * the plist contains a set of parens to allow variable-length lists. - * These macros are used for both the debug and non-debug versions of the code. - */ -#define ACPI_INFO(plist) acpi_info plist -#define ACPI_WARNING(plist) acpi_warning plist -#define ACPI_EXCEPTION(plist) acpi_exception plist -#define ACPI_ERROR(plist) acpi_error plist - -#else - -/* No error messages */ - -#define ACPI_INFO(plist) -#define ACPI_WARNING(plist) -#define ACPI_EXCEPTION(plist) -#define ACPI_ERROR(plist) - -#endif /* ACPI_NO_ERROR_MESSAGES */ - -/* - * Debug macros that are conditionally compiled - */ -#ifdef ACPI_DEBUG_OUTPUT - -/* - * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, - * define it now. This is the case where there the compiler does not support - * a __FUNCTION__ macro or equivalent. - */ -#ifndef ACPI_GET_FUNCTION_NAME -#define ACPI_GET_FUNCTION_NAME _acpi_function_name - -/* - * The Name parameter should be the procedure name as a quoted string. - * The function name is also used by the function exit macros below. - * Note: (const char) is used to be compatible with the debug interfaces - * and macros such as __FUNCTION__. - */ -#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; - -#else -/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ - -#define ACPI_FUNCTION_NAME(name) -#endif /* ACPI_GET_FUNCTION_NAME */ - -/* - * Common parameters used for debug output functions: - * line number, function name, module(file) name, component ID - */ -#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT - -/* - * Master debug print macros - * Print message if and only if: - * 1) Debug print for the current component is enabled - * 2) Debug error level or trace level for the print statement is enabled - */ -#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist -#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist - -#else -/* - * This is the non-debug case -- make everything go away, - * leaving no executable debug code! - */ -#define ACPI_FUNCTION_NAME(a) -#define ACPI_DEBUG_PRINT(pl) -#define ACPI_DEBUG_PRINT_RAW(pl) - -#endif /* ACPI_DEBUG_OUTPUT */ - #endif /* __ACOUTPUT_H__ */ diff --git a/trunk/drivers/acpi/acpica/acparser.h b/trunk/include/acpi/acparser.h similarity index 100% rename from trunk/drivers/acpi/acpica/acparser.h rename to trunk/include/acpi/acparser.h diff --git a/trunk/include/acpi/acpi.h b/trunk/include/acpi/acpi.h index 472b7bf0c5d4..c515ef6cc89e 100644 --- a/trunk/include/acpi/acpi.h +++ b/trunk/include/acpi/acpi.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: acpi.h - Master public include file used to interface to ACPICA + * Name: acpi.h - Master include file, Publics and external data. * *****************************************************************************/ @@ -45,22 +45,25 @@ #define __ACPI_H__ /* - * Public include files for use by code that will interface to ACPICA. - * - * Information includes the ACPICA data types, names, exceptions, and - * external interface prototypes. Also included are the definitions for - * all ACPI tables (FADT, MADT, etc.) - * - * Note: The order of these include files is important. + * Common includes for all ACPI driver files + * We put them here because we don't want to duplicate them + * in the rest of the source code again and again. */ -#include "platform/acenv.h" /* Environment-specific items */ -#include "acnames.h" /* Common ACPI names and strings */ -#include "actypes.h" /* ACPICA data types and structures */ -#include "acexcep.h" /* ACPICA exceptions */ +#include "acnames.h" /* Global ACPI names and strings */ +#include "acconfig.h" /* Configuration constants */ +#include "platform/acenv.h" /* Target environment specific items */ +#include "actypes.h" /* Fundamental common data types */ +#include "acexcep.h" /* ACPI exception codes */ +#include "acmacros.h" /* C macros */ #include "actbl.h" /* ACPI table definitions */ +#include "aclocal.h" /* Internal data types */ #include "acoutput.h" /* Error output and Debug macros */ -#include "acrestyp.h" /* Resource Descriptor structs */ -#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ +#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer */ #include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ #endif /* __ACPI_H__ */ diff --git a/trunk/include/acpi/acpiosxf.h b/trunk/include/acpi/acpiosxf.h index a62720a7edc0..b91440ac0d16 100644 --- a/trunk/include/acpi/acpiosxf.h +++ b/trunk/include/acpi/acpiosxf.h @@ -121,11 +121,8 @@ acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout); acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); /* - * Mutex primitives. May be configured to use semaphores instead via - * ACPI_MUTEX_TYPE (see platform/acenv.h) + * Mutex primitives */ -#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) - acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); void acpi_os_delete_mutex(acpi_mutex handle); @@ -133,7 +130,13 @@ void acpi_os_delete_mutex(acpi_mutex handle); acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); void acpi_os_release_mutex(acpi_mutex handle); -#endif + +/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */ + +#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle) +#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle) +#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time) +#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1) /* * Memory allocation and mapping diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index c8e8cf45830f..33bc0e3b1954 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -45,32 +45,9 @@ #ifndef __ACXFACE_H__ #define __ACXFACE_H__ -/* Current ACPICA subsystem version in YYYYMMDD format */ - -#define ACPI_CA_VERSION 0x20081204 - #include "actypes.h" #include "actbl.h" -extern u8 acpi_gbl_permanent_mmap; - -/* - * Globals that are publically available, allowing for - * run time configuration - */ -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; -extern u8 acpi_gbl_enable_interpreter_slack; -extern u8 acpi_gbl_all_methods_serialized; -extern u8 acpi_gbl_create_osi_method; -extern u8 acpi_gbl_leave_wake_gpes_disabled; -extern acpi_name acpi_gbl_trace_method_name; -extern u32 acpi_gbl_trace_flags; - -extern u32 acpi_current_gpe_count; -extern struct acpi_table_fadt acpi_gbl_FADT; - -extern u32 acpi_rsdt_forced; /* * Global interfaces */ @@ -102,6 +79,11 @@ const char *acpi_format_exception(acpi_status exception); acpi_status acpi_purge_cached_objects(void); +#ifdef ACPI_FUTURE_USAGE +acpi_status +acpi_install_initialization_handler(acpi_init_handler handler, u32 function); +#endif + /* * ACPI Memory management */ @@ -211,11 +193,8 @@ acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); /* - * Handler interfaces + * Event handler interfaces */ -acpi_status -acpi_install_initialization_handler(acpi_init_handler handler, u32 function); - acpi_status acpi_install_fixed_event_handler(u32 acpi_event, acpi_event_handler handler, void *context); @@ -248,10 +227,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device, u32 gpe_number, u32 type, acpi_event_handler address, void *context); -acpi_status -acpi_remove_gpe_handler(acpi_handle gpe_device, - u32 gpe_number, acpi_event_handler address); - #ifdef ACPI_FUTURE_USAGE acpi_status acpi_install_exception_handler(acpi_exception_handler handler); #endif @@ -263,6 +238,10 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); acpi_status acpi_release_global_lock(u32 handle); +acpi_status +acpi_remove_gpe_handler(acpi_handle gpe_device, + u32 gpe_number, acpi_event_handler address); + acpi_status acpi_enable_event(u32 event, u32 flags); acpi_status acpi_disable_event(u32 event, u32 flags); @@ -271,9 +250,6 @@ acpi_status acpi_clear_event(u32 event); acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); -/* - * GPE Interfaces - */ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); @@ -287,12 +263,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, u32 gpe_number, u32 flags, acpi_event_status * event_status); -acpi_status acpi_disable_all_gpes(void); - -acpi_status acpi_enable_all_runtime_gpes(void); - -acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device); - acpi_status acpi_install_gpe_block(acpi_handle gpe_device, struct acpi_generic_address *gpe_block_address, @@ -343,8 +313,6 @@ acpi_resource_to_address64(struct acpi_resource *resource, /* * Hardware (ACPI device) interfaces */ -acpi_status acpi_reset(void); - acpi_status acpi_get_register(u32 register_id, u32 * return_value); acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); @@ -352,14 +320,12 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); acpi_status acpi_set_register(u32 register_id, u32 value); acpi_status -acpi_set_firmware_waking_vector(u32 physical_address); +acpi_set_firmware_waking_vector(acpi_physical_address physical_address); +#ifdef ACPI_FUTURE_USAGE acpi_status -acpi_set_firmware_waking_vector64(u64 physical_address); - -acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); - -acpi_status acpi_write(u32 value, struct acpi_generic_address *reg); +acpi_get_firmware_waking_vector(acpi_physical_address * physical_address); +#endif acpi_status acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); @@ -374,42 +340,4 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); acpi_status acpi_leave_sleep_state(u8 sleep_state); -/* - * Debug output - */ -void ACPI_INTERNAL_VAR_XFACE -acpi_error(const char *module_name, - u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); - -void ACPI_INTERNAL_VAR_XFACE -acpi_exception(const char *module_name, - u32 line_number, - acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4); - -void ACPI_INTERNAL_VAR_XFACE -acpi_warning(const char *module_name, - u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); - -void ACPI_INTERNAL_VAR_XFACE -acpi_info(const char *module_name, - u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); - -#ifdef ACPI_DEBUG_OUTPUT - -void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print(u32 requested_debug_level, - u32 line_number, - const char *function_name, - const char *module_name, - u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6); - -void ACPI_INTERNAL_VAR_XFACE -acpi_debug_print_raw(u32 requested_debug_level, - u32 line_number, - const char *function_name, - const char *module_name, - u32 component_id, - const char *format, ...) ACPI_PRINTF_LIKE(6); -#endif - #endif /* __ACXFACE_H__ */ diff --git a/trunk/drivers/acpi/acpica/acpredef.h b/trunk/include/acpi/acpredef.h similarity index 100% rename from trunk/drivers/acpi/acpica/acpredef.h rename to trunk/include/acpi/acpredef.h diff --git a/trunk/drivers/acpi/acpica/acresrc.h b/trunk/include/acpi/acresrc.h similarity index 100% rename from trunk/drivers/acpi/acpica/acresrc.h rename to trunk/include/acpi/acresrc.h diff --git a/trunk/include/acpi/acrestyp.h b/trunk/include/acpi/acrestyp.h deleted file mode 100644 index 9ffe00feada6..000000000000 --- a/trunk/include/acpi/acrestyp.h +++ /dev/null @@ -1,405 +0,0 @@ -/****************************************************************************** - * - * Name: acrestyp.h - Defines, types, and structures for resource descriptors - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 - 2008, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#ifndef __ACRESTYP_H__ -#define __ACRESTYP_H__ - -/* - * Definitions for Resource Attributes - */ -typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ -typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ - -/* - * Memory Attributes - */ -#define ACPI_READ_ONLY_MEMORY (u8) 0x00 -#define ACPI_READ_WRITE_MEMORY (u8) 0x01 - -#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 -#define ACPI_CACHABLE_MEMORY (u8) 0x01 -#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 -#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 - -/* - * IO Attributes - * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. - * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. - */ -#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 -#define ACPI_ISA_ONLY_RANGES (u8) 0x02 -#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) - -/* Type of translation - 1=Sparse, 0=Dense */ - -#define ACPI_SPARSE_TRANSLATION (u8) 0x01 - -/* - * IO Port Descriptor Decode - */ -#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ -#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ - -/* - * IRQ Attributes - */ -#define ACPI_LEVEL_SENSITIVE (u8) 0x00 -#define ACPI_EDGE_SENSITIVE (u8) 0x01 - -#define ACPI_ACTIVE_HIGH (u8) 0x00 -#define ACPI_ACTIVE_LOW (u8) 0x01 - -#define ACPI_EXCLUSIVE (u8) 0x00 -#define ACPI_SHARED (u8) 0x01 - -/* - * DMA Attributes - */ -#define ACPI_COMPATIBILITY (u8) 0x00 -#define ACPI_TYPE_A (u8) 0x01 -#define ACPI_TYPE_B (u8) 0x02 -#define ACPI_TYPE_F (u8) 0x03 - -#define ACPI_NOT_BUS_MASTER (u8) 0x00 -#define ACPI_BUS_MASTER (u8) 0x01 - -#define ACPI_TRANSFER_8 (u8) 0x00 -#define ACPI_TRANSFER_8_16 (u8) 0x01 -#define ACPI_TRANSFER_16 (u8) 0x02 - -/* - * Start Dependent Functions Priority definitions - */ -#define ACPI_GOOD_CONFIGURATION (u8) 0x00 -#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 -#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 - -/* - * 16, 32 and 64-bit Address Descriptor resource types - */ -#define ACPI_MEMORY_RANGE (u8) 0x00 -#define ACPI_IO_RANGE (u8) 0x01 -#define ACPI_BUS_NUMBER_RANGE (u8) 0x02 - -#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 -#define ACPI_ADDRESS_FIXED (u8) 0x01 - -#define ACPI_POS_DECODE (u8) 0x00 -#define ACPI_SUB_DECODE (u8) 0x01 - -#define ACPI_PRODUCER (u8) 0x00 -#define ACPI_CONSUMER (u8) 0x01 - -/* - * If possible, pack the following structures to byte alignment - */ -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#pragma pack(1) -#endif - -/* UUID data structures for use in vendor-defined resource descriptors */ - -struct acpi_uuid { - u8 data[ACPI_UUID_LENGTH]; -}; - -struct acpi_vendor_uuid { - u8 subtype; - u8 data[ACPI_UUID_LENGTH]; -}; - -/* - * Structures used to describe device resources - */ -struct acpi_resource_irq { - u8 descriptor_length; - u8 triggering; - u8 polarity; - u8 sharable; - u8 interrupt_count; - u8 interrupts[1]; -}; - -struct acpi_resource_dma { - u8 type; - u8 bus_master; - u8 transfer; - u8 channel_count; - u8 channels[1]; -}; - -struct acpi_resource_start_dependent { - u8 descriptor_length; - u8 compatibility_priority; - u8 performance_robustness; -}; - -/* - * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not - * needed because it has no fields - */ - -struct acpi_resource_io { - u8 io_decode; - u8 alignment; - u8 address_length; - u16 minimum; - u16 maximum; -}; - -struct acpi_resource_fixed_io { - u16 address; - u8 address_length; -}; - -struct acpi_resource_vendor { - u16 byte_length; - u8 byte_data[1]; -}; - -/* Vendor resource with UUID info (introduced in ACPI 3.0) */ - -struct acpi_resource_vendor_typed { - u16 byte_length; - u8 uuid_subtype; - u8 uuid[ACPI_UUID_LENGTH]; - u8 byte_data[1]; -}; - -struct acpi_resource_end_tag { - u8 checksum; -}; - -struct acpi_resource_memory24 { - u8 write_protect; - u16 minimum; - u16 maximum; - u16 alignment; - u16 address_length; -}; - -struct acpi_resource_memory32 { - u8 write_protect; - u32 minimum; - u32 maximum; - u32 alignment; - u32 address_length; -}; - -struct acpi_resource_fixed_memory32 { - u8 write_protect; - u32 address; - u32 address_length; -}; - -struct acpi_memory_attribute { - u8 write_protect; - u8 caching; - u8 range_type; - u8 translation; -}; - -struct acpi_io_attribute { - u8 range_type; - u8 translation; - u8 translation_type; - u8 reserved1; -}; - -union acpi_resource_attribute { - struct acpi_memory_attribute mem; - struct acpi_io_attribute io; - - /* Used for the *word_space macros */ - - u8 type_specific; -}; - -struct acpi_resource_source { - u8 index; - u16 string_length; - char *string_ptr; -}; - -/* Fields common to all address descriptors, 16/32/64 bit */ - -#define ACPI_RESOURCE_ADDRESS_COMMON \ - u8 resource_type; \ - u8 producer_consumer; \ - u8 decode; \ - u8 min_address_fixed; \ - u8 max_address_fixed; \ - union acpi_resource_attribute info; - -struct acpi_resource_address { -ACPI_RESOURCE_ADDRESS_COMMON}; - -struct acpi_resource_address16 { - ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; - u16 minimum; - u16 maximum; - u16 translation_offset; - u16 address_length; - struct acpi_resource_source resource_source; -}; - -struct acpi_resource_address32 { - ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 minimum; - u32 maximum; - u32 translation_offset; - u32 address_length; - struct acpi_resource_source resource_source; -}; - -struct acpi_resource_address64 { - ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; - u64 minimum; - u64 maximum; - u64 translation_offset; - u64 address_length; - struct acpi_resource_source resource_source; -}; - -struct acpi_resource_extended_address64 { - ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; - u64 granularity; - u64 minimum; - u64 maximum; - u64 translation_offset; - u64 address_length; - u64 type_specific; -}; - -struct acpi_resource_extended_irq { - u8 producer_consumer; - u8 triggering; - u8 polarity; - u8 sharable; - u8 interrupt_count; - struct acpi_resource_source resource_source; - u32 interrupts[1]; -}; - -struct acpi_resource_generic_register { - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 access_size; - u64 address; -}; - -/* ACPI_RESOURCE_TYPEs */ - -#define ACPI_RESOURCE_TYPE_IRQ 0 -#define ACPI_RESOURCE_TYPE_DMA 1 -#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 -#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 -#define ACPI_RESOURCE_TYPE_IO 4 -#define ACPI_RESOURCE_TYPE_FIXED_IO 5 -#define ACPI_RESOURCE_TYPE_VENDOR 6 -#define ACPI_RESOURCE_TYPE_END_TAG 7 -#define ACPI_RESOURCE_TYPE_MEMORY24 8 -#define ACPI_RESOURCE_TYPE_MEMORY32 9 -#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 -#define ACPI_RESOURCE_TYPE_ADDRESS16 11 -#define ACPI_RESOURCE_TYPE_ADDRESS32 12 -#define ACPI_RESOURCE_TYPE_ADDRESS64 13 -#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ -#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 -#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 -#define ACPI_RESOURCE_TYPE_MAX 16 - -/* Master union for resource descriptors */ - -union acpi_resource_data { - struct acpi_resource_irq irq; - struct acpi_resource_dma dma; - struct acpi_resource_start_dependent start_dpf; - struct acpi_resource_io io; - struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor; - struct acpi_resource_vendor_typed vendor_typed; - struct acpi_resource_end_tag end_tag; - struct acpi_resource_memory24 memory24; - struct acpi_resource_memory32 memory32; - struct acpi_resource_fixed_memory32 fixed_memory32; - struct acpi_resource_address16 address16; - struct acpi_resource_address32 address32; - struct acpi_resource_address64 address64; - struct acpi_resource_extended_address64 ext_address64; - struct acpi_resource_extended_irq extended_irq; - struct acpi_resource_generic_register generic_reg; - - /* Common fields */ - - struct acpi_resource_address address; /* Common 16/32/64 address fields */ -}; - -/* Common resource header */ - -struct acpi_resource { - u32 type; - u32 length; - union acpi_resource_data data; -}; - -/* restore default alignment */ - -#pragma pack() - -#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ -#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) -#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) - -#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) - -struct acpi_pci_routing_table { - u32 length; - u32 pin; - acpi_integer address; /* here for 64-bit alignment */ - u32 source_index; - char source[4]; /* pad to 64 bits so sizeof() works in all cases */ -}; - -#endif /* __ACRESTYP_H__ */ diff --git a/trunk/drivers/acpi/acpica/acstruct.h b/trunk/include/acpi/acstruct.h similarity index 100% rename from trunk/drivers/acpi/acpica/acstruct.h rename to trunk/include/acpi/acstruct.h diff --git a/trunk/drivers/acpi/acpica/actables.h b/trunk/include/acpi/actables.h similarity index 98% rename from trunk/drivers/acpi/acpica/actables.h rename to trunk/include/acpi/actables.h index 7ce6e33c7f78..0cbe1b9ab522 100644 --- a/trunk/drivers/acpi/acpica/actables.h +++ b/trunk/include/acpi/actables.h @@ -94,8 +94,6 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); /* * tbutils - table manager utilities */ -acpi_status acpi_tb_initialize_facs(void); - u8 acpi_tb_tables_loaded(void); void diff --git a/trunk/include/acpi/actbl.h b/trunk/include/acpi/actbl.h index 813e4b6c2c0d..13a3d9ad92db 100644 --- a/trunk/include/acpi/actbl.h +++ b/trunk/include/acpi/actbl.h @@ -288,31 +288,6 @@ enum acpi_prefered_pm_profiles { #define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) -union acpi_name_union { - u32 integer; - char ascii[4]; -}; - -/* - * Internal ACPI Table Descriptor. One per ACPI table - */ -struct acpi_table_desc { - acpi_physical_address address; - struct acpi_table_header *pointer; - u32 length; /* Length fixed at 32 bits */ - union acpi_name_union signature; - acpi_owner_id owner_id; - u8 flags; -}; - -/* Flags for above */ - -#define ACPI_TABLE_ORIGIN_UNKNOWN (0) -#define ACPI_TABLE_ORIGIN_MAPPED (1) -#define ACPI_TABLE_ORIGIN_ALLOCATED (2) -#define ACPI_TABLE_ORIGIN_MASK (3) -#define ACPI_TABLE_IS_LOADED (4) - /* * Get the remaining ACPI tables */ diff --git a/trunk/include/acpi/actbl1.h b/trunk/include/acpi/actbl1.h index 18963b968114..63f5b4cf4de1 100644 --- a/trunk/include/acpi/actbl1.h +++ b/trunk/include/acpi/actbl1.h @@ -627,7 +627,7 @@ struct acpi_hest_aer_common { u32 uncorrectable_error_mask; u32 uncorrectable_error_severity; u32 correctable_error_mask; - u32 advanced_error_capabilities; + u32 advanced_error_cababilities; }; /* Hardware Error Notification */ diff --git a/trunk/include/acpi/actypes.h b/trunk/include/acpi/actypes.h index 03744d28dcf6..7220361790b3 100644 --- a/trunk/include/acpi/actypes.h +++ b/trunk/include/acpi/actypes.h @@ -204,10 +204,11 @@ typedef u32 acpi_physical_address; /******************************************************************************* * - * OS-dependent types + * OS-dependent and compiler-dependent types * * If the defaults below are not appropriate for the host system, they can - * be defined in the OS-specific header, and this will take precedence. + * be defined in the compiler-specific or OS-specific header, and this will + * take precedence. * ******************************************************************************/ @@ -217,6 +218,12 @@ typedef u32 acpi_physical_address; #define acpi_thread_id acpi_size #endif +/* Object returned from acpi_os_create_lock */ + +#ifndef acpi_spinlock +#define acpi_spinlock void * +#endif + /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ #ifndef acpi_cpu_flags @@ -226,51 +233,9 @@ typedef u32 acpi_physical_address; /* Object returned from acpi_os_create_cache */ #ifndef acpi_cache_t -#ifdef ACPI_USE_LOCAL_CACHE #define acpi_cache_t struct acpi_memory_list -#else -#define acpi_cache_t void * -#endif -#endif - -/* - * Synchronization objects - Mutexes, Semaphores, and spin_locks - */ -#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) -/* - * These macros are used if the host OS does not support a mutex object. - * Map the OSL Mutex interfaces to binary semaphores. - */ -#define acpi_mutex acpi_semaphore -#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle) -#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle) -#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time) -#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1) -#endif - -/* Configurable types for synchronization objects */ - -#ifndef acpi_spinlock -#define acpi_spinlock void * -#endif - -#ifndef acpi_semaphore -#define acpi_semaphore void * -#endif - -#ifndef acpi_mutex -#define acpi_mutex void * #endif -/******************************************************************************* - * - * Compiler-dependent types - * - * If the defaults below are not appropriate for the host compiler, they can - * be defined in the compiler-specific header, and this will take precedence. - * - ******************************************************************************/ - /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ #ifndef acpi_uintptr_t @@ -303,43 +268,6 @@ typedef u32 acpi_physical_address; #define ACPI_EXPORT_SYMBOL(symbol) #endif -/****************************************************************************** - * - * ACPI Specification constants (Do not change unless the specification changes) - * - *****************************************************************************/ - -/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ - -#define ACPI_MAX_GPE_BLOCKS 2 - -/* Default ACPI register widths */ - -#define ACPI_GPE_REGISTER_WIDTH 8 -#define ACPI_PM1_REGISTER_WIDTH 16 -#define ACPI_PM2_REGISTER_WIDTH 8 -#define ACPI_PM_TIMER_WIDTH 32 - -/* Names within the namespace are 4 bytes long */ - -#define ACPI_NAME_SIZE 4 -#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ -#define ACPI_PATH_SEPARATOR '.' - -/* Sizes for ACPI table headers */ - -#define ACPI_OEM_ID_SIZE 6 -#define ACPI_OEM_TABLE_ID_SIZE 8 - -/* ACPI/PNP hardware IDs */ - -#define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" - -/* PM Timer ticks per second (HZ) */ - -#define PM_TIMER_FREQUENCY 3579545 - /******************************************************************************* * * Independent types @@ -363,18 +291,13 @@ typedef u32 acpi_physical_address; #endif /* - * Miscellaneous types + * Mescellaneous types */ typedef u32 acpi_status; /* All ACPI Exceptions */ typedef u32 acpi_name; /* 4-byte ACPI name */ typedef char *acpi_string; /* Null terminated ASCII string */ typedef void *acpi_handle; /* Actually a ptr to a NS Node */ -/* Owner IDs are used to track namespace nodes for selective deletion */ - -typedef u8 acpi_owner_id; -#define ACPI_OWNER_ID_MAX 0xFF - struct uint64_struct { u32 lo; u32 hi; @@ -390,8 +313,13 @@ struct uint32_struct { u32 hi; }; +/* Synchronization objects */ + +#define acpi_mutex void * +#define acpi_semaphore void * + /* - * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI + * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI * version 2, integers are 64 bits. Note that this pertains to the ACPI integer * type only, not other integers used in the implementation of the ACPI CA * subsystem. @@ -410,75 +338,10 @@ typedef unsigned long long acpi_integer; #define ACPI_MAX16_DECIMAL_DIGITS 5 #define ACPI_MAX8_DECIMAL_DIGITS 3 -/* PM Timer ticks per second (HZ) */ - -#define PM_TIMER_FREQUENCY 3579545 - /* * Constants with special meanings */ #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) -#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ -#define ACPI_DO_NOT_WAIT 0 - -/******************************************************************************* - * - * Commonly used macros - * - ******************************************************************************/ - -/* Data manipulation */ - -#define ACPI_LOWORD(l) ((u16)(u32)(l)) -#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) -#define ACPI_LOBYTE(l) ((u8)(u16)(l)) -#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) - -/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ - -struct acpi_integer_overlay { - u32 lo_dword; - u32 hi_dword; -}; - -#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword) -#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword) - -#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) -#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) -#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) -#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) - -/* Size calculation */ - -#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) - -/* Pointer manipulation */ - -#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) -#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b))) -#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b))) - -/* Pointer/Integer type conversions */ - -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i) -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) -#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) -#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) -#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) - -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) -#else -#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) -#endif - -/******************************************************************************* - * - * Miscellaneous constants - * - ******************************************************************************/ /* * Initialization sequence @@ -551,7 +414,7 @@ struct acpi_integer_overlay { #define ACPI_NOTIFY_MAX 0x0B /* - * Types associated with ACPI names and objects. The first group of + * Types associated with ACPI names and objects. The first group of * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition * of the ACPI object_type() operator (See the ACPI Spec). Therefore, * only add to the first group if the spec changes. @@ -868,15 +731,6 @@ struct acpi_buffer { #define ACPI_SINGLE_NAME 1 #define ACPI_NAME_TYPE_MAX 1 -/* - * Predefined Namespace items - */ -struct acpi_predefined_names { - char *name; - u8 type; - char *val; -}; - /* * Structure and flags for acpi_get_system_info */ @@ -933,7 +787,7 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status, u16 opcode, u32 aml_offset, void *context); -/* Table Event handler (Load, load_table, etc.) and types */ +/* Table Event handler (Load, load_table etc) and types */ typedef acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); @@ -969,12 +823,6 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 -/* Length of _HID, _UID, _CID, and UUID values */ - -#define ACPI_DEVICE_ID_LENGTH 0x09 -#define ACPI_MAX_CID_LENGTH 48 -#define ACPI_UUID_LENGTH 16 - /* Common string version of device HIDs and UIDs */ struct acpica_device_id { @@ -1052,28 +900,357 @@ struct acpi_mem_space_context { }; /* - * struct acpi_memory_list is used only if the ACPICA local cache is enabled + * Definitions for Resource Attributes + */ +typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ +typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ + +/* + * Memory Attributes + */ +#define ACPI_READ_ONLY_MEMORY (u8) 0x00 +#define ACPI_READ_WRITE_MEMORY (u8) 0x01 + +#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 +#define ACPI_CACHABLE_MEMORY (u8) 0x01 +#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 +#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 + +/* + * IO Attributes + * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. + * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. */ -struct acpi_memory_list { - char *list_name; - void *list_head; - u16 object_size; - u16 max_depth; - u16 current_depth; - u16 link_offset; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Statistics for debug memory tracking only */ - - u32 total_allocated; - u32 total_freed; - u32 max_occupied; - u32 total_size; - u32 current_total_size; - u32 requests; - u32 hits; +#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 +#define ACPI_ISA_ONLY_RANGES (u8) 0x02 +#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) + +/* Type of translation - 1=Sparse, 0=Dense */ + +#define ACPI_SPARSE_TRANSLATION (u8) 0x01 + +/* + * IO Port Descriptor Decode + */ +#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ +#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ + +/* + * IRQ Attributes + */ +#define ACPI_LEVEL_SENSITIVE (u8) 0x00 +#define ACPI_EDGE_SENSITIVE (u8) 0x01 + +#define ACPI_ACTIVE_HIGH (u8) 0x00 +#define ACPI_ACTIVE_LOW (u8) 0x01 + +#define ACPI_EXCLUSIVE (u8) 0x00 +#define ACPI_SHARED (u8) 0x01 + +/* + * DMA Attributes + */ +#define ACPI_COMPATIBILITY (u8) 0x00 +#define ACPI_TYPE_A (u8) 0x01 +#define ACPI_TYPE_B (u8) 0x02 +#define ACPI_TYPE_F (u8) 0x03 + +#define ACPI_NOT_BUS_MASTER (u8) 0x00 +#define ACPI_BUS_MASTER (u8) 0x01 + +#define ACPI_TRANSFER_8 (u8) 0x00 +#define ACPI_TRANSFER_8_16 (u8) 0x01 +#define ACPI_TRANSFER_16 (u8) 0x02 + +/* + * Start Dependent Functions Priority definitions + */ +#define ACPI_GOOD_CONFIGURATION (u8) 0x00 +#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 +#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 + +/* + * 16, 32 and 64-bit Address Descriptor resource types + */ +#define ACPI_MEMORY_RANGE (u8) 0x00 +#define ACPI_IO_RANGE (u8) 0x01 +#define ACPI_BUS_NUMBER_RANGE (u8) 0x02 + +#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 +#define ACPI_ADDRESS_FIXED (u8) 0x01 + +#define ACPI_POS_DECODE (u8) 0x00 +#define ACPI_SUB_DECODE (u8) 0x01 + +#define ACPI_PRODUCER (u8) 0x00 +#define ACPI_CONSUMER (u8) 0x01 + +/* + * If possible, pack the following structures to byte alignment + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) #endif + +/* UUID data structures for use in vendor-defined resource descriptors */ + +struct acpi_uuid { + u8 data[ACPI_UUID_LENGTH]; +}; + +struct acpi_vendor_uuid { + u8 subtype; + u8 data[ACPI_UUID_LENGTH]; +}; + +/* + * Structures used to describe device resources + */ +struct acpi_resource_irq { + u8 descriptor_length; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; + u8 interrupts[1]; +}; + +struct acpi_resource_dma { + u8 type; + u8 bus_master; + u8 transfer; + u8 channel_count; + u8 channels[1]; +}; + +struct acpi_resource_start_dependent { + u8 descriptor_length; + u8 compatibility_priority; + u8 performance_robustness; +}; + +/* + * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not + * needed because it has no fields + */ + +struct acpi_resource_io { + u8 io_decode; + u8 alignment; + u8 address_length; + u16 minimum; + u16 maximum; +}; + +struct acpi_resource_fixed_io { + u16 address; + u8 address_length; +}; + +struct acpi_resource_vendor { + u16 byte_length; + u8 byte_data[1]; +}; + +/* Vendor resource with UUID info (introduced in ACPI 3.0) */ + +struct acpi_resource_vendor_typed { + u16 byte_length; + u8 uuid_subtype; + u8 uuid[ACPI_UUID_LENGTH]; + u8 byte_data[1]; +}; + +struct acpi_resource_end_tag { + u8 checksum; +}; + +struct acpi_resource_memory24 { + u8 write_protect; + u16 minimum; + u16 maximum; + u16 alignment; + u16 address_length; +}; + +struct acpi_resource_memory32 { + u8 write_protect; + u32 minimum; + u32 maximum; + u32 alignment; + u32 address_length; +}; + +struct acpi_resource_fixed_memory32 { + u8 write_protect; + u32 address; + u32 address_length; +}; + +struct acpi_memory_attribute { + u8 write_protect; + u8 caching; + u8 range_type; + u8 translation; +}; + +struct acpi_io_attribute { + u8 range_type; + u8 translation; + u8 translation_type; + u8 reserved1; +}; + +union acpi_resource_attribute { + struct acpi_memory_attribute mem; + struct acpi_io_attribute io; + + /* Used for the *word_space macros */ + + u8 type_specific; +}; + +struct acpi_resource_source { + u8 index; + u16 string_length; + char *string_ptr; +}; + +/* Fields common to all address descriptors, 16/32/64 bit */ + +#define ACPI_RESOURCE_ADDRESS_COMMON \ + u8 resource_type; \ + u8 producer_consumer; \ + u8 decode; \ + u8 min_address_fixed; \ + u8 max_address_fixed; \ + union acpi_resource_attribute info; + +struct acpi_resource_address { +ACPI_RESOURCE_ADDRESS_COMMON}; + +struct acpi_resource_address16 { + ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; + u16 minimum; + u16 maximum; + u16 translation_offset; + u16 address_length; + struct acpi_resource_source resource_source; +}; + +struct acpi_resource_address32 { + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 minimum; + u32 maximum; + u32 translation_offset; + u32 address_length; + struct acpi_resource_source resource_source; +}; + +struct acpi_resource_address64 { + ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; + struct acpi_resource_source resource_source; +}; + +struct acpi_resource_extended_address64 { + ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; + u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; + u64 type_specific; +}; + +struct acpi_resource_extended_irq { + u8 producer_consumer; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; + struct acpi_resource_source resource_source; + u32 interrupts[1]; +}; + +struct acpi_resource_generic_register { + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; + u64 address; +}; + +/* ACPI_RESOURCE_TYPEs */ + +#define ACPI_RESOURCE_TYPE_IRQ 0 +#define ACPI_RESOURCE_TYPE_DMA 1 +#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 +#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 +#define ACPI_RESOURCE_TYPE_IO 4 +#define ACPI_RESOURCE_TYPE_FIXED_IO 5 +#define ACPI_RESOURCE_TYPE_VENDOR 6 +#define ACPI_RESOURCE_TYPE_END_TAG 7 +#define ACPI_RESOURCE_TYPE_MEMORY24 8 +#define ACPI_RESOURCE_TYPE_MEMORY32 9 +#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 +#define ACPI_RESOURCE_TYPE_ADDRESS16 11 +#define ACPI_RESOURCE_TYPE_ADDRESS32 12 +#define ACPI_RESOURCE_TYPE_ADDRESS64 13 +#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ +#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 +#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 +#define ACPI_RESOURCE_TYPE_MAX 16 + +union acpi_resource_data { + struct acpi_resource_irq irq; + struct acpi_resource_dma dma; + struct acpi_resource_start_dependent start_dpf; + struct acpi_resource_io io; + struct acpi_resource_fixed_io fixed_io; + struct acpi_resource_vendor vendor; + struct acpi_resource_vendor_typed vendor_typed; + struct acpi_resource_end_tag end_tag; + struct acpi_resource_memory24 memory24; + struct acpi_resource_memory32 memory32; + struct acpi_resource_fixed_memory32 fixed_memory32; + struct acpi_resource_address16 address16; + struct acpi_resource_address32 address32; + struct acpi_resource_address64 address64; + struct acpi_resource_extended_address64 ext_address64; + struct acpi_resource_extended_irq extended_irq; + struct acpi_resource_generic_register generic_reg; + + /* Common fields */ + + struct acpi_resource_address address; /* Common 16/32/64 address fields */ +}; + +struct acpi_resource { + u32 type; + u32 length; + union acpi_resource_data data; +}; + +/* restore default alignment */ + +#pragma pack() + +#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) +#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) + +#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) + +struct acpi_pci_routing_table { + u32 length; + u32 pin; + acpi_integer address; /* here for 64-bit alignment */ + u32 source_index; + char source[4]; /* pad to 64 bits so sizeof() works in all cases */ }; #endif /* __ACTYPES_H__ */ diff --git a/trunk/drivers/acpi/acpica/acutils.h b/trunk/include/acpi/acutils.h similarity index 93% rename from trunk/drivers/acpi/acpica/acutils.h rename to trunk/include/acpi/acutils.h index 80d8813484fe..d8307b2987e3 100644 --- a/trunk/drivers/acpi/acpica/acutils.h +++ b/trunk/include/acpi/acutils.h @@ -297,6 +297,42 @@ void acpi_ut_report_info(char *module_name, u32 line_number); void acpi_ut_report_warning(char *module_name, u32 line_number); +/* Error and message reporting interfaces */ + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_debug_print(u32 requested_debug_level, + u32 line_number, + const char *function_name, + const char *module_name, + u32 component_id, + const char *format, ...) ACPI_PRINTF_LIKE(6); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_debug_print_raw(u32 requested_debug_level, + u32 line_number, + const char *function_name, + const char *module_name, + u32 component_id, + const char *format, ...) ACPI_PRINTF_LIKE(6); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_error(const char *module_name, + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_exception(const char *module_name, + u32 line_number, + acpi_status status, + const char *format, ...) ACPI_PRINTF_LIKE(4); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_warning(const char *module_name, + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_info(const char *module_name, + u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); + /* * utdelete - Object deletion and reference counts */ diff --git a/trunk/drivers/acpi/acpica/amlcode.h b/trunk/include/acpi/amlcode.h similarity index 100% rename from trunk/drivers/acpi/acpica/amlcode.h rename to trunk/include/acpi/amlcode.h diff --git a/trunk/drivers/acpi/acpica/amlresrc.h b/trunk/include/acpi/amlresrc.h similarity index 100% rename from trunk/drivers/acpi/acpica/amlresrc.h rename to trunk/include/acpi/amlresrc.h diff --git a/trunk/include/acpi/platform/acenv.h b/trunk/include/acpi/platform/acenv.h index e62f10d9a7d8..fcd2572e428c 100644 --- a/trunk/include/acpi/platform/acenv.h +++ b/trunk/include/acpi/platform/acenv.h @@ -44,26 +44,14 @@ #ifndef __ACENV_H__ #define __ACENV_H__ -/* Types for ACPI_MUTEX_TYPE */ - -#define ACPI_BINARY_SEMAPHORE 0 -#define ACPI_OSL_MUTEX 1 - -/* Types for DEBUGGER_THREADING */ - -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - -/****************************************************************************** - * +/* * Configuration for ACPI tools and utilities - * - *****************************************************************************/ + */ #ifdef ACPI_LIBRARY /* * Note: The non-debug version of the acpi_library does not contain any - * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG + * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG */ #define ACPI_USE_LOCAL_CACHE #endif @@ -87,6 +75,17 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif +#ifdef ACPI_DASM_APP +#ifndef MSDOS +#define ACPI_DEBUG_OUTPUT +#endif +#define ACPI_APPLICATION +#define ACPI_DISASSEMBLER +#define ACPI_NO_METHOD_EXECUTION +#define ACPI_LARGE_NAMESPACE_NODE +#define ACPI_DATA_TABLE_DISASSEMBLY +#endif + #ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_LOCAL_CACHE @@ -180,19 +179,6 @@ /*! [End] no source code translation !*/ -/****************************************************************************** - * - * Miscellaneous configuration - * - *****************************************************************************/ - -/* - * Are mutexes supported by the host? default is no, use binary semaphores. - */ -#ifndef ACPI_MUTEX_TYPE -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE -#endif - /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application @@ -201,6 +187,9 @@ * By default the model is single threaded if ACPI_APPLICATION is set, * multi-threaded if ACPI_APPLICATION is not set. */ +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + #ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index 3cabf888c8af..029c8c06c151 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -46,7 +46,6 @@ #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_DO_WHILE_0 -#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE #ifdef __KERNEL__ @@ -142,10 +141,6 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) /* * We need to show where it is safe to preempt execution of ACPICA */ -#define ACPI_PREEMPTION_POINT() \ - do { \ - if (!irqs_disabled()) \ - cond_resched(); \ - } while (0) +#define ACPI_PREEMPTION_POINT() cond_resched() #endif /* __ACLINUX_H__ */ diff --git a/trunk/include/linux/pci_hotplug.h b/trunk/include/linux/pci_hotplug.h index c2d1a7d1886a..a00bd1a0f156 100644 --- a/trunk/include/linux/pci_hotplug.h +++ b/trunk/include/linux/pci_hotplug.h @@ -223,6 +223,7 @@ struct hotplug_params { #ifdef CONFIG_ACPI #include #include +#include extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, struct hotplug_params *hpp); int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); diff --git a/trunk/kernel/cgroup.c b/trunk/kernel/cgroup.c index 2606d0fb4e54..8185a0f09594 100644 --- a/trunk/kernel/cgroup.c +++ b/trunk/kernel/cgroup.c @@ -1024,7 +1024,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, if (ret == -EBUSY) { mutex_unlock(&cgroup_mutex); mutex_unlock(&inode->i_mutex); - goto free_cg_links; + goto drop_new_super; } /* EBUSY should be the only error here */ @@ -1073,11 +1073,10 @@ static int cgroup_get_sb(struct file_system_type *fs_type, return simple_set_mnt(mnt, sb); - free_cg_links: - free_cg_links(&tmp_cg_links); drop_new_super: up_write(&sb->s_umount); deactivate_super(sb); + free_cg_links(&tmp_cg_links); return ret; } @@ -2935,6 +2934,9 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys, again: root = subsys->root; if (root == &rootnode) { + printk(KERN_INFO + "Not cloning cgroup for unused subsystem %s\n", + subsys->name); mutex_unlock(&cgroup_mutex); return 0; } diff --git a/trunk/kernel/posix-timers.c b/trunk/kernel/posix-timers.c index a140e44eebba..5e79c662294b 100644 --- a/trunk/kernel/posix-timers.c +++ b/trunk/kernel/posix-timers.c @@ -197,11 +197,6 @@ static int common_timer_create(struct k_itimer *new_timer) return 0; } -static int no_timer_create(struct k_itimer *new_timer) -{ - return -EOPNOTSUPP; -} - /* * Return nonzero if we know a priori this clockid_t value is bogus. */ @@ -253,7 +248,6 @@ static __init int init_posix_timers(void) .clock_getres = hrtimer_get_res, .clock_get = posix_get_monotonic_raw, .clock_set = do_posix_clock_nosettime, - .timer_create = no_timer_create, }; register_posix_clock(CLOCK_REALTIME, &clock_realtime); diff --git a/trunk/kernel/power/disk.c b/trunk/kernel/power/disk.c index c9d74083746f..096fe4899ea4 100644 --- a/trunk/kernel/power/disk.c +++ b/trunk/kernel/power/disk.c @@ -259,12 +259,12 @@ int hibernation_snapshot(int platform_mode) { int error, ftrace_save; - /* Free memory before shutting down devices. */ - error = swsusp_shrink_memory(); + error = platform_begin(platform_mode); if (error) return error; - error = platform_begin(platform_mode); + /* Free memory before shutting down devices. */ + error = swsusp_shrink_memory(); if (error) goto Close; diff --git a/trunk/net/bluetooth/rfcomm/core.c b/trunk/net/bluetooth/rfcomm/core.c index ce68e046d963..ba537fae0a4c 100644 --- a/trunk/net/bluetooth/rfcomm/core.c +++ b/trunk/net/bluetooth/rfcomm/core.c @@ -1786,6 +1786,8 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s) if (err < 0) return; + __module_get(nsock->ops->owner); + /* Set our callbacks */ nsock->sk->sk_data_ready = rfcomm_l2data_ready; nsock->sk->sk_state_change = rfcomm_l2state_change; diff --git a/trunk/net/socket.c b/trunk/net/socket.c index 76ba80aeac1a..92764d836891 100644 --- a/trunk/net/socket.c +++ b/trunk/net/socket.c @@ -2307,7 +2307,6 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) } (*newsock)->ops = sock->ops; - __module_get((*newsock)->ops->owner); done: return err; diff --git a/trunk/sound/pci/hda/patch_sigmatel.c b/trunk/sound/pci/hda/patch_sigmatel.c index b77f330d2650..5dd3e89f620a 100644 --- a/trunk/sound/pci/hda/patch_sigmatel.c +++ b/trunk/sound/pci/hda/patch_sigmatel.c @@ -69,7 +69,6 @@ enum { }; enum { - STAC_92HD73XX_NO_JD, /* no jack-detection */ STAC_92HD73XX_REF, STAC_DELL_M6_AMIC, STAC_DELL_M6_DMIC, @@ -128,7 +127,6 @@ enum { }; enum { - STAC_D965_REF_NO_JD, /* no jack-detection */ STAC_D965_REF, STAC_D965_3ST, STAC_D965_5ST, @@ -859,7 +857,6 @@ static struct hda_verb stac92hd83xxx_core_init[] = { /* power state controls amps */ { 0x01, AC_VERB_SET_EAPD, 1 << 2}, - {} }; static struct hda_verb stac92hd71bxx_core_init[] = { @@ -871,7 +868,6 @@ static struct hda_verb stac92hd71bxx_core_init[] = { { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {} }; #define HD_DISABLE_PORTF 2 @@ -1615,7 +1611,6 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { }; static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { - [STAC_92HD73XX_NO_JD] = "no-jd", [STAC_92HD73XX_REF] = "ref", [STAC_DELL_M6_AMIC] = "dell-m6-amic", [STAC_DELL_M6_DMIC] = "dell-m6-dmic", @@ -1645,8 +1640,6 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { "unknown Dell", STAC_DELL_M6_DMIC), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, "Dell Studio 1537", STAC_DELL_M6_DMIC), - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, - "Dell Studio 17", STAC_DELL_M6_DMIC), {} /* terminator */ }; @@ -1669,7 +1662,6 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { /* SigmaTel reference board */ SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_92HD71BXX_REF), - {} /* terminator */ }; static unsigned int ref92hd71bxx_pin_configs[11] = { @@ -2035,7 +2027,6 @@ static unsigned int dell_3st_pin_configs[14] = { }; static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { - [STAC_D965_REF_NO_JD] = ref927x_pin_configs, [STAC_D965_REF] = ref927x_pin_configs, [STAC_D965_3ST] = d965_3st_pin_configs, [STAC_D965_5ST] = d965_5st_pin_configs, @@ -2044,7 +2035,6 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { }; static const char *stac927x_models[STAC_927X_MODELS] = { - [STAC_D965_REF_NO_JD] = "ref-no-jd", [STAC_D965_REF] = "ref", [STAC_D965_3ST] = "3stack", [STAC_D965_5ST] = "5stack", @@ -2906,7 +2896,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, } if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && - cfg->hp_outs == 1 && !spec->multiout.hp_nid) + cfg->hp_outs && !spec->multiout.hp_nid) spec->multiout.hp_nid = nid; if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { @@ -4264,17 +4254,14 @@ static int patch_stac92hd73xx(struct hda_codec *codec) switch (spec->multiout.num_dacs) { case 0x3: /* 6 Channel */ - spec->multiout.hp_nid = 0x17; spec->mixer = stac92hd73xx_6ch_mixer; spec->init = stac92hd73xx_6ch_core_init; break; case 0x4: /* 8 Channel */ - spec->multiout.hp_nid = 0x18; spec->mixer = stac92hd73xx_8ch_mixer; spec->init = stac92hd73xx_8ch_core_init; break; case 0x5: /* 10 Channel */ - spec->multiout.hp_nid = 0x19; spec->mixer = stac92hd73xx_10ch_mixer; spec->init = stac92hd73xx_10ch_core_init; }; @@ -4310,7 +4297,6 @@ static int patch_stac92hd73xx(struct hda_codec *codec) spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; spec->eapd_switch = 0; spec->num_amps = 1; - spec->multiout.hp_nid = 0; /* dual HPs */ if (!spec->init) spec->init = dell_m6_core_init; @@ -4365,9 +4351,6 @@ static int patch_stac92hd73xx(struct hda_codec *codec) return err; } - if (spec->board_config == STAC_92HD73XX_NO_JD) - spec->hp_detect = 0; - codec->patch_ops = stac92xx_patch_ops; return 0; @@ -4916,10 +4899,6 @@ static int patch_stac927x(struct hda_codec *codec) */ codec->bus->needs_damn_long_delay = 1; - /* no jack detecion for ref-no-jd model */ - if (spec->board_config == STAC_D965_REF_NO_JD) - spec->hp_detect = 0; - return 0; } diff --git a/trunk/sound/soc/omap/omap-pcm.c b/trunk/sound/soc/omap/omap-pcm.c index acd68efb2b75..e9084fdd2082 100644 --- a/trunk/sound/soc/omap/omap-pcm.c +++ b/trunk/sound/soc/omap/omap-pcm.c @@ -233,7 +233,7 @@ static int omap_pcm_open(struct snd_pcm_substream *substream) if (ret < 0) goto out; - prtd = kzalloc(sizeof(*prtd), GFP_KERNEL); + prtd = kzalloc(sizeof(prtd), GFP_KERNEL); if (prtd == NULL) { ret = -ENOMEM; goto out;