Merge remote-tracking branch 'origin/x86/urgent' into x86/vdso

Resolved Conflicts:
	arch/x86/vdso/vdso32-setup.c

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin 2014-05-21 17:38:22 -07:00
commit 94aca80897
195 changed files with 2270 additions and 1187 deletions

View file

@ -117,7 +117,7 @@ Description:
What: /sys/bus/pci/devices/.../vpd What: /sys/bus/pci/devices/.../vpd
Date: February 2008 Date: February 2008
Contact: Ben Hutchings <bhutchings@solarflare.com> Contact: Ben Hutchings <bwh@kernel.org>
Description: Description:
A file named vpd in a device directory will be a A file named vpd in a device directory will be a
binary file containing the Vital Product Data for the binary file containing the Vital Product Data for the

View file

@ -43,7 +43,7 @@ Example
clock-output-names = clock-output-names =
"tpu0", "mmcif1", "sdhi3", "sdhi2", "tpu0", "mmcif1", "sdhi3", "sdhi2",
"sdhi1", "sdhi0", "mmcif0"; "sdhi1", "sdhi0", "mmcif0";
renesas,clock-indices = < clock-indices = <
R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
R8A7790_CLK_MMCIF0 R8A7790_CLK_MMCIF0

View file

@ -2246,12 +2246,6 @@ L: linux-usb@vger.kernel.org
S: Maintained S: Maintained
F: drivers/usb/host/ohci-ep93xx.c F: drivers/usb/host/ohci-ep93xx.c
CIRRUS LOGIC CS4270 SOUND DRIVER
M: Timur Tabi <timur@tabi.org>
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
S: Odd Fixes
F: sound/soc/codecs/cs4270*
CIRRUS LOGIC AUDIO CODEC DRIVERS CIRRUS LOGIC AUDIO CODEC DRIVERS
M: Brian Austin <brian.austin@cirrus.com> M: Brian Austin <brian.austin@cirrus.com>
M: Paul Handrigan <Paul.Handrigan@cirrus.com> M: Paul Handrigan <Paul.Handrigan@cirrus.com>
@ -9116,6 +9110,9 @@ F: arch/um/os-Linux/drivers/
TURBOCHANNEL SUBSYSTEM TURBOCHANNEL SUBSYSTEM
M: "Maciej W. Rozycki" <macro@linux-mips.org> M: "Maciej W. Rozycki" <macro@linux-mips.org>
M: Ralf Baechle <ralf@linux-mips.org>
L: linux-mips@linux-mips.org
Q: http://patchwork.linux-mips.org/project/linux-mips/list/
S: Maintained S: Maintained
F: drivers/tc/ F: drivers/tc/
F: include/linux/tc.h F: include/linux/tc.h

View file

@ -1,7 +1,7 @@
VERSION = 3 VERSION = 3
PATCHLEVEL = 15 PATCHLEVEL = 15
SUBLEVEL = 0 SUBLEVEL = 0
EXTRAVERSION = -rc5 EXTRAVERSION = -rc6
NAME = Shuffling Zombie Juror NAME = Shuffling Zombie Juror
# *DOCUMENTATION* # *DOCUMENTATION*

View file

@ -244,7 +244,7 @@
&tve { &tve {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_vga_sync_1>; pinctrl-0 = <&pinctrl_vga_sync_1>;
i2c-ddc-bus = <&i2c3>; ddc-i2c-bus = <&i2c3>;
fsl,tve-mode = "vga"; fsl,tve-mode = "vga";
fsl,hsync-pin = <4>; fsl,hsync-pin = <4>;
fsl,vsync-pin = <6>; fsl,vsync-pin = <6>;

View file

@ -18,6 +18,7 @@
compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
memory@0 { memory@0 {
device_type = "memory";
reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
}; };

View file

@ -97,11 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc)
if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
return false; return false;
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
affinity = cpu_online_mask;
ret = true; ret = true;
}
/*
* when using forced irq_set_affinity we must ensure that the cpu
* being offlined is not present in the affinity mask, it may be
* selected as the target CPU otherwise
*/
affinity = cpu_online_mask;
c = irq_data_get_irq_chip(d); c = irq_data_get_irq_chip(d);
if (!c->irq_set_affinity) if (!c->irq_set_affinity)
pr_debug("IRQ%u: unable to set affinity\n", d->irq); pr_debug("IRQ%u: unable to set affinity\n", d->irq);

View file

@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd)
int pud_huge(pud_t pud) int pud_huge(pud_t pud)
{ {
#ifndef __PAGETABLE_PMD_FOLDED
return !(pud_val(pud) & PUD_TABLE_BIT); return !(pud_val(pud) & PUD_TABLE_BIT);
#else
return 0;
#endif
} }
int pmd_huge_support(void) int pmd_huge_support(void)

View file

@ -11,7 +11,7 @@
#define NR_syscalls 314 /* length of syscall table */ #define NR_syscalls 315 /* length of syscall table */
/* /*
* The following defines stop scripts/checksyscalls.sh from complaining about * The following defines stop scripts/checksyscalls.sh from complaining about

View file

@ -327,5 +327,6 @@
#define __NR_finit_module 1335 #define __NR_finit_module 1335
#define __NR_sched_setattr 1336 #define __NR_sched_setattr 1336
#define __NR_sched_getattr 1337 #define __NR_sched_getattr 1337
#define __NR_renameat2 1338
#endif /* _UAPI_ASM_IA64_UNISTD_H */ #endif /* _UAPI_ASM_IA64_UNISTD_H */

View file

@ -1775,6 +1775,7 @@ sys_call_table:
data8 sys_finit_module // 1335 data8 sys_finit_module // 1335
data8 sys_sched_setattr data8 sys_sched_setattr
data8 sys_sched_getattr data8 sys_sched_getattr
data8 sys_renameat2
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */

View file

@ -4,7 +4,7 @@
#include <uapi/asm/unistd.h> #include <uapi/asm/unistd.h>
#define NR_syscalls 351 #define NR_syscalls 352
#define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_OLD_STAT #define __ARCH_WANT_OLD_STAT

View file

@ -356,5 +356,6 @@
#define __NR_finit_module 348 #define __NR_finit_module 348
#define __NR_sched_setattr 349 #define __NR_sched_setattr 349
#define __NR_sched_getattr 350 #define __NR_sched_getattr 350
#define __NR_renameat2 351
#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ #endif /* _UAPI_ASM_M68K_UNISTD_H_ */

View file

@ -371,4 +371,5 @@ ENTRY(sys_call_table)
.long sys_finit_module .long sys_finit_module
.long sys_sched_setattr .long sys_sched_setattr
.long sys_sched_getattr /* 350 */ .long sys_sched_getattr /* 350 */
.long sys_renameat2

View file

@ -15,6 +15,7 @@ static inline void wr_fence(void)
volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE; volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE;
barrier(); barrier();
*flushptr = 0; *flushptr = 0;
barrier();
} }
#else /* CONFIG_METAG_META21 */ #else /* CONFIG_METAG_META21 */
@ -35,6 +36,7 @@ static inline void wr_fence(void)
*flushptr = 0; *flushptr = 0;
*flushptr = 0; *flushptr = 0;
*flushptr = 0; *flushptr = 0;
barrier();
} }
#endif /* !CONFIG_METAG_META21 */ #endif /* !CONFIG_METAG_META21 */
@ -68,6 +70,7 @@ static inline void fence(void)
volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK; volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK;
barrier(); barrier();
*flushptr = 0; *flushptr = 0;
barrier();
} }
#define smp_mb() fence() #define smp_mb() fence()
#define smp_rmb() fence() #define smp_rmb() fence()

View file

@ -22,6 +22,8 @@
/* Add an extra page of padding at the top of the stack for the guard page. */ /* Add an extra page of padding at the top of the stack for the guard page. */
#define STACK_TOP (TASK_SIZE - PAGE_SIZE) #define STACK_TOP (TASK_SIZE - PAGE_SIZE)
#define STACK_TOP_MAX STACK_TOP #define STACK_TOP_MAX STACK_TOP
/* Maximum virtual space for stack */
#define STACK_SIZE_MAX (CONFIG_MAX_STACK_SIZE_MB*1024*1024)
/* This decides where the kernel will search for a free chunk of vm /* This decides where the kernel will search for a free chunk of vm
* space during mmap's. * space during mmap's.

View file

@ -4,11 +4,11 @@ include include/uapi/asm-generic/Kbuild.asm
header-y += byteorder.h header-y += byteorder.h
header-y += ech.h header-y += ech.h
header-y += ptrace.h header-y += ptrace.h
header-y += resource.h
header-y += sigcontext.h header-y += sigcontext.h
header-y += siginfo.h header-y += siginfo.h
header-y += swab.h header-y += swab.h
header-y += unistd.h header-y += unistd.h
generic-y += mman.h generic-y += mman.h
generic-y += resource.h
generic-y += setup.h generic-y += setup.h

View file

@ -1,7 +0,0 @@
#ifndef _UAPI_METAG_RESOURCE_H
#define _UAPI_METAG_RESOURCE_H
#define _STK_LIM_MAX (1 << 28)
#include <asm-generic/resource.h>
#endif /* _UAPI_METAG_RESOURCE_H */

View file

@ -21,6 +21,7 @@
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/cpu-type.h>
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>

View file

@ -19,6 +19,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/cpu-type.h>
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/traps.h> #include <asm/traps.h>

View file

@ -6,4 +6,3 @@
lib-y += init.o memory.o cmdline.o identify.o console.o lib-y += init.o memory.o cmdline.o identify.o console.o
lib-$(CONFIG_32BIT) += locore.o lib-$(CONFIG_32BIT) += locore.o
lib-$(CONFIG_64BIT) += call_o32.o

View file

@ -1,89 +0,0 @@
/*
* O32 interface for the 64 (or N32) ABI.
*
* Copyright (C) 2002 Maciej W. Rozycki
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/asm.h>
#include <asm/regdef.h>
/* Maximum number of arguments supported. Must be even! */
#define O32_ARGC 32
/* Number of static registers we save. */
#define O32_STATC 11
/* Frame size for both of the above. */
#define O32_FRAMESZ (4 * O32_ARGC + SZREG * O32_STATC)
.text
/*
* O32 function call dispatcher, for interfacing 32-bit ROM routines.
*
* The standard 64 (N32) calling sequence is supported, with a0
* holding a function pointer, a1-a7 -- its first seven arguments
* and the stack -- remaining ones (up to O32_ARGC, including a1-a7).
* Static registers, gp and fp are preserved, v0 holds a result.
* This code relies on the called o32 function for sp and ra
* restoration and thus both this dispatcher and the current stack
* have to be placed in a KSEGx (or KUSEG) address space. Any
* pointers passed have to point to addresses within one of these
* spaces as well.
*/
NESTED(call_o32, O32_FRAMESZ, ra)
REG_SUBU sp,O32_FRAMESZ
REG_S ra,O32_FRAMESZ-1*SZREG(sp)
REG_S fp,O32_FRAMESZ-2*SZREG(sp)
REG_S gp,O32_FRAMESZ-3*SZREG(sp)
REG_S s7,O32_FRAMESZ-4*SZREG(sp)
REG_S s6,O32_FRAMESZ-5*SZREG(sp)
REG_S s5,O32_FRAMESZ-6*SZREG(sp)
REG_S s4,O32_FRAMESZ-7*SZREG(sp)
REG_S s3,O32_FRAMESZ-8*SZREG(sp)
REG_S s2,O32_FRAMESZ-9*SZREG(sp)
REG_S s1,O32_FRAMESZ-10*SZREG(sp)
REG_S s0,O32_FRAMESZ-11*SZREG(sp)
move jp,a0
sll a0,a1,zero
sll a1,a2,zero
sll a2,a3,zero
sll a3,a4,zero
sw a5,0x10(sp)
sw a6,0x14(sp)
sw a7,0x18(sp)
PTR_LA t0,O32_FRAMESZ(sp)
PTR_LA t1,0x1c(sp)
li t2,O32_ARGC-7
1:
lw t3,(t0)
REG_ADDU t0,SZREG
sw t3,(t1)
REG_SUBU t2,1
REG_ADDU t1,4
bnez t2,1b
jalr jp
REG_L s0,O32_FRAMESZ-11*SZREG(sp)
REG_L s1,O32_FRAMESZ-10*SZREG(sp)
REG_L s2,O32_FRAMESZ-9*SZREG(sp)
REG_L s3,O32_FRAMESZ-8*SZREG(sp)
REG_L s4,O32_FRAMESZ-7*SZREG(sp)
REG_L s5,O32_FRAMESZ-6*SZREG(sp)
REG_L s6,O32_FRAMESZ-5*SZREG(sp)
REG_L s7,O32_FRAMESZ-4*SZREG(sp)
REG_L gp,O32_FRAMESZ-3*SZREG(sp)
REG_L fp,O32_FRAMESZ-2*SZREG(sp)
REG_L ra,O32_FRAMESZ-1*SZREG(sp)
REG_ADDU sp,O32_FRAMESZ
jr ra
END(call_o32)

View file

@ -1,7 +1,7 @@
/* /*
* O32 interface for the 64 (or N32) ABI. * O32 interface for the 64 (or N32) ABI.
* *
* Copyright (C) 2002 Maciej W. Rozycki * Copyright (C) 2002, 2014 Maciej W. Rozycki
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -12,28 +12,37 @@
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/regdef.h> #include <asm/regdef.h>
/* O32 register size. */
#define O32_SZREG 4
/* Maximum number of arguments supported. Must be even! */ /* Maximum number of arguments supported. Must be even! */
#define O32_ARGC 32 #define O32_ARGC 32
/* Number of static registers we save. */ /* Number of static registers we save. */
#define O32_STATC 11 #define O32_STATC 11
/* Frame size for static register */ /* Argument area frame size. */
#define O32_FRAMESZ (SZREG * O32_STATC) #define O32_ARGSZ (O32_SZREG * O32_ARGC)
/* Frame size on new stack */ /* Static register save area frame size. */
#define O32_FRAMESZ_NEW (SZREG + 4 * O32_ARGC) #define O32_STATSZ (SZREG * O32_STATC)
/* Stack pointer register save area frame size. */
#define O32_SPSZ SZREG
/* Combined area frame size. */
#define O32_FRAMESZ (O32_ARGSZ + O32_SPSZ + O32_STATSZ)
/* Switched stack frame size. */
#define O32_NFRAMESZ (O32_ARGSZ + O32_SPSZ)
.text .text
/* /*
* O32 function call dispatcher, for interfacing 32-bit ROM routines. * O32 function call dispatcher, for interfacing 32-bit ROM routines.
* *
* The standard 64 (N32) calling sequence is supported, with a0 * The standard 64 (N32) calling sequence is supported, with a0 holding
* holding a function pointer, a1 a new stack pointer, a2-a7 -- its * a function pointer, a1 a pointer to the new stack to call the
* first six arguments and the stack -- remaining ones (up to O32_ARGC, * function with or 0 if no stack switching is requested, a2-a7 -- the
* including a2-a7). Static registers, gp and fp are preserved, v0 holds * function call's first six arguments, and the stack -- the remaining
* a result. This code relies on the called o32 function for sp and ra * arguments (up to O32_ARGC, including a2-a7). Static registers, gp
* restoration and this dispatcher has to be placed in a KSEGx (or KUSEG) * and fp are preserved, v0 holds the result. This code relies on the
* address space. Any pointers passed have to point to addresses within * called o32 function for sp and ra restoration and this dispatcher has
* one of these spaces as well. * to be placed in a KSEGx (or KUSEG) address space. Any pointers
* passed have to point to addresses within one of these spaces as well.
*/ */
NESTED(call_o32, O32_FRAMESZ, ra) NESTED(call_o32, O32_FRAMESZ, ra)
REG_SUBU sp,O32_FRAMESZ REG_SUBU sp,O32_FRAMESZ
@ -51,32 +60,36 @@ NESTED(call_o32, O32_FRAMESZ, ra)
REG_S s0,O32_FRAMESZ-11*SZREG(sp) REG_S s0,O32_FRAMESZ-11*SZREG(sp)
move jp,a0 move jp,a0
REG_SUBU s0,a1,O32_FRAMESZ_NEW
REG_S sp,O32_FRAMESZ_NEW-1*SZREG(s0) move fp,sp
beqz a1,0f
REG_SUBU fp,a1,O32_NFRAMESZ
0:
REG_S sp,O32_NFRAMESZ-1*SZREG(fp)
sll a0,a2,zero sll a0,a2,zero
sll a1,a3,zero sll a1,a3,zero
sll a2,a4,zero sll a2,a4,zero
sll a3,a5,zero sll a3,a5,zero
sw a6,0x10(s0) sw a6,4*O32_SZREG(fp)
sw a7,0x14(s0) sw a7,5*O32_SZREG(fp)
PTR_LA t0,O32_FRAMESZ(sp) PTR_LA t0,O32_FRAMESZ(sp)
PTR_LA t1,0x18(s0) PTR_LA t1,6*O32_SZREG(fp)
li t2,O32_ARGC-6 li t2,O32_ARGC-6
1: 1:
lw t3,(t0) lw t3,(t0)
REG_ADDU t0,SZREG REG_ADDU t0,SZREG
sw t3,(t1) sw t3,(t1)
REG_SUBU t2,1 REG_SUBU t2,1
REG_ADDU t1,4 REG_ADDU t1,O32_SZREG
bnez t2,1b bnez t2,1b
move sp,s0 move sp,fp
jalr jp jalr jp
REG_L sp,O32_FRAMESZ_NEW-1*SZREG(sp) REG_L sp,O32_NFRAMESZ-1*SZREG(sp)
REG_L s0,O32_FRAMESZ-11*SZREG(sp) REG_L s0,O32_FRAMESZ-11*SZREG(sp)
REG_L s1,O32_FRAMESZ-10*SZREG(sp) REG_L s1,O32_FRAMESZ-10*SZREG(sp)

View file

@ -40,7 +40,8 @@
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
static u8 o32_stk[16384]; /* O32 stack has to be 8-byte aligned. */
static u64 o32_stk[4096];
#define O32_STK &o32_stk[sizeof(o32_stk)] #define O32_STK &o32_stk[sizeof(o32_stk)]
#define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ #define __PROM_O32(fun, arg) fun arg __asm__(#fun); \

View file

