diff options
178 files changed, 9290 insertions, 3214 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 6abafb6f1844..aaa47400eb9c 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -84,7 +84,7 @@ | |||
84 | kputc #'\n' | 84 | kputc #'\n' |
85 | kphex r5, 8 /* decompressed kernel start */ | 85 | kphex r5, 8 /* decompressed kernel start */ |
86 | kputc #'-' | 86 | kputc #'-' |
87 | kphex r8, 8 /* decompressed kernel end */ | 87 | kphex r9, 8 /* decompressed kernel end */ |
88 | kputc #'>' | 88 | kputc #'>' |
89 | kphex r4, 8 /* kernel execution address */ | 89 | kphex r4, 8 /* kernel execution address */ |
90 | kputc #'\n' | 90 | kputc #'\n' |
@@ -116,7 +116,7 @@ start: | |||
116 | .word start @ absolute load/run zImage address | 116 | .word start @ absolute load/run zImage address |
117 | .word _edata @ zImage end address | 117 | .word _edata @ zImage end address |
118 | 1: mov r7, r1 @ save architecture ID | 118 | 1: mov r7, r1 @ save architecture ID |
119 | mov r8, #0 @ save r0 | 119 | mov r8, r2 @ save atags pointer |
120 | 120 | ||
121 | #ifndef __ARM_ARCH_2__ | 121 | #ifndef __ARM_ARCH_2__ |
122 | /* | 122 | /* |
@@ -144,7 +144,7 @@ not_angel: | |||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * some architecture specific code can be inserted | 146 | * some architecture specific code can be inserted |
147 | * by the linker here, but it should preserve r7 and r8. | 147 | * by the linker here, but it should preserve r7, r8, and r9. |
148 | */ | 148 | */ |
149 | 149 | ||
150 | .text | 150 | .text |
@@ -249,16 +249,17 @@ not_relocated: mov r0, #0 | |||
249 | * r5 = decompressed kernel start | 249 | * r5 = decompressed kernel start |
250 | * r6 = processor ID | 250 | * r6 = processor ID |
251 | * r7 = architecture ID | 251 | * r7 = architecture ID |
252 | * r8-r14 = unused | 252 | * r8 = atags pointer |
253 | * r9-r14 = corrupted | ||
253 | */ | 254 | */ |
254 | add r1, r5, r0 @ end of decompressed kernel | 255 | add r1, r5, r0 @ end of decompressed kernel |
255 | adr r2, reloc_start | 256 | adr r2, reloc_start |
256 | ldr r3, LC1 | 257 | ldr r3, LC1 |
257 | add r3, r2, r3 | 258 | add r3, r2, r3 |
258 | 1: ldmia r2!, {r8 - r13} @ copy relocation code | 259 | 1: ldmia r2!, {r9 - r14} @ copy relocation code |
259 | stmia r1!, {r8 - r13} | 260 | stmia r1!, {r9 - r14} |
260 | ldmia r2!, {r8 - r13} | 261 | ldmia r2!, {r9 - r14} |
261 | stmia r1!, {r8 - r13} | 262 | stmia r1!, {r9 - r14} |
262 | cmp r2, r3 | 263 | cmp r2, r3 |
263 | blo 1b | 264 | blo 1b |
264 | 265 | ||
@@ -308,11 +309,12 @@ params: ldr r0, =params_phys | |||
308 | * r4 = kernel execution address | 309 | * r4 = kernel execution address |
309 | * r6 = processor ID | 310 | * r6 = processor ID |
310 | * r7 = architecture number | 311 | * r7 = architecture number |
311 | * r8 = run-time address of "start" | 312 | * r8 = atags pointer |
313 | * r9 = run-time address of "start" (???) | ||
312 | * On exit, | 314 | * On exit, |
313 | * r1, r2, r3, r8, r9, r12 corrupted | 315 | * r1, r2, r3, r9, r10, r12 corrupted |
314 | * This routine must preserve: | 316 | * This routine must preserve: |
315 | * r4, r5, r6, r7 | 317 | * r4, r5, r6, r7, r8 |
316 | */ | 318 | */ |
317 | .align 5 | 319 | .align 5 |
318 | cache_on: mov r3, #8 @ cache_on function | 320 | cache_on: mov r3, #8 @ cache_on function |
@@ -326,15 +328,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size | |||
326 | * bits for the RAM area only. | 328 | * bits for the RAM area only. |
327 | */ | 329 | */ |
328 | mov r0, r3 | 330 | mov r0, r3 |
329 | mov r8, r0, lsr #18 | 331 | mov r9, r0, lsr #18 |
330 | mov r8, r8, lsl #18 @ start of RAM | 332 | mov r9, r9, lsl #18 @ start of RAM |
331 | add r9, r8, #0x10000000 @ a reasonable RAM size | 333 | add r10, r9, #0x10000000 @ a reasonable RAM size |
332 | mov r1, #0x12 | 334 | mov r1, #0x12 |
333 | orr r1, r1, #3 << 10 | 335 | orr r1, r1, #3 << 10 |
334 | add r2, r3, #16384 | 336 | add r2, r3, #16384 |
335 | 1: cmp r1, r8 @ if virt > start of RAM | 337 | 1: cmp r1, r8 @ if virt > start of RAM |
336 | orrhs r1, r1, #0x0c @ set cacheable, bufferable | 338 | orrhs r1, r1, #0x0c @ set cacheable, bufferable |
337 | cmp r1, r9 @ if virt > end of RAM | 339 | cmp r1, r10 @ if virt > end of RAM |
338 | bichs r1, r1, #0x0c @ clear cacheable, bufferable | 340 | bichs r1, r1, #0x0c @ clear cacheable, bufferable |
339 | str r1, [r0], #4 @ 1:1 mapping | 341 | str r1, [r0], #4 @ 1:1 mapping |
340 | add r1, r1, #1048576 | 342 | add r1, r1, #1048576 |
@@ -403,26 +405,28 @@ __common_cache_on: | |||
403 | * r5 = decompressed kernel start | 405 | * r5 = decompressed kernel start |
404 | * r6 = processor ID | 406 | * r6 = processor ID |
405 | * r7 = architecture ID | 407 | * r7 = architecture ID |
406 | * r8-r14 = unused | 408 | * r8 = atags pointer |
409 | * r9-r14 = corrupted | ||
407 | */ | 410 | */ |
408 | .align 5 | 411 | .align 5 |
409 | reloc_start: add r8, r5, r0 | 412 | reloc_start: add r9, r5, r0 |
410 | debug_reloc_start | 413 | debug_reloc_start |
411 | mov r1, r4 | 414 | mov r1, r4 |
412 | 1: | 415 | 1: |
413 | .rept 4 | 416 | .rept 4 |
414 | ldmia r5!, {r0, r2, r3, r9 - r13} @ relocate kernel | 417 | ldmia r5!, {r0, r2, r3, r10 - r14} @ relocate kernel |
415 | stmia r1!, {r0, r2, r3, r9 - r13} | 418 | stmia r1!, {r0, r2, r3, r10 - r14} |
416 | .endr | 419 | .endr |
417 | 420 | ||
418 | cmp r5, r8 | 421 | cmp r5, r9 |
419 | blo 1b | 422 | blo 1b |
420 | debug_reloc_end | 423 | debug_reloc_end |
421 | 424 | ||
422 | call_kernel: bl cache_clean_flush | 425 | call_kernel: bl cache_clean_flush |
423 | bl cache_off | 426 | bl cache_off |
424 | mov r0, #0 | 427 | mov r0, #0 @ must be zero |
425 | mov r1, r7 @ restore architecture number | 428 | mov r1, r7 @ restore architecture number |
429 | mov r2, r8 @ restore atags pointer | ||
426 | mov pc, r4 @ call kernel | 430 | mov pc, r4 @ call kernel |
427 | 431 | ||
428 | /* | 432 | /* |
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c index ffb82d5bedef..48b1e19b131f 100644 --- a/arch/arm/common/rtctime.c +++ b/arch/arm/common/rtctime.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/capability.h> | 20 | #include <linux/capability.h> |
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/mutex.h> | ||
22 | 23 | ||
23 | #include <asm/rtc.h> | 24 | #include <asm/rtc.h> |
24 | #include <asm/semaphore.h> | 25 | #include <asm/semaphore.h> |
@@ -35,7 +36,7 @@ static unsigned long rtc_irq_data; | |||
35 | /* | 36 | /* |
36 | * rtc_sem protects rtc_inuse and rtc_ops | 37 | * rtc_sem protects rtc_inuse and rtc_ops |
37 | */ | 38 | */ |
38 | static DECLARE_MUTEX(rtc_sem); | 39 | static DEFINE_MUTEX(rtc_mutex); |
39 | static unsigned long rtc_inuse; | 40 | static unsigned long rtc_inuse; |
40 | static struct rtc_ops *rtc_ops; | 41 | static struct rtc_ops *rtc_ops; |
41 | 42 | ||
@@ -356,7 +357,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
356 | { | 357 | { |
357 | int ret; | 358 | int ret; |
358 | 359 | ||
359 | down(&rtc_sem); | 360 | mutex_lock(&rtc_mutex); |
360 | 361 | ||
361 | if (rtc_inuse) { | 362 | if (rtc_inuse) { |
362 | ret = -EBUSY; | 363 | ret = -EBUSY; |
@@ -374,7 +375,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
374 | rtc_inuse = 1; | 375 | rtc_inuse = 1; |
375 | } | 376 | } |
376 | } | 377 | } |
377 | up(&rtc_sem); | 378 | mutex_unlock(&rtc_mutex); |
378 | 379 | ||
379 | return ret; | 380 | return ret; |
380 | } | 381 | } |
@@ -480,7 +481,7 @@ int register_rtc(struct rtc_ops *ops) | |||
480 | { | 481 | { |
481 | int ret = -EBUSY; | 482 | int ret = -EBUSY; |
482 | 483 | ||
483 | down(&rtc_sem); | 484 | mutex_lock(&rtc_mutex); |
484 | if (rtc_ops == NULL) { | 485 | if (rtc_ops == NULL) { |
485 | rtc_ops = ops; | 486 | rtc_ops = ops; |
486 | 487 | ||
@@ -489,7 +490,7 @@ int register_rtc(struct rtc_ops *ops) | |||
489 | create_proc_read_entry("driver/rtc", 0, NULL, | 490 | create_proc_read_entry("driver/rtc", 0, NULL, |
490 | rtc_read_proc, ops); | 491 | rtc_read_proc, ops); |
491 | } | 492 | } |
492 | up(&rtc_sem); | 493 | mutex_unlock(&rtc_mutex); |
493 | 494 | ||
494 | return ret; | 495 | return ret; |
495 | } | 496 | } |
@@ -497,12 +498,12 @@ EXPORT_SYMBOL(register_rtc); | |||
497 | 498 | ||
498 | void unregister_rtc(struct rtc_ops *rtc) | 499 | void unregister_rtc(struct rtc_ops *rtc) |
499 | { | 500 | { |
500 | down(&rtc_sem); | 501 | mutex_lock(&rtc_mutex); |
501 | if (rtc == rtc_ops) { | 502 | if (rtc == rtc_ops) { |
502 | remove_proc_entry("driver/rtc", NULL); | 503 | remove_proc_entry("driver/rtc", NULL); |
503 | misc_deregister(&rtc_miscdev); | 504 | misc_deregister(&rtc_miscdev); |
504 | rtc_ops = NULL; | 505 | rtc_ops = NULL; |
505 | } | 506 | } |
506 | up(&rtc_sem); | 507 | mutex_unlock(&rtc_mutex); |
507 | } | 508 | } |
508 | EXPORT_SYMBOL(unregister_rtc); | 509 | EXPORT_SYMBOL(unregister_rtc); |
diff --git a/arch/arm/configs/at91rm9200dk_defconfig b/arch/arm/configs/at91rm9200dk_defconfig new file mode 100644 index 000000000000..5cdd13acf8ff --- /dev/null +++ b/arch/arm/configs/at91rm9200dk_defconfig | |||
@@ -0,0 +1,1009 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.15 | ||
4 | # Mon Jan 9 20:54:30 2006 | ||
5 | # | ||
6 | CONFIG_ARM=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_UID16=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
11 | |||
12 | # | ||
13 | # Code maturity level options | ||
14 | # | ||
15 | CONFIG_EXPERIMENTAL=y | ||
16 | CONFIG_CLEAN_COMPILE=y | ||
17 | CONFIG_BROKEN_ON_SMP=y | ||
18 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | ||
24 | CONFIG_LOCALVERSION_AUTO=y | ||
25 | # CONFIG_SWAP is not set | ||
26 | CONFIG_SYSVIPC=y | ||
27 | # CONFIG_POSIX_MQUEUE is not set | ||
28 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
29 | CONFIG_SYSCTL=y | ||
30 | # CONFIG_AUDIT is not set | ||
31 | CONFIG_HOTPLUG=y | ||
32 | CONFIG_KOBJECT_UEVENT=y | ||
33 | # CONFIG_IKCONFIG is not set | ||
34 | CONFIG_INITRAMFS_SOURCE="" | ||
35 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
36 | # CONFIG_EMBEDDED is not set | ||
37 | CONFIG_KALLSYMS=y | ||
38 | # CONFIG_KALLSYMS_ALL is not set | ||
39 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | CONFIG_BASE_FULL=y | ||
43 | CONFIG_FUTEX=y | ||
44 | CONFIG_EPOLL=y | ||
45 | CONFIG_SHMEM=y | ||
46 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
47 | CONFIG_CC_ALIGN_LABELS=0 | ||
48 | CONFIG_CC_ALIGN_LOOPS=0 | ||
49 | CONFIG_CC_ALIGN_JUMPS=0 | ||
50 | # CONFIG_TINY_SHMEM is not set | ||
51 | CONFIG_BASE_SMALL=0 | ||
52 | |||
53 | # | ||
54 | # Loadable module support | ||
55 | # | ||
56 | CONFIG_MODULES=y | ||
57 | CONFIG_MODULE_UNLOAD=y | ||
58 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
59 | CONFIG_OBSOLETE_MODPARM=y | ||
60 | # CONFIG_MODVERSIONS is not set | ||
61 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
62 | CONFIG_KMOD=y | ||
63 | |||
64 | # | ||
65 | # Block layer | ||
66 | # | ||
67 | |||
68 | # | ||
69 | # IO Schedulers | ||
70 | # | ||
71 | CONFIG_IOSCHED_NOOP=y | ||
72 | CONFIG_IOSCHED_AS=y | ||
73 | # CONFIG_IOSCHED_DEADLINE is not set | ||
74 | # CONFIG_IOSCHED_CFQ is not set | ||
75 | CONFIG_DEFAULT_AS=y | ||
76 | # CONFIG_DEFAULT_DEADLINE is not set | ||
77 | # CONFIG_DEFAULT_CFQ is not set | ||
78 | # CONFIG_DEFAULT_NOOP is not set | ||
79 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
80 | |||
81 | # | ||
82 | # System Type | ||
83 | # | ||
84 | # CONFIG_ARCH_CLPS7500 is not set | ||
85 | # CONFIG_ARCH_CLPS711X is not set | ||
86 | # CONFIG_ARCH_CO285 is not set | ||
87 | # CONFIG_ARCH_EBSA110 is not set | ||
88 | # CONFIG_ARCH_CAMELOT is not set | ||
89 | # CONFIG_ARCH_FOOTBRIDGE is not set | ||
90 | # CONFIG_ARCH_INTEGRATOR is not set | ||
91 | # CONFIG_ARCH_IOP3XX is not set | ||
92 | # CONFIG_ARCH_IXP4XX is not set | ||
93 | # CONFIG_ARCH_IXP2000 is not set | ||
94 | # CONFIG_ARCH_L7200 is not set | ||
95 | # CONFIG_ARCH_PXA is not set | ||
96 | # CONFIG_ARCH_RPC is not set | ||
97 | # CONFIG_ARCH_SA1100 is not set | ||
98 | # CONFIG_ARCH_S3C2410 is not set | ||
99 | # CONFIG_ARCH_SHARK is not set | ||
100 | # CONFIG_ARCH_LH7A40X is not set | ||
101 | # CONFIG_ARCH_OMAP is not set | ||
102 | # CONFIG_ARCH_VERSATILE is not set | ||
103 | # CONFIG_ARCH_REALVIEW is not set | ||
104 | # CONFIG_ARCH_IMX is not set | ||
105 | # CONFIG_ARCH_H720X is not set | ||
106 | # CONFIG_ARCH_AAEC2000 is not set | ||
107 | CONFIG_ARCH_AT91RM9200=y | ||
108 | |||
109 | # | ||
110 | # AT91RM9200 Implementations | ||
111 | # | ||
112 | |||
113 | # | ||
114 | # AT91RM9200 Board Type | ||
115 | # | ||
116 | CONFIG_ARCH_AT91RM9200DK=y | ||
117 | # CONFIG_MACH_AT91RM9200EK is not set | ||
118 | # CONFIG_MACH_CSB337 is not set | ||
119 | # CONFIG_MACH_CSB637 is not set | ||
120 | # CONFIG_MACH_CARMEVA is not set | ||
121 | # CONFIG_MACH_KB9200 is not set | ||
122 | # CONFIG_MACH_ATEB9200 is not set | ||
123 | |||
124 | # | ||
125 | # AT91RM9200 Feature Selections | ||
126 | # | ||
127 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
128 | |||
129 | # | ||
130 | # Processor Type | ||
131 | # | ||
132 | CONFIG_CPU_32=y | ||
133 | CONFIG_CPU_ARM920T=y | ||
134 | CONFIG_CPU_32v4=y | ||
135 | CONFIG_CPU_ABRT_EV4T=y | ||
136 | CONFIG_CPU_CACHE_V4WT=y | ||
137 | CONFIG_CPU_CACHE_VIVT=y | ||
138 | CONFIG_CPU_COPY_V4WB=y | ||
139 | CONFIG_CPU_TLB_V4WBI=y | ||
140 | |||
141 | # | ||
142 | # Processor Features | ||
143 | # | ||
144 | # CONFIG_ARM_THUMB is not set | ||
145 | # CONFIG_CPU_ICACHE_DISABLE is not set | ||
146 | # CONFIG_CPU_DCACHE_DISABLE is not set | ||
147 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | ||
148 | |||
149 | # | ||
150 | # Bus support | ||
151 | # | ||
152 | CONFIG_ISA_DMA_API=y | ||
153 | |||
154 | # | ||
155 | # PCCARD (PCMCIA/CardBus) support | ||
156 | # | ||
157 | CONFIG_PCCARD=y | ||
158 | # CONFIG_PCMCIA_DEBUG is not set | ||
159 | CONFIG_PCMCIA=y | ||
160 | CONFIG_PCMCIA_LOAD_CIS=y | ||
161 | CONFIG_PCMCIA_IOCTL=y | ||
162 | |||
163 | # | ||
164 | # PC-card bridges | ||
165 | # | ||
166 | CONFIG_AT91_CF=y | ||
167 | |||
168 | # | ||
169 | # Kernel Features | ||
170 | # | ||
171 | # CONFIG_PREEMPT is not set | ||
172 | # CONFIG_NO_IDLE_HZ is not set | ||
173 | # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set | ||
174 | CONFIG_SELECT_MEMORY_MODEL=y | ||
175 | CONFIG_FLATMEM_MANUAL=y | ||
176 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
177 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
178 | CONFIG_FLATMEM=y | ||
179 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
180 | # CONFIG_SPARSEMEM_STATIC is not set | ||
181 | CONFIG_SPLIT_PTLOCK_CPUS=4096 | ||
182 | CONFIG_LEDS=y | ||
183 | CONFIG_LEDS_TIMER=y | ||
184 | # CONFIG_LEDS_CPU is not set | ||
185 | CONFIG_ALIGNMENT_TRAP=y | ||
186 | |||
187 | # | ||
188 | # Boot options | ||
189 | # | ||
190 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
191 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
192 | CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw" | ||
193 | # CONFIG_XIP_KERNEL is not set | ||
194 | |||
195 | # | ||
196 | # Floating point emulation | ||
197 | # | ||
198 | |||
199 | # | ||
200 | # At least one emulation must be selected | ||
201 | # | ||
202 | CONFIG_FPE_NWFPE=y | ||
203 | # CONFIG_FPE_NWFPE_XP is not set | ||
204 | # CONFIG_FPE_FASTFPE is not set | ||
205 | |||
206 | # | ||
207 | # Userspace binary formats | ||
208 | # | ||
209 | CONFIG_BINFMT_ELF=y | ||
210 | # CONFIG_BINFMT_AOUT is not set | ||
211 | # CONFIG_BINFMT_MISC is not set | ||
212 | # CONFIG_ARTHUR is not set | ||
213 | |||
214 | # | ||
215 | # Power management options | ||
216 | # | ||
217 | # CONFIG_PM is not set | ||
218 | |||
219 | # | ||
220 | # Networking | ||
221 | # | ||
222 | CONFIG_NET=y | ||
223 | |||
224 | # | ||
225 | # Networking options | ||
226 | # | ||
227 | CONFIG_PACKET=y | ||
228 | # CONFIG_PACKET_MMAP is not set | ||
229 | CONFIG_UNIX=y | ||
230 | # CONFIG_NET_KEY is not set | ||
231 | CONFIG_INET=y | ||
232 | # CONFIG_IP_MULTICAST is not set | ||
233 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
234 | CONFIG_IP_FIB_HASH=y | ||
235 | CONFIG_IP_PNP=y | ||
236 | # CONFIG_IP_PNP_DHCP is not set | ||
237 | CONFIG_IP_PNP_BOOTP=y | ||
238 | # CONFIG_IP_PNP_RARP is not set | ||
239 | # CONFIG_NET_IPIP is not set | ||
240 | # CONFIG_NET_IPGRE is not set | ||
241 | # CONFIG_ARPD is not set | ||
242 | # CONFIG_SYN_COOKIES is not set | ||
243 | # CONFIG_INET_AH is not set | ||
244 | # CONFIG_INET_ESP is not set | ||
245 | # CONFIG_INET_IPCOMP is not set | ||
246 | # CONFIG_INET_TUNNEL is not set | ||
247 | CONFIG_INET_DIAG=y | ||
248 | CONFIG_INET_TCP_DIAG=y | ||
249 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
250 | CONFIG_TCP_CONG_BIC=y | ||
251 | # CONFIG_IPV6 is not set | ||
252 | # CONFIG_NETFILTER is not set | ||
253 | |||
254 | # | ||
255 | # DCCP Configuration (EXPERIMENTAL) | ||
256 | # | ||
257 | # CONFIG_IP_DCCP is not set | ||
258 | |||
259 | # | ||
260 | # SCTP Configuration (EXPERIMENTAL) | ||
261 | # | ||
262 | # CONFIG_IP_SCTP is not set | ||
263 | # CONFIG_ATM is not set | ||
264 | # CONFIG_BRIDGE is not set | ||
265 | # CONFIG_VLAN_8021Q is not set | ||
266 | # CONFIG_DECNET is not set | ||
267 | # CONFIG_LLC2 is not set | ||
268 | # CONFIG_IPX is not set | ||
269 | # CONFIG_ATALK is not set | ||
270 | # CONFIG_X25 is not set | ||
271 | # CONFIG_LAPB is not set | ||
272 | # CONFIG_NET_DIVERT is not set | ||
273 | # CONFIG_ECONET is not set | ||
274 | # CONFIG_WAN_ROUTER is not set | ||
275 | |||
276 | # | ||
277 | # QoS and/or fair queueing | ||
278 | # | ||
279 | # CONFIG_NET_SCHED is not set | ||
280 | |||
281 | # | ||
282 | # Network testing | ||
283 | # | ||
284 | # CONFIG_NET_PKTGEN is not set | ||
285 | # CONFIG_HAMRADIO is not set | ||
286 | # CONFIG_IRDA is not set | ||
287 | # CONFIG_BT is not set | ||
288 | # CONFIG_IEEE80211 is not set | ||
289 | |||
290 | # | ||
291 | # Device Drivers | ||
292 | # | ||
293 | |||
294 | # | ||
295 | # Generic Driver Options | ||
296 | # | ||
297 | CONFIG_STANDALONE=y | ||
298 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
299 | CONFIG_FW_LOADER=y | ||
300 | # CONFIG_DEBUG_DRIVER is not set | ||
301 | |||
302 | # | ||
303 | # Connector - unified userspace <-> kernelspace linker | ||
304 | # | ||
305 | # CONFIG_CONNECTOR is not set | ||
306 | |||
307 | # | ||
308 | # Memory Technology Devices (MTD) | ||
309 | # | ||
310 | CONFIG_MTD=y | ||
311 | # CONFIG_MTD_DEBUG is not set | ||
312 | # CONFIG_MTD_CONCAT is not set | ||
313 | CONFIG_MTD_PARTITIONS=y | ||
314 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
315 | CONFIG_MTD_CMDLINE_PARTS=y | ||
316 | # CONFIG_MTD_AFS_PARTS is not set | ||
317 | |||
318 | # | ||
319 | # User Modules And Translation Layers | ||
320 | # | ||
321 | CONFIG_MTD_CHAR=y | ||
322 | CONFIG_MTD_BLOCK=y | ||
323 | # CONFIG_FTL is not set | ||
324 | # CONFIG_NFTL is not set | ||
325 | # CONFIG_INFTL is not set | ||
326 | # CONFIG_RFD_FTL is not set | ||
327 | |||
328 | # | ||
329 | # RAM/ROM/Flash chip drivers | ||
330 | # | ||
331 | CONFIG_MTD_CFI=y | ||
332 | CONFIG_MTD_JEDECPROBE=y | ||
333 | CONFIG_MTD_GEN_PROBE=y | ||
334 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
335 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
336 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
337 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
338 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
339 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
340 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
341 | CONFIG_MTD_CFI_I1=y | ||
342 | CONFIG_MTD_CFI_I2=y | ||
343 | # CONFIG_MTD_CFI_I4 is not set | ||
344 | # CONFIG_MTD_CFI_I8 is not set | ||
345 | # CONFIG_MTD_CFI_INTELEXT is not set | ||
346 | CONFIG_MTD_CFI_AMDSTD=y | ||
347 | CONFIG_MTD_CFI_AMDSTD_RETRY=0 | ||
348 | # CONFIG_MTD_CFI_STAA is not set | ||
349 | CONFIG_MTD_CFI_UTIL=y | ||
350 | # CONFIG_MTD_RAM is not set | ||
351 | # CONFIG_MTD_ROM is not set | ||
352 | # CONFIG_MTD_ABSENT is not set | ||
353 | # CONFIG_MTD_XIP is not set | ||
354 | |||
355 | # | ||
356 | # Mapping drivers for chip access | ||
357 | # | ||
358 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
359 | CONFIG_MTD_PHYSMAP=y | ||
360 | CONFIG_MTD_PHYSMAP_START=0x10000000 | ||
361 | CONFIG_MTD_PHYSMAP_LEN=0x200000 | ||
362 | CONFIG_MTD_PHYSMAP_BANKWIDTH=2 | ||
363 | # CONFIG_MTD_ARM_INTEGRATOR is not set | ||
364 | # CONFIG_MTD_IMPA7 is not set | ||
365 | # CONFIG_MTD_PLATRAM is not set | ||
366 | |||
367 | # | ||
368 | # Self-contained MTD device drivers | ||
369 | # | ||
370 | # CONFIG_MTD_SLRAM is not set | ||
371 | # CONFIG_MTD_PHRAM is not set | ||
372 | # CONFIG_MTD_MTDRAM is not set | ||
373 | # CONFIG_MTD_BLKMTD is not set | ||
374 | # CONFIG_MTD_BLOCK2MTD is not set | ||
375 | |||
376 | # | ||
377 | # Disk-On-Chip Device Drivers | ||
378 | # | ||
379 | # CONFIG_MTD_DOC2000 is not set | ||
380 | # CONFIG_MTD_DOC2001 is not set | ||
381 | # CONFIG_MTD_DOC2001PLUS is not set | ||
382 | CONFIG_MTD_AT91_DATAFLASH=y | ||
383 | CONFIG_MTD_AT91_DATAFLASH_CARD=y | ||
384 | |||
385 | # | ||
386 | # NAND Flash Device Drivers | ||
387 | # | ||
388 | # CONFIG_MTD_NAND is not set | ||
389 | |||
390 | # | ||
391 | # OneNAND Flash Device Drivers | ||
392 | # | ||
393 | # CONFIG_MTD_ONENAND is not set | ||
394 | |||
395 | # | ||
396 | # Parallel port support | ||
397 | # | ||
398 | # CONFIG_PARPORT is not set | ||
399 | |||
400 | # | ||
401 | # Plug and Play support | ||
402 | # | ||
403 | |||
404 | # | ||
405 | # Block devices | ||
406 | # | ||
407 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
408 | # CONFIG_BLK_DEV_LOOP is not set | ||
409 | # CONFIG_BLK_DEV_NBD is not set | ||
410 | # CONFIG_BLK_DEV_UB is not set | ||
411 | CONFIG_BLK_DEV_RAM=y | ||
412 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
413 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
414 | CONFIG_BLK_DEV_INITRD=y | ||
415 | # CONFIG_CDROM_PKTCDVD is not set | ||
416 | # CONFIG_ATA_OVER_ETH is not set | ||
417 | |||
418 | # | ||
419 | # ATA/ATAPI/MFM/RLL support | ||
420 | # | ||
421 | # CONFIG_IDE is not set | ||
422 | |||
423 | # | ||
424 | # SCSI device support | ||
425 | # | ||
426 | # CONFIG_RAID_ATTRS is not set | ||
427 | # CONFIG_SCSI is not set | ||
428 | |||
429 | # | ||
430 | # Multi-device support (RAID and LVM) | ||
431 | # | ||
432 | # CONFIG_MD is not set | ||
433 | |||
434 | # | ||
435 | # Fusion MPT device support | ||
436 | # | ||
437 | # CONFIG_FUSION is not set | ||
438 | |||
439 | # | ||
440 | # IEEE 1394 (FireWire) support | ||
441 | # | ||
442 | |||
443 | # | ||
444 | # I2O device support | ||
445 | # | ||
446 | |||
447 | # | ||
448 | # Network device support | ||
449 | # | ||
450 | CONFIG_NETDEVICES=y | ||
451 | # CONFIG_DUMMY is not set | ||
452 | # CONFIG_BONDING is not set | ||
453 | # CONFIG_EQUALIZER is not set | ||
454 | # CONFIG_TUN is not set | ||
455 | |||
456 | # | ||
457 | # PHY device support | ||
458 | # | ||
459 | # CONFIG_PHYLIB is not set | ||
460 | |||
461 | # | ||
462 | # Ethernet (10 or 100Mbit) | ||
463 | # | ||
464 | CONFIG_NET_ETHERNET=y | ||
465 | CONFIG_MII=y | ||
466 | CONFIG_ARM_AT91_ETHER=y | ||
467 | # CONFIG_SMC91X is not set | ||
468 | # CONFIG_DM9000 is not set | ||
469 | |||
470 | # | ||
471 | # Ethernet (1000 Mbit) | ||
472 | # | ||
473 | |||
474 | # | ||
475 | # Ethernet (10000 Mbit) | ||
476 | # | ||
477 | |||
478 | # | ||
479 | # Token Ring devices | ||
480 | # | ||
481 | |||
482 | # | ||
483 | # Wireless LAN (non-hamradio) | ||
484 | # | ||
485 | # CONFIG_NET_RADIO is not set | ||
486 | |||
487 | # | ||
488 | # PCMCIA network device support | ||
489 | # | ||
490 | # CONFIG_NET_PCMCIA is not set | ||
491 | |||
492 | # | ||
493 | # Wan interfaces | ||
494 | # | ||
495 | # CONFIG_WAN is not set | ||
496 | # CONFIG_PPP is not set | ||
497 | # CONFIG_SLIP is not set | ||
498 | # CONFIG_SHAPER is not set | ||
499 | # CONFIG_NETCONSOLE is not set | ||
500 | # CONFIG_NETPOLL is not set | ||
501 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
502 | |||
503 | # | ||
504 | # ISDN subsystem | ||
505 | # | ||
506 | # CONFIG_ISDN is not set | ||
507 | |||
508 | # | ||
509 | # Input device support | ||
510 | # | ||
511 | CONFIG_INPUT=y | ||
512 | |||
513 | # | ||
514 | # Userland interfaces | ||
515 | # | ||
516 | CONFIG_INPUT_MOUSEDEV=y | ||
517 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | ||
518 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
519 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
520 | # CONFIG_INPUT_JOYDEV is not set | ||
521 | # CONFIG_INPUT_TSDEV is not set | ||
522 | # CONFIG_INPUT_EVDEV is not set | ||
523 | # CONFIG_INPUT_EVBUG is not set | ||
524 | |||
525 | # | ||
526 | # Input Device Drivers | ||
527 | # | ||
528 | # CONFIG_INPUT_KEYBOARD is not set | ||
529 | # CONFIG_INPUT_MOUSE is not set | ||
530 | # CONFIG_INPUT_JOYSTICK is not set | ||
531 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
532 | # CONFIG_INPUT_MISC is not set | ||
533 | |||
534 | # | ||
535 | # Hardware I/O ports | ||
536 | # | ||
537 | # CONFIG_SERIO is not set | ||
538 | # CONFIG_GAMEPORT is not set | ||
539 | |||
540 | # | ||
541 | # Character devices | ||
542 | # | ||
543 | CONFIG_VT=y | ||
544 | CONFIG_VT_CONSOLE=y | ||
545 | CONFIG_HW_CONSOLE=y | ||
546 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
547 | |||
548 | # | ||
549 | # Serial drivers | ||
550 | # | ||
551 | # CONFIG_SERIAL_8250 is not set | ||
552 | |||
553 | # | ||
554 | # Non-8250 serial port support | ||
555 | # | ||
556 | CONFIG_SERIAL_AT91=y | ||
557 | CONFIG_SERIAL_AT91_CONSOLE=y | ||
558 | # CONFIG_SERIAL_AT91_TTYAT is not set | ||
559 | CONFIG_SERIAL_CORE=y | ||
560 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
561 | CONFIG_UNIX98_PTYS=y | ||
562 | CONFIG_LEGACY_PTYS=y | ||
563 | CONFIG_LEGACY_PTY_COUNT=256 | ||
564 | |||
565 | # | ||
566 | # IPMI | ||
567 | # | ||
568 | # CONFIG_IPMI_HANDLER is not set | ||
569 | |||
570 | # | ||
571 | # Watchdog Cards | ||
572 | # | ||
573 | CONFIG_WATCHDOG=y | ||
574 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
575 | |||
576 | # | ||
577 | # Watchdog Device Drivers | ||
578 | # | ||
579 | # CONFIG_SOFT_WATCHDOG is not set | ||
580 | CONFIG_AT91_WATCHDOG=y | ||
581 | |||
582 | # | ||
583 | # USB-based Watchdog Cards | ||
584 | # | ||
585 | # CONFIG_USBPCWATCHDOG is not set | ||
586 | # CONFIG_NVRAM is not set | ||
587 | # CONFIG_RTC is not set | ||
588 | CONFIG_AT91_RTC=y | ||
589 | # CONFIG_DTLK is not set | ||
590 | # CONFIG_R3964 is not set | ||
591 | |||
592 | # | ||
593 | # Ftape, the floppy tape device driver | ||
594 | # | ||
595 | |||
596 | # | ||
597 | # PCMCIA character devices | ||
598 | # | ||
599 | # CONFIG_SYNCLINK_CS is not set | ||
600 | # CONFIG_CARDMAN_4000 is not set | ||
601 | # CONFIG_CARDMAN_4040 is not set | ||
602 | # CONFIG_RAW_DRIVER is not set | ||
603 | |||
604 | # | ||
605 | # TPM devices | ||
606 | # | ||
607 | # CONFIG_TCG_TPM is not set | ||
608 | # CONFIG_TELCLOCK is not set | ||
609 | CONFIG_AT91_SPI=y | ||
610 | CONFIG_AT91_SPIDEV=y | ||
611 | |||
612 | # | ||
613 | # I2C support | ||
614 | # | ||
615 | CONFIG_I2C=y | ||
616 | CONFIG_I2C_CHARDEV=y | ||
617 | |||
618 | # | ||
619 | # I2C Algorithms | ||
620 | # | ||
621 | # CONFIG_I2C_ALGOBIT is not set | ||
622 | # CONFIG_I2C_ALGOPCF is not set | ||
623 | # CONFIG_I2C_ALGOPCA is not set | ||
624 | |||
625 | # | ||
626 | # I2C Hardware Bus support | ||
627 | # | ||
628 | CONFIG_I2C_AT91=y | ||
629 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
630 | # CONFIG_I2C_STUB is not set | ||
631 | # CONFIG_I2C_PCA_ISA is not set | ||
632 | |||
633 | # | ||
634 | # Miscellaneous I2C Chip support | ||
635 | # | ||
636 | # CONFIG_SENSORS_DS1337 is not set | ||
637 | # CONFIG_SENSORS_DS1374 is not set | ||
638 | # CONFIG_SENSORS_EEPROM is not set | ||
639 | # CONFIG_SENSORS_PCF8574 is not set | ||
640 | # CONFIG_SENSORS_PCA9539 is not set | ||
641 | # CONFIG_SENSORS_PCF8591 is not set | ||
642 | # CONFIG_SENSORS_RTC8564 is not set | ||
643 | # CONFIG_SENSORS_MAX6875 is not set | ||
644 | # CONFIG_RTC_X1205_I2C is not set | ||
645 | # CONFIG_I2C_DEBUG_CORE is not set | ||
646 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
647 | # CONFIG_I2C_DEBUG_BUS is not set | ||
648 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
649 | |||
650 | # | ||
651 | # Hardware Monitoring support | ||
652 | # | ||
653 | CONFIG_HWMON=y | ||
654 | # CONFIG_HWMON_VID is not set | ||
655 | # CONFIG_SENSORS_ADM1021 is not set | ||
656 | # CONFIG_SENSORS_ADM1025 is not set | ||
657 | # CONFIG_SENSORS_ADM1026 is not set | ||
658 | # CONFIG_SENSORS_ADM1031 is not set | ||
659 | # CONFIG_SENSORS_ADM9240 is not set | ||
660 | # CONFIG_SENSORS_ASB100 is not set | ||
661 | # CONFIG_SENSORS_ATXP1 is not set | ||
662 | # CONFIG_SENSORS_DS1621 is not set | ||
663 | # CONFIG_SENSORS_FSCHER is not set | ||
664 | # CONFIG_SENSORS_FSCPOS is not set | ||
665 | # CONFIG_SENSORS_GL518SM is not set | ||
666 | # CONFIG_SENSORS_GL520SM is not set | ||
667 | # CONFIG_SENSORS_IT87 is not set | ||
668 | # CONFIG_SENSORS_LM63 is not set | ||
669 | # CONFIG_SENSORS_LM75 is not set | ||
670 | # CONFIG_SENSORS_LM77 is not set | ||
671 | # CONFIG_SENSORS_LM78 is not set | ||
672 | # CONFIG_SENSORS_LM80 is not set | ||
673 | # CONFIG_SENSORS_LM83 is not set | ||
674 | # CONFIG_SENSORS_LM85 is not set | ||
675 | # CONFIG_SENSORS_LM87 is not set | ||
676 | # CONFIG_SENSORS_LM90 is not set | ||
677 | # CONFIG_SENSORS_LM92 is not set | ||
678 | # CONFIG_SENSORS_MAX1619 is not set | ||
679 | # CONFIG_SENSORS_PC87360 is not set | ||
680 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
681 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
682 | # CONFIG_SENSORS_W83781D is not set | ||
683 | # CONFIG_SENSORS_W83792D is not set | ||
684 | # CONFIG_SENSORS_W83L785TS is not set | ||
685 | # CONFIG_SENSORS_W83627HF is not set | ||
686 | # CONFIG_SENSORS_W83627EHF is not set | ||
687 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
688 | |||
689 | # | ||
690 | # Misc devices | ||
691 | # | ||
692 | |||
693 | # | ||
694 | # Multimedia Capabilities Port drivers | ||
695 | # | ||
696 | |||
697 | # | ||
698 | # Multimedia devices | ||
699 | # | ||
700 | # CONFIG_VIDEO_DEV is not set | ||
701 | |||
702 | # | ||
703 | # Digital Video Broadcasting Devices | ||
704 | # | ||
705 | # CONFIG_DVB is not set | ||
706 | |||
707 | # | ||
708 | # Graphics support | ||
709 | # | ||
710 | # CONFIG_FB is not set | ||
711 | |||
712 | # | ||
713 | # Console display driver support | ||
714 | # | ||
715 | # CONFIG_VGA_CONSOLE is not set | ||
716 | CONFIG_DUMMY_CONSOLE=y | ||
717 | |||
718 | # | ||
719 | # Sound | ||
720 | # | ||
721 | # CONFIG_SOUND is not set | ||
722 | |||
723 | # | ||
724 | # USB support | ||
725 | # | ||
726 | CONFIG_USB_ARCH_HAS_HCD=y | ||
727 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
728 | CONFIG_USB=y | ||
729 | CONFIG_USB_DEBUG=y | ||
730 | |||
731 | # | ||
732 | # Miscellaneous USB options | ||
733 | # | ||
734 | CONFIG_USB_DEVICEFS=y | ||
735 | # CONFIG_USB_BANDWIDTH is not set | ||
736 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
737 | # CONFIG_USB_OTG is not set | ||
738 | |||
739 | # | ||
740 | # USB Host Controller Drivers | ||
741 | # | ||
742 | # CONFIG_USB_ISP116X_HCD is not set | ||
743 | CONFIG_USB_OHCI_HCD=y | ||
744 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | ||
745 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
746 | # CONFIG_USB_SL811_HCD is not set | ||
747 | |||
748 | # | ||
749 | # USB Device Class drivers | ||
750 | # | ||
751 | # CONFIG_USB_ACM is not set | ||
752 | # CONFIG_USB_PRINTER is not set | ||
753 | |||
754 | # | ||
755 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | ||
756 | # | ||
757 | |||
758 | # | ||
759 | # may also be needed; see USB_STORAGE Help for more information | ||
760 | # | ||
761 | # CONFIG_USB_STORAGE is not set | ||
762 | |||
763 | # | ||
764 | # USB Input Devices | ||
765 | # | ||
766 | # CONFIG_USB_HID is not set | ||
767 | |||
768 | # | ||
769 | # USB HID Boot Protocol drivers | ||
770 | # | ||
771 | # CONFIG_USB_KBD is not set | ||
772 | # CONFIG_USB_MOUSE is not set | ||
773 | # CONFIG_USB_AIPTEK is not set | ||
774 | # CONFIG_USB_WACOM is not set | ||
775 | # CONFIG_USB_ACECAD is not set | ||
776 | # CONFIG_USB_KBTAB is not set | ||
777 | # CONFIG_USB_POWERMATE is not set | ||
778 | # CONFIG_USB_MTOUCH is not set | ||
779 | # CONFIG_USB_ITMTOUCH is not set | ||
780 | # CONFIG_USB_EGALAX is not set | ||
781 | # CONFIG_USB_YEALINK is not set | ||
782 | # CONFIG_USB_XPAD is not set | ||
783 | # CONFIG_USB_ATI_REMOTE is not set | ||
784 | # CONFIG_USB_KEYSPAN_REMOTE is not set | ||
785 | # CONFIG_USB_APPLETOUCH is not set | ||
786 | |||
787 | # | ||
788 | # USB Imaging devices | ||
789 | # | ||
790 | # CONFIG_USB_MDC800 is not set | ||
791 | |||
792 | # | ||
793 | # USB Multimedia devices | ||
794 | # | ||
795 | # CONFIG_USB_DABUSB is not set | ||
796 | |||
797 | # | ||
798 | # Video4Linux support is needed for USB Multimedia device support | ||
799 | # | ||
800 | |||
801 | # | ||
802 | # USB Network Adapters | ||
803 | # | ||
804 | # CONFIG_USB_CATC is not set | ||
805 | # CONFIG_USB_KAWETH is not set | ||
806 | # CONFIG_USB_PEGASUS is not set | ||
807 | # CONFIG_USB_RTL8150 is not set | ||
808 | # CONFIG_USB_USBNET is not set | ||
809 | CONFIG_USB_MON=y | ||
810 | |||
811 | # | ||
812 | # USB port drivers | ||
813 | # | ||
814 | |||
815 | # | ||
816 | # USB Serial Converter support | ||
817 | # | ||
818 | # CONFIG_USB_SERIAL is not set | ||
819 | |||
820 | # | ||
821 | # USB Miscellaneous drivers | ||
822 | # | ||
823 | # CONFIG_USB_EMI62 is not set | ||
824 | # CONFIG_USB_EMI26 is not set | ||
825 | # CONFIG_USB_AUERSWALD is not set | ||
826 | # CONFIG_USB_RIO500 is not set | ||
827 | # CONFIG_USB_LEGOTOWER is not set | ||
828 | # CONFIG_USB_LCD is not set | ||
829 | # CONFIG_USB_LED is not set | ||
830 | # CONFIG_USB_CYTHERM is not set | ||
831 | # CONFIG_USB_PHIDGETKIT is not set | ||
832 | # CONFIG_USB_PHIDGETSERVO is not set | ||
833 | # CONFIG_USB_IDMOUSE is not set | ||
834 | # CONFIG_USB_LD is not set | ||
835 | # CONFIG_USB_TEST is not set | ||
836 | |||
837 | # | ||
838 | # USB DSL modem support | ||
839 | # | ||
840 | |||
841 | # | ||
842 | # USB Gadget Support | ||
843 | # | ||
844 | CONFIG_USB_GADGET=y | ||
845 | # CONFIG_USB_GADGET_DEBUG_FILES is not set | ||
846 | CONFIG_USB_GADGET_SELECTED=y | ||
847 | # CONFIG_USB_GADGET_NET2280 is not set | ||
848 | # CONFIG_USB_GADGET_PXA2XX is not set | ||
849 | # CONFIG_USB_GADGET_GOKU is not set | ||
850 | # CONFIG_USB_GADGET_LH7A40X is not set | ||
851 | # CONFIG_USB_GADGET_OMAP is not set | ||
852 | CONFIG_USB_GADGET_AT91=y | ||
853 | CONFIG_USB_AT91=y | ||
854 | # CONFIG_USB_GADGET_DUMMY_HCD is not set | ||
855 | # CONFIG_USB_GADGET_DUALSPEED is not set | ||
856 | # CONFIG_USB_ZERO is not set | ||
857 | # CONFIG_USB_ETH is not set | ||
858 | # CONFIG_USB_GADGETFS is not set | ||
859 | # CONFIG_USB_FILE_STORAGE is not set | ||
860 | # CONFIG_USB_G_SERIAL is not set | ||
861 | |||
862 | # | ||
863 | # MMC/SD Card support | ||
864 | # | ||
865 | CONFIG_MMC=y | ||
866 | # CONFIG_MMC_DEBUG is not set | ||
867 | CONFIG_MMC_BLOCK=y | ||
868 | # CONFIG_MMC_WBSD is not set | ||
869 | CONFIG_MMC_AT91RM9200=y | ||
870 | |||
871 | # | ||
872 | # File systems | ||
873 | # | ||
874 | CONFIG_EXT2_FS=y | ||
875 | # CONFIG_EXT2_FS_XATTR is not set | ||
876 | # CONFIG_EXT2_FS_XIP is not set | ||
877 | # CONFIG_EXT3_FS is not set | ||
878 | # CONFIG_JBD is not set | ||
879 | # CONFIG_REISERFS_FS is not set | ||
880 | # CONFIG_JFS_FS is not set | ||
881 | # CONFIG_FS_POSIX_ACL is not set | ||
882 | # CONFIG_XFS_FS is not set | ||
883 | # CONFIG_MINIX_FS is not set | ||
884 | # CONFIG_ROMFS_FS is not set | ||
885 | CONFIG_INOTIFY=y | ||
886 | # CONFIG_QUOTA is not set | ||
887 | CONFIG_DNOTIFY=y | ||
888 | # CONFIG_AUTOFS_FS is not set | ||
889 | # CONFIG_AUTOFS4_FS is not set | ||
890 | # CONFIG_FUSE_FS is not set | ||
891 | |||
892 | # | ||
893 | # CD-ROM/DVD Filesystems | ||
894 | # | ||
895 | # CONFIG_ISO9660_FS is not set | ||
896 | # CONFIG_UDF_FS is not set | ||
897 | |||
898 | # | ||
899 | # DOS/FAT/NT Filesystems | ||
900 | # | ||
901 | # CONFIG_MSDOS_FS is not set | ||
902 | # CONFIG_VFAT_FS is not set | ||
903 | # CONFIG_NTFS_FS is not set | ||
904 | |||
905 | # | ||
906 | # Pseudo filesystems | ||
907 | # | ||
908 | CONFIG_PROC_FS=y | ||
909 | CONFIG_SYSFS=y | ||
910 | CONFIG_TMPFS=y | ||
911 | # CONFIG_HUGETLB_PAGE is not set | ||
912 | CONFIG_RAMFS=y | ||
913 | # CONFIG_RELAYFS_FS is not set | ||
914 | |||
915 | # | ||
916 | # Miscellaneous filesystems | ||
917 | # | ||
918 | # CONFIG_ADFS_FS is not set | ||
919 | # CONFIG_AFFS_FS is not set | ||
920 | # CONFIG_HFS_FS is not set | ||
921 | # CONFIG_HFSPLUS_FS is not set | ||
922 | # CONFIG_BEFS_FS is not set | ||
923 | # CONFIG_BFS_FS is not set | ||
924 | # CONFIG_EFS_FS is not set | ||
925 | # CONFIG_JFFS_FS is not set | ||
926 | # CONFIG_JFFS2_FS is not set | ||
927 | CONFIG_CRAMFS=y | ||
928 | # CONFIG_VXFS_FS is not set | ||
929 | # CONFIG_HPFS_FS is not set | ||
930 | # CONFIG_QNX4FS_FS is not set | ||
931 | # CONFIG_SYSV_FS is not set | ||
932 | # CONFIG_UFS_FS is not set | ||
933 | |||
934 | # | ||
935 | # Network File Systems | ||
936 | # | ||
937 | # CONFIG_NFS_FS is not set | ||
938 | # CONFIG_NFSD is not set | ||
939 | # CONFIG_SMB_FS is not set | ||
940 | # CONFIG_CIFS is not set | ||
941 | # CONFIG_NCP_FS is not set | ||
942 | # CONFIG_CODA_FS is not set | ||
943 | # CONFIG_AFS_FS is not set | ||
944 | # CONFIG_9P_FS is not set | ||
945 | |||
946 | # | ||
947 | # Partition Types | ||
948 | # | ||
949 | # CONFIG_PARTITION_ADVANCED is not set | ||
950 | CONFIG_MSDOS_PARTITION=y | ||
951 | |||
952 | # | ||
953 | # Native Language Support | ||
954 | # | ||
955 | # CONFIG_NLS is not set | ||
956 | |||
957 | # | ||
958 | # Profiling support | ||
959 | # | ||
960 | # CONFIG_PROFILING is not set | ||
961 | |||
962 | # | ||
963 | # Kernel hacking | ||
964 | # | ||
965 | # CONFIG_PRINTK_TIME is not set | ||
966 | CONFIG_DEBUG_KERNEL=y | ||
967 | # CONFIG_MAGIC_SYSRQ is not set | ||
968 | CONFIG_LOG_BUF_SHIFT=14 | ||
969 | CONFIG_DETECT_SOFTLOCKUP=y | ||
970 | # CONFIG_SCHEDSTATS is not set | ||
971 | # CONFIG_DEBUG_SLAB is not set | ||
972 | # CONFIG_DEBUG_SPINLOCK is not set | ||
973 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
974 | # CONFIG_DEBUG_KOBJECT is not set | ||
975 | CONFIG_DEBUG_BUGVERBOSE=y | ||
976 | # CONFIG_DEBUG_INFO is not set | ||
977 | # CONFIG_DEBUG_FS is not set | ||
978 | # CONFIG_DEBUG_VM is not set | ||
979 | CONFIG_FRAME_POINTER=y | ||
980 | # CONFIG_RCU_TORTURE_TEST is not set | ||
981 | CONFIG_DEBUG_USER=y | ||
982 | # CONFIG_DEBUG_WAITQ is not set | ||
983 | # CONFIG_DEBUG_ERRORS is not set | ||
984 | CONFIG_DEBUG_LL=y | ||
985 | # CONFIG_DEBUG_ICEDCC is not set | ||
986 | |||
987 | # | ||
988 | # Security options | ||
989 | # | ||
990 | # CONFIG_KEYS is not set | ||
991 | # CONFIG_SECURITY is not set | ||
992 | |||
993 | # | ||
994 | # Cryptographic options | ||
995 | # | ||
996 | # CONFIG_CRYPTO is not set | ||
997 | |||
998 | # | ||
999 | # Hardware crypto devices | ||
1000 | # | ||
1001 | |||
1002 | # | ||
1003 | # Library routines | ||
1004 | # | ||
1005 | # CONFIG_CRC_CCITT is not set | ||
1006 | # CONFIG_CRC16 is not set | ||
1007 | CONFIG_CRC32=y | ||
1008 | # CONFIG_LIBCRC32C is not set | ||
1009 | CONFIG_ZLIB_INFLATE=y | ||
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig new file mode 100644 index 000000000000..20838ccf1da7 --- /dev/null +++ b/arch/arm/configs/at91rm9200ek_defconfig | |||
@@ -0,0 +1,998 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.15 | ||
4 | # Mon Jan 9 20:57:31 2006 | ||
5 | # | ||
6 | CONFIG_ARM=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_UID16=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
11 | |||
12 | # | ||
13 | # Code maturity level options | ||
14 | # | ||
15 | CONFIG_EXPERIMENTAL=y | ||
16 | CONFIG_CLEAN_COMPILE=y | ||
17 | CONFIG_BROKEN_ON_SMP=y | ||
18 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | ||
24 | # CONFIG_LOCALVERSION_AUTO is not set | ||
25 | # CONFIG_SWAP is not set | ||
26 | CONFIG_SYSVIPC=y | ||
27 | # CONFIG_POSIX_MQUEUE is not set | ||
28 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
29 | CONFIG_SYSCTL=y | ||
30 | # CONFIG_AUDIT is not set | ||
31 | CONFIG_HOTPLUG=y | ||
32 | CONFIG_KOBJECT_UEVENT=y | ||
33 | # CONFIG_IKCONFIG is not set | ||
34 | CONFIG_INITRAMFS_SOURCE="" | ||
35 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
36 | # CONFIG_EMBEDDED is not set | ||
37 | CONFIG_KALLSYMS=y | ||
38 | # CONFIG_KALLSYMS_ALL is not set | ||
39 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | CONFIG_BASE_FULL=y | ||
43 | CONFIG_FUTEX=y | ||
44 | CONFIG_EPOLL=y | ||
45 | CONFIG_SHMEM=y | ||
46 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
47 | CONFIG_CC_ALIGN_LABELS=0 | ||
48 | CONFIG_CC_ALIGN_LOOPS=0 | ||
49 | CONFIG_CC_ALIGN_JUMPS=0 | ||
50 | # CONFIG_TINY_SHMEM is not set | ||
51 | CONFIG_BASE_SMALL=0 | ||
52 | |||
53 | # | ||
54 | # Loadable module support | ||
55 | # | ||
56 | CONFIG_MODULES=y | ||
57 | CONFIG_MODULE_UNLOAD=y | ||
58 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
59 | CONFIG_OBSOLETE_MODPARM=y | ||
60 | # CONFIG_MODVERSIONS is not set | ||
61 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
62 | CONFIG_KMOD=y | ||
63 | |||
64 | # | ||
65 | # Block layer | ||
66 | # | ||
67 | |||
68 | # | ||
69 | # IO Schedulers | ||
70 | # | ||
71 | CONFIG_IOSCHED_NOOP=y | ||
72 | CONFIG_IOSCHED_AS=y | ||
73 | # CONFIG_IOSCHED_DEADLINE is not set | ||
74 | # CONFIG_IOSCHED_CFQ is not set | ||
75 | CONFIG_DEFAULT_AS=y | ||
76 | # CONFIG_DEFAULT_DEADLINE is not set | ||
77 | # CONFIG_DEFAULT_CFQ is not set | ||
78 | # CONFIG_DEFAULT_NOOP is not set | ||
79 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
80 | |||
81 | # | ||
82 | # System Type | ||
83 | # | ||
84 | # CONFIG_ARCH_CLPS7500 is not set | ||
85 | # CONFIG_ARCH_CLPS711X is not set | ||
86 | # CONFIG_ARCH_CO285 is not set | ||
87 | # CONFIG_ARCH_EBSA110 is not set | ||
88 | # CONFIG_ARCH_CAMELOT is not set | ||
89 | # CONFIG_ARCH_FOOTBRIDGE is not set | ||
90 | # CONFIG_ARCH_INTEGRATOR is not set | ||
91 | # CONFIG_ARCH_IOP3XX is not set | ||
92 | # CONFIG_ARCH_IXP4XX is not set | ||
93 | # CONFIG_ARCH_IXP2000 is not set | ||
94 | # CONFIG_ARCH_L7200 is not set | ||
95 | # CONFIG_ARCH_PXA is not set | ||
96 | # CONFIG_ARCH_RPC is not set | ||
97 | # CONFIG_ARCH_SA1100 is not set | ||
98 | # CONFIG_ARCH_S3C2410 is not set | ||
99 | # CONFIG_ARCH_SHARK is not set | ||
100 | # CONFIG_ARCH_LH7A40X is not set | ||
101 | # CONFIG_ARCH_OMAP is not set | ||
102 | # CONFIG_ARCH_VERSATILE is not set | ||
103 | # CONFIG_ARCH_REALVIEW is not set | ||
104 | # CONFIG_ARCH_IMX is not set | ||
105 | # CONFIG_ARCH_H720X is not set | ||
106 | # CONFIG_ARCH_AAEC2000 is not set | ||
107 | CONFIG_ARCH_AT91RM9200=y | ||
108 | |||
109 | # | ||
110 | # AT91RM9200 Implementations | ||
111 | # | ||
112 | |||
113 | # | ||
114 | # AT91RM9200 Board Type | ||
115 | # | ||
116 | # CONFIG_ARCH_AT91RM9200DK is not set | ||
117 | CONFIG_MACH_AT91RM9200EK=y | ||
118 | # CONFIG_MACH_CSB337 is not set | ||
119 | # CONFIG_MACH_CSB637 is not set | ||
120 | # CONFIG_MACH_CARMEVA is not set | ||
121 | # CONFIG_MACH_KB9200 is not set | ||
122 | # CONFIG_MACH_ATEB9200 is not set | ||
123 | |||
124 | # | ||
125 | # AT91RM9200 Feature Selections | ||
126 | # | ||
127 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
128 | |||
129 | # | ||
130 | # Processor Type | ||
131 | # | ||
132 | CONFIG_CPU_32=y | ||
133 | CONFIG_CPU_ARM920T=y | ||
134 | CONFIG_CPU_32v4=y | ||
135 | CONFIG_CPU_ABRT_EV4T=y | ||
136 | CONFIG_CPU_CACHE_V4WT=y | ||
137 | CONFIG_CPU_CACHE_VIVT=y | ||
138 | CONFIG_CPU_COPY_V4WB=y | ||
139 | CONFIG_CPU_TLB_V4WBI=y | ||
140 | |||
141 | # | ||
142 | # Processor Features | ||
143 | # | ||
144 | # CONFIG_ARM_THUMB is not set | ||
145 | # CONFIG_CPU_ICACHE_DISABLE is not set | ||
146 | # CONFIG_CPU_DCACHE_DISABLE is not set | ||
147 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | ||
148 | |||
149 | # | ||
150 | # Bus support | ||
151 | # | ||
152 | CONFIG_ISA_DMA_API=y | ||
153 | |||
154 | # | ||
155 | # PCCARD (PCMCIA/CardBus) support | ||
156 | # | ||
157 | # CONFIG_PCCARD is not set | ||
158 | |||
159 | # | ||
160 | # Kernel Features | ||
161 | # | ||
162 | # CONFIG_PREEMPT is not set | ||
163 | # CONFIG_NO_IDLE_HZ is not set | ||
164 | # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set | ||
165 | CONFIG_SELECT_MEMORY_MODEL=y | ||
166 | CONFIG_FLATMEM_MANUAL=y | ||
167 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
168 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
169 | CONFIG_FLATMEM=y | ||
170 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
171 | # CONFIG_SPARSEMEM_STATIC is not set | ||
172 | CONFIG_SPLIT_PTLOCK_CPUS=4096 | ||
173 | CONFIG_LEDS=y | ||
174 | CONFIG_LEDS_TIMER=y | ||
175 | CONFIG_LEDS_CPU=y | ||
176 | CONFIG_ALIGNMENT_TRAP=y | ||
177 | |||
178 | # | ||
179 | # Boot options | ||
180 | # | ||
181 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
182 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
183 | CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw" | ||
184 | # CONFIG_XIP_KERNEL is not set | ||
185 | |||
186 | # | ||
187 | # Floating point emulation | ||
188 | # | ||
189 | |||
190 | # | ||
191 | # At least one emulation must be selected | ||
192 | # | ||
193 | CONFIG_FPE_NWFPE=y | ||
194 | # CONFIG_FPE_NWFPE_XP is not set | ||
195 | # CONFIG_FPE_FASTFPE is not set | ||
196 | |||
197 | # | ||
198 | # Userspace binary formats | ||
199 | # | ||
200 | CONFIG_BINFMT_ELF=y | ||
201 | # CONFIG_BINFMT_AOUT is not set | ||
202 | # CONFIG_BINFMT_MISC is not set | ||
203 | # CONFIG_ARTHUR is not set | ||
204 | |||
205 | # | ||
206 | # Power management options | ||
207 | # | ||
208 | # CONFIG_PM is not set | ||
209 | |||
210 | # | ||
211 | # Networking | ||
212 | # | ||
213 | CONFIG_NET=y | ||
214 | |||
215 | # | ||
216 | # Networking options | ||
217 | # | ||
218 | CONFIG_PACKET=y | ||
219 | # CONFIG_PACKET_MMAP is not set | ||
220 | CONFIG_UNIX=y | ||
221 | # CONFIG_NET_KEY is not set | ||
222 | CONFIG_INET=y | ||
223 | # CONFIG_IP_MULTICAST is not set | ||
224 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
225 | CONFIG_IP_FIB_HASH=y | ||
226 | CONFIG_IP_PNP=y | ||
227 | # CONFIG_IP_PNP_DHCP is not set | ||
228 | CONFIG_IP_PNP_BOOTP=y | ||
229 | # CONFIG_IP_PNP_RARP is not set | ||
230 | # CONFIG_NET_IPIP is not set | ||
231 | # CONFIG_NET_IPGRE is not set | ||
232 | # CONFIG_ARPD is not set | ||
233 | # CONFIG_SYN_COOKIES is not set | ||
234 | # CONFIG_INET_AH is not set | ||
235 | # CONFIG_INET_ESP is not set | ||
236 | # CONFIG_INET_IPCOMP is not set | ||
237 | # CONFIG_INET_TUNNEL is not set | ||
238 | CONFIG_INET_DIAG=y | ||
239 | CONFIG_INET_TCP_DIAG=y | ||
240 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
241 | CONFIG_TCP_CONG_BIC=y | ||
242 | # CONFIG_IPV6 is not set | ||
243 | # CONFIG_NETFILTER is not set | ||
244 | |||
245 | # | ||
246 | # DCCP Configuration (EXPERIMENTAL) | ||
247 | # | ||
248 | # CONFIG_IP_DCCP is not set | ||
249 | |||
250 | # | ||
251 | # SCTP Configuration (EXPERIMENTAL) | ||
252 | # | ||
253 | # CONFIG_IP_SCTP is not set | ||
254 | # CONFIG_ATM is not set | ||
255 | # CONFIG_BRIDGE is not set | ||
256 | # CONFIG_VLAN_8021Q is not set | ||
257 | # CONFIG_DECNET is not set | ||
258 | # CONFIG_LLC2 is not set | ||
259 | # CONFIG_IPX is not set | ||
260 | # CONFIG_ATALK is not set | ||
261 | # CONFIG_X25 is not set | ||
262 | # CONFIG_LAPB is not set | ||
263 | # CONFIG_NET_DIVERT is not set | ||
264 | # CONFIG_ECONET is not set | ||
265 | # CONFIG_WAN_ROUTER is not set | ||
266 | |||
267 | # | ||
268 | # QoS and/or fair queueing | ||
269 | # | ||
270 | # CONFIG_NET_SCHED is not set | ||
271 | |||
272 | # | ||
273 | # Network testing | ||
274 | # | ||
275 | # CONFIG_NET_PKTGEN is not set | ||
276 | # CONFIG_HAMRADIO is not set | ||
277 | # CONFIG_IRDA is not set | ||
278 | # CONFIG_BT is not set | ||
279 | # CONFIG_IEEE80211 is not set | ||
280 | |||
281 | # | ||
282 | # Device Drivers | ||
283 | # | ||
284 | |||
285 | # | ||
286 | # Generic Driver Options | ||
287 | # | ||
288 | CONFIG_STANDALONE=y | ||
289 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
290 | # CONFIG_FW_LOADER is not set | ||
291 | # CONFIG_DEBUG_DRIVER is not set | ||
292 | |||
293 | # | ||
294 | # Connector - unified userspace <-> kernelspace linker | ||
295 | # | ||
296 | # CONFIG_CONNECTOR is not set | ||
297 | |||
298 | # | ||
299 | # Memory Technology Devices (MTD) | ||
300 | # | ||
301 | CONFIG_MTD=y | ||
302 | # CONFIG_MTD_DEBUG is not set | ||
303 | # CONFIG_MTD_CONCAT is not set | ||
304 | CONFIG_MTD_PARTITIONS=y | ||
305 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
306 | CONFIG_MTD_CMDLINE_PARTS=y | ||
307 | # CONFIG_MTD_AFS_PARTS is not set | ||
308 | |||
309 | # | ||
310 | # User Modules And Translation Layers | ||
311 | # | ||
312 | CONFIG_MTD_CHAR=y | ||
313 | CONFIG_MTD_BLOCK=y | ||
314 | # CONFIG_FTL is not set | ||
315 | # CONFIG_NFTL is not set | ||
316 | # CONFIG_INFTL is not set | ||
317 | # CONFIG_RFD_FTL is not set | ||
318 | |||
319 | # | ||
320 | # RAM/ROM/Flash chip drivers | ||
321 | # | ||
322 | CONFIG_MTD_CFI=y | ||
323 | CONFIG_MTD_JEDECPROBE=y | ||
324 | CONFIG_MTD_GEN_PROBE=y | ||
325 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
326 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
327 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
328 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
329 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
330 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
331 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
332 | CONFIG_MTD_CFI_I1=y | ||
333 | CONFIG_MTD_CFI_I2=y | ||
334 | # CONFIG_MTD_CFI_I4 is not set | ||
335 | # CONFIG_MTD_CFI_I8 is not set | ||
336 | # CONFIG_MTD_CFI_INTELEXT is not set | ||
337 | CONFIG_MTD_CFI_AMDSTD=y | ||
338 | CONFIG_MTD_CFI_AMDSTD_RETRY=0 | ||
339 | # CONFIG_MTD_CFI_STAA is not set | ||
340 | CONFIG_MTD_CFI_UTIL=y | ||
341 | # CONFIG_MTD_RAM is not set | ||
342 | # CONFIG_MTD_ROM is not set | ||
343 | # CONFIG_MTD_ABSENT is not set | ||
344 | # CONFIG_MTD_XIP is not set | ||
345 | |||
346 | # | ||
347 | # Mapping drivers for chip access | ||
348 | # | ||
349 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
350 | CONFIG_MTD_PHYSMAP=y | ||
351 | CONFIG_MTD_PHYSMAP_START=0x10000000 | ||
352 | CONFIG_MTD_PHYSMAP_LEN=0x800000 | ||
353 | CONFIG_MTD_PHYSMAP_BANKWIDTH=2 | ||
354 | # CONFIG_MTD_ARM_INTEGRATOR is not set | ||
355 | # CONFIG_MTD_IMPA7 is not set | ||
356 | # CONFIG_MTD_PLATRAM is not set | ||
357 | |||
358 | # | ||
359 | # Self-contained MTD device drivers | ||
360 | # | ||
361 | # CONFIG_MTD_SLRAM is not set | ||
362 | # CONFIG_MTD_PHRAM is not set | ||
363 | # CONFIG_MTD_MTDRAM is not set | ||
364 | # CONFIG_MTD_BLKMTD is not set | ||
365 | # CONFIG_MTD_BLOCK2MTD is not set | ||
366 | |||
367 | # | ||
368 | # Disk-On-Chip Device Drivers | ||
369 | # | ||
370 | # CONFIG_MTD_DOC2000 is not set | ||
371 | # CONFIG_MTD_DOC2001 is not set | ||
372 | # CONFIG_MTD_DOC2001PLUS is not set | ||
373 | CONFIG_MTD_AT91_DATAFLASH=y | ||
374 | CONFIG_MTD_AT91_DATAFLASH_CARD=y | ||
375 | |||
376 | # | ||
377 | # NAND Flash Device Drivers | ||
378 | # | ||
379 | # CONFIG_MTD_NAND is not set | ||
380 | |||
381 | # | ||
382 | # OneNAND Flash Device Drivers | ||
383 | # | ||
384 | # CONFIG_MTD_ONENAND is not set | ||
385 | |||
386 | # | ||
387 | # Parallel port support | ||
388 | # | ||
389 | # CONFIG_PARPORT is not set | ||
390 | |||
391 | # | ||
392 | # Plug and Play support | ||
393 | # | ||
394 | |||
395 | # | ||
396 | # Block devices | ||
397 | # | ||
398 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
399 | # CONFIG_BLK_DEV_LOOP is not set | ||
400 | # CONFIG_BLK_DEV_NBD is not set | ||
401 | # CONFIG_BLK_DEV_UB is not set | ||
402 | CONFIG_BLK_DEV_RAM=y | ||
403 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
404 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
405 | CONFIG_BLK_DEV_INITRD=y | ||
406 | # CONFIG_CDROM_PKTCDVD is not set | ||
407 | # CONFIG_ATA_OVER_ETH is not set | ||
408 | |||
409 | # | ||
410 | # SCSI device support | ||
411 | # | ||
412 | # CONFIG_RAID_ATTRS is not set | ||
413 | # CONFIG_SCSI is not set | ||
414 | |||
415 | # | ||
416 | # Multi-device support (RAID and LVM) | ||
417 | # | ||
418 | # CONFIG_MD is not set | ||
419 | |||
420 | # | ||
421 | # Fusion MPT device support | ||
422 | # | ||
423 | # CONFIG_FUSION is not set | ||
424 | |||
425 | # | ||
426 | # IEEE 1394 (FireWire) support | ||
427 | # | ||
428 | |||
429 | # | ||
430 | # I2O device support | ||
431 | # | ||
432 | |||
433 | # | ||
434 | # Network device support | ||
435 | # | ||
436 | CONFIG_NETDEVICES=y | ||
437 | # CONFIG_DUMMY is not set | ||
438 | # CONFIG_BONDING is not set | ||
439 | # CONFIG_EQUALIZER is not set | ||
440 | # CONFIG_TUN is not set | ||
441 | |||
442 | # | ||
443 | # PHY device support | ||
444 | # | ||
445 | # CONFIG_PHYLIB is not set | ||
446 | |||
447 | # | ||
448 | # Ethernet (10 or 100Mbit) | ||
449 | # | ||
450 | CONFIG_NET_ETHERNET=y | ||
451 | CONFIG_MII=y | ||
452 | CONFIG_ARM_AT91_ETHER=y | ||
453 | # CONFIG_SMC91X is not set | ||
454 | # CONFIG_DM9000 is not set | ||
455 | |||
456 | # | ||
457 | # Ethernet (1000 Mbit) | ||
458 | # | ||
459 | |||
460 | # | ||
461 | # Ethernet (10000 Mbit) | ||
462 | # | ||
463 | |||
464 | # | ||
465 | # Token Ring devices | ||
466 | # | ||
467 | |||
468 | # | ||
469 | # Wireless LAN (non-hamradio) | ||
470 | # | ||
471 | # CONFIG_NET_RADIO is not set | ||
472 | |||
473 | # | ||
474 | # Wan interfaces | ||
475 | # | ||
476 | # CONFIG_WAN is not set | ||
477 | # CONFIG_PPP is not set | ||
478 | # CONFIG_SLIP is not set | ||
479 | # CONFIG_SHAPER is not set | ||
480 | # CONFIG_NETCONSOLE is not set | ||
481 | # CONFIG_NETPOLL is not set | ||
482 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
483 | |||
484 | # | ||
485 | # ISDN subsystem | ||
486 | # | ||
487 | # CONFIG_ISDN is not set | ||
488 | |||
489 | # | ||
490 | # Input device support | ||
491 | # | ||
492 | CONFIG_INPUT=y | ||
493 | |||
494 | # | ||
495 | # Userland interfaces | ||
496 | # | ||
497 | CONFIG_INPUT_MOUSEDEV=y | ||
498 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | ||
499 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
500 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
501 | # CONFIG_INPUT_JOYDEV is not set | ||
502 | # CONFIG_INPUT_TSDEV is not set | ||
503 | # CONFIG_INPUT_EVDEV is not set | ||
504 | # CONFIG_INPUT_EVBUG is not set | ||
505 | |||
506 | # | ||
507 | # Input Device Drivers | ||
508 | # | ||
509 | # CONFIG_INPUT_KEYBOARD is not set | ||
510 | # CONFIG_INPUT_MOUSE is not set | ||
511 | # CONFIG_INPUT_JOYSTICK is not set | ||
512 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
513 | # CONFIG_INPUT_MISC is not set | ||
514 | |||
515 | # | ||
516 | # Hardware I/O ports | ||
517 | # | ||
518 | # CONFIG_SERIO is not set | ||
519 | # CONFIG_GAMEPORT is not set | ||
520 | |||
521 | # | ||
522 | # Character devices | ||
523 | # | ||
524 | CONFIG_VT=y | ||
525 | CONFIG_VT_CONSOLE=y | ||
526 | CONFIG_HW_CONSOLE=y | ||
527 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
528 | |||
529 | # | ||
530 | # Serial drivers | ||
531 | # | ||
532 | # CONFIG_SERIAL_8250 is not set | ||
533 | |||
534 | # | ||
535 | # Non-8250 serial port support | ||
536 | # | ||
537 | CONFIG_SERIAL_AT91=y | ||
538 | CONFIG_SERIAL_AT91_CONSOLE=y | ||
539 | # CONFIG_SERIAL_AT91_TTYAT is not set | ||
540 | CONFIG_SERIAL_CORE=y | ||
541 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
542 | CONFIG_UNIX98_PTYS=y | ||
543 | CONFIG_LEGACY_PTYS=y | ||
544 | CONFIG_LEGACY_PTY_COUNT=256 | ||
545 | |||
546 | # | ||
547 | # IPMI | ||
548 | # | ||
549 | # CONFIG_IPMI_HANDLER is not set | ||
550 | |||
551 | # | ||
552 | # Watchdog Cards | ||
553 | # | ||
554 | CONFIG_WATCHDOG=y | ||
555 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
556 | |||
557 | # | ||
558 | # Watchdog Device Drivers | ||
559 | # | ||
560 | # CONFIG_SOFT_WATCHDOG is not set | ||
561 | CONFIG_AT91_WATCHDOG=y | ||
562 | |||
563 | # | ||
564 | # USB-based Watchdog Cards | ||
565 | # | ||
566 | # CONFIG_USBPCWATCHDOG is not set | ||
567 | # CONFIG_NVRAM is not set | ||
568 | # CONFIG_RTC is not set | ||
569 | CONFIG_AT91_RTC=y | ||
570 | # CONFIG_DTLK is not set | ||
571 | # CONFIG_R3964 is not set | ||
572 | |||
573 | # | ||
574 | # Ftape, the floppy tape device driver | ||
575 | # | ||
576 | # CONFIG_RAW_DRIVER is not set | ||
577 | |||
578 | # | ||
579 | # TPM devices | ||
580 | # | ||
581 | # CONFIG_TCG_TPM is not set | ||
582 | # CONFIG_TELCLOCK is not set | ||
583 | CONFIG_AT91_SPI=y | ||
584 | CONFIG_AT91_SPIDEV=y | ||
585 | |||
586 | # | ||
587 | # I2C support | ||
588 | # | ||
589 | CONFIG_I2C=y | ||
590 | CONFIG_I2C_CHARDEV=y | ||
591 | |||
592 | # | ||
593 | # I2C Algorithms | ||
594 | # | ||
595 | # CONFIG_I2C_ALGOBIT is not set | ||
596 | # CONFIG_I2C_ALGOPCF is not set | ||
597 | # CONFIG_I2C_ALGOPCA is not set | ||
598 | |||
599 | # | ||
600 | # I2C Hardware Bus support | ||
601 | # | ||
602 | CONFIG_I2C_AT91=y | ||
603 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
604 | # CONFIG_I2C_STUB is not set | ||
605 | # CONFIG_I2C_PCA_ISA is not set | ||
606 | |||
607 | # | ||
608 | # Miscellaneous I2C Chip support | ||
609 | # | ||
610 | # CONFIG_SENSORS_DS1337 is not set | ||
611 | # CONFIG_SENSORS_DS1374 is not set | ||
612 | # CONFIG_SENSORS_EEPROM is not set | ||
613 | # CONFIG_SENSORS_PCF8574 is not set | ||
614 | # CONFIG_SENSORS_PCA9539 is not set | ||
615 | # CONFIG_SENSORS_PCF8591 is not set | ||
616 | # CONFIG_SENSORS_RTC8564 is not set | ||
617 | # CONFIG_SENSORS_MAX6875 is not set | ||
618 | # CONFIG_RTC_X1205_I2C is not set | ||
619 | # CONFIG_I2C_DEBUG_CORE is not set | ||
620 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
621 | # CONFIG_I2C_DEBUG_BUS is not set | ||
622 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
623 | |||
624 | # | ||
625 | # Hardware Monitoring support | ||
626 | # | ||
627 | CONFIG_HWMON=y | ||
628 | # CONFIG_HWMON_VID is not set | ||
629 | # CONFIG_SENSORS_ADM1021 is not set | ||
630 | # CONFIG_SENSORS_ADM1025 is not set | ||
631 | # CONFIG_SENSORS_ADM1026 is not set | ||
632 | # CONFIG_SENSORS_ADM1031 is not set | ||
633 | # CONFIG_SENSORS_ADM9240 is not set | ||
634 | # CONFIG_SENSORS_ASB100 is not set | ||
635 | # CONFIG_SENSORS_ATXP1 is not set | ||
636 | # CONFIG_SENSORS_DS1621 is not set | ||
637 | # CONFIG_SENSORS_FSCHER is not set | ||
638 | # CONFIG_SENSORS_FSCPOS is not set | ||
639 | # CONFIG_SENSORS_GL518SM is not set | ||
640 | # CONFIG_SENSORS_GL520SM is not set | ||
641 | # CONFIG_SENSORS_IT87 is not set | ||
642 | # CONFIG_SENSORS_LM63 is not set | ||
643 | # CONFIG_SENSORS_LM75 is not set | ||
644 | # CONFIG_SENSORS_LM77 is not set | ||
645 | # CONFIG_SENSORS_LM78 is not set | ||
646 | # CONFIG_SENSORS_LM80 is not set | ||
647 | # CONFIG_SENSORS_LM83 is not set | ||
648 | # CONFIG_SENSORS_LM85 is not set | ||
649 | # CONFIG_SENSORS_LM87 is not set | ||
650 | # CONFIG_SENSORS_LM90 is not set | ||
651 | # CONFIG_SENSORS_LM92 is not set | ||
652 | # CONFIG_SENSORS_MAX1619 is not set | ||
653 | # CONFIG_SENSORS_PC87360 is not set | ||
654 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
655 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
656 | # CONFIG_SENSORS_W83781D is not set | ||
657 | # CONFIG_SENSORS_W83792D is not set | ||
658 | # CONFIG_SENSORS_W83L785TS is not set | ||
659 | # CONFIG_SENSORS_W83627HF is not set | ||
660 | # CONFIG_SENSORS_W83627EHF is not set | ||
661 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
662 | |||
663 | # | ||
664 | # Misc devices | ||
665 | # | ||
666 | |||
667 | # | ||
668 | # Multimedia Capabilities Port drivers | ||
669 | # | ||
670 | |||
671 | # | ||
672 | # Multimedia devices | ||
673 | # | ||
674 | # CONFIG_VIDEO_DEV is not set | ||
675 | |||
676 | # | ||
677 | # Digital Video Broadcasting Devices | ||
678 | # | ||
679 | # CONFIG_DVB is not set | ||
680 | |||
681 | # | ||
682 | # Graphics support | ||
683 | # | ||
684 | CONFIG_FB=y | ||
685 | CONFIG_FB_CFB_FILLRECT=y | ||
686 | CONFIG_FB_CFB_COPYAREA=y | ||
687 | CONFIG_FB_CFB_IMAGEBLIT=y | ||
688 | # CONFIG_FB_MACMODES is not set | ||
689 | # CONFIG_FB_MODE_HELPERS is not set | ||
690 | # CONFIG_FB_TILEBLITTING is not set | ||
691 | CONFIG_FB_S1D13XXX=y | ||
692 | # CONFIG_FB_VIRTUAL is not set | ||
693 | |||
694 | # | ||
695 | # Console display driver support | ||
696 | # | ||
697 | # CONFIG_VGA_CONSOLE is not set | ||
698 | CONFIG_DUMMY_CONSOLE=y | ||
699 | # CONFIG_FRAMEBUFFER_CONSOLE is not set | ||
700 | |||
701 | # | ||
702 | # Logo configuration | ||
703 | # | ||
704 | # CONFIG_LOGO is not set | ||
705 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
706 | |||
707 | # | ||
708 | # Sound | ||
709 | # | ||
710 | # CONFIG_SOUND is not set | ||
711 | |||
712 | # | ||
713 | # USB support | ||
714 | # | ||
715 | CONFIG_USB_ARCH_HAS_HCD=y | ||
716 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
717 | CONFIG_USB=y | ||
718 | CONFIG_USB_DEBUG=y | ||
719 | |||
720 | # | ||
721 | # Miscellaneous USB options | ||
722 | # | ||
723 | CONFIG_USB_DEVICEFS=y | ||
724 | # CONFIG_USB_BANDWIDTH is not set | ||
725 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
726 | # CONFIG_USB_OTG is not set | ||
727 | |||
728 | # | ||
729 | # USB Host Controller Drivers | ||
730 | # | ||
731 | # CONFIG_USB_ISP116X_HCD is not set | ||
732 | CONFIG_USB_OHCI_HCD=y | ||
733 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | ||
734 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
735 | # CONFIG_USB_SL811_HCD is not set | ||
736 | |||
737 | # | ||
738 | # USB Device Class drivers | ||
739 | # | ||
740 | # CONFIG_USB_ACM is not set | ||
741 | # CONFIG_USB_PRINTER is not set | ||
742 | |||
743 | # | ||
744 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | ||
745 | # | ||
746 | |||
747 | # | ||
748 | # may also be needed; see USB_STORAGE Help for more information | ||
749 | # | ||
750 | # CONFIG_USB_STORAGE is not set | ||
751 | |||
752 | # | ||
753 | # USB Input Devices | ||
754 | # | ||
755 | # CONFIG_USB_HID is not set | ||
756 | |||
757 | # | ||
758 | # USB HID Boot Protocol drivers | ||
759 | # | ||
760 | # CONFIG_USB_KBD is not set | ||
761 | # CONFIG_USB_MOUSE is not set | ||
762 | # CONFIG_USB_AIPTEK is not set | ||
763 | # CONFIG_USB_WACOM is not set | ||
764 | # CONFIG_USB_ACECAD is not set | ||
765 | # CONFIG_USB_KBTAB is not set | ||
766 | # CONFIG_USB_POWERMATE is not set | ||
767 | # CONFIG_USB_MTOUCH is not set | ||
768 | # CONFIG_USB_ITMTOUCH is not set | ||
769 | # CONFIG_USB_EGALAX is not set | ||
770 | # CONFIG_USB_YEALINK is not set | ||
771 | # CONFIG_USB_XPAD is not set | ||
772 | # CONFIG_USB_ATI_REMOTE is not set | ||
773 | # CONFIG_USB_KEYSPAN_REMOTE is not set | ||
774 | # CONFIG_USB_APPLETOUCH is not set | ||
775 | |||
776 | # | ||
777 | # USB Imaging devices | ||
778 | # | ||
779 | # CONFIG_USB_MDC800 is not set | ||
780 | |||
781 | # | ||
782 | # USB Multimedia devices | ||
783 | # | ||
784 | # CONFIG_USB_DABUSB is not set | ||
785 | |||
786 | # | ||
787 | # Video4Linux support is needed for USB Multimedia device support | ||
788 | # | ||
789 | |||
790 | # | ||
791 | # USB Network Adapters | ||
792 | # | ||
793 | # CONFIG_USB_CATC is not set | ||
794 | # CONFIG_USB_KAWETH is not set | ||
795 | # CONFIG_USB_PEGASUS is not set | ||
796 | # CONFIG_USB_RTL8150 is not set | ||
797 | # CONFIG_USB_USBNET is not set | ||
798 | CONFIG_USB_MON=y | ||
799 | |||
800 | # | ||
801 | # USB port drivers | ||
802 | # | ||
803 | |||
804 | # | ||
805 | # USB Serial Converter support | ||
806 | # | ||
807 | # CONFIG_USB_SERIAL is not set | ||
808 | |||
809 | # | ||
810 | # USB Miscellaneous drivers | ||
811 | # | ||
812 | # CONFIG_USB_EMI62 is not set | ||
813 | # CONFIG_USB_EMI26 is not set | ||
814 | # CONFIG_USB_AUERSWALD is not set | ||
815 | # CONFIG_USB_RIO500 is not set | ||
816 | # CONFIG_USB_LEGOTOWER is not set | ||
817 | # CONFIG_USB_LCD is not set | ||
818 | # CONFIG_USB_LED is not set | ||
819 | # CONFIG_USB_CYTHERM is not set | ||
820 | # CONFIG_USB_PHIDGETKIT is not set | ||
821 | # CONFIG_USB_PHIDGETSERVO is not set | ||
822 | # CONFIG_USB_IDMOUSE is not set | ||
823 | # CONFIG_USB_LD is not set | ||
824 | # CONFIG_USB_TEST is not set | ||
825 | |||
826 | # | ||
827 | # USB DSL modem support | ||
828 | # | ||
829 | |||
830 | # | ||
831 | # USB Gadget Support | ||
832 | # | ||
833 | CONFIG_USB_GADGET=y | ||
834 | # CONFIG_USB_GADGET_DEBUG_FILES is not set | ||
835 | CONFIG_USB_GADGET_SELECTED=y | ||
836 | # CONFIG_USB_GADGET_NET2280 is not set | ||
837 | # CONFIG_USB_GADGET_PXA2XX is not set | ||
838 | # CONFIG_USB_GADGET_GOKU is not set | ||
839 | # CONFIG_USB_GADGET_LH7A40X is not set | ||
840 | # CONFIG_USB_GADGET_OMAP is not set | ||
841 | CONFIG_USB_GADGET_AT91=y | ||
842 | CONFIG_USB_AT91=y | ||
843 | # CONFIG_USB_GADGET_DUMMY_HCD is not set | ||
844 | # CONFIG_USB_GADGET_DUALSPEED is not set | ||
845 | # CONFIG_USB_ZERO is not set | ||
846 | # CONFIG_USB_ETH is not set | ||
847 | # CONFIG_USB_GADGETFS is not set | ||
848 | # CONFIG_USB_FILE_STORAGE is not set | ||
849 | # CONFIG_USB_G_SERIAL is not set | ||
850 | |||
851 | # | ||
852 | # MMC/SD Card support | ||
853 | # | ||
854 | CONFIG_MMC=y | ||
855 | # CONFIG_MMC_DEBUG is not set | ||
856 | CONFIG_MMC_BLOCK=y | ||
857 | # CONFIG_MMC_WBSD is not set | ||
858 | CONFIG_MMC_AT91RM9200=y | ||
859 | |||
860 | # | ||
861 | # File systems | ||
862 | # | ||
863 | CONFIG_EXT2_FS=y | ||
864 | # CONFIG_EXT2_FS_XATTR is not set | ||
865 | # CONFIG_EXT2_FS_XIP is not set | ||
866 | # CONFIG_EXT3_FS is not set | ||
867 | # CONFIG_JBD is not set | ||
868 | # CONFIG_REISERFS_FS is not set | ||
869 | # CONFIG_JFS_FS is not set | ||
870 | # CONFIG_FS_POSIX_ACL is not set | ||
871 | # CONFIG_XFS_FS is not set | ||
872 | # CONFIG_MINIX_FS is not set | ||
873 | # CONFIG_ROMFS_FS is not set | ||
874 | CONFIG_INOTIFY=y | ||
875 | # CONFIG_QUOTA is not set | ||
876 | CONFIG_DNOTIFY=y | ||
877 | # CONFIG_AUTOFS_FS is not set | ||
878 | # CONFIG_AUTOFS4_FS is not set | ||
879 | # CONFIG_FUSE_FS is not set | ||
880 | |||
881 | # | ||
882 | # CD-ROM/DVD Filesystems | ||
883 | # | ||
884 | # CONFIG_ISO9660_FS is not set | ||
885 | # CONFIG_UDF_FS is not set | ||
886 | |||
887 | # | ||
888 | # DOS/FAT/NT Filesystems | ||
889 | # | ||
890 | # CONFIG_MSDOS_FS is not set | ||
891 | # CONFIG_VFAT_FS is not set | ||
892 | # CONFIG_NTFS_FS is not set | ||
893 | |||
894 | # | ||
895 | # Pseudo filesystems | ||
896 | # | ||
897 | CONFIG_PROC_FS=y | ||
898 | CONFIG_SYSFS=y | ||
899 | CONFIG_TMPFS=y | ||
900 | # CONFIG_HUGETLB_PAGE is not set | ||
901 | CONFIG_RAMFS=y | ||
902 | # CONFIG_RELAYFS_FS is not set | ||
903 | |||
904 | # | ||
905 | # Miscellaneous filesystems | ||
906 | # | ||
907 | # CONFIG_ADFS_FS is not set | ||
908 | # CONFIG_AFFS_FS is not set | ||
909 | # CONFIG_HFS_FS is not set | ||
910 | # CONFIG_HFSPLUS_FS is not set | ||
911 | # CONFIG_BEFS_FS is not set | ||
912 | # CONFIG_BFS_FS is not set | ||
913 | # CONFIG_EFS_FS is not set | ||
914 | # CONFIG_JFFS_FS is not set | ||
915 | # CONFIG_JFFS2_FS is not set | ||
916 | CONFIG_CRAMFS=y | ||
917 | # CONFIG_VXFS_FS is not set | ||
918 | # CONFIG_HPFS_FS is not set | ||
919 | # CONFIG_QNX4FS_FS is not set | ||
920 | # CONFIG_SYSV_FS is not set | ||
921 | # CONFIG_UFS_FS is not set | ||
922 | |||
923 | # | ||
924 | # Network File Systems | ||
925 | # | ||
926 | # CONFIG_NFS_FS is not set | ||
927 | # CONFIG_NFSD is not set | ||
928 | # CONFIG_SMB_FS is not set | ||
929 | # CONFIG_CIFS is not set | ||
930 | # CONFIG_NCP_FS is not set | ||
931 | # CONFIG_CODA_FS is not set | ||
932 | # CONFIG_AFS_FS is not set | ||
933 | # CONFIG_9P_FS is not set | ||
934 | |||
935 | # | ||
936 | # Partition Types | ||
937 | # | ||
938 | # CONFIG_PARTITION_ADVANCED is not set | ||
939 | CONFIG_MSDOS_PARTITION=y | ||
940 | |||
941 | # | ||
942 | # Native Language Support | ||
943 | # | ||
944 | # CONFIG_NLS is not set | ||
945 | |||
946 | # | ||
947 | # Profiling support | ||
948 | # | ||
949 | # CONFIG_PROFILING is not set | ||
950 | |||
951 | # | ||
952 | # Kernel hacking | ||
953 | # | ||
954 | # CONFIG_PRINTK_TIME is not set | ||
955 | CONFIG_DEBUG_KERNEL=y | ||
956 | # CONFIG_MAGIC_SYSRQ is not set | ||
957 | CONFIG_LOG_BUF_SHIFT=14 | ||
958 | CONFIG_DETECT_SOFTLOCKUP=y | ||
959 | # CONFIG_SCHEDSTATS is not set | ||
960 | # CONFIG_DEBUG_SLAB is not set | ||
961 | # CONFIG_DEBUG_SPINLOCK is not set | ||
962 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
963 | # CONFIG_DEBUG_KOBJECT is not set | ||
964 | CONFIG_DEBUG_BUGVERBOSE=y | ||
965 | # CONFIG_DEBUG_INFO is not set | ||
966 | # CONFIG_DEBUG_FS is not set | ||
967 | # CONFIG_DEBUG_VM is not set | ||
968 | CONFIG_FRAME_POINTER=y | ||
969 | # CONFIG_RCU_TORTURE_TEST is not set | ||
970 | CONFIG_DEBUG_USER=y | ||
971 | # CONFIG_DEBUG_WAITQ is not set | ||
972 | # CONFIG_DEBUG_ERRORS is not set | ||
973 | CONFIG_DEBUG_LL=y | ||
974 | # CONFIG_DEBUG_ICEDCC is not set | ||
975 | |||
976 | # | ||
977 | # Security options | ||
978 | # | ||
979 | # CONFIG_KEYS is not set | ||
980 | # CONFIG_SECURITY is not set | ||
981 | |||
982 | # | ||
983 | # Cryptographic options | ||
984 | # | ||
985 | # CONFIG_CRYPTO is not set | ||
986 | |||
987 | # | ||
988 | # Hardware crypto devices | ||
989 | # | ||
990 | |||
991 | # | ||
992 | # Library routines | ||
993 | # | ||
994 | # CONFIG_CRC_CCITT is not set | ||
995 | # CONFIG_CRC16 is not set | ||
996 | CONFIG_CRC32=y | ||
997 | # CONFIG_LIBCRC32C is not set | ||
998 | CONFIG_ZLIB_INFLATE=y | ||
diff --git a/arch/arm/configs/csb337_defconfig b/arch/arm/configs/csb337_defconfig new file mode 100644 index 000000000000..885a3184830a --- /dev/null +++ b/arch/arm/configs/csb337_defconfig | |||
@@ -0,0 +1,1136 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.15 | ||
4 | # Mon Jan 9 21:51:31 2006 | ||
5 | # | ||
6 | CONFIG_ARM=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_UID16=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
11 | |||
12 | # | ||
13 | # Code maturity level options | ||
14 | # | ||
15 | CONFIG_EXPERIMENTAL=y | ||
16 | CONFIG_CLEAN_COMPILE=y | ||
17 | CONFIG_BROKEN_ON_SMP=y | ||
18 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | ||
24 | CONFIG_LOCALVERSION_AUTO=y | ||
25 | # CONFIG_SWAP is not set | ||
26 | CONFIG_SYSVIPC=y | ||
27 | # CONFIG_POSIX_MQUEUE is not set | ||
28 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
29 | CONFIG_SYSCTL=y | ||
30 | # CONFIG_AUDIT is not set | ||
31 | CONFIG_HOTPLUG=y | ||
32 | CONFIG_KOBJECT_UEVENT=y | ||
33 | # CONFIG_IKCONFIG is not set | ||
34 | CONFIG_INITRAMFS_SOURCE="" | ||
35 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
36 | # CONFIG_EMBEDDED is not set | ||
37 | CONFIG_KALLSYMS=y | ||
38 | # CONFIG_KALLSYMS_ALL is not set | ||
39 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | CONFIG_BASE_FULL=y | ||
43 | CONFIG_FUTEX=y | ||
44 | CONFIG_EPOLL=y | ||
45 | CONFIG_SHMEM=y | ||
46 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
47 | CONFIG_CC_ALIGN_LABELS=0 | ||
48 | CONFIG_CC_ALIGN_LOOPS=0 | ||
49 | CONFIG_CC_ALIGN_JUMPS=0 | ||
50 | # CONFIG_TINY_SHMEM is not set | ||
51 | CONFIG_BASE_SMALL=0 | ||
52 | |||
53 | # | ||
54 | # Loadable module support | ||
55 | # | ||
56 | CONFIG_MODULES=y | ||
57 | CONFIG_MODULE_UNLOAD=y | ||
58 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
59 | CONFIG_OBSOLETE_MODPARM=y | ||
60 | # CONFIG_MODVERSIONS is not set | ||
61 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
62 | CONFIG_KMOD=y | ||
63 | |||
64 | # | ||
65 | # Block layer | ||
66 | # | ||
67 | |||
68 | # | ||
69 | # IO Schedulers | ||
70 | # | ||
71 | CONFIG_IOSCHED_NOOP=y | ||
72 | CONFIG_IOSCHED_AS=y | ||
73 | CONFIG_IOSCHED_DEADLINE=y | ||
74 | CONFIG_IOSCHED_CFQ=y | ||
75 | CONFIG_DEFAULT_AS=y | ||
76 | # CONFIG_DEFAULT_DEADLINE is not set | ||
77 | # CONFIG_DEFAULT_CFQ is not set | ||
78 | # CONFIG_DEFAULT_NOOP is not set | ||
79 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
80 | |||
81 | # | ||
82 | # System Type | ||
83 | # | ||
84 | # CONFIG_ARCH_CLPS7500 is not set | ||
85 | # CONFIG_ARCH_CLPS711X is not set | ||
86 | # CONFIG_ARCH_CO285 is not set | ||
87 | # CONFIG_ARCH_EBSA110 is not set | ||
88 | # CONFIG_ARCH_CAMELOT is not set | ||
89 | # CONFIG_ARCH_FOOTBRIDGE is not set | ||
90 | # CONFIG_ARCH_INTEGRATOR is not set | ||
91 | # CONFIG_ARCH_IOP3XX is not set | ||
92 | # CONFIG_ARCH_IXP4XX is not set | ||
93 | # CONFIG_ARCH_IXP2000 is not set | ||
94 | # CONFIG_ARCH_L7200 is not set | ||
95 | # CONFIG_ARCH_PXA is not set | ||
96 | # CONFIG_ARCH_RPC is not set | ||
97 | # CONFIG_ARCH_SA1100 is not set | ||
98 | # CONFIG_ARCH_S3C2410 is not set | ||
99 | # CONFIG_ARCH_SHARK is not set | ||
100 | # CONFIG_ARCH_LH7A40X is not set | ||
101 | # CONFIG_ARCH_OMAP is not set | ||
102 | # CONFIG_ARCH_VERSATILE is not set | ||
103 | # CONFIG_ARCH_REALVIEW is not set | ||
104 | # CONFIG_ARCH_IMX is not set | ||
105 | # CONFIG_ARCH_H720X is not set | ||
106 | # CONFIG_ARCH_AAEC2000 is not set | ||
107 | CONFIG_ARCH_AT91RM9200=y | ||
108 | |||
109 | # | ||
110 | # AT91RM9200 Implementations | ||
111 | # | ||
112 | |||
113 | # | ||
114 | # AT91RM9200 Board Type | ||
115 | # | ||
116 | # CONFIG_ARCH_AT91RM9200DK is not set | ||
117 | # CONFIG_MACH_AT91RM9200EK is not set | ||
118 | CONFIG_MACH_CSB337=y | ||
119 | # CONFIG_MACH_CSB637 is not set | ||
120 | # CONFIG_MACH_CARMEVA is not set | ||
121 | # CONFIG_MACH_KB9200 is not set | ||
122 | # CONFIG_MACH_ATEB9200 is not set | ||
123 | |||
124 | # | ||
125 | # AT91RM9200 Feature Selections | ||
126 | # | ||
127 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
128 | |||
129 | # | ||
130 | # Processor Type | ||
131 | # | ||
132 | CONFIG_CPU_32=y | ||
133 | CONFIG_CPU_ARM920T=y | ||
134 | CONFIG_CPU_32v4=y | ||
135 | CONFIG_CPU_ABRT_EV4T=y | ||
136 | CONFIG_CPU_CACHE_V4WT=y | ||
137 | CONFIG_CPU_CACHE_VIVT=y | ||
138 | CONFIG_CPU_COPY_V4WB=y | ||
139 | CONFIG_CPU_TLB_V4WBI=y | ||
140 | |||
141 | # | ||
142 | # Processor Features | ||
143 | # | ||
144 | # CONFIG_ARM_THUMB is not set | ||
145 | # CONFIG_CPU_ICACHE_DISABLE is not set | ||
146 | # CONFIG_CPU_DCACHE_DISABLE is not set | ||
147 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | ||
148 | |||
149 | # | ||
150 | # Bus support | ||
151 | # | ||
152 | CONFIG_ISA_DMA_API=y | ||
153 | |||
154 | # | ||
155 | # PCCARD (PCMCIA/CardBus) support | ||
156 | # | ||
157 | CONFIG_PCCARD=y | ||
158 | # CONFIG_PCMCIA_DEBUG is not set | ||
159 | CONFIG_PCMCIA=y | ||
160 | CONFIG_PCMCIA_LOAD_CIS=y | ||
161 | CONFIG_PCMCIA_IOCTL=y | ||
162 | |||
163 | # | ||
164 | # PC-card bridges | ||
165 | # | ||
166 | CONFIG_AT91_CF=y | ||
167 | |||
168 | # | ||
169 | # Kernel Features | ||
170 | # | ||
171 | # CONFIG_PREEMPT is not set | ||
172 | # CONFIG_NO_IDLE_HZ is not set | ||
173 | # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set | ||
174 | CONFIG_SELECT_MEMORY_MODEL=y | ||
175 | CONFIG_FLATMEM_MANUAL=y | ||
176 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
177 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
178 | CONFIG_FLATMEM=y | ||
179 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
180 | # CONFIG_SPARSEMEM_STATIC is not set | ||
181 | CONFIG_SPLIT_PTLOCK_CPUS=4096 | ||
182 | CONFIG_LEDS=y | ||
183 | CONFIG_LEDS_TIMER=y | ||
184 | CONFIG_LEDS_CPU=y | ||
185 | CONFIG_ALIGNMENT_TRAP=y | ||
186 | |||
187 | # | ||
188 | # Boot options | ||
189 | # | ||
190 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
191 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
192 | CONFIG_CMDLINE="mem=32M console=ttyS0,38400 initrd=0x20410000,3145728 root=/dev/ram0 rw" | ||
193 | # CONFIG_XIP_KERNEL is not set | ||
194 | |||
195 | # | ||
196 | # Floating point emulation | ||
197 | # | ||
198 | |||
199 | # | ||
200 | # At least one emulation must be selected | ||
201 | # | ||
202 | CONFIG_FPE_NWFPE=y | ||
203 | # CONFIG_FPE_NWFPE_XP is not set | ||
204 | # CONFIG_FPE_FASTFPE is not set | ||
205 | |||
206 | # | ||
207 | # Userspace binary formats | ||
208 | # | ||
209 | CONFIG_BINFMT_ELF=y | ||
210 | # CONFIG_BINFMT_AOUT is not set | ||
211 | # CONFIG_BINFMT_MISC is not set | ||
212 | # CONFIG_ARTHUR is not set | ||
213 | |||
214 | # | ||
215 | # Power management options | ||
216 | # | ||
217 | # CONFIG_PM is not set | ||
218 | |||
219 | # | ||
220 | # Networking | ||
221 | # | ||
222 | CONFIG_NET=y | ||
223 | |||
224 | # | ||
225 | # Networking options | ||
226 | # | ||
227 | CONFIG_PACKET=y | ||
228 | # CONFIG_PACKET_MMAP is not set | ||
229 | CONFIG_UNIX=y | ||
230 | # CONFIG_NET_KEY is not set | ||
231 | CONFIG_INET=y | ||
232 | # CONFIG_IP_MULTICAST is not set | ||
233 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
234 | CONFIG_IP_FIB_HASH=y | ||
235 | CONFIG_IP_PNP=y | ||
236 | CONFIG_IP_PNP_DHCP=y | ||
237 | CONFIG_IP_PNP_BOOTP=y | ||
238 | # CONFIG_IP_PNP_RARP is not set | ||
239 | # CONFIG_NET_IPIP is not set | ||
240 | # CONFIG_NET_IPGRE is not set | ||
241 | # CONFIG_ARPD is not set | ||
242 | # CONFIG_SYN_COOKIES is not set | ||
243 | # CONFIG_INET_AH is not set | ||
244 | # CONFIG_INET_ESP is not set | ||
245 | # CONFIG_INET_IPCOMP is not set | ||
246 | # CONFIG_INET_TUNNEL is not set | ||
247 | CONFIG_INET_DIAG=y | ||
248 | CONFIG_INET_TCP_DIAG=y | ||
249 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
250 | CONFIG_TCP_CONG_BIC=y | ||
251 | # CONFIG_IPV6 is not set | ||
252 | # CONFIG_NETFILTER is not set | ||
253 | |||
254 | # | ||
255 | # DCCP Configuration (EXPERIMENTAL) | ||
256 | # | ||
257 | # CONFIG_IP_DCCP is not set | ||
258 | |||
259 | # | ||
260 | # SCTP Configuration (EXPERIMENTAL) | ||
261 | # | ||
262 | # CONFIG_IP_SCTP is not set | ||
263 | # CONFIG_ATM is not set | ||
264 | # CONFIG_BRIDGE is not set | ||
265 | # CONFIG_VLAN_8021Q is not set | ||
266 | # CONFIG_DECNET is not set | ||
267 | # CONFIG_LLC2 is not set | ||
268 | # CONFIG_IPX is not set | ||
269 | # CONFIG_ATALK is not set | ||
270 | # CONFIG_X25 is not set | ||
271 | # CONFIG_LAPB is not set | ||
272 | # CONFIG_NET_DIVERT is not set | ||
273 | # CONFIG_ECONET is not set | ||
274 | # CONFIG_WAN_ROUTER is not set | ||
275 | |||
276 | # | ||
277 | # QoS and/or fair queueing | ||
278 | # | ||
279 | # CONFIG_NET_SCHED is not set | ||
280 | |||
281 | # | ||
282 | # Network testing | ||
283 | # | ||
284 | # CONFIG_NET_PKTGEN is not set | ||
285 | # CONFIG_HAMRADIO is not set | ||
286 | # CONFIG_IRDA is not set | ||
287 | # CONFIG_BT is not set | ||
288 | # CONFIG_IEEE80211 is not set | ||
289 | |||
290 | # | ||
291 | # Device Drivers | ||
292 | # | ||
293 | |||
294 | # | ||
295 | # Generic Driver Options | ||
296 | # | ||
297 | CONFIG_STANDALONE=y | ||
298 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
299 | CONFIG_FW_LOADER=y | ||
300 | # CONFIG_DEBUG_DRIVER is not set | ||
301 | |||
302 | # | ||
303 | # Connector - unified userspace <-> kernelspace linker | ||
304 | # | ||
305 | # CONFIG_CONNECTOR is not set | ||
306 | |||
307 | # | ||
308 | # Memory Technology Devices (MTD) | ||
309 | # | ||
310 | CONFIG_MTD=y | ||
311 | # CONFIG_MTD_DEBUG is not set | ||
312 | # CONFIG_MTD_CONCAT is not set | ||
313 | CONFIG_MTD_PARTITIONS=y | ||
314 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
315 | CONFIG_MTD_CMDLINE_PARTS=y | ||
316 | # CONFIG_MTD_AFS_PARTS is not set | ||
317 | |||
318 | # | ||
319 | # User Modules And Translation Layers | ||
320 | # | ||
321 | CONFIG_MTD_CHAR=y | ||
322 | CONFIG_MTD_BLOCK=y | ||
323 | # CONFIG_FTL is not set | ||
324 | # CONFIG_NFTL is not set | ||
325 | # CONFIG_INFTL is not set | ||
326 | # CONFIG_RFD_FTL is not set | ||
327 | |||
328 | # | ||
329 | # RAM/ROM/Flash chip drivers | ||
330 | # | ||
331 | CONFIG_MTD_CFI=y | ||
332 | # CONFIG_MTD_JEDECPROBE is not set | ||
333 | CONFIG_MTD_GEN_PROBE=y | ||
334 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
335 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
336 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
337 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
338 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
339 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
340 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
341 | CONFIG_MTD_CFI_I1=y | ||
342 | CONFIG_MTD_CFI_I2=y | ||
343 | # CONFIG_MTD_CFI_I4 is not set | ||
344 | # CONFIG_MTD_CFI_I8 is not set | ||
345 | CONFIG_MTD_CFI_INTELEXT=y | ||
346 | # CONFIG_MTD_CFI_AMDSTD is not set | ||
347 | # CONFIG_MTD_CFI_STAA is not set | ||
348 | CONFIG_MTD_CFI_UTIL=y | ||
349 | # CONFIG_MTD_RAM is not set | ||
350 | # CONFIG_MTD_ROM is not set | ||
351 | # CONFIG_MTD_ABSENT is not set | ||
352 | # CONFIG_MTD_XIP is not set | ||
353 | |||
354 | # | ||
355 | # Mapping drivers for chip access | ||
356 | # | ||
357 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
358 | # CONFIG_MTD_PHYSMAP is not set | ||
359 | # CONFIG_MTD_ARM_INTEGRATOR is not set | ||
360 | # CONFIG_MTD_PLATRAM is not set | ||
361 | CONFIG_MTD_CSB337=y | ||
362 | |||
363 | # | ||
364 | # Self-contained MTD device drivers | ||
365 | # | ||
366 | # CONFIG_MTD_SLRAM is not set | ||
367 | # CONFIG_MTD_PHRAM is not set | ||
368 | # CONFIG_MTD_MTDRAM is not set | ||
369 | # CONFIG_MTD_BLKMTD is not set | ||
370 | # CONFIG_MTD_BLOCK2MTD is not set | ||
371 | |||
372 | # | ||
373 | # Disk-On-Chip Device Drivers | ||
374 | # | ||
375 | # CONFIG_MTD_DOC2000 is not set | ||
376 | # CONFIG_MTD_DOC2001 is not set | ||
377 | # CONFIG_MTD_DOC2001PLUS is not set | ||
378 | # CONFIG_MTD_AT91_DATAFLASH is not set | ||
379 | |||
380 | # | ||
381 | # NAND Flash Device Drivers | ||
382 | # | ||
383 | # CONFIG_MTD_NAND is not set | ||
384 | |||
385 | # | ||
386 | # OneNAND Flash Device Drivers | ||
387 | # | ||
388 | # CONFIG_MTD_ONENAND is not set | ||
389 | |||
390 | # | ||
391 | # Parallel port support | ||
392 | # | ||
393 | # CONFIG_PARPORT is not set | ||
394 | |||
395 | # | ||
396 | # Plug and Play support | ||
397 | # | ||
398 | |||
399 | # | ||
400 | # Block devices | ||
401 | # | ||
402 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
403 | CONFIG_BLK_DEV_LOOP=y | ||
404 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
405 | # CONFIG_BLK_DEV_NBD is not set | ||
406 | # CONFIG_BLK_DEV_UB is not set | ||
407 | CONFIG_BLK_DEV_RAM=y | ||
408 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
409 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
410 | CONFIG_BLK_DEV_INITRD=y | ||
411 | # CONFIG_CDROM_PKTCDVD is not set | ||
412 | # CONFIG_ATA_OVER_ETH is not set | ||
413 | |||
414 | # | ||
415 | # ATA/ATAPI/MFM/RLL support | ||
416 | # | ||
417 | # CONFIG_IDE is not set | ||
418 | |||
419 | # | ||
420 | # SCSI device support | ||
421 | # | ||
422 | # CONFIG_RAID_ATTRS is not set | ||
423 | CONFIG_SCSI=y | ||
424 | CONFIG_SCSI_PROC_FS=y | ||
425 | |||
426 | # | ||
427 | # SCSI support type (disk, tape, CD-ROM) | ||
428 | # | ||
429 | # CONFIG_BLK_DEV_SD is not set | ||
430 | # CONFIG_CHR_DEV_ST is not set | ||
431 | # CONFIG_CHR_DEV_OSST is not set | ||
432 | # CONFIG_BLK_DEV_SR is not set | ||
433 | # CONFIG_CHR_DEV_SG is not set | ||
434 | # CONFIG_CHR_DEV_SCH is not set | ||
435 | |||
436 | # | ||
437 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
438 | # | ||
439 | # CONFIG_SCSI_MULTI_LUN is not set | ||
440 | # CONFIG_SCSI_CONSTANTS is not set | ||
441 | # CONFIG_SCSI_LOGGING is not set | ||
442 | |||
443 | # | ||
444 | # SCSI Transport Attributes | ||
445 | # | ||
446 | # CONFIG_SCSI_SPI_ATTRS is not set | ||
447 | # CONFIG_SCSI_FC_ATTRS is not set | ||
448 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
449 | # CONFIG_SCSI_SAS_ATTRS is not set | ||
450 | |||
451 | # | ||
452 | # SCSI low-level drivers | ||
453 | # | ||
454 | # CONFIG_ISCSI_TCP is not set | ||
455 | # CONFIG_SCSI_SATA is not set | ||
456 | # CONFIG_SCSI_DEBUG is not set | ||
457 | |||
458 | # | ||
459 | # PCMCIA SCSI adapter support | ||
460 | # | ||
461 | # CONFIG_PCMCIA_AHA152X is not set | ||
462 | # CONFIG_PCMCIA_FDOMAIN is not set | ||
463 | # CONFIG_PCMCIA_NINJA_SCSI is not set | ||
464 | # CONFIG_PCMCIA_QLOGIC is not set | ||
465 | # CONFIG_PCMCIA_SYM53C500 is not set | ||
466 | |||
467 | # | ||
468 | # Multi-device support (RAID and LVM) | ||
469 | # | ||
470 | # CONFIG_MD is not set | ||
471 | |||
472 | # | ||
473 | # Fusion MPT device support | ||
474 | # | ||
475 | # CONFIG_FUSION is not set | ||
476 | |||
477 | # | ||
478 | # IEEE 1394 (FireWire) support | ||
479 | # | ||
480 | |||
481 | # | ||
482 | # I2O device support | ||
483 | # | ||
484 | |||
485 | # | ||
486 | # Network device support | ||
487 | # | ||
488 | CONFIG_NETDEVICES=y | ||
489 | # CONFIG_DUMMY is not set | ||
490 | # CONFIG_BONDING is not set | ||
491 | # CONFIG_EQUALIZER is not set | ||
492 | # CONFIG_TUN is not set | ||
493 | |||
494 | # | ||
495 | # PHY device support | ||
496 | # | ||
497 | # CONFIG_PHYLIB is not set | ||
498 | |||
499 | # | ||
500 | # Ethernet (10 or 100Mbit) | ||
501 | # | ||
502 | CONFIG_NET_ETHERNET=y | ||
503 | CONFIG_MII=y | ||
504 | CONFIG_ARM_AT91_ETHER=y | ||
505 | # CONFIG_SMC91X is not set | ||
506 | # CONFIG_DM9000 is not set | ||
507 | |||
508 | # | ||
509 | # Ethernet (1000 Mbit) | ||
510 | # | ||
511 | |||
512 | # | ||
513 | # Ethernet (10000 Mbit) | ||
514 | # | ||
515 | |||
516 | # | ||
517 | # Token Ring devices | ||
518 | # | ||
519 | |||
520 | # | ||
521 | # Wireless LAN (non-hamradio) | ||
522 | # | ||
523 | # CONFIG_NET_RADIO is not set | ||
524 | |||
525 | # | ||
526 | # PCMCIA network device support | ||
527 | # | ||
528 | # CONFIG_NET_PCMCIA is not set | ||
529 | |||
530 | # | ||
531 | # Wan interfaces | ||
532 | # | ||
533 | # CONFIG_WAN is not set | ||
534 | # CONFIG_PPP is not set | ||
535 | # CONFIG_SLIP is not set | ||
536 | # CONFIG_SHAPER is not set | ||
537 | # CONFIG_NETCONSOLE is not set | ||
538 | # CONFIG_NETPOLL is not set | ||
539 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
540 | |||
541 | # | ||
542 | # ISDN subsystem | ||
543 | # | ||
544 | # CONFIG_ISDN is not set | ||
545 | |||
546 | # | ||
547 | # Input device support | ||
548 | # | ||
549 | CONFIG_INPUT=y | ||
550 | |||
551 | # | ||
552 | # Userland interfaces | ||
553 | # | ||
554 | CONFIG_INPUT_MOUSEDEV=y | ||
555 | CONFIG_INPUT_MOUSEDEV_PSAUX=y | ||
556 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
557 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
558 | # CONFIG_INPUT_JOYDEV is not set | ||
559 | # CONFIG_INPUT_TSDEV is not set | ||
560 | # CONFIG_INPUT_EVDEV is not set | ||
561 | # CONFIG_INPUT_EVBUG is not set | ||
562 | |||
563 | # | ||
564 | # Input Device Drivers | ||
565 | # | ||
566 | # CONFIG_INPUT_KEYBOARD is not set | ||
567 | # CONFIG_INPUT_MOUSE is not set | ||
568 | # CONFIG_INPUT_JOYSTICK is not set | ||
569 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
570 | # CONFIG_INPUT_MISC is not set | ||
571 | |||
572 | # | ||
573 | # Hardware I/O ports | ||
574 | # | ||
575 | # CONFIG_SERIO is not set | ||
576 | # CONFIG_GAMEPORT is not set | ||
577 | |||
578 | # | ||
579 | # Character devices | ||
580 | # | ||
581 | CONFIG_VT=y | ||
582 | CONFIG_VT_CONSOLE=y | ||
583 | CONFIG_HW_CONSOLE=y | ||
584 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
585 | |||
586 | # | ||
587 | # Serial drivers | ||
588 | # | ||
589 | # CONFIG_SERIAL_8250 is not set | ||
590 | |||
591 | # | ||
592 | # Non-8250 serial port support | ||
593 | # | ||
594 | CONFIG_SERIAL_AT91=y | ||
595 | CONFIG_SERIAL_AT91_CONSOLE=y | ||
596 | # CONFIG_SERIAL_AT91_TTYAT is not set | ||
597 | CONFIG_SERIAL_CORE=y | ||
598 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
599 | CONFIG_UNIX98_PTYS=y | ||
600 | CONFIG_LEGACY_PTYS=y | ||
601 | CONFIG_LEGACY_PTY_COUNT=256 | ||
602 | |||
603 | # | ||
604 | # IPMI | ||
605 | # | ||
606 | # CONFIG_IPMI_HANDLER is not set | ||
607 | |||
608 | # | ||
609 | # Watchdog Cards | ||
610 | # | ||
611 | CONFIG_WATCHDOG=y | ||
612 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
613 | |||
614 | # | ||
615 | # Watchdog Device Drivers | ||
616 | # | ||
617 | # CONFIG_SOFT_WATCHDOG is not set | ||
618 | CONFIG_AT91_WATCHDOG=y | ||
619 | |||
620 | # | ||
621 | # USB-based Watchdog Cards | ||
622 | # | ||
623 | # CONFIG_USBPCWATCHDOG is not set | ||
624 | # CONFIG_NVRAM is not set | ||
625 | CONFIG_RTC=y | ||
626 | # CONFIG_AT91_RTC is not set | ||
627 | # CONFIG_DTLK is not set | ||
628 | # CONFIG_R3964 is not set | ||
629 | |||
630 | # | ||
631 | # Ftape, the floppy tape device driver | ||
632 | # | ||
633 | |||
634 | # | ||
635 | # PCMCIA character devices | ||
636 | # | ||
637 | # CONFIG_SYNCLINK_CS is not set | ||
638 | # CONFIG_CARDMAN_4000 is not set | ||
639 | # CONFIG_CARDMAN_4040 is not set | ||
640 | # CONFIG_RAW_DRIVER is not set | ||
641 | |||
642 | # | ||
643 | # TPM devices | ||
644 | # | ||
645 | # CONFIG_TCG_TPM is not set | ||
646 | # CONFIG_TELCLOCK is not set | ||
647 | CONFIG_AT91_SPI=y | ||
648 | CONFIG_AT91_SPIDEV=y | ||
649 | |||
650 | # | ||
651 | # I2C support | ||
652 | # | ||
653 | CONFIG_I2C=y | ||
654 | CONFIG_I2C_CHARDEV=y | ||
655 | |||
656 | # | ||
657 | # I2C Algorithms | ||
658 | # | ||
659 | # CONFIG_I2C_ALGOBIT is not set | ||
660 | # CONFIG_I2C_ALGOPCF is not set | ||
661 | # CONFIG_I2C_ALGOPCA is not set | ||
662 | |||
663 | # | ||
664 | # I2C Hardware Bus support | ||
665 | # | ||
666 | CONFIG_I2C_AT91=y | ||
667 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
668 | # CONFIG_I2C_STUB is not set | ||
669 | # CONFIG_I2C_PCA_ISA is not set | ||
670 | |||
671 | # | ||
672 | # Miscellaneous I2C Chip support | ||
673 | # | ||
674 | # CONFIG_SENSORS_DS1337 is not set | ||
675 | # CONFIG_SENSORS_DS1374 is not set | ||
676 | # CONFIG_SENSORS_EEPROM is not set | ||
677 | # CONFIG_SENSORS_PCF8574 is not set | ||
678 | # CONFIG_SENSORS_PCA9539 is not set | ||
679 | # CONFIG_SENSORS_PCF8591 is not set | ||
680 | # CONFIG_SENSORS_RTC8564 is not set | ||
681 | # CONFIG_SENSORS_MAX6875 is not set | ||
682 | # CONFIG_RTC_X1205_I2C is not set | ||
683 | # CONFIG_I2C_DEBUG_CORE is not set | ||
684 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
685 | # CONFIG_I2C_DEBUG_BUS is not set | ||
686 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
687 | |||
688 | # | ||
689 | # Hardware Monitoring support | ||
690 | # | ||
691 | CONFIG_HWMON=y | ||
692 | # CONFIG_HWMON_VID is not set | ||
693 | # CONFIG_SENSORS_ADM1021 is not set | ||
694 | # CONFIG_SENSORS_ADM1025 is not set | ||
695 | # CONFIG_SENSORS_ADM1026 is not set | ||
696 | # CONFIG_SENSORS_ADM1031 is not set | ||
697 | # CONFIG_SENSORS_ADM9240 is not set | ||
698 | # CONFIG_SENSORS_ASB100 is not set | ||
699 | # CONFIG_SENSORS_ATXP1 is not set | ||
700 | # CONFIG_SENSORS_DS1621 is not set | ||
701 | # CONFIG_SENSORS_FSCHER is not set | ||
702 | # CONFIG_SENSORS_FSCPOS is not set | ||
703 | # CONFIG_SENSORS_GL518SM is not set | ||
704 | # CONFIG_SENSORS_GL520SM is not set | ||
705 | # CONFIG_SENSORS_IT87 is not set | ||
706 | # CONFIG_SENSORS_LM63 is not set | ||
707 | # CONFIG_SENSORS_LM75 is not set | ||
708 | # CONFIG_SENSORS_LM77 is not set | ||
709 | # CONFIG_SENSORS_LM78 is not set | ||
710 | # CONFIG_SENSORS_LM80 is not set | ||
711 | # CONFIG_SENSORS_LM83 is not set | ||
712 | # CONFIG_SENSORS_LM85 is not set | ||
713 | # CONFIG_SENSORS_LM87 is not set | ||
714 | # CONFIG_SENSORS_LM90 is not set | ||
715 | # CONFIG_SENSORS_LM92 is not set | ||
716 | # CONFIG_SENSORS_MAX1619 is not set | ||
717 | # CONFIG_SENSORS_PC87360 is not set | ||
718 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
719 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
720 | # CONFIG_SENSORS_W83781D is not set | ||
721 | # CONFIG_SENSORS_W83792D is not set | ||
722 | # CONFIG_SENSORS_W83L785TS is not set | ||
723 | # CONFIG_SENSORS_W83627HF is not set | ||
724 | # CONFIG_SENSORS_W83627EHF is not set | ||
725 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
726 | |||
727 | # | ||
728 | # Misc devices | ||
729 | # | ||
730 | |||
731 | # | ||
732 | # Multimedia Capabilities Port drivers | ||
733 | # | ||
734 | |||
735 | # | ||
736 | # Multimedia devices | ||
737 | # | ||
738 | # CONFIG_VIDEO_DEV is not set | ||
739 | |||
740 | # | ||
741 | # Digital Video Broadcasting Devices | ||
742 | # | ||
743 | # CONFIG_DVB is not set | ||
744 | |||
745 | # | ||
746 | # Graphics support | ||
747 | # | ||
748 | # CONFIG_FB is not set | ||
749 | |||
750 | # | ||
751 | # Console display driver support | ||
752 | # | ||
753 | # CONFIG_VGA_CONSOLE is not set | ||
754 | CONFIG_DUMMY_CONSOLE=y | ||
755 | |||
756 | # | ||
757 | # Sound | ||
758 | # | ||
759 | # CONFIG_SOUND is not set | ||
760 | |||
761 | # | ||
762 | # USB support | ||
763 | # | ||
764 | CONFIG_USB_ARCH_HAS_HCD=y | ||
765 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
766 | CONFIG_USB=y | ||
767 | CONFIG_USB_DEBUG=y | ||
768 | |||
769 | # | ||
770 | # Miscellaneous USB options | ||
771 | # | ||
772 | CONFIG_USB_DEVICEFS=y | ||
773 | # CONFIG_USB_BANDWIDTH is not set | ||
774 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
775 | # CONFIG_USB_OTG is not set | ||
776 | |||
777 | # | ||
778 | # USB Host Controller Drivers | ||
779 | # | ||
780 | # CONFIG_USB_ISP116X_HCD is not set | ||
781 | CONFIG_USB_OHCI_HCD=y | ||
782 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | ||
783 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
784 | # CONFIG_USB_SL811_HCD is not set | ||
785 | |||
786 | # | ||
787 | # USB Device Class drivers | ||
788 | # | ||
789 | # CONFIG_USB_ACM is not set | ||
790 | # CONFIG_USB_PRINTER is not set | ||
791 | |||
792 | # | ||
793 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | ||
794 | # | ||
795 | |||
796 | # | ||
797 | # may also be needed; see USB_STORAGE Help for more information | ||
798 | # | ||
799 | CONFIG_USB_STORAGE=y | ||
800 | # CONFIG_USB_STORAGE_DEBUG is not set | ||
801 | # CONFIG_USB_STORAGE_DATAFAB is not set | ||
802 | # CONFIG_USB_STORAGE_FREECOM is not set | ||
803 | # CONFIG_USB_STORAGE_DPCM is not set | ||
804 | # CONFIG_USB_STORAGE_USBAT is not set | ||
805 | # CONFIG_USB_STORAGE_SDDR09 is not set | ||
806 | # CONFIG_USB_STORAGE_SDDR55 is not set | ||
807 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | ||
808 | |||
809 | # | ||
810 | # USB Input Devices | ||
811 | # | ||
812 | # CONFIG_USB_HID is not set | ||
813 | |||
814 | # | ||
815 | # USB HID Boot Protocol drivers | ||
816 | # | ||
817 | # CONFIG_USB_KBD is not set | ||
818 | # CONFIG_USB_MOUSE is not set | ||
819 | # CONFIG_USB_AIPTEK is not set | ||
820 | # CONFIG_USB_WACOM is not set | ||
821 | # CONFIG_USB_ACECAD is not set | ||
822 | # CONFIG_USB_KBTAB is not set | ||
823 | # CONFIG_USB_POWERMATE is not set | ||
824 | # CONFIG_USB_MTOUCH is not set | ||
825 | # CONFIG_USB_ITMTOUCH is not set | ||
826 | # CONFIG_USB_EGALAX is not set | ||
827 | # CONFIG_USB_YEALINK is not set | ||
828 | # CONFIG_USB_XPAD is not set | ||
829 | # CONFIG_USB_ATI_REMOTE is not set | ||
830 | # CONFIG_USB_KEYSPAN_REMOTE is not set | ||
831 | # CONFIG_USB_APPLETOUCH is not set | ||
832 | |||
833 | # | ||
834 | # USB Imaging devices | ||
835 | # | ||
836 | # CONFIG_USB_MDC800 is not set | ||
837 | # CONFIG_USB_MICROTEK is not set | ||
838 | |||
839 | # | ||
840 | # USB Multimedia devices | ||
841 | # | ||
842 | # CONFIG_USB_DABUSB is not set | ||
843 | |||
844 | # | ||
845 | # Video4Linux support is needed for USB Multimedia device support | ||
846 | # | ||
847 | |||
848 | # | ||
849 | # USB Network Adapters | ||
850 | # | ||
851 | # CONFIG_USB_CATC is not set | ||
852 | # CONFIG_USB_KAWETH is not set | ||
853 | # CONFIG_USB_PEGASUS is not set | ||
854 | # CONFIG_USB_RTL8150 is not set | ||
855 | # CONFIG_USB_USBNET is not set | ||
856 | CONFIG_USB_MON=y | ||
857 | |||
858 | # | ||
859 | # USB port drivers | ||
860 | # | ||
861 | |||
862 | # | ||
863 | # USB Serial Converter support | ||
864 | # | ||
865 | CONFIG_USB_SERIAL=y | ||
866 | CONFIG_USB_SERIAL_CONSOLE=y | ||
867 | CONFIG_USB_SERIAL_GENERIC=y | ||
868 | # CONFIG_USB_SERIAL_AIRPRIME is not set | ||
869 | # CONFIG_USB_SERIAL_ANYDATA is not set | ||
870 | # CONFIG_USB_SERIAL_BELKIN is not set | ||
871 | # CONFIG_USB_SERIAL_WHITEHEAT is not set | ||
872 | # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set | ||
873 | # CONFIG_USB_SERIAL_CP2101 is not set | ||
874 | # CONFIG_USB_SERIAL_CYPRESS_M8 is not set | ||
875 | # CONFIG_USB_SERIAL_EMPEG is not set | ||
876 | CONFIG_USB_SERIAL_FTDI_SIO=y | ||
877 | # CONFIG_USB_SERIAL_VISOR is not set | ||
878 | # CONFIG_USB_SERIAL_IPAQ is not set | ||
879 | # CONFIG_USB_SERIAL_IR is not set | ||
880 | # CONFIG_USB_SERIAL_EDGEPORT is not set | ||
881 | # CONFIG_USB_SERIAL_EDGEPORT_TI is not set | ||
882 | # CONFIG_USB_SERIAL_GARMIN is not set | ||
883 | # CONFIG_USB_SERIAL_IPW is not set | ||
884 | # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set | ||
885 | CONFIG_USB_SERIAL_KEYSPAN=y | ||
886 | CONFIG_USB_SERIAL_KEYSPAN_MPR=y | ||
887 | CONFIG_USB_SERIAL_KEYSPAN_USA28=y | ||
888 | CONFIG_USB_SERIAL_KEYSPAN_USA28X=y | ||
889 | CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y | ||
890 | CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y | ||
891 | CONFIG_USB_SERIAL_KEYSPAN_USA19=y | ||
892 | CONFIG_USB_SERIAL_KEYSPAN_USA18X=y | ||
893 | CONFIG_USB_SERIAL_KEYSPAN_USA19W=y | ||
894 | CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y | ||
895 | CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y | ||
896 | CONFIG_USB_SERIAL_KEYSPAN_USA49W=y | ||
897 | CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y | ||
898 | # CONFIG_USB_SERIAL_KLSI is not set | ||
899 | # CONFIG_USB_SERIAL_KOBIL_SCT is not set | ||
900 | CONFIG_USB_SERIAL_MCT_U232=y | ||
901 | # CONFIG_USB_SERIAL_PL2303 is not set | ||
902 | # CONFIG_USB_SERIAL_HP4X is not set | ||
903 | # CONFIG_USB_SERIAL_SAFE is not set | ||
904 | # CONFIG_USB_SERIAL_TI is not set | ||
905 | # CONFIG_USB_SERIAL_CYBERJACK is not set | ||
906 | # CONFIG_USB_SERIAL_XIRCOM is not set | ||
907 | # CONFIG_USB_SERIAL_OPTION is not set | ||
908 | # CONFIG_USB_SERIAL_OMNINET is not set | ||
909 | CONFIG_USB_EZUSB=y | ||
910 | |||
911 | # | ||
912 | # USB Miscellaneous drivers | ||
913 | # | ||
914 | # CONFIG_USB_EMI62 is not set | ||
915 | # CONFIG_USB_EMI26 is not set | ||
916 | # CONFIG_USB_AUERSWALD is not set | ||
917 | # CONFIG_USB_RIO500 is not set | ||
918 | # CONFIG_USB_LEGOTOWER is not set | ||
919 | # CONFIG_USB_LCD is not set | ||
920 | # CONFIG_USB_LED is not set | ||
921 | # CONFIG_USB_CYTHERM is not set | ||
922 | # CONFIG_USB_PHIDGETKIT is not set | ||
923 | # CONFIG_USB_PHIDGETSERVO is not set | ||
924 | # CONFIG_USB_IDMOUSE is not set | ||
925 | # CONFIG_USB_LD is not set | ||
926 | # CONFIG_USB_TEST is not set | ||
927 | |||
928 | # | ||
929 | # USB DSL modem support | ||
930 | # | ||
931 | |||
932 | # | ||
933 | # USB Gadget Support | ||
934 | # | ||
935 | CONFIG_USB_GADGET=y | ||
936 | # CONFIG_USB_GADGET_DEBUG_FILES is not set | ||
937 | CONFIG_USB_GADGET_SELECTED=y | ||
938 | # CONFIG_USB_GADGET_NET2280 is not set | ||
939 | # CONFIG_USB_GADGET_PXA2XX is not set | ||
940 | # CONFIG_USB_GADGET_GOKU is not set | ||
941 | # CONFIG_USB_GADGET_LH7A40X is not set | ||
942 | # CONFIG_USB_GADGET_OMAP is not set | ||
943 | CONFIG_USB_GADGET_AT91=y | ||
944 | CONFIG_USB_AT91=y | ||
945 | # CONFIG_USB_GADGET_DUMMY_HCD is not set | ||
946 | # CONFIG_USB_GADGET_DUALSPEED is not set | ||
947 | # CONFIG_USB_ZERO is not set | ||
948 | # CONFIG_USB_ETH is not set | ||
949 | # CONFIG_USB_GADGETFS is not set | ||
950 | # CONFIG_USB_FILE_STORAGE is not set | ||
951 | # CONFIG_USB_G_SERIAL is not set | ||
952 | |||
953 | # | ||
954 | # MMC/SD Card support | ||
955 | # | ||
956 | CONFIG_MMC=y | ||
957 | # CONFIG_MMC_DEBUG is not set | ||
958 | CONFIG_MMC_BLOCK=y | ||
959 | # CONFIG_MMC_WBSD is not set | ||
960 | CONFIG_MMC_AT91RM9200=y | ||
961 | |||
962 | # | ||
963 | # File systems | ||
964 | # | ||
965 | CONFIG_EXT2_FS=y | ||
966 | # CONFIG_EXT2_FS_XATTR is not set | ||
967 | # CONFIG_EXT2_FS_XIP is not set | ||
968 | # CONFIG_EXT3_FS is not set | ||
969 | # CONFIG_JBD is not set | ||
970 | # CONFIG_REISERFS_FS is not set | ||
971 | # CONFIG_JFS_FS is not set | ||
972 | # CONFIG_FS_POSIX_ACL is not set | ||
973 | # CONFIG_XFS_FS is not set | ||
974 | # CONFIG_MINIX_FS is not set | ||
975 | # CONFIG_ROMFS_FS is not set | ||
976 | CONFIG_INOTIFY=y | ||
977 | # CONFIG_QUOTA is not set | ||
978 | CONFIG_DNOTIFY=y | ||
979 | # CONFIG_AUTOFS_FS is not set | ||
980 | # CONFIG_AUTOFS4_FS is not set | ||
981 | # CONFIG_FUSE_FS is not set | ||
982 | |||
983 | # | ||
984 | # CD-ROM/DVD Filesystems | ||
985 | # | ||
986 | # CONFIG_ISO9660_FS is not set | ||
987 | # CONFIG_UDF_FS is not set | ||
988 | |||
989 | # | ||
990 | # DOS/FAT/NT Filesystems | ||
991 | # | ||
992 | # CONFIG_MSDOS_FS is not set | ||
993 | # CONFIG_VFAT_FS is not set | ||
994 | # CONFIG_NTFS_FS is not set | ||
995 | |||
996 | # | ||
997 | # Pseudo filesystems | ||
998 | # | ||
999 | CONFIG_PROC_FS=y | ||
1000 | CONFIG_SYSFS=y | ||
1001 | CONFIG_TMPFS=y | ||
1002 | # CONFIG_HUGETLB_PAGE is not set | ||
1003 | CONFIG_RAMFS=y | ||
1004 | # CONFIG_RELAYFS_FS is not set | ||
1005 | |||
1006 | # | ||
1007 | # Miscellaneous filesystems | ||
1008 | # | ||
1009 | # CONFIG_ADFS_FS is not set | ||
1010 | # CONFIG_AFFS_FS is not set | ||
1011 | # CONFIG_HFS_FS is not set | ||
1012 | # CONFIG_HFSPLUS_FS is not set | ||
1013 | # CONFIG_BEFS_FS is not set | ||
1014 | # CONFIG_BFS_FS is not set | ||
1015 | # CONFIG_EFS_FS is not set | ||
1016 | # CONFIG_JFFS_FS is not set | ||
1017 | # CONFIG_JFFS2_FS is not set | ||
1018 | CONFIG_CRAMFS=y | ||
1019 | # CONFIG_VXFS_FS is not set | ||
1020 | # CONFIG_HPFS_FS is not set | ||
1021 | # CONFIG_QNX4FS_FS is not set | ||
1022 | # CONFIG_SYSV_FS is not set | ||
1023 | # CONFIG_UFS_FS is not set | ||
1024 | |||
1025 | # | ||
1026 | # Network File Systems | ||
1027 | # | ||
1028 | CONFIG_NFS_FS=y | ||
1029 | CONFIG_NFS_V3=y | ||
1030 | # CONFIG_NFS_V3_ACL is not set | ||
1031 | CONFIG_NFS_V4=y | ||
1032 | # CONFIG_NFS_DIRECTIO is not set | ||
1033 | # CONFIG_NFSD is not set | ||
1034 | CONFIG_ROOT_NFS=y | ||
1035 | CONFIG_LOCKD=y | ||
1036 | CONFIG_LOCKD_V4=y | ||
1037 | CONFIG_NFS_COMMON=y | ||
1038 | CONFIG_SUNRPC=y | ||
1039 | CONFIG_SUNRPC_GSS=y | ||
1040 | CONFIG_RPCSEC_GSS_KRB5=y | ||
1041 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
1042 | # CONFIG_SMB_FS is not set | ||
1043 | # CONFIG_CIFS is not set | ||
1044 | # CONFIG_NCP_FS is not set | ||
1045 | # CONFIG_CODA_FS is not set | ||
1046 | # CONFIG_AFS_FS is not set | ||
1047 | # CONFIG_9P_FS is not set | ||
1048 | |||
1049 | # | ||
1050 | # Partition Types | ||
1051 | # | ||
1052 | # CONFIG_PARTITION_ADVANCED is not set | ||
1053 | CONFIG_MSDOS_PARTITION=y | ||
1054 | |||
1055 | # | ||
1056 | # Native Language Support | ||
1057 | # | ||
1058 | # CONFIG_NLS is not set | ||
1059 | |||
1060 | # | ||
1061 | # Profiling support | ||
1062 | # | ||
1063 | # CONFIG_PROFILING is not set | ||
1064 | |||
1065 | # | ||
1066 | # Kernel hacking | ||
1067 | # | ||
1068 | # CONFIG_PRINTK_TIME is not set | ||
1069 | CONFIG_DEBUG_KERNEL=y | ||
1070 | # CONFIG_MAGIC_SYSRQ is not set | ||
1071 | CONFIG_LOG_BUF_SHIFT=14 | ||
1072 | CONFIG_DETECT_SOFTLOCKUP=y | ||
1073 | # CONFIG_SCHEDSTATS is not set | ||
1074 | # CONFIG_DEBUG_SLAB is not set | ||
1075 | # CONFIG_DEBUG_SPINLOCK is not set | ||
1076 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
1077 | # CONFIG_DEBUG_KOBJECT is not set | ||
1078 | CONFIG_DEBUG_BUGVERBOSE=y | ||
1079 | # CONFIG_DEBUG_INFO is not set | ||
1080 | # CONFIG_DEBUG_FS is not set | ||
1081 | # CONFIG_DEBUG_VM is not set | ||
1082 | CONFIG_FRAME_POINTER=y | ||
1083 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1084 | CONFIG_DEBUG_USER=y | ||
1085 | # CONFIG_DEBUG_WAITQ is not set | ||
1086 | # CONFIG_DEBUG_ERRORS is not set | ||
1087 | CONFIG_DEBUG_LL=y | ||
1088 | # CONFIG_DEBUG_ICEDCC is not set | ||
1089 | |||
1090 | # | ||
1091 | # Security options | ||
1092 | # | ||
1093 | # CONFIG_KEYS is not set | ||
1094 | # CONFIG_SECURITY is not set | ||
1095 | |||
1096 | # | ||
1097 | # Cryptographic options | ||
1098 | # | ||
1099 | CONFIG_CRYPTO=y | ||
1100 | # CONFIG_CRYPTO_HMAC is not set | ||
1101 | # CONFIG_CRYPTO_NULL is not set | ||
1102 | # CONFIG_CRYPTO_MD4 is not set | ||
1103 | CONFIG_CRYPTO_MD5=y | ||
1104 | # CONFIG_CRYPTO_SHA1 is not set | ||
1105 | # CONFIG_CRYPTO_SHA256 is not set | ||
1106 | # CONFIG_CRYPTO_SHA512 is not set | ||
1107 | # CONFIG_CRYPTO_WP512 is not set | ||
1108 | # CONFIG_CRYPTO_TGR192 is not set | ||
1109 | CONFIG_CRYPTO_DES=y | ||
1110 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
1111 | # CONFIG_CRYPTO_TWOFISH is not set | ||
1112 | # CONFIG_CRYPTO_SERPENT is not set | ||
1113 | # CONFIG_CRYPTO_AES is not set | ||
1114 | # CONFIG_CRYPTO_CAST5 is not set | ||
1115 | # CONFIG_CRYPTO_CAST6 is not set | ||
1116 | # CONFIG_CRYPTO_TEA is not set | ||
1117 | # CONFIG_CRYPTO_ARC4 is not set | ||
1118 | # CONFIG_CRYPTO_KHAZAD is not set | ||
1119 | # CONFIG_CRYPTO_ANUBIS is not set | ||
1120 | # CONFIG_CRYPTO_DEFLATE is not set | ||
1121 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
1122 | # CONFIG_CRYPTO_CRC32C is not set | ||
1123 | # CONFIG_CRYPTO_TEST is not set | ||
1124 | |||
1125 | # | ||
1126 | # Hardware crypto devices | ||
1127 | # | ||
1128 | |||
1129 | # | ||
1130 | # Library routines | ||
1131 | # | ||
1132 | # CONFIG_CRC_CCITT is not set | ||
1133 | # CONFIG_CRC16 is not set | ||
1134 | CONFIG_CRC32=y | ||
1135 | # CONFIG_LIBCRC32C is not set | ||
1136 | CONFIG_ZLIB_INFLATE=y | ||
diff --git a/arch/arm/configs/csb637_defconfig b/arch/arm/configs/csb637_defconfig new file mode 100644 index 000000000000..95a96a5462a0 --- /dev/null +++ b/arch/arm/configs/csb637_defconfig | |||
@@ -0,0 +1,1116 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.15 | ||
4 | # Mon Jan 9 21:52:00 2006 | ||
5 | # | ||
6 | CONFIG_ARM=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_UID16=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
11 | |||
12 | # | ||
13 | # Code maturity level options | ||
14 | # | ||
15 | CONFIG_EXPERIMENTAL=y | ||
16 | CONFIG_CLEAN_COMPILE=y | ||
17 | CONFIG_BROKEN_ON_SMP=y | ||
18 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | ||
24 | CONFIG_LOCALVERSION_AUTO=y | ||
25 | # CONFIG_SWAP is not set | ||
26 | CONFIG_SYSVIPC=y | ||
27 | # CONFIG_POSIX_MQUEUE is not set | ||
28 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
29 | CONFIG_SYSCTL=y | ||
30 | # CONFIG_AUDIT is not set | ||
31 | CONFIG_HOTPLUG=y | ||
32 | CONFIG_KOBJECT_UEVENT=y | ||
33 | # CONFIG_IKCONFIG is not set | ||
34 | CONFIG_INITRAMFS_SOURCE="" | ||
35 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
36 | # CONFIG_EMBEDDED is not set | ||
37 | CONFIG_KALLSYMS=y | ||
38 | # CONFIG_KALLSYMS_ALL is not set | ||
39 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | CONFIG_BASE_FULL=y | ||
43 | CONFIG_FUTEX=y | ||
44 | CONFIG_EPOLL=y | ||
45 | CONFIG_SHMEM=y | ||
46 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
47 | CONFIG_CC_ALIGN_LABELS=0 | ||
48 | CONFIG_CC_ALIGN_LOOPS=0 | ||
49 | CONFIG_CC_ALIGN_JUMPS=0 | ||
50 | # CONFIG_TINY_SHMEM is not set | ||
51 | CONFIG_BASE_SMALL=0 | ||
52 | |||
53 | # | ||
54 | # Loadable module support | ||
55 | # | ||
56 | CONFIG_MODULES=y | ||
57 | CONFIG_MODULE_UNLOAD=y | ||
58 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
59 | CONFIG_OBSOLETE_MODPARM=y | ||
60 | # CONFIG_MODVERSIONS is not set | ||
61 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
62 | CONFIG_KMOD=y | ||
63 | |||
64 | # | ||
65 | # Block layer | ||
66 | # | ||
67 | |||
68 | # | ||
69 | # IO Schedulers | ||
70 | # | ||
71 | CONFIG_IOSCHED_NOOP=y | ||
72 | CONFIG_IOSCHED_AS=y | ||
73 | CONFIG_IOSCHED_DEADLINE=y | ||
74 | CONFIG_IOSCHED_CFQ=y | ||
75 | CONFIG_DEFAULT_AS=y | ||
76 | # CONFIG_DEFAULT_DEADLINE is not set | ||
77 | # CONFIG_DEFAULT_CFQ is not set | ||
78 | # CONFIG_DEFAULT_NOOP is not set | ||
79 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
80 | |||
81 | # | ||
82 | # System Type | ||
83 | # | ||
84 | # CONFIG_ARCH_CLPS7500 is not set | ||
85 | # CONFIG_ARCH_CLPS711X is not set | ||
86 | # CONFIG_ARCH_CO285 is not set | ||
87 | # CONFIG_ARCH_EBSA110 is not set | ||
88 | # CONFIG_ARCH_CAMELOT is not set | ||
89 | # CONFIG_ARCH_FOOTBRIDGE is not set | ||
90 | # CONFIG_ARCH_INTEGRATOR is not set | ||
91 | # CONFIG_ARCH_IOP3XX is not set | ||
92 | # CONFIG_ARCH_IXP4XX is not set | ||
93 | # CONFIG_ARCH_IXP2000 is not set | ||
94 | # CONFIG_ARCH_L7200 is not set | ||
95 | # CONFIG_ARCH_PXA is not set | ||
96 | # CONFIG_ARCH_RPC is not set | ||
97 | # CONFIG_ARCH_SA1100 is not set | ||
98 | # CONFIG_ARCH_S3C2410 is not set | ||
99 | # CONFIG_ARCH_SHARK is not set | ||
100 | # CONFIG_ARCH_LH7A40X is not set | ||
101 | # CONFIG_ARCH_OMAP is not set | ||
102 | # CONFIG_ARCH_VERSATILE is not set | ||
103 | # CONFIG_ARCH_REALVIEW is not set | ||
104 | # CONFIG_ARCH_IMX is not set | ||
105 | # CONFIG_ARCH_H720X is not set | ||
106 | # CONFIG_ARCH_AAEC2000 is not set | ||
107 | CONFIG_ARCH_AT91RM9200=y | ||
108 | |||
109 | # | ||
110 | # AT91RM9200 Implementations | ||
111 | # | ||
112 | |||
113 | # | ||
114 | # AT91RM9200 Board Type | ||
115 | # | ||
116 | # CONFIG_ARCH_AT91RM9200DK is not set | ||
117 | # CONFIG_MACH_AT91RM9200EK is not set | ||
118 | # CONFIG_MACH_CSB337 is not set | ||
119 | CONFIG_MACH_CSB637=y | ||
120 | # CONFIG_MACH_CARMEVA is not set | ||
121 | # CONFIG_MACH_KB9200 is not set | ||
122 | # CONFIG_MACH_ATEB9200 is not set | ||
123 | |||
124 | # | ||
125 | # AT91RM9200 Feature Selections | ||
126 | # | ||
127 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
128 | |||
129 | # | ||
130 | # Processor Type | ||
131 | # | ||
132 | CONFIG_CPU_32=y | ||
133 | CONFIG_CPU_ARM920T=y | ||
134 | CONFIG_CPU_32v4=y | ||
135 | CONFIG_CPU_ABRT_EV4T=y | ||
136 | CONFIG_CPU_CACHE_V4WT=y | ||
137 | CONFIG_CPU_CACHE_VIVT=y | ||
138 | CONFIG_CPU_COPY_V4WB=y | ||
139 | CONFIG_CPU_TLB_V4WBI=y | ||
140 | |||
141 | # | ||
142 | # Processor Features | ||
143 | # | ||
144 | # CONFIG_ARM_THUMB is not set | ||
145 | # CONFIG_CPU_ICACHE_DISABLE is not set | ||
146 | # CONFIG_CPU_DCACHE_DISABLE is not set | ||
147 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | ||
148 | |||
149 | # | ||
150 | # Bus support | ||
151 | # | ||
152 | CONFIG_ISA_DMA_API=y | ||
153 | |||
154 | # | ||
155 | # PCCARD (PCMCIA/CardBus) support | ||
156 | # | ||
157 | CONFIG_PCCARD=y | ||
158 | # CONFIG_PCMCIA_DEBUG is not set | ||
159 | CONFIG_PCMCIA=y | ||
160 | CONFIG_PCMCIA_LOAD_CIS=y | ||
161 | CONFIG_PCMCIA_IOCTL=y | ||
162 | |||
163 | # | ||
164 | # PC-card bridges | ||
165 | # | ||
166 | CONFIG_AT91_CF=y | ||
167 | |||
168 | # | ||
169 | # Kernel Features | ||
170 | # | ||
171 | # CONFIG_PREEMPT is not set | ||
172 | # CONFIG_NO_IDLE_HZ is not set | ||
173 | # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set | ||
174 | CONFIG_SELECT_MEMORY_MODEL=y | ||
175 | CONFIG_FLATMEM_MANUAL=y | ||
176 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
177 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
178 | CONFIG_FLATMEM=y | ||
179 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
180 | # CONFIG_SPARSEMEM_STATIC is not set | ||
181 | CONFIG_SPLIT_PTLOCK_CPUS=4096 | ||
182 | CONFIG_LEDS=y | ||
183 | CONFIG_LEDS_TIMER=y | ||
184 | CONFIG_LEDS_CPU=y | ||
185 | CONFIG_ALIGNMENT_TRAP=y | ||
186 | |||
187 | # | ||
188 | # Boot options | ||
189 | # | ||
190 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
191 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
192 | CONFIG_CMDLINE="mem=32M console=ttyS0,38400 initrd=0x20410000,3145728 root=/dev/ram0 rw" | ||
193 | # CONFIG_XIP_KERNEL is not set | ||
194 | |||
195 | # | ||
196 | # Floating point emulation | ||
197 | # | ||
198 | |||
199 | # | ||
200 | # At least one emulation must be selected | ||
201 | # | ||
202 | CONFIG_FPE_NWFPE=y | ||
203 | # CONFIG_FPE_NWFPE_XP is not set | ||
204 | # CONFIG_FPE_FASTFPE is not set | ||
205 | |||
206 | # | ||
207 | # Userspace binary formats | ||
208 | # | ||
209 | CONFIG_BINFMT_ELF=y | ||
210 | # CONFIG_BINFMT_AOUT is not set | ||
211 | # CONFIG_BINFMT_MISC is not set | ||
212 | # CONFIG_ARTHUR is not set | ||
213 | |||
214 | # | ||
215 | # Power management options | ||
216 | # | ||
217 | # CONFIG_PM is not set | ||
218 | |||
219 | # | ||
220 | # Networking | ||
221 | # | ||
222 | CONFIG_NET=y | ||
223 | |||
224 | # | ||
225 | # Networking options | ||
226 | # | ||
227 | CONFIG_PACKET=y | ||
228 | # CONFIG_PACKET_MMAP is not set | ||
229 | CONFIG_UNIX=y | ||
230 | # CONFIG_NET_KEY is not set | ||
231 | CONFIG_INET=y | ||
232 | # CONFIG_IP_MULTICAST is not set | ||
233 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
234 | CONFIG_IP_FIB_HASH=y | ||
235 | CONFIG_IP_PNP=y | ||
236 | CONFIG_IP_PNP_DHCP=y | ||
237 | CONFIG_IP_PNP_BOOTP=y | ||
238 | # CONFIG_IP_PNP_RARP is not set | ||
239 | # CONFIG_NET_IPIP is not set | ||
240 | # CONFIG_NET_IPGRE is not set | ||
241 | # CONFIG_ARPD is not set | ||
242 | # CONFIG_SYN_COOKIES is not set | ||
243 | # CONFIG_INET_AH is not set | ||
244 | # CONFIG_INET_ESP is not set | ||
245 | # CONFIG_INET_IPCOMP is not set | ||
246 | # CONFIG_INET_TUNNEL is not set | ||
247 | CONFIG_INET_DIAG=y | ||
248 | CONFIG_INET_TCP_DIAG=y | ||
249 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
250 | CONFIG_TCP_CONG_BIC=y | ||
251 | # CONFIG_IPV6 is not set | ||
252 | # CONFIG_NETFILTER is not set | ||
253 | |||
254 | # | ||
255 | # DCCP Configuration (EXPERIMENTAL) | ||
256 | # | ||
257 | # CONFIG_IP_DCCP is not set | ||
258 | |||
259 | # | ||
260 | # SCTP Configuration (EXPERIMENTAL) | ||
261 | # | ||
262 | # CONFIG_IP_SCTP is not set | ||
263 | # CONFIG_ATM is not set | ||
264 | # CONFIG_BRIDGE is not set | ||
265 | # CONFIG_VLAN_8021Q is not set | ||
266 | # CONFIG_DECNET is not set | ||
267 | # CONFIG_LLC2 is not set | ||
268 | # CONFIG_IPX is not set | ||
269 | # CONFIG_ATALK is not set | ||
270 | # CONFIG_X25 is not set | ||
271 | # CONFIG_LAPB is not set | ||
272 | # CONFIG_NET_DIVERT is not set | ||
273 | # CONFIG_ECONET is not set | ||
274 | # CONFIG_WAN_ROUTER is not set | ||
275 | |||
276 | # | ||
277 | # QoS and/or fair queueing | ||
278 | # | ||
279 | # CONFIG_NET_SCHED is not set | ||
280 | |||
281 | # | ||
282 | # Network testing | ||
283 | # | ||
284 | # CONFIG_NET_PKTGEN is not set | ||
285 | # CONFIG_HAMRADIO is not set | ||
286 | # CONFIG_IRDA is not set | ||
287 | # CONFIG_BT is not set | ||
288 | # CONFIG_IEEE80211 is not set | ||
289 | |||
290 | # | ||
291 | # Device Drivers | ||
292 | # | ||
293 | |||
294 | # | ||
295 | # Generic Driver Options | ||
296 | # | ||
297 | CONFIG_STANDALONE=y | ||
298 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
299 | CONFIG_FW_LOADER=y | ||
300 | # CONFIG_DEBUG_DRIVER is not set | ||
301 | |||
302 | # | ||
303 | # Connector - unified userspace <-> kernelspace linker | ||
304 | # | ||
305 | # CONFIG_CONNECTOR is not set | ||
306 | |||
307 | # | ||
308 | # Memory Technology Devices (MTD) | ||
309 | # | ||
310 | CONFIG_MTD=y | ||
311 | # CONFIG_MTD_DEBUG is not set | ||
312 | # CONFIG_MTD_CONCAT is not set | ||
313 | CONFIG_MTD_PARTITIONS=y | ||
314 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
315 | CONFIG_MTD_CMDLINE_PARTS=y | ||
316 | # CONFIG_MTD_AFS_PARTS is not set | ||
317 | |||
318 | # | ||
319 | # User Modules And Translation Layers | ||
320 | # | ||
321 | CONFIG_MTD_CHAR=y | ||
322 | CONFIG_MTD_BLOCK=y | ||
323 | # CONFIG_FTL is not set | ||
324 | # CONFIG_NFTL is not set | ||
325 | # CONFIG_INFTL is not set | ||
326 | # CONFIG_RFD_FTL is not set | ||
327 | |||
328 | # | ||
329 | # RAM/ROM/Flash chip drivers | ||
330 | # | ||
331 | CONFIG_MTD_CFI=y | ||
332 | # CONFIG_MTD_JEDECPROBE is not set | ||
333 | CONFIG_MTD_GEN_PROBE=y | ||
334 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
335 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
336 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
337 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
338 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
339 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
340 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
341 | CONFIG_MTD_CFI_I1=y | ||
342 | CONFIG_MTD_CFI_I2=y | ||
343 | # CONFIG_MTD_CFI_I4 is not set | ||
344 | # CONFIG_MTD_CFI_I8 is not set | ||
345 | CONFIG_MTD_CFI_INTELEXT=y | ||
346 | # CONFIG_MTD_CFI_AMDSTD is not set | ||
347 | # CONFIG_MTD_CFI_STAA is not set | ||
348 | CONFIG_MTD_CFI_UTIL=y | ||
349 | # CONFIG_MTD_RAM is not set | ||
350 | # CONFIG_MTD_ROM is not set | ||
351 | # CONFIG_MTD_ABSENT is not set | ||
352 | # CONFIG_MTD_XIP is not set | ||
353 | |||
354 | # | ||
355 | # Mapping drivers for chip access | ||
356 | # | ||
357 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
358 | # CONFIG_MTD_PHYSMAP is not set | ||
359 | # CONFIG_MTD_ARM_INTEGRATOR is not set | ||
360 | # CONFIG_MTD_PLATRAM is not set | ||
361 | CONFIG_MTD_CSB637=y | ||
362 | |||
363 | # | ||
364 | # Self-contained MTD device drivers | ||
365 | # | ||
366 | # CONFIG_MTD_SLRAM is not set | ||
367 | # CONFIG_MTD_PHRAM is not set | ||
368 | # CONFIG_MTD_MTDRAM is not set | ||
369 | # CONFIG_MTD_BLKMTD is not set | ||
370 | # CONFIG_MTD_BLOCK2MTD is not set | ||
371 | |||
372 | # | ||
373 | # Disk-On-Chip Device Drivers | ||
374 | # | ||
375 | # CONFIG_MTD_DOC2000 is not set | ||
376 | # CONFIG_MTD_DOC2001 is not set | ||
377 | # CONFIG_MTD_DOC2001PLUS is not set | ||
378 | # CONFIG_MTD_AT91_DATAFLASH is not set | ||
379 | |||
380 | # | ||
381 | # NAND Flash Device Drivers | ||
382 | # | ||
383 | # CONFIG_MTD_NAND is not set | ||
384 | |||
385 | # | ||
386 | # OneNAND Flash Device Drivers | ||
387 | # | ||
388 | # CONFIG_MTD_ONENAND is not set | ||
389 | |||
390 | # | ||
391 | # Parallel port support | ||
392 | # | ||
393 | # CONFIG_PARPORT is not set | ||
394 | |||
395 | # | ||
396 | # Plug and Play support | ||
397 | # | ||
398 | |||
399 | # | ||
400 | # Block devices | ||
401 | # | ||
402 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
403 | CONFIG_BLK_DEV_LOOP=y | ||
404 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
405 | # CONFIG_BLK_DEV_NBD is not set | ||
406 | # CONFIG_BLK_DEV_UB is not set | ||
407 | CONFIG_BLK_DEV_RAM=y | ||
408 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
409 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
410 | CONFIG_BLK_DEV_INITRD=y | ||
411 | # CONFIG_CDROM_PKTCDVD is not set | ||
412 | # CONFIG_ATA_OVER_ETH is not set | ||
413 | |||
414 | # | ||
415 | # ATA/ATAPI/MFM/RLL support | ||
416 | # | ||
417 | # CONFIG_IDE is not set | ||
418 | |||
419 | # | ||
420 | # SCSI device support | ||
421 | # | ||
422 | # CONFIG_RAID_ATTRS is not set | ||
423 | CONFIG_SCSI=y | ||
424 | CONFIG_SCSI_PROC_FS=y | ||
425 | |||
426 | # | ||
427 | # SCSI support type (disk, tape, CD-ROM) | ||
428 | # | ||
429 | # CONFIG_BLK_DEV_SD is not set | ||
430 | # CONFIG_CHR_DEV_ST is not set | ||
431 | # CONFIG_CHR_DEV_OSST is not set | ||
432 | # CONFIG_BLK_DEV_SR is not set | ||
433 | # CONFIG_CHR_DEV_SG is not set | ||
434 | # CONFIG_CHR_DEV_SCH is not set | ||
435 | |||
436 | # | ||
437 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
438 | # | ||
439 | # CONFIG_SCSI_MULTI_LUN is not set | ||
440 | # CONFIG_SCSI_CONSTANTS is not set | ||
441 | # CONFIG_SCSI_LOGGING is not set | ||
442 | |||
443 | # | ||
444 | # SCSI Transport Attributes | ||
445 | # | ||
446 | # CONFIG_SCSI_SPI_ATTRS is not set | ||
447 | # CONFIG_SCSI_FC_ATTRS is not set | ||
448 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
449 | # CONFIG_SCSI_SAS_ATTRS is not set | ||
450 | |||
451 | # | ||
452 | # SCSI low-level drivers | ||
453 | # | ||
454 | # CONFIG_ISCSI_TCP is not set | ||
455 | # CONFIG_SCSI_SATA is not set | ||
456 | # CONFIG_SCSI_DEBUG is not set | ||
457 | |||
458 | # | ||
459 | # PCMCIA SCSI adapter support | ||
460 | # | ||
461 | # CONFIG_PCMCIA_AHA152X is not set | ||
462 | # CONFIG_PCMCIA_FDOMAIN is not set | ||
463 | # CONFIG_PCMCIA_NINJA_SCSI is not set | ||
464 | # CONFIG_PCMCIA_QLOGIC is not set | ||
465 | # CONFIG_PCMCIA_SYM53C500 is not set | ||
466 | |||
467 | # | ||
468 | # Multi-device support (RAID and LVM) | ||
469 | # | ||
470 | # CONFIG_MD is not set | ||
471 | |||
472 | # | ||
473 | # Fusion MPT device support | ||
474 | # | ||
475 | # CONFIG_FUSION is not set | ||
476 | |||
477 | # | ||
478 | # IEEE 1394 (FireWire) support | ||
479 | # | ||
480 | |||
481 | # | ||
482 | # I2O device support | ||
483 | # | ||
484 | |||
485 | # | ||
486 | # Network device support | ||
487 | # | ||
488 | CONFIG_NETDEVICES=y | ||
489 | # CONFIG_DUMMY is not set | ||
490 | # CONFIG_BONDING is not set | ||
491 | # CONFIG_EQUALIZER is not set | ||
492 | # CONFIG_TUN is not set | ||
493 | |||
494 | # | ||
495 | # PHY device support | ||
496 | # | ||
497 | # CONFIG_PHYLIB is not set | ||
498 | |||
499 | # | ||
500 | # Ethernet (10 or 100Mbit) | ||
501 | # | ||
502 | CONFIG_NET_ETHERNET=y | ||
503 | CONFIG_MII=y | ||
504 | CONFIG_ARM_AT91_ETHER=y | ||
505 | # CONFIG_SMC91X is not set | ||
506 | # CONFIG_DM9000 is not set | ||
507 | |||
508 | # | ||
509 | # Ethernet (1000 Mbit) | ||
510 | # | ||
511 | |||
512 | # | ||
513 | # Ethernet (10000 Mbit) | ||
514 | # | ||
515 | |||
516 | # | ||
517 | # Token Ring devices | ||
518 | # | ||
519 | |||
520 | # | ||
521 | # Wireless LAN (non-hamradio) | ||
522 | # | ||
523 | # CONFIG_NET_RADIO is not set | ||
524 | |||
525 | # | ||
526 | # PCMCIA network device support | ||
527 | # | ||
528 | # CONFIG_NET_PCMCIA is not set | ||
529 | |||
530 | # | ||
531 | # Wan interfaces | ||
532 | # | ||
533 | # CONFIG_WAN is not set | ||
534 | # CONFIG_PPP is not set | ||
535 | # CONFIG_SLIP is not set | ||
536 | # CONFIG_SHAPER is not set | ||
537 | # CONFIG_NETCONSOLE is not set | ||
538 | # CONFIG_NETPOLL is not set | ||
539 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
540 | |||
541 | # | ||
542 | # ISDN subsystem | ||
543 | # | ||
544 | # CONFIG_ISDN is not set | ||
545 | |||
546 | # | ||
547 | # Input device support | ||
548 | # | ||
549 | CONFIG_INPUT=y | ||
550 | |||
551 | # | ||
552 | # Userland interfaces | ||
553 | # | ||
554 | CONFIG_INPUT_MOUSEDEV=y | ||
555 | CONFIG_INPUT_MOUSEDEV_PSAUX=y | ||
556 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
557 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
558 | # CONFIG_INPUT_JOYDEV is not set | ||
559 | # CONFIG_INPUT_TSDEV is not set | ||
560 | # CONFIG_INPUT_EVDEV is not set | ||
561 | # CONFIG_INPUT_EVBUG is not set | ||
562 | |||
563 | # | ||
564 | # Input Device Drivers | ||
565 | # | ||
566 | # CONFIG_INPUT_KEYBOARD is not set | ||
567 | # CONFIG_INPUT_MOUSE is not set | ||
568 | # CONFIG_INPUT_JOYSTICK is not set | ||
569 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
570 | # CONFIG_INPUT_MISC is not set | ||
571 | |||
572 | # | ||
573 | # Hardware I/O ports | ||
574 | # | ||
575 | # CONFIG_SERIO is not set | ||
576 | # CONFIG_GAMEPORT is not set | ||
577 | |||
578 | # | ||
579 | # Character devices | ||
580 | # | ||
581 | CONFIG_VT=y | ||
582 | CONFIG_VT_CONSOLE=y | ||
583 | CONFIG_HW_CONSOLE=y | ||
584 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
585 | |||
586 | # | ||
587 | # Serial drivers | ||
588 | # | ||
589 | # CONFIG_SERIAL_8250 is not set | ||
590 | |||
591 | # | ||
592 | # Non-8250 serial port support | ||
593 | # | ||
594 | CONFIG_SERIAL_AT91=y | ||
595 | CONFIG_SERIAL_AT91_CONSOLE=y | ||
596 | # CONFIG_SERIAL_AT91_TTYAT is not set | ||
597 | CONFIG_SERIAL_CORE=y | ||
598 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
599 | CONFIG_UNIX98_PTYS=y | ||
600 | CONFIG_LEGACY_PTYS=y | ||
601 | CONFIG_LEGACY_PTY_COUNT=256 | ||
602 | |||
603 | # | ||
604 | # IPMI | ||
605 | # | ||
606 | # CONFIG_IPMI_HANDLER is not set | ||
607 | |||
608 | # | ||
609 | # Watchdog Cards | ||
610 | # | ||
611 | CONFIG_WATCHDOG=y | ||
612 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
613 | |||
614 | # | ||
615 | # Watchdog Device Drivers | ||
616 | # | ||
617 | # CONFIG_SOFT_WATCHDOG is not set | ||
618 | CONFIG_AT91_WATCHDOG=y | ||
619 | |||
620 | # | ||
621 | # USB-based Watchdog Cards | ||
622 | # | ||
623 | # CONFIG_USBPCWATCHDOG is not set | ||
624 | # CONFIG_NVRAM is not set | ||
625 | CONFIG_RTC=y | ||
626 | # CONFIG_AT91_RTC is not set | ||
627 | # CONFIG_DTLK is not set | ||
628 | # CONFIG_R3964 is not set | ||
629 | |||
630 | # | ||
631 | # Ftape, the floppy tape device driver | ||
632 | # | ||
633 | |||
634 | # | ||
635 | # PCMCIA character devices | ||
636 | # | ||
637 | # CONFIG_SYNCLINK_CS is not set | ||
638 | # CONFIG_CARDMAN_4000 is not set | ||
639 | # CONFIG_CARDMAN_4040 is not set | ||
640 | # CONFIG_RAW_DRIVER is not set | ||
641 | |||
642 | # | ||
643 | # TPM devices | ||
644 | # | ||
645 | # CONFIG_TCG_TPM is not set | ||
646 | # CONFIG_TELCLOCK is not set | ||
647 | CONFIG_AT91_SPI=y | ||
648 | CONFIG_AT91_SPIDEV=y | ||
649 | |||
650 | # | ||
651 | # I2C support | ||
652 | # | ||
653 | CONFIG_I2C=y | ||
654 | CONFIG_I2C_CHARDEV=y | ||
655 | |||
656 | # | ||
657 | # I2C Algorithms | ||
658 | # | ||
659 | # CONFIG_I2C_ALGOBIT is not set | ||
660 | # CONFIG_I2C_ALGOPCF is not set | ||
661 | # CONFIG_I2C_ALGOPCA is not set | ||
662 | |||
663 | # | ||
664 | # I2C Hardware Bus support | ||
665 | # | ||
666 | CONFIG_I2C_AT91=y | ||
667 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
668 | # CONFIG_I2C_STUB is not set | ||
669 | # CONFIG_I2C_PCA_ISA is not set | ||
670 | |||
671 | # | ||
672 | # Miscellaneous I2C Chip support | ||
673 | # | ||
674 | # CONFIG_SENSORS_DS1337 is not set | ||
675 | # CONFIG_SENSORS_DS1374 is not set | ||
676 | # CONFIG_SENSORS_EEPROM is not set | ||
677 | # CONFIG_SENSORS_PCF8574 is not set | ||
678 | # CONFIG_SENSORS_PCA9539 is not set | ||
679 | # CONFIG_SENSORS_PCF8591 is not set | ||
680 | # CONFIG_SENSORS_RTC8564 is not set | ||
681 | # CONFIG_SENSORS_MAX6875 is not set | ||
682 | # CONFIG_RTC_X1205_I2C is not set | ||
683 | # CONFIG_I2C_DEBUG_CORE is not set | ||
684 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
685 | # CONFIG_I2C_DEBUG_BUS is not set | ||
686 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
687 | |||
688 | # | ||
689 | # Hardware Monitoring support | ||
690 | # | ||
691 | CONFIG_HWMON=y | ||
692 | # CONFIG_HWMON_VID is not set | ||
693 | # CONFIG_SENSORS_ADM1021 is not set | ||
694 | # CONFIG_SENSORS_ADM1025 is not set | ||
695 | # CONFIG_SENSORS_ADM1026 is not set | ||
696 | # CONFIG_SENSORS_ADM1031 is not set | ||
697 | # CONFIG_SENSORS_ADM9240 is not set | ||
698 | # CONFIG_SENSORS_ASB100 is not set | ||
699 | # CONFIG_SENSORS_ATXP1 is not set | ||
700 | # CONFIG_SENSORS_DS1621 is not set | ||
701 | # CONFIG_SENSORS_FSCHER is not set | ||
702 | # CONFIG_SENSORS_FSCPOS is not set | ||
703 | # CONFIG_SENSORS_GL518SM is not set | ||
704 | # CONFIG_SENSORS_GL520SM is not set | ||
705 | # CONFIG_SENSORS_IT87 is not set | ||
706 | # CONFIG_SENSORS_LM63 is not set | ||
707 | # CONFIG_SENSORS_LM75 is not set | ||
708 | # CONFIG_SENSORS_LM77 is not set | ||
709 | # CONFIG_SENSORS_LM78 is not set | ||
710 | # CONFIG_SENSORS_LM80 is not set | ||
711 | # CONFIG_SENSORS_LM83 is not set | ||
712 | # CONFIG_SENSORS_LM85 is not set | ||
713 | # CONFIG_SENSORS_LM87 is not set | ||
714 | # CONFIG_SENSORS_LM90 is not set | ||
715 | # CONFIG_SENSORS_LM92 is not set | ||
716 | # CONFIG_SENSORS_MAX1619 is not set | ||
717 | # CONFIG_SENSORS_PC87360 is not set | ||
718 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
719 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
720 | # CONFIG_SENSORS_W83781D is not set | ||
721 | # CONFIG_SENSORS_W83792D is not set | ||
722 | # CONFIG_SENSORS_W83L785TS is not set | ||
723 | # CONFIG_SENSORS_W83627HF is not set | ||
724 | # CONFIG_SENSORS_W83627EHF is not set | ||
725 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
726 | |||
727 | # | ||
728 | # Misc devices | ||
729 | # | ||
730 | |||
731 | # | ||
732 | # Multimedia Capabilities Port drivers | ||
733 | # | ||
734 | |||
735 | # | ||
736 | # Multimedia devices | ||
737 | # | ||
738 | # CONFIG_VIDEO_DEV is not set | ||
739 | |||
740 | # | ||
741 | # Digital Video Broadcasting Devices | ||
742 | # | ||
743 | # CONFIG_DVB is not set | ||
744 | |||
745 | # | ||
746 | # Graphics support | ||
747 | # | ||
748 | # CONFIG_FB is not set | ||
749 | |||
750 | # | ||
751 | # Console display driver support | ||
752 | # | ||
753 | # CONFIG_VGA_CONSOLE is not set | ||
754 | CONFIG_DUMMY_CONSOLE=y | ||
755 | |||
756 | # | ||
757 | # Sound | ||
758 | # | ||
759 | # CONFIG_SOUND is not set | ||
760 | |||
761 | # | ||
762 | # USB support | ||
763 | # | ||
764 | CONFIG_USB_ARCH_HAS_HCD=y | ||
765 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
766 | CONFIG_USB=y | ||
767 | CONFIG_USB_DEBUG=y | ||
768 | |||
769 | # | ||
770 | # Miscellaneous USB options | ||
771 | # | ||
772 | CONFIG_USB_DEVICEFS=y | ||
773 | # CONFIG_USB_BANDWIDTH is not set | ||
774 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
775 | # CONFIG_USB_OTG is not set | ||
776 | |||
777 | # | ||
778 | # USB Host Controller Drivers | ||
779 | # | ||
780 | # CONFIG_USB_ISP116X_HCD is not set | ||
781 | CONFIG_USB_OHCI_HCD=y | ||
782 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | ||
783 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
784 | # CONFIG_USB_SL811_HCD is not set | ||
785 | |||
786 | # | ||
787 | # USB Device Class drivers | ||
788 | # | ||
789 | # CONFIG_USB_ACM is not set | ||
790 | # CONFIG_USB_PRINTER is not set | ||
791 | |||
792 | # | ||
793 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | ||
794 | # | ||
795 | |||
796 | # | ||
797 | # may also be needed; see USB_STORAGE Help for more information | ||
798 | # | ||
799 | CONFIG_USB_STORAGE=y | ||
800 | # CONFIG_USB_STORAGE_DEBUG is not set | ||
801 | # CONFIG_USB_STORAGE_DATAFAB is not set | ||
802 | # CONFIG_USB_STORAGE_FREECOM is not set | ||
803 | # CONFIG_USB_STORAGE_DPCM is not set | ||
804 | # CONFIG_USB_STORAGE_USBAT is not set | ||
805 | # CONFIG_USB_STORAGE_SDDR09 is not set | ||
806 | # CONFIG_USB_STORAGE_SDDR55 is not set | ||
807 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | ||
808 | |||
809 | # | ||
810 | # USB Input Devices | ||
811 | # | ||
812 | # CONFIG_USB_HID is not set | ||
813 | |||
814 | # | ||
815 | # USB HID Boot Protocol drivers | ||
816 | # | ||
817 | # CONFIG_USB_KBD is not set | ||
818 | # CONFIG_USB_MOUSE is not set | ||
819 | # CONFIG_USB_AIPTEK is not set | ||
820 | # CONFIG_USB_WACOM is not set | ||
821 | # CONFIG_USB_ACECAD is not set | ||
822 | # CONFIG_USB_KBTAB is not set | ||
823 | # CONFIG_USB_POWERMATE is not set | ||
824 | # CONFIG_USB_MTOUCH is not set | ||
825 | # CONFIG_USB_ITMTOUCH is not set | ||
826 | # CONFIG_USB_EGALAX is not set | ||
827 | # CONFIG_USB_YEALINK is not set | ||
828 | # CONFIG_USB_XPAD is not set | ||
829 | # CONFIG_USB_ATI_REMOTE is not set | ||
830 | # CONFIG_USB_KEYSPAN_REMOTE is not set | ||
831 | # CONFIG_USB_APPLETOUCH is not set | ||
832 | |||
833 | # | ||
834 | # USB Imaging devices | ||
835 | # | ||
836 | # CONFIG_USB_MDC800 is not set | ||
837 | # CONFIG_USB_MICROTEK is not set | ||
838 | |||
839 | # | ||
840 | # USB Multimedia devices | ||
841 | # | ||
842 | # CONFIG_USB_DABUSB is not set | ||
843 | |||
844 | # | ||
845 | # Video4Linux support is needed for USB Multimedia device support | ||
846 | # | ||
847 | |||
848 | # | ||
849 | # USB Network Adapters | ||
850 | # | ||
851 | # CONFIG_USB_CATC is not set | ||
852 | # CONFIG_USB_KAWETH is not set | ||
853 | # CONFIG_USB_PEGASUS is not set | ||
854 | # CONFIG_USB_RTL8150 is not set | ||
855 | # CONFIG_USB_USBNET is not set | ||
856 | CONFIG_USB_MON=y | ||
857 | |||
858 | # | ||
859 | # USB port drivers | ||
860 | # | ||
861 | |||
862 | # | ||
863 | # USB Serial Converter support | ||
864 | # | ||
865 | CONFIG_USB_SERIAL=y | ||
866 | CONFIG_USB_SERIAL_CONSOLE=y | ||
867 | CONFIG_USB_SERIAL_GENERIC=y | ||
868 | # CONFIG_USB_SERIAL_AIRPRIME is not set | ||
869 | # CONFIG_USB_SERIAL_ANYDATA is not set | ||
870 | # CONFIG_USB_SERIAL_BELKIN is not set | ||
871 | # CONFIG_USB_SERIAL_WHITEHEAT is not set | ||
872 | # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set | ||
873 | # CONFIG_USB_SERIAL_CP2101 is not set | ||
874 | # CONFIG_USB_SERIAL_CYPRESS_M8 is not set | ||
875 | # CONFIG_USB_SERIAL_EMPEG is not set | ||
876 | CONFIG_USB_SERIAL_FTDI_SIO=y | ||
877 | # CONFIG_USB_SERIAL_VISOR is not set | ||
878 | # CONFIG_USB_SERIAL_IPAQ is not set | ||
879 | # CONFIG_USB_SERIAL_IR is not set | ||
880 | # CONFIG_USB_SERIAL_EDGEPORT is not set | ||
881 | # CONFIG_USB_SERIAL_EDGEPORT_TI is not set | ||
882 | # CONFIG_USB_SERIAL_GARMIN is not set | ||
883 | # CONFIG_USB_SERIAL_IPW is not set | ||
884 | # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set | ||
885 | CONFIG_USB_SERIAL_KEYSPAN=y | ||
886 | CONFIG_USB_SERIAL_KEYSPAN_MPR=y | ||
887 | CONFIG_USB_SERIAL_KEYSPAN_USA28=y | ||
888 | CONFIG_USB_SERIAL_KEYSPAN_USA28X=y | ||
889 | CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y | ||
890 | CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y | ||
891 | CONFIG_USB_SERIAL_KEYSPAN_USA19=y | ||
892 | CONFIG_USB_SERIAL_KEYSPAN_USA18X=y | ||
893 | CONFIG_USB_SERIAL_KEYSPAN_USA19W=y | ||
894 | CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y | ||
895 | CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y | ||
896 | CONFIG_USB_SERIAL_KEYSPAN_USA49W=y | ||
897 | CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y | ||
898 | # CONFIG_USB_SERIAL_KLSI is not set | ||
899 | # CONFIG_USB_SERIAL_KOBIL_SCT is not set | ||
900 | CONFIG_USB_SERIAL_MCT_U232=y | ||
901 | # CONFIG_USB_SERIAL_PL2303 is not set | ||
902 | # CONFIG_USB_SERIAL_HP4X is not set | ||
903 | # CONFIG_USB_SERIAL_SAFE is not set | ||
904 | # CONFIG_USB_SERIAL_TI is not set | ||
905 | # CONFIG_USB_SERIAL_CYBERJACK is not set | ||
906 | # CONFIG_USB_SERIAL_XIRCOM is not set | ||
907 | # CONFIG_USB_SERIAL_OPTION is not set | ||
908 | # CONFIG_USB_SERIAL_OMNINET is not set | ||
909 | CONFIG_USB_EZUSB=y | ||
910 | |||
911 | # | ||
912 | # USB Miscellaneous drivers | ||
913 | # | ||
914 | # CONFIG_USB_EMI62 is not set | ||
915 | # CONFIG_USB_EMI26 is not set | ||
916 | # CONFIG_USB_AUERSWALD is not set | ||
917 | # CONFIG_USB_RIO500 is not set | ||
918 | # CONFIG_USB_LEGOTOWER is not set | ||
919 | # CONFIG_USB_LCD is not set | ||
920 | # CONFIG_USB_LED is not set | ||
921 | # CONFIG_USB_CYTHERM is not set | ||
922 | # CONFIG_USB_PHIDGETKIT is not set | ||
923 | # CONFIG_USB_PHIDGETSERVO is not set | ||
924 | # CONFIG_USB_IDMOUSE is not set | ||
925 | # CONFIG_USB_LD is not set | ||
926 | # CONFIG_USB_TEST is not set | ||
927 | |||
928 | # | ||
929 | # USB DSL modem support | ||
930 | # | ||
931 | |||
932 | # | ||
933 | # USB Gadget Support | ||
934 | # | ||
935 | # CONFIG_USB_GADGET is not set | ||
936 | |||
937 | # | ||
938 | # MMC/SD Card support | ||
939 | # | ||
940 | # CONFIG_MMC is not set | ||
941 | |||
942 | # | ||
943 | # File systems | ||
944 | # | ||
945 | CONFIG_EXT2_FS=y | ||
946 | # CONFIG_EXT2_FS_XATTR is not set | ||
947 | # CONFIG_EXT2_FS_XIP is not set | ||
948 | # CONFIG_EXT3_FS is not set | ||
949 | # CONFIG_JBD is not set | ||
950 | # CONFIG_REISERFS_FS is not set | ||
951 | # CONFIG_JFS_FS is not set | ||
952 | # CONFIG_FS_POSIX_ACL is not set | ||
953 | # CONFIG_XFS_FS is not set | ||
954 | # CONFIG_MINIX_FS is not set | ||
955 | # CONFIG_ROMFS_FS is not set | ||
956 | CONFIG_INOTIFY=y | ||
957 | # CONFIG_QUOTA is not set | ||
958 | CONFIG_DNOTIFY=y | ||
959 | # CONFIG_AUTOFS_FS is not set | ||
960 | # CONFIG_AUTOFS4_FS is not set | ||
961 | # CONFIG_FUSE_FS is not set | ||
962 | |||
963 | # | ||
964 | # CD-ROM/DVD Filesystems | ||
965 | # | ||
966 | # CONFIG_ISO9660_FS is not set | ||
967 | # CONFIG_UDF_FS is not set | ||
968 | |||
969 | # | ||
970 | # DOS/FAT/NT Filesystems | ||
971 | # | ||
972 | # CONFIG_MSDOS_FS is not set | ||
973 | # CONFIG_VFAT_FS is not set | ||
974 | # CONFIG_NTFS_FS is not set | ||
975 | |||
976 | # | ||
977 | # Pseudo filesystems | ||
978 | # | ||
979 | CONFIG_PROC_FS=y | ||
980 | CONFIG_SYSFS=y | ||
981 | CONFIG_TMPFS=y | ||
982 | # CONFIG_HUGETLB_PAGE is not set | ||
983 | CONFIG_RAMFS=y | ||
984 | # CONFIG_RELAYFS_FS is not set | ||
985 | |||
986 | # | ||
987 | # Miscellaneous filesystems | ||
988 | # | ||
989 | # CONFIG_ADFS_FS is not set | ||
990 | # CONFIG_AFFS_FS is not set | ||
991 | # CONFIG_HFS_FS is not set | ||
992 | # CONFIG_HFSPLUS_FS is not set | ||
993 | # CONFIG_BEFS_FS is not set | ||
994 | # CONFIG_BFS_FS is not set | ||
995 | # CONFIG_EFS_FS is not set | ||
996 | # CONFIG_JFFS_FS is not set | ||
997 | # CONFIG_JFFS2_FS is not set | ||
998 | CONFIG_CRAMFS=y | ||
999 | # CONFIG_VXFS_FS is not set | ||
1000 | # CONFIG_HPFS_FS is not set | ||
1001 | # CONFIG_QNX4FS_FS is not set | ||
1002 | # CONFIG_SYSV_FS is not set | ||
1003 | # CONFIG_UFS_FS is not set | ||
1004 | |||
1005 | # | ||
1006 | # Network File Systems | ||
1007 | # | ||
1008 | CONFIG_NFS_FS=y | ||
1009 | CONFIG_NFS_V3=y | ||
1010 | # CONFIG_NFS_V3_ACL is not set | ||
1011 | CONFIG_NFS_V4=y | ||
1012 | # CONFIG_NFS_DIRECTIO is not set | ||
1013 | # CONFIG_NFSD is not set | ||
1014 | CONFIG_ROOT_NFS=y | ||
1015 | CONFIG_LOCKD=y | ||
1016 | CONFIG_LOCKD_V4=y | ||
1017 | CONFIG_NFS_COMMON=y | ||
1018 | CONFIG_SUNRPC=y | ||
1019 | CONFIG_SUNRPC_GSS=y | ||
1020 | CONFIG_RPCSEC_GSS_KRB5=y | ||
1021 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
1022 | # CONFIG_SMB_FS is not set | ||
1023 | # CONFIG_CIFS is not set | ||
1024 | # CONFIG_NCP_FS is not set | ||
1025 | # CONFIG_CODA_FS is not set | ||
1026 | # CONFIG_AFS_FS is not set | ||
1027 | # CONFIG_9P_FS is not set | ||
1028 | |||
1029 | # | ||
1030 | # Partition Types | ||
1031 | # | ||
1032 | # CONFIG_PARTITION_ADVANCED is not set | ||
1033 | CONFIG_MSDOS_PARTITION=y | ||
1034 | |||
1035 | # | ||
1036 | # Native Language Support | ||
1037 | # | ||
1038 | # CONFIG_NLS is not set | ||
1039 | |||
1040 | # | ||
1041 | # Profiling support | ||
1042 | # | ||
1043 | # CONFIG_PROFILING is not set | ||
1044 | |||
1045 | # | ||
1046 | # Kernel hacking | ||
1047 | # | ||
1048 | # CONFIG_PRINTK_TIME is not set | ||
1049 | CONFIG_DEBUG_KERNEL=y | ||
1050 | # CONFIG_MAGIC_SYSRQ is not set | ||
1051 | CONFIG_LOG_BUF_SHIFT=14 | ||
1052 | CONFIG_DETECT_SOFTLOCKUP=y | ||
1053 | # CONFIG_SCHEDSTATS is not set | ||
1054 | # CONFIG_DEBUG_SLAB is not set | ||
1055 | # CONFIG_DEBUG_SPINLOCK is not set | ||
1056 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
1057 | # CONFIG_DEBUG_KOBJECT is not set | ||
1058 | CONFIG_DEBUG_BUGVERBOSE=y | ||
1059 | # CONFIG_DEBUG_INFO is not set | ||
1060 | # CONFIG_DEBUG_FS is not set | ||
1061 | # CONFIG_DEBUG_VM is not set | ||
1062 | CONFIG_FRAME_POINTER=y | ||
1063 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1064 | CONFIG_DEBUG_USER=y | ||
1065 | # CONFIG_DEBUG_WAITQ is not set | ||
1066 | # CONFIG_DEBUG_ERRORS is not set | ||
1067 | CONFIG_DEBUG_LL=y | ||
1068 | # CONFIG_DEBUG_ICEDCC is not set | ||
1069 | |||
1070 | # | ||
1071 | # Security options | ||
1072 | # | ||
1073 | # CONFIG_KEYS is not set | ||
1074 | # CONFIG_SECURITY is not set | ||
1075 | |||
1076 | # | ||
1077 | # Cryptographic options | ||
1078 | # | ||
1079 | CONFIG_CRYPTO=y | ||
1080 | # CONFIG_CRYPTO_HMAC is not set | ||
1081 | # CONFIG_CRYPTO_NULL is not set | ||
1082 | # CONFIG_CRYPTO_MD4 is not set | ||
1083 | CONFIG_CRYPTO_MD5=y | ||
1084 | # CONFIG_CRYPTO_SHA1 is not set | ||
1085 | # CONFIG_CRYPTO_SHA256 is not set | ||
1086 | # CONFIG_CRYPTO_SHA512 is not set | ||
1087 | # CONFIG_CRYPTO_WP512 is not set | ||
1088 | # CONFIG_CRYPTO_TGR192 is not set | ||
1089 | CONFIG_CRYPTO_DES=y | ||
1090 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
1091 | # CONFIG_CRYPTO_TWOFISH is not set | ||
1092 | # CONFIG_CRYPTO_SERPENT is not set | ||
1093 | # CONFIG_CRYPTO_AES is not set | ||
1094 | # CONFIG_CRYPTO_CAST5 is not set | ||
1095 | # CONFIG_CRYPTO_CAST6 is not set | ||
1096 | # CONFIG_CRYPTO_TEA is not set | ||
1097 | # CONFIG_CRYPTO_ARC4 is not set | ||
1098 | # CONFIG_CRYPTO_KHAZAD is not set | ||
1099 | # CONFIG_CRYPTO_ANUBIS is not set | ||
1100 | # CONFIG_CRYPTO_DEFLATE is not set | ||
1101 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
1102 | # CONFIG_CRYPTO_CRC32C is not set | ||
1103 | # CONFIG_CRYPTO_TEST is not set | ||
1104 | |||
1105 | # | ||
1106 | # Hardware crypto devices | ||
1107 | # | ||
1108 | |||
1109 | # | ||
1110 | # Library routines | ||
1111 | # | ||
1112 | # CONFIG_CRC_CCITT is not set | ||
1113 | # CONFIG_CRC16 is not set | ||
1114 | CONFIG_CRC32=y | ||
1115 | # CONFIG_LIBCRC32C is not set | ||
1116 | CONFIG_ZLIB_INFLATE=y | ||
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index dceb826bd216..96fd91926c9b 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
41 | #include <linux/device.h> | 41 | #include <linux/device.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | #include <asm/dma.h> | 45 | #include <asm/dma.h> |
45 | #include <asm/ecard.h> | 46 | #include <asm/ecard.h> |
@@ -206,7 +207,7 @@ static void ecard_task_readbytes(struct ecard_request *req) | |||
206 | 207 | ||
207 | static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); | 208 | static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); |
208 | static struct ecard_request *ecard_req; | 209 | static struct ecard_request *ecard_req; |
209 | static DECLARE_MUTEX(ecard_sem); | 210 | static DEFINE_MUTEX(ecard_mutex); |
210 | 211 | ||
211 | /* | 212 | /* |
212 | * Set up the expansion card daemon's page tables. | 213 | * Set up the expansion card daemon's page tables. |
@@ -299,7 +300,7 @@ static void ecard_call(struct ecard_request *req) | |||
299 | 300 | ||
300 | req->complete = &completion; | 301 | req->complete = &completion; |
301 | 302 | ||
302 | down(&ecard_sem); | 303 | mutex_lock(&ecard_mutex); |
303 | ecard_req = req; | 304 | ecard_req = req; |
304 | wake_up(&ecard_wait); | 305 | wake_up(&ecard_wait); |
305 | 306 | ||
@@ -307,7 +308,7 @@ static void ecard_call(struct ecard_request *req) | |||
307 | * Now wait for kecardd to run. | 308 | * Now wait for kecardd to run. |
308 | */ | 309 | */ |
309 | wait_for_completion(&completion); | 310 | wait_for_completion(&completion); |
310 | up(&ecard_sem); | 311 | mutex_unlock(&ecard_mutex); |
311 | } | 312 | } |
312 | 313 | ||
313 | /* ======================= Mid-level card control ===================== */ | 314 | /* ======================= Mid-level card control ===================== */ |
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 9299dfc25698..1ec3f7faa259 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c | |||
@@ -101,7 +101,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs) | |||
101 | ldmia %1, {r8 - r14}\n\ | 101 | ldmia %1, {r8 - r14}\n\ |
102 | msr cpsr_c, %0 @ return to SVC mode\n\ | 102 | msr cpsr_c, %0 @ return to SVC mode\n\ |
103 | mov r0, r0\n\ | 103 | mov r0, r0\n\ |
104 | ldmea fp, {fp, sp, pc}" | 104 | ldmfd sp, {fp, sp, pc}" |
105 | : "=&r" (tmp) | 105 | : "=&r" (tmp) |
106 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); | 106 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); |
107 | } | 107 | } |
@@ -119,7 +119,7 @@ void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs) | |||
119 | stmia %1, {r8 - r14}\n\ | 119 | stmia %1, {r8 - r14}\n\ |
120 | msr cpsr_c, %0 @ return to SVC mode\n\ | 120 | msr cpsr_c, %0 @ return to SVC mode\n\ |
121 | mov r0, r0\n\ | 121 | mov r0, r0\n\ |
122 | ldmea fp, {fp, sp, pc}" | 122 | ldmfd sp, {fp, sp, pc}" |
123 | : "=&r" (tmp) | 123 | : "=&r" (tmp) |
124 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); | 124 | : "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); |
125 | } | 125 | } |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 2cab741ad0f8..c45d10d07bde 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -205,7 +205,7 @@ static const char *proc_arch[] = { | |||
205 | "5TE", | 205 | "5TE", |
206 | "5TEJ", | 206 | "5TEJ", |
207 | "6TEJ", | 207 | "6TEJ", |
208 | "?(10)", | 208 | "7", |
209 | "?(11)", | 209 | "?(11)", |
210 | "?(12)", | 210 | "?(12)", |
211 | "?(13)", | 211 | "?(13)", |
@@ -258,14 +258,17 @@ int cpu_architecture(void) | |||
258 | { | 258 | { |
259 | int cpu_arch; | 259 | int cpu_arch; |
260 | 260 | ||
261 | if ((processor_id & 0x0000f000) == 0) { | 261 | if ((processor_id & 0x0008f000) == 0) { |
262 | cpu_arch = CPU_ARCH_UNKNOWN; | 262 | cpu_arch = CPU_ARCH_UNKNOWN; |
263 | } else if ((processor_id & 0x0000f000) == 0x00007000) { | 263 | } else if ((processor_id & 0x0008f000) == 0x00007000) { |
264 | cpu_arch = (processor_id & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3; | 264 | cpu_arch = (processor_id & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3; |
265 | } else { | 265 | } else if ((processor_id & 0x00080000) == 0x00000000) { |
266 | cpu_arch = (processor_id >> 16) & 7; | 266 | cpu_arch = (processor_id >> 16) & 7; |
267 | if (cpu_arch) | 267 | if (cpu_arch) |
268 | cpu_arch += CPU_ARCH_ARMv3; | 268 | cpu_arch += CPU_ARCH_ARMv3; |
269 | } else { | ||
270 | /* the revised CPUID */ | ||
271 | cpu_arch = ((processor_id >> 12) & 0xf) - 0xb + CPU_ARCH_ARMv6; | ||
269 | } | 272 | } |
270 | 273 | ||
271 | return cpu_arch; | 274 | return cpu_arch; |
@@ -863,11 +866,11 @@ static int c_show(struct seq_file *m, void *v) | |||
863 | seq_printf(m, "\nCPU implementer\t: 0x%02x\n", processor_id >> 24); | 866 | seq_printf(m, "\nCPU implementer\t: 0x%02x\n", processor_id >> 24); |
864 | seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); | 867 | seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); |
865 | 868 | ||
866 | if ((processor_id & 0x0000f000) == 0x00000000) { | 869 | if ((processor_id & 0x0008f000) == 0x00000000) { |
867 | /* pre-ARM7 */ | 870 | /* pre-ARM7 */ |
868 | seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4); | 871 | seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4); |
869 | } else { | 872 | } else { |
870 | if ((processor_id & 0x0000f000) == 0x00007000) { | 873 | if ((processor_id & 0x0008f000) == 0x00007000) { |
871 | /* ARM7 */ | 874 | /* ARM7 */ |
872 | seq_printf(m, "CPU variant\t: 0x%02x\n", | 875 | seq_printf(m, "CPU variant\t: 0x%02x\n", |
873 | (processor_id >> 16) & 127); | 876 | (processor_id >> 16) & 127); |
diff --git a/arch/arm/lib/csumpartialcopy.S b/arch/arm/lib/csumpartialcopy.S index 990ee63b2465..21effe0dbf97 100644 --- a/arch/arm/lib/csumpartialcopy.S +++ b/arch/arm/lib/csumpartialcopy.S | |||
@@ -18,11 +18,13 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | .macro save_regs | 20 | .macro save_regs |
21 | mov ip, sp | ||
21 | stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc} | 22 | stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc} |
23 | sub fp, ip, #4 | ||
22 | .endm | 24 | .endm |
23 | 25 | ||
24 | .macro load_regs,flags | 26 | .macro load_regs |
25 | LOADREGS(\flags,fp,{r1, r4 - r8, fp, sp, pc}) | 27 | ldmfd sp, {r1, r4 - r8, fp, sp, pc} |
26 | .endm | 28 | .endm |
27 | 29 | ||
28 | .macro load1b, reg1 | 30 | .macro load1b, reg1 |
diff --git a/arch/arm/lib/csumpartialcopygeneric.S b/arch/arm/lib/csumpartialcopygeneric.S index 4a4609c19095..c50e8f5285d1 100644 --- a/arch/arm/lib/csumpartialcopygeneric.S +++ b/arch/arm/lib/csumpartialcopygeneric.S | |||
@@ -23,7 +23,7 @@ len .req r2 | |||
23 | sum .req r3 | 23 | sum .req r3 |
24 | 24 | ||
25 | .Lzero: mov r0, sum | 25 | .Lzero: mov r0, sum |
26 | load_regs ea | 26 | load_regs |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Align an unaligned destination pointer. We know that | 29 | * Align an unaligned destination pointer. We know that |
@@ -87,9 +87,7 @@ sum .req r3 | |||
87 | b .Ldone | 87 | b .Ldone |
88 | 88 | ||
89 | FN_ENTRY | 89 | FN_ENTRY |
90 | mov ip, sp | ||
91 | save_regs | 90 | save_regs |
92 | sub fp, ip, #4 | ||
93 | 91 | ||
94 | cmp len, #8 @ Ensure that we have at least | 92 | cmp len, #8 @ Ensure that we have at least |
95 | blo .Lless8 @ 8 bytes to copy. | 93 | blo .Lless8 @ 8 bytes to copy. |
@@ -163,7 +161,7 @@ FN_ENTRY | |||
163 | ldr sum, [sp, #0] @ dst | 161 | ldr sum, [sp, #0] @ dst |
164 | tst sum, #1 | 162 | tst sum, #1 |
165 | movne r0, r0, ror #8 | 163 | movne r0, r0, ror #8 |
166 | load_regs ea | 164 | load_regs |
167 | 165 | ||
168 | .Lsrc_not_aligned: | 166 | .Lsrc_not_aligned: |
169 | adc sum, sum, #0 @ include C from dst alignment | 167 | adc sum, sum, #0 @ include C from dst alignment |
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S index 333bca292de9..c3b93e22ea25 100644 --- a/arch/arm/lib/csumpartialcopyuser.S +++ b/arch/arm/lib/csumpartialcopyuser.S | |||
@@ -18,11 +18,13 @@ | |||
18 | .text | 18 | .text |
19 | 19 | ||
20 | .macro save_regs | 20 | .macro save_regs |
21 | mov ip, sp | ||
21 | stmfd sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc} | 22 | stmfd sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc} |
23 | sub fp, ip, #4 | ||
22 | .endm | 24 | .endm |
23 | 25 | ||
24 | .macro load_regs,flags | 26 | .macro load_regs |
25 | ldm\flags fp, {r1, r2, r4-r8, fp, sp, pc} | 27 | ldmfd sp, {r1, r2, r4-r8, fp, sp, pc} |
26 | .endm | 28 | .endm |
27 | 29 | ||
28 | .macro load1b, reg1 | 30 | .macro load1b, reg1 |
@@ -100,5 +102,5 @@ | |||
100 | 6002: teq r2, r1 | 102 | 6002: teq r2, r1 |
101 | strneb r0, [r1], #1 | 103 | strneb r0, [r1], #1 |
102 | bne 6002b | 104 | bne 6002b |
103 | load_regs ea | 105 | load_regs |
104 | .previous | 106 | .previous |
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c index 1c84c60941e1..74aa7a39bb68 100644 --- a/arch/arm/mach-aaec2000/clock.c +++ b/arch/arm/mach-aaec2000/clock.c | |||
@@ -16,26 +16,27 @@ | |||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/mutex.h> | ||
19 | 20 | ||
20 | #include <asm/semaphore.h> | 21 | #include <asm/semaphore.h> |
21 | 22 | ||
22 | #include "clock.h" | 23 | #include "clock.h" |
23 | 24 | ||
24 | static LIST_HEAD(clocks); | 25 | static LIST_HEAD(clocks); |
25 | static DECLARE_MUTEX(clocks_sem); | 26 | static DEFINE_MUTEX(clocks_mutex); |
26 | 27 | ||
27 | struct clk *clk_get(struct device *dev, const char *id) | 28 | struct clk *clk_get(struct device *dev, const char *id) |
28 | { | 29 | { |
29 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 30 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
30 | 31 | ||
31 | down(&clocks_sem); | 32 | mutex_lock(&clocks_mutex); |
32 | list_for_each_entry(p, &clocks, node) { | 33 | list_for_each_entry(p, &clocks, node) { |
33 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 34 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
34 | clk = p; | 35 | clk = p; |
35 | break; | 36 | break; |
36 | } | 37 | } |
37 | } | 38 | } |
38 | up(&clocks_sem); | 39 | mutex_unlock(&clocks_mutex); |
39 | 40 | ||
40 | return clk; | 41 | return clk; |
41 | } | 42 | } |
@@ -78,18 +79,18 @@ EXPORT_SYMBOL(clk_set_rate); | |||
78 | 79 | ||
79 | int clk_register(struct clk *clk) | 80 | int clk_register(struct clk *clk) |
80 | { | 81 | { |
81 | down(&clocks_sem); | 82 | mutex_lock(&clocks_mutex); |
82 | list_add(&clk->node, &clocks); | 83 | list_add(&clk->node, &clocks); |
83 | up(&clocks_sem); | 84 | mutex_unlock(&clocks_mutex); |
84 | return 0; | 85 | return 0; |
85 | } | 86 | } |
86 | EXPORT_SYMBOL(clk_register); | 87 | EXPORT_SYMBOL(clk_register); |
87 | 88 | ||
88 | void clk_unregister(struct clk *clk) | 89 | void clk_unregister(struct clk *clk) |
89 | { | 90 | { |
90 | down(&clocks_sem); | 91 | mutex_lock(&clocks_mutex); |
91 | list_del(&clk->node); | 92 | list_del(&clk->node); |
92 | up(&clocks_sem); | 93 | mutex_unlock(&clocks_mutex); |
93 | } | 94 | } |
94 | EXPORT_SYMBOL(clk_unregister); | 95 | EXPORT_SYMBOL(clk_unregister); |
95 | 96 | ||
diff --git a/arch/arm/mach-at91rm9200/Makefile b/arch/arm/mach-at91rm9200/Makefile index 1f2805ca6e21..75e6ee318ded 100644 --- a/arch/arm/mach-at91rm9200/Makefile +++ b/arch/arm/mach-at91rm9200/Makefile | |||
@@ -8,10 +8,10 @@ obj-n := | |||
8 | obj- := | 8 | obj- := |
9 | 9 | ||
10 | # Board-specific support | 10 | # Board-specific support |
11 | #obj-$(CONFIG_ARCH_AT91RM9200DK) += board-dk.o | 11 | obj-$(CONFIG_ARCH_AT91RM9200DK) += board-dk.o |
12 | #obj-$(CONFIG_MACH_AT91RM9200EK) += board-ek.o | 12 | obj-$(CONFIG_MACH_AT91RM9200EK) += board-ek.o |
13 | #obj-$(CONFIG_MACH_CSB337) += board-csb337.o | 13 | obj-$(CONFIG_MACH_CSB337) += board-csb337.o |
14 | #obj-$(CONFIG_MACH_CSB637) += board-csb637.o | 14 | obj-$(CONFIG_MACH_CSB637) += board-csb637.o |
15 | #obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o | 15 | #obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o |
16 | #obj-$(CONFIG_MACH_KB9200) += board-kb9202.o | 16 | #obj-$(CONFIG_MACH_KB9200) += board-kb9202.o |
17 | 17 | ||
diff --git a/arch/arm/mach-at91rm9200/board-csb337.c b/arch/arm/mach-at91rm9200/board-csb337.c new file mode 100644 index 000000000000..4aec834ee47f --- /dev/null +++ b/arch/arm/mach-at91rm9200/board-csb337.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91rm9200/board-csb337.c | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
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 | #include <linux/config.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #include <asm/hardware.h> | ||
29 | #include <asm/setup.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | #include <asm/mach/irq.h> | ||
36 | |||
37 | #include <asm/arch/hardware.h> | ||
38 | #include <asm/mach/serial_at91rm9200.h> | ||
39 | #include <asm/arch/board.h> | ||
40 | |||
41 | #include "generic.h" | ||
42 | |||
43 | static void __init csb337_init_irq(void) | ||
44 | { | ||
45 | /* Initialize AIC controller */ | ||
46 | at91rm9200_init_irq(NULL); | ||
47 | |||
48 | /* Set up the GPIO interrupts */ | ||
49 | at91_gpio_irq_setup(BGA_GPIO_BANKS); | ||
50 | } | ||
51 | |||
52 | /* | ||
53 | * Serial port configuration. | ||
54 | * 0 .. 3 = USART0 .. USART3 | ||
55 | * 4 = DBGU | ||
56 | */ | ||
57 | #define CSB337_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ | ||
58 | #define CSB337_SERIAL_CONSOLE 0 /* ttyS0 */ | ||
59 | |||
60 | static void __init csb337_map_io(void) | ||
61 | { | ||
62 | int serial[AT91_NR_UART] = CSB337_UART_MAP; | ||
63 | int i; | ||
64 | |||
65 | at91rm9200_map_io(); | ||
66 | |||
67 | /* Initialize clocks: 3.6864 MHz crystal */ | ||
68 | at91_clock_init(3686400); | ||
69 | |||
70 | #ifdef CONFIG_SERIAL_AT91 | ||
71 | at91_console_port = CSB337_SERIAL_CONSOLE; | ||
72 | memcpy(at91_serial_map, serial, sizeof(serial)); | ||
73 | |||
74 | /* Register UARTs */ | ||
75 | for (i = 0; i < AT91_NR_UART; i++) { | ||
76 | if (serial[i] >= 0) | ||
77 | at91_register_uart(i, serial[i]); | ||
78 | } | ||
79 | #endif | ||
80 | } | ||
81 | |||
82 | static struct at91_eth_data __initdata csb337_eth_data = { | ||
83 | .phy_irq_pin = AT91_PIN_PC2, | ||
84 | .is_rmii = 0, | ||
85 | }; | ||
86 | |||
87 | static struct at91_usbh_data __initdata csb337_usbh_data = { | ||
88 | .ports = 2, | ||
89 | }; | ||
90 | |||
91 | static struct at91_udc_data __initdata csb337_udc_data = { | ||
92 | // this has no VBUS sensing pin | ||
93 | .pullup_pin = AT91_PIN_PA24, | ||
94 | }; | ||
95 | |||
96 | static struct at91_cf_data __initdata csb337_cf_data = { | ||
97 | /* | ||
98 | * connector P4 on the CSB 337 mates to | ||
99 | * connector P8 on the CSB 300CF | ||
100 | */ | ||
101 | |||
102 | /* CSB337 specific */ | ||
103 | .det_pin = AT91_PIN_PC3, | ||
104 | |||
105 | /* CSB300CF specific */ | ||
106 | .irq_pin = AT91_PIN_PA19, | ||
107 | .vcc_pin = AT91_PIN_PD0, | ||
108 | .rst_pin = AT91_PIN_PD2, | ||
109 | }; | ||
110 | |||
111 | static struct at91_mmc_data __initdata csb337_mmc_data = { | ||
112 | .det_pin = AT91_PIN_PD5, | ||
113 | .is_b = 0, | ||
114 | .wire4 = 1, | ||
115 | .wp_pin = AT91_PIN_PD6, | ||
116 | }; | ||
117 | |||
118 | static void __init csb337_board_init(void) | ||
119 | { | ||
120 | /* Ethernet */ | ||
121 | at91_add_device_eth(&csb337_eth_data); | ||
122 | /* USB Host */ | ||
123 | at91_add_device_usbh(&csb337_usbh_data); | ||
124 | /* USB Device */ | ||
125 | at91_add_device_udc(&csb337_udc_data); | ||
126 | /* Compact Flash */ | ||
127 | at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ | ||
128 | at91_add_device_cf(&csb337_cf_data); | ||
129 | /* MMC */ | ||
130 | at91_add_device_mmc(&csb337_mmc_data); | ||
131 | } | ||
132 | |||
133 | MACHINE_START(CSB337, "Cogent CSB337") | ||
134 | /* Maintainer: Bill Gatliff */ | ||
135 | .phys_ram = AT91_SDRAM_BASE, | ||
136 | .phys_io = AT91_BASE_SYS, | ||
137 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | ||
138 | .boot_params = AT91_SDRAM_BASE + 0x100, | ||
139 | .timer = &at91rm9200_timer, | ||
140 | .map_io = csb337_map_io, | ||
141 | .init_irq = csb337_init_irq, | ||
142 | .init_machine = csb337_board_init, | ||
143 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91rm9200/board-csb637.c b/arch/arm/mach-at91rm9200/board-csb637.c new file mode 100644 index 000000000000..23e4cc21481a --- /dev/null +++ b/arch/arm/mach-at91rm9200/board-csb637.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91rm9200/board-csb637.c | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
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 | #include <linux/config.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #include <asm/hardware.h> | ||
29 | #include <asm/setup.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | #include <asm/mach/irq.h> | ||
36 | |||
37 | #include <asm/arch/hardware.h> | ||
38 | #include <asm/mach/serial_at91rm9200.h> | ||
39 | #include <asm/arch/board.h> | ||
40 | |||
41 | #include "generic.h" | ||
42 | |||
43 | static void __init csb637_init_irq(void) | ||
44 | { | ||
45 | /* Initialize AIC controller */ | ||
46 | at91rm9200_init_irq(NULL); | ||
47 | |||
48 | /* Set up the GPIO interrupts */ | ||
49 | at91_gpio_irq_setup(BGA_GPIO_BANKS); | ||
50 | } | ||
51 | |||
52 | /* | ||
53 | * Serial port configuration. | ||
54 | * 0 .. 3 = USART0 .. USART3 | ||
55 | * 4 = DBGU | ||
56 | */ | ||
57 | #define CSB637_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ | ||
58 | #define CSB637_SERIAL_CONSOLE 0 /* ttyS0 */ | ||
59 | |||
60 | static void __init csb637_map_io(void) | ||
61 | { | ||
62 | int serial[AT91_NR_UART] = CSB637_UART_MAP; | ||
63 | int i; | ||
64 | |||
65 | at91rm9200_map_io(); | ||
66 | |||
67 | /* Initialize clocks: 3.6864 MHz crystal */ | ||
68 | at91_clock_init(3686400); | ||
69 | |||
70 | #ifdef CONFIG_SERIAL_AT91 | ||
71 | at91_console_port = CSB637_SERIAL_CONSOLE; | ||
72 | memcpy(at91_serial_map, serial, sizeof(serial)); | ||
73 | |||
74 | /* Register UARTs */ | ||
75 | for (i = 0; i < AT91_NR_UART; i++) { | ||
76 | if (serial[i] >= 0) | ||
77 | at91_register_uart(i, serial[i]); | ||
78 | } | ||
79 | #endif | ||
80 | } | ||
81 | |||
82 | static struct at91_eth_data __initdata csb637_eth_data = { | ||
83 | .phy_irq_pin = AT91_PIN_PC0, | ||
84 | .is_rmii = 0, | ||
85 | }; | ||
86 | |||
87 | static struct at91_usbh_data __initdata csb637_usbh_data = { | ||
88 | .ports = 2, | ||
89 | }; | ||
90 | |||
91 | static struct at91_udc_data __initdata csb637_udc_data = { | ||
92 | .vbus_pin = AT91_PIN_PB28, | ||
93 | .pullup_pin = AT91_PIN_PB1, | ||
94 | }; | ||
95 | |||
96 | static void __init csb637_board_init(void) | ||
97 | { | ||
98 | /* Ethernet */ | ||
99 | at91_add_device_eth(&csb637_eth_data); | ||
100 | /* USB Host */ | ||
101 | at91_add_device_usbh(&csb637_usbh_data); | ||
102 | /* USB Device */ | ||
103 | at91_add_device_udc(&csb637_udc_data); | ||
104 | } | ||
105 | |||
106 | MACHINE_START(CSB637, "Cogent CSB637") | ||
107 | /* Maintainer: Bill Gatliff */ | ||
108 | .phys_ram = AT91_SDRAM_BASE, | ||
109 | .phys_io = AT91_BASE_SYS, | ||
110 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | ||
111 | .boot_params = AT91_SDRAM_BASE + 0x100, | ||
112 | .timer = &at91rm9200_timer, | ||
113 | .map_io = csb637_map_io, | ||
114 | .init_irq = csb637_init_irq, | ||
115 | .init_machine = csb637_board_init, | ||
116 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91rm9200/board-dk.c b/arch/arm/mach-at91rm9200/board-dk.c new file mode 100644 index 000000000000..8c747a31b95a --- /dev/null +++ b/arch/arm/mach-at91rm9200/board-dk.c | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91rm9200/board-dk.c | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * | ||
6 | * Epson S1D framebuffer glue code is: | ||
7 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/config.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | |||
31 | #include <asm/hardware.h> | ||
32 | #include <asm/setup.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | #include <asm/irq.h> | ||
35 | |||
36 | #include <asm/mach/arch.h> | ||
37 | #include <asm/mach/map.h> | ||
38 | #include <asm/mach/irq.h> | ||
39 | |||
40 | #include <asm/arch/hardware.h> | ||
41 | #include <asm/mach/serial_at91rm9200.h> | ||
42 | #include <asm/arch/board.h> | ||
43 | |||
44 | #include "generic.h" | ||
45 | |||
46 | static void __init dk_init_irq(void) | ||
47 | { | ||
48 | /* Initialize AIC controller */ | ||
49 | at91rm9200_init_irq(NULL); | ||
50 | |||
51 | /* Set up the GPIO interrupts */ | ||
52 | at91_gpio_irq_setup(BGA_GPIO_BANKS); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Serial port configuration. | ||
57 | * 0 .. 3 = USART0 .. USART3 | ||
58 | * 4 = DBGU | ||
59 | */ | ||
60 | #define DK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ | ||
61 | #define DK_SERIAL_CONSOLE 0 /* ttyS0 */ | ||
62 | |||
63 | static void __init dk_map_io(void) | ||
64 | { | ||
65 | int serial[AT91_NR_UART] = DK_UART_MAP; | ||
66 | int i; | ||
67 | |||
68 | at91rm9200_map_io(); | ||
69 | |||
70 | /* Initialize clocks: 18.432 MHz crystal */ | ||
71 | at91_clock_init(18432000); | ||
72 | |||
73 | #ifdef CONFIG_SERIAL_AT91 | ||
74 | at91_console_port = DK_SERIAL_CONSOLE; | ||
75 | memcpy(at91_serial_map, serial, sizeof(serial)); | ||
76 | |||
77 | /* Register UARTs */ | ||
78 | for (i = 0; i < AT91_NR_UART; i++) { | ||
79 | if (at91_serial_map[i] >= 0) | ||
80 | at91_register_uart(i, at91_serial_map[i]); | ||
81 | } | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | static struct at91_eth_data __initdata dk_eth_data = { | ||
86 | .phy_irq_pin = AT91_PIN_PC4, | ||
87 | .is_rmii = 1, | ||
88 | }; | ||
89 | |||
90 | static struct at91_usbh_data __initdata dk_usbh_data = { | ||
91 | .ports = 2, | ||
92 | }; | ||
93 | |||
94 | static struct at91_udc_data __initdata dk_udc_data = { | ||
95 | .vbus_pin = AT91_PIN_PD4, | ||
96 | .pullup_pin = AT91_PIN_PD5, | ||
97 | }; | ||
98 | |||
99 | static struct at91_cf_data __initdata dk_cf_data = { | ||
100 | .det_pin = AT91_PIN_PB0, | ||
101 | .rst_pin = AT91_PIN_PC5, | ||
102 | // .irq_pin = ... not connected | ||
103 | // .vcc_pin = ... always powered | ||
104 | }; | ||
105 | |||
106 | static struct at91_mmc_data __initdata dk_mmc_data = { | ||
107 | .is_b = 0, | ||
108 | .wire4 = 1, | ||
109 | }; | ||
110 | |||
111 | static void __init dk_board_init(void) | ||
112 | { | ||
113 | /* Ethernet */ | ||
114 | at91_add_device_eth(&dk_eth_data); | ||
115 | /* USB Host */ | ||
116 | at91_add_device_usbh(&dk_usbh_data); | ||
117 | /* USB Device */ | ||
118 | at91_add_device_udc(&dk_udc_data); | ||
119 | /* Compact Flash */ | ||
120 | at91_add_device_cf(&dk_cf_data); | ||
121 | /* MMC */ | ||
122 | at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */ | ||
123 | at91_add_device_mmc(&dk_mmc_data); | ||
124 | /* VGA */ | ||
125 | // dk_add_device_video(); | ||
126 | } | ||
127 | |||
128 | MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK") | ||
129 | /* Maintainer: SAN People/Atmel */ | ||
130 | .phys_ram = AT91_SDRAM_BASE, | ||
131 | .phys_io = AT91_BASE_SYS, | ||
132 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | ||
133 | .boot_params = AT91_SDRAM_BASE + 0x100, | ||
134 | .timer = &at91rm9200_timer, | ||
135 | .map_io = dk_map_io, | ||
136 | .init_irq = dk_init_irq, | ||
137 | .init_machine = dk_board_init, | ||
138 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91rm9200/board-ek.c b/arch/arm/mach-at91rm9200/board-ek.c new file mode 100644 index 000000000000..d140645711be --- /dev/null +++ b/arch/arm/mach-at91rm9200/board-ek.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91rm9200/board-ek.c | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * | ||
6 | * Epson S1D framebuffer glue code is: | ||
7 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/config.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | |||
31 | #include <asm/hardware.h> | ||
32 | #include <asm/setup.h> | ||
33 | #include <asm/mach-types.h> | ||
34 | #include <asm/irq.h> | ||
35 | |||
36 | #include <asm/mach/arch.h> | ||
37 | #include <asm/mach/map.h> | ||
38 | #include <asm/mach/irq.h> | ||
39 | |||
40 | #include <asm/arch/hardware.h> | ||
41 | #include <asm/mach/serial_at91rm9200.h> | ||
42 | #include <asm/arch/board.h> | ||
43 | |||
44 | #include "generic.h" | ||
45 | |||
46 | static void __init ek_init_irq(void) | ||
47 | { | ||
48 | /* Initialize AIC controller */ | ||
49 | at91rm9200_init_irq(NULL); | ||
50 | |||
51 | /* Set up the GPIO interrupts */ | ||
52 | at91_gpio_irq_setup(BGA_GPIO_BANKS); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Serial port configuration. | ||
57 | * 0 .. 3 = USART0 .. USART3 | ||
58 | * 4 = DBGU | ||
59 | */ | ||
60 | #define EK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ | ||
61 | #define EK_SERIAL_CONSOLE 0 /* ttyS0 */ | ||
62 | |||
63 | static void __init ek_map_io(void) | ||
64 | { | ||
65 | int serial[AT91_NR_UART] = EK_UART_MAP; | ||
66 | int i; | ||
67 | |||
68 | at91rm9200_map_io(); | ||
69 | |||
70 | /* Initialize clocks: 18.432 MHz crystal */ | ||
71 | at91_clock_init(18432000); | ||
72 | |||
73 | #ifdef CONFIG_SERIAL_AT91 | ||
74 | at91_console_port = EK_SERIAL_CONSOLE; | ||
75 | memcpy(at91_serial_map, serial, sizeof(serial)); | ||
76 | |||
77 | /* Register UARTs */ | ||
78 | for (i = 0; i < AT91_NR_UART; i++) { | ||
79 | if (serial[i] >= 0) | ||
80 | at91_register_uart(i, serial[i]); | ||
81 | } | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | static struct at91_eth_data __initdata ek_eth_data = { | ||
86 | .phy_irq_pin = AT91_PIN_PC4, | ||
87 | .is_rmii = 1, | ||
88 | }; | ||
89 | |||
90 | static struct at91_usbh_data __initdata ek_usbh_data = { | ||
91 | .ports = 2, | ||
92 | }; | ||
93 | |||
94 | static struct at91_udc_data __initdata ek_udc_data = { | ||
95 | .vbus_pin = AT91_PIN_PD4, | ||
96 | .pullup_pin = AT91_PIN_PD5, | ||
97 | }; | ||
98 | |||
99 | static struct at91_mmc_data __initdata ek_mmc_data = { | ||
100 | .det_pin = AT91_PIN_PB27, | ||
101 | .is_b = 0, | ||
102 | .wire4 = 1, | ||
103 | .wp_pin = AT91_PIN_PA17, | ||
104 | }; | ||
105 | |||
106 | static void __init ek_board_init(void) | ||
107 | { | ||
108 | /* Ethernet */ | ||
109 | at91_add_device_eth(&ek_eth_data); | ||
110 | /* USB Host */ | ||
111 | at91_add_device_usbh(&ek_usbh_data); | ||
112 | /* USB Device */ | ||
113 | at91_add_device_udc(&ek_udc_data); | ||
114 | /* MMC */ | ||
115 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */ | ||
116 | at91_add_device_mmc(&ek_mmc_data); | ||
117 | /* VGA */ | ||
118 | // ek_add_device_video(); | ||
119 | } | ||
120 | |||
121 | MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK") | ||
122 | /* Maintainer: SAN People/Atmel */ | ||
123 | .phys_ram = AT91_SDRAM_BASE, | ||
124 | .phys_io = AT91_BASE_SYS, | ||
125 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | ||
126 | .boot_params = AT91_SDRAM_BASE + 0x100, | ||
127 | .timer = &at91rm9200_timer, | ||
128 | .map_io = ek_map_io, | ||
129 | .init_irq = ek_init_irq, | ||
130 | .init_machine = ek_board_init, | ||
131 | MACHINE_END | ||
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c index 40684e01e865..95a1e263f7fa 100644 --- a/arch/arm/mach-integrator/clock.c +++ b/arch/arm/mach-integrator/clock.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/mutex.h> | ||
18 | 19 | ||
19 | #include <asm/semaphore.h> | 20 | #include <asm/semaphore.h> |
20 | #include <asm/hardware/icst525.h> | 21 | #include <asm/hardware/icst525.h> |
@@ -22,20 +23,20 @@ | |||
22 | #include "clock.h" | 23 | #include "clock.h" |
23 | 24 | ||
24 | static LIST_HEAD(clocks); | 25 | static LIST_HEAD(clocks); |
25 | static DECLARE_MUTEX(clocks_sem); | 26 | static DEFINE_MUTEX(clocks_mutex); |
26 | 27 | ||
27 | struct clk *clk_get(struct device *dev, const char *id) | 28 | struct clk *clk_get(struct device *dev, const char *id) |
28 | { | 29 | { |
29 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 30 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
30 | 31 | ||
31 | down(&clocks_sem); | 32 | mutex_lock(&clocks_mutex); |
32 | list_for_each_entry(p, &clocks, node) { | 33 | list_for_each_entry(p, &clocks, node) { |
33 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 34 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
34 | clk = p; | 35 | clk = p; |
35 | break; | 36 | break; |
36 | } | 37 | } |
37 | } | 38 | } |
38 | up(&clocks_sem); | 39 | mutex_unlock(&clocks_mutex); |
39 | 40 | ||
40 | return clk; | 41 | return clk; |
41 | } | 42 | } |
@@ -107,18 +108,18 @@ static struct clk uart_clk = { | |||
107 | 108 | ||
108 | int clk_register(struct clk *clk) | 109 | int clk_register(struct clk *clk) |
109 | { | 110 | { |
110 | down(&clocks_sem); | 111 | mutex_lock(&clocks_mutex); |
111 | list_add(&clk->node, &clocks); | 112 | list_add(&clk->node, &clocks); |
112 | up(&clocks_sem); | 113 | mutex_unlock(&clocks_mutex); |
113 | return 0; | 114 | return 0; |
114 | } | 115 | } |
115 | EXPORT_SYMBOL(clk_register); | 116 | EXPORT_SYMBOL(clk_register); |
116 | 117 | ||
117 | void clk_unregister(struct clk *clk) | 118 | void clk_unregister(struct clk *clk) |
118 | { | 119 | { |
119 | down(&clocks_sem); | 120 | mutex_lock(&clocks_mutex); |
120 | list_del(&clk->node); | 121 | list_del(&clk->node); |
121 | up(&clocks_sem); | 122 | mutex_unlock(&clocks_mutex); |
122 | } | 123 | } |
123 | EXPORT_SYMBOL(clk_unregister); | 124 | EXPORT_SYMBOL(clk_unregister); |
124 | 125 | ||
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c index a68b30eff4d2..93096befd017 100644 --- a/arch/arm/mach-pxa/ssp.c +++ b/arch/arm/mach-pxa/ssp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/mutex.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
36 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
@@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = { | |||
59 | #endif | 60 | #endif |
60 | }; | 61 | }; |
61 | 62 | ||
62 | static DECLARE_MUTEX(sem); | 63 | static DEFINE_MUTEX(mutex); |
63 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; | 64 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; |
64 | 65 | ||
65 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 66 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
@@ -239,16 +240,16 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
239 | if (port > PXA_SSP_PORTS || port == 0) | 240 | if (port > PXA_SSP_PORTS || port == 0) |
240 | return -ENODEV; | 241 | return -ENODEV; |
241 | 242 | ||
242 | down(&sem); | 243 | mutex_lock(&mutex); |
243 | if (use_count[port - 1]) { | 244 | if (use_count[port - 1]) { |
244 | up(&sem); | 245 | mutex_unlock(&mutex); |
245 | return -EBUSY; | 246 | return -EBUSY; |
246 | } | 247 | } |
247 | use_count[port - 1]++; | 248 | use_count[port - 1]++; |
248 | 249 | ||
249 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { | 250 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { |
250 | use_count[port - 1]--; | 251 | use_count[port - 1]--; |
251 | up(&sem); | 252 | mutex_unlock(&mutex); |
252 | return -EBUSY; | 253 | return -EBUSY; |
253 | } | 254 | } |
254 | dev->port = port; | 255 | dev->port = port; |
@@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
265 | 266 | ||
266 | /* turn on SSP port clock */ | 267 | /* turn on SSP port clock */ |
267 | pxa_set_cken(ssp_info[port-1].clock, 1); | 268 | pxa_set_cken(ssp_info[port-1].clock, 1); |
268 | up(&sem); | 269 | mutex_unlock(&mutex); |
269 | return 0; | 270 | return 0; |
270 | 271 | ||
271 | out_region: | 272 | out_region: |
272 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); | 273 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); |
273 | use_count[port - 1]--; | 274 | use_count[port - 1]--; |
274 | up(&sem); | 275 | mutex_unlock(&mutex); |
275 | return ret; | 276 | return ret; |
276 | } | 277 | } |
277 | 278 | ||
@@ -282,7 +283,7 @@ out_region: | |||
282 | */ | 283 | */ |
283 | void ssp_exit(struct ssp_dev *dev) | 284 | void ssp_exit(struct ssp_dev *dev) |
284 | { | 285 | { |
285 | down(&sem); | 286 | mutex_lock(&mutex); |
286 | SSCR0_P(dev->port) &= ~SSCR0_SSE; | 287 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
287 | 288 | ||
288 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { | 289 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { |
@@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev) | |||
295 | free_irq(dev->irq, dev); | 296 | free_irq(dev->irq, dev); |
296 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); | 297 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); |
297 | use_count[dev->port - 1]--; | 298 | use_count[dev->port - 1]--; |
298 | up(&sem); | 299 | mutex_unlock(&mutex); |
299 | } | 300 | } |
300 | 301 | ||
301 | EXPORT_SYMBOL(ssp_write_word); | 302 | EXPORT_SYMBOL(ssp_write_word); |
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c index ec3f7e798623..21325a4da9da 100644 --- a/arch/arm/mach-realview/clock.c +++ b/arch/arm/mach-realview/clock.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/mutex.h> | ||
17 | 18 | ||
18 | #include <asm/semaphore.h> | 19 | #include <asm/semaphore.h> |
19 | #include <asm/hardware/icst307.h> | 20 | #include <asm/hardware/icst307.h> |
@@ -21,20 +22,20 @@ | |||
21 | #include "clock.h" | 22 | #include "clock.h" |
22 | 23 | ||
23 | static LIST_HEAD(clocks); | 24 | static LIST_HEAD(clocks); |
24 | static DECLARE_MUTEX(clocks_sem); | 25 | static DEFINE_MUTEX(clocks_mutex); |
25 | 26 | ||
26 | struct clk *clk_get(struct device *dev, const char *id) | 27 | struct clk *clk_get(struct device *dev, const char *id) |
27 | { | 28 | { |
28 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 29 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
29 | 30 | ||
30 | down(&clocks_sem); | 31 | mutex_lock(&clocks_mutex); |
31 | list_for_each_entry(p, &clocks, node) { | 32 | list_for_each_entry(p, &clocks, node) { |
32 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 33 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
33 | clk = p; | 34 | clk = p; |
34 | break; | 35 | break; |
35 | } | 36 | } |
36 | } | 37 | } |
37 | up(&clocks_sem); | 38 | mutex_unlock(&clocks_mutex); |
38 | 39 | ||
39 | return clk; | 40 | return clk; |
40 | } | 41 | } |
@@ -109,18 +110,18 @@ static struct clk mmci_clk = { | |||
109 | 110 | ||
110 | int clk_register(struct clk *clk) | 111 | int clk_register(struct clk *clk) |
111 | { | 112 | { |
112 | down(&clocks_sem); | 113 | mutex_lock(&clocks_mutex); |
113 | list_add(&clk->node, &clocks); | 114 | list_add(&clk->node, &clocks); |
114 | up(&clocks_sem); | 115 | mutex_unlock(&clocks_mutex); |
115 | return 0; | 116 | return 0; |
116 | } | 117 | } |
117 | EXPORT_SYMBOL(clk_register); | 118 | EXPORT_SYMBOL(clk_register); |
118 | 119 | ||
119 | void clk_unregister(struct clk *clk) | 120 | void clk_unregister(struct clk *clk) |
120 | { | 121 | { |
121 | down(&clocks_sem); | 122 | mutex_lock(&clocks_mutex); |
122 | list_del(&clk->node); | 123 | list_del(&clk->node); |
123 | up(&clocks_sem); | 124 | mutex_unlock(&clocks_mutex); |
124 | } | 125 | } |
125 | EXPORT_SYMBOL(clk_unregister); | 126 | EXPORT_SYMBOL(clk_unregister); |
126 | 127 | ||
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c index fc09ba92d66a..af2f3d52b61b 100644 --- a/arch/arm/mach-s3c2410/clock.c +++ b/arch/arm/mach-s3c2410/clock.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
39 | #include <linux/clk.h> | 39 | #include <linux/clk.h> |
40 | #include <linux/mutex.h> | ||
40 | 41 | ||
41 | #include <asm/hardware.h> | 42 | #include <asm/hardware.h> |
42 | #include <asm/atomic.h> | 43 | #include <asm/atomic.h> |
@@ -51,7 +52,7 @@ | |||
51 | /* clock information */ | 52 | /* clock information */ |
52 | 53 | ||
53 | static LIST_HEAD(clocks); | 54 | static LIST_HEAD(clocks); |
54 | static DECLARE_MUTEX(clocks_sem); | 55 | static DEFINE_MUTEX(clocks_mutex); |
55 | 56 | ||
56 | /* old functions */ | 57 | /* old functions */ |
57 | 58 | ||
@@ -102,7 +103,7 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
102 | else | 103 | else |
103 | idno = to_platform_device(dev)->id; | 104 | idno = to_platform_device(dev)->id; |
104 | 105 | ||
105 | down(&clocks_sem); | 106 | mutex_lock(&clocks_mutex); |
106 | 107 | ||
107 | list_for_each_entry(p, &clocks, list) { | 108 | list_for_each_entry(p, &clocks, list) { |
108 | if (p->id == idno && | 109 | if (p->id == idno && |
@@ -126,7 +127,7 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
129 | up(&clocks_sem); | 130 | mutex_unlock(&clocks_mutex); |
130 | return clk; | 131 | return clk; |
131 | } | 132 | } |
132 | 133 | ||
@@ -362,9 +363,9 @@ int s3c24xx_register_clock(struct clk *clk) | |||
362 | 363 | ||
363 | /* add to the list of available clocks */ | 364 | /* add to the list of available clocks */ |
364 | 365 | ||
365 | down(&clocks_sem); | 366 | mutex_lock(&clocks_mutex); |
366 | list_add(&clk->list, &clocks); | 367 | list_add(&clk->list, &clocks); |
367 | up(&clocks_sem); | 368 | mutex_unlock(&clocks_mutex); |
368 | 369 | ||
369 | return 0; | 370 | return 0; |
370 | } | 371 | } |
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c index dcf10014f5cd..9858c96560e2 100644 --- a/arch/arm/mach-versatile/clock.c +++ b/arch/arm/mach-versatile/clock.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/mutex.h> | ||
18 | 19 | ||
19 | #include <asm/semaphore.h> | 20 | #include <asm/semaphore.h> |
20 | #include <asm/hardware/icst307.h> | 21 | #include <asm/hardware/icst307.h> |
@@ -22,20 +23,20 @@ | |||
22 | #include "clock.h" | 23 | #include "clock.h" |
23 | 24 | ||
24 | static LIST_HEAD(clocks); | 25 | static LIST_HEAD(clocks); |
25 | static DECLARE_MUTEX(clocks_sem); | 26 | static DEFINE_MUTEX(clocks_mutex); |
26 | 27 | ||
27 | struct clk *clk_get(struct device *dev, const char *id) | 28 | struct clk *clk_get(struct device *dev, const char *id) |
28 | { | 29 | { |
29 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 30 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
30 | 31 | ||
31 | down(&clocks_sem); | 32 | mutex_lock(&clocks_mutex); |
32 | list_for_each_entry(p, &clocks, node) { | 33 | list_for_each_entry(p, &clocks, node) { |
33 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 34 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
34 | clk = p; | 35 | clk = p; |
35 | break; | 36 | break; |
36 | } | 37 | } |
37 | } | 38 | } |
38 | up(&clocks_sem); | 39 | mutex_unlock(&clocks_mutex); |
39 | 40 | ||
40 | return clk; | 41 | return clk; |
41 | } | 42 | } |
@@ -110,18 +111,18 @@ static struct clk mmci_clk = { | |||
110 | 111 | ||
111 | int clk_register(struct clk *clk) | 112 | int clk_register(struct clk *clk) |
112 | { | 113 | { |
113 | down(&clocks_sem); | 114 | mutex_lock(&clocks_mutex); |
114 | list_add(&clk->node, &clocks); | 115 | list_add(&clk->node, &clocks); |
115 | up(&clocks_sem); | 116 | mutex_unlock(&clocks_mutex); |
116 | return 0; | 117 | return 0; |
117 | } | 118 | } |
118 | EXPORT_SYMBOL(clk_register); | 119 | EXPORT_SYMBOL(clk_register); |
119 | 120 | ||
120 | void clk_unregister(struct clk *clk) | 121 | void clk_unregister(struct clk *clk) |
121 | { | 122 | { |
122 | down(&clocks_sem); | 123 | mutex_lock(&clocks_mutex); |
123 | list_del(&clk->node); | 124 | list_del(&clk->node); |
124 | up(&clocks_sem); | 125 | mutex_unlock(&clocks_mutex); |
125 | } | 126 | } |
126 | EXPORT_SYMBOL(clk_unregister); | 127 | EXPORT_SYMBOL(clk_unregister); |
127 | 128 | ||
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index 0513ed1b2fcf..c2ee18d2075e 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c | |||
@@ -20,15 +20,25 @@ | |||
20 | 20 | ||
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | #include <asm/tlbflush.h> | 22 | #include <asm/tlbflush.h> |
23 | #include <asm/sizes.h> | ||
24 | |||
25 | /* Sanity check size */ | ||
26 | #if (CONSISTENT_DMA_SIZE % SZ_2M) | ||
27 | #error "CONSISTENT_DMA_SIZE must be multiple of 2MiB" | ||
28 | #endif | ||
23 | 29 | ||
24 | #define CONSISTENT_BASE (0xffc00000) | ||
25 | #define CONSISTENT_END (0xffe00000) | 30 | #define CONSISTENT_END (0xffe00000) |
31 | #define CONSISTENT_BASE (CONSISTENT_END - CONSISTENT_DMA_SIZE) | ||
32 | |||
26 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) | 33 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) |
34 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT) | ||
35 | #define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) | ||
36 | |||
27 | 37 | ||
28 | /* | 38 | /* |
29 | * This is the page table (2MB) covering uncached, DMA consistent allocations | 39 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations |
30 | */ | 40 | */ |
31 | static pte_t *consistent_pte; | 41 | static pte_t *consistent_pte[NUM_CONSISTENT_PTES]; |
32 | static DEFINE_SPINLOCK(consistent_lock); | 42 | static DEFINE_SPINLOCK(consistent_lock); |
33 | 43 | ||
34 | /* | 44 | /* |
@@ -142,7 +152,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
142 | unsigned long order; | 152 | unsigned long order; |
143 | u64 mask = ISA_DMA_THRESHOLD, limit; | 153 | u64 mask = ISA_DMA_THRESHOLD, limit; |
144 | 154 | ||
145 | if (!consistent_pte) { | 155 | if (!consistent_pte[0]) { |
146 | printk(KERN_ERR "%s: not initialised\n", __func__); | 156 | printk(KERN_ERR "%s: not initialised\n", __func__); |
147 | dump_stack(); | 157 | dump_stack(); |
148 | return NULL; | 158 | return NULL; |
@@ -205,9 +215,12 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
205 | c = vm_region_alloc(&consistent_head, size, | 215 | c = vm_region_alloc(&consistent_head, size, |
206 | gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); | 216 | gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); |
207 | if (c) { | 217 | if (c) { |
208 | pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start); | 218 | pte_t *pte; |
209 | struct page *end = page + (1 << order); | 219 | struct page *end = page + (1 << order); |
220 | int idx = CONSISTENT_PTE_INDEX(c->vm_start); | ||
221 | u32 off = CONSISTENT_OFFSET(c->vm_start) & (PTRS_PER_PTE-1); | ||
210 | 222 | ||
223 | pte = consistent_pte[idx] + off; | ||
211 | c->vm_pages = page; | 224 | c->vm_pages = page; |
212 | 225 | ||
213 | /* | 226 | /* |
@@ -226,6 +239,11 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
226 | set_pte(pte, mk_pte(page, prot)); | 239 | set_pte(pte, mk_pte(page, prot)); |
227 | page++; | 240 | page++; |
228 | pte++; | 241 | pte++; |
242 | off++; | ||
243 | if (off >= PTRS_PER_PTE) { | ||
244 | off = 0; | ||
245 | pte = consistent_pte[++idx]; | ||
246 | } | ||
229 | } while (size -= PAGE_SIZE); | 247 | } while (size -= PAGE_SIZE); |
230 | 248 | ||
231 | /* | 249 | /* |
@@ -327,6 +345,8 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr | |||
327 | struct vm_region *c; | 345 | struct vm_region *c; |
328 | unsigned long flags, addr; | 346 | unsigned long flags, addr; |
329 | pte_t *ptep; | 347 | pte_t *ptep; |
348 | int idx; | ||
349 | u32 off; | ||
330 | 350 | ||
331 | WARN_ON(irqs_disabled()); | 351 | WARN_ON(irqs_disabled()); |
332 | 352 | ||
@@ -347,7 +367,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr | |||
347 | size = c->vm_end - c->vm_start; | 367 | size = c->vm_end - c->vm_start; |
348 | } | 368 | } |
349 | 369 | ||
350 | ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start); | 370 | idx = CONSISTENT_PTE_INDEX(c->vm_start); |
371 | off = CONSISTENT_OFFSET(c->vm_start) & (PTRS_PER_PTE-1); | ||
372 | ptep = consistent_pte[idx] + off; | ||
351 | addr = c->vm_start; | 373 | addr = c->vm_start; |
352 | do { | 374 | do { |
353 | pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep); | 375 | pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep); |
@@ -355,6 +377,11 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr | |||
355 | 377 | ||
356 | ptep++; | 378 | ptep++; |
357 | addr += PAGE_SIZE; | 379 | addr += PAGE_SIZE; |
380 | off++; | ||
381 | if (off >= PTRS_PER_PTE) { | ||
382 | off = 0; | ||
383 | ptep = consistent_pte[++idx]; | ||
384 | } | ||
358 | 385 | ||
359 | if (!pte_none(pte) && pte_present(pte)) { | 386 | if (!pte_none(pte) && pte_present(pte)) { |
360 | pfn = pte_pfn(pte); | 387 | pfn = pte_pfn(pte); |
@@ -401,11 +428,12 @@ static int __init consistent_init(void) | |||
401 | pgd_t *pgd; | 428 | pgd_t *pgd; |
402 | pmd_t *pmd; | 429 | pmd_t *pmd; |
403 | pte_t *pte; | 430 | pte_t *pte; |
404 | int ret = 0; | 431 | int ret = 0, i = 0; |
432 | u32 base = CONSISTENT_BASE; | ||
405 | 433 | ||
406 | do { | 434 | do { |
407 | pgd = pgd_offset(&init_mm, CONSISTENT_BASE); | 435 | pgd = pgd_offset(&init_mm, base); |
408 | pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE); | 436 | pmd = pmd_alloc(&init_mm, pgd, base); |
409 | if (!pmd) { | 437 | if (!pmd) { |
410 | printk(KERN_ERR "%s: no pmd tables\n", __func__); | 438 | printk(KERN_ERR "%s: no pmd tables\n", __func__); |
411 | ret = -ENOMEM; | 439 | ret = -ENOMEM; |
@@ -413,15 +441,16 @@ static int __init consistent_init(void) | |||
413 | } | 441 | } |
414 | WARN_ON(!pmd_none(*pmd)); | 442 | WARN_ON(!pmd_none(*pmd)); |
415 | 443 | ||
416 | pte = pte_alloc_kernel(pmd, CONSISTENT_BASE); | 444 | pte = pte_alloc_kernel(pmd, base); |
417 | if (!pte) { | 445 | if (!pte) { |
418 | printk(KERN_ERR "%s: no pte tables\n", __func__); | 446 | printk(KERN_ERR "%s: no pte tables\n", __func__); |
419 | ret = -ENOMEM; | 447 | ret = -ENOMEM; |
420 | break; | 448 | break; |
421 | } | 449 | } |
422 | 450 | ||
423 | consistent_pte = pte; | 451 | consistent_pte[i++] = pte; |
424 | } while (0); | 452 | base += (1 << PGDIR_SHIFT); |
453 | } while (base < CONSISTENT_END); | ||
425 | 454 | ||
426 | return ret; | 455 | return ret; |
427 | } | 456 | } |
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 84fd65656fcf..7ebc5a29db8d 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/mutex.h> | ||
23 | 24 | ||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/semaphore.h> | 26 | #include <asm/semaphore.h> |
@@ -27,7 +28,7 @@ | |||
27 | #include <asm/arch/clock.h> | 28 | #include <asm/arch/clock.h> |
28 | 29 | ||
29 | LIST_HEAD(clocks); | 30 | LIST_HEAD(clocks); |
30 | static DECLARE_MUTEX(clocks_sem); | 31 | static DEFINE_MUTEX(clocks_mutex); |
31 | DEFINE_SPINLOCK(clockfw_lock); | 32 | DEFINE_SPINLOCK(clockfw_lock); |
32 | 33 | ||
33 | static struct clk_functions *arch_clock; | 34 | static struct clk_functions *arch_clock; |
@@ -40,14 +41,14 @@ struct clk * clk_get(struct device *dev, const char *id) | |||
40 | { | 41 | { |
41 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 42 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
42 | 43 | ||
43 | down(&clocks_sem); | 44 | mutex_lock(&clocks_mutex); |
44 | list_for_each_entry(p, &clocks, node) { | 45 | list_for_each_entry(p, &clocks, node) { |
45 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 46 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
46 | clk = p; | 47 | clk = p; |
47 | break; | 48 | break; |
48 | } | 49 | } |
49 | } | 50 | } |
50 | up(&clocks_sem); | 51 | mutex_unlock(&clocks_mutex); |
51 | 52 | ||
52 | return clk; | 53 | return clk; |
53 | } | 54 | } |
@@ -249,11 +250,11 @@ void propagate_rate(struct clk * tclk) | |||
249 | 250 | ||
250 | int clk_register(struct clk *clk) | 251 | int clk_register(struct clk *clk) |
251 | { | 252 | { |
252 | down(&clocks_sem); | 253 | mutex_lock(&clocks_mutex); |
253 | list_add(&clk->node, &clocks); | 254 | list_add(&clk->node, &clocks); |
254 | if (clk->init) | 255 | if (clk->init) |
255 | clk->init(clk); | 256 | clk->init(clk); |
256 | up(&clocks_sem); | 257 | mutex_unlock(&clocks_mutex); |
257 | 258 | ||
258 | return 0; | 259 | return 0; |
259 | } | 260 | } |
@@ -261,9 +262,9 @@ EXPORT_SYMBOL(clk_register); | |||
261 | 262 | ||
262 | void clk_unregister(struct clk *clk) | 263 | void clk_unregister(struct clk *clk) |
263 | { | 264 | { |
264 | down(&clocks_sem); | 265 | mutex_lock(&clocks_mutex); |
265 | list_del(&clk->node); | 266 | list_del(&clk->node); |
266 | up(&clocks_sem); | 267 | mutex_unlock(&clocks_mutex); |
267 | } | 268 | } |
268 | EXPORT_SYMBOL(clk_unregister); | 269 | EXPORT_SYMBOL(clk_unregister); |
269 | 270 | ||
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index bbfa1bdceb4d..a94699d8dc52 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -11,7 +11,8 @@ CFLAGS_btext.o += -fPIC | |||
11 | endif | 11 | endif |
12 | 12 | ||
13 | obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ | 13 | obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ |
14 | irq.o align.o signal_32.o pmc.o vdso.o | 14 | irq.o align.o signal_32.o pmc.o vdso.o \ |
15 | init_task.o process.o | ||
15 | obj-y += vdso32/ | 16 | obj-y += vdso32/ |
16 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ | 17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ |
17 | signal_64.o ptrace32.o systbl.o \ | 18 | signal_64.o ptrace32.o systbl.o \ |
@@ -44,8 +45,7 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o | |||
44 | extra-$(CONFIG_8xx) := head_8xx.o | 45 | extra-$(CONFIG_8xx) := head_8xx.o |
45 | extra-y += vmlinux.lds | 46 | extra-y += vmlinux.lds |
46 | 47 | ||
47 | obj-y += process.o init_task.o time.o \ | 48 | obj-y += time.o prom.o traps.o setup-common.o udbg.o |
48 | prom.o traps.o setup-common.o udbg.o | ||
49 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o | 49 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o |
50 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o | 50 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o |
51 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o | 51 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 24fe70f40b66..c367520bc1c3 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(io_page_mask); | |||
53 | #ifdef CONFIG_PPC_MULTIPLATFORM | 53 | #ifdef CONFIG_PPC_MULTIPLATFORM |
54 | static void fixup_resource(struct resource *res, struct pci_dev *dev); | 54 | static void fixup_resource(struct resource *res, struct pci_dev *dev); |
55 | static void do_bus_setup(struct pci_bus *bus); | 55 | static void do_bus_setup(struct pci_bus *bus); |
56 | static void phbs_remap_io(void); | ||
56 | #endif | 57 | #endif |
57 | 58 | ||
58 | /* pci_io_base -- the base address from which io bars are offsets. | 59 | /* pci_io_base -- the base address from which io bars are offsets. |
@@ -251,6 +252,7 @@ void pcibios_free_controller(struct pci_controller *phb) | |||
251 | kfree(phb); | 252 | kfree(phb); |
252 | } | 253 | } |
253 | 254 | ||
255 | #ifndef CONFIG_PPC_ISERIES | ||
254 | void __devinit pcibios_claim_one_bus(struct pci_bus *b) | 256 | void __devinit pcibios_claim_one_bus(struct pci_bus *b) |
255 | { | 257 | { |
256 | struct pci_dev *dev; | 258 | struct pci_dev *dev; |
@@ -275,7 +277,6 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *b) | |||
275 | EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); | 277 | EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); |
276 | #endif | 278 | #endif |
277 | 279 | ||
278 | #ifndef CONFIG_PPC_ISERIES | ||
279 | static void __init pcibios_claim_of_setup(void) | 280 | static void __init pcibios_claim_of_setup(void) |
280 | { | 281 | { |
281 | struct pci_bus *b; | 282 | struct pci_bus *b; |
@@ -1218,7 +1219,7 @@ int remap_bus_range(struct pci_bus *bus) | |||
1218 | } | 1219 | } |
1219 | EXPORT_SYMBOL(remap_bus_range); | 1220 | EXPORT_SYMBOL(remap_bus_range); |
1220 | 1221 | ||
1221 | void phbs_remap_io(void) | 1222 | static void phbs_remap_io(void) |
1222 | { | 1223 | { |
1223 | struct pci_controller *hose, *tmp; | 1224 | struct pci_controller *hose, *tmp; |
1224 | 1225 | ||
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 1f816f0d7740..57703994a063 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -201,13 +201,13 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs) | |||
201 | } | 201 | } |
202 | #endif /* CONFIG_SPE */ | 202 | #endif /* CONFIG_SPE */ |
203 | 203 | ||
204 | #ifndef CONFIG_SMP | ||
204 | /* | 205 | /* |
205 | * If we are doing lazy switching of CPU state (FP, altivec or SPE), | 206 | * If we are doing lazy switching of CPU state (FP, altivec or SPE), |
206 | * and the current task has some state, discard it. | 207 | * and the current task has some state, discard it. |
207 | */ | 208 | */ |
208 | static inline void discard_lazy_cpu_state(void) | 209 | void discard_lazy_cpu_state(void) |
209 | { | 210 | { |
210 | #ifndef CONFIG_SMP | ||
211 | preempt_disable(); | 211 | preempt_disable(); |
212 | if (last_task_used_math == current) | 212 | if (last_task_used_math == current) |
213 | last_task_used_math = NULL; | 213 | last_task_used_math = NULL; |
@@ -220,9 +220,10 @@ static inline void discard_lazy_cpu_state(void) | |||
220 | last_task_used_spe = NULL; | 220 | last_task_used_spe = NULL; |
221 | #endif | 221 | #endif |
222 | preempt_enable(); | 222 | preempt_enable(); |
223 | #endif /* CONFIG_SMP */ | ||
224 | } | 223 | } |
224 | #endif /* CONFIG_SMP */ | ||
225 | 225 | ||
226 | #ifdef CONFIG_PPC_MERGE /* XXX for now */ | ||
226 | int set_dabr(unsigned long dabr) | 227 | int set_dabr(unsigned long dabr) |
227 | { | 228 | { |
228 | if (ppc_md.set_dabr) | 229 | if (ppc_md.set_dabr) |
@@ -231,6 +232,7 @@ int set_dabr(unsigned long dabr) | |||
231 | mtspr(SPRN_DABR, dabr); | 232 | mtspr(SPRN_DABR, dabr); |
232 | return 0; | 233 | return 0; |
233 | } | 234 | } |
235 | #endif | ||
234 | 236 | ||
235 | #ifdef CONFIG_PPC64 | 237 | #ifdef CONFIG_PPC64 |
236 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); | 238 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 34ab0daec3a7..02e2115323e4 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -1100,17 +1100,37 @@ static int __init early_init_dt_scan_memory(unsigned long node, | |||
1100 | 1100 | ||
1101 | static void __init early_reserve_mem(void) | 1101 | static void __init early_reserve_mem(void) |
1102 | { | 1102 | { |
1103 | unsigned long base, size; | 1103 | u64 base, size; |
1104 | unsigned long *reserve_map; | 1104 | u64 *reserve_map; |
1105 | 1105 | ||
1106 | reserve_map = (unsigned long *)(((unsigned long)initial_boot_params) + | 1106 | reserve_map = (u64 *)(((unsigned long)initial_boot_params) + |
1107 | initial_boot_params->off_mem_rsvmap); | 1107 | initial_boot_params->off_mem_rsvmap); |
1108 | #ifdef CONFIG_PPC32 | ||
1109 | /* | ||
1110 | * Handle the case where we might be booting from an old kexec | ||
1111 | * image that setup the mem_rsvmap as pairs of 32-bit values | ||
1112 | */ | ||
1113 | if (*reserve_map > 0xffffffffull) { | ||
1114 | u32 base_32, size_32; | ||
1115 | u32 *reserve_map_32 = (u32 *)reserve_map; | ||
1116 | |||
1117 | while (1) { | ||
1118 | base_32 = *(reserve_map_32++); | ||
1119 | size_32 = *(reserve_map_32++); | ||
1120 | if (size_32 == 0) | ||
1121 | break; | ||
1122 | DBG("reserving: %lx -> %lx\n", base_32, size_32); | ||
1123 | lmb_reserve(base_32, size_32); | ||
1124 | } | ||
1125 | return; | ||
1126 | } | ||
1127 | #endif | ||
1108 | while (1) { | 1128 | while (1) { |
1109 | base = *(reserve_map++); | 1129 | base = *(reserve_map++); |
1110 | size = *(reserve_map++); | 1130 | size = *(reserve_map++); |
1111 | if (size == 0) | 1131 | if (size == 0) |
1112 | break; | 1132 | break; |
1113 | DBG("reserving: %lx -> %lx\n", base, size); | 1133 | DBG("reserving: %llx -> %llx\n", base, size); |
1114 | lmb_reserve(base, size); | 1134 | lmb_reserve(base, size); |
1115 | } | 1135 | } |
1116 | 1136 | ||
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index e381f2fc121c..d963a12ec640 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -137,8 +137,8 @@ struct prom_t { | |||
137 | }; | 137 | }; |
138 | 138 | ||
139 | struct mem_map_entry { | 139 | struct mem_map_entry { |
140 | unsigned long base; | 140 | u64 base; |
141 | unsigned long size; | 141 | u64 size; |
142 | }; | 142 | }; |
143 | 143 | ||
144 | typedef u32 cell_t; | 144 | typedef u32 cell_t; |
@@ -897,9 +897,9 @@ static unsigned long __init prom_next_cell(int s, cell_t **cellp) | |||
897 | * If problems seem to show up, it would be a good start to track | 897 | * If problems seem to show up, it would be a good start to track |
898 | * them down. | 898 | * them down. |
899 | */ | 899 | */ |
900 | static void reserve_mem(unsigned long base, unsigned long size) | 900 | static void reserve_mem(u64 base, u64 size) |
901 | { | 901 | { |
902 | unsigned long top = base + size; | 902 | u64 top = base + size; |
903 | unsigned long cnt = RELOC(mem_reserve_cnt); | 903 | unsigned long cnt = RELOC(mem_reserve_cnt); |
904 | 904 | ||
905 | if (size == 0) | 905 | if (size == 0) |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index d3f0b6d452fb..177bba78fb0b 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -497,6 +497,15 @@ static long restore_user_regs(struct pt_regs *regs, | |||
497 | if (err) | 497 | if (err) |
498 | return 1; | 498 | return 1; |
499 | 499 | ||
500 | /* | ||
501 | * Do this before updating the thread state in | ||
502 | * current->thread.fpr/vr/evr. That way, if we get preempted | ||
503 | * and another task grabs the FPU/Altivec/SPE, it won't be | ||
504 | * tempted to save the current CPU state into the thread_struct | ||
505 | * and corrupt what we are writing there. | ||
506 | */ | ||
507 | discard_lazy_cpu_state(); | ||
508 | |||
500 | /* force the process to reload the FP registers from | 509 | /* force the process to reload the FP registers from |
501 | current->thread when it next does FP instructions */ | 510 | current->thread when it next does FP instructions */ |
502 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1); | 511 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1); |
@@ -538,18 +547,6 @@ static long restore_user_regs(struct pt_regs *regs, | |||
538 | return 1; | 547 | return 1; |
539 | #endif /* CONFIG_SPE */ | 548 | #endif /* CONFIG_SPE */ |
540 | 549 | ||
541 | #ifndef CONFIG_SMP | ||
542 | preempt_disable(); | ||
543 | if (last_task_used_math == current) | ||
544 | last_task_used_math = NULL; | ||
545 | if (last_task_used_altivec == current) | ||
546 | last_task_used_altivec = NULL; | ||
547 | #ifdef CONFIG_SPE | ||
548 | if (last_task_used_spe == current) | ||
549 | last_task_used_spe = NULL; | ||
550 | #endif | ||
551 | preempt_enable(); | ||
552 | #endif | ||
553 | return 0; | 550 | return 0; |
554 | } | 551 | } |
555 | 552 | ||
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 5462bef898f6..7b9d999e2115 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -207,10 +207,20 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
207 | 207 | ||
208 | if (!sig) | 208 | if (!sig) |
209 | regs->gpr[13] = save_r13; | 209 | regs->gpr[13] = save_r13; |
210 | err |= __copy_from_user(¤t->thread.fpr, &sc->fp_regs, FP_REGS_SIZE); | ||
211 | if (set != NULL) | 210 | if (set != NULL) |
212 | err |= __get_user(set->sig[0], &sc->oldmask); | 211 | err |= __get_user(set->sig[0], &sc->oldmask); |
213 | 212 | ||
213 | /* | ||
214 | * Do this before updating the thread state in | ||
215 | * current->thread.fpr/vr. That way, if we get preempted | ||
216 | * and another task grabs the FPU/Altivec, it won't be | ||
217 | * tempted to save the current CPU state into the thread_struct | ||
218 | * and corrupt what we are writing there. | ||
219 | */ | ||
220 | discard_lazy_cpu_state(); | ||
221 | |||
222 | err |= __copy_from_user(¤t->thread.fpr, &sc->fp_regs, FP_REGS_SIZE); | ||
223 | |||
214 | #ifdef CONFIG_ALTIVEC | 224 | #ifdef CONFIG_ALTIVEC |
215 | err |= __get_user(v_regs, &sc->v_regs); | 225 | err |= __get_user(v_regs, &sc->v_regs); |
216 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); | 226 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); |
@@ -229,14 +239,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
229 | current->thread.vrsave = 0; | 239 | current->thread.vrsave = 0; |
230 | #endif /* CONFIG_ALTIVEC */ | 240 | #endif /* CONFIG_ALTIVEC */ |
231 | 241 | ||
232 | #ifndef CONFIG_SMP | ||
233 | preempt_disable(); | ||
234 | if (last_task_used_math == current) | ||
235 | last_task_used_math = NULL; | ||
236 | if (last_task_used_altivec == current) | ||
237 | last_task_used_altivec = NULL; | ||
238 | preempt_enable(); | ||
239 | #endif | ||
240 | /* Force reload of FP/VEC */ | 242 | /* Force reload of FP/VEC */ |
241 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); | 243 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); |
242 | 244 | ||
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c index 85152544c153..e0e051c675dd 100644 --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c | |||
@@ -142,7 +142,7 @@ static void cbe_idle(void) | |||
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | int cbe_system_reset_exception(struct pt_regs *regs) | 145 | static int cbe_system_reset_exception(struct pt_regs *regs) |
146 | { | 146 | { |
147 | switch (regs->msr & SRR1_WAKEMASK) { | 147 | switch (regs->msr & SRR1_WAKEMASK) { |
148 | case SRR1_WAKEEE: | 148 | case SRR1_WAKEEE: |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index 18e25e65c04b..b33a4443f5a9 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #define DBG(fmt...) | 57 | #define DBG(fmt...) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | void cell_show_cpuinfo(struct seq_file *m) | 60 | static void cell_show_cpuinfo(struct seq_file *m) |
61 | { | 61 | { |
62 | struct device_node *root; | 62 | struct device_node *root; |
63 | const char *model = ""; | 63 | const char *model = ""; |
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index d549aa7ebea6..e6565a949ddc 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -29,7 +29,9 @@ | |||
29 | * value of the spu_status register after the SPU has stopped. | 29 | * value of the spu_status register after the SPU has stopped. |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | long do_spu_run(struct file *filp, __u32 __user *unpc, __u32 __user *ustatus) | 32 | static long do_spu_run(struct file *filp, |
33 | __u32 __user *unpc, | ||
34 | __u32 __user *ustatus) | ||
33 | { | 35 | { |
34 | long ret; | 36 | long ret; |
35 | struct spufs_inode_info *i; | 37 | struct spufs_inode_info *i; |
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile index 127b465308be..ce8c0b943fa0 100644 --- a/arch/powerpc/platforms/iseries/Makefile +++ b/arch/powerpc/platforms/iseries/Makefile | |||
@@ -1,8 +1,8 @@ | |||
1 | EXTRA_CFLAGS += -mno-minimal-toc | 1 | EXTRA_CFLAGS += -mno-minimal-toc |
2 | 2 | ||
3 | obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ | 3 | obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ |
4 | hvcall.o proc.o htab.o iommu.o misc.o | 4 | hvcall.o proc.o htab.o iommu.o misc.o irq.o |
5 | obj-$(CONFIG_PCI) += pci.o irq.o vpdinfo.o | 5 | obj-$(CONFIG_PCI) += pci.o vpdinfo.o |
6 | obj-$(CONFIG_IBMVIO) += vio.o | 6 | obj-$(CONFIG_IBMVIO) += vio.o |
7 | obj-$(CONFIG_SMP) += smp.o | 7 | obj-$(CONFIG_SMP) += smp.o |
8 | obj-$(CONFIG_VIOPATH) += viopath.o | 8 | obj-$(CONFIG_VIOPATH) += viopath.o |
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index 2b54eeb2c899..bea0b703f409 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <asm/pci-bridge.h> | 34 | #include <asm/pci-bridge.h> |
35 | #include <asm/iseries/hv_call_xm.h> | 35 | #include <asm/iseries/hv_call_xm.h> |
36 | 36 | ||
37 | #include "iommu.h" | ||
38 | |||
37 | extern struct list_head iSeries_Global_Device_List; | 39 | extern struct list_head iSeries_Global_Device_List; |
38 | 40 | ||
39 | 41 | ||
diff --git a/arch/powerpc/platforms/iseries/iommu.h b/arch/powerpc/platforms/iseries/iommu.h new file mode 100644 index 000000000000..cb5658fbe657 --- /dev/null +++ b/arch/powerpc/platforms/iseries/iommu.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef _PLATFORMS_ISERIES_IOMMU_H | ||
2 | #define _PLATFORMS_ISERIES_IOMMU_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2005 Stephen Rothwell, IBM Corporation | ||
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 as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the: | ||
19 | * Free Software Foundation, Inc., | ||
20 | * 59 Temple Place, Suite 330, | ||
21 | * Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | struct device_node; | ||
25 | struct iommu_table; | ||
26 | |||
27 | /* Creates table for an individual device node */ | ||
28 | extern void iommu_devnode_init_iSeries(struct device_node *dn); | ||
29 | |||
30 | /* Get table parameters from HV */ | ||
31 | extern void iommu_table_getparms_iSeries(unsigned long busno, | ||
32 | unsigned char slotno, unsigned char virtbus, | ||
33 | struct iommu_table *tbl); | ||
34 | |||
35 | #endif /* _PLATFORMS_ISERIES_IOMMU_H */ | ||
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c index 42e978e4897a..83442ea77476 100644 --- a/arch/powerpc/platforms/iseries/irq.c +++ b/arch/powerpc/platforms/iseries/irq.c | |||
@@ -48,6 +48,8 @@ | |||
48 | extern void iSeries_smp_message_recv(struct pt_regs *); | 48 | extern void iSeries_smp_message_recv(struct pt_regs *); |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #ifdef CONFIG_PCI | ||
52 | |||
51 | enum pci_event_type { | 53 | enum pci_event_type { |
52 | pe_bus_created = 0, /* PHB has been created */ | 54 | pe_bus_created = 0, /* PHB has been created */ |
53 | pe_bus_error = 1, /* PHB has failed */ | 55 | pe_bus_error = 1, /* PHB has failed */ |
@@ -147,20 +149,11 @@ static void int_received(struct pci_event *event, struct pt_regs *regs) | |||
147 | static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs) | 149 | static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs) |
148 | { | 150 | { |
149 | if (event && (event->xType == HvLpEvent_Type_PciIo)) { | 151 | if (event && (event->xType == HvLpEvent_Type_PciIo)) { |
150 | switch (event->xFlags.xFunction) { | 152 | if (hvlpevent_is_int(event)) |
151 | case HvLpEvent_Function_Int: | ||
152 | int_received((struct pci_event *)event, regs); | 153 | int_received((struct pci_event *)event, regs); |
153 | break; | 154 | else |
154 | case HvLpEvent_Function_Ack: | ||
155 | printk(KERN_ERR | 155 | printk(KERN_ERR |
156 | "pci_event_handler: unexpected ack received\n"); | 156 | "pci_event_handler: unexpected ack received\n"); |
157 | break; | ||
158 | default: | ||
159 | printk(KERN_ERR | ||
160 | "pci_event_handler: unexpected event function %d\n", | ||
161 | (int)event->xFlags.xFunction); | ||
162 | break; | ||
163 | } | ||
164 | } else if (event) | 157 | } else if (event) |
165 | printk(KERN_ERR | 158 | printk(KERN_ERR |
166 | "pci_event_handler: Unrecognized PCI event type 0x%x\n", | 159 | "pci_event_handler: Unrecognized PCI event type 0x%x\n", |
@@ -334,6 +327,8 @@ int __init iSeries_allocate_IRQ(HvBusNumber bus, | |||
334 | return virtirq; | 327 | return virtirq; |
335 | } | 328 | } |
336 | 329 | ||
330 | #endif /* CONFIG_PCI */ | ||
331 | |||
337 | /* | 332 | /* |
338 | * Get the next pending IRQ. | 333 | * Get the next pending IRQ. |
339 | */ | 334 | */ |
@@ -353,6 +348,7 @@ int iSeries_get_irq(struct pt_regs *regs) | |||
353 | if (hvlpevent_is_pending()) | 348 | if (hvlpevent_is_pending()) |
354 | process_hvlpevents(regs); | 349 | process_hvlpevents(regs); |
355 | 350 | ||
351 | #ifdef CONFIG_PCI | ||
356 | if (num_pending_irqs) { | 352 | if (num_pending_irqs) { |
357 | spin_lock(&pending_irqs_lock); | 353 | spin_lock(&pending_irqs_lock); |
358 | for (irq = 0; irq < NR_IRQS; irq++) { | 354 | for (irq = 0; irq < NR_IRQS; irq++) { |
@@ -366,6 +362,7 @@ int iSeries_get_irq(struct pt_regs *regs) | |||
366 | if (irq >= NR_IRQS) | 362 | if (irq >= NR_IRQS) |
367 | irq = -2; | 363 | irq = -2; |
368 | } | 364 | } |
365 | #endif | ||
369 | 366 | ||
370 | return irq; | 367 | return irq; |
371 | } | 368 | } |
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c index ea72385aaf0a..438e2dba63b5 100644 --- a/arch/powerpc/platforms/iseries/lpardata.c +++ b/arch/powerpc/platforms/iseries/lpardata.c | |||
@@ -93,10 +93,7 @@ struct ItLpNaca itLpNaca = { | |||
93 | .xPirEnvironMode = 0, /* Piranha stuff */ | 93 | .xPirEnvironMode = 0, /* Piranha stuff */ |
94 | .xPirConsoleMode = 0, | 94 | .xPirConsoleMode = 0, |
95 | .xPirDasdMode = 0, | 95 | .xPirDasdMode = 0, |
96 | .xLparInstalled = 0, | 96 | .flags = 0, |
97 | .xSysPartitioned = 0, | ||
98 | .xHwSyncedTBs = 0, | ||
99 | .xIntProcUtilHmt = 0, | ||
100 | .xSpVpdFormat = 0, | 97 | .xSpVpdFormat = 0, |
101 | .xIntProcRatio = 0, | 98 | .xIntProcRatio = 0, |
102 | .xPlicVrmIndex = 0, /* VRM index of PLIC */ | 99 | .xPlicVrmIndex = 0, /* VRM index of PLIC */ |
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c index e9fb98bf895f..0b885300d1d1 100644 --- a/arch/powerpc/platforms/iseries/lpevents.c +++ b/arch/powerpc/platforms/iseries/lpevents.c | |||
@@ -53,7 +53,7 @@ static struct HvLpEvent * get_next_hvlpevent(void) | |||
53 | struct HvLpEvent * event; | 53 | struct HvLpEvent * event; |
54 | event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; | 54 | event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; |
55 | 55 | ||
56 | if (event->xFlags.xValid) { | 56 | if (hvlpevent_is_valid(event)) { |
57 | /* rmb() needed only for weakly consistent machines (regatta) */ | 57 | /* rmb() needed only for weakly consistent machines (regatta) */ |
58 | rmb(); | 58 | rmb(); |
59 | /* Set pointer to next potential event */ | 59 | /* Set pointer to next potential event */ |
@@ -84,7 +84,7 @@ int hvlpevent_is_pending(void) | |||
84 | 84 | ||
85 | next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; | 85 | next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; |
86 | 86 | ||
87 | return next_event->xFlags.xValid | | 87 | return hvlpevent_is_valid(next_event) || |
88 | hvlpevent_queue.xPlicOverflowIntPending; | 88 | hvlpevent_queue.xPlicOverflowIntPending; |
89 | } | 89 | } |
90 | 90 | ||
@@ -101,18 +101,18 @@ static void hvlpevent_clear_valid(struct HvLpEvent * event) | |||
101 | switch (extra) { | 101 | switch (extra) { |
102 | case 3: | 102 | case 3: |
103 | tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); | 103 | tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); |
104 | tmp->xFlags.xValid = 0; | 104 | hvlpevent_invalidate(tmp); |
105 | case 2: | 105 | case 2: |
106 | tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); | 106 | tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); |
107 | tmp->xFlags.xValid = 0; | 107 | hvlpevent_invalidate(tmp); |
108 | case 1: | 108 | case 1: |
109 | tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); | 109 | tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); |
110 | tmp->xFlags.xValid = 0; | 110 | hvlpevent_invalidate(tmp); |
111 | } | 111 | } |
112 | 112 | ||
113 | mb(); | 113 | mb(); |
114 | 114 | ||
115 | event->xFlags.xValid = 0; | 115 | hvlpevent_invalidate(event); |
116 | } | 116 | } |
117 | 117 | ||
118 | void process_hvlpevents(struct pt_regs *regs) | 118 | void process_hvlpevents(struct pt_regs *regs) |
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c index 49e7e4b85847..a41d8b78c0cd 100644 --- a/arch/powerpc/platforms/iseries/mf.c +++ b/arch/powerpc/platforms/iseries/mf.c | |||
@@ -251,10 +251,7 @@ static struct pending_event *new_pending_event(void) | |||
251 | } | 251 | } |
252 | memset(ev, 0, sizeof(struct pending_event)); | 252 | memset(ev, 0, sizeof(struct pending_event)); |
253 | hev = &ev->event.hp_lp_event; | 253 | hev = &ev->event.hp_lp_event; |
254 | hev->xFlags.xValid = 1; | 254 | hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK | HV_LP_EVENT_INT; |
255 | hev->xFlags.xAckType = HvLpEvent_AckType_ImmediateAck; | ||
256 | hev->xFlags.xAckInd = HvLpEvent_AckInd_DoAck; | ||
257 | hev->xFlags.xFunction = HvLpEvent_Function_Int; | ||
258 | hev->xType = HvLpEvent_Type_MachineFac; | 255 | hev->xType = HvLpEvent_Type_MachineFac; |
259 | hev->xSourceLp = HvLpConfig_getLpIndex(); | 256 | hev->xSourceLp = HvLpConfig_getLpIndex(); |
260 | hev->xTargetLp = primary_lp; | 257 | hev->xTargetLp = primary_lp; |
@@ -518,17 +515,10 @@ static void handle_ack(struct io_mf_lp_event *event) | |||
518 | static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs) | 515 | static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs) |
519 | { | 516 | { |
520 | if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) { | 517 | if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) { |
521 | switch(event->xFlags.xFunction) { | 518 | if (hvlpevent_is_ack(event)) |
522 | case HvLpEvent_Function_Ack: | ||
523 | handle_ack((struct io_mf_lp_event *)event); | 519 | handle_ack((struct io_mf_lp_event *)event); |
524 | break; | 520 | else |
525 | case HvLpEvent_Function_Int: | ||
526 | handle_int((struct io_mf_lp_event *)event); | 521 | handle_int((struct io_mf_lp_event *)event); |
527 | break; | ||
528 | default: | ||
529 | printk(KERN_ERR "mf.c: non ack/int event received\n"); | ||
530 | break; | ||
531 | } | ||
532 | } else | 522 | } else |
533 | printk(KERN_ERR "mf.c: alien event received\n"); | 523 | printk(KERN_ERR "mf.c: alien event received\n"); |
534 | } | 524 | } |
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index dafc518fbb83..a19833b880e4 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "irq.h" | 43 | #include "irq.h" |
44 | #include "pci.h" | 44 | #include "pci.h" |
45 | #include "call_pci.h" | 45 | #include "call_pci.h" |
46 | #include "iommu.h" | ||
46 | 47 | ||
47 | extern unsigned long io_page_mask; | 48 | extern unsigned long io_page_mask; |
48 | 49 | ||
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c index 384360ee06ec..ad36ab0639f0 100644 --- a/arch/powerpc/platforms/iseries/vio.c +++ b/arch/powerpc/platforms/iseries/vio.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <asm/iseries/hv_lp_config.h> | 22 | #include <asm/iseries/hv_lp_config.h> |
23 | #include <asm/iseries/hv_call_xm.h> | 23 | #include <asm/iseries/hv_call_xm.h> |
24 | 24 | ||
25 | #include "iommu.h" | ||
26 | |||
25 | struct device *iSeries_vio_dev = &vio_bus_device.dev; | 27 | struct device *iSeries_vio_dev = &vio_bus_device.dev; |
26 | EXPORT_SYMBOL(iSeries_vio_dev); | 28 | EXPORT_SYMBOL(iSeries_vio_dev); |
27 | 29 | ||
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c index 842672695598..622a30149b48 100644 --- a/arch/powerpc/platforms/iseries/viopath.c +++ b/arch/powerpc/platforms/iseries/viopath.c | |||
@@ -270,7 +270,7 @@ static void handleMonitorEvent(struct HvLpEvent *event) | |||
270 | * First see if this is just a normal monitor message from the | 270 | * First see if this is just a normal monitor message from the |
271 | * other partition | 271 | * other partition |
272 | */ | 272 | */ |
273 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 273 | if (hvlpevent_is_int(event)) { |
274 | remoteLp = event->xSourceLp; | 274 | remoteLp = event->xSourceLp; |
275 | if (!viopathStatus[remoteLp].isActive) | 275 | if (!viopathStatus[remoteLp].isActive) |
276 | sendMonMsg(remoteLp); | 276 | sendMonMsg(remoteLp); |
@@ -331,13 +331,12 @@ static void handleConfig(struct HvLpEvent *event) | |||
331 | { | 331 | { |
332 | if (!event) | 332 | if (!event) |
333 | return; | 333 | return; |
334 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 334 | if (hvlpevent_is_int(event)) { |
335 | printk(VIOPATH_KERN_WARN | 335 | printk(VIOPATH_KERN_WARN |
336 | "unexpected config request from partition %d", | 336 | "unexpected config request from partition %d", |
337 | event->xSourceLp); | 337 | event->xSourceLp); |
338 | 338 | ||
339 | if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && | 339 | if (hvlpevent_need_ack(event)) { |
340 | (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) { | ||
341 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 340 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
342 | HvCallEvent_ackLpEvent(event); | 341 | HvCallEvent_ackLpEvent(event); |
343 | } | 342 | } |
@@ -377,7 +376,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs) | |||
377 | int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK) | 376 | int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK) |
378 | >> VIOMAJOR_SUBTYPE_SHIFT; | 377 | >> VIOMAJOR_SUBTYPE_SHIFT; |
379 | 378 | ||
380 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 379 | if (hvlpevent_is_int(event)) { |
381 | remoteLp = event->xSourceLp; | 380 | remoteLp = event->xSourceLp; |
382 | /* | 381 | /* |
383 | * The isActive is checked because if the hosting partition | 382 | * The isActive is checked because if the hosting partition |
@@ -436,8 +435,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs) | |||
436 | "unexpected virtual io event subtype %d from partition %d\n", | 435 | "unexpected virtual io event subtype %d from partition %d\n", |
437 | event->xSubtype, remoteLp); | 436 | event->xSubtype, remoteLp); |
438 | /* No handler. Ack if necessary */ | 437 | /* No handler. Ack if necessary */ |
439 | if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && | 438 | if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) { |
440 | (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) { | ||
441 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 439 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
442 | HvCallEvent_ackLpEvent(event); | 440 | HvCallEvent_ackLpEvent(event); |
443 | } | 441 | } |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 3b1a9d4fcbc6..89c4c3636161 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -278,7 +278,7 @@ static void __init l2cr_init(void) | |||
278 | } | 278 | } |
279 | #endif | 279 | #endif |
280 | 280 | ||
281 | void __init pmac_setup_arch(void) | 281 | static void __init pmac_setup_arch(void) |
282 | { | 282 | { |
283 | struct device_node *cpu, *ic; | 283 | struct device_node *cpu, *ic; |
284 | int *fp; | 284 | int *fp; |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 17cea7f2afd3..83578313ee7e 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -208,10 +208,11 @@ static void __eeh_mark_slot (struct device_node *dn, int mode_flag) | |||
208 | { | 208 | { |
209 | while (dn) { | 209 | while (dn) { |
210 | if (PCI_DN(dn)) { | 210 | if (PCI_DN(dn)) { |
211 | PCI_DN(dn)->eeh_mode |= mode_flag; | ||
212 | |||
213 | /* Mark the pci device driver too */ | 211 | /* Mark the pci device driver too */ |
214 | struct pci_dev *dev = PCI_DN(dn)->pcidev; | 212 | struct pci_dev *dev = PCI_DN(dn)->pcidev; |
213 | |||
214 | PCI_DN(dn)->eeh_mode |= mode_flag; | ||
215 | |||
215 | if (dev && dev->driver) | 216 | if (dev && dev->driver) |
216 | dev->error_state = pci_channel_io_frozen; | 217 | dev->error_state = pci_channel_io_frozen; |
217 | 218 | ||
diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c index 4d584172055a..22bfb5c89db9 100644 --- a/arch/powerpc/platforms/pseries/hvcserver.c +++ b/arch/powerpc/platforms/pseries/hvcserver.c | |||
@@ -40,7 +40,7 @@ MODULE_VERSION(HVCS_ARCH_VERSION); | |||
40 | * functions aren't performance sensitive, so this conversion isn't an | 40 | * functions aren't performance sensitive, so this conversion isn't an |
41 | * issue. | 41 | * issue. |
42 | */ | 42 | */ |
43 | int hvcs_convert(long to_convert) | 43 | static int hvcs_convert(long to_convert) |
44 | { | 44 | { |
45 | switch (to_convert) { | 45 | switch (to_convert) { |
46 | case H_Success: | 46 | case H_Success: |
@@ -91,7 +91,7 @@ int hvcs_free_partner_info(struct list_head *head) | |||
91 | EXPORT_SYMBOL(hvcs_free_partner_info); | 91 | EXPORT_SYMBOL(hvcs_free_partner_info); |
92 | 92 | ||
93 | /* Helper function for hvcs_get_partner_info */ | 93 | /* Helper function for hvcs_get_partner_info */ |
94 | int hvcs_next_partner(uint32_t unit_address, | 94 | static int hvcs_next_partner(uint32_t unit_address, |
95 | unsigned long last_p_partition_ID, | 95 | unsigned long last_p_partition_ID, |
96 | unsigned long last_p_unit_address, unsigned long *pi_buff) | 96 | unsigned long last_p_unit_address, unsigned long *pi_buff) |
97 | 97 | ||
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 169f9148789c..48cfbfc43f99 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -51,8 +51,6 @@ | |||
51 | 51 | ||
52 | #define DBG(fmt...) | 52 | #define DBG(fmt...) |
53 | 53 | ||
54 | extern int is_python(struct device_node *); | ||
55 | |||
56 | static void tce_build_pSeries(struct iommu_table *tbl, long index, | 54 | static void tce_build_pSeries(struct iommu_table *tbl, long index, |
57 | long npages, unsigned long uaddr, | 55 | long npages, unsigned long uaddr, |
58 | enum dma_data_direction direction) | 56 | enum dma_data_direction direction) |
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index 2edc947f7c44..50643496eb63 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -192,7 +192,7 @@ struct file_operations scanlog_fops = { | |||
192 | .release = scanlog_release, | 192 | .release = scanlog_release, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | int __init scanlog_init(void) | 195 | static int __init scanlog_init(void) |
196 | { | 196 | { |
197 | struct proc_dir_entry *ent; | 197 | struct proc_dir_entry *ent; |
198 | 198 | ||
@@ -222,7 +222,7 @@ int __init scanlog_init(void) | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | void __exit scanlog_cleanup(void) | 225 | static void __exit scanlog_cleanup(void) |
226 | { | 226 | { |
227 | if (proc_ppc64_scan_log_dump) { | 227 | if (proc_ppc64_scan_log_dump) { |
228 | kfree(proc_ppc64_scan_log_dump->data); | 228 | kfree(proc_ppc64_scan_log_dump->data); |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 8903cf63236a..68b7f086d63d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -86,7 +86,7 @@ static void pseries_dedicated_idle(void); | |||
86 | 86 | ||
87 | struct mpic *pSeries_mpic; | 87 | struct mpic *pSeries_mpic; |
88 | 88 | ||
89 | void pSeries_show_cpuinfo(struct seq_file *m) | 89 | static void pSeries_show_cpuinfo(struct seq_file *m) |
90 | { | 90 | { |
91 | struct device_node *root; | 91 | struct device_node *root; |
92 | const char *model = ""; | 92 | const char *model = ""; |
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index 2f543cea9787..8e6b1ed1396e 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c | |||
@@ -93,7 +93,7 @@ static int query_cpu_stopped(unsigned int pcpu) | |||
93 | return cpu_status; | 93 | return cpu_status; |
94 | } | 94 | } |
95 | 95 | ||
96 | int pSeries_cpu_disable(void) | 96 | static int pSeries_cpu_disable(void) |
97 | { | 97 | { |
98 | int cpu = smp_processor_id(); | 98 | int cpu = smp_processor_id(); |
99 | 99 | ||
@@ -109,7 +109,7 @@ int pSeries_cpu_disable(void) | |||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | void pSeries_cpu_die(unsigned int cpu) | 112 | static void pSeries_cpu_die(unsigned int cpu) |
113 | { | 113 | { |
114 | int tries; | 114 | int tries; |
115 | int cpu_status; | 115 | int cpu_status; |
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index 0c0cfa32eb58..fd823c7c9ac8 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -381,7 +381,7 @@ int xics_get_irq(struct pt_regs *regs) | |||
381 | 381 | ||
382 | #ifdef CONFIG_SMP | 382 | #ifdef CONFIG_SMP |
383 | 383 | ||
384 | irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) | 384 | static irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) |
385 | { | 385 | { |
386 | int cpu = smp_processor_id(); | 386 | int cpu = smp_processor_id(); |
387 | 387 | ||
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index e00b46b9514e..977de9db8754 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -139,7 +139,6 @@ static void dart_build(struct iommu_table *tbl, long index, | |||
139 | 139 | ||
140 | *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); | 140 | *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); |
141 | 141 | ||
142 | rpn++; | ||
143 | uaddr += DART_PAGE_SIZE; | 142 | uaddr += DART_PAGE_SIZE; |
144 | } | 143 | } |
145 | 144 | ||
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 22612ed5379c..7d02fa2a8990 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -311,7 +311,7 @@ static void release_output_lock(void) | |||
311 | } | 311 | } |
312 | #endif | 312 | #endif |
313 | 313 | ||
314 | int xmon_core(struct pt_regs *regs, int fromipi) | 314 | static int xmon_core(struct pt_regs *regs, int fromipi) |
315 | { | 315 | { |
316 | int cmd = 0; | 316 | int cmd = 0; |
317 | unsigned long msr; | 317 | unsigned long msr; |
@@ -528,7 +528,7 @@ xmon_irq(int irq, void *d, struct pt_regs *regs) | |||
528 | return IRQ_HANDLED; | 528 | return IRQ_HANDLED; |
529 | } | 529 | } |
530 | 530 | ||
531 | int xmon_bpt(struct pt_regs *regs) | 531 | static int xmon_bpt(struct pt_regs *regs) |
532 | { | 532 | { |
533 | struct bpt *bp; | 533 | struct bpt *bp; |
534 | unsigned long offset; | 534 | unsigned long offset; |
@@ -554,7 +554,7 @@ int xmon_bpt(struct pt_regs *regs) | |||
554 | return 1; | 554 | return 1; |
555 | } | 555 | } |
556 | 556 | ||
557 | int xmon_sstep(struct pt_regs *regs) | 557 | static int xmon_sstep(struct pt_regs *regs) |
558 | { | 558 | { |
559 | if (user_mode(regs)) | 559 | if (user_mode(regs)) |
560 | return 0; | 560 | return 0; |
@@ -562,7 +562,7 @@ int xmon_sstep(struct pt_regs *regs) | |||
562 | return 1; | 562 | return 1; |
563 | } | 563 | } |
564 | 564 | ||
565 | int xmon_dabr_match(struct pt_regs *regs) | 565 | static int xmon_dabr_match(struct pt_regs *regs) |
566 | { | 566 | { |
567 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) | 567 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) |
568 | return 0; | 568 | return 0; |
@@ -572,7 +572,7 @@ int xmon_dabr_match(struct pt_regs *regs) | |||
572 | return 1; | 572 | return 1; |
573 | } | 573 | } |
574 | 574 | ||
575 | int xmon_iabr_match(struct pt_regs *regs) | 575 | static int xmon_iabr_match(struct pt_regs *regs) |
576 | { | 576 | { |
577 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) | 577 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) |
578 | return 0; | 578 | return 0; |
@@ -582,7 +582,7 @@ int xmon_iabr_match(struct pt_regs *regs) | |||
582 | return 1; | 582 | return 1; |
583 | } | 583 | } |
584 | 584 | ||
585 | int xmon_ipi(struct pt_regs *regs) | 585 | static int xmon_ipi(struct pt_regs *regs) |
586 | { | 586 | { |
587 | #ifdef CONFIG_SMP | 587 | #ifdef CONFIG_SMP |
588 | if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon)) | 588 | if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon)) |
@@ -591,7 +591,7 @@ int xmon_ipi(struct pt_regs *regs) | |||
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
593 | 593 | ||
594 | int xmon_fault_handler(struct pt_regs *regs) | 594 | static int xmon_fault_handler(struct pt_regs *regs) |
595 | { | 595 | { |
596 | struct bpt *bp; | 596 | struct bpt *bp; |
597 | unsigned long offset; | 597 | unsigned long offset; |
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile index e6c1d615bb86..ca0201300868 100644 --- a/arch/ppc/kernel/Makefile +++ b/arch/ppc/kernel/Makefile | |||
@@ -13,7 +13,6 @@ extra-$(CONFIG_POWER4) += idle_power4.o | |||
13 | extra-y += vmlinux.lds | 13 | extra-y += vmlinux.lds |
14 | 14 | ||
15 | obj-y := entry.o traps.o idle.o time.o misc.o \ | 15 | obj-y := entry.o traps.o idle.o time.o misc.o \ |
16 | process.o \ | ||
17 | setup.o \ | 16 | setup.o \ |
18 | ppc_htab.o | 17 | ppc_htab.o |
19 | obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o | 18 | obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o |
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c deleted file mode 100644 index a76b504299ca..000000000000 --- a/arch/ppc/kernel/process.c +++ /dev/null | |||
@@ -1,851 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/kernel/process.c | ||
3 | * | ||
4 | * Derived from "arch/i386/kernel/process.c" | ||
5 | * Copyright (C) 1995 Linus Torvalds | ||
6 | * | ||
7 | * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and | ||
8 | * Paul Mackerras (paulus@cs.anu.edu.au) | ||
9 | * | ||
10 | * PowerPC version | ||
11 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/smp.h> | ||
26 | #include <linux/smp_lock.h> | ||
27 | #include <linux/stddef.h> | ||
28 | #include <linux/unistd.h> | ||
29 | #include <linux/ptrace.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/user.h> | ||
32 | #include <linux/elf.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/prctl.h> | ||
35 | #include <linux/init_task.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/kallsyms.h> | ||
38 | #include <linux/mqueue.h> | ||
39 | #include <linux/hardirq.h> | ||
40 | |||
41 | #include <asm/pgtable.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | #include <asm/system.h> | ||
44 | #include <asm/io.h> | ||
45 | #include <asm/processor.h> | ||
46 | #include <asm/mmu.h> | ||
47 | #include <asm/prom.h> | ||
48 | |||
49 | extern unsigned long _get_SP(void); | ||
50 | |||
51 | struct task_struct *last_task_used_math = NULL; | ||
52 | struct task_struct *last_task_used_altivec = NULL; | ||
53 | struct task_struct *last_task_used_spe = NULL; | ||
54 | |||
55 | static struct fs_struct init_fs = INIT_FS; | ||
56 | static struct files_struct init_files = INIT_FILES; | ||
57 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
58 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
59 | struct mm_struct init_mm = INIT_MM(init_mm); | ||
60 | EXPORT_SYMBOL(init_mm); | ||
61 | |||
62 | /* this is 8kB-aligned so we can get to the thread_info struct | ||
63 | at the base of it from the stack pointer with 1 integer instruction. */ | ||
64 | union thread_union init_thread_union | ||
65 | __attribute__((__section__(".data.init_task"))) = | ||
66 | { INIT_THREAD_INFO(init_task) }; | ||
67 | |||
68 | /* initial task structure */ | ||
69 | struct task_struct init_task = INIT_TASK(init_task); | ||
70 | EXPORT_SYMBOL(init_task); | ||
71 | |||
72 | /* only used to get secondary processor up */ | ||
73 | struct task_struct *current_set[NR_CPUS] = {&init_task, }; | ||
74 | |||
75 | #undef SHOW_TASK_SWITCHES | ||
76 | #undef CHECK_STACK | ||
77 | |||
78 | #if defined(CHECK_STACK) | ||
79 | unsigned long | ||
80 | kernel_stack_top(struct task_struct *tsk) | ||
81 | { | ||
82 | return ((unsigned long)tsk) + sizeof(union task_union); | ||
83 | } | ||
84 | |||
85 | unsigned long | ||
86 | task_top(struct task_struct *tsk) | ||
87 | { | ||
88 | return ((unsigned long)tsk) + sizeof(struct thread_info); | ||
89 | } | ||
90 | |||
91 | /* check to make sure the kernel stack is healthy */ | ||
92 | int check_stack(struct task_struct *tsk) | ||
93 | { | ||
94 | unsigned long stack_top = kernel_stack_top(tsk); | ||
95 | unsigned long tsk_top = task_top(tsk); | ||
96 | int ret = 0; | ||
97 | |||
98 | #if 0 | ||
99 | /* check thread magic */ | ||
100 | if ( tsk->thread.magic != THREAD_MAGIC ) | ||
101 | { | ||
102 | ret |= 1; | ||
103 | printk("thread.magic bad: %08x\n", tsk->thread.magic); | ||
104 | } | ||
105 | #endif | ||
106 | |||
107 | if ( !tsk ) | ||
108 | printk("check_stack(): tsk bad tsk %p\n",tsk); | ||
109 | |||
110 | /* check if stored ksp is bad */ | ||
111 | if ( (tsk->thread.ksp > stack_top) || (tsk->thread.ksp < tsk_top) ) | ||
112 | { | ||
113 | printk("stack out of bounds: %s/%d\n" | ||
114 | " tsk_top %08lx ksp %08lx stack_top %08lx\n", | ||
115 | tsk->comm,tsk->pid, | ||
116 | tsk_top, tsk->thread.ksp, stack_top); | ||
117 | ret |= 2; | ||
118 | } | ||
119 | |||
120 | /* check if stack ptr RIGHT NOW is bad */ | ||
121 | if ( (tsk == current) && ((_get_SP() > stack_top ) || (_get_SP() < tsk_top)) ) | ||
122 | { | ||
123 | printk("current stack ptr out of bounds: %s/%d\n" | ||
124 | " tsk_top %08lx sp %08lx stack_top %08lx\n", | ||
125 | current->comm,current->pid, | ||
126 | tsk_top, _get_SP(), stack_top); | ||
127 | ret |= 4; | ||
128 | } | ||
129 | |||
130 | #if 0 | ||
131 | /* check amount of free stack */ | ||
132 | for ( i = (unsigned long *)task_top(tsk) ; i < kernel_stack_top(tsk) ; i++ ) | ||
133 | { | ||
134 | if ( !i ) | ||
135 | printk("check_stack(): i = %p\n", i); | ||
136 | if ( *i != 0 ) | ||
137 | { | ||
138 | /* only notify if it's less than 900 bytes */ | ||
139 | if ( (i - (unsigned long *)task_top(tsk)) < 900 ) | ||
140 | printk("%d bytes free on stack\n", | ||
141 | i - task_top(tsk)); | ||
142 | break; | ||
143 | } | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | if (ret) | ||
148 | { | ||
149 | panic("bad kernel stack"); | ||
150 | } | ||
151 | return(ret); | ||
152 | } | ||
153 | #endif /* defined(CHECK_STACK) */ | ||
154 | |||
155 | /* | ||
156 | * Make sure the floating-point register state in the | ||
157 | * the thread_struct is up to date for task tsk. | ||
158 | */ | ||
159 | void flush_fp_to_thread(struct task_struct *tsk) | ||
160 | { | ||
161 | if (tsk->thread.regs) { | ||
162 | /* | ||
163 | * We need to disable preemption here because if we didn't, | ||
164 | * another process could get scheduled after the regs->msr | ||
165 | * test but before we have finished saving the FP registers | ||
166 | * to the thread_struct. That process could take over the | ||
167 | * FPU, and then when we get scheduled again we would store | ||
168 | * bogus values for the remaining FP registers. | ||
169 | */ | ||
170 | preempt_disable(); | ||
171 | if (tsk->thread.regs->msr & MSR_FP) { | ||
172 | #ifdef CONFIG_SMP | ||
173 | /* | ||
174 | * This should only ever be called for current or | ||
175 | * for a stopped child process. Since we save away | ||
176 | * the FP register state on context switch on SMP, | ||
177 | * there is something wrong if a stopped child appears | ||
178 | * to still have its FP state in the CPU registers. | ||
179 | */ | ||
180 | BUG_ON(tsk != current); | ||
181 | #endif | ||
182 | giveup_fpu(current); | ||
183 | } | ||
184 | preempt_enable(); | ||
185 | } | ||
186 | } | ||
187 | |||
188 | void enable_kernel_fp(void) | ||
189 | { | ||
190 | WARN_ON(preemptible()); | ||
191 | |||
192 | #ifdef CONFIG_SMP | ||
193 | if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) | ||
194 | giveup_fpu(current); | ||
195 | else | ||
196 | giveup_fpu(NULL); /* just enables FP for kernel */ | ||
197 | #else | ||
198 | giveup_fpu(last_task_used_math); | ||
199 | #endif /* CONFIG_SMP */ | ||
200 | } | ||
201 | EXPORT_SYMBOL(enable_kernel_fp); | ||
202 | |||
203 | int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) | ||
204 | { | ||
205 | preempt_disable(); | ||
206 | if (tsk->thread.regs && (tsk->thread.regs->msr & MSR_FP)) | ||
207 | giveup_fpu(tsk); | ||
208 | preempt_enable(); | ||
209 | memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs)); | ||
210 | return 1; | ||
211 | } | ||
212 | |||
213 | #ifdef CONFIG_ALTIVEC | ||
214 | void enable_kernel_altivec(void) | ||
215 | { | ||
216 | WARN_ON(preemptible()); | ||
217 | |||
218 | #ifdef CONFIG_SMP | ||
219 | if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) | ||
220 | giveup_altivec(current); | ||
221 | else | ||
222 | giveup_altivec(NULL); /* just enable AltiVec for kernel - force */ | ||
223 | #else | ||
224 | giveup_altivec(last_task_used_altivec); | ||
225 | #endif /* __SMP __ */ | ||
226 | } | ||
227 | EXPORT_SYMBOL(enable_kernel_altivec); | ||
228 | |||
229 | /* | ||
230 | * Make sure the VMX/Altivec register state in the | ||
231 | * the thread_struct is up to date for task tsk. | ||
232 | */ | ||
233 | void flush_altivec_to_thread(struct task_struct *tsk) | ||
234 | { | ||
235 | if (tsk->thread.regs) { | ||
236 | preempt_disable(); | ||
237 | if (tsk->thread.regs->msr & MSR_VEC) { | ||
238 | #ifdef CONFIG_SMP | ||
239 | BUG_ON(tsk != current); | ||
240 | #endif | ||
241 | giveup_altivec(current); | ||
242 | } | ||
243 | preempt_enable(); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) | ||
248 | { | ||
249 | if (regs->msr & MSR_VEC) | ||
250 | giveup_altivec(current); | ||
251 | memcpy(vrregs, ¤t->thread.vr[0], sizeof(*vrregs)); | ||
252 | return 1; | ||
253 | } | ||
254 | #endif /* CONFIG_ALTIVEC */ | ||
255 | |||
256 | #ifdef CONFIG_SPE | ||
257 | void | ||
258 | enable_kernel_spe(void) | ||
259 | { | ||
260 | WARN_ON(preemptible()); | ||
261 | |||
262 | #ifdef CONFIG_SMP | ||
263 | if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) | ||
264 | giveup_spe(current); | ||
265 | else | ||
266 | giveup_spe(NULL); /* just enable SPE for kernel - force */ | ||
267 | #else | ||
268 | giveup_spe(last_task_used_spe); | ||
269 | #endif /* __SMP __ */ | ||
270 | } | ||
271 | EXPORT_SYMBOL(enable_kernel_spe); | ||
272 | |||
273 | void flush_spe_to_thread(struct task_struct *tsk) | ||
274 | { | ||
275 | if (tsk->thread.regs) { | ||
276 | preempt_disable(); | ||
277 | if (tsk->thread.regs->msr & MSR_SPE) { | ||
278 | #ifdef CONFIG_SMP | ||
279 | BUG_ON(tsk != current); | ||
280 | #endif | ||
281 | giveup_spe(current); | ||
282 | } | ||
283 | preempt_enable(); | ||
284 | } | ||
285 | } | ||
286 | |||
287 | int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs) | ||
288 | { | ||
289 | if (regs->msr & MSR_SPE) | ||
290 | giveup_spe(current); | ||
291 | /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */ | ||
292 | memcpy(evrregs, ¤t->thread.evr[0], sizeof(u32) * 35); | ||
293 | return 1; | ||
294 | } | ||
295 | #endif /* CONFIG_SPE */ | ||
296 | |||
297 | struct task_struct *__switch_to(struct task_struct *prev, | ||
298 | struct task_struct *new) | ||
299 | { | ||
300 | struct thread_struct *new_thread, *old_thread; | ||
301 | unsigned long s; | ||
302 | struct task_struct *last; | ||
303 | |||
304 | local_irq_save(s); | ||
305 | #ifdef CHECK_STACK | ||
306 | check_stack(prev); | ||
307 | check_stack(new); | ||
308 | #endif | ||
309 | |||
310 | #ifdef CONFIG_SMP | ||
311 | /* avoid complexity of lazy save/restore of fpu | ||
312 | * by just saving it every time we switch out if | ||
313 | * this task used the fpu during the last quantum. | ||
314 | * | ||
315 | * If it tries to use the fpu again, it'll trap and | ||
316 | * reload its fp regs. So we don't have to do a restore | ||
317 | * every switch, just a save. | ||
318 | * -- Cort | ||
319 | */ | ||
320 | if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP)) | ||
321 | giveup_fpu(prev); | ||
322 | #ifdef CONFIG_ALTIVEC | ||
323 | /* | ||
324 | * If the previous thread used altivec in the last quantum | ||
325 | * (thus changing altivec regs) then save them. | ||
326 | * We used to check the VRSAVE register but not all apps | ||
327 | * set it, so we don't rely on it now (and in fact we need | ||
328 | * to save & restore VSCR even if VRSAVE == 0). -- paulus | ||
329 | * | ||
330 | * On SMP we always save/restore altivec regs just to avoid the | ||
331 | * complexity of changing processors. | ||
332 | * -- Cort | ||
333 | */ | ||
334 | if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC))) | ||
335 | giveup_altivec(prev); | ||
336 | #endif /* CONFIG_ALTIVEC */ | ||
337 | #ifdef CONFIG_SPE | ||
338 | /* | ||
339 | * If the previous thread used spe in the last quantum | ||
340 | * (thus changing spe regs) then save them. | ||
341 | * | ||
342 | * On SMP we always save/restore spe regs just to avoid the | ||
343 | * complexity of changing processors. | ||
344 | */ | ||
345 | if ((prev->thread.regs && (prev->thread.regs->msr & MSR_SPE))) | ||
346 | giveup_spe(prev); | ||
347 | #endif /* CONFIG_SPE */ | ||
348 | #endif /* CONFIG_SMP */ | ||
349 | |||
350 | #ifdef CONFIG_ALTIVEC | ||
351 | /* Avoid the trap. On smp this this never happens since | ||
352 | * we don't set last_task_used_altivec -- Cort | ||
353 | */ | ||
354 | if (new->thread.regs && last_task_used_altivec == new) | ||
355 | new->thread.regs->msr |= MSR_VEC; | ||
356 | #endif | ||
357 | #ifdef CONFIG_SPE | ||
358 | /* Avoid the trap. On smp this this never happens since | ||
359 | * we don't set last_task_used_spe | ||
360 | */ | ||
361 | if (new->thread.regs && last_task_used_spe == new) | ||
362 | new->thread.regs->msr |= MSR_SPE; | ||
363 | #endif /* CONFIG_SPE */ | ||
364 | new_thread = &new->thread; | ||
365 | old_thread = ¤t->thread; | ||
366 | last = _switch(old_thread, new_thread); | ||
367 | local_irq_restore(s); | ||
368 | return last; | ||
369 | } | ||
370 | |||
371 | void show_regs(struct pt_regs * regs) | ||
372 | { | ||
373 | int i, trap; | ||
374 | |||
375 | printk("NIP: %08lX LR: %08lX SP: %08lX REGS: %p TRAP: %04lx %s\n", | ||
376 | regs->nip, regs->link, regs->gpr[1], regs, regs->trap, | ||
377 | print_tainted()); | ||
378 | printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n", | ||
379 | regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0, | ||
380 | regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0, | ||
381 | regs->msr&MSR_IR ? 1 : 0, | ||
382 | regs->msr&MSR_DR ? 1 : 0); | ||
383 | trap = TRAP(regs); | ||
384 | if (trap == 0x300 || trap == 0x600) | ||
385 | printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr); | ||
386 | printk("TASK = %p[%d] '%s' THREAD: %p\n", | ||
387 | current, current->pid, current->comm, task_thread_info(current)); | ||
388 | printk("Last syscall: %ld ", current->thread.last_syscall); | ||
389 | |||
390 | #ifdef CONFIG_SMP | ||
391 | printk(" CPU: %d", smp_processor_id()); | ||
392 | #endif /* CONFIG_SMP */ | ||
393 | |||
394 | for (i = 0; i < 32; i++) { | ||
395 | long r; | ||
396 | if ((i % 8) == 0) | ||
397 | printk("\n" KERN_INFO "GPR%02d: ", i); | ||
398 | if (__get_user(r, ®s->gpr[i])) | ||
399 | break; | ||
400 | printk("%08lX ", r); | ||
401 | if (i == 12 && !FULL_REGS(regs)) | ||
402 | break; | ||
403 | } | ||
404 | printk("\n"); | ||
405 | #ifdef CONFIG_KALLSYMS | ||
406 | /* | ||
407 | * Lookup NIP late so we have the best change of getting the | ||
408 | * above info out without failing | ||
409 | */ | ||
410 | printk("NIP [%08lx] ", regs->nip); | ||
411 | print_symbol("%s\n", regs->nip); | ||
412 | printk("LR [%08lx] ", regs->link); | ||
413 | print_symbol("%s\n", regs->link); | ||
414 | #endif | ||
415 | show_stack(current, (unsigned long *) regs->gpr[1]); | ||
416 | } | ||
417 | |||
418 | void exit_thread(void) | ||
419 | { | ||
420 | preempt_disable(); | ||
421 | if (last_task_used_math == current) | ||
422 | last_task_used_math = NULL; | ||
423 | if (last_task_used_altivec == current) | ||
424 | last_task_used_altivec = NULL; | ||
425 | #ifdef CONFIG_SPE | ||
426 | if (last_task_used_spe == current) | ||
427 | last_task_used_spe = NULL; | ||
428 | #endif | ||
429 | preempt_enable(); | ||
430 | } | ||
431 | |||
432 | void flush_thread(void) | ||
433 | { | ||
434 | preempt_disable(); | ||
435 | if (last_task_used_math == current) | ||
436 | last_task_used_math = NULL; | ||
437 | if (last_task_used_altivec == current) | ||
438 | last_task_used_altivec = NULL; | ||
439 | #ifdef CONFIG_SPE | ||
440 | if (last_task_used_spe == current) | ||
441 | last_task_used_spe = NULL; | ||
442 | #endif | ||
443 | preempt_enable(); | ||
444 | } | ||
445 | |||
446 | void | ||
447 | release_thread(struct task_struct *t) | ||
448 | { | ||
449 | } | ||
450 | |||
451 | /* | ||
452 | * This gets called before we allocate a new thread and copy | ||
453 | * the current task into it. | ||
454 | */ | ||
455 | void prepare_to_copy(struct task_struct *tsk) | ||
456 | { | ||
457 | struct pt_regs *regs = tsk->thread.regs; | ||
458 | |||
459 | if (regs == NULL) | ||
460 | return; | ||
461 | preempt_disable(); | ||
462 | if (regs->msr & MSR_FP) | ||
463 | giveup_fpu(current); | ||
464 | #ifdef CONFIG_ALTIVEC | ||
465 | if (regs->msr & MSR_VEC) | ||
466 | giveup_altivec(current); | ||
467 | #endif /* CONFIG_ALTIVEC */ | ||
468 | #ifdef CONFIG_SPE | ||
469 | if (regs->msr & MSR_SPE) | ||
470 | giveup_spe(current); | ||
471 | #endif /* CONFIG_SPE */ | ||
472 | preempt_enable(); | ||
473 | } | ||
474 | |||
475 | /* | ||
476 | * Copy a thread.. | ||
477 | */ | ||
478 | int | ||
479 | copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | ||
480 | unsigned long unused, | ||
481 | struct task_struct *p, struct pt_regs *regs) | ||
482 | { | ||
483 | struct pt_regs *childregs, *kregs; | ||
484 | extern void ret_from_fork(void); | ||
485 | unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; | ||
486 | unsigned long childframe; | ||
487 | |||
488 | CHECK_FULL_REGS(regs); | ||
489 | /* Copy registers */ | ||
490 | sp -= sizeof(struct pt_regs); | ||
491 | childregs = (struct pt_regs *) sp; | ||
492 | *childregs = *regs; | ||
493 | if ((childregs->msr & MSR_PR) == 0) { | ||
494 | /* for kernel thread, set `current' and stackptr in new task */ | ||
495 | childregs->gpr[1] = sp + sizeof(struct pt_regs); | ||
496 | childregs->gpr[2] = (unsigned long) p; | ||
497 | p->thread.regs = NULL; /* no user register state */ | ||
498 | } else { | ||
499 | childregs->gpr[1] = usp; | ||
500 | p->thread.regs = childregs; | ||
501 | if (clone_flags & CLONE_SETTLS) | ||
502 | childregs->gpr[2] = childregs->gpr[6]; | ||
503 | } | ||
504 | childregs->gpr[3] = 0; /* Result from fork() */ | ||
505 | sp -= STACK_FRAME_OVERHEAD; | ||
506 | childframe = sp; | ||
507 | |||
508 | /* | ||
509 | * The way this works is that at some point in the future | ||
510 | * some task will call _switch to switch to the new task. | ||
511 | * That will pop off the stack frame created below and start | ||
512 | * the new task running at ret_from_fork. The new task will | ||
513 | * do some house keeping and then return from the fork or clone | ||
514 | * system call, using the stack frame created above. | ||
515 | */ | ||
516 | sp -= sizeof(struct pt_regs); | ||
517 | kregs = (struct pt_regs *) sp; | ||
518 | sp -= STACK_FRAME_OVERHEAD; | ||
519 | p->thread.ksp = sp; | ||
520 | kregs->nip = (unsigned long)ret_from_fork; | ||
521 | |||
522 | p->thread.last_syscall = -1; | ||
523 | |||
524 | return 0; | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | * Set up a thread for executing a new program | ||
529 | */ | ||
530 | void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp) | ||
531 | { | ||
532 | set_fs(USER_DS); | ||
533 | memset(regs->gpr, 0, sizeof(regs->gpr)); | ||
534 | regs->ctr = 0; | ||
535 | regs->link = 0; | ||
536 | regs->xer = 0; | ||
537 | regs->ccr = 0; | ||
538 | regs->mq = 0; | ||
539 | regs->nip = nip; | ||
540 | regs->gpr[1] = sp; | ||
541 | regs->msr = MSR_USER; | ||
542 | preempt_disable(); | ||
543 | if (last_task_used_math == current) | ||
544 | last_task_used_math = NULL; | ||
545 | if (last_task_used_altivec == current) | ||
546 | last_task_used_altivec = NULL; | ||
547 | #ifdef CONFIG_SPE | ||
548 | if (last_task_used_spe == current) | ||
549 | last_task_used_spe = NULL; | ||
550 | #endif | ||
551 | preempt_enable(); | ||
552 | memset(current->thread.fpr, 0, sizeof(current->thread.fpr)); | ||
553 | current->thread.fpscr.val = 0; | ||
554 | #ifdef CONFIG_ALTIVEC | ||
555 | memset(current->thread.vr, 0, sizeof(current->thread.vr)); | ||
556 | memset(¤t->thread.vscr, 0, sizeof(current->thread.vscr)); | ||
557 | current->thread.vrsave = 0; | ||
558 | current->thread.used_vr = 0; | ||
559 | #endif /* CONFIG_ALTIVEC */ | ||
560 | #ifdef CONFIG_SPE | ||
561 | memset(current->thread.evr, 0, sizeof(current->thread.evr)); | ||
562 | current->thread.acc = 0; | ||
563 | current->thread.spefscr = 0; | ||
564 | current->thread.used_spe = 0; | ||
565 | #endif /* CONFIG_SPE */ | ||
566 | } | ||
567 | |||
568 | #define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \ | ||
569 | | PR_FP_EXC_RES | PR_FP_EXC_INV) | ||
570 | |||
571 | int set_fpexc_mode(struct task_struct *tsk, unsigned int val) | ||
572 | { | ||
573 | struct pt_regs *regs = tsk->thread.regs; | ||
574 | |||
575 | /* This is a bit hairy. If we are an SPE enabled processor | ||
576 | * (have embedded fp) we store the IEEE exception enable flags in | ||
577 | * fpexc_mode. fpexc_mode is also used for setting FP exception | ||
578 | * mode (asyn, precise, disabled) for 'Classic' FP. */ | ||
579 | if (val & PR_FP_EXC_SW_ENABLE) { | ||
580 | #ifdef CONFIG_SPE | ||
581 | tsk->thread.fpexc_mode = val & | ||
582 | (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT); | ||
583 | #else | ||
584 | return -EINVAL; | ||
585 | #endif | ||
586 | } else { | ||
587 | /* on a CONFIG_SPE this does not hurt us. The bits that | ||
588 | * __pack_fe01 use do not overlap with bits used for | ||
589 | * PR_FP_EXC_SW_ENABLE. Additionally, the MSR[FE0,FE1] bits | ||
590 | * on CONFIG_SPE implementations are reserved so writing to | ||
591 | * them does not change anything */ | ||
592 | if (val > PR_FP_EXC_PRECISE) | ||
593 | return -EINVAL; | ||
594 | tsk->thread.fpexc_mode = __pack_fe01(val); | ||
595 | if (regs != NULL && (regs->msr & MSR_FP) != 0) | ||
596 | regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1)) | ||
597 | | tsk->thread.fpexc_mode; | ||
598 | } | ||
599 | return 0; | ||
600 | } | ||
601 | |||
602 | int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) | ||
603 | { | ||
604 | unsigned int val; | ||
605 | |||
606 | if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) | ||
607 | #ifdef CONFIG_SPE | ||
608 | val = tsk->thread.fpexc_mode; | ||
609 | #else | ||
610 | return -EINVAL; | ||
611 | #endif | ||
612 | else | ||
613 | val = __unpack_fe01(tsk->thread.fpexc_mode); | ||
614 | return put_user(val, (unsigned int __user *) adr); | ||
615 | } | ||
616 | |||
617 | int sys_clone(unsigned long clone_flags, unsigned long usp, | ||
618 | int __user *parent_tidp, void __user *child_threadptr, | ||
619 | int __user *child_tidp, int p6, | ||
620 | struct pt_regs *regs) | ||
621 | { | ||
622 | CHECK_FULL_REGS(regs); | ||
623 | if (usp == 0) | ||
624 | usp = regs->gpr[1]; /* stack pointer for child */ | ||
625 | return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp); | ||
626 | } | ||
627 | |||
628 | int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
629 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
630 | struct pt_regs *regs) | ||
631 | { | ||
632 | CHECK_FULL_REGS(regs); | ||
633 | return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL); | ||
634 | } | ||
635 | |||
636 | int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
637 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
638 | struct pt_regs *regs) | ||
639 | { | ||
640 | CHECK_FULL_REGS(regs); | ||
641 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1], | ||
642 | regs, 0, NULL, NULL); | ||
643 | } | ||
644 | |||
645 | int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | ||
646 | unsigned long a3, unsigned long a4, unsigned long a5, | ||
647 | struct pt_regs *regs) | ||
648 | { | ||
649 | int error; | ||
650 | char * filename; | ||
651 | |||
652 | filename = getname((char __user *) a0); | ||
653 | error = PTR_ERR(filename); | ||
654 | if (IS_ERR(filename)) | ||
655 | goto out; | ||
656 | preempt_disable(); | ||
657 | if (regs->msr & MSR_FP) | ||
658 | giveup_fpu(current); | ||
659 | #ifdef CONFIG_ALTIVEC | ||
660 | if (regs->msr & MSR_VEC) | ||
661 | giveup_altivec(current); | ||
662 | #endif /* CONFIG_ALTIVEC */ | ||
663 | #ifdef CONFIG_SPE | ||
664 | if (regs->msr & MSR_SPE) | ||
665 | giveup_spe(current); | ||
666 | #endif /* CONFIG_SPE */ | ||
667 | preempt_enable(); | ||
668 | error = do_execve(filename, (char __user *__user *) a1, | ||
669 | (char __user *__user *) a2, regs); | ||
670 | if (error == 0) { | ||
671 | task_lock(current); | ||
672 | current->ptrace &= ~PT_DTRACE; | ||
673 | task_unlock(current); | ||
674 | } | ||
675 | putname(filename); | ||
676 | out: | ||
677 | return error; | ||
678 | } | ||
679 | |||
680 | void dump_stack(void) | ||
681 | { | ||
682 | show_stack(current, NULL); | ||
683 | } | ||
684 | |||
685 | EXPORT_SYMBOL(dump_stack); | ||
686 | |||
687 | void show_stack(struct task_struct *tsk, unsigned long *stack) | ||
688 | { | ||
689 | unsigned long sp, stack_top, prev_sp, ret; | ||
690 | int count = 0; | ||
691 | unsigned long next_exc = 0; | ||
692 | struct pt_regs *regs; | ||
693 | extern char ret_from_except, ret_from_except_full, ret_from_syscall; | ||
694 | |||
695 | sp = (unsigned long) stack; | ||
696 | if (tsk == NULL) | ||
697 | tsk = current; | ||
698 | if (sp == 0) { | ||
699 | if (tsk == current) | ||
700 | asm("mr %0,1" : "=r" (sp)); | ||
701 | else | ||
702 | sp = tsk->thread.ksp; | ||
703 | } | ||
704 | |||
705 | prev_sp = (unsigned long) end_of_stack(tsk); | ||
706 | stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE; | ||
707 | while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { | ||
708 | if (count == 0) { | ||
709 | printk("Call trace:"); | ||
710 | #ifdef CONFIG_KALLSYMS | ||
711 | printk("\n"); | ||
712 | #endif | ||
713 | } else { | ||
714 | if (next_exc) { | ||
715 | ret = next_exc; | ||
716 | next_exc = 0; | ||
717 | } else | ||
718 | ret = *(unsigned long *)(sp + 4); | ||
719 | printk(" [%08lx] ", ret); | ||
720 | #ifdef CONFIG_KALLSYMS | ||
721 | print_symbol("%s", ret); | ||
722 | printk("\n"); | ||
723 | #endif | ||
724 | if (ret == (unsigned long) &ret_from_except | ||
725 | || ret == (unsigned long) &ret_from_except_full | ||
726 | || ret == (unsigned long) &ret_from_syscall) { | ||
727 | /* sp + 16 points to an exception frame */ | ||
728 | regs = (struct pt_regs *) (sp + 16); | ||
729 | if (sp + 16 + sizeof(*regs) <= stack_top) | ||
730 | next_exc = regs->nip; | ||
731 | } | ||
732 | } | ||
733 | ++count; | ||
734 | sp = *(unsigned long *)sp; | ||
735 | } | ||
736 | #ifndef CONFIG_KALLSYMS | ||
737 | if (count > 0) | ||
738 | printk("\n"); | ||
739 | #endif | ||
740 | } | ||
741 | |||
742 | #if 0 | ||
743 | /* | ||
744 | * Low level print for debugging - Cort | ||
745 | */ | ||
746 | int __init ll_printk(const char *fmt, ...) | ||
747 | { | ||
748 | va_list args; | ||
749 | char buf[256]; | ||
750 | int i; | ||
751 | |||
752 | va_start(args, fmt); | ||
753 | i=vsprintf(buf,fmt,args); | ||
754 | ll_puts(buf); | ||
755 | va_end(args); | ||
756 | return i; | ||
757 | } | ||
758 | |||
759 | int lines = 24, cols = 80; | ||
760 | int orig_x = 0, orig_y = 0; | ||
761 | |||
762 | void puthex(unsigned long val) | ||
763 | { | ||
764 | unsigned char buf[10]; | ||
765 | int i; | ||
766 | for (i = 7; i >= 0; i--) | ||
767 | { | ||
768 | buf[i] = "0123456789ABCDEF"[val & 0x0F]; | ||
769 | val >>= 4; | ||
770 | } | ||
771 | buf[8] = '\0'; | ||
772 | prom_print(buf); | ||
773 | } | ||
774 | |||
775 | void __init ll_puts(const char *s) | ||
776 | { | ||
777 | int x,y; | ||
778 | char *vidmem = (char *)/*(_ISA_MEM_BASE + 0xB8000) */0xD00B8000; | ||
779 | char c; | ||
780 | extern int mem_init_done; | ||
781 | |||
782 | if ( mem_init_done ) /* assume this means we can printk */ | ||
783 | { | ||
784 | printk(s); | ||
785 | return; | ||
786 | } | ||
787 | |||
788 | #if 0 | ||
789 | if ( have_of ) | ||
790 | { | ||
791 | prom_print(s); | ||
792 | return; | ||
793 | } | ||
794 | #endif | ||
795 | |||
796 | /* | ||
797 | * can't ll_puts on chrp without openfirmware yet. | ||
798 | * vidmem just needs to be setup for it. | ||
799 | * -- Cort | ||
800 | */ | ||
801 | if ( _machine != _MACH_prep ) | ||
802 | return; | ||
803 | x = orig_x; | ||
804 | y = orig_y; | ||
805 | |||
806 | while ( ( c = *s++ ) != '\0' ) { | ||
807 | if ( c == '\n' ) { | ||
808 | x = 0; | ||
809 | if ( ++y >= lines ) { | ||
810 | /*scroll();*/ | ||
811 | /*y--;*/ | ||
812 | y = 0; | ||
813 | } | ||
814 | } else { | ||
815 | vidmem [ ( x + cols * y ) * 2 ] = c; | ||
816 | if ( ++x >= cols ) { | ||
817 | x = 0; | ||
818 | if ( ++y >= lines ) { | ||
819 | /*scroll();*/ | ||
820 | /*y--;*/ | ||
821 | y = 0; | ||
822 | } | ||
823 | } | ||
824 | } | ||
825 | } | ||
826 | |||
827 | orig_x = x; | ||
828 | orig_y = y; | ||
829 | } | ||
830 | #endif | ||
831 | |||
832 | unsigned long get_wchan(struct task_struct *p) | ||
833 | { | ||
834 | unsigned long ip, sp; | ||
835 | unsigned long stack_page = (unsigned long) task_stack_page(p); | ||
836 | int count = 0; | ||
837 | if (!p || p == current || p->state == TASK_RUNNING) | ||
838 | return 0; | ||
839 | sp = p->thread.ksp; | ||
840 | do { | ||
841 | sp = *(unsigned long *)sp; | ||
842 | if (sp < stack_page || sp >= stack_page + 8188) | ||
843 | return 0; | ||
844 | if (count > 0) { | ||
845 | ip = *(unsigned long *)(sp + 4); | ||
846 | if (!in_sched_functions(ip)) | ||
847 | return ip; | ||
848 | } | ||
849 | } while (count++ < 16); | ||
850 | return 0; | ||
851 | } | ||
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index d1aaf31bd97e..f63e07bd9f9c 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -293,6 +293,7 @@ static int send_request(struct request *req) | |||
293 | u16 viocmd; | 293 | u16 viocmd; |
294 | HvLpEvent_Rc hvrc; | 294 | HvLpEvent_Rc hvrc; |
295 | struct vioblocklpevent *bevent; | 295 | struct vioblocklpevent *bevent; |
296 | struct HvLpEvent *hev; | ||
296 | struct scatterlist sg[VIOMAXBLOCKDMA]; | 297 | struct scatterlist sg[VIOMAXBLOCKDMA]; |
297 | int sgindex; | 298 | int sgindex; |
298 | int statindex; | 299 | int statindex; |
@@ -347,22 +348,19 @@ static int send_request(struct request *req) | |||
347 | * token so we can match the response up later | 348 | * token so we can match the response up later |
348 | */ | 349 | */ |
349 | memset(bevent, 0, sizeof(struct vioblocklpevent)); | 350 | memset(bevent, 0, sizeof(struct vioblocklpevent)); |
350 | bevent->event.xFlags.xValid = 1; | 351 | hev = &bevent->event; |
351 | bevent->event.xFlags.xFunction = HvLpEvent_Function_Int; | 352 | hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK | |
352 | bevent->event.xFlags.xAckInd = HvLpEvent_AckInd_DoAck; | 353 | HV_LP_EVENT_INT; |
353 | bevent->event.xFlags.xAckType = HvLpEvent_AckType_ImmediateAck; | 354 | hev->xType = HvLpEvent_Type_VirtualIo; |
354 | bevent->event.xType = HvLpEvent_Type_VirtualIo; | 355 | hev->xSubtype = viocmd; |
355 | bevent->event.xSubtype = viocmd; | 356 | hev->xSourceLp = HvLpConfig_getLpIndex(); |
356 | bevent->event.xSourceLp = HvLpConfig_getLpIndex(); | 357 | hev->xTargetLp = viopath_hostLp; |
357 | bevent->event.xTargetLp = viopath_hostLp; | 358 | hev->xSizeMinus1 = |
358 | bevent->event.xSizeMinus1 = | ||
359 | offsetof(struct vioblocklpevent, u.rw_data.dma_info) + | 359 | offsetof(struct vioblocklpevent, u.rw_data.dma_info) + |
360 | (sizeof(bevent->u.rw_data.dma_info[0]) * nsg) - 1; | 360 | (sizeof(bevent->u.rw_data.dma_info[0]) * nsg) - 1; |
361 | bevent->event.xSourceInstanceId = | 361 | hev->xSourceInstanceId = viopath_sourceinst(viopath_hostLp); |
362 | viopath_sourceinst(viopath_hostLp); | 362 | hev->xTargetInstanceId = viopath_targetinst(viopath_hostLp); |
363 | bevent->event.xTargetInstanceId = | 363 | hev->xCorrelationToken = (u64)req; |
364 | viopath_targetinst(viopath_hostLp); | ||
365 | bevent->event.xCorrelationToken = (u64)req; | ||
366 | bevent->version = VIOVERSION; | 364 | bevent->version = VIOVERSION; |
367 | bevent->disk = DEVICE_NO(d); | 365 | bevent->disk = DEVICE_NO(d); |
368 | bevent->u.rw_data.offset = start; | 366 | bevent->u.rw_data.offset = start; |
@@ -649,10 +647,10 @@ static void handle_block_event(struct HvLpEvent *event) | |||
649 | /* Notification that a partition went away! */ | 647 | /* Notification that a partition went away! */ |
650 | return; | 648 | return; |
651 | /* First, we should NEVER get an int here...only acks */ | 649 | /* First, we should NEVER get an int here...only acks */ |
652 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 650 | if (hvlpevent_is_int(event)) { |
653 | printk(VIOD_KERN_WARNING | 651 | printk(VIOD_KERN_WARNING |
654 | "Yikes! got an int in viodasd event handler!\n"); | 652 | "Yikes! got an int in viodasd event handler!\n"); |
655 | if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { | 653 | if (hvlpevent_need_ack(event)) { |
656 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 654 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
657 | HvCallEvent_ackLpEvent(event); | 655 | HvCallEvent_ackLpEvent(event); |
658 | } | 656 | } |
@@ -695,7 +693,7 @@ static void handle_block_event(struct HvLpEvent *event) | |||
695 | 693 | ||
696 | default: | 694 | default: |
697 | printk(VIOD_KERN_WARNING "invalid subtype!"); | 695 | printk(VIOD_KERN_WARNING "invalid subtype!"); |
698 | if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { | 696 | if (hvlpevent_need_ack(event)) { |
699 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 697 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
700 | HvCallEvent_ackLpEvent(event); | 698 | HvCallEvent_ackLpEvent(event); |
701 | } | 699 | } |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index b5191780ecca..193446e6a08a 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -542,10 +542,10 @@ static void vio_handle_cd_event(struct HvLpEvent *event) | |||
542 | /* Notification that a partition went away! */ | 542 | /* Notification that a partition went away! */ |
543 | return; | 543 | return; |
544 | /* First, we should NEVER get an int here...only acks */ | 544 | /* First, we should NEVER get an int here...only acks */ |
545 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 545 | if (hvlpevent_is_int(event)) { |
546 | printk(VIOCD_KERN_WARNING | 546 | printk(VIOCD_KERN_WARNING |
547 | "Yikes! got an int in viocd event handler!\n"); | 547 | "Yikes! got an int in viocd event handler!\n"); |
548 | if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { | 548 | if (hvlpevent_need_ack(event)) { |
549 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 549 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
550 | HvCallEvent_ackLpEvent(event); | 550 | HvCallEvent_ackLpEvent(event); |
551 | } | 551 | } |
@@ -616,7 +616,7 @@ return_complete: | |||
616 | printk(VIOCD_KERN_WARNING | 616 | printk(VIOCD_KERN_WARNING |
617 | "message with invalid subtype %0x04X!\n", | 617 | "message with invalid subtype %0x04X!\n", |
618 | event->xSubtype & VIOMINOR_SUBTYPE_MASK); | 618 | event->xSubtype & VIOMINOR_SUBTYPE_MASK); |
619 | if (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck) { | 619 | if (hvlpevent_need_ack(event)) { |
620 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 620 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
621 | HvCallEvent_ackLpEvent(event); | 621 | HvCallEvent_ackLpEvent(event); |
622 | } | 622 | } |
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile index e41060c76226..9d180c42816c 100644 --- a/drivers/char/drm/Makefile +++ b/drivers/char/drm/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. | 3 | # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. |
4 | 4 | ||
5 | drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \ | 5 | drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \ |
6 | drm_drv.o drm_fops.o drm_init.o drm_ioctl.o drm_irq.o \ | 6 | drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \ |
7 | drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ | 7 | drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ |
8 | drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \ | 8 | drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \ |
9 | drm_sysfs.o | 9 | drm_sysfs.o |
@@ -18,7 +18,7 @@ radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o | |||
18 | ffb-objs := ffb_drv.o ffb_context.o | 18 | ffb-objs := ffb_drv.o ffb_context.o |
19 | sis-objs := sis_drv.o sis_ds.o sis_mm.o | 19 | sis-objs := sis_drv.o sis_ds.o sis_mm.o |
20 | savage-objs := savage_drv.o savage_bci.o savage_state.o | 20 | savage-objs := savage_drv.o savage_bci.o savage_state.o |
21 | via-objs := via_irq.o via_drv.o via_ds.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o | 21 | via-objs := via_irq.o via_drv.o via_ds.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o |
22 | 22 | ||
23 | ifeq ($(CONFIG_COMPAT),y) | 23 | ifeq ($(CONFIG_COMPAT),y) |
24 | drm-objs += drm_ioc32.o | 24 | drm-objs += drm_ioc32.o |
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index efff0eec618c..5485382cadec 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c | |||
@@ -52,7 +52,7 @@ | |||
52 | # define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ | 52 | # define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ |
53 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ | 53 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ |
54 | 54 | ||
55 | static unsigned long drm_ati_alloc_pcigart_table(void) | 55 | static void *drm_ati_alloc_pcigart_table(void) |
56 | { | 56 | { |
57 | unsigned long address; | 57 | unsigned long address; |
58 | struct page *page; | 58 | struct page *page; |
@@ -72,27 +72,26 @@ static unsigned long drm_ati_alloc_pcigart_table(void) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); | 74 | DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); |
75 | return address; | 75 | return (void *)address; |
76 | } | 76 | } |
77 | 77 | ||
78 | static void drm_ati_free_pcigart_table(unsigned long address) | 78 | static void drm_ati_free_pcigart_table(void *address) |
79 | { | 79 | { |
80 | struct page *page; | 80 | struct page *page; |
81 | int i; | 81 | int i; |
82 | DRM_DEBUG("%s\n", __FUNCTION__); | 82 | DRM_DEBUG("%s\n", __FUNCTION__); |
83 | 83 | ||
84 | page = virt_to_page(address); | 84 | page = virt_to_page((unsigned long)address); |
85 | 85 | ||
86 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { | 86 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { |
87 | __put_page(page); | 87 | __put_page(page); |
88 | ClearPageReserved(page); | 88 | ClearPageReserved(page); |
89 | } | 89 | } |
90 | 90 | ||
91 | free_pages(address, ATI_PCIGART_TABLE_ORDER); | 91 | free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); |
92 | } | 92 | } |
93 | 93 | ||
94 | int drm_ati_pcigart_cleanup(drm_device_t * dev, | 94 | int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) |
95 | drm_ati_pcigart_info * gart_info) | ||
96 | { | 95 | { |
97 | drm_sg_mem_t *entry = dev->sg; | 96 | drm_sg_mem_t *entry = dev->sg; |
98 | unsigned long pages; | 97 | unsigned long pages; |
@@ -136,10 +135,10 @@ int drm_ati_pcigart_cleanup(drm_device_t * dev, | |||
136 | 135 | ||
137 | EXPORT_SYMBOL(drm_ati_pcigart_cleanup); | 136 | EXPORT_SYMBOL(drm_ati_pcigart_cleanup); |
138 | 137 | ||
139 | int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) | 138 | int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) |
140 | { | 139 | { |
141 | drm_sg_mem_t *entry = dev->sg; | 140 | drm_sg_mem_t *entry = dev->sg; |
142 | unsigned long address = 0; | 141 | void *address = NULL; |
143 | unsigned long pages; | 142 | unsigned long pages; |
144 | u32 *pci_gart, page_base, bus_address = 0; | 143 | u32 *pci_gart, page_base, bus_address = 0; |
145 | int i, j, ret = 0; | 144 | int i, j, ret = 0; |
@@ -163,7 +162,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) | |||
163 | goto done; | 162 | goto done; |
164 | } | 163 | } |
165 | 164 | ||
166 | bus_address = pci_map_single(dev->pdev, (void *)address, | 165 | bus_address = pci_map_single(dev->pdev, address, |
167 | ATI_PCIGART_TABLE_PAGES * | 166 | ATI_PCIGART_TABLE_PAGES * |
168 | PAGE_SIZE, PCI_DMA_TODEVICE); | 167 | PAGE_SIZE, PCI_DMA_TODEVICE); |
169 | if (bus_address == 0) { | 168 | if (bus_address == 0) { |
@@ -176,7 +175,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) | |||
176 | address = gart_info->addr; | 175 | address = gart_info->addr; |
177 | bus_address = gart_info->bus_addr; | 176 | bus_address = gart_info->bus_addr; |
178 | DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", | 177 | DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", |
179 | bus_address, address); | 178 | bus_address, (unsigned long)address); |
180 | } | 179 | } |
181 | 180 | ||
182 | pci_gart = (u32 *) address; | 181 | pci_gart = (u32 *) address; |
@@ -195,7 +194,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) | |||
195 | if (entry->busaddr[i] == 0) { | 194 | if (entry->busaddr[i] == 0) { |
196 | DRM_ERROR("unable to map PCIGART pages!\n"); | 195 | DRM_ERROR("unable to map PCIGART pages!\n"); |
197 | drm_ati_pcigart_cleanup(dev, gart_info); | 196 | drm_ati_pcigart_cleanup(dev, gart_info); |
198 | address = 0; | 197 | address = NULL; |
199 | bus_address = 0; | 198 | bus_address = 0; |
200 | goto done; | 199 | goto done; |
201 | } | 200 | } |
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 64d6237fdd0b..9da0ddb892b5 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h | |||
@@ -90,8 +90,8 @@ | |||
90 | #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ | 90 | #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ |
91 | #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ | 91 | #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ |
92 | 92 | ||
93 | #define _DRM_LOCK_HELD 0x80000000 /**< Hardware lock is held */ | 93 | #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ |
94 | #define _DRM_LOCK_CONT 0x40000000 /**< Hardware lock is contended */ | 94 | #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ |
95 | #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) | 95 | #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) |
96 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) | 96 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) |
97 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) | 97 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 3dc3c9d79ae4..54b561e69486 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -144,20 +144,6 @@ | |||
144 | /** \name Backward compatibility section */ | 144 | /** \name Backward compatibility section */ |
145 | /*@{*/ | 145 | /*@{*/ |
146 | 146 | ||
147 | #ifndef MODULE_LICENSE | ||
148 | #define MODULE_LICENSE(x) | ||
149 | #endif | ||
150 | |||
151 | #ifndef preempt_disable | ||
152 | #define preempt_disable() | ||
153 | #define preempt_enable() | ||
154 | #endif | ||
155 | |||
156 | #ifndef pte_offset_map | ||
157 | #define pte_offset_map pte_offset | ||
158 | #define pte_unmap(pte) | ||
159 | #endif | ||
160 | |||
161 | #define DRM_RPR_ARG(vma) vma, | 147 | #define DRM_RPR_ARG(vma) vma, |
162 | 148 | ||
163 | #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) | 149 | #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) |
@@ -286,10 +272,13 @@ typedef int drm_ioctl_t(struct inode *inode, struct file *filp, | |||
286 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 272 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
287 | unsigned long arg); | 273 | unsigned long arg); |
288 | 274 | ||
275 | #define DRM_AUTH 0x1 | ||
276 | #define DRM_MASTER 0x2 | ||
277 | #define DRM_ROOT_ONLY 0x4 | ||
278 | |||
289 | typedef struct drm_ioctl_desc { | 279 | typedef struct drm_ioctl_desc { |
290 | drm_ioctl_t *func; | 280 | drm_ioctl_t *func; |
291 | int auth_needed; | 281 | int flags; |
292 | int root_only; | ||
293 | } drm_ioctl_desc_t; | 282 | } drm_ioctl_desc_t; |
294 | 283 | ||
295 | typedef struct drm_devstate { | 284 | typedef struct drm_devstate { |
@@ -384,6 +373,7 @@ typedef struct drm_buf_entry { | |||
384 | /** File private data */ | 373 | /** File private data */ |
385 | typedef struct drm_file { | 374 | typedef struct drm_file { |
386 | int authenticated; | 375 | int authenticated; |
376 | int master; | ||
387 | int minor; | 377 | int minor; |
388 | pid_t pid; | 378 | pid_t pid; |
389 | uid_t uid; | 379 | uid_t uid; |
@@ -532,8 +522,9 @@ typedef struct drm_vbl_sig { | |||
532 | typedef struct ati_pcigart_info { | 522 | typedef struct ati_pcigart_info { |
533 | int gart_table_location; | 523 | int gart_table_location; |
534 | int is_pcie; | 524 | int is_pcie; |
535 | unsigned long addr; | 525 | void *addr; |
536 | dma_addr_t bus_addr; | 526 | dma_addr_t bus_addr; |
527 | drm_local_map_t mapping; | ||
537 | } drm_ati_pcigart_info; | 528 | } drm_ati_pcigart_info; |
538 | 529 | ||
539 | /** | 530 | /** |
@@ -544,16 +535,14 @@ typedef struct ati_pcigart_info { | |||
544 | struct drm_device; | 535 | struct drm_device; |
545 | 536 | ||
546 | struct drm_driver { | 537 | struct drm_driver { |
547 | int (*preinit) (struct drm_device *, unsigned long flags); | 538 | int (*load) (struct drm_device *, unsigned long flags); |
548 | void (*prerelease) (struct drm_device *, struct file * filp); | 539 | int (*firstopen) (struct drm_device *); |
549 | void (*pretakedown) (struct drm_device *); | 540 | int (*open) (struct drm_device *, drm_file_t *); |
550 | int (*postcleanup) (struct drm_device *); | 541 | void (*preclose) (struct drm_device *, struct file * filp); |
551 | int (*presetup) (struct drm_device *); | 542 | void (*postclose) (struct drm_device *, drm_file_t *); |
552 | int (*postsetup) (struct drm_device *); | 543 | void (*lastclose) (struct drm_device *); |
544 | int (*unload) (struct drm_device *); | ||
553 | int (*dma_ioctl) (DRM_IOCTL_ARGS); | 545 | int (*dma_ioctl) (DRM_IOCTL_ARGS); |
554 | int (*open_helper) (struct drm_device *, drm_file_t *); | ||
555 | void (*free_filp_priv) (struct drm_device *, drm_file_t *); | ||
556 | void (*release) (struct drm_device *, struct file * filp); | ||
557 | void (*dma_ready) (struct drm_device *); | 546 | void (*dma_ready) (struct drm_device *); |
558 | int (*dma_quiescent) (struct drm_device *); | 547 | int (*dma_quiescent) (struct drm_device *); |
559 | int (*context_ctor) (struct drm_device * dev, int context); | 548 | int (*context_ctor) (struct drm_device * dev, int context); |
@@ -561,8 +550,9 @@ struct drm_driver { | |||
561 | int (*kernel_context_switch) (struct drm_device * dev, int old, | 550 | int (*kernel_context_switch) (struct drm_device * dev, int old, |
562 | int new); | 551 | int new); |
563 | void (*kernel_context_switch_unlock) (struct drm_device * dev, | 552 | void (*kernel_context_switch_unlock) (struct drm_device * dev, |
564 | drm_lock_t * lock); | 553 | drm_lock_t *lock); |
565 | int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); | 554 | int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); |
555 | int (*dri_library_name) (struct drm_device *dev, char *buf); | ||
566 | 556 | ||
567 | /** | 557 | /** |
568 | * Called by \c drm_device_is_agp. Typically used to determine if a | 558 | * Called by \c drm_device_is_agp. Typically used to determine if a |
@@ -579,16 +569,24 @@ struct drm_driver { | |||
579 | 569 | ||
580 | /* these have to be filled in */ | 570 | /* these have to be filled in */ |
581 | 571 | ||
582 | int (*postinit) (struct drm_device *, unsigned long flags); | 572 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
583 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | ||
584 | void (*irq_preinstall) (struct drm_device * dev); | 573 | void (*irq_preinstall) (struct drm_device * dev); |
585 | void (*irq_postinstall) (struct drm_device * dev); | 574 | void (*irq_postinstall) (struct drm_device * dev); |
586 | void (*irq_uninstall) (struct drm_device * dev); | 575 | void (*irq_uninstall) (struct drm_device * dev); |
587 | void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); | 576 | void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); |
577 | void (*reclaim_buffers_locked) (struct drm_device *dev, | ||
578 | struct file *filp); | ||
588 | unsigned long (*get_map_ofs) (drm_map_t * map); | 579 | unsigned long (*get_map_ofs) (drm_map_t * map); |
589 | unsigned long (*get_reg_ofs) (struct drm_device * dev); | 580 | unsigned long (*get_reg_ofs) (struct drm_device * dev); |
590 | void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); | 581 | void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); |
591 | int (*version) (drm_version_t * version); | 582 | |
583 | int major; | ||
584 | int minor; | ||
585 | int patchlevel; | ||
586 | char *name; | ||
587 | char *desc; | ||
588 | char *date; | ||
589 | |||
592 | u32 driver_features; | 590 | u32 driver_features; |
593 | int dev_priv_size; | 591 | int dev_priv_size; |
594 | drm_ioctl_desc_t *ioctls; | 592 | drm_ioctl_desc_t *ioctls; |
@@ -752,19 +750,43 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) | |||
752 | { | 750 | { |
753 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); | 751 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); |
754 | } | 752 | } |
753 | |||
754 | #define DRM_MTRR_WC MTRR_TYPE_WRCOMB | ||
755 | |||
756 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
757 | unsigned int flags) | ||
758 | { | ||
759 | return mtrr_add(offset, size, flags, 1); | ||
760 | } | ||
761 | |||
762 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
763 | unsigned long size, unsigned int flags) | ||
764 | { | ||
765 | return mtrr_del(handle, offset, size); | ||
766 | } | ||
767 | |||
755 | #else | 768 | #else |
756 | #define drm_core_has_MTRR(dev) (0) | 769 | #define drm_core_has_MTRR(dev) (0) |
770 | |||
771 | #define DRM_MTRR_WC 0 | ||
772 | |||
773 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
774 | unsigned int flags) | ||
775 | { | ||
776 | return 0; | ||
777 | } | ||
778 | |||
779 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
780 | unsigned long size, unsigned int flags) | ||
781 | { | ||
782 | return 0; | ||
783 | } | ||
757 | #endif | 784 | #endif |
758 | 785 | ||
759 | /******************************************************************/ | 786 | /******************************************************************/ |
760 | /** \name Internal function definitions */ | 787 | /** \name Internal function definitions */ |
761 | /*@{*/ | 788 | /*@{*/ |
762 | 789 | ||
763 | /* Misc. support (drm_init.h) */ | ||
764 | extern int drm_flags; | ||
765 | extern void drm_parse_options(char *s); | ||
766 | extern int drm_cpu_valid(void); | ||
767 | |||
768 | /* Driver support (drm_drv.h) */ | 790 | /* Driver support (drm_drv.h) */ |
769 | extern int drm_init(struct drm_driver *driver); | 791 | extern int drm_init(struct drm_driver *driver); |
770 | extern void drm_exit(struct drm_driver *driver); | 792 | extern void drm_exit(struct drm_driver *driver); |
@@ -772,12 +794,11 @@ extern int drm_ioctl(struct inode *inode, struct file *filp, | |||
772 | unsigned int cmd, unsigned long arg); | 794 | unsigned int cmd, unsigned long arg); |
773 | extern long drm_compat_ioctl(struct file *filp, | 795 | extern long drm_compat_ioctl(struct file *filp, |
774 | unsigned int cmd, unsigned long arg); | 796 | unsigned int cmd, unsigned long arg); |
775 | extern int drm_takedown(drm_device_t * dev); | 797 | extern int drm_lastclose(drm_device_t *dev); |
776 | 798 | ||
777 | /* Device support (drm_fops.h) */ | 799 | /* Device support (drm_fops.h) */ |
778 | extern int drm_open(struct inode *inode, struct file *filp); | 800 | extern int drm_open(struct inode *inode, struct file *filp); |
779 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 801 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
780 | extern int drm_flush(struct file *filp); | ||
781 | extern int drm_fasync(int fd, struct file *filp, int on); | 802 | extern int drm_fasync(int fd, struct file *filp, int on); |
782 | extern int drm_release(struct inode *inode, struct file *filp); | 803 | extern int drm_release(struct inode *inode, struct file *filp); |
783 | 804 | ||
@@ -819,6 +840,8 @@ extern int drm_getstats(struct inode *inode, struct file *filp, | |||
819 | unsigned int cmd, unsigned long arg); | 840 | unsigned int cmd, unsigned long arg); |
820 | extern int drm_setversion(struct inode *inode, struct file *filp, | 841 | extern int drm_setversion(struct inode *inode, struct file *filp, |
821 | unsigned int cmd, unsigned long arg); | 842 | unsigned int cmd, unsigned long arg); |
843 | extern int drm_noop(struct inode *inode, struct file *filp, | ||
844 | unsigned int cmd, unsigned long arg); | ||
822 | 845 | ||
823 | /* Context IOCTL support (drm_context.h) */ | 846 | /* Context IOCTL support (drm_context.h) */ |
824 | extern int drm_resctx(struct inode *inode, struct file *filp, | 847 | extern int drm_resctx(struct inode *inode, struct file *filp, |
@@ -857,10 +880,6 @@ extern int drm_getmagic(struct inode *inode, struct file *filp, | |||
857 | extern int drm_authmagic(struct inode *inode, struct file *filp, | 880 | extern int drm_authmagic(struct inode *inode, struct file *filp, |
858 | unsigned int cmd, unsigned long arg); | 881 | unsigned int cmd, unsigned long arg); |
859 | 882 | ||
860 | /* Placeholder for ioctls past */ | ||
861 | extern int drm_noop(struct inode *inode, struct file *filp, | ||
862 | unsigned int cmd, unsigned long arg); | ||
863 | |||
864 | /* Locking IOCTL support (drm_lock.h) */ | 883 | /* Locking IOCTL support (drm_lock.h) */ |
865 | extern int drm_lock(struct inode *inode, struct file *filp, | 884 | extern int drm_lock(struct inode *inode, struct file *filp, |
866 | unsigned int cmd, unsigned long arg); | 885 | unsigned int cmd, unsigned long arg); |
@@ -873,6 +892,7 @@ extern int drm_lock_free(drm_device_t * dev, | |||
873 | /* Buffer management support (drm_bufs.h) */ | 892 | /* Buffer management support (drm_bufs.h) */ |
874 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); | 893 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); |
875 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); | 894 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); |
895 | extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request); | ||
876 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, | 896 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, |
877 | unsigned int size, drm_map_type_t type, | 897 | unsigned int size, drm_map_type_t type, |
878 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); | 898 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); |
@@ -908,8 +928,8 @@ extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp); | |||
908 | /* IRQ support (drm_irq.h) */ | 928 | /* IRQ support (drm_irq.h) */ |
909 | extern int drm_control(struct inode *inode, struct file *filp, | 929 | extern int drm_control(struct inode *inode, struct file *filp, |
910 | unsigned int cmd, unsigned long arg); | 930 | unsigned int cmd, unsigned long arg); |
911 | extern int drm_irq_uninstall(drm_device_t * dev); | ||
912 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); | 931 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); |
932 | extern int drm_irq_uninstall(drm_device_t * dev); | ||
913 | extern void drm_driver_irq_preinstall(drm_device_t * dev); | 933 | extern void drm_driver_irq_preinstall(drm_device_t * dev); |
914 | extern void drm_driver_irq_postinstall(drm_device_t * dev); | 934 | extern void drm_driver_irq_postinstall(drm_device_t * dev); |
915 | extern void drm_driver_irq_uninstall(drm_device_t * dev); | 935 | extern void drm_driver_irq_uninstall(drm_device_t * dev); |
@@ -933,13 +953,17 @@ extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, | |||
933 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); | 953 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); |
934 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, | 954 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, |
935 | unsigned int cmd, unsigned long arg); | 955 | unsigned int cmd, unsigned long arg); |
936 | extern int drm_agp_alloc(struct inode *inode, struct file *filp, | 956 | extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request); |
957 | extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, | ||
937 | unsigned int cmd, unsigned long arg); | 958 | unsigned int cmd, unsigned long arg); |
938 | extern int drm_agp_free(struct inode *inode, struct file *filp, | 959 | extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request); |
960 | extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp, | ||
939 | unsigned int cmd, unsigned long arg); | 961 | unsigned int cmd, unsigned long arg); |
940 | extern int drm_agp_unbind(struct inode *inode, struct file *filp, | 962 | extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request); |
963 | extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, | ||
941 | unsigned int cmd, unsigned long arg); | 964 | unsigned int cmd, unsigned long arg); |
942 | extern int drm_agp_bind(struct inode *inode, struct file *filp, | 965 | extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request); |
966 | extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, | ||
943 | unsigned int cmd, unsigned long arg); | 967 | unsigned int cmd, unsigned long arg); |
944 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, | 968 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, |
945 | size_t pages, u32 type); | 969 | size_t pages, u32 type); |
@@ -991,10 +1015,8 @@ extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, | |||
991 | char *name); | 1015 | char *name); |
992 | extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); | 1016 | extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); |
993 | extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | 1017 | extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, |
994 | dev_t dev, | 1018 | drm_head_t *head); |
995 | struct device *device, | 1019 | extern void drm_sysfs_device_remove(struct class_device *class_dev); |
996 | const char *fmt, ...); | ||
997 | extern void drm_sysfs_device_remove(dev_t dev); | ||
998 | 1020 | ||
999 | /* Inline replacements for DRM_IOREMAP macros */ | 1021 | /* Inline replacements for DRM_IOREMAP macros */ |
1000 | static __inline__ void drm_core_ioremap(struct drm_map *map, | 1022 | static __inline__ void drm_core_ioremap(struct drm_map *map, |
diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c index 2b6453a9ffce..fabc930c67a2 100644 --- a/drivers/char/drm/drm_agpsupport.c +++ b/drivers/char/drm/drm_agpsupport.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * \file drm_agpsupport.h | 2 | * \file drm_agpsupport.c |
3 | * DRM support for AGP/GART backend | 3 | * DRM support for AGP/GART backend |
4 | * | 4 | * |
5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | 5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> |
@@ -91,7 +91,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp, | |||
91 | /** | 91 | /** |
92 | * Acquire the AGP device. | 92 | * Acquire the AGP device. |
93 | * | 93 | * |
94 | * \param dev DRM device that is to acquire AGP | 94 | * \param dev DRM device that is to acquire AGP. |
95 | * \return zero on success or a negative number on failure. | 95 | * \return zero on success or a negative number on failure. |
96 | * | 96 | * |
97 | * Verifies the AGP device hasn't been acquired before and calls | 97 | * Verifies the AGP device hasn't been acquired before and calls |
@@ -134,7 +134,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, | |||
134 | /** | 134 | /** |
135 | * Release the AGP device. | 135 | * Release the AGP device. |
136 | * | 136 | * |
137 | * \param dev DRM device that is to release AGP | 137 | * \param dev DRM device that is to release AGP. |
138 | * \return zero on success or a negative number on failure. | 138 | * \return zero on success or a negative number on failure. |
139 | * | 139 | * |
140 | * Verifies the AGP device has been acquired and calls \c agp_backend_release. | 140 | * Verifies the AGP device has been acquired and calls \c agp_backend_release. |
@@ -147,7 +147,6 @@ int drm_agp_release(drm_device_t * dev) | |||
147 | dev->agp->acquired = 0; | 147 | dev->agp->acquired = 0; |
148 | return 0; | 148 | return 0; |
149 | } | 149 | } |
150 | |||
151 | EXPORT_SYMBOL(drm_agp_release); | 150 | EXPORT_SYMBOL(drm_agp_release); |
152 | 151 | ||
153 | int drm_agp_release_ioctl(struct inode *inode, struct file *filp, | 152 | int drm_agp_release_ioctl(struct inode *inode, struct file *filp, |
@@ -208,30 +207,22 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, | |||
208 | * Verifies the AGP device is present and has been acquired, allocates the | 207 | * Verifies the AGP device is present and has been acquired, allocates the |
209 | * memory via alloc_agp() and creates a drm_agp_mem entry for it. | 208 | * memory via alloc_agp() and creates a drm_agp_mem entry for it. |
210 | */ | 209 | */ |
211 | int drm_agp_alloc(struct inode *inode, struct file *filp, | 210 | int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request) |
212 | unsigned int cmd, unsigned long arg) | ||
213 | { | 211 | { |
214 | drm_file_t *priv = filp->private_data; | ||
215 | drm_device_t *dev = priv->head->dev; | ||
216 | drm_agp_buffer_t request; | ||
217 | drm_agp_mem_t *entry; | 212 | drm_agp_mem_t *entry; |
218 | DRM_AGP_MEM *memory; | 213 | DRM_AGP_MEM *memory; |
219 | unsigned long pages; | 214 | unsigned long pages; |
220 | u32 type; | 215 | u32 type; |
221 | drm_agp_buffer_t __user *argp = (void __user *)arg; | ||
222 | 216 | ||
223 | if (!dev->agp || !dev->agp->acquired) | 217 | if (!dev->agp || !dev->agp->acquired) |
224 | return -EINVAL; | 218 | return -EINVAL; |
225 | if (copy_from_user(&request, argp, sizeof(request))) | ||
226 | return -EFAULT; | ||
227 | if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS))) | 219 | if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS))) |
228 | return -ENOMEM; | 220 | return -ENOMEM; |
229 | 221 | ||
230 | memset(entry, 0, sizeof(*entry)); | 222 | memset(entry, 0, sizeof(*entry)); |
231 | 223 | ||
232 | pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; | 224 | pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; |
233 | type = (u32) request.type; | 225 | type = (u32) request->type; |
234 | |||
235 | if (!(memory = drm_alloc_agp(dev, pages, type))) { | 226 | if (!(memory = drm_alloc_agp(dev, pages, type))) { |
236 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); | 227 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); |
237 | return -ENOMEM; | 228 | return -ENOMEM; |
@@ -247,16 +238,39 @@ int drm_agp_alloc(struct inode *inode, struct file *filp, | |||
247 | dev->agp->memory->prev = entry; | 238 | dev->agp->memory->prev = entry; |
248 | dev->agp->memory = entry; | 239 | dev->agp->memory = entry; |
249 | 240 | ||
250 | request.handle = entry->handle; | 241 | request->handle = entry->handle; |
251 | request.physical = memory->physical; | 242 | request->physical = memory->physical; |
243 | |||
244 | return 0; | ||
245 | } | ||
246 | EXPORT_SYMBOL(drm_agp_alloc); | ||
247 | |||
248 | int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, | ||
249 | unsigned int cmd, unsigned long arg) | ||
250 | { | ||
251 | drm_file_t *priv = filp->private_data; | ||
252 | drm_device_t *dev = priv->head->dev; | ||
253 | drm_agp_buffer_t request; | ||
254 | drm_agp_buffer_t __user *argp = (void __user *)arg; | ||
255 | int err; | ||
256 | |||
257 | if (copy_from_user(&request, argp, sizeof(request))) | ||
258 | return -EFAULT; | ||
259 | |||
260 | err = drm_agp_alloc(dev, &request); | ||
261 | if (err) | ||
262 | return err; | ||
252 | 263 | ||
253 | if (copy_to_user(argp, &request, sizeof(request))) { | 264 | if (copy_to_user(argp, &request, sizeof(request))) { |
265 | drm_agp_mem_t *entry = dev->agp->memory; | ||
266 | |||
254 | dev->agp->memory = entry->next; | 267 | dev->agp->memory = entry->next; |
255 | dev->agp->memory->prev = NULL; | 268 | dev->agp->memory->prev = NULL; |
256 | drm_free_agp(memory, pages); | 269 | drm_free_agp(entry->memory, entry->pages); |
257 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); | 270 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); |
258 | return -EFAULT; | 271 | return -EFAULT; |
259 | } | 272 | } |
273 | |||
260 | return 0; | 274 | return 0; |
261 | } | 275 | } |
262 | 276 | ||
@@ -293,21 +307,14 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev, | |||
293 | * Verifies the AGP device is present and acquired, looks-up the AGP memory | 307 | * Verifies the AGP device is present and acquired, looks-up the AGP memory |
294 | * entry and passes it to the unbind_agp() function. | 308 | * entry and passes it to the unbind_agp() function. |
295 | */ | 309 | */ |
296 | int drm_agp_unbind(struct inode *inode, struct file *filp, | 310 | int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request) |
297 | unsigned int cmd, unsigned long arg) | ||
298 | { | 311 | { |
299 | drm_file_t *priv = filp->private_data; | ||
300 | drm_device_t *dev = priv->head->dev; | ||
301 | drm_agp_binding_t request; | ||
302 | drm_agp_mem_t *entry; | 312 | drm_agp_mem_t *entry; |
303 | int ret; | 313 | int ret; |
304 | 314 | ||
305 | if (!dev->agp || !dev->agp->acquired) | 315 | if (!dev->agp || !dev->agp->acquired) |
306 | return -EINVAL; | 316 | return -EINVAL; |
307 | if (copy_from_user | 317 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) |
308 | (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) | ||
309 | return -EFAULT; | ||
310 | if (!(entry = drm_agp_lookup_entry(dev, request.handle))) | ||
311 | return -EINVAL; | 318 | return -EINVAL; |
312 | if (!entry->bound) | 319 | if (!entry->bound) |
313 | return -EINVAL; | 320 | return -EINVAL; |
@@ -316,6 +323,21 @@ int drm_agp_unbind(struct inode *inode, struct file *filp, | |||
316 | entry->bound = 0; | 323 | entry->bound = 0; |
317 | return ret; | 324 | return ret; |
318 | } | 325 | } |
326 | EXPORT_SYMBOL(drm_agp_unbind); | ||
327 | |||
328 | int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, | ||
329 | unsigned int cmd, unsigned long arg) | ||
330 | { | ||
331 | drm_file_t *priv = filp->private_data; | ||
332 | drm_device_t *dev = priv->head->dev; | ||
333 | drm_agp_binding_t request; | ||
334 | |||
335 | if (copy_from_user | ||
336 | (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) | ||
337 | return -EFAULT; | ||
338 | |||
339 | return drm_agp_unbind(dev, &request); | ||
340 | } | ||
319 | 341 | ||
320 | /** | 342 | /** |
321 | * Bind AGP memory into the GATT (ioctl) | 343 | * Bind AGP memory into the GATT (ioctl) |
@@ -330,26 +352,19 @@ int drm_agp_unbind(struct inode *inode, struct file *filp, | |||
330 | * is currently bound into the GATT. Looks-up the AGP memory entry and passes | 352 | * is currently bound into the GATT. Looks-up the AGP memory entry and passes |
331 | * it to bind_agp() function. | 353 | * it to bind_agp() function. |
332 | */ | 354 | */ |
333 | int drm_agp_bind(struct inode *inode, struct file *filp, | 355 | int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request) |
334 | unsigned int cmd, unsigned long arg) | ||
335 | { | 356 | { |
336 | drm_file_t *priv = filp->private_data; | ||
337 | drm_device_t *dev = priv->head->dev; | ||
338 | drm_agp_binding_t request; | ||
339 | drm_agp_mem_t *entry; | 357 | drm_agp_mem_t *entry; |
340 | int retcode; | 358 | int retcode; |
341 | int page; | 359 | int page; |
342 | 360 | ||
343 | if (!dev->agp || !dev->agp->acquired) | 361 | if (!dev->agp || !dev->agp->acquired) |
344 | return -EINVAL; | 362 | return -EINVAL; |
345 | if (copy_from_user | 363 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) |
346 | (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) | ||
347 | return -EFAULT; | ||
348 | if (!(entry = drm_agp_lookup_entry(dev, request.handle))) | ||
349 | return -EINVAL; | 364 | return -EINVAL; |
350 | if (entry->bound) | 365 | if (entry->bound) |
351 | return -EINVAL; | 366 | return -EINVAL; |
352 | page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; | 367 | page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; |
353 | if ((retcode = drm_bind_agp(entry->memory, page))) | 368 | if ((retcode = drm_bind_agp(entry->memory, page))) |
354 | return retcode; | 369 | return retcode; |
355 | entry->bound = dev->agp->base + (page << PAGE_SHIFT); | 370 | entry->bound = dev->agp->base + (page << PAGE_SHIFT); |
@@ -357,6 +372,21 @@ int drm_agp_bind(struct inode *inode, struct file *filp, | |||
357 | dev->agp->base, entry->bound); | 372 | dev->agp->base, entry->bound); |
358 | return 0; | 373 | return 0; |
359 | } | 374 | } |
375 | EXPORT_SYMBOL(drm_agp_bind); | ||
376 | |||
377 | int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, | ||
378 | unsigned int cmd, unsigned long arg) | ||
379 | { | ||
380 | drm_file_t *priv = filp->private_data; | ||
381 | drm_device_t *dev = priv->head->dev; | ||
382 | drm_agp_binding_t request; | ||
383 | |||
384 | if (copy_from_user | ||
385 | (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) | ||
386 | return -EFAULT; | ||
387 | |||
388 | return drm_agp_bind(dev, &request); | ||
389 | } | ||
360 | 390 | ||
361 | /** | 391 | /** |
362 | * Free AGP memory (ioctl). | 392 | * Free AGP memory (ioctl). |
@@ -372,20 +402,13 @@ int drm_agp_bind(struct inode *inode, struct file *filp, | |||
372 | * unbind_agp(). Frees it via free_agp() as well as the entry itself | 402 | * unbind_agp(). Frees it via free_agp() as well as the entry itself |
373 | * and unlinks from the doubly linked list it's inserted in. | 403 | * and unlinks from the doubly linked list it's inserted in. |
374 | */ | 404 | */ |
375 | int drm_agp_free(struct inode *inode, struct file *filp, | 405 | int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request) |
376 | unsigned int cmd, unsigned long arg) | ||
377 | { | 406 | { |
378 | drm_file_t *priv = filp->private_data; | ||
379 | drm_device_t *dev = priv->head->dev; | ||
380 | drm_agp_buffer_t request; | ||
381 | drm_agp_mem_t *entry; | 407 | drm_agp_mem_t *entry; |
382 | 408 | ||
383 | if (!dev->agp || !dev->agp->acquired) | 409 | if (!dev->agp || !dev->agp->acquired) |
384 | return -EINVAL; | 410 | return -EINVAL; |
385 | if (copy_from_user | 411 | if (!(entry = drm_agp_lookup_entry(dev, request->handle))) |
386 | (&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) | ||
387 | return -EFAULT; | ||
388 | if (!(entry = drm_agp_lookup_entry(dev, request.handle))) | ||
389 | return -EINVAL; | 412 | return -EINVAL; |
390 | if (entry->bound) | 413 | if (entry->bound) |
391 | drm_unbind_agp(entry->memory); | 414 | drm_unbind_agp(entry->memory); |
@@ -402,12 +425,30 @@ int drm_agp_free(struct inode *inode, struct file *filp, | |||
402 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); | 425 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); |
403 | return 0; | 426 | return 0; |
404 | } | 427 | } |
428 | EXPORT_SYMBOL(drm_agp_free); | ||
429 | |||
430 | int drm_agp_free_ioctl(struct inode *inode, struct file *filp, | ||
431 | unsigned int cmd, unsigned long arg) | ||
432 | { | ||
433 | drm_file_t *priv = filp->private_data; | ||
434 | drm_device_t *dev = priv->head->dev; | ||
435 | drm_agp_buffer_t request; | ||
436 | |||
437 | if (copy_from_user | ||
438 | (&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) | ||
439 | return -EFAULT; | ||
440 | |||
441 | return drm_agp_free(dev, &request); | ||
442 | } | ||
405 | 443 | ||
406 | /** | 444 | /** |
407 | * Initialize the AGP resources. | 445 | * Initialize the AGP resources. |
408 | * | 446 | * |
409 | * \return pointer to a drm_agp_head structure. | 447 | * \return pointer to a drm_agp_head structure. |
410 | * | 448 | * |
449 | * Gets the drm_agp_t structure which is made available by the agpgart module | ||
450 | * via the inter_module_* functions. Creates and initializes a drm_agp_head | ||
451 | * structure. | ||
411 | */ | 452 | */ |
412 | drm_agp_head_t *drm_agp_init(drm_device_t * dev) | 453 | drm_agp_head_t *drm_agp_init(drm_device_t * dev) |
413 | { | 454 | { |
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 319bdea8de8a..1db12dcb6802 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -36,22 +36,21 @@ | |||
36 | #include <linux/vmalloc.h> | 36 | #include <linux/vmalloc.h> |
37 | #include "drmP.h" | 37 | #include "drmP.h" |
38 | 38 | ||
39 | unsigned long drm_get_resource_start(drm_device_t * dev, unsigned int resource) | 39 | unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource) |
40 | { | 40 | { |
41 | return pci_resource_start(dev->pdev, resource); | 41 | return pci_resource_start(dev->pdev, resource); |
42 | } | 42 | } |
43 | |||
44 | EXPORT_SYMBOL(drm_get_resource_start); | 43 | EXPORT_SYMBOL(drm_get_resource_start); |
45 | 44 | ||
46 | unsigned long drm_get_resource_len(drm_device_t * dev, unsigned int resource) | 45 | unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource) |
47 | { | 46 | { |
48 | return pci_resource_len(dev->pdev, resource); | 47 | return pci_resource_len(dev->pdev, resource); |
49 | } | 48 | } |
50 | 49 | ||
51 | EXPORT_SYMBOL(drm_get_resource_len); | 50 | EXPORT_SYMBOL(drm_get_resource_len); |
52 | 51 | ||
53 | static drm_map_list_t *drm_find_matching_map(drm_device_t * dev, | 52 | static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, |
54 | drm_local_map_t * map) | 53 | drm_local_map_t *map) |
55 | { | 54 | { |
56 | struct list_head *list; | 55 | struct list_head *list; |
57 | 56 | ||
@@ -74,7 +73,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t * dev, | |||
74 | 73 | ||
75 | #ifdef _LP64 | 74 | #ifdef _LP64 |
76 | static __inline__ unsigned int HandleID(unsigned long lhandle, | 75 | static __inline__ unsigned int HandleID(unsigned long lhandle, |
77 | drm_device_t * dev) | 76 | drm_device_t *dev) |
78 | { | 77 | { |
79 | static unsigned int map32_handle = START_RANGE; | 78 | static unsigned int map32_handle = START_RANGE; |
80 | unsigned int hash; | 79 | unsigned int hash; |
@@ -155,7 +154,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
155 | case _DRM_REGISTERS: | 154 | case _DRM_REGISTERS: |
156 | case _DRM_FRAME_BUFFER: | 155 | case _DRM_FRAME_BUFFER: |
157 | #if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) | 156 | #if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) |
158 | if (map->offset + map->size < map->offset || | 157 | if (map->offset + (map->size-1) < map->offset || |
159 | map->offset < virt_to_phys(high_memory)) { | 158 | map->offset < virt_to_phys(high_memory)) { |
160 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 159 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
161 | return -EINVAL; | 160 | return -EINVAL; |
@@ -301,6 +300,9 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, | |||
301 | return -EFAULT; | 300 | return -EFAULT; |
302 | } | 301 | } |
303 | 302 | ||
303 | if (!(capable(CAP_SYS_ADMIN) || map.type == _DRM_AGP)) | ||
304 | return -EPERM; | ||
305 | |||
304 | err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags, | 306 | err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags, |
305 | &maplist); | 307 | &maplist); |
306 | 308 | ||
@@ -332,7 +334,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, | |||
332 | * | 334 | * |
333 | * \sa drm_addmap | 335 | * \sa drm_addmap |
334 | */ | 336 | */ |
335 | int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map) | 337 | int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) |
336 | { | 338 | { |
337 | struct list_head *list; | 339 | struct list_head *list; |
338 | drm_map_list_t *r_list = NULL; | 340 | drm_map_list_t *r_list = NULL; |
@@ -384,10 +386,9 @@ int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map) | |||
384 | 386 | ||
385 | return 0; | 387 | return 0; |
386 | } | 388 | } |
387 | |||
388 | EXPORT_SYMBOL(drm_rmmap_locked); | 389 | EXPORT_SYMBOL(drm_rmmap_locked); |
389 | 390 | ||
390 | int drm_rmmap(drm_device_t * dev, drm_local_map_t * map) | 391 | int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) |
391 | { | 392 | { |
392 | int ret; | 393 | int ret; |
393 | 394 | ||
@@ -397,7 +398,6 @@ int drm_rmmap(drm_device_t * dev, drm_local_map_t * map) | |||
397 | 398 | ||
398 | return ret; | 399 | return ret; |
399 | } | 400 | } |
400 | |||
401 | EXPORT_SYMBOL(drm_rmmap); | 401 | EXPORT_SYMBOL(drm_rmmap); |
402 | 402 | ||
403 | /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on | 403 | /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on |
@@ -548,7 +548,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
548 | DRM_DEBUG("count: %d\n", count); | 548 | DRM_DEBUG("count: %d\n", count); |
549 | DRM_DEBUG("order: %d\n", order); | 549 | DRM_DEBUG("order: %d\n", order); |
550 | DRM_DEBUG("size: %d\n", size); | 550 | DRM_DEBUG("size: %d\n", size); |
551 | DRM_DEBUG("agp_offset: %lu\n", agp_offset); | 551 | DRM_DEBUG("agp_offset: %lx\n", agp_offset); |
552 | DRM_DEBUG("alignment: %d\n", alignment); | 552 | DRM_DEBUG("alignment: %d\n", alignment); |
553 | DRM_DEBUG("page_order: %d\n", page_order); | 553 | DRM_DEBUG("page_order: %d\n", page_order); |
554 | DRM_DEBUG("total: %d\n", total); | 554 | DRM_DEBUG("total: %d\n", total); |
@@ -649,6 +649,8 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
649 | } | 649 | } |
650 | 650 | ||
651 | dma->buf_count += entry->buf_count; | 651 | dma->buf_count += entry->buf_count; |
652 | dma->seg_count += entry->seg_count; | ||
653 | dma->page_count += byte_count >> PAGE_SHIFT; | ||
652 | dma->byte_count += byte_count; | 654 | dma->byte_count += byte_count; |
653 | 655 | ||
654 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 656 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
@@ -664,7 +666,6 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
664 | atomic_dec(&dev->buf_alloc); | 666 | atomic_dec(&dev->buf_alloc); |
665 | return 0; | 667 | return 0; |
666 | } | 668 | } |
667 | |||
668 | EXPORT_SYMBOL(drm_addbufs_agp); | 669 | EXPORT_SYMBOL(drm_addbufs_agp); |
669 | #endif /* __OS_HAS_AGP */ | 670 | #endif /* __OS_HAS_AGP */ |
670 | 671 | ||
@@ -689,9 +690,13 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
689 | 690 | ||
690 | if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) | 691 | if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) |
691 | return -EINVAL; | 692 | return -EINVAL; |
693 | |||
692 | if (!dma) | 694 | if (!dma) |
693 | return -EINVAL; | 695 | return -EINVAL; |
694 | 696 | ||
697 | if (!capable(CAP_SYS_ADMIN)) | ||
698 | return -EPERM; | ||
699 | |||
695 | count = request->count; | 700 | count = request->count; |
696 | order = drm_order(request->size); | 701 | order = drm_order(request->size); |
697 | size = 1 << order; | 702 | size = 1 << order; |
@@ -882,7 +887,6 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
882 | return 0; | 887 | return 0; |
883 | 888 | ||
884 | } | 889 | } |
885 | |||
886 | EXPORT_SYMBOL(drm_addbufs_pci); | 890 | EXPORT_SYMBOL(drm_addbufs_pci); |
887 | 891 | ||
888 | static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | 892 | static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) |
@@ -908,6 +912,9 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
908 | if (!dma) | 912 | if (!dma) |
909 | return -EINVAL; | 913 | return -EINVAL; |
910 | 914 | ||
915 | if (!capable(CAP_SYS_ADMIN)) | ||
916 | return -EPERM; | ||
917 | |||
911 | count = request->count; | 918 | count = request->count; |
912 | order = drm_order(request->size); | 919 | order = drm_order(request->size); |
913 | size = 1 << order; | 920 | size = 1 << order; |
@@ -1026,6 +1033,8 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
1026 | } | 1033 | } |
1027 | 1034 | ||
1028 | dma->buf_count += entry->buf_count; | 1035 | dma->buf_count += entry->buf_count; |
1036 | dma->seg_count += entry->seg_count; | ||
1037 | dma->page_count += byte_count >> PAGE_SHIFT; | ||
1029 | dma->byte_count += byte_count; | 1038 | dma->byte_count += byte_count; |
1030 | 1039 | ||
1031 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 1040 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
@@ -1042,7 +1051,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
1042 | return 0; | 1051 | return 0; |
1043 | } | 1052 | } |
1044 | 1053 | ||
1045 | static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | 1054 | int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) |
1046 | { | 1055 | { |
1047 | drm_device_dma_t *dma = dev->dma; | 1056 | drm_device_dma_t *dma = dev->dma; |
1048 | drm_buf_entry_t *entry; | 1057 | drm_buf_entry_t *entry; |
@@ -1065,6 +1074,9 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1065 | if (!dma) | 1074 | if (!dma) |
1066 | return -EINVAL; | 1075 | return -EINVAL; |
1067 | 1076 | ||
1077 | if (!capable(CAP_SYS_ADMIN)) | ||
1078 | return -EPERM; | ||
1079 | |||
1068 | count = request->count; | 1080 | count = request->count; |
1069 | order = drm_order(request->size); | 1081 | order = drm_order(request->size); |
1070 | size = 1 << order; | 1082 | size = 1 << order; |
@@ -1181,6 +1193,8 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1181 | } | 1193 | } |
1182 | 1194 | ||
1183 | dma->buf_count += entry->buf_count; | 1195 | dma->buf_count += entry->buf_count; |
1196 | dma->seg_count += entry->seg_count; | ||
1197 | dma->page_count += byte_count >> PAGE_SHIFT; | ||
1184 | dma->byte_count += byte_count; | 1198 | dma->byte_count += byte_count; |
1185 | 1199 | ||
1186 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 1200 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
@@ -1196,6 +1210,8 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1196 | atomic_dec(&dev->buf_alloc); | 1210 | atomic_dec(&dev->buf_alloc); |
1197 | return 0; | 1211 | return 0; |
1198 | } | 1212 | } |
1213 | EXPORT_SYMBOL(drm_addbufs_fb); | ||
1214 | |||
1199 | 1215 | ||
1200 | /** | 1216 | /** |
1201 | * Add buffers for DMA transfers (ioctl). | 1217 | * Add buffers for DMA transfers (ioctl). |
@@ -1577,5 +1593,6 @@ int drm_order(unsigned long size) | |||
1577 | 1593 | ||
1578 | return order; | 1594 | return order; |
1579 | } | 1595 | } |
1580 | |||
1581 | EXPORT_SYMBOL(drm_order); | 1596 | EXPORT_SYMBOL(drm_order); |
1597 | |||
1598 | |||
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index bd958d69a2ac..f84254526949 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -433,7 +433,7 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { | 433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { |
434 | if (dev->driver->context_ctor) | 434 | if (dev->driver->context_ctor) |
435 | if (!dev->driver->context_ctor(dev, ctx.handle)) { | 435 | if (!dev->driver->context_ctor(dev, ctx.handle)) { |
436 | DRM_DEBUG( "Running out of ctxs or memory.\n"); | 436 | DRM_DEBUG("Running out of ctxs or memory.\n"); |
437 | return -ENOMEM; | 437 | return -ENOMEM; |
438 | } | 438 | } |
439 | } | 439 | } |
diff --git a/drivers/char/drm/drm_core.h b/drivers/char/drm/drm_core.h index cc97bb906dda..f4f9db6c7ed4 100644 --- a/drivers/char/drm/drm_core.h +++ b/drivers/char/drm/drm_core.h | |||
@@ -24,11 +24,11 @@ | |||
24 | 24 | ||
25 | #define CORE_NAME "drm" | 25 | #define CORE_NAME "drm" |
26 | #define CORE_DESC "DRM shared core routines" | 26 | #define CORE_DESC "DRM shared core routines" |
27 | #define CORE_DATE "20040925" | 27 | #define CORE_DATE "20051102" |
28 | 28 | ||
29 | #define DRM_IF_MAJOR 1 | 29 | #define DRM_IF_MAJOR 1 |
30 | #define DRM_IF_MINOR 2 | 30 | #define DRM_IF_MINOR 2 |
31 | 31 | ||
32 | #define CORE_MAJOR 1 | 32 | #define CORE_MAJOR 1 |
33 | #define CORE_MINOR 0 | 33 | #define CORE_MINOR 0 |
34 | #define CORE_PATCHLEVEL 0 | 34 | #define CORE_PATCHLEVEL 1 |
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 4dff7554eb08..c4fa5a29582b 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -56,66 +56,66 @@ static int drm_version(struct inode *inode, struct file *filp, | |||
56 | 56 | ||
57 | /** Ioctl table */ | 57 | /** Ioctl table */ |
58 | static drm_ioctl_desc_t drm_ioctls[] = { | 58 | static drm_ioctl_desc_t drm_ioctls[] = { |
59 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0, 0}, | 59 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0}, |
60 | [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique, 0, 0}, | 60 | [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique, 0}, |
61 | [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0, 0}, | 61 | [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0}, |
62 | [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = {drm_irq_by_busid, 0, 1}, | 62 | [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = {drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY}, |
63 | [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = {drm_getmap, 0, 0}, | 63 | [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = {drm_getmap, 0}, |
64 | [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = {drm_getclient, 0, 0}, | 64 | [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = {drm_getclient, 0}, |
65 | [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = {drm_getstats, 0, 0}, | 65 | [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = {drm_getstats, 0}, |
66 | [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = {drm_setversion, 0, 1}, | 66 | [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = {drm_setversion, DRM_MASTER|DRM_ROOT_ONLY}, |
67 | 67 | [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = {drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
68 | [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = {drm_setunique, 1, 1}, | 68 | [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = {drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
69 | [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = {drm_noop, 1, 1}, | 69 | [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = {drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
70 | [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = {drm_noop, 1, 1}, | 70 | [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = {drm_authmagic, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
71 | [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = {drm_authmagic, 1, 1}, | 71 | |
72 | 72 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = {drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
73 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = {drm_addmap_ioctl, 1, 1}, | 73 | [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = {drm_rmmap_ioctl, DRM_AUTH}, |
74 | [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = {drm_rmmap_ioctl, 1, 0}, | 74 | |
75 | 75 | [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = {drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
76 | [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = {drm_setsareactx, 1, 1}, | 76 | [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = {drm_getsareactx, DRM_AUTH}, |
77 | [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = {drm_getsareactx, 1, 0}, | 77 | |
78 | 78 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
79 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, 1, 1}, | 79 | [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = {drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
80 | [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = {drm_rmctx, 1, 1}, | 80 | [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = {drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
81 | [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = {drm_modctx, 1, 1}, | 81 | [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, DRM_AUTH}, |
82 | [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, 1, 0}, | 82 | [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = {drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
83 | [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = {drm_switchctx, 1, 1}, | 83 | [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = {drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
84 | [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = {drm_newctx, 1, 1}, | 84 | [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = {drm_resctx, DRM_AUTH}, |
85 | [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = {drm_resctx, 1, 0}, | 85 | |
86 | 86 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = {drm_adddraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
87 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = {drm_adddraw, 1, 1}, | 87 | [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = {drm_rmdraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
88 | [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = {drm_rmdraw, 1, 1}, | 88 | |
89 | 89 | [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = {drm_lock, DRM_AUTH}, | |
90 | [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = {drm_lock, 1, 0}, | 90 | [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = {drm_unlock, DRM_AUTH}, |
91 | [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = {drm_unlock, 1, 0}, | 91 | |
92 | 92 | [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = {drm_noop, DRM_AUTH}, | |
93 | [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = {drm_noop, 1, 0}, | 93 | |
94 | 94 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = {drm_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | |
95 | [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = {drm_addbufs, 1, 1}, | 95 | [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = {drm_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
96 | [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = {drm_markbufs, 1, 1}, | 96 | [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = {drm_infobufs, DRM_AUTH}, |
97 | [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = {drm_infobufs, 1, 0}, | 97 | [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = {drm_mapbufs, DRM_AUTH}, |
98 | [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = {drm_mapbufs, 1, 0}, | 98 | [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = {drm_freebufs, DRM_AUTH}, |
99 | [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = {drm_freebufs, 1, 0}, | ||
100 | /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ | 99 | /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ |
100 | [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = {NULL, DRM_AUTH}, | ||
101 | 101 | ||
102 | [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = {drm_control, 1, 1}, | 102 | [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = {drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
103 | 103 | ||
104 | #if __OS_HAS_AGP | 104 | #if __OS_HAS_AGP |
105 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire_ioctl, 1, 1}, | 105 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
106 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release_ioctl, 1, 1}, | 106 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
107 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable_ioctl, 1, 1}, | 107 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
108 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info_ioctl, 1, 0}, | 108 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info_ioctl, DRM_AUTH}, |
109 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, | 109 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
110 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1}, | 110 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
111 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_bind, 1, 1}, | 111 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_bind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
112 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_unbind, 1, 1}, | 112 | [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_unbind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = {drm_sg_alloc, 1, 1}, | 115 | [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = {drm_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
116 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = {drm_sg_free, 1, 1}, | 116 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = {drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
117 | 117 | ||
118 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0, 0}, | 118 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0}, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) | 121 | #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) |
@@ -129,7 +129,7 @@ static drm_ioctl_desc_t drm_ioctls[] = { | |||
129 | * | 129 | * |
130 | * \sa drm_device | 130 | * \sa drm_device |
131 | */ | 131 | */ |
132 | int drm_takedown(drm_device_t * dev) | 132 | int drm_lastclose(drm_device_t * dev) |
133 | { | 133 | { |
134 | drm_magic_entry_t *pt, *next; | 134 | drm_magic_entry_t *pt, *next; |
135 | drm_map_list_t *r_list; | 135 | drm_map_list_t *r_list; |
@@ -138,9 +138,9 @@ int drm_takedown(drm_device_t * dev) | |||
138 | 138 | ||
139 | DRM_DEBUG("\n"); | 139 | DRM_DEBUG("\n"); |
140 | 140 | ||
141 | if (dev->driver->pretakedown) | 141 | if (dev->driver->lastclose) |
142 | dev->driver->pretakedown(dev); | 142 | dev->driver->lastclose(dev); |
143 | DRM_DEBUG("driver pretakedown completed\n"); | 143 | DRM_DEBUG("driver lastclose completed\n"); |
144 | 144 | ||
145 | if (dev->unique) { | 145 | if (dev->unique) { |
146 | drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER); | 146 | drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER); |
@@ -233,7 +233,7 @@ int drm_takedown(drm_device_t * dev) | |||
233 | } | 233 | } |
234 | up(&dev->struct_sem); | 234 | up(&dev->struct_sem); |
235 | 235 | ||
236 | DRM_DEBUG("takedown completed\n"); | 236 | DRM_DEBUG("lastclose completed\n"); |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
@@ -281,7 +281,7 @@ EXPORT_SYMBOL(drm_init); | |||
281 | /** | 281 | /** |
282 | * Called via cleanup_module() at module unload time. | 282 | * Called via cleanup_module() at module unload time. |
283 | * | 283 | * |
284 | * Cleans up all DRM device, calling takedown(). | 284 | * Cleans up all DRM device, calling drm_lastclose(). |
285 | * | 285 | * |
286 | * \sa drm_init | 286 | * \sa drm_init |
287 | */ | 287 | */ |
@@ -294,7 +294,7 @@ static void drm_cleanup(drm_device_t * dev) | |||
294 | return; | 294 | return; |
295 | } | 295 | } |
296 | 296 | ||
297 | drm_takedown(dev); | 297 | drm_lastclose(dev); |
298 | 298 | ||
299 | if (dev->maplist) { | 299 | if (dev->maplist) { |
300 | drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); | 300 | drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); |
@@ -317,8 +317,8 @@ static void drm_cleanup(drm_device_t * dev) | |||
317 | dev->agp = NULL; | 317 | dev->agp = NULL; |
318 | } | 318 | } |
319 | 319 | ||
320 | if (dev->driver->postcleanup) | 320 | if (dev->driver->unload) |
321 | dev->driver->postcleanup(dev); | 321 | dev->driver->unload(dev); |
322 | 322 | ||
323 | drm_put_head(&dev->primary); | 323 | drm_put_head(&dev->primary); |
324 | if (drm_put_dev(dev)) | 324 | if (drm_put_dev(dev)) |
@@ -342,12 +342,12 @@ void drm_exit(struct drm_driver *driver) | |||
342 | if (head->dev->driver != driver) | 342 | if (head->dev->driver != driver) |
343 | continue; | 343 | continue; |
344 | dev = head->dev; | 344 | dev = head->dev; |
345 | } | 345 | if (dev) { |
346 | if (dev) { | 346 | /* release the pci driver */ |
347 | /* release the pci driver */ | 347 | if (dev->pdev) |
348 | if (dev->pdev) | 348 | pci_dev_put(dev->pdev); |
349 | pci_dev_put(dev->pdev); | 349 | drm_cleanup(dev); |
350 | drm_cleanup(dev); | 350 | } |
351 | } | 351 | } |
352 | DRM_INFO("Module unloaded\n"); | 352 | DRM_INFO("Module unloaded\n"); |
353 | } | 353 | } |
@@ -432,14 +432,17 @@ static int drm_version(struct inode *inode, struct file *filp, | |||
432 | drm_device_t *dev = priv->head->dev; | 432 | drm_device_t *dev = priv->head->dev; |
433 | drm_version_t __user *argp = (void __user *)arg; | 433 | drm_version_t __user *argp = (void __user *)arg; |
434 | drm_version_t version; | 434 | drm_version_t version; |
435 | int ret; | 435 | int len; |
436 | 436 | ||
437 | if (copy_from_user(&version, argp, sizeof(version))) | 437 | if (copy_from_user(&version, argp, sizeof(version))) |
438 | return -EFAULT; | 438 | return -EFAULT; |
439 | 439 | ||
440 | /* version is a required function to return the personality module version */ | 440 | version.version_major = dev->driver->major; |
441 | if ((ret = dev->driver->version(&version))) | 441 | version.version_minor = dev->driver->minor; |
442 | return ret; | 442 | version.version_patchlevel = dev->driver->patchlevel; |
443 | DRM_COPY(version.name, dev->driver->name); | ||
444 | DRM_COPY(version.date, dev->driver->date); | ||
445 | DRM_COPY(version.desc, dev->driver->desc); | ||
443 | 446 | ||
444 | if (copy_to_user(argp, &version, sizeof(version))) | 447 | if (copy_to_user(argp, &version, sizeof(version))) |
445 | return -EFAULT; | 448 | return -EFAULT; |
@@ -493,8 +496,9 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
493 | if (!func) { | 496 | if (!func) { |
494 | DRM_DEBUG("no function\n"); | 497 | DRM_DEBUG("no function\n"); |
495 | retcode = -EINVAL; | 498 | retcode = -EINVAL; |
496 | } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) || | 499 | } else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) || |
497 | (ioctl->auth_needed && !priv->authenticated)) { | 500 | ((ioctl->flags & DRM_AUTH) && !priv->authenticated) || |
501 | ((ioctl->flags & DRM_MASTER) && !priv->master)) { | ||
498 | retcode = -EACCES; | 502 | retcode = -EACCES; |
499 | } else { | 503 | } else { |
500 | retcode = func(inode, filp, cmd, arg); | 504 | retcode = func(inode, filp, cmd, arg); |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index bf0a740122bf..403f44a1bf01 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -35,6 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "drmP.h" | 37 | #include "drmP.h" |
38 | #include "drm_sarea.h" | ||
38 | #include <linux/poll.h> | 39 | #include <linux/poll.h> |
39 | 40 | ||
40 | static int drm_open_helper(struct inode *inode, struct file *filp, | 41 | static int drm_open_helper(struct inode *inode, struct file *filp, |
@@ -42,15 +43,21 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
42 | 43 | ||
43 | static int drm_setup(drm_device_t * dev) | 44 | static int drm_setup(drm_device_t * dev) |
44 | { | 45 | { |
46 | drm_local_map_t *map; | ||
45 | int i; | 47 | int i; |
46 | int ret; | 48 | int ret; |
47 | 49 | ||
48 | if (dev->driver->presetup) { | 50 | if (dev->driver->firstopen) { |
49 | ret = dev->driver->presetup(dev); | 51 | ret = dev->driver->firstopen(dev); |
50 | if (ret != 0) | 52 | if (ret != 0) |
51 | return ret; | 53 | return ret; |
52 | } | 54 | } |
53 | 55 | ||
56 | /* prebuild the SAREA */ | ||
57 | i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map); | ||
58 | if (i != 0) | ||
59 | return i; | ||
60 | |||
54 | atomic_set(&dev->ioctl_count, 0); | 61 | atomic_set(&dev->ioctl_count, 0); |
55 | atomic_set(&dev->vma_count, 0); | 62 | atomic_set(&dev->vma_count, 0); |
56 | dev->buf_use = 0; | 63 | dev->buf_use = 0; |
@@ -109,8 +116,6 @@ static int drm_setup(drm_device_t * dev) | |||
109 | * drm_select_queue fails between the time the interrupt is | 116 | * drm_select_queue fails between the time the interrupt is |
110 | * initialized and the time the queues are initialized. | 117 | * initialized and the time the queues are initialized. |
111 | */ | 118 | */ |
112 | if (dev->driver->postsetup) | ||
113 | dev->driver->postsetup(dev); | ||
114 | 119 | ||
115 | return 0; | 120 | return 0; |
116 | } | 121 | } |
@@ -154,10 +159,168 @@ int drm_open(struct inode *inode, struct file *filp) | |||
154 | 159 | ||
155 | return retcode; | 160 | return retcode; |
156 | } | 161 | } |
157 | |||
158 | EXPORT_SYMBOL(drm_open); | 162 | EXPORT_SYMBOL(drm_open); |
159 | 163 | ||
160 | /** | 164 | /** |
165 | * File \c open operation. | ||
166 | * | ||
167 | * \param inode device inode. | ||
168 | * \param filp file pointer. | ||
169 | * | ||
170 | * Puts the dev->fops corresponding to the device minor number into | ||
171 | * \p filp, call the \c open method, and restore the file operations. | ||
172 | */ | ||
173 | int drm_stub_open(struct inode *inode, struct file *filp) | ||
174 | { | ||
175 | drm_device_t *dev = NULL; | ||
176 | int minor = iminor(inode); | ||
177 | int err = -ENODEV; | ||
178 | struct file_operations *old_fops; | ||
179 | |||
180 | DRM_DEBUG("\n"); | ||
181 | |||
182 | if (!((minor >= 0) && (minor < drm_cards_limit))) | ||
183 | return -ENODEV; | ||
184 | |||
185 | if (!drm_heads[minor]) | ||
186 | return -ENODEV; | ||
187 | |||
188 | if (!(dev = drm_heads[minor]->dev)) | ||
189 | return -ENODEV; | ||
190 | |||
191 | old_fops = filp->f_op; | ||
192 | filp->f_op = fops_get(&dev->driver->fops); | ||
193 | if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { | ||
194 | fops_put(filp->f_op); | ||
195 | filp->f_op = fops_get(old_fops); | ||
196 | } | ||
197 | fops_put(old_fops); | ||
198 | |||
199 | return err; | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * Check whether DRI will run on this CPU. | ||
204 | * | ||
205 | * \return non-zero if the DRI will run on this CPU, or zero otherwise. | ||
206 | */ | ||
207 | static int drm_cpu_valid(void) | ||
208 | { | ||
209 | #if defined(__i386__) | ||
210 | if (boot_cpu_data.x86 == 3) | ||
211 | return 0; /* No cmpxchg on a 386 */ | ||
212 | #endif | ||
213 | #if defined(__sparc__) && !defined(__sparc_v9__) | ||
214 | return 0; /* No cmpxchg before v9 sparc. */ | ||
215 | #endif | ||
216 | return 1; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * Called whenever a process opens /dev/drm. | ||
221 | * | ||
222 | * \param inode device inode. | ||
223 | * \param filp file pointer. | ||
224 | * \param dev device. | ||
225 | * \return zero on success or a negative number on failure. | ||
226 | * | ||
227 | * Creates and initializes a drm_file structure for the file private data in \p | ||
228 | * filp and add it into the double linked list in \p dev. | ||
229 | */ | ||
230 | static int drm_open_helper(struct inode *inode, struct file *filp, | ||
231 | drm_device_t * dev) | ||
232 | { | ||
233 | int minor = iminor(inode); | ||
234 | drm_file_t *priv; | ||
235 | int ret; | ||
236 | |||
237 | if (filp->f_flags & O_EXCL) | ||
238 | return -EBUSY; /* No exclusive opens */ | ||
239 | if (!drm_cpu_valid()) | ||
240 | return -EINVAL; | ||
241 | |||
242 | DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); | ||
243 | |||
244 | priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); | ||
245 | if (!priv) | ||
246 | return -ENOMEM; | ||
247 | |||
248 | memset(priv, 0, sizeof(*priv)); | ||
249 | filp->private_data = priv; | ||
250 | priv->uid = current->euid; | ||
251 | priv->pid = current->pid; | ||
252 | priv->minor = minor; | ||
253 | priv->head = drm_heads[minor]; | ||
254 | priv->ioctl_count = 0; | ||
255 | /* for compatibility root is always authenticated */ | ||
256 | priv->authenticated = capable(CAP_SYS_ADMIN); | ||
257 | priv->lock_count = 0; | ||
258 | |||
259 | if (dev->driver->open) { | ||
260 | ret = dev->driver->open(dev, priv); | ||
261 | if (ret < 0) | ||
262 | goto out_free; | ||
263 | } | ||
264 | |||
265 | down(&dev->struct_sem); | ||
266 | if (!dev->file_last) { | ||
267 | priv->next = NULL; | ||
268 | priv->prev = NULL; | ||
269 | dev->file_first = priv; | ||
270 | dev->file_last = priv; | ||
271 | /* first opener automatically becomes master */ | ||
272 | priv->master = 1; | ||
273 | } else { | ||
274 | priv->next = NULL; | ||
275 | priv->prev = dev->file_last; | ||
276 | dev->file_last->next = priv; | ||
277 | dev->file_last = priv; | ||
278 | } | ||
279 | up(&dev->struct_sem); | ||
280 | |||
281 | #ifdef __alpha__ | ||
282 | /* | ||
283 | * Default the hose | ||
284 | */ | ||
285 | if (!dev->hose) { | ||
286 | struct pci_dev *pci_dev; | ||
287 | pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); | ||
288 | if (pci_dev) { | ||
289 | dev->hose = pci_dev->sysdata; | ||
290 | pci_dev_put(pci_dev); | ||
291 | } | ||
292 | if (!dev->hose) { | ||
293 | struct pci_bus *b = pci_bus_b(pci_root_buses.next); | ||
294 | if (b) | ||
295 | dev->hose = b->sysdata; | ||
296 | } | ||
297 | } | ||
298 | #endif | ||
299 | |||
300 | return 0; | ||
301 | out_free: | ||
302 | drm_free(priv, sizeof(*priv), DRM_MEM_FILES); | ||
303 | filp->private_data = NULL; | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | /** No-op. */ | ||
308 | int drm_fasync(int fd, struct file *filp, int on) | ||
309 | { | ||
310 | drm_file_t *priv = filp->private_data; | ||
311 | drm_device_t *dev = priv->head->dev; | ||
312 | int retcode; | ||
313 | |||
314 | DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, | ||
315 | (long)old_encode_dev(priv->head->device)); | ||
316 | retcode = fasync_helper(fd, filp, on, &dev->buf_async); | ||
317 | if (retcode < 0) | ||
318 | return retcode; | ||
319 | return 0; | ||
320 | } | ||
321 | EXPORT_SYMBOL(drm_fasync); | ||
322 | |||
323 | /** | ||
161 | * Release file. | 324 | * Release file. |
162 | * | 325 | * |
163 | * \param inode device inode | 326 | * \param inode device inode |
@@ -167,7 +330,7 @@ EXPORT_SYMBOL(drm_open); | |||
167 | * If the hardware lock is held then free it, and take it again for the kernel | 330 | * If the hardware lock is held then free it, and take it again for the kernel |
168 | * context since it's necessary to reclaim buffers. Unlink the file private | 331 | * context since it's necessary to reclaim buffers. Unlink the file private |
169 | * data from its list and free it. Decreases the open count and if it reaches | 332 | * data from its list and free it. Decreases the open count and if it reaches |
170 | * zero calls takedown(). | 333 | * zero calls drm_lastclose(). |
171 | */ | 334 | */ |
172 | int drm_release(struct inode *inode, struct file *filp) | 335 | int drm_release(struct inode *inode, struct file *filp) |
173 | { | 336 | { |
@@ -180,8 +343,8 @@ int drm_release(struct inode *inode, struct file *filp) | |||
180 | 343 | ||
181 | DRM_DEBUG("open_count = %d\n", dev->open_count); | 344 | DRM_DEBUG("open_count = %d\n", dev->open_count); |
182 | 345 | ||
183 | if (dev->driver->prerelease) | 346 | if (dev->driver->preclose) |
184 | dev->driver->prerelease(dev, filp); | 347 | dev->driver->preclose(dev, filp); |
185 | 348 | ||
186 | /* ======================================================== | 349 | /* ======================================================== |
187 | * Begin inline drm_release | 350 | * Begin inline drm_release |
@@ -197,8 +360,8 @@ int drm_release(struct inode *inode, struct file *filp) | |||
197 | DRM_DEBUG("File %p released, freeing lock for context %d\n", | 360 | DRM_DEBUG("File %p released, freeing lock for context %d\n", |
198 | filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); | 361 | filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); |
199 | 362 | ||
200 | if (dev->driver->release) | 363 | if (dev->driver->reclaim_buffers_locked) |
201 | dev->driver->release(dev, filp); | 364 | dev->driver->reclaim_buffers_locked(dev, filp); |
202 | 365 | ||
203 | drm_lock_free(dev, &dev->lock.hw_lock->lock, | 366 | drm_lock_free(dev, &dev->lock.hw_lock->lock, |
204 | _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); | 367 | _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); |
@@ -207,7 +370,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
207 | hardware at this point, possibly | 370 | hardware at this point, possibly |
208 | processed via a callback to the X | 371 | processed via a callback to the X |
209 | server. */ | 372 | server. */ |
210 | } else if (dev->driver->release && priv->lock_count | 373 | } else if (dev->driver->reclaim_buffers_locked && priv->lock_count |
211 | && dev->lock.hw_lock) { | 374 | && dev->lock.hw_lock) { |
212 | /* The lock is required to reclaim buffers */ | 375 | /* The lock is required to reclaim buffers */ |
213 | DECLARE_WAITQUEUE(entry, current); | 376 | DECLARE_WAITQUEUE(entry, current); |
@@ -237,15 +400,14 @@ int drm_release(struct inode *inode, struct file *filp) | |||
237 | __set_current_state(TASK_RUNNING); | 400 | __set_current_state(TASK_RUNNING); |
238 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 401 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
239 | if (!retcode) { | 402 | if (!retcode) { |
240 | if (dev->driver->release) | 403 | dev->driver->reclaim_buffers_locked(dev, filp); |
241 | dev->driver->release(dev, filp); | ||
242 | drm_lock_free(dev, &dev->lock.hw_lock->lock, | 404 | drm_lock_free(dev, &dev->lock.hw_lock->lock, |
243 | DRM_KERNEL_CONTEXT); | 405 | DRM_KERNEL_CONTEXT); |
244 | } | 406 | } |
245 | } | 407 | } |
246 | 408 | ||
247 | if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) | 409 | if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && |
248 | && !dev->driver->release) { | 410 | !dev->driver->reclaim_buffers_locked) { |
249 | dev->driver->reclaim_buffers(dev, filp); | 411 | dev->driver->reclaim_buffers(dev, filp); |
250 | } | 412 | } |
251 | 413 | ||
@@ -292,9 +454,8 @@ int drm_release(struct inode *inode, struct file *filp) | |||
292 | } | 454 | } |
293 | up(&dev->struct_sem); | 455 | up(&dev->struct_sem); |
294 | 456 | ||
295 | if (dev->driver->free_filp_priv) | 457 | if (dev->driver->postclose) |
296 | dev->driver->free_filp_priv(dev, priv); | 458 | dev->driver->postclose(dev, priv); |
297 | |||
298 | drm_free(priv, sizeof(*priv), DRM_MEM_FILES); | 459 | drm_free(priv, sizeof(*priv), DRM_MEM_FILES); |
299 | 460 | ||
300 | /* ======================================================== | 461 | /* ======================================================== |
@@ -313,7 +474,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
313 | } | 474 | } |
314 | spin_unlock(&dev->count_lock); | 475 | spin_unlock(&dev->count_lock); |
315 | unlock_kernel(); | 476 | unlock_kernel(); |
316 | return drm_takedown(dev); | 477 | return drm_lastclose(dev); |
317 | } | 478 | } |
318 | spin_unlock(&dev->count_lock); | 479 | spin_unlock(&dev->count_lock); |
319 | 480 | ||
@@ -321,129 +482,11 @@ int drm_release(struct inode *inode, struct file *filp) | |||
321 | 482 | ||
322 | return retcode; | 483 | return retcode; |
323 | } | 484 | } |
324 | |||
325 | EXPORT_SYMBOL(drm_release); | 485 | EXPORT_SYMBOL(drm_release); |
326 | 486 | ||
327 | /** | ||
328 | * Called whenever a process opens /dev/drm. | ||
329 | * | ||
330 | * \param inode device inode. | ||
331 | * \param filp file pointer. | ||
332 | * \param dev device. | ||
333 | * \return zero on success or a negative number on failure. | ||
334 | * | ||
335 | * Creates and initializes a drm_file structure for the file private data in \p | ||
336 | * filp and add it into the double linked list in \p dev. | ||
337 | */ | ||
338 | static int drm_open_helper(struct inode *inode, struct file *filp, | ||
339 | drm_device_t * dev) | ||
340 | { | ||
341 | int minor = iminor(inode); | ||
342 | drm_file_t *priv; | ||
343 | int ret; | ||
344 | |||
345 | if (filp->f_flags & O_EXCL) | ||
346 | return -EBUSY; /* No exclusive opens */ | ||
347 | if (!drm_cpu_valid()) | ||
348 | return -EINVAL; | ||
349 | |||
350 | DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); | ||
351 | |||
352 | priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); | ||
353 | if (!priv) | ||
354 | return -ENOMEM; | ||
355 | |||
356 | memset(priv, 0, sizeof(*priv)); | ||
357 | filp->private_data = priv; | ||
358 | priv->uid = current->euid; | ||
359 | priv->pid = current->pid; | ||
360 | priv->minor = minor; | ||
361 | priv->head = drm_heads[minor]; | ||
362 | priv->ioctl_count = 0; | ||
363 | priv->authenticated = capable(CAP_SYS_ADMIN); | ||
364 | priv->lock_count = 0; | ||
365 | |||
366 | if (dev->driver->open_helper) { | ||
367 | ret = dev->driver->open_helper(dev, priv); | ||
368 | if (ret < 0) | ||
369 | goto out_free; | ||
370 | } | ||
371 | |||
372 | down(&dev->struct_sem); | ||
373 | if (!dev->file_last) { | ||
374 | priv->next = NULL; | ||
375 | priv->prev = NULL; | ||
376 | dev->file_first = priv; | ||
377 | dev->file_last = priv; | ||
378 | } else { | ||
379 | priv->next = NULL; | ||
380 | priv->prev = dev->file_last; | ||
381 | dev->file_last->next = priv; | ||
382 | dev->file_last = priv; | ||
383 | } | ||
384 | up(&dev->struct_sem); | ||
385 | |||
386 | #ifdef __alpha__ | ||
387 | /* | ||
388 | * Default the hose | ||
389 | */ | ||
390 | if (!dev->hose) { | ||
391 | struct pci_dev *pci_dev; | ||
392 | pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); | ||
393 | if (pci_dev) { | ||
394 | dev->hose = pci_dev->sysdata; | ||
395 | pci_dev_put(pci_dev); | ||
396 | } | ||
397 | if (!dev->hose) { | ||
398 | struct pci_bus *b = pci_bus_b(pci_root_buses.next); | ||
399 | if (b) | ||
400 | dev->hose = b->sysdata; | ||
401 | } | ||
402 | } | ||
403 | #endif | ||
404 | |||
405 | return 0; | ||
406 | out_free: | ||
407 | drm_free(priv, sizeof(*priv), DRM_MEM_FILES); | ||
408 | filp->private_data = NULL; | ||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | /** No-op. */ | ||
413 | int drm_flush(struct file *filp) | ||
414 | { | ||
415 | drm_file_t *priv = filp->private_data; | ||
416 | drm_device_t *dev = priv->head->dev; | ||
417 | |||
418 | DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", | ||
419 | current->pid, (long)old_encode_dev(priv->head->device), | ||
420 | dev->open_count); | ||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | EXPORT_SYMBOL(drm_flush); | ||
425 | |||
426 | /** No-op. */ | ||
427 | int drm_fasync(int fd, struct file *filp, int on) | ||
428 | { | ||
429 | drm_file_t *priv = filp->private_data; | ||
430 | drm_device_t *dev = priv->head->dev; | ||
431 | int retcode; | ||
432 | |||
433 | DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, | ||
434 | (long)old_encode_dev(priv->head->device)); | ||
435 | retcode = fasync_helper(fd, filp, on, &dev->buf_async); | ||
436 | if (retcode < 0) | ||
437 | return retcode; | ||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | EXPORT_SYMBOL(drm_fasync); | ||
442 | |||
443 | /** No-op. */ | 487 | /** No-op. */ |
444 | unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) | 488 | unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) |
445 | { | 489 | { |
446 | return 0; | 490 | return 0; |
447 | } | 491 | } |
448 | |||
449 | EXPORT_SYMBOL(drm_poll); | 492 | EXPORT_SYMBOL(drm_poll); |
diff --git a/drivers/char/drm/drm_init.c b/drivers/char/drm/drm_init.c deleted file mode 100644 index 754b934715c4..000000000000 --- a/drivers/char/drm/drm_init.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /** | ||
2 | * \file drm_init.c | ||
3 | * Setup/Cleanup for DRM | ||
4 | * | ||
5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | ||
6 | * \author Gareth Hughes <gareth@valinux.com> | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com | ||
11 | * | ||
12 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | ||
13 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | ||
14 | * All Rights Reserved. | ||
15 | * | ||
16 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
17 | * copy of this software and associated documentation files (the "Software"), | ||
18 | * to deal in the Software without restriction, including without limitation | ||
19 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
20 | * and/or sell copies of the Software, and to permit persons to whom the | ||
21 | * Software is furnished to do so, subject to the following conditions: | ||
22 | * | ||
23 | * The above copyright notice and this permission notice (including the next | ||
24 | * paragraph) shall be included in all copies or substantial portions of the | ||
25 | * Software. | ||
26 | * | ||
27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
30 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
31 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
32 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
33 | * OTHER DEALINGS IN THE SOFTWARE. | ||
34 | */ | ||
35 | |||
36 | #include "drmP.h" | ||
37 | |||
38 | /** | ||
39 | * Check whether DRI will run on this CPU. | ||
40 | * | ||
41 | * \return non-zero if the DRI will run on this CPU, or zero otherwise. | ||
42 | */ | ||
43 | int drm_cpu_valid(void) | ||
44 | { | ||
45 | #if defined(__i386__) | ||
46 | if (boot_cpu_data.x86 == 3) | ||
47 | return 0; /* No cmpxchg on a 386 */ | ||
48 | #endif | ||
49 | #if defined(__sparc__) && !defined(__sparc_v9__) | ||
50 | return 0; /* No cmpxchg before v9 sparc. */ | ||
51 | #endif | ||
52 | return 1; | ||
53 | } | ||
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index 9b0feba6b063..bcd4e604d3ec 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -137,17 +137,22 @@ int drm_setunique(struct inode *inode, struct file *filp, | |||
137 | 137 | ||
138 | static int drm_set_busid(drm_device_t * dev) | 138 | static int drm_set_busid(drm_device_t * dev) |
139 | { | 139 | { |
140 | int len; | ||
141 | |||
140 | if (dev->unique != NULL) | 142 | if (dev->unique != NULL) |
141 | return EBUSY; | 143 | return EBUSY; |
142 | 144 | ||
143 | dev->unique_len = 20; | 145 | dev->unique_len = 40; |
144 | dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); | 146 | dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); |
145 | if (dev->unique == NULL) | 147 | if (dev->unique == NULL) |
146 | return ENOMEM; | 148 | return ENOMEM; |
147 | 149 | ||
148 | snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", | 150 | len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", |
149 | dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); | 151 | dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); |
150 | 152 | ||
153 | if (len > dev->unique_len) | ||
154 | DRM_ERROR("Unique buffer overflowed\n"); | ||
155 | |||
151 | dev->devname = | 156 | dev->devname = |
152 | drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + | 157 | drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + |
153 | 2, DRM_MEM_DRIVER); | 158 | 2, DRM_MEM_DRIVER); |
@@ -239,7 +244,7 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
239 | { | 244 | { |
240 | drm_file_t *priv = filp->private_data; | 245 | drm_file_t *priv = filp->private_data; |
241 | drm_device_t *dev = priv->head->dev; | 246 | drm_device_t *dev = priv->head->dev; |
242 | drm_client_t __user *argp = (void __user *)arg; | 247 | drm_client_t __user *argp = (drm_client_t __user *)arg; |
243 | drm_client_t client; | 248 | drm_client_t client; |
244 | drm_file_t *pt; | 249 | drm_file_t *pt; |
245 | int idx; | 250 | int idx; |
@@ -262,7 +267,7 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
262 | client.iocs = pt->ioctl_count; | 267 | client.iocs = pt->ioctl_count; |
263 | up(&dev->struct_sem); | 268 | up(&dev->struct_sem); |
264 | 269 | ||
265 | if (copy_to_user((drm_client_t __user *) arg, &client, sizeof(client))) | 270 | if (copy_to_user(argp, &client, sizeof(client))) |
266 | return -EFAULT; | 271 | return -EFAULT; |
267 | return 0; | 272 | return 0; |
268 | } | 273 | } |
@@ -325,17 +330,13 @@ int drm_setversion(DRM_IOCTL_ARGS) | |||
325 | drm_set_version_t retv; | 330 | drm_set_version_t retv; |
326 | int if_version; | 331 | int if_version; |
327 | drm_set_version_t __user *argp = (void __user *)data; | 332 | drm_set_version_t __user *argp = (void __user *)data; |
328 | drm_version_t version; | ||
329 | 333 | ||
330 | DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); | 334 | DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); |
331 | 335 | ||
332 | memset(&version, 0, sizeof(version)); | ||
333 | |||
334 | dev->driver->version(&version); | ||
335 | retv.drm_di_major = DRM_IF_MAJOR; | 336 | retv.drm_di_major = DRM_IF_MAJOR; |
336 | retv.drm_di_minor = DRM_IF_MINOR; | 337 | retv.drm_di_minor = DRM_IF_MINOR; |
337 | retv.drm_dd_major = version.version_major; | 338 | retv.drm_dd_major = dev->driver->major; |
338 | retv.drm_dd_minor = version.version_minor; | 339 | retv.drm_dd_minor = dev->driver->minor; |
339 | 340 | ||
340 | DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); | 341 | DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); |
341 | 342 | ||
@@ -343,7 +344,7 @@ int drm_setversion(DRM_IOCTL_ARGS) | |||
343 | if (sv.drm_di_major != DRM_IF_MAJOR || | 344 | if (sv.drm_di_major != DRM_IF_MAJOR || |
344 | sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) | 345 | sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) |
345 | return EINVAL; | 346 | return EINVAL; |
346 | if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); | 347 | if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor); |
347 | dev->if_version = DRM_MAX(if_version, dev->if_version); | 348 | dev->if_version = DRM_MAX(if_version, dev->if_version); |
348 | if (sv.drm_di_minor >= 1) { | 349 | if (sv.drm_di_minor >= 1) { |
349 | /* | 350 | /* |
@@ -354,9 +355,9 @@ int drm_setversion(DRM_IOCTL_ARGS) | |||
354 | } | 355 | } |
355 | 356 | ||
356 | if (sv.drm_dd_major != -1) { | 357 | if (sv.drm_dd_major != -1) { |
357 | if (sv.drm_dd_major != version.version_major || | 358 | if (sv.drm_dd_major != dev->driver->major || |
358 | sv.drm_dd_minor < 0 | 359 | sv.drm_dd_minor < 0 |
359 | || sv.drm_dd_minor > version.version_minor) | 360 | || sv.drm_dd_minor > dev->driver->minor) |
360 | return EINVAL; | 361 | return EINVAL; |
361 | 362 | ||
362 | if (dev->driver->set_version) | 363 | if (dev->driver->set_version) |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index b48a595d54ec..f9e45303498d 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -130,7 +130,6 @@ int drm_lock(struct inode *inode, struct file *filp, | |||
130 | /* dev->driver->kernel_context_switch isn't used by any of the x86 | 130 | /* dev->driver->kernel_context_switch isn't used by any of the x86 |
131 | * drivers but is used by the Sparc driver. | 131 | * drivers but is used by the Sparc driver. |
132 | */ | 132 | */ |
133 | |||
134 | if (dev->driver->kernel_context_switch && | 133 | if (dev->driver->kernel_context_switch && |
135 | dev->last_context != lock.context) { | 134 | dev->last_context != lock.context) { |
136 | dev->driver->kernel_context_switch(dev, dev->last_context, | 135 | dev->driver->kernel_context_switch(dev, dev->last_context, |
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index abef2acf99f5..8074771e348f 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c | |||
@@ -145,30 +145,22 @@ DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) | |||
145 | return drm_agp_allocate_memory(dev->agp->bridge, pages, type); | 145 | return drm_agp_allocate_memory(dev->agp->bridge, pages, type); |
146 | } | 146 | } |
147 | 147 | ||
148 | EXPORT_SYMBOL(drm_alloc_agp); | ||
149 | |||
150 | /** Wrapper around agp_free_memory() */ | 148 | /** Wrapper around agp_free_memory() */ |
151 | int drm_free_agp(DRM_AGP_MEM * handle, int pages) | 149 | int drm_free_agp(DRM_AGP_MEM * handle, int pages) |
152 | { | 150 | { |
153 | return drm_agp_free_memory(handle) ? 0 : -EINVAL; | 151 | return drm_agp_free_memory(handle) ? 0 : -EINVAL; |
154 | } | 152 | } |
155 | 153 | ||
156 | EXPORT_SYMBOL(drm_free_agp); | ||
157 | |||
158 | /** Wrapper around agp_bind_memory() */ | 154 | /** Wrapper around agp_bind_memory() */ |
159 | int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) | 155 | int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) |
160 | { | 156 | { |
161 | return drm_agp_bind_memory(handle, start); | 157 | return drm_agp_bind_memory(handle, start); |
162 | } | 158 | } |
163 | 159 | ||
164 | EXPORT_SYMBOL(drm_bind_agp); | ||
165 | |||
166 | /** Wrapper around agp_unbind_memory() */ | 160 | /** Wrapper around agp_unbind_memory() */ |
167 | int drm_unbind_agp(DRM_AGP_MEM * handle) | 161 | int drm_unbind_agp(DRM_AGP_MEM * handle) |
168 | { | 162 | { |
169 | return drm_agp_unbind_memory(handle); | 163 | return drm_agp_unbind_memory(handle); |
170 | } | 164 | } |
171 | |||
172 | EXPORT_SYMBOL(drm_unbind_agp); | ||
173 | #endif /* agp */ | 165 | #endif /* agp */ |
174 | #endif /* debug_memory */ | 166 | #endif /* debug_memory */ |
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index b370aca718d2..e84605fc54af 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * \file drm_memory.h | 2 | * \file drm_memory_debug.h |
3 | * Memory management wrappers for DRM. | 3 | * Memory management wrappers for DRM. |
4 | * | 4 | * |
5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> | 5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> |
@@ -43,42 +43,41 @@ typedef struct drm_mem_stats { | |||
43 | unsigned long bytes_freed; | 43 | unsigned long bytes_freed; |
44 | } drm_mem_stats_t; | 44 | } drm_mem_stats_t; |
45 | 45 | ||
46 | static DEFINE_SPINLOCK(DRM(mem_lock)); | 46 | static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; |
47 | static unsigned long DRM(ram_available) = 0; /* In pages */ | 47 | static unsigned long drm_ram_available = 0; /* In pages */ |
48 | static unsigned long DRM(ram_used) = 0; | 48 | static unsigned long drm_ram_used = 0; |
49 | static drm_mem_stats_t DRM(mem_stats)[] = | 49 | static drm_mem_stats_t drm_mem_stats[] = |
50 | { | 50 | { |
51 | [DRM_MEM_DMA] = { | 51 | [DRM_MEM_DMA] = {"dmabufs"}, |
52 | "dmabufs"},[DRM_MEM_SAREA] = { | 52 | [DRM_MEM_SAREA] = {"sareas"}, |
53 | "sareas"},[DRM_MEM_DRIVER] = { | 53 | [DRM_MEM_DRIVER] = {"driver"}, |
54 | "driver"},[DRM_MEM_MAGIC] = { | 54 | [DRM_MEM_MAGIC] = {"magic"}, |
55 | "magic"},[DRM_MEM_IOCTLS] = { | 55 | [DRM_MEM_IOCTLS] = {"ioctltab"}, |
56 | "ioctltab"},[DRM_MEM_MAPS] = { | 56 | [DRM_MEM_MAPS] = {"maplist"}, |
57 | "maplist"},[DRM_MEM_VMAS] = { | 57 | [DRM_MEM_VMAS] = {"vmalist"}, |
58 | "vmalist"},[DRM_MEM_BUFS] = { | 58 | [DRM_MEM_BUFS] = {"buflist"}, |
59 | "buflist"},[DRM_MEM_SEGS] = { | 59 | [DRM_MEM_SEGS] = {"seglist"}, |
60 | "seglist"},[DRM_MEM_PAGES] = { | 60 | [DRM_MEM_PAGES] = {"pagelist"}, |
61 | "pagelist"},[DRM_MEM_FILES] = { | 61 | [DRM_MEM_FILES] = {"files"}, |
62 | "files"},[DRM_MEM_QUEUES] = { | 62 | [DRM_MEM_QUEUES] = {"queues"}, |
63 | "queues"},[DRM_MEM_CMDS] = { | 63 | [DRM_MEM_CMDS] = {"commands"}, |
64 | "commands"},[DRM_MEM_MAPPINGS] = { | 64 | [DRM_MEM_MAPPINGS] = {"mappings"}, |
65 | "mappings"},[DRM_MEM_BUFLISTS] = { | 65 | [DRM_MEM_BUFLISTS] = {"buflists"}, |
66 | "buflists"},[DRM_MEM_AGPLISTS] = { | 66 | [DRM_MEM_AGPLISTS] = {"agplist"}, |
67 | "agplist"},[DRM_MEM_SGLISTS] = { | 67 | [DRM_MEM_SGLISTS] = {"sglist"}, |
68 | "sglist"},[DRM_MEM_TOTALAGP] = { | 68 | [DRM_MEM_TOTALAGP] = {"totalagp"}, |
69 | "totalagp"},[DRM_MEM_BOUNDAGP] = { | 69 | [DRM_MEM_BOUNDAGP] = {"boundagp"}, |
70 | "boundagp"},[DRM_MEM_CTXBITMAP] = { | 70 | [DRM_MEM_CTXBITMAP] = {"ctxbitmap"}, |
71 | "ctxbitmap"},[DRM_MEM_CTXLIST] = { | 71 | [DRM_MEM_CTXLIST] = {"ctxlist"}, |
72 | "ctxlist"},[DRM_MEM_STUB] = { | 72 | [DRM_MEM_STUB] = {"stub"}, |
73 | "stub"}, { | 73 | {NULL, 0,} /* Last entry must be null */ |
74 | NULL, 0,} /* Last entry must be null */ | ||
75 | }; | 74 | }; |
76 | 75 | ||
77 | void DRM(mem_init) (void) { | 76 | void drm_mem_init (void) { |
78 | drm_mem_stats_t *mem; | 77 | drm_mem_stats_t *mem; |
79 | struct sysinfo si; | 78 | struct sysinfo si; |
80 | 79 | ||
81 | for (mem = DRM(mem_stats); mem->name; ++mem) { | 80 | for (mem = drm_mem_stats; mem->name; ++mem) { |
82 | mem->succeed_count = 0; | 81 | mem->succeed_count = 0; |
83 | mem->free_count = 0; | 82 | mem->free_count = 0; |
84 | mem->fail_count = 0; | 83 | mem->fail_count = 0; |
@@ -87,13 +86,13 @@ void DRM(mem_init) (void) { | |||
87 | } | 86 | } |
88 | 87 | ||
89 | si_meminfo(&si); | 88 | si_meminfo(&si); |
90 | DRM(ram_available) = si.totalram; | 89 | drm_ram_available = si.totalram; |
91 | DRM(ram_used) = 0; | 90 | drm_ram_used = 0; |
92 | } | 91 | } |
93 | 92 | ||
94 | /* drm_mem_info is called whenever a process reads /dev/drm/mem. */ | 93 | /* drm_mem_info is called whenever a process reads /dev/drm/mem. */ |
95 | 94 | ||
96 | static int DRM(_mem_info) (char *buf, char **start, off_t offset, | 95 | static int drm__mem_info (char *buf, char **start, off_t offset, |
97 | int request, int *eof, void *data) { | 96 | int request, int *eof, void *data) { |
98 | drm_mem_stats_t *pt; | 97 | drm_mem_stats_t *pt; |
99 | int len = 0; | 98 | int len = 0; |
@@ -112,11 +111,11 @@ static int DRM(_mem_info) (char *buf, char **start, off_t offset, | |||
112 | " | allocs bytes\n\n"); | 111 | " | allocs bytes\n\n"); |
113 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", | 112 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", |
114 | "system", 0, 0, 0, | 113 | "system", 0, 0, 0, |
115 | DRM(ram_available) << (PAGE_SHIFT - 10)); | 114 | drm_ram_available << (PAGE_SHIFT - 10)); |
116 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", | 115 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", |
117 | "locked", 0, 0, 0, DRM(ram_used) >> 10); | 116 | "locked", 0, 0, 0, drm_ram_used >> 10); |
118 | DRM_PROC_PRINT("\n"); | 117 | DRM_PROC_PRINT("\n"); |
119 | for (pt = DRM(mem_stats); pt->name; pt++) { | 118 | for (pt = drm_mem_stats; pt->name; pt++) { |
120 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", | 119 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", |
121 | pt->name, | 120 | pt->name, |
122 | pt->succeed_count, | 121 | pt->succeed_count, |
@@ -135,17 +134,17 @@ static int DRM(_mem_info) (char *buf, char **start, off_t offset, | |||
135 | return len - offset; | 134 | return len - offset; |
136 | } | 135 | } |
137 | 136 | ||
138 | int DRM(mem_info) (char *buf, char **start, off_t offset, | 137 | int drm_mem_info (char *buf, char **start, off_t offset, |
139 | int len, int *eof, void *data) { | 138 | int len, int *eof, void *data) { |
140 | int ret; | 139 | int ret; |
141 | 140 | ||
142 | spin_lock(&DRM(mem_lock)); | 141 | spin_lock(&drm_mem_lock); |
143 | ret = DRM(_mem_info) (buf, start, offset, len, eof, data); | 142 | ret = drm__mem_info (buf, start, offset, len, eof, data); |
144 | spin_unlock(&DRM(mem_lock)); | 143 | spin_unlock(&drm_mem_lock); |
145 | return ret; | 144 | return ret; |
146 | } | 145 | } |
147 | 146 | ||
148 | void *DRM(alloc) (size_t size, int area) { | 147 | void *drm_alloc (size_t size, int area) { |
149 | void *pt; | 148 | void *pt; |
150 | 149 | ||
151 | if (!size) { | 150 | if (!size) { |
@@ -154,41 +153,41 @@ void *DRM(alloc) (size_t size, int area) { | |||
154 | } | 153 | } |
155 | 154 | ||
156 | if (!(pt = kmalloc(size, GFP_KERNEL))) { | 155 | if (!(pt = kmalloc(size, GFP_KERNEL))) { |
157 | spin_lock(&DRM(mem_lock)); | 156 | spin_lock(&drm_mem_lock); |
158 | ++DRM(mem_stats)[area].fail_count; | 157 | ++drm_mem_stats[area].fail_count; |
159 | spin_unlock(&DRM(mem_lock)); | 158 | spin_unlock(&drm_mem_lock); |
160 | return NULL; | 159 | return NULL; |
161 | } | 160 | } |
162 | spin_lock(&DRM(mem_lock)); | 161 | spin_lock(&drm_mem_lock); |
163 | ++DRM(mem_stats)[area].succeed_count; | 162 | ++drm_mem_stats[area].succeed_count; |
164 | DRM(mem_stats)[area].bytes_allocated += size; | 163 | drm_mem_stats[area].bytes_allocated += size; |
165 | spin_unlock(&DRM(mem_lock)); | 164 | spin_unlock(&drm_mem_lock); |
166 | return pt; | 165 | return pt; |
167 | } | 166 | } |
168 | 167 | ||
169 | void *DRM(calloc) (size_t nmemb, size_t size, int area) { | 168 | void *drm_calloc (size_t nmemb, size_t size, int area) { |
170 | void *addr; | 169 | void *addr; |
171 | 170 | ||
172 | addr = DRM(alloc) (nmemb * size, area); | 171 | addr = drm_alloc (nmemb * size, area); |
173 | if (addr != NULL) | 172 | if (addr != NULL) |
174 | memset((void *)addr, 0, size * nmemb); | 173 | memset((void *)addr, 0, size * nmemb); |
175 | 174 | ||
176 | return addr; | 175 | return addr; |
177 | } | 176 | } |
178 | 177 | ||
179 | void *DRM(realloc) (void *oldpt, size_t oldsize, size_t size, int area) { | 178 | void *drm_realloc (void *oldpt, size_t oldsize, size_t size, int area) { |
180 | void *pt; | 179 | void *pt; |
181 | 180 | ||
182 | if (!(pt = DRM(alloc) (size, area))) | 181 | if (!(pt = drm_alloc (size, area))) |
183 | return NULL; | 182 | return NULL; |
184 | if (oldpt && oldsize) { | 183 | if (oldpt && oldsize) { |
185 | memcpy(pt, oldpt, oldsize); | 184 | memcpy(pt, oldpt, oldsize); |
186 | DRM(free) (oldpt, oldsize, area); | 185 | drm_free (oldpt, oldsize, area); |
187 | } | 186 | } |
188 | return pt; | 187 | return pt; |
189 | } | 188 | } |
190 | 189 | ||
191 | void DRM(free) (void *pt, size_t size, int area) { | 190 | void drm_free (void *pt, size_t size, int area) { |
192 | int alloc_count; | 191 | int alloc_count; |
193 | int free_count; | 192 | int free_count; |
194 | 193 | ||
@@ -196,43 +195,43 @@ void DRM(free) (void *pt, size_t size, int area) { | |||
196 | DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); | 195 | DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); |
197 | else | 196 | else |
198 | kfree(pt); | 197 | kfree(pt); |
199 | spin_lock(&DRM(mem_lock)); | 198 | spin_lock(&drm_mem_lock); |
200 | DRM(mem_stats)[area].bytes_freed += size; | 199 | drm_mem_stats[area].bytes_freed += size; |
201 | free_count = ++DRM(mem_stats)[area].free_count; | 200 | free_count = ++drm_mem_stats[area].free_count; |
202 | alloc_count = DRM(mem_stats)[area].succeed_count; | 201 | alloc_count = drm_mem_stats[area].succeed_count; |
203 | spin_unlock(&DRM(mem_lock)); | 202 | spin_unlock(&drm_mem_lock); |
204 | if (free_count > alloc_count) { | 203 | if (free_count > alloc_count) { |
205 | DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", | 204 | DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", |
206 | free_count, alloc_count); | 205 | free_count, alloc_count); |
207 | } | 206 | } |
208 | } | 207 | } |
209 | 208 | ||
210 | unsigned long DRM(alloc_pages) (int order, int area) { | 209 | unsigned long drm_alloc_pages (int order, int area) { |
211 | unsigned long address; | 210 | unsigned long address; |
212 | unsigned long bytes = PAGE_SIZE << order; | 211 | unsigned long bytes = PAGE_SIZE << order; |
213 | unsigned long addr; | 212 | unsigned long addr; |
214 | unsigned int sz; | 213 | unsigned int sz; |
215 | 214 | ||
216 | spin_lock(&DRM(mem_lock)); | 215 | spin_lock(&drm_mem_lock); |
217 | if ((DRM(ram_used) >> PAGE_SHIFT) | 216 | if ((drm_ram_used >> PAGE_SHIFT) |
218 | > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) { | 217 | > (DRM_RAM_PERCENT * drm_ram_available) / 100) { |
219 | spin_unlock(&DRM(mem_lock)); | 218 | spin_unlock(&drm_mem_lock); |
220 | return 0; | 219 | return 0; |
221 | } | 220 | } |
222 | spin_unlock(&DRM(mem_lock)); | 221 | spin_unlock(&drm_mem_lock); |
223 | 222 | ||
224 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); | 223 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); |
225 | if (!address) { | 224 | if (!address) { |
226 | spin_lock(&DRM(mem_lock)); | 225 | spin_lock(&drm_mem_lock); |
227 | ++DRM(mem_stats)[area].fail_count; | 226 | ++drm_mem_stats[area].fail_count; |
228 | spin_unlock(&DRM(mem_lock)); | 227 | spin_unlock(&drm_mem_lock); |
229 | return 0; | 228 | return 0; |
230 | } | 229 | } |
231 | spin_lock(&DRM(mem_lock)); | 230 | spin_lock(&drm_mem_lock); |
232 | ++DRM(mem_stats)[area].succeed_count; | 231 | ++drm_mem_stats[area].succeed_count; |
233 | DRM(mem_stats)[area].bytes_allocated += bytes; | 232 | drm_mem_stats[area].bytes_allocated += bytes; |
234 | DRM(ram_used) += bytes; | 233 | drm_ram_used += bytes; |
235 | spin_unlock(&DRM(mem_lock)); | 234 | spin_unlock(&drm_mem_lock); |
236 | 235 | ||
237 | /* Zero outside the lock */ | 236 | /* Zero outside the lock */ |
238 | memset((void *)address, 0, bytes); | 237 | memset((void *)address, 0, bytes); |
@@ -246,7 +245,7 @@ unsigned long DRM(alloc_pages) (int order, int area) { | |||
246 | return address; | 245 | return address; |
247 | } | 246 | } |
248 | 247 | ||
249 | void DRM(free_pages) (unsigned long address, int order, int area) { | 248 | void drm_free_pages (unsigned long address, int order, int area) { |
250 | unsigned long bytes = PAGE_SIZE << order; | 249 | unsigned long bytes = PAGE_SIZE << order; |
251 | int alloc_count; | 250 | int alloc_count; |
252 | int free_count; | 251 | int free_count; |
@@ -264,12 +263,12 @@ void DRM(free_pages) (unsigned long address, int order, int area) { | |||
264 | free_pages(address, order); | 263 | free_pages(address, order); |
265 | } | 264 | } |
266 | 265 | ||
267 | spin_lock(&DRM(mem_lock)); | 266 | spin_lock(&drm_mem_lock); |
268 | free_count = ++DRM(mem_stats)[area].free_count; | 267 | free_count = ++drm_mem_stats[area].free_count; |
269 | alloc_count = DRM(mem_stats)[area].succeed_count; | 268 | alloc_count = drm_mem_stats[area].succeed_count; |
270 | DRM(mem_stats)[area].bytes_freed += bytes; | 269 | drm_mem_stats[area].bytes_freed += bytes; |
271 | DRM(ram_used) -= bytes; | 270 | drm_ram_used -= bytes; |
272 | spin_unlock(&DRM(mem_lock)); | 271 | spin_unlock(&drm_mem_lock); |
273 | if (free_count > alloc_count) { | 272 | if (free_count > alloc_count) { |
274 | DRM_MEM_ERROR(area, | 273 | DRM_MEM_ERROR(area, |
275 | "Excess frees: %d frees, %d allocs\n", | 274 | "Excess frees: %d frees, %d allocs\n", |
@@ -277,7 +276,7 @@ void DRM(free_pages) (unsigned long address, int order, int area) { | |||
277 | } | 276 | } |
278 | } | 277 | } |
279 | 278 | ||
280 | void *DRM(ioremap) (unsigned long offset, unsigned long size, | 279 | void *drm_ioremap (unsigned long offset, unsigned long size, |
281 | drm_device_t * dev) { | 280 | drm_device_t * dev) { |
282 | void *pt; | 281 | void *pt; |
283 | 282 | ||
@@ -288,19 +287,19 @@ void *DRM(ioremap) (unsigned long offset, unsigned long size, | |||
288 | } | 287 | } |
289 | 288 | ||
290 | if (!(pt = drm_ioremap(offset, size, dev))) { | 289 | if (!(pt = drm_ioremap(offset, size, dev))) { |
291 | spin_lock(&DRM(mem_lock)); | 290 | spin_lock(&drm_mem_lock); |
292 | ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; | 291 | ++drm_mem_stats[DRM_MEM_MAPPINGS].fail_count; |
293 | spin_unlock(&DRM(mem_lock)); | 292 | spin_unlock(&drm_mem_lock); |
294 | return NULL; | 293 | return NULL; |
295 | } | 294 | } |
296 | spin_lock(&DRM(mem_lock)); | 295 | spin_lock(&drm_mem_lock); |
297 | ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; | 296 | ++drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; |
298 | DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; | 297 | drm_mem_stats[DRM_MEM_MAPPINGS].bytes_allocated += size; |
299 | spin_unlock(&DRM(mem_lock)); | 298 | spin_unlock(&drm_mem_lock); |
300 | return pt; | 299 | return pt; |
301 | } | 300 | } |
302 | 301 | ||
303 | void *DRM(ioremap_nocache) (unsigned long offset, unsigned long size, | 302 | void *drm_ioremap_nocache (unsigned long offset, unsigned long size, |
304 | drm_device_t * dev) { | 303 | drm_device_t * dev) { |
305 | void *pt; | 304 | void *pt; |
306 | 305 | ||
@@ -311,19 +310,19 @@ void *DRM(ioremap_nocache) (unsigned long offset, unsigned long size, | |||
311 | } | 310 | } |
312 | 311 | ||
313 | if (!(pt = drm_ioremap_nocache(offset, size, dev))) { | 312 | if (!(pt = drm_ioremap_nocache(offset, size, dev))) { |
314 | spin_lock(&DRM(mem_lock)); | 313 | spin_lock(&drm_mem_lock); |
315 | ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; | 314 | ++drm_mem_stats[DRM_MEM_MAPPINGS].fail_count; |
316 | spin_unlock(&DRM(mem_lock)); | 315 | spin_unlock(&drm_mem_lock); |
317 | return NULL; | 316 | return NULL; |
318 | } | 317 | } |
319 | spin_lock(&DRM(mem_lock)); | 318 | spin_lock(&drm_mem_lock); |
320 | ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; | 319 | ++drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; |
321 | DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; | 320 | drm_mem_stats[DRM_MEM_MAPPINGS].bytes_allocated += size; |
322 | spin_unlock(&DRM(mem_lock)); | 321 | spin_unlock(&drm_mem_lock); |
323 | return pt; | 322 | return pt; |
324 | } | 323 | } |
325 | 324 | ||
326 | void DRM(ioremapfree) (void *pt, unsigned long size, drm_device_t * dev) { | 325 | void drm_ioremapfree (void *pt, unsigned long size, drm_device_t * dev) { |
327 | int alloc_count; | 326 | int alloc_count; |
328 | int free_count; | 327 | int free_count; |
329 | 328 | ||
@@ -333,11 +332,11 @@ void DRM(ioremapfree) (void *pt, unsigned long size, drm_device_t * dev) { | |||
333 | else | 332 | else |
334 | drm_ioremapfree(pt, size, dev); | 333 | drm_ioremapfree(pt, size, dev); |
335 | 334 | ||
336 | spin_lock(&DRM(mem_lock)); | 335 | spin_lock(&drm_mem_lock); |
337 | DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size; | 336 | drm_mem_stats[DRM_MEM_MAPPINGS].bytes_freed += size; |
338 | free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count; | 337 | free_count = ++drm_mem_stats[DRM_MEM_MAPPINGS].free_count; |
339 | alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; | 338 | alloc_count = drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; |
340 | spin_unlock(&DRM(mem_lock)); | 339 | spin_unlock(&drm_mem_lock); |
341 | if (free_count > alloc_count) { | 340 | if (free_count > alloc_count) { |
342 | DRM_MEM_ERROR(DRM_MEM_MAPPINGS, | 341 | DRM_MEM_ERROR(DRM_MEM_MAPPINGS, |
343 | "Excess frees: %d frees, %d allocs\n", | 342 | "Excess frees: %d frees, %d allocs\n", |
@@ -347,7 +346,7 @@ void DRM(ioremapfree) (void *pt, unsigned long size, drm_device_t * dev) { | |||
347 | 346 | ||
348 | #if __OS_HAS_AGP | 347 | #if __OS_HAS_AGP |
349 | 348 | ||
350 | DRM_AGP_MEM *DRM(alloc_agp) (int pages, u32 type) { | 349 | DRM_AGP_MEM *drm_alloc_agp (drm_device_t *dev, int pages, u32 type) { |
351 | DRM_AGP_MEM *handle; | 350 | DRM_AGP_MEM *handle; |
352 | 351 | ||
353 | if (!pages) { | 352 | if (!pages) { |
@@ -355,21 +354,21 @@ DRM_AGP_MEM *DRM(alloc_agp) (int pages, u32 type) { | |||
355 | return NULL; | 354 | return NULL; |
356 | } | 355 | } |
357 | 356 | ||
358 | if ((handle = DRM(agp_allocate_memory) (pages, type))) { | 357 | if ((handle = drm_agp_allocate_memory (pages, type))) { |
359 | spin_lock(&DRM(mem_lock)); | 358 | spin_lock(&drm_mem_lock); |
360 | ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; | 359 | ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; |
361 | DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated | 360 | drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated |
362 | += pages << PAGE_SHIFT; | 361 | += pages << PAGE_SHIFT; |
363 | spin_unlock(&DRM(mem_lock)); | 362 | spin_unlock(&drm_mem_lock); |
364 | return handle; | 363 | return handle; |
365 | } | 364 | } |
366 | spin_lock(&DRM(mem_lock)); | 365 | spin_lock(&drm_mem_lock); |
367 | ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count; | 366 | ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; |
368 | spin_unlock(&DRM(mem_lock)); | 367 | spin_unlock(&drm_mem_lock); |
369 | return NULL; | 368 | return NULL; |
370 | } | 369 | } |
371 | 370 | ||
372 | int DRM(free_agp) (DRM_AGP_MEM * handle, int pages) { | 371 | int drm_free_agp (DRM_AGP_MEM * handle, int pages) { |
373 | int alloc_count; | 372 | int alloc_count; |
374 | int free_count; | 373 | int free_count; |
375 | int retval = -EINVAL; | 374 | int retval = -EINVAL; |
@@ -380,13 +379,13 @@ int DRM(free_agp) (DRM_AGP_MEM * handle, int pages) { | |||
380 | return retval; | 379 | return retval; |
381 | } | 380 | } |
382 | 381 | ||
383 | if (DRM(agp_free_memory) (handle)) { | 382 | if (drm_agp_free_memory (handle)) { |
384 | spin_lock(&DRM(mem_lock)); | 383 | spin_lock(&drm_mem_lock); |
385 | free_count = ++DRM(mem_stats)[DRM_MEM_TOTALAGP].free_count; | 384 | free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count; |
386 | alloc_count = DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; | 385 | alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; |
387 | DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_freed | 386 | drm_mem_stats[DRM_MEM_TOTALAGP].bytes_freed |
388 | += pages << PAGE_SHIFT; | 387 | += pages << PAGE_SHIFT; |
389 | spin_unlock(&DRM(mem_lock)); | 388 | spin_unlock(&drm_mem_lock); |
390 | if (free_count > alloc_count) { | 389 | if (free_count > alloc_count) { |
391 | DRM_MEM_ERROR(DRM_MEM_TOTALAGP, | 390 | DRM_MEM_ERROR(DRM_MEM_TOTALAGP, |
392 | "Excess frees: %d frees, %d allocs\n", | 391 | "Excess frees: %d frees, %d allocs\n", |
@@ -397,7 +396,7 @@ int DRM(free_agp) (DRM_AGP_MEM * handle, int pages) { | |||
397 | return retval; | 396 | return retval; |
398 | } | 397 | } |
399 | 398 | ||
400 | int DRM(bind_agp) (DRM_AGP_MEM * handle, unsigned int start) { | 399 | int drm_bind_agp (DRM_AGP_MEM * handle, unsigned int start) { |
401 | int retcode = -EINVAL; | 400 | int retcode = -EINVAL; |
402 | 401 | ||
403 | if (!handle) { | 402 | if (!handle) { |
@@ -406,21 +405,21 @@ int DRM(bind_agp) (DRM_AGP_MEM * handle, unsigned int start) { | |||
406 | return retcode; | 405 | return retcode; |
407 | } | 406 | } |
408 | 407 | ||
409 | if (!(retcode = DRM(agp_bind_memory) (handle, start))) { | 408 | if (!(retcode = drm_agp_bind_memory (handle, start))) { |
410 | spin_lock(&DRM(mem_lock)); | 409 | spin_lock(&drm_mem_lock); |
411 | ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; | 410 | ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; |
412 | DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated | 411 | drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated |
413 | += handle->page_count << PAGE_SHIFT; | 412 | += handle->page_count << PAGE_SHIFT; |
414 | spin_unlock(&DRM(mem_lock)); | 413 | spin_unlock(&drm_mem_lock); |
415 | return retcode; | 414 | return retcode; |
416 | } | 415 | } |
417 | spin_lock(&DRM(mem_lock)); | 416 | spin_lock(&drm_mem_lock); |
418 | ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count; | 417 | ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; |
419 | spin_unlock(&DRM(mem_lock)); | 418 | spin_unlock(&drm_mem_lock); |
420 | return retcode; | 419 | return retcode; |
421 | } | 420 | } |
422 | 421 | ||
423 | int DRM(unbind_agp) (DRM_AGP_MEM * handle) { | 422 | int drm_unbind_agp (DRM_AGP_MEM * handle) { |
424 | int alloc_count; | 423 | int alloc_count; |
425 | int free_count; | 424 | int free_count; |
426 | int retcode = -EINVAL; | 425 | int retcode = -EINVAL; |
@@ -431,14 +430,14 @@ int DRM(unbind_agp) (DRM_AGP_MEM * handle) { | |||
431 | return retcode; | 430 | return retcode; |
432 | } | 431 | } |
433 | 432 | ||
434 | if ((retcode = DRM(agp_unbind_memory) (handle))) | 433 | if ((retcode = drm_agp_unbind_memory (handle))) |
435 | return retcode; | 434 | return retcode; |
436 | spin_lock(&DRM(mem_lock)); | 435 | spin_lock(&drm_mem_lock); |
437 | free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count; | 436 | free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; |
438 | alloc_count = DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; | 437 | alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; |
439 | DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_freed | 438 | drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed |
440 | += handle->page_count << PAGE_SHIFT; | 439 | += handle->page_count << PAGE_SHIFT; |
441 | spin_unlock(&DRM(mem_lock)); | 440 | spin_unlock(&drm_mem_lock); |
442 | if (free_count > alloc_count) { | 441 | if (free_count > alloc_count) { |
443 | DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, | 442 | DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, |
444 | "Excess frees: %d frees, %d allocs\n", | 443 | "Excess frees: %d frees, %d allocs\n", |
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h index d51aeb4966f4..695115d70382 100644 --- a/drivers/char/drm/drm_os_linux.h +++ b/drivers/char/drm/drm_os_linux.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define DRM_ERR(d) -(d) | 13 | #define DRM_ERR(d) -(d) |
14 | /** Current process ID */ | 14 | /** Current process ID */ |
15 | #define DRM_CURRENTPID current->pid | 15 | #define DRM_CURRENTPID current->pid |
16 | #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) | ||
16 | #define DRM_UDELAY(d) udelay(d) | 17 | #define DRM_UDELAY(d) udelay(d) |
17 | /** Read a byte from a MMIO region */ | 18 | /** Read a byte from a MMIO region */ |
18 | #define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset)) | 19 | #define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset)) |
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index d66dc55e29a0..5b1d3a04458d 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -46,6 +46,7 @@ | |||
46 | {0x1002, 0x4E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ | 46 | {0x1002, 0x4E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ |
47 | {0x1002, 0x4E51, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ | 47 | {0x1002, 0x4E51, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ |
48 | {0x1002, 0x4E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ | 48 | {0x1002, 0x4E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ |
49 | {0x1002, 0x4E56, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \ | ||
49 | {0x1002, 0x5144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ | 50 | {0x1002, 0x5144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ |
50 | {0x1002, 0x5145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ | 51 | {0x1002, 0x5145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ |
51 | {0x1002, 0x5146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ | 52 | {0x1002, 0x5146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \ |
@@ -69,6 +70,7 @@ | |||
69 | {0x1002, 0x516B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ | 70 | {0x1002, 0x516B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ |
70 | {0x1002, 0x516C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ | 71 | {0x1002, 0x516C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ |
71 | {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ | 72 | {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ |
73 | {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \ | ||
72 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \ | 74 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \ |
73 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \ | 75 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \ |
74 | {0x1002, 0x5836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \ | 76 | {0x1002, 0x5836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \ |
@@ -82,10 +84,13 @@ | |||
82 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ | 84 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ |
83 | {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 85 | {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
84 | {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 86 | {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
87 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ | ||
85 | {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ | 88 | {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ |
86 | {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 89 | {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
87 | {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ | 90 | {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ |
88 | {0x1002, 0x5c64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 91 | {0x1002, 0x5c64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
92 | {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \ | ||
93 | {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420}, \ | ||
89 | {0, 0, 0} | 94 | {0, 0, 0} |
90 | 95 | ||
91 | #define r128_PCI_IDS \ | 96 | #define r128_PCI_IDS \ |
@@ -176,7 +181,7 @@ | |||
176 | 181 | ||
177 | #define viadrv_PCI_IDS \ | 182 | #define viadrv_PCI_IDS \ |
178 | {0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 183 | {0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
179 | {0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 184 | {0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \ |
180 | {0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 185 | {0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
181 | {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 186 | {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
182 | {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 187 | {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
@@ -196,6 +201,10 @@ | |||
196 | {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 201 | {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
197 | {0, 0, 0} | 202 | {0, 0, 0} |
198 | 203 | ||
204 | #define gamma_PCI_IDS \ | ||
205 | {0x3d3d, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
206 | {0, 0, 0} | ||
207 | |||
199 | #define savage_PCI_IDS \ | 208 | #define savage_PCI_IDS \ |
200 | {0x5333, 0x8a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ | 209 | {0x5333, 0x8a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ |
201 | {0x5333, 0x8a21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ | 210 | {0x5333, 0x8a21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ |
@@ -234,3 +243,4 @@ | |||
234 | {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 243 | {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
235 | {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 244 | {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
236 | {0, 0, 0} | 245 | {0, 0, 0} |
246 | |||
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c index 3f452f763f0f..6f943e3309ef 100644 --- a/drivers/char/drm/drm_proc.c +++ b/drivers/char/drm/drm_proc.c | |||
@@ -61,16 +61,14 @@ static struct drm_proc_list { | |||
61 | const char *name; /**< file name */ | 61 | const char *name; /**< file name */ |
62 | int (*f) (char *, char **, off_t, int, int *, void *); /**< proc callback*/ | 62 | int (*f) (char *, char **, off_t, int, int *, void *); /**< proc callback*/ |
63 | } drm_proc_list[] = { | 63 | } drm_proc_list[] = { |
64 | { | 64 | {"name", drm_name_info}, |
65 | "name", drm_name_info}, { | 65 | {"mem", drm_mem_info}, |
66 | "mem", drm_mem_info}, { | 66 | {"vm", drm_vm_info}, |
67 | "vm", drm_vm_info}, { | 67 | {"clients", drm_clients_info}, |
68 | "clients", drm_clients_info}, { | 68 | {"queues", drm_queues_info}, |
69 | "queues", drm_queues_info}, { | 69 | {"bufs", drm_bufs_info}, |
70 | "bufs", drm_bufs_info}, | ||
71 | #if DRM_DEBUG_CODE | 70 | #if DRM_DEBUG_CODE |
72 | { | 71 | {"vma", drm_vma_info}, |
73 | "vma", drm_vma_info}, | ||
74 | #endif | 72 | #endif |
75 | }; | 73 | }; |
76 | 74 | ||
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 60b6f8e8bf69..42d766359caa 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c | |||
@@ -93,8 +93,8 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, | |||
93 | 93 | ||
94 | dev->driver = driver; | 94 | dev->driver = driver; |
95 | 95 | ||
96 | if (dev->driver->preinit) | 96 | if (dev->driver->load) |
97 | if ((retcode = dev->driver->preinit(dev, ent->driver_data))) | 97 | if ((retcode = dev->driver->load(dev, ent->driver_data))) |
98 | goto error_out_unreg; | 98 | goto error_out_unreg; |
99 | 99 | ||
100 | if (drm_core_has_AGP(dev)) { | 100 | if (drm_core_has_AGP(dev)) { |
@@ -124,47 +124,10 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, | |||
124 | return 0; | 124 | return 0; |
125 | 125 | ||
126 | error_out_unreg: | 126 | error_out_unreg: |
127 | drm_takedown(dev); | 127 | drm_lastclose(dev); |
128 | return retcode; | 128 | return retcode; |
129 | } | 129 | } |
130 | 130 | ||
131 | /** | ||
132 | * File \c open operation. | ||
133 | * | ||
134 | * \param inode device inode. | ||
135 | * \param filp file pointer. | ||
136 | * | ||
137 | * Puts the dev->fops corresponding to the device minor number into | ||
138 | * \p filp, call the \c open method, and restore the file operations. | ||
139 | */ | ||
140 | int drm_stub_open(struct inode *inode, struct file *filp) | ||
141 | { | ||
142 | drm_device_t *dev = NULL; | ||
143 | int minor = iminor(inode); | ||
144 | int err = -ENODEV; | ||
145 | struct file_operations *old_fops; | ||
146 | |||
147 | DRM_DEBUG("\n"); | ||
148 | |||
149 | if (!((minor >= 0) && (minor < drm_cards_limit))) | ||
150 | return -ENODEV; | ||
151 | |||
152 | if (!drm_heads[minor]) | ||
153 | return -ENODEV; | ||
154 | |||
155 | if (!(dev = drm_heads[minor]->dev)) | ||
156 | return -ENODEV; | ||
157 | |||
158 | old_fops = filp->f_op; | ||
159 | filp->f_op = fops_get(&dev->driver->fops); | ||
160 | if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { | ||
161 | fops_put(filp->f_op); | ||
162 | filp->f_op = fops_get(old_fops); | ||
163 | } | ||
164 | fops_put(old_fops); | ||
165 | |||
166 | return err; | ||
167 | } | ||
168 | 131 | ||
169 | /** | 132 | /** |
170 | * Get a secondary minor number. | 133 | * Get a secondary minor number. |
@@ -200,11 +163,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head) | |||
200 | goto err_g1; | 163 | goto err_g1; |
201 | } | 164 | } |
202 | 165 | ||
203 | head->dev_class = drm_sysfs_device_add(drm_class, | 166 | head->dev_class = drm_sysfs_device_add(drm_class, head); |
204 | MKDEV(DRM_MAJOR, | ||
205 | minor), | ||
206 | &dev->pdev->dev, | ||
207 | "card%d", minor); | ||
208 | if (IS_ERR(head->dev_class)) { | 167 | if (IS_ERR(head->dev_class)) { |
209 | printk(KERN_ERR | 168 | printk(KERN_ERR |
210 | "DRM: Error sysfs_device_add.\n"); | 169 | "DRM: Error sysfs_device_add.\n"); |
@@ -258,11 +217,10 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
258 | } | 217 | } |
259 | if ((ret = drm_get_head(dev, &dev->primary))) | 218 | if ((ret = drm_get_head(dev, &dev->primary))) |
260 | goto err_g1; | 219 | goto err_g1; |
261 | 220 | ||
262 | /* postinit is a required function to display the signon banner */ | 221 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", |
263 | /* drivers add secondary heads here if needed */ | 222 | driver->name, driver->major, driver->minor, driver->patchlevel, |
264 | if ((ret = dev->driver->postinit(dev, ent->driver_data))) | 223 | driver->date, dev->primary.minor); |
265 | goto err_g1; | ||
266 | 224 | ||
267 | return 0; | 225 | return 0; |
268 | 226 | ||
@@ -318,10 +276,9 @@ int drm_put_head(drm_head_t * head) | |||
318 | DRM_DEBUG("release secondary minor %d\n", minor); | 276 | DRM_DEBUG("release secondary minor %d\n", minor); |
319 | 277 | ||
320 | drm_proc_cleanup(minor, drm_proc_root, head->dev_root); | 278 | drm_proc_cleanup(minor, drm_proc_root, head->dev_root); |
321 | drm_sysfs_device_remove(MKDEV(DRM_MAJOR, head->minor)); | 279 | drm_sysfs_device_remove(head->dev_class); |
322 | 280 | ||
323 | *head = (drm_head_t) { | 281 | *head = (drm_head_t) {.dev = NULL}; |
324 | .dev = NULL}; | ||
325 | 282 | ||
326 | drm_heads[minor] = NULL; | 283 | drm_heads[minor] = NULL; |
327 | 284 | ||
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 6d3449761914..68e43ddc16ae 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -15,8 +15,6 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/kdev_t.h> | 16 | #include <linux/kdev_t.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/string.h> | ||
20 | 18 | ||
21 | #include "drm_core.h" | 19 | #include "drm_core.h" |
22 | #include "drmP.h" | 20 | #include "drmP.h" |
@@ -28,15 +26,11 @@ struct drm_sysfs_class { | |||
28 | #define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class) | 26 | #define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class) |
29 | 27 | ||
30 | struct simple_dev { | 28 | struct simple_dev { |
31 | struct list_head node; | ||
32 | dev_t dev; | 29 | dev_t dev; |
33 | struct class_device class_dev; | 30 | struct class_device class_dev; |
34 | }; | 31 | }; |
35 | #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) | 32 | #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) |
36 | 33 | ||
37 | static LIST_HEAD(simple_dev_list); | ||
38 | static DEFINE_SPINLOCK(simple_dev_list_lock); | ||
39 | |||
40 | static void release_simple_dev(struct class_device *class_dev) | 34 | static void release_simple_dev(struct class_device *class_dev) |
41 | { | 35 | { |
42 | struct simple_dev *s_dev = to_simple_dev(class_dev); | 36 | struct simple_dev *s_dev = to_simple_dev(class_dev); |
@@ -124,6 +118,18 @@ void drm_sysfs_destroy(struct drm_sysfs_class *cs) | |||
124 | class_unregister(&cs->class); | 118 | class_unregister(&cs->class); |
125 | } | 119 | } |
126 | 120 | ||
121 | static ssize_t show_dri(struct class_device *class_device, char *buf) | ||
122 | { | ||
123 | drm_device_t * dev = ((drm_head_t *)class_get_devdata(class_device))->dev; | ||
124 | if (dev->driver->dri_library_name) | ||
125 | return dev->driver->dri_library_name(dev, buf); | ||
126 | return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name); | ||
127 | } | ||
128 | |||
129 | static struct class_device_attribute class_device_attrs[] = { | ||
130 | __ATTR(dri_library_name, S_IRUGO, show_dri, NULL), | ||
131 | }; | ||
132 | |||
127 | /** | 133 | /** |
128 | * drm_sysfs_device_add - adds a class device to sysfs for a character driver | 134 | * drm_sysfs_device_add - adds a class device to sysfs for a character driver |
129 | * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. | 135 | * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. |
@@ -138,13 +144,11 @@ void drm_sysfs_destroy(struct drm_sysfs_class *cs) | |||
138 | * Note: the struct drm_sysfs_class passed to this function must have previously been | 144 | * Note: the struct drm_sysfs_class passed to this function must have previously been |
139 | * created with a call to drm_sysfs_create(). | 145 | * created with a call to drm_sysfs_create(). |
140 | */ | 146 | */ |
141 | struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, dev_t dev, | 147 | struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, |
142 | struct device *device, | 148 | drm_head_t *head) |
143 | const char *fmt, ...) | ||
144 | { | 149 | { |
145 | va_list args; | ||
146 | struct simple_dev *s_dev = NULL; | 150 | struct simple_dev *s_dev = NULL; |
147 | int retval; | 151 | int i, retval; |
148 | 152 | ||
149 | if ((cs == NULL) || (IS_ERR(cs))) { | 153 | if ((cs == NULL) || (IS_ERR(cs))) { |
150 | retval = -ENODEV; | 154 | retval = -ENODEV; |
@@ -158,26 +162,23 @@ struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, dev_t dev, | |||
158 | } | 162 | } |
159 | memset(s_dev, 0x00, sizeof(*s_dev)); | 163 | memset(s_dev, 0x00, sizeof(*s_dev)); |
160 | 164 | ||
161 | s_dev->dev = dev; | 165 | s_dev->dev = MKDEV(DRM_MAJOR, head->minor); |
162 | s_dev->class_dev.dev = device; | 166 | s_dev->class_dev.dev = &(head->dev->pdev)->dev; |
163 | s_dev->class_dev.class = &cs->class; | 167 | s_dev->class_dev.class = &cs->class; |
164 | 168 | ||
165 | va_start(args, fmt); | 169 | snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); |
166 | vsnprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, fmt, args); | ||
167 | va_end(args); | ||
168 | retval = class_device_register(&s_dev->class_dev); | 170 | retval = class_device_register(&s_dev->class_dev); |
169 | if (retval) | 171 | if (retval) |
170 | goto error; | 172 | goto error; |
171 | 173 | ||
172 | class_device_create_file(&s_dev->class_dev, &cs->attr); | 174 | class_device_create_file(&s_dev->class_dev, &cs->attr); |
175 | class_set_devdata(&s_dev->class_dev, head); | ||
173 | 176 | ||
174 | spin_lock(&simple_dev_list_lock); | 177 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
175 | list_add(&s_dev->node, &simple_dev_list); | 178 | class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); |
176 | spin_unlock(&simple_dev_list_lock); | ||
177 | |||
178 | return &s_dev->class_dev; | 179 | return &s_dev->class_dev; |
179 | 180 | ||
180 | error: | 181 | error: |
181 | kfree(s_dev); | 182 | kfree(s_dev); |
182 | return ERR_PTR(retval); | 183 | return ERR_PTR(retval); |
183 | } | 184 | } |
@@ -189,23 +190,12 @@ struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, dev_t dev, | |||
189 | * This call unregisters and cleans up a class device that was created with a | 190 | * This call unregisters and cleans up a class device that was created with a |
190 | * call to drm_sysfs_device_add() | 191 | * call to drm_sysfs_device_add() |
191 | */ | 192 | */ |
192 | void drm_sysfs_device_remove(dev_t dev) | 193 | void drm_sysfs_device_remove(struct class_device *class_dev) |
193 | { | 194 | { |
194 | struct simple_dev *s_dev = NULL; | 195 | struct simple_dev *s_dev = to_simple_dev(class_dev); |
195 | int found = 0; | 196 | int i; |
196 | 197 | ||
197 | spin_lock(&simple_dev_list_lock); | 198 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
198 | list_for_each_entry(s_dev, &simple_dev_list, node) { | 199 | class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); |
199 | if (s_dev->dev == dev) { | 200 | class_device_unregister(&s_dev->class_dev); |
200 | found = 1; | ||
201 | break; | ||
202 | } | ||
203 | } | ||
204 | if (found) { | ||
205 | list_del(&s_dev->node); | ||
206 | spin_unlock(&simple_dev_list_lock); | ||
207 | class_device_unregister(&s_dev->class_dev); | ||
208 | } else { | ||
209 | spin_unlock(&simple_dev_list_lock); | ||
210 | } | ||
211 | } | 201 | } |
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index dba502373da1..cc1b89086876 100644 --- a/drivers/char/drm/i810_dma.c +++ b/drivers/char/drm/i810_dma.c | |||
@@ -114,7 +114,6 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
114 | 114 | ||
115 | static struct file_operations i810_buffer_fops = { | 115 | static struct file_operations i810_buffer_fops = { |
116 | .open = drm_open, | 116 | .open = drm_open, |
117 | .flush = drm_flush, | ||
118 | .release = drm_release, | 117 | .release = drm_release, |
119 | .ioctl = drm_ioctl, | 118 | .ioctl = drm_ioctl, |
120 | .mmap = i810_mmap_buffers, | 119 | .mmap = i810_mmap_buffers, |
@@ -1319,12 +1318,24 @@ static int i810_flip_bufs(struct inode *inode, struct file *filp, | |||
1319 | return 0; | 1318 | return 0; |
1320 | } | 1319 | } |
1321 | 1320 | ||
1322 | void i810_driver_pretakedown(drm_device_t * dev) | 1321 | int i810_driver_load(drm_device_t *dev, unsigned long flags) |
1322 | { | ||
1323 | /* i810 has 4 more counters */ | ||
1324 | dev->counters += 4; | ||
1325 | dev->types[6] = _DRM_STAT_IRQ; | ||
1326 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
1327 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
1328 | dev->types[9] = _DRM_STAT_DMA; | ||
1329 | |||
1330 | return 0; | ||
1331 | } | ||
1332 | |||
1333 | void i810_driver_lastclose(drm_device_t * dev) | ||
1323 | { | 1334 | { |
1324 | i810_dma_cleanup(dev); | 1335 | i810_dma_cleanup(dev); |
1325 | } | 1336 | } |
1326 | 1337 | ||
1327 | void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp) | 1338 | void i810_driver_preclose(drm_device_t * dev, DRMFILE filp) |
1328 | { | 1339 | { |
1329 | if (dev->dev_private) { | 1340 | if (dev->dev_private) { |
1330 | drm_i810_private_t *dev_priv = dev->dev_private; | 1341 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -1334,7 +1345,7 @@ void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp) | |||
1334 | } | 1345 | } |
1335 | } | 1346 | } |
1336 | 1347 | ||
1337 | void i810_driver_release(drm_device_t * dev, struct file *filp) | 1348 | void i810_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) |
1338 | { | 1349 | { |
1339 | i810_reclaim_buffers(dev, filp); | 1350 | i810_reclaim_buffers(dev, filp); |
1340 | } | 1351 | } |
@@ -1346,21 +1357,21 @@ int i810_driver_dma_quiescent(drm_device_t * dev) | |||
1346 | } | 1357 | } |
1347 | 1358 | ||
1348 | drm_ioctl_desc_t i810_ioctls[] = { | 1359 | drm_ioctl_desc_t i810_ioctls[] = { |
1349 | [DRM_IOCTL_NR(DRM_I810_INIT)] = {i810_dma_init, 1, 1}, | 1360 | [DRM_IOCTL_NR(DRM_I810_INIT)] = {i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1350 | [DRM_IOCTL_NR(DRM_I810_VERTEX)] = {i810_dma_vertex, 1, 0}, | 1361 | [DRM_IOCTL_NR(DRM_I810_VERTEX)] = {i810_dma_vertex, DRM_AUTH}, |
1351 | [DRM_IOCTL_NR(DRM_I810_CLEAR)] = {i810_clear_bufs, 1, 0}, | 1362 | [DRM_IOCTL_NR(DRM_I810_CLEAR)] = {i810_clear_bufs, DRM_AUTH}, |
1352 | [DRM_IOCTL_NR(DRM_I810_FLUSH)] = {i810_flush_ioctl, 1, 0}, | 1363 | [DRM_IOCTL_NR(DRM_I810_FLUSH)] = {i810_flush_ioctl, DRM_AUTH}, |
1353 | [DRM_IOCTL_NR(DRM_I810_GETAGE)] = {i810_getage, 1, 0}, | 1364 | [DRM_IOCTL_NR(DRM_I810_GETAGE)] = {i810_getage, DRM_AUTH}, |
1354 | [DRM_IOCTL_NR(DRM_I810_GETBUF)] = {i810_getbuf, 1, 0}, | 1365 | [DRM_IOCTL_NR(DRM_I810_GETBUF)] = {i810_getbuf, DRM_AUTH}, |
1355 | [DRM_IOCTL_NR(DRM_I810_SWAP)] = {i810_swap_bufs, 1, 0}, | 1366 | [DRM_IOCTL_NR(DRM_I810_SWAP)] = {i810_swap_bufs, DRM_AUTH}, |
1356 | [DRM_IOCTL_NR(DRM_I810_COPY)] = {i810_copybuf, 1, 0}, | 1367 | [DRM_IOCTL_NR(DRM_I810_COPY)] = {i810_copybuf, DRM_AUTH}, |
1357 | [DRM_IOCTL_NR(DRM_I810_DOCOPY)] = {i810_docopy, 1, 0}, | 1368 | [DRM_IOCTL_NR(DRM_I810_DOCOPY)] = {i810_docopy, DRM_AUTH}, |
1358 | [DRM_IOCTL_NR(DRM_I810_OV0INFO)] = {i810_ov0_info, 1, 0}, | 1369 | [DRM_IOCTL_NR(DRM_I810_OV0INFO)] = {i810_ov0_info, DRM_AUTH}, |
1359 | [DRM_IOCTL_NR(DRM_I810_FSTATUS)] = {i810_fstatus, 1, 0}, | 1370 | [DRM_IOCTL_NR(DRM_I810_FSTATUS)] = {i810_fstatus, DRM_AUTH}, |
1360 | [DRM_IOCTL_NR(DRM_I810_OV0FLIP)] = {i810_ov0_flip, 1, 0}, | 1371 | [DRM_IOCTL_NR(DRM_I810_OV0FLIP)] = {i810_ov0_flip, DRM_AUTH}, |
1361 | [DRM_IOCTL_NR(DRM_I810_MC)] = {i810_dma_mc, 1, 1}, | 1372 | [DRM_IOCTL_NR(DRM_I810_MC)] = {i810_dma_mc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1362 | [DRM_IOCTL_NR(DRM_I810_RSTATUS)] = {i810_rstatus, 1, 0}, | 1373 | [DRM_IOCTL_NR(DRM_I810_RSTATUS)] = {i810_rstatus, DRM_AUTH}, |
1363 | [DRM_IOCTL_NR(DRM_I810_FLIP)] = {i810_flip_bufs, 1, 0} | 1374 | [DRM_IOCTL_NR(DRM_I810_FLIP)] = {i810_flip_bufs, DRM_AUTH} |
1364 | }; | 1375 | }; |
1365 | 1376 | ||
1366 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); | 1377 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); |
diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c index 070cef6c2b46..dfe6ad2b6a6e 100644 --- a/drivers/char/drm/i810_drv.c +++ b/drivers/char/drm/i810_drv.c | |||
@@ -38,38 +38,6 @@ | |||
38 | 38 | ||
39 | #include "drm_pciids.h" | 39 | #include "drm_pciids.h" |
40 | 40 | ||
41 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
42 | { | ||
43 | /* i810 has 4 more counters */ | ||
44 | dev->counters += 4; | ||
45 | dev->types[6] = _DRM_STAT_IRQ; | ||
46 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
47 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
48 | dev->types[9] = _DRM_STAT_DMA; | ||
49 | |||
50 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
51 | DRIVER_NAME, | ||
52 | DRIVER_MAJOR, | ||
53 | DRIVER_MINOR, | ||
54 | DRIVER_PATCHLEVEL, | ||
55 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
56 | ); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static int version(drm_version_t * version) | ||
61 | { | ||
62 | int len; | ||
63 | |||
64 | version->version_major = DRIVER_MAJOR; | ||
65 | version->version_minor = DRIVER_MINOR; | ||
66 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
67 | DRM_COPY(version->name, DRIVER_NAME); | ||
68 | DRM_COPY(version->date, DRIVER_DATE); | ||
69 | DRM_COPY(version->desc, DRIVER_DESC); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static struct pci_device_id pciidlist[] = { | 41 | static struct pci_device_id pciidlist[] = { |
74 | i810_PCI_IDS | 42 | i810_PCI_IDS |
75 | }; | 43 | }; |
@@ -79,16 +47,14 @@ static struct drm_driver driver = { | |||
79 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | | 47 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | |
80 | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE, | 48 | DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE, |
81 | .dev_priv_size = sizeof(drm_i810_buf_priv_t), | 49 | .dev_priv_size = sizeof(drm_i810_buf_priv_t), |
82 | .pretakedown = i810_driver_pretakedown, | 50 | .load = i810_driver_load, |
83 | .prerelease = i810_driver_prerelease, | 51 | .lastclose = i810_driver_lastclose, |
52 | .preclose = i810_driver_preclose, | ||
84 | .device_is_agp = i810_driver_device_is_agp, | 53 | .device_is_agp = i810_driver_device_is_agp, |
85 | .release = i810_driver_release, | 54 | .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked, |
86 | .dma_quiescent = i810_driver_dma_quiescent, | 55 | .dma_quiescent = i810_driver_dma_quiescent, |
87 | .reclaim_buffers = i810_reclaim_buffers, | ||
88 | .get_map_ofs = drm_core_get_map_ofs, | 56 | .get_map_ofs = drm_core_get_map_ofs, |
89 | .get_reg_ofs = drm_core_get_reg_ofs, | 57 | .get_reg_ofs = drm_core_get_reg_ofs, |
90 | .postinit = postinit, | ||
91 | .version = version, | ||
92 | .ioctls = i810_ioctls, | 58 | .ioctls = i810_ioctls, |
93 | .fops = { | 59 | .fops = { |
94 | .owner = THIS_MODULE, | 60 | .owner = THIS_MODULE, |
@@ -98,13 +64,19 @@ static struct drm_driver driver = { | |||
98 | .mmap = drm_mmap, | 64 | .mmap = drm_mmap, |
99 | .poll = drm_poll, | 65 | .poll = drm_poll, |
100 | .fasync = drm_fasync, | 66 | .fasync = drm_fasync, |
101 | } | 67 | }, |
102 | , | 68 | |
103 | .pci_driver = { | 69 | .pci_driver = { |
104 | .name = DRIVER_NAME, | 70 | .name = DRIVER_NAME, |
105 | .id_table = pciidlist, | 71 | .id_table = pciidlist, |
106 | } | 72 | }, |
107 | , | 73 | |
74 | .name = DRIVER_NAME, | ||
75 | .desc = DRIVER_DESC, | ||
76 | .date = DRIVER_DATE, | ||
77 | .major = DRIVER_MAJOR, | ||
78 | .minor = DRIVER_MINOR, | ||
79 | .patchlevel = DRIVER_PATCHLEVEL, | ||
108 | }; | 80 | }; |
109 | 81 | ||
110 | static int __init i810_init(void) | 82 | static int __init i810_init(void) |
diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h index c78f36aaa2f0..a18b80d91920 100644 --- a/drivers/char/drm/i810_drv.h +++ b/drivers/char/drm/i810_drv.h | |||
@@ -116,9 +116,13 @@ typedef struct drm_i810_private { | |||
116 | extern void i810_reclaim_buffers(drm_device_t * dev, struct file *filp); | 116 | extern void i810_reclaim_buffers(drm_device_t * dev, struct file *filp); |
117 | 117 | ||
118 | extern int i810_driver_dma_quiescent(drm_device_t * dev); | 118 | extern int i810_driver_dma_quiescent(drm_device_t * dev); |
119 | extern void i810_driver_release(drm_device_t * dev, struct file *filp); | 119 | extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, |
120 | extern void i810_driver_pretakedown(drm_device_t * dev); | 120 | struct file *filp); |
121 | extern void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp); | 121 | extern int i810_driver_load(struct drm_device *, unsigned long flags); |
122 | extern void i810_driver_lastclose(drm_device_t * dev); | ||
123 | extern void i810_driver_preclose(drm_device_t * dev, DRMFILE filp); | ||
124 | extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, | ||
125 | struct file *filp); | ||
122 | extern int i810_driver_device_is_agp(drm_device_t * dev); | 126 | extern int i810_driver_device_is_agp(drm_device_t * dev); |
123 | 127 | ||
124 | extern drm_ioctl_desc_t i810_ioctls[]; | 128 | extern drm_ioctl_desc_t i810_ioctls[]; |
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c index dc94f1914425..4fea32aed6d2 100644 --- a/drivers/char/drm/i830_dma.c +++ b/drivers/char/drm/i830_dma.c | |||
@@ -116,7 +116,6 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
116 | 116 | ||
117 | static struct file_operations i830_buffer_fops = { | 117 | static struct file_operations i830_buffer_fops = { |
118 | .open = drm_open, | 118 | .open = drm_open, |
119 | .flush = drm_flush, | ||
120 | .release = drm_release, | 119 | .release = drm_release, |
121 | .ioctl = drm_ioctl, | 120 | .ioctl = drm_ioctl, |
122 | .mmap = i830_mmap_buffers, | 121 | .mmap = i830_mmap_buffers, |
@@ -1517,12 +1516,24 @@ static int i830_setparam(struct inode *inode, struct file *filp, | |||
1517 | return 0; | 1516 | return 0; |
1518 | } | 1517 | } |
1519 | 1518 | ||
1520 | void i830_driver_pretakedown(drm_device_t * dev) | 1519 | int i830_driver_load(drm_device_t *dev, unsigned long flags) |
1520 | { | ||
1521 | /* i830 has 4 more counters */ | ||
1522 | dev->counters += 4; | ||
1523 | dev->types[6] = _DRM_STAT_IRQ; | ||
1524 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
1525 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
1526 | dev->types[9] = _DRM_STAT_DMA; | ||
1527 | |||
1528 | return 0; | ||
1529 | } | ||
1530 | |||
1531 | void i830_driver_lastclose(drm_device_t * dev) | ||
1521 | { | 1532 | { |
1522 | i830_dma_cleanup(dev); | 1533 | i830_dma_cleanup(dev); |
1523 | } | 1534 | } |
1524 | 1535 | ||
1525 | void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp) | 1536 | void i830_driver_preclose(drm_device_t * dev, DRMFILE filp) |
1526 | { | 1537 | { |
1527 | if (dev->dev_private) { | 1538 | if (dev->dev_private) { |
1528 | drm_i830_private_t *dev_priv = dev->dev_private; | 1539 | drm_i830_private_t *dev_priv = dev->dev_private; |
@@ -1532,7 +1543,7 @@ void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp) | |||
1532 | } | 1543 | } |
1533 | } | 1544 | } |
1534 | 1545 | ||
1535 | void i830_driver_release(drm_device_t * dev, struct file *filp) | 1546 | void i830_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) |
1536 | { | 1547 | { |
1537 | i830_reclaim_buffers(dev, filp); | 1548 | i830_reclaim_buffers(dev, filp); |
1538 | } | 1549 | } |
@@ -1544,20 +1555,20 @@ int i830_driver_dma_quiescent(drm_device_t * dev) | |||
1544 | } | 1555 | } |
1545 | 1556 | ||
1546 | drm_ioctl_desc_t i830_ioctls[] = { | 1557 | drm_ioctl_desc_t i830_ioctls[] = { |
1547 | [DRM_IOCTL_NR(DRM_I830_INIT)] = {i830_dma_init, 1, 1}, | 1558 | [DRM_IOCTL_NR(DRM_I830_INIT)] = {i830_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1548 | [DRM_IOCTL_NR(DRM_I830_VERTEX)] = {i830_dma_vertex, 1, 0}, | 1559 | [DRM_IOCTL_NR(DRM_I830_VERTEX)] = {i830_dma_vertex, DRM_AUTH}, |
1549 | [DRM_IOCTL_NR(DRM_I830_CLEAR)] = {i830_clear_bufs, 1, 0}, | 1560 | [DRM_IOCTL_NR(DRM_I830_CLEAR)] = {i830_clear_bufs, DRM_AUTH}, |
1550 | [DRM_IOCTL_NR(DRM_I830_FLUSH)] = {i830_flush_ioctl, 1, 0}, | 1561 | [DRM_IOCTL_NR(DRM_I830_FLUSH)] = {i830_flush_ioctl, DRM_AUTH}, |
1551 | [DRM_IOCTL_NR(DRM_I830_GETAGE)] = {i830_getage, 1, 0}, | 1562 | [DRM_IOCTL_NR(DRM_I830_GETAGE)] = {i830_getage, DRM_AUTH}, |
1552 | [DRM_IOCTL_NR(DRM_I830_GETBUF)] = {i830_getbuf, 1, 0}, | 1563 | [DRM_IOCTL_NR(DRM_I830_GETBUF)] = {i830_getbuf, DRM_AUTH}, |
1553 | [DRM_IOCTL_NR(DRM_I830_SWAP)] = {i830_swap_bufs, 1, 0}, | 1564 | [DRM_IOCTL_NR(DRM_I830_SWAP)] = {i830_swap_bufs, DRM_AUTH}, |
1554 | [DRM_IOCTL_NR(DRM_I830_COPY)] = {i830_copybuf, 1, 0}, | 1565 | [DRM_IOCTL_NR(DRM_I830_COPY)] = {i830_copybuf, DRM_AUTH}, |
1555 | [DRM_IOCTL_NR(DRM_I830_DOCOPY)] = {i830_docopy, 1, 0}, | 1566 | [DRM_IOCTL_NR(DRM_I830_DOCOPY)] = {i830_docopy, DRM_AUTH}, |
1556 | [DRM_IOCTL_NR(DRM_I830_FLIP)] = {i830_flip_bufs, 1, 0}, | 1567 | [DRM_IOCTL_NR(DRM_I830_FLIP)] = {i830_flip_bufs, DRM_AUTH}, |
1557 | [DRM_IOCTL_NR(DRM_I830_IRQ_EMIT)] = {i830_irq_emit, 1, 0}, | 1568 | [DRM_IOCTL_NR(DRM_I830_IRQ_EMIT)] = {i830_irq_emit, DRM_AUTH}, |
1558 | [DRM_IOCTL_NR(DRM_I830_IRQ_WAIT)] = {i830_irq_wait, 1, 0}, | 1569 | [DRM_IOCTL_NR(DRM_I830_IRQ_WAIT)] = {i830_irq_wait, DRM_AUTH}, |
1559 | [DRM_IOCTL_NR(DRM_I830_GETPARAM)] = {i830_getparam, 1, 0}, | 1570 | [DRM_IOCTL_NR(DRM_I830_GETPARAM)] = {i830_getparam, DRM_AUTH}, |
1560 | [DRM_IOCTL_NR(DRM_I830_SETPARAM)] = {i830_setparam, 1, 0} | 1571 | [DRM_IOCTL_NR(DRM_I830_SETPARAM)] = {i830_setparam, DRM_AUTH} |
1561 | }; | 1572 | }; |
1562 | 1573 | ||
1563 | int i830_max_ioctl = DRM_ARRAY_SIZE(i830_ioctls); | 1574 | int i830_max_ioctl = DRM_ARRAY_SIZE(i830_ioctls); |
diff --git a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c index acd821e8fe4d..722658188f5f 100644 --- a/drivers/char/drm/i830_drv.c +++ b/drivers/char/drm/i830_drv.c | |||
@@ -40,37 +40,6 @@ | |||
40 | 40 | ||
41 | #include "drm_pciids.h" | 41 | #include "drm_pciids.h" |
42 | 42 | ||
43 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
44 | { | ||
45 | dev->counters += 4; | ||
46 | dev->types[6] = _DRM_STAT_IRQ; | ||
47 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
48 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
49 | dev->types[9] = _DRM_STAT_DMA; | ||
50 | |||
51 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
52 | DRIVER_NAME, | ||
53 | DRIVER_MAJOR, | ||
54 | DRIVER_MINOR, | ||
55 | DRIVER_PATCHLEVEL, | ||
56 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
57 | ); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static int version(drm_version_t * version) | ||
62 | { | ||
63 | int len; | ||
64 | |||
65 | version->version_major = DRIVER_MAJOR; | ||
66 | version->version_minor = DRIVER_MINOR; | ||
67 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
68 | DRM_COPY(version->name, DRIVER_NAME); | ||
69 | DRM_COPY(version->date, DRIVER_DATE); | ||
70 | DRM_COPY(version->desc, DRIVER_DESC); | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static struct pci_device_id pciidlist[] = { | 43 | static struct pci_device_id pciidlist[] = { |
75 | i830_PCI_IDS | 44 | i830_PCI_IDS |
76 | }; | 45 | }; |
@@ -83,12 +52,12 @@ static struct drm_driver driver = { | |||
83 | .driver_features |= DRIVER_HAVE_IRQ | DRIVER_SHARED_IRQ, | 52 | .driver_features |= DRIVER_HAVE_IRQ | DRIVER_SHARED_IRQ, |
84 | #endif | 53 | #endif |
85 | .dev_priv_size = sizeof(drm_i830_buf_priv_t), | 54 | .dev_priv_size = sizeof(drm_i830_buf_priv_t), |
86 | .pretakedown = i830_driver_pretakedown, | 55 | .load = i830_driver_load, |
87 | .prerelease = i830_driver_prerelease, | 56 | .lastclose = i830_driver_lastclose, |
57 | .preclose = i830_driver_preclose, | ||
88 | .device_is_agp = i830_driver_device_is_agp, | 58 | .device_is_agp = i830_driver_device_is_agp, |
89 | .release = i830_driver_release, | 59 | .reclaim_buffers_locked = i830_driver_reclaim_buffers_locked, |
90 | .dma_quiescent = i830_driver_dma_quiescent, | 60 | .dma_quiescent = i830_driver_dma_quiescent, |
91 | .reclaim_buffers = i830_reclaim_buffers, | ||
92 | .get_map_ofs = drm_core_get_map_ofs, | 61 | .get_map_ofs = drm_core_get_map_ofs, |
93 | .get_reg_ofs = drm_core_get_reg_ofs, | 62 | .get_reg_ofs = drm_core_get_reg_ofs, |
94 | #if USE_IRQS | 63 | #if USE_IRQS |
@@ -97,8 +66,6 @@ static struct drm_driver driver = { | |||
97 | .irq_uninstall = i830_driver_irq_uninstall, | 66 | .irq_uninstall = i830_driver_irq_uninstall, |
98 | .irq_handler = i830_driver_irq_handler, | 67 | .irq_handler = i830_driver_irq_handler, |
99 | #endif | 68 | #endif |
100 | .postinit = postinit, | ||
101 | .version = version, | ||
102 | .ioctls = i830_ioctls, | 69 | .ioctls = i830_ioctls, |
103 | .fops = { | 70 | .fops = { |
104 | .owner = THIS_MODULE, | 71 | .owner = THIS_MODULE, |
@@ -108,13 +75,19 @@ static struct drm_driver driver = { | |||
108 | .mmap = drm_mmap, | 75 | .mmap = drm_mmap, |
109 | .poll = drm_poll, | 76 | .poll = drm_poll, |
110 | .fasync = drm_fasync, | 77 | .fasync = drm_fasync, |
111 | } | 78 | }, |
112 | , | 79 | |
113 | .pci_driver = { | 80 | .pci_driver = { |
114 | .name = DRIVER_NAME, | 81 | .name = DRIVER_NAME, |
115 | .id_table = pciidlist, | 82 | .id_table = pciidlist, |
116 | } | 83 | }, |
117 | 84 | ||
85 | .name = DRIVER_NAME, | ||
86 | .desc = DRIVER_DESC, | ||
87 | .date = DRIVER_DATE, | ||
88 | .major = DRIVER_MAJOR, | ||
89 | .minor = DRIVER_MINOR, | ||
90 | .patchlevel = DRIVER_PATCHLEVEL, | ||
118 | }; | 91 | }; |
119 | 92 | ||
120 | static int __init i830_init(void) | 93 | static int __init i830_init(void) |
diff --git a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h index bc4bd49fb0cc..bf9075b576bd 100644 --- a/drivers/char/drm/i830_drv.h +++ b/drivers/char/drm/i830_drv.h | |||
@@ -136,10 +136,12 @@ extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS); | |||
136 | extern void i830_driver_irq_preinstall(drm_device_t * dev); | 136 | extern void i830_driver_irq_preinstall(drm_device_t * dev); |
137 | extern void i830_driver_irq_postinstall(drm_device_t * dev); | 137 | extern void i830_driver_irq_postinstall(drm_device_t * dev); |
138 | extern void i830_driver_irq_uninstall(drm_device_t * dev); | 138 | extern void i830_driver_irq_uninstall(drm_device_t * dev); |
139 | extern void i830_driver_pretakedown(drm_device_t * dev); | 139 | extern int i830_driver_load(struct drm_device *, unsigned long flags); |
140 | extern void i830_driver_release(drm_device_t * dev, struct file *filp); | 140 | extern void i830_driver_preclose(drm_device_t * dev, DRMFILE filp); |
141 | extern void i830_driver_lastclose(drm_device_t * dev); | ||
142 | extern void i830_driver_reclaim_buffers_locked(drm_device_t * dev, | ||
143 | struct file *filp); | ||
141 | extern int i830_driver_dma_quiescent(drm_device_t * dev); | 144 | extern int i830_driver_dma_quiescent(drm_device_t * dev); |
142 | extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp); | ||
143 | extern int i830_driver_device_is_agp(drm_device_t * dev); | 145 | extern int i830_driver_device_is_agp(drm_device_t * dev); |
144 | 146 | ||
145 | #define I830_READ(reg) DRM_READ32(dev_priv->mmio_map, reg) | 147 | #define I830_READ(reg) DRM_READ32(dev_priv->mmio_map, reg) |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index f3aa0c370127..9140703da1ba 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- | 1 | /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | ||
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 4 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 5 | * All Rights Reserved. |
7 | * | 6 | * |
@@ -25,7 +24,7 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 26 | * |
28 | **************************************************************************/ | 27 | */ |
29 | 28 | ||
30 | #include "drmP.h" | 29 | #include "drmP.h" |
31 | #include "drm.h" | 30 | #include "drm.h" |
@@ -196,7 +195,7 @@ static int i915_initialize(drm_device_t * dev, | |||
196 | return 0; | 195 | return 0; |
197 | } | 196 | } |
198 | 197 | ||
199 | static int i915_resume(drm_device_t * dev) | 198 | static int i915_dma_resume(drm_device_t * dev) |
200 | { | 199 | { |
201 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 200 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
202 | 201 | ||
@@ -253,7 +252,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) | |||
253 | retcode = i915_dma_cleanup(dev); | 252 | retcode = i915_dma_cleanup(dev); |
254 | break; | 253 | break; |
255 | case I915_RESUME_DMA: | 254 | case I915_RESUME_DMA: |
256 | retcode = i915_resume(dev); | 255 | retcode = i915_dma_resume(dev); |
257 | break; | 256 | break; |
258 | default: | 257 | default: |
259 | retcode = -EINVAL; | 258 | retcode = -EINVAL; |
@@ -654,6 +653,9 @@ static int i915_getparam(DRM_IOCTL_ARGS) | |||
654 | case I915_PARAM_ALLOW_BATCHBUFFER: | 653 | case I915_PARAM_ALLOW_BATCHBUFFER: |
655 | value = dev_priv->allow_batchbuffer ? 1 : 0; | 654 | value = dev_priv->allow_batchbuffer ? 1 : 0; |
656 | break; | 655 | break; |
656 | case I915_PARAM_LAST_DISPATCH: | ||
657 | value = READ_BREADCRUMB(dev_priv); | ||
658 | break; | ||
657 | default: | 659 | default: |
658 | DRM_ERROR("Unkown parameter %d\n", param.param); | 660 | DRM_ERROR("Unkown parameter %d\n", param.param); |
659 | return DRM_ERR(EINVAL); | 661 | return DRM_ERR(EINVAL); |
@@ -699,7 +701,19 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
699 | return 0; | 701 | return 0; |
700 | } | 702 | } |
701 | 703 | ||
702 | void i915_driver_pretakedown(drm_device_t * dev) | 704 | int i915_driver_load(drm_device_t *dev, unsigned long flags) |
705 | { | ||
706 | /* i915 has 4 more counters */ | ||
707 | dev->counters += 4; | ||
708 | dev->types[6] = _DRM_STAT_IRQ; | ||
709 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
710 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
711 | dev->types[9] = _DRM_STAT_DMA; | ||
712 | |||
713 | return 0; | ||
714 | } | ||
715 | |||
716 | void i915_driver_lastclose(drm_device_t * dev) | ||
703 | { | 717 | { |
704 | if (dev->dev_private) { | 718 | if (dev->dev_private) { |
705 | drm_i915_private_t *dev_priv = dev->dev_private; | 719 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -708,7 +722,7 @@ void i915_driver_pretakedown(drm_device_t * dev) | |||
708 | i915_dma_cleanup(dev); | 722 | i915_dma_cleanup(dev); |
709 | } | 723 | } |
710 | 724 | ||
711 | void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp) | 725 | void i915_driver_preclose(drm_device_t * dev, DRMFILE filp) |
712 | { | 726 | { |
713 | if (dev->dev_private) { | 727 | if (dev->dev_private) { |
714 | drm_i915_private_t *dev_priv = dev->dev_private; | 728 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -717,18 +731,18 @@ void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp) | |||
717 | } | 731 | } |
718 | 732 | ||
719 | drm_ioctl_desc_t i915_ioctls[] = { | 733 | drm_ioctl_desc_t i915_ioctls[] = { |
720 | [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1}, | 734 | [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
721 | [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0}, | 735 | [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, DRM_AUTH}, |
722 | [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0}, | 736 | [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, DRM_AUTH}, |
723 | [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0}, | 737 | [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, DRM_AUTH}, |
724 | [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0}, | 738 | [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, DRM_AUTH}, |
725 | [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0}, | 739 | [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, DRM_AUTH}, |
726 | [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0}, | 740 | [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, DRM_AUTH}, |
727 | [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1}, | 741 | [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
728 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0}, | 742 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, DRM_AUTH}, |
729 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0}, | 743 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, |
730 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1}, | 744 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
731 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} | 745 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH} |
732 | }; | 746 | }; |
733 | 747 | ||
734 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); | 748 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); |
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h index 23e027d29080..77412ddac007 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /************************************************************************** | 1 | /* |
2 | * | ||
3 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 2 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
4 | * All Rights Reserved. | 3 | * All Rights Reserved. |
5 | * | 4 | * |
@@ -23,7 +22,7 @@ | |||
23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | * | 24 | * |
26 | **************************************************************************/ | 25 | */ |
27 | 26 | ||
28 | #ifndef _I915_DRM_H_ | 27 | #ifndef _I915_DRM_H_ |
29 | #define _I915_DRM_H_ | 28 | #define _I915_DRM_H_ |
@@ -152,6 +151,7 @@ typedef struct drm_i915_irq_wait { | |||
152 | */ | 151 | */ |
153 | #define I915_PARAM_IRQ_ACTIVE 1 | 152 | #define I915_PARAM_IRQ_ACTIVE 1 |
154 | #define I915_PARAM_ALLOW_BATCHBUFFER 2 | 153 | #define I915_PARAM_ALLOW_BATCHBUFFER 2 |
154 | #define I915_PARAM_LAST_DISPATCH 3 | ||
155 | 155 | ||
156 | typedef struct drm_i915_getparam { | 156 | typedef struct drm_i915_getparam { |
157 | int param; | 157 | int param; |
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c index 0508240f4e3b..8e2e6095c4b3 100644 --- a/drivers/char/drm/i915_drv.c +++ b/drivers/char/drm/i915_drv.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*- | 1 | /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | 4 | * |
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 6 | * All Rights Reserved. |
@@ -25,7 +25,7 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 27 | * |
28 | **************************************************************************/ | 28 | */ |
29 | 29 | ||
30 | #include "drmP.h" | 30 | #include "drmP.h" |
31 | #include "drm.h" | 31 | #include "drm.h" |
@@ -34,48 +34,22 @@ | |||
34 | 34 | ||
35 | #include "drm_pciids.h" | 35 | #include "drm_pciids.h" |
36 | 36 | ||
37 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
38 | { | ||
39 | dev->counters += 4; | ||
40 | dev->types[6] = _DRM_STAT_IRQ; | ||
41 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
42 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
43 | dev->types[9] = _DRM_STAT_DMA; | ||
44 | |||
45 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
46 | DRIVER_NAME, | ||
47 | DRIVER_MAJOR, | ||
48 | DRIVER_MINOR, | ||
49 | DRIVER_PATCHLEVEL, | ||
50 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
51 | ); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static int version(drm_version_t * version) | ||
56 | { | ||
57 | int len; | ||
58 | |||
59 | version->version_major = DRIVER_MAJOR; | ||
60 | version->version_minor = DRIVER_MINOR; | ||
61 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
62 | DRM_COPY(version->name, DRIVER_NAME); | ||
63 | DRM_COPY(version->date, DRIVER_DATE); | ||
64 | DRM_COPY(version->desc, DRIVER_DESC); | ||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static struct pci_device_id pciidlist[] = { | 37 | static struct pci_device_id pciidlist[] = { |
69 | i915_PCI_IDS | 38 | i915_PCI_IDS |
70 | }; | 39 | }; |
71 | 40 | ||
72 | static struct drm_driver driver = { | 41 | static struct drm_driver driver = { |
42 | /* don't use mtrr's here, the Xserver or user space app should | ||
43 | * deal with them for intel hardware. | ||
44 | */ | ||
73 | .driver_features = | 45 | .driver_features = |
74 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | | 46 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ |
75 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 47 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, |
76 | .pretakedown = i915_driver_pretakedown, | 48 | .load = i915_driver_load, |
77 | .prerelease = i915_driver_prerelease, | 49 | .lastclose = i915_driver_lastclose, |
50 | .preclose = i915_driver_preclose, | ||
78 | .device_is_agp = i915_driver_device_is_agp, | 51 | .device_is_agp = i915_driver_device_is_agp, |
52 | .vblank_wait = i915_driver_vblank_wait, | ||
79 | .irq_preinstall = i915_driver_irq_preinstall, | 53 | .irq_preinstall = i915_driver_irq_preinstall, |
80 | .irq_postinstall = i915_driver_irq_postinstall, | 54 | .irq_postinstall = i915_driver_irq_postinstall, |
81 | .irq_uninstall = i915_driver_irq_uninstall, | 55 | .irq_uninstall = i915_driver_irq_uninstall, |
@@ -83,8 +57,6 @@ static struct drm_driver driver = { | |||
83 | .reclaim_buffers = drm_core_reclaim_buffers, | 57 | .reclaim_buffers = drm_core_reclaim_buffers, |
84 | .get_map_ofs = drm_core_get_map_ofs, | 58 | .get_map_ofs = drm_core_get_map_ofs, |
85 | .get_reg_ofs = drm_core_get_reg_ofs, | 59 | .get_reg_ofs = drm_core_get_reg_ofs, |
86 | .postinit = postinit, | ||
87 | .version = version, | ||
88 | .ioctls = i915_ioctls, | 60 | .ioctls = i915_ioctls, |
89 | .fops = { | 61 | .fops = { |
90 | .owner = THIS_MODULE, | 62 | .owner = THIS_MODULE, |
@@ -97,11 +69,19 @@ static struct drm_driver driver = { | |||
97 | #ifdef CONFIG_COMPAT | 69 | #ifdef CONFIG_COMPAT |
98 | .compat_ioctl = i915_compat_ioctl, | 70 | .compat_ioctl = i915_compat_ioctl, |
99 | #endif | 71 | #endif |
100 | }, | 72 | }, |
73 | |||
101 | .pci_driver = { | 74 | .pci_driver = { |
102 | .name = DRIVER_NAME, | 75 | .name = DRIVER_NAME, |
103 | .id_table = pciidlist, | 76 | .id_table = pciidlist, |
104 | } | 77 | }, |
78 | |||
79 | .name = DRIVER_NAME, | ||
80 | .desc = DRIVER_DESC, | ||
81 | .date = DRIVER_DATE, | ||
82 | .major = DRIVER_MAJOR, | ||
83 | .minor = DRIVER_MINOR, | ||
84 | .patchlevel = DRIVER_PATCHLEVEL, | ||
105 | }; | 85 | }; |
106 | 86 | ||
107 | static int __init i915_init(void) | 87 | static int __init i915_init(void) |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index 17e457c73dc7..c6c71b45f101 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- | 1 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | 4 | * |
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 6 | * All Rights Reserved. |
@@ -25,7 +25,7 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 27 | * |
28 | **************************************************************************/ | 28 | */ |
29 | 29 | ||
30 | #ifndef _I915_DRV_H_ | 30 | #ifndef _I915_DRV_H_ |
31 | #define _I915_DRV_H_ | 31 | #define _I915_DRV_H_ |
@@ -37,21 +37,18 @@ | |||
37 | 37 | ||
38 | #define DRIVER_NAME "i915" | 38 | #define DRIVER_NAME "i915" |
39 | #define DRIVER_DESC "Intel Graphics" | 39 | #define DRIVER_DESC "Intel Graphics" |
40 | #define DRIVER_DATE "20040405" | 40 | #define DRIVER_DATE "20051209" |
41 | 41 | ||
42 | /* Interface history: | 42 | /* Interface history: |
43 | * | 43 | * |
44 | * 1.1: Original. | 44 | * 1.1: Original. |
45 | * 1.2: Add Power Management | ||
46 | * 1.3: Add vblank support | ||
45 | */ | 47 | */ |
46 | #define DRIVER_MAJOR 1 | 48 | #define DRIVER_MAJOR 1 |
47 | #define DRIVER_MINOR 1 | 49 | #define DRIVER_MINOR 3 |
48 | #define DRIVER_PATCHLEVEL 0 | 50 | #define DRIVER_PATCHLEVEL 0 |
49 | 51 | ||
50 | /* We use our own dma mechanisms, not the drm template code. However, | ||
51 | * the shared IRQ code is useful to us: | ||
52 | */ | ||
53 | #define __HAVE_PM 1 | ||
54 | |||
55 | typedef struct _drm_i915_ring_buffer { | 52 | typedef struct _drm_i915_ring_buffer { |
56 | int tail_mask; | 53 | int tail_mask; |
57 | unsigned long Start; | 54 | unsigned long Start; |
@@ -97,6 +94,7 @@ typedef struct drm_i915_private { | |||
97 | int tex_lru_log_granularity; | 94 | int tex_lru_log_granularity; |
98 | int allow_batchbuffer; | 95 | int allow_batchbuffer; |
99 | struct mem_block *agp_heap; | 96 | struct mem_block *agp_heap; |
97 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | ||
100 | } drm_i915_private_t; | 98 | } drm_i915_private_t; |
101 | 99 | ||
102 | extern drm_ioctl_desc_t i915_ioctls[]; | 100 | extern drm_ioctl_desc_t i915_ioctls[]; |
@@ -104,14 +102,18 @@ extern int i915_max_ioctl; | |||
104 | 102 | ||
105 | /* i915_dma.c */ | 103 | /* i915_dma.c */ |
106 | extern void i915_kernel_lost_context(drm_device_t * dev); | 104 | extern void i915_kernel_lost_context(drm_device_t * dev); |
107 | extern void i915_driver_pretakedown(drm_device_t * dev); | 105 | extern int i915_driver_load(struct drm_device *, unsigned long flags); |
108 | extern void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp); | 106 | extern void i915_driver_lastclose(drm_device_t * dev); |
107 | extern void i915_driver_preclose(drm_device_t * dev, DRMFILE filp); | ||
109 | extern int i915_driver_device_is_agp(drm_device_t * dev); | 108 | extern int i915_driver_device_is_agp(drm_device_t * dev); |
109 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, | ||
110 | unsigned long arg); | ||
110 | 111 | ||
111 | /* i915_irq.c */ | 112 | /* i915_irq.c */ |
112 | extern int i915_irq_emit(DRM_IOCTL_ARGS); | 113 | extern int i915_irq_emit(DRM_IOCTL_ARGS); |
113 | extern int i915_irq_wait(DRM_IOCTL_ARGS); | 114 | extern int i915_irq_wait(DRM_IOCTL_ARGS); |
114 | 115 | ||
116 | extern int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); | ||
115 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | 117 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); |
116 | extern void i915_driver_irq_preinstall(drm_device_t * dev); | 118 | extern void i915_driver_irq_preinstall(drm_device_t * dev); |
117 | extern void i915_driver_irq_postinstall(drm_device_t * dev); | 119 | extern void i915_driver_irq_postinstall(drm_device_t * dev); |
@@ -125,13 +127,10 @@ extern void i915_mem_takedown(struct mem_block **heap); | |||
125 | extern void i915_mem_release(drm_device_t * dev, | 127 | extern void i915_mem_release(drm_device_t * dev, |
126 | DRMFILE filp, struct mem_block *heap); | 128 | DRMFILE filp, struct mem_block *heap); |
127 | 129 | ||
128 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, | 130 | #define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg)) |
129 | unsigned long arg); | 131 | #define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val)) |
130 | 132 | #define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg)) | |
131 | #define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, reg) | 133 | #define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, (reg), (val)) |
132 | #define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, reg, val) | ||
133 | #define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, reg) | ||
134 | #define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, reg, val) | ||
135 | 134 | ||
136 | #define I915_VERBOSE 0 | 135 | #define I915_VERBOSE 0 |
137 | 136 | ||
@@ -195,6 +194,13 @@ extern int i915_wait_ring(drm_device_t * dev, int n, const char *caller); | |||
195 | #define PPCR 0x61204 | 194 | #define PPCR 0x61204 |
196 | #define PPCR_ON (1<<0) | 195 | #define PPCR_ON (1<<0) |
197 | 196 | ||
197 | #define DVOB 0x61140 | ||
198 | #define DVOB_ON (1<<31) | ||
199 | #define DVOC 0x61160 | ||
200 | #define DVOC_ON (1<<31) | ||
201 | #define LVDS 0x61180 | ||
202 | #define LVDS_ON (1<<31) | ||
203 | |||
198 | #define ADPA 0x61100 | 204 | #define ADPA 0x61100 |
199 | #define ADPA_DPMS_MASK (~(3<<10)) | 205 | #define ADPA_DPMS_MASK (~(3<<10)) |
200 | #define ADPA_DPMS_ON (0<<10) | 206 | #define ADPA_DPMS_ON (0<<10) |
@@ -258,4 +264,6 @@ extern int i915_wait_ring(drm_device_t * dev, int n, const char *caller); | |||
258 | 264 | ||
259 | #define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) | 265 | #define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) |
260 | 266 | ||
267 | #define READ_BREADCRUMB(dev_priv) (((u32 *)(dev_priv->hw_status_page))[5]) | ||
268 | |||
261 | #endif | 269 | #endif |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 4fa448ee846b..a1381c61aa63 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- | 1 | /* i915_irq.c -- IRQ support for the I915 -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | ||
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 4 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 5 | * All Rights Reserved. |
7 | * | 6 | * |
@@ -25,16 +24,18 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 26 | * |
28 | **************************************************************************/ | 27 | */ |
29 | 28 | ||
30 | #include "drmP.h" | 29 | #include "drmP.h" |
31 | #include "drm.h" | 30 | #include "drm.h" |
32 | #include "i915_drm.h" | 31 | #include "i915_drm.h" |
33 | #include "i915_drv.h" | 32 | #include "i915_drv.h" |
34 | 33 | ||
35 | #define USER_INT_FLAG 0x2 | 34 | #define USER_INT_FLAG (1<<1) |
35 | #define VSYNC_PIPEB_FLAG (1<<5) | ||
36 | #define VSYNC_PIPEA_FLAG (1<<7) | ||
37 | |||
36 | #define MAX_NOPID ((u32)~0) | 38 | #define MAX_NOPID ((u32)~0) |
37 | #define READ_BREADCRUMB(dev_priv) (((u32*)(dev_priv->hw_status_page))[5]) | ||
38 | 39 | ||
39 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 40 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
40 | { | 41 | { |
@@ -43,7 +44,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
43 | u16 temp; | 44 | u16 temp; |
44 | 45 | ||
45 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | 46 | temp = I915_READ16(I915REG_INT_IDENTITY_R); |
46 | temp &= USER_INT_FLAG; | 47 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG); |
47 | 48 | ||
48 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); | 49 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); |
49 | 50 | ||
@@ -51,7 +52,15 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
51 | return IRQ_NONE; | 52 | return IRQ_NONE; |
52 | 53 | ||
53 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | 54 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
54 | DRM_WAKEUP(&dev_priv->irq_queue); | 55 | |
56 | if (temp & USER_INT_FLAG) | ||
57 | DRM_WAKEUP(&dev_priv->irq_queue); | ||
58 | |||
59 | if (temp & VSYNC_PIPEA_FLAG) { | ||
60 | atomic_inc(&dev->vbl_received); | ||
61 | DRM_WAKEUP(&dev->vbl_queue); | ||
62 | drm_vbl_send_signals(dev); | ||
63 | } | ||
55 | 64 | ||
56 | return IRQ_HANDLED; | 65 | return IRQ_HANDLED; |
57 | } | 66 | } |
@@ -102,6 +111,27 @@ static int i915_wait_irq(drm_device_t * dev, int irq_nr) | |||
102 | return ret; | 111 | return ret; |
103 | } | 112 | } |
104 | 113 | ||
114 | int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) | ||
115 | { | ||
116 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
117 | unsigned int cur_vblank; | ||
118 | int ret = 0; | ||
119 | |||
120 | if (!dev_priv) { | ||
121 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | ||
122 | return DRM_ERR(EINVAL); | ||
123 | } | ||
124 | |||
125 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
126 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
127 | - *sequence) <= (1<<23))); | ||
128 | |||
129 | *sequence = cur_vblank; | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | |||
105 | /* Needs the lock as it touches the ring. | 135 | /* Needs the lock as it touches the ring. |
106 | */ | 136 | */ |
107 | int i915_irq_emit(DRM_IOCTL_ARGS) | 137 | int i915_irq_emit(DRM_IOCTL_ARGS) |
@@ -165,7 +195,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev) | |||
165 | { | 195 | { |
166 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 196 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
167 | 197 | ||
168 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG); | 198 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | VSYNC_PIPEA_FLAG); |
169 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 199 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
170 | } | 200 | } |
171 | 201 | ||
diff --git a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c index 13176d136a99..ba87ff17ff64 100644 --- a/drivers/char/drm/i915_mem.c +++ b/drivers/char/drm/i915_mem.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* i915_mem.c -- Simple agp/fb memory manager for i915 -*- linux-c -*- | 1 | /* i915_mem.c -- Simple agp/fb memory manager for i915 -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | ||
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 4 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 5 | * All Rights Reserved. |
7 | * | 6 | * |
@@ -25,7 +24,7 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 26 | * |
28 | **************************************************************************/ | 27 | */ |
29 | 28 | ||
30 | #include "drmP.h" | 29 | #include "drmP.h" |
31 | #include "drm.h" | 30 | #include "drm.h" |
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c index 70dc7f64b7b9..c2a4bac14521 100644 --- a/drivers/char/drm/mga_dma.c +++ b/drivers/char/drm/mga_dma.c | |||
@@ -44,7 +44,9 @@ | |||
44 | #define MGA_DEFAULT_USEC_TIMEOUT 10000 | 44 | #define MGA_DEFAULT_USEC_TIMEOUT 10000 |
45 | #define MGA_FREELIST_DEBUG 0 | 45 | #define MGA_FREELIST_DEBUG 0 |
46 | 46 | ||
47 | static int mga_do_cleanup_dma(drm_device_t * dev); | 47 | #define MINIMAL_CLEANUP 0 |
48 | #define FULL_CLEANUP 1 | ||
49 | static int mga_do_cleanup_dma(drm_device_t *dev, int full_cleanup); | ||
48 | 50 | ||
49 | /* ================================================================ | 51 | /* ================================================================ |
50 | * Engine control | 52 | * Engine control |
@@ -391,7 +393,7 @@ int mga_freelist_put(drm_device_t * dev, drm_buf_t * buf) | |||
391 | * DMA initialization, cleanup | 393 | * DMA initialization, cleanup |
392 | */ | 394 | */ |
393 | 395 | ||
394 | int mga_driver_preinit(drm_device_t * dev, unsigned long flags) | 396 | int mga_driver_load(drm_device_t * dev, unsigned long flags) |
395 | { | 397 | { |
396 | drm_mga_private_t *dev_priv; | 398 | drm_mga_private_t *dev_priv; |
397 | 399 | ||
@@ -405,6 +407,14 @@ int mga_driver_preinit(drm_device_t * dev, unsigned long flags) | |||
405 | dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; | 407 | dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; |
406 | dev_priv->chipset = flags; | 408 | dev_priv->chipset = flags; |
407 | 409 | ||
410 | dev_priv->mmio_base = drm_get_resource_start(dev, 1); | ||
411 | dev_priv->mmio_size = drm_get_resource_len(dev, 1); | ||
412 | |||
413 | dev->counters += 3; | ||
414 | dev->types[6] = _DRM_STAT_IRQ; | ||
415 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
416 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
417 | |||
408 | return 0; | 418 | return 0; |
409 | } | 419 | } |
410 | 420 | ||
@@ -438,17 +448,19 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
438 | drm_buf_desc_t req; | 448 | drm_buf_desc_t req; |
439 | drm_agp_mode_t mode; | 449 | drm_agp_mode_t mode; |
440 | drm_agp_info_t info; | 450 | drm_agp_info_t info; |
451 | drm_agp_buffer_t agp_req; | ||
452 | drm_agp_binding_t bind_req; | ||
441 | 453 | ||
442 | /* Acquire AGP. */ | 454 | /* Acquire AGP. */ |
443 | err = drm_agp_acquire(dev); | 455 | err = drm_agp_acquire(dev); |
444 | if (err) { | 456 | if (err) { |
445 | DRM_ERROR("Unable to acquire AGP\n"); | 457 | DRM_ERROR("Unable to acquire AGP: %d\n", err); |
446 | return err; | 458 | return err; |
447 | } | 459 | } |
448 | 460 | ||
449 | err = drm_agp_info(dev, &info); | 461 | err = drm_agp_info(dev, &info); |
450 | if (err) { | 462 | if (err) { |
451 | DRM_ERROR("Unable to get AGP info\n"); | 463 | DRM_ERROR("Unable to get AGP info: %d\n", err); |
452 | return err; | 464 | return err; |
453 | } | 465 | } |
454 | 466 | ||
@@ -472,18 +484,24 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
472 | } | 484 | } |
473 | 485 | ||
474 | /* Allocate and bind AGP memory. */ | 486 | /* Allocate and bind AGP memory. */ |
475 | dev_priv->agp_pages = agp_size / PAGE_SIZE; | 487 | agp_req.size = agp_size; |
476 | dev_priv->agp_mem = drm_alloc_agp(dev, dev_priv->agp_pages, 0); | 488 | agp_req.type = 0; |
477 | if (dev_priv->agp_mem == NULL) { | 489 | err = drm_agp_alloc(dev, &agp_req); |
478 | dev_priv->agp_pages = 0; | 490 | if (err) { |
491 | dev_priv->agp_size = 0; | ||
479 | DRM_ERROR("Unable to allocate %uMB AGP memory\n", | 492 | DRM_ERROR("Unable to allocate %uMB AGP memory\n", |
480 | dma_bs->agp_size); | 493 | dma_bs->agp_size); |
481 | return DRM_ERR(ENOMEM); | 494 | return err; |
482 | } | 495 | } |
496 | |||
497 | dev_priv->agp_size = agp_size; | ||
498 | dev_priv->agp_handle = agp_req.handle; | ||
483 | 499 | ||
484 | err = drm_bind_agp(dev_priv->agp_mem, 0); | 500 | bind_req.handle = agp_req.handle; |
501 | bind_req.offset = 0; | ||
502 | err = drm_agp_bind(dev, &bind_req); | ||
485 | if (err) { | 503 | if (err) { |
486 | DRM_ERROR("Unable to bind AGP memory\n"); | 504 | DRM_ERROR("Unable to bind AGP memory: %d\n", err); |
487 | return err; | 505 | return err; |
488 | } | 506 | } |
489 | 507 | ||
@@ -497,7 +515,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
497 | err = drm_addmap(dev, offset, warp_size, | 515 | err = drm_addmap(dev, offset, warp_size, |
498 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); | 516 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); |
499 | if (err) { | 517 | if (err) { |
500 | DRM_ERROR("Unable to map WARP microcode\n"); | 518 | DRM_ERROR("Unable to map WARP microcode: %d\n", err); |
501 | return err; | 519 | return err; |
502 | } | 520 | } |
503 | 521 | ||
@@ -505,7 +523,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
505 | err = drm_addmap(dev, offset, dma_bs->primary_size, | 523 | err = drm_addmap(dev, offset, dma_bs->primary_size, |
506 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->primary); | 524 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->primary); |
507 | if (err) { | 525 | if (err) { |
508 | DRM_ERROR("Unable to map primary DMA region\n"); | 526 | DRM_ERROR("Unable to map primary DMA region: %d\n", err); |
509 | return err; | 527 | return err; |
510 | } | 528 | } |
511 | 529 | ||
@@ -513,7 +531,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
513 | err = drm_addmap(dev, offset, secondary_size, | 531 | err = drm_addmap(dev, offset, secondary_size, |
514 | _DRM_AGP, 0, &dev->agp_buffer_map); | 532 | _DRM_AGP, 0, &dev->agp_buffer_map); |
515 | if (err) { | 533 | if (err) { |
516 | DRM_ERROR("Unable to map secondary DMA region\n"); | 534 | DRM_ERROR("Unable to map secondary DMA region: %d\n", err); |
517 | return err; | 535 | return err; |
518 | } | 536 | } |
519 | 537 | ||
@@ -525,15 +543,29 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
525 | 543 | ||
526 | err = drm_addbufs_agp(dev, &req); | 544 | err = drm_addbufs_agp(dev, &req); |
527 | if (err) { | 545 | if (err) { |
528 | DRM_ERROR("Unable to add secondary DMA buffers\n"); | 546 | DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err); |
529 | return err; | 547 | return err; |
530 | } | 548 | } |
531 | 549 | ||
550 | { | ||
551 | drm_map_list_t *_entry; | ||
552 | unsigned long agp_token = 0; | ||
553 | |||
554 | list_for_each_entry(_entry, &dev->maplist->head, head) { | ||
555 | if (_entry->map == dev->agp_buffer_map) | ||
556 | agp_token = _entry->user_token; | ||
557 | } | ||
558 | if (!agp_token) | ||
559 | return -EFAULT; | ||
560 | |||
561 | dev->agp_buffer_token = agp_token; | ||
562 | } | ||
563 | |||
532 | offset += secondary_size; | 564 | offset += secondary_size; |
533 | err = drm_addmap(dev, offset, agp_size - offset, | 565 | err = drm_addmap(dev, offset, agp_size - offset, |
534 | _DRM_AGP, 0, &dev_priv->agp_textures); | 566 | _DRM_AGP, 0, &dev_priv->agp_textures); |
535 | if (err) { | 567 | if (err) { |
536 | DRM_ERROR("Unable to map AGP texture region\n"); | 568 | DRM_ERROR("Unable to map AGP texture region %d\n", err); |
537 | return err; | 569 | return err; |
538 | } | 570 | } |
539 | 571 | ||
@@ -603,7 +635,8 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
603 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, | 635 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, |
604 | _DRM_READ_ONLY, &dev_priv->warp); | 636 | _DRM_READ_ONLY, &dev_priv->warp); |
605 | if (err != 0) { | 637 | if (err != 0) { |
606 | DRM_ERROR("Unable to create mapping for WARP microcode\n"); | 638 | DRM_ERROR("Unable to create mapping for WARP microcode: %d\n", |
639 | err); | ||
607 | return err; | 640 | return err; |
608 | } | 641 | } |
609 | 642 | ||
@@ -622,7 +655,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
622 | } | 655 | } |
623 | 656 | ||
624 | if (err != 0) { | 657 | if (err != 0) { |
625 | DRM_ERROR("Unable to allocate primary DMA region\n"); | 658 | DRM_ERROR("Unable to allocate primary DMA region: %d\n", err); |
626 | return DRM_ERR(ENOMEM); | 659 | return DRM_ERR(ENOMEM); |
627 | } | 660 | } |
628 | 661 | ||
@@ -646,7 +679,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
646 | } | 679 | } |
647 | 680 | ||
648 | if (bin_count == 0) { | 681 | if (bin_count == 0) { |
649 | DRM_ERROR("Unable to add secondary DMA buffers\n"); | 682 | DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err); |
650 | return err; | 683 | return err; |
651 | } | 684 | } |
652 | 685 | ||
@@ -682,7 +715,7 @@ static int mga_do_dma_bootstrap(drm_device_t * dev, | |||
682 | err = drm_addmap(dev, dev_priv->mmio_base, dev_priv->mmio_size, | 715 | err = drm_addmap(dev, dev_priv->mmio_base, dev_priv->mmio_size, |
683 | _DRM_REGISTERS, _DRM_READ_ONLY, &dev_priv->mmio); | 716 | _DRM_REGISTERS, _DRM_READ_ONLY, &dev_priv->mmio); |
684 | if (err) { | 717 | if (err) { |
685 | DRM_ERROR("Unable to map MMIO region\n"); | 718 | DRM_ERROR("Unable to map MMIO region: %d\n", err); |
686 | return err; | 719 | return err; |
687 | } | 720 | } |
688 | 721 | ||
@@ -690,7 +723,7 @@ static int mga_do_dma_bootstrap(drm_device_t * dev, | |||
690 | _DRM_READ_ONLY | _DRM_LOCKED | _DRM_KERNEL, | 723 | _DRM_READ_ONLY | _DRM_LOCKED | _DRM_KERNEL, |
691 | &dev_priv->status); | 724 | &dev_priv->status); |
692 | if (err) { | 725 | if (err) { |
693 | DRM_ERROR("Unable to map status region\n"); | 726 | DRM_ERROR("Unable to map status region: %d\n", err); |
694 | return err; | 727 | return err; |
695 | } | 728 | } |
696 | 729 | ||
@@ -708,7 +741,7 @@ static int mga_do_dma_bootstrap(drm_device_t * dev, | |||
708 | */ | 741 | */ |
709 | 742 | ||
710 | if (err) { | 743 | if (err) { |
711 | mga_do_cleanup_dma(dev); | 744 | mga_do_cleanup_dma(dev, MINIMAL_CLEANUP); |
712 | } | 745 | } |
713 | 746 | ||
714 | /* Not only do we want to try and initialized PCI cards for PCI DMA, | 747 | /* Not only do we want to try and initialized PCI cards for PCI DMA, |
@@ -731,35 +764,32 @@ int mga_dma_bootstrap(DRM_IOCTL_ARGS) | |||
731 | DRM_DEVICE; | 764 | DRM_DEVICE; |
732 | drm_mga_dma_bootstrap_t bootstrap; | 765 | drm_mga_dma_bootstrap_t bootstrap; |
733 | int err; | 766 | int err; |
767 | static const int modes[] = { 0, 1, 2, 2, 4, 4, 4, 4 }; | ||
768 | const drm_mga_private_t *const dev_priv = | ||
769 | (drm_mga_private_t *) dev->dev_private; | ||
734 | 770 | ||
735 | DRM_COPY_FROM_USER_IOCTL(bootstrap, | 771 | DRM_COPY_FROM_USER_IOCTL(bootstrap, |
736 | (drm_mga_dma_bootstrap_t __user *) data, | 772 | (drm_mga_dma_bootstrap_t __user *) data, |
737 | sizeof(bootstrap)); | 773 | sizeof(bootstrap)); |
738 | 774 | ||
739 | err = mga_do_dma_bootstrap(dev, &bootstrap); | 775 | err = mga_do_dma_bootstrap(dev, &bootstrap); |
740 | if (!err) { | 776 | if (err) { |
741 | static const int modes[] = { 0, 1, 2, 2, 4, 4, 4, 4 }; | 777 | mga_do_cleanup_dma(dev, FULL_CLEANUP); |
742 | const drm_mga_private_t *const dev_priv = | 778 | return err; |
743 | (drm_mga_private_t *) dev->dev_private; | 779 | } |
744 | |||
745 | if (dev_priv->agp_textures != NULL) { | ||
746 | bootstrap.texture_handle = | ||
747 | dev_priv->agp_textures->offset; | ||
748 | bootstrap.texture_size = dev_priv->agp_textures->size; | ||
749 | } else { | ||
750 | bootstrap.texture_handle = 0; | ||
751 | bootstrap.texture_size = 0; | ||
752 | } | ||
753 | 780 | ||
754 | bootstrap.agp_mode = modes[bootstrap.agp_mode & 0x07]; | 781 | if (dev_priv->agp_textures != NULL) { |
755 | if (DRM_COPY_TO_USER((void __user *)data, &bootstrap, | 782 | bootstrap.texture_handle = dev_priv->agp_textures->offset; |
756 | sizeof(bootstrap))) { | 783 | bootstrap.texture_size = dev_priv->agp_textures->size; |
757 | err = DRM_ERR(EFAULT); | ||
758 | } | ||
759 | } else { | 784 | } else { |
760 | mga_do_cleanup_dma(dev); | 785 | bootstrap.texture_handle = 0; |
786 | bootstrap.texture_size = 0; | ||
761 | } | 787 | } |
762 | 788 | ||
789 | bootstrap.agp_mode = modes[bootstrap.agp_mode & 0x07]; | ||
790 | DRM_COPY_TO_USER_IOCTL((drm_mga_dma_bootstrap_t __user *)data, | ||
791 | bootstrap, sizeof(bootstrap)); | ||
792 | |||
763 | return err; | 793 | return err; |
764 | } | 794 | } |
765 | 795 | ||
@@ -853,13 +883,13 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init) | |||
853 | 883 | ||
854 | ret = mga_warp_install_microcode(dev_priv); | 884 | ret = mga_warp_install_microcode(dev_priv); |
855 | if (ret < 0) { | 885 | if (ret < 0) { |
856 | DRM_ERROR("failed to install WARP ucode!\n"); | 886 | DRM_ERROR("failed to install WARP ucode!: %d\n", ret); |
857 | return ret; | 887 | return ret; |
858 | } | 888 | } |
859 | 889 | ||
860 | ret = mga_warp_init(dev_priv); | 890 | ret = mga_warp_init(dev_priv); |
861 | if (ret < 0) { | 891 | if (ret < 0) { |
862 | DRM_ERROR("failed to init WARP engine!\n"); | 892 | DRM_ERROR("failed to init WARP engine!: %d\n", ret); |
863 | return ret; | 893 | return ret; |
864 | } | 894 | } |
865 | 895 | ||
@@ -904,7 +934,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init) | |||
904 | return 0; | 934 | return 0; |
905 | } | 935 | } |
906 | 936 | ||
907 | static int mga_do_cleanup_dma(drm_device_t * dev) | 937 | static int mga_do_cleanup_dma(drm_device_t *dev, int full_cleanup) |
908 | { | 938 | { |
909 | int err = 0; | 939 | int err = 0; |
910 | DRM_DEBUG("\n"); | 940 | DRM_DEBUG("\n"); |
@@ -932,31 +962,39 @@ static int mga_do_cleanup_dma(drm_device_t * dev) | |||
932 | 962 | ||
933 | if (dev_priv->used_new_dma_init) { | 963 | if (dev_priv->used_new_dma_init) { |
934 | #if __OS_HAS_AGP | 964 | #if __OS_HAS_AGP |
935 | if (dev_priv->agp_mem != NULL) { | 965 | if (dev_priv->agp_handle != 0) { |
936 | dev_priv->agp_textures = NULL; | 966 | drm_agp_binding_t unbind_req; |
937 | drm_unbind_agp(dev_priv->agp_mem); | 967 | drm_agp_buffer_t free_req; |
968 | |||
969 | unbind_req.handle = dev_priv->agp_handle; | ||
970 | drm_agp_unbind(dev, &unbind_req); | ||
938 | 971 | ||
939 | drm_free_agp(dev_priv->agp_mem, | 972 | free_req.handle = dev_priv->agp_handle; |
940 | dev_priv->agp_pages); | 973 | drm_agp_free(dev, &free_req); |
941 | dev_priv->agp_pages = 0; | 974 | |
942 | dev_priv->agp_mem = NULL; | 975 | dev_priv->agp_textures = NULL; |
976 | dev_priv->agp_size = 0; | ||
977 | dev_priv->agp_handle = 0; | ||
943 | } | 978 | } |
944 | 979 | ||
945 | if ((dev->agp != NULL) && dev->agp->acquired) { | 980 | if ((dev->agp != NULL) && dev->agp->acquired) { |
946 | err = drm_agp_release(dev); | 981 | err = drm_agp_release(dev); |
947 | } | 982 | } |
948 | #endif | 983 | #endif |
949 | dev_priv->used_new_dma_init = 0; | ||
950 | } | 984 | } |
951 | 985 | ||
952 | dev_priv->warp = NULL; | 986 | dev_priv->warp = NULL; |
953 | dev_priv->primary = NULL; | 987 | dev_priv->primary = NULL; |
954 | dev_priv->mmio = NULL; | ||
955 | dev_priv->status = NULL; | ||
956 | dev_priv->sarea = NULL; | 988 | dev_priv->sarea = NULL; |
957 | dev_priv->sarea_priv = NULL; | 989 | dev_priv->sarea_priv = NULL; |
958 | dev->agp_buffer_map = NULL; | 990 | dev->agp_buffer_map = NULL; |
959 | 991 | ||
992 | if (full_cleanup) { | ||
993 | dev_priv->mmio = NULL; | ||
994 | dev_priv->status = NULL; | ||
995 | dev_priv->used_new_dma_init = 0; | ||
996 | } | ||
997 | |||
960 | memset(&dev_priv->prim, 0, sizeof(dev_priv->prim)); | 998 | memset(&dev_priv->prim, 0, sizeof(dev_priv->prim)); |
961 | dev_priv->warp_pipe = 0; | 999 | dev_priv->warp_pipe = 0; |
962 | memset(dev_priv->warp_pipe_phys, 0, | 1000 | memset(dev_priv->warp_pipe_phys, 0, |
@@ -967,7 +1005,7 @@ static int mga_do_cleanup_dma(drm_device_t * dev) | |||
967 | } | 1005 | } |
968 | } | 1006 | } |
969 | 1007 | ||
970 | return err; | 1008 | return 0; |
971 | } | 1009 | } |
972 | 1010 | ||
973 | int mga_dma_init(DRM_IOCTL_ARGS) | 1011 | int mga_dma_init(DRM_IOCTL_ARGS) |
@@ -985,11 +1023,11 @@ int mga_dma_init(DRM_IOCTL_ARGS) | |||
985 | case MGA_INIT_DMA: | 1023 | case MGA_INIT_DMA: |
986 | err = mga_do_init_dma(dev, &init); | 1024 | err = mga_do_init_dma(dev, &init); |
987 | if (err) { | 1025 | if (err) { |
988 | (void)mga_do_cleanup_dma(dev); | 1026 | (void)mga_do_cleanup_dma(dev, FULL_CLEANUP); |
989 | } | 1027 | } |
990 | return err; | 1028 | return err; |
991 | case MGA_CLEANUP_DMA: | 1029 | case MGA_CLEANUP_DMA: |
992 | return mga_do_cleanup_dma(dev); | 1030 | return mga_do_cleanup_dma(dev, FULL_CLEANUP); |
993 | } | 1031 | } |
994 | 1032 | ||
995 | return DRM_ERR(EINVAL); | 1033 | return DRM_ERR(EINVAL); |
@@ -1118,7 +1156,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS) | |||
1118 | /** | 1156 | /** |
1119 | * Called just before the module is unloaded. | 1157 | * Called just before the module is unloaded. |
1120 | */ | 1158 | */ |
1121 | int mga_driver_postcleanup(drm_device_t * dev) | 1159 | int mga_driver_unload(drm_device_t * dev) |
1122 | { | 1160 | { |
1123 | drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); | 1161 | drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); |
1124 | dev->dev_private = NULL; | 1162 | dev->dev_private = NULL; |
@@ -1129,9 +1167,9 @@ int mga_driver_postcleanup(drm_device_t * dev) | |||
1129 | /** | 1167 | /** |
1130 | * Called when the last opener of the device is closed. | 1168 | * Called when the last opener of the device is closed. |
1131 | */ | 1169 | */ |
1132 | void mga_driver_pretakedown(drm_device_t * dev) | 1170 | void mga_driver_lastclose(drm_device_t * dev) |
1133 | { | 1171 | { |
1134 | mga_do_cleanup_dma(dev); | 1172 | mga_do_cleanup_dma(dev, FULL_CLEANUP); |
1135 | } | 1173 | } |
1136 | 1174 | ||
1137 | int mga_driver_dma_quiescent(drm_device_t * dev) | 1175 | int mga_driver_dma_quiescent(drm_device_t * dev) |
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 1713451a5cc6..9f7ed0e0351b 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -38,41 +38,6 @@ | |||
38 | #include "drm_pciids.h" | 38 | #include "drm_pciids.h" |
39 | 39 | ||
40 | static int mga_driver_device_is_agp(drm_device_t * dev); | 40 | static int mga_driver_device_is_agp(drm_device_t * dev); |
41 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
42 | { | ||
43 | drm_mga_private_t *const dev_priv = | ||
44 | (drm_mga_private_t *) dev->dev_private; | ||
45 | |||
46 | dev_priv->mmio_base = pci_resource_start(dev->pdev, 1); | ||
47 | dev_priv->mmio_size = pci_resource_len(dev->pdev, 1); | ||
48 | |||
49 | dev->counters += 3; | ||
50 | dev->types[6] = _DRM_STAT_IRQ; | ||
51 | dev->types[7] = _DRM_STAT_PRIMARY; | ||
52 | dev->types[8] = _DRM_STAT_SECONDARY; | ||
53 | |||
54 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
55 | DRIVER_NAME, | ||
56 | DRIVER_MAJOR, | ||
57 | DRIVER_MINOR, | ||
58 | DRIVER_PATCHLEVEL, | ||
59 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
60 | ); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int version(drm_version_t * version) | ||
65 | { | ||
66 | int len; | ||
67 | |||
68 | version->version_major = DRIVER_MAJOR; | ||
69 | version->version_minor = DRIVER_MINOR; | ||
70 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
71 | DRM_COPY(version->name, DRIVER_NAME); | ||
72 | DRM_COPY(version->date, DRIVER_DATE); | ||
73 | DRM_COPY(version->desc, DRIVER_DESC); | ||
74 | return 0; | ||
75 | } | ||
76 | 41 | ||
77 | static struct pci_device_id pciidlist[] = { | 42 | static struct pci_device_id pciidlist[] = { |
78 | mga_PCI_IDS | 43 | mga_PCI_IDS |
@@ -80,12 +45,12 @@ static struct pci_device_id pciidlist[] = { | |||
80 | 45 | ||
81 | static struct drm_driver driver = { | 46 | static struct drm_driver driver = { |
82 | .driver_features = | 47 | .driver_features = |
83 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | | 48 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | |
84 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | | 49 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
85 | DRIVER_IRQ_VBL, | 50 | DRIVER_IRQ_VBL, |
86 | .preinit = mga_driver_preinit, | 51 | .load = mga_driver_load, |
87 | .postcleanup = mga_driver_postcleanup, | 52 | .unload = mga_driver_unload, |
88 | .pretakedown = mga_driver_pretakedown, | 53 | .lastclose = mga_driver_lastclose, |
89 | .dma_quiescent = mga_driver_dma_quiescent, | 54 | .dma_quiescent = mga_driver_dma_quiescent, |
90 | .device_is_agp = mga_driver_device_is_agp, | 55 | .device_is_agp = mga_driver_device_is_agp, |
91 | .vblank_wait = mga_driver_vblank_wait, | 56 | .vblank_wait = mga_driver_vblank_wait, |
@@ -96,8 +61,6 @@ static struct drm_driver driver = { | |||
96 | .reclaim_buffers = drm_core_reclaim_buffers, | 61 | .reclaim_buffers = drm_core_reclaim_buffers, |
97 | .get_map_ofs = drm_core_get_map_ofs, | 62 | .get_map_ofs = drm_core_get_map_ofs, |
98 | .get_reg_ofs = drm_core_get_reg_ofs, | 63 | .get_reg_ofs = drm_core_get_reg_ofs, |
99 | .postinit = postinit, | ||
100 | .version = version, | ||
101 | .ioctls = mga_ioctls, | 64 | .ioctls = mga_ioctls, |
102 | .dma_ioctl = mga_dma_buffers, | 65 | .dma_ioctl = mga_dma_buffers, |
103 | .fops = { | 66 | .fops = { |
@@ -113,9 +76,16 @@ static struct drm_driver driver = { | |||
113 | #endif | 76 | #endif |
114 | }, | 77 | }, |
115 | .pci_driver = { | 78 | .pci_driver = { |
116 | .name = DRIVER_NAME, | 79 | .name = DRIVER_NAME, |
117 | .id_table = pciidlist, | 80 | .id_table = pciidlist, |
118 | } | 81 | }, |
82 | |||
83 | .name = DRIVER_NAME, | ||
84 | .desc = DRIVER_DESC, | ||
85 | .date = DRIVER_DATE, | ||
86 | .major = DRIVER_MAJOR, | ||
87 | .minor = DRIVER_MINOR, | ||
88 | .patchlevel = DRIVER_PATCHLEVEL, | ||
119 | }; | 89 | }; |
120 | 90 | ||
121 | static int __init mga_init(void) | 91 | static int __init mga_init(void) |
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h index 461728e6a58a..6b0c53193506 100644 --- a/drivers/char/drm/mga_drv.h +++ b/drivers/char/drm/mga_drv.h | |||
@@ -38,11 +38,11 @@ | |||
38 | 38 | ||
39 | #define DRIVER_NAME "mga" | 39 | #define DRIVER_NAME "mga" |
40 | #define DRIVER_DESC "Matrox G200/G400" | 40 | #define DRIVER_DESC "Matrox G200/G400" |
41 | #define DRIVER_DATE "20050607" | 41 | #define DRIVER_DATE "20051102" |
42 | 42 | ||
43 | #define DRIVER_MAJOR 3 | 43 | #define DRIVER_MAJOR 3 |
44 | #define DRIVER_MINOR 2 | 44 | #define DRIVER_MINOR 2 |
45 | #define DRIVER_PATCHLEVEL 0 | 45 | #define DRIVER_PATCHLEVEL 1 |
46 | 46 | ||
47 | typedef struct drm_mga_primary_buffer { | 47 | typedef struct drm_mga_primary_buffer { |
48 | u8 *start; | 48 | u8 *start; |
@@ -144,22 +144,22 @@ typedef struct drm_mga_private { | |||
144 | drm_local_map_t *primary; | 144 | drm_local_map_t *primary; |
145 | drm_local_map_t *agp_textures; | 145 | drm_local_map_t *agp_textures; |
146 | 146 | ||
147 | DRM_AGP_MEM *agp_mem; | 147 | unsigned long agp_handle; |
148 | unsigned int agp_pages; | 148 | unsigned int agp_size; |
149 | } drm_mga_private_t; | 149 | } drm_mga_private_t; |
150 | 150 | ||
151 | extern drm_ioctl_desc_t mga_ioctls[]; | 151 | extern drm_ioctl_desc_t mga_ioctls[]; |
152 | extern int mga_max_ioctl; | 152 | extern int mga_max_ioctl; |
153 | 153 | ||
154 | /* mga_dma.c */ | 154 | /* mga_dma.c */ |
155 | extern int mga_driver_preinit(drm_device_t * dev, unsigned long flags); | ||
156 | extern int mga_dma_bootstrap(DRM_IOCTL_ARGS); | 155 | extern int mga_dma_bootstrap(DRM_IOCTL_ARGS); |
157 | extern int mga_dma_init(DRM_IOCTL_ARGS); | 156 | extern int mga_dma_init(DRM_IOCTL_ARGS); |
158 | extern int mga_dma_flush(DRM_IOCTL_ARGS); | 157 | extern int mga_dma_flush(DRM_IOCTL_ARGS); |
159 | extern int mga_dma_reset(DRM_IOCTL_ARGS); | 158 | extern int mga_dma_reset(DRM_IOCTL_ARGS); |
160 | extern int mga_dma_buffers(DRM_IOCTL_ARGS); | 159 | extern int mga_dma_buffers(DRM_IOCTL_ARGS); |
161 | extern int mga_driver_postcleanup(drm_device_t * dev); | 160 | extern int mga_driver_load(drm_device_t *dev, unsigned long flags); |
162 | extern void mga_driver_pretakedown(drm_device_t * dev); | 161 | extern int mga_driver_unload(drm_device_t * dev); |
162 | extern void mga_driver_lastclose(drm_device_t * dev); | ||
163 | extern int mga_driver_dma_quiescent(drm_device_t * dev); | 163 | extern int mga_driver_dma_quiescent(drm_device_t * dev); |
164 | 164 | ||
165 | extern int mga_do_wait_for_idle(drm_mga_private_t * dev_priv); | 165 | extern int mga_do_wait_for_idle(drm_mga_private_t * dev_priv); |
diff --git a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c index 47f54b5ae956..2837e669183a 100644 --- a/drivers/char/drm/mga_state.c +++ b/drivers/char/drm/mga_state.c | |||
@@ -1127,19 +1127,19 @@ static int mga_wait_fence(DRM_IOCTL_ARGS) | |||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | drm_ioctl_desc_t mga_ioctls[] = { | 1129 | drm_ioctl_desc_t mga_ioctls[] = { |
1130 | [DRM_IOCTL_NR(DRM_MGA_INIT)] = {mga_dma_init, 1, 1}, | 1130 | [DRM_IOCTL_NR(DRM_MGA_INIT)] = {mga_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1131 | [DRM_IOCTL_NR(DRM_MGA_FLUSH)] = {mga_dma_flush, 1, 0}, | 1131 | [DRM_IOCTL_NR(DRM_MGA_FLUSH)] = {mga_dma_flush, DRM_AUTH}, |
1132 | [DRM_IOCTL_NR(DRM_MGA_RESET)] = {mga_dma_reset, 1, 0}, | 1132 | [DRM_IOCTL_NR(DRM_MGA_RESET)] = {mga_dma_reset, DRM_AUTH}, |
1133 | [DRM_IOCTL_NR(DRM_MGA_SWAP)] = {mga_dma_swap, 1, 0}, | 1133 | [DRM_IOCTL_NR(DRM_MGA_SWAP)] = {mga_dma_swap, DRM_AUTH}, |
1134 | [DRM_IOCTL_NR(DRM_MGA_CLEAR)] = {mga_dma_clear, 1, 0}, | 1134 | [DRM_IOCTL_NR(DRM_MGA_CLEAR)] = {mga_dma_clear, DRM_AUTH}, |
1135 | [DRM_IOCTL_NR(DRM_MGA_VERTEX)] = {mga_dma_vertex, 1, 0}, | 1135 | [DRM_IOCTL_NR(DRM_MGA_VERTEX)] = {mga_dma_vertex, DRM_AUTH}, |
1136 | [DRM_IOCTL_NR(DRM_MGA_INDICES)] = {mga_dma_indices, 1, 0}, | 1136 | [DRM_IOCTL_NR(DRM_MGA_INDICES)] = {mga_dma_indices, DRM_AUTH}, |
1137 | [DRM_IOCTL_NR(DRM_MGA_ILOAD)] = {mga_dma_iload, 1, 0}, | 1137 | [DRM_IOCTL_NR(DRM_MGA_ILOAD)] = {mga_dma_iload, DRM_AUTH}, |
1138 | [DRM_IOCTL_NR(DRM_MGA_BLIT)] = {mga_dma_blit, 1, 0}, | 1138 | [DRM_IOCTL_NR(DRM_MGA_BLIT)] = {mga_dma_blit, DRM_AUTH}, |
1139 | [DRM_IOCTL_NR(DRM_MGA_GETPARAM)] = {mga_getparam, 1, 0}, | 1139 | [DRM_IOCTL_NR(DRM_MGA_GETPARAM)] = {mga_getparam, DRM_AUTH}, |
1140 | [DRM_IOCTL_NR(DRM_MGA_SET_FENCE)] = {mga_set_fence, 1, 0}, | 1140 | [DRM_IOCTL_NR(DRM_MGA_SET_FENCE)] = {mga_set_fence, DRM_AUTH}, |
1141 | [DRM_IOCTL_NR(DRM_MGA_WAIT_FENCE)] = {mga_wait_fence, 1, 0}, | 1141 | [DRM_IOCTL_NR(DRM_MGA_WAIT_FENCE)] = {mga_wait_fence, DRM_AUTH}, |
1142 | [DRM_IOCTL_NR(DRM_MGA_DMA_BOOTSTRAP)] = {mga_dma_bootstrap, 1, 1}, | 1142 | [DRM_IOCTL_NR(DRM_MGA_DMA_BOOTSTRAP)] = {mga_dma_bootstrap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1143 | }; | 1143 | }; |
1144 | 1144 | ||
1145 | int mga_max_ioctl = DRM_ARRAY_SIZE(mga_ioctls); | 1145 | int mga_max_ioctl = DRM_ARRAY_SIZE(mga_ioctls); |
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c index 7452753d4d01..db5a60450e68 100644 --- a/drivers/char/drm/r128_cce.c +++ b/drivers/char/drm/r128_cce.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- | 1 | /* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- |
2 | * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com | 2 | * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com |
3 | * | 3 | */ |
4 | /* | ||
4 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | 5 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 6 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
6 | * All Rights Reserved. | 7 | * All Rights Reserved. |
@@ -559,7 +560,8 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init) | |||
559 | if (dev_priv->is_pci) { | 560 | if (dev_priv->is_pci) { |
560 | #endif | 561 | #endif |
561 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; | 562 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; |
562 | dev_priv->gart_info.addr = dev_priv->gart_info.bus_addr = 0; | 563 | dev_priv->gart_info.addr = NULL; |
564 | dev_priv->gart_info.bus_addr = 0; | ||
563 | dev_priv->gart_info.is_pcie = 0; | 565 | dev_priv->gart_info.is_pcie = 0; |
564 | if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { | 566 | if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { |
565 | DRM_ERROR("failed to init PCI GART!\n"); | 567 | DRM_ERROR("failed to init PCI GART!\n"); |
@@ -601,15 +603,16 @@ int r128_do_cleanup_cce(drm_device_t * dev) | |||
601 | drm_core_ioremapfree(dev_priv->cce_ring, dev); | 603 | drm_core_ioremapfree(dev_priv->cce_ring, dev); |
602 | if (dev_priv->ring_rptr != NULL) | 604 | if (dev_priv->ring_rptr != NULL) |
603 | drm_core_ioremapfree(dev_priv->ring_rptr, dev); | 605 | drm_core_ioremapfree(dev_priv->ring_rptr, dev); |
604 | if (dev->agp_buffer_map != NULL) | 606 | if (dev->agp_buffer_map != NULL) { |
605 | drm_core_ioremapfree(dev->agp_buffer_map, dev); | 607 | drm_core_ioremapfree(dev->agp_buffer_map, dev); |
608 | dev->agp_buffer_map = NULL; | ||
609 | } | ||
606 | } else | 610 | } else |
607 | #endif | 611 | #endif |
608 | { | 612 | { |
609 | if (dev_priv->gart_info.bus_addr) | 613 | if (dev_priv->gart_info.bus_addr) |
610 | if (!drm_ati_pcigart_cleanup(dev, | 614 | if (!drm_ati_pcigart_cleanup(dev, |
611 | &dev_priv-> | 615 | &dev_priv->gart_info)) |
612 | gart_info)) | ||
613 | DRM_ERROR | 616 | DRM_ERROR |
614 | ("failed to cleanup PCI GART!\n"); | 617 | ("failed to cleanup PCI GART!\n"); |
615 | } | 618 | } |
diff --git a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h index 5ddc03202411..5d835b006f55 100644 --- a/drivers/char/drm/r128_drm.h +++ b/drivers/char/drm/r128_drm.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- | 1 | /* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- |
2 | * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com | 2 | * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com |
3 | * | 3 | */ |
4 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | 4 | /* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c index 1661e7351402..e20450ae220e 100644 --- a/drivers/char/drm/r128_drv.c +++ b/drivers/char/drm/r128_drv.c | |||
@@ -37,31 +37,6 @@ | |||
37 | 37 | ||
38 | #include "drm_pciids.h" | 38 | #include "drm_pciids.h" |
39 | 39 | ||
40 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
41 | { | ||
42 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
43 | DRIVER_NAME, | ||
44 | DRIVER_MAJOR, | ||
45 | DRIVER_MINOR, | ||
46 | DRIVER_PATCHLEVEL, | ||
47 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
48 | ); | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static int version(drm_version_t * version) | ||
53 | { | ||
54 | int len; | ||
55 | |||
56 | version->version_major = DRIVER_MAJOR; | ||
57 | version->version_minor = DRIVER_MINOR; | ||
58 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
59 | DRM_COPY(version->name, DRIVER_NAME); | ||
60 | DRM_COPY(version->date, DRIVER_DATE); | ||
61 | DRM_COPY(version->desc, DRIVER_DESC); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static struct pci_device_id pciidlist[] = { | 40 | static struct pci_device_id pciidlist[] = { |
66 | r128_PCI_IDS | 41 | r128_PCI_IDS |
67 | }; | 42 | }; |
@@ -72,8 +47,8 @@ static struct drm_driver driver = { | |||
72 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | | 47 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
73 | DRIVER_IRQ_VBL, | 48 | DRIVER_IRQ_VBL, |
74 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), | 49 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), |
75 | .prerelease = r128_driver_prerelease, | 50 | .preclose = r128_driver_preclose, |
76 | .pretakedown = r128_driver_pretakedown, | 51 | .lastclose = r128_driver_lastclose, |
77 | .vblank_wait = r128_driver_vblank_wait, | 52 | .vblank_wait = r128_driver_vblank_wait, |
78 | .irq_preinstall = r128_driver_irq_preinstall, | 53 | .irq_preinstall = r128_driver_irq_preinstall, |
79 | .irq_postinstall = r128_driver_irq_postinstall, | 54 | .irq_postinstall = r128_driver_irq_postinstall, |
@@ -82,8 +57,6 @@ static struct drm_driver driver = { | |||
82 | .reclaim_buffers = drm_core_reclaim_buffers, | 57 | .reclaim_buffers = drm_core_reclaim_buffers, |
83 | .get_map_ofs = drm_core_get_map_ofs, | 58 | .get_map_ofs = drm_core_get_map_ofs, |
84 | .get_reg_ofs = drm_core_get_reg_ofs, | 59 | .get_reg_ofs = drm_core_get_reg_ofs, |
85 | .postinit = postinit, | ||
86 | .version = version, | ||
87 | .ioctls = r128_ioctls, | 60 | .ioctls = r128_ioctls, |
88 | .dma_ioctl = r128_cce_buffers, | 61 | .dma_ioctl = r128_cce_buffers, |
89 | .fops = { | 62 | .fops = { |
@@ -97,12 +70,19 @@ static struct drm_driver driver = { | |||
97 | #ifdef CONFIG_COMPAT | 70 | #ifdef CONFIG_COMPAT |
98 | .compat_ioctl = r128_compat_ioctl, | 71 | .compat_ioctl = r128_compat_ioctl, |
99 | #endif | 72 | #endif |
100 | } | 73 | }, |
101 | , | 74 | |
102 | .pci_driver = { | 75 | .pci_driver = { |
103 | .name = DRIVER_NAME, | 76 | .name = DRIVER_NAME, |
104 | .id_table = pciidlist, | 77 | .id_table = pciidlist, |
105 | } | 78 | }, |
79 | |||
80 | .name = DRIVER_NAME, | ||
81 | .desc = DRIVER_DESC, | ||
82 | .date = DRIVER_DATE, | ||
83 | .major = DRIVER_MAJOR, | ||
84 | .minor = DRIVER_MINOR, | ||
85 | .patchlevel = DRIVER_PATCHLEVEL, | ||
106 | }; | 86 | }; |
107 | 87 | ||
108 | static int __init r128_init(void) | 88 | static int __init r128_init(void) |
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h index 5c79e40eb88f..94abffb2cca5 100644 --- a/drivers/char/drm/r128_drv.h +++ b/drivers/char/drm/r128_drv.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* r128_drv.h -- Private header for r128 driver -*- linux-c -*- | 1 | /* r128_drv.h -- Private header for r128 driver -*- linux-c -*- |
2 | * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com | 2 | * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com |
3 | * | 3 | */ |
4 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | 4 | /* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -154,8 +154,8 @@ extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); | |||
154 | extern void r128_driver_irq_preinstall(drm_device_t * dev); | 154 | extern void r128_driver_irq_preinstall(drm_device_t * dev); |
155 | extern void r128_driver_irq_postinstall(drm_device_t * dev); | 155 | extern void r128_driver_irq_postinstall(drm_device_t * dev); |
156 | extern void r128_driver_irq_uninstall(drm_device_t * dev); | 156 | extern void r128_driver_irq_uninstall(drm_device_t * dev); |
157 | extern void r128_driver_pretakedown(drm_device_t * dev); | 157 | extern void r128_driver_lastclose(drm_device_t * dev); |
158 | extern void r128_driver_prerelease(drm_device_t * dev, DRMFILE filp); | 158 | extern void r128_driver_preclose(drm_device_t * dev, DRMFILE filp); |
159 | 159 | ||
160 | extern long r128_compat_ioctl(struct file *filp, unsigned int cmd, | 160 | extern long r128_compat_ioctl(struct file *filp, unsigned int cmd, |
161 | unsigned long arg); | 161 | unsigned long arg); |
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c index 27eb0e31bd3b..87f8ca2b0685 100644 --- a/drivers/char/drm/r128_irq.c +++ b/drivers/char/drm/r128_irq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- | 1 | /* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- */ |
2 | * | 2 | /* |
3 | * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. | 3 | * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. |
4 | * | 4 | * |
5 | * The Weather Channel (TM) funded Tungsten Graphics to develop the | 5 | * The Weather Channel (TM) funded Tungsten Graphics to develop the |
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c index 14479cc08a57..caeecc2c36da 100644 --- a/drivers/char/drm/r128_state.c +++ b/drivers/char/drm/r128_state.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* r128_state.c -- State support for r128 -*- linux-c -*- | 1 | /* r128_state.c -- State support for r128 -*- linux-c -*- |
2 | * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com | 2 | * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com |
3 | * | 3 | */ |
4 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 4 | /* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. |
6 | * | 6 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
@@ -1674,7 +1674,7 @@ static int r128_getparam(DRM_IOCTL_ARGS) | |||
1674 | return 0; | 1674 | return 0; |
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | void r128_driver_prerelease(drm_device_t * dev, DRMFILE filp) | 1677 | void r128_driver_preclose(drm_device_t * dev, DRMFILE filp) |
1678 | { | 1678 | { |
1679 | if (dev->dev_private) { | 1679 | if (dev->dev_private) { |
1680 | drm_r128_private_t *dev_priv = dev->dev_private; | 1680 | drm_r128_private_t *dev_priv = dev->dev_private; |
@@ -1684,29 +1684,29 @@ void r128_driver_prerelease(drm_device_t * dev, DRMFILE filp) | |||
1684 | } | 1684 | } |
1685 | } | 1685 | } |
1686 | 1686 | ||
1687 | void r128_driver_pretakedown(drm_device_t * dev) | 1687 | void r128_driver_lastclose(drm_device_t * dev) |
1688 | { | 1688 | { |
1689 | r128_do_cleanup_cce(dev); | 1689 | r128_do_cleanup_cce(dev); |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | drm_ioctl_desc_t r128_ioctls[] = { | 1692 | drm_ioctl_desc_t r128_ioctls[] = { |
1693 | [DRM_IOCTL_NR(DRM_R128_INIT)] = {r128_cce_init, 1, 1}, | 1693 | [DRM_IOCTL_NR(DRM_R128_INIT)] = {r128_cce_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1694 | [DRM_IOCTL_NR(DRM_R128_CCE_START)] = {r128_cce_start, 1, 1}, | 1694 | [DRM_IOCTL_NR(DRM_R128_CCE_START)] = {r128_cce_start, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1695 | [DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = {r128_cce_stop, 1, 1}, | 1695 | [DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = {r128_cce_stop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1696 | [DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = {r128_cce_reset, 1, 1}, | 1696 | [DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = {r128_cce_reset, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1697 | [DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = {r128_cce_idle, 1, 0}, | 1697 | [DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = {r128_cce_idle, DRM_AUTH}, |
1698 | [DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, 1, 0}, | 1698 | [DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, DRM_AUTH}, |
1699 | [DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, 1, 0}, | 1699 | [DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, DRM_AUTH}, |
1700 | [DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, 1, 0}, | 1700 | [DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, DRM_AUTH}, |
1701 | [DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, 1, 0}, | 1701 | [DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, DRM_AUTH}, |
1702 | [DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, 1, 0}, | 1702 | [DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, DRM_AUTH}, |
1703 | [DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, 1, 0}, | 1703 | [DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, DRM_AUTH}, |
1704 | [DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, 1, 0}, | 1704 | [DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, DRM_AUTH}, |
1705 | [DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, 1, 0}, | 1705 | [DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, DRM_AUTH}, |
1706 | [DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, 1, 0}, | 1706 | [DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, DRM_AUTH}, |
1707 | [DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, 1, 0}, | 1707 | [DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, DRM_AUTH}, |
1708 | [DRM_IOCTL_NR(DRM_R128_INDIRECT)] = {r128_cce_indirect, 1, 1}, | 1708 | [DRM_IOCTL_NR(DRM_R128_INDIRECT)] = {r128_cce_indirect, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1709 | [DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, 1, 0}, | 1709 | [DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, DRM_AUTH}, |
1710 | }; | 1710 | }; |
1711 | 1711 | ||
1712 | int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls); | 1712 | int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls); |
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index 3a1ac5f78b43..291dbf4c8186 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -52,8 +52,8 @@ static const int r300_cliprect_cntl[4] = { | |||
52 | * Emit up to R300_SIMULTANEOUS_CLIPRECTS cliprects from the given command | 52 | * Emit up to R300_SIMULTANEOUS_CLIPRECTS cliprects from the given command |
53 | * buffer, starting with index n. | 53 | * buffer, starting with index n. |
54 | */ | 54 | */ |
55 | static int r300_emit_cliprects(drm_radeon_private_t * dev_priv, | 55 | static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, |
56 | drm_radeon_kcmd_buffer_t * cmdbuf, int n) | 56 | drm_radeon_kcmd_buffer_t *cmdbuf, int n) |
57 | { | 57 | { |
58 | drm_clip_rect_t box; | 58 | drm_clip_rect_t box; |
59 | int nr; | 59 | int nr; |
@@ -216,6 +216,7 @@ void r300_init_reg_flags(void) | |||
216 | ADD_RANGE(R300_TX_UNK1_0, 16); | 216 | ADD_RANGE(R300_TX_UNK1_0, 16); |
217 | ADD_RANGE(R300_TX_SIZE_0, 16); | 217 | ADD_RANGE(R300_TX_SIZE_0, 16); |
218 | ADD_RANGE(R300_TX_FORMAT_0, 16); | 218 | ADD_RANGE(R300_TX_FORMAT_0, 16); |
219 | ADD_RANGE(R300_TX_PITCH_0, 16); | ||
219 | /* Texture offset is dangerous and needs more checking */ | 220 | /* Texture offset is dangerous and needs more checking */ |
220 | ADD_RANGE_MARK(R300_TX_OFFSET_0, 16, MARK_CHECK_OFFSET); | 221 | ADD_RANGE_MARK(R300_TX_OFFSET_0, 16, MARK_CHECK_OFFSET); |
221 | ADD_RANGE(R300_TX_UNK4_0, 16); | 222 | ADD_RANGE(R300_TX_UNK4_0, 16); |
@@ -242,7 +243,7 @@ static __inline__ int r300_check_range(unsigned reg, int count) | |||
242 | 243 | ||
243 | /* we expect offsets passed to the framebuffer to be either within video memory or | 244 | /* we expect offsets passed to the framebuffer to be either within video memory or |
244 | within AGP space */ | 245 | within AGP space */ |
245 | static __inline__ int r300_check_offset(drm_radeon_private_t * dev_priv, | 246 | static __inline__ int r300_check_offset(drm_radeon_private_t *dev_priv, |
246 | u32 offset) | 247 | u32 offset) |
247 | { | 248 | { |
248 | /* we realy want to check against end of video aperture | 249 | /* we realy want to check against end of video aperture |
@@ -317,8 +318,8 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * | |||
317 | * | 318 | * |
318 | * Note that checks are performed on contents and addresses of the registers | 319 | * Note that checks are performed on contents and addresses of the registers |
319 | */ | 320 | */ |
320 | static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv, | 321 | static __inline__ int r300_emit_packet0(drm_radeon_private_t *dev_priv, |
321 | drm_radeon_kcmd_buffer_t * cmdbuf, | 322 | drm_radeon_kcmd_buffer_t *cmdbuf, |
322 | drm_r300_cmd_header_t header) | 323 | drm_r300_cmd_header_t header) |
323 | { | 324 | { |
324 | int reg; | 325 | int reg; |
@@ -363,8 +364,8 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv, | |||
363 | * the graphics card. | 364 | * the graphics card. |
364 | * Called by r300_do_cp_cmdbuf. | 365 | * Called by r300_do_cp_cmdbuf. |
365 | */ | 366 | */ |
366 | static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv, | 367 | static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv, |
367 | drm_radeon_kcmd_buffer_t * cmdbuf, | 368 | drm_radeon_kcmd_buffer_t *cmdbuf, |
368 | drm_r300_cmd_header_t header) | 369 | drm_r300_cmd_header_t header) |
369 | { | 370 | { |
370 | int sz; | 371 | int sz; |
@@ -400,8 +401,8 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv, | |||
400 | * Emit a clear packet from userspace. | 401 | * Emit a clear packet from userspace. |
401 | * Called by r300_emit_packet3. | 402 | * Called by r300_emit_packet3. |
402 | */ | 403 | */ |
403 | static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv, | 404 | static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv, |
404 | drm_radeon_kcmd_buffer_t * cmdbuf) | 405 | drm_radeon_kcmd_buffer_t *cmdbuf) |
405 | { | 406 | { |
406 | RING_LOCALS; | 407 | RING_LOCALS; |
407 | 408 | ||
@@ -421,8 +422,8 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv, | |||
421 | return 0; | 422 | return 0; |
422 | } | 423 | } |
423 | 424 | ||
424 | static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv, | 425 | static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, |
425 | drm_radeon_kcmd_buffer_t * cmdbuf, | 426 | drm_radeon_kcmd_buffer_t *cmdbuf, |
426 | u32 header) | 427 | u32 header) |
427 | { | 428 | { |
428 | int count, i, k; | 429 | int count, i, k; |
@@ -489,8 +490,8 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv, | |||
489 | return 0; | 490 | return 0; |
490 | } | 491 | } |
491 | 492 | ||
492 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv, | 493 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, |
493 | drm_radeon_kcmd_buffer_t * cmdbuf) | 494 | drm_radeon_kcmd_buffer_t *cmdbuf) |
494 | { | 495 | { |
495 | u32 header; | 496 | u32 header; |
496 | int count; | 497 | int count; |
@@ -554,8 +555,8 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv, | |||
554 | * Emit a rendering packet3 from userspace. | 555 | * Emit a rendering packet3 from userspace. |
555 | * Called by r300_do_cp_cmdbuf. | 556 | * Called by r300_do_cp_cmdbuf. |
556 | */ | 557 | */ |
557 | static __inline__ int r300_emit_packet3(drm_radeon_private_t * dev_priv, | 558 | static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv, |
558 | drm_radeon_kcmd_buffer_t * cmdbuf, | 559 | drm_radeon_kcmd_buffer_t *cmdbuf, |
559 | drm_r300_cmd_header_t header) | 560 | drm_r300_cmd_header_t header) |
560 | { | 561 | { |
561 | int n; | 562 | int n; |
@@ -623,7 +624,7 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t * dev_priv, | |||
623 | /** | 624 | /** |
624 | * Emit the sequence to pacify R300. | 625 | * Emit the sequence to pacify R300. |
625 | */ | 626 | */ |
626 | static __inline__ void r300_pacify(drm_radeon_private_t * dev_priv) | 627 | static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) |
627 | { | 628 | { |
628 | RING_LOCALS; | 629 | RING_LOCALS; |
629 | 630 | ||
@@ -657,9 +658,10 @@ static void r300_discard_buffer(drm_device_t * dev, drm_buf_t * buf) | |||
657 | * commands on the DMA ring buffer. | 658 | * commands on the DMA ring buffer. |
658 | * Called by the ioctl handler function radeon_cp_cmdbuf. | 659 | * Called by the ioctl handler function radeon_cp_cmdbuf. |
659 | */ | 660 | */ |
660 | int r300_do_cp_cmdbuf(drm_device_t * dev, | 661 | int r300_do_cp_cmdbuf(drm_device_t *dev, |
661 | DRMFILE filp, | 662 | DRMFILE filp, |
662 | drm_file_t * filp_priv, drm_radeon_kcmd_buffer_t * cmdbuf) | 663 | drm_file_t *filp_priv, |
664 | drm_radeon_kcmd_buffer_t *cmdbuf) | ||
663 | { | 665 | { |
664 | drm_radeon_private_t *dev_priv = dev->dev_private; | 666 | drm_radeon_private_t *dev_priv = dev->dev_private; |
665 | drm_device_dma_t *dma = dev->dma; | 667 | drm_device_dma_t *dma = dev->dma; |
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h index e5b73c002394..a0ed20e25221 100644 --- a/drivers/char/drm/r300_reg.h +++ b/drivers/char/drm/r300_reg.h | |||
@@ -797,6 +797,7 @@ I am fairly certain that they are correct unless stated otherwise in comments. | |||
797 | 797 | ||
798 | # define R300_TX_FORMAT_YUV_MODE 0x00800000 | 798 | # define R300_TX_FORMAT_YUV_MODE 0x00800000 |
799 | 799 | ||
800 | #define R300_TX_PITCH_0 0x4500 | ||
800 | #define R300_TX_OFFSET_0 0x4540 | 801 | #define R300_TX_OFFSET_0 0x4540 |
801 | /* BEGIN: Guess from R200 */ | 802 | /* BEGIN: Guess from R200 */ |
802 | # define R300_TXO_ENDIAN_NO_SWAP (0 << 0) | 803 | # define R300_TXO_ENDIAN_NO_SWAP (0 << 0) |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 342302d46743..915665c7fe7c 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* radeon_cp.c -- CP support for Radeon -*- linux-c -*- | 1 | /* radeon_cp.c -- CP support for Radeon -*- linux-c -*- */ |
2 | * | 2 | /* |
3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | 3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | 4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. |
@@ -824,7 +824,7 @@ static int RADEON_READ_PLL(drm_device_t * dev, int addr) | |||
824 | return RADEON_READ(RADEON_CLOCK_CNTL_DATA); | 824 | return RADEON_READ(RADEON_CLOCK_CNTL_DATA); |
825 | } | 825 | } |
826 | 826 | ||
827 | static int RADEON_READ_PCIE(drm_radeon_private_t * dev_priv, int addr) | 827 | static int RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr) |
828 | { | 828 | { |
829 | RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff); | 829 | RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff); |
830 | return RADEON_READ(RADEON_PCIE_DATA); | 830 | return RADEON_READ(RADEON_PCIE_DATA); |
@@ -1125,7 +1125,7 @@ static void radeon_cp_init_ring_buffer(drm_device_t * dev, | |||
1125 | | (dev_priv->fb_location >> 16)); | 1125 | | (dev_priv->fb_location >> 16)); |
1126 | 1126 | ||
1127 | #if __OS_HAS_AGP | 1127 | #if __OS_HAS_AGP |
1128 | if (!dev_priv->is_pci) { | 1128 | if (dev_priv->flags & CHIP_IS_AGP) { |
1129 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, | 1129 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, |
1130 | (((dev_priv->gart_vm_start - 1 + | 1130 | (((dev_priv->gart_vm_start - 1 + |
1131 | dev_priv->gart_size) & 0xffff0000) | | 1131 | dev_priv->gart_size) & 0xffff0000) | |
@@ -1152,7 +1152,7 @@ static void radeon_cp_init_ring_buffer(drm_device_t * dev, | |||
1152 | dev_priv->ring.tail = cur_read_ptr; | 1152 | dev_priv->ring.tail = cur_read_ptr; |
1153 | 1153 | ||
1154 | #if __OS_HAS_AGP | 1154 | #if __OS_HAS_AGP |
1155 | if (!dev_priv->is_pci) { | 1155 | if (dev_priv->flags & CHIP_IS_AGP) { |
1156 | /* set RADEON_AGP_BASE here instead of relying on X from user space */ | 1156 | /* set RADEON_AGP_BASE here instead of relying on X from user space */ |
1157 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base); | 1157 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base); |
1158 | RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR, | 1158 | RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR, |
@@ -1278,13 +1278,15 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on) | |||
1278 | /* Enable or disable PCI GART on the chip */ | 1278 | /* Enable or disable PCI GART on the chip */ |
1279 | static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) | 1279 | static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) |
1280 | { | 1280 | { |
1281 | u32 tmp = RADEON_READ(RADEON_AIC_CNTL); | 1281 | u32 tmp; |
1282 | 1282 | ||
1283 | if (dev_priv->flags & CHIP_IS_PCIE) { | 1283 | if (dev_priv->flags & CHIP_IS_PCIE) { |
1284 | radeon_set_pciegart(dev_priv, on); | 1284 | radeon_set_pciegart(dev_priv, on); |
1285 | return; | 1285 | return; |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | tmp = RADEON_READ(RADEON_AIC_CNTL); | ||
1289 | |||
1288 | if (on) { | 1290 | if (on) { |
1289 | RADEON_WRITE(RADEON_AIC_CNTL, | 1291 | RADEON_WRITE(RADEON_AIC_CNTL, |
1290 | tmp | RADEON_PCIGART_TRANSLATE_EN); | 1292 | tmp | RADEON_PCIGART_TRANSLATE_EN); |
@@ -1312,13 +1314,17 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) | |||
1312 | static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | 1314 | static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) |
1313 | { | 1315 | { |
1314 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1316 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1317 | |||
1315 | DRM_DEBUG("\n"); | 1318 | DRM_DEBUG("\n"); |
1316 | 1319 | ||
1317 | dev_priv->is_pci = init->is_pci; | 1320 | if (init->is_pci && (dev_priv->flags & CHIP_IS_AGP)) |
1321 | { | ||
1322 | DRM_DEBUG("Forcing AGP card to PCI mode\n"); | ||
1323 | dev_priv->flags &= ~CHIP_IS_AGP; | ||
1324 | } | ||
1318 | 1325 | ||
1319 | if (dev_priv->is_pci && !dev->sg) { | 1326 | if ((!(dev_priv->flags & CHIP_IS_AGP)) && !dev->sg) { |
1320 | DRM_ERROR("PCI GART memory not allocated!\n"); | 1327 | DRM_ERROR("PCI GART memory not allocated!\n"); |
1321 | dev->dev_private = (void *)dev_priv; | ||
1322 | radeon_do_cleanup_cp(dev); | 1328 | radeon_do_cleanup_cp(dev); |
1323 | return DRM_ERR(EINVAL); | 1329 | return DRM_ERR(EINVAL); |
1324 | } | 1330 | } |
@@ -1327,12 +1333,11 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1327 | if (dev_priv->usec_timeout < 1 || | 1333 | if (dev_priv->usec_timeout < 1 || |
1328 | dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) { | 1334 | dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) { |
1329 | DRM_DEBUG("TIMEOUT problem!\n"); | 1335 | DRM_DEBUG("TIMEOUT problem!\n"); |
1330 | dev->dev_private = (void *)dev_priv; | ||
1331 | radeon_do_cleanup_cp(dev); | 1336 | radeon_do_cleanup_cp(dev); |
1332 | return DRM_ERR(EINVAL); | 1337 | return DRM_ERR(EINVAL); |
1333 | } | 1338 | } |
1334 | 1339 | ||
1335 | switch (init->func) { | 1340 | switch(init->func) { |
1336 | case RADEON_INIT_R200_CP: | 1341 | case RADEON_INIT_R200_CP: |
1337 | dev_priv->microcode_version = UCODE_R200; | 1342 | dev_priv->microcode_version = UCODE_R200; |
1338 | break; | 1343 | break; |
@@ -1353,7 +1358,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1353 | if ((init->cp_mode != RADEON_CSQ_PRIBM_INDDIS) && | 1358 | if ((init->cp_mode != RADEON_CSQ_PRIBM_INDDIS) && |
1354 | (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) { | 1359 | (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) { |
1355 | DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode); | 1360 | DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode); |
1356 | dev->dev_private = (void *)dev_priv; | ||
1357 | radeon_do_cleanup_cp(dev); | 1361 | radeon_do_cleanup_cp(dev); |
1358 | return DRM_ERR(EINVAL); | 1362 | return DRM_ERR(EINVAL); |
1359 | } | 1363 | } |
@@ -1416,8 +1420,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1416 | 1420 | ||
1417 | DRM_GETSAREA(); | 1421 | DRM_GETSAREA(); |
1418 | 1422 | ||
1419 | dev_priv->fb_offset = init->fb_offset; | ||
1420 | dev_priv->mmio_offset = init->mmio_offset; | ||
1421 | dev_priv->ring_offset = init->ring_offset; | 1423 | dev_priv->ring_offset = init->ring_offset; |
1422 | dev_priv->ring_rptr_offset = init->ring_rptr_offset; | 1424 | dev_priv->ring_rptr_offset = init->ring_rptr_offset; |
1423 | dev_priv->buffers_offset = init->buffers_offset; | 1425 | dev_priv->buffers_offset = init->buffers_offset; |
@@ -1425,29 +1427,19 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1425 | 1427 | ||
1426 | if (!dev_priv->sarea) { | 1428 | if (!dev_priv->sarea) { |
1427 | DRM_ERROR("could not find sarea!\n"); | 1429 | DRM_ERROR("could not find sarea!\n"); |
1428 | dev->dev_private = (void *)dev_priv; | ||
1429 | radeon_do_cleanup_cp(dev); | 1430 | radeon_do_cleanup_cp(dev); |
1430 | return DRM_ERR(EINVAL); | 1431 | return DRM_ERR(EINVAL); |
1431 | } | 1432 | } |
1432 | 1433 | ||
1433 | dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); | ||
1434 | if (!dev_priv->mmio) { | ||
1435 | DRM_ERROR("could not find mmio region!\n"); | ||
1436 | dev->dev_private = (void *)dev_priv; | ||
1437 | radeon_do_cleanup_cp(dev); | ||
1438 | return DRM_ERR(EINVAL); | ||
1439 | } | ||
1440 | dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); | 1434 | dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); |
1441 | if (!dev_priv->cp_ring) { | 1435 | if (!dev_priv->cp_ring) { |
1442 | DRM_ERROR("could not find cp ring region!\n"); | 1436 | DRM_ERROR("could not find cp ring region!\n"); |
1443 | dev->dev_private = (void *)dev_priv; | ||
1444 | radeon_do_cleanup_cp(dev); | 1437 | radeon_do_cleanup_cp(dev); |
1445 | return DRM_ERR(EINVAL); | 1438 | return DRM_ERR(EINVAL); |
1446 | } | 1439 | } |
1447 | dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); | 1440 | dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); |
1448 | if (!dev_priv->ring_rptr) { | 1441 | if (!dev_priv->ring_rptr) { |
1449 | DRM_ERROR("could not find ring read pointer!\n"); | 1442 | DRM_ERROR("could not find ring read pointer!\n"); |
1450 | dev->dev_private = (void *)dev_priv; | ||
1451 | radeon_do_cleanup_cp(dev); | 1443 | radeon_do_cleanup_cp(dev); |
1452 | return DRM_ERR(EINVAL); | 1444 | return DRM_ERR(EINVAL); |
1453 | } | 1445 | } |
@@ -1455,7 +1447,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1455 | dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); | 1447 | dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); |
1456 | if (!dev->agp_buffer_map) { | 1448 | if (!dev->agp_buffer_map) { |
1457 | DRM_ERROR("could not find dma buffer region!\n"); | 1449 | DRM_ERROR("could not find dma buffer region!\n"); |
1458 | dev->dev_private = (void *)dev_priv; | ||
1459 | radeon_do_cleanup_cp(dev); | 1450 | radeon_do_cleanup_cp(dev); |
1460 | return DRM_ERR(EINVAL); | 1451 | return DRM_ERR(EINVAL); |
1461 | } | 1452 | } |
@@ -1465,7 +1456,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1465 | drm_core_findmap(dev, init->gart_textures_offset); | 1456 | drm_core_findmap(dev, init->gart_textures_offset); |
1466 | if (!dev_priv->gart_textures) { | 1457 | if (!dev_priv->gart_textures) { |
1467 | DRM_ERROR("could not find GART texture region!\n"); | 1458 | DRM_ERROR("could not find GART texture region!\n"); |
1468 | dev->dev_private = (void *)dev_priv; | ||
1469 | radeon_do_cleanup_cp(dev); | 1459 | radeon_do_cleanup_cp(dev); |
1470 | return DRM_ERR(EINVAL); | 1460 | return DRM_ERR(EINVAL); |
1471 | } | 1461 | } |
@@ -1476,7 +1466,7 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1476 | init->sarea_priv_offset); | 1466 | init->sarea_priv_offset); |
1477 | 1467 | ||
1478 | #if __OS_HAS_AGP | 1468 | #if __OS_HAS_AGP |
1479 | if (!dev_priv->is_pci) { | 1469 | if (dev_priv->flags & CHIP_IS_AGP) { |
1480 | drm_core_ioremap(dev_priv->cp_ring, dev); | 1470 | drm_core_ioremap(dev_priv->cp_ring, dev); |
1481 | drm_core_ioremap(dev_priv->ring_rptr, dev); | 1471 | drm_core_ioremap(dev_priv->ring_rptr, dev); |
1482 | drm_core_ioremap(dev->agp_buffer_map, dev); | 1472 | drm_core_ioremap(dev->agp_buffer_map, dev); |
@@ -1484,7 +1474,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1484 | !dev_priv->ring_rptr->handle || | 1474 | !dev_priv->ring_rptr->handle || |
1485 | !dev->agp_buffer_map->handle) { | 1475 | !dev->agp_buffer_map->handle) { |
1486 | DRM_ERROR("could not find ioremap agp regions!\n"); | 1476 | DRM_ERROR("could not find ioremap agp regions!\n"); |
1487 | dev->dev_private = (void *)dev_priv; | ||
1488 | radeon_do_cleanup_cp(dev); | 1477 | radeon_do_cleanup_cp(dev); |
1489 | return DRM_ERR(EINVAL); | 1478 | return DRM_ERR(EINVAL); |
1490 | } | 1479 | } |
@@ -1525,7 +1514,7 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1525 | + RADEON_READ(RADEON_CONFIG_APER_SIZE); | 1514 | + RADEON_READ(RADEON_CONFIG_APER_SIZE); |
1526 | 1515 | ||
1527 | #if __OS_HAS_AGP | 1516 | #if __OS_HAS_AGP |
1528 | if (!dev_priv->is_pci) | 1517 | if (dev_priv->flags & CHIP_IS_AGP) |
1529 | dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset | 1518 | dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset |
1530 | - dev->agp->base | 1519 | - dev->agp->base |
1531 | + dev_priv->gart_vm_start); | 1520 | + dev_priv->gart_vm_start); |
@@ -1551,7 +1540,7 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1551 | dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; | 1540 | dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; |
1552 | 1541 | ||
1553 | #if __OS_HAS_AGP | 1542 | #if __OS_HAS_AGP |
1554 | if (!dev_priv->is_pci) { | 1543 | if (dev_priv->flags & CHIP_IS_AGP) { |
1555 | /* Turn off PCI GART */ | 1544 | /* Turn off PCI GART */ |
1556 | radeon_set_pcigart(dev_priv, 0); | 1545 | radeon_set_pcigart(dev_priv, 0); |
1557 | } else | 1546 | } else |
@@ -1561,25 +1550,28 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1561 | if (dev_priv->pcigart_offset) { | 1550 | if (dev_priv->pcigart_offset) { |
1562 | dev_priv->gart_info.bus_addr = | 1551 | dev_priv->gart_info.bus_addr = |
1563 | dev_priv->pcigart_offset + dev_priv->fb_location; | 1552 | dev_priv->pcigart_offset + dev_priv->fb_location; |
1553 | dev_priv->gart_info.mapping.offset = | ||
1554 | dev_priv->gart_info.bus_addr; | ||
1555 | dev_priv->gart_info.mapping.size = | ||
1556 | RADEON_PCIGART_TABLE_SIZE; | ||
1557 | |||
1558 | drm_core_ioremap(&dev_priv->gart_info.mapping, dev); | ||
1564 | dev_priv->gart_info.addr = | 1559 | dev_priv->gart_info.addr = |
1565 | (unsigned long)drm_ioremap(dev_priv->gart_info. | 1560 | dev_priv->gart_info.mapping.handle; |
1566 | bus_addr, | ||
1567 | RADEON_PCIGART_TABLE_SIZE, | ||
1568 | dev); | ||
1569 | 1561 | ||
1570 | dev_priv->gart_info.is_pcie = | 1562 | dev_priv->gart_info.is_pcie = |
1571 | !!(dev_priv->flags & CHIP_IS_PCIE); | 1563 | !!(dev_priv->flags & CHIP_IS_PCIE); |
1572 | dev_priv->gart_info.gart_table_location = | 1564 | dev_priv->gart_info.gart_table_location = |
1573 | DRM_ATI_GART_FB; | 1565 | DRM_ATI_GART_FB; |
1574 | 1566 | ||
1575 | DRM_DEBUG("Setting phys_pci_gart to %08lX %08lX\n", | 1567 | DRM_DEBUG("Setting phys_pci_gart to %p %08lX\n", |
1576 | dev_priv->gart_info.addr, | 1568 | dev_priv->gart_info.addr, |
1577 | dev_priv->pcigart_offset); | 1569 | dev_priv->pcigart_offset); |
1578 | } else { | 1570 | } else { |
1579 | dev_priv->gart_info.gart_table_location = | 1571 | dev_priv->gart_info.gart_table_location = |
1580 | DRM_ATI_GART_MAIN; | 1572 | DRM_ATI_GART_MAIN; |
1581 | dev_priv->gart_info.addr = | 1573 | dev_priv->gart_info.addr = NULL; |
1582 | dev_priv->gart_info.bus_addr = 0; | 1574 | dev_priv->gart_info.bus_addr = 0; |
1583 | if (dev_priv->flags & CHIP_IS_PCIE) { | 1575 | if (dev_priv->flags & CHIP_IS_PCIE) { |
1584 | DRM_ERROR | 1576 | DRM_ERROR |
1585 | ("Cannot use PCI Express without GART in FB memory\n"); | 1577 | ("Cannot use PCI Express without GART in FB memory\n"); |
@@ -1590,7 +1582,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1590 | 1582 | ||
1591 | if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { | 1583 | if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { |
1592 | DRM_ERROR("failed to init PCI GART!\n"); | 1584 | DRM_ERROR("failed to init PCI GART!\n"); |
1593 | dev->dev_private = (void *)dev_priv; | ||
1594 | radeon_do_cleanup_cp(dev); | 1585 | radeon_do_cleanup_cp(dev); |
1595 | return DRM_ERR(ENOMEM); | 1586 | return DRM_ERR(ENOMEM); |
1596 | } | 1587 | } |
@@ -1604,8 +1595,6 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) | |||
1604 | 1595 | ||
1605 | dev_priv->last_buf = 0; | 1596 | dev_priv->last_buf = 0; |
1606 | 1597 | ||
1607 | dev->dev_private = (void *)dev_priv; | ||
1608 | |||
1609 | radeon_do_engine_reset(dev); | 1598 | radeon_do_engine_reset(dev); |
1610 | 1599 | ||
1611 | return 0; | 1600 | return 0; |
@@ -1624,11 +1613,15 @@ static int radeon_do_cleanup_cp(drm_device_t * dev) | |||
1624 | drm_irq_uninstall(dev); | 1613 | drm_irq_uninstall(dev); |
1625 | 1614 | ||
1626 | #if __OS_HAS_AGP | 1615 | #if __OS_HAS_AGP |
1627 | if (!dev_priv->is_pci) { | 1616 | if (dev_priv->flags & CHIP_IS_AGP) { |
1628 | if (dev_priv->cp_ring != NULL) | 1617 | if (dev_priv->cp_ring != NULL) { |
1629 | drm_core_ioremapfree(dev_priv->cp_ring, dev); | 1618 | drm_core_ioremapfree(dev_priv->cp_ring, dev); |
1630 | if (dev_priv->ring_rptr != NULL) | 1619 | dev_priv->cp_ring = NULL; |
1620 | } | ||
1621 | if (dev_priv->ring_rptr != NULL) { | ||
1631 | drm_core_ioremapfree(dev_priv->ring_rptr, dev); | 1622 | drm_core_ioremapfree(dev_priv->ring_rptr, dev); |
1623 | dev_priv->ring_rptr = NULL; | ||
1624 | } | ||
1632 | if (dev->agp_buffer_map != NULL) { | 1625 | if (dev->agp_buffer_map != NULL) { |
1633 | drm_core_ioremapfree(dev->agp_buffer_map, dev); | 1626 | drm_core_ioremapfree(dev->agp_buffer_map, dev); |
1634 | dev->agp_buffer_map = NULL; | 1627 | dev->agp_buffer_map = NULL; |
@@ -1636,17 +1629,20 @@ static int radeon_do_cleanup_cp(drm_device_t * dev) | |||
1636 | } else | 1629 | } else |
1637 | #endif | 1630 | #endif |
1638 | { | 1631 | { |
1639 | if (dev_priv->gart_info.bus_addr) | 1632 | |
1633 | if (dev_priv->gart_info.bus_addr) { | ||
1634 | /* Turn off PCI GART */ | ||
1635 | radeon_set_pcigart(dev_priv, 0); | ||
1640 | if (!drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info)) | 1636 | if (!drm_ati_pcigart_cleanup(dev, &dev_priv->gart_info)) |
1641 | DRM_ERROR("failed to cleanup PCI GART!\n"); | 1637 | DRM_ERROR("failed to cleanup PCI GART!\n"); |
1638 | } | ||
1642 | 1639 | ||
1643 | if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) { | 1640 | if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) |
1644 | drm_ioremapfree((void *)dev_priv->gart_info.addr, | 1641 | { |
1645 | RADEON_PCIGART_TABLE_SIZE, dev); | 1642 | drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); |
1646 | dev_priv->gart_info.addr = 0; | 1643 | dev_priv->gart_info.addr = 0; |
1647 | } | 1644 | } |
1648 | } | 1645 | } |
1649 | |||
1650 | /* only clear to the start of flags */ | 1646 | /* only clear to the start of flags */ |
1651 | memset(dev_priv, 0, offsetof(drm_radeon_private_t, flags)); | 1647 | memset(dev_priv, 0, offsetof(drm_radeon_private_t, flags)); |
1652 | 1648 | ||
@@ -1672,7 +1668,7 @@ static int radeon_do_resume_cp(drm_device_t * dev) | |||
1672 | DRM_DEBUG("Starting radeon_do_resume_cp()\n"); | 1668 | DRM_DEBUG("Starting radeon_do_resume_cp()\n"); |
1673 | 1669 | ||
1674 | #if __OS_HAS_AGP | 1670 | #if __OS_HAS_AGP |
1675 | if (!dev_priv->is_pci) { | 1671 | if (dev_priv->flags & CHIP_IS_AGP) { |
1676 | /* Turn off PCI GART */ | 1672 | /* Turn off PCI GART */ |
1677 | radeon_set_pcigart(dev_priv, 0); | 1673 | radeon_set_pcigart(dev_priv, 0); |
1678 | } else | 1674 | } else |
@@ -2103,7 +2099,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS) | |||
2103 | return ret; | 2099 | return ret; |
2104 | } | 2100 | } |
2105 | 2101 | ||
2106 | int radeon_driver_preinit(struct drm_device *dev, unsigned long flags) | 2102 | int radeon_driver_load(struct drm_device *dev, unsigned long flags) |
2107 | { | 2103 | { |
2108 | drm_radeon_private_t *dev_priv; | 2104 | drm_radeon_private_t *dev_priv; |
2109 | int ret = 0; | 2105 | int ret = 0; |
@@ -2136,11 +2132,14 @@ int radeon_driver_preinit(struct drm_device *dev, unsigned long flags) | |||
2136 | dev_priv->flags |= CHIP_IS_PCIE; | 2132 | dev_priv->flags |= CHIP_IS_PCIE; |
2137 | 2133 | ||
2138 | DRM_DEBUG("%s card detected\n", | 2134 | DRM_DEBUG("%s card detected\n", |
2139 | ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : "PCI")); | 2135 | ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : (((dev_priv->flags & CHIP_IS_PCIE) ? "PCIE" : "PCI")))); |
2140 | return ret; | 2136 | return ret; |
2141 | } | 2137 | } |
2142 | 2138 | ||
2143 | int radeon_presetup(struct drm_device *dev) | 2139 | /* Create mappings for registers and framebuffer so userland doesn't necessarily |
2140 | * have to find them. | ||
2141 | */ | ||
2142 | int radeon_driver_firstopen(struct drm_device *dev) | ||
2144 | { | 2143 | { |
2145 | int ret; | 2144 | int ret; |
2146 | drm_local_map_t *map; | 2145 | drm_local_map_t *map; |
@@ -2161,12 +2160,11 @@ int radeon_presetup(struct drm_device *dev) | |||
2161 | return 0; | 2160 | return 0; |
2162 | } | 2161 | } |
2163 | 2162 | ||
2164 | int radeon_driver_postcleanup(struct drm_device *dev) | 2163 | int radeon_driver_unload(struct drm_device *dev) |
2165 | { | 2164 | { |
2166 | drm_radeon_private_t *dev_priv = dev->dev_private; | 2165 | drm_radeon_private_t *dev_priv = dev->dev_private; |
2167 | 2166 | ||
2168 | DRM_DEBUG("\n"); | 2167 | DRM_DEBUG("\n"); |
2169 | |||
2170 | drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); | 2168 | drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); |
2171 | 2169 | ||
2172 | dev->dev_private = NULL; | 2170 | dev->dev_private = NULL; |
diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h index 1cd81a671a36..9c177a6b2a4c 100644 --- a/drivers/char/drm/radeon_drm.h +++ b/drivers/char/drm/radeon_drm.h | |||
@@ -624,6 +624,11 @@ typedef struct drm_radeon_indirect { | |||
624 | int discard; | 624 | int discard; |
625 | } drm_radeon_indirect_t; | 625 | } drm_radeon_indirect_t; |
626 | 626 | ||
627 | /* enum for card type parameters */ | ||
628 | #define RADEON_CARD_PCI 0 | ||
629 | #define RADEON_CARD_AGP 1 | ||
630 | #define RADEON_CARD_PCIE 2 | ||
631 | |||
627 | /* 1.3: An ioctl to get parameters that aren't available to the 3d | 632 | /* 1.3: An ioctl to get parameters that aren't available to the 3d |
628 | * client any other way. | 633 | * client any other way. |
629 | */ | 634 | */ |
@@ -640,6 +645,7 @@ typedef struct drm_radeon_indirect { | |||
640 | #define RADEON_PARAM_SAREA_HANDLE 9 | 645 | #define RADEON_PARAM_SAREA_HANDLE 9 |
641 | #define RADEON_PARAM_GART_TEX_HANDLE 10 | 646 | #define RADEON_PARAM_GART_TEX_HANDLE 10 |
642 | #define RADEON_PARAM_SCRATCH_OFFSET 11 | 647 | #define RADEON_PARAM_SCRATCH_OFFSET 11 |
648 | #define RADEON_PARAM_CARD_TYPE 12 | ||
643 | 649 | ||
644 | typedef struct drm_radeon_getparam { | 650 | typedef struct drm_radeon_getparam { |
645 | int param; | 651 | int param; |
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c index ee49670d8162..b04ed1b562b9 100644 --- a/drivers/char/drm/radeon_drv.c +++ b/drivers/char/drm/radeon_drv.c | |||
@@ -42,29 +42,15 @@ int radeon_no_wb; | |||
42 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n"); | 42 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n"); |
43 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 43 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
44 | 44 | ||
45 | static int postinit(struct drm_device *dev, unsigned long flags) | 45 | static int dri_library_name(struct drm_device *dev, char *buf) |
46 | { | 46 | { |
47 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | 47 | drm_radeon_private_t *dev_priv = dev->dev_private; |
48 | DRIVER_NAME, | 48 | int family = dev_priv->flags & CHIP_FAMILY_MASK; |
49 | DRIVER_MAJOR, | ||
50 | DRIVER_MINOR, | ||
51 | DRIVER_PATCHLEVEL, | ||
52 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
53 | ); | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static int version(drm_version_t * version) | ||
58 | { | ||
59 | int len; | ||
60 | 49 | ||
61 | version->version_major = DRIVER_MAJOR; | 50 | return snprintf(buf, PAGE_SIZE, "%s\n", |
62 | version->version_minor = DRIVER_MINOR; | 51 | (family < CHIP_R200) ? "radeon" : |
63 | version->version_patchlevel = DRIVER_PATCHLEVEL; | 52 | ((family < CHIP_R300) ? "r200" : |
64 | DRM_COPY(version->name, DRIVER_NAME); | 53 | "r300")); |
65 | DRM_COPY(version->date, DRIVER_DATE); | ||
66 | DRM_COPY(version->desc, DRIVER_DESC); | ||
67 | return 0; | ||
68 | } | 54 | } |
69 | 55 | ||
70 | static struct pci_device_id pciidlist[] = { | 56 | static struct pci_device_id pciidlist[] = { |
@@ -77,23 +63,22 @@ static struct drm_driver driver = { | |||
77 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | | 63 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | |
78 | DRIVER_IRQ_VBL, | 64 | DRIVER_IRQ_VBL, |
79 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), | 65 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), |
80 | .preinit = radeon_driver_preinit, | 66 | .load = radeon_driver_load, |
81 | .presetup = radeon_presetup, | 67 | .firstopen = radeon_driver_firstopen, |
82 | .postcleanup = radeon_driver_postcleanup, | 68 | .open = radeon_driver_open, |
83 | .prerelease = radeon_driver_prerelease, | 69 | .preclose = radeon_driver_preclose, |
84 | .pretakedown = radeon_driver_pretakedown, | 70 | .postclose = radeon_driver_postclose, |
85 | .open_helper = radeon_driver_open_helper, | 71 | .lastclose = radeon_driver_lastclose, |
72 | .unload = radeon_driver_unload, | ||
86 | .vblank_wait = radeon_driver_vblank_wait, | 73 | .vblank_wait = radeon_driver_vblank_wait, |
74 | .dri_library_name = dri_library_name, | ||
87 | .irq_preinstall = radeon_driver_irq_preinstall, | 75 | .irq_preinstall = radeon_driver_irq_preinstall, |
88 | .irq_postinstall = radeon_driver_irq_postinstall, | 76 | .irq_postinstall = radeon_driver_irq_postinstall, |
89 | .irq_uninstall = radeon_driver_irq_uninstall, | 77 | .irq_uninstall = radeon_driver_irq_uninstall, |
90 | .irq_handler = radeon_driver_irq_handler, | 78 | .irq_handler = radeon_driver_irq_handler, |
91 | .free_filp_priv = radeon_driver_free_filp_priv, | ||
92 | .reclaim_buffers = drm_core_reclaim_buffers, | 79 | .reclaim_buffers = drm_core_reclaim_buffers, |
93 | .get_map_ofs = drm_core_get_map_ofs, | 80 | .get_map_ofs = drm_core_get_map_ofs, |
94 | .get_reg_ofs = drm_core_get_reg_ofs, | 81 | .get_reg_ofs = drm_core_get_reg_ofs, |
95 | .postinit = postinit, | ||
96 | .version = version, | ||
97 | .ioctls = radeon_ioctls, | 82 | .ioctls = radeon_ioctls, |
98 | .dma_ioctl = radeon_cp_buffers, | 83 | .dma_ioctl = radeon_cp_buffers, |
99 | .fops = { | 84 | .fops = { |
@@ -107,12 +92,19 @@ static struct drm_driver driver = { | |||
107 | #ifdef CONFIG_COMPAT | 92 | #ifdef CONFIG_COMPAT |
108 | .compat_ioctl = radeon_compat_ioctl, | 93 | .compat_ioctl = radeon_compat_ioctl, |
109 | #endif | 94 | #endif |
110 | } | 95 | }, |
111 | , | 96 | |
112 | .pci_driver = { | 97 | .pci_driver = { |
113 | .name = DRIVER_NAME, | 98 | .name = DRIVER_NAME, |
114 | .id_table = pciidlist, | 99 | .id_table = pciidlist, |
115 | } | 100 | }, |
101 | |||
102 | .name = DRIVER_NAME, | ||
103 | .desc = DRIVER_DESC, | ||
104 | .date = DRIVER_DATE, | ||
105 | .major = DRIVER_MAJOR, | ||
106 | .minor = DRIVER_MINOR, | ||
107 | .patchlevel = DRIVER_PATCHLEVEL, | ||
116 | }; | 108 | }; |
117 | 109 | ||
118 | static int __init radeon_init(void) | 110 | static int __init radeon_init(void) |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index d92ccee3e54c..498b19b1d641 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define DRIVER_NAME "radeon" | 39 | #define DRIVER_NAME "radeon" |
40 | #define DRIVER_DESC "ATI Radeon" | 40 | #define DRIVER_DESC "ATI Radeon" |
41 | #define DRIVER_DATE "20050911" | 41 | #define DRIVER_DATE "20051229" |
42 | 42 | ||
43 | /* Interface history: | 43 | /* Interface history: |
44 | * | 44 | * |
@@ -73,7 +73,7 @@ | |||
73 | * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color | 73 | * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color |
74 | * and GL_EXT_blend_[func|equation]_separate on r200 | 74 | * and GL_EXT_blend_[func|equation]_separate on r200 |
75 | * 1.12- Add R300 CP microcode support - this just loads the CP on r300 | 75 | * 1.12- Add R300 CP microcode support - this just loads the CP on r300 |
76 | * (No 3D support yet - just microcode loading) | 76 | * (No 3D support yet - just microcode loading). |
77 | * 1.13- Add packet R200_EMIT_TCL_POINT_SPRITE_CNTL for ARB_point_parameters | 77 | * 1.13- Add packet R200_EMIT_TCL_POINT_SPRITE_CNTL for ARB_point_parameters |
78 | * - Add hyperz support, add hyperz flags to clear ioctl. | 78 | * - Add hyperz support, add hyperz flags to clear ioctl. |
79 | * 1.14- Add support for color tiling | 79 | * 1.14- Add support for color tiling |
@@ -88,14 +88,13 @@ | |||
88 | * R200_EMIT_PP_TXFILTER_0-5, 2 more regs) and R200_EMIT_ATF_TFACTOR | 88 | * R200_EMIT_PP_TXFILTER_0-5, 2 more regs) and R200_EMIT_ATF_TFACTOR |
89 | * (replaces R200_EMIT_TFACTOR_0 (8 consts instead of 6) | 89 | * (replaces R200_EMIT_TFACTOR_0 (8 consts instead of 6) |
90 | * 1.19- Add support for gart table in FB memory and PCIE r300 | 90 | * 1.19- Add support for gart table in FB memory and PCIE r300 |
91 | * 1.20- Add support for r300 texrect | ||
92 | * 1.21- Add support for card type getparam | ||
91 | */ | 93 | */ |
92 | #define DRIVER_MAJOR 1 | 94 | #define DRIVER_MAJOR 1 |
93 | #define DRIVER_MINOR 19 | 95 | #define DRIVER_MINOR 21 |
94 | #define DRIVER_PATCHLEVEL 0 | 96 | #define DRIVER_PATCHLEVEL 0 |
95 | 97 | ||
96 | #define GET_RING_HEAD(dev_priv) DRM_READ32( (dev_priv)->ring_rptr, 0 ) | ||
97 | #define SET_RING_HEAD(dev_priv,val) DRM_WRITE32( (dev_priv)->ring_rptr, 0, (val) ) | ||
98 | |||
99 | /* | 98 | /* |
100 | * Radeon chip families | 99 | * Radeon chip families |
101 | */ | 100 | */ |
@@ -103,8 +102,8 @@ enum radeon_family { | |||
103 | CHIP_R100, | 102 | CHIP_R100, |
104 | CHIP_RS100, | 103 | CHIP_RS100, |
105 | CHIP_RV100, | 104 | CHIP_RV100, |
106 | CHIP_R200, | ||
107 | CHIP_RV200, | 105 | CHIP_RV200, |
106 | CHIP_R200, | ||
108 | CHIP_RS200, | 107 | CHIP_RS200, |
109 | CHIP_R250, | 108 | CHIP_R250, |
110 | CHIP_RS250, | 109 | CHIP_RS250, |
@@ -138,6 +137,9 @@ enum radeon_chip_flags { | |||
138 | CHIP_IS_PCIE = 0x00200000UL, | 137 | CHIP_IS_PCIE = 0x00200000UL, |
139 | }; | 138 | }; |
140 | 139 | ||
140 | #define GET_RING_HEAD(dev_priv) DRM_READ32( (dev_priv)->ring_rptr, 0 ) | ||
141 | #define SET_RING_HEAD(dev_priv,val) DRM_WRITE32( (dev_priv)->ring_rptr, 0, (val) ) | ||
142 | |||
141 | typedef struct drm_radeon_freelist { | 143 | typedef struct drm_radeon_freelist { |
142 | unsigned int age; | 144 | unsigned int age; |
143 | drm_buf_t *buf; | 145 | drm_buf_t *buf; |
@@ -245,8 +247,6 @@ typedef struct drm_radeon_private { | |||
245 | 247 | ||
246 | drm_radeon_depth_clear_t depth_clear; | 248 | drm_radeon_depth_clear_t depth_clear; |
247 | 249 | ||
248 | unsigned long fb_offset; | ||
249 | unsigned long mmio_offset; | ||
250 | unsigned long ring_offset; | 250 | unsigned long ring_offset; |
251 | unsigned long ring_rptr_offset; | 251 | unsigned long ring_rptr_offset; |
252 | unsigned long buffers_offset; | 252 | unsigned long buffers_offset; |
@@ -273,7 +273,6 @@ typedef struct drm_radeon_private { | |||
273 | 273 | ||
274 | /* starting from here on, data is preserved accross an open */ | 274 | /* starting from here on, data is preserved accross an open */ |
275 | uint32_t flags; /* see radeon_chip_flags */ | 275 | uint32_t flags; /* see radeon_chip_flags */ |
276 | int is_pci; | ||
277 | } drm_radeon_private_t; | 276 | } drm_radeon_private_t; |
278 | 277 | ||
279 | typedef struct drm_radeon_buf_priv { | 278 | typedef struct drm_radeon_buf_priv { |
@@ -330,17 +329,14 @@ extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); | |||
330 | extern void radeon_driver_irq_preinstall(drm_device_t * dev); | 329 | extern void radeon_driver_irq_preinstall(drm_device_t * dev); |
331 | extern void radeon_driver_irq_postinstall(drm_device_t * dev); | 330 | extern void radeon_driver_irq_postinstall(drm_device_t * dev); |
332 | extern void radeon_driver_irq_uninstall(drm_device_t * dev); | 331 | extern void radeon_driver_irq_uninstall(drm_device_t * dev); |
333 | extern void radeon_driver_prerelease(drm_device_t * dev, DRMFILE filp); | ||
334 | extern void radeon_driver_pretakedown(drm_device_t * dev); | ||
335 | extern int radeon_driver_open_helper(drm_device_t * dev, | ||
336 | drm_file_t * filp_priv); | ||
337 | extern void radeon_driver_free_filp_priv(drm_device_t * dev, | ||
338 | drm_file_t * filp_priv); | ||
339 | |||
340 | extern int radeon_preinit(struct drm_device *dev, unsigned long flags); | ||
341 | extern int radeon_postinit(struct drm_device *dev, unsigned long flags); | ||
342 | extern int radeon_postcleanup(struct drm_device *dev); | ||
343 | 332 | ||
333 | extern int radeon_driver_load(struct drm_device *dev, unsigned long flags); | ||
334 | extern int radeon_driver_unload(struct drm_device *dev); | ||
335 | extern int radeon_driver_firstopen(struct drm_device *dev); | ||
336 | extern void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp); | ||
337 | extern void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp); | ||
338 | extern void radeon_driver_lastclose(drm_device_t * dev); | ||
339 | extern int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv); | ||
344 | extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd, | 340 | extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd, |
345 | unsigned long arg); | 341 | unsigned long arg); |
346 | 342 | ||
@@ -364,6 +360,8 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, | |||
364 | */ | 360 | */ |
365 | 361 | ||
366 | #define RADEON_AGP_COMMAND 0x0f60 | 362 | #define RADEON_AGP_COMMAND 0x0f60 |
363 | #define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config */ | ||
364 | # define RADEON_AGP_ENABLE (1<<8) | ||
367 | #define RADEON_AUX_SCISSOR_CNTL 0x26f0 | 365 | #define RADEON_AUX_SCISSOR_CNTL 0x26f0 |
368 | # define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) | 366 | # define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) |
369 | # define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) | 367 | # define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) |
@@ -651,6 +649,8 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, | |||
651 | 649 | ||
652 | #define RADEON_WAIT_UNTIL 0x1720 | 650 | #define RADEON_WAIT_UNTIL 0x1720 |
653 | # define RADEON_WAIT_CRTC_PFLIP (1 << 0) | 651 | # define RADEON_WAIT_CRTC_PFLIP (1 << 0) |
652 | # define RADEON_WAIT_2D_IDLE (1 << 14) | ||
653 | # define RADEON_WAIT_3D_IDLE (1 << 15) | ||
654 | # define RADEON_WAIT_2D_IDLECLEAN (1 << 16) | 654 | # define RADEON_WAIT_2D_IDLECLEAN (1 << 16) |
655 | # define RADEON_WAIT_3D_IDLECLEAN (1 << 17) | 655 | # define RADEON_WAIT_3D_IDLECLEAN (1 << 17) |
656 | # define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) | 656 | # define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) |
@@ -1105,7 +1105,6 @@ do { \ | |||
1105 | write = 0; \ | 1105 | write = 0; \ |
1106 | _tab += _i; \ | 1106 | _tab += _i; \ |
1107 | } \ | 1107 | } \ |
1108 | \ | ||
1109 | while (_size > 0) { \ | 1108 | while (_size > 0) { \ |
1110 | *(ring + write) = *_tab++; \ | 1109 | *(ring + write) = *_tab++; \ |
1111 | write++; \ | 1110 | write++; \ |
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index 231ac1438c69..7bc27516d425 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* radeon_state.c -- State support for Radeon -*- linux-c -*- | 1 | /* radeon_state.c -- State support for Radeon -*- linux-c -*- */ |
2 | * | 2 | /* |
3 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | 3 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. |
4 | * All Rights Reserved. | 4 | * All Rights Reserved. |
5 | * | 5 | * |
@@ -72,10 +72,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
72 | 72 | ||
73 | case RADEON_EMIT_PP_MISC: | 73 | case RADEON_EMIT_PP_MISC: |
74 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, | 74 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, |
75 | &data[(RADEON_RB3D_DEPTHOFFSET | 75 | &data[(RADEON_RB3D_DEPTHOFFSET - RADEON_PP_MISC) / 4])) { |
76 | - | ||
77 | RADEON_PP_MISC) / | ||
78 | 4])) { | ||
79 | DRM_ERROR("Invalid depth buffer offset\n"); | 76 | DRM_ERROR("Invalid depth buffer offset\n"); |
80 | return DRM_ERR(EINVAL); | 77 | return DRM_ERR(EINVAL); |
81 | } | 78 | } |
@@ -83,10 +80,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
83 | 80 | ||
84 | case RADEON_EMIT_PP_CNTL: | 81 | case RADEON_EMIT_PP_CNTL: |
85 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, | 82 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, |
86 | &data[(RADEON_RB3D_COLOROFFSET | 83 | &data[(RADEON_RB3D_COLOROFFSET - RADEON_PP_CNTL) / 4])) { |
87 | - | ||
88 | RADEON_PP_CNTL) / | ||
89 | 4])) { | ||
90 | DRM_ERROR("Invalid colour buffer offset\n"); | 84 | DRM_ERROR("Invalid colour buffer offset\n"); |
91 | return DRM_ERR(EINVAL); | 85 | return DRM_ERR(EINVAL); |
92 | } | 86 | } |
@@ -109,10 +103,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
109 | case RADEON_EMIT_PP_TXFILTER_1: | 103 | case RADEON_EMIT_PP_TXFILTER_1: |
110 | case RADEON_EMIT_PP_TXFILTER_2: | 104 | case RADEON_EMIT_PP_TXFILTER_2: |
111 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, | 105 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, |
112 | &data[(RADEON_PP_TXOFFSET_0 | 106 | &data[(RADEON_PP_TXOFFSET_0 - RADEON_PP_TXFILTER_0) / 4])) { |
113 | - | ||
114 | RADEON_PP_TXFILTER_0) / | ||
115 | 4])) { | ||
116 | DRM_ERROR("Invalid R100 texture offset\n"); | 107 | DRM_ERROR("Invalid R100 texture offset\n"); |
117 | return DRM_ERR(EINVAL); | 108 | return DRM_ERR(EINVAL); |
118 | } | 109 | } |
@@ -126,8 +117,9 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
126 | case R200_EMIT_PP_CUBIC_OFFSETS_5:{ | 117 | case R200_EMIT_PP_CUBIC_OFFSETS_5:{ |
127 | int i; | 118 | int i; |
128 | for (i = 0; i < 5; i++) { | 119 | for (i = 0; i < 5; i++) { |
129 | if (radeon_check_and_fixup_offset | 120 | if (radeon_check_and_fixup_offset(dev_priv, |
130 | (dev_priv, filp_priv, &data[i])) { | 121 | filp_priv, |
122 | &data[i])) { | ||
131 | DRM_ERROR | 123 | DRM_ERROR |
132 | ("Invalid R200 cubic texture offset\n"); | 124 | ("Invalid R200 cubic texture offset\n"); |
133 | return DRM_ERR(EINVAL); | 125 | return DRM_ERR(EINVAL); |
@@ -239,8 +231,9 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
239 | 231 | ||
240 | static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * | 232 | static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * |
241 | dev_priv, | 233 | dev_priv, |
242 | drm_file_t * filp_priv, | 234 | drm_file_t *filp_priv, |
243 | drm_radeon_kcmd_buffer_t *cmdbuf, | 235 | drm_radeon_kcmd_buffer_t * |
236 | cmdbuf, | ||
244 | unsigned int *cmdsz) | 237 | unsigned int *cmdsz) |
245 | { | 238 | { |
246 | u32 *cmd = (u32 *) cmdbuf->buf; | 239 | u32 *cmd = (u32 *) cmdbuf->buf; |
@@ -555,7 +548,8 @@ static struct { | |||
555 | {R200_PP_TXOFFSET_4, 1, "R200_PP_TXOFFSET_4"}, | 548 | {R200_PP_TXOFFSET_4, 1, "R200_PP_TXOFFSET_4"}, |
556 | {R200_PP_TXOFFSET_5, 1, "R200_PP_TXOFFSET_5"}, | 549 | {R200_PP_TXOFFSET_5, 1, "R200_PP_TXOFFSET_5"}, |
557 | {R200_SE_VTE_CNTL, 1, "R200_SE_VTE_CNTL"}, | 550 | {R200_SE_VTE_CNTL, 1, "R200_SE_VTE_CNTL"}, |
558 | {R200_SE_TCL_OUTPUT_VTX_COMP_SEL, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL"}, | 551 | {R200_SE_TCL_OUTPUT_VTX_COMP_SEL, 1, |
552 | "R200_SE_TCL_OUTPUT_VTX_COMP_SEL"}, | ||
559 | {R200_PP_TAM_DEBUG3, 1, "R200_PP_TAM_DEBUG3"}, | 553 | {R200_PP_TAM_DEBUG3, 1, "R200_PP_TAM_DEBUG3"}, |
560 | {R200_PP_CNTL_X, 1, "R200_PP_CNTL_X"}, | 554 | {R200_PP_CNTL_X, 1, "R200_PP_CNTL_X"}, |
561 | {R200_RB3D_DEPTHXY_OFFSET, 1, "R200_RB3D_DEPTHXY_OFFSET"}, | 555 | {R200_RB3D_DEPTHXY_OFFSET, 1, "R200_RB3D_DEPTHXY_OFFSET"}, |
@@ -569,7 +563,7 @@ static struct { | |||
569 | {R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, 4, | 563 | {R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, 4, |
570 | "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0"}, | 564 | "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0"}, |
571 | {R200_PP_CUBIC_FACES_0, 1, "R200_PP_CUBIC_FACES_0"}, /* 61 */ | 565 | {R200_PP_CUBIC_FACES_0, 1, "R200_PP_CUBIC_FACES_0"}, /* 61 */ |
572 | {R200_PP_CUBIC_OFFSET_F1_0, 5, "R200_PP_CUBIC_OFFSET_F1_0"}, /* 62 */ | 566 | {R200_PP_CUBIC_OFFSET_F1_0, 5, "R200_PP_CUBIC_OFFSET_F1_0"}, /* 62 */ |
573 | {R200_PP_CUBIC_FACES_1, 1, "R200_PP_CUBIC_FACES_1"}, | 567 | {R200_PP_CUBIC_FACES_1, 1, "R200_PP_CUBIC_FACES_1"}, |
574 | {R200_PP_CUBIC_OFFSET_F1_1, 5, "R200_PP_CUBIC_OFFSET_F1_1"}, | 568 | {R200_PP_CUBIC_OFFSET_F1_1, 5, "R200_PP_CUBIC_OFFSET_F1_1"}, |
575 | {R200_PP_CUBIC_FACES_2, 1, "R200_PP_CUBIC_FACES_2"}, | 569 | {R200_PP_CUBIC_FACES_2, 1, "R200_PP_CUBIC_FACES_2"}, |
@@ -592,7 +586,7 @@ static struct { | |||
592 | {RADEON_PP_CUBIC_FACES_2, 1, "RADEON_PP_CUBIC_FACES_2"}, | 586 | {RADEON_PP_CUBIC_FACES_2, 1, "RADEON_PP_CUBIC_FACES_2"}, |
593 | {RADEON_PP_CUBIC_OFFSET_T2_0, 5, "RADEON_PP_CUBIC_OFFSET_T2_0"}, | 587 | {RADEON_PP_CUBIC_OFFSET_T2_0, 5, "RADEON_PP_CUBIC_OFFSET_T2_0"}, |
594 | {R200_PP_TRI_PERF, 2, "R200_PP_TRI_PERF"}, | 588 | {R200_PP_TRI_PERF, 2, "R200_PP_TRI_PERF"}, |
595 | {R200_PP_AFS_0, 32, "R200_PP_AFS_0"}, /* 85 */ | 589 | {R200_PP_AFS_0, 32, "R200_PP_AFS_0"}, /* 85 */ |
596 | {R200_PP_AFS_1, 32, "R200_PP_AFS_1"}, | 590 | {R200_PP_AFS_1, 32, "R200_PP_AFS_1"}, |
597 | {R200_PP_TFACTOR_0, 8, "R200_ATF_TFACTOR"}, | 591 | {R200_PP_TFACTOR_0, 8, "R200_ATF_TFACTOR"}, |
598 | {R200_PP_TXFILTER_0, 8, "R200_PP_TXCTLALL_0"}, | 592 | {R200_PP_TXFILTER_0, 8, "R200_PP_TXCTLALL_0"}, |
@@ -985,8 +979,8 @@ static void radeon_cp_dispatch_clear(drm_device_t * dev, | |||
985 | * rendering a quad into just those buffers. Thus, we have to | 979 | * rendering a quad into just those buffers. Thus, we have to |
986 | * make sure the 3D engine is configured correctly. | 980 | * make sure the 3D engine is configured correctly. |
987 | */ | 981 | */ |
988 | if ((dev_priv->microcode_version == UCODE_R200) && | 982 | else if ((dev_priv->microcode_version == UCODE_R200) && |
989 | (flags & (RADEON_DEPTH | RADEON_STENCIL))) { | 983 | (flags & (RADEON_DEPTH | RADEON_STENCIL))) { |
990 | 984 | ||
991 | int tempPP_CNTL; | 985 | int tempPP_CNTL; |
992 | int tempRE_CNTL; | 986 | int tempRE_CNTL; |
@@ -1637,6 +1631,14 @@ static int radeon_cp_dispatch_texture(DRMFILE filp, | |||
1637 | (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset); | 1631 | (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset); |
1638 | dwords = size / 4; | 1632 | dwords = size / 4; |
1639 | 1633 | ||
1634 | #define RADEON_COPY_MT(_buf, _data, _width) \ | ||
1635 | do { \ | ||
1636 | if (DRM_COPY_FROM_USER(_buf, _data, (_width))) {\ | ||
1637 | DRM_ERROR("EFAULT on pad, %d bytes\n", (_width)); \ | ||
1638 | return DRM_ERR(EFAULT); \ | ||
1639 | } \ | ||
1640 | } while(0) | ||
1641 | |||
1640 | if (microtile) { | 1642 | if (microtile) { |
1641 | /* texture micro tiling in use, minimum texture width is thus 16 bytes. | 1643 | /* texture micro tiling in use, minimum texture width is thus 16 bytes. |
1642 | however, we cannot use blitter directly for texture width < 64 bytes, | 1644 | however, we cannot use blitter directly for texture width < 64 bytes, |
@@ -1648,46 +1650,19 @@ static int radeon_cp_dispatch_texture(DRMFILE filp, | |||
1648 | from user space. */ | 1650 | from user space. */ |
1649 | if (tex->height == 1) { | 1651 | if (tex->height == 1) { |
1650 | if (tex_width >= 64 || tex_width <= 16) { | 1652 | if (tex_width >= 64 || tex_width <= 16) { |
1651 | if (DRM_COPY_FROM_USER(buffer, data, | 1653 | RADEON_COPY_MT(buffer, data, |
1652 | tex_width * | 1654 | (int)(tex_width * sizeof(u32))); |
1653 | sizeof(u32))) { | ||
1654 | DRM_ERROR | ||
1655 | ("EFAULT on pad, %d bytes\n", | ||
1656 | tex_width); | ||
1657 | return DRM_ERR(EFAULT); | ||
1658 | } | ||
1659 | } else if (tex_width == 32) { | 1655 | } else if (tex_width == 32) { |
1660 | if (DRM_COPY_FROM_USER | 1656 | RADEON_COPY_MT(buffer, data, 16); |
1661 | (buffer, data, 16)) { | 1657 | RADEON_COPY_MT(buffer + 8, |
1662 | DRM_ERROR | 1658 | data + 16, 16); |
1663 | ("EFAULT on pad, %d bytes\n", | ||
1664 | tex_width); | ||
1665 | return DRM_ERR(EFAULT); | ||
1666 | } | ||
1667 | if (DRM_COPY_FROM_USER | ||
1668 | (buffer + 8, data + 16, 16)) { | ||
1669 | DRM_ERROR | ||
1670 | ("EFAULT on pad, %d bytes\n", | ||
1671 | tex_width); | ||
1672 | return DRM_ERR(EFAULT); | ||
1673 | } | ||
1674 | } | 1659 | } |
1675 | } else if (tex_width >= 64 || tex_width == 16) { | 1660 | } else if (tex_width >= 64 || tex_width == 16) { |
1676 | if (DRM_COPY_FROM_USER(buffer, data, | 1661 | RADEON_COPY_MT(buffer, data, |
1677 | dwords * sizeof(u32))) { | 1662 | (int)(dwords * sizeof(u32))); |
1678 | DRM_ERROR("EFAULT on data, %d dwords\n", | ||
1679 | dwords); | ||
1680 | return DRM_ERR(EFAULT); | ||
1681 | } | ||
1682 | } else if (tex_width < 16) { | 1663 | } else if (tex_width < 16) { |
1683 | for (i = 0; i < tex->height; i++) { | 1664 | for (i = 0; i < tex->height; i++) { |
1684 | if (DRM_COPY_FROM_USER | 1665 | RADEON_COPY_MT(buffer, data, tex_width); |
1685 | (buffer, data, tex_width)) { | ||
1686 | DRM_ERROR | ||
1687 | ("EFAULT on pad, %d bytes\n", | ||
1688 | tex_width); | ||
1689 | return DRM_ERR(EFAULT); | ||
1690 | } | ||
1691 | buffer += 4; | 1666 | buffer += 4; |
1692 | data += tex_width; | 1667 | data += tex_width; |
1693 | } | 1668 | } |
@@ -1695,37 +1670,13 @@ static int radeon_cp_dispatch_texture(DRMFILE filp, | |||
1695 | /* TODO: make sure this works when not fitting in one buffer | 1670 | /* TODO: make sure this works when not fitting in one buffer |
1696 | (i.e. 32bytes x 2048...) */ | 1671 | (i.e. 32bytes x 2048...) */ |
1697 | for (i = 0; i < tex->height; i += 2) { | 1672 | for (i = 0; i < tex->height; i += 2) { |
1698 | if (DRM_COPY_FROM_USER | 1673 | RADEON_COPY_MT(buffer, data, 16); |
1699 | (buffer, data, 16)) { | ||
1700 | DRM_ERROR | ||
1701 | ("EFAULT on pad, %d bytes\n", | ||
1702 | tex_width); | ||
1703 | return DRM_ERR(EFAULT); | ||
1704 | } | ||
1705 | data += 16; | 1674 | data += 16; |
1706 | if (DRM_COPY_FROM_USER | 1675 | RADEON_COPY_MT(buffer + 8, data, 16); |
1707 | (buffer + 8, data, 16)) { | ||
1708 | DRM_ERROR | ||
1709 | ("EFAULT on pad, %d bytes\n", | ||
1710 | tex_width); | ||
1711 | return DRM_ERR(EFAULT); | ||
1712 | } | ||
1713 | data += 16; | 1676 | data += 16; |
1714 | if (DRM_COPY_FROM_USER | 1677 | RADEON_COPY_MT(buffer + 4, data, 16); |
1715 | (buffer + 4, data, 16)) { | ||
1716 | DRM_ERROR | ||
1717 | ("EFAULT on pad, %d bytes\n", | ||
1718 | tex_width); | ||
1719 | return DRM_ERR(EFAULT); | ||
1720 | } | ||
1721 | data += 16; | 1678 | data += 16; |
1722 | if (DRM_COPY_FROM_USER | 1679 | RADEON_COPY_MT(buffer + 12, data, 16); |
1723 | (buffer + 12, data, 16)) { | ||
1724 | DRM_ERROR | ||
1725 | ("EFAULT on pad, %d bytes\n", | ||
1726 | tex_width); | ||
1727 | return DRM_ERR(EFAULT); | ||
1728 | } | ||
1729 | data += 16; | 1680 | data += 16; |
1730 | buffer += 16; | 1681 | buffer += 16; |
1731 | } | 1682 | } |
@@ -1735,31 +1686,22 @@ static int radeon_cp_dispatch_texture(DRMFILE filp, | |||
1735 | /* Texture image width is larger than the minimum, so we | 1686 | /* Texture image width is larger than the minimum, so we |
1736 | * can upload it directly. | 1687 | * can upload it directly. |
1737 | */ | 1688 | */ |
1738 | if (DRM_COPY_FROM_USER(buffer, data, | 1689 | RADEON_COPY_MT(buffer, data, |
1739 | dwords * sizeof(u32))) { | 1690 | (int)(dwords * sizeof(u32))); |
1740 | DRM_ERROR("EFAULT on data, %d dwords\n", | ||
1741 | dwords); | ||
1742 | return DRM_ERR(EFAULT); | ||
1743 | } | ||
1744 | } else { | 1691 | } else { |
1745 | /* Texture image width is less than the minimum, so we | 1692 | /* Texture image width is less than the minimum, so we |
1746 | * need to pad out each image scanline to the minimum | 1693 | * need to pad out each image scanline to the minimum |
1747 | * width. | 1694 | * width. |
1748 | */ | 1695 | */ |
1749 | for (i = 0; i < tex->height; i++) { | 1696 | for (i = 0; i < tex->height; i++) { |
1750 | if (DRM_COPY_FROM_USER | 1697 | RADEON_COPY_MT(buffer, data, tex_width); |
1751 | (buffer, data, tex_width)) { | ||
1752 | DRM_ERROR | ||
1753 | ("EFAULT on pad, %d bytes\n", | ||
1754 | tex_width); | ||
1755 | return DRM_ERR(EFAULT); | ||
1756 | } | ||
1757 | buffer += 8; | 1698 | buffer += 8; |
1758 | data += tex_width; | 1699 | data += tex_width; |
1759 | } | 1700 | } |
1760 | } | 1701 | } |
1761 | } | 1702 | } |
1762 | 1703 | ||
1704 | #undef RADEON_COPY_MT | ||
1763 | buf->filp = filp; | 1705 | buf->filp = filp; |
1764 | buf->used = size; | 1706 | buf->used = size; |
1765 | offset = dev_priv->gart_buffers_offset + buf->offset; | 1707 | offset = dev_priv->gart_buffers_offset + buf->offset; |
@@ -1821,7 +1763,7 @@ static void radeon_cp_dispatch_stipple(drm_device_t * dev, u32 * stipple) | |||
1821 | } | 1763 | } |
1822 | 1764 | ||
1823 | static void radeon_apply_surface_regs(int surf_index, | 1765 | static void radeon_apply_surface_regs(int surf_index, |
1824 | drm_radeon_private_t * dev_priv) | 1766 | drm_radeon_private_t *dev_priv) |
1825 | { | 1767 | { |
1826 | if (!dev_priv->mmio) | 1768 | if (!dev_priv->mmio) |
1827 | return; | 1769 | return; |
@@ -1847,8 +1789,8 @@ static void radeon_apply_surface_regs(int surf_index, | |||
1847 | * freed, we suddenly need two surfaces to store A and C, which might | 1789 | * freed, we suddenly need two surfaces to store A and C, which might |
1848 | * not always be available. | 1790 | * not always be available. |
1849 | */ | 1791 | */ |
1850 | static int alloc_surface(drm_radeon_surface_alloc_t * new, | 1792 | static int alloc_surface(drm_radeon_surface_alloc_t *new, |
1851 | drm_radeon_private_t * dev_priv, DRMFILE filp) | 1793 | drm_radeon_private_t *dev_priv, DRMFILE filp) |
1852 | { | 1794 | { |
1853 | struct radeon_virt_surface *s; | 1795 | struct radeon_virt_surface *s; |
1854 | int i; | 1796 | int i; |
@@ -2158,6 +2100,11 @@ static int radeon_cp_vertex(DRM_IOCTL_ARGS) | |||
2158 | 2100 | ||
2159 | LOCK_TEST_WITH_RETURN(dev, filp); | 2101 | LOCK_TEST_WITH_RETURN(dev, filp); |
2160 | 2102 | ||
2103 | if (!dev_priv) { | ||
2104 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | ||
2105 | return DRM_ERR(EINVAL); | ||
2106 | } | ||
2107 | |||
2161 | DRM_GET_PRIV_WITH_RETURN(filp_priv, filp); | 2108 | DRM_GET_PRIV_WITH_RETURN(filp_priv, filp); |
2162 | 2109 | ||
2163 | DRM_COPY_FROM_USER_IOCTL(vertex, (drm_radeon_vertex_t __user *) data, | 2110 | DRM_COPY_FROM_USER_IOCTL(vertex, (drm_radeon_vertex_t __user *) data, |
@@ -2596,9 +2543,9 @@ static int radeon_emit_packets(drm_radeon_private_t * dev_priv, | |||
2596 | return 0; | 2543 | return 0; |
2597 | } | 2544 | } |
2598 | 2545 | ||
2599 | static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv, | 2546 | static __inline__ int radeon_emit_scalars(drm_radeon_private_t *dev_priv, |
2600 | drm_radeon_cmd_header_t header, | 2547 | drm_radeon_cmd_header_t header, |
2601 | drm_radeon_kcmd_buffer_t * cmdbuf) | 2548 | drm_radeon_kcmd_buffer_t *cmdbuf) |
2602 | { | 2549 | { |
2603 | int sz = header.scalars.count; | 2550 | int sz = header.scalars.count; |
2604 | int start = header.scalars.offset; | 2551 | int start = header.scalars.offset; |
@@ -2618,9 +2565,9 @@ static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv, | |||
2618 | 2565 | ||
2619 | /* God this is ugly | 2566 | /* God this is ugly |
2620 | */ | 2567 | */ |
2621 | static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv, | 2568 | static __inline__ int radeon_emit_scalars2(drm_radeon_private_t *dev_priv, |
2622 | drm_radeon_cmd_header_t header, | 2569 | drm_radeon_cmd_header_t header, |
2623 | drm_radeon_kcmd_buffer_t * cmdbuf) | 2570 | drm_radeon_kcmd_buffer_t *cmdbuf) |
2624 | { | 2571 | { |
2625 | int sz = header.scalars.count; | 2572 | int sz = header.scalars.count; |
2626 | int start = ((unsigned int)header.scalars.offset) + 0x100; | 2573 | int start = ((unsigned int)header.scalars.offset) + 0x100; |
@@ -2638,9 +2585,9 @@ static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv, | |||
2638 | return 0; | 2585 | return 0; |
2639 | } | 2586 | } |
2640 | 2587 | ||
2641 | static __inline__ int radeon_emit_vectors(drm_radeon_private_t * dev_priv, | 2588 | static __inline__ int radeon_emit_vectors(drm_radeon_private_t *dev_priv, |
2642 | drm_radeon_cmd_header_t header, | 2589 | drm_radeon_cmd_header_t header, |
2643 | drm_radeon_kcmd_buffer_t * cmdbuf) | 2590 | drm_radeon_kcmd_buffer_t *cmdbuf) |
2644 | { | 2591 | { |
2645 | int sz = header.vectors.count; | 2592 | int sz = header.vectors.count; |
2646 | int start = header.vectors.offset; | 2593 | int start = header.vectors.offset; |
@@ -2685,8 +2632,8 @@ static int radeon_emit_packet3(drm_device_t * dev, | |||
2685 | return 0; | 2632 | return 0; |
2686 | } | 2633 | } |
2687 | 2634 | ||
2688 | static int radeon_emit_packet3_cliprect(drm_device_t * dev, | 2635 | static int radeon_emit_packet3_cliprect(drm_device_t *dev, |
2689 | drm_file_t * filp_priv, | 2636 | drm_file_t *filp_priv, |
2690 | drm_radeon_kcmd_buffer_t *cmdbuf, | 2637 | drm_radeon_kcmd_buffer_t *cmdbuf, |
2691 | int orig_nbox) | 2638 | int orig_nbox) |
2692 | { | 2639 | { |
@@ -2818,7 +2765,8 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS) | |||
2818 | kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER); | 2765 | kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER); |
2819 | if (kbuf == NULL) | 2766 | if (kbuf == NULL) |
2820 | return DRM_ERR(ENOMEM); | 2767 | return DRM_ERR(ENOMEM); |
2821 | if (DRM_COPY_FROM_USER(kbuf, (void __user *)cmdbuf.buf, cmdbuf.bufsz)) { | 2768 | if (DRM_COPY_FROM_USER(kbuf, (void __user *)cmdbuf.buf, |
2769 | cmdbuf.bufsz)) { | ||
2822 | drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER); | 2770 | drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER); |
2823 | return DRM_ERR(EFAULT); | 2771 | return DRM_ERR(EFAULT); |
2824 | } | 2772 | } |
@@ -2981,7 +2929,7 @@ static int radeon_cp_getparam(DRM_IOCTL_ARGS) | |||
2981 | value = dev_priv->gart_vm_start; | 2929 | value = dev_priv->gart_vm_start; |
2982 | break; | 2930 | break; |
2983 | case RADEON_PARAM_REGISTER_HANDLE: | 2931 | case RADEON_PARAM_REGISTER_HANDLE: |
2984 | value = dev_priv->mmio_offset; | 2932 | value = dev_priv->mmio->offset; |
2985 | break; | 2933 | break; |
2986 | case RADEON_PARAM_STATUS_HANDLE: | 2934 | case RADEON_PARAM_STATUS_HANDLE: |
2987 | value = dev_priv->ring_rptr_offset; | 2935 | value = dev_priv->ring_rptr_offset; |
@@ -3004,6 +2952,15 @@ static int radeon_cp_getparam(DRM_IOCTL_ARGS) | |||
3004 | case RADEON_PARAM_GART_TEX_HANDLE: | 2952 | case RADEON_PARAM_GART_TEX_HANDLE: |
3005 | value = dev_priv->gart_textures_offset; | 2953 | value = dev_priv->gart_textures_offset; |
3006 | break; | 2954 | break; |
2955 | |||
2956 | case RADEON_PARAM_CARD_TYPE: | ||
2957 | if (dev_priv->flags & CHIP_IS_PCIE) | ||
2958 | value = RADEON_CARD_PCIE; | ||
2959 | else if (dev_priv->flags & CHIP_IS_AGP) | ||
2960 | value = RADEON_CARD_AGP; | ||
2961 | else | ||
2962 | value = RADEON_CARD_PCI; | ||
2963 | break; | ||
3007 | default: | 2964 | default: |
3008 | return DRM_ERR(EINVAL); | 2965 | return DRM_ERR(EINVAL); |
3009 | } | 2966 | } |
@@ -3066,10 +3023,11 @@ static int radeon_cp_setparam(DRM_IOCTL_ARGS) | |||
3066 | /* When a client dies: | 3023 | /* When a client dies: |
3067 | * - Check for and clean up flipped page state | 3024 | * - Check for and clean up flipped page state |
3068 | * - Free any alloced GART memory. | 3025 | * - Free any alloced GART memory. |
3026 | * - Free any alloced radeon surfaces. | ||
3069 | * | 3027 | * |
3070 | * DRM infrastructure takes care of reclaiming dma buffers. | 3028 | * DRM infrastructure takes care of reclaiming dma buffers. |
3071 | */ | 3029 | */ |
3072 | void radeon_driver_prerelease(drm_device_t * dev, DRMFILE filp) | 3030 | void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp) |
3073 | { | 3031 | { |
3074 | if (dev->dev_private) { | 3032 | if (dev->dev_private) { |
3075 | drm_radeon_private_t *dev_priv = dev->dev_private; | 3033 | drm_radeon_private_t *dev_priv = dev->dev_private; |
@@ -3082,16 +3040,17 @@ void radeon_driver_prerelease(drm_device_t * dev, DRMFILE filp) | |||
3082 | } | 3040 | } |
3083 | } | 3041 | } |
3084 | 3042 | ||
3085 | void radeon_driver_pretakedown(drm_device_t * dev) | 3043 | void radeon_driver_lastclose(drm_device_t * dev) |
3086 | { | 3044 | { |
3087 | radeon_do_release(dev); | 3045 | radeon_do_release(dev); |
3088 | } | 3046 | } |
3089 | 3047 | ||
3090 | int radeon_driver_open_helper(drm_device_t * dev, drm_file_t * filp_priv) | 3048 | int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv) |
3091 | { | 3049 | { |
3092 | drm_radeon_private_t *dev_priv = dev->dev_private; | 3050 | drm_radeon_private_t *dev_priv = dev->dev_private; |
3093 | struct drm_radeon_driver_file_fields *radeon_priv; | 3051 | struct drm_radeon_driver_file_fields *radeon_priv; |
3094 | 3052 | ||
3053 | DRM_DEBUG("\n"); | ||
3095 | radeon_priv = | 3054 | radeon_priv = |
3096 | (struct drm_radeon_driver_file_fields *) | 3055 | (struct drm_radeon_driver_file_fields *) |
3097 | drm_alloc(sizeof(*radeon_priv), DRM_MEM_FILES); | 3056 | drm_alloc(sizeof(*radeon_priv), DRM_MEM_FILES); |
@@ -3100,6 +3059,7 @@ int radeon_driver_open_helper(drm_device_t * dev, drm_file_t * filp_priv) | |||
3100 | return -ENOMEM; | 3059 | return -ENOMEM; |
3101 | 3060 | ||
3102 | filp_priv->driver_priv = radeon_priv; | 3061 | filp_priv->driver_priv = radeon_priv; |
3062 | |||
3103 | if (dev_priv) | 3063 | if (dev_priv) |
3104 | radeon_priv->radeon_fb_delta = dev_priv->fb_location; | 3064 | radeon_priv->radeon_fb_delta = dev_priv->fb_location; |
3105 | else | 3065 | else |
@@ -3107,7 +3067,7 @@ int radeon_driver_open_helper(drm_device_t * dev, drm_file_t * filp_priv) | |||
3107 | return 0; | 3067 | return 0; |
3108 | } | 3068 | } |
3109 | 3069 | ||
3110 | void radeon_driver_free_filp_priv(drm_device_t * dev, drm_file_t * filp_priv) | 3070 | void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp_priv) |
3111 | { | 3071 | { |
3112 | struct drm_radeon_driver_file_fields *radeon_priv = | 3072 | struct drm_radeon_driver_file_fields *radeon_priv = |
3113 | filp_priv->driver_priv; | 3073 | filp_priv->driver_priv; |
@@ -3116,33 +3076,33 @@ void radeon_driver_free_filp_priv(drm_device_t * dev, drm_file_t * filp_priv) | |||
3116 | } | 3076 | } |
3117 | 3077 | ||
3118 | drm_ioctl_desc_t radeon_ioctls[] = { | 3078 | drm_ioctl_desc_t radeon_ioctls[] = { |
3119 | [DRM_IOCTL_NR(DRM_RADEON_CP_INIT)] = {radeon_cp_init, 1, 1}, | 3079 | [DRM_IOCTL_NR(DRM_RADEON_CP_INIT)] = {radeon_cp_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3120 | [DRM_IOCTL_NR(DRM_RADEON_CP_START)] = {radeon_cp_start, 1, 1}, | 3080 | [DRM_IOCTL_NR(DRM_RADEON_CP_START)] = {radeon_cp_start, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3121 | [DRM_IOCTL_NR(DRM_RADEON_CP_STOP)] = {radeon_cp_stop, 1, 1}, | 3081 | [DRM_IOCTL_NR(DRM_RADEON_CP_STOP)] = {radeon_cp_stop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3122 | [DRM_IOCTL_NR(DRM_RADEON_CP_RESET)] = {radeon_cp_reset, 1, 1}, | 3082 | [DRM_IOCTL_NR(DRM_RADEON_CP_RESET)] = {radeon_cp_reset, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3123 | [DRM_IOCTL_NR(DRM_RADEON_CP_IDLE)] = {radeon_cp_idle, 1, 0}, | 3083 | [DRM_IOCTL_NR(DRM_RADEON_CP_IDLE)] = {radeon_cp_idle, DRM_AUTH}, |
3124 | [DRM_IOCTL_NR(DRM_RADEON_CP_RESUME)] = {radeon_cp_resume, 1, 0}, | 3084 | [DRM_IOCTL_NR(DRM_RADEON_CP_RESUME)] = {radeon_cp_resume, DRM_AUTH}, |
3125 | [DRM_IOCTL_NR(DRM_RADEON_RESET)] = {radeon_engine_reset, 1, 0}, | 3085 | [DRM_IOCTL_NR(DRM_RADEON_RESET)] = {radeon_engine_reset, DRM_AUTH}, |
3126 | [DRM_IOCTL_NR(DRM_RADEON_FULLSCREEN)] = {radeon_fullscreen, 1, 0}, | 3086 | [DRM_IOCTL_NR(DRM_RADEON_FULLSCREEN)] = {radeon_fullscreen, DRM_AUTH}, |
3127 | [DRM_IOCTL_NR(DRM_RADEON_SWAP)] = {radeon_cp_swap, 1, 0}, | 3087 | [DRM_IOCTL_NR(DRM_RADEON_SWAP)] = {radeon_cp_swap, DRM_AUTH}, |
3128 | [DRM_IOCTL_NR(DRM_RADEON_CLEAR)] = {radeon_cp_clear, 1, 0}, | 3088 | [DRM_IOCTL_NR(DRM_RADEON_CLEAR)] = {radeon_cp_clear, DRM_AUTH}, |
3129 | [DRM_IOCTL_NR(DRM_RADEON_VERTEX)] = {radeon_cp_vertex, 1, 0}, | 3089 | [DRM_IOCTL_NR(DRM_RADEON_VERTEX)] = {radeon_cp_vertex, DRM_AUTH}, |
3130 | [DRM_IOCTL_NR(DRM_RADEON_INDICES)] = {radeon_cp_indices, 1, 0}, | 3090 | [DRM_IOCTL_NR(DRM_RADEON_INDICES)] = {radeon_cp_indices, DRM_AUTH}, |
3131 | [DRM_IOCTL_NR(DRM_RADEON_TEXTURE)] = {radeon_cp_texture, 1, 0}, | 3091 | [DRM_IOCTL_NR(DRM_RADEON_TEXTURE)] = {radeon_cp_texture, DRM_AUTH}, |
3132 | [DRM_IOCTL_NR(DRM_RADEON_STIPPLE)] = {radeon_cp_stipple, 1, 0}, | 3092 | [DRM_IOCTL_NR(DRM_RADEON_STIPPLE)] = {radeon_cp_stipple, DRM_AUTH}, |
3133 | [DRM_IOCTL_NR(DRM_RADEON_INDIRECT)] = {radeon_cp_indirect, 1, 1}, | 3093 | [DRM_IOCTL_NR(DRM_RADEON_INDIRECT)] = {radeon_cp_indirect, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3134 | [DRM_IOCTL_NR(DRM_RADEON_VERTEX2)] = {radeon_cp_vertex2, 1, 0}, | 3094 | [DRM_IOCTL_NR(DRM_RADEON_VERTEX2)] = {radeon_cp_vertex2, DRM_AUTH}, |
3135 | [DRM_IOCTL_NR(DRM_RADEON_CMDBUF)] = {radeon_cp_cmdbuf, 1, 0}, | 3095 | [DRM_IOCTL_NR(DRM_RADEON_CMDBUF)] = {radeon_cp_cmdbuf, DRM_AUTH}, |
3136 | [DRM_IOCTL_NR(DRM_RADEON_GETPARAM)] = {radeon_cp_getparam, 1, 0}, | 3096 | [DRM_IOCTL_NR(DRM_RADEON_GETPARAM)] = {radeon_cp_getparam, DRM_AUTH}, |
3137 | [DRM_IOCTL_NR(DRM_RADEON_FLIP)] = {radeon_cp_flip, 1, 0}, | 3097 | [DRM_IOCTL_NR(DRM_RADEON_FLIP)] = {radeon_cp_flip, DRM_AUTH}, |
3138 | [DRM_IOCTL_NR(DRM_RADEON_ALLOC)] = {radeon_mem_alloc, 1, 0}, | 3098 | [DRM_IOCTL_NR(DRM_RADEON_ALLOC)] = {radeon_mem_alloc, DRM_AUTH}, |
3139 | [DRM_IOCTL_NR(DRM_RADEON_FREE)] = {radeon_mem_free, 1, 0}, | 3099 | [DRM_IOCTL_NR(DRM_RADEON_FREE)] = {radeon_mem_free, DRM_AUTH}, |
3140 | [DRM_IOCTL_NR(DRM_RADEON_INIT_HEAP)] = {radeon_mem_init_heap, 1, 1}, | 3100 | [DRM_IOCTL_NR(DRM_RADEON_INIT_HEAP)] = {radeon_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
3141 | [DRM_IOCTL_NR(DRM_RADEON_IRQ_EMIT)] = {radeon_irq_emit, 1, 0}, | 3101 | [DRM_IOCTL_NR(DRM_RADEON_IRQ_EMIT)] = {radeon_irq_emit, DRM_AUTH}, |
3142 | [DRM_IOCTL_NR(DRM_RADEON_IRQ_WAIT)] = {radeon_irq_wait, 1, 0}, | 3102 | [DRM_IOCTL_NR(DRM_RADEON_IRQ_WAIT)] = {radeon_irq_wait, DRM_AUTH}, |
3143 | [DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = {radeon_cp_setparam, 1, 0}, | 3103 | [DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = {radeon_cp_setparam, DRM_AUTH}, |
3144 | [DRM_IOCTL_NR(DRM_RADEON_SURF_ALLOC)] = {radeon_surface_alloc, 1, 0}, | 3104 | [DRM_IOCTL_NR(DRM_RADEON_SURF_ALLOC)] = {radeon_surface_alloc, DRM_AUTH}, |
3145 | [DRM_IOCTL_NR(DRM_RADEON_SURF_FREE)] = {radeon_surface_free, 1, 0} | 3105 | [DRM_IOCTL_NR(DRM_RADEON_SURF_FREE)] = {radeon_surface_free, DRM_AUTH} |
3146 | }; | 3106 | }; |
3147 | 3107 | ||
3148 | int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls); | 3108 | int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls); |
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 6d10515795cc..0d426deeefec 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -533,16 +533,32 @@ static void savage_fake_dma_flush(drm_savage_private_t * dev_priv) | |||
533 | dev_priv->first_dma_page = dev_priv->current_dma_page = 0; | 533 | dev_priv->first_dma_page = dev_priv->current_dma_page = 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | int savage_driver_load(drm_device_t *dev, unsigned long chipset) | ||
537 | { | ||
538 | drm_savage_private_t *dev_priv; | ||
539 | |||
540 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | ||
541 | if (dev_priv == NULL) | ||
542 | return DRM_ERR(ENOMEM); | ||
543 | |||
544 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); | ||
545 | dev->dev_private = (void *)dev_priv; | ||
546 | |||
547 | dev_priv->chipset = (enum savage_family)chipset; | ||
548 | |||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | |||
536 | /* | 553 | /* |
537 | * Initalize mappings. On Savage4 and SavageIX the alignment | 554 | * Initalize mappings. On Savage4 and SavageIX the alignment |
538 | * and size of the aperture is not suitable for automatic MTRR setup | 555 | * and size of the aperture is not suitable for automatic MTRR setup |
539 | * in drm_addmap. Therefore we do it manually before the maps are | 556 | * in drm_addmap. Therefore we add them manually before the maps are |
540 | * initialized. We also need to take care of deleting the MTRRs in | 557 | * initialized, and tear them down on last close. |
541 | * postcleanup. | ||
542 | */ | 558 | */ |
543 | int savage_preinit(drm_device_t * dev, unsigned long chipset) | 559 | int savage_driver_firstopen(drm_device_t *dev) |
544 | { | 560 | { |
545 | drm_savage_private_t *dev_priv; | 561 | drm_savage_private_t *dev_priv = dev->dev_private; |
546 | unsigned long mmio_base, fb_base, fb_size, aperture_base; | 562 | unsigned long mmio_base, fb_base, fb_size, aperture_base; |
547 | /* fb_rsrc and aper_rsrc aren't really used currently, but still exist | 563 | /* fb_rsrc and aper_rsrc aren't really used currently, but still exist |
548 | * in case we decide we need information on the BAR for BSD in the | 564 | * in case we decide we need information on the BAR for BSD in the |
@@ -551,14 +567,6 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
551 | unsigned int fb_rsrc, aper_rsrc; | 567 | unsigned int fb_rsrc, aper_rsrc; |
552 | int ret = 0; | 568 | int ret = 0; |
553 | 569 | ||
554 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | ||
555 | if (dev_priv == NULL) | ||
556 | return DRM_ERR(ENOMEM); | ||
557 | |||
558 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); | ||
559 | dev->dev_private = (void *)dev_priv; | ||
560 | dev_priv->chipset = (enum savage_family)chipset; | ||
561 | |||
562 | dev_priv->mtrr[0].handle = -1; | 570 | dev_priv->mtrr[0].handle = -1; |
563 | dev_priv->mtrr[1].handle = -1; | 571 | dev_priv->mtrr[1].handle = -1; |
564 | dev_priv->mtrr[2].handle = -1; | 572 | dev_priv->mtrr[2].handle = -1; |
@@ -576,26 +584,24 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
576 | dev_priv->mtrr[0].base = fb_base; | 584 | dev_priv->mtrr[0].base = fb_base; |
577 | dev_priv->mtrr[0].size = 0x01000000; | 585 | dev_priv->mtrr[0].size = 0x01000000; |
578 | dev_priv->mtrr[0].handle = | 586 | dev_priv->mtrr[0].handle = |
579 | mtrr_add(dev_priv->mtrr[0].base, | 587 | drm_mtrr_add(dev_priv->mtrr[0].base, |
580 | dev_priv->mtrr[0].size, MTRR_TYPE_WRCOMB, | 588 | dev_priv->mtrr[0].size, DRM_MTRR_WC); |
581 | 1); | ||
582 | dev_priv->mtrr[1].base = fb_base + 0x02000000; | 589 | dev_priv->mtrr[1].base = fb_base + 0x02000000; |
583 | dev_priv->mtrr[1].size = 0x02000000; | 590 | dev_priv->mtrr[1].size = 0x02000000; |
584 | dev_priv->mtrr[1].handle = | 591 | dev_priv->mtrr[1].handle = |
585 | mtrr_add(dev_priv->mtrr[1].base, | 592 | drm_mtrr_add(dev_priv->mtrr[1].base, |
586 | dev_priv->mtrr[1].size, MTRR_TYPE_WRCOMB, | 593 | dev_priv->mtrr[1].size, DRM_MTRR_WC); |
587 | 1); | ||
588 | dev_priv->mtrr[2].base = fb_base + 0x04000000; | 594 | dev_priv->mtrr[2].base = fb_base + 0x04000000; |
589 | dev_priv->mtrr[2].size = 0x04000000; | 595 | dev_priv->mtrr[2].size = 0x04000000; |
590 | dev_priv->mtrr[2].handle = | 596 | dev_priv->mtrr[2].handle = |
591 | mtrr_add(dev_priv->mtrr[2].base, | 597 | drm_mtrr_add(dev_priv->mtrr[2].base, |
592 | dev_priv->mtrr[2].size, MTRR_TYPE_WRCOMB, | 598 | dev_priv->mtrr[2].size, DRM_MTRR_WC); |
593 | 1); | ||
594 | } else { | 599 | } else { |
595 | DRM_ERROR("strange pci_resource_len %08lx\n", | 600 | DRM_ERROR("strange pci_resource_len %08lx\n", |
596 | drm_get_resource_len(dev, 0)); | 601 | drm_get_resource_len(dev, 0)); |
597 | } | 602 | } |
598 | } else if (chipset != S3_SUPERSAVAGE && chipset != S3_SAVAGE2000) { | 603 | } else if (dev_priv->chipset != S3_SUPERSAVAGE && |
604 | dev_priv->chipset != S3_SAVAGE2000) { | ||
599 | mmio_base = drm_get_resource_start(dev, 0); | 605 | mmio_base = drm_get_resource_start(dev, 0); |
600 | fb_rsrc = 1; | 606 | fb_rsrc = 1; |
601 | fb_base = drm_get_resource_start(dev, 1); | 607 | fb_base = drm_get_resource_start(dev, 1); |
@@ -609,9 +615,8 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
609 | dev_priv->mtrr[0].base = fb_base; | 615 | dev_priv->mtrr[0].base = fb_base; |
610 | dev_priv->mtrr[0].size = 0x08000000; | 616 | dev_priv->mtrr[0].size = 0x08000000; |
611 | dev_priv->mtrr[0].handle = | 617 | dev_priv->mtrr[0].handle = |
612 | mtrr_add(dev_priv->mtrr[0].base, | 618 | drm_mtrr_add(dev_priv->mtrr[0].base, |
613 | dev_priv->mtrr[0].size, MTRR_TYPE_WRCOMB, | 619 | dev_priv->mtrr[0].size, DRM_MTRR_WC); |
614 | 1); | ||
615 | } else { | 620 | } else { |
616 | DRM_ERROR("strange pci_resource_len %08lx\n", | 621 | DRM_ERROR("strange pci_resource_len %08lx\n", |
617 | drm_get_resource_len(dev, 1)); | 622 | drm_get_resource_len(dev, 1)); |
@@ -648,16 +653,21 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
648 | /* | 653 | /* |
649 | * Delete MTRRs and free device-private data. | 654 | * Delete MTRRs and free device-private data. |
650 | */ | 655 | */ |
651 | int savage_postcleanup(drm_device_t * dev) | 656 | void savage_driver_lastclose(drm_device_t *dev) |
652 | { | 657 | { |
653 | drm_savage_private_t *dev_priv = dev->dev_private; | 658 | drm_savage_private_t *dev_priv = dev->dev_private; |
654 | int i; | 659 | int i; |
655 | 660 | ||
656 | for (i = 0; i < 3; ++i) | 661 | for (i = 0; i < 3; ++i) |
657 | if (dev_priv->mtrr[i].handle >= 0) | 662 | if (dev_priv->mtrr[i].handle >= 0) |
658 | mtrr_del(dev_priv->mtrr[i].handle, | 663 | drm_mtrr_del(dev_priv->mtrr[i].handle, |
659 | dev_priv->mtrr[i].base, | 664 | dev_priv->mtrr[i].base, |
660 | dev_priv->mtrr[i].size); | 665 | dev_priv->mtrr[i].size, DRM_MTRR_WC); |
666 | } | ||
667 | |||
668 | int savage_driver_unload(drm_device_t *dev) | ||
669 | { | ||
670 | drm_savage_private_t *dev_priv = dev->dev_private; | ||
661 | 671 | ||
662 | drm_free(dev_priv, sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | 672 | drm_free(dev_priv, sizeof(drm_savage_private_t), DRM_MEM_DRIVER); |
663 | 673 | ||
@@ -994,8 +1004,7 @@ static int savage_bci_event_wait(DRM_IOCTL_ARGS) | |||
994 | * DMA buffer management | 1004 | * DMA buffer management |
995 | */ | 1005 | */ |
996 | 1006 | ||
997 | static int savage_bci_get_buffers(DRMFILE filp, drm_device_t * dev, | 1007 | static int savage_bci_get_buffers(DRMFILE filp, drm_device_t *dev, drm_dma_t *d) |
998 | drm_dma_t * d) | ||
999 | { | 1008 | { |
1000 | drm_buf_t *buf; | 1009 | drm_buf_t *buf; |
1001 | int i; | 1010 | int i; |
@@ -1057,7 +1066,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) | |||
1057 | return ret; | 1066 | return ret; |
1058 | } | 1067 | } |
1059 | 1068 | ||
1060 | void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp) | 1069 | void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp) |
1061 | { | 1070 | { |
1062 | drm_device_dma_t *dma = dev->dma; | 1071 | drm_device_dma_t *dma = dev->dma; |
1063 | drm_savage_private_t *dev_priv = dev->dev_private; | 1072 | drm_savage_private_t *dev_priv = dev->dev_private; |
@@ -1090,10 +1099,10 @@ void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp) | |||
1090 | } | 1099 | } |
1091 | 1100 | ||
1092 | drm_ioctl_desc_t savage_ioctls[] = { | 1101 | drm_ioctl_desc_t savage_ioctls[] = { |
1093 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_INIT)] = {savage_bci_init, 1, 1}, | 1102 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_INIT)] = {savage_bci_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
1094 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_CMDBUF)] = {savage_bci_cmdbuf, 1, 0}, | 1103 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_CMDBUF)] = {savage_bci_cmdbuf, DRM_AUTH}, |
1095 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_EVENT_EMIT)] = {savage_bci_event_emit, 1, 0}, | 1104 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_EVENT_EMIT)] = {savage_bci_event_emit, DRM_AUTH}, |
1096 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_EVENT_WAIT)] = {savage_bci_event_wait, 1, 0}, | 1105 | [DRM_IOCTL_NR(DRM_SAVAGE_BCI_EVENT_WAIT)] = {savage_bci_event_wait, DRM_AUTH}, |
1097 | }; | 1106 | }; |
1098 | 1107 | ||
1099 | int savage_max_ioctl = DRM_ARRAY_SIZE(savage_ioctls); | 1108 | int savage_max_ioctl = DRM_ARRAY_SIZE(savage_ioctls); |
diff --git a/drivers/char/drm/savage_drv.c b/drivers/char/drm/savage_drv.c index 22d799cde41c..aa6c0d1a82f8 100644 --- a/drivers/char/drm/savage_drv.c +++ b/drivers/char/drm/savage_drv.c | |||
@@ -30,31 +30,6 @@ | |||
30 | 30 | ||
31 | #include "drm_pciids.h" | 31 | #include "drm_pciids.h" |
32 | 32 | ||
33 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
34 | { | ||
35 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
36 | DRIVER_NAME, | ||
37 | DRIVER_MAJOR, | ||
38 | DRIVER_MINOR, | ||
39 | DRIVER_PATCHLEVEL, | ||
40 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
41 | ); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int version(drm_version_t * version) | ||
46 | { | ||
47 | int len; | ||
48 | |||
49 | version->version_major = DRIVER_MAJOR; | ||
50 | version->version_minor = DRIVER_MINOR; | ||
51 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
52 | DRM_COPY(version->name, DRIVER_NAME); | ||
53 | DRM_COPY(version->date, DRIVER_DATE); | ||
54 | DRM_COPY(version->desc, DRIVER_DESC); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static struct pci_device_id pciidlist[] = { | 33 | static struct pci_device_id pciidlist[] = { |
59 | savage_PCI_IDS | 34 | savage_PCI_IDS |
60 | }; | 35 | }; |
@@ -63,13 +38,13 @@ static struct drm_driver driver = { | |||
63 | .driver_features = | 38 | .driver_features = |
64 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, | 39 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, |
65 | .dev_priv_size = sizeof(drm_savage_buf_priv_t), | 40 | .dev_priv_size = sizeof(drm_savage_buf_priv_t), |
66 | .preinit = savage_preinit, | 41 | .load = savage_driver_load, |
67 | .postinit = postinit, | 42 | .firstopen = savage_driver_firstopen, |
68 | .postcleanup = savage_postcleanup, | 43 | .lastclose = savage_driver_lastclose, |
44 | .unload = savage_driver_unload, | ||
69 | .reclaim_buffers = savage_reclaim_buffers, | 45 | .reclaim_buffers = savage_reclaim_buffers, |
70 | .get_map_ofs = drm_core_get_map_ofs, | 46 | .get_map_ofs = drm_core_get_map_ofs, |
71 | .get_reg_ofs = drm_core_get_reg_ofs, | 47 | .get_reg_ofs = drm_core_get_reg_ofs, |
72 | .version = version, | ||
73 | .ioctls = savage_ioctls, | 48 | .ioctls = savage_ioctls, |
74 | .dma_ioctl = savage_bci_buffers, | 49 | .dma_ioctl = savage_bci_buffers, |
75 | .fops = { | 50 | .fops = { |
@@ -80,12 +55,19 @@ static struct drm_driver driver = { | |||
80 | .mmap = drm_mmap, | 55 | .mmap = drm_mmap, |
81 | .poll = drm_poll, | 56 | .poll = drm_poll, |
82 | .fasync = drm_fasync, | 57 | .fasync = drm_fasync, |
83 | } | 58 | }, |
84 | , | 59 | |
85 | .pci_driver = { | 60 | .pci_driver = { |
86 | .name = DRIVER_NAME, | 61 | .name = DRIVER_NAME, |
87 | .id_table = pciidlist, | 62 | .id_table = pciidlist, |
88 | } | 63 | }, |
64 | |||
65 | .name = DRIVER_NAME, | ||
66 | .desc = DRIVER_DESC, | ||
67 | .date = DRIVER_DATE, | ||
68 | .major = DRIVER_MAJOR, | ||
69 | .minor = DRIVER_MINOR, | ||
70 | .patchlevel = DRIVER_PATCHLEVEL, | ||
89 | }; | 71 | }; |
90 | 72 | ||
91 | static int __init savage_init(void) | 73 | static int __init savage_init(void) |
diff --git a/drivers/char/drm/savage_drv.h b/drivers/char/drm/savage_drv.h index a4b0fa998a95..dd46cb85439c 100644 --- a/drivers/char/drm/savage_drv.h +++ b/drivers/char/drm/savage_drv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* savage_drv.h -- Private header for the savage driver | 1 | /* savage_drv.h -- Private header for the savage driver */ |
2 | * | 2 | /* |
3 | * Copyright 2004 Felix Kuehling | 3 | * Copyright 2004 Felix Kuehling |
4 | * All Rights Reserved. | 4 | * All Rights Reserved. |
5 | * | 5 | * |
@@ -192,7 +192,7 @@ typedef struct drm_savage_private { | |||
192 | /* Err, there is a macro wait_event in include/linux/wait.h. | 192 | /* Err, there is a macro wait_event in include/linux/wait.h. |
193 | * Avoid unwanted macro expansion. */ | 193 | * Avoid unwanted macro expansion. */ |
194 | void (*emit_clip_rect) (struct drm_savage_private * dev_priv, | 194 | void (*emit_clip_rect) (struct drm_savage_private * dev_priv, |
195 | drm_clip_rect_t * pbox); | 195 | const drm_clip_rect_t * pbox); |
196 | void (*dma_flush) (struct drm_savage_private * dev_priv); | 196 | void (*dma_flush) (struct drm_savage_private * dev_priv); |
197 | } drm_savage_private_t; | 197 | } drm_savage_private_t; |
198 | 198 | ||
@@ -208,16 +208,18 @@ extern void savage_dma_reset(drm_savage_private_t * dev_priv); | |||
208 | extern void savage_dma_wait(drm_savage_private_t * dev_priv, unsigned int page); | 208 | extern void savage_dma_wait(drm_savage_private_t * dev_priv, unsigned int page); |
209 | extern uint32_t *savage_dma_alloc(drm_savage_private_t * dev_priv, | 209 | extern uint32_t *savage_dma_alloc(drm_savage_private_t * dev_priv, |
210 | unsigned int n); | 210 | unsigned int n); |
211 | extern int savage_preinit(drm_device_t * dev, unsigned long chipset); | 211 | extern int savage_driver_load(drm_device_t *dev, unsigned long chipset); |
212 | extern int savage_postcleanup(drm_device_t * dev); | 212 | extern int savage_driver_firstopen(drm_device_t *dev); |
213 | extern void savage_driver_lastclose(drm_device_t *dev); | ||
214 | extern int savage_driver_unload(drm_device_t *dev); | ||
213 | extern int savage_do_cleanup_bci(drm_device_t * dev); | 215 | extern int savage_do_cleanup_bci(drm_device_t * dev); |
214 | extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); | 216 | extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); |
215 | 217 | ||
216 | /* state functions */ | 218 | /* state functions */ |
217 | extern void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, | 219 | extern void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, |
218 | drm_clip_rect_t * pbox); | 220 | const drm_clip_rect_t * pbox); |
219 | extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, | 221 | extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, |
220 | drm_clip_rect_t * pbox); | 222 | const drm_clip_rect_t * pbox); |
221 | 223 | ||
222 | #define SAVAGE_FB_SIZE_S3 0x01000000 /* 16MB */ | 224 | #define SAVAGE_FB_SIZE_S3 0x01000000 /* 16MB */ |
223 | #define SAVAGE_FB_SIZE_S4 0x02000000 /* 32MB */ | 225 | #define SAVAGE_FB_SIZE_S4 0x02000000 /* 32MB */ |
@@ -500,15 +502,6 @@ extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, | |||
500 | 502 | ||
501 | #define BCI_WRITE( val ) *bci_ptr++ = (uint32_t)(val) | 503 | #define BCI_WRITE( val ) *bci_ptr++ = (uint32_t)(val) |
502 | 504 | ||
503 | #define BCI_COPY_FROM_USER(src,n) do { \ | ||
504 | unsigned int i; \ | ||
505 | for (i = 0; i < n; ++i) { \ | ||
506 | uint32_t val; \ | ||
507 | DRM_GET_USER_UNCHECKED(val, &((uint32_t*)(src))[i]); \ | ||
508 | BCI_WRITE(val); \ | ||
509 | } \ | ||
510 | } while(0) | ||
511 | |||
512 | /* | 505 | /* |
513 | * command DMA support | 506 | * command DMA support |
514 | */ | 507 | */ |
@@ -534,8 +527,8 @@ extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, | |||
534 | 527 | ||
535 | #define DMA_WRITE( val ) *dma_ptr++ = (uint32_t)(val) | 528 | #define DMA_WRITE( val ) *dma_ptr++ = (uint32_t)(val) |
536 | 529 | ||
537 | #define DMA_COPY_FROM_USER(src,n) do { \ | 530 | #define DMA_COPY(src, n) do { \ |
538 | DRM_COPY_FROM_USER_UNCHECKED(dma_ptr, (src), (n)*4); \ | 531 | memcpy(dma_ptr, (src), (n)*4); \ |
539 | dma_ptr += n; \ | 532 | dma_ptr += n; \ |
540 | } while(0) | 533 | } while(0) |
541 | 534 | ||
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c index e87a5d59b99c..ef2581d16146 100644 --- a/drivers/char/drm/savage_state.c +++ b/drivers/char/drm/savage_state.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "savage_drv.h" | 27 | #include "savage_drv.h" |
28 | 28 | ||
29 | void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, | 29 | void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, |
30 | drm_clip_rect_t * pbox) | 30 | const drm_clip_rect_t * pbox) |
31 | { | 31 | { |
32 | uint32_t scstart = dev_priv->state.s3d.new_scstart; | 32 | uint32_t scstart = dev_priv->state.s3d.new_scstart; |
33 | uint32_t scend = dev_priv->state.s3d.new_scend; | 33 | uint32_t scend = dev_priv->state.s3d.new_scend; |
@@ -53,7 +53,7 @@ void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, | |||
53 | } | 53 | } |
54 | 54 | ||
55 | void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, | 55 | void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, |
56 | drm_clip_rect_t * pbox) | 56 | const drm_clip_rect_t * pbox) |
57 | { | 57 | { |
58 | uint32_t drawctrl0 = dev_priv->state.s4.new_drawctrl0; | 58 | uint32_t drawctrl0 = dev_priv->state.s4.new_drawctrl0; |
59 | uint32_t drawctrl1 = dev_priv->state.s4.new_drawctrl1; | 59 | uint32_t drawctrl1 = dev_priv->state.s4.new_drawctrl1; |
@@ -115,18 +115,19 @@ static int savage_verify_texaddr(drm_savage_private_t * dev_priv, int unit, | |||
115 | 115 | ||
116 | #define SAVE_STATE(reg,where) \ | 116 | #define SAVE_STATE(reg,where) \ |
117 | if(start <= reg && start+count > reg) \ | 117 | if(start <= reg && start+count > reg) \ |
118 | DRM_GET_USER_UNCHECKED(dev_priv->state.where, ®s[reg-start]) | 118 | dev_priv->state.where = regs[reg - start] |
119 | #define SAVE_STATE_MASK(reg,where,mask) do { \ | 119 | #define SAVE_STATE_MASK(reg,where,mask) do { \ |
120 | if(start <= reg && start+count > reg) { \ | 120 | if(start <= reg && start+count > reg) { \ |
121 | uint32_t tmp; \ | 121 | uint32_t tmp; \ |
122 | DRM_GET_USER_UNCHECKED(tmp, ®s[reg-start]); \ | 122 | tmp = regs[reg - start]; \ |
123 | dev_priv->state.where = (tmp & (mask)) | \ | 123 | dev_priv->state.where = (tmp & (mask)) | \ |
124 | (dev_priv->state.where & ~(mask)); \ | 124 | (dev_priv->state.where & ~(mask)); \ |
125 | } \ | 125 | } \ |
126 | } while (0) | 126 | } while (0) |
127 | |||
127 | static int savage_verify_state_s3d(drm_savage_private_t * dev_priv, | 128 | static int savage_verify_state_s3d(drm_savage_private_t * dev_priv, |
128 | unsigned int start, unsigned int count, | 129 | unsigned int start, unsigned int count, |
129 | const uint32_t __user * regs) | 130 | const uint32_t *regs) |
130 | { | 131 | { |
131 | if (start < SAVAGE_TEXPALADDR_S3D || | 132 | if (start < SAVAGE_TEXPALADDR_S3D || |
132 | start + count - 1 > SAVAGE_DESTTEXRWWATERMARK_S3D) { | 133 | start + count - 1 > SAVAGE_DESTTEXRWWATERMARK_S3D) { |
@@ -148,8 +149,7 @@ static int savage_verify_state_s3d(drm_savage_private_t * dev_priv, | |||
148 | SAVE_STATE(SAVAGE_TEXADDR_S3D, s3d.texaddr); | 149 | SAVE_STATE(SAVAGE_TEXADDR_S3D, s3d.texaddr); |
149 | if (dev_priv->state.s3d.texctrl & SAVAGE_TEXCTRL_TEXEN_MASK) | 150 | if (dev_priv->state.s3d.texctrl & SAVAGE_TEXCTRL_TEXEN_MASK) |
150 | return savage_verify_texaddr(dev_priv, 0, | 151 | return savage_verify_texaddr(dev_priv, 0, |
151 | dev_priv->state.s3d. | 152 | dev_priv->state.s3d.texaddr); |
152 | texaddr); | ||
153 | } | 153 | } |
154 | 154 | ||
155 | return 0; | 155 | return 0; |
@@ -157,7 +157,7 @@ static int savage_verify_state_s3d(drm_savage_private_t * dev_priv, | |||
157 | 157 | ||
158 | static int savage_verify_state_s4(drm_savage_private_t * dev_priv, | 158 | static int savage_verify_state_s4(drm_savage_private_t * dev_priv, |
159 | unsigned int start, unsigned int count, | 159 | unsigned int start, unsigned int count, |
160 | const uint32_t __user * regs) | 160 | const uint32_t *regs) |
161 | { | 161 | { |
162 | int ret = 0; | 162 | int ret = 0; |
163 | 163 | ||
@@ -174,19 +174,18 @@ static int savage_verify_state_s4(drm_savage_private_t * dev_priv, | |||
174 | ~SAVAGE_SCISSOR_MASK_S4); | 174 | ~SAVAGE_SCISSOR_MASK_S4); |
175 | 175 | ||
176 | /* if any texture regs were changed ... */ | 176 | /* if any texture regs were changed ... */ |
177 | if (start <= SAVAGE_TEXDESCR_S4 && start + count > SAVAGE_TEXPALADDR_S4) { | 177 | if (start <= SAVAGE_TEXDESCR_S4 && |
178 | start + count > SAVAGE_TEXPALADDR_S4) { | ||
178 | /* ... check texture state */ | 179 | /* ... check texture state */ |
179 | SAVE_STATE(SAVAGE_TEXDESCR_S4, s4.texdescr); | 180 | SAVE_STATE(SAVAGE_TEXDESCR_S4, s4.texdescr); |
180 | SAVE_STATE(SAVAGE_TEXADDR0_S4, s4.texaddr0); | 181 | SAVE_STATE(SAVAGE_TEXADDR0_S4, s4.texaddr0); |
181 | SAVE_STATE(SAVAGE_TEXADDR1_S4, s4.texaddr1); | 182 | SAVE_STATE(SAVAGE_TEXADDR1_S4, s4.texaddr1); |
182 | if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX0EN_MASK) | 183 | if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX0EN_MASK) |
183 | ret |= | 184 | ret |= savage_verify_texaddr(dev_priv, 0, |
184 | savage_verify_texaddr(dev_priv, 0, | 185 | dev_priv->state.s4.texaddr0); |
185 | dev_priv->state.s4.texaddr0); | ||
186 | if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX1EN_MASK) | 186 | if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX1EN_MASK) |
187 | ret |= | 187 | ret |= savage_verify_texaddr(dev_priv, 1, |
188 | savage_verify_texaddr(dev_priv, 1, | 188 | dev_priv->state.s4.texaddr1); |
189 | dev_priv->state.s4.texaddr1); | ||
190 | } | 189 | } |
191 | 190 | ||
192 | return ret; | 191 | return ret; |
@@ -197,7 +196,7 @@ static int savage_verify_state_s4(drm_savage_private_t * dev_priv, | |||
197 | 196 | ||
198 | static int savage_dispatch_state(drm_savage_private_t * dev_priv, | 197 | static int savage_dispatch_state(drm_savage_private_t * dev_priv, |
199 | const drm_savage_cmd_header_t * cmd_header, | 198 | const drm_savage_cmd_header_t * cmd_header, |
200 | const uint32_t __user * regs) | 199 | const uint32_t *regs) |
201 | { | 200 | { |
202 | unsigned int count = cmd_header->state.count; | 201 | unsigned int count = cmd_header->state.count; |
203 | unsigned int start = cmd_header->state.start; | 202 | unsigned int start = cmd_header->state.start; |
@@ -209,9 +208,6 @@ static int savage_dispatch_state(drm_savage_private_t * dev_priv, | |||
209 | if (!count) | 208 | if (!count) |
210 | return 0; | 209 | return 0; |
211 | 210 | ||
212 | if (DRM_VERIFYAREA_READ(regs, count * 4)) | ||
213 | return DRM_ERR(EFAULT); | ||
214 | |||
215 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 211 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
216 | ret = savage_verify_state_s3d(dev_priv, start, count, regs); | 212 | ret = savage_verify_state_s3d(dev_priv, start, count, regs); |
217 | if (ret != 0) | 213 | if (ret != 0) |
@@ -236,8 +232,8 @@ static int savage_dispatch_state(drm_savage_private_t * dev_priv, | |||
236 | /* scissor regs are emitted in savage_dispatch_draw */ | 232 | /* scissor regs are emitted in savage_dispatch_draw */ |
237 | if (start < SAVAGE_DRAWCTRL0_S4) { | 233 | if (start < SAVAGE_DRAWCTRL0_S4) { |
238 | if (start + count > SAVAGE_DRAWCTRL1_S4 + 1) | 234 | if (start + count > SAVAGE_DRAWCTRL1_S4 + 1) |
239 | count2 = | 235 | count2 = count - |
240 | count - (SAVAGE_DRAWCTRL1_S4 + 1 - start); | 236 | (SAVAGE_DRAWCTRL1_S4 + 1 - start); |
241 | if (start + count > SAVAGE_DRAWCTRL0_S4) | 237 | if (start + count > SAVAGE_DRAWCTRL0_S4) |
242 | count = SAVAGE_DRAWCTRL0_S4 - start; | 238 | count = SAVAGE_DRAWCTRL0_S4 - start; |
243 | } else if (start <= SAVAGE_DRAWCTRL1_S4) { | 239 | } else if (start <= SAVAGE_DRAWCTRL1_S4) { |
@@ -263,7 +259,7 @@ static int savage_dispatch_state(drm_savage_private_t * dev_priv, | |||
263 | while (count > 0) { | 259 | while (count > 0) { |
264 | unsigned int n = count < 255 ? count : 255; | 260 | unsigned int n = count < 255 ? count : 255; |
265 | DMA_SET_REGISTERS(start, n); | 261 | DMA_SET_REGISTERS(start, n); |
266 | DMA_COPY_FROM_USER(regs, n); | 262 | DMA_COPY(regs, n); |
267 | count -= n; | 263 | count -= n; |
268 | start += n; | 264 | start += n; |
269 | regs += n; | 265 | regs += n; |
@@ -421,8 +417,8 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, | |||
421 | 417 | ||
422 | static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | 418 | static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, |
423 | const drm_savage_cmd_header_t * cmd_header, | 419 | const drm_savage_cmd_header_t * cmd_header, |
424 | const uint32_t __user * vtxbuf, | 420 | const uint32_t *vtxbuf, unsigned int vb_size, |
425 | unsigned int vb_size, unsigned int vb_stride) | 421 | unsigned int vb_stride) |
426 | { | 422 | { |
427 | unsigned char reorder = 0; | 423 | unsigned char reorder = 0; |
428 | unsigned int prim = cmd_header->prim.prim; | 424 | unsigned int prim = cmd_header->prim.prim; |
@@ -507,8 +503,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
507 | 503 | ||
508 | for (i = start; i < start + count; ++i) { | 504 | for (i = start; i < start + count; ++i) { |
509 | unsigned int j = i + reorder[i % 3]; | 505 | unsigned int j = i + reorder[i % 3]; |
510 | DMA_COPY_FROM_USER(&vtxbuf[vb_stride * j], | 506 | DMA_COPY(&vtxbuf[vb_stride * j], vtx_size); |
511 | vtx_size); | ||
512 | } | 507 | } |
513 | 508 | ||
514 | DMA_COMMIT(); | 509 | DMA_COMMIT(); |
@@ -517,13 +512,12 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
517 | DMA_DRAW_PRIMITIVE(count, prim, skip); | 512 | DMA_DRAW_PRIMITIVE(count, prim, skip); |
518 | 513 | ||
519 | if (vb_stride == vtx_size) { | 514 | if (vb_stride == vtx_size) { |
520 | DMA_COPY_FROM_USER(&vtxbuf[vb_stride * start], | 515 | DMA_COPY(&vtxbuf[vb_stride * start], |
521 | vtx_size * count); | 516 | vtx_size * count); |
522 | } else { | 517 | } else { |
523 | for (i = start; i < start + count; ++i) { | 518 | for (i = start; i < start + count; ++i) { |
524 | DMA_COPY_FROM_USER(&vtxbuf | 519 | DMA_COPY(&vtxbuf [vb_stride * i], |
525 | [vb_stride * i], | 520 | vtx_size); |
526 | vtx_size); | ||
527 | } | 521 | } |
528 | } | 522 | } |
529 | 523 | ||
@@ -541,7 +535,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
541 | 535 | ||
542 | static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | 536 | static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, |
543 | const drm_savage_cmd_header_t * cmd_header, | 537 | const drm_savage_cmd_header_t * cmd_header, |
544 | const uint16_t __user * usr_idx, | 538 | const uint16_t *idx, |
545 | const drm_buf_t * dmabuf) | 539 | const drm_buf_t * dmabuf) |
546 | { | 540 | { |
547 | unsigned char reorder = 0; | 541 | unsigned char reorder = 0; |
@@ -628,11 +622,8 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
628 | while (n != 0) { | 622 | while (n != 0) { |
629 | /* Can emit up to 255 indices (85 triangles) at once. */ | 623 | /* Can emit up to 255 indices (85 triangles) at once. */ |
630 | unsigned int count = n > 255 ? 255 : n; | 624 | unsigned int count = n > 255 ? 255 : n; |
631 | /* Is it ok to allocate 510 bytes on the stack in an ioctl? */ | ||
632 | uint16_t idx[255]; | ||
633 | 625 | ||
634 | /* Copy and check indices */ | 626 | /* check indices */ |
635 | DRM_COPY_FROM_USER_UNCHECKED(idx, usr_idx, count * 2); | ||
636 | for (i = 0; i < count; ++i) { | 627 | for (i = 0; i < count; ++i) { |
637 | if (idx[i] > dmabuf->total / 32) { | 628 | if (idx[i] > dmabuf->total / 32) { |
638 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", | 629 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", |
@@ -652,8 +643,8 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
652 | 643 | ||
653 | for (i = 1; i + 1 < count; i += 2) | 644 | for (i = 1; i + 1 < count; i += 2) |
654 | BCI_WRITE(idx[i + reorder[i % 3]] | | 645 | BCI_WRITE(idx[i + reorder[i % 3]] | |
655 | (idx[i + 1 + reorder[(i + 1) % 3]] << | 646 | (idx[i + 1 + |
656 | 16)); | 647 | reorder[(i + 1) % 3]] << 16)); |
657 | if (i < count) | 648 | if (i < count) |
658 | BCI_WRITE(idx[i + reorder[i % 3]]); | 649 | BCI_WRITE(idx[i + reorder[i % 3]]); |
659 | } else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 650 | } else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
@@ -674,7 +665,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
674 | BCI_WRITE(idx[i]); | 665 | BCI_WRITE(idx[i]); |
675 | } | 666 | } |
676 | 667 | ||
677 | usr_idx += count; | 668 | idx += count; |
678 | n -= count; | 669 | n -= count; |
679 | 670 | ||
680 | prim |= BCI_CMD_DRAW_CONT; | 671 | prim |= BCI_CMD_DRAW_CONT; |
@@ -685,8 +676,8 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
685 | 676 | ||
686 | static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | 677 | static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, |
687 | const drm_savage_cmd_header_t * cmd_header, | 678 | const drm_savage_cmd_header_t * cmd_header, |
688 | const uint16_t __user * usr_idx, | 679 | const uint16_t *idx, |
689 | const uint32_t __user * vtxbuf, | 680 | const uint32_t *vtxbuf, |
690 | unsigned int vb_size, unsigned int vb_stride) | 681 | unsigned int vb_size, unsigned int vb_stride) |
691 | { | 682 | { |
692 | unsigned char reorder = 0; | 683 | unsigned char reorder = 0; |
@@ -751,11 +742,8 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
751 | while (n != 0) { | 742 | while (n != 0) { |
752 | /* Can emit up to 255 vertices (85 triangles) at once. */ | 743 | /* Can emit up to 255 vertices (85 triangles) at once. */ |
753 | unsigned int count = n > 255 ? 255 : n; | 744 | unsigned int count = n > 255 ? 255 : n; |
754 | /* Is it ok to allocate 510 bytes on the stack in an ioctl? */ | 745 | |
755 | uint16_t idx[255]; | 746 | /* Check indices */ |
756 | |||
757 | /* Copy and check indices */ | ||
758 | DRM_COPY_FROM_USER_UNCHECKED(idx, usr_idx, count * 2); | ||
759 | for (i = 0; i < count; ++i) { | 747 | for (i = 0; i < count; ++i) { |
760 | if (idx[i] > vb_size / (vb_stride * 4)) { | 748 | if (idx[i] > vb_size / (vb_stride * 4)) { |
761 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", | 749 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", |
@@ -775,8 +763,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
775 | 763 | ||
776 | for (i = 0; i < count; ++i) { | 764 | for (i = 0; i < count; ++i) { |
777 | unsigned int j = idx[i + reorder[i % 3]]; | 765 | unsigned int j = idx[i + reorder[i % 3]]; |
778 | DMA_COPY_FROM_USER(&vtxbuf[vb_stride * j], | 766 | DMA_COPY(&vtxbuf[vb_stride * j], vtx_size); |
779 | vtx_size); | ||
780 | } | 767 | } |
781 | 768 | ||
782 | DMA_COMMIT(); | 769 | DMA_COMMIT(); |
@@ -786,14 +773,13 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
786 | 773 | ||
787 | for (i = 0; i < count; ++i) { | 774 | for (i = 0; i < count; ++i) { |
788 | unsigned int j = idx[i]; | 775 | unsigned int j = idx[i]; |
789 | DMA_COPY_FROM_USER(&vtxbuf[vb_stride * j], | 776 | DMA_COPY(&vtxbuf[vb_stride * j], vtx_size); |
790 | vtx_size); | ||
791 | } | 777 | } |
792 | 778 | ||
793 | DMA_COMMIT(); | 779 | DMA_COMMIT(); |
794 | } | 780 | } |
795 | 781 | ||
796 | usr_idx += count; | 782 | idx += count; |
797 | n -= count; | 783 | n -= count; |
798 | 784 | ||
799 | prim |= BCI_CMD_DRAW_CONT; | 785 | prim |= BCI_CMD_DRAW_CONT; |
@@ -804,11 +790,11 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
804 | 790 | ||
805 | static int savage_dispatch_clear(drm_savage_private_t * dev_priv, | 791 | static int savage_dispatch_clear(drm_savage_private_t * dev_priv, |
806 | const drm_savage_cmd_header_t * cmd_header, | 792 | const drm_savage_cmd_header_t * cmd_header, |
807 | const drm_savage_cmd_header_t __user * data, | 793 | const drm_savage_cmd_header_t *data, |
808 | unsigned int nbox, | 794 | unsigned int nbox, |
809 | const drm_clip_rect_t __user * usr_boxes) | 795 | const drm_clip_rect_t *boxes) |
810 | { | 796 | { |
811 | unsigned int flags = cmd_header->clear0.flags, mask, value; | 797 | unsigned int flags = cmd_header->clear0.flags; |
812 | unsigned int clear_cmd; | 798 | unsigned int clear_cmd; |
813 | unsigned int i, nbufs; | 799 | unsigned int i, nbufs; |
814 | DMA_LOCALS; | 800 | DMA_LOCALS; |
@@ -816,9 +802,6 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv, | |||
816 | if (nbox == 0) | 802 | if (nbox == 0) |
817 | return 0; | 803 | return 0; |
818 | 804 | ||
819 | DRM_GET_USER_UNCHECKED(mask, &data->clear1.mask); | ||
820 | DRM_GET_USER_UNCHECKED(value, &data->clear1.value); | ||
821 | |||
822 | clear_cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | | 805 | clear_cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | |
823 | BCI_CMD_SEND_COLOR | BCI_CMD_DEST_PBD_NEW; | 806 | BCI_CMD_SEND_COLOR | BCI_CMD_DEST_PBD_NEW; |
824 | BCI_CMD_SET_ROP(clear_cmd, 0xCC); | 807 | BCI_CMD_SET_ROP(clear_cmd, 0xCC); |
@@ -828,21 +811,19 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv, | |||
828 | if (nbufs == 0) | 811 | if (nbufs == 0) |
829 | return 0; | 812 | return 0; |
830 | 813 | ||
831 | if (mask != 0xffffffff) { | 814 | if (data->clear1.mask != 0xffffffff) { |
832 | /* set mask */ | 815 | /* set mask */ |
833 | BEGIN_DMA(2); | 816 | BEGIN_DMA(2); |
834 | DMA_SET_REGISTERS(SAVAGE_BITPLANEWTMASK, 1); | 817 | DMA_SET_REGISTERS(SAVAGE_BITPLANEWTMASK, 1); |
835 | DMA_WRITE(mask); | 818 | DMA_WRITE(data->clear1.mask); |
836 | DMA_COMMIT(); | 819 | DMA_COMMIT(); |
837 | } | 820 | } |
838 | for (i = 0; i < nbox; ++i) { | 821 | for (i = 0; i < nbox; ++i) { |
839 | drm_clip_rect_t box; | ||
840 | unsigned int x, y, w, h; | 822 | unsigned int x, y, w, h; |
841 | unsigned int buf; | 823 | unsigned int buf; |
842 | DRM_COPY_FROM_USER_UNCHECKED(&box, &usr_boxes[i], sizeof(box)); | 824 | x = boxes[i].x1, y = boxes[i].y1; |
843 | x = box.x1, y = box.y1; | 825 | w = boxes[i].x2 - boxes[i].x1; |
844 | w = box.x2 - box.x1; | 826 | h = boxes[i].y2 - boxes[i].y1; |
845 | h = box.y2 - box.y1; | ||
846 | BEGIN_DMA(nbufs * 6); | 827 | BEGIN_DMA(nbufs * 6); |
847 | for (buf = SAVAGE_FRONT; buf <= SAVAGE_DEPTH; buf <<= 1) { | 828 | for (buf = SAVAGE_FRONT; buf <= SAVAGE_DEPTH; buf <<= 1) { |
848 | if (!(flags & buf)) | 829 | if (!(flags & buf)) |
@@ -862,13 +843,13 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv, | |||
862 | DMA_WRITE(dev_priv->depth_bd); | 843 | DMA_WRITE(dev_priv->depth_bd); |
863 | break; | 844 | break; |
864 | } | 845 | } |
865 | DMA_WRITE(value); | 846 | DMA_WRITE(data->clear1.value); |
866 | DMA_WRITE(BCI_X_Y(x, y)); | 847 | DMA_WRITE(BCI_X_Y(x, y)); |
867 | DMA_WRITE(BCI_W_H(w, h)); | 848 | DMA_WRITE(BCI_W_H(w, h)); |
868 | } | 849 | } |
869 | DMA_COMMIT(); | 850 | DMA_COMMIT(); |
870 | } | 851 | } |
871 | if (mask != 0xffffffff) { | 852 | if (data->clear1.mask != 0xffffffff) { |
872 | /* reset mask */ | 853 | /* reset mask */ |
873 | BEGIN_DMA(2); | 854 | BEGIN_DMA(2); |
874 | DMA_SET_REGISTERS(SAVAGE_BITPLANEWTMASK, 1); | 855 | DMA_SET_REGISTERS(SAVAGE_BITPLANEWTMASK, 1); |
@@ -880,8 +861,7 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv, | |||
880 | } | 861 | } |
881 | 862 | ||
882 | static int savage_dispatch_swap(drm_savage_private_t * dev_priv, | 863 | static int savage_dispatch_swap(drm_savage_private_t * dev_priv, |
883 | unsigned int nbox, | 864 | unsigned int nbox, const drm_clip_rect_t *boxes) |
884 | const drm_clip_rect_t __user * usr_boxes) | ||
885 | { | 865 | { |
886 | unsigned int swap_cmd; | 866 | unsigned int swap_cmd; |
887 | unsigned int i; | 867 | unsigned int i; |
@@ -895,16 +875,14 @@ static int savage_dispatch_swap(drm_savage_private_t * dev_priv, | |||
895 | BCI_CMD_SET_ROP(swap_cmd, 0xCC); | 875 | BCI_CMD_SET_ROP(swap_cmd, 0xCC); |
896 | 876 | ||
897 | for (i = 0; i < nbox; ++i) { | 877 | for (i = 0; i < nbox; ++i) { |
898 | drm_clip_rect_t box; | ||
899 | DRM_COPY_FROM_USER_UNCHECKED(&box, &usr_boxes[i], sizeof(box)); | ||
900 | |||
901 | BEGIN_DMA(6); | 878 | BEGIN_DMA(6); |
902 | DMA_WRITE(swap_cmd); | 879 | DMA_WRITE(swap_cmd); |
903 | DMA_WRITE(dev_priv->back_offset); | 880 | DMA_WRITE(dev_priv->back_offset); |
904 | DMA_WRITE(dev_priv->back_bd); | 881 | DMA_WRITE(dev_priv->back_bd); |
905 | DMA_WRITE(BCI_X_Y(box.x1, box.y1)); | 882 | DMA_WRITE(BCI_X_Y(boxes[i].x1, boxes[i].y1)); |
906 | DMA_WRITE(BCI_X_Y(box.x1, box.y1)); | 883 | DMA_WRITE(BCI_X_Y(boxes[i].x1, boxes[i].y1)); |
907 | DMA_WRITE(BCI_W_H(box.x2 - box.x1, box.y2 - box.y1)); | 884 | DMA_WRITE(BCI_W_H(boxes[i].x2 - boxes[i].x1, |
885 | boxes[i].y2 - boxes[i].y1)); | ||
908 | DMA_COMMIT(); | 886 | DMA_COMMIT(); |
909 | } | 887 | } |
910 | 888 | ||
@@ -912,68 +890,52 @@ static int savage_dispatch_swap(drm_savage_private_t * dev_priv, | |||
912 | } | 890 | } |
913 | 891 | ||
914 | static int savage_dispatch_draw(drm_savage_private_t * dev_priv, | 892 | static int savage_dispatch_draw(drm_savage_private_t * dev_priv, |
915 | const drm_savage_cmd_header_t __user * start, | 893 | const drm_savage_cmd_header_t *start, |
916 | const drm_savage_cmd_header_t __user * end, | 894 | const drm_savage_cmd_header_t *end, |
917 | const drm_buf_t * dmabuf, | 895 | const drm_buf_t * dmabuf, |
918 | const unsigned int __user * usr_vtxbuf, | 896 | const unsigned int *vtxbuf, |
919 | unsigned int vb_size, unsigned int vb_stride, | 897 | unsigned int vb_size, unsigned int vb_stride, |
920 | unsigned int nbox, | 898 | unsigned int nbox, |
921 | const drm_clip_rect_t __user * usr_boxes) | 899 | const drm_clip_rect_t *boxes) |
922 | { | 900 | { |
923 | unsigned int i, j; | 901 | unsigned int i, j; |
924 | int ret; | 902 | int ret; |
925 | 903 | ||
926 | for (i = 0; i < nbox; ++i) { | 904 | for (i = 0; i < nbox; ++i) { |
927 | drm_clip_rect_t box; | 905 | const drm_savage_cmd_header_t *cmdbuf; |
928 | const drm_savage_cmd_header_t __user *usr_cmdbuf; | 906 | dev_priv->emit_clip_rect(dev_priv, &boxes[i]); |
929 | DRM_COPY_FROM_USER_UNCHECKED(&box, &usr_boxes[i], sizeof(box)); | ||
930 | dev_priv->emit_clip_rect(dev_priv, &box); | ||
931 | 907 | ||
932 | usr_cmdbuf = start; | 908 | cmdbuf = start; |
933 | while (usr_cmdbuf < end) { | 909 | while (cmdbuf < end) { |
934 | drm_savage_cmd_header_t cmd_header; | 910 | drm_savage_cmd_header_t cmd_header; |
935 | DRM_COPY_FROM_USER_UNCHECKED(&cmd_header, usr_cmdbuf, | 911 | cmd_header = *cmdbuf; |
936 | sizeof(cmd_header)); | 912 | cmdbuf++; |
937 | usr_cmdbuf++; | ||
938 | switch (cmd_header.cmd.cmd) { | 913 | switch (cmd_header.cmd.cmd) { |
939 | case SAVAGE_CMD_DMA_PRIM: | 914 | case SAVAGE_CMD_DMA_PRIM: |
940 | ret = | 915 | ret = savage_dispatch_dma_prim( |
941 | savage_dispatch_dma_prim(dev_priv, | 916 | dev_priv, &cmd_header, dmabuf); |
942 | &cmd_header, | ||
943 | dmabuf); | ||
944 | break; | 917 | break; |
945 | case SAVAGE_CMD_VB_PRIM: | 918 | case SAVAGE_CMD_VB_PRIM: |
946 | ret = | 919 | ret = savage_dispatch_vb_prim( |
947 | savage_dispatch_vb_prim(dev_priv, | 920 | dev_priv, &cmd_header, |
948 | &cmd_header, | 921 | vtxbuf, vb_size, vb_stride); |
949 | (const uint32_t | ||
950 | __user *) | ||
951 | usr_vtxbuf, vb_size, | ||
952 | vb_stride); | ||
953 | break; | 922 | break; |
954 | case SAVAGE_CMD_DMA_IDX: | 923 | case SAVAGE_CMD_DMA_IDX: |
955 | j = (cmd_header.idx.count + 3) / 4; | 924 | j = (cmd_header.idx.count + 3) / 4; |
956 | /* j was check in savage_bci_cmdbuf */ | 925 | /* j was check in savage_bci_cmdbuf */ |
957 | ret = | 926 | ret = savage_dispatch_dma_idx(dev_priv, |
958 | savage_dispatch_dma_idx(dev_priv, | 927 | &cmd_header, (const uint16_t *)cmdbuf, |
959 | &cmd_header, | 928 | dmabuf); |
960 | (const uint16_t | 929 | cmdbuf += j; |
961 | __user *) | ||
962 | usr_cmdbuf, dmabuf); | ||
963 | usr_cmdbuf += j; | ||
964 | break; | 930 | break; |
965 | case SAVAGE_CMD_VB_IDX: | 931 | case SAVAGE_CMD_VB_IDX: |
966 | j = (cmd_header.idx.count + 3) / 4; | 932 | j = (cmd_header.idx.count + 3) / 4; |
967 | /* j was check in savage_bci_cmdbuf */ | 933 | /* j was check in savage_bci_cmdbuf */ |
968 | ret = | 934 | ret = savage_dispatch_vb_idx(dev_priv, |
969 | savage_dispatch_vb_idx(dev_priv, | 935 | &cmd_header, (const uint16_t *)cmdbuf, |
970 | &cmd_header, | 936 | (const uint32_t *)vtxbuf, vb_size, |
971 | (const uint16_t | 937 | vb_stride); |
972 | __user *)usr_cmdbuf, | 938 | cmdbuf += j; |
973 | (const uint32_t | ||
974 | __user *)usr_vtxbuf, | ||
975 | vb_size, vb_stride); | ||
976 | usr_cmdbuf += j; | ||
977 | break; | 939 | break; |
978 | default: | 940 | default: |
979 | /* What's the best return code? EFAULT? */ | 941 | /* What's the best return code? EFAULT? */ |
@@ -998,10 +960,10 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
998 | drm_device_dma_t *dma = dev->dma; | 960 | drm_device_dma_t *dma = dev->dma; |
999 | drm_buf_t *dmabuf; | 961 | drm_buf_t *dmabuf; |
1000 | drm_savage_cmdbuf_t cmdbuf; | 962 | drm_savage_cmdbuf_t cmdbuf; |
1001 | drm_savage_cmd_header_t __user *usr_cmdbuf; | 963 | drm_savage_cmd_header_t *kcmd_addr = NULL; |
1002 | drm_savage_cmd_header_t __user *first_draw_cmd; | 964 | drm_savage_cmd_header_t *first_draw_cmd; |
1003 | unsigned int __user *usr_vtxbuf; | 965 | unsigned int *kvb_addr = NULL; |
1004 | drm_clip_rect_t __user *usr_boxes; | 966 | drm_clip_rect_t *kbox_addr = NULL; |
1005 | unsigned int i, j; | 967 | unsigned int i, j; |
1006 | int ret = 0; | 968 | int ret = 0; |
1007 | 969 | ||
@@ -1024,15 +986,53 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1024 | dmabuf = NULL; | 986 | dmabuf = NULL; |
1025 | } | 987 | } |
1026 | 988 | ||
1027 | usr_cmdbuf = (drm_savage_cmd_header_t __user *) cmdbuf.cmd_addr; | 989 | /* Copy the user buffers into kernel temporary areas. This hasn't been |
1028 | usr_vtxbuf = (unsigned int __user *)cmdbuf.vb_addr; | 990 | * a performance loss compared to VERIFYAREA_READ/ |
1029 | usr_boxes = (drm_clip_rect_t __user *) cmdbuf.box_addr; | 991 | * COPY_FROM_USER_UNCHECKED when done in other drivers, and is correct |
1030 | if ((cmdbuf.size && DRM_VERIFYAREA_READ(usr_cmdbuf, cmdbuf.size * 8)) || | 992 | * for locking on FreeBSD. |
1031 | (cmdbuf.vb_size && DRM_VERIFYAREA_READ(usr_vtxbuf, cmdbuf.vb_size)) | 993 | */ |
1032 | || (cmdbuf.nbox | 994 | if (cmdbuf.size) { |
1033 | && DRM_VERIFYAREA_READ(usr_boxes, | 995 | kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); |
1034 | cmdbuf.nbox * sizeof(drm_clip_rect_t)))) | 996 | if (kcmd_addr == NULL) |
1035 | return DRM_ERR(EFAULT); | 997 | return ENOMEM; |
998 | |||
999 | if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, | ||
1000 | cmdbuf.size * 8)) | ||
1001 | { | ||
1002 | drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER); | ||
1003 | return DRM_ERR(EFAULT); | ||
1004 | } | ||
1005 | cmdbuf.cmd_addr = kcmd_addr; | ||
1006 | } | ||
1007 | if (cmdbuf.vb_size) { | ||
1008 | kvb_addr = drm_alloc(cmdbuf.vb_size, DRM_MEM_DRIVER); | ||
1009 | if (kvb_addr == NULL) { | ||
1010 | ret = DRM_ERR(ENOMEM); | ||
1011 | goto done; | ||
1012 | } | ||
1013 | |||
1014 | if (DRM_COPY_FROM_USER(kvb_addr, cmdbuf.vb_addr, | ||
1015 | cmdbuf.vb_size)) { | ||
1016 | ret = DRM_ERR(EFAULT); | ||
1017 | goto done; | ||
1018 | } | ||
1019 | cmdbuf.vb_addr = kvb_addr; | ||
1020 | } | ||
1021 | if (cmdbuf.nbox) { | ||
1022 | kbox_addr = drm_alloc(cmdbuf.nbox * sizeof(drm_clip_rect_t), | ||
1023 | DRM_MEM_DRIVER); | ||
1024 | if (kbox_addr == NULL) { | ||
1025 | ret = DRM_ERR(ENOMEM); | ||
1026 | goto done; | ||
1027 | } | ||
1028 | |||
1029 | if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf.box_addr, | ||
1030 | cmdbuf.nbox * sizeof(drm_clip_rect_t))) { | ||
1031 | ret = DRM_ERR(EFAULT); | ||
1032 | goto done; | ||
1033 | } | ||
1034 | cmdbuf.box_addr = kbox_addr; | ||
1035 | } | ||
1036 | 1036 | ||
1037 | /* Make sure writes to DMA buffers are finished before sending | 1037 | /* Make sure writes to DMA buffers are finished before sending |
1038 | * DMA commands to the graphics hardware. */ | 1038 | * DMA commands to the graphics hardware. */ |
@@ -1046,9 +1046,8 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1046 | first_draw_cmd = NULL; | 1046 | first_draw_cmd = NULL; |
1047 | while (i < cmdbuf.size) { | 1047 | while (i < cmdbuf.size) { |
1048 | drm_savage_cmd_header_t cmd_header; | 1048 | drm_savage_cmd_header_t cmd_header; |
1049 | DRM_COPY_FROM_USER_UNCHECKED(&cmd_header, usr_cmdbuf, | 1049 | cmd_header = *(drm_savage_cmd_header_t *)cmdbuf.cmd_addr; |
1050 | sizeof(cmd_header)); | 1050 | cmdbuf.cmd_addr++; |
1051 | usr_cmdbuf++; | ||
1052 | i++; | 1051 | i++; |
1053 | 1052 | ||
1054 | /* Group drawing commands with same state to minimize | 1053 | /* Group drawing commands with same state to minimize |
@@ -1068,21 +1067,18 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1068 | case SAVAGE_CMD_DMA_PRIM: | 1067 | case SAVAGE_CMD_DMA_PRIM: |
1069 | case SAVAGE_CMD_VB_PRIM: | 1068 | case SAVAGE_CMD_VB_PRIM: |
1070 | if (!first_draw_cmd) | 1069 | if (!first_draw_cmd) |
1071 | first_draw_cmd = usr_cmdbuf - 1; | 1070 | first_draw_cmd = cmdbuf.cmd_addr - 1; |
1072 | usr_cmdbuf += j; | 1071 | cmdbuf.cmd_addr += j; |
1073 | i += j; | 1072 | i += j; |
1074 | break; | 1073 | break; |
1075 | default: | 1074 | default: |
1076 | if (first_draw_cmd) { | 1075 | if (first_draw_cmd) { |
1077 | ret = | 1076 | ret = savage_dispatch_draw( |
1078 | savage_dispatch_draw(dev_priv, | 1077 | dev_priv, first_draw_cmd, |
1079 | first_draw_cmd, | 1078 | cmdbuf.cmd_addr - 1, |
1080 | usr_cmdbuf - 1, dmabuf, | 1079 | dmabuf, cmdbuf.vb_addr, cmdbuf.vb_size, |
1081 | usr_vtxbuf, | 1080 | cmdbuf.vb_stride, |
1082 | cmdbuf.vb_size, | 1081 | cmdbuf.nbox, cmdbuf.box_addr); |
1083 | cmdbuf.vb_stride, | ||
1084 | cmdbuf.nbox, | ||
1085 | usr_boxes); | ||
1086 | if (ret != 0) | 1082 | if (ret != 0) |
1087 | return ret; | 1083 | return ret; |
1088 | first_draw_cmd = NULL; | 1084 | first_draw_cmd = NULL; |
@@ -1098,12 +1094,12 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1098 | DRM_ERROR("command SAVAGE_CMD_STATE extends " | 1094 | DRM_ERROR("command SAVAGE_CMD_STATE extends " |
1099 | "beyond end of command buffer\n"); | 1095 | "beyond end of command buffer\n"); |
1100 | DMA_FLUSH(); | 1096 | DMA_FLUSH(); |
1101 | return DRM_ERR(EINVAL); | 1097 | ret = DRM_ERR(EINVAL); |
1098 | goto done; | ||
1102 | } | 1099 | } |
1103 | ret = savage_dispatch_state(dev_priv, &cmd_header, | 1100 | ret = savage_dispatch_state(dev_priv, &cmd_header, |
1104 | (uint32_t __user *) | 1101 | (const uint32_t *)cmdbuf.cmd_addr); |
1105 | usr_cmdbuf); | 1102 | cmdbuf.cmd_addr += j; |
1106 | usr_cmdbuf += j; | ||
1107 | i += j; | 1103 | i += j; |
1108 | break; | 1104 | break; |
1109 | case SAVAGE_CMD_CLEAR: | 1105 | case SAVAGE_CMD_CLEAR: |
@@ -1111,39 +1107,40 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1111 | DRM_ERROR("command SAVAGE_CMD_CLEAR extends " | 1107 | DRM_ERROR("command SAVAGE_CMD_CLEAR extends " |
1112 | "beyond end of command buffer\n"); | 1108 | "beyond end of command buffer\n"); |
1113 | DMA_FLUSH(); | 1109 | DMA_FLUSH(); |
1114 | return DRM_ERR(EINVAL); | 1110 | ret = DRM_ERR(EINVAL); |
1111 | goto done; | ||
1115 | } | 1112 | } |
1116 | ret = savage_dispatch_clear(dev_priv, &cmd_header, | 1113 | ret = savage_dispatch_clear(dev_priv, &cmd_header, |
1117 | usr_cmdbuf, | 1114 | cmdbuf.cmd_addr, |
1118 | cmdbuf.nbox, usr_boxes); | 1115 | cmdbuf.nbox, cmdbuf.box_addr); |
1119 | usr_cmdbuf++; | 1116 | cmdbuf.cmd_addr++; |
1120 | i++; | 1117 | i++; |
1121 | break; | 1118 | break; |
1122 | case SAVAGE_CMD_SWAP: | 1119 | case SAVAGE_CMD_SWAP: |
1123 | ret = savage_dispatch_swap(dev_priv, | 1120 | ret = savage_dispatch_swap(dev_priv, cmdbuf.nbox, |
1124 | cmdbuf.nbox, usr_boxes); | 1121 | cmdbuf.box_addr); |
1125 | break; | 1122 | break; |
1126 | default: | 1123 | default: |
1127 | DRM_ERROR("invalid command 0x%x\n", cmd_header.cmd.cmd); | 1124 | DRM_ERROR("invalid command 0x%x\n", cmd_header.cmd.cmd); |
1128 | DMA_FLUSH(); | 1125 | DMA_FLUSH(); |
1129 | return DRM_ERR(EINVAL); | 1126 | ret = DRM_ERR(EINVAL); |
1127 | goto done; | ||
1130 | } | 1128 | } |
1131 | 1129 | ||
1132 | if (ret != 0) { | 1130 | if (ret != 0) { |
1133 | DMA_FLUSH(); | 1131 | DMA_FLUSH(); |
1134 | return ret; | 1132 | goto done; |
1135 | } | 1133 | } |
1136 | } | 1134 | } |
1137 | 1135 | ||
1138 | if (first_draw_cmd) { | 1136 | if (first_draw_cmd) { |
1139 | ret = | 1137 | ret = savage_dispatch_draw ( |
1140 | savage_dispatch_draw(dev_priv, first_draw_cmd, usr_cmdbuf, | 1138 | dev_priv, first_draw_cmd, cmdbuf.cmd_addr, dmabuf, |
1141 | dmabuf, usr_vtxbuf, cmdbuf.vb_size, | 1139 | cmdbuf.vb_addr, cmdbuf.vb_size, cmdbuf.vb_stride, |
1142 | cmdbuf.vb_stride, cmdbuf.nbox, | 1140 | cmdbuf.nbox, cmdbuf.box_addr); |
1143 | usr_boxes); | ||
1144 | if (ret != 0) { | 1141 | if (ret != 0) { |
1145 | DMA_FLUSH(); | 1142 | DMA_FLUSH(); |
1146 | return ret; | 1143 | goto done; |
1147 | } | 1144 | } |
1148 | } | 1145 | } |
1149 | 1146 | ||
@@ -1157,5 +1154,12 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1157 | savage_freelist_put(dev, dmabuf); | 1154 | savage_freelist_put(dev, dmabuf); |
1158 | } | 1155 | } |
1159 | 1156 | ||
1160 | return 0; | 1157 | done: |
1158 | /* If we didn't need to allocate them, these'll be NULL */ | ||
1159 | drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER); | ||
1160 | drm_free(kvb_addr, cmdbuf.vb_size, DRM_MEM_DRIVER); | ||
1161 | drm_free(kbox_addr, cmdbuf.nbox * sizeof(drm_clip_rect_t), | ||
1162 | DRM_MEM_DRIVER); | ||
1163 | |||
1164 | return ret; | ||
1161 | } | 1165 | } |
diff --git a/drivers/char/drm/sis_drm.h b/drivers/char/drm/sis_drm.h index 8f273da76ddb..30f7b3827466 100644 --- a/drivers/char/drm/sis_drm.h +++ b/drivers/char/drm/sis_drm.h | |||
@@ -1,3 +1,28 @@ | |||
1 | /* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ | ||
2 | /* | ||
3 | * Copyright 2005 Eric Anholt | ||
4 | * All Rights Reserved. | ||
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 (including the next | ||
14 | * paragraph) shall be included in all copies or substantial portions of the | ||
15 | * Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
23 | * SOFTWARE. | ||
24 | * | ||
25 | */ | ||
1 | 26 | ||
2 | #ifndef __SIS_DRM_H__ | 27 | #ifndef __SIS_DRM_H__ |
3 | #define __SIS_DRM_H__ | 28 | #define __SIS_DRM_H__ |
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c index 3cef10643a8f..6f6d7d613ede 100644 --- a/drivers/char/drm/sis_drv.c +++ b/drivers/char/drm/sis_drv.c | |||
@@ -32,31 +32,6 @@ | |||
32 | 32 | ||
33 | #include "drm_pciids.h" | 33 | #include "drm_pciids.h" |
34 | 34 | ||
35 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
36 | { | ||
37 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
38 | DRIVER_NAME, | ||
39 | DRIVER_MAJOR, | ||
40 | DRIVER_MINOR, | ||
41 | DRIVER_PATCHLEVEL, | ||
42 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
43 | ); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static int version(drm_version_t * version) | ||
48 | { | ||
49 | int len; | ||
50 | |||
51 | version->version_major = DRIVER_MAJOR; | ||
52 | version->version_minor = DRIVER_MINOR; | ||
53 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
54 | DRM_COPY(version->name, DRIVER_NAME); | ||
55 | DRM_COPY(version->date, DRIVER_DATE); | ||
56 | DRM_COPY(version->desc, DRIVER_DESC); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static struct pci_device_id pciidlist[] = { | 35 | static struct pci_device_id pciidlist[] = { |
61 | sisdrv_PCI_IDS | 36 | sisdrv_PCI_IDS |
62 | }; | 37 | }; |
@@ -68,8 +43,6 @@ static struct drm_driver driver = { | |||
68 | .reclaim_buffers = drm_core_reclaim_buffers, | 43 | .reclaim_buffers = drm_core_reclaim_buffers, |
69 | .get_map_ofs = drm_core_get_map_ofs, | 44 | .get_map_ofs = drm_core_get_map_ofs, |
70 | .get_reg_ofs = drm_core_get_reg_ofs, | 45 | .get_reg_ofs = drm_core_get_reg_ofs, |
71 | .postinit = postinit, | ||
72 | .version = version, | ||
73 | .ioctls = sis_ioctls, | 46 | .ioctls = sis_ioctls, |
74 | .fops = { | 47 | .fops = { |
75 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
@@ -79,11 +52,18 @@ static struct drm_driver driver = { | |||
79 | .mmap = drm_mmap, | 52 | .mmap = drm_mmap, |
80 | .poll = drm_poll, | 53 | .poll = drm_poll, |
81 | .fasync = drm_fasync, | 54 | .fasync = drm_fasync, |
82 | }, | 55 | }, |
83 | .pci_driver = { | 56 | .pci_driver = { |
84 | .name = DRIVER_NAME, | 57 | .name = DRIVER_NAME, |
85 | .id_table = pciidlist, | 58 | .id_table = pciidlist, |
86 | } | 59 | }, |
60 | |||
61 | .name = DRIVER_NAME, | ||
62 | .desc = DRIVER_DESC, | ||
63 | .date = DRIVER_DATE, | ||
64 | .major = DRIVER_MAJOR, | ||
65 | .minor = DRIVER_MINOR, | ||
66 | .patchlevel = DRIVER_PATCHLEVEL, | ||
87 | }; | 67 | }; |
88 | 68 | ||
89 | static int __init sis_init(void) | 69 | static int __init sis_init(void) |
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h index b1fddad83a93..e218e5269503 100644 --- a/drivers/char/drm/sis_drv.h +++ b/drivers/char/drm/sis_drv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* sis_drv.h -- Private header for sis driver -*- linux-c -*- | 1 | /* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ |
2 | * | 2 | /* |
3 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | 3 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
4 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 4 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
5 | * All rights reserved. | 5 | * All rights reserved. |
diff --git a/drivers/char/drm/sis_ds.h b/drivers/char/drm/sis_ds.h index da850b4f5440..94f2b4728b63 100644 --- a/drivers/char/drm/sis_ds.h +++ b/drivers/char/drm/sis_ds.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- | 1 | /* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- |
2 | * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw | 2 | * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw |
3 | * | 3 | */ |
4 | /* | ||
4 | * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. | 5 | * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. |
5 | * All rights reserved. | 6 | * All rights reserved. |
6 | * | 7 | * |
@@ -35,7 +36,7 @@ | |||
35 | 36 | ||
36 | #define SET_SIZE 5000 | 37 | #define SET_SIZE 5000 |
37 | 38 | ||
38 | typedef unsigned int ITEM_TYPE; | 39 | typedef unsigned long ITEM_TYPE; |
39 | 40 | ||
40 | typedef struct { | 41 | typedef struct { |
41 | ITEM_TYPE val; | 42 | ITEM_TYPE val; |
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c index a8529728fa63..6774d2fe3452 100644 --- a/drivers/char/drm/sis_mm.c +++ b/drivers/char/drm/sis_mm.c | |||
@@ -86,7 +86,7 @@ static int sis_fb_alloc(DRM_IOCTL_ARGS) | |||
86 | { | 86 | { |
87 | drm_sis_mem_t fb; | 87 | drm_sis_mem_t fb; |
88 | struct sis_memreq req; | 88 | struct sis_memreq req; |
89 | drm_sis_mem_t __user *argp = (void __user *)data; | 89 | drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *)data; |
90 | int retval = 0; | 90 | int retval = 0; |
91 | 91 | ||
92 | DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb)); | 92 | DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb)); |
@@ -110,7 +110,7 @@ static int sis_fb_alloc(DRM_IOCTL_ARGS) | |||
110 | 110 | ||
111 | DRM_COPY_TO_USER_IOCTL(argp, fb, sizeof(fb)); | 111 | DRM_COPY_TO_USER_IOCTL(argp, fb, sizeof(fb)); |
112 | 112 | ||
113 | DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, req.offset); | 113 | DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); |
114 | 114 | ||
115 | return retval; | 115 | return retval; |
116 | } | 116 | } |
@@ -127,9 +127,9 @@ static int sis_fb_free(DRM_IOCTL_ARGS) | |||
127 | 127 | ||
128 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) | 128 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) |
129 | retval = DRM_ERR(EINVAL); | 129 | retval = DRM_ERR(EINVAL); |
130 | sis_free((u32) fb.free); | 130 | sis_free(fb.free); |
131 | 131 | ||
132 | DRM_DEBUG("free fb, offset = %lu\n", fb.free); | 132 | DRM_DEBUG("free fb, offset = 0x%lx\n", fb.free); |
133 | 133 | ||
134 | return retval; | 134 | return retval; |
135 | } | 135 | } |
@@ -176,7 +176,7 @@ static int sis_fb_alloc(DRM_IOCTL_ARGS) | |||
176 | { | 176 | { |
177 | DRM_DEVICE; | 177 | DRM_DEVICE; |
178 | drm_sis_private_t *dev_priv = dev->dev_private; | 178 | drm_sis_private_t *dev_priv = dev->dev_private; |
179 | drm_sis_mem_t __user *argp = (void __user *)data; | 179 | drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *)data; |
180 | drm_sis_mem_t fb; | 180 | drm_sis_mem_t fb; |
181 | PMemBlock block; | 181 | PMemBlock block; |
182 | int retval = 0; | 182 | int retval = 0; |
@@ -267,7 +267,7 @@ static int sis_ioctl_agp_alloc(DRM_IOCTL_ARGS) | |||
267 | { | 267 | { |
268 | DRM_DEVICE; | 268 | DRM_DEVICE; |
269 | drm_sis_private_t *dev_priv = dev->dev_private; | 269 | drm_sis_private_t *dev_priv = dev->dev_private; |
270 | drm_sis_mem_t __user *argp = (void __user *)data; | 270 | drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *)data; |
271 | drm_sis_mem_t agp; | 271 | drm_sis_mem_t agp; |
272 | PMemBlock block; | 272 | PMemBlock block; |
273 | int retval = 0; | 273 | int retval = 0; |
@@ -367,7 +367,7 @@ int sis_final_context(struct drm_device *dev, int context) | |||
367 | 367 | ||
368 | if (i < MAX_CONTEXT) { | 368 | if (i < MAX_CONTEXT) { |
369 | set_t *set; | 369 | set_t *set; |
370 | unsigned int item; | 370 | ITEM_TYPE item; |
371 | int retval; | 371 | int retval; |
372 | 372 | ||
373 | DRM_DEBUG("find socket %d, context = %d\n", i, context); | 373 | DRM_DEBUG("find socket %d, context = %d\n", i, context); |
@@ -376,7 +376,7 @@ int sis_final_context(struct drm_device *dev, int context) | |||
376 | set = global_ppriv[i].sets[0]; | 376 | set = global_ppriv[i].sets[0]; |
377 | retval = setFirst(set, &item); | 377 | retval = setFirst(set, &item); |
378 | while (retval) { | 378 | while (retval) { |
379 | DRM_DEBUG("free video memory 0x%x\n", item); | 379 | DRM_DEBUG("free video memory 0x%lx\n", item); |
380 | #if defined(__linux__) && defined(CONFIG_FB_SIS) | 380 | #if defined(__linux__) && defined(CONFIG_FB_SIS) |
381 | sis_free(item); | 381 | sis_free(item); |
382 | #else | 382 | #else |
@@ -390,7 +390,7 @@ int sis_final_context(struct drm_device *dev, int context) | |||
390 | set = global_ppriv[i].sets[1]; | 390 | set = global_ppriv[i].sets[1]; |
391 | retval = setFirst(set, &item); | 391 | retval = setFirst(set, &item); |
392 | while (retval) { | 392 | while (retval) { |
393 | DRM_DEBUG("free agp memory 0x%x\n", item); | 393 | DRM_DEBUG("free agp memory 0x%lx\n", item); |
394 | mmFreeMem((PMemBlock) item); | 394 | mmFreeMem((PMemBlock) item); |
395 | retval = setNext(set, &item); | 395 | retval = setNext(set, &item); |
396 | } | 396 | } |
@@ -403,12 +403,12 @@ int sis_final_context(struct drm_device *dev, int context) | |||
403 | } | 403 | } |
404 | 404 | ||
405 | drm_ioctl_desc_t sis_ioctls[] = { | 405 | drm_ioctl_desc_t sis_ioctls[] = { |
406 | [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = {sis_fb_alloc, 1, 0}, | 406 | [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = {sis_fb_alloc, DRM_AUTH}, |
407 | [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = {sis_fb_free, 1, 0}, | 407 | [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = {sis_fb_free, DRM_AUTH}, |
408 | [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = {sis_ioctl_agp_init, 1, 1}, | 408 | [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = {sis_ioctl_agp_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
409 | [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = {sis_ioctl_agp_alloc, 1, 0}, | 409 | [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = {sis_ioctl_agp_alloc, DRM_AUTH}, |
410 | [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = {sis_ioctl_agp_free, 1, 0}, | 410 | [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = {sis_ioctl_agp_free, DRM_AUTH}, |
411 | [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, 1, 1} | 411 | [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY} |
412 | }; | 412 | }; |
413 | 413 | ||
414 | int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls); | 414 | int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls); |
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c index c275cbb6e9ce..baa4416032a8 100644 --- a/drivers/char/drm/tdfx_drv.c +++ b/drivers/char/drm/tdfx_drv.c | |||
@@ -36,31 +36,6 @@ | |||
36 | 36 | ||
37 | #include "drm_pciids.h" | 37 | #include "drm_pciids.h" |
38 | 38 | ||
39 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
40 | { | ||
41 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | ||
42 | DRIVER_NAME, | ||
43 | DRIVER_MAJOR, | ||
44 | DRIVER_MINOR, | ||
45 | DRIVER_PATCHLEVEL, | ||
46 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
47 | ); | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static int version(drm_version_t * version) | ||
52 | { | ||
53 | int len; | ||
54 | |||
55 | version->version_major = DRIVER_MAJOR; | ||
56 | version->version_minor = DRIVER_MINOR; | ||
57 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
58 | DRM_COPY(version->name, DRIVER_NAME); | ||
59 | DRM_COPY(version->date, DRIVER_DATE); | ||
60 | DRM_COPY(version->desc, DRIVER_DESC); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static struct pci_device_id pciidlist[] = { | 39 | static struct pci_device_id pciidlist[] = { |
65 | tdfx_PCI_IDS | 40 | tdfx_PCI_IDS |
66 | }; | 41 | }; |
@@ -70,8 +45,6 @@ static struct drm_driver driver = { | |||
70 | .reclaim_buffers = drm_core_reclaim_buffers, | 45 | .reclaim_buffers = drm_core_reclaim_buffers, |
71 | .get_map_ofs = drm_core_get_map_ofs, | 46 | .get_map_ofs = drm_core_get_map_ofs, |
72 | .get_reg_ofs = drm_core_get_reg_ofs, | 47 | .get_reg_ofs = drm_core_get_reg_ofs, |
73 | .postinit = postinit, | ||
74 | .version = version, | ||
75 | .fops = { | 48 | .fops = { |
76 | .owner = THIS_MODULE, | 49 | .owner = THIS_MODULE, |
77 | .open = drm_open, | 50 | .open = drm_open, |
@@ -80,11 +53,18 @@ static struct drm_driver driver = { | |||
80 | .mmap = drm_mmap, | 53 | .mmap = drm_mmap, |
81 | .poll = drm_poll, | 54 | .poll = drm_poll, |
82 | .fasync = drm_fasync, | 55 | .fasync = drm_fasync, |
83 | }, | 56 | }, |
84 | .pci_driver = { | 57 | .pci_driver = { |
85 | .name = DRIVER_NAME, | 58 | .name = DRIVER_NAME, |
86 | .id_table = pciidlist, | 59 | .id_table = pciidlist, |
87 | } | 60 | }, |
61 | |||
62 | .name = DRIVER_NAME, | ||
63 | .desc = DRIVER_DESC, | ||
64 | .date = DRIVER_DATE, | ||
65 | .major = DRIVER_MAJOR, | ||
66 | .minor = DRIVER_MINOR, | ||
67 | .patchlevel = DRIVER_PATCHLEVEL, | ||
88 | }; | 68 | }; |
89 | 69 | ||
90 | static int __init tdfx_init(void) | 70 | static int __init tdfx_init(void) |
diff --git a/drivers/char/drm/tdfx_drv.h b/drivers/char/drm/tdfx_drv.h index a582a3db4c75..84204ec1b046 100644 --- a/drivers/char/drm/tdfx_drv.h +++ b/drivers/char/drm/tdfx_drv.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- | 1 | /* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- |
2 | * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com | 2 | * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com |
3 | * | 3 | */ |
4 | /* | ||
4 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | 5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
5 | * All Rights Reserved. | 6 | * All Rights Reserved. |
6 | * | 7 | * |
@@ -30,10 +31,6 @@ | |||
30 | #ifndef __TDFX_H__ | 31 | #ifndef __TDFX_H__ |
31 | #define __TDFX_H__ | 32 | #define __TDFX_H__ |
32 | 33 | ||
33 | /* This remains constant for all DRM template files. | ||
34 | */ | ||
35 | #define DRM(x) tdfx_##x | ||
36 | |||
37 | /* General customization: | 34 | /* General customization: |
38 | */ | 35 | */ |
39 | 36 | ||
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index d4b1766608b0..593c0b8f650a 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c | |||
@@ -213,7 +213,9 @@ static int via_initialize(drm_device_t * dev, | |||
213 | dev_priv->dma_wrap = init->size; | 213 | dev_priv->dma_wrap = init->size; |
214 | dev_priv->dma_offset = init->offset; | 214 | dev_priv->dma_offset = init->offset; |
215 | dev_priv->last_pause_ptr = NULL; | 215 | dev_priv->last_pause_ptr = NULL; |
216 | dev_priv->hw_addr_ptr = dev_priv->mmio->handle + init->reg_pause_addr; | 216 | dev_priv->hw_addr_ptr = |
217 | (volatile uint32_t *)((char *)dev_priv->mmio->handle + | ||
218 | init->reg_pause_addr); | ||
217 | 219 | ||
218 | via_cmdbuf_start(dev_priv); | 220 | via_cmdbuf_start(dev_priv); |
219 | 221 | ||
@@ -232,13 +234,13 @@ int via_dma_init(DRM_IOCTL_ARGS) | |||
232 | 234 | ||
233 | switch (init.func) { | 235 | switch (init.func) { |
234 | case VIA_INIT_DMA: | 236 | case VIA_INIT_DMA: |
235 | if (!capable(CAP_SYS_ADMIN)) | 237 | if (!DRM_SUSER(DRM_CURPROC)) |
236 | retcode = DRM_ERR(EPERM); | 238 | retcode = DRM_ERR(EPERM); |
237 | else | 239 | else |
238 | retcode = via_initialize(dev, dev_priv, &init); | 240 | retcode = via_initialize(dev, dev_priv, &init); |
239 | break; | 241 | break; |
240 | case VIA_CLEANUP_DMA: | 242 | case VIA_CLEANUP_DMA: |
241 | if (!capable(CAP_SYS_ADMIN)) | 243 | if (!DRM_SUSER(DRM_CURPROC)) |
242 | retcode = DRM_ERR(EPERM); | 244 | retcode = DRM_ERR(EPERM); |
243 | else | 245 | else |
244 | retcode = via_dma_cleanup(dev); | 246 | retcode = via_dma_cleanup(dev); |
@@ -349,9 +351,6 @@ int via_cmdbuffer(DRM_IOCTL_ARGS) | |||
349 | return 0; | 351 | return 0; |
350 | } | 352 | } |
351 | 353 | ||
352 | extern int | ||
353 | via_parse_command_stream(drm_device_t * dev, const uint32_t * buf, | ||
354 | unsigned int size); | ||
355 | static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, | 354 | static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, |
356 | drm_via_cmdbuffer_t * cmd) | 355 | drm_via_cmdbuffer_t * cmd) |
357 | { | 356 | { |
@@ -450,9 +449,9 @@ static int via_hook_segment(drm_via_private_t * dev_priv, | |||
450 | if ((count <= 8) && (count >= 0)) { | 449 | if ((count <= 8) && (count >= 0)) { |
451 | uint32_t rgtr, ptr; | 450 | uint32_t rgtr, ptr; |
452 | rgtr = *(dev_priv->hw_addr_ptr); | 451 | rgtr = *(dev_priv->hw_addr_ptr); |
453 | ptr = ((char *)dev_priv->last_pause_ptr - dev_priv->dma_ptr) + | 452 | ptr = ((volatile char *)dev_priv->last_pause_ptr - |
454 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4 - | 453 | dev_priv->dma_ptr) + dev_priv->dma_offset + |
455 | CMDBUF_ALIGNMENT_SIZE; | 454 | (uint32_t) dev_priv->agpAddr + 4 - CMDBUF_ALIGNMENT_SIZE; |
456 | if (rgtr <= ptr) { | 455 | if (rgtr <= ptr) { |
457 | DRM_ERROR | 456 | DRM_ERROR |
458 | ("Command regulator\npaused at count %d, address %x, " | 457 | ("Command regulator\npaused at count %d, address %x, " |
@@ -472,7 +471,7 @@ static int via_hook_segment(drm_via_private_t * dev_priv, | |||
472 | && count--) ; | 471 | && count--) ; |
473 | 472 | ||
474 | rgtr = *(dev_priv->hw_addr_ptr); | 473 | rgtr = *(dev_priv->hw_addr_ptr); |
475 | ptr = ((char *)paused_at - dev_priv->dma_ptr) + | 474 | ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) + |
476 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; | 475 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; |
477 | 476 | ||
478 | ptr_low = (ptr > 3 * CMDBUF_ALIGNMENT_SIZE) ? | 477 | ptr_low = (ptr > 3 * CMDBUF_ALIGNMENT_SIZE) ? |
@@ -724,3 +723,22 @@ int via_cmdbuf_size(DRM_IOCTL_ARGS) | |||
724 | sizeof(d_siz)); | 723 | sizeof(d_siz)); |
725 | return ret; | 724 | return ret; |
726 | } | 725 | } |
726 | |||
727 | drm_ioctl_desc_t via_ioctls[] = { | ||
728 | [DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = {via_mem_alloc, DRM_AUTH}, | ||
729 | [DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = {via_mem_free, DRM_AUTH}, | ||
730 | [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, DRM_AUTH|DRM_MASTER}, | ||
731 | [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, DRM_AUTH|DRM_MASTER}, | ||
732 | [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, DRM_AUTH|DRM_MASTER}, | ||
733 | [DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = {via_decoder_futex, DRM_AUTH}, | ||
734 | [DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = {via_dma_init, DRM_AUTH}, | ||
735 | [DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = {via_cmdbuffer, DRM_AUTH}, | ||
736 | [DRM_IOCTL_NR(DRM_VIA_FLUSH)] = {via_flush_ioctl, DRM_AUTH}, | ||
737 | [DRM_IOCTL_NR(DRM_VIA_PCICMD)] = {via_pci_cmdbuffer, DRM_AUTH}, | ||
738 | [DRM_IOCTL_NR(DRM_VIA_CMDBUF_SIZE)] = {via_cmdbuf_size, DRM_AUTH}, | ||
739 | [DRM_IOCTL_NR(DRM_VIA_WAIT_IRQ)] = {via_wait_irq, DRM_AUTH}, | ||
740 | [DRM_IOCTL_NR(DRM_VIA_DMA_BLIT)] = {via_dma_blit, DRM_AUTH}, | ||
741 | [DRM_IOCTL_NR(DRM_VIA_BLIT_SYNC)] = {via_dma_blit_sync, DRM_AUTH} | ||
742 | }; | ||
743 | |||
744 | int via_max_ioctl = DRM_ARRAY_SIZE(via_ioctls); | ||
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c new file mode 100644 index 000000000000..9d5e027dae0e --- /dev/null +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -0,0 +1,805 @@ | |||
1 | /* via_dmablit.c -- PCI DMA BitBlt support for the VIA Unichrome/Pro | ||
2 | * | ||
3 | * Copyright (C) 2005 Thomas Hellstrom, All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sub license, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the | ||
13 | * next paragraph) shall be included in all copies or substantial portions | ||
14 | * 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 NON-INFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
22 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Thomas Hellstrom. | ||
26 | * Partially based on code obtained from Digeo Inc. | ||
27 | */ | ||
28 | |||
29 | |||
30 | /* | ||
31 | * Unmaps the DMA mappings. | ||
32 | * FIXME: Is this a NoOp on x86? Also | ||
33 | * FIXME: What happens if this one is called and a pending blit has previously done | ||
34 | * the same DMA mappings? | ||
35 | */ | ||
36 | |||
37 | #include "drmP.h" | ||
38 | #include "via_drm.h" | ||
39 | #include "via_drv.h" | ||
40 | #include "via_dmablit.h" | ||
41 | |||
42 | #include <linux/pagemap.h> | ||
43 | |||
44 | #define VIA_PGDN(x) (((unsigned long)(x)) & PAGE_MASK) | ||
45 | #define VIA_PGOFF(x) (((unsigned long)(x)) & ~PAGE_MASK) | ||
46 | #define VIA_PFN(x) ((unsigned long)(x) >> PAGE_SHIFT) | ||
47 | |||
48 | typedef struct _drm_via_descriptor { | ||
49 | uint32_t mem_addr; | ||
50 | uint32_t dev_addr; | ||
51 | uint32_t size; | ||
52 | uint32_t next; | ||
53 | } drm_via_descriptor_t; | ||
54 | |||
55 | |||
56 | /* | ||
57 | * Unmap a DMA mapping. | ||
58 | */ | ||
59 | |||
60 | |||
61 | |||
62 | static void | ||
63 | via_unmap_blit_from_device(struct pci_dev *pdev, drm_via_sg_info_t *vsg) | ||
64 | { | ||
65 | int num_desc = vsg->num_desc; | ||
66 | unsigned cur_descriptor_page = num_desc / vsg->descriptors_per_page; | ||
67 | unsigned descriptor_this_page = num_desc % vsg->descriptors_per_page; | ||
68 | drm_via_descriptor_t *desc_ptr = vsg->desc_pages[cur_descriptor_page] + | ||
69 | descriptor_this_page; | ||
70 | dma_addr_t next = vsg->chain_start; | ||
71 | |||
72 | while(num_desc--) { | ||
73 | if (descriptor_this_page-- == 0) { | ||
74 | cur_descriptor_page--; | ||
75 | descriptor_this_page = vsg->descriptors_per_page - 1; | ||
76 | desc_ptr = vsg->desc_pages[cur_descriptor_page] + | ||
77 | descriptor_this_page; | ||
78 | } | ||
79 | dma_unmap_single(&pdev->dev, next, sizeof(*desc_ptr), DMA_TO_DEVICE); | ||
80 | dma_unmap_page(&pdev->dev, desc_ptr->mem_addr, desc_ptr->size, vsg->direction); | ||
81 | next = (dma_addr_t) desc_ptr->next; | ||
82 | desc_ptr--; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * If mode = 0, count how many descriptors are needed. | ||
88 | * If mode = 1, Map the DMA pages for the device, put together and map also the descriptors. | ||
89 | * Descriptors are run in reverse order by the hardware because we are not allowed to update the | ||
90 | * 'next' field without syncing calls when the descriptor is already mapped. | ||
91 | */ | ||
92 | |||
93 | static void | ||
94 | via_map_blit_for_device(struct pci_dev *pdev, | ||
95 | const drm_via_dmablit_t *xfer, | ||
96 | drm_via_sg_info_t *vsg, | ||
97 | int mode) | ||
98 | { | ||
99 | unsigned cur_descriptor_page = 0; | ||
100 | unsigned num_descriptors_this_page = 0; | ||
101 | unsigned char *mem_addr = xfer->mem_addr; | ||
102 | unsigned char *cur_mem; | ||
103 | unsigned char *first_addr = (unsigned char *)VIA_PGDN(mem_addr); | ||
104 | uint32_t fb_addr = xfer->fb_addr; | ||
105 | uint32_t cur_fb; | ||
106 | unsigned long line_len; | ||
107 | unsigned remaining_len; | ||
108 | int num_desc = 0; | ||
109 | int cur_line; | ||
110 | dma_addr_t next = 0 | VIA_DMA_DPR_EC; | ||
111 | drm_via_descriptor_t *desc_ptr = 0; | ||
112 | |||
113 | if (mode == 1) | ||
114 | desc_ptr = vsg->desc_pages[cur_descriptor_page]; | ||
115 | |||
116 | for (cur_line = 0; cur_line < xfer->num_lines; ++cur_line) { | ||
117 | |||
118 | line_len = xfer->line_length; | ||
119 | cur_fb = fb_addr; | ||
120 | cur_mem = mem_addr; | ||
121 | |||
122 | while (line_len > 0) { | ||
123 | |||
124 | remaining_len = min(PAGE_SIZE-VIA_PGOFF(cur_mem), line_len); | ||
125 | line_len -= remaining_len; | ||
126 | |||
127 | if (mode == 1) { | ||
128 | desc_ptr->mem_addr = | ||
129 | dma_map_page(&pdev->dev, | ||
130 | vsg->pages[VIA_PFN(cur_mem) - | ||
131 | VIA_PFN(first_addr)], | ||
132 | VIA_PGOFF(cur_mem), remaining_len, | ||
133 | vsg->direction); | ||
134 | desc_ptr->dev_addr = cur_fb; | ||
135 | |||
136 | desc_ptr->size = remaining_len; | ||
137 | desc_ptr->next = (uint32_t) next; | ||
138 | next = dma_map_single(&pdev->dev, desc_ptr, sizeof(*desc_ptr), | ||
139 | DMA_TO_DEVICE); | ||
140 | desc_ptr++; | ||
141 | if (++num_descriptors_this_page >= vsg->descriptors_per_page) { | ||
142 | num_descriptors_this_page = 0; | ||
143 | desc_ptr = vsg->desc_pages[++cur_descriptor_page]; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | num_desc++; | ||
148 | cur_mem += remaining_len; | ||
149 | cur_fb += remaining_len; | ||
150 | } | ||
151 | |||
152 | mem_addr += xfer->mem_stride; | ||
153 | fb_addr += xfer->fb_stride; | ||
154 | } | ||
155 | |||
156 | if (mode == 1) { | ||
157 | vsg->chain_start = next; | ||
158 | vsg->state = dr_via_device_mapped; | ||
159 | } | ||
160 | vsg->num_desc = num_desc; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * Function that frees up all resources for a blit. It is usable even if the | ||
165 | * blit info has only be partially built as long as the status enum is consistent | ||
166 | * with the actual status of the used resources. | ||
167 | */ | ||
168 | |||
169 | |||
170 | void | ||
171 | via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) | ||
172 | { | ||
173 | struct page *page; | ||
174 | int i; | ||
175 | |||
176 | switch(vsg->state) { | ||
177 | case dr_via_device_mapped: | ||
178 | via_unmap_blit_from_device(pdev, vsg); | ||
179 | case dr_via_desc_pages_alloc: | ||
180 | for (i=0; i<vsg->num_desc_pages; ++i) { | ||
181 | if (vsg->desc_pages[i] != NULL) | ||
182 | free_page((unsigned long)vsg->desc_pages[i]); | ||
183 | } | ||
184 | kfree(vsg->desc_pages); | ||
185 | case dr_via_pages_locked: | ||
186 | for (i=0; i<vsg->num_pages; ++i) { | ||
187 | if ( NULL != (page = vsg->pages[i])) { | ||
188 | if (! PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction)) | ||
189 | SetPageDirty(page); | ||
190 | page_cache_release(page); | ||
191 | } | ||
192 | } | ||
193 | case dr_via_pages_alloc: | ||
194 | vfree(vsg->pages); | ||
195 | default: | ||
196 | vsg->state = dr_via_sg_init; | ||
197 | } | ||
198 | if (vsg->bounce_buffer) { | ||
199 | vfree(vsg->bounce_buffer); | ||
200 | vsg->bounce_buffer = NULL; | ||
201 | } | ||
202 | vsg->free_on_sequence = 0; | ||
203 | } | ||
204 | |||
205 | /* | ||
206 | * Fire a blit engine. | ||
207 | */ | ||
208 | |||
209 | static void | ||
210 | via_fire_dmablit(drm_device_t *dev, drm_via_sg_info_t *vsg, int engine) | ||
211 | { | ||
212 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
213 | |||
214 | VIA_WRITE(VIA_PCI_DMA_MAR0 + engine*0x10, 0); | ||
215 | VIA_WRITE(VIA_PCI_DMA_DAR0 + engine*0x10, 0); | ||
216 | VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_DD | VIA_DMA_CSR_TD | | ||
217 | VIA_DMA_CSR_DE); | ||
218 | VIA_WRITE(VIA_PCI_DMA_MR0 + engine*0x04, VIA_DMA_MR_CM | VIA_DMA_MR_TDIE); | ||
219 | VIA_WRITE(VIA_PCI_DMA_BCR0 + engine*0x10, 0); | ||
220 | VIA_WRITE(VIA_PCI_DMA_DPR0 + engine*0x10, vsg->chain_start); | ||
221 | VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_DE | VIA_DMA_CSR_TS); | ||
222 | } | ||
223 | |||
224 | /* | ||
225 | * Obtain a page pointer array and lock all pages into system memory. A segmentation violation will | ||
226 | * occur here if the calling user does not have access to the submitted address. | ||
227 | */ | ||
228 | |||
229 | static int | ||
230 | via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) | ||
231 | { | ||
232 | int ret; | ||
233 | unsigned long first_pfn = VIA_PFN(xfer->mem_addr); | ||
234 | vsg->num_pages = VIA_PFN(xfer->mem_addr + (xfer->num_lines * xfer->mem_stride -1)) - | ||
235 | first_pfn + 1; | ||
236 | |||
237 | if (NULL == (vsg->pages = vmalloc(sizeof(struct page *) * vsg->num_pages))) | ||
238 | return DRM_ERR(ENOMEM); | ||
239 | memset(vsg->pages, 0, sizeof(struct page *) * vsg->num_pages); | ||
240 | down_read(¤t->mm->mmap_sem); | ||
241 | ret = get_user_pages(current, current->mm, (unsigned long) xfer->mem_addr, | ||
242 | vsg->num_pages, vsg->direction, 0, vsg->pages, NULL); | ||
243 | |||
244 | up_read(¤t->mm->mmap_sem); | ||
245 | if (ret != vsg->num_pages) { | ||
246 | if (ret < 0) | ||
247 | return ret; | ||
248 | vsg->state = dr_via_pages_locked; | ||
249 | return DRM_ERR(EINVAL); | ||
250 | } | ||
251 | vsg->state = dr_via_pages_locked; | ||
252 | DRM_DEBUG("DMA pages locked\n"); | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | /* | ||
257 | * Allocate DMA capable memory for the blit descriptor chain, and an array that keeps track of the | ||
258 | * pages we allocate. We don't want to use kmalloc for the descriptor chain because it may be | ||
259 | * quite large for some blits, and pages don't need to be contingous. | ||
260 | */ | ||
261 | |||
262 | static int | ||
263 | via_alloc_desc_pages(drm_via_sg_info_t *vsg) | ||
264 | { | ||
265 | int i; | ||
266 | |||
267 | vsg->descriptors_per_page = PAGE_SIZE / sizeof( drm_via_descriptor_t); | ||
268 | vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) / | ||
269 | vsg->descriptors_per_page; | ||
270 | |||
271 | if (NULL == (vsg->desc_pages = kmalloc(sizeof(void *) * vsg->num_desc_pages, GFP_KERNEL))) | ||
272 | return DRM_ERR(ENOMEM); | ||
273 | |||
274 | memset(vsg->desc_pages, 0, sizeof(void *) * vsg->num_desc_pages); | ||
275 | vsg->state = dr_via_desc_pages_alloc; | ||
276 | for (i=0; i<vsg->num_desc_pages; ++i) { | ||
277 | if (NULL == (vsg->desc_pages[i] = | ||
278 | (drm_via_descriptor_t *) __get_free_page(GFP_KERNEL))) | ||
279 | return DRM_ERR(ENOMEM); | ||
280 | } | ||
281 | DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages, | ||
282 | vsg->num_desc); | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static void | ||
287 | via_abort_dmablit(drm_device_t *dev, int engine) | ||
288 | { | ||
289 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
290 | |||
291 | VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_TA); | ||
292 | } | ||
293 | |||
294 | static void | ||
295 | via_dmablit_engine_off(drm_device_t *dev, int engine) | ||
296 | { | ||
297 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
298 | |||
299 | VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_TD | VIA_DMA_CSR_DD); | ||
300 | } | ||
301 | |||
302 | |||
303 | |||
304 | /* | ||
305 | * The dmablit part of the IRQ handler. Trying to do only reasonably fast things here. | ||
306 | * The rest, like unmapping and freeing memory for done blits is done in a separate workqueue | ||
307 | * task. Basically the task of the interrupt handler is to submit a new blit to the engine, while | ||
308 | * the workqueue task takes care of processing associated with the old blit. | ||
309 | */ | ||
310 | |||
311 | void | ||
312 | via_dmablit_handler(drm_device_t *dev, int engine, int from_irq) | ||
313 | { | ||
314 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
315 | drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; | ||
316 | int cur; | ||
317 | int done_transfer; | ||
318 | unsigned long irqsave=0; | ||
319 | uint32_t status = 0; | ||
320 | |||
321 | DRM_DEBUG("DMA blit handler called. engine = %d, from_irq = %d, blitq = 0x%lx\n", | ||
322 | engine, from_irq, (unsigned long) blitq); | ||
323 | |||
324 | if (from_irq) { | ||
325 | spin_lock(&blitq->blit_lock); | ||
326 | } else { | ||
327 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
328 | } | ||
329 | |||
330 | done_transfer = blitq->is_active && | ||
331 | (( status = VIA_READ(VIA_PCI_DMA_CSR0 + engine*0x04)) & VIA_DMA_CSR_TD); | ||
332 | done_transfer = done_transfer || ( blitq->aborting && !(status & VIA_DMA_CSR_DE)); | ||
333 | |||
334 | cur = blitq->cur; | ||
335 | if (done_transfer) { | ||
336 | |||
337 | blitq->blits[cur]->aborted = blitq->aborting; | ||
338 | blitq->done_blit_handle++; | ||
339 | DRM_WAKEUP(blitq->blit_queue + cur); | ||
340 | |||
341 | cur++; | ||
342 | if (cur >= VIA_NUM_BLIT_SLOTS) | ||
343 | cur = 0; | ||
344 | blitq->cur = cur; | ||
345 | |||
346 | /* | ||
347 | * Clear transfer done flag. | ||
348 | */ | ||
349 | |||
350 | VIA_WRITE(VIA_PCI_DMA_CSR0 + engine*0x04, VIA_DMA_CSR_TD); | ||
351 | |||
352 | blitq->is_active = 0; | ||
353 | blitq->aborting = 0; | ||
354 | schedule_work(&blitq->wq); | ||
355 | |||
356 | } else if (blitq->is_active && time_after_eq(jiffies, blitq->end)) { | ||
357 | |||
358 | /* | ||
359 | * Abort transfer after one second. | ||
360 | */ | ||
361 | |||
362 | via_abort_dmablit(dev, engine); | ||
363 | blitq->aborting = 1; | ||
364 | blitq->end = jiffies + DRM_HZ; | ||
365 | } | ||
366 | |||
367 | if (!blitq->is_active) { | ||
368 | if (blitq->num_outstanding) { | ||
369 | via_fire_dmablit(dev, blitq->blits[cur], engine); | ||
370 | blitq->is_active = 1; | ||
371 | blitq->cur = cur; | ||
372 | blitq->num_outstanding--; | ||
373 | blitq->end = jiffies + DRM_HZ; | ||
374 | if (!timer_pending(&blitq->poll_timer)) { | ||
375 | blitq->poll_timer.expires = jiffies+1; | ||
376 | add_timer(&blitq->poll_timer); | ||
377 | } | ||
378 | } else { | ||
379 | if (timer_pending(&blitq->poll_timer)) { | ||
380 | del_timer(&blitq->poll_timer); | ||
381 | } | ||
382 | via_dmablit_engine_off(dev, engine); | ||
383 | } | ||
384 | } | ||
385 | |||
386 | if (from_irq) { | ||
387 | spin_unlock(&blitq->blit_lock); | ||
388 | } else { | ||
389 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
390 | } | ||
391 | } | ||
392 | |||
393 | |||
394 | |||
395 | /* | ||
396 | * Check whether this blit is still active, performing necessary locking. | ||
397 | */ | ||
398 | |||
399 | static int | ||
400 | via_dmablit_active(drm_via_blitq_t *blitq, int engine, uint32_t handle, wait_queue_head_t **queue) | ||
401 | { | ||
402 | unsigned long irqsave; | ||
403 | uint32_t slot; | ||
404 | int active; | ||
405 | |||
406 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
407 | |||
408 | /* | ||
409 | * Allow for handle wraparounds. | ||
410 | */ | ||
411 | |||
412 | active = ((blitq->done_blit_handle - handle) > (1 << 23)) && | ||
413 | ((blitq->cur_blit_handle - handle) <= (1 << 23)); | ||
414 | |||
415 | if (queue && active) { | ||
416 | slot = handle - blitq->done_blit_handle + blitq->cur -1; | ||
417 | if (slot >= VIA_NUM_BLIT_SLOTS) { | ||
418 | slot -= VIA_NUM_BLIT_SLOTS; | ||
419 | } | ||
420 | *queue = blitq->blit_queue + slot; | ||
421 | } | ||
422 | |||
423 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
424 | |||
425 | return active; | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | * Sync. Wait for at least three seconds for the blit to be performed. | ||
430 | */ | ||
431 | |||
432 | static int | ||
433 | via_dmablit_sync(drm_device_t *dev, uint32_t handle, int engine) | ||
434 | { | ||
435 | |||
436 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
437 | drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; | ||
438 | wait_queue_head_t *queue; | ||
439 | int ret = 0; | ||
440 | |||
441 | if (via_dmablit_active(blitq, engine, handle, &queue)) { | ||
442 | DRM_WAIT_ON(ret, *queue, 3 * DRM_HZ, | ||
443 | !via_dmablit_active(blitq, engine, handle, NULL)); | ||
444 | } | ||
445 | DRM_DEBUG("DMA blit sync handle 0x%x engine %d returned %d\n", | ||
446 | handle, engine, ret); | ||
447 | |||
448 | return ret; | ||
449 | } | ||
450 | |||
451 | |||
452 | /* | ||
453 | * A timer that regularly polls the blit engine in cases where we don't have interrupts: | ||
454 | * a) Broken hardware (typically those that don't have any video capture facility). | ||
455 | * b) Blit abort. The hardware doesn't send an interrupt when a blit is aborted. | ||
456 | * The timer and hardware IRQ's can and do work in parallel. If the hardware has | ||
457 | * irqs, it will shorten the latency somewhat. | ||
458 | */ | ||
459 | |||
460 | |||
461 | |||
462 | static void | ||
463 | via_dmablit_timer(unsigned long data) | ||
464 | { | ||
465 | drm_via_blitq_t *blitq = (drm_via_blitq_t *) data; | ||
466 | drm_device_t *dev = blitq->dev; | ||
467 | int engine = (int) | ||
468 | (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues); | ||
469 | |||
470 | DRM_DEBUG("Polling timer called for engine %d, jiffies %lu\n", engine, | ||
471 | (unsigned long) jiffies); | ||
472 | |||
473 | via_dmablit_handler(dev, engine, 0); | ||
474 | |||
475 | if (!timer_pending(&blitq->poll_timer)) { | ||
476 | blitq->poll_timer.expires = jiffies+1; | ||
477 | add_timer(&blitq->poll_timer); | ||
478 | } | ||
479 | via_dmablit_handler(dev, engine, 0); | ||
480 | |||
481 | } | ||
482 | |||
483 | |||
484 | |||
485 | |||
486 | /* | ||
487 | * Workqueue task that frees data and mappings associated with a blit. | ||
488 | * Also wakes up waiting processes. Each of these tasks handles one | ||
489 | * blit engine only and may not be called on each interrupt. | ||
490 | */ | ||
491 | |||
492 | |||
493 | static void | ||
494 | via_dmablit_workqueue(void *data) | ||
495 | { | ||
496 | drm_via_blitq_t *blitq = (drm_via_blitq_t *) data; | ||
497 | drm_device_t *dev = blitq->dev; | ||
498 | unsigned long irqsave; | ||
499 | drm_via_sg_info_t *cur_sg; | ||
500 | int cur_released; | ||
501 | |||
502 | |||
503 | DRM_DEBUG("Workqueue task called for blit engine %ld\n",(unsigned long) | ||
504 | (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues)); | ||
505 | |||
506 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
507 | |||
508 | while(blitq->serviced != blitq->cur) { | ||
509 | |||
510 | cur_released = blitq->serviced++; | ||
511 | |||
512 | DRM_DEBUG("Releasing blit slot %d\n", cur_released); | ||
513 | |||
514 | if (blitq->serviced >= VIA_NUM_BLIT_SLOTS) | ||
515 | blitq->serviced = 0; | ||
516 | |||
517 | cur_sg = blitq->blits[cur_released]; | ||
518 | blitq->num_free++; | ||
519 | |||
520 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
521 | |||
522 | DRM_WAKEUP(&blitq->busy_queue); | ||
523 | |||
524 | via_free_sg_info(dev->pdev, cur_sg); | ||
525 | kfree(cur_sg); | ||
526 | |||
527 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
528 | } | ||
529 | |||
530 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
531 | } | ||
532 | |||
533 | |||
534 | /* | ||
535 | * Init all blit engines. Currently we use two, but some hardware have 4. | ||
536 | */ | ||
537 | |||
538 | |||
539 | void | ||
540 | via_init_dmablit(drm_device_t *dev) | ||
541 | { | ||
542 | int i,j; | ||
543 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
544 | drm_via_blitq_t *blitq; | ||
545 | |||
546 | pci_set_master(dev->pdev); | ||
547 | |||
548 | for (i=0; i< VIA_NUM_BLIT_ENGINES; ++i) { | ||
549 | blitq = dev_priv->blit_queues + i; | ||
550 | blitq->dev = dev; | ||
551 | blitq->cur_blit_handle = 0; | ||
552 | blitq->done_blit_handle = 0; | ||
553 | blitq->head = 0; | ||
554 | blitq->cur = 0; | ||
555 | blitq->serviced = 0; | ||
556 | blitq->num_free = VIA_NUM_BLIT_SLOTS; | ||
557 | blitq->num_outstanding = 0; | ||
558 | blitq->is_active = 0; | ||
559 | blitq->aborting = 0; | ||
560 | blitq->blit_lock = SPIN_LOCK_UNLOCKED; | ||
561 | for (j=0; j<VIA_NUM_BLIT_SLOTS; ++j) { | ||
562 | DRM_INIT_WAITQUEUE(blitq->blit_queue + j); | ||
563 | } | ||
564 | DRM_INIT_WAITQUEUE(&blitq->busy_queue); | ||
565 | INIT_WORK(&blitq->wq, via_dmablit_workqueue, blitq); | ||
566 | init_timer(&blitq->poll_timer); | ||
567 | blitq->poll_timer.function = &via_dmablit_timer; | ||
568 | blitq->poll_timer.data = (unsigned long) blitq; | ||
569 | } | ||
570 | } | ||
571 | |||
572 | /* | ||
573 | * Build all info and do all mappings required for a blit. | ||
574 | */ | ||
575 | |||
576 | |||
577 | static int | ||
578 | via_build_sg_info(drm_device_t *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) | ||
579 | { | ||
580 | int draw = xfer->to_fb; | ||
581 | int ret = 0; | ||
582 | |||
583 | vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
584 | vsg->bounce_buffer = 0; | ||
585 | |||
586 | vsg->state = dr_via_sg_init; | ||
587 | |||
588 | if (xfer->num_lines <= 0 || xfer->line_length <= 0) { | ||
589 | DRM_ERROR("Zero size bitblt.\n"); | ||
590 | return DRM_ERR(EINVAL); | ||
591 | } | ||
592 | |||
593 | /* | ||
594 | * Below check is a driver limitation, not a hardware one. We | ||
595 | * don't want to lock unused pages, and don't want to incoporate the | ||
596 | * extra logic of avoiding them. Make sure there are no. | ||
597 | * (Not a big limitation anyway.) | ||
598 | */ | ||
599 | |||
600 | if (((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) || | ||
601 | (xfer->mem_stride > 2048*4)) { | ||
602 | DRM_ERROR("Too large system memory stride. Stride: %d, " | ||
603 | "Length: %d\n", xfer->mem_stride, xfer->line_length); | ||
604 | return DRM_ERR(EINVAL); | ||
605 | } | ||
606 | |||
607 | if (xfer->num_lines > 2048) { | ||
608 | DRM_ERROR("Too many PCI DMA bitblt lines.\n"); | ||
609 | return DRM_ERR(EINVAL); | ||
610 | } | ||
611 | |||
612 | /* | ||
613 | * we allow a negative fb stride to allow flipping of images in | ||
614 | * transfer. | ||
615 | */ | ||
616 | |||
617 | if (xfer->mem_stride < xfer->line_length || | ||
618 | abs(xfer->fb_stride) < xfer->line_length) { | ||
619 | DRM_ERROR("Invalid frame-buffer / memory stride.\n"); | ||
620 | return DRM_ERR(EINVAL); | ||
621 | } | ||
622 | |||
623 | /* | ||
624 | * A hardware bug seems to be worked around if system memory addresses start on | ||
625 | * 16 byte boundaries. This seems a bit restrictive however. VIA is contacted | ||
626 | * about this. Meanwhile, impose the following restrictions: | ||
627 | */ | ||
628 | |||
629 | #ifdef VIA_BUGFREE | ||
630 | if ((((unsigned long)xfer->mem_addr & 3) != ((unsigned long)xfer->fb_addr & 3)) || | ||
631 | ((xfer->mem_stride & 3) != (xfer->fb_stride & 3))) { | ||
632 | DRM_ERROR("Invalid DRM bitblt alignment.\n"); | ||
633 | return DRM_ERR(EINVAL); | ||
634 | } | ||
635 | #else | ||
636 | if ((((unsigned long)xfer->mem_addr & 15) || | ||
637 | ((unsigned long)xfer->fb_addr & 3)) || (xfer->mem_stride & 15) || | ||
638 | (xfer->fb_stride & 3)) { | ||
639 | DRM_ERROR("Invalid DRM bitblt alignment.\n"); | ||
640 | return DRM_ERR(EINVAL); | ||
641 | } | ||
642 | #endif | ||
643 | |||
644 | if (0 != (ret = via_lock_all_dma_pages(vsg, xfer))) { | ||
645 | DRM_ERROR("Could not lock DMA pages.\n"); | ||
646 | via_free_sg_info(dev->pdev, vsg); | ||
647 | return ret; | ||
648 | } | ||
649 | |||
650 | via_map_blit_for_device(dev->pdev, xfer, vsg, 0); | ||
651 | if (0 != (ret = via_alloc_desc_pages(vsg))) { | ||
652 | DRM_ERROR("Could not allocate DMA descriptor pages.\n"); | ||
653 | via_free_sg_info(dev->pdev, vsg); | ||
654 | return ret; | ||
655 | } | ||
656 | via_map_blit_for_device(dev->pdev, xfer, vsg, 1); | ||
657 | |||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | |||
662 | /* | ||
663 | * Reserve one free slot in the blit queue. Will wait for one second for one | ||
664 | * to become available. Otherwise -EBUSY is returned. | ||
665 | */ | ||
666 | |||
667 | static int | ||
668 | via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine) | ||
669 | { | ||
670 | int ret=0; | ||
671 | unsigned long irqsave; | ||
672 | |||
673 | DRM_DEBUG("Num free is %d\n", blitq->num_free); | ||
674 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
675 | while(blitq->num_free == 0) { | ||
676 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
677 | |||
678 | DRM_WAIT_ON(ret, blitq->busy_queue, DRM_HZ, blitq->num_free > 0); | ||
679 | if (ret) { | ||
680 | return (DRM_ERR(EINTR) == ret) ? DRM_ERR(EAGAIN) : ret; | ||
681 | } | ||
682 | |||
683 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
684 | } | ||
685 | |||
686 | blitq->num_free--; | ||
687 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
688 | |||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | /* | ||
693 | * Hand back a free slot if we changed our mind. | ||
694 | */ | ||
695 | |||
696 | static void | ||
697 | via_dmablit_release_slot(drm_via_blitq_t *blitq) | ||
698 | { | ||
699 | unsigned long irqsave; | ||
700 | |||
701 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
702 | blitq->num_free++; | ||
703 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
704 | DRM_WAKEUP( &blitq->busy_queue ); | ||
705 | } | ||
706 | |||
707 | /* | ||
708 | * Grab a free slot. Build blit info and queue a blit. | ||
709 | */ | ||
710 | |||
711 | |||
712 | static int | ||
713 | via_dmablit(drm_device_t *dev, drm_via_dmablit_t *xfer) | ||
714 | { | ||
715 | drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; | ||
716 | drm_via_sg_info_t *vsg; | ||
717 | drm_via_blitq_t *blitq; | ||
718 | int ret; | ||
719 | int engine; | ||
720 | unsigned long irqsave; | ||
721 | |||
722 | if (dev_priv == NULL) { | ||
723 | DRM_ERROR("Called without initialization.\n"); | ||
724 | return DRM_ERR(EINVAL); | ||
725 | } | ||
726 | |||
727 | engine = (xfer->to_fb) ? 0 : 1; | ||
728 | blitq = dev_priv->blit_queues + engine; | ||
729 | if (0 != (ret = via_dmablit_grab_slot(blitq, engine))) { | ||
730 | return ret; | ||
731 | } | ||
732 | if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) { | ||
733 | via_dmablit_release_slot(blitq); | ||
734 | return DRM_ERR(ENOMEM); | ||
735 | } | ||
736 | if (0 != (ret = via_build_sg_info(dev, vsg, xfer))) { | ||
737 | via_dmablit_release_slot(blitq); | ||
738 | kfree(vsg); | ||
739 | return ret; | ||
740 | } | ||
741 | spin_lock_irqsave(&blitq->blit_lock, irqsave); | ||
742 | |||
743 | blitq->blits[blitq->head++] = vsg; | ||
744 | if (blitq->head >= VIA_NUM_BLIT_SLOTS) | ||
745 | blitq->head = 0; | ||
746 | blitq->num_outstanding++; | ||
747 | xfer->sync.sync_handle = ++blitq->cur_blit_handle; | ||
748 | |||
749 | spin_unlock_irqrestore(&blitq->blit_lock, irqsave); | ||
750 | xfer->sync.engine = engine; | ||
751 | |||
752 | via_dmablit_handler(dev, engine, 0); | ||
753 | |||
754 | return 0; | ||
755 | } | ||
756 | |||
757 | /* | ||
758 | * Sync on a previously submitted blit. Note that the X server use signals extensively, and | ||
759 | * that there is a very big proability that this IOCTL will be interrupted by a signal. In that | ||
760 | * case it returns with -EAGAIN for the signal to be delivered. | ||
761 | * The caller should then reissue the IOCTL. This is similar to what is being done for drmGetLock(). | ||
762 | */ | ||
763 | |||
764 | int | ||
765 | via_dma_blit_sync( DRM_IOCTL_ARGS ) | ||
766 | { | ||
767 | drm_via_blitsync_t sync; | ||
768 | int err; | ||
769 | DRM_DEVICE; | ||
770 | |||
771 | DRM_COPY_FROM_USER_IOCTL(sync, (drm_via_blitsync_t *)data, sizeof(sync)); | ||
772 | |||
773 | if (sync.engine >= VIA_NUM_BLIT_ENGINES) | ||
774 | return DRM_ERR(EINVAL); | ||
775 | |||
776 | err = via_dmablit_sync(dev, sync.sync_handle, sync.engine); | ||
777 | |||
778 | if (DRM_ERR(EINTR) == err) | ||
779 | err = DRM_ERR(EAGAIN); | ||
780 | |||
781 | return err; | ||
782 | } | ||
783 | |||
784 | |||
785 | /* | ||
786 | * Queue a blit and hand back a handle to be used for sync. This IOCTL may be interrupted by a signal | ||
787 | * while waiting for a free slot in the blit queue. In that case it returns with -EAGAIN and should | ||
788 | * be reissued. See the above IOCTL code. | ||
789 | */ | ||
790 | |||
791 | int | ||
792 | via_dma_blit( DRM_IOCTL_ARGS ) | ||
793 | { | ||
794 | drm_via_dmablit_t xfer; | ||
795 | int err; | ||
796 | DRM_DEVICE; | ||
797 | |||
798 | DRM_COPY_FROM_USER_IOCTL(xfer, (drm_via_dmablit_t __user *)data, sizeof(xfer)); | ||
799 | |||
800 | err = via_dmablit(dev, &xfer); | ||
801 | |||
802 | DRM_COPY_TO_USER_IOCTL((void __user *)data, xfer, sizeof(xfer)); | ||
803 | |||
804 | return err; | ||
805 | } | ||
diff --git a/drivers/char/drm/via_dmablit.h b/drivers/char/drm/via_dmablit.h new file mode 100644 index 000000000000..f4036cd5d0e0 --- /dev/null +++ b/drivers/char/drm/via_dmablit.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* via_dmablit.h -- PCI DMA BitBlt support for the VIA Unichrome/Pro | ||
2 | * | ||
3 | * Copyright 2005 Thomas Hellstrom. | ||
4 | * All Rights Reserved. | ||
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, sub license, | ||
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 (including the | ||
14 | * next paragraph) shall be included in all copies or substantial portions | ||
15 | * of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
20 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
23 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | * | ||
25 | * Authors: | ||
26 | * Thomas Hellstrom. | ||
27 | * Register info from Digeo Inc. | ||
28 | */ | ||
29 | |||
30 | #ifndef _VIA_DMABLIT_H | ||
31 | #define _VIA_DMABLIT_H | ||
32 | |||
33 | #include <linux/dma-mapping.h> | ||
34 | |||
35 | #define VIA_NUM_BLIT_ENGINES 2 | ||
36 | #define VIA_NUM_BLIT_SLOTS 8 | ||
37 | |||
38 | struct _drm_via_descriptor; | ||
39 | |||
40 | typedef struct _drm_via_sg_info { | ||
41 | struct page **pages; | ||
42 | unsigned long num_pages; | ||
43 | struct _drm_via_descriptor **desc_pages; | ||
44 | int num_desc_pages; | ||
45 | int num_desc; | ||
46 | enum dma_data_direction direction; | ||
47 | unsigned char *bounce_buffer; | ||
48 | dma_addr_t chain_start; | ||
49 | uint32_t free_on_sequence; | ||
50 | unsigned int descriptors_per_page; | ||
51 | int aborted; | ||
52 | enum { | ||
53 | dr_via_device_mapped, | ||
54 | dr_via_desc_pages_alloc, | ||
55 | dr_via_pages_locked, | ||
56 | dr_via_pages_alloc, | ||
57 | dr_via_sg_init | ||
58 | } state; | ||
59 | } drm_via_sg_info_t; | ||
60 | |||
61 | typedef struct _drm_via_blitq { | ||
62 | drm_device_t *dev; | ||
63 | uint32_t cur_blit_handle; | ||
64 | uint32_t done_blit_handle; | ||
65 | unsigned serviced; | ||
66 | unsigned head; | ||
67 | unsigned cur; | ||
68 | unsigned num_free; | ||
69 | unsigned num_outstanding; | ||
70 | unsigned long end; | ||
71 | int aborting; | ||
72 | int is_active; | ||
73 | drm_via_sg_info_t *blits[VIA_NUM_BLIT_SLOTS]; | ||
74 | spinlock_t blit_lock; | ||
75 | wait_queue_head_t blit_queue[VIA_NUM_BLIT_SLOTS]; | ||
76 | wait_queue_head_t busy_queue; | ||
77 | struct work_struct wq; | ||
78 | struct timer_list poll_timer; | ||
79 | } drm_via_blitq_t; | ||
80 | |||
81 | |||
82 | /* | ||
83 | * PCI DMA Registers | ||
84 | * Channels 2 & 3 don't seem to be implemented in hardware. | ||
85 | */ | ||
86 | |||
87 | #define VIA_PCI_DMA_MAR0 0xE40 /* Memory Address Register of Channel 0 */ | ||
88 | #define VIA_PCI_DMA_DAR0 0xE44 /* Device Address Register of Channel 0 */ | ||
89 | #define VIA_PCI_DMA_BCR0 0xE48 /* Byte Count Register of Channel 0 */ | ||
90 | #define VIA_PCI_DMA_DPR0 0xE4C /* Descriptor Pointer Register of Channel 0 */ | ||
91 | |||
92 | #define VIA_PCI_DMA_MAR1 0xE50 /* Memory Address Register of Channel 1 */ | ||
93 | #define VIA_PCI_DMA_DAR1 0xE54 /* Device Address Register of Channel 1 */ | ||
94 | #define VIA_PCI_DMA_BCR1 0xE58 /* Byte Count Register of Channel 1 */ | ||
95 | #define VIA_PCI_DMA_DPR1 0xE5C /* Descriptor Pointer Register of Channel 1 */ | ||
96 | |||
97 | #define VIA_PCI_DMA_MAR2 0xE60 /* Memory Address Register of Channel 2 */ | ||
98 | #define VIA_PCI_DMA_DAR2 0xE64 /* Device Address Register of Channel 2 */ | ||
99 | #define VIA_PCI_DMA_BCR2 0xE68 /* Byte Count Register of Channel 2 */ | ||
100 | #define VIA_PCI_DMA_DPR2 0xE6C /* Descriptor Pointer Register of Channel 2 */ | ||
101 | |||
102 | #define VIA_PCI_DMA_MAR3 0xE70 /* Memory Address Register of Channel 3 */ | ||
103 | #define VIA_PCI_DMA_DAR3 0xE74 /* Device Address Register of Channel 3 */ | ||
104 | #define VIA_PCI_DMA_BCR3 0xE78 /* Byte Count Register of Channel 3 */ | ||
105 | #define VIA_PCI_DMA_DPR3 0xE7C /* Descriptor Pointer Register of Channel 3 */ | ||
106 | |||
107 | #define VIA_PCI_DMA_MR0 0xE80 /* Mode Register of Channel 0 */ | ||
108 | #define VIA_PCI_DMA_MR1 0xE84 /* Mode Register of Channel 1 */ | ||
109 | #define VIA_PCI_DMA_MR2 0xE88 /* Mode Register of Channel 2 */ | ||
110 | #define VIA_PCI_DMA_MR3 0xE8C /* Mode Register of Channel 3 */ | ||
111 | |||
112 | #define VIA_PCI_DMA_CSR0 0xE90 /* Command/Status Register of Channel 0 */ | ||
113 | #define VIA_PCI_DMA_CSR1 0xE94 /* Command/Status Register of Channel 1 */ | ||
114 | #define VIA_PCI_DMA_CSR2 0xE98 /* Command/Status Register of Channel 2 */ | ||
115 | #define VIA_PCI_DMA_CSR3 0xE9C /* Command/Status Register of Channel 3 */ | ||
116 | |||
117 | #define VIA_PCI_DMA_PTR 0xEA0 /* Priority Type Register */ | ||
118 | |||
119 | /* Define for DMA engine */ | ||
120 | /* DPR */ | ||
121 | #define VIA_DMA_DPR_EC (1<<1) /* end of chain */ | ||
122 | #define VIA_DMA_DPR_DDIE (1<<2) /* descriptor done interrupt enable */ | ||
123 | #define VIA_DMA_DPR_DT (1<<3) /* direction of transfer (RO) */ | ||
124 | |||
125 | /* MR */ | ||
126 | #define VIA_DMA_MR_CM (1<<0) /* chaining mode */ | ||
127 | #define VIA_DMA_MR_TDIE (1<<1) /* transfer done interrupt enable */ | ||
128 | #define VIA_DMA_MR_HENDMACMD (1<<7) /* ? */ | ||
129 | |||
130 | /* CSR */ | ||
131 | #define VIA_DMA_CSR_DE (1<<0) /* DMA enable */ | ||
132 | #define VIA_DMA_CSR_TS (1<<1) /* transfer start */ | ||
133 | #define VIA_DMA_CSR_TA (1<<2) /* transfer abort */ | ||
134 | #define VIA_DMA_CSR_TD (1<<3) /* transfer done */ | ||
135 | #define VIA_DMA_CSR_DD (1<<4) /* descriptor done */ | ||
136 | #define VIA_DMA_DPR_EC (1<<1) /* end of chain */ | ||
137 | |||
138 | |||
139 | |||
140 | #endif | ||
diff --git a/drivers/char/drm/via_drm.h b/drivers/char/drm/via_drm.h index ebde9206115e..47f0b5b26379 100644 --- a/drivers/char/drm/via_drm.h +++ b/drivers/char/drm/via_drm.h | |||
@@ -75,6 +75,8 @@ | |||
75 | #define DRM_VIA_CMDBUF_SIZE 0x0b | 75 | #define DRM_VIA_CMDBUF_SIZE 0x0b |
76 | #define NOT_USED | 76 | #define NOT_USED |
77 | #define DRM_VIA_WAIT_IRQ 0x0d | 77 | #define DRM_VIA_WAIT_IRQ 0x0d |
78 | #define DRM_VIA_DMA_BLIT 0x0e | ||
79 | #define DRM_VIA_BLIT_SYNC 0x0f | ||
78 | 80 | ||
79 | #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) | 81 | #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) |
80 | #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) | 82 | #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) |
@@ -89,6 +91,8 @@ | |||
89 | #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ | 91 | #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ |
90 | drm_via_cmdbuf_size_t) | 92 | drm_via_cmdbuf_size_t) |
91 | #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) | 93 | #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) |
94 | #define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t) | ||
95 | #define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t) | ||
92 | 96 | ||
93 | /* Indices into buf.Setup where various bits of state are mirrored per | 97 | /* Indices into buf.Setup where various bits of state are mirrored per |
94 | * context and per buffer. These can be fired at the card as a unit, | 98 | * context and per buffer. These can be fired at the card as a unit, |
@@ -103,8 +107,12 @@ | |||
103 | #define VIA_BACK 0x2 | 107 | #define VIA_BACK 0x2 |
104 | #define VIA_DEPTH 0x4 | 108 | #define VIA_DEPTH 0x4 |
105 | #define VIA_STENCIL 0x8 | 109 | #define VIA_STENCIL 0x8 |
106 | #define VIDEO 0 | 110 | #define VIA_MEM_VIDEO 0 /* matches drm constant */ |
107 | #define AGP 1 | 111 | #define VIA_MEM_AGP 1 /* matches drm constant */ |
112 | #define VIA_MEM_SYSTEM 2 | ||
113 | #define VIA_MEM_MIXED 3 | ||
114 | #define VIA_MEM_UNKNOWN 4 | ||
115 | |||
108 | typedef struct { | 116 | typedef struct { |
109 | uint32_t offset; | 117 | uint32_t offset; |
110 | uint32_t size; | 118 | uint32_t size; |
@@ -192,6 +200,9 @@ typedef struct _drm_via_sarea { | |||
192 | unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; | 200 | unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; |
193 | unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ | 201 | unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ |
194 | 202 | ||
203 | /* Used by the 3d driver only at this point, for pageflipping: | ||
204 | */ | ||
205 | unsigned int pfCurrentOffset; | ||
195 | } drm_via_sarea_t; | 206 | } drm_via_sarea_t; |
196 | 207 | ||
197 | typedef struct _drm_via_cmdbuf_size { | 208 | typedef struct _drm_via_cmdbuf_size { |
@@ -212,6 +223,16 @@ typedef enum { | |||
212 | 223 | ||
213 | #define VIA_IRQ_FLAGS_MASK 0xF0000000 | 224 | #define VIA_IRQ_FLAGS_MASK 0xF0000000 |
214 | 225 | ||
226 | enum drm_via_irqs { | ||
227 | drm_via_irq_hqv0 = 0, | ||
228 | drm_via_irq_hqv1, | ||
229 | drm_via_irq_dma0_dd, | ||
230 | drm_via_irq_dma0_td, | ||
231 | drm_via_irq_dma1_dd, | ||
232 | drm_via_irq_dma1_td, | ||
233 | drm_via_irq_num | ||
234 | }; | ||
235 | |||
215 | struct drm_via_wait_irq_request { | 236 | struct drm_via_wait_irq_request { |
216 | unsigned irq; | 237 | unsigned irq; |
217 | via_irq_seq_type_t type; | 238 | via_irq_seq_type_t type; |
@@ -224,20 +245,25 @@ typedef union drm_via_irqwait { | |||
224 | struct drm_wait_vblank_reply reply; | 245 | struct drm_wait_vblank_reply reply; |
225 | } drm_via_irqwait_t; | 246 | } drm_via_irqwait_t; |
226 | 247 | ||
227 | #ifdef __KERNEL__ | 248 | typedef struct drm_via_blitsync { |
228 | 249 | uint32_t sync_handle; | |
229 | int via_fb_init(DRM_IOCTL_ARGS); | 250 | unsigned engine; |
230 | int via_mem_alloc(DRM_IOCTL_ARGS); | 251 | } drm_via_blitsync_t; |
231 | int via_mem_free(DRM_IOCTL_ARGS); | 252 | |
232 | int via_agp_init(DRM_IOCTL_ARGS); | 253 | typedef struct drm_via_dmablit { |
233 | int via_map_init(DRM_IOCTL_ARGS); | 254 | uint32_t num_lines; |
234 | int via_decoder_futex(DRM_IOCTL_ARGS); | 255 | uint32_t line_length; |
235 | int via_dma_init(DRM_IOCTL_ARGS); | 256 | |
236 | int via_cmdbuffer(DRM_IOCTL_ARGS); | 257 | uint32_t fb_addr; |
237 | int via_flush_ioctl(DRM_IOCTL_ARGS); | 258 | uint32_t fb_stride; |
238 | int via_pci_cmdbuffer(DRM_IOCTL_ARGS); | 259 | |
239 | int via_cmdbuf_size(DRM_IOCTL_ARGS); | 260 | unsigned char *mem_addr; |
240 | int via_wait_irq(DRM_IOCTL_ARGS); | 261 | uint32_t mem_stride; |
262 | |||
263 | int bounce_buffer; | ||
264 | int to_fb; | ||
265 | |||
266 | drm_via_blitsync_t sync; | ||
267 | } drm_via_dmablit_t; | ||
241 | 268 | ||
242 | #endif | ||
243 | #endif /* _VIA_DRM_H_ */ | 269 | #endif /* _VIA_DRM_H_ */ |
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c index 016665e0c69f..3f012255d315 100644 --- a/drivers/char/drm/via_drv.c +++ b/drivers/char/drm/via_drv.c | |||
@@ -29,54 +29,21 @@ | |||
29 | 29 | ||
30 | #include "drm_pciids.h" | 30 | #include "drm_pciids.h" |
31 | 31 | ||
32 | static int postinit(struct drm_device *dev, unsigned long flags) | 32 | static int dri_library_name(struct drm_device *dev, char *buf) |
33 | { | 33 | { |
34 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n", | 34 | return snprintf(buf, PAGE_SIZE, "unichrome"); |
35 | DRIVER_NAME, | ||
36 | DRIVER_MAJOR, | ||
37 | DRIVER_MINOR, | ||
38 | DRIVER_PATCHLEVEL, | ||
39 | DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) | ||
40 | ); | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | static int version(drm_version_t * version) | ||
45 | { | ||
46 | int len; | ||
47 | |||
48 | version->version_major = DRIVER_MAJOR; | ||
49 | version->version_minor = DRIVER_MINOR; | ||
50 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
51 | DRM_COPY(version->name, DRIVER_NAME); | ||
52 | DRM_COPY(version->date, DRIVER_DATE); | ||
53 | DRM_COPY(version->desc, DRIVER_DESC); | ||
54 | return 0; | ||
55 | } | 35 | } |
56 | 36 | ||
57 | static struct pci_device_id pciidlist[] = { | 37 | static struct pci_device_id pciidlist[] = { |
58 | viadrv_PCI_IDS | 38 | viadrv_PCI_IDS |
59 | }; | 39 | }; |
60 | 40 | ||
61 | static drm_ioctl_desc_t ioctls[] = { | ||
62 | [DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = {via_mem_alloc, 1, 0}, | ||
63 | [DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = {via_mem_free, 1, 0}, | ||
64 | [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, 1, 0}, | ||
65 | [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, 1, 0}, | ||
66 | [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, 1, 0}, | ||
67 | [DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = {via_decoder_futex, 1, 0}, | ||
68 | [DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = {via_dma_init, 1, 0}, | ||
69 | [DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = {via_cmdbuffer, 1, 0}, | ||
70 | [DRM_IOCTL_NR(DRM_VIA_FLUSH)] = {via_flush_ioctl, 1, 0}, | ||
71 | [DRM_IOCTL_NR(DRM_VIA_PCICMD)] = {via_pci_cmdbuffer, 1, 0}, | ||
72 | [DRM_IOCTL_NR(DRM_VIA_CMDBUF_SIZE)] = {via_cmdbuf_size, 1, 0}, | ||
73 | [DRM_IOCTL_NR(DRM_VIA_WAIT_IRQ)] = {via_wait_irq, 1, 0} | ||
74 | }; | ||
75 | |||
76 | static struct drm_driver driver = { | 41 | static struct drm_driver driver = { |
77 | .driver_features = | 42 | .driver_features = |
78 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | | 43 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | |
79 | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, | 44 | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, |
45 | .load = via_driver_load, | ||
46 | .unload = via_driver_unload, | ||
80 | .context_ctor = via_init_context, | 47 | .context_ctor = via_init_context, |
81 | .context_dtor = via_final_context, | 48 | .context_dtor = via_final_context, |
82 | .vblank_wait = via_driver_vblank_wait, | 49 | .vblank_wait = via_driver_vblank_wait, |
@@ -85,13 +52,11 @@ static struct drm_driver driver = { | |||
85 | .irq_uninstall = via_driver_irq_uninstall, | 52 | .irq_uninstall = via_driver_irq_uninstall, |
86 | .irq_handler = via_driver_irq_handler, | 53 | .irq_handler = via_driver_irq_handler, |
87 | .dma_quiescent = via_driver_dma_quiescent, | 54 | .dma_quiescent = via_driver_dma_quiescent, |
55 | .dri_library_name = dri_library_name, | ||
88 | .reclaim_buffers = drm_core_reclaim_buffers, | 56 | .reclaim_buffers = drm_core_reclaim_buffers, |
89 | .get_map_ofs = drm_core_get_map_ofs, | 57 | .get_map_ofs = drm_core_get_map_ofs, |
90 | .get_reg_ofs = drm_core_get_reg_ofs, | 58 | .get_reg_ofs = drm_core_get_reg_ofs, |
91 | .postinit = postinit, | 59 | .ioctls = via_ioctls, |
92 | .version = version, | ||
93 | .ioctls = ioctls, | ||
94 | .num_ioctls = DRM_ARRAY_SIZE(ioctls), | ||
95 | .fops = { | 60 | .fops = { |
96 | .owner = THIS_MODULE, | 61 | .owner = THIS_MODULE, |
97 | .open = drm_open, | 62 | .open = drm_open, |
@@ -100,15 +65,23 @@ static struct drm_driver driver = { | |||
100 | .mmap = drm_mmap, | 65 | .mmap = drm_mmap, |
101 | .poll = drm_poll, | 66 | .poll = drm_poll, |
102 | .fasync = drm_fasync, | 67 | .fasync = drm_fasync, |
103 | }, | 68 | }, |
104 | .pci_driver = { | 69 | .pci_driver = { |
105 | .name = DRIVER_NAME, | 70 | .name = DRIVER_NAME, |
106 | .id_table = pciidlist, | 71 | .id_table = pciidlist, |
107 | } | 72 | }, |
73 | |||
74 | .name = DRIVER_NAME, | ||
75 | .desc = DRIVER_DESC, | ||
76 | .date = DRIVER_DATE, | ||
77 | .major = DRIVER_MAJOR, | ||
78 | .minor = DRIVER_MINOR, | ||
79 | .patchlevel = DRIVER_PATCHLEVEL, | ||
108 | }; | 80 | }; |
109 | 81 | ||
110 | static int __init via_init(void) | 82 | static int __init via_init(void) |
111 | { | 83 | { |
84 | driver.num_ioctls = via_max_ioctl; | ||
112 | via_init_command_verifier(); | 85 | via_init_command_verifier(); |
113 | return drm_init(&driver); | 86 | return drm_init(&driver); |
114 | } | 87 | } |
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h index 7d5daf43797e..aad4f99f5405 100644 --- a/drivers/char/drm/via_drv.h +++ b/drivers/char/drm/via_drv.h | |||
@@ -24,24 +24,26 @@ | |||
24 | #ifndef _VIA_DRV_H_ | 24 | #ifndef _VIA_DRV_H_ |
25 | #define _VIA_DRV_H_ | 25 | #define _VIA_DRV_H_ |
26 | 26 | ||
27 | #define DRIVER_AUTHOR "VIA" | 27 | #define DRIVER_AUTHOR "Various" |
28 | 28 | ||
29 | #define DRIVER_NAME "via" | 29 | #define DRIVER_NAME "via" |
30 | #define DRIVER_DESC "VIA Unichrome / Pro" | 30 | #define DRIVER_DESC "VIA Unichrome / Pro" |
31 | #define DRIVER_DATE "20050523" | 31 | #define DRIVER_DATE "20051116" |
32 | 32 | ||
33 | #define DRIVER_MAJOR 2 | 33 | #define DRIVER_MAJOR 2 |
34 | #define DRIVER_MINOR 6 | 34 | #define DRIVER_MINOR 7 |
35 | #define DRIVER_PATCHLEVEL 3 | 35 | #define DRIVER_PATCHLEVEL 4 |
36 | 36 | ||
37 | #include "via_verifier.h" | 37 | #include "via_verifier.h" |
38 | 38 | ||
39 | #include "via_dmablit.h" | ||
40 | |||
39 | #define VIA_PCI_BUF_SIZE 60000 | 41 | #define VIA_PCI_BUF_SIZE 60000 |
40 | #define VIA_FIRE_BUF_SIZE 1024 | 42 | #define VIA_FIRE_BUF_SIZE 1024 |
41 | #define VIA_NUM_IRQS 2 | 43 | #define VIA_NUM_IRQS 4 |
42 | 44 | ||
43 | typedef struct drm_via_ring_buffer { | 45 | typedef struct drm_via_ring_buffer { |
44 | drm_map_t map; | 46 | drm_local_map_t map; |
45 | char *virtual_start; | 47 | char *virtual_start; |
46 | } drm_via_ring_buffer_t; | 48 | } drm_via_ring_buffer_t; |
47 | 49 | ||
@@ -56,9 +58,9 @@ typedef struct drm_via_irq { | |||
56 | 58 | ||
57 | typedef struct drm_via_private { | 59 | typedef struct drm_via_private { |
58 | drm_via_sarea_t *sarea_priv; | 60 | drm_via_sarea_t *sarea_priv; |
59 | drm_map_t *sarea; | 61 | drm_local_map_t *sarea; |
60 | drm_map_t *fb; | 62 | drm_local_map_t *fb; |
61 | drm_map_t *mmio; | 63 | drm_local_map_t *mmio; |
62 | unsigned long agpAddr; | 64 | unsigned long agpAddr; |
63 | wait_queue_head_t decoder_queue[VIA_NR_XVMC_LOCKS]; | 65 | wait_queue_head_t decoder_queue[VIA_NR_XVMC_LOCKS]; |
64 | char *dma_ptr; | 66 | char *dma_ptr; |
@@ -82,8 +84,15 @@ typedef struct drm_via_private { | |||
82 | maskarray_t *irq_masks; | 84 | maskarray_t *irq_masks; |
83 | uint32_t irq_enable_mask; | 85 | uint32_t irq_enable_mask; |
84 | uint32_t irq_pending_mask; | 86 | uint32_t irq_pending_mask; |
87 | int *irq_map; | ||
88 | drm_via_blitq_t blit_queues[VIA_NUM_BLIT_ENGINES]; | ||
85 | } drm_via_private_t; | 89 | } drm_via_private_t; |
86 | 90 | ||
91 | enum via_family { | ||
92 | VIA_OTHER = 0, | ||
93 | VIA_PRO_GROUP_A, | ||
94 | }; | ||
95 | |||
87 | /* VIA MMIO register access */ | 96 | /* VIA MMIO register access */ |
88 | #define VIA_BASE ((dev_priv->mmio)) | 97 | #define VIA_BASE ((dev_priv->mmio)) |
89 | 98 | ||
@@ -92,12 +101,31 @@ typedef struct drm_via_private { | |||
92 | #define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg) | 101 | #define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg) |
93 | #define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val) | 102 | #define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val) |
94 | 103 | ||
104 | extern drm_ioctl_desc_t via_ioctls[]; | ||
105 | extern int via_max_ioctl; | ||
106 | |||
107 | extern int via_fb_init(DRM_IOCTL_ARGS); | ||
108 | extern int via_mem_alloc(DRM_IOCTL_ARGS); | ||
109 | extern int via_mem_free(DRM_IOCTL_ARGS); | ||
110 | extern int via_agp_init(DRM_IOCTL_ARGS); | ||
111 | extern int via_map_init(DRM_IOCTL_ARGS); | ||
112 | extern int via_decoder_futex(DRM_IOCTL_ARGS); | ||
113 | extern int via_dma_init(DRM_IOCTL_ARGS); | ||
114 | extern int via_cmdbuffer(DRM_IOCTL_ARGS); | ||
115 | extern int via_flush_ioctl(DRM_IOCTL_ARGS); | ||
116 | extern int via_pci_cmdbuffer(DRM_IOCTL_ARGS); | ||
117 | extern int via_cmdbuf_size(DRM_IOCTL_ARGS); | ||
118 | extern int via_wait_irq(DRM_IOCTL_ARGS); | ||
119 | extern int via_dma_blit_sync( DRM_IOCTL_ARGS ); | ||
120 | extern int via_dma_blit( DRM_IOCTL_ARGS ); | ||
121 | |||
122 | extern int via_driver_load(drm_device_t *dev, unsigned long chipset); | ||
123 | extern int via_driver_unload(drm_device_t *dev); | ||
124 | |||
95 | extern int via_init_context(drm_device_t * dev, int context); | 125 | extern int via_init_context(drm_device_t * dev, int context); |
96 | extern int via_final_context(drm_device_t * dev, int context); | 126 | extern int via_final_context(drm_device_t * dev, int context); |
97 | 127 | ||
98 | extern int via_do_cleanup_map(drm_device_t * dev); | 128 | extern int via_do_cleanup_map(drm_device_t * dev); |
99 | extern int via_map_init(struct inode *inode, struct file *filp, | ||
100 | unsigned int cmd, unsigned long arg); | ||
101 | extern int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence); | 129 | extern int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence); |
102 | 130 | ||
103 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); | 131 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); |
@@ -111,8 +139,10 @@ extern int via_driver_dma_quiescent(drm_device_t * dev); | |||
111 | extern void via_init_futex(drm_via_private_t * dev_priv); | 139 | extern void via_init_futex(drm_via_private_t * dev_priv); |
112 | extern void via_cleanup_futex(drm_via_private_t * dev_priv); | 140 | extern void via_cleanup_futex(drm_via_private_t * dev_priv); |
113 | extern void via_release_futex(drm_via_private_t * dev_priv, int context); | 141 | extern void via_release_futex(drm_via_private_t * dev_priv, int context); |
142 | extern int via_driver_irq_wait(drm_device_t * dev, unsigned int irq, | ||
143 | int force_sequence, unsigned int *sequence); | ||
114 | 144 | ||
115 | extern int via_parse_command_stream(drm_device_t * dev, const uint32_t * buf, | 145 | extern void via_dmablit_handler(drm_device_t *dev, int engine, int from_irq); |
116 | unsigned int size); | 146 | extern void via_init_dmablit(drm_device_t *dev); |
117 | 147 | ||
118 | #endif | 148 | #endif |
diff --git a/drivers/char/drm/via_ds.c b/drivers/char/drm/via_ds.c index 5c71e089246c..9429736b3b96 100644 --- a/drivers/char/drm/via_ds.c +++ b/drivers/char/drm/via_ds.c | |||
@@ -22,14 +22,7 @@ | |||
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | * DEALINGS IN THE SOFTWARE. | 23 | * DEALINGS IN THE SOFTWARE. |
24 | */ | 24 | */ |
25 | #include <linux/module.h> | 25 | #include "drmP.h" |
26 | #include <linux/delay.h> | ||
27 | #include <linux/errno.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/poll.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <asm/io.h> | ||
33 | 26 | ||
34 | #include "via_ds.h" | 27 | #include "via_ds.h" |
35 | extern unsigned int VIA_DEBUG; | 28 | extern unsigned int VIA_DEBUG; |
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c index d023add1929b..56d7e3daea12 100644 --- a/drivers/char/drm/via_irq.c +++ b/drivers/char/drm/via_irq.c | |||
@@ -50,6 +50,15 @@ | |||
50 | #define VIA_IRQ_HQV1_ENABLE (1 << 25) | 50 | #define VIA_IRQ_HQV1_ENABLE (1 << 25) |
51 | #define VIA_IRQ_HQV0_PENDING (1 << 9) | 51 | #define VIA_IRQ_HQV0_PENDING (1 << 9) |
52 | #define VIA_IRQ_HQV1_PENDING (1 << 10) | 52 | #define VIA_IRQ_HQV1_PENDING (1 << 10) |
53 | #define VIA_IRQ_DMA0_DD_ENABLE (1 << 20) | ||
54 | #define VIA_IRQ_DMA0_TD_ENABLE (1 << 21) | ||
55 | #define VIA_IRQ_DMA1_DD_ENABLE (1 << 22) | ||
56 | #define VIA_IRQ_DMA1_TD_ENABLE (1 << 23) | ||
57 | #define VIA_IRQ_DMA0_DD_PENDING (1 << 4) | ||
58 | #define VIA_IRQ_DMA0_TD_PENDING (1 << 5) | ||
59 | #define VIA_IRQ_DMA1_DD_PENDING (1 << 6) | ||
60 | #define VIA_IRQ_DMA1_TD_PENDING (1 << 7) | ||
61 | |||
53 | 62 | ||
54 | /* | 63 | /* |
55 | * Device-specific IRQs go here. This type might need to be extended with | 64 | * Device-specific IRQs go here. This type might need to be extended with |
@@ -61,13 +70,24 @@ static maskarray_t via_pro_group_a_irqs[] = { | |||
61 | {VIA_IRQ_HQV0_ENABLE, VIA_IRQ_HQV0_PENDING, 0x000003D0, 0x00008010, | 70 | {VIA_IRQ_HQV0_ENABLE, VIA_IRQ_HQV0_PENDING, 0x000003D0, 0x00008010, |
62 | 0x00000000}, | 71 | 0x00000000}, |
63 | {VIA_IRQ_HQV1_ENABLE, VIA_IRQ_HQV1_PENDING, 0x000013D0, 0x00008010, | 72 | {VIA_IRQ_HQV1_ENABLE, VIA_IRQ_HQV1_PENDING, 0x000013D0, 0x00008010, |
64 | 0x00000000} | 73 | 0x00000000}, |
74 | {VIA_IRQ_DMA0_TD_ENABLE, VIA_IRQ_DMA0_TD_PENDING, VIA_PCI_DMA_CSR0, | ||
75 | VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008}, | ||
76 | {VIA_IRQ_DMA1_TD_ENABLE, VIA_IRQ_DMA1_TD_PENDING, VIA_PCI_DMA_CSR1, | ||
77 | VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008}, | ||
65 | }; | 78 | }; |
66 | static int via_num_pro_group_a = | 79 | static int via_num_pro_group_a = |
67 | sizeof(via_pro_group_a_irqs) / sizeof(maskarray_t); | 80 | sizeof(via_pro_group_a_irqs) / sizeof(maskarray_t); |
81 | static int via_irqmap_pro_group_a[] = {0, 1, -1, 2, -1, 3}; | ||
68 | 82 | ||
69 | static maskarray_t via_unichrome_irqs[] = { }; | 83 | static maskarray_t via_unichrome_irqs[] = { |
84 | {VIA_IRQ_DMA0_TD_ENABLE, VIA_IRQ_DMA0_TD_PENDING, VIA_PCI_DMA_CSR0, | ||
85 | VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008}, | ||
86 | {VIA_IRQ_DMA1_TD_ENABLE, VIA_IRQ_DMA1_TD_PENDING, VIA_PCI_DMA_CSR1, | ||
87 | VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008} | ||
88 | }; | ||
70 | static int via_num_unichrome = sizeof(via_unichrome_irqs) / sizeof(maskarray_t); | 89 | static int via_num_unichrome = sizeof(via_unichrome_irqs) / sizeof(maskarray_t); |
90 | static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1}; | ||
71 | 91 | ||
72 | static unsigned time_diff(struct timeval *now, struct timeval *then) | 92 | static unsigned time_diff(struct timeval *now, struct timeval *then) |
73 | { | 93 | { |
@@ -113,6 +133,11 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | |||
113 | atomic_inc(&cur_irq->irq_received); | 133 | atomic_inc(&cur_irq->irq_received); |
114 | DRM_WAKEUP(&cur_irq->irq_queue); | 134 | DRM_WAKEUP(&cur_irq->irq_queue); |
115 | handled = 1; | 135 | handled = 1; |
136 | if (dev_priv->irq_map[drm_via_irq_dma0_td] == i) { | ||
137 | via_dmablit_handler(dev, 0, 1); | ||
138 | } else if (dev_priv->irq_map[drm_via_irq_dma1_td] == i) { | ||
139 | via_dmablit_handler(dev, 1, 1); | ||
140 | } | ||
116 | } | 141 | } |
117 | cur_irq++; | 142 | cur_irq++; |
118 | } | 143 | } |
@@ -165,7 +190,7 @@ int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) | |||
165 | return ret; | 190 | return ret; |
166 | } | 191 | } |
167 | 192 | ||
168 | static int | 193 | int |
169 | via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, | 194 | via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, |
170 | unsigned int *sequence) | 195 | unsigned int *sequence) |
171 | { | 196 | { |
@@ -174,6 +199,7 @@ via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, | |||
174 | drm_via_irq_t *cur_irq = dev_priv->via_irqs; | 199 | drm_via_irq_t *cur_irq = dev_priv->via_irqs; |
175 | int ret = 0; | 200 | int ret = 0; |
176 | maskarray_t *masks = dev_priv->irq_masks; | 201 | maskarray_t *masks = dev_priv->irq_masks; |
202 | int real_irq; | ||
177 | 203 | ||
178 | DRM_DEBUG("%s\n", __FUNCTION__); | 204 | DRM_DEBUG("%s\n", __FUNCTION__); |
179 | 205 | ||
@@ -182,15 +208,23 @@ via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, | |||
182 | return DRM_ERR(EINVAL); | 208 | return DRM_ERR(EINVAL); |
183 | } | 209 | } |
184 | 210 | ||
185 | if (irq >= dev_priv->num_irqs) { | 211 | if (irq >= drm_via_irq_num) { |
186 | DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, | 212 | DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, |
187 | irq); | 213 | irq); |
188 | return DRM_ERR(EINVAL); | 214 | return DRM_ERR(EINVAL); |
189 | } | 215 | } |
190 | 216 | ||
191 | cur_irq += irq; | 217 | real_irq = dev_priv->irq_map[irq]; |
218 | |||
219 | if (real_irq < 0) { | ||
220 | DRM_ERROR("%s Video IRQ %d not available on this hardware.\n", | ||
221 | __FUNCTION__, irq); | ||
222 | return DRM_ERR(EINVAL); | ||
223 | } | ||
224 | |||
225 | cur_irq += real_irq; | ||
192 | 226 | ||
193 | if (masks[irq][2] && !force_sequence) { | 227 | if (masks[real_irq][2] && !force_sequence) { |
194 | DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ, | 228 | DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ, |
195 | ((VIA_READ(masks[irq][2]) & masks[irq][3]) == | 229 | ((VIA_READ(masks[irq][2]) & masks[irq][3]) == |
196 | masks[irq][4])); | 230 | masks[irq][4])); |
@@ -226,6 +260,8 @@ void via_driver_irq_preinstall(drm_device_t * dev) | |||
226 | via_pro_group_a_irqs : via_unichrome_irqs; | 260 | via_pro_group_a_irqs : via_unichrome_irqs; |
227 | dev_priv->num_irqs = (dev_priv->pro_group_a) ? | 261 | dev_priv->num_irqs = (dev_priv->pro_group_a) ? |
228 | via_num_pro_group_a : via_num_unichrome; | 262 | via_num_pro_group_a : via_num_unichrome; |
263 | dev_priv->irq_map = (dev_priv->pro_group_a) ? | ||
264 | via_irqmap_pro_group_a : via_irqmap_unichrome; | ||
229 | 265 | ||
230 | for (i = 0; i < dev_priv->num_irqs; ++i) { | 266 | for (i = 0; i < dev_priv->num_irqs; ++i) { |
231 | atomic_set(&cur_irq->irq_received, 0); | 267 | atomic_set(&cur_irq->irq_received, 0); |
@@ -241,7 +277,7 @@ void via_driver_irq_preinstall(drm_device_t * dev) | |||
241 | 277 | ||
242 | dev_priv->last_vblank_valid = 0; | 278 | dev_priv->last_vblank_valid = 0; |
243 | 279 | ||
244 | // Clear VSync interrupt regs | 280 | /* Clear VSync interrupt regs */ |
245 | status = VIA_READ(VIA_REG_INTERRUPT); | 281 | status = VIA_READ(VIA_REG_INTERRUPT); |
246 | VIA_WRITE(VIA_REG_INTERRUPT, status & | 282 | VIA_WRITE(VIA_REG_INTERRUPT, status & |
247 | ~(dev_priv->irq_enable_mask)); | 283 | ~(dev_priv->irq_enable_mask)); |
@@ -291,8 +327,7 @@ void via_driver_irq_uninstall(drm_device_t * dev) | |||
291 | 327 | ||
292 | int via_wait_irq(DRM_IOCTL_ARGS) | 328 | int via_wait_irq(DRM_IOCTL_ARGS) |
293 | { | 329 | { |
294 | drm_file_t *priv = filp->private_data; | 330 | DRM_DEVICE; |
295 | drm_device_t *dev = priv->head->dev; | ||
296 | drm_via_irqwait_t __user *argp = (void __user *)data; | 331 | drm_via_irqwait_t __user *argp = (void __user *)data; |
297 | drm_via_irqwait_t irqwait; | 332 | drm_via_irqwait_t irqwait; |
298 | struct timeval now; | 333 | struct timeval now; |
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c index 6bd6ac52ad1b..c6a08e96285b 100644 --- a/drivers/char/drm/via_map.c +++ b/drivers/char/drm/via_map.c | |||
@@ -27,16 +27,10 @@ | |||
27 | 27 | ||
28 | static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) | 28 | static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) |
29 | { | 29 | { |
30 | drm_via_private_t *dev_priv; | 30 | drm_via_private_t *dev_priv = dev->dev_private; |
31 | 31 | ||
32 | DRM_DEBUG("%s\n", __FUNCTION__); | 32 | DRM_DEBUG("%s\n", __FUNCTION__); |
33 | 33 | ||
34 | dev_priv = drm_alloc(sizeof(drm_via_private_t), DRM_MEM_DRIVER); | ||
35 | if (dev_priv == NULL) | ||
36 | return -ENOMEM; | ||
37 | |||
38 | memset(dev_priv, 0, sizeof(drm_via_private_t)); | ||
39 | |||
40 | DRM_GETSAREA(); | 34 | DRM_GETSAREA(); |
41 | if (!dev_priv->sarea) { | 35 | if (!dev_priv->sarea) { |
42 | DRM_ERROR("could not find sarea!\n"); | 36 | DRM_ERROR("could not find sarea!\n"); |
@@ -67,7 +61,8 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) | |||
67 | dev_priv->agpAddr = init->agpAddr; | 61 | dev_priv->agpAddr = init->agpAddr; |
68 | 62 | ||
69 | via_init_futex(dev_priv); | 63 | via_init_futex(dev_priv); |
70 | dev_priv->pro_group_a = (dev->pdev->device == 0x3118); | 64 | |
65 | via_init_dmablit(dev); | ||
71 | 66 | ||
72 | dev->dev_private = (void *)dev_priv; | 67 | dev->dev_private = (void *)dev_priv; |
73 | return 0; | 68 | return 0; |
@@ -75,15 +70,7 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) | |||
75 | 70 | ||
76 | int via_do_cleanup_map(drm_device_t * dev) | 71 | int via_do_cleanup_map(drm_device_t * dev) |
77 | { | 72 | { |
78 | if (dev->dev_private) { | 73 | via_dma_cleanup(dev); |
79 | |||
80 | drm_via_private_t *dev_priv = dev->dev_private; | ||
81 | |||
82 | via_dma_cleanup(dev); | ||
83 | |||
84 | drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER); | ||
85 | dev->dev_private = NULL; | ||
86 | } | ||
87 | 74 | ||
88 | return 0; | 75 | return 0; |
89 | } | 76 | } |
@@ -107,3 +94,29 @@ int via_map_init(DRM_IOCTL_ARGS) | |||
107 | 94 | ||
108 | return -EINVAL; | 95 | return -EINVAL; |
109 | } | 96 | } |
97 | |||
98 | int via_driver_load(drm_device_t *dev, unsigned long chipset) | ||
99 | { | ||
100 | drm_via_private_t *dev_priv; | ||
101 | |||
102 | dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER); | ||
103 | if (dev_priv == NULL) | ||
104 | return DRM_ERR(ENOMEM); | ||
105 | |||
106 | dev->dev_private = (void *)dev_priv; | ||
107 | |||
108 | if (chipset == VIA_PRO_GROUP_A) | ||
109 | dev_priv->pro_group_a = 1; | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | int via_driver_unload(drm_device_t *dev) | ||
115 | { | ||
116 | drm_via_private_t *dev_priv = dev->dev_private; | ||
117 | |||
118 | drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER); | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c index 3baddacdff26..33e0cb12e4c3 100644 --- a/drivers/char/drm/via_mm.c +++ b/drivers/char/drm/via_mm.c | |||
@@ -42,7 +42,7 @@ static int via_agp_free(drm_via_mem_t * mem); | |||
42 | static int via_fb_alloc(drm_via_mem_t * mem); | 42 | static int via_fb_alloc(drm_via_mem_t * mem); |
43 | static int via_fb_free(drm_via_mem_t * mem); | 43 | static int via_fb_free(drm_via_mem_t * mem); |
44 | 44 | ||
45 | static int add_alloc_set(int context, int type, unsigned int val) | 45 | static int add_alloc_set(int context, int type, unsigned long val) |
46 | { | 46 | { |
47 | int i, retval = 0; | 47 | int i, retval = 0; |
48 | 48 | ||
@@ -56,7 +56,7 @@ static int add_alloc_set(int context, int type, unsigned int val) | |||
56 | return retval; | 56 | return retval; |
57 | } | 57 | } |
58 | 58 | ||
59 | static int del_alloc_set(int context, int type, unsigned int val) | 59 | static int del_alloc_set(int context, int type, unsigned long val) |
60 | { | 60 | { |
61 | int i, retval = 0; | 61 | int i, retval = 0; |
62 | 62 | ||
@@ -199,13 +199,13 @@ int via_mem_alloc(DRM_IOCTL_ARGS) | |||
199 | sizeof(mem)); | 199 | sizeof(mem)); |
200 | 200 | ||
201 | switch (mem.type) { | 201 | switch (mem.type) { |
202 | case VIDEO: | 202 | case VIA_MEM_VIDEO: |
203 | if (via_fb_alloc(&mem) < 0) | 203 | if (via_fb_alloc(&mem) < 0) |
204 | return -EFAULT; | 204 | return -EFAULT; |
205 | DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, | 205 | DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, |
206 | sizeof(mem)); | 206 | sizeof(mem)); |
207 | return 0; | 207 | return 0; |
208 | case AGP: | 208 | case VIA_MEM_AGP: |
209 | if (via_agp_alloc(&mem) < 0) | 209 | if (via_agp_alloc(&mem) < 0) |
210 | return -EFAULT; | 210 | return -EFAULT; |
211 | DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, | 211 | DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, |
@@ -232,7 +232,7 @@ static int via_fb_alloc(drm_via_mem_t * mem) | |||
232 | if (block) { | 232 | if (block) { |
233 | fb.offset = block->ofs; | 233 | fb.offset = block->ofs; |
234 | fb.free = (unsigned long)block; | 234 | fb.free = (unsigned long)block; |
235 | if (!add_alloc_set(fb.context, VIDEO, fb.free)) { | 235 | if (!add_alloc_set(fb.context, VIA_MEM_VIDEO, fb.free)) { |
236 | DRM_DEBUG("adding to allocation set fails\n"); | 236 | DRM_DEBUG("adding to allocation set fails\n"); |
237 | via_mmFreeMem((PMemBlock) fb.free); | 237 | via_mmFreeMem((PMemBlock) fb.free); |
238 | retval = -1; | 238 | retval = -1; |
@@ -269,7 +269,7 @@ static int via_agp_alloc(drm_via_mem_t * mem) | |||
269 | if (block) { | 269 | if (block) { |
270 | agp.offset = block->ofs; | 270 | agp.offset = block->ofs; |
271 | agp.free = (unsigned long)block; | 271 | agp.free = (unsigned long)block; |
272 | if (!add_alloc_set(agp.context, AGP, agp.free)) { | 272 | if (!add_alloc_set(agp.context, VIA_MEM_AGP, agp.free)) { |
273 | DRM_DEBUG("adding to allocation set fails\n"); | 273 | DRM_DEBUG("adding to allocation set fails\n"); |
274 | via_mmFreeMem((PMemBlock) agp.free); | 274 | via_mmFreeMem((PMemBlock) agp.free); |
275 | retval = -1; | 275 | retval = -1; |
@@ -297,11 +297,11 @@ int via_mem_free(DRM_IOCTL_ARGS) | |||
297 | 297 | ||
298 | switch (mem.type) { | 298 | switch (mem.type) { |
299 | 299 | ||
300 | case VIDEO: | 300 | case VIA_MEM_VIDEO: |
301 | if (via_fb_free(&mem) == 0) | 301 | if (via_fb_free(&mem) == 0) |
302 | return 0; | 302 | return 0; |
303 | break; | 303 | break; |
304 | case AGP: | 304 | case VIA_MEM_AGP: |
305 | if (via_agp_free(&mem) == 0) | 305 | if (via_agp_free(&mem) == 0) |
306 | return 0; | 306 | return 0; |
307 | break; | 307 | break; |
@@ -329,7 +329,7 @@ static int via_fb_free(drm_via_mem_t * mem) | |||
329 | 329 | ||
330 | via_mmFreeMem((PMemBlock) fb.free); | 330 | via_mmFreeMem((PMemBlock) fb.free); |
331 | 331 | ||
332 | if (!del_alloc_set(fb.context, VIDEO, fb.free)) { | 332 | if (!del_alloc_set(fb.context, VIA_MEM_VIDEO, fb.free)) { |
333 | retval = -1; | 333 | retval = -1; |
334 | } | 334 | } |
335 | 335 | ||
@@ -352,7 +352,7 @@ static int via_agp_free(drm_via_mem_t * mem) | |||
352 | 352 | ||
353 | via_mmFreeMem((PMemBlock) agp.free); | 353 | via_mmFreeMem((PMemBlock) agp.free); |
354 | 354 | ||
355 | if (!del_alloc_set(agp.context, AGP, agp.free)) { | 355 | if (!del_alloc_set(agp.context, VIA_MEM_AGP, agp.free)) { |
356 | retval = -1; | 356 | retval = -1; |
357 | } | 357 | } |
358 | 358 | ||
diff --git a/drivers/char/drm/via_verifier.c b/drivers/char/drm/via_verifier.c index 4ac495f297f7..70c897c88766 100644 --- a/drivers/char/drm/via_verifier.c +++ b/drivers/char/drm/via_verifier.c | |||
@@ -237,7 +237,7 @@ static hazard_t table3[256]; | |||
237 | static __inline__ int | 237 | static __inline__ int |
238 | eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words) | 238 | eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words) |
239 | { | 239 | { |
240 | if ((*buf - buf_end) >= num_words) { | 240 | if ((buf_end - *buf) >= num_words) { |
241 | *buf += num_words; | 241 | *buf += num_words; |
242 | return 0; | 242 | return 0; |
243 | } | 243 | } |
@@ -249,14 +249,14 @@ eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words) | |||
249 | * Partially stolen from drm_memory.h | 249 | * Partially stolen from drm_memory.h |
250 | */ | 250 | */ |
251 | 251 | ||
252 | static __inline__ drm_map_t *via_drm_lookup_agp_map(drm_via_state_t * seq, | 252 | static __inline__ drm_local_map_t *via_drm_lookup_agp_map(drm_via_state_t *seq, |
253 | unsigned long offset, | 253 | unsigned long offset, |
254 | unsigned long size, | 254 | unsigned long size, |
255 | drm_device_t * dev) | 255 | drm_device_t * dev) |
256 | { | 256 | { |
257 | struct list_head *list; | 257 | struct list_head *list; |
258 | drm_map_list_t *r_list; | 258 | drm_map_list_t *r_list; |
259 | drm_map_t *map = seq->map_cache; | 259 | drm_local_map_t *map = seq->map_cache; |
260 | 260 | ||
261 | if (map && map->offset <= offset | 261 | if (map && map->offset <= offset |
262 | && (offset + size) <= (map->offset + map->size)) { | 262 | && (offset + size) <= (map->offset + map->size)) { |
diff --git a/drivers/char/drm/via_verifier.h b/drivers/char/drm/via_verifier.h index eb4eda344345..256590fcc22a 100644 --- a/drivers/char/drm/via_verifier.h +++ b/drivers/char/drm/via_verifier.h | |||
@@ -47,7 +47,7 @@ typedef struct { | |||
47 | int agp_texture; | 47 | int agp_texture; |
48 | int multitex; | 48 | int multitex; |
49 | drm_device_t *dev; | 49 | drm_device_t *dev; |
50 | drm_map_t *map_cache; | 50 | drm_local_map_t *map_cache; |
51 | uint32_t vertex_count; | 51 | uint32_t vertex_count; |
52 | int agp; | 52 | int agp; |
53 | const uint32_t *buf_start; | 53 | const uint32_t *buf_start; |
@@ -55,5 +55,7 @@ typedef struct { | |||
55 | 55 | ||
56 | extern int via_verify_command_stream(const uint32_t * buf, unsigned int size, | 56 | extern int via_verify_command_stream(const uint32_t * buf, unsigned int size, |
57 | drm_device_t * dev, int agp); | 57 | drm_device_t * dev, int agp); |
58 | extern int via_parse_command_stream(drm_device_t *dev, const uint32_t *buf, | ||
59 | unsigned int size); | ||
58 | 60 | ||
59 | #endif | 61 | #endif |
diff --git a/drivers/char/drm/via_video.c b/drivers/char/drm/via_video.c index 7fab9fbdf424..300ac61b09ed 100644 --- a/drivers/char/drm/via_video.c +++ b/drivers/char/drm/via_video.c | |||
@@ -50,8 +50,11 @@ void via_release_futex(drm_via_private_t * dev_priv, int context) | |||
50 | unsigned int i; | 50 | unsigned int i; |
51 | volatile int *lock; | 51 | volatile int *lock; |
52 | 52 | ||
53 | if (!dev_priv->sarea_priv) | ||
54 | return; | ||
55 | |||
53 | for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) { | 56 | for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) { |
54 | lock = (int *)XVMCLOCKPTR(dev_priv->sarea_priv, i); | 57 | lock = (volatile int *)XVMCLOCKPTR(dev_priv->sarea_priv, i); |
55 | if ((_DRM_LOCKING_CONTEXT(*lock) == context)) { | 58 | if ((_DRM_LOCKING_CONTEXT(*lock) == context)) { |
56 | if (_DRM_LOCK_IS_HELD(*lock) | 59 | if (_DRM_LOCK_IS_HELD(*lock) |
57 | && (*lock & _DRM_LOCK_CONT)) { | 60 | && (*lock & _DRM_LOCK_CONT)) { |
@@ -79,7 +82,7 @@ int via_decoder_futex(DRM_IOCTL_ARGS) | |||
79 | if (fx.lock > VIA_NR_XVMC_LOCKS) | 82 | if (fx.lock > VIA_NR_XVMC_LOCKS) |
80 | return -EFAULT; | 83 | return -EFAULT; |
81 | 84 | ||
82 | lock = (int *)XVMCLOCKPTR(sAPriv, fx.lock); | 85 | lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx.lock); |
83 | 86 | ||
84 | switch (fx.func) { | 87 | switch (fx.func) { |
85 | case VIA_FUTEX_WAIT: | 88 | case VIA_FUTEX_WAIT: |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 704c3c07f0ab..29c41f4418c0 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -534,7 +534,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
534 | return virtr + wrote; | 534 | return virtr + wrote; |
535 | } | 535 | } |
536 | 536 | ||
537 | #if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) | 537 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
538 | static ssize_t read_port(struct file * file, char __user * buf, | 538 | static ssize_t read_port(struct file * file, char __user * buf, |
539 | size_t count, loff_t *ppos) | 539 | size_t count, loff_t *ppos) |
540 | { | 540 | { |
@@ -795,7 +795,7 @@ static struct file_operations null_fops = { | |||
795 | .write = write_null, | 795 | .write = write_null, |
796 | }; | 796 | }; |
797 | 797 | ||
798 | #if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) | 798 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
799 | static struct file_operations port_fops = { | 799 | static struct file_operations port_fops = { |
800 | .llseek = memory_lseek, | 800 | .llseek = memory_lseek, |
801 | .read = read_port, | 801 | .read = read_port, |
@@ -865,7 +865,7 @@ static int memory_open(struct inode * inode, struct file * filp) | |||
865 | case 3: | 865 | case 3: |
866 | filp->f_op = &null_fops; | 866 | filp->f_op = &null_fops; |
867 | break; | 867 | break; |
868 | #if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) | 868 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
869 | case 4: | 869 | case 4: |
870 | filp->f_op = &port_fops; | 870 | filp->f_op = &port_fops; |
871 | break; | 871 | break; |
@@ -912,7 +912,7 @@ static const struct { | |||
912 | {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, | 912 | {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, |
913 | {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, | 913 | {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, |
914 | {3, "null", S_IRUGO | S_IWUGO, &null_fops}, | 914 | {3, "null", S_IRUGO | S_IWUGO, &null_fops}, |
915 | #if (defined(CONFIG_ISA) || !defined(__mc68000__)) && (!defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI)) | 915 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
916 | {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops}, | 916 | {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops}, |
917 | #endif | 917 | #endif |
918 | {5, "zero", S_IRUGO | S_IWUGO, &zero_fops}, | 918 | {5, "zero", S_IRUGO | S_IWUGO, &zero_fops}, |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index faee5e7acaf7..4e5360388748 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -476,19 +476,19 @@ static struct port_info *get_port_data(struct tty_struct *tty) | |||
476 | */ | 476 | */ |
477 | static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp) | 477 | static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp) |
478 | { | 478 | { |
479 | struct HvLpEvent *hev = &viochar->event; | ||
480 | |||
479 | memset(viochar, 0, sizeof(struct viocharlpevent)); | 481 | memset(viochar, 0, sizeof(struct viocharlpevent)); |
480 | 482 | ||
481 | viochar->event.xFlags.xValid = 1; | 483 | hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK | |
482 | viochar->event.xFlags.xFunction = HvLpEvent_Function_Int; | 484 | HV_LP_EVENT_INT; |
483 | viochar->event.xFlags.xAckInd = HvLpEvent_AckInd_NoAck; | 485 | hev->xType = HvLpEvent_Type_VirtualIo; |
484 | viochar->event.xFlags.xAckType = HvLpEvent_AckType_DeferredAck; | 486 | hev->xSubtype = viomajorsubtype_chario | viochardata; |
485 | viochar->event.xType = HvLpEvent_Type_VirtualIo; | 487 | hev->xSourceLp = HvLpConfig_getLpIndex(); |
486 | viochar->event.xSubtype = viomajorsubtype_chario | viochardata; | 488 | hev->xTargetLp = lp; |
487 | viochar->event.xSourceLp = HvLpConfig_getLpIndex(); | 489 | hev->xSizeMinus1 = sizeof(struct viocharlpevent); |
488 | viochar->event.xTargetLp = lp; | 490 | hev->xSourceInstanceId = viopath_sourceinst(lp); |
489 | viochar->event.xSizeMinus1 = sizeof(struct viocharlpevent); | 491 | hev->xTargetInstanceId = viopath_targetinst(lp); |
490 | viochar->event.xSourceInstanceId = viopath_sourceinst(lp); | ||
491 | viochar->event.xTargetInstanceId = viopath_targetinst(lp); | ||
492 | } | 492 | } |
493 | 493 | ||
494 | /* | 494 | /* |
@@ -752,7 +752,7 @@ static void vioHandleOpenEvent(struct HvLpEvent *event) | |||
752 | struct port_info *pi; | 752 | struct port_info *pi; |
753 | int reject = 0; | 753 | int reject = 0; |
754 | 754 | ||
755 | if (event->xFlags.xFunction == HvLpEvent_Function_Ack) { | 755 | if (hvlpevent_is_ack(event)) { |
756 | if (port >= VTTY_PORTS) | 756 | if (port >= VTTY_PORTS) |
757 | return; | 757 | return; |
758 | 758 | ||
@@ -788,7 +788,7 @@ static void vioHandleOpenEvent(struct HvLpEvent *event) | |||
788 | } | 788 | } |
789 | 789 | ||
790 | /* This had better require an ack, otherwise complain */ | 790 | /* This had better require an ack, otherwise complain */ |
791 | if (event->xFlags.xAckInd != HvLpEvent_AckInd_DoAck) { | 791 | if (!hvlpevent_need_ack(event)) { |
792 | printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n"); | 792 | printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n"); |
793 | return; | 793 | return; |
794 | } | 794 | } |
@@ -856,7 +856,7 @@ static void vioHandleCloseEvent(struct HvLpEvent *event) | |||
856 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | 856 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; |
857 | u8 port = cevent->virtual_device; | 857 | u8 port = cevent->virtual_device; |
858 | 858 | ||
859 | if (event->xFlags.xFunction == HvLpEvent_Function_Int) { | 859 | if (hvlpevent_is_int(event)) { |
860 | if (port >= VTTY_PORTS) { | 860 | if (port >= VTTY_PORTS) { |
861 | printk(VIOCONS_KERN_WARN | 861 | printk(VIOCONS_KERN_WARN |
862 | "close message from invalid virtual device.\n"); | 862 | "close message from invalid virtual device.\n"); |
@@ -1056,8 +1056,7 @@ static void vioHandleCharEvent(struct HvLpEvent *event) | |||
1056 | vioHandleConfig(event); | 1056 | vioHandleConfig(event); |
1057 | break; | 1057 | break; |
1058 | default: | 1058 | default: |
1059 | if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && | 1059 | if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) { |
1060 | (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) { | ||
1061 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 1060 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
1062 | HvCallEvent_ackLpEvent(event); | 1061 | HvCallEvent_ackLpEvent(event); |
1063 | } | 1062 | } |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 70f7ab829d36..86e2234faf80 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -899,6 +899,12 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num | |||
899 | struct pxa_i2c *i2c = adap->algo_data; | 899 | struct pxa_i2c *i2c = adap->algo_data; |
900 | int ret, i; | 900 | int ret, i; |
901 | 901 | ||
902 | /* If the I2C controller is disabled we need to reset it (probably due | ||
903 | to a suspend/resume destroying state). We do this here as we can then | ||
904 | avoid worrying about resuming the controller before its users. */ | ||
905 | if (!(ICR & ICR_IUE)) | ||
906 | i2c_pxa_reset(i2c); | ||
907 | |||
902 | for (i = adap->retries; i >= 0; i--) { | 908 | for (i = adap->retries; i >= 0; i--) { |
903 | ret = i2c_pxa_do_xfer(i2c, msgs, num); | 909 | ret = i2c_pxa_do_xfer(i2c, msgs, num); |
904 | if (ret != I2C_RETRY) | 910 | if (ret != I2C_RETRY) |
@@ -939,7 +945,9 @@ static struct pxa_i2c i2c_pxa = { | |||
939 | static int i2c_pxa_probe(struct platform_device *dev) | 945 | static int i2c_pxa_probe(struct platform_device *dev) |
940 | { | 946 | { |
941 | struct pxa_i2c *i2c = &i2c_pxa; | 947 | struct pxa_i2c *i2c = &i2c_pxa; |
948 | #ifdef CONFIG_I2C_PXA_SLAVE | ||
942 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; | 949 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; |
950 | #endif | ||
943 | int ret; | 951 | int ret; |
944 | 952 | ||
945 | #ifdef CONFIG_PXA27x | 953 | #ifdef CONFIG_PXA27x |
@@ -1024,5 +1032,7 @@ static void i2c_adap_pxa_exit(void) | |||
1024 | return platform_driver_unregister(&i2c_pxa_driver); | 1032 | return platform_driver_unregister(&i2c_pxa_driver); |
1025 | } | 1033 | } |
1026 | 1034 | ||
1035 | MODULE_LICENSE("GPL"); | ||
1036 | |||
1027 | module_init(i2c_adap_pxa_init); | 1037 | module_init(i2c_adap_pxa_init); |
1028 | module_exit(i2c_adap_pxa_exit); | 1038 | module_exit(i2c_adap_pxa_exit); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index bcbaeb50bb93..8d50df4526a4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -55,22 +55,9 @@ | |||
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | #include <asm/bitops.h> | 56 | #include <asm/bitops.h> |
57 | 57 | ||
58 | void ide_softirq_done(struct request *rq) | ||
59 | { | ||
60 | request_queue_t *q = rq->q; | ||
61 | |||
62 | add_disk_randomness(rq->rq_disk); | ||
63 | end_that_request_chunk(rq, 1, rq->data_len); | ||
64 | |||
65 | spin_lock_irq(q->queue_lock); | ||
66 | end_that_request_last(rq, 1); | ||
67 | spin_unlock_irq(q->queue_lock); | ||
68 | } | ||
69 | |||
70 | int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, | 58 | int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, |
71 | int nr_sectors) | 59 | int nr_sectors) |
72 | { | 60 | { |
73 | unsigned int nbytes; | ||
74 | int ret = 1; | 61 | int ret = 1; |
75 | 62 | ||
76 | BUG_ON(!(rq->flags & REQ_STARTED)); | 63 | BUG_ON(!(rq->flags & REQ_STARTED)); |
@@ -94,27 +81,12 @@ int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, | |||
94 | HWGROUP(drive)->hwif->ide_dma_on(drive); | 81 | HWGROUP(drive)->hwif->ide_dma_on(drive); |
95 | } | 82 | } |
96 | 83 | ||
97 | /* | 84 | if (!end_that_request_first(rq, uptodate, nr_sectors)) { |
98 | * For partial completions (or non fs/pc requests), use the regular | 85 | add_disk_randomness(rq->rq_disk); |
99 | * direct completion path. Same thing for requests that failed, to | ||
100 | * preserve the ->errors value we use the normal completion path | ||
101 | * for those | ||
102 | */ | ||
103 | nbytes = nr_sectors << 9; | ||
104 | if (!rq->errors && rq_all_done(rq, nbytes)) { | ||
105 | rq->data_len = nbytes; | ||
106 | blkdev_dequeue_request(rq); | 86 | blkdev_dequeue_request(rq); |
107 | HWGROUP(drive)->rq = NULL; | 87 | HWGROUP(drive)->rq = NULL; |
108 | blk_complete_request(rq); | 88 | end_that_request_last(rq, uptodate); |
109 | ret = 0; | 89 | ret = 0; |
110 | } else { | ||
111 | if (!end_that_request_first(rq, uptodate, nr_sectors)) { | ||
112 | add_disk_randomness(rq->rq_disk); | ||
113 | blkdev_dequeue_request(rq); | ||
114 | HWGROUP(drive)->rq = NULL; | ||
115 | end_that_request_last(rq, uptodate); | ||
116 | ret = 0; | ||
117 | } | ||
118 | } | 90 | } |
119 | 91 | ||
120 | return ret; | 92 | return ret; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 7cb2d86601db..e7425546b4b1 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1011,8 +1011,6 @@ static int ide_init_queue(ide_drive_t *drive) | |||
1011 | blk_queue_max_hw_segments(q, max_sg_entries); | 1011 | blk_queue_max_hw_segments(q, max_sg_entries); |
1012 | blk_queue_max_phys_segments(q, max_sg_entries); | 1012 | blk_queue_max_phys_segments(q, max_sg_entries); |
1013 | 1013 | ||
1014 | blk_queue_softirq_done(q, ide_softirq_done); | ||
1015 | |||
1016 | /* assign drive queue */ | 1014 | /* assign drive queue */ |
1017 | drive->queue = q; | 1015 | drive->queue = q; |
1018 | 1016 | ||
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index b42e0fbab59b..aff83f966803 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -24,13 +24,14 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/mutex.h> | ||
27 | 28 | ||
28 | #include <asm/dma.h> | 29 | #include <asm/dma.h> |
29 | #include <asm/hardware.h> | 30 | #include <asm/hardware.h> |
30 | 31 | ||
31 | #include "ucb1x00.h" | 32 | #include "ucb1x00.h" |
32 | 33 | ||
33 | static DECLARE_MUTEX(ucb1x00_sem); | 34 | static DEFINE_MUTEX(ucb1x00_mutex); |
34 | static LIST_HEAD(ucb1x00_drivers); | 35 | static LIST_HEAD(ucb1x00_drivers); |
35 | static LIST_HEAD(ucb1x00_devices); | 36 | static LIST_HEAD(ucb1x00_devices); |
36 | 37 | ||
@@ -521,12 +522,12 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
521 | goto err_irq; | 522 | goto err_irq; |
522 | 523 | ||
523 | INIT_LIST_HEAD(&ucb->devs); | 524 | INIT_LIST_HEAD(&ucb->devs); |
524 | down(&ucb1x00_sem); | 525 | mutex_lock(&ucb1x00_mutex); |
525 | list_add(&ucb->node, &ucb1x00_devices); | 526 | list_add(&ucb->node, &ucb1x00_devices); |
526 | list_for_each_entry(drv, &ucb1x00_drivers, node) { | 527 | list_for_each_entry(drv, &ucb1x00_drivers, node) { |
527 | ucb1x00_add_dev(ucb, drv); | 528 | ucb1x00_add_dev(ucb, drv); |
528 | } | 529 | } |
529 | up(&ucb1x00_sem); | 530 | mutex_unlock(&ucb1x00_mutex); |
530 | goto out; | 531 | goto out; |
531 | 532 | ||
532 | err_irq: | 533 | err_irq: |
@@ -544,13 +545,13 @@ static void ucb1x00_remove(struct mcp *mcp) | |||
544 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 545 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
545 | struct list_head *l, *n; | 546 | struct list_head *l, *n; |
546 | 547 | ||
547 | down(&ucb1x00_sem); | 548 | mutex_lock(&ucb1x00_mutex); |
548 | list_del(&ucb->node); | 549 | list_del(&ucb->node); |
549 | list_for_each_safe(l, n, &ucb->devs) { | 550 | list_for_each_safe(l, n, &ucb->devs) { |
550 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, dev_node); | 551 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, dev_node); |
551 | ucb1x00_remove_dev(dev); | 552 | ucb1x00_remove_dev(dev); |
552 | } | 553 | } |
553 | up(&ucb1x00_sem); | 554 | mutex_unlock(&ucb1x00_mutex); |
554 | 555 | ||
555 | free_irq(ucb->irq, ucb); | 556 | free_irq(ucb->irq, ucb); |
556 | class_device_unregister(&ucb->cdev); | 557 | class_device_unregister(&ucb->cdev); |
@@ -561,12 +562,12 @@ int ucb1x00_register_driver(struct ucb1x00_driver *drv) | |||
561 | struct ucb1x00 *ucb; | 562 | struct ucb1x00 *ucb; |
562 | 563 | ||
563 | INIT_LIST_HEAD(&drv->devs); | 564 | INIT_LIST_HEAD(&drv->devs); |
564 | down(&ucb1x00_sem); | 565 | mutex_lock(&ucb1x00_mutex); |
565 | list_add(&drv->node, &ucb1x00_drivers); | 566 | list_add(&drv->node, &ucb1x00_drivers); |
566 | list_for_each_entry(ucb, &ucb1x00_devices, node) { | 567 | list_for_each_entry(ucb, &ucb1x00_devices, node) { |
567 | ucb1x00_add_dev(ucb, drv); | 568 | ucb1x00_add_dev(ucb, drv); |
568 | } | 569 | } |
569 | up(&ucb1x00_sem); | 570 | mutex_unlock(&ucb1x00_mutex); |
570 | return 0; | 571 | return 0; |
571 | } | 572 | } |
572 | 573 | ||
@@ -574,13 +575,13 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv) | |||
574 | { | 575 | { |
575 | struct list_head *n, *l; | 576 | struct list_head *n, *l; |
576 | 577 | ||
577 | down(&ucb1x00_sem); | 578 | mutex_lock(&ucb1x00_mutex); |
578 | list_del(&drv->node); | 579 | list_del(&drv->node); |
579 | list_for_each_safe(l, n, &drv->devs) { | 580 | list_for_each_safe(l, n, &drv->devs) { |
580 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, drv_node); | 581 | struct ucb1x00_dev *dev = list_entry(l, struct ucb1x00_dev, drv_node); |
581 | ucb1x00_remove_dev(dev); | 582 | ucb1x00_remove_dev(dev); |
582 | } | 583 | } |
583 | up(&ucb1x00_sem); | 584 | mutex_unlock(&ucb1x00_mutex); |
584 | } | 585 | } |
585 | 586 | ||
586 | static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) | 587 | static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) |
@@ -588,12 +589,12 @@ static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) | |||
588 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 589 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
589 | struct ucb1x00_dev *dev; | 590 | struct ucb1x00_dev *dev; |
590 | 591 | ||
591 | down(&ucb1x00_sem); | 592 | mutex_lock(&ucb1x00_mutex); |
592 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 593 | list_for_each_entry(dev, &ucb->devs, dev_node) { |
593 | if (dev->drv->suspend) | 594 | if (dev->drv->suspend) |
594 | dev->drv->suspend(dev, state); | 595 | dev->drv->suspend(dev, state); |
595 | } | 596 | } |
596 | up(&ucb1x00_sem); | 597 | mutex_unlock(&ucb1x00_mutex); |
597 | return 0; | 598 | return 0; |
598 | } | 599 | } |
599 | 600 | ||
@@ -602,12 +603,12 @@ static int ucb1x00_resume(struct mcp *mcp) | |||
602 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 603 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); |
603 | struct ucb1x00_dev *dev; | 604 | struct ucb1x00_dev *dev; |
604 | 605 | ||
605 | down(&ucb1x00_sem); | 606 | mutex_lock(&ucb1x00_mutex); |
606 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 607 | list_for_each_entry(dev, &ucb->devs, dev_node) { |
607 | if (dev->drv->resume) | 608 | if (dev->drv->resume) |
608 | dev->drv->resume(dev); | 609 | dev->drv->resume(dev); |
609 | } | 610 | } |
610 | up(&ucb1x00_sem); | 611 | mutex_unlock(&ucb1x00_mutex); |
611 | return 0; | 612 | return 0; |
612 | } | 613 | } |
613 | 614 | ||
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index f2c42b13945d..9b7c37e0e574 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/kdev_t.h> | 28 | #include <linux/kdev_t.h> |
29 | #include <linux/blkdev.h> | 29 | #include <linux/blkdev.h> |
30 | #include <linux/devfs_fs_kernel.h> | 30 | #include <linux/devfs_fs_kernel.h> |
31 | #include <linux/mutex.h> | ||
31 | 32 | ||
32 | #include <linux/mmc/card.h> | 33 | #include <linux/mmc/card.h> |
33 | #include <linux/mmc/protocol.h> | 34 | #include <linux/mmc/protocol.h> |
@@ -57,33 +58,33 @@ struct mmc_blk_data { | |||
57 | unsigned int read_only; | 58 | unsigned int read_only; |
58 | }; | 59 | }; |
59 | 60 | ||
60 | static DECLARE_MUTEX(open_lock); | 61 | static DEFINE_MUTEX(open_lock); |
61 | 62 | ||
62 | static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) | 63 | static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) |
63 | { | 64 | { |
64 | struct mmc_blk_data *md; | 65 | struct mmc_blk_data *md; |
65 | 66 | ||
66 | down(&open_lock); | 67 | mutex_lock(&open_lock); |
67 | md = disk->private_data; | 68 | md = disk->private_data; |
68 | if (md && md->usage == 0) | 69 | if (md && md->usage == 0) |
69 | md = NULL; | 70 | md = NULL; |
70 | if (md) | 71 | if (md) |
71 | md->usage++; | 72 | md->usage++; |
72 | up(&open_lock); | 73 | mutex_unlock(&open_lock); |
73 | 74 | ||
74 | return md; | 75 | return md; |
75 | } | 76 | } |
76 | 77 | ||
77 | static void mmc_blk_put(struct mmc_blk_data *md) | 78 | static void mmc_blk_put(struct mmc_blk_data *md) |
78 | { | 79 | { |
79 | down(&open_lock); | 80 | mutex_lock(&open_lock); |
80 | md->usage--; | 81 | md->usage--; |
81 | if (md->usage == 0) { | 82 | if (md->usage == 0) { |
82 | put_disk(md->disk); | 83 | put_disk(md->disk); |
83 | mmc_cleanup_queue(&md->queue); | 84 | mmc_cleanup_queue(&md->queue); |
84 | kfree(md); | 85 | kfree(md); |
85 | } | 86 | } |
86 | up(&open_lock); | 87 | mutex_unlock(&open_lock); |
87 | } | 88 | } |
88 | 89 | ||
89 | static int mmc_blk_open(struct inode *inode, struct file *filp) | 90 | static int mmc_blk_open(struct inode *inode, struct file *filp) |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 77eadf84cb2c..f0f04be989d6 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -590,9 +590,9 @@ static void veth_handle_event(struct HvLpEvent *event, struct pt_regs *regs) | |||
590 | { | 590 | { |
591 | struct veth_lpevent *veth_event = (struct veth_lpevent *)event; | 591 | struct veth_lpevent *veth_event = (struct veth_lpevent *)event; |
592 | 592 | ||
593 | if (event->xFlags.xFunction == HvLpEvent_Function_Ack) | 593 | if (hvlpevent_is_ack(event)) |
594 | veth_handle_ack(veth_event); | 594 | veth_handle_ack(veth_event); |
595 | else if (event->xFlags.xFunction == HvLpEvent_Function_Int) | 595 | else |
596 | veth_handle_int(veth_event); | 596 | veth_handle_int(veth_event); |
597 | } | 597 | } |
598 | 598 | ||
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 5d957dfe23d9..fda06941e730 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
@@ -171,27 +171,22 @@ static int __init mst_pcmcia_init(void) | |||
171 | { | 171 | { |
172 | int ret; | 172 | int ret; |
173 | 173 | ||
174 | mst_pcmcia_device = kzalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL); | 174 | mst_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
175 | if (!mst_pcmcia_device) | 175 | if (!mst_pcmcia_device) |
176 | return -ENOMEM; | 176 | return -ENOMEM; |
177 | mst_pcmcia_device->name = "pxa2xx-pcmcia"; | 177 | |
178 | mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; | 178 | mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; |
179 | 179 | ||
180 | ret = platform_device_register(mst_pcmcia_device); | 180 | ret = platform_device_add(mst_pcmcia_device); |
181 | |||
181 | if (ret) | 182 | if (ret) |
182 | kfree(mst_pcmcia_device); | 183 | platform_device_put(mst_pcmcia_device); |
183 | 184 | ||
184 | return ret; | 185 | return ret; |
185 | } | 186 | } |
186 | 187 | ||
187 | static void __exit mst_pcmcia_exit(void) | 188 | static void __exit mst_pcmcia_exit(void) |
188 | { | 189 | { |
189 | /* | ||
190 | * This call is supposed to free our mst_pcmcia_device. | ||
191 | * Unfortunately platform_device don't have a free method, and | ||
192 | * we can't assume it's free of any reference at this point so we | ||
193 | * can't free it either. | ||
194 | */ | ||
195 | platform_device_unregister(mst_pcmcia_device); | 190 | platform_device_unregister(mst_pcmcia_device); |
196 | } | 191 | } |
197 | 192 | ||
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index 12a7244a5ec8..fd3647368955 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
@@ -263,30 +263,25 @@ static int __init sharpsl_pcmcia_init(void) | |||
263 | { | 263 | { |
264 | int ret; | 264 | int ret; |
265 | 265 | ||
266 | sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs; | 266 | sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs; |
267 | sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); | 267 | sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
268 | |||
268 | if (!sharpsl_pcmcia_device) | 269 | if (!sharpsl_pcmcia_device) |
269 | return -ENOMEM; | 270 | return -ENOMEM; |
270 | 271 | ||
271 | sharpsl_pcmcia_device->name = "pxa2xx-pcmcia"; | ||
272 | sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; | 272 | sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; |
273 | sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev; | 273 | sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev; |
274 | |||
275 | ret = platform_device_add(sharpsl_pcmcia_device); | ||
274 | 276 | ||
275 | ret = platform_device_register(sharpsl_pcmcia_device); | ||
276 | if (ret) | 277 | if (ret) |
277 | kfree(sharpsl_pcmcia_device); | 278 | platform_device_put(sharpsl_pcmcia_device); |
278 | 279 | ||
279 | return ret; | 280 | return ret; |
280 | } | 281 | } |
281 | 282 | ||
282 | static void __exit sharpsl_pcmcia_exit(void) | 283 | static void __exit sharpsl_pcmcia_exit(void) |
283 | { | 284 | { |
284 | /* | ||
285 | * This call is supposed to free our sharpsl_pcmcia_device. | ||
286 | * Unfortunately platform_device don't have a free method, and | ||
287 | * we can't assume it's free of any reference at this point so we | ||
288 | * can't free it either. | ||
289 | */ | ||
290 | platform_device_unregister(sharpsl_pcmcia_device); | 285 | platform_device_unregister(sharpsl_pcmcia_device); |
291 | } | 286 | } |
292 | 287 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 54e5cc0dd5f8..fb610c3634a4 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/serial.h> | 41 | #include <linux/serial.h> |
42 | #include <linux/serial_8250.h> | 42 | #include <linux/serial_8250.h> |
43 | #include <linux/nmi.h> | 43 | #include <linux/nmi.h> |
44 | #include <linux/mutex.h> | ||
44 | 45 | ||
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
46 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
@@ -2467,7 +2468,7 @@ static struct platform_device *serial8250_isa_devs; | |||
2467 | * 16x50 serial ports to be configured at run-time, to support PCMCIA | 2468 | * 16x50 serial ports to be configured at run-time, to support PCMCIA |
2468 | * modems and PCI multiport cards. | 2469 | * modems and PCI multiport cards. |
2469 | */ | 2470 | */ |
2470 | static DECLARE_MUTEX(serial_sem); | 2471 | static DEFINE_MUTEX(serial_mutex); |
2471 | 2472 | ||
2472 | static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) | 2473 | static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) |
2473 | { | 2474 | { |
@@ -2522,7 +2523,7 @@ int serial8250_register_port(struct uart_port *port) | |||
2522 | if (port->uartclk == 0) | 2523 | if (port->uartclk == 0) |
2523 | return -EINVAL; | 2524 | return -EINVAL; |
2524 | 2525 | ||
2525 | down(&serial_sem); | 2526 | mutex_lock(&serial_mutex); |
2526 | 2527 | ||
2527 | uart = serial8250_find_match_or_unused(port); | 2528 | uart = serial8250_find_match_or_unused(port); |
2528 | if (uart) { | 2529 | if (uart) { |
@@ -2544,7 +2545,7 @@ int serial8250_register_port(struct uart_port *port) | |||
2544 | if (ret == 0) | 2545 | if (ret == 0) |
2545 | ret = uart->port.line; | 2546 | ret = uart->port.line; |
2546 | } | 2547 | } |
2547 | up(&serial_sem); | 2548 | mutex_unlock(&serial_mutex); |
2548 | 2549 | ||
2549 | return ret; | 2550 | return ret; |
2550 | } | 2551 | } |
@@ -2561,7 +2562,7 @@ void serial8250_unregister_port(int line) | |||
2561 | { | 2562 | { |
2562 | struct uart_8250_port *uart = &serial8250_ports[line]; | 2563 | struct uart_8250_port *uart = &serial8250_ports[line]; |
2563 | 2564 | ||
2564 | down(&serial_sem); | 2565 | mutex_lock(&serial_mutex); |
2565 | uart_remove_one_port(&serial8250_reg, &uart->port); | 2566 | uart_remove_one_port(&serial8250_reg, &uart->port); |
2566 | if (serial8250_isa_devs) { | 2567 | if (serial8250_isa_devs) { |
2567 | uart->port.flags &= ~UPF_BOOT_AUTOCONF; | 2568 | uart->port.flags &= ~UPF_BOOT_AUTOCONF; |
@@ -2571,7 +2572,7 @@ void serial8250_unregister_port(int line) | |||
2571 | } else { | 2572 | } else { |
2572 | uart->port.dev = NULL; | 2573 | uart->port.dev = NULL; |
2573 | } | 2574 | } |
2574 | up(&serial_sem); | 2575 | mutex_unlock(&serial_mutex); |
2575 | } | 2576 | } |
2576 | EXPORT_SYMBOL(serial8250_unregister_port); | 2577 | EXPORT_SYMBOL(serial8250_unregister_port); |
2577 | 2578 | ||
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 698cb76819d9..843717275d49 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -280,6 +280,40 @@ config SERIAL_AMBA_PL011_CONSOLE | |||
280 | your boot loader (lilo or loadlin) about how to pass options to the | 280 | your boot loader (lilo or loadlin) about how to pass options to the |
281 | kernel at boot time.) | 281 | kernel at boot time.) |
282 | 282 | ||
283 | config SERIAL_AT91 | ||
284 | bool "AT91RM9200 serial port support" | ||
285 | depends on ARM && ARCH_AT91RM9200 | ||
286 | select SERIAL_CORE | ||
287 | help | ||
288 | This enables the driver for the on-chip UARTs of the AT91RM9200 | ||
289 | processor. | ||
290 | |||
291 | config SERIAL_AT91_CONSOLE | ||
292 | bool "Support for console on AT91RM9200 serial port" | ||
293 | depends on SERIAL_AT91=y | ||
294 | select SERIAL_CORE_CONSOLE | ||
295 | help | ||
296 | Say Y here if you wish to use a UART on the AT91RM9200 as the system | ||
297 | console (the system console is the device which receives all kernel | ||
298 | messages and warnings and which allows logins in single user mode). | ||
299 | |||
300 | config SERIAL_AT91_TTYAT | ||
301 | bool "Install as device ttyAT0-4 instead of ttyS0-4" | ||
302 | depends on SERIAL_AT91=y | ||
303 | help | ||
304 | Say Y here if you wish to have the five internal AT91RM9200 UARTs | ||
305 | appear as /dev/ttyAT0-4 (major 240, minor 0-4) instead of the | ||
306 | normal /dev/ttyS0-4 (major 4, minor 64-68). This is necessary if | ||
307 | you also want other UARTs, such as external 8250/16C550 compatible | ||
308 | UARTs. | ||
309 | The ttySn nodes are legally reserved for the 8250 serial driver | ||
310 | but are often misused by other serial drivers. | ||
311 | |||
312 | To use this, you should create suitable ttyATn device nodes in | ||
313 | /dev/, and pass "console=ttyATn" to the kernel. | ||
314 | |||
315 | Say Y if you have an external 8250/16C550 UART. If unsure, say N. | ||
316 | |||
283 | config SERIAL_CLPS711X | 317 | config SERIAL_CLPS711X |
284 | tristate "CLPS711X serial port support" | 318 | tristate "CLPS711X serial port support" |
285 | depends on ARM && ARCH_CLPS711X | 319 | depends on ARM && ARCH_CLPS711X |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 137148bba4fa..24a583e482bb 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -56,3 +56,4 @@ obj-$(CONFIG_SERIAL_JSM) += jsm/ | |||
56 | obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o | 56 | obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o |
57 | obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o | 57 | obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o |
58 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o | 58 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o |
59 | obj-$(CONFIG_SERIAL_AT91) += at91_serial.o | ||
diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c new file mode 100644 index 000000000000..0e206063d685 --- /dev/null +++ b/drivers/serial/at91_serial.c | |||
@@ -0,0 +1,894 @@ | |||
1 | /* | ||
2 | * linux/drivers/char/at91_serial.c | ||
3 | * | ||
4 | * Driver for Atmel AT91RM9200 Serial ports | ||
5 | * | ||
6 | * Copyright (C) 2003 Rick Bronson | ||
7 | * | ||
8 | * Based on drivers/char/serial_sa1100.c, by Deep Blue Solutions Ltd. | ||
9 | * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. | ||
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/config.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/tty.h> | ||
29 | #include <linux/ioport.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <linux/serial.h> | ||
33 | #include <linux/console.h> | ||
34 | #include <linux/sysrq.h> | ||
35 | #include <linux/tty_flip.h> | ||
36 | |||
37 | #include <asm/io.h> | ||
38 | |||
39 | #include <asm/arch/at91rm9200_usart.h> | ||
40 | #include <asm/mach/serial_at91rm9200.h> | ||
41 | #include <asm/arch/board.h> | ||
42 | #include <asm/arch/pio.h> | ||
43 | |||
44 | |||
45 | #if defined(CONFIG_SERIAL_AT91_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
46 | #define SUPPORT_SYSRQ | ||
47 | #endif | ||
48 | |||
49 | #include <linux/serial_core.h> | ||
50 | |||
51 | #ifdef CONFIG_SERIAL_AT91_TTYAT | ||
52 | |||
53 | /* Use device name ttyAT, major 204 and minor 154-169. This is necessary if we | ||
54 | * should coexist with the 8250 driver, such as if we have an external 16C550 | ||
55 | * UART. */ | ||
56 | #define SERIAL_AT91_MAJOR 204 | ||
57 | #define MINOR_START 154 | ||
58 | #define AT91_DEVICENAME "ttyAT" | ||
59 | |||
60 | #else | ||
61 | |||
62 | /* Use device name ttyS, major 4, minor 64-68. This is the usual serial port | ||
63 | * name, but it is legally reserved for the 8250 driver. */ | ||
64 | #define SERIAL_AT91_MAJOR TTY_MAJOR | ||
65 | #define MINOR_START 64 | ||
66 | #define AT91_DEVICENAME "ttyS" | ||
67 | |||
68 | #endif | ||
69 | |||
70 | #define AT91_VA_BASE_DBGU ((unsigned long) AT91_VA_BASE_SYS + AT91_DBGU) | ||
71 | #define AT91_ISR_PASS_LIMIT 256 | ||
72 | |||
73 | #define UART_PUT_CR(port,v) writel(v, (port)->membase + AT91_US_CR) | ||
74 | #define UART_GET_MR(port) readl((port)->membase + AT91_US_MR) | ||
75 | #define UART_PUT_MR(port,v) writel(v, (port)->membase + AT91_US_MR) | ||
76 | #define UART_PUT_IER(port,v) writel(v, (port)->membase + AT91_US_IER) | ||
77 | #define UART_PUT_IDR(port,v) writel(v, (port)->membase + AT91_US_IDR) | ||
78 | #define UART_GET_IMR(port) readl((port)->membase + AT91_US_IMR) | ||
79 | #define UART_GET_CSR(port) readl((port)->membase + AT91_US_CSR) | ||
80 | #define UART_GET_CHAR(port) readl((port)->membase + AT91_US_RHR) | ||
81 | #define UART_PUT_CHAR(port,v) writel(v, (port)->membase + AT91_US_THR) | ||
82 | #define UART_GET_BRGR(port) readl((port)->membase + AT91_US_BRGR) | ||
83 | #define UART_PUT_BRGR(port,v) writel(v, (port)->membase + AT91_US_BRGR) | ||
84 | #define UART_PUT_RTOR(port,v) writel(v, (port)->membase + AT91_US_RTOR) | ||
85 | |||
86 | // #define UART_GET_CR(port) readl((port)->membase + AT91_US_CR) // is write-only | ||
87 | |||
88 | /* PDC registers */ | ||
89 | #define UART_PUT_PTCR(port,v) writel(v, (port)->membase + AT91_PDC_PTCR) | ||
90 | #define UART_PUT_RPR(port,v) writel(v, (port)->membase + AT91_PDC_RPR) | ||
91 | #define UART_PUT_RCR(port,v) writel(v, (port)->membase + AT91_PDC_RCR) | ||
92 | #define UART_GET_RCR(port) readl((port)->membase + AT91_PDC_RCR) | ||
93 | #define UART_PUT_RNPR(port,v) writel(v, (port)->membase + AT91_PDC_RNPR) | ||
94 | #define UART_PUT_RNCR(port,v) writel(v, (port)->membase + AT91_PDC_RNCR) | ||
95 | |||
96 | |||
97 | static int (*at91_open)(struct uart_port *); | ||
98 | static void (*at91_close)(struct uart_port *); | ||
99 | |||
100 | #ifdef SUPPORT_SYSRQ | ||
101 | static struct console at91_console; | ||
102 | #endif | ||
103 | |||
104 | /* | ||
105 | * Return TIOCSER_TEMT when transmitter FIFO and Shift register is empty. | ||
106 | */ | ||
107 | static u_int at91_tx_empty(struct uart_port *port) | ||
108 | { | ||
109 | return (UART_GET_CSR(port) & AT91_US_TXEMPTY) ? TIOCSER_TEMT : 0; | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * Set state of the modem control output lines | ||
114 | */ | ||
115 | static void at91_set_mctrl(struct uart_port *port, u_int mctrl) | ||
116 | { | ||
117 | unsigned int control = 0; | ||
118 | |||
119 | /* | ||
120 | * Errata #39: RTS0 is not internally connected to PA21. We need to drive | ||
121 | * the pin manually. | ||
122 | */ | ||
123 | if (port->mapbase == AT91_VA_BASE_US0) { | ||
124 | if (mctrl & TIOCM_RTS) | ||
125 | at91_sys_write(AT91_PIOA + PIO_CODR, AT91_PA21_RTS0); | ||
126 | else | ||
127 | at91_sys_write(AT91_PIOA + PIO_SODR, AT91_PA21_RTS0); | ||
128 | } | ||
129 | |||
130 | if (mctrl & TIOCM_RTS) | ||
131 | control |= AT91_US_RTSEN; | ||
132 | else | ||
133 | control |= AT91_US_RTSDIS; | ||
134 | |||
135 | if (mctrl & TIOCM_DTR) | ||
136 | control |= AT91_US_DTREN; | ||
137 | else | ||
138 | control |= AT91_US_DTRDIS; | ||
139 | |||
140 | UART_PUT_CR(port,control); | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Get state of the modem control input lines | ||
145 | */ | ||
146 | static u_int at91_get_mctrl(struct uart_port *port) | ||
147 | { | ||
148 | unsigned int status, ret = 0; | ||
149 | |||
150 | status = UART_GET_CSR(port); | ||
151 | |||
152 | /* | ||
153 | * The control signals are active low. | ||
154 | */ | ||
155 | if (!(status & AT91_US_DCD)) | ||
156 | ret |= TIOCM_CD; | ||
157 | if (!(status & AT91_US_CTS)) | ||
158 | ret |= TIOCM_CTS; | ||
159 | if (!(status & AT91_US_DSR)) | ||
160 | ret |= TIOCM_DSR; | ||
161 | if (!(status & AT91_US_RI)) | ||
162 | ret |= TIOCM_RI; | ||
163 | |||
164 | return ret; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Stop transmitting. | ||
169 | */ | ||
170 | static void at91_stop_tx(struct uart_port *port) | ||
171 | { | ||
172 | UART_PUT_IDR(port, AT91_US_TXRDY); | ||
173 | port->read_status_mask &= ~AT91_US_TXRDY; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * Start transmitting. | ||
178 | */ | ||
179 | static void at91_start_tx(struct uart_port *port) | ||
180 | { | ||
181 | port->read_status_mask |= AT91_US_TXRDY; | ||
182 | UART_PUT_IER(port, AT91_US_TXRDY); | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Stop receiving - port is in process of being closed. | ||
187 | */ | ||
188 | static void at91_stop_rx(struct uart_port *port) | ||
189 | { | ||
190 | UART_PUT_IDR(port, AT91_US_RXRDY); | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * Enable modem status interrupts | ||
195 | */ | ||
196 | static void at91_enable_ms(struct uart_port *port) | ||
197 | { | ||
198 | port->read_status_mask |= (AT91_US_RIIC | AT91_US_DSRIC | AT91_US_DCDIC | AT91_US_CTSIC); | ||
199 | UART_PUT_IER(port, AT91_US_RIIC | AT91_US_DSRIC | AT91_US_DCDIC | AT91_US_CTSIC); | ||
200 | } | ||
201 | |||
202 | /* | ||
203 | * Control the transmission of a break signal | ||
204 | */ | ||
205 | static void at91_break_ctl(struct uart_port *port, int break_state) | ||
206 | { | ||
207 | if (break_state != 0) | ||
208 | UART_PUT_CR(port, AT91_US_STTBRK); /* start break */ | ||
209 | else | ||
210 | UART_PUT_CR(port, AT91_US_STPBRK); /* stop break */ | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * Characters received (called from interrupt handler) | ||
215 | */ | ||
216 | static void at91_rx_chars(struct uart_port *port, struct pt_regs *regs) | ||
217 | { | ||
218 | struct tty_struct *tty = port->info->tty; | ||
219 | unsigned int status, ch, flg; | ||
220 | |||
221 | status = UART_GET_CSR(port) & port->read_status_mask; | ||
222 | while (status & (AT91_US_RXRDY)) { | ||
223 | ch = UART_GET_CHAR(port); | ||
224 | |||
225 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
226 | goto ignore_char; | ||
227 | port->icount.rx++; | ||
228 | |||
229 | flg = TTY_NORMAL; | ||
230 | |||
231 | /* | ||
232 | * note that the error handling code is | ||
233 | * out of the main execution path | ||
234 | */ | ||
235 | if (unlikely(status & (AT91_US_PARE | AT91_US_FRAME | AT91_US_OVRE))) { | ||
236 | UART_PUT_CR(port, AT91_US_RSTSTA); /* clear error */ | ||
237 | if (status & (AT91_US_PARE)) | ||
238 | port->icount.parity++; | ||
239 | if (status & (AT91_US_FRAME)) | ||
240 | port->icount.frame++; | ||
241 | if (status & (AT91_US_OVRE)) | ||
242 | port->icount.overrun++; | ||
243 | |||
244 | if (status & AT91_US_PARE) | ||
245 | flg = TTY_PARITY; | ||
246 | else if (status & AT91_US_FRAME) | ||
247 | flg = TTY_FRAME; | ||
248 | if (status & AT91_US_OVRE) { | ||
249 | /* | ||
250 | * overrun does *not* affect the character | ||
251 | * we read from the FIFO | ||
252 | */ | ||
253 | tty_insert_flip_char(tty, ch, flg); | ||
254 | ch = 0; | ||
255 | flg = TTY_OVERRUN; | ||
256 | } | ||
257 | #ifdef SUPPORT_SYSRQ | ||
258 | port->sysrq = 0; | ||
259 | #endif | ||
260 | } | ||
261 | |||
262 | if (uart_handle_sysrq_char(port, ch, regs)) | ||
263 | goto ignore_char; | ||
264 | |||
265 | tty_insert_flip_char(tty, ch, flg); | ||
266 | |||
267 | ignore_char: | ||
268 | status = UART_GET_CSR(port) & port->read_status_mask; | ||
269 | } | ||
270 | |||
271 | tty_flip_buffer_push(tty); | ||
272 | } | ||
273 | |||
274 | /* | ||
275 | * Transmit characters (called from interrupt handler) | ||
276 | */ | ||
277 | static void at91_tx_chars(struct uart_port *port) | ||
278 | { | ||
279 | struct circ_buf *xmit = &port->info->xmit; | ||
280 | |||
281 | if (port->x_char) { | ||
282 | UART_PUT_CHAR(port, port->x_char); | ||
283 | port->icount.tx++; | ||
284 | port->x_char = 0; | ||
285 | return; | ||
286 | } | ||
287 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | ||
288 | at91_stop_tx(port); | ||
289 | return; | ||
290 | } | ||
291 | |||
292 | while (UART_GET_CSR(port) & AT91_US_TXRDY) { | ||
293 | UART_PUT_CHAR(port, xmit->buf[xmit->tail]); | ||
294 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | ||
295 | port->icount.tx++; | ||
296 | if (uart_circ_empty(xmit)) | ||
297 | break; | ||
298 | } | ||
299 | |||
300 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
301 | uart_write_wakeup(port); | ||
302 | |||
303 | if (uart_circ_empty(xmit)) | ||
304 | at91_stop_tx(port); | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Interrupt handler | ||
309 | */ | ||
310 | static irqreturn_t at91_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
311 | { | ||
312 | struct uart_port *port = dev_id; | ||
313 | unsigned int status, pending, pass_counter = 0; | ||
314 | |||
315 | status = UART_GET_CSR(port); | ||
316 | pending = status & port->read_status_mask; | ||
317 | if (pending) { | ||
318 | do { | ||
319 | if (pending & AT91_US_RXRDY) | ||
320 | at91_rx_chars(port, regs); | ||
321 | |||
322 | /* Clear the relevent break bits */ | ||
323 | if (pending & AT91_US_RXBRK) { | ||
324 | UART_PUT_CR(port, AT91_US_RSTSTA); | ||
325 | port->icount.brk++; | ||
326 | uart_handle_break(port); | ||
327 | } | ||
328 | |||
329 | // TODO: All reads to CSR will clear these interrupts! | ||
330 | if (pending & AT91_US_RIIC) port->icount.rng++; | ||
331 | if (pending & AT91_US_DSRIC) port->icount.dsr++; | ||
332 | if (pending & AT91_US_DCDIC) | ||
333 | uart_handle_dcd_change(port, !(status & AT91_US_DCD)); | ||
334 | if (pending & AT91_US_CTSIC) | ||
335 | uart_handle_cts_change(port, !(status & AT91_US_CTS)); | ||
336 | if (pending & (AT91_US_RIIC | AT91_US_DSRIC | AT91_US_DCDIC | AT91_US_CTSIC)) | ||
337 | wake_up_interruptible(&port->info->delta_msr_wait); | ||
338 | |||
339 | if (pending & AT91_US_TXRDY) | ||
340 | at91_tx_chars(port); | ||
341 | if (pass_counter++ > AT91_ISR_PASS_LIMIT) | ||
342 | break; | ||
343 | |||
344 | status = UART_GET_CSR(port); | ||
345 | pending = status & port->read_status_mask; | ||
346 | } while (pending); | ||
347 | } | ||
348 | return IRQ_HANDLED; | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * Perform initialization and enable port for reception | ||
353 | */ | ||
354 | static int at91_startup(struct uart_port *port) | ||
355 | { | ||
356 | int retval; | ||
357 | |||
358 | /* | ||
359 | * Ensure that no interrupts are enabled otherwise when | ||
360 | * request_irq() is called we could get stuck trying to | ||
361 | * handle an unexpected interrupt | ||
362 | */ | ||
363 | UART_PUT_IDR(port, -1); | ||
364 | |||
365 | /* | ||
366 | * Allocate the IRQ | ||
367 | */ | ||
368 | retval = request_irq(port->irq, at91_interrupt, SA_SHIRQ, "at91_serial", port); | ||
369 | if (retval) { | ||
370 | printk("at91_serial: at91_startup - Can't get irq\n"); | ||
371 | return retval; | ||
372 | } | ||
373 | |||
374 | /* | ||
375 | * If there is a specific "open" function (to register | ||
376 | * control line interrupts) | ||
377 | */ | ||
378 | if (at91_open) { | ||
379 | retval = at91_open(port); | ||
380 | if (retval) { | ||
381 | free_irq(port->irq, port); | ||
382 | return retval; | ||
383 | } | ||
384 | } | ||
385 | |||
386 | port->read_status_mask = AT91_US_RXRDY | AT91_US_TXRDY | AT91_US_OVRE | ||
387 | | AT91_US_FRAME | AT91_US_PARE | AT91_US_RXBRK; | ||
388 | /* | ||
389 | * Finally, enable the serial port | ||
390 | */ | ||
391 | UART_PUT_CR(port, AT91_US_RSTSTA | AT91_US_RSTRX); | ||
392 | UART_PUT_CR(port, AT91_US_TXEN | AT91_US_RXEN); /* enable xmit & rcvr */ | ||
393 | UART_PUT_IER(port, AT91_US_RXRDY); /* do receive only */ | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | /* | ||
398 | * Disable the port | ||
399 | */ | ||
400 | static void at91_shutdown(struct uart_port *port) | ||
401 | { | ||
402 | /* | ||
403 | * Disable all interrupts, port and break condition. | ||
404 | */ | ||
405 | UART_PUT_CR(port, AT91_US_RSTSTA); | ||
406 | UART_PUT_IDR(port, -1); | ||
407 | |||
408 | /* | ||
409 | * Free the interrupt | ||
410 | */ | ||
411 | free_irq(port->irq, port); | ||
412 | |||
413 | /* | ||
414 | * If there is a specific "close" function (to unregister | ||
415 | * control line interrupts) | ||
416 | */ | ||
417 | if (at91_close) | ||
418 | at91_close(port); | ||
419 | } | ||
420 | |||
421 | /* | ||
422 | * Power / Clock management. | ||
423 | */ | ||
424 | static void at91_serial_pm(struct uart_port *port, unsigned int state, unsigned int oldstate) | ||
425 | { | ||
426 | switch (state) { | ||
427 | case 0: | ||
428 | /* | ||
429 | * Enable the peripheral clock for this serial port. | ||
430 | * This is called on uart_open() or a resume event. | ||
431 | */ | ||
432 | at91_sys_write(AT91_PMC_PCER, 1 << port->irq); | ||
433 | break; | ||
434 | case 3: | ||
435 | /* | ||
436 | * Disable the peripheral clock for this serial port. | ||
437 | * This is called on uart_close() or a suspend event. | ||
438 | */ | ||
439 | if (port->irq != AT91_ID_SYS) /* is this a shared clock? */ | ||
440 | at91_sys_write(AT91_PMC_PCDR, 1 << port->irq); | ||
441 | break; | ||
442 | default: | ||
443 | printk(KERN_ERR "at91_serial: unknown pm %d\n", state); | ||
444 | } | ||
445 | } | ||
446 | |||
447 | /* | ||
448 | * Change the port parameters | ||
449 | */ | ||
450 | static void at91_set_termios(struct uart_port *port, struct termios * termios, struct termios * old) | ||
451 | { | ||
452 | unsigned long flags; | ||
453 | unsigned int mode, imr, quot, baud; | ||
454 | |||
455 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | ||
456 | quot = uart_get_divisor(port, baud); | ||
457 | |||
458 | /* Get current mode register */ | ||
459 | mode = UART_GET_MR(port) & ~(AT91_US_CHRL | AT91_US_NBSTOP | AT91_US_PAR); | ||
460 | |||
461 | /* byte size */ | ||
462 | switch (termios->c_cflag & CSIZE) { | ||
463 | case CS5: | ||
464 | mode |= AT91_US_CHRL_5; | ||
465 | break; | ||
466 | case CS6: | ||
467 | mode |= AT91_US_CHRL_6; | ||
468 | break; | ||
469 | case CS7: | ||
470 | mode |= AT91_US_CHRL_7; | ||
471 | break; | ||
472 | default: | ||
473 | mode |= AT91_US_CHRL_8; | ||
474 | break; | ||
475 | } | ||
476 | |||
477 | /* stop bits */ | ||
478 | if (termios->c_cflag & CSTOPB) | ||
479 | mode |= AT91_US_NBSTOP_2; | ||
480 | |||
481 | /* parity */ | ||
482 | if (termios->c_cflag & PARENB) { | ||
483 | if (termios->c_cflag & CMSPAR) { /* Mark or Space parity */ | ||
484 | if (termios->c_cflag & PARODD) | ||
485 | mode |= AT91_US_PAR_MARK; | ||
486 | else | ||
487 | mode |= AT91_US_PAR_SPACE; | ||
488 | } | ||
489 | else if (termios->c_cflag & PARODD) | ||
490 | mode |= AT91_US_PAR_ODD; | ||
491 | else | ||
492 | mode |= AT91_US_PAR_EVEN; | ||
493 | } | ||
494 | else | ||
495 | mode |= AT91_US_PAR_NONE; | ||
496 | |||
497 | spin_lock_irqsave(&port->lock, flags); | ||
498 | |||
499 | port->read_status_mask |= AT91_US_OVRE; | ||
500 | if (termios->c_iflag & INPCK) | ||
501 | port->read_status_mask |= AT91_US_FRAME | AT91_US_PARE; | ||
502 | if (termios->c_iflag & (BRKINT | PARMRK)) | ||
503 | port->read_status_mask |= AT91_US_RXBRK; | ||
504 | |||
505 | /* | ||
506 | * Characters to ignore | ||
507 | */ | ||
508 | port->ignore_status_mask = 0; | ||
509 | if (termios->c_iflag & IGNPAR) | ||
510 | port->ignore_status_mask |= (AT91_US_FRAME | AT91_US_PARE); | ||
511 | if (termios->c_iflag & IGNBRK) { | ||
512 | port->ignore_status_mask |= AT91_US_RXBRK; | ||
513 | /* | ||
514 | * If we're ignoring parity and break indicators, | ||
515 | * ignore overruns too (for real raw support). | ||
516 | */ | ||
517 | if (termios->c_iflag & IGNPAR) | ||
518 | port->ignore_status_mask |= AT91_US_OVRE; | ||
519 | } | ||
520 | |||
521 | // TODO: Ignore all characters if CREAD is set. | ||
522 | |||
523 | /* update the per-port timeout */ | ||
524 | uart_update_timeout(port, termios->c_cflag, baud); | ||
525 | |||
526 | /* disable interrupts and drain transmitter */ | ||
527 | imr = UART_GET_IMR(port); /* get interrupt mask */ | ||
528 | UART_PUT_IDR(port, -1); /* disable all interrupts */ | ||
529 | while (!(UART_GET_CSR(port) & AT91_US_TXEMPTY)) { barrier(); } | ||
530 | |||
531 | /* disable receiver and transmitter */ | ||
532 | UART_PUT_CR(port, AT91_US_TXDIS | AT91_US_RXDIS); | ||
533 | |||
534 | /* set the parity, stop bits and data size */ | ||
535 | UART_PUT_MR(port, mode); | ||
536 | |||
537 | /* set the baud rate */ | ||
538 | UART_PUT_BRGR(port, quot); | ||
539 | UART_PUT_CR(port, AT91_US_RSTSTA | AT91_US_RSTRX); | ||
540 | UART_PUT_CR(port, AT91_US_TXEN | AT91_US_RXEN); | ||
541 | |||
542 | /* restore interrupts */ | ||
543 | UART_PUT_IER(port, imr); | ||
544 | |||
545 | /* CTS flow-control and modem-status interrupts */ | ||
546 | if (UART_ENABLE_MS(port, termios->c_cflag)) | ||
547 | port->ops->enable_ms(port); | ||
548 | |||
549 | spin_unlock_irqrestore(&port->lock, flags); | ||
550 | } | ||
551 | |||
552 | /* | ||
553 | * Return string describing the specified port | ||
554 | */ | ||
555 | static const char *at91_type(struct uart_port *port) | ||
556 | { | ||
557 | return (port->type == PORT_AT91RM9200) ? "AT91_SERIAL" : NULL; | ||
558 | } | ||
559 | |||
560 | /* | ||
561 | * Release the memory region(s) being used by 'port'. | ||
562 | */ | ||
563 | static void at91_release_port(struct uart_port *port) | ||
564 | { | ||
565 | release_mem_region(port->mapbase, | ||
566 | (port->mapbase == AT91_VA_BASE_DBGU) ? 512 : SZ_16K); | ||
567 | } | ||
568 | |||
569 | /* | ||
570 | * Request the memory region(s) being used by 'port'. | ||
571 | */ | ||
572 | static int at91_request_port(struct uart_port *port) | ||
573 | { | ||
574 | return request_mem_region(port->mapbase, | ||
575 | (port->mapbase == AT91_VA_BASE_DBGU) ? 512 : SZ_16K, | ||
576 | "at91_serial") != NULL ? 0 : -EBUSY; | ||
577 | |||
578 | } | ||
579 | |||
580 | /* | ||
581 | * Configure/autoconfigure the port. | ||
582 | */ | ||
583 | static void at91_config_port(struct uart_port *port, int flags) | ||
584 | { | ||
585 | if (flags & UART_CONFIG_TYPE) { | ||
586 | port->type = PORT_AT91RM9200; | ||
587 | at91_request_port(port); | ||
588 | } | ||
589 | } | ||
590 | |||
591 | /* | ||
592 | * Verify the new serial_struct (for TIOCSSERIAL). | ||
593 | */ | ||
594 | static int at91_verify_port(struct uart_port *port, struct serial_struct *ser) | ||
595 | { | ||
596 | int ret = 0; | ||
597 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_AT91RM9200) | ||
598 | ret = -EINVAL; | ||
599 | if (port->irq != ser->irq) | ||
600 | ret = -EINVAL; | ||
601 | if (ser->io_type != SERIAL_IO_MEM) | ||
602 | ret = -EINVAL; | ||
603 | if (port->uartclk / 16 != ser->baud_base) | ||
604 | ret = -EINVAL; | ||
605 | if ((void *)port->mapbase != ser->iomem_base) | ||
606 | ret = -EINVAL; | ||
607 | if (port->iobase != ser->port) | ||
608 | ret = -EINVAL; | ||
609 | if (ser->hub6 != 0) | ||
610 | ret = -EINVAL; | ||
611 | return ret; | ||
612 | } | ||
613 | |||
614 | static struct uart_ops at91_pops = { | ||
615 | .tx_empty = at91_tx_empty, | ||
616 | .set_mctrl = at91_set_mctrl, | ||
617 | .get_mctrl = at91_get_mctrl, | ||
618 | .stop_tx = at91_stop_tx, | ||
619 | .start_tx = at91_start_tx, | ||
620 | .stop_rx = at91_stop_rx, | ||
621 | .enable_ms = at91_enable_ms, | ||
622 | .break_ctl = at91_break_ctl, | ||
623 | .startup = at91_startup, | ||
624 | .shutdown = at91_shutdown, | ||
625 | .set_termios = at91_set_termios, | ||
626 | .type = at91_type, | ||
627 | .release_port = at91_release_port, | ||
628 | .request_port = at91_request_port, | ||
629 | .config_port = at91_config_port, | ||
630 | .verify_port = at91_verify_port, | ||
631 | .pm = at91_serial_pm, | ||
632 | }; | ||
633 | |||
634 | static struct uart_port at91_ports[AT91_NR_UART]; | ||
635 | |||
636 | void __init at91_init_ports(void) | ||
637 | { | ||
638 | static int first = 1; | ||
639 | int i; | ||
640 | |||
641 | if (!first) | ||
642 | return; | ||
643 | first = 0; | ||
644 | |||
645 | for (i = 0; i < AT91_NR_UART; i++) { | ||
646 | at91_ports[i].iotype = UPIO_MEM; | ||
647 | at91_ports[i].flags = UPF_BOOT_AUTOCONF; | ||
648 | at91_ports[i].uartclk = at91_master_clock; | ||
649 | at91_ports[i].ops = &at91_pops; | ||
650 | at91_ports[i].fifosize = 1; | ||
651 | at91_ports[i].line = i; | ||
652 | } | ||
653 | } | ||
654 | |||
655 | void __init at91_register_uart_fns(struct at91rm9200_port_fns *fns) | ||
656 | { | ||
657 | if (fns->enable_ms) | ||
658 | at91_pops.enable_ms = fns->enable_ms; | ||
659 | if (fns->get_mctrl) | ||
660 | at91_pops.get_mctrl = fns->get_mctrl; | ||
661 | if (fns->set_mctrl) | ||
662 | at91_pops.set_mctrl = fns->set_mctrl; | ||
663 | at91_open = fns->open; | ||
664 | at91_close = fns->close; | ||
665 | at91_pops.pm = fns->pm; | ||
666 | at91_pops.set_wake = fns->set_wake; | ||
667 | } | ||
668 | |||
669 | /* | ||
670 | * Setup ports. | ||
671 | */ | ||
672 | void __init at91_register_uart(int idx, int port) | ||
673 | { | ||
674 | if ((idx < 0) || (idx >= AT91_NR_UART)) { | ||
675 | printk(KERN_ERR "%s: bad index number %d\n", __FUNCTION__, idx); | ||
676 | return; | ||
677 | } | ||
678 | |||
679 | switch (port) { | ||
680 | case 0: | ||
681 | at91_ports[idx].membase = (void __iomem *) AT91_VA_BASE_US0; | ||
682 | at91_ports[idx].mapbase = AT91_VA_BASE_US0; | ||
683 | at91_ports[idx].irq = AT91_ID_US0; | ||
684 | AT91_CfgPIO_USART0(); | ||
685 | break; | ||
686 | case 1: | ||
687 | at91_ports[idx].membase = (void __iomem *) AT91_VA_BASE_US1; | ||
688 | at91_ports[idx].mapbase = AT91_VA_BASE_US1; | ||
689 | at91_ports[idx].irq = AT91_ID_US1; | ||
690 | AT91_CfgPIO_USART1(); | ||
691 | break; | ||
692 | case 2: | ||
693 | at91_ports[idx].membase = (void __iomem *) AT91_VA_BASE_US2; | ||
694 | at91_ports[idx].mapbase = AT91_VA_BASE_US2; | ||
695 | at91_ports[idx].irq = AT91_ID_US2; | ||
696 | AT91_CfgPIO_USART2(); | ||
697 | break; | ||
698 | case 3: | ||
699 | at91_ports[idx].membase = (void __iomem *) AT91_VA_BASE_US3; | ||
700 | at91_ports[idx].mapbase = AT91_VA_BASE_US3; | ||
701 | at91_ports[idx].irq = AT91_ID_US3; | ||
702 | AT91_CfgPIO_USART3(); | ||
703 | break; | ||
704 | case 4: | ||
705 | at91_ports[idx].membase = (void __iomem *) AT91_VA_BASE_DBGU; | ||
706 | at91_ports[idx].mapbase = AT91_VA_BASE_DBGU; | ||
707 | at91_ports[idx].irq = AT91_ID_SYS; | ||
708 | AT91_CfgPIO_DBGU(); | ||
709 | break; | ||
710 | default: | ||
711 | printk(KERN_ERR "%s : bad port number %d\n", __FUNCTION__, port); | ||
712 | } | ||
713 | } | ||
714 | |||
715 | #ifdef CONFIG_SERIAL_AT91_CONSOLE | ||
716 | |||
717 | /* | ||
718 | * Interrupts are disabled on entering | ||
719 | */ | ||
720 | static void at91_console_write(struct console *co, const char *s, u_int count) | ||
721 | { | ||
722 | struct uart_port *port = at91_ports + co->index; | ||
723 | unsigned int status, i, imr; | ||
724 | |||
725 | /* | ||
726 | * First, save IMR and then disable interrupts | ||
727 | */ | ||
728 | imr = UART_GET_IMR(port); /* get interrupt mask */ | ||
729 | UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); | ||
730 | |||
731 | /* | ||
732 | * Now, do each character | ||
733 | */ | ||
734 | for (i = 0; i < count; i++) { | ||
735 | do { | ||
736 | status = UART_GET_CSR(port); | ||
737 | } while (!(status & AT91_US_TXRDY)); | ||
738 | UART_PUT_CHAR(port, s[i]); | ||
739 | if (s[i] == '\n') { | ||
740 | do { | ||
741 | status = UART_GET_CSR(port); | ||
742 | } while (!(status & AT91_US_TXRDY)); | ||
743 | UART_PUT_CHAR(port, '\r'); | ||
744 | } | ||
745 | } | ||
746 | |||
747 | /* | ||
748 | * Finally, wait for transmitter to become empty | ||
749 | * and restore IMR | ||
750 | */ | ||
751 | do { | ||
752 | status = UART_GET_CSR(port); | ||
753 | } while (!(status & AT91_US_TXRDY)); | ||
754 | UART_PUT_IER(port, imr); /* set interrupts back the way they were */ | ||
755 | } | ||
756 | |||
757 | /* | ||
758 | * If the port was already initialised (eg, by a boot loader), try to determine | ||
759 | * the current setup. | ||
760 | */ | ||
761 | static void __init at91_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits) | ||
762 | { | ||
763 | unsigned int mr, quot; | ||
764 | |||
765 | // TODO: CR is a write-only register | ||
766 | // unsigned int cr; | ||
767 | // | ||
768 | // cr = UART_GET_CR(port) & (AT91_US_RXEN | AT91_US_TXEN); | ||
769 | // if (cr == (AT91_US_RXEN | AT91_US_TXEN)) { | ||
770 | // /* ok, the port was enabled */ | ||
771 | // } | ||
772 | |||
773 | mr = UART_GET_MR(port) & AT91_US_CHRL; | ||
774 | if (mr == AT91_US_CHRL_8) | ||
775 | *bits = 8; | ||
776 | else | ||
777 | *bits = 7; | ||
778 | |||
779 | mr = UART_GET_MR(port) & AT91_US_PAR; | ||
780 | if (mr == AT91_US_PAR_EVEN) | ||
781 | *parity = 'e'; | ||
782 | else if (mr == AT91_US_PAR_ODD) | ||
783 | *parity = 'o'; | ||
784 | |||
785 | quot = UART_GET_BRGR(port); | ||
786 | *baud = port->uartclk / (16 * (quot)); | ||
787 | } | ||
788 | |||
789 | static int __init at91_console_setup(struct console *co, char *options) | ||
790 | { | ||
791 | struct uart_port *port; | ||
792 | int baud = 115200; | ||
793 | int bits = 8; | ||
794 | int parity = 'n'; | ||
795 | int flow = 'n'; | ||
796 | |||
797 | /* | ||
798 | * Check whether an invalid uart number has been specified, and | ||
799 | * if so, search for the first available port that does have | ||
800 | * console support. | ||
801 | */ | ||
802 | port = uart_get_console(at91_ports, AT91_NR_UART, co); | ||
803 | |||
804 | /* | ||
805 | * Enable the serial console, in-case bootloader did not do it. | ||
806 | */ | ||
807 | at91_sys_write(AT91_PMC_PCER, 1 << port->irq); /* enable clock */ | ||
808 | UART_PUT_IDR(port, -1); /* disable interrupts */ | ||
809 | UART_PUT_CR(port, AT91_US_RSTSTA | AT91_US_RSTRX); | ||
810 | UART_PUT_CR(port, AT91_US_TXEN | AT91_US_RXEN); | ||
811 | |||
812 | if (options) | ||
813 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
814 | else | ||
815 | at91_console_get_options(port, &baud, &parity, &bits); | ||
816 | |||
817 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
818 | } | ||
819 | |||
820 | static struct uart_driver at91_uart; | ||
821 | |||
822 | static struct console at91_console = { | ||
823 | .name = AT91_DEVICENAME, | ||
824 | .write = at91_console_write, | ||
825 | .device = uart_console_device, | ||
826 | .setup = at91_console_setup, | ||
827 | .flags = CON_PRINTBUFFER, | ||
828 | .index = -1, | ||
829 | .data = &at91_uart, | ||
830 | }; | ||
831 | |||
832 | #define AT91_CONSOLE_DEVICE &at91_console | ||
833 | |||
834 | static int __init at91_console_init(void) | ||
835 | { | ||
836 | at91_init_ports(); | ||
837 | |||
838 | at91_console.index = at91_console_port; | ||
839 | register_console(&at91_console); | ||
840 | return 0; | ||
841 | } | ||
842 | console_initcall(at91_console_init); | ||
843 | |||
844 | #else | ||
845 | #define AT91_CONSOLE_DEVICE NULL | ||
846 | #endif | ||
847 | |||
848 | static struct uart_driver at91_uart = { | ||
849 | .owner = THIS_MODULE, | ||
850 | .driver_name = AT91_DEVICENAME, | ||
851 | .dev_name = AT91_DEVICENAME, | ||
852 | .devfs_name = AT91_DEVICENAME, | ||
853 | .major = SERIAL_AT91_MAJOR, | ||
854 | .minor = MINOR_START, | ||
855 | .nr = AT91_NR_UART, | ||
856 | .cons = AT91_CONSOLE_DEVICE, | ||
857 | }; | ||
858 | |||
859 | static int __init at91_serial_init(void) | ||
860 | { | ||
861 | int ret, i; | ||
862 | |||
863 | at91_init_ports(); | ||
864 | |||
865 | ret = uart_register_driver(&at91_uart); | ||
866 | if (ret) | ||
867 | return ret; | ||
868 | |||
869 | for (i = 0; i < AT91_NR_UART; i++) { | ||
870 | if (at91_serial_map[i] >= 0) | ||
871 | uart_add_one_port(&at91_uart, &at91_ports[i]); | ||
872 | } | ||
873 | |||
874 | return 0; | ||
875 | } | ||
876 | |||
877 | static void __exit at91_serial_exit(void) | ||
878 | { | ||
879 | int i; | ||
880 | |||
881 | for (i = 0; i < AT91_NR_UART; i++) { | ||
882 | if (at91_serial_map[i] >= 0) | ||
883 | uart_remove_one_port(&at91_uart, &at91_ports[i]); | ||
884 | } | ||
885 | |||
886 | uart_unregister_driver(&at91_uart); | ||
887 | } | ||
888 | |||
889 | module_init(at91_serial_init); | ||
890 | module_exit(at91_serial_exit); | ||
891 | |||
892 | MODULE_AUTHOR("Rick Bronson"); | ||
893 | MODULE_DESCRIPTION("AT91 generic serial port driver"); | ||
894 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 08c42c000188..be12623d8544 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -442,6 +442,7 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
442 | #include <linux/init.h> | 442 | #include <linux/init.h> |
443 | #include <asm/uaccess.h> | 443 | #include <asm/uaccess.h> |
444 | #include <linux/kernel.h> | 444 | #include <linux/kernel.h> |
445 | #include <linux/mutex.h> | ||
445 | 446 | ||
446 | #include <asm/io.h> | 447 | #include <asm/io.h> |
447 | #include <asm/irq.h> | 448 | #include <asm/irq.h> |
@@ -1315,11 +1316,7 @@ static const struct control_pins e100_modem_pins[NR_PORTS] = | |||
1315 | * memory if large numbers of serial ports are open. | 1316 | * memory if large numbers of serial ports are open. |
1316 | */ | 1317 | */ |
1317 | static unsigned char *tmp_buf; | 1318 | static unsigned char *tmp_buf; |
1318 | #ifdef DECLARE_MUTEX | 1319 | static DEFINE_MUTEX(tmp_buf_mutex); |
1319 | static DECLARE_MUTEX(tmp_buf_sem); | ||
1320 | #else | ||
1321 | static struct semaphore tmp_buf_sem = MUTEX; | ||
1322 | #endif | ||
1323 | 1320 | ||
1324 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ | 1321 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ |
1325 | static void update_char_time(struct e100_serial * info) | 1322 | static void update_char_time(struct e100_serial * info) |
@@ -3661,7 +3658,7 @@ rs_raw_write(struct tty_struct * tty, int from_user, | |||
3661 | * design. | 3658 | * design. |
3662 | */ | 3659 | */ |
3663 | if (from_user) { | 3660 | if (from_user) { |
3664 | down(&tmp_buf_sem); | 3661 | mutex_lock(&tmp_buf_mutex); |
3665 | while (1) { | 3662 | while (1) { |
3666 | int c1; | 3663 | int c1; |
3667 | c = CIRC_SPACE_TO_END(info->xmit.head, | 3664 | c = CIRC_SPACE_TO_END(info->xmit.head, |
@@ -3692,7 +3689,7 @@ rs_raw_write(struct tty_struct * tty, int from_user, | |||
3692 | count -= c; | 3689 | count -= c; |
3693 | ret += c; | 3690 | ret += c; |
3694 | } | 3691 | } |
3695 | up(&tmp_buf_sem); | 3692 | mutex_unlock(&tmp_buf_mutex); |
3696 | } else { | 3693 | } else { |
3697 | cli(); | 3694 | cli(); |
3698 | while (count) { | 3695 | while (count) { |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index f330d6c0e0df..5f52883e64d2 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/pmu.h> | 60 | #include <linux/pmu.h> |
61 | #include <linux/bitops.h> | 61 | #include <linux/bitops.h> |
62 | #include <linux/sysrq.h> | 62 | #include <linux/sysrq.h> |
63 | #include <linux/mutex.h> | ||
63 | #include <asm/sections.h> | 64 | #include <asm/sections.h> |
64 | #include <asm/io.h> | 65 | #include <asm/io.h> |
65 | #include <asm/irq.h> | 66 | #include <asm/irq.h> |
@@ -96,7 +97,7 @@ MODULE_LICENSE("GPL"); | |||
96 | */ | 97 | */ |
97 | static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS]; | 98 | static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS]; |
98 | static int pmz_ports_count; | 99 | static int pmz_ports_count; |
99 | static DECLARE_MUTEX(pmz_irq_sem); | 100 | static DEFINE_MUTEX(pmz_irq_mutex); |
100 | 101 | ||
101 | static struct uart_driver pmz_uart_reg = { | 102 | static struct uart_driver pmz_uart_reg = { |
102 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
@@ -922,7 +923,7 @@ static int pmz_startup(struct uart_port *port) | |||
922 | if (uap->node == NULL) | 923 | if (uap->node == NULL) |
923 | return -ENODEV; | 924 | return -ENODEV; |
924 | 925 | ||
925 | down(&pmz_irq_sem); | 926 | mutex_lock(&pmz_irq_mutex); |
926 | 927 | ||
927 | uap->flags |= PMACZILOG_FLAG_IS_OPEN; | 928 | uap->flags |= PMACZILOG_FLAG_IS_OPEN; |
928 | 929 | ||
@@ -940,11 +941,11 @@ static int pmz_startup(struct uart_port *port) | |||
940 | dev_err(&uap->dev->ofdev.dev, | 941 | dev_err(&uap->dev->ofdev.dev, |
941 | "Unable to register zs interrupt handler.\n"); | 942 | "Unable to register zs interrupt handler.\n"); |
942 | pmz_set_scc_power(uap, 0); | 943 | pmz_set_scc_power(uap, 0); |
943 | up(&pmz_irq_sem); | 944 | mutex_unlock(&pmz_irq_mutex); |
944 | return -ENXIO; | 945 | return -ENXIO; |
945 | } | 946 | } |
946 | 947 | ||
947 | up(&pmz_irq_sem); | 948 | mutex_unlock(&pmz_irq_mutex); |
948 | 949 | ||
949 | /* Right now, we deal with delay by blocking here, I'll be | 950 | /* Right now, we deal with delay by blocking here, I'll be |
950 | * smarter later on | 951 | * smarter later on |
@@ -981,7 +982,7 @@ static void pmz_shutdown(struct uart_port *port) | |||
981 | if (uap->node == NULL) | 982 | if (uap->node == NULL) |
982 | return; | 983 | return; |
983 | 984 | ||
984 | down(&pmz_irq_sem); | 985 | mutex_lock(&pmz_irq_mutex); |
985 | 986 | ||
986 | /* Release interrupt handler */ | 987 | /* Release interrupt handler */ |
987 | free_irq(uap->port.irq, uap); | 988 | free_irq(uap->port.irq, uap); |
@@ -1002,7 +1003,7 @@ static void pmz_shutdown(struct uart_port *port) | |||
1002 | 1003 | ||
1003 | if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) { | 1004 | if (ZS_IS_CONS(uap) || ZS_IS_ASLEEP(uap)) { |
1004 | spin_unlock_irqrestore(&port->lock, flags); | 1005 | spin_unlock_irqrestore(&port->lock, flags); |
1005 | up(&pmz_irq_sem); | 1006 | mutex_unlock(&pmz_irq_mutex); |
1006 | return; | 1007 | return; |
1007 | } | 1008 | } |
1008 | 1009 | ||
@@ -1019,7 +1020,7 @@ static void pmz_shutdown(struct uart_port *port) | |||
1019 | 1020 | ||
1020 | spin_unlock_irqrestore(&port->lock, flags); | 1021 | spin_unlock_irqrestore(&port->lock, flags); |
1021 | 1022 | ||
1022 | up(&pmz_irq_sem); | 1023 | mutex_unlock(&pmz_irq_mutex); |
1023 | 1024 | ||
1024 | pmz_debug("pmz: shutdown() done.\n"); | 1025 | pmz_debug("pmz: shutdown() done.\n"); |
1025 | } | 1026 | } |
@@ -1591,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) | |||
1591 | 1592 | ||
1592 | state = pmz_uart_reg.state + uap->port.line; | 1593 | state = pmz_uart_reg.state + uap->port.line; |
1593 | 1594 | ||
1594 | down(&pmz_irq_sem); | 1595 | mutex_lock(&pmz_irq_mutex); |
1595 | down(&state->sem); | 1596 | down(&state->sem); |
1596 | 1597 | ||
1597 | spin_lock_irqsave(&uap->port.lock, flags); | 1598 | spin_lock_irqsave(&uap->port.lock, flags); |
@@ -1624,7 +1625,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) | |||
1624 | pmz_set_scc_power(uap, 0); | 1625 | pmz_set_scc_power(uap, 0); |
1625 | 1626 | ||
1626 | up(&state->sem); | 1627 | up(&state->sem); |
1627 | up(&pmz_irq_sem); | 1628 | mutex_unlock(&pmz_irq_mutex); |
1628 | 1629 | ||
1629 | pmz_debug("suspend, switching complete\n"); | 1630 | pmz_debug("suspend, switching complete\n"); |
1630 | 1631 | ||
@@ -1651,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev) | |||
1651 | 1652 | ||
1652 | state = pmz_uart_reg.state + uap->port.line; | 1653 | state = pmz_uart_reg.state + uap->port.line; |
1653 | 1654 | ||
1654 | down(&pmz_irq_sem); | 1655 | mutex_lock(&pmz_irq_mutex); |
1655 | down(&state->sem); | 1656 | down(&state->sem); |
1656 | 1657 | ||
1657 | spin_lock_irqsave(&uap->port.lock, flags); | 1658 | spin_lock_irqsave(&uap->port.lock, flags); |
@@ -1685,7 +1686,7 @@ static int pmz_resume(struct macio_dev *mdev) | |||
1685 | 1686 | ||
1686 | bail: | 1687 | bail: |
1687 | up(&state->sem); | 1688 | up(&state->sem); |
1688 | up(&pmz_irq_sem); | 1689 | mutex_unlock(&pmz_irq_mutex); |
1689 | 1690 | ||
1690 | /* Right now, we deal with delay by blocking here, I'll be | 1691 | /* Right now, we deal with delay by blocking here, I'll be |
1691 | * smarter later on | 1692 | * smarter later on |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 9589509fc5bd..2ca620900bcc 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ | 34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
@@ -47,7 +48,7 @@ | |||
47 | /* | 48 | /* |
48 | * This is used to lock changes in serial line configuration. | 49 | * This is used to lock changes in serial line configuration. |
49 | */ | 50 | */ |
50 | static DECLARE_MUTEX(port_sem); | 51 | static DEFINE_MUTEX(port_mutex); |
51 | 52 | ||
52 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) | 53 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) |
53 | 54 | ||
@@ -1472,7 +1473,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1472 | { | 1473 | { |
1473 | struct uart_state *state; | 1474 | struct uart_state *state; |
1474 | 1475 | ||
1475 | down(&port_sem); | 1476 | mutex_lock(&port_mutex); |
1476 | state = drv->state + line; | 1477 | state = drv->state + line; |
1477 | if (down_interruptible(&state->sem)) { | 1478 | if (down_interruptible(&state->sem)) { |
1478 | state = ERR_PTR(-ERESTARTSYS); | 1479 | state = ERR_PTR(-ERESTARTSYS); |
@@ -1509,7 +1510,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1509 | } | 1510 | } |
1510 | 1511 | ||
1511 | out: | 1512 | out: |
1512 | up(&port_sem); | 1513 | mutex_unlock(&port_mutex); |
1513 | return state; | 1514 | return state; |
1514 | } | 1515 | } |
1515 | 1516 | ||
@@ -2219,7 +2220,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2219 | 2220 | ||
2220 | state = drv->state + port->line; | 2221 | state = drv->state + port->line; |
2221 | 2222 | ||
2222 | down(&port_sem); | 2223 | mutex_lock(&port_mutex); |
2223 | if (state->port) { | 2224 | if (state->port) { |
2224 | ret = -EINVAL; | 2225 | ret = -EINVAL; |
2225 | goto out; | 2226 | goto out; |
@@ -2255,7 +2256,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2255 | register_console(port->cons); | 2256 | register_console(port->cons); |
2256 | 2257 | ||
2257 | out: | 2258 | out: |
2258 | up(&port_sem); | 2259 | mutex_unlock(&port_mutex); |
2259 | 2260 | ||
2260 | return ret; | 2261 | return ret; |
2261 | } | 2262 | } |
@@ -2279,7 +2280,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2279 | printk(KERN_ALERT "Removing wrong port: %p != %p\n", | 2280 | printk(KERN_ALERT "Removing wrong port: %p != %p\n", |
2280 | state->port, port); | 2281 | state->port, port); |
2281 | 2282 | ||
2282 | down(&port_sem); | 2283 | mutex_lock(&port_mutex); |
2283 | 2284 | ||
2284 | /* | 2285 | /* |
2285 | * Remove the devices from devfs | 2286 | * Remove the devices from devfs |
@@ -2288,7 +2289,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2288 | 2289 | ||
2289 | uart_unconfigure_port(drv, state); | 2290 | uart_unconfigure_port(drv, state); |
2290 | state->port = NULL; | 2291 | state->port = NULL; |
2291 | up(&port_sem); | 2292 | mutex_unlock(&port_mutex); |
2292 | 2293 | ||
2293 | return 0; | 2294 | return 0; |
2294 | } | 2295 | } |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index fdd1f1915a42..ee98a867bc6d 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/tty_flip.h> | 52 | #include <linux/tty_flip.h> |
53 | #include <linux/serial_core.h> | 53 | #include <linux/serial_core.h> |
54 | #include <linux/serial.h> | 54 | #include <linux/serial.h> |
55 | #include <linux/mutex.h> | ||
55 | 56 | ||
56 | #include <asm/io.h> | 57 | #include <asm/io.h> |
57 | #include <asm/irq.h> | 58 | #include <asm/irq.h> |
@@ -1018,7 +1019,7 @@ static void serial_txx9_resume_port(int line) | |||
1018 | uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port); | 1019 | uart_resume_port(&serial_txx9_reg, &serial_txx9_ports[line].port); |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | static DECLARE_MUTEX(serial_txx9_sem); | 1022 | static DEFINE_MUTEX(serial_txx9_mutex); |
1022 | 1023 | ||
1023 | /** | 1024 | /** |
1024 | * serial_txx9_register_port - register a serial port | 1025 | * serial_txx9_register_port - register a serial port |
@@ -1037,7 +1038,7 @@ static int __devinit serial_txx9_register_port(struct uart_port *port) | |||
1037 | struct uart_txx9_port *uart; | 1038 | struct uart_txx9_port *uart; |
1038 | int ret = -ENOSPC; | 1039 | int ret = -ENOSPC; |
1039 | 1040 | ||
1040 | down(&serial_txx9_sem); | 1041 | mutex_lock(&serial_txx9_mutex); |
1041 | for (i = 0; i < UART_NR; i++) { | 1042 | for (i = 0; i < UART_NR; i++) { |
1042 | uart = &serial_txx9_ports[i]; | 1043 | uart = &serial_txx9_ports[i]; |
1043 | if (uart->port.type == PORT_UNKNOWN) | 1044 | if (uart->port.type == PORT_UNKNOWN) |
@@ -1058,7 +1059,7 @@ static int __devinit serial_txx9_register_port(struct uart_port *port) | |||
1058 | if (ret == 0) | 1059 | if (ret == 0) |
1059 | ret = uart->port.line; | 1060 | ret = uart->port.line; |
1060 | } | 1061 | } |
1061 | up(&serial_txx9_sem); | 1062 | mutex_unlock(&serial_txx9_mutex); |
1062 | return ret; | 1063 | return ret; |
1063 | } | 1064 | } |
1064 | 1065 | ||
@@ -1073,7 +1074,7 @@ static void __devexit serial_txx9_unregister_port(int line) | |||
1073 | { | 1074 | { |
1074 | struct uart_txx9_port *uart = &serial_txx9_ports[line]; | 1075 | struct uart_txx9_port *uart = &serial_txx9_ports[line]; |
1075 | 1076 | ||
1076 | down(&serial_txx9_sem); | 1077 | mutex_lock(&serial_txx9_mutex); |
1077 | uart_remove_one_port(&serial_txx9_reg, &uart->port); | 1078 | uart_remove_one_port(&serial_txx9_reg, &uart->port); |
1078 | uart->port.flags = 0; | 1079 | uart->port.flags = 0; |
1079 | uart->port.type = PORT_UNKNOWN; | 1080 | uart->port.type = PORT_UNKNOWN; |
@@ -1082,7 +1083,7 @@ static void __devexit serial_txx9_unregister_port(int line) | |||
1082 | uart->port.membase = 0; | 1083 | uart->port.membase = 0; |
1083 | uart->port.dev = NULL; | 1084 | uart->port.dev = NULL; |
1084 | uart_add_one_port(&serial_txx9_reg, &uart->port); | 1085 | uart_add_one_port(&serial_txx9_reg, &uart->port); |
1085 | up(&serial_txx9_sem); | 1086 | mutex_unlock(&serial_txx9_mutex); |
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | /* | 1089 | /* |
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h b/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h new file mode 100644 index 000000000000..ce1150d4438d --- /dev/null +++ b/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * Peripheral Data Controller (PDC) registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91RM9200_PDC_H | ||
17 | #define AT91RM9200_PDC_H | ||
18 | |||
19 | #define AT91_PDC_RPR 0x100 /* Receive Pointer Register */ | ||
20 | #define AT91_PDC_RCR 0x104 /* Receive Counter Register */ | ||
21 | #define AT91_PDC_TPR 0x108 /* Transmit Pointer Register */ | ||
22 | #define AT91_PDC_TCR 0x10c /* Transmit Counter Register */ | ||
23 | #define AT91_PDC_RNPR 0x110 /* Receive Next Pointer Register */ | ||
24 | #define AT91_PDC_RNCR 0x114 /* Receive Next Counter Register */ | ||
25 | #define AT91_PDC_TNPR 0x118 /* Transmit Next Pointer Register */ | ||
26 | #define AT91_PDC_TNCR 0x11c /* Transmit Next Counter Register */ | ||
27 | |||
28 | #define AT91_PDC_PTCR 0x120 /* Transfer Control Register */ | ||
29 | #define AT91_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */ | ||
30 | #define AT91_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */ | ||
31 | #define AT91_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */ | ||
32 | #define AT91_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */ | ||
33 | |||
34 | #define AT91_PDC_PTSR 0x124 /* Transfer Status Register */ | ||
35 | |||
36 | #endif | ||
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h b/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h new file mode 100644 index 000000000000..79f851e31b9c --- /dev/null +++ b/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-at91rm9200/at91rm9200_usart.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * USART registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91RM9200_USART_H | ||
17 | #define AT91RM9200_USART_H | ||
18 | |||
19 | #define AT91_US_CR 0x00 /* Control Register */ | ||
20 | #define AT91_US_RSTRX (1 << 2) /* Reset Receiver */ | ||
21 | #define AT91_US_RSTTX (1 << 3) /* Reset Transmitter */ | ||
22 | #define AT91_US_RXEN (1 << 4) /* Receiver Enable */ | ||
23 | #define AT91_US_RXDIS (1 << 5) /* Receiver Disable */ | ||
24 | #define AT91_US_TXEN (1 << 6) /* Transmitter Enable */ | ||
25 | #define AT91_US_TXDIS (1 << 7) /* Transmitter Disable */ | ||
26 | #define AT91_US_RSTSTA (1 << 8) /* Reset Status Bits */ | ||
27 | #define AT91_US_STTBRK (1 << 9) /* Start Break */ | ||
28 | #define AT91_US_STPBRK (1 << 10) /* Stop Break */ | ||
29 | #define AT91_US_STTTO (1 << 11) /* Start Time-out */ | ||
30 | #define AT91_US_SENDA (1 << 12) /* Send Address */ | ||
31 | #define AT91_US_RSTIT (1 << 13) /* Reset Iterations */ | ||
32 | #define AT91_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */ | ||
33 | #define AT91_US_RETTO (1 << 15) /* Rearm Time-out */ | ||
34 | #define AT91_US_DTREN (1 << 16) /* Data Terminal Ready Enable */ | ||
35 | #define AT91_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable */ | ||
36 | #define AT91_US_RTSEN (1 << 18) /* Request To Send Enable */ | ||
37 | #define AT91_US_RTSDIS (1 << 19) /* Request To Send Disable */ | ||
38 | |||
39 | #define AT91_US_MR 0x04 /* Mode Register */ | ||
40 | #define AT91_US_USMODE (0xf << 0) /* Mode of the USART */ | ||
41 | #define AT91_US_USMODE_NORMAL 0 | ||
42 | #define AT91_US_USMODE_RS485 1 | ||
43 | #define AT91_US_USMODE_HWHS 2 | ||
44 | #define AT91_US_USMODE_MODEM 3 | ||
45 | #define AT91_US_USMODE_ISO7816_T0 4 | ||
46 | #define AT91_US_USMODE_ISO7816_T1 6 | ||
47 | #define AT91_US_USMODE_IRDA 8 | ||
48 | #define AT91_US_USCLKS (3 << 4) /* Clock Selection */ | ||
49 | #define AT91_US_CHRL (3 << 6) /* Character Length */ | ||
50 | #define AT91_US_CHRL_5 (0 << 6) | ||
51 | #define AT91_US_CHRL_6 (1 << 6) | ||
52 | #define AT91_US_CHRL_7 (2 << 6) | ||
53 | #define AT91_US_CHRL_8 (3 << 6) | ||
54 | #define AT91_US_SYNC (1 << 8) /* Synchronous Mode Select */ | ||
55 | #define AT91_US_PAR (7 << 9) /* Parity Type */ | ||
56 | #define AT91_US_PAR_EVEN (0 << 9) | ||
57 | #define AT91_US_PAR_ODD (1 << 9) | ||
58 | #define AT91_US_PAR_SPACE (2 << 9) | ||
59 | #define AT91_US_PAR_MARK (3 << 9) | ||
60 | #define AT91_US_PAR_NONE (4 << 9) | ||
61 | #define AT91_US_PAR_MULTI_DROP (6 << 9) | ||
62 | #define AT91_US_NBSTOP (3 << 12) /* Number of Stop Bits */ | ||
63 | #define AT91_US_NBSTOP_1 (0 << 12) | ||
64 | #define AT91_US_NBSTOP_1_5 (1 << 12) | ||
65 | #define AT91_US_NBSTOP_2 (2 << 12) | ||
66 | #define AT91_US_CHMODE (3 << 14) /* Channel Mode */ | ||
67 | #define AT91_US_CHMODE_NORMAL (0 << 14) | ||
68 | #define AT91_US_CHMODE_ECHO (1 << 14) | ||
69 | #define AT91_US_CHMODE_LOC_LOOP (2 << 14) | ||
70 | #define AT91_US_CHMODE_REM_LOOP (3 << 14) | ||
71 | #define AT91_US_MSBF (1 << 16) /* Bit Order */ | ||
72 | #define AT91_US_MODE9 (1 << 17) /* 9-bit Character Length */ | ||
73 | #define AT91_US_CLKO (1 << 18) /* Clock Output Select */ | ||
74 | #define AT91_US_OVER (1 << 19) /* Oversampling Mode */ | ||
75 | #define AT91_US_INACK (1 << 20) /* Inhibit Non Acknowledge */ | ||
76 | #define AT91_US_DSNACK (1 << 21) /* Disable Successive NACK */ | ||
77 | #define AT91_US_MAX_ITER (7 << 24) /* Max Iterations */ | ||
78 | #define AT91_US_FILTER (1 << 28) /* Infrared Receive Line Filter */ | ||
79 | |||
80 | #define AT91_US_IER 0x08 /* Interrupt Enable Register */ | ||
81 | #define AT91_US_RXRDY (1 << 0) /* Receiver Ready */ | ||
82 | #define AT91_US_TXRDY (1 << 1) /* Transmitter Ready */ | ||
83 | #define AT91_US_RXBRK (1 << 2) /* Break Received / End of Break */ | ||
84 | #define AT91_US_ENDRX (1 << 3) /* End of Receiver Transfer */ | ||
85 | #define AT91_US_ENDTX (1 << 4) /* End of Transmitter Transfer */ | ||
86 | #define AT91_US_OVRE (1 << 5) /* Overrun Error */ | ||
87 | #define AT91_US_FRAME (1 << 6) /* Framing Error */ | ||
88 | #define AT91_US_PARE (1 << 7) /* Parity Error */ | ||
89 | #define AT91_US_TIMEOUT (1 << 8) /* Receiver Time-out */ | ||
90 | #define AT91_US_TXEMPTY (1 << 9) /* Transmitter Empty */ | ||
91 | #define AT91_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */ | ||
92 | #define AT91_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */ | ||
93 | #define AT91_US_RXBUFF (1 << 12) /* Reception Buffer Full */ | ||
94 | #define AT91_US_NACK (1 << 13) /* Non Acknowledge */ | ||
95 | #define AT91_US_RIIC (1 << 16) /* Ring Indicator Input Change */ | ||
96 | #define AT91_US_DSRIC (1 << 17) /* Data Set Ready Input Change */ | ||
97 | #define AT91_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change */ | ||
98 | #define AT91_US_CTSIC (1 << 19) /* Clear to Send Input Change */ | ||
99 | #define AT91_US_RI (1 << 20) /* RI */ | ||
100 | #define AT91_US_DSR (1 << 21) /* DSR */ | ||
101 | #define AT91_US_DCD (1 << 22) /* DCD */ | ||
102 | #define AT91_US_CTS (1 << 23) /* CTS */ | ||
103 | |||
104 | #define AT91_US_IDR 0x0c /* Interrupt Disable Register */ | ||
105 | #define AT91_US_IMR 0x10 /* Interrupt Mask Register */ | ||
106 | #define AT91_US_CSR 0x14 /* Channel Status Register */ | ||
107 | #define AT91_US_RHR 0x18 /* Receiver Holding Register */ | ||
108 | #define AT91_US_THR 0x1c /* Transmitter Holding Register */ | ||
109 | |||
110 | #define AT91_US_BRGR 0x20 /* Baud Rate Generator Register */ | ||
111 | #define AT91_US_CD (0xffff << 0) /* Clock Divider */ | ||
112 | |||
113 | #define AT91_US_RTOR 0x24 /* Receiver Time-out Register */ | ||
114 | #define AT91_US_TO (0xffff << 0) /* Time-out Value */ | ||
115 | |||
116 | #define AT91_US_TTGR 0x28 /* Transmitter Timeguard Register */ | ||
117 | #define AT91_US_TG (0xff << 0) /* Timeguard Value */ | ||
118 | |||
119 | #define AT91_US_FIDI 0x40 /* FI DI Ratio Register */ | ||
120 | #define AT91_US_NER 0x44 /* Number of Errors Register */ | ||
121 | #define AT91_US_IF 0x4c /* IrDA Filter Register */ | ||
122 | |||
123 | #endif | ||
diff --git a/include/asm-arm/byteorder.h b/include/asm-arm/byteorder.h index 741f5bc5d016..17eaf8bdf092 100644 --- a/include/asm-arm/byteorder.h +++ b/include/asm-arm/byteorder.h | |||
@@ -22,7 +22,16 @@ static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) | |||
22 | { | 22 | { |
23 | __u32 t; | 23 | __u32 t; |
24 | 24 | ||
25 | t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ | 25 | if (__builtin_constant_p(x)) { |
26 | t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ | ||
27 | } else { | ||
28 | /* | ||
29 | * The compiler needs a bit of a hint here to always do the | ||
30 | * right thing and not screw it up to different degrees | ||
31 | * depending on the gcc version. | ||
32 | */ | ||
33 | asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); | ||
34 | } | ||
26 | x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ | 35 | x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ |
27 | t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ | 36 | t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ |
28 | x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ | 37 | x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ |
diff --git a/include/asm-arm/mach/serial_at91rm9200.h b/include/asm-arm/mach/serial_at91rm9200.h new file mode 100644 index 000000000000..98f4b0cb883c --- /dev/null +++ b/include/asm-arm/mach/serial_at91rm9200.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/mach/serial_at91rm9200.h | ||
3 | * | ||
4 | * Based on serial_sa1100.h by Nicolas Pitre | ||
5 | * | ||
6 | * Copyright (C) 2002 ATMEL Rousset | ||
7 | * | ||
8 | * Low level machine dependent UART functions. | ||
9 | */ | ||
10 | #include <linux/config.h> | ||
11 | |||
12 | struct uart_port; | ||
13 | |||
14 | /* | ||
15 | * This is a temporary structure for registering these | ||
16 | * functions; it is intended to be discarded after boot. | ||
17 | */ | ||
18 | struct at91rm9200_port_fns { | ||
19 | void (*set_mctrl)(struct uart_port *, u_int); | ||
20 | u_int (*get_mctrl)(struct uart_port *); | ||
21 | void (*enable_ms)(struct uart_port *); | ||
22 | void (*pm)(struct uart_port *, u_int, u_int); | ||
23 | int (*set_wake)(struct uart_port *, u_int); | ||
24 | int (*open)(struct uart_port *); | ||
25 | void (*close)(struct uart_port *); | ||
26 | }; | ||
27 | |||
28 | #if defined(CONFIG_SERIAL_AT91) | ||
29 | void at91_register_uart_fns(struct at91rm9200_port_fns *fns); | ||
30 | void at91_register_uart(int idx, int port); | ||
31 | #else | ||
32 | #define at91_register_uart_fns(fns) do { } while (0) | ||
33 | #define at91_register_uart(idx,port) do { } while (0) | ||
34 | #endif | ||
35 | |||
36 | |||
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index 3d7f08bd9030..b4e1146ab682 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | #include <linux/compiler.h> | 26 | #include <linux/compiler.h> |
27 | #include <asm/arch/memory.h> | 27 | #include <asm/arch/memory.h> |
28 | #include <asm/sizes.h> | ||
28 | 29 | ||
29 | #ifndef TASK_SIZE | 30 | #ifndef TASK_SIZE |
30 | /* | 31 | /* |
@@ -48,6 +49,14 @@ | |||
48 | #endif | 49 | #endif |
49 | 50 | ||
50 | /* | 51 | /* |
52 | * Size of DMA-consistent memory region. Must be multiple of 2M, | ||
53 | * between 2MB and 14MB inclusive. | ||
54 | */ | ||
55 | #ifndef CONSISTENT_DMA_SIZE | ||
56 | #define CONSISTENT_DMA_SIZE SZ_2M | ||
57 | #endif | ||
58 | |||
59 | /* | ||
51 | * Physical vs virtual RAM address space conversion. These are | 60 | * Physical vs virtual RAM address space conversion. These are |
52 | * private definitions which should NOT be used outside memory.h | 61 | * private definitions which should NOT be used outside memory.h |
53 | * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. | 62 | * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. |
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index 8a8393e50774..d5677cbec200 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h | |||
@@ -64,25 +64,6 @@ extern void iommu_free_table(struct device_node *dn); | |||
64 | 64 | ||
65 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 65 | #endif /* CONFIG_PPC_MULTIPLATFORM */ |
66 | 66 | ||
67 | #ifdef CONFIG_PPC_PSERIES | ||
68 | |||
69 | /* Creates table for an individual device node */ | ||
70 | extern void iommu_devnode_init_pSeries(struct device_node *dn); | ||
71 | |||
72 | #endif /* CONFIG_PPC_PSERIES */ | ||
73 | |||
74 | #ifdef CONFIG_PPC_ISERIES | ||
75 | |||
76 | /* Creates table for an individual device node */ | ||
77 | extern void iommu_devnode_init_iSeries(struct device_node *dn); | ||
78 | /* Get table parameters from HV */ | ||
79 | extern void iommu_table_getparms_iSeries(unsigned long busno, | ||
80 | unsigned char slotno, | ||
81 | unsigned char virtbus, | ||
82 | struct iommu_table* tbl); | ||
83 | |||
84 | #endif /* CONFIG_PPC_ISERIES */ | ||
85 | |||
86 | /* Initializes an iommu_table based in values set in the passed-in | 67 | /* Initializes an iommu_table based in values set in the passed-in |
87 | * structure | 68 | * structure |
88 | */ | 69 | */ |
diff --git a/include/asm-powerpc/iseries/hv_call.h b/include/asm-powerpc/iseries/hv_call.h index e9f831c9a5e5..162d653ad51f 100644 --- a/include/asm-powerpc/iseries/hv_call.h +++ b/include/asm-powerpc/iseries/hv_call.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvCall.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -15,8 +14,7 @@ | |||
15 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 17 | * |
19 | /* | ||
20 | * This file contains the "hypervisor call" interface which is used to | 18 | * This file contains the "hypervisor call" interface which is used to |
21 | * drive the hypervisor from the OS. | 19 | * drive the hypervisor from the OS. |
22 | */ | 20 | */ |
diff --git a/include/asm-powerpc/iseries/hv_call_event.h b/include/asm-powerpc/iseries/hv_call_event.h index 46763a30590a..4cec4762076d 100644 --- a/include/asm-powerpc/iseries/hv_call_event.h +++ b/include/asm-powerpc/iseries/hv_call_event.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallEvent.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -15,8 +14,7 @@ | |||
15 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 17 | * |
19 | /* | ||
20 | * This file contains the "hypervisor call" interface which is used to | 18 | * This file contains the "hypervisor call" interface which is used to |
21 | * drive the hypervisor from the OS. | 19 | * drive the hypervisor from the OS. |
22 | */ | 20 | */ |
@@ -33,32 +31,9 @@ typedef u8 HvLpEvent_Type; | |||
33 | typedef u8 HvLpEvent_AckInd; | 31 | typedef u8 HvLpEvent_AckInd; |
34 | typedef u8 HvLpEvent_AckType; | 32 | typedef u8 HvLpEvent_AckType; |
35 | 33 | ||
36 | struct HvCallEvent_PackedParms { | ||
37 | u8 xAckType:1; | ||
38 | u8 xAckInd:1; | ||
39 | u8 xRsvd:1; | ||
40 | u8 xTargetLp:5; | ||
41 | u8 xType; | ||
42 | u16 xSubtype; | ||
43 | HvLpInstanceId xSourceInstId; | ||
44 | HvLpInstanceId xTargetInstId; | ||
45 | }; | ||
46 | |||
47 | typedef u8 HvLpDma_Direction; | 34 | typedef u8 HvLpDma_Direction; |
48 | typedef u8 HvLpDma_AddressType; | 35 | typedef u8 HvLpDma_AddressType; |
49 | 36 | ||
50 | struct HvCallEvent_PackedDmaParms { | ||
51 | u8 xDirection:1; | ||
52 | u8 xLocalAddrType:1; | ||
53 | u8 xRemoteAddrType:1; | ||
54 | u8 xRsvd1:5; | ||
55 | HvLpIndex xRemoteLp; | ||
56 | u8 xType; | ||
57 | u8 xRsvd2; | ||
58 | HvLpInstanceId xLocalInstId; | ||
59 | HvLpInstanceId xRemoteInstId; | ||
60 | }; | ||
61 | |||
62 | typedef u64 HvLpEvent_Rc; | 37 | typedef u64 HvLpEvent_Rc; |
63 | typedef u64 HvLpDma_Rc; | 38 | typedef u64 HvLpDma_Rc; |
64 | 39 | ||
@@ -92,11 +67,8 @@ static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) | |||
92 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | 67 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, |
93 | char *eventStackAddr, u32 eventStackSize) | 68 | char *eventStackAddr, u32 eventStackSize) |
94 | { | 69 | { |
95 | u64 abs_addr; | 70 | HvCall3(HvCallEventSetLpEventStack, queueIndex, |
96 | 71 | virt_to_abs(eventStackAddr), eventStackSize); | |
97 | abs_addr = virt_to_abs(eventStackAddr); | ||
98 | HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, | ||
99 | eventStackSize); | ||
100 | } | 72 | } |
101 | 73 | ||
102 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | 74 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, |
@@ -108,14 +80,7 @@ static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | |||
108 | 80 | ||
109 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) | 81 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) |
110 | { | 82 | { |
111 | u64 abs_addr; | 83 | return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event)); |
112 | |||
113 | #ifdef DEBUG_SENDEVENT | ||
114 | printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", | ||
115 | (unsigned long)event); | ||
116 | #endif | ||
117 | abs_addr = virt_to_abs(event); | ||
118 | return HvCall1(HvCallEventSignalLpEvent, abs_addr); | ||
119 | } | 84 | } |
120 | 85 | ||
121 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | 86 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, |
@@ -127,17 +92,21 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | |||
127 | { | 92 | { |
128 | /* Pack the misc bits into a single Dword to pass to PLIC */ | 93 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
129 | union { | 94 | union { |
130 | struct HvCallEvent_PackedParms parms; | 95 | struct { |
96 | u8 ack_and_target; | ||
97 | u8 type; | ||
98 | u16 subtype; | ||
99 | HvLpInstanceId src_inst; | ||
100 | HvLpInstanceId target_inst; | ||
101 | } parms; | ||
131 | u64 dword; | 102 | u64 dword; |
132 | } packed; | 103 | } packed; |
133 | packed.parms.xAckType = ackType; | 104 | |
134 | packed.parms.xAckInd = ackInd; | 105 | packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp; |
135 | packed.parms.xRsvd = 0; | 106 | packed.parms.type = type; |
136 | packed.parms.xTargetLp = targetLp; | 107 | packed.parms.subtype = subtype; |
137 | packed.parms.xType = type; | 108 | packed.parms.src_inst = sourceInstanceId; |
138 | packed.parms.xSubtype = subtype; | 109 | packed.parms.target_inst = targetInstanceId; |
139 | packed.parms.xSourceInstId = sourceInstanceId; | ||
140 | packed.parms.xTargetInstId = targetInstanceId; | ||
141 | 110 | ||
142 | return HvCall7(HvCallEventSignalLpEventParms, packed.dword, | 111 | return HvCall7(HvCallEventSignalLpEventParms, packed.dword, |
143 | correlationToken, eventData1, eventData2, | 112 | correlationToken, eventData1, eventData2, |
@@ -146,18 +115,12 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | |||
146 | 115 | ||
147 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) | 116 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) |
148 | { | 117 | { |
149 | u64 abs_addr; | 118 | return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event)); |
150 | |||
151 | abs_addr = virt_to_abs(event); | ||
152 | return HvCall1(HvCallEventAckLpEvent, abs_addr); | ||
153 | } | 119 | } |
154 | 120 | ||
155 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) | 121 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) |
156 | { | 122 | { |
157 | u64 abs_addr; | 123 | return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event)); |
158 | |||
159 | abs_addr = virt_to_abs(event); | ||
160 | return HvCall1(HvCallEventCancelLpEvent, abs_addr); | ||
161 | } | 124 | } |
162 | 125 | ||
163 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( | 126 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( |
@@ -195,59 +158,34 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | |||
195 | { | 158 | { |
196 | /* Pack the misc bits into a single Dword to pass to PLIC */ | 159 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
197 | union { | 160 | union { |
198 | struct HvCallEvent_PackedDmaParms parms; | 161 | struct { |
162 | u8 flags; | ||
163 | HvLpIndex remote; | ||
164 | u8 type; | ||
165 | u8 reserved; | ||
166 | HvLpInstanceId local_inst; | ||
167 | HvLpInstanceId remote_inst; | ||
168 | } parms; | ||
199 | u64 dword; | 169 | u64 dword; |
200 | } packed; | 170 | } packed; |
201 | 171 | ||
202 | packed.parms.xDirection = direction; | 172 | packed.parms.flags = (direction << 7) | |
203 | packed.parms.xLocalAddrType = localAddressType; | 173 | (localAddressType << 6) | (remoteAddressType << 5); |
204 | packed.parms.xRemoteAddrType = remoteAddressType; | 174 | packed.parms.remote = remoteLp; |
205 | packed.parms.xRsvd1 = 0; | 175 | packed.parms.type = type; |
206 | packed.parms.xRemoteLp = remoteLp; | 176 | packed.parms.reserved = 0; |
207 | packed.parms.xType = type; | 177 | packed.parms.local_inst = localInstanceId; |
208 | packed.parms.xRsvd2 = 0; | 178 | packed.parms.remote_inst = remoteInstanceId; |
209 | packed.parms.xLocalInstId = localInstanceId; | ||
210 | packed.parms.xRemoteInstId = remoteInstanceId; | ||
211 | 179 | ||
212 | return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, | 180 | return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, |
213 | remoteBufList, transferLength); | 181 | remoteBufList, transferLength); |
214 | } | 182 | } |
215 | 183 | ||
216 | static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | ||
217 | HvLpIndex remoteLp, HvLpDma_Direction direction, | ||
218 | HvLpInstanceId localInstanceId, | ||
219 | HvLpInstanceId remoteInstanceId, | ||
220 | HvLpDma_AddressType localAddressType, | ||
221 | HvLpDma_AddressType remoteAddressType, | ||
222 | u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) | ||
223 | { | ||
224 | /* Pack the misc bits into a single Dword to pass to PLIC */ | ||
225 | union { | ||
226 | struct HvCallEvent_PackedDmaParms parms; | ||
227 | u64 dword; | ||
228 | } packed; | ||
229 | |||
230 | packed.parms.xDirection = direction; | ||
231 | packed.parms.xLocalAddrType = localAddressType; | ||
232 | packed.parms.xRemoteAddrType = remoteAddressType; | ||
233 | packed.parms.xRsvd1 = 0; | ||
234 | packed.parms.xRemoteLp = remoteLp; | ||
235 | packed.parms.xType = type; | ||
236 | packed.parms.xRsvd2 = 0; | ||
237 | packed.parms.xLocalInstId = localInstanceId; | ||
238 | packed.parms.xRemoteInstId = remoteInstanceId; | ||
239 | |||
240 | return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword, | ||
241 | localAddrOrTce, remoteAddrOrTce, transferLength); | ||
242 | } | ||
243 | |||
244 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, | 184 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, |
245 | u32 length, HvLpDma_Direction dir) | 185 | u32 length, HvLpDma_Direction dir) |
246 | { | 186 | { |
247 | u64 abs_addr; | 187 | return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote, |
248 | 188 | length, dir); | |
249 | abs_addr = virt_to_abs(local); | ||
250 | return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir); | ||
251 | } | 189 | } |
252 | 190 | ||
253 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */ | 191 | #endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */ |
diff --git a/include/asm-powerpc/iseries/hv_call_sc.h b/include/asm-powerpc/iseries/hv_call_sc.h index dec7e9d9ab78..f5d210959250 100644 --- a/include/asm-powerpc/iseries/hv_call_sc.h +++ b/include/asm-powerpc/iseries/hv_call_sc.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvCallSc.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h index bc00f036bca0..df8b20739719 100644 --- a/include/asm-powerpc/iseries/hv_lp_config.h +++ b/include/asm-powerpc/iseries/hv_lp_config.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvLpConfig.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/hv_lp_event.h b/include/asm-powerpc/iseries/hv_lp_event.h index 499ab1ad0185..4065a4de4935 100644 --- a/include/asm-powerpc/iseries/hv_lp_event.h +++ b/include/asm-powerpc/iseries/hv_lp_event.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvLpEvent.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -32,17 +31,8 @@ | |||
32 | * partitions through PLIC. | 31 | * partitions through PLIC. |
33 | */ | 32 | */ |
34 | 33 | ||
35 | struct HvEventFlags { | ||
36 | u8 xValid:1; /* Indicates a valid request x00-x00 */ | ||
37 | u8 xRsvd1:4; /* Reserved ... */ | ||
38 | u8 xAckType:1; /* Immediate or deferred ... */ | ||
39 | u8 xAckInd:1; /* Indicates if ACK required ... */ | ||
40 | u8 xFunction:1; /* Interrupt or Acknowledge ... */ | ||
41 | }; | ||
42 | |||
43 | |||
44 | struct HvLpEvent { | 34 | struct HvLpEvent { |
45 | struct HvEventFlags xFlags; /* Event flags x00-x00 */ | 35 | u8 flags; /* Event flags x00-x00 */ |
46 | u8 xType; /* Type of message x01-x01 */ | 36 | u8 xType; /* Type of message x01-x01 */ |
47 | u16 xSubtype; /* Subtype for event x02-x03 */ | 37 | u16 xSubtype; /* Subtype for event x02-x03 */ |
48 | u8 xSourceLp; /* Source LP x04-x04 */ | 38 | u8 xSourceLp; /* Source LP x04-x04 */ |
@@ -126,6 +116,11 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | |||
126 | #define HvLpEvent_AckType_ImmediateAck 0 | 116 | #define HvLpEvent_AckType_ImmediateAck 0 |
127 | #define HvLpEvent_AckType_DeferredAck 1 | 117 | #define HvLpEvent_AckType_DeferredAck 1 |
128 | 118 | ||
119 | #define HV_LP_EVENT_INT 0x01 | ||
120 | #define HV_LP_EVENT_DO_ACK 0x02 | ||
121 | #define HV_LP_EVENT_DEFERRED_ACK 0x04 | ||
122 | #define HV_LP_EVENT_VALID 0x80 | ||
123 | |||
129 | #define HvLpDma_Direction_LocalToRemote 0 | 124 | #define HvLpDma_Direction_LocalToRemote 0 |
130 | #define HvLpDma_Direction_RemoteToLocal 1 | 125 | #define HvLpDma_Direction_RemoteToLocal 1 |
131 | 126 | ||
@@ -139,4 +134,29 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex); | |||
139 | #define HvLpDma_Rc_InvalidAddress 4 | 134 | #define HvLpDma_Rc_InvalidAddress 4 |
140 | #define HvLpDma_Rc_InvalidLength 5 | 135 | #define HvLpDma_Rc_InvalidLength 5 |
141 | 136 | ||
137 | static inline int hvlpevent_is_valid(struct HvLpEvent *h) | ||
138 | { | ||
139 | return h->flags & HV_LP_EVENT_VALID; | ||
140 | } | ||
141 | |||
142 | static inline void hvlpevent_invalidate(struct HvLpEvent *h) | ||
143 | { | ||
144 | h->flags &= ~ HV_LP_EVENT_VALID; | ||
145 | } | ||
146 | |||
147 | static inline int hvlpevent_is_int(struct HvLpEvent *h) | ||
148 | { | ||
149 | return h->flags & HV_LP_EVENT_INT; | ||
150 | } | ||
151 | |||
152 | static inline int hvlpevent_is_ack(struct HvLpEvent *h) | ||
153 | { | ||
154 | return !hvlpevent_is_int(h); | ||
155 | } | ||
156 | |||
157 | static inline int hvlpevent_need_ack(struct HvLpEvent *h) | ||
158 | { | ||
159 | return h->flags & HV_LP_EVENT_DO_ACK; | ||
160 | } | ||
161 | |||
142 | #endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */ | 162 | #endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */ |
diff --git a/include/asm-powerpc/iseries/hv_types.h b/include/asm-powerpc/iseries/hv_types.h index c38f7e3d01dc..c3e6d2a1d1c3 100644 --- a/include/asm-powerpc/iseries/hv_types.h +++ b/include/asm-powerpc/iseries/hv_types.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * HvTypes.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h index 56b2113ff0f5..496aa852b617 100644 --- a/include/asm-powerpc/iseries/iseries_io.h +++ b/include/asm-powerpc/iseries/iseries_io.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #ifdef CONFIG_PPC_ISERIES | 6 | #ifdef CONFIG_PPC_ISERIES |
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | /* | 8 | /* |
9 | * File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. | 9 | * Created by Allan Trautman on Thu Dec 28 2000. |
10 | * | 10 | * |
11 | * Remaps the io.h for the iSeries Io | 11 | * Remaps the io.h for the iSeries Io |
12 | * Copyright (C) 2000 Allan H Trautman, IBM Corporation | 12 | * Copyright (C) 2000 Allan H Trautman, IBM Corporation |
@@ -32,6 +32,7 @@ | |||
32 | * End Change Activity | 32 | * End Change Activity |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #ifdef CONFIG_PCI | ||
35 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); | 36 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); |
36 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); | 37 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); |
37 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); | 38 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); |
@@ -44,6 +45,17 @@ extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, | |||
44 | size_t n); | 45 | size_t n); |
45 | extern void iSeries_memcpy_fromio(void *dest, | 46 | extern void iSeries_memcpy_fromio(void *dest, |
46 | const volatile void __iomem *source, size_t n); | 47 | const volatile void __iomem *source, size_t n); |
48 | #else | ||
49 | static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | ||
50 | { | ||
51 | return 0xff; | ||
52 | } | ||
53 | |||
54 | static inline void iSeries_Write_Byte(u8 IoData, | ||
55 | volatile void __iomem *IoAddress) | ||
56 | { | ||
57 | } | ||
58 | #endif /* CONFIG_PCI */ | ||
47 | 59 | ||
48 | #endif /* CONFIG_PPC_ISERIES */ | 60 | #endif /* CONFIG_PPC_ISERIES */ |
49 | #endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ | 61 | #endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ |
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h index 66a17a230c52..304a609ae21a 100644 --- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h +++ b/include/asm-powerpc/iseries/it_exp_vpd_panel.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * ItExtVpdPanel.h | ||
3 | * Copyright (C) 2002 Dave Boutcher IBM Corporation | 2 | * Copyright (C) 2002 Dave Boutcher IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h index c3ef1de45d82..4fdcf052927f 100644 --- a/include/asm-powerpc/iseries/it_lp_naca.h +++ b/include/asm-powerpc/iseries/it_lp_naca.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpNaca.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -37,17 +36,13 @@ struct ItLpNaca { | |||
37 | u8 xLpIndex; // LP Index x0B-x0B | 36 | u8 xLpIndex; // LP Index x0B-x0B |
38 | u16 xMaxLpQueues; // Number of allocated queues x0C-x0D | 37 | u16 xMaxLpQueues; // Number of allocated queues x0C-x0D |
39 | u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F | 38 | u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F |
40 | u8 xPirEnvironMode:8; // Piranha or hardware x10-x10 | 39 | u8 xPirEnvironMode; // Piranha or hardware x10-x10 |
41 | u8 xPirConsoleMode:8; // Piranha console indicator x11-x11 | 40 | u8 xPirConsoleMode; // Piranha console indicator x11-x11 |
42 | u8 xPirDasdMode:8; // Piranha dasd indicator x12-x12 | 41 | u8 xPirDasdMode; // Piranha dasd indicator x12-x12 |
43 | u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 | 42 | u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 |
44 | u8 xLparInstalled:1; // Is LPAR installed on system x18-x1F | 43 | u8 flags; // flags, see below x18-x1F |
45 | u8 xSysPartitioned:1; // Is the system partitioned ... | 44 | u8 xSpVpdFormat; // VPD areas are in CSP format ... |
46 | u8 xHwSyncedTBs:1; // Hardware synced TBs ... | 45 | u8 xIntProcRatio; // Ratio of int procs to procs ... |
47 | u8 xIntProcUtilHmt:1; // Utilize HMT for interrupts ... | ||
48 | u8 xRsvd1_1:4; // Reserved ... | ||
49 | u8 xSpVpdFormat:8; // VPD areas are in CSP format ... | ||
50 | u8 xIntProcRatio:8; // Ratio of int procs to procs ... | ||
51 | u8 xRsvd1_2[5]; // Reserved ... | 46 | u8 xRsvd1_2[5]; // Reserved ... |
52 | u16 xRsvd1_3; // Reserved x20-x21 | 47 | u16 xRsvd1_3; // Reserved x20-x21 |
53 | u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 | 48 | u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 |
@@ -77,4 +72,9 @@ struct ItLpNaca { | |||
77 | 72 | ||
78 | extern struct ItLpNaca itLpNaca; | 73 | extern struct ItLpNaca itLpNaca; |
79 | 74 | ||
75 | #define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */ | ||
76 | #define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */ | ||
77 | #define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */ | ||
78 | #define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */ | ||
79 | |||
80 | #endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ | 80 | #endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ |
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h index a60d03afbf95..b7c6fc12cce2 100644 --- a/include/asm-powerpc/iseries/it_lp_queue.h +++ b/include/asm-powerpc/iseries/it_lp_queue.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpQueue.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/it_lp_reg_save.h b/include/asm-powerpc/iseries/it_lp_reg_save.h index 81824e1bb767..5403b756f654 100644 --- a/include/asm-powerpc/iseries/it_lp_reg_save.h +++ b/include/asm-powerpc/iseries/it_lp_reg_save.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpRegSave.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -83,4 +82,4 @@ struct ItLpRegSave { | |||
83 | 82 | ||
84 | extern struct ItLpRegSave iseries_reg_save[]; | 83 | extern struct ItLpRegSave iseries_reg_save[]; |
85 | 84 | ||
86 | #endif /* _ITLPREGSAVE_H */ | 85 | #endif /* _ASM_POWERPC_ISERIES_IT_LP_REG_SAVE_H */ |
diff --git a/include/asm-powerpc/iseries/lpar_map.h b/include/asm-powerpc/iseries/lpar_map.h index 84fc321615bf..2ec384d66abb 100644 --- a/include/asm-powerpc/iseries/lpar_map.h +++ b/include/asm-powerpc/iseries/lpar_map.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * LparMap.h | ||
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h index e7bd57a03fb1..857e5202fc78 100644 --- a/include/asm-powerpc/iseries/mf.h +++ b/include/asm-powerpc/iseries/mf.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * mf.h | ||
3 | * Copyright (C) 2001 Troy D. Armstrong IBM Corporation | 2 | * Copyright (C) 2001 Troy D. Armstrong IBM Corporation |
4 | * Copyright (C) 2004 Stephen Rothwell IBM Corporation | 3 | * Copyright (C) 2004 Stephen Rothwell IBM Corporation |
5 | * | 4 | * |
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h index 7e3a469420dd..72a97d37aac3 100644 --- a/include/asm-powerpc/iseries/vio.h +++ b/include/asm-powerpc/iseries/vio.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* -*- linux-c -*- | 1 | /* -*- linux-c -*- |
2 | * drivers/char/vio.h | ||
3 | * | 2 | * |
4 | * iSeries Virtual I/O Message Path header | 3 | * iSeries Virtual I/O Message Path header |
5 | * | 4 | * |
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index b0d816fe2e27..38de92d41a14 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h | |||
@@ -142,8 +142,6 @@ void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus); | |||
142 | 142 | ||
143 | extern int pcibios_remove_root_bus(struct pci_controller *phb); | 143 | extern int pcibios_remove_root_bus(struct pci_controller *phb); |
144 | 144 | ||
145 | extern void phbs_remap_io(void); | ||
146 | |||
147 | static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) | 145 | static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) |
148 | { | 146 | { |
149 | struct device_node *busdn = bus->sysdata; | 147 | struct device_node *busdn = bus->sysdata; |
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 1be629b4fb97..9b822afa7d0e 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -133,6 +133,14 @@ extern int fix_alignment(struct pt_regs *); | |||
133 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); | 133 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); |
134 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); | 134 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); |
135 | 135 | ||
136 | #ifndef CONFIG_SMP | ||
137 | extern void discard_lazy_cpu_state(void); | ||
138 | #else | ||
139 | static inline void discard_lazy_cpu_state(void) | ||
140 | { | ||
141 | } | ||
142 | #endif | ||
143 | |||
136 | #ifdef CONFIG_ALTIVEC | 144 | #ifdef CONFIG_ALTIVEC |
137 | extern void flush_altivec_to_thread(struct task_struct *); | 145 | extern void flush_altivec_to_thread(struct task_struct *); |
138 | #else | 146 | #else |
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 212dca66fcac..fb49c0c49ea1 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #ifndef __PPC_SYSTEM_H | 4 | #ifndef __PPC_SYSTEM_H |
5 | #define __PPC_SYSTEM_H | 5 | #define __PPC_SYSTEM_H |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
9 | 8 | ||
10 | #include <asm/atomic.h> | 9 | #include <asm/atomic.h> |
@@ -39,7 +38,7 @@ | |||
39 | #ifdef CONFIG_SMP | 38 | #ifdef CONFIG_SMP |
40 | #define smp_mb() mb() | 39 | #define smp_mb() mb() |
41 | #define smp_rmb() rmb() | 40 | #define smp_rmb() rmb() |
42 | #define smp_wmb() wmb() | 41 | #define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory") |
43 | #define smp_read_barrier_depends() read_barrier_depends() | 42 | #define smp_read_barrier_depends() read_barrier_depends() |
44 | #else | 43 | #else |
45 | #define smp_mb() barrier() | 44 | #define smp_mb() barrier() |
@@ -74,6 +73,7 @@ extern void chrp_nvram_init(void); | |||
74 | extern void read_rtc_time(void); | 73 | extern void read_rtc_time(void); |
75 | extern void pmac_find_display(void); | 74 | extern void pmac_find_display(void); |
76 | extern void giveup_fpu(struct task_struct *); | 75 | extern void giveup_fpu(struct task_struct *); |
76 | extern void disable_kernel_fp(void); | ||
77 | extern void enable_kernel_fp(void); | 77 | extern void enable_kernel_fp(void); |
78 | extern void flush_fp_to_thread(struct task_struct *); | 78 | extern void flush_fp_to_thread(struct task_struct *); |
79 | extern void enable_kernel_altivec(void); | 79 | extern void enable_kernel_altivec(void); |
@@ -86,6 +86,14 @@ extern int fix_alignment(struct pt_regs *); | |||
86 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); | 86 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); |
87 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); | 87 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); |
88 | 88 | ||
89 | #ifndef CONFIG_SMP | ||
90 | extern void discard_lazy_cpu_state(void); | ||
91 | #else | ||
92 | static inline void discard_lazy_cpu_state(void) | ||
93 | { | ||
94 | } | ||
95 | #endif | ||
96 | |||
89 | #ifdef CONFIG_ALTIVEC | 97 | #ifdef CONFIG_ALTIVEC |
90 | extern void flush_altivec_to_thread(struct task_struct *); | 98 | extern void flush_altivec_to_thread(struct task_struct *); |
91 | #else | 99 | #else |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index cf5cfdf8d613..089bfb1fa01a 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -49,8 +49,6 @@ struct hrtimer_base; | |||
49 | * struct hrtimer - the basic hrtimer structure | 49 | * struct hrtimer - the basic hrtimer structure |
50 | * | 50 | * |
51 | * @node: red black tree node for time ordered insertion | 51 | * @node: red black tree node for time ordered insertion |
52 | * @list: list head for easier access to the time ordered list, | ||
53 | * without walking the red black tree. | ||
54 | * @expires: the absolute expiry time in the hrtimers internal | 52 | * @expires: the absolute expiry time in the hrtimers internal |
55 | * representation. The time is related to the clock on | 53 | * representation. The time is related to the clock on |
56 | * which the timer is based. | 54 | * which the timer is based. |
@@ -63,7 +61,6 @@ struct hrtimer_base; | |||
63 | */ | 61 | */ |
64 | struct hrtimer { | 62 | struct hrtimer { |
65 | struct rb_node node; | 63 | struct rb_node node; |
66 | struct list_head list; | ||
67 | ktime_t expires; | 64 | ktime_t expires; |
68 | enum hrtimer_state state; | 65 | enum hrtimer_state state; |
69 | int (*function)(void *); | 66 | int (*function)(void *); |
@@ -78,7 +75,7 @@ struct hrtimer { | |||
78 | * to a base on another cpu. | 75 | * to a base on another cpu. |
79 | * @lock: lock protecting the base and associated timers | 76 | * @lock: lock protecting the base and associated timers |
80 | * @active: red black tree root node for the active timers | 77 | * @active: red black tree root node for the active timers |
81 | * @pending: list of pending timers for simple time ordered access | 78 | * @first: pointer to the timer node which expires first |
82 | * @resolution: the resolution of the clock, in nanoseconds | 79 | * @resolution: the resolution of the clock, in nanoseconds |
83 | * @get_time: function to retrieve the current time of the clock | 80 | * @get_time: function to retrieve the current time of the clock |
84 | * @curr_timer: the timer which is executing a callback right now | 81 | * @curr_timer: the timer which is executing a callback right now |
@@ -87,8 +84,8 @@ struct hrtimer_base { | |||
87 | clockid_t index; | 84 | clockid_t index; |
88 | spinlock_t lock; | 85 | spinlock_t lock; |
89 | struct rb_root active; | 86 | struct rb_root active; |
90 | struct list_head pending; | 87 | struct rb_node *first; |
91 | unsigned long resolution; | 88 | ktime_t resolution; |
92 | ktime_t (*get_time)(void); | 89 | ktime_t (*get_time)(void); |
93 | struct hrtimer *curr_timer; | 90 | struct hrtimer *curr_timer; |
94 | }; | 91 | }; |
@@ -125,8 +122,7 @@ static inline int hrtimer_active(const struct hrtimer *timer) | |||
125 | } | 122 | } |
126 | 123 | ||
127 | /* Forward a hrtimer so it expires after now: */ | 124 | /* Forward a hrtimer so it expires after now: */ |
128 | extern unsigned long hrtimer_forward(struct hrtimer *timer, | 125 | extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); |
129 | const ktime_t interval); | ||
130 | 126 | ||
131 | /* Precise sleep: */ | 127 | /* Precise sleep: */ |
132 | extern long hrtimer_nanosleep(struct timespec *rqtp, | 128 | extern long hrtimer_nanosleep(struct timespec *rqtp, |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9a8c05dbe4f3..f2e1b5b22898 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1002,7 +1002,6 @@ extern int noautodma; | |||
1002 | 1002 | ||
1003 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 1003 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); |
1004 | extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); | 1004 | extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); |
1005 | extern void ide_softirq_done(struct request *rq); | ||
1006 | 1005 | ||
1007 | /* | 1006 | /* |
1008 | * This is used on exit from the driver to designate the next irq handler | 1007 | * This is used on exit from the driver to designate the next irq handler |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 222a047cc145..1bd6552cc341 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -272,8 +272,8 @@ static inline u64 ktime_to_ns(const ktime_t kt) | |||
272 | * idea of the (in)accuracy of timers. Timer values are rounded up to | 272 | * idea of the (in)accuracy of timers. Timer values are rounded up to |
273 | * this resolution values. | 273 | * this resolution values. |
274 | */ | 274 | */ |
275 | #define KTIME_REALTIME_RES (NSEC_PER_SEC/HZ) | 275 | #define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC } |
276 | #define KTIME_MONOTONIC_RES (NSEC_PER_SEC/HZ) | 276 | #define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC } |
277 | 277 | ||
278 | /* Get the monotonic time in timespec format: */ | 278 | /* Get the monotonic time in timespec format: */ |
279 | extern void ktime_get_ts(struct timespec *ts); | 279 | extern void ktime_get_ts(struct timespec *ts); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index e3710d7e260a..a8187c3c8a7b 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -67,6 +67,9 @@ | |||
67 | /* Parisc type numbers. */ | 67 | /* Parisc type numbers. */ |
68 | #define PORT_MUX 48 | 68 | #define PORT_MUX 48 |
69 | 69 | ||
70 | /* Atmel AT91RM9200 SoC */ | ||
71 | #define PORT_AT91RM9200 49 | ||
72 | |||
70 | /* Macintosh Zilog type numbers */ | 73 | /* Macintosh Zilog type numbers */ |
71 | #define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ | 74 | #define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ |
72 | #define PORT_PMAC_ZILOG 51 | 75 | #define PORT_PMAC_ZILOG 51 |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index f073a2461faa..04ccab099e84 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -275,7 +275,7 @@ void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) | |||
275 | * The number of overruns is added to the overrun field. | 275 | * The number of overruns is added to the overrun field. |
276 | */ | 276 | */ |
277 | unsigned long | 277 | unsigned long |
278 | hrtimer_forward(struct hrtimer *timer, const ktime_t interval) | 278 | hrtimer_forward(struct hrtimer *timer, ktime_t interval) |
279 | { | 279 | { |
280 | unsigned long orun = 1; | 280 | unsigned long orun = 1; |
281 | ktime_t delta, now; | 281 | ktime_t delta, now; |
@@ -287,6 +287,9 @@ hrtimer_forward(struct hrtimer *timer, const ktime_t interval) | |||
287 | if (delta.tv64 < 0) | 287 | if (delta.tv64 < 0) |
288 | return 0; | 288 | return 0; |
289 | 289 | ||
290 | if (interval.tv64 < timer->base->resolution.tv64) | ||
291 | interval.tv64 = timer->base->resolution.tv64; | ||
292 | |||
290 | if (unlikely(delta.tv64 >= interval.tv64)) { | 293 | if (unlikely(delta.tv64 >= interval.tv64)) { |
291 | nsec_t incr = ktime_to_ns(interval); | 294 | nsec_t incr = ktime_to_ns(interval); |
292 | 295 | ||
@@ -314,7 +317,6 @@ hrtimer_forward(struct hrtimer *timer, const ktime_t interval) | |||
314 | static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | 317 | static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) |
315 | { | 318 | { |
316 | struct rb_node **link = &base->active.rb_node; | 319 | struct rb_node **link = &base->active.rb_node; |
317 | struct list_head *prev = &base->pending; | ||
318 | struct rb_node *parent = NULL; | 320 | struct rb_node *parent = NULL; |
319 | struct hrtimer *entry; | 321 | struct hrtimer *entry; |
320 | 322 | ||
@@ -330,22 +332,23 @@ static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | |||
330 | */ | 332 | */ |
331 | if (timer->expires.tv64 < entry->expires.tv64) | 333 | if (timer->expires.tv64 < entry->expires.tv64) |
332 | link = &(*link)->rb_left; | 334 | link = &(*link)->rb_left; |
333 | else { | 335 | else |
334 | link = &(*link)->rb_right; | 336 | link = &(*link)->rb_right; |
335 | prev = &entry->list; | ||
336 | } | ||
337 | } | 337 | } |
338 | 338 | ||
339 | /* | 339 | /* |
340 | * Insert the timer to the rbtree and to the sorted list: | 340 | * Insert the timer to the rbtree and check whether it |
341 | * replaces the first pending timer | ||
341 | */ | 342 | */ |
342 | rb_link_node(&timer->node, parent, link); | 343 | rb_link_node(&timer->node, parent, link); |
343 | rb_insert_color(&timer->node, &base->active); | 344 | rb_insert_color(&timer->node, &base->active); |
344 | list_add(&timer->list, prev); | ||
345 | 345 | ||
346 | timer->state = HRTIMER_PENDING; | 346 | timer->state = HRTIMER_PENDING; |
347 | } | ||
348 | 347 | ||
348 | if (!base->first || timer->expires.tv64 < | ||
349 | rb_entry(base->first, struct hrtimer, node)->expires.tv64) | ||
350 | base->first = &timer->node; | ||
351 | } | ||
349 | 352 | ||
350 | /* | 353 | /* |
351 | * __remove_hrtimer - internal function to remove a timer | 354 | * __remove_hrtimer - internal function to remove a timer |
@@ -355,9 +358,11 @@ static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | |||
355 | static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | 358 | static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) |
356 | { | 359 | { |
357 | /* | 360 | /* |
358 | * Remove the timer from the sorted list and from the rbtree: | 361 | * Remove the timer from the rbtree and replace the |
362 | * first entry pointer if necessary. | ||
359 | */ | 363 | */ |
360 | list_del(&timer->list); | 364 | if (base->first == &timer->node) |
365 | base->first = rb_next(&timer->node); | ||
361 | rb_erase(&timer->node, &base->active); | 366 | rb_erase(&timer->node, &base->active); |
362 | } | 367 | } |
363 | 368 | ||
@@ -516,9 +521,8 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
516 | { | 521 | { |
517 | struct hrtimer_base *bases; | 522 | struct hrtimer_base *bases; |
518 | 523 | ||
519 | tp->tv_sec = 0; | ||
520 | bases = per_cpu(hrtimer_bases, raw_smp_processor_id()); | 524 | bases = per_cpu(hrtimer_bases, raw_smp_processor_id()); |
521 | tp->tv_nsec = bases[which_clock].resolution; | 525 | *tp = ktime_to_timespec(bases[which_clock].resolution); |
522 | 526 | ||
523 | return 0; | 527 | return 0; |
524 | } | 528 | } |
@@ -529,16 +533,17 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
529 | static inline void run_hrtimer_queue(struct hrtimer_base *base) | 533 | static inline void run_hrtimer_queue(struct hrtimer_base *base) |
530 | { | 534 | { |
531 | ktime_t now = base->get_time(); | 535 | ktime_t now = base->get_time(); |
536 | struct rb_node *node; | ||
532 | 537 | ||
533 | spin_lock_irq(&base->lock); | 538 | spin_lock_irq(&base->lock); |
534 | 539 | ||
535 | while (!list_empty(&base->pending)) { | 540 | while ((node = base->first)) { |
536 | struct hrtimer *timer; | 541 | struct hrtimer *timer; |
537 | int (*fn)(void *); | 542 | int (*fn)(void *); |
538 | int restart; | 543 | int restart; |
539 | void *data; | 544 | void *data; |
540 | 545 | ||
541 | timer = list_entry(base->pending.next, struct hrtimer, list); | 546 | timer = rb_entry(node, struct hrtimer, node); |
542 | if (now.tv64 <= timer->expires.tv64) | 547 | if (now.tv64 <= timer->expires.tv64) |
543 | break; | 548 | break; |
544 | 549 | ||
@@ -732,7 +737,6 @@ static void __devinit init_hrtimers_cpu(int cpu) | |||
732 | 737 | ||
733 | for (i = 0; i < MAX_HRTIMER_BASES; i++) { | 738 | for (i = 0; i < MAX_HRTIMER_BASES; i++) { |
734 | spin_lock_init(&base->lock); | 739 | spin_lock_init(&base->lock); |
735 | INIT_LIST_HEAD(&base->pending); | ||
736 | base++; | 740 | base++; |
737 | } | 741 | } |
738 | } | 742 | } |