From a4f540d3237bc9dda3b94a0553df54bd49d77da4 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Tue, 12 Oct 2010 09:09:37 +0800 Subject: [PATCH] --- yaml --- r: 217663 b: refs/heads/master c: dab5fff14df2cd16eb1ad4c02e83915e1063fece h: refs/heads/master i: 217661: f9bf90e980002c0dd4da4efbc3834ff74d9464b0 217659: e45702e6b57f62255229f8ba557430b934ed7996 217655: c2b41d8df52b0945aa60561af4a4c6f7e57de692 217647: 277805c971d0ace6883a9024c040f0b754710570 217631: d167afb36a89d510afc6a8c258f9b63c340537fa 217599: 478c209b0657fe921ba4de3b93bf898a23dc84b6 v: v3 --- [refs] | 2 +- trunk/MAINTAINERS | 2 +- trunk/Makefile | 4 +- trunk/arch/arm/Kconfig | 14 - trunk/arch/arm/kernel/kprobes-decode.c | 7 +- .../arch/arm/mach-at91/include/mach/system.h | 7 +- trunk/arch/arm/mach-ep93xx/dma-m2p.c | 2 +- trunk/arch/arm/mach-imx/Kconfig | 1 - trunk/arch/arm/mach-imx/mach-cpuimx27.c | 2 +- trunk/arch/arm/mach-vexpress/ct-ca9x4.c | 4 +- trunk/arch/arm/mach-vexpress/v2m.c | 2 +- trunk/arch/arm/mm/ioremap.c | 8 +- trunk/arch/arm/mm/mmu.c | 4 +- trunk/arch/arm/mm/proc-v7.S | 10 +- trunk/arch/arm/plat-omap/iommu.c | 1 - trunk/arch/m32r/include/asm/elf.h | 4 +- trunk/arch/m32r/kernel/.gitignore | 1 - trunk/arch/m32r/kernel/signal.c | 4 +- trunk/arch/mips/Kbuild | 4 - trunk/arch/mips/Kconfig | 4 - trunk/arch/mips/boot/compressed/Makefile | 2 +- trunk/arch/mips/dec/Platform | 2 +- trunk/arch/mips/include/asm/fcntl.h | 1 - trunk/arch/mips/jz4740/Platform | 2 +- trunk/arch/mips/kernel/branch.c | 1 + trunk/arch/mips/kernel/ptrace.c | 4 +- trunk/arch/mips/kernel/scall32-o32.S | 11 +- trunk/arch/mips/kernel/scall64-64.S | 7 +- trunk/arch/mips/kernel/scall64-n32.S | 12 +- trunk/arch/mips/kernel/scall64-o32.S | 15 +- trunk/arch/mips/kernel/signal.c | 45 +- trunk/arch/mips/kernel/signal_n32.c | 5 - trunk/arch/mips/kernel/unaligned.c | 2 + trunk/arch/um/drivers/hostaudio_kern.c | 14 +- trunk/arch/um/drivers/ubd_kern.c | 9 +- trunk/arch/x86/ia32/ia32_aout.c | 22 +- trunk/arch/x86/include/asm/kvm_host.h | 24 + .../x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 1 + trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c | 9 +- .../arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 +- trunk/arch/x86/kvm/svm.c | 17 +- trunk/arch/x86/kvm/vmx.c | 24 +- trunk/arch/x86/mm/srat_64.c | 8 +- trunk/block/bsg.c | 2 +- trunk/drivers/acpi/Kconfig | 11 +- trunk/drivers/acpi/ac.c | 14 + trunk/drivers/acpi/acpica/Makefile | 5 +- trunk/drivers/acpi/acpica/acdebug.h | 2 - trunk/drivers/acpi/acpica/acglobal.h | 8 +- trunk/drivers/acpi/acpica/achware.h | 7 - trunk/drivers/acpi/acpica/aclocal.h | 12 +- trunk/drivers/acpi/acpica/acmacros.h | 4 +- trunk/drivers/acpi/acpica/acnamesp.h | 12 + trunk/drivers/acpi/acpica/acobject.h | 2 +- trunk/drivers/acpi/acpica/acutils.h | 56 +- trunk/drivers/acpi/acpica/dsmethod.c | 2 +- trunk/drivers/acpi/acpica/dswexec.c | 19 +- trunk/drivers/acpi/acpica/evmisc.c | 2 +- trunk/drivers/acpi/acpica/evrgnini.c | 14 +- trunk/drivers/acpi/acpica/evxfregn.c | 6 - trunk/drivers/acpi/acpica/exfldio.c | 75 +- trunk/drivers/acpi/acpica/exmutex.c | 10 +- trunk/drivers/acpi/acpica/exprep.c | 45 +- trunk/drivers/acpi/acpica/exregion.c | 4 +- trunk/drivers/acpi/acpica/hwpci.c | 412 ---------- trunk/drivers/acpi/acpica/nsrepair2.c | 163 ---- trunk/drivers/acpi/acpica/nsutils.c | 98 +++ trunk/drivers/acpi/acpica/tbfadt.c | 4 +- trunk/drivers/acpi/acpica/utdebug.c | 7 +- trunk/drivers/acpi/acpica/uteval.c | 147 ++++ trunk/drivers/acpi/acpica/utglobal.c | 8 +- trunk/drivers/acpi/acpica/utids.c | 45 +- trunk/drivers/acpi/acpica/utinit.c | 4 - trunk/drivers/acpi/acpica/utmath.c | 23 +- trunk/drivers/acpi/acpica/utmisc.c | 162 ++++ trunk/drivers/acpi/acpica/utmutex.c | 37 +- trunk/drivers/acpi/acpica/utosi.c | 380 --------- trunk/drivers/acpi/acpica/utxface.c | 125 +-- trunk/drivers/acpi/acpica/utxferror.c | 415 ---------- trunk/drivers/acpi/battery.c | 21 + trunk/drivers/acpi/fan.c | 139 +++- trunk/drivers/acpi/osl.c | 162 ++-- trunk/drivers/acpi/pci_irq.c | 1 + trunk/drivers/acpi/pci_link.c | 1 + trunk/drivers/acpi/pci_root.c | 1 + trunk/drivers/acpi/processor_driver.c | 20 +- trunk/drivers/acpi/processor_throttling.c | 4 - trunk/drivers/acpi/sbs.c | 25 + trunk/drivers/acpi/thermal.c | 436 +++++++++- trunk/drivers/acpi/video.c | 771 +++++++++++++++++- trunk/drivers/atm/iphase.c | 6 + trunk/drivers/atm/iphase.h | 2 +- trunk/drivers/atm/solos-pci.c | 8 +- trunk/drivers/block/ps3disk.c | 2 +- trunk/drivers/char/virtio_console.c | 17 +- trunk/drivers/dma/ioat/dma_v2.c | 2 +- trunk/drivers/firewire/ohci.c | 19 +- trunk/drivers/firewire/ohci.h | 8 + trunk/drivers/gpu/drm/radeon/evergreen.c | 5 +- trunk/drivers/gpu/drm/radeon/r100.c | 3 - trunk/drivers/gpu/drm/radeon/r600.c | 4 +- trunk/drivers/gpu/drm/radeon/r600_blit_kms.c | 2 - trunk/drivers/gpu/drm/radeon/radeon.h | 1 - .../drivers/gpu/drm/radeon/radeon_atombios.c | 18 +- trunk/drivers/gpu/drm/radeon/radeon_combios.c | 26 +- trunk/drivers/gpu/drm/radeon/radeon_cursor.c | 28 +- trunk/drivers/gpu/drm/radeon/radeon_object.c | 2 +- trunk/drivers/gpu/drm/radeon/radeon_object.h | 5 +- trunk/drivers/gpu/drm/radeon/rs600.c | 1 - trunk/drivers/gpu/drm/radeon/rs690.c | 1 - trunk/drivers/gpu/drm/radeon/rv770.c | 2 - trunk/drivers/hid/hid-cando.c | 2 - trunk/drivers/hid/hid-core.c | 1 - trunk/drivers/hid/hid-ids.h | 2 - trunk/drivers/hid/hidraw.c | 11 - trunk/drivers/hid/usbhid/hid-quirks.c | 1 - trunk/drivers/i2c/busses/i2c-davinci.c | 24 +- trunk/drivers/i2c/busses/i2c-imx.c | 12 +- trunk/drivers/input/evdev.c | 8 +- .../drivers/media/video/v4l2-compat-ioctl32.c | 32 +- trunk/drivers/mmc/core/core.c | 13 - trunk/drivers/mtd/nand/mxc_nand.c | 92 +-- trunk/drivers/net/b44.c | 4 +- trunk/drivers/net/ehea/ehea_main.c | 9 +- trunk/drivers/net/ehea/ehea_qmr.h | 1 - trunk/drivers/net/fec.c | 44 +- trunk/drivers/net/r8169.c | 65 +- trunk/drivers/net/tg3.c | 6 +- trunk/drivers/net/tg3.h | 2 +- trunk/drivers/net/wimax/i2400m/rx.c | 26 +- trunk/drivers/scsi/scsi.c | 4 +- trunk/drivers/serial/ioc3_serial.c | 1 - trunk/fs/binfmt_aout.c | 4 + trunk/fs/exec.c | 40 - trunk/fs/nfsd/nfsfh.h | 2 + trunk/fs/notify/Kconfig | 2 +- trunk/include/acpi/acpiosxf.h | 12 +- trunk/include/acpi/acpixf.h | 9 +- trunk/include/acpi/actypes.h | 30 +- trunk/include/acpi/platform/acenv.h | 6 - trunk/include/acpi/platform/acgcc.h | 2 - trunk/include/acpi/platform/aclinux.h | 7 +- trunk/include/linux/Kbuild | 1 + trunk/include/linux/coredump.h | 34 +- trunk/include/linux/types.h | 15 +- trunk/kernel/hrtimer.c | 13 +- trunk/kernel/perf_event.c | 4 +- trunk/kernel/sysctl_check.c | 9 + trunk/kernel/trace/ring_buffer.c | 2 +- trunk/net/atm/mpc.c | 2 +- trunk/net/core/ethtool.c | 6 +- trunk/net/rds/page.c | 27 +- trunk/sound/core/rawmidi.c | 4 +- trunk/tools/perf/perf.h | 12 - 154 files changed, 2567 insertions(+), 2448 deletions(-) delete mode 100644 trunk/arch/m32r/kernel/.gitignore delete mode 100644 trunk/drivers/acpi/acpica/hwpci.c delete mode 100644 trunk/drivers/acpi/acpica/utosi.c delete mode 100644 trunk/drivers/acpi/acpica/utxferror.c diff --git a/[refs] b/[refs] index 78982e37c570..44b951f3830e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f3ab69a321d08ce123dce8166eabe7fddd94b949 +refs/heads/master: dab5fff14df2cd16eb1ad4c02e83915e1063fece diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index f2a2b8e647c5..7679bf32f7bb 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -3162,7 +3162,7 @@ F: drivers/net/ioc3-eth.c IOC3 SERIAL DRIVER M: Pat Gefre -L: linux-serial@vger.kernel.org +L: linux-mips@linux-mips.org S: Maintained F: drivers/serial/ioc3_serial.c diff --git a/trunk/Makefile b/trunk/Makefile index 860c26af52c3..77b5c6ed0ce5 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,8 +1,8 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 36 -EXTRAVERSION = -NAME = Flesh-Eating Bats with Fangs +EXTRAVERSION = -rc7 +NAME = Sheep on Meth # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 9c26ba7244fb..88c97bc7a6f5 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -1101,20 +1101,6 @@ config ARM_ERRATA_720789 invalidated are not, resulting in an incoherency in the system page tables. The workaround changes the TLB flushing routines to invalidate entries regardless of the ASID. - -config ARM_ERRATA_743622 - bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption" - depends on CPU_V7 - help - This option enables the workaround for the 743622 Cortex-A9 - (r2p0..r2p2) erratum. Under very rare conditions, a faulty - optimisation in the Cortex-A9 Store Buffer may lead to data - corruption. This workaround sets a specific bit in the diagnostic - register of the Cortex-A9 which disables the Store Buffer - optimisation, preventing the defect from occurring. This has no - visible impact on the overall performance or power consumption of the - processor. - endmenu source "arch/arm/common/Kconfig" diff --git a/trunk/arch/arm/kernel/kprobes-decode.c b/trunk/arch/arm/kernel/kprobes-decode.c index 2c1f0050c9c4..8bccbfa693ff 100644 --- a/trunk/arch/arm/kernel/kprobes-decode.c +++ b/trunk/arch/arm/kernel/kprobes-decode.c @@ -1162,12 +1162,11 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) { /* * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx - * Undef : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx + * Undef : cccc 0011 0x00 xxxx xxxx xxxx xxxx xxxx * ALU op with S bit and Rd == 15 : * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx */ - if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */ - (insn & 0x0ff00000) == 0x03400000 || /* Undef */ + if ((insn & 0x0f900000) == 0x03200000 || /* MSR & Undef */ (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */ return INSN_REJECTED; @@ -1178,7 +1177,7 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) * *S (bit 20) updates condition codes * ADC/SBC/RSC reads the C flag */ - insn &= 0xffff0fff; /* Rd = r0 */ + insn &= 0xfff00fff; /* Rn = r0, Rd = r0 */ asi->insn[0] = insn; asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ emulate_alu_imm_rwflags : emulate_alu_imm_rflags; diff --git a/trunk/arch/arm/mach-at91/include/mach/system.h b/trunk/arch/arm/mach-at91/include/mach/system.h index ee8db152592e..c80e090b3670 100644 --- a/trunk/arch/arm/mach-at91/include/mach/system.h +++ b/trunk/arch/arm/mach-at91/include/mach/system.h @@ -28,16 +28,17 @@ static inline void arch_idle(void) { +#ifndef CONFIG_DEBUG_KERNEL /* * Disable the processor clock. The processor will be automatically * re-enabled by an interrupt or by a reset. */ at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK); -#ifndef CONFIG_CPU_ARM920T +#else /* * Set the processor (CP15) into 'Wait for Interrupt' mode. - * Post-RM9200 processors need this in conjunction with the above - * to save power when idle. + * Unlike disabling the processor clock via the PMC (above) + * this allows the processor to be woken via JTAG. */ cpu_do_idle(); #endif diff --git a/trunk/arch/arm/mach-ep93xx/dma-m2p.c b/trunk/arch/arm/mach-ep93xx/dma-m2p.c index a696d354b1f8..8904ca4e2e24 100644 --- a/trunk/arch/arm/mach-ep93xx/dma-m2p.c +++ b/trunk/arch/arm/mach-ep93xx/dma-m2p.c @@ -276,7 +276,7 @@ static void channel_disable(struct m2p_channel *ch) v &= ~(M2P_CONTROL_STALL_IRQ_EN | M2P_CONTROL_NFB_IRQ_EN); m2p_set_control(ch, v); - while (m2p_channel_state(ch) >= STATE_ON) + while (m2p_channel_state(ch) == STATE_ON) cpu_relax(); m2p_set_control(ch, 0x0); diff --git a/trunk/arch/arm/mach-imx/Kconfig b/trunk/arch/arm/mach-imx/Kconfig index 2f7e2728970d..c5c0369bb481 100644 --- a/trunk/arch/arm/mach-imx/Kconfig +++ b/trunk/arch/arm/mach-imx/Kconfig @@ -122,7 +122,6 @@ config MACH_CPUIMX27 select IMX_HAVE_PLATFORM_IMX_I2C select IMX_HAVE_PLATFORM_IMX_UART select IMX_HAVE_PLATFORM_MXC_NAND - select MXC_ULPI if USB_ULPI help Include support for Eukrea CPUIMX27 platform. This includes specific configurations for the module and its peripherals. diff --git a/trunk/arch/arm/mach-imx/mach-cpuimx27.c b/trunk/arch/arm/mach-imx/mach-cpuimx27.c index 6830afd1d2ba..339150ab0ea5 100644 --- a/trunk/arch/arm/mach-imx/mach-cpuimx27.c +++ b/trunk/arch/arm/mach-imx/mach-cpuimx27.c @@ -259,7 +259,7 @@ static void __init eukrea_cpuimx27_init(void) i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices, ARRAY_SIZE(eukrea_cpuimx27_i2c_devices)); - imx27_add_i2c_imx0(&cpuimx27_i2c1_data); + imx27_add_i2c_imx1(&cpuimx27_i2c1_data); platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); diff --git a/trunk/arch/arm/mach-vexpress/ct-ca9x4.c b/trunk/arch/arm/mach-vexpress/ct-ca9x4.c index 71fb17349520..efb127022d42 100644 --- a/trunk/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/trunk/arch/arm/mach-vexpress/ct-ca9x4.c @@ -68,7 +68,7 @@ static void __init ct_ca9x4_init_irq(void) } #if 0 -static void __init ct_ca9x4_timer_init(void) +static void ct_ca9x4_timer_init(void) { writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL); writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL); @@ -222,7 +222,7 @@ static struct platform_device pmu_device = { .resource = pmu_resources, }; -static void __init ct_ca9x4_init(void) +static void ct_ca9x4_init(void) { int i; diff --git a/trunk/arch/arm/mach-vexpress/v2m.c b/trunk/arch/arm/mach-vexpress/v2m.c index 7eaa232180a5..817f0ad38a0b 100644 --- a/trunk/arch/arm/mach-vexpress/v2m.c +++ b/trunk/arch/arm/mach-vexpress/v2m.c @@ -48,7 +48,7 @@ void __init v2m_map_io(struct map_desc *tile, size_t num) } -static void __init v2m_timer_init(void) +static void v2m_timer_init(void) { writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); diff --git a/trunk/arch/arm/mm/ioremap.c b/trunk/arch/arm/mm/ioremap.c index 17e7b0b57e49..ab506272b2d3 100644 --- a/trunk/arch/arm/mm/ioremap.c +++ b/trunk/arch/arm/mm/ioremap.c @@ -204,12 +204,8 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, /* * Don't allow RAM to be mapped - this causes problems with ARMv6+ */ - if (pfn_valid(pfn)) { - printk(KERN_WARNING "BUG: Your driver calls ioremap() on system memory. This leads\n" - KERN_WARNING "to architecturally unpredictable behaviour on ARMv6+, and ioremap()\n" - KERN_WARNING "will fail in the next kernel release. Please fix your driver.\n"); - WARN_ON(1); - } + if (WARN_ON(pfn_valid(pfn))) + return NULL; type = get_mem_type(mtype); if (!type) diff --git a/trunk/arch/arm/mm/mmu.c b/trunk/arch/arm/mm/mmu.c index e8ed9dc461fe..6a3a2d0cd6db 100644 --- a/trunk/arch/arm/mm/mmu.c +++ b/trunk/arch/arm/mm/mmu.c @@ -248,7 +248,7 @@ static struct mem_type mem_types[] = { }, [MT_MEMORY] = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | - L_PTE_WRITE | L_PTE_EXEC, + L_PTE_USER | L_PTE_EXEC, .prot_l1 = PMD_TYPE_TABLE, .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, .domain = DOMAIN_KERNEL, @@ -259,7 +259,7 @@ static struct mem_type mem_types[] = { }, [MT_MEMORY_NONCACHED] = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | - L_PTE_WRITE | L_PTE_EXEC | L_PTE_MT_BUFFERABLE, + L_PTE_USER | L_PTE_EXEC | L_PTE_MT_BUFFERABLE, .prot_l1 = PMD_TYPE_TABLE, .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, .domain = DOMAIN_KERNEL, diff --git a/trunk/arch/arm/mm/proc-v7.S b/trunk/arch/arm/mm/proc-v7.S index 197f21bed5e9..7563ff0141bd 100644 --- a/trunk/arch/arm/mm/proc-v7.S +++ b/trunk/arch/arm/mm/proc-v7.S @@ -253,14 +253,6 @@ __v7_setup: orreq r10, r10, #1 << 22 @ set bit #22 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register #endif -#ifdef CONFIG_ARM_ERRATA_743622 - teq r6, #0x20 @ present in r2p0 - teqne r6, #0x21 @ present in r2p1 - teqne r6, #0x22 @ present in r2p2 - mrceq p15, 0, r10, c15, c0, 1 @ read diagnostic register - orreq r10, r10, #1 << 6 @ set bit #6 - mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register -#endif 3: mov r10, #0 #ifdef HARVARD_CACHE @@ -373,7 +365,7 @@ __v7_ca9mp_proc_info: b __v7_ca9mp_setup .long cpu_arch_name .long cpu_elf_name - .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS + .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP .long cpu_v7_name .long v7_processor_functions .long v7wbi_tlb_fns diff --git a/trunk/arch/arm/plat-omap/iommu.c b/trunk/arch/arm/plat-omap/iommu.c index 6cd151b31bc5..a202a2ce6e3d 100644 --- a/trunk/arch/arm/plat-omap/iommu.c +++ b/trunk/arch/arm/plat-omap/iommu.c @@ -320,7 +320,6 @@ void flush_iotlb_page(struct iommu *obj, u32 da) if ((start <= da) && (da < start + bytes)) { dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n", __func__, start, da, bytes); - iotlb_load_cr(obj, &cr); iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY); } } diff --git a/trunk/arch/m32r/include/asm/elf.h b/trunk/arch/m32r/include/asm/elf.h index b8da7d0574d2..2f85412ef730 100644 --- a/trunk/arch/m32r/include/asm/elf.h +++ b/trunk/arch/m32r/include/asm/elf.h @@ -82,9 +82,9 @@ typedef elf_fpreg_t elf_fpregset_t; * These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS32 -#if defined(__LITTLE_ENDIAN__) +#if defined(__LITTLE_ENDIAN) #define ELF_DATA ELFDATA2LSB -#elif defined(__BIG_ENDIAN__) +#elif defined(__BIG_ENDIAN) #define ELF_DATA ELFDATA2MSB #else #error no endian defined diff --git a/trunk/arch/m32r/kernel/.gitignore b/trunk/arch/m32r/kernel/.gitignore deleted file mode 100644 index c5f676c3c224..000000000000 --- a/trunk/arch/m32r/kernel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vmlinux.lds diff --git a/trunk/arch/m32r/kernel/signal.c b/trunk/arch/m32r/kernel/signal.c index a08697f0886d..7bbe38645ed5 100644 --- a/trunk/arch/m32r/kernel/signal.c +++ b/trunk/arch/m32r/kernel/signal.c @@ -28,8 +28,6 @@ #define DEBUG_SIG 0 -#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) - asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r2, unsigned long r3, unsigned long r4, @@ -256,7 +254,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, static int prev_insn(struct pt_regs *regs) { u16 inst; - if (get_user(inst, (u16 __user *)(regs->bpc - 2))) + if (get_user(&inst, (u16 __user *)(regs->bpc - 2))) return -EFAULT; if ((inst & 0xfff0) == 0x10f0) /* trap ? */ regs->bpc -= 2; diff --git a/trunk/arch/mips/Kbuild b/trunk/arch/mips/Kbuild index 7dd65cfae837..e322d65f33a4 100644 --- a/trunk/arch/mips/Kbuild +++ b/trunk/arch/mips/Kbuild @@ -7,10 +7,6 @@ subdir-ccflags-y := -Werror include arch/mips/Kbuild.platforms obj-y := $(platform-y) -# make clean traverses $(obj-) without having included .config, so -# everything ends up here -obj- := $(platform-) - # mips object files # The object files are linked as core-y files would be linked diff --git a/trunk/arch/mips/Kconfig b/trunk/arch/mips/Kconfig index 4c9f402295dd..5526faabfc21 100644 --- a/trunk/arch/mips/Kconfig +++ b/trunk/arch/mips/Kconfig @@ -881,15 +881,11 @@ config NO_IOPORT config GENERIC_ISA_DMA bool select ZONE_DMA if GENERIC_ISA_DMA_SUPPORT_BROKEN=n - select ISA_DMA_API config GENERIC_ISA_DMA_SUPPORT_BROKEN bool select GENERIC_ISA_DMA -config ISA_DMA_API - bool - config GENERIC_GPIO bool diff --git a/trunk/arch/mips/boot/compressed/Makefile b/trunk/arch/mips/boot/compressed/Makefile index 5042d51b0512..5fd7f7a58b7e 100644 --- a/trunk/arch/mips/boot/compressed/Makefile +++ b/trunk/arch/mips/boot/compressed/Makefile @@ -105,4 +105,4 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec vmlinuz.srec: vmlinuz $(call cmd,objcopy) -clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} +clean-files := $(objtree)/vmlinuz.* diff --git a/trunk/arch/mips/dec/Platform b/trunk/arch/mips/dec/Platform index cf55a6f4e720..3adbcbd95db1 100644 --- a/trunk/arch/mips/dec/Platform +++ b/trunk/arch/mips/dec/Platform @@ -1,7 +1,7 @@ # # DECstation family # -platform-$(CONFIG_MACH_DECSTATION) += dec/ +platform-$(CONFIG_MACH_DECSTATION) = dec/ cflags-$(CONFIG_MACH_DECSTATION) += \ -I$(srctree)/arch/mips/include/asm/mach-dec libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/ diff --git a/trunk/arch/mips/include/asm/fcntl.h b/trunk/arch/mips/include/asm/fcntl.h index 75eddedcfc3e..e482fe90fe88 100644 --- a/trunk/arch/mips/include/asm/fcntl.h +++ b/trunk/arch/mips/include/asm/fcntl.h @@ -56,7 +56,6 @@ */ #ifdef CONFIG_32BIT -#include struct flock { short l_type; diff --git a/trunk/arch/mips/jz4740/Platform b/trunk/arch/mips/jz4740/Platform index ba91be9c21ef..6a97230e3d05 100644 --- a/trunk/arch/mips/jz4740/Platform +++ b/trunk/arch/mips/jz4740/Platform @@ -1,3 +1,3 @@ -platform-$(CONFIG_MACH_JZ4740) += jz4740/ +core-$(CONFIG_MACH_JZ4740) += arch/mips/jz4740/ cflags-$(CONFIG_MACH_JZ4740) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 load-$(CONFIG_MACH_JZ4740) += 0xffffffff80010000 diff --git a/trunk/arch/mips/kernel/branch.c b/trunk/arch/mips/kernel/branch.c index 32103cc2a257..0176ed015c89 100644 --- a/trunk/arch/mips/kernel/branch.c +++ b/trunk/arch/mips/kernel/branch.c @@ -40,6 +40,7 @@ int __compute_return_epc(struct pt_regs *regs) return -EFAULT; } + regs->regs[0] = 0; switch (insn.i_format.opcode) { /* * jr and jalr are in r_format format. diff --git a/trunk/arch/mips/kernel/ptrace.c b/trunk/arch/mips/kernel/ptrace.c index c8777333e198..c51b95ff8644 100644 --- a/trunk/arch/mips/kernel/ptrace.c +++ b/trunk/arch/mips/kernel/ptrace.c @@ -536,7 +536,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) { /* do the secure computing check first */ if (!entryexit) - secure_computing(regs->regs[2]); + secure_computing(regs->regs[0]); if (unlikely(current->audit_context) && entryexit) audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), @@ -565,7 +565,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) out: if (unlikely(current->audit_context) && !entryexit) - audit_syscall_entry(audit_arch(), regs->regs[2], + audit_syscall_entry(audit_arch(), regs->regs[0], regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); } diff --git a/trunk/arch/mips/kernel/scall32-o32.S b/trunk/arch/mips/kernel/scall32-o32.S index fbaabad0e6e2..584415eef8c9 100644 --- a/trunk/arch/mips/kernel/scall32-o32.S +++ b/trunk/arch/mips/kernel/scall32-o32.S @@ -63,9 +63,9 @@ stack_done: sw t0, PT_R7(sp) # set error flag beqz t0, 1f - lw t1, PT_R2(sp) # syscall number negu v0 # error - sw t1, PT_R0(sp) # save it for syscall restarting + sw v0, PT_R0(sp) # set flag for syscall + # restarting 1: sw v0, PT_R2(sp) # result o32_syscall_exit: @@ -104,9 +104,9 @@ syscall_trace_entry: sw t0, PT_R7(sp) # set error flag beqz t0, 1f - lw t1, PT_R2(sp) # syscall number negu v0 # error - sw t1, PT_R0(sp) # save it for syscall restarting + sw v0, PT_R0(sp) # set flag for syscall + # restarting 1: sw v0, PT_R2(sp) # result j syscall_exit @@ -169,7 +169,8 @@ stackargs: * We probably should handle this case a bit more drastic. */ bad_stack: - li v0, EFAULT + negu v0 # error + sw v0, PT_R0(sp) sw v0, PT_R2(sp) li t0, 1 # set error flag sw t0, PT_R7(sp) diff --git a/trunk/arch/mips/kernel/scall64-64.S b/trunk/arch/mips/kernel/scall64-64.S index 3f4179283207..5573f8e4e326 100644 --- a/trunk/arch/mips/kernel/scall64-64.S +++ b/trunk/arch/mips/kernel/scall64-64.S @@ -66,9 +66,9 @@ NESTED(handle_sys64, PT_SIZE, sp) sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # set flag for syscall + # restarting 1: sd v0, PT_R2(sp) # result n64_syscall_exit: @@ -109,9 +109,8 @@ syscall_trace_entry: sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # set flag for syscall restarting 1: sd v0, PT_R2(sp) # result j syscall_exit diff --git a/trunk/arch/mips/kernel/scall64-n32.S b/trunk/arch/mips/kernel/scall64-n32.S index f08ece6d8acc..1e38ec97672e 100644 --- a/trunk/arch/mips/kernel/scall64-n32.S +++ b/trunk/arch/mips/kernel/scall64-n32.S @@ -65,9 +65,8 @@ NESTED(handle_sysn32, PT_SIZE, sp) sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # set flag for syscall restarting 1: sd v0, PT_R2(sp) # result local_irq_disable # make sure need_resched and @@ -107,9 +106,8 @@ n32_syscall_trace_entry: sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # set flag for syscall restarting 1: sd v0, PT_R2(sp) # result j syscall_exit @@ -322,10 +320,10 @@ EXPORT(sysn32_call_table) PTR sys_cacheflush PTR sys_cachectl PTR sys_sysmips - PTR compat_sys_io_setup /* 6200 */ + PTR sys_io_setup /* 6200 */ PTR sys_io_destroy - PTR compat_sys_io_getevents - PTR compat_sys_io_submit + PTR sys_io_getevents + PTR sys_io_submit PTR sys_io_cancel PTR sys_exit_group /* 6205 */ PTR sys_lookup_dcookie diff --git a/trunk/arch/mips/kernel/scall64-o32.S b/trunk/arch/mips/kernel/scall64-o32.S index 78d768a3e19d..171979fc98e5 100644 --- a/trunk/arch/mips/kernel/scall64-o32.S +++ b/trunk/arch/mips/kernel/scall64-o32.S @@ -93,9 +93,8 @@ NESTED(handle_sys, PT_SIZE, sp) sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # flag for syscall restarting 1: sd v0, PT_R2(sp) # result o32_syscall_exit: @@ -143,9 +142,8 @@ trace_a_syscall: sd t0, PT_R7(sp) # set error flag beqz t0, 1f - ld t1, PT_R2(sp) # syscall number dnegu v0 # error - sd t1, PT_R0(sp) # save it for syscall restarting + sd v0, PT_R0(sp) # set flag for syscall restarting 1: sd v0, PT_R2(sp) # result j syscall_exit @@ -156,7 +154,8 @@ trace_a_syscall: * The stackpointer for a call with more than 4 arguments is bad. */ bad_stack: - li v0, EFAULT + dnegu v0 # error + sd v0, PT_R0(sp) sd v0, PT_R2(sp) li t0, 1 # set error flag sd t0, PT_R7(sp) @@ -445,10 +444,10 @@ sys_call_table: PTR compat_sys_futex PTR compat_sys_sched_setaffinity PTR compat_sys_sched_getaffinity /* 4240 */ - PTR compat_sys_io_setup + PTR sys_io_setup PTR sys_io_destroy - PTR compat_sys_io_getevents - PTR compat_sys_io_submit + PTR sys_io_getevents + PTR sys_io_submit PTR sys_io_cancel /* 4245 */ PTR sys_exit_group PTR sys32_lookup_dcookie diff --git a/trunk/arch/mips/kernel/signal.c b/trunk/arch/mips/kernel/signal.c index 5922342bca39..2099d5a4c4b7 100644 --- a/trunk/arch/mips/kernel/signal.c +++ b/trunk/arch/mips/kernel/signal.c @@ -390,6 +390,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) { struct rt_sigframe __user *frame; sigset_t set; + stack_t st; int sig; frame = (struct rt_sigframe __user *) regs.regs[29]; @@ -410,9 +411,11 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) else if (sig) force_sig(sig, current); + if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) + goto badframe; /* It is more difficult to avoid calling this function than to call it and ignore errors. */ - do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]); + do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); /* * Don't let your children do this ... @@ -547,27 +550,24 @@ static int handle_signal(unsigned long sig, siginfo_t *info, struct mips_abi *abi = current->thread.abi; void *vdso = current->mm->context.vdso; - if (regs->regs[0]) { - switch(regs->regs[2]) { - case ERESTART_RESTARTBLOCK: - case ERESTARTNOHAND: + switch(regs->regs[0]) { + case ERESTART_RESTARTBLOCK: + case ERESTARTNOHAND: + regs->regs[2] = EINTR; + break; + case ERESTARTSYS: + if (!(ka->sa.sa_flags & SA_RESTART)) { regs->regs[2] = EINTR; break; - case ERESTARTSYS: - if (!(ka->sa.sa_flags & SA_RESTART)) { - regs->regs[2] = EINTR; - break; - } - /* fallthrough */ - case ERESTARTNOINTR: - regs->regs[7] = regs->regs[26]; - regs->regs[2] = regs->regs[0]; - regs->cp0_epc -= 4; } - - regs->regs[0] = 0; /* Don't deal with this again. */ + /* fallthrough */ + case ERESTARTNOINTR: /* Userland will reload $v0. */ + regs->regs[7] = regs->regs[26]; + regs->cp0_epc -= 8; } + regs->regs[0] = 0; /* Don't deal with this again. */ + if (sig_uses_siginfo(ka)) ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset, ka, regs, sig, oldset, info); @@ -575,9 +575,6 @@ static int handle_signal(unsigned long sig, siginfo_t *info, ret = abi->setup_frame(vdso + abi->signal_return_offset, ka, regs, sig, oldset); - if (ret) - return ret; - spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) @@ -625,13 +622,17 @@ static void do_signal(struct pt_regs *regs) return; } + /* + * Who's code doesn't conform to the restartable syscall convention + * dies here!!! The li instruction, a single machine instruction, + * must directly be followed by the syscall instruction. + */ if (regs->regs[0]) { if (regs->regs[2] == ERESTARTNOHAND || regs->regs[2] == ERESTARTSYS || regs->regs[2] == ERESTARTNOINTR) { - regs->regs[2] = regs->regs[0]; regs->regs[7] = regs->regs[26]; - regs->cp0_epc -= 4; + regs->cp0_epc -= 8; } if (regs->regs[2] == ERESTART_RESTARTBLOCK) { regs->regs[2] = current->thread.abi->restart; diff --git a/trunk/arch/mips/kernel/signal_n32.c b/trunk/arch/mips/kernel/signal_n32.c index ee24d814d5b9..2c5df818c65a 100644 --- a/trunk/arch/mips/kernel/signal_n32.c +++ b/trunk/arch/mips/kernel/signal_n32.c @@ -109,7 +109,6 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) { struct rt_sigframe_n32 __user *frame; - mm_segment_t old_fs; sigset_t set; stack_t st; s32 sp; @@ -144,11 +143,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) /* It is more difficult to avoid calling this function than to call it and ignore errors. */ - old_fs = get_fs(); - set_fs(KERNEL_DS); do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); - set_fs(old_fs); - /* * Don't let your children do this ... diff --git a/trunk/arch/mips/kernel/unaligned.c b/trunk/arch/mips/kernel/unaligned.c index 33d5a5ce4a29..69b039ca8d83 100644 --- a/trunk/arch/mips/kernel/unaligned.c +++ b/trunk/arch/mips/kernel/unaligned.c @@ -109,6 +109,8 @@ static void emulate_load_store_insn(struct pt_regs *regs, unsigned long value; unsigned int res; + regs->regs[0] = 0; + /* * This load never faults. */ diff --git a/trunk/arch/um/drivers/hostaudio_kern.c b/trunk/arch/um/drivers/hostaudio_kern.c index 63c740a85b4c..0c46e398cd8f 100644 --- a/trunk/arch/um/drivers/hostaudio_kern.c +++ b/trunk/arch/um/drivers/hostaudio_kern.c @@ -40,11 +40,6 @@ static char *mixer = HOSTAUDIO_DEV_MIXER; " This is used to specify the host mixer device to the hostaudio driver.\n"\ " The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n" -module_param(dsp, charp, 0644); -MODULE_PARM_DESC(dsp, DSP_HELP); -module_param(mixer, charp, 0644); -MODULE_PARM_DESC(mixer, MIXER_HELP); - #ifndef MODULE static int set_dsp(char *name, int *add) { @@ -61,6 +56,15 @@ static int set_mixer(char *name, int *add) } __uml_setup("mixer=", set_mixer, "mixer=\n" MIXER_HELP); + +#else /*MODULE*/ + +module_param(dsp, charp, 0644); +MODULE_PARM_DESC(dsp, DSP_HELP); + +module_param(mixer, charp, 0644); +MODULE_PARM_DESC(mixer, MIXER_HELP); + #endif /* /dev/dsp file operations */ diff --git a/trunk/arch/um/drivers/ubd_kern.c b/trunk/arch/um/drivers/ubd_kern.c index 9734994cba1e..1bcd208c459f 100644 --- a/trunk/arch/um/drivers/ubd_kern.c +++ b/trunk/arch/um/drivers/ubd_kern.c @@ -163,7 +163,6 @@ struct ubd { struct scatterlist sg[MAX_SG]; struct request *request; int start_sg, end_sg; - sector_t rq_pos; }; #define DEFAULT_COW { \ @@ -188,7 +187,6 @@ struct ubd { .request = NULL, \ .start_sg = 0, \ .end_sg = 0, \ - .rq_pos = 0, \ } /* Protected by ubd_lock */ @@ -1230,6 +1228,7 @@ static void do_ubd_request(struct request_queue *q) { struct io_thread_req *io_req; struct request *req; + sector_t sector; int n; while(1){ @@ -1240,12 +1239,12 @@ static void do_ubd_request(struct request_queue *q) return; dev->request = req; - dev->rq_pos = blk_rq_pos(req); dev->start_sg = 0; dev->end_sg = blk_rq_map_sg(q, req, dev->sg); } req = dev->request; + sector = blk_rq_pos(req); while(dev->start_sg < dev->end_sg){ struct scatterlist *sg = &dev->sg[dev->start_sg]; @@ -1257,9 +1256,10 @@ static void do_ubd_request(struct request_queue *q) return; } prepare_request(req, io_req, - (unsigned long long)dev->rq_pos << 9, + (unsigned long long)sector << 9, sg->offset, sg->length, sg_page(sg)); + sector += sg->length >> 9; n = os_write_file(thread_fd, &io_req, sizeof(struct io_thread_req *)); if(n != sizeof(struct io_thread_req *)){ @@ -1272,7 +1272,6 @@ static void do_ubd_request(struct request_queue *q) return; } - dev->rq_pos += sg->length >> 9; dev->start_sg++; } dev->end_sg = 0; diff --git a/trunk/arch/x86/ia32/ia32_aout.c b/trunk/arch/x86/ia32/ia32_aout.c index 2d93bdbc9ac0..0350311906ae 100644 --- a/trunk/arch/x86/ia32/ia32_aout.c +++ b/trunk/arch/x86/ia32/ia32_aout.c @@ -34,7 +34,7 @@ #include #undef WARN_OLD -#undef CORE_DUMP /* definitely broken */ +#undef CORE_DUMP /* probably broken */ static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); static int load_aout_library(struct file *); @@ -131,15 +131,21 @@ static void set_brk(unsigned long start, unsigned long end) * macros to write out all the necessary info. */ -#include +static int dump_write(struct file *file, const void *addr, int nr) +{ + return file->f_op->write(file, addr, nr, &file->f_pos) == nr; +} #define DUMP_WRITE(addr, nr) \ if (!dump_write(file, (void *)(addr), (nr))) \ goto end_coredump; -#define DUMP_SEEK(offset) \ - if (!dump_seek(file, offset)) \ - goto end_coredump; +#define DUMP_SEEK(offset) \ + if (file->f_op->llseek) { \ + if (file->f_op->llseek(file, (offset), 0) != (offset)) \ + goto end_coredump; \ + } else \ + file->f_pos = (offset) #define START_DATA() (u.u_tsize << PAGE_SHIFT) #define START_STACK(u) (u.start_stack) @@ -211,6 +217,12 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, dump_size = dump.u_ssize << PAGE_SHIFT; DUMP_WRITE(dump_start, dump_size); } + /* + * Finally dump the task struct. Not be used by gdb, but + * could be useful + */ + set_fs(KERNEL_DS); + DUMP_WRITE(current, sizeof(*current)); end_coredump: set_fs(fs); return has_dumped; diff --git a/trunk/arch/x86/include/asm/kvm_host.h b/trunk/arch/x86/include/asm/kvm_host.h index c52e2eb40a1e..502e53f999cf 100644 --- a/trunk/arch/x86/include/asm/kvm_host.h +++ b/trunk/arch/x86/include/asm/kvm_host.h @@ -652,6 +652,20 @@ static inline struct kvm_mmu_page *page_header(hpa_t shadow_page) return (struct kvm_mmu_page *)page_private(page); } +static inline u16 kvm_read_fs(void) +{ + u16 seg; + asm("mov %%fs, %0" : "=g"(seg)); + return seg; +} + +static inline u16 kvm_read_gs(void) +{ + u16 seg; + asm("mov %%gs, %0" : "=g"(seg)); + return seg; +} + static inline u16 kvm_read_ldt(void) { u16 ldt; @@ -659,6 +673,16 @@ static inline u16 kvm_read_ldt(void) return ldt; } +static inline void kvm_load_fs(u16 sel) +{ + asm("mov %0, %%fs" : : "rm"(sel)); +} + +static inline void kvm_load_gs(u16 sel) +{ + asm("mov %0, %%gs" : : "rm"(sel)); +} + static inline void kvm_load_ldt(u16 sel) { asm("lldt %0" : : "rm"(sel)); diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index cd8da247dda1..a2baafb2fe6d 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -701,6 +701,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) per_cpu(acfreq_data, policy->cpu) = NULL; acpi_processor_unregister_performance(data->acpi_data, policy->cpu); + kfree(data->freq_table); kfree(data); } diff --git a/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c b/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c index 39aaee5c1ab2..5e975298fa81 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -141,7 +141,6 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) address = (low & MASK_BLKPTR_LO) >> 21; if (!address) break; - address += MCG_XBLK_ADDR; } else ++address; @@ -149,8 +148,12 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) if (rdmsr_safe(address, &low, &high)) break; - if (!(high & MASK_VALID_HI)) - continue; + if (!(high & MASK_VALID_HI)) { + if (block) + continue; + else + break; + } if (!(high & MASK_CNTP_HI) || (high & MASK_LOCKED_HI)) diff --git a/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c b/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c index 169d8804a9f8..d9368eeda309 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -216,7 +216,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, err = sysfs_add_file_to_group(&sys_dev->kobj, &attr_core_power_limit_count.attr, thermal_attr_group.name); - if (cpu_has(c, X86_FEATURE_PTS)) { + if (cpu_has(c, X86_FEATURE_PTS)) err = sysfs_add_file_to_group(&sys_dev->kobj, &attr_package_throttle_count.attr, thermal_attr_group.name); @@ -224,7 +224,6 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, err = sysfs_add_file_to_group(&sys_dev->kobj, &attr_package_power_limit_count.attr, thermal_attr_group.name); - } return err; } diff --git a/trunk/arch/x86/kvm/svm.c b/trunk/arch/x86/kvm/svm.c index 8a3f9f64f86f..bc5b9b8d4a33 100644 --- a/trunk/arch/x86/kvm/svm.c +++ b/trunk/arch/x86/kvm/svm.c @@ -766,6 +766,7 @@ static void init_vmcb(struct vcpu_svm *svm) control->iopm_base_pa = iopm_base; control->msrpm_base_pa = __pa(svm->msrpm); + control->tsc_offset = 0; control->int_ctl = V_INTR_MASKING_MASK; init_seg(&save->es); @@ -901,7 +902,6 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; svm->asid_generation = 0; init_vmcb(svm); - svm->vmcb->control.tsc_offset = 0-native_read_tsc(); err = fx_init(&svm->vcpu); if (err) @@ -3163,8 +3163,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) sync_lapic_to_cr8(vcpu); save_host_msrs(vcpu); - savesegment(fs, fs_selector); - savesegment(gs, gs_selector); + fs_selector = kvm_read_fs(); + gs_selector = kvm_read_gs(); ldt_selector = kvm_read_ldt(); svm->vmcb->save.cr2 = vcpu->arch.cr2; /* required for live migration with NPT */ @@ -3251,15 +3251,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; - load_host_msrs(vcpu); - loadsegment(fs, fs_selector); -#ifdef CONFIG_X86_64 - load_gs_index(gs_selector); - wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); -#else - loadsegment(gs, gs_selector); -#endif + kvm_load_fs(fs_selector); + kvm_load_gs(gs_selector); kvm_load_ldt(ldt_selector); + load_host_msrs(vcpu); reload_tss(vcpu); diff --git a/trunk/arch/x86/kvm/vmx.c b/trunk/arch/x86/kvm/vmx.c index 7bddfab12013..49b25eee25ac 100644 --- a/trunk/arch/x86/kvm/vmx.c +++ b/trunk/arch/x86/kvm/vmx.c @@ -803,7 +803,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) */ vmx->host_state.ldt_sel = kvm_read_ldt(); vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel; - savesegment(fs, vmx->host_state.fs_sel); + vmx->host_state.fs_sel = kvm_read_fs(); if (!(vmx->host_state.fs_sel & 7)) { vmcs_write16(HOST_FS_SELECTOR, vmx->host_state.fs_sel); vmx->host_state.fs_reload_needed = 0; @@ -811,7 +811,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) vmcs_write16(HOST_FS_SELECTOR, 0); vmx->host_state.fs_reload_needed = 1; } - savesegment(gs, vmx->host_state.gs_sel); + vmx->host_state.gs_sel = kvm_read_gs(); if (!(vmx->host_state.gs_sel & 7)) vmcs_write16(HOST_GS_SELECTOR, vmx->host_state.gs_sel); else { @@ -841,21 +841,27 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) static void __vmx_load_host_state(struct vcpu_vmx *vmx) { + unsigned long flags; + if (!vmx->host_state.loaded) return; ++vmx->vcpu.stat.host_state_reload; vmx->host_state.loaded = 0; if (vmx->host_state.fs_reload_needed) - loadsegment(fs, vmx->host_state.fs_sel); + kvm_load_fs(vmx->host_state.fs_sel); if (vmx->host_state.gs_ldt_reload_needed) { kvm_load_ldt(vmx->host_state.ldt_sel); + /* + * If we have to reload gs, we must take care to + * preserve our gs base. + */ + local_irq_save(flags); + kvm_load_gs(vmx->host_state.gs_sel); #ifdef CONFIG_X86_64 - load_gs_index(vmx->host_state.gs_sel); - wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); -#else - loadsegment(gs, vmx->host_state.gs_sel); + wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE)); #endif + local_irq_restore(flags); } reload_tss(); #ifdef CONFIG_X86_64 @@ -2583,8 +2589,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */ - vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */ - vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */ + vmcs_write16(HOST_FS_SELECTOR, kvm_read_fs()); /* 22.2.4 */ + vmcs_write16(HOST_GS_SELECTOR, kvm_read_gs()); /* 22.2.4 */ vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ #ifdef CONFIG_X86_64 rdmsrl(MSR_FS_BASE, a); diff --git a/trunk/arch/x86/mm/srat_64.c b/trunk/arch/x86/mm/srat_64.c index 9c0d0d399c30..f9897f7a9ef1 100644 --- a/trunk/arch/x86/mm/srat_64.c +++ b/trunk/arch/x86/mm/srat_64.c @@ -420,11 +420,9 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) return -1; } - for (i = 0; i < num_node_memblks; i++) - e820_register_active_regions(memblk_nodeid[i], - node_memblk_range[i].start >> PAGE_SHIFT, - node_memblk_range[i].end >> PAGE_SHIFT); - + for_each_node_mask(i, nodes_parsed) + e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, + nodes[i].end >> PAGE_SHIFT); /* for out of order entries in SRAT */ sort_node_map(); if (!nodes_cover_memory(nodes)) { diff --git a/trunk/block/bsg.c b/trunk/block/bsg.c index 0c00870553a3..82d58829ba59 100644 --- a/trunk/block/bsg.c +++ b/trunk/block/bsg.c @@ -426,7 +426,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, /* * fill in all the output members */ - hdr->device_status = rq->errors & 0xff; + hdr->device_status = status_byte(rq->errors); hdr->transport_status = host_byte(rq->errors); hdr->driver_status = driver_byte(rq->errors); hdr->info = 0; diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index 0f9de2b44c0c..88681aca88c5 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -66,6 +66,7 @@ config ACPI_PROCFS config ACPI_PROCFS_POWER bool "Deprecated power /proc/acpi directories" depends on PROC_FS + default y help For backwards compatibility, this option allows deprecated power /proc/acpi/ directories to exist, even when @@ -89,6 +90,13 @@ config ACPI_POWER_METER To compile this driver as a module, choose M here: the module will be called power-meter. +config ACPI_SYSFS_POWER + bool "Future power /sys interface" + select POWER_SUPPLY + default y + help + Say N to disable power /sys interface + config ACPI_EC_DEBUGFS tristate "EC read/write access through /sys/kernel/debug/ec" default n @@ -128,7 +136,6 @@ config ACPI_PROC_EVENT config ACPI_AC tristate "AC Adapter" depends on X86 - select POWER_SUPPLY default y help This driver supports the AC Adapter object, which indicates @@ -141,7 +148,6 @@ config ACPI_AC config ACPI_BATTERY tristate "Battery" depends on X86 - select POWER_SUPPLY default y help This driver adds support for battery information through @@ -358,7 +364,6 @@ config ACPI_HOTPLUG_MEMORY config ACPI_SBS tristate "Smart Battery System" depends on X86 - select POWER_SUPPLY help This driver supports the Smart Battery System, another type of access to battery information, found on some laptops. diff --git a/trunk/drivers/acpi/ac.c b/trunk/drivers/acpi/ac.c index ba9afeaa23ac..56205a0b85df 100644 --- a/trunk/drivers/acpi/ac.c +++ b/trunk/drivers/acpi/ac.c @@ -32,7 +32,9 @@ #include #include #endif +#ifdef CONFIG_ACPI_SYSFS_POWER #include +#endif #include #include @@ -84,7 +86,9 @@ static struct acpi_driver acpi_ac_driver = { }; struct acpi_ac { +#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply charger; +#endif struct acpi_device * device; unsigned long long state; }; @@ -100,6 +104,7 @@ static const struct file_operations acpi_ac_fops = { .release = single_release, }; #endif +#ifdef CONFIG_ACPI_SYSFS_POWER static int get_ac_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -118,6 +123,7 @@ static int get_ac_property(struct power_supply *psy, static enum power_supply_property ac_props[] = { POWER_SUPPLY_PROP_ONLINE, }; +#endif /* -------------------------------------------------------------------------- AC Adapter Management -------------------------------------------------------------------------- */ @@ -241,7 +247,9 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) dev_name(&device->dev), event, (u32) ac->state); acpi_notifier_call_chain(device, event, (u32) ac->state); +#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); +#endif } return; @@ -274,12 +282,14 @@ static int acpi_ac_add(struct acpi_device *device) #endif if (result) goto end; +#ifdef CONFIG_ACPI_SYSFS_POWER ac->charger.name = acpi_device_bid(device); ac->charger.type = POWER_SUPPLY_TYPE_MAINS; ac->charger.properties = ac_props; ac->charger.num_properties = ARRAY_SIZE(ac_props); ac->charger.get_property = get_ac_property; power_supply_register(&ac->device->dev, &ac->charger); +#endif printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), @@ -306,8 +316,10 @@ static int acpi_ac_resume(struct acpi_device *device) old_state = ac->state; if (acpi_ac_get_state(ac)) return 0; +#ifdef CONFIG_ACPI_SYSFS_POWER if (old_state != ac->state) kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); +#endif return 0; } @@ -321,8 +333,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ac = acpi_driver_data(device); +#ifdef CONFIG_ACPI_SYSFS_POWER if (ac->charger.dev) power_supply_unregister(&ac->charger); +#endif #ifdef CONFIG_ACPI_PROCFS_POWER acpi_ac_remove_fs(device); #endif diff --git a/trunk/drivers/acpi/acpica/Makefile b/trunk/drivers/acpi/acpica/Makefile index a7e1d1aa4107..d93cc06f4bf8 100644 --- a/trunk/drivers/acpi/acpica/Makefile +++ b/trunk/drivers/acpi/acpica/Makefile @@ -21,7 +21,7 @@ acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o -acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o hwpci.o +acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o @@ -44,5 +44,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o acpi-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 utlock.o utids.o \ - utosi.o utxferror.o + utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o diff --git a/trunk/drivers/acpi/acpica/acdebug.h b/trunk/drivers/acpi/acpica/acdebug.h index 72e9d5eb083c..48faf3eba9fb 100644 --- a/trunk/drivers/acpi/acpica/acdebug.h +++ b/trunk/drivers/acpi/acpica/acdebug.h @@ -105,8 +105,6 @@ void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); -void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg); - acpi_status acpi_db_find_name_in_namespace(char *name_arg); void acpi_db_set_scope(char *name); diff --git a/trunk/drivers/acpi/acpica/acglobal.h b/trunk/drivers/acpi/acpica/acglobal.h index b8dbb9bd6962..1d192142c691 100644 --- a/trunk/drivers/acpi/acpica/acglobal.h +++ b/trunk/drivers/acpi/acpica/acglobal.h @@ -132,7 +132,6 @@ struct acpi_table_fadt acpi_gbl_FADT; u32 acpi_current_gpe_count; u32 acpi_gbl_trace_flags; acpi_name acpi_gbl_trace_method_name; -u8 acpi_gbl_system_awake_and_running; #endif @@ -188,10 +187,6 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; ACPI_EXTERN u8 acpi_gbl_integer_byte_width; ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; -/* Mutex for _OSI support */ - -ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; - /* Reader/Writer lock is used for namespace walk and dynamic table unload */ ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; @@ -260,7 +255,6 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; ACPI_EXTERN void *acpi_gbl_table_handler_context; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; -ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; /* Owner ID support */ @@ -279,8 +273,8 @@ ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_step_to_next_call; ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; ACPI_EXTERN u8 acpi_gbl_events_initialized; +ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; ACPI_EXTERN u8 acpi_gbl_osi_data; -ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces; #ifndef DEFINE_ACPI_GLOBALS diff --git a/trunk/drivers/acpi/acpica/achware.h b/trunk/drivers/acpi/acpica/achware.h index 167470ad2d21..120b3af56596 100644 --- a/trunk/drivers/acpi/acpica/achware.h +++ b/trunk/drivers/acpi/acpica/achware.h @@ -121,13 +121,6 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, struct acpi_gpe_block_info *gpe_block, void *context); -/* - * hwpci - PCI configuration support - */ -acpi_status -acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, - acpi_handle root_pci_device, acpi_handle pci_region); - #ifdef ACPI_FUTURE_USAGE /* * hwtimer - ACPI Timer prototypes diff --git a/trunk/drivers/acpi/acpica/aclocal.h b/trunk/drivers/acpi/acpica/aclocal.h index 8acf1e8e479f..7dad9160f209 100644 --- a/trunk/drivers/acpi/acpica/aclocal.h +++ b/trunk/drivers/acpi/acpica/aclocal.h @@ -854,7 +854,7 @@ struct acpi_bit_register_info { ACPI_BITMASK_POWER_BUTTON_STATUS | \ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ ACPI_BITMASK_RT_CLOCK_STATUS | \ - ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ + ACPI_BITMASK_PCIEXP_WAKE_DISABLE | \ ACPI_BITMASK_WAKE_STATUS) #define ACPI_BITMASK_TIMER_ENABLE 0x0001 @@ -909,21 +909,15 @@ struct acpi_bit_register_info { #define ACPI_OSI_WIN_VISTA 0x07 #define ACPI_OSI_WINSRV_2008 0x08 #define ACPI_OSI_WIN_VISTA_SP1 0x09 -#define ACPI_OSI_WIN_VISTA_SP2 0x0A -#define ACPI_OSI_WIN_7 0x0B +#define ACPI_OSI_WIN_7 0x0A #define ACPI_ALWAYS_ILLEGAL 0x00 struct acpi_interface_info { char *name; - struct acpi_interface_info *next; - u8 flags; u8 value; }; -#define ACPI_OSI_INVALID 0x01 -#define ACPI_OSI_DYNAMIC 0x02 - struct acpi_port_info { char *name; u16 start; @@ -1003,7 +997,7 @@ struct acpi_port_info { struct acpi_db_method_info { acpi_handle main_thread_gate; acpi_handle thread_complete_gate; - acpi_thread_id *threads; + u32 *threads; u32 num_threads; u32 num_created; u32 num_completed; diff --git a/trunk/drivers/acpi/acpica/acmacros.h b/trunk/drivers/acpi/acpica/acmacros.h index 8d5c9e0a495f..9894929a2abb 100644 --- a/trunk/drivers/acpi/acpica/acmacros.h +++ b/trunk/drivers/acpi/acpica/acmacros.h @@ -338,8 +338,8 @@ * 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_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); -#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); +#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); #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist diff --git a/trunk/drivers/acpi/acpica/acnamesp.h b/trunk/drivers/acpi/acpica/acnamesp.h index d44d3bc5b847..9f60ff002203 100644 --- a/trunk/drivers/acpi/acpica/acnamesp.h +++ b/trunk/drivers/acpi/acpica/acnamesp.h @@ -338,6 +338,18 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); u32 acpi_ns_local(acpi_object_type type); +void +acpi_ns_report_error(const char *module_name, + u32 line_number, + const char *internal_name, acpi_status lookup_status); + +void +acpi_ns_report_method_error(const char *module_name, + u32 line_number, + const char *message, + struct acpi_namespace_node *node, + const char *path, acpi_status lookup_status); + void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); diff --git a/trunk/drivers/acpi/acpica/acobject.h b/trunk/drivers/acpi/acpica/acobject.h index bdbfaf22bd14..54857fa87aaf 100644 --- a/trunk/drivers/acpi/acpica/acobject.h +++ b/trunk/drivers/acpi/acpica/acobject.h @@ -248,7 +248,7 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; u32 base_byte_offset; /* Byte offset within containing object */\ u32 value; /* Value to store into the Bank or Index register */\ u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ - + u8 access_bit_width; /* Read/Write size in bits (8-64) */ struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ diff --git a/trunk/drivers/acpi/acpica/acutils.h b/trunk/drivers/acpi/acpica/acutils.h index 72e4183c1937..35df755251ce 100644 --- a/trunk/drivers/acpi/acpica/acutils.h +++ b/trunk/drivers/acpi/acpica/acutils.h @@ -312,6 +312,8 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); /* * uteval - object evaluation */ +acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); + acpi_status acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, char *path, @@ -392,21 +394,6 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); acpi_status acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); -/* - * utosi - Support for the _OSI predefined control method - */ -acpi_status acpi_ut_initialize_interfaces(void); - -void acpi_ut_interface_terminate(void); - -acpi_status acpi_ut_install_interface(acpi_string interface_name); - -acpi_status acpi_ut_remove_interface(acpi_string interface_name); - -struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); - -acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); - /* * utstate - Generic state creation/cache routines */ @@ -486,6 +473,17 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_predefined_warning(const char *module_name, + u32 line_number, + char *pathname, + u8 node_flags, const char *format, ...); + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_predefined_info(const char *module_name, + u32 line_number, + char *pathname, u8 node_flags, const char *format, ...); + /* Values for Base above (16=Hex, 10=Decimal) */ #define ACPI_ANY_BASE 0 @@ -576,32 +574,6 @@ acpi_status acpi_ut_create_list(char *list_name, u16 object_size, struct acpi_memory_list **return_cache); -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ - -/* - * utxferror - various error/warning output functions - */ -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_predefined_warning(const char *module_name, - u32 line_number, - char *pathname, - u8 node_flags, const char *format, ...); - -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_predefined_info(const char *module_name, - u32 line_number, - char *pathname, u8 node_flags, const char *format, ...); - -void -acpi_ut_namespace_error(const char *module_name, - u32 line_number, - const char *internal_name, acpi_status lookup_status); - -void -acpi_ut_method_error(const char *module_name, - u32 line_number, - const char *message, - struct acpi_namespace_node *node, - const char *path, acpi_status lookup_status); +#endif #endif /* _ACUTILS_H */ diff --git a/trunk/drivers/acpi/acpica/dsmethod.c b/trunk/drivers/acpi/acpica/dsmethod.c index d94dd8974b55..64750ee96e20 100644 --- a/trunk/drivers/acpi/acpica/dsmethod.c +++ b/trunk/drivers/acpi/acpica/dsmethod.c @@ -573,7 +573,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, acpi_os_release_mutex(method_desc->method. mutex->mutex.os_mutex); - method_desc->method.mutex->mutex.thread_id = 0; + method_desc->method.mutex->mutex.thread_id = NULL; } } diff --git a/trunk/drivers/acpi/acpica/dswexec.c b/trunk/drivers/acpi/acpica/dswexec.c index 6b0b5d08d97a..d555b374e314 100644 --- a/trunk/drivers/acpi/acpica/dswexec.c +++ b/trunk/drivers/acpi/acpica/dswexec.c @@ -300,25 +300,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, * we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. - * - * Note 10/2010: Except for the Scope() op. This opcode does - * not actually create a new object, it refers to an existing - * object. However, for Scope(), we want to indeed open a - * new scope. */ - if (op->common.aml_opcode != AML_SCOPE_OP) { - status = - acpi_ds_load2_begin_op(walk_state, NULL); - } else { - status = - acpi_ds_scope_stack_push(op->named.node, - op->named.node-> - type, walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } + status = acpi_ds_load2_begin_op(walk_state, NULL); } + break; case AML_CLASS_EXECUTE: diff --git a/trunk/drivers/acpi/acpica/evmisc.c b/trunk/drivers/acpi/acpica/evmisc.c index fcaed9fb44ff..df0aea9a8cfd 100644 --- a/trunk/drivers/acpi/acpica/evmisc.c +++ b/trunk/drivers/acpi/acpica/evmisc.c @@ -553,7 +553,7 @@ acpi_status acpi_ev_release_global_lock(void) acpi_gbl_global_lock_acquired = FALSE; /* Release the local GL mutex */ - acpi_ev_global_lock_thread_id = 0; + acpi_ev_global_lock_thread_id = NULL; acpi_ev_global_lock_acquired = 0; acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/acpica/evrgnini.c b/trunk/drivers/acpi/acpica/evrgnini.c index 0b47a6dc9290..f40d271bf568 100644 --- a/trunk/drivers/acpi/acpica/evrgnini.c +++ b/trunk/drivers/acpi/acpica/evrgnini.c @@ -289,8 +289,8 @@ 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); @@ -320,15 +320,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, pci_id->bus = ACPI_LOWORD(pci_value); } - /* Complete/update the PCI ID for this device */ + /* Complete this device's pci_id */ - status = - acpi_hw_derive_pci_id(pci_id, pci_root_node, - region_obj->region.node); - if (ACPI_FAILURE(status)) { - ACPI_FREE(pci_id); - return_ACPI_STATUS(status); - } + acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id); *region_context = pci_id; return_ACPI_STATUS(AE_OK); diff --git a/trunk/drivers/acpi/acpica/evxfregn.c b/trunk/drivers/acpi/acpica/evxfregn.c index ce9314f79451..541cbc1544d5 100644 --- a/trunk/drivers/acpi/acpica/evxfregn.c +++ b/trunk/drivers/acpi/acpica/evxfregn.c @@ -64,12 +64,6 @@ ACPI_MODULE_NAME("evxfregn") * * DESCRIPTION: Install a handler for all op_regions of a given space_id. * - * NOTE: This function should only be called after acpi_enable_subsystem has - * been called. This is because any _REG methods associated with the Space ID - * are executed here, and these methods can only be safely executed after - * the default handlers have been installed and the hardware has been - * initialized (via acpi_enable_subsystem.) - * ******************************************************************************/ acpi_status acpi_install_address_space_handler(acpi_handle device, diff --git a/trunk/drivers/acpi/acpica/exfldio.c b/trunk/drivers/acpi/acpica/exfldio.c index 38293fd3e088..047217303a4b 100644 --- a/trunk/drivers/acpi/acpica/exfldio.c +++ b/trunk/drivers/acpi/acpica/exfldio.c @@ -119,8 +119,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, } /* - * Exit now for SMBus or IPMI address space, it has a non-linear - * address space and the request cannot be directly validated + * Exit now for SMBus or IPMI address space, it has a non-linear address space + * and the request cannot be directly validated */ if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { @@ -147,7 +147,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * (Region length is specified in bytes) */ if (rgn_desc->region.length < - (obj_desc->common_field.base_byte_offset + field_datum_byte_offset + + (obj_desc->common_field.base_byte_offset + + field_datum_byte_offset + obj_desc->common_field.access_byte_width)) { if (acpi_gbl_enable_interpreter_slack) { /* @@ -679,7 +680,6 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, u32 buffer_tail_bits; u32 datum_count; u32 field_datum_count; - u32 access_bit_width; u32 i; ACPI_FUNCTION_TRACE(ex_extract_from_field); @@ -694,36 +694,16 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } - ACPI_MEMSET(buffer, 0, buffer_length); - access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); - - /* Handle the simple case here */ - - if ((obj_desc->common_field.start_field_bit_offset == 0) && - (obj_desc->common_field.bit_length == access_bit_width)) { - status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ); - return_ACPI_STATUS(status); - } - -/* TBD: Move to common setup code */ - - /* Field algorithm is limited to sizeof(u64), truncate if needed */ - - if (obj_desc->common_field.access_byte_width > sizeof(u64)) { - obj_desc->common_field.access_byte_width = sizeof(u64); - access_bit_width = sizeof(u64) * 8; - } /* Compute the number of datums (access width data items) */ - datum_count = - ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, - access_bit_width); - + datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, + obj_desc->common_field.access_bit_width); field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + obj_desc->common_field. start_field_bit_offset, + obj_desc->common_field. access_bit_width); /* Priming read from the field */ @@ -758,11 +738,12 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, * This avoids the differences in behavior between different compilers * concerning shift values larger than the target data width. */ - if (access_bit_width - - obj_desc->common_field.start_field_bit_offset < + if ((obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset) < ACPI_INTEGER_BIT_SIZE) { merged_datum |= - raw_datum << (access_bit_width - + raw_datum << (obj_desc->common_field. + access_bit_width - obj_desc->common_field. start_field_bit_offset); } @@ -784,7 +765,8 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, /* Mask off any extra bits in the last datum */ - buffer_tail_bits = obj_desc->common_field.bit_length % access_bit_width; + buffer_tail_bits = obj_desc->common_field.bit_length % + obj_desc->common_field.access_bit_width; if (buffer_tail_bits) { merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); } @@ -816,7 +798,6 @@ acpi_status acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, void *buffer, u32 buffer_length) { - void *new_buffer; acpi_status status; u64 mask; u64 width_mask; @@ -827,9 +808,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, u32 buffer_tail_bits; u32 datum_count; u32 field_datum_count; - u32 access_bit_width; - u32 required_length; u32 i; + u32 required_length; + void *new_buffer; ACPI_FUNCTION_TRACE(ex_insert_into_field); @@ -863,24 +844,17 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, buffer_length = required_length; } -/* TBD: Move to common setup code */ - - /* Algo is limited to sizeof(u64), so cut the access_byte_width */ - if (obj_desc->common_field.access_byte_width > sizeof(u64)) { - obj_desc->common_field.access_byte_width = sizeof(u64); - } - - access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); - /* * Create the bitmasks used for bit insertion. * Note: This if/else is used to bypass compiler differences with the * shift operator */ - if (access_bit_width == ACPI_INTEGER_BIT_SIZE) { + if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { width_mask = ACPI_UINT64_MAX; } else { - width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width); + width_mask = + ACPI_MASK_BITS_ABOVE(obj_desc->common_field. + access_bit_width); } mask = width_mask & @@ -889,11 +863,12 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, /* Compute the number of datums (access width data items) */ datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, - access_bit_width); + obj_desc->common_field.access_bit_width); field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + obj_desc->common_field. start_field_bit_offset, + obj_desc->common_field. access_bit_width); /* Get initial Datum from the input buffer */ @@ -930,11 +905,12 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, * This avoids the differences in behavior between different compilers * concerning shift values larger than the target data width. */ - if ((access_bit_width - + if ((obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset) < ACPI_INTEGER_BIT_SIZE) { merged_datum = - raw_datum >> (access_bit_width - + raw_datum >> (obj_desc->common_field. + access_bit_width - obj_desc->common_field. start_field_bit_offset); } else { @@ -953,7 +929,6 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, ACPI_MIN(obj_desc->common_field.access_byte_width, buffer_length - buffer_offset)); - merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset; } @@ -962,7 +937,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, buffer_tail_bits = (obj_desc->common_field.bit_length + obj_desc->common_field.start_field_bit_offset) % - access_bit_width; + obj_desc->common_field.access_bit_width; if (buffer_tail_bits) { mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); } diff --git a/trunk/drivers/acpi/acpica/exmutex.c b/trunk/drivers/acpi/acpica/exmutex.c index 6af14e43f839..f73be97043c0 100644 --- a/trunk/drivers/acpi/acpica/exmutex.c +++ b/trunk/drivers/acpi/acpica/exmutex.c @@ -336,7 +336,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) /* Clear mutex info */ - obj_desc->mutex.thread_id = 0; + obj_desc->mutex.thread_id = NULL; return_ACPI_STATUS(status); } @@ -393,10 +393,10 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, if ((owner_thread->thread_id != walk_state->thread->thread_id) && (obj_desc != acpi_gbl_global_lock_mutex)) { ACPI_ERROR((AE_INFO, - "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", - (u32)walk_state->thread->thread_id, + "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", + ACPI_CAST_PTR(void, walk_state->thread->thread_id), acpi_ut_get_node_name(obj_desc->mutex.node), - (u32)owner_thread->thread_id)); + ACPI_CAST_PTR(void, owner_thread->thread_id))); return_ACPI_STATUS(AE_AML_NOT_OWNER); } @@ -488,7 +488,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) /* Mark mutex unowned */ obj_desc->mutex.owner_thread = NULL; - obj_desc->mutex.thread_id = 0; + obj_desc->mutex.thread_id = NULL; /* Update Thread sync_level (Last mutex is the important one) */ diff --git a/trunk/drivers/acpi/acpica/exprep.c b/trunk/drivers/acpi/acpica/exprep.c index 7aae29f73d3f..98a331d2249b 100644 --- a/trunk/drivers/acpi/acpica/exprep.c +++ b/trunk/drivers/acpi/acpica/exprep.c @@ -355,10 +355,12 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } - /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */ + /* Setup width (access granularity) fields */ obj_desc->common_field.access_byte_width = (u8) - ACPI_DIV_8(access_bit_width); + ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */ + + obj_desc->common_field.access_bit_width = (u8) access_bit_width; /* * base_byte_offset is the address of the start of the field within the @@ -403,9 +405,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) { union acpi_operand_object *obj_desc; union acpi_operand_object *second_desc = NULL; - acpi_status status; - u32 access_byte_width; u32 type; + acpi_status status; ACPI_FUNCTION_TRACE(ex_prep_field_value); @@ -420,8 +421,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) type = acpi_ns_get_type(info->region_node); if (type != ACPI_TYPE_REGION) { ACPI_ERROR((AE_INFO, - "Needed Region, found type 0x%X (%s)", type, - acpi_ut_get_type_name(type))); + "Needed Region, found type 0x%X (%s)", + type, acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -437,8 +438,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) /* Initialize areas of the object that are common to all fields */ obj_desc->common_field.node = info->field_node; - status = acpi_ex_prep_common_field_object(obj_desc, - info->field_flags, + status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags, info->attribute, info->field_bit_position, info->field_bit_length); @@ -455,25 +455,26 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) obj_desc->field.region_obj = acpi_ns_get_attached_object(info->region_node); - /* Allow full data read from EC address space */ - - if ((obj_desc->field.region_obj->region.space_id == - ACPI_ADR_SPACE_EC) - && (obj_desc->common_field.bit_length > 8)) { - access_byte_width = - ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field. - bit_length); + /* An additional reference for the container */ - /* Maximum byte width supported is 255 */ + acpi_ut_add_reference(obj_desc->field.region_obj); - if (access_byte_width < 256) { + /* allow full data read from EC address space */ + if (obj_desc->field.region_obj->region.space_id == + ACPI_ADR_SPACE_EC) { + if (obj_desc->common_field.bit_length > 8) { + unsigned width = + ACPI_ROUND_BITS_UP_TO_BYTES( + obj_desc->common_field.bit_length); + // access_bit_width is u8, don't overflow it + if (width > 8) + width = 8; obj_desc->common_field.access_byte_width = - (u8)access_byte_width; + width; + obj_desc->common_field.access_bit_width = + 8 * width; } } - /* An additional reference for the container */ - - acpi_ut_add_reference(obj_desc->field.region_obj); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", diff --git a/trunk/drivers/acpi/acpica/exregion.c b/trunk/drivers/acpi/acpica/exregion.c index de17e10da0ed..8819d2ac5aee 100644 --- a/trunk/drivers/acpi/acpica/exregion.c +++ b/trunk/drivers/acpi/acpica/exregion.c @@ -353,6 +353,7 @@ acpi_ex_pci_config_space_handler(u32 function, acpi_status status = AE_OK; struct acpi_pci_id *pci_id; u16 pci_register; + u32 value32; ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); @@ -380,7 +381,8 @@ acpi_ex_pci_config_space_handler(u32 function, case ACPI_READ: status = acpi_os_read_pci_configuration(pci_id, pci_register, - value, bit_width); + &value32, bit_width); + *value = value32; break; case ACPI_WRITE: diff --git a/trunk/drivers/acpi/acpica/hwpci.c b/trunk/drivers/acpi/acpica/hwpci.c deleted file mode 100644 index ad21c7d8bf4f..000000000000 --- a/trunk/drivers/acpi/acpica/hwpci.c +++ /dev/null @@ -1,412 +0,0 @@ -/******************************************************************************* - * - * Module Name: hwpci - Obtain PCI bus, device, and function numbers - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2010, 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" - -#define _COMPONENT ACPI_NAMESPACE -ACPI_MODULE_NAME("hwpci") - -/* PCI configuration space values */ -#define PCI_CFG_HEADER_TYPE_REG 0x0E -#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18 -#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19 -/* PCI header values */ -#define PCI_HEADER_TYPE_MASK 0x7F -#define PCI_TYPE_BRIDGE 0x01 -#define PCI_TYPE_CARDBUS_BRIDGE 0x02 -typedef struct acpi_pci_device { - acpi_handle device; - struct acpi_pci_device *next; - -} acpi_pci_device; - -/* Local prototypes */ - -static acpi_status -acpi_hw_build_pci_list(acpi_handle root_pci_device, - acpi_handle pci_region, - struct acpi_pci_device **return_list_head); - -static acpi_status -acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, - struct acpi_pci_device *list_head); - -static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head); - -static acpi_status -acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, - acpi_handle pci_device, - u16 *bus_number, u8 *is_bridge); - -/******************************************************************************* - * - * FUNCTION: acpi_hw_derive_pci_id - * - * PARAMETERS: pci_id - Initial values for the PCI ID. May be - * modified by this function. - * root_pci_device - A handle to a PCI device object. This - * object must be a PCI Root Bridge having a - * _HID value of either PNP0A03 or PNP0A08 - * pci_region - A handle to a PCI configuration space - * Operation Region being initialized - * - * RETURN: Status - * - * DESCRIPTION: This function derives a full PCI ID for a PCI device, - * consisting of a Segment number, Bus number, Device number, - * and function code. - * - * The PCI hardware dynamically configures PCI bus numbers - * depending on the bus topology discovered during system - * initialization. This function is invoked during configuration - * of a PCI_Config Operation Region in order to (possibly) update - * the Bus/Device/Function numbers in the pci_id with the actual - * values as determined by the hardware and operating system - * configuration. - * - * The pci_id parameter is initially populated during the Operation - * Region initialization. This function is then called, and is - * will make any necessary modifications to the Bus, Device, or - * Function number PCI ID subfields as appropriate for the - * current hardware and OS configuration. - * - * NOTE: Created 08/2010. Replaces the previous OSL acpi_os_derive_pci_id - * interface since this feature is OS-independent. This module - * specifically avoids any use of recursion by building a local - * temporary device list. - * - ******************************************************************************/ - -acpi_status -acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, - acpi_handle root_pci_device, acpi_handle pci_region) -{ - acpi_status status; - struct acpi_pci_device *list_head = NULL; - - ACPI_FUNCTION_TRACE(hw_derive_pci_id); - - if (!pci_id) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - /* Build a list of PCI devices, from pci_region up to root_pci_device */ - - status = - acpi_hw_build_pci_list(root_pci_device, pci_region, &list_head); - if (ACPI_SUCCESS(status)) { - - /* Walk the list, updating the PCI device/function/bus numbers */ - - status = acpi_hw_process_pci_list(pci_id, list_head); - } - - /* Always delete the list */ - - acpi_hw_delete_pci_list(list_head); - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_hw_build_pci_list - * - * PARAMETERS: root_pci_device - A handle to a PCI device object. This - * object is guaranteed to be a PCI Root - * Bridge having a _HID value of either - * PNP0A03 or PNP0A08 - * pci_region - A handle to the PCI configuration space - * Operation Region - * return_list_head - Where the PCI device list is returned - * - * RETURN: Status - * - * DESCRIPTION: Builds a list of devices from the input PCI region up to the - * Root PCI device for this namespace subtree. - * - ******************************************************************************/ - -static acpi_status -acpi_hw_build_pci_list(acpi_handle root_pci_device, - acpi_handle pci_region, - struct acpi_pci_device **return_list_head) -{ - acpi_handle current_device; - acpi_handle parent_device; - acpi_status status; - struct acpi_pci_device *list_element; - struct acpi_pci_device *list_head = NULL; - - /* - * Ascend namespace branch until the root_pci_device is reached, building - * a list of device nodes. Loop will exit when either the PCI device is - * found, or the root of the namespace is reached. - */ - current_device = pci_region; - while (1) { - status = acpi_get_parent(current_device, &parent_device); - if (ACPI_FAILURE(status)) { - return (status); - } - - /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ - - if (parent_device == root_pci_device) { - *return_list_head = list_head; - return (AE_OK); - } - - list_element = ACPI_ALLOCATE(sizeof(struct acpi_pci_device)); - if (!list_element) { - return (AE_NO_MEMORY); - } - - /* Put new element at the head of the list */ - - list_element->next = list_head; - list_element->device = parent_device; - list_head = list_element; - - current_device = parent_device; - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_hw_process_pci_list - * - * PARAMETERS: pci_id - Initial values for the PCI ID. May be - * modified by this function. - * list_head - Device list created by - * acpi_hw_build_pci_list - * - * RETURN: Status - * - * DESCRIPTION: Walk downward through the PCI device list, getting the device - * info for each, via the PCI configuration space and updating - * the PCI ID as necessary. Deletes the list during traversal. - * - ******************************************************************************/ - -static acpi_status -acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, - struct acpi_pci_device *list_head) -{ - acpi_status status = AE_OK; - struct acpi_pci_device *info; - u16 bus_number; - u8 is_bridge = TRUE; - - ACPI_FUNCTION_NAME(hw_process_pci_list); - - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n", - pci_id->segment, pci_id->bus, pci_id->device, - pci_id->function)); - - bus_number = pci_id->bus; - - /* - * Descend down the namespace tree, collecting PCI device, function, - * and bus numbers. bus_number is only important for PCI bridges. - * Algorithm: As we descend the tree, use the last valid PCI device, - * function, and bus numbers that are discovered, and assign them - * to the PCI ID for the target device. - */ - info = list_head; - while (info) { - status = acpi_hw_get_pci_device_info(pci_id, info->device, - &bus_number, &is_bridge); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - info = info->next; - } - - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X " - "Status %X BusNumber %X IsBridge %X\n", - pci_id->segment, pci_id->bus, pci_id->device, - pci_id->function, status, bus_number, is_bridge)); - - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_hw_delete_pci_list - * - * PARAMETERS: list_head - Device list created by - * acpi_hw_build_pci_list - * - * RETURN: None - * - * DESCRIPTION: Free the entire PCI list. - * - ******************************************************************************/ - -static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head) -{ - struct acpi_pci_device *next; - struct acpi_pci_device *previous; - - next = list_head; - while (next) { - previous = next; - next = previous->next; - ACPI_FREE(previous); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_hw_get_pci_device_info - * - * PARAMETERS: pci_id - Initial values for the PCI ID. May be - * modified by this function. - * pci_device - Handle for the PCI device object - * bus_number - Where a PCI bridge bus number is returned - * is_bridge - Return value, indicates if this PCI - * device is a PCI bridge - * - * RETURN: Status - * - * DESCRIPTION: Get the device info for a single PCI device object. Get the - * _ADR (contains PCI device and function numbers), and for PCI - * bridge devices, get the bus number from PCI configuration - * space. - * - ******************************************************************************/ - -static acpi_status -acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, - acpi_handle pci_device, - u16 *bus_number, u8 *is_bridge) -{ - acpi_status status; - acpi_object_type object_type; - u64 return_value; - u64 pci_value; - - /* We only care about objects of type Device */ - - status = acpi_get_type(pci_device, &object_type); - if (ACPI_FAILURE(status)) { - return (status); - } - - if (object_type != ACPI_TYPE_DEVICE) { - return (AE_OK); - } - - /* We need an _ADR. Ignore device if not present */ - - status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, - pci_device, &return_value); - if (ACPI_FAILURE(status)) { - return (AE_OK); - } - - /* - * From _ADR, get the PCI Device and Function and - * update the PCI ID. - */ - pci_id->device = ACPI_HIWORD(ACPI_LODWORD(return_value)); - pci_id->function = ACPI_LOWORD(ACPI_LODWORD(return_value)); - - /* - * If the previous device was a bridge, use the previous - * device bus number - */ - if (*is_bridge) { - pci_id->bus = *bus_number; - } - - /* - * Get the bus numbers from PCI Config space: - * - * First, get the PCI header_type - */ - *is_bridge = FALSE; - status = acpi_os_read_pci_configuration(pci_id, - PCI_CFG_HEADER_TYPE_REG, - &pci_value, 8); - if (ACPI_FAILURE(status)) { - return (status); - } - - /* We only care about bridges (1=pci_bridge, 2=card_bus_bridge) */ - - pci_value &= PCI_HEADER_TYPE_MASK; - - if ((pci_value != PCI_TYPE_BRIDGE) && - (pci_value != PCI_TYPE_CARDBUS_BRIDGE)) { - return (AE_OK); - } - - /* Bridge: Get the Primary bus_number */ - - status = acpi_os_read_pci_configuration(pci_id, - PCI_CFG_PRIMARY_BUS_NUMBER_REG, - &pci_value, 8); - if (ACPI_FAILURE(status)) { - return (status); - } - - *is_bridge = TRUE; - pci_id->bus = (u16)pci_value; - - /* Bridge: Get the Secondary bus_number */ - - status = acpi_os_read_pci_configuration(pci_id, - PCI_CFG_SECONDARY_BUS_NUMBER_REG, - &pci_value, 8); - if (ACPI_FAILURE(status)) { - return (status); - } - - *bus_number = (u16)pci_value; - return (AE_OK); -} diff --git a/trunk/drivers/acpi/acpica/nsrepair2.c b/trunk/drivers/acpi/acpica/nsrepair2.c index 4ef9f43ea926..4009498fbabd 100644 --- a/trunk/drivers/acpi/acpica/nsrepair2.c +++ b/trunk/drivers/acpi/acpica/nsrepair2.c @@ -73,18 +73,10 @@ static acpi_status acpi_ns_repair_ALR(struct acpi_predefined_data *data, union acpi_operand_object **return_object_ptr); -static acpi_status -acpi_ns_repair_CID(struct acpi_predefined_data *data, - union acpi_operand_object **return_object_ptr); - static acpi_status acpi_ns_repair_FDE(struct acpi_predefined_data *data, union acpi_operand_object **return_object_ptr); -static acpi_status -acpi_ns_repair_HID(struct acpi_predefined_data *data, - union acpi_operand_object **return_object_ptr); - static acpi_status acpi_ns_repair_PSS(struct acpi_predefined_data *data, union acpi_operand_object **return_object_ptr); @@ -116,10 +108,8 @@ acpi_ns_sort_list(union acpi_operand_object **elements, * As necessary: * * _ALR: Sort the list ascending by ambient_illuminance - * _CID: Strings: uppercase all, remove any leading asterisk * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs - * _HID: Strings: uppercase all, remove any leading asterisk * _PSS: Sort the list descending by Power * _TSS: Sort the list descending by Power * @@ -132,10 +122,8 @@ acpi_ns_sort_list(union acpi_operand_object **elements, */ static const struct acpi_repair_info acpi_ns_repairable_names[] = { {"_ALR", acpi_ns_repair_ALR}, - {"_CID", acpi_ns_repair_CID}, {"_FDE", acpi_ns_repair_FDE}, {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ - {"_HID", acpi_ns_repair_HID}, {"_PSS", acpi_ns_repair_PSS}, {"_TSS", acpi_ns_repair_TSS}, {{0, 0, 0, 0}, NULL} /* Table terminator */ @@ -331,157 +319,6 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data, return (AE_OK); } -/****************************************************************************** - * - * FUNCTION: acpi_ns_repair_CID - * - * PARAMETERS: Data - Pointer to validation data structure - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _CID object. If a string, ensure that all - * letters are uppercase and that there is no leading asterisk. - * If a Package, ensure same for all string elements. - * - *****************************************************************************/ - -static acpi_status -acpi_ns_repair_CID(struct acpi_predefined_data *data, - union acpi_operand_object **return_object_ptr) -{ - acpi_status status; - union acpi_operand_object *return_object = *return_object_ptr; - union acpi_operand_object **element_ptr; - union acpi_operand_object *original_element; - u16 original_ref_count; - u32 i; - - /* Check for _CID as a simple string */ - - if (return_object->common.type == ACPI_TYPE_STRING) { - status = acpi_ns_repair_HID(data, return_object_ptr); - return (status); - } - - /* Exit if not a Package */ - - if (return_object->common.type != ACPI_TYPE_PACKAGE) { - return (AE_OK); - } - - /* Examine each element of the _CID package */ - - element_ptr = return_object->package.elements; - for (i = 0; i < return_object->package.count; i++) { - original_element = *element_ptr; - original_ref_count = original_element->common.reference_count; - - status = acpi_ns_repair_HID(data, element_ptr); - if (ACPI_FAILURE(status)) { - return (status); - } - - /* Take care with reference counts */ - - if (original_element != *element_ptr) { - - /* Element was replaced */ - - (*element_ptr)->common.reference_count = - original_ref_count; - - acpi_ut_remove_reference(original_element); - } - - element_ptr++; - } - - return (AE_OK); -} - -/****************************************************************************** - * - * FUNCTION: acpi_ns_repair_HID - * - * PARAMETERS: Data - Pointer to validation data structure - * return_object_ptr - Pointer to the object returned from the - * evaluation of a method or object - * - * RETURN: Status. AE_OK if object is OK or was repaired successfully - * - * DESCRIPTION: Repair for the _HID object. If a string, ensure that all - * letters are uppercase and that there is no leading asterisk. - * - *****************************************************************************/ - -static acpi_status -acpi_ns_repair_HID(struct acpi_predefined_data *data, - union acpi_operand_object **return_object_ptr) -{ - union acpi_operand_object *return_object = *return_object_ptr; - union acpi_operand_object *new_string; - char *source; - char *dest; - - ACPI_FUNCTION_NAME(ns_repair_HID); - - /* We only care about string _HID objects (not integers) */ - - if (return_object->common.type != ACPI_TYPE_STRING) { - return (AE_OK); - } - - if (return_object->string.length == 0) { - ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, - "Invalid zero-length _HID or _CID string")); - - /* Return AE_OK anyway, let driver handle it */ - - data->flags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); - } - - /* It is simplest to always create a new string object */ - - new_string = acpi_ut_create_string_object(return_object->string.length); - if (!new_string) { - return (AE_NO_MEMORY); - } - - /* - * Remove a leading asterisk if present. For some unknown reason, there - * are many machines in the field that contains IDs like this. - * - * Examples: "*PNP0C03", "*ACPI0003" - */ - source = return_object->string.pointer; - if (*source == '*') { - source++; - new_string->string.length--; - - ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, - "%s: Removed invalid leading asterisk\n", - data->pathname)); - } - - /* - * Copy and uppercase the string. From the ACPI specification: - * - * A valid PNP ID must be of the form "AAA####" where A is an uppercase - * letter and # is a hex digit. A valid ACPI ID must be of the form - * "ACPI####" where # is a hex digit. - */ - for (dest = new_string->string.pointer; *source; dest++, source++) { - *dest = (char)ACPI_TOUPPER(*source); - } - - acpi_ut_remove_reference(return_object); - *return_object_ptr = new_string; - return (AE_OK); -} - /****************************************************************************** * * FUNCTION: acpi_ns_repair_TSS diff --git a/trunk/drivers/acpi/acpica/nsutils.c b/trunk/drivers/acpi/acpica/nsutils.c index a7d6ad9c111b..e1add3491b04 100644 --- a/trunk/drivers/acpi/acpica/nsutils.c +++ b/trunk/drivers/acpi/acpica/nsutils.c @@ -58,6 +58,104 @@ static u8 acpi_ns_valid_path_separator(char sep); acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); #endif +/******************************************************************************* + * + * FUNCTION: acpi_ns_report_error + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * internal_name - Name or path of the namespace node + * lookup_status - Exception code from NS lookup + * + * RETURN: None + * + * DESCRIPTION: Print warning message with full pathname + * + ******************************************************************************/ + +void +acpi_ns_report_error(const char *module_name, + u32 line_number, + const char *internal_name, acpi_status lookup_status) +{ + acpi_status status; + u32 bad_name; + char *name = NULL; + + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + + if (lookup_status == AE_BAD_CHARACTER) { + + /* There is a non-ascii character in the name */ + + ACPI_MOVE_32_TO_32(&bad_name, + ACPI_CAST_PTR(u32, internal_name)); + acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); + } else { + /* Convert path to external format */ + + status = acpi_ns_externalize_name(ACPI_UINT32_MAX, + internal_name, NULL, &name); + + /* Print target name */ + + if (ACPI_SUCCESS(status)) { + acpi_os_printf("[%s]", name); + } else { + acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); + } + + if (name) { + ACPI_FREE(name); + } + } + + acpi_os_printf(" Namespace lookup failure, %s\n", + acpi_format_exception(lookup_status)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ns_report_method_error + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * Message - Error message to use on failure + * prefix_node - Prefix relative to the path + * Path - Path to the node (optional) + * method_status - Execution status + * + * RETURN: None + * + * DESCRIPTION: Print warning message with full pathname + * + ******************************************************************************/ + +void +acpi_ns_report_method_error(const char *module_name, + u32 line_number, + const char *message, + struct acpi_namespace_node *prefix_node, + const char *path, acpi_status method_status) +{ + acpi_status status; + struct acpi_namespace_node *node = prefix_node; + + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + + if (path) { + status = + acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, + &node); + if (ACPI_FAILURE(status)) { + acpi_os_printf("[Could not get node by pathname]"); + } + } + + acpi_ns_print_node_pathname(node, message); + acpi_os_printf(", %s\n", acpi_format_exception(method_status)); +} + /******************************************************************************* * * FUNCTION: acpi_ns_print_node_pathname diff --git a/trunk/drivers/acpi/acpica/tbfadt.c b/trunk/drivers/acpi/acpica/tbfadt.c index d2ff4325c427..1728cb9bf600 100644 --- a/trunk/drivers/acpi/acpica/tbfadt.c +++ b/trunk/drivers/acpi/acpica/tbfadt.c @@ -49,7 +49,7 @@ ACPI_MODULE_NAME("tbfadt") /* Local prototypes */ -static ACPI_INLINE void +static inline void acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 space_id, u8 byte_width, u64 address); @@ -181,7 +181,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { * ******************************************************************************/ -static ACPI_INLINE void +static inline void acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, u8 space_id, u8 byte_width, u64 address) { diff --git a/trunk/drivers/acpi/acpica/utdebug.c b/trunk/drivers/acpi/acpica/utdebug.c index f21c486929a5..983510640059 100644 --- a/trunk/drivers/acpi/acpica/utdebug.c +++ b/trunk/drivers/acpi/acpica/utdebug.c @@ -179,8 +179,9 @@ acpi_debug_print(u32 requested_debug_level, if (thread_id != acpi_gbl_prev_thread_id) { if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf - ("\n**** Context Switch from TID %u to TID %u ****\n\n", - (u32)acpi_gbl_prev_thread_id, (u32)thread_id); + ("\n**** Context Switch from TID %p to TID %p ****\n\n", + ACPI_CAST_PTR(void, acpi_gbl_prev_thread_id), + ACPI_CAST_PTR(void, thread_id)); } acpi_gbl_prev_thread_id = thread_id; @@ -193,7 +194,7 @@ acpi_debug_print(u32 requested_debug_level, acpi_os_printf("%8s-%04ld ", module_name, line_number); if (ACPI_LV_THREADS & acpi_dbg_level) { - acpi_os_printf("[%u] ", (u32)thread_id); + acpi_os_printf("[%p] ", ACPI_CAST_PTR(void, thread_id)); } acpi_os_printf("[%02ld] %-22.22s: ", diff --git a/trunk/drivers/acpi/acpica/uteval.c b/trunk/drivers/acpi/acpica/uteval.c index 22f59ef604e0..6dfdeb653490 100644 --- a/trunk/drivers/acpi/acpica/uteval.c +++ b/trunk/drivers/acpi/acpica/uteval.c @@ -48,6 +48,153 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("uteval") +/* + * Strings supported by the _OSI predefined (internal) method. + * + * March 2009: Removed "Linux" as this host no longer wants to respond true + * for this string. Basically, the only safe OS strings are windows-related + * and in many or most cases represent the only test path within the + * BIOS-provided ASL code. + * + * The second element of each entry is used to track the newest version of + * Windows that the BIOS has requested. + */ +static struct acpi_interface_info acpi_interfaces_supported[] = { + /* Operating System Vendor Strings */ + + {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ + {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ + {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ + {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ + {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ + {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ + {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ + {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ + {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ + {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ + + /* Feature Group Strings */ + + {"Extended Address Space Descriptor", 0} + + /* + * All "optional" feature group strings (features that are implemented + * by the host) should be implemented in the host version of + * acpi_os_validate_interface and should not be added here. + */ +}; + +/******************************************************************************* + * + * FUNCTION: acpi_ut_osi_implementation + * + * PARAMETERS: walk_state - Current walk state + * + * RETURN: Status + * + * DESCRIPTION: Implementation of the _OSI predefined control method + * + ******************************************************************************/ + +acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) +{ + acpi_status status; + union acpi_operand_object *string_desc; + union acpi_operand_object *return_desc; + u32 return_value; + u32 i; + + ACPI_FUNCTION_TRACE(ut_osi_implementation); + + /* Validate the string input argument */ + + string_desc = walk_state->arguments[0].object; + if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { + return_ACPI_STATUS(AE_TYPE); + } + + /* Create a return object */ + + return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); + if (!return_desc) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* Default return value is 0, NOT SUPPORTED */ + + return_value = 0; + + /* Compare input string to static table of supported interfaces */ + + for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { + if (!ACPI_STRCMP(string_desc->string.pointer, + acpi_interfaces_supported[i].name)) { + /* + * The interface is supported. + * Update the osi_data if necessary. We keep track of the latest + * version of Windows that has been requested by the BIOS. + */ + if (acpi_interfaces_supported[i].value > + acpi_gbl_osi_data) { + acpi_gbl_osi_data = + acpi_interfaces_supported[i].value; + } + + return_value = ACPI_UINT32_MAX; + goto exit; + } + } + + /* + * Did not match the string in the static table, call the host OSL to + * check for a match with one of the optional strings (such as + * "Module Device", "3.0 Thermal Model", etc.) + */ + status = acpi_os_validate_interface(string_desc->string.pointer); + if (ACPI_SUCCESS(status)) { + + /* The interface is supported */ + + return_value = ACPI_UINT32_MAX; + } + +exit: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, + "ACPI: BIOS _OSI(%s) is %ssupported\n", + string_desc->string.pointer, return_value == 0 ? "not " : "")); + + /* Complete the return value */ + + return_desc->integer.value = return_value; + walk_state->return_desc = return_desc; + return_ACPI_STATUS (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_osi_invalidate + * + * PARAMETERS: interface_string + * + * RETURN: Status + * + * DESCRIPTION: invalidate string in pre-defiend _OSI string list + * + ******************************************************************************/ + +acpi_status acpi_osi_invalidate(char *interface) +{ + int i; + + for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { + if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i].name)) { + *acpi_interfaces_supported[i].name = '\0'; + return AE_OK; + } + } + return AE_NOT_FOUND; +} + /******************************************************************************* * * FUNCTION: acpi_ut_evaluate_object diff --git a/trunk/drivers/acpi/acpica/utglobal.c b/trunk/drivers/acpi/acpica/utglobal.c index 4a5dcaa268de..0558747579ef 100644 --- a/trunk/drivers/acpi/acpica/utglobal.c +++ b/trunk/drivers/acpi/acpica/utglobal.c @@ -154,16 +154,14 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception) * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run * during the initialization sequence. * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to - * perform a Notify() operation on it. 09/2010: Changed to type Device. - * This still allows notifies, but does not confuse host code that - * searches for valid thermal_zone objects. + * perform a Notify() operation on it. */ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_SB_", ACPI_TYPE_DEVICE, NULL}, {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_DEVICE, NULL}, + {"_TZ_", ACPI_TYPE_THERMAL, NULL}, {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, @@ -776,7 +774,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_exception_handler = NULL; acpi_gbl_init_handler = NULL; acpi_gbl_table_handler = NULL; - acpi_gbl_interface_handler = NULL; /* Global Lock support */ @@ -803,7 +800,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; acpi_gbl_osi_data = 0; - acpi_gbl_osi_mutex = NULL; /* Hardware oriented */ diff --git a/trunk/drivers/acpi/acpica/utids.c b/trunk/drivers/acpi/acpica/utids.c index d2906328535d..1397fadd0d4b 100644 --- a/trunk/drivers/acpi/acpica/utids.c +++ b/trunk/drivers/acpi/acpica/utids.c @@ -48,6 +48,42 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utids") +/* Local prototypes */ +static void acpi_ut_copy_id_string(char *destination, char *source); + +/******************************************************************************* + * + * FUNCTION: acpi_ut_copy_id_string + * + * PARAMETERS: Destination - Where to copy the string + * Source - Source string + * + * RETURN: None + * + * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. + * Performs removal of a leading asterisk if present -- workaround + * for a known issue on a bunch of machines. + * + ******************************************************************************/ + +static void acpi_ut_copy_id_string(char *destination, char *source) +{ + + /* + * Workaround for ID strings that have a leading asterisk. This construct + * is not allowed by the ACPI specification (ID strings must be + * alphanumeric), but enough existing machines have this embedded in their + * ID strings that the following code is useful. + */ + if (*source == '*') { + source++; + } + + /* Do the actual copy */ + + ACPI_STRCPY(destination, source); +} + /******************************************************************************* * * FUNCTION: acpi_ut_execute_HID @@ -65,6 +101,7 @@ ACPI_MODULE_NAME("utids") * NOTE: Internal function, no parameter validation * ******************************************************************************/ + acpi_status acpi_ut_execute_HID(struct acpi_namespace_node *device_node, struct acpica_device_id **return_id) @@ -110,7 +147,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, if (obj_desc->common.type == ACPI_TYPE_INTEGER) { acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); } else { - ACPI_STRCPY(hid->string, obj_desc->string.pointer); + acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer); } hid->length = length; @@ -187,7 +224,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, if (obj_desc->common.type == ACPI_TYPE_INTEGER) { acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); } else { - ACPI_STRCPY(uid->string, obj_desc->string.pointer); + acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer); } uid->length = length; @@ -320,8 +357,8 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node, /* Copy the String CID from the returned object */ - ACPI_STRCPY(next_id_string, - cid_objects[i]->string.pointer); + acpi_ut_copy_id_string(next_id_string, + cid_objects[i]->string.pointer); length = cid_objects[i]->string.length + 1; } diff --git a/trunk/drivers/acpi/acpica/utinit.c b/trunk/drivers/acpi/acpica/utinit.c index c1b1c803ea9b..a39c93dac719 100644 --- a/trunk/drivers/acpi/acpica/utinit.c +++ b/trunk/drivers/acpi/acpica/utinit.c @@ -117,10 +117,6 @@ void acpi_ut_subsystem_shutdown(void) /* Close the acpi_event Handling */ acpi_ev_terminate(); - - /* Delete any dynamic _OSI interfaces */ - - acpi_ut_interface_terminate(); #endif /* Close the Namespace */ diff --git a/trunk/drivers/acpi/acpica/utmath.c b/trunk/drivers/acpi/acpica/utmath.c index 49cf7b7fd816..35059a14eb72 100644 --- a/trunk/drivers/acpi/acpica/utmath.c +++ b/trunk/drivers/acpi/acpica/utmath.c @@ -48,27 +48,11 @@ ACPI_MODULE_NAME("utmath") /* - * Optional support for 64-bit double-precision integer divide. This code - * is configurable and is implemented in order to support 32-bit kernel - * environments where a 64-bit double-precision math library is not available. - * - * Support for a more normal 64-bit divide/modulo (with check for a divide- - * by-zero) appears after this optional section of code. + * Support for double-precision integer divide. This code is included here + * in order to support kernel environments where the double-precision math + * library is not available. */ #ifndef ACPI_USE_NATIVE_DIVIDE -/* Structures used only for 64-bit divide */ -typedef struct uint64_struct { - u32 lo; - u32 hi; - -} uint64_struct; - -typedef union uint64_overlay { - u64 full; - struct uint64_struct part; - -} uint64_overlay; - /******************************************************************************* * * FUNCTION: acpi_ut_short_divide @@ -85,7 +69,6 @@ typedef union uint64_overlay { * 32-bit remainder. * ******************************************************************************/ - acpi_status acpi_ut_short_divide(u64 dividend, u32 divisor, u64 *out_quotient, u32 *out_remainder) diff --git a/trunk/drivers/acpi/acpica/utmisc.c b/trunk/drivers/acpi/acpica/utmisc.c index c7d0e05ef5a4..e8d0724ee403 100644 --- a/trunk/drivers/acpi/acpica/utmisc.c +++ b/trunk/drivers/acpi/acpica/utmisc.c @@ -50,6 +50,11 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") +/* + * Common suffix for messages + */ +#define ACPI_COMMON_MSG_SUFFIX \ + acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) /******************************************************************************* * * FUNCTION: acpi_ut_validate_exception @@ -1039,3 +1044,160 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, return_ACPI_STATUS(AE_AML_INTERNAL); } + +/******************************************************************************* + * + * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Print message with module/line/version info + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +acpi_error(const char *module_name, u32 line_number, const char *format, ...) +{ + va_list args; + + acpi_os_printf("ACPI Error: "); + + va_start(args, format); + acpi_os_vprintf(format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end(args); +} + +void ACPI_INTERNAL_VAR_XFACE +acpi_exception(const char *module_name, + u32 line_number, acpi_status status, const char *format, ...) +{ + va_list args; + + acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); + + va_start(args, format); + acpi_os_vprintf(format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end(args); +} + +void ACPI_INTERNAL_VAR_XFACE +acpi_warning(const char *module_name, u32 line_number, const char *format, ...) +{ + va_list args; + + acpi_os_printf("ACPI Warning: "); + + va_start(args, format); + acpi_os_vprintf(format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end(args); +} + +void ACPI_INTERNAL_VAR_XFACE +acpi_info(const char *module_name, u32 line_number, const char *format, ...) +{ + va_list args; + + acpi_os_printf("ACPI: "); + + va_start(args, format); + acpi_os_vprintf(format, args); + 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) + +/******************************************************************************* + * + * FUNCTION: acpi_ut_predefined_warning + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * Pathname - Full pathname to the node + * node_flags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Warnings for the predefined validation module. Messages are + * only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of error + * messages for methods that are repeatedly evaluated. + * +******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_predefined_warning(const char *module_name, + u32 line_number, + char *pathname, + u8 node_flags, const char *format, ...) +{ + va_list args; + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (node_flags & ANOBJ_EVALUATED) { + return; + } + + acpi_os_printf("ACPI Warning for %s: ", pathname); + + va_start(args, format); + acpi_os_vprintf(format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end(args); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_predefined_info + * + * PARAMETERS: module_name - Caller's module name (for error output) + * line_number - Caller's line number (for error output) + * Pathname - Full pathname to the node + * node_flags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Info messages for the predefined validation module. Messages + * are only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +acpi_ut_predefined_info(const char *module_name, + u32 line_number, + char *pathname, u8 node_flags, const char *format, ...) +{ + va_list args; + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (node_flags & ANOBJ_EVALUATED) { + return; + } + + acpi_os_printf("ACPI Info for %s: ", pathname); + + va_start(args, format); + acpi_os_vprintf(format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end(args); +} diff --git a/trunk/drivers/acpi/acpica/utmutex.c b/trunk/drivers/acpi/acpica/utmutex.c index d9efa495b433..f5cca3a1300c 100644 --- a/trunk/drivers/acpi/acpica/utmutex.c +++ b/trunk/drivers/acpi/acpica/utmutex.c @@ -86,12 +86,6 @@ acpi_status acpi_ut_mutex_initialize(void) spin_lock_init(acpi_gbl_gpe_lock); spin_lock_init(acpi_gbl_hardware_lock); - /* Mutex for _OSI support */ - status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - /* Create the reader/writer lock for namespace access */ status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); @@ -123,8 +117,6 @@ void acpi_ut_mutex_terminate(void) acpi_ut_delete_mutex(i); } - acpi_os_delete_mutex(acpi_gbl_osi_mutex); - /* Delete the spinlocks */ acpi_os_delete_lock(acpi_gbl_gpe_lock); @@ -228,17 +220,18 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_ERROR((AE_INFO, - "Mutex [%s] already acquired by this thread [%u]", + "Mutex [%s] already acquired by this thread [%p]", acpi_ut_get_mutex_name (mutex_id), - (u32)this_thread_id)); + ACPI_CAST_PTR(void, + this_thread_id))); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR((AE_INFO, - "Invalid acquire order: Thread %u owns [%s], wants [%s]", - (u32)this_thread_id, + "Invalid acquire order: Thread %p owns [%s], wants [%s]", + ACPI_CAST_PTR(void, this_thread_id), acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); @@ -249,24 +242,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) #endif ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Thread %u attempting to acquire Mutex [%s]\n", - (u32)this_thread_id, + "Thread %p attempting to acquire Mutex [%s]\n", + ACPI_CAST_PTR(void, this_thread_id), acpi_ut_get_mutex_name(mutex_id))); status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Thread %u acquired Mutex [%s]\n", - (u32)this_thread_id, + "Thread %p acquired Mutex [%s]\n", + ACPI_CAST_PTR(void, this_thread_id), acpi_ut_get_mutex_name(mutex_id))); acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { ACPI_EXCEPTION((AE_INFO, status, - "Thread %u could not acquire Mutex [0x%X]", - (u32)this_thread_id, mutex_id)); + "Thread %p could not acquire Mutex [0x%X]", + ACPI_CAST_PTR(void, this_thread_id), mutex_id)); } return (status); @@ -286,14 +279,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { - acpi_thread_id this_thread_id; - ACPI_FUNCTION_NAME(ut_release_mutex); - this_thread_id = acpi_os_get_thread_id(); - - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", - (u32)this_thread_id, + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", + ACPI_CAST_PTR(void, acpi_os_get_thread_id()), acpi_ut_get_mutex_name(mutex_id))); if (mutex_id > ACPI_MAX_MUTEX) { diff --git a/trunk/drivers/acpi/acpica/utosi.c b/trunk/drivers/acpi/acpica/utosi.c deleted file mode 100644 index 18c59a85fdca..000000000000 --- a/trunk/drivers/acpi/acpica/utosi.c +++ /dev/null @@ -1,380 +0,0 @@ -/****************************************************************************** - * - * Module Name: utosi - Support for the _OSI predefined control method - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 - 2010, 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" - -#define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utosi") - -/* - * Strings supported by the _OSI predefined control method (which is - * implemented internally within this module.) - * - * March 2009: Removed "Linux" as this host no longer wants to respond true - * for this string. Basically, the only safe OS strings are windows-related - * and in many or most cases represent the only test path within the - * BIOS-provided ASL code. - * - * The last element of each entry is used to track the newest version of - * Windows that the BIOS has requested. - */ -static struct acpi_interface_info acpi_default_supported_interfaces[] = { - /* Operating System Vendor Strings */ - - {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ - {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ - {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ - {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ - {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ - {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ - {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ - {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ - {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ - {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ - {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ - - /* Feature Group Strings */ - - {"Extended Address Space Descriptor", NULL, 0, 0} - - /* - * All "optional" feature group strings (features that are implemented - * by the host) should be dynamically added by the host via - * acpi_install_interface and should not be manually added here. - * - * Examples of optional feature group strings: - * - * "Module Device" - * "Processor Device" - * "3.0 Thermal Model" - * "3.0 _SCP Extensions" - * "Processor Aggregator Device" - */ -}; - -/******************************************************************************* - * - * FUNCTION: acpi_ut_initialize_interfaces - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize the global _OSI supported interfaces list - * - ******************************************************************************/ - -acpi_status acpi_ut_initialize_interfaces(void) -{ - u32 i; - - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; - - /* Link the static list of supported interfaces */ - - for (i = 0; - i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1); - i++) { - acpi_default_supported_interfaces[i].next = - &acpi_default_supported_interfaces[(acpi_size) i + 1]; - } - - acpi_os_release_mutex(acpi_gbl_osi_mutex); - return (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_interface_terminate - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all interfaces in the global list. Sets - * acpi_gbl_supported_interfaces to NULL. - * - ******************************************************************************/ - -void acpi_ut_interface_terminate(void) -{ - struct acpi_interface_info *next_interface; - - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - next_interface = acpi_gbl_supported_interfaces; - - while (next_interface) { - acpi_gbl_supported_interfaces = next_interface->next; - - /* Only interfaces added at runtime can be freed */ - - if (next_interface->flags & ACPI_OSI_DYNAMIC) { - ACPI_FREE(next_interface->name); - ACPI_FREE(next_interface); - } - - next_interface = acpi_gbl_supported_interfaces; - } - - acpi_os_release_mutex(acpi_gbl_osi_mutex); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_install_interface - * - * PARAMETERS: interface_name - The interface to install - * - * RETURN: Status - * - * DESCRIPTION: Install the interface into the global interface list. - * Caller MUST hold acpi_gbl_osi_mutex - * - ******************************************************************************/ - -acpi_status acpi_ut_install_interface(acpi_string interface_name) -{ - struct acpi_interface_info *interface_info; - - /* Allocate info block and space for the name string */ - - interface_info = - ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info)); - if (!interface_info) { - return (AE_NO_MEMORY); - } - - interface_info->name = - ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1); - if (!interface_info->name) { - ACPI_FREE(interface_info); - return (AE_NO_MEMORY); - } - - /* Initialize new info and insert at the head of the global list */ - - ACPI_STRCPY(interface_info->name, interface_name); - interface_info->flags = ACPI_OSI_DYNAMIC; - interface_info->next = acpi_gbl_supported_interfaces; - - acpi_gbl_supported_interfaces = interface_info; - return (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_remove_interface - * - * PARAMETERS: interface_name - The interface to remove - * - * RETURN: Status - * - * DESCRIPTION: Remove the interface from the global interface list. - * Caller MUST hold acpi_gbl_osi_mutex - * - ******************************************************************************/ - -acpi_status acpi_ut_remove_interface(acpi_string interface_name) -{ - struct acpi_interface_info *previous_interface; - struct acpi_interface_info *next_interface; - - previous_interface = next_interface = acpi_gbl_supported_interfaces; - while (next_interface) { - if (!ACPI_STRCMP(interface_name, next_interface->name)) { - - /* Found: name is in either the static list or was added at runtime */ - - if (next_interface->flags & ACPI_OSI_DYNAMIC) { - - /* Interface was added dynamically, remove and free it */ - - if (previous_interface == next_interface) { - acpi_gbl_supported_interfaces = - next_interface->next; - } else { - previous_interface->next = - next_interface->next; - } - - ACPI_FREE(next_interface->name); - ACPI_FREE(next_interface); - } else { - /* - * Interface is in static list. If marked invalid, then it - * does not actually exist. Else, mark it invalid. - */ - if (next_interface->flags & ACPI_OSI_INVALID) { - return (AE_NOT_EXIST); - } - - next_interface->flags |= ACPI_OSI_INVALID; - } - - return (AE_OK); - } - - previous_interface = next_interface; - next_interface = next_interface->next; - } - - /* Interface was not found */ - - return (AE_NOT_EXIST); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_interface - * - * PARAMETERS: interface_name - The interface to find - * - * RETURN: struct acpi_interface_info if found. NULL if not found. - * - * DESCRIPTION: Search for the specified interface name in the global list. - * Caller MUST hold acpi_gbl_osi_mutex - * - ******************************************************************************/ - -struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name) -{ - struct acpi_interface_info *next_interface; - - next_interface = acpi_gbl_supported_interfaces; - while (next_interface) { - if (!ACPI_STRCMP(interface_name, next_interface->name)) { - return (next_interface); - } - - next_interface = next_interface->next; - } - - return (NULL); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_osi_implementation - * - * PARAMETERS: walk_state - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Implementation of the _OSI predefined control method. When - * an invocation of _OSI is encountered in the system AML, - * control is transferred to this function. - * - ******************************************************************************/ - -acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) -{ - union acpi_operand_object *string_desc; - union acpi_operand_object *return_desc; - struct acpi_interface_info *interface_info; - acpi_interface_handler interface_handler; - u32 return_value; - - ACPI_FUNCTION_TRACE(ut_osi_implementation); - - /* Validate the string input argument (from the AML caller) */ - - string_desc = walk_state->arguments[0].object; - if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { - return_ACPI_STATUS(AE_TYPE); - } - - /* Create a return object */ - - return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); - if (!return_desc) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* Default return value is 0, NOT SUPPORTED */ - - return_value = 0; - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - - /* Lookup the interface in the global _OSI list */ - - interface_info = acpi_ut_get_interface(string_desc->string.pointer); - if (interface_info && !(interface_info->flags & ACPI_OSI_INVALID)) { - /* - * The interface is supported. - * Update the osi_data if necessary. We keep track of the latest - * version of Windows that has been requested by the BIOS. - */ - if (interface_info->value > acpi_gbl_osi_data) { - acpi_gbl_osi_data = interface_info->value; - } - - return_value = ACPI_UINT32_MAX; - } - - acpi_os_release_mutex(acpi_gbl_osi_mutex); - - /* - * Invoke an optional _OSI interface handler. The host OS may wish - * to do some interface-specific handling. For example, warn about - * certain interfaces or override the true/false support value. - */ - interface_handler = acpi_gbl_interface_handler; - if (interface_handler) { - return_value = - interface_handler(string_desc->string.pointer, - return_value); - } - - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, - "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", - string_desc->string.pointer, - return_value == 0 ? "not " : "")); - - /* Complete the return object */ - - return_desc->integer.value = return_value; - walk_state->return_desc = return_desc; - return_ACPI_STATUS(AE_OK); -} diff --git a/trunk/drivers/acpi/acpica/utxface.c b/trunk/drivers/acpi/acpica/utxface.c index c2da90f5fbe9..7f8cefcb2b32 100644 --- a/trunk/drivers/acpi/acpica/utxface.c +++ b/trunk/drivers/acpi/acpica/utxface.c @@ -110,15 +110,6 @@ acpi_status __init acpi_initialize_subsystem(void) return_ACPI_STATUS(status); } - /* Initialize the global OSI interfaces list with the static names */ - - status = acpi_ut_initialize_interfaces(); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "During OSI interfaces initialization")); - return_ACPI_STATUS(status); - } - /* If configured, initialize the AML debugger */ ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); @@ -515,7 +506,6 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) #endif /* ACPI_FUTURE_USAGE */ - /***************************************************************************** * * FUNCTION: acpi_purge_cached_objects @@ -539,117 +529,4 @@ acpi_status acpi_purge_cached_objects(void) } ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) - -/***************************************************************************** - * - * FUNCTION: acpi_install_interface - * - * PARAMETERS: interface_name - The interface to install - * - * RETURN: Status - * - * DESCRIPTION: Install an _OSI interface to the global list - * - ****************************************************************************/ -acpi_status acpi_install_interface(acpi_string interface_name) -{ - acpi_status status; - struct acpi_interface_info *interface_info; - - /* Parameter validation */ - - if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { - return (AE_BAD_PARAMETER); - } - - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - - /* Check if the interface name is already in the global list */ - - interface_info = acpi_ut_get_interface(interface_name); - if (interface_info) { - /* - * The interface already exists in the list. This is OK if the - * interface has been marked invalid -- just clear the bit. - */ - if (interface_info->flags & ACPI_OSI_INVALID) { - interface_info->flags &= ~ACPI_OSI_INVALID; - status = AE_OK; - } else { - status = AE_ALREADY_EXISTS; - } - } else { - /* New interface name, install into the global list */ - - status = acpi_ut_install_interface(interface_name); - } - - acpi_os_release_mutex(acpi_gbl_osi_mutex); - return (status); -} - -ACPI_EXPORT_SYMBOL(acpi_install_interface) - -/***************************************************************************** - * - * FUNCTION: acpi_remove_interface - * - * PARAMETERS: interface_name - The interface to remove - * - * RETURN: Status - * - * DESCRIPTION: Remove an _OSI interface from the global list - * - ****************************************************************************/ -acpi_status acpi_remove_interface(acpi_string interface_name) -{ - acpi_status status; - - /* Parameter validation */ - - if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { - return (AE_BAD_PARAMETER); - } - - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - - status = acpi_ut_remove_interface(interface_name); - - acpi_os_release_mutex(acpi_gbl_osi_mutex); - return (status); -} - -ACPI_EXPORT_SYMBOL(acpi_remove_interface) - -/***************************************************************************** - * - * FUNCTION: acpi_install_interface_handler - * - * PARAMETERS: Handler - The _OSI interface handler to install - * NULL means "remove existing handler" - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. - * invoked during execution of the internal implementation of - * _OSI. A NULL handler simply removes any existing handler. - * - ****************************************************************************/ -acpi_status acpi_install_interface_handler(acpi_interface_handler handler) -{ - acpi_status status = AE_OK; - - (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); - - if (handler && acpi_gbl_interface_handler) { - status = AE_ALREADY_EXISTS; - } else { - acpi_gbl_interface_handler = handler; - } - - acpi_os_release_mutex(acpi_gbl_osi_mutex); - return (status); -} - -ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) -#endif /* !ACPI_ASL_COMPILER */ +#endif diff --git a/trunk/drivers/acpi/acpica/utxferror.c b/trunk/drivers/acpi/acpica/utxferror.c deleted file mode 100644 index 6f12e314fbae..000000000000 --- a/trunk/drivers/acpi/acpica/utxferror.c +++ /dev/null @@ -1,415 +0,0 @@ -/******************************************************************************* - * - * Module Name: utxferror - Various error/warning output functions - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2010, 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" - -#define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utxferror") - -/* - * This module is used for the in-kernel ACPICA as well as the ACPICA - * tools/applications. - * - * For the i_aSL compiler case, the output is redirected to stderr so that - * any of the various ACPI errors and warnings do not appear in the output - * files, for either the compiler or disassembler portions of the tool. - */ -#ifdef ACPI_ASL_COMPILER -#include -extern FILE *acpi_gbl_output_file; - -#define ACPI_MSG_REDIRECT_BEGIN \ - FILE *output_file = acpi_gbl_output_file; \ - acpi_os_redirect_output (stderr); - -#define ACPI_MSG_REDIRECT_END \ - acpi_os_redirect_output (output_file); - -#else -/* - * non-i_aSL case - no redirection, nothing to do - */ -#define ACPI_MSG_REDIRECT_BEGIN -#define ACPI_MSG_REDIRECT_END -#endif -/* - * Common message prefixes - */ -#define ACPI_MSG_ERROR "ACPI Error: " -#define ACPI_MSG_EXCEPTION "ACPI Exception: " -#define ACPI_MSG_WARNING "ACPI Warning: " -#define ACPI_MSG_INFO "ACPI: " -/* - * Common message suffix - */ -#define ACPI_MSG_SUFFIX \ - acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) -/******************************************************************************* - * - * FUNCTION: acpi_error - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Error" message with module/line/version info - * - ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_error(const char *module_name, u32 line_number, const char *format, ...) -{ - va_list arg_list; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_ERROR); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - ACPI_MSG_SUFFIX; - va_end(arg_list); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL(acpi_error) - -/******************************************************************************* - * - * FUNCTION: acpi_exception - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Status - Status to be formatted - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Exception" message with module/line/version info - * and decoded acpi_status. - * - ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_exception(const char *module_name, - u32 line_number, acpi_status status, const char *format, ...) -{ - va_list arg_list; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", - acpi_format_exception(status)); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - ACPI_MSG_SUFFIX; - va_end(arg_list); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL(acpi_exception) - -/******************************************************************************* - * - * FUNCTION: acpi_warning - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print "ACPI Warning" message with module/line/version info - * - ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_warning(const char *module_name, u32 line_number, const char *format, ...) -{ - va_list arg_list; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_WARNING); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - ACPI_MSG_SUFFIX; - va_end(arg_list); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL(acpi_warning) - -/******************************************************************************* - * - * FUNCTION: acpi_info - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Print generic "ACPI:" information message. There is no - * module/line/version info in order to keep the message simple. - * - * TBD: module_name and line_number args are not needed, should be removed. - * - ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_info(const char *module_name, u32 line_number, const char *format, ...) -{ - va_list arg_list; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_INFO); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - acpi_os_printf("\n"); - va_end(arg_list); - - ACPI_MSG_REDIRECT_END; -} - -ACPI_EXPORT_SYMBOL(acpi_info) - -/* - * The remainder of this module contains internal error functions that may - * be configured out. - */ -#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) -/******************************************************************************* - * - * FUNCTION: acpi_ut_predefined_warning - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Pathname - Full pathname to the node - * node_flags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Warnings for the predefined validation module. Messages are - * only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of error - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_predefined_warning(const char *module_name, - u32 line_number, - char *pathname, - u8 node_flags, const char *format, ...) -{ - va_list arg_list; - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (node_flags & ANOBJ_EVALUATED) { - return; - } - - acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - ACPI_MSG_SUFFIX; - va_end(arg_list); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_predefined_info - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Pathname - Full pathname to the node - * node_flags - From Namespace node for the method/object - * Format - Printf format string + additional args - * - * RETURN: None - * - * DESCRIPTION: Info messages for the predefined validation module. Messages - * are only emitted the first time a problem with a particular - * method/object is detected. This prevents a flood of - * messages for methods that are repeatedly evaluated. - * - ******************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_predefined_info(const char *module_name, - u32 line_number, - char *pathname, u8 node_flags, const char *format, ...) -{ - va_list arg_list; - - /* - * Warning messages for this method/object will be disabled after the - * first time a validation fails or an object is successfully repaired. - */ - if (node_flags & ANOBJ_EVALUATED) { - return; - } - - acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname); - - va_start(arg_list, format); - acpi_os_vprintf(format, arg_list); - ACPI_MSG_SUFFIX; - va_end(arg_list); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_namespace_error - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * internal_name - Name or path of the namespace node - * lookup_status - Exception code from NS lookup - * - * RETURN: None - * - * DESCRIPTION: Print error message with the full pathname for the NS node. - * - ******************************************************************************/ - -void -acpi_ut_namespace_error(const char *module_name, - u32 line_number, - const char *internal_name, acpi_status lookup_status) -{ - acpi_status status; - u32 bad_name; - char *name = NULL; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_ERROR); - - if (lookup_status == AE_BAD_CHARACTER) { - - /* There is a non-ascii character in the name */ - - ACPI_MOVE_32_TO_32(&bad_name, - ACPI_CAST_PTR(u32, internal_name)); - acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); - } else { - /* Convert path to external format */ - - status = acpi_ns_externalize_name(ACPI_UINT32_MAX, - internal_name, NULL, &name); - - /* Print target name */ - - if (ACPI_SUCCESS(status)) { - acpi_os_printf("[%s]", name); - } else { - acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); - } - - if (name) { - ACPI_FREE(name); - } - } - - acpi_os_printf(" Namespace lookup failure, %s", - acpi_format_exception(lookup_status)); - - ACPI_MSG_SUFFIX; - ACPI_MSG_REDIRECT_END; -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_method_error - * - * PARAMETERS: module_name - Caller's module name (for error output) - * line_number - Caller's line number (for error output) - * Message - Error message to use on failure - * prefix_node - Prefix relative to the path - * Path - Path to the node (optional) - * method_status - Execution status - * - * RETURN: None - * - * DESCRIPTION: Print error message with the full pathname for the method. - * - ******************************************************************************/ - -void -acpi_ut_method_error(const char *module_name, - u32 line_number, - const char *message, - struct acpi_namespace_node *prefix_node, - const char *path, acpi_status method_status) -{ - acpi_status status; - struct acpi_namespace_node *node = prefix_node; - - ACPI_MSG_REDIRECT_BEGIN; - acpi_os_printf(ACPI_MSG_ERROR); - - if (path) { - status = - acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, - &node); - if (ACPI_FAILURE(status)) { - acpi_os_printf("[Could not get node by pathname]"); - } - } - - acpi_ns_print_node_pathname(node, message); - acpi_os_printf(", %s", acpi_format_exception(method_status)); - - ACPI_MSG_SUFFIX; - ACPI_MSG_REDIRECT_END; -} - -#endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/trunk/drivers/acpi/battery.c b/trunk/drivers/acpi/battery.c index 7b8787b490f6..98417201e9ce 100644 --- a/trunk/drivers/acpi/battery.c +++ b/trunk/drivers/acpi/battery.c @@ -42,7 +42,10 @@ #include #include + +#ifdef CONFIG_ACPI_SYSFS_POWER #include +#endif #define PREFIX "ACPI: " @@ -99,7 +102,9 @@ enum { struct acpi_battery { struct mutex lock; +#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply bat; +#endif struct acpi_device *device; unsigned long update_time; int rate_now; @@ -136,6 +141,7 @@ inline int acpi_battery_present(struct acpi_battery *battery) return battery->device->status.battery_present; } +#ifdef CONFIG_ACPI_SYSFS_POWER static int acpi_battery_technology(struct acpi_battery *battery) { if (!strcasecmp("NiCd", battery->type)) @@ -275,6 +281,7 @@ static enum power_supply_property energy_battery_props[] = { POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, }; +#endif #ifdef CONFIG_ACPI_PROCFS_POWER inline char *acpi_battery_units(struct acpi_battery *battery) @@ -485,6 +492,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) return acpi_battery_set_alarm(battery); } +#ifdef CONFIG_ACPI_SYSFS_POWER static ssize_t acpi_battery_alarm_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -544,6 +552,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) power_supply_unregister(&battery->bat); battery->bat.dev = NULL; } +#endif static void acpi_battery_quirks(struct acpi_battery *battery) { @@ -559,7 +568,9 @@ static int acpi_battery_update(struct acpi_battery *battery) if (result) return result; if (!acpi_battery_present(battery)) { +#ifdef CONFIG_ACPI_SYSFS_POWER sysfs_remove_battery(battery); +#endif battery->update_time = 0; return 0; } @@ -571,8 +582,10 @@ static int acpi_battery_update(struct acpi_battery *battery) acpi_battery_quirks(battery); acpi_battery_init_alarm(battery); } +#ifdef CONFIG_ACPI_SYSFS_POWER if (!battery->bat.dev) sysfs_add_battery(battery); +#endif return acpi_battery_get_state(battery); } @@ -854,20 +867,26 @@ static void acpi_battery_remove_fs(struct acpi_device *device) static void acpi_battery_notify(struct acpi_device *device, u32 event) { struct acpi_battery *battery = acpi_driver_data(device); +#ifdef CONFIG_ACPI_SYSFS_POWER struct device *old; +#endif if (!battery) return; +#ifdef CONFIG_ACPI_SYSFS_POWER old = battery->bat.dev; +#endif acpi_battery_update(battery); acpi_bus_generate_proc_event(device, event, acpi_battery_present(battery)); acpi_bus_generate_netlink_event(device->pnp.device_class, dev_name(&device->dev), event, acpi_battery_present(battery)); +#ifdef CONFIG_ACPI_SYSFS_POWER /* acpi_battery_update could remove power_supply object */ if (old && battery->bat.dev) power_supply_changed(&battery->bat); +#endif } static int acpi_battery_add(struct acpi_device *device) @@ -915,7 +934,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type) #ifdef CONFIG_ACPI_PROCFS_POWER acpi_battery_remove_fs(device); #endif +#ifdef CONFIG_ACPI_SYSFS_POWER sysfs_remove_battery(battery); +#endif mutex_destroy(&battery->lock); kfree(battery); return 0; diff --git a/trunk/drivers/acpi/fan.c b/trunk/drivers/acpi/fan.c index 60049080c869..d94d2953c974 100644 --- a/trunk/drivers/acpi/fan.c +++ b/trunk/drivers/acpi/fan.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -116,6 +118,122 @@ static struct thermal_cooling_device_ops fan_cooling_ops = { .set_cur_state = fan_set_cur_state, }; +/* -------------------------------------------------------------------------- + FS Interface (/proc) + -------------------------------------------------------------------------- */ +#ifdef CONFIG_ACPI_PROCFS + +static struct proc_dir_entry *acpi_fan_dir; + +static int acpi_fan_read_state(struct seq_file *seq, void *offset) +{ + struct acpi_device *device = seq->private; + int state = 0; + + + if (device) { + if (acpi_bus_get_power(device->handle, &state)) + seq_printf(seq, "status: ERROR\n"); + else + seq_printf(seq, "status: %s\n", + !state ? "on" : "off"); + } + return 0; +} + +static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_fan_read_state, PDE(inode)->data); +} + +static ssize_t +acpi_fan_write_state(struct file *file, const char __user * buffer, + size_t count, loff_t * ppos) +{ + int result = 0; + struct seq_file *m = file->private_data; + struct acpi_device *device = m->private; + char state_string[3] = { '\0' }; + + if (count > sizeof(state_string) - 1) + return -EINVAL; + + if (copy_from_user(state_string, buffer, count)) + return -EFAULT; + + state_string[count] = '\0'; + if ((state_string[0] < '0') || (state_string[0] > '3')) + return -EINVAL; + if (state_string[1] == '\n') + state_string[1] = '\0'; + if (state_string[1] != '\0') + return -EINVAL; + + result = acpi_bus_set_power(device->handle, + simple_strtoul(state_string, NULL, 0)); + if (result) + return result; + + return count; +} + +static const struct file_operations acpi_fan_state_ops = { + .open = acpi_fan_state_open_fs, + .read = seq_read, + .write = acpi_fan_write_state, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; + +static int acpi_fan_add_fs(struct acpi_device *device) +{ + struct proc_dir_entry *entry = NULL; + + + if (!device) + return -EINVAL; + + if (!acpi_device_dir(device)) { + acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + acpi_fan_dir); + if (!acpi_device_dir(device)) + return -ENODEV; + } + + /* 'status' [R/W] */ + entry = proc_create_data(ACPI_FAN_FILE_STATE, + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device), + &acpi_fan_state_ops, + device); + if (!entry) + return -ENODEV; + return 0; +} + +static int acpi_fan_remove_fs(struct acpi_device *device) +{ + + if (acpi_device_dir(device)) { + remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); + remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); + acpi_device_dir(device) = NULL; + } + + return 0; +} +#else +static int acpi_fan_add_fs(struct acpi_device *device) +{ + return 0; +} + +static int acpi_fan_remove_fs(struct acpi_device *device) +{ + return 0; +} +#endif /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -166,6 +284,10 @@ static int acpi_fan_add(struct acpi_device *device) dev_err(&device->dev, "Failed to create sysfs link " "'device'\n"); + result = acpi_fan_add_fs(device); + if (result) + goto end; + printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), !device->power.state ? "on" : "off"); @@ -181,6 +303,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) if (!device || !cdev) return -EINVAL; + acpi_fan_remove_fs(device); sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); sysfs_remove_link(&cdev->device.kobj, "device"); thermal_cooling_device_unregister(cdev); @@ -224,9 +347,19 @@ static int __init acpi_fan_init(void) { int result = 0; +#ifdef CONFIG_ACPI_PROCFS + acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); + if (!acpi_fan_dir) + return -ENODEV; +#endif + result = acpi_bus_register_driver(&acpi_fan_driver); - if (result < 0) + if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS + remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); +#endif return -ENODEV; + } return 0; } @@ -236,6 +369,10 @@ static void __exit acpi_fan_exit(void) acpi_bus_unregister_driver(&acpi_fan_driver); +#ifdef CONFIG_ACPI_PROCFS + remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); +#endif + return; } diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index d3bed219c442..65b25a303b86 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -96,9 +96,7 @@ static LIST_HEAD(resource_list_head); static DEFINE_SPINLOCK(acpi_res_lock); #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ -static char osi_setup_string[OSI_STRING_LENGTH_MAX]; - -static void __init acpi_osi_setup_late(void); +static char osi_additional_string[OSI_STRING_LENGTH_MAX]; /* * The story of _OSI(Linux) @@ -140,20 +138,6 @@ static struct osi_linux { unsigned int known:1; } osi_linux = { 0, 0, 0, 0}; -static u32 acpi_osi_handler(acpi_string interface, u32 supported) -{ - if (!strcmp("Linux", interface)) { - - printk(KERN_NOTICE FW_BUG PREFIX - "BIOS _OSI(Linux) query %s%s\n", - osi_linux.enable ? "honored" : "ignored", - osi_linux.cmdline ? " via cmdline" : - osi_linux.dmi ? " via DMI" : ""); - } - - return supported; -} - static void __init acpi_request_region (struct acpi_generic_address *addr, unsigned int length, char *desc) { @@ -214,8 +198,6 @@ acpi_status acpi_os_initialize1(void) BUG_ON(!kacpid_wq); BUG_ON(!kacpi_notify_wq); BUG_ON(!kacpi_hotplug_wq); - acpi_install_interface_handler(acpi_osi_handler); - acpi_osi_setup_late(); return AE_OK; } @@ -565,10 +547,9 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, - u64 *value, u32 width) + u32 *value, u32 width) { int result, size; - u32 value32; if (!value) return AE_BAD_PARAMETER; @@ -589,8 +570,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, result = raw_pci_read(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), - reg, size, &value32); - *value = value32; + reg, size, value); return (result ? AE_ERROR : AE_OK); } @@ -622,6 +602,74 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return (result ? AE_ERROR : AE_OK); } +/* TODO: Change code to take advantage of driver model more */ +static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id, + int *is_bridge, u8 * bus_number) +{ + acpi_handle handle; + struct acpi_pci_id *pci_id = *id; + acpi_status status; + unsigned long long temp; + acpi_object_type type; + + acpi_get_parent(chandle, &handle); + if (handle != rhandle) { + acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, + bus_number); + + status = acpi_get_type(handle, &type); + if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE)) + return; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, + &temp); + if (ACPI_SUCCESS(status)) { + u32 val; + pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); + pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); + + if (*is_bridge) + pci_id->bus = *bus_number; + + /* any nicer way to get bus number of bridge ? */ + status = + acpi_os_read_pci_configuration(pci_id, 0x0e, &val, + 8); + if (ACPI_SUCCESS(status) + && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) { + status = + acpi_os_read_pci_configuration(pci_id, 0x18, + &val, 8); + if (!ACPI_SUCCESS(status)) { + /* Certainly broken... FIX ME */ + return; + } + *is_bridge = 1; + pci_id->bus = val; + status = + acpi_os_read_pci_configuration(pci_id, 0x19, + &val, 8); + if (ACPI_SUCCESS(status)) { + *bus_number = val; + } + } else + *is_bridge = 0; + } + } +} + +void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id) +{ + int is_bridge = 1; + u8 bus_number = (*id)->bus; + + acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); +} + static void acpi_os_execute_deferred(struct work_struct *work) { struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); @@ -929,12 +977,6 @@ static void __init set_osi_linux(unsigned int enable) printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", enable ? "Add": "Delet"); } - - if (osi_linux.enable) - acpi_osi_setup("Linux"); - else - acpi_osi_setup("!Linux"); - return; } @@ -969,33 +1011,21 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) * string starting with '!' disables that string * otherwise string is added to list, augmenting built-in strings */ -static void __init acpi_osi_setup_late(void) +int __init acpi_osi_setup(char *str) { - char *str = osi_setup_string; - - if (*str == '\0') - return; - - if (!strcmp("!Linux", str)) { + if (str == NULL || *str == '\0') { + printk(KERN_INFO PREFIX "_OSI method disabled\n"); + acpi_gbl_create_osi_method = FALSE; + } else if (!strcmp("!Linux", str)) { acpi_cmdline_osi_linux(0); /* !enable */ } else if (*str == '!') { - if (acpi_remove_interface(++str) == AE_OK) + if (acpi_osi_invalidate(++str) == AE_OK) printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); } else if (!strcmp("Linux", str)) { acpi_cmdline_osi_linux(1); /* enable */ - } else { - if (acpi_install_interface(str) == AE_OK) - printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); - } -} - -int __init acpi_osi_setup(char *str) -{ - if (str == NULL || *str == '\0') { - printk(KERN_INFO PREFIX "_OSI method disabled\n"); - acpi_gbl_create_osi_method = FALSE; - } else { - strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); + } else if (*osi_additional_string == '\0') { + strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); + printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); } return 1; @@ -1252,6 +1282,38 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) return (AE_OK); } +/****************************************************************************** + * + * FUNCTION: acpi_os_validate_interface + * + * PARAMETERS: interface - Requested interface to be validated + * + * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise + * + * DESCRIPTION: Match an interface string to the interfaces supported by the + * host. Strings originate from an AML call to the _OSI method. + * + *****************************************************************************/ + +acpi_status +acpi_os_validate_interface (char *interface) +{ + if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) + return AE_OK; + if (!strcmp("Linux", interface)) { + + printk(KERN_NOTICE PREFIX + "BIOS _OSI(Linux) query %s%s\n", + osi_linux.enable ? "honored" : "ignored", + osi_linux.cmdline ? " via cmdline" : + osi_linux.dmi ? " via DMI" : ""); + + if (osi_linux.enable) + return AE_OK; + } + return AE_SUPPORT; +} + static inline int acpi_res_list_add(struct acpi_res_list *res) { struct acpi_res_list *res_list_elem; diff --git a/trunk/drivers/acpi/pci_irq.c b/trunk/drivers/acpi/pci_irq.c index f907cfbfa13c..e4804fb05e23 100644 --- a/trunk/drivers/acpi/pci_irq.c +++ b/trunk/drivers/acpi/pci_irq.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 9ff80a7e9f6a..8d47a5846aeb 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/drivers/acpi/pci_root.c b/trunk/drivers/acpi/pci_root.c index 96668ad09622..3ba8d1f44a73 100644 --- a/trunk/drivers/acpi/pci_root.c +++ b/trunk/drivers/acpi/pci_root.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/drivers/acpi/processor_driver.c b/trunk/drivers/acpi/processor_driver.c index 356c320bdd08..347eb21b2353 100644 --- a/trunk/drivers/acpi/processor_driver.c +++ b/trunk/drivers/acpi/processor_driver.c @@ -40,10 +40,8 @@ #include #include #include -#ifdef CONFIG_ACPI_PROCFS #include #include -#endif #include #include #include @@ -246,7 +244,6 @@ static int acpi_processor_errata(struct acpi_processor *pr) return result; } -#ifdef CONFIG_ACPI_PROCFS static struct proc_dir_entry *acpi_processor_dir = NULL; static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) @@ -283,16 +280,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) return 0; } -#else -static inline int acpi_processor_add_fs(struct acpi_device *device) -{ - return 0; -} -static inline int acpi_processor_remove_fs(struct acpi_device *device) -{ - return 0; -} -#endif + /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -854,11 +842,9 @@ static int __init acpi_processor_init(void) memset(&errata, 0, sizeof(errata)); -#ifdef CONFIG_ACPI_PROCFS acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); if (!acpi_processor_dir) return -ENOMEM; -#endif if (!cpuidle_register_driver(&acpi_idle_driver)) { printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", @@ -885,9 +871,7 @@ static int __init acpi_processor_init(void) out_cpuidle: cpuidle_unregister_driver(&acpi_idle_driver); -#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); -#endif return result; } @@ -907,9 +891,7 @@ static void __exit acpi_processor_exit(void) cpuidle_unregister_driver(&acpi_idle_driver); -#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); -#endif return; } diff --git a/trunk/drivers/acpi/processor_throttling.c b/trunk/drivers/acpi/processor_throttling.c index ff3632717c51..730863855ed5 100644 --- a/trunk/drivers/acpi/processor_throttling.c +++ b/trunk/drivers/acpi/processor_throttling.c @@ -32,10 +32,8 @@ #include #include #include -#ifdef CONFIG_ACPI_PROCFS #include #include -#endif #include #include @@ -1216,7 +1214,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) return result; } -#ifdef CONFIG_ACPI_PROCFS /* proc interface */ static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset) @@ -1325,4 +1322,3 @@ const struct file_operations acpi_processor_throttling_fops = { .llseek = seq_lseek, .release = single_release, }; -#endif diff --git a/trunk/drivers/acpi/sbs.c b/trunk/drivers/acpi/sbs.c index e5dbedb16bbf..4ff76e8174eb 100644 --- a/trunk/drivers/acpi/sbs.c +++ b/trunk/drivers/acpi/sbs.c @@ -40,7 +40,10 @@ #include #include #include + +#ifdef CONFIG_ACPI_SYSFS_POWER #include +#endif #include "sbshc.h" @@ -82,7 +85,9 @@ static const struct acpi_device_id sbs_device_ids[] = { MODULE_DEVICE_TABLE(acpi, sbs_device_ids); struct acpi_battery { +#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply bat; +#endif struct acpi_sbs *sbs; #ifdef CONFIG_ACPI_PROCFS_POWER struct proc_dir_entry *proc_entry; @@ -115,7 +120,9 @@ struct acpi_battery { #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); struct acpi_sbs { +#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply charger; +#endif struct acpi_device *device; struct acpi_smb_hc *hc; struct mutex lock; @@ -159,6 +166,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) acpi_battery_ipscale(battery); } +#ifdef CONFIG_ACPI_SYSFS_POWER static int sbs_get_ac_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -305,6 +313,7 @@ static enum power_supply_property sbs_energy_battery_props[] = { POWER_SUPPLY_PROP_MANUFACTURER, }; +#endif /* -------------------------------------------------------------------------- Smart Battery System Management @@ -440,6 +449,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) return result; } +#ifdef CONFIG_ACPI_SYSFS_POWER static ssize_t acpi_battery_alarm_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -469,6 +479,7 @@ static struct device_attribute alarm_attr = { .show = acpi_battery_alarm_show, .store = acpi_battery_alarm_store, }; +#endif /* -------------------------------------------------------------------------- FS Interface (/proc/acpi) @@ -787,6 +798,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) &acpi_battery_state_fops, &acpi_battery_alarm_fops, battery); #endif +#ifdef CONFIG_ACPI_SYSFS_POWER battery->bat.name = battery->name; battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; if (!acpi_battery_mode(battery)) { @@ -807,6 +819,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) goto end; battery->have_sysfs_alarm = 1; end: +#endif printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), battery->name, battery->present ? "present" : "absent"); @@ -815,13 +828,17 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) static void acpi_battery_remove(struct acpi_sbs *sbs, int id) { +#if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) struct acpi_battery *battery = &sbs->battery[id]; +#endif +#ifdef CONFIG_ACPI_SYSFS_POWER if (battery->bat.dev) { if (battery->have_sysfs_alarm) device_remove_file(battery->bat.dev, &alarm_attr); power_supply_unregister(&battery->bat); } +#endif #ifdef CONFIG_ACPI_PROCFS_POWER if (battery->proc_entry) acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); @@ -842,12 +859,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs) if (result) goto end; #endif +#ifdef CONFIG_ACPI_SYSFS_POWER sbs->charger.name = "sbs-charger"; sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; sbs->charger.properties = sbs_ac_props; sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); sbs->charger.get_property = sbs_get_ac_property; power_supply_register(&sbs->device->dev, &sbs->charger); +#endif printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); @@ -857,8 +876,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs) static void acpi_charger_remove(struct acpi_sbs *sbs) { +#ifdef CONFIG_ACPI_SYSFS_POWER if (sbs->charger.dev) power_supply_unregister(&sbs->charger); +#endif #ifdef CONFIG_ACPI_PROCFS_POWER if (sbs->charger_entry) acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); @@ -879,7 +900,9 @@ static void acpi_sbs_callback(void *context) ACPI_SBS_NOTIFY_STATUS, sbs->charger_present); #endif +#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); +#endif } if (sbs->manager_present) { for (id = 0; id < MAX_SBS_BAT; ++id) { @@ -896,7 +919,9 @@ static void acpi_sbs_callback(void *context) ACPI_SBS_NOTIFY_STATUS, bat->present); #endif +#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); +#endif } } } diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index 5a27b0a31315..2f8f17131d9f 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -37,6 +37,12 @@ #include #include #include + +#ifdef CONFIG_ACPI_PROCFS +#include +#include +#endif + #include #include #include @@ -189,6 +195,61 @@ struct acpi_thermal { struct mutex lock; }; +#ifdef CONFIG_ACPI_PROCFS +static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_thermal_write_cooling_mode(struct file *, + const char __user *, size_t, + loff_t *); +static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, + size_t, loff_t *); + +static const struct file_operations acpi_thermal_state_fops = { + .owner = THIS_MODULE, + .open = acpi_thermal_state_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations acpi_thermal_temp_fops = { + .owner = THIS_MODULE, + .open = acpi_thermal_temp_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations acpi_thermal_trip_fops = { + .owner = THIS_MODULE, + .open = acpi_thermal_trip_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations acpi_thermal_cooling_fops = { + .owner = THIS_MODULE, + .open = acpi_thermal_cooling_open_fs, + .read = seq_read, + .write = acpi_thermal_write_cooling_mode, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations acpi_thermal_polling_fops = { + .owner = THIS_MODULE, + .open = acpi_thermal_polling_open_fs, + .read = seq_read, + .write = acpi_thermal_write_polling, + .llseek = seq_lseek, + .release = single_release, +}; +#endif /* CONFIG_ACPI_PROCFS*/ + /* -------------------------------------------------------------------------- Thermal Zone Management -------------------------------------------------------------------------- */ @@ -896,6 +957,358 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) } +/* -------------------------------------------------------------------------- + FS Interface (/proc) + -------------------------------------------------------------------------- */ +#ifdef CONFIG_ACPI_PROCFS +static struct proc_dir_entry *acpi_thermal_dir; + +static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_thermal *tz = seq->private; + + + if (!tz) + goto end; + + seq_puts(seq, "state: "); + + if (!tz->state.critical && !tz->state.hot && !tz->state.passive + && !tz->state.active) + seq_puts(seq, "ok\n"); + else { + if (tz->state.critical) + seq_puts(seq, "critical "); + if (tz->state.hot) + seq_puts(seq, "hot "); + if (tz->state.passive) + seq_puts(seq, "passive "); + if (tz->state.active) + seq_printf(seq, "active[%d]", tz->state.active_index); + seq_puts(seq, "\n"); + } + + end: + return 0; +} + +static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data); +} + +static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) +{ + int result = 0; + struct acpi_thermal *tz = seq->private; + + + if (!tz) + goto end; + + result = acpi_thermal_get_temperature(tz); + if (result) + goto end; + + seq_printf(seq, "temperature: %ld C\n", + KELVIN_TO_CELSIUS(tz->temperature)); + + end: + return 0; +} + +static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data); +} + +static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_thermal *tz = seq->private; + struct acpi_device *device; + acpi_status status; + + int i = 0; + int j = 0; + + + if (!tz) + goto end; + + if (tz->trips.critical.flags.valid) + seq_printf(seq, "critical (S5): %ld C%s", + KELVIN_TO_CELSIUS(tz->trips.critical.temperature), + nocrt ? " \n" : "\n"); + + if (tz->trips.hot.flags.valid) + seq_printf(seq, "hot (S4): %ld C%s", + KELVIN_TO_CELSIUS(tz->trips.hot.temperature), + nocrt ? " \n" : "\n"); + + if (tz->trips.passive.flags.valid) { + seq_printf(seq, + "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=", + KELVIN_TO_CELSIUS(tz->trips.passive.temperature), + tz->trips.passive.tc1, tz->trips.passive.tc2, + tz->trips.passive.tsp); + for (j = 0; j < tz->trips.passive.devices.count; j++) { + status = acpi_bus_get_device(tz->trips.passive.devices. + handles[j], &device); + seq_printf(seq, "%4.4s ", status ? "" : + acpi_device_bid(device)); + } + seq_puts(seq, "\n"); + } else { + seq_printf(seq, "passive (forced):"); + if (tz->thermal_zone->forced_passive) + seq_printf(seq, " %i C\n", + tz->thermal_zone->forced_passive / 1000); + else + seq_printf(seq, "\n"); + } + + for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { + if (!(tz->trips.active[i].flags.valid)) + break; + seq_printf(seq, "active[%d]: %ld C: devices=", + i, + KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); + for (j = 0; j < tz->trips.active[i].devices.count; j++){ + status = acpi_bus_get_device(tz->trips.active[i]. + devices.handles[j], + &device); + seq_printf(seq, "%4.4s ", status ? "" : + acpi_device_bid(device)); + } + seq_puts(seq, "\n"); + } + + end: + return 0; +} + +static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); +} + +static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_thermal *tz = seq->private; + + + if (!tz) + goto end; + + if (!tz->flags.cooling_mode) + seq_puts(seq, "\n"); + else + seq_puts(seq, "0 - Active; 1 - Passive\n"); + + end: + return 0; +} + +static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_thermal_cooling_seq_show, + PDE(inode)->data); +} + +static ssize_t +acpi_thermal_write_cooling_mode(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) +{ + struct seq_file *m = file->private_data; + struct acpi_thermal *tz = m->private; + int result = 0; + char mode_string[12] = { '\0' }; + + + if (!tz || (count > sizeof(mode_string) - 1)) + return -EINVAL; + + if (!tz->flags.cooling_mode) + return -ENODEV; + + if (copy_from_user(mode_string, buffer, count)) + return -EFAULT; + + mode_string[count] = '\0'; + + result = acpi_thermal_set_cooling_mode(tz, + simple_strtoul(mode_string, NULL, + 0)); + if (result) + return result; + + acpi_thermal_check(tz); + + return count; +} + +static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_thermal *tz = seq->private; + + + if (!tz) + goto end; + + if (!tz->thermal_zone->polling_delay) { + seq_puts(seq, "\n"); + goto end; + } + + seq_printf(seq, "polling frequency: %d seconds\n", + (tz->thermal_zone->polling_delay / 1000)); + + end: + return 0; +} + +static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_thermal_polling_seq_show, + PDE(inode)->data); +} + +static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) +{ + if (!tz) + return -EINVAL; + + /* Convert value to deci-seconds */ + tz->polling_frequency = seconds * 10; + + tz->thermal_zone->polling_delay = seconds * 1000; + + if (tz->tz_enabled) + thermal_zone_device_update(tz->thermal_zone); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Polling frequency set to %lu seconds\n", + tz->polling_frequency/10)); + + return 0; +} + +static ssize_t +acpi_thermal_write_polling(struct file *file, + const char __user * buffer, + size_t count, loff_t * ppos) +{ + struct seq_file *m = file->private_data; + struct acpi_thermal *tz = m->private; + int result = 0; + char polling_string[12] = { '\0' }; + int seconds = 0; + + + if (!tz || (count > sizeof(polling_string) - 1)) + return -EINVAL; + + if (copy_from_user(polling_string, buffer, count)) + return -EFAULT; + + polling_string[count] = '\0'; + + seconds = simple_strtoul(polling_string, NULL, 0); + + result = acpi_thermal_set_polling(tz, seconds); + if (result) + return result; + + acpi_thermal_check(tz); + + return count; +} + +static int acpi_thermal_add_fs(struct acpi_device *device) +{ + struct proc_dir_entry *entry = NULL; + + + if (!acpi_device_dir(device)) { + acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + acpi_thermal_dir); + if (!acpi_device_dir(device)) + return -ENODEV; + } + + /* 'state' [R] */ + entry = proc_create_data(ACPI_THERMAL_FILE_STATE, + S_IRUGO, acpi_device_dir(device), + &acpi_thermal_state_fops, + acpi_driver_data(device)); + if (!entry) + return -ENODEV; + + /* 'temperature' [R] */ + entry = proc_create_data(ACPI_THERMAL_FILE_TEMPERATURE, + S_IRUGO, acpi_device_dir(device), + &acpi_thermal_temp_fops, + acpi_driver_data(device)); + if (!entry) + return -ENODEV; + + /* 'trip_points' [R] */ + entry = proc_create_data(ACPI_THERMAL_FILE_TRIP_POINTS, + S_IRUGO, + acpi_device_dir(device), + &acpi_thermal_trip_fops, + acpi_driver_data(device)); + if (!entry) + return -ENODEV; + + /* 'cooling_mode' [R/W] */ + entry = proc_create_data(ACPI_THERMAL_FILE_COOLING_MODE, + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device), + &acpi_thermal_cooling_fops, + acpi_driver_data(device)); + if (!entry) + return -ENODEV; + + /* 'polling_frequency' [R/W] */ + entry = proc_create_data(ACPI_THERMAL_FILE_POLLING_FREQ, + S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device), + &acpi_thermal_polling_fops, + acpi_driver_data(device)); + if (!entry) + return -ENODEV; + return 0; +} + +static int acpi_thermal_remove_fs(struct acpi_device *device) +{ + + if (acpi_device_dir(device)) { + remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, + acpi_device_dir(device)); + remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, + acpi_device_dir(device)); + remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, + acpi_device_dir(device)); + remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, + acpi_device_dir(device)); + remove_proc_entry(ACPI_THERMAL_FILE_STATE, + acpi_device_dir(device)); + remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir); + acpi_device_dir(device) = NULL; + } + + return 0; +} +#else +static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; } +static inline int acpi_thermal_remove_fs(struct acpi_device *device) +{ + return 0; +} +#endif /* CONFIG_ACPI_PROCFS */ /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -1015,11 +1428,17 @@ static int acpi_thermal_add(struct acpi_device *device) if (result) goto free_memory; + result = acpi_thermal_add_fs(device); + if (result) + goto unregister_thermal_zone; + printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device), acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature)); goto end; +unregister_thermal_zone: + thermal_zone_device_unregister(tz->thermal_zone); free_memory: kfree(tz); end: @@ -1035,6 +1454,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) tz = acpi_driver_data(device); + acpi_thermal_remove_fs(device); acpi_thermal_unregister_thermal_zone(tz); mutex_destroy(&tz->lock); kfree(tz); @@ -1160,9 +1580,19 @@ static int __init acpi_thermal_init(void) return -ENODEV; } +#ifdef CONFIG_ACPI_PROCFS + acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); + if (!acpi_thermal_dir) + return -ENODEV; +#endif + result = acpi_bus_register_driver(&acpi_thermal_driver); - if (result < 0) + if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS + remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); +#endif return -ENODEV; + } return 0; } @@ -1172,6 +1602,10 @@ static void __exit acpi_thermal_exit(void) acpi_bus_unregister_driver(&acpi_thermal_driver); +#ifdef CONFIG_ACPI_PROCFS + remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); +#endif + return; } diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 5cd0228d2daa..67dec0c675aa 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -150,6 +152,9 @@ struct acpi_video_bus { struct acpi_video_bus_flags flags; struct list_head video_device_list; struct mutex device_list_lock; /* protects video_device_list */ +#ifdef CONFIG_ACPI_PROCFS + struct proc_dir_entry *dir; +#endif struct input_dev *input; char phys[32]; /* for input device */ struct notifier_block pm_nb; @@ -205,6 +210,108 @@ struct acpi_video_device { struct output_device *output_dev; }; +#ifdef CONFIG_ACPI_PROCFS +/* bus */ +static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); +static const struct file_operations acpi_video_bus_info_fops = { + .owner = THIS_MODULE, + .open = acpi_video_bus_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); +static const struct file_operations acpi_video_bus_ROM_fops = { + .owner = THIS_MODULE, + .open = acpi_video_bus_ROM_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_bus_POST_info_open_fs(struct inode *inode, + struct file *file); +static const struct file_operations acpi_video_bus_POST_info_fops = { + .owner = THIS_MODULE, + .open = acpi_video_bus_POST_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_video_bus_write_POST(struct file *file, + const char __user *buffer, size_t count, loff_t *data); +static const struct file_operations acpi_video_bus_POST_fops = { + .owner = THIS_MODULE, + .open = acpi_video_bus_POST_open_fs, + .read = seq_read, + .write = acpi_video_bus_write_POST, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_video_bus_write_DOS(struct file *file, + const char __user *buffer, size_t count, loff_t *data); +static const struct file_operations acpi_video_bus_DOS_fops = { + .owner = THIS_MODULE, + .open = acpi_video_bus_DOS_open_fs, + .read = seq_read, + .write = acpi_video_bus_write_DOS, + .llseek = seq_lseek, + .release = single_release, +}; + +/* device */ +static int acpi_video_device_info_open_fs(struct inode *inode, + struct file *file); +static const struct file_operations acpi_video_device_info_fops = { + .owner = THIS_MODULE, + .open = acpi_video_device_info_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_device_state_open_fs(struct inode *inode, + struct file *file); +static ssize_t acpi_video_device_write_state(struct file *file, + const char __user *buffer, size_t count, loff_t *data); +static const struct file_operations acpi_video_device_state_fops = { + .owner = THIS_MODULE, + .open = acpi_video_device_state_open_fs, + .read = seq_read, + .write = acpi_video_device_write_state, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_device_brightness_open_fs(struct inode *inode, + struct file *file); +static ssize_t acpi_video_device_write_brightness(struct file *file, + const char __user *buffer, size_t count, loff_t *data); +static const struct file_operations acpi_video_device_brightness_fops = { + .owner = THIS_MODULE, + .open = acpi_video_device_brightness_open_fs, + .read = seq_read, + .write = acpi_video_device_write_brightness, + .llseek = seq_lseek, + .release = single_release, +}; + +static int acpi_video_device_EDID_open_fs(struct inode *inode, + struct file *file); +static const struct file_operations acpi_video_device_EDID_fops = { + .owner = THIS_MODULE, + .open = acpi_video_device_EDID_open_fs, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +#endif /* CONFIG_ACPI_PROCFS */ + static const char device_decode[][30] = { "motherboard VGA device", "PCI VGA device", @@ -1003,6 +1110,646 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) return status; } +/* -------------------------------------------------------------------------- + FS Interface (/proc) + -------------------------------------------------------------------------- */ +#ifdef CONFIG_ACPI_PROCFS + +static struct proc_dir_entry *acpi_video_dir; + +/* video devices */ + +static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_device *dev = seq->private; + + + if (!dev) + goto end; + + seq_printf(seq, "device_id: 0x%04x\n", (u32) dev->device_id); + seq_printf(seq, "type: "); + if (dev->flags.crt) + seq_printf(seq, "CRT\n"); + else if (dev->flags.lcd) + seq_printf(seq, "LCD\n"); + else if (dev->flags.tvout) + seq_printf(seq, "TVOUT\n"); + else if (dev->flags.dvi) + seq_printf(seq, "DVI\n"); + else + seq_printf(seq, "UNKNOWN\n"); + + seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); + + end: + return 0; +} + +static int +acpi_video_device_info_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_device_info_seq_show, + PDE(inode)->data); +} + +static int +acpi_video_device_query(struct acpi_video_device *device, + unsigned long long *state) +{ + int status; + + status = acpi_evaluate_integer(device->dev->handle, "_DGS", + NULL, state); + + return status; +} + +static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) +{ + int status; + struct acpi_video_device *dev = seq->private; + unsigned long long state; + + + if (!dev) + goto end; + + status = acpi_video_device_get_state(dev, &state); + seq_printf(seq, "state: "); + if (ACPI_SUCCESS(status)) + seq_printf(seq, "0x%02llx\n", state); + else + seq_printf(seq, "\n"); + + status = acpi_video_device_query(dev, &state); + seq_printf(seq, "query: "); + if (ACPI_SUCCESS(status)) + seq_printf(seq, "0x%02llx\n", state); + else + seq_printf(seq, "\n"); + + end: + return 0; +} + +static int +acpi_video_device_state_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_device_state_seq_show, + PDE(inode)->data); +} + +static ssize_t +acpi_video_device_write_state(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) +{ + int status; + struct seq_file *m = file->private_data; + struct acpi_video_device *dev = m->private; + char str[12] = { 0 }; + u32 state = 0; + + + if (!dev || count >= sizeof(str)) + return -EINVAL; + + if (copy_from_user(str, buffer, count)) + return -EFAULT; + + str[count] = 0; + state = simple_strtoul(str, NULL, 0); + state &= ((1ul << 31) | (1ul << 30) | (1ul << 0)); + + status = acpi_video_device_set_state(dev, state); + + if (status) + return -EFAULT; + + return count; +} + +static int +acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_device *dev = seq->private; + int i; + + + if (!dev || !dev->brightness) { + seq_printf(seq, "\n"); + return 0; + } + + seq_printf(seq, "levels: "); + for (i = 2; i < dev->brightness->count; i++) + seq_printf(seq, " %d", dev->brightness->levels[i]); + seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); + + return 0; +} + +static int +acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_device_brightness_seq_show, + PDE(inode)->data); +} + +static ssize_t +acpi_video_device_write_brightness(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) +{ + struct seq_file *m = file->private_data; + struct acpi_video_device *dev = m->private; + char str[5] = { 0 }; + unsigned int level = 0; + int i; + + + if (!dev || !dev->brightness || count >= sizeof(str)) + return -EINVAL; + + if (copy_from_user(str, buffer, count)) + return -EFAULT; + + str[count] = 0; + level = simple_strtoul(str, NULL, 0); + + if (level > 100) + return -EFAULT; + + /* validate through the list of available levels */ + for (i = 2; i < dev->brightness->count; i++) + if (level == dev->brightness->levels[i]) { + if (!acpi_video_device_lcd_set_level(dev, level)) + return count; + break; + } + + return -EINVAL; +} + +static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_device *dev = seq->private; + int status; + int i; + union acpi_object *edid = NULL; + + + if (!dev) + goto out; + + status = acpi_video_device_EDID(dev, &edid, 128); + if (ACPI_FAILURE(status)) { + status = acpi_video_device_EDID(dev, &edid, 256); + } + + if (ACPI_FAILURE(status)) { + goto out; + } + + if (edid && edid->type == ACPI_TYPE_BUFFER) { + for (i = 0; i < edid->buffer.length; i++) + seq_putc(seq, edid->buffer.pointer[i]); + } + + out: + if (!edid) + seq_printf(seq, "\n"); + else + kfree(edid); + + return 0; +} + +static int +acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_device_EDID_seq_show, + PDE(inode)->data); +} + +static int acpi_video_device_add_fs(struct acpi_device *device) +{ + struct proc_dir_entry *entry, *device_dir; + struct acpi_video_device *vid_dev; + + vid_dev = acpi_driver_data(device); + if (!vid_dev) + return -ENODEV; + + device_dir = proc_mkdir(acpi_device_bid(device), + vid_dev->video->dir); + if (!device_dir) + return -ENOMEM; + + /* 'info' [R] */ + entry = proc_create_data("info", S_IRUGO, device_dir, + &acpi_video_device_info_fops, acpi_driver_data(device)); + if (!entry) + goto err_remove_dir; + + /* 'state' [R/W] */ + entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR, + device_dir, + &acpi_video_device_state_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_info; + + /* 'brightness' [R/W] */ + entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR, + device_dir, + &acpi_video_device_brightness_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_state; + + /* 'EDID' [R] */ + entry = proc_create_data("EDID", S_IRUGO, device_dir, + &acpi_video_device_EDID_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_brightness; + + acpi_device_dir(device) = device_dir; + + return 0; + + err_remove_brightness: + remove_proc_entry("brightness", device_dir); + err_remove_state: + remove_proc_entry("state", device_dir); + err_remove_info: + remove_proc_entry("info", device_dir); + err_remove_dir: + remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); + return -ENOMEM; +} + +static int acpi_video_device_remove_fs(struct acpi_device *device) +{ + struct acpi_video_device *vid_dev; + struct proc_dir_entry *device_dir; + + vid_dev = acpi_driver_data(device); + if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) + return -ENODEV; + + device_dir = acpi_device_dir(device); + if (device_dir) { + remove_proc_entry("info", device_dir); + remove_proc_entry("state", device_dir); + remove_proc_entry("brightness", device_dir); + remove_proc_entry("EDID", device_dir); + remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); + acpi_device_dir(device) = NULL; + } + + return 0; +} + +/* video bus */ +static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_bus *video = seq->private; + + + if (!video) + goto end; + + seq_printf(seq, "Switching heads: %s\n", + video->flags.multihead ? "yes" : "no"); + seq_printf(seq, "Video ROM: %s\n", + video->flags.rom ? "yes" : "no"); + seq_printf(seq, "Device to be POSTed on boot: %s\n", + video->flags.post ? "yes" : "no"); + + end: + return 0; +} + +static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_bus_info_seq_show, + PDE(inode)->data); +} + +static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_bus *video = seq->private; + + + if (!video) + goto end; + + printk(KERN_INFO PREFIX "Please implement %s\n", __func__); + seq_printf(seq, "\n"); + + end: + return 0; +} + +static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); +} + +static int +acpi_video_bus_POST_options(struct acpi_video_bus *video, + unsigned long long *options) +{ + int status; + + status = acpi_evaluate_integer(video->device->handle, "_VPO", + NULL, options); + *options &= 3; + + return status; +} + +static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_bus *video = seq->private; + unsigned long long options; + int status; + + + if (!video) + goto end; + + status = acpi_video_bus_POST_options(video, &options); + if (ACPI_SUCCESS(status)) { + if (!(options & 1)) { + printk(KERN_WARNING PREFIX + "The motherboard VGA device is not listed as a possible POST device.\n"); + printk(KERN_WARNING PREFIX + "This indicates a BIOS bug. Please contact the manufacturer.\n"); + } + printk(KERN_WARNING "%llx\n", options); + seq_printf(seq, "can POST: "); + if (options & 2) + seq_printf(seq, " "); + if (options & 4) + seq_printf(seq, " "); + seq_putc(seq, '\n'); + } else + seq_printf(seq, "\n"); + end: + return 0; +} + +static int +acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_bus_POST_info_seq_show, + PDE(inode)->data); +} + +static int +acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) +{ + int status; + + status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); + + return status; +} + +static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_bus *video = seq->private; + int status; + unsigned long long id; + + + if (!video) + goto end; + + status = acpi_video_bus_get_POST(video, &id); + if (!ACPI_SUCCESS(status)) { + seq_printf(seq, "\n"); + goto end; + } + seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]); + + end: + return 0; +} + +static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) +{ + struct acpi_video_bus *video = seq->private; + + + seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); + + return 0; +} + +static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_bus_POST_seq_show, + PDE(inode)->data); +} + +static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) +{ + return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); +} + +static int +acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) +{ + int status; + unsigned long long tmp; + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; + struct acpi_object_list args = { 1, &arg0 }; + + + arg0.integer.value = option; + + status = acpi_evaluate_integer(video->device->handle, "_SPD", + &args, &tmp); + if (ACPI_SUCCESS(status)) + status = tmp ? (-EINVAL) : (AE_OK); + + return status; +} + +static ssize_t +acpi_video_bus_write_POST(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) +{ + int status; + struct seq_file *m = file->private_data; + struct acpi_video_bus *video = m->private; + char str[12] = { 0 }; + unsigned long long opt, options; + + + if (!video || count >= sizeof(str)) + return -EINVAL; + + status = acpi_video_bus_POST_options(video, &options); + if (!ACPI_SUCCESS(status)) + return -EINVAL; + + if (copy_from_user(str, buffer, count)) + return -EFAULT; + + str[count] = 0; + opt = strtoul(str, NULL, 0); + if (opt > 3) + return -EFAULT; + + /* just in case an OEM 'forgot' the motherboard... */ + options |= 1; + + if (options & (1ul << opt)) { + status = acpi_video_bus_set_POST(video, opt); + if (!ACPI_SUCCESS(status)) + return -EFAULT; + + } + + return count; +} + +static ssize_t +acpi_video_bus_write_DOS(struct file *file, + const char __user * buffer, + size_t count, loff_t * data) +{ + int status; + struct seq_file *m = file->private_data; + struct acpi_video_bus *video = m->private; + char str[12] = { 0 }; + unsigned long opt; + + + if (!video || count >= sizeof(str)) + return -EINVAL; + + if (copy_from_user(str, buffer, count)) + return -EFAULT; + + str[count] = 0; + opt = strtoul(str, NULL, 0); + if (opt > 7) + return -EFAULT; + + status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); + + if (!ACPI_SUCCESS(status)) + return -EFAULT; + + return count; +} + +static int acpi_video_bus_add_fs(struct acpi_device *device) +{ + struct acpi_video_bus *video = acpi_driver_data(device); + struct proc_dir_entry *device_dir; + struct proc_dir_entry *entry; + + device_dir = proc_mkdir(acpi_device_bid(device), acpi_video_dir); + if (!device_dir) + return -ENOMEM; + + /* 'info' [R] */ + entry = proc_create_data("info", S_IRUGO, device_dir, + &acpi_video_bus_info_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_dir; + + /* 'ROM' [R] */ + entry = proc_create_data("ROM", S_IRUGO, device_dir, + &acpi_video_bus_ROM_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_info; + + /* 'POST_info' [R] */ + entry = proc_create_data("POST_info", S_IRUGO, device_dir, + &acpi_video_bus_POST_info_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_rom; + + /* 'POST' [R/W] */ + entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, + device_dir, + &acpi_video_bus_POST_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_post_info; + + /* 'DOS' [R/W] */ + entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, + device_dir, + &acpi_video_bus_DOS_fops, + acpi_driver_data(device)); + if (!entry) + goto err_remove_post; + + video->dir = acpi_device_dir(device) = device_dir; + return 0; + + err_remove_post: + remove_proc_entry("POST", device_dir); + err_remove_post_info: + remove_proc_entry("POST_info", device_dir); + err_remove_rom: + remove_proc_entry("ROM", device_dir); + err_remove_info: + remove_proc_entry("info", device_dir); + err_remove_dir: + remove_proc_entry(acpi_device_bid(device), acpi_video_dir); + return -ENOMEM; +} + +static int acpi_video_bus_remove_fs(struct acpi_device *device) +{ + struct proc_dir_entry *device_dir = acpi_device_dir(device); + + if (device_dir) { + remove_proc_entry("info", device_dir); + remove_proc_entry("ROM", device_dir); + remove_proc_entry("POST_info", device_dir); + remove_proc_entry("POST", device_dir); + remove_proc_entry("DOS", device_dir); + remove_proc_entry(acpi_device_bid(device), acpi_video_dir); + acpi_device_dir(device) = NULL; + } + + return 0; +} +#else +static inline int acpi_video_device_add_fs(struct acpi_device *device) +{ + return 0; +} +static inline int acpi_video_device_remove_fs(struct acpi_device *device) +{ + return 0; +} +static inline int acpi_video_bus_add_fs(struct acpi_device *device) +{ + return 0; +} +static inline int acpi_video_bus_remove_fs(struct acpi_device *device) +{ + return 0; +} +#endif /* CONFIG_ACPI_PROCFS */ + /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -1130,6 +1877,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device, list_add_tail(&data->entry, &video->video_device_list); mutex_unlock(&video->device_list_lock); + acpi_video_device_add_fs(device); + return 0; } @@ -1432,6 +2181,8 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) if (!device || !device->video) return -ENOENT; + acpi_video_device_remove_fs(device->dev); + status = acpi_remove_notify_handler(device->dev->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); @@ -1715,6 +2466,10 @@ static int acpi_video_bus_add(struct acpi_device *device) if (error) goto err_free_video; + error = acpi_video_bus_add_fs(device); + if (error) + goto err_free_video; + mutex_init(&video->device_list_lock); INIT_LIST_HEAD(&video->video_device_list); @@ -1767,6 +2522,7 @@ static int acpi_video_bus_add(struct acpi_device *device) acpi_video_bus_stop_devices(video); acpi_video_bus_put_devices(video); kfree(video->attached_array); + acpi_video_bus_remove_fs(device); err_free_video: kfree(video); device->driver_data = NULL; @@ -1788,6 +2544,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) acpi_video_bus_stop_devices(video); acpi_video_bus_put_devices(video); + acpi_video_bus_remove_fs(device); input_unregister_device(video->input); kfree(video->attached_array); @@ -1827,9 +2584,17 @@ int acpi_video_register(void) return 0; } +#ifdef CONFIG_ACPI_PROCFS + acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); + if (!acpi_video_dir) + return -ENODEV; +#endif + result = acpi_bus_register_driver(&acpi_video_bus); - if (result < 0) + if (result < 0) { + remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); return -ENODEV; + } /* * When the acpi_video_bus is loaded successfully, increase @@ -1852,6 +2617,10 @@ void acpi_video_unregister(void) } acpi_bus_unregister_driver(&acpi_video_bus); +#ifdef CONFIG_ACPI_PROCFS + remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); +#endif + register_count = 0; return; diff --git a/trunk/drivers/atm/iphase.c b/trunk/drivers/atm/iphase.c index 8cb0347dec28..ee9ddeb53417 100644 --- a/trunk/drivers/atm/iphase.c +++ b/trunk/drivers/atm/iphase.c @@ -3156,6 +3156,7 @@ static int __devinit ia_init_one(struct pci_dev *pdev, { struct atm_dev *dev; IADEV *iadev; + unsigned long flags; int ret; iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); @@ -3187,14 +3188,19 @@ static int __devinit ia_init_one(struct pci_dev *pdev, ia_dev[iadev_count] = iadev; _ia_dev[iadev_count] = dev; iadev_count++; + spin_lock_init(&iadev->misc_lock); + /* First fixes first. I don't want to think about this now. */ + spin_lock_irqsave(&iadev->misc_lock, flags); if (ia_init(dev) || ia_start(dev)) { IF_INIT(printk("IA register failed!\n");) iadev_count--; ia_dev[iadev_count] = NULL; _ia_dev[iadev_count] = NULL; + spin_unlock_irqrestore(&iadev->misc_lock, flags); ret = -EINVAL; goto err_out_deregister_dev; } + spin_unlock_irqrestore(&iadev->misc_lock, flags); IF_EVENT(printk("iadev_count = %d\n", iadev_count);) iadev->next_board = ia_boards; diff --git a/trunk/drivers/atm/iphase.h b/trunk/drivers/atm/iphase.h index 077735e0e04b..b2cd20f549cb 100644 --- a/trunk/drivers/atm/iphase.h +++ b/trunk/drivers/atm/iphase.h @@ -1022,7 +1022,7 @@ typedef struct iadev_t { struct dle_q rx_dle_q; struct free_desc_q *rx_free_desc_qhead; struct sk_buff_head rx_dma_q; - spinlock_t rx_lock; + spinlock_t rx_lock, misc_lock; struct atm_vcc **rx_open; /* list of all open VCs */ u16 num_rx_desc, rx_buf_sz, rxing; u32 rx_pkt_ram, rx_tmp_cnt; diff --git a/trunk/drivers/atm/solos-pci.c b/trunk/drivers/atm/solos-pci.c index f46138ab38b6..f916ddf63938 100644 --- a/trunk/drivers/atm/solos-pci.c +++ b/trunk/drivers/atm/solos-pci.c @@ -444,7 +444,6 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); struct solos_card *card = atmdev->dev_data; struct sk_buff *skb; - unsigned int len; spin_lock(&card->cli_queue_lock); skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); @@ -452,12 +451,11 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, if(skb == NULL) return sprintf(buf, "No data.\n"); - len = skb->len; - memcpy(buf, skb->data, len); - dev_dbg(&card->dev->dev, "len: %d\n", len); + memcpy(buf, skb->data, skb->len); + dev_dbg(&card->dev->dev, "len: %d\n", skb->len); kfree_skb(skb); - return len; + return skb->len; } static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) diff --git a/trunk/drivers/block/ps3disk.c b/trunk/drivers/block/ps3disk.c index 03688c2da319..e9da874d0419 100644 --- a/trunk/drivers/block/ps3disk.c +++ b/trunk/drivers/block/ps3disk.c @@ -113,7 +113,7 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev, memcpy(buf, dev->bounce_buf+offset, size); offset += size; flush_kernel_dcache_page(bvec->bv_page); - bvec_kunmap_irq(buf, &flags); + bvec_kunmap_irq(bvec, &flags); i++; } } diff --git a/trunk/drivers/char/virtio_console.c b/trunk/drivers/char/virtio_console.c index 0f69c5ec0ecd..c810481a5bc2 100644 --- a/trunk/drivers/char/virtio_console.c +++ b/trunk/drivers/char/virtio_console.c @@ -459,12 +459,9 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count, /* * Wait till the host acknowledges it pushed out the data we - * sent. This is done for data from the hvc_console; the tty - * operations are performed with spinlocks held so we can't - * sleep here. An alternative would be to copy the data to a - * buffer and relax the spinning requirement. The downside is - * we need to kmalloc a GFP_ATOMIC buffer each time the - * console driver writes something out. + * sent. This is done for ports in blocking mode or for data + * from the hvc_console; the tty operations are performed with + * spinlocks held so we can't sleep here. */ while (!virtqueue_get_buf(out_vq, &len)) cpu_relax(); @@ -629,14 +626,6 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, goto free_buf; } - /* - * We now ask send_buf() to not spin for generic ports -- we - * can re-use the same code path that non-blocking file - * descriptors take for blocking file descriptors since the - * wait is already done and we're certain the write will go - * through to the host. - */ - nonblock = true; ret = send_buf(port, buf, count, nonblock); if (nonblock && ret > 0) diff --git a/trunk/drivers/dma/ioat/dma_v2.c b/trunk/drivers/dma/ioat/dma_v2.c index effd140fc042..216f9d383b5b 100644 --- a/trunk/drivers/dma/ioat/dma_v2.c +++ b/trunk/drivers/dma/ioat/dma_v2.c @@ -879,7 +879,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) dma->device_issue_pending = ioat2_issue_pending; dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; dma->device_free_chan_resources = ioat2_free_chan_resources; - dma->device_tx_status = ioat_dma_tx_status; + dma->device_tx_status = ioat_tx_status; err = ioat_probe(device); if (err) diff --git a/trunk/drivers/firewire/ohci.c b/trunk/drivers/firewire/ohci.c index 9dcb17d51aee..1b05896648bc 100644 --- a/trunk/drivers/firewire/ohci.c +++ b/trunk/drivers/firewire/ohci.c @@ -2840,7 +2840,7 @@ static int __devinit pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) { struct fw_ohci *ohci; - u32 bus_options, max_receive, link_speed, version; + u32 bus_options, max_receive, link_speed, version, link_enh; u64 guid; int i, err, n_ir, n_it; size_t size; @@ -2894,6 +2894,23 @@ static int __devinit pci_probe(struct pci_dev *dev, if (param_quirks) ohci->quirks = param_quirks; + /* TI OHCI-Lynx and compatible: set recommended configuration bits. */ + if (dev->vendor == PCI_VENDOR_ID_TI) { + pci_read_config_dword(dev, PCI_CFG_TI_LinkEnh, &link_enh); + + /* adjust latency of ATx FIFO: use 1.7 KB threshold */ + link_enh &= ~TI_LinkEnh_atx_thresh_mask; + link_enh |= TI_LinkEnh_atx_thresh_1_7K; + + /* use priority arbitration for asynchronous responses */ + link_enh |= TI_LinkEnh_enab_unfair; + + /* required for aPhyEnhanceEnable to work */ + link_enh |= TI_LinkEnh_enab_accel; + + pci_write_config_dword(dev, PCI_CFG_TI_LinkEnh, link_enh); + } + ar_context_init(&ohci->ar_request_ctx, ohci, OHCI1394_AsReqRcvContextControlSet); diff --git a/trunk/drivers/firewire/ohci.h b/trunk/drivers/firewire/ohci.h index ef5e7336da68..0e6c5a466908 100644 --- a/trunk/drivers/firewire/ohci.h +++ b/trunk/drivers/firewire/ohci.h @@ -155,4 +155,12 @@ #define OHCI1394_phy_tcode 0xe +/* TI extensions */ + +#define PCI_CFG_TI_LinkEnh 0xf4 +#define TI_LinkEnh_enab_accel 0x00000002 +#define TI_LinkEnh_enab_unfair 0x00000080 +#define TI_LinkEnh_atx_thresh_mask 0x00003000 +#define TI_LinkEnh_atx_thresh_1_7K 0x00001000 + #endif /* _FIREWIRE_OHCI_H */ diff --git a/trunk/drivers/gpu/drm/radeon/evergreen.c b/trunk/drivers/gpu/drm/radeon/evergreen.c index 2f93d46ae69a..79082d4398ae 100644 --- a/trunk/drivers/gpu/drm/radeon/evergreen.c +++ b/trunk/drivers/gpu/drm/radeon/evergreen.c @@ -1137,7 +1137,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) WREG32(RCU_IND_INDEX, 0x203); efuse_straps_3 = RREG32(RCU_IND_DATA); - efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28); + efuse_box_bit_127_124 = (u8)(efuse_straps_3 & 0xF0000000) >> 28; switch(efuse_box_bit_127_124) { case 0x0: @@ -1407,7 +1407,6 @@ int evergreen_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; r600_vram_gtt_location(rdev, &rdev->mc); radeon_update_bandwidth_info(rdev); @@ -1521,7 +1520,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev) { u32 tmp; - WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); + WREG32(CP_INT_CNTL, 0); WREG32(GRBM_INT_CNTL, 0); WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); diff --git a/trunk/drivers/gpu/drm/radeon/r100.c b/trunk/drivers/gpu/drm/radeon/r100.c index e59422320bb6..e151f16a8f86 100644 --- a/trunk/drivers/gpu/drm/radeon/r100.c +++ b/trunk/drivers/gpu/drm/radeon/r100.c @@ -1030,7 +1030,6 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) return r; } rdev->cp.ready = true; - rdev->mc.active_vram_size = rdev->mc.real_vram_size; return 0; } @@ -1048,7 +1047,6 @@ void r100_cp_fini(struct radeon_device *rdev) void r100_cp_disable(struct radeon_device *rdev) { /* Disable ring */ - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; rdev->cp.ready = false; WREG32(RADEON_CP_CSQ_MODE, 0); WREG32(RADEON_CP_CSQ_CNTL, 0); @@ -2297,7 +2295,6 @@ void r100_vram_init_sizes(struct radeon_device *rdev) /* FIXME we don't use the second aperture yet when we could use it */ if (rdev->mc.visible_vram_size > rdev->mc.aper_size) rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); if (rdev->flags & RADEON_IS_IGP) { uint32_t tom; diff --git a/trunk/drivers/gpu/drm/radeon/r600.c b/trunk/drivers/gpu/drm/radeon/r600.c index 7b65e4efe8af..7a04959ba0ee 100644 --- a/trunk/drivers/gpu/drm/radeon/r600.c +++ b/trunk/drivers/gpu/drm/radeon/r600.c @@ -1248,7 +1248,6 @@ int r600_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; r600_vram_gtt_location(rdev, &rdev->mc); if (rdev->flags & RADEON_IS_IGP) { @@ -1918,7 +1917,6 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) */ void r600_cp_stop(struct radeon_device *rdev) { - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); } @@ -2912,7 +2910,7 @@ static void r600_disable_interrupt_state(struct radeon_device *rdev) { u32 tmp; - WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); + WREG32(CP_INT_CNTL, 0); WREG32(GRBM_INT_CNTL, 0); WREG32(DxMODE_INT_MASK, 0); if (ASIC_IS_DCE3(rdev)) { diff --git a/trunk/drivers/gpu/drm/radeon/r600_blit_kms.c b/trunk/drivers/gpu/drm/radeon/r600_blit_kms.c index 3473c00781ff..9ceb2a1ce799 100644 --- a/trunk/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/trunk/drivers/gpu/drm/radeon/r600_blit_kms.c @@ -532,7 +532,6 @@ int r600_blit_init(struct radeon_device *rdev) memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); radeon_bo_kunmap(rdev->r600_blit.shader_obj); radeon_bo_unreserve(rdev->r600_blit.shader_obj); - rdev->mc.active_vram_size = rdev->mc.real_vram_size; return 0; } @@ -540,7 +539,6 @@ void r600_blit_fini(struct radeon_device *rdev) { int r; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; if (rdev->r600_blit.shader_obj == NULL) return; /* If we can't reserve the bo, unref should be enough to destroy diff --git a/trunk/drivers/gpu/drm/radeon/radeon.h b/trunk/drivers/gpu/drm/radeon/radeon.h index 9ff38c99a6ea..a168d644bf9e 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon.h +++ b/trunk/drivers/gpu/drm/radeon/radeon.h @@ -344,7 +344,6 @@ struct radeon_mc { * about vram size near mc fb location */ u64 mc_vram_size; u64 visible_vram_size; - u64 active_vram_size; u64 gtt_size; u64 gtt_start; u64 gtt_end; diff --git a/trunk/drivers/gpu/drm/radeon/radeon_atombios.c b/trunk/drivers/gpu/drm/radeon/radeon_atombios.c index 8e43ddae70cc..68932ba7b8a4 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_atombios.c @@ -1558,39 +1558,39 @@ radeon_atombios_get_tv_info(struct radeon_device *rdev) switch (tv_info->ucTV_BootUpDefaultStandard) { case ATOM_TV_NTSC: tv_std = TV_STD_NTSC; - DRM_DEBUG_KMS("Default TV standard: NTSC\n"); + DRM_INFO("Default TV standard: NTSC\n"); break; case ATOM_TV_NTSCJ: tv_std = TV_STD_NTSC_J; - DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); + DRM_INFO("Default TV standard: NTSC-J\n"); break; case ATOM_TV_PAL: tv_std = TV_STD_PAL; - DRM_DEBUG_KMS("Default TV standard: PAL\n"); + DRM_INFO("Default TV standard: PAL\n"); break; case ATOM_TV_PALM: tv_std = TV_STD_PAL_M; - DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); + DRM_INFO("Default TV standard: PAL-M\n"); break; case ATOM_TV_PALN: tv_std = TV_STD_PAL_N; - DRM_DEBUG_KMS("Default TV standard: PAL-N\n"); + DRM_INFO("Default TV standard: PAL-N\n"); break; case ATOM_TV_PALCN: tv_std = TV_STD_PAL_CN; - DRM_DEBUG_KMS("Default TV standard: PAL-CN\n"); + DRM_INFO("Default TV standard: PAL-CN\n"); break; case ATOM_TV_PAL60: tv_std = TV_STD_PAL_60; - DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); + DRM_INFO("Default TV standard: PAL-60\n"); break; case ATOM_TV_SECAM: tv_std = TV_STD_SECAM; - DRM_DEBUG_KMS("Default TV standard: SECAM\n"); + DRM_INFO("Default TV standard: SECAM\n"); break; default: tv_std = TV_STD_NTSC; - DRM_DEBUG_KMS("Unknown TV standard; defaulting to NTSC\n"); + DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); break; } } diff --git a/trunk/drivers/gpu/drm/radeon/radeon_combios.c b/trunk/drivers/gpu/drm/radeon/radeon_combios.c index 7b7ea269549c..a04b7a6ad95f 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_combios.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_combios.c @@ -913,47 +913,47 @@ radeon_combios_get_tv_info(struct radeon_device *rdev) switch (RBIOS8(tv_info + 7) & 0xf) { case 1: tv_std = TV_STD_NTSC; - DRM_DEBUG_KMS("Default TV standard: NTSC\n"); + DRM_INFO("Default TV standard: NTSC\n"); break; case 2: tv_std = TV_STD_PAL; - DRM_DEBUG_KMS("Default TV standard: PAL\n"); + DRM_INFO("Default TV standard: PAL\n"); break; case 3: tv_std = TV_STD_PAL_M; - DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); + DRM_INFO("Default TV standard: PAL-M\n"); break; case 4: tv_std = TV_STD_PAL_60; - DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); + DRM_INFO("Default TV standard: PAL-60\n"); break; case 5: tv_std = TV_STD_NTSC_J; - DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); + DRM_INFO("Default TV standard: NTSC-J\n"); break; case 6: tv_std = TV_STD_SCART_PAL; - DRM_DEBUG_KMS("Default TV standard: SCART-PAL\n"); + DRM_INFO("Default TV standard: SCART-PAL\n"); break; default: tv_std = TV_STD_NTSC; - DRM_DEBUG_KMS + DRM_INFO ("Unknown TV standard; defaulting to NTSC\n"); break; } switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { case 0: - DRM_DEBUG_KMS("29.498928713 MHz TV ref clk\n"); + DRM_INFO("29.498928713 MHz TV ref clk\n"); break; case 1: - DRM_DEBUG_KMS("28.636360000 MHz TV ref clk\n"); + DRM_INFO("28.636360000 MHz TV ref clk\n"); break; case 2: - DRM_DEBUG_KMS("14.318180000 MHz TV ref clk\n"); + DRM_INFO("14.318180000 MHz TV ref clk\n"); break; case 3: - DRM_DEBUG_KMS("27.000000000 MHz TV ref clk\n"); + DRM_INFO("27.000000000 MHz TV ref clk\n"); break; default: break; @@ -1324,7 +1324,7 @@ bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, if (tmds_info) { ver = RBIOS8(tmds_info); - DRM_DEBUG_KMS("DFP table revision: %d\n", ver); + DRM_INFO("DFP table revision: %d\n", ver); if (ver == 3) { n = RBIOS8(tmds_info + 5) + 1; if (n > 4) @@ -1408,7 +1408,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); if (offset) { ver = RBIOS8(offset); - DRM_DEBUG_KMS("External TMDS Table revision: %d\n", ver); + DRM_INFO("External TMDS Table revision: %d\n", ver); tmds->slave_addr = RBIOS8(offset + 4 + 2); tmds->slave_addr >>= 1; /* 7 bit addressing */ gpio = RBIOS8(offset + 4 + 3); diff --git a/trunk/drivers/gpu/drm/radeon/radeon_cursor.c b/trunk/drivers/gpu/drm/radeon/radeon_cursor.c index 3eef567b0421..5731fc9b1ae3 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_cursor.c @@ -203,7 +203,6 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); struct radeon_device *rdev = crtc->dev->dev_private; int xorigin = 0, yorigin = 0; - int w = radeon_crtc->cursor_width; if (x < 0) xorigin = -x + 1; @@ -214,7 +213,22 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, if (yorigin >= CURSOR_HEIGHT) yorigin = CURSOR_HEIGHT - 1; - if (ASIC_IS_AVIVO(rdev)) { + radeon_lock_cursor(crtc, true); + if (ASIC_IS_DCE4(rdev)) { + /* cursors are offset into the total surface */ + x += crtc->x; + y += crtc->y; + DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y); + + /* XXX: check if evergreen has the same issues as avivo chips */ + WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, + ((xorigin ? 0 : x) << 16) | + (yorigin ? 0 : y)); + WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); + WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, + ((radeon_crtc->cursor_width - 1) << 16) | (radeon_crtc->cursor_height - 1)); + } else if (ASIC_IS_AVIVO(rdev)) { + int w = radeon_crtc->cursor_width; int i = 0; struct drm_crtc *crtc_p; @@ -246,17 +260,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, if (w <= 0) w = 1; } - } - radeon_lock_cursor(crtc, true); - if (ASIC_IS_DCE4(rdev)) { - WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, - ((xorigin ? 0 : x) << 16) | - (yorigin ? 0 : y)); - WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); - WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, - ((w - 1) << 16) | (radeon_crtc->cursor_height - 1)); - } else if (ASIC_IS_AVIVO(rdev)) { WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y)); diff --git a/trunk/drivers/gpu/drm/radeon/radeon_object.c b/trunk/drivers/gpu/drm/radeon/radeon_object.c index b3b5306bb578..0afd1e62347d 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_object.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_object.c @@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) u32 c = 0; rbo->placement.fpfn = 0; - rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; + rbo->placement.lpfn = 0; rbo->placement.placement = rbo->placements; rbo->placement.busy_placement = rbo->placements; if (domain & RADEON_GEM_DOMAIN_VRAM) diff --git a/trunk/drivers/gpu/drm/radeon/radeon_object.h b/trunk/drivers/gpu/drm/radeon/radeon_object.h index 3481bc7f6f58..353998dc2c03 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_object.h +++ b/trunk/drivers/gpu/drm/radeon/radeon_object.h @@ -124,8 +124,11 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, int r; r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); - if (unlikely(r != 0)) + if (unlikely(r != 0)) { + if (r != -ERESTARTSYS) + dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo); return r; + } spin_lock(&bo->tbo.lock); if (mem_type) *mem_type = bo->tbo.mem.mem_type; diff --git a/trunk/drivers/gpu/drm/radeon/rs600.c b/trunk/drivers/gpu/drm/radeon/rs600.c index 51d5f7b5ab21..cc05b230d7ef 100644 --- a/trunk/drivers/gpu/drm/radeon/rs600.c +++ b/trunk/drivers/gpu/drm/radeon/rs600.c @@ -693,7 +693,6 @@ void rs600_mc_init(struct radeon_device *rdev) rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); rdev->mc.mc_vram_size = rdev->mc.real_vram_size; rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); base = RREG32_MC(R_000004_MC_FB_LOCATION); base = G_000004_MC_FB_START(base) << 16; diff --git a/trunk/drivers/gpu/drm/radeon/rs690.c b/trunk/drivers/gpu/drm/radeon/rs690.c index 4dc2a87ea680..3e3f75718be3 100644 --- a/trunk/drivers/gpu/drm/radeon/rs690.c +++ b/trunk/drivers/gpu/drm/radeon/rs690.c @@ -157,7 +157,6 @@ void rs690_mc_init(struct radeon_device *rdev) rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); base = G_000100_MC_FB_START(base) << 16; rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); diff --git a/trunk/drivers/gpu/drm/radeon/rv770.c b/trunk/drivers/gpu/drm/radeon/rv770.c index 9490da700749..bfa59db374d2 100644 --- a/trunk/drivers/gpu/drm/radeon/rv770.c +++ b/trunk/drivers/gpu/drm/radeon/rv770.c @@ -267,7 +267,6 @@ static void rv770_mc_program(struct radeon_device *rdev) */ void r700_cp_stop(struct radeon_device *rdev) { - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); } @@ -993,7 +992,6 @@ int rv770_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); rdev->mc.visible_vram_size = rdev->mc.aper_size; - rdev->mc.active_vram_size = rdev->mc.visible_vram_size; r600_vram_gtt_location(rdev, &rdev->mc); radeon_update_bandwidth_info(rdev); diff --git a/trunk/drivers/hid/hid-cando.c b/trunk/drivers/hid/hid-cando.c index 5925bdcd417d..4267a6fdc277 100644 --- a/trunk/drivers/hid/hid-cando.c +++ b/trunk/drivers/hid/hid-cando.c @@ -237,8 +237,6 @@ static const struct hid_device_id cando_devices[] = { USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, - USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, { } }; MODULE_DEVICE_TABLE(hid, cando_devices); diff --git a/trunk/drivers/hid/hid-core.c b/trunk/drivers/hid/hid-core.c index a0dea3d1296e..3f7292486024 100644 --- a/trunk/drivers/hid/hid-core.c +++ b/trunk/drivers/hid/hid-core.c @@ -1292,7 +1292,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, diff --git a/trunk/drivers/hid/hid-ids.h b/trunk/drivers/hid/hid-ids.h index c5ae5f1545bd..765a4f53eb5c 100644 --- a/trunk/drivers/hid/hid-ids.h +++ b/trunk/drivers/hid/hid-ids.h @@ -134,7 +134,6 @@ #define USB_VENDOR_ID_CANDO 0x2087 #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 -#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 #define USB_VENDOR_ID_CH 0x068e #define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 @@ -504,7 +503,6 @@ #define USB_VENDOR_ID_TURBOX 0x062a #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 -#define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 #define USB_VENDOR_ID_TWINHAN 0x6253 #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 diff --git a/trunk/drivers/hid/hidraw.c b/trunk/drivers/hid/hidraw.c index a3866b5c0c43..47d70c523d93 100644 --- a/trunk/drivers/hid/hidraw.c +++ b/trunk/drivers/hid/hidraw.c @@ -109,12 +109,6 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t int ret = 0; mutex_lock(&minors_lock); - - if (!hidraw_table[minor]) { - ret = -ENODEV; - goto out; - } - dev = hidraw_table[minor]->hid; if (!dev->hid_output_raw_report) { @@ -250,10 +244,6 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, mutex_lock(&minors_lock); dev = hidraw_table[minor]; - if (!dev) { - ret = -ENODEV; - goto out; - } switch (cmd) { case HIDIOCGRDESCSIZE: @@ -327,7 +317,6 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, ret = -ENOTTY; } -out: mutex_unlock(&minors_lock); return ret; } diff --git a/trunk/drivers/hid/usbhid/hid-quirks.c b/trunk/drivers/hid/usbhid/hid-quirks.c index f0260c699adb..70da3181c8a0 100644 --- a/trunk/drivers/hid/usbhid/hid-quirks.c +++ b/trunk/drivers/hid/usbhid/hid-quirks.c @@ -36,7 +36,6 @@ static const struct hid_blacklist { { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, diff --git a/trunk/drivers/i2c/busses/i2c-davinci.c b/trunk/drivers/i2c/busses/i2c-davinci.c index 5795c8398c7c..b8feac5f2ef4 100644 --- a/trunk/drivers/i2c/busses/i2c-davinci.c +++ b/trunk/drivers/i2c/busses/i2c-davinci.c @@ -331,16 +331,21 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) INIT_COMPLETION(dev->cmd_complete); dev->cmd_err = 0; - /* Take I2C out of reset and configure it as master */ - flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST; + /* Take I2C out of reset, configure it as master and set the + * start bit */ + flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT; /* if the slave address is ten bit address, enable XA bit */ if (msg->flags & I2C_M_TEN) flag |= DAVINCI_I2C_MDR_XA; if (!(msg->flags & I2C_M_RD)) flag |= DAVINCI_I2C_MDR_TRX; - if (msg->len == 0) + if (stop) + flag |= DAVINCI_I2C_MDR_STP; + if (msg->len == 0) { flag |= DAVINCI_I2C_MDR_RM; + flag &= ~DAVINCI_I2C_MDR_STP; + } /* Enable receive or transmit interrupts */ w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG); @@ -352,29 +357,18 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) dev->terminate = 0; - /* - * Write mode register first as needed for correct behaviour - * on OMAP-L138, but don't set STT yet to avoid a race with XRDY - * occuring before we have loaded DXR - */ - davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); - /* * First byte should be set here, not after interrupt, * because transmit-data-ready interrupt can come before * NACK-interrupt during sending of previous message and * ICDXR may have wrong data - * It also saves us one interrupt, slightly faster */ if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) { davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++); dev->buf_len--; } - /* Set STT to begin transmit now DXR is loaded */ - flag |= DAVINCI_I2C_MDR_STT; - if (stop && msg->len != 0) - flag |= DAVINCI_I2C_MDR_STP; + /* write the data into mode register; start transmitting */ davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, diff --git a/trunk/drivers/i2c/busses/i2c-imx.c b/trunk/drivers/i2c/busses/i2c-imx.c index 4c2a62b75b5c..d1ff9408dc1f 100644 --- a/trunk/drivers/i2c/busses/i2c-imx.c +++ b/trunk/drivers/i2c/busses/i2c-imx.c @@ -159,9 +159,15 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) { - wait_event_timeout(i2c_imx->queue, i2c_imx->i2csr & I2SR_IIF, HZ / 10); + int result; + + result = wait_event_interruptible_timeout(i2c_imx->queue, + i2c_imx->i2csr & I2SR_IIF, HZ / 10); - if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { + if (unlikely(result < 0)) { + dev_dbg(&i2c_imx->adapter.dev, "<%s> result < 0\n", __func__); + return result; + } else if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); return -ETIMEDOUT; } @@ -289,7 +295,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) i2c_imx->i2csr = temp; temp &= ~I2SR_IIF; writeb(temp, i2c_imx->base + IMX_I2C_I2SR); - wake_up(&i2c_imx->queue); + wake_up_interruptible(&i2c_imx->queue); return IRQ_HANDLED; } diff --git a/trunk/drivers/input/evdev.c b/trunk/drivers/input/evdev.c index 9ddafc30f432..c908c5f83645 100644 --- a/trunk/drivers/input/evdev.c +++ b/trunk/drivers/input/evdev.c @@ -669,9 +669,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { - if (!dev->absinfo) - return -EINVAL; - t = _IOC_NR(cmd) & ABS_MAX; abs = dev->absinfo[t]; @@ -683,13 +680,10 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, } } - if (_IOC_DIR(cmd) == _IOC_WRITE) { + if (_IOC_DIR(cmd) == _IOC_READ) { if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { - if (!dev->absinfo) - return -EINVAL; - t = _IOC_NR(cmd) & ABS_MAX; if (copy_from_user(&abs, p, min_t(size_t, diff --git a/trunk/drivers/media/video/v4l2-compat-ioctl32.c b/trunk/drivers/media/video/v4l2-compat-ioctl32.c index 86294ed35c9b..073f01390cdd 100644 --- a/trunk/drivers/media/video/v4l2-compat-ioctl32.c +++ b/trunk/drivers/media/video/v4l2-compat-ioctl32.c @@ -193,24 +193,17 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u struct video_code32 { char loadwhat[16]; /* name or tag of file being passed */ compat_int_t datasize; - compat_uptr_t data; + unsigned char *data; }; -static struct video_code __user *get_microcode32(struct video_code32 *kp) +static int get_microcode32(struct video_code *kp, struct video_code32 __user *up) { - struct video_code __user *up; - - up = compat_alloc_user_space(sizeof(*up)); - - /* - * NOTE! We don't actually care if these fail. If the - * user address is invalid, the native ioctl will do - * the error handling for us - */ - (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); - (void) put_user(kp->datasize, &up->datasize); - (void) put_user(compat_ptr(kp->data), &up->data); - return up; + if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || + copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) || + get_user(kp->datasize, &up->datasize) || + copy_from_user(kp->data, up->data, up->datasize)) + return -EFAULT; + return 0; } #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) @@ -746,7 +739,7 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar struct video_tuner vt; struct video_buffer vb; struct video_window vw; - struct video_code32 vc; + struct video_code vc; struct video_audio va; #endif struct v4l2_format v2f; @@ -825,11 +818,8 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar break; case VIDIOCSMICROCODE: - /* Copy the 32-bit "video_code32" to kernel space */ - if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) - return -EFAULT; - /* Convert the 32-bit version to a 64-bit version in user space */ - up = get_microcode32(&karg.vc); + err = get_microcode32(&karg.vc, up); + compatible_arg = 0; break; case VIDIOCSFREQ: diff --git a/trunk/drivers/mmc/core/core.c b/trunk/drivers/mmc/core/core.c index 09eee6df0653..5db49b124ffa 100644 --- a/trunk/drivers/mmc/core/core.c +++ b/trunk/drivers/mmc/core/core.c @@ -1631,19 +1631,6 @@ int mmc_suspend_host(struct mmc_host *host) if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); - if (err == -ENOSYS || !host->bus_ops->resume) { - /* - * We simply "remove" the card in this case. - * It will be redetected on resume. - */ - if (host->bus_ops->remove) - host->bus_ops->remove(host); - mmc_claim_host(host); - mmc_detach_bus(host); - mmc_release_host(host); - host->pm_flags = 0; - err = 0; - } } mmc_bus_put(host); diff --git a/trunk/drivers/mtd/nand/mxc_nand.c b/trunk/drivers/mtd/nand/mxc_nand.c index 214b03afdd48..b2828e84d243 100644 --- a/trunk/drivers/mtd/nand/mxc_nand.c +++ b/trunk/drivers/mtd/nand/mxc_nand.c @@ -30,8 +30,6 @@ #include #include #include -#include -#include #include #include @@ -153,7 +151,7 @@ struct mxc_nand_host { int irq; int eccsize; - struct completion op_completion; + wait_queue_head_t irq_waitq; uint8_t *data_buf; unsigned int buf_start; @@ -166,7 +164,6 @@ struct mxc_nand_host { void (*send_read_id)(struct mxc_nand_host *); uint16_t (*get_dev_status)(struct mxc_nand_host *); int (*check_int)(struct mxc_nand_host *); - void (*irq_control)(struct mxc_nand_host *, int); }; /* OOB placement block for use with hardware ecc generation */ @@ -219,12 +216,9 @@ static irqreturn_t mxc_nfc_irq(int irq, void *dev_id) { struct mxc_nand_host *host = dev_id; - if (!host->check_int(host)) - return IRQ_NONE; + disable_irq_nosync(irq); - host->irq_control(host, 0); - - complete(&host->op_completion); + wake_up(&host->irq_waitq); return IRQ_HANDLED; } @@ -251,54 +245,11 @@ static int check_int_v1_v2(struct mxc_nand_host *host) if (!(tmp & NFC_V1_V2_CONFIG2_INT)) return 0; - if (!cpu_is_mx21()) - writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); + writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); return 1; } -/* - * It has been observed that the i.MX21 cannot read the CONFIG2:INT bit - * if interrupts are masked (CONFIG1:INT_MSK is set). To handle this, the - * driver can enable/disable the irq line rather than simply masking the - * interrupts. - */ -static void irq_control_mx21(struct mxc_nand_host *host, int activate) -{ - if (activate) - enable_irq(host->irq); - else - disable_irq_nosync(host->irq); -} - -static void irq_control_v1_v2(struct mxc_nand_host *host, int activate) -{ - uint16_t tmp; - - tmp = readw(NFC_V1_V2_CONFIG1); - - if (activate) - tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK; - else - tmp |= NFC_V1_V2_CONFIG1_INT_MSK; - - writew(tmp, NFC_V1_V2_CONFIG1); -} - -static void irq_control_v3(struct mxc_nand_host *host, int activate) -{ - uint32_t tmp; - - tmp = readl(NFC_V3_CONFIG2); - - if (activate) - tmp &= ~NFC_V3_CONFIG2_INT_MSK; - else - tmp |= NFC_V3_CONFIG2_INT_MSK; - - writel(tmp, NFC_V3_CONFIG2); -} - /* This function polls the NANDFC to wait for the basic operation to * complete by checking the INT bit of config2 register. */ @@ -308,9 +259,10 @@ static void wait_op_done(struct mxc_nand_host *host, int useirq) if (useirq) { if (!host->check_int(host)) { - INIT_COMPLETION(host->op_completion); - host->irq_control(host, 1); - wait_for_completion(&host->op_completion); + + enable_irq(host->irq); + + wait_event(host->irq_waitq, host->check_int(host)); } } else { while (max_retries-- > 0) { @@ -847,7 +799,6 @@ static void preset_v3(struct mtd_info *mtd) NFC_V3_CONFIG2_2CMD_PHASES | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | NFC_V3_CONFIG2_ST_CMD(0x70) | - NFC_V3_CONFIG2_INT_MSK | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; if (chip->ecc.mode == NAND_ECC_HW) @@ -1073,10 +1024,6 @@ static int __init mxcnd_probe(struct platform_device *pdev) host->send_read_id = send_read_id_v1_v2; host->get_dev_status = get_dev_status_v1_v2; host->check_int = check_int_v1_v2; - if (cpu_is_mx21()) - host->irq_control = irq_control_mx21; - else - host->irq_control = irq_control_v1_v2; } if (nfc_is_v21()) { @@ -1115,7 +1062,6 @@ static int __init mxcnd_probe(struct platform_device *pdev) host->send_read_id = send_read_id_v3; host->check_int = check_int_v3; host->get_dev_status = get_dev_status_v3; - host->irq_control = irq_control_v3; oob_smallpage = &nandv2_hw_eccoob_smallpage; oob_largepage = &nandv2_hw_eccoob_largepage; } else @@ -1147,34 +1093,14 @@ static int __init mxcnd_probe(struct platform_device *pdev) this->options |= NAND_USE_FLASH_BBT; } - init_completion(&host->op_completion); + init_waitqueue_head(&host->irq_waitq); host->irq = platform_get_irq(pdev, 0); - /* - * mask the interrupt. For i.MX21 explicitely call - * irq_control_v1_v2 to use the mask bit. We can't call - * disable_irq_nosync() for an interrupt we do not own yet. - */ - if (cpu_is_mx21()) - irq_control_v1_v2(host, 0); - else - host->irq_control(host, 0); - err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host); if (err) goto eirq; - host->irq_control(host, 0); - - /* - * Now that the interrupt is disabled make sure the interrupt - * mask bit is cleared on i.MX21. Otherwise we can't read - * the interrupt status bit on this machine. - */ - if (cpu_is_mx21()) - irq_control_v1_v2(host, 1); - /* first scan to find the device and get the page size */ if (nand_scan_ident(mtd, 1, NULL)) { err = -ENXIO; diff --git a/trunk/drivers/net/b44.c b/trunk/drivers/net/b44.c index efeffdf9e5fa..1e620e287ae0 100644 --- a/trunk/drivers/net/b44.c +++ b/trunk/drivers/net/b44.c @@ -2170,6 +2170,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, dev->irq = sdev->irq; SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); + netif_carrier_off(dev); + err = ssb_bus_powerup(sdev->bus, 0); if (err) { dev_err(sdev->dev, @@ -2211,8 +2213,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, goto err_out_powerdown; } - netif_carrier_off(dev); - ssb_set_drvdata(sdev, dev); /* Chip reset provides power to the b44 MAC & PCI cores, which diff --git a/trunk/drivers/net/ehea/ehea_main.c b/trunk/drivers/net/ehea/ehea_main.c index 6372610ed240..a333b42111b8 100644 --- a/trunk/drivers/net/ehea/ehea_main.c +++ b/trunk/drivers/net/ehea/ehea_main.c @@ -533,15 +533,8 @@ static inline void ehea_fill_skb(struct net_device *dev, int length = cqe->num_bytes_transfered - 4; /*remove CRC */ skb_put(skb, length); + skb->ip_summed = CHECKSUM_UNNECESSARY; skb->protocol = eth_type_trans(skb, dev); - - /* The packet was not an IPV4 packet so a complemented checksum was - calculated. The value is found in the Internet Checksum field. */ - if (cqe->status & EHEA_CQE_BLIND_CKSUM) { - skb->ip_summed = CHECKSUM_COMPLETE; - skb->csum = csum_unfold(~cqe->inet_checksum_value); - } else - skb->ip_summed = CHECKSUM_UNNECESSARY; } static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, diff --git a/trunk/drivers/net/ehea/ehea_qmr.h b/trunk/drivers/net/ehea/ehea_qmr.h index 38104734a3be..f608a6c54af5 100644 --- a/trunk/drivers/net/ehea/ehea_qmr.h +++ b/trunk/drivers/net/ehea/ehea_qmr.h @@ -150,7 +150,6 @@ struct ehea_rwqe { #define EHEA_CQE_TYPE_RQ 0x60 #define EHEA_CQE_STAT_ERR_MASK 0x700F #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF -#define EHEA_CQE_BLIND_CKSUM 0x8000 #define EHEA_CQE_STAT_ERR_TCP 0x4000 #define EHEA_CQE_STAT_ERR_IP 0x2000 #define EHEA_CQE_STAT_ERR_CRC 0x1000 diff --git a/trunk/drivers/net/fec.c b/trunk/drivers/net/fec.c index cce32d43175f..768b840aeb6b 100644 --- a/trunk/drivers/net/fec.c +++ b/trunk/drivers/net/fec.c @@ -678,37 +678,24 @@ static int fec_enet_mii_probe(struct net_device *dev) { struct fec_enet_private *fep = netdev_priv(dev); struct phy_device *phy_dev = NULL; - char mdio_bus_id[MII_BUS_ID_SIZE]; - char phy_name[MII_BUS_ID_SIZE + 3]; - int phy_id; + int ret; fep->phy_dev = NULL; - /* check for attached phy */ - for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { - if ((fep->mii_bus->phy_mask & (1 << phy_id))) - continue; - if (fep->mii_bus->phy_map[phy_id] == NULL) - continue; - if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) - continue; - strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); - break; - } - - if (phy_id >= PHY_MAX_ADDR) { - printk(KERN_INFO "%s: no PHY, assuming direct connection " - "to switch\n", dev->name); - strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); - phy_id = 0; + /* find the first phy */ + phy_dev = phy_find_first(fep->mii_bus); + if (!phy_dev) { + printk(KERN_ERR "%s: no PHY found\n", dev->name); + return -ENODEV; } - snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); - phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0, - PHY_INTERFACE_MODE_MII); - if (IS_ERR(phy_dev)) { - printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); - return PTR_ERR(phy_dev); + /* attach the mac to the phy */ + ret = phy_connect_direct(dev, phy_dev, + &fec_enet_adjust_link, 0, + PHY_INTERFACE_MODE_MII); + if (ret) { + printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); + return ret; } /* mask with MAC supported features */ @@ -751,7 +738,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) fep->mii_bus->read = fec_enet_mdio_read; fep->mii_bus->write = fec_enet_mdio_write; fep->mii_bus->reset = fec_enet_mdio_reset; - snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1); + snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); fep->mii_bus->priv = fep; fep->mii_bus->parent = &pdev->dev; @@ -1324,9 +1311,6 @@ fec_probe(struct platform_device *pdev) if (ret) goto failed_mii_init; - /* Carrier starts down, phylib will bring it up */ - netif_carrier_off(ndev); - ret = register_netdev(ndev); if (ret) goto failed_register; diff --git a/trunk/drivers/net/r8169.c b/trunk/drivers/net/r8169.c index 992db2fa136e..a0da4a17b025 100644 --- a/trunk/drivers/net/r8169.c +++ b/trunk/drivers/net/r8169.c @@ -1212,8 +1212,7 @@ static void rtl8169_update_counters(struct net_device *dev) if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) return; - counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters), - &paddr, GFP_KERNEL); + counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); if (!counters) return; @@ -1234,8 +1233,7 @@ static void rtl8169_update_counters(struct net_device *dev) RTL_W32(CounterAddrLow, 0); RTL_W32(CounterAddrHigh, 0); - dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters, - paddr); + pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); } static void rtl8169_get_ethtool_stats(struct net_device *dev, @@ -3294,15 +3292,15 @@ static int rtl8169_open(struct net_device *dev) /* * Rx and Tx desscriptors needs 256 bytes alignment. - * dma_alloc_coherent provides more. + * pci_alloc_consistent provides more. */ - tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES, - &tp->TxPhyAddr, GFP_KERNEL); + tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, + &tp->TxPhyAddr); if (!tp->TxDescArray) goto err_pm_runtime_put; - tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES, - &tp->RxPhyAddr, GFP_KERNEL); + tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, + &tp->RxPhyAddr); if (!tp->RxDescArray) goto err_free_tx_0; @@ -3336,12 +3334,12 @@ static int rtl8169_open(struct net_device *dev) err_release_ring_2: rtl8169_rx_clear(tp); err_free_rx_1: - dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, - tp->RxPhyAddr); + pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, + tp->RxPhyAddr); tp->RxDescArray = NULL; err_free_tx_0: - dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, - tp->TxPhyAddr); + pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, + tp->TxPhyAddr); tp->TxDescArray = NULL; err_pm_runtime_put: pm_runtime_put_noidle(&pdev->dev); @@ -3977,7 +3975,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp, { struct pci_dev *pdev = tp->pci_dev; - dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz, + pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, PCI_DMA_FROMDEVICE); dev_kfree_skb(*sk_buff); *sk_buff = NULL; @@ -4002,7 +4000,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev, struct RxDesc *desc, int rx_buf_sz, - unsigned int align, gfp_t gfp) + unsigned int align) { struct sk_buff *skb; dma_addr_t mapping; @@ -4010,13 +4008,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, pad = align ? align : NET_IP_ALIGN; - skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp); + skb = netdev_alloc_skb(dev, rx_buf_sz + pad); if (!skb) goto err_out; skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); - mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz, + mapping = pci_map_single(pdev, skb->data, rx_buf_sz, PCI_DMA_FROMDEVICE); rtl8169_map_to_asic(desc, mapping, rx_buf_sz); @@ -4041,7 +4039,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) } static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, - u32 start, u32 end, gfp_t gfp) + u32 start, u32 end) { u32 cur; @@ -4056,7 +4054,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, tp->RxDescArray + i, - tp->rx_buf_sz, tp->align, gfp); + tp->rx_buf_sz, tp->align); if (!skb) break; @@ -4084,7 +4082,7 @@ static int rtl8169_init_ring(struct net_device *dev) memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); - if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC) + if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) goto err_out; rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); @@ -4101,8 +4099,7 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, { unsigned int len = tx_skb->len; - dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, - PCI_DMA_TODEVICE); + pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); desc->opts1 = 0x00; desc->opts2 = 0x00; desc->addr = 0x00; @@ -4246,8 +4243,7 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, txd = tp->TxDescArray + entry; len = frag->size; addr = ((void *) page_address(frag->page)) + frag->page_offset; - mapping = dma_map_single(&tp->pci_dev->dev, addr, len, - PCI_DMA_TODEVICE); + mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); /* anti gcc 2.95.3 bugware (sic) */ status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); @@ -4317,8 +4313,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, tp->tx_skb[entry].skb = skb; } - mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, - PCI_DMA_TODEVICE); + mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); tp->tx_skb[entry].len = len; txd->addr = cpu_to_le64(mapping); @@ -4482,8 +4477,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, if (!skb) goto out; - dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size, - PCI_DMA_FROMDEVICE); + pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, + PCI_DMA_FROMDEVICE); skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); *sk_buff = skb; done = true; @@ -4554,11 +4549,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev, rtl8169_rx_csum(skb, desc); if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { - dma_sync_single_for_device(&pdev->dev, addr, + pci_dma_sync_single_for_device(pdev, addr, pkt_size, PCI_DMA_FROMDEVICE); rtl8169_mark_to_asic(desc, tp->rx_buf_sz); } else { - dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz, + pci_unmap_single(pdev, addr, tp->rx_buf_sz, PCI_DMA_FROMDEVICE); tp->Rx_skbuff[entry] = NULL; } @@ -4588,7 +4583,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, count = cur_rx - tp->cur_rx; tp->cur_rx = cur_rx; - delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC); + delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); if (!delta && count) netif_info(tp, intr, dev, "no Rx buffer allocated\n"); tp->dirty_rx += delta; @@ -4774,10 +4769,10 @@ static int rtl8169_close(struct net_device *dev) free_irq(dev->irq, dev); - dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, - tp->RxPhyAddr); - dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, - tp->TxPhyAddr); + pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, + tp->RxPhyAddr); + pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, + tp->TxPhyAddr); tp->TxDescArray = NULL; tp->RxDescArray = NULL; diff --git a/trunk/drivers/net/tg3.c b/trunk/drivers/net/tg3.c index 1ec4b9e0239a..bc3af78a869f 100644 --- a/trunk/drivers/net/tg3.c +++ b/trunk/drivers/net/tg3.c @@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) desc_idx, *post_ptr); drop_it_no_recycle: /* Other statistics kept track of by card. */ - tp->rx_dropped++; + tp->net_stats.rx_dropped++; goto next_pkt; } @@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) if (len > (tp->dev->mtu + ETH_HLEN) && skb->protocol != htons(ETH_P_8021Q)) { dev_kfree_skb(skb); - goto drop_it_no_recycle; + goto next_pkt; } if (desc->type_flags & RXD_FLAG_VLAN && @@ -9240,8 +9240,6 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, stats->rx_missed_errors = old_stats->rx_missed_errors + get_stat64(&hw_stats->rx_discards); - stats->rx_dropped = tp->rx_dropped; - return stats; } diff --git a/trunk/drivers/net/tg3.h b/trunk/drivers/net/tg3.h index be7ff138a7f9..4937bd190964 100644 --- a/trunk/drivers/net/tg3.h +++ b/trunk/drivers/net/tg3.h @@ -2759,7 +2759,7 @@ struct tg3 { /* begin "everything else" cacheline(s) section */ - unsigned long rx_dropped; + struct rtnl_link_stats64 net_stats; struct rtnl_link_stats64 net_stats_prev; struct tg3_ethtool_stats estats; struct tg3_ethtool_stats estats_prev; diff --git a/trunk/drivers/net/wimax/i2400m/rx.c b/trunk/drivers/net/wimax/i2400m/rx.c index 1737d1488b35..8cc9e319f435 100644 --- a/trunk/drivers/net/wimax/i2400m/rx.c +++ b/trunk/drivers/net/wimax/i2400m/rx.c @@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) int i, result; struct device *dev = i2400m_dev(i2400m); const struct i2400m_msg_hdr *msg_hdr; - size_t pl_itr, pl_size; + size_t pl_itr, pl_size, skb_len; unsigned long flags; - unsigned num_pls, single_last, skb_len; + unsigned num_pls, single_last; skb_len = skb->len; - d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n", + d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", i2400m, skb, skb_len); result = -EIO; msg_hdr = (void *) skb->data; - result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len); + result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); if (result < 0) goto error_msg_hdr_check; result = -EIO; @@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ num_pls * sizeof(msg_hdr->pld[0]); pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); - if (pl_itr > skb_len) { /* got all the payload descriptors? */ + if (pl_itr > skb->len) { /* got all the payload descriptors? */ dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " "%u payload descriptors (%zu each, total %zu)\n", - skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); + skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); goto error_pl_descr_short; } /* Walk each payload payload--check we really got it */ @@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) /* work around old gcc warnings */ pl_size = i2400m_pld_size(&msg_hdr->pld[i]); result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], - pl_itr, skb_len); + pl_itr, skb->len); if (result < 0) goto error_pl_descr_check; single_last = num_pls == 1 || i == num_pls - 1; @@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) if (i < i2400m->rx_pl_min) i2400m->rx_pl_min = i; i2400m->rx_num++; - i2400m->rx_size_acc += skb_len; - if (skb_len < i2400m->rx_size_min) - i2400m->rx_size_min = skb_len; - if (skb_len > i2400m->rx_size_max) - i2400m->rx_size_max = skb_len; + i2400m->rx_size_acc += skb->len; + if (skb->len < i2400m->rx_size_min) + i2400m->rx_size_min = skb->len; + if (skb->len > i2400m->rx_size_max) + i2400m->rx_size_max = skb->len; spin_unlock_irqrestore(&i2400m->rx_lock, flags); error_pl_descr_check: error_pl_descr_short: error_msg_hdr_check: - d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n", + d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", i2400m, skb, skb_len, result); return result; } diff --git a/trunk/drivers/scsi/scsi.c b/trunk/drivers/scsi/scsi.c index 348fba0a8976..ad0ed212db4a 100644 --- a/trunk/drivers/scsi/scsi.c +++ b/trunk/drivers/scsi/scsi.c @@ -1046,13 +1046,13 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, /* If the user actually wanted this page, we can skip the rest */ if (page == 0) - return 0; + return -EINVAL; for (i = 0; i < min((int)buf[3], buf_len - 4); i++) if (buf[i + 4] == page) goto found; - if (i < buf[3] && i >= buf_len - 4) + if (i < buf[3] && i > buf_len) /* ran off the end of the buffer, give us benefit of doubt */ goto found; /* The device claims it doesn't support the requested page */ diff --git a/trunk/drivers/serial/ioc3_serial.c b/trunk/drivers/serial/ioc3_serial.c index 800c54602339..93de907b1208 100644 --- a/trunk/drivers/serial/ioc3_serial.c +++ b/trunk/drivers/serial/ioc3_serial.c @@ -2044,7 +2044,6 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd) if (!port) { printk(KERN_WARNING "IOC3 serial memory not available for port\n"); - ret = -ENOMEM; goto out4; } spin_lock_init(&port->ip_lock); diff --git a/trunk/fs/binfmt_aout.c b/trunk/fs/binfmt_aout.c index a6395bdb26ae..f96eff04e11a 100644 --- a/trunk/fs/binfmt_aout.c +++ b/trunk/fs/binfmt_aout.c @@ -134,6 +134,10 @@ static int aout_core_dump(struct coredump_params *cprm) if (!dump_write(file, dump_start, dump_size)) goto end_coredump; } +/* Finally dump the task struct. Not be used by gdb, but could be useful */ + set_fs(KERNEL_DS); + if (!dump_write(file, current, sizeof(*current))) + goto end_coredump; end_coredump: set_fs(fs); return has_dumped; diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index 6d2b6f936858..828dd2461d6b 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -2014,43 +2014,3 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs) fail: return; } - -/* - * Core dumping helper functions. These are the only things you should - * do on a core-file: use only these functions to write out all the - * necessary info. - */ -int dump_write(struct file *file, const void *addr, int nr) -{ - return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr; -} -EXPORT_SYMBOL(dump_write); - -int dump_seek(struct file *file, loff_t off) -{ - int ret = 1; - - if (file->f_op->llseek && file->f_op->llseek != no_llseek) { - if (file->f_op->llseek(file, off, SEEK_CUR) < 0) - return 0; - } else { - char *buf = (char *)get_zeroed_page(GFP_KERNEL); - - if (!buf) - return 0; - while (off > 0) { - unsigned long n = off; - - if (n > PAGE_SIZE) - n = PAGE_SIZE; - if (!dump_write(file, buf, n)) { - ret = 0; - break; - } - off -= n; - } - free_page((unsigned long)buf); - } - return ret; -} -EXPORT_SYMBOL(dump_seek); diff --git a/trunk/fs/nfsd/nfsfh.h b/trunk/fs/nfsd/nfsfh.h index c16f8d8331b5..cdfb8c6a4206 100644 --- a/trunk/fs/nfsd/nfsfh.h +++ b/trunk/fs/nfsd/nfsfh.h @@ -196,6 +196,8 @@ fh_lock(struct svc_fh *fhp) static inline void fh_unlock(struct svc_fh *fhp) { + BUG_ON(!fhp->fh_dentry); + if (fhp->fh_locked) { fill_post_wcc(fhp); mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); diff --git a/trunk/fs/notify/Kconfig b/trunk/fs/notify/Kconfig index b388443c3a09..22c629eedd82 100644 --- a/trunk/fs/notify/Kconfig +++ b/trunk/fs/notify/Kconfig @@ -3,4 +3,4 @@ config FSNOTIFY source "fs/notify/dnotify/Kconfig" source "fs/notify/inotify/Kconfig" -#source "fs/notify/fanotify/Kconfig" +source "fs/notify/fanotify/Kconfig" diff --git a/trunk/include/acpi/acpiosxf.h b/trunk/include/acpi/acpiosxf.h index 43027432a055..29bf945143e8 100644 --- a/trunk/include/acpi/acpiosxf.h +++ b/trunk/include/acpi/acpiosxf.h @@ -223,15 +223,25 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); */ acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, - u32 reg, u64 *value, u32 width); + u32 reg, u32 *value, u32 width); acpi_status acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, u32 reg, u64 value, u32 width); +/* + * Interim function needed for PCI IRQ routing + */ +void +acpi_os_derive_pci_id(acpi_handle device, + acpi_handle region, struct acpi_pci_id **pci_id); + /* * Miscellaneous */ +acpi_status acpi_os_validate_interface(char *interface); +acpi_status acpi_osi_invalidate(char* interface); + acpi_status acpi_os_validate_address(u8 space_id, acpi_physical_address address, acpi_size length, char *name); diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index 7db647c96283..984cdc62e30b 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20101013 +#define ACPI_CA_VERSION 0x20100702 #include "actypes.h" #include "actbl.h" @@ -72,7 +72,6 @@ extern u8 acpi_gbl_truncate_io_addresses; extern u32 acpi_current_gpe_count; extern struct acpi_table_fadt acpi_gbl_FADT; -extern u8 acpi_gbl_system_awake_and_running; extern u32 acpi_rsdt_forced; /* @@ -106,10 +105,6 @@ const char *acpi_format_exception(acpi_status exception); acpi_status acpi_purge_cached_objects(void); -acpi_status acpi_install_interface(acpi_string interface_name); - -acpi_status acpi_remove_interface(acpi_string interface_name); - /* * ACPI Memory management */ @@ -268,8 +263,6 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, acpi_status acpi_install_exception_handler(acpi_exception_handler handler); #endif -acpi_status acpi_install_interface_handler(acpi_interface_handler handler); - /* * Event interfaces */ diff --git a/trunk/include/acpi/actypes.h b/trunk/include/acpi/actypes.h index 2b134b691e34..5db8f472fec9 100644 --- a/trunk/include/acpi/actypes.h +++ b/trunk/include/acpi/actypes.h @@ -115,6 +115,7 @@ * * ACPI_SIZE 16/32/64-bit unsigned value * ACPI_NATIVE_INT 16/32/64-bit signed value + * */ /******************************************************************************* @@ -131,16 +132,6 @@ typedef COMPILER_DEPENDENT_INT64 INT64; /*! [End] no source code translation !*/ -/* - * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" - * across operating systems or even the various UNIX systems. Since ACPICA - * only needs the thread ID as a unique thread identifier, we use a u64 - * as the only common data type - it will accommodate any type of pointer or - * any type of integer. It is up to the host-dependent OSL to cast the - * native thread ID type to a u64 (in acpi_os_get_thread_id). - */ -#define acpi_thread_id u64 - /******************************************************************************* * * Types specific to 64-bit targets @@ -220,6 +211,12 @@ typedef u32 acpi_physical_address; * ******************************************************************************/ +/* Value returned by acpi_os_get_thread_id */ + +#ifndef acpi_thread_id +#define acpi_thread_id acpi_size +#endif + /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ #ifndef acpi_cpu_flags @@ -378,6 +375,16 @@ typedef void *acpi_handle; /* Actually a ptr to a NS Node */ typedef u8 acpi_owner_id; #define ACPI_OWNER_ID_MAX 0xFF +struct uint64_struct { + u32 lo; + u32 hi; +}; + +union uint64_overlay { + u64 full; + struct uint64_struct part; +}; + #define ACPI_INTEGER_BIT_SIZE 64 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ @@ -943,9 +950,6 @@ acpi_status(*acpi_walk_callback) (acpi_handle object, u32 nesting_level, void *context, void **return_value); -typedef -u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); - /* Interrupt handler return values */ #define ACPI_INTERRUPT_NOT_HANDLED 0x00 diff --git a/trunk/include/acpi/platform/acenv.h b/trunk/include/acpi/platform/acenv.h index a3e334ab1119..c05aeba9e8f0 100644 --- a/trunk/include/acpi/platform/acenv.h +++ b/trunk/include/acpi/platform/acenv.h @@ -193,12 +193,6 @@ #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE #endif -/* "inline" keywords - configurable since inline is not standardized */ - -#ifndef ACPI_INLINE -#define ACPI_INLINE -#endif - /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application diff --git a/trunk/include/acpi/platform/acgcc.h b/trunk/include/acpi/platform/acgcc.h index 5dcb9537343c..0cd53e3cd1a3 100644 --- a/trunk/include/acpi/platform/acgcc.h +++ b/trunk/include/acpi/platform/acgcc.h @@ -44,8 +44,6 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ -#define ACPI_INLINE __inline__ - /* Function name is used for debug output. Non-ANSI, compiler-dependent */ #define ACPI_GET_FUNCTION_NAME __func__ diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index 572189e37133..103f08aca764 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -75,6 +75,7 @@ #define acpi_cache_t struct kmem_cache #define acpi_spinlock spinlock_t * #define acpi_cpu_flags unsigned long +#define acpi_thread_id struct task_struct * #else /* !__KERNEL__ */ @@ -87,7 +88,7 @@ /* Host-dependent types and defines for user-space ACPICA */ #define ACPI_FLUSH_CPU_CACHE() -#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) +#define acpi_thread_id pthread_t #if defined(__ia64__) || defined(__x86_64__) #define ACPI_MACHINE_WIDTH 64 @@ -112,13 +113,12 @@ #ifdef __KERNEL__ -#include /* * Overrides for in-kernel ACPICA */ static inline acpi_thread_id acpi_os_get_thread_id(void) { - return (acpi_thread_id)(unsigned long)current; + return current; } /* @@ -127,6 +127,7 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) * However, boot has (system_state != SYSTEM_RUNNING) * to quiet __might_sleep() in kmalloc() and resume does not. */ +#include static inline void *acpi_os_allocate(acpi_size size) { return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); diff --git a/trunk/include/linux/Kbuild b/trunk/include/linux/Kbuild index 4e8ea8c8ec1e..626b629429ff 100644 --- a/trunk/include/linux/Kbuild +++ b/trunk/include/linux/Kbuild @@ -118,6 +118,7 @@ header-y += eventpoll.h header-y += ext2_fs.h header-y += fadvise.h header-y += falloc.h +header-y += fanotify.h header-y += fb.h header-y += fcntl.h header-y += fd.h diff --git a/trunk/include/linux/coredump.h b/trunk/include/linux/coredump.h index ba4b85a6d9b8..8ba66a9d9022 100644 --- a/trunk/include/linux/coredump.h +++ b/trunk/include/linux/coredump.h @@ -9,7 +9,37 @@ * These are the only things you should do on a core-file: use only these * functions to write out all the necessary info. */ -extern int dump_write(struct file *file, const void *addr, int nr); -extern int dump_seek(struct file *file, loff_t off); +static inline int dump_write(struct file *file, const void *addr, int nr) +{ + return file->f_op->write(file, addr, nr, &file->f_pos) == nr; +} + +static inline int dump_seek(struct file *file, loff_t off) +{ + int ret = 1; + + if (file->f_op->llseek && file->f_op->llseek != no_llseek) { + if (file->f_op->llseek(file, off, SEEK_CUR) < 0) + return 0; + } else { + char *buf = (char *)get_zeroed_page(GFP_KERNEL); + + if (!buf) + return 0; + while (off > 0) { + unsigned long n = off; + + if (n > PAGE_SIZE) + n = PAGE_SIZE; + if (!dump_write(file, buf, n)) { + ret = 0; + break; + } + off -= n; + } + free_page((unsigned long)buf); + } + return ret; +} #endif /* _LINUX_COREDUMP_H */ diff --git a/trunk/include/linux/types.h b/trunk/include/linux/types.h index 357dbc19606f..01a082f56ef4 100644 --- a/trunk/include/linux/types.h +++ b/trunk/include/linux/types.h @@ -121,15 +121,7 @@ typedef __u64 u_int64_t; typedef __s64 int64_t; #endif -/* - * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid - * common 32/64-bit compat problems. - * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other - * architectures) and to 8-byte boundaries on 64-bit architetures. The new - * aligned_64 type enforces 8-byte alignment so that structs containing - * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. - * No conversions are necessary between 32-bit user-space and a 64-bit kernel. - */ +/* this is a special 64bit data type that is 8-byte aligned */ #define aligned_u64 __u64 __attribute__((aligned(8))) #define aligned_be64 __be64 __attribute__((aligned(8))) #define aligned_le64 __le64 __attribute__((aligned(8))) @@ -186,11 +178,6 @@ typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; -/* this is a special 64bit data type that is 8-byte aligned */ -#define __aligned_u64 __u64 __attribute__((aligned(8))) -#define __aligned_be64 __be64 __attribute__((aligned(8))) -#define __aligned_le64 __le64 __attribute__((aligned(8))) - #ifdef __KERNEL__ typedef unsigned __bitwise__ gfp_t; typedef unsigned __bitwise__ fmode_t; diff --git a/trunk/kernel/hrtimer.c b/trunk/kernel/hrtimer.c index 72206cf5c6cf..1decafbb6b1a 100644 --- a/trunk/kernel/hrtimer.c +++ b/trunk/kernel/hrtimer.c @@ -931,7 +931,6 @@ static inline int remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base) { if (hrtimer_is_queued(timer)) { - unsigned long state; int reprogram; /* @@ -945,13 +944,8 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base) debug_deactivate(timer); timer_stats_hrtimer_clear_start_info(timer); reprogram = base->cpu_base == &__get_cpu_var(hrtimer_bases); - /* - * We must preserve the CALLBACK state flag here, - * otherwise we could move the timer base in - * switch_hrtimer_base. - */ - state = timer->state & HRTIMER_STATE_CALLBACK; - __remove_hrtimer(timer, base, state, reprogram); + __remove_hrtimer(timer, base, HRTIMER_STATE_INACTIVE, + reprogram); return 1; } return 0; @@ -1237,9 +1231,6 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now) BUG_ON(timer->state != HRTIMER_STATE_CALLBACK); enqueue_hrtimer(timer, base); } - - WARN_ON_ONCE(!(timer->state & HRTIMER_STATE_CALLBACK)); - timer->state &= ~HRTIMER_STATE_CALLBACK; } diff --git a/trunk/kernel/perf_event.c b/trunk/kernel/perf_event.c index b98bed3d8182..db5b56064687 100644 --- a/trunk/kernel/perf_event.c +++ b/trunk/kernel/perf_event.c @@ -2202,13 +2202,15 @@ static void perf_event_for_each(struct perf_event *event, static int perf_event_period(struct perf_event *event, u64 __user *arg) { struct perf_event_context *ctx = event->ctx; + unsigned long size; int ret = 0; u64 value; if (!event->attr.sample_period) return -EINVAL; - if (copy_from_user(&value, arg, sizeof(value))) + size = copy_from_user(&value, arg, sizeof(value)); + if (size != sizeof(value)) return -EFAULT; if (!value) diff --git a/trunk/kernel/sysctl_check.c b/trunk/kernel/sysctl_check.c index 10b90d8a03c4..04cdcf72c827 100644 --- a/trunk/kernel/sysctl_check.c +++ b/trunk/kernel/sysctl_check.c @@ -143,6 +143,15 @@ int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table) if (!table->maxlen) set_fail(&fail, table, "No maxlen"); } + if ((table->proc_handler == proc_doulongvec_minmax) || + (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { + if (table->maxlen > sizeof (unsigned long)) { + if (!table->extra1) + set_fail(&fail, table, "No min"); + if (!table->extra2) + set_fail(&fail, table, "No max"); + } + } #ifdef CONFIG_PROC_SYSCTL if (table->procname && !table->proc_handler) set_fail(&fail, table, "No proc_handler"); diff --git a/trunk/kernel/trace/ring_buffer.c b/trunk/kernel/trace/ring_buffer.c index bca96377fd4e..492197e2f86c 100644 --- a/trunk/kernel/trace/ring_buffer.c +++ b/trunk/kernel/trace/ring_buffer.c @@ -405,7 +405,7 @@ static inline int test_time_stamp(u64 delta) #define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2)) /* Max number of timestamps that can fit on a page */ -#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_EXTEND) +#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_STAMP) int ring_buffer_print_page_header(struct trace_seq *s) { diff --git a/trunk/net/atm/mpc.c b/trunk/net/atm/mpc.c index 74bcc662c3dd..622b471e14e0 100644 --- a/trunk/net/atm/mpc.c +++ b/trunk/net/atm/mpc.c @@ -778,7 +778,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) eg->packets_rcvd++; mpc->eg_ops->put(eg); - memset(ATM_SKB(new_skb), 0, sizeof(struct atm_skb_data)); + memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); netif_rx(new_skb); } diff --git a/trunk/net/core/ethtool.c b/trunk/net/core/ethtool.c index 8451ab481095..4016ac6bdd5e 100644 --- a/trunk/net/core/ethtool.c +++ b/trunk/net/core/ethtool.c @@ -397,7 +397,7 @@ static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev, (KMALLOC_MAX_SIZE - sizeof(*indir)) / sizeof(*indir->ring_index)) return -ENOMEM; full_size = sizeof(*indir) + sizeof(*indir->ring_index) * table_size; - indir = kzalloc(full_size, GFP_USER); + indir = kmalloc(full_size, GFP_USER); if (!indir) return -ENOMEM; @@ -538,7 +538,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr) gstrings.len = ret; - data = kzalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); + data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); if (!data) return -ENOMEM; @@ -775,7 +775,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) if (regs.len > reglen) regs.len = reglen; - regbuf = kzalloc(reglen, GFP_USER); + regbuf = kmalloc(reglen, GFP_USER); if (!regbuf) return -ENOMEM; diff --git a/trunk/net/rds/page.c b/trunk/net/rds/page.c index 1dfbfea12e9b..595a952d4b17 100644 --- a/trunk/net/rds/page.c +++ b/trunk/net/rds/page.c @@ -57,17 +57,30 @@ int rds_page_copy_user(struct page *page, unsigned long offset, unsigned long ret; void *addr; - addr = kmap(page); - if (to_user) { + if (to_user) rds_stats_add(s_copy_to_user, bytes); - ret = copy_to_user(ptr, addr + offset, bytes); - } else { + else rds_stats_add(s_copy_from_user, bytes); - ret = copy_from_user(addr + offset, ptr, bytes); + + addr = kmap_atomic(page, KM_USER0); + if (to_user) + ret = __copy_to_user_inatomic(ptr, addr + offset, bytes); + else + ret = __copy_from_user_inatomic(addr + offset, ptr, bytes); + kunmap_atomic(addr, KM_USER0); + + if (ret) { + addr = kmap(page); + if (to_user) + ret = copy_to_user(ptr, addr + offset, bytes); + else + ret = copy_from_user(addr + offset, ptr, bytes); + kunmap(page); + if (ret) + return -EFAULT; } - kunmap(page); - return ret ? -EFAULT : 0; + return 0; } EXPORT_SYMBOL_GPL(rds_page_copy_user); diff --git a/trunk/sound/core/rawmidi.c b/trunk/sound/core/rawmidi.c index cbbed0db9e56..a7868ad4d530 100644 --- a/trunk/sound/core/rawmidi.c +++ b/trunk/sound/core/rawmidi.c @@ -535,15 +535,13 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file) { struct snd_rawmidi_file *rfile; struct snd_rawmidi *rmidi; - struct module *module; rfile = file->private_data; rmidi = rfile->rmidi; rawmidi_release_priv(rfile); kfree(rfile); - module = rmidi->card->module; snd_card_file_remove(rmidi->card, file); - module_put(module); + module_put(rmidi->card->module); return 0; } diff --git a/trunk/tools/perf/perf.h b/trunk/tools/perf/perf.h index 95aaf565c704..ef7aa0a0c526 100644 --- a/trunk/tools/perf/perf.h +++ b/trunk/tools/perf/perf.h @@ -73,18 +73,6 @@ void get_term_dimensions(struct winsize *ws); #define cpu_relax() asm volatile("":::"memory") #endif -#ifdef __mips__ -#include "../../arch/mips/include/asm/unistd.h" -#define rmb() asm volatile( \ - ".set mips2\n\t" \ - "sync\n\t" \ - ".set mips0" \ - : /* no output */ \ - : /* no input */ \ - : "memory") -#define cpu_relax() asm volatile("" ::: "memory") -#endif - #include #include #include