@ -113,31 +113,31 @@ extern int (*__pmax_close)(int);
#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \ #define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
__asm__(#fun " = call_o32") __asm__(#fun " = call_o32")
int __DEC_PROM_O32(_rex_bootinit, (int (*)(void))); int __DEC_PROM_O32(_rex_bootinit, (int (*)(void), void *));
int __DEC_PROM_O32(_rex_bootread, (int (*)(void))); int __DEC_PROM_O32(_rex_bootread, (int (*)(void), void *));
int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *)); int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), void *, memmap *));
unsigned long *__DEC_PROM_O32(_rex_slot_address, unsigned long *__DEC_PROM_O32(_rex_slot_address,
(unsigned long *(*)(int), int)); (unsigned long *(*)(int), void *, int));
void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void))); void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void), void *));
int __DEC_PROM_O32(_rex_getsysid, (int (*)(void))); int __DEC_PROM_O32(_rex_getsysid, (int (*)(void), void *));
void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void))); void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void), void *));
int __DEC_PROM_O32(_prom_getchar, (int (*)(void))); int __DEC_PROM_O32(_prom_getchar, (int (*)(void), void *));
char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *)); char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), void *, char *));
int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...)); int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), void *, char *, ...));
#define rex_bootinit() _rex_bootinit(__rex_bootinit) #define rex_bootinit() _rex_bootinit(__rex_bootinit, NULL)
#define rex_bootread() _rex_bootread(__rex_bootread) #define rex_bootread() _rex_bootread(__rex_bootread, NULL)
#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x) #define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, NULL, x)
#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x) #define rex_slot_address(x) _rex_slot_address(__rex_slot_address, NULL, x)
#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo) #define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo, NULL)
#define rex_getsysid() _rex_getsysid(__rex_getsysid) #define rex_getsysid() _rex_getsysid(__rex_getsysid, NULL)
#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache) #define rex_clear_cache() _rex_clear_cache(__rex_clear_cache, NULL)
#define prom_getchar() _prom_getchar(__prom_getchar) #define prom_getchar() _prom_getchar(__prom_getchar, NULL)
#define prom_getenv(x) _prom_getenv(__prom_getenv, x) #define prom_getenv(x) _prom_getenv(__prom_getenv, NULL, x)
#define prom_printf(x...) _prom_printf(__prom_printf, x) #define prom_printf(x...) _prom_printf(__prom_printf, NULL, x)
#else /* !CONFIG_64BIT */ #else /* !CONFIG_64BIT */

View file

@ -1,56 +0,0 @@
/*
* Copyright (C) 2004 by Basler Vision Technologies AG
* Author: Thomas Koeller <thomas.koeller@baslerweb.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(_ASM_RM9K_OCD_H)
#define _ASM_RM9K_OCD_H
#include <linux/types.h>
#include <linux/spinlock.h>
#include <asm/io.h>
extern volatile void __iomem * const ocd_base;
extern volatile void __iomem * const titan_base;
#define ocd_addr(__x__) (ocd_base + (__x__))
#define titan_addr(__x__) (titan_base + (__x__))
#define scram_addr(__x__) (scram_base + (__x__))
/* OCD register access */
#define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
#define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
#define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
#define ocd_writel(__val__, __offs__) \
__raw_writel((__val__), ocd_addr(__offs__))
#define ocd_writew(__val__, __offs__) \
__raw_writew((__val__), ocd_addr(__offs__))
#define ocd_writeb(__val__, __offs__) \
__raw_writeb((__val__), ocd_addr(__offs__))
/* TITAN register access - 32 bit-wide only */
#define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
#define titan_writel(__val__, __offs__) \
__raw_writel((__val__), titan_addr(__offs__))
/* Protect access to shared TITAN registers */
extern spinlock_t titan_lock;
extern int titan_irqflags;
#define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
#define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
#endif /* !defined(_ASM_RM9K_OCD_H) */

View file

@ -133,6 +133,8 @@ static inline int syscall_get_arch(void)
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
if (!test_thread_flag(TIF_32BIT_REGS)) if (!test_thread_flag(TIF_32BIT_REGS))
arch |= __AUDIT_ARCH_64BIT; arch |= __AUDIT_ARCH_64BIT;
if (test_thread_flag(TIF_32BIT_ADDR))
arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
#endif #endif
#if defined(__LITTLE_ENDIAN) #if defined(__LITTLE_ENDIAN)
arch |= __AUDIT_ARCH_LE; arch |= __AUDIT_ARCH_LE;

View file

@ -484,13 +484,13 @@ enum MIPS6e_i8_func {
* Damn ... bitfields depend from byteorder :-( * Damn ... bitfields depend from byteorder :-(
*/ */
#ifdef __MIPSEB__ #ifdef __MIPSEB__
#define BITFIELD_FIELD(field, more) \ #define __BITFIELD_FIELD(field, more) \
field; \ field; \
more more
#elif defined(__MIPSEL__) #elif defined(__MIPSEL__)
#define BITFIELD_FIELD(field, more) \ #define __BITFIELD_FIELD(field, more) \
more \ more \
field; field;
@ -499,112 +499,112 @@ enum MIPS6e_i8_func {
#endif #endif
struct j_format { struct j_format {
BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */ __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */
BITFIELD_FIELD(unsigned int target : 26, __BITFIELD_FIELD(unsigned int target : 26,
;)) ;))
}; };
struct i_format { /* signed immediate format */ struct i_format { /* signed immediate format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(signed int simmediate : 16, __BITFIELD_FIELD(signed int simmediate : 16,
;)))) ;))))
}; };
struct u_format { /* unsigned immediate format */ struct u_format { /* unsigned immediate format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int uimmediate : 16, __BITFIELD_FIELD(unsigned int uimmediate : 16,
;)))) ;))))
}; };
struct c_format { /* Cache (>= R6000) format */ struct c_format { /* Cache (>= R6000) format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int c_op : 3, __BITFIELD_FIELD(unsigned int c_op : 3,
BITFIELD_FIELD(unsigned int cache : 2, __BITFIELD_FIELD(unsigned int cache : 2,
BITFIELD_FIELD(unsigned int simmediate : 16, __BITFIELD_FIELD(unsigned int simmediate : 16,
;))))) ;)))))
}; };
struct r_format { /* Register format */ struct r_format { /* Register format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int rd : 5,
BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int re : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct p_format { /* Performance counter format (R10000) */ struct p_format { /* Performance counter format (R10000) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int rd : 5,
BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int re : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct f_format { /* FPU register format */ struct f_format { /* FPU register format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int : 1, __BITFIELD_FIELD(unsigned int : 1,
BITFIELD_FIELD(unsigned int fmt : 4, __BITFIELD_FIELD(unsigned int fmt : 4,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int rd : 5,
BITFIELD_FIELD(unsigned int re : 5, __BITFIELD_FIELD(unsigned int re : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;))))))) ;)))))))
}; };
struct ma_format { /* FPU multiply and add format (MIPS IV) */ struct ma_format { /* FPU multiply and add format (MIPS IV) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int fr : 5,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int func : 4,
BITFIELD_FIELD(unsigned int fmt : 2, __BITFIELD_FIELD(unsigned int fmt : 2,
;))))))) ;)))))))
}; };
struct b_format { /* BREAK and SYSCALL */ struct b_format { /* BREAK and SYSCALL */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int code : 20, __BITFIELD_FIELD(unsigned int code : 20,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;))) ;)))
}; };
struct ps_format { /* MIPS-3D / paired single format */ struct ps_format { /* MIPS-3D / paired single format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct v_format { /* MDMX vector format */ struct v_format { /* MDMX vector format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int sel : 4, __BITFIELD_FIELD(unsigned int sel : 4,
BITFIELD_FIELD(unsigned int fmt : 1, __BITFIELD_FIELD(unsigned int fmt : 1,
BITFIELD_FIELD(unsigned int vt : 5, __BITFIELD_FIELD(unsigned int vt : 5,
BITFIELD_FIELD(unsigned int vs : 5, __BITFIELD_FIELD(unsigned int vs : 5,
BITFIELD_FIELD(unsigned int vd : 5, __BITFIELD_FIELD(unsigned int vd : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;))))))) ;)))))))
}; };
struct spec3_format { /* SPEC3 */ struct spec3_format { /* SPEC3 */
BITFIELD_FIELD(unsigned int opcode:6, __BITFIELD_FIELD(unsigned int opcode:6,
BITFIELD_FIELD(unsigned int rs:5, __BITFIELD_FIELD(unsigned int rs:5,
BITFIELD_FIELD(unsigned int rt:5, __BITFIELD_FIELD(unsigned int rt:5,
BITFIELD_FIELD(signed int simmediate:9, __BITFIELD_FIELD(signed int simmediate:9,
BITFIELD_FIELD(unsigned int func:7, __BITFIELD_FIELD(unsigned int func:7,
;))))) ;)))))
}; };
@ -616,141 +616,141 @@ struct spec3_format { /* SPEC3 */
* if it is MIPS32 instruction re-encoded for use in the microMIPS ASE. * if it is MIPS32 instruction re-encoded for use in the microMIPS ASE.
*/ */
struct fb_format { /* FPU branch format (MIPS32) */ struct fb_format { /* FPU branch format (MIPS32) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int bc : 5, __BITFIELD_FIELD(unsigned int bc : 5,
BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int cc : 3,
BITFIELD_FIELD(unsigned int flag : 2, __BITFIELD_FIELD(unsigned int flag : 2,
BITFIELD_FIELD(signed int simmediate : 16, __BITFIELD_FIELD(signed int simmediate : 16,
;))))) ;)))))
}; };
struct fp0_format { /* FPU multiply and add format (MIPS32) */ struct fp0_format { /* FPU multiply and add format (MIPS32) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int fmt : 5, __BITFIELD_FIELD(unsigned int fmt : 5,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_fp0_format { /* FPU multipy and add format (microMIPS) */ struct mm_fp0_format { /* FPU multipy and add format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int fmt : 3,
BITFIELD_FIELD(unsigned int op : 2, __BITFIELD_FIELD(unsigned int op : 2,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;))))))) ;)))))))
}; };
struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */ struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int op : 5, __BITFIELD_FIELD(unsigned int op : 5,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */ struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fmt : 2, __BITFIELD_FIELD(unsigned int fmt : 2,
BITFIELD_FIELD(unsigned int op : 8, __BITFIELD_FIELD(unsigned int op : 8,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */ struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int cc : 3,
BITFIELD_FIELD(unsigned int zero : 2, __BITFIELD_FIELD(unsigned int zero : 2,
BITFIELD_FIELD(unsigned int fmt : 2, __BITFIELD_FIELD(unsigned int fmt : 2,
BITFIELD_FIELD(unsigned int op : 3, __BITFIELD_FIELD(unsigned int op : 3,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))))) ;))))))))
}; };
struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */ struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int fmt : 3,
BITFIELD_FIELD(unsigned int op : 7, __BITFIELD_FIELD(unsigned int op : 7,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_fp4_format { /* FPU c.cond format (microMIPS) */ struct mm_fp4_format { /* FPU c.cond format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int cc : 3, __BITFIELD_FIELD(unsigned int cc : 3,
BITFIELD_FIELD(unsigned int fmt : 3, __BITFIELD_FIELD(unsigned int fmt : 3,
BITFIELD_FIELD(unsigned int cond : 4, __BITFIELD_FIELD(unsigned int cond : 4,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;))))))) ;)))))))
}; };
struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */ struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int index : 5, __BITFIELD_FIELD(unsigned int index : 5,
BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int base : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int op : 5, __BITFIELD_FIELD(unsigned int op : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct fp6_format { /* FPU madd and msub format (MIPS IV) */ struct fp6_format { /* FPU madd and msub format (MIPS IV) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int fr : 5,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */ struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int ft : 5, __BITFIELD_FIELD(unsigned int ft : 5,
BITFIELD_FIELD(unsigned int fs : 5, __BITFIELD_FIELD(unsigned int fs : 5,
BITFIELD_FIELD(unsigned int fd : 5, __BITFIELD_FIELD(unsigned int fd : 5,
BITFIELD_FIELD(unsigned int fr : 5, __BITFIELD_FIELD(unsigned int fr : 5,
BITFIELD_FIELD(unsigned int func : 6, __BITFIELD_FIELD(unsigned int func : 6,
;)))))) ;))))))
}; };
struct mm_i_format { /* Immediate format (microMIPS) */ struct mm_i_format { /* Immediate format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(unsigned int rs : 5, __BITFIELD_FIELD(unsigned int rs : 5,
BITFIELD_FIELD(signed int simmediate : 16, __BITFIELD_FIELD(signed int simmediate : 16,
;)))) ;))))
}; };
struct mm_m_format { /* Multi-word load/store format (microMIPS) */ struct mm_m_format { /* Multi-word load/store format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int rd : 5,
BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int base : 5,
BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int func : 4,
BITFIELD_FIELD(signed int simmediate : 12, __BITFIELD_FIELD(signed int simmediate : 12,
;))))) ;)))))
}; };
struct mm_x_format { /* Scaled indexed load format (microMIPS) */ struct mm_x_format { /* Scaled indexed load format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int index : 5, __BITFIELD_FIELD(unsigned int index : 5,
BITFIELD_FIELD(unsigned int base : 5, __BITFIELD_FIELD(unsigned int base : 5,
BITFIELD_FIELD(unsigned int rd : 5, __BITFIELD_FIELD(unsigned int rd : 5,
BITFIELD_FIELD(unsigned int func : 11, __BITFIELD_FIELD(unsigned int func : 11,
;))))) ;)))))
}; };
@ -758,51 +758,51 @@ struct mm_x_format { /* Scaled indexed load format (microMIPS) */
* microMIPS instruction formats (16-bit length) * microMIPS instruction formats (16-bit length)
*/ */
struct mm_b0_format { /* Unconditional branch format (microMIPS) */ struct mm_b0_format { /* Unconditional branch format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(signed int simmediate : 10, __BITFIELD_FIELD(signed int simmediate : 10,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;))) ;)))
}; };
struct mm_b1_format { /* Conditional branch format (microMIPS) */ struct mm_b1_format { /* Conditional branch format (microMIPS) */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rs : 3, __BITFIELD_FIELD(unsigned int rs : 3,
BITFIELD_FIELD(signed int simmediate : 7, __BITFIELD_FIELD(signed int simmediate : 7,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;)))) ;))))
}; };
struct mm16_m_format { /* Multi-word load/store format */ struct mm16_m_format { /* Multi-word load/store format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int func : 4, __BITFIELD_FIELD(unsigned int func : 4,
BITFIELD_FIELD(unsigned int rlist : 2, __BITFIELD_FIELD(unsigned int rlist : 2,
BITFIELD_FIELD(unsigned int imm : 4, __BITFIELD_FIELD(unsigned int imm : 4,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;))))) ;)))))
}; };
struct mm16_rb_format { /* Signed immediate format */ struct mm16_rb_format { /* Signed immediate format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 3, __BITFIELD_FIELD(unsigned int rt : 3,
BITFIELD_FIELD(unsigned int base : 3, __BITFIELD_FIELD(unsigned int base : 3,
BITFIELD_FIELD(signed int simmediate : 4, __BITFIELD_FIELD(signed int simmediate : 4,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;))))) ;)))))
}; };
struct mm16_r3_format { /* Load from global pointer format */ struct mm16_r3_format { /* Load from global pointer format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 3, __BITFIELD_FIELD(unsigned int rt : 3,
BITFIELD_FIELD(signed int simmediate : 7, __BITFIELD_FIELD(signed int simmediate : 7,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;)))) ;))))
}; };
struct mm16_r5_format { /* Load/store from stack pointer format */ struct mm16_r5_format { /* Load/store from stack pointer format */
BITFIELD_FIELD(unsigned int opcode : 6, __BITFIELD_FIELD(unsigned int opcode : 6,
BITFIELD_FIELD(unsigned int rt : 5, __BITFIELD_FIELD(unsigned int rt : 5,
BITFIELD_FIELD(signed int simmediate : 5, __BITFIELD_FIELD(signed int simmediate : 5,
BITFIELD_FIELD(unsigned int : 16, /* Ignored */ __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;)))) ;))))
}; };
@ -810,57 +810,57 @@ struct mm16_r5_format { /* Load/store from stack pointer format */
* MIPS16e instruction formats (16-bit length) * MIPS16e instruction formats (16-bit length)
*/ */
struct m16e_rr { struct m16e_rr {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int rx : 3,
BITFIELD_FIELD(unsigned int nd : 1, __BITFIELD_FIELD(unsigned int nd : 1,
BITFIELD_FIELD(unsigned int l : 1, __BITFIELD_FIELD(unsigned int l : 1,
BITFIELD_FIELD(unsigned int ra : 1, __BITFIELD_FIELD(unsigned int ra : 1,
BITFIELD_FIELD(unsigned int func : 5, __BITFIELD_FIELD(unsigned int func : 5,
;)))))) ;))))))
}; };
struct m16e_jal { struct m16e_jal {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int x : 1, __BITFIELD_FIELD(unsigned int x : 1,
BITFIELD_FIELD(unsigned int imm20_16 : 5, __BITFIELD_FIELD(unsigned int imm20_16 : 5,
BITFIELD_FIELD(signed int imm25_21 : 5, __BITFIELD_FIELD(signed int imm25_21 : 5,
;)))) ;))))
}; };
struct m16e_i64 { struct m16e_i64 {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int func : 3,
BITFIELD_FIELD(unsigned int imm : 8, __BITFIELD_FIELD(unsigned int imm : 8,
;))) ;)))
}; };
struct m16e_ri64 { struct m16e_ri64 {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int func : 3,
BITFIELD_FIELD(unsigned int ry : 3, __BITFIELD_FIELD(unsigned int ry : 3,
BITFIELD_FIELD(unsigned int imm : 5, __BITFIELD_FIELD(unsigned int imm : 5,
;)))) ;))))
}; };
struct m16e_ri { struct m16e_ri {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int rx : 3,
BITFIELD_FIELD(unsigned int imm : 8, __BITFIELD_FIELD(unsigned int imm : 8,
;))) ;)))
}; };
struct m16e_rri { struct m16e_rri {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int rx : 3, __BITFIELD_FIELD(unsigned int rx : 3,
BITFIELD_FIELD(unsigned int ry : 3, __BITFIELD_FIELD(unsigned int ry : 3,
BITFIELD_FIELD(unsigned int imm : 5, __BITFIELD_FIELD(unsigned int imm : 5,
;)))) ;))))
}; };
struct m16e_i8 { struct m16e_i8 {
BITFIELD_FIELD(unsigned int opcode : 5, __BITFIELD_FIELD(unsigned int opcode : 5,
BITFIELD_FIELD(unsigned int func : 3, __BITFIELD_FIELD(unsigned int func : 3,
BITFIELD_FIELD(unsigned int imm : 8, __BITFIELD_FIELD(unsigned int imm : 8,
;))) ;)))
}; };

View file

