diff options
138 files changed, 2791 insertions, 1174 deletions
diff --git a/Documentation/vfio.txt b/Documentation/vfio.txt index 0cb6685c8029..8eda3635a17d 100644 --- a/Documentation/vfio.txt +++ b/Documentation/vfio.txt | |||
| @@ -133,7 +133,7 @@ character devices for this group: | |||
| 133 | $ lspci -n -s 0000:06:0d.0 | 133 | $ lspci -n -s 0000:06:0d.0 |
| 134 | 06:0d.0 0401: 1102:0002 (rev 08) | 134 | 06:0d.0 0401: 1102:0002 (rev 08) |
| 135 | # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind | 135 | # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind |
| 136 | # echo 1102 0002 > /sys/bus/pci/drivers/vfio/new_id | 136 | # echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id |
| 137 | 137 | ||
| 138 | Now we need to look at what other devices are in the group to free | 138 | Now we need to look at what other devices are in the group to free |
| 139 | it for use by VFIO: | 139 | it for use by VFIO: |
diff --git a/MAINTAINERS b/MAINTAINERS index b17587d9412f..9a6c4da3b2ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -3552,11 +3552,12 @@ K: \b(ABS|SYN)_MT_ | |||
| 3552 | 3552 | ||
| 3553 | INTEL C600 SERIES SAS CONTROLLER DRIVER | 3553 | INTEL C600 SERIES SAS CONTROLLER DRIVER |
| 3554 | M: Intel SCU Linux support <intel-linux-scu@intel.com> | 3554 | M: Intel SCU Linux support <intel-linux-scu@intel.com> |
| 3555 | M: Lukasz Dorau <lukasz.dorau@intel.com> | ||
| 3556 | M: Maciej Patelczyk <maciej.patelczyk@intel.com> | ||
| 3555 | M: Dave Jiang <dave.jiang@intel.com> | 3557 | M: Dave Jiang <dave.jiang@intel.com> |
| 3556 | M: Ed Nadolski <edmund.nadolski@intel.com> | ||
| 3557 | L: linux-scsi@vger.kernel.org | 3558 | L: linux-scsi@vger.kernel.org |
| 3558 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git | 3559 | T: git git://git.code.sf.net/p/intel-sas/isci |
| 3559 | S: Maintained | 3560 | S: Supported |
| 3560 | F: drivers/scsi/isci/ | 3561 | F: drivers/scsi/isci/ |
| 3561 | F: firmware/isci/ | 3562 | F: firmware/isci/ |
| 3562 | 3563 | ||
| @@ -5544,6 +5545,8 @@ F: Documentation/devicetree/bindings/pwm/ | |||
| 5544 | F: include/linux/pwm.h | 5545 | F: include/linux/pwm.h |
| 5545 | F: include/linux/of_pwm.h | 5546 | F: include/linux/of_pwm.h |
| 5546 | F: drivers/pwm/ | 5547 | F: drivers/pwm/ |
| 5548 | F: drivers/video/backlight/pwm_bl.c | ||
| 5549 | F: include/linux/pwm_backlight.h | ||
| 5547 | 5550 | ||
| 5548 | PXA2xx/PXA3xx SUPPORT | 5551 | PXA2xx/PXA3xx SUPPORT |
| 5549 | M: Eric Miao <eric.y.miao@gmail.com> | 5552 | M: Eric Miao <eric.y.miao@gmail.com> |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc7 | 4 | EXTRAVERSION = |
| 5 | NAME = Terrified Chipmunk | 5 | NAME = Terrified Chipmunk |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 8dabfe81d07c..ff886e01a0b0 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
| @@ -261,7 +261,7 @@ static void __init apx4devkit_init(void) | |||
| 261 | enable_clk_enet_out(); | 261 | enable_clk_enet_out(); |
| 262 | 262 | ||
| 263 | if (IS_BUILTIN(CONFIG_PHYLIB)) | 263 | if (IS_BUILTIN(CONFIG_PHYLIB)) |
| 264 | phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, | 264 | phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK, |
| 265 | apx4devkit_phy_fixup); | 265 | apx4devkit_phy_fixup); |
| 266 | 266 | ||
| 267 | mxsfb_pdata.mode_list = apx4devkit_video_modes; | 267 | mxsfb_pdata.mode_list = apx4devkit_video_modes; |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 410291c67666..a6cd14ab1e4e 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
| @@ -204,6 +204,13 @@ void __init orion5x_wdt_init(void) | |||
| 204 | void __init orion5x_init_early(void) | 204 | void __init orion5x_init_early(void) |
| 205 | { | 205 | { |
| 206 | orion_time_set_base(TIMER_VIRT_BASE); | 206 | orion_time_set_base(TIMER_VIRT_BASE); |
| 207 | |||
| 208 | /* | ||
| 209 | * Some Orion5x devices allocate their coherent buffers from atomic | ||
| 210 | * context. Increase size of atomic coherent pool to make sure such | ||
| 211 | * the allocations won't fail. | ||
| 212 | */ | ||
| 213 | init_dma_coherent_pool_size(SZ_1M); | ||
| 207 | } | 214 | } |
| 208 | 215 | ||
| 209 | int orion5x_tclk; | 216 | int orion5x_tclk; |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e59c4ab71bcb..13f555d62491 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
| @@ -346,6 +346,8 @@ static int __init atomic_pool_init(void) | |||
| 346 | (unsigned)pool->size / 1024); | 346 | (unsigned)pool->size / 1024); |
| 347 | return 0; | 347 | return 0; |
| 348 | } | 348 | } |
| 349 | |||
| 350 | kfree(pages); | ||
| 349 | no_pages: | 351 | no_pages: |
| 350 | kfree(bitmap); | 352 | kfree(bitmap); |
| 351 | no_bitmap: | 353 | no_bitmap: |
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 3af601e31e66..f08e89183cda 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
| @@ -2,6 +2,7 @@ include include/asm-generic/Kbuild.asm | |||
| 2 | 2 | ||
| 3 | generic-y += atomic.h | 3 | generic-y += atomic.h |
| 4 | generic-y += auxvec.h | 4 | generic-y += auxvec.h |
| 5 | generic-y += barrier.h | ||
| 5 | generic-y += bitsperlong.h | 6 | generic-y += bitsperlong.h |
| 6 | generic-y += bugs.h | 7 | generic-y += bugs.h |
| 7 | generic-y += cputime.h | 8 | generic-y += cputime.h |
diff --git a/arch/c6x/include/asm/barrier.h b/arch/c6x/include/asm/barrier.h deleted file mode 100644 index 538240e85909..000000000000 --- a/arch/c6x/include/asm/barrier.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Port on Texas Instruments TMS320C6x architecture | ||
| 3 | * | ||
| 4 | * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated | ||
| 5 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef _ASM_C6X_BARRIER_H | ||
| 12 | #define _ASM_C6X_BARRIER_H | ||
| 13 | |||
| 14 | #define nop() asm("NOP\n"); | ||
| 15 | |||
| 16 | #define mb() barrier() | ||
| 17 | #define rmb() barrier() | ||
| 18 | #define wmb() barrier() | ||
| 19 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
| 20 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
| 21 | |||
| 22 | #define smp_mb() barrier() | ||
| 23 | #define smp_rmb() barrier() | ||
| 24 | #define smp_wmb() barrier() | ||
| 25 | #define smp_read_barrier_depends() do { } while (0) | ||
| 26 | |||
| 27 | #endif /* _ASM_C6X_BARRIER_H */ | ||
diff --git a/arch/tile/include/gxio/iorpc_trio.h b/arch/tile/include/gxio/iorpc_trio.h index 15fb77992083..58105c31228b 100644 --- a/arch/tile/include/gxio/iorpc_trio.h +++ b/arch/tile/include/gxio/iorpc_trio.h | |||
| @@ -25,21 +25,23 @@ | |||
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
| 27 | 27 | ||
| 28 | #define GXIO_TRIO_OP_ALLOC_ASIDS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1400) | 28 | #define GXIO_TRIO_OP_DEALLOC_ASID IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1400) |
| 29 | #define GXIO_TRIO_OP_ALLOC_ASIDS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1401) | ||
| 29 | 30 | ||
| 30 | #define GXIO_TRIO_OP_ALLOC_MEMORY_MAPS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1402) | 31 | #define GXIO_TRIO_OP_ALLOC_MEMORY_MAPS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1404) |
| 31 | 32 | ||
| 32 | #define GXIO_TRIO_OP_ALLOC_PIO_REGIONS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x140e) | 33 | #define GXIO_TRIO_OP_ALLOC_PIO_REGIONS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1412) |
| 33 | #define GXIO_TRIO_OP_INIT_PIO_REGION_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x140f) | ||
| 34 | 34 | ||
| 35 | #define GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1417) | 35 | #define GXIO_TRIO_OP_INIT_PIO_REGION_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1414) |
| 36 | #define GXIO_TRIO_OP_GET_PORT_PROPERTY IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1418) | ||
| 37 | #define GXIO_TRIO_OP_CONFIG_LEGACY_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1419) | ||
| 38 | #define GXIO_TRIO_OP_CONFIG_MSI_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x141a) | ||
| 39 | 36 | ||
| 40 | #define GXIO_TRIO_OP_SET_MPS_MRS IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141c) | 37 | #define GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141e) |
| 41 | #define GXIO_TRIO_OP_FORCE_RC_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141d) | 38 | #define GXIO_TRIO_OP_GET_PORT_PROPERTY IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141f) |
| 42 | #define GXIO_TRIO_OP_FORCE_EP_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141e) | 39 | #define GXIO_TRIO_OP_CONFIG_LEGACY_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1420) |
| 40 | #define GXIO_TRIO_OP_CONFIG_MSI_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1421) | ||
| 41 | |||
| 42 | #define GXIO_TRIO_OP_SET_MPS_MRS IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1423) | ||
| 43 | #define GXIO_TRIO_OP_FORCE_RC_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1424) | ||
| 44 | #define GXIO_TRIO_OP_FORCE_EP_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1425) | ||
| 43 | #define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) | 45 | #define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) |
| 44 | #define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) | 46 | #define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) |
| 45 | 47 | ||
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h index 69f1c57a8d0d..33a6a2423bd2 100644 --- a/arch/um/include/asm/processor-generic.h +++ b/arch/um/include/asm/processor-generic.h | |||
| @@ -20,14 +20,6 @@ struct mm_struct; | |||
| 20 | 20 | ||
| 21 | struct thread_struct { | 21 | struct thread_struct { |
| 22 | struct task_struct *saved_task; | 22 | struct task_struct *saved_task; |
| 23 | /* | ||
| 24 | * This flag is set to 1 before calling do_fork (and analyzed in | ||
| 25 | * copy_thread) to mark that we are begin called from userspace (fork / | ||
| 26 | * vfork / clone), and reset to 0 after. It is left to 0 when called | ||
| 27 | * from kernelspace (i.e. kernel_thread() or fork_idle(), | ||
| 28 | * as of 2.6.11). | ||
| 29 | */ | ||
| 30 | int forking; | ||
| 31 | struct pt_regs regs; | 23 | struct pt_regs regs; |
| 32 | int singlestep_syscall; | 24 | int singlestep_syscall; |
| 33 | void *fault_addr; | 25 | void *fault_addr; |
| @@ -58,7 +50,6 @@ struct thread_struct { | |||
| 58 | 50 | ||
| 59 | #define INIT_THREAD \ | 51 | #define INIT_THREAD \ |
| 60 | { \ | 52 | { \ |
| 61 | .forking = 0, \ | ||
| 62 | .regs = EMPTY_REGS, \ | 53 | .regs = EMPTY_REGS, \ |
| 63 | .fault_addr = NULL, \ | 54 | .fault_addr = NULL, \ |
| 64 | .prev_sched = NULL, \ | 55 | .prev_sched = NULL, \ |
diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shared/common-offsets.h index 40db8f71deae..2df313b6a586 100644 --- a/arch/um/include/shared/common-offsets.h +++ b/arch/um/include/shared/common-offsets.h | |||
| @@ -7,16 +7,6 @@ DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK); | |||
| 7 | DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); | 7 | DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); |
| 8 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); | 8 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); |
| 9 | 9 | ||
| 10 | DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); | ||
| 11 | DEFINE_STR(UM_KERN_ALERT, KERN_ALERT); | ||
| 12 | DEFINE_STR(UM_KERN_CRIT, KERN_CRIT); | ||
| 13 | DEFINE_STR(UM_KERN_ERR, KERN_ERR); | ||
| 14 | DEFINE_STR(UM_KERN_WARNING, KERN_WARNING); | ||
| 15 | DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE); | ||
| 16 | DEFINE_STR(UM_KERN_INFO, KERN_INFO); | ||
| 17 | DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG); | ||
| 18 | DEFINE_STR(UM_KERN_CONT, KERN_CONT); | ||
| 19 | |||
| 20 | DEFINE(UM_ELF_CLASS, ELF_CLASS); | 10 | DEFINE(UM_ELF_CLASS, ELF_CLASS); |
| 21 | DEFINE(UM_ELFCLASS32, ELFCLASS32); | 11 | DEFINE(UM_ELFCLASS32, ELFCLASS32); |
| 22 | DEFINE(UM_ELFCLASS64, ELFCLASS64); | 12 | DEFINE(UM_ELFCLASS64, ELFCLASS64); |
diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h index 4fa82c055aab..cef068563336 100644 --- a/arch/um/include/shared/user.h +++ b/arch/um/include/shared/user.h | |||
| @@ -26,6 +26,17 @@ | |||
| 26 | extern void panic(const char *fmt, ...) | 26 | extern void panic(const char *fmt, ...) |
| 27 | __attribute__ ((format (printf, 1, 2))); | 27 | __attribute__ ((format (printf, 1, 2))); |
| 28 | 28 | ||
| 29 | /* Requires preincluding include/linux/kern_levels.h */ | ||
| 30 | #define UM_KERN_EMERG KERN_EMERG | ||
| 31 | #define UM_KERN_ALERT KERN_ALERT | ||
| 32 | #define UM_KERN_CRIT KERN_CRIT | ||
| 33 | #define UM_KERN_ERR KERN_ERR | ||
| 34 | #define UM_KERN_WARNING KERN_WARNING | ||
| 35 | #define UM_KERN_NOTICE KERN_NOTICE | ||
| 36 | #define UM_KERN_INFO KERN_INFO | ||
| 37 | #define UM_KERN_DEBUG KERN_DEBUG | ||
| 38 | #define UM_KERN_CONT KERN_CONT | ||
| 39 | |||
| 29 | #ifdef UML_CONFIG_PRINTK | 40 | #ifdef UML_CONFIG_PRINTK |
| 30 | extern int printk(const char *fmt, ...) | 41 | extern int printk(const char *fmt, ...) |
| 31 | __attribute__ ((format (printf, 1, 2))); | 42 | __attribute__ ((format (printf, 1, 2))); |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 6cade9366364..8c82786da823 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
| @@ -39,34 +39,21 @@ void flush_thread(void) | |||
| 39 | 39 | ||
| 40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | 40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) |
| 41 | { | 41 | { |
| 42 | get_safe_registers(regs->regs.gp, regs->regs.fp); | ||
| 42 | PT_REGS_IP(regs) = eip; | 43 | PT_REGS_IP(regs) = eip; |
| 43 | PT_REGS_SP(regs) = esp; | 44 | PT_REGS_SP(regs) = esp; |
| 44 | } | 45 | current->ptrace &= ~PT_DTRACE; |
| 45 | EXPORT_SYMBOL(start_thread); | ||
| 46 | |||
| 47 | static long execve1(const char *file, | ||
| 48 | const char __user *const __user *argv, | ||
| 49 | const char __user *const __user *env) | ||
| 50 | { | ||
| 51 | long error; | ||
| 52 | |||
| 53 | error = do_execve(file, argv, env, ¤t->thread.regs); | ||
| 54 | if (error == 0) { | ||
| 55 | task_lock(current); | ||
| 56 | current->ptrace &= ~PT_DTRACE; | ||
| 57 | #ifdef SUBARCH_EXECVE1 | 46 | #ifdef SUBARCH_EXECVE1 |
| 58 | SUBARCH_EXECVE1(¤t->thread.regs.regs); | 47 | SUBARCH_EXECVE1(regs->regs); |
| 59 | #endif | 48 | #endif |
| 60 | task_unlock(current); | ||
| 61 | } | ||
| 62 | return error; | ||
| 63 | } | 49 | } |
| 50 | EXPORT_SYMBOL(start_thread); | ||
| 64 | 51 | ||
| 65 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) | 52 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) |
| 66 | { | 53 | { |
| 67 | long err; | 54 | long err; |
| 68 | 55 | ||
| 69 | err = execve1(file, argv, env); | 56 | err = do_execve(file, argv, env, ¤t->thread.regs); |
| 70 | if (!err) | 57 | if (!err) |
| 71 | UML_LONGJMP(current->thread.exec_buf, 1); | 58 | UML_LONGJMP(current->thread.exec_buf, 1); |
| 72 | return err; | 59 | return err; |
| @@ -81,7 +68,7 @@ long sys_execve(const char __user *file, const char __user *const __user *argv, | |||
| 81 | filename = getname(file); | 68 | filename = getname(file); |
| 82 | error = PTR_ERR(filename); | 69 | error = PTR_ERR(filename); |
| 83 | if (IS_ERR(filename)) goto out; | 70 | if (IS_ERR(filename)) goto out; |
| 84 | error = execve1(filename, argv, env); | 71 | error = do_execve(filename, argv, env, ¤t->thread.regs); |
| 85 | putname(filename); | 72 | putname(filename); |
| 86 | out: | 73 | out: |
| 87 | return error; | 74 | return error; |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 57fc7028714a..c5f5afa50745 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
| @@ -181,11 +181,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
| 181 | struct pt_regs *regs) | 181 | struct pt_regs *regs) |
| 182 | { | 182 | { |
| 183 | void (*handler)(void); | 183 | void (*handler)(void); |
| 184 | int kthread = current->flags & PF_KTHREAD; | ||
| 184 | int ret = 0; | 185 | int ret = 0; |
| 185 | 186 | ||
| 186 | p->thread = (struct thread_struct) INIT_THREAD; | 187 | p->thread = (struct thread_struct) INIT_THREAD; |
| 187 | 188 | ||
| 188 | if (current->thread.forking) { | 189 | if (!kthread) { |
| 189 | memcpy(&p->thread.regs.regs, ®s->regs, | 190 | memcpy(&p->thread.regs.regs, ®s->regs, |
| 190 | sizeof(p->thread.regs.regs)); | 191 | sizeof(p->thread.regs.regs)); |
| 191 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); | 192 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); |
| @@ -195,8 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
| 195 | handler = fork_handler; | 196 | handler = fork_handler; |
| 196 | 197 | ||
| 197 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | 198 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
| 198 | } | 199 | } else { |
| 199 | else { | ||
| 200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); | 200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); |
| 201 | p->thread.request.u.thread = current->thread.request.u.thread; | 201 | p->thread.request.u.thread = current->thread.request.u.thread; |
| 202 | handler = new_thread_handler; | 202 | handler = new_thread_handler; |
| @@ -204,7 +204,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
| 204 | 204 | ||
| 205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); | 205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); |
| 206 | 206 | ||
| 207 | if (current->thread.forking) { | 207 | if (!kthread) { |
| 208 | clear_flushed_tls(p); | 208 | clear_flushed_tls(p); |
| 209 | 209 | ||
| 210 | /* | 210 | /* |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 7362d58efc29..cc9c2350e417 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
| @@ -22,9 +22,13 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
| 22 | struct k_sigaction *ka, siginfo_t *info) | 22 | struct k_sigaction *ka, siginfo_t *info) |
| 23 | { | 23 | { |
| 24 | sigset_t *oldset = sigmask_to_save(); | 24 | sigset_t *oldset = sigmask_to_save(); |
| 25 | int singlestep = 0; | ||
| 25 | unsigned long sp; | 26 | unsigned long sp; |
| 26 | int err; | 27 | int err; |
| 27 | 28 | ||
| 29 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
| 30 | singlestep = 1; | ||
| 31 | |||
| 28 | /* Did we come from a system call? */ | 32 | /* Did we come from a system call? */ |
| 29 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { | 33 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { |
| 30 | /* If so, check system call restarting.. */ | 34 | /* If so, check system call restarting.. */ |
| @@ -61,7 +65,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
| 61 | if (err) | 65 | if (err) |
| 62 | force_sigsegv(signr, current); | 66 | force_sigsegv(signr, current); |
| 63 | else | 67 | else |
| 64 | signal_delivered(signr, info, ka, regs, 0); | 68 | signal_delivered(signr, info, ka, regs, singlestep); |
| 65 | } | 69 | } |
| 66 | 70 | ||
| 67 | static int kern_do_signal(struct pt_regs *regs) | 71 | static int kern_do_signal(struct pt_regs *regs) |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index f958cb876ee3..a4c6d8eee74c 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
| @@ -17,25 +17,25 @@ | |||
| 17 | 17 | ||
| 18 | long sys_fork(void) | 18 | long sys_fork(void) |
| 19 | { | 19 | { |
| 20 | long ret; | 20 | return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
| 21 | |||
| 22 | current->thread.forking = 1; | ||
| 23 | ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), | ||
| 24 | ¤t->thread.regs, 0, NULL, NULL); | 21 | ¤t->thread.regs, 0, NULL, NULL); |
| 25 | current->thread.forking = 0; | ||
| 26 | return ret; | ||
| 27 | } | 22 | } |
| 28 | 23 | ||
| 29 | long sys_vfork(void) | 24 | long sys_vfork(void) |
| 30 | { | 25 | { |
| 31 | long ret; | 26 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
| 32 | |||
| 33 | current->thread.forking = 1; | ||
| 34 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | ||
| 35 | UPT_SP(¤t->thread.regs.regs), | 27 | UPT_SP(¤t->thread.regs.regs), |
| 36 | ¤t->thread.regs, 0, NULL, NULL); | 28 | ¤t->thread.regs, 0, NULL, NULL); |
| 37 | current->thread.forking = 0; | 29 | } |
| 38 | return ret; | 30 | |
| 31 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
| 32 | void __user *parent_tid, void __user *child_tid) | ||
| 33 | { | ||
| 34 | if (!newsp) | ||
| 35 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
| 36 | |||
| 37 | return do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
| 38 | child_tid); | ||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | long old_mmap(unsigned long addr, unsigned long len, | 41 | long old_mmap(unsigned long addr, unsigned long len, |
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules index d50270d26b42..15889df9b466 100644 --- a/arch/um/scripts/Makefile.rules +++ b/arch/um/scripts/Makefile.rules | |||
| @@ -8,7 +8,7 @@ USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) | |||
| 8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) | 8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) |
| 9 | 9 | ||
| 10 | $(USER_OBJS:.o=.%): \ | 10 | $(USER_OBJS:.o=.%): \ |
| 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o) | 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o) |
| 12 | 12 | ||
| 13 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of | 13 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of |
| 14 | # using it directly. | 14 | # using it directly. |
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index 9926e11a772d..aeaff8bef2f1 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig | |||
| @@ -21,6 +21,7 @@ config 64BIT | |||
| 21 | config X86_32 | 21 | config X86_32 |
| 22 | def_bool !64BIT | 22 | def_bool !64BIT |
| 23 | select HAVE_AOUT | 23 | select HAVE_AOUT |
| 24 | select ARCH_WANT_IPC_PARSE_VERSION | ||
| 24 | 25 | ||
| 25 | config X86_64 | 26 | config X86_64 |
| 26 | def_bool 64BIT | 27 | def_bool 64BIT |
diff --git a/arch/x86/um/shared/sysdep/kernel-offsets.h b/arch/x86/um/shared/sysdep/kernel-offsets.h index 5868526b5eef..46a9df99f3c5 100644 --- a/arch/x86/um/shared/sysdep/kernel-offsets.h +++ b/arch/x86/um/shared/sysdep/kernel-offsets.h | |||
| @@ -7,9 +7,6 @@ | |||
| 7 | #define DEFINE(sym, val) \ | 7 | #define DEFINE(sym, val) \ |
| 8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
| 9 | 9 | ||
| 10 | #define STR(x) #x | ||
| 11 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) | ||
| 12 | |||
| 13 | #define BLANK() asm volatile("\n->" : : ) | 10 | #define BLANK() asm volatile("\n->" : : ) |
| 14 | 11 | ||
| 15 | #define OFFSET(sym, str, mem) \ | 12 | #define OFFSET(sym, str, mem) \ |
diff --git a/arch/x86/um/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls.h index bd9a89b67e41..ca255a805ed9 100644 --- a/arch/x86/um/shared/sysdep/syscalls.h +++ b/arch/x86/um/shared/sysdep/syscalls.h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | extern long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
| 2 | void __user *parent_tid, void __user *child_tid); | ||
| 1 | #ifdef __i386__ | 3 | #ifdef __i386__ |
| 2 | #include "syscalls_32.h" | 4 | #include "syscalls_32.h" |
| 3 | #else | 5 | #else |
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index a508cea13503..ba7363ecf896 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c | |||
| @@ -416,9 +416,6 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, | |||
| 416 | PT_REGS_AX(regs) = (unsigned long) sig; | 416 | PT_REGS_AX(regs) = (unsigned long) sig; |
| 417 | PT_REGS_DX(regs) = (unsigned long) 0; | 417 | PT_REGS_DX(regs) = (unsigned long) 0; |
| 418 | PT_REGS_CX(regs) = (unsigned long) 0; | 418 | PT_REGS_CX(regs) = (unsigned long) 0; |
| 419 | |||
| 420 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
| 421 | ptrace_notify(SIGTRAP); | ||
| 422 | return 0; | 419 | return 0; |
| 423 | } | 420 | } |
| 424 | 421 | ||
| @@ -466,9 +463,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
| 466 | PT_REGS_AX(regs) = (unsigned long) sig; | 463 | PT_REGS_AX(regs) = (unsigned long) sig; |
| 467 | PT_REGS_DX(regs) = (unsigned long) &frame->info; | 464 | PT_REGS_DX(regs) = (unsigned long) &frame->info; |
| 468 | PT_REGS_CX(regs) = (unsigned long) &frame->uc; | 465 | PT_REGS_CX(regs) = (unsigned long) &frame->uc; |
| 469 | |||
| 470 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
| 471 | ptrace_notify(SIGTRAP); | ||
| 472 | return 0; | 466 | return 0; |
| 473 | } | 467 | } |
| 474 | 468 | ||
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c index 68d1dc91b37b..b5408cecac6c 100644 --- a/arch/x86/um/sys_call_table_32.c +++ b/arch/x86/um/sys_call_table_32.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #define ptregs_execve sys_execve | 28 | #define ptregs_execve sys_execve |
| 29 | #define ptregs_iopl sys_iopl | 29 | #define ptregs_iopl sys_iopl |
| 30 | #define ptregs_vm86old sys_vm86old | 30 | #define ptregs_vm86old sys_vm86old |
| 31 | #define ptregs_clone sys_clone | 31 | #define ptregs_clone i386_clone |
| 32 | #define ptregs_vm86 sys_vm86 | 32 | #define ptregs_vm86 sys_vm86 |
| 33 | #define ptregs_sigaltstack sys_sigaltstack | 33 | #define ptregs_sigaltstack sys_sigaltstack |
| 34 | #define ptregs_vfork sys_vfork | 34 | #define ptregs_vfork sys_vfork |
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c index b853e8600b9d..db444c7218fe 100644 --- a/arch/x86/um/syscalls_32.c +++ b/arch/x86/um/syscalls_32.c | |||
| @@ -3,37 +3,24 @@ | |||
| 3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include "linux/sched.h" | 6 | #include <linux/syscalls.h> |
| 7 | #include "linux/shm.h" | 7 | #include <sysdep/syscalls.h> |
| 8 | #include "linux/ipc.h" | ||
| 9 | #include "linux/syscalls.h" | ||
| 10 | #include "asm/mman.h" | ||
| 11 | #include "asm/uaccess.h" | ||
| 12 | #include "asm/unistd.h" | ||
| 13 | 8 | ||
| 14 | /* | 9 | /* |
| 15 | * The prototype on i386 is: | 10 | * The prototype on i386 is: |
| 16 | * | 11 | * |
| 17 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) | 12 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls |
| 18 | * | 13 | * |
| 19 | * and the "newtls" arg. on i386 is read by copy_thread directly from the | 14 | * and the "newtls" arg. on i386 is read by copy_thread directly from the |
| 20 | * register saved on the stack. | 15 | * register saved on the stack. |
| 21 | */ | 16 | */ |
| 22 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | 17 | long i386_clone(unsigned long clone_flags, unsigned long newsp, |
| 23 | int __user *parent_tid, void *newtls, int __user *child_tid) | 18 | int __user *parent_tid, void *newtls, int __user *child_tid) |
| 24 | { | 19 | { |
| 25 | long ret; | 20 | return sys_clone(clone_flags, newsp, parent_tid, child_tid); |
| 26 | |||
| 27 | if (!newsp) | ||
| 28 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
| 29 | |||
| 30 | current->thread.forking = 1; | ||
| 31 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
| 32 | child_tid); | ||
| 33 | current->thread.forking = 0; | ||
| 34 | return ret; | ||
| 35 | } | 21 | } |
| 36 | 22 | ||
| 23 | |||
| 37 | long sys_sigaction(int sig, const struct old_sigaction __user *act, | 24 | long sys_sigaction(int sig, const struct old_sigaction __user *act, |
| 38 | struct old_sigaction __user *oact) | 25 | struct old_sigaction __user *oact) |
| 39 | { | 26 | { |
diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c index f3d82bb6e15a..adb08eb5c22a 100644 --- a/arch/x86/um/syscalls_64.c +++ b/arch/x86/um/syscalls_64.c | |||
| @@ -5,12 +5,9 @@ | |||
| 5 | * Licensed under the GPL | 5 | * Licensed under the GPL |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "linux/linkage.h" | 8 | #include <linux/sched.h> |
| 9 | #include "linux/personality.h" | 9 | #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
| 10 | #include "linux/utsname.h" | 10 | #include <os.h> |
| 11 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ | ||
| 12 | #include "asm/uaccess.h" | ||
| 13 | #include "os.h" | ||
| 14 | 11 | ||
| 15 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) | 12 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
| 16 | { | 13 | { |
| @@ -79,20 +76,6 @@ long sys_arch_prctl(int code, unsigned long addr) | |||
| 79 | return arch_prctl(current, code, (unsigned long __user *) addr); | 76 | return arch_prctl(current, code, (unsigned long __user *) addr); |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
| 83 | void __user *parent_tid, void __user *child_tid) | ||
| 84 | { | ||
| 85 | long ret; | ||
| 86 | |||
| 87 | if (!newsp) | ||
| 88 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
| 89 | current->thread.forking = 1; | ||
| 90 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
| 91 | child_tid); | ||
| 92 | current->thread.forking = 0; | ||
| 93 | return ret; | ||
| 94 | } | ||
| 95 | |||
| 96 | void arch_switch_to(struct task_struct *to) | 79 | void arch_switch_to(struct task_struct *to) |
| 97 | { | 80 | { |
| 98 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) | 81 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index d11ca11d14fc..e2d62d697b5d 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <asm/e820.h> | 17 | #include <asm/e820.h> |
| 18 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
| 19 | #include <asm/acpi.h> | 19 | #include <asm/acpi.h> |
| 20 | #include <asm/numa.h> | ||
| 20 | #include <asm/xen/hypervisor.h> | 21 | #include <asm/xen/hypervisor.h> |
| 21 | #include <asm/xen/hypercall.h> | 22 | #include <asm/xen/hypercall.h> |
| 22 | 23 | ||
| @@ -544,4 +545,7 @@ void __init xen_arch_setup(void) | |||
| 544 | disable_cpufreq(); | 545 | disable_cpufreq(); |
| 545 | WARN_ON(set_pm_idle_to_default()); | 546 | WARN_ON(set_pm_idle_to_default()); |
| 546 | fiddle_vdso(); | 547 | fiddle_vdso(); |
| 548 | #ifdef CONFIG_NUMA | ||
| 549 | numa_off = 1; | ||
| 550 | #endif | ||
| 547 | } | 551 | } |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 0a1b3435f920..7f1d40797e80 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -158,5 +158,6 @@ acpi-y += \ | |||
| 158 | utresrc.o \ | 158 | utresrc.o \ |
| 159 | utstate.o \ | 159 | utstate.o \ |
| 160 | utxface.o \ | 160 | utxface.o \ |
| 161 | utxfinit.o \ | ||
| 161 | utxferror.o \ | 162 | utxferror.o \ |
| 162 | utxfmutex.o | 163 | utxfmutex.o |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 5de4ec72766d..d902d31abc6c 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
| @@ -110,8 +110,7 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
| 110 | /* | 110 | /* |
| 111 | * hwgpe - GPE support | 111 | * hwgpe - GPE support |
| 112 | */ | 112 | */ |
| 113 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 113 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info); |
| 114 | struct acpi_gpe_register_info *gpe_register_info); | ||
| 115 | 114 | ||
| 116 | acpi_status | 115 | acpi_status |
| 117 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action); | 116 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action); |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index cc80fe10e8ea..c816ee675094 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -707,15 +707,18 @@ union acpi_parse_value { | |||
| 707 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 707 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
| 708 | char aml_op_name[16]) /* Op name (debug only) */ | 708 | char aml_op_name[16]) /* Op name (debug only) */ |
| 709 | 709 | ||
| 710 | #define ACPI_DASM_BUFFER 0x00 | 710 | /* Flags for disasm_flags field above */ |
| 711 | #define ACPI_DASM_RESOURCE 0x01 | 711 | |
| 712 | #define ACPI_DASM_STRING 0x02 | 712 | #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ |
| 713 | #define ACPI_DASM_UNICODE 0x03 | 713 | #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ |
| 714 | #define ACPI_DASM_EISAID 0x04 | 714 | #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ |
| 715 | #define ACPI_DASM_MATCHOP 0x05 | 715 | #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ |
| 716 | #define ACPI_DASM_LNOT_PREFIX 0x06 | 716 | #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ |
| 717 | #define ACPI_DASM_LNOT_SUFFIX 0x07 | 717 | #define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ |
| 718 | #define ACPI_DASM_IGNORE 0x08 | 718 | #define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ |
| 719 | #define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a Lnot_equal (etc.) pair of opcodes */ | ||
| 720 | #define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a Lnot_equal (etc.) pair of opcodes */ | ||
| 721 | #define ACPI_DASM_IGNORE 0x09 /* Not used at this time */ | ||
| 719 | 722 | ||
| 720 | /* | 723 | /* |
| 721 | * Generic operation (for example: If, While, Store) | 724 | * Generic operation (for example: If, While, Store) |
| @@ -932,6 +935,7 @@ struct acpi_bit_register_info { | |||
| 932 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 | 935 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 |
| 933 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A | 936 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A |
| 934 | #define ACPI_OSI_WIN_7 0x0B | 937 | #define ACPI_OSI_WIN_7 0x0B |
| 938 | #define ACPI_OSI_WIN_8 0x0C | ||
| 935 | 939 | ||
| 936 | #define ACPI_ALWAYS_ILLEGAL 0x00 | 940 | #define ACPI_ALWAYS_ILLEGAL 0x00 |
| 937 | 941 | ||
| @@ -1024,6 +1028,7 @@ struct acpi_port_info { | |||
| 1024 | ****************************************************************************/ | 1028 | ****************************************************************************/ |
| 1025 | 1029 | ||
| 1026 | struct acpi_db_method_info { | 1030 | struct acpi_db_method_info { |
| 1031 | acpi_handle method; | ||
| 1027 | acpi_handle main_thread_gate; | 1032 | acpi_handle main_thread_gate; |
| 1028 | acpi_handle thread_complete_gate; | 1033 | acpi_handle thread_complete_gate; |
| 1029 | acpi_thread_id *threads; | 1034 | acpi_thread_id *threads; |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 832b6198652e..a7f68c47f517 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
| @@ -277,10 +277,33 @@ | |||
| 277 | 277 | ||
| 278 | /* Bitfields within ACPI registers */ | 278 | /* Bitfields within ACPI registers */ |
| 279 | 279 | ||
| 280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | 280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \ |
| 281 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | 281 | ((val << pos) & mask) |
| 282 | 282 | ||
| 283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 283 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \ |
| 284 | reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | ||
| 285 | |||
| 286 | #define ACPI_INSERT_BITS(target, mask, source) \ | ||
| 287 | target = ((target & (~(mask))) | (source & mask)) | ||
| 288 | |||
| 289 | /* Generic bitfield macros and masks */ | ||
| 290 | |||
| 291 | #define ACPI_GET_BITS(source_ptr, position, mask) \ | ||
| 292 | ((*source_ptr >> position) & mask) | ||
| 293 | |||
| 294 | #define ACPI_SET_BITS(target_ptr, position, mask, value) \ | ||
| 295 | (*target_ptr |= ((value & mask) << position)) | ||
| 296 | |||
| 297 | #define ACPI_1BIT_MASK 0x00000001 | ||
| 298 | #define ACPI_2BIT_MASK 0x00000003 | ||
| 299 | #define ACPI_3BIT_MASK 0x00000007 | ||
| 300 | #define ACPI_4BIT_MASK 0x0000000F | ||
| 301 | #define ACPI_5BIT_MASK 0x0000001F | ||
| 302 | #define ACPI_6BIT_MASK 0x0000003F | ||
| 303 | #define ACPI_7BIT_MASK 0x0000007F | ||
| 304 | #define ACPI_8BIT_MASK 0x000000FF | ||
| 305 | #define ACPI_16BIT_MASK 0x0000FFFF | ||
| 306 | #define ACPI_24BIT_MASK 0x00FFFFFF | ||
| 284 | 307 | ||
| 285 | /* | 308 | /* |
| 286 | * An object of type struct acpi_namespace_node can appear in some contexts | 309 | * An object of type struct acpi_namespace_node can appear in some contexts |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 552aa3a50c84..557510084c7a 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
| @@ -230,6 +230,20 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
| 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
| 231 | break; | 231 | break; |
| 232 | 232 | ||
| 233 | case ACPI_TYPE_METHOD: | ||
| 234 | |||
| 235 | /* | ||
| 236 | * Allow scope change to root during execution of module-level | ||
| 237 | * code. Root is typed METHOD during this time. | ||
| 238 | */ | ||
| 239 | if ((node == acpi_gbl_root_node) && | ||
| 240 | (walk_state-> | ||
| 241 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
| 242 | break; | ||
| 243 | } | ||
| 244 | |||
| 245 | /*lint -fallthrough */ | ||
| 246 | |||
| 233 | default: | 247 | default: |
| 234 | 248 | ||
| 235 | /* All other types are an error */ | 249 | /* All other types are an error */ |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index ae7147724763..89c0114210c0 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
| @@ -230,6 +230,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
| 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
| 231 | break; | 231 | break; |
| 232 | 232 | ||
| 233 | case ACPI_TYPE_METHOD: | ||
| 234 | |||
| 235 | /* | ||
| 236 | * Allow scope change to root during execution of module-level | ||
| 237 | * code. Root is typed METHOD during this time. | ||
| 238 | */ | ||
| 239 | if ((node == acpi_gbl_root_node) && | ||
| 240 | (walk_state-> | ||
| 241 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
| 242 | break; | ||
| 243 | } | ||
| 244 | |||
| 245 | /*lint -fallthrough */ | ||
| 246 | |||
| 233 | default: | 247 | default: |
| 234 | 248 | ||
| 235 | /* All other types are an error */ | 249 | /* All other types are an error */ |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index afbd5cb391f6..ef0193d74b5d 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -80,8 +80,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) | |||
| 80 | return_ACPI_STATUS(AE_NOT_EXIST); | 80 | return_ACPI_STATUS(AE_NOT_EXIST); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 83 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 84 | gpe_register_info); | ||
| 85 | 84 | ||
| 86 | /* Clear the run bit up front */ | 85 | /* Clear the run bit up front */ |
| 87 | 86 | ||
| @@ -379,6 +378,18 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
| 379 | */ | 378 | */ |
| 380 | if (!(gpe_register_info->enable_for_run | | 379 | if (!(gpe_register_info->enable_for_run | |
| 381 | gpe_register_info->enable_for_wake)) { | 380 | gpe_register_info->enable_for_wake)) { |
| 381 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | ||
| 382 | "Ignore disabled registers for GPE%02X-GPE%02X: " | ||
| 383 | "RunEnable=%02X, WakeEnable=%02X\n", | ||
| 384 | gpe_register_info-> | ||
| 385 | base_gpe_number, | ||
| 386 | gpe_register_info-> | ||
| 387 | base_gpe_number + | ||
| 388 | (ACPI_GPE_REGISTER_WIDTH - 1), | ||
| 389 | gpe_register_info-> | ||
| 390 | enable_for_run, | ||
| 391 | gpe_register_info-> | ||
| 392 | enable_for_wake)); | ||
| 382 | continue; | 393 | continue; |
| 383 | } | 394 | } |
| 384 | 395 | ||
| @@ -401,9 +412,14 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
| 401 | } | 412 | } |
| 402 | 413 | ||
| 403 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, | 414 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, |
| 404 | "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", | 415 | "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " |
| 416 | "RunEnable=%02X, WakeEnable=%02X\n", | ||
| 405 | gpe_register_info->base_gpe_number, | 417 | gpe_register_info->base_gpe_number, |
| 406 | status_reg, enable_reg)); | 418 | gpe_register_info->base_gpe_number + |
| 419 | (ACPI_GPE_REGISTER_WIDTH - 1), | ||
| 420 | status_reg, enable_reg, | ||
| 421 | gpe_register_info->enable_for_run, | ||
| 422 | gpe_register_info->enable_for_wake)); | ||
| 407 | 423 | ||
| 408 | /* Check if there is anything active at all in this register */ | 424 | /* Check if there is anything active at all in this register */ |
| 409 | 425 | ||
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 6affbdb4b88c..87c5f2332260 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
| @@ -357,8 +357,7 @@ acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 ac | |||
| 357 | goto unlock_and_exit; | 357 | goto unlock_and_exit; |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | register_bit = | 360 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 361 | acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info); | ||
| 362 | 361 | ||
| 363 | /* Perform the action */ | 362 | /* Perform the action */ |
| 364 | 363 | ||
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 25bd28c4ae8d..db4076580e2b 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
| @@ -60,7 +60,6 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 60 | * FUNCTION: acpi_hw_get_gpe_register_bit | 60 | * FUNCTION: acpi_hw_get_gpe_register_bit |
| 61 | * | 61 | * |
| 62 | * PARAMETERS: gpe_event_info - Info block for the GPE | 62 | * PARAMETERS: gpe_event_info - Info block for the GPE |
| 63 | * gpe_register_info - Info block for the GPE register | ||
| 64 | * | 63 | * |
| 65 | * RETURN: Register mask with a one in the GPE bit position | 64 | * RETURN: Register mask with a one in the GPE bit position |
| 66 | * | 65 | * |
| @@ -69,11 +68,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 69 | * | 68 | * |
| 70 | ******************************************************************************/ | 69 | ******************************************************************************/ |
| 71 | 70 | ||
| 72 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | 71 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info) |
| 73 | struct acpi_gpe_register_info *gpe_register_info) | ||
| 74 | { | 72 | { |
| 75 | return (u32)1 << (gpe_event_info->gpe_number - | 73 | return (u32)1 << (gpe_event_info->gpe_number - |
| 76 | gpe_register_info->base_gpe_number); | 74 | gpe_event_info->register_info->base_gpe_number); |
| 77 | } | 75 | } |
| 78 | 76 | ||
| 79 | /****************************************************************************** | 77 | /****************************************************************************** |
| @@ -115,8 +113,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
| 115 | 113 | ||
| 116 | /* Set or clear just the bit that corresponds to this GPE */ | 114 | /* Set or clear just the bit that corresponds to this GPE */ |
| 117 | 115 | ||
| 118 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 116 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 119 | gpe_register_info); | ||
| 120 | switch (action) { | 117 | switch (action) { |
| 121 | case ACPI_GPE_CONDITIONAL_ENABLE: | 118 | case ACPI_GPE_CONDITIONAL_ENABLE: |
| 122 | 119 | ||
| @@ -178,8 +175,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
| 178 | * Write a one to the appropriate bit in the status register to | 175 | * Write a one to the appropriate bit in the status register to |
| 179 | * clear this GPE. | 176 | * clear this GPE. |
| 180 | */ | 177 | */ |
| 181 | register_bit = | 178 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 182 | acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info); | ||
| 183 | 179 | ||
| 184 | status = acpi_hw_write(register_bit, | 180 | status = acpi_hw_write(register_bit, |
| 185 | &gpe_register_info->status_address); | 181 | &gpe_register_info->status_address); |
| @@ -222,8 +218,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
| 222 | 218 | ||
| 223 | /* Get the register bitmask for this GPE */ | 219 | /* Get the register bitmask for this GPE */ |
| 224 | 220 | ||
| 225 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, | 221 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 226 | gpe_register_info); | ||
| 227 | 222 | ||
| 228 | /* GPE currently enabled? (enabled for runtime?) */ | 223 | /* GPE currently enabled? (enabled for runtime?) */ |
| 229 | 224 | ||
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index 1f165a750ae2..0ff1ecea5c3a 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c | |||
| @@ -381,7 +381,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) | |||
| 381 | * FUNCTION: acpi_leave_sleep_state_prep | 381 | * FUNCTION: acpi_leave_sleep_state_prep |
| 382 | * | 382 | * |
| 383 | * PARAMETERS: sleep_state - Which sleep state we are exiting | 383 | * PARAMETERS: sleep_state - Which sleep state we are exiting |
| 384 | * flags - ACPI_EXECUTE_BFS to run optional method | ||
| 385 | * | 384 | * |
| 386 | * RETURN: Status | 385 | * RETURN: Status |
| 387 | * | 386 | * |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 7ee4e6aeb0a2..2526aaf945ee 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
| @@ -264,7 +264,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
| 264 | switch (type) { | 264 | switch (type) { |
| 265 | case ACPI_TYPE_PROCESSOR: | 265 | case ACPI_TYPE_PROCESSOR: |
| 266 | 266 | ||
| 267 | acpi_os_printf("ID %X Len %.4X Addr %p\n", | 267 | acpi_os_printf("ID %02X Len %02X Addr %p\n", |
| 268 | obj_desc->processor.proc_id, | 268 | obj_desc->processor.proc_id, |
| 269 | obj_desc->processor.length, | 269 | obj_desc->processor.length, |
| 270 | ACPI_CAST_PTR(void, | 270 | ACPI_CAST_PTR(void, |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 74f97d74db1c..70f9d787c82c 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
| @@ -350,6 +350,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
| 350 | acpi_status acpi_tb_resize_root_table_list(void) | 350 | acpi_status acpi_tb_resize_root_table_list(void) |
| 351 | { | 351 | { |
| 352 | struct acpi_table_desc *tables; | 352 | struct acpi_table_desc *tables; |
| 353 | u32 table_count; | ||
| 353 | 354 | ||
| 354 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); | 355 | ACPI_FUNCTION_TRACE(tb_resize_root_table_list); |
| 355 | 356 | ||
| @@ -363,8 +364,13 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
| 363 | 364 | ||
| 364 | /* Increase the Table Array size */ | 365 | /* Increase the Table Array size */ |
| 365 | 366 | ||
| 366 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. | 367 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
| 367 | max_table_count + | 368 | table_count = acpi_gbl_root_table_list.max_table_count; |
| 369 | } else { | ||
| 370 | table_count = acpi_gbl_root_table_list.current_table_count; | ||
| 371 | } | ||
| 372 | |||
| 373 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count + | ||
| 368 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * | 374 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * |
| 369 | sizeof(struct acpi_table_desc)); | 375 | sizeof(struct acpi_table_desc)); |
| 370 | if (!tables) { | 376 | if (!tables) { |
| @@ -377,8 +383,8 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
| 377 | 383 | ||
| 378 | if (acpi_gbl_root_table_list.tables) { | 384 | if (acpi_gbl_root_table_list.tables) { |
| 379 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | 385 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, |
| 380 | (acpi_size) acpi_gbl_root_table_list. | 386 | (acpi_size) table_count * |
| 381 | max_table_count * sizeof(struct acpi_table_desc)); | 387 | sizeof(struct acpi_table_desc)); |
| 382 | 388 | ||
| 383 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | 389 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
| 384 | ACPI_FREE(acpi_gbl_root_table_list.tables); | 390 | ACPI_FREE(acpi_gbl_root_table_list.tables); |
| @@ -386,9 +392,9 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
| 386 | } | 392 | } |
| 387 | 393 | ||
| 388 | acpi_gbl_root_table_list.tables = tables; | 394 | acpi_gbl_root_table_list.tables = tables; |
| 389 | acpi_gbl_root_table_list.max_table_count += | 395 | acpi_gbl_root_table_list.max_table_count = |
| 390 | ACPI_ROOT_TABLE_SIZE_INCREMENT; | 396 | table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT; |
| 391 | acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED; | 397 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED; |
| 392 | 398 | ||
| 393 | return_ACPI_STATUS(AE_OK); | 399 | return_ACPI_STATUS(AE_OK); |
| 394 | } | 400 | } |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index 29e51bc01383..21101262e47a 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
| @@ -159,14 +159,12 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, | |||
| 159 | * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the | 159 | * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the |
| 160 | * root list from the previously provided scratch area. Should | 160 | * root list from the previously provided scratch area. Should |
| 161 | * be called once dynamic memory allocation is available in the | 161 | * be called once dynamic memory allocation is available in the |
| 162 | * kernel | 162 | * kernel. |
| 163 | * | 163 | * |
| 164 | ******************************************************************************/ | 164 | ******************************************************************************/ |
| 165 | acpi_status acpi_reallocate_root_table(void) | 165 | acpi_status acpi_reallocate_root_table(void) |
| 166 | { | 166 | { |
| 167 | struct acpi_table_desc *tables; | 167 | acpi_status status; |
| 168 | acpi_size new_size; | ||
| 169 | acpi_size current_size; | ||
| 170 | 168 | ||
| 171 | ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); | 169 | ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); |
| 172 | 170 | ||
| @@ -178,39 +176,10 @@ acpi_status acpi_reallocate_root_table(void) | |||
| 178 | return_ACPI_STATUS(AE_SUPPORT); | 176 | return_ACPI_STATUS(AE_SUPPORT); |
| 179 | } | 177 | } |
| 180 | 178 | ||
| 181 | /* | 179 | acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE; |
| 182 | * Get the current size of the root table and add the default | ||
| 183 | * increment to create the new table size. | ||
| 184 | */ | ||
| 185 | current_size = (acpi_size) | ||
| 186 | acpi_gbl_root_table_list.current_table_count * | ||
| 187 | sizeof(struct acpi_table_desc); | ||
| 188 | |||
| 189 | new_size = current_size + | ||
| 190 | (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc)); | ||
| 191 | |||
| 192 | /* Create new array and copy the old array */ | ||
| 193 | |||
| 194 | tables = ACPI_ALLOCATE_ZEROED(new_size); | ||
| 195 | if (!tables) { | ||
| 196 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
| 197 | } | ||
| 198 | 180 | ||
| 199 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size); | 181 | status = acpi_tb_resize_root_table_list(); |
| 200 | 182 | return_ACPI_STATUS(status); | |
| 201 | /* | ||
| 202 | * Update the root table descriptor. The new size will be the current | ||
| 203 | * number of tables plus the increment, independent of the reserved | ||
| 204 | * size of the original table list. | ||
| 205 | */ | ||
| 206 | acpi_gbl_root_table_list.tables = tables; | ||
| 207 | acpi_gbl_root_table_list.max_table_count = | ||
| 208 | acpi_gbl_root_table_list.current_table_count + | ||
| 209 | ACPI_ROOT_TABLE_SIZE_INCREMENT; | ||
| 210 | acpi_gbl_root_table_list.flags = | ||
| 211 | ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; | ||
| 212 | |||
| 213 | return_ACPI_STATUS(AE_OK); | ||
| 214 | } | 183 | } |
| 215 | 184 | ||
| 216 | /******************************************************************************* | 185 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 34ef0bd7e4b4..676285d6116d 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
| @@ -73,6 +73,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { | |||
| 73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | 73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ |
| 74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ | 74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ |
| 75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | 75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ |
| 76 | {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ | ||
| 76 | 77 | ||
| 77 | /* Feature Group Strings */ | 78 | /* Feature Group Strings */ |
| 78 | 79 | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 534179f1177b..b09632b4f5b3 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Module Name: utxface - External interfaces for "global" ACPI functions | 3 | * Module Name: utxface - External interfaces, miscellaneous utility functions |
| 4 | * | 4 | * |
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| @@ -53,271 +53,6 @@ | |||
| 53 | #define _COMPONENT ACPI_UTILITIES | 53 | #define _COMPONENT ACPI_UTILITIES |
| 54 | ACPI_MODULE_NAME("utxface") | 54 | ACPI_MODULE_NAME("utxface") |
| 55 | 55 | ||
| 56 | #ifndef ACPI_ASL_COMPILER | ||
| 57 | /******************************************************************************* | ||
| 58 | * | ||
| 59 | * FUNCTION: acpi_initialize_subsystem | ||
| 60 | * | ||
| 61 | * PARAMETERS: None | ||
| 62 | * | ||
| 63 | * RETURN: Status | ||
| 64 | * | ||
| 65 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
| 66 | * called, so any early initialization belongs here. | ||
| 67 | * | ||
| 68 | ******************************************************************************/ | ||
| 69 | acpi_status __init acpi_initialize_subsystem(void) | ||
| 70 | { | ||
| 71 | acpi_status status; | ||
| 72 | |||
| 73 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
| 74 | |||
| 75 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
| 76 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
| 77 | |||
| 78 | /* Initialize the OS-Dependent layer */ | ||
| 79 | |||
| 80 | status = acpi_os_initialize(); | ||
| 81 | if (ACPI_FAILURE(status)) { | ||
| 82 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
| 83 | return_ACPI_STATUS(status); | ||
| 84 | } | ||
| 85 | |||
| 86 | /* Initialize all globals used by the subsystem */ | ||
| 87 | |||
| 88 | status = acpi_ut_init_globals(); | ||
| 89 | if (ACPI_FAILURE(status)) { | ||
| 90 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 91 | "During initialization of globals")); | ||
| 92 | return_ACPI_STATUS(status); | ||
| 93 | } | ||
| 94 | |||
| 95 | /* Create the default mutex objects */ | ||
| 96 | |||
| 97 | status = acpi_ut_mutex_initialize(); | ||
| 98 | if (ACPI_FAILURE(status)) { | ||
| 99 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 100 | "During Global Mutex creation")); | ||
| 101 | return_ACPI_STATUS(status); | ||
| 102 | } | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Initialize the namespace manager and | ||
| 106 | * the root of the namespace tree | ||
| 107 | */ | ||
| 108 | status = acpi_ns_root_initialize(); | ||
| 109 | if (ACPI_FAILURE(status)) { | ||
| 110 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 111 | "During Namespace initialization")); | ||
| 112 | return_ACPI_STATUS(status); | ||
| 113 | } | ||
| 114 | |||
| 115 | /* Initialize the global OSI interfaces list with the static names */ | ||
| 116 | |||
| 117 | status = acpi_ut_initialize_interfaces(); | ||
| 118 | if (ACPI_FAILURE(status)) { | ||
| 119 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 120 | "During OSI interfaces initialization")); | ||
| 121 | return_ACPI_STATUS(status); | ||
| 122 | } | ||
| 123 | |||
| 124 | /* If configured, initialize the AML debugger */ | ||
| 125 | |||
| 126 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
| 127 | return_ACPI_STATUS(status); | ||
| 128 | } | ||
| 129 | |||
| 130 | /******************************************************************************* | ||
| 131 | * | ||
| 132 | * FUNCTION: acpi_enable_subsystem | ||
| 133 | * | ||
| 134 | * PARAMETERS: flags - Init/enable Options | ||
| 135 | * | ||
| 136 | * RETURN: Status | ||
| 137 | * | ||
| 138 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
| 139 | * Puts system into ACPI mode if it isn't already. | ||
| 140 | * | ||
| 141 | ******************************************************************************/ | ||
| 142 | acpi_status acpi_enable_subsystem(u32 flags) | ||
| 143 | { | ||
| 144 | acpi_status status = AE_OK; | ||
| 145 | |||
| 146 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
| 147 | |||
| 148 | #if (!ACPI_REDUCED_HARDWARE) | ||
| 149 | |||
| 150 | /* Enable ACPI mode */ | ||
| 151 | |||
| 152 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
| 153 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 154 | "[Init] Going into ACPI mode\n")); | ||
| 155 | |||
| 156 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
| 157 | |||
| 158 | status = acpi_enable(); | ||
| 159 | if (ACPI_FAILURE(status)) { | ||
| 160 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
| 161 | return_ACPI_STATUS(status); | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | /* | ||
| 166 | * Obtain a permanent mapping for the FACS. This is required for the | ||
| 167 | * Global Lock and the Firmware Waking Vector | ||
| 168 | */ | ||
| 169 | status = acpi_tb_initialize_facs(); | ||
| 170 | if (ACPI_FAILURE(status)) { | ||
| 171 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
| 172 | return_ACPI_STATUS(status); | ||
| 173 | } | ||
| 174 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
| 175 | |||
| 176 | /* | ||
| 177 | * Install the default op_region handlers. These are installed unless | ||
| 178 | * other handlers have already been installed via the | ||
| 179 | * install_address_space_handler interface. | ||
| 180 | */ | ||
| 181 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
| 182 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 183 | "[Init] Installing default address space handlers\n")); | ||
| 184 | |||
| 185 | status = acpi_ev_install_region_handlers(); | ||
| 186 | if (ACPI_FAILURE(status)) { | ||
| 187 | return_ACPI_STATUS(status); | ||
| 188 | } | ||
| 189 | } | ||
| 190 | #if (!ACPI_REDUCED_HARDWARE) | ||
| 191 | /* | ||
| 192 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
| 193 | * | ||
| 194 | * Note1: We must have the hardware and events initialized before we can | ||
| 195 | * execute any control methods safely. Any control method can require | ||
| 196 | * ACPI hardware support, so the hardware must be fully initialized before | ||
| 197 | * any method execution! | ||
| 198 | * | ||
| 199 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
| 200 | * initialized, but cannot be enabled until after the hardware is | ||
| 201 | * completely initialized (SCI and global_lock activated) | ||
| 202 | */ | ||
| 203 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
| 204 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 205 | "[Init] Initializing ACPI events\n")); | ||
| 206 | |||
| 207 | status = acpi_ev_initialize_events(); | ||
| 208 | if (ACPI_FAILURE(status)) { | ||
| 209 | return_ACPI_STATUS(status); | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | /* | ||
| 214 | * Install the SCI handler and Global Lock handler. This completes the | ||
| 215 | * hardware initialization. | ||
| 216 | */ | ||
| 217 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
| 218 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 219 | "[Init] Installing SCI/GL handlers\n")); | ||
| 220 | |||
| 221 | status = acpi_ev_install_xrupt_handlers(); | ||
| 222 | if (ACPI_FAILURE(status)) { | ||
| 223 | return_ACPI_STATUS(status); | ||
| 224 | } | ||
| 225 | } | ||
| 226 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
| 227 | |||
| 228 | return_ACPI_STATUS(status); | ||
| 229 | } | ||
| 230 | |||
| 231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
| 232 | |||
| 233 | /******************************************************************************* | ||
| 234 | * | ||
| 235 | * FUNCTION: acpi_initialize_objects | ||
| 236 | * | ||
| 237 | * PARAMETERS: flags - Init/enable Options | ||
| 238 | * | ||
| 239 | * RETURN: Status | ||
| 240 | * | ||
| 241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
| 242 | * objects and executing AML code for Regions, buffers, etc. | ||
| 243 | * | ||
| 244 | ******************************************************************************/ | ||
| 245 | acpi_status acpi_initialize_objects(u32 flags) | ||
| 246 | { | ||
| 247 | acpi_status status = AE_OK; | ||
| 248 | |||
| 249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
| 250 | |||
| 251 | /* | ||
| 252 | * Run all _REG methods | ||
| 253 | * | ||
| 254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
| 255 | * initialized, even if they contain executable AML (see the call to | ||
| 256 | * acpi_ns_initialize_objects below). | ||
| 257 | */ | ||
| 258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
| 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 260 | "[Init] Executing _REG OpRegion methods\n")); | ||
| 261 | |||
| 262 | status = acpi_ev_initialize_op_regions(); | ||
| 263 | if (ACPI_FAILURE(status)) { | ||
| 264 | return_ACPI_STATUS(status); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | /* | ||
| 269 | * Execute any module-level code that was detected during the table load | ||
| 270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
| 271 | * contain this type of code. Each block of detected executable AML code | ||
| 272 | * outside of any control method is wrapped with a temporary control | ||
| 273 | * method object and placed on a global list. The methods on this list | ||
| 274 | * are executed below. | ||
| 275 | */ | ||
| 276 | acpi_ns_exec_module_code_list(); | ||
| 277 | |||
| 278 | /* | ||
| 279 | * Initialize the objects that remain uninitialized. This runs the | ||
| 280 | * executable AML that may be part of the declaration of these objects: | ||
| 281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
| 282 | */ | ||
| 283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
| 284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
| 286 | |||
| 287 | status = acpi_ns_initialize_objects(); | ||
| 288 | if (ACPI_FAILURE(status)) { | ||
| 289 | return_ACPI_STATUS(status); | ||
| 290 | } | ||
| 291 | } | ||
| 292 | |||
| 293 | /* | ||
| 294 | * Initialize all device objects in the namespace. This runs the device | ||
| 295 | * _STA and _INI methods. | ||
| 296 | */ | ||
| 297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
| 298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 299 | "[Init] Initializing ACPI Devices\n")); | ||
| 300 | |||
| 301 | status = acpi_ns_initialize_devices(); | ||
| 302 | if (ACPI_FAILURE(status)) { | ||
| 303 | return_ACPI_STATUS(status); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 307 | /* | ||
| 308 | * Empty the caches (delete the cached objects) on the assumption that | ||
| 309 | * the table load filled them up more than they will be at runtime -- | ||
| 310 | * thus wasting non-paged memory. | ||
| 311 | */ | ||
| 312 | status = acpi_purge_cached_objects(); | ||
| 313 | |||
| 314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
| 315 | return_ACPI_STATUS(status); | ||
| 316 | } | ||
| 317 | |||
| 318 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
| 319 | |||
| 320 | #endif | ||
| 321 | /******************************************************************************* | 56 | /******************************************************************************* |
| 322 | * | 57 | * |
| 323 | * FUNCTION: acpi_terminate | 58 | * FUNCTION: acpi_terminate |
| @@ -683,3 +418,90 @@ acpi_check_address_range(acpi_adr_space_type space_id, | |||
| 683 | 418 | ||
| 684 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) | 419 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) |
| 685 | #endif /* !ACPI_ASL_COMPILER */ | 420 | #endif /* !ACPI_ASL_COMPILER */ |
| 421 | /******************************************************************************* | ||
| 422 | * | ||
| 423 | * FUNCTION: acpi_decode_pld_buffer | ||
| 424 | * | ||
| 425 | * PARAMETERS: in_buffer - Buffer returned by _PLD method | ||
| 426 | * length - Length of the in_buffer | ||
| 427 | * return_buffer - Where the decode buffer is returned | ||
| 428 | * | ||
| 429 | * RETURN: Status and the decoded _PLD buffer. User must deallocate | ||
| 430 | * the buffer via ACPI_FREE. | ||
| 431 | * | ||
| 432 | * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into | ||
| 433 | * a local struct that is much more useful to an ACPI driver. | ||
| 434 | * | ||
| 435 | ******************************************************************************/ | ||
| 436 | acpi_status | ||
| 437 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
| 438 | acpi_size length, struct acpi_pld_info ** return_buffer) | ||
| 439 | { | ||
| 440 | struct acpi_pld_info *pld_info; | ||
| 441 | u32 *buffer = ACPI_CAST_PTR(u32, in_buffer); | ||
| 442 | u32 dword; | ||
| 443 | |||
| 444 | /* Parameter validation */ | ||
| 445 | |||
| 446 | if (!in_buffer || !return_buffer || (length < 16)) { | ||
| 447 | return (AE_BAD_PARAMETER); | ||
| 448 | } | ||
| 449 | |||
| 450 | pld_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pld_info)); | ||
| 451 | if (!pld_info) { | ||
| 452 | return (AE_NO_MEMORY); | ||
| 453 | } | ||
| 454 | |||
| 455 | /* First 32-bit DWord */ | ||
| 456 | |||
| 457 | ACPI_MOVE_32_TO_32(&dword, &buffer[0]); | ||
| 458 | pld_info->revision = ACPI_PLD_GET_REVISION(&dword); | ||
| 459 | pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword); | ||
| 460 | pld_info->color = ACPI_PLD_GET_COLOR(&dword); | ||
| 461 | |||
| 462 | /* Second 32-bit DWord */ | ||
| 463 | |||
| 464 | ACPI_MOVE_32_TO_32(&dword, &buffer[1]); | ||
| 465 | pld_info->width = ACPI_PLD_GET_WIDTH(&dword); | ||
| 466 | pld_info->height = ACPI_PLD_GET_HEIGHT(&dword); | ||
| 467 | |||
| 468 | /* Third 32-bit DWord */ | ||
| 469 | |||
| 470 | ACPI_MOVE_32_TO_32(&dword, &buffer[2]); | ||
| 471 | pld_info->user_visible = ACPI_PLD_GET_USER_VISIBLE(&dword); | ||
| 472 | pld_info->dock = ACPI_PLD_GET_DOCK(&dword); | ||
| 473 | pld_info->lid = ACPI_PLD_GET_LID(&dword); | ||
| 474 | pld_info->panel = ACPI_PLD_GET_PANEL(&dword); | ||
| 475 | pld_info->vertical_position = ACPI_PLD_GET_VERTICAL(&dword); | ||
| 476 | pld_info->horizontal_position = ACPI_PLD_GET_HORIZONTAL(&dword); | ||
| 477 | pld_info->shape = ACPI_PLD_GET_SHAPE(&dword); | ||
| 478 | pld_info->group_orientation = ACPI_PLD_GET_ORIENTATION(&dword); | ||
| 479 | pld_info->group_token = ACPI_PLD_GET_TOKEN(&dword); | ||
| 480 | pld_info->group_position = ACPI_PLD_GET_POSITION(&dword); | ||
| 481 | pld_info->bay = ACPI_PLD_GET_BAY(&dword); | ||
| 482 | |||
| 483 | /* Fourth 32-bit DWord */ | ||
| 484 | |||
| 485 | ACPI_MOVE_32_TO_32(&dword, &buffer[3]); | ||
| 486 | pld_info->ejectable = ACPI_PLD_GET_EJECTABLE(&dword); | ||
| 487 | pld_info->ospm_eject_required = ACPI_PLD_GET_OSPM_EJECT(&dword); | ||
| 488 | pld_info->cabinet_number = ACPI_PLD_GET_CABINET(&dword); | ||
| 489 | pld_info->card_cage_number = ACPI_PLD_GET_CARD_CAGE(&dword); | ||
| 490 | pld_info->reference = ACPI_PLD_GET_REFERENCE(&dword); | ||
| 491 | pld_info->rotation = ACPI_PLD_GET_ROTATION(&dword); | ||
| 492 | pld_info->order = ACPI_PLD_GET_ORDER(&dword); | ||
| 493 | |||
| 494 | if (length >= ACPI_PLD_BUFFER_SIZE) { | ||
| 495 | |||
| 496 | /* Fifth 32-bit DWord (Revision 2 of _PLD) */ | ||
| 497 | |||
| 498 | ACPI_MOVE_32_TO_32(&dword, &buffer[4]); | ||
| 499 | pld_info->vertical_offset = ACPI_PLD_GET_VERT_OFFSET(&dword); | ||
| 500 | pld_info->horizontal_offset = ACPI_PLD_GET_HORIZ_OFFSET(&dword); | ||
| 501 | } | ||
| 502 | |||
| 503 | *return_buffer = pld_info; | ||
| 504 | return (AE_OK); | ||
| 505 | } | ||
| 506 | |||
| 507 | ACPI_EXPORT_SYMBOL(acpi_decode_pld_buffer) | ||
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c new file mode 100644 index 000000000000..14f523627a5e --- /dev/null +++ b/drivers/acpi/acpica/utxfinit.c | |||
| @@ -0,0 +1,317 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: utxfinit - External interfaces for ACPICA initialization | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions, and the following disclaimer, | ||
| 16 | * without modification. | ||
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 20 | * including a substantially similar Disclaimer requirement for further | ||
| 21 | * binary redistribution. | ||
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 23 | * of any contributors may be used to endorse or promote products derived | ||
| 24 | * from this software without specific prior written permission. | ||
| 25 | * | ||
| 26 | * Alternatively, this software may be distributed under the terms of the | ||
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 28 | * Software Foundation. | ||
| 29 | * | ||
| 30 | * NO WARRANTY | ||
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #include <linux/export.h> | ||
| 45 | #include <acpi/acpi.h> | ||
| 46 | #include "accommon.h" | ||
| 47 | #include "acevents.h" | ||
| 48 | #include "acnamesp.h" | ||
| 49 | #include "acdebug.h" | ||
| 50 | #include "actables.h" | ||
| 51 | |||
| 52 | #define _COMPONENT ACPI_UTILITIES | ||
| 53 | ACPI_MODULE_NAME("utxfinit") | ||
| 54 | |||
| 55 | /******************************************************************************* | ||
| 56 | * | ||
| 57 | * FUNCTION: acpi_initialize_subsystem | ||
| 58 | * | ||
| 59 | * PARAMETERS: None | ||
| 60 | * | ||
| 61 | * RETURN: Status | ||
| 62 | * | ||
| 63 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
| 64 | * called, so any early initialization belongs here. | ||
| 65 | * | ||
| 66 | ******************************************************************************/ | ||
| 67 | acpi_status acpi_initialize_subsystem(void) | ||
| 68 | { | ||
| 69 | acpi_status status; | ||
| 70 | |||
| 71 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
| 72 | |||
| 73 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
| 74 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
| 75 | |||
| 76 | /* Initialize the OS-Dependent layer */ | ||
| 77 | |||
| 78 | status = acpi_os_initialize(); | ||
| 79 | if (ACPI_FAILURE(status)) { | ||
| 80 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
| 81 | return_ACPI_STATUS(status); | ||
| 82 | } | ||
| 83 | |||
| 84 | /* Initialize all globals used by the subsystem */ | ||
| 85 | |||
| 86 | status = acpi_ut_init_globals(); | ||
| 87 | if (ACPI_FAILURE(status)) { | ||
| 88 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 89 | "During initialization of globals")); | ||
| 90 | return_ACPI_STATUS(status); | ||
| 91 | } | ||
| 92 | |||
| 93 | /* Create the default mutex objects */ | ||
| 94 | |||
| 95 | status = acpi_ut_mutex_initialize(); | ||
| 96 | if (ACPI_FAILURE(status)) { | ||
| 97 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 98 | "During Global Mutex creation")); | ||
| 99 | return_ACPI_STATUS(status); | ||
| 100 | } | ||
| 101 | |||
| 102 | /* | ||
| 103 | * Initialize the namespace manager and | ||
| 104 | * the root of the namespace tree | ||
| 105 | */ | ||
| 106 | status = acpi_ns_root_initialize(); | ||
| 107 | if (ACPI_FAILURE(status)) { | ||
| 108 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 109 | "During Namespace initialization")); | ||
| 110 | return_ACPI_STATUS(status); | ||
| 111 | } | ||
| 112 | |||
| 113 | /* Initialize the global OSI interfaces list with the static names */ | ||
| 114 | |||
| 115 | status = acpi_ut_initialize_interfaces(); | ||
| 116 | if (ACPI_FAILURE(status)) { | ||
| 117 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 118 | "During OSI interfaces initialization")); | ||
| 119 | return_ACPI_STATUS(status); | ||
| 120 | } | ||
| 121 | |||
| 122 | /* If configured, initialize the AML debugger */ | ||
| 123 | |||
| 124 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
| 125 | return_ACPI_STATUS(status); | ||
| 126 | } | ||
| 127 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
| 128 | |||
| 129 | /******************************************************************************* | ||
| 130 | * | ||
| 131 | * FUNCTION: acpi_enable_subsystem | ||
| 132 | * | ||
| 133 | * PARAMETERS: flags - Init/enable Options | ||
| 134 | * | ||
| 135 | * RETURN: Status | ||
| 136 | * | ||
| 137 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
| 138 | * Puts system into ACPI mode if it isn't already. | ||
| 139 | * | ||
| 140 | ******************************************************************************/ | ||
| 141 | acpi_status acpi_enable_subsystem(u32 flags) | ||
| 142 | { | ||
| 143 | acpi_status status = AE_OK; | ||
| 144 | |||
| 145 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
| 146 | |||
| 147 | #if (!ACPI_REDUCED_HARDWARE) | ||
| 148 | |||
| 149 | /* Enable ACPI mode */ | ||
| 150 | |||
| 151 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
| 152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 153 | "[Init] Going into ACPI mode\n")); | ||
| 154 | |||
| 155 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
| 156 | |||
| 157 | status = acpi_enable(); | ||
| 158 | if (ACPI_FAILURE(status)) { | ||
| 159 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
| 160 | return_ACPI_STATUS(status); | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Obtain a permanent mapping for the FACS. This is required for the | ||
| 166 | * Global Lock and the Firmware Waking Vector | ||
| 167 | */ | ||
| 168 | status = acpi_tb_initialize_facs(); | ||
| 169 | if (ACPI_FAILURE(status)) { | ||
| 170 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
| 171 | return_ACPI_STATUS(status); | ||
| 172 | } | ||
| 173 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
| 174 | |||
| 175 | /* | ||
| 176 | * Install the default op_region handlers. These are installed unless | ||
| 177 | * other handlers have already been installed via the | ||
| 178 | * install_address_space_handler interface. | ||
| 179 | */ | ||
| 180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
| 181 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 182 | "[Init] Installing default address space handlers\n")); | ||
| 183 | |||
| 184 | status = acpi_ev_install_region_handlers(); | ||
| 185 | if (ACPI_FAILURE(status)) { | ||
| 186 | return_ACPI_STATUS(status); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | #if (!ACPI_REDUCED_HARDWARE) | ||
| 190 | /* | ||
| 191 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
| 192 | * | ||
| 193 | * Note1: We must have the hardware and events initialized before we can | ||
| 194 | * execute any control methods safely. Any control method can require | ||
| 195 | * ACPI hardware support, so the hardware must be fully initialized before | ||
| 196 | * any method execution! | ||
| 197 | * | ||
| 198 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
| 199 | * initialized, but cannot be enabled until after the hardware is | ||
| 200 | * completely initialized (SCI and global_lock activated) and the various | ||
| 201 | * initialization control methods are run (_REG, _STA, _INI) on the | ||
| 202 | * entire namespace. | ||
| 203 | */ | ||
| 204 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
| 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 206 | "[Init] Initializing ACPI events\n")); | ||
| 207 | |||
| 208 | status = acpi_ev_initialize_events(); | ||
| 209 | if (ACPI_FAILURE(status)) { | ||
| 210 | return_ACPI_STATUS(status); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | |||
| 214 | /* | ||
| 215 | * Install the SCI handler and Global Lock handler. This completes the | ||
| 216 | * hardware initialization. | ||
| 217 | */ | ||
| 218 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
| 219 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 220 | "[Init] Installing SCI/GL handlers\n")); | ||
| 221 | |||
| 222 | status = acpi_ev_install_xrupt_handlers(); | ||
| 223 | if (ACPI_FAILURE(status)) { | ||
| 224 | return_ACPI_STATUS(status); | ||
| 225 | } | ||
| 226 | } | ||
| 227 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
| 228 | |||
| 229 | return_ACPI_STATUS(status); | ||
| 230 | } | ||
| 231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
| 232 | |||
| 233 | /******************************************************************************* | ||
| 234 | * | ||
| 235 | * FUNCTION: acpi_initialize_objects | ||
| 236 | * | ||
| 237 | * PARAMETERS: flags - Init/enable Options | ||
| 238 | * | ||
| 239 | * RETURN: Status | ||
| 240 | * | ||
| 241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
| 242 | * objects and executing AML code for Regions, buffers, etc. | ||
| 243 | * | ||
| 244 | ******************************************************************************/ | ||
| 245 | acpi_status acpi_initialize_objects(u32 flags) | ||
| 246 | { | ||
| 247 | acpi_status status = AE_OK; | ||
| 248 | |||
| 249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
| 250 | |||
| 251 | /* | ||
| 252 | * Run all _REG methods | ||
| 253 | * | ||
| 254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
| 255 | * initialized, even if they contain executable AML (see the call to | ||
| 256 | * acpi_ns_initialize_objects below). | ||
| 257 | */ | ||
| 258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
| 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 260 | "[Init] Executing _REG OpRegion methods\n")); | ||
| 261 | |||
| 262 | status = acpi_ev_initialize_op_regions(); | ||
| 263 | if (ACPI_FAILURE(status)) { | ||
| 264 | return_ACPI_STATUS(status); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | /* | ||
| 269 | * Execute any module-level code that was detected during the table load | ||
| 270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
| 271 | * contain this type of code. Each block of detected executable AML code | ||
| 272 | * outside of any control method is wrapped with a temporary control | ||
| 273 | * method object and placed on a global list. The methods on this list | ||
| 274 | * are executed below. | ||
| 275 | */ | ||
| 276 | acpi_ns_exec_module_code_list(); | ||
| 277 | |||
| 278 | /* | ||
| 279 | * Initialize the objects that remain uninitialized. This runs the | ||
| 280 | * executable AML that may be part of the declaration of these objects: | ||
| 281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
| 282 | */ | ||
| 283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
| 284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
| 286 | |||
| 287 | status = acpi_ns_initialize_objects(); | ||
| 288 | if (ACPI_FAILURE(status)) { | ||
| 289 | return_ACPI_STATUS(status); | ||
| 290 | } | ||
| 291 | } | ||
| 292 | |||
| 293 | /* | ||
| 294 | * Initialize all device objects in the namespace. This runs the device | ||
| 295 | * _STA and _INI methods. | ||
| 296 | */ | ||
| 297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
| 298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
| 299 | "[Init] Initializing ACPI Devices\n")); | ||
| 300 | |||
| 301 | status = acpi_ns_initialize_devices(); | ||
| 302 | if (ACPI_FAILURE(status)) { | ||
| 303 | return_ACPI_STATUS(status); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 307 | /* | ||
| 308 | * Empty the caches (delete the cached objects) on the assumption that | ||
| 309 | * the table load filled them up more than they will be at runtime -- | ||
| 310 | * thus wasting non-paged memory. | ||
| 311 | */ | ||
| 312 | status = acpi_purge_cached_objects(); | ||
| 313 | |||
| 314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
| 315 | return_ACPI_STATUS(status); | ||
| 316 | } | ||
| 317 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 314a3b84bbc7..f0d936b65e37 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -450,15 +450,4 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
| 450 | return 0; | 450 | return 0; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static int __init acpi_button_init(void) | 453 | module_acpi_driver(acpi_button_driver); |
| 454 | { | ||
| 455 | return acpi_bus_register_driver(&acpi_button_driver); | ||
| 456 | } | ||
| 457 | |||
| 458 | static void __exit acpi_button_exit(void) | ||
| 459 | { | ||
| 460 | acpi_bus_unregister_driver(&acpi_button_driver); | ||
| 461 | } | ||
| 462 | |||
| 463 | module_init(acpi_button_init); | ||
| 464 | module_exit(acpi_button_exit); | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index bc36a476f1ab..3bd6a54702d6 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -212,24 +212,4 @@ static int acpi_fan_resume(struct device *dev) | |||
| 212 | } | 212 | } |
| 213 | #endif | 213 | #endif |
| 214 | 214 | ||
| 215 | static int __init acpi_fan_init(void) | 215 | module_acpi_driver(acpi_fan_driver); |
| 216 | { | ||
| 217 | int result = 0; | ||
| 218 | |||
| 219 | result = acpi_bus_register_driver(&acpi_fan_driver); | ||
| 220 | if (result < 0) | ||
| 221 | return -ENODEV; | ||
| 222 | |||
| 223 | return 0; | ||
| 224 | } | ||
| 225 | |||
| 226 | static void __exit acpi_fan_exit(void) | ||
| 227 | { | ||
| 228 | |||
| 229 | acpi_bus_unregister_driver(&acpi_fan_driver); | ||
| 230 | |||
| 231 | return; | ||
| 232 | } | ||
| 233 | |||
| 234 | module_init(acpi_fan_init); | ||
| 235 | module_exit(acpi_fan_exit); | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 243ee85e4d2e..d1a2d74033e9 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | static LIST_HEAD(bus_type_list); | 25 | static LIST_HEAD(bus_type_list); |
| 26 | static DECLARE_RWSEM(bus_type_sem); | 26 | static DECLARE_RWSEM(bus_type_sem); |
| 27 | 27 | ||
| 28 | #define PHYSICAL_NODE_STRING "physical_node" | ||
| 29 | |||
| 28 | int register_acpi_bus_type(struct acpi_bus_type *type) | 30 | int register_acpi_bus_type(struct acpi_bus_type *type) |
| 29 | { | 31 | { |
| 30 | if (acpi_disabled) | 32 | if (acpi_disabled) |
| @@ -124,84 +126,119 @@ acpi_handle acpi_get_child(acpi_handle parent, u64 address) | |||
| 124 | 126 | ||
| 125 | EXPORT_SYMBOL(acpi_get_child); | 127 | EXPORT_SYMBOL(acpi_get_child); |
| 126 | 128 | ||
| 127 | /* Link ACPI devices with physical devices */ | ||
| 128 | static void acpi_glue_data_handler(acpi_handle handle, | ||
| 129 | void *context) | ||
| 130 | { | ||
| 131 | /* we provide an empty handler */ | ||
| 132 | } | ||
| 133 | |||
| 134 | /* Note: a success call will increase reference count by one */ | ||
| 135 | struct device *acpi_get_physical_device(acpi_handle handle) | ||
| 136 | { | ||
| 137 | acpi_status status; | ||
| 138 | struct device *dev; | ||
| 139 | |||
| 140 | status = acpi_get_data(handle, acpi_glue_data_handler, (void **)&dev); | ||
| 141 | if (ACPI_SUCCESS(status)) | ||
| 142 | return get_device(dev); | ||
| 143 | return NULL; | ||
| 144 | } | ||
| 145 | |||
| 146 | EXPORT_SYMBOL(acpi_get_physical_device); | ||
| 147 | |||
| 148 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 129 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
| 149 | { | 130 | { |
| 150 | struct acpi_device *acpi_dev; | 131 | struct acpi_device *acpi_dev; |
| 151 | acpi_status status; | 132 | acpi_status status; |
| 133 | struct acpi_device_physical_node *physical_node; | ||
| 134 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | ||
| 135 | int retval = -EINVAL; | ||
| 152 | 136 | ||
| 153 | if (dev->archdata.acpi_handle) { | 137 | if (dev->archdata.acpi_handle) { |
| 154 | dev_warn(dev, "Drivers changed 'acpi_handle'\n"); | 138 | dev_warn(dev, "Drivers changed 'acpi_handle'\n"); |
| 155 | return -EINVAL; | 139 | return -EINVAL; |
| 156 | } | 140 | } |
| 141 | |||
| 157 | get_device(dev); | 142 | get_device(dev); |
| 158 | status = acpi_attach_data(handle, acpi_glue_data_handler, dev); | 143 | status = acpi_bus_get_device(handle, &acpi_dev); |
| 159 | if (ACPI_FAILURE(status)) { | 144 | if (ACPI_FAILURE(status)) |
| 160 | put_device(dev); | 145 | goto err; |
| 161 | return -EINVAL; | 146 | |
| 147 | physical_node = kzalloc(sizeof(struct acpi_device_physical_node), | ||
| 148 | GFP_KERNEL); | ||
| 149 | if (!physical_node) { | ||
| 150 | retval = -ENOMEM; | ||
| 151 | goto err; | ||
| 162 | } | 152 | } |
| 163 | dev->archdata.acpi_handle = handle; | ||
| 164 | 153 | ||
| 165 | status = acpi_bus_get_device(handle, &acpi_dev); | 154 | mutex_lock(&acpi_dev->physical_node_lock); |
| 166 | if (!ACPI_FAILURE(status)) { | 155 | /* allocate physical node id according to physical_node_id_bitmap */ |
| 167 | int ret; | 156 | physical_node->node_id = |
| 168 | 157 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, | |
| 169 | ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | 158 | ACPI_MAX_PHYSICAL_NODE); |
| 170 | "firmware_node"); | 159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { |
| 171 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | 160 | retval = -ENOSPC; |
| 172 | "physical_node"); | 161 | mutex_unlock(&acpi_dev->physical_node_lock); |
| 173 | if (acpi_dev->wakeup.flags.valid) | 162 | goto err; |
| 174 | device_set_wakeup_capable(dev, true); | ||
| 175 | } | 163 | } |
| 176 | 164 | ||
| 165 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); | ||
| 166 | physical_node->dev = dev; | ||
| 167 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); | ||
| 168 | acpi_dev->physical_node_count++; | ||
| 169 | mutex_unlock(&acpi_dev->physical_node_lock); | ||
| 170 | |||
| 171 | dev->archdata.acpi_handle = handle; | ||
| 172 | |||
| 173 | if (!physical_node->node_id) | ||
| 174 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); | ||
| 175 | else | ||
| 176 | sprintf(physical_node_name, | ||
| 177 | "physical_node%d", physical_node->node_id); | ||
| 178 | retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | ||
| 179 | physical_node_name); | ||
| 180 | retval = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | ||
| 181 | "firmware_node"); | ||
| 182 | |||
| 183 | if (acpi_dev->wakeup.flags.valid) | ||
| 184 | device_set_wakeup_capable(dev, true); | ||
| 185 | |||
| 177 | return 0; | 186 | return 0; |
| 187 | |||
| 188 | err: | ||
| 189 | put_device(dev); | ||
| 190 | return retval; | ||
| 178 | } | 191 | } |
| 179 | 192 | ||
| 180 | static int acpi_unbind_one(struct device *dev) | 193 | static int acpi_unbind_one(struct device *dev) |
| 181 | { | 194 | { |
| 195 | struct acpi_device_physical_node *entry; | ||
| 196 | struct acpi_device *acpi_dev; | ||
| 197 | acpi_status status; | ||
| 198 | struct list_head *node, *next; | ||
| 199 | |||
| 182 | if (!dev->archdata.acpi_handle) | 200 | if (!dev->archdata.acpi_handle) |
| 183 | return 0; | 201 | return 0; |
| 184 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { | ||
| 185 | struct acpi_device *acpi_dev; | ||
| 186 | 202 | ||
| 187 | /* acpi_get_physical_device increase refcnt by one */ | 203 | status = acpi_bus_get_device(dev->archdata.acpi_handle, |
| 188 | put_device(dev); | 204 | &acpi_dev); |
| 205 | if (ACPI_FAILURE(status)) | ||
| 206 | goto err; | ||
| 189 | 207 | ||
| 190 | if (!acpi_bus_get_device(dev->archdata.acpi_handle, | 208 | mutex_lock(&acpi_dev->physical_node_lock); |
| 191 | &acpi_dev)) { | 209 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
| 192 | sysfs_remove_link(&dev->kobj, "firmware_node"); | 210 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; |
| 193 | sysfs_remove_link(&acpi_dev->dev.kobj, "physical_node"); | 211 | |
| 194 | } | 212 | entry = list_entry(node, struct acpi_device_physical_node, |
| 213 | node); | ||
| 214 | if (entry->dev != dev) | ||
| 215 | continue; | ||
| 216 | |||
| 217 | list_del(node); | ||
| 218 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); | ||
| 195 | 219 | ||
| 196 | acpi_detach_data(dev->archdata.acpi_handle, | 220 | acpi_dev->physical_node_count--; |
| 197 | acpi_glue_data_handler); | 221 | |
| 222 | if (!entry->node_id) | ||
| 223 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); | ||
| 224 | else | ||
| 225 | sprintf(physical_node_name, | ||
| 226 | "physical_node%d", entry->node_id); | ||
| 227 | |||
| 228 | sysfs_remove_link(&acpi_dev->dev.kobj, physical_node_name); | ||
| 229 | sysfs_remove_link(&dev->kobj, "firmware_node"); | ||
| 198 | dev->archdata.acpi_handle = NULL; | 230 | dev->archdata.acpi_handle = NULL; |
| 199 | /* acpi_bind_one increase refcnt by one */ | 231 | /* acpi_bind_one increase refcnt by one */ |
| 200 | put_device(dev); | 232 | put_device(dev); |
| 201 | } else { | 233 | kfree(entry); |
| 202 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); | ||
| 203 | } | 234 | } |
| 235 | mutex_unlock(&acpi_dev->physical_node_lock); | ||
| 236 | |||
| 204 | return 0; | 237 | return 0; |
| 238 | |||
| 239 | err: | ||
| 240 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); | ||
| 241 | return -EINVAL; | ||
| 205 | } | 242 | } |
| 206 | 243 | ||
| 207 | static int acpi_platform_notify(struct device *dev) | 244 | static int acpi_platform_notify(struct device *dev) |
diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c index d0c1967f7597..20a0f2c3ca3b 100644 --- a/drivers/acpi/hed.c +++ b/drivers/acpi/hed.c | |||
| @@ -86,25 +86,7 @@ static struct acpi_driver acpi_hed_driver = { | |||
| 86 | .notify = acpi_hed_notify, | 86 | .notify = acpi_hed_notify, |
| 87 | }, | 87 | }, |
| 88 | }; | 88 | }; |
| 89 | 89 | module_acpi_driver(acpi_hed_driver); | |
| 90 | static int __init acpi_hed_init(void) | ||
| 91 | { | ||
| 92 | if (acpi_disabled) | ||
| 93 | return -ENODEV; | ||
| 94 | |||
| 95 | if (acpi_bus_register_driver(&acpi_hed_driver) < 0) | ||
| 96 | return -ENODEV; | ||
| 97 | |||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | static void __exit acpi_hed_exit(void) | ||
| 102 | { | ||
| 103 | acpi_bus_unregister_driver(&acpi_hed_driver); | ||
| 104 | } | ||
| 105 | |||
| 106 | module_init(acpi_hed_init); | ||
| 107 | module_exit(acpi_hed_exit); | ||
| 108 | 90 | ||
| 109 | ACPI_MODULE_NAME("hed"); | 91 | ACPI_MODULE_NAME("hed"); |
| 110 | MODULE_AUTHOR("Huang Ying"); | 92 | MODULE_AUTHOR("Huang Ying"); |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 251c7b6273a9..27adb090bb30 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
| @@ -302,26 +302,41 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
| 302 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 302 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
| 303 | struct acpi_device *dev = | 303 | struct acpi_device *dev = |
| 304 | container_of(node, struct acpi_device, wakeup_list); | 304 | container_of(node, struct acpi_device, wakeup_list); |
| 305 | struct device *ldev; | 305 | struct acpi_device_physical_node *entry; |
| 306 | 306 | ||
| 307 | if (!dev->wakeup.flags.valid) | 307 | if (!dev->wakeup.flags.valid) |
| 308 | continue; | 308 | continue; |
| 309 | 309 | ||
| 310 | ldev = acpi_get_physical_device(dev->handle); | 310 | seq_printf(seq, "%s\t S%d\t", |
| 311 | seq_printf(seq, "%s\t S%d\t%c%-8s ", | ||
| 312 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
| 313 | (u32) dev->wakeup.sleep_state, | 312 | (u32) dev->wakeup.sleep_state); |
| 314 | dev->wakeup.flags.run_wake ? '*' : ' ', | 313 | |
| 315 | (device_may_wakeup(&dev->dev) | 314 | if (!dev->physical_node_count) |
| 316 | || (ldev && device_may_wakeup(ldev))) ? | 315 | seq_printf(seq, "%c%-8s\n", |
| 317 | "enabled" : "disabled"); | 316 | dev->wakeup.flags.run_wake ? |
| 318 | if (ldev) | 317 | '*' : ' ', "disabled"); |
| 319 | seq_printf(seq, "%s:%s", | 318 | else { |
| 320 | ldev->bus ? ldev->bus->name : "no-bus", | 319 | struct device *ldev; |
| 321 | dev_name(ldev)); | 320 | list_for_each_entry(entry, &dev->physical_node_list, |
| 322 | seq_printf(seq, "\n"); | 321 | node) { |
| 323 | put_device(ldev); | 322 | ldev = get_device(entry->dev); |
| 324 | 323 | if (!ldev) | |
| 324 | continue; | ||
| 325 | |||
| 326 | if (&entry->node != | ||
| 327 | dev->physical_node_list.next) | ||
| 328 | seq_printf(seq, "\t\t"); | ||
| 329 | |||
| 330 | seq_printf(seq, "%c%-8s %s:%s\n", | ||
| 331 | dev->wakeup.flags.run_wake ? '*' : ' ', | ||
| 332 | (device_may_wakeup(&dev->dev) || | ||
| 333 | (ldev && device_may_wakeup(ldev))) ? | ||
| 334 | "enabled" : "disabled", | ||
| 335 | ldev->bus ? ldev->bus->name : | ||
| 336 | "no-bus", dev_name(ldev)); | ||
| 337 | put_device(ldev); | ||
| 338 | } | ||
| 339 | } | ||
| 325 | } | 340 | } |
| 326 | mutex_unlock(&acpi_device_lock); | 341 | mutex_unlock(&acpi_device_lock); |
| 327 | return 0; | 342 | return 0; |
| @@ -329,12 +344,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
| 329 | 344 | ||
| 330 | static void physical_device_enable_wakeup(struct acpi_device *adev) | 345 | static void physical_device_enable_wakeup(struct acpi_device *adev) |
| 331 | { | 346 | { |
| 332 | struct device *dev = acpi_get_physical_device(adev->handle); | 347 | struct acpi_device_physical_node *entry; |
| 333 | 348 | ||
| 334 | if (dev && device_can_wakeup(dev)) { | 349 | list_for_each_entry(entry, |
| 335 | bool enable = !device_may_wakeup(dev); | 350 | &adev->physical_node_list, node) |
| 336 | device_set_wakeup_enable(dev, enable); | 351 | if (entry->dev && device_can_wakeup(entry->dev)) { |
| 337 | } | 352 | bool enable = !device_may_wakeup(entry->dev); |
| 353 | device_set_wakeup_enable(entry->dev, enable); | ||
| 354 | } | ||
| 338 | } | 355 | } |
| 339 | 356 | ||
| 340 | static ssize_t | 357 | static ssize_t |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index f8d2a472795c..cf6129a8af7c 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
| @@ -310,23 +310,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type) | |||
| 310 | return 0; | 310 | return 0; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | static int __init acpi_smb_hc_init(void) | 313 | module_acpi_driver(acpi_smb_hc_driver); |
| 314 | { | ||
| 315 | int result; | ||
| 316 | |||
| 317 | result = acpi_bus_register_driver(&acpi_smb_hc_driver); | ||
| 318 | if (result < 0) | ||
| 319 | return -ENODEV; | ||
| 320 | return 0; | ||
| 321 | } | ||
| 322 | |||
| 323 | static void __exit acpi_smb_hc_exit(void) | ||
| 324 | { | ||
| 325 | acpi_bus_unregister_driver(&acpi_smb_hc_driver); | ||
| 326 | } | ||
| 327 | |||
| 328 | module_init(acpi_smb_hc_init); | ||
| 329 | module_exit(acpi_smb_hc_exit); | ||
| 330 | 314 | ||
| 331 | MODULE_LICENSE("GPL"); | 315 | MODULE_LICENSE("GPL"); |
| 332 | MODULE_AUTHOR("Alexey Starikovskiy"); | 316 | MODULE_AUTHOR("Alexey Starikovskiy"); |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 04302835723d..1fcb8678665c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -531,6 +531,8 @@ static int acpi_device_register(struct acpi_device *device) | |||
| 531 | INIT_LIST_HEAD(&device->children); | 531 | INIT_LIST_HEAD(&device->children); |
| 532 | INIT_LIST_HEAD(&device->node); | 532 | INIT_LIST_HEAD(&device->node); |
| 533 | INIT_LIST_HEAD(&device->wakeup_list); | 533 | INIT_LIST_HEAD(&device->wakeup_list); |
| 534 | INIT_LIST_HEAD(&device->physical_node_list); | ||
| 535 | mutex_init(&device->physical_node_lock); | ||
| 534 | 536 | ||
| 535 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); | 537 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); |
| 536 | if (!new_bus_id) { | 538 | if (!new_bus_id) { |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 3e87c9c538aa..462f7e300363 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
| @@ -384,7 +384,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
| 384 | EXPORT_SYMBOL(acpi_evaluate_reference); | 384 | EXPORT_SYMBOL(acpi_evaluate_reference); |
| 385 | 385 | ||
| 386 | acpi_status | 386 | acpi_status |
| 387 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld) | 387 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) |
| 388 | { | 388 | { |
| 389 | acpi_status status; | 389 | acpi_status status; |
| 390 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 390 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| @@ -400,13 +400,16 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld) | |||
| 400 | if (!output || output->type != ACPI_TYPE_PACKAGE | 400 | if (!output || output->type != ACPI_TYPE_PACKAGE |
| 401 | || !output->package.count | 401 | || !output->package.count |
| 402 | || output->package.elements[0].type != ACPI_TYPE_BUFFER | 402 | || output->package.elements[0].type != ACPI_TYPE_BUFFER |
| 403 | || output->package.elements[0].buffer.length > sizeof(*pld)) { | 403 | || output->package.elements[0].buffer.length < ACPI_PLD_REV1_BUFFER_SIZE) { |
| 404 | status = AE_TYPE; | 404 | status = AE_TYPE; |
| 405 | goto out; | 405 | goto out; |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | memcpy(pld, output->package.elements[0].buffer.pointer, | 408 | status = acpi_decode_pld_buffer( |
| 409 | output->package.elements[0].buffer.length); | 409 | output->package.elements[0].buffer.pointer, |
| 410 | output->package.elements[0].buffer.length, | ||
| 411 | pld); | ||
| 412 | |||
| 410 | out: | 413 | out: |
| 411 | kfree(buffer.pointer); | 414 | kfree(buffer.pointer); |
| 412 | return status; | 415 | return status; |
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 38a2d0631882..ad16c68c8645 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
| @@ -79,6 +79,7 @@ struct nvme_dev { | |||
| 79 | char serial[20]; | 79 | char serial[20]; |
| 80 | char model[40]; | 80 | char model[40]; |
| 81 | char firmware_rev[8]; | 81 | char firmware_rev[8]; |
| 82 | u32 max_hw_sectors; | ||
| 82 | }; | 83 | }; |
| 83 | 84 | ||
| 84 | /* | 85 | /* |
| @@ -835,15 +836,15 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns, | |||
| 835 | } | 836 | } |
| 836 | 837 | ||
| 837 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | 838 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, |
| 838 | unsigned dword11, dma_addr_t dma_addr) | 839 | unsigned nsid, dma_addr_t dma_addr) |
| 839 | { | 840 | { |
| 840 | struct nvme_command c; | 841 | struct nvme_command c; |
| 841 | 842 | ||
| 842 | memset(&c, 0, sizeof(c)); | 843 | memset(&c, 0, sizeof(c)); |
| 843 | c.features.opcode = nvme_admin_get_features; | 844 | c.features.opcode = nvme_admin_get_features; |
| 845 | c.features.nsid = cpu_to_le32(nsid); | ||
| 844 | c.features.prp1 = cpu_to_le64(dma_addr); | 846 | c.features.prp1 = cpu_to_le64(dma_addr); |
| 845 | c.features.fid = cpu_to_le32(fid); | 847 | c.features.fid = cpu_to_le32(fid); |
| 846 | c.features.dword11 = cpu_to_le32(dword11); | ||
| 847 | 848 | ||
| 848 | return nvme_submit_admin_cmd(dev, &c, NULL); | 849 | return nvme_submit_admin_cmd(dev, &c, NULL); |
| 849 | } | 850 | } |
| @@ -862,11 +863,51 @@ static int nvme_set_features(struct nvme_dev *dev, unsigned fid, | |||
| 862 | return nvme_submit_admin_cmd(dev, &c, result); | 863 | return nvme_submit_admin_cmd(dev, &c, result); |
| 863 | } | 864 | } |
| 864 | 865 | ||
| 866 | /** | ||
| 867 | * nvme_cancel_ios - Cancel outstanding I/Os | ||
| 868 | * @queue: The queue to cancel I/Os on | ||
| 869 | * @timeout: True to only cancel I/Os which have timed out | ||
| 870 | */ | ||
| 871 | static void nvme_cancel_ios(struct nvme_queue *nvmeq, bool timeout) | ||
| 872 | { | ||
| 873 | int depth = nvmeq->q_depth - 1; | ||
| 874 | struct nvme_cmd_info *info = nvme_cmd_info(nvmeq); | ||
| 875 | unsigned long now = jiffies; | ||
| 876 | int cmdid; | ||
| 877 | |||
| 878 | for_each_set_bit(cmdid, nvmeq->cmdid_data, depth) { | ||
| 879 | void *ctx; | ||
| 880 | nvme_completion_fn fn; | ||
| 881 | static struct nvme_completion cqe = { | ||
| 882 | .status = cpu_to_le16(NVME_SC_ABORT_REQ) << 1, | ||
| 883 | }; | ||
| 884 | |||
| 885 | if (timeout && !time_after(now, info[cmdid].timeout)) | ||
| 886 | continue; | ||
| 887 | dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d\n", cmdid); | ||
| 888 | ctx = cancel_cmdid(nvmeq, cmdid, &fn); | ||
| 889 | fn(nvmeq->dev, ctx, &cqe); | ||
| 890 | } | ||
| 891 | } | ||
| 892 | |||
| 893 | static void nvme_free_queue_mem(struct nvme_queue *nvmeq) | ||
| 894 | { | ||
| 895 | dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth), | ||
| 896 | (void *)nvmeq->cqes, nvmeq->cq_dma_addr); | ||
| 897 | dma_free_coherent(nvmeq->q_dmadev, SQ_SIZE(nvmeq->q_depth), | ||
| 898 | nvmeq->sq_cmds, nvmeq->sq_dma_addr); | ||
| 899 | kfree(nvmeq); | ||
| 900 | } | ||
| 901 | |||
| 865 | static void nvme_free_queue(struct nvme_dev *dev, int qid) | 902 | static void nvme_free_queue(struct nvme_dev *dev, int qid) |
| 866 | { | 903 | { |
| 867 | struct nvme_queue *nvmeq = dev->queues[qid]; | 904 | struct nvme_queue *nvmeq = dev->queues[qid]; |
| 868 | int vector = dev->entry[nvmeq->cq_vector].vector; | 905 | int vector = dev->entry[nvmeq->cq_vector].vector; |
| 869 | 906 | ||
| 907 | spin_lock_irq(&nvmeq->q_lock); | ||
| 908 | nvme_cancel_ios(nvmeq, false); | ||
| 909 | spin_unlock_irq(&nvmeq->q_lock); | ||
| 910 | |||
| 870 | irq_set_affinity_hint(vector, NULL); | 911 | irq_set_affinity_hint(vector, NULL); |
| 871 | free_irq(vector, nvmeq); | 912 | free_irq(vector, nvmeq); |
| 872 | 913 | ||
| @@ -876,18 +917,15 @@ static void nvme_free_queue(struct nvme_dev *dev, int qid) | |||
| 876 | adapter_delete_cq(dev, qid); | 917 | adapter_delete_cq(dev, qid); |
| 877 | } | 918 | } |
| 878 | 919 | ||
| 879 | dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth), | 920 | nvme_free_queue_mem(nvmeq); |
| 880 | (void *)nvmeq->cqes, nvmeq->cq_dma_addr); | ||
| 881 | dma_free_coherent(nvmeq->q_dmadev, SQ_SIZE(nvmeq->q_depth), | ||
| 882 | nvmeq->sq_cmds, nvmeq->sq_dma_addr); | ||
| 883 | kfree(nvmeq); | ||
| 884 | } | 921 | } |
| 885 | 922 | ||
| 886 | static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, | 923 | static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, |
| 887 | int depth, int vector) | 924 | int depth, int vector) |
| 888 | { | 925 | { |
| 889 | struct device *dmadev = &dev->pci_dev->dev; | 926 | struct device *dmadev = &dev->pci_dev->dev; |
| 890 | unsigned extra = (depth / 8) + (depth * sizeof(struct nvme_cmd_info)); | 927 | unsigned extra = DIV_ROUND_UP(depth, 8) + (depth * |
| 928 | sizeof(struct nvme_cmd_info)); | ||
| 891 | struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq) + extra, GFP_KERNEL); | 929 | struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq) + extra, GFP_KERNEL); |
| 892 | if (!nvmeq) | 930 | if (!nvmeq) |
| 893 | return NULL; | 931 | return NULL; |
| @@ -975,7 +1013,7 @@ static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev, | |||
| 975 | 1013 | ||
| 976 | static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev) | 1014 | static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev) |
| 977 | { | 1015 | { |
| 978 | int result; | 1016 | int result = 0; |
| 979 | u32 aqa; | 1017 | u32 aqa; |
| 980 | u64 cap; | 1018 | u64 cap; |
| 981 | unsigned long timeout; | 1019 | unsigned long timeout; |
| @@ -1005,17 +1043,22 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev) | |||
| 1005 | timeout = ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies; | 1043 | timeout = ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies; |
| 1006 | dev->db_stride = NVME_CAP_STRIDE(cap); | 1044 | dev->db_stride = NVME_CAP_STRIDE(cap); |
| 1007 | 1045 | ||
| 1008 | while (!(readl(&dev->bar->csts) & NVME_CSTS_RDY)) { | 1046 | while (!result && !(readl(&dev->bar->csts) & NVME_CSTS_RDY)) { |
| 1009 | msleep(100); | 1047 | msleep(100); |
| 1010 | if (fatal_signal_pending(current)) | 1048 | if (fatal_signal_pending(current)) |
| 1011 | return -EINTR; | 1049 | result = -EINTR; |
| 1012 | if (time_after(jiffies, timeout)) { | 1050 | if (time_after(jiffies, timeout)) { |
| 1013 | dev_err(&dev->pci_dev->dev, | 1051 | dev_err(&dev->pci_dev->dev, |
| 1014 | "Device not ready; aborting initialisation\n"); | 1052 | "Device not ready; aborting initialisation\n"); |
| 1015 | return -ENODEV; | 1053 | result = -ENODEV; |
| 1016 | } | 1054 | } |
| 1017 | } | 1055 | } |
| 1018 | 1056 | ||
| 1057 | if (result) { | ||
| 1058 | nvme_free_queue_mem(nvmeq); | ||
| 1059 | return result; | ||
| 1060 | } | ||
| 1061 | |||
| 1019 | result = queue_request_irq(dev, nvmeq, "nvme admin"); | 1062 | result = queue_request_irq(dev, nvmeq, "nvme admin"); |
| 1020 | dev->queues[0] = nvmeq; | 1063 | dev->queues[0] = nvmeq; |
| 1021 | return result; | 1064 | return result; |
| @@ -1037,6 +1080,8 @@ static struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | |||
| 1037 | offset = offset_in_page(addr); | 1080 | offset = offset_in_page(addr); |
| 1038 | count = DIV_ROUND_UP(offset + length, PAGE_SIZE); | 1081 | count = DIV_ROUND_UP(offset + length, PAGE_SIZE); |
| 1039 | pages = kcalloc(count, sizeof(*pages), GFP_KERNEL); | 1082 | pages = kcalloc(count, sizeof(*pages), GFP_KERNEL); |
| 1083 | if (!pages) | ||
| 1084 | return ERR_PTR(-ENOMEM); | ||
| 1040 | 1085 | ||
| 1041 | err = get_user_pages_fast(addr, count, 1, pages); | 1086 | err = get_user_pages_fast(addr, count, 1, pages); |
| 1042 | if (err < count) { | 1087 | if (err < count) { |
| @@ -1146,14 +1191,13 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
| 1146 | return status; | 1191 | return status; |
| 1147 | } | 1192 | } |
| 1148 | 1193 | ||
| 1149 | static int nvme_user_admin_cmd(struct nvme_ns *ns, | 1194 | static int nvme_user_admin_cmd(struct nvme_dev *dev, |
| 1150 | struct nvme_admin_cmd __user *ucmd) | 1195 | struct nvme_admin_cmd __user *ucmd) |
| 1151 | { | 1196 | { |
| 1152 | struct nvme_dev *dev = ns->dev; | ||
| 1153 | struct nvme_admin_cmd cmd; | 1197 | struct nvme_admin_cmd cmd; |
| 1154 | struct nvme_command c; | 1198 | struct nvme_command c; |
| 1155 | int status, length; | 1199 | int status, length; |
| 1156 | struct nvme_iod *iod; | 1200 | struct nvme_iod *uninitialized_var(iod); |
| 1157 | 1201 | ||
| 1158 | if (!capable(CAP_SYS_ADMIN)) | 1202 | if (!capable(CAP_SYS_ADMIN)) |
| 1159 | return -EACCES; | 1203 | return -EACCES; |
| @@ -1204,7 +1248,7 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, | |||
| 1204 | case NVME_IOCTL_ID: | 1248 | case NVME_IOCTL_ID: |
| 1205 | return ns->ns_id; | 1249 | return ns->ns_id; |
| 1206 | case NVME_IOCTL_ADMIN_CMD: | 1250 | case NVME_IOCTL_ADMIN_CMD: |
| 1207 | return nvme_user_admin_cmd(ns, (void __user *)arg); | 1251 | return nvme_user_admin_cmd(ns->dev, (void __user *)arg); |
| 1208 | case NVME_IOCTL_SUBMIT_IO: | 1252 | case NVME_IOCTL_SUBMIT_IO: |
| 1209 | return nvme_submit_io(ns, (void __user *)arg); | 1253 | return nvme_submit_io(ns, (void __user *)arg); |
| 1210 | default: | 1254 | default: |
| @@ -1218,26 +1262,6 @@ static const struct block_device_operations nvme_fops = { | |||
| 1218 | .compat_ioctl = nvme_ioctl, | 1262 | .compat_ioctl = nvme_ioctl, |
| 1219 | }; | 1263 | }; |
| 1220 | 1264 | ||
| 1221 | static void nvme_timeout_ios(struct nvme_queue *nvmeq) | ||
| 1222 | { | ||
| 1223 | int depth = nvmeq->q_depth - 1; | ||
| 1224 | struct nvme_cmd_info *info = nvme_cmd_info(nvmeq); | ||
| 1225 | unsigned long now = jiffies; | ||
| 1226 | int cmdid; | ||
| 1227 | |||
| 1228 | for_each_set_bit(cmdid, nvmeq->cmdid_data, depth) { | ||
| 1229 | void *ctx; | ||
| 1230 | nvme_completion_fn fn; | ||
| 1231 | static struct nvme_completion cqe = { .status = cpu_to_le16(NVME_SC_ABORT_REQ) << 1, }; | ||
| 1232 | |||
| 1233 | if (!time_after(now, info[cmdid].timeout)) | ||
| 1234 | continue; | ||
| 1235 | dev_warn(nvmeq->q_dmadev, "Timing out I/O %d\n", cmdid); | ||
| 1236 | ctx = cancel_cmdid(nvmeq, cmdid, &fn); | ||
| 1237 | fn(nvmeq->dev, ctx, &cqe); | ||
| 1238 | } | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) | 1265 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) |
| 1242 | { | 1266 | { |
| 1243 | while (bio_list_peek(&nvmeq->sq_cong)) { | 1267 | while (bio_list_peek(&nvmeq->sq_cong)) { |
| @@ -1269,7 +1293,7 @@ static int nvme_kthread(void *data) | |||
| 1269 | spin_lock_irq(&nvmeq->q_lock); | 1293 | spin_lock_irq(&nvmeq->q_lock); |
| 1270 | if (nvme_process_cq(nvmeq)) | 1294 | if (nvme_process_cq(nvmeq)) |
| 1271 | printk("process_cq did something\n"); | 1295 | printk("process_cq did something\n"); |
| 1272 | nvme_timeout_ios(nvmeq); | 1296 | nvme_cancel_ios(nvmeq, true); |
| 1273 | nvme_resubmit_bios(nvmeq); | 1297 | nvme_resubmit_bios(nvmeq); |
| 1274 | spin_unlock_irq(&nvmeq->q_lock); | 1298 | spin_unlock_irq(&nvmeq->q_lock); |
| 1275 | } | 1299 | } |
| @@ -1339,6 +1363,9 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, int nsid, | |||
| 1339 | ns->disk = disk; | 1363 | ns->disk = disk; |
| 1340 | lbaf = id->flbas & 0xf; | 1364 | lbaf = id->flbas & 0xf; |
| 1341 | ns->lba_shift = id->lbaf[lbaf].ds; | 1365 | ns->lba_shift = id->lbaf[lbaf].ds; |
| 1366 | blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift); | ||
| 1367 | if (dev->max_hw_sectors) | ||
| 1368 | blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors); | ||
| 1342 | 1369 | ||
| 1343 | disk->major = nvme_major; | 1370 | disk->major = nvme_major; |
| 1344 | disk->minors = NVME_MINORS; | 1371 | disk->minors = NVME_MINORS; |
| @@ -1383,7 +1410,7 @@ static int set_queue_count(struct nvme_dev *dev, int count) | |||
| 1383 | 1410 | ||
| 1384 | static int __devinit nvme_setup_io_queues(struct nvme_dev *dev) | 1411 | static int __devinit nvme_setup_io_queues(struct nvme_dev *dev) |
| 1385 | { | 1412 | { |
| 1386 | int result, cpu, i, nr_io_queues, db_bar_size; | 1413 | int result, cpu, i, nr_io_queues, db_bar_size, q_depth; |
| 1387 | 1414 | ||
| 1388 | nr_io_queues = num_online_cpus(); | 1415 | nr_io_queues = num_online_cpus(); |
| 1389 | result = set_queue_count(dev, nr_io_queues); | 1416 | result = set_queue_count(dev, nr_io_queues); |
| @@ -1429,9 +1456,10 @@ static int __devinit nvme_setup_io_queues(struct nvme_dev *dev) | |||
| 1429 | cpu = cpumask_next(cpu, cpu_online_mask); | 1456 | cpu = cpumask_next(cpu, cpu_online_mask); |
| 1430 | } | 1457 | } |
| 1431 | 1458 | ||
| 1459 | q_depth = min_t(int, NVME_CAP_MQES(readq(&dev->bar->cap)) + 1, | ||
| 1460 | NVME_Q_DEPTH); | ||
| 1432 | for (i = 0; i < nr_io_queues; i++) { | 1461 | for (i = 0; i < nr_io_queues; i++) { |
| 1433 | dev->queues[i + 1] = nvme_create_queue(dev, i + 1, | 1462 | dev->queues[i + 1] = nvme_create_queue(dev, i + 1, q_depth, i); |
| 1434 | NVME_Q_DEPTH, i); | ||
| 1435 | if (IS_ERR(dev->queues[i + 1])) | 1463 | if (IS_ERR(dev->queues[i + 1])) |
| 1436 | return PTR_ERR(dev->queues[i + 1]); | 1464 | return PTR_ERR(dev->queues[i + 1]); |
| 1437 | dev->queue_count++; | 1465 | dev->queue_count++; |
| @@ -1480,6 +1508,10 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev) | |||
| 1480 | memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn)); | 1508 | memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn)); |
| 1481 | memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn)); | 1509 | memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn)); |
| 1482 | memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr)); | 1510 | memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr)); |
| 1511 | if (ctrl->mdts) { | ||
| 1512 | int shift = NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12; | ||
| 1513 | dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9); | ||
| 1514 | } | ||
| 1483 | 1515 | ||
| 1484 | id_ns = mem; | 1516 | id_ns = mem; |
| 1485 | for (i = 1; i <= nn; i++) { | 1517 | for (i = 1; i <= nn; i++) { |
| @@ -1523,8 +1555,6 @@ static int nvme_dev_remove(struct nvme_dev *dev) | |||
| 1523 | list_del(&dev->node); | 1555 | list_del(&dev->node); |
| 1524 | spin_unlock(&dev_list_lock); | 1556 | spin_unlock(&dev_list_lock); |
| 1525 | 1557 | ||
| 1526 | /* TODO: wait all I/O finished or cancel them */ | ||
| 1527 | |||
| 1528 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) { | 1558 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) { |
| 1529 | list_del(&ns->list); | 1559 | list_del(&ns->list); |
| 1530 | del_gendisk(ns->disk); | 1560 | del_gendisk(ns->disk); |
| @@ -1560,15 +1590,33 @@ static void nvme_release_prp_pools(struct nvme_dev *dev) | |||
| 1560 | dma_pool_destroy(dev->prp_small_pool); | 1590 | dma_pool_destroy(dev->prp_small_pool); |
| 1561 | } | 1591 | } |
| 1562 | 1592 | ||
| 1563 | /* XXX: Use an ida or something to let remove / add work correctly */ | 1593 | static DEFINE_IDA(nvme_instance_ida); |
| 1564 | static void nvme_set_instance(struct nvme_dev *dev) | 1594 | |
| 1595 | static int nvme_set_instance(struct nvme_dev *dev) | ||
| 1565 | { | 1596 | { |
| 1566 | static int instance; | 1597 | int instance, error; |
| 1567 | dev->instance = instance++; | 1598 | |
| 1599 | do { | ||
| 1600 | if (!ida_pre_get(&nvme_instance_ida, GFP_KERNEL)) | ||
| 1601 | return -ENODEV; | ||
| 1602 | |||
| 1603 | spin_lock(&dev_list_lock); | ||
| 1604 | error = ida_get_new(&nvme_instance_ida, &instance); | ||
| 1605 | spin_unlock(&dev_list_lock); | ||
| 1606 | } while (error == -EAGAIN); | ||
| 1607 | |||
| 1608 | if (error) | ||
| 1609 | return -ENODEV; | ||
| 1610 | |||
| 1611 | dev->instance = instance; | ||
| 1612 | return 0; | ||
| 1568 | } | 1613 | } |
| 1569 | 1614 | ||
| 1570 | static void nvme_release_instance(struct nvme_dev *dev) | 1615 | static void nvme_release_instance(struct nvme_dev *dev) |
| 1571 | { | 1616 | { |
| 1617 | spin_lock(&dev_list_lock); | ||
| 1618 | ida_remove(&nvme_instance_ida, dev->instance); | ||
| 1619 | spin_unlock(&dev_list_lock); | ||
| 1572 | } | 1620 | } |
| 1573 | 1621 | ||
| 1574 | static int __devinit nvme_probe(struct pci_dev *pdev, | 1622 | static int __devinit nvme_probe(struct pci_dev *pdev, |
| @@ -1601,7 +1649,10 @@ static int __devinit nvme_probe(struct pci_dev *pdev, | |||
| 1601 | pci_set_drvdata(pdev, dev); | 1649 | pci_set_drvdata(pdev, dev); |
| 1602 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1650 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); |
| 1603 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1651 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); |
| 1604 | nvme_set_instance(dev); | 1652 | result = nvme_set_instance(dev); |
| 1653 | if (result) | ||
| 1654 | goto disable; | ||
| 1655 | |||
| 1605 | dev->entry[0].vector = pdev->irq; | 1656 | dev->entry[0].vector = pdev->irq; |
| 1606 | 1657 | ||
| 1607 | result = nvme_setup_prp_pools(dev); | 1658 | result = nvme_setup_prp_pools(dev); |
| @@ -1704,15 +1755,17 @@ static struct pci_driver nvme_driver = { | |||
| 1704 | 1755 | ||
| 1705 | static int __init nvme_init(void) | 1756 | static int __init nvme_init(void) |
| 1706 | { | 1757 | { |
| 1707 | int result = -EBUSY; | 1758 | int result; |
| 1708 | 1759 | ||
| 1709 | nvme_thread = kthread_run(nvme_kthread, NULL, "nvme"); | 1760 | nvme_thread = kthread_run(nvme_kthread, NULL, "nvme"); |
| 1710 | if (IS_ERR(nvme_thread)) | 1761 | if (IS_ERR(nvme_thread)) |
| 1711 | return PTR_ERR(nvme_thread); | 1762 | return PTR_ERR(nvme_thread); |
| 1712 | 1763 | ||
| 1713 | nvme_major = register_blkdev(nvme_major, "nvme"); | 1764 | result = register_blkdev(nvme_major, "nvme"); |
| 1714 | if (nvme_major <= 0) | 1765 | if (result < 0) |
| 1715 | goto kill_kthread; | 1766 | goto kill_kthread; |
| 1767 | else if (result > 0) | ||
| 1768 | nvme_major = result; | ||
| 1716 | 1769 | ||
| 1717 | result = pci_register_driver(&nvme_driver); | 1770 | result = pci_register_driver(&nvme_driver); |
| 1718 | if (result) | 1771 | if (result) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 9917943a3572..54a55f03115d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -246,13 +246,12 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) | |||
| 246 | { | 246 | { |
| 247 | struct rbd_device *rbd_dev = bdev->bd_disk->private_data; | 247 | struct rbd_device *rbd_dev = bdev->bd_disk->private_data; |
| 248 | 248 | ||
| 249 | rbd_get_dev(rbd_dev); | ||
| 250 | |||
| 251 | set_device_ro(bdev, rbd_dev->read_only); | ||
| 252 | |||
| 253 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) | 249 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) |
| 254 | return -EROFS; | 250 | return -EROFS; |
| 255 | 251 | ||
| 252 | rbd_get_dev(rbd_dev); | ||
| 253 | set_device_ro(bdev, rbd_dev->read_only); | ||
| 254 | |||
| 256 | return 0; | 255 | return 0; |
| 257 | } | 256 | } |
| 258 | 257 | ||
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index 47180a08edad..b6653a6fc5d5 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c | |||
| @@ -391,7 +391,7 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx) | |||
| 391 | for (j = 0; j < nr_channels; j++) { | 391 | for (j = 0; j < nr_channels; j++) { |
| 392 | struct dimm_info *dimm = csrow->channels[j]->dimm; | 392 | struct dimm_info *dimm = csrow->channels[j]->dimm; |
| 393 | 393 | ||
| 394 | dimm->nr_pages = nr_pages / nr_channels; | 394 | dimm->nr_pages = nr_pages; |
| 395 | dimm->grain = nr_pages << PAGE_SHIFT; | 395 | dimm->grain = nr_pages << PAGE_SHIFT; |
| 396 | dimm->mtype = MEM_DDR2; | 396 | dimm->mtype = MEM_DDR2; |
| 397 | dimm->dtype = DEV_UNKNOWN; | 397 | dimm->dtype = DEV_UNKNOWN; |
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 39c63757c2a1..6a49dd00b81b 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
| @@ -1012,6 +1012,10 @@ static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, | |||
| 1012 | /* add the number of COLUMN bits */ | 1012 | /* add the number of COLUMN bits */ |
| 1013 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); | 1013 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); |
| 1014 | 1014 | ||
| 1015 | /* Dual-rank memories have twice the size */ | ||
| 1016 | if (dinfo->dual_rank) | ||
| 1017 | addrBits++; | ||
| 1018 | |||
| 1015 | addrBits += 6; /* add 64 bits per DIMM */ | 1019 | addrBits += 6; /* add 64 bits per DIMM */ |
| 1016 | addrBits -= 20; /* divide by 2^^20 */ | 1020 | addrBits -= 20; /* divide by 2^^20 */ |
| 1017 | addrBits -= 3; /* 8 bits per bytes */ | 1021 | addrBits -= 3; /* 8 bits per bytes */ |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index f3b1f9fafa4b..5715b7c2c517 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
| @@ -513,7 +513,8 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
| 513 | { | 513 | { |
| 514 | struct sbridge_pvt *pvt = mci->pvt_info; | 514 | struct sbridge_pvt *pvt = mci->pvt_info; |
| 515 | struct dimm_info *dimm; | 515 | struct dimm_info *dimm; |
| 516 | int i, j, banks, ranks, rows, cols, size, npages; | 516 | unsigned i, j, banks, ranks, rows, cols, npages; |
| 517 | u64 size; | ||
| 517 | u32 reg; | 518 | u32 reg; |
| 518 | enum edac_type mode; | 519 | enum edac_type mode; |
| 519 | enum mem_type mtype; | 520 | enum mem_type mtype; |
| @@ -585,10 +586,10 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
| 585 | cols = numcol(mtr); | 586 | cols = numcol(mtr); |
| 586 | 587 | ||
| 587 | /* DDR3 has 8 I/O banks */ | 588 | /* DDR3 has 8 I/O banks */ |
| 588 | size = (rows * cols * banks * ranks) >> (20 - 3); | 589 | size = ((u64)rows * cols * banks * ranks) >> (20 - 3); |
| 589 | npages = MiB_TO_PAGES(size); | 590 | npages = MiB_TO_PAGES(size); |
| 590 | 591 | ||
| 591 | edac_dbg(0, "mc#%d: channel %d, dimm %d, %d Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n", | 592 | edac_dbg(0, "mc#%d: channel %d, dimm %d, %Ld Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n", |
| 592 | pvt->sbridge_dev->mc, i, j, | 593 | pvt->sbridge_dev->mc, i, j, |
| 593 | size, npages, | 594 | size, npages, |
| 594 | banks, ranks, rows, cols); | 595 | banks, ranks, rows, cols); |
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index 8a420f13905e..ed94b4ea72e9 100644 --- a/drivers/gpio/gpio-lpc32xx.c +++ b/drivers/gpio/gpio-lpc32xx.c | |||
| @@ -308,6 +308,7 @@ static int lpc32xx_gpio_dir_output_p012(struct gpio_chip *chip, unsigned pin, | |||
| 308 | { | 308 | { |
| 309 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | 309 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); |
| 310 | 310 | ||
| 311 | __set_gpio_level_p012(group, pin, value); | ||
| 311 | __set_gpio_dir_p012(group, pin, 0); | 312 | __set_gpio_dir_p012(group, pin, 0); |
| 312 | 313 | ||
| 313 | return 0; | 314 | return 0; |
| @@ -318,6 +319,7 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin, | |||
| 318 | { | 319 | { |
| 319 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | 320 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); |
| 320 | 321 | ||
| 322 | __set_gpio_level_p3(group, pin, value); | ||
| 321 | __set_gpio_dir_p3(group, pin, 0); | 323 | __set_gpio_dir_p3(group, pin, 0); |
| 322 | 324 | ||
| 323 | return 0; | 325 | return 0; |
| @@ -326,6 +328,9 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin, | |||
| 326 | static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin, | 328 | static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin, |
| 327 | int value) | 329 | int value) |
| 328 | { | 330 | { |
| 331 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | ||
| 332 | |||
| 333 | __set_gpo_level_p3(group, pin, value); | ||
| 329 | return 0; | 334 | return 0; |
| 330 | } | 335 | } |
| 331 | 336 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index ff23d88880e5..3ca240b4413d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
| @@ -179,7 +179,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) | |||
| 179 | return 0; | 179 | return 0; |
| 180 | } else | 180 | } else |
| 181 | if (init->class == 0x906e) { | 181 | if (init->class == 0x906e) { |
| 182 | NV_ERROR(dev, "906e not supported yet\n"); | 182 | NV_DEBUG(dev, "906e not supported yet\n"); |
| 183 | return -EINVAL; | 183 | return -EINVAL; |
| 184 | } | 184 | } |
| 185 | 185 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index f704e942372e..f376c39310df 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
| @@ -124,6 +124,7 @@ nvc0_fb_init(struct drm_device *dev) | |||
| 124 | priv = dev_priv->engine.fb.priv; | 124 | priv = dev_priv->engine.fb.priv; |
| 125 | 125 | ||
| 126 | nv_wr32(dev, 0x100c10, priv->r100c10 >> 8); | 126 | nv_wr32(dev, 0x100c10, priv->r100c10 >> 8); |
| 127 | nv_mask(dev, 0x17e820, 0x00100000, 0x00000000); /* NV_PLTCG_INTR_EN */ | ||
| 127 | return 0; | 128 | return 0; |
| 128 | } | 129 | } |
| 129 | 130 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fifo.c b/drivers/gpu/drm/nouveau/nvc0_fifo.c index 7d85553d518c..cd39eb99f5b1 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fifo.c +++ b/drivers/gpu/drm/nouveau/nvc0_fifo.c | |||
| @@ -373,7 +373,8 @@ nvc0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) | |||
| 373 | static void | 373 | static void |
| 374 | nvc0_fifo_isr(struct drm_device *dev) | 374 | nvc0_fifo_isr(struct drm_device *dev) |
| 375 | { | 375 | { |
| 376 | u32 stat = nv_rd32(dev, 0x002100); | 376 | u32 mask = nv_rd32(dev, 0x002140); |
| 377 | u32 stat = nv_rd32(dev, 0x002100) & mask; | ||
| 377 | 378 | ||
| 378 | if (stat & 0x00000100) { | 379 | if (stat & 0x00000100) { |
| 379 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); | 380 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); |
diff --git a/drivers/gpu/drm/nouveau/nve0_fifo.c b/drivers/gpu/drm/nouveau/nve0_fifo.c index e98d144e6eb9..281bece751b6 100644 --- a/drivers/gpu/drm/nouveau/nve0_fifo.c +++ b/drivers/gpu/drm/nouveau/nve0_fifo.c | |||
| @@ -345,7 +345,8 @@ nve0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) | |||
| 345 | static void | 345 | static void |
| 346 | nve0_fifo_isr(struct drm_device *dev) | 346 | nve0_fifo_isr(struct drm_device *dev) |
| 347 | { | 347 | { |
| 348 | u32 stat = nv_rd32(dev, 0x002100); | 348 | u32 mask = nv_rd32(dev, 0x002140); |
| 349 | u32 stat = nv_rd32(dev, 0x002100) & mask; | ||
| 349 | 350 | ||
| 350 | if (stat & 0x00000100) { | 351 | if (stat & 0x00000100) { |
| 351 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); | 352 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); |
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c index ba055e9ca007..8d9dc44f1f94 100644 --- a/drivers/gpu/drm/udl/udl_connector.c +++ b/drivers/gpu/drm/udl/udl_connector.c | |||
| @@ -69,6 +69,13 @@ static int udl_get_modes(struct drm_connector *connector) | |||
| 69 | static int udl_mode_valid(struct drm_connector *connector, | 69 | static int udl_mode_valid(struct drm_connector *connector, |
| 70 | struct drm_display_mode *mode) | 70 | struct drm_display_mode *mode) |
| 71 | { | 71 | { |
| 72 | struct udl_device *udl = connector->dev->dev_private; | ||
| 73 | if (!udl->sku_pixel_limit) | ||
| 74 | return 0; | ||
| 75 | |||
| 76 | if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit) | ||
| 77 | return MODE_VIRTUAL_Y; | ||
| 78 | |||
| 72 | return 0; | 79 | return 0; |
| 73 | } | 80 | } |
| 74 | 81 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index f2fb8f15e2f1..7e0743358dff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | |||
| @@ -1018,7 +1018,7 @@ int vmw_event_fence_action_create(struct drm_file *file_priv, | |||
| 1018 | } | 1018 | } |
| 1019 | 1019 | ||
| 1020 | 1020 | ||
| 1021 | event = kzalloc(sizeof(event->event), GFP_KERNEL); | 1021 | event = kzalloc(sizeof(*event), GFP_KERNEL); |
| 1022 | if (unlikely(event == NULL)) { | 1022 | if (unlikely(event == NULL)) { |
| 1023 | DRM_ERROR("Failed to allocate an event.\n"); | 1023 | DRM_ERROR("Failed to allocate an event.\n"); |
| 1024 | ret = -ENOMEM; | 1024 | ret = -ENOMEM; |
diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c index 388cbdc96db7..6aafa3d88ff0 100644 --- a/drivers/i2c/busses/i2c-scmi.c +++ b/drivers/i2c/busses/i2c-scmi.c | |||
| @@ -426,19 +426,7 @@ static struct acpi_driver acpi_smbus_cmi_driver = { | |||
| 426 | .remove = acpi_smbus_cmi_remove, | 426 | .remove = acpi_smbus_cmi_remove, |
| 427 | }, | 427 | }, |
| 428 | }; | 428 | }; |
| 429 | 429 | module_acpi_driver(acpi_smbus_cmi_driver); | |
| 430 | static int __init acpi_smbus_cmi_init(void) | ||
| 431 | { | ||
| 432 | return acpi_bus_register_driver(&acpi_smbus_cmi_driver); | ||
| 433 | } | ||
| 434 | |||
| 435 | static void __exit acpi_smbus_cmi_exit(void) | ||
| 436 | { | ||
| 437 | acpi_bus_unregister_driver(&acpi_smbus_cmi_driver); | ||
| 438 | } | ||
| 439 | |||
| 440 | module_init(acpi_smbus_cmi_init); | ||
| 441 | module_exit(acpi_smbus_cmi_exit); | ||
| 442 | 430 | ||
| 443 | MODULE_LICENSE("GPL"); | 431 | MODULE_LICENSE("GPL"); |
| 444 | MODULE_AUTHOR("Crane Cai <crane.cai@amd.com>"); | 432 | MODULE_AUTHOR("Crane Cai <crane.cai@amd.com>"); |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index e8726177d103..b0f6b4c8ee14 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
| @@ -413,6 +413,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { | |||
| 413 | ICPU(0x2a, idle_cpu_snb), | 413 | ICPU(0x2a, idle_cpu_snb), |
| 414 | ICPU(0x2d, idle_cpu_snb), | 414 | ICPU(0x2d, idle_cpu_snb), |
| 415 | ICPU(0x3a, idle_cpu_ivb), | 415 | ICPU(0x3a, idle_cpu_ivb), |
| 416 | ICPU(0x3e, idle_cpu_ivb), | ||
| 416 | {} | 417 | {} |
| 417 | }; | 418 | }; |
| 418 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); | 419 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); |
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 601f7372f9c4..26f13131639a 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c | |||
| @@ -151,22 +151,7 @@ static struct acpi_driver atlas_acpi_driver = { | |||
| 151 | .remove = atlas_acpi_button_remove, | 151 | .remove = atlas_acpi_button_remove, |
| 152 | }, | 152 | }, |
| 153 | }; | 153 | }; |
| 154 | 154 | module_acpi_driver(atlas_acpi_driver); | |
| 155 | static int __init atlas_acpi_init(void) | ||
| 156 | { | ||
| 157 | if (acpi_disabled) | ||
| 158 | return -ENODEV; | ||
| 159 | |||
| 160 | return acpi_bus_register_driver(&atlas_acpi_driver); | ||
| 161 | } | ||
| 162 | |||
| 163 | static void __exit atlas_acpi_exit(void) | ||
| 164 | { | ||
| 165 | acpi_bus_unregister_driver(&atlas_acpi_driver); | ||
| 166 | } | ||
| 167 | |||
| 168 | module_init(atlas_acpi_init); | ||
| 169 | module_exit(atlas_acpi_exit); | ||
| 170 | 155 | ||
| 171 | MODULE_AUTHOR("Jaya Kumar"); | 156 | MODULE_AUTHOR("Jaya Kumar"); |
| 172 | MODULE_LICENSE("GPL"); | 157 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index b64502dfa9f4..e89daf1b21b4 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -266,7 +266,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to) | |||
| 266 | 266 | ||
| 267 | static int iommu_init_device(struct device *dev) | 267 | static int iommu_init_device(struct device *dev) |
| 268 | { | 268 | { |
| 269 | struct pci_dev *dma_pdev, *pdev = to_pci_dev(dev); | 269 | struct pci_dev *dma_pdev = NULL, *pdev = to_pci_dev(dev); |
| 270 | struct iommu_dev_data *dev_data; | 270 | struct iommu_dev_data *dev_data; |
| 271 | struct iommu_group *group; | 271 | struct iommu_group *group; |
| 272 | u16 alias; | 272 | u16 alias; |
| @@ -293,7 +293,9 @@ static int iommu_init_device(struct device *dev) | |||
| 293 | dev_data->alias_data = alias_data; | 293 | dev_data->alias_data = alias_data; |
| 294 | 294 | ||
| 295 | dma_pdev = pci_get_bus_and_slot(alias >> 8, alias & 0xff); | 295 | dma_pdev = pci_get_bus_and_slot(alias >> 8, alias & 0xff); |
| 296 | } else | 296 | } |
| 297 | |||
| 298 | if (dma_pdev == NULL) | ||
| 297 | dma_pdev = pci_dev_get(pdev); | 299 | dma_pdev = pci_dev_get(pdev); |
| 298 | 300 | ||
| 299 | /* Account for quirked devices */ | 301 | /* Account for quirked devices */ |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index d8abb90a6c2f..034233eefc82 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -1555,6 +1555,7 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | |||
| 1555 | unsigned long arg) | 1555 | unsigned long arg) |
| 1556 | { | 1556 | { |
| 1557 | struct multipath *m = ti->private; | 1557 | struct multipath *m = ti->private; |
| 1558 | struct pgpath *pgpath; | ||
| 1558 | struct block_device *bdev; | 1559 | struct block_device *bdev; |
| 1559 | fmode_t mode; | 1560 | fmode_t mode; |
| 1560 | unsigned long flags; | 1561 | unsigned long flags; |
| @@ -1570,12 +1571,14 @@ again: | |||
| 1570 | if (!m->current_pgpath) | 1571 | if (!m->current_pgpath) |
| 1571 | __choose_pgpath(m, 0); | 1572 | __choose_pgpath(m, 0); |
| 1572 | 1573 | ||
| 1573 | if (m->current_pgpath) { | 1574 | pgpath = m->current_pgpath; |
| 1574 | bdev = m->current_pgpath->path.dev->bdev; | 1575 | |
| 1575 | mode = m->current_pgpath->path.dev->mode; | 1576 | if (pgpath) { |
| 1577 | bdev = pgpath->path.dev->bdev; | ||
| 1578 | mode = pgpath->path.dev->mode; | ||
| 1576 | } | 1579 | } |
| 1577 | 1580 | ||
| 1578 | if (m->queue_io) | 1581 | if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path)) |
| 1579 | r = -EAGAIN; | 1582 | r = -EAGAIN; |
| 1580 | else if (!bdev) | 1583 | else if (!bdev) |
| 1581 | r = -EIO; | 1584 | r = -EIO; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f90069029aae..100368eb7991 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -1212,6 +1212,41 @@ struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector) | |||
| 1212 | return &t->targets[(KEYS_PER_NODE * n) + k]; | 1212 | return &t->targets[(KEYS_PER_NODE * n) + k]; |
| 1213 | } | 1213 | } |
| 1214 | 1214 | ||
| 1215 | static int count_device(struct dm_target *ti, struct dm_dev *dev, | ||
| 1216 | sector_t start, sector_t len, void *data) | ||
| 1217 | { | ||
| 1218 | unsigned *num_devices = data; | ||
| 1219 | |||
| 1220 | (*num_devices)++; | ||
| 1221 | |||
| 1222 | return 0; | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | /* | ||
| 1226 | * Check whether a table has no data devices attached using each | ||
| 1227 | * target's iterate_devices method. | ||
| 1228 | * Returns false if the result is unknown because a target doesn't | ||
| 1229 | * support iterate_devices. | ||
| 1230 | */ | ||
| 1231 | bool dm_table_has_no_data_devices(struct dm_table *table) | ||
| 1232 | { | ||
| 1233 | struct dm_target *uninitialized_var(ti); | ||
| 1234 | unsigned i = 0, num_devices = 0; | ||
| 1235 | |||
| 1236 | while (i < dm_table_get_num_targets(table)) { | ||
| 1237 | ti = dm_table_get_target(table, i++); | ||
| 1238 | |||
| 1239 | if (!ti->type->iterate_devices) | ||
| 1240 | return false; | ||
| 1241 | |||
| 1242 | ti->type->iterate_devices(ti, count_device, &num_devices); | ||
| 1243 | if (num_devices) | ||
| 1244 | return false; | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | return true; | ||
| 1248 | } | ||
| 1249 | |||
| 1215 | /* | 1250 | /* |
| 1216 | * Establish the new table's queue_limits and validate them. | 1251 | * Establish the new table's queue_limits and validate them. |
| 1217 | */ | 1252 | */ |
| @@ -1354,17 +1389,25 @@ static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev, | |||
| 1354 | return q && blk_queue_nonrot(q); | 1389 | return q && blk_queue_nonrot(q); |
| 1355 | } | 1390 | } |
| 1356 | 1391 | ||
| 1357 | static bool dm_table_is_nonrot(struct dm_table *t) | 1392 | static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev, |
| 1393 | sector_t start, sector_t len, void *data) | ||
| 1394 | { | ||
| 1395 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
| 1396 | |||
| 1397 | return q && !blk_queue_add_random(q); | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | static bool dm_table_all_devices_attribute(struct dm_table *t, | ||
| 1401 | iterate_devices_callout_fn func) | ||
| 1358 | { | 1402 | { |
| 1359 | struct dm_target *ti; | 1403 | struct dm_target *ti; |
| 1360 | unsigned i = 0; | 1404 | unsigned i = 0; |
| 1361 | 1405 | ||
| 1362 | /* Ensure that all underlying device are non-rotational. */ | ||
| 1363 | while (i < dm_table_get_num_targets(t)) { | 1406 | while (i < dm_table_get_num_targets(t)) { |
| 1364 | ti = dm_table_get_target(t, i++); | 1407 | ti = dm_table_get_target(t, i++); |
| 1365 | 1408 | ||
| 1366 | if (!ti->type->iterate_devices || | 1409 | if (!ti->type->iterate_devices || |
| 1367 | !ti->type->iterate_devices(ti, device_is_nonrot, NULL)) | 1410 | !ti->type->iterate_devices(ti, func, NULL)) |
| 1368 | return 0; | 1411 | return 0; |
| 1369 | } | 1412 | } |
| 1370 | 1413 | ||
| @@ -1396,7 +1439,8 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
| 1396 | if (!dm_table_discard_zeroes_data(t)) | 1439 | if (!dm_table_discard_zeroes_data(t)) |
| 1397 | q->limits.discard_zeroes_data = 0; | 1440 | q->limits.discard_zeroes_data = 0; |
| 1398 | 1441 | ||
| 1399 | if (dm_table_is_nonrot(t)) | 1442 | /* Ensure that all underlying devices are non-rotational. */ |
| 1443 | if (dm_table_all_devices_attribute(t, device_is_nonrot)) | ||
| 1400 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); | 1444 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); |
| 1401 | else | 1445 | else |
| 1402 | queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q); | 1446 | queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q); |
| @@ -1404,6 +1448,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
| 1404 | dm_table_set_integrity(t); | 1448 | dm_table_set_integrity(t); |
| 1405 | 1449 | ||
| 1406 | /* | 1450 | /* |
| 1451 | * Determine whether or not this queue's I/O timings contribute | ||
| 1452 | * to the entropy pool, Only request-based targets use this. | ||
| 1453 | * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not | ||
| 1454 | * have it set. | ||
| 1455 | */ | ||
| 1456 | if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_is_not_random)) | ||
| 1457 | queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q); | ||
| 1458 | |||
| 1459 | /* | ||
| 1407 | * QUEUE_FLAG_STACKABLE must be set after all queue settings are | 1460 | * QUEUE_FLAG_STACKABLE must be set after all queue settings are |
| 1408 | * visible to other CPUs because, once the flag is set, incoming bios | 1461 | * visible to other CPUs because, once the flag is set, incoming bios |
| 1409 | * are processed by request-based dm, which refers to the queue | 1462 | * are processed by request-based dm, which refers to the queue |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index af1fc3b2c2ad..c29410af1e22 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -509,9 +509,9 @@ enum pool_mode { | |||
| 509 | struct pool_features { | 509 | struct pool_features { |
| 510 | enum pool_mode mode; | 510 | enum pool_mode mode; |
| 511 | 511 | ||
| 512 | unsigned zero_new_blocks:1; | 512 | bool zero_new_blocks:1; |
| 513 | unsigned discard_enabled:1; | 513 | bool discard_enabled:1; |
| 514 | unsigned discard_passdown:1; | 514 | bool discard_passdown:1; |
| 515 | }; | 515 | }; |
| 516 | 516 | ||
| 517 | struct thin_c; | 517 | struct thin_c; |
| @@ -580,7 +580,8 @@ struct pool_c { | |||
| 580 | struct dm_target_callbacks callbacks; | 580 | struct dm_target_callbacks callbacks; |
| 581 | 581 | ||
| 582 | dm_block_t low_water_blocks; | 582 | dm_block_t low_water_blocks; |
| 583 | struct pool_features pf; | 583 | struct pool_features requested_pf; /* Features requested during table load */ |
| 584 | struct pool_features adjusted_pf; /* Features used after adjusting for constituent devices */ | ||
| 584 | }; | 585 | }; |
| 585 | 586 | ||
| 586 | /* | 587 | /* |
| @@ -1839,6 +1840,47 @@ static void __requeue_bios(struct pool *pool) | |||
| 1839 | /*---------------------------------------------------------------- | 1840 | /*---------------------------------------------------------------- |
| 1840 | * Binding of control targets to a pool object | 1841 | * Binding of control targets to a pool object |
| 1841 | *--------------------------------------------------------------*/ | 1842 | *--------------------------------------------------------------*/ |
| 1843 | static bool data_dev_supports_discard(struct pool_c *pt) | ||
| 1844 | { | ||
| 1845 | struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | ||
| 1846 | |||
| 1847 | return q && blk_queue_discard(q); | ||
| 1848 | } | ||
| 1849 | |||
| 1850 | /* | ||
| 1851 | * If discard_passdown was enabled verify that the data device | ||
| 1852 | * supports discards. Disable discard_passdown if not. | ||
| 1853 | */ | ||
| 1854 | static void disable_passdown_if_not_supported(struct pool_c *pt) | ||
| 1855 | { | ||
| 1856 | struct pool *pool = pt->pool; | ||
| 1857 | struct block_device *data_bdev = pt->data_dev->bdev; | ||
| 1858 | struct queue_limits *data_limits = &bdev_get_queue(data_bdev)->limits; | ||
| 1859 | sector_t block_size = pool->sectors_per_block << SECTOR_SHIFT; | ||
| 1860 | const char *reason = NULL; | ||
| 1861 | char buf[BDEVNAME_SIZE]; | ||
| 1862 | |||
| 1863 | if (!pt->adjusted_pf.discard_passdown) | ||
| 1864 | return; | ||
| 1865 | |||
| 1866 | if (!data_dev_supports_discard(pt)) | ||
| 1867 | reason = "discard unsupported"; | ||
| 1868 | |||
| 1869 | else if (data_limits->max_discard_sectors < pool->sectors_per_block) | ||
| 1870 | reason = "max discard sectors smaller than a block"; | ||
| 1871 | |||
| 1872 | else if (data_limits->discard_granularity > block_size) | ||
| 1873 | reason = "discard granularity larger than a block"; | ||
| 1874 | |||
| 1875 | else if (block_size & (data_limits->discard_granularity - 1)) | ||
| 1876 | reason = "discard granularity not a factor of block size"; | ||
| 1877 | |||
| 1878 | if (reason) { | ||
| 1879 | DMWARN("Data device (%s) %s: Disabling discard passdown.", bdevname(data_bdev, buf), reason); | ||
| 1880 | pt->adjusted_pf.discard_passdown = false; | ||
| 1881 | } | ||
| 1882 | } | ||
| 1883 | |||
| 1842 | static int bind_control_target(struct pool *pool, struct dm_target *ti) | 1884 | static int bind_control_target(struct pool *pool, struct dm_target *ti) |
| 1843 | { | 1885 | { |
| 1844 | struct pool_c *pt = ti->private; | 1886 | struct pool_c *pt = ti->private; |
| @@ -1847,31 +1889,16 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
| 1847 | * We want to make sure that degraded pools are never upgraded. | 1889 | * We want to make sure that degraded pools are never upgraded. |
| 1848 | */ | 1890 | */ |
| 1849 | enum pool_mode old_mode = pool->pf.mode; | 1891 | enum pool_mode old_mode = pool->pf.mode; |
| 1850 | enum pool_mode new_mode = pt->pf.mode; | 1892 | enum pool_mode new_mode = pt->adjusted_pf.mode; |
| 1851 | 1893 | ||
| 1852 | if (old_mode > new_mode) | 1894 | if (old_mode > new_mode) |
| 1853 | new_mode = old_mode; | 1895 | new_mode = old_mode; |
| 1854 | 1896 | ||
| 1855 | pool->ti = ti; | 1897 | pool->ti = ti; |
| 1856 | pool->low_water_blocks = pt->low_water_blocks; | 1898 | pool->low_water_blocks = pt->low_water_blocks; |
| 1857 | pool->pf = pt->pf; | 1899 | pool->pf = pt->adjusted_pf; |
| 1858 | set_pool_mode(pool, new_mode); | ||
| 1859 | 1900 | ||
| 1860 | /* | 1901 | set_pool_mode(pool, new_mode); |
| 1861 | * If discard_passdown was enabled verify that the data device | ||
| 1862 | * supports discards. Disable discard_passdown if not; otherwise | ||
| 1863 | * -EOPNOTSUPP will be returned. | ||
| 1864 | */ | ||
| 1865 | /* FIXME: pull this out into a sep fn. */ | ||
| 1866 | if (pt->pf.discard_passdown) { | ||
| 1867 | struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | ||
| 1868 | if (!q || !blk_queue_discard(q)) { | ||
| 1869 | char buf[BDEVNAME_SIZE]; | ||
| 1870 | DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.", | ||
| 1871 | bdevname(pt->data_dev->bdev, buf)); | ||
| 1872 | pool->pf.discard_passdown = 0; | ||
| 1873 | } | ||
| 1874 | } | ||
| 1875 | 1902 | ||
| 1876 | return 0; | 1903 | return 0; |
| 1877 | } | 1904 | } |
| @@ -1889,9 +1916,9 @@ static void unbind_control_target(struct pool *pool, struct dm_target *ti) | |||
| 1889 | static void pool_features_init(struct pool_features *pf) | 1916 | static void pool_features_init(struct pool_features *pf) |
| 1890 | { | 1917 | { |
| 1891 | pf->mode = PM_WRITE; | 1918 | pf->mode = PM_WRITE; |
| 1892 | pf->zero_new_blocks = 1; | 1919 | pf->zero_new_blocks = true; |
| 1893 | pf->discard_enabled = 1; | 1920 | pf->discard_enabled = true; |
| 1894 | pf->discard_passdown = 1; | 1921 | pf->discard_passdown = true; |
| 1895 | } | 1922 | } |
| 1896 | 1923 | ||
| 1897 | static void __pool_destroy(struct pool *pool) | 1924 | static void __pool_destroy(struct pool *pool) |
| @@ -2119,13 +2146,13 @@ static int parse_pool_features(struct dm_arg_set *as, struct pool_features *pf, | |||
| 2119 | argc--; | 2146 | argc--; |
| 2120 | 2147 | ||
| 2121 | if (!strcasecmp(arg_name, "skip_block_zeroing")) | 2148 | if (!strcasecmp(arg_name, "skip_block_zeroing")) |
| 2122 | pf->zero_new_blocks = 0; | 2149 | pf->zero_new_blocks = false; |
| 2123 | 2150 | ||
| 2124 | else if (!strcasecmp(arg_name, "ignore_discard")) | 2151 | else if (!strcasecmp(arg_name, "ignore_discard")) |
| 2125 | pf->discard_enabled = 0; | 2152 | pf->discard_enabled = false; |
| 2126 | 2153 | ||
| 2127 | else if (!strcasecmp(arg_name, "no_discard_passdown")) | 2154 | else if (!strcasecmp(arg_name, "no_discard_passdown")) |
| 2128 | pf->discard_passdown = 0; | 2155 | pf->discard_passdown = false; |
| 2129 | 2156 | ||
| 2130 | else if (!strcasecmp(arg_name, "read_only")) | 2157 | else if (!strcasecmp(arg_name, "read_only")) |
| 2131 | pf->mode = PM_READ_ONLY; | 2158 | pf->mode = PM_READ_ONLY; |
| @@ -2259,8 +2286,9 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2259 | pt->metadata_dev = metadata_dev; | 2286 | pt->metadata_dev = metadata_dev; |
| 2260 | pt->data_dev = data_dev; | 2287 | pt->data_dev = data_dev; |
| 2261 | pt->low_water_blocks = low_water_blocks; | 2288 | pt->low_water_blocks = low_water_blocks; |
| 2262 | pt->pf = pf; | 2289 | pt->adjusted_pf = pt->requested_pf = pf; |
| 2263 | ti->num_flush_requests = 1; | 2290 | ti->num_flush_requests = 1; |
| 2291 | |||
| 2264 | /* | 2292 | /* |
| 2265 | * Only need to enable discards if the pool should pass | 2293 | * Only need to enable discards if the pool should pass |
| 2266 | * them down to the data device. The thin device's discard | 2294 | * them down to the data device. The thin device's discard |
| @@ -2268,12 +2296,14 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2268 | */ | 2296 | */ |
| 2269 | if (pf.discard_enabled && pf.discard_passdown) { | 2297 | if (pf.discard_enabled && pf.discard_passdown) { |
| 2270 | ti->num_discard_requests = 1; | 2298 | ti->num_discard_requests = 1; |
| 2299 | |||
| 2271 | /* | 2300 | /* |
| 2272 | * Setting 'discards_supported' circumvents the normal | 2301 | * Setting 'discards_supported' circumvents the normal |
| 2273 | * stacking of discard limits (this keeps the pool and | 2302 | * stacking of discard limits (this keeps the pool and |
| 2274 | * thin devices' discard limits consistent). | 2303 | * thin devices' discard limits consistent). |
| 2275 | */ | 2304 | */ |
| 2276 | ti->discards_supported = true; | 2305 | ti->discards_supported = true; |
| 2306 | ti->discard_zeroes_data_unsupported = true; | ||
| 2277 | } | 2307 | } |
| 2278 | ti->private = pt; | 2308 | ti->private = pt; |
| 2279 | 2309 | ||
| @@ -2703,7 +2733,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, | |||
| 2703 | format_dev_t(buf2, pt->data_dev->bdev->bd_dev), | 2733 | format_dev_t(buf2, pt->data_dev->bdev->bd_dev), |
| 2704 | (unsigned long)pool->sectors_per_block, | 2734 | (unsigned long)pool->sectors_per_block, |
| 2705 | (unsigned long long)pt->low_water_blocks); | 2735 | (unsigned long long)pt->low_water_blocks); |
| 2706 | emit_flags(&pt->pf, result, sz, maxlen); | 2736 | emit_flags(&pt->requested_pf, result, sz, maxlen); |
| 2707 | break; | 2737 | break; |
| 2708 | } | 2738 | } |
| 2709 | 2739 | ||
| @@ -2732,20 +2762,21 @@ static int pool_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | |||
| 2732 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); | 2762 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); |
| 2733 | } | 2763 | } |
| 2734 | 2764 | ||
| 2735 | static void set_discard_limits(struct pool *pool, struct queue_limits *limits) | 2765 | static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) |
| 2736 | { | 2766 | { |
| 2737 | /* | 2767 | struct pool *pool = pt->pool; |
| 2738 | * FIXME: these limits may be incompatible with the pool's data device | 2768 | struct queue_limits *data_limits; |
| 2739 | */ | 2769 | |
| 2740 | limits->max_discard_sectors = pool->sectors_per_block; | 2770 | limits->max_discard_sectors = pool->sectors_per_block; |
| 2741 | 2771 | ||
| 2742 | /* | 2772 | /* |
| 2743 | * This is just a hint, and not enforced. We have to cope with | 2773 | * discard_granularity is just a hint, and not enforced. |
| 2744 | * bios that cover a block partially. A discard that spans a block | ||
| 2745 | * boundary is not sent to this target. | ||
| 2746 | */ | 2774 | */ |
| 2747 | limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; | 2775 | if (pt->adjusted_pf.discard_passdown) { |
| 2748 | limits->discard_zeroes_data = pool->pf.zero_new_blocks; | 2776 | data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits; |
| 2777 | limits->discard_granularity = data_limits->discard_granularity; | ||
| 2778 | } else | ||
| 2779 | limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; | ||
| 2749 | } | 2780 | } |
| 2750 | 2781 | ||
| 2751 | static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) | 2782 | static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) |
| @@ -2755,15 +2786,25 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
| 2755 | 2786 | ||
| 2756 | blk_limits_io_min(limits, 0); | 2787 | blk_limits_io_min(limits, 0); |
| 2757 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); | 2788 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); |
| 2758 | if (pool->pf.discard_enabled) | 2789 | |
| 2759 | set_discard_limits(pool, limits); | 2790 | /* |
| 2791 | * pt->adjusted_pf is a staging area for the actual features to use. | ||
| 2792 | * They get transferred to the live pool in bind_control_target() | ||
| 2793 | * called from pool_preresume(). | ||
| 2794 | */ | ||
| 2795 | if (!pt->adjusted_pf.discard_enabled) | ||
| 2796 | return; | ||
| 2797 | |||
| 2798 | disable_passdown_if_not_supported(pt); | ||
| 2799 | |||
| 2800 | set_discard_limits(pt, limits); | ||
| 2760 | } | 2801 | } |
| 2761 | 2802 | ||
| 2762 | static struct target_type pool_target = { | 2803 | static struct target_type pool_target = { |
| 2763 | .name = "thin-pool", | 2804 | .name = "thin-pool", |
| 2764 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2805 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
| 2765 | DM_TARGET_IMMUTABLE, | 2806 | DM_TARGET_IMMUTABLE, |
| 2766 | .version = {1, 3, 0}, | 2807 | .version = {1, 4, 0}, |
| 2767 | .module = THIS_MODULE, | 2808 | .module = THIS_MODULE, |
| 2768 | .ctr = pool_ctr, | 2809 | .ctr = pool_ctr, |
| 2769 | .dtr = pool_dtr, | 2810 | .dtr = pool_dtr, |
| @@ -3042,19 +3083,19 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
| 3042 | return 0; | 3083 | return 0; |
| 3043 | } | 3084 | } |
| 3044 | 3085 | ||
| 3086 | /* | ||
| 3087 | * A thin device always inherits its queue limits from its pool. | ||
| 3088 | */ | ||
| 3045 | static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) | 3089 | static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) |
| 3046 | { | 3090 | { |
| 3047 | struct thin_c *tc = ti->private; | 3091 | struct thin_c *tc = ti->private; |
| 3048 | struct pool *pool = tc->pool; | ||
| 3049 | 3092 | ||
| 3050 | blk_limits_io_min(limits, 0); | 3093 | *limits = bdev_get_queue(tc->pool_dev->bdev)->limits; |
| 3051 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); | ||
| 3052 | set_discard_limits(pool, limits); | ||
| 3053 | } | 3094 | } |
| 3054 | 3095 | ||
| 3055 | static struct target_type thin_target = { | 3096 | static struct target_type thin_target = { |
| 3056 | .name = "thin", | 3097 | .name = "thin", |
| 3057 | .version = {1, 3, 0}, | 3098 | .version = {1, 4, 0}, |
| 3058 | .module = THIS_MODULE, | 3099 | .module = THIS_MODULE, |
| 3059 | .ctr = thin_ctr, | 3100 | .ctr = thin_ctr, |
| 3060 | .dtr = thin_dtr, | 3101 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 254d19268ad2..892ae2766aa6 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
| @@ -718,8 +718,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 718 | v->hash_dev_block_bits = ffs(num) - 1; | 718 | v->hash_dev_block_bits = ffs(num) - 1; |
| 719 | 719 | ||
| 720 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || | 720 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || |
| 721 | num_ll << (v->data_dev_block_bits - SECTOR_SHIFT) != | 721 | (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) |
| 722 | (sector_t)num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) { | 722 | >> (v->data_dev_block_bits - SECTOR_SHIFT) != num_ll) { |
| 723 | ti->error = "Invalid data blocks"; | 723 | ti->error = "Invalid data blocks"; |
| 724 | r = -EINVAL; | 724 | r = -EINVAL; |
| 725 | goto bad; | 725 | goto bad; |
| @@ -733,8 +733,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | if (sscanf(argv[6], "%llu%c", &num_ll, &dummy) != 1 || | 735 | if (sscanf(argv[6], "%llu%c", &num_ll, &dummy) != 1 || |
| 736 | num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT) != | 736 | (sector_t)(num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) |
| 737 | (sector_t)num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) { | 737 | >> (v->hash_dev_block_bits - SECTOR_SHIFT) != num_ll) { |
| 738 | ti->error = "Invalid hash start"; | 738 | ti->error = "Invalid hash start"; |
| 739 | r = -EINVAL; | 739 | r = -EINVAL; |
| 740 | goto bad; | 740 | goto bad; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 4e09b6ff5b49..67ffa391edcf 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -865,10 +865,14 @@ static void dm_done(struct request *clone, int error, bool mapped) | |||
| 865 | { | 865 | { |
| 866 | int r = error; | 866 | int r = error; |
| 867 | struct dm_rq_target_io *tio = clone->end_io_data; | 867 | struct dm_rq_target_io *tio = clone->end_io_data; |
| 868 | dm_request_endio_fn rq_end_io = tio->ti->type->rq_end_io; | 868 | dm_request_endio_fn rq_end_io = NULL; |
| 869 | 869 | ||
| 870 | if (mapped && rq_end_io) | 870 | if (tio->ti) { |
| 871 | r = rq_end_io(tio->ti, clone, error, &tio->info); | 871 | rq_end_io = tio->ti->type->rq_end_io; |
| 872 | |||
| 873 | if (mapped && rq_end_io) | ||
| 874 | r = rq_end_io(tio->ti, clone, error, &tio->info); | ||
| 875 | } | ||
| 872 | 876 | ||
| 873 | if (r <= 0) | 877 | if (r <= 0) |
| 874 | /* The target wants to complete the I/O */ | 878 | /* The target wants to complete the I/O */ |
| @@ -1588,15 +1592,6 @@ static int map_request(struct dm_target *ti, struct request *clone, | |||
| 1588 | int r, requeued = 0; | 1592 | int r, requeued = 0; |
| 1589 | struct dm_rq_target_io *tio = clone->end_io_data; | 1593 | struct dm_rq_target_io *tio = clone->end_io_data; |
| 1590 | 1594 | ||
| 1591 | /* | ||
| 1592 | * Hold the md reference here for the in-flight I/O. | ||
| 1593 | * We can't rely on the reference count by device opener, | ||
| 1594 | * because the device may be closed during the request completion | ||
| 1595 | * when all bios are completed. | ||
| 1596 | * See the comment in rq_completed() too. | ||
| 1597 | */ | ||
| 1598 | dm_get(md); | ||
| 1599 | |||
| 1600 | tio->ti = ti; | 1595 | tio->ti = ti; |
| 1601 | r = ti->type->map_rq(ti, clone, &tio->info); | 1596 | r = ti->type->map_rq(ti, clone, &tio->info); |
| 1602 | switch (r) { | 1597 | switch (r) { |
| @@ -1628,6 +1623,26 @@ static int map_request(struct dm_target *ti, struct request *clone, | |||
| 1628 | return requeued; | 1623 | return requeued; |
| 1629 | } | 1624 | } |
| 1630 | 1625 | ||
| 1626 | static struct request *dm_start_request(struct mapped_device *md, struct request *orig) | ||
| 1627 | { | ||
| 1628 | struct request *clone; | ||
| 1629 | |||
| 1630 | blk_start_request(orig); | ||
| 1631 | clone = orig->special; | ||
| 1632 | atomic_inc(&md->pending[rq_data_dir(clone)]); | ||
| 1633 | |||
| 1634 | /* | ||
| 1635 | * Hold the md reference here for the in-flight I/O. | ||
| 1636 | * We can't rely on the reference count by device opener, | ||
| 1637 | * because the device may be closed during the request completion | ||
| 1638 | * when all bios are completed. | ||
| 1639 | * See the comment in rq_completed() too. | ||
| 1640 | */ | ||
| 1641 | dm_get(md); | ||
| 1642 | |||
| 1643 | return clone; | ||
| 1644 | } | ||
| 1645 | |||
| 1631 | /* | 1646 | /* |
| 1632 | * q->request_fn for request-based dm. | 1647 | * q->request_fn for request-based dm. |
| 1633 | * Called with the queue lock held. | 1648 | * Called with the queue lock held. |
| @@ -1657,14 +1672,21 @@ static void dm_request_fn(struct request_queue *q) | |||
| 1657 | pos = blk_rq_pos(rq); | 1672 | pos = blk_rq_pos(rq); |
| 1658 | 1673 | ||
| 1659 | ti = dm_table_find_target(map, pos); | 1674 | ti = dm_table_find_target(map, pos); |
| 1660 | BUG_ON(!dm_target_is_valid(ti)); | 1675 | if (!dm_target_is_valid(ti)) { |
| 1676 | /* | ||
| 1677 | * Must perform setup, that dm_done() requires, | ||
| 1678 | * before calling dm_kill_unmapped_request | ||
| 1679 | */ | ||
| 1680 | DMERR_LIMIT("request attempted access beyond the end of device"); | ||
| 1681 | clone = dm_start_request(md, rq); | ||
| 1682 | dm_kill_unmapped_request(clone, -EIO); | ||
| 1683 | continue; | ||
| 1684 | } | ||
| 1661 | 1685 | ||
| 1662 | if (ti->type->busy && ti->type->busy(ti)) | 1686 | if (ti->type->busy && ti->type->busy(ti)) |
| 1663 | goto delay_and_out; | 1687 | goto delay_and_out; |
| 1664 | 1688 | ||
| 1665 | blk_start_request(rq); | 1689 | clone = dm_start_request(md, rq); |
| 1666 | clone = rq->special; | ||
| 1667 | atomic_inc(&md->pending[rq_data_dir(clone)]); | ||
| 1668 | 1690 | ||
| 1669 | spin_unlock(q->queue_lock); | 1691 | spin_unlock(q->queue_lock); |
| 1670 | if (map_request(ti, clone, md)) | 1692 | if (map_request(ti, clone, md)) |
| @@ -1684,8 +1706,6 @@ delay_and_out: | |||
| 1684 | blk_delay_queue(q, HZ / 10); | 1706 | blk_delay_queue(q, HZ / 10); |
| 1685 | out: | 1707 | out: |
| 1686 | dm_table_put(map); | 1708 | dm_table_put(map); |
| 1687 | |||
| 1688 | return; | ||
| 1689 | } | 1709 | } |
| 1690 | 1710 | ||
| 1691 | int dm_underlying_device_busy(struct request_queue *q) | 1711 | int dm_underlying_device_busy(struct request_queue *q) |
| @@ -2409,7 +2429,7 @@ static void dm_queue_flush(struct mapped_device *md) | |||
| 2409 | */ | 2429 | */ |
| 2410 | struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | 2430 | struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) |
| 2411 | { | 2431 | { |
| 2412 | struct dm_table *map = ERR_PTR(-EINVAL); | 2432 | struct dm_table *live_map, *map = ERR_PTR(-EINVAL); |
| 2413 | struct queue_limits limits; | 2433 | struct queue_limits limits; |
| 2414 | int r; | 2434 | int r; |
| 2415 | 2435 | ||
| @@ -2419,6 +2439,19 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | |||
| 2419 | if (!dm_suspended_md(md)) | 2439 | if (!dm_suspended_md(md)) |
| 2420 | goto out; | 2440 | goto out; |
| 2421 | 2441 | ||
| 2442 | /* | ||
| 2443 | * If the new table has no data devices, retain the existing limits. | ||
| 2444 | * This helps multipath with queue_if_no_path if all paths disappear, | ||
| 2445 | * then new I/O is queued based on these limits, and then some paths | ||
| 2446 | * reappear. | ||
| 2447 | */ | ||
| 2448 | if (dm_table_has_no_data_devices(table)) { | ||
| 2449 | live_map = dm_get_live_table(md); | ||
| 2450 | if (live_map) | ||
| 2451 | limits = md->queue->limits; | ||
| 2452 | dm_table_put(live_map); | ||
| 2453 | } | ||
| 2454 | |||
| 2422 | r = dm_calculate_queue_limits(table, &limits); | 2455 | r = dm_calculate_queue_limits(table, &limits); |
| 2423 | if (r) { | 2456 | if (r) { |
| 2424 | map = ERR_PTR(r); | 2457 | map = ERR_PTR(r); |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 52eef493d266..6a99fefaa743 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
| @@ -54,6 +54,7 @@ void dm_table_event_callback(struct dm_table *t, | |||
| 54 | void (*fn)(void *), void *context); | 54 | void (*fn)(void *), void *context); |
| 55 | struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index); | 55 | struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index); |
| 56 | struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector); | 56 | struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector); |
| 57 | bool dm_table_has_no_data_devices(struct dm_table *table); | ||
| 57 | int dm_calculate_queue_limits(struct dm_table *table, | 58 | int dm_calculate_queue_limits(struct dm_table *table, |
| 58 | struct queue_limits *limits); | 59 | struct queue_limits *limits); |
| 59 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | 60 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 1c2eb38f3c51..0138a727c1f3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -1512,14 +1512,16 @@ static int _enough(struct r10conf *conf, struct geom *geo, int ignore) | |||
| 1512 | do { | 1512 | do { |
| 1513 | int n = conf->copies; | 1513 | int n = conf->copies; |
| 1514 | int cnt = 0; | 1514 | int cnt = 0; |
| 1515 | int this = first; | ||
| 1515 | while (n--) { | 1516 | while (n--) { |
| 1516 | if (conf->mirrors[first].rdev && | 1517 | if (conf->mirrors[this].rdev && |
| 1517 | first != ignore) | 1518 | this != ignore) |
| 1518 | cnt++; | 1519 | cnt++; |
| 1519 | first = (first+1) % geo->raid_disks; | 1520 | this = (this+1) % geo->raid_disks; |
| 1520 | } | 1521 | } |
| 1521 | if (cnt == 0) | 1522 | if (cnt == 0) |
| 1522 | return 0; | 1523 | return 0; |
| 1524 | first = (first + geo->near_copies) % geo->raid_disks; | ||
| 1523 | } while (first != 0); | 1525 | } while (first != 0); |
| 1524 | return 1; | 1526 | return 1; |
| 1525 | } | 1527 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7031b865b3a0..0689173fd9f5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -1591,6 +1591,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
| 1591 | #ifdef CONFIG_MULTICORE_RAID456 | 1591 | #ifdef CONFIG_MULTICORE_RAID456 |
| 1592 | init_waitqueue_head(&nsh->ops.wait_for_ops); | 1592 | init_waitqueue_head(&nsh->ops.wait_for_ops); |
| 1593 | #endif | 1593 | #endif |
| 1594 | spin_lock_init(&nsh->stripe_lock); | ||
| 1594 | 1595 | ||
| 1595 | list_add(&nsh->lru, &newstripes); | 1596 | list_add(&nsh->lru, &newstripes); |
| 1596 | } | 1597 | } |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index f2f482bec573..a6e74514e662 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -1123,6 +1123,33 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, | |||
| 1123 | } | 1123 | } |
| 1124 | #endif | 1124 | #endif |
| 1125 | 1125 | ||
| 1126 | static inline unsigned long get_vm_size(struct vm_area_struct *vma) | ||
| 1127 | { | ||
| 1128 | return vma->vm_end - vma->vm_start; | ||
| 1129 | } | ||
| 1130 | |||
| 1131 | static inline resource_size_t get_vm_offset(struct vm_area_struct *vma) | ||
| 1132 | { | ||
| 1133 | return (resource_size_t) vma->vm_pgoff << PAGE_SHIFT; | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | /* | ||
| 1137 | * Set a new vm offset. | ||
| 1138 | * | ||
| 1139 | * Verify that the incoming offset really works as a page offset, | ||
| 1140 | * and that the offset and size fit in a resource_size_t. | ||
| 1141 | */ | ||
| 1142 | static inline int set_vm_offset(struct vm_area_struct *vma, resource_size_t off) | ||
| 1143 | { | ||
| 1144 | pgoff_t pgoff = off >> PAGE_SHIFT; | ||
| 1145 | if (off != (resource_size_t) pgoff << PAGE_SHIFT) | ||
| 1146 | return -EINVAL; | ||
| 1147 | if (off + get_vm_size(vma) - 1 < off) | ||
| 1148 | return -EINVAL; | ||
| 1149 | vma->vm_pgoff = pgoff; | ||
| 1150 | return 0; | ||
| 1151 | } | ||
| 1152 | |||
| 1126 | /* | 1153 | /* |
| 1127 | * set up a mapping for shared memory segments | 1154 | * set up a mapping for shared memory segments |
| 1128 | */ | 1155 | */ |
| @@ -1132,20 +1159,29 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 1132 | struct mtd_file_info *mfi = file->private_data; | 1159 | struct mtd_file_info *mfi = file->private_data; |
| 1133 | struct mtd_info *mtd = mfi->mtd; | 1160 | struct mtd_info *mtd = mfi->mtd; |
| 1134 | struct map_info *map = mtd->priv; | 1161 | struct map_info *map = mtd->priv; |
| 1135 | unsigned long start; | 1162 | resource_size_t start, off; |
| 1136 | unsigned long off; | 1163 | unsigned long len, vma_len; |
| 1137 | u32 len; | ||
| 1138 | 1164 | ||
| 1139 | if (mtd->type == MTD_RAM || mtd->type == MTD_ROM) { | 1165 | if (mtd->type == MTD_RAM || mtd->type == MTD_ROM) { |
| 1140 | off = vma->vm_pgoff << PAGE_SHIFT; | 1166 | off = get_vm_offset(vma); |
| 1141 | start = map->phys; | 1167 | start = map->phys; |
| 1142 | len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size); | 1168 | len = PAGE_ALIGN((start & ~PAGE_MASK) + map->size); |
| 1143 | start &= PAGE_MASK; | 1169 | start &= PAGE_MASK; |
| 1144 | if ((vma->vm_end - vma->vm_start + off) > len) | 1170 | vma_len = get_vm_size(vma); |
| 1171 | |||
| 1172 | /* Overflow in off+len? */ | ||
| 1173 | if (vma_len + off < off) | ||
| 1174 | return -EINVAL; | ||
| 1175 | /* Does it fit in the mapping? */ | ||
| 1176 | if (vma_len + off > len) | ||
| 1145 | return -EINVAL; | 1177 | return -EINVAL; |
| 1146 | 1178 | ||
| 1147 | off += start; | 1179 | off += start; |
| 1148 | vma->vm_pgoff = off >> PAGE_SHIFT; | 1180 | /* Did that overflow? */ |
| 1181 | if (off < start) | ||
| 1182 | return -EINVAL; | ||
| 1183 | if (set_vm_offset(vma, off) < 0) | ||
| 1184 | return -EINVAL; | ||
| 1149 | vma->vm_flags |= VM_IO | VM_RESERVED; | 1185 | vma->vm_flags |= VM_IO | VM_RESERVED; |
| 1150 | 1186 | ||
| 1151 | #ifdef pgprot_noncached | 1187 | #ifdef pgprot_noncached |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 79cebd8525ce..e48312f2305d 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
| @@ -8564,7 +8564,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 8564 | return 0; | 8564 | return 0; |
| 8565 | 8565 | ||
| 8566 | error: | 8566 | error: |
| 8567 | iounmap(bp->regview); | 8567 | pci_iounmap(pdev, bp->regview); |
| 8568 | pci_release_regions(pdev); | 8568 | pci_release_regions(pdev); |
| 8569 | pci_disable_device(pdev); | 8569 | pci_disable_device(pdev); |
| 8570 | pci_set_drvdata(pdev, NULL); | 8570 | pci_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index c42bbb16cdae..a688a2ddcfd6 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
| @@ -722,10 +722,8 @@ static int octeon_mgmt_init_phy(struct net_device *netdev) | |||
| 722 | octeon_mgmt_adjust_link, 0, | 722 | octeon_mgmt_adjust_link, 0, |
| 723 | PHY_INTERFACE_MODE_MII); | 723 | PHY_INTERFACE_MODE_MII); |
| 724 | 724 | ||
| 725 | if (IS_ERR(p->phydev)) { | 725 | if (!p->phydev) |
| 726 | p->phydev = NULL; | ||
| 727 | return -1; | 726 | return -1; |
| 728 | } | ||
| 729 | 727 | ||
| 730 | phy_start_aneg(p->phydev); | 728 | phy_start_aneg(p->phydev); |
| 731 | 729 | ||
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index e559dfa06d6a..6fa74d530e44 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
| @@ -1101,9 +1101,9 @@ static int pasemi_mac_phy_init(struct net_device *dev) | |||
| 1101 | phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, | 1101 | phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, |
| 1102 | PHY_INTERFACE_MODE_SGMII); | 1102 | PHY_INTERFACE_MODE_SGMII); |
| 1103 | 1103 | ||
| 1104 | if (IS_ERR(phydev)) { | 1104 | if (!phydev) { |
| 1105 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); | 1105 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); |
| 1106 | return PTR_ERR(phydev); | 1106 | return -ENODEV; |
| 1107 | } | 1107 | } |
| 1108 | 1108 | ||
| 1109 | mac->phydev = phydev; | 1109 | mac->phydev = phydev; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index b8ead696141e..2a179d087207 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
| @@ -15,7 +15,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
| 15 | 15 | ||
| 16 | do { | 16 | do { |
| 17 | /* give atleast 1ms for firmware to respond */ | 17 | /* give atleast 1ms for firmware to respond */ |
| 18 | msleep(1); | 18 | mdelay(1); |
| 19 | 19 | ||
| 20 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) | 20 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) |
| 21 | return QLCNIC_CDRP_RSP_TIMEOUT; | 21 | return QLCNIC_CDRP_RSP_TIMEOUT; |
| @@ -601,7 +601,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) | |||
| 601 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); | 601 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); |
| 602 | 602 | ||
| 603 | /* Allow dma queues to drain after context reset */ | 603 | /* Allow dma queues to drain after context reset */ |
| 604 | msleep(20); | 604 | mdelay(20); |
| 605 | } | 605 | } |
| 606 | } | 606 | } |
| 607 | 607 | ||
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index 2346b38b9837..799789518e87 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c | |||
| @@ -229,3 +229,5 @@ static void __exit bcm87xx_exit(void) | |||
| 229 | ARRAY_SIZE(bcm87xx_driver)); | 229 | ARRAY_SIZE(bcm87xx_driver)); |
| 230 | } | 230 | } |
| 231 | module_exit(bcm87xx_exit); | 231 | module_exit(bcm87xx_exit); |
| 232 | |||
| 233 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cf287e0eb408..2165d5fdb8c0 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
| @@ -21,6 +21,12 @@ | |||
| 21 | #include <linux/phy.h> | 21 | #include <linux/phy.h> |
| 22 | #include <linux/micrel_phy.h> | 22 | #include <linux/micrel_phy.h> |
| 23 | 23 | ||
| 24 | /* Operation Mode Strap Override */ | ||
| 25 | #define MII_KSZPHY_OMSO 0x16 | ||
| 26 | #define KSZPHY_OMSO_B_CAST_OFF (1 << 9) | ||
| 27 | #define KSZPHY_OMSO_RMII_OVERRIDE (1 << 1) | ||
| 28 | #define KSZPHY_OMSO_MII_OVERRIDE (1 << 0) | ||
| 29 | |||
| 24 | /* general Interrupt control/status reg in vendor specific block. */ | 30 | /* general Interrupt control/status reg in vendor specific block. */ |
| 25 | #define MII_KSZPHY_INTCS 0x1B | 31 | #define MII_KSZPHY_INTCS 0x1B |
| 26 | #define KSZPHY_INTCS_JABBER (1 << 15) | 32 | #define KSZPHY_INTCS_JABBER (1 << 15) |
| @@ -101,6 +107,13 @@ static int kszphy_config_init(struct phy_device *phydev) | |||
| 101 | return 0; | 107 | return 0; |
| 102 | } | 108 | } |
| 103 | 109 | ||
| 110 | static int ksz8021_config_init(struct phy_device *phydev) | ||
| 111 | { | ||
| 112 | const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE; | ||
| 113 | phy_write(phydev, MII_KSZPHY_OMSO, val); | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 104 | static int ks8051_config_init(struct phy_device *phydev) | 117 | static int ks8051_config_init(struct phy_device *phydev) |
| 105 | { | 118 | { |
| 106 | int regval; | 119 | int regval; |
| @@ -128,9 +141,22 @@ static struct phy_driver ksphy_driver[] = { | |||
| 128 | .config_intr = ks8737_config_intr, | 141 | .config_intr = ks8737_config_intr, |
| 129 | .driver = { .owner = THIS_MODULE,}, | 142 | .driver = { .owner = THIS_MODULE,}, |
| 130 | }, { | 143 | }, { |
| 131 | .phy_id = PHY_ID_KS8041, | 144 | .phy_id = PHY_ID_KSZ8021, |
| 145 | .phy_id_mask = 0x00ffffff, | ||
| 146 | .name = "Micrel KSZ8021", | ||
| 147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | | ||
| 148 | SUPPORTED_Asym_Pause), | ||
| 149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | ||
| 150 | .config_init = ksz8021_config_init, | ||
| 151 | .config_aneg = genphy_config_aneg, | ||
| 152 | .read_status = genphy_read_status, | ||
| 153 | .ack_interrupt = kszphy_ack_interrupt, | ||
| 154 | .config_intr = kszphy_config_intr, | ||
| 155 | .driver = { .owner = THIS_MODULE,}, | ||
| 156 | }, { | ||
| 157 | .phy_id = PHY_ID_KSZ8041, | ||
| 132 | .phy_id_mask = 0x00fffff0, | 158 | .phy_id_mask = 0x00fffff0, |
| 133 | .name = "Micrel KS8041", | 159 | .name = "Micrel KSZ8041", |
| 134 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
| 135 | | SUPPORTED_Asym_Pause), | 161 | | SUPPORTED_Asym_Pause), |
| 136 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 162 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| @@ -141,9 +167,9 @@ static struct phy_driver ksphy_driver[] = { | |||
| 141 | .config_intr = kszphy_config_intr, | 167 | .config_intr = kszphy_config_intr, |
| 142 | .driver = { .owner = THIS_MODULE,}, | 168 | .driver = { .owner = THIS_MODULE,}, |
| 143 | }, { | 169 | }, { |
| 144 | .phy_id = PHY_ID_KS8051, | 170 | .phy_id = PHY_ID_KSZ8051, |
| 145 | .phy_id_mask = 0x00fffff0, | 171 | .phy_id_mask = 0x00fffff0, |
| 146 | .name = "Micrel KS8051", | 172 | .name = "Micrel KSZ8051", |
| 147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 173 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
| 148 | | SUPPORTED_Asym_Pause), | 174 | | SUPPORTED_Asym_Pause), |
| 149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 175 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| @@ -154,8 +180,8 @@ static struct phy_driver ksphy_driver[] = { | |||
| 154 | .config_intr = kszphy_config_intr, | 180 | .config_intr = kszphy_config_intr, |
| 155 | .driver = { .owner = THIS_MODULE,}, | 181 | .driver = { .owner = THIS_MODULE,}, |
| 156 | }, { | 182 | }, { |
| 157 | .phy_id = PHY_ID_KS8001, | 183 | .phy_id = PHY_ID_KSZ8001, |
| 158 | .name = "Micrel KS8001 or KS8721", | 184 | .name = "Micrel KSZ8001 or KS8721", |
| 159 | .phy_id_mask = 0x00ffffff, | 185 | .phy_id_mask = 0x00ffffff, |
| 160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | 186 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 161 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 187 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| @@ -201,10 +227,11 @@ MODULE_LICENSE("GPL"); | |||
| 201 | 227 | ||
| 202 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { | 228 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
| 203 | { PHY_ID_KSZ9021, 0x000ffffe }, | 229 | { PHY_ID_KSZ9021, 0x000ffffe }, |
| 204 | { PHY_ID_KS8001, 0x00ffffff }, | 230 | { PHY_ID_KSZ8001, 0x00ffffff }, |
| 205 | { PHY_ID_KS8737, 0x00fffff0 }, | 231 | { PHY_ID_KS8737, 0x00fffff0 }, |
| 206 | { PHY_ID_KS8041, 0x00fffff0 }, | 232 | { PHY_ID_KSZ8021, 0x00ffffff }, |
| 207 | { PHY_ID_KS8051, 0x00fffff0 }, | 233 | { PHY_ID_KSZ8041, 0x00fffff0 }, |
| 234 | { PHY_ID_KSZ8051, 0x00fffff0 }, | ||
| 208 | { } | 235 | { } |
| 209 | }; | 236 | }; |
| 210 | 237 | ||
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 6d6192316b30..88e3991464e7 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
| @@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev) | |||
| 56 | return smsc_phy_ack_interrupt (phydev); | 56 | return smsc_phy_ack_interrupt (phydev); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static int lan87xx_config_init(struct phy_device *phydev) | ||
| 60 | { | ||
| 61 | /* | ||
| 62 | * Make sure the EDPWRDOWN bit is NOT set. Setting this bit on | ||
| 63 | * LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due | ||
| 64 | * to a bug on the chip. | ||
| 65 | * | ||
| 66 | * When the system is powered on with the network cable being | ||
| 67 | * disconnected all the way until after ifconfig ethX up is | ||
| 68 | * issued for the LAN port with this PHY, connecting the cable | ||
| 69 | * afterwards does not cause LINK change detection, while the | ||
| 70 | * expected behavior is the Link UP being detected. | ||
| 71 | */ | ||
| 72 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | ||
| 73 | if (rc < 0) | ||
| 74 | return rc; | ||
| 75 | |||
| 76 | rc &= ~MII_LAN83C185_EDPWRDOWN; | ||
| 77 | |||
| 78 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc); | ||
| 79 | if (rc < 0) | ||
| 80 | return rc; | ||
| 81 | |||
| 82 | return smsc_phy_ack_interrupt(phydev); | ||
| 83 | } | ||
| 84 | |||
| 59 | static int lan911x_config_init(struct phy_device *phydev) | 85 | static int lan911x_config_init(struct phy_device *phydev) |
| 60 | { | 86 | { |
| 61 | return smsc_phy_ack_interrupt(phydev); | 87 | return smsc_phy_ack_interrupt(phydev); |
| @@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
| 162 | /* basic functions */ | 188 | /* basic functions */ |
| 163 | .config_aneg = genphy_config_aneg, | 189 | .config_aneg = genphy_config_aneg, |
| 164 | .read_status = genphy_read_status, | 190 | .read_status = genphy_read_status, |
| 165 | .config_init = smsc_phy_config_init, | 191 | .config_init = lan87xx_config_init, |
| 166 | 192 | ||
| 167 | /* IRQ related */ | 193 | /* IRQ related */ |
| 168 | .ack_interrupt = smsc_phy_ack_interrupt, | 194 | .ack_interrupt = smsc_phy_ack_interrupt, |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index cbf7047decc0..20f31d0d1536 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
| @@ -570,7 +570,7 @@ static int pppoe_release(struct socket *sock) | |||
| 570 | 570 | ||
| 571 | po = pppox_sk(sk); | 571 | po = pppox_sk(sk); |
| 572 | 572 | ||
| 573 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 573 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
| 574 | dev_put(po->pppoe_dev); | 574 | dev_put(po->pppoe_dev); |
| 575 | po->pppoe_dev = NULL; | 575 | po->pppoe_dev = NULL; |
| 576 | } | 576 | } |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 341b65dbbcd3..f8cd61f449a4 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -848,7 +848,7 @@ static struct netpoll_info *team_netpoll_info(struct team *team) | |||
| 848 | } | 848 | } |
| 849 | #endif | 849 | #endif |
| 850 | 850 | ||
| 851 | static void __team_port_change_check(struct team_port *port, bool linkup); | 851 | static void __team_port_change_port_added(struct team_port *port, bool linkup); |
| 852 | 852 | ||
| 853 | static int team_port_add(struct team *team, struct net_device *port_dev) | 853 | static int team_port_add(struct team *team, struct net_device *port_dev) |
| 854 | { | 854 | { |
| @@ -948,7 +948,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) | |||
| 948 | team_port_enable(team, port); | 948 | team_port_enable(team, port); |
| 949 | list_add_tail_rcu(&port->list, &team->port_list); | 949 | list_add_tail_rcu(&port->list, &team->port_list); |
| 950 | __team_compute_features(team); | 950 | __team_compute_features(team); |
| 951 | __team_port_change_check(port, !!netif_carrier_ok(port_dev)); | 951 | __team_port_change_port_added(port, !!netif_carrier_ok(port_dev)); |
| 952 | __team_options_change_check(team); | 952 | __team_options_change_check(team); |
| 953 | 953 | ||
| 954 | netdev_info(dev, "Port device %s added\n", portname); | 954 | netdev_info(dev, "Port device %s added\n", portname); |
| @@ -983,6 +983,8 @@ err_set_mtu: | |||
| 983 | return err; | 983 | return err; |
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | static void __team_port_change_port_removed(struct team_port *port); | ||
| 987 | |||
| 986 | static int team_port_del(struct team *team, struct net_device *port_dev) | 988 | static int team_port_del(struct team *team, struct net_device *port_dev) |
| 987 | { | 989 | { |
| 988 | struct net_device *dev = team->dev; | 990 | struct net_device *dev = team->dev; |
| @@ -999,8 +1001,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev) | |||
| 999 | __team_option_inst_mark_removed_port(team, port); | 1001 | __team_option_inst_mark_removed_port(team, port); |
| 1000 | __team_options_change_check(team); | 1002 | __team_options_change_check(team); |
| 1001 | __team_option_inst_del_port(team, port); | 1003 | __team_option_inst_del_port(team, port); |
| 1002 | port->removed = true; | 1004 | __team_port_change_port_removed(port); |
| 1003 | __team_port_change_check(port, false); | ||
| 1004 | team_port_disable(team, port); | 1005 | team_port_disable(team, port); |
| 1005 | list_del_rcu(&port->list); | 1006 | list_del_rcu(&port->list); |
| 1006 | netdev_rx_handler_unregister(port_dev); | 1007 | netdev_rx_handler_unregister(port_dev); |
| @@ -1652,8 +1653,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) | |||
| 1652 | 1653 | ||
| 1653 | hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, | 1654 | hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, |
| 1654 | &team_nl_family, 0, TEAM_CMD_NOOP); | 1655 | &team_nl_family, 0, TEAM_CMD_NOOP); |
| 1655 | if (IS_ERR(hdr)) { | 1656 | if (!hdr) { |
| 1656 | err = PTR_ERR(hdr); | 1657 | err = -EMSGSIZE; |
| 1657 | goto err_msg_put; | 1658 | goto err_msg_put; |
| 1658 | } | 1659 | } |
| 1659 | 1660 | ||
| @@ -1847,8 +1848,8 @@ start_again: | |||
| 1847 | 1848 | ||
| 1848 | hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI, | 1849 | hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI, |
| 1849 | TEAM_CMD_OPTIONS_GET); | 1850 | TEAM_CMD_OPTIONS_GET); |
| 1850 | if (IS_ERR(hdr)) | 1851 | if (!hdr) |
| 1851 | return PTR_ERR(hdr); | 1852 | return -EMSGSIZE; |
| 1852 | 1853 | ||
| 1853 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) | 1854 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) |
| 1854 | goto nla_put_failure; | 1855 | goto nla_put_failure; |
| @@ -2067,8 +2068,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb, | |||
| 2067 | 2068 | ||
| 2068 | hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags, | 2069 | hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags, |
| 2069 | TEAM_CMD_PORT_LIST_GET); | 2070 | TEAM_CMD_PORT_LIST_GET); |
| 2070 | if (IS_ERR(hdr)) | 2071 | if (!hdr) |
| 2071 | return PTR_ERR(hdr); | 2072 | return -EMSGSIZE; |
| 2072 | 2073 | ||
| 2073 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) | 2074 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) |
| 2074 | goto nla_put_failure; | 2075 | goto nla_put_failure; |
| @@ -2251,13 +2252,11 @@ static void __team_options_change_check(struct team *team) | |||
| 2251 | } | 2252 | } |
| 2252 | 2253 | ||
| 2253 | /* rtnl lock is held */ | 2254 | /* rtnl lock is held */ |
| 2254 | static void __team_port_change_check(struct team_port *port, bool linkup) | 2255 | |
| 2256 | static void __team_port_change_send(struct team_port *port, bool linkup) | ||
| 2255 | { | 2257 | { |
| 2256 | int err; | 2258 | int err; |
| 2257 | 2259 | ||
| 2258 | if (!port->removed && port->state.linkup == linkup) | ||
| 2259 | return; | ||
| 2260 | |||
| 2261 | port->changed = true; | 2260 | port->changed = true; |
| 2262 | port->state.linkup = linkup; | 2261 | port->state.linkup = linkup; |
| 2263 | team_refresh_port_linkup(port); | 2262 | team_refresh_port_linkup(port); |
| @@ -2282,6 +2281,23 @@ send_event: | |||
| 2282 | 2281 | ||
| 2283 | } | 2282 | } |
| 2284 | 2283 | ||
| 2284 | static void __team_port_change_check(struct team_port *port, bool linkup) | ||
| 2285 | { | ||
| 2286 | if (port->state.linkup != linkup) | ||
| 2287 | __team_port_change_send(port, linkup); | ||
| 2288 | } | ||
| 2289 | |||
| 2290 | static void __team_port_change_port_added(struct team_port *port, bool linkup) | ||
| 2291 | { | ||
| 2292 | __team_port_change_send(port, linkup); | ||
| 2293 | } | ||
| 2294 | |||
| 2295 | static void __team_port_change_port_removed(struct team_port *port) | ||
| 2296 | { | ||
| 2297 | port->removed = true; | ||
| 2298 | __team_port_change_send(port, false); | ||
| 2299 | } | ||
| 2300 | |||
| 2285 | static void team_port_change_check(struct team_port *port, bool linkup) | 2301 | static void team_port_change_check(struct team_port *port, bool linkup) |
| 2286 | { | 2302 | { |
| 2287 | struct team *team = port->team; | 2303 | struct team *team = port->team; |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index f5ab6e613ec8..376143e8a1aa 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
| @@ -1253,6 +1253,7 @@ static struct usb_driver smsc75xx_driver = { | |||
| 1253 | .probe = usbnet_probe, | 1253 | .probe = usbnet_probe, |
| 1254 | .suspend = usbnet_suspend, | 1254 | .suspend = usbnet_suspend, |
| 1255 | .resume = usbnet_resume, | 1255 | .resume = usbnet_resume, |
| 1256 | .reset_resume = usbnet_resume, | ||
| 1256 | .disconnect = usbnet_disconnect, | 1257 | .disconnect = usbnet_disconnect, |
| 1257 | .disable_hub_initiated_lpm = 1, | 1258 | .disable_hub_initiated_lpm = 1, |
| 1258 | }; | 1259 | }; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 1e86ea2266d4..dbeebef562d5 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
| @@ -1442,6 +1442,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
| 1442 | return err; | 1442 | return err; |
| 1443 | 1443 | ||
| 1444 | err_free_irq: | 1444 | err_free_irq: |
| 1445 | trans_pcie->irq_requested = false; | ||
| 1445 | free_irq(trans_pcie->irq, trans); | 1446 | free_irq(trans_pcie->irq, trans); |
| 1446 | error: | 1447 | error: |
| 1447 | iwl_free_isr_ict(trans); | 1448 | iwl_free_isr_ict(trans); |
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c index 6b9af989632b..18d74f29dcb2 100644 --- a/drivers/platform/x86/hp_accel.c +++ b/drivers/platform/x86/hp_accel.c | |||
| @@ -382,31 +382,8 @@ static struct acpi_driver lis3lv02d_driver = { | |||
| 382 | }, | 382 | }, |
| 383 | .drv.pm = HP_ACCEL_PM, | 383 | .drv.pm = HP_ACCEL_PM, |
| 384 | }; | 384 | }; |
| 385 | 385 | module_acpi_driver(lis3lv02d_driver); | |
| 386 | static int __init lis3lv02d_init_module(void) | ||
| 387 | { | ||
| 388 | int ret; | ||
| 389 | |||
| 390 | if (acpi_disabled) | ||
| 391 | return -ENODEV; | ||
| 392 | |||
| 393 | ret = acpi_bus_register_driver(&lis3lv02d_driver); | ||
| 394 | if (ret < 0) | ||
| 395 | return ret; | ||
| 396 | |||
| 397 | pr_info("driver loaded\n"); | ||
| 398 | |||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | |||
| 402 | static void __exit lis3lv02d_exit_module(void) | ||
| 403 | { | ||
| 404 | acpi_bus_unregister_driver(&lis3lv02d_driver); | ||
| 405 | } | ||
| 406 | 386 | ||
| 407 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED."); | 387 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED."); |
| 408 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); | 388 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); |
| 409 | MODULE_LICENSE("GPL"); | 389 | MODULE_LICENSE("GPL"); |
| 410 | |||
| 411 | module_init(lis3lv02d_init_module); | ||
| 412 | module_exit(lis3lv02d_exit_module); | ||
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index dae7abe1d711..5ff4f2e314d2 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
| @@ -917,20 +917,8 @@ static struct acpi_driver ideapad_acpi_driver = { | |||
| 917 | .drv.pm = &ideapad_pm, | 917 | .drv.pm = &ideapad_pm, |
| 918 | .owner = THIS_MODULE, | 918 | .owner = THIS_MODULE, |
| 919 | }; | 919 | }; |
| 920 | 920 | module_acpi_driver(ideapad_acpi_driver); | |
| 921 | static int __init ideapad_acpi_module_init(void) | ||
| 922 | { | ||
| 923 | return acpi_bus_register_driver(&ideapad_acpi_driver); | ||
| 924 | } | ||
| 925 | |||
| 926 | static void __exit ideapad_acpi_module_exit(void) | ||
| 927 | { | ||
| 928 | acpi_bus_unregister_driver(&ideapad_acpi_driver); | ||
| 929 | } | ||
| 930 | 921 | ||
| 931 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | 922 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); |
| 932 | MODULE_DESCRIPTION("IdeaPad ACPI Extras"); | 923 | MODULE_DESCRIPTION("IdeaPad ACPI Extras"); |
| 933 | MODULE_LICENSE("GPL"); | 924 | MODULE_LICENSE("GPL"); |
| 934 | |||
| 935 | module_init(ideapad_acpi_module_init); | ||
| 936 | module_exit(ideapad_acpi_module_exit); | ||
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c index d528daa0e81c..d727bfee89a6 100644 --- a/drivers/platform/x86/topstar-laptop.c +++ b/drivers/platform/x86/topstar-laptop.c | |||
| @@ -186,27 +186,7 @@ static struct acpi_driver acpi_topstar_driver = { | |||
| 186 | .notify = acpi_topstar_notify, | 186 | .notify = acpi_topstar_notify, |
| 187 | }, | 187 | }, |
| 188 | }; | 188 | }; |
| 189 | 189 | module_acpi_driver(acpi_topstar_driver); | |
| 190 | static int __init topstar_laptop_init(void) | ||
| 191 | { | ||
| 192 | int ret; | ||
| 193 | |||
| 194 | ret = acpi_bus_register_driver(&acpi_topstar_driver); | ||
| 195 | if (ret < 0) | ||
| 196 | return ret; | ||
| 197 | |||
| 198 | pr_info("ACPI extras driver loaded\n"); | ||
| 199 | |||
| 200 | return 0; | ||
| 201 | } | ||
| 202 | |||
| 203 | static void __exit topstar_laptop_exit(void) | ||
| 204 | { | ||
| 205 | acpi_bus_unregister_driver(&acpi_topstar_driver); | ||
| 206 | } | ||
| 207 | |||
| 208 | module_init(topstar_laptop_init); | ||
| 209 | module_exit(topstar_laptop_exit); | ||
| 210 | 190 | ||
| 211 | MODULE_AUTHOR("Herton Ronaldo Krzesinski"); | 191 | MODULE_AUTHOR("Herton Ronaldo Krzesinski"); |
| 212 | MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); | 192 | MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); |
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c index 5e5d6317d690..e95be0b74859 100644 --- a/drivers/platform/x86/toshiba_bluetooth.c +++ b/drivers/platform/x86/toshiba_bluetooth.c | |||
| @@ -122,30 +122,10 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device) | |||
| 122 | return result; | 122 | return result; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int __init toshiba_bt_rfkill_init(void) | ||
| 126 | { | ||
| 127 | int result; | ||
| 128 | |||
| 129 | result = acpi_bus_register_driver(&toshiba_bt_rfkill_driver); | ||
| 130 | if (result < 0) { | ||
| 131 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
| 132 | "Error registering driver\n")); | ||
| 133 | return result; | ||
| 134 | } | ||
| 135 | |||
| 136 | return 0; | ||
| 137 | } | ||
| 138 | |||
| 139 | static int toshiba_bt_rfkill_remove(struct acpi_device *device, int type) | 125 | static int toshiba_bt_rfkill_remove(struct acpi_device *device, int type) |
| 140 | { | 126 | { |
| 141 | /* clean up */ | 127 | /* clean up */ |
| 142 | return 0; | 128 | return 0; |
| 143 | } | 129 | } |
| 144 | 130 | ||
| 145 | static void __exit toshiba_bt_rfkill_exit(void) | 131 | module_acpi_driver(toshiba_bt_rfkill_driver); |
| 146 | { | ||
| 147 | acpi_bus_unregister_driver(&toshiba_bt_rfkill_driver); | ||
| 148 | } | ||
| 149 | |||
| 150 | module_init(toshiba_bt_rfkill_init); | ||
| 151 | module_exit(toshiba_bt_rfkill_exit); | ||
diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c index 38ba39d7ca7d..16d340c3b852 100644 --- a/drivers/platform/x86/xo15-ebook.c +++ b/drivers/platform/x86/xo15-ebook.c | |||
| @@ -170,16 +170,4 @@ static struct acpi_driver xo15_ebook_driver = { | |||
| 170 | }, | 170 | }, |
| 171 | .drv.pm = &ebook_switch_pm, | 171 | .drv.pm = &ebook_switch_pm, |
| 172 | }; | 172 | }; |
| 173 | 173 | module_acpi_driver(xo15_ebook_driver); | |
| 174 | static int __init xo15_ebook_init(void) | ||
| 175 | { | ||
| 176 | return acpi_bus_register_driver(&xo15_ebook_driver); | ||
| 177 | } | ||
| 178 | |||
| 179 | static void __exit xo15_ebook_exit(void) | ||
| 180 | { | ||
| 181 | acpi_bus_unregister_driver(&xo15_ebook_driver); | ||
| 182 | } | ||
| 183 | |||
| 184 | module_init(xo15_ebook_init); | ||
| 185 | module_exit(xo15_ebook_exit); | ||
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 507a8e2b9a4c..26b5d4b18dd7 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
| @@ -321,14 +321,9 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp) | |||
| 321 | { | 321 | { |
| 322 | struct acpi_device *acpi = to_acpi_device(dev); | 322 | struct acpi_device *acpi = to_acpi_device(dev); |
| 323 | struct pnp_dev *pnp = _pnp; | 323 | struct pnp_dev *pnp = _pnp; |
| 324 | struct device *physical_device; | ||
| 325 | |||
| 326 | physical_device = acpi_get_physical_device(acpi->handle); | ||
| 327 | if (physical_device) | ||
| 328 | put_device(physical_device); | ||
| 329 | 324 | ||
| 330 | /* true means it matched */ | 325 | /* true means it matched */ |
| 331 | return !physical_device | 326 | return !acpi->physical_node_count |
| 332 | && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); | 327 | && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); |
| 333 | } | 328 | } |
| 334 | 329 | ||
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c index a3ac39b79192..0646bf6e7889 100644 --- a/drivers/sh/pfc/pinctrl.c +++ b/drivers/sh/pfc/pinctrl.c | |||
| @@ -208,6 +208,8 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | |||
| 208 | 208 | ||
| 209 | break; | 209 | break; |
| 210 | case PINMUX_TYPE_GPIO: | 210 | case PINMUX_TYPE_GPIO: |
| 211 | case PINMUX_TYPE_INPUT: | ||
| 212 | case PINMUX_TYPE_OUTPUT: | ||
| 211 | break; | 213 | break; |
| 212 | default: | 214 | default: |
| 213 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); | 215 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index d95696584762..3440812b4a84 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
| @@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, | |||
| 624 | /* print devices for all busses */ | 624 | /* print devices for all busses */ |
| 625 | list_for_each_entry(bus, &usb_bus_list, bus_list) { | 625 | list_for_each_entry(bus, &usb_bus_list, bus_list) { |
| 626 | /* recurse through all children of the root hub */ | 626 | /* recurse through all children of the root hub */ |
| 627 | if (!bus->root_hub) | 627 | if (!bus_to_hcd(bus)->rh_registered) |
| 628 | continue; | 628 | continue; |
| 629 | usb_lock_device(bus->root_hub); | 629 | usb_lock_device(bus->root_hub); |
| 630 | ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, | 630 | ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bc84106ac057..75ba2091f9b4 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -1011,10 +1011,7 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
| 1011 | if (retval) { | 1011 | if (retval) { |
| 1012 | dev_err (parent_dev, "can't register root hub for %s, %d\n", | 1012 | dev_err (parent_dev, "can't register root hub for %s, %d\n", |
| 1013 | dev_name(&usb_dev->dev), retval); | 1013 | dev_name(&usb_dev->dev), retval); |
| 1014 | } | 1014 | } else { |
| 1015 | mutex_unlock(&usb_bus_list_lock); | ||
| 1016 | |||
| 1017 | if (retval == 0) { | ||
| 1018 | spin_lock_irq (&hcd_root_hub_lock); | 1015 | spin_lock_irq (&hcd_root_hub_lock); |
| 1019 | hcd->rh_registered = 1; | 1016 | hcd->rh_registered = 1; |
| 1020 | spin_unlock_irq (&hcd_root_hub_lock); | 1017 | spin_unlock_irq (&hcd_root_hub_lock); |
| @@ -1023,6 +1020,7 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
| 1023 | if (HCD_DEAD(hcd)) | 1020 | if (HCD_DEAD(hcd)) |
| 1024 | usb_hc_died (hcd); /* This time clean up */ | 1021 | usb_hc_died (hcd); /* This time clean up */ |
| 1025 | } | 1022 | } |
| 1023 | mutex_unlock(&usb_bus_list_lock); | ||
| 1026 | 1024 | ||
| 1027 | return retval; | 1025 | return retval; |
| 1028 | } | 1026 | } |
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 8947b203d5a4..ce45f5535236 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c | |||
| @@ -52,18 +52,19 @@ out: | |||
| 52 | static int usb_acpi_check_pld(struct usb_device *udev, acpi_handle handle) | 52 | static int usb_acpi_check_pld(struct usb_device *udev, acpi_handle handle) |
| 53 | { | 53 | { |
| 54 | acpi_status status; | 54 | acpi_status status; |
| 55 | struct acpi_pld pld; | 55 | struct acpi_pld_info *pld; |
| 56 | 56 | ||
| 57 | status = acpi_get_physical_device_location(handle, &pld); | 57 | status = acpi_get_physical_device_location(handle, &pld); |
| 58 | 58 | ||
| 59 | if (ACPI_FAILURE(status)) | 59 | if (ACPI_FAILURE(status)) |
| 60 | return -ENODEV; | 60 | return -ENODEV; |
| 61 | 61 | ||
| 62 | if (pld.user_visible) | 62 | if (pld->user_visible) |
| 63 | udev->removable = USB_DEVICE_REMOVABLE; | 63 | udev->removable = USB_DEVICE_REMOVABLE; |
| 64 | else | 64 | else |
| 65 | udev->removable = USB_DEVICE_FIXED; | 65 | udev->removable = USB_DEVICE_FIXED; |
| 66 | 66 | ||
| 67 | ACPI_FREE(pld); | ||
| 67 | return 0; | 68 | return 0; |
| 68 | } | 69 | } |
| 69 | 70 | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index aaa8d2bce217..0bf72f943b00 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
| @@ -467,7 +467,8 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
| 467 | /* From the GPIO notifying the over-current situation, find | 467 | /* From the GPIO notifying the over-current situation, find |
| 468 | * out the corresponding port */ | 468 | * out the corresponding port */ |
| 469 | at91_for_each_port(port) { | 469 | at91_for_each_port(port) { |
| 470 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | 470 | if (gpio_is_valid(pdata->overcurrent_pin[port]) && |
| 471 | gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | ||
| 471 | gpio = pdata->overcurrent_pin[port]; | 472 | gpio = pdata->overcurrent_pin[port]; |
| 472 | break; | 473 | break; |
| 473 | } | 474 | } |
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 211a4920b88a..d8dedc7d3910 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
| @@ -76,9 +76,24 @@ static int virqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key) | |||
| 76 | schedule_work(&virqfd->inject); | 76 | schedule_work(&virqfd->inject); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | if (flags & POLLHUP) | 79 | if (flags & POLLHUP) { |
| 80 | /* The eventfd is closing, detach from VFIO */ | 80 | unsigned long flags; |
| 81 | virqfd_deactivate(virqfd); | 81 | spin_lock_irqsave(&virqfd->vdev->irqlock, flags); |
| 82 | |||
| 83 | /* | ||
| 84 | * The eventfd is closing, if the virqfd has not yet been | ||
| 85 | * queued for release, as determined by testing whether the | ||
| 86 | * vdev pointer to it is still valid, queue it now. As | ||
| 87 | * with kvm irqfds, we know we won't race against the virqfd | ||
| 88 | * going away because we hold wqh->lock to get here. | ||
| 89 | */ | ||
| 90 | if (*(virqfd->pvirqfd) == virqfd) { | ||
| 91 | *(virqfd->pvirqfd) = NULL; | ||
| 92 | virqfd_deactivate(virqfd); | ||
| 93 | } | ||
| 94 | |||
| 95 | spin_unlock_irqrestore(&virqfd->vdev->irqlock, flags); | ||
| 96 | } | ||
| 82 | 97 | ||
| 83 | return 0; | 98 | return 0; |
| 84 | } | 99 | } |
| @@ -93,7 +108,6 @@ static void virqfd_ptable_queue_proc(struct file *file, | |||
| 93 | static void virqfd_shutdown(struct work_struct *work) | 108 | static void virqfd_shutdown(struct work_struct *work) |
| 94 | { | 109 | { |
| 95 | struct virqfd *virqfd = container_of(work, struct virqfd, shutdown); | 110 | struct virqfd *virqfd = container_of(work, struct virqfd, shutdown); |
| 96 | struct virqfd **pvirqfd = virqfd->pvirqfd; | ||
| 97 | u64 cnt; | 111 | u64 cnt; |
| 98 | 112 | ||
| 99 | eventfd_ctx_remove_wait_queue(virqfd->eventfd, &virqfd->wait, &cnt); | 113 | eventfd_ctx_remove_wait_queue(virqfd->eventfd, &virqfd->wait, &cnt); |
| @@ -101,7 +115,6 @@ static void virqfd_shutdown(struct work_struct *work) | |||
| 101 | eventfd_ctx_put(virqfd->eventfd); | 115 | eventfd_ctx_put(virqfd->eventfd); |
| 102 | 116 | ||
| 103 | kfree(virqfd); | 117 | kfree(virqfd); |
| 104 | *pvirqfd = NULL; | ||
| 105 | } | 118 | } |
| 106 | 119 | ||
| 107 | static void virqfd_inject(struct work_struct *work) | 120 | static void virqfd_inject(struct work_struct *work) |
| @@ -122,15 +135,11 @@ static int virqfd_enable(struct vfio_pci_device *vdev, | |||
| 122 | int ret = 0; | 135 | int ret = 0; |
| 123 | unsigned int events; | 136 | unsigned int events; |
| 124 | 137 | ||
| 125 | if (*pvirqfd) | ||
| 126 | return -EBUSY; | ||
| 127 | |||
| 128 | virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL); | 138 | virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL); |
| 129 | if (!virqfd) | 139 | if (!virqfd) |
| 130 | return -ENOMEM; | 140 | return -ENOMEM; |
| 131 | 141 | ||
| 132 | virqfd->pvirqfd = pvirqfd; | 142 | virqfd->pvirqfd = pvirqfd; |
| 133 | *pvirqfd = virqfd; | ||
| 134 | virqfd->vdev = vdev; | 143 | virqfd->vdev = vdev; |
| 135 | virqfd->handler = handler; | 144 | virqfd->handler = handler; |
| 136 | virqfd->thread = thread; | 145 | virqfd->thread = thread; |
| @@ -154,6 +163,23 @@ static int virqfd_enable(struct vfio_pci_device *vdev, | |||
| 154 | virqfd->eventfd = ctx; | 163 | virqfd->eventfd = ctx; |
| 155 | 164 | ||
| 156 | /* | 165 | /* |
| 166 | * virqfds can be released by closing the eventfd or directly | ||
| 167 | * through ioctl. These are both done through a workqueue, so | ||
| 168 | * we update the pointer to the virqfd under lock to avoid | ||
| 169 | * pushing multiple jobs to release the same virqfd. | ||
| 170 | */ | ||
| 171 | spin_lock_irq(&vdev->irqlock); | ||
| 172 | |||
| 173 | if (*pvirqfd) { | ||
| 174 | spin_unlock_irq(&vdev->irqlock); | ||
| 175 | ret = -EBUSY; | ||
| 176 | goto fail; | ||
| 177 | } | ||
| 178 | *pvirqfd = virqfd; | ||
| 179 | |||
| 180 | spin_unlock_irq(&vdev->irqlock); | ||
| 181 | |||
| 182 | /* | ||
| 157 | * Install our own custom wake-up handling so we are notified via | 183 | * Install our own custom wake-up handling so we are notified via |
| 158 | * a callback whenever someone signals the underlying eventfd. | 184 | * a callback whenever someone signals the underlying eventfd. |
| 159 | */ | 185 | */ |
| @@ -187,19 +213,29 @@ fail: | |||
| 187 | fput(file); | 213 | fput(file); |
| 188 | 214 | ||
| 189 | kfree(virqfd); | 215 | kfree(virqfd); |
| 190 | *pvirqfd = NULL; | ||
| 191 | 216 | ||
| 192 | return ret; | 217 | return ret; |
| 193 | } | 218 | } |
| 194 | 219 | ||
| 195 | static void virqfd_disable(struct virqfd *virqfd) | 220 | static void virqfd_disable(struct vfio_pci_device *vdev, |
| 221 | struct virqfd **pvirqfd) | ||
| 196 | { | 222 | { |
| 197 | if (!virqfd) | 223 | unsigned long flags; |
| 198 | return; | 224 | |
| 225 | spin_lock_irqsave(&vdev->irqlock, flags); | ||
| 226 | |||
| 227 | if (*pvirqfd) { | ||
| 228 | virqfd_deactivate(*pvirqfd); | ||
| 229 | *pvirqfd = NULL; | ||
| 230 | } | ||
| 199 | 231 | ||
| 200 | virqfd_deactivate(virqfd); | 232 | spin_unlock_irqrestore(&vdev->irqlock, flags); |
| 201 | 233 | ||
| 202 | /* Block until we know all outstanding shutdown jobs have completed. */ | 234 | /* |
| 235 | * Block until we know all outstanding shutdown jobs have completed. | ||
| 236 | * Even if we don't queue the job, flush the wq to be sure it's | ||
| 237 | * been released. | ||
| 238 | */ | ||
| 203 | flush_workqueue(vfio_irqfd_cleanup_wq); | 239 | flush_workqueue(vfio_irqfd_cleanup_wq); |
| 204 | } | 240 | } |
| 205 | 241 | ||
| @@ -392,8 +428,8 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd) | |||
| 392 | static void vfio_intx_disable(struct vfio_pci_device *vdev) | 428 | static void vfio_intx_disable(struct vfio_pci_device *vdev) |
| 393 | { | 429 | { |
| 394 | vfio_intx_set_signal(vdev, -1); | 430 | vfio_intx_set_signal(vdev, -1); |
| 395 | virqfd_disable(vdev->ctx[0].unmask); | 431 | virqfd_disable(vdev, &vdev->ctx[0].unmask); |
| 396 | virqfd_disable(vdev->ctx[0].mask); | 432 | virqfd_disable(vdev, &vdev->ctx[0].mask); |
| 397 | vdev->irq_type = VFIO_PCI_NUM_IRQS; | 433 | vdev->irq_type = VFIO_PCI_NUM_IRQS; |
| 398 | vdev->num_ctx = 0; | 434 | vdev->num_ctx = 0; |
| 399 | kfree(vdev->ctx); | 435 | kfree(vdev->ctx); |
| @@ -539,8 +575,8 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix) | |||
| 539 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); | 575 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); |
| 540 | 576 | ||
| 541 | for (i = 0; i < vdev->num_ctx; i++) { | 577 | for (i = 0; i < vdev->num_ctx; i++) { |
| 542 | virqfd_disable(vdev->ctx[i].unmask); | 578 | virqfd_disable(vdev, &vdev->ctx[i].unmask); |
| 543 | virqfd_disable(vdev->ctx[i].mask); | 579 | virqfd_disable(vdev, &vdev->ctx[i].mask); |
| 544 | } | 580 | } |
| 545 | 581 | ||
| 546 | if (msix) { | 582 | if (msix) { |
| @@ -577,7 +613,7 @@ static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev, | |||
| 577 | vfio_send_intx_eventfd, NULL, | 613 | vfio_send_intx_eventfd, NULL, |
| 578 | &vdev->ctx[0].unmask, fd); | 614 | &vdev->ctx[0].unmask, fd); |
| 579 | 615 | ||
| 580 | virqfd_disable(vdev->ctx[0].unmask); | 616 | virqfd_disable(vdev, &vdev->ctx[0].unmask); |
| 581 | } | 617 | } |
| 582 | 618 | ||
| 583 | return 0; | 619 | return 0; |
diff --git a/fs/dcache.c b/fs/dcache.c index 16521a9f2038..693f95bf1cae 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -1134,6 +1134,8 @@ positive: | |||
| 1134 | return 1; | 1134 | return 1; |
| 1135 | 1135 | ||
| 1136 | rename_retry: | 1136 | rename_retry: |
| 1137 | if (locked) | ||
| 1138 | goto again; | ||
| 1137 | locked = 1; | 1139 | locked = 1; |
| 1138 | write_seqlock(&rename_lock); | 1140 | write_seqlock(&rename_lock); |
| 1139 | goto again; | 1141 | goto again; |
| @@ -1141,7 +1143,7 @@ rename_retry: | |||
| 1141 | EXPORT_SYMBOL(have_submounts); | 1143 | EXPORT_SYMBOL(have_submounts); |
| 1142 | 1144 | ||
| 1143 | /* | 1145 | /* |
| 1144 | * Search the dentry child list for the specified parent, | 1146 | * Search the dentry child list of the specified parent, |
| 1145 | * and move any unused dentries to the end of the unused | 1147 | * and move any unused dentries to the end of the unused |
| 1146 | * list for prune_dcache(). We descend to the next level | 1148 | * list for prune_dcache(). We descend to the next level |
| 1147 | * whenever the d_subdirs list is non-empty and continue | 1149 | * whenever the d_subdirs list is non-empty and continue |
| @@ -1236,6 +1238,8 @@ out: | |||
| 1236 | rename_retry: | 1238 | rename_retry: |
| 1237 | if (found) | 1239 | if (found) |
| 1238 | return found; | 1240 | return found; |
| 1241 | if (locked) | ||
| 1242 | goto again; | ||
| 1239 | locked = 1; | 1243 | locked = 1; |
| 1240 | write_seqlock(&rename_lock); | 1244 | write_seqlock(&rename_lock); |
| 1241 | goto again; | 1245 | goto again; |
| @@ -3035,6 +3039,8 @@ resume: | |||
| 3035 | return; | 3039 | return; |
| 3036 | 3040 | ||
| 3037 | rename_retry: | 3041 | rename_retry: |
| 3042 | if (locked) | ||
| 3043 | goto again; | ||
| 3038 | locked = 1; | 3044 | locked = 1; |
| 3039 | write_seqlock(&rename_lock); | 3045 | write_seqlock(&rename_lock); |
| 3040 | goto again; | 3046 | goto again; |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index fb1a2bedbe97..8d80c990dffd 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
| @@ -289,7 +289,6 @@ static void nlmsvc_free_block(struct kref *kref) | |||
| 289 | dprintk("lockd: freeing block %p...\n", block); | 289 | dprintk("lockd: freeing block %p...\n", block); |
| 290 | 290 | ||
| 291 | /* Remove block from file's list of blocks */ | 291 | /* Remove block from file's list of blocks */ |
| 292 | mutex_lock(&file->f_mutex); | ||
| 293 | list_del_init(&block->b_flist); | 292 | list_del_init(&block->b_flist); |
| 294 | mutex_unlock(&file->f_mutex); | 293 | mutex_unlock(&file->f_mutex); |
| 295 | 294 | ||
| @@ -303,7 +302,7 @@ static void nlmsvc_free_block(struct kref *kref) | |||
| 303 | static void nlmsvc_release_block(struct nlm_block *block) | 302 | static void nlmsvc_release_block(struct nlm_block *block) |
| 304 | { | 303 | { |
| 305 | if (block != NULL) | 304 | if (block != NULL) |
| 306 | kref_put(&block->b_count, nlmsvc_free_block); | 305 | kref_put_mutex(&block->b_count, nlmsvc_free_block, &block->b_file->f_mutex); |
| 307 | } | 306 | } |
| 308 | 307 | ||
| 309 | /* | 308 | /* |
diff --git a/fs/namespace.c b/fs/namespace.c index 4d31f73e2561..7bdf7907413f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
| @@ -1886,8 +1886,14 @@ static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) | |||
| 1886 | return err; | 1886 | return err; |
| 1887 | 1887 | ||
| 1888 | err = -EINVAL; | 1888 | err = -EINVAL; |
| 1889 | if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(real_mount(path->mnt))) | 1889 | if (unlikely(!check_mnt(real_mount(path->mnt)))) { |
| 1890 | goto unlock; | 1890 | /* that's acceptable only for automounts done in private ns */ |
| 1891 | if (!(mnt_flags & MNT_SHRINKABLE)) | ||
| 1892 | goto unlock; | ||
| 1893 | /* ... and for those we'd better have mountpoint still alive */ | ||
| 1894 | if (!real_mount(path->mnt)->mnt_ns) | ||
| 1895 | goto unlock; | ||
| 1896 | } | ||
| 1891 | 1897 | ||
| 1892 | /* Refuse the same filesystem on the same mount point */ | 1898 | /* Refuse the same filesystem on the same mount point */ |
| 1893 | err = -EBUSY; | 1899 | err = -EBUSY; |
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h new file mode 100644 index 000000000000..a1e45cdd729a --- /dev/null +++ b/include/acpi/acbuffer.h | |||
| @@ -0,0 +1,235 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Name: acbuffer.h - Support for buffers returned by ACPI predefined names | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions, and the following disclaimer, | ||
| 16 | * without modification. | ||
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 20 | * including a substantially similar Disclaimer requirement for further | ||
| 21 | * binary redistribution. | ||
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 23 | * of any contributors may be used to endorse or promote products derived | ||
| 24 | * from this software without specific prior written permission. | ||
| 25 | * | ||
| 26 | * Alternatively, this software may be distributed under the terms of the | ||
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 28 | * Software Foundation. | ||
| 29 | * | ||
| 30 | * NO WARRANTY | ||
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #ifndef __ACBUFFER_H__ | ||
| 45 | #define __ACBUFFER_H__ | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Contains buffer structures for these predefined names: | ||
| 49 | * _FDE, _GRT, _GTM, _PLD, _SRT | ||
| 50 | */ | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Note: C bitfields are not used for this reason: | ||
| 54 | * | ||
| 55 | * "Bitfields are great and easy to read, but unfortunately the C language | ||
| 56 | * does not specify the layout of bitfields in memory, which means they are | ||
| 57 | * essentially useless for dealing with packed data in on-disk formats or | ||
| 58 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
| 59 | * this decision was a design error in C. Ritchie could have picked an order | ||
| 60 | * and stuck with it." Norman Ramsey. | ||
| 61 | * See http://stackoverflow.com/a/1053662/41661 | ||
| 62 | */ | ||
| 63 | |||
| 64 | /* _FDE return value */ | ||
| 65 | |||
| 66 | struct acpi_fde_info { | ||
| 67 | u32 floppy0; | ||
| 68 | u32 floppy1; | ||
| 69 | u32 floppy2; | ||
| 70 | u32 floppy3; | ||
| 71 | u32 tape; | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * _GRT return value | ||
| 76 | * _SRT input value | ||
| 77 | */ | ||
| 78 | struct acpi_grt_info { | ||
| 79 | u16 year; | ||
| 80 | u8 month; | ||
| 81 | u8 day; | ||
| 82 | u8 hour; | ||
| 83 | u8 minute; | ||
| 84 | u8 second; | ||
| 85 | u8 valid; | ||
| 86 | u16 milliseconds; | ||
| 87 | u16 timezone; | ||
| 88 | u8 daylight; | ||
| 89 | u8 reserved[3]; | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* _GTM return value */ | ||
| 93 | |||
| 94 | struct acpi_gtm_info { | ||
| 95 | u32 pio_speed0; | ||
| 96 | u32 dma_speed0; | ||
| 97 | u32 pio_speed1; | ||
| 98 | u32 dma_speed1; | ||
| 99 | u32 flags; | ||
| 100 | }; | ||
| 101 | |||
| 102 | /* | ||
| 103 | * Formatted _PLD return value. The minimum size is a package containing | ||
| 104 | * one buffer. | ||
| 105 | * Revision 1: Buffer is 16 bytes (128 bits) | ||
| 106 | * Revision 2: Buffer is 20 bytes (160 bits) | ||
| 107 | * | ||
| 108 | * Note: This structure is returned from the acpi_decode_pld_buffer | ||
| 109 | * interface. | ||
| 110 | */ | ||
| 111 | struct acpi_pld_info { | ||
| 112 | u8 revision; | ||
| 113 | u8 ignore_color; | ||
| 114 | u32 color; | ||
| 115 | u16 width; | ||
| 116 | u16 height; | ||
| 117 | u8 user_visible; | ||
| 118 | u8 dock; | ||
| 119 | u8 lid; | ||
| 120 | u8 panel; | ||
| 121 | u8 vertical_position; | ||
| 122 | u8 horizontal_position; | ||
| 123 | u8 shape; | ||
| 124 | u8 group_orientation; | ||
| 125 | u8 group_token; | ||
| 126 | u8 group_position; | ||
| 127 | u8 bay; | ||
| 128 | u8 ejectable; | ||
| 129 | u8 ospm_eject_required; | ||
| 130 | u8 cabinet_number; | ||
| 131 | u8 card_cage_number; | ||
| 132 | u8 reference; | ||
| 133 | u8 rotation; | ||
| 134 | u8 order; | ||
| 135 | u8 reserved; | ||
| 136 | u16 vertical_offset; | ||
| 137 | u16 horizontal_offset; | ||
| 138 | }; | ||
| 139 | |||
| 140 | /* | ||
| 141 | * Macros to: | ||
| 142 | * 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET* | ||
| 143 | * (Used by acpi_decode_pld_buffer) | ||
| 144 | * 2) Construct a _PLD buffer - ACPI_PLD_SET* | ||
| 145 | * (Intended for BIOS use only) | ||
| 146 | */ | ||
| 147 | #define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ | ||
| 148 | #define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ | ||
| 149 | |||
| 150 | /* First 32-bit dword, bits 0:32 */ | ||
| 151 | |||
| 152 | #define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) | ||
| 153 | #define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ | ||
| 154 | |||
| 155 | #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) | ||
| 156 | #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ | ||
| 157 | |||
| 158 | #define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) | ||
| 159 | #define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ | ||
| 160 | |||
| 161 | /* Second 32-bit dword, bits 33:63 */ | ||
| 162 | |||
| 163 | #define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) | ||
| 164 | #define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ | ||
| 165 | |||
| 166 | #define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) | ||
| 167 | #define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ | ||
| 168 | |||
| 169 | /* Third 32-bit dword, bits 64:95 */ | ||
| 170 | |||
| 171 | #define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) | ||
| 172 | #define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ | ||
| 173 | |||
| 174 | #define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) | ||
| 175 | #define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ | ||
| 176 | |||
| 177 | #define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) | ||
| 178 | #define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ | ||
| 179 | |||
| 180 | #define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) | ||
| 181 | #define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ | ||
| 182 | |||
| 183 | #define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) | ||
| 184 | #define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ | ||
| 185 | |||
| 186 | #define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) | ||
| 187 | #define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ | ||
| 188 | |||
| 189 | #define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) | ||
| 190 | #define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ | ||
| 191 | |||
| 192 | #define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) | ||
| 193 | #define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ | ||
| 194 | |||
| 195 | #define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) | ||
| 196 | #define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ | ||
| 197 | |||
| 198 | #define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) | ||
| 199 | #define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ | ||
| 200 | |||
| 201 | #define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) | ||
| 202 | #define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ | ||
| 203 | |||
| 204 | /* Fourth 32-bit dword, bits 96:127 */ | ||
| 205 | |||
| 206 | #define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) | ||
| 207 | #define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ | ||
| 208 | |||
| 209 | #define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) | ||
| 210 | #define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ | ||
| 211 | |||
| 212 | #define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) | ||
| 213 | #define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ | ||
| 214 | |||
| 215 | #define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) | ||
| 216 | #define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ | ||
| 217 | |||
| 218 | #define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) | ||
| 219 | #define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ | ||
| 220 | |||
| 221 | #define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) | ||
| 222 | #define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ | ||
| 223 | |||
| 224 | #define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) | ||
| 225 | #define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ | ||
| 226 | |||
| 227 | /* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ | ||
| 228 | |||
| 229 | #define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) | ||
| 230 | #define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ | ||
| 231 | |||
| 232 | #define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) | ||
| 233 | #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ | ||
| 234 | |||
| 235 | #endif /* ACBUFFER_H */ | ||
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index d988ac54f41e..745dd24e3cb5 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
| @@ -63,11 +63,10 @@ | |||
| 63 | #define METHOD_NAME__PRW "_PRW" | 63 | #define METHOD_NAME__PRW "_PRW" |
| 64 | #define METHOD_NAME__SRS "_SRS" | 64 | #define METHOD_NAME__SRS "_SRS" |
| 65 | #define METHOD_NAME__CBA "_CBA" | 65 | #define METHOD_NAME__CBA "_CBA" |
| 66 | #define METHOD_NAME__PLD "_PLD" | ||
| 66 | 67 | ||
| 67 | /* Method names - these methods must appear at the namespace root */ | 68 | /* Method names - these methods must appear at the namespace root */ |
| 68 | 69 | ||
| 69 | #define METHOD_PATHNAME__BFS "\\_BFS" | ||
| 70 | #define METHOD_PATHNAME__GTS "\\_GTS" | ||
| 71 | #define METHOD_PATHNAME__PTS "\\_PTS" | 70 | #define METHOD_PATHNAME__PTS "\\_PTS" |
| 72 | #define METHOD_PATHNAME__SST "\\_SI._SST" | 71 | #define METHOD_PATHNAME__SST "\\_SI._SST" |
| 73 | #define METHOD_PATHNAME__WAK "\\_WAK" | 72 | #define METHOD_PATHNAME__WAK "\\_WAK" |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 3eb9de318824..0daa0fbd8654 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -54,37 +54,8 @@ acpi_status | |||
| 54 | acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | 54 | acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, |
| 55 | u32 status_code, struct acpi_buffer *status_buf); | 55 | u32 status_code, struct acpi_buffer *status_buf); |
| 56 | 56 | ||
| 57 | struct acpi_pld { | ||
| 58 | unsigned int revision:7; /* 0 */ | ||
| 59 | unsigned int ignore_colour:1; /* 7 */ | ||
| 60 | unsigned int colour:24; /* 8 */ | ||
| 61 | unsigned int width:16; /* 32 */ | ||
| 62 | unsigned int height:16; /* 48 */ | ||
| 63 | unsigned int user_visible:1; /* 64 */ | ||
| 64 | unsigned int dock:1; /* 65 */ | ||
| 65 | unsigned int lid:1; /* 66 */ | ||
| 66 | unsigned int panel:3; /* 67 */ | ||
| 67 | unsigned int vertical_pos:2; /* 70 */ | ||
| 68 | unsigned int horizontal_pos:2; /* 72 */ | ||
| 69 | unsigned int shape:4; /* 74 */ | ||
| 70 | unsigned int group_orientation:1; /* 78 */ | ||
| 71 | unsigned int group_token:8; /* 79 */ | ||
| 72 | unsigned int group_position:8; /* 87 */ | ||
| 73 | unsigned int bay:1; /* 95 */ | ||
| 74 | unsigned int ejectable:1; /* 96 */ | ||
| 75 | unsigned int ospm_eject_required:1; /* 97 */ | ||
| 76 | unsigned int cabinet_number:8; /* 98 */ | ||
| 77 | unsigned int card_cage_number:8; /* 106 */ | ||
| 78 | unsigned int reference:1; /* 114 */ | ||
| 79 | unsigned int rotation:4; /* 115 */ | ||
| 80 | unsigned int order:5; /* 119 */ | ||
| 81 | unsigned int reserved:4; /* 124 */ | ||
| 82 | unsigned int vertical_offset:16; /* 128 */ | ||
| 83 | unsigned int horizontal_offset:16; /* 144 */ | ||
| 84 | } __attribute__((__packed__)); | ||
| 85 | |||
| 86 | acpi_status | 57 | acpi_status |
| 87 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld); | 58 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); |
| 88 | #ifdef CONFIG_ACPI | 59 | #ifdef CONFIG_ACPI |
| 89 | 60 | ||
| 90 | #include <linux/proc_fs.h> | 61 | #include <linux/proc_fs.h> |
| @@ -283,8 +254,16 @@ struct acpi_device_wakeup { | |||
| 283 | int prepare_count; | 254 | int prepare_count; |
| 284 | }; | 255 | }; |
| 285 | 256 | ||
| 286 | /* Device */ | 257 | struct acpi_device_physical_node { |
| 258 | u8 node_id; | ||
| 259 | struct list_head node; | ||
| 260 | struct device *dev; | ||
| 261 | }; | ||
| 262 | |||
| 263 | /* set maximum of physical nodes to 32 for expansibility */ | ||
| 264 | #define ACPI_MAX_PHYSICAL_NODE 32 | ||
| 287 | 265 | ||
| 266 | /* Device */ | ||
| 288 | struct acpi_device { | 267 | struct acpi_device { |
| 289 | int device_type; | 268 | int device_type; |
| 290 | acpi_handle handle; /* no handle for fixed hardware */ | 269 | acpi_handle handle; /* no handle for fixed hardware */ |
| @@ -305,6 +284,10 @@ struct acpi_device { | |||
| 305 | struct device dev; | 284 | struct device dev; |
| 306 | struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */ | 285 | struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */ |
| 307 | enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ | 286 | enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ |
| 287 | u8 physical_node_count; | ||
| 288 | struct list_head physical_node_list; | ||
| 289 | struct mutex physical_node_lock; | ||
| 290 | DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); | ||
| 308 | }; | 291 | }; |
| 309 | 292 | ||
| 310 | static inline void *acpi_driver_data(struct acpi_device *d) | 293 | static inline void *acpi_driver_data(struct acpi_device *d) |
| @@ -382,6 +365,19 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
| 382 | int acpi_create_dir(struct acpi_device *); | 365 | int acpi_create_dir(struct acpi_device *); |
| 383 | void acpi_remove_dir(struct acpi_device *); | 366 | void acpi_remove_dir(struct acpi_device *); |
| 384 | 367 | ||
| 368 | |||
| 369 | /** | ||
| 370 | * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver | ||
| 371 | * @__acpi_driver: acpi_driver struct | ||
| 372 | * | ||
| 373 | * Helper macro for ACPI drivers which do not do anything special in module | ||
| 374 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 375 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 376 | */ | ||
| 377 | #define module_acpi_driver(__acpi_driver) \ | ||
| 378 | module_driver(__acpi_driver, acpi_bus_register_driver, \ | ||
| 379 | acpi_bus_unregister_driver) | ||
| 380 | |||
| 385 | /* | 381 | /* |
| 386 | * Bind physical devices with ACPI devices | 382 | * Bind physical devices with ACPI devices |
| 387 | */ | 383 | */ |
| @@ -395,7 +391,6 @@ struct acpi_bus_type { | |||
| 395 | }; | 391 | }; |
| 396 | int register_acpi_bus_type(struct acpi_bus_type *); | 392 | int register_acpi_bus_type(struct acpi_bus_type *); |
| 397 | int unregister_acpi_bus_type(struct acpi_bus_type *); | 393 | int unregister_acpi_bus_type(struct acpi_bus_type *); |
| 398 | struct device *acpi_get_physical_device(acpi_handle); | ||
| 399 | 394 | ||
| 400 | struct acpi_pci_root { | 395 | struct acpi_pci_root { |
| 401 | struct list_head node; | 396 | struct list_head node; |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 26a92fc28a59..267bfc4b26a9 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -47,11 +47,12 @@ | |||
| 47 | 47 | ||
| 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
| 49 | 49 | ||
| 50 | #define ACPI_CA_VERSION 0x20120711 | 50 | #define ACPI_CA_VERSION 0x20120913 |
| 51 | 51 | ||
| 52 | #include "acconfig.h" | 52 | #include "acconfig.h" |
| 53 | #include "actypes.h" | 53 | #include "actypes.h" |
| 54 | #include "actbl.h" | 54 | #include "actbl.h" |
| 55 | #include "acbuffer.h" | ||
| 55 | 56 | ||
| 56 | extern u8 acpi_gbl_permanent_mmap; | 57 | extern u8 acpi_gbl_permanent_mmap; |
| 57 | 58 | ||
| @@ -144,6 +145,10 @@ acpi_check_address_range(acpi_adr_space_type space_id, | |||
| 144 | acpi_physical_address address, | 145 | acpi_physical_address address, |
| 145 | acpi_size length, u8 warn); | 146 | acpi_size length, u8 warn); |
| 146 | 147 | ||
| 148 | acpi_status | ||
| 149 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
| 150 | acpi_size length, struct acpi_pld_info **return_buffer); | ||
| 151 | |||
| 147 | /* | 152 | /* |
| 148 | * ACPI Memory management | 153 | * ACPI Memory management |
| 149 | */ | 154 | */ |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 59a73e1b2845..4f94b1d812d5 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
| @@ -79,9 +79,15 @@ | |||
| 79 | #pragma pack(1) | 79 | #pragma pack(1) |
| 80 | 80 | ||
| 81 | /* | 81 | /* |
| 82 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 82 | * Note: C bitfields are not used for this reason: |
| 83 | * This is the only type that is even remotely portable. Anything else is not | 83 | * |
| 84 | * portable, so do not use any other bitfield types. | 84 | * "Bitfields are great and easy to read, but unfortunately the C language |
| 85 | * does not specify the layout of bitfields in memory, which means they are | ||
| 86 | * essentially useless for dealing with packed data in on-disk formats or | ||
| 87 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
| 88 | * this decision was a design error in C. Ritchie could have picked an order | ||
| 89 | * and stuck with it." Norman Ramsey. | ||
| 90 | * See http://stackoverflow.com/a/1053662/41661 | ||
| 85 | */ | 91 | */ |
| 86 | 92 | ||
| 87 | /******************************************************************************* | 93 | /******************************************************************************* |
| @@ -94,7 +100,7 @@ | |||
| 94 | struct acpi_table_header { | 100 | struct acpi_table_header { |
| 95 | char signature[ACPI_NAME_SIZE]; /* ASCII table signature */ | 101 | char signature[ACPI_NAME_SIZE]; /* ASCII table signature */ |
| 96 | u32 length; /* Length of table in bytes, including this header */ | 102 | u32 length; /* Length of table in bytes, including this header */ |
| 97 | u8 revision; /* ACPI Specification minor version # */ | 103 | u8 revision; /* ACPI Specification minor version number */ |
| 98 | u8 checksum; /* To make sum of entire table == 0 */ | 104 | u8 checksum; /* To make sum of entire table == 0 */ |
| 99 | char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ | 105 | char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ |
| 100 | char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ | 106 | char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ |
| @@ -108,7 +114,7 @@ struct acpi_table_header { | |||
| 108 | * GAS - Generic Address Structure (ACPI 2.0+) | 114 | * GAS - Generic Address Structure (ACPI 2.0+) |
| 109 | * | 115 | * |
| 110 | * Note: Since this structure is used in the ACPI tables, it is byte aligned. | 116 | * Note: Since this structure is used in the ACPI tables, it is byte aligned. |
| 111 | * If misaliged access is not supported by the hardware, accesses to the | 117 | * If misaligned access is not supported by the hardware, accesses to the |
| 112 | * 64-bit Address field must be performed with care. | 118 | * 64-bit Address field must be performed with care. |
| 113 | * | 119 | * |
| 114 | ******************************************************************************/ | 120 | ******************************************************************************/ |
| @@ -210,18 +216,18 @@ struct acpi_table_fadt { | |||
| 210 | u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */ | 216 | u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */ |
| 211 | u16 sci_interrupt; /* System vector of SCI interrupt */ | 217 | u16 sci_interrupt; /* System vector of SCI interrupt */ |
| 212 | u32 smi_command; /* 32-bit Port address of SMI command port */ | 218 | u32 smi_command; /* 32-bit Port address of SMI command port */ |
| 213 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ | 219 | u8 acpi_enable; /* Value to write to SMI_CMD to enable ACPI */ |
| 214 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ | 220 | u8 acpi_disable; /* Value to write to SMI_CMD to disable ACPI */ |
| 215 | u8 s4_bios_request; /* Value to write to SMI CMD to enter S4BIOS state */ | 221 | u8 s4_bios_request; /* Value to write to SMI_CMD to enter S4BIOS state */ |
| 216 | u8 pstate_control; /* Processor performance state control */ | 222 | u8 pstate_control; /* Processor performance state control */ |
| 217 | u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ | 223 | u32 pm1a_event_block; /* 32-bit port address of Power Mgt 1a Event Reg Blk */ |
| 218 | u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ | 224 | u32 pm1b_event_block; /* 32-bit port address of Power Mgt 1b Event Reg Blk */ |
| 219 | u32 pm1a_control_block; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */ | 225 | u32 pm1a_control_block; /* 32-bit port address of Power Mgt 1a Control Reg Blk */ |
| 220 | u32 pm1b_control_block; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */ | 226 | u32 pm1b_control_block; /* 32-bit port address of Power Mgt 1b Control Reg Blk */ |
| 221 | u32 pm2_control_block; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */ | 227 | u32 pm2_control_block; /* 32-bit port address of Power Mgt 2 Control Reg Blk */ |
| 222 | u32 pm_timer_block; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ | 228 | u32 pm_timer_block; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ |
| 223 | u32 gpe0_block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */ | 229 | u32 gpe0_block; /* 32-bit port address of General Purpose Event 0 Reg Blk */ |
| 224 | u32 gpe1_block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */ | 230 | u32 gpe1_block; /* 32-bit port address of General Purpose Event 1 Reg Blk */ |
| 225 | u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */ | 231 | u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */ |
| 226 | u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */ | 232 | u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */ |
| 227 | u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */ | 233 | u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */ |
| @@ -229,12 +235,12 @@ struct acpi_table_fadt { | |||
| 229 | u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */ | 235 | u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */ |
| 230 | u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ | 236 | u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ |
| 231 | u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ | 237 | u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ |
| 232 | u8 cst_control; /* Support for the _CST object and C States change notification */ | 238 | u8 cst_control; /* Support for the _CST object and C-States change notification */ |
| 233 | u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */ | 239 | u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */ |
| 234 | u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */ | 240 | u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */ |
| 235 | u16 flush_size; /* Processor's memory cache line width, in bytes */ | 241 | u16 flush_size; /* Processor memory cache line width, in bytes */ |
| 236 | u16 flush_stride; /* Number of flush strides that need to be read */ | 242 | u16 flush_stride; /* Number of flush strides that need to be read */ |
| 237 | u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ | 243 | u8 duty_offset; /* Processor duty cycle index in processor P_CNT reg */ |
| 238 | u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ | 244 | u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ |
| 239 | u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ | 245 | u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ |
| 240 | u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ | 246 | u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ |
| @@ -255,11 +261,11 @@ struct acpi_table_fadt { | |||
| 255 | struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ | 261 | struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ |
| 256 | struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ | 262 | struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ |
| 257 | struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ | 263 | struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ |
| 258 | struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register */ | 264 | struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register (ACPI 5.0) */ |
| 259 | struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register */ | 265 | struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */ |
| 260 | }; | 266 | }; |
| 261 | 267 | ||
| 262 | /* Masks for FADT Boot Architecture Flags (boot_flags) */ | 268 | /* Masks for FADT Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ |
| 263 | 269 | ||
| 264 | #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ | 270 | #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ |
| 265 | #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ | 271 | #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ |
| @@ -272,13 +278,13 @@ struct acpi_table_fadt { | |||
| 272 | 278 | ||
| 273 | /* Masks for FADT flags */ | 279 | /* Masks for FADT flags */ |
| 274 | 280 | ||
| 275 | #define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ | 281 | #define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ |
| 276 | #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ | 282 | #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */ |
| 277 | #define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ | 283 | #define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ |
| 278 | #define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ | 284 | #define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ |
| 279 | #define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ | 285 | #define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ |
| 280 | #define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ | 286 | #define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ |
| 281 | #define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ | 287 | #define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */ |
| 282 | #define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ | 288 | #define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ |
| 283 | #define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ | 289 | #define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ |
| 284 | #define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ | 290 | #define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ |
| @@ -297,7 +303,7 @@ struct acpi_table_fadt { | |||
| 297 | 303 | ||
| 298 | /* Values for preferred_profile (Preferred Power Management Profiles) */ | 304 | /* Values for preferred_profile (Preferred Power Management Profiles) */ |
| 299 | 305 | ||
| 300 | enum acpi_prefered_pm_profiles { | 306 | enum acpi_preferred_pm_profiles { |
| 301 | PM_UNSPECIFIED = 0, | 307 | PM_UNSPECIFIED = 0, |
| 302 | PM_DESKTOP = 1, | 308 | PM_DESKTOP = 1, |
| 303 | PM_MOBILE = 2, | 309 | PM_MOBILE = 2, |
| @@ -335,7 +341,7 @@ union acpi_name_union { | |||
| 335 | struct acpi_table_desc { | 341 | struct acpi_table_desc { |
| 336 | acpi_physical_address address; | 342 | acpi_physical_address address; |
| 337 | struct acpi_table_header *pointer; | 343 | struct acpi_table_header *pointer; |
| 338 | u32 length; /* Length fixed at 32 bits */ | 344 | u32 length; /* Length fixed at 32 bits (fixed in table header) */ |
| 339 | union acpi_name_union signature; | 345 | union acpi_name_union signature; |
| 340 | acpi_owner_id owner_id; | 346 | acpi_owner_id owner_id; |
| 341 | u8 flags; | 347 | u8 flags; |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 300d14e7c5d5..280fc45b59dd 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
| @@ -79,9 +79,15 @@ | |||
| 79 | #pragma pack(1) | 79 | #pragma pack(1) |
| 80 | 80 | ||
| 81 | /* | 81 | /* |
| 82 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 82 | * Note: C bitfields are not used for this reason: |
| 83 | * This is the only type that is even remotely portable. Anything else is not | 83 | * |
| 84 | * portable, so do not use any other bitfield types. | 84 | * "Bitfields are great and easy to read, but unfortunately the C language |
| 85 | * does not specify the layout of bitfields in memory, which means they are | ||
| 86 | * essentially useless for dealing with packed data in on-disk formats or | ||
| 87 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
| 88 | * this decision was a design error in C. Ritchie could have picked an order | ||
| 89 | * and stuck with it." Norman Ramsey. | ||
| 90 | * See http://stackoverflow.com/a/1053662/41661 | ||
| 85 | */ | 91 | */ |
| 86 | 92 | ||
| 87 | /******************************************************************************* | 93 | /******************************************************************************* |
| @@ -489,7 +495,9 @@ enum acpi_hest_notify_types { | |||
| 489 | ACPI_HEST_NOTIFY_LOCAL = 2, | 495 | ACPI_HEST_NOTIFY_LOCAL = 2, |
| 490 | ACPI_HEST_NOTIFY_SCI = 3, | 496 | ACPI_HEST_NOTIFY_SCI = 3, |
| 491 | ACPI_HEST_NOTIFY_NMI = 4, | 497 | ACPI_HEST_NOTIFY_NMI = 4, |
| 492 | ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ | 498 | ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ |
| 499 | ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ | ||
| 500 | ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ | ||
| 493 | }; | 501 | }; |
| 494 | 502 | ||
| 495 | /* Values for config_write_enable bitfield above */ | 503 | /* Values for config_write_enable bitfield above */ |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index d9ceb3d31629..1b2b356486d1 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
| @@ -63,6 +63,8 @@ | |||
| 63 | */ | 63 | */ |
| 64 | #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ | 64 | #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ |
| 65 | #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ | 65 | #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ |
| 66 | #define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */ | ||
| 67 | #define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */ | ||
| 66 | #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ | 68 | #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ |
| 67 | #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ | 69 | #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ |
| 68 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ | 70 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ |
| @@ -96,9 +98,15 @@ | |||
| 96 | #pragma pack(1) | 98 | #pragma pack(1) |
| 97 | 99 | ||
| 98 | /* | 100 | /* |
| 99 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 101 | * Note: C bitfields are not used for this reason: |
| 100 | * This is the only type that is even remotely portable. Anything else is not | 102 | * |
| 101 | * portable, so do not use any other bitfield types. | 103 | * "Bitfields are great and easy to read, but unfortunately the C language |
| 104 | * does not specify the layout of bitfields in memory, which means they are | ||
| 105 | * essentially useless for dealing with packed data in on-disk formats or | ||
| 106 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
| 107 | * this decision was a design error in C. Ritchie could have picked an order | ||
| 108 | * and stuck with it." Norman Ramsey. | ||
| 109 | * See http://stackoverflow.com/a/1053662/41661 | ||
| 102 | */ | 110 | */ |
| 103 | 111 | ||
| 104 | /******************************************************************************* | 112 | /******************************************************************************* |
| @@ -232,6 +240,115 @@ struct acpi_table_boot { | |||
| 232 | 240 | ||
| 233 | /******************************************************************************* | 241 | /******************************************************************************* |
| 234 | * | 242 | * |
| 243 | * CSRT - Core System Resource Table | ||
| 244 | * Version 0 | ||
| 245 | * | ||
| 246 | * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 | ||
| 247 | * | ||
| 248 | ******************************************************************************/ | ||
| 249 | |||
| 250 | struct acpi_table_csrt { | ||
| 251 | struct acpi_table_header header; /* Common ACPI table header */ | ||
| 252 | }; | ||
| 253 | |||
| 254 | /* Resource Group subtable */ | ||
| 255 | |||
| 256 | struct acpi_csrt_group { | ||
| 257 | u32 length; | ||
| 258 | u32 vendor_id; | ||
| 259 | u32 subvendor_id; | ||
| 260 | u16 device_id; | ||
| 261 | u16 subdevice_id; | ||
| 262 | u16 revision; | ||
| 263 | u16 reserved; | ||
| 264 | u32 info_length; | ||
| 265 | |||
| 266 | /* Shared data (length = info_length) immediately follows */ | ||
| 267 | }; | ||
| 268 | |||
| 269 | /* Resource Descriptor subtable */ | ||
| 270 | |||
| 271 | struct acpi_csrt_descriptor { | ||
| 272 | u32 length; | ||
| 273 | u16 type; | ||
| 274 | u16 subtype; | ||
| 275 | u32 uid; | ||
| 276 | |||
| 277 | /* Resource-specific information immediately follows */ | ||
| 278 | }; | ||
| 279 | |||
| 280 | /* Resource Types */ | ||
| 281 | |||
| 282 | #define ACPI_CSRT_TYPE_INTERRUPT 0x0001 | ||
| 283 | #define ACPI_CSRT_TYPE_TIMER 0x0002 | ||
| 284 | #define ACPI_CSRT_TYPE_DMA 0x0003 | ||
| 285 | |||
| 286 | /* Resource Subtypes */ | ||
| 287 | |||
| 288 | #define ACPI_CSRT_XRUPT_LINE 0x0000 | ||
| 289 | #define ACPI_CSRT_XRUPT_CONTROLLER 0x0001 | ||
| 290 | #define ACPI_CSRT_TIMER 0x0000 | ||
| 291 | #define ACPI_CSRT_DMA_CHANNEL 0x0000 | ||
| 292 | #define ACPI_CSRT_DMA_CONTROLLER 0x0001 | ||
| 293 | |||
| 294 | /******************************************************************************* | ||
| 295 | * | ||
| 296 | * DBG2 - Debug Port Table 2 | ||
| 297 | * Version 0 (Both main table and subtables) | ||
| 298 | * | ||
| 299 | * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. | ||
| 300 | * | ||
| 301 | ******************************************************************************/ | ||
| 302 | |||
| 303 | struct acpi_table_dbg2 { | ||
| 304 | struct acpi_table_header header; /* Common ACPI table header */ | ||
| 305 | u32 info_offset; | ||
| 306 | u32 info_count; | ||
| 307 | }; | ||
| 308 | |||
| 309 | /* Debug Device Information Subtable */ | ||
| 310 | |||
| 311 | struct acpi_dbg2_device { | ||
| 312 | u8 revision; | ||
| 313 | u16 length; | ||
| 314 | u8 register_count; /* Number of base_address registers */ | ||
| 315 | u16 namepath_length; | ||
| 316 | u16 namepath_offset; | ||
| 317 | u16 oem_data_length; | ||
| 318 | u16 oem_data_offset; | ||
| 319 | u16 port_type; | ||
| 320 | u16 port_subtype; | ||
| 321 | u16 reserved; | ||
| 322 | u16 base_address_offset; | ||
| 323 | u16 address_size_offset; | ||
| 324 | /* | ||
| 325 | * Data that follows: | ||
| 326 | * base_address (required) - Each in 12-byte Generic Address Structure format. | ||
| 327 | * address_size (required) - Array of u32 sizes corresponding to each base_address register. | ||
| 328 | * Namepath (required) - Null terminated string. Single dot if not supported. | ||
| 329 | * oem_data (optional) - Length is oem_data_length. | ||
| 330 | */ | ||
| 331 | }; | ||
| 332 | |||
| 333 | /* Types for port_type field above */ | ||
| 334 | |||
| 335 | #define ACPI_DBG2_SERIAL_PORT 0x8000 | ||
| 336 | #define ACPI_DBG2_1394_PORT 0x8001 | ||
| 337 | #define ACPI_DBG2_USB_PORT 0x8002 | ||
| 338 | #define ACPI_DBG2_NET_PORT 0x8003 | ||
| 339 | |||
| 340 | /* Subtypes for port_subtype field above */ | ||
| 341 | |||
| 342 | #define ACPI_DBG2_16550_COMPATIBLE 0x0000 | ||
| 343 | #define ACPI_DBG2_16550_SUBSET 0x0001 | ||
| 344 | |||
| 345 | #define ACPI_DBG2_1394_STANDARD 0x0000 | ||
| 346 | |||
| 347 | #define ACPI_DBG2_USB_XHCI 0x0000 | ||
| 348 | #define ACPI_DBG2_USB_EHCI 0x0001 | ||
| 349 | |||
| 350 | /******************************************************************************* | ||
| 351 | * | ||
| 235 | * DBGP - Debug Port table | 352 | * DBGP - Debug Port table |
| 236 | * Version 1 | 353 | * Version 1 |
| 237 | * | 354 | * |
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index f65a0ed869eb..8c61b5fe42a4 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h | |||
| @@ -75,7 +75,6 @@ | |||
| 75 | /* Reserved table signatures */ | 75 | /* Reserved table signatures */ |
| 76 | 76 | ||
| 77 | #define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ | 77 | #define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ |
| 78 | #define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */ | ||
| 79 | #define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ | 78 | #define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ |
| 80 | #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ | 79 | #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ |
| 81 | #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ | 80 | #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ |
| @@ -87,9 +86,15 @@ | |||
| 87 | #pragma pack(1) | 86 | #pragma pack(1) |
| 88 | 87 | ||
| 89 | /* | 88 | /* |
| 90 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 89 | * Note: C bitfields are not used for this reason: |
| 91 | * This is the only type that is even remotely portable. Anything else is not | 90 | * |
| 92 | * portable, so do not use any other bitfield types. | 91 | * "Bitfields are great and easy to read, but unfortunately the C language |
| 92 | * does not specify the layout of bitfields in memory, which means they are | ||
| 93 | * essentially useless for dealing with packed data in on-disk formats or | ||
| 94 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
| 95 | * this decision was a design error in C. Ritchie could have picked an order | ||
| 96 | * and stuck with it." Norman Ramsey. | ||
| 97 | * See http://stackoverflow.com/a/1053662/41661 | ||
| 93 | */ | 98 | */ |
| 94 | 99 | ||
| 95 | /******************************************************************************* | 100 | /******************************************************************************* |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 3d00bd5bd7e3..a85bae968262 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -519,13 +519,6 @@ typedef u64 acpi_integer; | |||
| 519 | #define ACPI_SLEEP_TYPE_INVALID 0xFF | 519 | #define ACPI_SLEEP_TYPE_INVALID 0xFF |
| 520 | 520 | ||
| 521 | /* | 521 | /* |
| 522 | * Sleep/Wake flags | ||
| 523 | */ | ||
| 524 | #define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */ | ||
| 525 | #define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */ | ||
| 526 | #define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */ | ||
| 527 | |||
| 528 | /* | ||
| 529 | * Standard notify values | 522 | * Standard notify values |
| 530 | */ | 523 | */ |
| 531 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 | 524 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 991ef01cd77e..3748ec92dcbc 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
| @@ -691,9 +691,11 @@ __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ | |||
| 691 | #define __NR_process_vm_writev 271 | 691 | #define __NR_process_vm_writev 271 |
| 692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | 692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ |
| 693 | compat_sys_process_vm_writev) | 693 | compat_sys_process_vm_writev) |
| 694 | #define __NR_kcmp 272 | ||
| 695 | __SYSCALL(__NR_kcmp, sys_kcmp) | ||
| 694 | 696 | ||
| 695 | #undef __NR_syscalls | 697 | #undef __NR_syscalls |
| 696 | #define __NR_syscalls 272 | 698 | #define __NR_syscalls 273 |
| 697 | 699 | ||
| 698 | /* | 700 | /* |
| 699 | * All syscalls below here should go away really, | 701 | * All syscalls below here should go away really, |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 7e83370e6fd2..f3b99e1c1042 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -256,72 +256,78 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain, | |||
| 256 | { | 256 | { |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) | 259 | static inline int iommu_attach_group(struct iommu_domain *domain, |
| 260 | struct iommu_group *group) | ||
| 260 | { | 261 | { |
| 261 | return -ENODEV; | 262 | return -ENODEV; |
| 262 | } | 263 | } |
| 263 | 264 | ||
| 264 | void iommu_detach_group(struct iommu_domain *domain, struct iommu_group *group) | 265 | static inline void iommu_detach_group(struct iommu_domain *domain, |
| 266 | struct iommu_group *group) | ||
| 265 | { | 267 | { |
| 266 | } | 268 | } |
| 267 | 269 | ||
| 268 | struct iommu_group *iommu_group_alloc(void) | 270 | static inline struct iommu_group *iommu_group_alloc(void) |
| 269 | { | 271 | { |
| 270 | return ERR_PTR(-ENODEV); | 272 | return ERR_PTR(-ENODEV); |
| 271 | } | 273 | } |
| 272 | 274 | ||
| 273 | void *iommu_group_get_iommudata(struct iommu_group *group) | 275 | static inline void *iommu_group_get_iommudata(struct iommu_group *group) |
| 274 | { | 276 | { |
| 275 | return NULL; | 277 | return NULL; |
| 276 | } | 278 | } |
| 277 | 279 | ||
| 278 | void iommu_group_set_iommudata(struct iommu_group *group, void *iommu_data, | 280 | static inline void iommu_group_set_iommudata(struct iommu_group *group, |
| 279 | void (*release)(void *iommu_data)) | 281 | void *iommu_data, |
| 282 | void (*release)(void *iommu_data)) | ||
| 280 | { | 283 | { |
| 281 | } | 284 | } |
| 282 | 285 | ||
| 283 | int iommu_group_set_name(struct iommu_group *group, const char *name) | 286 | static inline int iommu_group_set_name(struct iommu_group *group, |
| 287 | const char *name) | ||
| 284 | { | 288 | { |
| 285 | return -ENODEV; | 289 | return -ENODEV; |
| 286 | } | 290 | } |
| 287 | 291 | ||
| 288 | int iommu_group_add_device(struct iommu_group *group, struct device *dev) | 292 | static inline int iommu_group_add_device(struct iommu_group *group, |
| 293 | struct device *dev) | ||
| 289 | { | 294 | { |
| 290 | return -ENODEV; | 295 | return -ENODEV; |
| 291 | } | 296 | } |
| 292 | 297 | ||
| 293 | void iommu_group_remove_device(struct device *dev) | 298 | static inline void iommu_group_remove_device(struct device *dev) |
| 294 | { | 299 | { |
| 295 | } | 300 | } |
| 296 | 301 | ||
| 297 | int iommu_group_for_each_dev(struct iommu_group *group, void *data, | 302 | static inline int iommu_group_for_each_dev(struct iommu_group *group, |
| 298 | int (*fn)(struct device *, void *)) | 303 | void *data, |
| 304 | int (*fn)(struct device *, void *)) | ||
| 299 | { | 305 | { |
| 300 | return -ENODEV; | 306 | return -ENODEV; |
| 301 | } | 307 | } |
| 302 | 308 | ||
| 303 | struct iommu_group *iommu_group_get(struct device *dev) | 309 | static inline struct iommu_group *iommu_group_get(struct device *dev) |
| 304 | { | 310 | { |
| 305 | return NULL; | 311 | return NULL; |
| 306 | } | 312 | } |
| 307 | 313 | ||
| 308 | void iommu_group_put(struct iommu_group *group) | 314 | static inline void iommu_group_put(struct iommu_group *group) |
| 309 | { | 315 | { |
| 310 | } | 316 | } |
| 311 | 317 | ||
| 312 | int iommu_group_register_notifier(struct iommu_group *group, | 318 | static inline int iommu_group_register_notifier(struct iommu_group *group, |
| 313 | struct notifier_block *nb) | 319 | struct notifier_block *nb) |
| 314 | { | 320 | { |
| 315 | return -ENODEV; | 321 | return -ENODEV; |
| 316 | } | 322 | } |
| 317 | 323 | ||
| 318 | int iommu_group_unregister_notifier(struct iommu_group *group, | 324 | static inline int iommu_group_unregister_notifier(struct iommu_group *group, |
| 319 | struct notifier_block *nb) | 325 | struct notifier_block *nb) |
| 320 | { | 326 | { |
| 321 | return 0; | 327 | return 0; |
| 322 | } | 328 | } |
| 323 | 329 | ||
| 324 | int iommu_group_id(struct iommu_group *group) | 330 | static inline int iommu_group_id(struct iommu_group *group) |
| 325 | { | 331 | { |
| 326 | return -ENODEV; | 332 | return -ENODEV; |
| 327 | } | 333 | } |
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 61f0905bdc48..de201203bc7c 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/micrel_phy.h | ||
| 3 | * | ||
| 4 | * Micrel PHY IDs | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 9 | * option) any later version. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | |||
| 1 | #ifndef _MICREL_PHY_H | 13 | #ifndef _MICREL_PHY_H |
| 2 | #define _MICREL_PHY_H | 14 | #define _MICREL_PHY_H |
| 3 | 15 | ||
| @@ -5,10 +17,11 @@ | |||
| 5 | 17 | ||
| 6 | #define PHY_ID_KSZ9021 0x00221610 | 18 | #define PHY_ID_KSZ9021 0x00221610 |
| 7 | #define PHY_ID_KS8737 0x00221720 | 19 | #define PHY_ID_KS8737 0x00221720 |
| 8 | #define PHY_ID_KS8041 0x00221510 | 20 | #define PHY_ID_KSZ8021 0x00221555 |
| 9 | #define PHY_ID_KS8051 0x00221550 | 21 | #define PHY_ID_KSZ8041 0x00221510 |
| 22 | #define PHY_ID_KSZ8051 0x00221550 | ||
| 10 | /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ | 23 | /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ |
| 11 | #define PHY_ID_KS8001 0x0022161A | 24 | #define PHY_ID_KSZ8001 0x0022161A |
| 12 | 25 | ||
| 13 | /* struct phy_device dev_flags definitions */ | 26 | /* struct phy_device dev_flags definitions */ |
| 14 | #define MICREL_PHY_50MHZ_CLK 0x00000001 | 27 | #define MICREL_PHY_50MHZ_CLK 0x00000001 |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 9490a00529f4..c25cccaa555a 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
| @@ -35,8 +35,10 @@ struct nvme_bar { | |||
| 35 | __u64 acq; /* Admin CQ Base Address */ | 35 | __u64 acq; /* Admin CQ Base Address */ |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | #define NVME_CAP_MQES(cap) ((cap) & 0xffff) | ||
| 38 | #define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff) | 39 | #define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff) |
| 39 | #define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf) | 40 | #define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf) |
| 41 | #define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf) | ||
| 40 | 42 | ||
| 41 | enum { | 43 | enum { |
| 42 | NVME_CC_ENABLE = 1 << 0, | 44 | NVME_CC_ENABLE = 1 << 0, |
diff --git a/include/linux/security.h b/include/linux/security.h index 3dea6a9d568f..d143b8e01954 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -118,6 +118,7 @@ void reset_security_ops(void); | |||
| 118 | extern unsigned long mmap_min_addr; | 118 | extern unsigned long mmap_min_addr; |
| 119 | extern unsigned long dac_mmap_min_addr; | 119 | extern unsigned long dac_mmap_min_addr; |
| 120 | #else | 120 | #else |
| 121 | #define mmap_min_addr 0UL | ||
| 121 | #define dac_mmap_min_addr 0UL | 122 | #define dac_mmap_min_addr 0UL |
| 122 | #endif | 123 | #endif |
| 123 | 124 | ||
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index c785554f9523..ebf3bac460b0 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c | |||
| @@ -62,7 +62,7 @@ void fprop_global_destroy(struct fprop_global *p) | |||
| 62 | */ | 62 | */ |
| 63 | bool fprop_new_period(struct fprop_global *p, int periods) | 63 | bool fprop_new_period(struct fprop_global *p, int periods) |
| 64 | { | 64 | { |
| 65 | u64 events; | 65 | s64 events; |
| 66 | unsigned long flags; | 66 | unsigned long flags; |
| 67 | 67 | ||
| 68 | local_irq_save(flags); | 68 | local_irq_save(flags); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 57c4b9309015..141dbb695097 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -1811,7 +1811,6 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page, | |||
| 1811 | src_page = pte_page(pteval); | 1811 | src_page = pte_page(pteval); |
| 1812 | copy_user_highpage(page, src_page, address, vma); | 1812 | copy_user_highpage(page, src_page, address, vma); |
| 1813 | VM_BUG_ON(page_mapcount(src_page) != 1); | 1813 | VM_BUG_ON(page_mapcount(src_page) != 1); |
| 1814 | VM_BUG_ON(page_count(src_page) != 2); | ||
| 1815 | release_pte_page(src_page); | 1814 | release_pte_page(src_page); |
| 1816 | /* | 1815 | /* |
| 1817 | * ptl mostly unnecessary, but preempt has to | 1816 | * ptl mostly unnecessary, but preempt has to |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index e877af8bdd1e..469daabd90c7 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
| @@ -642,7 +642,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
| 642 | struct batadv_neigh_node *router = NULL; | 642 | struct batadv_neigh_node *router = NULL; |
| 643 | struct batadv_orig_node *orig_node_tmp; | 643 | struct batadv_orig_node *orig_node_tmp; |
| 644 | struct hlist_node *node; | 644 | struct hlist_node *node; |
| 645 | uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; | 645 | int if_num; |
| 646 | uint8_t sum_orig, sum_neigh; | ||
| 646 | uint8_t *neigh_addr; | 647 | uint8_t *neigh_addr; |
| 647 | 648 | ||
| 648 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 649 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
| @@ -727,17 +728,17 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
| 727 | if (router && (neigh_node->tq_avg == router->tq_avg)) { | 728 | if (router && (neigh_node->tq_avg == router->tq_avg)) { |
| 728 | orig_node_tmp = router->orig_node; | 729 | orig_node_tmp = router->orig_node; |
| 729 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 730 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
| 730 | bcast_own_sum_orig = | 731 | if_num = router->if_incoming->if_num; |
| 731 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 732 | sum_orig = orig_node_tmp->bcast_own_sum[if_num]; |
| 732 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 733 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
| 733 | 734 | ||
| 734 | orig_node_tmp = neigh_node->orig_node; | 735 | orig_node_tmp = neigh_node->orig_node; |
| 735 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 736 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
| 736 | bcast_own_sum_neigh = | 737 | if_num = neigh_node->if_incoming->if_num; |
| 737 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 738 | sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; |
| 738 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 739 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
| 739 | 740 | ||
| 740 | if (bcast_own_sum_orig >= bcast_own_sum_neigh) | 741 | if (sum_orig >= sum_neigh) |
| 741 | goto update_tt; | 742 | goto update_tt; |
| 742 | } | 743 | } |
| 743 | 744 | ||
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 109ea2aae96c..21c53577c8d6 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | |||
| 100 | { | 100 | { |
| 101 | struct batadv_priv *bat_priv = netdev_priv(dev); | 101 | struct batadv_priv *bat_priv = netdev_priv(dev); |
| 102 | struct sockaddr *addr = p; | 102 | struct sockaddr *addr = p; |
| 103 | uint8_t old_addr[ETH_ALEN]; | ||
| 103 | 104 | ||
| 104 | if (!is_valid_ether_addr(addr->sa_data)) | 105 | if (!is_valid_ether_addr(addr->sa_data)) |
| 105 | return -EADDRNOTAVAIL; | 106 | return -EADDRNOTAVAIL; |
| 106 | 107 | ||
| 108 | memcpy(old_addr, dev->dev_addr, ETH_ALEN); | ||
| 109 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
| 110 | |||
| 107 | /* only modify transtable if it has been initialized before */ | 111 | /* only modify transtable if it has been initialized before */ |
| 108 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { | 112 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { |
| 109 | batadv_tt_local_remove(bat_priv, dev->dev_addr, | 113 | batadv_tt_local_remove(bat_priv, old_addr, |
| 110 | "mac address changed", false); | 114 | "mac address changed", false); |
| 111 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); | 115 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); |
| 112 | } | 116 | } |
| 113 | 117 | ||
| 114 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
| 115 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | 118 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; |
| 116 | return 0; | 119 | return 0; |
| 117 | } | 120 | } |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d4de5db18d5a..0b997c8f9655 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
| @@ -734,6 +734,8 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
| 734 | 734 | ||
| 735 | cancel_work_sync(&hdev->le_scan); | 735 | cancel_work_sync(&hdev->le_scan); |
| 736 | 736 | ||
| 737 | cancel_delayed_work(&hdev->power_off); | ||
| 738 | |||
| 737 | hci_req_cancel(hdev, ENODEV); | 739 | hci_req_cancel(hdev, ENODEV); |
| 738 | hci_req_lock(hdev); | 740 | hci_req_lock(hdev); |
| 739 | 741 | ||
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 4ea1710a4783..38c00f142203 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -1008,7 +1008,7 @@ static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *c | |||
| 1008 | if (!conn) | 1008 | if (!conn) |
| 1009 | return; | 1009 | return; |
| 1010 | 1010 | ||
| 1011 | if (chan->mode == L2CAP_MODE_ERTM) { | 1011 | if (chan->mode == L2CAP_MODE_ERTM && chan->state == BT_CONNECTED) { |
| 1012 | __clear_retrans_timer(chan); | 1012 | __clear_retrans_timer(chan); |
| 1013 | __clear_monitor_timer(chan); | 1013 | __clear_monitor_timer(chan); |
| 1014 | __clear_ack_timer(chan); | 1014 | __clear_ack_timer(chan); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index ad6613d17ca6..eba022de3c20 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -2875,6 +2875,22 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) | |||
| 2875 | if (scan) | 2875 | if (scan) |
| 2876 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); | 2876 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); |
| 2877 | 2877 | ||
| 2878 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { | ||
| 2879 | u8 ssp = 1; | ||
| 2880 | |||
| 2881 | hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp); | ||
| 2882 | } | ||
| 2883 | |||
| 2884 | if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { | ||
| 2885 | struct hci_cp_write_le_host_supported cp; | ||
| 2886 | |||
| 2887 | cp.le = 1; | ||
| 2888 | cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR); | ||
| 2889 | |||
| 2890 | hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, | ||
| 2891 | sizeof(cp), &cp); | ||
| 2892 | } | ||
| 2893 | |||
| 2878 | update_class(hdev); | 2894 | update_class(hdev); |
| 2879 | update_name(hdev, hdev->dev_name); | 2895 | update_name(hdev, hdev->dev_name); |
| 2880 | update_eir(hdev); | 2896 | update_eir(hdev); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 24c5eea8c45b..159aa8bef9e7 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -1073,16 +1073,13 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
| 1073 | BUG_ON(kaddr == NULL); | 1073 | BUG_ON(kaddr == NULL); |
| 1074 | base = kaddr + con->out_msg_pos.page_pos + bio_offset; | 1074 | base = kaddr + con->out_msg_pos.page_pos + bio_offset; |
| 1075 | crc = crc32c(crc, base, len); | 1075 | crc = crc32c(crc, base, len); |
| 1076 | kunmap(page); | ||
| 1076 | msg->footer.data_crc = cpu_to_le32(crc); | 1077 | msg->footer.data_crc = cpu_to_le32(crc); |
| 1077 | con->out_msg_pos.did_page_crc = true; | 1078 | con->out_msg_pos.did_page_crc = true; |
| 1078 | } | 1079 | } |
| 1079 | ret = ceph_tcp_sendpage(con->sock, page, | 1080 | ret = ceph_tcp_sendpage(con->sock, page, |
| 1080 | con->out_msg_pos.page_pos + bio_offset, | 1081 | con->out_msg_pos.page_pos + bio_offset, |
| 1081 | len, 1); | 1082 | len, 1); |
| 1082 | |||
| 1083 | if (do_datacrc) | ||
| 1084 | kunmap(page); | ||
| 1085 | |||
| 1086 | if (ret <= 0) | 1083 | if (ret <= 0) |
| 1087 | goto out; | 1084 | goto out; |
| 1088 | 1085 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 305792076121..a6000fbad294 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -691,7 +691,8 @@ set_rcvbuf: | |||
| 691 | 691 | ||
| 692 | case SO_KEEPALIVE: | 692 | case SO_KEEPALIVE: |
| 693 | #ifdef CONFIG_INET | 693 | #ifdef CONFIG_INET |
| 694 | if (sk->sk_protocol == IPPROTO_TCP) | 694 | if (sk->sk_protocol == IPPROTO_TCP && |
| 695 | sk->sk_type == SOCK_STREAM) | ||
| 695 | tcp_set_keepalive(sk, valbool); | 696 | tcp_set_keepalive(sk, valbool); |
| 696 | #endif | 697 | #endif |
| 697 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); | 698 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index e1e0a4e8fd34..c7527f6b9ad9 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
| @@ -510,7 +510,10 @@ relookup: | |||
| 510 | secure_ipv6_id(daddr->addr.a6)); | 510 | secure_ipv6_id(daddr->addr.a6)); |
| 511 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; | 511 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; |
| 512 | p->rate_tokens = 0; | 512 | p->rate_tokens = 0; |
| 513 | p->rate_last = 0; | 513 | /* 60*HZ is arbitrary, but chosen enough high so that the first |
| 514 | * calculation of tokens is at its maximum. | ||
| 515 | */ | ||
| 516 | p->rate_last = jiffies - 60*HZ; | ||
| 514 | INIT_LIST_HEAD(&p->gc_list); | 517 | INIT_LIST_HEAD(&p->gc_list); |
| 515 | 518 | ||
| 516 | /* Link the node. */ | 519 | /* Link the node. */ |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ff0f071969ea..d23c6571ba1c 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
| @@ -131,18 +131,20 @@ found: | |||
| 131 | * 0 - deliver | 131 | * 0 - deliver |
| 132 | * 1 - block | 132 | * 1 - block |
| 133 | */ | 133 | */ |
| 134 | static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) | 134 | static int icmp_filter(const struct sock *sk, const struct sk_buff *skb) |
| 135 | { | 135 | { |
| 136 | int type; | 136 | struct icmphdr _hdr; |
| 137 | const struct icmphdr *hdr; | ||
| 137 | 138 | ||
| 138 | if (!pskb_may_pull(skb, sizeof(struct icmphdr))) | 139 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
| 140 | sizeof(_hdr), &_hdr); | ||
| 141 | if (!hdr) | ||
| 139 | return 1; | 142 | return 1; |
| 140 | 143 | ||
| 141 | type = icmp_hdr(skb)->type; | 144 | if (hdr->type < 32) { |
| 142 | if (type < 32) { | ||
| 143 | __u32 data = raw_sk(sk)->filter.data; | 145 | __u32 data = raw_sk(sk)->filter.data; |
| 144 | 146 | ||
| 145 | return ((1 << type) & data) != 0; | 147 | return ((1U << hdr->type) & data) != 0; |
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | /* Do not block unknown ICMP types */ | 150 | /* Do not block unknown ICMP types */ |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 5b087c31d87b..0f9bdc5ee9f3 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
| @@ -86,28 +86,30 @@ static int mip6_mh_len(int type) | |||
| 86 | 86 | ||
| 87 | static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) | 87 | static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) |
| 88 | { | 88 | { |
| 89 | struct ip6_mh *mh; | 89 | struct ip6_mh _hdr; |
| 90 | const struct ip6_mh *mh; | ||
| 90 | 91 | ||
| 91 | if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) || | 92 | mh = skb_header_pointer(skb, skb_transport_offset(skb), |
| 92 | !pskb_may_pull(skb, (skb_transport_offset(skb) + | 93 | sizeof(_hdr), &_hdr); |
| 93 | ((skb_transport_header(skb)[1] + 1) << 3)))) | 94 | if (!mh) |
| 94 | return -1; | 95 | return -1; |
| 95 | 96 | ||
| 96 | mh = (struct ip6_mh *)skb_transport_header(skb); | 97 | if (((mh->ip6mh_hdrlen + 1) << 3) > skb->len) |
| 98 | return -1; | ||
| 97 | 99 | ||
| 98 | if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) { | 100 | if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) { |
| 99 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n", | 101 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n", |
| 100 | mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type)); | 102 | mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type)); |
| 101 | mip6_param_prob(skb, 0, ((&mh->ip6mh_hdrlen) - | 103 | mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_hdrlen) + |
| 102 | skb_network_header(skb))); | 104 | skb_network_header_len(skb)); |
| 103 | return -1; | 105 | return -1; |
| 104 | } | 106 | } |
| 105 | 107 | ||
| 106 | if (mh->ip6mh_proto != IPPROTO_NONE) { | 108 | if (mh->ip6mh_proto != IPPROTO_NONE) { |
| 107 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", | 109 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", |
| 108 | mh->ip6mh_proto); | 110 | mh->ip6mh_proto); |
| 109 | mip6_param_prob(skb, 0, ((&mh->ip6mh_proto) - | 111 | mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_proto) + |
| 110 | skb_network_header(skb))); | 112 | skb_network_header_len(skb)); |
| 111 | return -1; | 113 | return -1; |
| 112 | } | 114 | } |
| 113 | 115 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ef0579d5bca6..4a5f78b50495 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -107,21 +107,20 @@ found: | |||
| 107 | * 0 - deliver | 107 | * 0 - deliver |
| 108 | * 1 - block | 108 | * 1 - block |
| 109 | */ | 109 | */ |
| 110 | static __inline__ int icmpv6_filter(struct sock *sk, struct sk_buff *skb) | 110 | static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb) |
| 111 | { | 111 | { |
| 112 | struct icmp6hdr *icmph; | 112 | struct icmp6hdr *_hdr; |
| 113 | struct raw6_sock *rp = raw6_sk(sk); | 113 | const struct icmp6hdr *hdr; |
| 114 | |||
| 115 | if (pskb_may_pull(skb, sizeof(struct icmp6hdr))) { | ||
| 116 | __u32 *data = &rp->filter.data[0]; | ||
| 117 | int bit_nr; | ||
| 118 | 114 | ||
| 119 | icmph = (struct icmp6hdr *) skb->data; | 115 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
| 120 | bit_nr = icmph->icmp6_type; | 116 | sizeof(_hdr), &_hdr); |
| 117 | if (hdr) { | ||
| 118 | const __u32 *data = &raw6_sk(sk)->filter.data[0]; | ||
| 119 | unsigned int type = hdr->icmp6_type; | ||
| 121 | 120 | ||
| 122 | return (data[bit_nr >> 5] & (1 << (bit_nr & 31))) != 0; | 121 | return (data[type >> 5] & (1U << (type & 31))) != 0; |
| 123 | } | 122 | } |
| 124 | return 0; | 123 | return 1; |
| 125 | } | 124 | } |
| 126 | 125 | ||
| 127 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 126 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index d71cd9229a47..6f936358d664 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
| @@ -80,8 +80,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) | |||
| 80 | 80 | ||
| 81 | hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, | 81 | hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, |
| 82 | &l2tp_nl_family, 0, L2TP_CMD_NOOP); | 82 | &l2tp_nl_family, 0, L2TP_CMD_NOOP); |
| 83 | if (IS_ERR(hdr)) { | 83 | if (!hdr) { |
| 84 | ret = PTR_ERR(hdr); | 84 | ret = -EMSGSIZE; |
| 85 | goto err_out; | 85 | goto err_out; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -250,8 +250,8 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 pid, u32 seq, int flags, | |||
| 250 | 250 | ||
| 251 | hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, | 251 | hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, |
| 252 | L2TP_CMD_TUNNEL_GET); | 252 | L2TP_CMD_TUNNEL_GET); |
| 253 | if (IS_ERR(hdr)) | 253 | if (!hdr) |
| 254 | return PTR_ERR(hdr); | 254 | return -EMSGSIZE; |
| 255 | 255 | ||
| 256 | if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) || | 256 | if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) || |
| 257 | nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || | 257 | nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || |
| @@ -617,8 +617,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 pid, u32 seq, int flags | |||
| 617 | sk = tunnel->sock; | 617 | sk = tunnel->sock; |
| 618 | 618 | ||
| 619 | hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET); | 619 | hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET); |
| 620 | if (IS_ERR(hdr)) | 620 | if (!hdr) |
| 621 | return PTR_ERR(hdr); | 621 | return -EMSGSIZE; |
| 622 | 622 | ||
| 623 | if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || | 623 | if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || |
| 624 | nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || | 624 | nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || |
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c index 5c22ce8ab309..a4c1e4528cac 100644 --- a/net/netfilter/xt_limit.c +++ b/net/netfilter/xt_limit.c | |||
| @@ -117,11 +117,11 @@ static int limit_mt_check(const struct xt_mtchk_param *par) | |||
| 117 | 117 | ||
| 118 | /* For SMP, we only want to use one set of state. */ | 118 | /* For SMP, we only want to use one set of state. */ |
| 119 | r->master = priv; | 119 | r->master = priv; |
| 120 | /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * | ||
| 121 | 128. */ | ||
| 122 | priv->prev = jiffies; | ||
| 123 | priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ | ||
| 120 | if (r->cost == 0) { | 124 | if (r->cost == 0) { |
| 121 | /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * | ||
| 122 | 128. */ | ||
| 123 | priv->prev = jiffies; | ||
| 124 | priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ | ||
| 125 | r->credit_cap = priv->credit; /* Credits full. */ | 125 | r->credit_cap = priv->credit; /* Credits full. */ |
| 126 | r->cost = user2credits(r->avg); | 126 | r->cost = user2credits(r->avg); |
| 127 | } | 127 | } |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 2ded3c7fad06..72d170ca3406 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
| @@ -350,6 +350,9 @@ static void reg_regdb_search(struct work_struct *work) | |||
| 350 | struct reg_regdb_search_request *request; | 350 | struct reg_regdb_search_request *request; |
| 351 | const struct ieee80211_regdomain *curdom, *regdom; | 351 | const struct ieee80211_regdomain *curdom, *regdom; |
| 352 | int i, r; | 352 | int i, r; |
| 353 | bool set_reg = false; | ||
| 354 | |||
| 355 | mutex_lock(&cfg80211_mutex); | ||
| 353 | 356 | ||
| 354 | mutex_lock(®_regdb_search_mutex); | 357 | mutex_lock(®_regdb_search_mutex); |
| 355 | while (!list_empty(®_regdb_search_list)) { | 358 | while (!list_empty(®_regdb_search_list)) { |
| @@ -365,9 +368,7 @@ static void reg_regdb_search(struct work_struct *work) | |||
| 365 | r = reg_copy_regd(®dom, curdom); | 368 | r = reg_copy_regd(®dom, curdom); |
| 366 | if (r) | 369 | if (r) |
| 367 | break; | 370 | break; |
| 368 | mutex_lock(&cfg80211_mutex); | 371 | set_reg = true; |
| 369 | set_regdom(regdom); | ||
| 370 | mutex_unlock(&cfg80211_mutex); | ||
| 371 | break; | 372 | break; |
| 372 | } | 373 | } |
| 373 | } | 374 | } |
| @@ -375,6 +376,11 @@ static void reg_regdb_search(struct work_struct *work) | |||
| 375 | kfree(request); | 376 | kfree(request); |
| 376 | } | 377 | } |
| 377 | mutex_unlock(®_regdb_search_mutex); | 378 | mutex_unlock(®_regdb_search_mutex); |
| 379 | |||
| 380 | if (set_reg) | ||
| 381 | set_regdom(regdom); | ||
| 382 | |||
| 383 | mutex_unlock(&cfg80211_mutex); | ||
| 378 | } | 384 | } |
| 379 | 385 | ||
| 380 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); | 386 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); |
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index d24810fc6af6..fd8fa9aa7c4e 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh | |||
| @@ -200,7 +200,7 @@ EOF | |||
| 200 | syscall_list() { | 200 | syscall_list() { |
| 201 | grep '^[0-9]' "$1" | sort -n | ( | 201 | grep '^[0-9]' "$1" | sort -n | ( |
| 202 | while read nr abi name entry ; do | 202 | while read nr abi name entry ; do |
| 203 | echo <<EOF | 203 | cat <<EOF |
| 204 | #if !defined(__NR_${name}) && !defined(__IGNORE_${name}) | 204 | #if !defined(__NR_${name}) && !defined(__IGNORE_${name}) |
| 205 | #warning syscall ${name} not implemented | 205 | #warning syscall ${name} not implemented |
| 206 | #endif | 206 | #endif |
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 3fd5b29dc933..a3acb7a85f6a 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
| @@ -702,7 +702,7 @@ static bool wm2000_readable_reg(struct device *dev, unsigned int reg) | |||
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | static const struct regmap_config wm2000_regmap = { | 704 | static const struct regmap_config wm2000_regmap = { |
| 705 | .reg_bits = 8, | 705 | .reg_bits = 16, |
| 706 | .val_bits = 8, | 706 | .val_bits = 8, |
| 707 | 707 | ||
| 708 | .max_register = WM2000_REG_IF_CTL, | 708 | .max_register = WM2000_REG_IF_CTL, |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index d6e2bb49c59c..060dccb9ec75 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
| @@ -197,7 +197,13 @@ static void prepare_outbound_urb(struct snd_usb_endpoint *ep, | |||
| 197 | /* no data provider, so send silence */ | 197 | /* no data provider, so send silence */ |
| 198 | unsigned int offs = 0; | 198 | unsigned int offs = 0; |
| 199 | for (i = 0; i < ctx->packets; ++i) { | 199 | for (i = 0; i < ctx->packets; ++i) { |
| 200 | int counts = ctx->packet_size[i]; | 200 | int counts; |
| 201 | |||
| 202 | if (ctx->packet_size[i]) | ||
| 203 | counts = ctx->packet_size[i]; | ||
| 204 | else | ||
| 205 | counts = snd_usb_endpoint_next_packet_size(ep); | ||
| 206 | |||
| 201 | urb->iso_frame_desc[i].offset = offs * ep->stride; | 207 | urb->iso_frame_desc[i].offset = offs * ep->stride; |
| 202 | urb->iso_frame_desc[i].length = counts * ep->stride; | 208 | urb->iso_frame_desc[i].length = counts * ep->stride; |
| 203 | offs += counts; | 209 | offs += counts; |
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile new file mode 100644 index 000000000000..6b9cf7a987c7 --- /dev/null +++ b/tools/power/acpi/Makefile | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | PROG= acpidump | ||
| 2 | SRCS= acpidump.c | ||
| 3 | KERNEL_INCLUDE := ../../../include | ||
| 4 | CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE) | ||
| 5 | |||
| 6 | all: acpidump | ||
| 7 | $(PROG) : $(SRCS) | ||
| 8 | $(CC) $(CFLAGS) $(SRCS) -o $(PROG) | ||
| 9 | |||
| 10 | CLEANFILES= $(PROG) | ||
| 11 | |||
| 12 | clean : | ||
| 13 | rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) *~ | ||
| 14 | |||
| 15 | install : | ||
| 16 | install acpidump /usr/bin/acpidump | ||
| 17 | install acpidump.8 /usr/share/man/man8 | ||
| 18 | |||
diff --git a/tools/power/acpi/acpidump.8 b/tools/power/acpi/acpidump.8 new file mode 100644 index 000000000000..adfa99166e5e --- /dev/null +++ b/tools/power/acpi/acpidump.8 | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | .TH ACPIDUMP 8 | ||
| 2 | .SH NAME | ||
| 3 | acpidump \- Dump system's ACPI tables to an ASCII file. | ||
| 4 | .SH SYNOPSIS | ||
| 5 | .ft B | ||
| 6 | .B acpidump > acpidump.out | ||
| 7 | .SH DESCRIPTION | ||
| 8 | \fBacpidump \fP dumps the systems ACPI tables to an ASCII file | ||
| 9 | appropriate for attaching to a bug report. | ||
| 10 | |||
| 11 | Subsequently, they can be processed by utilities in the ACPICA package. | ||
| 12 | .SS Options | ||
| 13 | no options worth worrying about. | ||
| 14 | .PP | ||
| 15 | .SH EXAMPLE | ||
| 16 | |||
| 17 | .nf | ||
| 18 | # acpidump > acpidump.out | ||
| 19 | |||
| 20 | $ acpixtract -a acpidump.out | ||
| 21 | Acpi table [DSDT] - 15974 bytes written to DSDT.dat | ||
| 22 | Acpi table [FACS] - 64 bytes written to FACS.dat | ||
| 23 | Acpi table [FACP] - 116 bytes written to FACP.dat | ||
| 24 | Acpi table [APIC] - 120 bytes written to APIC.dat | ||
| 25 | Acpi table [MCFG] - 60 bytes written to MCFG.dat | ||
| 26 | Acpi table [SSDT] - 444 bytes written to SSDT1.dat | ||
| 27 | Acpi table [SSDT] - 439 bytes written to SSDT2.dat | ||
| 28 | Acpi table [SSDT] - 439 bytes written to SSDT3.dat | ||
| 29 | Acpi table [SSDT] - 439 bytes written to SSDT4.dat | ||
| 30 | Acpi table [SSDT] - 439 bytes written to SSDT5.dat | ||
| 31 | Acpi table [RSDT] - 76 bytes written to RSDT.dat | ||
| 32 | Acpi table [RSDP] - 20 bytes written to RSDP.dat | ||
| 33 | |||
| 34 | $ iasl -d *.dat | ||
| 35 | ... | ||
| 36 | .fi | ||
| 37 | creates *.dsl, a human readable form which can be edited | ||
| 38 | and compiled using iasl. | ||
| 39 | |||
| 40 | |||
| 41 | .SH NOTES | ||
| 42 | |||
| 43 | .B "acpidump " | ||
| 44 | must be run as root. | ||
| 45 | |||
| 46 | .SH REFERENCES | ||
| 47 | ACPICA: https://acpica.org/ | ||
| 48 | |||
| 49 | .SH FILES | ||
| 50 | .ta | ||
| 51 | .nf | ||
| 52 | /dev/mem | ||
| 53 | /sys/firmware/acpi/tables/dynamic/* | ||
| 54 | .fi | ||
| 55 | |||
| 56 | .PP | ||
| 57 | .SH AUTHOR | ||
| 58 | .nf | ||
| 59 | Written by Len Brown <len.brown@intel.com> | ||
diff --git a/tools/power/acpi/acpidump.c b/tools/power/acpi/acpidump.c new file mode 100644 index 000000000000..07779871421c --- /dev/null +++ b/tools/power/acpi/acpidump.c | |||
| @@ -0,0 +1,560 @@ | |||
| 1 | /* | ||
| 2 | * (c) Alexey Starikovskiy, Intel, 2005-2006. | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions, and the following disclaimer, | ||
| 10 | * without modification. | ||
| 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 12 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 13 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 14 | * including a substantially similar Disclaimer requirement for further | ||
| 15 | * binary redistribution. | ||
| 16 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 17 | * of any contributors may be used to endorse or promote products derived | ||
| 18 | * from this software without specific prior written permission. | ||
| 19 | * | ||
| 20 | * Alternatively, this software may be distributed under the terms of the | ||
| 21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 22 | * Software Foundation. | ||
| 23 | * | ||
| 24 | * NO WARRANTY | ||
| 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 26 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 27 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 28 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 29 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 33 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 34 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 35 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 36 | */ | ||
| 37 | |||
| 38 | #ifdef DEFINE_ALTERNATE_TYPES | ||
| 39 | /* hack to enable building old application with new headers -lenb */ | ||
| 40 | #define acpi_fadt_descriptor acpi_table_fadt | ||
| 41 | #define acpi_rsdp_descriptor acpi_table_rsdp | ||
| 42 | #define DSDT_SIG ACPI_SIG_DSDT | ||
| 43 | #define FACS_SIG ACPI_SIG_FACS | ||
| 44 | #define FADT_SIG ACPI_SIG_FADT | ||
| 45 | #define xfirmware_ctrl Xfacs | ||
| 46 | #define firmware_ctrl facs | ||
| 47 | |||
| 48 | typedef int s32; | ||
| 49 | typedef unsigned char u8; | ||
| 50 | typedef unsigned short u16; | ||
| 51 | typedef unsigned int u32; | ||
| 52 | typedef unsigned long long u64; | ||
| 53 | typedef long long s64; | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #include <sys/mman.h> | ||
| 57 | #include <sys/types.h> | ||
| 58 | #include <sys/stat.h> | ||
| 59 | #include <fcntl.h> | ||
| 60 | #include <stdio.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <unistd.h> | ||
| 63 | #include <getopt.h> | ||
| 64 | |||
| 65 | #include <sys/types.h> | ||
| 66 | #include <dirent.h> | ||
| 67 | |||
| 68 | #include <acpi/acconfig.h> | ||
| 69 | #include <acpi/platform/acenv.h> | ||
| 70 | #include <acpi/actypes.h> | ||
| 71 | #include <acpi/actbl.h> | ||
| 72 | |||
| 73 | static inline u8 checksum(u8 * buffer, u32 length) | ||
| 74 | { | ||
| 75 | u8 sum = 0, *i = buffer; | ||
| 76 | buffer += length; | ||
| 77 | for (; i < buffer; sum += *(i++)); | ||
| 78 | return sum; | ||
| 79 | } | ||
| 80 | |||
| 81 | static unsigned long psz, addr, length; | ||
| 82 | static int print, connect, skip; | ||
| 83 | static u8 select_sig[4]; | ||
| 84 | |||
| 85 | static unsigned long read_efi_systab( void ) | ||
| 86 | { | ||
| 87 | char buffer[80]; | ||
| 88 | unsigned long addr; | ||
| 89 | FILE *f = fopen("/sys/firmware/efi/systab", "r"); | ||
| 90 | if (f) { | ||
| 91 | while (fgets(buffer, 80, f)) { | ||
| 92 | if (sscanf(buffer, "ACPI20=0x%lx", &addr) == 1) | ||
| 93 | return addr; | ||
| 94 | } | ||
| 95 | fclose(f); | ||
| 96 | } | ||
| 97 | return 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | static u8 *acpi_map_memory(unsigned long where, unsigned length) | ||
| 101 | { | ||
| 102 | unsigned long offset; | ||
| 103 | u8 *there; | ||
| 104 | int fd = open("/dev/mem", O_RDONLY); | ||
| 105 | if (fd < 0) { | ||
| 106 | fprintf(stderr, "acpi_os_map_memory: cannot open /dev/mem\n"); | ||
| 107 | exit(1); | ||
| 108 | } | ||
| 109 | offset = where % psz; | ||
| 110 | there = mmap(NULL, length + offset, PROT_READ, MAP_PRIVATE, | ||
| 111 | fd, where - offset); | ||
| 112 | close(fd); | ||
| 113 | if (there == MAP_FAILED) return 0; | ||
| 114 | return (there + offset); | ||
| 115 | } | ||
| 116 | |||
| 117 | static void acpi_unmap_memory(u8 * there, unsigned length) | ||
| 118 | { | ||
| 119 | unsigned long offset = (unsigned long)there % psz; | ||
| 120 | munmap(there - offset, length + offset); | ||
| 121 | } | ||
| 122 | |||
| 123 | static struct acpi_table_header *acpi_map_table(unsigned long where, char *sig) | ||
| 124 | { | ||
| 125 | unsigned size; | ||
| 126 | struct acpi_table_header *tbl = (struct acpi_table_header *) | ||
| 127 | acpi_map_memory(where, sizeof(struct acpi_table_header)); | ||
| 128 | if (!tbl || (sig && memcmp(sig, tbl->signature, 4))) return 0; | ||
| 129 | size = tbl->length; | ||
| 130 | acpi_unmap_memory((u8 *) tbl, sizeof(struct acpi_table_header)); | ||
| 131 | return (struct acpi_table_header *)acpi_map_memory(where, size); | ||
| 132 | } | ||
| 133 | |||
| 134 | static void acpi_unmap_table(struct acpi_table_header *tbl) | ||
| 135 | { | ||
| 136 | acpi_unmap_memory((u8 *)tbl, tbl->length); | ||
| 137 | } | ||
| 138 | |||
| 139 | static struct acpi_rsdp_descriptor *acpi_scan_for_rsdp(u8 *begin, u32 length) | ||
| 140 | { | ||
| 141 | struct acpi_rsdp_descriptor *rsdp; | ||
| 142 | u8 *i, *end = begin + length; | ||
| 143 | /* Search from given start address for the requested length */ | ||
| 144 | for (i = begin; i < end; i += ACPI_RSDP_SCAN_STEP) { | ||
| 145 | /* The signature and checksum must both be correct */ | ||
| 146 | if (memcmp((char *)i, "RSD PTR ", 8)) continue; | ||
| 147 | rsdp = (struct acpi_rsdp_descriptor *)i; | ||
| 148 | /* Signature matches, check the appropriate checksum */ | ||
| 149 | if (!checksum((u8 *) rsdp, (rsdp->revision < 2) ? | ||
| 150 | ACPI_RSDP_CHECKSUM_LENGTH : | ||
| 151 | ACPI_RSDP_XCHECKSUM_LENGTH)) | ||
| 152 | /* Checksum valid, we have found a valid RSDP */ | ||
| 153 | return rsdp; | ||
| 154 | } | ||
| 155 | /* Searched entire block, no RSDP was found */ | ||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | /* | ||
| 160 | * Output data | ||
| 161 | */ | ||
| 162 | static void acpi_show_data(int fd, u8 * data, int size) | ||
| 163 | { | ||
| 164 | char buffer[256]; | ||
| 165 | int len; | ||
| 166 | int i, remain = size; | ||
| 167 | while (remain > 0) { | ||
| 168 | len = snprintf(buffer, 256, " %04x:", size - remain); | ||
| 169 | for (i = 0; i < 16 && i < remain; i++) { | ||
| 170 | len += | ||
| 171 | snprintf(&buffer[len], 256 - len, " %02x", data[i]); | ||
| 172 | } | ||
| 173 | for (; i < 16; i++) { | ||
| 174 | len += snprintf(&buffer[len], 256 - len, " "); | ||
| 175 | } | ||
| 176 | len += snprintf(&buffer[len], 256 - len, " "); | ||
| 177 | for (i = 0; i < 16 && i < remain; i++) { | ||
| 178 | buffer[len++] = (isprint(data[i])) ? data[i] : '.'; | ||
| 179 | } | ||
| 180 | buffer[len++] = '\n'; | ||
| 181 | write(fd, buffer, len); | ||
| 182 | data += 16; | ||
| 183 | remain -= 16; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | /* | ||
| 188 | * Output ACPI table | ||
| 189 | */ | ||
| 190 | static void acpi_show_table(int fd, struct acpi_table_header *table, unsigned long addr) | ||
| 191 | { | ||
| 192 | char buff[80]; | ||
| 193 | int len = snprintf(buff, 80, "%.4s @ %p\n", table->signature, (void *)addr); | ||
| 194 | write(fd, buff, len); | ||
| 195 | acpi_show_data(fd, (u8 *) table, table->length); | ||
| 196 | buff[0] = '\n'; | ||
| 197 | write(fd, buff, 1); | ||
| 198 | } | ||
| 199 | |||
| 200 | static void write_table(int fd, struct acpi_table_header *tbl, unsigned long addr) | ||
| 201 | { | ||
| 202 | static int select_done = 0; | ||
| 203 | if (!select_sig[0]) { | ||
| 204 | if (print) { | ||
| 205 | acpi_show_table(fd, tbl, addr); | ||
| 206 | } else { | ||
| 207 | write(fd, tbl, tbl->length); | ||
| 208 | } | ||
| 209 | } else if (!select_done && !memcmp(select_sig, tbl->signature, 4)) { | ||
| 210 | if (skip > 0) { | ||
| 211 | --skip; | ||
| 212 | return; | ||
| 213 | } | ||
| 214 | if (print) { | ||
| 215 | acpi_show_table(fd, tbl, addr); | ||
| 216 | } else { | ||
| 217 | write(fd, tbl, tbl->length); | ||
| 218 | } | ||
| 219 | select_done = 1; | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | static void acpi_dump_FADT(int fd, struct acpi_table_header *tbl, unsigned long xaddr) { | ||
| 224 | struct acpi_fadt_descriptor x; | ||
| 225 | unsigned long addr; | ||
| 226 | size_t len = sizeof(struct acpi_fadt_descriptor); | ||
| 227 | if (len > tbl->length) len = tbl->length; | ||
| 228 | memcpy(&x, tbl, len); | ||
| 229 | x.header.length = len; | ||
| 230 | if (checksum((u8 *)tbl, len)) { | ||
| 231 | fprintf(stderr, "Wrong checksum for FADT!\n"); | ||
| 232 | } | ||
| 233 | if (x.header.length >= 148 && x.Xdsdt) { | ||
| 234 | addr = (unsigned long)x.Xdsdt; | ||
| 235 | if (connect) { | ||
| 236 | x.Xdsdt = lseek(fd, 0, SEEK_CUR); | ||
| 237 | } | ||
| 238 | } else if (x.header.length >= 44 && x.dsdt) { | ||
| 239 | addr = (unsigned long)x.dsdt; | ||
| 240 | if (connect) { | ||
| 241 | x.dsdt = lseek(fd, 0, SEEK_CUR); | ||
| 242 | } | ||
| 243 | } else { | ||
| 244 | fprintf(stderr, "No DSDT in FADT!\n"); | ||
| 245 | goto no_dsdt; | ||
| 246 | } | ||
| 247 | tbl = acpi_map_table(addr, DSDT_SIG); | ||
| 248 | if (!tbl) goto no_dsdt; | ||
| 249 | if (checksum((u8 *)tbl, tbl->length)) | ||
| 250 | fprintf(stderr, "Wrong checksum for DSDT!\n"); | ||
| 251 | write_table(fd, tbl, addr); | ||
| 252 | acpi_unmap_table(tbl); | ||
| 253 | no_dsdt: | ||
| 254 | if (x.header.length >= 140 && x.xfirmware_ctrl) { | ||
| 255 | addr = (unsigned long)x.xfirmware_ctrl; | ||
| 256 | if (connect) { | ||
| 257 | x.xfirmware_ctrl = lseek(fd, 0, SEEK_CUR); | ||
| 258 | } | ||
| 259 | } else if (x.header.length >= 40 && x.firmware_ctrl) { | ||
| 260 | addr = (unsigned long)x.firmware_ctrl; | ||
| 261 | if (connect) { | ||
| 262 | x.firmware_ctrl = lseek(fd, 0, SEEK_CUR); | ||
| 263 | } | ||
| 264 | } else { | ||
| 265 | fprintf(stderr, "No FACS in FADT!\n"); | ||
| 266 | goto no_facs; | ||
| 267 | } | ||
| 268 | tbl = acpi_map_table(addr, FACS_SIG); | ||
| 269 | if (!tbl) goto no_facs; | ||
| 270 | /* do not checksum FACS */ | ||
| 271 | write_table(fd, tbl, addr); | ||
| 272 | acpi_unmap_table(tbl); | ||
| 273 | no_facs: | ||
| 274 | write_table(fd, (struct acpi_table_header *)&x, xaddr); | ||
| 275 | } | ||
| 276 | |||
| 277 | static int acpi_dump_SDT(int fd, struct acpi_rsdp_descriptor *rsdp) | ||
| 278 | { | ||
| 279 | struct acpi_table_header *sdt, *tbl = 0; | ||
| 280 | int xsdt = 1, i, num; | ||
| 281 | char *offset; | ||
| 282 | unsigned long addr; | ||
| 283 | if (rsdp->revision > 1 && rsdp->xsdt_physical_address) { | ||
| 284 | tbl = acpi_map_table(rsdp->xsdt_physical_address, "XSDT"); | ||
| 285 | } | ||
| 286 | if (!tbl && rsdp->rsdt_physical_address) { | ||
| 287 | xsdt = 0; | ||
| 288 | tbl = acpi_map_table(rsdp->rsdt_physical_address, "RSDT"); | ||
| 289 | } | ||
| 290 | if (!tbl) return 0; | ||
| 291 | sdt = malloc(tbl->length); | ||
| 292 | memcpy(sdt, tbl, tbl->length); | ||
| 293 | acpi_unmap_table(tbl); | ||
| 294 | if (checksum((u8 *)sdt, sdt->length)) | ||
| 295 | fprintf(stderr, "Wrong checksum for %s!\n", (xsdt)?"XSDT":"RSDT"); | ||
| 296 | num = (sdt->length - sizeof(struct acpi_table_header))/((xsdt)?sizeof(u64):sizeof(u32)); | ||
| 297 | offset = (char *)sdt + sizeof(struct acpi_table_header); | ||
| 298 | for (i = 0; i < num; ++i, offset += ((xsdt) ? sizeof(u64) : sizeof(u32))) { | ||
| 299 | addr = (xsdt) ? (unsigned long)(*(u64 *)offset): | ||
| 300 | (unsigned long)(*(u32 *)offset); | ||
| 301 | if (!addr) continue; | ||
| 302 | tbl = acpi_map_table(addr, 0); | ||
| 303 | if (!tbl) continue; | ||
| 304 | if (!memcmp(tbl->signature, FADT_SIG, 4)) { | ||
| 305 | acpi_dump_FADT(fd, tbl, addr); | ||
| 306 | } else { | ||
| 307 | if (checksum((u8 *)tbl, tbl->length)) | ||
| 308 | fprintf(stderr, "Wrong checksum for generic table!\n"); | ||
| 309 | write_table(fd, tbl, addr); | ||
| 310 | } | ||
| 311 | acpi_unmap_table(tbl); | ||
| 312 | if (connect) { | ||
| 313 | if (xsdt) | ||
| 314 | (*(u64*)offset) = lseek(fd, 0, SEEK_CUR); | ||
| 315 | else | ||
| 316 | (*(u32*)offset) = lseek(fd, 0, SEEK_CUR); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | if (xsdt) { | ||
| 320 | addr = (unsigned long)rsdp->xsdt_physical_address; | ||
| 321 | if (connect) { | ||
| 322 | rsdp->xsdt_physical_address = lseek(fd, 0, SEEK_CUR); | ||
| 323 | } | ||
| 324 | } else { | ||
| 325 | addr = (unsigned long)rsdp->rsdt_physical_address; | ||
| 326 | if (connect) { | ||
| 327 | rsdp->rsdt_physical_address = lseek(fd, 0, SEEK_CUR); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | write_table(fd, sdt, addr); | ||
| 331 | free (sdt); | ||
| 332 | return 1; | ||
| 333 | } | ||
| 334 | |||
| 335 | #define DYNAMIC_SSDT "/sys/firmware/acpi/tables/dynamic" | ||
| 336 | |||
| 337 | static void acpi_dump_dynamic_SSDT(int fd) | ||
| 338 | { | ||
| 339 | struct stat file_stat; | ||
| 340 | char filename[256], *ptr; | ||
| 341 | DIR *tabledir; | ||
| 342 | struct dirent *entry; | ||
| 343 | FILE *fp; | ||
| 344 | int count, readcount, length; | ||
| 345 | struct acpi_table_header table_header, *ptable; | ||
| 346 | |||
| 347 | if (stat(DYNAMIC_SSDT, &file_stat) == -1) { | ||
| 348 | /* The directory doesn't exist */ | ||
| 349 | return; | ||
| 350 | } | ||
| 351 | tabledir = opendir(DYNAMIC_SSDT); | ||
| 352 | if(!tabledir){ | ||
| 353 | /*can't open the directory */ | ||
| 354 | return; | ||
| 355 | } | ||
| 356 | |||
| 357 | while ((entry = readdir(tabledir)) != 0){ | ||
| 358 | /* skip the file of . /.. */ | ||
| 359 | if (entry->d_name[0] == '.') | ||
| 360 | continue; | ||
| 361 | |||
| 362 | sprintf(filename, "%s/%s", DYNAMIC_SSDT, entry->d_name); | ||
| 363 | fp = fopen(filename, "r"); | ||
| 364 | if (fp == NULL) { | ||
| 365 | fprintf(stderr, "Can't open the file of %s\n", | ||
| 366 | filename); | ||
| 367 | continue; | ||
| 368 | } | ||
| 369 | /* Read the Table header to parse the table length */ | ||
| 370 | count = fread(&table_header, 1, sizeof(struct acpi_table_header), fp); | ||
| 371 | if (count < sizeof(table_header)) { | ||
| 372 | /* the length is lessn than ACPI table header. skip it */ | ||
| 373 | fclose(fp); | ||
| 374 | continue; | ||
| 375 | } | ||
| 376 | length = table_header.length; | ||
| 377 | ptr = malloc(table_header.length); | ||
| 378 | fseek(fp, 0, SEEK_SET); | ||
| 379 | readcount = 0; | ||
| 380 | while(!feof(fp) && readcount < length) { | ||
| 381 | count = fread(ptr + readcount, 1, 256, fp); | ||
| 382 | readcount += count; | ||
| 383 | } | ||
| 384 | fclose(fp); | ||
| 385 | ptable = (struct acpi_table_header *) ptr; | ||
| 386 | if (checksum((u8 *) ptable, ptable->length)) | ||
| 387 | fprintf(stderr, "Wrong checksum " | ||
| 388 | "for dynamic SSDT table!\n"); | ||
| 389 | write_table(fd, ptable, 0); | ||
| 390 | free(ptr); | ||
| 391 | } | ||
| 392 | closedir(tabledir); | ||
| 393 | return; | ||
| 394 | } | ||
| 395 | |||
| 396 | static void usage(const char *progname) | ||
| 397 | { | ||
| 398 | puts("Usage:"); | ||
| 399 | printf("%s [--addr 0x1234][--table DSDT][--output filename]" | ||
| 400 | "[--binary][--length 0x456][--help]\n", progname); | ||
| 401 | puts("\t--addr 0x1234 or -a 0x1234 -- look for tables at this physical address"); | ||
| 402 | puts("\t--table DSDT or -t DSDT -- only dump table with DSDT signature"); | ||
| 403 | puts("\t--output filename or -o filename -- redirect output from stdin to filename"); | ||
| 404 | puts("\t--binary or -b -- dump data in binary form rather than in hex-dump format"); | ||
| 405 | puts("\t--length 0x456 or -l 0x456 -- works only with --addr, dump physical memory" | ||
| 406 | "\n\t\tregion without trying to understand it's contents"); | ||
| 407 | puts("\t--skip 2 or -s 2 -- skip 2 tables of the given name and output only 3rd one"); | ||
| 408 | puts("\t--help or -h -- this help message"); | ||
| 409 | exit(0); | ||
| 410 | } | ||
| 411 | |||
| 412 | static struct option long_options[] = { | ||
| 413 | {"addr", 1, 0, 0}, | ||
| 414 | {"table", 1, 0, 0}, | ||
| 415 | {"output", 1, 0, 0}, | ||
| 416 | {"binary", 0, 0, 0}, | ||
| 417 | {"length", 1, 0, 0}, | ||
| 418 | {"skip", 1, 0, 0}, | ||
| 419 | {"help", 0, 0, 0}, | ||
| 420 | {0, 0, 0, 0} | ||
| 421 | }; | ||
| 422 | int main(int argc, char **argv) | ||
| 423 | { | ||
| 424 | int option_index, c, fd; | ||
| 425 | u8 *raw; | ||
| 426 | struct acpi_rsdp_descriptor rsdpx, *x = 0; | ||
| 427 | char *filename = 0; | ||
| 428 | char buff[80]; | ||
| 429 | memset(select_sig, 0, 4); | ||
| 430 | print = 1; | ||
| 431 | connect = 0; | ||
| 432 | addr = length = 0; | ||
| 433 | skip = 0; | ||
| 434 | while (1) { | ||
| 435 | option_index = 0; | ||
| 436 | c = getopt_long(argc, argv, "a:t:o:bl:s:h", | ||
| 437 | long_options, &option_index); | ||
| 438 | if (c == -1) | ||
| 439 | break; | ||
| 440 | |||
| 441 | switch (c) { | ||
| 442 | case 0: | ||
| 443 | switch (option_index) { | ||
| 444 | case 0: | ||
| 445 | addr = strtoul(optarg, (char **)NULL, 16); | ||
| 446 | break; | ||
| 447 | case 1: | ||
| 448 | memcpy(select_sig, optarg, 4); | ||
| 449 | break; | ||
| 450 | case 2: | ||
| 451 | filename = optarg; | ||
| 452 | break; | ||
| 453 | case 3: | ||
| 454 | print = 0; | ||
| 455 | break; | ||
| 456 | case 4: | ||
| 457 | length = strtoul(optarg, (char **)NULL, 16); | ||
| 458 | break; | ||
| 459 | case 5: | ||
| 460 | skip = strtoul(optarg, (char **)NULL, 10); | ||
| 461 | break; | ||
| 462 | case 6: | ||
| 463 | usage(argv[0]); | ||
| 464 | exit(0); | ||
| 465 | } | ||
| 466 | break; | ||
| 467 | case 'a': | ||
| 468 | addr = strtoul(optarg, (char **)NULL, 16); | ||
| 469 | break; | ||
| 470 | case 't': | ||
| 471 | memcpy(select_sig, optarg, 4); | ||
| 472 | break; | ||
| 473 | case 'o': | ||
| 474 | filename = optarg; | ||
| 475 | break; | ||
| 476 | case 'b': | ||
| 477 | print = 0; | ||
| 478 | break; | ||
| 479 | case 'l': | ||
| 480 | length = strtoul(optarg, (char **)NULL, 16); | ||
| 481 | break; | ||
| 482 | case 's': | ||
| 483 | skip = strtoul(optarg, (char **)NULL, 10); | ||
| 484 | break; | ||
| 485 | case 'h': | ||
| 486 | usage(argv[0]); | ||
| 487 | exit(0); | ||
| 488 | default: | ||
| 489 | printf("Unknown option!\n"); | ||
| 490 | usage(argv[0]); | ||
| 491 | exit(0); | ||
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 | fd = STDOUT_FILENO; | ||
| 496 | if (filename) { | ||
| 497 | fd = creat(filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); | ||
| 498 | if (fd < 0) | ||
| 499 | return fd; | ||
| 500 | } | ||
| 501 | |||
| 502 | if (!select_sig[0] && !print) { | ||
| 503 | connect = 1; | ||
| 504 | } | ||
| 505 | |||
| 506 | psz = sysconf(_SC_PAGESIZE); | ||
| 507 | if (length && addr) { | ||
| 508 | /* We know length and address, it means we just want a memory dump */ | ||
| 509 | if (!(raw = acpi_map_memory(addr, length))) | ||
| 510 | goto not_found; | ||
| 511 | write(fd, raw, length); | ||
| 512 | acpi_unmap_memory(raw, length); | ||
| 513 | close(fd); | ||
| 514 | return 0; | ||
| 515 | } | ||
| 516 | |||
| 517 | length = sizeof(struct acpi_rsdp_descriptor); | ||
| 518 | if (!addr) { | ||
| 519 | addr = read_efi_systab(); | ||
| 520 | if (!addr) { | ||
| 521 | addr = ACPI_HI_RSDP_WINDOW_BASE; | ||
| 522 | length = ACPI_HI_RSDP_WINDOW_SIZE; | ||
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 526 | if (!(raw = acpi_map_memory(addr, length)) || | ||
| 527 | !(x = acpi_scan_for_rsdp(raw, length))) | ||
| 528 | goto not_found; | ||
| 529 | |||
| 530 | /* Find RSDP and print all found tables */ | ||
| 531 | memcpy(&rsdpx, x, sizeof(struct acpi_rsdp_descriptor)); | ||
| 532 | acpi_unmap_memory(raw, length); | ||
| 533 | if (connect) { | ||
| 534 | lseek(fd, sizeof(struct acpi_rsdp_descriptor), SEEK_SET); | ||
| 535 | } | ||
| 536 | if (!acpi_dump_SDT(fd, &rsdpx)) | ||
| 537 | goto not_found; | ||
| 538 | if (connect) { | ||
| 539 | lseek(fd, 0, SEEK_SET); | ||
| 540 | write(fd, x, (rsdpx.revision < 2) ? | ||
| 541 | ACPI_RSDP_CHECKSUM_LENGTH : ACPI_RSDP_XCHECKSUM_LENGTH); | ||
| 542 | } else if (!select_sig[0] || !memcmp("RSD PTR ", select_sig, 4)) { | ||
| 543 | addr += (long)x - (long)raw; | ||
| 544 | length = snprintf(buff, 80, "RSD PTR @ %p\n", (void *)addr); | ||
| 545 | write(fd, buff, length); | ||
| 546 | acpi_show_data(fd, (u8 *) & rsdpx, (rsdpx.revision < 2) ? | ||
| 547 | ACPI_RSDP_CHECKSUM_LENGTH : ACPI_RSDP_XCHECKSUM_LENGTH); | ||
| 548 | buff[0] = '\n'; | ||
| 549 | write(fd, buff, 1); | ||
| 550 | } | ||
| 551 | acpi_dump_dynamic_SSDT(fd); | ||
| 552 | close(fd); | ||
| 553 | return 0; | ||
| 554 | not_found: | ||
| 555 | close(fd); | ||
| 556 | fprintf(stderr, "ACPI tables were not found. If you know location " | ||
| 557 | "of RSD PTR table (from dmesg, etc), " | ||
| 558 | "supply it with either --addr or -a option\n"); | ||
| 559 | return 1; | ||
| 560 | } | ||
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8 index 74e44507dfe9..e4d0690cccf9 100644 --- a/tools/power/x86/turbostat/turbostat.8 +++ b/tools/power/x86/turbostat/turbostat.8 | |||
| @@ -4,15 +4,11 @@ turbostat \- Report processor frequency and idle statistics | |||
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| 5 | .ft B | 5 | .ft B |
| 6 | .B turbostat | 6 | .B turbostat |
| 7 | .RB [ "\-s" ] | 7 | .RB [ Options ] |
| 8 | .RB [ "\-v" ] | ||
| 9 | .RB [ "\-M MSR#" ] | ||
| 10 | .RB command | 8 | .RB command |
| 11 | .br | 9 | .br |
| 12 | .B turbostat | 10 | .B turbostat |
| 13 | .RB [ "\-s" ] | 11 | .RB [ Options ] |
| 14 | .RB [ "\-v" ] | ||
| 15 | .RB [ "\-M MSR#" ] | ||
| 16 | .RB [ "\-i interval_sec" ] | 12 | .RB [ "\-i interval_sec" ] |
| 17 | .SH DESCRIPTION | 13 | .SH DESCRIPTION |
| 18 | \fBturbostat \fP reports processor topology, frequency | 14 | \fBturbostat \fP reports processor topology, frequency |
| @@ -27,16 +23,23 @@ supports an "invariant" TSC, plus the APERF and MPERF MSRs. | |||
| 27 | on processors that additionally support C-state residency counters. | 23 | on processors that additionally support C-state residency counters. |
| 28 | 24 | ||
| 29 | .SS Options | 25 | .SS Options |
| 30 | The \fB-s\fP option limits output to a 1-line system summary for each interval. | 26 | The \fB-p\fP option limits output to the 1st thread in 1st core of each package. |
| 31 | .PP | 27 | .PP |
| 32 | The \fB-c\fP option limits output to the 1st thread in each core. | 28 | The \fB-P\fP option limits output to the 1st thread in each Package. |
| 33 | .PP | 29 | .PP |
| 34 | The \fB-p\fP option limits output to the 1st thread in each package. | 30 | The \fB-S\fP option limits output to a 1-line System Summary for each interval. |
| 35 | .PP | 31 | .PP |
| 36 | The \fB-v\fP option increases verbosity. | 32 | The \fB-v\fP option increases verbosity. |
| 37 | .PP | 33 | .PP |
| 38 | The \fB-M MSR#\fP option dumps the specified MSR, | 34 | The \fB-s\fP option prints the SMI counter, equivalent to "-c 0x34" |
| 39 | in addition to the usual frequency and idle statistics. | 35 | .PP |
| 36 | The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter. | ||
| 37 | .PP | ||
| 38 | The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter. | ||
| 39 | .PP | ||
| 40 | The \fB-m MSR#\fP option includes the the specified 32-bit MSR value. | ||
| 41 | .PP | ||
| 42 | The \fB-M MSR#\fP option includes the the specified 64-bit MSR value. | ||
| 40 | .PP | 43 | .PP |
| 41 | The \fB-i interval_sec\fP option prints statistics every \fiinterval_sec\fP seconds. | 44 | The \fB-i interval_sec\fP option prints statistics every \fiinterval_sec\fP seconds. |
| 42 | The default is 5 seconds. | 45 | The default is 5 seconds. |
| @@ -150,6 +153,29 @@ Note that turbostat reports average GHz of 3.63, while | |||
| 150 | the arithmetic average of the GHz column above is lower. | 153 | the arithmetic average of the GHz column above is lower. |
| 151 | This is a weighted average, where the weight is %c0. ie. it is the total number of | 154 | This is a weighted average, where the weight is %c0. ie. it is the total number of |
| 152 | un-halted cycles elapsed per time divided by the number of CPUs. | 155 | un-halted cycles elapsed per time divided by the number of CPUs. |
| 156 | .SH SMI COUNTING EXAMPLE | ||
| 157 | On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. | ||
| 158 | Using the -m option, you can display how many SMIs have fired since reset, or if there | ||
| 159 | are SMIs during the measurement interval, you can display the delta using the -d option. | ||
| 160 | .nf | ||
| 161 | [root@x980 ~]# turbostat -m 0x34 | ||
| 162 | cor CPU %c0 GHz TSC MSR 0x034 %c1 %c3 %c6 %pc3 %pc6 | ||
| 163 | 1.41 1.82 3.38 0x00000000 8.92 37.82 51.85 17.37 0.55 | ||
| 164 | 0 0 3.73 2.03 3.38 0x00000055 1.72 48.25 46.31 17.38 0.55 | ||
| 165 | 0 6 0.14 1.63 3.38 0x00000056 5.30 | ||
| 166 | 1 2 2.51 1.80 3.38 0x00000056 15.65 29.33 52.52 | ||
| 167 | 1 8 0.10 1.65 3.38 0x00000056 18.05 | ||
| 168 | 2 4 1.16 1.68 3.38 0x00000056 5.87 24.47 68.50 | ||
| 169 | 2 10 0.10 1.63 3.38 0x00000056 6.93 | ||
| 170 | 8 1 3.84 1.91 3.38 0x00000056 1.36 50.65 44.16 | ||
| 171 | 8 7 0.08 1.64 3.38 0x00000056 5.12 | ||
| 172 | 9 3 1.82 1.73 3.38 0x00000056 7.59 24.21 66.38 | ||
| 173 | 9 9 0.09 1.68 3.38 0x00000056 9.32 | ||
| 174 | 10 5 1.66 1.65 3.38 0x00000056 15.10 50.00 33.23 | ||
| 175 | 10 11 1.72 1.65 3.38 0x00000056 15.05 | ||
| 176 | ^C | ||
| 177 | [root@x980 ~]# | ||
| 178 | .fi | ||
| 153 | .SH NOTES | 179 | .SH NOTES |
| 154 | 180 | ||
| 155 | .B "turbostat " | 181 | .B "turbostat " |
| @@ -165,6 +191,13 @@ may work poorly on Linux-2.6.20 through 2.6.29, | |||
| 165 | as \fBacpi-cpufreq \fPperiodically cleared the APERF and MPERF | 191 | as \fBacpi-cpufreq \fPperiodically cleared the APERF and MPERF |
| 166 | in those kernels. | 192 | in those kernels. |
| 167 | 193 | ||
| 194 | If the TSC column does not make sense, then | ||
| 195 | the other numbers will also make no sense. | ||
| 196 | Turbostat is lightweight, and its data collection is not atomic. | ||
| 197 | These issues are usually caused by an extremely short measurement | ||
| 198 | interval (much less than 1 second), or system activity that prevents | ||
| 199 | turbostat from being able to run on all CPUS to quickly collect data. | ||
| 200 | |||
| 168 | The APERF, MPERF MSRs are defined to count non-halted cycles. | 201 | The APERF, MPERF MSRs are defined to count non-halted cycles. |
| 169 | Although it is not guaranteed by the architecture, turbostat assumes | 202 | Although it is not guaranteed by the architecture, turbostat assumes |
| 170 | that they count at TSC rate, which is true on all processors tested to date. | 203 | that they count at TSC rate, which is true on all processors tested to date. |
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 861d77190206..2655ae9a3ad8 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
| @@ -35,9 +35,9 @@ | |||
| 35 | #include <ctype.h> | 35 | #include <ctype.h> |
| 36 | #include <sched.h> | 36 | #include <sched.h> |
| 37 | 37 | ||
| 38 | #define MSR_TSC 0x10 | ||
| 39 | #define MSR_NEHALEM_PLATFORM_INFO 0xCE | 38 | #define MSR_NEHALEM_PLATFORM_INFO 0xCE |
| 40 | #define MSR_NEHALEM_TURBO_RATIO_LIMIT 0x1AD | 39 | #define MSR_NEHALEM_TURBO_RATIO_LIMIT 0x1AD |
| 40 | #define MSR_IVT_TURBO_RATIO_LIMIT 0x1AE | ||
| 41 | #define MSR_APERF 0xE8 | 41 | #define MSR_APERF 0xE8 |
| 42 | #define MSR_MPERF 0xE7 | 42 | #define MSR_MPERF 0xE7 |
| 43 | #define MSR_PKG_C2_RESIDENCY 0x60D /* SNB only */ | 43 | #define MSR_PKG_C2_RESIDENCY 0x60D /* SNB only */ |
| @@ -62,7 +62,11 @@ unsigned int genuine_intel; | |||
| 62 | unsigned int has_invariant_tsc; | 62 | unsigned int has_invariant_tsc; |
| 63 | unsigned int do_nehalem_platform_info; | 63 | unsigned int do_nehalem_platform_info; |
| 64 | unsigned int do_nehalem_turbo_ratio_limit; | 64 | unsigned int do_nehalem_turbo_ratio_limit; |
| 65 | unsigned int extra_msr_offset; | 65 | unsigned int do_ivt_turbo_ratio_limit; |
| 66 | unsigned int extra_msr_offset32; | ||
| 67 | unsigned int extra_msr_offset64; | ||
| 68 | unsigned int extra_delta_offset32; | ||
| 69 | unsigned int extra_delta_offset64; | ||
| 66 | double bclk; | 70 | double bclk; |
| 67 | unsigned int show_pkg; | 71 | unsigned int show_pkg; |
| 68 | unsigned int show_core; | 72 | unsigned int show_core; |
| @@ -83,7 +87,10 @@ struct thread_data { | |||
| 83 | unsigned long long aperf; | 87 | unsigned long long aperf; |
| 84 | unsigned long long mperf; | 88 | unsigned long long mperf; |
| 85 | unsigned long long c1; /* derived */ | 89 | unsigned long long c1; /* derived */ |
| 86 | unsigned long long extra_msr; | 90 | unsigned long long extra_msr64; |
| 91 | unsigned long long extra_delta64; | ||
| 92 | unsigned long long extra_msr32; | ||
| 93 | unsigned long long extra_delta32; | ||
| 87 | unsigned int cpu_id; | 94 | unsigned int cpu_id; |
| 88 | unsigned int flags; | 95 | unsigned int flags; |
| 89 | #define CPU_IS_FIRST_THREAD_IN_CORE 0x2 | 96 | #define CPU_IS_FIRST_THREAD_IN_CORE 0x2 |
| @@ -222,6 +229,14 @@ void print_header(void) | |||
| 222 | if (has_aperf) | 229 | if (has_aperf) |
| 223 | outp += sprintf(outp, " GHz"); | 230 | outp += sprintf(outp, " GHz"); |
| 224 | outp += sprintf(outp, " TSC"); | 231 | outp += sprintf(outp, " TSC"); |
| 232 | if (extra_delta_offset32) | ||
| 233 | outp += sprintf(outp, " count 0x%03X", extra_delta_offset32); | ||
| 234 | if (extra_delta_offset64) | ||
| 235 | outp += sprintf(outp, " COUNT 0x%03X", extra_delta_offset64); | ||
| 236 | if (extra_msr_offset32) | ||
| 237 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset32); | ||
| 238 | if (extra_msr_offset64) | ||
| 239 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); | ||
| 225 | if (do_nhm_cstates) | 240 | if (do_nhm_cstates) |
| 226 | outp += sprintf(outp, " %%c1"); | 241 | outp += sprintf(outp, " %%c1"); |
| 227 | if (do_nhm_cstates) | 242 | if (do_nhm_cstates) |
| @@ -238,8 +253,6 @@ void print_header(void) | |||
| 238 | outp += sprintf(outp, " %%pc6"); | 253 | outp += sprintf(outp, " %%pc6"); |
| 239 | if (do_snb_cstates) | 254 | if (do_snb_cstates) |
| 240 | outp += sprintf(outp, " %%pc7"); | 255 | outp += sprintf(outp, " %%pc7"); |
| 241 | if (extra_msr_offset) | ||
| 242 | outp += sprintf(outp, " MSR 0x%x ", extra_msr_offset); | ||
| 243 | 256 | ||
| 244 | outp += sprintf(outp, "\n"); | 257 | outp += sprintf(outp, "\n"); |
| 245 | } | 258 | } |
| @@ -255,8 +268,14 @@ int dump_counters(struct thread_data *t, struct core_data *c, | |||
| 255 | fprintf(stderr, "aperf: %016llX\n", t->aperf); | 268 | fprintf(stderr, "aperf: %016llX\n", t->aperf); |
| 256 | fprintf(stderr, "mperf: %016llX\n", t->mperf); | 269 | fprintf(stderr, "mperf: %016llX\n", t->mperf); |
| 257 | fprintf(stderr, "c1: %016llX\n", t->c1); | 270 | fprintf(stderr, "c1: %016llX\n", t->c1); |
| 271 | fprintf(stderr, "msr0x%x: %08llX\n", | ||
| 272 | extra_delta_offset32, t->extra_delta32); | ||
| 258 | fprintf(stderr, "msr0x%x: %016llX\n", | 273 | fprintf(stderr, "msr0x%x: %016llX\n", |
| 259 | extra_msr_offset, t->extra_msr); | 274 | extra_delta_offset64, t->extra_delta64); |
| 275 | fprintf(stderr, "msr0x%x: %08llX\n", | ||
| 276 | extra_msr_offset32, t->extra_msr32); | ||
| 277 | fprintf(stderr, "msr0x%x: %016llX\n", | ||
| 278 | extra_msr_offset64, t->extra_msr64); | ||
| 260 | } | 279 | } |
| 261 | 280 | ||
| 262 | if (c) { | 281 | if (c) { |
| @@ -360,6 +379,21 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 360 | /* TSC */ | 379 | /* TSC */ |
| 361 | outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); | 380 | outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); |
| 362 | 381 | ||
| 382 | /* delta */ | ||
| 383 | if (extra_delta_offset32) | ||
| 384 | outp += sprintf(outp, " %11llu", t->extra_delta32); | ||
| 385 | |||
| 386 | /* DELTA */ | ||
| 387 | if (extra_delta_offset64) | ||
| 388 | outp += sprintf(outp, " %11llu", t->extra_delta64); | ||
| 389 | /* msr */ | ||
| 390 | if (extra_msr_offset32) | ||
| 391 | outp += sprintf(outp, " 0x%08llx", t->extra_msr32); | ||
| 392 | |||
| 393 | /* MSR */ | ||
| 394 | if (extra_msr_offset64) | ||
| 395 | outp += sprintf(outp, " 0x%016llx", t->extra_msr64); | ||
| 396 | |||
| 363 | if (do_nhm_cstates) { | 397 | if (do_nhm_cstates) { |
| 364 | if (!skip_c1) | 398 | if (!skip_c1) |
| 365 | outp += sprintf(outp, " %6.2f", 100.0 * t->c1/t->tsc); | 399 | outp += sprintf(outp, " %6.2f", 100.0 * t->c1/t->tsc); |
| @@ -391,8 +425,6 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 391 | if (do_snb_cstates) | 425 | if (do_snb_cstates) |
| 392 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); | 426 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); |
| 393 | done: | 427 | done: |
| 394 | if (extra_msr_offset) | ||
| 395 | outp += sprintf(outp, " 0x%016llx", t->extra_msr); | ||
| 396 | outp += sprintf(outp, "\n"); | 428 | outp += sprintf(outp, "\n"); |
| 397 | 429 | ||
| 398 | return 0; | 430 | return 0; |
| @@ -502,10 +534,16 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
| 502 | old->mperf = 1; /* divide by 0 protection */ | 534 | old->mperf = 1; /* divide by 0 protection */ |
| 503 | } | 535 | } |
| 504 | 536 | ||
| 537 | old->extra_delta32 = new->extra_delta32 - old->extra_delta32; | ||
| 538 | old->extra_delta32 &= 0xFFFFFFFF; | ||
| 539 | |||
| 540 | old->extra_delta64 = new->extra_delta64 - old->extra_delta64; | ||
| 541 | |||
| 505 | /* | 542 | /* |
| 506 | * for "extra msr", just copy the latest w/o subtracting | 543 | * Extra MSR is just a snapshot, simply copy latest w/o subtracting |
| 507 | */ | 544 | */ |
| 508 | old->extra_msr = new->extra_msr; | 545 | old->extra_msr32 = new->extra_msr32; |
| 546 | old->extra_msr64 = new->extra_msr64; | ||
| 509 | } | 547 | } |
| 510 | 548 | ||
| 511 | int delta_cpu(struct thread_data *t, struct core_data *c, | 549 | int delta_cpu(struct thread_data *t, struct core_data *c, |
| @@ -533,6 +571,9 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data | |||
| 533 | t->mperf = 0; | 571 | t->mperf = 0; |
| 534 | t->c1 = 0; | 572 | t->c1 = 0; |
| 535 | 573 | ||
| 574 | t->extra_delta32 = 0; | ||
| 575 | t->extra_delta64 = 0; | ||
| 576 | |||
| 536 | /* tells format_counters to dump all fields from this set */ | 577 | /* tells format_counters to dump all fields from this set */ |
| 537 | t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE; | 578 | t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE; |
| 538 | 579 | ||
| @@ -553,6 +594,9 @@ int sum_counters(struct thread_data *t, struct core_data *c, | |||
| 553 | average.threads.mperf += t->mperf; | 594 | average.threads.mperf += t->mperf; |
| 554 | average.threads.c1 += t->c1; | 595 | average.threads.c1 += t->c1; |
| 555 | 596 | ||
| 597 | average.threads.extra_delta32 += t->extra_delta32; | ||
| 598 | average.threads.extra_delta64 += t->extra_delta64; | ||
| 599 | |||
| 556 | /* sum per-core values only for 1st thread in core */ | 600 | /* sum per-core values only for 1st thread in core */ |
| 557 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 601 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
| 558 | return 0; | 602 | return 0; |
| @@ -588,6 +632,11 @@ void compute_average(struct thread_data *t, struct core_data *c, | |||
| 588 | average.threads.mperf /= topo.num_cpus; | 632 | average.threads.mperf /= topo.num_cpus; |
| 589 | average.threads.c1 /= topo.num_cpus; | 633 | average.threads.c1 /= topo.num_cpus; |
| 590 | 634 | ||
| 635 | average.threads.extra_delta32 /= topo.num_cpus; | ||
| 636 | average.threads.extra_delta32 &= 0xFFFFFFFF; | ||
| 637 | |||
| 638 | average.threads.extra_delta64 /= topo.num_cpus; | ||
| 639 | |||
| 591 | average.cores.c3 /= topo.num_cores; | 640 | average.cores.c3 /= topo.num_cores; |
| 592 | average.cores.c6 /= topo.num_cores; | 641 | average.cores.c6 /= topo.num_cores; |
| 593 | average.cores.c7 /= topo.num_cores; | 642 | average.cores.c7 /= topo.num_cores; |
| @@ -629,8 +678,24 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 629 | return -4; | 678 | return -4; |
| 630 | } | 679 | } |
| 631 | 680 | ||
| 632 | if (extra_msr_offset) | 681 | if (extra_delta_offset32) { |
| 633 | if (get_msr(cpu, extra_msr_offset, &t->extra_msr)) | 682 | if (get_msr(cpu, extra_delta_offset32, &t->extra_delta32)) |
| 683 | return -5; | ||
| 684 | t->extra_delta32 &= 0xFFFFFFFF; | ||
| 685 | } | ||
| 686 | |||
| 687 | if (extra_delta_offset64) | ||
| 688 | if (get_msr(cpu, extra_delta_offset64, &t->extra_delta64)) | ||
| 689 | return -5; | ||
| 690 | |||
| 691 | if (extra_msr_offset32) { | ||
| 692 | if (get_msr(cpu, extra_msr_offset32, &t->extra_msr32)) | ||
| 693 | return -5; | ||
| 694 | t->extra_msr32 &= 0xFFFFFFFF; | ||
| 695 | } | ||
| 696 | |||
| 697 | if (extra_msr_offset64) | ||
| 698 | if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64)) | ||
| 634 | return -5; | 699 | return -5; |
| 635 | 700 | ||
| 636 | /* collect core counters only for 1st thread in core */ | 701 | /* collect core counters only for 1st thread in core */ |
| @@ -677,6 +742,9 @@ void print_verbose_header(void) | |||
| 677 | 742 | ||
| 678 | get_msr(0, MSR_NEHALEM_PLATFORM_INFO, &msr); | 743 | get_msr(0, MSR_NEHALEM_PLATFORM_INFO, &msr); |
| 679 | 744 | ||
| 745 | if (verbose > 1) | ||
| 746 | fprintf(stderr, "MSR_NEHALEM_PLATFORM_INFO: 0x%llx\n", msr); | ||
| 747 | |||
| 680 | ratio = (msr >> 40) & 0xFF; | 748 | ratio = (msr >> 40) & 0xFF; |
| 681 | fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency\n", | 749 | fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency\n", |
| 682 | ratio, bclk, ratio * bclk); | 750 | ratio, bclk, ratio * bclk); |
| @@ -685,14 +753,84 @@ void print_verbose_header(void) | |||
| 685 | fprintf(stderr, "%d * %.0f = %.0f MHz TSC frequency\n", | 753 | fprintf(stderr, "%d * %.0f = %.0f MHz TSC frequency\n", |
| 686 | ratio, bclk, ratio * bclk); | 754 | ratio, bclk, ratio * bclk); |
| 687 | 755 | ||
| 756 | if (!do_ivt_turbo_ratio_limit) | ||
| 757 | goto print_nhm_turbo_ratio_limits; | ||
| 758 | |||
| 759 | get_msr(0, MSR_IVT_TURBO_RATIO_LIMIT, &msr); | ||
| 760 | |||
| 688 | if (verbose > 1) | 761 | if (verbose > 1) |
| 689 | fprintf(stderr, "MSR_NEHALEM_PLATFORM_INFO: 0x%llx\n", msr); | 762 | fprintf(stderr, "MSR_IVT_TURBO_RATIO_LIMIT: 0x%llx\n", msr); |
| 763 | |||
| 764 | ratio = (msr >> 56) & 0xFF; | ||
| 765 | if (ratio) | ||
| 766 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 16 active cores\n", | ||
| 767 | ratio, bclk, ratio * bclk); | ||
| 768 | |||
| 769 | ratio = (msr >> 48) & 0xFF; | ||
| 770 | if (ratio) | ||
| 771 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 15 active cores\n", | ||
| 772 | ratio, bclk, ratio * bclk); | ||
| 773 | |||
| 774 | ratio = (msr >> 40) & 0xFF; | ||
| 775 | if (ratio) | ||
| 776 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 14 active cores\n", | ||
| 777 | ratio, bclk, ratio * bclk); | ||
| 778 | |||
| 779 | ratio = (msr >> 32) & 0xFF; | ||
| 780 | if (ratio) | ||
| 781 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 13 active cores\n", | ||
| 782 | ratio, bclk, ratio * bclk); | ||
| 783 | |||
| 784 | ratio = (msr >> 24) & 0xFF; | ||
| 785 | if (ratio) | ||
| 786 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 12 active cores\n", | ||
| 787 | ratio, bclk, ratio * bclk); | ||
| 788 | |||
| 789 | ratio = (msr >> 16) & 0xFF; | ||
| 790 | if (ratio) | ||
| 791 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 11 active cores\n", | ||
| 792 | ratio, bclk, ratio * bclk); | ||
| 793 | |||
| 794 | ratio = (msr >> 8) & 0xFF; | ||
| 795 | if (ratio) | ||
| 796 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 10 active cores\n", | ||
| 797 | ratio, bclk, ratio * bclk); | ||
| 798 | |||
| 799 | ratio = (msr >> 0) & 0xFF; | ||
| 800 | if (ratio) | ||
| 801 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 9 active cores\n", | ||
| 802 | ratio, bclk, ratio * bclk); | ||
| 803 | |||
| 804 | print_nhm_turbo_ratio_limits: | ||
| 690 | 805 | ||
| 691 | if (!do_nehalem_turbo_ratio_limit) | 806 | if (!do_nehalem_turbo_ratio_limit) |
| 692 | return; | 807 | return; |
| 693 | 808 | ||
| 694 | get_msr(0, MSR_NEHALEM_TURBO_RATIO_LIMIT, &msr); | 809 | get_msr(0, MSR_NEHALEM_TURBO_RATIO_LIMIT, &msr); |
| 695 | 810 | ||
| 811 | if (verbose > 1) | ||
| 812 | fprintf(stderr, "MSR_NEHALEM_TURBO_RATIO_LIMIT: 0x%llx\n", msr); | ||
| 813 | |||
| 814 | ratio = (msr >> 56) & 0xFF; | ||
| 815 | if (ratio) | ||
| 816 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 8 active cores\n", | ||
| 817 | ratio, bclk, ratio * bclk); | ||
| 818 | |||
| 819 | ratio = (msr >> 48) & 0xFF; | ||
| 820 | if (ratio) | ||
| 821 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 7 active cores\n", | ||
| 822 | ratio, bclk, ratio * bclk); | ||
| 823 | |||
| 824 | ratio = (msr >> 40) & 0xFF; | ||
| 825 | if (ratio) | ||
| 826 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 6 active cores\n", | ||
| 827 | ratio, bclk, ratio * bclk); | ||
| 828 | |||
| 829 | ratio = (msr >> 32) & 0xFF; | ||
| 830 | if (ratio) | ||
| 831 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 5 active cores\n", | ||
| 832 | ratio, bclk, ratio * bclk); | ||
| 833 | |||
| 696 | ratio = (msr >> 24) & 0xFF; | 834 | ratio = (msr >> 24) & 0xFF; |
| 697 | if (ratio) | 835 | if (ratio) |
| 698 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 4 active cores\n", | 836 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 4 active cores\n", |
| @@ -712,7 +850,6 @@ void print_verbose_header(void) | |||
| 712 | if (ratio) | 850 | if (ratio) |
| 713 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 1 active cores\n", | 851 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 1 active cores\n", |
| 714 | ratio, bclk, ratio * bclk); | 852 | ratio, bclk, ratio * bclk); |
| 715 | |||
| 716 | } | 853 | } |
| 717 | 854 | ||
| 718 | void free_all_buffers(void) | 855 | void free_all_buffers(void) |
| @@ -1038,7 +1175,7 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model) | |||
| 1038 | case 0x2A: /* SNB */ | 1175 | case 0x2A: /* SNB */ |
| 1039 | case 0x2D: /* SNB Xeon */ | 1176 | case 0x2D: /* SNB Xeon */ |
| 1040 | case 0x3A: /* IVB */ | 1177 | case 0x3A: /* IVB */ |
| 1041 | case 0x3D: /* IVB Xeon */ | 1178 | case 0x3E: /* IVB Xeon */ |
| 1042 | return 1; | 1179 | return 1; |
| 1043 | case 0x2E: /* Nehalem-EX Xeon - Beckton */ | 1180 | case 0x2E: /* Nehalem-EX Xeon - Beckton */ |
| 1044 | case 0x2F: /* Westmere-EX Xeon - Eagleton */ | 1181 | case 0x2F: /* Westmere-EX Xeon - Eagleton */ |
| @@ -1046,6 +1183,22 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model) | |||
| 1046 | return 0; | 1183 | return 0; |
| 1047 | } | 1184 | } |
| 1048 | } | 1185 | } |
| 1186 | int has_ivt_turbo_ratio_limit(unsigned int family, unsigned int model) | ||
| 1187 | { | ||
| 1188 | if (!genuine_intel) | ||
| 1189 | return 0; | ||
| 1190 | |||
| 1191 | if (family != 6) | ||
| 1192 | return 0; | ||
| 1193 | |||
| 1194 | switch (model) { | ||
| 1195 | case 0x3E: /* IVB Xeon */ | ||
| 1196 | return 1; | ||
| 1197 | default: | ||
| 1198 | return 0; | ||
| 1199 | } | ||
| 1200 | } | ||
| 1201 | |||
| 1049 | 1202 | ||
| 1050 | int is_snb(unsigned int family, unsigned int model) | 1203 | int is_snb(unsigned int family, unsigned int model) |
| 1051 | { | 1204 | { |
| @@ -1056,7 +1209,7 @@ int is_snb(unsigned int family, unsigned int model) | |||
| 1056 | case 0x2A: | 1209 | case 0x2A: |
| 1057 | case 0x2D: | 1210 | case 0x2D: |
| 1058 | case 0x3A: /* IVB */ | 1211 | case 0x3A: /* IVB */ |
| 1059 | case 0x3D: /* IVB Xeon */ | 1212 | case 0x3E: /* IVB Xeon */ |
| 1060 | return 1; | 1213 | return 1; |
| 1061 | } | 1214 | } |
| 1062 | return 0; | 1215 | return 0; |
| @@ -1145,12 +1298,13 @@ void check_cpuid() | |||
| 1145 | bclk = discover_bclk(family, model); | 1298 | bclk = discover_bclk(family, model); |
| 1146 | 1299 | ||
| 1147 | do_nehalem_turbo_ratio_limit = has_nehalem_turbo_ratio_limit(family, model); | 1300 | do_nehalem_turbo_ratio_limit = has_nehalem_turbo_ratio_limit(family, model); |
| 1301 | do_ivt_turbo_ratio_limit = has_ivt_turbo_ratio_limit(family, model); | ||
| 1148 | } | 1302 | } |
| 1149 | 1303 | ||
| 1150 | 1304 | ||
| 1151 | void usage() | 1305 | void usage() |
| 1152 | { | 1306 | { |
| 1153 | fprintf(stderr, "%s: [-v] [-M MSR#] [-i interval_sec | command ...]\n", | 1307 | fprintf(stderr, "%s: [-v][-p|-P|-S][-c MSR# | -s]][-C MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n", |
| 1154 | progname); | 1308 | progname); |
| 1155 | exit(1); | 1309 | exit(1); |
| 1156 | } | 1310 | } |
| @@ -1440,15 +1594,15 @@ void cmdline(int argc, char **argv) | |||
| 1440 | 1594 | ||
| 1441 | progname = argv[0]; | 1595 | progname = argv[0]; |
| 1442 | 1596 | ||
| 1443 | while ((opt = getopt(argc, argv, "+cpsvi:M:")) != -1) { | 1597 | while ((opt = getopt(argc, argv, "+pPSvisc:sC:m:M:")) != -1) { |
| 1444 | switch (opt) { | 1598 | switch (opt) { |
| 1445 | case 'c': | 1599 | case 'p': |
| 1446 | show_core_only++; | 1600 | show_core_only++; |
| 1447 | break; | 1601 | break; |
| 1448 | case 'p': | 1602 | case 'P': |
| 1449 | show_pkg_only++; | 1603 | show_pkg_only++; |
| 1450 | break; | 1604 | break; |
| 1451 | case 's': | 1605 | case 'S': |
| 1452 | summary_only++; | 1606 | summary_only++; |
| 1453 | break; | 1607 | break; |
| 1454 | case 'v': | 1608 | case 'v': |
| @@ -1457,10 +1611,20 @@ void cmdline(int argc, char **argv) | |||
| 1457 | case 'i': | 1611 | case 'i': |
| 1458 | interval_sec = atoi(optarg); | 1612 | interval_sec = atoi(optarg); |
| 1459 | break; | 1613 | break; |
| 1614 | case 'c': | ||
| 1615 | sscanf(optarg, "%x", &extra_delta_offset32); | ||
| 1616 | break; | ||
| 1617 | case 's': | ||
| 1618 | extra_delta_offset32 = 0x34; /* SMI counter */ | ||
| 1619 | break; | ||
| 1620 | case 'C': | ||
| 1621 | sscanf(optarg, "%x", &extra_delta_offset64); | ||
| 1622 | break; | ||
| 1623 | case 'm': | ||
| 1624 | sscanf(optarg, "%x", &extra_msr_offset32); | ||
| 1625 | break; | ||
| 1460 | case 'M': | 1626 | case 'M': |
| 1461 | sscanf(optarg, "%x", &extra_msr_offset); | 1627 | sscanf(optarg, "%x", &extra_msr_offset64); |
| 1462 | if (verbose > 1) | ||
| 1463 | fprintf(stderr, "MSR 0x%X\n", extra_msr_offset); | ||
| 1464 | break; | 1628 | break; |
| 1465 | default: | 1629 | default: |
| 1466 | usage(); | 1630 | usage(); |
| @@ -1473,7 +1637,7 @@ int main(int argc, char **argv) | |||
| 1473 | cmdline(argc, argv); | 1637 | cmdline(argc, argv); |
| 1474 | 1638 | ||
| 1475 | if (verbose > 1) | 1639 | if (verbose > 1) |
| 1476 | fprintf(stderr, "turbostat v2.0 May 16, 2012" | 1640 | fprintf(stderr, "turbostat v2.1 October 6, 2012" |
| 1477 | " - Len Brown <lenb@kernel.org>\n"); | 1641 | " - Len Brown <lenb@kernel.org>\n"); |
| 1478 | 1642 | ||
| 1479 | turbostat_init(); | 1643 | turbostat_init(); |
