Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' into export-slabh

Tejun Heo 336f5899 a4ab2773

+4567 -2624
+54
Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt
··· 21 21 - fsl,qe-num-snums: define how many serial number(SNUM) the QE can use for the 22 22 threads. 23 23 24 + Optional properties: 25 + - fsl,firmware-phandle: 26 + Usage: required only if there is no fsl,qe-firmware child node 27 + Value type: <phandle> 28 + Definition: Points to a firmware node (see "QE Firmware Node" below) 29 + that contains the firmware that should be uploaded for this QE. 30 + The compatible property for the firmware node should say, 31 + "fsl,qe-firmware". 32 + 24 33 Recommended properties 25 34 - brg-frequency : the internal clock source frequency for baud-rate 26 35 generators in Hz. ··· 68 59 reg = <0 c000>; 69 60 }; 70 61 }; 62 + 63 + * QE Firmware Node 64 + 65 + This node defines a firmware binary that is embedded in the device tree, for 66 + the purpose of passing the firmware from bootloader to the kernel, or from 67 + the hypervisor to the guest. 68 + 69 + The firmware node itself contains the firmware binary contents, a compatible 70 + property, and any firmware-specific properties. The node should be placed 71 + inside a QE node that needs it. Doing so eliminates the need for a 72 + fsl,firmware-phandle property. Other QE nodes that need the same firmware 73 + should define an fsl,firmware-phandle property that points to the firmware node 74 + in the first QE node. 75 + 76 + The fsl,firmware property can be specified in the DTS (possibly using incbin) 77 + or can be inserted by the boot loader at boot time. 78 + 79 + Required properties: 80 + - compatible 81 + Usage: required 82 + Value type: <string> 83 + Definition: A standard property. Specify a string that indicates what 84 + kind of firmware it is. For QE, this should be "fsl,qe-firmware". 85 + 86 + - fsl,firmware 87 + Usage: required 88 + Value type: <prop-encoded-array>, encoded as an array of bytes 89 + Definition: A standard property. This property contains the firmware 90 + binary "blob". 91 + 92 + Example: 93 + qe1@e0080000 { 94 + compatible = "fsl,qe"; 95 + qe_firmware:qe-firmware { 96 + compatible = "fsl,qe-firmware"; 97 + fsl,firmware = [0x70 0xcd 0x00 0x00 0x01 0x46 0x45 ...]; 98 + }; 99 + ... 100 + }; 101 + 102 + qe2@e0090000 { 103 + compatible = "fsl,qe"; 104 + fsl,firmware-phandle = <&qe_firmware>; 105 + ... 106 + };
+10
MAINTAINERS
··· 3270 3270 F: include/linux/kexec.h 3271 3271 F: kernel/kexec.c 3272 3272 3273 + KEYS/KEYRINGS: 3274 + M: David Howells <dhowells@redhat.com> 3275 + L: keyrings@linux-nfs.org 3276 + S: Maintained 3277 + F: Documentation/keys.txt 3278 + F: include/linux/key.h 3279 + F: include/linux/key-type.h 3280 + F: include/keys/ 3281 + F: security/keys/ 3282 + 3273 3283 KGDB 3274 3284 M: Jason Wessel <jason.wessel@windriver.com> 3275 3285 L: kgdb-bugreport@lists.sourceforge.net
+1 -1
Makefile
··· 1 1 VERSION = 2 2 2 PATCHLEVEL = 6 3 3 SUBLEVEL = 34 4 - EXTRAVERSION = -rc2 4 + EXTRAVERSION = -rc3 5 5 NAME = Man-Eating Seals of Antiquity 6 6 7 7 # *DOCUMENTATION*
+1 -37
arch/arm/include/asm/cacheflush.h
··· 15 15 #include <asm/glue.h> 16 16 #include <asm/shmparam.h> 17 17 #include <asm/cachetype.h> 18 + #include <asm/outercache.h> 18 19 19 20 #define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) 20 21 ··· 220 219 void (*dma_flush_range)(const void *, const void *); 221 220 }; 222 221 223 - struct outer_cache_fns { 224 - void (*inv_range)(unsigned long, unsigned long); 225 - void (*clean_range)(unsigned long, unsigned long); 226 - void (*flush_range)(unsigned long, unsigned long); 227 - }; 228 - 229 222 /* 230 223 * Select the calling method 231 224 */ ··· 273 278 extern void dmac_map_area(const void *, size_t, int); 274 279 extern void dmac_unmap_area(const void *, size_t, int); 275 280 extern void dmac_flush_range(const void *, const void *); 276 - 277 - #endif 278 - 279 - #ifdef CONFIG_OUTER_CACHE 280 - 281 - extern struct outer_cache_fns outer_cache; 282 - 283 - static inline void outer_inv_range(unsigned long start, unsigned long end) 284 - { 285 - if (outer_cache.inv_range) 286 - outer_cache.inv_range(start, end); 287 - } 288 - static inline void outer_clean_range(unsigned long start, unsigned long end) 289 - { 290 - if (outer_cache.clean_range) 291 - outer_cache.clean_range(start, end); 292 - } 293 - static inline void outer_flush_range(unsigned long start, unsigned long end) 294 - { 295 - if (outer_cache.flush_range) 296 - outer_cache.flush_range(start, end); 297 - } 298 - 299 - #else 300 - 301 - static inline void outer_inv_range(unsigned long start, unsigned long end) 302 - { } 303 - static inline void outer_clean_range(unsigned long start, unsigned long end) 304 - { } 305 - static inline void outer_flush_range(unsigned long start, unsigned long end) 306 - { } 307 281 308 282 #endif 309 283
+1
arch/arm/include/asm/clkdev.h
··· 13 13 #define __ASM_CLKDEV_H 14 14 15 15 struct clk; 16 + struct device; 16 17 17 18 struct clk_lookup { 18 19 struct list_head node;
+1
arch/arm/include/asm/irq.h
··· 17 17 18 18 #ifndef __ASSEMBLY__ 19 19 struct irqaction; 20 + struct pt_regs; 20 21 extern void migrate_irqs(void); 21 22 22 23 extern void asm_do_IRQ(unsigned int, struct pt_regs *);
+75
arch/arm/include/asm/outercache.h
··· 1 + /* 2 + * arch/arm/include/asm/outercache.h 3 + * 4 + * Copyright (C) 2010 ARM Ltd. 5 + * Written by Catalin Marinas <catalin.marinas@arm.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 + */ 20 + 21 + #ifndef __ASM_OUTERCACHE_H 22 + #define __ASM_OUTERCACHE_H 23 + 24 + struct outer_cache_fns { 25 + void (*inv_range)(unsigned long, unsigned long); 26 + void (*clean_range)(unsigned long, unsigned long); 27 + void (*flush_range)(unsigned long, unsigned long); 28 + #ifdef CONFIG_OUTER_CACHE_SYNC 29 + void (*sync)(void); 30 + #endif 31 + }; 32 + 33 + #ifdef CONFIG_OUTER_CACHE 34 + 35 + extern struct outer_cache_fns outer_cache; 36 + 37 + static inline void outer_inv_range(unsigned long start, unsigned long end) 38 + { 39 + if (outer_cache.inv_range) 40 + outer_cache.inv_range(start, end); 41 + } 42 + static inline void outer_clean_range(unsigned long start, unsigned long end) 43 + { 44 + if (outer_cache.clean_range) 45 + outer_cache.clean_range(start, end); 46 + } 47 + static inline void outer_flush_range(unsigned long start, unsigned long end) 48 + { 49 + if (outer_cache.flush_range) 50 + outer_cache.flush_range(start, end); 51 + } 52 + 53 + #else 54 + 55 + static inline void outer_inv_range(unsigned long start, unsigned long end) 56 + { } 57 + static inline void outer_clean_range(unsigned long start, unsigned long end) 58 + { } 59 + static inline void outer_flush_range(unsigned long start, unsigned long end) 60 + { } 61 + 62 + #endif 63 + 64 + #ifdef CONFIG_OUTER_CACHE_SYNC 65 + static inline void outer_sync(void) 66 + { 67 + if (outer_cache.sync) 68 + outer_cache.sync(); 69 + } 70 + #else 71 + static inline void outer_sync(void) 72 + { } 73 + #endif 74 + 75 + #endif /* __ASM_OUTERCACHE_H */
+10 -6
arch/arm/include/asm/system.h
··· 60 60 #include <linux/linkage.h> 61 61 #include <linux/irqflags.h> 62 62 63 + #include <asm/outercache.h> 64 + 63 65 #define __exception __attribute__((section(".exception.text"))) 64 66 65 67 struct thread_info; ··· 139 137 #define dmb() __asm__ __volatile__ ("" : : : "memory") 140 138 #endif 141 139 142 - #if __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP) 143 - #define mb() dmb() 140 + #ifdef CONFIG_ARCH_HAS_BARRIERS 141 + #include <mach/barriers.h> 142 + #elif __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP) 143 + #define mb() do { dsb(); outer_sync(); } while (0) 144 144 #define rmb() dmb() 145 - #define wmb() dmb() 145 + #define wmb() mb() 146 146 #else 147 147 #define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 148 148 #define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) ··· 156 152 #define smp_rmb() barrier() 157 153 #define smp_wmb() barrier() 158 154 #else 159 - #define smp_mb() mb() 160 - #define smp_rmb() rmb() 161 - #define smp_wmb() wmb() 155 + #define smp_mb() dmb() 156 + #define smp_rmb() dmb() 157 + #define smp_wmb() dmb() 162 158 #endif 163 159 164 160 #define read_barrier_depends() do { } while(0)
+9 -1
arch/arm/kernel/kprobes.c
··· 394 394 /* 395 395 * Setup an empty pt_regs. Fill SP and PC fields as 396 396 * they're needed by longjmp_break_handler. 397 + * 398 + * We allocate some slack between the original SP and start of 399 + * our fabricated regs. To be precise we want to have worst case 400 + * covered which is STMFD with all 16 regs so we allocate 2 * 401 + * sizeof(struct_pt_regs)). 402 + * 403 + * This is to prevent any simulated instruction from writing 404 + * over the regs when they are accessing the stack. 397 405 */ 398 406 "sub sp, %0, %1 \n\t" 399 407 "ldr r0, ="__stringify(JPROBE_MAGIC_ADDR)"\n\t" ··· 419 411 "ldmia sp, {r0 - pc} \n\t" 420 412 : 421 413 : "r" (kcb->jprobe_saved_regs.ARM_sp), 422 - "I" (sizeof(struct pt_regs)), 414 + "I" (sizeof(struct pt_regs) * 2), 423 415 "J" (offsetof(struct pt_regs, ARM_sp)), 424 416 "J" (offsetof(struct pt_regs, ARM_pc)), 425 417 "J" (offsetof(struct pt_regs, ARM_cpsr))
+2 -2
arch/arm/lib/memmove.S
··· 74 74 rsb ip, ip, #32 75 75 addne pc, pc, ip @ C is always clear here 76 76 b 7f 77 - 6: nop 77 + 6: W(nop) 78 78 W(ldr) r3, [r1, #-4]! 79 79 W(ldr) r4, [r1, #-4]! 80 80 W(ldr) r5, [r1, #-4]! ··· 85 85 86 86 add pc, pc, ip 87 87 nop 88 - nop 88 + W(nop) 89 89 W(str) r3, [r0, #-4]! 90 90 W(str) r4, [r0, #-4]! 91 91 W(str) r5, [r0, #-4]!
+13
arch/arm/mm/Kconfig
··· 736 736 config OUTER_CACHE 737 737 bool 738 738 739 + config OUTER_CACHE_SYNC 740 + bool 741 + help 742 + The outer cache has a outer_cache_fns.sync function pointer 743 + that can be used to drain the write buffer of the outer cache. 744 + 739 745 config CACHE_FEROCEON_L2 740 746 bool "Enable the Feroceon L2 cache controller" 741 747 depends on ARCH_KIRKWOOD || ARCH_MV78XX0 ··· 763 757 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK || ARCH_OMAP4 764 758 default y 765 759 select OUTER_CACHE 760 + select OUTER_CACHE_SYNC 766 761 help 767 762 This option enables the L2x0 PrimeCell. 768 763 ··· 788 781 int 789 782 default 6 if ARM_L1_CACHE_SHIFT_6 790 783 default 5 784 + 785 + config ARCH_HAS_BARRIERS 786 + bool 787 + help 788 + This option allows the use of custom mandatory barriers 789 + included via the mach/barriers.h file.
+10
arch/arm/mm/cache-l2x0.c
··· 93 93 } 94 94 #endif 95 95 96 + static void l2x0_cache_sync(void) 97 + { 98 + unsigned long flags; 99 + 100 + spin_lock_irqsave(&l2x0_lock, flags); 101 + cache_sync(); 102 + spin_unlock_irqrestore(&l2x0_lock, flags); 103 + } 104 + 96 105 static inline void l2x0_inv_all(void) 97 106 { 98 107 unsigned long flags; ··· 234 225 outer_cache.inv_range = l2x0_inv_range; 235 226 outer_cache.clean_range = l2x0_clean_range; 236 227 outer_cache.flush_range = l2x0_flush_range; 228 + outer_cache.sync = l2x0_cache_sync; 237 229 238 230 printk(KERN_INFO "L2X0 cache controller enabled\n"); 239 231 }
+1 -1
arch/arm/vfp/vfpmodule.c
··· 545 545 */ 546 546 elf_hwcap |= HWCAP_VFP; 547 547 #ifdef CONFIG_VFPv3 548 - if (VFP_arch >= 3) { 548 + if (VFP_arch >= 2) { 549 549 elf_hwcap |= HWCAP_VFPv3; 550 550 551 551 /*
-3
arch/microblaze/Kconfig
··· 75 75 config HAVE_LATENCYTOP_SUPPORT 76 76 def_bool y 77 77 78 - config PCI 79 - def_bool n 80 - 81 78 config DTC 82 79 def_bool y 83 80
+3 -1
arch/microblaze/Makefile
··· 84 84 echo '* linux.bin - Create raw binary' 85 85 echo ' linux.bin.gz - Create compressed raw binary' 86 86 echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' 87 - echo ' - stripped elf with fdt blob 87 + echo ' - stripped elf with fdt blob' 88 88 echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob' 89 89 echo ' *_defconfig - Select default config from arch/microblaze/configs' 90 90 echo '' ··· 94 94 echo ' name of a dts file from the arch/microblaze/boot/dts/ directory' 95 95 echo ' (minus the .dts extension).' 96 96 endef 97 + 98 + MRPROPER_FILES += $(boot)/simpleImage.*
+1 -5
arch/microblaze/boot/Makefile
··· 23 23 endif 24 24 25 25 $(obj)/linux.bin: vmlinux FORCE 26 - [ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \ 27 - touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image" 28 26 $(call if_changed,objcopy) 29 27 $(call if_changed,uimage) 30 28 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' ··· 60 62 $(obj)/%.dtb: $(dtstree)/%.dts FORCE 61 63 $(call if_changed,dtc) 62 64 63 - clean-kernel += linux.bin linux.bin.gz simpleImage.* 64 - 65 - clean-files += *.dtb simpleImage.*.unstrip 65 + clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
-1
arch/microblaze/include/asm/processor.h
··· 14 14 #include <asm/ptrace.h> 15 15 #include <asm/setup.h> 16 16 #include <asm/registers.h> 17 - #include <asm/segment.h> 18 17 #include <asm/entry.h> 19 18 #include <asm/current.h> 20 19
-49
arch/microblaze/include/asm/segment.h
··· 1 - /* 2 - * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> 3 - * Copyright (C) 2008-2009 PetaLogix 4 - * Copyright (C) 2006 Atmark Techno, Inc. 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file "COPYING" in the main directory of this archive 8 - * for more details. 9 - */ 10 - 11 - #ifndef _ASM_MICROBLAZE_SEGMENT_H 12 - #define _ASM_MICROBLAZE_SEGMENT_H 13 - 14 - # ifndef __ASSEMBLY__ 15 - 16 - typedef struct { 17 - unsigned long seg; 18 - } mm_segment_t; 19 - 20 - /* 21 - * On Microblaze the fs value is actually the top of the corresponding 22 - * address space. 23 - * 24 - * The fs value determines whether argument validity checking should be 25 - * performed or not. If get_fs() == USER_DS, checking is performed, with 26 - * get_fs() == KERNEL_DS, checking is bypassed. 27 - * 28 - * For historical reasons, these macros are grossly misnamed. 29 - * 30 - * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal. 31 - */ 32 - # define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 33 - 34 - # ifndef CONFIG_MMU 35 - # define KERNEL_DS MAKE_MM_SEG(0) 36 - # define USER_DS KERNEL_DS 37 - # else 38 - # define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) 39 - # define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) 40 - # endif 41 - 42 - # define get_ds() (KERNEL_DS) 43 - # define get_fs() (current_thread_info()->addr_limit) 44 - # define set_fs(val) (current_thread_info()->addr_limit = (val)) 45 - 46 - # define segment_eq(a, b) ((a).seg == (b).seg) 47 - 48 - # endif /* __ASSEMBLY__ */ 49 - #endif /* _ASM_MICROBLAZE_SEGMENT_H */
+4 -1
arch/microblaze/include/asm/thread_info.h
··· 19 19 #ifndef __ASSEMBLY__ 20 20 # include <linux/types.h> 21 21 # include <asm/processor.h> 22 - # include <asm/segment.h> 23 22 24 23 /* 25 24 * low level task data that entry.S needs immediate access to ··· 58 59 __u32 esr; 59 60 __u32 fsr; 60 61 }; 62 + 63 + typedef struct { 64 + unsigned long seg; 65 + } mm_segment_t; 61 66 62 67 struct thread_info { 63 68 struct task_struct *task; /* main task structure */
+2 -1
arch/microblaze/include/asm/tlbflush.h
··· 24 24 extern void _tlbia(void); 25 25 26 26 #define __tlbia() { preempt_disable(); _tlbia(); preempt_enable(); } 27 + #define __tlbie(x) { _tlbie(x); } 27 28 28 29 static inline void local_flush_tlb_all(void) 29 30 { __tlbia(); } ··· 32 31 { __tlbia(); } 33 32 static inline void local_flush_tlb_page(struct vm_area_struct *vma, 34 33 unsigned long vmaddr) 35 - { _tlbie(vmaddr); } 34 + { __tlbie(vmaddr); } 36 35 static inline void local_flush_tlb_range(struct vm_area_struct *vma, 37 36 unsigned long start, unsigned long end) 38 37 { __tlbia(); }
+255 -214
arch/microblaze/include/asm/uaccess.h
··· 22 22 #include <asm/mmu.h> 23 23 #include <asm/page.h> 24 24 #include <asm/pgtable.h> 25 - #include <asm/segment.h> 26 25 #include <linux/string.h> 27 26 28 27 #define VERIFY_READ 0 29 28 #define VERIFY_WRITE 1 30 29 31 - #define __clear_user(addr, n) (memset((void *)(addr), 0, (n)), 0) 30 + /* 31 + * On Microblaze the fs value is actually the top of the corresponding 32 + * address space. 33 + * 34 + * The fs value determines whether argument validity checking should be 35 + * performed or not. If get_fs() == USER_DS, checking is performed, with 36 + * get_fs() == KERNEL_DS, checking is bypassed. 37 + * 38 + * For historical reasons, these macros are grossly misnamed. 39 + * 40 + * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal. 41 + */ 42 + # define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 43 + 44 + # ifndef CONFIG_MMU 45 + # define KERNEL_DS MAKE_MM_SEG(0) 46 + # define USER_DS KERNEL_DS 47 + # else 48 + # define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) 49 + # define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) 50 + # endif 51 + 52 + # define get_ds() (KERNEL_DS) 53 + # define get_fs() (current_thread_info()->addr_limit) 54 + # define set_fs(val) (current_thread_info()->addr_limit = (val)) 55 + 56 + # define segment_eq(a, b) ((a).seg == (b).seg) 57 + 58 + /* 59 + * The exception table consists of pairs of addresses: the first is the 60 + * address of an instruction that is allowed to fault, and the second is 61 + * the address at which the program should continue. No registers are 62 + * modified, so it is entirely up to the continuation code to figure out 63 + * what to do. 64 + * 65 + * All the routines below use bits of fixup code that are out of line 66 + * with the main instruction path. This means when everything is well, 67 + * we don't even have to jump over them. Further, they do not intrude 68 + * on our cache or tlb entries. 69 + */ 70 + struct exception_table_entry { 71 + unsigned long insn, fixup; 72 + }; 73 + 74 + /* Returns 0 if exception not found and fixup otherwise. */ 75 + extern unsigned long search_exception_table(unsigned long); 32 76 33 77 #ifndef CONFIG_MMU 34 78 35 - extern int ___range_ok(unsigned long addr, unsigned long size); 79 + /* Check against bounds of physical memory */ 80 + static inline int ___range_ok(unsigned long addr, unsigned long size) 81 + { 82 + return ((addr < memory_start) || 83 + ((addr + size) > memory_end)); 84 + } 36 85 37 86 #define __range_ok(addr, size) \ 38 87 ___range_ok((unsigned long)(addr), (unsigned long)(size)) 39 88 40 89 #define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) 41 - #define __access_ok(add, size) (__range_ok((addr), (size)) == 0) 42 90 43 - /* Undefined function to trigger linker error */ 44 - extern int bad_user_access_length(void); 45 - 46 - /* FIXME this is function for optimalization -> memcpy */ 47 - #define __get_user(var, ptr) \ 48 - ({ \ 49 - int __gu_err = 0; \ 50 - switch (sizeof(*(ptr))) { \ 51 - case 1: \ 52 - case 2: \ 53 - case 4: \ 54 - (var) = *(ptr); \ 55 - break; \ 56 - case 8: \ 57 - memcpy((void *) &(var), (ptr), 8); \ 58 - break; \ 59 - default: \ 60 - (var) = 0; \ 61 - __gu_err = __get_user_bad(); \ 62 - break; \ 63 - } \ 64 - __gu_err; \ 65 - }) 66 - 67 - #define __get_user_bad() (bad_user_access_length(), (-EFAULT)) 68 - 69 - /* FIXME is not there defined __pu_val */ 70 - #define __put_user(var, ptr) \ 71 - ({ \ 72 - int __pu_err = 0; \ 73 - switch (sizeof(*(ptr))) { \ 74 - case 1: \ 75 - case 2: \ 76 - case 4: \ 77 - *(ptr) = (var); \ 78 - break; \ 79 - case 8: { \ 80 - typeof(*(ptr)) __pu_val = (var); \ 81 - memcpy(ptr, &__pu_val, sizeof(__pu_val)); \ 82 - } \ 83 - break; \ 84 - default: \ 85 - __pu_err = __put_user_bad(); \ 86 - break; \ 87 - } \ 88 - __pu_err; \ 89 - }) 90 - 91 - #define __put_user_bad() (bad_user_access_length(), (-EFAULT)) 92 - 93 - #define put_user(x, ptr) __put_user((x), (ptr)) 94 - #define get_user(x, ptr) __get_user((x), (ptr)) 95 - 96 - #define copy_to_user(to, from, n) (memcpy((to), (from), (n)), 0) 97 - #define copy_from_user(to, from, n) (memcpy((to), (from), (n)), 0) 98 - 99 - #define __copy_to_user(to, from, n) (copy_to_user((to), (from), (n))) 100 - #define __copy_from_user(to, from, n) (copy_from_user((to), (from), (n))) 101 - #define __copy_to_user_inatomic(to, from, n) \ 102 - (__copy_to_user((to), (from), (n))) 103 - #define __copy_from_user_inatomic(to, from, n) \ 104 - (__copy_from_user((to), (from), (n))) 105 - 106 - static inline unsigned long clear_user(void *addr, unsigned long size) 107 - { 108 - if (access_ok(VERIFY_WRITE, addr, size)) 109 - size = __clear_user(addr, size); 110 - return size; 111 - } 112 - 113 - /* Returns 0 if exception not found and fixup otherwise. */ 114 - extern unsigned long search_exception_table(unsigned long); 115 - 116 - extern long strncpy_from_user(char *dst, const char *src, long count); 117 - extern long strnlen_user(const char *src, long count); 118 - 119 - #else /* CONFIG_MMU */ 91 + #else 120 92 121 93 /* 122 94 * Address is valid if: ··· 101 129 /* || printk("access_ok failed for %s at 0x%08lx (size %d), seg 0x%08x\n", 102 130 type?"WRITE":"READ",addr,size,get_fs().seg)) */ 103 131 104 - /* 105 - * All the __XXX versions macros/functions below do not perform 106 - * access checking. It is assumed that the necessary checks have been 107 - * already performed before the finction (macro) is called. 132 + #endif 133 + 134 + #ifdef CONFIG_MMU 135 + # define __FIXUP_SECTION ".section .fixup,\"ax\"\n" 136 + # define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n" 137 + #else 138 + # define __FIXUP_SECTION ".section .discard,\"ax\"\n" 139 + # define __EX_TABLE_SECTION ".section .discard,\"a\"\n" 140 + #endif 141 + 142 + extern unsigned long __copy_tofrom_user(void __user *to, 143 + const void __user *from, unsigned long size); 144 + 145 + /* Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. */ 146 + static inline unsigned long __must_check __clear_user(void __user *to, 147 + unsigned long n) 148 + { 149 + /* normal memset with two words to __ex_table */ 150 + __asm__ __volatile__ ( \ 151 + "1: sb r0, %2, r0;" \ 152 + " addik %0, %0, -1;" \ 153 + " bneid %0, 1b;" \ 154 + " addik %2, %2, 1;" \ 155 + "2: " \ 156 + __EX_TABLE_SECTION \ 157 + ".word 1b,2b;" \ 158 + ".previous;" \ 159 + : "=r"(n) \ 160 + : "0"(n), "r"(to) 161 + ); 162 + return n; 163 + } 164 + 165 + static inline unsigned long __must_check clear_user(void __user *to, 166 + unsigned long n) 167 + { 168 + might_sleep(); 169 + if (unlikely(!access_ok(VERIFY_WRITE, to, n))) 170 + return n; 171 + 172 + return __clear_user(to, n); 173 + } 174 + 175 + /* put_user and get_user macros */ 176 + extern long __user_bad(void); 177 + 178 + #define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 179 + ({ \ 180 + __asm__ __volatile__ ( \ 181 + "1:" insn " %1, %2, r0;" \ 182 + " addk %0, r0, r0;" \ 183 + "2: " \ 184 + __FIXUP_SECTION \ 185 + "3: brid 2b;" \ 186 + " addik %0, r0, %3;" \ 187 + ".previous;" \ 188 + __EX_TABLE_SECTION \ 189 + ".word 1b,3b;" \ 190 + ".previous;" \ 191 + : "=&r"(__gu_err), "=r"(__gu_val) \ 192 + : "r"(__gu_ptr), "i"(-EFAULT) \ 193 + ); \ 194 + }) 195 + 196 + /** 197 + * get_user: - Get a simple variable from user space. 198 + * @x: Variable to store result. 199 + * @ptr: Source address, in user space. 200 + * 201 + * Context: User context only. This function may sleep. 202 + * 203 + * This macro copies a single simple variable from user space to kernel 204 + * space. It supports simple types like char and int, but not larger 205 + * data types like structures or arrays. 206 + * 207 + * @ptr must have pointer-to-simple-variable type, and the result of 208 + * dereferencing @ptr must be assignable to @x without a cast. 209 + * 210 + * Returns zero on success, or -EFAULT on error. 211 + * On error, the variable @x is set to zero. 108 212 */ 109 - 110 - #define get_user(x, ptr) \ 111 - ({ \ 112 - access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ 113 - ? __get_user((x), (ptr)) : -EFAULT; \ 114 - }) 115 - 116 - #define put_user(x, ptr) \ 117 - ({ \ 118 - access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ 119 - ? __put_user((x), (ptr)) : -EFAULT; \ 120 - }) 121 213 122 214 #define __get_user(x, ptr) \ 123 215 ({ \ ··· 199 163 __get_user_asm("lw", (ptr), __gu_val, __gu_err); \ 200 164 break; \ 201 165 default: \ 202 - __gu_val = 0; __gu_err = -EINVAL; \ 166 + /* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\ 203 167 } \ 204 168 x = (__typeof__(*(ptr))) __gu_val; \ 205 169 __gu_err; \ 206 170 }) 207 171 208 - #define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 172 + 173 + #define get_user(x, ptr) \ 209 174 ({ \ 210 - __asm__ __volatile__ ( \ 211 - "1:" insn " %1, %2, r0; \ 212 - addk %0, r0, r0; \ 213 - 2: \ 214 - .section .fixup,\"ax\"; \ 215 - 3: brid 2b; \ 216 - addik %0, r0, %3; \ 217 - .previous; \ 218 - .section __ex_table,\"a\"; \ 219 - .word 1b,3b; \ 220 - .previous;" \ 221 - : "=r"(__gu_err), "=r"(__gu_val) \ 222 - : "r"(__gu_ptr), "i"(-EFAULT) \ 223 - ); \ 175 + access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ 176 + ? __get_user((x), (ptr)) : -EFAULT; \ 224 177 }) 178 + 179 + #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 180 + ({ \ 181 + __asm__ __volatile__ ( \ 182 + "1:" insn " %1, %2, r0;" \ 183 + " addk %0, r0, r0;" \ 184 + "2: " \ 185 + __FIXUP_SECTION \ 186 + "3: brid 2b;" \ 187 + " addik %0, r0, %3;" \ 188 + ".previous;" \ 189 + __EX_TABLE_SECTION \ 190 + ".word 1b,3b;" \ 191 + ".previous;" \ 192 + : "=&r"(__gu_err) \ 193 + : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \ 194 + ); \ 195 + }) 196 + 197 + #define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \ 198 + ({ \ 199 + __asm__ __volatile__ (" lwi %0, %1, 0;" \ 200 + "1: swi %0, %2, 0;" \ 201 + " lwi %0, %1, 4;" \ 202 + "2: swi %0, %2, 4;" \ 203 + " addk %0, r0, r0;" \ 204 + "3: " \ 205 + __FIXUP_SECTION \ 206 + "4: brid 3b;" \ 207 + " addik %0, r0, %3;" \ 208 + ".previous;" \ 209 + __EX_TABLE_SECTION \ 210 + ".word 1b,4b,2b,4b;" \ 211 + ".previous;" \ 212 + : "=&r"(__gu_err) \ 213 + : "r"(&__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \ 214 + ); \ 215 + }) 216 + 217 + /** 218 + * put_user: - Write a simple value into user space. 219 + * @x: Value to copy to user space. 220 + * @ptr: Destination address, in user space. 221 + * 222 + * Context: User context only. This function may sleep. 223 + * 224 + * This macro copies a single simple value from kernel space to user 225 + * space. It supports simple types like char and int, but not larger 226 + * data types like structures or arrays. 227 + * 228 + * @ptr must have pointer-to-simple-variable type, and @x must be assignable 229 + * to the result of dereferencing @ptr. 230 + * 231 + * Returns zero on success, or -EFAULT on error. 232 + */ 225 233 226 234 #define __put_user(x, ptr) \ 227 235 ({ \ ··· 275 195 case 1: \ 276 196 __put_user_asm("sb", (ptr), __gu_val, __gu_err); \ 277 197 break; \ 278 - case 2: \ 198 + case 2: \ 279 199 __put_user_asm("sh", (ptr), __gu_val, __gu_err); \ 280 200 break; \ 281 201 case 4: \ ··· 285 205 __put_user_asm_8((ptr), __gu_val, __gu_err); \ 286 206 break; \ 287 207 default: \ 288 - __gu_err = -EINVAL; \ 208 + /*__gu_err = -EINVAL;*/ __gu_err = __user_bad(); \ 289 209 } \ 290 210 __gu_err; \ 291 211 }) 292 212 293 - #define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \ 294 - ({ \ 295 - __asm__ __volatile__ (" lwi %0, %1, 0; \ 296 - 1: swi %0, %2, 0; \ 297 - lwi %0, %1, 4; \ 298 - 2: swi %0, %2, 4; \ 299 - addk %0,r0,r0; \ 300 - 3: \ 301 - .section .fixup,\"ax\"; \ 302 - 4: brid 3b; \ 303 - addik %0, r0, %3; \ 304 - .previous; \ 305 - .section __ex_table,\"a\"; \ 306 - .word 1b,4b,2b,4b; \ 307 - .previous;" \ 308 - : "=&r"(__gu_err) \ 309 - : "r"(&__gu_val), \ 310 - "r"(__gu_ptr), "i"(-EFAULT) \ 311 - ); \ 213 + #ifndef CONFIG_MMU 214 + 215 + #define put_user(x, ptr) __put_user((x), (ptr)) 216 + 217 + #else /* CONFIG_MMU */ 218 + 219 + #define put_user(x, ptr) \ 220 + ({ \ 221 + access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ 222 + ? __put_user((x), (ptr)) : -EFAULT; \ 312 223 }) 224 + #endif /* CONFIG_MMU */ 313 225 314 - #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ 315 - ({ \ 316 - __asm__ __volatile__ ( \ 317 - "1:" insn " %1, %2, r0; \ 318 - addk %0, r0, r0; \ 319 - 2: \ 320 - .section .fixup,\"ax\"; \ 321 - 3: brid 2b; \ 322 - addik %0, r0, %3; \ 323 - .previous; \ 324 - .section __ex_table,\"a\"; \ 325 - .word 1b,3b; \ 326 - .previous;" \ 327 - : "=r"(__gu_err) \ 328 - : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \ 329 - ); \ 330 - }) 331 - 332 - /* 333 - * Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. 334 - */ 335 - static inline int clear_user(char *to, int size) 336 - { 337 - if (size && access_ok(VERIFY_WRITE, to, size)) { 338 - __asm__ __volatile__ (" \ 339 - 1: \ 340 - sb r0, %2, r0; \ 341 - addik %0, %0, -1; \ 342 - bneid %0, 1b; \ 343 - addik %2, %2, 1; \ 344 - 2: \ 345 - .section __ex_table,\"a\"; \ 346 - .word 1b,2b; \ 347 - .section .text;" \ 348 - : "=r"(size) \ 349 - : "0"(size), "r"(to) 350 - ); 351 - } 352 - return size; 353 - } 354 - 355 - #define __copy_from_user(to, from, n) copy_from_user((to), (from), (n)) 226 + /* copy_to_from_user */ 227 + #define __copy_from_user(to, from, n) \ 228 + __copy_tofrom_user((__force void __user *)(to), \ 229 + (void __user *)(from), (n)) 356 230 #define __copy_from_user_inatomic(to, from, n) \ 357 231 copy_from_user((to), (from), (n)) 358 232 359 - #define copy_to_user(to, from, n) \ 360 - (access_ok(VERIFY_WRITE, (to), (n)) ? \ 361 - __copy_tofrom_user((void __user *)(to), \ 362 - (__force const void __user *)(from), (n)) \ 363 - : -EFAULT) 233 + static inline long copy_from_user(void *to, 234 + const void __user *from, unsigned long n) 235 + { 236 + might_sleep(); 237 + if (access_ok(VERIFY_READ, from, n)) 238 + return __copy_from_user(to, from, n); 239 + return n; 240 + } 364 241 365 - #define __copy_to_user(to, from, n) copy_to_user((to), (from), (n)) 242 + #define __copy_to_user(to, from, n) \ 243 + __copy_tofrom_user((void __user *)(to), \ 244 + (__force const void __user *)(from), (n)) 366 245 #define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) 367 246 368 - #define copy_from_user(to, from, n) \ 369 - (access_ok(VERIFY_READ, (from), (n)) ? \ 370 - __copy_tofrom_user((__force void __user *)(to), \ 371 - (void __user *)(from), (n)) \ 372 - : -EFAULT) 373 - 374 - extern int __strncpy_user(char *to, const char __user *from, int len); 375 - extern int __strnlen_user(const char __user *sstr, int len); 376 - 377 - #define strncpy_from_user(to, from, len) \ 378 - (access_ok(VERIFY_READ, from, 1) ? \ 379 - __strncpy_user(to, from, len) : -EFAULT) 380 - #define strnlen_user(str, len) \ 381 - (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0) 382 - 383 - #endif /* CONFIG_MMU */ 384 - 385 - extern unsigned long __copy_tofrom_user(void __user *to, 386 - const void __user *from, unsigned long size); 247 + static inline long copy_to_user(void __user *to, 248 + const void *from, unsigned long n) 249 + { 250 + might_sleep(); 251 + if (access_ok(VERIFY_WRITE, to, n)) 252 + return __copy_to_user(to, from, n); 253 + return n; 254 + } 387 255 388 256 /* 389 - * The exception table consists of pairs of addresses: the first is the 390 - * address of an instruction that is allowed to fault, and the second is 391 - * the address at which the program should continue. No registers are 392 - * modified, so it is entirely up to the continuation code to figure out 393 - * what to do. 394 - * 395 - * All the routines below use bits of fixup code that are out of line 396 - * with the main instruction path. This means when everything is well, 397 - * we don't even have to jump over them. Further, they do not intrude 398 - * on our cache or tlb entries. 257 + * Copy a null terminated string from userspace. 399 258 */ 400 - struct exception_table_entry { 401 - unsigned long insn, fixup; 402 - }; 259 + extern int __strncpy_user(char *to, const char __user *from, int len); 260 + 261 + #define __strncpy_from_user __strncpy_user 262 + 263 + static inline long 264 + strncpy_from_user(char *dst, const char __user *src, long count) 265 + { 266 + if (!access_ok(VERIFY_READ, src, 1)) 267 + return -EFAULT; 268 + return __strncpy_from_user(dst, src, count); 269 + } 270 + 271 + /* 272 + * Return the size of a string (including the ending 0) 273 + * 274 + * Return 0 on exception, a value greater than N if too long 275 + */ 276 + extern int __strnlen_user(const char __user *sstr, int len); 277 + 278 + static inline long strnlen_user(const char __user *src, long n) 279 + { 280 + if (!access_ok(VERIFY_READ, src, 1)) 281 + return 0; 282 + return __strnlen_user(src, n); 283 + } 403 284 404 285 #endif /* __ASSEMBLY__ */ 405 286 #endif /* __KERNEL__ */
+1 -1
arch/microblaze/kernel/dma.c
··· 38 38 39 39 static unsigned long get_dma_direct_offset(struct device *dev) 40 40 { 41 - if (dev) 41 + if (likely(dev)) 42 42 return (unsigned long)dev->archdata.dma_data; 43 43 44 44 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
+9 -3
arch/microblaze/kernel/head.S
··· 51 51 52 52 .text 53 53 ENTRY(_start) 54 + #if CONFIG_KERNEL_BASE_ADDR == 0 55 + brai TOPHYS(real_start) 56 + .org 0x100 57 + real_start: 58 + #endif 59 + 54 60 mfs r1, rmsr 55 61 andi r1, r1, ~2 56 62 mts rmsr, r1 ··· 105 99 tophys(r4,r4) /* convert to phys address */ 106 100 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */ 107 101 _copy_command_line: 108 - lbu r2, r5, r6 /* r7=r5+r6 - r5 contain pointer to command line */ 109 - sb r2, r4, r6 /* addr[r4+r6]= r7*/ 102 + lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */ 103 + sb r2, r4, r6 /* addr[r4+r6]= r2*/ 110 104 addik r6, r6, 1 /* increment counting */ 111 105 bgtid r3, _copy_command_line /* loop for all entries */ 112 106 addik r3, r3, -1 /* descrement loop */ ··· 134 128 * virtual to physical. 135 129 */ 136 130 nop 137 - addik r3, r0, 63 /* Invalidate all TLB entries */ 131 + addik r3, r0, MICROBLAZE_TLB_SIZE -1 /* Invalidate all TLB entries */ 138 132 _invalidate: 139 133 mts rtlbx, r3 140 134 mts rtlbhi, r0 /* flush: ensure V is clear */
+48 -64
arch/microblaze/kernel/hw_exception_handler.S
··· 313 313 mfs r5, rmsr; 314 314 nop 315 315 swi r5, r1, 0; 316 - mfs r3, resr 316 + mfs r4, resr 317 317 nop 318 - mfs r4, rear; 318 + mfs r3, rear; 319 319 nop 320 320 321 321 #ifndef CONFIG_MMU 322 - andi r5, r3, 0x1000; /* Check ESR[DS] */ 322 + andi r5, r4, 0x1000; /* Check ESR[DS] */ 323 323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */ 324 324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 325 325 nop ··· 327 327 swi r17, r1, PT_R17 328 328 #endif 329 329 330 - andi r5, r3, 0x1F; /* Extract ESR[EXC] */ 330 + andi r5, r4, 0x1F; /* Extract ESR[EXC] */ 331 331 332 332 #ifdef CONFIG_MMU 333 333 /* Calculate exception vector offset = r5 << 2 */ 334 334 addk r6, r5, r5; /* << 1 */ 335 335 addk r6, r6, r6; /* << 2 */ 336 336 337 + #ifdef DEBUG 337 338 /* counting which exception happen */ 338 339 lwi r5, r0, 0x200 + TOPHYS(r0_ram) 339 340 addi r5, r5, 1 ··· 342 341 lwi r5, r6, 0x200 + TOPHYS(r0_ram) 343 342 addi r5, r5, 1 344 343 swi r5, r6, 0x200 + TOPHYS(r0_ram) 344 + #endif 345 345 /* end */ 346 346 /* Load the HW Exception vector */ 347 347 lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable) ··· 378 376 swi r18, r1, PT_R18 379 377 380 378 or r5, r1, r0 381 - andi r6, r3, 0x1F; /* Load ESR[EC] */ 379 + andi r6, r4, 0x1F; /* Load ESR[EC] */ 382 380 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */ 383 381 swi r7, r1, PT_MODE 384 382 mfs r7, rfsr ··· 428 426 */ 429 427 handle_unaligned_ex: 430 428 /* Working registers already saved: R3, R4, R5, R6 431 - * R3 = ESR 432 - * R4 = EAR 429 + * R4 = ESR 430 + * R3 = EAR 433 431 */ 434 432 #ifdef CONFIG_MMU 435 - andi r6, r3, 0x1000 /* Check ESR[DS] */ 433 + andi r6, r4, 0x1000 /* Check ESR[DS] */ 436 434 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */ 437 435 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 438 436 nop ··· 441 439 RESTORE_STATE; 442 440 bri unaligned_data_trap 443 441 #endif 444 - andi r6, r3, 0x3E0; /* Mask and extract the register operand */ 442 + andi r6, r4, 0x3E0; /* Mask and extract the register operand */ 445 443 srl r6, r6; /* r6 >> 5 */ 446 444 srl r6, r6; 447 445 srl r6, r6; ··· 450 448 /* Store the register operand in a temporary location */ 451 449 sbi r6, r0, TOPHYS(ex_reg_op); 452 450 453 - andi r6, r3, 0x400; /* Extract ESR[S] */ 451 + andi r6, r4, 0x400; /* Extract ESR[S] */ 454 452 bnei r6, ex_sw; 455 453 ex_lw: 456 - andi r6, r3, 0x800; /* Extract ESR[W] */ 454 + andi r6, r4, 0x800; /* Extract ESR[W] */ 457 455 beqi r6, ex_lhw; 458 - lbui r5, r4, 0; /* Exception address in r4 */ 456 + lbui r5, r3, 0; /* Exception address in r3 */ 459 457 /* Load a word, byte-by-byte from destination address 460 458 and save it in tmp space */ 461 459 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 462 - lbui r5, r4, 1; 460 + lbui r5, r3, 1; 463 461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 464 - lbui r5, r4, 2; 462 + lbui r5, r3, 2; 465 463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2); 466 - lbui r5, r4, 3; 464 + lbui r5, r3, 3; 467 465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3); 468 - /* Get the destination register value into r3 */ 469 - lwi r3, r0, TOPHYS(ex_tmp_data_loc_0); 466 + /* Get the destination register value into r4 */ 467 + lwi r4, r0, TOPHYS(ex_tmp_data_loc_0); 470 468 bri ex_lw_tail; 471 469 ex_lhw: 472 - lbui r5, r4, 0; /* Exception address in r4 */ 470 + lbui r5, r3, 0; /* Exception address in r3 */ 473 471 /* Load a half-word, byte-by-byte from destination 474 472 address and save it in tmp space */ 475 473 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 476 - lbui r5, r4, 1; 474 + lbui r5, r3, 1; 477 475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 478 - /* Get the destination register value into r3 */ 479 - lhui r3, r0, TOPHYS(ex_tmp_data_loc_0); 476 + /* Get the destination register value into r4 */ 477 + lhui r4, r0, TOPHYS(ex_tmp_data_loc_0); 480 478 ex_lw_tail: 481 479 /* Get the destination register number into r5 */ 482 480 lbui r5, r0, TOPHYS(ex_reg_op); ··· 504 502 andi r6, r6, 0x800; /* Extract ESR[W] */ 505 503 beqi r6, ex_shw; 506 504 /* Get the word - delay slot */ 507 - swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 505 + swi r4, r0, TOPHYS(ex_tmp_data_loc_0); 508 506 /* Store the word, byte-by-byte into destination address */ 509 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_0); 510 - sbi r3, r4, 0; 511 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_1); 512 - sbi r3, r4, 1; 513 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 514 - sbi r3, r4, 2; 515 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 516 - sbi r3, r4, 3; 507 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_0); 508 + sbi r4, r3, 0; 509 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_1); 510 + sbi r4, r3, 1; 511 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_2); 512 + sbi r4, r3, 2; 513 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_3); 514 + sbi r4, r3, 3; 517 515 bri ex_handler_done; 518 516 519 517 ex_shw: 520 518 /* Store the lower half-word, byte-by-byte into destination address */ 521 - swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 522 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 523 - sbi r3, r4, 0; 524 - lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 525 - sbi r3, r4, 1; 519 + swi r4, r0, TOPHYS(ex_tmp_data_loc_0); 520 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_2); 521 + sbi r4, r3, 0; 522 + lbui r4, r0, TOPHYS(ex_tmp_data_loc_3); 523 + sbi r4, r3, 1; 526 524 ex_sw_end: /* Exception handling of store word, ends. */ 527 525 528 526 ex_handler_done: ··· 562 560 */ 563 561 mfs r11, rpid 564 562 nop 565 - bri 4 566 - mfs r3, rear /* Get faulting address */ 567 - nop 568 563 /* If we are faulting a kernel address, we have to use the 569 564 * kernel page tables. 570 565 */ 571 - ori r4, r0, CONFIG_KERNEL_START 572 - cmpu r4, r3, r4 573 - bgti r4, ex3 566 + ori r5, r0, CONFIG_KERNEL_START 567 + cmpu r5, r3, r5 568 + bgti r5, ex3 574 569 /* First, check if it was a zone fault (which means a user 575 570 * tried to access a kernel or read-protected page - always 576 571 * a SEGV). All other faults here must be stores, so no 577 572 * need to check ESR_S as well. */ 578 - mfs r4, resr 579 - nop 580 573 andi r4, r4, 0x800 /* ESR_Z - zone protection */ 581 574 bnei r4, ex2 582 575 ··· 586 589 * tried to access a kernel or read-protected page - always 587 590 * a SEGV). All other faults here must be stores, so no 588 591 * need to check ESR_S as well. */ 589 - mfs r4, resr 590 - nop 591 592 andi r4, r4, 0x800 /* ESR_Z */ 592 593 bnei r4, ex2 593 594 /* get current task address */ ··· 660 665 * R3 = ESR 661 666 */ 662 667 663 - mfs r3, rear /* Get faulting address */ 664 - nop 665 668 RESTORE_STATE; 666 669 bri page_fault_instr_trap 667 670 ··· 670 677 */ 671 678 handle_data_tlb_miss_exception: 672 679 /* Working registers already saved: R3, R4, R5, R6 673 - * R3 = ESR 680 + * R3 = EAR, R4 = ESR 674 681 */ 675 682 mfs r11, rpid 676 - nop 677 - bri 4 678 - mfs r3, rear /* Get faulting address */ 679 683 nop 680 684 681 685 /* If we are faulting a kernel address, we have to use the 682 686 * kernel page tables. */ 683 - ori r4, r0, CONFIG_KERNEL_START 684 - cmpu r4, r3, r4 687 + ori r6, r0, CONFIG_KERNEL_START 688 + cmpu r4, r3, r6 685 689 bgti r4, ex5 686 690 ori r4, r0, swapper_pg_dir 687 691 mts rpid, r0 /* TLB will have 0 TID */ ··· 721 731 * Many of these bits are software only. Bits we don't set 722 732 * here we (properly should) assume have the appropriate value. 723 733 */ 734 + brid finish_tlb_load 724 735 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 725 - 726 - bri finish_tlb_load 727 736 ex7: 728 737 /* The bailout. Restore registers to pre-exception conditions 729 738 * and call the heavyweights to help us out. ··· 742 753 * R3 = ESR 743 754 */ 744 755 mfs r11, rpid 745 - nop 746 - bri 4 747 - mfs r3, rear /* Get faulting address */ 748 756 nop 749 757 750 758 /* If we are faulting a kernel address, we have to use the ··· 778 792 lwi r4, r5, 0 /* Get Linux PTE */ 779 793 780 794 andi r6, r4, _PAGE_PRESENT 781 - beqi r6, ex7 795 + beqi r6, ex10 782 796 783 797 ori r4, r4, _PAGE_ACCESSED 784 798 swi r4, r5, 0 ··· 791 805 * Many of these bits are software only. Bits we don't set 792 806 * here we (properly should) assume have the appropriate value. 793 807 */ 808 + brid finish_tlb_load 794 809 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 795 - 796 - bri finish_tlb_load 797 810 ex10: 798 811 /* The bailout. Restore registers to pre-exception conditions 799 812 * and call the heavyweights to help us out. ··· 822 837 andi r5, r5, (MICROBLAZE_TLB_SIZE-1) 823 838 ori r6, r0, 1 824 839 cmp r31, r5, r6 825 - blti r31, sem 840 + blti r31, ex12 826 841 addik r5, r6, 1 827 - sem: 842 + ex12: 828 843 /* MS: save back current TLB index */ 829 844 swi r5, r0, TOPHYS(tlb_index) 830 845 ··· 844 859 nop 845 860 846 861 /* Done...restore registers and get out of here. */ 847 - ex12: 848 862 mts rpid, r11 849 863 nop 850 864 bri 4
+13 -2
arch/microblaze/kernel/misc.S
··· 26 26 * We avoid flushing the pinned 0, 1 and possibly 2 entries. 27 27 */ 28 28 .globl _tlbia; 29 + .type _tlbia, @function 29 30 .align 4; 30 31 _tlbia: 31 - addik r12, r0, 63 /* flush all entries (63 - 3) */ 32 + addik r12, r0, MICROBLAZE_TLB_SIZE - 1 /* flush all entries (63 - 3) */ 32 33 /* isync */ 33 34 _tlbia_1: 34 35 mts rtlbx, r12 ··· 42 41 /* sync */ 43 42 rtsd r15, 8 44 43 nop 44 + .size _tlbia, . - _tlbia 45 45 46 46 /* 47 47 * Flush MMU TLB for a particular address (in r5) 48 48 */ 49 49 .globl _tlbie; 50 + .type _tlbie, @function 50 51 .align 4; 51 52 _tlbie: 52 53 mts rtlbsx, r5 /* look up the address in TLB */ ··· 62 59 rtsd r15, 8 63 60 nop 64 61 62 + .size _tlbie, . - _tlbie 63 + 65 64 /* 66 65 * Allocate TLB entry for early console 67 66 */ 68 67 .globl early_console_reg_tlb_alloc; 68 + .type early_console_reg_tlb_alloc, @function 69 69 .align 4; 70 70 early_console_reg_tlb_alloc: 71 71 /* 72 72 * Load a TLB entry for the UART, so that microblaze_progress() can use 73 73 * the UARTs nice and early. We use a 4k real==virtual mapping. 74 74 */ 75 - ori r4, r0, 63 75 + ori r4, r0, MICROBLAZE_TLB_SIZE - 1 76 76 mts rtlbx, r4 /* TLB slot 2 */ 77 77 78 78 or r4,r5,r0 ··· 91 85 nop 92 86 rtsd r15, 8 93 87 nop 88 + 89 + .size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc 94 90 95 91 /* 96 92 * Copy a whole page (4096 bytes). ··· 112 104 #define DCACHE_LINE_BYTES (4 * 4) 113 105 114 106 .globl copy_page; 107 + .type copy_page, @function 115 108 .align 4; 116 109 copy_page: 117 110 ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1 ··· 127 118 addik r11, r11, -1 128 119 rtsd r15, 8 129 120 nop 121 + 122 + .size copy_page, . - copy_page
+6 -4
arch/microblaze/kernel/process.c
··· 15 15 #include <linux/bitops.h> 16 16 #include <asm/system.h> 17 17 #include <asm/pgalloc.h> 18 + #include <asm/uaccess.h> /* for USER_DS macros */ 18 19 #include <asm/cacheflush.h> 19 20 20 21 void show_regs(struct pt_regs *regs) ··· 75 74 76 75 void default_idle(void) 77 76 { 78 - if (!hlt_counter) { 77 + if (likely(hlt_counter)) { 78 + while (!need_resched()) 79 + cpu_relax(); 80 + } else { 79 81 clear_thread_flag(TIF_POLLING_NRFLAG); 80 82 smp_mb__after_clear_bit(); 81 83 local_irq_disable(); ··· 86 82 cpu_sleep(); 87 83 local_irq_enable(); 88 84 set_thread_flag(TIF_POLLING_NRFLAG); 89 - } else 90 - while (!need_resched()) 91 - cpu_relax(); 85 + } 92 86 } 93 87 94 88 void cpu_idle(void)
+15 -9
arch/microblaze/kernel/setup.c
··· 92 92 } 93 93 #endif /* CONFIG_MTD_UCLINUX_EBSS */ 94 94 95 + #if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_SERIAL_UARTLITE_CONSOLE) 96 + #define eprintk early_printk 97 + #else 98 + #define eprintk printk 99 + #endif 100 + 95 101 void __init machine_early_init(const char *cmdline, unsigned int ram, 96 102 unsigned int fdt, unsigned int msr) 97 103 { ··· 145 139 setup_early_printk(NULL); 146 140 #endif 147 141 148 - early_printk("Ramdisk addr 0x%08x, ", ram); 142 + eprintk("Ramdisk addr 0x%08x, ", ram); 149 143 if (fdt) 150 - early_printk("FDT at 0x%08x\n", fdt); 144 + eprintk("FDT at 0x%08x\n", fdt); 151 145 else 152 - early_printk("Compiled-in FDT at 0x%08x\n", 146 + eprintk("Compiled-in FDT at 0x%08x\n", 153 147 (unsigned int)_fdt_start); 154 148 155 149 #ifdef CONFIG_MTD_UCLINUX 156 - early_printk("Found romfs @ 0x%08x (0x%08x)\n", 150 + eprintk("Found romfs @ 0x%08x (0x%08x)\n", 157 151 romfs_base, romfs_size); 158 - early_printk("#### klimit %p ####\n", old_klimit); 152 + eprintk("#### klimit %p ####\n", old_klimit); 159 153 BUG_ON(romfs_size < 0); /* What else can we do? */ 160 154 161 - early_printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", 155 + eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", 162 156 romfs_size, romfs_base, (unsigned)&_ebss); 163 157 164 - early_printk("New klimit: 0x%08x\n", (unsigned)klimit); 158 + eprintk("New klimit: 0x%08x\n", (unsigned)klimit); 165 159 #endif 166 160 167 161 #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 168 162 if (msr) 169 - early_printk("!!!Your kernel has setup MSR instruction but " 163 + eprintk("!!!Your kernel has setup MSR instruction but " 170 164 "CPU don't have it %d\n", msr); 171 165 #else 172 166 if (!msr) 173 - early_printk("!!!Your kernel not setup MSR instruction but " 167 + eprintk("!!!Your kernel not setup MSR instruction but " 174 168 "CPU have it %d\n", msr); 175 169 #endif 176 170
+2 -4
arch/microblaze/kernel/traps.c
··· 22 22 __enable_hw_exceptions(); 23 23 } 24 24 25 - static int kstack_depth_to_print = 24; 25 + static unsigned long kstack_depth_to_print = 24; 26 26 27 27 static int __init kstack_setup(char *s) 28 28 { 29 - kstack_depth_to_print = strict_strtoul(s, 0, NULL); 30 - 31 - return 1; 29 + return !strict_strtoul(s, 0, &kstack_depth_to_print); 32 30 } 33 31 __setup("kstack=", kstack_setup); 34 32
+1 -2
arch/microblaze/lib/Makefile
··· 10 10 lib-y += memcpy.o memmove.o 11 11 endif 12 12 13 - lib-$(CONFIG_NO_MMU) += uaccess.o 14 - lib-$(CONFIG_MMU) += uaccess_old.o 13 + lib-y += uaccess_old.o
+5 -1
arch/microblaze/lib/fastcopy.S
··· 30 30 */ 31 31 32 32 #include <linux/linkage.h> 33 - 33 + .text 34 34 .globl memcpy 35 + .type memcpy, @function 35 36 .ent memcpy 36 37 37 38 memcpy: ··· 346 345 rtsd r15, 8 347 346 nop 348 347 348 + .size memcpy, . - memcpy 349 349 .end memcpy 350 350 /*----------------------------------------------------------------------------*/ 351 351 .globl memmove 352 + .type memmove, @function 352 353 .ent memmove 353 354 354 355 memmove: ··· 662 659 rtsd r15, 8 663 660 nop 664 661 662 + .size memmove, . - memmove 665 663 .end memmove
+1 -1
arch/microblaze/lib/memcpy.c
··· 53 53 const uint32_t *i_src; 54 54 uint32_t *i_dst; 55 55 56 - if (c >= 4) { 56 + if (likely(c >= 4)) { 57 57 unsigned value, buf_hold; 58 58 59 59 /* Align the dstination to a word boundry. */
+8 -7
arch/microblaze/lib/memset.c
··· 33 33 #ifdef __HAVE_ARCH_MEMSET 34 34 void *memset(void *v_src, int c, __kernel_size_t n) 35 35 { 36 - 37 36 char *src = v_src; 38 37 #ifdef CONFIG_OPT_LIB_FUNCTION 39 38 uint32_t *i_src; 40 - uint32_t w32; 39 + uint32_t w32 = 0; 41 40 #endif 42 41 /* Truncate c to 8 bits */ 43 42 c = (c & 0xFF); 44 43 45 44 #ifdef CONFIG_OPT_LIB_FUNCTION 46 - /* Make a repeating word out of it */ 47 - w32 = c; 48 - w32 |= w32 << 8; 49 - w32 |= w32 << 16; 45 + if (unlikely(c)) { 46 + /* Make a repeating word out of it */ 47 + w32 = c; 48 + w32 |= w32 << 8; 49 + w32 |= w32 << 16; 50 + } 50 51 51 - if (n >= 4) { 52 + if (likely(n >= 4)) { 52 53 /* Align the destination to a word boundary */ 53 54 /* This is done in an endian independant manner */ 54 55 switch ((unsigned) src & 3) {
-48
arch/microblaze/lib/uaccess.c
··· 1 - /* 2 - * Copyright (C) 2006 Atmark Techno, Inc. 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - */ 8 - 9 - #include <linux/string.h> 10 - #include <asm/uaccess.h> 11 - 12 - #include <asm/bug.h> 13 - 14 - long strnlen_user(const char __user *src, long count) 15 - { 16 - return strlen(src) + 1; 17 - } 18 - 19 - #define __do_strncpy_from_user(dst, src, count, res) \ 20 - do { \ 21 - char *tmp; \ 22 - strncpy(dst, src, count); \ 23 - for (tmp = dst; *tmp && count > 0; tmp++, count--) \ 24 - ; \ 25 - res = (tmp - dst); \ 26 - } while (0) 27 - 28 - long __strncpy_from_user(char *dst, const char __user *src, long count) 29 - { 30 - long res; 31 - __do_strncpy_from_user(dst, src, count, res); 32 - return res; 33 - } 34 - 35 - long strncpy_from_user(char *dst, const char __user *src, long count) 36 - { 37 - long res = -EFAULT; 38 - if (access_ok(VERIFY_READ, src, 1)) 39 - __do_strncpy_from_user(dst, src, count, res); 40 - return res; 41 - } 42 - 43 - unsigned long __copy_tofrom_user(void __user *to, 44 - const void __user *from, unsigned long size) 45 - { 46 - memcpy(to, from, size); 47 - return 0; 48 - }
+31 -14
arch/microblaze/lib/uaccess_old.S
··· 22 22 23 23 .text 24 24 .globl __strncpy_user; 25 + .type __strncpy_user, @function 25 26 .align 4; 26 27 __strncpy_user: 27 28 ··· 51 50 3: 52 51 rtsd r15,8 53 52 nop 54 - 53 + .size __strncpy_user, . - __strncpy_user 55 54 56 55 .section .fixup, "ax" 57 56 .align 2 ··· 73 72 74 73 .text 75 74 .globl __strnlen_user; 75 + .type __strnlen_user, @function 76 76 .align 4; 77 77 __strnlen_user: 78 78 addik r3,r6,0 ··· 92 90 3: 93 91 rtsd r15,8 94 92 nop 95 - 93 + .size __strnlen_user, . - __strnlen_user 96 94 97 95 .section .fixup,"ax" 98 96 4: ··· 110 108 */ 111 109 .text 112 110 .globl __copy_tofrom_user; 111 + .type __copy_tofrom_user, @function 113 112 .align 4; 114 113 __copy_tofrom_user: 115 114 /* ··· 119 116 * r7, r3 - count 120 117 * r4 - tempval 121 118 */ 122 - addik r3,r7,0 123 - beqi r3,3f 124 - 1: 125 - lbu r4,r6,r0 126 - addik r6,r6,1 127 - 2: 128 - sb r4,r5,r0 129 - addik r3,r3,-1 130 - bneid r3,1b 131 - addik r5,r5,1 /* delay slot */ 119 + beqid r7, 3f /* zero size is not likely */ 120 + andi r3, r7, 0x3 /* filter add count */ 121 + bneid r3, 4f /* if is odd value then byte copying */ 122 + or r3, r5, r6 /* find if is any to/from unaligned */ 123 + andi r3, r3, 0x3 /* mask unaligned */ 124 + bneid r3, 1f /* it is unaligned -> then jump */ 125 + or r3, r0, r0 126 + 127 + /* at least one 4 byte copy */ 128 + 5: lw r4, r6, r3 129 + 6: sw r4, r5, r3 130 + addik r7, r7, -4 131 + bneid r7, 5b 132 + addik r3, r3, 4 133 + addik r3, r7, 0 134 + rtsd r15, 8 135 + nop 136 + 4: or r3, r0, r0 137 + 1: lbu r4,r6,r3 138 + 2: sb r4,r5,r3 139 + addik r7,r7,-1 140 + bneid r7,1b 141 + addik r3,r3,1 /* delay slot */ 132 142 3: 143 + addik r3,r7,0 133 144 rtsd r15,8 134 145 nop 135 - 146 + .size __copy_tofrom_user, . - __copy_tofrom_user 136 147 137 148 .section __ex_table,"a" 138 - .word 1b,3b,2b,3b 149 + .word 1b,3b,2b,3b,5b,3b,6b,3b
+12 -12
arch/microblaze/mm/fault.c
··· 106 106 regs->esr = error_code; 107 107 108 108 /* On a kernel SLB miss we can only check for a valid exception entry */ 109 - if (kernel_mode(regs) && (address >= TASK_SIZE)) { 109 + if (unlikely(kernel_mode(regs) && (address >= TASK_SIZE))) { 110 110 printk(KERN_WARNING "kernel task_size exceed"); 111 111 _exception(SIGSEGV, regs, code, address); 112 112 } ··· 122 122 } 123 123 #endif /* CONFIG_KGDB */ 124 124 125 - if (in_atomic() || !mm) { 125 + if (unlikely(in_atomic() || !mm)) { 126 126 if (kernel_mode(regs)) 127 127 goto bad_area_nosemaphore; 128 128 ··· 150 150 * source. If this is invalid we can skip the address space check, 151 151 * thus avoiding the deadlock. 152 152 */ 153 - if (!down_read_trylock(&mm->mmap_sem)) { 153 + if (unlikely(!down_read_trylock(&mm->mmap_sem))) { 154 154 if (kernel_mode(regs) && !search_exception_tables(regs->pc)) 155 155 goto bad_area_nosemaphore; 156 156 ··· 158 158 } 159 159 160 160 vma = find_vma(mm, address); 161 - if (!vma) 161 + if (unlikely(!vma)) 162 162 goto bad_area; 163 163 164 164 if (vma->vm_start <= address) 165 165 goto good_area; 166 166 167 - if (!(vma->vm_flags & VM_GROWSDOWN)) 167 + if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) 168 168 goto bad_area; 169 169 170 - if (!is_write) 170 + if (unlikely(!is_write)) 171 171 goto bad_area; 172 172 173 173 /* ··· 179 179 * before setting the user r1. Thus we allow the stack to 180 180 * expand to 1MB without further checks. 181 181 */ 182 - if (address + 0x100000 < vma->vm_end) { 182 + if (unlikely(address + 0x100000 < vma->vm_end)) { 183 183 184 184 /* get user regs even if this fault is in kernel mode */ 185 185 struct pt_regs *uregs = current->thread.regs; ··· 209 209 code = SEGV_ACCERR; 210 210 211 211 /* a write */ 212 - if (is_write) { 213 - if (!(vma->vm_flags & VM_WRITE)) 212 + if (unlikely(is_write)) { 213 + if (unlikely(!(vma->vm_flags & VM_WRITE))) 214 214 goto bad_area; 215 215 /* a read */ 216 216 } else { 217 217 /* protection fault */ 218 - if (error_code & 0x08000000) 218 + if (unlikely(error_code & 0x08000000)) 219 219 goto bad_area; 220 - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 220 + if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC)))) 221 221 goto bad_area; 222 222 } 223 223 ··· 235 235 goto do_sigbus; 236 236 BUG(); 237 237 } 238 - if (fault & VM_FAULT_MAJOR) 238 + if (unlikely(fault & VM_FAULT_MAJOR)) 239 239 current->maj_flt++; 240 240 else 241 241 current->min_flt++;
-9
arch/microblaze/mm/init.c
··· 166 166 for (addr = begin; addr < end; addr += PAGE_SIZE) { 167 167 ClearPageReserved(virt_to_page(addr)); 168 168 init_page_count(virt_to_page(addr)); 169 - memset((void *)addr, 0xcc, PAGE_SIZE); 170 169 free_page(addr); 171 170 totalram_pages++; 172 171 } ··· 208 209 } 209 210 210 211 #ifndef CONFIG_MMU 211 - /* Check against bounds of physical memory */ 212 - int ___range_ok(unsigned long addr, unsigned long size) 213 - { 214 - return ((addr < memory_start) || 215 - ((addr + size) > memory_end)); 216 - } 217 - EXPORT_SYMBOL(___range_ok); 218 - 219 212 int page_is_ram(unsigned long pfn) 220 213 { 221 214 return __range_ok(pfn, 0);
+1 -1
arch/microblaze/mm/pgtable.c
··· 154 154 err = 0; 155 155 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, 156 156 __pgprot(flags))); 157 - if (mem_init_done) 157 + if (unlikely(mem_init_done)) 158 158 flush_HPTE(0, va, pmd_val(*pd)); 159 159 /* flush_HPTE(0, va, pg); */ 160 160 }
-2
arch/powerpc/kernel/misc.S
··· 128 128 /* place holder */ 129 129 blr 130 130 131 - #ifdef CONFIG_EVENT_TRACING 132 131 /* 133 132 * Get a minimal set of registers for our caller's nth caller. 134 133 * r3 = regs pointer, r5 = n. ··· 153 154 PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3) 154 155 PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3) 155 156 blr 156 - #endif /* CONFIG_EVENT_TRACING */
+2
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
··· 481 481 if (rc) 482 482 goto err_bcom_rx_irq; 483 483 484 + lpbfifo.dma_irqs_enabled = 1; 485 + 484 486 /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */ 485 487 lpbfifo.bcom_tx_task = 486 488 bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA,
+190 -46
arch/sh/configs/ecovec24_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.33-rc2 4 - # Mon Jan 4 11:20:36 2010 3 + # Linux kernel version: 2.6.34-rc2 4 + # Mon Mar 29 02:21:58 2010 5 5 # 6 6 CONFIG_SUPERH=y 7 7 CONFIG_SUPERH32=y ··· 13 13 CONFIG_GENERIC_HWEIGHT=y 14 14 CONFIG_GENERIC_HARDIRQS=y 15 15 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 16 - CONFIG_GENERIC_IRQ_PROBE=y 17 16 CONFIG_IRQ_PER_CPU=y 17 + CONFIG_SPARSE_IRQ=y 18 18 CONFIG_GENERIC_GPIO=y 19 19 CONFIG_GENERIC_TIME=y 20 20 CONFIG_GENERIC_CLOCKEVENTS=y ··· 32 32 CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33 33 CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34 34 CONFIG_DMA_NONCOHERENT=y 35 + CONFIG_NEED_DMA_MAP_STATE=y 35 36 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36 37 CONFIG_CONSTRUCTORS=y 37 38 ··· 48 47 CONFIG_HAVE_KERNEL_GZIP=y 49 48 CONFIG_HAVE_KERNEL_BZIP2=y 50 49 CONFIG_HAVE_KERNEL_LZMA=y 50 + CONFIG_HAVE_KERNEL_LZO=y 51 51 CONFIG_KERNEL_GZIP=y 52 52 # CONFIG_KERNEL_BZIP2 is not set 53 53 # CONFIG_KERNEL_LZMA is not set 54 + # CONFIG_KERNEL_LZO is not set 54 55 CONFIG_SWAP=y 55 56 CONFIG_SYSVIPC=y 56 57 CONFIG_SYSVIPC_SYSCTL=y ··· 74 71 # CONFIG_TREE_RCU_TRACE is not set 75 72 # CONFIG_IKCONFIG is not set 76 73 CONFIG_LOG_BUF_SHIFT=14 77 - CONFIG_GROUP_SCHED=y 78 - CONFIG_FAIR_GROUP_SCHED=y 79 - # CONFIG_RT_GROUP_SCHED is not set 80 - CONFIG_USER_SCHED=y 81 - # CONFIG_CGROUP_SCHED is not set 82 74 # CONFIG_CGROUPS is not set 83 - CONFIG_SYSFS_DEPRECATED=y 84 - CONFIG_SYSFS_DEPRECATED_V2=y 75 + # CONFIG_SYSFS_DEPRECATED_V2 is not set 85 76 # CONFIG_RELAY is not set 86 77 # CONFIG_NAMESPACES is not set 87 78 # CONFIG_BLK_DEV_INITRD is not set ··· 104 107 # 105 108 # Kernel Performance Events And Counters 106 109 # 107 - # CONFIG_PERF_EVENTS is not set 110 + CONFIG_PERF_EVENTS=y 108 111 # CONFIG_PERF_COUNTERS is not set 109 112 CONFIG_VM_EVENT_COUNTERS=y 110 113 CONFIG_COMPAT_BRK=y ··· 113 116 # CONFIG_SLOB is not set 114 117 # CONFIG_PROFILING is not set 115 118 CONFIG_HAVE_OPROFILE=y 116 - CONFIG_HAVE_IOREMAP_PROT=y 117 119 CONFIG_HAVE_KPROBES=y 118 120 CONFIG_HAVE_KRETPROBES=y 119 121 CONFIG_HAVE_ARCH_TRACEHOOK=y 120 122 CONFIG_HAVE_DMA_ATTRS=y 121 123 CONFIG_HAVE_CLK=y 122 124 CONFIG_HAVE_DMA_API_DEBUG=y 125 + CONFIG_HAVE_HW_BREAKPOINT=y 123 126 124 127 # 125 128 # GCOV-based kernel profiling ··· 231 234 CONFIG_QUICKLIST=y 232 235 CONFIG_MMU=y 233 236 CONFIG_PAGE_OFFSET=0x80000000 234 - CONFIG_FORCE_MAX_ZONEORDER=11 237 + CONFIG_FORCE_MAX_ZONEORDER=12 235 238 CONFIG_MEMORY_START=0x08000000 236 239 CONFIG_MEMORY_SIZE=0x10000000 237 240 CONFIG_29BIT=y 238 - # CONFIG_PMB_ENABLE is not set 239 - # CONFIG_X2TLB is not set 241 + # CONFIG_PMB is not set 242 + CONFIG_X2TLB=y 240 243 CONFIG_VSYSCALL=y 241 244 CONFIG_ARCH_FLATMEM_ENABLE=y 242 245 CONFIG_ARCH_SPARSEMEM_ENABLE=y ··· 244 247 CONFIG_MAX_ACTIVE_REGIONS=1 245 248 CONFIG_ARCH_POPULATES_NODE_MAP=y 246 249 CONFIG_ARCH_SELECT_MEMORY_MODEL=y 250 + CONFIG_IOREMAP_FIXED=y 251 + CONFIG_UNCACHED_MAPPING=y 247 252 CONFIG_PAGE_SIZE_4KB=y 248 253 # CONFIG_PAGE_SIZE_8KB is not set 249 254 # CONFIG_PAGE_SIZE_16KB is not set ··· 261 262 CONFIG_SPLIT_PTLOCK_CPUS=4 262 263 # CONFIG_PHYS_ADDR_T_64BIT is not set 263 264 CONFIG_ZONE_DMA_FLAG=0 264 - CONFIG_NR_QUICK=2 265 + CONFIG_NR_QUICK=1 265 266 # CONFIG_KSM is not set 266 267 CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 267 268 ··· 336 337 # CONFIG_PREEMPT_VOLUNTARY is not set 337 338 CONFIG_PREEMPT=y 338 339 CONFIG_GUSA=y 339 - # CONFIG_SPARSE_IRQ is not set 340 340 341 341 # 342 342 # Boot options ··· 345 347 CONFIG_ENTRY_OFFSET=0x00001000 346 348 CONFIG_CMDLINE_OVERWRITE=y 347 349 # CONFIG_CMDLINE_EXTEND is not set 348 - CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=120M memchunk.vpu=4m" 350 + CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=248M memchunk.vpu=8m memchunk.veu0=4m" 349 351 350 352 # 351 353 # Bus options ··· 371 373 CONFIG_SUSPEND_FREEZER=y 372 374 # CONFIG_HIBERNATION is not set 373 375 CONFIG_PM_RUNTIME=y 376 + CONFIG_PM_OPS=y 374 377 # CONFIG_CPU_IDLE is not set 375 378 CONFIG_NET=y 376 379 ··· 379 380 # Networking options 380 381 # 381 382 CONFIG_PACKET=y 382 - # CONFIG_PACKET_MMAP is not set 383 383 CONFIG_UNIX=y 384 384 # CONFIG_NET_KEY is not set 385 385 CONFIG_INET=y ··· 443 445 # CONFIG_NET_PKTGEN is not set 444 446 # CONFIG_HAMRADIO is not set 445 447 # CONFIG_CAN is not set 446 - # CONFIG_IRDA is not set 448 + CONFIG_IRDA=y 449 + 450 + # 451 + # IrDA protocols 452 + # 453 + # CONFIG_IRLAN is not set 454 + # CONFIG_IRCOMM is not set 455 + # CONFIG_IRDA_ULTRA is not set 456 + 457 + # 458 + # IrDA options 459 + # 460 + # CONFIG_IRDA_CACHE_LAST_LSAP is not set 461 + # CONFIG_IRDA_FAST_RR is not set 462 + # CONFIG_IRDA_DEBUG is not set 463 + 464 + # 465 + # Infrared-port device drivers 466 + # 467 + 468 + # 469 + # SIR device drivers 470 + # 471 + # CONFIG_IRTTY_SIR is not set 472 + 473 + # 474 + # Dongle support 475 + # 476 + CONFIG_SH_SIR=y 477 + # CONFIG_KINGSUN_DONGLE is not set 478 + # CONFIG_KSDAZZLE_DONGLE is not set 479 + # CONFIG_KS959_DONGLE is not set 480 + 481 + # 482 + # FIR device drivers 483 + # 484 + # CONFIG_USB_IRDA is not set 485 + # CONFIG_SIGMATEL_FIR is not set 486 + # CONFIG_MCS_FIR is not set 447 487 # CONFIG_BT is not set 448 488 # CONFIG_AF_RXRPC is not set 449 489 CONFIG_WIRELESS=y ··· 592 556 # CONFIG_MTD_NAND_NANDSIM is not set 593 557 # CONFIG_MTD_NAND_PLATFORM is not set 594 558 # CONFIG_MTD_ALAUDA is not set 559 + # CONFIG_MTD_NAND_SH_FLCTL is not set 595 560 # CONFIG_MTD_ONENAND is not set 596 561 597 562 # ··· 634 597 # CONFIG_ICS932S401 is not set 635 598 # CONFIG_ENCLOSURE_SERVICES is not set 636 599 # CONFIG_ISL29003 is not set 600 + # CONFIG_SENSORS_TSL2550 is not set 637 601 # CONFIG_DS1682 is not set 638 602 # CONFIG_TI_DAC7512 is not set 639 603 # CONFIG_C2PORT is not set ··· 654 616 # 655 617 # SCSI device support 656 618 # 619 + CONFIG_SCSI_MOD=y 657 620 # CONFIG_RAID_ATTRS is not set 658 621 CONFIG_SCSI=y 659 622 CONFIG_SCSI_DMA=y ··· 807 768 # CONFIG_INPUT_MOUSE is not set 808 769 # CONFIG_INPUT_JOYSTICK is not set 809 770 # CONFIG_INPUT_TABLET is not set 810 - # CONFIG_INPUT_TOUCHSCREEN is not set 771 + CONFIG_INPUT_TOUCHSCREEN=y 772 + # CONFIG_TOUCHSCREEN_ADS7846 is not set 773 + # CONFIG_TOUCHSCREEN_AD7877 is not set 774 + # CONFIG_TOUCHSCREEN_AD7879_I2C is not set 775 + # CONFIG_TOUCHSCREEN_AD7879_SPI is not set 776 + # CONFIG_TOUCHSCREEN_AD7879 is not set 777 + # CONFIG_TOUCHSCREEN_DYNAPRO is not set 778 + # CONFIG_TOUCHSCREEN_EETI is not set 779 + # CONFIG_TOUCHSCREEN_FUJITSU is not set 780 + # CONFIG_TOUCHSCREEN_GUNZE is not set 781 + # CONFIG_TOUCHSCREEN_ELO is not set 782 + # CONFIG_TOUCHSCREEN_WACOM_W8001 is not set 783 + # CONFIG_TOUCHSCREEN_MCS5000 is not set 784 + # CONFIG_TOUCHSCREEN_MTOUCH is not set 785 + # CONFIG_TOUCHSCREEN_INEXIO is not set 786 + # CONFIG_TOUCHSCREEN_MK712 is not set 787 + # CONFIG_TOUCHSCREEN_PENMOUNT is not set 788 + # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 789 + # CONFIG_TOUCHSCREEN_TOUCHWIN is not set 790 + # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set 791 + # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set 792 + CONFIG_TOUCHSCREEN_TSC2007=y 793 + # CONFIG_TOUCHSCREEN_W90X900 is not set 811 794 # CONFIG_INPUT_MISC is not set 812 795 813 796 # ··· 863 802 CONFIG_SERIAL_SH_SCI_CONSOLE=y 864 803 CONFIG_SERIAL_CORE=y 865 804 CONFIG_SERIAL_CORE_CONSOLE=y 805 + # CONFIG_SERIAL_TIMBERDALE is not set 866 806 CONFIG_UNIX98_PTYS=y 867 807 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 868 - CONFIG_LEGACY_PTYS=y 869 - CONFIG_LEGACY_PTY_COUNT=256 808 + # CONFIG_LEGACY_PTYS is not set 870 809 # CONFIG_IPMI_HANDLER is not set 871 810 CONFIG_HW_RANDOM=y 872 811 # CONFIG_HW_RANDOM_TIMERIOMEM is not set ··· 891 830 # CONFIG_I2C_OCORES is not set 892 831 CONFIG_I2C_SH_MOBILE=y 893 832 # CONFIG_I2C_SIMTEC is not set 833 + # CONFIG_I2C_XILINX is not set 894 834 895 835 # 896 836 # External I2C/SMBus adapter drivers ··· 905 843 # 906 844 # CONFIG_I2C_PCA_PLATFORM is not set 907 845 # CONFIG_I2C_STUB is not set 908 - 909 - # 910 - # Miscellaneous I2C Chip support 911 - # 912 - # CONFIG_SENSORS_TSL2550 is not set 913 846 # CONFIG_I2C_DEBUG_CORE is not set 914 847 # CONFIG_I2C_DEBUG_ALGO is not set 915 848 # CONFIG_I2C_DEBUG_BUS is not set 916 - # CONFIG_I2C_DEBUG_CHIP is not set 917 849 CONFIG_SPI=y 918 850 CONFIG_SPI_MASTER=y 919 851 ··· 938 882 # 939 883 # Memory mapped GPIO expanders: 940 884 # 885 + # CONFIG_GPIO_IT8761E is not set 941 886 942 887 # 943 888 # I2C GPIO expanders: 944 889 # 890 + # CONFIG_GPIO_MAX7300 is not set 945 891 # CONFIG_GPIO_MAX732X is not set 946 892 # CONFIG_GPIO_PCA953X is not set 947 893 # CONFIG_GPIO_PCF857X is not set 894 + # CONFIG_GPIO_ADP5588 is not set 948 895 949 896 # 950 897 # PCI GPIO expanders: ··· 978 919 # 979 920 # Multifunction device drivers 980 921 # 981 - # CONFIG_MFD_CORE is not set 922 + CONFIG_MFD_CORE=y 923 + # CONFIG_MFD_88PM860X is not set 982 924 # CONFIG_MFD_SM501 is not set 983 - # CONFIG_MFD_SH_MOBILE_SDHI is not set 925 + CONFIG_MFD_SH_MOBILE_SDHI=y 984 926 # CONFIG_HTC_PASIC3 is not set 927 + # CONFIG_HTC_I2CPLD is not set 985 928 # CONFIG_TPS65010 is not set 986 929 # CONFIG_TWL4030_CORE is not set 987 930 # CONFIG_MFD_TMIO is not set 988 931 # CONFIG_PMIC_DA903X is not set 989 932 # CONFIG_PMIC_ADP5520 is not set 933 + # CONFIG_MFD_MAX8925 is not set 990 934 # CONFIG_MFD_WM8400 is not set 991 935 # CONFIG_MFD_WM831X is not set 992 936 # CONFIG_MFD_WM8350_I2C is not set 937 + # CONFIG_MFD_WM8994 is not set 993 938 # CONFIG_MFD_PCF50633 is not set 994 939 # CONFIG_MFD_MC13783 is not set 995 940 # CONFIG_AB3100_CORE is not set 996 941 # CONFIG_EZX_PCAP is not set 997 - # CONFIG_MFD_88PM8607 is not set 998 942 # CONFIG_AB4500_CORE is not set 999 943 # CONFIG_REGULATOR is not set 1000 944 CONFIG_MEDIA_SUPPORT=y ··· 1047 985 # CONFIG_SOC_CAMERA_MT9M001 is not set 1048 986 # CONFIG_SOC_CAMERA_MT9M111 is not set 1049 987 # CONFIG_SOC_CAMERA_MT9T031 is not set 1050 - # CONFIG_SOC_CAMERA_MT9T112 is not set 988 + CONFIG_SOC_CAMERA_MT9T112=y 1051 989 # CONFIG_SOC_CAMERA_MT9V022 is not set 1052 990 # CONFIG_SOC_CAMERA_RJ54N1 is not set 1053 - # CONFIG_SOC_CAMERA_TW9910 is not set 991 + CONFIG_SOC_CAMERA_TW9910=y 1054 992 # CONFIG_SOC_CAMERA_PLATFORM is not set 1055 993 # CONFIG_SOC_CAMERA_OV772X is not set 1056 994 # CONFIG_SOC_CAMERA_OV9640 is not set ··· 1063 1001 # CONFIG_RADIO_SI470X is not set 1064 1002 # CONFIG_USB_MR800 is not set 1065 1003 # CONFIG_RADIO_TEA5764 is not set 1004 + # CONFIG_RADIO_SAA7706H is not set 1066 1005 # CONFIG_RADIO_TEF6862 is not set 1067 1006 # CONFIG_DAB is not set 1068 1007 ··· 1097 1034 # 1098 1035 # CONFIG_FB_S1D13XXX is not set 1099 1036 CONFIG_FB_SH_MOBILE_LCDC=y 1037 + # CONFIG_FB_TMIO is not set 1100 1038 # CONFIG_FB_VIRTUAL is not set 1101 1039 # CONFIG_FB_METRONOME is not set 1102 1040 # CONFIG_FB_MB862XX is not set ··· 1126 1062 # CONFIG_LOGO_SUPERH_MONO is not set 1127 1063 # CONFIG_LOGO_SUPERH_VGA16 is not set 1128 1064 CONFIG_LOGO_SUPERH_CLUT224=y 1129 - # CONFIG_SOUND is not set 1065 + CONFIG_SOUND=y 1066 + CONFIG_SOUND_OSS_CORE=y 1067 + CONFIG_SOUND_OSS_CORE_PRECLAIM=y 1068 + CONFIG_SND=y 1069 + CONFIG_SND_TIMER=y 1070 + CONFIG_SND_PCM=y 1071 + CONFIG_SND_JACK=y 1072 + CONFIG_SND_SEQUENCER=y 1073 + CONFIG_SND_SEQ_DUMMY=y 1074 + CONFIG_SND_OSSEMUL=y 1075 + CONFIG_SND_MIXER_OSS=y 1076 + CONFIG_SND_PCM_OSS=y 1077 + CONFIG_SND_PCM_OSS_PLUGINS=y 1078 + # CONFIG_SND_SEQUENCER_OSS is not set 1079 + # CONFIG_SND_DYNAMIC_MINORS is not set 1080 + CONFIG_SND_SUPPORT_OLD_API=y 1081 + CONFIG_SND_VERBOSE_PROCFS=y 1082 + # CONFIG_SND_VERBOSE_PRINTK is not set 1083 + # CONFIG_SND_DEBUG is not set 1084 + # CONFIG_SND_RAWMIDI_SEQ is not set 1085 + # CONFIG_SND_OPL3_LIB_SEQ is not set 1086 + # CONFIG_SND_OPL4_LIB_SEQ is not set 1087 + # CONFIG_SND_SBAWE_SEQ is not set 1088 + # CONFIG_SND_EMU10K1_SEQ is not set 1089 + # CONFIG_SND_DRIVERS is not set 1090 + # CONFIG_SND_SPI is not set 1091 + CONFIG_SND_SUPERH=y 1092 + # CONFIG_SND_USB is not set 1093 + CONFIG_SND_SOC=y 1094 + 1095 + # 1096 + # SoC Audio support for SuperH 1097 + # 1098 + CONFIG_SND_SOC_SH4_FSI=y 1099 + # CONFIG_SND_FSI_AK4642 is not set 1100 + CONFIG_SND_FSI_DA7210=y 1101 + CONFIG_SND_SOC_I2C_AND_SPI=y 1102 + # CONFIG_SND_SOC_ALL_CODECS is not set 1103 + CONFIG_SND_SOC_DA7210=y 1104 + # CONFIG_SOUND_PRIME is not set 1130 1105 CONFIG_HID_SUPPORT=y 1131 1106 CONFIG_HID=y 1132 1107 # CONFIG_HIDRAW is not set ··· 1180 1077 # 1181 1078 # Special HID drivers 1182 1079 # 1080 + # CONFIG_HID_3M_PCT is not set 1183 1081 # CONFIG_HID_A4TECH is not set 1184 1082 # CONFIG_HID_APPLE is not set 1185 1083 # CONFIG_HID_BELKIN is not set ··· 1195 1091 # CONFIG_HID_KENSINGTON is not set 1196 1092 # CONFIG_HID_LOGITECH is not set 1197 1093 # CONFIG_HID_MICROSOFT is not set 1094 + # CONFIG_HID_MOSART is not set 1198 1095 # CONFIG_HID_MONTEREY is not set 1199 1096 # CONFIG_HID_NTRIG is not set 1097 + # CONFIG_HID_ORTEK is not set 1200 1098 # CONFIG_HID_PANTHERLORD is not set 1201 1099 # CONFIG_HID_PETALYNX is not set 1100 + # CONFIG_HID_QUANTA is not set 1202 1101 # CONFIG_HID_SAMSUNG is not set 1203 1102 # CONFIG_HID_SONY is not set 1103 + # CONFIG_HID_STANTUM is not set 1204 1104 # CONFIG_HID_SUNPLUS is not set 1205 1105 # CONFIG_HID_GREENASIA is not set 1206 1106 # CONFIG_HID_SMARTJOYPLUS is not set ··· 1244 1136 # CONFIG_USB_SL811_HCD is not set 1245 1137 CONFIG_USB_R8A66597_HCD=y 1246 1138 # CONFIG_USB_HWA_HCD is not set 1139 + # CONFIG_USB_GADGET_MUSB_HDRC is not set 1247 1140 1248 1141 # 1249 1142 # USB Device Class drivers ··· 1297 1188 # CONFIG_USB_RIO500 is not set 1298 1189 # CONFIG_USB_LEGOTOWER is not set 1299 1190 # CONFIG_USB_LCD is not set 1300 - # CONFIG_USB_BERRY_CHARGE is not set 1301 1191 # CONFIG_USB_LED is not set 1302 1192 # CONFIG_USB_CYPRESS_CY7C63 is not set 1303 1193 # CONFIG_USB_CYTHERM is not set ··· 1308 1200 # CONFIG_USB_IOWARRIOR is not set 1309 1201 # CONFIG_USB_TEST is not set 1310 1202 # CONFIG_USB_ISIGHTFW is not set 1311 - # CONFIG_USB_VST is not set 1312 - # CONFIG_USB_GADGET is not set 1203 + CONFIG_USB_GADGET=y 1204 + # CONFIG_USB_GADGET_DEBUG_FILES is not set 1205 + # CONFIG_USB_GADGET_DEBUG_FS is not set 1206 + CONFIG_USB_GADGET_VBUS_DRAW=2 1207 + CONFIG_USB_GADGET_SELECTED=y 1208 + # CONFIG_USB_GADGET_AT91 is not set 1209 + # CONFIG_USB_GADGET_ATMEL_USBA is not set 1210 + # CONFIG_USB_GADGET_FSL_USB2 is not set 1211 + # CONFIG_USB_GADGET_LH7A40X is not set 1212 + # CONFIG_USB_GADGET_OMAP is not set 1213 + # CONFIG_USB_GADGET_PXA25X is not set 1214 + CONFIG_USB_GADGET_R8A66597=y 1215 + CONFIG_USB_R8A66597=y 1216 + # CONFIG_USB_GADGET_PXA27X is not set 1217 + # CONFIG_USB_GADGET_S3C_HSOTG is not set 1218 + # CONFIG_USB_GADGET_IMX is not set 1219 + # CONFIG_USB_GADGET_S3C2410 is not set 1220 + # CONFIG_USB_GADGET_M66592 is not set 1221 + # CONFIG_USB_GADGET_AMD5536UDC is not set 1222 + # CONFIG_USB_GADGET_FSL_QE is not set 1223 + # CONFIG_USB_GADGET_CI13XXX is not set 1224 + # CONFIG_USB_GADGET_NET2280 is not set 1225 + # CONFIG_USB_GADGET_GOKU is not set 1226 + # CONFIG_USB_GADGET_LANGWELL is not set 1227 + # CONFIG_USB_GADGET_DUMMY_HCD is not set 1228 + CONFIG_USB_GADGET_DUALSPEED=y 1229 + # CONFIG_USB_ZERO is not set 1230 + # CONFIG_USB_AUDIO is not set 1231 + # CONFIG_USB_ETH is not set 1232 + # CONFIG_USB_GADGETFS is not set 1233 + CONFIG_USB_FILE_STORAGE=m 1234 + # CONFIG_USB_FILE_STORAGE_TEST is not set 1235 + # CONFIG_USB_MASS_STORAGE is not set 1236 + # CONFIG_USB_G_SERIAL is not set 1237 + # CONFIG_USB_MIDI_GADGET is not set 1238 + # CONFIG_USB_G_PRINTER is not set 1239 + # CONFIG_USB_CDC_COMPOSITE is not set 1240 + # CONFIG_USB_G_NOKIA is not set 1241 + # CONFIG_USB_G_MULTI is not set 1313 1242 1314 1243 # 1315 1244 # OTG and related infrastructure ··· 1369 1224 # MMC/SD/SDIO Host Controller Drivers 1370 1225 # 1371 1226 # CONFIG_MMC_SDHCI is not set 1372 - # CONFIG_MMC_AT91 is not set 1373 - # CONFIG_MMC_ATMELMCI is not set 1374 1227 CONFIG_MMC_SPI=y 1375 - # CONFIG_MMC_TMIO is not set 1228 + CONFIG_MMC_TMIO=y 1376 1229 # CONFIG_MEMSTICK is not set 1377 1230 # CONFIG_NEW_LEDS is not set 1378 1231 # CONFIG_ACCESSIBILITY is not set ··· 1396 1253 # CONFIG_RTC_DRV_DS1374 is not set 1397 1254 # CONFIG_RTC_DRV_DS1672 is not set 1398 1255 # CONFIG_RTC_DRV_MAX6900 is not set 1399 - # CONFIG_RTC_DRV_RS5C372 is not set 1256 + CONFIG_RTC_DRV_RS5C372=y 1400 1257 # CONFIG_RTC_DRV_ISL1208 is not set 1401 1258 # CONFIG_RTC_DRV_X1205 is not set 1402 - CONFIG_RTC_DRV_PCF8563=y 1259 + # CONFIG_RTC_DRV_PCF8563 is not set 1403 1260 # CONFIG_RTC_DRV_PCF8583 is not set 1404 1261 # CONFIG_RTC_DRV_M41T80 is not set 1405 1262 # CONFIG_RTC_DRV_BQ32K is not set ··· 1446 1303 CONFIG_UIO=y 1447 1304 # CONFIG_UIO_PDRV is not set 1448 1305 CONFIG_UIO_PDRV_GENIRQ=y 1449 - # CONFIG_UIO_SMX is not set 1450 - # CONFIG_UIO_SERCOS3 is not set 1451 1306 1452 1307 # 1453 1308 # TI VLYNQ ··· 1531 1390 # CONFIG_EFS_FS is not set 1532 1391 # CONFIG_JFFS2_FS is not set 1533 1392 # CONFIG_UBIFS_FS is not set 1393 + # CONFIG_LOGFS is not set 1534 1394 # CONFIG_CRAMFS is not set 1535 1395 # CONFIG_SQUASHFS is not set 1536 1396 # CONFIG_VXFS_FS is not set ··· 1560 1418 # CONFIG_RPCSEC_GSS_KRB5 is not set 1561 1419 # CONFIG_RPCSEC_GSS_SPKM3 is not set 1562 1420 # CONFIG_SMB_FS is not set 1421 + # CONFIG_CEPH_FS is not set 1563 1422 # CONFIG_CIFS is not set 1564 1423 # CONFIG_NCP_FS is not set 1565 1424 # CONFIG_CODA_FS is not set ··· 1630 1487 CONFIG_DEBUG_BUGVERBOSE=y 1631 1488 # CONFIG_DEBUG_MEMORY_INIT is not set 1632 1489 # CONFIG_RCU_CPU_STALL_DETECTOR is not set 1490 + # CONFIG_LKDTM is not set 1633 1491 # CONFIG_LATENCYTOP is not set 1634 1492 CONFIG_SYSCTL_SYSCALL_CHECK=y 1635 1493 CONFIG_HAVE_FUNCTION_TRACER=y ··· 1762 1618 # 1763 1619 CONFIG_BITREVERSE=y 1764 1620 CONFIG_GENERIC_FIND_LAST_BIT=y 1765 - # CONFIG_CRC_CCITT is not set 1621 + CONFIG_CRC_CCITT=y 1766 1622 # CONFIG_CRC16 is not set 1767 1623 CONFIG_CRC_T10DIF=y 1768 1624 CONFIG_CRC_ITU_T=y
+4 -2
arch/sh/include/asm/elf.h
··· 211 211 212 212 #define VSYSCALL_AUX_ENT \ 213 213 if (vdso_enabled) \ 214 - NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); 214 + NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ 215 + else \ 216 + NEW_AUX_ENT(AT_IGNORE, 0); 215 217 #else 216 218 #define VSYSCALL_AUX_ENT 217 219 #endif /* CONFIG_VSYSCALL */ ··· 221 219 #ifdef CONFIG_SH_FPU 222 220 #define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT) 223 221 #else 224 - #define FPU_AUX_ENT 222 + #define FPU_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0) 225 223 #endif 226 224 227 225 extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
+2
arch/sh/include/cpu-sh4/cpu/mmu_context.h
··· 30 30 #define MMUCR_URB 0x00FC0000 31 31 #define MMUCR_URB_SHIFT 18 32 32 #define MMUCR_URB_NENTRIES 64 33 + #define MMUCR_URC 0x0000FC00 34 + #define MMUCR_URC_SHIFT 10 33 35 34 36 #if defined(CONFIG_32BIT) && defined(CONFIG_CPU_SUBTYPE_ST40) 35 37 #define MMUCR_SE (1 << 4)
+2 -2
arch/sh/kernel/cpufreq.c
··· 48 48 return -ENODEV; 49 49 50 50 cpus_allowed = current->cpus_allowed; 51 - set_cpus_allowed(current, cpumask_of_cpu(cpu)); 51 + set_cpus_allowed_ptr(current, cpumask_of(cpu)); 52 52 53 53 BUG_ON(smp_processor_id() != cpu); 54 54 ··· 66 66 freqs.flags = 0; 67 67 68 68 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 69 - set_cpus_allowed(current, cpus_allowed); 69 + set_cpus_allowed_ptr(current, &cpus_allowed); 70 70 clk_set_rate(cpuclk, freq); 71 71 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 72 72
+3
arch/sh/kernel/return_address.c
··· 9 9 * for more details. 10 10 */ 11 11 #include <linux/kernel.h> 12 + #include <linux/module.h> 12 13 #include <asm/dwarf.h> 13 14 14 15 #ifdef CONFIG_DWARF_UNWINDER ··· 53 52 } 54 53 55 54 #endif 55 + 56 + EXPORT_SYMBOL_GPL(return_address);
+1
arch/sh/kernel/smp.c
··· 69 69 unsigned int cpu; 70 70 struct mm_struct *mm = &init_mm; 71 71 72 + enable_mmu(); 72 73 atomic_inc(&mm->mm_count); 73 74 atomic_inc(&mm->mm_users); 74 75 current->active_mm = mm;
+28
arch/sh/mm/tlb-pteaex.c
··· 77 77 __raw_writel(asid, MMU_ITLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT); 78 78 back_to_cached(); 79 79 } 80 + 81 + void local_flush_tlb_all(void) 82 + { 83 + unsigned long flags, status; 84 + int i; 85 + 86 + /* 87 + * Flush all the TLB. 88 + */ 89 + local_irq_save(flags); 90 + jump_to_uncached(); 91 + 92 + status = __raw_readl(MMUCR); 93 + status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT); 94 + 95 + if (status == 0) 96 + status = MMUCR_URB_NENTRIES; 97 + 98 + for (i = 0; i < status; i++) 99 + __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8)); 100 + 101 + for (i = 0; i < 4; i++) 102 + __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8)); 103 + 104 + back_to_cached(); 105 + ctrl_barrier(); 106 + local_irq_restore(flags); 107 + }
+19
arch/sh/mm/tlb-sh3.c
··· 77 77 for (i = 0; i < ways; i++) 78 78 __raw_writel(data, addr + (i << 8)); 79 79 } 80 + 81 + void local_flush_tlb_all(void) 82 + { 83 + unsigned long flags, status; 84 + 85 + /* 86 + * Flush all the TLB. 87 + * 88 + * Write to the MMU control register's bit: 89 + * TF-bit for SH-3, TI-bit for SH-4. 90 + * It's same position, bit #2. 91 + */ 92 + local_irq_save(flags); 93 + status = __raw_readl(MMUCR); 94 + status |= 0x04; 95 + __raw_writel(status, MMUCR); 96 + ctrl_barrier(); 97 + local_irq_restore(flags); 98 + }
+28
arch/sh/mm/tlb-sh4.c
··· 80 80 __raw_writel(data, addr); 81 81 back_to_cached(); 82 82 } 83 + 84 + void local_flush_tlb_all(void) 85 + { 86 + unsigned long flags, status; 87 + int i; 88 + 89 + /* 90 + * Flush all the TLB. 91 + */ 92 + local_irq_save(flags); 93 + jump_to_uncached(); 94 + 95 + status = __raw_readl(MMUCR); 96 + status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT); 97 + 98 + if (status == 0) 99 + status = MMUCR_URB_NENTRIES; 100 + 101 + for (i = 0; i < status; i++) 102 + __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8)); 103 + 104 + for (i = 0; i < 4; i++) 105 + __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8)); 106 + 107 + back_to_cached(); 108 + ctrl_barrier(); 109 + local_irq_restore(flags); 110 + }
+17 -5
arch/sh/mm/tlb-urb.c
··· 24 24 25 25 local_irq_save(flags); 26 26 27 - /* Load the entry into the TLB */ 28 - __update_tlb(vma, addr, pte); 29 - 30 - /* ... and wire it up. */ 31 27 status = __raw_readl(MMUCR); 32 28 urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; 33 - status &= ~MMUCR_URB; 29 + status &= ~MMUCR_URC; 34 30 35 31 /* 36 32 * Make sure we're not trying to wire the last TLB entry slot. ··· 35 39 36 40 urb = urb % MMUCR_URB_NENTRIES; 37 41 42 + /* 43 + * Insert this entry into the highest non-wired TLB slot (via 44 + * the URC field). 45 + */ 46 + status |= (urb << MMUCR_URC_SHIFT); 47 + __raw_writel(status, MMUCR); 48 + ctrl_barrier(); 49 + 50 + /* Load the entry into the TLB */ 51 + __update_tlb(vma, addr, pte); 52 + 53 + /* ... and wire it up. */ 54 + status = __raw_readl(MMUCR); 55 + 56 + status &= ~MMUCR_URB; 38 57 status |= (urb << MMUCR_URB_SHIFT); 58 + 39 59 __raw_writel(status, MMUCR); 40 60 ctrl_barrier(); 41 61
-28
arch/sh/mm/tlbflush_32.c
··· 119 119 local_irq_restore(flags); 120 120 } 121 121 } 122 - 123 - void local_flush_tlb_all(void) 124 - { 125 - unsigned long flags, status; 126 - int i; 127 - 128 - /* 129 - * Flush all the TLB. 130 - */ 131 - local_irq_save(flags); 132 - jump_to_uncached(); 133 - 134 - status = __raw_readl(MMUCR); 135 - status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT); 136 - 137 - if (status == 0) 138 - status = MMUCR_URB_NENTRIES; 139 - 140 - for (i = 0; i < status; i++) 141 - __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8)); 142 - 143 - for (i = 0; i < 4; i++) 144 - __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8)); 145 - 146 - back_to_cached(); 147 - ctrl_barrier(); 148 - local_irq_restore(flags); 149 - }
+16 -12
arch/sparc/configs/sparc64_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.33 4 - # Wed Mar 3 02:54:29 2010 3 + # Linux kernel version: 2.6.34-rc3 4 + # Sat Apr 3 15:49:56 2010 5 5 # 6 6 CONFIG_64BIT=y 7 7 CONFIG_SPARC=y ··· 23 23 CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 24 24 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 25 25 CONFIG_MMU=y 26 + CONFIG_NEED_DMA_MAP_STATE=y 26 27 CONFIG_ARCH_NO_VIRT_TO_BUS=y 27 28 CONFIG_OF=y 28 29 CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y ··· 440 439 # CONFIG_ENCLOSURE_SERVICES is not set 441 440 # CONFIG_HP_ILO is not set 442 441 # CONFIG_ISL29003 is not set 442 + # CONFIG_SENSORS_TSL2550 is not set 443 443 # CONFIG_DS1682 is not set 444 444 # CONFIG_C2PORT is not set 445 445 ··· 513 511 # 514 512 # SCSI device support 515 513 # 514 + CONFIG_SCSI_MOD=y 516 515 CONFIG_RAID_ATTRS=m 517 516 CONFIG_SCSI=y 518 517 CONFIG_SCSI_DMA=y ··· 891 888 CONFIG_SERIAL_CORE=y 892 889 CONFIG_SERIAL_CORE_CONSOLE=y 893 890 # CONFIG_SERIAL_JSM is not set 891 + # CONFIG_SERIAL_TIMBERDALE is not set 894 892 # CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set 895 893 CONFIG_UNIX98_PTYS=y 896 894 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set ··· 939 935 # 940 936 # CONFIG_I2C_OCORES is not set 941 937 # CONFIG_I2C_SIMTEC is not set 938 + # CONFIG_I2C_XILINX is not set 942 939 943 940 # 944 941 # External I2C/SMBus adapter drivers ··· 953 948 # 954 949 # CONFIG_I2C_PCA_PLATFORM is not set 955 950 # CONFIG_I2C_STUB is not set 956 - 957 - # 958 - # Miscellaneous I2C Chip support 959 - # 960 - # CONFIG_SENSORS_TSL2550 is not set 961 951 # CONFIG_I2C_DEBUG_CORE is not set 962 952 # CONFIG_I2C_DEBUG_ALGO is not set 963 953 # CONFIG_I2C_DEBUG_BUS is not set 964 - # CONFIG_I2C_DEBUG_CHIP is not set 965 954 # CONFIG_SPI is not set 966 955 967 956 # ··· 981 982 # CONFIG_SENSORS_ADM1029 is not set 982 983 # CONFIG_SENSORS_ADM1031 is not set 983 984 # CONFIG_SENSORS_ADM9240 is not set 985 + # CONFIG_SENSORS_ADT7411 is not set 984 986 # CONFIG_SENSORS_ADT7462 is not set 985 987 # CONFIG_SENSORS_ADT7470 is not set 986 - # CONFIG_SENSORS_ADT7473 is not set 987 988 # CONFIG_SENSORS_ADT7475 is not set 989 + # CONFIG_SENSORS_ASC7621 is not set 988 990 # CONFIG_SENSORS_ATXP1 is not set 989 991 # CONFIG_SENSORS_DS1621 is not set 990 992 # CONFIG_SENSORS_I5K_AMB is not set ··· 1052 1052 # Multifunction device drivers 1053 1053 # 1054 1054 # CONFIG_MFD_CORE is not set 1055 + # CONFIG_MFD_88PM860X is not set 1055 1056 # CONFIG_MFD_SM501 is not set 1056 1057 # CONFIG_HTC_PASIC3 is not set 1057 1058 # CONFIG_TWL4030_CORE is not set 1058 1059 # CONFIG_MFD_TMIO is not set 1059 1060 # CONFIG_PMIC_DA903X is not set 1060 1061 # CONFIG_PMIC_ADP5520 is not set 1062 + # CONFIG_MFD_MAX8925 is not set 1061 1063 # CONFIG_MFD_WM8400 is not set 1062 1064 # CONFIG_MFD_WM831X is not set 1063 1065 # CONFIG_MFD_WM8350_I2C is not set 1066 + # CONFIG_MFD_WM8994 is not set 1064 1067 # CONFIG_MFD_PCF50633 is not set 1065 1068 # CONFIG_AB3100_CORE is not set 1066 - # CONFIG_MFD_88PM8607 is not set 1069 + # CONFIG_LPC_SCH is not set 1067 1070 # CONFIG_REGULATOR is not set 1068 1071 # CONFIG_MEDIA_SUPPORT is not set 1069 1072 ··· 1116 1113 # CONFIG_FB_LEO is not set 1117 1114 CONFIG_FB_XVR500=y 1118 1115 CONFIG_FB_XVR2500=y 1116 + CONFIG_FB_XVR1000=y 1119 1117 # CONFIG_FB_S1D13XXX is not set 1120 1118 # CONFIG_FB_NVIDIA is not set 1121 1119 # CONFIG_FB_RIVA is not set ··· 1434 1430 # CONFIG_USB_RIO500 is not set 1435 1431 # CONFIG_USB_LEGOTOWER is not set 1436 1432 # CONFIG_USB_LCD is not set 1437 - # CONFIG_USB_BERRY_CHARGE is not set 1438 1433 # CONFIG_USB_LED is not set 1439 1434 # CONFIG_USB_CYPRESS_CY7C63 is not set 1440 1435 # CONFIG_USB_CYTHERM is not set ··· 1446 1443 # CONFIG_USB_IOWARRIOR is not set 1447 1444 # CONFIG_USB_TEST is not set 1448 1445 # CONFIG_USB_ISIGHTFW is not set 1449 - # CONFIG_USB_VST is not set 1450 1446 # CONFIG_USB_GADGET is not set 1451 1447 1452 1448 # ··· 1612 1610 # CONFIG_BEFS_FS is not set 1613 1611 # CONFIG_BFS_FS is not set 1614 1612 # CONFIG_EFS_FS is not set 1613 + # CONFIG_LOGFS is not set 1615 1614 # CONFIG_CRAMFS is not set 1616 1615 # CONFIG_SQUASHFS is not set 1617 1616 # CONFIG_VXFS_FS is not set ··· 1627 1624 # CONFIG_NFS_FS is not set 1628 1625 # CONFIG_NFSD is not set 1629 1626 # CONFIG_SMB_FS is not set 1627 + # CONFIG_CEPH_FS is not set 1630 1628 # CONFIG_CIFS is not set 1631 1629 # CONFIG_NCP_FS is not set 1632 1630 # CONFIG_CODA_FS is not set
+75
arch/sparc/kernel/helpers.S
··· 46 46 nop 47 47 .size stack_trace_flush,.-stack_trace_flush 48 48 49 + #ifdef CONFIG_PERF_EVENTS 50 + .globl perf_arch_fetch_caller_regs 51 + .type perf_arch_fetch_caller_regs,#function 52 + perf_arch_fetch_caller_regs: 53 + /* We always read the %pstate into %o5 since we will use 54 + * that to construct a fake %tstate to store into the regs. 55 + */ 56 + rdpr %pstate, %o5 57 + brz,pn %o2, 50f 58 + mov %o2, %g7 59 + 60 + /* Turn off interrupts while we walk around the register 61 + * window by hand. 62 + */ 63 + wrpr %o5, PSTATE_IE, %pstate 64 + 65 + /* The %canrestore tells us how many register windows are 66 + * still live in the chip above us, past that we have to 67 + * walk the frame as saved on the stack. We stash away 68 + * the %cwp in %g1 so we can return back to the original 69 + * register window. 70 + */ 71 + rdpr %cwp, %g1 72 + rdpr %canrestore, %g2 73 + sub %g1, 1, %g3 74 + 75 + /* We have the skip count in %g7, if it hits zero then 76 + * %fp/%i7 are the registers we need. Otherwise if our 77 + * %canrestore count maintained in %g2 hits zero we have 78 + * to start traversing the stack. 79 + */ 80 + 10: brz,pn %g2, 4f 81 + sub %g2, 1, %g2 82 + wrpr %g3, %cwp 83 + subcc %g7, 1, %g7 84 + bne,pt %xcc, 10b 85 + sub %g3, 1, %g3 86 + 87 + /* We found the values we need in the cpu's register 88 + * windows. 89 + */ 90 + mov %fp, %g3 91 + ba,pt %xcc, 3f 92 + mov %i7, %g2 93 + 94 + 50: mov %fp, %g3 95 + ba,pt %xcc, 2f 96 + mov %i7, %g2 97 + 98 + /* We hit the end of the valid register windows in the 99 + * cpu, start traversing the stack frame. 100 + */ 101 + 4: mov %fp, %g3 102 + 103 + 20: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2 104 + subcc %g7, 1, %g7 105 + bne,pn %xcc, 20b 106 + ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3 107 + 108 + /* Restore the current register window position and 109 + * re-enable interrupts. 110 + */ 111 + 3: wrpr %g1, %cwp 112 + wrpr %o5, %pstate 113 + 114 + 2: stx %g3, [%o0 + PT_V9_FP] 115 + sllx %o5, 8, %o5 116 + stx %o5, [%o0 + PT_V9_TSTATE] 117 + stx %g2, [%o0 + PT_V9_TPC] 118 + add %g2, 4, %g2 119 + retl 120 + stx %g2, [%o0 + PT_V9_TNPC] 121 + .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs 122 + #endif /* CONFIG_PERF_EVENTS */ 123 + 49 124 #ifdef CONFIG_SMP 50 125 .globl hard_smp_processor_id 51 126 .type hard_smp_processor_id,#function
+4
arch/sparc/kernel/ptrace_32.c
··· 65 65 *k++ = regs->u_regs[pos++]; 66 66 67 67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 68 + reg_window -= 16; 68 69 for (; count > 0 && pos < 32; count--) { 69 70 if (get_user(*k++, &reg_window[pos++])) 70 71 return -EFAULT; ··· 77 76 } 78 77 79 78 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 79 + reg_window -= 16; 80 80 for (; count > 0 && pos < 32; count--) { 81 81 if (get_user(reg, &reg_window[pos++]) || 82 82 put_user(reg, u++)) ··· 143 141 regs->u_regs[pos++] = *k++; 144 142 145 143 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 144 + reg_window -= 16; 146 145 for (; count > 0 && pos < 32; count--) { 147 146 if (put_user(*k++, &reg_window[pos++])) 148 147 return -EFAULT; ··· 156 153 } 157 154 158 155 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 156 + reg_window -= 16; 159 157 for (; count > 0 && pos < 32; count--) { 160 158 if (get_user(reg, u++) || 161 159 put_user(reg, &reg_window[pos++]))
+4
arch/sparc/kernel/ptrace_64.c
··· 492 492 *k++ = regs->u_regs[pos++]; 493 493 494 494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 495 + reg_window -= 16; 495 496 if (target == current) { 496 497 for (; count > 0 && pos < 32; count--) { 497 498 if (get_user(*k++, &reg_window[pos++])) ··· 517 516 } 518 517 519 518 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 519 + reg_window -= 16; 520 520 if (target == current) { 521 521 for (; count > 0 && pos < 32; count--) { 522 522 if (get_user(reg, &reg_window[pos++]) || ··· 601 599 regs->u_regs[pos++] = *k++; 602 600 603 601 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 602 + reg_window -= 16; 604 603 if (target == current) { 605 604 for (; count > 0 && pos < 32; count--) { 606 605 if (put_user(*k++, &reg_window[pos++])) ··· 628 625 } 629 626 630 627 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 628 + reg_window -= 16; 631 629 if (target == current) { 632 630 for (; count > 0 && pos < 32; count--) { 633 631 if (get_user(reg, u++) ||
+1 -1
arch/sparc/mm/init_64.c
··· 2117 2117 "node=%d entry=%lu/%lu\n", start, block, nr, 2118 2118 node, 2119 2119 addr >> VMEMMAP_CHUNK_SHIFT, 2120 - VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT); 2120 + VMEMMAP_SIZE); 2121 2121 } 2122 2122 } 2123 2123 return 0;
+44 -10
arch/x86/kernel/cpu/perf_event.c
··· 29 29 #include <asm/apic.h> 30 30 #include <asm/stacktrace.h> 31 31 #include <asm/nmi.h> 32 + #include <asm/compat.h> 32 33 33 34 static u64 perf_event_mask __read_mostly; 34 35 ··· 160 159 struct perf_event *event); 161 160 struct event_constraint *event_constraints; 162 161 163 - void (*cpu_prepare)(int cpu); 162 + int (*cpu_prepare)(int cpu); 164 163 void (*cpu_starting)(int cpu); 165 164 void (*cpu_dying)(int cpu); 166 165 void (*cpu_dead)(int cpu); ··· 1335 1334 x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1336 1335 { 1337 1336 unsigned int cpu = (long)hcpu; 1337 + int ret = NOTIFY_OK; 1338 1338 1339 1339 switch (action & ~CPU_TASKS_FROZEN) { 1340 1340 case CPU_UP_PREPARE: 1341 1341 if (x86_pmu.cpu_prepare) 1342 - x86_pmu.cpu_prepare(cpu); 1342 + ret = x86_pmu.cpu_prepare(cpu); 1343 1343 break; 1344 1344 1345 1345 case CPU_STARTING: ··· 1353 1351 x86_pmu.cpu_dying(cpu); 1354 1352 break; 1355 1353 1354 + case CPU_UP_CANCELED: 1356 1355 case CPU_DEAD: 1357 1356 if (x86_pmu.cpu_dead) 1358 1357 x86_pmu.cpu_dead(cpu); ··· 1363 1360 break; 1364 1361 } 1365 1362 1366 - return NOTIFY_OK; 1363 + return ret; 1367 1364 } 1368 1365 1369 1366 static void __init pmu_check_apic(void) ··· 1632 1629 return len; 1633 1630 } 1634 1631 1635 - static int copy_stack_frame(const void __user *fp, struct stack_frame *frame) 1632 + #ifdef CONFIG_COMPAT 1633 + static inline int 1634 + perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) 1636 1635 { 1637 - unsigned long bytes; 1636 + /* 32-bit process in 64-bit kernel. */ 1637 + struct stack_frame_ia32 frame; 1638 + const void __user *fp; 1638 1639 1639 - bytes = copy_from_user_nmi(frame, fp, sizeof(*frame)); 1640 + if (!test_thread_flag(TIF_IA32)) 1641 + return 0; 1640 1642 1641 - return bytes == sizeof(*frame); 1643 + fp = compat_ptr(regs->bp); 1644 + while (entry->nr < PERF_MAX_STACK_DEPTH) { 1645 + unsigned long bytes; 1646 + frame.next_frame = 0; 1647 + frame.return_address = 0; 1648 + 1649 + bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); 1650 + if (bytes != sizeof(frame)) 1651 + break; 1652 + 1653 + if (fp < compat_ptr(regs->sp)) 1654 + break; 1655 + 1656 + callchain_store(entry, frame.return_address); 1657 + fp = compat_ptr(frame.next_frame); 1658 + } 1659 + return 1; 1642 1660 } 1661 + #else 1662 + static inline int 1663 + perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) 1664 + { 1665 + return 0; 1666 + } 1667 + #endif 1643 1668 1644 1669 static void 1645 1670 perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry) ··· 1683 1652 callchain_store(entry, PERF_CONTEXT_USER); 1684 1653 callchain_store(entry, regs->ip); 1685 1654 1655 + if (perf_callchain_user32(regs, entry)) 1656 + return; 1657 + 1686 1658 while (entry->nr < PERF_MAX_STACK_DEPTH) { 1659 + unsigned long bytes; 1687 1660 frame.next_frame = NULL; 1688 1661 frame.return_address = 0; 1689 1662 1690 - if (!copy_stack_frame(fp, &frame)) 1663 + bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); 1664 + if (bytes != sizeof(frame)) 1691 1665 break; 1692 1666 1693 1667 if ((unsigned long)fp < regs->sp) ··· 1739 1703 return entry; 1740 1704 } 1741 1705 1742 - #ifdef CONFIG_EVENT_TRACING 1743 1706 void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip) 1744 1707 { 1745 1708 regs->ip = ip; ··· 1750 1715 regs->cs = __KERNEL_CS; 1751 1716 local_save_flags(regs->flags); 1752 1717 } 1753 - #endif
+47 -33
arch/x86/kernel/cpu/perf_event_amd.c
··· 137 137 return (hwc->config & 0xe0) == 0xe0; 138 138 } 139 139 140 + static inline int amd_has_nb(struct cpu_hw_events *cpuc) 141 + { 142 + struct amd_nb *nb = cpuc->amd_nb; 143 + 144 + return nb && nb->nb_id != -1; 145 + } 146 + 140 147 static void amd_put_event_constraints(struct cpu_hw_events *cpuc, 141 148 struct perf_event *event) 142 149 { ··· 154 147 /* 155 148 * only care about NB events 156 149 */ 157 - if (!(nb && amd_is_nb_event(hwc))) 150 + if (!(amd_has_nb(cpuc) && amd_is_nb_event(hwc))) 158 151 return; 159 152 160 153 /* ··· 221 214 /* 222 215 * if not NB event or no NB, then no constraints 223 216 */ 224 - if (!(nb && amd_is_nb_event(hwc))) 217 + if (!(amd_has_nb(cpuc) && amd_is_nb_event(hwc))) 225 218 return &unconstrained; 226 219 227 220 /* ··· 300 293 return nb; 301 294 } 302 295 303 - static void amd_pmu_cpu_online(int cpu) 296 + static int amd_pmu_cpu_prepare(int cpu) 304 297 { 305 - struct cpu_hw_events *cpu1, *cpu2; 306 - struct amd_nb *nb = NULL; 298 + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); 299 + 300 + WARN_ON_ONCE(cpuc->amd_nb); 301 + 302 + if (boot_cpu_data.x86_max_cores < 2) 303 + return NOTIFY_OK; 304 + 305 + cpuc->amd_nb = amd_alloc_nb(cpu, -1); 306 + if (!cpuc->amd_nb) 307 + return NOTIFY_BAD; 308 + 309 + return NOTIFY_OK; 310 + } 311 + 312 + static void amd_pmu_cpu_starting(int cpu) 313 + { 314 + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); 315 + struct amd_nb *nb; 307 316 int i, nb_id; 308 317 309 318 if (boot_cpu_data.x86_max_cores < 2) 310 319 return; 311 320 312 - /* 313 - * function may be called too early in the 314 - * boot process, in which case nb_id is bogus 315 - */ 316 321 nb_id = amd_get_nb_id(cpu); 317 - if (nb_id == BAD_APICID) 318 - return; 319 - 320 - cpu1 = &per_cpu(cpu_hw_events, cpu); 321 - cpu1->amd_nb = NULL; 322 + WARN_ON_ONCE(nb_id == BAD_APICID); 322 323 323 324 raw_spin_lock(&amd_nb_lock); 324 325 325 326 for_each_online_cpu(i) { 326 - cpu2 = &per_cpu(cpu_hw_events, i); 327 - nb = cpu2->amd_nb; 328 - if (!nb) 327 + nb = per_cpu(cpu_hw_events, i).amd_nb; 328 + if (WARN_ON_ONCE(!nb)) 329 329 continue; 330 - if (nb->nb_id == nb_id) 331 - goto found; 330 + 331 + if (nb->nb_id == nb_id) { 332 + kfree(cpuc->amd_nb); 333 + cpuc->amd_nb = nb; 334 + break; 335 + } 332 336 } 333 337 334 - nb = amd_alloc_nb(cpu, nb_id); 335 - if (!nb) { 336 - pr_err("perf_events: failed NB allocation for CPU%d\n", cpu); 337 - raw_spin_unlock(&amd_nb_lock); 338 - return; 339 - } 340 - found: 341 - nb->refcnt++; 342 - cpu1->amd_nb = nb; 338 + cpuc->amd_nb->nb_id = nb_id; 339 + cpuc->amd_nb->refcnt++; 343 340 344 341 raw_spin_unlock(&amd_nb_lock); 345 342 } 346 343 347 - static void amd_pmu_cpu_offline(int cpu) 344 + static void amd_pmu_cpu_dead(int cpu) 348 345 { 349 346 struct cpu_hw_events *cpuhw; 350 347 ··· 360 349 raw_spin_lock(&amd_nb_lock); 361 350 362 351 if (cpuhw->amd_nb) { 363 - if (--cpuhw->amd_nb->refcnt == 0) 364 - kfree(cpuhw->amd_nb); 352 + struct amd_nb *nb = cpuhw->amd_nb; 353 + 354 + if (nb->nb_id == -1 || --nb->refcnt == 0) 355 + kfree(nb); 365 356 366 357 cpuhw->amd_nb = NULL; 367 358 } ··· 392 379 .get_event_constraints = amd_get_event_constraints, 393 380 .put_event_constraints = amd_put_event_constraints, 394 381 395 - .cpu_prepare = amd_pmu_cpu_online, 396 - .cpu_dead = amd_pmu_cpu_offline, 382 + .cpu_prepare = amd_pmu_cpu_prepare, 383 + .cpu_starting = amd_pmu_cpu_starting, 384 + .cpu_dead = amd_pmu_cpu_dead, 397 385 }; 398 386 399 387 static __init int amd_pmu_init(void)
+5
arch/x86/kernel/dumpstack.h
··· 30 30 unsigned long return_address; 31 31 }; 32 32 33 + struct stack_frame_ia32 { 34 + u32 next_frame; 35 + u32 return_address; 36 + }; 37 + 33 38 static inline unsigned long rewind_frame_pointer(int n) 34 39 { 35 40 struct stack_frame *frame;
+3 -1
arch/x86/kernel/head32.c
··· 7 7 8 8 #include <linux/init.h> 9 9 #include <linux/start_kernel.h> 10 + #include <linux/mm.h> 10 11 11 12 #include <asm/setup.h> 12 13 #include <asm/sections.h> ··· 45 44 #ifdef CONFIG_BLK_DEV_INITRD 46 45 /* Reserve INITRD */ 47 46 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 47 + /* Assume only end is not page aligned */ 48 48 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 49 49 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 50 - u64 ramdisk_end = ramdisk_image + ramdisk_size; 50 + u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); 51 51 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 52 52 } 53 53 #endif
+2 -1
arch/x86/kernel/head64.c
··· 103 103 #ifdef CONFIG_BLK_DEV_INITRD 104 104 /* Reserve INITRD */ 105 105 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 106 + /* Assume only end is not page aligned */ 106 107 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; 107 108 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; 108 - unsigned long ramdisk_end = ramdisk_image + ramdisk_size; 109 + unsigned long ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); 109 110 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 110 111 } 111 112 #endif
+1 -1
arch/x86/kernel/kgdb.c
··· 618 618 * portion of kgdb because this operation requires mutexs to 619 619 * complete. 620 620 */ 621 + hw_breakpoint_init(&attr); 621 622 attr.bp_addr = (unsigned long)kgdb_arch_init; 622 - attr.type = PERF_TYPE_BREAKPOINT; 623 623 attr.bp_len = HW_BREAKPOINT_LEN_1; 624 624 attr.bp_type = HW_BREAKPOINT_W; 625 625 attr.disabled = 1;
+6 -4
arch/x86/kernel/setup.c
··· 313 313 #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) 314 314 static void __init relocate_initrd(void) 315 315 { 316 - 316 + /* Assume only end is not page aligned */ 317 317 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 318 318 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 319 + u64 area_size = PAGE_ALIGN(ramdisk_size); 319 320 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; 320 321 u64 ramdisk_here; 321 322 unsigned long slop, clen, mapaddr; 322 323 char *p, *q; 323 324 324 325 /* We need to move the initrd down into lowmem */ 325 - ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size, 326 + ramdisk_here = find_e820_area(0, end_of_lowmem, area_size, 326 327 PAGE_SIZE); 327 328 328 329 if (ramdisk_here == -1ULL) ··· 332 331 333 332 /* Note: this includes all the lowmem currently occupied by 334 333 the initrd, we rely on that fact to keep the data intact. */ 335 - reserve_early(ramdisk_here, ramdisk_here + ramdisk_size, 334 + reserve_early(ramdisk_here, ramdisk_here + area_size, 336 335 "NEW RAMDISK"); 337 336 initrd_start = ramdisk_here + PAGE_OFFSET; 338 337 initrd_end = initrd_start + ramdisk_size; ··· 376 375 377 376 static void __init reserve_initrd(void) 378 377 { 378 + /* Assume only end is not page aligned */ 379 379 u64 ramdisk_image = boot_params.hdr.ramdisk_image; 380 380 u64 ramdisk_size = boot_params.hdr.ramdisk_size; 381 - u64 ramdisk_end = ramdisk_image + ramdisk_size; 381 + u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); 382 382 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; 383 383 384 384 if (!boot_params.hdr.type_of_loader ||
+2 -2
arch/x86/kernel/smpboot.c
··· 243 243 end_local_APIC_setup(); 244 244 map_cpu_to_logical_apicid(); 245 245 246 - notify_cpu_starting(cpuid); 247 - 248 246 /* 249 247 * Need to setup vector mappings before we enable interrupts. 250 248 */ ··· 262 264 * Save our processor parameters 263 265 */ 264 266 smp_store_cpu_info(cpuid); 267 + 268 + notify_cpu_starting(cpuid); 265 269 266 270 /* 267 271 * Allow the master to continue.
+1 -1
arch/x86/kernel/vmlinux.lds.S
··· 291 291 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 292 292 __smp_locks = .; 293 293 *(.smp_locks) 294 - __smp_locks_end = .; 295 294 . = ALIGN(PAGE_SIZE); 295 + __smp_locks_end = .; 296 296 } 297 297 298 298 #ifdef CONFIG_X86_64
+26 -6
arch/x86/mm/init.c
··· 332 332 333 333 void free_init_pages(char *what, unsigned long begin, unsigned long end) 334 334 { 335 - unsigned long addr = begin; 335 + unsigned long addr; 336 + unsigned long begin_aligned, end_aligned; 336 337 337 - if (addr >= end) 338 + /* Make sure boundaries are page aligned */ 339 + begin_aligned = PAGE_ALIGN(begin); 340 + end_aligned = end & PAGE_MASK; 341 + 342 + if (WARN_ON(begin_aligned != begin || end_aligned != end)) { 343 + begin = begin_aligned; 344 + end = end_aligned; 345 + } 346 + 347 + if (begin >= end) 338 348 return; 349 + 350 + addr = begin; 339 351 340 352 /* 341 353 * If debugging page accesses then do not free this memory but ··· 356 344 */ 357 345 #ifdef CONFIG_DEBUG_PAGEALLOC 358 346 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n", 359 - begin, PAGE_ALIGN(end)); 347 + begin, end); 360 348 set_memory_np(begin, (end - begin) >> PAGE_SHIFT); 361 349 #else 362 350 /* ··· 371 359 for (; addr < end; addr += PAGE_SIZE) { 372 360 ClearPageReserved(virt_to_page(addr)); 373 361 init_page_count(virt_to_page(addr)); 374 - memset((void *)(addr & ~(PAGE_SIZE-1)), 375 - POISON_FREE_INITMEM, PAGE_SIZE); 362 + memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 376 363 free_page(addr); 377 364 totalram_pages++; 378 365 } ··· 388 377 #ifdef CONFIG_BLK_DEV_INITRD 389 378 void free_initrd_mem(unsigned long start, unsigned long end) 390 379 { 391 - free_init_pages("initrd memory", start, end); 380 + /* 381 + * end could be not aligned, and We can not align that, 382 + * decompresser could be confused by aligned initrd_end 383 + * We already reserve the end partial page before in 384 + * - i386_start_kernel() 385 + * - x86_64_start_kernel() 386 + * - relocate_initrd() 387 + * So here We can do PAGE_ALIGN() safely to get partial page to be freed 388 + */ 389 + free_init_pages("initrd memory", start, PAGE_ALIGN(end)); 392 390 } 393 391 #endif
+2
drivers/char/tty_io.c
··· 1423 1423 list_del_init(&tty->tty_files); 1424 1424 file_list_unlock(); 1425 1425 1426 + put_pid(tty->pgrp); 1427 + put_pid(tty->session); 1426 1428 free_tty_struct(tty); 1427 1429 } 1428 1430
+1
drivers/gpu/drm/drm_crtc_helper.c
··· 104 104 if (connector->status == connector_status_disconnected) { 105 105 DRM_DEBUG_KMS("%s is disconnected\n", 106 106 drm_get_connector_name(connector)); 107 + drm_mode_connector_update_edid_property(connector, NULL); 107 108 goto prune; 108 109 } 109 110
-9
drivers/gpu/drm/drm_edid.c
··· 708 708 mode->vsync_end = mode->vsync_start + vsync_pulse_width; 709 709 mode->vtotal = mode->vdisplay + vblank; 710 710 711 - /* perform the basic check for the detailed timing */ 712 - if (mode->hsync_end > mode->htotal || 713 - mode->vsync_end > mode->vtotal) { 714 - drm_mode_destroy(dev, mode); 715 - DRM_DEBUG_KMS("Incorrect detailed timing. " 716 - "Sync is beyond the blank.\n"); 717 - return NULL; 718 - } 719 - 720 711 /* Some EDIDs have bogus h/vtotal values */ 721 712 if (mode->hsync_end > mode->htotal) 722 713 mode->htotal = mode->hsync_end + 1;
+2
drivers/gpu/drm/drm_fb_helper.c
··· 284 284 .help_msg = "force-fb(V)", 285 285 .action_msg = "Restore framebuffer console", 286 286 }; 287 + #else 288 + static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { }; 287 289 #endif 288 290 289 291 static void drm_fb_helper_on(struct fb_info *info)
+9 -7
drivers/gpu/drm/drm_fops.c
··· 141 141 spin_unlock(&dev->count_lock); 142 142 } 143 143 out: 144 - mutex_lock(&dev->struct_mutex); 145 - if (minor->type == DRM_MINOR_LEGACY) { 146 - BUG_ON((dev->dev_mapping != NULL) && 147 - (dev->dev_mapping != inode->i_mapping)); 148 - if (dev->dev_mapping == NULL) 149 - dev->dev_mapping = inode->i_mapping; 144 + if (!retcode) { 145 + mutex_lock(&dev->struct_mutex); 146 + if (minor->type == DRM_MINOR_LEGACY) { 147 + if (dev->dev_mapping == NULL) 148 + dev->dev_mapping = inode->i_mapping; 149 + else if (dev->dev_mapping != inode->i_mapping) 150 + retcode = -ENODEV; 151 + } 152 + mutex_unlock(&dev->struct_mutex); 150 153 } 151 - mutex_unlock(&dev->struct_mutex); 152 154 153 155 return retcode; 154 156 }
+1 -1
drivers/gpu/drm/nouveau/Makefile
··· 12 12 nouveau_dp.o nouveau_grctx.o \ 13 13 nv04_timer.o \ 14 14 nv04_mc.o nv40_mc.o nv50_mc.o \ 15 - nv04_fb.o nv10_fb.o nv40_fb.o \ 15 + nv04_fb.o nv10_fb.o nv40_fb.o nv50_fb.o \ 16 16 nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ 17 17 nv04_graph.o nv10_graph.o nv20_graph.o \ 18 18 nv40_graph.o nv50_graph.o \
+26 -2
drivers/gpu/drm/nouveau/nouveau_bios.c
··· 5211 5211 } 5212 5212 5213 5213 static void 5214 + apply_dcb_connector_quirks(struct nvbios *bios, int idx) 5215 + { 5216 + struct dcb_connector_table_entry *cte = &bios->dcb.connector.entry[idx]; 5217 + struct drm_device *dev = bios->dev; 5218 + 5219 + /* Gigabyte NX85T */ 5220 + if ((dev->pdev->device == 0x0421) && 5221 + (dev->pdev->subsystem_vendor == 0x1458) && 5222 + (dev->pdev->subsystem_device == 0x344c)) { 5223 + if (cte->type == DCB_CONNECTOR_HDMI_1) 5224 + cte->type = DCB_CONNECTOR_DVI_I; 5225 + } 5226 + } 5227 + 5228 + static void 5214 5229 parse_dcb_connector_table(struct nvbios *bios) 5215 5230 { 5216 5231 struct drm_device *dev = bios->dev; ··· 5253 5238 entry = conntab + conntab[1]; 5254 5239 cte = &ct->entry[0]; 5255 5240 for (i = 0; i < conntab[2]; i++, entry += conntab[3], cte++) { 5241 + cte->index = i; 5256 5242 if (conntab[3] == 2) 5257 5243 cte->entry = ROM16(entry[0]); 5258 5244 else 5259 5245 cte->entry = ROM32(entry[0]); 5260 5246 5261 5247 cte->type = (cte->entry & 0x000000ff) >> 0; 5262 - cte->index = (cte->entry & 0x00000f00) >> 8; 5248 + cte->index2 = (cte->entry & 0x00000f00) >> 8; 5263 5249 switch (cte->entry & 0x00033000) { 5264 5250 case 0x00001000: 5265 5251 cte->gpio_tag = 0x07; ··· 5281 5265 5282 5266 if (cte->type == 0xff) 5283 5267 continue; 5268 + 5269 + apply_dcb_connector_quirks(bios, i); 5284 5270 5285 5271 NV_INFO(dev, " %d: 0x%08x: type 0x%02x idx %d tag 0x%02x\n", 5286 5272 i, cte->entry, cte->type, cte->index, cte->gpio_tag); ··· 5305 5287 break; 5306 5288 default: 5307 5289 cte->type = divine_connector_type(bios, cte->index); 5308 - NV_WARN(dev, "unknown type, using 0x%02x", cte->type); 5290 + NV_WARN(dev, "unknown type, using 0x%02x\n", cte->type); 5309 5291 break; 5292 + } 5293 + 5294 + if (nouveau_override_conntype) { 5295 + int type = divine_connector_type(bios, cte->index); 5296 + if (type != cte->type) 5297 + NV_WARN(dev, " -> type 0x%02x\n", cte->type); 5310 5298 } 5311 5299 5312 5300 }
+2 -1
drivers/gpu/drm/nouveau/nouveau_bios.h
··· 72 72 }; 73 73 74 74 struct dcb_connector_table_entry { 75 + uint8_t index; 75 76 uint32_t entry; 76 77 enum dcb_connector_type type; 77 - uint8_t index; 78 + uint8_t index2; 78 79 uint8_t gpio_tag; 79 80 }; 80 81
+1 -2
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 440 440 441 441 switch (bo->mem.mem_type) { 442 442 case TTM_PL_VRAM: 443 - nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_TT | 444 - TTM_PL_FLAG_SYSTEM); 443 + nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_TT); 445 444 break; 446 445 default: 447 446 nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_SYSTEM);
+1 -1
drivers/gpu/drm/nouveau/nouveau_connector.c
··· 302 302 303 303 detect_analog: 304 304 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); 305 - if (!nv_encoder) 305 + if (!nv_encoder && !nouveau_tv_disable) 306 306 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); 307 307 if (nv_encoder) { 308 308 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
+5
drivers/gpu/drm/nouveau/nouveau_dma.c
··· 190 190 nouveau_bo_wr32(pb, ip++, upper_32_bits(offset) | length << 8); 191 191 192 192 chan->dma.ib_put = (chan->dma.ib_put + 1) & chan->dma.ib_max; 193 + 194 + DRM_MEMORYBARRIER(); 195 + /* Flush writes. */ 196 + nouveau_bo_rd32(pb, 0); 197 + 193 198 nvchan_wr32(chan, 0x8c, chan->dma.ib_put); 194 199 chan->dma.ib_free--; 195 200 }
+10
drivers/gpu/drm/nouveau/nouveau_drv.c
··· 83 83 int nouveau_nofbaccel = 0; 84 84 module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400); 85 85 86 + MODULE_PARM_DESC(override_conntype, "Ignore DCB connector type"); 87 + int nouveau_override_conntype = 0; 88 + module_param_named(override_conntype, nouveau_override_conntype, int, 0400); 89 + 90 + MODULE_PARM_DESC(tv_disable, "Disable TV-out detection\n"); 91 + int nouveau_tv_disable = 0; 92 + module_param_named(tv_disable, nouveau_tv_disable, int, 0400); 93 + 86 94 MODULE_PARM_DESC(tv_norm, "Default TV norm.\n" 87 95 "\t\tSupported: PAL, PAL-M, PAL-N, PAL-Nc, NTSC-M, NTSC-J,\n" 88 96 "\t\t\thd480i, hd480p, hd576i, hd576p, hd720p, hd1080i.\n" ··· 162 154 if (pm_state.event == PM_EVENT_PRETHAW) 163 155 return 0; 164 156 157 + NV_INFO(dev, "Disabling fbcon acceleration...\n"); 165 158 fbdev_flags = dev_priv->fbdev_info->flags; 166 159 dev_priv->fbdev_info->flags |= FBINFO_HWACCEL_DISABLED; 167 160 161 + NV_INFO(dev, "Unpinning framebuffer(s)...\n"); 168 162 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 169 163 struct nouveau_framebuffer *nouveau_fb; 170 164
+6
drivers/gpu/drm/nouveau/nouveau_drv.h
··· 681 681 extern int nouveau_vram_pushbuf; 682 682 extern int nouveau_vram_notify; 683 683 extern int nouveau_fbpercrtc; 684 + extern int nouveau_tv_disable; 684 685 extern char *nouveau_tv_norm; 685 686 extern int nouveau_reg_debug; 686 687 extern char *nouveau_vbios; ··· 689 688 extern int nouveau_ignorelid; 690 689 extern int nouveau_nofbaccel; 691 690 extern int nouveau_noaccel; 691 + extern int nouveau_override_conntype; 692 692 693 693 extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); 694 694 extern int nouveau_pci_resume(struct pci_dev *pdev); ··· 927 925 extern void nv40_fb_takedown(struct drm_device *); 928 926 extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, 929 927 uint32_t, uint32_t); 928 + 929 + /* nv50_fb.c */ 930 + extern int nv50_fb_init(struct drm_device *); 931 + extern void nv50_fb_takedown(struct drm_device *); 930 932 931 933 /* nv04_fifo.c */ 932 934 extern int nv04_fifo_init(struct drm_device *);
+561 -48
drivers/gpu/drm/nouveau/nouveau_irq.c
··· 311 311 #define nouveau_print_bitfield_names(val, namelist) \ 312 312 nouveau_print_bitfield_names_((val), (namelist), ARRAY_SIZE(namelist)) 313 313 314 + struct nouveau_enum_names { 315 + uint32_t value; 316 + const char *name; 317 + }; 318 + 319 + static void 320 + nouveau_print_enum_names_(uint32_t value, 321 + const struct nouveau_enum_names *namelist, 322 + const int namelist_len) 323 + { 324 + /* 325 + * Caller must have already printed the KERN_* log level for us. 326 + * Also the caller is responsible for adding the newline. 327 + */ 328 + int i; 329 + for (i = 0; i < namelist_len; ++i) { 330 + if (value == namelist[i].value) { 331 + printk("%s", namelist[i].name); 332 + return; 333 + } 334 + } 335 + printk("unknown value 0x%08x", value); 336 + } 337 + #define nouveau_print_enum_names(val, namelist) \ 338 + nouveau_print_enum_names_((val), (namelist), ARRAY_SIZE(namelist)) 314 339 315 340 static int 316 341 nouveau_graph_chid_from_grctx(struct drm_device *dev) ··· 452 427 struct drm_nouveau_private *dev_priv = dev->dev_private; 453 428 uint32_t nsource = trap->nsource, nstatus = trap->nstatus; 454 429 455 - NV_INFO(dev, "%s - nSource:", id); 456 - nouveau_print_bitfield_names(nsource, nsource_names); 457 - printk(", nStatus:"); 458 - if (dev_priv->card_type < NV_10) 459 - nouveau_print_bitfield_names(nstatus, nstatus_names); 460 - else 461 - nouveau_print_bitfield_names(nstatus, nstatus_names_nv10); 462 - printk("\n"); 430 + if (dev_priv->card_type < NV_50) { 431 + NV_INFO(dev, "%s - nSource:", id); 432 + nouveau_print_bitfield_names(nsource, nsource_names); 433 + printk(", nStatus:"); 434 + if (dev_priv->card_type < NV_10) 435 + nouveau_print_bitfield_names(nstatus, nstatus_names); 436 + else 437 + nouveau_print_bitfield_names(nstatus, nstatus_names_nv10); 438 + printk("\n"); 439 + } 463 440 464 441 NV_INFO(dev, "%s - Ch %d/%d Class 0x%04x Mthd 0x%04x " 465 442 "Data 0x%08x:0x%08x\n", ··· 605 578 } 606 579 607 580 static void 581 + nv50_pfb_vm_trap(struct drm_device *dev, int display, const char *name) 582 + { 583 + struct drm_nouveau_private *dev_priv = dev->dev_private; 584 + uint32_t trap[6]; 585 + int i, ch; 586 + uint32_t idx = nv_rd32(dev, 0x100c90); 587 + if (idx & 0x80000000) { 588 + idx &= 0xffffff; 589 + if (display) { 590 + for (i = 0; i < 6; i++) { 591 + nv_wr32(dev, 0x100c90, idx | i << 24); 592 + trap[i] = nv_rd32(dev, 0x100c94); 593 + } 594 + for (ch = 0; ch < dev_priv->engine.fifo.channels; ch++) { 595 + struct nouveau_channel *chan = dev_priv->fifos[ch]; 596 + 597 + if (!chan || !chan->ramin) 598 + continue; 599 + 600 + if (trap[1] == chan->ramin->instance >> 12) 601 + break; 602 + } 603 + NV_INFO(dev, "%s - VM: Trapped %s at %02x%04x%04x status %08x %08x channel %d\n", 604 + name, (trap[5]&0x100?"read":"write"), 605 + trap[5]&0xff, trap[4]&0xffff, 606 + trap[3]&0xffff, trap[0], trap[2], ch); 607 + } 608 + nv_wr32(dev, 0x100c90, idx | 0x80000000); 609 + } else if (display) { 610 + NV_INFO(dev, "%s - no VM fault?\n", name); 611 + } 612 + } 613 + 614 + static struct nouveau_enum_names nv50_mp_exec_error_names[] = 615 + { 616 + { 3, "STACK_UNDERFLOW" }, 617 + { 4, "QUADON_ACTIVE" }, 618 + { 8, "TIMEOUT" }, 619 + { 0x10, "INVALID_OPCODE" }, 620 + { 0x40, "BREAKPOINT" }, 621 + }; 622 + 623 + static void 624 + nv50_pgraph_mp_trap(struct drm_device *dev, int tpid, int display) 625 + { 626 + struct drm_nouveau_private *dev_priv = dev->dev_private; 627 + uint32_t units = nv_rd32(dev, 0x1540); 628 + uint32_t addr, mp10, status, pc, oplow, ophigh; 629 + int i; 630 + int mps = 0; 631 + for (i = 0; i < 4; i++) { 632 + if (!(units & 1 << (i+24))) 633 + continue; 634 + if (dev_priv->chipset < 0xa0) 635 + addr = 0x408200 + (tpid << 12) + (i << 7); 636 + else 637 + addr = 0x408100 + (tpid << 11) + (i << 7); 638 + mp10 = nv_rd32(dev, addr + 0x10); 639 + status = nv_rd32(dev, addr + 0x14); 640 + if (!status) 641 + continue; 642 + if (display) { 643 + nv_rd32(dev, addr + 0x20); 644 + pc = nv_rd32(dev, addr + 0x24); 645 + oplow = nv_rd32(dev, addr + 0x70); 646 + ophigh= nv_rd32(dev, addr + 0x74); 647 + NV_INFO(dev, "PGRAPH_TRAP_MP_EXEC - " 648 + "TP %d MP %d: ", tpid, i); 649 + nouveau_print_enum_names(status, 650 + nv50_mp_exec_error_names); 651 + printk(" at %06x warp %d, opcode %08x %08x\n", 652 + pc&0xffffff, pc >> 24, 653 + oplow, ophigh); 654 + } 655 + nv_wr32(dev, addr + 0x10, mp10); 656 + nv_wr32(dev, addr + 0x14, 0); 657 + mps++; 658 + } 659 + if (!mps && display) 660 + NV_INFO(dev, "PGRAPH_TRAP_MP_EXEC - TP %d: " 661 + "No MPs claiming errors?\n", tpid); 662 + } 663 + 664 + static void 665 + nv50_pgraph_tp_trap(struct drm_device *dev, int type, uint32_t ustatus_old, 666 + uint32_t ustatus_new, int display, const char *name) 667 + { 668 + struct drm_nouveau_private *dev_priv = dev->dev_private; 669 + int tps = 0; 670 + uint32_t units = nv_rd32(dev, 0x1540); 671 + int i, r; 672 + uint32_t ustatus_addr, ustatus; 673 + for (i = 0; i < 16; i++) { 674 + if (!(units & (1 << i))) 675 + continue; 676 + if (dev_priv->chipset < 0xa0) 677 + ustatus_addr = ustatus_old + (i << 12); 678 + else 679 + ustatus_addr = ustatus_new + (i << 11); 680 + ustatus = nv_rd32(dev, ustatus_addr) & 0x7fffffff; 681 + if (!ustatus) 682 + continue; 683 + tps++; 684 + switch (type) { 685 + case 6: /* texture error... unknown for now */ 686 + nv50_pfb_vm_trap(dev, display, name); 687 + if (display) { 688 + NV_ERROR(dev, "magic set %d:\n", i); 689 + for (r = ustatus_addr + 4; r <= ustatus_addr + 0x10; r += 4) 690 + NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, 691 + nv_rd32(dev, r)); 692 + } 693 + break; 694 + case 7: /* MP error */ 695 + if (ustatus & 0x00010000) { 696 + nv50_pgraph_mp_trap(dev, i, display); 697 + ustatus &= ~0x00010000; 698 + } 699 + break; 700 + case 8: /* TPDMA error */ 701 + { 702 + uint32_t e0c = nv_rd32(dev, ustatus_addr + 4); 703 + uint32_t e10 = nv_rd32(dev, ustatus_addr + 8); 704 + uint32_t e14 = nv_rd32(dev, ustatus_addr + 0xc); 705 + uint32_t e18 = nv_rd32(dev, ustatus_addr + 0x10); 706 + uint32_t e1c = nv_rd32(dev, ustatus_addr + 0x14); 707 + uint32_t e20 = nv_rd32(dev, ustatus_addr + 0x18); 708 + uint32_t e24 = nv_rd32(dev, ustatus_addr + 0x1c); 709 + nv50_pfb_vm_trap(dev, display, name); 710 + /* 2d engine destination */ 711 + if (ustatus & 0x00000010) { 712 + if (display) { 713 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA_2D - TP %d - Unknown fault at address %02x%08x\n", 714 + i, e14, e10); 715 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA_2D - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n", 716 + i, e0c, e18, e1c, e20, e24); 717 + } 718 + ustatus &= ~0x00000010; 719 + } 720 + /* Render target */ 721 + if (ustatus & 0x00000040) { 722 + if (display) { 723 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA_RT - TP %d - Unknown fault at address %02x%08x\n", 724 + i, e14, e10); 725 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA_RT - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n", 726 + i, e0c, e18, e1c, e20, e24); 727 + } 728 + ustatus &= ~0x00000040; 729 + } 730 + /* CUDA memory: l[], g[] or stack. */ 731 + if (ustatus & 0x00000080) { 732 + if (display) { 733 + if (e18 & 0x80000000) { 734 + /* g[] read fault? */ 735 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Global read fault at address %02x%08x\n", 736 + i, e14, e10 | ((e18 >> 24) & 0x1f)); 737 + e18 &= ~0x1f000000; 738 + } else if (e18 & 0xc) { 739 + /* g[] write fault? */ 740 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Global write fault at address %02x%08x\n", 741 + i, e14, e10 | ((e18 >> 7) & 0x1f)); 742 + e18 &= ~0x00000f80; 743 + } else { 744 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Unknown CUDA fault at address %02x%08x\n", 745 + i, e14, e10); 746 + } 747 + NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n", 748 + i, e0c, e18, e1c, e20, e24); 749 + } 750 + ustatus &= ~0x00000080; 751 + } 752 + } 753 + break; 754 + } 755 + if (ustatus) { 756 + if (display) 757 + NV_INFO(dev, "%s - TP%d: Unhandled ustatus 0x%08x\n", name, i, ustatus); 758 + } 759 + nv_wr32(dev, ustatus_addr, 0xc0000000); 760 + } 761 + 762 + if (!tps && display) 763 + NV_INFO(dev, "%s - No TPs claiming errors?\n", name); 764 + } 765 + 766 + static void 767 + nv50_pgraph_trap_handler(struct drm_device *dev) 768 + { 769 + struct nouveau_pgraph_trap trap; 770 + uint32_t status = nv_rd32(dev, 0x400108); 771 + uint32_t ustatus; 772 + int display = nouveau_ratelimit(); 773 + 774 + 775 + if (!status && display) { 776 + nouveau_graph_trap_info(dev, &trap); 777 + nouveau_graph_dump_trap_info(dev, "PGRAPH_TRAP", &trap); 778 + NV_INFO(dev, "PGRAPH_TRAP - no units reporting traps?\n"); 779 + } 780 + 781 + /* DISPATCH: Relays commands to other units and handles NOTIFY, 782 + * COND, QUERY. If you get a trap from it, the command is still stuck 783 + * in DISPATCH and you need to do something about it. */ 784 + if (status & 0x001) { 785 + ustatus = nv_rd32(dev, 0x400804) & 0x7fffffff; 786 + if (!ustatus && display) { 787 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH - no ustatus?\n"); 788 + } 789 + 790 + /* Known to be triggered by screwed up NOTIFY and COND... */ 791 + if (ustatus & 0x00000001) { 792 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_FAULT"); 793 + nv_wr32(dev, 0x400500, 0); 794 + if (nv_rd32(dev, 0x400808) & 0x80000000) { 795 + if (display) { 796 + if (nouveau_graph_trapped_channel(dev, &trap.channel)) 797 + trap.channel = -1; 798 + trap.class = nv_rd32(dev, 0x400814); 799 + trap.mthd = nv_rd32(dev, 0x400808) & 0x1ffc; 800 + trap.subc = (nv_rd32(dev, 0x400808) >> 16) & 0x7; 801 + trap.data = nv_rd32(dev, 0x40080c); 802 + trap.data2 = nv_rd32(dev, 0x400810); 803 + nouveau_graph_dump_trap_info(dev, 804 + "PGRAPH_TRAP_DISPATCH_FAULT", &trap); 805 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - 400808: %08x\n", nv_rd32(dev, 0x400808)); 806 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - 400848: %08x\n", nv_rd32(dev, 0x400848)); 807 + } 808 + nv_wr32(dev, 0x400808, 0); 809 + } else if (display) { 810 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - No stuck command?\n"); 811 + } 812 + nv_wr32(dev, 0x4008e8, nv_rd32(dev, 0x4008e8) & 3); 813 + nv_wr32(dev, 0x400848, 0); 814 + ustatus &= ~0x00000001; 815 + } 816 + if (ustatus & 0x00000002) { 817 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_QUERY"); 818 + nv_wr32(dev, 0x400500, 0); 819 + if (nv_rd32(dev, 0x40084c) & 0x80000000) { 820 + if (display) { 821 + if (nouveau_graph_trapped_channel(dev, &trap.channel)) 822 + trap.channel = -1; 823 + trap.class = nv_rd32(dev, 0x400814); 824 + trap.mthd = nv_rd32(dev, 0x40084c) & 0x1ffc; 825 + trap.subc = (nv_rd32(dev, 0x40084c) >> 16) & 0x7; 826 + trap.data = nv_rd32(dev, 0x40085c); 827 + trap.data2 = 0; 828 + nouveau_graph_dump_trap_info(dev, 829 + "PGRAPH_TRAP_DISPATCH_QUERY", &trap); 830 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_QUERY - 40084c: %08x\n", nv_rd32(dev, 0x40084c)); 831 + } 832 + nv_wr32(dev, 0x40084c, 0); 833 + } else if (display) { 834 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_QUERY - No stuck command?\n"); 835 + } 836 + ustatus &= ~0x00000002; 837 + } 838 + if (ustatus && display) 839 + NV_INFO(dev, "PGRAPH_TRAP_DISPATCH - Unhandled ustatus 0x%08x\n", ustatus); 840 + nv_wr32(dev, 0x400804, 0xc0000000); 841 + nv_wr32(dev, 0x400108, 0x001); 842 + status &= ~0x001; 843 + } 844 + 845 + /* TRAPs other than dispatch use the "normal" trap regs. */ 846 + if (status && display) { 847 + nouveau_graph_trap_info(dev, &trap); 848 + nouveau_graph_dump_trap_info(dev, 849 + "PGRAPH_TRAP", &trap); 850 + } 851 + 852 + /* M2MF: Memory to memory copy engine. */ 853 + if (status & 0x002) { 854 + ustatus = nv_rd32(dev, 0x406800) & 0x7fffffff; 855 + if (!ustatus && display) { 856 + NV_INFO(dev, "PGRAPH_TRAP_M2MF - no ustatus?\n"); 857 + } 858 + if (ustatus & 0x00000001) { 859 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_NOTIFY"); 860 + ustatus &= ~0x00000001; 861 + } 862 + if (ustatus & 0x00000002) { 863 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_IN"); 864 + ustatus &= ~0x00000002; 865 + } 866 + if (ustatus & 0x00000004) { 867 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_OUT"); 868 + ustatus &= ~0x00000004; 869 + } 870 + NV_INFO (dev, "PGRAPH_TRAP_M2MF - %08x %08x %08x %08x\n", 871 + nv_rd32(dev, 0x406804), 872 + nv_rd32(dev, 0x406808), 873 + nv_rd32(dev, 0x40680c), 874 + nv_rd32(dev, 0x406810)); 875 + if (ustatus && display) 876 + NV_INFO(dev, "PGRAPH_TRAP_M2MF - Unhandled ustatus 0x%08x\n", ustatus); 877 + /* No sane way found yet -- just reset the bugger. */ 878 + nv_wr32(dev, 0x400040, 2); 879 + nv_wr32(dev, 0x400040, 0); 880 + nv_wr32(dev, 0x406800, 0xc0000000); 881 + nv_wr32(dev, 0x400108, 0x002); 882 + status &= ~0x002; 883 + } 884 + 885 + /* VFETCH: Fetches data from vertex buffers. */ 886 + if (status & 0x004) { 887 + ustatus = nv_rd32(dev, 0x400c04) & 0x7fffffff; 888 + if (!ustatus && display) { 889 + NV_INFO(dev, "PGRAPH_TRAP_VFETCH - no ustatus?\n"); 890 + } 891 + if (ustatus & 0x00000001) { 892 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_VFETCH_FAULT"); 893 + NV_INFO (dev, "PGRAPH_TRAP_VFETCH_FAULT - %08x %08x %08x %08x\n", 894 + nv_rd32(dev, 0x400c00), 895 + nv_rd32(dev, 0x400c08), 896 + nv_rd32(dev, 0x400c0c), 897 + nv_rd32(dev, 0x400c10)); 898 + ustatus &= ~0x00000001; 899 + } 900 + if (ustatus && display) 901 + NV_INFO(dev, "PGRAPH_TRAP_VFETCH - Unhandled ustatus 0x%08x\n", ustatus); 902 + nv_wr32(dev, 0x400c04, 0xc0000000); 903 + nv_wr32(dev, 0x400108, 0x004); 904 + status &= ~0x004; 905 + } 906 + 907 + /* STRMOUT: DirectX streamout / OpenGL transform feedback. */ 908 + if (status & 0x008) { 909 + ustatus = nv_rd32(dev, 0x401800) & 0x7fffffff; 910 + if (!ustatus && display) { 911 + NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - no ustatus?\n"); 912 + } 913 + if (ustatus & 0x00000001) { 914 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_STRMOUT_FAULT"); 915 + NV_INFO (dev, "PGRAPH_TRAP_STRMOUT_FAULT - %08x %08x %08x %08x\n", 916 + nv_rd32(dev, 0x401804), 917 + nv_rd32(dev, 0x401808), 918 + nv_rd32(dev, 0x40180c), 919 + nv_rd32(dev, 0x401810)); 920 + ustatus &= ~0x00000001; 921 + } 922 + if (ustatus && display) 923 + NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - Unhandled ustatus 0x%08x\n", ustatus); 924 + /* No sane way found yet -- just reset the bugger. */ 925 + nv_wr32(dev, 0x400040, 0x80); 926 + nv_wr32(dev, 0x400040, 0); 927 + nv_wr32(dev, 0x401800, 0xc0000000); 928 + nv_wr32(dev, 0x400108, 0x008); 929 + status &= ~0x008; 930 + } 931 + 932 + /* CCACHE: Handles code and c[] caches and fills them. */ 933 + if (status & 0x010) { 934 + ustatus = nv_rd32(dev, 0x405018) & 0x7fffffff; 935 + if (!ustatus && display) { 936 + NV_INFO(dev, "PGRAPH_TRAP_CCACHE - no ustatus?\n"); 937 + } 938 + if (ustatus & 0x00000001) { 939 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_CCACHE_FAULT"); 940 + NV_INFO (dev, "PGRAPH_TRAP_CCACHE_FAULT - %08x %08x %08x %08x %08x %08x %08x\n", 941 + nv_rd32(dev, 0x405800), 942 + nv_rd32(dev, 0x405804), 943 + nv_rd32(dev, 0x405808), 944 + nv_rd32(dev, 0x40580c), 945 + nv_rd32(dev, 0x405810), 946 + nv_rd32(dev, 0x405814), 947 + nv_rd32(dev, 0x40581c)); 948 + ustatus &= ~0x00000001; 949 + } 950 + if (ustatus && display) 951 + NV_INFO(dev, "PGRAPH_TRAP_CCACHE - Unhandled ustatus 0x%08x\n", ustatus); 952 + nv_wr32(dev, 0x405018, 0xc0000000); 953 + nv_wr32(dev, 0x400108, 0x010); 954 + status &= ~0x010; 955 + } 956 + 957 + /* Unknown, not seen yet... 0x402000 is the only trap status reg 958 + * remaining, so try to handle it anyway. Perhaps related to that 959 + * unknown DMA slot on tesla? */ 960 + if (status & 0x20) { 961 + nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_UNKC04"); 962 + ustatus = nv_rd32(dev, 0x402000) & 0x7fffffff; 963 + if (display) 964 + NV_INFO(dev, "PGRAPH_TRAP_UNKC04 - Unhandled ustatus 0x%08x\n", ustatus); 965 + nv_wr32(dev, 0x402000, 0xc0000000); 966 + /* no status modifiction on purpose */ 967 + } 968 + 969 + /* TEXTURE: CUDA texturing units */ 970 + if (status & 0x040) { 971 + nv50_pgraph_tp_trap (dev, 6, 0x408900, 0x408600, display, 972 + "PGRAPH_TRAP_TEXTURE"); 973 + nv_wr32(dev, 0x400108, 0x040); 974 + status &= ~0x040; 975 + } 976 + 977 + /* MP: CUDA execution engines. */ 978 + if (status & 0x080) { 979 + nv50_pgraph_tp_trap (dev, 7, 0x408314, 0x40831c, display, 980 + "PGRAPH_TRAP_MP"); 981 + nv_wr32(dev, 0x400108, 0x080); 982 + status &= ~0x080; 983 + } 984 + 985 + /* TPDMA: Handles TP-initiated uncached memory accesses: 986 + * l[], g[], stack, 2d surfaces, render targets. */ 987 + if (status & 0x100) { 988 + nv50_pgraph_tp_trap (dev, 8, 0x408e08, 0x408708, display, 989 + "PGRAPH_TRAP_TPDMA"); 990 + nv_wr32(dev, 0x400108, 0x100); 991 + status &= ~0x100; 992 + } 993 + 994 + if (status) { 995 + if (display) 996 + NV_INFO(dev, "PGRAPH_TRAP - Unknown trap 0x%08x\n", 997 + status); 998 + nv_wr32(dev, 0x400108, status); 999 + } 1000 + } 1001 + 1002 + /* There must be a *lot* of these. Will take some time to gather them up. */ 1003 + static struct nouveau_enum_names nv50_data_error_names[] = 1004 + { 1005 + { 4, "INVALID_VALUE" }, 1006 + { 5, "INVALID_ENUM" }, 1007 + { 8, "INVALID_OBJECT" }, 1008 + { 0xc, "INVALID_BITFIELD" }, 1009 + { 0x28, "MP_NO_REG_SPACE" }, 1010 + { 0x2b, "MP_BLOCK_SIZE_MISMATCH" }, 1011 + }; 1012 + 1013 + static void 608 1014 nv50_pgraph_irq_handler(struct drm_device *dev) 609 1015 { 1016 + struct nouveau_pgraph_trap trap; 1017 + int unhandled = 0; 610 1018 uint32_t status; 611 1019 612 1020 while ((status = nv_rd32(dev, NV03_PGRAPH_INTR))) { 613 - uint32_t nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE); 614 - 1021 + /* NOTIFY: You've set a NOTIFY an a command and it's done. */ 615 1022 if (status & 0x00000001) { 616 - nouveau_pgraph_intr_notify(dev, nsource); 1023 + nouveau_graph_trap_info(dev, &trap); 1024 + if (nouveau_ratelimit()) 1025 + nouveau_graph_dump_trap_info(dev, 1026 + "PGRAPH_NOTIFY", &trap); 617 1027 status &= ~0x00000001; 618 1028 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001); 619 1029 } 620 1030 621 - if (status & 0x00000010) { 622 - nouveau_pgraph_intr_error(dev, nsource | 623 - NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD); 1031 + /* COMPUTE_QUERY: Purpose and exact cause unknown, happens 1032 + * when you write 0x200 to 0x50c0 method 0x31c. */ 1033 + if (status & 0x00000002) { 1034 + nouveau_graph_trap_info(dev, &trap); 1035 + if (nouveau_ratelimit()) 1036 + nouveau_graph_dump_trap_info(dev, 1037 + "PGRAPH_COMPUTE_QUERY", &trap); 1038 + status &= ~0x00000002; 1039 + nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000002); 1040 + } 624 1041 1042 + /* Unknown, never seen: 0x4 */ 1043 + 1044 + /* ILLEGAL_MTHD: You used a wrong method for this class. */ 1045 + if (status & 0x00000010) { 1046 + nouveau_graph_trap_info(dev, &trap); 1047 + if (nouveau_pgraph_intr_swmthd(dev, &trap)) 1048 + unhandled = 1; 1049 + if (unhandled && nouveau_ratelimit()) 1050 + nouveau_graph_dump_trap_info(dev, 1051 + "PGRAPH_ILLEGAL_MTHD", &trap); 625 1052 status &= ~0x00000010; 626 1053 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010); 627 1054 } 628 1055 1056 + /* ILLEGAL_CLASS: You used a wrong class. */ 1057 + if (status & 0x00000020) { 1058 + nouveau_graph_trap_info(dev, &trap); 1059 + if (nouveau_ratelimit()) 1060 + nouveau_graph_dump_trap_info(dev, 1061 + "PGRAPH_ILLEGAL_CLASS", &trap); 1062 + status &= ~0x00000020; 1063 + nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000020); 1064 + } 1065 + 1066 + /* DOUBLE_NOTIFY: You tried to set a NOTIFY on another NOTIFY. */ 1067 + if (status & 0x00000040) { 1068 + nouveau_graph_trap_info(dev, &trap); 1069 + if (nouveau_ratelimit()) 1070 + nouveau_graph_dump_trap_info(dev, 1071 + "PGRAPH_DOUBLE_NOTIFY", &trap); 1072 + status &= ~0x00000040; 1073 + nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000040); 1074 + } 1075 + 1076 + /* CONTEXT_SWITCH: PGRAPH needs us to load a new context */ 629 1077 if (status & 0x00001000) { 630 1078 nv_wr32(dev, 0x400500, 0x00000000); 631 1079 nv_wr32(dev, NV03_PGRAPH_INTR, ··· 1115 613 status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH; 1116 614 } 1117 615 1118 - if (status & 0x00100000) { 1119 - nouveau_pgraph_intr_error(dev, nsource | 1120 - NV03_PGRAPH_NSOURCE_DATA_ERROR); 616 + /* BUFFER_NOTIFY: Your m2mf transfer finished */ 617 + if (status & 0x00010000) { 618 + nouveau_graph_trap_info(dev, &trap); 619 + if (nouveau_ratelimit()) 620 + nouveau_graph_dump_trap_info(dev, 621 + "PGRAPH_BUFFER_NOTIFY", &trap); 622 + status &= ~0x00010000; 623 + nv_wr32(dev, NV03_PGRAPH_INTR, 0x00010000); 624 + } 1121 625 626 + /* DATA_ERROR: Invalid value for this method, or invalid 627 + * state in current PGRAPH context for this operation */ 628 + if (status & 0x00100000) { 629 + nouveau_graph_trap_info(dev, &trap); 630 + if (nouveau_ratelimit()) { 631 + nouveau_graph_dump_trap_info(dev, 632 + "PGRAPH_DATA_ERROR", &trap); 633 + NV_INFO (dev, "PGRAPH_DATA_ERROR - "); 634 + nouveau_print_enum_names(nv_rd32(dev, 0x400110), 635 + nv50_data_error_names); 636 + printk("\n"); 637 + } 1122 638 status &= ~0x00100000; 1123 639 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000); 1124 640 } 1125 641 642 + /* TRAP: Something bad happened in the middle of command 643 + * execution. Has a billion types, subtypes, and even 644 + * subsubtypes. */ 1126 645 if (status & 0x00200000) { 1127 - int r; 1128 - 1129 - nouveau_pgraph_intr_error(dev, nsource | 1130 - NV03_PGRAPH_NSOURCE_PROTECTION_ERROR); 1131 - 1132 - NV_ERROR(dev, "magic set 1:\n"); 1133 - for (r = 0x408900; r <= 0x408910; r += 4) 1134 - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, 1135 - nv_rd32(dev, r)); 1136 - nv_wr32(dev, 0x408900, 1137 - nv_rd32(dev, 0x408904) | 0xc0000000); 1138 - for (r = 0x408e08; r <= 0x408e24; r += 4) 1139 - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, 1140 - nv_rd32(dev, r)); 1141 - nv_wr32(dev, 0x408e08, 1142 - nv_rd32(dev, 0x408e08) | 0xc0000000); 1143 - 1144 - NV_ERROR(dev, "magic set 2:\n"); 1145 - for (r = 0x409900; r <= 0x409910; r += 4) 1146 - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, 1147 - nv_rd32(dev, r)); 1148 - nv_wr32(dev, 0x409900, 1149 - nv_rd32(dev, 0x409904) | 0xc0000000); 1150 - for (r = 0x409e08; r <= 0x409e24; r += 4) 1151 - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, 1152 - nv_rd32(dev, r)); 1153 - nv_wr32(dev, 0x409e08, 1154 - nv_rd32(dev, 0x409e08) | 0xc0000000); 1155 - 646 + nv50_pgraph_trap_handler(dev); 1156 647 status &= ~0x00200000; 1157 - nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource); 1158 648 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000); 1159 649 } 650 + 651 + /* Unknown, never seen: 0x00400000 */ 652 + 653 + /* SINGLE_STEP: Happens on every method if you turned on 654 + * single stepping in 40008c */ 655 + if (status & 0x01000000) { 656 + nouveau_graph_trap_info(dev, &trap); 657 + if (nouveau_ratelimit()) 658 + nouveau_graph_dump_trap_info(dev, 659 + "PGRAPH_SINGLE_STEP", &trap); 660 + status &= ~0x01000000; 661 + nv_wr32(dev, NV03_PGRAPH_INTR, 0x01000000); 662 + } 663 + 664 + /* 0x02000000 happens when you pause a ctxprog... 665 + * but the only way this can happen that I know is by 666 + * poking the relevant MMIO register, and we don't 667 + * do that. */ 1160 668 1161 669 if (status) { 1162 670 NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n", ··· 1184 672 } 1185 673 1186 674 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); 1187 - nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31)); 675 + if (nv_rd32(dev, 0x400824) & (1 << 31)) 676 + nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31)); 1188 677 } 1189 678 1190 679 static void
+2 -3
drivers/gpu/drm/nouveau/nouveau_state.c
··· 36 36 #include "nouveau_drm.h" 37 37 #include "nv50_display.h" 38 38 39 - static int nouveau_stub_init(struct drm_device *dev) { return 0; } 40 39 static void nouveau_stub_takedown(struct drm_device *dev) {} 41 40 42 41 static int nouveau_init_engine_ptrs(struct drm_device *dev) ··· 277 278 engine->timer.init = nv04_timer_init; 278 279 engine->timer.read = nv04_timer_read; 279 280 engine->timer.takedown = nv04_timer_takedown; 280 - engine->fb.init = nouveau_stub_init; 281 - engine->fb.takedown = nouveau_stub_takedown; 281 + engine->fb.init = nv50_fb_init; 282 + engine->fb.takedown = nv50_fb_takedown; 282 283 engine->graph.grclass = nv50_graph_grclass; 283 284 engine->graph.init = nv50_graph_init; 284 285 engine->graph.takedown = nv50_graph_takedown;
+3 -3
drivers/gpu/drm/nouveau/nv04_crtc.c
··· 230 230 struct drm_framebuffer *fb = crtc->fb; 231 231 232 232 /* Calculate our timings */ 233 - int horizDisplay = (mode->crtc_hdisplay >> 3) - 1; 234 - int horizStart = (mode->crtc_hsync_start >> 3) - 1; 235 - int horizEnd = (mode->crtc_hsync_end >> 3) - 1; 233 + int horizDisplay = (mode->crtc_hdisplay >> 3) - 1; 234 + int horizStart = (mode->crtc_hsync_start >> 3) + 1; 235 + int horizEnd = (mode->crtc_hsync_end >> 3) + 1; 236 236 int horizTotal = (mode->crtc_htotal >> 3) - 5; 237 237 int horizBlankStart = (mode->crtc_hdisplay >> 3) - 1; 238 238 int horizBlankEnd = (mode->crtc_htotal >> 3) - 1;
+3 -3
drivers/gpu/drm/nouveau/nv04_fbcon.c
··· 118 118 return; 119 119 } 120 120 121 - width = ALIGN(image->width, 32); 122 - dsize = (width * image->height) >> 5; 121 + width = ALIGN(image->width, 8); 122 + dsize = ALIGN(width * image->height, 32) >> 5; 123 123 124 124 if (info->fix.visual == FB_VISUAL_TRUECOLOR || 125 125 info->fix.visual == FB_VISUAL_DIRECTCOLOR) { ··· 136 136 ((image->dx + image->width) & 0xffff)); 137 137 OUT_RING(chan, bg); 138 138 OUT_RING(chan, fg); 139 - OUT_RING(chan, (image->height << 16) | image->width); 140 139 OUT_RING(chan, (image->height << 16) | width); 140 + OUT_RING(chan, (image->height << 16) | image->width); 141 141 OUT_RING(chan, (image->dy << 16) | (image->dx & 0xffff)); 142 142 143 143 while (dsize) {
+2 -2
drivers/gpu/drm/nouveau/nv50_display.c
··· 522 522 } 523 523 524 524 for (i = 0 ; i < dcb->connector.entries; i++) { 525 - if (i != 0 && dcb->connector.entry[i].index == 526 - dcb->connector.entry[i - 1].index) 525 + if (i != 0 && dcb->connector.entry[i].index2 == 526 + dcb->connector.entry[i - 1].index2) 527 527 continue; 528 528 nouveau_connector_create(dev, &dcb->connector.entry[i]); 529 529 }
+32
drivers/gpu/drm/nouveau/nv50_fb.c
··· 1 + #include "drmP.h" 2 + #include "drm.h" 3 + #include "nouveau_drv.h" 4 + #include "nouveau_drm.h" 5 + 6 + int 7 + nv50_fb_init(struct drm_device *dev) 8 + { 9 + /* This is needed to get meaningful information from 100c90 10 + * on traps. No idea what these values mean exactly. */ 11 + struct drm_nouveau_private *dev_priv = dev->dev_private; 12 + 13 + switch (dev_priv->chipset) { 14 + case 0x50: 15 + nv_wr32(dev, 0x100c90, 0x0707ff); 16 + break; 17 + case 0xa5: 18 + case 0xa8: 19 + nv_wr32(dev, 0x100c90, 0x0d0fff); 20 + break; 21 + default: 22 + nv_wr32(dev, 0x100c90, 0x1d07ff); 23 + break; 24 + } 25 + 26 + return 0; 27 + } 28 + 29 + void 30 + nv50_fb_takedown(struct drm_device *dev) 31 + { 32 + }
+1 -1
drivers/gpu/drm/nouveau/nv50_fbcon.c
··· 233 233 BEGIN_RING(chan, NvSub2D, 0x0808, 3); 234 234 OUT_RING(chan, 0); 235 235 OUT_RING(chan, 0); 236 - OUT_RING(chan, 0); 236 + OUT_RING(chan, 1); 237 237 BEGIN_RING(chan, NvSub2D, 0x081c, 1); 238 238 OUT_RING(chan, 1); 239 239 BEGIN_RING(chan, NvSub2D, 0x0840, 4);
+18 -4
drivers/gpu/drm/nouveau/nv50_graph.c
··· 56 56 static void 57 57 nv50_graph_init_regs__nv(struct drm_device *dev) 58 58 { 59 + struct drm_nouveau_private *dev_priv = dev->dev_private; 60 + uint32_t units = nv_rd32(dev, 0x1540); 61 + int i; 62 + 59 63 NV_DEBUG(dev, "\n"); 60 64 61 65 nv_wr32(dev, 0x400804, 0xc0000000); ··· 68 64 nv_wr32(dev, 0x401800, 0xc0000000); 69 65 nv_wr32(dev, 0x405018, 0xc0000000); 70 66 nv_wr32(dev, 0x402000, 0xc0000000); 67 + 68 + for (i = 0; i < 16; i++) { 69 + if (units & 1 << i) { 70 + if (dev_priv->chipset < 0xa0) { 71 + nv_wr32(dev, 0x408900 + (i << 12), 0xc0000000); 72 + nv_wr32(dev, 0x408e08 + (i << 12), 0xc0000000); 73 + nv_wr32(dev, 0x408314 + (i << 12), 0xc0000000); 74 + } else { 75 + nv_wr32(dev, 0x408600 + (i << 11), 0xc0000000); 76 + nv_wr32(dev, 0x408708 + (i << 11), 0xc0000000); 77 + nv_wr32(dev, 0x40831c + (i << 11), 0xc0000000); 78 + } 79 + } 80 + } 71 81 72 82 nv_wr32(dev, 0x400108, 0xffffffff); 73 83 ··· 247 229 nouveau_grctx_vals_load(dev, ctx); 248 230 } 249 231 nv_wo32(dev, ctx, 0x00000/4, chan->ramin->instance >> 12); 250 - if ((dev_priv->chipset & 0xf0) == 0xa0) 251 - nv_wo32(dev, ctx, 0x00004/4, 0x00000000); 252 - else 253 - nv_wo32(dev, ctx, 0x0011c/4, 0x00000000); 254 232 dev_priv->engine.instmem.finish_access(dev); 255 233 256 234 return 0;
+9 -4
drivers/gpu/drm/nouveau/nv50_grctx.c
··· 64 64 #define CP_FLAG_ALWAYS ((2 * 32) + 13) 65 65 #define CP_FLAG_ALWAYS_FALSE 0 66 66 #define CP_FLAG_ALWAYS_TRUE 1 67 + #define CP_FLAG_INTR ((2 * 32) + 15) 68 + #define CP_FLAG_INTR_NOT_PENDING 0 69 + #define CP_FLAG_INTR_PENDING 1 67 70 68 71 #define CP_CTX 0x00100000 69 72 #define CP_CTX_COUNT 0x000f0000 ··· 217 214 cp_name(ctx, cp_setup_save); 218 215 cp_set (ctx, UNK1D, SET); 219 216 cp_wait(ctx, STATUS, BUSY); 217 + cp_wait(ctx, INTR, PENDING); 218 + cp_bra (ctx, STATUS, BUSY, cp_setup_save); 220 219 cp_set (ctx, UNK01, SET); 221 220 cp_set (ctx, SWAP_DIRECTION, SAVE); 222 221 ··· 274 269 int offset, base; 275 270 uint32_t units = nv_rd32 (ctx->dev, 0x1540); 276 271 277 - /* 0800 */ 272 + /* 0800: DISPATCH */ 278 273 cp_ctx(ctx, 0x400808, 7); 279 274 gr_def(ctx, 0x400814, 0x00000030); 280 275 cp_ctx(ctx, 0x400834, 0x32); ··· 305 300 gr_def(ctx, 0x400b20, 0x0001629d); 306 301 } 307 302 308 - /* 0C00 */ 303 + /* 0C00: VFETCH */ 309 304 cp_ctx(ctx, 0x400c08, 0x2); 310 305 gr_def(ctx, 0x400c08, 0x0000fe0c); 311 306 ··· 331 326 cp_ctx(ctx, 0x401540, 0x5); 332 327 gr_def(ctx, 0x401550, 0x00001018); 333 328 334 - /* 1800 */ 329 + /* 1800: STREAMOUT */ 335 330 cp_ctx(ctx, 0x401814, 0x1); 336 331 gr_def(ctx, 0x401814, 0x000000ff); 337 332 if (dev_priv->chipset == 0x50) { ··· 646 641 if (dev_priv->chipset == 0x50) 647 642 cp_ctx(ctx, 0x4063e0, 0x1); 648 643 649 - /* 6800 */ 644 + /* 6800: M2MF */ 650 645 if (dev_priv->chipset < 0x90) { 651 646 cp_ctx(ctx, 0x406814, 0x2b); 652 647 gr_def(ctx, 0x406818, 0x00000f80);
+1 -1
drivers/gpu/drm/radeon/Makefile
··· 50 50 radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ 51 51 radeon_irq.o r300_cmdbuf.o r600_cp.o 52 52 # add KMS driver 53 - radeon-y += radeon_device.o radeon_kms.o \ 53 + radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ 54 54 radeon_atombios.o radeon_agp.o atombios_crtc.o radeon_combios.o \ 55 55 atom.o radeon_fence.o radeon_ttm.o radeon_object.o radeon_gart.o \ 56 56 radeon_legacy_crtc.o radeon_legacy_encoders.o radeon_connectors.o \
+67 -24
drivers/gpu/drm/radeon/atom.c
··· 53 53 54 54 typedef struct { 55 55 struct atom_context *ctx; 56 - 57 56 uint32_t *ps, *ws; 58 57 int ps_shift; 59 58 uint16_t start; 59 + unsigned last_jump; 60 + unsigned long last_jump_jiffies; 61 + bool abort; 60 62 } atom_exec_context; 61 63 62 64 int atom_debug = 0; 63 - static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); 64 - void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); 65 + static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); 66 + int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); 65 67 66 68 static uint32_t atom_arg_mask[8] = 67 69 { 0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000, ··· 607 605 static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) 608 606 { 609 607 int idx = U8((*ptr)++); 608 + int r = 0; 609 + 610 610 if (idx < ATOM_TABLE_NAMES_CNT) 611 611 SDEBUG(" table: %d (%s)\n", idx, atom_table_names[idx]); 612 612 else 613 613 SDEBUG(" table: %d\n", idx); 614 614 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) 615 - atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); 615 + r = atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); 616 + if (r) { 617 + ctx->abort = true; 618 + } 616 619 } 617 620 618 621 static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) ··· 681 674 static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) 682 675 { 683 676 int execute = 0, target = U16(*ptr); 677 + unsigned long cjiffies; 678 + 684 679 (*ptr) += 2; 685 680 switch (arg) { 686 681 case ATOM_COND_ABOVE: ··· 710 701 if (arg != ATOM_COND_ALWAYS) 711 702 SDEBUG(" taken: %s\n", execute ? "yes" : "no"); 712 703 SDEBUG(" target: 0x%04X\n", target); 713 - if (execute) 704 + if (execute) { 705 + if (ctx->last_jump == (ctx->start + target)) { 706 + cjiffies = jiffies; 707 + if (time_after(cjiffies, ctx->last_jump_jiffies)) { 708 + cjiffies -= ctx->last_jump_jiffies; 709 + if ((jiffies_to_msecs(cjiffies) > 1000)) { 710 + DRM_ERROR("atombios stuck in loop for more than 1sec aborting\n"); 711 + ctx->abort = true; 712 + } 713 + } else { 714 + /* jiffies wrap around we will just wait a little longer */ 715 + ctx->last_jump_jiffies = jiffies; 716 + } 717 + } else { 718 + ctx->last_jump = ctx->start + target; 719 + ctx->last_jump_jiffies = jiffies; 720 + } 714 721 *ptr = ctx->start + target; 722 + } 715 723 } 716 724 717 725 static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) ··· 1131 1105 atom_op_shr, ATOM_ARG_MC}, { 1132 1106 atom_op_debug, 0},}; 1133 1107 1134 - static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) 1108 + static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) 1135 1109 { 1136 1110 int base = CU16(ctx->cmd_table + 4 + 2 * index); 1137 1111 int len, ws, ps, ptr; ··· 1139 1113 atom_exec_context ectx; 1140 1114 1141 1115 if (!base) 1142 - return; 1116 + return -EINVAL; 1143 1117 1144 1118 len = CU16(base + ATOM_CT_SIZE_PTR); 1145 1119 ws = CU8(base + ATOM_CT_WS_PTR); ··· 1152 1126 ectx.ps_shift = ps / 4; 1153 1127 ectx.start = base; 1154 1128 ectx.ps = params; 1129 + ectx.abort = false; 1130 + ectx.last_jump = 0; 1155 1131 if (ws) 1156 1132 ectx.ws = kzalloc(4 * ws, GFP_KERNEL); 1157 1133 else ··· 1166 1138 SDEBUG("%s @ 0x%04X\n", atom_op_names[op], ptr - 1); 1167 1139 else 1168 1140 SDEBUG("[%d] @ 0x%04X\n", op, ptr - 1); 1141 + if (ectx.abort) { 1142 + DRM_ERROR("atombios stuck executing %04X (len %d, WS %d, PS %d) @ 0x%04X\n", 1143 + base, len, ws, ps, ptr - 1); 1144 + return -EINVAL; 1145 + } 1169 1146 1170 1147 if (op < ATOM_OP_CNT && op > 0) 1171 1148 opcode_table[op].func(&ectx, &ptr, ··· 1186 1153 1187 1154 if (ws) 1188 1155 kfree(ectx.ws); 1156 + return 0; 1189 1157 } 1190 1158 1191 - void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1159 + int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1192 1160 { 1161 + int r; 1162 + 1193 1163 mutex_lock(&ctx->mutex); 1194 1164 /* reset reg block */ 1195 1165 ctx->reg_block = 0; ··· 1200 1164 ctx->fb_base = 0; 1201 1165 /* reset io mode */ 1202 1166 ctx->io_mode = ATOM_IO_MM; 1203 - atom_execute_table_locked(ctx, index, params); 1167 + r = atom_execute_table_locked(ctx, index, params); 1204 1168 mutex_unlock(&ctx->mutex); 1169 + return r; 1205 1170 } 1206 1171 1207 1172 static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; ··· 1286 1249 1287 1250 if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) 1288 1251 return 1; 1289 - atom_execute_table(ctx, ATOM_CMD_INIT, ps); 1290 - 1291 - return 0; 1252 + return atom_execute_table(ctx, ATOM_CMD_INIT, ps); 1292 1253 } 1293 1254 1294 1255 void atom_destroy(struct atom_context *ctx) ··· 1296 1261 kfree(ctx); 1297 1262 } 1298 1263 1299 - void atom_parse_data_header(struct atom_context *ctx, int index, 1264 + bool atom_parse_data_header(struct atom_context *ctx, int index, 1300 1265 uint16_t * size, uint8_t * frev, uint8_t * crev, 1301 1266 uint16_t * data_start) 1302 1267 { 1303 1268 int offset = index * 2 + 4; 1304 1269 int idx = CU16(ctx->data_table + offset); 1270 + u16 *mdt = (u16 *)(ctx->bios + ctx->data_table + 4); 1271 + 1272 + if (!mdt[index]) 1273 + return false; 1305 1274 1306 1275 if (size) 1307 1276 *size = CU16(idx); ··· 1314 1275 if (crev) 1315 1276 *crev = CU8(idx + 3); 1316 1277 *data_start = idx; 1317 - return; 1278 + return true; 1318 1279 } 1319 1280 1320 - void atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, 1281 + bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, 1321 1282 uint8_t * crev) 1322 1283 { 1323 1284 int offset = index * 2 + 4; 1324 1285 int idx = CU16(ctx->cmd_table + offset); 1286 + u16 *mct = (u16 *)(ctx->bios + ctx->cmd_table + 4); 1287 + 1288 + if (!mct[index]) 1289 + return false; 1325 1290 1326 1291 if (frev) 1327 1292 *frev = CU8(idx + 2); 1328 1293 if (crev) 1329 1294 *crev = CU8(idx + 3); 1330 - return; 1295 + return true; 1331 1296 } 1332 1297 1333 1298 int atom_allocate_fb_scratch(struct atom_context *ctx) 1334 1299 { 1335 1300 int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); 1336 1301 uint16_t data_offset; 1337 - int usage_bytes; 1302 + int usage_bytes = 0; 1338 1303 struct _ATOM_VRAM_USAGE_BY_FIRMWARE *firmware_usage; 1339 1304 1340 - atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset); 1305 + if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { 1306 + firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); 1341 1307 1342 - firmware_usage = (struct _ATOM_VRAM_USAGE_BY_FIRMWARE *)(ctx->bios + data_offset); 1308 + DRM_DEBUG("atom firmware requested %08x %dkb\n", 1309 + firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, 1310 + firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb); 1343 1311 1344 - DRM_DEBUG("atom firmware requested %08x %dkb\n", 1345 - firmware_usage->asFirmwareVramReserveInfo[0].ulStartAddrUsedByFirmware, 1346 - firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb); 1347 - 1348 - usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; 1312 + usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; 1313 + } 1349 1314 if (usage_bytes == 0) 1350 1315 usage_bytes = 20 * 1024; 1351 1316 /* allocate some scratch memory */
+5 -3
drivers/gpu/drm/radeon/atom.h
··· 140 140 extern int atom_debug; 141 141 142 142 struct atom_context *atom_parse(struct card_info *, void *); 143 - void atom_execute_table(struct atom_context *, int, uint32_t *); 143 + int atom_execute_table(struct atom_context *, int, uint32_t *); 144 144 int atom_asic_init(struct atom_context *); 145 145 void atom_destroy(struct atom_context *); 146 - void atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, uint8_t *frev, uint8_t *crev, uint16_t *data_start); 147 - void atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *frev, uint8_t *crev); 146 + bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, 147 + uint8_t *frev, uint8_t *crev, uint16_t *data_start); 148 + bool atom_parse_cmd_header(struct atom_context *ctx, int index, 149 + uint8_t *frev, uint8_t *crev); 148 150 int atom_allocate_fb_scratch(struct atom_context *ctx); 149 151 #include "atom-types.h" 150 152 #include "atombios.h"
+73 -25
drivers/gpu/drm/radeon/atombios_crtc.c
··· 353 353 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 354 354 } 355 355 356 + static void atombios_disable_ss(struct drm_crtc *crtc) 357 + { 358 + struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 359 + struct drm_device *dev = crtc->dev; 360 + struct radeon_device *rdev = dev->dev_private; 361 + u32 ss_cntl; 362 + 363 + if (ASIC_IS_DCE4(rdev)) { 364 + switch (radeon_crtc->pll_id) { 365 + case ATOM_PPLL1: 366 + ss_cntl = RREG32(EVERGREEN_P1PLL_SS_CNTL); 367 + ss_cntl &= ~EVERGREEN_PxPLL_SS_EN; 368 + WREG32(EVERGREEN_P1PLL_SS_CNTL, ss_cntl); 369 + break; 370 + case ATOM_PPLL2: 371 + ss_cntl = RREG32(EVERGREEN_P2PLL_SS_CNTL); 372 + ss_cntl &= ~EVERGREEN_PxPLL_SS_EN; 373 + WREG32(EVERGREEN_P2PLL_SS_CNTL, ss_cntl); 374 + break; 375 + case ATOM_DCPLL: 376 + case ATOM_PPLL_INVALID: 377 + return; 378 + } 379 + } else if (ASIC_IS_AVIVO(rdev)) { 380 + switch (radeon_crtc->pll_id) { 381 + case ATOM_PPLL1: 382 + ss_cntl = RREG32(AVIVO_P1PLL_INT_SS_CNTL); 383 + ss_cntl &= ~1; 384 + WREG32(AVIVO_P1PLL_INT_SS_CNTL, ss_cntl); 385 + break; 386 + case ATOM_PPLL2: 387 + ss_cntl = RREG32(AVIVO_P2PLL_INT_SS_CNTL); 388 + ss_cntl &= ~1; 389 + WREG32(AVIVO_P2PLL_INT_SS_CNTL, ss_cntl); 390 + break; 391 + case ATOM_DCPLL: 392 + case ATOM_PPLL_INVALID: 393 + return; 394 + } 395 + } 396 + } 397 + 398 + 356 399 union atom_enable_ss { 357 400 ENABLE_LVDS_SS_PARAMETERS legacy; 358 401 ENABLE_SPREAD_SPECTRUM_ON_PPLL_PS_ALLOCATION v1; 359 402 }; 360 403 361 - static void atombios_set_ss(struct drm_crtc *crtc, int enable) 404 + static void atombios_enable_ss(struct drm_crtc *crtc) 362 405 { 363 406 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 364 407 struct drm_device *dev = crtc->dev; ··· 430 387 step = dig->ss->step; 431 388 delay = dig->ss->delay; 432 389 range = dig->ss->range; 433 - } else if (enable) 390 + } else 434 391 return; 435 - } else if (enable) 392 + } else 436 393 return; 437 394 break; 438 395 } ··· 449 406 args.v1.ucSpreadSpectrumDelay = delay; 450 407 args.v1.ucSpreadSpectrumRange = range; 451 408 args.v1.ucPpll = radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1; 452 - args.v1.ucEnable = enable; 409 + args.v1.ucEnable = ATOM_ENABLE; 453 410 } else { 454 411 args.legacy.usSpreadSpectrumPercentage = cpu_to_le16(percentage); 455 412 args.legacy.ucSpreadSpectrumType = type; 456 413 args.legacy.ucSpreadSpectrumStepSize_Delay = (step & 3) << 2; 457 414 args.legacy.ucSpreadSpectrumStepSize_Delay |= (delay & 7) << 4; 458 - args.legacy.ucEnable = enable; 415 + args.legacy.ucEnable = ATOM_ENABLE; 459 416 } 460 417 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 461 418 } ··· 521 478 /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ 522 479 if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) 523 480 adjusted_clock = mode->clock * 2; 524 - /* LVDS PLL quirks */ 525 - if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) { 526 - struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 527 - pll->algo = dig->pll_algo; 528 - } 529 481 } else { 530 482 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) 531 483 pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; ··· 541 503 int index; 542 504 543 505 index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll); 544 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 545 - &crev); 506 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 507 + &crev)) 508 + return adjusted_clock; 546 509 547 510 memset(&args, 0, sizeof(args)); 548 511 ··· 581 542 } 582 543 } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 583 544 /* may want to enable SS on DP/eDP eventually */ 584 - args.v3.sInput.ucDispPllConfig |= 585 - DISPPLL_CONFIG_SS_ENABLE; 586 - if (mode->clock > 165000) 545 + /*args.v3.sInput.ucDispPllConfig |= 546 + DISPPLL_CONFIG_SS_ENABLE;*/ 547 + if (encoder_mode == ATOM_ENCODER_MODE_DP) 587 548 args.v3.sInput.ucDispPllConfig |= 588 - DISPPLL_CONFIG_DUAL_LINK; 549 + DISPPLL_CONFIG_COHERENT_MODE; 550 + else { 551 + if (mode->clock > 165000) 552 + args.v3.sInput.ucDispPllConfig |= 553 + DISPPLL_CONFIG_DUAL_LINK; 554 + } 589 555 } 590 556 atom_execute_table(rdev->mode_info.atom_context, 591 557 index, (uint32_t *)&args); ··· 636 592 memset(&args, 0, sizeof(args)); 637 593 638 594 index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); 639 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 640 - &crev); 595 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 596 + &crev)) 597 + return; 641 598 642 599 switch (frev) { 643 600 case 1: ··· 712 667 &ref_div, &post_div); 713 668 714 669 index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); 715 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 716 - &crev); 670 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, 671 + &crev)) 672 + return; 717 673 718 674 switch (frev) { 719 675 case 1: ··· 1129 1083 1130 1084 /* TODO color tiling */ 1131 1085 1132 - /* pick pll */ 1133 - radeon_crtc->pll_id = radeon_atom_pick_pll(crtc); 1134 - 1135 - atombios_set_ss(crtc, 0); 1086 + atombios_disable_ss(crtc); 1136 1087 /* always set DCPLL */ 1137 1088 if (ASIC_IS_DCE4(rdev)) 1138 1089 atombios_crtc_set_dcpll(crtc); 1139 1090 atombios_crtc_set_pll(crtc, adjusted_mode); 1140 - atombios_set_ss(crtc, 1); 1091 + atombios_enable_ss(crtc); 1141 1092 1142 1093 if (ASIC_IS_DCE4(rdev)) 1143 1094 atombios_set_crtc_dtd_timing(crtc, adjusted_mode); ··· 1163 1120 1164 1121 static void atombios_crtc_prepare(struct drm_crtc *crtc) 1165 1122 { 1123 + struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 1124 + 1125 + /* pick pll */ 1126 + radeon_crtc->pll_id = radeon_atom_pick_pll(crtc); 1127 + 1166 1128 atombios_lock_crtc(crtc, ATOM_ENABLE); 1167 1129 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); 1168 1130 }
+3 -3
drivers/gpu/drm/radeon/atombios_dp.c
··· 745 745 >> DP_TRAIN_PRE_EMPHASIS_SHIFT); 746 746 747 747 /* disable the training pattern on the sink */ 748 + dp_set_training(radeon_connector, DP_TRAINING_PATTERN_DISABLE); 749 + 750 + /* disable the training pattern on the source */ 748 751 if (ASIC_IS_DCE4(rdev)) 749 752 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE); 750 753 else 751 754 radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE, 752 755 dig_connector->dp_clock, enc_id, 0); 753 - 754 - radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE, 755 - dig_connector->dp_clock, enc_id, 0); 756 756 } 757 757 758 758 int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
+4 -7
drivers/gpu/drm/radeon/evergreen.c
··· 26 26 #include <linux/slab.h> 27 27 #include "drmP.h" 28 28 #include "radeon.h" 29 + #include "radeon_asic.h" 29 30 #include "radeon_drm.h" 30 31 #include "rv770d.h" 31 32 #include "atom.h" ··· 438 437 439 438 int evergreen_mc_init(struct radeon_device *rdev) 440 439 { 441 - fixed20_12 a; 442 440 u32 tmp; 443 441 int chansize, numchan; 444 442 ··· 482 482 rdev->mc.real_vram_size = rdev->mc.aper_size; 483 483 } 484 484 r600_vram_gtt_location(rdev, &rdev->mc); 485 - /* FIXME: we should enforce default clock in case GPU is not in 486 - * default setup 487 - */ 488 - a.full = rfixed_const(100); 489 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 490 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 485 + radeon_update_bandwidth_info(rdev); 486 + 491 487 return 0; 492 488 } 493 489 ··· 743 747 744 748 void evergreen_fini(struct radeon_device *rdev) 745 749 { 750 + radeon_pm_fini(rdev); 746 751 evergreen_suspend(rdev); 747 752 #if 0 748 753 r600_blit_fini(rdev);
+19 -6
drivers/gpu/drm/radeon/r100.c
··· 32 32 #include "radeon_drm.h" 33 33 #include "radeon_reg.h" 34 34 #include "radeon.h" 35 + #include "radeon_asic.h" 35 36 #include "r100d.h" 36 37 #include "rs100d.h" 37 38 #include "rv200d.h" ··· 237 236 238 237 void r100_pci_gart_fini(struct radeon_device *rdev) 239 238 { 239 + radeon_gart_fini(rdev); 240 240 r100_pci_gart_disable(rdev); 241 241 radeon_gart_table_ram_free(rdev); 242 - radeon_gart_fini(rdev); 243 242 } 244 243 245 244 int r100_irq_set(struct radeon_device *rdev) ··· 314 313 /* Vertical blank interrupts */ 315 314 if (status & RADEON_CRTC_VBLANK_STAT) { 316 315 drm_handle_vblank(rdev->ddev, 0); 316 + rdev->pm.vblank_sync = true; 317 317 wake_up(&rdev->irq.vblank_queue); 318 318 } 319 319 if (status & RADEON_CRTC2_VBLANK_STAT) { 320 320 drm_handle_vblank(rdev->ddev, 1); 321 + rdev->pm.vblank_sync = true; 321 322 wake_up(&rdev->irq.vblank_queue); 322 323 } 323 324 if (status & RADEON_FP_DETECT_STAT) { ··· 745 742 udelay(10); 746 743 rdev->cp.rptr = RREG32(RADEON_CP_RB_RPTR); 747 744 rdev->cp.wptr = RREG32(RADEON_CP_RB_WPTR); 745 + /* protect against crazy HW on resume */ 746 + rdev->cp.wptr &= rdev->cp.ptr_mask; 748 747 /* Set cp mode to bus mastering & enable cp*/ 749 748 WREG32(RADEON_CP_CSQ_MODE, 750 749 REG_SET(RADEON_INDIRECT2_START, indirect2_start) | ··· 1810 1805 { 1811 1806 struct drm_device *dev = rdev->ddev; 1812 1807 bool force_dac2 = false; 1808 + u32 tmp; 1813 1809 1814 1810 /* set these so they don't interfere with anything */ 1815 1811 WREG32(RADEON_OV0_SCALE_CNTL, 0); ··· 1882 1876 WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); 1883 1877 WREG32(RADEON_DAC_CNTL2, dac2_cntl); 1884 1878 } 1879 + 1880 + /* switch PM block to ACPI mode */ 1881 + tmp = RREG32_PLL(RADEON_PLL_PWRMGT_CNTL); 1882 + tmp &= ~RADEON_PM_MODE_SEL; 1883 + WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); 1884 + 1885 1885 } 1886 1886 1887 1887 /* ··· 2035 2023 radeon_vram_location(rdev, &rdev->mc, base); 2036 2024 if (!(rdev->flags & RADEON_IS_AGP)) 2037 2025 radeon_gtt_location(rdev, &rdev->mc); 2026 + radeon_update_bandwidth_info(rdev); 2038 2027 } 2039 2028 2040 2029 ··· 2399 2386 uint32_t pixel_bytes1 = 0; 2400 2387 uint32_t pixel_bytes2 = 0; 2401 2388 2389 + radeon_update_display_priority(rdev); 2390 + 2402 2391 if (rdev->mode_info.crtcs[0]->base.enabled) { 2403 2392 mode1 = &rdev->mode_info.crtcs[0]->base.mode; 2404 2393 pixel_bytes1 = rdev->mode_info.crtcs[0]->base.fb->bits_per_pixel / 8; ··· 2429 2414 /* 2430 2415 * determine is there is enough bw for current mode 2431 2416 */ 2432 - mclk_ff.full = rfixed_const(rdev->clock.default_mclk); 2433 - temp_ff.full = rfixed_const(100); 2434 - mclk_ff.full = rfixed_div(mclk_ff, temp_ff); 2435 - sclk_ff.full = rfixed_const(rdev->clock.default_sclk); 2436 - sclk_ff.full = rfixed_div(sclk_ff, temp_ff); 2417 + sclk_ff = rdev->pm.sclk; 2418 + mclk_ff = rdev->pm.mclk; 2437 2419 2438 2420 temp = (rdev->mc.vram_width / 8) * (rdev->mc.vram_is_ddr ? 2 : 1); 2439 2421 temp_ff.full = rfixed_const(temp); ··· 3453 3441 3454 3442 void r100_fini(struct radeon_device *rdev) 3455 3443 { 3444 + radeon_pm_fini(rdev); 3456 3445 r100_cp_fini(rdev); 3457 3446 r100_wb_fini(rdev); 3458 3447 r100_ib_fini(rdev);
+1
drivers/gpu/drm/radeon/r200.c
··· 30 30 #include "radeon_drm.h" 31 31 #include "radeon_reg.h" 32 32 #include "radeon.h" 33 + #include "radeon_asic.h" 33 34 34 35 #include "r100d.h" 35 36 #include "r200_reg_safe.h"
+4 -1
drivers/gpu/drm/radeon/r300.c
··· 31 31 #include "drm.h" 32 32 #include "radeon_reg.h" 33 33 #include "radeon.h" 34 + #include "radeon_asic.h" 34 35 #include "radeon_drm.h" 35 36 #include "r100_track.h" 36 37 #include "r300d.h" ··· 166 165 167 166 void rv370_pcie_gart_fini(struct radeon_device *rdev) 168 167 { 168 + radeon_gart_fini(rdev); 169 169 rv370_pcie_gart_disable(rdev); 170 170 radeon_gart_table_vram_free(rdev); 171 - radeon_gart_fini(rdev); 172 171 } 173 172 174 173 void r300_fence_ring_emit(struct radeon_device *rdev, ··· 483 482 radeon_vram_location(rdev, &rdev->mc, base); 484 483 if (!(rdev->flags & RADEON_IS_AGP)) 485 484 radeon_gtt_location(rdev, &rdev->mc); 485 + radeon_update_bandwidth_info(rdev); 486 486 } 487 487 488 488 void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes) ··· 1337 1335 1338 1336 void r300_fini(struct radeon_device *rdev) 1339 1337 { 1338 + radeon_pm_fini(rdev); 1340 1339 r100_cp_fini(rdev); 1341 1340 r100_wb_fini(rdev); 1342 1341 r100_ib_fini(rdev);
+2
drivers/gpu/drm/radeon/r420.c
··· 30 30 #include "drmP.h" 31 31 #include "radeon_reg.h" 32 32 #include "radeon.h" 33 + #include "radeon_asic.h" 33 34 #include "atom.h" 34 35 #include "r100d.h" 35 36 #include "r420d.h" ··· 268 267 269 268 void r420_fini(struct radeon_device *rdev) 270 269 { 270 + radeon_pm_fini(rdev); 271 271 r100_cp_fini(rdev); 272 272 r100_wb_fini(rdev); 273 273 r100_ib_fini(rdev);
+2 -7
drivers/gpu/drm/radeon/r520.c
··· 27 27 */ 28 28 #include "drmP.h" 29 29 #include "radeon.h" 30 + #include "radeon_asic.h" 30 31 #include "atom.h" 31 32 #include "r520d.h" 32 33 ··· 122 121 123 122 void r520_mc_init(struct radeon_device *rdev) 124 123 { 125 - fixed20_12 a; 126 124 127 125 r520_vram_get_type(rdev); 128 126 r100_vram_init_sizes(rdev); 129 127 radeon_vram_location(rdev, &rdev->mc, 0); 130 128 if (!(rdev->flags & RADEON_IS_AGP)) 131 129 radeon_gtt_location(rdev, &rdev->mc); 132 - /* FIXME: we should enforce default clock in case GPU is not in 133 - * default setup 134 - */ 135 - a.full = rfixed_const(100); 136 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 137 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 130 + radeon_update_bandwidth_info(rdev); 138 131 } 139 132 140 133 void r520_mc_program(struct radeon_device *rdev)
+15 -15
drivers/gpu/drm/radeon/r600.c
··· 32 32 #include "drmP.h" 33 33 #include "radeon_drm.h" 34 34 #include "radeon.h" 35 + #include "radeon_asic.h" 35 36 #include "radeon_mode.h" 36 37 #include "r600d.h" 37 38 #include "atom.h" ··· 493 492 494 493 void r600_pcie_gart_fini(struct radeon_device *rdev) 495 494 { 495 + radeon_gart_fini(rdev); 496 496 r600_pcie_gart_disable(rdev); 497 497 radeon_gart_table_vram_free(rdev); 498 - radeon_gart_fini(rdev); 499 498 } 500 499 501 500 void r600_agp_enable(struct radeon_device *rdev) ··· 677 676 678 677 int r600_mc_init(struct radeon_device *rdev) 679 678 { 680 - fixed20_12 a; 681 679 u32 tmp; 682 680 int chansize, numchan; 683 681 ··· 720 720 rdev->mc.real_vram_size = rdev->mc.aper_size; 721 721 } 722 722 r600_vram_gtt_location(rdev, &rdev->mc); 723 - /* FIXME: we should enforce default clock in case GPU is not in 724 - * default setup 725 - */ 726 - a.full = rfixed_const(100); 727 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 728 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 723 + 729 724 if (rdev->flags & RADEON_IS_IGP) 730 725 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 726 + radeon_update_bandwidth_info(rdev); 731 727 return 0; 732 728 } 733 729 ··· 1129 1133 /* Setup pipes */ 1130 1134 WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); 1131 1135 WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 1136 + WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 1132 1137 1133 1138 tmp = R6XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); 1134 1139 WREG32(VGT_OUT_DEALLOC_CNTL, (tmp * 4) & DEALLOC_DIST_MASK); ··· 2117 2120 2118 2121 void r600_fini(struct radeon_device *rdev) 2119 2122 { 2123 + radeon_pm_fini(rdev); 2120 2124 r600_audio_fini(rdev); 2121 2125 r600_blit_fini(rdev); 2122 2126 r600_cp_fini(rdev); ··· 2397 2399 WREG32(DC_HPD4_INT_CONTROL, tmp); 2398 2400 if (ASIC_IS_DCE32(rdev)) { 2399 2401 tmp = RREG32(DC_HPD5_INT_CONTROL) & DC_HPDx_INT_POLARITY; 2400 - WREG32(DC_HPD5_INT_CONTROL, 0); 2402 + WREG32(DC_HPD5_INT_CONTROL, tmp); 2401 2403 tmp = RREG32(DC_HPD6_INT_CONTROL) & DC_HPDx_INT_POLARITY; 2402 - WREG32(DC_HPD6_INT_CONTROL, 0); 2404 + WREG32(DC_HPD6_INT_CONTROL, tmp); 2403 2405 } 2404 2406 } else { 2405 2407 WREG32(DACA_AUTODETECT_INT_CONTROL, 0); 2406 2408 WREG32(DACB_AUTODETECT_INT_CONTROL, 0); 2407 2409 tmp = RREG32(DC_HOT_PLUG_DETECT1_INT_CONTROL) & DC_HOT_PLUG_DETECTx_INT_POLARITY; 2408 - WREG32(DC_HOT_PLUG_DETECT1_INT_CONTROL, 0); 2410 + WREG32(DC_HOT_PLUG_DETECT1_INT_CONTROL, tmp); 2409 2411 tmp = RREG32(DC_HOT_PLUG_DETECT2_INT_CONTROL) & DC_HOT_PLUG_DETECTx_INT_POLARITY; 2410 - WREG32(DC_HOT_PLUG_DETECT2_INT_CONTROL, 0); 2412 + WREG32(DC_HOT_PLUG_DETECT2_INT_CONTROL, tmp); 2411 2413 tmp = RREG32(DC_HOT_PLUG_DETECT3_INT_CONTROL) & DC_HOT_PLUG_DETECTx_INT_POLARITY; 2412 - WREG32(DC_HOT_PLUG_DETECT3_INT_CONTROL, 0); 2414 + WREG32(DC_HOT_PLUG_DETECT3_INT_CONTROL, tmp); 2413 2415 } 2414 2416 } 2415 2417 ··· 2764 2766 case 0: /* D1 vblank */ 2765 2767 if (disp_int & LB_D1_VBLANK_INTERRUPT) { 2766 2768 drm_handle_vblank(rdev->ddev, 0); 2769 + rdev->pm.vblank_sync = true; 2767 2770 wake_up(&rdev->irq.vblank_queue); 2768 2771 disp_int &= ~LB_D1_VBLANK_INTERRUPT; 2769 2772 DRM_DEBUG("IH: D1 vblank\n"); ··· 2786 2787 case 0: /* D2 vblank */ 2787 2788 if (disp_int & LB_D2_VBLANK_INTERRUPT) { 2788 2789 drm_handle_vblank(rdev->ddev, 1); 2790 + rdev->pm.vblank_sync = true; 2789 2791 wake_up(&rdev->irq.vblank_queue); 2790 2792 disp_int &= ~LB_D2_VBLANK_INTERRUPT; 2791 2793 DRM_DEBUG("IH: D2 vblank\n"); ··· 2835 2835 break; 2836 2836 case 10: 2837 2837 if (disp_int_cont2 & DC_HPD5_INTERRUPT) { 2838 - disp_int_cont &= ~DC_HPD5_INTERRUPT; 2838 + disp_int_cont2 &= ~DC_HPD5_INTERRUPT; 2839 2839 queue_hotplug = true; 2840 2840 DRM_DEBUG("IH: HPD5\n"); 2841 2841 } 2842 2842 break; 2843 2843 case 12: 2844 2844 if (disp_int_cont2 & DC_HPD6_INTERRUPT) { 2845 - disp_int_cont &= ~DC_HPD6_INTERRUPT; 2845 + disp_int_cont2 &= ~DC_HPD6_INTERRUPT; 2846 2846 queue_hotplug = true; 2847 2847 DRM_DEBUG("IH: HPD6\n"); 2848 2848 }
+10 -42
drivers/gpu/drm/radeon/r600_audio.c
··· 182 182 } 183 183 184 184 /* 185 - * determin how the encoders and audio interface is wired together 186 - */ 187 - int r600_audio_tmds_index(struct drm_encoder *encoder) 188 - { 189 - struct drm_device *dev = encoder->dev; 190 - struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 191 - struct drm_encoder *other; 192 - 193 - switch (radeon_encoder->encoder_id) { 194 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 195 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 196 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 197 - return 0; 198 - 199 - case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 200 - /* special case check if an TMDS1 is present */ 201 - list_for_each_entry(other, &dev->mode_config.encoder_list, head) { 202 - if (to_radeon_encoder(other)->encoder_id == 203 - ENCODER_OBJECT_ID_INTERNAL_TMDS1) 204 - return 1; 205 - } 206 - return 0; 207 - 208 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 209 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: 210 - return 1; 211 - 212 - default: 213 - DRM_ERROR("Unsupported encoder type 0x%02X\n", 214 - radeon_encoder->encoder_id); 215 - return -1; 216 - } 217 - } 218 - 219 - /* 220 185 * atach the audio codec to the clock source of the encoder 221 186 */ 222 187 void r600_audio_set_clock(struct drm_encoder *encoder, int clock) ··· 189 224 struct drm_device *dev = encoder->dev; 190 225 struct radeon_device *rdev = dev->dev_private; 191 226 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 227 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 192 228 int base_rate = 48000; 193 229 194 230 switch (radeon_encoder->encoder_id) { ··· 197 231 case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 198 232 WREG32_P(R600_AUDIO_TIMING, 0, ~0x301); 199 233 break; 200 - 201 234 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 202 235 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 203 236 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 204 237 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: 205 238 WREG32_P(R600_AUDIO_TIMING, 0x100, ~0x301); 206 239 break; 207 - 208 240 default: 209 241 DRM_ERROR("Unsupported encoder type 0x%02X\n", 210 242 radeon_encoder->encoder_id); 211 243 return; 212 244 } 213 245 214 - switch (r600_audio_tmds_index(encoder)) { 246 + switch (dig->dig_encoder) { 215 247 case 0: 216 - WREG32(R600_AUDIO_PLL1_MUL, base_rate*50); 217 - WREG32(R600_AUDIO_PLL1_DIV, clock*100); 248 + WREG32(R600_AUDIO_PLL1_MUL, base_rate * 50); 249 + WREG32(R600_AUDIO_PLL1_DIV, clock * 100); 218 250 WREG32(R600_AUDIO_CLK_SRCSEL, 0); 219 251 break; 220 252 221 253 case 1: 222 - WREG32(R600_AUDIO_PLL2_MUL, base_rate*50); 223 - WREG32(R600_AUDIO_PLL2_DIV, clock*100); 254 + WREG32(R600_AUDIO_PLL2_MUL, base_rate * 50); 255 + WREG32(R600_AUDIO_PLL2_DIV, clock * 100); 224 256 WREG32(R600_AUDIO_CLK_SRCSEL, 1); 225 257 break; 258 + default: 259 + dev_err(rdev->dev, "Unsupported DIG on encoder 0x%02X\n", 260 + radeon_encoder->encoder_id); 261 + return; 226 262 } 227 263 } 228 264
+35
drivers/gpu/drm/radeon/r600_blit_shaders.c
··· 1 + /* 2 + * Copyright 2009 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice (including the next 12 + * paragraph) shall be included in all copies or substantial portions of the 13 + * Software. 14 + * 15 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 + * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 + * DEALINGS IN THE SOFTWARE. 22 + * 23 + * Authors: 24 + * Alex Deucher <alexander.deucher@amd.com> 25 + */ 1 26 2 27 #include <linux/types.h> 3 28 #include <linux/kernel.h> 29 + 30 + /* 31 + * R6xx+ cards need to use the 3D engine to blit data which requires 32 + * quite a bit of hw state setup. Rather than pull the whole 3D driver 33 + * (which normally generates the 3D state) into the DRM, we opt to use 34 + * statically generated state tables. The regsiter state and shaders 35 + * were hand generated to support blitting functionality. See the 3D 36 + * driver or documentation for descriptions of the registers and 37 + * shader instructions. 38 + */ 4 39 5 40 const u32 r6xx_default_state[] = 6 41 {
+3
drivers/gpu/drm/radeon/r600_cp.c
··· 1548 1548 1549 1549 RADEON_WRITE(R600_CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); 1550 1550 RADEON_WRITE(R600_CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 1551 + RADEON_WRITE(R600_GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 1551 1552 1552 1553 RADEON_WRITE(R700_CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); 1553 1554 RADEON_WRITE(R700_CGTS_SYS_TCC_DISABLE, 0); 1554 1555 RADEON_WRITE(R700_CGTS_TCC_DISABLE, 0); 1556 + RADEON_WRITE(R700_CGTS_USER_SYS_TCC_DISABLE, 0); 1557 + RADEON_WRITE(R700_CGTS_USER_TCC_DISABLE, 0); 1555 1558 1556 1559 num_qd_pipes = 1557 1560 R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & R600_INACTIVE_QD_PIPES_MASK) >> 8);
+63 -7
drivers/gpu/drm/radeon/r600_cs.c
··· 45 45 u32 nbanks; 46 46 u32 npipes; 47 47 /* value we track */ 48 + u32 sq_config; 48 49 u32 nsamples; 49 50 u32 cb_color_base_last[8]; 50 51 struct radeon_bo *cb_color_bo[8]; ··· 142 141 { 143 142 int i; 144 143 144 + /* assume DX9 mode */ 145 + track->sq_config = DX9_CONSTS; 145 146 for (i = 0; i < 8; i++) { 146 147 track->cb_color_base_last[i] = 0; 147 148 track->cb_color_size[i] = 0; ··· 718 715 tmp =radeon_get_ib_value(p, idx); 719 716 ib[idx] = 0; 720 717 break; 718 + case SQ_CONFIG: 719 + track->sq_config = radeon_get_ib_value(p, idx); 720 + break; 721 721 case R_028800_DB_DEPTH_CONTROL: 722 722 track->db_depth_control = radeon_get_ib_value(p, idx); 723 723 break; ··· 875 869 case SQ_PGM_START_VS: 876 870 case SQ_PGM_START_GS: 877 871 case SQ_PGM_START_PS: 872 + case SQ_ALU_CONST_CACHE_GS_0: 873 + case SQ_ALU_CONST_CACHE_GS_1: 874 + case SQ_ALU_CONST_CACHE_GS_2: 875 + case SQ_ALU_CONST_CACHE_GS_3: 876 + case SQ_ALU_CONST_CACHE_GS_4: 877 + case SQ_ALU_CONST_CACHE_GS_5: 878 + case SQ_ALU_CONST_CACHE_GS_6: 879 + case SQ_ALU_CONST_CACHE_GS_7: 880 + case SQ_ALU_CONST_CACHE_GS_8: 881 + case SQ_ALU_CONST_CACHE_GS_9: 882 + case SQ_ALU_CONST_CACHE_GS_10: 883 + case SQ_ALU_CONST_CACHE_GS_11: 884 + case SQ_ALU_CONST_CACHE_GS_12: 885 + case SQ_ALU_CONST_CACHE_GS_13: 886 + case SQ_ALU_CONST_CACHE_GS_14: 887 + case SQ_ALU_CONST_CACHE_GS_15: 888 + case SQ_ALU_CONST_CACHE_PS_0: 889 + case SQ_ALU_CONST_CACHE_PS_1: 890 + case SQ_ALU_CONST_CACHE_PS_2: 891 + case SQ_ALU_CONST_CACHE_PS_3: 892 + case SQ_ALU_CONST_CACHE_PS_4: 893 + case SQ_ALU_CONST_CACHE_PS_5: 894 + case SQ_ALU_CONST_CACHE_PS_6: 895 + case SQ_ALU_CONST_CACHE_PS_7: 896 + case SQ_ALU_CONST_CACHE_PS_8: 897 + case SQ_ALU_CONST_CACHE_PS_9: 898 + case SQ_ALU_CONST_CACHE_PS_10: 899 + case SQ_ALU_CONST_CACHE_PS_11: 900 + case SQ_ALU_CONST_CACHE_PS_12: 901 + case SQ_ALU_CONST_CACHE_PS_13: 902 + case SQ_ALU_CONST_CACHE_PS_14: 903 + case SQ_ALU_CONST_CACHE_PS_15: 904 + case SQ_ALU_CONST_CACHE_VS_0: 905 + case SQ_ALU_CONST_CACHE_VS_1: 906 + case SQ_ALU_CONST_CACHE_VS_2: 907 + case SQ_ALU_CONST_CACHE_VS_3: 908 + case SQ_ALU_CONST_CACHE_VS_4: 909 + case SQ_ALU_CONST_CACHE_VS_5: 910 + case SQ_ALU_CONST_CACHE_VS_6: 911 + case SQ_ALU_CONST_CACHE_VS_7: 912 + case SQ_ALU_CONST_CACHE_VS_8: 913 + case SQ_ALU_CONST_CACHE_VS_9: 914 + case SQ_ALU_CONST_CACHE_VS_10: 915 + case SQ_ALU_CONST_CACHE_VS_11: 916 + case SQ_ALU_CONST_CACHE_VS_12: 917 + case SQ_ALU_CONST_CACHE_VS_13: 918 + case SQ_ALU_CONST_CACHE_VS_14: 919 + case SQ_ALU_CONST_CACHE_VS_15: 878 920 r = r600_cs_packet_next_reloc(p, &reloc); 879 921 if (r) { 880 922 dev_warn(p->dev, "bad SET_CONTEXT_REG " ··· 1280 1226 } 1281 1227 break; 1282 1228 case PACKET3_SET_ALU_CONST: 1283 - start_reg = (idx_value << 2) + PACKET3_SET_ALU_CONST_OFFSET; 1284 - end_reg = 4 * pkt->count + start_reg - 4; 1285 - if ((start_reg < PACKET3_SET_ALU_CONST_OFFSET) || 1286 - (start_reg >= PACKET3_SET_ALU_CONST_END) || 1287 - (end_reg >= PACKET3_SET_ALU_CONST_END)) { 1288 - DRM_ERROR("bad SET_ALU_CONST\n"); 1289 - return -EINVAL; 1229 + if (track->sq_config & DX9_CONSTS) { 1230 + start_reg = (idx_value << 2) + PACKET3_SET_ALU_CONST_OFFSET; 1231 + end_reg = 4 * pkt->count + start_reg - 4; 1232 + if ((start_reg < PACKET3_SET_ALU_CONST_OFFSET) || 1233 + (start_reg >= PACKET3_SET_ALU_CONST_END) || 1234 + (end_reg >= PACKET3_SET_ALU_CONST_END)) { 1235 + DRM_ERROR("bad SET_ALU_CONST\n"); 1236 + return -EINVAL; 1237 + } 1290 1238 } 1291 1239 break; 1292 1240 case PACKET3_SET_BOOL_CONST:
+127 -76
drivers/gpu/drm/radeon/r600_hdmi.c
··· 42 42 */ 43 43 enum r600_hdmi_iec_status_bits { 44 44 AUDIO_STATUS_DIG_ENABLE = 0x01, 45 - AUDIO_STATUS_V = 0x02, 46 - AUDIO_STATUS_VCFG = 0x04, 45 + AUDIO_STATUS_V = 0x02, 46 + AUDIO_STATUS_VCFG = 0x04, 47 47 AUDIO_STATUS_EMPHASIS = 0x08, 48 48 AUDIO_STATUS_COPYRIGHT = 0x10, 49 49 AUDIO_STATUS_NONAUDIO = 0x20, 50 50 AUDIO_STATUS_PROFESSIONAL = 0x40, 51 - AUDIO_STATUS_LEVEL = 0x80 51 + AUDIO_STATUS_LEVEL = 0x80 52 52 }; 53 53 54 54 struct { ··· 85 85 static void r600_hdmi_calc_CTS(uint32_t clock, int *CTS, int N, int freq) 86 86 { 87 87 if (*CTS == 0) 88 - *CTS = clock*N/(128*freq)*1000; 88 + *CTS = clock * N / (128 * freq) * 1000; 89 89 DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n", 90 90 N, *CTS, freq); 91 91 } ··· 131 131 uint8_t length, 132 132 uint8_t *frame) 133 133 { 134 - int i; 135 - frame[0] = packetType + versionNumber + length; 136 - for (i = 1; i <= length; i++) 137 - frame[0] += frame[i]; 138 - frame[0] = 0x100 - frame[0]; 134 + int i; 135 + frame[0] = packetType + versionNumber + length; 136 + for (i = 1; i <= length; i++) 137 + frame[0] += frame[i]; 138 + frame[0] = 0x100 - frame[0]; 139 139 } 140 140 141 141 /* ··· 417 417 WREG32_P(offset+R600_HDMI_CNTL, 0x04000000, ~0x04000000); 418 418 } 419 419 420 - /* 421 - * enable/disable the HDMI engine 422 - */ 423 - void r600_hdmi_enable(struct drm_encoder *encoder, int enable) 420 + static int r600_hdmi_find_free_block(struct drm_device *dev) 421 + { 422 + struct radeon_device *rdev = dev->dev_private; 423 + struct drm_encoder *encoder; 424 + struct radeon_encoder *radeon_encoder; 425 + bool free_blocks[3] = { true, true, true }; 426 + 427 + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 428 + radeon_encoder = to_radeon_encoder(encoder); 429 + switch (radeon_encoder->hdmi_offset) { 430 + case R600_HDMI_BLOCK1: 431 + free_blocks[0] = false; 432 + break; 433 + case R600_HDMI_BLOCK2: 434 + free_blocks[1] = false; 435 + break; 436 + case R600_HDMI_BLOCK3: 437 + free_blocks[2] = false; 438 + break; 439 + } 440 + } 441 + 442 + if (rdev->family == CHIP_RS600 || rdev->family == CHIP_RS690) { 443 + return free_blocks[0] ? R600_HDMI_BLOCK1 : 0; 444 + } else if (rdev->family >= CHIP_R600) { 445 + if (free_blocks[0]) 446 + return R600_HDMI_BLOCK1; 447 + else if (free_blocks[1]) 448 + return R600_HDMI_BLOCK2; 449 + } 450 + return 0; 451 + } 452 + 453 + static void r600_hdmi_assign_block(struct drm_encoder *encoder) 424 454 { 425 455 struct drm_device *dev = encoder->dev; 426 456 struct radeon_device *rdev = dev->dev_private; 427 457 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 428 - uint32_t offset = to_radeon_encoder(encoder)->hdmi_offset; 458 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 429 459 430 - if (!offset) 460 + if (!dig) { 461 + dev_err(rdev->dev, "Enabling HDMI on non-dig encoder\n"); 431 462 return; 463 + } 432 464 433 - DRM_DEBUG("%s HDMI interface @ 0x%04X\n", enable ? "Enabling" : "Disabling", offset); 434 - 435 - /* some version of atombios ignore the enable HDMI flag 436 - * so enabling/disabling HDMI was moved here for TMDS1+2 */ 437 - switch (radeon_encoder->encoder_id) { 438 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 439 - WREG32_P(AVIVO_TMDSA_CNTL, enable ? 0x4 : 0x0, ~0x4); 440 - WREG32(offset+R600_HDMI_ENABLE, enable ? 0x101 : 0x0); 441 - break; 442 - 443 - case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 444 - WREG32_P(AVIVO_LVTMA_CNTL, enable ? 0x4 : 0x0, ~0x4); 445 - WREG32(offset+R600_HDMI_ENABLE, enable ? 0x105 : 0x0); 446 - break; 447 - 448 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 449 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 450 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 451 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: 452 - /* This part is doubtfull in my opinion */ 453 - WREG32(offset+R600_HDMI_ENABLE, enable ? 0x110 : 0x0); 454 - break; 455 - 456 - default: 457 - DRM_ERROR("unknown HDMI output type\n"); 458 - break; 465 + if (ASIC_IS_DCE4(rdev)) { 466 + /* TODO */ 467 + } else if (ASIC_IS_DCE3(rdev)) { 468 + radeon_encoder->hdmi_offset = dig->dig_encoder ? 469 + R600_HDMI_BLOCK3 : R600_HDMI_BLOCK1; 470 + if (ASIC_IS_DCE32(rdev)) 471 + radeon_encoder->hdmi_config_offset = dig->dig_encoder ? 472 + R600_HDMI_CONFIG2 : R600_HDMI_CONFIG1; 473 + } else if (rdev->family >= CHIP_R600) { 474 + radeon_encoder->hdmi_offset = r600_hdmi_find_free_block(dev); 459 475 } 460 476 } 461 477 462 478 /* 463 - * determin at which register offset the HDMI encoder is 479 + * enable the HDMI engine 464 480 */ 465 - void r600_hdmi_init(struct drm_encoder *encoder) 481 + void r600_hdmi_enable(struct drm_encoder *encoder) 466 482 { 483 + struct drm_device *dev = encoder->dev; 484 + struct radeon_device *rdev = dev->dev_private; 467 485 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 468 486 469 - switch (radeon_encoder->encoder_id) { 470 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 471 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 472 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 473 - radeon_encoder->hdmi_offset = R600_HDMI_TMDS1; 474 - break; 475 - 476 - case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 477 - switch (r600_audio_tmds_index(encoder)) { 478 - case 0: 479 - radeon_encoder->hdmi_offset = R600_HDMI_TMDS1; 480 - break; 481 - case 1: 482 - radeon_encoder->hdmi_offset = R600_HDMI_TMDS2; 483 - break; 484 - default: 485 - radeon_encoder->hdmi_offset = 0; 486 - break; 487 + if (!radeon_encoder->hdmi_offset) { 488 + r600_hdmi_assign_block(encoder); 489 + if (!radeon_encoder->hdmi_offset) { 490 + dev_warn(rdev->dev, "Could not find HDMI block for " 491 + "0x%x encoder\n", radeon_encoder->encoder_id); 492 + return; 487 493 } 488 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 489 - radeon_encoder->hdmi_offset = R600_HDMI_TMDS2; 490 - break; 491 - 492 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: 493 - radeon_encoder->hdmi_offset = R600_HDMI_DIG; 494 - break; 495 - 496 - default: 497 - radeon_encoder->hdmi_offset = 0; 498 - break; 499 494 } 500 495 501 - DRM_DEBUG("using HDMI engine at offset 0x%04X for encoder 0x%x\n", 502 - radeon_encoder->hdmi_offset, radeon_encoder->encoder_id); 496 + if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) { 497 + WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0x1, ~0x1); 498 + } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { 499 + int offset = radeon_encoder->hdmi_offset; 500 + switch (radeon_encoder->encoder_id) { 501 + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 502 + WREG32_P(AVIVO_TMDSA_CNTL, 0x4, ~0x4); 503 + WREG32(offset + R600_HDMI_ENABLE, 0x101); 504 + break; 505 + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 506 + WREG32_P(AVIVO_LVTMA_CNTL, 0x4, ~0x4); 507 + WREG32(offset + R600_HDMI_ENABLE, 0x105); 508 + break; 509 + default: 510 + dev_err(rdev->dev, "Unknown HDMI output type\n"); 511 + break; 512 + } 513 + } 503 514 504 - /* TODO: make this configureable */ 505 - radeon_encoder->hdmi_audio_workaround = 0; 515 + DRM_DEBUG("Enabling HDMI interface @ 0x%04X for encoder 0x%x\n", 516 + radeon_encoder->hdmi_offset, radeon_encoder->encoder_id); 517 + } 518 + 519 + /* 520 + * disable the HDMI engine 521 + */ 522 + void r600_hdmi_disable(struct drm_encoder *encoder) 523 + { 524 + struct drm_device *dev = encoder->dev; 525 + struct radeon_device *rdev = dev->dev_private; 526 + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 527 + 528 + if (!radeon_encoder->hdmi_offset) { 529 + dev_err(rdev->dev, "Disabling not enabled HDMI\n"); 530 + return; 531 + } 532 + 533 + DRM_DEBUG("Disabling HDMI interface @ 0x%04X for encoder 0x%x\n", 534 + radeon_encoder->hdmi_offset, radeon_encoder->encoder_id); 535 + 536 + if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) { 537 + WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0, ~0x1); 538 + } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { 539 + int offset = radeon_encoder->hdmi_offset; 540 + switch (radeon_encoder->encoder_id) { 541 + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 542 + WREG32_P(AVIVO_TMDSA_CNTL, 0, ~0x4); 543 + WREG32(offset + R600_HDMI_ENABLE, 0); 544 + break; 545 + case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 546 + WREG32_P(AVIVO_LVTMA_CNTL, 0, ~0x4); 547 + WREG32(offset + R600_HDMI_ENABLE, 0); 548 + break; 549 + default: 550 + dev_err(rdev->dev, "Unknown HDMI output type\n"); 551 + break; 552 + } 553 + } 554 + 555 + radeon_encoder->hdmi_offset = 0; 556 + radeon_encoder->hdmi_config_offset = 0; 506 557 }
+7 -3
drivers/gpu/drm/radeon/r600_reg.h
··· 152 152 #define R600_AUDIO_STATUS_BITS 0x73d8 153 153 154 154 /* HDMI base register addresses */ 155 - #define R600_HDMI_TMDS1 0x7400 156 - #define R600_HDMI_TMDS2 0x7700 157 - #define R600_HDMI_DIG 0x7800 155 + #define R600_HDMI_BLOCK1 0x7400 156 + #define R600_HDMI_BLOCK2 0x7700 157 + #define R600_HDMI_BLOCK3 0x7800 158 158 159 159 /* HDMI registers */ 160 160 #define R600_HDMI_ENABLE 0x00 ··· 184 184 #define R600_HDMI_AUDIO_DEBUG_1 0xe4 185 185 #define R600_HDMI_AUDIO_DEBUG_2 0xe8 186 186 #define R600_HDMI_AUDIO_DEBUG_3 0xec 187 + 188 + /* HDMI additional config base register addresses */ 189 + #define R600_HDMI_CONFIG1 0x7600 190 + #define R600_HDMI_CONFIG2 0x7a00 187 191 188 192 #endif
+49
drivers/gpu/drm/radeon/r600d.h
··· 77 77 #define CB_COLOR0_FRAG 0x280e0 78 78 #define CB_COLOR0_MASK 0x28100 79 79 80 + #define SQ_ALU_CONST_CACHE_PS_0 0x28940 81 + #define SQ_ALU_CONST_CACHE_PS_1 0x28944 82 + #define SQ_ALU_CONST_CACHE_PS_2 0x28948 83 + #define SQ_ALU_CONST_CACHE_PS_3 0x2894c 84 + #define SQ_ALU_CONST_CACHE_PS_4 0x28950 85 + #define SQ_ALU_CONST_CACHE_PS_5 0x28954 86 + #define SQ_ALU_CONST_CACHE_PS_6 0x28958 87 + #define SQ_ALU_CONST_CACHE_PS_7 0x2895c 88 + #define SQ_ALU_CONST_CACHE_PS_8 0x28960 89 + #define SQ_ALU_CONST_CACHE_PS_9 0x28964 90 + #define SQ_ALU_CONST_CACHE_PS_10 0x28968 91 + #define SQ_ALU_CONST_CACHE_PS_11 0x2896c 92 + #define SQ_ALU_CONST_CACHE_PS_12 0x28970 93 + #define SQ_ALU_CONST_CACHE_PS_13 0x28974 94 + #define SQ_ALU_CONST_CACHE_PS_14 0x28978 95 + #define SQ_ALU_CONST_CACHE_PS_15 0x2897c 96 + #define SQ_ALU_CONST_CACHE_VS_0 0x28980 97 + #define SQ_ALU_CONST_CACHE_VS_1 0x28984 98 + #define SQ_ALU_CONST_CACHE_VS_2 0x28988 99 + #define SQ_ALU_CONST_CACHE_VS_3 0x2898c 100 + #define SQ_ALU_CONST_CACHE_VS_4 0x28990 101 + #define SQ_ALU_CONST_CACHE_VS_5 0x28994 102 + #define SQ_ALU_CONST_CACHE_VS_6 0x28998 103 + #define SQ_ALU_CONST_CACHE_VS_7 0x2899c 104 + #define SQ_ALU_CONST_CACHE_VS_8 0x289a0 105 + #define SQ_ALU_CONST_CACHE_VS_9 0x289a4 106 + #define SQ_ALU_CONST_CACHE_VS_10 0x289a8 107 + #define SQ_ALU_CONST_CACHE_VS_11 0x289ac 108 + #define SQ_ALU_CONST_CACHE_VS_12 0x289b0 109 + #define SQ_ALU_CONST_CACHE_VS_13 0x289b4 110 + #define SQ_ALU_CONST_CACHE_VS_14 0x289b8 111 + #define SQ_ALU_CONST_CACHE_VS_15 0x289bc 112 + #define SQ_ALU_CONST_CACHE_GS_0 0x289c0 113 + #define SQ_ALU_CONST_CACHE_GS_1 0x289c4 114 + #define SQ_ALU_CONST_CACHE_GS_2 0x289c8 115 + #define SQ_ALU_CONST_CACHE_GS_3 0x289cc 116 + #define SQ_ALU_CONST_CACHE_GS_4 0x289d0 117 + #define SQ_ALU_CONST_CACHE_GS_5 0x289d4 118 + #define SQ_ALU_CONST_CACHE_GS_6 0x289d8 119 + #define SQ_ALU_CONST_CACHE_GS_7 0x289dc 120 + #define SQ_ALU_CONST_CACHE_GS_8 0x289e0 121 + #define SQ_ALU_CONST_CACHE_GS_9 0x289e4 122 + #define SQ_ALU_CONST_CACHE_GS_10 0x289e8 123 + #define SQ_ALU_CONST_CACHE_GS_11 0x289ec 124 + #define SQ_ALU_CONST_CACHE_GS_12 0x289f0 125 + #define SQ_ALU_CONST_CACHE_GS_13 0x289f4 126 + #define SQ_ALU_CONST_CACHE_GS_14 0x289f8 127 + #define SQ_ALU_CONST_CACHE_GS_15 0x289fc 128 + 80 129 #define CONFIG_MEMSIZE 0x5428 81 130 #define CONFIG_CNTL 0x5424 82 131 #define CP_STAT 0x8680
+17 -49
drivers/gpu/drm/radeon/radeon.h
··· 91 91 extern int radeon_new_pll; 92 92 extern int radeon_dynpm; 93 93 extern int radeon_audio; 94 + extern int radeon_disp_priority; 95 + extern int radeon_hw_i2c; 94 96 95 97 /* 96 98 * Copy from radeon_drv.h so we don't have to include both and have conflicting ··· 170 168 * Power management 171 169 */ 172 170 int radeon_pm_init(struct radeon_device *rdev); 171 + void radeon_pm_fini(struct radeon_device *rdev); 173 172 void radeon_pm_compute_clocks(struct radeon_device *rdev); 174 173 void radeon_combios_get_power_modes(struct radeon_device *rdev); 175 174 void radeon_atombios_get_power_modes(struct radeon_device *rdev); ··· 690 687 bool downclocked; 691 688 int active_crtcs; 692 689 int req_vblank; 690 + bool vblank_sync; 693 691 fixed20_12 max_bandwidth; 694 692 fixed20_12 igp_sideport_mclk; 695 693 fixed20_12 igp_system_mclk; ··· 701 697 fixed20_12 ht_bandwidth; 702 698 fixed20_12 core_bandwidth; 703 699 fixed20_12 sclk; 700 + fixed20_12 mclk; 704 701 fixed20_12 needed_bandwidth; 705 702 /* XXX: use a define for num power modes */ 706 703 struct radeon_power_state power_state[8]; ··· 712 707 struct radeon_power_state *requested_power_state; 713 708 struct radeon_pm_clock_info *requested_clock_mode; 714 709 struct radeon_power_state *default_power_state; 710 + struct radeon_i2c_chan *i2c_bus; 715 711 }; 716 712 717 713 ··· 735 729 struct drm_info_list *files, 736 730 unsigned nfiles); 737 731 int radeon_debugfs_fence_init(struct radeon_device *rdev); 738 - int r100_debugfs_rbbm_init(struct radeon_device *rdev); 739 - int r100_debugfs_cp_init(struct radeon_device *rdev); 740 732 741 733 742 734 /* ··· 786 782 int (*set_surface_reg)(struct radeon_device *rdev, int reg, 787 783 uint32_t tiling_flags, uint32_t pitch, 788 784 uint32_t offset, uint32_t obj_size); 789 - int (*clear_surface_reg)(struct radeon_device *rdev, int reg); 785 + void (*clear_surface_reg)(struct radeon_device *rdev, int reg); 790 786 void (*bandwidth_update)(struct radeon_device *rdev); 791 787 void (*hpd_init)(struct radeon_device *rdev); 792 788 void (*hpd_fini)(struct radeon_device *rdev); ··· 865 861 struct r600_asic r600; 866 862 struct rv770_asic rv770; 867 863 }; 864 + 865 + /* 866 + * asic initizalization from radeon_asic.c 867 + */ 868 + void radeon_agp_disable(struct radeon_device *rdev); 869 + int radeon_asic_init(struct radeon_device *rdev); 868 870 869 871 870 872 /* ··· 1182 1172 extern int radeon_modeset_init(struct radeon_device *rdev); 1183 1173 extern void radeon_modeset_fini(struct radeon_device *rdev); 1184 1174 extern bool radeon_card_posted(struct radeon_device *rdev); 1175 + extern void radeon_update_bandwidth_info(struct radeon_device *rdev); 1176 + extern void radeon_update_display_priority(struct radeon_device *rdev); 1185 1177 extern bool radeon_boot_test_post_card(struct radeon_device *rdev); 1186 1178 extern int radeon_clocks_init(struct radeon_device *rdev); 1187 1179 extern void radeon_clocks_fini(struct radeon_device *rdev); ··· 1200 1188 extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state); 1201 1189 1202 1190 /* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ 1203 - struct r100_mc_save { 1204 - u32 GENMO_WT; 1205 - u32 CRTC_EXT_CNTL; 1206 - u32 CRTC_GEN_CNTL; 1207 - u32 CRTC2_GEN_CNTL; 1208 - u32 CUR_OFFSET; 1209 - u32 CUR2_OFFSET; 1210 - }; 1211 - extern void r100_cp_disable(struct radeon_device *rdev); 1212 - extern int r100_cp_init(struct radeon_device *rdev, unsigned ring_size); 1213 - extern void r100_cp_fini(struct radeon_device *rdev); 1214 - extern void r100_pci_gart_tlb_flush(struct radeon_device *rdev); 1215 - extern int r100_pci_gart_init(struct radeon_device *rdev); 1216 - extern void r100_pci_gart_fini(struct radeon_device *rdev); 1217 - extern int r100_pci_gart_enable(struct radeon_device *rdev); 1218 - extern void r100_pci_gart_disable(struct radeon_device *rdev); 1219 - extern int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr); 1220 - extern int r100_debugfs_mc_info_init(struct radeon_device *rdev); 1221 - extern int r100_gui_wait_for_idle(struct radeon_device *rdev); 1222 - extern void r100_ib_fini(struct radeon_device *rdev); 1223 - extern int r100_ib_init(struct radeon_device *rdev); 1224 - extern void r100_irq_disable(struct radeon_device *rdev); 1225 - extern int r100_irq_set(struct radeon_device *rdev); 1226 - extern void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save); 1227 - extern void r100_mc_resume(struct radeon_device *rdev, struct r100_mc_save *save); 1228 - extern void r100_vram_init_sizes(struct radeon_device *rdev); 1229 - extern void r100_wb_disable(struct radeon_device *rdev); 1230 - extern void r100_wb_fini(struct radeon_device *rdev); 1231 - extern int r100_wb_init(struct radeon_device *rdev); 1232 - extern void r100_hdp_reset(struct radeon_device *rdev); 1233 - extern int r100_rb2d_reset(struct radeon_device *rdev); 1234 - extern int r100_cp_reset(struct radeon_device *rdev); 1235 - extern void r100_vga_render_disable(struct radeon_device *rdev); 1236 - extern int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p, 1237 - struct radeon_cs_packet *pkt, 1238 - struct radeon_bo *robj); 1239 - extern int r100_cs_parse_packet0(struct radeon_cs_parser *p, 1240 - struct radeon_cs_packet *pkt, 1241 - const unsigned *auth, unsigned n, 1242 - radeon_packet0_check_t check); 1243 - extern int r100_cs_packet_parse(struct radeon_cs_parser *p, 1244 - struct radeon_cs_packet *pkt, 1245 - unsigned idx); 1246 - extern void r100_enable_bm(struct radeon_device *rdev); 1247 - extern void r100_set_common_regs(struct radeon_device *rdev); 1248 1191 1249 1192 /* rv200,rv250,rv280 */ 1250 1193 extern void r200_set_safe_registers(struct radeon_device *rdev); ··· 1289 1322 extern void r600_audio_set_clock(struct drm_encoder *encoder, int clock); 1290 1323 extern void r600_audio_fini(struct radeon_device *rdev); 1291 1324 extern void r600_hdmi_init(struct drm_encoder *encoder); 1292 - extern void r600_hdmi_enable(struct drm_encoder *encoder, int enable); 1325 + extern void r600_hdmi_enable(struct drm_encoder *encoder); 1326 + extern void r600_hdmi_disable(struct drm_encoder *encoder); 1293 1327 extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); 1294 1328 extern int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder); 1295 1329 extern void r600_hdmi_update_audio_settings(struct drm_encoder *encoder,
+772
drivers/gpu/drm/radeon/radeon_asic.c
··· 1 + /* 2 + * Copyright 2008 Advanced Micro Devices, Inc. 3 + * Copyright 2008 Red Hat Inc. 4 + * Copyright 2009 Jerome Glisse. 5 + * 6 + * Permission is hereby granted, free of charge, to any person obtaining a 7 + * copy of this software and associated documentation files (the "Software"), 8 + * to deal in the Software without restriction, including without limitation 9 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 + * and/or sell copies of the Software, and to permit persons to whom the 11 + * Software is furnished to do so, subject to the following conditions: 12 + * 13 + * The above copyright notice and this permission notice shall be included in 14 + * all copies or substantial portions of the Software. 15 + * 16 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 + * OTHER DEALINGS IN THE SOFTWARE. 23 + * 24 + * Authors: Dave Airlie 25 + * Alex Deucher 26 + * Jerome Glisse 27 + */ 28 + 29 + #include <linux/console.h> 30 + #include <drm/drmP.h> 31 + #include <drm/drm_crtc_helper.h> 32 + #include <drm/radeon_drm.h> 33 + #include <linux/vgaarb.h> 34 + #include <linux/vga_switcheroo.h> 35 + #include "radeon_reg.h" 36 + #include "radeon.h" 37 + #include "radeon_asic.h" 38 + #include "atom.h" 39 + 40 + /* 41 + * Registers accessors functions. 42 + */ 43 + static uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg) 44 + { 45 + DRM_ERROR("Invalid callback to read register 0x%04X\n", reg); 46 + BUG_ON(1); 47 + return 0; 48 + } 49 + 50 + static void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) 51 + { 52 + DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n", 53 + reg, v); 54 + BUG_ON(1); 55 + } 56 + 57 + static void radeon_register_accessor_init(struct radeon_device *rdev) 58 + { 59 + rdev->mc_rreg = &radeon_invalid_rreg; 60 + rdev->mc_wreg = &radeon_invalid_wreg; 61 + rdev->pll_rreg = &radeon_invalid_rreg; 62 + rdev->pll_wreg = &radeon_invalid_wreg; 63 + rdev->pciep_rreg = &radeon_invalid_rreg; 64 + rdev->pciep_wreg = &radeon_invalid_wreg; 65 + 66 + /* Don't change order as we are overridding accessor. */ 67 + if (rdev->family < CHIP_RV515) { 68 + rdev->pcie_reg_mask = 0xff; 69 + } else { 70 + rdev->pcie_reg_mask = 0x7ff; 71 + } 72 + /* FIXME: not sure here */ 73 + if (rdev->family <= CHIP_R580) { 74 + rdev->pll_rreg = &r100_pll_rreg; 75 + rdev->pll_wreg = &r100_pll_wreg; 76 + } 77 + if (rdev->family >= CHIP_R420) { 78 + rdev->mc_rreg = &r420_mc_rreg; 79 + rdev->mc_wreg = &r420_mc_wreg; 80 + } 81 + if (rdev->family >= CHIP_RV515) { 82 + rdev->mc_rreg = &rv515_mc_rreg; 83 + rdev->mc_wreg = &rv515_mc_wreg; 84 + } 85 + if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) { 86 + rdev->mc_rreg = &rs400_mc_rreg; 87 + rdev->mc_wreg = &rs400_mc_wreg; 88 + } 89 + if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) { 90 + rdev->mc_rreg = &rs690_mc_rreg; 91 + rdev->mc_wreg = &rs690_mc_wreg; 92 + } 93 + if (rdev->family == CHIP_RS600) { 94 + rdev->mc_rreg = &rs600_mc_rreg; 95 + rdev->mc_wreg = &rs600_mc_wreg; 96 + } 97 + if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_RV740)) { 98 + rdev->pciep_rreg = &r600_pciep_rreg; 99 + rdev->pciep_wreg = &r600_pciep_wreg; 100 + } 101 + } 102 + 103 + 104 + /* helper to disable agp */ 105 + void radeon_agp_disable(struct radeon_device *rdev) 106 + { 107 + rdev->flags &= ~RADEON_IS_AGP; 108 + if (rdev->family >= CHIP_R600) { 109 + DRM_INFO("Forcing AGP to PCIE mode\n"); 110 + rdev->flags |= RADEON_IS_PCIE; 111 + } else if (rdev->family >= CHIP_RV515 || 112 + rdev->family == CHIP_RV380 || 113 + rdev->family == CHIP_RV410 || 114 + rdev->family == CHIP_R423) { 115 + DRM_INFO("Forcing AGP to PCIE mode\n"); 116 + rdev->flags |= RADEON_IS_PCIE; 117 + rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush; 118 + rdev->asic->gart_set_page = &rv370_pcie_gart_set_page; 119 + } else { 120 + DRM_INFO("Forcing AGP to PCI mode\n"); 121 + rdev->flags |= RADEON_IS_PCI; 122 + rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush; 123 + rdev->asic->gart_set_page = &r100_pci_gart_set_page; 124 + } 125 + rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; 126 + } 127 + 128 + /* 129 + * ASIC 130 + */ 131 + static struct radeon_asic r100_asic = { 132 + .init = &r100_init, 133 + .fini = &r100_fini, 134 + .suspend = &r100_suspend, 135 + .resume = &r100_resume, 136 + .vga_set_state = &r100_vga_set_state, 137 + .gpu_reset = &r100_gpu_reset, 138 + .gart_tlb_flush = &r100_pci_gart_tlb_flush, 139 + .gart_set_page = &r100_pci_gart_set_page, 140 + .cp_commit = &r100_cp_commit, 141 + .ring_start = &r100_ring_start, 142 + .ring_test = &r100_ring_test, 143 + .ring_ib_execute = &r100_ring_ib_execute, 144 + .irq_set = &r100_irq_set, 145 + .irq_process = &r100_irq_process, 146 + .get_vblank_counter = &r100_get_vblank_counter, 147 + .fence_ring_emit = &r100_fence_ring_emit, 148 + .cs_parse = &r100_cs_parse, 149 + .copy_blit = &r100_copy_blit, 150 + .copy_dma = NULL, 151 + .copy = &r100_copy_blit, 152 + .get_engine_clock = &radeon_legacy_get_engine_clock, 153 + .set_engine_clock = &radeon_legacy_set_engine_clock, 154 + .get_memory_clock = &radeon_legacy_get_memory_clock, 155 + .set_memory_clock = NULL, 156 + .get_pcie_lanes = NULL, 157 + .set_pcie_lanes = NULL, 158 + .set_clock_gating = &radeon_legacy_set_clock_gating, 159 + .set_surface_reg = r100_set_surface_reg, 160 + .clear_surface_reg = r100_clear_surface_reg, 161 + .bandwidth_update = &r100_bandwidth_update, 162 + .hpd_init = &r100_hpd_init, 163 + .hpd_fini = &r100_hpd_fini, 164 + .hpd_sense = &r100_hpd_sense, 165 + .hpd_set_polarity = &r100_hpd_set_polarity, 166 + .ioctl_wait_idle = NULL, 167 + }; 168 + 169 + static struct radeon_asic r200_asic = { 170 + .init = &r100_init, 171 + .fini = &r100_fini, 172 + .suspend = &r100_suspend, 173 + .resume = &r100_resume, 174 + .vga_set_state = &r100_vga_set_state, 175 + .gpu_reset = &r100_gpu_reset, 176 + .gart_tlb_flush = &r100_pci_gart_tlb_flush, 177 + .gart_set_page = &r100_pci_gart_set_page, 178 + .cp_commit = &r100_cp_commit, 179 + .ring_start = &r100_ring_start, 180 + .ring_test = &r100_ring_test, 181 + .ring_ib_execute = &r100_ring_ib_execute, 182 + .irq_set = &r100_irq_set, 183 + .irq_process = &r100_irq_process, 184 + .get_vblank_counter = &r100_get_vblank_counter, 185 + .fence_ring_emit = &r100_fence_ring_emit, 186 + .cs_parse = &r100_cs_parse, 187 + .copy_blit = &r100_copy_blit, 188 + .copy_dma = &r200_copy_dma, 189 + .copy = &r100_copy_blit, 190 + .get_engine_clock = &radeon_legacy_get_engine_clock, 191 + .set_engine_clock = &radeon_legacy_set_engine_clock, 192 + .get_memory_clock = &radeon_legacy_get_memory_clock, 193 + .set_memory_clock = NULL, 194 + .set_pcie_lanes = NULL, 195 + .set_clock_gating = &radeon_legacy_set_clock_gating, 196 + .set_surface_reg = r100_set_surface_reg, 197 + .clear_surface_reg = r100_clear_surface_reg, 198 + .bandwidth_update = &r100_bandwidth_update, 199 + .hpd_init = &r100_hpd_init, 200 + .hpd_fini = &r100_hpd_fini, 201 + .hpd_sense = &r100_hpd_sense, 202 + .hpd_set_polarity = &r100_hpd_set_polarity, 203 + .ioctl_wait_idle = NULL, 204 + }; 205 + 206 + static struct radeon_asic r300_asic = { 207 + .init = &r300_init, 208 + .fini = &r300_fini, 209 + .suspend = &r300_suspend, 210 + .resume = &r300_resume, 211 + .vga_set_state = &r100_vga_set_state, 212 + .gpu_reset = &r300_gpu_reset, 213 + .gart_tlb_flush = &r100_pci_gart_tlb_flush, 214 + .gart_set_page = &r100_pci_gart_set_page, 215 + .cp_commit = &r100_cp_commit, 216 + .ring_start = &r300_ring_start, 217 + .ring_test = &r100_ring_test, 218 + .ring_ib_execute = &r100_ring_ib_execute, 219 + .irq_set = &r100_irq_set, 220 + .irq_process = &r100_irq_process, 221 + .get_vblank_counter = &r100_get_vblank_counter, 222 + .fence_ring_emit = &r300_fence_ring_emit, 223 + .cs_parse = &r300_cs_parse, 224 + .copy_blit = &r100_copy_blit, 225 + .copy_dma = &r200_copy_dma, 226 + .copy = &r100_copy_blit, 227 + .get_engine_clock = &radeon_legacy_get_engine_clock, 228 + .set_engine_clock = &radeon_legacy_set_engine_clock, 229 + .get_memory_clock = &radeon_legacy_get_memory_clock, 230 + .set_memory_clock = NULL, 231 + .get_pcie_lanes = &rv370_get_pcie_lanes, 232 + .set_pcie_lanes = &rv370_set_pcie_lanes, 233 + .set_clock_gating = &radeon_legacy_set_clock_gating, 234 + .set_surface_reg = r100_set_surface_reg, 235 + .clear_surface_reg = r100_clear_surface_reg, 236 + .bandwidth_update = &r100_bandwidth_update, 237 + .hpd_init = &r100_hpd_init, 238 + .hpd_fini = &r100_hpd_fini, 239 + .hpd_sense = &r100_hpd_sense, 240 + .hpd_set_polarity = &r100_hpd_set_polarity, 241 + .ioctl_wait_idle = NULL, 242 + }; 243 + 244 + static struct radeon_asic r300_asic_pcie = { 245 + .init = &r300_init, 246 + .fini = &r300_fini, 247 + .suspend = &r300_suspend, 248 + .resume = &r300_resume, 249 + .vga_set_state = &r100_vga_set_state, 250 + .gpu_reset = &r300_gpu_reset, 251 + .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 252 + .gart_set_page = &rv370_pcie_gart_set_page, 253 + .cp_commit = &r100_cp_commit, 254 + .ring_start = &r300_ring_start, 255 + .ring_test = &r100_ring_test, 256 + .ring_ib_execute = &r100_ring_ib_execute, 257 + .irq_set = &r100_irq_set, 258 + .irq_process = &r100_irq_process, 259 + .get_vblank_counter = &r100_get_vblank_counter, 260 + .fence_ring_emit = &r300_fence_ring_emit, 261 + .cs_parse = &r300_cs_parse, 262 + .copy_blit = &r100_copy_blit, 263 + .copy_dma = &r200_copy_dma, 264 + .copy = &r100_copy_blit, 265 + .get_engine_clock = &radeon_legacy_get_engine_clock, 266 + .set_engine_clock = &radeon_legacy_set_engine_clock, 267 + .get_memory_clock = &radeon_legacy_get_memory_clock, 268 + .set_memory_clock = NULL, 269 + .set_pcie_lanes = &rv370_set_pcie_lanes, 270 + .set_clock_gating = &radeon_legacy_set_clock_gating, 271 + .set_surface_reg = r100_set_surface_reg, 272 + .clear_surface_reg = r100_clear_surface_reg, 273 + .bandwidth_update = &r100_bandwidth_update, 274 + .hpd_init = &r100_hpd_init, 275 + .hpd_fini = &r100_hpd_fini, 276 + .hpd_sense = &r100_hpd_sense, 277 + .hpd_set_polarity = &r100_hpd_set_polarity, 278 + .ioctl_wait_idle = NULL, 279 + }; 280 + 281 + static struct radeon_asic r420_asic = { 282 + .init = &r420_init, 283 + .fini = &r420_fini, 284 + .suspend = &r420_suspend, 285 + .resume = &r420_resume, 286 + .vga_set_state = &r100_vga_set_state, 287 + .gpu_reset = &r300_gpu_reset, 288 + .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 289 + .gart_set_page = &rv370_pcie_gart_set_page, 290 + .cp_commit = &r100_cp_commit, 291 + .ring_start = &r300_ring_start, 292 + .ring_test = &r100_ring_test, 293 + .ring_ib_execute = &r100_ring_ib_execute, 294 + .irq_set = &r100_irq_set, 295 + .irq_process = &r100_irq_process, 296 + .get_vblank_counter = &r100_get_vblank_counter, 297 + .fence_ring_emit = &r300_fence_ring_emit, 298 + .cs_parse = &r300_cs_parse, 299 + .copy_blit = &r100_copy_blit, 300 + .copy_dma = &r200_copy_dma, 301 + .copy = &r100_copy_blit, 302 + .get_engine_clock = &radeon_atom_get_engine_clock, 303 + .set_engine_clock = &radeon_atom_set_engine_clock, 304 + .get_memory_clock = &radeon_atom_get_memory_clock, 305 + .set_memory_clock = &radeon_atom_set_memory_clock, 306 + .get_pcie_lanes = &rv370_get_pcie_lanes, 307 + .set_pcie_lanes = &rv370_set_pcie_lanes, 308 + .set_clock_gating = &radeon_atom_set_clock_gating, 309 + .set_surface_reg = r100_set_surface_reg, 310 + .clear_surface_reg = r100_clear_surface_reg, 311 + .bandwidth_update = &r100_bandwidth_update, 312 + .hpd_init = &r100_hpd_init, 313 + .hpd_fini = &r100_hpd_fini, 314 + .hpd_sense = &r100_hpd_sense, 315 + .hpd_set_polarity = &r100_hpd_set_polarity, 316 + .ioctl_wait_idle = NULL, 317 + }; 318 + 319 + static struct radeon_asic rs400_asic = { 320 + .init = &rs400_init, 321 + .fini = &rs400_fini, 322 + .suspend = &rs400_suspend, 323 + .resume = &rs400_resume, 324 + .vga_set_state = &r100_vga_set_state, 325 + .gpu_reset = &r300_gpu_reset, 326 + .gart_tlb_flush = &rs400_gart_tlb_flush, 327 + .gart_set_page = &rs400_gart_set_page, 328 + .cp_commit = &r100_cp_commit, 329 + .ring_start = &r300_ring_start, 330 + .ring_test = &r100_ring_test, 331 + .ring_ib_execute = &r100_ring_ib_execute, 332 + .irq_set = &r100_irq_set, 333 + .irq_process = &r100_irq_process, 334 + .get_vblank_counter = &r100_get_vblank_counter, 335 + .fence_ring_emit = &r300_fence_ring_emit, 336 + .cs_parse = &r300_cs_parse, 337 + .copy_blit = &r100_copy_blit, 338 + .copy_dma = &r200_copy_dma, 339 + .copy = &r100_copy_blit, 340 + .get_engine_clock = &radeon_legacy_get_engine_clock, 341 + .set_engine_clock = &radeon_legacy_set_engine_clock, 342 + .get_memory_clock = &radeon_legacy_get_memory_clock, 343 + .set_memory_clock = NULL, 344 + .get_pcie_lanes = NULL, 345 + .set_pcie_lanes = NULL, 346 + .set_clock_gating = &radeon_legacy_set_clock_gating, 347 + .set_surface_reg = r100_set_surface_reg, 348 + .clear_surface_reg = r100_clear_surface_reg, 349 + .bandwidth_update = &r100_bandwidth_update, 350 + .hpd_init = &r100_hpd_init, 351 + .hpd_fini = &r100_hpd_fini, 352 + .hpd_sense = &r100_hpd_sense, 353 + .hpd_set_polarity = &r100_hpd_set_polarity, 354 + .ioctl_wait_idle = NULL, 355 + }; 356 + 357 + static struct radeon_asic rs600_asic = { 358 + .init = &rs600_init, 359 + .fini = &rs600_fini, 360 + .suspend = &rs600_suspend, 361 + .resume = &rs600_resume, 362 + .vga_set_state = &r100_vga_set_state, 363 + .gpu_reset = &r300_gpu_reset, 364 + .gart_tlb_flush = &rs600_gart_tlb_flush, 365 + .gart_set_page = &rs600_gart_set_page, 366 + .cp_commit = &r100_cp_commit, 367 + .ring_start = &r300_ring_start, 368 + .ring_test = &r100_ring_test, 369 + .ring_ib_execute = &r100_ring_ib_execute, 370 + .irq_set = &rs600_irq_set, 371 + .irq_process = &rs600_irq_process, 372 + .get_vblank_counter = &rs600_get_vblank_counter, 373 + .fence_ring_emit = &r300_fence_ring_emit, 374 + .cs_parse = &r300_cs_parse, 375 + .copy_blit = &r100_copy_blit, 376 + .copy_dma = &r200_copy_dma, 377 + .copy = &r100_copy_blit, 378 + .get_engine_clock = &radeon_atom_get_engine_clock, 379 + .set_engine_clock = &radeon_atom_set_engine_clock, 380 + .get_memory_clock = &radeon_atom_get_memory_clock, 381 + .set_memory_clock = &radeon_atom_set_memory_clock, 382 + .get_pcie_lanes = NULL, 383 + .set_pcie_lanes = NULL, 384 + .set_clock_gating = &radeon_atom_set_clock_gating, 385 + .set_surface_reg = r100_set_surface_reg, 386 + .clear_surface_reg = r100_clear_surface_reg, 387 + .bandwidth_update = &rs600_bandwidth_update, 388 + .hpd_init = &rs600_hpd_init, 389 + .hpd_fini = &rs600_hpd_fini, 390 + .hpd_sense = &rs600_hpd_sense, 391 + .hpd_set_polarity = &rs600_hpd_set_polarity, 392 + .ioctl_wait_idle = NULL, 393 + }; 394 + 395 + static struct radeon_asic rs690_asic = { 396 + .init = &rs690_init, 397 + .fini = &rs690_fini, 398 + .suspend = &rs690_suspend, 399 + .resume = &rs690_resume, 400 + .vga_set_state = &r100_vga_set_state, 401 + .gpu_reset = &r300_gpu_reset, 402 + .gart_tlb_flush = &rs400_gart_tlb_flush, 403 + .gart_set_page = &rs400_gart_set_page, 404 + .cp_commit = &r100_cp_commit, 405 + .ring_start = &r300_ring_start, 406 + .ring_test = &r100_ring_test, 407 + .ring_ib_execute = &r100_ring_ib_execute, 408 + .irq_set = &rs600_irq_set, 409 + .irq_process = &rs600_irq_process, 410 + .get_vblank_counter = &rs600_get_vblank_counter, 411 + .fence_ring_emit = &r300_fence_ring_emit, 412 + .cs_parse = &r300_cs_parse, 413 + .copy_blit = &r100_copy_blit, 414 + .copy_dma = &r200_copy_dma, 415 + .copy = &r200_copy_dma, 416 + .get_engine_clock = &radeon_atom_get_engine_clock, 417 + .set_engine_clock = &radeon_atom_set_engine_clock, 418 + .get_memory_clock = &radeon_atom_get_memory_clock, 419 + .set_memory_clock = &radeon_atom_set_memory_clock, 420 + .get_pcie_lanes = NULL, 421 + .set_pcie_lanes = NULL, 422 + .set_clock_gating = &radeon_atom_set_clock_gating, 423 + .set_surface_reg = r100_set_surface_reg, 424 + .clear_surface_reg = r100_clear_surface_reg, 425 + .bandwidth_update = &rs690_bandwidth_update, 426 + .hpd_init = &rs600_hpd_init, 427 + .hpd_fini = &rs600_hpd_fini, 428 + .hpd_sense = &rs600_hpd_sense, 429 + .hpd_set_polarity = &rs600_hpd_set_polarity, 430 + .ioctl_wait_idle = NULL, 431 + }; 432 + 433 + static struct radeon_asic rv515_asic = { 434 + .init = &rv515_init, 435 + .fini = &rv515_fini, 436 + .suspend = &rv515_suspend, 437 + .resume = &rv515_resume, 438 + .vga_set_state = &r100_vga_set_state, 439 + .gpu_reset = &rv515_gpu_reset, 440 + .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 441 + .gart_set_page = &rv370_pcie_gart_set_page, 442 + .cp_commit = &r100_cp_commit, 443 + .ring_start = &rv515_ring_start, 444 + .ring_test = &r100_ring_test, 445 + .ring_ib_execute = &r100_ring_ib_execute, 446 + .irq_set = &rs600_irq_set, 447 + .irq_process = &rs600_irq_process, 448 + .get_vblank_counter = &rs600_get_vblank_counter, 449 + .fence_ring_emit = &r300_fence_ring_emit, 450 + .cs_parse = &r300_cs_parse, 451 + .copy_blit = &r100_copy_blit, 452 + .copy_dma = &r200_copy_dma, 453 + .copy = &r100_copy_blit, 454 + .get_engine_clock = &radeon_atom_get_engine_clock, 455 + .set_engine_clock = &radeon_atom_set_engine_clock, 456 + .get_memory_clock = &radeon_atom_get_memory_clock, 457 + .set_memory_clock = &radeon_atom_set_memory_clock, 458 + .get_pcie_lanes = &rv370_get_pcie_lanes, 459 + .set_pcie_lanes = &rv370_set_pcie_lanes, 460 + .set_clock_gating = &radeon_atom_set_clock_gating, 461 + .set_surface_reg = r100_set_surface_reg, 462 + .clear_surface_reg = r100_clear_surface_reg, 463 + .bandwidth_update = &rv515_bandwidth_update, 464 + .hpd_init = &rs600_hpd_init, 465 + .hpd_fini = &rs600_hpd_fini, 466 + .hpd_sense = &rs600_hpd_sense, 467 + .hpd_set_polarity = &rs600_hpd_set_polarity, 468 + .ioctl_wait_idle = NULL, 469 + }; 470 + 471 + static struct radeon_asic r520_asic = { 472 + .init = &r520_init, 473 + .fini = &rv515_fini, 474 + .suspend = &rv515_suspend, 475 + .resume = &r520_resume, 476 + .vga_set_state = &r100_vga_set_state, 477 + .gpu_reset = &rv515_gpu_reset, 478 + .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 479 + .gart_set_page = &rv370_pcie_gart_set_page, 480 + .cp_commit = &r100_cp_commit, 481 + .ring_start = &rv515_ring_start, 482 + .ring_test = &r100_ring_test, 483 + .ring_ib_execute = &r100_ring_ib_execute, 484 + .irq_set = &rs600_irq_set, 485 + .irq_process = &rs600_irq_process, 486 + .get_vblank_counter = &rs600_get_vblank_counter, 487 + .fence_ring_emit = &r300_fence_ring_emit, 488 + .cs_parse = &r300_cs_parse, 489 + .copy_blit = &r100_copy_blit, 490 + .copy_dma = &r200_copy_dma, 491 + .copy = &r100_copy_blit, 492 + .get_engine_clock = &radeon_atom_get_engine_clock, 493 + .set_engine_clock = &radeon_atom_set_engine_clock, 494 + .get_memory_clock = &radeon_atom_get_memory_clock, 495 + .set_memory_clock = &radeon_atom_set_memory_clock, 496 + .get_pcie_lanes = &rv370_get_pcie_lanes, 497 + .set_pcie_lanes = &rv370_set_pcie_lanes, 498 + .set_clock_gating = &radeon_atom_set_clock_gating, 499 + .set_surface_reg = r100_set_surface_reg, 500 + .clear_surface_reg = r100_clear_surface_reg, 501 + .bandwidth_update = &rv515_bandwidth_update, 502 + .hpd_init = &rs600_hpd_init, 503 + .hpd_fini = &rs600_hpd_fini, 504 + .hpd_sense = &rs600_hpd_sense, 505 + .hpd_set_polarity = &rs600_hpd_set_polarity, 506 + .ioctl_wait_idle = NULL, 507 + }; 508 + 509 + static struct radeon_asic r600_asic = { 510 + .init = &r600_init, 511 + .fini = &r600_fini, 512 + .suspend = &r600_suspend, 513 + .resume = &r600_resume, 514 + .cp_commit = &r600_cp_commit, 515 + .vga_set_state = &r600_vga_set_state, 516 + .gpu_reset = &r600_gpu_reset, 517 + .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 518 + .gart_set_page = &rs600_gart_set_page, 519 + .ring_test = &r600_ring_test, 520 + .ring_ib_execute = &r600_ring_ib_execute, 521 + .irq_set = &r600_irq_set, 522 + .irq_process = &r600_irq_process, 523 + .get_vblank_counter = &rs600_get_vblank_counter, 524 + .fence_ring_emit = &r600_fence_ring_emit, 525 + .cs_parse = &r600_cs_parse, 526 + .copy_blit = &r600_copy_blit, 527 + .copy_dma = &r600_copy_blit, 528 + .copy = &r600_copy_blit, 529 + .get_engine_clock = &radeon_atom_get_engine_clock, 530 + .set_engine_clock = &radeon_atom_set_engine_clock, 531 + .get_memory_clock = &radeon_atom_get_memory_clock, 532 + .set_memory_clock = &radeon_atom_set_memory_clock, 533 + .get_pcie_lanes = &rv370_get_pcie_lanes, 534 + .set_pcie_lanes = NULL, 535 + .set_clock_gating = NULL, 536 + .set_surface_reg = r600_set_surface_reg, 537 + .clear_surface_reg = r600_clear_surface_reg, 538 + .bandwidth_update = &rv515_bandwidth_update, 539 + .hpd_init = &r600_hpd_init, 540 + .hpd_fini = &r600_hpd_fini, 541 + .hpd_sense = &r600_hpd_sense, 542 + .hpd_set_polarity = &r600_hpd_set_polarity, 543 + .ioctl_wait_idle = r600_ioctl_wait_idle, 544 + }; 545 + 546 + static struct radeon_asic rs780_asic = { 547 + .init = &r600_init, 548 + .fini = &r600_fini, 549 + .suspend = &r600_suspend, 550 + .resume = &r600_resume, 551 + .cp_commit = &r600_cp_commit, 552 + .vga_set_state = &r600_vga_set_state, 553 + .gpu_reset = &r600_gpu_reset, 554 + .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 555 + .gart_set_page = &rs600_gart_set_page, 556 + .ring_test = &r600_ring_test, 557 + .ring_ib_execute = &r600_ring_ib_execute, 558 + .irq_set = &r600_irq_set, 559 + .irq_process = &r600_irq_process, 560 + .get_vblank_counter = &rs600_get_vblank_counter, 561 + .fence_ring_emit = &r600_fence_ring_emit, 562 + .cs_parse = &r600_cs_parse, 563 + .copy_blit = &r600_copy_blit, 564 + .copy_dma = &r600_copy_blit, 565 + .copy = &r600_copy_blit, 566 + .get_engine_clock = &radeon_atom_get_engine_clock, 567 + .set_engine_clock = &radeon_atom_set_engine_clock, 568 + .get_memory_clock = NULL, 569 + .set_memory_clock = NULL, 570 + .get_pcie_lanes = NULL, 571 + .set_pcie_lanes = NULL, 572 + .set_clock_gating = NULL, 573 + .set_surface_reg = r600_set_surface_reg, 574 + .clear_surface_reg = r600_clear_surface_reg, 575 + .bandwidth_update = &rs690_bandwidth_update, 576 + .hpd_init = &r600_hpd_init, 577 + .hpd_fini = &r600_hpd_fini, 578 + .hpd_sense = &r600_hpd_sense, 579 + .hpd_set_polarity = &r600_hpd_set_polarity, 580 + .ioctl_wait_idle = r600_ioctl_wait_idle, 581 + }; 582 + 583 + static struct radeon_asic rv770_asic = { 584 + .init = &rv770_init, 585 + .fini = &rv770_fini, 586 + .suspend = &rv770_suspend, 587 + .resume = &rv770_resume, 588 + .cp_commit = &r600_cp_commit, 589 + .gpu_reset = &rv770_gpu_reset, 590 + .vga_set_state = &r600_vga_set_state, 591 + .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 592 + .gart_set_page = &rs600_gart_set_page, 593 + .ring_test = &r600_ring_test, 594 + .ring_ib_execute = &r600_ring_ib_execute, 595 + .irq_set = &r600_irq_set, 596 + .irq_process = &r600_irq_process, 597 + .get_vblank_counter = &rs600_get_vblank_counter, 598 + .fence_ring_emit = &r600_fence_ring_emit, 599 + .cs_parse = &r600_cs_parse, 600 + .copy_blit = &r600_copy_blit, 601 + .copy_dma = &r600_copy_blit, 602 + .copy = &r600_copy_blit, 603 + .get_engine_clock = &radeon_atom_get_engine_clock, 604 + .set_engine_clock = &radeon_atom_set_engine_clock, 605 + .get_memory_clock = &radeon_atom_get_memory_clock, 606 + .set_memory_clock = &radeon_atom_set_memory_clock, 607 + .get_pcie_lanes = &rv370_get_pcie_lanes, 608 + .set_pcie_lanes = NULL, 609 + .set_clock_gating = &radeon_atom_set_clock_gating, 610 + .set_surface_reg = r600_set_surface_reg, 611 + .clear_surface_reg = r600_clear_surface_reg, 612 + .bandwidth_update = &rv515_bandwidth_update, 613 + .hpd_init = &r600_hpd_init, 614 + .hpd_fini = &r600_hpd_fini, 615 + .hpd_sense = &r600_hpd_sense, 616 + .hpd_set_polarity = &r600_hpd_set_polarity, 617 + .ioctl_wait_idle = r600_ioctl_wait_idle, 618 + }; 619 + 620 + static struct radeon_asic evergreen_asic = { 621 + .init = &evergreen_init, 622 + .fini = &evergreen_fini, 623 + .suspend = &evergreen_suspend, 624 + .resume = &evergreen_resume, 625 + .cp_commit = NULL, 626 + .gpu_reset = &evergreen_gpu_reset, 627 + .vga_set_state = &r600_vga_set_state, 628 + .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 629 + .gart_set_page = &rs600_gart_set_page, 630 + .ring_test = NULL, 631 + .ring_ib_execute = NULL, 632 + .irq_set = NULL, 633 + .irq_process = NULL, 634 + .get_vblank_counter = NULL, 635 + .fence_ring_emit = NULL, 636 + .cs_parse = NULL, 637 + .copy_blit = NULL, 638 + .copy_dma = NULL, 639 + .copy = NULL, 640 + .get_engine_clock = &radeon_atom_get_engine_clock, 641 + .set_engine_clock = &radeon_atom_set_engine_clock, 642 + .get_memory_clock = &radeon_atom_get_memory_clock, 643 + .set_memory_clock = &radeon_atom_set_memory_clock, 644 + .set_pcie_lanes = NULL, 645 + .set_clock_gating = NULL, 646 + .set_surface_reg = r600_set_surface_reg, 647 + .clear_surface_reg = r600_clear_surface_reg, 648 + .bandwidth_update = &evergreen_bandwidth_update, 649 + .hpd_init = &evergreen_hpd_init, 650 + .hpd_fini = &evergreen_hpd_fini, 651 + .hpd_sense = &evergreen_hpd_sense, 652 + .hpd_set_polarity = &evergreen_hpd_set_polarity, 653 + }; 654 + 655 + int radeon_asic_init(struct radeon_device *rdev) 656 + { 657 + radeon_register_accessor_init(rdev); 658 + switch (rdev->family) { 659 + case CHIP_R100: 660 + case CHIP_RV100: 661 + case CHIP_RS100: 662 + case CHIP_RV200: 663 + case CHIP_RS200: 664 + rdev->asic = &r100_asic; 665 + break; 666 + case CHIP_R200: 667 + case CHIP_RV250: 668 + case CHIP_RS300: 669 + case CHIP_RV280: 670 + rdev->asic = &r200_asic; 671 + break; 672 + case CHIP_R300: 673 + case CHIP_R350: 674 + case CHIP_RV350: 675 + case CHIP_RV380: 676 + if (rdev->flags & RADEON_IS_PCIE) 677 + rdev->asic = &r300_asic_pcie; 678 + else 679 + rdev->asic = &r300_asic; 680 + break; 681 + case CHIP_R420: 682 + case CHIP_R423: 683 + case CHIP_RV410: 684 + rdev->asic = &r420_asic; 685 + break; 686 + case CHIP_RS400: 687 + case CHIP_RS480: 688 + rdev->asic = &rs400_asic; 689 + break; 690 + case CHIP_RS600: 691 + rdev->asic = &rs600_asic; 692 + break; 693 + case CHIP_RS690: 694 + case CHIP_RS740: 695 + rdev->asic = &rs690_asic; 696 + break; 697 + case CHIP_RV515: 698 + rdev->asic = &rv515_asic; 699 + break; 700 + case CHIP_R520: 701 + case CHIP_RV530: 702 + case CHIP_RV560: 703 + case CHIP_RV570: 704 + case CHIP_R580: 705 + rdev->asic = &r520_asic; 706 + break; 707 + case CHIP_R600: 708 + case CHIP_RV610: 709 + case CHIP_RV630: 710 + case CHIP_RV620: 711 + case CHIP_RV635: 712 + case CHIP_RV670: 713 + rdev->asic = &r600_asic; 714 + break; 715 + case CHIP_RS780: 716 + case CHIP_RS880: 717 + rdev->asic = &rs780_asic; 718 + break; 719 + case CHIP_RV770: 720 + case CHIP_RV730: 721 + case CHIP_RV710: 722 + case CHIP_RV740: 723 + rdev->asic = &rv770_asic; 724 + break; 725 + case CHIP_CEDAR: 726 + case CHIP_REDWOOD: 727 + case CHIP_JUNIPER: 728 + case CHIP_CYPRESS: 729 + case CHIP_HEMLOCK: 730 + rdev->asic = &evergreen_asic; 731 + break; 732 + default: 733 + /* FIXME: not supported yet */ 734 + return -EINVAL; 735 + } 736 + 737 + if (rdev->flags & RADEON_IS_IGP) { 738 + rdev->asic->get_memory_clock = NULL; 739 + rdev->asic->set_memory_clock = NULL; 740 + } 741 + 742 + /* set the number of crtcs */ 743 + if (rdev->flags & RADEON_SINGLE_CRTC) 744 + rdev->num_crtc = 1; 745 + else { 746 + if (ASIC_IS_DCE4(rdev)) 747 + rdev->num_crtc = 6; 748 + else 749 + rdev->num_crtc = 2; 750 + } 751 + 752 + return 0; 753 + } 754 + 755 + /* 756 + * Wrapper around modesetting bits. Move to radeon_clocks.c? 757 + */ 758 + int radeon_clocks_init(struct radeon_device *rdev) 759 + { 760 + int r; 761 + 762 + r = radeon_static_clocks_init(rdev->ddev); 763 + if (r) { 764 + return r; 765 + } 766 + DRM_INFO("Clocks initialized !\n"); 767 + return 0; 768 + } 769 + 770 + void radeon_clocks_fini(struct radeon_device *rdev) 771 + { 772 + }
+50 -495
drivers/gpu/drm/radeon/radeon_asic.h
··· 45 45 /* 46 46 * r100,rv100,rs100,rv200,rs200 47 47 */ 48 - extern int r100_init(struct radeon_device *rdev); 49 - extern void r100_fini(struct radeon_device *rdev); 50 - extern int r100_suspend(struct radeon_device *rdev); 51 - extern int r100_resume(struct radeon_device *rdev); 48 + struct r100_mc_save { 49 + u32 GENMO_WT; 50 + u32 CRTC_EXT_CNTL; 51 + u32 CRTC_GEN_CNTL; 52 + u32 CRTC2_GEN_CNTL; 53 + u32 CUR_OFFSET; 54 + u32 CUR2_OFFSET; 55 + }; 56 + int r100_init(struct radeon_device *rdev); 57 + void r100_fini(struct radeon_device *rdev); 58 + int r100_suspend(struct radeon_device *rdev); 59 + int r100_resume(struct radeon_device *rdev); 52 60 uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg); 53 61 void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); 54 62 void r100_vga_set_state(struct radeon_device *rdev, bool state); ··· 81 73 int r100_set_surface_reg(struct radeon_device *rdev, int reg, 82 74 uint32_t tiling_flags, uint32_t pitch, 83 75 uint32_t offset, uint32_t obj_size); 84 - int r100_clear_surface_reg(struct radeon_device *rdev, int reg); 76 + void r100_clear_surface_reg(struct radeon_device *rdev, int reg); 85 77 void r100_bandwidth_update(struct radeon_device *rdev); 86 78 void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 87 79 int r100_ring_test(struct radeon_device *rdev); ··· 90 82 bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); 91 83 void r100_hpd_set_polarity(struct radeon_device *rdev, 92 84 enum radeon_hpd_id hpd); 93 - 94 - static struct radeon_asic r100_asic = { 95 - .init = &r100_init, 96 - .fini = &r100_fini, 97 - .suspend = &r100_suspend, 98 - .resume = &r100_resume, 99 - .vga_set_state = &r100_vga_set_state, 100 - .gpu_reset = &r100_gpu_reset, 101 - .gart_tlb_flush = &r100_pci_gart_tlb_flush, 102 - .gart_set_page = &r100_pci_gart_set_page, 103 - .cp_commit = &r100_cp_commit, 104 - .ring_start = &r100_ring_start, 105 - .ring_test = &r100_ring_test, 106 - .ring_ib_execute = &r100_ring_ib_execute, 107 - .irq_set = &r100_irq_set, 108 - .irq_process = &r100_irq_process, 109 - .get_vblank_counter = &r100_get_vblank_counter, 110 - .fence_ring_emit = &r100_fence_ring_emit, 111 - .cs_parse = &r100_cs_parse, 112 - .copy_blit = &r100_copy_blit, 113 - .copy_dma = NULL, 114 - .copy = &r100_copy_blit, 115 - .get_engine_clock = &radeon_legacy_get_engine_clock, 116 - .set_engine_clock = &radeon_legacy_set_engine_clock, 117 - .get_memory_clock = &radeon_legacy_get_memory_clock, 118 - .set_memory_clock = NULL, 119 - .get_pcie_lanes = NULL, 120 - .set_pcie_lanes = NULL, 121 - .set_clock_gating = &radeon_legacy_set_clock_gating, 122 - .set_surface_reg = r100_set_surface_reg, 123 - .clear_surface_reg = r100_clear_surface_reg, 124 - .bandwidth_update = &r100_bandwidth_update, 125 - .hpd_init = &r100_hpd_init, 126 - .hpd_fini = &r100_hpd_fini, 127 - .hpd_sense = &r100_hpd_sense, 128 - .hpd_set_polarity = &r100_hpd_set_polarity, 129 - .ioctl_wait_idle = NULL, 130 - }; 85 + int r100_debugfs_rbbm_init(struct radeon_device *rdev); 86 + int r100_debugfs_cp_init(struct radeon_device *rdev); 87 + void r100_cp_disable(struct radeon_device *rdev); 88 + int r100_cp_init(struct radeon_device *rdev, unsigned ring_size); 89 + void r100_cp_fini(struct radeon_device *rdev); 90 + int r100_pci_gart_init(struct radeon_device *rdev); 91 + void r100_pci_gart_fini(struct radeon_device *rdev); 92 + int r100_pci_gart_enable(struct radeon_device *rdev); 93 + void r100_pci_gart_disable(struct radeon_device *rdev); 94 + int r100_debugfs_mc_info_init(struct radeon_device *rdev); 95 + int r100_gui_wait_for_idle(struct radeon_device *rdev); 96 + void r100_ib_fini(struct radeon_device *rdev); 97 + int r100_ib_init(struct radeon_device *rdev); 98 + void r100_irq_disable(struct radeon_device *rdev); 99 + void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save); 100 + void r100_mc_resume(struct radeon_device *rdev, struct r100_mc_save *save); 101 + void r100_vram_init_sizes(struct radeon_device *rdev); 102 + void r100_wb_disable(struct radeon_device *rdev); 103 + void r100_wb_fini(struct radeon_device *rdev); 104 + int r100_wb_init(struct radeon_device *rdev); 105 + void r100_hdp_reset(struct radeon_device *rdev); 106 + int r100_rb2d_reset(struct radeon_device *rdev); 107 + int r100_cp_reset(struct radeon_device *rdev); 108 + void r100_vga_render_disable(struct radeon_device *rdev); 109 + int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p, 110 + struct radeon_cs_packet *pkt, 111 + struct radeon_bo *robj); 112 + int r100_cs_parse_packet0(struct radeon_cs_parser *p, 113 + struct radeon_cs_packet *pkt, 114 + const unsigned *auth, unsigned n, 115 + radeon_packet0_check_t check); 116 + int r100_cs_packet_parse(struct radeon_cs_parser *p, 117 + struct radeon_cs_packet *pkt, 118 + unsigned idx); 119 + void r100_enable_bm(struct radeon_device *rdev); 120 + void r100_set_common_regs(struct radeon_device *rdev); 131 121 132 122 /* 133 123 * r200,rv250,rs300,rv280 ··· 135 129 uint64_t dst_offset, 136 130 unsigned num_pages, 137 131 struct radeon_fence *fence); 138 - static struct radeon_asic r200_asic = { 139 - .init = &r100_init, 140 - .fini = &r100_fini, 141 - .suspend = &r100_suspend, 142 - .resume = &r100_resume, 143 - .vga_set_state = &r100_vga_set_state, 144 - .gpu_reset = &r100_gpu_reset, 145 - .gart_tlb_flush = &r100_pci_gart_tlb_flush, 146 - .gart_set_page = &r100_pci_gart_set_page, 147 - .cp_commit = &r100_cp_commit, 148 - .ring_start = &r100_ring_start, 149 - .ring_test = &r100_ring_test, 150 - .ring_ib_execute = &r100_ring_ib_execute, 151 - .irq_set = &r100_irq_set, 152 - .irq_process = &r100_irq_process, 153 - .get_vblank_counter = &r100_get_vblank_counter, 154 - .fence_ring_emit = &r100_fence_ring_emit, 155 - .cs_parse = &r100_cs_parse, 156 - .copy_blit = &r100_copy_blit, 157 - .copy_dma = &r200_copy_dma, 158 - .copy = &r100_copy_blit, 159 - .get_engine_clock = &radeon_legacy_get_engine_clock, 160 - .set_engine_clock = &radeon_legacy_set_engine_clock, 161 - .get_memory_clock = &radeon_legacy_get_memory_clock, 162 - .set_memory_clock = NULL, 163 - .set_pcie_lanes = NULL, 164 - .set_clock_gating = &radeon_legacy_set_clock_gating, 165 - .set_surface_reg = r100_set_surface_reg, 166 - .clear_surface_reg = r100_clear_surface_reg, 167 - .bandwidth_update = &r100_bandwidth_update, 168 - .hpd_init = &r100_hpd_init, 169 - .hpd_fini = &r100_hpd_fini, 170 - .hpd_sense = &r100_hpd_sense, 171 - .hpd_set_polarity = &r100_hpd_set_polarity, 172 - .ioctl_wait_idle = NULL, 173 - }; 174 - 175 132 176 133 /* 177 134 * r300,r350,rv350,rv380 ··· 155 186 extern void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes); 156 187 extern int rv370_get_pcie_lanes(struct radeon_device *rdev); 157 188 158 - static struct radeon_asic r300_asic = { 159 - .init = &r300_init, 160 - .fini = &r300_fini, 161 - .suspend = &r300_suspend, 162 - .resume = &r300_resume, 163 - .vga_set_state = &r100_vga_set_state, 164 - .gpu_reset = &r300_gpu_reset, 165 - .gart_tlb_flush = &r100_pci_gart_tlb_flush, 166 - .gart_set_page = &r100_pci_gart_set_page, 167 - .cp_commit = &r100_cp_commit, 168 - .ring_start = &r300_ring_start, 169 - .ring_test = &r100_ring_test, 170 - .ring_ib_execute = &r100_ring_ib_execute, 171 - .irq_set = &r100_irq_set, 172 - .irq_process = &r100_irq_process, 173 - .get_vblank_counter = &r100_get_vblank_counter, 174 - .fence_ring_emit = &r300_fence_ring_emit, 175 - .cs_parse = &r300_cs_parse, 176 - .copy_blit = &r100_copy_blit, 177 - .copy_dma = &r200_copy_dma, 178 - .copy = &r100_copy_blit, 179 - .get_engine_clock = &radeon_legacy_get_engine_clock, 180 - .set_engine_clock = &radeon_legacy_set_engine_clock, 181 - .get_memory_clock = &radeon_legacy_get_memory_clock, 182 - .set_memory_clock = NULL, 183 - .get_pcie_lanes = &rv370_get_pcie_lanes, 184 - .set_pcie_lanes = &rv370_set_pcie_lanes, 185 - .set_clock_gating = &radeon_legacy_set_clock_gating, 186 - .set_surface_reg = r100_set_surface_reg, 187 - .clear_surface_reg = r100_clear_surface_reg, 188 - .bandwidth_update = &r100_bandwidth_update, 189 - .hpd_init = &r100_hpd_init, 190 - .hpd_fini = &r100_hpd_fini, 191 - .hpd_sense = &r100_hpd_sense, 192 - .hpd_set_polarity = &r100_hpd_set_polarity, 193 - .ioctl_wait_idle = NULL, 194 - }; 195 - 196 - 197 - static struct radeon_asic r300_asic_pcie = { 198 - .init = &r300_init, 199 - .fini = &r300_fini, 200 - .suspend = &r300_suspend, 201 - .resume = &r300_resume, 202 - .vga_set_state = &r100_vga_set_state, 203 - .gpu_reset = &r300_gpu_reset, 204 - .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 205 - .gart_set_page = &rv370_pcie_gart_set_page, 206 - .cp_commit = &r100_cp_commit, 207 - .ring_start = &r300_ring_start, 208 - .ring_test = &r100_ring_test, 209 - .ring_ib_execute = &r100_ring_ib_execute, 210 - .irq_set = &r100_irq_set, 211 - .irq_process = &r100_irq_process, 212 - .get_vblank_counter = &r100_get_vblank_counter, 213 - .fence_ring_emit = &r300_fence_ring_emit, 214 - .cs_parse = &r300_cs_parse, 215 - .copy_blit = &r100_copy_blit, 216 - .copy_dma = &r200_copy_dma, 217 - .copy = &r100_copy_blit, 218 - .get_engine_clock = &radeon_legacy_get_engine_clock, 219 - .set_engine_clock = &radeon_legacy_set_engine_clock, 220 - .get_memory_clock = &radeon_legacy_get_memory_clock, 221 - .set_memory_clock = NULL, 222 - .set_pcie_lanes = &rv370_set_pcie_lanes, 223 - .set_clock_gating = &radeon_legacy_set_clock_gating, 224 - .set_surface_reg = r100_set_surface_reg, 225 - .clear_surface_reg = r100_clear_surface_reg, 226 - .bandwidth_update = &r100_bandwidth_update, 227 - .hpd_init = &r100_hpd_init, 228 - .hpd_fini = &r100_hpd_fini, 229 - .hpd_sense = &r100_hpd_sense, 230 - .hpd_set_polarity = &r100_hpd_set_polarity, 231 - .ioctl_wait_idle = NULL, 232 - }; 233 - 234 189 /* 235 190 * r420,r423,rv410 236 191 */ ··· 162 269 extern void r420_fini(struct radeon_device *rdev); 163 270 extern int r420_suspend(struct radeon_device *rdev); 164 271 extern int r420_resume(struct radeon_device *rdev); 165 - static struct radeon_asic r420_asic = { 166 - .init = &r420_init, 167 - .fini = &r420_fini, 168 - .suspend = &r420_suspend, 169 - .resume = &r420_resume, 170 - .vga_set_state = &r100_vga_set_state, 171 - .gpu_reset = &r300_gpu_reset, 172 - .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 173 - .gart_set_page = &rv370_pcie_gart_set_page, 174 - .cp_commit = &r100_cp_commit, 175 - .ring_start = &r300_ring_start, 176 - .ring_test = &r100_ring_test, 177 - .ring_ib_execute = &r100_ring_ib_execute, 178 - .irq_set = &r100_irq_set, 179 - .irq_process = &r100_irq_process, 180 - .get_vblank_counter = &r100_get_vblank_counter, 181 - .fence_ring_emit = &r300_fence_ring_emit, 182 - .cs_parse = &r300_cs_parse, 183 - .copy_blit = &r100_copy_blit, 184 - .copy_dma = &r200_copy_dma, 185 - .copy = &r100_copy_blit, 186 - .get_engine_clock = &radeon_atom_get_engine_clock, 187 - .set_engine_clock = &radeon_atom_set_engine_clock, 188 - .get_memory_clock = &radeon_atom_get_memory_clock, 189 - .set_memory_clock = &radeon_atom_set_memory_clock, 190 - .get_pcie_lanes = &rv370_get_pcie_lanes, 191 - .set_pcie_lanes = &rv370_set_pcie_lanes, 192 - .set_clock_gating = &radeon_atom_set_clock_gating, 193 - .set_surface_reg = r100_set_surface_reg, 194 - .clear_surface_reg = r100_clear_surface_reg, 195 - .bandwidth_update = &r100_bandwidth_update, 196 - .hpd_init = &r100_hpd_init, 197 - .hpd_fini = &r100_hpd_fini, 198 - .hpd_sense = &r100_hpd_sense, 199 - .hpd_set_polarity = &r100_hpd_set_polarity, 200 - .ioctl_wait_idle = NULL, 201 - }; 202 - 203 272 204 273 /* 205 274 * rs400,rs480 ··· 174 319 int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr); 175 320 uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg); 176 321 void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); 177 - static struct radeon_asic rs400_asic = { 178 - .init = &rs400_init, 179 - .fini = &rs400_fini, 180 - .suspend = &rs400_suspend, 181 - .resume = &rs400_resume, 182 - .vga_set_state = &r100_vga_set_state, 183 - .gpu_reset = &r300_gpu_reset, 184 - .gart_tlb_flush = &rs400_gart_tlb_flush, 185 - .gart_set_page = &rs400_gart_set_page, 186 - .cp_commit = &r100_cp_commit, 187 - .ring_start = &r300_ring_start, 188 - .ring_test = &r100_ring_test, 189 - .ring_ib_execute = &r100_ring_ib_execute, 190 - .irq_set = &r100_irq_set, 191 - .irq_process = &r100_irq_process, 192 - .get_vblank_counter = &r100_get_vblank_counter, 193 - .fence_ring_emit = &r300_fence_ring_emit, 194 - .cs_parse = &r300_cs_parse, 195 - .copy_blit = &r100_copy_blit, 196 - .copy_dma = &r200_copy_dma, 197 - .copy = &r100_copy_blit, 198 - .get_engine_clock = &radeon_legacy_get_engine_clock, 199 - .set_engine_clock = &radeon_legacy_set_engine_clock, 200 - .get_memory_clock = &radeon_legacy_get_memory_clock, 201 - .set_memory_clock = NULL, 202 - .get_pcie_lanes = NULL, 203 - .set_pcie_lanes = NULL, 204 - .set_clock_gating = &radeon_legacy_set_clock_gating, 205 - .set_surface_reg = r100_set_surface_reg, 206 - .clear_surface_reg = r100_clear_surface_reg, 207 - .bandwidth_update = &r100_bandwidth_update, 208 - .hpd_init = &r100_hpd_init, 209 - .hpd_fini = &r100_hpd_fini, 210 - .hpd_sense = &r100_hpd_sense, 211 - .hpd_set_polarity = &r100_hpd_set_polarity, 212 - .ioctl_wait_idle = NULL, 213 - }; 214 - 215 322 216 323 /* 217 324 * rs600. ··· 196 379 void rs600_hpd_set_polarity(struct radeon_device *rdev, 197 380 enum radeon_hpd_id hpd); 198 381 199 - static struct radeon_asic rs600_asic = { 200 - .init = &rs600_init, 201 - .fini = &rs600_fini, 202 - .suspend = &rs600_suspend, 203 - .resume = &rs600_resume, 204 - .vga_set_state = &r100_vga_set_state, 205 - .gpu_reset = &r300_gpu_reset, 206 - .gart_tlb_flush = &rs600_gart_tlb_flush, 207 - .gart_set_page = &rs600_gart_set_page, 208 - .cp_commit = &r100_cp_commit, 209 - .ring_start = &r300_ring_start, 210 - .ring_test = &r100_ring_test, 211 - .ring_ib_execute = &r100_ring_ib_execute, 212 - .irq_set = &rs600_irq_set, 213 - .irq_process = &rs600_irq_process, 214 - .get_vblank_counter = &rs600_get_vblank_counter, 215 - .fence_ring_emit = &r300_fence_ring_emit, 216 - .cs_parse = &r300_cs_parse, 217 - .copy_blit = &r100_copy_blit, 218 - .copy_dma = &r200_copy_dma, 219 - .copy = &r100_copy_blit, 220 - .get_engine_clock = &radeon_atom_get_engine_clock, 221 - .set_engine_clock = &radeon_atom_set_engine_clock, 222 - .get_memory_clock = &radeon_atom_get_memory_clock, 223 - .set_memory_clock = &radeon_atom_set_memory_clock, 224 - .get_pcie_lanes = NULL, 225 - .set_pcie_lanes = NULL, 226 - .set_clock_gating = &radeon_atom_set_clock_gating, 227 - .set_surface_reg = r100_set_surface_reg, 228 - .clear_surface_reg = r100_clear_surface_reg, 229 - .bandwidth_update = &rs600_bandwidth_update, 230 - .hpd_init = &rs600_hpd_init, 231 - .hpd_fini = &rs600_hpd_fini, 232 - .hpd_sense = &rs600_hpd_sense, 233 - .hpd_set_polarity = &rs600_hpd_set_polarity, 234 - .ioctl_wait_idle = NULL, 235 - }; 236 - 237 - 238 382 /* 239 383 * rs690,rs740 240 384 */ ··· 206 428 uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg); 207 429 void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); 208 430 void rs690_bandwidth_update(struct radeon_device *rdev); 209 - static struct radeon_asic rs690_asic = { 210 - .init = &rs690_init, 211 - .fini = &rs690_fini, 212 - .suspend = &rs690_suspend, 213 - .resume = &rs690_resume, 214 - .vga_set_state = &r100_vga_set_state, 215 - .gpu_reset = &r300_gpu_reset, 216 - .gart_tlb_flush = &rs400_gart_tlb_flush, 217 - .gart_set_page = &rs400_gart_set_page, 218 - .cp_commit = &r100_cp_commit, 219 - .ring_start = &r300_ring_start, 220 - .ring_test = &r100_ring_test, 221 - .ring_ib_execute = &r100_ring_ib_execute, 222 - .irq_set = &rs600_irq_set, 223 - .irq_process = &rs600_irq_process, 224 - .get_vblank_counter = &rs600_get_vblank_counter, 225 - .fence_ring_emit = &r300_fence_ring_emit, 226 - .cs_parse = &r300_cs_parse, 227 - .copy_blit = &r100_copy_blit, 228 - .copy_dma = &r200_copy_dma, 229 - .copy = &r200_copy_dma, 230 - .get_engine_clock = &radeon_atom_get_engine_clock, 231 - .set_engine_clock = &radeon_atom_set_engine_clock, 232 - .get_memory_clock = &radeon_atom_get_memory_clock, 233 - .set_memory_clock = &radeon_atom_set_memory_clock, 234 - .get_pcie_lanes = NULL, 235 - .set_pcie_lanes = NULL, 236 - .set_clock_gating = &radeon_atom_set_clock_gating, 237 - .set_surface_reg = r100_set_surface_reg, 238 - .clear_surface_reg = r100_clear_surface_reg, 239 - .bandwidth_update = &rs690_bandwidth_update, 240 - .hpd_init = &rs600_hpd_init, 241 - .hpd_fini = &rs600_hpd_fini, 242 - .hpd_sense = &rs600_hpd_sense, 243 - .hpd_set_polarity = &rs600_hpd_set_polarity, 244 - .ioctl_wait_idle = NULL, 245 - }; 246 - 247 431 248 432 /* 249 433 * rv515 ··· 221 481 void rv515_bandwidth_update(struct radeon_device *rdev); 222 482 int rv515_resume(struct radeon_device *rdev); 223 483 int rv515_suspend(struct radeon_device *rdev); 224 - static struct radeon_asic rv515_asic = { 225 - .init = &rv515_init, 226 - .fini = &rv515_fini, 227 - .suspend = &rv515_suspend, 228 - .resume = &rv515_resume, 229 - .vga_set_state = &r100_vga_set_state, 230 - .gpu_reset = &rv515_gpu_reset, 231 - .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 232 - .gart_set_page = &rv370_pcie_gart_set_page, 233 - .cp_commit = &r100_cp_commit, 234 - .ring_start = &rv515_ring_start, 235 - .ring_test = &r100_ring_test, 236 - .ring_ib_execute = &r100_ring_ib_execute, 237 - .irq_set = &rs600_irq_set, 238 - .irq_process = &rs600_irq_process, 239 - .get_vblank_counter = &rs600_get_vblank_counter, 240 - .fence_ring_emit = &r300_fence_ring_emit, 241 - .cs_parse = &r300_cs_parse, 242 - .copy_blit = &r100_copy_blit, 243 - .copy_dma = &r200_copy_dma, 244 - .copy = &r100_copy_blit, 245 - .get_engine_clock = &radeon_atom_get_engine_clock, 246 - .set_engine_clock = &radeon_atom_set_engine_clock, 247 - .get_memory_clock = &radeon_atom_get_memory_clock, 248 - .set_memory_clock = &radeon_atom_set_memory_clock, 249 - .get_pcie_lanes = &rv370_get_pcie_lanes, 250 - .set_pcie_lanes = &rv370_set_pcie_lanes, 251 - .set_clock_gating = &radeon_atom_set_clock_gating, 252 - .set_surface_reg = r100_set_surface_reg, 253 - .clear_surface_reg = r100_clear_surface_reg, 254 - .bandwidth_update = &rv515_bandwidth_update, 255 - .hpd_init = &rs600_hpd_init, 256 - .hpd_fini = &rs600_hpd_fini, 257 - .hpd_sense = &rs600_hpd_sense, 258 - .hpd_set_polarity = &rs600_hpd_set_polarity, 259 - .ioctl_wait_idle = NULL, 260 - }; 261 - 262 484 263 485 /* 264 486 * r520,rv530,rv560,rv570,r580 265 487 */ 266 488 int r520_init(struct radeon_device *rdev); 267 489 int r520_resume(struct radeon_device *rdev); 268 - static struct radeon_asic r520_asic = { 269 - .init = &r520_init, 270 - .fini = &rv515_fini, 271 - .suspend = &rv515_suspend, 272 - .resume = &r520_resume, 273 - .vga_set_state = &r100_vga_set_state, 274 - .gpu_reset = &rv515_gpu_reset, 275 - .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 276 - .gart_set_page = &rv370_pcie_gart_set_page, 277 - .cp_commit = &r100_cp_commit, 278 - .ring_start = &rv515_ring_start, 279 - .ring_test = &r100_ring_test, 280 - .ring_ib_execute = &r100_ring_ib_execute, 281 - .irq_set = &rs600_irq_set, 282 - .irq_process = &rs600_irq_process, 283 - .get_vblank_counter = &rs600_get_vblank_counter, 284 - .fence_ring_emit = &r300_fence_ring_emit, 285 - .cs_parse = &r300_cs_parse, 286 - .copy_blit = &r100_copy_blit, 287 - .copy_dma = &r200_copy_dma, 288 - .copy = &r100_copy_blit, 289 - .get_engine_clock = &radeon_atom_get_engine_clock, 290 - .set_engine_clock = &radeon_atom_set_engine_clock, 291 - .get_memory_clock = &radeon_atom_get_memory_clock, 292 - .set_memory_clock = &radeon_atom_set_memory_clock, 293 - .get_pcie_lanes = &rv370_get_pcie_lanes, 294 - .set_pcie_lanes = &rv370_set_pcie_lanes, 295 - .set_clock_gating = &radeon_atom_set_clock_gating, 296 - .set_surface_reg = r100_set_surface_reg, 297 - .clear_surface_reg = r100_clear_surface_reg, 298 - .bandwidth_update = &rv515_bandwidth_update, 299 - .hpd_init = &rs600_hpd_init, 300 - .hpd_fini = &rs600_hpd_fini, 301 - .hpd_sense = &rs600_hpd_sense, 302 - .hpd_set_polarity = &rs600_hpd_set_polarity, 303 - .ioctl_wait_idle = NULL, 304 - }; 305 490 306 491 /* 307 492 * r600,rv610,rv630,rv620,rv635,rv670,rs780,rs880 ··· 256 591 int r600_set_surface_reg(struct radeon_device *rdev, int reg, 257 592 uint32_t tiling_flags, uint32_t pitch, 258 593 uint32_t offset, uint32_t obj_size); 259 - int r600_clear_surface_reg(struct radeon_device *rdev, int reg); 594 + void r600_clear_surface_reg(struct radeon_device *rdev, int reg); 260 595 void r600_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 261 596 int r600_ring_test(struct radeon_device *rdev); 262 597 int r600_copy_blit(struct radeon_device *rdev, ··· 269 604 enum radeon_hpd_id hpd); 270 605 extern void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo); 271 606 272 - static struct radeon_asic r600_asic = { 273 - .init = &r600_init, 274 - .fini = &r600_fini, 275 - .suspend = &r600_suspend, 276 - .resume = &r600_resume, 277 - .cp_commit = &r600_cp_commit, 278 - .vga_set_state = &r600_vga_set_state, 279 - .gpu_reset = &r600_gpu_reset, 280 - .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 281 - .gart_set_page = &rs600_gart_set_page, 282 - .ring_test = &r600_ring_test, 283 - .ring_ib_execute = &r600_ring_ib_execute, 284 - .irq_set = &r600_irq_set, 285 - .irq_process = &r600_irq_process, 286 - .get_vblank_counter = &rs600_get_vblank_counter, 287 - .fence_ring_emit = &r600_fence_ring_emit, 288 - .cs_parse = &r600_cs_parse, 289 - .copy_blit = &r600_copy_blit, 290 - .copy_dma = &r600_copy_blit, 291 - .copy = &r600_copy_blit, 292 - .get_engine_clock = &radeon_atom_get_engine_clock, 293 - .set_engine_clock = &radeon_atom_set_engine_clock, 294 - .get_memory_clock = &radeon_atom_get_memory_clock, 295 - .set_memory_clock = &radeon_atom_set_memory_clock, 296 - .get_pcie_lanes = &rv370_get_pcie_lanes, 297 - .set_pcie_lanes = NULL, 298 - .set_clock_gating = NULL, 299 - .set_surface_reg = r600_set_surface_reg, 300 - .clear_surface_reg = r600_clear_surface_reg, 301 - .bandwidth_update = &rv515_bandwidth_update, 302 - .hpd_init = &r600_hpd_init, 303 - .hpd_fini = &r600_hpd_fini, 304 - .hpd_sense = &r600_hpd_sense, 305 - .hpd_set_polarity = &r600_hpd_set_polarity, 306 - .ioctl_wait_idle = r600_ioctl_wait_idle, 307 - }; 308 - 309 607 /* 310 608 * rv770,rv730,rv710,rv740 311 609 */ ··· 277 649 int rv770_suspend(struct radeon_device *rdev); 278 650 int rv770_resume(struct radeon_device *rdev); 279 651 int rv770_gpu_reset(struct radeon_device *rdev); 280 - 281 - static struct radeon_asic rv770_asic = { 282 - .init = &rv770_init, 283 - .fini = &rv770_fini, 284 - .suspend = &rv770_suspend, 285 - .resume = &rv770_resume, 286 - .cp_commit = &r600_cp_commit, 287 - .gpu_reset = &rv770_gpu_reset, 288 - .vga_set_state = &r600_vga_set_state, 289 - .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 290 - .gart_set_page = &rs600_gart_set_page, 291 - .ring_test = &r600_ring_test, 292 - .ring_ib_execute = &r600_ring_ib_execute, 293 - .irq_set = &r600_irq_set, 294 - .irq_process = &r600_irq_process, 295 - .get_vblank_counter = &rs600_get_vblank_counter, 296 - .fence_ring_emit = &r600_fence_ring_emit, 297 - .cs_parse = &r600_cs_parse, 298 - .copy_blit = &r600_copy_blit, 299 - .copy_dma = &r600_copy_blit, 300 - .copy = &r600_copy_blit, 301 - .get_engine_clock = &radeon_atom_get_engine_clock, 302 - .set_engine_clock = &radeon_atom_set_engine_clock, 303 - .get_memory_clock = &radeon_atom_get_memory_clock, 304 - .set_memory_clock = &radeon_atom_set_memory_clock, 305 - .get_pcie_lanes = &rv370_get_pcie_lanes, 306 - .set_pcie_lanes = NULL, 307 - .set_clock_gating = &radeon_atom_set_clock_gating, 308 - .set_surface_reg = r600_set_surface_reg, 309 - .clear_surface_reg = r600_clear_surface_reg, 310 - .bandwidth_update = &rv515_bandwidth_update, 311 - .hpd_init = &r600_hpd_init, 312 - .hpd_fini = &r600_hpd_fini, 313 - .hpd_sense = &r600_hpd_sense, 314 - .hpd_set_polarity = &r600_hpd_set_polarity, 315 - .ioctl_wait_idle = r600_ioctl_wait_idle, 316 - }; 317 652 318 653 /* 319 654 * evergreen ··· 292 701 bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); 293 702 void evergreen_hpd_set_polarity(struct radeon_device *rdev, 294 703 enum radeon_hpd_id hpd); 295 - 296 - static struct radeon_asic evergreen_asic = { 297 - .init = &evergreen_init, 298 - .fini = &evergreen_fini, 299 - .suspend = &evergreen_suspend, 300 - .resume = &evergreen_resume, 301 - .cp_commit = NULL, 302 - .gpu_reset = &evergreen_gpu_reset, 303 - .vga_set_state = &r600_vga_set_state, 304 - .gart_tlb_flush = &r600_pcie_gart_tlb_flush, 305 - .gart_set_page = &rs600_gart_set_page, 306 - .ring_test = NULL, 307 - .ring_ib_execute = NULL, 308 - .irq_set = NULL, 309 - .irq_process = NULL, 310 - .get_vblank_counter = NULL, 311 - .fence_ring_emit = NULL, 312 - .cs_parse = NULL, 313 - .copy_blit = NULL, 314 - .copy_dma = NULL, 315 - .copy = NULL, 316 - .get_engine_clock = &radeon_atom_get_engine_clock, 317 - .set_engine_clock = &radeon_atom_set_engine_clock, 318 - .get_memory_clock = &radeon_atom_get_memory_clock, 319 - .set_memory_clock = &radeon_atom_set_memory_clock, 320 - .set_pcie_lanes = NULL, 321 - .set_clock_gating = NULL, 322 - .set_surface_reg = r600_set_surface_reg, 323 - .clear_surface_reg = r600_clear_surface_reg, 324 - .bandwidth_update = &evergreen_bandwidth_update, 325 - .hpd_init = &evergreen_hpd_init, 326 - .hpd_fini = &evergreen_hpd_fini, 327 - .hpd_sense = &evergreen_hpd_sense, 328 - .hpd_set_polarity = &evergreen_hpd_set_polarity, 329 - }; 330 - 331 704 #endif
+240 -201
drivers/gpu/drm/radeon/radeon_atombios.c
··· 75 75 memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); 76 76 i2c.valid = false; 77 77 78 - atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset); 78 + if (atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) { 79 + i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); 79 80 80 - i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); 81 + for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { 82 + gpio = &i2c_info->asGPIO_Info[i]; 81 83 84 + if (gpio->sucI2cId.ucAccess == id) { 85 + i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 86 + i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 87 + i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; 88 + i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; 89 + i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; 90 + i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; 91 + i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; 92 + i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; 93 + i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); 94 + i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); 95 + i2c.en_clk_mask = (1 << gpio->ucClkEnShift); 96 + i2c.en_data_mask = (1 << gpio->ucDataEnShift); 97 + i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); 98 + i2c.y_data_mask = (1 << gpio->ucDataY_Shift); 99 + i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); 100 + i2c.a_data_mask = (1 << gpio->ucDataA_Shift); 82 101 83 - for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { 84 - gpio = &i2c_info->asGPIO_Info[i]; 102 + if (gpio->sucI2cId.sbfAccess.bfHW_Capable) 103 + i2c.hw_capable = true; 104 + else 105 + i2c.hw_capable = false; 85 106 86 - if (gpio->sucI2cId.ucAccess == id) { 87 - i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 88 - i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 89 - i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; 90 - i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; 91 - i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; 92 - i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; 93 - i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; 94 - i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; 95 - i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); 96 - i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); 97 - i2c.en_clk_mask = (1 << gpio->ucClkEnShift); 98 - i2c.en_data_mask = (1 << gpio->ucDataEnShift); 99 - i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); 100 - i2c.y_data_mask = (1 << gpio->ucDataY_Shift); 101 - i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); 102 - i2c.a_data_mask = (1 << gpio->ucDataA_Shift); 107 + if (gpio->sucI2cId.ucAccess == 0xa0) 108 + i2c.mm_i2c = true; 109 + else 110 + i2c.mm_i2c = false; 103 111 104 - if (gpio->sucI2cId.sbfAccess.bfHW_Capable) 105 - i2c.hw_capable = true; 106 - else 107 - i2c.hw_capable = false; 112 + i2c.i2c_id = gpio->sucI2cId.ucAccess; 108 113 109 - if (gpio->sucI2cId.ucAccess == 0xa0) 110 - i2c.mm_i2c = true; 111 - else 112 - i2c.mm_i2c = false; 113 - 114 - i2c.i2c_id = gpio->sucI2cId.ucAccess; 115 - 116 - i2c.valid = true; 117 - break; 114 + i2c.valid = true; 115 + break; 116 + } 118 117 } 119 118 } 120 119 ··· 134 135 memset(&gpio, 0, sizeof(struct radeon_gpio_rec)); 135 136 gpio.valid = false; 136 137 137 - atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset); 138 + if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { 139 + gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset); 138 140 139 - gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset); 141 + num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / 142 + sizeof(ATOM_GPIO_PIN_ASSIGNMENT); 140 143 141 - num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / sizeof(ATOM_GPIO_PIN_ASSIGNMENT); 142 - 143 - for (i = 0; i < num_indices; i++) { 144 - pin = &gpio_info->asGPIO_Pin[i]; 145 - if (id == pin->ucGPIO_ID) { 146 - gpio.id = pin->ucGPIO_ID; 147 - gpio.reg = pin->usGpioPin_AIndex * 4; 148 - gpio.mask = (1 << pin->ucGpioPinBitShift); 149 - gpio.valid = true; 150 - break; 144 + for (i = 0; i < num_indices; i++) { 145 + pin = &gpio_info->asGPIO_Pin[i]; 146 + if (id == pin->ucGPIO_ID) { 147 + gpio.id = pin->ucGPIO_ID; 148 + gpio.reg = pin->usGpioPin_AIndex * 4; 149 + gpio.mask = (1 << pin->ucGpioPinBitShift); 150 + gpio.valid = true; 151 + break; 152 + } 151 153 } 152 154 } 153 155 ··· 264 264 if ((supported_device == ATOM_DEVICE_CRT1_SUPPORT) || 265 265 (supported_device == ATOM_DEVICE_DFP2_SUPPORT)) 266 266 return false; 267 + if (supported_device == ATOM_DEVICE_CRT2_SUPPORT) 268 + *line_mux = 0x90; 267 269 } 268 270 269 271 /* ASUS HD 3600 XT board lists the DVI port as HDMI */ ··· 397 395 struct radeon_gpio_rec gpio; 398 396 struct radeon_hpd hpd; 399 397 400 - atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); 401 - 402 - if (data_offset == 0) 398 + if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset)) 403 399 return false; 404 400 405 401 if (crev < 2) ··· 449 449 GetIndexIntoMasterTable(DATA, 450 450 IntegratedSystemInfo); 451 451 452 - atom_parse_data_header(ctx, index, &size, &frev, 453 - &crev, &igp_offset); 452 + if (atom_parse_data_header(ctx, index, &size, &frev, 453 + &crev, &igp_offset)) { 454 454 455 - if (crev >= 2) { 456 - igp_obj = 457 - (ATOM_INTEGRATED_SYSTEM_INFO_V2 458 - *) (ctx->bios + igp_offset); 455 + if (crev >= 2) { 456 + igp_obj = 457 + (ATOM_INTEGRATED_SYSTEM_INFO_V2 458 + *) (ctx->bios + igp_offset); 459 459 460 - if (igp_obj) { 461 - uint32_t slot_config, ct; 460 + if (igp_obj) { 461 + uint32_t slot_config, ct; 462 462 463 - if (con_obj_num == 1) 464 - slot_config = 465 - igp_obj-> 466 - ulDDISlot1Config; 467 - else 468 - slot_config = 469 - igp_obj-> 470 - ulDDISlot2Config; 463 + if (con_obj_num == 1) 464 + slot_config = 465 + igp_obj-> 466 + ulDDISlot1Config; 467 + else 468 + slot_config = 469 + igp_obj-> 470 + ulDDISlot2Config; 471 471 472 - ct = (slot_config >> 16) & 0xff; 473 - connector_type = 474 - object_connector_convert 475 - [ct]; 476 - connector_object_id = ct; 477 - igp_lane_info = 478 - slot_config & 0xffff; 472 + ct = (slot_config >> 16) & 0xff; 473 + connector_type = 474 + object_connector_convert 475 + [ct]; 476 + connector_object_id = ct; 477 + igp_lane_info = 478 + slot_config & 0xffff; 479 + } else 480 + continue; 479 481 } else 480 482 continue; 481 - } else 482 - continue; 483 + } else { 484 + igp_lane_info = 0; 485 + connector_type = 486 + object_connector_convert[con_obj_id]; 487 + connector_object_id = con_obj_id; 488 + } 483 489 } else { 484 490 igp_lane_info = 0; 485 491 connector_type = ··· 633 627 uint8_t frev, crev; 634 628 ATOM_XTMDS_INFO *xtmds; 635 629 636 - atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); 637 - xtmds = (ATOM_XTMDS_INFO *)(ctx->bios + data_offset); 630 + if (atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset)) { 631 + xtmds = (ATOM_XTMDS_INFO *)(ctx->bios + data_offset); 638 632 639 - if (xtmds->ucSupportedLink & ATOM_XTMDS_SUPPORTED_DUALLINK) { 640 - if (connector_type == DRM_MODE_CONNECTOR_DVII) 641 - return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I; 642 - else 643 - return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D; 644 - } else { 645 - if (connector_type == DRM_MODE_CONNECTOR_DVII) 646 - return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; 647 - else 648 - return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D; 649 - } 633 + if (xtmds->ucSupportedLink & ATOM_XTMDS_SUPPORTED_DUALLINK) { 634 + if (connector_type == DRM_MODE_CONNECTOR_DVII) 635 + return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I; 636 + else 637 + return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D; 638 + } else { 639 + if (connector_type == DRM_MODE_CONNECTOR_DVII) 640 + return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; 641 + else 642 + return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D; 643 + } 644 + } else 645 + return supported_devices_connector_object_id_convert 646 + [connector_type]; 650 647 } else { 651 648 return supported_devices_connector_object_id_convert 652 649 [connector_type]; ··· 681 672 int i, j, max_device; 682 673 struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE]; 683 674 684 - atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); 675 + if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset)) 676 + return false; 685 677 686 678 supported_devices = 687 679 (union atom_supported_devices *)(ctx->bios + data_offset); ··· 875 865 struct radeon_pll *mpll = &rdev->clock.mpll; 876 866 uint16_t data_offset; 877 867 878 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, 879 - &crev, &data_offset); 880 - 881 - firmware_info = 882 - (union firmware_info *)(mode_info->atom_context->bios + 883 - data_offset); 884 - 885 - if (firmware_info) { 868 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 869 + &frev, &crev, &data_offset)) { 870 + firmware_info = 871 + (union firmware_info *)(mode_info->atom_context->bios + 872 + data_offset); 886 873 /* pixel clocks */ 887 874 p1pll->reference_freq = 888 875 le16_to_cpu(firmware_info->info.usReferenceClock); ··· 893 886 le32_to_cpu(firmware_info->info_12.ulMinPixelClockPLL_Output); 894 887 p1pll->pll_out_max = 895 888 le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); 889 + 890 + if (crev >= 4) { 891 + p1pll->lcd_pll_out_min = 892 + le16_to_cpu(firmware_info->info_14.usLcdMinPixelClockPLL_Output) * 100; 893 + if (p1pll->lcd_pll_out_min == 0) 894 + p1pll->lcd_pll_out_min = p1pll->pll_out_min; 895 + p1pll->lcd_pll_out_max = 896 + le16_to_cpu(firmware_info->info_14.usLcdMaxPixelClockPLL_Output) * 100; 897 + if (p1pll->lcd_pll_out_max == 0) 898 + p1pll->lcd_pll_out_max = p1pll->pll_out_max; 899 + } else { 900 + p1pll->lcd_pll_out_min = p1pll->pll_out_min; 901 + p1pll->lcd_pll_out_max = p1pll->pll_out_max; 902 + } 896 903 897 904 if (p1pll->pll_out_min == 0) { 898 905 if (ASIC_IS_AVIVO(rdev)) ··· 1013 992 u8 frev, crev; 1014 993 u16 data_offset; 1015 994 1016 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, 1017 - &crev, &data_offset); 1018 - 1019 - igp_info = (union igp_info *)(mode_info->atom_context->bios + 995 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 996 + &frev, &crev, &data_offset)) { 997 + igp_info = (union igp_info *)(mode_info->atom_context->bios + 1020 998 data_offset); 1021 - 1022 - if (igp_info) { 1023 999 switch (crev) { 1024 1000 case 1: 1025 1001 if (igp_info->info.ucMemoryType & 0xf0) ··· 1047 1029 uint16_t maxfreq; 1048 1030 int i; 1049 1031 1050 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, 1051 - &crev, &data_offset); 1032 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1033 + &frev, &crev, &data_offset)) { 1034 + tmds_info = 1035 + (struct _ATOM_TMDS_INFO *)(mode_info->atom_context->bios + 1036 + data_offset); 1052 1037 1053 - tmds_info = 1054 - (struct _ATOM_TMDS_INFO *)(mode_info->atom_context->bios + 1055 - data_offset); 1056 - 1057 - if (tmds_info) { 1058 1038 maxfreq = le16_to_cpu(tmds_info->usMaxFrequency); 1059 1039 for (i = 0; i < 4; i++) { 1060 1040 tmds->tmds_pll[i].freq = ··· 1101 1085 if (id > ATOM_MAX_SS_ENTRY) 1102 1086 return NULL; 1103 1087 1104 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, 1105 - &crev, &data_offset); 1088 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1089 + &frev, &crev, &data_offset)) { 1090 + ss_info = 1091 + (struct _ATOM_SPREAD_SPECTRUM_INFO *)(mode_info->atom_context->bios + data_offset); 1106 1092 1107 - ss_info = 1108 - (struct _ATOM_SPREAD_SPECTRUM_INFO *)(mode_info->atom_context->bios + data_offset); 1109 - 1110 - if (ss_info) { 1111 1093 ss = 1112 1094 kzalloc(sizeof(struct radeon_atom_ss), GFP_KERNEL); 1113 1095 ··· 1128 1114 return ss; 1129 1115 } 1130 1116 1131 - static void radeon_atom_apply_lvds_quirks(struct drm_device *dev, 1132 - struct radeon_encoder_atom_dig *lvds) 1133 - { 1134 - 1135 - /* Toshiba A300-1BU laptop panel doesn't like new pll divider algo */ 1136 - if ((dev->pdev->device == 0x95c4) && 1137 - (dev->pdev->subsystem_vendor == 0x1179) && 1138 - (dev->pdev->subsystem_device == 0xff50)) { 1139 - if ((lvds->native_mode.hdisplay == 1280) && 1140 - (lvds->native_mode.vdisplay == 800)) 1141 - lvds->pll_algo = PLL_ALGO_LEGACY; 1142 - } 1143 - 1144 - /* Dell Studio 15 laptop panel doesn't like new pll divider algo */ 1145 - if ((dev->pdev->device == 0x95c4) && 1146 - (dev->pdev->subsystem_vendor == 0x1028) && 1147 - (dev->pdev->subsystem_device == 0x029f)) { 1148 - if ((lvds->native_mode.hdisplay == 1280) && 1149 - (lvds->native_mode.vdisplay == 800)) 1150 - lvds->pll_algo = PLL_ALGO_LEGACY; 1151 - } 1152 - 1153 - } 1154 - 1155 1117 union lvds_info { 1156 1118 struct _ATOM_LVDS_INFO info; 1157 1119 struct _ATOM_LVDS_INFO_V12 info_12; ··· 1146 1156 uint8_t frev, crev; 1147 1157 struct radeon_encoder_atom_dig *lvds = NULL; 1148 1158 1149 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, 1150 - &crev, &data_offset); 1151 - 1152 - lvds_info = 1153 - (union lvds_info *)(mode_info->atom_context->bios + data_offset); 1154 - 1155 - if (lvds_info) { 1159 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1160 + &frev, &crev, &data_offset)) { 1161 + lvds_info = 1162 + (union lvds_info *)(mode_info->atom_context->bios + data_offset); 1156 1163 lvds = 1157 1164 kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL); 1158 1165 ··· 1207 1220 lvds->pll_algo = PLL_ALGO_LEGACY; 1208 1221 } 1209 1222 1210 - /* LVDS quirks */ 1211 - radeon_atom_apply_lvds_quirks(dev, lvds); 1212 - 1213 1223 encoder->native_mode = lvds->native_mode; 1214 1224 } 1215 1225 return lvds; ··· 1225 1241 uint8_t bg, dac; 1226 1242 struct radeon_encoder_primary_dac *p_dac = NULL; 1227 1243 1228 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); 1244 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1245 + &frev, &crev, &data_offset)) { 1246 + dac_info = (struct _COMPASSIONATE_DATA *) 1247 + (mode_info->atom_context->bios + data_offset); 1229 1248 1230 - dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset); 1231 - 1232 - if (dac_info) { 1233 1249 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), GFP_KERNEL); 1234 1250 1235 1251 if (!p_dac) ··· 1254 1270 u8 frev, crev; 1255 1271 u16 data_offset, misc; 1256 1272 1257 - atom_parse_data_header(mode_info->atom_context, data_index, NULL, &frev, &crev, &data_offset); 1273 + if (!atom_parse_data_header(mode_info->atom_context, data_index, NULL, 1274 + &frev, &crev, &data_offset)) 1275 + return false; 1258 1276 1259 1277 switch (crev) { 1260 1278 case 1: ··· 1348 1362 struct _ATOM_ANALOG_TV_INFO *tv_info; 1349 1363 enum radeon_tv_std tv_std = TV_STD_NTSC; 1350 1364 1351 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); 1365 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1366 + &frev, &crev, &data_offset)) { 1352 1367 1353 - tv_info = (struct _ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); 1368 + tv_info = (struct _ATOM_ANALOG_TV_INFO *) 1369 + (mode_info->atom_context->bios + data_offset); 1354 1370 1355 - switch (tv_info->ucTV_BootUpDefaultStandard) { 1356 - case ATOM_TV_NTSC: 1357 - tv_std = TV_STD_NTSC; 1358 - DRM_INFO("Default TV standard: NTSC\n"); 1359 - break; 1360 - case ATOM_TV_NTSCJ: 1361 - tv_std = TV_STD_NTSC_J; 1362 - DRM_INFO("Default TV standard: NTSC-J\n"); 1363 - break; 1364 - case ATOM_TV_PAL: 1365 - tv_std = TV_STD_PAL; 1366 - DRM_INFO("Default TV standard: PAL\n"); 1367 - break; 1368 - case ATOM_TV_PALM: 1369 - tv_std = TV_STD_PAL_M; 1370 - DRM_INFO("Default TV standard: PAL-M\n"); 1371 - break; 1372 - case ATOM_TV_PALN: 1373 - tv_std = TV_STD_PAL_N; 1374 - DRM_INFO("Default TV standard: PAL-N\n"); 1375 - break; 1376 - case ATOM_TV_PALCN: 1377 - tv_std = TV_STD_PAL_CN; 1378 - DRM_INFO("Default TV standard: PAL-CN\n"); 1379 - break; 1380 - case ATOM_TV_PAL60: 1381 - tv_std = TV_STD_PAL_60; 1382 - DRM_INFO("Default TV standard: PAL-60\n"); 1383 - break; 1384 - case ATOM_TV_SECAM: 1385 - tv_std = TV_STD_SECAM; 1386 - DRM_INFO("Default TV standard: SECAM\n"); 1387 - break; 1388 - default: 1389 - tv_std = TV_STD_NTSC; 1390 - DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); 1391 - break; 1371 + switch (tv_info->ucTV_BootUpDefaultStandard) { 1372 + case ATOM_TV_NTSC: 1373 + tv_std = TV_STD_NTSC; 1374 + DRM_INFO("Default TV standard: NTSC\n"); 1375 + break; 1376 + case ATOM_TV_NTSCJ: 1377 + tv_std = TV_STD_NTSC_J; 1378 + DRM_INFO("Default TV standard: NTSC-J\n"); 1379 + break; 1380 + case ATOM_TV_PAL: 1381 + tv_std = TV_STD_PAL; 1382 + DRM_INFO("Default TV standard: PAL\n"); 1383 + break; 1384 + case ATOM_TV_PALM: 1385 + tv_std = TV_STD_PAL_M; 1386 + DRM_INFO("Default TV standard: PAL-M\n"); 1387 + break; 1388 + case ATOM_TV_PALN: 1389 + tv_std = TV_STD_PAL_N; 1390 + DRM_INFO("Default TV standard: PAL-N\n"); 1391 + break; 1392 + case ATOM_TV_PALCN: 1393 + tv_std = TV_STD_PAL_CN; 1394 + DRM_INFO("Default TV standard: PAL-CN\n"); 1395 + break; 1396 + case ATOM_TV_PAL60: 1397 + tv_std = TV_STD_PAL_60; 1398 + DRM_INFO("Default TV standard: PAL-60\n"); 1399 + break; 1400 + case ATOM_TV_SECAM: 1401 + tv_std = TV_STD_SECAM; 1402 + DRM_INFO("Default TV standard: SECAM\n"); 1403 + break; 1404 + default: 1405 + tv_std = TV_STD_NTSC; 1406 + DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); 1407 + break; 1408 + } 1392 1409 } 1393 1410 return tv_std; 1394 1411 } ··· 1409 1420 uint8_t bg, dac; 1410 1421 struct radeon_encoder_tv_dac *tv_dac = NULL; 1411 1422 1412 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); 1423 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1424 + &frev, &crev, &data_offset)) { 1413 1425 1414 - dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset); 1426 + dac_info = (struct _COMPASSIONATE_DATA *) 1427 + (mode_info->atom_context->bios + data_offset); 1415 1428 1416 - if (dac_info) { 1417 1429 tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL); 1418 1430 1419 1431 if (!tv_dac) ··· 1437 1447 return tv_dac; 1438 1448 } 1439 1449 1450 + static const char *thermal_controller_names[] = { 1451 + "NONE", 1452 + "LM63", 1453 + "ADM1032", 1454 + "ADM1030", 1455 + "MUA6649", 1456 + "LM64", 1457 + "F75375", 1458 + "ASC7512", 1459 + }; 1460 + 1461 + static const char *pp_lib_thermal_controller_names[] = { 1462 + "NONE", 1463 + "LM63", 1464 + "ADM1032", 1465 + "ADM1030", 1466 + "MUA6649", 1467 + "LM64", 1468 + "F75375", 1469 + "RV6xx", 1470 + "RV770", 1471 + "ADT7473", 1472 + }; 1473 + 1440 1474 union power_info { 1441 1475 struct _ATOM_POWERPLAY_INFO info; 1442 1476 struct _ATOM_POWERPLAY_INFO_V2 info_2; ··· 1480 1466 struct _ATOM_PPLIB_STATE *power_state; 1481 1467 int num_modes = 0, i, j; 1482 1468 int state_index = 0, mode_index = 0; 1483 - 1484 - atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); 1485 - 1486 - power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 1469 + struct radeon_i2c_bus_rec i2c_bus; 1487 1470 1488 1471 rdev->pm.default_power_state = NULL; 1489 1472 1490 - if (power_info) { 1473 + if (atom_parse_data_header(mode_info->atom_context, index, NULL, 1474 + &frev, &crev, &data_offset)) { 1475 + power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 1491 1476 if (frev < 4) { 1477 + /* add the i2c bus for thermal/fan chip */ 1478 + if (power_info->info.ucOverdriveThermalController > 0) { 1479 + DRM_INFO("Possible %s thermal controller at 0x%02x\n", 1480 + thermal_controller_names[power_info->info.ucOverdriveThermalController], 1481 + power_info->info.ucOverdriveControllerAddress >> 1); 1482 + i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); 1483 + rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); 1484 + } 1492 1485 num_modes = power_info->info.ucNumOfPowerModeEntries; 1493 1486 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) 1494 1487 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; ··· 1705 1684 } 1706 1685 } 1707 1686 } else if (frev == 4) { 1687 + /* add the i2c bus for thermal/fan chip */ 1688 + /* no support for internal controller yet */ 1689 + if (power_info->info_4.sThermalController.ucType > 0) { 1690 + if ((power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) || 1691 + (power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV770)) { 1692 + DRM_INFO("Internal thermal controller %s fan control\n", 1693 + (power_info->info_4.sThermalController.ucFanParameters & 1694 + ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 1695 + } else { 1696 + DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", 1697 + pp_lib_thermal_controller_names[power_info->info_4.sThermalController.ucType], 1698 + power_info->info_4.sThermalController.ucI2cAddress >> 1, 1699 + (power_info->info_4.sThermalController.ucFanParameters & 1700 + ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 1701 + i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info_4.sThermalController.ucI2cLine); 1702 + rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); 1703 + } 1704 + } 1708 1705 for (i = 0; i < power_info->info_4.ucNumStates; i++) { 1709 1706 mode_index = 0; 1710 1707 power_state = (struct _ATOM_PPLIB_STATE *)
+3 -4
drivers/gpu/drm/radeon/radeon_combios.c
··· 531 531 case CHIP_RS300: 532 532 switch (ddc_line) { 533 533 case RADEON_GPIO_DVI_DDC: 534 - /* in theory this should be hw capable, 535 - * but it doesn't seem to work 536 - */ 537 - i2c.hw_capable = false; 534 + i2c.hw_capable = true; 538 535 break; 539 536 default: 540 537 i2c.hw_capable = false; ··· 630 633 p1pll->reference_div = RBIOS16(pll_info + 0x10); 631 634 p1pll->pll_out_min = RBIOS32(pll_info + 0x12); 632 635 p1pll->pll_out_max = RBIOS32(pll_info + 0x16); 636 + p1pll->lcd_pll_out_min = p1pll->pll_out_min; 637 + p1pll->lcd_pll_out_max = p1pll->pll_out_max; 633 638 634 639 if (rev > 9) { 635 640 p1pll->pll_in_min = RBIOS32(pll_info + 0x36);
+1 -1
drivers/gpu/drm/radeon/radeon_connectors.c
··· 940 940 if (radeon_connector->edid) 941 941 kfree(radeon_connector->edid); 942 942 if (radeon_dig_connector->dp_i2c_bus) 943 - radeon_i2c_destroy_dp(radeon_dig_connector->dp_i2c_bus); 943 + radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus); 944 944 kfree(radeon_connector->con_priv); 945 945 drm_sysfs_connector_remove(connector); 946 946 drm_connector_cleanup(connector);
+7 -4
drivers/gpu/drm/radeon/radeon_cs.c
··· 193 193 radeon_bo_list_fence(&parser->validated, parser->ib->fence); 194 194 } 195 195 radeon_bo_list_unreserve(&parser->validated); 196 - for (i = 0; i < parser->nrelocs; i++) { 197 - if (parser->relocs[i].gobj) 198 - drm_gem_object_unreference_unlocked(parser->relocs[i].gobj); 196 + if (parser->relocs != NULL) { 197 + for (i = 0; i < parser->nrelocs; i++) { 198 + if (parser->relocs[i].gobj) 199 + drm_gem_object_unreference_unlocked(parser->relocs[i].gobj); 200 + } 199 201 } 200 202 kfree(parser->track); 201 203 kfree(parser->relocs); ··· 245 243 } 246 244 r = radeon_cs_parser_relocs(&parser); 247 245 if (r) { 248 - DRM_ERROR("Failed to parse relocation !\n"); 246 + if (r != -ERESTARTSYS) 247 + DRM_ERROR("Failed to parse relocation %d!\n", r); 249 248 radeon_cs_parser_fini(&parser, r); 250 249 mutex_unlock(&rdev->cs_mutex); 251 250 return r;
+38 -199
drivers/gpu/drm/radeon/radeon_device.c
··· 34 34 #include <linux/vga_switcheroo.h> 35 35 #include "radeon_reg.h" 36 36 #include "radeon.h" 37 - #include "radeon_asic.h" 38 37 #include "atom.h" 39 38 40 39 /* ··· 242 243 243 244 } 244 245 246 + void radeon_update_bandwidth_info(struct radeon_device *rdev) 247 + { 248 + fixed20_12 a; 249 + u32 sclk, mclk; 250 + 251 + if (rdev->flags & RADEON_IS_IGP) { 252 + sclk = radeon_get_engine_clock(rdev); 253 + mclk = rdev->clock.default_mclk; 254 + 255 + a.full = rfixed_const(100); 256 + rdev->pm.sclk.full = rfixed_const(sclk); 257 + rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 258 + rdev->pm.mclk.full = rfixed_const(mclk); 259 + rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a); 260 + 261 + a.full = rfixed_const(16); 262 + /* core_bandwidth = sclk(Mhz) * 16 */ 263 + rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a); 264 + } else { 265 + sclk = radeon_get_engine_clock(rdev); 266 + mclk = radeon_get_memory_clock(rdev); 267 + 268 + a.full = rfixed_const(100); 269 + rdev->pm.sclk.full = rfixed_const(sclk); 270 + rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 271 + rdev->pm.mclk.full = rfixed_const(mclk); 272 + rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a); 273 + } 274 + } 275 + 245 276 bool radeon_boot_test_post_card(struct radeon_device *rdev) 246 277 { 247 278 if (radeon_card_posted(rdev)) ··· 317 288 rdev->dummy_page.page = NULL; 318 289 } 319 290 320 - 321 - /* 322 - * Registers accessors functions. 323 - */ 324 - uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg) 325 - { 326 - DRM_ERROR("Invalid callback to read register 0x%04X\n", reg); 327 - BUG_ON(1); 328 - return 0; 329 - } 330 - 331 - void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) 332 - { 333 - DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n", 334 - reg, v); 335 - BUG_ON(1); 336 - } 337 - 338 - void radeon_register_accessor_init(struct radeon_device *rdev) 339 - { 340 - rdev->mc_rreg = &radeon_invalid_rreg; 341 - rdev->mc_wreg = &radeon_invalid_wreg; 342 - rdev->pll_rreg = &radeon_invalid_rreg; 343 - rdev->pll_wreg = &radeon_invalid_wreg; 344 - rdev->pciep_rreg = &radeon_invalid_rreg; 345 - rdev->pciep_wreg = &radeon_invalid_wreg; 346 - 347 - /* Don't change order as we are overridding accessor. */ 348 - if (rdev->family < CHIP_RV515) { 349 - rdev->pcie_reg_mask = 0xff; 350 - } else { 351 - rdev->pcie_reg_mask = 0x7ff; 352 - } 353 - /* FIXME: not sure here */ 354 - if (rdev->family <= CHIP_R580) { 355 - rdev->pll_rreg = &r100_pll_rreg; 356 - rdev->pll_wreg = &r100_pll_wreg; 357 - } 358 - if (rdev->family >= CHIP_R420) { 359 - rdev->mc_rreg = &r420_mc_rreg; 360 - rdev->mc_wreg = &r420_mc_wreg; 361 - } 362 - if (rdev->family >= CHIP_RV515) { 363 - rdev->mc_rreg = &rv515_mc_rreg; 364 - rdev->mc_wreg = &rv515_mc_wreg; 365 - } 366 - if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) { 367 - rdev->mc_rreg = &rs400_mc_rreg; 368 - rdev->mc_wreg = &rs400_mc_wreg; 369 - } 370 - if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) { 371 - rdev->mc_rreg = &rs690_mc_rreg; 372 - rdev->mc_wreg = &rs690_mc_wreg; 373 - } 374 - if (rdev->family == CHIP_RS600) { 375 - rdev->mc_rreg = &rs600_mc_rreg; 376 - rdev->mc_wreg = &rs600_mc_wreg; 377 - } 378 - if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_RV740)) { 379 - rdev->pciep_rreg = &r600_pciep_rreg; 380 - rdev->pciep_wreg = &r600_pciep_wreg; 381 - } 382 - } 383 - 384 - 385 - /* 386 - * ASIC 387 - */ 388 - int radeon_asic_init(struct radeon_device *rdev) 389 - { 390 - radeon_register_accessor_init(rdev); 391 - switch (rdev->family) { 392 - case CHIP_R100: 393 - case CHIP_RV100: 394 - case CHIP_RS100: 395 - case CHIP_RV200: 396 - case CHIP_RS200: 397 - rdev->asic = &r100_asic; 398 - break; 399 - case CHIP_R200: 400 - case CHIP_RV250: 401 - case CHIP_RS300: 402 - case CHIP_RV280: 403 - rdev->asic = &r200_asic; 404 - break; 405 - case CHIP_R300: 406 - case CHIP_R350: 407 - case CHIP_RV350: 408 - case CHIP_RV380: 409 - if (rdev->flags & RADEON_IS_PCIE) 410 - rdev->asic = &r300_asic_pcie; 411 - else 412 - rdev->asic = &r300_asic; 413 - break; 414 - case CHIP_R420: 415 - case CHIP_R423: 416 - case CHIP_RV410: 417 - rdev->asic = &r420_asic; 418 - break; 419 - case CHIP_RS400: 420 - case CHIP_RS480: 421 - rdev->asic = &rs400_asic; 422 - break; 423 - case CHIP_RS600: 424 - rdev->asic = &rs600_asic; 425 - break; 426 - case CHIP_RS690: 427 - case CHIP_RS740: 428 - rdev->asic = &rs690_asic; 429 - break; 430 - case CHIP_RV515: 431 - rdev->asic = &rv515_asic; 432 - break; 433 - case CHIP_R520: 434 - case CHIP_RV530: 435 - case CHIP_RV560: 436 - case CHIP_RV570: 437 - case CHIP_R580: 438 - rdev->asic = &r520_asic; 439 - break; 440 - case CHIP_R600: 441 - case CHIP_RV610: 442 - case CHIP_RV630: 443 - case CHIP_RV620: 444 - case CHIP_RV635: 445 - case CHIP_RV670: 446 - case CHIP_RS780: 447 - case CHIP_RS880: 448 - rdev->asic = &r600_asic; 449 - break; 450 - case CHIP_RV770: 451 - case CHIP_RV730: 452 - case CHIP_RV710: 453 - case CHIP_RV740: 454 - rdev->asic = &rv770_asic; 455 - break; 456 - case CHIP_CEDAR: 457 - case CHIP_REDWOOD: 458 - case CHIP_JUNIPER: 459 - case CHIP_CYPRESS: 460 - case CHIP_HEMLOCK: 461 - rdev->asic = &evergreen_asic; 462 - break; 463 - default: 464 - /* FIXME: not supported yet */ 465 - return -EINVAL; 466 - } 467 - 468 - if (rdev->flags & RADEON_IS_IGP) { 469 - rdev->asic->get_memory_clock = NULL; 470 - rdev->asic->set_memory_clock = NULL; 471 - } 472 - 473 - return 0; 474 - } 475 - 476 - 477 - /* 478 - * Wrapper around modesetting bits. 479 - */ 480 - int radeon_clocks_init(struct radeon_device *rdev) 481 - { 482 - int r; 483 - 484 - r = radeon_static_clocks_init(rdev->ddev); 485 - if (r) { 486 - return r; 487 - } 488 - DRM_INFO("Clocks initialized !\n"); 489 - return 0; 490 - } 491 - 492 - void radeon_clocks_fini(struct radeon_device *rdev) 493 - { 494 - } 495 291 496 292 /* ATOM accessor methods */ 497 293 static uint32_t cail_pll_read(struct card_info *info, uint32_t reg) ··· 420 566 VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 421 567 else 422 568 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 423 - } 424 - 425 - void radeon_agp_disable(struct radeon_device *rdev) 426 - { 427 - rdev->flags &= ~RADEON_IS_AGP; 428 - if (rdev->family >= CHIP_R600) { 429 - DRM_INFO("Forcing AGP to PCIE mode\n"); 430 - rdev->flags |= RADEON_IS_PCIE; 431 - } else if (rdev->family >= CHIP_RV515 || 432 - rdev->family == CHIP_RV380 || 433 - rdev->family == CHIP_RV410 || 434 - rdev->family == CHIP_R423) { 435 - DRM_INFO("Forcing AGP to PCIE mode\n"); 436 - rdev->flags |= RADEON_IS_PCIE; 437 - rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush; 438 - rdev->asic->gart_set_page = &rv370_pcie_gart_set_page; 439 - } else { 440 - DRM_INFO("Forcing AGP to PCI mode\n"); 441 - rdev->flags |= RADEON_IS_PCI; 442 - rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush; 443 - rdev->asic->gart_set_page = &r100_pci_gart_set_page; 444 - } 445 - rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; 446 569 } 447 570 448 571 void radeon_check_arguments(struct radeon_device *rdev) ··· 562 731 if (r) 563 732 return r; 564 733 radeon_check_arguments(rdev); 734 + 735 + /* all of the newer IGP chips have an internal gart 736 + * However some rs4xx report as AGP, so remove that here. 737 + */ 738 + if ((rdev->family >= CHIP_RS400) && 739 + (rdev->flags & RADEON_IS_IGP)) { 740 + rdev->flags &= ~RADEON_IS_AGP; 741 + } 565 742 566 743 if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) { 567 744 radeon_agp_disable(rdev);
+51 -17
drivers/gpu/drm/radeon/radeon_display.c
··· 368 368 369 369 if (rdev->bios) { 370 370 if (rdev->is_atom_bios) { 371 - if (rdev->family >= CHIP_R600) 371 + ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); 372 + if (ret == false) 372 373 ret = radeon_get_atom_connector_info_from_object_table(dev); 373 - else 374 - ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); 375 374 } else { 376 375 ret = radeon_get_legacy_connector_info_from_bios(dev); 377 376 if (ret == false) ··· 468 469 uint32_t best_error = 0xffffffff; 469 470 uint32_t best_vco_diff = 1; 470 471 uint32_t post_div; 472 + u32 pll_out_min, pll_out_max; 471 473 472 474 DRM_DEBUG("PLL freq %llu %u %u\n", freq, pll->min_ref_div, pll->max_ref_div); 473 475 freq = freq * 1000; 476 + 477 + if (pll->flags & RADEON_PLL_IS_LCD) { 478 + pll_out_min = pll->lcd_pll_out_min; 479 + pll_out_max = pll->lcd_pll_out_max; 480 + } else { 481 + pll_out_min = pll->pll_out_min; 482 + pll_out_max = pll->pll_out_max; 483 + } 474 484 475 485 if (pll->flags & RADEON_PLL_USE_REF_DIV) 476 486 min_ref_div = max_ref_div = pll->reference_div; ··· 544 536 tmp = (uint64_t)pll->reference_freq * feedback_div; 545 537 vco = radeon_div(tmp, ref_div); 546 538 547 - if (vco < pll->pll_out_min) { 539 + if (vco < pll_out_min) { 548 540 min_feed_div = feedback_div + 1; 549 541 continue; 550 - } else if (vco > pll->pll_out_max) { 542 + } else if (vco > pll_out_max) { 551 543 max_feed_div = feedback_div; 552 544 continue; 553 545 } ··· 683 675 { 684 676 fixed20_12 ffreq, max_error, error, pll_out, a; 685 677 u32 vco; 678 + u32 pll_out_min, pll_out_max; 679 + 680 + if (pll->flags & RADEON_PLL_IS_LCD) { 681 + pll_out_min = pll->lcd_pll_out_min; 682 + pll_out_max = pll->lcd_pll_out_max; 683 + } else { 684 + pll_out_min = pll->pll_out_min; 685 + pll_out_max = pll->pll_out_max; 686 + } 686 687 687 688 ffreq.full = rfixed_const(freq); 688 689 /* max_error = ffreq * 0.0025; */ ··· 703 686 vco = pll->reference_freq * (((*fb_div) * 10) + (*fb_div_frac)); 704 687 vco = vco / ((*ref_div) * 10); 705 688 706 - if ((vco < pll->pll_out_min) || (vco > pll->pll_out_max)) 689 + if ((vco < pll_out_min) || (vco > pll_out_max)) 707 690 continue; 708 691 709 692 /* pll_out = vco / post_div; */ ··· 731 714 { 732 715 u32 fb_div = 0, fb_div_frac = 0, post_div = 0, ref_div = 0; 733 716 u32 best_freq = 0, vco_frequency; 717 + u32 pll_out_min, pll_out_max; 718 + 719 + if (pll->flags & RADEON_PLL_IS_LCD) { 720 + pll_out_min = pll->lcd_pll_out_min; 721 + pll_out_max = pll->lcd_pll_out_max; 722 + } else { 723 + pll_out_min = pll->pll_out_min; 724 + pll_out_max = pll->pll_out_max; 725 + } 734 726 735 727 /* freq = freq / 10; */ 736 728 do_div(freq, 10); ··· 750 724 goto done; 751 725 752 726 vco_frequency = freq * post_div; 753 - if ((vco_frequency < pll->pll_out_min) || (vco_frequency > pll->pll_out_max)) 727 + if ((vco_frequency < pll_out_min) || (vco_frequency > pll_out_max)) 754 728 goto done; 755 729 756 730 if (pll->flags & RADEON_PLL_USE_REF_DIV) { ··· 775 749 continue; 776 750 777 751 vco_frequency = freq * post_div; 778 - if ((vco_frequency < pll->pll_out_min) || (vco_frequency > pll->pll_out_max)) 752 + if ((vco_frequency < pll_out_min) || (vco_frequency > pll_out_max)) 779 753 continue; 780 754 if (pll->flags & RADEON_PLL_USE_REF_DIV) { 781 755 ref_div = pll->reference_div; ··· 971 945 return 0; 972 946 } 973 947 948 + void radeon_update_display_priority(struct radeon_device *rdev) 949 + { 950 + /* adjustment options for the display watermarks */ 951 + if ((radeon_disp_priority == 0) || (radeon_disp_priority > 2)) { 952 + /* set display priority to high for r3xx, rv515 chips 953 + * this avoids flickering due to underflow to the 954 + * display controllers during heavy acceleration. 955 + */ 956 + if (ASIC_IS_R300(rdev) || (rdev->family == CHIP_RV515)) 957 + rdev->disp_priority = 2; 958 + else 959 + rdev->disp_priority = 0; 960 + } else 961 + rdev->disp_priority = radeon_disp_priority; 962 + 963 + } 964 + 974 965 int radeon_modeset_init(struct radeon_device *rdev) 975 966 { 976 967 int i; ··· 1017 974 if (!rdev->is_atom_bios) { 1018 975 /* check for hardcoded EDID in BIOS */ 1019 976 radeon_combios_check_hardcoded_edid(rdev); 1020 - } 1021 - 1022 - if (rdev->flags & RADEON_SINGLE_CRTC) 1023 - rdev->num_crtc = 1; 1024 - else { 1025 - if (ASIC_IS_DCE4(rdev)) 1026 - rdev->num_crtc = 6; 1027 - else 1028 - rdev->num_crtc = 2; 1029 977 } 1030 978 1031 979 /* allocate crtcs */
+10 -1
drivers/gpu/drm/radeon/radeon_drv.c
··· 42 42 * KMS wrapper. 43 43 * - 2.0.0 - initial interface 44 44 * - 2.1.0 - add square tiling interface 45 + * - 2.2.0 - add r6xx/r7xx const buffer support 45 46 */ 46 47 #define KMS_DRIVER_MAJOR 2 47 - #define KMS_DRIVER_MINOR 1 48 + #define KMS_DRIVER_MINOR 2 48 49 #define KMS_DRIVER_PATCHLEVEL 0 49 50 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 50 51 int radeon_driver_unload_kms(struct drm_device *dev); ··· 92 91 int radeon_new_pll = -1; 93 92 int radeon_dynpm = -1; 94 93 int radeon_audio = 1; 94 + int radeon_disp_priority = 0; 95 + int radeon_hw_i2c = 0; 95 96 96 97 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); 97 98 module_param_named(no_wb, radeon_no_wb, int, 0444); ··· 136 133 137 134 MODULE_PARM_DESC(audio, "Audio enable (0 = disable)"); 138 135 module_param_named(audio, radeon_audio, int, 0444); 136 + 137 + MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)"); 138 + module_param_named(disp_priority, radeon_disp_priority, int, 0444); 139 + 140 + MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)"); 141 + module_param_named(hw_i2c, radeon_hw_i2c, int, 0444); 139 142 140 143 static int radeon_suspend(struct drm_device *dev, pm_message_t state) 141 144 {
+2 -1
drivers/gpu/drm/radeon/radeon_drv.h
··· 107 107 * 1.30- Add support for occlusion queries 108 108 * 1.31- Add support for num Z pipes from GET_PARAM 109 109 * 1.32- fixes for rv740 setup 110 + * 1.33- Add r6xx/r7xx const buffer support 110 111 */ 111 112 #define DRIVER_MAJOR 1 112 - #define DRIVER_MINOR 32 113 + #define DRIVER_MINOR 33 113 114 #define DRIVER_PATCHLEVEL 0 114 115 115 116 enum radeon_cp_microcode_version {
+64 -57
drivers/gpu/drm/radeon/radeon_encoders.c
··· 302 302 } 303 303 304 304 if (ASIC_IS_DCE3(rdev) && 305 - (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT))) { 305 + (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT))) { 306 306 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); 307 307 radeon_dp_set_link_config(connector, mode); 308 308 } ··· 519 519 break; 520 520 } 521 521 522 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); 522 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 523 + return; 523 524 524 525 switch (frev) { 525 526 case 1: ··· 594 593 } 595 594 596 595 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 597 - r600_hdmi_enable(encoder, hdmi_detected); 598 596 } 599 597 600 598 int ··· 708 708 struct radeon_connector_atom_dig *dig_connector = 709 709 radeon_get_atom_connector_priv_from_encoder(encoder); 710 710 union dig_encoder_control args; 711 - int index = 0, num = 0; 711 + int index = 0; 712 712 uint8_t frev, crev; 713 713 714 714 if (!dig || !dig_connector) ··· 724 724 else 725 725 index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl); 726 726 } 727 - num = dig->dig_encoder + 1; 728 727 729 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); 728 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 729 + return; 730 730 731 731 args.v1.ucAction = action; 732 732 args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); ··· 785 785 struct drm_connector *connector; 786 786 struct radeon_connector *radeon_connector; 787 787 union dig_transmitter_control args; 788 - int index = 0, num = 0; 788 + int index = 0; 789 789 uint8_t frev, crev; 790 790 bool is_dp = false; 791 791 int pll_id = 0; ··· 814 814 } 815 815 } 816 816 817 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); 817 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 818 + return; 818 819 819 820 args.v1.ucAction = action; 820 821 if (action == ATOM_TRANSMITTER_ACTION_INIT) { ··· 861 860 switch (radeon_encoder->encoder_id) { 862 861 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 863 862 args.v3.acConfig.ucTransmitterSel = 0; 864 - num = 0; 865 863 break; 866 864 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 867 865 args.v3.acConfig.ucTransmitterSel = 1; 868 - num = 1; 869 866 break; 870 867 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 871 868 args.v3.acConfig.ucTransmitterSel = 2; 872 - num = 2; 873 869 break; 874 870 } 875 871 ··· 877 879 args.v3.acConfig.fCoherentMode = 1; 878 880 } 879 881 } else if (ASIC_IS_DCE32(rdev)) { 880 - if (dig->dig_encoder == 1) 881 - args.v2.acConfig.ucEncoderSel = 1; 882 + args.v2.acConfig.ucEncoderSel = dig->dig_encoder; 882 883 if (dig_connector->linkb) 883 884 args.v2.acConfig.ucLinkSel = 1; 884 885 885 886 switch (radeon_encoder->encoder_id) { 886 887 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 887 888 args.v2.acConfig.ucTransmitterSel = 0; 888 - num = 0; 889 889 break; 890 890 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 891 891 args.v2.acConfig.ucTransmitterSel = 1; 892 - num = 1; 893 892 break; 894 893 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: 895 894 args.v2.acConfig.ucTransmitterSel = 2; 896 - num = 2; 897 895 break; 898 896 } 899 897 ··· 907 913 else 908 914 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER; 909 915 910 - switch (radeon_encoder->encoder_id) { 911 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 912 - if (rdev->flags & RADEON_IS_IGP) { 913 - if (radeon_encoder->pixel_clock > 165000) { 914 - if (dig_connector->igp_lane_info & 0x3) 915 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_7; 916 - else if (dig_connector->igp_lane_info & 0xc) 917 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_15; 918 - } else { 919 - if (dig_connector->igp_lane_info & 0x1) 920 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_3; 921 - else if (dig_connector->igp_lane_info & 0x2) 922 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_4_7; 923 - else if (dig_connector->igp_lane_info & 0x4) 924 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_11; 925 - else if (dig_connector->igp_lane_info & 0x8) 926 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_12_15; 927 - } 916 + if ((rdev->flags & RADEON_IS_IGP) && 917 + (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_UNIPHY)) { 918 + if (is_dp || (radeon_encoder->pixel_clock <= 165000)) { 919 + if (dig_connector->igp_lane_info & 0x1) 920 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_3; 921 + else if (dig_connector->igp_lane_info & 0x2) 922 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_4_7; 923 + else if (dig_connector->igp_lane_info & 0x4) 924 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_11; 925 + else if (dig_connector->igp_lane_info & 0x8) 926 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_12_15; 927 + } else { 928 + if (dig_connector->igp_lane_info & 0x3) 929 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_7; 930 + else if (dig_connector->igp_lane_info & 0xc) 931 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_15; 928 932 } 929 - break; 930 933 } 931 - 932 - if (radeon_encoder->pixel_clock > 165000) 933 - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_8LANE_LINK; 934 934 935 935 if (dig_connector->linkb) 936 936 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKB; ··· 936 948 else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { 937 949 if (dig->coherent_mode) 938 950 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_COHERENT; 951 + if (radeon_encoder->pixel_clock > 165000) 952 + args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_8LANE_LINK; 939 953 } 940 954 } 941 955 ··· 1044 1054 if (is_dig) { 1045 1055 switch (mode) { 1046 1056 case DRM_MODE_DPMS_ON: 1047 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); 1048 - { 1057 + if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { 1049 1058 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); 1059 + 1050 1060 dp_link_train(encoder, connector); 1061 + if (ASIC_IS_DCE4(rdev)) 1062 + atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); 1051 1063 } 1064 + if (!ASIC_IS_DCE4(rdev)) 1065 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); 1052 1066 break; 1053 1067 case DRM_MODE_DPMS_STANDBY: 1054 1068 case DRM_MODE_DPMS_SUSPEND: 1055 1069 case DRM_MODE_DPMS_OFF: 1056 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); 1070 + if (!ASIC_IS_DCE4(rdev)) 1071 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); 1072 + if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { 1073 + if (ASIC_IS_DCE4(rdev)) 1074 + atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF); 1075 + } 1057 1076 break; 1058 1077 } 1059 1078 } else { ··· 1103 1104 1104 1105 memset(&args, 0, sizeof(args)); 1105 1106 1106 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); 1107 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 1108 + return; 1107 1109 1108 1110 switch (frev) { 1109 1111 case 1: ··· 1216 1216 } 1217 1217 1218 1218 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 1219 + 1220 + /* update scratch regs with new routing */ 1221 + radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); 1219 1222 } 1220 1223 1221 1224 static void ··· 1329 1326 struct drm_device *dev = encoder->dev; 1330 1327 struct radeon_device *rdev = dev->dev_private; 1331 1328 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1332 - struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); 1333 1329 1334 - if (radeon_encoder->active_device & 1335 - (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) { 1336 - struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 1337 - if (dig) 1338 - dig->dig_encoder = radeon_atom_pick_dig_encoder(encoder); 1339 - } 1340 1330 radeon_encoder->pixel_clock = adjusted_mode->clock; 1341 - 1342 - radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); 1343 - atombios_set_encoder_crtc_source(encoder); 1344 1331 1345 1332 if (ASIC_IS_AVIVO(rdev)) { 1346 1333 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) ··· 1389 1396 } 1390 1397 atombios_apply_encoder_quirks(encoder, adjusted_mode); 1391 1398 1392 - /* XXX */ 1393 - if (!ASIC_IS_DCE4(rdev)) 1399 + if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { 1400 + r600_hdmi_enable(encoder); 1394 1401 r600_hdmi_setmode(encoder, adjusted_mode); 1402 + } 1395 1403 } 1396 1404 1397 1405 static bool ··· 1412 1418 1413 1419 memset(&args, 0, sizeof(args)); 1414 1420 1415 - atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); 1421 + if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 1422 + return false; 1416 1423 1417 1424 args.sDacload.ucMisc = 0; 1418 1425 ··· 1487 1492 1488 1493 static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) 1489 1494 { 1495 + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1496 + 1497 + if (radeon_encoder->active_device & 1498 + (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) { 1499 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 1500 + if (dig) 1501 + dig->dig_encoder = radeon_atom_pick_dig_encoder(encoder); 1502 + } 1503 + 1490 1504 radeon_atom_output_lock(encoder, true); 1491 1505 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1506 + 1507 + /* this is needed for the pll/ss setup to work correctly in some cases */ 1508 + atombios_set_encoder_crtc_source(encoder); 1492 1509 } 1493 1510 1494 1511 static void radeon_atom_encoder_commit(struct drm_encoder *encoder) ··· 1516 1509 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1517 1510 1518 1511 if (radeon_encoder_is_digital(encoder)) { 1512 + if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) 1513 + r600_hdmi_disable(encoder); 1519 1514 dig = radeon_encoder->enc_priv; 1520 1515 dig->dig_encoder = -1; 1521 1516 } ··· 1668 1659 drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs); 1669 1660 break; 1670 1661 } 1671 - 1672 - r600_hdmi_init(encoder); 1673 1662 }
+73 -80
drivers/gpu/drm/radeon/radeon_i2c.c
··· 59 59 return false; 60 60 } 61 61 62 + /* bit banging i2c */ 62 63 63 64 static void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state) 64 65 { ··· 182 181 WREG32(rec->en_data_reg, val); 183 182 } 184 183 184 + static int pre_xfer(struct i2c_adapter *i2c_adap) 185 + { 186 + struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); 187 + 188 + radeon_i2c_do_lock(i2c, 1); 189 + 190 + return 0; 191 + } 192 + 193 + static void post_xfer(struct i2c_adapter *i2c_adap) 194 + { 195 + struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); 196 + 197 + radeon_i2c_do_lock(i2c, 0); 198 + } 199 + 200 + /* hw i2c */ 201 + 185 202 static u32 radeon_get_i2c_prescale(struct radeon_device *rdev) 186 203 { 187 - struct radeon_pll *spll = &rdev->clock.spll; 188 204 u32 sclk = radeon_get_engine_clock(rdev); 189 205 u32 prescale = 0; 190 - u32 n, m; 191 - u8 loop; 206 + u32 nm; 207 + u8 n, m, loop; 192 208 int i2c_clock; 193 209 194 210 switch (rdev->family) { ··· 221 203 case CHIP_R300: 222 204 case CHIP_R350: 223 205 case CHIP_RV350: 224 - n = (spll->reference_freq) / (4 * 6); 206 + i2c_clock = 60; 207 + nm = (sclk * 10) / (i2c_clock * 4); 225 208 for (loop = 1; loop < 255; loop++) { 226 - if ((loop * (loop - 1)) > n) 209 + if ((nm / loop) < loop) 227 210 break; 228 211 } 229 - m = loop - 1; 230 - prescale = m | (loop << 8); 212 + n = loop - 1; 213 + m = loop - 2; 214 + prescale = m | (n << 8); 231 215 break; 232 216 case CHIP_RV380: 233 217 case CHIP_RS400: ··· 237 217 case CHIP_R420: 238 218 case CHIP_R423: 239 219 case CHIP_RV410: 240 - sclk = radeon_get_engine_clock(rdev); 241 220 prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128; 242 221 break; 243 222 case CHIP_RS600: ··· 251 232 case CHIP_RV570: 252 233 case CHIP_R580: 253 234 i2c_clock = 50; 254 - sclk = radeon_get_engine_clock(rdev); 255 235 if (rdev->family == CHIP_R520) 256 236 prescale = (127 << 8) + ((sclk * 10) / (4 * 127 * i2c_clock)); 257 237 else ··· 309 291 prescale = radeon_get_i2c_prescale(rdev); 310 292 311 293 reg = ((prescale << RADEON_I2C_PRESCALE_SHIFT) | 294 + RADEON_I2C_DRIVE_EN | 312 295 RADEON_I2C_START | 313 296 RADEON_I2C_STOP | 314 297 RADEON_I2C_GO); ··· 776 757 return ret; 777 758 } 778 759 779 - static int radeon_sw_i2c_xfer(struct i2c_adapter *i2c_adap, 760 + static int radeon_hw_i2c_xfer(struct i2c_adapter *i2c_adap, 780 761 struct i2c_msg *msgs, int num) 781 - { 782 - struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); 783 - int ret; 784 - 785 - radeon_i2c_do_lock(i2c, 1); 786 - ret = i2c_transfer(&i2c->algo.radeon.bit_adapter, msgs, num); 787 - radeon_i2c_do_lock(i2c, 0); 788 - 789 - return ret; 790 - } 791 - 792 - static int radeon_i2c_xfer(struct i2c_adapter *i2c_adap, 793 - struct i2c_msg *msgs, int num) 794 762 { 795 763 struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); 796 764 struct radeon_device *rdev = i2c->dev->dev_private; 797 765 struct radeon_i2c_bus_rec *rec = &i2c->rec; 798 - int ret; 766 + int ret = 0; 799 767 800 768 switch (rdev->family) { 801 769 case CHIP_R100: ··· 803 797 case CHIP_RV410: 804 798 case CHIP_RS400: 805 799 case CHIP_RS480: 806 - if (rec->hw_capable) 807 - ret = r100_hw_i2c_xfer(i2c_adap, msgs, num); 808 - else 809 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 800 + ret = r100_hw_i2c_xfer(i2c_adap, msgs, num); 810 801 break; 811 802 case CHIP_RS600: 812 803 case CHIP_RS690: 813 804 case CHIP_RS740: 814 805 /* XXX fill in hw i2c implementation */ 815 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 816 806 break; 817 807 case CHIP_RV515: 818 808 case CHIP_R520: ··· 816 814 case CHIP_RV560: 817 815 case CHIP_RV570: 818 816 case CHIP_R580: 819 - if (rec->hw_capable) { 820 - if (rec->mm_i2c) 821 - ret = r100_hw_i2c_xfer(i2c_adap, msgs, num); 822 - else 823 - ret = r500_hw_i2c_xfer(i2c_adap, msgs, num); 824 - } else 825 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 817 + if (rec->mm_i2c) 818 + ret = r100_hw_i2c_xfer(i2c_adap, msgs, num); 819 + else 820 + ret = r500_hw_i2c_xfer(i2c_adap, msgs, num); 826 821 break; 827 822 case CHIP_R600: 828 823 case CHIP_RV610: 829 824 case CHIP_RV630: 830 825 case CHIP_RV670: 831 826 /* XXX fill in hw i2c implementation */ 832 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 833 827 break; 834 828 case CHIP_RV620: 835 829 case CHIP_RV635: ··· 836 838 case CHIP_RV710: 837 839 case CHIP_RV740: 838 840 /* XXX fill in hw i2c implementation */ 839 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 840 841 break; 841 842 case CHIP_CEDAR: 842 843 case CHIP_REDWOOD: ··· 843 846 case CHIP_CYPRESS: 844 847 case CHIP_HEMLOCK: 845 848 /* XXX fill in hw i2c implementation */ 846 - ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num); 847 849 break; 848 850 default: 849 851 DRM_ERROR("i2c: unhandled radeon chip\n"); ··· 853 857 return ret; 854 858 } 855 859 856 - static u32 radeon_i2c_func(struct i2c_adapter *adap) 860 + static u32 radeon_hw_i2c_func(struct i2c_adapter *adap) 857 861 { 858 862 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 859 863 } 860 864 861 865 static const struct i2c_algorithm radeon_i2c_algo = { 862 - .master_xfer = radeon_i2c_xfer, 863 - .functionality = radeon_i2c_func, 866 + .master_xfer = radeon_hw_i2c_xfer, 867 + .functionality = radeon_hw_i2c_func, 864 868 }; 865 869 866 870 struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, 867 871 struct radeon_i2c_bus_rec *rec, 868 872 const char *name) 869 873 { 874 + struct radeon_device *rdev = dev->dev_private; 870 875 struct radeon_i2c_chan *i2c; 871 876 int ret; 872 877 ··· 875 878 if (i2c == NULL) 876 879 return NULL; 877 880 878 - /* set the internal bit adapter */ 879 - i2c->algo.radeon.bit_adapter.owner = THIS_MODULE; 880 - i2c_set_adapdata(&i2c->algo.radeon.bit_adapter, i2c); 881 - sprintf(i2c->algo.radeon.bit_adapter.name, "Radeon internal i2c bit bus %s", name); 882 - i2c->algo.radeon.bit_adapter.algo_data = &i2c->algo.radeon.bit_data; 883 - i2c->algo.radeon.bit_data.setsda = set_data; 884 - i2c->algo.radeon.bit_data.setscl = set_clock; 885 - i2c->algo.radeon.bit_data.getsda = get_data; 886 - i2c->algo.radeon.bit_data.getscl = get_clock; 887 - i2c->algo.radeon.bit_data.udelay = 20; 888 - /* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always 889 - * make this, 2 jiffies is a lot more reliable */ 890 - i2c->algo.radeon.bit_data.timeout = 2; 891 - i2c->algo.radeon.bit_data.data = i2c; 892 - ret = i2c_bit_add_bus(&i2c->algo.radeon.bit_adapter); 893 - if (ret) { 894 - DRM_ERROR("Failed to register internal bit i2c %s\n", name); 895 - goto out_free; 896 - } 897 - /* set the radeon i2c adapter */ 898 - i2c->dev = dev; 899 881 i2c->rec = *rec; 900 882 i2c->adapter.owner = THIS_MODULE; 883 + i2c->dev = dev; 901 884 i2c_set_adapdata(&i2c->adapter, i2c); 902 - sprintf(i2c->adapter.name, "Radeon i2c %s", name); 903 - i2c->adapter.algo_data = &i2c->algo.radeon; 904 - i2c->adapter.algo = &radeon_i2c_algo; 905 - ret = i2c_add_adapter(&i2c->adapter); 906 - if (ret) { 907 - DRM_ERROR("Failed to register i2c %s\n", name); 908 - goto out_free; 885 + if (rec->mm_i2c || 886 + (rec->hw_capable && 887 + radeon_hw_i2c && 888 + ((rdev->family <= CHIP_RS480) || 889 + ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) { 890 + /* set the radeon hw i2c adapter */ 891 + sprintf(i2c->adapter.name, "Radeon i2c hw bus %s", name); 892 + i2c->adapter.algo = &radeon_i2c_algo; 893 + ret = i2c_add_adapter(&i2c->adapter); 894 + if (ret) { 895 + DRM_ERROR("Failed to register hw i2c %s\n", name); 896 + goto out_free; 897 + } 898 + } else { 899 + /* set the radeon bit adapter */ 900 + sprintf(i2c->adapter.name, "Radeon i2c bit bus %s", name); 901 + i2c->adapter.algo_data = &i2c->algo.bit; 902 + i2c->algo.bit.pre_xfer = pre_xfer; 903 + i2c->algo.bit.post_xfer = post_xfer; 904 + i2c->algo.bit.setsda = set_data; 905 + i2c->algo.bit.setscl = set_clock; 906 + i2c->algo.bit.getsda = get_data; 907 + i2c->algo.bit.getscl = get_clock; 908 + i2c->algo.bit.udelay = 20; 909 + /* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always 910 + * make this, 2 jiffies is a lot more reliable */ 911 + i2c->algo.bit.timeout = 2; 912 + i2c->algo.bit.data = i2c; 913 + ret = i2c_bit_add_bus(&i2c->adapter); 914 + if (ret) { 915 + DRM_ERROR("Failed to register bit i2c %s\n", name); 916 + goto out_free; 917 + } 909 918 } 910 919 911 920 return i2c; ··· 956 953 { 957 954 if (!i2c) 958 955 return; 959 - i2c_del_adapter(&i2c->algo.radeon.bit_adapter); 960 - i2c_del_adapter(&i2c->adapter); 961 - kfree(i2c); 962 - } 963 - 964 - void radeon_i2c_destroy_dp(struct radeon_i2c_chan *i2c) 965 - { 966 - if (!i2c) 967 - return; 968 - 969 956 i2c_del_adapter(&i2c->adapter); 970 957 kfree(i2c); 971 958 }
+11 -9
drivers/gpu/drm/radeon/radeon_irq_kms.c
··· 67 67 68 68 /* Disable *all* interrupts */ 69 69 rdev->irq.sw_int = false; 70 - for (i = 0; i < 2; i++) { 70 + for (i = 0; i < rdev->num_crtc; i++) 71 71 rdev->irq.crtc_vblank_int[i] = false; 72 - } 72 + for (i = 0; i < 6; i++) 73 + rdev->irq.hpd[i] = false; 73 74 radeon_irq_set(rdev); 74 75 /* Clear bits */ 75 76 radeon_irq_process(rdev); ··· 96 95 } 97 96 /* Disable *all* interrupts */ 98 97 rdev->irq.sw_int = false; 99 - for (i = 0; i < 2; i++) { 98 + for (i = 0; i < rdev->num_crtc; i++) 100 99 rdev->irq.crtc_vblank_int[i] = false; 100 + for (i = 0; i < 6; i++) 101 101 rdev->irq.hpd[i] = false; 102 - } 103 102 radeon_irq_set(rdev); 104 103 } 105 104 106 105 int radeon_irq_kms_init(struct radeon_device *rdev) 107 106 { 108 107 int r = 0; 109 - int num_crtc = 2; 110 108 111 - if (rdev->flags & RADEON_SINGLE_CRTC) 112 - num_crtc = 1; 113 109 spin_lock_init(&rdev->irq.sw_lock); 114 - r = drm_vblank_init(rdev->ddev, num_crtc); 110 + r = drm_vblank_init(rdev->ddev, rdev->num_crtc); 115 111 if (r) { 116 112 return r; 117 113 } 118 114 /* enable msi */ 119 115 rdev->msi_enabled = 0; 120 - if (rdev->family >= CHIP_RV380) { 116 + /* MSIs don't seem to work reliably on all IGP 117 + * chips. Disable MSI on them for now. 118 + */ 119 + if ((rdev->family >= CHIP_RV380) && 120 + (!(rdev->flags & RADEON_IS_IGP))) { 121 121 int ret = pci_enable_msi(rdev->pdev); 122 122 if (!ret) { 123 123 rdev->msi_enabled = 1;
+8
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
··· 603 603 ? RADEON_CRTC2_INTERLACE_EN 604 604 : 0)); 605 605 606 + /* rs4xx chips seem to like to have the crtc enabled when the timing is set */ 607 + if ((rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS480)) 608 + crtc2_gen_cntl |= RADEON_CRTC2_EN; 609 + 606 610 disp2_merge_cntl = RREG32(RADEON_DISP2_MERGE_CNTL); 607 611 disp2_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN; 608 612 ··· 633 629 | ((mode->flags & DRM_MODE_FLAG_INTERLACE) 634 630 ? RADEON_CRTC_INTERLACE_EN 635 631 : 0)); 632 + 633 + /* rs4xx chips seem to like to have the crtc enabled when the timing is set */ 634 + if ((rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS480)) 635 + crtc_gen_cntl |= RADEON_CRTC_EN; 636 636 637 637 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); 638 638 crtc_ext_cntl |= (RADEON_XCRT_CNT_EN |
+24 -5
drivers/gpu/drm/radeon/radeon_legacy_tv.c
··· 57 57 #define NTSC_TV_PLL_N_14 693 58 58 #define NTSC_TV_PLL_P_14 7 59 59 60 + #define PAL_TV_PLL_M_14 19 61 + #define PAL_TV_PLL_N_14 353 62 + #define PAL_TV_PLL_P_14 5 63 + 60 64 #define VERT_LEAD_IN_LINES 2 61 65 #define FRAC_BITS 0xe 62 66 #define FRAC_MASK 0x3fff ··· 209 205 630627, /* defRestart */ 210 206 347, /* crtcPLL_N */ 211 207 14, /* crtcPLL_M */ 212 - 8, /* crtcPLL_postDiv */ 208 + 8, /* crtcPLL_postDiv */ 213 209 1022, /* pixToTV */ 210 + }, 211 + { /* PAL timing for 14 Mhz ref clk */ 212 + 800, /* horResolution */ 213 + 600, /* verResolution */ 214 + TV_STD_PAL, /* standard */ 215 + 1131, /* horTotal */ 216 + 742, /* verTotal */ 217 + 813, /* horStart */ 218 + 840, /* horSyncStart */ 219 + 633, /* verSyncStart */ 220 + 708369, /* defRestart */ 221 + 211, /* crtcPLL_N */ 222 + 9, /* crtcPLL_M */ 223 + 8, /* crtcPLL_postDiv */ 224 + 759, /* pixToTV */ 214 225 }, 215 226 }; 216 227 ··· 261 242 if (pll->reference_freq == 2700) 262 243 const_ptr = &available_tv_modes[1]; 263 244 else 264 - const_ptr = &available_tv_modes[1]; /* FIX ME */ 245 + const_ptr = &available_tv_modes[3]; 265 246 } 266 247 return const_ptr; 267 248 } ··· 704 685 n = PAL_TV_PLL_N_27; 705 686 p = PAL_TV_PLL_P_27; 706 687 } else { 707 - m = PAL_TV_PLL_M_27; 708 - n = PAL_TV_PLL_N_27; 709 - p = PAL_TV_PLL_P_27; 688 + m = PAL_TV_PLL_M_14; 689 + n = PAL_TV_PLL_N_14; 690 + p = PAL_TV_PLL_P_14; 710 691 } 711 692 } 712 693
+5 -7
drivers/gpu/drm/radeon/radeon_mode.h
··· 129 129 #define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10) 130 130 #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) 131 131 #define RADEON_PLL_USE_POST_DIV (1 << 12) 132 + #define RADEON_PLL_IS_LCD (1 << 13) 132 133 133 134 /* pll algo */ 134 135 enum radeon_pll_algo { ··· 150 149 uint32_t pll_in_max; 151 150 uint32_t pll_out_min; 152 151 uint32_t pll_out_max; 152 + uint32_t lcd_pll_out_min; 153 + uint32_t lcd_pll_out_max; 153 154 uint32_t best_vco; 154 155 155 156 /* divider limits */ ··· 173 170 enum radeon_pll_algo algo; 174 171 }; 175 172 176 - struct i2c_algo_radeon_data { 177 - struct i2c_adapter bit_adapter; 178 - struct i2c_algo_bit_data bit_data; 179 - }; 180 - 181 173 struct radeon_i2c_chan { 182 174 struct i2c_adapter adapter; 183 175 struct drm_device *dev; 184 176 union { 177 + struct i2c_algo_bit_data bit; 185 178 struct i2c_algo_dp_aux_data dp; 186 - struct i2c_algo_radeon_data radeon; 187 179 } algo; 188 180 struct radeon_i2c_bus_rec rec; 189 181 }; ··· 340 342 struct drm_display_mode native_mode; 341 343 void *enc_priv; 342 344 int hdmi_offset; 345 + int hdmi_config_offset; 343 346 int hdmi_audio_workaround; 344 347 int hdmi_buffer_status; 345 348 }; ··· 430 431 struct radeon_i2c_bus_rec *rec, 431 432 const char *name); 432 433 extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); 433 - extern void radeon_i2c_destroy_dp(struct radeon_i2c_chan *i2c); 434 434 extern void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus, 435 435 u8 slave_addr, 436 436 u8 addr,
+4 -2
drivers/gpu/drm/radeon/radeon_object.c
··· 186 186 return 0; 187 187 } 188 188 radeon_ttm_placement_from_domain(bo, domain); 189 - /* force to pin into visible video ram */ 190 - bo->placement.lpfn = bo->rdev->mc.visible_vram_size >> PAGE_SHIFT; 189 + if (domain == RADEON_GEM_DOMAIN_VRAM) { 190 + /* force to pin into visible video ram */ 191 + bo->placement.lpfn = bo->rdev->mc.visible_vram_size >> PAGE_SHIFT; 192 + } 191 193 for (i = 0; i < bo->placement.num_placement; i++) 192 194 bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; 193 195 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
+37 -9
drivers/gpu/drm/radeon/radeon_pm.c
··· 28 28 #define RADEON_RECLOCK_DELAY_MS 200 29 29 #define RADEON_WAIT_VBLANK_TIMEOUT 200 30 30 31 + static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish); 31 32 static void radeon_pm_set_clocks_locked(struct radeon_device *rdev); 32 33 static void radeon_pm_set_clocks(struct radeon_device *rdev); 33 34 static void radeon_pm_idle_work_handler(struct work_struct *work); ··· 180 179 rdev->pm.requested_power_state->non_clock_info.pcie_lanes); 181 180 } 182 181 182 + static inline void radeon_sync_with_vblank(struct radeon_device *rdev) 183 + { 184 + if (rdev->pm.active_crtcs) { 185 + rdev->pm.vblank_sync = false; 186 + wait_event_timeout( 187 + rdev->irq.vblank_queue, rdev->pm.vblank_sync, 188 + msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT)); 189 + } 190 + } 191 + 183 192 static void radeon_set_power_state(struct radeon_device *rdev) 184 193 { 185 194 /* if *_clock_mode are the same, *_power_state are as well */ ··· 200 189 rdev->pm.requested_clock_mode->sclk, 201 190 rdev->pm.requested_clock_mode->mclk, 202 191 rdev->pm.requested_power_state->non_clock_info.pcie_lanes); 192 + 203 193 /* set pcie lanes */ 194 + /* TODO */ 195 + 204 196 /* set voltage */ 197 + /* TODO */ 198 + 205 199 /* set engine clock */ 200 + radeon_sync_with_vblank(rdev); 201 + radeon_pm_debug_check_in_vbl(rdev, false); 206 202 radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk); 203 + radeon_pm_debug_check_in_vbl(rdev, true); 204 + 205 + #if 0 207 206 /* set memory clock */ 207 + if (rdev->asic->set_memory_clock) { 208 + radeon_sync_with_vblank(rdev); 209 + radeon_pm_debug_check_in_vbl(rdev, false); 210 + radeon_set_memory_clock(rdev, rdev->pm.requested_clock_mode->mclk); 211 + radeon_pm_debug_check_in_vbl(rdev, true); 212 + } 213 + #endif 208 214 209 215 rdev->pm.current_power_state = rdev->pm.requested_power_state; 210 216 rdev->pm.current_clock_mode = rdev->pm.requested_clock_mode; ··· 257 229 return 0; 258 230 } 259 231 232 + void radeon_pm_fini(struct radeon_device *rdev) 233 + { 234 + if (rdev->pm.i2c_bus) 235 + radeon_i2c_destroy(rdev->pm.i2c_bus); 236 + } 237 + 260 238 void radeon_pm_compute_clocks(struct radeon_device *rdev) 261 239 { 262 240 struct drm_device *ddev = rdev->ddev; ··· 279 245 list_for_each_entry(connector, 280 246 &ddev->mode_config.connector_list, head) { 281 247 if (connector->encoder && 282 - connector->dpms != DRM_MODE_DPMS_OFF) { 248 + connector->encoder->crtc && 249 + connector->dpms != DRM_MODE_DPMS_OFF) { 283 250 radeon_crtc = to_radeon_crtc(connector->encoder->crtc); 284 251 rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); 285 252 ++count; ··· 368 333 break; 369 334 } 370 335 371 - /* check if we are in vblank */ 372 - radeon_pm_debug_check_in_vbl(rdev, false); 373 336 radeon_set_power_state(rdev); 374 - radeon_pm_debug_check_in_vbl(rdev, true); 375 337 rdev->pm.planned_action = PM_ACTION_NONE; 376 338 } 377 339 ··· 385 353 rdev->pm.req_vblank |= (1 << 1); 386 354 drm_vblank_get(rdev->ddev, 1); 387 355 } 388 - if (rdev->pm.active_crtcs) 389 - wait_event_interruptible_timeout( 390 - rdev->irq.vblank_queue, 0, 391 - msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT)); 356 + radeon_pm_set_clocks_locked(rdev); 392 357 if (rdev->pm.req_vblank & (1 << 0)) { 393 358 rdev->pm.req_vblank &= ~(1 << 0); 394 359 drm_vblank_put(rdev->ddev, 0); ··· 395 366 drm_vblank_put(rdev->ddev, 1); 396 367 } 397 368 398 - radeon_pm_set_clocks_locked(rdev); 399 369 mutex_unlock(&rdev->cp.mutex); 400 370 } 401 371
+1
drivers/gpu/drm/radeon/radeon_reg.h
··· 346 346 # define RADEON_TVPLL_PWRMGT_OFF (1 << 30) 347 347 # define RADEON_TVCLK_TURNOFF (1 << 31) 348 348 #define RADEON_PLL_PWRMGT_CNTL 0x0015 /* PLL */ 349 + # define RADEON_PM_MODE_SEL (1 << 13) 349 350 # define RADEON_TCL_BYPASS_DISABLE (1 << 20) 350 351 #define RADEON_CLR_CMP_CLR_3D 0x1a24 351 352 #define RADEON_CLR_CMP_CLR_DST 0x15c8
-75
drivers/gpu/drm/radeon/reg_srcs/r600
··· 26 26 0x00028408 VGT_INDX_OFFSET 27 27 0x00028AA0 VGT_INSTANCE_STEP_RATE_0 28 28 0x00028AA4 VGT_INSTANCE_STEP_RATE_1 29 - 0x000088C0 VGT_LAST_COPY_STATE 30 29 0x00028400 VGT_MAX_VTX_INDX 31 - 0x000088D8 VGT_MC_LAT_CNTL 32 30 0x00028404 VGT_MIN_VTX_INDX 33 31 0x00028A94 VGT_MULTI_PRIM_IB_RESET_EN 34 32 0x0002840C VGT_MULTI_PRIM_IB_RESET_INDX 35 33 0x00008970 VGT_NUM_INDICES 36 34 0x00008974 VGT_NUM_INSTANCES 37 35 0x00028A10 VGT_OUTPUT_PATH_CNTL 38 - 0x00028C5C VGT_OUT_DEALLOC_CNTL 39 36 0x00028A84 VGT_PRIMITIVEID_EN 40 37 0x00008958 VGT_PRIMITIVE_TYPE 41 38 0x00028AB4 VGT_REUSE_OFF 42 - 0x00028C58 VGT_VERTEX_REUSE_BLOCK_CNTL 43 39 0x00028AB8 VGT_VTX_CNT_EN 44 40 0x000088B0 VGT_VTX_VECT_EJECT_REG 45 41 0x00028810 PA_CL_CLIP_CNTL ··· 276 280 0x00028E00 PA_SU_POLY_OFFSET_FRONT_SCALE 277 281 0x00028814 PA_SU_SC_MODE_CNTL 278 282 0x00028C08 PA_SU_VTX_CNTL 279 - 0x00008C00 SQ_CONFIG 280 283 0x00008C04 SQ_GPR_RESOURCE_MGMT_1 281 284 0x00008C08 SQ_GPR_RESOURCE_MGMT_2 282 285 0x00008C10 SQ_STACK_RESOURCE_MGMT_1 ··· 315 320 0x000283FC SQ_VTX_SEMANTIC_31 316 321 0x000288E0 SQ_VTX_SEMANTIC_CLEAR 317 322 0x0003CFF4 SQ_VTX_START_INST_LOC 318 - 0x0003C000 SQ_TEX_SAMPLER_WORD0_0 319 - 0x0003C004 SQ_TEX_SAMPLER_WORD1_0 320 - 0x0003C008 SQ_TEX_SAMPLER_WORD2_0 321 - 0x00030000 SQ_ALU_CONSTANT0_0 322 - 0x00030004 SQ_ALU_CONSTANT1_0 323 - 0x00030008 SQ_ALU_CONSTANT2_0 324 - 0x0003000C SQ_ALU_CONSTANT3_0 325 - 0x0003E380 SQ_BOOL_CONST_0 326 - 0x0003E384 SQ_BOOL_CONST_1 327 - 0x0003E388 SQ_BOOL_CONST_2 328 - 0x0003E200 SQ_LOOP_CONST_0 329 - 0x0003E200 SQ_LOOP_CONST_DX10_0 330 323 0x000281C0 SQ_ALU_CONST_BUFFER_SIZE_GS_0 331 324 0x000281C4 SQ_ALU_CONST_BUFFER_SIZE_GS_1 332 325 0x000281C8 SQ_ALU_CONST_BUFFER_SIZE_GS_2 ··· 363 380 0x000281B4 SQ_ALU_CONST_BUFFER_SIZE_VS_13 364 381 0x000281B8 SQ_ALU_CONST_BUFFER_SIZE_VS_14 365 382 0x000281BC SQ_ALU_CONST_BUFFER_SIZE_VS_15 366 - 0x000289C0 SQ_ALU_CONST_CACHE_GS_0 367 - 0x000289C4 SQ_ALU_CONST_CACHE_GS_1 368 - 0x000289C8 SQ_ALU_CONST_CACHE_GS_2 369 - 0x000289CC SQ_ALU_CONST_CACHE_GS_3 370 - 0x000289D0 SQ_ALU_CONST_CACHE_GS_4 371 - 0x000289D4 SQ_ALU_CONST_CACHE_GS_5 372 - 0x000289D8 SQ_ALU_CONST_CACHE_GS_6 373 - 0x000289DC SQ_ALU_CONST_CACHE_GS_7 374 - 0x000289E0 SQ_ALU_CONST_CACHE_GS_8 375 - 0x000289E4 SQ_ALU_CONST_CACHE_GS_9 376 - 0x000289E8 SQ_ALU_CONST_CACHE_GS_10 377 - 0x000289EC SQ_ALU_CONST_CACHE_GS_11 378 - 0x000289F0 SQ_ALU_CONST_CACHE_GS_12 379 - 0x000289F4 SQ_ALU_CONST_CACHE_GS_13 380 - 0x000289F8 SQ_ALU_CONST_CACHE_GS_14 381 - 0x000289FC SQ_ALU_CONST_CACHE_GS_15 382 - 0x00028940 SQ_ALU_CONST_CACHE_PS_0 383 - 0x00028944 SQ_ALU_CONST_CACHE_PS_1 384 - 0x00028948 SQ_ALU_CONST_CACHE_PS_2 385 - 0x0002894C SQ_ALU_CONST_CACHE_PS_3 386 - 0x00028950 SQ_ALU_CONST_CACHE_PS_4 387 - 0x00028954 SQ_ALU_CONST_CACHE_PS_5 388 - 0x00028958 SQ_ALU_CONST_CACHE_PS_6 389 - 0x0002895C SQ_ALU_CONST_CACHE_PS_7 390 - 0x00028960 SQ_ALU_CONST_CACHE_PS_8 391 - 0x00028964 SQ_ALU_CONST_CACHE_PS_9 392 - 0x00028968 SQ_ALU_CONST_CACHE_PS_10 393 - 0x0002896C SQ_ALU_CONST_CACHE_PS_11 394 - 0x00028970 SQ_ALU_CONST_CACHE_PS_12 395 - 0x00028974 SQ_ALU_CONST_CACHE_PS_13 396 - 0x00028978 SQ_ALU_CONST_CACHE_PS_14 397 - 0x0002897C SQ_ALU_CONST_CACHE_PS_15 398 - 0x00028980 SQ_ALU_CONST_CACHE_VS_0 399 - 0x00028984 SQ_ALU_CONST_CACHE_VS_1 400 - 0x00028988 SQ_ALU_CONST_CACHE_VS_2 401 - 0x0002898C SQ_ALU_CONST_CACHE_VS_3 402 - 0x00028990 SQ_ALU_CONST_CACHE_VS_4 403 - 0x00028994 SQ_ALU_CONST_CACHE_VS_5 404 - 0x00028998 SQ_ALU_CONST_CACHE_VS_6 405 - 0x0002899C SQ_ALU_CONST_CACHE_VS_7 406 - 0x000289A0 SQ_ALU_CONST_CACHE_VS_8 407 - 0x000289A4 SQ_ALU_CONST_CACHE_VS_9 408 - 0x000289A8 SQ_ALU_CONST_CACHE_VS_10 409 - 0x000289AC SQ_ALU_CONST_CACHE_VS_11 410 - 0x000289B0 SQ_ALU_CONST_CACHE_VS_12 411 - 0x000289B4 SQ_ALU_CONST_CACHE_VS_13 412 - 0x000289B8 SQ_ALU_CONST_CACHE_VS_14 413 - 0x000289BC SQ_ALU_CONST_CACHE_VS_15 414 383 0x000288D8 SQ_PGM_CF_OFFSET_ES 415 384 0x000288DC SQ_PGM_CF_OFFSET_FS 416 385 0x000288D4 SQ_PGM_CF_OFFSET_GS ··· 429 494 0x00028438 SX_ALPHA_REF 430 495 0x00028410 SX_ALPHA_TEST_CONTROL 431 496 0x00028350 SX_MISC 432 - 0x0000A020 SMX_DC_CTL0 433 - 0x0000A024 SMX_DC_CTL1 434 - 0x0000A028 SMX_DC_CTL2 435 - 0x00009608 TC_CNTL 436 497 0x00009604 TC_INVALIDATE 437 - 0x00009490 TD_CNTL 438 498 0x00009400 TD_FILTER4 439 499 0x00009404 TD_FILTER4_1 440 500 0x00009408 TD_FILTER4_2 ··· 754 824 0x00028428 CB_FOG_GREEN 755 825 0x00028424 CB_FOG_RED 756 826 0x00008040 WAIT_UNTIL 757 - 0x00008950 CC_GC_SHADER_PIPE_CONFIG 758 - 0x00008954 GC_USER_SHADER_PIPE_CONFIG 759 827 0x00009714 VC_ENHANCE 760 828 0x00009830 DB_DEBUG 761 829 0x00009838 DB_WATERMARKS 762 830 0x00028D28 DB_SRESULTS_COMPARE_STATE0 763 831 0x00028D44 DB_ALPHA_TO_MASK 764 - 0x00009504 TA_CNTL 765 832 0x00009700 VC_CNTL 766 - 0x00009718 VC_CONFIG 767 - 0x0000A02C SMX_DC_MC_INTF_CTL
+6 -1
drivers/gpu/drm/radeon/rs400.c
··· 29 29 #include <linux/slab.h> 30 30 #include <drm/drmP.h> 31 31 #include "radeon.h" 32 + #include "radeon_asic.h" 32 33 #include "rs400d.h" 33 34 34 35 /* This files gather functions specifics to : rs400,rs480 */ ··· 204 203 205 204 void rs400_gart_fini(struct radeon_device *rdev) 206 205 { 206 + radeon_gart_fini(rdev); 207 207 rs400_gart_disable(rdev); 208 208 radeon_gart_table_ram_free(rdev); 209 - radeon_gart_fini(rdev); 210 209 } 211 210 212 211 int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) ··· 266 265 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16; 267 266 radeon_vram_location(rdev, &rdev->mc, base); 268 267 radeon_gtt_location(rdev, &rdev->mc); 268 + radeon_update_bandwidth_info(rdev); 269 269 } 270 270 271 271 uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg) ··· 391 389 { 392 390 int r; 393 391 392 + r100_set_common_regs(rdev); 393 + 394 394 rs400_mc_program(rdev); 395 395 /* Resume clock */ 396 396 r300_clock_startup(rdev); ··· 458 454 459 455 void rs400_fini(struct radeon_device *rdev) 460 456 { 457 + radeon_pm_fini(rdev); 461 458 r100_cp_fini(rdev); 462 459 r100_wb_fini(rdev); 463 460 r100_ib_fini(rdev);
+31 -2
drivers/gpu/drm/radeon/rs600.c
··· 37 37 */ 38 38 #include "drmP.h" 39 39 #include "radeon.h" 40 + #include "radeon_asic.h" 40 41 #include "atom.h" 41 42 #include "rs600d.h" 42 43 ··· 268 267 269 268 void rs600_gart_fini(struct radeon_device *rdev) 270 269 { 270 + radeon_gart_fini(rdev); 271 271 rs600_gart_disable(rdev); 272 272 radeon_gart_table_vram_free(rdev); 273 - radeon_gart_fini(rdev); 274 273 } 275 274 276 275 #define R600_PTE_VALID (1 << 0) ··· 393 392 /* Vertical blank interrupts */ 394 393 if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) { 395 394 drm_handle_vblank(rdev->ddev, 0); 395 + rdev->pm.vblank_sync = true; 396 396 wake_up(&rdev->irq.vblank_queue); 397 397 } 398 398 if (G_007EDC_LB_D2_VBLANK_INTERRUPT(r500_disp_int)) { 399 399 drm_handle_vblank(rdev->ddev, 1); 400 + rdev->pm.vblank_sync = true; 400 401 wake_up(&rdev->irq.vblank_queue); 401 402 } 402 403 if (G_007EDC_DC_HOT_PLUG_DETECT1_INTERRUPT(r500_disp_int)) { ··· 475 472 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 476 473 base = RREG32_MC(R_000004_MC_FB_LOCATION); 477 474 base = G_000004_MC_FB_START(base) << 16; 475 + rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 478 476 radeon_vram_location(rdev, &rdev->mc, base); 479 477 radeon_gtt_location(rdev, &rdev->mc); 478 + radeon_update_bandwidth_info(rdev); 480 479 } 481 480 482 481 void rs600_bandwidth_update(struct radeon_device *rdev) 483 482 { 484 - /* FIXME: implement, should this be like rs690 ? */ 483 + struct drm_display_mode *mode0 = NULL; 484 + struct drm_display_mode *mode1 = NULL; 485 + u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; 486 + /* FIXME: implement full support */ 487 + 488 + radeon_update_display_priority(rdev); 489 + 490 + if (rdev->mode_info.crtcs[0]->base.enabled) 491 + mode0 = &rdev->mode_info.crtcs[0]->base.mode; 492 + if (rdev->mode_info.crtcs[1]->base.enabled) 493 + mode1 = &rdev->mode_info.crtcs[1]->base.mode; 494 + 495 + rs690_line_buffer_adjust(rdev, mode0, mode1); 496 + 497 + if (rdev->disp_priority == 2) { 498 + d1mode_priority_a_cnt = RREG32(R_006548_D1MODE_PRIORITY_A_CNT); 499 + d2mode_priority_a_cnt = RREG32(R_006D48_D2MODE_PRIORITY_A_CNT); 500 + d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); 501 + d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); 502 + WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); 503 + WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); 504 + WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); 505 + WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); 506 + } 485 507 } 486 508 487 509 uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg) ··· 626 598 627 599 void rs600_fini(struct radeon_device *rdev) 628 600 { 601 + radeon_pm_fini(rdev); 629 602 r100_cp_fini(rdev); 630 603 r100_wb_fini(rdev); 631 604 r100_ib_fini(rdev);
+53
drivers/gpu/drm/radeon/rs600d.h
··· 535 535 #define G_00016C_INVALIDATE_L1_TLB(x) (((x) >> 20) & 0x1) 536 536 #define C_00016C_INVALIDATE_L1_TLB 0xFFEFFFFF 537 537 538 + #define R_006548_D1MODE_PRIORITY_A_CNT 0x006548 539 + #define S_006548_D1MODE_PRIORITY_MARK_A(x) (((x) & 0x7FFF) << 0) 540 + #define G_006548_D1MODE_PRIORITY_MARK_A(x) (((x) >> 0) & 0x7FFF) 541 + #define C_006548_D1MODE_PRIORITY_MARK_A 0xFFFF8000 542 + #define S_006548_D1MODE_PRIORITY_A_OFF(x) (((x) & 0x1) << 16) 543 + #define G_006548_D1MODE_PRIORITY_A_OFF(x) (((x) >> 16) & 0x1) 544 + #define C_006548_D1MODE_PRIORITY_A_OFF 0xFFFEFFFF 545 + #define S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(x) (((x) & 0x1) << 20) 546 + #define G_006548_D1MODE_PRIORITY_A_ALWAYS_ON(x) (((x) >> 20) & 0x1) 547 + #define C_006548_D1MODE_PRIORITY_A_ALWAYS_ON 0xFFEFFFFF 548 + #define S_006548_D1MODE_PRIORITY_A_FORCE_MASK(x) (((x) & 0x1) << 24) 549 + #define G_006548_D1MODE_PRIORITY_A_FORCE_MASK(x) (((x) >> 24) & 0x1) 550 + #define C_006548_D1MODE_PRIORITY_A_FORCE_MASK 0xFEFFFFFF 551 + #define R_00654C_D1MODE_PRIORITY_B_CNT 0x00654C 552 + #define S_00654C_D1MODE_PRIORITY_MARK_B(x) (((x) & 0x7FFF) << 0) 553 + #define G_00654C_D1MODE_PRIORITY_MARK_B(x) (((x) >> 0) & 0x7FFF) 554 + #define C_00654C_D1MODE_PRIORITY_MARK_B 0xFFFF8000 555 + #define S_00654C_D1MODE_PRIORITY_B_OFF(x) (((x) & 0x1) << 16) 556 + #define G_00654C_D1MODE_PRIORITY_B_OFF(x) (((x) >> 16) & 0x1) 557 + #define C_00654C_D1MODE_PRIORITY_B_OFF 0xFFFEFFFF 558 + #define S_00654C_D1MODE_PRIORITY_B_ALWAYS_ON(x) (((x) & 0x1) << 20) 559 + #define G_00654C_D1MODE_PRIORITY_B_ALWAYS_ON(x) (((x) >> 20) & 0x1) 560 + #define C_00654C_D1MODE_PRIORITY_B_ALWAYS_ON 0xFFEFFFFF 561 + #define S_00654C_D1MODE_PRIORITY_B_FORCE_MASK(x) (((x) & 0x1) << 24) 562 + #define G_00654C_D1MODE_PRIORITY_B_FORCE_MASK(x) (((x) >> 24) & 0x1) 563 + #define C_00654C_D1MODE_PRIORITY_B_FORCE_MASK 0xFEFFFFFF 564 + #define R_006D48_D2MODE_PRIORITY_A_CNT 0x006D48 565 + #define S_006D48_D2MODE_PRIORITY_MARK_A(x) (((x) & 0x7FFF) << 0) 566 + #define G_006D48_D2MODE_PRIORITY_MARK_A(x) (((x) >> 0) & 0x7FFF) 567 + #define C_006D48_D2MODE_PRIORITY_MARK_A 0xFFFF8000 568 + #define S_006D48_D2MODE_PRIORITY_A_OFF(x) (((x) & 0x1) << 16) 569 + #define G_006D48_D2MODE_PRIORITY_A_OFF(x) (((x) >> 16) & 0x1) 570 + #define C_006D48_D2MODE_PRIORITY_A_OFF 0xFFFEFFFF 571 + #define S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(x) (((x) & 0x1) << 20) 572 + #define G_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(x) (((x) >> 20) & 0x1) 573 + #define C_006D48_D2MODE_PRIORITY_A_ALWAYS_ON 0xFFEFFFFF 574 + #define S_006D48_D2MODE_PRIORITY_A_FORCE_MASK(x) (((x) & 0x1) << 24) 575 + #define G_006D48_D2MODE_PRIORITY_A_FORCE_MASK(x) (((x) >> 24) & 0x1) 576 + #define C_006D48_D2MODE_PRIORITY_A_FORCE_MASK 0xFEFFFFFF 577 + #define R_006D4C_D2MODE_PRIORITY_B_CNT 0x006D4C 578 + #define S_006D4C_D2MODE_PRIORITY_MARK_B(x) (((x) & 0x7FFF) << 0) 579 + #define G_006D4C_D2MODE_PRIORITY_MARK_B(x) (((x) >> 0) & 0x7FFF) 580 + #define C_006D4C_D2MODE_PRIORITY_MARK_B 0xFFFF8000 581 + #define S_006D4C_D2MODE_PRIORITY_B_OFF(x) (((x) & 0x1) << 16) 582 + #define G_006D4C_D2MODE_PRIORITY_B_OFF(x) (((x) >> 16) & 0x1) 583 + #define C_006D4C_D2MODE_PRIORITY_B_OFF 0xFFFEFFFF 584 + #define S_006D4C_D2MODE_PRIORITY_B_ALWAYS_ON(x) (((x) & 0x1) << 20) 585 + #define G_006D4C_D2MODE_PRIORITY_B_ALWAYS_ON(x) (((x) >> 20) & 0x1) 586 + #define C_006D4C_D2MODE_PRIORITY_B_ALWAYS_ON 0xFFEFFFFF 587 + #define S_006D4C_D2MODE_PRIORITY_B_FORCE_MASK(x) (((x) & 0x1) << 24) 588 + #define G_006D4C_D2MODE_PRIORITY_B_FORCE_MASK(x) (((x) >> 24) & 0x1) 589 + #define C_006D4C_D2MODE_PRIORITY_B_FORCE_MASK 0xFEFFFFFF 590 + 538 591 #endif
+72 -50
drivers/gpu/drm/radeon/rs690.c
··· 27 27 */ 28 28 #include "drmP.h" 29 29 #include "radeon.h" 30 + #include "radeon_asic.h" 30 31 #include "atom.h" 31 32 #include "rs690d.h" 32 33 ··· 58 57 } 59 58 } 60 59 60 + union igp_info { 61 + struct _ATOM_INTEGRATED_SYSTEM_INFO info; 62 + struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_v2; 63 + }; 64 + 61 65 void rs690_pm_info(struct radeon_device *rdev) 62 66 { 63 67 int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); 64 - struct _ATOM_INTEGRATED_SYSTEM_INFO *info; 65 - struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 *info_v2; 66 - void *ptr; 68 + union igp_info *info; 67 69 uint16_t data_offset; 68 70 uint8_t frev, crev; 69 71 fixed20_12 tmp; 70 72 71 - atom_parse_data_header(rdev->mode_info.atom_context, index, NULL, 72 - &frev, &crev, &data_offset); 73 - ptr = rdev->mode_info.atom_context->bios + data_offset; 74 - info = (struct _ATOM_INTEGRATED_SYSTEM_INFO *)ptr; 75 - info_v2 = (struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 *)ptr; 76 - /* Get various system informations from bios */ 77 - switch (crev) { 78 - case 1: 79 - tmp.full = rfixed_const(100); 80 - rdev->pm.igp_sideport_mclk.full = rfixed_const(info->ulBootUpMemoryClock); 81 - rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); 82 - rdev->pm.igp_system_mclk.full = rfixed_const(le16_to_cpu(info->usK8MemoryClock)); 83 - rdev->pm.igp_ht_link_clk.full = rfixed_const(le16_to_cpu(info->usFSBClock)); 84 - rdev->pm.igp_ht_link_width.full = rfixed_const(info->ucHTLinkWidth); 85 - break; 86 - case 2: 87 - tmp.full = rfixed_const(100); 88 - rdev->pm.igp_sideport_mclk.full = rfixed_const(info_v2->ulBootUpSidePortClock); 89 - rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); 90 - rdev->pm.igp_system_mclk.full = rfixed_const(info_v2->ulBootUpUMAClock); 91 - rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); 92 - rdev->pm.igp_ht_link_clk.full = rfixed_const(info_v2->ulHTLinkFreq); 93 - rdev->pm.igp_ht_link_clk.full = rfixed_div(rdev->pm.igp_ht_link_clk, tmp); 94 - rdev->pm.igp_ht_link_width.full = rfixed_const(le16_to_cpu(info_v2->usMinHTLinkWidth)); 95 - break; 96 - default: 73 + if (atom_parse_data_header(rdev->mode_info.atom_context, index, NULL, 74 + &frev, &crev, &data_offset)) { 75 + info = (union igp_info *)(rdev->mode_info.atom_context->bios + data_offset); 76 + 77 + /* Get various system informations from bios */ 78 + switch (crev) { 79 + case 1: 80 + tmp.full = rfixed_const(100); 81 + rdev->pm.igp_sideport_mclk.full = rfixed_const(info->info.ulBootUpMemoryClock); 82 + rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); 83 + rdev->pm.igp_system_mclk.full = rfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); 84 + rdev->pm.igp_ht_link_clk.full = rfixed_const(le16_to_cpu(info->info.usFSBClock)); 85 + rdev->pm.igp_ht_link_width.full = rfixed_const(info->info.ucHTLinkWidth); 86 + break; 87 + case 2: 88 + tmp.full = rfixed_const(100); 89 + rdev->pm.igp_sideport_mclk.full = rfixed_const(info->info_v2.ulBootUpSidePortClock); 90 + rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); 91 + rdev->pm.igp_system_mclk.full = rfixed_const(info->info_v2.ulBootUpUMAClock); 92 + rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); 93 + rdev->pm.igp_ht_link_clk.full = rfixed_const(info->info_v2.ulHTLinkFreq); 94 + rdev->pm.igp_ht_link_clk.full = rfixed_div(rdev->pm.igp_ht_link_clk, tmp); 95 + rdev->pm.igp_ht_link_width.full = rfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); 96 + break; 97 + default: 98 + tmp.full = rfixed_const(100); 99 + /* We assume the slower possible clock ie worst case */ 100 + /* DDR 333Mhz */ 101 + rdev->pm.igp_sideport_mclk.full = rfixed_const(333); 102 + /* FIXME: system clock ? */ 103 + rdev->pm.igp_system_mclk.full = rfixed_const(100); 104 + rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); 105 + rdev->pm.igp_ht_link_clk.full = rfixed_const(200); 106 + rdev->pm.igp_ht_link_width.full = rfixed_const(8); 107 + DRM_ERROR("No integrated system info for your GPU, using safe default\n"); 108 + break; 109 + } 110 + } else { 97 111 tmp.full = rfixed_const(100); 98 112 /* We assume the slower possible clock ie worst case */ 99 113 /* DDR 333Mhz */ ··· 119 103 rdev->pm.igp_ht_link_clk.full = rfixed_const(200); 120 104 rdev->pm.igp_ht_link_width.full = rfixed_const(8); 121 105 DRM_ERROR("No integrated system info for your GPU, using safe default\n"); 122 - break; 123 106 } 124 107 /* Compute various bandwidth */ 125 108 /* k8_bandwidth = (memory_clk / 2) * 2 * 8 * 0.5 = memory_clk * 4 */ ··· 146 131 147 132 void rs690_mc_init(struct radeon_device *rdev) 148 133 { 149 - fixed20_12 a; 150 134 u64 base; 151 135 152 136 rs400_gart_adjust_size(rdev); ··· 159 145 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); 160 146 base = G_000100_MC_FB_START(base) << 16; 161 147 rs690_pm_info(rdev); 162 - /* FIXME: we should enforce default clock in case GPU is not in 163 - * default setup 164 - */ 165 - a.full = rfixed_const(100); 166 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 167 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 168 - a.full = rfixed_const(16); 169 - /* core_bandwidth = sclk(Mhz) * 16 */ 170 - rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a); 171 148 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 172 149 radeon_vram_location(rdev, &rdev->mc, base); 173 150 radeon_gtt_location(rdev, &rdev->mc); 151 + radeon_update_bandwidth_info(rdev); 174 152 } 175 153 176 154 void rs690_line_buffer_adjust(struct radeon_device *rdev, ··· 400 394 struct drm_display_mode *mode1 = NULL; 401 395 struct rs690_watermark wm0; 402 396 struct rs690_watermark wm1; 403 - u32 tmp; 397 + u32 tmp, d1mode_priority_a_cnt, d2mode_priority_a_cnt; 404 398 fixed20_12 priority_mark02, priority_mark12, fill_rate; 405 399 fixed20_12 a, b; 400 + 401 + radeon_update_display_priority(rdev); 406 402 407 403 if (rdev->mode_info.crtcs[0]->base.enabled) 408 404 mode0 = &rdev->mode_info.crtcs[0]->base.mode; ··· 415 407 * modes if the user specifies HIGH for displaypriority 416 408 * option. 417 409 */ 418 - if (rdev->disp_priority == 2) { 410 + if ((rdev->disp_priority == 2) && 411 + ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))) { 419 412 tmp = RREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER); 420 413 tmp &= C_000104_MC_DISP0R_INIT_LAT; 421 414 tmp &= C_000104_MC_DISP1R_INIT_LAT; ··· 491 482 priority_mark12.full = 0; 492 483 if (wm1.priority_mark_max.full > priority_mark12.full) 493 484 priority_mark12.full = wm1.priority_mark_max.full; 494 - WREG32(R_006548_D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); 495 - WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); 496 - WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); 497 - WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); 485 + d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); 486 + d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); 487 + if (rdev->disp_priority == 2) { 488 + d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); 489 + d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); 490 + } 491 + WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); 492 + WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); 493 + WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); 494 + WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); 498 495 } else if (mode0) { 499 496 if (rfixed_trunc(wm0.dbpp) > 64) 500 497 a.full = rfixed_mul(wm0.dbpp, wm0.num_line_pair); ··· 527 512 priority_mark02.full = 0; 528 513 if (wm0.priority_mark_max.full > priority_mark02.full) 529 514 priority_mark02.full = wm0.priority_mark_max.full; 530 - WREG32(R_006548_D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); 531 - WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); 515 + d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); 516 + if (rdev->disp_priority == 2) 517 + d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); 518 + WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); 519 + WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); 532 520 WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, 533 521 S_006D48_D2MODE_PRIORITY_A_OFF(1)); 534 522 WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, ··· 562 544 priority_mark12.full = 0; 563 545 if (wm1.priority_mark_max.full > priority_mark12.full) 564 546 priority_mark12.full = wm1.priority_mark_max.full; 547 + d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); 548 + if (rdev->disp_priority == 2) 549 + d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); 565 550 WREG32(R_006548_D1MODE_PRIORITY_A_CNT, 566 551 S_006548_D1MODE_PRIORITY_A_OFF(1)); 567 552 WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, 568 553 S_00654C_D1MODE_PRIORITY_B_OFF(1)); 569 - WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); 570 - WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); 554 + WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); 555 + WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); 571 556 } 572 557 } 573 558 ··· 678 657 679 658 void rs690_fini(struct radeon_device *rdev) 680 659 { 660 + radeon_pm_fini(rdev); 681 661 r100_cp_fini(rdev); 682 662 r100_wb_fini(rdev); 683 663 r100_ib_fini(rdev);
+3
drivers/gpu/drm/radeon/rs690d.h
··· 182 182 #define S_006548_D1MODE_PRIORITY_A_OFF(x) (((x) & 0x1) << 16) 183 183 #define G_006548_D1MODE_PRIORITY_A_OFF(x) (((x) >> 16) & 0x1) 184 184 #define C_006548_D1MODE_PRIORITY_A_OFF 0xFFFEFFFF 185 + #define S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(x) (((x) & 0x1) << 20) 186 + #define G_006548_D1MODE_PRIORITY_A_ALWAYS_ON(x) (((x) >> 20) & 0x1) 187 + #define C_006548_D1MODE_PRIORITY_A_ALWAYS_ON 0xFFEFFFFF 185 188 #define S_006548_D1MODE_PRIORITY_A_FORCE_MASK(x) (((x) & 0x1) << 24) 186 189 #define G_006548_D1MODE_PRIORITY_A_FORCE_MASK(x) (((x) >> 24) & 0x1) 187 190 #define C_006548_D1MODE_PRIORITY_A_FORCE_MASK 0xFEFFFFFF
+28 -17
drivers/gpu/drm/radeon/rv515.c
··· 30 30 #include "drmP.h" 31 31 #include "rv515d.h" 32 32 #include "radeon.h" 33 + #include "radeon_asic.h" 33 34 #include "atom.h" 34 35 #include "rv515_reg_safe.h" 35 36 ··· 281 280 282 281 void rv515_mc_init(struct radeon_device *rdev) 283 282 { 284 - fixed20_12 a; 285 283 286 284 rv515_vram_get_type(rdev); 287 285 r100_vram_init_sizes(rdev); 288 286 radeon_vram_location(rdev, &rdev->mc, 0); 289 287 if (!(rdev->flags & RADEON_IS_AGP)) 290 288 radeon_gtt_location(rdev, &rdev->mc); 291 - /* FIXME: we should enforce default clock in case GPU is not in 292 - * default setup 293 - */ 294 - a.full = rfixed_const(100); 295 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 296 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 289 + radeon_update_bandwidth_info(rdev); 297 290 } 298 291 299 292 uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg) ··· 535 540 536 541 void rv515_fini(struct radeon_device *rdev) 537 542 { 543 + radeon_pm_fini(rdev); 538 544 r100_cp_fini(rdev); 539 545 r100_wb_fini(rdev); 540 546 r100_ib_fini(rdev); ··· 1017 1021 struct drm_display_mode *mode1 = NULL; 1018 1022 struct rv515_watermark wm0; 1019 1023 struct rv515_watermark wm1; 1020 - u32 tmp; 1024 + u32 tmp, d1mode_priority_a_cnt, d2mode_priority_a_cnt; 1021 1025 fixed20_12 priority_mark02, priority_mark12, fill_rate; 1022 1026 fixed20_12 a, b; 1023 1027 ··· 1085 1089 priority_mark12.full = 0; 1086 1090 if (wm1.priority_mark_max.full > priority_mark12.full) 1087 1091 priority_mark12.full = wm1.priority_mark_max.full; 1088 - WREG32(D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); 1089 - WREG32(D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); 1090 - WREG32(D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); 1091 - WREG32(D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); 1092 + d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); 1093 + d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); 1094 + if (rdev->disp_priority == 2) { 1095 + d1mode_priority_a_cnt |= MODE_PRIORITY_ALWAYS_ON; 1096 + d2mode_priority_a_cnt |= MODE_PRIORITY_ALWAYS_ON; 1097 + } 1098 + WREG32(D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); 1099 + WREG32(D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); 1100 + WREG32(D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); 1101 + WREG32(D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); 1092 1102 } else if (mode0) { 1093 1103 if (rfixed_trunc(wm0.dbpp) > 64) 1094 1104 a.full = rfixed_div(wm0.dbpp, wm0.num_line_pair); ··· 1121 1119 priority_mark02.full = 0; 1122 1120 if (wm0.priority_mark_max.full > priority_mark02.full) 1123 1121 priority_mark02.full = wm0.priority_mark_max.full; 1124 - WREG32(D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); 1125 - WREG32(D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); 1122 + d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); 1123 + if (rdev->disp_priority == 2) 1124 + d1mode_priority_a_cnt |= MODE_PRIORITY_ALWAYS_ON; 1125 + WREG32(D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); 1126 + WREG32(D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); 1126 1127 WREG32(D2MODE_PRIORITY_A_CNT, MODE_PRIORITY_OFF); 1127 1128 WREG32(D2MODE_PRIORITY_B_CNT, MODE_PRIORITY_OFF); 1128 1129 } else { ··· 1154 1149 priority_mark12.full = 0; 1155 1150 if (wm1.priority_mark_max.full > priority_mark12.full) 1156 1151 priority_mark12.full = wm1.priority_mark_max.full; 1152 + d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); 1153 + if (rdev->disp_priority == 2) 1154 + d2mode_priority_a_cnt |= MODE_PRIORITY_ALWAYS_ON; 1157 1155 WREG32(D1MODE_PRIORITY_A_CNT, MODE_PRIORITY_OFF); 1158 1156 WREG32(D1MODE_PRIORITY_B_CNT, MODE_PRIORITY_OFF); 1159 - WREG32(D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); 1160 - WREG32(D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); 1157 + WREG32(D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); 1158 + WREG32(D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); 1161 1159 } 1162 1160 } 1163 1161 ··· 1169 1161 uint32_t tmp; 1170 1162 struct drm_display_mode *mode0 = NULL; 1171 1163 struct drm_display_mode *mode1 = NULL; 1164 + 1165 + radeon_update_display_priority(rdev); 1172 1166 1173 1167 if (rdev->mode_info.crtcs[0]->base.enabled) 1174 1168 mode0 = &rdev->mode_info.crtcs[0]->base.mode; ··· 1181 1171 * modes if the user specifies HIGH for displaypriority 1182 1172 * option. 1183 1173 */ 1184 - if (rdev->disp_priority == 2) { 1174 + if ((rdev->disp_priority == 2) && 1175 + (rdev->family == CHIP_RV515)) { 1185 1176 tmp = RREG32_MC(MC_MISC_LAT_TIMER); 1186 1177 tmp &= ~MC_DISP1R_INIT_LAT_MASK; 1187 1178 tmp &= ~MC_DISP0R_INIT_LAT_MASK;
+23 -8
drivers/gpu/drm/radeon/rv770.c
··· 30 30 #include <linux/slab.h> 31 31 #include "drmP.h" 32 32 #include "radeon.h" 33 + #include "radeon_asic.h" 33 34 #include "radeon_drm.h" 34 35 #include "rv770d.h" 35 36 #include "atom.h" ··· 127 126 128 127 void rv770_pcie_gart_fini(struct radeon_device *rdev) 129 128 { 129 + radeon_gart_fini(rdev); 130 130 rv770_pcie_gart_disable(rdev); 131 131 radeon_gart_table_vram_free(rdev); 132 - radeon_gart_fini(rdev); 133 132 } 134 133 135 134 ··· 649 648 650 649 WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); 651 650 WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 651 + WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config); 652 652 WREG32(CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); 653 653 654 654 WREG32(CGTS_SYS_TCC_DISABLE, 0); 655 655 WREG32(CGTS_TCC_DISABLE, 0); 656 + WREG32(CGTS_USER_SYS_TCC_DISABLE, 0); 657 + WREG32(CGTS_USER_TCC_DISABLE, 0); 656 658 657 659 num_qd_pipes = 658 660 R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8); ··· 869 865 870 866 int rv770_mc_init(struct radeon_device *rdev) 871 867 { 872 - fixed20_12 a; 873 868 u32 tmp; 874 869 int chansize, numchan; 875 870 ··· 912 909 rdev->mc.real_vram_size = rdev->mc.aper_size; 913 910 } 914 911 r600_vram_gtt_location(rdev, &rdev->mc); 915 - /* FIXME: we should enforce default clock in case GPU is not in 916 - * default setup 917 - */ 918 - a.full = rfixed_const(100); 919 - rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 920 - rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 912 + radeon_update_bandwidth_info(rdev); 913 + 921 914 return 0; 922 915 } 923 916 ··· 1013 1014 DRM_ERROR("radeon: failled testing IB (%d).\n", r); 1014 1015 return r; 1015 1016 } 1017 + 1018 + r = r600_audio_init(rdev); 1019 + if (r) { 1020 + dev_err(rdev->dev, "radeon: audio init failed\n"); 1021 + return r; 1022 + } 1023 + 1016 1024 return r; 1017 1025 1018 1026 } ··· 1028 1022 { 1029 1023 int r; 1030 1024 1025 + r600_audio_fini(rdev); 1031 1026 /* FIXME: we should wait for ring to be empty */ 1032 1027 r700_cp_stop(rdev); 1033 1028 rdev->cp.ready = false; ··· 1152 1145 } 1153 1146 } 1154 1147 } 1148 + 1149 + r = r600_audio_init(rdev); 1150 + if (r) { 1151 + dev_err(rdev->dev, "radeon: audio init failed\n"); 1152 + return r; 1153 + } 1154 + 1155 1155 return 0; 1156 1156 } 1157 1157 1158 1158 void rv770_fini(struct radeon_device *rdev) 1159 1159 { 1160 + radeon_pm_fini(rdev); 1160 1161 r600_blit_fini(rdev); 1161 1162 r600_cp_fini(rdev); 1162 1163 r600_wb_fini(rdev);
+2 -2
drivers/gpu/drm/ttm/ttm_bo.c
··· 1425 1425 1426 1426 atomic_set(&glob->bo_count, 0); 1427 1427 1428 - kobject_init(&glob->kobj, &ttm_bo_glob_kobj_type); 1429 - ret = kobject_add(&glob->kobj, ttm_get_kobj(), "buffer_objects"); 1428 + ret = kobject_init_and_add( 1429 + &glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects"); 1430 1430 if (unlikely(ret != 0)) 1431 1431 kobject_put(&glob->kobj); 1432 1432 return ret;
+8 -10
drivers/gpu/drm/ttm/ttm_memory.c
··· 261 261 zone->used_mem = 0; 262 262 zone->glob = glob; 263 263 glob->zone_kernel = zone; 264 - kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 265 - ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 264 + ret = kobject_init_and_add( 265 + &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); 266 266 if (unlikely(ret != 0)) { 267 267 kobject_put(&zone->kobj); 268 268 return ret; ··· 297 297 zone->used_mem = 0; 298 298 zone->glob = glob; 299 299 glob->zone_highmem = zone; 300 - kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 301 - ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 300 + ret = kobject_init_and_add( 301 + &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); 302 302 if (unlikely(ret != 0)) { 303 303 kobject_put(&zone->kobj); 304 304 return ret; ··· 344 344 zone->used_mem = 0; 345 345 zone->glob = glob; 346 346 glob->zone_dma32 = zone; 347 - kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); 348 - ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); 347 + ret = kobject_init_and_add( 348 + &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); 349 349 if (unlikely(ret != 0)) { 350 350 kobject_put(&zone->kobj); 351 351 return ret; ··· 366 366 glob->swap_queue = create_singlethread_workqueue("ttm_swap"); 367 367 INIT_WORK(&glob->work, ttm_shrink_work); 368 368 init_waitqueue_head(&glob->queue); 369 - kobject_init(&glob->kobj, &ttm_mem_glob_kobj_type); 370 - ret = kobject_add(&glob->kobj, 371 - ttm_get_kobj(), 372 - "memory_accounting"); 369 + ret = kobject_init_and_add( 370 + &glob->kobj, &ttm_mem_glob_kobj_type, ttm_get_kobj(), "memory_accounting"); 373 371 if (unlikely(ret != 0)) { 374 372 kobject_put(&glob->kobj); 375 373 return ret;
+3 -20
drivers/gpu/drm/ttm/ttm_tt.c
··· 28 28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 29 29 */ 30 30 31 - #include <linux/vmalloc.h> 32 31 #include <linux/sched.h> 33 32 #include <linux/highmem.h> 34 33 #include <linux/pagemap.h> ··· 35 36 #include <linux/swap.h> 36 37 #include <linux/slab.h> 37 38 #include "drm_cache.h" 39 + #include "drm_mem_util.h" 38 40 #include "ttm/ttm_module.h" 39 41 #include "ttm/ttm_bo_driver.h" 40 42 #include "ttm/ttm_placement.h" ··· 44 44 45 45 /** 46 46 * Allocates storage for pointers to the pages that back the ttm. 47 - * 48 - * Uses kmalloc if possible. Otherwise falls back to vmalloc. 49 47 */ 50 48 static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm) 51 49 { 52 - unsigned long size = ttm->num_pages * sizeof(*ttm->pages); 53 - ttm->pages = NULL; 54 - 55 - if (size <= PAGE_SIZE) 56 - ttm->pages = kzalloc(size, GFP_KERNEL); 57 - 58 - if (!ttm->pages) { 59 - ttm->pages = vmalloc_user(size); 60 - if (ttm->pages) 61 - ttm->page_flags |= TTM_PAGE_FLAG_VMALLOC; 62 - } 50 + ttm->pages = drm_calloc_large(ttm->num_pages, sizeof(*ttm->pages)); 63 51 } 64 52 65 53 static void ttm_tt_free_page_directory(struct ttm_tt *ttm) 66 54 { 67 - if (ttm->page_flags & TTM_PAGE_FLAG_VMALLOC) { 68 - vfree(ttm->pages); 69 - ttm->page_flags &= ~TTM_PAGE_FLAG_VMALLOC; 70 - } else { 71 - kfree(ttm->pages); 72 - } 55 + drm_free_large(ttm->pages); 73 56 ttm->pages = NULL; 74 57 } 75 58
+1 -1
drivers/gpu/drm/vmwgfx/Kconfig
··· 1 1 config DRM_VMWGFX 2 2 tristate "DRM driver for VMware Virtual GPU" 3 - depends on DRM && PCI 3 + depends on DRM && PCI && FB 4 4 select FB_DEFERRED_IO 5 5 select FB_CFB_FILLRECT 6 6 select FB_CFB_COPYAREA
+4 -1
drivers/hid/hid-gyration.c
··· 53 53 static int gyration_event(struct hid_device *hdev, struct hid_field *field, 54 54 struct hid_usage *usage, __s32 value) 55 55 { 56 - struct input_dev *input = field->hidinput->input; 56 + 57 + if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput) 58 + return 0; 57 59 58 60 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK && 59 61 (usage->hid & 0xff) == 0x82) { 62 + struct input_dev *input = field->hidinput->input; 60 63 input_event(input, usage->type, usage->code, 1); 61 64 input_sync(input); 62 65 input_event(input, usage->type, usage->code, 0);
+1
drivers/hid/usbhid/hid-quirks.c
··· 61 61 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 62 62 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 63 63 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, 64 + { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, 64 65 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, 65 66 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 66 67 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
+6
drivers/misc/kgdbts.c
··· 295 295 /* On x86 a breakpoint stop requires it to be decremented */ 296 296 if (addr + 1 == kgdbts_regs.ip) 297 297 offset = -1; 298 + #elif defined(CONFIG_SUPERH) 299 + /* On SUPERH a breakpoint stop requires it to be decremented */ 300 + if (addr + 2 == kgdbts_regs.pc) 301 + offset = -2; 298 302 #endif 299 303 if (strcmp(arg, "silent") && 300 304 instruction_pointer(&kgdbts_regs) + offset != addr) { ··· 309 305 #ifdef CONFIG_X86 310 306 /* On x86 adjust the instruction pointer if needed */ 311 307 kgdbts_regs.ip += offset; 308 + #elif defined(CONFIG_SUPERH) 309 + kgdbts_regs.pc += offset; 312 310 #endif 313 311 return 0; 314 312 }
+5 -2
drivers/of/fdt.c
··· 376 376 if (!np->type) 377 377 np->type = "<NULL>"; 378 378 } 379 - while (tag == OF_DT_BEGIN_NODE) { 380 - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); 379 + while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) { 380 + if (tag == OF_DT_NOP) 381 + *p += 4; 382 + else 383 + mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize); 381 384 tag = be32_to_cpup((__be32 *)(*p)); 382 385 } 383 386 if (tag != OF_DT_END_NODE) {
+3 -33
drivers/pci/quirks.c
··· 2123 2123 } 2124 2124 } 2125 2125 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 2126 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x9602, quirk_disable_msi); 2127 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASUSTEK, 0x9602, quirk_disable_msi); 2128 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AI, 0x9602, quirk_disable_msi); 2126 2129 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xa238, quirk_disable_msi); 2127 2130 2128 2131 /* Go through the list of Hypertransport capabilities and ··· 2497 2494 quirk_msi_intx_disable_bug); 2498 2495 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375, 2499 2496 quirk_msi_intx_disable_bug); 2500 - 2501 - /* 2502 - * MSI does not work with the AMD RS780/RS880 internal graphics and HDMI audio 2503 - * devices unless the BIOS has initialized the nb_cntl.strap_msi_enable bit. 2504 - */ 2505 - static void __init rs780_int_gfx_disable_msi(struct pci_dev *int_gfx_bridge) 2506 - { 2507 - u32 nb_cntl; 2508 - 2509 - if (!int_gfx_bridge->subordinate) 2510 - return; 2511 - 2512 - pci_bus_write_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0), 2513 - 0x60, 0); 2514 - pci_bus_read_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0), 2515 - 0x64, &nb_cntl); 2516 - 2517 - if (!(nb_cntl & BIT(10))) { 2518 - dev_warn(&int_gfx_bridge->dev, 2519 - FW_WARN "RS780: MSI for internal graphics disabled\n"); 2520 - int_gfx_bridge->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 2521 - } 2522 - } 2523 - 2524 - #define PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX 0x9602 2525 - 2526 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 2527 - PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX, 2528 - rs780_int_gfx_disable_msi); 2529 - /* wrong vendor ID on M4A785TD motherboard: */ 2530 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASUSTEK, 2531 - PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX, 2532 - rs780_int_gfx_disable_msi); 2533 2497 2534 2498 #endif /* CONFIG_PCI_MSI */ 2535 2499
+10
drivers/platform/x86/Kconfig
··· 385 385 386 386 If you have an Eee PC laptop, say Y or M here. 387 387 388 + config EEEPC_WMI 389 + tristate "Eee PC WMI Hotkey Driver (EXPERIMENTAL)" 390 + depends on ACPI_WMI 391 + depends on INPUT 392 + depends on EXPERIMENTAL 393 + ---help--- 394 + Say Y here if you want to support WMI-based hotkeys on Eee PC laptops. 395 + 396 + To compile this driver as a module, choose M here: the module will 397 + be called eeepc-wmi. 388 398 389 399 config ACPI_WMI 390 400 tristate "WMI"
+1
drivers/platform/x86/Makefile
··· 4 4 # 5 5 obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o 6 6 obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 7 + obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o 7 8 obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 8 9 obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o 9 10 obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
+2 -2
drivers/platform/x86/asus-laptop.c
··· 140 140 141 141 /* Backlight */ 142 142 static acpi_handle lcd_switch_handle; 143 - static const char *lcd_switch_paths[] = { 143 + static char *lcd_switch_paths[] = { 144 144 "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ 145 145 "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */ 146 146 "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */ ··· 154 154 #define METHOD_SWITCH_DISPLAY "SDSP" 155 155 156 156 static acpi_handle display_get_handle; 157 - static const char *display_get_paths[] = { 157 + static char *display_get_paths[] = { 158 158 /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ 159 159 "\\_SB.PCI0.P0P1.VGA.GETD", 160 160 /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V S5A M5A z33A W1Jc W2V G1 */
+157
drivers/platform/x86/eeepc-wmi.c
··· 1 + /* 2 + * Eee PC WMI hotkey driver 3 + * 4 + * Copyright(C) 2010 Intel Corporation. 5 + * 6 + * Portions based on wistron_btns.c: 7 + * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> 8 + * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> 9 + * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License as published by 13 + * the Free Software Foundation; either version 2 of the License, or 14 + * (at your option) any later version. 15 + * 16 + * This program is distributed in the hope that it will be useful, 17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 + * GNU General Public License for more details. 20 + * 21 + * You should have received a copy of the GNU General Public License 22 + * along with this program; if not, write to the Free Software 23 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 + */ 25 + 26 + #include <linux/kernel.h> 27 + #include <linux/module.h> 28 + #include <linux/init.h> 29 + #include <linux/types.h> 30 + #include <linux/input.h> 31 + #include <linux/input/sparse-keymap.h> 32 + #include <acpi/acpi_bus.h> 33 + #include <acpi/acpi_drivers.h> 34 + 35 + MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>"); 36 + MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver"); 37 + MODULE_LICENSE("GPL"); 38 + 39 + #define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000" 40 + 41 + MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID); 42 + 43 + #define NOTIFY_BRNUP_MIN 0x11 44 + #define NOTIFY_BRNUP_MAX 0x1f 45 + #define NOTIFY_BRNDOWN_MIN 0x20 46 + #define NOTIFY_BRNDOWN_MAX 0x2e 47 + 48 + static const struct key_entry eeepc_wmi_keymap[] = { 49 + /* Sleep already handled via generic ACPI code */ 50 + { KE_KEY, 0x5d, { KEY_WLAN } }, 51 + { KE_KEY, 0x32, { KEY_MUTE } }, 52 + { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, 53 + { KE_KEY, 0x30, { KEY_VOLUMEUP } }, 54 + { KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } }, 55 + { KE_IGNORE, NOTIFY_BRNUP_MIN, { KEY_BRIGHTNESSUP } }, 56 + { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, 57 + { KE_END, 0}, 58 + }; 59 + 60 + static struct input_dev *eeepc_wmi_input_dev; 61 + 62 + static void eeepc_wmi_notify(u32 value, void *context) 63 + { 64 + struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; 65 + union acpi_object *obj; 66 + acpi_status status; 67 + int code; 68 + 69 + status = wmi_get_event_data(value, &response); 70 + if (status != AE_OK) { 71 + pr_err("EEEPC WMI: bad event status 0x%x\n", status); 72 + return; 73 + } 74 + 75 + obj = (union acpi_object *)response.pointer; 76 + 77 + if (obj && obj->type == ACPI_TYPE_INTEGER) { 78 + code = obj->integer.value; 79 + 80 + if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) 81 + code = NOTIFY_BRNUP_MIN; 82 + else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX) 83 + code = NOTIFY_BRNDOWN_MIN; 84 + 85 + if (!sparse_keymap_report_event(eeepc_wmi_input_dev, 86 + code, 1, true)) 87 + pr_info("EEEPC WMI: Unknown key %x pressed\n", code); 88 + } 89 + 90 + kfree(obj); 91 + } 92 + 93 + static int eeepc_wmi_input_setup(void) 94 + { 95 + int err; 96 + 97 + eeepc_wmi_input_dev = input_allocate_device(); 98 + if (!eeepc_wmi_input_dev) 99 + return -ENOMEM; 100 + 101 + eeepc_wmi_input_dev->name = "Eee PC WMI hotkeys"; 102 + eeepc_wmi_input_dev->phys = "wmi/input0"; 103 + eeepc_wmi_input_dev->id.bustype = BUS_HOST; 104 + 105 + err = sparse_keymap_setup(eeepc_wmi_input_dev, eeepc_wmi_keymap, NULL); 106 + if (err) 107 + goto err_free_dev; 108 + 109 + err = input_register_device(eeepc_wmi_input_dev); 110 + if (err) 111 + goto err_free_keymap; 112 + 113 + return 0; 114 + 115 + err_free_keymap: 116 + sparse_keymap_free(eeepc_wmi_input_dev); 117 + err_free_dev: 118 + input_free_device(eeepc_wmi_input_dev); 119 + return err; 120 + } 121 + 122 + static int __init eeepc_wmi_init(void) 123 + { 124 + int err; 125 + acpi_status status; 126 + 127 + if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID)) { 128 + pr_warning("EEEPC WMI: No known WMI GUID found\n"); 129 + return -ENODEV; 130 + } 131 + 132 + err = eeepc_wmi_input_setup(); 133 + if (err) 134 + return err; 135 + 136 + status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID, 137 + eeepc_wmi_notify, NULL); 138 + if (ACPI_FAILURE(status)) { 139 + sparse_keymap_free(eeepc_wmi_input_dev); 140 + input_unregister_device(eeepc_wmi_input_dev); 141 + pr_err("EEEPC WMI: Unable to register notify handler - %d\n", 142 + status); 143 + return -ENODEV; 144 + } 145 + 146 + return 0; 147 + } 148 + 149 + static void __exit eeepc_wmi_exit(void) 150 + { 151 + wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID); 152 + sparse_keymap_free(eeepc_wmi_input_dev); 153 + input_unregister_device(eeepc_wmi_input_dev); 154 + } 155 + 156 + module_init(eeepc_wmi_init); 157 + module_exit(eeepc_wmi_exit);
+3 -1
drivers/serial/sunsu.c
··· 1454 1454 if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { 1455 1455 err = sunsu_kbd_ms_init(up); 1456 1456 if (err) { 1457 + of_iounmap(&op->resource[0], 1458 + up->port.membase, up->reg_size); 1457 1459 kfree(up); 1458 - goto out_unmap; 1460 + return err; 1459 1461 } 1460 1462 dev_set_drvdata(&op->dev, up); 1461 1463
+9
drivers/usb/gadget/at91_udc.c
··· 1370 1370 { 1371 1371 struct at91_udc *udc = _udc; 1372 1372 u32 rescans = 5; 1373 + int disable_clock = 0; 1374 + 1375 + if (!udc->clocked) { 1376 + clk_on(udc); 1377 + disable_clock = 1; 1378 + } 1373 1379 1374 1380 while (rescans--) { 1375 1381 u32 status; ··· 1463 1457 } 1464 1458 } 1465 1459 } 1460 + 1461 + if (disable_clock) 1462 + clk_off(udc); 1466 1463 1467 1464 return IRQ_HANDLED; 1468 1465 }
-1
drivers/usb/gadget/r8a66597-udc.c
··· 23 23 #include <linux/module.h> 24 24 #include <linux/interrupt.h> 25 25 #include <linux/delay.h> 26 - #include <linux/err.h> 27 26 #include <linux/io.h> 28 27 #include <linux/platform_device.h> 29 28 #include <linux/clk.h>
+17 -7
drivers/video/sunxvr500.c
··· 241 241 static int __devinit e3d_pci_register(struct pci_dev *pdev, 242 242 const struct pci_device_id *ent) 243 243 { 244 + struct device_node *of_node; 245 + const char *device_type; 244 246 struct fb_info *info; 245 247 struct e3d_info *ep; 246 248 unsigned int line_length; 247 249 int err; 250 + 251 + of_node = pci_device_to_OF_node(pdev); 252 + if (!of_node) { 253 + printk(KERN_ERR "e3d: Cannot find OF node of %s\n", 254 + pci_name(pdev)); 255 + return -ENODEV; 256 + } 257 + 258 + device_type = of_get_property(of_node, "device_type", NULL); 259 + if (!device_type) { 260 + printk(KERN_INFO "e3d: Ignoring secondary output device " 261 + "at %s\n", pci_name(pdev)); 262 + return -ENODEV; 263 + } 248 264 249 265 err = pci_enable_device(pdev); 250 266 if (err < 0) { ··· 280 264 ep->info = info; 281 265 ep->pdev = pdev; 282 266 spin_lock_init(&ep->lock); 283 - ep->of_node = pci_device_to_OF_node(pdev); 284 - if (!ep->of_node) { 285 - printk(KERN_ERR "e3d: Cannot find OF node of %s\n", 286 - pci_name(pdev)); 287 - err = -ENODEV; 288 - goto err_release_fb; 289 - } 267 + ep->of_node = of_node; 290 268 291 269 /* Read the PCI base register of the frame buffer, which we 292 270 * need in order to interpret the RAMDAC_VID_*FB* values in
+3 -3
fs/fat/namei_vfat.c
··· 309 309 { 310 310 struct fat_mount_options *opts = &MSDOS_SB(dir->i_sb)->options; 311 311 wchar_t *ip, *ext_start, *end, *name_start; 312 - unsigned char base[9], ext[4], buf[8], *p; 312 + unsigned char base[9], ext[4], buf[5], *p; 313 313 unsigned char charbuf[NLS_MAX_CHARSET_SIZE]; 314 314 int chl, chi; 315 315 int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen; ··· 467 467 return 0; 468 468 } 469 469 470 - i = jiffies & 0xffff; 470 + i = jiffies; 471 471 sz = (jiffies >> 16) & 0x7; 472 472 if (baselen > 2) { 473 473 baselen = numtail2_baselen; ··· 476 476 name_res[baselen + 4] = '~'; 477 477 name_res[baselen + 5] = '1' + sz; 478 478 while (1) { 479 - sprintf(buf, "%04X", i); 479 + snprintf(buf, sizeof(buf), "%04X", i & 0xffff); 480 480 memcpy(&name_res[baselen], buf, 4); 481 481 if (vfat_find_form(dir, name_res) < 0) 482 482 break;
+7 -2
fs/logfs/dev_bdev.c
··· 81 81 prefetchw(&bvec->bv_page->flags); 82 82 83 83 end_page_writeback(page); 84 + page_cache_release(page); 84 85 } while (bvec >= bio->bi_io_vec); 85 86 bio_put(bio); 86 87 if (atomic_dec_and_test(&super->s_pending_writes)) ··· 99 98 unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); 100 99 int i; 101 100 101 + if (max_pages > BIO_MAX_PAGES) 102 + max_pages = BIO_MAX_PAGES; 102 103 bio = bio_alloc(GFP_NOFS, max_pages); 103 - BUG_ON(!bio); /* FIXME: handle this */ 104 + BUG_ON(!bio); 104 105 105 106 for (i = 0; i < nr_pages; i++) { 106 107 if (i >= max_pages) { ··· 195 192 unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); 196 193 int i; 197 194 195 + if (max_pages > BIO_MAX_PAGES) 196 + max_pages = BIO_MAX_PAGES; 198 197 bio = bio_alloc(GFP_NOFS, max_pages); 199 - BUG_ON(!bio); /* FIXME: handle this */ 198 + BUG_ON(!bio); 200 199 201 200 for (i = 0; i < nr_pages; i++) { 202 201 if (i >= max_pages) {
+2 -2
fs/logfs/dir.c
··· 303 303 (filler_t *)logfs_readpage, NULL); 304 304 if (IS_ERR(page)) 305 305 return PTR_ERR(page); 306 - dd = kmap_atomic(page, KM_USER0); 306 + dd = kmap(page); 307 307 BUG_ON(dd->namelen == 0); 308 308 309 309 full = filldir(buf, (char *)dd->name, be16_to_cpu(dd->namelen), 310 310 pos, be64_to_cpu(dd->ino), dd->type); 311 - kunmap_atomic(dd, KM_USER0); 311 + kunmap(page); 312 312 page_cache_release(page); 313 313 if (full) 314 314 break;
+7
fs/logfs/journal.c
··· 801 801 { 802 802 struct logfs_super *super = logfs_super(sb); 803 803 struct logfs_area *area = super->s_journal_area; 804 + struct btree_head32 *head = &super->s_reserved_segments; 804 805 u32 segno, ec; 805 806 int i, err; 806 807 ··· 809 808 /* Drop old segments */ 810 809 journal_for_each(i) 811 810 if (super->s_journal_seg[i]) { 811 + btree_remove32(head, super->s_journal_seg[i]); 812 812 logfs_set_segment_unreserved(sb, 813 813 super->s_journal_seg[i], 814 814 super->s_journal_ec[i]); ··· 822 820 super->s_journal_seg[i] = segno; 823 821 super->s_journal_ec[i] = ec; 824 822 logfs_set_segment_reserved(sb, segno); 823 + err = btree_insert32(head, segno, (void *)1, GFP_KERNEL); 824 + BUG_ON(err); /* mempool should prevent this */ 825 + err = logfs_erase_segment(sb, segno, 1); 826 + BUG_ON(err); /* FIXME: remount-ro would be nicer */ 825 827 } 826 828 /* Manually move journal_area */ 829 + freeseg(sb, area->a_segno); 827 830 area->a_segno = super->s_journal_seg[0]; 828 831 area->a_is_open = 0; 829 832 area->a_used_bytes = 0;
+1
fs/logfs/logfs.h
··· 587 587 int logfs_init_mapping(struct super_block *sb); 588 588 void logfs_sync_area(struct logfs_area *area); 589 589 void logfs_sync_segments(struct super_block *sb); 590 + void freeseg(struct super_block *sb, u32 segno); 590 591 591 592 /* area handling */ 592 593 int logfs_init_areas(struct super_block *sb);
+12 -1
fs/logfs/readwrite.c
··· 1595 1595 return ret; 1596 1596 } 1597 1597 1598 - /* Rewrite cannot mark the inode dirty but has to write it immediatly. */ 1599 1598 int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs, 1600 1599 gc_level_t gc_level, long flags) 1601 1600 { ··· 1611 1612 if (level != 0) 1612 1613 alloc_indirect_block(inode, page, 0); 1613 1614 err = logfs_write_buf(inode, page, flags); 1615 + if (!err && shrink_level(gc_level) == 0) { 1616 + /* Rewrite cannot mark the inode dirty but has to 1617 + * write it immediatly. 1618 + * Q: Can't we just create an alias for the inode 1619 + * instead? And if not, why not? 1620 + */ 1621 + if (inode->i_ino == LOGFS_INO_MASTER) 1622 + logfs_write_anchor(inode->i_sb); 1623 + else { 1624 + err = __logfs_write_inode(inode, flags); 1625 + } 1626 + } 1614 1627 } 1615 1628 logfs_put_write_page(page); 1616 1629 return err;
+31 -23
fs/logfs/segment.c
··· 94 94 } while (len); 95 95 } 96 96 97 - /* 98 - * bdev_writeseg will write full pages. Memset the tail to prevent data leaks. 99 - */ 100 - static void pad_wbuf(struct logfs_area *area, int final) 97 + static void pad_partial_page(struct logfs_area *area) 101 98 { 102 99 struct super_block *sb = area->a_sb; 103 - struct logfs_super *super = logfs_super(sb); 104 100 struct page *page; 105 101 u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes); 106 102 pgoff_t index = ofs >> PAGE_SHIFT; 107 103 long offset = ofs & (PAGE_SIZE-1); 108 104 u32 len = PAGE_SIZE - offset; 109 105 110 - if (len == PAGE_SIZE) { 111 - /* The math in this function can surely use some love */ 112 - len = 0; 113 - } 114 - if (len) { 115 - BUG_ON(area->a_used_bytes >= super->s_segsize); 116 - 117 - page = get_mapping_page(area->a_sb, index, 0); 106 + if (len % PAGE_SIZE) { 107 + page = get_mapping_page(sb, index, 0); 118 108 BUG_ON(!page); /* FIXME: reserve a pool */ 119 109 memset(page_address(page) + offset, 0xff, len); 120 110 SetPagePrivate(page); 121 111 page_cache_release(page); 122 112 } 113 + } 123 114 124 - if (!final) 125 - return; 115 + static void pad_full_pages(struct logfs_area *area) 116 + { 117 + struct super_block *sb = area->a_sb; 118 + struct logfs_super *super = logfs_super(sb); 119 + u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes); 120 + u32 len = super->s_segsize - area->a_used_bytes; 121 + pgoff_t index = PAGE_CACHE_ALIGN(ofs) >> PAGE_CACHE_SHIFT; 122 + pgoff_t no_indizes = len >> PAGE_CACHE_SHIFT; 123 + struct page *page; 126 124 127 - area->a_used_bytes += len; 128 - for ( ; area->a_used_bytes < super->s_segsize; 129 - area->a_used_bytes += PAGE_SIZE) { 130 - /* Memset another page */ 131 - index++; 132 - page = get_mapping_page(area->a_sb, index, 0); 125 + while (no_indizes) { 126 + page = get_mapping_page(sb, index, 0); 133 127 BUG_ON(!page); /* FIXME: reserve a pool */ 134 - memset(page_address(page), 0xff, PAGE_SIZE); 128 + SetPageUptodate(page); 129 + memset(page_address(page), 0xff, PAGE_CACHE_SIZE); 135 130 SetPagePrivate(page); 136 131 page_cache_release(page); 132 + index++; 133 + no_indizes--; 137 134 } 135 + } 136 + 137 + /* 138 + * bdev_writeseg will write full pages. Memset the tail to prevent data leaks. 139 + * Also make sure we allocate (and memset) all pages for final writeout. 140 + */ 141 + static void pad_wbuf(struct logfs_area *area, int final) 142 + { 143 + pad_partial_page(area); 144 + if (final) 145 + pad_full_pages(area); 138 146 } 139 147 140 148 /* ··· 692 684 return 0; 693 685 } 694 686 695 - static void freeseg(struct super_block *sb, u32 segno) 687 + void freeseg(struct super_block *sb, u32 segno) 696 688 { 697 689 struct logfs_super *super = logfs_super(sb); 698 690 struct address_space *mapping = super->s_mapping_inode->i_mapping;
+7 -8
fs/logfs/super.c
··· 278 278 } 279 279 if (valid0 && valid1 && ds_cmp(ds0, ds1)) { 280 280 printk(KERN_INFO"Superblocks don't match - fixing.\n"); 281 - return write_one_sb(sb, super->s_devops->find_last_sb); 281 + return logfs_write_sb(sb); 282 282 } 283 283 /* If neither is valid now, something's wrong. Didn't we properly 284 284 * check them before?!? */ ··· 290 290 { 291 291 int err; 292 292 293 + err = logfs_open_segfile(sb); 294 + if (err) 295 + return err; 296 + 293 297 /* Repair any broken superblock copies */ 294 298 err = logfs_recover_sb(sb); 295 299 if (err) ··· 301 297 302 298 /* Check areas for trailing unaccounted data */ 303 299 err = logfs_check_areas(sb); 304 - if (err) 305 - return err; 306 - 307 - err = logfs_open_segfile(sb); 308 300 if (err) 309 301 return err; 310 302 ··· 329 329 330 330 sb->s_root = d_alloc_root(rootdir); 331 331 if (!sb->s_root) 332 - goto fail; 332 + goto fail2; 333 333 334 334 super->s_erase_page = alloc_pages(GFP_KERNEL, 0); 335 335 if (!super->s_erase_page) ··· 573 573 return 0; 574 574 575 575 err1: 576 - up_write(&sb->s_umount); 577 - deactivate_super(sb); 576 + deactivate_locked_super(sb); 578 577 return err; 579 578 err0: 580 579 kfree(super);
+3 -2
fs/proc/base.c
··· 443 443 unsigned long badness(struct task_struct *p, unsigned long uptime); 444 444 static int proc_oom_score(struct task_struct *task, char *buffer) 445 445 { 446 - unsigned long points; 446 + unsigned long points = 0; 447 447 struct timespec uptime; 448 448 449 449 do_posix_clock_monotonic_gettime(&uptime); 450 450 read_lock(&tasklist_lock); 451 - points = badness(task->group_leader, uptime.tv_sec); 451 + if (pid_alive(task)) 452 + points = badness(task, uptime.tv_sec); 452 453 read_unlock(&tasklist_lock); 453 454 return sprintf(buffer, "%lu\n", points); 454 455 }
+37 -48
fs/proc/task_mmu.c
··· 407 407 408 408 memset(&mss, 0, sizeof mss); 409 409 mss.vma = vma; 410 + /* mmap_sem is held in m_start */ 410 411 if (vma->vm_mm && !is_vm_hugetlb_page(vma)) 411 412 walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); 412 413 ··· 554 553 }; 555 554 556 555 struct pagemapread { 557 - u64 __user *out, *end; 556 + int pos, len; 557 + u64 *buffer; 558 558 }; 559 559 560 560 #define PM_ENTRY_BYTES sizeof(u64) ··· 578 576 static int add_to_pagemap(unsigned long addr, u64 pfn, 579 577 struct pagemapread *pm) 580 578 { 581 - if (put_user(pfn, pm->out)) 582 - return -EFAULT; 583 - pm->out++; 584 - if (pm->out >= pm->end) 579 + pm->buffer[pm->pos++] = pfn; 580 + if (pm->pos >= pm->len) 585 581 return PM_END_OF_BUFFER; 586 582 return 0; 587 583 } ··· 721 721 * determine which areas of memory are actually mapped and llseek to 722 722 * skip over unmapped regions. 723 723 */ 724 + #define PAGEMAP_WALK_SIZE (PMD_SIZE) 724 725 static ssize_t pagemap_read(struct file *file, char __user *buf, 725 726 size_t count, loff_t *ppos) 726 727 { 727 728 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); 728 - struct page **pages, *page; 729 - unsigned long uaddr, uend; 730 729 struct mm_struct *mm; 731 730 struct pagemapread pm; 732 - int pagecount; 733 731 int ret = -ESRCH; 734 732 struct mm_walk pagemap_walk = {}; 735 733 unsigned long src; 736 734 unsigned long svpfn; 737 735 unsigned long start_vaddr; 738 736 unsigned long end_vaddr; 737 + int copied = 0; 739 738 740 739 if (!task) 741 740 goto out; ··· 757 758 if (!mm) 758 759 goto out_task; 759 760 760 - 761 - uaddr = (unsigned long)buf & PAGE_MASK; 762 - uend = (unsigned long)(buf + count); 763 - pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE; 764 - ret = 0; 765 - if (pagecount == 0) 766 - goto out_mm; 767 - pages = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL); 761 + pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); 762 + pm.buffer = kmalloc(pm.len, GFP_TEMPORARY); 768 763 ret = -ENOMEM; 769 - if (!pages) 764 + if (!pm.buffer) 770 765 goto out_mm; 771 - 772 - down_read(&current->mm->mmap_sem); 773 - ret = get_user_pages(current, current->mm, uaddr, pagecount, 774 - 1, 0, pages, NULL); 775 - up_read(&current->mm->mmap_sem); 776 - 777 - if (ret < 0) 778 - goto out_free; 779 - 780 - if (ret != pagecount) { 781 - pagecount = ret; 782 - ret = -EFAULT; 783 - goto out_pages; 784 - } 785 - 786 - pm.out = (u64 __user *)buf; 787 - pm.end = (u64 __user *)(buf + count); 788 766 789 767 pagemap_walk.pmd_entry = pagemap_pte_range; 790 768 pagemap_walk.pte_hole = pagemap_pte_hole; ··· 784 808 * user buffer is tracked in "pm", and the walk 785 809 * will stop when we hit the end of the buffer. 786 810 */ 787 - ret = walk_page_range(start_vaddr, end_vaddr, &pagemap_walk); 788 - if (ret == PM_END_OF_BUFFER) 789 - ret = 0; 790 - /* don't need mmap_sem for these, but this looks cleaner */ 791 - *ppos += (char __user *)pm.out - buf; 792 - if (!ret) 793 - ret = (char __user *)pm.out - buf; 811 + ret = 0; 812 + while (count && (start_vaddr < end_vaddr)) { 813 + int len; 814 + unsigned long end; 794 815 795 - out_pages: 796 - for (; pagecount; pagecount--) { 797 - page = pages[pagecount-1]; 798 - if (!PageReserved(page)) 799 - SetPageDirty(page); 800 - page_cache_release(page); 816 + pm.pos = 0; 817 + end = start_vaddr + PAGEMAP_WALK_SIZE; 818 + /* overflow ? */ 819 + if (end < start_vaddr || end > end_vaddr) 820 + end = end_vaddr; 821 + down_read(&mm->mmap_sem); 822 + ret = walk_page_range(start_vaddr, end, &pagemap_walk); 823 + up_read(&mm->mmap_sem); 824 + start_vaddr = end; 825 + 826 + len = min(count, PM_ENTRY_BYTES * pm.pos); 827 + if (copy_to_user(buf, pm.buffer, len) < 0) { 828 + ret = -EFAULT; 829 + goto out_free; 830 + } 831 + copied += len; 832 + buf += len; 833 + count -= len; 801 834 } 835 + *ppos += copied; 836 + if (!ret || ret == PM_END_OF_BUFFER) 837 + ret = copied; 838 + 802 839 out_free: 803 - kfree(pages); 840 + kfree(pm.buffer); 804 841 out_mm: 805 842 mmput(mm); 806 843 out_task:
+4 -6
fs/reiserfs/super.c
··· 1619 1619 save_mount_options(s, data); 1620 1620 1621 1621 sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); 1622 - if (!sbi) { 1623 - errval = -ENOMEM; 1624 - goto error_alloc; 1625 - } 1622 + if (!sbi) 1623 + return -ENOMEM; 1626 1624 s->s_fs_info = sbi; 1627 1625 /* Set default values for options: non-aggressive tails, RO on errors */ 1628 1626 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); ··· 1877 1879 return (0); 1878 1880 1879 1881 error: 1880 - reiserfs_write_unlock(s); 1881 - error_alloc: 1882 1882 if (jinit_done) { /* kill the commit thread, free journal ram */ 1883 1883 journal_release_error(NULL, s); 1884 1884 } 1885 + 1886 + reiserfs_write_unlock(s); 1885 1887 1886 1888 reiserfs_free_bitmap_cache(s); 1887 1889 if (SB_BUFFER_WITH_SB(s))
+1 -33
include/drm/drmP.h
··· 1546 1546 { 1547 1547 } 1548 1548 1549 - 1550 - static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 1551 - { 1552 - if (size != 0 && nmemb > ULONG_MAX / size) 1553 - return NULL; 1554 - 1555 - if (size * nmemb <= PAGE_SIZE) 1556 - return kcalloc(nmemb, size, GFP_KERNEL); 1557 - 1558 - return __vmalloc(size * nmemb, 1559 - GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); 1560 - } 1561 - 1562 - /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ 1563 - static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) 1564 - { 1565 - if (size != 0 && nmemb > ULONG_MAX / size) 1566 - return NULL; 1567 - 1568 - if (size * nmemb <= PAGE_SIZE) 1569 - return kmalloc(nmemb * size, GFP_KERNEL); 1570 - 1571 - return __vmalloc(size * nmemb, 1572 - GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL); 1573 - } 1574 - 1575 - static __inline void drm_free_large(void *ptr) 1576 - { 1577 - if (!is_vmalloc_addr(ptr)) 1578 - return kfree(ptr); 1579 - 1580 - vfree(ptr); 1581 - } 1549 + #include "drm_mem_util.h" 1582 1550 /*@}*/ 1583 1551 1584 1552 #endif /* __KERNEL__ */
+65
include/drm/drm_mem_util.h
··· 1 + /* 2 + * Copyright © 2008 Intel Corporation 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice (including the next 12 + * paragraph) shall be included in all copies or substantial portions of the 13 + * Software. 14 + * 15 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 + * IN THE SOFTWARE. 22 + * 23 + * Authors: 24 + * Jesse Barnes <jbarnes@virtuousgeek.org> 25 + * 26 + */ 27 + #ifndef _DRM_MEM_UTIL_H_ 28 + #define _DRM_MEM_UTIL_H_ 29 + 30 + #include <linux/vmalloc.h> 31 + 32 + static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 33 + { 34 + if (size != 0 && nmemb > ULONG_MAX / size) 35 + return NULL; 36 + 37 + if (size * nmemb <= PAGE_SIZE) 38 + return kcalloc(nmemb, size, GFP_KERNEL); 39 + 40 + return __vmalloc(size * nmemb, 41 + GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); 42 + } 43 + 44 + /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ 45 + static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) 46 + { 47 + if (size != 0 && nmemb > ULONG_MAX / size) 48 + return NULL; 49 + 50 + if (size * nmemb <= PAGE_SIZE) 51 + return kmalloc(nmemb * size, GFP_KERNEL); 52 + 53 + return __vmalloc(size * nmemb, 54 + GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL); 55 + } 56 + 57 + static __inline void drm_free_large(void *ptr) 58 + { 59 + if (!is_vmalloc_addr(ptr)) 60 + return kfree(ptr); 61 + 62 + vfree(ptr); 63 + } 64 + 65 + #endif
+1
include/drm/drm_pciids.h
··· 410 410 {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 411 411 {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 412 412 {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 413 + {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 413 414 {0, 0, 0} 414 415 415 416 #define r128_PCI_IDS \
-1
include/drm/ttm/ttm_bo_driver.h
··· 115 115 struct ttm_backend_func *func; 116 116 }; 117 117 118 - #define TTM_PAGE_FLAG_VMALLOC (1 << 0) 119 118 #define TTM_PAGE_FLAG_USER (1 << 1) 120 119 #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) 121 120 #define TTM_PAGE_FLAG_WRITE (1 << 3)
+3
include/linux/amba/bus.h
··· 14 14 #ifndef ASMARM_AMBA_H 15 15 #define ASMARM_AMBA_H 16 16 17 + #include <linux/device.h> 18 + #include <linux/resource.h> 19 + 17 20 #define AMBA_NR_IRQS 2 18 21 19 22 struct amba_device {
+2
include/linux/amba/pl061.h
··· 1 + #include <linux/types.h> 2 + 1 3 /* platform data for the PL061 GPIO driver */ 2 4 3 5 struct pl061_platform_data {
+5 -2
include/linux/freezer.h
··· 64 64 extern void cancel_freezing(struct task_struct *p); 65 65 66 66 #ifdef CONFIG_CGROUP_FREEZER 67 - extern int cgroup_frozen(struct task_struct *task); 67 + extern int cgroup_freezing_or_frozen(struct task_struct *task); 68 68 #else /* !CONFIG_CGROUP_FREEZER */ 69 - static inline int cgroup_frozen(struct task_struct *task) { return 0; } 69 + static inline int cgroup_freezing_or_frozen(struct task_struct *task) 70 + { 71 + return 0; 72 + } 70 73 #endif /* !CONFIG_CGROUP_FREEZER */ 71 74 72 75 /*
+14 -7
include/linux/perf_event.h
··· 842 842 843 843 extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 844 844 845 - static inline void 846 - perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) 847 - { 848 - if (atomic_read(&perf_swevent_enabled[event_id])) 849 - __perf_sw_event(event_id, nr, nmi, regs, addr); 850 - } 851 - 852 845 extern void 853 846 perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip); 854 847 ··· 878 885 } 879 886 880 887 return perf_arch_fetch_caller_regs(regs, ip, skip); 888 + } 889 + 890 + static inline void 891 + perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) 892 + { 893 + if (atomic_read(&perf_swevent_enabled[event_id])) { 894 + struct pt_regs hot_regs; 895 + 896 + if (!regs) { 897 + perf_fetch_caller_regs(&hot_regs, 1); 898 + regs = &hot_regs; 899 + } 900 + __perf_sw_event(event_id, nr, nmi, regs, addr); 901 + } 881 902 } 882 903 883 904 extern void __perf_event_mmap(struct vm_area_struct *vma);
+6 -3
kernel/cgroup_freezer.c
··· 48 48 struct freezer, css); 49 49 } 50 50 51 - int cgroup_frozen(struct task_struct *task) 51 + int cgroup_freezing_or_frozen(struct task_struct *task) 52 52 { 53 53 struct freezer *freezer; 54 54 enum freezer_state state; 55 55 56 56 task_lock(task); 57 57 freezer = task_freezer(task); 58 - state = freezer->state; 58 + if (!freezer->css.cgroup->parent) 59 + state = CGROUP_THAWED; /* root cgroup can't be frozen */ 60 + else 61 + state = freezer->state; 59 62 task_unlock(task); 60 63 61 - return state == CGROUP_FROZEN; 64 + return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN); 62 65 } 63 66 64 67 /*
+5 -1
kernel/cred.c
··· 365 365 366 366 new = kmem_cache_alloc(cred_jar, GFP_ATOMIC); 367 367 if (!new) 368 - return NULL; 368 + goto free_tgcred; 369 369 370 370 kdebug("prepare_usermodehelper_creds() alloc %p", new); 371 371 ··· 398 398 399 399 error: 400 400 put_cred(new); 401 + free_tgcred: 402 + #ifdef CONFIG_KEYS 403 + kfree(tgcred); 404 + #endif 401 405 return NULL; 402 406 } 403 407
+6
kernel/early_res.c
··· 333 333 struct early_res *r; 334 334 int i; 335 335 336 + if (start == end) 337 + return; 338 + 339 + if (WARN_ONCE(start > end, " wrong range [%#llx, %#llx]\n", start, end)) 340 + return; 341 + 336 342 try_next: 337 343 i = find_overlapped_early(start, end); 338 344 if (i >= max_early_res)
+103 -102
kernel/kgdb.c
··· 69 69 struct pt_regs *linux_regs; 70 70 }; 71 71 72 + /* Exception state values */ 73 + #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */ 74 + #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */ 75 + #define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */ 76 + #define DCPU_SSTEP 0x8 /* CPU is single stepping */ 77 + 72 78 static struct debuggerinfo_struct { 73 79 void *debuggerinfo; 74 80 struct task_struct *task; 81 + int exception_state; 75 82 } kgdb_info[NR_CPUS]; 76 83 77 84 /** ··· 398 391 399 392 /* 400 393 * Copy the binary array pointed to by buf into mem. Fix $, #, and 401 - * 0x7d escaped with 0x7d. Return a pointer to the character after 402 - * the last byte written. 394 + * 0x7d escaped with 0x7d. Return -EFAULT on failure or 0 on success. 395 + * The input buf is overwitten with the result to write to mem. 403 396 */ 404 397 static int kgdb_ebin2mem(char *buf, char *mem, int count) 405 398 { 406 - int err = 0; 407 - char c; 399 + int size = 0; 400 + char *c = buf; 408 401 409 402 while (count-- > 0) { 410 - c = *buf++; 411 - if (c == 0x7d) 412 - c = *buf++ ^ 0x20; 413 - 414 - err = probe_kernel_write(mem, &c, 1); 415 - if (err) 416 - break; 417 - 418 - mem++; 403 + c[size] = *buf++; 404 + if (c[size] == 0x7d) 405 + c[size] = *buf++ ^ 0x20; 406 + size++; 419 407 } 420 408 421 - return err; 409 + return probe_kernel_write(mem, c, size); 422 410 } 423 411 424 412 /* ··· 563 561 */ 564 562 return find_task_by_pid_ns(tid, &init_pid_ns); 565 563 } 566 - 567 - /* 568 - * CPU debug state control: 569 - */ 570 - 571 - #ifdef CONFIG_SMP 572 - static void kgdb_wait(struct pt_regs *regs) 573 - { 574 - unsigned long flags; 575 - int cpu; 576 - 577 - local_irq_save(flags); 578 - cpu = raw_smp_processor_id(); 579 - kgdb_info[cpu].debuggerinfo = regs; 580 - kgdb_info[cpu].task = current; 581 - /* 582 - * Make sure the above info reaches the primary CPU before 583 - * our cpu_in_kgdb[] flag setting does: 584 - */ 585 - smp_wmb(); 586 - atomic_set(&cpu_in_kgdb[cpu], 1); 587 - 588 - /* Disable any cpu specific hw breakpoints */ 589 - kgdb_disable_hw_debug(regs); 590 - 591 - /* Wait till primary CPU is done with debugging */ 592 - while (atomic_read(&passive_cpu_wait[cpu])) 593 - cpu_relax(); 594 - 595 - kgdb_info[cpu].debuggerinfo = NULL; 596 - kgdb_info[cpu].task = NULL; 597 - 598 - /* fix up hardware debug registers on local cpu */ 599 - if (arch_kgdb_ops.correct_hw_break) 600 - arch_kgdb_ops.correct_hw_break(); 601 - 602 - /* Signal the primary CPU that we are done: */ 603 - atomic_set(&cpu_in_kgdb[cpu], 0); 604 - touch_softlockup_watchdog_sync(); 605 - clocksource_touch_watchdog(); 606 - local_irq_restore(flags); 607 - } 608 - #endif 609 564 610 565 /* 611 566 * Some architectures need cache flushes when we set/clear a ··· 1359 1400 return 1; 1360 1401 } 1361 1402 1362 - /* 1363 - * kgdb_handle_exception() - main entry point from a kernel exception 1364 - * 1365 - * Locking hierarchy: 1366 - * interface locks, if any (begin_session) 1367 - * kgdb lock (kgdb_active) 1368 - */ 1369 - int 1370 - kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) 1403 + static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs) 1371 1404 { 1372 - struct kgdb_state kgdb_var; 1373 - struct kgdb_state *ks = &kgdb_var; 1374 1405 unsigned long flags; 1375 1406 int sstep_tries = 100; 1376 1407 int error = 0; 1377 1408 int i, cpu; 1378 - 1379 - ks->cpu = raw_smp_processor_id(); 1380 - ks->ex_vector = evector; 1381 - ks->signo = signo; 1382 - ks->ex_vector = evector; 1383 - ks->err_code = ecode; 1384 - ks->kgdb_usethreadid = 0; 1385 - ks->linux_regs = regs; 1386 - 1387 - if (kgdb_reenter_check(ks)) 1388 - return 0; /* Ouch, double exception ! */ 1389 - 1409 + int trace_on = 0; 1390 1410 acquirelock: 1391 1411 /* 1392 1412 * Interrupts will be restored by the 'trap return' code, except when ··· 1373 1435 */ 1374 1436 local_irq_save(flags); 1375 1437 1376 - cpu = raw_smp_processor_id(); 1438 + cpu = ks->cpu; 1439 + kgdb_info[cpu].debuggerinfo = regs; 1440 + kgdb_info[cpu].task = current; 1441 + /* 1442 + * Make sure the above info reaches the primary CPU before 1443 + * our cpu_in_kgdb[] flag setting does: 1444 + */ 1445 + atomic_inc(&cpu_in_kgdb[cpu]); 1377 1446 1378 1447 /* 1379 - * Acquire the kgdb_active lock: 1448 + * CPU will loop if it is a slave or request to become a kgdb 1449 + * master cpu and acquire the kgdb_active lock: 1380 1450 */ 1381 - while (atomic_cmpxchg(&kgdb_active, -1, cpu) != -1) 1451 + while (1) { 1452 + if (kgdb_info[cpu].exception_state & DCPU_WANT_MASTER) { 1453 + if (atomic_cmpxchg(&kgdb_active, -1, cpu) == cpu) 1454 + break; 1455 + } else if (kgdb_info[cpu].exception_state & DCPU_IS_SLAVE) { 1456 + if (!atomic_read(&passive_cpu_wait[cpu])) 1457 + goto return_normal; 1458 + } else { 1459 + return_normal: 1460 + /* Return to normal operation by executing any 1461 + * hw breakpoint fixup. 1462 + */ 1463 + if (arch_kgdb_ops.correct_hw_break) 1464 + arch_kgdb_ops.correct_hw_break(); 1465 + if (trace_on) 1466 + tracing_on(); 1467 + atomic_dec(&cpu_in_kgdb[cpu]); 1468 + touch_softlockup_watchdog_sync(); 1469 + clocksource_touch_watchdog(); 1470 + local_irq_restore(flags); 1471 + return 0; 1472 + } 1382 1473 cpu_relax(); 1474 + } 1383 1475 1384 1476 /* 1385 1477 * For single stepping, try to only enter on the processor ··· 1443 1475 if (kgdb_io_ops->pre_exception) 1444 1476 kgdb_io_ops->pre_exception(); 1445 1477 1446 - kgdb_info[ks->cpu].debuggerinfo = ks->linux_regs; 1447 - kgdb_info[ks->cpu].task = current; 1448 - 1449 1478 kgdb_disable_hw_debug(ks->linux_regs); 1450 1479 1451 1480 /* ··· 1451 1486 */ 1452 1487 if (!kgdb_single_step) { 1453 1488 for (i = 0; i < NR_CPUS; i++) 1454 - atomic_set(&passive_cpu_wait[i], 1); 1489 + atomic_inc(&passive_cpu_wait[i]); 1455 1490 } 1456 - 1457 - /* 1458 - * spin_lock code is good enough as a barrier so we don't 1459 - * need one here: 1460 - */ 1461 - atomic_set(&cpu_in_kgdb[ks->cpu], 1); 1462 1491 1463 1492 #ifdef CONFIG_SMP 1464 1493 /* Signal the other CPUs to enter kgdb_wait() */ ··· 1477 1518 kgdb_single_step = 0; 1478 1519 kgdb_contthread = current; 1479 1520 exception_level = 0; 1521 + trace_on = tracing_is_on(); 1522 + if (trace_on) 1523 + tracing_off(); 1480 1524 1481 1525 /* Talk to debugger with gdbserial protocol */ 1482 1526 error = gdb_serial_stub(ks); ··· 1488 1526 if (kgdb_io_ops->post_exception) 1489 1527 kgdb_io_ops->post_exception(); 1490 1528 1491 - kgdb_info[ks->cpu].debuggerinfo = NULL; 1492 - kgdb_info[ks->cpu].task = NULL; 1493 - atomic_set(&cpu_in_kgdb[ks->cpu], 0); 1529 + atomic_dec(&cpu_in_kgdb[ks->cpu]); 1494 1530 1495 1531 if (!kgdb_single_step) { 1496 1532 for (i = NR_CPUS-1; i >= 0; i--) 1497 - atomic_set(&passive_cpu_wait[i], 0); 1533 + atomic_dec(&passive_cpu_wait[i]); 1498 1534 /* 1499 1535 * Wait till all the CPUs have quit 1500 1536 * from the debugger. ··· 1511 1551 else 1512 1552 kgdb_sstep_pid = 0; 1513 1553 } 1554 + if (trace_on) 1555 + tracing_on(); 1514 1556 /* Free kgdb_active */ 1515 1557 atomic_set(&kgdb_active, -1); 1516 1558 touch_softlockup_watchdog_sync(); ··· 1522 1560 return error; 1523 1561 } 1524 1562 1563 + /* 1564 + * kgdb_handle_exception() - main entry point from a kernel exception 1565 + * 1566 + * Locking hierarchy: 1567 + * interface locks, if any (begin_session) 1568 + * kgdb lock (kgdb_active) 1569 + */ 1570 + int 1571 + kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) 1572 + { 1573 + struct kgdb_state kgdb_var; 1574 + struct kgdb_state *ks = &kgdb_var; 1575 + int ret; 1576 + 1577 + ks->cpu = raw_smp_processor_id(); 1578 + ks->ex_vector = evector; 1579 + ks->signo = signo; 1580 + ks->ex_vector = evector; 1581 + ks->err_code = ecode; 1582 + ks->kgdb_usethreadid = 0; 1583 + ks->linux_regs = regs; 1584 + 1585 + if (kgdb_reenter_check(ks)) 1586 + return 0; /* Ouch, double exception ! */ 1587 + kgdb_info[ks->cpu].exception_state |= DCPU_WANT_MASTER; 1588 + ret = kgdb_cpu_enter(ks, regs); 1589 + kgdb_info[ks->cpu].exception_state &= ~DCPU_WANT_MASTER; 1590 + return ret; 1591 + } 1592 + 1525 1593 int kgdb_nmicallback(int cpu, void *regs) 1526 1594 { 1527 1595 #ifdef CONFIG_SMP 1596 + struct kgdb_state kgdb_var; 1597 + struct kgdb_state *ks = &kgdb_var; 1598 + 1599 + memset(ks, 0, sizeof(struct kgdb_state)); 1600 + ks->cpu = cpu; 1601 + ks->linux_regs = regs; 1602 + 1528 1603 if (!atomic_read(&cpu_in_kgdb[cpu]) && 1529 - atomic_read(&kgdb_active) != cpu && 1530 - atomic_read(&cpu_in_kgdb[atomic_read(&kgdb_active)])) { 1531 - kgdb_wait((struct pt_regs *)regs); 1604 + atomic_read(&kgdb_active) != -1 && 1605 + atomic_read(&kgdb_active) != cpu) { 1606 + kgdb_info[cpu].exception_state |= DCPU_IS_SLAVE; 1607 + kgdb_cpu_enter(ks, regs); 1608 + kgdb_info[cpu].exception_state &= ~DCPU_IS_SLAVE; 1532 1609 return 0; 1533 1610 } 1534 1611 #endif ··· 1743 1742 */ 1744 1743 void kgdb_breakpoint(void) 1745 1744 { 1746 - atomic_set(&kgdb_setting_breakpoint, 1); 1745 + atomic_inc(&kgdb_setting_breakpoint); 1747 1746 wmb(); /* Sync point before breakpoint */ 1748 1747 arch_kgdb_breakpoint(); 1749 1748 wmb(); /* Sync point after breakpoint */ 1750 - atomic_set(&kgdb_setting_breakpoint, 0); 1749 + atomic_dec(&kgdb_setting_breakpoint); 1751 1750 } 1752 1751 EXPORT_SYMBOL_GPL(kgdb_breakpoint); 1753 1752
+14 -8
kernel/perf_event.c
··· 1165 1165 struct perf_event_context *ctx = task->perf_event_ctxp; 1166 1166 struct perf_event_context *next_ctx; 1167 1167 struct perf_event_context *parent; 1168 - struct pt_regs *regs; 1169 1168 int do_switch = 1; 1170 1169 1171 - regs = task_pt_regs(task); 1172 - perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, regs, 0); 1170 + perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); 1173 1171 1174 1172 if (likely(!ctx || !cpuctx->task_ctx)) 1175 1173 return; ··· 2785 2787 return NULL; 2786 2788 } 2787 2789 2788 - #ifdef CONFIG_EVENT_TRACING 2789 2790 __weak 2790 2791 void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip) 2791 2792 { 2792 2793 } 2793 - #endif 2794 + 2794 2795 2795 2796 /* 2796 2797 * Output ··· 3376 3379 struct perf_task_event *task_event) 3377 3380 { 3378 3381 struct perf_output_handle handle; 3379 - int size; 3380 3382 struct task_struct *task = task_event->task; 3381 - int ret; 3383 + unsigned long flags; 3384 + int size, ret; 3385 + 3386 + /* 3387 + * If this CPU attempts to acquire an rq lock held by a CPU spinning 3388 + * in perf_output_lock() from interrupt context, it's game over. 3389 + */ 3390 + local_irq_save(flags); 3382 3391 3383 3392 size = task_event->event_id.header.size; 3384 3393 ret = perf_output_begin(&handle, event, size, 0, 0); 3385 3394 3386 - if (ret) 3395 + if (ret) { 3396 + local_irq_restore(flags); 3387 3397 return; 3398 + } 3388 3399 3389 3400 task_event->event_id.pid = perf_event_pid(event, task); 3390 3401 task_event->event_id.ppid = perf_event_pid(event, current); ··· 3403 3398 perf_output_put(&handle, task_event->event_id); 3404 3399 3405 3400 perf_output_end(&handle); 3401 + local_irq_restore(flags); 3406 3402 } 3407 3403 3408 3404 static int perf_event_task_match(struct perf_event *event)
+2 -3
kernel/power/process.c
··· 88 88 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds " 89 89 "(%d tasks refusing to freeze):\n", 90 90 elapsed_csecs / 100, elapsed_csecs % 100, todo); 91 - show_state(); 92 91 read_lock(&tasklist_lock); 93 92 do_each_thread(g, p) { 94 93 task_lock(p); 95 94 if (freezing(p) && !freezer_should_skip(p)) 96 - printk(KERN_ERR " %s\n", p->comm); 95 + sched_show_task(p); 97 96 cancel_freezing(p); 98 97 task_unlock(p); 99 98 } while_each_thread(g, p); ··· 144 145 if (nosig_only && should_send_signal(p)) 145 146 continue; 146 147 147 - if (cgroup_frozen(p)) 148 + if (cgroup_freezing_or_frozen(p)) 148 149 continue; 149 150 150 151 thaw_process(p);
+1 -1
kernel/sched.c
··· 5388 5388 5389 5389 get_task_struct(mt); 5390 5390 task_rq_unlock(rq, &flags); 5391 - wake_up_process(rq->migration_thread); 5391 + wake_up_process(mt); 5392 5392 put_task_struct(mt); 5393 5393 wait_for_completion(&req.done); 5394 5394 tlb_migrate_finish(p->mm);
-4
kernel/sched_debug.c
··· 518 518 p->se.nr_wakeups_idle = 0; 519 519 p->sched_info.bkl_count = 0; 520 520 #endif 521 - p->se.sum_exec_runtime = 0; 522 - p->se.prev_sum_exec_runtime = 0; 523 - p->nvcsw = 0; 524 - p->nivcsw = 0; 525 521 }
+5 -3
kernel/trace/ring_buffer.c
··· 1210 1210 1211 1211 for (i = 0; i < nr_pages; i++) { 1212 1212 if (RB_WARN_ON(cpu_buffer, list_empty(cpu_buffer->pages))) 1213 - return; 1213 + goto out; 1214 1214 p = cpu_buffer->pages->next; 1215 1215 bpage = list_entry(p, struct buffer_page, list); 1216 1216 list_del_init(&bpage->list); 1217 1217 free_buffer_page(bpage); 1218 1218 } 1219 1219 if (RB_WARN_ON(cpu_buffer, list_empty(cpu_buffer->pages))) 1220 - return; 1220 + goto out; 1221 1221 1222 1222 rb_reset_cpu(cpu_buffer); 1223 1223 rb_check_pages(cpu_buffer); 1224 1224 1225 + out: 1225 1226 spin_unlock_irq(&cpu_buffer->reader_lock); 1226 1227 } 1227 1228 ··· 1239 1238 1240 1239 for (i = 0; i < nr_pages; i++) { 1241 1240 if (RB_WARN_ON(cpu_buffer, list_empty(pages))) 1242 - return; 1241 + goto out; 1243 1242 p = pages->next; 1244 1243 bpage = list_entry(p, struct buffer_page, list); 1245 1244 list_del_init(&bpage->list); ··· 1248 1247 rb_reset_cpu(cpu_buffer); 1249 1248 rb_check_pages(cpu_buffer); 1250 1249 1250 + out: 1251 1251 spin_unlock_irq(&cpu_buffer->reader_lock); 1252 1252 } 1253 1253
+2 -2
kernel/trace/trace_clock.c
··· 84 84 int this_cpu; 85 85 u64 now; 86 86 87 - raw_local_irq_save(flags); 87 + local_irq_save(flags); 88 88 89 89 this_cpu = raw_smp_processor_id(); 90 90 now = cpu_clock(this_cpu); ··· 110 110 arch_spin_unlock(&trace_clock_struct.lock); 111 111 112 112 out: 113 - raw_local_irq_restore(flags); 113 + local_irq_restore(flags); 114 114 115 115 return now; 116 116 }
+9 -2
kernel/trace/trace_event_perf.c
··· 17 17 static char *perf_trace_buf; 18 18 static char *perf_trace_buf_nmi; 19 19 20 - typedef typeof(char [PERF_MAX_TRACE_SIZE]) perf_trace_t ; 20 + /* 21 + * Force it to be aligned to unsigned long to avoid misaligned accesses 22 + * suprises 23 + */ 24 + typedef typeof(unsigned long [PERF_MAX_TRACE_SIZE / sizeof(unsigned long)]) 25 + perf_trace_t; 21 26 22 27 /* Count the events in use (per event id, not per instance) */ 23 28 static int total_ref_count; ··· 135 130 char *trace_buf, *raw_data; 136 131 int pc, cpu; 137 132 133 + BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(unsigned long)); 134 + 138 135 pc = preempt_count(); 139 136 140 137 /* Protect the per cpu buffer, begin the rcu read side */ ··· 159 152 raw_data = per_cpu_ptr(trace_buf, cpu); 160 153 161 154 /* zero the dead bytes from align to not leak stack to user */ 162 - *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL; 155 + memset(&raw_data[size - sizeof(u64)], 0, sizeof(u64)); 163 156 164 157 entry = (struct trace_entry *)raw_data; 165 158 tracing_generic_entry_update(entry, *irq_flags, pc);
+5 -5
tools/perf/Makefile
··· 200 200 201 201 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 202 202 EXTLIBS = -lpthread -lrt -lelf -lm 203 - ALL_CFLAGS = $(CFLAGS) 203 + ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 204 204 ALL_LDFLAGS = $(LDFLAGS) 205 205 STRIP ?= strip 206 206 ··· 492 492 PTHREAD_LIBS = 493 493 endif 494 494 495 - ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 496 - ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 495 + ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 496 + ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 497 497 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 498 498 endif 499 499 500 - ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 500 + ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 501 501 BASIC_CFLAGS += -DLIBELF_NO_MMAP 502 502 endif 503 503 else 504 504 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); 505 505 endif 506 506 507 - ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 507 + ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 508 508 msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/elfutils-dev); 509 509 BASIC_CFLAGS += -DNO_DWARF_SUPPORT 510 510 else
+12 -5
tools/perf/util/scripting-engines/trace-event-python.c
··· 208 208 int size __unused, 209 209 unsigned long long nsecs, char *comm) 210 210 { 211 - PyObject *handler, *retval, *context, *t; 211 + PyObject *handler, *retval, *context, *t, *obj; 212 212 static char handler_name[256]; 213 213 struct format_field *field; 214 214 unsigned long long val; ··· 256 256 offset &= 0xffff; 257 257 } else 258 258 offset = field->offset; 259 - PyTuple_SetItem(t, n++, 260 - PyString_FromString((char *)data + offset)); 259 + obj = PyString_FromString((char *)data + offset); 261 260 } else { /* FIELD_IS_NUMERIC */ 262 261 val = read_size(data + field->offset, field->size); 263 262 if (field->flags & FIELD_IS_SIGNED) { 264 - PyTuple_SetItem(t, n++, PyInt_FromLong(val)); 263 + if ((long long)val >= LONG_MIN && 264 + (long long)val <= LONG_MAX) 265 + obj = PyInt_FromLong(val); 266 + else 267 + obj = PyLong_FromLongLong(val); 265 268 } else { 266 - PyTuple_SetItem(t, n++, PyInt_FromLong(val)); 269 + if (val <= LONG_MAX) 270 + obj = PyInt_FromLong(val); 271 + else 272 + obj = PyLong_FromUnsignedLongLong(val); 267 273 } 268 274 } 275 + PyTuple_SetItem(t, n++, obj); 269 276 } 270 277 271 278 if (_PyTuple_Resize(&t, n) == -1)