@ -371,11 +371,12 @@
#define __NR_finit_module (__NR_Linux + 348) #define __NR_finit_module (__NR_Linux + 348)
#define __NR_sched_setattr (__NR_Linux + 349) #define __NR_sched_setattr (__NR_Linux + 349)
#define __NR_sched_getattr (__NR_Linux + 350) #define __NR_sched_getattr (__NR_Linux + 350)
#define __NR_renameat2 (__NR_Linux + 351)
/* /*
* Offset of the last Linux o32 flavoured syscall * Offset of the last Linux o32 flavoured syscall
*/ */
#define __NR_Linux_syscalls 350 #define __NR_Linux_syscalls 351
#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@ -699,11 +700,12 @@
#define __NR_getdents64 (__NR_Linux + 308) #define __NR_getdents64 (__NR_Linux + 308)
#define __NR_sched_setattr (__NR_Linux + 309) #define __NR_sched_setattr (__NR_Linux + 309)
#define __NR_sched_getattr (__NR_Linux + 310) #define __NR_sched_getattr (__NR_Linux + 310)
#define __NR_renameat2 (__NR_Linux + 311)
/* /*
* Offset of the last Linux 64-bit flavoured syscall * Offset of the last Linux 64-bit flavoured syscall
*/ */
#define __NR_Linux_syscalls 310 #define __NR_Linux_syscalls 311
#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
@ -1031,11 +1033,12 @@
#define __NR_finit_module (__NR_Linux + 312) #define __NR_finit_module (__NR_Linux + 312)
#define __NR_sched_setattr (__NR_Linux + 313) #define __NR_sched_setattr (__NR_Linux + 313)
#define __NR_sched_getattr (__NR_Linux + 314) #define __NR_sched_getattr (__NR_Linux + 314)
#define __NR_renameat2 (__NR_Linux + 315)
/* /*
* Offset of the last N32 flavoured syscall * Offset of the last N32 flavoured syscall
*/ */
#define __NR_Linux_syscalls 314 #define __NR_Linux_syscalls 315
#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */

View file

@ -124,14 +124,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "kscratch registers\t: %d\n", seq_printf(m, "kscratch registers\t: %d\n",
hweight8(cpu_data[n].kscratch_mask)); hweight8(cpu_data[n].kscratch_mask));
seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
if (cpu_has_mipsmt) {
seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
#if defined(CONFIG_MIPS_MT_SMTC)
seq_printf(m, "TC\t\t\t: %d\n", cpu_data[n].tc_id);
#endif
}
#endif
sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
cpu_has_vce ? "%u" : "not available"); cpu_has_vce ? "%u" : "not available");
seq_printf(m, fmt, 'D', vced_count); seq_printf(m, fmt, 'D', vced_count);

View file

@ -577,3 +577,4 @@ EXPORT(sys_call_table)
PTR sys_finit_module PTR sys_finit_module
PTR sys_sched_setattr PTR sys_sched_setattr
PTR sys_sched_getattr /* 4350 */ PTR sys_sched_getattr /* 4350 */
PTR sys_renameat2

View file

@ -430,4 +430,5 @@ EXPORT(sys_call_table)
PTR sys_getdents64 PTR sys_getdents64
PTR sys_sched_setattr PTR sys_sched_setattr
PTR sys_sched_getattr /* 5310 */ PTR sys_sched_getattr /* 5310 */
PTR sys_renameat2
.size sys_call_table,.-sys_call_table .size sys_call_table,.-sys_call_table

View file

@ -423,4 +423,5 @@ EXPORT(sysn32_call_table)
PTR sys_finit_module PTR sys_finit_module
PTR sys_sched_setattr PTR sys_sched_setattr
PTR sys_sched_getattr PTR sys_sched_getattr
PTR sys_renameat2 /* 6315 */
.size sysn32_call_table,.-sysn32_call_table .size sysn32_call_table,.-sysn32_call_table

View file

@ -556,4 +556,5 @@ EXPORT(sys32_call_table)
PTR sys_finit_module PTR sys_finit_module
PTR sys_sched_setattr PTR sys_sched_setattr
PTR sys_sched_getattr /* 4350 */ PTR sys_sched_getattr /* 4350 */
PTR sys_renameat2
.size sys32_call_table,.-sys32_call_table .size sys32_call_table,.-sys32_call_table

View file

@ -8,6 +8,7 @@
}; };
memory@0 { memory@0 {
device_type = "memory";
reg = <0x0 0x2000000>; reg = <0x0 0x2000000>;
}; };

View file

@ -56,14 +56,20 @@
#define UNIT(unit) ((unit)*NBYTES) #define UNIT(unit) ((unit)*NBYTES)
#define ADDC(sum,reg) \ #define ADDC(sum,reg) \
.set push; \
.set noat; \
ADD sum, reg; \ ADD sum, reg; \
sltu v1, sum, reg; \ sltu v1, sum, reg; \
ADD sum, v1; \ ADD sum, v1; \
.set pop
#define ADDC32(sum,reg) \ #define ADDC32(sum,reg) \
.set push; \
.set noat; \
addu sum, reg; \ addu sum, reg; \
sltu v1, sum, reg; \ sltu v1, sum, reg; \
addu sum, v1; \ addu sum, v1; \
.set pop
#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \ #define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \
LOAD _t0, (offset + UNIT(0))(src); \ LOAD _t0, (offset + UNIT(0))(src); \
@ -710,6 +716,8 @@ LEAF(csum_partial)
ADDC(sum, t2) ADDC(sum, t2)
.Ldone\@: .Ldone\@:
/* fold checksum */ /* fold checksum */
.set push
.set noat
#ifdef USE_DOUBLE #ifdef USE_DOUBLE
dsll32 v1, sum, 0 dsll32 v1, sum, 0
daddu sum, v1 daddu sum, v1
@ -732,6 +740,7 @@ LEAF(csum_partial)
or sum, sum, t0 or sum, sum, t0
1: 1:
#endif #endif
.set pop
.set reorder .set reorder
ADDC32(sum, psum) ADDC32(sum, psum)
jr ra jr ra

View file

@ -6,7 +6,7 @@
* Copyright (C) 1994 by Waldorf Electronics * Copyright (C) 1994 by Waldorf Electronics
* Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
* Copyright (C) 1999, 2000 Silicon Graphics, Inc. * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 2007 Maciej W. Rozycki * Copyright (C) 2007, 2014 Maciej W. Rozycki
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/param.h> #include <linux/param.h>
@ -15,6 +15,12 @@
#include <asm/compiler.h> #include <asm/compiler.h>
#include <asm/war.h> #include <asm/war.h>
#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
#define GCC_DADDI_IMM_ASM() "I"
#else
#define GCC_DADDI_IMM_ASM() "r"
#endif
void __delay(unsigned long loops) void __delay(unsigned long loops)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
@ -22,13 +28,13 @@ void __delay(unsigned long loops)
" .align 3 \n" " .align 3 \n"
"1: bnez %0, 1b \n" "1: bnez %0, 1b \n"
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
" subu %0, 1 \n" " subu %0, %1 \n"
#else #else
" dsubu %0, 1 \n" " dsubu %0, %1 \n"
#endif #endif
" .set reorder \n" " .set reorder \n"
: "=r" (loops) : "=r" (loops)
: "0" (loops)); : GCC_DADDI_IMM_ASM() (1), "0" (loops));
} }
EXPORT_SYMBOL(__delay); EXPORT_SYMBOL(__delay);

View file

@ -35,7 +35,6 @@ LEAF(__strncpy_from_\func\()_asm)
bnez v0, .Lfault\@ bnez v0, .Lfault\@
FEXPORT(__strncpy_from_\func\()_nocheck_asm) FEXPORT(__strncpy_from_\func\()_nocheck_asm)
.set noreorder
move t0, zero move t0, zero
move v1, a1 move v1, a1
.ifeqs "\func","kernel" .ifeqs "\func","kernel"
@ -45,21 +44,21 @@ FEXPORT(__strncpy_from_\func\()_nocheck_asm)
.endif .endif
PTR_ADDIU v1, 1 PTR_ADDIU v1, 1
R10KCBARRIER(0(ra)) R10KCBARRIER(0(ra))
sb v0, (a0)
beqz v0, 2f beqz v0, 2f
sb v0, (a0)
PTR_ADDIU t0, 1 PTR_ADDIU t0, 1
PTR_ADDIU a0, 1
bne t0, a2, 1b bne t0, a2, 1b
PTR_ADDIU a0, 1
2: PTR_ADDU v0, a1, t0 2: PTR_ADDU v0, a1, t0
xor v0, a1 xor v0, a1
bltz v0, .Lfault\@ bltz v0, .Lfault\@
nop move v0, t0
jr ra # return n jr ra # return n
move v0, t0
END(__strncpy_from_\func\()_asm) END(__strncpy_from_\func\()_asm)
.Lfault\@: jr ra .Lfault\@:
li v0, -EFAULT li v0, -EFAULT
jr ra
.section __ex_table,"a" .section __ex_table,"a"
PTR 1b, .Lfault\@ PTR 1b, .Lfault\@

View file

@ -64,7 +64,6 @@ config LEMOTE_MACH3A
bool "Lemote Loongson 3A family machines" bool "Lemote Loongson 3A family machines"
select ARCH_SPARSEMEM_ENABLE select ARCH_SPARSEMEM_ENABLE
select GENERIC_ISA_DMA_SUPPORT_BROKEN select GENERIC_ISA_DMA_SUPPORT_BROKEN
select GENERIC_HARDIRQS_NO__DO_IRQ
select BOOT_ELF32 select BOOT_ELF32
select BOARD_SCACHE select BOARD_SCACHE
select CSRC_R4K select CSRC_R4K

View file

@ -91,6 +91,7 @@ EXPORT_SYMBOL(clk_put);
int clk_set_rate(struct clk *clk, unsigned long rate) int clk_set_rate(struct clk *clk, unsigned long rate)
{ {
unsigned int rate_khz = rate / 1000;
int ret = 0; int ret = 0;
int regval; int regval;
int i; int i;
@ -111,10 +112,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
if (loongson2_clockmod_table[i].frequency == if (loongson2_clockmod_table[i].frequency ==
CPUFREQ_ENTRY_INVALID) CPUFREQ_ENTRY_INVALID)
continue; continue;
if (rate == loongson2_clockmod_table[i].frequency) if (rate_khz == loongson2_clockmod_table[i].frequency)
break; break;
} }
if (rate != loongson2_clockmod_table[i].frequency) if (rate_khz != loongson2_clockmod_table[i].frequency)
return -ENOTSUPP; return -ENOTSUPP;
clk->rate = rate; clk->rate = rate;

View file

@ -16,8 +16,10 @@
#define FASTPATH_SIZE 128 #define FASTPATH_SIZE 128
EXPORT(tlbmiss_handler_setup_pgd_start)
LEAF(tlbmiss_handler_setup_pgd) LEAF(tlbmiss_handler_setup_pgd)
.space 16 * 4 1: j 1b /* Dummy, will be replaced. */
.space 64
END(tlbmiss_handler_setup_pgd) END(tlbmiss_handler_setup_pgd)
EXPORT(tlbmiss_handler_setup_pgd_end) EXPORT(tlbmiss_handler_setup_pgd_end)

View file

@ -1422,16 +1422,17 @@ static void build_r4000_tlb_refill_handler(void)
extern u32 handle_tlbl[], handle_tlbl_end[]; extern u32 handle_tlbl[], handle_tlbl_end[];
extern u32 handle_tlbs[], handle_tlbs_end[]; extern u32 handle_tlbs[], handle_tlbs_end[];
extern u32 handle_tlbm[], handle_tlbm_end[]; extern u32 handle_tlbm[], handle_tlbm_end[];
extern u32 tlbmiss_handler_setup_pgd[], tlbmiss_handler_setup_pgd_end[]; extern u32 tlbmiss_handler_setup_pgd_start[], tlbmiss_handler_setup_pgd[];
extern u32 tlbmiss_handler_setup_pgd_end[];
static void build_setup_pgd(void) static void build_setup_pgd(void)
{ {
const int a0 = 4; const int a0 = 4;
const int __maybe_unused a1 = 5; const int __maybe_unused a1 = 5;
const int __maybe_unused a2 = 6; const int __maybe_unused a2 = 6;
u32 *p = tlbmiss_handler_setup_pgd; u32 *p = tlbmiss_handler_setup_pgd_start;
const int tlbmiss_handler_setup_pgd_size = const int tlbmiss_handler_setup_pgd_size =
tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd; tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd_start;
#ifndef CONFIG_MIPS_PGD_C0_CONTEXT #ifndef CONFIG_MIPS_PGD_C0_CONTEXT
long pgdc = (long)pgd_current; long pgdc = (long)pgd_current;
#endif #endif

View file

@ -7,6 +7,7 @@
model = "Ralink MT7620A evaluation board"; model = "Ralink MT7620A evaluation board";
memory@0 { memory@0 {
device_type = "memory";
reg = <0x0 0x2000000>; reg = <0x0 0x2000000>;
}; };

View file

@ -7,6 +7,7 @@
model = "Ralink RT2880 evaluation board"; model = "Ralink RT2880 evaluation board";
memory@0 { memory@0 {
device_type = "memory";
reg = <0x8000000 0x2000000>; reg = <0x8000000 0x2000000>;
}; };

View file

@ -7,6 +7,7 @@
model = "Ralink RT3052 evaluation board"; model = "Ralink RT3052 evaluation board";
memory@0 { memory@0 {
device_type = "memory";
reg = <0x0 0x2000000>; reg = <0x0 0x2000000>;
}; };

View file

@ -7,6 +7,7 @@
model = "Ralink RT3883 evaluation board"; model = "Ralink RT3883 evaluation board";
memory@0 { memory@0 {
device_type = "memory";
reg = <0x0 0x2000000>; reg = <0x0 0x2000000>;
}; };

View file

@ -22,6 +22,7 @@ config PARISC
select GENERIC_SMP_IDLE_THREAD select GENERIC_SMP_IDLE_THREAD
select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNCPY_FROM_USER
select SYSCTL_ARCH_UNALIGN_ALLOW select SYSCTL_ARCH_UNALIGN_ALLOW
select SYSCTL_EXCEPTION_TRACE
select HAVE_MOD_ARCH_SPECIFIC select HAVE_MOD_ARCH_SPECIFIC
select VIRT_TO_BUS select VIRT_TO_BUS
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA

View file

@ -55,6 +55,11 @@
#define STACK_TOP TASK_SIZE #define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX DEFAULT_TASK_SIZE #define STACK_TOP_MAX DEFAULT_TASK_SIZE
/* Allow bigger stacks for 64-bit processes */
#define STACK_SIZE_MAX (USER_WIDE_MODE \
? (1 << 30) /* 1 GB */ \
: (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
#endif #endif
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__

View file

@ -829,8 +829,9 @@
#define __NR_sched_setattr (__NR_Linux + 334) #define __NR_sched_setattr (__NR_Linux + 334)
#define __NR_sched_getattr (__NR_Linux + 335) #define __NR_sched_getattr (__NR_Linux + 335)
#define __NR_utimes (__NR_Linux + 336) #define __NR_utimes (__NR_Linux + 336)
#define __NR_renameat2 (__NR_Linux + 337)
#define __NR_Linux_syscalls (__NR_utimes + 1) #define __NR_Linux_syscalls (__NR_renameat2 + 1)
#define __IGNORE_select /* newselect */ #define __IGNORE_select /* newselect */

View file

@ -72,10 +72,10 @@ static unsigned long mmap_upper_limit(void)
{ {
unsigned long stack_base; unsigned long stack_base;
/* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */ /* Limit stack size - see setup_arg_pages() in fs/exec.c */
stack_base = rlimit_max(RLIMIT_STACK); stack_base = rlimit_max(RLIMIT_STACK);
if (stack_base > (1 << 30)) if (stack_base > STACK_SIZE_MAX)
stack_base = 1 << 30; stack_base = STACK_SIZE_MAX;
return PAGE_ALIGN(STACK_TOP - stack_base); return PAGE_ALIGN(STACK_TOP - stack_base);
} }

View file

@ -589,10 +589,13 @@ cas_nocontend:
# endif # endif
/* ENABLE_LWS_DEBUG */ /* ENABLE_LWS_DEBUG */
rsm PSW_SM_I, %r0 /* Disable interrupts */
/* COW breaks can cause contention on UP systems */
LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */
cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */ cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */
cas_wouldblock: cas_wouldblock:
ldo 2(%r0), %r28 /* 2nd case */ ldo 2(%r0), %r28 /* 2nd case */
ssm PSW_SM_I, %r0
b lws_exit /* Contended... */ b lws_exit /* Contended... */
ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
@ -619,15 +622,17 @@ cas_action:
stw %r1, 4(%sr2,%r20) stw %r1, 4(%sr2,%r20)
#endif #endif
/* The load and store could fail */ /* The load and store could fail */
1: ldw 0(%sr3,%r26), %r28 1: ldw,ma 0(%sr3,%r26), %r28
sub,<> %r28, %r25, %r0 sub,<> %r28, %r25, %r0
2: stw %r24, 0(%sr3,%r26) 2: stw,ma %r24, 0(%sr3,%r26)
/* Free lock */ /* Free lock */
stw %r20, 0(%sr2,%r20) stw,ma %r20, 0(%sr2,%r20)
#if ENABLE_LWS_DEBUG #if ENABLE_LWS_DEBUG
/* Clear thread register indicator */ /* Clear thread register indicator */
stw %r0, 4(%sr2,%r20) stw %r0, 4(%sr2,%r20)
#endif #endif
/* Enable interrupts */
ssm PSW_SM_I, %r0
/* Return to userspace, set no error */ /* Return to userspace, set no error */
b lws_exit b lws_exit
copy %r0, %r21 copy %r0, %r21
@ -639,6 +644,7 @@ cas_action:
#if ENABLE_LWS_DEBUG #if ENABLE_LWS_DEBUG
stw %r0, 4(%sr2,%r20) stw %r0, 4(%sr2,%r20)
#endif #endif
ssm PSW_SM_I, %r0
b lws_exit b lws_exit
ldo -EFAULT(%r0),%r21 /* set errno */ ldo -EFAULT(%r0),%r21 /* set errno */
nop nop

View file

@ -432,6 +432,7 @@
ENTRY_SAME(sched_setattr) ENTRY_SAME(sched_setattr)
ENTRY_SAME(sched_getattr) /* 335 */ ENTRY_SAME(sched_getattr) /* 335 */
ENTRY_COMP(utimes) ENTRY_COMP(utimes)
ENTRY_COMP(renameat2)
/* Nothing yet */ /* Nothing yet */

View file

@ -25,6 +25,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/ratelimit.h>
#include <asm/assembly.h> #include <asm/assembly.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
@ -42,9 +43,6 @@
#include "../math-emu/math-emu.h" /* for handle_fpe() */ #include "../math-emu/math-emu.h" /* for handle_fpe() */
#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
/* dumped to the console via printk) */
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
DEFINE_SPINLOCK(pa_dbit_lock); DEFINE_SPINLOCK(pa_dbit_lock);
#endif #endif
@ -160,6 +158,17 @@ void show_regs(struct pt_regs *regs)
} }
} }
static DEFINE_RATELIMIT_STATE(_hppa_rs,
DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);
#define parisc_printk_ratelimited(critical, regs, fmt, ...) { \
if ((critical || show_unhandled_signals) && __ratelimit(&_hppa_rs)) { \
printk(fmt, ##__VA_ARGS__); \
show_regs(regs); \
} \
}
static void do_show_stack(struct unwind_frame_info *info) static void do_show_stack(struct unwind_frame_info *info)
{ {
int i = 1; int i = 1;
@ -229,12 +238,10 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
if (err == 0) if (err == 0)
return; /* STFU */ return; /* STFU */
printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", parisc_printk_ratelimited(1, regs,
KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
current->comm, task_pid_nr(current), str, err, regs->iaoq[0]); current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
#ifdef PRINT_USER_FAULTS
/* XXX for debugging only */
show_regs(regs);
#endif
return; return;
} }
@ -321,14 +328,11 @@ static void handle_break(struct pt_regs *regs)
(tt == BUG_TRAP_TYPE_NONE) ? 9 : 0); (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);
} }
#ifdef PRINT_USER_FAULTS if (unlikely(iir != GDB_BREAK_INSN))
if (unlikely(iir != GDB_BREAK_INSN)) { parisc_printk_ratelimited(0, regs,
printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
iir & 31, (iir>>13) & ((1<<13)-1), iir & 31, (iir>>13) & ((1<<13)-1),
task_pid_nr(current), current->comm); task_pid_nr(current), current->comm);
show_regs(regs);
}
#endif
/* send standard GDB signal */ /* send standard GDB signal */
handle_gdb_break(regs, TRAP_BRKPT); handle_gdb_break(regs, TRAP_BRKPT);
@ -758,11 +762,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
default: default:
if (user_mode(regs)) { if (user_mode(regs)) {
#ifdef PRINT_USER_FAULTS parisc_printk_ratelimited(0, regs, KERN_DEBUG
printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", "handle_interruption() pid=%d command='%s'\n",
task_pid_nr(current), current->comm); task_pid_nr(current), current->comm);
show_regs(regs);
#endif
/* SIGBUS, for lack of a better one. */ /* SIGBUS, for lack of a better one. */
si.si_signo = SIGBUS; si.si_signo = SIGBUS;
si.si_code = BUS_OBJERR; si.si_code = BUS_OBJERR;
@ -779,16 +781,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
if (user_mode(regs)) { if (user_mode(regs)) {
if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) { if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) {
#ifdef PRINT_USER_FAULTS parisc_printk_ratelimited(0, regs, KERN_DEBUG
if (fault_space == 0) "User fault %d on space 0x%08lx, pid=%d command='%s'\n",
printk(KERN_DEBUG "User Fault on Kernel Space "); code, fault_space,
else task_pid_nr(current), current->comm);
printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
code);
printk(KERN_CONT "pid=%d command='%s'\n",
task_pid_nr(current), current->comm);
show_regs(regs);
#endif
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
si.si_errno = 0; si.si_errno = 0;
si.si_code = SEGV_MAPERR; si.si_code = SEGV_MAPERR;

View file

@ -19,10 +19,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/traps.h> #include <asm/traps.h>
#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
/* dumped to the console via printk) */
/* Various important other fields */ /* Various important other fields */
#define bit22set(x) (x & 0x00000200) #define bit22set(x) (x & 0x00000200)
#define bits23_25set(x) (x & 0x000001c0) #define bits23_25set(x) (x & 0x000001c0)
@ -34,6 +30,8 @@
DEFINE_PER_CPU(struct exception_data, exception_data); DEFINE_PER_CPU(struct exception_data, exception_data);
int show_unhandled_signals = 1;
/* /*
* parisc_acctyp(unsigned int inst) -- * parisc_acctyp(unsigned int inst) --
* Given a PA-RISC memory access instruction, determine if the * Given a PA-RISC memory access instruction, determine if the
@ -173,6 +171,32 @@ int fixup_exception(struct pt_regs *regs)
return 0; return 0;
} }
/*
* Print out info about fatal segfaults, if the show_unhandled_signals
* sysctl is set:
*/
static inline void
show_signal_msg(struct pt_regs *regs, unsigned long code,
unsigned long address, struct task_struct *tsk,
struct vm_area_struct *vma)
{
if (!unhandled_signal(tsk, SIGSEGV))
return;
if (!printk_ratelimit())
return;
pr_warn("\n");
pr_warn("do_page_fault() command='%s' type=%lu address=0x%08lx",
tsk->comm, code, address);
print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
if (vma)
pr_warn(" vm_start = 0x%08lx, vm_end = 0x%08lx\n",
vma->vm_start, vma->vm_end);
show_regs(regs);
}
void do_page_fault(struct pt_regs *regs, unsigned long code, void do_page_fault(struct pt_regs *regs, unsigned long code,
unsigned long address) unsigned long address)
{ {
@ -270,16 +294,8 @@ bad_area:
if (user_mode(regs)) { if (user_mode(regs)) {
struct siginfo si; struct siginfo si;
#ifdef PRINT_USER_FAULTS show_signal_msg(regs, code, address, tsk, vma);
printk(KERN_DEBUG "\n");
printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
task_pid_nr(tsk), tsk->comm, code, address);
if (vma) {
printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
vma->vm_start, vma->vm_end);
}
show_regs(regs);
#endif
switch (code) { switch (code) {
case 15: /* Data TLB miss fault/Data page fault */ case 15: /* Data TLB miss fault/Data page fault */
/* send SIGSEGV when outside of vma */ /* send SIGSEGV when outside of vma */

View file

@ -813,9 +813,6 @@ static void __init clocksource_init(void)
static int decrementer_set_next_event(unsigned long evt, static int decrementer_set_next_event(unsigned long evt,
struct clock_event_device *dev) struct clock_event_device *dev)
{ {
/* Don't adjust the decrementer if some irq work is pending */
if (test_irq_work_pending())
return 0;
__get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt; __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;
set_dec(evt); set_dec(evt);

View file

@ -549,7 +549,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
ret = ioda_eeh_phb_reset(hose, option); ret = ioda_eeh_phb_reset(hose, option);
} else { } else {
bus = eeh_pe_bus_get(pe); bus = eeh_pe_bus_get(pe);
if (pci_is_root_bus(bus)) if (pci_is_root_bus(bus) ||
pci_is_root_bus(bus->parent))
ret = ioda_eeh_root_reset(hose, option); ret = ioda_eeh_root_reset(hose, option);
else else
ret = ioda_eeh_bridge_reset(hose, bus->self, option); ret = ioda_eeh_bridge_reset(hose, bus->self, option);

View file

@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
else else
memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
spin_unlock(&ctrblk_lock); spin_unlock(&ctrblk_lock);
} else {
if (!nbytes)
memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
} }
/* /*
* final block may be < AES_BLOCK_SIZE, copy only nbytes * final block may be < AES_BLOCK_SIZE, copy only nbytes

View file

@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
else else
memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
spin_unlock(&ctrblk_lock); spin_unlock(&ctrblk_lock);
} else {
if (!nbytes)
memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
} }
/* final block may be < DES_BLOCK_SIZE, copy only nbytes */ /* final block may be < DES_BLOCK_SIZE, copy only nbytes */
if (nbytes) { if (nbytes) {

View file

@ -119,7 +119,7 @@ obj-$(CONFIG_SGI_SN) += sn/
obj-y += firmware/ obj-y += firmware/
obj-$(CONFIG_CRYPTO) += crypto/ obj-$(CONFIG_CRYPTO) += crypto/
obj-$(CONFIG_SUPERH) += sh/ obj-$(CONFIG_SUPERH) += sh/
obj-$(CONFIG_ARCH_SHMOBILE_LEGACY) += sh/ obj-$(CONFIG_ARCH_SHMOBILE) += sh/
ifndef CONFIG_ARCH_USES_GETTIMEOFFSET ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
obj-y += clocksource/ obj-y += clocksource/
endif endif

View file

@ -47,6 +47,23 @@ config ACPI_SLEEP
depends on SUSPEND || HIBERNATION depends on SUSPEND || HIBERNATION
default y default y
config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi directories"
depends on PROC_FS
help
For backwards compatibility, this option allows
deprecated power /proc/acpi/ directories to exist, even when
they have been replaced by functions in /sys.
The deprecated directories (and their replacements) include:
/proc/acpi/battery/* (/sys/class/power_supply/*)
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ directories
and functions, which do not yet exist in /sys
This option, together with the proc directories, will be
deleted in the future.
Say N to delete power /proc/acpi/ directories that have moved to /sys/
config ACPI_EC_DEBUGFS config ACPI_EC_DEBUGFS
tristate "EC read/write access through /sys/kernel/debug/ec" tristate "EC read/write access through /sys/kernel/debug/ec"
default n default n

View file

@ -47,6 +47,7 @@ acpi-y += sysfs.o
acpi-$(CONFIG_X86) += acpi_cmos_rtc.o acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
acpi-$(CONFIG_DEBUG_FS) += debugfs.o acpi-$(CONFIG_DEBUG_FS) += debugfs.o
acpi-$(CONFIG_ACPI_NUMA) += numa.o acpi-$(CONFIG_ACPI_NUMA) += numa.o
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
ifdef CONFIG_ACPI_VIDEO ifdef CONFIG_ACPI_VIDEO
acpi-y += video_detect.o acpi-y += video_detect.o
endif endif

View file

@ -52,11 +52,39 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver"); MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device);
static void acpi_ac_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id ac_device_ids[] = {
{"ACPI0003", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
#ifdef CONFIG_PM_SLEEP
static int acpi_ac_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static int ac_sleep_before_get_state_ms; static int ac_sleep_before_get_state_ms;
static struct acpi_driver acpi_ac_driver = {
.name = "ac",
.class = ACPI_AC_CLASS,
.ids = ac_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = {
.add = acpi_ac_add,
.remove = acpi_ac_remove,
.notify = acpi_ac_notify,
},
.drv.pm = &acpi_ac_pm,
};
struct acpi_ac { struct acpi_ac {
struct power_supply charger; struct power_supply charger;
struct platform_device *pdev; struct acpi_device * device;
unsigned long long state; unsigned long long state;
struct notifier_block battery_nb; struct notifier_block battery_nb;
}; };
@ -69,10 +97,12 @@ struct acpi_ac {
static int acpi_ac_get_state(struct acpi_ac *ac) static int acpi_ac_get_state(struct acpi_ac *ac)
{ {
acpi_status status; acpi_status status = AE_OK;
acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
status = acpi_evaluate_integer(handle, "_PSR", NULL, if (!ac)
return -EINVAL;
status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL,
&ac->state); &ac->state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
@ -117,10 +147,9 @@ static enum power_supply_property ac_props[] = {
Driver Model Driver Model
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) static void acpi_ac_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_ac *ac = data; struct acpi_ac *ac = acpi_driver_data(device);
struct acpi_device *adev;
if (!ac) if (!ac)
return; return;
@ -143,11 +172,10 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
msleep(ac_sleep_before_get_state_ms); msleep(ac_sleep_before_get_state_ms);
acpi_ac_get_state(ac); acpi_ac_get_state(ac);
adev = ACPI_COMPANION(&ac->pdev->dev); acpi_bus_generate_netlink_event(device->pnp.device_class,
acpi_bus_generate_netlink_event(adev->pnp.device_class, dev_name(&device->dev), event,
dev_name(&ac->pdev->dev), (u32) ac->state);
event, (u32) ac->state); acpi_notifier_call_chain(device, event, (u32) ac->state);
acpi_notifier_call_chain(adev, event, (u32) ac->state);
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
} }
@ -192,49 +220,39 @@ static struct dmi_system_id ac_dmi_table[] = {
{}, {},
}; };
static int acpi_ac_probe(struct platform_device *pdev) static int acpi_ac_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
struct acpi_device *adev;
if (!pdev)
if (!device)
return -EINVAL; return -EINVAL;
adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return -ENODEV;
ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
if (!ac) if (!ac)
return -ENOMEM; return -ENOMEM;
strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); ac->device = device;
strcpy(acpi_device_class(adev), ACPI_AC_CLASS); strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
ac->pdev = pdev; strcpy(acpi_device_class(device), ACPI_AC_CLASS);
platform_set_drvdata(pdev, ac); device->driver_data = ac;
result = acpi_ac_get_state(ac); result = acpi_ac_get_state(ac);
if (result) if (result)
goto end; goto end;
ac->charger.name = acpi_device_bid(adev); ac->charger.name = acpi_device_bid(device);
ac->charger.type = POWER_SUPPLY_TYPE_MAINS; ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
ac->charger.properties = ac_props; ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props); ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property; ac->charger.get_property = get_ac_property;
result = power_supply_register(&pdev->dev, &ac->charger); result = power_supply_register(&ac->device->dev, &ac->charger);
if (result) if (result)
goto end; goto end;
result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
if (result) {
power_supply_unregister(&ac->charger);
goto end;
}
printk(KERN_INFO PREFIX "%s [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(adev), acpi_device_bid(adev), acpi_device_name(device), acpi_device_bid(device),
ac->state ? "on-line" : "off-line"); ac->state ? "on-line" : "off-line");
ac->battery_nb.notifier_call = acpi_ac_battery_notify; ac->battery_nb.notifier_call = acpi_ac_battery_notify;
@ -256,7 +274,7 @@ static int acpi_ac_resume(struct device *dev)
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
ac = platform_get_drvdata(to_platform_device(dev)); ac = acpi_driver_data(to_acpi_device(dev));
if (!ac) if (!ac)
return -EINVAL; return -EINVAL;
@ -270,19 +288,17 @@ static int acpi_ac_resume(struct device *dev)
#else #else
#define acpi_ac_resume NULL #define acpi_ac_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume);
static int acpi_ac_remove(struct platform_device *pdev) static int acpi_ac_remove(struct acpi_device *device)
{ {
struct acpi_ac *ac; struct acpi_ac *ac = NULL;
if (!pdev)
if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev), ac = acpi_driver_data(device);
ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
ac = platform_get_drvdata(pdev);
if (ac->charger.dev) if (ac->charger.dev)
power_supply_unregister(&ac->charger); power_supply_unregister(&ac->charger);
unregister_acpi_notifier(&ac->battery_nb); unregister_acpi_notifier(&ac->battery_nb);
@ -292,23 +308,6 @@ static int acpi_ac_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct acpi_device_id acpi_ac_match[] = {
{ "ACPI0003", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, acpi_ac_match);
static struct platform_driver acpi_ac_driver = {
.probe = acpi_ac_probe,
.remove = acpi_ac_remove,
.driver = {
.name = "acpi-ac",
.owner = THIS_MODULE,
.pm = &acpi_ac_pm_ops,
.acpi_match_table = ACPI_PTR(acpi_ac_match),
},
};
static int __init acpi_ac_init(void) static int __init acpi_ac_init(void)
{ {
int result; int result;
@ -316,7 +315,7 @@ static int __init acpi_ac_init(void)
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
result = platform_driver_register(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) if (result < 0)
return -ENODEV; return -ENODEV;
@ -325,7 +324,7 @@ static int __init acpi_ac_init(void)
static void __exit acpi_ac_exit(void) static void __exit acpi_ac_exit(void)
{ {
platform_driver_unregister(&acpi_ac_driver); acpi_bus_unregister_driver(&acpi_ac_driver);
} }
module_init(acpi_ac_init); module_init(acpi_ac_init);
module_exit(acpi_ac_exit); module_exit(acpi_ac_exit);

View file

@ -29,7 +29,6 @@ ACPI_MODULE_NAME("platform");
static const struct acpi_device_id acpi_platform_device_ids[] = { static const struct acpi_device_id acpi_platform_device_ids[] = {
{ "PNP0D40" }, { "PNP0D40" },
{ "ACPI0003" },
{ "VPC2004" }, { "VPC2004" },
{ "BCM4752" }, { "BCM4752" },

View file

@ -405,7 +405,6 @@ static int acpi_processor_add(struct acpi_device *device,
goto err; goto err;
pr->dev = dev; pr->dev = dev;
dev->offline = pr->flags.need_hotplug_init;
/* Trigger the processor driver's .probe() if present. */ /* Trigger the processor driver's .probe() if present. */
if (device_attach(dev) >= 0) if (device_attach(dev) >= 0)

View file

@ -141,9 +141,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
* address. Although ACPICA adheres to the ACPI specification which * address. Although ACPICA adheres to the ACPI specification which
* requires the use of the corresponding 64-bit address if it is non-zero, * requires the use of the corresponding 64-bit address if it is non-zero,
* some machines have been found to have a corrupted non-zero 64-bit * some machines have been found to have a corrupted non-zero 64-bit
* address. Default is FALSE, do not favor the 32-bit addresses. * address. Default is TRUE, favor the 32-bit addresses.
*/ */
ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
/* /*
* Optionally truncate I/O addresses to 16 bits. Provides compatibility * Optionally truncate I/O addresses to 16 bits. Provides compatibility

View file

@ -461,6 +461,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
u32 table_count; u32 table_count;
struct acpi_table_header *table; struct acpi_table_header *table;
acpi_physical_address address; acpi_physical_address address;
acpi_physical_address rsdt_address;
u32 length; u32 length;
u8 *table_entry; u8 *table_entry;
acpi_status status; acpi_status status;
@ -488,11 +489,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
* as per the ACPI specification. * as per the ACPI specification.
*/ */
address = (acpi_physical_address) rsdp->xsdt_physical_address; address = (acpi_physical_address) rsdp->xsdt_physical_address;
rsdt_address =
(acpi_physical_address) rsdp->rsdt_physical_address;
table_entry_size = ACPI_XSDT_ENTRY_SIZE; table_entry_size = ACPI_XSDT_ENTRY_SIZE;
} else { } else {
/* Root table is an RSDT (32-bit physical addresses) */ /* Root table is an RSDT (32-bit physical addresses) */
address = (acpi_physical_address) rsdp->rsdt_physical_address; address = (acpi_physical_address) rsdp->rsdt_physical_address;
rsdt_address = address;
table_entry_size = ACPI_RSDT_ENTRY_SIZE; table_entry_size = ACPI_RSDT_ENTRY_SIZE;
} }
@ -515,8 +519,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
/* Fall back to the RSDT */ /* Fall back to the RSDT */
address = address = rsdt_address;
(acpi_physical_address) rsdp->rsdt_physical_address;
table_entry_size = ACPI_RSDT_ENTRY_SIZE; table_entry_size = ACPI_RSDT_ENTRY_SIZE;
} }
} }

View file

@ -36,6 +36,12 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#endif
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
@ -64,6 +70,19 @@ static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644); module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
#ifdef CONFIG_ACPI_PROCFS_POWER
extern struct proc_dir_entry *acpi_lock_battery_dir(void);
extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
enum acpi_battery_files {
info_tag = 0,
state_tag,
alarm_tag,
ACPI_BATTERY_NUMFILES,
};
#endif
static const struct acpi_device_id battery_device_ids[] = { static const struct acpi_device_id battery_device_ids[] = {
{"PNP0C0A", 0}, {"PNP0C0A", 0},
{"", 0}, {"", 0},
@ -299,6 +318,14 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
#ifdef CONFIG_ACPI_PROCFS_POWER
inline char *acpi_battery_units(struct acpi_battery *battery)
{
return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
"mA" : "mW";
}
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Battery Management Battery Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
@ -716,6 +743,279 @@ static void acpi_battery_refresh(struct acpi_battery *battery)
sysfs_add_battery(battery); sysfs_add_battery(battery);
} }
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS_POWER
static struct proc_dir_entry *acpi_battery_dir;
static int acpi_battery_print_info(struct seq_file *seq, int result)
{
struct acpi_battery *battery = seq->private;
if (result)
goto end;
seq_printf(seq, "present: %s\n",
acpi_battery_present(battery) ? "yes" : "no");
if (!acpi_battery_present(battery))
goto end;
if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "design capacity: unknown\n");
else
seq_printf(seq, "design capacity: %d %sh\n",
battery->design_capacity,
acpi_battery_units(battery));
if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "last full capacity: unknown\n");
else
seq_printf(seq, "last full capacity: %d %sh\n",
battery->full_charge_capacity,
acpi_battery_units(battery));
seq_printf(seq, "battery technology: %srechargeable\n",
(!battery->technology)?"non-":"");
if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "design voltage: unknown\n");
else
seq_printf(seq, "design voltage: %d mV\n",
battery->design_voltage);
seq_printf(seq, "design capacity warning: %d %sh\n",
battery->design_capacity_warning,
acpi_battery_units(battery));
seq_printf(seq, "design capacity low: %d %sh\n",
battery->design_capacity_low,
acpi_battery_units(battery));
seq_printf(seq, "cycle count: %i\n", battery->cycle_count);
seq_printf(seq, "capacity granularity 1: %d %sh\n",
battery->capacity_granularity_1,
acpi_battery_units(battery));
seq_printf(seq, "capacity granularity 2: %d %sh\n",
battery->capacity_granularity_2,
acpi_battery_units(battery));
seq_printf(seq, "model number: %s\n", battery->model_number);
seq_printf(seq, "serial number: %s\n", battery->serial_number);
seq_printf(seq, "battery type: %s\n", battery->type);
seq_printf(seq, "OEM info: %s\n", battery->oem_info);
end:
if (result)
seq_printf(seq, "ERROR: Unable to read battery info\n");
return result;
}
static int acpi_battery_print_state(struct seq_file *seq, int result)
{
struct acpi_battery *battery = seq->private;
if (result)
goto end;
seq_printf(seq, "present: %s\n",
acpi_battery_present(battery) ? "yes" : "no");
if (!acpi_battery_present(battery))
goto end;
seq_printf(seq, "capacity state: %s\n",
(battery->state & 0x04) ? "critical" : "ok");
if ((battery->state & 0x01) && (battery->state & 0x02))
seq_printf(seq,
"charging state: charging/discharging\n");
else if (battery->state & 0x01)
seq_printf(seq, "charging state: discharging\n");
else if (battery->state & 0x02)
seq_printf(seq, "charging state: charging\n");
else
seq_printf(seq, "charging state: charged\n");
if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "present rate: unknown\n");
else
seq_printf(seq, "present rate: %d %s\n",
battery->rate_now, acpi_battery_units(battery));
if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "remaining capacity: unknown\n");
else
seq_printf(seq, "remaining capacity: %d %sh\n",
battery->capacity_now, acpi_battery_units(battery));
if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "present voltage: unknown\n");
else
seq_printf(seq, "present voltage: %d mV\n",
battery->voltage_now);
end:
if (result)
seq_printf(seq, "ERROR: Unable to read battery state\n");
return result;
}
static int acpi_battery_print_alarm(struct seq_file *seq, int result)
{
struct acpi_battery *battery = seq->private;
if (result)
goto end;
if (!acpi_battery_present(battery)) {
seq_printf(seq, "present: no\n");
goto end;
}
seq_printf(seq, "alarm: ");
if (!battery->alarm)
seq_printf(seq, "unsupported\n");
else
seq_printf(seq, "%u %sh\n", battery->alarm,
acpi_battery_units(battery));
end:
if (result)
seq_printf(seq, "ERROR: Unable to read battery alarm\n");
return result;
}
static ssize_t acpi_battery_write_alarm(struct file *file,
const char __user * buffer,
size_t count, loff_t * ppos)
{
int result = 0;
char alarm_string[12] = { '\0' };
struct seq_file *m = file->private_data;
struct acpi_battery *battery = m->private;
if (!battery || (count > sizeof(alarm_string) - 1))
return -EINVAL;
if (!acpi_battery_present(battery)) {
result = -ENODEV;
goto end;
}
if (copy_from_user(alarm_string, buffer, count)) {
result = -EFAULT;
goto end;
}
alarm_string[count] = '\0';
battery->alarm = simple_strtol(alarm_string, NULL, 0);
result = acpi_battery_set_alarm(battery);
end:
if (!result)
return count;
return result;
}
typedef int(*print_func)(struct seq_file *seq, int result);
static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
acpi_battery_print_info,
acpi_battery_print_state,
acpi_battery_print_alarm,
};
static int acpi_battery_read(int fid, struct seq_file *seq)
{
struct acpi_battery *battery = seq->private;
int result = acpi_battery_update(battery);
return acpi_print_funcs[fid](seq, result);
}
#define DECLARE_FILE_FUNCTIONS(_name) \
static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
{ \
return acpi_battery_read(_name##_tag, seq); \
} \
static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
{ \
return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \
}
DECLARE_FILE_FUNCTIONS(info);
DECLARE_FILE_FUNCTIONS(state);
DECLARE_FILE_FUNCTIONS(alarm);
#undef DECLARE_FILE_FUNCTIONS
#define FILE_DESCRIPTION_RO(_name) \
{ \
.name = __stringify(_name), \
.mode = S_IRUGO, \
.ops = { \
.open = acpi_battery_##_name##_open_fs, \
.read = seq_read, \
.llseek = seq_lseek, \
.release = single_release, \
.owner = THIS_MODULE, \
}, \
}
#define FILE_DESCRIPTION_RW(_name) \
{ \
.name = __stringify(_name), \
.mode = S_IFREG | S_IRUGO | S_IWUSR, \
.ops = { \
.open = acpi_battery_##_name##_open_fs, \
.read = seq_read, \
.llseek = seq_lseek, \
.write = acpi_battery_write_##_name, \
.release = single_release, \
.owner = THIS_MODULE, \
}, \
}
static const struct battery_file {
struct file_operations ops;
umode_t mode;
const char *name;
} acpi_battery_file[] = {
FILE_DESCRIPTION_RO(info),
FILE_DESCRIPTION_RO(state),
FILE_DESCRIPTION_RW(alarm),
};
#undef FILE_DESCRIPTION_RO
#undef FILE_DESCRIPTION_RW
static int acpi_battery_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
int i;
printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
" please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_battery_dir);
if (!acpi_device_dir(device))
return -ENODEV;
}
for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
entry = proc_create_data(acpi_battery_file[i].name,
acpi_battery_file[i].mode,
acpi_device_dir(device),
&acpi_battery_file[i].ops,
acpi_driver_data(device));
if (!entry)
return -ENODEV;
}
return 0;
}
static void acpi_battery_remove_fs(struct acpi_device *device)
{
int i;
if (!acpi_device_dir(device))
return;
for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i)
remove_proc_entry(acpi_battery_file[i].name,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
acpi_device_dir(device) = NULL;
}
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
@ -790,6 +1090,15 @@ static int acpi_battery_add(struct acpi_device *device)
result = acpi_battery_update(battery); result = acpi_battery_update(battery);
if (result) if (result)
goto fail; goto fail;
#ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_battery_add_fs(device);
#endif
if (result) {
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device);
#endif
goto fail;
}
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
@ -816,6 +1125,9 @@ static int acpi_battery_remove(struct acpi_device *device)
return -EINVAL; return -EINVAL;
battery = acpi_driver_data(device); battery = acpi_driver_data(device);
unregister_pm_notifier(&battery->pm_nb); unregister_pm_notifier(&battery->pm_nb);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device);
#endif
sysfs_remove_battery(battery); sysfs_remove_battery(battery);
mutex_destroy(&battery->lock); mutex_destroy(&battery->lock);
mutex_destroy(&battery->sysfs_lock); mutex_destroy(&battery->sysfs_lock);
@ -866,7 +1178,19 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
if (dmi_check_system(bat_dmi_table)) if (dmi_check_system(bat_dmi_table))
battery_bix_broken_package = 1; battery_bix_broken_package = 1;
acpi_bus_register_driver(&acpi_battery_driver);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_dir = acpi_lock_battery_dir();
if (!acpi_battery_dir)
return;
#endif
if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_battery_dir(acpi_battery_dir);
#endif
return;
}
return;
} }
static int __init acpi_battery_init(void) static int __init acpi_battery_init(void)
@ -878,6 +1202,9 @@ static int __init acpi_battery_init(void)
static void __exit acpi_battery_exit(void) static void __exit acpi_battery_exit(void)
{ {
acpi_bus_unregister_driver(&acpi_battery_driver); acpi_bus_unregister_driver(&acpi_battery_driver);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_battery_dir(acpi_battery_dir);
#endif
} }
module_init(acpi_battery_init); module_init(acpi_battery_init);

View file

@ -314,6 +314,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
}, },
}, },
{
.callback = dmi_disable_osi_win8,
.ident = "Dell Inspiron 7737",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
},
},
/* /*
* BIOS invocation of _OSI(Linux) is almost always a BIOS bug. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
@ -374,6 +382,19 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"),
}, },
}, },
/*
* Without this this EEEpc exports a non working WMI interface, with
* this it exports a working "good old" eeepc_laptop interface, fixing
* both brightness control, and rfkill not working.
*/
{
.callback = dmi_enable_osi_linux,
.ident = "Asus EEE PC 1015PX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
},
},
{} {}
}; };

105
drivers/acpi/cm_sbs.c Normal file
View file

@ -0,0 +1,105 @@
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define PREFIX "ACPI: "
ACPI_MODULE_NAME("cm_sbs");
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_BATTERY_CLASS "battery"
#define _COMPONENT ACPI_SBS_COMPONENT
static struct proc_dir_entry *acpi_ac_dir;
static struct proc_dir_entry *acpi_battery_dir;
static DEFINE_MUTEX(cm_sbs_mutex);
static int lock_ac_dir_cnt;
static int lock_battery_dir_cnt;
struct proc_dir_entry *acpi_lock_ac_dir(void)
{
mutex_lock(&cm_sbs_mutex);
if (!acpi_ac_dir)
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (acpi_ac_dir) {
lock_ac_dir_cnt++;
} else {
printk(KERN_ERR PREFIX
"Cannot create %s\n", ACPI_AC_CLASS);
}
mutex_unlock(&cm_sbs_mutex);
return acpi_ac_dir;
}
EXPORT_SYMBOL(acpi_lock_ac_dir);
void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
{
mutex_lock(&cm_sbs_mutex);
if (acpi_ac_dir_param)
lock_ac_dir_cnt--;
if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
acpi_ac_dir = NULL;
}
mutex_unlock(&cm_sbs_mutex);
}
EXPORT_SYMBOL(acpi_unlock_ac_dir);
struct proc_dir_entry *acpi_lock_battery_dir(void)
{
mutex_lock(&cm_sbs_mutex);
if (!acpi_battery_dir) {
acpi_battery_dir =
proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
}
if (acpi_battery_dir) {
lock_battery_dir_cnt++;
} else {
printk(KERN_ERR PREFIX
"Cannot create %s\n", ACPI_BATTERY_CLASS);
}
mutex_unlock(&cm_sbs_mutex);
return acpi_battery_dir;
}
EXPORT_SYMBOL(acpi_lock_battery_dir);
void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
{
mutex_lock(&cm_sbs_mutex);
if (acpi_battery_dir_param)
lock_battery_dir_cnt--;
if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
&& acpi_battery_dir) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
acpi_battery_dir = NULL;
}
mutex_unlock(&cm_sbs_mutex);
return;
}
EXPORT_SYMBOL(acpi_unlock_battery_dir);

View file

@ -457,10 +457,10 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
}, },
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "ThinkPad T430s", .ident = "ThinkPad T430 and T430s",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430"),
}, },
}, },
{ {
@ -472,7 +472,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
}, },
}, },
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "ThinkPad X1 Carbon", .ident = "ThinkPad X1 Carbon",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@ -500,7 +500,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
.ident = "Dell Inspiron 7520", .ident = "Dell Inspiron 7520",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"), DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"),
}, },
}, },
{ {
@ -511,6 +511,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"),
}, },
}, },
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire 5742G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5742G"),
},
},
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "Acer Aspire V5-431", .ident = "Acer Aspire V5-431",

View file

@ -815,7 +815,7 @@ config PATA_AT32
config PATA_AT91 config PATA_AT91
tristate "PATA support for AT91SAM9260" tristate "PATA support for AT91SAM9260"
depends on ARM && ARCH_AT91 depends on ARM && SOC_AT91SAM9
help help
This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. This option enables support for IDE devices on the Atmel AT91SAM9260 SoC.

View file

@ -1115,6 +1115,17 @@ static bool ahci_broken_online(struct pci_dev *pdev)
return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff);
} }
static bool ahci_broken_devslp(struct pci_dev *pdev)
{
/* device with broken DEVSLP but still showing SDS capability */
static const struct pci_device_id ids[] = {
{ PCI_VDEVICE(INTEL, 0x0f23)}, /* Valleyview SoC */
{}
};
return pci_match_id(ids, pdev);
}
#ifdef CONFIG_ATA_ACPI #ifdef CONFIG_ATA_ACPI
static void ahci_gtf_filter_workaround(struct ata_host *host) static void ahci_gtf_filter_workaround(struct ata_host *host)
{ {
@ -1364,6 +1375,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar]; hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar];
/* must set flag prior to save config in order to take effect */
if (ahci_broken_devslp(pdev))
hpriv->flags |= AHCI_HFLAG_NO_DEVSLP;
/* save initial config */ /* save initial config */
ahci_pci_save_initial_config(pdev, hpriv); ahci_pci_save_initial_config(pdev, hpriv);

View file

@ -236,6 +236,7 @@ enum {
port start (wait until port start (wait until
error-handling stage) */ error-handling stage) */
AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */ AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */
AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */
/* ap->flags bits */ /* ap->flags bits */

View file

@ -29,9 +29,25 @@
#include "ahci.h" #include "ahci.h"
enum { enum {
PORT_PHY_CTL = 0x178, /* Port0 PHY Control */ /* Timer 1-ms Register */
PORT_PHY_CTL_PDDQ_LOC = 0x100000, /* PORT_PHY_CTL bits */ IMX_TIMER1MS = 0x00e0,
HOST_TIMER1MS = 0xe0, /* Timer 1-ms */ /* Port0 PHY Control Register */
IMX_P0PHYCR = 0x0178,
IMX_P0PHYCR_TEST_PDDQ = 1 << 20,
IMX_P0PHYCR_CR_READ = 1 << 19,
IMX_P0PHYCR_CR_WRITE = 1 << 18,
IMX_P0PHYCR_CR_CAP_DATA = 1 << 17,
IMX_P0PHYCR_CR_CAP_ADDR = 1 << 16,
/* Port0 PHY Status Register */
IMX_P0PHYSR = 0x017c,
IMX_P0PHYSR_CR_ACK = 1 << 18,
IMX_P0PHYSR_CR_DATA_OUT = 0xffff << 0,
/* Lane0 Output Status Register */
IMX_LANE0_OUT_STAT = 0x2003,
IMX_LANE0_OUT_STAT_RX_PLL_STATE = 1 << 1,
/* Clock Reset Register */
IMX_CLOCK_RESET = 0x7f3f,
IMX_CLOCK_RESET_RESET = 1 << 0,
}; };
enum ahci_imx_type { enum ahci_imx_type {
@ -54,9 +70,149 @@ MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support
static void ahci_imx_host_stop(struct ata_host *host); static void ahci_imx_host_stop(struct ata_host *host);
static int imx_phy_crbit_assert(void __iomem *mmio, u32 bit, bool assert)
{
int timeout = 10;
u32 crval;
u32 srval;
/* Assert or deassert the bit */
crval = readl(mmio + IMX_P0PHYCR);
if (assert)
crval |= bit;
else
crval &= ~bit;
writel(crval, mmio + IMX_P0PHYCR);
/* Wait for the cr_ack signal */
do {
srval = readl(mmio + IMX_P0PHYSR);
if ((assert ? srval : ~srval) & IMX_P0PHYSR_CR_ACK)
break;
usleep_range(100, 200);
} while (--timeout);
return timeout ? 0 : -ETIMEDOUT;
}
static int imx_phy_reg_addressing(u16 addr, void __iomem *mmio)
{
u32 crval = addr;
int ret;
/* Supply the address on cr_data_in */
writel(crval, mmio + IMX_P0PHYCR);
/* Assert the cr_cap_addr signal */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_ADDR, true);
if (ret)
return ret;
/* Deassert cr_cap_addr */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_ADDR, false);
if (ret)
return ret;
return 0;
}
static int imx_phy_reg_write(u16 val, void __iomem *mmio)
{
u32 crval = val;
int ret;
/* Supply the data on cr_data_in */
writel(crval, mmio + IMX_P0PHYCR);
/* Assert the cr_cap_data signal */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_DATA, true);
if (ret)
return ret;
/* Deassert cr_cap_data */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_DATA, false);
if (ret)
return ret;
if (val & IMX_CLOCK_RESET_RESET) {
/*
* In case we're resetting the phy, it's unable to acknowledge,
* so we return immediately here.
*/
crval |= IMX_P0PHYCR_CR_WRITE;
writel(crval, mmio + IMX_P0PHYCR);
goto out;
}
/* Assert the cr_write signal */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_WRITE, true);
if (ret)
return ret;
/* Deassert cr_write */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_WRITE, false);
if (ret)
return ret;
out:
return 0;
}
static int imx_phy_reg_read(u16 *val, void __iomem *mmio)
{
int ret;
/* Assert the cr_read signal */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_READ, true);
if (ret)
return ret;
/* Capture the data from cr_data_out[] */
*val = readl(mmio + IMX_P0PHYSR) & IMX_P0PHYSR_CR_DATA_OUT;
/* Deassert cr_read */
ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_READ, false);
if (ret)
return ret;
return 0;
}
static int imx_sata_phy_reset(struct ahci_host_priv *hpriv)
{
void __iomem *mmio = hpriv->mmio;
int timeout = 10;
u16 val;
int ret;
/* Reset SATA PHY by setting RESET bit of PHY register CLOCK_RESET */
ret = imx_phy_reg_addressing(IMX_CLOCK_RESET, mmio);
if (ret)
return ret;
ret = imx_phy_reg_write(IMX_CLOCK_RESET_RESET, mmio);
if (ret)
return ret;
/* Wait for PHY RX_PLL to be stable */
do {
usleep_range(100, 200);
ret = imx_phy_reg_addressing(IMX_LANE0_OUT_STAT, mmio);
if (ret)
return ret;
ret = imx_phy_reg_read(&val, mmio);
if (ret)
return ret;
if (val & IMX_LANE0_OUT_STAT_RX_PLL_STATE)
break;
} while (--timeout);
return timeout ? 0 : -ETIMEDOUT;
}
static int imx_sata_enable(struct ahci_host_priv *hpriv) static int imx_sata_enable(struct ahci_host_priv *hpriv)
{ {
struct imx_ahci_priv *imxpriv = hpriv->plat_data; struct imx_ahci_priv *imxpriv = hpriv->plat_data;
struct device *dev = &imxpriv->ahci_pdev->dev;
int ret; int ret;
if (imxpriv->no_device) if (imxpriv->no_device)
@ -101,6 +257,14 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13, regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
IMX6Q_GPR13_SATA_MPLL_CLK_EN, IMX6Q_GPR13_SATA_MPLL_CLK_EN,
IMX6Q_GPR13_SATA_MPLL_CLK_EN); IMX6Q_GPR13_SATA_MPLL_CLK_EN);
usleep_range(100, 200);
ret = imx_sata_phy_reset(hpriv);
if (ret) {
dev_err(dev, "failed to reset phy: %d\n", ret);
goto disable_regulator;
}
} }
usleep_range(1000, 2000); usleep_range(1000, 2000);
@ -156,8 +320,8 @@ static void ahci_imx_error_handler(struct ata_port *ap)
* without full reset once the pddq mode is enabled making it * without full reset once the pddq mode is enabled making it
* impossible to use as part of libata LPM. * impossible to use as part of libata LPM.
*/ */
reg_val = readl(mmio + PORT_PHY_CTL); reg_val = readl(mmio + IMX_P0PHYCR);
writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL); writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR);
imx_sata_disable(hpriv); imx_sata_disable(hpriv);
imxpriv->no_device = true; imxpriv->no_device = true;
} }
@ -217,6 +381,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
if (!imxpriv) if (!imxpriv)
return -ENOMEM; return -ENOMEM;
imxpriv->ahci_pdev = pdev;
imxpriv->no_device = false; imxpriv->no_device = false;
imxpriv->first_time = true; imxpriv->first_time = true;
imxpriv->type = (enum ahci_imx_type)of_id->data; imxpriv->type = (enum ahci_imx_type)of_id->data;
@ -248,7 +413,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
/* /*
* Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL,
* and IP vendor specific register HOST_TIMER1MS. * and IP vendor specific register IMX_TIMER1MS.
* Configure CAP_SSS (support stagered spin up). * Configure CAP_SSS (support stagered spin up).
* Implement the port0. * Implement the port0.
* Get the ahb clock rate, and configure the TIMER1MS register. * Get the ahb clock rate, and configure the TIMER1MS register.
@ -265,7 +430,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
} }
reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
writel(reg_val, hpriv->mmio + HOST_TIMER1MS); writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0); ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0);
if (ret) if (ret)

View file

@ -452,6 +452,13 @@ void ahci_save_initial_config(struct device *dev,
cap &= ~HOST_CAP_SNTF; cap &= ~HOST_CAP_SNTF;
} }
if ((cap2 & HOST_CAP2_SDS) && (hpriv->flags & AHCI_HFLAG_NO_DEVSLP)) {
dev_info(dev,
"controller can't do DEVSLP, turning off\n");
cap2 &= ~HOST_CAP2_SDS;
cap2 &= ~HOST_CAP2_SADM;
}
if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) {
dev_info(dev, "controller can do FBS, turning on CAP_FBS\n"); dev_info(dev, "controller can do FBS, turning on CAP_FBS\n");
cap |= HOST_CAP_FBS; cap |= HOST_CAP_FBS;

View file

@ -6314,6 +6314,8 @@ int ata_host_activate(struct ata_host *host, int irq,
static void ata_port_detach(struct ata_port *ap) static void ata_port_detach(struct ata_port *ap)
{ {
unsigned long flags; unsigned long flags;
struct ata_link *link;
struct ata_device *dev;
if (!ap->ops->error_handler) if (!ap->ops->error_handler)
goto skip_eh; goto skip_eh;
@ -6333,6 +6335,13 @@ static void ata_port_detach(struct ata_port *ap)
cancel_delayed_work_sync(&ap->hotplug_task); cancel_delayed_work_sync(&ap->hotplug_task);
skip_eh: skip_eh:
/* clean up zpodd on port removal */
ata_for_each_link(link, ap, HOST_FIRST) {
ata_for_each_dev(dev, link, ALL) {
if (zpodd_dev_enabled(dev))
zpodd_exit(dev);
}
}
if (ap->pmp_link) { if (ap->pmp_link) {
int i; int i;
for (i = 0; i < SATA_PMP_MAX_PORTS; i++) for (i = 0; i < SATA_PMP_MAX_PORTS; i++)

View file

@ -995,8 +995,11 @@ retry:
ibytes = min_t(size_t, ibytes, have_bytes - reserved); ibytes = min_t(size_t, ibytes, have_bytes - reserved);
if (ibytes < min) if (ibytes < min)
ibytes = 0; ibytes = 0;
entropy_count = max_t(int, 0, if (have_bytes >= ibytes + reserved)
entropy_count - (ibytes << (ENTROPY_SHIFT + 3))); entropy_count -= ibytes << (ENTROPY_SHIFT + 3);
else
entropy_count = reserved << (ENTROPY_SHIFT + 3);
if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
goto retry; goto retry;

View file

@ -328,13 +328,11 @@ int tpm_add_ppi(struct kobject *parent)
/* Cache TPM ACPI handle and version string */ /* Cache TPM ACPI handle and version string */
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
ppi_callback, NULL, NULL, &tpm_ppi_handle); ppi_callback, NULL, NULL, &tpm_ppi_handle);
if (tpm_ppi_handle == NULL) return tpm_ppi_handle ? sysfs_create_group(parent, &ppi_attr_grp) : 0;
return -ENODEV;
return sysfs_create_group(parent, &ppi_attr_grp);
} }
void tpm_remove_ppi(struct kobject *parent) void tpm_remove_ppi(struct kobject *parent)
{ {
sysfs_remove_group(parent, &ppi_attr_grp); if (tpm_ppi_handle)
sysfs_remove_group(parent, &ppi_attr_grp);
} }

View file

@ -27,7 +27,7 @@ LIST_HEAD(ccu_list); /* The list of set up CCUs */
static bool clk_requires_trigger(struct kona_clk *bcm_clk) static bool clk_requires_trigger(struct kona_clk *bcm_clk)
{ {
struct peri_clk_data *peri = bcm_clk->peri; struct peri_clk_data *peri = bcm_clk->u.peri;
struct bcm_clk_sel *sel; struct bcm_clk_sel *sel;
struct bcm_clk_div *div; struct bcm_clk_div *div;
@ -63,7 +63,7 @@ static bool peri_clk_data_offsets_valid(struct kona_clk *bcm_clk)
u32 limit; u32 limit;
BUG_ON(bcm_clk->type != bcm_clk_peri); BUG_ON(bcm_clk->type != bcm_clk_peri);
peri = bcm_clk->peri; peri = bcm_clk->u.peri;
name = bcm_clk->name; name = bcm_clk->name;
range = bcm_clk->ccu->range; range = bcm_clk->ccu->range;
@ -81,19 +81,19 @@ static bool peri_clk_data_offsets_valid(struct kona_clk *bcm_clk)
div = &peri->div; div = &peri->div;
if (divider_exists(div)) { if (divider_exists(div)) {
if (div->offset > limit) { if (div->u.s.offset > limit) {
pr_err("%s: bad divider offset for %s (%u > %u)\n", pr_err("%s: bad divider offset for %s (%u > %u)\n",
__func__, name, div->offset, limit); __func__, name, div->u.s.offset, limit);
return false; return false;
} }
} }
div = &peri->pre_div; div = &peri->pre_div;
if (divider_exists(div)) { if (divider_exists(div)) {
if (div->offset > limit) { if (div->u.s.offset > limit) {
pr_err("%s: bad pre-divider offset for %s " pr_err("%s: bad pre-divider offset for %s "
"(%u > %u)\n", "(%u > %u)\n",
__func__, name, div->offset, limit); __func__, name, div->u.s.offset, limit);
return false; return false;
} }
} }
@ -249,21 +249,22 @@ static bool div_valid(struct bcm_clk_div *div, const char *field_name,
{ {
if (divider_is_fixed(div)) { if (divider_is_fixed(div)) {
/* Any fixed divider value but 0 is OK */ /* Any fixed divider value but 0 is OK */
if (div->fixed == 0) { if (div->u.fixed == 0) {
pr_err("%s: bad %s fixed value 0 for %s\n", __func__, pr_err("%s: bad %s fixed value 0 for %s\n", __func__,
field_name, clock_name); field_name, clock_name);
return false; return false;
} }
return true; return true;
} }
if (!bitfield_valid(div->shift, div->width, field_name, clock_name)) if (!bitfield_valid(div->u.s.shift, div->u.s.width,
field_name, clock_name))
return false; return false;
if (divider_has_fraction(div)) if (divider_has_fraction(div))
if (div->frac_width > div->width) { if (div->u.s.frac_width > div->u.s.width) {
pr_warn("%s: bad %s fraction width for %s (%u > %u)\n", pr_warn("%s: bad %s fraction width for %s (%u > %u)\n",
__func__, field_name, clock_name, __func__, field_name, clock_name,
div->frac_width, div->width); div->u.s.frac_width, div->u.s.width);
return false; return false;
} }
@ -278,7 +279,7 @@ static bool div_valid(struct bcm_clk_div *div, const char *field_name,
*/ */
static bool kona_dividers_valid(struct kona_clk *bcm_clk) static bool kona_dividers_valid(struct kona_clk *bcm_clk)
{ {
struct peri_clk_data *peri = bcm_clk->peri; struct peri_clk_data *peri = bcm_clk->u.peri;
struct bcm_clk_div *div; struct bcm_clk_div *div;
struct bcm_clk_div *pre_div; struct bcm_clk_div *pre_div;
u32 limit; u32 limit;
@ -295,7 +296,7 @@ static bool kona_dividers_valid(struct kona_clk *bcm_clk)
limit = BITS_PER_BYTE * sizeof(u32); limit = BITS_PER_BYTE * sizeof(u32);
return div->frac_width + pre_div->frac_width <= limit; return div->u.s.frac_width + pre_div->u.s.frac_width <= limit;
} }
@ -328,7 +329,7 @@ peri_clk_data_valid(struct kona_clk *bcm_clk)
if (!peri_clk_data_offsets_valid(bcm_clk)) if (!peri_clk_data_offsets_valid(bcm_clk))
return false; return false;
peri = bcm_clk->peri; peri = bcm_clk->u.peri;
name = bcm_clk->name; name = bcm_clk->name;
gate = &peri->gate; gate = &peri->gate;
if (gate_exists(gate) && !gate_valid(gate, "gate", name)) if (gate_exists(gate) && !gate_valid(gate, "gate", name))
@ -588,12 +589,12 @@ static void bcm_clk_teardown(struct kona_clk *bcm_clk)
{ {
switch (bcm_clk->type) { switch (bcm_clk->type) {
case bcm_clk_peri: case bcm_clk_peri:
peri_clk_teardown(bcm_clk->data, &bcm_clk->init_data); peri_clk_teardown(bcm_clk->u.data, &bcm_clk->init_data);
break; break;
default: default:
break; break;
} }
bcm_clk->data = NULL; bcm_clk->u.data = NULL;
bcm_clk->type = bcm_clk_none; bcm_clk->type = bcm_clk_none;
} }
@ -644,7 +645,7 @@ struct clk *kona_clk_setup(struct ccu_data *ccu, const char *name,
break; break;
} }
bcm_clk->type = type; bcm_clk->type = type;
bcm_clk->data = data; bcm_clk->u.data = data;
/* Make sure everything makes sense before we set it up */ /* Make sure everything makes sense before we set it up */
if (!kona_clk_valid(bcm_clk)) { if (!kona_clk_valid(bcm_clk)) {

View file

@ -61,7 +61,7 @@ u64 do_div_round_closest(u64 dividend, unsigned long divisor)
/* Convert a divider into the scaled divisor value it represents. */ /* Convert a divider into the scaled divisor value it represents. */
static inline u64 scaled_div_value(struct bcm_clk_div *div, u32 reg_div) static inline u64 scaled_div_value(struct bcm_clk_div *div, u32 reg_div)
{ {
return (u64)reg_div + ((u64)1 << div->frac_width); return (u64)reg_div + ((u64)1 << div->u.s.frac_width);
} }
/* /*
@ -77,7 +77,7 @@ u64 scaled_div_build(struct bcm_clk_div *div, u32 div_value, u32 billionths)
BUG_ON(billionths >= BILLION); BUG_ON(billionths >= BILLION);
combined = (u64)div_value * BILLION + billionths; combined = (u64)div_value * BILLION + billionths;
combined <<= div->frac_width; combined <<= div->u.s.frac_width;
return do_div_round_closest(combined, BILLION); return do_div_round_closest(combined, BILLION);
} }
@ -87,7 +87,7 @@ static inline u64
scaled_div_min(struct bcm_clk_div *div) scaled_div_min(struct bcm_clk_div *div)
{ {
if (divider_is_fixed(div)) if (divider_is_fixed(div))
return (u64)div->fixed; return (u64)div->u.fixed;
return scaled_div_value(div, 0); return scaled_div_value(div, 0);
} }
@ -98,9 +98,9 @@ u64 scaled_div_max(struct bcm_clk_div *div)
u32 reg_div; u32 reg_div;
if (divider_is_fixed(div)) if (divider_is_fixed(div))
return (u64)div->fixed; return (u64)div->u.fixed;
reg_div = ((u32)1 << div->width) - 1; reg_div = ((u32)1 << div->u.s.width) - 1;
return scaled_div_value(div, reg_div); return scaled_div_value(div, reg_div);
} }
@ -115,7 +115,7 @@ divider(struct bcm_clk_div *div, u64 scaled_div)
BUG_ON(scaled_div < scaled_div_min(div)); BUG_ON(scaled_div < scaled_div_min(div));
BUG_ON(scaled_div > scaled_div_max(div)); BUG_ON(scaled_div > scaled_div_max(div));
return (u32)(scaled_div - ((u64)1 << div->frac_width)); return (u32)(scaled_div - ((u64)1 << div->u.s.frac_width));
} }
/* Return a rate scaled for use when dividing by a scaled divisor. */ /* Return a rate scaled for use when dividing by a scaled divisor. */
@ -125,7 +125,7 @@ scale_rate(struct bcm_clk_div *div, u32 rate)
if (divider_is_fixed(div)) if (divider_is_fixed(div))
return (u64)rate; return (u64)rate;
return (u64)rate << div->frac_width; return (u64)rate << div->u.s.frac_width;
} }
/* CCU access */ /* CCU access */
@ -398,14 +398,14 @@ static u64 divider_read_scaled(struct ccu_data *ccu, struct bcm_clk_div *div)
u32 reg_div; u32 reg_div;
if (divider_is_fixed(div)) if (divider_is_fixed(div))
return (u64)div->fixed; return (u64)div->u.fixed;
flags = ccu_lock(ccu); flags = ccu_lock(ccu);
reg_val = __ccu_read(ccu, div->offset); reg_val = __ccu_read(ccu, div->u.s.offset);
ccu_unlock(ccu, flags); ccu_unlock(ccu, flags);
/* Extract the full divider field from the register value */ /* Extract the full divider field from the register value */
reg_div = bitfield_extract(reg_val, div->shift, div->width); reg_div = bitfield_extract(reg_val, div->u.s.shift, div->u.s.width);
/* Return the scaled divisor value it represents */ /* Return the scaled divisor value it represents */
return scaled_div_value(div, reg_div); return scaled_div_value(div, reg_div);
@ -433,16 +433,17 @@ static int __div_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate,
* state was defined in the device tree, we just find out * state was defined in the device tree, we just find out
* what its current value is rather than updating it. * what its current value is rather than updating it.
*/ */
if (div->scaled_div == BAD_SCALED_DIV_VALUE) { if (div->u.s.scaled_div == BAD_SCALED_DIV_VALUE) {
reg_val = __ccu_read(ccu, div->offset); reg_val = __ccu_read(ccu, div->u.s.offset);
reg_div = bitfield_extract(reg_val, div->shift, div->width); reg_div = bitfield_extract(reg_val, div->u.s.shift,
div->scaled_div = scaled_div_value(div, reg_div); div->u.s.width);
div->u.s.scaled_div = scaled_div_value(div, reg_div);
return 0; return 0;
} }
/* Convert the scaled divisor to the value we need to record */ /* Convert the scaled divisor to the value we need to record */
reg_div = divider(div, div->scaled_div); reg_div = divider(div, div->u.s.scaled_div);
/* Clock needs to be enabled before changing the rate */ /* Clock needs to be enabled before changing the rate */
enabled = __is_clk_gate_enabled(ccu, gate); enabled = __is_clk_gate_enabled(ccu, gate);
@ -452,9 +453,10 @@ static int __div_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate,
} }
/* Replace the divider value and record the result */ /* Replace the divider value and record the result */
reg_val = __ccu_read(ccu, div->offset); reg_val = __ccu_read(ccu, div->u.s.offset);
reg_val = bitfield_replace(reg_val, div->shift, div->width, reg_div); reg_val = bitfield_replace(reg_val, div->u.s.shift, div->u.s.width,
__ccu_write(ccu, div->offset, reg_val); reg_div);
__ccu_write(ccu, div->u.s.offset, reg_val);
/* If the trigger fails we still want to disable the gate */ /* If the trigger fails we still want to disable the gate */
if (!__clk_trigger(ccu, trig)) if (!__clk_trigger(ccu, trig))
@ -490,11 +492,11 @@ static int divider_write(struct ccu_data *ccu, struct bcm_clk_gate *gate,
BUG_ON(divider_is_fixed(div)); BUG_ON(divider_is_fixed(div));
previous = div->scaled_div; previous = div->u.s.scaled_div;
if (previous == scaled_div) if (previous == scaled_div)
return 0; /* No change */ return 0; /* No change */
div->scaled_div = scaled_div; div->u.s.scaled_div = scaled_div;
flags = ccu_lock(ccu); flags = ccu_lock(ccu);
__ccu_write_enable(ccu); __ccu_write_enable(ccu);
@ -505,7 +507,7 @@ static int divider_write(struct ccu_data *ccu, struct bcm_clk_gate *gate,
ccu_unlock(ccu, flags); ccu_unlock(ccu, flags);
if (ret) if (ret)
div->scaled_div = previous; /* Revert the change */ div->u.s.scaled_div = previous; /* Revert the change */
return ret; return ret;
@ -802,7 +804,7 @@ static int selector_write(struct ccu_data *ccu, struct bcm_clk_gate *gate,
static int kona_peri_clk_enable(struct clk_hw *hw) static int kona_peri_clk_enable(struct clk_hw *hw)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_gate *gate = &bcm_clk->peri->gate; struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate;
return clk_gate(bcm_clk->ccu, bcm_clk->name, gate, true); return clk_gate(bcm_clk->ccu, bcm_clk->name, gate, true);
} }
@ -810,7 +812,7 @@ static int kona_peri_clk_enable(struct clk_hw *hw)
static void kona_peri_clk_disable(struct clk_hw *hw) static void kona_peri_clk_disable(struct clk_hw *hw)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_gate *gate = &bcm_clk->peri->gate; struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate;
(void)clk_gate(bcm_clk->ccu, bcm_clk->name, gate, false); (void)clk_gate(bcm_clk->ccu, bcm_clk->name, gate, false);
} }
@ -818,7 +820,7 @@ static void kona_peri_clk_disable(struct clk_hw *hw)
static int kona_peri_clk_is_enabled(struct clk_hw *hw) static int kona_peri_clk_is_enabled(struct clk_hw *hw)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_gate *gate = &bcm_clk->peri->gate; struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate;
return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0; return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0;
} }
@ -827,7 +829,7 @@ static unsigned long kona_peri_clk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct peri_clk_data *data = bcm_clk->peri; struct peri_clk_data *data = bcm_clk->u.peri;
return clk_recalc_rate(bcm_clk->ccu, &data->div, &data->pre_div, return clk_recalc_rate(bcm_clk->ccu, &data->div, &data->pre_div,
parent_rate); parent_rate);
@ -837,20 +839,20 @@ static long kona_peri_clk_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) unsigned long *parent_rate)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_div *div = &bcm_clk->peri->div; struct bcm_clk_div *div = &bcm_clk->u.peri->div;
if (!divider_exists(div)) if (!divider_exists(div))
return __clk_get_rate(hw->clk); return __clk_get_rate(hw->clk);
/* Quietly avoid a zero rate */ /* Quietly avoid a zero rate */
return round_rate(bcm_clk->ccu, div, &bcm_clk->peri->pre_div, return round_rate(bcm_clk->ccu, div, &bcm_clk->u.peri->pre_div,
rate ? rate : 1, *parent_rate, NULL); rate ? rate : 1, *parent_rate, NULL);
} }
static int kona_peri_clk_set_parent(struct clk_hw *hw, u8 index) static int kona_peri_clk_set_parent(struct clk_hw *hw, u8 index)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct peri_clk_data *data = bcm_clk->peri; struct peri_clk_data *data = bcm_clk->u.peri;
struct bcm_clk_sel *sel = &data->sel; struct bcm_clk_sel *sel = &data->sel;
struct bcm_clk_trig *trig; struct bcm_clk_trig *trig;
int ret; int ret;
@ -884,7 +886,7 @@ static int kona_peri_clk_set_parent(struct clk_hw *hw, u8 index)
static u8 kona_peri_clk_get_parent(struct clk_hw *hw) static u8 kona_peri_clk_get_parent(struct clk_hw *hw)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct peri_clk_data *data = bcm_clk->peri; struct peri_clk_data *data = bcm_clk->u.peri;
u8 index; u8 index;
index = selector_read_index(bcm_clk->ccu, &data->sel); index = selector_read_index(bcm_clk->ccu, &data->sel);
@ -897,7 +899,7 @@ static int kona_peri_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) unsigned long parent_rate)
{ {
struct kona_clk *bcm_clk = to_kona_clk(hw); struct kona_clk *bcm_clk = to_kona_clk(hw);
struct peri_clk_data *data = bcm_clk->peri; struct peri_clk_data *data = bcm_clk->u.peri;
struct bcm_clk_div *div = &data->div; struct bcm_clk_div *div = &data->div;
u64 scaled_div = 0; u64 scaled_div = 0;
int ret; int ret;
@ -958,7 +960,7 @@ struct clk_ops kona_peri_clk_ops = {
static bool __peri_clk_init(struct kona_clk *bcm_clk) static bool __peri_clk_init(struct kona_clk *bcm_clk)
{ {
struct ccu_data *ccu = bcm_clk->ccu; struct ccu_data *ccu = bcm_clk->ccu;
struct peri_clk_data *peri = bcm_clk->peri; struct peri_clk_data *peri = bcm_clk->u.peri;
const char *name = bcm_clk->name; const char *name = bcm_clk->name;
struct bcm_clk_trig *trig; struct bcm_clk_trig *trig;

View file

@ -57,7 +57,7 @@
#define divider_exists(div) FLAG_TEST(div, DIV, EXISTS) #define divider_exists(div) FLAG_TEST(div, DIV, EXISTS)
#define divider_is_fixed(div) FLAG_TEST(div, DIV, FIXED) #define divider_is_fixed(div) FLAG_TEST(div, DIV, FIXED)
#define divider_has_fraction(div) (!divider_is_fixed(div) && \ #define divider_has_fraction(div) (!divider_is_fixed(div) && \
(div)->frac_width > 0) (div)->u.s.frac_width > 0)
#define selector_exists(sel) ((sel)->width != 0) #define selector_exists(sel) ((sel)->width != 0)
#define trigger_exists(trig) FLAG_TEST(trig, TRIG, EXISTS) #define trigger_exists(trig) FLAG_TEST(trig, TRIG, EXISTS)
@ -244,9 +244,9 @@ struct bcm_clk_div {
u32 frac_width; /* field fraction width */ u32 frac_width; /* field fraction width */
u64 scaled_div; /* scaled divider value */ u64 scaled_div; /* scaled divider value */
}; } s;
u32 fixed; /* non-zero fixed divider value */ u32 fixed; /* non-zero fixed divider value */
}; } u;
u32 flags; /* BCM_CLK_DIV_FLAGS_* below */ u32 flags; /* BCM_CLK_DIV_FLAGS_* below */
}; };
@ -263,28 +263,28 @@ struct bcm_clk_div {
/* A fixed (non-zero) divider */ /* A fixed (non-zero) divider */
#define FIXED_DIVIDER(_value) \ #define FIXED_DIVIDER(_value) \
{ \ { \
.fixed = (_value), \ .u.fixed = (_value), \
.flags = FLAG(DIV, EXISTS)|FLAG(DIV, FIXED), \ .flags = FLAG(DIV, EXISTS)|FLAG(DIV, FIXED), \
} }
/* A divider with an integral divisor */ /* A divider with an integral divisor */
#define DIVIDER(_offset, _shift, _width) \ #define DIVIDER(_offset, _shift, _width) \
{ \ { \
.offset = (_offset), \ .u.s.offset = (_offset), \
.shift = (_shift), \ .u.s.shift = (_shift), \
.width = (_width), \ .u.s.width = (_width), \
.scaled_div = BAD_SCALED_DIV_VALUE, \ .u.s.scaled_div = BAD_SCALED_DIV_VALUE, \
.flags = FLAG(DIV, EXISTS), \ .flags = FLAG(DIV, EXISTS), \
} }
/* A divider whose divisor has an integer and fractional part */ /* A divider whose divisor has an integer and fractional part */
#define FRAC_DIVIDER(_offset, _shift, _width, _frac_width) \ #define FRAC_DIVIDER(_offset, _shift, _width, _frac_width) \
{ \ { \
.offset = (_offset), \ .u.s.offset = (_offset), \
.shift = (_shift), \ .u.s.shift = (_shift), \
.width = (_width), \ .u.s.width = (_width), \
.frac_width = (_frac_width), \ .u.s.frac_width = (_frac_width), \
.scaled_div = BAD_SCALED_DIV_VALUE, \ .u.s.scaled_div = BAD_SCALED_DIV_VALUE, \
.flags = FLAG(DIV, EXISTS), \ .flags = FLAG(DIV, EXISTS), \
} }
@ -380,7 +380,7 @@ struct kona_clk {
union { union {
void *data; void *data;
struct peri_clk_data *peri; struct peri_clk_data *peri;
}; } u;
}; };
#define to_kona_clk(_hw) \ #define to_kona_clk(_hw) \
container_of(_hw, struct kona_clk, hw) container_of(_hw, struct kona_clk, hw)

View file

@ -144,6 +144,37 @@ static bool _is_valid_div(struct clk_divider *divider, unsigned int div)
return true; return true;
} }
static int _round_up_table(const struct clk_div_table *table, int div)
{
const struct clk_div_table *clkt;
int up = _get_table_maxdiv(table);
for (clkt = table; clkt->div; clkt++) {
if (clkt->div == div)
return clkt->div;
else if (clkt->div < div)
continue;
if ((clkt->div - div) < (up - div))
up = clkt->div;
}
return up;
}
static int _div_round_up(struct clk_divider *divider,
unsigned long parent_rate, unsigned long rate)
{
int div = DIV_ROUND_UP(parent_rate, rate);
if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
div = __roundup_pow_of_two(div);
if (divider->table)
div = _round_up_table(divider->table, div);
return div;
}
static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
unsigned long *best_parent_rate) unsigned long *best_parent_rate)
{ {
@ -159,7 +190,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) {
parent_rate = *best_parent_rate; parent_rate = *best_parent_rate;
bestdiv = DIV_ROUND_UP(parent_rate, rate); bestdiv = _div_round_up(divider, parent_rate, rate);
bestdiv = bestdiv == 0 ? 1 : bestdiv; bestdiv = bestdiv == 0 ? 1 : bestdiv;
bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv;
return bestdiv; return bestdiv;
@ -219,6 +250,10 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
u32 val; u32 val;
div = DIV_ROUND_UP(parent_rate, rate); div = DIV_ROUND_UP(parent_rate, rate);
if (!_is_valid_div(divider, div))
return -EINVAL;
value = _get_val(divider, div); value = _get_val(divider, div);
if (value > div_mask(divider)) if (value > div_mask(divider))

View file

@ -1984,9 +1984,28 @@ struct clk *__clk_register(struct device *dev, struct clk_hw *hw)
} }
EXPORT_SYMBOL_GPL(__clk_register); EXPORT_SYMBOL_GPL(__clk_register);
static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) /**
* clk_register - allocate a new clock, register it and return an opaque cookie
* @dev: device that is registering this clock
* @hw: link to hardware-specific clock data
*
* clk_register is the primary interface for populating the clock tree with new
* clock nodes. It returns a pointer to the newly allocated struct clk which
* cannot be dereferenced by driver code but may be used in conjuction with the
* rest of the clock API. In the event of an error clk_register will return an
* error code; drivers must test for an error code after calling clk_register.
*/
struct clk *clk_register(struct device *dev, struct clk_hw *hw)
{ {
int i, ret; int i, ret;
struct clk *clk;
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
if (!clk) {
pr_err("%s: could not allocate clk\n", __func__);
ret = -ENOMEM;
goto fail_out;
}
clk->name = kstrdup(hw->init->name, GFP_KERNEL); clk->name = kstrdup(hw->init->name, GFP_KERNEL);
if (!clk->name) { if (!clk->name) {
@ -2026,7 +2045,7 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk)
ret = __clk_init(dev, clk); ret = __clk_init(dev, clk);
if (!ret) if (!ret)
return 0; return clk;
fail_parent_names_copy: fail_parent_names_copy:
while (--i >= 0) while (--i >= 0)
@ -2035,36 +2054,6 @@ fail_parent_names_copy:
fail_parent_names: fail_parent_names:
kfree(clk->name); kfree(clk->name);
fail_name: fail_name:
return ret;
}
/**
* clk_register - allocate a new clock, register it and return an opaque cookie
* @dev: device that is registering this clock
* @hw: link to hardware-specific clock data
*
* clk_register is the primary interface for populating the clock tree with new
* clock nodes. It returns a pointer to the newly allocated struct clk which
* cannot be dereferenced by driver code but may be used in conjuction with the
* rest of the clock API. In the event of an error clk_register will return an
* error code; drivers must test for an error code after calling clk_register.
*/
struct clk *clk_register(struct device *dev, struct clk_hw *hw)
{
int ret;
struct clk *clk;
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
if (!clk) {
pr_err("%s: could not allocate clk\n", __func__);
ret = -ENOMEM;
goto fail_out;
}
ret = _clk_register(dev, hw, clk);
if (!ret)
return clk;
kfree(clk); kfree(clk);
fail_out: fail_out:
return ERR_PTR(ret); return ERR_PTR(ret);
@ -2151,9 +2140,10 @@ void clk_unregister(struct clk *clk)
if (!hlist_empty(&clk->children)) { if (!hlist_empty(&clk->children)) {
struct clk *child; struct clk *child;
struct hlist_node *t;
/* Reparent all children to the orphan list. */ /* Reparent all children to the orphan list. */
hlist_for_each_entry(child, &clk->children, child_node) hlist_for_each_entry_safe(child, t, &clk->children, child_node)
clk_set_parent(child, NULL); clk_set_parent(child, NULL);
} }
@ -2173,7 +2163,7 @@ EXPORT_SYMBOL_GPL(clk_unregister);
static void devm_clk_release(struct device *dev, void *res) static void devm_clk_release(struct device *dev, void *res)
{ {
clk_unregister(res); clk_unregister(*(struct clk **)res);
} }
/** /**
@ -2188,18 +2178,18 @@ static void devm_clk_release(struct device *dev, void *res)
struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw) struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw)
{ {
struct clk *clk; struct clk *clk;
int ret; struct clk **clkp;
clk = devres_alloc(devm_clk_release, sizeof(*clk), GFP_KERNEL); clkp = devres_alloc(devm_clk_release, sizeof(*clkp), GFP_KERNEL);
if (!clk) if (!clkp)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ret = _clk_register(dev, hw, clk); clk = clk_register(dev, hw);
if (!ret) { if (!IS_ERR(clk)) {
devres_add(dev, clk); *clkp = clk;
devres_add(dev, clkp);
} else { } else {
devres_free(clk); devres_free(clkp);
clk = ERR_PTR(ret);
} }
return clk; return clk;

View file

@ -156,6 +156,7 @@ cpg_mstp_clock_register(const char *name, const char *parent_name,
static void __init cpg_mstp_clocks_init(struct device_node *np) static void __init cpg_mstp_clocks_init(struct device_node *np)
{ {
struct mstp_clock_group *group; struct mstp_clock_group *group;
const char *idxname;
struct clk **clks; struct clk **clks;
unsigned int i; unsigned int i;
@ -184,6 +185,11 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
for (i = 0; i < MSTP_MAX_CLOCKS; ++i) for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
clks[i] = ERR_PTR(-ENOENT); clks[i] = ERR_PTR(-ENOENT);
if (of_find_property(np, "clock-indices", &i))
idxname = "clock-indices";
else
idxname = "renesas,clock-indices";
for (i = 0; i < MSTP_MAX_CLOCKS; ++i) { for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
const char *parent_name; const char *parent_name;
const char *name; const char *name;
@ -197,8 +203,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
continue; continue;
parent_name = of_clk_get_parent_name(np, i); parent_name = of_clk_get_parent_name(np, i);
ret = of_property_read_u32_index(np, "renesas,clock-indices", i, ret = of_property_read_u32_index(np, idxname, i, &clkidx);
&clkidx);
if (parent_name == NULL || ret < 0) if (parent_name == NULL || ret < 0)
break; break;

View file

@ -20,6 +20,7 @@
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include "clk.h" #include "clk.h"
@ -43,6 +44,8 @@
#define to_socfpga_clk(p) container_of(p, struct socfpga_pll, hw.hw) #define to_socfpga_clk(p) container_of(p, struct socfpga_pll, hw.hw)
void __iomem *clk_mgr_base_addr;
static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk, static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk,
unsigned long parent_rate) unsigned long parent_rate)
{ {
@ -87,6 +90,7 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
const char *clk_name = node->name; const char *clk_name = node->name;
const char *parent_name[SOCFPGA_MAX_PARENTS]; const char *parent_name[SOCFPGA_MAX_PARENTS];
struct clk_init_data init; struct clk_init_data init;
struct device_node *clkmgr_np;
int rc; int rc;
int i = 0; int i = 0;
@ -96,6 +100,9 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
if (WARN_ON(!pll_clk)) if (WARN_ON(!pll_clk))
return NULL; return NULL;
clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
clk_mgr_base_addr = of_iomap(clkmgr_np, 0);
BUG_ON(!clk_mgr_base_addr);
pll_clk->hw.reg = clk_mgr_base_addr + reg; pll_clk->hw.reg = clk_mgr_base_addr + reg;
of_property_read_string(node, "clock-output-names", &clk_name); of_property_read_string(node, "clock-output-names", &clk_name);

View file

@ -17,28 +17,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include "clk.h" #include "clk.h"
void __iomem *clk_mgr_base_addr; CLK_OF_DECLARE(socfpga_pll_clk, "altr,socfpga-pll-clock", socfpga_pll_init);
CLK_OF_DECLARE(socfpga_perip_clk, "altr,socfpga-perip-clk", socfpga_periph_init);
static const struct of_device_id socfpga_child_clocks[] __initconst = { CLK_OF_DECLARE(socfpga_gate_clk, "altr,socfpga-gate-clk", socfpga_gate_init);
{ .compatible = "altr,socfpga-pll-clock", socfpga_pll_init, },
{ .compatible = "altr,socfpga-perip-clk", socfpga_periph_init, },
{ .compatible = "altr,socfpga-gate-clk", socfpga_gate_init, },
{},
};
static void __init socfpga_clkmgr_init(struct device_node *node)
{
clk_mgr_base_addr = of_iomap(node, 0);
of_clk_init(socfpga_child_clocks);
}
CLK_OF_DECLARE(socfpga_mgr, "altr,clk-mgr", socfpga_clkmgr_init);

View file

@ -1718,7 +1718,7 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
"pll_re_vco"); "pll_re_vco");
} else { } else {
val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL); val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
pll_writel(val, pll_params->aux_reg, pll); pll_writel(val_aux, pll_params->aux_reg, pll);
} }
clk = _tegra_clk_register_pll(pll, name, parent_name, flags, clk = _tegra_clk_register_pll(pll, name, parent_name, flags,

View file

@ -37,6 +37,7 @@
#define BYT_RATIOS 0x66a #define BYT_RATIOS 0x66a
#define BYT_VIDS 0x66b #define BYT_VIDS 0x66b
#define BYT_TURBO_RATIOS 0x66c #define BYT_TURBO_RATIOS 0x66c
#define BYT_TURBO_VIDS 0x66d
#define FRAC_BITS 6 #define FRAC_BITS 6
@ -70,8 +71,9 @@ struct pstate_data {
}; };
struct vid_data { struct vid_data {
int32_t min; int min;
int32_t max; int max;
int turbo;
int32_t ratio; int32_t ratio;
}; };
@ -359,14 +361,14 @@ static int byt_get_min_pstate(void)
{ {
u64 value; u64 value;
rdmsrl(BYT_RATIOS, value); rdmsrl(BYT_RATIOS, value);
return (value >> 8) & 0xFF; return (value >> 8) & 0x3F;
} }
static int byt_get_max_pstate(void) static int byt_get_max_pstate(void)
{ {
u64 value; u64 value;
rdmsrl(BYT_RATIOS, value); rdmsrl(BYT_RATIOS, value);
return (value >> 16) & 0xFF; return (value >> 16) & 0x3F;
} }
static int byt_get_turbo_pstate(void) static int byt_get_turbo_pstate(void)
@ -393,6 +395,9 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate)
vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max); vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max);
vid = fp_toint(vid_fp); vid = fp_toint(vid_fp);
if (pstate > cpudata->pstate.max_pstate)
vid = cpudata->vid.turbo;
val |= vid; val |= vid;
wrmsrl(MSR_IA32_PERF_CTL, val); wrmsrl(MSR_IA32_PERF_CTL, val);
@ -402,13 +407,17 @@ static void byt_get_vid(struct cpudata *cpudata)
{ {
u64 value; u64 value;
rdmsrl(BYT_VIDS, value); rdmsrl(BYT_VIDS, value);
cpudata->vid.min = int_tofp((value >> 8) & 0x7f); cpudata->vid.min = int_tofp((value >> 8) & 0x3f);
cpudata->vid.max = int_tofp((value >> 16) & 0x7f); cpudata->vid.max = int_tofp((value >> 16) & 0x3f);
cpudata->vid.ratio = div_fp( cpudata->vid.ratio = div_fp(
cpudata->vid.max - cpudata->vid.min, cpudata->vid.max - cpudata->vid.min,
int_tofp(cpudata->pstate.max_pstate - int_tofp(cpudata->pstate.max_pstate -
cpudata->pstate.min_pstate)); cpudata->pstate.min_pstate));
rdmsrl(BYT_TURBO_VIDS, value);
cpudata->vid.turbo = value & 0x7f;
} }
@ -545,12 +554,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
if (pstate_funcs.get_vid) if (pstate_funcs.get_vid)
pstate_funcs.get_vid(cpu); pstate_funcs.get_vid(cpu);
intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate);
/*
* goto max pstate so we don't slow up boot if we are built-in if we are
* a module we will take care of it during normal operation
*/
intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
} }
static inline void intel_pstate_calc_busy(struct cpudata *cpu, static inline void intel_pstate_calc_busy(struct cpudata *cpu,
@ -695,11 +699,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu = all_cpu_data[cpunum]; cpu = all_cpu_data[cpunum];
intel_pstate_get_cpu_pstates(cpu); intel_pstate_get_cpu_pstates(cpu);
if (!cpu->pstate.current_pstate) {
all_cpu_data[cpunum] = NULL;
kfree(cpu);
return -ENODATA;
}
cpu->cpu = cpunum; cpu->cpu = cpunum;
@ -710,7 +709,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu->timer.expires = jiffies + HZ/100; cpu->timer.expires = jiffies + HZ/100;
intel_pstate_busy_pid_reset(cpu); intel_pstate_busy_pid_reset(cpu);
intel_pstate_sample(cpu); intel_pstate_sample(cpu);
intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate);
add_timer_on(&cpu->timer, cpunum); add_timer_on(&cpu->timer, cpunum);

View file

@ -62,7 +62,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
set_cpus_allowed_ptr(current, &cpus_allowed); set_cpus_allowed_ptr(current, &cpus_allowed);
/* setting the cpu frequency */ /* setting the cpu frequency */
clk_set_rate(policy->clk, freq); clk_set_rate(policy->clk, freq * 1000);
return 0; return 0;
} }
@ -92,7 +92,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
i++) i++)
loongson2_clockmod_table[i].frequency = (rate * i) / 8; loongson2_clockmod_table[i].frequency = (rate * i) / 8;
ret = clk_set_rate(cpuclk, rate); ret = clk_set_rate(cpuclk, rate * 1000);
if (ret) { if (ret) {
clk_put(cpuclk); clk_put(cpuclk);
return ret; return ret;

View file

@ -16,9 +16,13 @@
char *tmp; \ char *tmp; \
\ \
tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \ tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \
sprintf(tmp, format, param); \ if (likely(tmp)) { \
strcat(str, tmp); \ sprintf(tmp, format, param); \
kfree(tmp); \ strcat(str, tmp); \
kfree(tmp); \
} else { \
strcat(str, "kmalloc failure in SPRINTFCAT"); \
} \
} }
static void report_jump_idx(u32 status, char *outstr) static void report_jump_idx(u32 status, char *outstr)

View file

@ -756,6 +756,7 @@ static const struct {
*/ */
{ ACPI_SIG_IBFT }, { ACPI_SIG_IBFT },
{ "iBFT" }, { "iBFT" },
{ "BIFT" }, /* Broadcom iSCSI Offload */
}; };
static void __init acpi_find_ibft_region(void) static void __init acpi_find_ibft_region(void)

View file

@ -305,6 +305,8 @@ static struct ichx_desc ich6_desc = {
.ngpio = 50, .ngpio = 50,
.have_blink = true, .have_blink = true,
.regs = ichx_regs,
.reglen = ichx_reglen,
}; };
/* Intel 3100 */ /* Intel 3100 */
@ -324,6 +326,8 @@ static struct ichx_desc i3100_desc = {
.uses_gpe0 = true, .uses_gpe0 = true,
.ngpio = 50, .ngpio = 50,
.regs = ichx_regs,
.reglen = ichx_reglen,
}; };
/* ICH7 and ICH8-based */ /* ICH7 and ICH8-based */

View file

@ -894,9 +894,11 @@ static int mcp23s08_probe(struct spi_device *spi)
dev_err(&spi->dev, "invalid spi-present-mask\n"); dev_err(&spi->dev, "invalid spi-present-mask\n");
return -ENODEV; return -ENODEV;
} }
for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) if ((spi_present_mask & (1 << addr)))
chips++;
pullups[addr] = 0; pullups[addr] = 0;
}
} else { } else {
type = spi_get_device_id(spi)->driver_data; type = spi_get_device_id(spi)->driver_data;
pdata = dev_get_platdata(&spi->dev); pdata = dev_get_platdata(&spi->dev);
@ -919,12 +921,12 @@ static int mcp23s08_probe(struct spi_device *spi)
pullups[addr] = pdata->chip[addr].pullups; pullups[addr] = pdata->chip[addr].pullups;
} }
if (!chips)
return -ENODEV;
base = pdata->base; base = pdata->base;
} }
if (!chips)
return -ENODEV;
data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08), data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08),
GFP_KERNEL); GFP_KERNEL);
if (!data) if (!data)

View file

@ -560,47 +560,71 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
dev_priv->vbt.edp_pps = *edp_pps; dev_priv->vbt.edp_pps = *edp_pps;
dev_priv->vbt.edp_rate = edp_link_params->rate ? DP_LINK_BW_2_7 : switch (edp_link_params->rate) {
DP_LINK_BW_1_62; case EDP_RATE_1_62:
dev_priv->vbt.edp_rate = DP_LINK_BW_1_62;
break;
case EDP_RATE_2_7:
dev_priv->vbt.edp_rate = DP_LINK_BW_2_7;
break;
default:
DRM_DEBUG_KMS("VBT has unknown eDP link rate value %u\n",
edp_link_params->rate);
break;
}
switch (edp_link_params->lanes) { switch (edp_link_params->lanes) {
case 0: case EDP_LANE_1:
dev_priv->vbt.edp_lanes = 1; dev_priv->vbt.edp_lanes = 1;
break; break;
case 1: case EDP_LANE_2:
dev_priv->vbt.edp_lanes = 2; dev_priv->vbt.edp_lanes = 2;
break; break;
case 3: case EDP_LANE_4:
default:
dev_priv->vbt.edp_lanes = 4; dev_priv->vbt.edp_lanes = 4;
break; break;
default:
DRM_DEBUG_KMS("VBT has unknown eDP lane count value %u\n",
edp_link_params->lanes);
break;
} }
switch (edp_link_params->preemphasis) { switch (edp_link_params->preemphasis) {
case 0: case EDP_PREEMPHASIS_NONE:
dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_0; dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_0;
break; break;
case 1: case EDP_PREEMPHASIS_3_5dB:
dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5; dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5;
break; break;
case 2: case EDP_PREEMPHASIS_6dB:
dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_6; dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_6;
break; break;
case 3: case EDP_PREEMPHASIS_9_5dB:
dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5; dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5;
break; break;
default:
DRM_DEBUG_KMS("VBT has unknown eDP pre-emphasis value %u\n",
edp_link_params->preemphasis);
break;
} }
switch (edp_link_params->vswing) { switch (edp_link_params->vswing) {
case 0: case EDP_VSWING_0_4V:
dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_400; dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_400;
break; break;
case 1: case EDP_VSWING_0_6V:
dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_600; dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_600;
break; break;
case 2: case EDP_VSWING_0_8V:
dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_800; dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_800;
break; break;
case 3: case EDP_VSWING_1_2V:
dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_1200; dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_1200;
break; break;
default:
DRM_DEBUG_KMS("VBT has unknown eDP voltage swing value %u\n",
edp_link_params->vswing);
break;
} }
} }

View file

@ -121,6 +121,22 @@ intel_dp_max_link_bw(struct intel_dp *intel_dp)
return max_link_bw; return max_link_bw;
} }
static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
{
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_device *dev = intel_dig_port->base.base.dev;
u8 source_max, sink_max;
source_max = 4;
if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
(intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
source_max = 2;
sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
return min(source_max, sink_max);
}
/* /*
* The units on the numbers in the next two are... bizarre. Examples will * The units on the numbers in the next two are... bizarre. Examples will
* make it clearer; this one parallels an example in the eDP spec. * make it clearer; this one parallels an example in the eDP spec.
@ -171,7 +187,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
} }
max_link_clock = drm_dp_bw_code_to_link_rate(intel_dp_max_link_bw(intel_dp)); max_link_clock = drm_dp_bw_code_to_link_rate(intel_dp_max_link_bw(intel_dp));
max_lanes = drm_dp_max_lane_count(intel_dp->dpcd); max_lanes = intel_dp_max_lane_count(intel_dp);
max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
mode_rate = intel_dp_link_required(target_clock, 18); mode_rate = intel_dp_link_required(target_clock, 18);
@ -751,8 +767,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
struct intel_crtc *intel_crtc = encoder->new_crtc; struct intel_crtc *intel_crtc = encoder->new_crtc;
struct intel_connector *intel_connector = intel_dp->attached_connector; struct intel_connector *intel_connector = intel_dp->attached_connector;
int lane_count, clock; int lane_count, clock;
int max_lane_count = drm_dp_max_lane_count(intel_dp->dpcd); int min_lane_count = 1;
int max_lane_count = intel_dp_max_lane_count(intel_dp);
/* Conveniently, the link BW constants become indices with a shift...*/ /* Conveniently, the link BW constants become indices with a shift...*/
int min_clock = 0;
int max_clock = intel_dp_max_link_bw(intel_dp) >> 3; int max_clock = intel_dp_max_link_bw(intel_dp) >> 3;
int bpp, mode_rate; int bpp, mode_rate;
static int bws[] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7, DP_LINK_BW_5_4 }; static int bws[] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7, DP_LINK_BW_5_4 };
@ -785,19 +803,38 @@ intel_dp_compute_config(struct intel_encoder *encoder,
/* Walk through all bpp values. Luckily they're all nicely spaced with 2 /* Walk through all bpp values. Luckily they're all nicely spaced with 2
* bpc in between. */ * bpc in between. */
bpp = pipe_config->pipe_bpp; bpp = pipe_config->pipe_bpp;
if (is_edp(intel_dp) && dev_priv->vbt.edp_bpp && if (is_edp(intel_dp)) {
dev_priv->vbt.edp_bpp < bpp) { if (dev_priv->vbt.edp_bpp && dev_priv->vbt.edp_bpp < bpp) {
DRM_DEBUG_KMS("clamping bpp for eDP panel to BIOS-provided %i\n", DRM_DEBUG_KMS("clamping bpp for eDP panel to BIOS-provided %i\n",
dev_priv->vbt.edp_bpp); dev_priv->vbt.edp_bpp);
bpp = dev_priv->vbt.edp_bpp; bpp = dev_priv->vbt.edp_bpp;
}
if (IS_BROADWELL(dev)) {
/* Yes, it's an ugly hack. */
min_lane_count = max_lane_count;
DRM_DEBUG_KMS("forcing lane count to max (%u) on BDW\n",
min_lane_count);
} else if (dev_priv->vbt.edp_lanes) {
min_lane_count = min(dev_priv->vbt.edp_lanes,
max_lane_count);
DRM_DEBUG_KMS("using min %u lanes per VBT\n",
min_lane_count);
}
if (dev_priv->vbt.edp_rate) {
min_clock = min(dev_priv->vbt.edp_rate >> 3, max_clock);
DRM_DEBUG_KMS("using min %02x link bw per VBT\n",
bws[min_clock]);
}
} }
for (; bpp >= 6*3; bpp -= 2*3) { for (; bpp >= 6*3; bpp -= 2*3) {
mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
bpp); bpp);
for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) {
for (clock = 0; clock <= max_clock; clock++) { for (clock = min_clock; clock <= max_clock; clock++) {
link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); link_clock = drm_dp_bw_code_to_link_rate(bws[clock]);
link_avail = intel_dp_max_data_rate(link_clock, link_avail = intel_dp_max_data_rate(link_clock,
lane_count); lane_count);

View file

@ -387,6 +387,15 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
height); height);
} }
/* No preferred mode marked by the EDID? Are there any modes? */
if (!modes[i] && !list_empty(&connector->modes)) {
DRM_DEBUG_KMS("using first mode listed on connector %s\n",
drm_get_connector_name(connector));
modes[i] = list_first_entry(&connector->modes,
struct drm_display_mode,
head);
}
/* last resort: use current mode */ /* last resort: use current mode */
if (!modes[i]) { if (!modes[i]) {
/* /*

View file

@ -492,6 +492,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
enum pipe pipe = intel_get_pipe_from_connector(connector); enum pipe pipe = intel_get_pipe_from_connector(connector);
u32 freq; u32 freq;
unsigned long flags; unsigned long flags;
u64 n;
if (!panel->backlight.present || pipe == INVALID_PIPE) if (!panel->backlight.present || pipe == INVALID_PIPE)
return; return;
@ -502,10 +503,9 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
/* scale to hardware max, but be careful to not overflow */ /* scale to hardware max, but be careful to not overflow */
freq = panel->backlight.max; freq = panel->backlight.max;
if (freq < max) n = (u64)level * freq;
level = level * freq / max; do_div(n, max);
else level = n;
level = freq / max * level;
panel->backlight.level = level; panel->backlight.level = level;
if (panel->backlight.device) if (panel->backlight.device)

View file

@ -2095,6 +2095,43 @@ static void intel_print_wm_latency(struct drm_device *dev,
} }
} }
static bool ilk_increase_wm_latency(struct drm_i915_private *dev_priv,
uint16_t wm[5], uint16_t min)
{
int level, max_level = ilk_wm_max_level(dev_priv->dev);
if (wm[0] >= min)
return false;
wm[0] = max(wm[0], min);
for (level = 1; level <= max_level; level++)
wm[level] = max_t(uint16_t, wm[level], DIV_ROUND_UP(min, 5));
return true;
}
static void snb_wm_latency_quirk(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
bool changed;
/*
* The BIOS provided WM memory latency values are often
* inadequate for high resolution displays. Adjust them.
*/
changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) |
ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) |
ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12);
if (!changed)
return;
DRM_DEBUG_KMS("WM latency values increased to avoid potential underruns\n");
intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency);
intel_print_wm_latency(dev, "Sprite", dev_priv->wm.spr_latency);
intel_print_wm_latency(dev, "Cursor", dev_priv->wm.cur_latency);
}
static void ilk_setup_wm_latency(struct drm_device *dev) static void ilk_setup_wm_latency(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
@ -2112,6 +2149,9 @@ static void ilk_setup_wm_latency(struct drm_device *dev)
intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency); intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency);
intel_print_wm_latency(dev, "Sprite", dev_priv->wm.spr_latency); intel_print_wm_latency(dev, "Sprite", dev_priv->wm.spr_latency);
intel_print_wm_latency(dev, "Cursor", dev_priv->wm.cur_latency); intel_print_wm_latency(dev, "Cursor", dev_priv->wm.cur_latency);
if (IS_GEN6(dev))
snb_wm_latency_quirk(dev);
} }
static void ilk_compute_wm_parameters(struct drm_crtc *crtc, static void ilk_compute_wm_parameters(struct drm_crtc *crtc,

View file

@ -2424,8 +2424,8 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
if (ret < 0) if (ret < 0)
goto err1; goto err1;
ret = sysfs_create_link(&encoder->ddc.dev.kobj, ret = sysfs_create_link(&drm_connector->kdev->kobj,
&drm_connector->kdev->kobj, &encoder->ddc.dev.kobj,
encoder->ddc.dev.kobj.name); encoder->ddc.dev.kobj.name);
if (ret < 0) if (ret < 0)
goto err2; goto err2;

View file

@ -185,6 +185,8 @@ static void vlv_force_wake_reset(struct drm_i915_private *dev_priv)
{ {
__raw_i915_write32(dev_priv, FORCEWAKE_VLV, __raw_i915_write32(dev_priv, FORCEWAKE_VLV,
_MASKED_BIT_DISABLE(0xffff)); _MASKED_BIT_DISABLE(0xffff));
__raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV,
_MASKED_BIT_DISABLE(0xffff));
/* something from same cacheline, but !FORCEWAKE_VLV */ /* something from same cacheline, but !FORCEWAKE_VLV */
__raw_posting_read(dev_priv, FORCEWAKE_ACK_VLV); __raw_posting_read(dev_priv, FORCEWAKE_ACK_VLV);
} }

Some files were not shown because too many files have changed in this diff Show more