]> git.pld-linux.org Git - packages/kernel.git/blame - patch-2.6.0-test4-bk3
- fixed for PLD
[packages/kernel.git] / patch-2.6.0-test4-bk3
CommitLineData
179f8ebf
AM
1diff -Nru a/CREDITS b/CREDITS
2--- a/CREDITS Wed Aug 20 04:45:18 2003
3+++ b/CREDITS Sun Aug 31 16:14:38 2003
4@@ -1279,14 +1279,13 @@
5
6 N: Christoph Hellwig
7 E: hch@infradead.org
8-E: hch@sgi.com
9 D: all kinds of driver, filesystem & core kernel hacking
10 D: freevxfs driver
11 D: sysvfs maintainer
12 D: chief codingstyle nitpicker
13-S: Auweg 38
14-S: 85748 Garching
15-S: Germany
16+S: Ampferstr. 50 / 4
17+S: 6020 Innsbruck
18+S: Austria
19
20 N: Richard Henderson
21 E: rth@twiddle.net
22diff -Nru a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
23--- a/Documentation/DocBook/kernel-locking.tmpl Thu Dec 5 18:56:55 2002
24+++ b/Documentation/DocBook/kernel-locking.tmpl Sun Aug 31 16:14:01 2003
25@@ -463,7 +463,7 @@
26 <function>spin_lock_irqsave()</function>
27 (<filename>include/linux/spinlock.h</filename>) is a variant
28 which saves whether interrupts were on or off in a flags word,
29- which is passed to <function>spin_lock_irqrestore()</function>. This
30+ which is passed to <function>spin_unlock_irqrestore()</function>. This
31 means that the same code can be used inside an hard irq handler (where
32 interrupts are already off) and in softirqs (where the irq
33 disabling is required).
34diff -Nru a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
35--- a/Documentation/filesystems/proc.txt Sun Jun 1 14:12:47 2003
36+++ b/Documentation/filesystems/proc.txt Sun Aug 31 16:15:48 2003
37@@ -25,6 +25,7 @@
38 1.5 SCSI info
39 1.6 Parallel port info in /proc/parport
40 1.7 TTY info in /proc/tty
41+ 1.8 Miscellaneous kernel statistics in /proc/stat
42
43 2 Modifying System Parameters
44 2.1 /proc/sys/fs - File system data
45@@ -702,6 +703,58 @@
46 /dev/console /dev/console 5 1 system:console
47 /dev/tty /dev/tty 5 0 system:/dev/tty
48 unknown /dev/tty 4 1-63 console
49+
50+
51+1.8 Miscellaneous kernel statistics in /proc/stat
52+-------------------------------------------------
53+
54+Various pieces of information about kernel activity are available in the
55+/proc/stat file. All of the numbers reported in this file are aggregates
56+since the system first booted. For a quick look, simply cat the file:
57+
58+ > cat /proc/stat
59+ cpu 2255 34 2290 22625563 6290 127 456
60+ cpu0 1132 34 1441 11311718 3675 127 438
61+ cpu1 1123 0 849 11313845 2614 0 18
62+ intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
63+ ctxt 1990473
64+ btime 1062191376
65+ processes 2915
66+ procs_running 1
67+ procs_blocked 0
68+
69+The very first "cpu" line aggregates the numbers in all of the other "cpuN"
70+lines. These numbers identify the amount of time the CPU has spent performing
71+different kinds of work. Time units are in USER_HZ (typically hundredths of a
72+second). The meanings of the columns are as follows, from left to right:
73+
74+- user: normal processes executing in user mode
75+- nice: niced processes executing in user mode
76+- system: processes executing in kernel mode
77+- idle: twiddling thumbs
78+- iowait: waiting for I/O to complete
79+- irq: servicing interrupts
80+- softirq: servicing softirqs
81+
82+The "intr" line gives counts of interrupts serviced since boot time, for each
83+of the possible system interrupts. The first column is the total of all
84+interrupts serviced; each subsequent column is the total for that particular
85+interrupt.
86+
87+The "ctxt" line gives the total number of context switches across all CPUs.
88+
89+The "btime" line gives the time at which the system booted, in seconds since
90+the Unix epoch.
91+
92+The "processes" line gives the number of processes and threads created, which
93+includes (but is not limited to) those created by calls to the fork() and
94+clone() system calls.
95+
96+The "procs_running" line gives the number of processes currently running on
97+CPUs.
98+
99+The "procs_blocked" line gives the number of processes currently blocked,
100+waiting for I/O to complete.
101
102
103 ------------------------------------------------------------------------------
104diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt
105--- a/Documentation/ide.txt Mon May 26 17:48:43 2003
106+++ b/Documentation/ide.txt Sun Aug 31 16:13:57 2003
107@@ -1,5 +1,5 @@
108
109- Information regarding the Enhanced IDE drive in Linux 2.5
110+ Information regarding the Enhanced IDE drive in Linux 2.6
111
112 ==============================================================================
113
114@@ -242,8 +242,23 @@
115 and quite likely to cause trouble with
116 older/odd IDE drives.
117
118+ "hdx=biostimings" : driver will NOT attempt to tune interface speed
119+ (DMA/PIO) but always honour BIOS timings.
120+
121 "hdx=slow" : insert a huge pause after each access to the data
122 port. Should be used only as a last resort.
123+
124+ "hdx=swapdata" : when the drive is a disk, byte swap all data
125+
126+ "hdx=bswap" : same as above..........
127+
128+ "hdx=flash" : allows for more than one ata_flash disk to be
129+ registered. In most cases, only one device
130+ will be present.
131+
132+ "hdx=scsi" : the return of the ide-scsi flag, this is useful for
133+ allowing ide-floppy, ide-tape, and ide-cdrom|writers
134+ to use ide-scsi emulation on a device specific option.
135
136 "hdxlun=xx" : set the drive last logical unit
137
138@@ -277,27 +292,41 @@
139 "idex=noautotune" : driver will NOT attempt to tune interface speed
140 This is the default for most chipsets,
141 except the cmd640.
142+
143+ "idex=biostimings" : driver will NOT attempt to tune interface speed
144+ (DMA/PIO) but always honour BIOS timings.
145
146 "idex=serialize" : do not overlap operations on idex. Please note
147 that you will have to specify this option for
148 both the respecitve primary and secondary channel
149 to take effect.
150+
151+ "idex=four" : four drives on idex and ide(x^1) share same ports
152
153 "idex=reset" : reset interface after probe
154
155 "idex=dma" : automatically configure/use DMA if possible.
156
157-The following are valid ONLY on ide0, which usually corresponds to the first
158-ATA interface found on the particular host, and the defaults for the base,ctl
159-ports must not be altered.
160+ "idex=ata66" : informs the interface that it has an 80c cable
161+ for chipsets that are ATA-66 capable, but the
162+ ability to bit test for detection is currently
163+ unknown.
164+
165+ "ide=reverse" : formerly called to pci sub-system, but now local.
166+
167+The following are valid ONLY on ide0 (except dc4030), which usually corresponds
168+to the first ATA interface found on the particular host, and the defaults for
169+the base,ctl ports must not be altered.
170
171 "ide0=dtc2278" : probe/support DTC2278 interface
172 "ide0=ht6560b" : probe/support HT6560B interface
173 "ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip
174 (not for PCI -- automatically detected)
175 "ide0=qd65xx" : probe/support qd65xx interface
176- "ide0=ali14xx" : probe/support ali14xx chipsets (ALI M1439/M1445)
177+ "ide0=ali14xx" : probe/support ali14xx chipsets (ALI M1439/M1443/M1445)
178 "ide0=umc8672" : probe/support umc8672 chipsets
179+ "idex=dc4030" : probe/support Promise DC4030VL interface
180+ "ide=doubler" : probe/support IDE doublers on Amiga
181
182 There may be more options than shown -- use the source, Luke!
183
184@@ -375,3 +404,6 @@
185
186 Wed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki, the current
187 maintainer.
188+
189+Wed Aug 20 22:31:29 CEST 2003 updated ide boot uptions to current ide.c
190+comments at 2.6.0-test4 time. Maciej Soltysiak <solt@dns.toxicfilms.tv>
191diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
192--- a/Documentation/kernel-parameters.txt Mon Aug 18 22:27:07 2003
193+++ b/Documentation/kernel-parameters.txt Sun Aug 31 16:14:50 2003
194@@ -215,7 +215,10 @@
195 when calculating gettimeofday(). If specicified timesource
196 is not avalible, it defaults to PIT.
197 Format: { pit | tsc | cyclone | ... }
198-
199+
200+ hpet= [IA-32,HPET] option to disable HPET and use PIT.
201+ Format: disable
202+
203 cm206= [HW,CD]
204 Format: { auto | [<io>,][<irq>] }
205
206diff -Nru a/Documentation/kobject.txt b/Documentation/kobject.txt
207--- a/Documentation/kobject.txt Tue Jun 17 15:59:07 2003
208+++ b/Documentation/kobject.txt Sun Aug 31 16:14:13 2003
209@@ -245,7 +245,9 @@
210 see the sysfs documentation for more information.
211
212 - default_attrs: Default attributes to be exported via sysfs when the
213- object is registered.
214+ object is registered.Note that the last attribute has to be
215+ initialized to NULL ! You can find a complete implementation
216+ in drivers/block/genhd.c
217
218
219 Instances of struct kobj_type are not registered; only referenced by
220diff -Nru a/Documentation/sonypi.txt b/Documentation/sonypi.txt
221--- a/Documentation/sonypi.txt Tue Mar 11 10:20:18 2003
222+++ b/Documentation/sonypi.txt Tue Aug 26 09:02:05 2003
223@@ -8,7 +8,9 @@
224 Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
225
226 This driver enables access to the Sony Programmable I/O Control Device which
227-can be found in many (all ?) Sony Vaio laptops.
228+can be found in many Sony Vaio laptops. Some newer Sony laptops (seems to be
229+limited to new FX series laptops, at least the FX501 and the FX702) lack a
230+sonypi device and are not supported at all by this driver.
231
232 It will give access (through a user space utility) to some events those laptops
233 generate, like:
234@@ -96,6 +98,7 @@
235 SONYPI_THUMBPHRASE_MASK 0x0200
236 SONYPI_MEYE_MASK 0x0400
237 SONYPI_MEMORYSTICK_MASK 0x0800
238+ SONYPI_BATTERY_MASK 0x1000
239
240 useinput: if set (which is the default) jogdial events are
241 forwarded to the input subsystem as mouse wheel
242diff -Nru a/Documentation/sysctl/README b/Documentation/sysctl/README
243--- a/Documentation/sysctl/README Tue Feb 5 09:40:37 2002
244+++ b/Documentation/sysctl/README Sun Aug 31 16:14:14 2003
245@@ -55,6 +55,7 @@
246 by piece basis, or just some 'thematic frobbing'.
247
248 The subdirs are about:
249+abi/ execution domains & personalities
250 debug/ <empty>
251 dev/ device specific information (eg dev/cdrom/info)
252 fs/ specific filesystems
253diff -Nru a/Documentation/sysctl/abi.txt b/Documentation/sysctl/abi.txt
254--- /dev/null Wed Dec 31 16:00:00 1969
255+++ b/Documentation/sysctl/abi.txt Sun Aug 31 16:14:14 2003
256@@ -0,0 +1,54 @@
257+Documentation for /proc/sys/abi/* kernel version 2.6.0.test2
258+ (c) 2003, Fabian Frederick <ffrederick@users.sourceforge.net>
259+
260+For general info : README.
261+
262+==============================================================
263+
264+This path is binary emulation relevant aka personality types aka abi.
265+When a process is executed, it's linked to an exec_domain whose
266+personality is defined using values available from /proc/sys/abi.
267+You can find further details about abi in include/linux/personality.h.
268+
269+Here are the files featuring in 2.6 kernel :
270+
271+- defhandler_coff
272+- defhandler_elf
273+- defhandler_lcall7
274+- defhandler_libcso
275+- fake_utsname
276+- trace
277+
278+===========================================================
279+defhandler_coff:
280+defined value :
281+PER_SCOSVR3
282+0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE
283+
284+===========================================================
285+defhandler_elf:
286+defined value :
287+PER_LINUX
288+0
289+
290+===========================================================
291+defhandler_lcall7:
292+defined value :
293+PER_SVR4
294+0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
295+
296+===========================================================
297+defhandler_libsco:
298+defined value:
299+PER_SVR4
300+0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
301+
302+===========================================================
303+fake_utsname:
304+Unused
305+
306+===========================================================
307+trace:
308+Unused
309+
310+===========================================================
311diff -Nru a/Documentation/video4linux/meye.txt b/Documentation/video4linux/meye.txt
312--- a/Documentation/video4linux/meye.txt Tue Feb 18 03:32:29 2003
313+++ b/Documentation/video4linux/meye.txt Fri Aug 1 05:47:51 2003
314@@ -16,6 +16,23 @@
315
316 MJPEG hardware grabbing is supported via a private API (see below).
317
318+Hardware supported:
319+-------------------
320+
321+This driver supports the 'second' version of the MotionEye camera :)
322+
323+The first version was connected directly on the video bus of the Neomagic
324+video card and is unsupported.
325+
326+The second one, made by Kawasaki Steel is fully supported by this
327+driver (PCI vendor/device is 0x136b/0xff01)
328+
329+The third one, present in recent (more or less last year) Picturebooks
330+(C1M* models), is not supported. The manufacturer has given the specs
331+to the developers under a NDA (which allows the develoment of a GPL
332+driver however), but things are not moving very fast (see
333+http://r-engine.sourceforge.net/) (PCI vendor/device is 0x10cf/0x2011).
334+
335 Driver options:
336 ---------------
337
338diff -Nru a/MAINTAINERS b/MAINTAINERS
339--- a/MAINTAINERS Thu Aug 21 09:09:26 2003
340+++ b/MAINTAINERS Sun Aug 31 16:13:57 2003
341@@ -615,8 +615,6 @@
342 S: Maintained
343
344 DRM DRIVERS
345-P: Rik Faith
346-M: faith@redhat.com
347 L: dri-devel@lists.sourceforge.net
348 S: Supported
349
350@@ -1087,6 +1085,14 @@
351 L: kbuild-devel@lists.sourceforge.net
352 W: http://kbuild.sourceforge.net
353 S: Maintained
354+
355+KERNEL JANITORS
356+P: Several
357+L: kernel-janitor-discuss@lists.sf.net
358+W: http://www.kerneljanitors.org/
359+W: http://sf.net/projects/kernel-janitor/
360+W: http://developer.osdl.org/rddunlap/kj-patches/
361+S: Maintained
362
363 KERNEL NFSD
364 P: Neil Brown
365diff -Nru a/Makefile b/Makefile
366--- a/Makefile Fri Aug 22 16:38:51 2003
367+++ b/Makefile Mon Sep 1 04:36:41 2003
179f8ebf
AM
368@@ -268,8 +268,19 @@
369 # Detect when mixed targets is specified, and make a second invocation
370 # of make so .config is not included in this case either (for *config).
371
372+no-dot-config-targets := clean mrproper distclean \
373+ cscope TAGS tags help %docs check%
374+
375 config-targets := 0
376 mixed-targets := 0
377+dot-config := 1
378+
379+ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
380+ ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
381+ dot-config := 0
382+ endif
383+endif
384+
385 ifneq ($(filter config %config,$(MAKECMDGOALS)),)
386 config-targets := 1
387 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
388@@ -309,7 +320,26 @@
389 core-y := usr/
390 SUBDIRS :=
391
392--include .config
393+ifeq ($(dot-config),1)
394+# In this section, we need .config
395+
396+# Read in dependencies to all Kconfig* files, make sure to run
397+# oldconfig if changes are detected.
398+-include .config.cmd
399+
400+include .config
401+
402+# If .config needs to be updated, it will be done via the dependency
403+# that autoconf has on .config.
404+# To avoid any implicit rule to kick in, define an empty command
405+.config: ;
406+
407+# If .config is newer than include/linux/autoconf.h, someone tinkered
408+# with it and forgot to run make oldconfig
409+include/linux/autoconf.h: scripts/fixdep .config
410+ $(Q)$(MAKE) $(build)=scripts/kconfig silentoldconfig
411+
412+endif
413
414 include arch/$(ARCH)/Makefile
415
416@@ -338,15 +368,7 @@
417
418 # Here goes the main Makefile
419 # ---------------------------------------------------------------------------
420-#
421-# If the user gave a *config target, it'll be handled in another
422-# section below, since in this case we cannot include .config
423-# Same goes for other targets like clean/mrproper etc, which
424-# don't need .config, either
425
426-# In this section, we need .config
427-
428--include .config.cmd
429
430 ifndef CONFIG_FRAME_POINTER
431 CFLAGS += -fomit-frame-pointer
432@@ -521,13 +543,6 @@
433 @scripts/split-include include/linux/autoconf.h include/config
434 @touch $@
435
436-# if .config is newer than include/linux/autoconf.h, someone tinkered
437-# with it and forgot to run make oldconfig
438-
439-include/linux/autoconf.h: .config scripts/fixdep
440- $(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
441- ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
442-
443 # Generate some files
444 # ---------------------------------------------------------------------------
445
446@@ -579,6 +594,11 @@
447
448 .PHONY: _modinst_
449 _modinst_:
450+ @if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
451+ echo "Warning: you may need to install module-init-tools"; \
452+ echo "See http://www.codemonkey.org.uk/post-halloween-2.5.txt";\
453+ sleep 1; \
454+ fi
455 @rm -rf $(MODLIB)/kernel
456 @rm -f $(MODLIB)/build
457 @mkdir -p $(MODLIB)/kernel
458diff -Nru a/arch/alpha/Kconfig b/arch/alpha/Kconfig
459--- a/arch/alpha/Kconfig Sun Aug 17 01:06:24 2003
460+++ b/arch/alpha/Kconfig Sun Aug 31 16:14:22 2003
461@@ -597,40 +597,6 @@
462
463 source "drivers/pcmcia/Kconfig"
464
465-choice
466- prompt "Kernel core (/proc/kcore) format"
467- depends on PROC_FS
468- default KCORE_ELF
469-
470-config KCORE_ELF
471- bool "ELF"
472- ---help---
473- If you enabled support for /proc file system then the file
474- /proc/kcore will contain the kernel core image. This can be used
475- in gdb:
476-
477- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
478-
479- You have two choices here: ELF and A.OUT. Selecting ELF will make
480- /proc/kcore appear in ELF core format as defined by the Executable
481- and Linking Format specification. Selecting A.OUT will choose the
482- old "a.out" format which may be necessary for some old versions
483- of binutils or on some architectures.
484-
485- This is especially useful if you have compiled the kernel with the
486- "-g" option to preserve debugging information. It is mainly used
487- for examining kernel data structures on the live kernel so if you
488- don't understand what this means or are not a kernel hacker, just
489- leave it at its default value ELF.
490-
491-config KCORE_AOUT
492- bool "A.OUT"
493- help
494- Not necessary unless you're using a very out-of-date binutils
495- version. You probably want KCORE_ELF.
496-
497-endchoice
498-
499 config SRM_ENV
500 tristate "SRM environment through procfs"
501 depends on PROC_FS
502diff -Nru a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c
503--- a/arch/alpha/kernel/core_titan.c Sun Aug 17 00:57:42 2003
504+++ b/arch/alpha/kernel/core_titan.c Sun Aug 31 16:14:08 2003
505@@ -717,12 +717,12 @@
506
507 struct alpha_agp_ops titan_agp_ops =
508 {
509- setup: titan_agp_setup,
510- cleanup: titan_agp_cleanup,
511- configure: titan_agp_configure,
512- bind: titan_agp_bind_memory,
513- unbind: titan_agp_unbind_memory,
514- translate: titan_agp_translate
515+ .setup = titan_agp_setup,
516+ .cleanup = titan_agp_cleanup,
517+ .configure = titan_agp_configure,
518+ .bind = titan_agp_bind_memory,
519+ .unbind = titan_agp_unbind_memory,
520+ .translate = titan_agp_translate
521 };
522
523 alpha_agp_info *
524diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig
525--- a/arch/arm/Kconfig Tue Aug 19 11:44:53 2003
526+++ b/arch/arm/Kconfig Sun Aug 31 16:14:22 2003
527@@ -654,39 +654,6 @@
528 If you do not feel you need a faster FP emulation you should better
529 choose NWFPE.
530
531-choice
532- prompt "Kernel core (/proc/kcore) format"
533- default KCORE_ELF
534-
535-config KCORE_ELF
536- bool "ELF"
537- ---help---
538- If you enabled support for /proc file system then the file
539- /proc/kcore will contain the kernel core image. This can be used
540- in gdb:
541-
542- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
543-
544- You have two choices here: ELF and A.OUT. Selecting ELF will make
545- /proc/kcore appear in ELF core format as defined by the Executable
546- and Linking Format specification. Selecting A.OUT will choose the
547- old "a.out" format which may be necessary for some old versions
548- of binutils or on some architectures.
549-
550- This is especially useful if you have compiled the kernel with the
551- "-g" option to preserve debugging information. It is mainly used
552- for examining kernel data structures on the live kernel so if you
553- don't understand what this means or are not a kernel hacker, just
554- leave it at its default value ELF.
555-
556-config KCORE_AOUT
557- bool "A.OUT"
558- help
559- Not necessary unless you're using a very out-of-date binutils
560- version. You probably want KCORE_ELF.
561-
562-endchoice
563-
564 source "fs/Kconfig.binfmt"
565
566 source "drivers/base/Kconfig"
567diff -Nru a/arch/arm/Makefile b/arch/arm/Makefile
568--- a/arch/arm/Makefile Tue Aug 19 11:44:53 2003
569+++ b/arch/arm/Makefile Wed Aug 13 16:23:42 2003
570@@ -24,6 +24,7 @@
571 CFLAGS += -mbig-endian
572 AS += -EB
573 LD += -EB
574+AFLAGS += -mbig-endian
575 endif
576
577 check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
578diff -Nru a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
579--- a/arch/arm/boot/Makefile Tue Apr 15 08:12:47 2003
580+++ b/arch/arm/boot/Makefile Wed Aug 13 16:46:20 2003
581@@ -42,11 +42,12 @@
582 ifeq ($(CONFIG_ARCH_SA1100),y)
583 zreladdr-$(CONFIG_SA1111) := 0xc0208000
584 endif
585- zreladdr-$(CONFIG_ARCH_PXA) := 0xa0008000
586- zreladdr-$(CONFIG_ARCH_ANAKIN) := 0x20008000
587- zreladdr-$(CONFIG_ARCH_IQ80310) := 0xa0008000
588- zreladdr-$(CONFIG_ARCH_IQ80321) := 0xa0008000
589- zreladdr-$(CONFIG_ARCH_ADIFCC) := 0xc0008000
590+ zreladdr-$(CONFIG_ARCH_PXA) := 0xa0008000
591+ zreladdr-$(CONFIG_ARCH_ANAKIN) := 0x20008000
592+ zreladdr-$(CONFIG_ARCH_IOP3XX) := 0xa0008000
593+params-phys-$(CONFIG_ARCH_IOP3XX) := 0xa0000100
594+ zreladdr-$(CONFIG_ARCH_ADIFCC) := 0xc0008000
595+params-phys-$(CONFIG_ARCH_ADIFCC) := 0xc0000100
596
597 ZRELADDR := $(zreladdr-y)
598 ZTEXTADDR := $(ztextaddr-y)
599diff -Nru a/arch/arm/common/amba.c b/arch/arm/common/amba.c
600--- a/arch/arm/common/amba.c Fri Aug 15 15:22:52 2003
601+++ b/arch/arm/common/amba.c Sun Aug 24 07:16:13 2003
602@@ -41,13 +41,35 @@
603 return amba_lookup(pcdrv->id_table, pcdev) != NULL;
604 }
605
606+static int amba_suspend(struct device *dev, u32 state)
607+{
608+ struct amba_driver *drv = to_amba_driver(dev->driver);
609+ int ret = 0;
610+
611+ if (dev->driver && drv->suspend)
612+ ret = drv->suspend(to_amba_device(dev), state);
613+ return ret;
614+}
615+
616+static int amba_resume(struct device *dev)
617+{
618+ struct amba_driver *drv = to_amba_driver(dev->driver);
619+ int ret = 0;
620+
621+ if (dev->driver && drv->resume)
622+ ret = drv->resume(to_amba_device(dev));
623+ return ret;
624+}
625+
626 /*
627 * Primecells are part of the Advanced Microcontroller Bus Architecture,
628 * so we call the bus "amba".
629 */
630-struct bus_type amba_bustype = {
631- .name = "amba",
632- .match = amba_match,
633+static struct bus_type amba_bustype = {
634+ .name = "amba",
635+ .match = amba_match,
636+ .suspend = amba_suspend,
637+ .resume = amba_resume,
638 };
639
640 static int __init amba_init(void)
641@@ -84,18 +106,6 @@
642 drv->shutdown(to_amba_device(dev));
643 }
644
645-static int amba_suspend(struct device *dev, u32 state, u32 level)
646-{
647- struct amba_driver *drv = to_amba_driver(dev->driver);
648- return drv->suspend(to_amba_device(dev), state, level);
649-}
650-
651-static int amba_resume(struct device *dev, u32 level)
652-{
653- struct amba_driver *drv = to_amba_driver(dev->driver);
654- return drv->resume(to_amba_device(dev), level);
655-}
656-
657 /**
658 * amba_driver_register - register an AMBA device driver
659 * @drv: amba device driver structure
660@@ -112,8 +122,6 @@
661 SETFN(probe);
662 SETFN(remove);
663 SETFN(shutdown);
664- SETFN(suspend);
665- SETFN(resume);
666
667 return driver_register(&drv->drv);
668 }
669diff -Nru a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
670--- a/arch/arm/common/sa1111.c Fri Aug 15 15:22:52 2003
671+++ b/arch/arm/common/sa1111.c Sun Aug 24 07:45:04 2003
672@@ -790,10 +790,13 @@
673 struct sa1111 *sachip = dev_get_drvdata(dev);
674 struct sa1111_save_data *save;
675 unsigned long flags;
676+ unsigned int val;
677 char *base;
678
679- if (!dev->saved_state && level == SUSPEND_NOTIFY)
680- dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
681+ if (level != SUSPEND_DISABLE)
682+ return 0;
683+
684+ dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
685 if (!dev->saved_state)
686 return -ENOMEM;
687
688@@ -804,36 +807,31 @@
689 /*
690 * Save state.
691 */
692- if (level == SUSPEND_SAVE_STATE) {
693- base = sachip->base;
694- save->skcr = sa1111_readl(base + SA1111_SKCR);
695- save->skpcr = sa1111_readl(base + SA1111_SKPCR);
696- save->skcdr = sa1111_readl(base + SA1111_SKCDR);
697- save->skaud = sa1111_readl(base + SA1111_SKAUD);
698- save->skpwm0 = sa1111_readl(base + SA1111_SKPWM0);
699- save->skpwm1 = sa1111_readl(base + SA1111_SKPWM1);
700-
701- base = sachip->base + SA1111_INTC;
702- save->intpol0 = sa1111_readl(base + SA1111_INTPOL0);
703- save->intpol1 = sa1111_readl(base + SA1111_INTPOL1);
704- save->inten0 = sa1111_readl(base + SA1111_INTEN0);
705- save->inten1 = sa1111_readl(base + SA1111_INTEN1);
706- save->wakepol0 = sa1111_readl(base + SA1111_WAKEPOL0);
707- save->wakepol1 = sa1111_readl(base + SA1111_WAKEPOL1);
708- save->wakeen0 = sa1111_readl(base + SA1111_WAKEEN0);
709- save->wakeen1 = sa1111_readl(base + SA1111_WAKEEN1);
710- }
711+ base = sachip->base;
712+ save->skcr = sa1111_readl(base + SA1111_SKCR);
713+ save->skpcr = sa1111_readl(base + SA1111_SKPCR);
714+ save->skcdr = sa1111_readl(base + SA1111_SKCDR);
715+ save->skaud = sa1111_readl(base + SA1111_SKAUD);
716+ save->skpwm0 = sa1111_readl(base + SA1111_SKPWM0);
717+ save->skpwm1 = sa1111_readl(base + SA1111_SKPWM1);
718+
719+ base = sachip->base + SA1111_INTC;
720+ save->intpol0 = sa1111_readl(base + SA1111_INTPOL0);
721+ save->intpol1 = sa1111_readl(base + SA1111_INTPOL1);
722+ save->inten0 = sa1111_readl(base + SA1111_INTEN0);
723+ save->inten1 = sa1111_readl(base + SA1111_INTEN1);
724+ save->wakepol0 = sa1111_readl(base + SA1111_WAKEPOL0);
725+ save->wakepol1 = sa1111_readl(base + SA1111_WAKEPOL1);
726+ save->wakeen0 = sa1111_readl(base + SA1111_WAKEEN0);
727+ save->wakeen1 = sa1111_readl(base + SA1111_WAKEEN1);
728
729 /*
730 * Disable.
731 */
732- if (level == SUSPEND_POWER_DOWN && state == 4) {
733- unsigned int val = sa1111_readl(sachip->base + SA1111_SKCR);
734-
735- sa1111_writel(val | SKCR_SLEEP, sachip->base + SA1111_SKCR);
736- sa1111_writel(0, sachip->base + SA1111_SKPWM0);
737- sa1111_writel(0, sachip->base + SA1111_SKPWM1);
738- }
739+ val = sa1111_readl(sachip->base + SA1111_SKCR);
740+ sa1111_writel(val | SKCR_SLEEP, sachip->base + SA1111_SKCR);
741+ sa1111_writel(0, sachip->base + SA1111_SKPWM0);
742+ sa1111_writel(0, sachip->base + SA1111_SKPWM1);
743
744 spin_unlock_irqrestore(&sachip->lock, flags);
745
746@@ -857,6 +855,9 @@
747 unsigned long flags, id;
748 char *base;
749
750+ if (level != RESUME_ENABLE)
751+ return 0;
752+
753 save = (struct sa1111_save_data *)dev->saved_state;
754 if (!save)
755 return 0;
756@@ -878,39 +879,32 @@
757 /*
758 * First of all, wake up the chip.
759 */
760- if (level == RESUME_POWER_ON) {
761- sa1111_wake(sachip);
762-
763- sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0);
764- sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1);
765- }
766-
767- if (level == RESUME_RESTORE_STATE) {
768- base = sachip->base;
769- sa1111_writel(save->skcr, base + SA1111_SKCR);
770- sa1111_writel(save->skpcr, base + SA1111_SKPCR);
771- sa1111_writel(save->skcdr, base + SA1111_SKCDR);
772- sa1111_writel(save->skaud, base + SA1111_SKAUD);
773- sa1111_writel(save->skpwm0, base + SA1111_SKPWM0);
774- sa1111_writel(save->skpwm1, base + SA1111_SKPWM1);
775-
776- base = sachip->base + SA1111_INTC;
777- sa1111_writel(save->intpol0, base + SA1111_INTPOL0);
778- sa1111_writel(save->intpol1, base + SA1111_INTPOL1);
779- sa1111_writel(save->inten0, base + SA1111_INTEN0);
780- sa1111_writel(save->inten1, base + SA1111_INTEN1);
781- sa1111_writel(save->wakepol0, base + SA1111_WAKEPOL0);
782- sa1111_writel(save->wakepol1, base + SA1111_WAKEPOL1);
783- sa1111_writel(save->wakeen0, base + SA1111_WAKEEN0);
784- sa1111_writel(save->wakeen1, base + SA1111_WAKEEN1);
785- }
786+ sa1111_wake(sachip);
787+ sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0);
788+ sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1);
789+
790+ base = sachip->base;
791+ sa1111_writel(save->skcr, base + SA1111_SKCR);
792+ sa1111_writel(save->skpcr, base + SA1111_SKPCR);
793+ sa1111_writel(save->skcdr, base + SA1111_SKCDR);
794+ sa1111_writel(save->skaud, base + SA1111_SKAUD);
795+ sa1111_writel(save->skpwm0, base + SA1111_SKPWM0);
796+ sa1111_writel(save->skpwm1, base + SA1111_SKPWM1);
797+
798+ base = sachip->base + SA1111_INTC;
799+ sa1111_writel(save->intpol0, base + SA1111_INTPOL0);
800+ sa1111_writel(save->intpol1, base + SA1111_INTPOL1);
801+ sa1111_writel(save->inten0, base + SA1111_INTEN0);
802+ sa1111_writel(save->inten1, base + SA1111_INTEN1);
803+ sa1111_writel(save->wakepol0, base + SA1111_WAKEPOL0);
804+ sa1111_writel(save->wakepol1, base + SA1111_WAKEPOL1);
805+ sa1111_writel(save->wakeen0, base + SA1111_WAKEEN0);
806+ sa1111_writel(save->wakeen1, base + SA1111_WAKEEN1);
807
808 spin_unlock_irqrestore(&sachip->lock, flags);
809
810- if (level == RESUME_ENABLE) {
811- dev->saved_state = NULL;
812- kfree(save);
813- }
814+ dev->saved_state = NULL;
815+ kfree(save);
816
817 return 0;
818 }
819@@ -1135,9 +1129,55 @@
820 return dev->devid == drv->devid;
821 }
822
823+static int sa1111_bus_suspend(struct device *dev, u32 state)
824+{
825+ struct sa1111_dev *sadev = SA1111_DEV(dev);
826+ struct sa1111_driver *drv = SA1111_DRV(dev->driver);
827+ int ret = 0;
828+
829+ if (drv && drv->suspend)
830+ ret = drv->suspend(sadev, state);
831+ return ret;
832+}
833+
834+static int sa1111_bus_resume(struct device *dev)
835+{
836+ struct sa1111_dev *sadev = SA1111_DEV(dev);
837+ struct sa1111_driver *drv = SA1111_DRV(dev->driver);
838+ int ret = 0;
839+
840+ if (drv && drv->resume)
841+ ret = drv->resume(sadev);
842+ return ret;
843+}
844+
845+static int sa1111_bus_probe(struct device *dev)
846+{
847+ struct sa1111_dev *sadev = SA1111_DEV(dev);
848+ struct sa1111_driver *drv = SA1111_DRV(dev->driver);
849+ int ret = -ENODEV;
850+
851+ if (drv->probe)
852+ ret = drv->probe(sadev);
853+ return ret;
854+}
855+
856+static int sa1111_bus_remove(struct device *dev)
857+{
858+ struct sa1111_dev *sadev = SA1111_DEV(dev);
859+ struct sa1111_driver *drv = SA1111_DRV(dev->driver);
860+ int ret = 0;
861+
862+ if (drv->remove)
863+ ret = drv->remove(sadev);
864+ return ret;
865+}
866+
867 struct bus_type sa1111_bus_type = {
868- .name = "RAB",
869- .match = sa1111_match,
870+ .name = "sa1111-rab",
871+ .match = sa1111_match,
872+ .suspend = sa1111_bus_suspend,
873+ .resume = sa1111_bus_resume,
874 };
875
876 static int sa1111_rab_bus_init(void)
877@@ -1147,6 +1187,19 @@
878
879 postcore_initcall(sa1111_rab_bus_init);
880
881+int sa1111_driver_register(struct sa1111_driver *driver)
882+{
883+ driver->drv.probe = sa1111_bus_probe;
884+ driver->drv.remove = sa1111_bus_remove;
885+ driver->drv.bus = &sa1111_bus_type;
886+ return driver_register(&driver->drv);
887+}
888+
889+void sa1111_driver_unregister(struct sa1111_driver *driver)
890+{
891+ driver_unregister(&driver->drv);
892+}
893+
894 EXPORT_SYMBOL(sa1111_check_dma_bug);
895 EXPORT_SYMBOL(sa1111_select_audio_mode);
896 EXPORT_SYMBOL(sa1111_set_audio_rate);
897@@ -1155,3 +1208,5 @@
898 EXPORT_SYMBOL(sa1111_disable_device);
899 EXPORT_SYMBOL(sa1111_pll_clock);
900 EXPORT_SYMBOL(sa1111_bus_type);
901+EXPORT_SYMBOL(sa1111_driver_register);
902+EXPORT_SYMBOL(sa1111_driver_unregister);
903diff -Nru a/arch/arm/def-configs/iq80310 b/arch/arm/def-configs/iq80310
904--- a/arch/arm/def-configs/iq80310 Tue Apr 15 07:34:41 2003
905+++ b/arch/arm/def-configs/iq80310 Wed Aug 13 16:46:20 2003
906@@ -19,6 +19,12 @@
907 # CONFIG_BSD_PROCESS_ACCT is not set
908 CONFIG_SYSCTL=y
909 CONFIG_LOG_BUF_SHIFT=14
910+# CONFIG_EMBEDDED is not set
911+CONFIG_KALLSYMS=y
912+CONFIG_FUTEX=y
913+CONFIG_EPOLL=y
914+CONFIG_IOSCHED_AS=y
915+CONFIG_IOSCHED_DEADLINE=y
916
917 #
918 # Loadable module support
919@@ -34,7 +40,6 @@
920 #
921 # CONFIG_ARCH_ADIFCC is not set
922 # CONFIG_ARCH_ANAKIN is not set
923-# CONFIG_ARCH_ARCA5K is not set
924 # CONFIG_ARCH_CLPS7500 is not set
925 # CONFIG_ARCH_CLPS711X is not set
926 # CONFIG_ARCH_CO285 is not set
927@@ -50,14 +55,6 @@
928 # CONFIG_ARCH_SHARK is not set
929
930 #
931-# Archimedes/A5000 Implementations
932-#
933-
934-#
935-# Archimedes/A5000 Implementations (select only ONE)
936-#
937-
938-#
939 # CLPS711X/EP721X Implementations
940 #
941
942@@ -73,7 +70,9 @@
943 # IOP3xx Implementation Options
944 #
945 CONFIG_ARCH_IQ80310=y
946+# CONFIG_ARCH_IQ80321 is not set
947 CONFIG_ARCH_IOP310=y
948+# CONFIG_ARCH_IOP321 is not set
949
950 #
951 # IOP3xx Chipset Features
952@@ -84,6 +83,14 @@
953 # CONFIG_IOP3XX_PMON is not set
954
955 #
956+# ADIFCC Implementation Options
957+#
958+
959+#
960+# ADI Board Types
961+#
962+
963+#
964 # Intel PXA250/210 Implementations
965 #
966
967@@ -96,6 +103,7 @@
968 #
969 CONFIG_CPU_32=y
970 CONFIG_CPU_XSCALE=y
971+CONFIG_XS80200=y
972 CONFIG_CPU_32v5=y
973
974 #
975@@ -116,9 +124,15 @@
976 # CONFIG_HOTPLUG is not set
977
978 #
979+# MMC/SD Card support
980+#
981+# CONFIG_MMC is not set
982+
983+#
984 # At least one math emulation must be selected
985 #
986 CONFIG_FPE_NWFPE=y
987+# CONFIG_FPE_NWFPE_XP is not set
988 # CONFIG_FPE_FASTFPE is not set
989 CONFIG_KCORE_ELF=y
990 # CONFIG_KCORE_AOUT is not set
991@@ -154,6 +168,7 @@
992 CONFIG_MTD_BLOCK=y
993 # CONFIG_FTL is not set
994 # CONFIG_NFTL is not set
995+# CONFIG_INFTL is not set
996
997 #
998 # RAM/ROM/Flash chip drivers
999@@ -164,6 +179,7 @@
1000 # CONFIG_MTD_CFI_ADV_OPTIONS is not set
1001 CONFIG_MTD_CFI_INTELEXT=y
1002 # CONFIG_MTD_CFI_AMDSTD is not set
1003+# CONFIG_MTD_CFI_STAA is not set
1004 # CONFIG_MTD_RAM is not set
1005 # CONFIG_MTD_ROM is not set
1006 # CONFIG_MTD_ABSENT is not set
1007@@ -172,13 +188,11 @@
1008 #
1009 # Mapping drivers for chip access
1010 #
1011+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
1012 # CONFIG_MTD_PHYSMAP is not set
1013-# CONFIG_MTD_NORA is not set
1014 # CONFIG_MTD_ARM_INTEGRATOR is not set
1015 CONFIG_MTD_IQ80310=y
1016 # CONFIG_MTD_EDB7312 is not set
1017-# CONFIG_MTD_PCI is not set
1018-# CONFIG_MTD_UCLINUX is not set
1019
1020 #
1021 # Self-contained MTD device drivers
1022@@ -191,9 +205,9 @@
1023 #
1024 # Disk-On-Chip Device Drivers
1025 #
1026-# CONFIG_MTD_DOC1000 is not set
1027 # CONFIG_MTD_DOC2000 is not set
1028 # CONFIG_MTD_DOC2001 is not set
1029+# CONFIG_MTD_DOC2001PLUS is not set
1030
1031 #
1032 # NAND Flash Device Drivers
1033@@ -236,7 +250,6 @@
1034 # CONFIG_NETLINK_DEV is not set
1035 CONFIG_NETFILTER=y
1036 # CONFIG_NETFILTER_DEBUG is not set
1037-# CONFIG_FILTER is not set
1038 CONFIG_UNIX=y
1039 # CONFIG_NET_KEY is not set
1040 CONFIG_INET=y
1041@@ -253,7 +266,7 @@
1042 # CONFIG_SYN_COOKIES is not set
1043 # CONFIG_INET_AH is not set
1044 # CONFIG_INET_ESP is not set
1045-# CONFIG_XFRM_USER is not set
1046+# CONFIG_INET_IPCOMP is not set
1047
1048 #
1049 # IP: Netfilter Configuration
1050@@ -264,7 +277,13 @@
1051 # CONFIG_IP_NF_ARPTABLES is not set
1052 # CONFIG_IP_NF_COMPAT_IPCHAINS is not set
1053 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
1054+
1055+#
1056+# IP: Virtual Server Configuration
1057+#
1058+# CONFIG_IP_VS is not set
1059 # CONFIG_IPV6 is not set
1060+# CONFIG_XFRM_USER is not set
1061
1062 #
1063 # SCTP Configuration (EXPERIMENTAL)
1064@@ -310,6 +329,7 @@
1065 #
1066 CONFIG_NET_ETHERNET=y
1067 CONFIG_MII=y
1068+# CONFIG_SMC91X is not set
1069 # CONFIG_HAPPYMEAL is not set
1070 # CONFIG_SUNGEM is not set
1071 # CONFIG_NET_VENDOR_3COM is not set
1072@@ -351,6 +371,11 @@
1073 # CONFIG_R8169 is not set
1074 # CONFIG_SK98LIN is not set
1075 # CONFIG_TIGON3 is not set
1076+
1077+#
1078+# Ethernet (10000 Mbit)
1079+#
1080+# CONFIG_IXGB is not set
1081 # CONFIG_FDDI is not set
1082 # CONFIG_HIPPI is not set
1083 # CONFIG_PPP is not set
1084@@ -402,6 +427,7 @@
1085 CONFIG_BLK_DEV_IDECD=y
1086 # CONFIG_BLK_DEV_IDEFLOPPY is not set
1087 # CONFIG_IDE_TASK_IOCTL is not set
1088+# CONFIG_IDE_TASKFILE_IO is not set
1089
1090 #
1091 # IDE chipset support/bugfixes
1092@@ -409,7 +435,7 @@
1093 # CONFIG_BLK_DEV_IDEPCI is not set
1094
1095 #
1096-# SCSI support
1097+# SCSI device support
1098 #
1099 # CONFIG_SCSI is not set
1100
1101@@ -481,6 +507,7 @@
1102 #
1103 # I2C Hardware Sensors Chip support
1104 #
1105+# CONFIG_I2C_SENSOR is not set
1106
1107 #
1108 # L3 serial bus support
1109@@ -534,6 +561,8 @@
1110 # CONFIG_VIDEO_PMS is not set
1111 # CONFIG_VIDEO_CPIA is not set
1112 # CONFIG_VIDEO_STRADIS is not set
1113+# CONFIG_VIDEO_HEXIUM_ORION is not set
1114+# CONFIG_VIDEO_HEXIUM_GEMINI is not set
1115
1116 #
1117 # Radio Adapters
1118@@ -551,18 +580,29 @@
1119 #
1120 # Supported Frontend Modules
1121 #
1122-CONFIG_DVB_ALPS_BSRU6=y
1123+# CONFIG_DVB_STV0299 is not set
1124 # CONFIG_DVB_ALPS_BSRV2 is not set
1125 # CONFIG_DVB_ALPS_TDLB7 is not set
1126 # CONFIG_DVB_ALPS_TDMB7 is not set
1127+# CONFIG_DVB_ATMEL_AT76C651 is not set
1128+# CONFIG_DVB_CX24110 is not set
1129 # CONFIG_DVB_GRUNDIG_29504_491 is not set
1130 # CONFIG_DVB_GRUNDIG_29504_401 is not set
1131+# CONFIG_DVB_MT312 is not set
1132 # CONFIG_DVB_VES1820 is not set
1133+# CONFIG_DVB_TDA1004X is not set
1134
1135 #
1136-# Supported DVB Adapters
1137+# Supported SAA7146 based PCI Adapters
1138 #
1139 # CONFIG_DVB_AV7110 is not set
1140+# CONFIG_DVB_BUDGET is not set
1141+
1142+#
1143+# Supported FlexCopII (B2C2) Adapters
1144+#
1145+# CONFIG_DVB_B2C2_SKYSTAR is not set
1146+# CONFIG_VIDEO_BTCX is not set
1147
1148 #
1149 # File systems
1150@@ -598,6 +638,7 @@
1151 CONFIG_PROC_FS=y
1152 # CONFIG_DEVFS_FS is not set
1153 CONFIG_DEVPTS_FS=y
1154+# CONFIG_DEVPTS_FS_XATTR is not set
1155 CONFIG_TMPFS=y
1156 CONFIG_RAMFS=y
1157
1158@@ -631,13 +672,13 @@
1159 CONFIG_ROOT_NFS=y
1160 CONFIG_LOCKD=y
1161 # CONFIG_EXPORTFS is not set
1162+CONFIG_SUNRPC=y
1163+# CONFIG_SUNRPC_GSS is not set
1164 # CONFIG_SMB_FS is not set
1165 # CONFIG_CIFS is not set
1166 # CONFIG_NCP_FS is not set
1167 # CONFIG_CODA_FS is not set
1168 # CONFIG_INTERMEZZO_FS is not set
1169-CONFIG_SUNRPC=y
1170-# CONFIG_SUNRPC_GSS is not set
1171 # CONFIG_AFS_FS is not set
1172
1173 #
1174@@ -655,6 +696,7 @@
1175 # CONFIG_SOLARIS_X86_PARTITION is not set
1176 # CONFIG_UNIXWARE_DISKLABEL is not set
1177 # CONFIG_LDM_PARTITION is not set
1178+# CONFIG_NEC98_PARTITION is not set
1179 # CONFIG_SGI_PARTITION is not set
1180 # CONFIG_ULTRIX_PARTITION is not set
1181 # CONFIG_SUN_PARTITION is not set
1182@@ -666,13 +708,6 @@
1183 # CONFIG_FB is not set
1184
1185 #
1186-# Console display driver support
1187-#
1188-# CONFIG_VGA_CONSOLE is not set
1189-# CONFIG_MDA_CONSOLE is not set
1190-CONFIG_DUMMY_CONSOLE=y
1191-
1192-#
1193 # Sound
1194 #
1195 # CONFIG_SOUND is not set
1196@@ -695,6 +730,7 @@
1197 # USB support
1198 #
1199 # CONFIG_USB is not set
1200+# CONFIG_USB_GADGET is not set
1201
1202 #
1203 # Bluetooth support
1204@@ -714,7 +750,6 @@
1205 # CONFIG_DEBUG_WAITQ is not set
1206 CONFIG_DEBUG_BUGVERBOSE=y
1207 CONFIG_DEBUG_ERRORS=y
1208-CONFIG_KALLSYMS=y
1209 CONFIG_DEBUG_LL=y
1210
1211 #
1212diff -Nru a/arch/arm/def-configs/iq80321 b/arch/arm/def-configs/iq80321
1213--- a/arch/arm/def-configs/iq80321 Sat Aug 2 12:59:32 2003
1214+++ b/arch/arm/def-configs/iq80321 Wed Aug 13 16:46:20 2003
1215@@ -9,7 +9,7 @@
1216 #
1217 # Code maturity level options
1218 #
1219-# CONFIG_EXPERIMENTAL is not set
1220+CONFIG_EXPERIMENTAL=y
1221
1222 #
1223 # General setup
1224@@ -19,6 +19,12 @@
1225 # CONFIG_BSD_PROCESS_ACCT is not set
1226 CONFIG_SYSCTL=y
1227 CONFIG_LOG_BUF_SHIFT=14
1228+# CONFIG_EMBEDDED is not set
1229+CONFIG_KALLSYMS=y
1230+CONFIG_FUTEX=y
1231+CONFIG_EPOLL=y
1232+CONFIG_IOSCHED_AS=y
1233+CONFIG_IOSCHED_DEADLINE=y
1234
1235 #
1236 # Loadable module support
1237@@ -26,6 +32,7 @@
1238 CONFIG_MODULES=y
1239 # CONFIG_MODULE_UNLOAD is not set
1240 CONFIG_OBSOLETE_MODPARM=y
1241+# CONFIG_MODVERSIONS is not set
1242 CONFIG_KMOD=y
1243
1244 #
1245@@ -33,7 +40,6 @@
1246 #
1247 # CONFIG_ARCH_ADIFCC is not set
1248 # CONFIG_ARCH_ANAKIN is not set
1249-# CONFIG_ARCH_ARCA5K is not set
1250 # CONFIG_ARCH_CLPS7500 is not set
1251 # CONFIG_ARCH_CLPS711X is not set
1252 # CONFIG_ARCH_CO285 is not set
1253@@ -49,14 +55,6 @@
1254 # CONFIG_ARCH_SHARK is not set
1255
1256 #
1257-# Archimedes/A5000 Implementations
1258-#
1259-
1260-#
1261-# Archimedes/A5000 Implementations (select only ONE)
1262-#
1263-
1264-#
1265 # CLPS711X/EP721X Implementations
1266 #
1267
1268@@ -79,6 +77,18 @@
1269 #
1270 # IOP3xx Chipset Features
1271 #
1272+# CONFIG_IOP3XX_AAU is not set
1273+# CONFIG_IOP3XX_DMA is not set
1274+# CONFIG_IOP3XX_MU is not set
1275+# CONFIG_IOP3XX_PMON is not set
1276+
1277+#
1278+# ADIFCC Implementation Options
1279+#
1280+
1281+#
1282+# ADI Board Types
1283+#
1284
1285 #
1286 # Intel PXA250/210 Implementations
1287@@ -98,6 +108,7 @@
1288 #
1289 # Processor Features
1290 #
1291+# CONFIG_ARM_THUMB is not set
1292 CONFIG_XSCALE_PMU=y
1293
1294 #
1295@@ -112,17 +123,25 @@
1296 # CONFIG_HOTPLUG is not set
1297
1298 #
1299+# MMC/SD Card support
1300+#
1301+# CONFIG_MMC is not set
1302+
1303+#
1304 # At least one math emulation must be selected
1305 #
1306 CONFIG_FPE_NWFPE=y
1307+# CONFIG_FPE_NWFPE_XP is not set
1308+# CONFIG_FPE_FASTFPE is not set
1309 CONFIG_KCORE_ELF=y
1310 # CONFIG_KCORE_AOUT is not set
1311 CONFIG_BINFMT_AOUT=y
1312 CONFIG_BINFMT_ELF=y
1313 # CONFIG_BINFMT_MISC is not set
1314 # CONFIG_PM is not set
1315+# CONFIG_PREEMPT is not set
1316 # CONFIG_ARTHUR is not set
1317-CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200"
1318+CONFIG_CMDLINE="ip=boot root=nfs console=ttyS0,115200 mem=128M@0xa0000000"
1319 CONFIG_ALIGNMENT_TRAP=y
1320
1321 #
1322@@ -148,6 +167,7 @@
1323 CONFIG_MTD_BLOCK=y
1324 # CONFIG_FTL is not set
1325 # CONFIG_NFTL is not set
1326+# CONFIG_INFTL is not set
1327
1328 #
1329 # RAM/ROM/Flash chip drivers
1330@@ -158,6 +178,7 @@
1331 # CONFIG_MTD_CFI_ADV_OPTIONS is not set
1332 CONFIG_MTD_CFI_INTELEXT=y
1333 # CONFIG_MTD_CFI_AMDSTD is not set
1334+# CONFIG_MTD_CFI_STAA is not set
1335 # CONFIG_MTD_RAM is not set
1336 # CONFIG_MTD_ROM is not set
1337 # CONFIG_MTD_ABSENT is not set
1338@@ -166,13 +187,10 @@
1339 #
1340 # Mapping drivers for chip access
1341 #
1342+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
1343 # CONFIG_MTD_PHYSMAP is not set
1344-# CONFIG_MTD_NORA is not set
1345 # CONFIG_MTD_ARM_INTEGRATOR is not set
1346-CONFIG_MTD_IQ80321=y
1347 # CONFIG_MTD_EDB7312 is not set
1348-# CONFIG_MTD_PCI is not set
1349-# CONFIG_MTD_UCLINUX is not set
1350
1351 #
1352 # Self-contained MTD device drivers
1353@@ -185,9 +203,9 @@
1354 #
1355 # Disk-On-Chip Device Drivers
1356 #
1357-# CONFIG_MTD_DOC1000 is not set
1358 # CONFIG_MTD_DOC2000 is not set
1359 # CONFIG_MTD_DOC2001 is not set
1360+# CONFIG_MTD_DOC2001PLUS is not set
1361
1362 #
1363 # NAND Flash Device Drivers
1364@@ -206,6 +224,7 @@
1365 # CONFIG_BLK_CPQ_DA is not set
1366 # CONFIG_BLK_CPQ_CISS_DA is not set
1367 # CONFIG_BLK_DEV_DAC960 is not set
1368+# CONFIG_BLK_DEV_UMEM is not set
1369 # CONFIG_BLK_DEV_LOOP is not set
1370 # CONFIG_BLK_DEV_NBD is not set
1371 CONFIG_BLK_DEV_RAM=y
1372@@ -229,7 +248,6 @@
1373 # CONFIG_NETLINK_DEV is not set
1374 CONFIG_NETFILTER=y
1375 # CONFIG_NETFILTER_DEBUG is not set
1376-# CONFIG_FILTER is not set
1377 CONFIG_UNIX=y
1378 # CONFIG_NET_KEY is not set
1379 CONFIG_INET=y
1380@@ -241,24 +259,47 @@
1381 # CONFIG_IP_PNP_RARP is not set
1382 # CONFIG_NET_IPIP is not set
1383 # CONFIG_NET_IPGRE is not set
1384+# CONFIG_ARPD is not set
1385 # CONFIG_INET_ECN is not set
1386 # CONFIG_SYN_COOKIES is not set
1387 # CONFIG_INET_AH is not set
1388 # CONFIG_INET_ESP is not set
1389-# CONFIG_XFRM_USER is not set
1390+# CONFIG_INET_IPCOMP is not set
1391
1392 #
1393 # IP: Netfilter Configuration
1394 #
1395 # CONFIG_IP_NF_CONNTRACK is not set
1396+# CONFIG_IP_NF_QUEUE is not set
1397 # CONFIG_IP_NF_IPTABLES is not set
1398 # CONFIG_IP_NF_ARPTABLES is not set
1399 # CONFIG_IP_NF_COMPAT_IPCHAINS is not set
1400 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
1401+
1402+#
1403+# IP: Virtual Server Configuration
1404+#
1405+# CONFIG_IP_VS is not set
1406+# CONFIG_IPV6 is not set
1407+# CONFIG_XFRM_USER is not set
1408+
1409+#
1410+# SCTP Configuration (EXPERIMENTAL)
1411+#
1412+CONFIG_IPV6_SCTP__=y
1413+# CONFIG_IP_SCTP is not set
1414+# CONFIG_ATM is not set
1415 # CONFIG_VLAN_8021Q is not set
1416 # CONFIG_LLC is not set
1417 # CONFIG_DECNET is not set
1418 # CONFIG_BRIDGE is not set
1419+# CONFIG_X25 is not set
1420+# CONFIG_LAPB is not set
1421+# CONFIG_NET_DIVERT is not set
1422+# CONFIG_ECONET is not set
1423+# CONFIG_WAN_ROUTER is not set
1424+# CONFIG_NET_FASTROUTE is not set
1425+# CONFIG_NET_HW_FLOWCONTROL is not set
1426
1427 #
1428 # QoS and/or fair queueing
1429@@ -279,12 +320,14 @@
1430 # CONFIG_BONDING is not set
1431 # CONFIG_EQUALIZER is not set
1432 # CONFIG_TUN is not set
1433+# CONFIG_ETHERTAP is not set
1434
1435 #
1436 # Ethernet (10 or 100Mbit)
1437 #
1438 CONFIG_NET_ETHERNET=y
1439 # CONFIG_MII is not set
1440+# CONFIG_SMC91X is not set
1441 # CONFIG_HAPPYMEAL is not set
1442 # CONFIG_SUNGEM is not set
1443 # CONFIG_NET_VENDOR_3COM is not set
1444@@ -298,6 +341,7 @@
1445 # CONFIG_PCNET32 is not set
1446 # CONFIG_AMD8111_ETH is not set
1447 # CONFIG_ADAPTEC_STARFIRE is not set
1448+# CONFIG_B44 is not set
1449 # CONFIG_DGRS is not set
1450 CONFIG_EEPRO100=y
1451 # CONFIG_EEPRO100_PIO is not set
1452@@ -305,6 +349,7 @@
1453 # CONFIG_FEALNX is not set
1454 # CONFIG_NATSEMI is not set
1455 # CONFIG_NE2K_PCI is not set
1456+# CONFIG_8139CP is not set
1457 # CONFIG_8139TOO is not set
1458 # CONFIG_SIS900 is not set
1459 # CONFIG_EPIC100 is not set
1460@@ -317,13 +362,21 @@
1461 #
1462 # CONFIG_ACENIC is not set
1463 # CONFIG_DL2K is not set
1464-# CONFIG_E1000 is not set
1465+CONFIG_E1000=y
1466+CONFIG_E1000_NAPI=y
1467 # CONFIG_NS83820 is not set
1468 # CONFIG_HAMACHI is not set
1469+# CONFIG_YELLOWFIN is not set
1470 # CONFIG_R8169 is not set
1471 # CONFIG_SK98LIN is not set
1472 # CONFIG_TIGON3 is not set
1473+
1474+#
1475+# Ethernet (10000 Mbit)
1476+#
1477+# CONFIG_IXGB is not set
1478 # CONFIG_FDDI is not set
1479+# CONFIG_HIPPI is not set
1480 # CONFIG_PPP is not set
1481 # CONFIG_SLIP is not set
1482
1483@@ -335,6 +388,8 @@
1484 #
1485 # Token Ring devices (depends on LLC=y)
1486 #
1487+# CONFIG_RCPCI is not set
1488+# CONFIG_SHAPER is not set
1489
1490 #
1491 # Wan interfaces
1492@@ -371,6 +426,7 @@
1493 CONFIG_BLK_DEV_IDECD=y
1494 # CONFIG_BLK_DEV_IDEFLOPPY is not set
1495 # CONFIG_IDE_TASK_IOCTL is not set
1496+# CONFIG_IDE_TASKFILE_IO is not set
1497
1498 #
1499 # IDE chipset support/bugfixes
1500@@ -379,11 +435,13 @@
1501 # CONFIG_BLK_DEV_GENERIC is not set
1502 # CONFIG_IDEPCI_SHARE_IRQ is not set
1503 CONFIG_BLK_DEV_IDEDMA_PCI=y
1504+# CONFIG_BLK_DEV_IDE_TCQ is not set
1505 # CONFIG_BLK_DEV_OFFBOARD is not set
1506 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
1507 CONFIG_IDEDMA_PCI_AUTO=y
1508 # CONFIG_IDEDMA_ONLYDISK is not set
1509 CONFIG_BLK_DEV_IDEDMA=y
1510+# CONFIG_IDEDMA_PCI_WIP is not set
1511 CONFIG_BLK_DEV_ADMA=y
1512 # CONFIG_BLK_DEV_AEC62XX is not set
1513 # CONFIG_BLK_DEV_ALI15X3 is not set
1514@@ -391,11 +449,13 @@
1515 CONFIG_BLK_DEV_CMD64X=y
1516 # CONFIG_BLK_DEV_TRIFLEX is not set
1517 # CONFIG_BLK_DEV_CY82C693 is not set
1518+# CONFIG_BLK_DEV_CS5520 is not set
1519 # CONFIG_BLK_DEV_HPT34X is not set
1520 # CONFIG_BLK_DEV_HPT366 is not set
1521 # CONFIG_BLK_DEV_SC1200 is not set
1522 # CONFIG_BLK_DEV_PIIX is not set
1523 # CONFIG_BLK_DEV_NS87415 is not set
1524+# CONFIG_BLK_DEV_OPTI621 is not set
1525 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
1526 # CONFIG_BLK_DEV_PDC202XX_NEW is not set
1527 # CONFIG_BLK_DEV_SVWKS is not set
1528@@ -408,11 +468,16 @@
1529 # CONFIG_IDEDMA_IVB is not set
1530
1531 #
1532-# SCSI support
1533+# SCSI device support
1534 #
1535 # CONFIG_SCSI is not set
1536
1537 #
1538+# IEEE 1394 (FireWire) support (EXPERIMENTAL)
1539+#
1540+# CONFIG_IEEE1394 is not set
1541+
1542+#
1543 # I2O device support
1544 #
1545 # CONFIG_I2O is not set
1546@@ -450,11 +515,16 @@
1547 #
1548 # Serial drivers
1549 #
1550+CONFIG_SERIAL_8250=y
1551+CONFIG_SERIAL_8250_CONSOLE=y
1552+# CONFIG_SERIAL_8250_EXTENDED is not set
1553
1554 #
1555 # Non-8250 serial port support
1556 #
1557 # CONFIG_SERIAL_DZ is not set
1558+CONFIG_SERIAL_CORE=y
1559+CONFIG_SERIAL_CORE_CONSOLE=y
1560 CONFIG_UNIX98_PTYS=y
1561 CONFIG_UNIX98_PTY_COUNT=256
1562
1563@@ -470,6 +540,7 @@
1564 #
1565 # I2C Hardware Sensors Chip support
1566 #
1567+# CONFIG_I2C_SENSOR is not set
1568
1569 #
1570 # L3 serial bus support
1571@@ -522,6 +593,9 @@
1572 #
1573 # CONFIG_VIDEO_PMS is not set
1574 # CONFIG_VIDEO_CPIA is not set
1575+# CONFIG_VIDEO_STRADIS is not set
1576+# CONFIG_VIDEO_HEXIUM_ORION is not set
1577+# CONFIG_VIDEO_HEXIUM_GEMINI is not set
1578
1579 #
1580 # Radio Adapters
1581@@ -534,6 +608,7 @@
1582 # Digital Video Broadcasting Devices
1583 #
1584 # CONFIG_DVB is not set
1585+# CONFIG_VIDEO_BTCX is not set
1586
1587 #
1588 # File systems
1589@@ -567,16 +642,25 @@
1590 # Pseudo filesystems
1591 #
1592 CONFIG_PROC_FS=y
1593+# CONFIG_DEVFS_FS is not set
1594 CONFIG_DEVPTS_FS=y
1595+# CONFIG_DEVPTS_FS_XATTR is not set
1596 CONFIG_TMPFS=y
1597 CONFIG_RAMFS=y
1598
1599 #
1600 # Miscellaneous filesystems
1601 #
1602+# CONFIG_ADFS_FS is not set
1603+# CONFIG_AFFS_FS is not set
1604+# CONFIG_HFS_FS is not set
1605+# CONFIG_BEFS_FS is not set
1606+# CONFIG_BFS_FS is not set
1607+# CONFIG_EFS_FS is not set
1608 # CONFIG_JFFS_FS is not set
1609 CONFIG_JFFS2_FS=y
1610 CONFIG_JFFS2_FS_DEBUG=0
1611+# CONFIG_JFFS2_FS_NAND is not set
1612 # CONFIG_CRAMFS is not set
1613 # CONFIG_VXFS_FS is not set
1614 # CONFIG_HPFS_FS is not set
1615@@ -589,15 +673,19 @@
1616 #
1617 CONFIG_NFS_FS=y
1618 # CONFIG_NFS_V3 is not set
1619+# CONFIG_NFS_V4 is not set
1620 # CONFIG_NFSD is not set
1621 CONFIG_ROOT_NFS=y
1622 CONFIG_LOCKD=y
1623 # CONFIG_EXPORTFS is not set
1624+CONFIG_SUNRPC=y
1625+# CONFIG_SUNRPC_GSS is not set
1626 # CONFIG_SMB_FS is not set
1627 # CONFIG_CIFS is not set
1628 # CONFIG_NCP_FS is not set
1629 # CONFIG_CODA_FS is not set
1630-CONFIG_SUNRPC=y
1631+# CONFIG_INTERMEZZO_FS is not set
1632+# CONFIG_AFS_FS is not set
1633
1634 #
1635 # Partition Types
1636@@ -614,6 +702,7 @@
1637 # CONFIG_SOLARIS_X86_PARTITION is not set
1638 # CONFIG_UNIXWARE_DISKLABEL is not set
1639 # CONFIG_LDM_PARTITION is not set
1640+# CONFIG_NEC98_PARTITION is not set
1641 # CONFIG_SGI_PARTITION is not set
1642 # CONFIG_ULTRIX_PARTITION is not set
1643 # CONFIG_SUN_PARTITION is not set
1644@@ -625,13 +714,6 @@
1645 # CONFIG_FB is not set
1646
1647 #
1648-# Console display driver support
1649-#
1650-# CONFIG_VGA_CONSOLE is not set
1651-# CONFIG_MDA_CONSOLE is not set
1652-CONFIG_DUMMY_CONSOLE=y
1653-
1654-#
1655 # Sound
1656 #
1657 # CONFIG_SOUND is not set
1658@@ -654,6 +736,7 @@
1659 # USB support
1660 #
1661 # CONFIG_USB is not set
1662+# CONFIG_USB_GADGET is not set
1663
1664 #
1665 # Bluetooth support
1666@@ -664,7 +747,7 @@
1667 # Kernel hacking
1668 #
1669 CONFIG_FRAME_POINTER=y
1670-CONFIG_DEBUG_USER=y
1671+# CONFIG_DEBUG_USER is not set
1672 # CONFIG_DEBUG_INFO is not set
1673 CONFIG_DEBUG_KERNEL=y
1674 # CONFIG_DEBUG_SLAB is not set
1675@@ -673,7 +756,6 @@
1676 # CONFIG_DEBUG_WAITQ is not set
1677 CONFIG_DEBUG_BUGVERBOSE=y
1678 CONFIG_DEBUG_ERRORS=y
1679-# CONFIG_KALLSYMS is not set
1680 CONFIG_DEBUG_LL=y
1681
1682 #
1683diff -Nru a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
1684--- a/arch/arm/kernel/apm.c Wed Mar 26 05:00:46 2003
1685+++ b/arch/arm/kernel/apm.c Sun Aug 31 16:14:08 2003
1686@@ -26,6 +26,7 @@
1687 #include <linux/init.h>
1688 #include <linux/completion.h>
1689
1690+#include <asm/apm.h> /* apm_power_info */
1691 #include <asm/system.h>
1692
1693 /*
1694@@ -93,18 +94,7 @@
1695
1696 static const char driver_version[] = "1.13"; /* no spaces */
1697
1698-/*
1699- * This structure gets filled in by the machine specific 'get_power_status'
1700- * implementation. Any fields which are not set default to a safe value.
1701- */
1702-struct apm_power_info {
1703- unsigned char ac_line_status;
1704- unsigned char battery_status;
1705- unsigned char battery_flag;
1706- unsigned char battery_life;
1707- int time;
1708- int units;
1709-};
1710+
1711
1712 /*
1713 * Compatibility cruft until the IPAQ people move over to the new
1714@@ -388,18 +378,18 @@
1715 }
1716
1717 static struct file_operations apm_bios_fops = {
1718- owner: THIS_MODULE,
1719- read: apm_read,
1720- poll: apm_poll,
1721- ioctl: apm_ioctl,
1722- open: apm_open,
1723- release: apm_release,
1724+ .owner = THIS_MODULE,
1725+ .read = apm_read,
1726+ .poll = apm_poll,
1727+ .ioctl = apm_ioctl,
1728+ .open = apm_open,
1729+ .release = apm_release,
1730 };
1731
1732 static struct miscdevice apm_device = {
1733- minor: APM_MINOR_DEV,
1734- name: "apm_bios",
1735- fops: &apm_bios_fops
1736+ .minor = APM_MINOR_DEV,
1737+ .name = "apm_bios",
1738+ .fops = &apm_bios_fops
1739 };
1740
1741
1742diff -Nru a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
1743--- a/arch/arm/kernel/bios32.c Thu Jul 31 16:47:19 2003
1744+++ b/arch/arm/kernel/bios32.c Sun Aug 24 06:12:42 2003
1745@@ -263,7 +263,7 @@
1746 void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
1747 {
1748 if (debug_pci)
1749- printk("PCI: Assigning IRQ %02d to %s\n", irq, dev->dev.name);
1750+ printk("PCI: Assigning IRQ %02d to %s\n", irq, pci_name(dev));
1751 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
1752 }
1753
1754@@ -362,6 +362,19 @@
1755 isa_bridge = dev;
1756 break;
1757 #endif
1758+ case PCI_CLASS_BRIDGE_PCI:
1759+ pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &status);
1760+ status |= PCI_BRIDGE_CTL_PARITY|PCI_BRIDGE_CTL_MASTER_ABORT;
1761+ status &= ~(PCI_BRIDGE_CTL_BUS_RESET|PCI_BRIDGE_CTL_FAST_BACK);
1762+ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, status);
1763+ break;
1764+
1765+ case PCI_CLASS_BRIDGE_CARDBUS:
1766+ pci_read_config_word(dev, PCI_CB_BRIDGE_CONTROL, &status);
1767+ status |= PCI_CB_BRIDGE_CTL_PARITY|PCI_CB_BRIDGE_CTL_MASTER_ABORT;
1768+ pci_write_config_word(dev, PCI_CB_BRIDGE_CONTROL, status);
1769+ break;
1770+ }
1771 }
1772
1773 /*
1774diff -Nru a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
1775--- a/arch/arm/kernel/ecard.c Fri Aug 15 15:22:53 2003
1776+++ b/arch/arm/kernel/ecard.c Sun Aug 24 05:44:40 2003
1777@@ -896,7 +896,7 @@
1778 static ssize_t ecard_show_vendor(struct device *dev, char *buf)
1779 {
1780 struct expansion_card *ec = ECARD_DEV(dev);
1781- return sprintf(buf, "%u\n", ec->manufacturer);
1782+ return sprintf(buf, "%u\n", ec->cid.manufacturer);
1783 }
1784
1785 static DEVICE_ATTR(vendor, S_IRUGO, ecard_show_vendor, NULL);
1786@@ -904,7 +904,7 @@
1787 static ssize_t ecard_show_device(struct device *dev, char *buf)
1788 {
1789 struct expansion_card *ec = ECARD_DEV(dev);
1790- return sprintf(buf, "%u\n", ec->product);
1791+ return sprintf(buf, "%u\n", ec->cid.product);
1792 }
1793
1794 static DEVICE_ATTR(device, S_IRUGO, ecard_show_device, NULL);
1795diff -Nru a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
1796--- a/arch/arm/kernel/entry-header.S Tue Mar 4 16:47:50 2003
1797+++ b/arch/arm/kernel/entry-header.S Sun Aug 24 06:17:52 2003
1798@@ -63,13 +63,7 @@
1799 #define S_OFF 8
1800
1801 .macro set_cpsr_c, reg, mode
1802-#if 1
1803- /* broken binutils */
1804- mov \reg, \mode
1805- msr cpsr_c, \reg
1806-#else
1807 msr cpsr_c, \mode
1808-#endif
1809 .endm
1810
1811 .macro disable_irq, temp
1812diff -Nru a/arch/arm/kernel/pm.c b/arch/arm/kernel/pm.c
1813--- a/arch/arm/kernel/pm.c Sat Jun 21 03:42:03 2003
1814+++ b/arch/arm/kernel/pm.c Sun Aug 24 05:40:01 2003
1815@@ -36,23 +36,7 @@
1816 if (ret != 0)
1817 goto out;
1818
1819- /*
1820- * Tell LDM devices we're going to suspend.
1821- */
1822- ret = device_suspend(4, SUSPEND_NOTIFY);
1823- if (ret != 0)
1824- goto resume_legacy;
1825-
1826- /*
1827- * Disable, devices, and save state.
1828- */
1829- device_suspend(4, SUSPEND_DISABLE);
1830- device_suspend(4, SUSPEND_SAVE_STATE);
1831-
1832- /*
1833- * Tell devices that they're going to be powered off.
1834- */
1835- device_suspend(4, SUSPEND_POWER_DOWN);
1836+ device_suspend(3);
1837
1838 local_irq_disable();
1839 leds_event(led_stop);
1840@@ -62,21 +46,8 @@
1841 leds_event(led_start);
1842 local_irq_enable();
1843
1844- /*
1845- * Tell devices that they now have power.
1846- */
1847- device_resume(RESUME_POWER_ON);
1848-
1849- /*
1850- * Resume LDM devices.
1851- */
1852- device_resume(RESUME_RESTORE_STATE);
1853- device_resume(RESUME_ENABLE);
1854+ device_resume();
1855
1856- resume_legacy:
1857- /*
1858- * Resume "legacy" devices.
1859- */
1860 pm_send_all(PM_RESUME, (void *)0);
1861
1862 out:
1863diff -Nru a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
1864--- a/arch/arm/kernel/vmlinux.lds.S Mon Aug 4 20:39:42 2003
1865+++ b/arch/arm/kernel/vmlinux.lds.S Sun Aug 24 04:26:29 2003
1866@@ -1,21 +1,134 @@
1867-#include <linux/config.h>
1868-
1869-#ifdef CONFIG_CPU_26
1870-
1871-#ifdef CONFIG_ROM_KERNEL
1872-
1873-#include "vmlinux-armo-rom.lds.in"
1874-
1875+/* ld script to make ARM Linux kernel
1876+ * taken from the i386 version by Russell King
1877+ * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
1878+ */
1879+
1880+#include <asm-generic/vmlinux.lds.h>
1881+
1882+OUTPUT_ARCH(arm)
1883+ENTRY(stext)
1884+#ifndef __ARMEB__
1885+jiffies = jiffies_64;
1886 #else
1887-
1888-#include "vmlinux-armo.lds.in"
1889-
1890-#endif
1891-
1892-#endif
1893-
1894-#ifdef CONFIG_CPU_32
1895-
1896-#include "vmlinux-armv.lds.in"
1897-
1898+jiffies = jiffies_64 + 4;
1899 #endif
1900+SECTIONS
1901+{
1902+ . = TEXTADDR;
1903+ .init : { /* Init code and data */
1904+ _stext = .;
1905+ __init_begin = .;
1906+ _sinittext = .;
1907+ *(.init.text)
1908+ _einittext = .;
1909+ __proc_info_begin = .;
1910+ *(.proc.info)
1911+ __proc_info_end = .;
1912+ __arch_info_begin = .;
1913+ *(.arch.info)
1914+ __arch_info_end = .;
1915+ __tagtable_begin = .;
1916+ *(.taglist)
1917+ __tagtable_end = .;
1918+ *(.init.data)
1919+ . = ALIGN(16);
1920+ __setup_start = .;
1921+ *(.init.setup)
1922+ __setup_end = .;
1923+ __early_begin = .;
1924+ *(__early_param)
1925+ __early_end = .;
1926+ __start___param = .;
1927+ *(__param)
1928+ __stop___param = .;
1929+ __initcall_start = .;
1930+ *(.initcall1.init)
1931+ *(.initcall2.init)
1932+ *(.initcall3.init)
1933+ *(.initcall4.init)
1934+ *(.initcall5.init)
1935+ *(.initcall6.init)
1936+ *(.initcall7.init)
1937+ __initcall_end = .;
1938+ __con_initcall_start = .;
1939+ *(.con_initcall.init)
1940+ __con_initcall_end = .;
1941+ __security_initcall_start = .;
1942+ *(.security_initcall.init)
1943+ __security_initcall_end = .;
1944+ . = ALIGN(32);
1945+ __initramfs_start = .;
1946+ usr/built-in.o(.init.ramfs)
1947+ __initramfs_end = .;
1948+ . = ALIGN(4096);
1949+ __init_end = .;
1950+ }
1951+
1952+ /DISCARD/ : { /* Exit code and data */
1953+ *(.exit.text)
1954+ *(.exit.data)
1955+ *(.exitcall.exit)
1956+ }
1957+
1958+ .text : { /* Real text segment */
1959+ _text = .; /* Text and read-only data */
1960+ *(.text)
1961+ *(.fixup)
1962+ *(.gnu.warning)
1963+ *(.rodata)
1964+ *(.rodata.*)
1965+ *(.glue_7)
1966+ *(.glue_7t)
1967+ *(.got) /* Global offset table */
1968+
1969+ _etext = .; /* End of text section */
1970+ }
1971+
1972+ . = ALIGN(16);
1973+ __ex_table : { /* Exception table */
1974+ __start___ex_table = .;
1975+ *(__ex_table)
1976+ __stop___ex_table = .;
1977+ }
1978+
1979+ RODATA
1980+
1981+ . = ALIGN(8192);
1982+
1983+ .data : {
1984+ /*
1985+ * first, the init task union, aligned
1986+ * to an 8192 byte boundary.
1987+ */
1988+ *(.init.task)
1989+
1990+ /*
1991+ * then the cacheline aligned data
1992+ */
1993+ . = ALIGN(32);
1994+ *(.data.cacheline_aligned)
1995+
1996+ /*
1997+ * and the usual data section
1998+ */
1999+ *(.data)
2000+ CONSTRUCTORS
2001+
2002+ _edata = .;
2003+ }
2004+
2005+ .bss : {
2006+ __bss_start = .; /* BSS */
2007+ *(.bss)
2008+ *(COMMON)
2009+ _end = . ;
2010+ }
2011+ /* Stabs debugging sections. */
2012+ .stab 0 : { *(.stab) }
2013+ .stabstr 0 : { *(.stabstr) }
2014+ .stab.excl 0 : { *(.stab.excl) }
2015+ .stab.exclstr 0 : { *(.stab.exclstr) }
2016+ .stab.index 0 : { *(.stab.index) }
2017+ .stab.indexstr 0 : { *(.stab.indexstr) }
2018+ .comment 0 : { *(.comment) }
2019+}
2020diff -Nru a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c
2021--- a/arch/arm/mach-footbridge/netwinder-pci.c Thu Jul 31 16:47:19 2003
2022+++ b/arch/arm/mach-footbridge/netwinder-pci.c Sun Aug 24 04:37:15 2003
2023@@ -36,8 +36,8 @@
2024 return IRQ_NETWINDER_ETHER10;
2025
2026 default:
2027- printk(KERN_ERR "PCI: unknown device in slot %s: %s\n",
2028- pci_name(dev), dev->dev.name);
2029+ printk(KERN_ERR "PCI: unknown device in slot %s\n",
2030+ pci_name(dev));
2031 return 0;
2032 }
2033 }
2034diff -Nru a/arch/arm/mach-iop3xx/iop321-time.c b/arch/arm/mach-iop3xx/iop321-time.c
2035--- a/arch/arm/mach-iop3xx/iop321-time.c Tue Apr 15 08:12:47 2003
2036+++ b/arch/arm/mach-iop3xx/iop321-time.c Wed Aug 13 16:46:20 2003
2037@@ -51,7 +51,8 @@
2038 return usec;
2039 }
2040
2041-static void iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2042+static irqreturn_t
2043+iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2044 {
2045 u32 tisr;
2046
2047@@ -62,6 +63,8 @@
2048 asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (tisr));
2049
2050 do_timer(regs);
2051+
2052+ return IRQ_HANDLED;
2053 }
2054
2055 extern unsigned long (*gettimeoffset)(void);
2056diff -Nru a/arch/arm/mach-iop3xx/iq80310-time.c b/arch/arm/mach-iop3xx/iq80310-time.c
2057--- a/arch/arm/mach-iop3xx/iq80310-time.c Mon Apr 21 15:43:40 2003
2058+++ b/arch/arm/mach-iop3xx/iq80310-time.c Wed Aug 13 16:46:20 2003
2059@@ -88,7 +88,8 @@
2060 }
2061
2062
2063-static void iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2064+static irqreturn_t
2065+iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2066 {
2067 volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
2068
2069@@ -96,21 +97,9 @@
2070 *timer_en &= ~2;
2071 *timer_en |= 2;
2072
2073- /*
2074- * AHEM..HACK
2075- *
2076- * Since the timer interrupt is cascaded through the CPLD and
2077- * the 80312 and the demux code calls do_IRQ, the irq count is
2078- * going to be at least 2 when we get here and this will cause the
2079- * kernel to increment the system tick counter even if we're
2080- * idle. This causes it to look like there's always 100% system
2081- * time, which is not the case. To get around it, we just decrement
2082- * the IRQ count before calling do_timer. We increment it again
2083- * b/c otherwise it will go negative and than bad things happen.
2084- *
2085- * -DS
2086- */
2087 do_timer(regs);
2088+
2089+ return IRQ_HANDLED;
2090 }
2091
2092 extern unsigned long (*gettimeoffset)(void);
2093@@ -126,7 +115,9 @@
2094 volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
2095
2096 gettimeoffset = iq80310_gettimeoffset;
2097+
2098 setup_irq(IRQ_IQ80310_TIMER, &timer_irq);
2099+
2100 *timer_en = 0;
2101 iq80310_write_timer(LATCH);
2102 *timer_en |= 2;
2103diff -Nru a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c
2104--- a/arch/arm/mach-sa1100/leds-simpad.c Mon Feb 4 23:53:46 2002
2105+++ b/arch/arm/mach-sa1100/leds-simpad.c Thu Aug 7 11:40:46 2003
2106@@ -9,6 +9,7 @@
2107 #include <asm/hardware.h>
2108 #include <asm/leds.h>
2109 #include <asm/system.h>
2110+#include <asm/arch/simpad.h>
2111
2112 #include "leds.h"
2113
2114diff -Nru a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
2115--- a/arch/arm/mach-sa1100/leds.c Wed Dec 11 06:27:36 2002
2116+++ b/arch/arm/mach-sa1100/leds.c Thu Aug 7 11:40:46 2003
2117@@ -41,6 +41,8 @@
2118 leds_event = adsbitsy_leds_event;
2119 if (machine_is_pt_system3())
2120 leds_event = system3_leds_event;
2121+ if (machine_is_simpad())
2122+ leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */
2123
2124 leds_event(led_start);
2125 return 0;
2126diff -Nru a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
2127--- a/arch/arm/mach-sa1100/leds.h Wed Dec 11 06:27:36 2002
2128+++ b/arch/arm/mach-sa1100/leds.h Thu Aug 7 11:40:46 2003
2129@@ -11,3 +11,4 @@
2130 extern void graphicsmaster_leds_event(led_event_t evt);
2131 extern void adsbitsy_leds_event(led_event_t evt);
2132 extern void system3_leds_event(led_event_t evt);
2133+extern void simpad_leds_event(led_event_t evt);
2134diff -Nru a/arch/arm/vmlinux-armo.lds.in b/arch/arm/vmlinux-armo.lds.in
2135--- a/arch/arm/vmlinux-armo.lds.in Wed Jun 11 17:40:04 2003
2136+++ /dev/null Wed Dec 31 16:00:00 1969
2137@@ -1,114 +0,0 @@
2138-/* ld script to make ARM Linux kernel
2139- * taken from the i386 version by Russell King
2140- * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
2141- */
2142-
2143-#include <asm-generic/vmlinux.lds.h>
2144-
2145-OUTPUT_ARCH(arm)
2146-ENTRY(stext)
2147-jiffies = jiffies_64;
2148-SECTIONS
2149-{
2150- . = TEXTADDR;
2151- .init : { /* Init code and data */
2152- _stext = .;
2153- __init_begin = .;
2154- _sinittext = .;
2155- *(.init.text)
2156- _einittext = .;
2157- __proc_info_begin = .;
2158- *(.proc.info)
2159- __proc_info_end = .;
2160- __arch_info_begin = .;
2161- *(.arch.info)
2162- __arch_info_end = .;
2163- __tagtable_begin = .;
2164- *(.taglist)
2165- __tagtable_end = .;
2166- *(.init.data)
2167- . = ALIGN(16);
2168- __setup_start = .;
2169- *(.init.setup)
2170- __setup_end = .;
2171- __initcall_start = .;
2172- *(.initcall1.init)
2173- *(.initcall2.init)
2174- *(.initcall3.init)
2175- *(.initcall4.init)
2176- *(.initcall5.init)
2177- *(.initcall6.init)
2178- *(.initcall7.init)
2179- __initcall_end = .;
2180- __con_initcall_start = .;
2181- *(.con_initcall.init)
2182- __con_initcall_end = .;
2183- SECURITY_INIT
2184- . = ALIGN(32768);
2185- __init_end = .;
2186- }
2187-
2188- .init.task : {
2189- *(.init.task)
2190- }
2191-
2192- /DISCARD/ : { /* Exit code and data */
2193- *(.exit.text)
2194- *(.exit.data)
2195- *(.exitcall.exit)
2196- }
2197-
2198- .text : { /* Real text segment */
2199- _text = .; /* Text and read-only data */
2200- *(.text)
2201- *(.fixup)
2202- *(.gnu.warning)
2203- *(.rodata)
2204- *(.rodata.*)
2205- *(.glue_7)
2206- *(.glue_7t)
2207- *(.got) /* Global offset table */
2208-
2209- _etext = .; /* End of text section */
2210- }
2211-
2212- . = ALIGN(16);
2213- __ex_table : { /* Exception table */
2214- __start___ex_table = .;
2215- *(__ex_table)
2216- __stop___ex_table = .;
2217- }
2218-
2219- RODATA
2220-
2221- .data : {
2222- /*
2223- * The cacheline aligned data
2224- */
2225- . = ALIGN(32);
2226- *(.data.cacheline_aligned)
2227-
2228- /*
2229- * and the usual data section
2230- */
2231- *(.data)
2232- CONSTRUCTORS
2233-
2234- _edata = .;
2235- }
2236-
2237- .bss : {
2238- __bss_start = .; /* BSS */
2239- *(.bss)
2240- *(COMMON)
2241- _end = . ;
2242- }
2243- /* Stabs debugging sections. */
2244- .stab 0 : { *(.stab) }
2245- .stabstr 0 : { *(.stabstr) }
2246- .stab.excl 0 : { *(.stab.excl) }
2247- .stab.exclstr 0 : { *(.stab.exclstr) }
2248- .stab.index 0 : { *(.stab.index) }
2249- .stab.indexstr 0 : { *(.stab.indexstr) }
2250- .comment 0 : { *(.comment) }
2251-}
2252diff -Nru a/arch/arm/vmlinux-armv.lds.in b/arch/arm/vmlinux-armv.lds.in
2253--- a/arch/arm/vmlinux-armv.lds.in Wed Jun 18 16:33:31 2003
2254+++ /dev/null Wed Dec 31 16:00:00 1969
2255@@ -1,134 +0,0 @@
2256-/* ld script to make ARM Linux kernel
2257- * taken from the i386 version by Russell King
2258- * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
2259- */
2260-
2261-#include <asm-generic/vmlinux.lds.h>
2262-
2263-OUTPUT_ARCH(arm)
2264-ENTRY(stext)
2265-#ifndef __ARMEB__
2266-jiffies = jiffies_64;
2267-#else
2268-jiffies = jiffies_64 + 4;
2269-#endif
2270-SECTIONS
2271-{
2272- . = TEXTADDR;
2273- .init : { /* Init code and data */
2274- _stext = .;
2275- __init_begin = .;
2276- _sinittext = .;
2277- *(.init.text)
2278- _einittext = .;
2279- __proc_info_begin = .;
2280- *(.proc.info)
2281- __proc_info_end = .;
2282- __arch_info_begin = .;
2283- *(.arch.info)
2284- __arch_info_end = .;
2285- __tagtable_begin = .;
2286- *(.taglist)
2287- __tagtable_end = .;
2288- *(.init.data)
2289- . = ALIGN(16);
2290- __setup_start = .;
2291- *(.init.setup)
2292- __setup_end = .;
2293- __early_begin = .;
2294- *(__early_param)
2295- __early_end = .;
2296- __start___param = .;
2297- *(__param)
2298- __stop___param = .;
2299- __initcall_start = .;
2300- *(.initcall1.init)
2301- *(.initcall2.init)
2302- *(.initcall3.init)
2303- *(.initcall4.init)
2304- *(.initcall5.init)
2305- *(.initcall6.init)
2306- *(.initcall7.init)
2307- __initcall_end = .;
2308- __con_initcall_start = .;
2309- *(.con_initcall.init)
2310- __con_initcall_end = .;
2311- __security_initcall_start = .;
2312- *(.security_initcall.init)
2313- __security_initcall_end = .;
2314- . = ALIGN(32);
2315- __initramfs_start = .;
2316- usr/built-in.o(.init.ramfs)
2317- __initramfs_end = .;
2318- . = ALIGN(4096);
2319- __init_end = .;
2320- }
2321-
2322- /DISCARD/ : { /* Exit code and data */
2323- *(.exit.text)
2324- *(.exit.data)
2325- *(.exitcall.exit)
2326- }
2327-
2328- .text : { /* Real text segment */
2329- _text = .; /* Text and read-only data */
2330- *(.text)
2331- *(.fixup)
2332- *(.gnu.warning)
2333- *(.rodata)
2334- *(.rodata.*)
2335- *(.glue_7)
2336- *(.glue_7t)
2337- *(.got) /* Global offset table */
2338-
2339- _etext = .; /* End of text section */
2340- }
2341-
2342- . = ALIGN(16);
2343- __ex_table : { /* Exception table */
2344- __start___ex_table = .;
2345- *(__ex_table)
2346- __stop___ex_table = .;
2347- }
2348-
2349- RODATA
2350-
2351- . = ALIGN(8192);
2352-
2353- .data : {
2354- /*
2355- * first, the init task union, aligned
2356- * to an 8192 byte boundary.
2357- */
2358- *(.init.task)
2359-
2360- /*
2361- * then the cacheline aligned data
2362- */
2363- . = ALIGN(32);
2364- *(.data.cacheline_aligned)
2365-
2366- /*
2367- * and the usual data section
2368- */
2369- *(.data)
2370- CONSTRUCTORS
2371-
2372- _edata = .;
2373- }
2374-
2375- .bss : {
2376- __bss_start = .; /* BSS */
2377- *(.bss)
2378- *(COMMON)
2379- _end = . ;
2380- }
2381- /* Stabs debugging sections. */
2382- .stab 0 : { *(.stab) }
2383- .stabstr 0 : { *(.stabstr) }
2384- .stab.excl 0 : { *(.stab.excl) }
2385- .stab.exclstr 0 : { *(.stab.exclstr) }
2386- .stab.index 0 : { *(.stab.index) }
2387- .stab.indexstr 0 : { *(.stab.indexstr) }
2388- .comment 0 : { *(.comment) }
2389-}
2390diff -Nru a/arch/arm26/Kconfig b/arch/arm26/Kconfig
2391--- a/arch/arm26/Kconfig Sat Aug 2 14:26:16 2003
2392+++ b/arch/arm26/Kconfig Sun Aug 31 16:14:22 2003
2393@@ -146,39 +146,6 @@
2394 You may say N here if you are going to load the Acorn FPEmulator
2395 early in the bootup.
2396
2397-choice
2398- prompt "Kernel core (/proc/kcore) format"
2399- default KCORE_ELF
2400-
2401-config KCORE_ELF
2402- bool "ELF"
2403- ---help---
2404- If you enabled support for /proc file system then the file
2405- /proc/kcore will contain the kernel core image. This can be used
2406- in gdb:
2407-
2408- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
2409-
2410- You have two choices here: ELF and A.OUT. Selecting ELF will make
2411- /proc/kcore appear in ELF core format as defined by the Executable
2412- and Linking Format specification. Selecting A.OUT will choose the
2413- old "a.out" format which may be necessary for some old versions
2414- of binutils or on some architectures.
2415-
2416- This is especially useful if you have compiled the kernel with the
2417- "-g" option to preserve debugging information. It is mainly used
2418- for examining kernel data structures on the live kernel so if you
2419- don't understand what this means or are not a kernel hacker, just
2420- leave it at its default value ELF.
2421-
2422-config KCORE_AOUT
2423- bool "A.OUT"
2424- help
2425- Not necessary unless you're using a very out-of-date binutils
2426- version. You probably want KCORE_ELF.
2427-
2428-endchoice
2429-
2430 source "fs/Kconfig.binfmt"
2431
2432 config PREEMPT
2433diff -Nru a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c
2434--- a/arch/arm26/kernel/setup.c Thu Jul 3 15:03:57 2003
2435+++ b/arch/arm26/kernel/setup.c Sun Aug 31 16:14:08 2003
2436@@ -304,12 +304,12 @@
2437
2438 #if defined(CONFIG_DUMMY_CONSOLE)
2439 struct screen_info screen_info = {
2440- orig_video_lines: 30,
2441- orig_video_cols: 80,
2442- orig_video_mode: 0,
2443- orig_video_ega_bx: 0,
2444- orig_video_isVGA: 1,
2445- orig_video_points: 8
2446+ .orig_video_lines = 30,
2447+ .orig_video_cols = 80,
2448+ .orig_video_mode = 0,
2449+ .orig_video_ega_bx = 0,
2450+ .orig_video_isVGA = 1,
2451+ .orig_video_points = 8
2452 };
2453
2454 static int __init parse_tag_videotext(const struct tag *tag)
2455diff -Nru a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
2456--- a/arch/cris/arch-v10/drivers/eeprom.c Fri Jul 4 03:27:37 2003
2457+++ b/arch/cris/arch-v10/drivers/eeprom.c Tue Aug 26 09:25:41 2003
2458@@ -441,9 +441,9 @@
2459 static int eeprom_open(struct inode * inode, struct file * file)
2460 {
2461
2462- if(minor(inode->i_rdev) != EEPROM_MINOR_NR)
2463+ if(iminor(inode) != EEPROM_MINOR_NR)
2464 return -ENXIO;
2465- if(major(inode->i_rdev) != EEPROM_MAJOR_NR)
2466+ if(imajor(inode) != EEPROM_MAJOR_NR)
2467 return -ENXIO;
2468
2469 if( eeprom.size > 0 )
2470diff -Nru a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
2471--- a/arch/cris/arch-v10/drivers/gpio.c Fri Jul 4 03:27:37 2003
2472+++ b/arch/cris/arch-v10/drivers/gpio.c Tue Aug 26 09:25:40 2003
2473@@ -386,7 +386,7 @@
2474 gpio_open(struct inode *inode, struct file *filp)
2475 {
2476 struct gpio_private *priv;
2477- int p = minor(inode->i_rdev);
2478+ int p = iminor(inode);
2479
2480 if (p > GPIO_MINOR_LAST)
2481 return -EINVAL;
2482diff -Nru a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
2483--- a/arch/cris/arch-v10/drivers/pcf8563.c Wed Jul 23 07:38:45 2003
2484+++ b/arch/cris/arch-v10/drivers/pcf8563.c Sun Aug 31 16:14:08 2003
2485@@ -57,10 +57,10 @@
2486 int pcf8563_release(struct inode *, struct file *);
2487
2488 static struct file_operations pcf8563_fops = {
2489- owner: THIS_MODULE,
2490- ioctl: pcf8563_ioctl,
2491- open: pcf8563_open,
2492- release: pcf8563_release,
2493+ .owner = THIS_MODULE,
2494+ .ioctl = pcf8563_ioctl,
2495+ .open = pcf8563_open,
2496+ .release = pcf8563_release,
2497 };
2498
2499 unsigned char
2500diff -Nru a/arch/h8300/Kconfig b/arch/h8300/Kconfig
2501--- a/arch/h8300/Kconfig Thu Aug 21 08:42:22 2003
2502+++ b/arch/h8300/Kconfig Sun Aug 31 16:14:22 2003
2503@@ -177,13 +177,6 @@
2504
2505 menu "Executable file formats"
2506
2507-config KCORE_AOUT
2508- bool
2509- default y
2510-
2511-config KCORE_ELF
2512- default y
2513-
2514 source "fs/Kconfig.binfmt"
2515
2516 endmenu
2517diff -Nru a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
2518--- a/arch/h8300/kernel/setup.c Sun Jul 27 20:40:08 2003
2519+++ b/arch/h8300/kernel/setup.c Sun Aug 31 16:14:08 2003
2520@@ -91,12 +91,12 @@
2521 }
2522
2523 static const struct console gdb_console = {
2524- name: "gdb_con",
2525- write: gdb_console_output,
2526- device: NULL,
2527- setup: gdb_console_setup,
2528- flags: CON_PRINTBUFFER,
2529- index: -1,
2530+ .name = "gdb_con",
2531+ .write = gdb_console_output,
2532+ .device = NULL,
2533+ .setup = gdb_console_setup,
2534+ .flags = CON_PRINTBUFFER,
2535+ .index = -1,
2536 };
2537 #endif
2538
2539@@ -260,8 +260,8 @@
2540 }
2541
2542 struct seq_operations cpuinfo_op = {
2543- start: c_start,
2544- next: c_next,
2545- stop: c_stop,
2546- show: show_cpuinfo,
2547+ .start = c_start,
2548+ .next = c_next,
2549+ .stop = c_stop,
2550+ .show = show_cpuinfo,
2551 };
2552diff -Nru a/arch/h8300/platform/h8300h/ints.c b/arch/h8300/platform/h8300h/ints.c
2553--- a/arch/h8300/platform/h8300h/ints.c Thu Aug 21 08:42:22 2003
2554+++ b/arch/h8300/platform/h8300h/ints.c Wed Aug 27 08:10:22 2003
2555@@ -32,15 +32,6 @@
2556 #include <asm/regs306x.h>
2557 #include <asm/errno.h>
2558
2559-#define EXT_IRQ0 12
2560-#define EXT_IRQ1 13
2561-#define EXT_IRQ2 14
2562-#define EXT_IRQ3 15
2563-#define EXT_IRQ4 16
2564-#define EXT_IRQ5 17
2565-#define EXT_IRQ6 18
2566-#define EXT_IRQ7 19
2567-
2568 /*
2569 * This structure has only 4 elements for speed reasons
2570 */
2571@@ -57,17 +48,20 @@
2572
2573 extern unsigned long *interrupt_redirect_table;
2574
2575+#define CPU_VECTOR ((unsigned long *)0x000000)
2576+#define ADDR_MASK (0xffffff)
2577+
2578 static inline unsigned long *get_vector_address(void)
2579 {
2580- unsigned long *rom_vector = (unsigned long *)0x000000;
2581+ unsigned long *rom_vector = CPU_VECTOR;
2582 unsigned long base,tmp;
2583 int vec_no;
2584
2585- base = rom_vector[EXT_IRQ0];
2586+ base = rom_vector[EXT_IRQ0] & ADDR_MASK;
2587
2588 /* check romvector format */
2589 for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ5; vec_no++) {
2590- if ((base+(vec_no - EXT_IRQ0)*4) != rom_vector[vec_no])
2591+ if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK))
2592 return NULL;
2593 }
2594
2595@@ -171,7 +165,7 @@
2596 irq, irq_list[irq]->devname);
2597 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5)
2598 *(volatile unsigned char *)IER &= ~(1 << (irq - EXT_IRQ0));
2599- if ((irq_list[irq] & 0x80000000) == 0) {
2600+ if (((unsigned long)irq_list[irq] & 0x80000000) == 0) {
2601 kfree(irq_list[irq]);
2602 irq_list[irq] = NULL;
2603 }
2604@@ -241,8 +235,9 @@
2605 {
2606 }
2607
2608-static void __init enable_kmalloc(void)
2609+static int __init enable_kmalloc(void)
2610 {
2611 use_kmalloc = 1;
2612+ return 0;
2613 }
2614-__initcall(enable_kmalloc);
2615+core_initcall(enable_kmalloc);
2616diff -Nru a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c
2617--- a/arch/h8300/platform/h8s/ints.c Thu Aug 21 08:42:22 2003
2618+++ b/arch/h8300/platform/h8s/ints.c Wed Aug 27 08:10:22 2003
2619@@ -33,23 +33,6 @@
2620 #include <asm/regs267x.h>
2621 #include <asm/errno.h>
2622
2623-#define EXT_IRQ0 16
2624-#define EXT_IRQ1 17
2625-#define EXT_IRQ2 18
2626-#define EXT_IRQ3 19
2627-#define EXT_IRQ4 20
2628-#define EXT_IRQ5 21
2629-#define EXT_IRQ6 22
2630-#define EXT_IRQ7 23
2631-#define EXT_IRQ8 24
2632-#define EXT_IRQ9 25
2633-#define EXT_IRQ10 26
2634-#define EXT_IRQ11 27
2635-#define EXT_IRQ12 28
2636-#define EXT_IRQ13 29
2637-#define EXT_IRQ14 30
2638-#define EXT_IRQ15 31
2639-
2640 /*
2641 * This structure has only 4 elements for speed reasons
2642 */
2643@@ -95,17 +78,20 @@
2644
2645 extern unsigned long *interrupt_redirect_table;
2646
2647+#define CPU_VECTOR ((unsigned long *)0x000000)
2648+#define ADDR_MASK (0xffffff)
2649+
2650 static inline unsigned long *get_vector_address(void)
2651 {
2652- volatile unsigned long *rom_vector = (unsigned long *)0x000000;
2653+ volatile unsigned long *rom_vector = CPU_VECTOR;
2654 unsigned long base,tmp;
2655 int vec_no;
2656
2657- base = rom_vector[EXT_IRQ0];
2658+ base = rom_vector[EXT_IRQ0] & ADDR_MASK;
2659
2660 /* check romvector format */
2661 for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ15; vec_no++) {
2662- if ((base+(vec_no - EXT_IRQ0)*4) != rom_vector[vec_no])
2663+ if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK))
2664 return NULL;
2665 }
2666
2667@@ -307,4 +293,4 @@
2668 use_kmalloc = 1;
2669 return 0;
2670 }
2671-__initcall(enable_kmalloc);
2672+core_initcall(enable_kmalloc);
2673diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
2674--- a/arch/i386/Kconfig Wed Aug 20 12:16:36 2003
2675+++ b/arch/i386/Kconfig Sun Aug 31 16:15:07 2003
2676@@ -408,6 +408,17 @@
2677
2678 Otherwise, say N.
2679
2680+config HPET_TIMER
2681+ bool "HPET Timer Support"
2682+ help
2683+ This enables the use of the HPET for the kernel's internal timer.
2684+ HPET is the next generation timer replacing legacy 8254s.
2685+ You can safely choose Y here. However, HPET will only be
2686+ activated if the platform and the BIOS support this feature.
2687+ Otherwise the 8254 will be used for timing services.
2688+
2689+ Choose N to continue using the legacy 8254 timer.
2690+
2691 config SMP
2692 bool "Symmetric multi-processing support"
2693 ---help---
2694@@ -1155,40 +1166,6 @@
2695
2696
2697 menu "Executable file formats"
2698-
2699-choice
2700- prompt "Kernel core (/proc/kcore) format"
2701- depends on PROC_FS
2702- default KCORE_ELF
2703-
2704-config KCORE_ELF
2705- bool "ELF"
2706- ---help---
2707- If you enabled support for /proc file system then the file
2708- /proc/kcore will contain the kernel core image. This can be used
2709- in gdb:
2710-
2711- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
2712-
2713- You have two choices here: ELF and A.OUT. Selecting ELF will make
2714- /proc/kcore appear in ELF core format as defined by the Executable
2715- and Linking Format specification. Selecting A.OUT will choose the
2716- old "a.out" format which may be necessary for some old versions
2717- of binutils or on some architectures.
2718-
2719- This is especially useful if you have compiled the kernel with the
2720- "-g" option to preserve debugging information. It is mainly used
2721- for examining kernel data structures on the live kernel so if you
2722- don't understand what this means or are not a kernel hacker, just
2723- leave it at its default value ELF.
2724-
2725-config KCORE_AOUT
2726- bool "A.OUT"
2727- help
2728- Not necessary unless you're using a very out-of-date binutils
2729- version. You probably want KCORE_ELF.
2730-
2731-endchoice
2732
2733 source "fs/Kconfig.binfmt"
2734
2735diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
2736--- a/arch/i386/kernel/Makefile Mon Aug 18 11:16:59 2003
2737+++ b/arch/i386/kernel/Makefile Sun Aug 31 16:14:50 2003
2738@@ -31,6 +31,7 @@
2739 obj-$(CONFIG_MODULES) += module.o
2740 obj-y += sysenter.o vsyscall.o
2741 obj-$(CONFIG_ACPI_SRAT) += srat.o
2742+obj-$(CONFIG_HPET_TIMER) += time_hpet.o
2743
2744 EXTRA_AFLAGS := -traditional
2745
2746diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
2747--- a/arch/i386/kernel/acpi/boot.c Thu Aug 21 11:08:59 2003
2748+++ b/arch/i386/kernel/acpi/boot.c Sun Aug 31 16:14:49 2003
2749@@ -41,6 +41,7 @@
2750 #define PREFIX "ACPI: "
2751
2752 extern int acpi_disabled;
2753+extern int acpi_irq;
2754 extern int acpi_ht;
2755
2756 int acpi_lapic = 0;
2757@@ -269,6 +270,27 @@
2758 return 0;
2759 }
2760
2761+#ifdef CONFIG_HPET_TIMER
2762+extern unsigned long hpet_address;
2763+
2764+static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
2765+{
2766+ struct acpi_table_hpet *hpet_tbl;
2767+
2768+ hpet_tbl = __va(phys);
2769+
2770+ if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
2771+ printk(KERN_WARNING PREFIX "HPET timers must be located in "
2772+ "memory.\n");
2773+ return -1;
2774+ }
2775+
2776+ hpet_address = hpet_tbl->addr.addrl;
2777+ printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", hpet_tbl->id,
2778+ hpet_address);
2779+ return 0;
2780+}
2781+#endif
2782
2783 unsigned long __init
2784 acpi_find_rsdp (void)
2785@@ -407,7 +429,7 @@
2786 * If MPS is present, it will handle them,
2787 * otherwise the system will stay in PIC mode
2788 */
2789- if (acpi_disabled) {
2790+ if (acpi_disabled || !acpi_irq) {
2791 return 1;
2792 }
2793
2794@@ -457,6 +479,9 @@
2795 smp_found_config = 1;
2796 clustered_apic_check();
2797 }
2798+#endif
2799+#ifdef CONFIG_HPET_TIMER
2800+ acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
2801 #endif
2802
2803 return 0;
2804diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
2805--- a/arch/i386/kernel/apic.c Mon Aug 18 22:27:07 2003
2806+++ b/arch/i386/kernel/apic.c Fri Aug 29 03:51:17 2003
2807@@ -34,6 +34,7 @@
2808 #include <asm/pgalloc.h>
2809 #include <asm/desc.h>
2810 #include <asm/arch_hooks.h>
2811+#include <asm/hpet.h>
2812
2813 #include <mach_apic.h>
2814
2815@@ -779,7 +780,8 @@
2816 return count;
2817 }
2818
2819-void __init wait_8254_wraparound(void)
2820+/* next tick in 8254 can be caught by catching timer wraparound */
2821+static void __init wait_8254_wraparound(void)
2822 {
2823 unsigned int curr_count, prev_count=~0;
2824 int delta;
2825@@ -801,6 +803,12 @@
2826 }
2827
2828 /*
2829+ * Default initialization for 8254 timers. If we use other timers like HPET,
2830+ * we override this later
2831+ */
2832+void (*wait_timer_tick)(void) = wait_8254_wraparound;
2833+
2834+/*
2835 * This function sets up the local APIC timer, with a timeout of
2836 * 'clocks' APIC bus clock. During calibration we actually call
2837 * this function twice on the boot CPU, once with a bogus timeout
2838@@ -841,7 +849,7 @@
2839 /*
2840 * Wait for IRQ0's slice:
2841 */
2842- wait_8254_wraparound();
2843+ wait_timer_tick();
2844
2845 __setup_APIC_LVTT(clocks);
2846
2847@@ -884,7 +892,7 @@
2848 * (the current tick might have been already half done)
2849 */
2850
2851- wait_8254_wraparound();
2852+ wait_timer_tick();
2853
2854 /*
2855 * We wrapped around just now. Let's start:
2856@@ -897,7 +905,7 @@
2857 * Let's wait LOOPS wraprounds:
2858 */
2859 for (i = 0; i < LOOPS; i++)
2860- wait_8254_wraparound();
2861+ wait_timer_tick();
2862
2863 tt2 = apic_read(APIC_TMCCT);
2864 if (cpu_has_tsc)
2865diff -Nru a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c
2866--- a/arch/i386/kernel/cpu/mtrr/if.c Wed May 14 23:43:54 2003
2867+++ b/arch/i386/kernel/cpu/mtrr/if.c Sun Aug 31 16:14:43 2003
2868@@ -17,6 +17,22 @@
2869
2870 #define FILE_FCOUNT(f) (((struct seq_file *)((f)->private_data))->private)
2871
2872+static char *mtrr_strings[MTRR_NUM_TYPES] =
2873+{
2874+ "uncachable", /* 0 */
2875+ "write-combining", /* 1 */
2876+ "?", /* 2 */
2877+ "?", /* 3 */
2878+ "write-through", /* 4 */
2879+ "write-protect", /* 5 */
2880+ "write-back", /* 6 */
2881+};
2882+
2883+char *mtrr_attrib_to_str(int x)
2884+{
2885+ return (x <= 6) ? mtrr_strings[x] : "?";
2886+}
2887+
2888 static int
2889 mtrr_file_add(unsigned long base, unsigned long size,
2890 unsigned int type, char increment, struct file *file, int page)
2891@@ -300,11 +316,6 @@
2892
2893 # endif /* CONFIG_PROC_FS */
2894
2895-char * attrib_to_str(int x)
2896-{
2897- return (x <= 6) ? mtrr_strings[x] : "?";
2898-}
2899-
2900 static int mtrr_seq_show(struct seq_file *seq, void *offset)
2901 {
2902 char factor;
2903@@ -332,7 +343,7 @@
2904 len += seq_printf(seq,
2905 "reg%02i: base=0x%05lx000 (%4liMB), size=%4i%cB: %s, count=%d\n",
2906 i, base, base >> (20 - PAGE_SHIFT), size, factor,
2907- attrib_to_str(type), usage_table[i]);
2908+ mtrr_attrib_to_str(type), usage_table[i]);
2909 }
2910 }
2911 return 0;
2912diff -Nru a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
2913--- a/arch/i386/kernel/cpu/mtrr/main.c Thu Aug 21 11:48:14 2003
2914+++ b/arch/i386/kernel/cpu/mtrr/main.c Sun Aug 31 16:14:43 2003
2915@@ -111,11 +111,6 @@
2916 num_var_ranges = config & 0xff;
2917 }
2918
2919-static char * attrib_to_str(int x)
2920-{
2921- return (x <= 6) ? mtrr_strings[x] : "?";
2922-}
2923-
2924 static void init_table(void)
2925 {
2926 int i, max;
2927@@ -362,8 +357,8 @@
2928 if (type == MTRR_TYPE_UNCACHABLE)
2929 continue;
2930 printk (KERN_WARNING "mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n",
2931- base, size, attrib_to_str(ltype),
2932- attrib_to_str(type));
2933+ base, size, mtrr_attrib_to_str(ltype),
2934+ mtrr_attrib_to_str(type));
2935 goto out;
2936 }
2937 if (increment)
2938@@ -703,16 +698,4 @@
2939 return -ENXIO;
2940 }
2941
2942-char *mtrr_strings[MTRR_NUM_TYPES] =
2943-{
2944- "uncachable", /* 0 */
2945- "write-combining", /* 1 */
2946- "?", /* 2 */
2947- "?", /* 3 */
2948- "write-through", /* 4 */
2949- "write-protect", /* 5 */
2950- "write-back", /* 6 */
2951-};
2952-
2953 subsys_initcall(mtrr_init);
2954-
2955diff -Nru a/arch/i386/kernel/cpu/mtrr/mtrr.h b/arch/i386/kernel/cpu/mtrr/mtrr.h
2956--- a/arch/i386/kernel/cpu/mtrr/mtrr.h Wed Nov 27 22:37:22 2002
2957+++ b/arch/i386/kernel/cpu/mtrr/mtrr.h Sun Aug 31 16:14:43 2003
2958@@ -95,5 +95,6 @@
2959
2960 void finalize_mtrr_state(void);
2961 void mtrr_state_warn(void);
2962+char *mtrr_attrib_to_str(int x);
2963
2964 extern char * mtrr_if_name[];
2965diff -Nru a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
2966--- a/arch/i386/kernel/cpuid.c Mon Aug 18 19:46:23 2003
2967+++ b/arch/i386/kernel/cpuid.c Tue Aug 26 09:25:40 2003
2968@@ -115,7 +115,7 @@
2969 u32 data[4];
2970 size_t rv;
2971 u32 reg = *ppos;
2972- int cpu = minor(file->f_dentry->d_inode->i_rdev);
2973+ int cpu = iminor(file->f_dentry->d_inode);
2974
2975 if ( count % 16 )
2976 return -EINVAL; /* Invalid chunk size */
2977@@ -133,7 +133,7 @@
2978
2979 static int cpuid_open(struct inode *inode, struct file *file)
2980 {
2981- int cpu = minor(file->f_dentry->d_inode->i_rdev);
2982+ int cpu = iminor(file->f_dentry->d_inode);
2983 struct cpuinfo_x86 *c = &(cpu_data)[cpu];
2984
2985 if (!cpu_online(cpu))
2986diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
2987--- a/arch/i386/kernel/mpparse.c Tue Aug 19 21:21:36 2003
2988+++ b/arch/i386/kernel/mpparse.c Sun Aug 31 16:14:25 2003
2989@@ -850,7 +850,7 @@
2990 return i;
2991 }
2992
2993- printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d/n", irq);
2994+ printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq);
2995
2996 return -1;
2997 }
2998diff -Nru a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
2999--- a/arch/i386/kernel/msr.c Mon Aug 18 19:46:23 2003
3000+++ b/arch/i386/kernel/msr.c Tue Aug 26 09:25:40 2003
3001@@ -194,7 +194,7 @@
3002 u32 data[2];
3003 size_t rv;
3004 u32 reg = *ppos;
3005- int cpu = minor(file->f_dentry->d_inode->i_rdev);
3006+ int cpu = iminor(file->f_dentry->d_inode);
3007 int err;
3008
3009 if ( count % 8 )
3010@@ -219,7 +219,7 @@
3011 u32 data[2];
3012 size_t rv;
3013 u32 reg = *ppos;
3014- int cpu = minor(file->f_dentry->d_inode->i_rdev);
3015+ int cpu = iminor(file->f_dentry->d_inode);
3016 int err;
3017
3018 if ( count % 8 )
3019@@ -239,7 +239,7 @@
3020
3021 static int msr_open(struct inode *inode, struct file *file)
3022 {
3023- int cpu = minor(file->f_dentry->d_inode->i_rdev);
3024+ int cpu = iminor(file->f_dentry->d_inode);
3025 struct cpuinfo_x86 *c = &(cpu_data)[cpu];
3026
3027 if (!cpu_online(cpu))
3028diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
3029--- a/arch/i386/kernel/setup.c Thu Aug 21 11:08:59 2003
3030+++ b/arch/i386/kernel/setup.c Sun Aug 31 16:14:11 2003
3031@@ -71,6 +71,7 @@
3032 EXPORT_SYMBOL(acpi_disabled);
3033
3034 #ifdef CONFIG_ACPI_BOOT
3035+ int acpi_irq __initdata = 1; /* enable IRQ */
3036 int acpi_ht __initdata = 1; /* enable HT */
3037 #endif
3038
3039@@ -542,6 +543,11 @@
3040 else if (!memcmp(from, "acpi=ht", 7)) {
3041 acpi_ht = 1;
3042 if (!acpi_force) acpi_disabled = 1;
3043+ }
3044+
3045+ /* "pci=noacpi" disables ACPI interrupt routing */
3046+ else if (!memcmp(from, "pci=noacpi", 10)) {
3047+ acpi_irq = 0;
3048 }
3049
3050 #ifdef CONFIG_X86_LOCAL_APIC
3051diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
3052--- a/arch/i386/kernel/time.c Thu Jul 10 22:22:57 2003
3053+++ b/arch/i386/kernel/time.c Fri Aug 29 03:51:17 2003
3054@@ -60,6 +60,8 @@
3055 #include <linux/timex.h>
3056 #include <linux/config.h>
3057
3058+#include <asm/hpet.h>
3059+
3060 #include <asm/arch_hooks.h>
3061
3062 #include "io_ports.h"
3063@@ -291,8 +293,38 @@
3064
3065 device_initcall(time_init_device);
3066
3067+#ifdef CONFIG_HPET_TIMER
3068+extern void (*late_time_init)(void);
3069+/* Duplicate of time_init() below, with hpet_enable part added */
3070+void __init hpet_time_init(void)
3071+{
3072+ xtime.tv_sec = get_cmos_time();
3073+ wall_to_monotonic.tv_sec = -xtime.tv_sec;
3074+ xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
3075+ wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
3076+
3077+ if (hpet_enable() >= 0) {
3078+ printk("Using HPET for base-timer\n");
3079+ }
3080+
3081+ cur_timer = select_timer();
3082+ time_init_hook();
3083+}
3084+#endif
3085+
3086 void __init time_init(void)
3087 {
3088+#ifdef CONFIG_HPET_TIMER
3089+ if (is_hpet_capable()) {
3090+ /*
3091+ * HPET initialization needs to do memory-mapped io. So, let
3092+ * us do a late initialization after mem_init().
3093+ */
3094+ late_time_init = hpet_time_init;
3095+ return;
3096+ }
3097+#endif
3098+
3099 xtime.tv_sec = get_cmos_time();
3100 wall_to_monotonic.tv_sec = -xtime.tv_sec;
3101 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
3102diff -Nru a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c
3103--- /dev/null Wed Dec 31 16:00:00 1969
3104+++ b/arch/i386/kernel/time_hpet.c Sun Aug 31 16:15:40 2003
3105@@ -0,0 +1,392 @@
3106+/*
3107+ * linux/arch/i386/kernel/time_hpet.c
3108+ * This code largely copied from arch/x86_64/kernel/time.c
3109+ * See that file for credits.
3110+ *
3111+ * 2003-06-30 Venkatesh Pallipadi - Additional changes for HPET support
3112+ */
3113+
3114+#include <linux/errno.h>
3115+#include <linux/kernel.h>
3116+#include <linux/param.h>
3117+#include <linux/string.h>
3118+#include <linux/init.h>
3119+#include <linux/smp.h>
3120+
3121+#include <asm/timer.h>
3122+#include <asm/fixmap.h>
3123+#include <asm/apic.h>
3124+
3125+#include <linux/timex.h>
3126+#include <linux/config.h>
3127+
3128+#include <asm/hpet.h>
3129+
3130+unsigned long hpet_period; /* fsecs / HPET clock */
3131+unsigned long hpet_tick; /* hpet clks count per tick */
3132+unsigned long hpet_address; /* hpet memory map physical address */
3133+
3134+static int use_hpet; /* can be used for runtime check of hpet */
3135+static int boot_hpet_disable; /* boottime override for HPET timer */
3136+static unsigned long hpet_virt_address; /* hpet kernel virtual address */
3137+
3138+#define FSEC_TO_USEC (1000000000UL)
3139+
3140+int hpet_readl(unsigned long a)
3141+{
3142+ return readl(hpet_virt_address + a);
3143+}
3144+
3145+void hpet_writel(unsigned long d, unsigned long a)
3146+{
3147+ writel(d, hpet_virt_address + a);
3148+}
3149+
3150+#ifdef CONFIG_X86_LOCAL_APIC
3151+/*
3152+ * HPET counters dont wrap around on every tick. They just change the
3153+ * comparator value and continue. Next tick can be caught by checking
3154+ * for a change in the comparator value. Used in apic.c.
3155+ */
3156+void __init wait_hpet_tick(void)
3157+{
3158+ unsigned int start_cmp_val, end_cmp_val;
3159+
3160+ start_cmp_val = hpet_readl(HPET_T0_CMP);
3161+ do {
3162+ end_cmp_val = hpet_readl(HPET_T0_CMP);
3163+ } while (start_cmp_val == end_cmp_val);
3164+}
3165+#endif
3166+
3167+/*
3168+ * Check whether HPET was found by ACPI boot parse. If yes setup HPET
3169+ * counter 0 for kernel base timer.
3170+ */
3171+int __init hpet_enable(void)
3172+{
3173+ unsigned int cfg, id;
3174+ unsigned long tick_fsec_low, tick_fsec_high; /* tick in femto sec */
3175+ unsigned long hpet_tick_rem;
3176+
3177+ if (boot_hpet_disable)
3178+ return -1;
3179+
3180+ if (!hpet_address) {
3181+ return -1;
3182+ }
3183+ hpet_virt_address = (unsigned long) ioremap_nocache(hpet_address,
3184+ HPET_MMAP_SIZE);
3185+ /*
3186+ * Read the period, compute tick and quotient.
3187+ */
3188+ id = hpet_readl(HPET_ID);
3189+
3190+ /*
3191+ * We are checking for value '1' or more in number field.
3192+ * So, we are OK with HPET_EMULATE_RTC part too, where we need
3193+ * to have atleast 2 timers.
3194+ */
3195+ if (!(id & HPET_ID_NUMBER) ||
3196+ !(id & HPET_ID_LEGSUP))
3197+ return -1;
3198+
3199+ if (((id & HPET_ID_VENDOR) >> HPET_ID_VENDOR_SHIFT) !=
3200+ HPET_ID_VENDOR_8086)
3201+ return -1;
3202+
3203+ hpet_period = hpet_readl(HPET_PERIOD);
3204+ if ((hpet_period < HPET_MIN_PERIOD) || (hpet_period > HPET_MAX_PERIOD))
3205+ return -1;
3206+
3207+ /*
3208+ * 64 bit math
3209+ * First changing tick into fsec
3210+ * Then 64 bit div to find number of hpet clk per tick
3211+ */
3212+ ASM_MUL64_REG(tick_fsec_low, tick_fsec_high,
3213+ KERNEL_TICK_USEC, FSEC_TO_USEC);
3214+ ASM_DIV64_REG(hpet_tick, hpet_tick_rem,
3215+ hpet_period, tick_fsec_low, tick_fsec_high);
3216+
3217+ if (hpet_tick_rem > (hpet_period >> 1))
3218+ hpet_tick++; /* rounding the result */
3219+
3220+ /*
3221+ * Stop the timers and reset the main counter.
3222+ */
3223+ cfg = hpet_readl(HPET_CFG);
3224+ cfg &= ~HPET_CFG_ENABLE;
3225+ hpet_writel(cfg, HPET_CFG);
3226+ hpet_writel(0, HPET_COUNTER);
3227+ hpet_writel(0, HPET_COUNTER + 4);
3228+
3229+ /*
3230+ * Set up timer 0, as periodic with first interrupt to happen at
3231+ * hpet_tick, and period also hpet_tick.
3232+ */
3233+ cfg = hpet_readl(HPET_T0_CFG);
3234+ cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
3235+ HPET_TN_SETVAL | HPET_TN_32BIT;
3236+ hpet_writel(cfg, HPET_T0_CFG);
3237+ hpet_writel(hpet_tick, HPET_T0_CMP);
3238+
3239+ /*
3240+ * Go!
3241+ */
3242+ cfg = hpet_readl(HPET_CFG);
3243+ cfg |= HPET_CFG_ENABLE | HPET_CFG_LEGACY;
3244+ hpet_writel(cfg, HPET_CFG);
3245+
3246+ use_hpet = 1;
3247+#ifdef CONFIG_X86_LOCAL_APIC
3248+ wait_timer_tick = wait_hpet_tick;
3249+#endif
3250+ return 0;
3251+}
3252+
3253+int is_hpet_enabled(void)
3254+{
3255+ return use_hpet;
3256+}
3257+
3258+int is_hpet_capable(void)
3259+{
3260+ if (!boot_hpet_disable && hpet_address)
3261+ return 1;
3262+ return 0;
3263+}
3264+
3265+static int __init hpet_setup(char* str)
3266+{
3267+ if (str) {
3268+ if (!strncmp("disable", str, 7))
3269+ boot_hpet_disable = 1;
3270+ }
3271+ return 1;
3272+}
3273+
3274+__setup("hpet=", hpet_setup);
3275+
3276+#ifdef CONFIG_HPET_EMULATE_RTC
3277+/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET
3278+ * is enabled, we support RTC interrupt functionality in software.
3279+ * RTC has 3 kinds of interrupts:
3280+ * 1) Update Interrupt - generate an interrupt, every sec, when RTC clock
3281+ * is updated
3282+ * 2) Alarm Interrupt - generate an interrupt at a specific time of day
3283+ * 3) Periodic Interrupt - generate periodic interrupt, with frequencies
3284+ * 2Hz-8192Hz (2Hz-64Hz for non-root user) (all freqs in powers of 2)
3285+ * (1) and (2) above are implemented using polling at a frequency of
3286+ * 64 Hz. The exact frequency is a tradeoff between accuracy and interrupt
3287+ * overhead. (DEFAULT_RTC_INT_FREQ)
3288+ * For (3), we use interrupts at 64Hz or user specified periodic
3289+ * frequency, whichever is higher.
3290+ */
3291+#include <linux/mc146818rtc.h>
3292+#include <linux/rtc.h>
3293+
3294+extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
3295+extern void get_rtc_time(struct rtc_time *rtc_tm);
3296+
3297+#define DEFAULT_RTC_INT_FREQ 64
3298+#define RTC_NUM_INTS 1
3299+
3300+static unsigned long UIE_on;
3301+static unsigned long prev_update_sec;
3302+
3303+static unsigned long AIE_on;
3304+static struct rtc_time alarm_time;
3305+
3306+static unsigned long PIE_on;
3307+static unsigned long PIE_freq = DEFAULT_RTC_INT_FREQ;
3308+static unsigned long PIE_count;
3309+
3310+static unsigned long hpet_rtc_int_freq; /* RTC interrupt frequency */
3311+
3312+/*
3313+ * Timer 1 for RTC, we do not use periodic interrupt feature,
3314+ * even if HPET supports periodic interrupts on Timer 1.
3315+ * The reason being, to set up a periodic interrupt in HPET, we need to
3316+ * stop the main counter. And if we do that everytime someone diables/enables
3317+ * RTC, we will have adverse effect on main kernel timer running on Timer 0.
3318+ * So, for the time being, simulate the periodic interrupt in software.
3319+ *
3320+ * hpet_rtc_timer_init() is called for the first time and during subsequent
3321+ * interuppts reinit happens through hpet_rtc_timer_reinit().
3322+ */
3323+int hpet_rtc_timer_init(void)
3324+{
3325+ unsigned int cfg, cnt;
3326+ unsigned long flags;
3327+
3328+ if (!is_hpet_enabled())
3329+ return 0;
3330+ /*
3331+ * Set the counter 1 and enable the interrupts.
3332+ */
3333+ if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
3334+ hpet_rtc_int_freq = PIE_freq;
3335+ else
3336+ hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
3337+
3338+ local_irq_save(flags);
3339+ cnt = hpet_readl(HPET_COUNTER);
3340+ cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq);
3341+ hpet_writel(cnt, HPET_T1_CMP);
3342+ local_irq_restore(flags);
3343+
3344+ cfg = hpet_readl(HPET_T1_CFG);
3345+ cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT;
3346+ hpet_writel(cfg, HPET_T1_CFG);
3347+
3348+ return 1;
3349+}
3350+
3351+static void hpet_rtc_timer_reinit(void)
3352+{
3353+ unsigned int cfg, cnt;
3354+
3355+ if (!(PIE_on | AIE_on | UIE_on))
3356+ return;
3357+
3358+ if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
3359+ hpet_rtc_int_freq = PIE_freq;
3360+ else
3361+ hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
3362+
3363+ /* It is more accurate to use the comparator value than current count.*/
3364+ cnt = hpet_readl(HPET_T1_CMP);
3365+ cnt += hpet_tick*HZ/hpet_rtc_int_freq;
3366+ hpet_writel(cnt, HPET_T1_CMP);
3367+
3368+ cfg = hpet_readl(HPET_T1_CFG);
3369+ cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT;
3370+ hpet_writel(cfg, HPET_T1_CFG);
3371+
3372+ return;
3373+}
3374+
3375+/*
3376+ * The functions below are called from rtc driver.
3377+ * Return 0 if HPET is not being used.
3378+ * Otherwise do the necessary changes and return 1.
3379+ */
3380+int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
3381+{
3382+ if (!is_hpet_enabled())
3383+ return 0;
3384+
3385+ if (bit_mask & RTC_UIE)
3386+ UIE_on = 0;
3387+ if (bit_mask & RTC_PIE)
3388+ PIE_on = 0;
3389+ if (bit_mask & RTC_AIE)
3390+ AIE_on = 0;
3391+
3392+ return 1;
3393+}
3394+
3395+int hpet_set_rtc_irq_bit(unsigned long bit_mask)
3396+{
3397+ int timer_init_reqd = 0;
3398+
3399+ if (!is_hpet_enabled())
3400+ return 0;
3401+
3402+ if (!(PIE_on | AIE_on | UIE_on))
3403+ timer_init_reqd = 1;
3404+
3405+ if (bit_mask & RTC_UIE) {
3406+ UIE_on = 1;
3407+ }
3408+ if (bit_mask & RTC_PIE) {
3409+ PIE_on = 1;
3410+ PIE_count = 0;
3411+ }
3412+ if (bit_mask & RTC_AIE) {
3413+ AIE_on = 1;
3414+ }
3415+
3416+ if (timer_init_reqd)
3417+ hpet_rtc_timer_init();
3418+
3419+ return 1;
3420+}
3421+
3422+int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec)
3423+{
3424+ if (!is_hpet_enabled())
3425+ return 0;
3426+
3427+ alarm_time.tm_hour = hrs;
3428+ alarm_time.tm_min = min;
3429+ alarm_time.tm_sec = sec;
3430+
3431+ return 1;
3432+}
3433+
3434+int hpet_set_periodic_freq(unsigned long freq)
3435+{
3436+ if (!is_hpet_enabled())
3437+ return 0;
3438+
3439+ PIE_freq = freq;
3440+ PIE_count = 0;
3441+
3442+ return 1;
3443+}
3444+
3445+int hpet_rtc_dropped_irq(void)
3446+{
3447+ if (!is_hpet_enabled())
3448+ return 0;
3449+
3450+ return 1;
3451+}
3452+
3453+irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3454+{
3455+ struct rtc_time curr_time;
3456+ unsigned long rtc_int_flag = 0;
3457+ int call_rtc_interrupt = 0;
3458+
3459+ hpet_rtc_timer_reinit();
3460+
3461+ if (UIE_on | AIE_on) {
3462+ get_rtc_time(&curr_time);
3463+ }
3464+ if (UIE_on) {
3465+ if (curr_time.tm_sec != prev_update_sec) {
3466+ /* Set update int info, call real rtc int routine */
3467+ call_rtc_interrupt = 1;
3468+ rtc_int_flag = RTC_UF;
3469+ prev_update_sec = curr_time.tm_sec;
3470+ }
3471+ }
3472+ if (PIE_on) {
3473+ PIE_count++;
3474+ if (PIE_count >= hpet_rtc_int_freq/PIE_freq) {
3475+ /* Set periodic int info, call real rtc int routine */
3476+ call_rtc_interrupt = 1;
3477+ rtc_int_flag |= RTC_PF;
3478+ PIE_count = 0;
3479+ }
3480+ }
3481+ if (AIE_on) {
3482+ if ((curr_time.tm_sec == alarm_time.tm_sec) &&
3483+ (curr_time.tm_min == alarm_time.tm_min) &&
3484+ (curr_time.tm_hour == alarm_time.tm_hour)) {
3485+ /* Set alarm int info, call real rtc int routine */
3486+ call_rtc_interrupt = 1;
3487+ rtc_int_flag |= RTC_AF;
3488+ }
3489+ }
3490+ if (call_rtc_interrupt) {
3491+ rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8));
3492+ rtc_interrupt(rtc_int_flag, dev_id, regs);
3493+ }
3494+ return IRQ_HANDLED;
3495+}
3496+#endif
3497+
3498diff -Nru a/arch/i386/kernel/timers/Makefile b/arch/i386/kernel/timers/Makefile
3499--- a/arch/i386/kernel/timers/Makefile Sun May 4 23:38:34 2003
3500+++ b/arch/i386/kernel/timers/Makefile Sun Aug 31 16:14:50 2003
3501@@ -5,3 +5,4 @@
3502 obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o
3503
3504 obj-$(CONFIG_X86_CYCLONE_TIMER) += timer_cyclone.o
3505+obj-$(CONFIG_HPET_TIMER) += timer_hpet.o
3506diff -Nru a/arch/i386/kernel/timers/timer.c b/arch/i386/kernel/timers/timer.c
3507--- a/arch/i386/kernel/timers/timer.c Wed Jul 2 21:21:34 2003
3508+++ b/arch/i386/kernel/timers/timer.c Sun Aug 31 16:15:21 2003
3509@@ -3,10 +3,21 @@
3510 #include <linux/string.h>
3511 #include <asm/timer.h>
3512
3513+#ifdef CONFIG_HPET_TIMER
3514+/*
3515+ * HPET memory read is slower than tsc reads, but is more dependable as it
3516+ * always runs at constant frequency and reduces complexity due to
3517+ * cpufreq. So, we prefer HPET timer to tsc based one. Also, we cannot use
3518+ * timer_pit when HPET is active. So, we default to timer_tsc.
3519+ */
3520+#endif
3521 /* list of timers, ordered by preference, NULL terminated */
3522 static struct timer_opts* timers[] = {
3523 #ifdef CONFIG_X86_CYCLONE_TIMER
3524 &timer_cyclone,
3525+#endif
3526+#ifdef CONFIG_HPET_TIMER
3527+ &timer_hpet,
3528 #endif
3529 &timer_tsc,
3530 &timer_pit,
3531diff -Nru a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c
3532--- /dev/null Wed Dec 31 16:00:00 1969
3533+++ b/arch/i386/kernel/timers/timer_hpet.c Sun Aug 31 16:15:29 2003
3534@@ -0,0 +1,241 @@
3535+/*
3536+ * This code largely moved from arch/i386/kernel/time.c.
3537+ * See comments there for proper credits.
3538+ */
3539+
3540+#include <linux/spinlock.h>
3541+#include <linux/init.h>
3542+#include <linux/timex.h>
3543+#include <linux/errno.h>
3544+#include <linux/string.h>
3545+#include <linux/jiffies.h>
3546+
3547+#include <asm/timer.h>
3548+#include <asm/io.h>
3549+#include <asm/processor.h>
3550+
3551+#include "io_ports.h"
3552+#include "mach_timer.h"
3553+#include <asm/hpet.h>
3554+
3555+static unsigned long hpet_usec_quotient; /* convert hpet clks to usec */
3556+static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */
3557+static unsigned long hpet_last; /* hpet counter value at last tick*/
3558+static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */
3559+static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */
3560+static unsigned long long monotonic_base;
3561+static rwlock_t monotonic_lock = RW_LOCK_UNLOCKED;
3562+
3563+/* convert from cycles(64bits) => nanoseconds (64bits)
3564+ * basic equation:
3565+ * ns = cycles / (freq / ns_per_sec)
3566+ * ns = cycles * (ns_per_sec / freq)
3567+ * ns = cycles * (10^9 / (cpu_mhz * 10^6))
3568+ * ns = cycles * (10^3 / cpu_mhz)
3569+ *
3570+ * Then we use scaling math (suggested by george@mvista.com) to get:
3571+ * ns = cycles * (10^3 * SC / cpu_mhz) / SC
3572+ * ns = cycles * cyc2ns_scale / SC
3573+ *
3574+ * And since SC is a constant power of two, we can convert the div
3575+ * into a shift.
3576+ * -johnstul@us.ibm.com "math is hard, lets go shopping!"
3577+ */
3578+static unsigned long cyc2ns_scale;
3579+#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
3580+
3581+static inline void set_cyc2ns_scale(unsigned long cpu_mhz)
3582+{
3583+ cyc2ns_scale = (1000 << CYC2NS_SCALE_FACTOR)/cpu_mhz;
3584+}
3585+
3586+static inline unsigned long long cycles_2_ns(unsigned long long cyc)
3587+{
3588+ return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
3589+}
3590+
3591+static unsigned long long monotonic_clock_hpet(void)
3592+{
3593+ unsigned long long last_offset, this_offset, base;
3594+
3595+ /* atomically read monotonic base & last_offset */
3596+ read_lock_irq(&monotonic_lock);
3597+ last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3598+ base = monotonic_base;
3599+ read_unlock_irq(&monotonic_lock);
3600+
3601+ /* Read the Time Stamp Counter */
3602+ rdtscll(this_offset);
3603+
3604+ /* return the value in ns */
3605+ return base + cycles_2_ns(this_offset - last_offset);
3606+}
3607+
3608+static unsigned long get_offset_hpet(void)
3609+{
3610+ register unsigned long eax, edx;
3611+
3612+ eax = hpet_readl(HPET_COUNTER);
3613+ eax -= hpet_last; /* hpet delta */
3614+
3615+ /*
3616+ * Time offset = (hpet delta) * ( usecs per HPET clock )
3617+ * = (hpet delta) * ( usecs per tick / HPET clocks per tick)
3618+ * = (hpet delta) * ( hpet_usec_quotient ) / (2^32)
3619+ *
3620+ * Where,
3621+ * hpet_usec_quotient = (2^32 * usecs per tick)/HPET clocks per tick
3622+ *
3623+ * Using a mull instead of a divl saves some cycles in critical path.
3624+ */
3625+ ASM_MUL64_REG(eax, edx, hpet_usec_quotient, eax);
3626+
3627+ /* our adjusted time offset in microseconds */
3628+ return edx;
3629+}
3630+
3631+static void mark_offset_hpet(void)
3632+{
3633+ unsigned long long this_offset, last_offset;
3634+ unsigned long offset;
3635+
3636+ write_lock(&monotonic_lock);
3637+ last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3638+ rdtsc(last_tsc_low, last_tsc_high);
3639+
3640+ offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
3641+ if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
3642+ int lost_ticks = (offset - hpet_last) / hpet_tick;
3643+ jiffies += lost_ticks;
3644+ }
3645+ hpet_last = offset;
3646+
3647+ /* update the monotonic base value */
3648+ this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3649+ monotonic_base += cycles_2_ns(this_offset - last_offset);
3650+ write_unlock(&monotonic_lock);
3651+}
3652+
3653+void delay_hpet(unsigned long loops)
3654+{
3655+ unsigned long hpet_start, hpet_end;
3656+ unsigned long eax;
3657+
3658+ /* loops is the number of cpu cycles. Convert it to hpet clocks */
3659+ ASM_MUL64_REG(eax, loops, tsc_hpet_quotient, loops);
3660+
3661+ hpet_start = hpet_readl(HPET_COUNTER);
3662+ do {
3663+ rep_nop();
3664+ hpet_end = hpet_readl(HPET_COUNTER);
3665+ } while ((hpet_end - hpet_start) < (loops));
3666+}
3667+
3668+/* ------ Calibrate the TSC -------
3669+ * Return 2^32 * (1 / (TSC clocks per usec)) for getting the CPU freq.
3670+ * Set 2^32 * (1 / (tsc per HPET clk)) for delay_hpet().
3671+ * calibrate_tsc() calibrates the processor TSC by comparing
3672+ * it to the HPET timer of known frequency.
3673+ * Too much 64-bit arithmetic here to do this cleanly in C
3674+ */
3675+#define CALIBRATE_CNT_HPET (5 * hpet_tick)
3676+#define CALIBRATE_TIME_HPET (5 * KERNEL_TICK_USEC)
3677+
3678+static unsigned long __init calibrate_tsc(void)
3679+{
3680+ unsigned long tsc_startlow, tsc_starthigh;
3681+ unsigned long tsc_endlow, tsc_endhigh;
3682+ unsigned long hpet_start, hpet_end;
3683+ unsigned long result, remain;
3684+
3685+ hpet_start = hpet_readl(HPET_COUNTER);
3686+ rdtsc(tsc_startlow, tsc_starthigh);
3687+ do {
3688+ hpet_end = hpet_readl(HPET_COUNTER);
3689+ } while ((hpet_end - hpet_start) < CALIBRATE_CNT_HPET);
3690+ rdtsc(tsc_endlow, tsc_endhigh);
3691+
3692+ /* 64-bit subtract - gcc just messes up with long longs */
3693+ __asm__("subl %2,%0\n\t"
3694+ "sbbl %3,%1"
3695+ :"=a" (tsc_endlow), "=d" (tsc_endhigh)
3696+ :"g" (tsc_startlow), "g" (tsc_starthigh),
3697+ "0" (tsc_endlow), "1" (tsc_endhigh));
3698+
3699+ /* Error: ECPUTOOFAST */
3700+ if (tsc_endhigh)
3701+ goto bad_calibration;
3702+
3703+ /* Error: ECPUTOOSLOW */
3704+ if (tsc_endlow <= CALIBRATE_TIME_HPET)
3705+ goto bad_calibration;
3706+
3707+ ASM_DIV64_REG(result, remain, tsc_endlow, 0, CALIBRATE_TIME_HPET);
3708+ if (remain > (tsc_endlow >> 1))
3709+ result++; /* rounding the result */
3710+
3711+ ASM_DIV64_REG(tsc_hpet_quotient, remain, tsc_endlow, 0,
3712+ CALIBRATE_CNT_HPET);
3713+ if (remain > (tsc_endlow >> 1))
3714+ tsc_hpet_quotient++; /* rounding the result */
3715+
3716+ return result;
3717+bad_calibration:
3718+ /*
3719+ * the CPU was so fast/slow that the quotient wouldn't fit in
3720+ * 32 bits..
3721+ */
3722+ return 0;
3723+}
3724+
3725+static int __init init_hpet(char* override)
3726+{
3727+ unsigned long result, remain;
3728+
3729+ /* check clock override */
3730+ if (override[0] && strncmp(override,"hpet",4))
3731+ return -ENODEV;
3732+
3733+ if (!is_hpet_enabled())
3734+ return -ENODEV;
3735+
3736+ printk("Using HPET for gettimeofday\n");
3737+ if (cpu_has_tsc) {
3738+ unsigned long tsc_quotient = calibrate_tsc();
3739+ if (tsc_quotient) {
3740+ /* report CPU clock rate in Hz.
3741+ * The formula is (10^6 * 2^32) / (2^32 * 1 / (clocks/us)) =
3742+ * clock/second. Our precision is about 100 ppm.
3743+ */
3744+ { unsigned long eax=0, edx=1000;
3745+ ASM_DIV64_REG(cpu_khz, edx, tsc_quotient,
3746+ eax, edx);
3747+ printk("Detected %lu.%03lu MHz processor.\n",
3748+ cpu_khz / 1000, cpu_khz % 1000);
3749+ }
3750+ set_cyc2ns_scale(cpu_khz/1000);
3751+ }
3752+ }
3753+
3754+ /*
3755+ * Math to calculate hpet to usec multiplier
3756+ * Look for the comments at get_offset_hpet()
3757+ */
3758+ ASM_DIV64_REG(result, remain, hpet_tick, 0, KERNEL_TICK_USEC);
3759+ if (remain > (hpet_tick >> 1))
3760+ result++; /* rounding the result */
3761+ hpet_usec_quotient = result;
3762+
3763+ return 0;
3764+}
3765+
3766+/************************************************************/
3767+
3768+/* tsc timer_opts struct */
3769+struct timer_opts timer_hpet = {
3770+ .init = init_hpet,
3771+ .mark_offset = mark_offset_hpet,
3772+ .get_offset = get_offset_hpet,
3773+ .monotonic_clock = monotonic_clock_hpet,
3774+ .delay = delay_hpet,
3775+};
3776diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
3777--- a/arch/i386/kernel/timers/timer_tsc.c Mon Aug 18 06:40:02 2003
3778+++ b/arch/i386/kernel/timers/timer_tsc.c Sun Aug 31 16:15:21 2003
3779@@ -19,9 +19,18 @@
3780 #include "io_ports.h"
3781 #include "mach_timer.h"
3782
3783+#include <asm/hpet.h>
3784+
3785+#ifdef CONFIG_HPET_TIMER
3786+static unsigned long hpet_usec_quotient;
3787+static unsigned long hpet_last;
3788+struct timer_opts timer_tsc;
3789+#endif
3790+
3791 int tsc_disable __initdata = 0;
3792
3793 extern spinlock_t i8253_lock;
3794+extern volatile unsigned long jiffies;
3795
3796 static int use_tsc;
3797 /* Number of usecs that the last interrupt was delayed */
3798@@ -232,7 +241,7 @@
3799
3800 #define CALIBRATE_TIME (5 * 1000020/HZ)
3801
3802-unsigned long __init calibrate_tsc(void)
3803+static unsigned long __init calibrate_tsc(void)
3804 {
3805 mach_prepare_counter();
3806
3807@@ -282,6 +291,107 @@
3808 return 0;
3809 }
3810
3811+#ifdef CONFIG_HPET_TIMER
3812+static void mark_offset_tsc_hpet(void)
3813+{
3814+ unsigned long long this_offset, last_offset;
3815+ unsigned long offset, temp, hpet_current;
3816+
3817+ write_lock(&monotonic_lock);
3818+ last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3819+ /*
3820+ * It is important that these two operations happen almost at
3821+ * the same time. We do the RDTSC stuff first, since it's
3822+ * faster. To avoid any inconsistencies, we need interrupts
3823+ * disabled locally.
3824+ */
3825+ /*
3826+ * Interrupts are just disabled locally since the timer irq
3827+ * has the SA_INTERRUPT flag set. -arca
3828+ */
3829+ /* read Pentium cycle counter */
3830+
3831+ hpet_current = hpet_readl(HPET_COUNTER);
3832+ rdtsc(last_tsc_low, last_tsc_high);
3833+
3834+ /* lost tick compensation */
3835+ offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
3836+ if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
3837+ int lost_ticks = (offset - hpet_last) / hpet_tick;
3838+ jiffies += lost_ticks;
3839+ }
3840+ hpet_last = hpet_current;
3841+
3842+ /* update the monotonic base value */
3843+ this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3844+ monotonic_base += cycles_2_ns(this_offset - last_offset);
3845+ write_unlock(&monotonic_lock);
3846+
3847+ /* calculate delay_at_last_interrupt */
3848+ /*
3849+ * Time offset = (hpet delta) * ( usecs per HPET clock )
3850+ * = (hpet delta) * ( usecs per tick / HPET clocks per tick)
3851+ * = (hpet delta) * ( hpet_usec_quotient ) / (2^32)
3852+ * Where,
3853+ * hpet_usec_quotient = (2^32 * usecs per tick)/HPET clocks per tick
3854+ */
3855+ delay_at_last_interrupt = hpet_current - offset;
3856+ ASM_MUL64_REG(temp, delay_at_last_interrupt,
3857+ hpet_usec_quotient, delay_at_last_interrupt);
3858+}
3859+
3860+/* ------ Calibrate the TSC based on HPET timer -------
3861+ * Return 2^32 * (1 / (TSC clocks per usec)) for do_fast_gettimeoffset().
3862+ * calibrate_tsc() calibrates the processor TSC by comparing
3863+ * it to the HPET timer of known frequency.
3864+ * Too much 64-bit arithmetic here to do this cleanly in C
3865+ */
3866+
3867+#define CALIBRATE_CNT_HPET (5 * hpet_tick)
3868+#define CALIBRATE_TIME_HPET (5 * KERNEL_TICK_USEC)
3869+
3870+unsigned long __init calibrate_tsc_hpet(void)
3871+{
3872+ unsigned long tsc_startlow, tsc_starthigh;
3873+ unsigned long tsc_endlow, tsc_endhigh;
3874+ unsigned long hpet_start, hpet_end;
3875+ unsigned long result, remain;
3876+
3877+ hpet_start = hpet_readl(HPET_COUNTER);
3878+ rdtsc(tsc_startlow, tsc_starthigh);
3879+ do {
3880+ hpet_end = hpet_readl(HPET_COUNTER);
3881+ } while ((hpet_end - hpet_start) < CALIBRATE_CNT_HPET);
3882+ rdtsc(tsc_endlow, tsc_endhigh);
3883+
3884+ /* 64-bit subtract - gcc just messes up with long longs */
3885+ __asm__("subl %2,%0\n\t"
3886+ "sbbl %3,%1"
3887+ :"=a" (tsc_endlow), "=d" (tsc_endhigh)
3888+ :"g" (tsc_startlow), "g" (tsc_starthigh),
3889+ "0" (tsc_endlow), "1" (tsc_endhigh));
3890+
3891+ /* Error: ECPUTOOFAST */
3892+ if (tsc_endhigh)
3893+ goto bad_calibration;
3894+
3895+ /* Error: ECPUTOOSLOW */
3896+ if (tsc_endlow <= CALIBRATE_TIME_HPET)
3897+ goto bad_calibration;
3898+
3899+ ASM_DIV64_REG(result, remain, tsc_endlow, 0, CALIBRATE_TIME_HPET);
3900+ if (remain > (tsc_endlow >> 1))
3901+ result++; /* rounding the result */
3902+
3903+ return result;
3904+bad_calibration:
3905+ /*
3906+ * the CPU was so fast/slow that the quotient wouldn't fit in
3907+ * 32 bits..
3908+ */
3909+ return 0;
3910+}
3911+#endif
3912
3913 #ifdef CONFIG_CPU_FREQ
3914 static unsigned int ref_freq = 0;
3915@@ -333,8 +443,16 @@
3916 {
3917
3918 /* check clock override */
3919- if (override[0] && strncmp(override,"tsc",3))
3920+ if (override[0] && strncmp(override,"tsc",3)) {
3921+#ifdef CONFIG_HPET_TIMER
3922+ if (is_hpet_enabled()) {
3923+ printk(KERN_ERR "Warning: clock= override failed. Defaulting to tsc\n");
3924+ } else
3925+#endif
3926+ {
3927 return -ENODEV;
3928+ }
3929+ }
3930
3931 /*
3932 * If we have APM enabled or the CPU clock speed is variable
3933@@ -368,7 +486,29 @@
3934 count2 = LATCH; /* initialize counter for mark_offset_tsc() */
3935
3936 if (cpu_has_tsc) {
3937- unsigned long tsc_quotient = calibrate_tsc();
3938+ unsigned long tsc_quotient;
3939+#ifdef CONFIG_HPET_TIMER
3940+ if (is_hpet_enabled()){
3941+ unsigned long result, remain;
3942+ printk("Using TSC for gettimeofday\n");
3943+ tsc_quotient = calibrate_tsc_hpet();
3944+ timer_tsc.mark_offset = &mark_offset_tsc_hpet;
3945+ /*
3946+ * Math to calculate hpet to usec multiplier
3947+ * Look for the comments at get_offset_tsc_hpet()
3948+ */
3949+ ASM_DIV64_REG(result, remain, hpet_tick,
3950+ 0, KERNEL_TICK_USEC);
3951+ if (remain > (hpet_tick >> 1))
3952+ result++; /* rounding the result */
3953+
3954+ hpet_usec_quotient = result;
3955+ } else
3956+#endif
3957+ {
3958+ tsc_quotient = calibrate_tsc();
3959+ }
3960+
3961 if (tsc_quotient) {
3962 fast_gettimeoffset_quotient = tsc_quotient;
3963 use_tsc = 1;
3964diff -Nru a/arch/i386/mach-visws/mpparse.c b/arch/i386/mach-visws/mpparse.c
3965--- a/arch/i386/mach-visws/mpparse.c Mon Aug 18 19:46:23 2003
3966+++ b/arch/i386/mach-visws/mpparse.c Sun Aug 31 16:14:17 2003
3967@@ -38,7 +38,7 @@
3968 void __init MP_processor_info (struct mpc_config_processor *m)
3969 {
3970 int ver, logical_apicid;
3971- cpumask_t apic_cpus;
3972+ physid_mask_t apic_cpus;
3973
3974 if (!(m->mpc_cpuflag & CPU_ENABLED))
3975 return;
3976diff -Nru a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
3977--- a/arch/i386/mach-voyager/voyager_smp.c Mon Aug 18 19:46:23 2003
3978+++ b/arch/i386/mach-voyager/voyager_smp.c Sun Aug 31 16:14:42 2003
3979@@ -130,7 +130,7 @@
3980 {
3981 int cpu;
3982
3983- for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
3984+ for_each_cpu(cpu, cpu_online_map) {
3985 if(cpuset & (1<<cpu)) {
3986 #ifdef VOYAGER_DEBUG
3987 if(!cpu_isset(cpu, cpu_online_map))
3988@@ -874,10 +874,10 @@
3989 asmlinkage void
3990 smp_invalidate_interrupt(void)
3991 {
3992- __u8 cpu = get_cpu();
3993+ __u8 cpu = smp_processor_id();
3994
3995- if (!(smp_invalidate_needed & (1UL << cpu)))
3996- goto out;
3997+ if (!test_bit(cpu, &smp_invalidate_needed))
3998+ return;
3999 /* This will flood messages. Don't uncomment unless you see
4000 * Problems with cross cpu invalidation
4001 VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n",
4002@@ -893,9 +893,9 @@
4003 } else
4004 leave_mm(cpu);
4005 }
4006- smp_invalidate_needed |= 1UL << cpu;
4007- out:
4008- put_cpu_no_resched();
4009+ smp_mb__before_clear_bit();
4010+ clear_bit(cpu, &smp_invalidate_needed);
4011+ smp_mb__after_clear_bit();
4012 }
4013
4014 /* All the new flush operations for 2.4 */
4015@@ -929,6 +929,7 @@
4016 send_CPI(cpumask, VIC_INVALIDATE_CPI);
4017
4018 while (smp_invalidate_needed) {
4019+ mb();
4020 if(--stuck == 0) {
4021 printk("***WARNING*** Stuck doing invalidate CPI (CPU%d)\n", smp_processor_id());
4022 break;
4023@@ -1464,7 +1465,7 @@
4024 cpuset &= 0xff; /* only first 8 CPUs vaild for VIC CPI */
4025 if(cpuset == 0)
4026 return;
4027- for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4028+ for_each_cpu(cpu, cpu_online_map) {
4029 if(cpuset & (1<<cpu))
4030 set_bit(cpi, &vic_cpi_mailbox[cpu]);
4031 }
4032@@ -1578,7 +1579,7 @@
4033 VDEBUG(("VOYAGER: enable_vic_irq(%d) CPU%d affinity 0x%lx\n",
4034 irq, cpu, cpu_irq_affinity[cpu]));
4035 spin_lock_irqsave(&vic_irq_lock, flags);
4036- for_each_cpu(real_cpu, mk_cpumask_const(cpu_online_map)) {
4037+ for_each_cpu(real_cpu, cpu_online_map) {
4038 if(!(voyager_extended_vic_processors & (1<<real_cpu)))
4039 continue;
4040 if(!(cpu_irq_affinity[real_cpu] & mask)) {
4041@@ -1723,7 +1724,7 @@
4042
4043 printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
4044 cpu, irq);
4045- for_each_cpu(real_cpu, mk_cpumask_const(mask)) {
4046+ for_each_cpu(real_cpu, mask) {
4047
4048 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
4049 VIC_PROCESSOR_ID);
4050@@ -1808,7 +1809,7 @@
4051 * bus) */
4052 return;
4053
4054- for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4055+ for_each_cpu(cpu, cpu_online_map) {
4056 unsigned long cpu_mask = 1 << cpu;
4057
4058 if(cpu_mask & real_mask) {
4059@@ -1874,7 +1875,7 @@
4060 int old_cpu = smp_processor_id(), cpu;
4061
4062 /* dump the interrupt masks of each processor */
4063- for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4064+ for_each_cpu(cpu, cpu_online_map) {
4065 __u16 imr, isr, irr;
4066 unsigned long flags;
4067
4068diff -Nru a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
4069--- a/arch/i386/oprofile/nmi_int.c Thu Jul 17 17:21:06 2003
4070+++ b/arch/i386/oprofile/nmi_int.c Fri Aug 29 09:02:20 2003
4071@@ -364,10 +364,21 @@
4072 switch (vendor) {
4073 case X86_VENDOR_AMD:
4074 /* Needs to be at least an Athlon (or hammer in 32bit mode) */
4075- if (family < 6)
4076+
4077+ switch (family) {
4078+ default:
4079 return -ENODEV;
4080- model = &op_athlon_spec;
4081- nmi_ops.cpu_type = "i386/athlon";
4082+ case 6:
4083+ model = &op_athlon_spec;
4084+ nmi_ops.cpu_type = "i386/athlon";
4085+ break;
4086+#if defined(CONFIG_X86_64)
4087+ case 0xf:
4088+ model = &op_athlon_spec;
4089+ nmi_ops.cpu_type = "x86-64/hammer";
4090+ break;
4091+#endif /* CONFIG_X86_64 */
4092+ }
4093 break;
4094
4095 #if !defined(CONFIG_X86_64)
4096diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig
4097--- a/arch/ia64/Kconfig Fri Aug 8 10:02:34 2003
4098+++ b/arch/ia64/Kconfig Sun Aug 31 16:14:22 2003
4099@@ -234,8 +234,8 @@
4100 endchoice
4101
4102 config DISCONTIGMEM
4103- bool "Discontiguous memory support" if (IA64_DIG && NUMA)
4104- default y if IA64_SGI_SN2 || IA64_GENERIC
4105+ bool "Discontiguous memory support" if (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC) && NUMA
4106+ default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA
4107 help
4108 Say Y to support efficient handling of discontiguous physical memory,
4109 for architectures which are either NUMA (Non-Uniform Memory Access)
4110@@ -296,29 +296,6 @@
4111 help
4112 If you are compiling a kernel that will run under SGI's IA-64
4113 simulator (Medusa) then say Y, otherwise say N.
4114-
4115-# On IA-64, we always want an ELF /proc/kcore.
4116-config KCORE_ELF
4117- bool
4118- default y
4119- ---help---
4120- If you enabled support for /proc file system then the file
4121- /proc/kcore will contain the kernel core image. This can be used
4122- in gdb:
4123-
4124- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
4125-
4126- You have two choices here: ELF and A.OUT. Selecting ELF will make
4127- /proc/kcore appear in ELF core format as defined by the Executable
4128- and Linking Format specification. Selecting A.OUT will choose the
4129- old "a.out" format which may be necessary for some old versions
4130- of binutils or on some architectures.
4131-
4132- This is especially useful if you have compiled the kernel with the
4133- "-g" option to preserve debugging information. It is mainly used
4134- for examining kernel data structures on the live kernel so if you
4135- don't understand what this means or are not a kernel hacker, just
4136- leave it at its default value ELF.
4137
4138 config FORCE_MAX_ZONEORDER
4139 int
4140diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile
4141--- a/arch/ia64/Makefile Tue Aug 19 23:13:39 2003
4142+++ b/arch/ia64/Makefile Sat Aug 23 10:28:23 2003
4143@@ -70,6 +70,8 @@
4144
4145 .PHONY: boot compressed check
4146
4147+all: compressed
4148+
4149 compressed: vmlinux.gz
4150
4151 vmlinux.gz: vmlinux
4152@@ -100,6 +102,6 @@
4153
4154
4155 define archhelp
4156- echo ' compressed - Build compressed kernel image'
4157+ echo '* compressed - Build compressed kernel image'
4158 echo ' boot - Build vmlinux and bootloader for Ski simulator'
4159 endef
4160diff -Nru a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
4161--- a/arch/ia64/hp/common/sba_iommu.c Sun Jul 27 12:01:33 2003
4162+++ b/arch/ia64/hp/common/sba_iommu.c Sun Aug 31 16:14:08 2003
4163@@ -1935,10 +1935,10 @@
4164 }
4165
4166 static struct acpi_driver acpi_sba_ioc_driver = {
4167- name: "IOC IOMMU Driver",
4168- ids: "HWP0001,HWP0004",
4169- ops: {
4170- add: acpi_sba_ioc_add,
4171+ .name = "IOC IOMMU Driver",
4172+ .ids = "HWP0001,HWP0004",
4173+ .ops = {
4174+ .add = acpi_sba_ioc_add,
4175 },
4176 };
4177
4178diff -Nru a/arch/ia64/ia32/ia32_ioctl.c b/arch/ia64/ia32/ia32_ioctl.c
4179--- a/arch/ia64/ia32/ia32_ioctl.c Thu Aug 7 17:00:00 2003
4180+++ b/arch/ia64/ia32/ia32_ioctl.c Sun Aug 31 16:14:44 2003
4181@@ -70,7 +70,7 @@
4182 #define IOCTL_TABLE_START \
4183 struct ioctl_trans ioctl_start[] = {
4184 #define IOCTL_TABLE_END \
4185- }; struct ioctl_trans ioctl_end[0];
4186+ };
4187
4188 IOCTL_TABLE_START
4189 HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
4190@@ -79,3 +79,5 @@
4191 #include "compat_ioctl.c"
4192 #include <linux/compat_ioctl.h>
4193 IOCTL_TABLE_END
4194+
4195+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
4196diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
4197--- a/arch/ia64/ia32/sys_ia32.c Tue Aug 19 23:13:39 2003
4198+++ b/arch/ia64/ia32/sys_ia32.c Mon Aug 25 14:45:43 2003
4199@@ -76,7 +76,6 @@
4200
4201 #define OFFSET4K(a) ((a) & 0xfff)
4202 #define PAGE_START(addr) ((addr) & PAGE_MASK)
4203-#define PAGE_OFF(addr) ((addr) & ~PAGE_MASK)
4204
4205 #define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
4206 #define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
4207@@ -170,9 +169,9 @@
4208 current->thread.map_base = old_map_base;
4209 current->thread.task_size = old_task_size;
4210 set_fs(USER_DS); /* establish new task-size as the address-limit */
4211- out:
4212- kfree(av);
4213 }
4214+ out:
4215+ kfree(av);
4216 return r;
4217 }
4218
4219@@ -271,11 +270,11 @@
4220
4221 if (old_prot) {
4222 /* copy back the old page contents. */
4223- if (PAGE_OFF(start))
4224- copy_to_user((void *) PAGE_START(start), page, PAGE_OFF(start));
4225- if (PAGE_OFF(end))
4226- copy_to_user((void *) end, page + PAGE_OFF(end),
4227- PAGE_SIZE - PAGE_OFF(end));
4228+ if (offset_in_page(start))
4229+ copy_to_user((void *) PAGE_START(start), page, offset_in_page(start));
4230+ if (offset_in_page(end))
4231+ copy_to_user((void *) end, page + offset_in_page(end),
4232+ PAGE_SIZE - offset_in_page(end));
4233 }
4234
4235 if (!(flags & MAP_ANONYMOUS)) {
4236@@ -330,7 +329,7 @@
4237 "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
4238 current->comm, current->pid, end);
4239 ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
4240- (off + len) - PAGE_OFF(end));
4241+ (off + len) - offset_in_page(end));
4242 if (IS_ERR((void *) ret))
4243 return ret;
4244 pend -= PAGE_SIZE;
4245@@ -347,14 +346,14 @@
4246 tmp = arch_get_unmapped_area(file, pstart - fudge, pend - pstart, 0, flags);
4247 if (tmp != pstart) {
4248 pstart = tmp;
4249- start = pstart + PAGE_OFF(off); /* make start congruent with off */
4250+ start = pstart + offset_in_page(off); /* make start congruent with off */
4251 end = start + len;
4252 pend = PAGE_ALIGN(end);
4253 }
4254 }
4255
4256 poff = off + (pstart - start); /* note: (pstart - start) may be negative */
4257- is_congruent = (flags & MAP_ANONYMOUS) || (PAGE_OFF(poff) == 0);
4258+ is_congruent = (flags & MAP_ANONYMOUS) || (offset_in_page(poff) == 0);
4259
4260 if ((flags & MAP_SHARED) && !is_congruent)
4261 printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
4262@@ -588,7 +587,7 @@
4263
4264 down(&ia32_mmap_sem);
4265 {
4266- if (PAGE_OFF(start)) {
4267+ if (offset_in_page(start)) {
4268 /* start address is 4KB aligned but not page aligned. */
4269 retval = mprotect_subpage(PAGE_START(start), prot);
4270 if (retval < 0)
4271@@ -599,7 +598,7 @@
4272 goto out; /* retval is already zero... */
4273 }
4274
4275- if (PAGE_OFF(end)) {
4276+ if (offset_in_page(end)) {
4277 /* end address is 4KB aligned but not page aligned. */
4278 retval = mprotect_subpage(PAGE_START(end), prot);
4279 if (retval < 0)
4280diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
4281--- a/arch/ia64/kernel/acpi.c Wed Aug 6 12:37:03 2003
4282+++ b/arch/ia64/kernel/acpi.c Tue Aug 26 15:09:18 2003
4283@@ -130,7 +130,7 @@
4284 int vector = -1;
4285
4286 if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
4287- /* correctable platform error interrupt */
4288+ /* corrected platform error interrupt */
4289 vector = platform_intr_list[int_type];
4290 } else
4291 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
4292diff -Nru a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
4293--- a/arch/ia64/kernel/entry.S Sat Aug 16 17:16:48 2003
4294+++ b/arch/ia64/kernel/entry.S Mon Aug 25 14:47:33 2003
4295@@ -1473,7 +1473,7 @@
4296 data8 sys_clock_nanosleep
4297 data8 sys_fstatfs64
4298 data8 sys_statfs64
4299- data8 ia64_ni_syscall
4300+ data8 sys_fadvise64_64
4301 data8 ia64_ni_syscall // 1260
4302 data8 ia64_ni_syscall
4303 data8 ia64_ni_syscall
4304diff -Nru a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
4305--- a/arch/ia64/kernel/fsys.S Thu Jul 10 18:16:32 2003
4306+++ b/arch/ia64/kernel/fsys.S Mon Aug 25 14:47:33 2003
4307@@ -678,9 +678,9 @@
4308 data8 0 // clock_gettime
4309 data8 0 // clock_getres // 1255
4310 data8 0 // clock_nanosleep
4311- data8 0
4312- data8 0
4313- data8 0
4314+ data8 0 // fstatfs64
4315+ data8 0 // statfs64
4316+ data8 0 // fadvise64_64
4317 data8 0 // 1260
4318 data8 0
4319 data8 0
4320diff -Nru a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
4321--- a/arch/ia64/kernel/mca.c Tue Aug 19 23:13:39 2003
4322+++ b/arch/ia64/kernel/mca.c Tue Aug 26 13:42:37 2003
4323@@ -1145,7 +1145,7 @@
4324
4325 ia64_mca_cmc_int_handler(cpe_irq, arg, ptregs);
4326
4327- for (++cpuid ; !cpu_online(cpuid) && cpuid < NR_CPUS ; cpuid++);
4328+ for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
4329
4330 if (cpuid < NR_CPUS) {
4331 platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
4332@@ -1225,7 +1225,7 @@
4333
4334 ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs);
4335
4336- for (++cpuid ; !cpu_online(cpuid) && cpuid < NR_CPUS ; cpuid++);
4337+ for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
4338
4339 if (cpuid < NR_CPUS) {
4340 platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
4341diff -Nru a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
4342--- a/arch/ia64/kernel/perfmon.c Thu Aug 21 15:45:04 2003
4343+++ b/arch/ia64/kernel/perfmon.c Sun Aug 31 16:14:08 2003
4344@@ -2109,7 +2109,7 @@
4345 return 1;
4346 }
4347 static struct dentry_operations pfmfs_dentry_operations = {
4348- d_delete: pfmfs_delete_dentry,
4349+ .d_delete = pfmfs_delete_dentry,
4350 };
4351
4352
4353diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
4354--- a/arch/ia64/kernel/smpboot.c Mon Aug 18 19:46:23 2003
4355+++ b/arch/ia64/kernel/smpboot.c Fri Aug 22 15:20:52 2003
4356@@ -560,7 +560,7 @@
4357 if (cpu_online(cpu))
4358 bogosum += cpu_data(cpu)->loops_per_jiffy;
4359
4360- printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
4361+ printk(KERN_INFO "Total of %lu processors activated (%lu.%02lu BogoMIPS).\n",
4362 num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
4363 }
4364
4365diff -Nru a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
4366--- a/arch/ia64/kernel/sys_ia64.c Wed Jul 9 09:56:58 2003
4367+++ b/arch/ia64/kernel/sys_ia64.c Mon Aug 25 14:45:43 2003
4368@@ -242,7 +242,7 @@
4369 asmlinkage unsigned long
4370 sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, long off)
4371 {
4372- if ((off & ~PAGE_MASK) != 0)
4373+ if (offset_in_page(off) != 0)
4374 return -EINVAL;
4375
4376 addr = do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
4377diff -Nru a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile
4378--- a/arch/ia64/lib/Makefile Fri Jun 20 12:48:24 2003
4379+++ b/arch/ia64/lib/Makefile Mon Aug 25 09:56:27 2003
4380@@ -14,9 +14,6 @@
4381 lib-$(CONFIG_PERFMON) += carta_random.o
4382 lib-$(CONFIG_MD_RAID5) += xor.o
4383
4384-IGNORE_FLAGS_OBJS = __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
4385- __divdi3.o __udivdi3.o __moddi3.o __umoddi3.o
4386-
4387 AFLAGS___divdi3.o =
4388 AFLAGS___udivdi3.o = -DUNSIGNED
4389 AFLAGS___moddi3.o = -DMODULO
4390@@ -27,26 +24,26 @@
4391 AFLAGS___modsi3.o = -DMODULO
4392 AFLAGS___umodsi3.o = -DUNSIGNED -DMODULO
4393
4394-$(obj)/__divdi3.o: $(src)/idiv64.S
4395- $(cmd_as_o_S)
4396+$(obj)/__divdi3.o: $(src)/idiv64.S FORCE
4397+ $(call if_changed_dep,as_o_S)
4398
4399-$(obj)/__udivdi3.o: $(src)/idiv64.S
4400- $(cmd_as_o_S)
4401+$(obj)/__udivdi3.o: $(src)/idiv64.S FORCE
4402+ $(call if_changed_dep,as_o_S)
4403
4404-$(obj)/__moddi3.o: $(src)/idiv64.S
4405- $(cmd_as_o_S)
4406+$(obj)/__moddi3.o: $(src)/idiv64.S FORCE
4407+ $(call if_changed_dep,as_o_S)
4408
4409-$(obj)/__umoddi3.o: $(src)/idiv64.S
4410- $(cmd_as_o_S)
4411+$(obj)/__umoddi3.o: $(src)/idiv64.S FORCE
4412+ $(call if_changed_dep,as_o_S)
4413
4414-$(obj)/__divsi3.o: $(src)/idiv32.S
4415- $(cmd_as_o_S)
4416+$(obj)/__divsi3.o: $(src)/idiv32.S FORCE
4417+ $(call if_changed_dep,as_o_S)
4418
4419-$(obj)/__udivsi3.o: $(src)/idiv32.S
4420- $(cmd_as_o_S)
4421+$(obj)/__udivsi3.o: $(src)/idiv32.S FORCE
4422+ $(call if_changed_dep,as_o_S)
4423
4424-$(obj)/__modsi3.o: $(src)/idiv32.S
4425- $(cmd_as_o_S)
4426+$(obj)/__modsi3.o: $(src)/idiv32.S FORCE
4427+ $(call if_changed_dep,as_o_S)
4428
4429-$(obj)/__umodsi3.o: $(src)/idiv32.S
4430- $(cmd_as_o_S)
4431+$(obj)/__umodsi3.o: $(src)/idiv32.S FORCE
4432+ $(call if_changed_dep,as_o_S)
4433diff -Nru a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
4434--- a/arch/ia64/mm/numa.c Mon Sep 30 06:38:28 2002
4435+++ b/arch/ia64/mm/numa.c Thu Aug 21 05:02:28 2003
4436@@ -42,5 +42,5 @@
4437 paddr < node_memblk[i].start_paddr + node_memblk[i].size)
4438 break;
4439
4440- return (i < num_memblks) ? node_memblk[i].nid : -1;
4441+ return (i < num_memblks) ? node_memblk[i].nid : (num_memblks ? -1 : 0);
4442 }
4443diff -Nru a/arch/ia64/sn/io/drivers/ioconfig_bus.c b/arch/ia64/sn/io/drivers/ioconfig_bus.c
4444--- a/arch/ia64/sn/io/drivers/ioconfig_bus.c Mon May 19 05:42:35 2003
4445+++ b/arch/ia64/sn/io/drivers/ioconfig_bus.c Sun Aug 31 16:14:08 2003
4446@@ -346,9 +346,9 @@
4447 }
4448
4449 struct file_operations ioconfig_bus_fops = {
4450- ioctl:ioconfig_bus_ioctl,
4451- open:ioconfig_bus_open, /* open */
4452- release:ioconfig_bus_close /* release */
4453+ .ioctl = ioconfig_bus_ioctl,
4454+ .open = ioconfig_bus_open, /* open */
4455+ .release = ioconfig_bus_close /* release */
4456 };
4457
4458
4459diff -Nru a/arch/ia64/sn/io/sn2/shub.c b/arch/ia64/sn/io/sn2/shub.c
4460--- a/arch/ia64/sn/io/sn2/shub.c Mon Aug 4 10:02:37 2003
4461+++ b/arch/ia64/sn/io/sn2/shub.c Sun Aug 31 16:14:08 2003
4462@@ -243,7 +243,7 @@
4463 }
4464
4465 struct file_operations shub_mon_fops = {
4466- ioctl: shubstats_ioctl,
4467+ .ioctl = shubstats_ioctl,
4468 };
4469
4470 /*
4471diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
4472--- a/arch/ia64/sn/kernel/setup.c Sat Aug 16 16:26:35 2003
4473+++ b/arch/ia64/sn/kernel/setup.c Sun Aug 31 16:14:08 2003
4474@@ -117,14 +117,14 @@
4475 * VGA color display.
4476 */
4477 struct screen_info sn_screen_info = {
4478- orig_x: 0,
4479- orig_y: 0,
4480- orig_video_mode: 3,
4481- orig_video_cols: 80,
4482- orig_video_ega_bx: 3,
4483- orig_video_lines: 25,
4484- orig_video_isVGA: 1,
4485- orig_video_points: 16
4486+ .orig_x = 0,
4487+ .orig_y = 0,
4488+ .orig_video_mode = 3,
4489+ .orig_video_cols = 80,
4490+ .orig_video_ega_bx = 3,
4491+ .orig_video_lines = 25,
4492+ .orig_video_isVGA = 1,
4493+ .orig_video_points = 16
4494 };
4495
4496 /*
4497diff -Nru a/arch/m68k/Kconfig b/arch/m68k/Kconfig
4498--- a/arch/m68k/Kconfig Sat Aug 2 14:26:16 2003
4499+++ b/arch/m68k/Kconfig Sun Aug 31 16:14:22 2003
4500@@ -342,40 +342,6 @@
4501
4502 menu "General setup"
4503
4504-choice
4505- prompt "Kernel core (/proc/kcore) format"
4506- depends on PROC_FS
4507- default KCORE_ELF
4508-
4509-config KCORE_ELF
4510- bool "ELF"
4511- ---help---
4512- If you enabled support for /proc file system then the file
4513- /proc/kcore will contain the kernel core image. This can be used
4514- in gdb:
4515-
4516- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
4517-
4518- You have two choices here: ELF and A.OUT. Selecting ELF will make
4519- /proc/kcore appear in ELF core format as defined by the Executable
4520- and Linking Format specification. Selecting A.OUT will choose the
4521- old "a.out" format which may be necessary for some old versions
4522- of binutils or on some architectures.
4523-
4524- This is especially useful if you have compiled the kernel with the
4525- "-g" option to preserve debugging information. It is mainly used
4526- for examining kernel data structures on the live kernel so if you
4527- don't understand what this means or are not a kernel hacker, just
4528- leave it at its default value ELF.
4529-
4530-config KCORE_AOUT
4531- bool "A.OUT"
4532- help
4533- Not necessary unless you're using a very out-of-date binutils
4534- version. You probably want KCORE_ELF.
4535-
4536-endchoice
4537-
4538 source "fs/Kconfig.binfmt"
4539
4540 config ZORRO
4541diff -Nru a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
4542--- /dev/null Wed Dec 31 16:00:00 1969
4543+++ b/arch/m68k/kernel/vmlinux-std.lds Sun Jun 15 03:46:43 2003
4544@@ -0,0 +1,97 @@
4545+/* ld script to make m68k Linux kernel */
4546+
4547+#include <asm-generic/vmlinux.lds.h>
4548+
4549+OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4550+OUTPUT_ARCH(m68k)
4551+ENTRY(_start)
4552+jiffies = jiffies_64 + 4;
4553+SECTIONS
4554+{
4555+ . = 0x1000;
4556+ _text = .; /* Text and read-only data */
4557+ .text : {
4558+ *(.text)
4559+ *(.fixup)
4560+ *(.gnu.warning)
4561+ } = 0x4e75
4562+
4563+ . = ALIGN(16); /* Exception table */
4564+ __start___ex_table = .;
4565+ __ex_table : { *(__ex_table) }
4566+ __stop___ex_table = .;
4567+
4568+ RODATA
4569+
4570+ _etext = .; /* End of text section */
4571+
4572+ .data : { /* Data */
4573+ *(.data)
4574+ CONSTRUCTORS
4575+ }
4576+
4577+ .bss : { *(.bss) } /* BSS */
4578+
4579+ . = ALIGN(16);
4580+ .data.cacheline_aligned : { *(.data.cacheline_aligned) }
4581+
4582+ _edata = .; /* End of data section */
4583+
4584+ /* will be freed after init */
4585+ . = ALIGN(4096); /* Init code and data */
4586+ __init_begin = .;
4587+ .init.text : {
4588+ _sinittext = .;
4589+ *(.init.text)
4590+ _einittext = .;
4591+ }
4592+ .init.data : { *(.init.data) }
4593+ . = ALIGN(16);
4594+ __setup_start = .;
4595+ .init.setup : { *(.init.setup) }
4596+ __setup_end = .;
4597+ __start___param = .;
4598+ __param : { *(__param) }
4599+ __stop___param = .;
4600+ __initcall_start = .;
4601+ .initcall.init : {
4602+ *(.initcall1.init)
4603+ *(.initcall2.init)
4604+ *(.initcall3.init)
4605+ *(.initcall4.init)
4606+ *(.initcall5.init)
4607+ *(.initcall6.init)
4608+ *(.initcall7.init)
4609+ }
4610+ __initcall_end = .;
4611+ __con_initcall_start = .;
4612+ .con_initcall.init : { *(.con_initcall.init) }
4613+ __con_initcall_end = .;
4614+ SECURITY_INIT
4615+ . = ALIGN(8192);
4616+ __initramfs_start = .;
4617+ .init.ramfs : { *(.init.ramfs) }
4618+ __initramfs_end = .;
4619+ . = ALIGN(8192);
4620+ __init_end = .;
4621+
4622+ .data.init_task : { *(.data.init_task) } /* The initial task and kernel stack */
4623+
4624+ _end = . ;
4625+
4626+ /* Sections to be discarded */
4627+ /DISCARD/ : {
4628+ *(.exit.text)
4629+ *(.exit.data)
4630+ *(.exitcall.exit)
4631+ }
4632+
4633+ /* Stabs debugging sections. */
4634+ .stab 0 : { *(.stab) }
4635+ .stabstr 0 : { *(.stabstr) }
4636+ .stab.excl 0 : { *(.stab.excl) }
4637+ .stab.exclstr 0 : { *(.stab.exclstr) }
4638+ .stab.index 0 : { *(.stab.index) }
4639+ .stab.indexstr 0 : { *(.stab.indexstr) }
4640+ .comment 0 : { *(.comment) }
4641+}
4642diff -Nru a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
4643--- /dev/null Wed Dec 31 16:00:00 1969
4644+++ b/arch/m68k/kernel/vmlinux-sun3.lds Sun Jun 15 03:46:43 2003
4645@@ -0,0 +1,97 @@
4646+/* ld script to make m68k Linux kernel */
4647+
4648+#include <asm-generic/vmlinux.lds.h>
4649+
4650+OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4651+OUTPUT_ARCH(m68k)
4652+ENTRY(_start)
4653+jiffies = jiffies_64 + 4;
4654+SECTIONS
4655+{
4656+ . = 0xE004000;
4657+ _text = .; /* Text and read-only data */
4658+ .text : {
4659+ *(.head)
4660+ *(.text)
4661+ *(.fixup)
4662+ *(.gnu.warning)
4663+ } = 0x4e75
4664+ RODATA
4665+
4666+ _etext = .; /* End of text section */
4667+
4668+ .data : { /* Data */
4669+ *(.data)
4670+ CONSTRUCTORS
4671+ . = ALIGN(16); /* Exception table */
4672+ __start___ex_table = .;
4673+ *(__ex_table)
4674+ __stop___ex_table = .;
4675+ }
4676+ /* End of data goes *here* so that freeing init code works properly. */
4677+ _edata = .;
4678+
4679+ /* will be freed after init */
4680+ . = ALIGN(8192); /* Init code and data */
4681+__init_begin = .;
4682+ .init.text : {
4683+ _sinittext = .;
4684+ *(.init.text)
4685+ _einittext = .;
4686+ }
4687+ .init.data : { *(.init.data) }
4688+ . = ALIGN(16);
4689+ __setup_start = .;
4690+ .init.setup : { *(.init.setup) }
4691+ __setup_end = .;
4692+ __start___param = .;
4693+ __param : { *(__param) }
4694+ __stop___param = .;
4695+ __initcall_start = .;
4696+ .initcall.init : {
4697+ *(.initcall1.init)
4698+ *(.initcall2.init)
4699+ *(.initcall3.init)
4700+ *(.initcall4.init)
4701+ *(.initcall5.init)
4702+ *(.initcall6.init)
4703+ *(.initcall7.init)
4704+ }
4705+ __initcall_end = .;
4706+ __con_initcall_start = .;
4707+ .con_initcall.init : { *(.con_initcall.init) }
4708+ __con_initcall_end = .;
4709+ SECURITY_INIT
4710+ . = ALIGN(8192);
4711+ __initramfs_start = .;
4712+ .init.ramfs : { *(.init.ramfs) }
4713+ __initramfs_end = .;
4714+ . = ALIGN(8192);
4715+ __init_end = .;
4716+ .init.task : { *(init_task) }
4717+
4718+
4719+ .bss : { *(.bss) } /* BSS */
4720+
4721+ _end = . ;
4722+
4723+ /* Sections to be discarded */
4724+ /DISCARD/ : {
4725+ *(.exit.text)
4726+ *(.exit.data)
4727+ *(.exitcall.exit)
4728+ }
4729+
4730+ .crap : {
4731+ /* Stabs debugging sections. */
4732+ *(.stab)
4733+ *(.stabstr)
4734+ *(.stab.excl)
4735+ *(.stab.exclstr)
4736+ *(.stab.index)
4737+ *(.stab.indexstr)
4738+ *(.comment)
4739+ *(.note)
4740+ }
4741+
4742+}
4743diff -Nru a/arch/m68k/vmlinux-std.lds b/arch/m68k/vmlinux-std.lds
4744--- a/arch/m68k/vmlinux-std.lds Wed Jun 11 17:40:05 2003
4745+++ /dev/null Wed Dec 31 16:00:00 1969
4746@@ -1,97 +0,0 @@
4747-/* ld script to make m68k Linux kernel */
4748-
4749-#include <asm-generic/vmlinux.lds.h>
4750-
4751-OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4752-OUTPUT_ARCH(m68k)
4753-ENTRY(_start)
4754-jiffies = jiffies_64 + 4;
4755-SECTIONS
4756-{
4757- . = 0x1000;
4758- _text = .; /* Text and read-only data */
4759- .text : {
4760- *(.text)
4761- *(.fixup)
4762- *(.gnu.warning)
4763- } = 0x4e75
4764-
4765- . = ALIGN(16); /* Exception table */
4766- __start___ex_table = .;
4767- __ex_table : { *(__ex_table) }
4768- __stop___ex_table = .;
4769-
4770- RODATA
4771-
4772- _etext = .; /* End of text section */
4773-
4774- .data : { /* Data */
4775- *(.data)
4776- CONSTRUCTORS
4777- }
4778-
4779- .bss : { *(.bss) } /* BSS */
4780-
4781- . = ALIGN(16);
4782- .data.cacheline_aligned : { *(.data.cacheline_aligned) }
4783-
4784- _edata = .; /* End of data section */
4785-
4786- /* will be freed after init */
4787- . = ALIGN(4096); /* Init code and data */
4788- __init_begin = .;
4789- .init.text : {
4790- _sinittext = .;
4791- *(.init.text)
4792- _einittext = .;
4793- }
4794- .init.data : { *(.init.data) }
4795- . = ALIGN(16);
4796- __setup_start = .;
4797- .init.setup : { *(.init.setup) }
4798- __setup_end = .;
4799- __start___param = .;
4800- __param : { *(__param) }
4801- __stop___param = .;
4802- __initcall_start = .;
4803- .initcall.init : {
4804- *(.initcall1.init)
4805- *(.initcall2.init)
4806- *(.initcall3.init)
4807- *(.initcall4.init)
4808- *(.initcall5.init)
4809- *(.initcall6.init)
4810- *(.initcall7.init)
4811- }
4812- __initcall_end = .;
4813- __con_initcall_start = .;
4814- .con_initcall.init : { *(.con_initcall.init) }
4815- __con_initcall_end = .;
4816- SECURITY_INIT
4817- . = ALIGN(8192);
4818- __initramfs_start = .;
4819- .init.ramfs : { *(.init.ramfs) }
4820- __initramfs_end = .;
4821- . = ALIGN(8192);
4822- __init_end = .;
4823-
4824- .data.init_task : { *(.data.init_task) } /* The initial task and kernel stack */
4825-
4826- _end = . ;
4827-
4828- /* Sections to be discarded */
4829- /DISCARD/ : {
4830- *(.exit.text)
4831- *(.exit.data)
4832- *(.exitcall.exit)
4833- }
4834-
4835- /* Stabs debugging sections. */
4836- .stab 0 : { *(.stab) }
4837- .stabstr 0 : { *(.stabstr) }
4838- .stab.excl 0 : { *(.stab.excl) }
4839- .stab.exclstr 0 : { *(.stab.exclstr) }
4840- .stab.index 0 : { *(.stab.index) }
4841- .stab.indexstr 0 : { *(.stab.indexstr) }
4842- .comment 0 : { *(.comment) }
4843-}
4844diff -Nru a/arch/m68k/vmlinux-sun3.lds b/arch/m68k/vmlinux-sun3.lds
4845--- a/arch/m68k/vmlinux-sun3.lds Wed Jun 11 17:40:05 2003
4846+++ /dev/null Wed Dec 31 16:00:00 1969
4847@@ -1,97 +0,0 @@
4848-/* ld script to make m68k Linux kernel */
4849-
4850-#include <asm-generic/vmlinux.lds.h>
4851-
4852-OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4853-OUTPUT_ARCH(m68k)
4854-ENTRY(_start)
4855-jiffies = jiffies_64 + 4;
4856-SECTIONS
4857-{
4858- . = 0xE004000;
4859- _text = .; /* Text and read-only data */
4860- .text : {
4861- *(.head)
4862- *(.text)
4863- *(.fixup)
4864- *(.gnu.warning)
4865- } = 0x4e75
4866- RODATA
4867-
4868- _etext = .; /* End of text section */
4869-
4870- .data : { /* Data */
4871- *(.data)
4872- CONSTRUCTORS
4873- . = ALIGN(16); /* Exception table */
4874- __start___ex_table = .;
4875- *(__ex_table)
4876- __stop___ex_table = .;
4877- }
4878- /* End of data goes *here* so that freeing init code works properly. */
4879- _edata = .;
4880-
4881- /* will be freed after init */
4882- . = ALIGN(8192); /* Init code and data */
4883-__init_begin = .;
4884- .init.text : {
4885- _sinittext = .;
4886- *(.init.text)
4887- _einittext = .;
4888- }
4889- .init.data : { *(.init.data) }
4890- . = ALIGN(16);
4891- __setup_start = .;
4892- .init.setup : { *(.init.setup) }
4893- __setup_end = .;
4894- __start___param = .;
4895- __param : { *(__param) }
4896- __stop___param = .;
4897- __initcall_start = .;
4898- .initcall.init : {
4899- *(.initcall1.init)
4900- *(.initcall2.init)
4901- *(.initcall3.init)
4902- *(.initcall4.init)
4903- *(.initcall5.init)
4904- *(.initcall6.init)
4905- *(.initcall7.init)
4906- }
4907- __initcall_end = .;
4908- __con_initcall_start = .;
4909- .con_initcall.init : { *(.con_initcall.init) }
4910- __con_initcall_end = .;
4911- SECURITY_INIT
4912- . = ALIGN(8192);
4913- __initramfs_start = .;
4914- .init.ramfs : { *(.init.ramfs) }
4915- __initramfs_end = .;
4916- . = ALIGN(8192);
4917- __init_end = .;
4918- .init.task : { *(init_task) }
4919-
4920-
4921- .bss : { *(.bss) } /* BSS */
4922-
4923- _end = . ;
4924-
4925- /* Sections to be discarded */
4926- /DISCARD/ : {
4927- *(.exit.text)
4928- *(.exit.data)
4929- *(.exitcall.exit)
4930- }
4931-
4932- .crap : {
4933- /* Stabs debugging sections. */
4934- *(.stab)
4935- *(.stabstr)
4936- *(.stab.excl)
4937- *(.stab.exclstr)
4938- *(.stab.index)
4939- *(.stab.indexstr)
4940- *(.comment)
4941- *(.note)
4942- }
4943-
4944-}
4945diff -Nru a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
4946--- a/arch/m68knommu/Kconfig Sat Aug 2 14:26:16 2003
4947+++ b/arch/m68knommu/Kconfig Sun Aug 31 16:14:22 2003
4948@@ -490,14 +490,6 @@
4949
4950 menu "Executable file formats"
4951
4952-config KCORE_AOUT
4953- bool
4954- default y
4955-
4956-config KCORE_ELF
4957- bool
4958- default y
4959-
4960 source "fs/Kconfig.binfmt"
4961
4962 endmenu
4963diff -Nru a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c
4964--- a/arch/m68knommu/platform/5206/config.c Tue May 27 20:13:12 2003
4965+++ b/arch/m68knommu/platform/5206/config.c Sat Aug 23 06:07:40 2003
4966@@ -14,6 +14,7 @@
4967 #include <linux/sched.h>
4968 #include <linux/param.h>
4969 #include <linux/init.h>
4970+#include <linux/interrupt.h>
4971 #include <asm/irq.h>
4972 #include <asm/dma.h>
4973 #include <asm/traps.h>
4974@@ -26,7 +27,7 @@
4975 /***************************************************************************/
4976
4977 void coldfire_tick(void);
4978-void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
4979+void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
4980 unsigned long coldfire_timer_offset(void);
4981 void coldfire_trap_init(void);
4982 void coldfire_reset(void);
4983diff -Nru a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
4984--- a/arch/m68knommu/platform/5206e/config.c Tue May 27 20:13:12 2003
4985+++ b/arch/m68knommu/platform/5206e/config.c Sat Aug 23 06:07:40 2003
4986@@ -12,6 +12,7 @@
4987 #include <linux/kernel.h>
4988 #include <linux/sched.h>
4989 #include <linux/param.h>
4990+#include <linux/interrupt.h>
4991 #include <asm/irq.h>
4992 #include <asm/dma.h>
4993 #include <asm/traps.h>
4994@@ -26,7 +27,7 @@
4995 /***************************************************************************/
4996
4997 void coldfire_tick(void);
4998-void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
4999+void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5000 unsigned long coldfire_timer_offset(void);
5001 void coldfire_trap_init(void);
5002 void coldfire_reset(void);
5003diff -Nru a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
5004--- a/arch/m68knommu/platform/5249/config.c Tue Jun 17 06:35:38 2003
5005+++ b/arch/m68knommu/platform/5249/config.c Sat Aug 23 06:07:40 2003
5006@@ -26,7 +26,7 @@
5007 /***************************************************************************/
5008
5009 void coldfire_tick(void);
5010-void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5011+void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5012 unsigned long coldfire_timer_offset(void);
5013 void coldfire_trap_init(void);
5014 void coldfire_reset(void);
5015diff -Nru a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
5016--- a/arch/m68knommu/platform/5272/config.c Tue Jun 17 06:35:38 2003
5017+++ b/arch/m68knommu/platform/5272/config.c Sat Aug 23 06:07:40 2003
5018@@ -14,6 +14,7 @@
5019 #include <linux/sched.h>
5020 #include <linux/param.h>
5021 #include <linux/init.h>
5022+#include <linux/interrupt.h>
5023 #include <asm/irq.h>
5024 #include <asm/dma.h>
5025 #include <asm/traps.h>
5026@@ -27,7 +28,7 @@
5027 /***************************************************************************/
5028
5029 void coldfire_tick(void);
5030-void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5031+void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5032 unsigned long coldfire_timer_offset(void);
5033 void coldfire_trap_init(void);
5034 void coldfire_reset(void);
5035diff -Nru a/arch/mips/Kconfig b/arch/mips/Kconfig
5036--- a/arch/mips/Kconfig Mon Jul 28 04:57:50 2003
5037+++ b/arch/mips/Kconfig Sun Aug 31 16:14:22 2003
5038@@ -1126,31 +1126,6 @@
5039
5040 menu "Executable file formats"
5041
5042-config KCORE_ELF
5043- bool
5044- default y
5045- ---help---
5046- If you enabled support for /proc file system then the file
5047- /proc/kcore will contain the kernel core image. This can be used
5048- in gdb:
5049-
5050- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
5051-
5052- You have two choices here: ELF and A.OUT. Selecting ELF will make
5053- /proc/kcore appear in ELF core format as defined by the Executable
5054- and Linking Format specification. Selecting A.OUT will choose the
5055- old "a.out" format which may be necessary for some old versions
5056- of binutils or on some architectures.
5057-
5058- This is especially useful if you have compiled the kernel with the
5059- "-g" option to preserve debugging information. It is mainly used
5060- for examining kernel data structures on the live kernel so if you
5061- don't understand what this means or are not a kernel hacker, just
5062- leave it at its default value ELF.
5063-
5064-config KCORE_AOUT
5065- bool
5066-
5067 source "fs/Kconfig.binfmt"
5068
5069 config TRAD_SIGNALS
5070diff -Nru a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
5071--- a/arch/mips/au1000/common/dma.c Mon Jun 23 12:12:26 2003
5072+++ b/arch/mips/au1000/common/dma.c Sun Aug 31 16:14:08 2003
5073@@ -62,14 +62,14 @@
5074 spinlock_t au1000_dma_spin_lock = SPIN_LOCK_UNLOCKED;
5075
5076 struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
5077- {dev_id:-1,},
5078- {dev_id:-1,},
5079- {dev_id:-1,},
5080- {dev_id:-1,},
5081- {dev_id:-1,},
5082- {dev_id:-1,},
5083- {dev_id:-1,},
5084- {dev_id:-1,}
5085+ {.dev_id = -1,},
5086+ {.dev_id = -1,},
5087+ {.dev_id = -1,},
5088+ {.dev_id = -1,},
5089+ {.dev_id = -1,},
5090+ {.dev_id = -1,},
5091+ {.dev_id = -1,},
5092+ {.dev_id = -1,}
5093 };
5094
5095 // Device FIFO addresses and default DMA modes
5096diff -Nru a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c
5097--- a/arch/mips/kernel/ioctl32.c Mon Jul 28 04:57:50 2003
5098+++ b/arch/mips/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
5099@@ -810,8 +810,7 @@
5100 #define IOCTL_TABLE_START \
5101 struct ioctl_trans ioctl_start[] = {
5102 #define IOCTL_TABLE_END \
5103- }; struct ioctl_trans ioctl_end[0];
5104-
5105+ };
5106
5107 IOCTL_TABLE_START
5108 #include <linux/compat_ioctl.h>
5109@@ -1205,6 +1204,8 @@
5110 COMPATIBLE_IOCTL(RTC_WKALM_SET)
5111 COMPATIBLE_IOCTL(RTC_WKALM_RD)
5112 IOCTL_TABLE_END
5113+
5114+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
5115
5116 #define NR_IOCTL_TRANS (sizeof(ioctl_translations) / \
5117 sizeof(ioctl_translations[0]))
5118diff -Nru a/arch/mips/sibyte/cfe/console.c b/arch/mips/sibyte/cfe/console.c
5119--- a/arch/mips/sibyte/cfe/console.c Mon Jul 28 04:57:50 2003
5120+++ b/arch/mips/sibyte/cfe/console.c Sun Aug 31 16:14:08 2003
5121@@ -9,7 +9,6 @@
5122 #include "cfe_error.h"
5123
5124 extern int cfe_cons_handle;
5125-static kdev_t cfe_consdev;
5126
5127 static void cfe_console_write(struct console *cons, const char *str,
5128 unsigned int count)
5129@@ -57,15 +56,12 @@
5130 #ifdef CONFIG_SIBYTE_SB1250_DUART
5131 if (!strcmp(consdev, "uart0")) {
5132 setleds("u0cn");
5133-// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 0);
5134 } else if (!strcmp(consdev, "uart1")) {
5135 setleds("u1cn");
5136-// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 1);
5137 #endif
5138 #ifdef CONFIG_VGA_CONSOLE
5139 } else if (!strcmp(consdev, "pcconsole0")) {
5140 setleds("pccn");
5141-// cfe_consdev = MKDEV(TTY_MAJOR, 0);
5142 #endif
5143 } else
5144 return -ENODEV;
5145@@ -74,12 +70,12 @@
5146 }
5147
5148 static struct console sb1250_cfe_cons = {
5149- name: "cfe",
5150- write: cfe_console_write,
5151- device: cfe_console_device,
5152- setup: cfe_console_setup,
5153- flags: CON_PRINTBUFFER,
5154- index: -1,
5155+ .name = "cfe",
5156+ .write = cfe_console_write,
5157+ .device = cfe_console_device,
5158+ .setup = cfe_console_setup,
5159+ .flags = CON_PRINTBUFFER,
5160+ .index = -1,
5161 };
5162
5163 static int __init sb1250_cfe_console_init(void)
5164diff -Nru a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
5165--- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c Mon Jul 28 04:57:50 2003
5166+++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c Tue Aug 26 09:25:40 2003
5167@@ -253,7 +253,7 @@
5168 {
5169 int minor;
5170
5171- minor = minor(inode->i_rdev);
5172+ minor = iminor(inode);
5173 if (minor != 0) {
5174 return -ENODEV;
5175 }
5176@@ -278,7 +278,7 @@
5177 {
5178 int minor;
5179
5180- minor = minor(inode->i_rdev);
5181+ minor = iminor(inode);
5182 if (minor != 0 || !sbp.open) {
5183 return -ENODEV;
5184 }
5185diff -Nru a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
5186--- a/arch/mips/tx4927/common/tx4927_irq.c Mon Apr 14 20:10:10 2003
5187+++ b/arch/mips/tx4927/common/tx4927_irq.c Sun Aug 31 16:14:08 2003
5188@@ -149,26 +149,26 @@
5189
5190 #define TX4927_CP0_NAME "TX4927-CP0"
5191 static struct hw_interrupt_type tx4927_irq_cp0_type = {
5192- typename: TX4927_CP0_NAME,
5193- startup: tx4927_irq_cp0_startup,
5194- shutdown: tx4927_irq_cp0_shutdown,
5195- enable: tx4927_irq_cp0_enable,
5196- disable: tx4927_irq_cp0_disable,
5197- ack: tx4927_irq_cp0_mask_and_ack,
5198- end: tx4927_irq_cp0_end,
5199- set_affinity: NULL
5200+ .typename = TX4927_CP0_NAME,
5201+ .startup = tx4927_irq_cp0_startup,
5202+ .shutdown = tx4927_irq_cp0_shutdown,
5203+ .enable = tx4927_irq_cp0_enable,
5204+ .disable = tx4927_irq_cp0_disable,
5205+ .ack = tx4927_irq_cp0_mask_and_ack,
5206+ .end = tx4927_irq_cp0_end,
5207+ .set_affinity = NULL
5208 };
5209
5210 #define TX4927_PIC_NAME "TX4927-PIC"
5211 static struct hw_interrupt_type tx4927_irq_pic_type = {
5212- typename: TX4927_PIC_NAME,
5213- startup: tx4927_irq_pic_startup,
5214- shutdown: tx4927_irq_pic_shutdown,
5215- enable: tx4927_irq_pic_enable,
5216- disable: tx4927_irq_pic_disable,
5217- ack: tx4927_irq_pic_mask_and_ack,
5218- end: tx4927_irq_pic_end,
5219- set_affinity: NULL
5220+ .typename = TX4927_PIC_NAME,
5221+ .startup = tx4927_irq_pic_startup,
5222+ .shutdown = tx4927_irq_pic_shutdown,
5223+ .enable = tx4927_irq_pic_enable,
5224+ .disable = tx4927_irq_pic_disable,
5225+ .ack = tx4927_irq_pic_mask_and_ack,
5226+ .end = tx4927_irq_pic_end,
5227+ .set_affinity = NULL
5228 };
5229
5230 #define TX4927_PIC_ACTION(s) { no_action, 0, 0, s, NULL, NULL }
5231diff -Nru a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
5232--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c Thu Jul 3 15:17:43 2003
5233+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c Sun Aug 31 16:14:08 2003
5234@@ -255,14 +255,14 @@
5235
5236 #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
5237 static struct hw_interrupt_type toshiba_rbtx4927_irq_ioc_type = {
5238- typename:TOSHIBA_RBTX4927_IOC_NAME,
5239- startup:toshiba_rbtx4927_irq_ioc_startup,
5240- shutdown:toshiba_rbtx4927_irq_ioc_shutdown,
5241- enable:toshiba_rbtx4927_irq_ioc_enable,
5242- disable:toshiba_rbtx4927_irq_ioc_disable,
5243- ack:toshiba_rbtx4927_irq_ioc_mask_and_ack,
5244- end:toshiba_rbtx4927_irq_ioc_end,
5245- set_affinity:NULL
5246+ .typename = TOSHIBA_RBTX4927_IOC_NAME,
5247+ .startup = toshiba_rbtx4927_irq_ioc_startup,
5248+ .shutdown = toshiba_rbtx4927_irq_ioc_shutdown,
5249+ .enable = toshiba_rbtx4927_irq_ioc_enable,
5250+ .disable = toshiba_rbtx4927_irq_ioc_disable,
5251+ .ack = toshiba_rbtx4927_irq_ioc_mask_and_ack,
5252+ .end = toshiba_rbtx4927_irq_ioc_end,
5253+ .set_affinity = NULL
5254 };
5255 #define TOSHIBA_RBTX4927_IOC_INTR_ENAB 0xbc002000
5256 #define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
5257@@ -271,14 +271,14 @@
5258 #ifdef CONFIG_TOSHIBA_FPCIB0
5259 #define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
5260 static struct hw_interrupt_type toshiba_rbtx4927_irq_isa_type = {
5261- typename:TOSHIBA_RBTX4927_ISA_NAME,
5262- startup:toshiba_rbtx4927_irq_isa_startup,
5263- shutdown:toshiba_rbtx4927_irq_isa_shutdown,
5264- enable:toshiba_rbtx4927_irq_isa_enable,
5265- disable:toshiba_rbtx4927_irq_isa_disable,
5266- ack:toshiba_rbtx4927_irq_isa_mask_and_ack,
5267- end:toshiba_rbtx4927_irq_isa_end,
5268- set_affinity:NULL
5269+ .typename = TOSHIBA_RBTX4927_ISA_NAME,
5270+ .startup = toshiba_rbtx4927_irq_isa_startup,
5271+ .shutdown = toshiba_rbtx4927_irq_isa_shutdown,
5272+ .enable = toshiba_rbtx4927_irq_isa_enable,
5273+ .disable = toshiba_rbtx4927_irq_isa_disable,
5274+ .ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
5275+ .end = toshiba_rbtx4927_irq_isa_end,
5276+ .set_affinity = NULL
5277 };
5278 #endif
5279
5280diff -Nru a/arch/mips/vr41xx/common/vrc4173.c b/arch/mips/vr41xx/common/vrc4173.c
5281--- a/arch/mips/vr41xx/common/vrc4173.c Thu Jul 31 08:59:17 2003
5282+++ b/arch/mips/vr41xx/common/vrc4173.c Sun Aug 31 16:14:08 2003
5283@@ -250,10 +250,10 @@
5284 }
5285
5286 static struct pci_driver vrc4173_driver = {
5287- name: "NEC VRC4173",
5288- probe: vrc4173_probe,
5289- remove: NULL,
5290- id_table: vrc4173_table,
5291+ .name = "NEC VRC4173",
5292+ .probe = vrc4173_probe,
5293+ .remove = NULL,
5294+ .id_table = vrc4173_table,
5295 };
5296
5297 static int __devinit vrc4173_init(void)
5298diff -Nru a/arch/parisc/Kconfig b/arch/parisc/Kconfig
5299--- a/arch/parisc/Kconfig Sat Aug 2 14:26:16 2003
5300+++ b/arch/parisc/Kconfig Sun Aug 31 16:14:22 2003
5301@@ -161,11 +161,6 @@
5302
5303 menu "Executable file formats"
5304
5305-config KCORE_ELF
5306- bool
5307- depends on PROC_FS
5308- default y
5309-
5310 source "fs/Kconfig.binfmt"
5311
5312 endmenu
5313diff -Nru a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
5314--- a/arch/parisc/kernel/ioctl32.c Fri May 2 10:22:56 2003
5315+++ b/arch/parisc/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
5316@@ -1426,7 +1426,7 @@
5317 return -EINVAL;
5318
5319 tty = (struct tty_struct *)file->private_data;
5320- if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
5321+ if (tty_paranoia_check(tty, inode, "tty_ioctl"))
5322 return -EINVAL;
5323
5324 if (tty->driver->ioctl != vt_ioctl)
5325@@ -2458,7 +2458,7 @@
5326 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl)
5327
5328 #define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
5329-#define IOCTL_TABLE_END }; struct ioctl_trans ioctl_end[0];
5330+#define IOCTL_TABLE_END };
5331
5332 IOCTL_TABLE_START
5333 #include <linux/compat_ioctl.h>
5334@@ -2631,3 +2631,4 @@
5335 #endif /* DRM */
5336 IOCTL_TABLE_END
5337
5338+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
5339diff -Nru a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c
5340--- a/arch/ppc/8260_io/uart.c Wed Jun 11 12:32:53 2003
5341+++ b/arch/ppc/8260_io/uart.c Tue Aug 26 09:25:39 2003
5342@@ -50,6 +50,10 @@
5343 #include <asm/cpm_8260.h>
5344 #include <asm/irq.h>
5345
5346+#ifdef CONFIG_MAGIC_SYSRQ
5347+#include <linux/sysrq.h>
5348+#endif
5349+
5350 #ifdef CONFIG_SERIAL_CONSOLE
5351 #include <linux/console.h>
5352
5353@@ -77,6 +81,14 @@
5354 static struct tty_driver *serial_driver;
5355 static int serial_console_setup(struct console *co, char *options);
5356
5357+static void serial_console_write(struct console *c, const char *s,
5358+ unsigned count);
5359+static kdev_t serial_console_device(struct console *c);
5360+
5361+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5362+static unsigned long break_pressed; /* break, really ... */
5363+#endif
5364+
5365 /*
5366 * Serial driver configuration section. Here are the various options:
5367 */
5368@@ -208,6 +220,15 @@
5369 cbd_t *tx_cur;
5370 } ser_info_t;
5371
5372+static struct console sercons = {
5373+ .name = "ttyS",
5374+ .write = serial_console_write,
5375+ .device = serial_console_device,
5376+ .setup = serial_console_setup,
5377+ .flags = CON_PRINTBUFFER,
5378+ .index = CONFIG_SERIAL_CONSOLE_PORT,
5379+};
5380+
5381 static void change_speed(ser_info_t *info);
5382 static void rs_8xx_wait_until_sent(struct tty_struct *tty, int timeout);
5383
5384@@ -328,7 +349,7 @@
5385 schedule_work(&info->tqueue);
5386 }
5387
5388-static _INLINE_ void receive_chars(ser_info_t *info)
5389+static _INLINE_ void receive_chars(ser_info_t *info, struct pt_regs *regs)
5390 {
5391 struct tty_struct *tty = info->tty;
5392 unsigned char ch, *cp;
5393@@ -450,6 +471,19 @@
5394 }
5395 }
5396 }
5397+
5398+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5399+ if (break_pressed && info->line == sercons.index) {
5400+ if (ch != 0 && time_before(jiffies,
5401+ break_pressed + HZ*5)) {
5402+ handle_sysrq(ch, regs, NULL, NULL);
5403+ break_pressed = 0;
5404+ goto ignore_char;
5405+ } else
5406+ break_pressed = 0;
5407+ }
5408+#endif
5409+
5410 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
5411 break;
5412
5413@@ -458,6 +492,10 @@
5414 tty->flip.count++;
5415 }
5416
5417+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5418+ ignore_char:
5419+#endif
5420+
5421 /* This BD is ready to be used again. Clear status.
5422 * Get next BD.
5423 */
5424@@ -475,7 +513,36 @@
5425 schedule_delayed_work(&tty->flip.work, 1);
5426 }
5427
5428-static _INLINE_ void transmit_chars(ser_info_t *info)
5429+static _INLINE_ void receive_break(ser_info_t *info, struct pt_regs *regs)
5430+{
5431+ struct tty_struct *tty = info->tty;
5432+
5433+ info->state->icount.brk++;
5434+
5435+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5436+ if (info->line == sercons.index) {
5437+ if (!break_pressed) {
5438+ break_pressed = jiffies;
5439+ return;
5440+ } else
5441+ break_pressed = 0;
5442+ }
5443+#endif
5444+
5445+ /* Check to see if there is room in the tty buffer for
5446+ * the break. If not, we exit now, losing the break. FIXME
5447+ */
5448+ if ((tty->flip.count + 1) >= TTY_FLIPBUF_SIZE)
5449+ return;
5450+ *(tty->flip.flag_buf_ptr++) = TTY_BREAK;
5451+ *(tty->flip.char_buf_ptr++) = 0;
5452+ tty->flip.count++;
5453+
5454+ queue_task(&tty->flip.tqueue, &tq_timer);
5455+}
5456+
5457+
5458+static _INLINE_ void transmit_chars(ser_info_t *info, struct pt_regs *regs)
5459 {
5460
5461 if (info->flags & TX_WAKEUP) {
5462@@ -575,19 +642,23 @@
5463 if ((idx = info->state->smc_scc_num) < SCC_NUM_BASE) {
5464 smcp = &immr->im_smc[idx];
5465 events = smcp->smc_smce;
5466+ if (events & SMCM_BRKE)
5467+ receive_break(info, regs);
5468 if (events & SMCM_RX)
5469- receive_chars(info);
5470+ receive_chars(info, regs);
5471 if (events & SMCM_TX)
5472- transmit_chars(info);
5473+ transmit_chars(info, regs);
5474 smcp->smc_smce = events;
5475 }
5476 else {
5477 sccp = &immr->im_scc[idx - SCC_IDX_BASE];
5478 events = sccp->scc_scce;
5479+ if (events & SMCM_BRKE)
5480+ receive_break(info, regs);
5481 if (events & SCCM_RX)
5482- receive_chars(info);
5483+ receive_chars(info, regs);
5484 if (events & SCCM_TX)
5485- transmit_chars(info);
5486+ transmit_chars(info, regs);
5487 sccp->scc_scce = events;
5488 }
5489
5490@@ -2207,7 +2278,7 @@
5491 static void serial_console_write(struct console *c, const char *s,
5492 unsigned count)
5493 {
5494-#if defined(CONFIG_KGDB) && !defined(CONFIG_USE_SERIAL2_KGDB)
5495+#if defined(CONFIG_KGDB_CONSOLE) && !defined(CONFIG_USE_SERIAL2_KGDB)
5496 /* Try to let stub handle output. Returns true if it did. */
5497 if (kgdb_output_string(s, count))
5498 return;
5499@@ -2391,21 +2462,11 @@
5500 }
5501 #endif
5502
5503-static kdev_t serial_console_device(struct console *c)
5504+static struct tty_driver *serial_console_device(struct console *c, int *index)
5505 {
5506 *index = c->index;
5507 return serial_driver;
5508 }
5509-
5510-
5511-static struct console sercons = {
5512- .name = "ttyS",
5513- .write = serial_console_write,
5514- .device = serial_console_device,
5515- .setup = serial_console_setup,
5516- .flags = CON_PRINTBUFFER,
5517- .index = CONFIG_SERIAL_CONSOLE_PORT,
5518-};
5519
5520 /*
5521 * Register console.
5522diff -Nru a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
5523--- a/arch/ppc/8xx_io/cs4218_tdm.c Tue Jul 15 10:01:29 2003
5524+++ b/arch/ppc/8xx_io/cs4218_tdm.c Tue Aug 26 09:25:40 2003
5525@@ -2106,11 +2106,11 @@
5526 */
5527 cs4218_ctl_write(cs4218_control);
5528
5529- sound.minDev = MINOR(inode->i_rdev) & 0x0f;
5530+ sound.minDev = iminor(inode) & 0x0f;
5531 sound.soft = sound.dsp;
5532 sound.hard = sound.dsp;
5533 sound_init();
5534- if ((MINOR(inode->i_rdev) & 0x0f) == SND_DEV_AUDIO) {
5535+ if ((iminor(inode) & 0x0f) == SND_DEV_AUDIO) {
5536 sound_set_speed(8000);
5537 sound_set_stereo(0);
5538 sound_set_format(AFMT_MU_LAW);
5539diff -Nru a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c
5540--- a/arch/ppc/8xx_io/uart.c Wed Jun 11 12:32:54 2003
5541+++ b/arch/ppc/8xx_io/uart.c Thu Aug 21 15:10:37 2003
5542@@ -1068,7 +1068,7 @@
5543 volatile cbd_t *bdp;
5544 unsigned char *cp;
5545
5546-#ifdef CONFIG_KGDB
5547+#ifdef CONFIG_KGDB_CONSOLE
5548 /* Try to let stub handle output. Returns true if it did. */
5549 if (kgdb_output_string(buf, count))
5550 return ret;
5551@@ -2271,7 +2271,7 @@
5552 static void serial_console_write(struct console *c, const char *s,
5553 unsigned count)
5554 {
5555-#ifdef CONFIG_KGDB
5556+#ifdef CONFIG_KGDB_CONSOLE
5557 /* Try to let stub handle output. Returns true if it did. */
5558 if (kgdb_output_string(s, count))
5559 return;
5560diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig
5561--- a/arch/ppc/Kconfig Mon Aug 4 16:10:57 2003
5562+++ b/arch/ppc/Kconfig Sun Aug 31 16:14:22 2003
5563@@ -795,22 +795,6 @@
5564 bool "PCI for Permedia2"
5565 depends on !4xx && !8xx && APUS
5566
5567-# only elf supported, a.out is not -- Cort
5568-config KCORE_ELF
5569- bool
5570- depends on PROC_FS
5571- default y
5572- help
5573- If you enabled support for /proc file system then the file
5574- /proc/kcore will contain the kernel core image in ELF format. This
5575- can be used in gdb:
5576-
5577- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
5578-
5579- This is especially useful if you have compiled the kernel with the
5580- "-g" option to preserve debugging information. It is mainly used
5581- for examining kernel data structures on the live kernel.
5582-
5583 config KERNEL_ELF
5584 bool
5585 default y
5586@@ -1277,16 +1261,11 @@
5587 floppy controller, say Y here. Most commonly found in PowerMacs.
5588
5589 config MAC_SERIAL
5590- tristate "Support for PowerMac serial ports"
5591+ tristate "Support for PowerMac serial ports (OBSOLETE DRIVER)"
5592 depends on PPC_PMAC
5593 help
5594- If you have Macintosh style serial ports (8 pin mini-DIN), say Y
5595- here. If you also have regular serial ports and enable the driver
5596- for them, you can't currently use the serial console feature.
5597-
5598-config SERIAL_CONSOLE
5599- bool "Support for console on serial port"
5600- depends on PPC_PMAC && MAC_SERIAL=y
5601+ This driver is obsolete. Use CONFIG_SERIAL_PMACZILOG in
5602+ "Character devices --> Serial drivers --> PowerMac z85c30" option.
5603
5604 config ADB
5605 bool "Apple Desktop Bus (ADB) support"
5606@@ -1426,20 +1405,12 @@
5607 config KGDB
5608 bool "Include kgdb kernel debugger"
5609 depends on DEBUG_KERNEL
5610+ select DEBUG_INFO
5611 help
5612 Include in-kernel hooks for kgdb, the Linux kernel source level
5613 debugger. See <http://kgdb.sourceforge.net/> for more information.
5614 Unless you are intending to debug the kernel, say N here.
5615
5616-config DEBUG_INFO
5617- bool "Compile the kernel with debug info"
5618- depends on DEBUG_KERNEL
5619- help
5620- If you say Y here the resulting kernel image will include
5621- debugging info resulting in a larger kernel image.
5622- Say Y here only if you plan to use gdb to debug the kernel.
5623- If you don't debug the kernel, you can say N.
5624-
5625 choice
5626 prompt "Serial Port"
5627 depends on KGDB
5628@@ -1459,6 +1430,14 @@
5629
5630 endchoice
5631
5632+config KGDB_CONSOLE
5633+ bool "Enable serial console thru kgdb port"
5634+ depends on KGDB && 8xx || 8260
5635+ help
5636+ If you enable this, all serial console messages will be sent
5637+ over the gdb stub.
5638+ If unsure, say N.
5639+
5640 config XMON
5641 bool "Include xmon kernel debugger"
5642 depends on DEBUG_KERNEL
5643@@ -1474,18 +1453,16 @@
5644 Unless you are intending to debug the kernel with one of these
5645 machines, say N here.
5646
5647-config MORE_COMPILE_OPTIONS
5648- bool "Add any additional compile options"
5649- depends on DEBUG_KERNEL && (KGDB || XMON || BDI_SWITCH)
5650- help
5651- If you want to add additional CFLAGS to the kernel build, such as -g
5652- for KGDB or the BDI2000, enable this option and then enter what you
5653- would like to add in the next question.
5654-
5655-config COMPILE_OPTIONS
5656- string "Additional compile arguments"
5657- depends on MORE_COMPILE_OPTIONS
5658- default "-g -ggdb"
5659+config DEBUG_INFO
5660+ bool "Compile the kernel with debug info"
5661+ depends on DEBUG_KERNEL
5662+ default y if BDI_SWITCH || XMON
5663+ help
5664+ If you say Y here the resulting kernel image will include
5665+ debugging info resulting in a larger kernel image.
5666+ Say Y here only if you plan to use some sort of debugger to
5667+ debug the kernel.
5668+ If you don't debug the kernel, you can say N.
5669
5670 config BOOTX_TEXT
5671 bool "Support for early boot text console (BootX or OpenFirmware only)"
5672diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
5673--- a/arch/ppc/Makefile Sun Jul 27 15:52:30 2003
5674+++ b/arch/ppc/Makefile Thu Aug 21 15:10:37 2003
5675@@ -22,9 +22,6 @@
5676
5677 cflags-$(CONFIG_4xx) += -Wa,-m405
5678 cflags-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
5679-# Use sed to remove the quotes.
5680-cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
5681- $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
5682
5683 CFLAGS += $(cflags-y)
5684
5685diff -Nru a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
5686--- a/arch/ppc/boot/common/ns16550.c Sat Jun 28 11:06:53 2003
5687+++ b/arch/ppc/boot/common/ns16550.c Wed Aug 20 10:24:16 2003
5688@@ -60,7 +60,7 @@
5689 else {
5690 /* Input clock. */
5691 outb(com_port + (UART_DLL << shift),
5692- (BASE_BAUD / SERIAL_BAUD));
5693+ (BASE_BAUD / SERIAL_BAUD) & 0xFF);
5694 outb(com_port + (UART_DLM << shift),
5695 (BASE_BAUD / SERIAL_BAUD) >> 8);
5696 /* 8 data, 1 stop, no parity */
5697diff -Nru a/arch/ppc/boot/common/util.S b/arch/ppc/boot/common/util.S
5698--- a/arch/ppc/boot/common/util.S Tue Feb 25 11:37:43 2003
5699+++ b/arch/ppc/boot/common/util.S Thu Aug 21 10:17:00 2003
5700@@ -160,9 +160,22 @@
5701 blr
5702
5703
5704+/* udelay (on non-601 processors) needs to know the period of the
5705+ * timebase in nanoseconds. This used to be hardcoded to be 60ns
5706+ * (period of 66MHz/4). Now a variable is used that is initialized to
5707+ * 60 for backward compatibility, but it can be overridden as necessary
5708+ * with code something like this:
5709+ * extern unsigned long timebase_period_ns;
5710+ * timebase_period_ns = 1000000000 / bd->bi_tbfreq;
5711+ */
5712+ .data
5713+ .globl timebase_period_ns
5714+timebase_period_ns:
5715+ .long 60
5716+
5717+ .text
5718 /*
5719 * Delay for a number of microseconds
5720- * -- Use the BUS timer (assumes 66MHz)
5721 */
5722 .globl udelay
5723 udelay:
5724@@ -180,8 +193,13 @@
5725
5726 .udelay_not_601:
5727 mulli r4,r3,1000 /* nanoseconds */
5728- addi r4,r4,59
5729- li r5,60
5730+ /* Change r4 to be the number of ticks using:
5731+ * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
5732+ * timebase_period_ns defaults to 60 (16.6MHz) */
5733+ lis r5,timebase_period_ns@h
5734+ lwz r5,timebase_period_ns@l(r5)
5735+ addi r4,r4,r5
5736+ addi r4,r4,-1
5737 divw r4,r4,r5 /* BUS ticks */
5738 1: mftbu r5
5739 mftb r6
5740diff -Nru a/arch/ppc/boot/include/of1275.h b/arch/ppc/boot/include/of1275.h
5741--- a/arch/ppc/boot/include/of1275.h Mon Sep 16 21:58:06 2002
5742+++ b/arch/ppc/boot/include/of1275.h Mon Aug 25 05:13:38 2003
5743@@ -20,6 +20,7 @@
5744 /* function declarations */
5745
5746 void * claim(unsigned int virt, unsigned int size, unsigned int align);
5747+int map(unsigned int phys, unsigned int virt, unsigned int size);
5748 void enter(void);
5749 void exit(void);
5750 phandle finddevice(const char *name);
5751diff -Nru a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script
5752--- a/arch/ppc/boot/ld.script Thu May 29 04:06:53 2003
5753+++ b/arch/ppc/boot/ld.script Mon Aug 25 05:13:38 2003
5754@@ -66,7 +66,7 @@
5755 _edata = .;
5756 PROVIDE (edata = .);
5757
5758- . = ALIGN(8);
5759+ . = ALIGN(4096);
5760 __bss_start = .;
5761 .bss :
5762 {
5763diff -Nru a/arch/ppc/boot/of1275/Makefile b/arch/ppc/boot/of1275/Makefile
5764--- a/arch/ppc/boot/of1275/Makefile Sun Jun 8 01:12:49 2003
5765+++ b/arch/ppc/boot/of1275/Makefile Mon Aug 25 09:36:40 2003
5766@@ -3,4 +3,4 @@
5767 #
5768
5769 lib-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \
5770- ofstdio.o read.o release.o write.o
5771+ ofstdio.o read.o release.o write.o map.o
5772diff -Nru a/arch/ppc/boot/of1275/map.c b/arch/ppc/boot/of1275/map.c
5773--- /dev/null Wed Dec 31 16:00:00 1969
5774+++ b/arch/ppc/boot/of1275/map.c Mon Aug 25 09:36:40 2003
5775@@ -0,0 +1,50 @@
5776+
5777+/*
5778+ * Copyright (C) Paul Mackerras 1997.
5779+ * Copyright (C) Leigh Brown 2002.
5780+ *
5781+ * This program is free software; you can redistribute it and/or
5782+ * modify it under the terms of the GNU General Public License
5783+ * as published by the Free Software Foundation; either version
5784+ * 2 of the License, or (at your option) any later version.
5785+ */
5786+
5787+#include "of1275.h"
5788+#include "nonstdio.h"
5789+
5790+extern ihandle of_prom_mmu;
5791+
5792+int
5793+map(unsigned int phys, unsigned int virt, unsigned int size)
5794+{
5795+ struct prom_args {
5796+ char *service;
5797+ int nargs;
5798+ int nret;
5799+ char *method;
5800+ ihandle mmu_ihandle;
5801+ int misc;
5802+ unsigned int phys;
5803+ unsigned int virt;
5804+ unsigned int size;
5805+ int ret0;
5806+ int ret1;
5807+ } args;
5808+
5809+ if (of_prom_mmu == 0) {
5810+ printf("map() called, no MMU found\n");
5811+ return -1;
5812+ }
5813+ args.service = "call-method";
5814+ args.nargs = 6;
5815+ args.nret = 2;
5816+ args.method = "map";
5817+ args.mmu_ihandle = of_prom_mmu;
5818+ args.misc = -1;
5819+ args.phys = phys;
5820+ args.virt = virt;
5821+ args.size = size;
5822+ (*of_prom_entry)(&args);
5823+
5824+ return (int)args.ret0;
5825+}
5826diff -Nru a/arch/ppc/boot/of1275/ofinit.c b/arch/ppc/boot/of1275/ofinit.c
5827--- a/arch/ppc/boot/of1275/ofinit.c Mon Sep 16 22:18:13 2002
5828+++ b/arch/ppc/boot/of1275/ofinit.c Mon Aug 25 05:13:38 2003
5829@@ -11,9 +11,17 @@
5830 #include "of1275.h"
5831
5832 prom_entry of_prom_entry;
5833+ihandle of_prom_mmu;
5834
5835 void
5836 ofinit(prom_entry prom_ptr)
5837 {
5838+ phandle chosen;
5839+
5840 of_prom_entry = prom_ptr;
5841+
5842+ if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE)
5843+ return;
5844+ if (getprop(chosen, "mmu", &of_prom_mmu, sizeof(ihandle)) != 4)
5845+ return;
5846 }
5847diff -Nru a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
5848--- a/arch/ppc/boot/openfirmware/Makefile Wed Jul 23 08:39:58 2003
5849+++ b/arch/ppc/boot/openfirmware/Makefile Mon Aug 25 05:13:38 2003
5850@@ -22,7 +22,7 @@
5851 images := $(boot)/images
5852
5853 OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
5854-COFF_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
5855+COFF_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00500000 -Bstatic
5856 CHRP_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00800000
5857 NEWWORLD_LD_ARGS:= -T $(boot)/ld.script -e _start -Ttext 0x01000000
5858
5859diff -Nru a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c
5860--- a/arch/ppc/boot/openfirmware/coffmain.c Thu Nov 7 03:31:11 2002
5861+++ b/arch/ppc/boot/openfirmware/coffmain.c Mon Aug 25 05:13:38 2003
5862@@ -32,16 +32,16 @@
5863 char *begin_avail, *end_avail;
5864 char *avail_high;
5865
5866-#define RAM_START 0
5867-#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
5868-
5869-#define PROG_START RAM_START
5870-#define PROG_SIZE 0x00700000
5871-
5872 #define SCRATCH_SIZE (128 << 10)
5873
5874 static char heap[SCRATCH_SIZE];
5875
5876+static unsigned long ram_start = 0;
5877+static unsigned long ram_end = 0x1000000;
5878+static unsigned long prog_start = 0x800000;
5879+static unsigned long prog_size = 0x800000;
5880+
5881+
5882 typedef void (*kernel_start_t)(int, int, void *);
5883
5884 void boot(int a1, int a2, void *prom)
5885@@ -52,32 +52,34 @@
5886 unsigned initrd_start, initrd_size;
5887
5888 printf("coffboot starting: loaded at 0x%p\n", &_start);
5889- setup_bats(RAM_START);
5890+ setup_bats(ram_start);
5891
5892 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
5893 if (initrd_size) {
5894- initrd_start = (RAM_END - initrd_size) & ~0xFFF;
5895+ initrd_start = (ram_end - initrd_size) & ~0xFFF;
5896 a1 = initrd_start;
5897 a2 = initrd_size;
5898- claim(initrd_start, RAM_END - initrd_start, 0);
5899+ claim(initrd_start, ram_end - initrd_start, 0);
5900 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
5901 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
5902 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
5903+ prog_size = initrd_start - prog_start;
5904 } else
5905 a2 = 0xdeadbeef;
5906
5907 im = (char *)(&__image_begin);
5908 len = (char *)(&__image_end) - (char *)(&__image_begin);
5909- /* claim 4MB starting at 0 */
5910- claim(0, PROG_SIZE, 0);
5911- dst = (void *) RAM_START;
5912+ /* claim 4MB starting at PROG_START */
5913+ claim(prog_start, prog_size, 0);
5914+ map(prog_start, prog_start, prog_size);
5915+ dst = (void *) prog_start;
5916 if (im[0] == 0x1f && im[1] == 0x8b) {
5917 /* set up scratch space */
5918 begin_avail = avail_high = avail_ram = heap;
5919 end_avail = heap + sizeof(heap);
5920 printf("heap at 0x%p\n", avail_ram);
5921 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
5922- gunzip(dst, PROG_SIZE, im, &len);
5923+ gunzip(dst, prog_size, im, &len);
5924 printf("done %u bytes\n", len);
5925 printf("%u bytes of heap consumed, max in use %u\n",
5926 avail_high - begin_avail, heap_max);
5927@@ -87,9 +89,9 @@
5928
5929 flush_cache(dst, len);
5930 make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac,
5931- (PROG_START + PROG_SIZE));
5932+ (prog_start + prog_size));
5933
5934- sa = (unsigned long)PROG_START;
5935+ sa = (unsigned long)prog_start;
5936 printf("start address = 0x%x\n", sa);
5937
5938 (*(kernel_start_t)sa)(a1, a2, prom);
5939diff -Nru a/arch/ppc/boot/openfirmware/misc.S b/arch/ppc/boot/openfirmware/misc.S
5940--- a/arch/ppc/boot/openfirmware/misc.S Mon Sep 16 21:54:12 2002
5941+++ b/arch/ppc/boot/openfirmware/misc.S Mon Aug 25 05:13:38 2003
5942@@ -9,7 +9,7 @@
5943 .text
5944
5945 /*
5946- * Use the BAT3 registers to map the 1st 8MB of RAM to
5947+ * Use the BAT2 & 3 registers to map the 1st 16MB of RAM to
5948 * the address given as the 1st argument.
5949 */
5950 .globl setup_bats
5951@@ -22,6 +22,10 @@
5952 mtibatl 3,0 /* invalidate BAT first */
5953 ori 3,3,4 /* set up BAT registers for 601 */
5954 li 4,0x7f
5955+ mtibatu 2,3
5956+ mtibatl 2,4
5957+ oris 3,3,0x80
5958+ oris 4,4,0x80
5959 mtibatu 3,3
5960 mtibatl 3,4
5961 b 5f
5962@@ -29,6 +33,12 @@
5963 mtibatu 3,0
5964 ori 3,3,0xff /* set up BAT registers for 604 */
5965 li 4,2
5966+ mtdbatl 2,4
5967+ mtdbatu 2,3
5968+ mtibatl 2,4
5969+ mtibatu 2,3
5970+ oris 3,3,0x80
5971+ oris 4,4,0x80
5972 mtdbatl 3,4
5973 mtdbatu 3,3
5974 mtibatl 3,4
5975diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
5976--- a/arch/ppc/boot/simple/Makefile Tue Jul 1 17:01:18 2003
5977+++ b/arch/ppc/boot/simple/Makefile Mon Aug 18 09:44:01 2003
5978@@ -22,7 +22,6 @@
5979 # get_mem_size(), which is memory controller dependent. Add in the correct
5980 # XXX_memory.o file for this to work, as well as editing the $(MISC) file.
5981
5982-boot: zImage
5983
5984 boot := arch/ppc/boot
5985 common := $(boot)/common
5986@@ -32,86 +31,90 @@
5987
5988 # Normally, we use the 'misc.c' file for decompress_kernel and
5989 # whatnot. Sometimes we need to override this however.
5990-MISC := misc.o
5991-ifeq ($(CONFIG_IBM_OPENBIOS),y)
5992-ZIMAGE := zImage-TREE
5993-ZIMAGEINITRD := zImage.initrd-TREE
5994-END := treeboot
5995-TFTPIMAGE := /tftpboot/zImage.$(END)
5996-MISC := misc-embedded.o
5997-endif
5998-ifeq ($(CONFIG_EMBEDDEDBOOT),y)
5999-TFTPIMAGE := /tftpboot/zImage.embedded
6000-MISC := misc-embedded.o
6001-endif
6002-ifeq ($(CONFIG_EBONY),y)
6003-ZIMAGE := zImage-TREE
6004-ZIMAGEINITRD := zImage.initrd-TREE
6005-END := ebony
6006-ENTRYPOINT := 0x01000000
6007-TFTPIMAGE := /tftpboot/zImage.$(END)
6008-endif
6009-ifeq ($(CONFIG_EV64260),y)
6010-EXTRA := misc-ev64260.o
6011-TFTPIMAGE := /tftpboot/zImage.ev64260
6012-endif
6013-ifeq ($(CONFIG_GEMINI),y)
6014-ZIMAGE := zImage-STRIPELF
6015-ZIMAGEINITRD := zImage.initrd-STRIPELF
6016-END := gemini
6017-TFTPIMAGE := /tftpboot/zImage.$(END)
6018-endif
6019-ifeq ($(CONFIG_K2),y)
6020-EXTRA := legacy.o
6021-TFTPIMAGE := /tftpboot/zImage.k2
6022-endif
6023-# kbuild-2.4 'feature', only one of these will ever by 'y' at a time.
6024+misc-y := misc.o
6025+
6026+#
6027+# See arch/ppc/kconfig and arch/ppc/platforms/Kconfig
6028+# for definition of what platform each config option refer to.
6029+#----------------------------------------------------------------------------
6030+ zimage-$(CONFIG_IBM_OPENBIOS) := zImage-TREE
6031+zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE
6032+ end-$(CONFIG_IBM_OPENBIOS) := treeboot
6033+ tftpimage-$(CONFIG_IBM_OPENBIOS) := /tftpboot/zImage.$(end-y)
6034+ misc-$(CONFIG_IBM_OPENBIOS) := misc-embedded.o
6035+
6036+ tftpimage-$(CONFIG_EMBEDDEDBOOT) := /tftpboot/zImage.embedded
6037+ misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o
6038+
6039+ zimage-$(CONFIG_EBONY) := zImage-TREE
6040+zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE
6041+ extra.o-$(CONFIG_EBONY) := direct.o
6042+ end-$(CONFIG_EBONY) := ebony
6043+ entrypoint-$(CONFIG_EBONY) := 0x01000000
6044+ tftpimage-$(CONFIG_EBONY) := /tftpboot/zImage.$(end-y)
6045+
6046+ extra.o-$(CONFIG_EV64260) := direct.o misc-ev64260.o
6047+ tftpimage-$(CONFIG_EV64260) := /tftpboot/zImage.ev64260
6048+
6049+ zimage-$(CONFIG_GEMINI) := zImage-STRIPELF
6050+zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF
6051+ end-$(CONFIG_GEMINI) := gemini
6052+ tftpimage-$(CONFIG_GEMINI) := /tftpboot/zImage.$(end-y)
6053+
6054+ extra.o-$(CONFIG_K2) := legacy.o
6055+ tftpimage-$(CONFIG_K2) := /tftpboot/zImage.k2
6056+
6057+# kconfig 'feature', only one of these will ever by 'y' at a time.
6058 # The rest will be unset.
6059-ifeq ($(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750)$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS),y)
6060-ZIMAGE := zImage-PPLUS
6061-ZIMAGEINITRD := zImage.initrd-PPLUS
6062-TFTPIMAGE := /tftpboot/zImage.pplus
6063-ZNETBOOT := zImage.pplus
6064-ZNETBOOTRD := zImage.initrd.pplus
6065-endif
6066-ifeq ($(CONFIG_PPLUS),y)
6067-EXTRA := legacy.o
6068-endif
6069-ifeq ($(CONFIG_PCORE)$(CONFIG_POWERPMC250),y)
6070-ZIMAGE := zImage-STRIPELF
6071-ZIMAGEINITRD := zImage.initrd-STRIPELF
6072-EXTRA := chrpmap.o
6073-END := pcore
6074-TFTPIMAGE := /tftpboot/zImage.$(END)
6075-endif
6076-ifeq ($(CONFIG_SANDPOINT),y)
6077-TFTPIMAGE := /tftpboot/zImage.sandpoint
6078-endif
6079-ifeq ($(CONFIG_SPRUCE),y)
6080-ZIMAGE := zImage-TREE
6081-ZIMAGEINITRD := zImage.initrd-TREE
6082-END := spruce
6083-ENTRYPOINT := 0x00800000
6084-MISC := misc-spruce.o
6085-TFTPIMAGE := /tftpboot/zImage.$(END)
6086-endif
6087-ifeq ($(CONFIG_SMP),y)
6088-TFTPIMAGE += .smp
6089-endif
6090-ifeq ($(CONFIG_REDWOOD_4),y)
6091+multi := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \
6092+$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS)
6093+ zimage-$(multi) := zImage-PPLUS
6094+zimageinitrd-$(multi) := zImage.initrd-PPLUS
6095+ tftpimage-$(multi) := /tftpboot/zImage.pplus
6096+ znetboot-$(multi) := zImage.pplus
6097+ znetbootrd-$(multi) := zImage.initrd.pplus
6098+
6099+# Overrides previous assingment
6100+ extra.o-$(CONFIG_PPLUS) := legacy.o
6101+
6102+ zimage-$(CONFIG_PCORE) := zImage-STRIPELF
6103+zimageinitrd-$(CONFIG_PCORE) := zImage.initrd-STRIPELF
6104+ extra.o-$(CONFIG_PCORE) := chrpmap.o
6105+ end-$(CONFIG_PCORE) := pcore
6106+ tftpimage-$(CONFIG_PCORE) := /tftpboot/zImage.$(end-y)
6107+
6108+ zimage-$(CONFIG_POWERPMC250) := zImage-STRIPELF
6109+zimageinitrd-$(CONFIG_POWERPMC250) := zImage.initrd-STRIPELF
6110+ extra.o-$(CONFIG_POWERPMC250) := chrpmap.o
6111+ end-$(CONFIG_POWERPMC250) := pcore
6112+ tftpimage-$(CONFIG_POWERPMC250) := /tftpboot/zImage.$(end-y)
6113+
6114+ tftpimage-$(CONFIG_SANDPOINT) := /tftpboot/zImage.sandpoint
6115+
6116+ zimage-$(CONFIG_SPRUCE) := zImage-TREE
6117+zimageinitrd-$(CONFIG_SPRUCE) := zImage.initrd-TREE
6118+ end-$(CONFIG_SPRUCE) := spruce
6119+ entrypoint-$(CONFIG_SPRUCE) := 0x00800000
6120+ misc-$(CONFIG_SPRUCE) := misc-spruce.o
6121+ tftpimage-$(CONFIG_SPRUCE) := /tftpboot/zImage.$(end-y)
6122+
6123+
6124+# tftp image is prefixed with .smp if compiled for SMP
6125+tftpimage-$(CONFIG_SMP) += .smp
6126+
6127 # This is a treeboot that needs init functions until the
6128 # boot rom is sorted out (i.e. this is short lived)
6129-EXTRA_AFLAGS := -Wa,-m405
6130-EXTRA := rw4/rw4_init.o rw4/rw4_init_brd.o
6131-endif
6132+extra-aflags-$(CONFIG_REDWOOD_4) := -Wa,-m405
6133+extra.o-$(CONFIG_REDWOOD_4) := rw4/rw4_init.o rw4/rw4_init_brd.o
6134+EXTRA_AFLAGS := $(extra-aflags-y)
6135
6136 # Linker args. This specifies where the image will be run at.
6137-LD_ARGS = -T $(boot)/ld.script \
6138- -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
6139+LD_ARGS := -T $(boot)/ld.script \
6140+ -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
6141 OBJCOPY_ARGS := -O elf32-powerpc
6142
6143 # head.o and relocate.o must be at the start.
6144-boot-y := head.o relocate.o $(EXTRA) $(MISC)
6145+boot-y := head.o relocate.o $(extra.o-y) $(misc-y)
6146 boot-$(CONFIG_40x) += embed_config.o
6147 boot-$(CONFIG_8xx) += embed_config.o
6148 boot-$(CONFIG_8260) += embed_config.o
6149@@ -160,40 +163,40 @@
6150 -R .stabstr -R .sysmap
6151
6152 # Sort-of dummy rules, that let us format the image we want.
6153-zImage: $(images)/$(ZIMAGE) $(obj)/zvmlinux
6154+zImage: $(images)/$(zimage-y) $(obj)/zvmlinux
6155 cp -f $(obj)/zvmlinux $(images)/zImage.elf
6156 rm -f $(obj)/zvmlinux
6157
6158-zImage.initrd: $(images)/$(ZIMAGEINITRD) $(obj)/zvmlinux.initrd
6159+zImage.initrd: $(images)/$(zimageinitrd-y) $(obj)/zvmlinux.initrd
6160 cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf
6161 rm -f $(obj)/zvmlinux.initrd
6162
6163 znetboot: zImage
6164 ifneq ($(ZNETBOOT),)
6165- cp $(images)/$(ZNETBOOT) $(TFTPIMAGE)
6166+ cp $(images)/$(ZNETBOOT) $(tftpimage-y)
6167 else
6168- cp $(images)/zImage.* $(TFTPIMAGE)
6169+ cp $(images)/zImage.* $(tftpimage-y)
6170 endif
6171
6172 znetboot.initrd: zImage.initrd
6173-ifneq ($(ZNETBOOTRD),)
6174- cp $(images)/$(ZNETBOOTRD) $(TFTPIMAGE)
6175+ifneq ($(znetbootrd-y),)
6176+ cp $(images)/$(znetbootrd-y) $(tftpimage-y)
6177 else
6178- cp $(images)/zImage.* $(TFTPIMAGE)
6179+ cp $(images)/zImage.* $(tftpimage-y)
6180 endif
6181
6182 $(images)/zImage-STRIPELF: $(obj)/zvmlinux
6183- dd if=$(obj)/zvmlinux of=$(images)/zImage.$(END) skip=64 bs=1k
6184+ dd if=$(obj)/zvmlinux of=$(images)/zImage.$(end-y) skip=64 bs=1k
6185
6186 $(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
6187- dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(END) \
6188+ dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(end-y) \
6189 skip=64 bs=1k
6190
6191 $(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE)
6192- $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(END) $(ENTRYPOINT)
6193+ $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT)
6194
6195 $(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE)
6196- $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(END) \
6197+ $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \
6198 $(ENTRYPOINT)
6199
6200 $(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
6201diff -Nru a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c
6202--- a/arch/ppc/boot/simple/embed_config.c Sat Mar 22 17:18:48 2003
6203+++ b/arch/ppc/boot/simple/embed_config.c Thu Aug 21 10:17:00 2003
6204@@ -20,6 +20,7 @@
6205 #ifdef CONFIG_40x
6206 #include <asm/io.h>
6207 #endif
6208+extern unsigned long timebase_period_ns;
6209
6210 /* For those boards that don't provide one.
6211 */
6212@@ -768,6 +769,7 @@
6213 #if defined(CONFIG_REDWOOD_5) || defined (CONFIG_REDWOOD_6)
6214 bd->bi_tbfreq = 27 * 1000 * 1000;
6215 #endif
6216+ timebase_period_ns = 1000000000 / bd->bi_tbfreq;
6217 }
6218 #endif /* CONFIG_BEECH */
6219 #endif /* CONFIG_IBM_OPENBIOS */
6220diff -Nru a/arch/ppc/boot/simple/misc-embedded.c b/arch/ppc/boot/simple/misc-embedded.c
6221--- a/arch/ppc/boot/simple/misc-embedded.c Thu Jun 5 18:06:12 2003
6222+++ b/arch/ppc/boot/simple/misc-embedded.c Wed Aug 20 15:44:31 2003
6223@@ -75,7 +75,7 @@
6224 extern void embed_config(bd_t **bp);
6225
6226 unsigned long
6227-decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp)
6228+load_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp)
6229 {
6230 char *cp, ch;
6231 int timer = 0, zimage_size;
6232diff -Nru a/arch/ppc/boot/simple/misc-spruce.c b/arch/ppc/boot/simple/misc-spruce.c
6233--- a/arch/ppc/boot/simple/misc-spruce.c Tue Feb 11 15:48:52 2003
6234+++ b/arch/ppc/boot/simple/misc-spruce.c Wed Aug 20 15:44:31 2003
6235@@ -147,7 +147,7 @@
6236 #define MEM_B2EA 0x60
6237
6238 unsigned long
6239-decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6240+load_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6241 {
6242 int timer = 0;
6243 char *cp, ch;
6244diff -Nru a/arch/ppc/boot/simple/misc.c b/arch/ppc/boot/simple/misc.c
6245--- a/arch/ppc/boot/simple/misc.c Tue Feb 11 15:48:52 2003
6246+++ b/arch/ppc/boot/simple/misc.c Wed Aug 20 15:44:31 2003
6247@@ -252,3 +252,10 @@
6248
6249 return (struct bi_record *)rec_loc;
6250 }
6251+
6252+/* Allow decompress_kernel to be hooked into. This is the default. */
6253+void * __attribute__ ((weak))
6254+load_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6255+{
6256+ return decompress_kernel(load_addr, num_words, cksum);
6257+}
6258diff -Nru a/arch/ppc/boot/simple/relocate.S b/arch/ppc/boot/simple/relocate.S
6259--- a/arch/ppc/boot/simple/relocate.S Tue Feb 11 15:48:52 2003
6260+++ b/arch/ppc/boot/simple/relocate.S Wed Aug 20 15:44:31 2003
6261@@ -183,7 +183,7 @@
6262 mr r4,r7 /* Program length */
6263 mr r5,r6 /* Checksum */
6264 mr r6,r11 /* Residual data */
6265- bl decompress_kernel
6266+ bl load_kernel
6267
6268 /*
6269 * Make sure the kernel knows we don't have things set in
6270diff -Nru a/arch/ppc/boot/utils/mktree.c b/arch/ppc/boot/utils/mktree.c
6271--- a/arch/ppc/boot/utils/mktree.c Sun Sep 15 21:51:58 2002
6272+++ b/arch/ppc/boot/utils/mktree.c Thu Aug 21 15:00:42 2003
6273@@ -86,7 +86,7 @@
6274 }
6275
6276 cksum = 0;
6277- cp = (uint *)&bt;
6278+ cp = (void *)&bt;
6279 for (i=0; i<sizeof(bt)/sizeof(uint); i++)
6280 cksum += *cp++;
6281
6282diff -Nru a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
6283--- a/arch/ppc/configs/common_defconfig Sat Aug 2 13:06:57 2003
6284+++ b/arch/ppc/configs/common_defconfig Sat Aug 23 02:33:38 2003
6285@@ -9,6 +9,7 @@
6286 # Code maturity level options
6287 #
6288 CONFIG_EXPERIMENTAL=y
6289+# CONFIG_BROKEN is not set
6290
6291 #
6292 # General setup
6293@@ -18,9 +19,15 @@
6294 # CONFIG_BSD_PROCESS_ACCT is not set
6295 CONFIG_SYSCTL=y
6296 CONFIG_LOG_BUF_SHIFT=14
6297+CONFIG_IKCONFIG=y
6298+CONFIG_IKCONFIG_PROC=y
6299 # CONFIG_EMBEDDED is not set
6300+CONFIG_KALLSYMS=y
6301 CONFIG_FUTEX=y
6302 CONFIG_EPOLL=y
6303+CONFIG_IOSCHED_NOOP=y
6304+CONFIG_IOSCHED_AS=y
6305+CONFIG_IOSCHED_DEADLINE=y
6306
6307 #
6308 # Loadable module support
6309@@ -86,8 +93,8 @@
6310 CONFIG_PCI=y
6311 CONFIG_PCI_DOMAINS=y
6312 CONFIG_KCORE_ELF=y
6313-CONFIG_BINFMT_ELF=y
6314 CONFIG_KERNEL_ELF=y
6315+CONFIG_BINFMT_ELF=y
6316 CONFIG_BINFMT_MISC=m
6317 CONFIG_PCI_LEGACY_PROC=y
6318 CONFIG_PCI_NAMES=y
6319@@ -126,6 +133,11 @@
6320 CONFIG_BOOT_LOAD=0x00800000
6321
6322 #
6323+# Generic Driver Options
6324+#
6325+# CONFIG_FW_LOADER is not set
6326+
6327+#
6328 # Memory Technology Devices (MTD)
6329 #
6330 # CONFIG_MTD is not set
6331@@ -144,10 +156,12 @@
6332 # CONFIG_BLK_DEV_DAC960 is not set
6333 # CONFIG_BLK_DEV_UMEM is not set
6334 CONFIG_BLK_DEV_LOOP=y
6335+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6336 # CONFIG_BLK_DEV_NBD is not set
6337 CONFIG_BLK_DEV_RAM=y
6338 CONFIG_BLK_DEV_RAM_SIZE=4096
6339 CONFIG_BLK_DEV_INITRD=y
6340+CONFIG_LBD=y
6341
6342 #
6343 # Multi-device support (RAID and LVM)
6344@@ -155,40 +169,38 @@
6345 # CONFIG_MD is not set
6346
6347 #
6348-# ATA/IDE/MFM/RLL support
6349+# ATA/ATAPI/MFM/RLL support
6350 #
6351 CONFIG_IDE=y
6352-
6353-#
6354-# IDE, ATA and ATAPI Block devices
6355-#
6356 CONFIG_BLK_DEV_IDE=y
6357
6358 #
6359 # Please see Documentation/ide.txt for help/info on IDE drives
6360 #
6361-# CONFIG_BLK_DEV_HD is not set
6362 CONFIG_BLK_DEV_IDEDISK=y
6363 # CONFIG_IDEDISK_MULTI_MODE is not set
6364 # CONFIG_IDEDISK_STROKE is not set
6365 CONFIG_BLK_DEV_IDECD=y
6366+# CONFIG_BLK_DEV_IDETAPE is not set
6367 CONFIG_BLK_DEV_IDEFLOPPY=y
6368 CONFIG_BLK_DEV_IDESCSI=y
6369 # CONFIG_IDE_TASK_IOCTL is not set
6370+# CONFIG_IDE_TASKFILE_IO is not set
6371
6372 #
6373 # IDE chipset support/bugfixes
6374 #
6375 CONFIG_BLK_DEV_IDEPCI=y
6376-CONFIG_BLK_DEV_GENERIC=y
6377 CONFIG_IDEPCI_SHARE_IRQ=y
6378+# CONFIG_BLK_DEV_OFFBOARD is not set
6379+CONFIG_BLK_DEV_GENERIC=y
6380+# CONFIG_BLK_DEV_OPTI621 is not set
6381+CONFIG_BLK_DEV_SL82C105=y
6382 CONFIG_BLK_DEV_IDEDMA_PCI=y
6383 # CONFIG_BLK_DEV_IDE_TCQ is not set
6384-# CONFIG_BLK_DEV_OFFBOARD is not set
6385 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
6386 CONFIG_IDEDMA_PCI_AUTO=y
6387 # CONFIG_IDEDMA_ONLYDISK is not set
6388-CONFIG_BLK_DEV_IDEDMA=y
6389 # CONFIG_IDEDMA_PCI_WIP is not set
6390 CONFIG_BLK_DEV_ADMA=y
6391 # CONFIG_BLK_DEV_AEC62XX is not set
6392@@ -198,12 +210,12 @@
6393 # CONFIG_BLK_DEV_TRIFLEX is not set
6394 # CONFIG_BLK_DEV_CY82C693 is not set
6395 # CONFIG_BLK_DEV_CS5520 is not set
6396+# CONFIG_BLK_DEV_CS5530 is not set
6397 # CONFIG_BLK_DEV_HPT34X is not set
6398 # CONFIG_BLK_DEV_HPT366 is not set
6399 # CONFIG_BLK_DEV_SC1200 is not set
6400 # CONFIG_BLK_DEV_PIIX is not set
6401 # CONFIG_BLK_DEV_NS87415 is not set
6402-# CONFIG_BLK_DEV_OPTI621 is not set
6403 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
6404 CONFIG_BLK_DEV_PDC202XX_NEW=y
6405 # CONFIG_PDC202XX_FORCE is not set
6406@@ -212,15 +224,17 @@
6407 # CONFIG_BLK_DEV_SLC90E66 is not set
6408 # CONFIG_BLK_DEV_TRM290 is not set
6409 # CONFIG_BLK_DEV_VIA82CXXX is not set
6410-CONFIG_BLK_DEV_SL82C105=y
6411 CONFIG_BLK_DEV_IDE_PMAC=y
6412 CONFIG_BLK_DEV_IDEDMA_PMAC=y
6413 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
6414-CONFIG_IDEDMA_AUTO=y
6415+CONFIG_BLK_DEV_IDEDMA=y
6416 # CONFIG_IDEDMA_IVB is not set
6417+CONFIG_IDEDMA_AUTO=y
6418+# CONFIG_DMA_NONPCI is not set
6419+# CONFIG_BLK_DEV_HD is not set
6420
6421 #
6422-# SCSI support
6423+# SCSI device support
6424 #
6425 CONFIG_SCSI=y
6426
6427@@ -260,8 +274,6 @@
6428 # CONFIG_SCSI_AIC79XX is not set
6429 # CONFIG_SCSI_DPT_I2O is not set
6430 CONFIG_SCSI_ADVANSYS=m
6431-# CONFIG_SCSI_IN2000 is not set
6432-# CONFIG_SCSI_AM53C974 is not set
6433 # CONFIG_SCSI_MEGARAID is not set
6434 # CONFIG_SCSI_BUSLOGIC is not set
6435 # CONFIG_SCSI_CPQFCTS is not set
6436@@ -270,11 +282,8 @@
6437 # CONFIG_SCSI_EATA_PIO is not set
6438 # CONFIG_SCSI_FUTURE_DOMAIN is not set
6439 # CONFIG_SCSI_GDTH is not set
6440-# CONFIG_SCSI_GENERIC_NCR5380 is not set
6441-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
6442 # CONFIG_SCSI_INITIO is not set
6443 # CONFIG_SCSI_INIA100 is not set
6444-# CONFIG_SCSI_NCR53C7xx is not set
6445 CONFIG_SCSI_SYM53C8XX_2=y
6446 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
6447 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
6448@@ -287,7 +296,6 @@
6449 # CONFIG_SCSI_QLOGIC_1280 is not set
6450 # CONFIG_SCSI_DC395x is not set
6451 # CONFIG_SCSI_DC390T is not set
6452-# CONFIG_SCSI_U14_34F is not set
6453 # CONFIG_SCSI_NSP32 is not set
6454 # CONFIG_SCSI_DEBUG is not set
6455 CONFIG_SCSI_MESH=y
6456@@ -321,8 +329,6 @@
6457 CONFIG_PACKET=y
6458 # CONFIG_PACKET_MMAP is not set
6459 # CONFIG_NETLINK_DEV is not set
6460-CONFIG_NETFILTER=y
6461-# CONFIG_NETFILTER_DEBUG is not set
6462 CONFIG_UNIX=y
6463 # CONFIG_NET_KEY is not set
6464 CONFIG_INET=y
6465@@ -340,6 +346,16 @@
6466 # CONFIG_INET_IPCOMP is not set
6467
6468 #
6469+# IP: Virtual Server Configuration
6470+#
6471+# CONFIG_IP_VS is not set
6472+# CONFIG_IPV6 is not set
6473+# CONFIG_DECNET is not set
6474+# CONFIG_BRIDGE is not set
6475+CONFIG_NETFILTER=y
6476+# CONFIG_NETFILTER_DEBUG is not set
6477+
6478+#
6479 # IP: Netfilter Configuration
6480 #
6481 CONFIG_IP_NF_CONNTRACK=m
6482@@ -355,6 +371,7 @@
6483 CONFIG_IP_NF_MATCH_MARK=m
6484 CONFIG_IP_NF_MATCH_MULTIPORT=m
6485 CONFIG_IP_NF_MATCH_TOS=m
6486+CONFIG_IP_NF_MATCH_RECENT=m
6487 CONFIG_IP_NF_MATCH_ECN=m
6488 CONFIG_IP_NF_MATCH_DSCP=m
6489 CONFIG_IP_NF_MATCH_AH_ESP=m
6490@@ -386,8 +403,6 @@
6491 # CONFIG_IP_NF_ARPTABLES is not set
6492 CONFIG_IP_NF_COMPAT_IPCHAINS=m
6493 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
6494-# CONFIG_IPV6 is not set
6495-# CONFIG_XFRM_USER is not set
6496
6497 #
6498 # SCTP Configuration (EXPERIMENTAL)
6499@@ -397,8 +412,6 @@
6500 # CONFIG_ATM is not set
6501 # CONFIG_VLAN_8021Q is not set
6502 # CONFIG_LLC is not set
6503-# CONFIG_DECNET is not set
6504-# CONFIG_BRIDGE is not set
6505 # CONFIG_X25 is not set
6506 # CONFIG_LAPB is not set
6507 # CONFIG_NET_DIVERT is not set
6508@@ -482,6 +495,7 @@
6509 # CONFIG_HAMACHI is not set
6510 # CONFIG_YELLOWFIN is not set
6511 # CONFIG_R8169 is not set
6512+# CONFIG_SIS190 is not set
6513 # CONFIG_SK98LIN is not set
6514 # CONFIG_TIGON3 is not set
6515
6516@@ -553,7 +567,7 @@
6517 # Graphics support
6518 #
6519 CONFIG_FB=y
6520-CONFIG_FB_CIRRUS=y
6521+# CONFIG_FB_CIRRUS is not set
6522 # CONFIG_FB_PM2 is not set
6523 # CONFIG_FB_CYBER2000 is not set
6524 CONFIG_FB_OF=y
6525@@ -606,11 +620,6 @@
6526 CONFIG_LOGO_LINUX_CLUT224=y
6527
6528 #
6529-# Old CD-ROM drivers (not SCSI, not IDE)
6530-#
6531-# CONFIG_CD_NO_IDESCSI is not set
6532-
6533-#
6534 # Input device support
6535 #
6536 CONFIG_INPUT=y
6537@@ -636,6 +645,7 @@
6538 CONFIG_SERIO_I8042=y
6539 # CONFIG_SERIO_SERPORT is not set
6540 # CONFIG_SERIO_CT82C710 is not set
6541+# CONFIG_SERIO_PCIPS2 is not set
6542
6543 #
6544 # Input Device Drivers
6545@@ -703,10 +713,12 @@
6546 #
6547 # I2C Hardware Sensors Mainboard support
6548 #
6549+# CONFIG_I2C_ALI1535 is not set
6550 # CONFIG_I2C_ALI15X3 is not set
6551 # CONFIG_I2C_AMD756 is not set
6552 # CONFIG_I2C_AMD8111 is not set
6553 # CONFIG_I2C_I801 is not set
6554+# CONFIG_I2C_NFORCE2 is not set
6555 # CONFIG_I2C_PIIX4 is not set
6556 # CONFIG_I2C_SIS96X is not set
6557 # CONFIG_I2C_VIAPRO is not set
6558@@ -718,6 +730,7 @@
6559 # CONFIG_SENSORS_IT87 is not set
6560 # CONFIG_SENSORS_LM75 is not set
6561 # CONFIG_SENSORS_LM85 is not set
6562+# CONFIG_SENSORS_LM78 is not set
6563 # CONFIG_SENSORS_VIA686A is not set
6564 # CONFIG_SENSORS_W83781D is not set
6565 # CONFIG_I2C_SENSOR is not set
6566@@ -913,13 +926,70 @@
6567 # Sound
6568 #
6569 CONFIG_SOUND=m
6570-CONFIG_DMASOUND_AWACS=m
6571-CONFIG_DMASOUND=m
6572+# CONFIG_DMASOUND_AWACS is not set
6573
6574 #
6575 # Advanced Linux Sound Architecture
6576 #
6577-# CONFIG_SND is not set
6578+CONFIG_SND=m
6579+CONFIG_SND_SEQUENCER=m
6580+# CONFIG_SND_SEQ_DUMMY is not set
6581+CONFIG_SND_OSSEMUL=y
6582+CONFIG_SND_MIXER_OSS=m
6583+CONFIG_SND_PCM_OSS=m
6584+CONFIG_SND_SEQUENCER_OSS=y
6585+# CONFIG_SND_VERBOSE_PRINTK is not set
6586+# CONFIG_SND_DEBUG is not set
6587+
6588+#
6589+# Generic devices
6590+#
6591+# CONFIG_SND_DUMMY is not set
6592+# CONFIG_SND_VIRMIDI is not set
6593+# CONFIG_SND_MTPAV is not set
6594+# CONFIG_SND_SERIAL_U16550 is not set
6595+# CONFIG_SND_MPU401 is not set
6596+
6597+#
6598+# PCI devices
6599+#
6600+# CONFIG_SND_ALI5451 is not set
6601+# CONFIG_SND_AZT3328 is not set
6602+# CONFIG_SND_CS46XX is not set
6603+# CONFIG_SND_CS4281 is not set
6604+# CONFIG_SND_EMU10K1 is not set
6605+# CONFIG_SND_KORG1212 is not set
6606+# CONFIG_SND_NM256 is not set
6607+# CONFIG_SND_RME32 is not set
6608+# CONFIG_SND_RME96 is not set
6609+# CONFIG_SND_RME9652 is not set
6610+# CONFIG_SND_HDSP is not set
6611+# CONFIG_SND_TRIDENT is not set
6612+# CONFIG_SND_YMFPCI is not set
6613+# CONFIG_SND_ALS4000 is not set
6614+# CONFIG_SND_CMIPCI is not set
6615+# CONFIG_SND_ENS1370 is not set
6616+# CONFIG_SND_ENS1371 is not set
6617+# CONFIG_SND_ES1938 is not set
6618+# CONFIG_SND_ES1968 is not set
6619+# CONFIG_SND_MAESTRO3 is not set
6620+# CONFIG_SND_FM801 is not set
6621+# CONFIG_SND_ICE1712 is not set
6622+# CONFIG_SND_ICE1724 is not set
6623+# CONFIG_SND_INTEL8X0 is not set
6624+# CONFIG_SND_SONICVIBES is not set
6625+# CONFIG_SND_VIA82XX is not set
6626+# CONFIG_SND_VX222 is not set
6627+
6628+#
6629+# ALSA PowerMac devices
6630+#
6631+CONFIG_SND_POWERMAC=m
6632+
6633+#
6634+# ALSA USB devices
6635+#
6636+CONFIG_SND_USB_AUDIO=m
6637
6638 #
6639 # Open Sound System
6640@@ -998,6 +1068,7 @@
6641 #
6642 # USB Network adaptors
6643 #
6644+# CONFIG_USB_AX8817X is not set
6645 # CONFIG_USB_CATC is not set
6646 # CONFIG_USB_KAWETH is not set
6647 # CONFIG_USB_PEGASUS is not set
6648@@ -1074,7 +1145,6 @@
6649 # Kernel hacking
6650 #
6651 # CONFIG_DEBUG_KERNEL is not set
6652-CONFIG_KALLSYMS=y
6653 CONFIG_BOOTX_TEXT=y
6654
6655 #
6656diff -Nru a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig
6657--- a/arch/ppc/configs/ibmchrp_defconfig Tue Jul 1 17:01:18 2003
6658+++ b/arch/ppc/configs/ibmchrp_defconfig Sat Aug 23 02:33:38 2003
6659@@ -9,6 +9,7 @@
6660 # Code maturity level options
6661 #
6662 CONFIG_EXPERIMENTAL=y
6663+# CONFIG_BROKEN is not set
6664
6665 #
6666 # General setup
6667@@ -18,9 +19,15 @@
6668 # CONFIG_BSD_PROCESS_ACCT is not set
6669 CONFIG_SYSCTL=y
6670 CONFIG_LOG_BUF_SHIFT=14
6671+CONFIG_IKCONFIG=y
6672+CONFIG_IKCONFIG_PROC=y
6673 # CONFIG_EMBEDDED is not set
6674+CONFIG_KALLSYMS=y
6675 CONFIG_FUTEX=y
6676 CONFIG_EPOLL=y
6677+CONFIG_IOSCHED_NOOP=y
6678+CONFIG_IOSCHED_AS=y
6679+CONFIG_IOSCHED_DEADLINE=y
6680
6681 #
6682 # Loadable module support
6683@@ -83,8 +90,8 @@
6684 CONFIG_PCI=y
6685 CONFIG_PCI_DOMAINS=y
6686 CONFIG_KCORE_ELF=y
6687-CONFIG_BINFMT_ELF=y
6688 CONFIG_KERNEL_ELF=y
6689+CONFIG_BINFMT_ELF=y
6690 CONFIG_BINFMT_MISC=y
6691 CONFIG_PCI_LEGACY_PROC=y
6692 CONFIG_PCI_NAMES=y
6693@@ -116,6 +123,10 @@
6694 CONFIG_BOOT_LOAD=0x00800000
6695
6696 #
6697+# Generic Driver Options
6698+#
6699+
6700+#
6701 # Memory Technology Devices (MTD)
6702 #
6703 # CONFIG_MTD is not set
6704@@ -134,10 +145,12 @@
6705 # CONFIG_BLK_DEV_DAC960 is not set
6706 # CONFIG_BLK_DEV_UMEM is not set
6707 CONFIG_BLK_DEV_LOOP=y
6708+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6709 # CONFIG_BLK_DEV_NBD is not set
6710 CONFIG_BLK_DEV_RAM=y
6711 CONFIG_BLK_DEV_RAM_SIZE=4096
6712 CONFIG_BLK_DEV_INITRD=y
6713+CONFIG_LBD=y
6714
6715 #
6716 # Multi-device support (RAID and LVM)
6717@@ -145,12 +158,12 @@
6718 # CONFIG_MD is not set
6719
6720 #
6721-# ATA/IDE/MFM/RLL support
6722+# ATA/ATAPI/MFM/RLL support
6723 #
6724 # CONFIG_IDE is not set
6725
6726 #
6727-# SCSI support
6728+# SCSI device support
6729 #
6730 CONFIG_SCSI=y
6731
6732@@ -183,8 +196,6 @@
6733 # CONFIG_SCSI_AIC79XX is not set
6734 # CONFIG_SCSI_DPT_I2O is not set
6735 # CONFIG_SCSI_ADVANSYS is not set
6736-# CONFIG_SCSI_IN2000 is not set
6737-# CONFIG_SCSI_AM53C974 is not set
6738 # CONFIG_SCSI_MEGARAID is not set
6739 # CONFIG_SCSI_BUSLOGIC is not set
6740 # CONFIG_SCSI_CPQFCTS is not set
6741@@ -193,11 +204,8 @@
6742 # CONFIG_SCSI_EATA_PIO is not set
6743 # CONFIG_SCSI_FUTURE_DOMAIN is not set
6744 # CONFIG_SCSI_GDTH is not set
6745-# CONFIG_SCSI_GENERIC_NCR5380 is not set
6746-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
6747 # CONFIG_SCSI_INITIO is not set
6748 # CONFIG_SCSI_INIA100 is not set
6749-# CONFIG_SCSI_NCR53C7xx is not set
6750 CONFIG_SCSI_SYM53C8XX_2=y
6751 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
6752 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
6753@@ -210,7 +218,6 @@
6754 # CONFIG_SCSI_QLOGIC_1280 is not set
6755 # CONFIG_SCSI_DC395x is not set
6756 # CONFIG_SCSI_DC390T is not set
6757-# CONFIG_SCSI_U14_34F is not set
6758 # CONFIG_SCSI_NSP32 is not set
6759 # CONFIG_SCSI_DEBUG is not set
6760 # CONFIG_SCSI_MESH is not set
6761@@ -242,8 +249,6 @@
6762 CONFIG_PACKET=y
6763 # CONFIG_PACKET_MMAP is not set
6764 # CONFIG_NETLINK_DEV is not set
6765-CONFIG_NETFILTER=y
6766-# CONFIG_NETFILTER_DEBUG is not set
6767 CONFIG_UNIX=y
6768 # CONFIG_NET_KEY is not set
6769 CONFIG_INET=y
6770@@ -261,6 +266,16 @@
6771 # CONFIG_INET_IPCOMP is not set
6772
6773 #
6774+# IP: Virtual Server Configuration
6775+#
6776+# CONFIG_IP_VS is not set
6777+# CONFIG_IPV6 is not set
6778+# CONFIG_DECNET is not set
6779+# CONFIG_BRIDGE is not set
6780+CONFIG_NETFILTER=y
6781+# CONFIG_NETFILTER_DEBUG is not set
6782+
6783+#
6784 # IP: Netfilter Configuration
6785 #
6786 CONFIG_IP_NF_CONNTRACK=m
6787@@ -276,6 +291,7 @@
6788 CONFIG_IP_NF_MATCH_MARK=m
6789 CONFIG_IP_NF_MATCH_MULTIPORT=m
6790 CONFIG_IP_NF_MATCH_TOS=m
6791+CONFIG_IP_NF_MATCH_RECENT=m
6792 CONFIG_IP_NF_MATCH_ECN=m
6793 CONFIG_IP_NF_MATCH_DSCP=m
6794 CONFIG_IP_NF_MATCH_AH_ESP=m
6795@@ -306,10 +322,9 @@
6796 CONFIG_IP_NF_TARGET_TCPMSS=m
6797 CONFIG_IP_NF_ARPTABLES=m
6798 CONFIG_IP_NF_ARPFILTER=m
6799+CONFIG_IP_NF_ARP_MANGLE=m
6800 CONFIG_IP_NF_COMPAT_IPCHAINS=m
6801 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
6802-# CONFIG_IPV6 is not set
6803-# CONFIG_XFRM_USER is not set
6804
6805 #
6806 # SCTP Configuration (EXPERIMENTAL)
6807@@ -319,8 +334,6 @@
6808 # CONFIG_ATM is not set
6809 # CONFIG_VLAN_8021Q is not set
6810 # CONFIG_LLC is not set
6811-# CONFIG_DECNET is not set
6812-# CONFIG_BRIDGE is not set
6813 # CONFIG_X25 is not set
6814 # CONFIG_LAPB is not set
6815 # CONFIG_NET_DIVERT is not set
6816@@ -396,6 +409,7 @@
6817 # CONFIG_HAMACHI is not set
6818 # CONFIG_YELLOWFIN is not set
6819 # CONFIG_R8169 is not set
6820+# CONFIG_SIS190 is not set
6821 # CONFIG_SK98LIN is not set
6822 # CONFIG_TIGON3 is not set
6823
6824@@ -495,11 +509,6 @@
6825 CONFIG_LOGO_LINUX_CLUT224=y
6826
6827 #
6828-# Old CD-ROM drivers (not SCSI, not IDE)
6829-#
6830-# CONFIG_CD_NO_IDESCSI is not set
6831-
6832-#
6833 # Input device support
6834 #
6835 CONFIG_INPUT=y
6836@@ -525,6 +534,7 @@
6837 CONFIG_SERIO_I8042=y
6838 CONFIG_SERIO_SERPORT=y
6839 # CONFIG_SERIO_CT82C710 is not set
6840+# CONFIG_SERIO_PCIPS2 is not set
6841
6842 #
6843 # Input Device Drivers
6844@@ -791,7 +801,6 @@
6845 # Kernel hacking
6846 #
6847 # CONFIG_DEBUG_KERNEL is not set
6848-CONFIG_KALLSYMS=y
6849 # CONFIG_BOOTX_TEXT is not set
6850
6851 #
6852diff -Nru a/arch/ppc/configs/mcpn765_defconfig b/arch/ppc/configs/mcpn765_defconfig
6853--- a/arch/ppc/configs/mcpn765_defconfig Tue Jul 1 17:01:18 2003
6854+++ b/arch/ppc/configs/mcpn765_defconfig Mon Jul 21 09:05:22 2003
6855@@ -19,6 +19,7 @@
6856 CONFIG_SYSCTL=y
6857 CONFIG_LOG_BUF_SHIFT=14
6858 # CONFIG_EMBEDDED is not set
6859+CONFIG_KALLSYMS=y
6860 CONFIG_FUTEX=y
6861 CONFIG_EPOLL=y
6862
6863@@ -74,8 +75,8 @@
6864 CONFIG_PCI=y
6865 CONFIG_PCI_DOMAINS=y
6866 CONFIG_KCORE_ELF=y
6867-CONFIG_BINFMT_ELF=y
6868 CONFIG_KERNEL_ELF=y
6869+CONFIG_BINFMT_ELF=y
6870 # CONFIG_BINFMT_MISC is not set
6871 # CONFIG_PCI_LEGACY_PROC is not set
6872 # CONFIG_PCI_NAMES is not set
6873@@ -104,6 +105,11 @@
6874 CONFIG_BOOT_LOAD=0x00800000
6875
6876 #
6877+# Generic Driver Options
6878+#
6879+# CONFIG_FW_LOADER is not set
6880+
6881+#
6882 # Memory Technology Devices (MTD)
6883 #
6884 # CONFIG_MTD is not set
6885@@ -122,10 +128,12 @@
6886 # CONFIG_BLK_DEV_DAC960 is not set
6887 # CONFIG_BLK_DEV_UMEM is not set
6888 CONFIG_BLK_DEV_LOOP=y
6889+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6890 # CONFIG_BLK_DEV_NBD is not set
6891 CONFIG_BLK_DEV_RAM=y
6892 CONFIG_BLK_DEV_RAM_SIZE=4096
6893 CONFIG_BLK_DEV_INITRD=y
6894+# CONFIG_LBD is not set
6895
6896 #
6897 # Multi-device support (RAID and LVM)
6898@@ -133,12 +141,12 @@
6899 # CONFIG_MD is not set
6900
6901 #
6902-# ATA/IDE/MFM/RLL support
6903+# ATA/ATAPI/MFM/RLL support
6904 #
6905 # CONFIG_IDE is not set
6906
6907 #
6908-# SCSI support
6909+# SCSI device support
6910 #
6911 # CONFIG_SCSI is not set
6912
6913@@ -320,11 +328,6 @@
6914 # CONFIG_FB is not set
6915
6916 #
6917-# Old CD-ROM drivers (not SCSI, not IDE)
6918-#
6919-# CONFIG_CD_NO_IDESCSI is not set
6920-
6921-#
6922 # Input device support
6923 #
6924 # CONFIG_INPUT is not set
6925@@ -526,7 +529,6 @@
6926 # Kernel hacking
6927 #
6928 # CONFIG_DEBUG_KERNEL is not set
6929-# CONFIG_KALLSYMS is not set
6930 # CONFIG_SERIAL_TEXT_DEBUG is not set
6931
6932 #
6933diff -Nru a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
6934--- a/arch/ppc/configs/pmac_defconfig Sat Aug 2 13:06:57 2003
6935+++ b/arch/ppc/configs/pmac_defconfig Sat Aug 23 02:33:38 2003
6936@@ -9,6 +9,7 @@
6937 # Code maturity level options
6938 #
6939 CONFIG_EXPERIMENTAL=y
6940+# CONFIG_BROKEN is not set
6941
6942 #
6943 # General setup
6944@@ -18,9 +19,15 @@
6945 # CONFIG_BSD_PROCESS_ACCT is not set
6946 CONFIG_SYSCTL=y
6947 CONFIG_LOG_BUF_SHIFT=14
6948+CONFIG_IKCONFIG=y
6949+CONFIG_IKCONFIG_PROC=y
6950 # CONFIG_EMBEDDED is not set
6951+CONFIG_KALLSYMS=y
6952 CONFIG_FUTEX=y
6953 CONFIG_EPOLL=y
6954+CONFIG_IOSCHED_NOOP=y
6955+CONFIG_IOSCHED_AS=y
6956+CONFIG_IOSCHED_DEADLINE=y
6957
6958 #
6959 # Loadable module support
6960@@ -79,6 +86,7 @@
6961 # CONFIG_TAU_INT is not set
6962 # CONFIG_TAU_AVERAGE is not set
6963 CONFIG_CPU_FREQ=y
6964+CONFIG_CPU_FREQ_TABLE=y
6965 CONFIG_CPU_FREQ_PROC_INTF=y
6966 CONFIG_CPU_FREQ_24_API=y
6967 CONFIG_CPU_FREQ_PMAC=y
6968@@ -90,8 +98,8 @@
6969 CONFIG_PCI=y
6970 CONFIG_PCI_DOMAINS=y
6971 CONFIG_KCORE_ELF=y
6972-CONFIG_BINFMT_ELF=y
6973 CONFIG_KERNEL_ELF=y
6974+CONFIG_BINFMT_ELF=y
6975 CONFIG_BINFMT_MISC=m
6976 CONFIG_PCI_LEGACY_PROC=y
6977 CONFIG_PCI_NAMES=y
6978@@ -101,9 +109,9 @@
6979 # PCMCIA/CardBus support
6980 #
6981 CONFIG_PCMCIA=m
6982+CONFIG_YENTA=m
6983 CONFIG_CARDBUS=y
6984 CONFIG_I82092=m
6985-CONFIG_I82365=m
6986 CONFIG_TCIC=m
6987
6988 #
6989@@ -131,6 +139,11 @@
6990 CONFIG_BOOT_LOAD=0x00800000
6991
6992 #
6993+# Generic Driver Options
6994+#
6995+# CONFIG_FW_LOADER is not set
6996+
6997+#
6998 # Memory Technology Devices (MTD)
6999 #
7000 # CONFIG_MTD is not set
7001@@ -149,10 +162,12 @@
7002 # CONFIG_BLK_DEV_DAC960 is not set
7003 # CONFIG_BLK_DEV_UMEM is not set
7004 CONFIG_BLK_DEV_LOOP=y
7005+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7006 # CONFIG_BLK_DEV_NBD is not set
7007 CONFIG_BLK_DEV_RAM=y
7008 CONFIG_BLK_DEV_RAM_SIZE=4096
7009 CONFIG_BLK_DEV_INITRD=y
7010+CONFIG_LBD=y
7011
7012 #
7013 # Multi-device support (RAID and LVM)
7014@@ -160,41 +175,39 @@
7015 # CONFIG_MD is not set
7016
7017 #
7018-# ATA/IDE/MFM/RLL support
7019+# ATA/ATAPI/MFM/RLL support
7020 #
7021 CONFIG_IDE=y
7022-
7023-#
7024-# IDE, ATA and ATAPI Block devices
7025-#
7026 CONFIG_BLK_DEV_IDE=y
7027
7028 #
7029 # Please see Documentation/ide.txt for help/info on IDE drives
7030 #
7031-# CONFIG_BLK_DEV_HD is not set
7032 CONFIG_BLK_DEV_IDEDISK=y
7033 # CONFIG_IDEDISK_MULTI_MODE is not set
7034 # CONFIG_IDEDISK_STROKE is not set
7035 CONFIG_BLK_DEV_IDECS=m
7036 CONFIG_BLK_DEV_IDECD=y
7037+# CONFIG_BLK_DEV_IDETAPE is not set
7038 CONFIG_BLK_DEV_IDEFLOPPY=y
7039 CONFIG_BLK_DEV_IDESCSI=y
7040 # CONFIG_IDE_TASK_IOCTL is not set
7041+# CONFIG_IDE_TASKFILE_IO is not set
7042
7043 #
7044 # IDE chipset support/bugfixes
7045 #
7046 CONFIG_BLK_DEV_IDEPCI=y
7047-CONFIG_BLK_DEV_GENERIC=y
7048 CONFIG_IDEPCI_SHARE_IRQ=y
7049+# CONFIG_BLK_DEV_OFFBOARD is not set
7050+CONFIG_BLK_DEV_GENERIC=y
7051+# CONFIG_BLK_DEV_OPTI621 is not set
7052+CONFIG_BLK_DEV_SL82C105=y
7053 CONFIG_BLK_DEV_IDEDMA_PCI=y
7054 # CONFIG_BLK_DEV_IDE_TCQ is not set
7055-# CONFIG_BLK_DEV_OFFBOARD is not set
7056 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
7057 CONFIG_IDEDMA_PCI_AUTO=y
7058 # CONFIG_IDEDMA_ONLYDISK is not set
7059-CONFIG_BLK_DEV_IDEDMA=y
7060 # CONFIG_IDEDMA_PCI_WIP is not set
7061 CONFIG_BLK_DEV_ADMA=y
7062 # CONFIG_BLK_DEV_AEC62XX is not set
7063@@ -204,12 +217,12 @@
7064 # CONFIG_BLK_DEV_TRIFLEX is not set
7065 # CONFIG_BLK_DEV_CY82C693 is not set
7066 # CONFIG_BLK_DEV_CS5520 is not set
7067+# CONFIG_BLK_DEV_CS5530 is not set
7068 # CONFIG_BLK_DEV_HPT34X is not set
7069 # CONFIG_BLK_DEV_HPT366 is not set
7070 # CONFIG_BLK_DEV_SC1200 is not set
7071 # CONFIG_BLK_DEV_PIIX is not set
7072 # CONFIG_BLK_DEV_NS87415 is not set
7073-# CONFIG_BLK_DEV_OPTI621 is not set
7074 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
7075 CONFIG_BLK_DEV_PDC202XX_NEW=y
7076 # CONFIG_PDC202XX_FORCE is not set
7077@@ -218,15 +231,17 @@
7078 # CONFIG_BLK_DEV_SLC90E66 is not set
7079 # CONFIG_BLK_DEV_TRM290 is not set
7080 # CONFIG_BLK_DEV_VIA82CXXX is not set
7081-CONFIG_BLK_DEV_SL82C105=y
7082 CONFIG_BLK_DEV_IDE_PMAC=y
7083 CONFIG_BLK_DEV_IDEDMA_PMAC=y
7084 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
7085-CONFIG_IDEDMA_AUTO=y
7086+CONFIG_BLK_DEV_IDEDMA=y
7087 # CONFIG_IDEDMA_IVB is not set
7088+CONFIG_IDEDMA_AUTO=y
7089+# CONFIG_DMA_NONPCI is not set
7090+# CONFIG_BLK_DEV_HD is not set
7091
7092 #
7093-# SCSI support
7094+# SCSI device support
7095 #
7096 CONFIG_SCSI=y
7097
7098@@ -266,8 +281,6 @@
7099 # CONFIG_SCSI_AIC79XX is not set
7100 # CONFIG_SCSI_DPT_I2O is not set
7101 CONFIG_SCSI_ADVANSYS=m
7102-# CONFIG_SCSI_IN2000 is not set
7103-# CONFIG_SCSI_AM53C974 is not set
7104 # CONFIG_SCSI_MEGARAID is not set
7105 # CONFIG_SCSI_BUSLOGIC is not set
7106 # CONFIG_SCSI_CPQFCTS is not set
7107@@ -276,11 +289,8 @@
7108 # CONFIG_SCSI_EATA_PIO is not set
7109 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7110 # CONFIG_SCSI_GDTH is not set
7111-# CONFIG_SCSI_GENERIC_NCR5380 is not set
7112-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7113 # CONFIG_SCSI_INITIO is not set
7114 # CONFIG_SCSI_INIA100 is not set
7115-# CONFIG_SCSI_NCR53C7xx is not set
7116 CONFIG_SCSI_SYM53C8XX_2=y
7117 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
7118 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7119@@ -293,7 +303,6 @@
7120 # CONFIG_SCSI_QLOGIC_1280 is not set
7121 # CONFIG_SCSI_DC395x is not set
7122 # CONFIG_SCSI_DC390T is not set
7123-# CONFIG_SCSI_U14_34F is not set
7124 # CONFIG_SCSI_NSP32 is not set
7125 # CONFIG_SCSI_DEBUG is not set
7126 CONFIG_SCSI_MESH=y
7127@@ -361,8 +370,6 @@
7128 CONFIG_PACKET=y
7129 # CONFIG_PACKET_MMAP is not set
7130 # CONFIG_NETLINK_DEV is not set
7131-CONFIG_NETFILTER=y
7132-# CONFIG_NETFILTER_DEBUG is not set
7133 CONFIG_UNIX=y
7134 # CONFIG_NET_KEY is not set
7135 CONFIG_INET=y
7136@@ -380,6 +387,16 @@
7137 # CONFIG_INET_IPCOMP is not set
7138
7139 #
7140+# IP: Virtual Server Configuration
7141+#
7142+# CONFIG_IP_VS is not set
7143+# CONFIG_IPV6 is not set
7144+# CONFIG_DECNET is not set
7145+# CONFIG_BRIDGE is not set
7146+CONFIG_NETFILTER=y
7147+# CONFIG_NETFILTER_DEBUG is not set
7148+
7149+#
7150 # IP: Netfilter Configuration
7151 #
7152 CONFIG_IP_NF_CONNTRACK=m
7153@@ -395,6 +412,7 @@
7154 CONFIG_IP_NF_MATCH_MARK=m
7155 CONFIG_IP_NF_MATCH_MULTIPORT=m
7156 CONFIG_IP_NF_MATCH_TOS=m
7157+CONFIG_IP_NF_MATCH_RECENT=m
7158 CONFIG_IP_NF_MATCH_ECN=m
7159 CONFIG_IP_NF_MATCH_DSCP=m
7160 CONFIG_IP_NF_MATCH_AH_ESP=m
7161@@ -425,10 +443,9 @@
7162 CONFIG_IP_NF_TARGET_TCPMSS=m
7163 CONFIG_IP_NF_ARPTABLES=m
7164 CONFIG_IP_NF_ARPFILTER=m
7165+CONFIG_IP_NF_ARP_MANGLE=m
7166 CONFIG_IP_NF_COMPAT_IPCHAINS=m
7167 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
7168-# CONFIG_IPV6 is not set
7169-# CONFIG_XFRM_USER is not set
7170
7171 #
7172 # SCTP Configuration (EXPERIMENTAL)
7173@@ -438,8 +455,6 @@
7174 # CONFIG_ATM is not set
7175 # CONFIG_VLAN_8021Q is not set
7176 # CONFIG_LLC is not set
7177-# CONFIG_DECNET is not set
7178-# CONFIG_BRIDGE is not set
7179 # CONFIG_X25 is not set
7180 # CONFIG_LAPB is not set
7181 # CONFIG_NET_DIVERT is not set
7182@@ -516,6 +531,7 @@
7183 # CONFIG_HAMACHI is not set
7184 # CONFIG_YELLOWFIN is not set
7185 # CONFIG_R8169 is not set
7186+# CONFIG_SIS190 is not set
7187 # CONFIG_SK98LIN is not set
7188 # CONFIG_TIGON3 is not set
7189
7190@@ -568,6 +584,7 @@
7191 CONFIG_PCMCIA_HERMES=m
7192 # CONFIG_AIRO_CS is not set
7193 # CONFIG_PCMCIA_ATMEL is not set
7194+# CONFIG_PCMCIA_WL3501 is not set
7195 CONFIG_NET_WIRELESS=y
7196
7197 #
7198@@ -637,25 +654,18 @@
7199 #
7200 # Old SIR device drivers
7201 #
7202-# CONFIG_IRTTY_OLD is not set
7203 # CONFIG_IRPORT_SIR is not set
7204
7205 #
7206 # Old Serial dongle support
7207 #
7208-# CONFIG_DONGLE_OLD is not set
7209
7210 #
7211 # FIR device drivers
7212 #
7213 # CONFIG_USB_IRDA is not set
7214-# CONFIG_NSC_FIR is not set
7215-# CONFIG_WINBOND_FIR is not set
7216 # CONFIG_TOSHIBA_OLD is not set
7217 # CONFIG_TOSHIBA_FIR is not set
7218-# CONFIG_SMC_IRCC_OLD is not set
7219-# CONFIG_SMC_IRCC_FIR is not set
7220-# CONFIG_ALI_FIR is not set
7221 # CONFIG_VLSI_FIR is not set
7222
7223 #
7224@@ -721,11 +731,6 @@
7225 CONFIG_LOGO_LINUX_CLUT224=y
7226
7227 #
7228-# Old CD-ROM drivers (not SCSI, not IDE)
7229-#
7230-# CONFIG_CD_NO_IDESCSI is not set
7231-
7232-#
7233 # Input device support
7234 #
7235 CONFIG_INPUT=y
7236@@ -766,7 +771,7 @@
7237 CONFIG_PMAC_PBOOK=y
7238 CONFIG_PMAC_APM_EMU=y
7239 CONFIG_PMAC_BACKLIGHT=y
7240-CONFIG_MAC_FLOPPY=y
7241+# CONFIG_MAC_FLOPPY is not set
7242 CONFIG_MAC_SERIAL=y
7243 CONFIG_ADB=y
7244 CONFIG_ADB_MACIO=y
7245@@ -808,10 +813,12 @@
7246 #
7247 # I2C Hardware Sensors Mainboard support
7248 #
7249+# CONFIG_I2C_ALI1535 is not set
7250 # CONFIG_I2C_ALI15X3 is not set
7251 # CONFIG_I2C_AMD756 is not set
7252 # CONFIG_I2C_AMD8111 is not set
7253 # CONFIG_I2C_I801 is not set
7254+# CONFIG_I2C_NFORCE2 is not set
7255 # CONFIG_I2C_PIIX4 is not set
7256 # CONFIG_I2C_SIS96X is not set
7257 # CONFIG_I2C_VIAPRO is not set
7258@@ -823,6 +830,7 @@
7259 # CONFIG_SENSORS_IT87 is not set
7260 # CONFIG_SENSORS_LM75 is not set
7261 # CONFIG_SENSORS_LM85 is not set
7262+# CONFIG_SENSORS_LM78 is not set
7263 # CONFIG_SENSORS_VIA686A is not set
7264 # CONFIG_SENSORS_W83781D is not set
7265 # CONFIG_I2C_SENSOR is not set
7266@@ -1028,8 +1036,7 @@
7267 # Sound
7268 #
7269 CONFIG_SOUND=m
7270-CONFIG_DMASOUND_AWACS=m
7271-CONFIG_DMASOUND=m
7272+# CONFIG_DMASOUND_AWACS is not set
7273
7274 #
7275 # Advanced Linux Sound Architecture
7276@@ -1168,6 +1175,7 @@
7277 #
7278 # USB Network adaptors
7279 #
7280+# CONFIG_USB_AX8817X is not set
7281 # CONFIG_USB_CATC is not set
7282 # CONFIG_USB_KAWETH is not set
7283 # CONFIG_USB_PEGASUS is not set
7284@@ -1231,7 +1239,6 @@
7285 # Kernel hacking
7286 #
7287 # CONFIG_DEBUG_KERNEL is not set
7288-CONFIG_KALLSYMS=y
7289 CONFIG_BOOTX_TEXT=y
7290
7291 #
7292diff -Nru a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
7293--- a/arch/ppc/configs/power3_defconfig Tue Jul 1 17:01:18 2003
7294+++ b/arch/ppc/configs/power3_defconfig Sat Aug 23 02:33:38 2003
7295@@ -9,6 +9,7 @@
7296 # Code maturity level options
7297 #
7298 CONFIG_EXPERIMENTAL=y
7299+# CONFIG_BROKEN is not set
7300
7301 #
7302 # General setup
7303@@ -18,9 +19,15 @@
7304 # CONFIG_BSD_PROCESS_ACCT is not set
7305 CONFIG_SYSCTL=y
7306 CONFIG_LOG_BUF_SHIFT=15
7307+CONFIG_IKCONFIG=y
7308+CONFIG_IKCONFIG_PROC=y
7309 # CONFIG_EMBEDDED is not set
7310+CONFIG_KALLSYMS=y
7311 CONFIG_FUTEX=y
7312 CONFIG_EPOLL=y
7313+CONFIG_IOSCHED_NOOP=y
7314+CONFIG_IOSCHED_AS=y
7315+CONFIG_IOSCHED_DEADLINE=y
7316
7317 #
7318 # Loadable module support
7319@@ -82,8 +89,8 @@
7320 CONFIG_PCI=y
7321 CONFIG_PCI_DOMAINS=y
7322 CONFIG_KCORE_ELF=y
7323-CONFIG_BINFMT_ELF=y
7324 CONFIG_KERNEL_ELF=y
7325+CONFIG_BINFMT_ELF=y
7326 CONFIG_BINFMT_MISC=y
7327 CONFIG_PCI_LEGACY_PROC=y
7328 CONFIG_PCI_NAMES=y
7329@@ -121,6 +128,10 @@
7330 CONFIG_BOOT_LOAD=0x00800000
7331
7332 #
7333+# Generic Driver Options
7334+#
7335+
7336+#
7337 # Memory Technology Devices (MTD)
7338 #
7339 # CONFIG_MTD is not set
7340@@ -140,10 +151,12 @@
7341 # CONFIG_BLK_DEV_DAC960 is not set
7342 # CONFIG_BLK_DEV_UMEM is not set
7343 CONFIG_BLK_DEV_LOOP=y
7344+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7345 # CONFIG_BLK_DEV_NBD is not set
7346 CONFIG_BLK_DEV_RAM=y
7347 CONFIG_BLK_DEV_RAM_SIZE=4096
7348 CONFIG_BLK_DEV_INITRD=y
7349+CONFIG_LBD=y
7350
7351 #
7352 # Multi-device support (RAID and LVM)
7353@@ -156,14 +169,15 @@
7354 CONFIG_MD_RAID5=y
7355 # CONFIG_MD_MULTIPATH is not set
7356 CONFIG_BLK_DEV_DM=y
7357+CONFIG_DM_IOCTL_V4=y
7358
7359 #
7360-# ATA/IDE/MFM/RLL support
7361+# ATA/ATAPI/MFM/RLL support
7362 #
7363 # CONFIG_IDE is not set
7364
7365 #
7366-# SCSI support
7367+# SCSI device support
7368 #
7369 CONFIG_SCSI=y
7370
7371@@ -196,8 +210,6 @@
7372 # CONFIG_SCSI_AIC79XX is not set
7373 # CONFIG_SCSI_DPT_I2O is not set
7374 # CONFIG_SCSI_ADVANSYS is not set
7375-# CONFIG_SCSI_IN2000 is not set
7376-# CONFIG_SCSI_AM53C974 is not set
7377 # CONFIG_SCSI_MEGARAID is not set
7378 # CONFIG_SCSI_BUSLOGIC is not set
7379 # CONFIG_SCSI_CPQFCTS is not set
7380@@ -206,13 +218,10 @@
7381 # CONFIG_SCSI_EATA_PIO is not set
7382 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7383 # CONFIG_SCSI_GDTH is not set
7384-# CONFIG_SCSI_GENERIC_NCR5380 is not set
7385-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7386 # CONFIG_SCSI_INITIO is not set
7387 # CONFIG_SCSI_INIA100 is not set
7388 # CONFIG_SCSI_PPA is not set
7389 # CONFIG_SCSI_IMM is not set
7390-# CONFIG_SCSI_NCR53C7xx is not set
7391 CONFIG_SCSI_SYM53C8XX_2=y
7392 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
7393 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7394@@ -225,7 +234,6 @@
7395 # CONFIG_SCSI_QLOGIC_1280 is not set
7396 # CONFIG_SCSI_DC395x is not set
7397 # CONFIG_SCSI_DC390T is not set
7398-# CONFIG_SCSI_U14_34F is not set
7399 # CONFIG_SCSI_NSP32 is not set
7400 # CONFIG_SCSI_DEBUG is not set
7401 # CONFIG_SCSI_MESH is not set
7402@@ -257,7 +265,6 @@
7403 CONFIG_PACKET=y
7404 # CONFIG_PACKET_MMAP is not set
7405 # CONFIG_NETLINK_DEV is not set
7406-# CONFIG_NETFILTER is not set
7407 CONFIG_UNIX=y
7408 # CONFIG_NET_KEY is not set
7409 CONFIG_INET=y
7410@@ -274,7 +281,9 @@
7411 # CONFIG_INET_ESP is not set
7412 # CONFIG_INET_IPCOMP is not set
7413 # CONFIG_IPV6 is not set
7414-# CONFIG_XFRM_USER is not set
7415+# CONFIG_DECNET is not set
7416+# CONFIG_BRIDGE is not set
7417+# CONFIG_NETFILTER is not set
7418
7419 #
7420 # SCTP Configuration (EXPERIMENTAL)
7421@@ -284,8 +293,6 @@
7422 # CONFIG_ATM is not set
7423 # CONFIG_VLAN_8021Q is not set
7424 # CONFIG_LLC is not set
7425-# CONFIG_DECNET is not set
7426-# CONFIG_BRIDGE is not set
7427 # CONFIG_X25 is not set
7428 # CONFIG_LAPB is not set
7429 # CONFIG_NET_DIVERT is not set
7430@@ -362,6 +369,7 @@
7431 # CONFIG_HAMACHI is not set
7432 # CONFIG_YELLOWFIN is not set
7433 # CONFIG_R8169 is not set
7434+# CONFIG_SIS190 is not set
7435 # CONFIG_SK98LIN is not set
7436 # CONFIG_TIGON3 is not set
7437
7438@@ -464,11 +472,6 @@
7439 CONFIG_LOGO_LINUX_CLUT224=y
7440
7441 #
7442-# Old CD-ROM drivers (not SCSI, not IDE)
7443-#
7444-# CONFIG_CD_NO_IDESCSI is not set
7445-
7446-#
7447 # Input device support
7448 #
7449 CONFIG_INPUT=y
7450@@ -495,6 +498,7 @@
7451 CONFIG_SERIO_SERPORT=y
7452 # CONFIG_SERIO_CT82C710 is not set
7453 # CONFIG_SERIO_PARKBD is not set
7454+# CONFIG_SERIO_PCIPS2 is not set
7455
7456 #
7457 # Input Device Drivers
7458@@ -554,9 +558,8 @@
7459 #
7460 CONFIG_I2C=y
7461 CONFIG_I2C_ALGOBIT=y
7462+# CONFIG_I2C_PROSAVAGE is not set
7463 # CONFIG_I2C_PHILIPSPAR is not set
7464-# CONFIG_I2C_ELV is not set
7465-# CONFIG_I2C_VELLEMAN is not set
7466 # CONFIG_SCx200_ACB is not set
7467 CONFIG_I2C_ALGOPCF=y
7468 # CONFIG_I2C_ELEKTOR is not set
7469@@ -566,10 +569,12 @@
7470 #
7471 # I2C Hardware Sensors Mainboard support
7472 #
7473+# CONFIG_I2C_ALI1535 is not set
7474 # CONFIG_I2C_ALI15X3 is not set
7475 # CONFIG_I2C_AMD756 is not set
7476 # CONFIG_I2C_AMD8111 is not set
7477 # CONFIG_I2C_I801 is not set
7478+# CONFIG_I2C_NFORCE2 is not set
7479 # CONFIG_I2C_PIIX4 is not set
7480 # CONFIG_I2C_SIS96X is not set
7481 # CONFIG_I2C_VIAPRO is not set
7482@@ -581,6 +586,7 @@
7483 # CONFIG_SENSORS_IT87 is not set
7484 # CONFIG_SENSORS_LM75 is not set
7485 # CONFIG_SENSORS_LM85 is not set
7486+# CONFIG_SENSORS_LM78 is not set
7487 # CONFIG_SENSORS_VIA686A is not set
7488 # CONFIG_SENSORS_W83781D is not set
7489 # CONFIG_I2C_SENSOR is not set
7490@@ -843,7 +849,6 @@
7491 # Kernel hacking
7492 #
7493 # CONFIG_DEBUG_KERNEL is not set
7494-CONFIG_KALLSYMS=y
7495 CONFIG_BOOTX_TEXT=y
7496
7497 #
7498diff -Nru a/arch/ppc/defconfig b/arch/ppc/defconfig
7499--- a/arch/ppc/defconfig Sat Aug 2 12:59:32 2003
7500+++ b/arch/ppc/defconfig Sat Aug 23 02:33:38 2003
7501@@ -9,6 +9,7 @@
7502 # Code maturity level options
7503 #
7504 CONFIG_EXPERIMENTAL=y
7505+# CONFIG_BROKEN is not set
7506
7507 #
7508 # General setup
7509@@ -18,9 +19,15 @@
7510 # CONFIG_BSD_PROCESS_ACCT is not set
7511 CONFIG_SYSCTL=y
7512 CONFIG_LOG_BUF_SHIFT=14
7513+CONFIG_IKCONFIG=y
7514+CONFIG_IKCONFIG_PROC=y
7515 # CONFIG_EMBEDDED is not set
7516+CONFIG_KALLSYMS=y
7517 CONFIG_FUTEX=y
7518 CONFIG_EPOLL=y
7519+CONFIG_IOSCHED_NOOP=y
7520+CONFIG_IOSCHED_AS=y
7521+CONFIG_IOSCHED_DEADLINE=y
7522
7523 #
7524 # Loadable module support
7525@@ -78,6 +85,7 @@
7526 # CONFIG_TAU_INT is not set
7527 # CONFIG_TAU_AVERAGE is not set
7528 CONFIG_CPU_FREQ=y
7529+CONFIG_CPU_FREQ_TABLE=y
7530 CONFIG_CPU_FREQ_PROC_INTF=y
7531 CONFIG_CPU_FREQ_24_API=y
7532 CONFIG_CPU_FREQ_PMAC=y
7533@@ -89,8 +97,8 @@
7534 CONFIG_PCI=y
7535 CONFIG_PCI_DOMAINS=y
7536 CONFIG_KCORE_ELF=y
7537-CONFIG_BINFMT_ELF=y
7538 CONFIG_KERNEL_ELF=y
7539+CONFIG_BINFMT_ELF=y
7540 CONFIG_BINFMT_MISC=m
7541 CONFIG_PCI_LEGACY_PROC=y
7542 CONFIG_PCI_NAMES=y
7543@@ -128,6 +136,11 @@
7544 CONFIG_BOOT_LOAD=0x00800000
7545
7546 #
7547+# Generic Driver Options
7548+#
7549+# CONFIG_FW_LOADER is not set
7550+
7551+#
7552 # Memory Technology Devices (MTD)
7553 #
7554 # CONFIG_MTD is not set
7555@@ -146,10 +159,12 @@
7556 # CONFIG_BLK_DEV_DAC960 is not set
7557 # CONFIG_BLK_DEV_UMEM is not set
7558 CONFIG_BLK_DEV_LOOP=y
7559+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7560 # CONFIG_BLK_DEV_NBD is not set
7561 CONFIG_BLK_DEV_RAM=y
7562 CONFIG_BLK_DEV_RAM_SIZE=4096
7563 CONFIG_BLK_DEV_INITRD=y
7564+CONFIG_LBD=y
7565
7566 #
7567 # Multi-device support (RAID and LVM)
7568@@ -157,40 +172,38 @@
7569 # CONFIG_MD is not set
7570
7571 #
7572-# ATA/IDE/MFM/RLL support
7573+# ATA/ATAPI/MFM/RLL support
7574 #
7575 CONFIG_IDE=y
7576-
7577-#
7578-# IDE, ATA and ATAPI Block devices
7579-#
7580 CONFIG_BLK_DEV_IDE=y
7581
7582 #
7583 # Please see Documentation/ide.txt for help/info on IDE drives
7584 #
7585-# CONFIG_BLK_DEV_HD is not set
7586 CONFIG_BLK_DEV_IDEDISK=y
7587 # CONFIG_IDEDISK_MULTI_MODE is not set
7588 # CONFIG_IDEDISK_STROKE is not set
7589 CONFIG_BLK_DEV_IDECD=y
7590+# CONFIG_BLK_DEV_IDETAPE is not set
7591 CONFIG_BLK_DEV_IDEFLOPPY=y
7592 CONFIG_BLK_DEV_IDESCSI=y
7593 # CONFIG_IDE_TASK_IOCTL is not set
7594+# CONFIG_IDE_TASKFILE_IO is not set
7595
7596 #
7597 # IDE chipset support/bugfixes
7598 #
7599 CONFIG_BLK_DEV_IDEPCI=y
7600-CONFIG_BLK_DEV_GENERIC=y
7601 CONFIG_IDEPCI_SHARE_IRQ=y
7602+# CONFIG_BLK_DEV_OFFBOARD is not set
7603+CONFIG_BLK_DEV_GENERIC=y
7604+# CONFIG_BLK_DEV_OPTI621 is not set
7605+CONFIG_BLK_DEV_SL82C105=y
7606 CONFIG_BLK_DEV_IDEDMA_PCI=y
7607 # CONFIG_BLK_DEV_IDE_TCQ is not set
7608-# CONFIG_BLK_DEV_OFFBOARD is not set
7609 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
7610 CONFIG_IDEDMA_PCI_AUTO=y
7611 # CONFIG_IDEDMA_ONLYDISK is not set
7612-CONFIG_BLK_DEV_IDEDMA=y
7613 # CONFIG_IDEDMA_PCI_WIP is not set
7614 CONFIG_BLK_DEV_ADMA=y
7615 # CONFIG_BLK_DEV_AEC62XX is not set
7616@@ -200,12 +213,12 @@
7617 # CONFIG_BLK_DEV_TRIFLEX is not set
7618 # CONFIG_BLK_DEV_CY82C693 is not set
7619 # CONFIG_BLK_DEV_CS5520 is not set
7620+# CONFIG_BLK_DEV_CS5530 is not set
7621 # CONFIG_BLK_DEV_HPT34X is not set
7622 # CONFIG_BLK_DEV_HPT366 is not set
7623 # CONFIG_BLK_DEV_SC1200 is not set
7624 # CONFIG_BLK_DEV_PIIX is not set
7625 # CONFIG_BLK_DEV_NS87415 is not set
7626-# CONFIG_BLK_DEV_OPTI621 is not set
7627 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
7628 # CONFIG_BLK_DEV_PDC202XX_NEW is not set
7629 # CONFIG_BLK_DEV_SVWKS is not set
7630@@ -213,15 +226,17 @@
7631 # CONFIG_BLK_DEV_SLC90E66 is not set
7632 # CONFIG_BLK_DEV_TRM290 is not set
7633 # CONFIG_BLK_DEV_VIA82CXXX is not set
7634-CONFIG_BLK_DEV_SL82C105=y
7635 CONFIG_BLK_DEV_IDE_PMAC=y
7636 CONFIG_BLK_DEV_IDEDMA_PMAC=y
7637 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
7638-CONFIG_IDEDMA_AUTO=y
7639+CONFIG_BLK_DEV_IDEDMA=y
7640 # CONFIG_IDEDMA_IVB is not set
7641+CONFIG_IDEDMA_AUTO=y
7642+# CONFIG_DMA_NONPCI is not set
7643+# CONFIG_BLK_DEV_HD is not set
7644
7645 #
7646-# SCSI support
7647+# SCSI device support
7648 #
7649 CONFIG_SCSI=y
7650
7651@@ -261,8 +276,6 @@
7652 # CONFIG_SCSI_AIC79XX is not set
7653 # CONFIG_SCSI_DPT_I2O is not set
7654 CONFIG_SCSI_ADVANSYS=m
7655-# CONFIG_SCSI_IN2000 is not set
7656-# CONFIG_SCSI_AM53C974 is not set
7657 # CONFIG_SCSI_MEGARAID is not set
7658 # CONFIG_SCSI_BUSLOGIC is not set
7659 # CONFIG_SCSI_CPQFCTS is not set
7660@@ -271,11 +284,8 @@
7661 # CONFIG_SCSI_EATA_PIO is not set
7662 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7663 # CONFIG_SCSI_GDTH is not set
7664-# CONFIG_SCSI_GENERIC_NCR5380 is not set
7665-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7666 # CONFIG_SCSI_INITIO is not set
7667 # CONFIG_SCSI_INIA100 is not set
7668-# CONFIG_SCSI_NCR53C7xx is not set
7669 CONFIG_SCSI_SYM53C8XX_2=y
7670 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
7671 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7672@@ -288,7 +298,6 @@
7673 # CONFIG_SCSI_QLOGIC_1280 is not set
7674 # CONFIG_SCSI_DC395x is not set
7675 # CONFIG_SCSI_DC390T is not set
7676-# CONFIG_SCSI_U14_34F is not set
7677 # CONFIG_SCSI_NSP32 is not set
7678 # CONFIG_SCSI_DEBUG is not set
7679 CONFIG_SCSI_MESH=y
7680@@ -322,8 +331,6 @@
7681 CONFIG_PACKET=y
7682 # CONFIG_PACKET_MMAP is not set
7683 # CONFIG_NETLINK_DEV is not set
7684-CONFIG_NETFILTER=y
7685-# CONFIG_NETFILTER_DEBUG is not set
7686 CONFIG_UNIX=y
7687 # CONFIG_NET_KEY is not set
7688 CONFIG_INET=y
7689@@ -341,6 +348,16 @@
7690 # CONFIG_INET_IPCOMP is not set
7691
7692 #
7693+# IP: Virtual Server Configuration
7694+#
7695+# CONFIG_IP_VS is not set
7696+# CONFIG_IPV6 is not set
7697+# CONFIG_DECNET is not set
7698+# CONFIG_BRIDGE is not set
7699+CONFIG_NETFILTER=y
7700+# CONFIG_NETFILTER_DEBUG is not set
7701+
7702+#
7703 # IP: Netfilter Configuration
7704 #
7705 CONFIG_IP_NF_CONNTRACK=m
7706@@ -356,6 +373,7 @@
7707 CONFIG_IP_NF_MATCH_MARK=m
7708 CONFIG_IP_NF_MATCH_MULTIPORT=m
7709 CONFIG_IP_NF_MATCH_TOS=m
7710+CONFIG_IP_NF_MATCH_RECENT=m
7711 CONFIG_IP_NF_MATCH_ECN=m
7712 CONFIG_IP_NF_MATCH_DSCP=m
7713 CONFIG_IP_NF_MATCH_AH_ESP=m
7714@@ -386,10 +404,9 @@
7715 CONFIG_IP_NF_TARGET_TCPMSS=m
7716 CONFIG_IP_NF_ARPTABLES=m
7717 CONFIG_IP_NF_ARPFILTER=m
7718+CONFIG_IP_NF_ARP_MANGLE=m
7719 CONFIG_IP_NF_COMPAT_IPCHAINS=m
7720 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
7721-# CONFIG_IPV6 is not set
7722-# CONFIG_XFRM_USER is not set
7723
7724 #
7725 # SCTP Configuration (EXPERIMENTAL)
7726@@ -399,8 +416,6 @@
7727 # CONFIG_ATM is not set
7728 # CONFIG_VLAN_8021Q is not set
7729 # CONFIG_LLC is not set
7730-# CONFIG_DECNET is not set
7731-# CONFIG_BRIDGE is not set
7732 # CONFIG_X25 is not set
7733 # CONFIG_LAPB is not set
7734 # CONFIG_NET_DIVERT is not set
7735@@ -477,6 +492,7 @@
7736 # CONFIG_HAMACHI is not set
7737 # CONFIG_YELLOWFIN is not set
7738 # CONFIG_R8169 is not set
7739+# CONFIG_SIS190 is not set
7740 # CONFIG_SK98LIN is not set
7741 # CONFIG_TIGON3 is not set
7742
7743@@ -548,7 +564,7 @@
7744 # Graphics support
7745 #
7746 CONFIG_FB=y
7747-CONFIG_FB_CIRRUS=y
7748+# CONFIG_FB_CIRRUS is not set
7749 # CONFIG_FB_PM2 is not set
7750 # CONFIG_FB_CYBER2000 is not set
7751 CONFIG_FB_OF=y
7752@@ -602,11 +618,6 @@
7753 CONFIG_LOGO_LINUX_CLUT224=y
7754
7755 #
7756-# Old CD-ROM drivers (not SCSI, not IDE)
7757-#
7758-# CONFIG_CD_NO_IDESCSI is not set
7759-
7760-#
7761 # Input device support
7762 #
7763 CONFIG_INPUT=y
7764@@ -632,6 +643,7 @@
7765 CONFIG_SERIO_I8042=y
7766 CONFIG_SERIO_SERPORT=y
7767 # CONFIG_SERIO_CT82C710 is not set
7768+# CONFIG_SERIO_PCIPS2 is not set
7769
7770 #
7771 # Input Device Drivers
7772@@ -698,10 +710,12 @@
7773 #
7774 # I2C Hardware Sensors Mainboard support
7775 #
7776+# CONFIG_I2C_ALI1535 is not set
7777 # CONFIG_I2C_ALI15X3 is not set
7778 # CONFIG_I2C_AMD756 is not set
7779 # CONFIG_I2C_AMD8111 is not set
7780 # CONFIG_I2C_I801 is not set
7781+# CONFIG_I2C_NFORCE2 is not set
7782 # CONFIG_I2C_PIIX4 is not set
7783 # CONFIG_I2C_SIS96X is not set
7784 # CONFIG_I2C_VIAPRO is not set
7785@@ -713,6 +727,7 @@
7786 # CONFIG_SENSORS_IT87 is not set
7787 # CONFIG_SENSORS_LM75 is not set
7788 # CONFIG_SENSORS_LM85 is not set
7789+# CONFIG_SENSORS_LM78 is not set
7790 # CONFIG_SENSORS_VIA686A is not set
7791 # CONFIG_SENSORS_W83781D is not set
7792 # CONFIG_I2C_SENSOR is not set
7793@@ -1047,6 +1062,7 @@
7794 #
7795 # USB Network adaptors
7796 #
7797+# CONFIG_USB_AX8817X is not set
7798 # CONFIG_USB_CATC is not set
7799 # CONFIG_USB_KAWETH is not set
7800 # CONFIG_USB_PEGASUS is not set
7801@@ -1123,7 +1139,6 @@
7802 # Kernel hacking
7803 #
7804 # CONFIG_DEBUG_KERNEL is not set
7805-CONFIG_KALLSYMS=y
7806 CONFIG_BOOTX_TEXT=y
7807
7808 #
7809diff -Nru a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
7810--- a/arch/ppc/kernel/cputable.c Sun Apr 27 05:41:48 2003
7811+++ b/arch/ppc/kernel/cputable.c Sun Aug 24 03:04:21 2003
7812@@ -154,6 +154,15 @@
7813 32, 32,
7814 __setup_cpu_750cx
7815 },
7816+ { /* 750FX rev 1.x */
7817+ 0xffffff00, 0x70000100, "750FX",
7818+ CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
7819+ CPU_FTR_L2CR | CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_CAN_NAP |
7820+ CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM,
7821+ COMMON_PPC,
7822+ 32, 32,
7823+ __setup_cpu_750
7824+ },
7825 { /* 750FX rev 2.0 must disable HID0[DPM] */
7826 0xffffffff, 0x70000200, "750FX",
7827 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
7828diff -Nru a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
7829--- a/arch/ppc/kernel/head.S Wed Jun 4 20:07:15 2003
7830+++ b/arch/ppc/kernel/head.S Tue Aug 26 06:38:51 2003
7831@@ -355,11 +355,6 @@
7832 * -- paulus.
7833 */
7834 . = 0x200
7835-MachineCheck:
7836-BEGIN_FTR_SECTION
7837- dssall
7838- sync
7839-END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
7840 mtspr SPRG0,r10
7841 mtspr SPRG1,r11
7842 mfcr r10
7843diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
7844--- a/arch/ppc/kernel/misc.S Tue Jul 15 04:47:19 2003
7845+++ b/arch/ppc/kernel/misc.S Fri Aug 22 19:15:18 2003
7846@@ -1380,3 +1380,4 @@
7847 .long sys_utimes
7848 .long sys_statfs64
7849 .long sys_fstatfs64
7850+ .long ppc_fadvise64_64
7851diff -Nru a/arch/ppc/kernel/ppc-stub.c b/arch/ppc/kernel/ppc-stub.c
7852--- a/arch/ppc/kernel/ppc-stub.c Mon Jun 30 10:10:33 2003
7853+++ b/arch/ppc/kernel/ppc-stub.c Mon Aug 25 11:39:55 2003
7854@@ -106,6 +106,7 @@
7855 #include <linux/smp.h>
7856 #include <linux/smp_lock.h>
7857
7858+#include <asm/cacheflush.h>
7859 #include <asm/system.h>
7860 #include <asm/signal.h>
7861 #include <asm/kgdb.h>
7862@@ -136,7 +137,7 @@
7863 /* typedef void (*trapfunc_t)(void); */
7864
7865 static void kgdb_fault_handler(struct pt_regs *regs);
7866-static void handle_exception (struct pt_regs *regs);
7867+static int handle_exception (struct pt_regs *regs);
7868
7869 #if 0
7870 /* Install an exception handler for kgdb */
7871@@ -186,7 +187,7 @@
7872 * return 0.
7873 */
7874 static unsigned char *
7875-mem2hex(char *mem, char *buf, int count)
7876+mem2hex(const char *mem, char *buf, int count)
7877 {
7878 unsigned char ch;
7879 unsigned short tmp_s;
7880@@ -460,14 +461,12 @@
7881
7882 int kgdb_bpt(struct pt_regs *regs)
7883 {
7884- handle_exception(regs);
7885- return 1;
7886+ return handle_exception(regs);
7887 }
7888
7889 int kgdb_sstep(struct pt_regs *regs)
7890 {
7891- handle_exception(regs);
7892- return 1;
7893+ return handle_exception(regs);
7894 }
7895
7896 void kgdb(struct pt_regs *regs)
7897@@ -477,16 +476,14 @@
7898
7899 int kgdb_iabr_match(struct pt_regs *regs)
7900 {
7901- printk("kgdb doesn't support iabr, what?!?\n");
7902- handle_exception(regs);
7903- return 1;
7904+ printk(KERN_ERR "kgdb doesn't support iabr, what?!?\n");
7905+ return handle_exception(regs);
7906 }
7907
7908 int kgdb_dabr_match(struct pt_regs *regs)
7909 {
7910- printk("kgdb doesn't support dabr, what?!?\n");
7911- handle_exception(regs);
7912- return 1;
7913+ printk(KERN_ERR "kgdb doesn't support dabr, what?!?\n");
7914+ return handle_exception(regs);
7915 }
7916
7917 /* Convert the hardware trap type code to a unix signal number. */
7918@@ -559,7 +556,7 @@
7919 /*
7920 * This function does all command processing for interfacing to gdb.
7921 */
7922-static void
7923+static int
7924 handle_exception (struct pt_regs *regs)
7925 {
7926 int sigval;
7927@@ -568,14 +565,19 @@
7928 char *ptr;
7929 unsigned int msr;
7930
7931+ /* We don't handle user-mode breakpoints. */
7932+ if (user_mode(regs))
7933+ return 0;
7934+
7935 if (debugger_fault_handler) {
7936 debugger_fault_handler(regs);
7937 panic("kgdb longjump failed!\n");
7938 }
7939 if (kgdb_active) {
7940- printk("interrupt while in kgdb, returning\n");
7941- return;
7942+ printk(KERN_ERR "interrupt while in kgdb, returning\n");
7943+ return 0;
7944 }
7945+
7946 kgdb_active = 1;
7947 kgdb_started = 1;
7948
7949@@ -783,7 +785,7 @@
7950 printk("remcomInBuffer: %s\n", remcomInBuffer);
7951 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
7952 }
7953- return;
7954+ return 1;
7955
7956 case 's':
7957 kgdb_flush_cache_all();
7958@@ -800,7 +802,7 @@
7959 printk("remcomInBuffer: %s\n", remcomInBuffer);
7960 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
7961 }
7962- return;
7963+ return 1;
7964
7965 case 'r': /* Reset (if user process..exit ???)*/
7966 panic("kgdb reset.");
7967@@ -828,11 +830,11 @@
7968 return;
7969 }
7970
7971- asm(" .globl breakinst
7972- breakinst: .long 0x7d821008
7973- ");
7974+ asm(" .globl breakinst \n\
7975+ breakinst: .long 0x7d821008");
7976 }
7977
7978+#ifdef CONFIG_KGDB_CONSOLE
7979 /* Output string in GDB O-packet format if GDB has connected. If nothing
7980 output, returns 0 (caller must then handle output). */
7981 int
7982@@ -852,3 +854,4 @@
7983
7984 return 1;
7985 }
7986+#endif
7987diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
7988--- a/arch/ppc/kernel/ppc_ksyms.c Tue Jul 1 10:57:22 2003
7989+++ b/arch/ppc/kernel/ppc_ksyms.c Sun Aug 24 03:57:52 2003
7990@@ -200,6 +200,7 @@
7991 EXPORT_SYMBOL(flush_icache_user_range);
7992 EXPORT_SYMBOL(flush_dcache_page);
7993 EXPORT_SYMBOL(flush_tlb_kernel_range);
7994+EXPORT_SYMBOL(flush_tlb_page);
7995 #ifdef CONFIG_ALTIVEC
7996 EXPORT_SYMBOL(last_task_used_altivec);
7997 EXPORT_SYMBOL(giveup_altivec);
7998@@ -259,6 +260,15 @@
7999 EXPORT_SYMBOL(pci_busdev_to_OF_node);
8000 EXPORT_SYMBOL(pci_device_to_OF_node);
8001 EXPORT_SYMBOL(pci_device_from_OF_node);
8002+EXPORT_SYMBOL(of_find_node_by_name);
8003+EXPORT_SYMBOL(of_find_node_by_type);
8004+EXPORT_SYMBOL(of_find_compatible_node);
8005+EXPORT_SYMBOL(of_find_node_by_path);
8006+EXPORT_SYMBOL(of_find_all_nodes);
8007+EXPORT_SYMBOL(of_get_parent);
8008+EXPORT_SYMBOL(of_get_next_child);
8009+EXPORT_SYMBOL(of_node_get);
8010+EXPORT_SYMBOL(of_node_put);
8011 #endif /* CONFIG_PPC_OF */
8012 #if defined(CONFIG_BOOTX_TEXT)
8013 EXPORT_SYMBOL(btext_update_display);
8014diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
8015--- a/arch/ppc/kernel/setup.c Mon Aug 18 19:46:23 2003
8016+++ b/arch/ppc/kernel/setup.c Mon Aug 25 11:11:43 2003
8017@@ -624,12 +624,10 @@
8018 #if defined(CONFIG_KGDB)
8019 kgdb_map_scc();
8020 set_debug_traps();
8021- if (strstr(cmd_line, "nokgdb"))
8022- printk("kgdb default breakpoint deactivated on command line\n");
8023- else {
8024+ if (strstr(cmd_line, "gdb")) {
8025 if (ppc_md.progress)
8026 ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
8027- printk("kgdb default breakpoint activated\n");
8028+ printk("kgdb breakpoint activated\n");
8029 breakpoint();
8030 }
8031 #endif
8032diff -Nru a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
8033--- a/arch/ppc/kernel/smp.c Mon Aug 18 19:46:23 2003
8034+++ b/arch/ppc/kernel/smp.c Fri Aug 22 19:58:08 2003
8035@@ -47,8 +47,8 @@
8036 DEFINE_PER_CPU(unsigned int, prof_multiplier);
8037 DEFINE_PER_CPU(unsigned int, prof_counter);
8038 unsigned long cache_decay_ticks = HZ/100;
8039-unsigned long cpu_online_map = cpumask_of_cpu(0);
8040-unsigned long cpu_possible_map = 1UL;
8041+cpumask_t cpu_online_map;
8042+cpumask_t cpu_possible_map;
8043 int smp_hw_index[NR_CPUS];
8044 struct thread_info *secondary_ti;
8045
8046@@ -336,7 +336,7 @@
8047
8048 void __init smp_prepare_cpus(unsigned int max_cpus)
8049 {
8050- int num_cpus;
8051+ int num_cpus, i;
8052
8053 /* Fixup boot cpu */
8054 smp_store_cpu_info(smp_processor_id());
8055@@ -350,7 +350,8 @@
8056
8057 /* Probe platform for CPUs: always linear. */
8058 num_cpus = smp_ops->probe();
8059- cpu_possible_map = (1 << num_cpus)-1;
8060+ for (i = 0; i < num_cpus; ++i)
8061+ cpu_set(i, cpu_possible_map);
8062
8063 /* Backup CPU 0 state */
8064 __save_cpu_setup();
8065diff -Nru a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
8066--- a/arch/ppc/kernel/syscalls.c Tue Jul 15 04:49:49 2003
8067+++ b/arch/ppc/kernel/syscalls.c Fri Aug 22 19:15:18 2003
8068@@ -262,4 +262,14 @@
8069 return error;
8070 }
8071
8072+/*
8073+ * We put the arguments in a different order so we only use 6
8074+ * registers for arguments, rather than 7 as sys_fadvise64_64 needs
8075+ * (because `offset' goes in r5/r6).
8076+ */
8077+long ppc_fadvise64_64(int fd, int advice, loff_t offset, loff_t len)
8078+{
8079+ return sys_fadvise64_64(fd, offset, len, advice);
8080+}
8081+
8082 cond_syscall(sys_pciconfig_iobase);
8083diff -Nru a/arch/ppc/platforms/mcpn765_serial.h b/arch/ppc/platforms/mcpn765_serial.h
8084--- a/arch/ppc/platforms/mcpn765_serial.h Tue Feb 11 15:48:53 2003
8085+++ b/arch/ppc/platforms/mcpn765_serial.h Mon Jul 21 09:05:22 2003
8086@@ -30,7 +30,8 @@
8087 #endif
8088
8089 /* Rate for the 1.8432 Mhz clock for the onboard serial chip */
8090-#define BASE_BAUD ( 1843200 / 16 )
8091+#define BASE_BAUD ( 1843200 / 16 )
8092+#define UART_CLK 1843200
8093
8094 #ifdef CONFIG_SERIAL_DETECT_IRQ
8095 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
8096diff -Nru a/arch/ppc/platforms/mcpn765_setup.c b/arch/ppc/platforms/mcpn765_setup.c
8097--- a/arch/ppc/platforms/mcpn765_setup.c Wed Apr 23 00:49:34 2003
8098+++ b/arch/ppc/platforms/mcpn765_setup.c Mon Jul 21 09:05:22 2003
8099@@ -31,6 +31,9 @@
8100 #include <linux/ide.h>
8101 #include <linux/seq_file.h>
8102 #include <linux/root_dev.h>
8103+#include <linux/serial.h>
8104+#include <linux/tty.h> /* for linux/serial_core.h */
8105+#include <linux/serial_core.h>
8106
8107 #include <asm/system.h>
8108 #include <asm/pgtable.h>
8109@@ -49,36 +52,94 @@
8110 #include <asm/pplus.h>
8111
8112 #include "mcpn765.h"
8113+#include "mcpn765_serial.h"
8114+
8115
8116 static u_char mcpn765_openpic_initsenses[] __initdata = {
8117- 0, /* 16: i8259 cascade (active high) */
8118- 1, /* 17: COM1,2,3,4 */
8119- 1, /* 18: Enet 1 (front panel) */
8120- 1, /* 19: HAWK WDT XXXX */
8121- 1, /* 20: 21554 PCI-PCI bridge */
8122- 1, /* 21: cPCI INTA# */
8123- 1, /* 22: cPCI INTB# */
8124- 1, /* 23: cPCI INTC# */
8125- 1, /* 24: cPCI INTD# */
8126- 1, /* 25: PMC1 INTA#, PMC2 INTB# */
8127- 1, /* 26: PMC1 INTB#, PMC2 INTC# */
8128- 1, /* 27: PMC1 INTC#, PMC2 INTD# */
8129- 1, /* 28: PMC1 INTD#, PMC2 INTA# */
8130- 1, /* 29: Enet 2 (connected to J3) */
8131- 1, /* 30: Abort Switch */
8132- 1, /* 31: RTC Alarm */
8133+ (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE),/* 16: i8259 cascade */
8134+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 17: COM1,2,3,4 */
8135+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 18: Enet 1 (front) */
8136+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 19: HAWK WDT XXXX */
8137+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 20: 21554 bridge */
8138+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 21: cPCI INTA# */
8139+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 22: cPCI INTB# */
8140+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 23: cPCI INTC# */
8141+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 24: cPCI INTD# */
8142+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 25: PMC1 INTA#,PMC2 INTB#*/
8143+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 26: PMC1 INTB#,PMC2 INTC#*/
8144+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 27: PMC1 INTC#,PMC2 INTD#*/
8145+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 28: PMC1 INTD#,PMC2 INTA#*/
8146+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 29: Enet 2 (J3) */
8147+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 30: Abort Switch */
8148+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 31: RTC Alarm */
8149 };
8150
8151
8152 extern u_int openpic_irq(void);
8153 extern char cmd_line[];
8154
8155+extern void gen550_progress(char *, unsigned short);
8156+extern void gen550_init(int, struct uart_port *);
8157+
8158 int use_of_interrupt_tree = 0;
8159
8160 static void mcpn765_halt(void);
8161
8162 TODC_ALLOC();
8163
8164+#if defined(CONFIG_SERIAL_8250) && \
8165+ (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG))
8166+static void __init
8167+mcpn765_early_serial_map(void)
8168+{
8169+ struct uart_port serial_req;
8170+
8171+ /* Setup serial port access */
8172+ memset(&serial_req, 0, sizeof(serial_req));
8173+ serial_req.uartclk = UART_CLK;
8174+ serial_req.irq = 17;
8175+ serial_req.flags = STD_COM_FLAGS;
8176+ serial_req.iotype = SERIAL_IO_MEM;
8177+ serial_req.membase = (u_char *)MCPN765_SERIAL_1;
8178+ serial_req.regshift = 4;
8179+
8180+ gen550_init(0, &serial_req);
8181+
8182+ if (early_serial_setup(&serial_req) != 0)
8183+ printk(KERN_ERR "Early serial init of port 0 failed\n");
8184+
8185+ /* Assume early_serial_setup() doesn't modify serial_req */
8186+ serial_req.line = 1;
8187+ serial_req.irq = 17;
8188+ serial_req.membase = (u_char *)MCPN765_SERIAL_2;
8189+
8190+ gen550_init(1, &serial_req);
8191+
8192+ if (early_serial_setup(&serial_req) != 0)
8193+ printk(KERN_ERR "Early serial init of port 1 failed\n");
8194+
8195+ /* Assume early_serial_setup() doesn't modify serial_req */
8196+ serial_req.line = 2;
8197+ serial_req.irq = 17;
8198+ serial_req.membase = (u_char *)MCPN765_SERIAL_3;
8199+
8200+ gen550_init(2, &serial_req);
8201+
8202+ if (early_serial_setup(&serial_req) != 0)
8203+ printk(KERN_ERR "Early serial init of port 2 failed\n");
8204+
8205+ /* Assume early_serial_setup() doesn't modify serial_req */
8206+ serial_req.line = 3;
8207+ serial_req.irq = 17;
8208+ serial_req.membase = (u_char *)MCPN765_SERIAL_4;
8209+
8210+ gen550_init(3, &serial_req);
8211+
8212+ if (early_serial_setup(&serial_req) != 0)
8213+ printk(KERN_ERR "Early serial init of port 3 failed\n");
8214+}
8215+#endif
8216+
8217 static void __init
8218 mcpn765_setup_arch(void)
8219 {
8220@@ -187,12 +248,12 @@
8221 if ( ppc_md.progress )
8222 ppc_md.progress("init_irq: enter", 0);
8223
8224- openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1);
8225+ openpic_init(NUM_8259_INTERRUPTS);
8226
8227 for(i=0; i < NUM_8259_INTERRUPTS; i++)
8228 irq_desc[i].handler = &i8259_pic;
8229
8230- i8259_init(NULL);
8231+ i8259_init(0);
8232
8233 if ( ppc_md.progress )
8234 ppc_md.progress("init_irq: exit", 0);
8235@@ -361,65 +422,15 @@
8236 static __inline__ void
8237 mcpn765_set_bat(void)
8238 {
8239- unsigned long bat3u, bat3l;
8240- static int mapping_set = 0;
8241-
8242- if (!mapping_set) {
8243-
8244- __asm__ __volatile__(
8245- " lis %0,0xf000\n \
8246- ori %1,%0,0x002a\n \
8247- ori %0,%0,0x1ffe\n \
8248- mtspr 0x21e,%0\n \
8249- mtspr 0x21f,%1\n \
8250- isync\n \
8251- sync "
8252- : "=r" (bat3u), "=r" (bat3l));
8253-
8254- mapping_set = 1;
8255- }
8256-
8257- return;
8258-}
8259-
8260-#ifdef CONFIG_SERIAL_TEXT_DEBUG
8261-#include <linux/serialP.h>
8262-#include <linux/serial_reg.h>
8263-#include <asm/serial.h>
8264-
8265-static struct serial_state rs_table[RS_TABLE_SIZE] = {
8266- SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
8267-};
8268-
8269-static void
8270-mcpn765_progress(char *s, unsigned short hex)
8271-{
8272- volatile char c;
8273- volatile unsigned long com_port;
8274- u16 shift;
8275-
8276- com_port = rs_table[0].port;
8277- shift = rs_table[0].iomem_reg_shift;
8278-
8279- while ((c = *s++) != 0) {
8280- while ((*((volatile unsigned char *)com_port +
8281- (UART_LSR << shift)) & UART_LSR_THRE) == 0)
8282- ;
8283- *(volatile unsigned char *)com_port = c;
8284-
8285- if (c == '\n') {
8286- while ((*((volatile unsigned char *)com_port +
8287- (UART_LSR << shift)) & UART_LSR_THRE) == 0)
8288- ;
8289- *(volatile unsigned char *)com_port = '\r';
8290- }
8291- }
8292+ mb();
8293+ mtspr(DBAT1U, 0xfe8000fe);
8294+ mtspr(DBAT1L, 0xfe80002a);
8295+ mb();
8296 }
8297-#endif /* CONFIG_SERIAL_TEXT_DEBUG */
8298
8299 void __init
8300 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
8301- unsigned long r6, unsigned long r7)
8302+ unsigned long r6, unsigned long r7)
8303 {
8304 parse_bootinfo(find_bootinfo());
8305
8306@@ -458,11 +469,13 @@
8307 ppc_md.heartbeat_reset = 0;
8308 ppc_md.heartbeat_count = 0;
8309
8310-#ifdef CONFIG_SERIAL_TEXT_DEBUG
8311- ppc_md.progress = mcpn765_progress;
8312-#else /* !CONFIG_SERIAL_TEXT_DEBUG */
8313- ppc_md.progress = NULL;
8314-#endif /* CONFIG_SERIAL_TEXT_DEBUG */
8315+#if defined(CONFIG_SERIAL_8250) && \
8316+ (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG))
8317+ mcpn765_early_serial_map();
8318+#ifdef CONFIG_SERIAL_TEXT_DEBUG
8319+ ppc_md.progress = gen550_progress;
8320+#endif
8321+#endif
8322
8323 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
8324 ppc_ide_md.default_irq = mcpn765_ide_default_irq;
8325diff -Nru a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
8326--- a/arch/ppc/platforms/pmac_cpufreq.c Wed Jul 23 17:04:23 2003
8327+++ b/arch/ppc/platforms/pmac_cpufreq.c Mon Aug 25 09:51:43 2003
8328@@ -21,6 +21,7 @@
8329 #include <linux/slab.h>
8330 #include <linux/cpufreq.h>
8331 #include <linux/init.h>
8332+#include <linux/sysdev.h>
8333 #include <asm/prom.h>
8334 #include <asm/machdep.h>
8335 #include <asm/irq.h>
8336@@ -31,12 +32,16 @@
8337 #include <asm/cputable.h>
8338 #include <asm/time.h>
8339
8340+/* WARNING !!! This will cause calibrate_delay() to be called,
8341+ * but this is an __init function ! So you MUST go edit
8342+ * init/main.c to make it non-init before enabling DEBUG_FREQ
8343+ */
8344 #undef DEBUG_FREQ
8345
8346 extern void low_choose_750fx_pll(int pll);
8347 extern void low_sleep_handler(void);
8348-extern void openpic_sleep_save_intrs(void);
8349-extern void openpic_sleep_restore_intrs(void);
8350+extern void openpic_suspend(struct sys_device *sysdev, u32 state);
8351+extern void openpic_resume(struct sys_device *sysdev);
8352 extern void enable_kernel_altivec(void);
8353 extern void enable_kernel_fp(void);
8354
8355@@ -116,10 +121,7 @@
8356 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
8357 #endif
8358 /* Disable all interrupt sources on openpic */
8359- openpic_sleep_save_intrs();
8360-
8361- /* Make sure the PMU is idle */
8362- pmu_suspend();
8363+ openpic_suspend(NULL, 1);
8364
8365 /* Make sure the decrementer won't interrupt us */
8366 asm volatile("mtdec %0" : : "r" (0x7fffffff));
8367@@ -153,11 +155,16 @@
8368 pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed);
8369 while (!req.complete)
8370 pmu_poll();
8371-
8372- pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
8373
8374+ /* Prepare the northbridge for the speed transition */
8375+ pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
8376+
8377+ /* Call low level code to backup CPU state and recover from
8378+ * hardware reset
8379+ */
8380 low_sleep_handler();
8381
8382+ /* Restore the northbridge */
8383 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0);
8384
8385 /* Restore L2 cache */
8386@@ -174,13 +181,14 @@
8387 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
8388 #endif
8389
8390+ /* Restore low level PMU operations */
8391+ pmu_unlock();
8392+
8393 /* Restore decrementer */
8394 wakeup_decrementer();
8395
8396 /* Restore interrupts */
8397- openpic_sleep_restore_intrs();
8398-
8399- pmu_resume();
8400+ openpic_resume(NULL);
8401
8402 /* Let interrupts flow again ... */
8403 local_irq_enable();
8404@@ -195,13 +203,16 @@
8405 static int __pmac
8406 do_set_cpu_speed(int speed_mode)
8407 {
8408- struct cpufreq_freqs freqs;
8409+ struct cpufreq_freqs freqs;
8410 int rc;
8411
8412 freqs.old = cur_freq;
8413 freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq;
8414 freqs.cpu = smp_processor_id();
8415
8416+ if (freqs.old == freqs.new)
8417+ return 0;
8418+
8419 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
8420 if (cpufreq_uses_pmu)
8421 rc = pmu_set_cpu_speed(speed_mode);
8422@@ -275,7 +286,10 @@
8423 struct device_node *cpunode;
8424 u32 *value;
8425 int has_freq_ctl = 0;
8426-
8427+
8428+ if (strstr(cmd_line, "nocpufreq"))
8429+ return 0;
8430+
8431 /* Assume only one CPU */
8432 cpunode = find_type_devices("cpu");
8433 if (!cpunode)
8434diff -Nru a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
8435--- a/arch/ppc/platforms/pmac_pic.c Wed Apr 30 05:41:43 2003
8436+++ b/arch/ppc/platforms/pmac_pic.c Sun Aug 24 04:12:57 2003
8437@@ -22,6 +22,9 @@
8438 #include <linux/signal.h>
8439 #include <linux/pci.h>
8440 #include <linux/interrupt.h>
8441+#include <linux/sysdev.h>
8442+#include <linux/adb.h>
8443+#include <linux/pmu.h>
8444
8445 #include <asm/sections.h>
8446 #include <asm/io.h>
8447@@ -506,7 +509,7 @@
8448 #endif /* CONFIG_XMON */
8449 }
8450
8451-#ifdef CONFIG_PMAC_PBOOK
8452+#ifdef CONFIG_PM
8453 /*
8454 * These procedures are used in implementing sleep on the powerbooks.
8455 * sleep_save_intrs() saves the states of all interrupt enables
8456@@ -515,9 +518,32 @@
8457 */
8458 unsigned long sleep_save_mask[2];
8459
8460-void __pmac
8461-pmac_sleep_save_intrs(int viaint)
8462+/* This used to be passed by the PMU driver but that link got
8463+ * broken with the new driver model. We use this tweak for now...
8464+ */
8465+static int pmacpic_find_viaint(void)
8466 {
8467+ int viaint = -1;
8468+
8469+#ifdef CONFIG_ADB_PMU
8470+ struct device_node *np;
8471+
8472+ if (pmu_get_model() != PMU_OHARE_BASED)
8473+ goto not_found;
8474+ np = of_find_node_by_name(NULL, "via-pmu");
8475+ if (np == NULL)
8476+ goto not_found;
8477+ viaint = np->intrs[0].line;
8478+#endif /* CONFIG_ADB_PMU */
8479+
8480+not_found:
8481+ return viaint;
8482+}
8483+
8484+static int pmacpic_suspend(struct sys_device *sysdev, u32 state)
8485+{
8486+ int viaint = pmacpic_find_viaint();
8487+
8488 sleep_save_mask[0] = ppc_cached_irq_mask[0];
8489 sleep_save_mask[1] = ppc_cached_irq_mask[1];
8490 ppc_cached_irq_mask[0] = 0;
8491@@ -531,10 +557,11 @@
8492 /* make sure mask gets to controller before we return to caller */
8493 mb();
8494 (void)in_le32(&pmac_irq_hw[0]->enable);
8495+
8496+ return 0;
8497 }
8498
8499-void __pmac
8500-pmac_sleep_restore_intrs(void)
8501+static int pmacpic_resume(struct sys_device *sysdev)
8502 {
8503 int i;
8504
8505@@ -545,5 +572,39 @@
8506 for (i = 0; i < max_real_irqs; ++i)
8507 if (test_bit(i, sleep_save_mask))
8508 pmac_unmask_irq(i);
8509+
8510+ return 0;
8511 }
8512-#endif /* CONFIG_PMAC_PBOOK */
8513+
8514+#endif /* CONFIG_PM */
8515+
8516+static struct sysdev_class pmacpic_sysclass = {
8517+ set_kset_name("pmac_pic"),
8518+};
8519+
8520+static struct sys_device device_pmacpic = {
8521+ .id = 0,
8522+ .cls = &pmacpic_sysclass,
8523+};
8524+
8525+static struct sysdev_driver driver_pmacpic = {
8526+#ifdef CONFIG_PM
8527+ .suspend = &pmacpic_suspend,
8528+ .resume = &pmacpic_resume,
8529+#endif /* CONFIG_PM */
8530+};
8531+
8532+static int __init init_pmacpic_sysfs(void)
8533+{
8534+ if (max_irqs == 0)
8535+ return -ENODEV;
8536+
8537+ printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
8538+ sysdev_class_register(&pmacpic_sysclass);
8539+ sys_device_register(&device_pmacpic);
8540+ sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
8541+ return 0;
8542+}
8543+
8544+subsys_initcall(init_pmacpic_sysfs);
8545+
8546diff -Nru a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
8547--- a/arch/ppc/platforms/sandpoint.c Tue Jul 1 10:56:46 2003
8548+++ b/arch/ppc/platforms/sandpoint.c Thu Aug 21 10:19:10 2003
8549@@ -357,6 +357,21 @@
8550 }
8551
8552 /*
8553+ * Fix IDE interrupts.
8554+ */
8555+static int __init
8556+sandpoint_fix_winbond_83553(void)
8557+{
8558+ /* Make all 8259 interrupt level sensitive */
8559+ outb(0xf8, 0x4d0);
8560+ outb(0xde, 0x4d1);
8561+
8562+ return 0;
8563+}
8564+
8565+arch_initcall(sandpoint_fix_winbond_83553);
8566+
8567+/*
8568 * Initialize the ISA devices on the Nat'l PC87308VUL SuperIO chip.
8569 */
8570 static int __init
8571@@ -390,21 +405,6 @@
8572 }
8573
8574 arch_initcall(sandpoint_setup_natl_87308);
8575-
8576-/*
8577- * Fix IDE interrupts.
8578- */
8579-static int __init
8580-sandpoint_fix_winbond_83553(void)
8581-{
8582- /* Make all 8259 interrupt level sensitive */
8583- outb(0xf8, 0x4d0);
8584- outb(0xde, 0x4d1);
8585-
8586- return 0;
8587-}
8588-
8589-arch_initcall(sandpoint_fix_winbond_83553);
8590
8591 static int __init
8592 sandpoint_request_io(void)
8593diff -Nru a/arch/ppc/platforms/sandpoint.h b/arch/ppc/platforms/sandpoint.h
8594--- a/arch/ppc/platforms/sandpoint.h Tue Jul 1 10:56:46 2003
8595+++ b/arch/ppc/platforms/sandpoint.h Thu Aug 21 10:19:10 2003
8596@@ -61,9 +61,9 @@
8597 #define UART_CLK 1843200
8598
8599 #ifdef CONFIG_SERIAL_DETECT_IRQ
8600-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
8601+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
8602 #else
8603-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
8604+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
8605 #endif
8606
8607 #define STD_SERIAL_PORT_DFNS \
8608diff -Nru a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
8609--- a/arch/ppc/syslib/of_device.c Sat Aug 16 11:48:20 2003
8610+++ b/arch/ppc/syslib/of_device.c Tue Aug 26 06:35:38 2003
8611@@ -15,8 +15,8 @@
8612 * Used by a driver to check whether an of_device present in the
8613 * system is in its list of supported devices.
8614 */
8615-const struct of_match *
8616-of_match_device(const struct of_match *matches, const struct of_device *dev)
8617+const struct of_match * of_match_device(const struct of_match *matches,
8618+ const struct of_device *dev)
8619 {
8620 if (!dev->node)
8621 return NULL;
8622@@ -38,8 +38,7 @@
8623 return NULL;
8624 }
8625
8626-static int
8627-of_platform_bus_match(struct device *dev, struct device_driver *drv)
8628+static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
8629 {
8630 struct of_device * of_dev = to_of_device(dev);
8631 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
8632@@ -51,21 +50,27 @@
8633 return of_match_device(matches, of_dev) != NULL;
8634 }
8635
8636-struct bus_type of_platform_bus_type = {
8637- name: "of_platform",
8638- match: of_platform_bus_match,
8639-};
8640+struct of_device *of_dev_get(struct of_device *dev)
8641+{
8642+ struct device *tmp;
8643+
8644+ if (!dev)
8645+ return NULL;
8646+ tmp = get_device(&dev->dev);
8647+ if (tmp)
8648+ return to_of_device(tmp);
8649+ else
8650+ return NULL;
8651+}
8652
8653-static int __init
8654-of_bus_driver_init(void)
8655+void of_dev_put(struct of_device *dev)
8656 {
8657- return bus_register(&of_platform_bus_type);
8658+ if (dev)
8659+ put_device(&dev->dev);
8660 }
8661
8662-postcore_initcall(of_bus_driver_init);
8663
8664-static int
8665-of_device_probe(struct device *dev)
8666+static int of_device_probe(struct device *dev)
8667 {
8668 int error = -ENODEV;
8669 struct of_platform_driver *drv;
8670@@ -78,22 +83,18 @@
8671 if (!drv->probe)
8672 return error;
8673
8674-/* if (!try_module_get(driver->owner)) {
8675- printk(KERN_ERR "Can't get a module reference for %s\n", driver->name);
8676- return error;
8677- }
8678-*/
8679+ of_dev_get(of_dev);
8680+
8681 match = of_match_device(drv->match_table, of_dev);
8682 if (match)
8683 error = drv->probe(of_dev, match);
8684-/*
8685- module_put(driver->owner);
8686-*/
8687+ if (error)
8688+ of_dev_put(of_dev);
8689+
8690 return error;
8691 }
8692
8693-static int
8694-of_device_remove(struct device *dev)
8695+static int of_device_remove(struct device *dev)
8696 {
8697 struct of_device * of_dev = to_of_device(dev);
8698 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8699@@ -103,32 +104,43 @@
8700 return 0;
8701 }
8702
8703-static int
8704-of_device_suspend(struct device *dev, u32 state, u32 level)
8705+static int of_device_suspend(struct device *dev, u32 state)
8706 {
8707 struct of_device * of_dev = to_of_device(dev);
8708 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8709 int error = 0;
8710
8711 if (drv && drv->suspend)
8712- error = drv->suspend(of_dev, state, level);
8713+ error = drv->suspend(of_dev, state);
8714 return error;
8715 }
8716
8717-static int
8718-of_device_resume(struct device * dev, u32 level)
8719+static int of_device_resume(struct device * dev)
8720 {
8721 struct of_device * of_dev = to_of_device(dev);
8722 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8723 int error = 0;
8724
8725 if (drv && drv->resume)
8726- error = drv->resume(of_dev, level);
8727+ error = drv->resume(of_dev);
8728 return error;
8729 }
8730
8731-int
8732-of_register_driver(struct of_platform_driver *drv)
8733+struct bus_type of_platform_bus_type = {
8734+ .name = "of_platform",
8735+ .match = of_platform_bus_match,
8736+ .suspend = of_device_suspend,
8737+ .resume = of_device_resume,
8738+};
8739+
8740+static int __init of_bus_driver_init(void)
8741+{
8742+ return bus_register(&of_platform_bus_type);
8743+}
8744+
8745+postcore_initcall(of_bus_driver_init);
8746+
8747+int of_register_driver(struct of_platform_driver *drv)
8748 {
8749 int count = 0;
8750
8751@@ -136,8 +148,6 @@
8752 drv->driver.name = drv->name;
8753 drv->driver.bus = &of_platform_bus_type;
8754 drv->driver.probe = of_device_probe;
8755- drv->driver.resume = of_device_resume;
8756- drv->driver.suspend = of_device_suspend;
8757 drv->driver.remove = of_device_remove;
8758
8759 /* register with core */
8760@@ -145,15 +155,13 @@
8761 return count ? count : 1;
8762 }
8763
8764-void
8765-of_unregister_driver(struct of_platform_driver *drv)
8766+void of_unregister_driver(struct of_platform_driver *drv)
8767 {
8768 driver_unregister(&drv->driver);
8769 }
8770
8771
8772-static ssize_t
8773-dev_show_devspec(struct device *dev, char *buf)
8774+static ssize_t dev_show_devspec(struct device *dev, char *buf)
8775 {
8776 struct of_device *ofdev;
8777
8778@@ -163,8 +171,22 @@
8779
8780 static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
8781
8782-int
8783-of_device_register(struct of_device *ofdev)
8784+/**
8785+ * of_release_dev - free an of device structure when all users of it are finished.
8786+ * @dev: device that's been disconnected
8787+ *
8788+ * Will be called only by the device core when all users of this of device are
8789+ * done.
8790+ */
8791+void of_release_dev(struct device *dev)
8792+{
8793+ struct of_device *ofdev;
8794+
8795+ ofdev = to_of_device(dev);
8796+ kfree(ofdev);
8797+}
8798+
8799+int of_device_register(struct of_device *ofdev)
8800 {
8801 int rc;
8802 struct of_device **odprop;
8803@@ -197,21 +219,20 @@
8804 return 0;
8805 }
8806
8807-void
8808-of_device_unregister(struct of_device *ofdev)
8809+void of_device_unregister(struct of_device *ofdev)
8810 {
8811 struct of_device **odprop;
8812
8813 device_remove_file(&ofdev->dev, &dev_attr_devspec);
8814- device_unregister(&ofdev->dev);
8815
8816 odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
8817 if (odprop)
8818 *odprop = NULL;
8819+
8820+ device_unregister(&ofdev->dev);
8821 }
8822
8823-struct of_device*
8824-of_platform_device_create(struct device_node *np, const char *bus_id)
8825+struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id)
8826 {
8827 struct of_device *dev;
8828 u32 *reg;
8829@@ -226,6 +247,7 @@
8830 dev->dev.dma_mask = &dev->dma_mask;
8831 dev->dev.parent = NULL;
8832 dev->dev.bus = &of_platform_bus_type;
8833+ dev->dev.release = of_release_dev;
8834
8835 reg = (u32 *)get_property(np, "reg", NULL);
8836 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
8837@@ -244,4 +266,7 @@
8838 EXPORT_SYMBOL(of_unregister_driver);
8839 EXPORT_SYMBOL(of_device_register);
8840 EXPORT_SYMBOL(of_device_unregister);
8841+EXPORT_SYMBOL(of_dev_get);
8842+EXPORT_SYMBOL(of_dev_put);
8843 EXPORT_SYMBOL(of_platform_device_create);
8844+EXPORT_SYMBOL(of_release_dev);
8845diff -Nru a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
8846--- a/arch/ppc/syslib/open_pic.c Tue Jul 15 10:01:29 2003
8847+++ b/arch/ppc/syslib/open_pic.c Sun Aug 24 04:11:21 2003
8848@@ -15,6 +15,7 @@
8849 #include <linux/init.h>
8850 #include <linux/irq.h>
8851 #include <linux/interrupt.h>
8852+#include <linux/sysdev.h>
8853 #include <asm/ptrace.h>
8854 #include <asm/signal.h>
8855 #include <asm/io.h>
8856@@ -276,7 +277,7 @@
8857 }
8858 #endif
8859
8860-#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PMAC_PBOOK)
8861+#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PM)
8862 static void openpic_reset(void)
8863 {
8864 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
8865@@ -532,7 +533,7 @@
8866 openpic_write(&OpenPIC->Global.Processor_Initialization, mask);
8867 }
8868
8869-#if defined(CONFIG_SMP) || defined(CONFIG_PMAC_PBOOK)
8870+#if defined(CONFIG_SMP) || defined(CONFIG_PM)
8871 static spinlock_t openpic_setup_lock = SPIN_LOCK_UNLOCKED;
8872 #endif
8873
8874@@ -864,20 +865,55 @@
8875 }
8876 #endif /* CONFIG_SMP */
8877
8878-#ifdef CONFIG_PMAC_PBOOK
8879+#ifdef CONFIG_PM
8880+
8881+/*
8882+ * We implement the IRQ controller as a sysdev and put it
8883+ * to sleep at powerdown stage (the callback is named suspend,
8884+ * but it's old semantics, for the Device Model, it's really
8885+ * powerdown). The possible problem is that another sysdev that
8886+ * happens to be suspend after this one will have interrupts off,
8887+ * that may be an issue... For now, this isn't an issue on pmac
8888+ * though...
8889+ */
8890+
8891 static u32 save_ipi_vp[OPENPIC_NUM_IPI];
8892 static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
8893 static u32 save_irq_src_dest[OPENPIC_MAX_SOURCES];
8894 static u32 save_cpu_task_pri[OPENPIC_MAX_PROCESSORS];
8895+static int openpic_suspend_count;
8896+
8897+static void openpic_cached_enable_irq(u_int irq)
8898+{
8899+ check_arg_irq(irq);
8900+ save_irq_src_vp[irq - open_pic_irq_offset] &= ~OPENPIC_MASK;
8901+}
8902
8903-void __pmac
8904-openpic_sleep_save_intrs(void)
8905+static void openpic_cached_disable_irq(u_int irq)
8906+{
8907+ check_arg_irq(irq);
8908+ save_irq_src_vp[irq - open_pic_irq_offset] |= OPENPIC_MASK;
8909+}
8910+
8911+/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
8912+ * we need something better to deal with that... Maybe switch to S1 for
8913+ * cpufreq changes
8914+ */
8915+int openpic_suspend(struct sys_device *sysdev, u32 state)
8916 {
8917 int i;
8918 unsigned long flags;
8919
8920 spin_lock_irqsave(&openpic_setup_lock, flags);
8921
8922+ if (openpic_suspend_count++ > 0) {
8923+ spin_unlock_irqrestore(&openpic_setup_lock, flags);
8924+ return 0;
8925+ }
8926+
8927+ open_pic.enable = openpic_cached_enable_irq;
8928+ open_pic.disable = openpic_cached_disable_irq;
8929+
8930 for (i=0; i<NumProcessors; i++) {
8931 save_cpu_task_pri[i] = openpic_read(&OpenPIC->Processor[i].Current_Task_Priority);
8932 openpic_writefield(&OpenPIC->Processor[i].Current_Task_Priority,
8933@@ -889,38 +925,112 @@
8934 for (i=0; i<NumSources; i++) {
8935 if (ISR[i] == 0)
8936 continue;
8937- save_irq_src_vp[i] = openpic_read(&ISR[i]->Vector_Priority)
8938- & ~OPENPIC_ACTIVITY;
8939+ save_irq_src_vp[i] = openpic_read(&ISR[i]->Vector_Priority) & ~OPENPIC_ACTIVITY;
8940 save_irq_src_dest[i] = openpic_read(&ISR[i]->Destination);
8941 }
8942+
8943 spin_unlock_irqrestore(&openpic_setup_lock, flags);
8944+
8945+ return 0;
8946 }
8947
8948-void __pmac
8949-openpic_sleep_restore_intrs(void)
8950+/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
8951+ * we need something better to deal with that... Maybe switch to S1 for
8952+ * cpufreq changes
8953+ */
8954+int openpic_resume(struct sys_device *sysdev)
8955 {
8956 int i;
8957 unsigned long flags;
8958+ u32 vppmask = OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
8959+ OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK |
8960+ OPENPIC_MASK;
8961
8962 spin_lock_irqsave(&openpic_setup_lock, flags);
8963
8964+ if ((--openpic_suspend_count) > 0) {
8965+ spin_unlock_irqrestore(&openpic_setup_lock, flags);
8966+ return 0;
8967+ }
8968+
8969 openpic_reset();
8970
8971+ /* OpenPIC sometimes seem to need some time to be fully back up... */
8972+ do {
8973+ openpic_set_spurious(OPENPIC_VEC_SPURIOUS+open_pic_irq_offset);
8974+ } while(openpic_readfield(&OpenPIC->Global.Spurious_Vector, OPENPIC_VECTOR_MASK)
8975+ != (OPENPIC_VEC_SPURIOUS + open_pic_irq_offset));
8976+
8977+ openpic_disable_8259_pass_through();
8978+
8979 for (i=0; i<OPENPIC_NUM_IPI; i++)
8980 openpic_write(&OpenPIC->Global.IPI_Vector_Priority(i),
8981 save_ipi_vp[i]);
8982 for (i=0; i<NumSources; i++) {
8983 if (ISR[i] == 0)
8984 continue;
8985- openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
8986 openpic_write(&ISR[i]->Destination, save_irq_src_dest[i]);
8987+ openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
8988+ /* make sure mask gets to controller before we return to user */
8989+ do {
8990+ openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
8991+ } while (openpic_readfield(&ISR[i]->Vector_Priority, vppmask)
8992+ != (save_irq_src_vp[i] & vppmask));
8993 }
8994- openpic_set_spurious(OPENPIC_VEC_SPURIOUS+open_pic_irq_offset);
8995- openpic_disable_8259_pass_through();
8996 for (i=0; i<NumProcessors; i++)
8997 openpic_write(&OpenPIC->Processor[i].Current_Task_Priority,
8998 save_cpu_task_pri[i]);
8999
9000+ open_pic.enable = openpic_enable_irq;
9001+ open_pic.disable = openpic_disable_irq;
9002+
9003 spin_unlock_irqrestore(&openpic_setup_lock, flags);
9004+
9005+ return 0;
9006+}
9007+
9008+#endif /* CONFIG_PM */
9009+
9010+static struct sysdev_class openpic_sysclass = {
9011+ set_kset_name("openpic"),
9012+};
9013+
9014+static struct sys_device device_openpic = {
9015+ .id = 0,
9016+ .cls = &openpic_sysclass,
9017+};
9018+
9019+static struct sysdev_driver driver_openpic = {
9020+#ifdef CONFIG_PM
9021+ .suspend = &openpic_suspend,
9022+ .resume = &openpic_resume,
9023+#endif /* CONFIG_PM */
9024+};
9025+
9026+static int __init init_openpic_sysfs(void)
9027+{
9028+ int rc;
9029+
9030+ if (!OpenPIC_Addr)
9031+ return -ENODEV;
9032+ printk(KERN_DEBUG "Registering openpic with sysfs...\n");
9033+ rc = sysdev_class_register(&openpic_sysclass);
9034+ if (rc) {
9035+ printk(KERN_ERR "Failed registering openpic sys class\n");
9036+ return -ENODEV;
9037+ }
9038+ rc = sys_device_register(&device_openpic);
9039+ if (rc) {
9040+ printk(KERN_ERR "Failed registering openpic sys device\n");
9041+ return -ENODEV;
9042+ }
9043+ rc = sysdev_driver_register(&openpic_sysclass, &driver_openpic);
9044+ if (rc) {
9045+ printk(KERN_ERR "Failed registering openpic sys driver\n");
9046+ return -ENODEV;
9047+ }
9048+ return 0;
9049 }
9050-#endif /* CONFIG_PMAC_PBOOK */
9051+
9052+subsys_initcall(init_openpic_sysfs);
9053+
9054diff -Nru a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c
9055--- a/arch/ppc/syslib/prom.c Sat Jun 7 02:18:01 2003
9056+++ b/arch/ppc/syslib/prom.c Sun Aug 24 03:57:52 2003
9057@@ -941,6 +941,184 @@
9058 return NULL;
9059 }
9060
9061+/*******
9062+ *
9063+ * New implementation of the OF "find" APIs, return a refcounted
9064+ * object, call of_node_put() when done. Currently, still lacks
9065+ * locking as old implementation, this is beeing done for ppc64.
9066+ *
9067+ * Note that property management will need some locking as well,
9068+ * this isn't dealt with yet
9069+ *
9070+ *******/
9071+
9072+/**
9073+ * of_find_node_by_name - Find a node by it's "name" property
9074+ * @from: The node to start searching from or NULL, the node
9075+ * you pass will not be searched, only the next one
9076+ * will; typically, you pass what the previous call
9077+ * returned. of_node_put() will be called on it
9078+ * @name: The name string to match against
9079+ *
9080+ * Returns a node pointer with refcount incremented, use
9081+ * of_node_put() on it when done.
9082+ */
9083+struct device_node *of_find_node_by_name(struct device_node *from,
9084+ const char *name)
9085+{
9086+ struct device_node *np = from ? from->allnext : allnodes;
9087+
9088+ for (; np != 0; np = np->allnext)
9089+ if (np->name != 0 && strcasecmp(np->name, name) == 0)
9090+ break;
9091+ if (from)
9092+ of_node_put(from);
9093+ return of_node_get(np);
9094+}
9095+
9096+/**
9097+ * of_find_node_by_type - Find a node by it's "device_type" property
9098+ * @from: The node to start searching from or NULL, the node
9099+ * you pass will not be searched, only the next one
9100+ * will; typically, you pass what the previous call
9101+ * returned. of_node_put() will be called on it
9102+ * @name: The type string to match against
9103+ *
9104+ * Returns a node pointer with refcount incremented, use
9105+ * of_node_put() on it when done.
9106+ */
9107+struct device_node *of_find_node_by_type(struct device_node *from,
9108+ const char *type)
9109+{
9110+ struct device_node *np = from ? from->allnext : allnodes;
9111+
9112+ for (; np != 0; np = np->allnext)
9113+ if (np->type != 0 && strcasecmp(np->type, type) == 0)
9114+ break;
9115+ if (from)
9116+ of_node_put(from);
9117+ return of_node_get(np);
9118+}
9119+
9120+/**
9121+ * of_find_compatible_node - Find a node based on type and one of the
9122+ * tokens in it's "compatible" property
9123+ * @from: The node to start searching from or NULL, the node
9124+ * you pass will not be searched, only the next one
9125+ * will; typically, you pass what the previous call
9126+ * returned. of_node_put() will be called on it
9127+ * @type: The type string to match "device_type" or NULL to ignore
9128+ * @compatible: The string to match to one of the tokens in the device
9129+ * "compatible" list.
9130+ *
9131+ * Returns a node pointer with refcount incremented, use
9132+ * of_node_put() on it when done.
9133+ */
9134+struct device_node *of_find_compatible_node(struct device_node *from,
9135+ const char *type, const char *compatible)
9136+{
9137+ struct device_node *np = from ? from->allnext : allnodes;
9138+
9139+ for (; np != 0; np = np->allnext) {
9140+ if (type != NULL
9141+ && !(np->type != 0 && strcasecmp(np->type, type) == 0))
9142+ continue;
9143+ if (device_is_compatible(np, compatible))
9144+ break;
9145+ }
9146+ if (from)
9147+ of_node_put(from);
9148+ return of_node_get(np);
9149+}
9150+
9151+/**
9152+ * of_find_node_by_path - Find a node matching a full OF path
9153+ * @path: The full path to match
9154+ *
9155+ * Returns a node pointer with refcount incremented, use
9156+ * of_node_put() on it when done.
9157+ */
9158+struct device_node *of_find_node_by_path(const char *path)
9159+{
9160+ struct device_node *np = allnodes;
9161+
9162+ for (; np != 0; np = np->allnext)
9163+ if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
9164+ break;
9165+ return of_node_get(np);
9166+}
9167+
9168+/**
9169+ * of_find_all_nodes - Get next node in global list
9170+ * @prev: Previous node or NULL to start iteration
9171+ * of_node_put() will be called on it
9172+ *
9173+ * Returns a node pointer with refcount incremented, use
9174+ * of_node_put() on it when done.
9175+ */
9176+struct device_node *of_find_all_nodes(struct device_node *prev)
9177+{
9178+ return of_node_get(prev ? prev->allnext : allnodes);
9179+}
9180+
9181+/**
9182+ * of_get_parent - Get a node's parent if any
9183+ * @node: Node to get parent
9184+ *
9185+ * Returns a node pointer with refcount incremented, use
9186+ * of_node_put() on it when done.
9187+ */
9188+struct device_node *of_get_parent(const struct device_node *node)
9189+{
9190+ return node ? of_node_get(node->parent) : NULL;
9191+}
9192+
9193+/**
9194+ * of_get_next_child - Iterate a node childs
9195+ * @node: parent node
9196+ * @prev: previous child of the parent node, or NULL to get first
9197+ *
9198+ * Returns a node pointer with refcount incremented, use
9199+ * of_node_put() on it when done.
9200+ */
9201+struct device_node *of_get_next_child(const struct device_node *node,
9202+ struct device_node *prev)
9203+{
9204+ struct device_node *next = prev ? prev->sibling : node->child;
9205+
9206+ for (; next != 0; next = next->sibling)
9207+ if (of_node_get(next))
9208+ break;
9209+ if (prev)
9210+ of_node_put(prev);
9211+ return next;
9212+}
9213+
9214+/**
9215+ * of_node_get - Increment refcount of a node
9216+ * @node: Node to inc refcount, NULL is supported to
9217+ * simplify writing of callers
9218+ *
9219+ * Returns the node itself or NULL if gone. Current implementation
9220+ * does nothing as we don't yet do dynamic node allocation on ppc32
9221+ */
9222+struct device_node *of_node_get(struct device_node *node)
9223+{
9224+ return node;
9225+}
9226+
9227+/**
9228+ * of_node_put - Decrement refcount of a node
9229+ * @node: Node to dec refcount, NULL is supported to
9230+ * simplify writing of callers
9231+ *
9232+ * Current implementation does nothing as we don't yet do dynamic node
9233+ * allocation on ppc32
9234+ */
9235+void of_node_put(struct device_node *node)
9236+{
9237+}
9238+
9239 /*
9240 * Find the device_node with a given phandle.
9241 */
9242diff -Nru a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
9243--- a/arch/ppc/xmon/start.c Sat Jun 7 02:18:02 2003
9244+++ b/arch/ppc/xmon/start.c Sun Aug 24 07:39:33 2003
9245@@ -225,14 +225,13 @@
9246 static int scc_initialized = 0;
9247
9248 void xmon_init_scc(void);
9249-extern void pmu_poll(void);
9250 extern void cuda_poll(void);
9251
9252 static inline void do_poll_adb(void)
9253 {
9254 #ifdef CONFIG_ADB_PMU
9255 if (sys_ctrler == SYS_CTRLER_PMU)
9256- pmu_poll();
9257+ pmu_poll_adb();
9258 #endif /* CONFIG_ADB_PMU */
9259 #ifdef CONFIG_ADB_CUDA
9260 if (sys_ctrler == SYS_CTRLER_CUDA)
9261diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
9262--- a/arch/ppc64/Kconfig Mon Aug 18 19:46:23 2003
9263+++ b/arch/ppc64/Kconfig Sun Aug 31 16:14:22 2003
9264@@ -175,22 +175,6 @@
9265 bool
9266 default PCI
9267
9268-# only elf supported, a.out is not -- Cort
9269-config KCORE_ELF
9270- bool
9271- depends on PROC_FS
9272- default y
9273- help
9274- If you enabled support for /proc file system then the file
9275- /proc/kcore will contain the kernel core image in ELF format. This
9276- can be used in gdb:
9277-
9278- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
9279-
9280- This is especially useful if you have compiled the kernel with the
9281- "-g" option to preserve debugging information. It is mainly used
9282- for examining kernel data structures on the live kernel.
9283-
9284 source "fs/Kconfig.binfmt"
9285
9286 source "drivers/pci/Kconfig"
9287diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c
9288--- a/arch/ppc64/kernel/ioctl32.c Fri Aug 8 14:53:47 2003
9289+++ b/arch/ppc64/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
9290@@ -725,7 +725,7 @@
9291 #define IOCTL_TABLE_START \
9292 struct ioctl_trans ioctl_start[] = {
9293 #define IOCTL_TABLE_END \
9294- }; struct ioctl_trans ioctl_end[0];
9295+ };
9296
9297 IOCTL_TABLE_START
9298 #include <linux/compat_ioctl.h>
9299@@ -763,3 +763,5 @@
9300 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb)
9301 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
9302 IOCTL_TABLE_END
9303+
9304+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
9305diff -Nru a/arch/ppc64/kernel/proc_ppc64.c b/arch/ppc64/kernel/proc_ppc64.c
9306--- a/arch/ppc64/kernel/proc_ppc64.c Tue Mar 25 20:30:59 2003
9307+++ b/arch/ppc64/kernel/proc_ppc64.c Sun Aug 31 16:14:08 2003
9308@@ -47,9 +47,9 @@
9309 static int page_map_mmap( struct file *file, struct vm_area_struct *vma );
9310
9311 static struct file_operations page_map_fops = {
9312- llseek: page_map_seek,
9313- read: page_map_read,
9314- mmap: page_map_mmap
9315+ .llseek = page_map_seek,
9316+ .read = page_map_read,
9317+ .mmap = page_map_mmap
9318 };
9319
9320
9321diff -Nru a/arch/ppc64/kernel/scanlog.c b/arch/ppc64/kernel/scanlog.c
9322--- a/arch/ppc64/kernel/scanlog.c Thu Feb 13 00:47:26 2003
9323+++ b/arch/ppc64/kernel/scanlog.c Sun Aug 31 16:14:08 2003
9324@@ -190,11 +190,11 @@
9325 }
9326
9327 struct file_operations scanlog_fops = {
9328- owner: THIS_MODULE,
9329- read: scanlog_read,
9330- write: scanlog_write,
9331- open: scanlog_open,
9332- release: scanlog_release,
9333+ .owner = THIS_MODULE,
9334+ .read = scanlog_read,
9335+ .write = scanlog_write,
9336+ .open = scanlog_open,
9337+ .release = scanlog_release,
9338 };
9339
9340 int __init scanlog_init(void)
9341diff -Nru a/arch/s390/Kconfig b/arch/s390/Kconfig
9342--- a/arch/s390/Kconfig Mon Jul 21 13:25:16 2003
9343+++ b/arch/s390/Kconfig Sun Aug 31 16:14:22 2003
9344@@ -217,10 +217,6 @@
9345
9346 endchoice
9347
9348-config KCORE_ELF
9349- bool
9350- default y
9351-
9352 source "fs/Kconfig.binfmt"
9353
9354 config PROCESS_DEBUG
9355diff -Nru a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c
9356--- a/arch/s390/kernel/compat_ioctl.c Tue May 27 12:34:41 2003
9357+++ b/arch/s390/kernel/compat_ioctl.c Sun Aug 31 16:14:44 2003
9358@@ -808,7 +808,7 @@
9359 #define IOCTL_TABLE_START \
9360 struct ioctl_trans ioctl_start[] = {
9361 #define IOCTL_TABLE_END \
9362- }; struct ioctl_trans ioctl_end[0];
9363+ };
9364
9365 IOCTL_TABLE_START
9366 #include <linux/compat_ioctl.h>
9367@@ -899,3 +899,5 @@
9368 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
9369
9370 IOCTL_TABLE_END
9371+
9372+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
9373diff -Nru a/arch/sh/Kconfig b/arch/sh/Kconfig
9374--- a/arch/sh/Kconfig Sat Aug 2 14:26:16 2003
9375+++ b/arch/sh/Kconfig Sun Aug 31 16:14:22 2003
9376@@ -729,40 +729,6 @@
9377
9378 menu "Executable file formats"
9379
9380-choice
9381- prompt "Kernel core (/proc/kcore) format"
9382- depends on PROC_FS
9383- default KCORE_ELF
9384-
9385-config KCORE_ELF
9386- bool "ELF"
9387- ---help---
9388- If you enabled support for /proc file system then the file
9389- /proc/kcore will contain the kernel core image. This can be used
9390- in gdb:
9391-
9392- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
9393-
9394- You have two choices here: ELF and A.OUT. Selecting ELF will make
9395- /proc/kcore appear in ELF core format as defined by the Executable
9396- and Linking Format specification. Selecting A.OUT will choose the
9397- old "a.out" format which may be necessary for some old versions
9398- of binutils or on some architectures.
9399-
9400- This is especially useful if you have compiled the kernel with the
9401- "-g" option to preserve debugging information. It is mainly used
9402- for examining kernel data structures on the live kernel so if you
9403- don't understand what this means or are not a kernel hacker, just
9404- leave it at its default value ELF.
9405-
9406-config KCORE_AOUT
9407- bool "A.OUT"
9408- help
9409- Not necessary unless you're using a very out-of-date binutils
9410- version. You probably want KCORE_ELF.
9411-
9412-endchoice
9413-
9414 source "fs/Kconfig.binfmt"
9415
9416 endmenu
9417diff -Nru a/arch/sh/boards/adx/mach.c b/arch/sh/boards/adx/mach.c
9418--- a/arch/sh/boards/adx/mach.c Mon May 19 16:04:36 2003
9419+++ b/arch/sh/boards/adx/mach.c Sun Aug 31 16:14:08 2003
9420@@ -24,41 +24,41 @@
9421 */
9422
9423 struct sh_machine_vector mv_adx __initmv = {
9424- mv_nr_irqs: 48,
9425+ .mv_nr_irqs = 48,
9426
9427- mv_inb: adx_inb,
9428- mv_inw: adx_inw,
9429- mv_inl: adx_inl,
9430- mv_outb: adx_outb,
9431- mv_outw: adx_outw,
9432- mv_outl: adx_outl,
9433-
9434- mv_inb_p: adx_inb_p,
9435- mv_inw_p: adx_inw,
9436- mv_inl_p: adx_inl,
9437- mv_outb_p: adx_outb_p,
9438- mv_outw_p: adx_outw,
9439- mv_outl_p: adx_outl,
9440-
9441- mv_insb: adx_insb,
9442- mv_insw: adx_insw,
9443- mv_insl: adx_insl,
9444- mv_outsb: adx_outsb,
9445- mv_outsw: adx_outsw,
9446- mv_outsl: adx_outsl,
9447-
9448- mv_readb: adx_readb,
9449- mv_readw: adx_readw,
9450- mv_readl: adx_readl,
9451- mv_writeb: adx_writeb,
9452- mv_writew: adx_writew,
9453- mv_writel: adx_writel,
9454+ .mv_inb = adx_inb,
9455+ .mv_inw = adx_inw,
9456+ .mv_inl = adx_inl,
9457+ .mv_outb = adx_outb,
9458+ .mv_outw = adx_outw,
9459+ .mv_outl = adx_outl,
9460+
9461+ .mv_inb_p = adx_inb_p,
9462+ .mv_inw_p = adx_inw,
9463+ .mv_inl_p = adx_inl,
9464+ .mv_outb_p = adx_outb_p,
9465+ .mv_outw_p = adx_outw,
9466+ .mv_outl_p = adx_outl,
9467+
9468+ .mv_insb = adx_insb,
9469+ .mv_insw = adx_insw,
9470+ .mv_insl = adx_insl,
9471+ .mv_outsb = adx_outsb,
9472+ .mv_outsw = adx_outsw,
9473+ .mv_outsl = adx_outsl,
9474+
9475+ .mv_readb = adx_readb,
9476+ .mv_readw = adx_readw,
9477+ .mv_readl = adx_readl,
9478+ .mv_writeb = adx_writeb,
9479+ .mv_writew = adx_writew,
9480+ .mv_writel = adx_writel,
9481
9482- mv_ioremap: adx_ioremap,
9483- mv_iounmap: adx_iounmap,
9484+ .mv_ioremap = adx_ioremap,
9485+ .mv_iounmap = adx_iounmap,
9486
9487- mv_isa_port2addr: adx_isa_port2addr,
9488+ .mv_isa_port2addr = adx_isa_port2addr,
9489
9490- mv_init_irq: init_adx_IRQ,
9491+ .mv_init_irq = init_adx_IRQ,
9492 };
9493 ALIAS_MV(adx)
9494diff -Nru a/arch/sh/boards/bigsur/mach.c b/arch/sh/boards/bigsur/mach.c
9495--- a/arch/sh/boards/bigsur/mach.c Sat Mar 2 08:57:07 2002
9496+++ b/arch/sh/boards/bigsur/mach.c Sun Aug 31 16:14:08 2003
9497@@ -28,44 +28,44 @@
9498 extern void init_bigsur_IRQ(void);
9499
9500 struct sh_machine_vector mv_bigsur __initmv = {
9501- mv_nr_irqs: NR_IRQS, // Defined in <asm/irq.h>
9502- mv_inb: bigsur_inb,
9503- mv_inw: bigsur_inw,
9504- mv_inl: bigsur_inl,
9505- mv_outb: bigsur_outb,
9506- mv_outw: bigsur_outw,
9507- mv_outl: bigsur_outl,
9508-
9509- mv_inb_p: bigsur_inb_p,
9510- mv_inw_p: bigsur_inw,
9511- mv_inl_p: bigsur_inl,
9512- mv_outb_p: bigsur_outb_p,
9513- mv_outw_p: bigsur_outw,
9514- mv_outl_p: bigsur_outl,
9515-
9516- mv_insb: bigsur_insb,
9517- mv_insw: bigsur_insw,
9518- mv_insl: bigsur_insl,
9519- mv_outsb: bigsur_outsb,
9520- mv_outsw: bigsur_outsw,
9521- mv_outsl: bigsur_outsl,
9522-
9523- mv_readb: generic_readb,
9524- mv_readw: generic_readw,
9525- mv_readl: generic_readl,
9526- mv_writeb: generic_writeb,
9527- mv_writew: generic_writew,
9528- mv_writel: generic_writel,
9529+ .mv_nr_irqs = NR_IRQS, // Defined in <asm/irq.h>
9530+ .mv_inb = bigsur_inb,
9531+ .mv_inw = bigsur_inw,
9532+ .mv_inl = bigsur_inl,
9533+ .mv_outb = bigsur_outb,
9534+ .mv_outw = bigsur_outw,
9535+ .mv_outl = bigsur_outl,
9536+
9537+ .mv_inb_p = bigsur_inb_p,
9538+ .mv_inw_p = bigsur_inw,
9539+ .mv_inl_p = bigsur_inl,
9540+ .mv_outb_p = bigsur_outb_p,
9541+ .mv_outw_p = bigsur_outw,
9542+ .mv_outl_p = bigsur_outl,
9543+
9544+ .mv_insb = bigsur_insb,
9545+ .mv_insw = bigsur_insw,
9546+ .mv_insl = bigsur_insl,
9547+ .mv_outsb = bigsur_outsb,
9548+ .mv_outsw = bigsur_outsw,
9549+ .mv_outsl = bigsur_outsl,
9550+
9551+ .mv_readb = generic_readb,
9552+ .mv_readw = generic_readw,
9553+ .mv_readl = generic_readl,
9554+ .mv_writeb = generic_writeb,
9555+ .mv_writew = generic_writew,
9556+ .mv_writel = generic_writel,
9557
9558- mv_ioremap: generic_ioremap,
9559- mv_iounmap: generic_iounmap,
9560+ .mv_ioremap = generic_ioremap,
9561+ .mv_iounmap = generic_iounmap,
9562
9563- mv_isa_port2addr: bigsur_isa_port2addr,
9564- mv_irq_demux: bigsur_irq_demux,
9565+ .mv_isa_port2addr = bigsur_isa_port2addr,
9566+ .mv_irq_demux = bigsur_irq_demux,
9567
9568- mv_init_irq: init_bigsur_IRQ,
9569+ .mv_init_irq = init_bigsur_IRQ,
9570 #ifdef CONFIG_HEARTBEAT
9571- mv_heartbeat: heartbeat_bigsur,
9572+ .mv_heartbeat = heartbeat_bigsur,
9573 #endif
9574
9575 };
9576diff -Nru a/arch/sh/boards/cat68701/mach.c b/arch/sh/boards/cat68701/mach.c
9577--- a/arch/sh/boards/cat68701/mach.c Sat Mar 2 08:57:07 2002
9578+++ b/arch/sh/boards/cat68701/mach.c Sun Aug 31 16:14:08 2003
9579@@ -23,44 +23,44 @@
9580 */
9581
9582 struct sh_machine_vector mv_cat68701 __initmv = {
9583- mv_nr_irqs: 32,
9584- mv_inb: cat68701_inb,
9585- mv_inw: cat68701_inw,
9586- mv_inl: cat68701_inl,
9587- mv_outb: cat68701_outb,
9588- mv_outw: cat68701_outw,
9589- mv_outl: cat68701_outl,
9590-
9591- mv_inb_p: cat68701_inb_p,
9592- mv_inw_p: cat68701_inw,
9593- mv_inl_p: cat68701_inl,
9594- mv_outb_p: cat68701_outb_p,
9595- mv_outw_p: cat68701_outw,
9596- mv_outl_p: cat68701_outl,
9597-
9598- mv_insb: cat68701_insb,
9599- mv_insw: cat68701_insw,
9600- mv_insl: cat68701_insl,
9601- mv_outsb: cat68701_outsb,
9602- mv_outsw: cat68701_outsw,
9603- mv_outsl: cat68701_outsl,
9604-
9605- mv_readb: cat68701_readb,
9606- mv_readw: cat68701_readw,
9607- mv_readl: cat68701_readl,
9608- mv_writeb: cat68701_writeb,
9609- mv_writew: cat68701_writew,
9610- mv_writel: cat68701_writel,
9611+ .mv_nr_irqs = 32,
9612+ .mv_inb = cat68701_inb,
9613+ .mv_inw = cat68701_inw,
9614+ .mv_inl = cat68701_inl,
9615+ .mv_outb = cat68701_outb,
9616+ .mv_outw = cat68701_outw,
9617+ .mv_outl = cat68701_outl,
9618+
9619+ .mv_inb_p = cat68701_inb_p,
9620+ .mv_inw_p = cat68701_inw,
9621+ .mv_inl_p = cat68701_inl,
9622+ .mv_outb_p = cat68701_outb_p,
9623+ .mv_outw_p = cat68701_outw,
9624+ .mv_outl_p = cat68701_outl,
9625+
9626+ .mv_insb = cat68701_insb,
9627+ .mv_insw = cat68701_insw,
9628+ .mv_insl = cat68701_insl,
9629+ .mv_outsb = cat68701_outsb,
9630+ .mv_outsw = cat68701_outsw,
9631+ .mv_outsl = cat68701_outsl,
9632+
9633+ .mv_readb = cat68701_readb,
9634+ .mv_readw = cat68701_readw,
9635+ .mv_readl = cat68701_readl,
9636+ .mv_writeb = cat68701_writeb,
9637+ .mv_writew = cat68701_writew,
9638+ .mv_writel = cat68701_writel,
9639
9640- mv_ioremap: cat68701_ioremap,
9641- mv_iounmap: cat68701_iounmap,
9642+ .mv_ioremap = cat68701_ioremap,
9643+ .mv_iounmap = cat68701_iounmap,
9644
9645- mv_isa_port2addr: cat68701_isa_port2addr,
9646- mv_irq_demux: cat68701_irq_demux,
9647+ .mv_isa_port2addr = cat68701_isa_port2addr,
9648+ .mv_irq_demux = cat68701_irq_demux,
9649
9650- mv_init_irq: init_cat68701_IRQ,
9651+ .mv_init_irq = init_cat68701_IRQ,
9652 #ifdef CONFIG_HEARTBEAT
9653- mv_heartbeat: heartbeat_cat68701,
9654+ .mv_heartbeat = heartbeat_cat68701,
9655 #endif
9656 };
9657 ALIAS_MV(cat68701)
9658diff -Nru a/arch/sh/boards/cqreek/mach.c b/arch/sh/boards/cqreek/mach.c
9659--- a/arch/sh/boards/cqreek/mach.c Sat Jun 14 11:02:09 2003
9660+++ b/arch/sh/boards/cqreek/mach.c Sun Aug 31 16:14:08 2003
9661@@ -21,46 +21,46 @@
9662
9663 struct sh_machine_vector mv_cqreek __initmv = {
9664 #if defined(CONFIG_CPU_SH4)
9665- mv_nr_irqs: 48,
9666+ .mv_nr_irqs = 48,
9667 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
9668- mv_nr_irqs: 32,
9669+ .mv_nr_irqs = 32,
9670 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
9671- mv_nr_irqs: 61,
9672+ .mv_nr_irqs = 61,
9673 #endif
9674
9675- mv_inb: generic_inb,
9676- mv_inw: generic_inw,
9677- mv_inl: generic_inl,
9678- mv_outb: generic_outb,
9679- mv_outw: generic_outw,
9680- mv_outl: generic_outl,
9681-
9682- mv_inb_p: generic_inb_p,
9683- mv_inw_p: generic_inw_p,
9684- mv_inl_p: generic_inl_p,
9685- mv_outb_p: generic_outb_p,
9686- mv_outw_p: generic_outw_p,
9687- mv_outl_p: generic_outl_p,
9688-
9689- mv_insb: generic_insb,
9690- mv_insw: generic_insw,
9691- mv_insl: generic_insl,
9692- mv_outsb: generic_outsb,
9693- mv_outsw: generic_outsw,
9694- mv_outsl: generic_outsl,
9695-
9696- mv_readb: generic_readb,
9697- mv_readw: generic_readw,
9698- mv_readl: generic_readl,
9699- mv_writeb: generic_writeb,
9700- mv_writew: generic_writew,
9701- mv_writel: generic_writel,
9702+ .mv_inb = generic_inb,
9703+ .mv_inw = generic_inw,
9704+ .mv_inl = generic_inl,
9705+ .mv_outb = generic_outb,
9706+ .mv_outw = generic_outw,
9707+ .mv_outl = generic_outl,
9708+
9709+ .mv_inb_p = generic_inb_p,
9710+ .mv_inw_p = generic_inw_p,
9711+ .mv_inl_p = generic_inl_p,
9712+ .mv_outb_p = generic_outb_p,
9713+ .mv_outw_p = generic_outw_p,
9714+ .mv_outl_p = generic_outl_p,
9715+
9716+ .mv_insb = generic_insb,
9717+ .mv_insw = generic_insw,
9718+ .mv_insl = generic_insl,
9719+ .mv_outsb = generic_outsb,
9720+ .mv_outsw = generic_outsw,
9721+ .mv_outsl = generic_outsl,
9722+
9723+ .mv_readb = generic_readb,
9724+ .mv_readw = generic_readw,
9725+ .mv_readl = generic_readl,
9726+ .mv_writeb = generic_writeb,
9727+ .mv_writew = generic_writew,
9728+ .mv_writel = generic_writel,
9729
9730- mv_init_irq: init_cqreek_IRQ,
9731+ .mv_init_irq = init_cqreek_IRQ,
9732
9733- mv_isa_port2addr: cqreek_port2addr,
9734+ .mv_isa_port2addr = cqreek_port2addr,
9735
9736- mv_ioremap: generic_ioremap,
9737- mv_iounmap: generic_iounmap,
9738+ .mv_ioremap = generic_ioremap,
9739+ .mv_iounmap = generic_iounmap,
9740 };
9741 ALIAS_MV(cqreek)
9742diff -Nru a/arch/sh/boards/dmida/mach.c b/arch/sh/boards/dmida/mach.c
9743--- a/arch/sh/boards/dmida/mach.c Mon May 19 16:04:36 2003
9744+++ b/arch/sh/boards/dmida/mach.c Sun Aug 31 16:14:08 2003
9745@@ -30,42 +30,42 @@
9746 */
9747
9748 struct sh_machine_vector mv_dmida __initmv = {
9749- mv_name: "DMIDA",
9750+ .mv_name = "DMIDA",
9751
9752- mv_nr_irqs: HD64465_IRQ_BASE+HD64465_IRQ_NUM,
9753+ .mv_nr_irqs = HD64465_IRQ_BASE+HD64465_IRQ_NUM,
9754
9755- mv_inb: hd64465_inb,
9756- mv_inw: hd64465_inw,
9757- mv_inl: hd64465_inl,
9758- mv_outb: hd64465_outb,
9759- mv_outw: hd64465_outw,
9760- mv_outl: hd64465_outl,
9761-
9762- mv_inb_p: hd64465_inb_p,
9763- mv_inw_p: hd64465_inw,
9764- mv_inl_p: hd64465_inl,
9765- mv_outb_p: hd64465_outb_p,
9766- mv_outw_p: hd64465_outw,
9767- mv_outl_p: hd64465_outl,
9768-
9769- mv_insb: hd64465_insb,
9770- mv_insw: hd64465_insw,
9771- mv_insl: hd64465_insl,
9772- mv_outsb: hd64465_outsb,
9773- mv_outsw: hd64465_outsw,
9774- mv_outsl: hd64465_outsl,
9775-
9776- mv_readb: generic_readb,
9777- mv_readw: generic_readw,
9778- mv_readl: generic_readl,
9779- mv_writeb: generic_writeb,
9780- mv_writew: generic_writew,
9781- mv_writel: generic_writel,
9782+ .mv_inb = hd64465_inb,
9783+ .mv_inw = hd64465_inw,
9784+ .mv_inl = hd64465_inl,
9785+ .mv_outb = hd64465_outb,
9786+ .mv_outw = hd64465_outw,
9787+ .mv_outl = hd64465_outl,
9788+
9789+ .mv_inb_p = hd64465_inb_p,
9790+ .mv_inw_p = hd64465_inw,
9791+ .mv_inl_p = hd64465_inl,
9792+ .mv_outb_p = hd64465_outb_p,
9793+ .mv_outw_p = hd64465_outw,
9794+ .mv_outl_p = hd64465_outl,
9795+
9796+ .mv_insb = hd64465_insb,
9797+ .mv_insw = hd64465_insw,
9798+ .mv_insl = hd64465_insl,
9799+ .mv_outsb = hd64465_outsb,
9800+ .mv_outsw = hd64465_outsw,
9801+ .mv_outsl = hd64465_outsl,
9802+
9803+ .mv_readb = generic_readb,
9804+ .mv_readw = generic_readw,
9805+ .mv_readl = generic_readl,
9806+ .mv_writeb = generic_writeb,
9807+ .mv_writew = generic_writew,
9808+ .mv_writel = generic_writel,
9809
9810- mv_irq_demux: hd64465_irq_demux,
9811+ .mv_irq_demux = hd64465_irq_demux,
9812
9813- mv_rtc_gettimeofday: sh_rtc_gettimeofday,
9814- mv_rtc_settimeofday: sh_rtc_settimeofday,
9815+ .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
9816+ .mv_rtc_settimeofday = sh_rtc_settimeofday,
9817 };
9818 ALIAS_MV(dmida)
9819
9820diff -Nru a/arch/sh/boards/dreamcast/irq.c b/arch/sh/boards/dreamcast/irq.c
9821--- a/arch/sh/boards/dreamcast/irq.c Sat Jun 14 11:02:09 2003
9822+++ b/arch/sh/boards/dreamcast/irq.c Sun Aug 31 16:14:08 2003
9823@@ -110,13 +110,13 @@
9824 }
9825
9826 struct hw_interrupt_type systemasic_int = {
9827- typename: "System ASIC",
9828- startup: startup_systemasic_irq,
9829- shutdown: shutdown_systemasic_irq,
9830- enable: enable_systemasic_irq,
9831- disable: disable_systemasic_irq,
9832- ack: ack_systemasic_irq,
9833- end: end_systemasic_irq,
9834+ .typename = "System ASIC",
9835+ .startup = startup_systemasic_irq,
9836+ .shutdown = shutdown_systemasic_irq,
9837+ .enable = enable_systemasic_irq,
9838+ .disable = disable_systemasic_irq,
9839+ .ack = ack_systemasic_irq,
9840+ .end = end_systemasic_irq,
9841 };
9842
9843 /*
9844diff -Nru a/arch/sh/boards/dreamcast/mach.c b/arch/sh/boards/dreamcast/mach.c
9845--- a/arch/sh/boards/dreamcast/mach.c Mon May 19 16:04:36 2003
9846+++ b/arch/sh/boards/dreamcast/mach.c Sun Aug 31 16:14:08 2003
9847@@ -21,40 +21,40 @@
9848 */
9849
9850 struct sh_machine_vector mv_dreamcast __initmv = {
9851- mv_nr_irqs: NR_IRQS,
9852+ .mv_nr_irqs = NR_IRQS,
9853
9854- mv_inb: generic_inb,
9855- mv_inw: generic_inw,
9856- mv_inl: generic_inl,
9857- mv_outb: generic_outb,
9858- mv_outw: generic_outw,
9859- mv_outl: generic_outl,
9860-
9861- mv_inb_p: generic_inb_p,
9862- mv_inw_p: generic_inw,
9863- mv_inl_p: generic_inl,
9864- mv_outb_p: generic_outb_p,
9865- mv_outw_p: generic_outw,
9866- mv_outl_p: generic_outl,
9867-
9868- mv_insb: generic_insb,
9869- mv_insw: generic_insw,
9870- mv_insl: generic_insl,
9871- mv_outsb: generic_outsb,
9872- mv_outsw: generic_outsw,
9873- mv_outsl: generic_outsl,
9874-
9875- mv_readb: generic_readb,
9876- mv_readw: generic_readw,
9877- mv_readl: generic_readl,
9878- mv_writeb: generic_writeb,
9879- mv_writew: generic_writew,
9880- mv_writel: generic_writel,
9881+ .mv_inb = generic_inb,
9882+ .mv_inw = generic_inw,
9883+ .mv_inl = generic_inl,
9884+ .mv_outb = generic_outb,
9885+ .mv_outw = generic_outw,
9886+ .mv_outl = generic_outl,
9887+
9888+ .mv_inb_p = generic_inb_p,
9889+ .mv_inw_p = generic_inw,
9890+ .mv_inl_p = generic_inl,
9891+ .mv_outb_p = generic_outb_p,
9892+ .mv_outw_p = generic_outw,
9893+ .mv_outl_p = generic_outl,
9894+
9895+ .mv_insb = generic_insb,
9896+ .mv_insw = generic_insw,
9897+ .mv_insl = generic_insl,
9898+ .mv_outsb = generic_outsb,
9899+ .mv_outsw = generic_outsw,
9900+ .mv_outsl = generic_outsl,
9901+
9902+ .mv_readb = generic_readb,
9903+ .mv_readw = generic_readw,
9904+ .mv_readl = generic_readl,
9905+ .mv_writeb = generic_writeb,
9906+ .mv_writew = generic_writew,
9907+ .mv_writel = generic_writel,
9908
9909- mv_ioremap: generic_ioremap,
9910- mv_iounmap: generic_iounmap,
9911+ .mv_ioremap = generic_ioremap,
9912+ .mv_iounmap = generic_iounmap,
9913
9914- mv_isa_port2addr: dreamcast_isa_port2addr,
9915- mv_irq_demux: systemasic_irq_demux,
9916+ .mv_isa_port2addr = dreamcast_isa_port2addr,
9917+ .mv_irq_demux = systemasic_irq_demux,
9918 };
9919 ALIAS_MV(dreamcast)
9920diff -Nru a/arch/sh/boards/ec3104/irq.c b/arch/sh/boards/ec3104/irq.c
9921--- a/arch/sh/boards/ec3104/irq.c Sat Jun 14 11:02:09 2003
9922+++ b/arch/sh/boards/ec3104/irq.c Sun Aug 31 16:14:08 2003
9923@@ -169,13 +169,13 @@
9924 }
9925
9926 static struct hw_interrupt_type ec3104_int = {
9927- typename: "EC3104",
9928- enable: enable_ec3104_irq,
9929- disable: disable_ec3104_irq,
9930- ack: mask_and_ack_ec3104_irq,
9931- end: end_ec3104_irq,
9932- startup: startup_ec3104_irq,
9933- shutdown: shutdown_ec3104_irq,
9934+ .typename = "EC3104",
9935+ .enable = enable_ec3104_irq,
9936+ .disable = disable_ec3104_irq,
9937+ .ack = mask_and_ack_ec3104_irq,
9938+ .end = end_ec3104_irq,
9939+ .startup = startup_ec3104_irq,
9940+ .shutdown = shutdown_ec3104_irq,
9941 };
9942
9943 /* Yuck. the _demux API is ugly */
9944diff -Nru a/arch/sh/boards/ec3104/mach.c b/arch/sh/boards/ec3104/mach.c
9945--- a/arch/sh/boards/ec3104/mach.c Sat Jan 19 10:54:19 2002
9946+++ b/arch/sh/boards/ec3104/mach.c Sun Aug 31 16:14:08 2003
9947@@ -28,42 +28,42 @@
9948 */
9949
9950 struct sh_machine_vector mv_ec3104 __initmv = {
9951- mv_name: "EC3104",
9952+ .mv_name = "EC3104",
9953
9954- mv_nr_irqs: 96,
9955+ .mv_nr_irqs = 96,
9956
9957- mv_inb: ec3104_inb,
9958- mv_inw: ec3104_inw,
9959- mv_inl: ec3104_inl,
9960- mv_outb: ec3104_outb,
9961- mv_outw: ec3104_outw,
9962- mv_outl: ec3104_outl,
9963-
9964- mv_inb_p: generic_inb_p,
9965- mv_inw_p: generic_inw,
9966- mv_inl_p: generic_inl,
9967- mv_outb_p: generic_outb_p,
9968- mv_outw_p: generic_outw,
9969- mv_outl_p: generic_outl,
9970-
9971- mv_insb: generic_insb,
9972- mv_insw: generic_insw,
9973- mv_insl: generic_insl,
9974- mv_outsb: generic_outsb,
9975- mv_outsw: generic_outsw,
9976- mv_outsl: generic_outsl,
9977-
9978- mv_readb: generic_readb,
9979- mv_readw: generic_readw,
9980- mv_readl: generic_readl,
9981- mv_writeb: generic_writeb,
9982- mv_writew: generic_writew,
9983- mv_writel: generic_writel,
9984+ .mv_inb = ec3104_inb,
9985+ .mv_inw = ec3104_inw,
9986+ .mv_inl = ec3104_inl,
9987+ .mv_outb = ec3104_outb,
9988+ .mv_outw = ec3104_outw,
9989+ .mv_outl = ec3104_outl,
9990+
9991+ .mv_inb_p = generic_inb_p,
9992+ .mv_inw_p = generic_inw,
9993+ .mv_inl_p = generic_inl,
9994+ .mv_outb_p = generic_outb_p,
9995+ .mv_outw_p = generic_outw,
9996+ .mv_outl_p = generic_outl,
9997+
9998+ .mv_insb = generic_insb,
9999+ .mv_insw = generic_insw,
10000+ .mv_insl = generic_insl,
10001+ .mv_outsb = generic_outsb,
10002+ .mv_outsw = generic_outsw,
10003+ .mv_outsl = generic_outsl,
10004+
10005+ .mv_readb = generic_readb,
10006+ .mv_readw = generic_readw,
10007+ .mv_readl = generic_readl,
10008+ .mv_writeb = generic_writeb,
10009+ .mv_writew = generic_writew,
10010+ .mv_writel = generic_writel,
10011
10012- mv_irq_demux: ec3104_irq_demux,
10013+ .mv_irq_demux = ec3104_irq_demux,
10014
10015- mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10016- mv_rtc_settimeofday: sh_rtc_settimeofday,
10017+ .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10018+ .mv_rtc_settimeofday = sh_rtc_settimeofday,
10019 };
10020
10021 ALIAS_MV(ec3104)
10022diff -Nru a/arch/sh/boards/harp/mach.c b/arch/sh/boards/harp/mach.c
10023--- a/arch/sh/boards/harp/mach.c Sat Mar 2 08:57:07 2002
10024+++ b/arch/sh/boards/harp/mach.c Sun Aug 31 16:14:08 2003
10025@@ -26,46 +26,46 @@
10026 */
10027
10028 struct sh_machine_vector mv_harp __initmv = {
10029- mv_nr_irqs: 89 + HD64465_IRQ_NUM,
10030+ .mv_nr_irqs = 89 + HD64465_IRQ_NUM,
10031
10032- mv_inb: hd64465_inb,
10033- mv_inw: hd64465_inw,
10034- mv_inl: hd64465_inl,
10035- mv_outb: hd64465_outb,
10036- mv_outw: hd64465_outw,
10037- mv_outl: hd64465_outl,
10038-
10039- mv_inb_p: hd64465_inb_p,
10040- mv_inw_p: hd64465_inw,
10041- mv_inl_p: hd64465_inl,
10042- mv_outb_p: hd64465_outb_p,
10043- mv_outw_p: hd64465_outw,
10044- mv_outl_p: hd64465_outl,
10045-
10046- mv_insb: hd64465_insb,
10047- mv_insw: hd64465_insw,
10048- mv_insl: hd64465_insl,
10049- mv_outsb: hd64465_outsb,
10050- mv_outsw: hd64465_outsw,
10051- mv_outsl: hd64465_outsl,
10052-
10053- mv_readb: generic_readb,
10054- mv_readw: generic_readw,
10055- mv_readl: generic_readl,
10056- mv_writeb: generic_writeb,
10057- mv_writew: generic_writew,
10058- mv_writel: generic_writel,
10059+ .mv_inb = hd64465_inb,
10060+ .mv_inw = hd64465_inw,
10061+ .mv_inl = hd64465_inl,
10062+ .mv_outb = hd64465_outb,
10063+ .mv_outw = hd64465_outw,
10064+ .mv_outl = hd64465_outl,
10065+
10066+ .mv_inb_p = hd64465_inb_p,
10067+ .mv_inw_p = hd64465_inw,
10068+ .mv_inl_p = hd64465_inl,
10069+ .mv_outb_p = hd64465_outb_p,
10070+ .mv_outw_p = hd64465_outw,
10071+ .mv_outl_p = hd64465_outl,
10072+
10073+ .mv_insb = hd64465_insb,
10074+ .mv_insw = hd64465_insw,
10075+ .mv_insl = hd64465_insl,
10076+ .mv_outsb = hd64465_outsb,
10077+ .mv_outsw = hd64465_outsw,
10078+ .mv_outsl = hd64465_outsl,
10079+
10080+ .mv_readb = generic_readb,
10081+ .mv_readw = generic_readw,
10082+ .mv_readl = generic_readl,
10083+ .mv_writeb = generic_writeb,
10084+ .mv_writew = generic_writew,
10085+ .mv_writel = generic_writel,
10086
10087- mv_ioremap: generic_ioremap,
10088- mv_iounmap: generic_iounmap,
10089+ .mv_ioremap = generic_ioremap,
10090+ .mv_iounmap = generic_iounmap,
10091
10092- mv_isa_port2addr: hd64465_isa_port2addr,
10093+ .mv_isa_port2addr = hd64465_isa_port2addr,
10094
10095 #ifdef CONFIG_PCI
10096- mv_init_irq: init_harp_irq,
10097+ .mv_init_irq = init_harp_irq,
10098 #endif
10099 #ifdef CONFIG_HEARTBEAT
10100- mv_heartbeat: heartbeat_harp,
10101+ .mv_heartbeat = heartbeat_harp,
10102 #endif
10103 };
10104
10105diff -Nru a/arch/sh/boards/hp6xx/hp620/mach.c b/arch/sh/boards/hp6xx/hp620/mach.c
10106--- a/arch/sh/boards/hp6xx/hp620/mach.c Mon May 19 16:04:36 2003
10107+++ b/arch/sh/boards/hp6xx/hp620/mach.c Sun Aug 31 16:14:08 2003
10108@@ -24,41 +24,41 @@
10109 */
10110
10111 struct sh_machine_vector mv_hp620 __initmv = {
10112- mv_name: "hp620",
10113+ .mv_name = "hp620",
10114
10115- mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10116+ .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10117
10118- mv_inb: hd64461_inb,
10119- mv_inw: hd64461_inw,
10120- mv_inl: hd64461_inl,
10121- mv_outb: hd64461_outb,
10122- mv_outw: hd64461_outw,
10123- mv_outl: hd64461_outl,
10124-
10125- mv_inb_p: hd64461_inb_p,
10126- mv_inw_p: hd64461_inw,
10127- mv_inl_p: hd64461_inl,
10128- mv_outb_p: hd64461_outb_p,
10129- mv_outw_p: hd64461_outw,
10130- mv_outl_p: hd64461_outl,
10131-
10132- mv_insb: hd64461_insb,
10133- mv_insw: hd64461_insw,
10134- mv_insl: hd64461_insl,
10135- mv_outsb: hd64461_outsb,
10136- mv_outsw: hd64461_outsw,
10137- mv_outsl: hd64461_outsl,
10138-
10139- mv_readb: generic_readb,
10140- mv_readw: generic_readw,
10141- mv_readl: generic_readl,
10142- mv_writeb: generic_writeb,
10143- mv_writew: generic_writew,
10144- mv_writel: generic_writel,
10145+ .mv_inb = hd64461_inb,
10146+ .mv_inw = hd64461_inw,
10147+ .mv_inl = hd64461_inl,
10148+ .mv_outb = hd64461_outb,
10149+ .mv_outw = hd64461_outw,
10150+ .mv_outl = hd64461_outl,
10151+
10152+ .mv_inb_p = hd64461_inb_p,
10153+ .mv_inw_p = hd64461_inw,
10154+ .mv_inl_p = hd64461_inl,
10155+ .mv_outb_p = hd64461_outb_p,
10156+ .mv_outw_p = hd64461_outw,
10157+ .mv_outl_p = hd64461_outl,
10158+
10159+ .mv_insb = hd64461_insb,
10160+ .mv_insw = hd64461_insw,
10161+ .mv_insl = hd64461_insl,
10162+ .mv_outsb = hd64461_outsb,
10163+ .mv_outsw = hd64461_outsw,
10164+ .mv_outsl = hd64461_outsl,
10165+
10166+ .mv_readb = generic_readb,
10167+ .mv_readw = generic_readw,
10168+ .mv_readl = generic_readl,
10169+ .mv_writeb = generic_writeb,
10170+ .mv_writew = generic_writew,
10171+ .mv_writel = generic_writel,
10172
10173- mv_irq_demux: hd64461_irq_demux,
10174+ .mv_irq_demux = hd64461_irq_demux,
10175
10176- mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10177- mv_rtc_settimeofday: sh_rtc_settimeofday,
10178+ .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10179+ .mv_rtc_settimeofday = sh_rtc_settimeofday,
10180 };
10181 ALIAS_MV(hp620)
10182diff -Nru a/arch/sh/boards/hp6xx/hp680/mach.c b/arch/sh/boards/hp6xx/hp680/mach.c
10183--- a/arch/sh/boards/hp6xx/hp680/mach.c Mon May 19 16:04:37 2003
10184+++ b/arch/sh/boards/hp6xx/hp680/mach.c Sun Aug 31 16:14:08 2003
10185@@ -20,41 +20,41 @@
10186 #include <asm/irq.h>
10187
10188 struct sh_machine_vector mv_hp680 __initmv = {
10189- mv_name: "hp680",
10190+ .mv_name = "hp680",
10191
10192- mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10193+ .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10194
10195- mv_inb: hd64461_inb,
10196- mv_inw: hd64461_inw,
10197- mv_inl: hd64461_inl,
10198- mv_outb: hd64461_outb,
10199- mv_outw: hd64461_outw,
10200- mv_outl: hd64461_outl,
10201-
10202- mv_inb_p: hd64461_inb_p,
10203- mv_inw_p: hd64461_inw,
10204- mv_inl_p: hd64461_inl,
10205- mv_outb_p: hd64461_outb_p,
10206- mv_outw_p: hd64461_outw,
10207- mv_outl_p: hd64461_outl,
10208-
10209- mv_insb: hd64461_insb,
10210- mv_insw: hd64461_insw,
10211- mv_insl: hd64461_insl,
10212- mv_outsb: hd64461_outsb,
10213- mv_outsw: hd64461_outsw,
10214- mv_outsl: hd64461_outsl,
10215-
10216- mv_readb: generic_readb,
10217- mv_readw: generic_readw,
10218- mv_readl: generic_readl,
10219- mv_writeb: generic_writeb,
10220- mv_writew: generic_writew,
10221- mv_writel: generic_writel,
10222+ .mv_inb = hd64461_inb,
10223+ .mv_inw = hd64461_inw,
10224+ .mv_inl = hd64461_inl,
10225+ .mv_outb = hd64461_outb,
10226+ .mv_outw = hd64461_outw,
10227+ .mv_outl = hd64461_outl,
10228+
10229+ .mv_inb_p = hd64461_inb_p,
10230+ .mv_inw_p = hd64461_inw,
10231+ .mv_inl_p = hd64461_inl,
10232+ .mv_outb_p = hd64461_outb_p,
10233+ .mv_outw_p = hd64461_outw,
10234+ .mv_outl_p = hd64461_outl,
10235+
10236+ .mv_insb = hd64461_insb,
10237+ .mv_insw = hd64461_insw,
10238+ .mv_insl = hd64461_insl,
10239+ .mv_outsb = hd64461_outsb,
10240+ .mv_outsw = hd64461_outsw,
10241+ .mv_outsl = hd64461_outsl,
10242+
10243+ .mv_readb = generic_readb,
10244+ .mv_readw = generic_readw,
10245+ .mv_readl = generic_readl,
10246+ .mv_writeb = generic_writeb,
10247+ .mv_writew = generic_writew,
10248+ .mv_writel = generic_writel,
10249
10250- mv_irq_demux: hd64461_irq_demux,
10251+ .mv_irq_demux = hd64461_irq_demux,
10252
10253- mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10254- mv_rtc_settimeofday: sh_rtc_settimeofday,
10255+ .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10256+ .mv_rtc_settimeofday = sh_rtc_settimeofday,
10257 };
10258 ALIAS_MV(hp680)
10259diff -Nru a/arch/sh/boards/hp6xx/hp690/mach.c b/arch/sh/boards/hp6xx/hp690/mach.c
10260--- a/arch/sh/boards/hp6xx/hp690/mach.c Mon May 19 16:04:37 2003
10261+++ b/arch/sh/boards/hp6xx/hp690/mach.c Sun Aug 31 16:14:08 2003
10262@@ -20,41 +20,41 @@
10263 #include <asm/irq.h>
10264
10265 struct sh_machine_vector mv_hp690 __initmv = {
10266- mv_name: "hp690",
10267+ .mv_name = "hp690",
10268
10269- mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10270+ .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10271
10272- mv_inb: hd64461_inb,
10273- mv_inw: hd64461_inw,
10274- mv_inl: hd64461_inl,
10275- mv_outb: hd64461_outb,
10276- mv_outw: hd64461_outw,
10277- mv_outl: hd64461_outl,
10278-
10279- mv_inb_p: hd64461_inb_p,
10280- mv_inw_p: hd64461_inw,
10281- mv_inl_p: hd64461_inl,
10282- mv_outb_p: hd64461_outb_p,
10283- mv_outw_p: hd64461_outw,
10284- mv_outl_p: hd64461_outl,
10285-
10286- mv_insb: hd64461_insb,
10287- mv_insw: hd64461_insw,
10288- mv_insl: hd64461_insl,
10289- mv_outsb: hd64461_outsb,
10290- mv_outsw: hd64461_outsw,
10291- mv_outsl: hd64461_outsl,
10292-
10293- mv_readb: generic_readb,
10294- mv_readw: generic_readw,
10295- mv_readl: generic_readl,
10296- mv_writeb: generic_writeb,
10297- mv_writew: generic_writew,
10298- mv_writel: generic_writel,
10299+ .mv_inb = hd64461_inb,
10300+ .mv_inw = hd64461_inw,
10301+ .mv_inl = hd64461_inl,
10302+ .mv_outb = hd64461_outb,
10303+ .mv_outw = hd64461_outw,
10304+ .mv_outl = hd64461_outl,
10305+
10306+ .mv_inb_p = hd64461_inb_p,
10307+ .mv_inw_p = hd64461_inw,
10308+ .mv_inl_p = hd64461_inl,
10309+ .mv_outb_p = hd64461_outb_p,
10310+ .mv_outw_p = hd64461_outw,
10311+ .mv_outl_p = hd64461_outl,
10312+
10313+ .mv_insb = hd64461_insb,
10314+ .mv_insw = hd64461_insw,
10315+ .mv_insl = hd64461_insl,
10316+ .mv_outsb = hd64461_outsb,
10317+ .mv_outsw = hd64461_outsw,
10318+ .mv_outsl = hd64461_outsl,
10319+
10320+ .mv_readb = generic_readb,
10321+ .mv_readw = generic_readw,
10322+ .mv_readl = generic_readl,
10323+ .mv_writeb = generic_writeb,
10324+ .mv_writew = generic_writew,
10325+ .mv_writel = generic_writel,
10326
10327- mv_irq_demux: hd64461_irq_demux,
10328+ .mv_irq_demux = hd64461_irq_demux,
10329
10330- mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10331- mv_rtc_settimeofday: sh_rtc_settimeofday,
10332+ .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10333+ .mv_rtc_settimeofday = sh_rtc_settimeofday,
10334 };
10335 ALIAS_MV(hp690)
10336diff -Nru a/arch/sh/boards/overdrive/mach.c b/arch/sh/boards/overdrive/mach.c
10337--- a/arch/sh/boards/overdrive/mach.c Sat Jun 14 11:02:09 2003
10338+++ b/arch/sh/boards/overdrive/mach.c Sun Aug 31 16:14:08 2003
10339@@ -28,46 +28,46 @@
10340 */
10341
10342 struct sh_machine_vector mv_od __initmv = {
10343- mv_nr_irqs: 48,
10344+ .mv_nr_irqs = 48,
10345
10346- mv_inb: od_inb,
10347- mv_inw: od_inw,
10348- mv_inl: od_inl,
10349- mv_outb: od_outb,
10350- mv_outw: od_outw,
10351- mv_outl: od_outl,
10352-
10353- mv_inb_p: od_inb_p,
10354- mv_inw_p: od_inw_p,
10355- mv_inl_p: od_inl_p,
10356- mv_outb_p: od_outb_p,
10357- mv_outw_p: od_outw_p,
10358- mv_outl_p: od_outl_p,
10359-
10360- mv_insb: od_insb,
10361- mv_insw: od_insw,
10362- mv_insl: od_insl,
10363- mv_outsb: od_outsb,
10364- mv_outsw: od_outsw,
10365- mv_outsl: od_outsl,
10366-
10367- mv_readb: generic_readb,
10368- mv_readw: generic_readw,
10369- mv_readl: generic_readl,
10370- mv_writeb: generic_writeb,
10371- mv_writew: generic_writew,
10372- mv_writel: generic_writel,
10373+ .mv_inb = od_inb,
10374+ .mv_inw = od_inw,
10375+ .mv_inl = od_inl,
10376+ .mv_outb = od_outb,
10377+ .mv_outw = od_outw,
10378+ .mv_outl = od_outl,
10379+
10380+ .mv_inb_p = od_inb_p,
10381+ .mv_inw_p = od_inw_p,
10382+ .mv_inl_p = od_inl_p,
10383+ .mv_outb_p = od_outb_p,
10384+ .mv_outw_p = od_outw_p,
10385+ .mv_outl_p = od_outl_p,
10386+
10387+ .mv_insb = od_insb,
10388+ .mv_insw = od_insw,
10389+ .mv_insl = od_insl,
10390+ .mv_outsb = od_outsb,
10391+ .mv_outsw = od_outsw,
10392+ .mv_outsl = od_outsl,
10393+
10394+ .mv_readb = generic_readb,
10395+ .mv_readw = generic_readw,
10396+ .mv_readl = generic_readl,
10397+ .mv_writeb = generic_writeb,
10398+ .mv_writew = generic_writew,
10399+ .mv_writel = generic_writel,
10400
10401- mv_ioremap: generic_ioremap,
10402- mv_iounmap: generic_iounmap,
10403+ .mv_ioremap = generic_ioremap,
10404+ .mv_iounmap = generic_iounmap,
10405
10406- mv_isa_port2addr: generic_isa_port2addr,
10407+ .mv_isa_port2addr = generic_isa_port2addr,
10408
10409 #ifdef CONFIG_PCI
10410- mv_init_irq: init_overdrive_irq,
10411+ .mv_init_irq = init_overdrive_irq,
10412 #endif
10413 #ifdef CONFIG_HEARTBEAT
10414- mv_heartbeat: heartbeat_od,
10415+ .mv_heartbeat = heartbeat_od,
10416 #endif
10417 };
10418
10419diff -Nru a/arch/sh/boards/saturn/irq.c b/arch/sh/boards/saturn/irq.c
10420--- a/arch/sh/boards/saturn/irq.c Sat Jun 14 11:02:09 2003
10421+++ b/arch/sh/boards/saturn/irq.c Sun Aug 31 16:14:08 2003
10422@@ -102,13 +102,13 @@
10423 }
10424
10425 static struct hw_interrupt_type saturn_int = {
10426- typename: "Saturn",
10427- enable: enable_saturn_irq,
10428- disable: disable_saturn_irq,
10429- ack: mask_and_ack_saturn_irq,
10430- end: end_saturn_irq,
10431- startup: startup_saturn_irq,
10432- shutdown: shutdown_saturn_irq,
10433+ .typename = "Saturn",
10434+ .enable = enable_saturn_irq,
10435+ .disable = disable_saturn_irq,
10436+ .ack = mask_and_ack_saturn_irq,
10437+ .end = end_saturn_irq,
10438+ .startup = startup_saturn_irq,
10439+ .shutdown = shutdown_saturn_irq,
10440 };
10441
10442 int saturn_irq_demux(int irq_nr)
10443diff -Nru a/arch/sh/boards/saturn/mach.c b/arch/sh/boards/saturn/mach.c
10444--- a/arch/sh/boards/saturn/mach.c Mon May 19 16:04:39 2003
10445+++ b/arch/sh/boards/saturn/mach.c Sun Aug 31 16:14:08 2003
10446@@ -18,41 +18,41 @@
10447 * The Machine Vector
10448 */
10449 struct sh_machine_vector mv_saturn __initmv = {
10450- mv_nr_irqs: 80, /* Fix this later */
10451+ .mv_nr_irqs = 80, /* Fix this later */
10452
10453- mv_inb: generic_inb,
10454- mv_inw: generic_inw,
10455- mv_inl: generic_inl,
10456- mv_outb: generic_outb,
10457- mv_outw: generic_outw,
10458- mv_outl: generic_outl,
10459-
10460- mv_inb_p: generic_inb_p,
10461- mv_inw_p: generic_inw_p,
10462- mv_inl_p: generic_inl_p,
10463- mv_outb_p: generic_outb_p,
10464- mv_outw_p: generic_outw_p,
10465- mv_outl_p: generic_outl_p,
10466-
10467- mv_insb: generic_insb,
10468- mv_insw: generic_insw,
10469- mv_insl: generic_insl,
10470- mv_outsb: generic_outsb,
10471- mv_outsw: generic_outsw,
10472- mv_outsl: generic_outsl,
10473-
10474- mv_readb: generic_readb,
10475- mv_readw: generic_readw,
10476- mv_readl: generic_readl,
10477- mv_writeb: generic_writeb,
10478- mv_writew: generic_writew,
10479- mv_writel: generic_writel,
10480+ .mv_inb = generic_inb,
10481+ .mv_inw = generic_inw,
10482+ .mv_inl = generic_inl,
10483+ .mv_outb = generic_outb,
10484+ .mv_outw = generic_outw,
10485+ .mv_outl = generic_outl,
10486+
10487+ .mv_inb_p = generic_inb_p,
10488+ .mv_inw_p = generic_inw_p,
10489+ .mv_inl_p = generic_inl_p,
10490+ .mv_outb_p = generic_outb_p,
10491+ .mv_outw_p = generic_outw_p,
10492+ .mv_outl_p = generic_outl_p,
10493+
10494+ .mv_insb = generic_insb,
10495+ .mv_insw = generic_insw,
10496+ .mv_insl = generic_insl,
10497+ .mv_outsb = generic_outsb,
10498+ .mv_outsw = generic_outsw,
10499+ .mv_outsl = generic_outsl,
10500+
10501+ .mv_readb = generic_readb,
10502+ .mv_readw = generic_readw,
10503+ .mv_readl = generic_readl,
10504+ .mv_writeb = generic_writeb,
10505+ .mv_writew = generic_writew,
10506+ .mv_writel = generic_writel,
10507
10508- mv_isa_port2addr: saturn_isa_port2addr,
10509- mv_irq_demux: saturn_irq_demux,
10510+ .mv_isa_port2addr = saturn_isa_port2addr,
10511+ .mv_irq_demux = saturn_irq_demux,
10512
10513- mv_ioremap: saturn_ioremap,
10514- mv_iounmap: saturn_iounmap,
10515+ .mv_ioremap = saturn_ioremap,
10516+ .mv_iounmap = saturn_iounmap,
10517 };
10518
10519 ALIAS_MV(saturn)
10520diff -Nru a/arch/sh/boards/se/770x/mach.c b/arch/sh/boards/se/770x/mach.c
10521--- a/arch/sh/boards/se/770x/mach.c Mon May 19 16:04:39 2003
10522+++ b/arch/sh/boards/se/770x/mach.c Sun Aug 31 16:14:08 2003
10523@@ -28,49 +28,49 @@
10524
10525 struct sh_machine_vector mv_se __initmv = {
10526 #if defined(CONFIG_CPU_SH4)
10527- mv_nr_irqs: 48,
10528+ .mv_nr_irqs = 48,
10529 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
10530- mv_nr_irqs: 32,
10531+ .mv_nr_irqs = 32,
10532 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
10533- mv_nr_irqs: 61,
10534+ .mv_nr_irqs = 61,
10535 #endif
10536
10537- mv_inb: se_inb,
10538- mv_inw: se_inw,
10539- mv_inl: se_inl,
10540- mv_outb: se_outb,
10541- mv_outw: se_outw,
10542- mv_outl: se_outl,
10543-
10544- mv_inb_p: se_inb_p,
10545- mv_inw_p: se_inw,
10546- mv_inl_p: se_inl,
10547- mv_outb_p: se_outb_p,
10548- mv_outw_p: se_outw,
10549- mv_outl_p: se_outl,
10550-
10551- mv_insb: se_insb,
10552- mv_insw: se_insw,
10553- mv_insl: se_insl,
10554- mv_outsb: se_outsb,
10555- mv_outsw: se_outsw,
10556- mv_outsl: se_outsl,
10557-
10558- mv_readb: se_readb,
10559- mv_readw: se_readw,
10560- mv_readl: se_readl,
10561- mv_writeb: se_writeb,
10562- mv_writew: se_writew,
10563- mv_writel: se_writel,
10564+ .mv_inb = se_inb,
10565+ .mv_inw = se_inw,
10566+ .mv_inl = se_inl,
10567+ .mv_outb = se_outb,
10568+ .mv_outw = se_outw,
10569+ .mv_outl = se_outl,
10570+
10571+ .mv_inb_p = se_inb_p,
10572+ .mv_inw_p = se_inw,
10573+ .mv_inl_p = se_inl,
10574+ .mv_outb_p = se_outb_p,
10575+ .mv_outw_p = se_outw,
10576+ .mv_outl_p = se_outl,
10577+
10578+ .mv_insb = se_insb,
10579+ .mv_insw = se_insw,
10580+ .mv_insl = se_insl,
10581+ .mv_outsb = se_outsb,
10582+ .mv_outsw = se_outsw,
10583+ .mv_outsl = se_outsl,
10584+
10585+ .mv_readb = se_readb,
10586+ .mv_readw = se_readw,
10587+ .mv_readl = se_readl,
10588+ .mv_writeb = se_writeb,
10589+ .mv_writew = se_writew,
10590+ .mv_writel = se_writel,
10591
10592- mv_ioremap: generic_ioremap,
10593- mv_iounmap: generic_iounmap,
10594+ .mv_ioremap = generic_ioremap,
10595+ .mv_iounmap = generic_iounmap,
10596
10597- mv_isa_port2addr: se_isa_port2addr,
10598+ .mv_isa_port2addr = se_isa_port2addr,
10599
10600- mv_init_irq: init_se_IRQ,
10601+ .mv_init_irq = init_se_IRQ,
10602 #ifdef CONFIG_HEARTBEAT
10603- mv_heartbeat: heartbeat_se,
10604+ .mv_heartbeat = heartbeat_se,
10605 #endif
10606 };
10607 ALIAS_MV(se)
10608diff -Nru a/arch/sh/boards/se/7751/mach.c b/arch/sh/boards/se/7751/mach.c
10609--- a/arch/sh/boards/se/7751/mach.c Mon May 19 16:04:39 2003
10610+++ b/arch/sh/boards/se/7751/mach.c Sun Aug 31 16:14:08 2003
10611@@ -26,44 +26,44 @@
10612 */
10613
10614 struct sh_machine_vector mv_7751se __initmv = {
10615- mv_nr_irqs: 72,
10616+ .mv_nr_irqs = 72,
10617
10618- mv_inb: sh7751se_inb,
10619- mv_inw: sh7751se_inw,
10620- mv_inl: sh7751se_inl,
10621- mv_outb: sh7751se_outb,
10622- mv_outw: sh7751se_outw,
10623- mv_outl: sh7751se_outl,
10624-
10625- mv_inb_p: sh7751se_inb_p,
10626- mv_inw_p: sh7751se_inw,
10627- mv_inl_p: sh7751se_inl,
10628- mv_outb_p: sh7751se_outb_p,
10629- mv_outw_p: sh7751se_outw,
10630- mv_outl_p: sh7751se_outl,
10631-
10632- mv_insb: sh7751se_insb,
10633- mv_insw: sh7751se_insw,
10634- mv_insl: sh7751se_insl,
10635- mv_outsb: sh7751se_outsb,
10636- mv_outsw: sh7751se_outsw,
10637- mv_outsl: sh7751se_outsl,
10638-
10639- mv_readb: sh7751se_readb,
10640- mv_readw: sh7751se_readw,
10641- mv_readl: sh7751se_readl,
10642- mv_writeb: sh7751se_writeb,
10643- mv_writew: sh7751se_writew,
10644- mv_writel: sh7751se_writel,
10645+ .mv_inb = sh7751se_inb,
10646+ .mv_inw = sh7751se_inw,
10647+ .mv_inl = sh7751se_inl,
10648+ .mv_outb = sh7751se_outb,
10649+ .mv_outw = sh7751se_outw,
10650+ .mv_outl = sh7751se_outl,
10651+
10652+ .mv_inb_p = sh7751se_inb_p,
10653+ .mv_inw_p = sh7751se_inw,
10654+ .mv_inl_p = sh7751se_inl,
10655+ .mv_outb_p = sh7751se_outb_p,
10656+ .mv_outw_p = sh7751se_outw,
10657+ .mv_outl_p = sh7751se_outl,
10658+
10659+ .mv_insb = sh7751se_insb,
10660+ .mv_insw = sh7751se_insw,
10661+ .mv_insl = sh7751se_insl,
10662+ .mv_outsb = sh7751se_outsb,
10663+ .mv_outsw = sh7751se_outsw,
10664+ .mv_outsl = sh7751se_outsl,
10665+
10666+ .mv_readb = sh7751se_readb,
10667+ .mv_readw = sh7751se_readw,
10668+ .mv_readl = sh7751se_readl,
10669+ .mv_writeb = sh7751se_writeb,
10670+ .mv_writew = sh7751se_writew,
10671+ .mv_writel = sh7751se_writel,
10672
10673- mv_ioremap: generic_ioremap,
10674- mv_iounmap: generic_iounmap,
10675+ .mv_ioremap = generic_ioremap,
10676+ .mv_iounmap = generic_iounmap,
10677
10678- mv_isa_port2addr: sh7751se_isa_port2addr,
10679+ .mv_isa_port2addr = sh7751se_isa_port2addr,
10680
10681- mv_init_irq: init_7751se_IRQ,
10682+ .mv_init_irq = init_7751se_IRQ,
10683 #ifdef CONFIG_HEARTBEAT
10684- mv_heartbeat: heartbeat_7751se,
10685+ .mv_heartbeat = heartbeat_7751se,
10686 #endif
10687 };
10688 ALIAS_MV(7751se)
10689diff -Nru a/arch/sh/boards/sh2000/mach.c b/arch/sh/boards/sh2000/mach.c
10690--- a/arch/sh/boards/sh2000/mach.c Mon May 19 16:04:40 2003
10691+++ b/arch/sh/boards/sh2000/mach.c Sun Aug 31 16:14:08 2003
10692@@ -19,39 +19,39 @@
10693 */
10694
10695 struct sh_machine_vector mv_sh2000 __initmv = {
10696- mv_nr_irqs: 80,
10697+ .mv_nr_irqs = 80,
10698
10699- mv_inb: generic_inb,
10700- mv_inw: generic_inw,
10701- mv_inl: generic_inl,
10702- mv_outb: generic_outb,
10703- mv_outw: generic_outw,
10704- mv_outl: generic_outl,
10705-
10706- mv_inb_p: generic_inb_p,
10707- mv_inw_p: generic_inw_p,
10708- mv_inl_p: generic_inl_p,
10709- mv_outb_p: generic_outb_p,
10710- mv_outw_p: generic_outw_p,
10711- mv_outl_p: generic_outl_p,
10712-
10713- mv_insb: generic_insb,
10714- mv_insw: generic_insw,
10715- mv_insl: generic_insl,
10716- mv_outsb: generic_outsb,
10717- mv_outsw: generic_outsw,
10718- mv_outsl: generic_outsl,
10719-
10720- mv_readb: generic_readb,
10721- mv_readw: generic_readw,
10722- mv_readl: generic_readl,
10723- mv_writeb: generic_writeb,
10724- mv_writew: generic_writew,
10725- mv_writel: generic_writel,
10726+ .mv_inb = generic_inb,
10727+ .mv_inw = generic_inw,
10728+ .mv_inl = generic_inl,
10729+ .mv_outb = generic_outb,
10730+ .mv_outw = generic_outw,
10731+ .mv_outl = generic_outl,
10732+
10733+ .mv_inb_p = generic_inb_p,
10734+ .mv_inw_p = generic_inw_p,
10735+ .mv_inl_p = generic_inl_p,
10736+ .mv_outb_p = generic_outb_p,
10737+ .mv_outw_p = generic_outw_p,
10738+ .mv_outl_p = generic_outl_p,
10739+
10740+ .mv_insb = generic_insb,
10741+ .mv_insw = generic_insw,
10742+ .mv_insl = generic_insl,
10743+ .mv_outsb = generic_outsb,
10744+ .mv_outsw = generic_outsw,
10745+ .mv_outsl = generic_outsl,
10746+
10747+ .mv_readb = generic_readb,
10748+ .mv_readw = generic_readw,
10749+ .mv_readl = generic_readl,
10750+ .mv_writeb = generic_writeb,
10751+ .mv_writew = generic_writew,
10752+ .mv_writel = generic_writel,
10753
10754- mv_isa_port2addr: sh2000_isa_port2addr,
10755+ .mv_isa_port2addr = sh2000_isa_port2addr,
10756
10757- mv_ioremap: generic_ioremap,
10758- mv_iounmap: generic_iounmap,
10759+ .mv_ioremap = generic_ioremap,
10760+ .mv_iounmap = generic_iounmap,
10761 };
10762 ALIAS_MV(sh2000)
10763diff -Nru a/arch/sh/boards/unknown/mach.c b/arch/sh/boards/unknown/mach.c
10764--- a/arch/sh/boards/unknown/mach.c Fri Jan 10 04:26:40 2003
10765+++ b/arch/sh/boards/unknown/mach.c Sun Aug 31 16:14:08 2003
10766@@ -24,44 +24,44 @@
10767
10768 struct sh_machine_vector mv_unknown __initmv = {
10769 #if defined(CONFIG_CPU_SH4)
10770- mv_nr_irqs: 48,
10771+ .mv_nr_irqs = 48,
10772 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
10773- mv_nr_irqs: 32,
10774+ .mv_nr_irqs = 32,
10775 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
10776- mv_nr_irqs: 61,
10777+ .mv_nr_irqs = 61,
10778 #endif
10779
10780- mv_inb: unknown_inb,
10781- mv_inw: unknown_inw,
10782- mv_inl: unknown_inl,
10783- mv_outb: unknown_outb,
10784- mv_outw: unknown_outw,
10785- mv_outl: unknown_outl,
10786-
10787- mv_inb_p: unknown_inb_p,
10788- mv_inw_p: unknown_inw_p,
10789- mv_inl_p: unknown_inl_p,
10790- mv_outb_p: unknown_outb_p,
10791- mv_outw_p: unknown_outw_p,
10792- mv_outl_p: unknown_outl_p,
10793-
10794- mv_insb: unknown_insb,
10795- mv_insw: unknown_insw,
10796- mv_insl: unknown_insl,
10797- mv_outsb: unknown_outsb,
10798- mv_outsw: unknown_outsw,
10799- mv_outsl: unknown_outsl,
10800-
10801- mv_readb: unknown_readb,
10802- mv_readw: unknown_readw,
10803- mv_readl: unknown_readl,
10804- mv_writeb: unknown_writeb,
10805- mv_writew: unknown_writew,
10806- mv_writel: unknown_writel,
10807+ .mv_inb = unknown_inb,
10808+ .mv_inw = unknown_inw,
10809+ .mv_inl = unknown_inl,
10810+ .mv_outb = unknown_outb,
10811+ .mv_outw = unknown_outw,
10812+ .mv_outl = unknown_outl,
10813+
10814+ .mv_inb_p = unknown_inb_p,
10815+ .mv_inw_p = unknown_inw_p,
10816+ .mv_inl_p = unknown_inl_p,
10817+ .mv_outb_p = unknown_outb_p,
10818+ .mv_outw_p = unknown_outw_p,
10819+ .mv_outl_p = unknown_outl_p,
10820+
10821+ .mv_insb = unknown_insb,
10822+ .mv_insw = unknown_insw,
10823+ .mv_insl = unknown_insl,
10824+ .mv_outsb = unknown_outsb,
10825+ .mv_outsw = unknown_outsw,
10826+ .mv_outsl = unknown_outsl,
10827+
10828+ .mv_readb = unknown_readb,
10829+ .mv_readw = unknown_readw,
10830+ .mv_readl = unknown_readl,
10831+ .mv_writeb = unknown_writeb,
10832+ .mv_writew = unknown_writew,
10833+ .mv_writel = unknown_writel,
10834
10835- mv_ioremap: unknown_ioremap,
10836- mv_iounmap: unknown_iounmap,
10837+ .mv_ioremap = unknown_ioremap,
10838+ .mv_iounmap = unknown_iounmap,
10839
10840- mv_isa_port2addr: unknown_isa_port2addr,
10841+ .mv_isa_port2addr = unknown_isa_port2addr,
10842 };
10843 ALIAS_MV(unknown)
10844diff -Nru a/arch/sh/cchips/hd6446x/hd64465/setup.c b/arch/sh/cchips/hd6446x/hd64465/setup.c
10845--- a/arch/sh/cchips/hd6446x/hd64465/setup.c Mon Nov 4 07:33:57 2002
10846+++ b/arch/sh/cchips/hd6446x/hd64465/setup.c Sun Aug 31 16:14:08 2003
10847@@ -89,13 +89,13 @@
10848
10849
10850 static struct hw_interrupt_type hd64465_irq_type = {
10851- typename: "HD64465-IRQ",
10852- startup: startup_hd64465_irq,
10853- shutdown: shutdown_hd64465_irq,
10854- enable: enable_hd64465_irq,
10855- disable: disable_hd64465_irq,
10856- ack: mask_and_ack_hd64465,
10857- end: end_hd64465_irq
10858+ .typename = "HD64465-IRQ",
10859+ .startup = startup_hd64465_irq,
10860+ .shutdown = shutdown_hd64465_irq,
10861+ .enable = enable_hd64465_irq,
10862+ .disable = disable_hd64465_irq,
10863+ .ack = mask_and_ack_hd64465,
10864+ .end = end_hd64465_irq
10865 };
10866
10867
10868diff -Nru a/arch/sparc/Kconfig b/arch/sparc/Kconfig
10869--- a/arch/sparc/Kconfig Sat Aug 2 14:26:16 2003
10870+++ b/arch/sparc/Kconfig Sun Aug 31 16:14:22 2003
10871@@ -254,29 +254,6 @@
10872 <file:Documentation/modules.txt>.
10873 The module will be called openpromfs. If unsure, say M.
10874
10875-config KCORE_ELF
10876- bool
10877- depends on PROC_FS
10878- default y
10879- ---help---
10880- If you enabled support for /proc file system then the file
10881- /proc/kcore will contain the kernel core image. This can be used
10882- in gdb:
10883-
10884- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
10885-
10886- You have two choices here: ELF and A.OUT. Selecting ELF will make
10887- /proc/kcore appear in ELF core format as defined by the Executable
10888- and Linking Format specification. Selecting A.OUT will choose the
10889- old "a.out" format which may be necessary for some old versions
10890- of binutils or on some architectures.
10891-
10892- This is especially useful if you have compiled the kernel with the
10893- "-g" option to preserve debugging information. It is mainly used
10894- for examining kernel data structures on the live kernel so if you
10895- don't understand what this means or are not a kernel hacker, just
10896- leave it at its default value ELF.
10897-
10898 source "fs/Kconfig.binfmt"
10899
10900 config SUNOS_EMUL
10901diff -Nru a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
10902--- a/arch/sparc/kernel/sys_sunos.c Sun May 25 17:00:00 2003
10903+++ b/arch/sparc/kernel/sys_sunos.c Tue Aug 26 09:25:41 2003
10904@@ -92,8 +92,8 @@
10905 * SunOS is so stupid some times... hmph!
10906 */
10907 if (file) {
10908- if(major(file->f_dentry->d_inode->i_rdev) == MEM_MAJOR &&
10909- minor(file->f_dentry->d_inode->i_rdev) == 5) {
10910+ if(imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
10911+ iminor(file->f_dentry->d_inode) == 5) {
10912 flags |= MAP_ANONYMOUS;
10913 fput(file);
10914 file = 0;
10915diff -Nru a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
10916--- a/arch/sparc64/Kconfig Sat Aug 2 14:26:53 2003
10917+++ b/arch/sparc64/Kconfig Sun Aug 31 16:14:22 2003
10918@@ -363,29 +363,6 @@
10919 <file:Documentation/modules.txt>.
10920 The module will be called openpromfs. If unsure, say M.
10921
10922-config KCORE_ELF
10923- bool
10924- depends on PROC_FS
10925- default y
10926- ---help---
10927- If you enabled support for /proc file system then the file
10928- /proc/kcore will contain the kernel core image. This can be used
10929- in gdb:
10930-
10931- $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
10932-
10933- You have two choices here: ELF and A.OUT. Selecting ELF will make
10934- /proc/kcore appear in ELF core format as defined by the Executable
10935- and Linking Format specification. Selecting A.OUT will choose the
10936- old "a.out" format which may be necessary for some old versions
10937- of binutils or on some architectures.
10938-
10939- This is especially useful if you have compiled the kernel with the
10940- "-g" option to preserve debugging information. It is mainly used
10941- for examining kernel data structures on the live kernel so if you
10942- don't understand what this means or are not a kernel hacker, just
10943- leave it at its default value ELF.
10944-
10945 config SPARC32_COMPAT
10946 bool "Kernel support for Linux/Sparc 32bit binary compatibility"
10947 help
10948diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
10949--- a/arch/sparc64/kernel/ioctl32.c Fri Aug 8 14:53:47 2003
10950+++ b/arch/sparc64/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
10951@@ -1388,7 +1388,7 @@
10952 #define IOCTL_TABLE_START \
10953 struct ioctl_trans ioctl_start[] = {
10954 #define IOCTL_TABLE_END \
10955- }; struct ioctl_trans ioctl_end[0];
10956+ };
10957
10958 IOCTL_TABLE_START
10959 #include <linux/compat_ioctl.h>
10960@@ -1583,3 +1583,5 @@
10961 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
10962 /* take care of sizeof(sizeof()) breakage */
10963 IOCTL_TABLE_END
10964+
10965+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
10966diff -Nru a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
10967--- a/arch/sparc64/kernel/sys_sunos32.c Sun May 25 17:00:00 2003
10968+++ b/arch/sparc64/kernel/sys_sunos32.c Tue Aug 26 09:25:41 2003
10969@@ -90,7 +90,7 @@
10970 if (!file)
10971 goto out;
10972 inode = file->f_dentry->d_inode;
10973- if (minor(inode->i_rdev) == MEM_MAJOR && minor(inode->i_rdev) == 5) {
10974+ if (imajor(inode) == MEM_MAJOR && iminor(inode) == 5) {
10975 flags |= MAP_ANONYMOUS;
10976 fput(file);
10977 file = NULL;
10978diff -Nru a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
10979--- a/arch/sparc64/mm/hugetlbpage.c Mon Feb 24 23:13:11 2003
10980+++ b/arch/sparc64/mm/hugetlbpage.c Tue Aug 26 09:41:27 2003
10981@@ -380,207 +380,6 @@
10982 return 1;
10983 }
10984
10985-static struct inode *set_new_inode(unsigned long len, int prot, int flag, int key)
10986-{
10987- struct inode *inode;
10988- int i;
10989-
10990- for (i = 0; i < MAX_ID; i++) {
10991- if (htlbpagek[i].key == 0)
10992- break;
10993- }
10994- if (i == MAX_ID)
10995- return NULL;
10996- inode = kmalloc(sizeof (struct inode), GFP_KERNEL);
10997- if (inode == NULL)
10998- return NULL;
10999-
11000- inode_init_once(inode);
11001- atomic_inc(&inode->i_writecount);
11002- inode->i_mapping = &inode->i_data;
11003- inode->i_mapping->host = inode;
11004- inode->i_ino = (unsigned long)key;
11005-
11006- htlbpagek[i].key = key;
11007- htlbpagek[i].in = inode;
11008- inode->i_uid = current->fsuid;
11009- inode->i_gid = current->fsgid;
11010- inode->i_mode = prot;
11011- inode->i_size = len;
11012- return inode;
11013-}
11014-
11015-static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag)
11016-{
11017- if (inode->i_uid != current->fsuid)
11018- return -1;
11019- if (inode->i_gid != current->fsgid)
11020- return -1;
11021- if (inode->i_size != len)
11022- return -1;
11023- return 0;
11024-}
11025-
11026-static int alloc_shared_hugetlb_pages(int key, unsigned long addr, unsigned long len,
11027- int prot, int flag)
11028-{
11029- struct mm_struct *mm = current->mm;
11030- struct vm_area_struct *vma;
11031- struct inode *inode;
11032- struct address_space *mapping;
11033- struct page *page;
11034- int idx;
11035- int retval = -ENOMEM;
11036- int newalloc = 0;
11037-
11038-try_again:
11039- spin_lock(&htlbpage_lock);
11040-
11041- inode = find_key_inode(key);
11042- if (inode == NULL) {
11043- if (!capable(CAP_SYS_ADMIN)) {
11044- if (!in_group_p(0)) {
11045- retval = -EPERM;
11046- goto out_err;
11047- }
11048- }
11049- if (!(flag & IPC_CREAT)) {
11050- retval = -ENOENT;
11051- goto out_err;
11052- }
11053- inode = set_new_inode(len, prot, flag, key);
11054- if (inode == NULL)
11055- goto out_err;
11056- newalloc = 1;
11057- } else {
11058- if (check_size_prot(inode, len, prot, flag) < 0) {
11059- retval = -EINVAL;
11060- goto out_err;
11061- } else if (atomic_read(&inode->i_writecount)) {
11062- spin_unlock(&htlbpage_lock);
11063- goto try_again;
11064- }
11065- }
11066- spin_unlock(&htlbpage_lock);
11067- mapping = inode->i_mapping;
11068-
11069- addr = do_mmap_pgoff(NULL, addr, len, (unsigned long) prot,
11070- MAP_NORESERVE|MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, 0);
11071- if (IS_ERR((void *) addr))
11072- goto freeinode;
11073-
11074- vma = find_vma(mm, addr);
11075- if (!vma) {
11076- retval = -EINVAL;
11077- goto freeinode;
11078- }
11079-
11080- spin_lock(&mm->page_table_lock);
11081- do {
11082- pte_t *pte = huge_pte_alloc_map(mm, addr);
11083-
11084- if (!pte || !pte_none(pte)) {
11085- if (pte)
11086- pte_unmap(pte);
11087- goto out;
11088- }
11089-
11090- idx = (addr - vma->vm_start) >> HPAGE_SHIFT;
11091- page = find_get_page(mapping, idx);
11092- if (page == NULL) {
11093- page = alloc_hugetlb_page();
11094- if (page == NULL) {
11095- pte_unmap(pte);
11096- retval = -ENOMEM;
11097- goto out;
11098- }
11099- retval = add_to_page_cache(page, mapping,
11100- idx, GFP_ATOMIC);
11101- if (retval) {
11102- pte_unmap(pte);
11103- free_hugetlb_page(page);
11104- goto out;
11105- }
11106- }
11107- set_huge_pte(mm, vma, page, pte,
11108- (vma->vm_flags & VM_WRITE));
11109- pte_unmap(pte);
11110-
11111- addr += HPAGE_SIZE;
11112- } while (addr < vma->vm_end);
11113-
11114- retval = 0;
11115- vma->vm_flags |= (VM_HUGETLB | VM_RESERVED);
11116- vma->vm_ops = &hugetlb_vm_ops;
11117- spin_unlock(&mm->page_table_lock);
11118- spin_lock(&htlbpage_lock);
11119- atomic_set(&inode->i_writecount, 0);
11120- spin_unlock(&htlbpage_lock);
11121-
11122- return retval;
11123-
11124-out:
11125- if (addr > vma->vm_start) {
11126- unsigned long raddr;
11127- raddr = vma->vm_end;
11128- vma->vm_end = addr;
11129-
11130- flush_cache_range(vma, vma->vm_start, vma->vm_end);
11131- zap_hugetlb_resources(vma);
11132- flush_tlb_range(vma, vma->vm_start, vma->vm_end);
11133-
11134- vma->vm_end = raddr;
11135- }
11136- spin_unlock(&mm->page_table_lock);
11137- do_munmap(mm, vma->vm_start, len);
11138- if (newalloc)
11139- goto freeinode;
11140-
11141- return retval;
11142-
11143-out_err:
11144- spin_unlock(&htlbpage_lock);
11145-
11146-freeinode:
11147- if (newalloc) {
11148- for (idx = 0; idx < MAX_ID; idx++) {
11149- if (htlbpagek[idx].key == inode->i_ino) {
11150- htlbpagek[idx].key = 0;
11151- htlbpagek[idx].in = NULL;
11152- break;
11153- }
11154- }
11155- kfree(inode);
11156- }
11157- return retval;
11158-}
11159-
11160-static int alloc_private_hugetlb_pages(int key, unsigned long addr, unsigned long len,
11161- int prot, int flag)
11162-{
11163- if (!capable(CAP_SYS_ADMIN)) {
11164- if (!in_group_p(0))
11165- return -EPERM;
11166- }
11167- addr = do_mmap_pgoff(NULL, addr, len, prot,
11168- MAP_NORESERVE|MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0);
11169- if (IS_ERR((void *) addr))
11170- return -ENOMEM;
11171- if (make_hugetlb_pages_present(addr, (addr + len), flag) < 0) {
11172- do_munmap(current->mm, addr, len);
11173- return -ENOMEM;
11174- }
11175- return 0;
11176-}
11177-
11178-int alloc_hugetlb_pages(int key, unsigned long addr, unsigned long len, int prot,
11179- int flag)
11180-{
11181- if (key > 0)
11182- return alloc_shared_hugetlb_pages(key, addr, len, prot, flag);
11183- return alloc_private_hugetlb_pages(key, addr, len, prot, flag);
11184-}
11185-
11186 extern long htlbzone_pages;
11187 extern struct list_head htlbpage_freelist;
11188
11189diff -Nru a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
11190--- a/arch/sparc64/solaris/misc.c Tue Aug 19 12:12:41 2003
11191+++ b/arch/sparc64/solaris/misc.c Tue Aug 26 09:25:41 2003
11192@@ -77,8 +77,8 @@
11193 goto out;
11194 else {
11195 struct inode * inode = file->f_dentry->d_inode;
11196- if(major(inode->i_rdev) == MEM_MAJOR &&
11197- minor(inode->i_rdev) == 5) {
11198+ if(imajor(inode) == MEM_MAJOR &&
11199+ iminor(inode) == 5) {
11200 flags |= MAP_ANONYMOUS;
11201 fput(file);
11202 file = NULL;
11203diff -Nru a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c
11204--- a/arch/sparc64/solaris/socksys.c Wed May 7 08:47:29 2003
11205+++ b/arch/sparc64/solaris/socksys.c Tue Aug 26 09:25:40 2003
11206@@ -70,14 +70,14 @@
11207 (int (*)(int,int,int))SUNOS(97);
11208 struct sol_socket_struct * sock;
11209
11210- family = ((minor(inode->i_rdev) >> 4) & 0xf);
11211+ family = ((iminor(inode) >> 4) & 0xf);
11212 switch (family) {
11213 case AF_UNIX:
11214 type = SOCK_STREAM;
11215 protocol = 0;
11216 break;
11217 case AF_INET:
11218- protocol = af_inet_protocols[minor(inode->i_rdev) & 0xf];
11219+ protocol = af_inet_protocols[iminor(inode) & 0xf];
11220 switch (protocol) {
11221 case IPPROTO_TCP: type = SOCK_STREAM; break;
11222 case IPPROTO_UDP: type = SOCK_DGRAM; break;
11223diff -Nru a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c
11224--- a/arch/sparc64/solaris/timod.c Fri Jun 6 04:40:53 2003
11225+++ b/arch/sparc64/solaris/timod.c Tue Aug 26 09:25:41 2003
11226@@ -924,7 +924,7 @@
11227 if (!ino) goto out;
11228
11229 if (!ino->i_sock &&
11230- (major(ino->i_rdev) != 30 || minor(ino->i_rdev) != 1))
11231+ (imajor(ino) != 30 || iminor(ino) != 1))
11232 goto out;
11233
11234 ctlptr = (struct strbuf *)A(arg1);
11235diff -Nru a/arch/v850/Kconfig b/arch/v850/Kconfig
11236--- a/arch/v850/Kconfig Sat Aug 2 14:26:16 2003
11237+++ b/arch/v850/Kconfig Sun Aug 31 16:14:22 2003
11238@@ -262,14 +262,6 @@
11239
11240 menu "Executable file formats"
11241
11242-config KCORE_AOUT
11243- bool
11244- default y
11245-
11246-config KCORE_ELF
11247- bool
11248- default y
11249-
11250 source "fs/Kconfig.binfmt"
11251
11252 endmenu
11253diff -Nru a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
11254--- a/arch/v850/kernel/vmlinux.lds.S Mon Aug 4 20:42:12 2003
11255+++ b/arch/v850/kernel/vmlinux.lds.S Tue Aug 26 00:21:26 2003
11256@@ -33,6 +33,30 @@
11257 *(.intv.mach) /* Machine-specific int. vectors. */ \
11258 __intv_end = . ;
11259
11260+#define RODATA_CONTENTS \
11261+ . = ALIGN (16) ; \
11262+ *(.rodata) *(.rodata.*) \
11263+ *(__vermagic) /* Kernel version magic */ \
11264+ *(.rodata1) \
11265+ /* Kernel symbol table: Normal symbols */ \
11266+ ___start___ksymtab = .; \
11267+ *(__ksymtab) \
11268+ ___stop___ksymtab = .; \
11269+ /* Kernel symbol table: GPL-only symbols */ \
11270+ ___start___ksymtab_gpl = .; \
11271+ *(__ksymtab_gpl) \
11272+ ___stop___ksymtab_gpl = .; \
11273+ /* Kernel symbol table: strings */ \
11274+ *(__ksymtab_strings) \
11275+ /* Kernel symbol table: Normal symbols */ \
11276+ ___start___kcrctab = .; \
11277+ *(__kcrctab) \
11278+ ___stop___kcrctab = .; \
11279+ /* Kernel symbol table: GPL-only symbols */ \
11280+ ___start___kcrctab_gpl = .; \
11281+ *(__kcrctab_gpl) \
11282+ ___stop___kcrctab_gpl = .; \
11283+
11284 /* Kernel text segment, and some constant data areas. */
11285 #define TEXT_CONTENTS \
11286 __stext = . ; \
11287@@ -42,7 +66,7 @@
11288 *(.text.lock) \
11289 *(.exitcall.exit) \
11290 __real_etext = . ; /* There may be data after here. */ \
11291- RODATA \
11292+ RODATA_CONTENTS \
11293 . = ALIGN (4) ; \
11294 *(.call_table_data) \
11295 *(.call_table_text) \
11296diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
11297--- a/arch/x86_64/Kconfig Sat Aug 2 14:26:16 2003
11298+++ b/arch/x86_64/Kconfig Sun Aug 31 16:14:22 2003
11299@@ -370,11 +370,6 @@
11300
11301 menu "Executable file formats / Emulations"
11302
11303-config KCORE_ELF
11304- bool
11305- depends on PROC_FS
11306- default y
11307-
11308 source "fs/Kconfig.binfmt"
11309
11310 config IA32_EMULATION
11311diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig
11312--- a/arch/x86_64/defconfig Sat Aug 9 07:53:46 2003
11313+++ b/arch/x86_64/defconfig Sat Aug 23 04:57:05 2003
11314@@ -14,6 +14,7 @@
11315 # Code maturity level options
11316 #
11317 CONFIG_EXPERIMENTAL=y
11318+# CONFIG_BROKEN is not set
11319
11320 #
11321 # General setup
11322@@ -23,10 +24,12 @@
11323 # CONFIG_BSD_PROCESS_ACCT is not set
11324 CONFIG_SYSCTL=y
11325 CONFIG_LOG_BUF_SHIFT=18
11326+# CONFIG_IKCONFIG is not set
11327 # CONFIG_EMBEDDED is not set
11328 CONFIG_KALLSYMS=y
11329 CONFIG_FUTEX=y
11330 CONFIG_EPOLL=y
11331+CONFIG_IOSCHED_NOOP=y
11332 CONFIG_IOSCHED_AS=y
11333 CONFIG_IOSCHED_DEADLINE=y
11334
11335@@ -72,10 +75,10 @@
11336 CONFIG_SOFTWARE_SUSPEND=y
11337
11338 #
11339-# ACPI Support
11340+# ACPI (Advanced Configuration and Power Interface) Support
11341 #
11342+# CONFIG_ACPI_HT is not set
11343 CONFIG_ACPI=y
11344-# CONFIG_ACPI_HT_ONLY is not set
11345 CONFIG_ACPI_BOOT=y
11346 CONFIG_ACPI_SLEEP=y
11347 CONFIG_ACPI_SLEEP_PROC_FS=y
11348@@ -117,7 +120,6 @@
11349 #
11350 # Generic Driver Options
11351 #
11352-# CONFIG_FW_LOADER is not set
11353
11354 #
11355 # Memory Technology Devices (MTD)
11356@@ -159,6 +161,7 @@
11357 CONFIG_IDEDISK_MULTI_MODE=y
11358 # CONFIG_IDEDISK_STROKE is not set
11359 CONFIG_BLK_DEV_IDECD=y
11360+# CONFIG_BLK_DEV_IDETAPE is not set
11361 # CONFIG_BLK_DEV_IDEFLOPPY is not set
11362 # CONFIG_BLK_DEV_IDESCSI is not set
11363 # CONFIG_IDE_TASK_IOCTL is not set
11364@@ -318,7 +321,6 @@
11365 # CONFIG_DECNET is not set
11366 # CONFIG_BRIDGE is not set
11367 # CONFIG_NETFILTER is not set
11368-# CONFIG_XFRM_USER is not set
11369
11370 #
11371 # SCTP Configuration (EXPERIMENTAL)
11372@@ -405,6 +407,7 @@
11373 # CONFIG_HAMACHI is not set
11374 # CONFIG_YELLOWFIN is not set
11375 # CONFIG_R8169 is not set
11376+# CONFIG_SIS190 is not set
11377 # CONFIG_SK98LIN is not set
11378 CONFIG_TIGON3=y
11379
11380@@ -595,10 +598,7 @@
11381 CONFIG_REISERFS_FS=y
11382 # CONFIG_REISERFS_CHECK is not set
11383 # CONFIG_REISERFS_PROC_INFO is not set
11384-CONFIG_JFS_FS=y
11385-CONFIG_JFS_POSIX_ACL=y
11386-# CONFIG_JFS_DEBUG is not set
11387-# CONFIG_JFS_STATISTICS is not set
11388+# CONFIG_JFS_FS is not set
11389 CONFIG_FS_POSIX_ACL=y
11390 # CONFIG_XFS_FS is not set
11391 # CONFIG_MINIX_FS is not set
11392@@ -674,49 +674,6 @@
11393 #
11394 # CONFIG_PARTITION_ADVANCED is not set
11395 CONFIG_MSDOS_PARTITION=y
11396-CONFIG_NLS=y
11397-
11398-#
11399-# Native Language Support
11400-#
11401-CONFIG_NLS_DEFAULT="iso8859-1"
11402-# CONFIG_NLS_CODEPAGE_437 is not set
11403-# CONFIG_NLS_CODEPAGE_737 is not set
11404-# CONFIG_NLS_CODEPAGE_775 is not set
11405-# CONFIG_NLS_CODEPAGE_850 is not set
11406-# CONFIG_NLS_CODEPAGE_852 is not set
11407-# CONFIG_NLS_CODEPAGE_855 is not set
11408-# CONFIG_NLS_CODEPAGE_857 is not set
11409-# CONFIG_NLS_CODEPAGE_860 is not set
11410-# CONFIG_NLS_CODEPAGE_861 is not set
11411-# CONFIG_NLS_CODEPAGE_862 is not set
11412-# CONFIG_NLS_CODEPAGE_863 is not set
11413-# CONFIG_NLS_CODEPAGE_864 is not set
11414-# CONFIG_NLS_CODEPAGE_865 is not set
11415-# CONFIG_NLS_CODEPAGE_866 is not set
11416-# CONFIG_NLS_CODEPAGE_869 is not set
11417-# CONFIG_NLS_CODEPAGE_936 is not set
11418-# CONFIG_NLS_CODEPAGE_950 is not set
11419-# CONFIG_NLS_CODEPAGE_932 is not set
11420-# CONFIG_NLS_CODEPAGE_949 is not set
11421-# CONFIG_NLS_CODEPAGE_874 is not set
11422-# CONFIG_NLS_ISO8859_8 is not set
11423-# CONFIG_NLS_CODEPAGE_1250 is not set
11424-# CONFIG_NLS_CODEPAGE_1251 is not set
11425-# CONFIG_NLS_ISO8859_1 is not set
11426-# CONFIG_NLS_ISO8859_2 is not set
11427-# CONFIG_NLS_ISO8859_3 is not set
11428-# CONFIG_NLS_ISO8859_4 is not set
11429-# CONFIG_NLS_ISO8859_5 is not set
11430-# CONFIG_NLS_ISO8859_6 is not set
11431-# CONFIG_NLS_ISO8859_7 is not set
11432-# CONFIG_NLS_ISO8859_9 is not set
11433-# CONFIG_NLS_ISO8859_13 is not set
11434-# CONFIG_NLS_ISO8859_14 is not set
11435-# CONFIG_NLS_ISO8859_15 is not set
11436-# CONFIG_NLS_KOI8_R is not set
11437-# CONFIG_NLS_KOI8_U is not set
11438-# CONFIG_NLS_UTF8 is not set
11439
11440 #
11441 # Graphics support
11442diff -Nru a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
11443--- a/arch/x86_64/ia32/ia32_ioctl.c Fri Jul 11 05:14:13 2003
11444+++ b/arch/x86_64/ia32/ia32_ioctl.c Sun Aug 31 16:14:44 2003
11445@@ -673,12 +673,10 @@
11446 return err;
11447 }
11448
11449-#define REF_SYMBOL(handler) if (0) (void)handler;
11450-#define HANDLE_IOCTL2(cmd,handler) REF_SYMBOL(handler); asm volatile(".quad %P0, " #handler ",0"::"i" (cmd));
11451-#define HANDLE_IOCTL(cmd,handler) HANDLE_IOCTL2(cmd,handler)
11452+#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
11453 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
11454-#define IOCTL_TABLE_START void ioctl_dummy(void) { asm volatile("\n.global ioctl_start\nioctl_start:\n\t" );
11455-#define IOCTL_TABLE_END asm volatile("\n.global ioctl_end;\nioctl_end:\n"); }
11456+#define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
11457+#define IOCTL_TABLE_END };
11458
11459 IOCTL_TABLE_START
11460 #include <linux/compat_ioctl.h>
11461@@ -765,3 +763,4 @@
11462 HANDLE_IOCTL(MTRRIOC32_KILL_PAGE_ENTRY, mtrr_ioctl32)
11463 IOCTL_TABLE_END
11464
11465+int ioctl_table_size = ARRAY_SIZE(ioctl_start);
11466diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
11467--- a/arch/x86_64/ia32/sys_ia32.c Mon Jul 14 04:19:39 2003
11468+++ b/arch/x86_64/ia32/sys_ia32.c Sun Aug 31 05:33:07 2003
11469@@ -1170,8 +1170,6 @@
11470 return ret;
11471 }
11472
11473-extern void check_pending(int signum);
11474-
11475 asmlinkage long sys_utimes(char *, struct timeval *);
11476
11477 asmlinkage long
11478diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
11479--- a/arch/x86_64/kernel/apic.c Mon Aug 18 19:46:23 2003
11480+++ b/arch/x86_64/kernel/apic.c Sat Aug 23 05:13:33 2003
11481@@ -299,7 +299,7 @@
11482 * This is meaningless in clustered apic mode, so we skip it.
11483 */
11484 if (!clustered_apic_mode &&
11485- !cpu_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map))
11486+ !physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map))
11487 BUG();
11488
11489 /*
11490@@ -993,7 +993,7 @@
11491
11492 connect_bsp_APIC();
11493
11494- phys_cpu_present_map = cpumask_of_cpu(0);
11495+ phys_cpu_present_map = physid_mask_of_physid(0);
11496 apic_write_around(APIC_ID, boot_cpu_id);
11497
11498 setup_local_APIC();
11499diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
11500--- a/arch/x86_64/kernel/io_apic.c Tue Aug 19 07:45:10 2003
11501+++ b/arch/x86_64/kernel/io_apic.c Sat Aug 23 05:13:33 2003
11502@@ -1014,7 +1014,7 @@
11503 static void __init setup_ioapic_ids_from_mpc (void)
11504 {
11505 union IO_APIC_reg_00 reg_00;
11506- cpumask_t phys_id_present_map = phys_cpu_present_map;
11507+ physid_mask_t phys_id_present_map = phys_cpu_present_map;
11508 int apic;
11509 int i;
11510 unsigned char old_id;
11511@@ -1047,22 +1047,22 @@
11512 * system must have a unique ID or we get lots of nice
11513 * 'stuck on smp_invalidate_needed IPI wait' messages.
11514 */
11515- if (cpu_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map)) {
11516+ if (physid_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map)) {
11517 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
11518 apic, mp_ioapics[apic].mpc_apicid);
11519 for (i = 0; i < 0xf; i++)
11520- if (!cpu_isset(i, phys_id_present_map))
11521+ if (!physid_isset(i, phys_id_present_map))
11522 break;
11523 if (i >= 0xf)
11524 panic("Max APIC ID exceeded!\n");
11525 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
11526 i);
11527- cpu_set(i, phys_id_present_map);
11528+ physid_set(i, phys_id_present_map);
11529 mp_ioapics[apic].mpc_apicid = i;
11530 } else {
11531 printk(KERN_INFO
11532 "Using IO-APIC %d\n", mp_ioapics[apic].mpc_apicid);
11533- cpu_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
11534+ physid_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
11535 }
11536
11537
11538@@ -1642,7 +1642,7 @@
11539 int __init io_apic_get_unique_id (int ioapic, int apic_id)
11540 {
11541 union IO_APIC_reg_00 reg_00;
11542- static cpumask_t apic_id_map;
11543+ static physid_mask_t apic_id_map;
11544 unsigned long flags;
11545 int i = 0;
11546
11547@@ -1655,7 +1655,7 @@
11548 * advantage of new APIC bus architecture.
11549 */
11550
11551- if (!cpus_empty(apic_id_map))
11552+ if (!physids_empty(apic_id_map))
11553 apic_id_map = phys_cpu_present_map;
11554
11555 spin_lock_irqsave(&ioapic_lock, flags);
11556@@ -1672,10 +1672,10 @@
11557 * Every APIC in a system must have a unique ID or we get lots of nice
11558 * 'stuck on smp_invalidate_needed IPI wait' messages.
11559 */
11560- if (cpu_isset(apic_id, apic_id_map)) {
11561+ if (physid_isset(apic_id, apic_id_map)) {
11562
11563 for (i = 0; i < IO_APIC_MAX_ID; i++) {
11564- if (!cpu_isset(i, apic_id_map))
11565+ if (!physid_isset(i, apic_id_map))
11566 break;
11567 }
11568
11569@@ -1688,7 +1688,7 @@
11570 apic_id = i;
11571 }
11572
11573- cpu_set(apic_id, apic_id_map);
11574+ physid_set(apic_id, apic_id_map);
11575
11576 if (reg_00.bits.ID != apic_id) {
11577 reg_00.bits.ID = apic_id;
11578diff -Nru a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c
11579--- a/arch/x86_64/kernel/ioport.c Wed Aug 20 10:43:52 2003
11580+++ b/arch/x86_64/kernel/ioport.c Sat Aug 23 05:03:34 2003
11581@@ -10,12 +10,11 @@
11582 #include <linux/errno.h>
11583 #include <linux/types.h>
11584 #include <linux/ioport.h>
11585-#include <linux/mm.h>
11586 #include <linux/smp.h>
11587 #include <linux/smp_lock.h>
11588 #include <linux/stddef.h>
11589 #include <linux/slab.h>
11590-#include <asm/io.h>
11591+#include <linux/thread_info.h>
11592
11593 /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
11594 static void set_bitmap(unsigned long *bitmap, unsigned int base, unsigned int extent, int new_value)
11595@@ -118,12 +117,7 @@
11596 return -EPERM;
11597 }
11598 regs.eflags = (regs.eflags &~ 0x3000UL) | (level << 12);
11599+ /* Make sure we return the long way (not sysenter) */
11600+ set_thread_flag(TIF_IRET);
11601 return 0;
11602 }
11603-
11604-void eat_key(void)
11605-{
11606- if (inb(0x60) & 1)
11607- inb(0x64);
11608-}
11609-
11610diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
11611--- a/arch/x86_64/kernel/mpparse.c Tue Aug 19 07:45:28 2003
11612+++ b/arch/x86_64/kernel/mpparse.c Sat Aug 23 05:13:33 2003
11613@@ -67,7 +67,7 @@
11614 static unsigned int num_processors = 0;
11615
11616 /* Bitmask of physically existing CPUs */
11617-cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
11618+physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
11619
11620 /* ACPI MADT entry parsing functions */
11621 #ifdef CONFIG_ACPI_BOOT
11622@@ -126,7 +126,7 @@
11623 }
11624 ver = m->mpc_apicver;
11625
11626- cpu_set(m->mpc_apicid, phys_cpu_present_map);
11627+ physid_set(m->mpc_apicid, phys_cpu_present_map);
11628 /*
11629 * Validate version
11630 */
11631diff -Nru a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c
11632--- a/arch/x86_64/kernel/msr.c Mon Aug 18 19:46:23 2003
11633+++ b/arch/x86_64/kernel/msr.c Tue Aug 26 09:25:40 2003
11634@@ -194,7 +194,7 @@
11635 u32 data[2];
11636 size_t rv;
11637 u32 reg = *ppos;
11638- int cpu = minor(file->f_dentry->d_inode->i_rdev);
11639+ int cpu = iminor(file->f_dentry->d_inode);
11640 int err;
11641
11642 if ( count % 8 )
11643@@ -219,7 +219,7 @@
11644 u32 data[2];
11645 size_t rv;
11646 u32 reg = *ppos;
11647- int cpu = minor(file->f_dentry->d_inode->i_rdev);
11648+ int cpu = iminor(file->f_dentry->d_inode);
11649 int err;
11650
11651 if ( count % 8 )
11652@@ -239,7 +239,7 @@
11653
11654 static int msr_open(struct inode *inode, struct file *file)
11655 {
11656- int cpu = minor(file->f_dentry->d_inode->i_rdev);
11657+ int cpu = iminor(file->f_dentry->d_inode);
11658 struct cpuinfo_x86 *c = &(cpu_data)[cpu];
11659
11660 if (!cpu_online(cpu))
11661diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
11662--- a/arch/x86_64/kernel/setup.c Mon Aug 18 19:46:23 2003
11663+++ b/arch/x86_64/kernel/setup.c Sat Aug 23 04:55:48 2003
11664@@ -243,6 +243,8 @@
11665
11666 void __init setup_arch(char **cmdline_p)
11667 {
11668+ unsigned long low_mem_size;
11669+
11670 ROOT_DEV = ORIG_ROOT_DEV;
11671 drive_info = DRIVE_INFO;
11672 screen_info = SCREEN_INFO;
11673@@ -378,7 +380,13 @@
11674 request_resource(&ioport_resource, standard_io_resources+i);
11675 }
11676
11677- pci_mem_start = IOMAP_START;
11678+ /* Will likely break when you have unassigned resources with more
11679+ than 4GB memory and bridges that don't support more than 4GB.
11680+ Doing it properly would require to allocate GFP_DMA memory
11681+ in this case. */
11682+ low_mem_size = ((end_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
11683+ if (low_mem_size > pci_mem_start)
11684+ pci_mem_start = low_mem_size;
11685
11686 #ifdef CONFIG_GART_IOMMU
11687 iommu_hole_init();
11688diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
11689--- a/arch/x86_64/kernel/smpboot.c Mon Aug 18 19:46:23 2003
11690+++ b/arch/x86_64/kernel/smpboot.c Sat Aug 23 05:13:33 2003
11691@@ -734,10 +734,10 @@
11692 current_thread_info()->cpu = 0;
11693 smp_tune_scheduling();
11694
11695- if (!cpu_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
11696+ if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
11697 printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
11698 hard_smp_processor_id());
11699- cpu_set(hard_smp_processor_id(), phys_cpu_present_map);
11700+ physid_set(hard_smp_processor_id(), phys_cpu_present_map);
11701 }
11702
11703 /*
11704@@ -748,7 +748,7 @@
11705 printk(KERN_NOTICE "SMP motherboard not detected.\n");
11706 io_apic_irqs = 0;
11707 cpu_online_map = cpumask_of_cpu(0);
11708- phys_cpu_present_map = cpumask_of_cpu(0);
11709+ phys_cpu_present_map = physid_mask_of_physid(0);
11710 if (APIC_init_uniprocessor())
11711 printk(KERN_NOTICE "Local APIC not detected."
11712 " Using dummy APIC emulation.\n");
11713@@ -759,10 +759,10 @@
11714 * Should not be necessary because the MP table should list the boot
11715 * CPU too, but we do it for the sake of robustness anyway.
11716 */
11717- if (!cpu_isset(boot_cpu_id, phys_cpu_present_map)) {
11718+ if (!physid_isset(boot_cpu_id, phys_cpu_present_map)) {
11719 printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n",
11720 boot_cpu_id);
11721- cpu_set(hard_smp_processor_id(), phys_cpu_present_map);
11722+ physid_set(hard_smp_processor_id(), phys_cpu_present_map);
11723 }
11724
11725 /*
11726@@ -774,7 +774,7 @@
11727 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
11728 io_apic_irqs = 0;
11729 cpu_online_map = cpumask_of_cpu(0);
11730- phys_cpu_present_map = cpumask_of_cpu(0);
11731+ phys_cpu_present_map = physid_mask_of_physid(0);
11732 disable_apic = 1;
11733 goto smp_done;
11734 }
11735@@ -789,7 +789,7 @@
11736 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
11737 io_apic_irqs = 0;
11738 cpu_online_map = cpumask_of_cpu(0);
11739- phys_cpu_present_map = cpumask_of_cpu(0);
11740+ phys_cpu_present_map = physid_mask_of_physid(0);
11741 disable_apic = 1;
11742 goto smp_done;
11743 }
11744@@ -803,7 +803,7 @@
11745 /*
11746 * Now scan the CPU present map and fire up the other CPUs.
11747 */
11748- Dprintk("CPU present map: %lx\n", phys_cpu_present_map);
11749+ Dprintk("CPU present map: %lx\n", physids_coerce(phys_cpu_present_map));
11750
11751 for (apicid = 0; apicid < NR_CPUS; apicid++) {
11752 /*
11753diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
11754--- a/arch/x86_64/kernel/time.c Thu Jul 10 22:22:57 2003
11755+++ b/arch/x86_64/kernel/time.c Sat Aug 23 04:31:18 2003
11756@@ -79,6 +79,7 @@
11757 unsigned long t;
11758 unsigned long x;
11759 rdtscll_sync(&t);
11760+ if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */
11761 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32;
11762 return x;
11763 }
11764diff -Nru a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
11765--- a/arch/x86_64/kernel/vsyscall.c Fri Jun 13 01:16:29 2003
11766+++ b/arch/x86_64/kernel/vsyscall.c Sat Aug 23 04:31:40 2003
11767@@ -85,6 +85,7 @@
11768 if (__vxtime.mode == VXTIME_TSC) {
11769 sync_core();
11770 rdtscll(t);
11771+ if (t < __vxtime.last_tsc) t = __vxtime.last_tsc;
11772 usec += ((t - __vxtime.last_tsc) *
11773 __vxtime.tsc_quot) >> 32;
11774 } else {
11775diff -Nru a/drivers/Makefile b/drivers/Makefile
11776--- a/drivers/Makefile Tue Aug 12 08:42:21 2003
11777+++ b/drivers/Makefile Sun Aug 24 07:59:26 2003
11778@@ -20,6 +20,7 @@
11779 obj-y += base/ block/ misc/ net/ media/
11780 obj-$(CONFIG_NUBUS) += nubus/
11781 obj-$(CONFIG_ATM) += atm/
11782+obj-$(CONFIG_PPC_PMAC) += macintosh/
11783 obj-$(CONFIG_IDE) += ide/
11784 obj-$(CONFIG_FC4) += fc4/
11785 obj-$(CONFIG_SCSI) += scsi/
11786@@ -31,7 +32,6 @@
11787 obj-$(CONFIG_DIO) += dio/
11788 obj-$(CONFIG_SBUS) += sbus/
11789 obj-$(CONFIG_ZORRO) += zorro/
11790-obj-$(CONFIG_PPC_PMAC) += macintosh/
11791 obj-$(CONFIG_MAC) += macintosh/
11792 obj-$(CONFIG_PARIDE) += block/paride/
11793 obj-$(CONFIG_TC) += tc/
11794diff -Nru a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
11795--- a/drivers/acorn/block/fd1772.c Thu Aug 7 02:25:23 2003
11796+++ b/drivers/acorn/block/fd1772.c Tue Aug 26 09:25:40 2003
11797@@ -1455,8 +1455,8 @@
11798
11799 static int floppy_open(struct inode *inode, struct file *filp)
11800 {
11801- int drive = minor(inode->i_rdev) & 3;
11802- int type = minor(inode->i_rdev) >> 2;
11803+ int drive = iminor(inode) & 3;
11804+ int type = iminor(inode) >> 2;
11805 int old_dev = fd_device[drive];
11806
11807 if (fd_ref[drive] && old_dev != type)
11808@@ -1490,7 +1490,7 @@
11809
11810 static int floppy_release(struct inode *inode, struct file *filp)
11811 {
11812- int drive = minor(inode->i_rdev) & 3;
11813+ int drive = iminor(inode) & 3;
11814
11815 if (fd_ref[drive] < 0)
11816 fd_ref[drive] = 0;
11817diff -Nru a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
11818--- a/drivers/acpi/Kconfig Wed Aug 20 09:06:49 2003
11819+++ b/drivers/acpi/Kconfig Sat Aug 23 04:07:34 2003
11820@@ -69,6 +69,7 @@
11821 bool "Sleep States (EXPERIMENTAL)"
11822 depends on X86 && ACPI
11823 depends on EXPERIMENTAL && PM
11824+ select SOFTWARE_SUSPEND
11825 default y
11826 ---help---
11827 This option adds support for ACPI suspend states.
11828diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
11829--- a/drivers/acpi/pci_link.c Tue Jul 29 13:28:29 2003
11830+++ b/drivers/acpi/pci_link.c Sun Aug 31 16:14:25 2003
11831@@ -516,9 +516,8 @@
11832 return_VALUE(0);
11833 }
11834
11835- if (acpi_pci_link_allocate(link)) {
11836- return -ENODEV;
11837- }
11838+ if (acpi_pci_link_allocate(link))
11839+ return_VALUE(0);
11840
11841 if (!link->irq.active) {
11842 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link disabled\n"));
11843diff -Nru a/drivers/atm/eni.c b/drivers/atm/eni.c
11844--- a/drivers/atm/eni.c Tue Aug 19 21:10:45 2003
11845+++ b/drivers/atm/eni.c Sun Aug 31 16:14:27 2003
11846@@ -2345,7 +2345,7 @@
11847 struct sk_buff *skb; /* dummy for sizeof */
11848
11849 if (sizeof(skb->cb) < sizeof(struct eni_skb_prv)) {
11850- printk(KERN_ERR "eni_detect: skb->cb is too small (%d < %d)\n",
11851+ printk(KERN_ERR "eni_detect: skb->cb is too small (%Zd < %Zd)\n",
11852 sizeof(skb->cb),sizeof(struct eni_skb_prv));
11853 return -EIO;
11854 }
11855diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c
11856--- a/drivers/atm/firestream.c Tue Aug 19 21:10:45 2003
11857+++ b/drivers/atm/firestream.c Sun Aug 31 16:14:27 2003
11858@@ -895,7 +895,7 @@
11859 /* XXX handle qos parameters (rate limiting) ? */
11860
11861 vcc = kmalloc(sizeof(struct fs_vcc), GFP_KERNEL);
11862- fs_dprintk (FS_DEBUG_ALLOC, "Alloc VCC: %p(%d)\n", vcc, sizeof(struct fs_vcc));
11863+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc VCC: %p(%Zd)\n", vcc, sizeof(struct fs_vcc));
11864 if (!vcc) {
11865 clear_bit(ATM_VF_ADDR, &atm_vcc->flags);
11866 return -ENOMEM;
11867@@ -946,7 +946,7 @@
11868
11869 if (DO_DIRECTION (txtp)) {
11870 tc = kmalloc (sizeof (struct fs_transmit_config), GFP_KERNEL);
11871- fs_dprintk (FS_DEBUG_ALLOC, "Alloc tc: %p(%d)\n",
11872+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc tc: %p(%Zd)\n",
11873 tc, sizeof (struct fs_transmit_config));
11874 if (!tc) {
11875 fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n");
11876@@ -1180,7 +1180,7 @@
11877 vcc->last_skb = skb;
11878
11879 td = kmalloc (sizeof (struct FS_BPENTRY), GFP_ATOMIC);
11880- fs_dprintk (FS_DEBUG_ALLOC, "Alloc transd: %p(%d)\n", td, sizeof (struct FS_BPENTRY));
11881+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc transd: %p(%Zd)\n", td, sizeof (struct FS_BPENTRY));
11882 if (!td) {
11883 /* Oops out of mem */
11884 return -ENOMEM;
11885@@ -1487,7 +1487,7 @@
11886 fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-skb: %p(%d)\n", skb, fp->bufsize);
11887 if (!skb) break;
11888 ne = kmalloc (sizeof (struct FS_BPENTRY), gfp_flags);
11889- fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-d: %p(%d)\n", ne, sizeof (struct FS_BPENTRY));
11890+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-d: %p(%Zd)\n", ne, sizeof (struct FS_BPENTRY));
11891 if (!ne) {
11892 fs_dprintk (FS_DEBUG_ALLOC, "Free rec-skb: %p\n", skb);
11893 dev_kfree_skb_any (skb);
11894@@ -1792,7 +1792,7 @@
11895 }
11896 dev->atm_vccs = kmalloc (dev->nchannels * sizeof (struct atm_vcc *),
11897 GFP_KERNEL);
11898- fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%d)\n",
11899+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%Zd)\n",
11900 dev->atm_vccs, dev->nchannels * sizeof (struct atm_vcc *));
11901
11902 if (!dev->atm_vccs) {
11903@@ -1900,7 +1900,7 @@
11904 goto err_out;
11905
11906 fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
11907- fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%d)\n",
11908+ fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%Zd)\n",
11909 fs_dev, sizeof (struct fs_dev));
11910 if (!fs_dev)
11911 goto err_out;
11912diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
11913--- a/drivers/block/DAC960.c Fri Aug 15 09:39:48 2003
11914+++ b/drivers/block/DAC960.c Sun Aug 31 16:13:56 2003
11915@@ -23,6 +23,7 @@
11916 #include <linux/version.h>
11917 #include <linux/module.h>
11918 #include <linux/types.h>
11919+#include <linux/miscdevice.h>
11920 #include <linux/blkdev.h>
11921 #include <linux/bio.h>
11922 #include <linux/completion.h>
11923@@ -44,6 +45,8 @@
11924 #include <asm/uaccess.h>
11925 #include "DAC960.h"
11926
11927+#define DAC960_GAM_MINOR 252
11928+
11929
11930 static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers];
11931 static int DAC960_ControllerCount;
11932@@ -71,10 +74,6 @@
11933 DAC960_Controller_T *p = disk->queue->queuedata;
11934 int drive_nr = (int)disk->private_data;
11935
11936- /* bad hack for the "user" ioctls */
11937- if (!p->ControllerNumber && !drive_nr && (file->f_flags & O_NONBLOCK))
11938- return 0;
11939-
11940 if (p->FirmwareType == DAC960_V1_Controller) {
11941 if (p->V1.LogicalDriveInformation[drive_nr].
11942 LogicalDriveState == DAC960_V1_LogicalDrive_Offline)
11943@@ -101,9 +100,6 @@
11944 int drive_nr = (int)disk->private_data;
11945 struct hd_geometry g, *loc = (struct hd_geometry *)arg;
11946
11947- if (file && (file->f_flags & O_NONBLOCK))
11948- return DAC960_UserIOCTL(inode, file, cmd, arg);
11949-
11950 if (cmd != HDIO_GETGEO || !loc)
11951 return -EINVAL;
11952
11953@@ -5569,407 +5565,6 @@
11954 }
11955
11956 /*
11957- DAC960_UserIOCTL is the User IOCTL Function for the DAC960 Driver.
11958-*/
11959-
11960-static int DAC960_UserIOCTL(struct inode *inode, struct file *file,
11961- unsigned int Request, unsigned long Argument)
11962-{
11963- int ErrorCode = 0;
11964- if (!capable(CAP_SYS_ADMIN)) return -EACCES;
11965- switch (Request)
11966- {
11967- case DAC960_IOCTL_GET_CONTROLLER_COUNT:
11968- return DAC960_ControllerCount;
11969- case DAC960_IOCTL_GET_CONTROLLER_INFO:
11970- {
11971- DAC960_ControllerInfo_T *UserSpaceControllerInfo =
11972- (DAC960_ControllerInfo_T *) Argument;
11973- DAC960_ControllerInfo_T ControllerInfo;
11974- DAC960_Controller_T *Controller;
11975- int ControllerNumber;
11976- if (UserSpaceControllerInfo == NULL) return -EINVAL;
11977- ErrorCode = get_user(ControllerNumber,
11978- &UserSpaceControllerInfo->ControllerNumber);
11979- if (ErrorCode != 0) return ErrorCode;
11980- if (ControllerNumber < 0 ||
11981- ControllerNumber > DAC960_ControllerCount - 1)
11982- return -ENXIO;
11983- Controller = DAC960_Controllers[ControllerNumber];
11984- if (Controller == NULL) return -ENXIO;
11985- memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T));
11986- ControllerInfo.ControllerNumber = ControllerNumber;
11987- ControllerInfo.FirmwareType = Controller->FirmwareType;
11988- ControllerInfo.Channels = Controller->Channels;
11989- ControllerInfo.Targets = Controller->Targets;
11990- ControllerInfo.PCI_Bus = Controller->Bus;
11991- ControllerInfo.PCI_Device = Controller->Device;
11992- ControllerInfo.PCI_Function = Controller->Function;
11993- ControllerInfo.IRQ_Channel = Controller->IRQ_Channel;
11994- ControllerInfo.PCI_Address = Controller->PCI_Address;
11995- strcpy(ControllerInfo.ModelName, Controller->ModelName);
11996- strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion);
11997- return (copy_to_user(UserSpaceControllerInfo, &ControllerInfo,
11998- sizeof(DAC960_ControllerInfo_T)) ? -EFAULT : 0);
11999- }
12000- case DAC960_IOCTL_V1_EXECUTE_COMMAND:
12001- {
12002- DAC960_V1_UserCommand_T *UserSpaceUserCommand =
12003- (DAC960_V1_UserCommand_T *) Argument;
12004- DAC960_V1_UserCommand_T UserCommand;
12005- DAC960_Controller_T *Controller;
12006- DAC960_Command_T *Command = NULL;
12007- DAC960_V1_CommandOpcode_T CommandOpcode;
12008- DAC960_V1_CommandStatus_T CommandStatus;
12009- DAC960_V1_DCDB_T DCDB;
12010- DAC960_V1_DCDB_T *DCDB_IOBUF = NULL;
12011- dma_addr_t DCDB_IOBUFDMA;
12012- unsigned long flags;
12013- int ControllerNumber, DataTransferLength;
12014- unsigned char *DataTransferBuffer = NULL;
12015- dma_addr_t DataTransferBufferDMA;
12016- if (UserSpaceUserCommand == NULL) return -EINVAL;
12017- if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12018- sizeof(DAC960_V1_UserCommand_T))) {
12019- ErrorCode = -EFAULT;
12020- goto Failure1a;
12021- }
12022- ControllerNumber = UserCommand.ControllerNumber;
12023- if (ControllerNumber < 0 ||
12024- ControllerNumber > DAC960_ControllerCount - 1)
12025- return -ENXIO;
12026- Controller = DAC960_Controllers[ControllerNumber];
12027- if (Controller == NULL) return -ENXIO;
12028- if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL;
12029- CommandOpcode = UserCommand.CommandMailbox.Common.CommandOpcode;
12030- DataTransferLength = UserCommand.DataTransferLength;
12031- if (CommandOpcode & 0x80) return -EINVAL;
12032- if (CommandOpcode == DAC960_V1_DCDB)
12033- {
12034- if (copy_from_user(&DCDB, UserCommand.DCDB,
12035- sizeof(DAC960_V1_DCDB_T))) {
12036- ErrorCode = -EFAULT;
12037- goto Failure1a;
12038- }
12039- if (DCDB.Channel >= DAC960_V1_MaxChannels) return -EINVAL;
12040- if (!((DataTransferLength == 0 &&
12041- DCDB.Direction
12042- == DAC960_V1_DCDB_NoDataTransfer) ||
12043- (DataTransferLength > 0 &&
12044- DCDB.Direction
12045- == DAC960_V1_DCDB_DataTransferDeviceToSystem) ||
12046- (DataTransferLength < 0 &&
12047- DCDB.Direction
12048- == DAC960_V1_DCDB_DataTransferSystemToDevice)))
12049- return -EINVAL;
12050- if (((DCDB.TransferLengthHigh4 << 16) | DCDB.TransferLength)
12051- != abs(DataTransferLength))
12052- return -EINVAL;
12053- DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice,
12054- sizeof(DAC960_V1_DCDB_T), &DCDB_IOBUFDMA);
12055- if (DCDB_IOBUF == NULL)
12056- return -ENOMEM;
12057- }
12058- if (DataTransferLength > 0)
12059- {
12060- DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12061- DataTransferLength, &DataTransferBufferDMA);
12062- if (DataTransferBuffer == NULL) {
12063- ErrorCode = -ENOMEM;
12064- goto Failure1;
12065- }
12066- memset(DataTransferBuffer, 0, DataTransferLength);
12067- }
12068- else if (DataTransferLength < 0)
12069- {
12070- DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12071- -DataTransferLength, &DataTransferBufferDMA);
12072- if (DataTransferBuffer == NULL) {
12073- ErrorCode = -ENOMEM;
12074- goto Failure1;
12075- }
12076- if (copy_from_user(DataTransferBuffer,
12077- UserCommand.DataTransferBuffer,
12078- -DataTransferLength)) {
12079- ErrorCode = -EFAULT;
12080- goto Failure1;
12081- }
12082- }
12083- if (CommandOpcode == DAC960_V1_DCDB)
12084- {
12085- spin_lock_irqsave(&Controller->queue_lock, flags);
12086- while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12087- DAC960_WaitForCommand(Controller);
12088- while (Controller->V1.DirectCommandActive[DCDB.Channel]
12089- [DCDB.TargetID])
12090- {
12091- spin_unlock_irq(&Controller->queue_lock);
12092- __wait_event(Controller->CommandWaitQueue,
12093- !Controller->V1.DirectCommandActive
12094- [DCDB.Channel][DCDB.TargetID]);
12095- spin_lock_irq(&Controller->queue_lock);
12096- }
12097- Controller->V1.DirectCommandActive[DCDB.Channel]
12098- [DCDB.TargetID] = true;
12099- spin_unlock_irqrestore(&Controller->queue_lock, flags);
12100- DAC960_V1_ClearCommand(Command);
12101- Command->CommandType = DAC960_ImmediateCommand;
12102- memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12103- sizeof(DAC960_V1_CommandMailbox_T));
12104- Command->V1.CommandMailbox.Type3.BusAddress = DCDB_IOBUFDMA;
12105- DCDB.BusAddress = DataTransferBufferDMA;
12106- memcpy(DCDB_IOBUF, &DCDB, sizeof(DAC960_V1_DCDB_T));
12107- }
12108- else
12109- {
12110- spin_lock_irqsave(&Controller->queue_lock, flags);
12111- while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12112- DAC960_WaitForCommand(Controller);
12113- spin_unlock_irqrestore(&Controller->queue_lock, flags);
12114- DAC960_V1_ClearCommand(Command);
12115- Command->CommandType = DAC960_ImmediateCommand;
12116- memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12117- sizeof(DAC960_V1_CommandMailbox_T));
12118- if (DataTransferBuffer != NULL)
12119- Command->V1.CommandMailbox.Type3.BusAddress =
12120- DataTransferBufferDMA;
12121- }
12122- DAC960_ExecuteCommand(Command);
12123- CommandStatus = Command->V1.CommandStatus;
12124- spin_lock_irqsave(&Controller->queue_lock, flags);
12125- DAC960_DeallocateCommand(Command);
12126- spin_unlock_irqrestore(&Controller->queue_lock, flags);
12127- if (DataTransferLength > 0)
12128- {
12129- if (copy_to_user(UserCommand.DataTransferBuffer,
12130- DataTransferBuffer, DataTransferLength)) {
12131- ErrorCode = -EFAULT;
12132- goto Failure1;
12133- }
12134- }
12135- if (CommandOpcode == DAC960_V1_DCDB)
12136- {
12137- /*
12138- I don't believe Target or Channel in the DCDB_IOBUF
12139- should be any different from the contents of DCDB.
12140- */
12141- Controller->V1.DirectCommandActive[DCDB.Channel]
12142- [DCDB.TargetID] = false;
12143- if (copy_to_user(UserCommand.DCDB, DCDB_IOBUF,
12144- sizeof(DAC960_V1_DCDB_T))) {
12145- ErrorCode = -EFAULT;
12146- goto Failure1;
12147- }
12148- }
12149- ErrorCode = CommandStatus;
12150- Failure1:
12151- if (DataTransferBuffer != NULL)
12152- pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
12153- DataTransferBuffer, DataTransferBufferDMA);
12154- if (DCDB_IOBUF != NULL)
12155- pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T),
12156- DCDB_IOBUF, DCDB_IOBUFDMA);
12157- Failure1a:
12158- return ErrorCode;
12159- }
12160- case DAC960_IOCTL_V2_EXECUTE_COMMAND:
12161- {
12162- DAC960_V2_UserCommand_T *UserSpaceUserCommand =
12163- (DAC960_V2_UserCommand_T *) Argument;
12164- DAC960_V2_UserCommand_T UserCommand;
12165- DAC960_Controller_T *Controller;
12166- DAC960_Command_T *Command = NULL;
12167- DAC960_V2_CommandMailbox_T *CommandMailbox;
12168- DAC960_V2_CommandStatus_T CommandStatus;
12169- unsigned long flags;
12170- int ControllerNumber, DataTransferLength;
12171- int DataTransferResidue, RequestSenseLength;
12172- unsigned char *DataTransferBuffer = NULL;
12173- dma_addr_t DataTransferBufferDMA;
12174- unsigned char *RequestSenseBuffer = NULL;
12175- dma_addr_t RequestSenseBufferDMA;
12176- if (UserSpaceUserCommand == NULL) return -EINVAL;
12177- if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12178- sizeof(DAC960_V2_UserCommand_T))) {
12179- ErrorCode = -EFAULT;
12180- goto Failure2a;
12181- }
12182- ControllerNumber = UserCommand.ControllerNumber;
12183- if (ControllerNumber < 0 ||
12184- ControllerNumber > DAC960_ControllerCount - 1)
12185- return -ENXIO;
12186- Controller = DAC960_Controllers[ControllerNumber];
12187- if (Controller == NULL) return -ENXIO;
12188- if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
12189- DataTransferLength = UserCommand.DataTransferLength;
12190- if (DataTransferLength > 0)
12191- {
12192- DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12193- DataTransferLength, &DataTransferBufferDMA);
12194- if (DataTransferBuffer == NULL) return -ENOMEM;
12195- memset(DataTransferBuffer, 0, DataTransferLength);
12196- }
12197- else if (DataTransferLength < 0)
12198- {
12199- DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12200- -DataTransferLength, &DataTransferBufferDMA);
12201- if (DataTransferBuffer == NULL) return -ENOMEM;
12202- if (copy_from_user(DataTransferBuffer,
12203- UserCommand.DataTransferBuffer,
12204- -DataTransferLength)) {
12205- ErrorCode = -EFAULT;
12206- goto Failure2;
12207- }
12208- }
12209- RequestSenseLength = UserCommand.RequestSenseLength;
12210- if (RequestSenseLength > 0)
12211- {
12212- RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
12213- RequestSenseLength, &RequestSenseBufferDMA);
12214- if (RequestSenseBuffer == NULL)
12215- {
12216- ErrorCode = -ENOMEM;
12217- goto Failure2;
12218- }
12219- memset(RequestSenseBuffer, 0, RequestSenseLength);
12220- }
12221- spin_lock_irqsave(&Controller->queue_lock, flags);
12222- while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12223- DAC960_WaitForCommand(Controller);
12224- spin_unlock_irqrestore(&Controller->queue_lock, flags);
12225- DAC960_V2_ClearCommand(Command);
12226- Command->CommandType = DAC960_ImmediateCommand;
12227- CommandMailbox = &Command->V2.CommandMailbox;
12228- memcpy(CommandMailbox, &UserCommand.CommandMailbox,
12229- sizeof(DAC960_V2_CommandMailbox_T));
12230- CommandMailbox->Common.CommandControlBits
12231- .AdditionalScatterGatherListMemory = false;
12232- CommandMailbox->Common.CommandControlBits
12233- .NoAutoRequestSense = true;
12234- CommandMailbox->Common.DataTransferSize = 0;
12235- CommandMailbox->Common.DataTransferPageNumber = 0;
12236- memset(&CommandMailbox->Common.DataTransferMemoryAddress, 0,
12237- sizeof(DAC960_V2_DataTransferMemoryAddress_T));
12238- if (DataTransferLength != 0)
12239- {
12240- if (DataTransferLength > 0)
12241- {
12242- CommandMailbox->Common.CommandControlBits
12243- .DataTransferControllerToHost = true;
12244- CommandMailbox->Common.DataTransferSize = DataTransferLength;
12245- }
12246- else
12247- {
12248- CommandMailbox->Common.CommandControlBits
12249- .DataTransferControllerToHost = false;
12250- CommandMailbox->Common.DataTransferSize = -DataTransferLength;
12251- }
12252- CommandMailbox->Common.DataTransferMemoryAddress
12253- .ScatterGatherSegments[0]
12254- .SegmentDataPointer = DataTransferBufferDMA;
12255- CommandMailbox->Common.DataTransferMemoryAddress
12256- .ScatterGatherSegments[0]
12257- .SegmentByteCount =
12258- CommandMailbox->Common.DataTransferSize;
12259- }
12260- if (RequestSenseLength > 0)
12261- {
12262- CommandMailbox->Common.CommandControlBits
12263- .NoAutoRequestSense = false;
12264- CommandMailbox->Common.RequestSenseSize = RequestSenseLength;
12265- CommandMailbox->Common.RequestSenseBusAddress =
12266- RequestSenseBufferDMA;
12267- }
12268- DAC960_ExecuteCommand(Command);
12269- CommandStatus = Command->V2.CommandStatus;
12270- RequestSenseLength = Command->V2.RequestSenseLength;
12271- DataTransferResidue = Command->V2.DataTransferResidue;
12272- spin_lock_irqsave(&Controller->queue_lock, flags);
12273- DAC960_DeallocateCommand(Command);
12274- spin_unlock_irqrestore(&Controller->queue_lock, flags);
12275- if (RequestSenseLength > UserCommand.RequestSenseLength)
12276- RequestSenseLength = UserCommand.RequestSenseLength;
12277- if (copy_to_user(&UserSpaceUserCommand->DataTransferLength,
12278- &DataTransferResidue,
12279- sizeof(DataTransferResidue))) {
12280- ErrorCode = -EFAULT;
12281- goto Failure2;
12282- }
12283- if (copy_to_user(&UserSpaceUserCommand->RequestSenseLength,
12284- &RequestSenseLength, sizeof(RequestSenseLength))) {
12285- ErrorCode = -EFAULT;
12286- goto Failure2;
12287- }
12288- if (DataTransferLength > 0)
12289- {
12290- if (copy_to_user(UserCommand.DataTransferBuffer,
12291- DataTransferBuffer, DataTransferLength)) {
12292- ErrorCode = -EFAULT;
12293- goto Failure2;
12294- }
12295- }
12296- if (RequestSenseLength > 0)
12297- {
12298- if (copy_to_user(UserCommand.RequestSenseBuffer,
12299- RequestSenseBuffer, RequestSenseLength)) {
12300- ErrorCode = -EFAULT;
12301- goto Failure2;
12302- }
12303- }
12304- ErrorCode = CommandStatus;
12305- Failure2:
12306- pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
12307- DataTransferBuffer, DataTransferBufferDMA);
12308- if (RequestSenseBuffer != NULL)
12309- pci_free_consistent(Controller->PCIDevice, RequestSenseLength,
12310- RequestSenseBuffer, RequestSenseBufferDMA);
12311- Failure2a:
12312- return ErrorCode;
12313- }
12314- case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
12315- {
12316- DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
12317- (DAC960_V2_GetHealthStatus_T *) Argument;
12318- DAC960_V2_GetHealthStatus_T GetHealthStatus;
12319- DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
12320- DAC960_Controller_T *Controller;
12321- int ControllerNumber;
12322- if (UserSpaceGetHealthStatus == NULL) return -EINVAL;
12323- if (copy_from_user(&GetHealthStatus, UserSpaceGetHealthStatus,
12324- sizeof(DAC960_V2_GetHealthStatus_T)))
12325- return -EFAULT;
12326- ControllerNumber = GetHealthStatus.ControllerNumber;
12327- if (ControllerNumber < 0 ||
12328- ControllerNumber > DAC960_ControllerCount - 1)
12329- return -ENXIO;
12330- Controller = DAC960_Controllers[ControllerNumber];
12331- if (Controller == NULL) return -ENXIO;
12332- if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
12333- if (copy_from_user(&HealthStatusBuffer,
12334- GetHealthStatus.HealthStatusBuffer,
12335- sizeof(DAC960_V2_HealthStatusBuffer_T)))
12336- return -EFAULT;
12337- while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
12338- == HealthStatusBuffer.StatusChangeCounter &&
12339- Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
12340- == HealthStatusBuffer.NextEventSequenceNumber)
12341- {
12342- interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
12343- DAC960_MonitoringTimerInterval);
12344- if (signal_pending(current)) return -EINTR;
12345- }
12346- if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
12347- Controller->V2.HealthStatusBuffer,
12348- sizeof(DAC960_V2_HealthStatusBuffer_T)))
12349- return -EFAULT;
12350- return 0;
12351- }
12352- }
12353- return -EINVAL;
12354-}
12355-
12356-
12357-/*
12358 DAC960_CheckStatusBuffer verifies that there is room to hold ByteCount
12359 additional bytes in the Combined Status Buffer and grows the buffer if
12360 necessary. It returns true if there is enough room and false otherwise.
12361@@ -6901,6 +6496,436 @@
12362 Controller->ControllerProcEntry = NULL;
12363 }
12364
12365+#ifdef DAC960_GAM_MINOR
12366+
12367+/*
12368+ * DAC960_gam_ioctl is the ioctl function for performing RAID operations.
12369+*/
12370+
12371+static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
12372+ unsigned int Request, unsigned long Argument)
12373+{
12374+ int ErrorCode = 0;
12375+ if (!capable(CAP_SYS_ADMIN)) return -EACCES;
12376+ switch (Request)
12377+ {
12378+ case DAC960_IOCTL_GET_CONTROLLER_COUNT:
12379+ return DAC960_ControllerCount;
12380+ case DAC960_IOCTL_GET_CONTROLLER_INFO:
12381+ {
12382+ DAC960_ControllerInfo_T *UserSpaceControllerInfo =
12383+ (DAC960_ControllerInfo_T *) Argument;
12384+ DAC960_ControllerInfo_T ControllerInfo;
12385+ DAC960_Controller_T *Controller;
12386+ int ControllerNumber;
12387+ if (UserSpaceControllerInfo == NULL) return -EINVAL;
12388+ ErrorCode = get_user(ControllerNumber,
12389+ &UserSpaceControllerInfo->ControllerNumber);
12390+ if (ErrorCode != 0) return ErrorCode;
12391+ if (ControllerNumber < 0 ||
12392+ ControllerNumber > DAC960_ControllerCount - 1)
12393+ return -ENXIO;
12394+ Controller = DAC960_Controllers[ControllerNumber];
12395+ if (Controller == NULL) return -ENXIO;
12396+ memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T));
12397+ ControllerInfo.ControllerNumber = ControllerNumber;
12398+ ControllerInfo.FirmwareType = Controller->FirmwareType;
12399+ ControllerInfo.Channels = Controller->Channels;
12400+ ControllerInfo.Targets = Controller->Targets;
12401+ ControllerInfo.PCI_Bus = Controller->Bus;
12402+ ControllerInfo.PCI_Device = Controller->Device;
12403+ ControllerInfo.PCI_Function = Controller->Function;
12404+ ControllerInfo.IRQ_Channel = Controller->IRQ_Channel;
12405+ ControllerInfo.PCI_Address = Controller->PCI_Address;
12406+ strcpy(ControllerInfo.ModelName, Controller->ModelName);
12407+ strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion);
12408+ return (copy_to_user(UserSpaceControllerInfo, &ControllerInfo,
12409+ sizeof(DAC960_ControllerInfo_T)) ? -EFAULT : 0);
12410+ }
12411+ case DAC960_IOCTL_V1_EXECUTE_COMMAND:
12412+ {
12413+ DAC960_V1_UserCommand_T *UserSpaceUserCommand =
12414+ (DAC960_V1_UserCommand_T *) Argument;
12415+ DAC960_V1_UserCommand_T UserCommand;
12416+ DAC960_Controller_T *Controller;
12417+ DAC960_Command_T *Command = NULL;
12418+ DAC960_V1_CommandOpcode_T CommandOpcode;
12419+ DAC960_V1_CommandStatus_T CommandStatus;
12420+ DAC960_V1_DCDB_T DCDB;
12421+ DAC960_V1_DCDB_T *DCDB_IOBUF = NULL;
12422+ dma_addr_t DCDB_IOBUFDMA;
12423+ unsigned long flags;
12424+ int ControllerNumber, DataTransferLength;
12425+ unsigned char *DataTransferBuffer = NULL;
12426+ dma_addr_t DataTransferBufferDMA;
12427+ if (UserSpaceUserCommand == NULL) return -EINVAL;
12428+ if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12429+ sizeof(DAC960_V1_UserCommand_T))) {
12430+ ErrorCode = -EFAULT;
12431+ goto Failure1a;
12432+ }
12433+ ControllerNumber = UserCommand.ControllerNumber;
12434+ if (ControllerNumber < 0 ||
12435+ ControllerNumber > DAC960_ControllerCount - 1)
12436+ return -ENXIO;
12437+ Controller = DAC960_Controllers[ControllerNumber];
12438+ if (Controller == NULL) return -ENXIO;
12439+ if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL;
12440+ CommandOpcode = UserCommand.CommandMailbox.Common.CommandOpcode;
12441+ DataTransferLength = UserCommand.DataTransferLength;
12442+ if (CommandOpcode & 0x80) return -EINVAL;
12443+ if (CommandOpcode == DAC960_V1_DCDB)
12444+ {
12445+ if (copy_from_user(&DCDB, UserCommand.DCDB,
12446+ sizeof(DAC960_V1_DCDB_T))) {
12447+ ErrorCode = -EFAULT;
12448+ goto Failure1a;
12449+ }
12450+ if (DCDB.Channel >= DAC960_V1_MaxChannels) return -EINVAL;
12451+ if (!((DataTransferLength == 0 &&
12452+ DCDB.Direction
12453+ == DAC960_V1_DCDB_NoDataTransfer) ||
12454+ (DataTransferLength > 0 &&
12455+ DCDB.Direction
12456+ == DAC960_V1_DCDB_DataTransferDeviceToSystem) ||
12457+ (DataTransferLength < 0 &&
12458+ DCDB.Direction
12459+ == DAC960_V1_DCDB_DataTransferSystemToDevice)))
12460+ return -EINVAL;
12461+ if (((DCDB.TransferLengthHigh4 << 16) | DCDB.TransferLength)
12462+ != abs(DataTransferLength))
12463+ return -EINVAL;
12464+ DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice,
12465+ sizeof(DAC960_V1_DCDB_T), &DCDB_IOBUFDMA);
12466+ if (DCDB_IOBUF == NULL)
12467+ return -ENOMEM;
12468+ }
12469+ if (DataTransferLength > 0)
12470+ {
12471+ DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12472+ DataTransferLength, &DataTransferBufferDMA);
12473+ if (DataTransferBuffer == NULL) {
12474+ ErrorCode = -ENOMEM;
12475+ goto Failure1;
12476+ }
12477+ memset(DataTransferBuffer, 0, DataTransferLength);
12478+ }
12479+ else if (DataTransferLength < 0)
12480+ {
12481+ DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12482+ -DataTransferLength, &DataTransferBufferDMA);
12483+ if (DataTransferBuffer == NULL) {
12484+ ErrorCode = -ENOMEM;
12485+ goto Failure1;
12486+ }
12487+ if (copy_from_user(DataTransferBuffer,
12488+ UserCommand.DataTransferBuffer,
12489+ -DataTransferLength)) {
12490+ ErrorCode = -EFAULT;
12491+ goto Failure1;
12492+ }
12493+ }
12494+ if (CommandOpcode == DAC960_V1_DCDB)
12495+ {
12496+ spin_lock_irqsave(&Controller->queue_lock, flags);
12497+ while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12498+ DAC960_WaitForCommand(Controller);
12499+ while (Controller->V1.DirectCommandActive[DCDB.Channel]
12500+ [DCDB.TargetID])
12501+ {
12502+ spin_unlock_irq(&Controller->queue_lock);
12503+ __wait_event(Controller->CommandWaitQueue,
12504+ !Controller->V1.DirectCommandActive
12505+ [DCDB.Channel][DCDB.TargetID]);
12506+ spin_lock_irq(&Controller->queue_lock);
12507+ }
12508+ Controller->V1.DirectCommandActive[DCDB.Channel]
12509+ [DCDB.TargetID] = true;
12510+ spin_unlock_irqrestore(&Controller->queue_lock, flags);
12511+ DAC960_V1_ClearCommand(Command);
12512+ Command->CommandType = DAC960_ImmediateCommand;
12513+ memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12514+ sizeof(DAC960_V1_CommandMailbox_T));
12515+ Command->V1.CommandMailbox.Type3.BusAddress = DCDB_IOBUFDMA;
12516+ DCDB.BusAddress = DataTransferBufferDMA;
12517+ memcpy(DCDB_IOBUF, &DCDB, sizeof(DAC960_V1_DCDB_T));
12518+ }
12519+ else
12520+ {
12521+ spin_lock_irqsave(&Controller->queue_lock, flags);
12522+ while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12523+ DAC960_WaitForCommand(Controller);
12524+ spin_unlock_irqrestore(&Controller->queue_lock, flags);
12525+ DAC960_V1_ClearCommand(Command);
12526+ Command->CommandType = DAC960_ImmediateCommand;
12527+ memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12528+ sizeof(DAC960_V1_CommandMailbox_T));
12529+ if (DataTransferBuffer != NULL)
12530+ Command->V1.CommandMailbox.Type3.BusAddress =
12531+ DataTransferBufferDMA;
12532+ }
12533+ DAC960_ExecuteCommand(Command);
12534+ CommandStatus = Command->V1.CommandStatus;
12535+ spin_lock_irqsave(&Controller->queue_lock, flags);
12536+ DAC960_DeallocateCommand(Command);
12537+ spin_unlock_irqrestore(&Controller->queue_lock, flags);
12538+ if (DataTransferLength > 0)
12539+ {
12540+ if (copy_to_user(UserCommand.DataTransferBuffer,
12541+ DataTransferBuffer, DataTransferLength)) {
12542+ ErrorCode = -EFAULT;
12543+ goto Failure1;
12544+ }
12545+ }
12546+ if (CommandOpcode == DAC960_V1_DCDB)
12547+ {
12548+ /*
12549+ I don't believe Target or Channel in the DCDB_IOBUF
12550+ should be any different from the contents of DCDB.
12551+ */
12552+ Controller->V1.DirectCommandActive[DCDB.Channel]
12553+ [DCDB.TargetID] = false;
12554+ if (copy_to_user(UserCommand.DCDB, DCDB_IOBUF,
12555+ sizeof(DAC960_V1_DCDB_T))) {
12556+ ErrorCode = -EFAULT;
12557+ goto Failure1;
12558+ }
12559+ }
12560+ ErrorCode = CommandStatus;
12561+ Failure1:
12562+ if (DataTransferBuffer != NULL)
12563+ pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
12564+ DataTransferBuffer, DataTransferBufferDMA);
12565+ if (DCDB_IOBUF != NULL)
12566+ pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T),
12567+ DCDB_IOBUF, DCDB_IOBUFDMA);
12568+ Failure1a:
12569+ return ErrorCode;
12570+ }
12571+ case DAC960_IOCTL_V2_EXECUTE_COMMAND:
12572+ {
12573+ DAC960_V2_UserCommand_T *UserSpaceUserCommand =
12574+ (DAC960_V2_UserCommand_T *) Argument;
12575+ DAC960_V2_UserCommand_T UserCommand;
12576+ DAC960_Controller_T *Controller;
12577+ DAC960_Command_T *Command = NULL;
12578+ DAC960_V2_CommandMailbox_T *CommandMailbox;
12579+ DAC960_V2_CommandStatus_T CommandStatus;
12580+ unsigned long flags;
12581+ int ControllerNumber, DataTransferLength;
12582+ int DataTransferResidue, RequestSenseLength;
12583+ unsigned char *DataTransferBuffer = NULL;
12584+ dma_addr_t DataTransferBufferDMA;
12585+ unsigned char *RequestSenseBuffer = NULL;
12586+ dma_addr_t RequestSenseBufferDMA;
12587+ if (UserSpaceUserCommand == NULL) return -EINVAL;
12588+ if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12589+ sizeof(DAC960_V2_UserCommand_T))) {
12590+ ErrorCode = -EFAULT;
12591+ goto Failure2a;
12592+ }
12593+ ControllerNumber = UserCommand.ControllerNumber;
12594+ if (ControllerNumber < 0 ||
12595+ ControllerNumber > DAC960_ControllerCount - 1)
12596+ return -ENXIO;
12597+ Controller = DAC960_Controllers[ControllerNumber];
12598+ if (Controller == NULL) return -ENXIO;
12599+ if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
12600+ DataTransferLength = UserCommand.DataTransferLength;
12601+ if (DataTransferLength > 0)
12602+ {
12603+ DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12604+ DataTransferLength, &DataTransferBufferDMA);
12605+ if (DataTransferBuffer == NULL) return -ENOMEM;
12606+ memset(DataTransferBuffer, 0, DataTransferLength);
12607+ }
12608+ else if (DataTransferLength < 0)
12609+ {
12610+ DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12611+ -DataTransferLength, &DataTransferBufferDMA);
12612+ if (DataTransferBuffer == NULL) return -ENOMEM;
12613+ if (copy_from_user(DataTransferBuffer,
12614+ UserCommand.DataTransferBuffer,
12615+ -DataTransferLength)) {
12616+ ErrorCode = -EFAULT;
12617+ goto Failure2;
12618+ }
12619+ }
12620+ RequestSenseLength = UserCommand.RequestSenseLength;
12621+ if (RequestSenseLength > 0)
12622+ {
12623+ RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
12624+ RequestSenseLength, &RequestSenseBufferDMA);
12625+ if (RequestSenseBuffer == NULL)
12626+ {
12627+ ErrorCode = -ENOMEM;
12628+ goto Failure2;
12629+ }
12630+ memset(RequestSenseBuffer, 0, RequestSenseLength);
12631+ }
12632+ spin_lock_irqsave(&Controller->queue_lock, flags);
12633+ while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12634+ DAC960_WaitForCommand(Controller);
12635+ spin_unlock_irqrestore(&Controller->queue_lock, flags);
12636+ DAC960_V2_ClearCommand(Command);
12637+ Command->CommandType = DAC960_ImmediateCommand;
12638+ CommandMailbox = &Command->V2.CommandMailbox;
12639+ memcpy(CommandMailbox, &UserCommand.CommandMailbox,
12640+ sizeof(DAC960_V2_CommandMailbox_T));
12641+ CommandMailbox->Common.CommandControlBits
12642+ .AdditionalScatterGatherListMemory = false;
12643+ CommandMailbox->Common.CommandControlBits
12644+ .NoAutoRequestSense = true;
12645+ CommandMailbox->Common.DataTransferSize = 0;
12646+ CommandMailbox->Common.DataTransferPageNumber = 0;
12647+ memset(&CommandMailbox->Common.DataTransferMemoryAddress, 0,
12648+ sizeof(DAC960_V2_DataTransferMemoryAddress_T));
12649+ if (DataTransferLength != 0)
12650+ {
12651+ if (DataTransferLength > 0)
12652+ {
12653+ CommandMailbox->Common.CommandControlBits
12654+ .DataTransferControllerToHost = true;
12655+ CommandMailbox->Common.DataTransferSize = DataTransferLength;
12656+ }
12657+ else
12658+ {
12659+ CommandMailbox->Common.CommandControlBits
12660+ .DataTransferControllerToHost = false;
12661+ CommandMailbox->Common.DataTransferSize = -DataTransferLength;
12662+ }
12663+ CommandMailbox->Common.DataTransferMemoryAddress
12664+ .ScatterGatherSegments[0]
12665+ .SegmentDataPointer = DataTransferBufferDMA;
12666+ CommandMailbox->Common.DataTransferMemoryAddress
12667+ .ScatterGatherSegments[0]
12668+ .SegmentByteCount =
12669+ CommandMailbox->Common.DataTransferSize;
12670+ }
12671+ if (RequestSenseLength > 0)
12672+ {
12673+ CommandMailbox->Common.CommandControlBits
12674+ .NoAutoRequestSense = false;
12675+ CommandMailbox->Common.RequestSenseSize = RequestSenseLength;
12676+ CommandMailbox->Common.RequestSenseBusAddress =
12677+ RequestSenseBufferDMA;
12678+ }
12679+ DAC960_ExecuteCommand(Command);
12680+ CommandStatus = Command->V2.CommandStatus;
12681+ RequestSenseLength = Command->V2.RequestSenseLength;
12682+ DataTransferResidue = Command->V2.DataTransferResidue;
12683+ spin_lock_irqsave(&Controller->queue_lock, flags);
12684+ DAC960_DeallocateCommand(Command);
12685+ spin_unlock_irqrestore(&Controller->queue_lock, flags);
12686+ if (RequestSenseLength > UserCommand.RequestSenseLength)
12687+ RequestSenseLength = UserCommand.RequestSenseLength;
12688+ if (copy_to_user(&UserSpaceUserCommand->DataTransferLength,
12689+ &DataTransferResidue,
12690+ sizeof(DataTransferResidue))) {
12691+ ErrorCode = -EFAULT;
12692+ goto Failure2;
12693+ }
12694+ if (copy_to_user(&UserSpaceUserCommand->RequestSenseLength,
12695+ &RequestSenseLength, sizeof(RequestSenseLength))) {
12696+ ErrorCode = -EFAULT;
12697+ goto Failure2;
12698+ }
12699+ if (DataTransferLength > 0)
12700+ {
12701+ if (copy_to_user(UserCommand.DataTransferBuffer,
12702+ DataTransferBuffer, DataTransferLength)) {
12703+ ErrorCode = -EFAULT;
12704+ goto Failure2;
12705+ }
12706+ }
12707+ if (RequestSenseLength > 0)
12708+ {
12709+ if (copy_to_user(UserCommand.RequestSenseBuffer,
12710+ RequestSenseBuffer, RequestSenseLength)) {
12711+ ErrorCode = -EFAULT;
12712+ goto Failure2;
12713+ }
12714+ }
12715+ ErrorCode = CommandStatus;
12716+ Failure2:
12717+ pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
12718+ DataTransferBuffer, DataTransferBufferDMA);
12719+ if (RequestSenseBuffer != NULL)
12720+ pci_free_consistent(Controller->PCIDevice, RequestSenseLength,
12721+ RequestSenseBuffer, RequestSenseBufferDMA);
12722+ Failure2a:
12723+ return ErrorCode;
12724+ }
12725+ case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
12726+ {
12727+ DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
12728+ (DAC960_V2_GetHealthStatus_T *) Argument;
12729+ DAC960_V2_GetHealthStatus_T GetHealthStatus;
12730+ DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
12731+ DAC960_Controller_T *Controller;
12732+ int ControllerNumber;
12733+ if (UserSpaceGetHealthStatus == NULL) return -EINVAL;
12734+ if (copy_from_user(&GetHealthStatus, UserSpaceGetHealthStatus,
12735+ sizeof(DAC960_V2_GetHealthStatus_T)))
12736+ return -EFAULT;
12737+ ControllerNumber = GetHealthStatus.ControllerNumber;
12738+ if (ControllerNumber < 0 ||
12739+ ControllerNumber > DAC960_ControllerCount - 1)
12740+ return -ENXIO;
12741+ Controller = DAC960_Controllers[ControllerNumber];
12742+ if (Controller == NULL) return -ENXIO;
12743+ if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
12744+ if (copy_from_user(&HealthStatusBuffer,
12745+ GetHealthStatus.HealthStatusBuffer,
12746+ sizeof(DAC960_V2_HealthStatusBuffer_T)))
12747+ return -EFAULT;
12748+ while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
12749+ == HealthStatusBuffer.StatusChangeCounter &&
12750+ Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
12751+ == HealthStatusBuffer.NextEventSequenceNumber)
12752+ {
12753+ interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
12754+ DAC960_MonitoringTimerInterval);
12755+ if (signal_pending(current)) return -EINTR;
12756+ }
12757+ if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
12758+ Controller->V2.HealthStatusBuffer,
12759+ sizeof(DAC960_V2_HealthStatusBuffer_T)))
12760+ return -EFAULT;
12761+ return 0;
12762+ }
12763+ }
12764+ return -EINVAL;
12765+}
12766+
12767+static struct file_operations DAC960_gam_fops = {
12768+ .owner = THIS_MODULE,
12769+ .ioctl = DAC960_gam_ioctl
12770+};
12771+
12772+static struct miscdevice DAC960_gam_dev = {
12773+ DAC960_GAM_MINOR,
12774+ "dac960_gam",
12775+ &DAC960_gam_fops
12776+};
12777+
12778+static int DAC960_gam_init(void)
12779+{
12780+ int ret;
12781+
12782+ ret = misc_register(&DAC960_gam_dev);
12783+ if (ret)
12784+ printk(KERN_ERR "DAC960_gam: can't misc_register on minor %d\n", DAC960_GAM_MINOR);
12785+ return ret;
12786+}
12787+
12788+static void DAC960_gam_cleanup(void)
12789+{
12790+ misc_deregister(&DAC960_gam_dev);
12791+}
12792+
12793+#endif /* DAC960_GAM_MINOR */
12794+
12795 static struct DAC960_privdata DAC960_BA_privdata = {
12796 .HardwareType = DAC960_BA_Controller,
12797 .FirmwareType = DAC960_V2_Controller,
12798@@ -7000,12 +7025,23 @@
12799
12800 static int DAC960_init_module(void)
12801 {
12802- return pci_module_init(&DAC960_pci_driver);
12803+ int ret;
12804+
12805+ ret = pci_module_init(&DAC960_pci_driver);
12806+#ifdef DAC960_GAM_MINOR
12807+ if (!ret)
12808+ DAC960_gam_init();
12809+#endif
12810+ return ret;
12811 }
12812
12813 static void DAC960_cleanup_module(void)
12814 {
12815 int i;
12816+
12817+#ifdef DAC960_GAM_MINOR
12818+ DAC960_gam_cleanup();
12819+#endif
12820
12821 for (i = 0; i < DAC960_ControllerCount; i++) {
12822 DAC960_Controller_T *Controller = DAC960_Controllers[i];
12823diff -Nru a/drivers/block/DAC960.h b/drivers/block/DAC960.h
12824--- a/drivers/block/DAC960.h Thu Aug 7 06:13:28 2003
12825+++ b/drivers/block/DAC960.h Sun Aug 31 16:13:56 2003
12826@@ -4138,8 +4138,6 @@
12827 static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
12828 static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
12829 static void DAC960_MonitoringTimerFunction(unsigned long);
12830-static int DAC960_UserIOCTL(struct inode *, struct file *,
12831- unsigned int, unsigned long);
12832 static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
12833 DAC960_Controller_T *, ...);
12834 static void DAC960_CreateProcEntries(DAC960_Controller_T *);
12835diff -Nru a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
12836--- a/drivers/block/acsi_slm.c Sun Jun 8 04:05:16 2003
12837+++ b/drivers/block/acsi_slm.c Tue Aug 26 09:25:40 2003
12838@@ -374,7 +374,7 @@
12839 if (!(page = __get_free_page( GFP_KERNEL )))
12840 return( -ENOMEM );
12841
12842- length = slm_getstats( (char *)page, MINOR(node->i_rdev) );
12843+ length = slm_getstats( (char *)page, iminor(node) );
12844 if (length < 0) {
12845 count = length;
12846 goto out;
12847@@ -622,7 +622,7 @@
12848
12849 {
12850 struct inode *node = file->f_dentry->d_inode;
12851- int device = MINOR( node->i_rdev );
12852+ int device = iminor(node);
12853 int n, filled, w, h;
12854
12855 while( SLMState == PRINTING ||
12856@@ -694,7 +694,7 @@
12857 static int slm_ioctl( struct inode *inode, struct file *file,
12858 unsigned int cmd, unsigned long arg )
12859
12860-{ int device = MINOR( inode->i_rdev ), err;
12861+{ int device = iminor(inode), err;
12862
12863 /* I can think of setting:
12864 * - manual feed
12865@@ -768,7 +768,7 @@
12866 { int device;
12867 struct slm *sip;
12868
12869- device = MINOR(inode->i_rdev);
12870+ device = iminor(inode);
12871 if (device >= N_SLM_Printers)
12872 return( -ENXIO );
12873 sip = &slm_info[device];
12874@@ -797,7 +797,7 @@
12875 { int device;
12876 struct slm *sip;
12877
12878- device = MINOR(inode->i_rdev);
12879+ device = iminor(inode);
12880 sip = &slm_info[device];
12881
12882 if (file->f_mode & 2)
12883diff -Nru a/drivers/block/amiflop.c b/drivers/block/amiflop.c
12884--- a/drivers/block/amiflop.c Thu Aug 7 02:25:23 2003
12885+++ b/drivers/block/amiflop.c Tue Jul 29 16:35:37 2003
12886@@ -55,24 +55,15 @@
12887
12888 #include <linux/module.h>
12889
12890-#include <linux/sched.h>
12891-#include <linux/fs.h>
12892-#include <linux/fcntl.h>
12893-#include <linux/kernel.h>
12894-#include <linux/timer.h>
12895 #include <linux/fd.h>
12896 #include <linux/hdreg.h>
12897-#include <linux/errno.h>
12898-#include <linux/types.h>
12899 #include <linux/delay.h>
12900-#include <linux/string.h>
12901-#include <linux/slab.h>
12902 #include <linux/init.h>
12903 #include <linux/amifdreg.h>
12904 #include <linux/amifd.h>
12905-#include <linux/ioport.h>
12906 #include <linux/buffer_head.h>
12907-#include <linux/interrupt.h>
12908+#include <linux/blkdev.h>
12909+#include <linux/elevator.h>
12910
12911 #include <asm/setup.h>
12912 #include <asm/uaccess.h>
12913@@ -1446,7 +1437,7 @@
12914 static int fd_ioctl(struct inode *inode, struct file *filp,
12915 unsigned int cmd, unsigned long param)
12916 {
12917- int drive = minor(inode->i_rdev) & 3;
12918+ int drive = iminor(inode) & 3;
12919 static struct floppy_struct getprm;
12920
12921 switch(cmd){
12922@@ -1570,8 +1561,8 @@
12923 */
12924 static int floppy_open(struct inode *inode, struct file *filp)
12925 {
12926- int drive = minor(inode->i_rdev) & 3;
12927- int system = (minor(inode->i_rdev) & 4) >> 2;
12928+ int drive = iminor(inode) & 3;
12929+ int system = (iminor(inode) & 4) >> 2;
12930 int old_dev;
12931 unsigned long flags;
12932
12933@@ -1618,7 +1609,7 @@
12934
12935 static int floppy_release(struct inode * inode, struct file * filp)
12936 {
12937- int drive = minor(inode->i_rdev) & 3;
12938+ int drive = iminor(inode) & 3;
12939
12940 if (unit[drive].dirty == 1) {
12941 del_timer (flush_track_timer + drive);
12942diff -Nru a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
12943--- a/drivers/block/as-iosched.c Fri Aug 15 00:57:28 2003
12944+++ b/drivers/block/as-iosched.c Sun Aug 31 16:14:29 2003
12945@@ -709,6 +709,14 @@
12946 return 1;
12947 }
12948
12949+ if (aic->seek_samples == 0 || aic->ttime_samples == 0) {
12950+ /*
12951+ * Process has just started IO so default to not anticipate.
12952+ * Maybe should be smarter.
12953+ */
12954+ return 1;
12955+ }
12956+
12957 if (aic->ttime_mean > ad->antic_expire) {
12958 /* the process thinks too much between requests */
12959 return 1;
12960diff -Nru a/drivers/block/ataflop.c b/drivers/block/ataflop.c
12961--- a/drivers/block/ataflop.c Thu Aug 7 02:25:23 2003
12962+++ b/drivers/block/ataflop.c Wed Jul 30 15:49:57 2003
12963@@ -63,35 +63,16 @@
12964
12965 #include <linux/module.h>
12966
12967-#include <linux/sched.h>
12968-#include <linux/string.h>
12969-#include <linux/fs.h>
12970-#include <linux/fcntl.h>
12971-#include <linux/kernel.h>
12972-#include <linux/timer.h>
12973 #include <linux/fd.h>
12974-#include <linux/errno.h>
12975-#include <linux/types.h>
12976 #include <linux/delay.h>
12977-#include <linux/mm.h>
12978-#include <linux/slab.h>
12979 #include <linux/init.h>
12980-#include <linux/buffer_head.h> /* for invalidate_buffers() */
12981-
12982-#include <asm/setup.h>
12983-#include <asm/system.h>
12984-#include <asm/bitops.h>
12985-#include <asm/irq.h>
12986-#include <asm/pgtable.h>
12987-#include <asm/uaccess.h>
12988+#include <linux/blkdev.h>
12989
12990 #include <asm/atafd.h>
12991 #include <asm/atafdreg.h>
12992-#include <asm/atarihw.h>
12993 #include <asm/atariints.h>
12994 #include <asm/atari_stdma.h>
12995 #include <asm/atari_stram.h>
12996-#include <linux/blkpg.h>
12997
12998 #define FD_MAX_UNITS 2
12999
13000@@ -1838,7 +1819,7 @@
13001 static int floppy_open( struct inode *inode, struct file *filp )
13002 {
13003 struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data;
13004- int type = minor(inode->i_rdev) >> 2;
13005+ int type = iminor(inode) >> 2;
13006
13007 DPRINT(("fd_open: type=%d\n",type));
13008 if (p->ref && p->type != type)
13009diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
13010--- a/drivers/block/cciss.c Thu Aug 7 06:13:28 2003
13011+++ b/drivers/block/cciss.c Tue Aug 26 09:25:41 2003
13012@@ -356,11 +356,11 @@
13013 */
13014 static int cciss_open(struct inode *inode, struct file *filep)
13015 {
13016- int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13017- int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13018+ int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13019+ int dsk = iminor(inode) >> NWD_SHIFT;
13020
13021 #ifdef CCISS_DEBUG
13022- printk(KERN_DEBUG "cciss_open %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
13023+ printk(KERN_DEBUG "cciss_open %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
13024 #endif /* CCISS_DEBUG */
13025
13026 if (ctlr >= MAX_CTLR || hba[ctlr] == NULL)
13027@@ -372,7 +372,7 @@
13028 * for "raw controller".
13029 */
13030 if (hba[ctlr]->drv[dsk].nr_blocks == 0) {
13031- if (minor(inode->i_rdev) != 0)
13032+ if (iminor(inode) != 0)
13033 return -ENXIO;
13034 if (!capable(CAP_SYS_ADMIN))
13035 return -EPERM;
13036@@ -386,11 +386,11 @@
13037 */
13038 static int cciss_release(struct inode *inode, struct file *filep)
13039 {
13040- int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13041- int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13042+ int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13043+ int dsk = iminor(inode) >> NWD_SHIFT;
13044
13045 #ifdef CCISS_DEBUG
13046- printk(KERN_DEBUG "cciss_release %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
13047+ printk(KERN_DEBUG "cciss_release %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
13048 #endif /* CCISS_DEBUG */
13049
13050 /* fsync_dev(inode->i_rdev); */
13051@@ -406,8 +406,8 @@
13052 static int cciss_ioctl(struct inode *inode, struct file *filep,
13053 unsigned int cmd, unsigned long arg)
13054 {
13055- int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13056- int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13057+ int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13058+ int dsk = iminor(inode) >> NWD_SHIFT;
13059
13060 #ifdef CCISS_DEBUG
13061 printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg);
13062@@ -2525,6 +2525,9 @@
13063 if (!q)
13064 goto err_all;
13065
13066+ hba[i]->queue = q;
13067+ q->queuedata = hba[i];
13068+
13069 /* Initialize the pdev driver private data.
13070 have it point to hba[i]. */
13071 pci_set_drvdata(pdev, hba[i]);
13072@@ -2545,7 +2548,6 @@
13073
13074 cciss_procinit(i);
13075
13076- q->queuedata = hba[i];
13077 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
13078
13079 /* This is a hardware imposed limit. */
13080diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
13081--- a/drivers/block/cpqarray.c Thu Aug 7 02:25:24 2003
13082+++ b/drivers/block/cpqarray.c Tue Aug 26 09:25:41 2003
13083@@ -1078,7 +1078,7 @@
13084 put_user(host->ctlr_sig, (int*)arg);
13085 return 0;
13086 case IDAREVALIDATEVOLS:
13087- if (minor(inode->i_rdev) != 0)
13088+ if (iminor(inode) != 0)
13089 return -ENXIO;
13090 return revalidate_allvol(host);
13091 case IDADRIVERVERSION:
13092diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
13093--- a/drivers/block/floppy.c Fri Aug 15 10:27:03 2003
13094+++ b/drivers/block/floppy.c Sun Aug 31 16:14:41 2003
13095@@ -695,23 +695,9 @@
13096 spin_unlock_irqrestore(&floppy_lock, flags);
13097 }
13098
13099-static int maximum(int a, int b)
13100-{
13101- if (a > b)
13102- return a;
13103- else
13104- return b;
13105-}
13106-#define INFBOUND(a,b) (a)=maximum((a),(b));
13107+#define INFBOUND(a,b) (a)=max_t(int, a, b)
13108
13109-static int minimum(int a, int b)
13110-{
13111- if (a < b)
13112- return a;
13113- else
13114- return b;
13115-}
13116-#define SUPBOUND(a,b) (a)=minimum((a),(b));
13117+#define SUPBOUND(a,b) (a)=min_t(int, a, b)
13118
13119
13120 /*
13121@@ -1021,9 +1007,9 @@
13122
13123 static DECLARE_WORK(floppy_work, NULL, NULL);
13124
13125-static void schedule_bh( void (*handler)(void*) )
13126+static void schedule_bh(void (*handler) (void))
13127 {
13128- PREPARE_WORK(&floppy_work, handler, NULL);
13129+ PREPARE_WORK(&floppy_work, (void (*)(void *))handler, NULL);
13130 schedule_work(&floppy_work);
13131 }
13132
13133@@ -1035,7 +1021,7 @@
13134
13135 spin_lock_irqsave(&floppy_lock, flags);
13136 do_floppy = NULL;
13137- PREPARE_WORK(&floppy_work, (void*)(void*)empty, NULL);
13138+ PREPARE_WORK(&floppy_work, (void*)empty, NULL);
13139 del_timer(&fd_timer);
13140 spin_unlock_irqrestore(&floppy_lock, flags);
13141 }
13142@@ -1813,9 +1799,9 @@
13143 max_sensei--;
13144 } while ((ST0 & 0x83) != UNIT(current_drive) && inr == 2 && max_sensei);
13145 }
13146- if (handler) {
13147- schedule_bh( (void *)(void *) handler);
13148- } else
13149+ if (handler)
13150+ schedule_bh(handler);
13151+ else
13152 FDCS->reset = 1;
13153 is_alive("normal interrupt end");
13154
13155@@ -2058,26 +2044,26 @@
13156 wake_up(&command_done);
13157 }
13158
13159-static struct cont_t wakeup_cont={
13160- empty,
13161- do_wakeup,
13162- empty,
13163- (done_f)empty
13164+static struct cont_t wakeup_cont = {
13165+ .interrupt = empty,
13166+ .redo = do_wakeup,
13167+ .error = empty,
13168+ .done = (done_f) empty
13169 };
13170
13171
13172-static struct cont_t intr_cont={
13173- empty,
13174- process_fd_request,
13175- empty,
13176- (done_f) empty
13177+static struct cont_t intr_cont = {
13178+ .interrupt = empty,
13179+ .redo = process_fd_request,
13180+ .error = empty,
13181+ .done = (done_f) empty
13182 };
13183
13184 static int wait_til_done(void (*handler)(void), int interruptible)
13185 {
13186 int ret;
13187
13188- schedule_bh((void *)(void *)handler);
13189+ schedule_bh(handler);
13190
13191 if (command_status < 2 && NO_SIGNAL) {
13192 DECLARE_WAITQUEUE(wait, current);
13193@@ -2281,11 +2267,12 @@
13194 #endif
13195 }
13196
13197-static struct cont_t format_cont={
13198- format_interrupt,
13199- redo_format,
13200- bad_flp_intr,
13201- generic_done };
13202+static struct cont_t format_cont = {
13203+ .interrupt = format_interrupt,
13204+ .redo = redo_format,
13205+ .error = bad_flp_intr,
13206+ .done = generic_done
13207+};
13208
13209 static int do_format(int drive, struct format_descr *tmp_format_req)
13210 {
13211@@ -2523,12 +2510,12 @@
13212 int size, i;
13213
13214 max_sector = transfer_size(ssize,
13215- minimum(max_sector, max_sector_2),
13216+ min(max_sector, max_sector_2),
13217 current_req->nr_sectors);
13218
13219 if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
13220 buffer_max > fsector_t + current_req->nr_sectors)
13221- current_count_sectors = minimum(buffer_max - fsector_t,
13222+ current_count_sectors = min_t(int, buffer_max - fsector_t,
13223 current_req->nr_sectors);
13224
13225 remaining = current_count_sectors << 9;
13226@@ -2546,7 +2533,7 @@
13227 }
13228 #endif
13229
13230- buffer_max = maximum(max_sector, buffer_max);
13231+ buffer_max = max(max_sector, buffer_max);
13232
13233 dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9);
13234
13235@@ -2697,7 +2684,7 @@
13236 if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){
13237 max_sector = 2 * _floppy->sect / 3;
13238 if (fsector_t >= max_sector){
13239- current_count_sectors = minimum(_floppy->sect - fsector_t,
13240+ current_count_sectors = min_t(int, _floppy->sect - fsector_t,
13241 current_req->nr_sectors);
13242 return 1;
13243 }
13244@@ -2987,7 +2974,7 @@
13245
13246 if (TESTF(FD_NEED_TWADDLE))
13247 twaddle();
13248- schedule_bh( (void *)(void *) floppy_start);
13249+ schedule_bh(floppy_start);
13250 #ifdef DEBUGT
13251 debugt("queue fd request");
13252 #endif
13253@@ -2996,16 +2983,17 @@
13254 #undef REPEAT
13255 }
13256
13257-static struct cont_t rw_cont={
13258- rw_interrupt,
13259- redo_fd_request,
13260- bad_flp_intr,
13261- request_done };
13262+static struct cont_t rw_cont = {
13263+ .interrupt = rw_interrupt,
13264+ .redo = redo_fd_request,
13265+ .error = bad_flp_intr,
13266+ .done = request_done
13267+};
13268
13269 static void process_fd_request(void)
13270 {
13271 cont = &rw_cont;
13272- schedule_bh( (void *)(void *) redo_fd_request);
13273+ schedule_bh(redo_fd_request);
13274 }
13275
13276 static void do_fd_request(request_queue_t * q)
13277@@ -3031,11 +3019,12 @@
13278 is_alive("do fd request");
13279 }
13280
13281-static struct cont_t poll_cont={
13282- success_and_wakeup,
13283- floppy_ready,
13284- generic_failure,
13285- generic_done };
13286+static struct cont_t poll_cont = {
13287+ .interrupt = success_and_wakeup,
13288+ .redo = floppy_ready,
13289+ .error = generic_failure,
13290+ .done = generic_done
13291+};
13292
13293 static int poll_drive(int interruptible, int flag)
13294 {
13295@@ -3066,11 +3055,12 @@
13296 printk("weird, reset interrupt called\n");
13297 }
13298
13299-static struct cont_t reset_cont={
13300- reset_intr,
13301- success_and_wakeup,
13302- generic_failure,
13303- generic_done };
13304+static struct cont_t reset_cont = {
13305+ .interrupt = reset_intr,
13306+ .redo = success_and_wakeup,
13307+ .error = generic_failure,
13308+ .done = generic_done
13309+};
13310
13311 static int user_reset_fdc(int drive, int arg, int interruptible)
13312 {
13313@@ -3174,11 +3164,11 @@
13314 }
13315
13316
13317-static struct cont_t raw_cmd_cont={
13318- success_and_wakeup,
13319- floppy_start,
13320- generic_failure,
13321- raw_cmd_done
13322+static struct cont_t raw_cmd_cont = {
13323+ .interrupt = success_and_wakeup,
13324+ .redo = floppy_start,
13325+ .error = generic_failure,
13326+ .done = raw_cmd_done
13327 };
13328
13329 static inline int raw_cmd_copyout(int cmd, char *param,
13330@@ -3781,9 +3771,9 @@
13331 }
13332 }
13333
13334- UDRS->fd_device = minor(inode->i_rdev);
13335- set_capacity(disks[drive], floppy_sizes[minor(inode->i_rdev)]);
13336- if (old_dev != -1 && old_dev != minor(inode->i_rdev)) {
13337+ UDRS->fd_device = iminor(inode);
13338+ set_capacity(disks[drive], floppy_sizes[iminor(inode)]);
13339+ if (old_dev != -1 && old_dev != iminor(inode)) {
13340 if (buffer_drive == drive)
13341 buffer_track = -1;
13342 }
13343@@ -3910,22 +3900,6 @@
13344 return 0;
13345 }
13346
13347-static int floppy_read_block_0(struct gendisk *disk)
13348-{
13349- struct block_device *bdev;
13350- int ret;
13351-
13352- bdev = bdget_disk(disk, 0);
13353- if (!bdev) {
13354- printk("No block device for %s\n", disk->disk_name);
13355- BUG();
13356- }
13357- bdev->bd_disk = disk; /* ewww */
13358- ret = __floppy_read_block_0(bdev);
13359- atomic_dec(&bdev->bd_count);
13360- return ret;
13361-}
13362-
13363 /* revalidate the floppy disk, i.e. trigger format autodetection by reading
13364 * the bootblock (block 0). "Autodetection" is also needed to check whether
13365 * there is a disk in the drive at all... Thus we also do it for fixed
13366@@ -3961,7 +3935,7 @@
13367 UDRS->generation++;
13368 if (NO_GEOM){
13369 /* auto-sensing */
13370- res = floppy_read_block_0(disk);
13371+ res = __floppy_read_block_0(opened_bdev[drive]);
13372 } else {
13373 if (cf)
13374 poll_drive(0, FD_RAW_NEED_DISK);
13375diff -Nru a/drivers/block/floppy98.c b/drivers/block/floppy98.c
13376--- a/drivers/block/floppy98.c Thu Aug 7 02:25:24 2003
13377+++ b/drivers/block/floppy98.c Tue Aug 26 09:44:42 2003
13378@@ -3844,9 +3844,9 @@
13379 }
13380 }
13381
13382- UDRS->fd_device = minor(inode->i_rdev);
13383- set_capacity(disks[drive], floppy_sizes[minor(inode->i_rdev)]);
13384- if (old_dev != -1 && old_dev != minor(inode->i_rdev)) {
13385+ UDRS->fd_device = iminor(inode);
13386+ set_capacity(disks[drive], floppy_sizes[iminor(inode)]);
13387+ if (old_dev != -1 && old_dev != iminor(inode)) {
13388 if (buffer_drive == drive)
13389 buffer_track = -1;
13390 }
13391@@ -3989,22 +3989,6 @@
13392 return 0;
13393 }
13394
13395-static int floppy_read_block_0(struct gendisk *disk)
13396-{
13397- struct block_device *bdev;
13398- int ret;
13399-
13400- bdev = bdget_disk(disk, 0);
13401- if (!bdev) {
13402- printk("No block device for %s\n", disk->disk_name);
13403- BUG();
13404- }
13405- bdev->bd_disk = disk; /* ewww */
13406- ret = __floppy_read_block_0(bdev);
13407- atomic_dec(&bdev->bd_count);
13408- return ret;
13409-}
13410-
13411 /* revalidate the floppy disk, i.e. trigger format autodetection by reading
13412 * the bootblock (block 0). "Autodetection" is also needed to check whether
13413 * there is a disk in the drive at all... Thus we also do it for fixed
13414@@ -4040,7 +4024,7 @@
13415 UDRS->generation++;
13416 if (NO_GEOM){
13417 /* auto-sensing */
13418- res = floppy_read_block_0(disk);
13419+ res = __floppy_read_block_0(opened_bdev[drive]);
13420 } else {
13421 if (cf)
13422 poll_drive(0, FD_RAW_NEED_DISK);
13423diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
13424--- a/drivers/block/genhd.c Fri Aug 1 02:22:20 2003
13425+++ b/drivers/block/genhd.c Tue Aug 26 12:06:15 2003
13426@@ -576,13 +576,10 @@
13427
13428 void set_device_ro(struct block_device *bdev, int flag)
13429 {
13430- struct gendisk *disk = bdev->bd_disk;
13431- if (bdev->bd_contains != bdev) {
13432- int part = bdev->bd_dev - MKDEV(disk->major, disk->first_minor);
13433- struct hd_struct *p = disk->part[part-1];
13434- if (p) p->policy = flag;
13435- } else
13436- disk->policy = flag;
13437+ if (bdev->bd_contains != bdev)
13438+ bdev->bd_part->policy = flag;
13439+ else
13440+ bdev->bd_disk->policy = flag;
13441 }
13442
13443 void set_disk_ro(struct gendisk *disk, int flag)
13444@@ -595,17 +592,12 @@
13445
13446 int bdev_read_only(struct block_device *bdev)
13447 {
13448- struct gendisk *disk;
13449 if (!bdev)
13450 return 0;
13451- disk = bdev->bd_disk;
13452- if (bdev->bd_contains != bdev) {
13453- int part = bdev->bd_dev - MKDEV(disk->major, disk->first_minor);
13454- struct hd_struct *p = disk->part[part-1];
13455- if (p) return p->policy;
13456- return 0;
13457- } else
13458- return disk->policy;
13459+ else if (bdev->bd_contains != bdev)
13460+ return bdev->bd_part->policy;
13461+ else
13462+ return bdev->bd_disk->policy;
13463 }
13464
13465 int invalidate_partition(struct gendisk *disk, int index)
13466diff -Nru a/drivers/block/ioctl.c b/drivers/block/ioctl.c
13467--- a/drivers/block/ioctl.c Thu Jul 17 22:30:42 2003
13468+++ b/drivers/block/ioctl.c Tue Aug 26 12:06:15 2003
13469@@ -8,7 +8,6 @@
13470 static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg *arg)
13471 {
13472 struct block_device *bdevp;
13473- int holder;
13474 struct gendisk *disk;
13475 struct blkpg_ioctl_arg a;
13476 struct blkpg_partition p;
13477@@ -41,8 +40,11 @@
13478 return -EINVAL;
13479 }
13480 /* partition number in use? */
13481- if (disk->part[part - 1])
13482+ down(&bdev->bd_sem);
13483+ if (disk->part[part - 1]) {
13484+ up(&bdev->bd_sem);
13485 return -EBUSY;
13486+ }
13487 /* overlap? */
13488 for (i = 0; i < disk->minors - 1; i++) {
13489 struct hd_struct *s = disk->part[i];
13490@@ -50,22 +52,26 @@
13491 if (!s)
13492 continue;
13493 if (!(start+length <= s->start_sect ||
13494- start >= s->start_sect + s->nr_sects))
13495+ start >= s->start_sect + s->nr_sects)) {
13496+ up(&bdev->bd_sem);
13497 return -EBUSY;
13498+ }
13499 }
13500 /* all seems OK */
13501 add_partition(disk, part, start, length);
13502+ up(&bdev->bd_sem);
13503 return 0;
13504 case BLKPG_DEL_PARTITION:
13505 if (!disk->part[part-1])
13506 return -ENXIO;
13507 if (disk->part[part - 1]->nr_sects == 0)
13508 return -ENXIO;
13509- /* partition in use? Incomplete check for now. */
13510 bdevp = bdget_disk(disk, part);
13511 if (!bdevp)
13512 return -ENOMEM;
13513- if (bd_claim(bdevp, &holder) < 0) {
13514+ down(&bdevp->bd_sem);
13515+ if (bdevp->bd_openers) {
13516+ up(&bdevp->bd_sem);
13517 bdput(bdevp);
13518 return -EBUSY;
13519 }
13520@@ -73,9 +79,12 @@
13521 fsync_bdev(bdevp);
13522 invalidate_bdev(bdevp, 0);
13523
13524+ down(&bdev->bd_sem);
13525 delete_partition(disk, part);
13526- bd_release(bdevp);
13527+ up(&bdev->bd_sem);
13528+ up(&bdevp->bd_sem);
13529 bdput(bdevp);
13530+
13531 return 0;
13532 default:
13533 return -EINVAL;
13534diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
13535--- a/drivers/block/ll_rw_blk.c Mon Aug 18 22:28:54 2003
13536+++ b/drivers/block/ll_rw_blk.c Tue Aug 26 12:06:15 2003
13537@@ -2043,24 +2043,23 @@
13538 static inline void blk_partition_remap(struct bio *bio)
13539 {
13540 struct block_device *bdev = bio->bi_bdev;
13541- struct gendisk *disk = bdev->bd_disk;
13542- struct hd_struct *p;
13543- if (bdev == bdev->bd_contains)
13544- return;
13545
13546- p = disk->part[bdev->bd_dev-MKDEV(disk->major,disk->first_minor)-1];
13547- switch (bio->bi_rw) {
13548- case READ:
13549- p->read_sectors += bio_sectors(bio);
13550- p->reads++;
13551- break;
13552- case WRITE:
13553- p->write_sectors += bio_sectors(bio);
13554- p->writes++;
13555- break;
13556+ if (bdev != bdev->bd_contains) {
13557+ struct hd_struct *p = bdev->bd_part;
13558+
13559+ switch (bio->bi_rw) {
13560+ case READ:
13561+ p->read_sectors += bio_sectors(bio);
13562+ p->reads++;
13563+ break;
13564+ case WRITE:
13565+ p->write_sectors += bio_sectors(bio);
13566+ p->writes++;
13567+ break;
13568+ }
13569+ bio->bi_sector += p->start_sect;
13570+ bio->bi_bdev = bdev->bd_contains;
13571 }
13572- bio->bi_sector += bdev->bd_offset;
13573- bio->bi_bdev = bdev->bd_contains;
13574 }
13575
13576 /**
13577diff -Nru a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
13578--- a/drivers/block/paride/pg.c Sun May 25 02:45:05 2003
13579+++ b/drivers/block/paride/pg.c Tue Aug 26 09:25:41 2003
13580@@ -527,11 +527,9 @@
13581 return -1;
13582 }
13583
13584-#define DEVICE_NR(dev) (minor(dev) & 0x7F)
13585-
13586 static int pg_open(struct inode *inode, struct file *file)
13587 {
13588- int unit = DEVICE_NR(inode->i_rdev);
13589+ int unit = iminor(inode) & 0x7f;
13590 struct pg *dev = &devices[unit];
13591
13592 if ((unit >= PG_UNITS) || (!dev->present))
13593diff -Nru a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
13594--- a/drivers/block/paride/pt.c Sun May 25 02:45:06 2003
13595+++ b/drivers/block/paride/pt.c Tue Aug 26 09:25:41 2003
13596@@ -670,11 +670,11 @@
13597 return -1;
13598 }
13599
13600-#define DEVICE_NR(dev) (minor(dev) & 0x7F)
13601+#define DEVICE_NR(inode) (iminor(inode) & 0x7F)
13602
13603 static int pt_open(struct inode *inode, struct file *file)
13604 {
13605- int unit = DEVICE_NR(inode->i_rdev);
13606+ int unit = DEVICE_NR(inode);
13607
13608 if ((unit >= PT_UNITS) || (!PT.present))
13609 return -ENODEV;
13610@@ -696,7 +696,7 @@
13611 return -EROFS;
13612 }
13613
13614- if (!(minor(inode->i_rdev) & 128))
13615+ if (!(iminor(inode) & 128))
13616 PT.flags |= PT_REWIND;
13617
13618 PT.bufptr = kmalloc(PT_BUFSIZE, GFP_KERNEL);
13619@@ -715,7 +715,7 @@
13620 int unit;
13621 struct mtop mtop;
13622
13623- unit = DEVICE_NR(inode->i_rdev);
13624+ unit = DEVICE_NR(inode);
13625 if (unit >= PT_UNITS)
13626 return -EINVAL;
13627 if (!PT.present)
13628@@ -753,7 +753,7 @@
13629 static int
13630 pt_release(struct inode *inode, struct file *file)
13631 {
13632- int unit = DEVICE_NR(inode->i_rdev);
13633+ int unit = DEVICE_NR(inode);
13634
13635 if ((unit >= PT_UNITS) || (atomic_read(&PT.available) > 1))
13636 return -EINVAL;
13637@@ -776,7 +776,7 @@
13638 static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
13639 {
13640 struct inode *ino = filp->f_dentry->d_inode;
13641- int unit = DEVICE_NR(ino->i_rdev);
13642+ int unit = DEVICE_NR(ino);
13643 char rd_cmd[12] = { ATAPI_READ_6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
13644 int k, n, r, p, s, t, b;
13645
13646@@ -873,7 +873,7 @@
13647 static ssize_t pt_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
13648 {
13649 struct inode *ino = filp->f_dentry->d_inode;
13650- int unit = DEVICE_NR(ino->i_rdev);
13651+ int unit = DEVICE_NR(ino);
13652 char wr_cmd[12] = { ATAPI_WRITE_6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
13653 int k, n, r, p, s, t, b;
13654
13655diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
13656--- a/drivers/block/rd.c Thu Aug 7 02:25:24 2003
13657+++ b/drivers/block/rd.c Tue Aug 26 10:05:56 2003
13658@@ -245,6 +245,7 @@
13659 static int rd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
13660 {
13661 int error;
13662+ struct block_device *bdev = inode->i_bdev;
13663
13664 if (cmd != BLKFLSBUF)
13665 return -EINVAL;
13666@@ -253,12 +254,12 @@
13667 it's not like with the other blockdevices where
13668 this ioctl only flushes away the buffer cache. */
13669 error = -EBUSY;
13670- down(&inode->i_bdev->bd_sem);
13671- if (inode->i_bdev->bd_openers <= 2) {
13672- truncate_inode_pages(inode->i_mapping, 0);
13673+ down(&bdev->bd_sem);
13674+ if (bdev->bd_openers <= 2) {
13675+ truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
13676 error = 0;
13677 }
13678- up(&inode->i_bdev->bd_sem);
13679+ up(&bdev->bd_sem);
13680 return error;
13681 }
13682
13683@@ -269,18 +270,18 @@
13684
13685 static int rd_open(struct inode * inode, struct file * filp)
13686 {
13687- unsigned unit = minor(inode->i_rdev);
13688+ unsigned unit = iminor(inode);
13689
13690 /*
13691 * Immunize device against invalidate_buffers() and prune_icache().
13692 */
13693 if (rd_bdev[unit] == NULL) {
13694 struct block_device *bdev = inode->i_bdev;
13695- atomic_inc(&bdev->bd_count);
13696+ inode = igrab(bdev->bd_inode);
13697 rd_bdev[unit] = bdev;
13698 bdev->bd_openers++;
13699 bdev->bd_block_size = rd_blocksize;
13700- bdev->bd_inode->i_size = get_capacity(rd_disks[unit])<<9;
13701+ inode->i_size = get_capacity(rd_disks[unit])<<9;
13702 inode->i_mapping->a_ops = &ramdisk_aops;
13703 inode->i_mapping->backing_dev_info = &rd_backing_dev_info;
13704 }
13705diff -Nru a/drivers/block/z2ram.c b/drivers/block/z2ram.c
13706--- a/drivers/block/z2ram.c Thu Aug 7 02:25:24 2003
13707+++ b/drivers/block/z2ram.c Wed Jul 30 15:20:18 2003
13708@@ -28,10 +28,10 @@
13709 #define DEVICE_NAME "Z2RAM"
13710
13711 #include <linux/major.h>
13712-#include <linux/slab.h>
13713 #include <linux/vmalloc.h>
13714 #include <linux/init.h>
13715 #include <linux/module.h>
13716+#include <linux/blkdev.h>
13717
13718 #include <asm/setup.h>
13719 #include <asm/bitops.h>
13720@@ -150,7 +150,7 @@
13721 sizeof( z2ram_map[0] );
13722 int rc = -ENOMEM;
13723
13724- device = minor( inode->i_rdev );
13725+ device = iminor(inode);
13726
13727 if ( current_device != -1 && current_device != device )
13728 {
13729diff -Nru a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
13730--- a/drivers/char/agp/Kconfig Fri Aug 15 07:33:19 2003
13731+++ b/drivers/char/agp/Kconfig Thu Aug 28 16:22:00 2003
13732@@ -63,15 +63,19 @@
13733 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
13734 use GLX or DRI. If unsure, say N.
13735
13736+# RED-PEN this option is misnamed, it's not 8151 specific
13737 config AGP_AMD_8151
13738- tristate "AMD Opteron/Athlon64 on-CPU GART support"
13739+ tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
13740 depends on AGP && X86
13741- default GART_IOMMU
13742+ default y if GART_IOMMU
13743 help
13744 This option gives you AGP support for the GLX component of
13745- XFree86 4.x using the on-CPU AGP bridge of the AMD Athlon64/Opteron CPUs.
13746+ XFree86 4.x using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
13747+ You still need an external AGP bridge like the AMD 8151, VIA
13748+ K8T400M, SiS755. It may also support other AGP bridges when loaded
13749+ with agp_try_unsupported=1.
13750 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
13751- use GLX or DRI. If unsure, say N
13752+ use GLX or DRI. If unsure, say Y
13753
13754 config AGP_INTEL
13755 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support"
13756diff -Nru a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
13757--- a/drivers/char/agp/agp.h Fri Aug 15 06:28:58 2003
13758+++ b/drivers/char/agp/agp.h Thu Aug 28 18:04:31 2003
13759@@ -167,8 +167,10 @@
13760
13761 #define PGE_EMPTY(b, p) (!(p) || (p) == (unsigned long) (b)->scratch_page)
13762
13763-/* intel register */
13764-#define INTEL_APBASE 0x10
13765+/* Chipset independant registers (from AGP Spec) */
13766+#define AGP_APBASE 0x10
13767+
13768+/* Intel registers */
13769 #define INTEL_APSIZE 0xb4
13770 #define INTEL_ATTBASE 0xb8
13771 #define INTEL_AGPCTRL 0xb0
13772@@ -176,7 +178,6 @@
13773 #define INTEL_ERRSTS 0x91
13774
13775 /* Intel 460GX Registers */
13776-#define INTEL_I460_APBASE 0x10
13777 #define INTEL_I460_BAPBASE 0x98
13778 #define INTEL_I460_GXBCTL 0xa0
13779 #define INTEL_I460_AGPSIZ 0xa2
13780@@ -184,7 +185,7 @@
13781 #define INTEL_I460_GATT_VALID (1UL << 24)
13782 #define INTEL_I460_GATT_COHERENT (1UL << 25)
13783
13784-/* intel i830 registers */
13785+/* Intel i830 registers */
13786 #define I830_GMCH_CTRL 0x52
13787 #define I830_GMCH_ENABLED 0x4
13788 #define I830_GMCH_MEM_MASK 0x1
13789@@ -218,31 +219,31 @@
13790 #define I852_GME 0x2
13791 #define I852_GM 0x5
13792
13793-/* intel 815 register */
13794+/* Intel 815 register */
13795 #define INTEL_815_APCONT 0x51
13796 #define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF
13797
13798-/* intel i820 registers */
13799+/* Intel i820 registers */
13800 #define INTEL_I820_RDCR 0x51
13801 #define INTEL_I820_ERRSTS 0xc8
13802
13803-/* intel i840 registers */
13804+/* Intel i840 registers */
13805 #define INTEL_I840_MCHCFG 0x50
13806 #define INTEL_I840_ERRSTS 0xc8
13807
13808-/* intel i845 registers */
13809+/* Intel i845 registers */
13810 #define INTEL_I845_AGPM 0x51
13811 #define INTEL_I845_ERRSTS 0xc8
13812
13813-/* intel i850 registers */
13814+/* Intel i850 registers */
13815 #define INTEL_I850_MCHCFG 0x50
13816 #define INTEL_I850_ERRSTS 0xc8
13817
13818-/* intel i860 registers */
13819+/* Intel i860 registers */
13820 #define INTEL_I860_MCHCFG 0x50
13821 #define INTEL_I860_ERRSTS 0xc8
13822
13823-/* intel i810 registers */
13824+/* Intel i810 registers */
13825 #define I810_GMADDR 0x10
13826 #define I810_MMADDR 0x14
13827 #define I810_PTE_BASE 0x10000
13828@@ -261,7 +262,6 @@
13829 #define I810_DRAM_ROW_0_SDRAM 0x00000001
13830
13831 /* Intel 7505 registers */
13832-#define INTEL_I7505_NAPBASELO 0x10
13833 #define INTEL_I7505_APSIZE 0x74
13834 #define INTEL_I7505_NCAPID 0x60
13835 #define INTEL_I7505_NISTAT 0x6c
13836@@ -271,26 +271,23 @@
13837 #define INTEL_I7505_MCHCFG 0x50
13838
13839 /* VIA register */
13840-#define VIA_APBASE 0x10
13841 #define VIA_GARTCTRL 0x80
13842 #define VIA_APSIZE 0x84
13843 #define VIA_ATTBASE 0x88
13844
13845 /* VIA KT400 */
13846 #define VIA_AGP3_GARTCTRL 0x90
13847-#define VIA_AGP3_APSIZE 0x94
13848+#define VIA_AGP3_APSIZE 0x94
13849 #define VIA_AGP3_ATTBASE 0x98
13850-#define VIA_AGPSEL 0xfd
13851+#define VIA_AGPSEL 0xfd
13852
13853 /* SiS registers */
13854-#define SIS_APBASE 0x10
13855 #define SIS_ATTBASE 0x90
13856 #define SIS_APSIZE 0x94
13857 #define SIS_TLBCNTRL 0x97
13858 #define SIS_TLBFLUSH 0x98
13859
13860 /* AMD registers */
13861-#define AMD_APBASE 0x10
13862 #define AMD_MMBASE 0x14
13863 #define AMD_APSIZE 0xac
13864 #define AMD_MODECNTL 0xb0
13865@@ -300,24 +297,14 @@
13866 #define AMD_TLBFLUSH 0x0c /* In mmio region (32-bit register) */
13867 #define AMD_CACHEENTRY 0x10 /* In mmio region (32-bit register) */
13868
13869-#define AMD_8151_APSIZE 0xb4
13870-#define AMD_8151_GARTBLOCK 0xb8
13871-
13872-#define AMD_X86_64_GARTAPERTURECTL 0x90
13873-#define AMD_X86_64_GARTAPERTUREBASE 0x94
13874-#define AMD_X86_64_GARTTABLEBASE 0x98
13875-#define AMD_X86_64_GARTCACHECTL 0x9c
13876-#define AMD_X86_64_GARTEN 1<<0
13877-
13878-#define AMD_8151_VMAPERTURE 0x10
13879-#define AMD_8151_AGP_CTL 0xb0
13880-#define AMD_8151_APERTURESIZE 0xb4
13881-#define AMD_8151_GARTPTR 0xb8
13882-#define AMD_8151_GTLBEN 1<<7
13883-#define AMD_8151_APEREN 1<<8
13884+/* AMD64 registers */
13885+#define AMD64_GARTAPERTURECTL 0x90
13886+#define AMD64_GARTAPERTUREBASE 0x94
13887+#define AMD64_GARTTABLEBASE 0x98
13888+#define AMD64_GARTCACHECTL 0x9c
13889+#define AMD64_GARTEN 1<<0
13890
13891 /* ALi registers */
13892-#define ALI_APBASE 0x10
13893 #define ALI_AGPCTRL 0xb8
13894 #define ALI_ATTBASE 0xbc
13895 #define ALI_TLBCTRL 0xc0
13896@@ -327,19 +314,17 @@
13897 #define ALI_CACHE_FLUSH_EN 0x100
13898
13899 /* ATI register */
13900-#define ATI_APBASE 0x10
13901-#define ATI_GART_MMBASE_ADDR 0x14
13902-#define ATI_RS100_APSIZE 0xac
13903-#define ATI_RS300_APSIZE 0xf8
13904-#define ATI_RS100_IG_AGPMODE 0xb0
13905-#define ATI_RS300_IG_AGPMODE 0xfc
13906-
13907-#define ATI_GART_FEATURE_ID 0x00
13908-#define ATI_GART_BASE 0x04
13909-#define ATI_GART_CACHE_SZBASE 0x08
13910-#define ATI_GART_CACHE_CNTRL 0x0c
13911-#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
13912-
13913+#define ATI_GART_MMBASE_ADDR 0x14
13914+#define ATI_RS100_APSIZE 0xac
13915+#define ATI_RS300_APSIZE 0xf8
13916+#define ATI_RS100_IG_AGPMODE 0xb0
13917+#define ATI_RS300_IG_AGPMODE 0xfc
13918+
13919+#define ATI_GART_FEATURE_ID 0x00
13920+#define ATI_GART_BASE 0x04
13921+#define ATI_GART_CACHE_SZBASE 0x08
13922+#define ATI_GART_CACHE_CNTRL 0x0c
13923+#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
13924
13925 /* Serverworks Registers */
13926 #define SVWRKS_APSIZE 0x10
13927@@ -369,6 +354,17 @@
13928 #define HP_ZX1_PDIR_BASE 0x320
13929 #define HP_ZX1_CACHE_FLUSH 0x428
13930
13931+/* NVIDIA registers */
13932+#define NVIDIA_0_APSIZE 0x80
13933+#define NVIDIA_1_WBC 0xf0
13934+#define NVIDIA_2_GARTCTRL 0xd0
13935+#define NVIDIA_2_APBASE 0xd8
13936+#define NVIDIA_2_APLIMIT 0xdc
13937+#define NVIDIA_2_ATTBASE(i) (0xe0 + (i) * 4)
13938+#define NVIDIA_3_APBASE 0x50
13939+#define NVIDIA_3_APLIMIT 0x54
13940+
13941+
13942 struct agp_device_ids {
13943 unsigned short device_id; /* first, to make table easier to read */
13944 enum chipset_type chipset;
13945@@ -405,6 +401,9 @@
13946 void global_cache_flush(void);
13947 void get_agp_version(struct agp_bridge_data *bridge);
13948 unsigned long agp_generic_mask_memory(unsigned long addr, int type);
13949+
13950+extern int agp_off;
13951+extern int agp_try_unsupported_boot;
13952
13953 /* Standard agp registers */
13954 #define AGPSTAT 0x4
13955diff -Nru a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
13956--- a/drivers/char/agp/ali-agp.c Mon Aug 18 10:39:21 2003
13957+++ b/drivers/char/agp/ali-agp.c Thu Aug 28 16:44:18 2003
13958@@ -76,7 +76,7 @@
13959 pci_write_config_dword(agp_bridge->dev, ALI_TLBCTRL, ((temp & 0xffffff00) | 0x00000010));
13960
13961 /* address to map to */
13962- pci_read_config_dword(agp_bridge->dev, ALI_APBASE, &temp);
13963+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
13964 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
13965
13966 #if 0
13967diff -Nru a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
13968--- a/drivers/char/agp/amd-k7-agp.c Mon Aug 18 10:39:21 2003
13969+++ b/drivers/char/agp/amd-k7-agp.c Thu Aug 28 16:44:18 2003
13970@@ -148,7 +148,7 @@
13971 * used to program the agp master not the cpu
13972 */
13973
13974- pci_read_config_dword(agp_bridge->dev, AMD_APBASE, &temp);
13975+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
13976 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
13977 agp_bridge->gart_bus_addr = addr;
13978
13979diff -Nru a/drivers/char/agp/amd-k8-agp.c b/drivers/char/agp/amd-k8-agp.c
13980--- a/drivers/char/agp/amd-k8-agp.c Thu Jul 31 08:58:45 2003
13981+++ b/drivers/char/agp/amd-k8-agp.c Thu Aug 28 18:04:31 2003
13982@@ -8,12 +8,6 @@
13983 * work is done in the northbridge(s).
13984 */
13985
13986-/*
13987- * On x86-64 the AGP driver needs to be initialized early by the IOMMU
13988- * code. When you use this driver as a template for a new K8 AGP bridge
13989- * driver don't forget to change arch/x86_64/kernel/pci-gart.c too -AK.
13990- */
13991-
13992 #include <linux/module.h>
13993 #include <linux/pci.h>
13994 #include <linux/init.h>
13995@@ -21,7 +15,11 @@
13996 #include "agp.h"
13997
13998 /* Will need to be increased if hammer ever goes >8-way. */
13999+#ifdef CONFIG_SMP
14000 #define MAX_HAMMER_GARTS 8
14001+#else
14002+#define MAX_HAMMER_GARTS 1
14003+#endif
14004
14005 /* PTE bits. */
14006 #define GPTE_VALID 1
14007@@ -39,6 +37,8 @@
14008 static int nr_garts;
14009 static struct pci_dev * hammers[MAX_HAMMER_GARTS];
14010
14011+static int __initdata agp_try_unsupported;
14012+
14013 static int gart_iterator;
14014 #define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++)
14015
14016@@ -46,9 +46,9 @@
14017 {
14018 u32 tmp;
14019
14020- pci_read_config_dword (dev, AMD_X86_64_GARTCACHECTL, &tmp);
14021+ pci_read_config_dword (dev, AMD64_GARTCACHECTL, &tmp);
14022 tmp |= INVGART;
14023- pci_write_config_dword (dev, AMD_X86_64_GARTCACHECTL, tmp);
14024+ pci_write_config_dword (dev, AMD64_GARTCACHECTL, tmp);
14025 }
14026
14027 static void amd_x86_64_tlbflush(struct agp_memory *temp)
14028@@ -135,7 +135,7 @@
14029 if (dev==NULL)
14030 return 0;
14031
14032- pci_read_config_dword(dev, AMD_X86_64_GARTAPERTURECTL, &temp);
14033+ pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &temp);
14034 temp = (temp & 0xe);
14035 values = A_SIZE_32(x86_64_aperture_sizes);
14036
14037@@ -162,7 +162,7 @@
14038 u64 addr, aper_base;
14039
14040 /* Address to map to */
14041- pci_read_config_dword (hammer, AMD_X86_64_GARTAPERTUREBASE, &tmp);
14042+ pci_read_config_dword (hammer, AMD64_GARTAPERTUREBASE, &tmp);
14043 aperturebase = tmp << 25;
14044 aper_base = (aperturebase & PCI_BASE_ADDRESS_MEM_MASK);
14045
14046@@ -171,13 +171,13 @@
14047 addr >>= 12;
14048 tmp = (u32) addr<<4;
14049 tmp &= ~0xf;
14050- pci_write_config_dword (hammer, AMD_X86_64_GARTTABLEBASE, tmp);
14051+ pci_write_config_dword (hammer, AMD64_GARTTABLEBASE, tmp);
14052
14053 /* Enable GART translation for this hammer. */
14054- pci_read_config_dword(hammer, AMD_X86_64_GARTAPERTURECTL, &tmp);
14055+ pci_read_config_dword(hammer, AMD64_GARTAPERTURECTL, &tmp);
14056 tmp |= GARTEN;
14057 tmp &= ~(DISGARTCPU | DISGARTIO);
14058- pci_write_config_dword(hammer, AMD_X86_64_GARTAPERTURECTL, tmp);
14059+ pci_write_config_dword(hammer, AMD64_GARTAPERTURECTL, tmp);
14060
14061 /* keep CPU's coherent. */
14062 flush_x86_64_tlb (hammer);
14063@@ -216,9 +216,9 @@
14064
14065 for_each_nb() {
14066 /* disable gart translation */
14067- pci_read_config_dword (hammers[gart_iterator], AMD_X86_64_GARTAPERTURECTL, &tmp);
14068- tmp &= ~(AMD_X86_64_GARTEN);
14069- pci_write_config_dword (hammers[gart_iterator], AMD_X86_64_GARTAPERTURECTL, tmp);
14070+ pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp);
14071+ tmp &= ~AMD64_GARTEN;
14072+ pci_write_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, tmp);
14073 }
14074 }
14075
14076@@ -246,24 +246,123 @@
14077 .agp_destroy_page = agp_generic_destroy_page,
14078 };
14079
14080+/* Some basic sanity checks for the aperture. */
14081+static int __init aperture_valid(u64 aper, u32 size)
14082+{
14083+ static int not_first_call;
14084+ u32 pfn, c;
14085+ if (aper == 0) {
14086+ printk(KERN_ERR "No aperture\n");
14087+ return 0;
14088+ }
14089+ if (size < 32*1024*1024) {
14090+ printk(KERN_ERR "Aperture too small (%d MB)\n", size>>20);
14091+ return 0;
14092+ }
14093+ if (aper + size > 0xffffffff) {
14094+ printk(KERN_ERR "Aperture out of bounds\n");
14095+ return 0;
14096+ }
14097+ pfn = aper >> PAGE_SHIFT;
14098+ for (c = 0; c < size/PAGE_SIZE; c++) {
14099+ if (!pfn_valid(pfn + c))
14100+ break;
14101+ if (!PageReserved(pfn_to_page(pfn + c))) {
14102+ printk(KERN_ERR "Aperture pointing to RAM\n");
14103+ return 0;
14104+ }
14105+ }
14106
14107-#ifdef CONFIG_SMP
14108-static int cache_nbs (void)
14109+ /* Request the Aperture. This catches cases when someone else
14110+ already put a mapping in there - happens with some very broken BIOS
14111+
14112+ Maybe better to use pci_assign_resource/pci_enable_device instead trusting
14113+ the bridges? */
14114+ if (!not_first_call && request_mem_region(aper, size, "aperture") < 0) {
14115+ printk(KERN_ERR "Aperture conflicts with PCI mapping.\n");
14116+ return 0;
14117+ }
14118+
14119+ not_first_call = 1;
14120+ return 1;
14121+}
14122+
14123+/*
14124+ * W*s centric BIOS sometimes only set up the aperture in the AGP
14125+ * bridge, not the northbridge. On AMD64 this is handled early
14126+ * in aperture.c, but when GART_IOMMU is not enabled or we run
14127+ * on a 32bit kernel this needs to be redone.
14128+ * Unfortunately it is impossible to fix the aperture here because it's too late
14129+ * to allocate that much memory. But at least error out cleanly instead of
14130+ * crashing.
14131+ */
14132+static __init int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
14133+ u16 cap)
14134+{
14135+ u32 aper_low, aper_hi;
14136+ u64 aper, nb_aper;
14137+ int order = 0;
14138+ u32 nb_order, nb_base;
14139+ u16 apsize;
14140+
14141+ pci_read_config_dword(nb, 0x90, &nb_order);
14142+ nb_order = (nb_order >> 1) & 7;
14143+ pci_read_config_dword(nb, 0x94, &nb_base);
14144+ nb_aper = nb_base << 25;
14145+ if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) {
14146+ return 0;
14147+ }
14148+
14149+ /* Northbridge seems to contain crap. Try the AGP bridge. */
14150+
14151+ pci_read_config_word(agp, cap+0x14, &apsize);
14152+ if (apsize == 0xffff)
14153+ return -1;
14154+
14155+ apsize &= 0xfff;
14156+ /* Some BIOS use weird encodings not in the AGPv3 table. */
14157+ if (apsize & 0xff)
14158+ apsize |= 0xf00;
14159+ order = 7 - hweight16(apsize);
14160+
14161+ pci_read_config_dword(agp, 0x10, &aper_low);
14162+ pci_read_config_dword(agp, 0x14, &aper_hi);
14163+ aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
14164+ printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order);
14165+ if (order < 0 || !aperture_valid(aper, (32*1024*1024)<<order))
14166+ return -1;
14167+
14168+ pci_write_config_dword(nb, 0x90, order << 1);
14169+ pci_write_config_dword(nb, 0x94, aper >> 25);
14170+
14171+ return 0;
14172+}
14173+
14174+static __init int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
14175 {
14176 struct pci_dev *loop_dev = NULL;
14177 int i = 0;
14178
14179 /* cache pci_devs of northbridges. */
14180- while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) {
14181+ while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev))
14182+ != NULL) {
14183+ if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) {
14184+ printk("No usable aperture found.\n");
14185+#ifdef __x86_64__
14186+ /* should port this to i386 */
14187+ printk("Consider rebooting with iommu=memaper=2 to get a good aperture.\n");
14188+#endif
14189+ return -1;
14190+ }
14191 hammers[i++] = loop_dev;
14192 nr_garts = i;
14193- if (i == MAX_HAMMER_GARTS)
14194+ if (i == MAX_HAMMER_GARTS) {
14195+ printk(KERN_INFO "Too many northbridges for AGP\n");
14196 return -1;
14197+ }
14198 }
14199- return 0;
14200+ return i == 0 ? -1 : 0;
14201 }
14202-#endif
14203-
14204
14205 static int __init agp_amdk8_probe(struct pci_dev *pdev,
14206 const struct pci_device_id *ent)
14207@@ -277,7 +376,7 @@
14208 if (!cap_ptr)
14209 return -ENODEV;
14210
14211- printk(KERN_INFO PFX "Detected Opteron/Athlon64 on-CPU GART\n");
14212+ /* Could check for AGPv3 here */
14213
14214 bridge = agp_alloc_bridge();
14215 if (!bridge)
14216@@ -311,6 +410,9 @@
14217 bridge->major_version = 3;
14218 bridge->minor_version = 0;
14219 }
14220+ } else {
14221+ printk(KERN_INFO PFX "Detected AGP bridge %x\n",
14222+ pdev->devfn);
14223 }
14224
14225 bridge->driver = &amd_8151_driver;
14226@@ -320,22 +422,10 @@
14227 /* Fill in the mode register */
14228 pci_read_config_dword(pdev, bridge->capndx+PCI_AGP_STATUS, &bridge->mode);
14229
14230-#ifdef CONFIG_SMP
14231- if (cache_nbs() == -1) {
14232+ if (cache_nbs(pdev, cap_ptr) == -1) {
14233 agp_put_bridge(bridge);
14234- return -ENOMEM;
14235- }
14236-#else
14237- {
14238- struct pci_dev *loop_dev = NULL;
14239- while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) {
14240- /* For UP, we only care about the first GART. */
14241- hammers[0] = loop_dev;
14242- nr_garts = 1;
14243- break;
14244- }
14245+ return -ENODEV;
14246 }
14247-#endif
14248
14249 pci_set_drvdata(pdev, bridge);
14250 return agp_add_bridge(bridge);
14251@@ -345,6 +435,8 @@
14252 {
14253 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
14254
14255+ release_mem_region(virt_to_phys(bridge->gatt_table_real),
14256+ x86_64_aperture_sizes[bridge->aperture_size_idx].size);
14257 agp_remove_bridge(bridge);
14258 agp_put_bridge(bridge);
14259 }
14260@@ -358,11 +450,21 @@
14261 .subvendor = PCI_ANY_ID,
14262 .subdevice = PCI_ANY_ID,
14263 },
14264+ /* VIA K8T800 */
14265 {
14266 .class = (PCI_CLASS_BRIDGE_HOST << 8),
14267 .class_mask = ~0,
14268 .vendor = PCI_VENDOR_ID_VIA,
14269- .device = PCI_DEVICE_ID_VIA_K8T400M_0,
14270+ .device = PCI_DEVICE_ID_VIA_8385_0,
14271+ .subvendor = PCI_ANY_ID,
14272+ .subdevice = PCI_ANY_ID,
14273+ },
14274+ /* VIA K8M800 / K8N800 */
14275+ {
14276+ .class = (PCI_CLASS_BRIDGE_HOST << 8),
14277+ .class_mask = ~0,
14278+ .vendor = PCI_VENDOR_ID_VIA,
14279+ .device = PCI_DEVICE_ID_VIA_8380_0,
14280 .subvendor = PCI_ANY_ID,
14281 .subdevice = PCI_ANY_ID,
14282 },
14283@@ -386,10 +488,43 @@
14284 .remove = agp_amdk8_remove,
14285 };
14286
14287+
14288 /* Not static due to IOMMU code calling it early. */
14289 int __init agp_amdk8_init(void)
14290 {
14291- return pci_module_init(&agp_amdk8_pci_driver);
14292+ int err = 0;
14293+ if (agp_off)
14294+ return -EINVAL;
14295+ if (pci_module_init(&agp_amdk8_pci_driver) == 0) {
14296+ struct pci_dev *dev;
14297+ if (!agp_try_unsupported && !agp_try_unsupported_boot) {
14298+ printk(KERN_INFO "No supported AGP bridge found.\n");
14299+#ifdef MODULE
14300+ printk(KERN_INFO "You can try agp_try_unsupported=1\n");
14301+#else
14302+ printk(KERN_INFO "You can boot with agp=try_unsupported\n");
14303+#endif
14304+ return -ENODEV;
14305+ }
14306+
14307+ /* First check that we have at least one K8 NB */
14308+ if (!pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, NULL))
14309+ return -ENODEV;
14310+
14311+ /* Look for any AGP bridge */
14312+ dev = NULL;
14313+ err = -ENODEV;
14314+ while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
14315+ if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
14316+ continue;
14317+ /* Only one bridge supported right now */
14318+ if (agp_amdk8_probe(dev, NULL) == 0) {
14319+ err = 0;
14320+ break;
14321+ }
14322+ }
14323+ }
14324+ return err;
14325 }
14326
14327 static void __exit agp_amdk8_cleanup(void)
14328@@ -404,6 +539,6 @@
14329 module_exit(agp_amdk8_cleanup);
14330 #endif
14331
14332-MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
14333+MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>, Andi Kleen");
14334+MODULE_PARM(agp_try_unsupported, "1i");
14335 MODULE_LICENSE("GPL and additional rights");
14336-
14337diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
14338--- a/drivers/char/agp/ati-agp.c Mon Aug 18 10:39:21 2003
14339+++ b/drivers/char/agp/ati-agp.c Thu Aug 28 16:44:18 2003
14340@@ -1,5 +1,5 @@
14341 /*
14342- * ALi AGPGART routines.
14343+ * ATi AGPGART routines.
14344 */
14345
14346 #include <linux/types.h>
14347@@ -212,7 +212,7 @@
14348
14349 /* address to map too */
14350 /*
14351- pci_read_config_dword(agp_bridge.dev, ATI_APBASE, &temp);
14352+ pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp);
14353 agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14354 printk(KERN_INFO "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr);
14355 */
14356@@ -355,7 +355,7 @@
14357 * This is a bus address even on the alpha, b/c its
14358 * used to program the agp master not the cpu
14359 */
14360- pci_read_config_dword(agp_bridge->dev, ATI_APBASE, &temp);
14361+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14362 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14363 agp_bridge->gart_bus_addr = addr;
14364
14365diff -Nru a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
14366--- a/drivers/char/agp/backend.c Wed Aug 13 10:20:16 2003
14367+++ b/drivers/char/agp/backend.c Thu Aug 28 16:22:00 2003
14368@@ -301,9 +301,14 @@
14369 }
14370 EXPORT_SYMBOL_GPL(agp_remove_bridge);
14371
14372+int agp_off;
14373+int agp_try_unsupported_boot;
14374+EXPORT_SYMBOL(agp_off);
14375+EXPORT_SYMBOL(agp_try_unsupported_boot);
14376
14377 static int __init agp_init(void)
14378 {
14379+ if (!agp_off)
14380 printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
14381 AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
14382 return 0;
14383@@ -313,6 +318,15 @@
14384 {
14385 }
14386
14387+static __init int agp_setup(char *s)
14388+{
14389+ if (!strcmp(s,"off"))
14390+ agp_off = 1;
14391+ if (!strcmp(s,"try_unsupported"))
14392+ agp_try_unsupported_boot = 1;
14393+ return 1;
14394+}
14395+__setup("agp=", agp_setup);
14396
14397 MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
14398 MODULE_DESCRIPTION("AGP GART driver");
14399diff -Nru a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
14400--- a/drivers/char/agp/frontend.c Sun Jul 13 05:36:05 2003
14401+++ b/drivers/char/agp/frontend.c Tue Aug 26 09:25:41 2003
14402@@ -698,7 +698,7 @@
14403
14404 static int agp_open(struct inode *inode, struct file *file)
14405 {
14406- int minor = minor(inode->i_rdev);
14407+ int minor = iminor(inode);
14408 struct agp_file_private *priv;
14409 struct agp_client *client;
14410 int rc = -ENXIO;
14411diff -Nru a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
14412--- a/drivers/char/agp/generic.c Wed Aug 13 01:35:50 2003
14413+++ b/drivers/char/agp/generic.c Wed Aug 27 11:06:10 2003
14414@@ -577,12 +577,12 @@
14415 agp_device_command(command, TRUE);
14416 return;
14417 } else {
14418- /* Disable calibration cycle in RX91<1> when not in AGP3.0 mode of operation.*/
14419+ /* Disable calibration cycle in RX91<1> when not in AGP3.0 mode of operation.*/
14420 command &= ~(7<<10) ;
14421 pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &temp);
14422 temp |= (1<<9);
14423 pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, temp);
14424-
14425+
14426 printk (KERN_INFO PFX "Device is in legacy mode,"
14427 " falling back to 2.x\n");
14428 }
14429diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
14430--- a/drivers/char/agp/intel-agp.c Fri Aug 15 07:25:05 2003
14431+++ b/drivers/char/agp/intel-agp.c Thu Aug 28 16:44:18 2003
14432@@ -618,7 +618,7 @@
14433 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14434
14435 /* address to map to */
14436- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14437+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14438 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14439
14440 /* attbase - aperture base */
14441@@ -657,7 +657,7 @@
14442 current_size->size_value);
14443
14444 /* address to map to */
14445- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14446+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14447 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14448
14449 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
14450@@ -708,7 +708,7 @@
14451 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14452
14453 /* address to map to */
14454- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14455+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14456 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14457
14458 /* attbase - aperture base */
14459@@ -739,7 +739,7 @@
14460 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14461
14462 /* address to map to */
14463- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14464+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14465 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14466
14467 /* attbase - aperture base */
14468@@ -768,7 +768,7 @@
14469 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14470
14471 /* address to map to */
14472- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14473+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14474 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14475
14476 /* attbase - aperture base */
14477@@ -797,7 +797,7 @@
14478 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14479
14480 /* address to map to */
14481- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14482+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14483 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14484
14485 /* attbase - aperture base */
14486@@ -826,7 +826,7 @@
14487 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14488
14489 /* address to map to */
14490- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14491+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14492 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14493
14494 /* attbase - aperture base */
14495@@ -855,7 +855,7 @@
14496 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14497
14498 /* address to map to */
14499- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14500+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14501 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14502
14503 /* attbase - aperture base */
14504@@ -884,7 +884,7 @@
14505 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
14506
14507 /* address to map to */
14508- pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
14509+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14510 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14511
14512 /* attbase - aperture base */
14513diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
14514--- a/drivers/char/agp/nvidia-agp.c Fri Aug 15 07:22:22 2003
14515+++ b/drivers/char/agp/nvidia-agp.c Thu Aug 28 16:56:50 2003
14516@@ -13,18 +13,6 @@
14517 #include <linux/mm.h>
14518 #include "agp.h"
14519
14520-
14521-/* registers */
14522-#define NVIDIA_0_APBASE 0x10
14523-#define NVIDIA_0_APSIZE 0x80
14524-#define NVIDIA_1_WBC 0xf0
14525-#define NVIDIA_2_GARTCTRL 0xd0
14526-#define NVIDIA_2_APBASE 0xd8
14527-#define NVIDIA_2_APLIMIT 0xdc
14528-#define NVIDIA_2_ATTBASE(i) (0xe0 + (i) * 4)
14529-#define NVIDIA_3_APBASE 0x50
14530-#define NVIDIA_3_APLIMIT 0x54
14531-
14532 static struct _nvidia_private {
14533 struct pci_dev *dev_1;
14534 struct pci_dev *dev_2;
14535@@ -73,7 +61,7 @@
14536 current_size->size_value);
14537
14538 /* address to map to */
14539- pci_read_config_dword(agp_bridge->dev, NVIDIA_0_APBASE, &apbase);
14540+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &apbase);
14541 apbase &= PCI_BASE_ADDRESS_MEM_MASK;
14542 agp_bridge->gart_bus_addr = apbase;
14543 aplimit = apbase + (current_size->size * 1024 * 1024) - 1;
14544diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
14545--- a/drivers/char/agp/sis-agp.c Mon Aug 18 10:39:21 2003
14546+++ b/drivers/char/agp/sis-agp.c Thu Aug 28 16:44:18 2003
14547@@ -43,7 +43,7 @@
14548
14549 current_size = A_SIZE_8(agp_bridge->current_size);
14550 pci_write_config_byte(agp_bridge->dev, SIS_TLBCNTRL, 0x05);
14551- pci_read_config_dword(agp_bridge->dev, SIS_APBASE, &temp);
14552+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14553 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14554 pci_write_config_dword(agp_bridge->dev, SIS_ATTBASE,
14555 agp_bridge->gatt_bus_addr);
14556diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
14557--- a/drivers/char/agp/via-agp.c Wed Aug 13 01:41:04 2003
14558+++ b/drivers/char/agp/via-agp.c Thu Aug 28 17:14:45 2003
14559@@ -39,7 +39,7 @@
14560 pci_write_config_byte(agp_bridge->dev, VIA_APSIZE,
14561 current_size->size_value);
14562 /* address to map too */
14563- pci_read_config_dword(agp_bridge->dev, VIA_APBASE, &temp);
14564+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14565 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14566
14567 /* GART control register */
14568@@ -114,7 +114,7 @@
14569 current_size = A_SIZE_16(agp_bridge->current_size);
14570
14571 /* address to map too */
14572- pci_read_config_dword(agp_bridge->dev, VIA_APBASE, &temp);
14573+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14574 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14575
14576 /* attbase - aperture GATT base */
14577@@ -215,52 +215,52 @@
14578 {
14579 {
14580 .device_id = PCI_DEVICE_ID_VIA_82C597_0,
14581- .chipset_name = "VP3",
14582+ .chipset_name = "Apollo VP3",
14583 },
14584
14585 {
14586 .device_id = PCI_DEVICE_ID_VIA_82C598_0,
14587- .chipset_name = "MVP3",
14588+ .chipset_name = "Apollo MVP3",
14589 },
14590
14591 {
14592 .device_id = PCI_DEVICE_ID_VIA_8501_0,
14593- .chipset_name = "MVP4",
14594+ .chipset_name = "Apollo MVP4",
14595 },
14596
14597 /* VT8601 */
14598 {
14599 .device_id = PCI_DEVICE_ID_VIA_8601_0,
14600- .chipset_name = "PLE133 ProMedia",
14601+ .chipset_name = "Apollo ProMedia/PLE133Ta",
14602 },
14603
14604 /* VT82C693A / VT28C694T */
14605 {
14606- .device_id = PCI_DEVICE_ID_VIA_82C691,
14607+ .device_id = PCI_DEVICE_ID_VIA_82C691_0,
14608 .chipset_name = "Apollo Pro 133",
14609 },
14610
14611 {
14612 .device_id = PCI_DEVICE_ID_VIA_8371_0,
14613- .chipset_name = "Apollo Pro KX133",
14614+ .chipset_name = "KX133",
14615 },
14616
14617 /* VT8633 */
14618 {
14619 .device_id = PCI_DEVICE_ID_VIA_8633_0,
14620- .chipset_name = "Apollo Pro 266",
14621+ .chipset_name = "Pro 266",
14622 },
14623
14624 /* VT8361 */
14625 {
14626 .device_id = PCI_DEVICE_ID_VIA_8361,
14627- .chipset_name = "Apollo KLE133",
14628+ .chipset_name = "KLE133",
14629 },
14630
14631 /* VT8365 / VT8362 */
14632 {
14633 .device_id = PCI_DEVICE_ID_VIA_8363_0,
14634- .chipset_name = "Apollo Pro KT133/KM133/TwisterK",
14635+ .chipset_name = "Twister-K/KT133x/KM133",
14636 },
14637
14638 /* VT8753A */
14639@@ -272,79 +272,79 @@
14640 /* VT8366 */
14641 {
14642 .device_id = PCI_DEVICE_ID_VIA_8367_0,
14643- .chipset_name = "Apollo Pro KT266/KT333",
14644+ .chipset_name = "KT266/KY266x/KT333",
14645 },
14646
14647 /* VT8633 (for CuMine/ Celeron) */
14648 {
14649 .device_id = PCI_DEVICE_ID_VIA_8653_0,
14650- .chipset_name = "Apollo Pro 266T",
14651+ .chipset_name = "Pro266T",
14652 },
14653
14654 /* KM266 / PM266 */
14655 {
14656- .device_id = PCI_DEVICE_ID_VIA_KM266,
14657- .chipset_name = "KM266/PM266",
14658+ .device_id = PCI_DEVICE_ID_VIA_XM266,
14659+ .chipset_name = "PM266/KM266",
14660 },
14661
14662 /* CLE266 */
14663 {
14664- .device_id = PCI_DEVICE_ID_VIA_CLE266,
14665+ .device_id = PCI_DEVICE_ID_VIA_862X_0,
14666 .chipset_name = "CLE266",
14667 },
14668
14669 {
14670 .device_id = PCI_DEVICE_ID_VIA_8377_0,
14671- .chipset_name = "Apollo Pro KT400",
14672+ .chipset_name = "KT400/KT400A/KT600",
14673 },
14674
14675- /* VT8604 / VT8605 / VT8603 / TwisterT
14676+ /* VT8604 / VT8605 / VT8603
14677 * (Apollo Pro133A chipset with S3 Savage4) */
14678 {
14679- .device_id = PCI_DEVICE_ID_VIA_82C694X_0,
14680- .chipset_name = "Apollo ProSavage PM133/PL133/PN133/Twister"
14681+ .device_id = PCI_DEVICE_ID_VIA_8605_0,
14682+ .chipset_name = "ProSavage PM133/PL133/PN133"
14683 },
14684
14685- /* VT8752*/
14686+ /* P4M266x/P4N266 */
14687 {
14688- .device_id = PCI_DEVICE_ID_VIA_8752,
14689- .chipset_name = "ProSavage DDR P4M266",
14690+ .device_id = PCI_DEVICE_ID_VIA_8703_51_0,
14691+ .chipset_name = "P4M266x/P4N266",
14692 },
14693
14694- /* KN266/PN266 */
14695+ /* VT8754 */
14696 {
14697- .device_id = PCI_DEVICE_ID_VIA_KN266,
14698- .chipset_name = "KN266/PN266",
14699+ .device_id = PCI_DEVICE_ID_VIA_8754C_0,
14700+ .chipset_name = "PT800",
14701 },
14702
14703- /* VT8754 */
14704+ /* P4X600 */
14705 {
14706- .device_id = PCI_DEVICE_ID_VIA_8754,
14707- .chipset_name = "Apollo P4X333/P4X400"
14708+ .device_id = PCI_DEVICE_ID_VIA_8763_0,
14709+ .chipset_name = "P4X600"
14710 },
14711
14712- /* P4N333 */
14713+ /* KM400 */
14714 {
14715- .device_id = PCI_DEVICE_ID_VIA_P4N333,
14716- .chipset_name = "P4N333",
14717+ .device_id = PCI_DEVICE_ID_VIA_8378_0,
14718+ .chipset_name = "KM400/KM400A",
14719 },
14720
14721- /* P4X600 */
14722+ /* PT880 */
14723 {
14724- .device_id = PCI_DEVICE_ID_VIA_P4X600,
14725- .chipset_name = "P4X600",
14726+ .device_id = PCI_DEVICE_ID_VIA_PT880,
14727+ .chipset_name = "PT880",
14728 },
14729
14730- /* KM400 */
14731+ /* PT890 */
14732 {
14733- .device_id = PCI_DEVICE_ID_VIA_KM400,
14734- .chipset_name = "KM400",
14735+ .device_id = PCI_DEVICE_ID_VIA_8783_0,
14736+ .chipset_name = "PT890",
14737 },
14738
14739- /* P4M400 */
14740+ /* PM800/PN800/PM880/PN880 */
14741 {
14742- .device_id = PCI_DEVICE_ID_VIA_P4M400,
14743- .chipset_name = "P4M400",
14744+ .device_id = PCI_DEVICE_ID_VIA_PX8X0_0,
14745+ .chipset_name = "PM800/PN800/PM880/PN880",
14746 },
14747
14748 { }, /* dummy final entry, always present */
14749diff -Nru a/drivers/char/busmouse.c b/drivers/char/busmouse.c
14750--- a/drivers/char/busmouse.c Fri Jul 11 23:17:17 2003
14751+++ b/drivers/char/busmouse.c Tue Aug 26 09:25:41 2003
14752@@ -51,7 +51,7 @@
14753
14754 #define NR_MICE 15
14755 #define FIRST_MOUSE 0
14756-#define DEV_TO_MOUSE(dev) MINOR_TO_MOUSE(minor(dev))
14757+#define DEV_TO_MOUSE(inode) MINOR_TO_MOUSE(iminor(inode))
14758 #define MINOR_TO_MOUSE(minor) ((minor) - FIRST_MOUSE)
14759
14760 /*
14761@@ -190,7 +190,7 @@
14762 unsigned int mousedev;
14763 int ret;
14764
14765- mousedev = DEV_TO_MOUSE(inode->i_rdev);
14766+ mousedev = DEV_TO_MOUSE(inode);
14767 if (mousedev >= NR_MICE)
14768 return -EINVAL;
14769
14770diff -Nru a/drivers/char/cyclades.c b/drivers/char/cyclades.c
14771--- a/drivers/char/cyclades.c Fri Aug 1 02:20:44 2003
14772+++ b/drivers/char/cyclades.c Sun Aug 31 16:14:39 2003
14773@@ -1050,14 +1050,14 @@
14774 udelay(5000L);
14775
14776 /* Enable the Tx interrupts on the CD1400 */
14777- save_flags(flags); cli();
14778+ local_irq_save(flags);
14779 cy_writeb((u_long)address + (CyCAR<<index), 0);
14780 cyy_issue_cmd(address, CyCHAN_CTL|CyENB_XMTR, index);
14781
14782 cy_writeb((u_long)address + (CyCAR<<index), 0);
14783 cy_writeb((u_long)address + (CySRER<<index),
14784 cy_readb(address + (CySRER<<index)) | CyTxRdy);
14785- restore_flags(flags);
14786+ local_irq_restore(flags);
14787
14788 /* Wait ... */
14789 udelay(5000L);
14790@@ -5665,7 +5665,7 @@
14791 cy_cleanup_module(void)
14792 {
14793 int i;
14794- int e1;
14795+ int e1, e2;
14796 unsigned long flags;
14797
14798 #ifndef CONFIG_CYZ_INTR
14799@@ -5675,13 +5675,10 @@
14800 }
14801 #endif /* CONFIG_CYZ_INTR */
14802
14803- save_flags(flags); cli();
14804-
14805 if ((e1 = tty_unregister_driver(cy_serial_driver)))
14806 printk("cyc: failed to unregister Cyclades serial driver(%d)\n",
14807 e1);
14808
14809- restore_flags(flags);
14810 put_tty_driver(cy_serial_driver);
14811
14812 for (i = 0; i < NR_CARDS; i++) {
14813diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h
14814--- a/drivers/char/drm/drm_drv.h Thu Aug 7 15:37:26 2003
14815+++ b/drivers/char/drm/drm_drv.h Tue Aug 26 09:25:41 2003
14816@@ -795,7 +795,7 @@
14817 int i;
14818
14819 for (i = 0; i < DRM(numdevs); i++) {
14820- if (minor(inode->i_rdev) == DRM(minor)[i]) {
14821+ if (iminor(inode) == DRM(minor)[i]) {
14822 dev = &(DRM(device)[i]);
14823 break;
14824 }
14825diff -Nru a/drivers/char/drm/drm_fops.h b/drivers/char/drm/drm_fops.h
14826--- a/drivers/char/drm/drm_fops.h Thu Jul 10 23:18:01 2003
14827+++ b/drivers/char/drm/drm_fops.h Tue Aug 26 09:25:41 2003
14828@@ -51,7 +51,7 @@
14829 */
14830 int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
14831 {
14832- int minor = minor(inode->i_rdev);
14833+ int minor = iminor(inode);
14834 drm_file_t *priv;
14835
14836 if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
14837diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h
14838--- a/drivers/char/drm/drm_stub.h Thu Jul 10 23:18:01 2003
14839+++ b/drivers/char/drm/drm_stub.h Tue Aug 26 09:25:41 2003
14840@@ -62,7 +62,7 @@
14841 */
14842 static int DRM(stub_open)(struct inode *inode, struct file *filp)
14843 {
14844- int minor = minor(inode->i_rdev);
14845+ int minor = iminor(inode);
14846 int err = -ENODEV;
14847 struct file_operations *old_fops;
14848
14849diff -Nru a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
14850--- a/drivers/char/dsp56k.c Wed May 7 08:47:29 2003
14851+++ b/drivers/char/dsp56k.c Tue Aug 26 09:25:41 2003
14852@@ -207,7 +207,7 @@
14853 loff_t *ppos)
14854 {
14855 struct inode *inode = file->f_dentry->d_inode;
14856- int dev = minor(inode->i_rdev) & 0x0f;
14857+ int dev = iminor(inode) & 0x0f;
14858
14859 switch(dev)
14860 {
14861@@ -270,7 +270,7 @@
14862 loff_t *ppos)
14863 {
14864 struct inode *inode = file->f_dentry->d_inode;
14865- int dev = minor(inode->i_rdev) & 0x0f;
14866+ int dev = iminor(inode) & 0x0f;
14867
14868 switch(dev)
14869 {
14870@@ -331,7 +331,7 @@
14871 static int dsp56k_ioctl(struct inode *inode, struct file *file,
14872 unsigned int cmd, unsigned long arg)
14873 {
14874- int dev = minor(inode->i_rdev) & 0x0f;
14875+ int dev = iminor(inode) & 0x0f;
14876
14877 switch(dev)
14878 {
14879@@ -424,7 +424,7 @@
14880 #if 0
14881 static unsigned int dsp56k_poll(struct file *file, poll_table *wait)
14882 {
14883- int dev = minor(file->f_dentry->d_inode->i_rdev) & 0x0f;
14884+ int dev = iminor(file->f_dentry->d_inode) & 0x0f;
14885
14886 switch(dev)
14887 {
14888@@ -441,7 +441,7 @@
14889
14890 static int dsp56k_open(struct inode *inode, struct file *file)
14891 {
14892- int dev = minor(inode->i_rdev) & 0x0f;
14893+ int dev = iminor(inode) & 0x0f;
14894
14895 switch(dev)
14896 {
14897@@ -472,7 +472,7 @@
14898
14899 static int dsp56k_release(struct inode *inode, struct file *file)
14900 {
14901- int dev = minor(inode->i_rdev) & 0x0f;
14902+ int dev = iminor(inode) & 0x0f;
14903
14904 switch(dev)
14905 {
14906diff -Nru a/drivers/char/dtlk.c b/drivers/char/dtlk.c
14907--- a/drivers/char/dtlk.c Fri Jul 11 06:34:28 2003
14908+++ b/drivers/char/dtlk.c Tue Aug 26 09:25:41 2003
14909@@ -125,7 +125,7 @@
14910 static ssize_t dtlk_read(struct file *file, char *buf,
14911 size_t count, loff_t * ppos)
14912 {
14913- unsigned int minor = minor(file->f_dentry->d_inode->i_rdev);
14914+ unsigned int minor = iminor(file->f_dentry->d_inode);
14915 char ch;
14916 int i = 0, retries;
14917
14918@@ -185,7 +185,7 @@
14919 if (ppos != &file->f_pos)
14920 return -ESPIPE;
14921
14922- if (minor(file->f_dentry->d_inode->i_rdev) != DTLK_MINOR)
14923+ if (iminor(file->f_dentry->d_inode) != DTLK_MINOR)
14924 return -EINVAL;
14925
14926 while (1) {
14927@@ -304,7 +304,7 @@
14928 {
14929 TRACE_TEXT("(dtlk_open");
14930
14931- switch (minor(inode->i_rdev)) {
14932+ switch (iminor(inode)) {
14933 case DTLK_MINOR:
14934 if (dtlk_busy)
14935 return -EBUSY;
14936@@ -319,7 +319,7 @@
14937 {
14938 TRACE_TEXT("(dtlk_release");
14939
14940- switch (minor(inode->i_rdev)) {
14941+ switch (iminor(inode)) {
14942 case DTLK_MINOR:
14943 break;
14944
14945diff -Nru a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c
14946--- a/drivers/char/ftape/lowlevel/fdc-io.c Tue Jul 15 10:01:29 2003
14947+++ b/drivers/char/ftape/lowlevel/fdc-io.c Sun Aug 31 16:13:58 2003
14948@@ -1305,7 +1305,7 @@
14949 } else {
14950 TRACE(ft_t_bug, "Unexpected ftape interrupt");
14951 }
14952- return IRQ_RETVAL(handled);
14953+ TRACE_EXIT IRQ_RETVAL(handled);
14954 }
14955
14956 int fdc_grab_irq_and_dma(void)
14957diff -Nru a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
14958--- a/drivers/char/ftape/zftape/zftape-init.c Tue Jul 15 10:01:29 2003
14959+++ b/drivers/char/ftape/zftape/zftape-init.c Tue Aug 26 09:25:41 2003
14960@@ -110,11 +110,11 @@
14961 int result;
14962 TRACE_FUN(ft_t_flow);
14963
14964- TRACE(ft_t_flow, "called for minor %d", minor(ino->i_rdev));
14965+ TRACE(ft_t_flow, "called for minor %d", iminor(ino));
14966 if ( test_and_set_bit(0,&busy_flag) ) {
14967 TRACE_ABORT(-EBUSY, ft_t_warn, "failed: already busy");
14968 }
14969- if ((minor(ino->i_rdev) & ~(ZFT_MINOR_OP_MASK | FTAPE_NO_REWIND))
14970+ if ((iminor(ino) & ~(ZFT_MINOR_OP_MASK | FTAPE_NO_REWIND))
14971 >
14972 FTAPE_SEL_D) {
14973 clear_bit(0,&busy_flag);
14974@@ -122,7 +122,7 @@
14975 }
14976 orig_sigmask = current->blocked;
14977 sigfillset(&current->blocked);
14978- result = _zft_open(minor(ino->i_rdev), filep->f_flags & O_ACCMODE);
14979+ result = _zft_open(iminor(ino), filep->f_flags & O_ACCMODE);
14980 if (result < 0) {
14981 current->blocked = orig_sigmask; /* restore mask */
14982 clear_bit(0,&busy_flag);
14983@@ -144,7 +144,7 @@
14984 int result;
14985 TRACE_FUN(ft_t_flow);
14986
14987- if ( !test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit) {
14988+ if ( !test_bit(0,&busy_flag) || iminor(ino) != zft_unit) {
14989 TRACE(ft_t_err, "failed: not busy or wrong unit");
14990 TRACE_EXIT 0;
14991 }
14992@@ -167,7 +167,7 @@
14993 sigset_t old_sigmask;
14994 TRACE_FUN(ft_t_flow);
14995
14996- if ( !test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
14997+ if ( !test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
14998 TRACE_ABORT(-EIO, ft_t_err,
14999 "failed: not busy, failure or wrong unit");
15000 }
15001@@ -188,7 +188,7 @@
15002 TRACE_FUN(ft_t_flow);
15003
15004 if ( !test_bit(0,&busy_flag) ||
15005- minor(filep->f_dentry->d_inode->i_rdev) != zft_unit ||
15006+ iminor(filep->f_dentry->d_inode) != zft_unit ||
15007 ft_failure)
15008 {
15009 TRACE_ABORT(-EIO, ft_t_err,
15010@@ -217,7 +217,7 @@
15011 TRACE_FUN(ft_t_flow);
15012
15013 TRACE(ft_t_data_flow, "called with count: %ld", (unsigned long)req_len);
15014- if (!test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
15015+ if (!test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
15016 TRACE_ABORT(-EIO, ft_t_err,
15017 "failed: not busy, failure or wrong unit");
15018 }
15019@@ -240,7 +240,7 @@
15020 TRACE_FUN(ft_t_flow);
15021
15022 TRACE(ft_t_flow, "called with count: %ld", (unsigned long)req_len);
15023- if (!test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
15024+ if (!test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
15025 TRACE_ABORT(-EIO, ft_t_err,
15026 "failed: not busy, failure or wrong unit");
15027 }
15028diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
15029--- a/drivers/char/ip2main.c Mon Jul 14 06:47:09 2003
15030+++ b/drivers/char/ip2main.c Tue Aug 26 09:25:41 2003
15031@@ -2733,7 +2733,7 @@
15032 ssize_t
15033 ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off )
15034 {
15035- unsigned int minor = minor( pFile->f_dentry->d_inode->i_rdev );
15036+ unsigned int minor = iminor(pFile->f_dentry->d_inode);
15037 int rc = 0;
15038
15039 #ifdef IP2DEBUG_IPL
15040@@ -2863,7 +2863,7 @@
15041 static int
15042 ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
15043 {
15044- unsigned int iplminor = minor(pInode->i_rdev);
15045+ unsigned int iplminor = iminor(pInode);
15046 int rc = 0;
15047 ULONG *pIndex = (ULONG*)arg;
15048 i2eBordStrPtr pB = i2BoardPtrTable[iplminor / 4];
15049@@ -2998,7 +2998,7 @@
15050 static int
15051 ip2_ipl_open( struct inode *pInode, struct file *pFile )
15052 {
15053- unsigned int iplminor = minor(pInode->i_rdev);
15054+ unsigned int iplminor = iminor(pInode);
15055 i2eBordStrPtr pB;
15056 i2ChanStrPtr pCh;
15057
15058diff -Nru a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
15059--- a/drivers/char/ipmi/ipmi_devintf.c Wed May 7 08:47:29 2003
15060+++ b/drivers/char/ipmi/ipmi_devintf.c Tue Aug 26 09:25:41 2003
15061@@ -110,7 +110,7 @@
15062
15063 static int ipmi_open(struct inode *inode, struct file *file)
15064 {
15065- int if_num = minor(inode->i_rdev);
15066+ int if_num = iminor(inode);
15067 int rv;
15068 struct ipmi_file_private *priv;
15069
15070diff -Nru a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
15071--- a/drivers/char/ipmi/ipmi_watchdog.c Mon Aug 11 04:34:37 2003
15072+++ b/drivers/char/ipmi/ipmi_watchdog.c Tue Aug 26 09:25:41 2003
15073@@ -645,7 +645,7 @@
15074
15075 static int ipmi_open(struct inode *ino, struct file *filep)
15076 {
15077- switch (minor(ino->i_rdev))
15078+ switch (iminor(ino))
15079 {
15080 case WATCHDOG_MINOR:
15081 if (ipmi_wdog_open)
15082@@ -688,7 +688,7 @@
15083
15084 static int ipmi_close(struct inode *ino, struct file *filep)
15085 {
15086- if (minor(ino->i_rdev)==WATCHDOG_MINOR)
15087+ if (iminor(ino)==WATCHDOG_MINOR)
15088 {
15089 #ifndef CONFIG_WATCHDOG_NOWAYOUT
15090 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
15091diff -Nru a/drivers/char/istallion.c b/drivers/char/istallion.c
15092--- a/drivers/char/istallion.c Mon Jun 23 18:43:58 2003
15093+++ b/drivers/char/istallion.c Tue Aug 26 09:25:41 2003
15094@@ -4805,7 +4805,7 @@
15095 (int) fp, (int) buf, count, (int) offp);
15096 #endif
15097
15098- brdnr = minor(fp->f_dentry->d_inode->i_rdev);
15099+ brdnr = iminor(fp->f_dentry->d_inode);
15100 if (brdnr >= stli_nrbrds)
15101 return(-ENODEV);
15102 brdp = stli_brds[brdnr];
15103@@ -4860,7 +4860,7 @@
15104 (int) fp, (int) buf, count, (int) offp);
15105 #endif
15106
15107- brdnr = minor(fp->f_dentry->d_inode->i_rdev);
15108+ brdnr = iminor(fp->f_dentry->d_inode);
15109 if (brdnr >= stli_nrbrds)
15110 return(-ENODEV);
15111 brdp = stli_brds[brdnr];
15112@@ -5201,7 +5201,7 @@
15113 * Now handle the board specific ioctls. These all depend on the
15114 * minor number of the device they were called from.
15115 */
15116- brdnr = minor(ip->i_rdev);
15117+ brdnr = iminor(ip);
15118 if (brdnr >= STL_MAXBRDS)
15119 return(-ENODEV);
15120 brdp = stli_brds[brdnr];
15121diff -Nru a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
15122--- a/drivers/char/ite_gpio.c Thu Mar 6 14:03:51 2003
15123+++ b/drivers/char/ite_gpio.c Tue Aug 26 09:25:41 2003
15124@@ -238,7 +238,7 @@
15125
15126 static int ite_gpio_open(struct inode *inode, struct file *file)
15127 {
15128- unsigned int minor = minor(inode->i_rdev);
15129+ unsigned int minor = iminor(inode);
15130 if (minor != GPIO_MINOR)
15131 return -ENODEV;
15132
15133diff -Nru a/drivers/char/lcd.c b/drivers/char/lcd.c
15134--- a/drivers/char/lcd.c Wed May 29 12:05:13 2002
15135+++ b/drivers/char/lcd.c Sun Aug 31 16:14:08 2003
15136@@ -551,9 +551,9 @@
15137 */
15138
15139 static struct file_operations lcd_fops = {
15140- read: lcd_read,
15141- ioctl: lcd_ioctl,
15142- open: lcd_open,
15143+ .read = lcd_read,
15144+ .ioctl = lcd_ioctl,
15145+ .open = lcd_open,
15146 };
15147
15148 static struct miscdevice lcd_dev=
15149diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
15150--- a/drivers/char/lp.c Wed May 7 08:47:29 2003
15151+++ b/drivers/char/lp.c Tue Aug 26 09:25:41 2003
15152@@ -292,7 +292,7 @@
15153 static ssize_t lp_write(struct file * file, const char * buf,
15154 size_t count, loff_t *ppos)
15155 {
15156- unsigned int minor = minor(file->f_dentry->d_inode->i_rdev);
15157+ unsigned int minor = iminor(file->f_dentry->d_inode);
15158 struct parport *port = lp_table[minor].dev->port;
15159 char *kbuf = lp_table[minor].lp_buffer;
15160 ssize_t retv = 0;
15161@@ -408,7 +408,7 @@
15162 static ssize_t lp_read(struct file * file, char * buf,
15163 size_t count, loff_t *ppos)
15164 {
15165- unsigned int minor=minor(file->f_dentry->d_inode->i_rdev);
15166+ unsigned int minor=iminor(file->f_dentry->d_inode);
15167 struct parport *port = lp_table[minor].dev->port;
15168 ssize_t retval = 0;
15169 char *kbuf = lp_table[minor].lp_buffer;
15170@@ -483,7 +483,7 @@
15171
15172 static int lp_open(struct inode * inode, struct file * file)
15173 {
15174- unsigned int minor = minor(inode->i_rdev);
15175+ unsigned int minor = iminor(inode);
15176
15177 if (minor >= LP_NO)
15178 return -ENXIO;
15179@@ -540,7 +540,7 @@
15180
15181 static int lp_release(struct inode * inode, struct file * file)
15182 {
15183- unsigned int minor = minor(inode->i_rdev);
15184+ unsigned int minor = iminor(inode);
15185
15186 lp_claim_parport_or_block (&lp_table[minor]);
15187 parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);
15188@@ -555,7 +555,7 @@
15189 static int lp_ioctl(struct inode *inode, struct file *file,
15190 unsigned int cmd, unsigned long arg)
15191 {
15192- unsigned int minor = minor(inode->i_rdev);
15193+ unsigned int minor = iminor(inode);
15194 int status;
15195 int retval = 0;
15196
15197diff -Nru a/drivers/char/lp_old98.c b/drivers/char/lp_old98.c
15198--- a/drivers/char/lp_old98.c Thu Apr 24 03:30:40 2003
15199+++ b/drivers/char/lp_old98.c Tue Aug 26 09:25:41 2003
15200@@ -219,7 +219,7 @@
15201
15202 static int lp_old98_open(struct inode * inode, struct file * file)
15203 {
15204- if (minor(inode->i_rdev) != 0)
15205+ if (iminor(inode) != 0)
15206 return -ENXIO;
15207
15208 if (lp.flags & LP_BUSY)
15209diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
15210--- a/drivers/char/mem.c Tue Jun 10 23:33:17 2003
15211+++ b/drivers/char/mem.c Tue Aug 26 09:25:41 2003
15212@@ -607,7 +607,7 @@
15213
15214 static int memory_open(struct inode * inode, struct file * filp)
15215 {
15216- switch (minor(inode->i_rdev)) {
15217+ switch (iminor(inode)) {
15218 case 1:
15219 filp->f_op = &mem_fops;
15220 break;
15221diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
15222--- a/drivers/char/misc.c Sat May 17 12:39:13 2003
15223+++ b/drivers/char/misc.c Tue Aug 26 09:25:41 2003
15224@@ -100,7 +100,7 @@
15225
15226 static int misc_open(struct inode * inode, struct file * file)
15227 {
15228- int minor = minor(inode->i_rdev);
15229+ int minor = iminor(inode);
15230 struct miscdevice *c;
15231 int err = -ENODEV;
15232 struct file_operations *old_fops, *new_fops = NULL;
15233diff -Nru a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
15234--- a/drivers/char/n_hdlc.c Fri May 30 19:53:01 2003
15235+++ b/drivers/char/n_hdlc.c Sun Aug 31 16:14:27 2003
15236@@ -182,9 +182,9 @@
15237
15238 /* TTY callbacks */
15239
15240-static int n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
15241+static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
15242 __u8 *buf, size_t nr);
15243-static int n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
15244+static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
15245 const __u8 *buf, size_t nr);
15246 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
15247 unsigned int cmd, unsigned long arg);
15248@@ -572,7 +572,7 @@
15249 *
15250 * Returns the number of bytes returned or error code.
15251 */
15252-static int n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
15253+static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
15254 __u8 *buf, size_t nr)
15255 {
15256 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
15257@@ -649,7 +649,7 @@
15258 *
15259 * Returns the number of bytes written (or error code).
15260 */
15261-static int n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
15262+static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
15263 const __u8 *data, size_t count)
15264 {
15265 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
15266@@ -658,7 +658,7 @@
15267 struct n_hdlc_buf *tbuf;
15268
15269 if (debuglevel >= DEBUG_LEVEL_INFO)
15270- printk("%s(%d)n_hdlc_tty_write() called count=%d\n",
15271+ printk("%s(%d)n_hdlc_tty_write() called count=%Zd\n",
15272 __FILE__,__LINE__,count);
15273
15274 /* Verify pointers */
15275@@ -673,7 +673,7 @@
15276 if (debuglevel & DEBUG_LEVEL_INFO)
15277 printk (KERN_WARNING
15278 "n_hdlc_tty_write: truncating user packet "
15279- "from %lu to %d\n", (unsigned long) count,
15280+ "from %lu to %Zd\n", (unsigned long) count,
15281 maxframe );
15282 count = maxframe;
15283 }
15284diff -Nru a/drivers/char/pcxx.c b/drivers/char/pcxx.c
15285--- a/drivers/char/pcxx.c Wed Aug 20 14:20:10 2003
15286+++ b/drivers/char/pcxx.c Sun Aug 31 16:14:07 2003
15287@@ -121,7 +121,7 @@
15288 MODULE_PARM(altpin, "1-4i");
15289 MODULE_PARM(numports, "1-4i");
15290
15291-#endif MODULE
15292+#endif /* MODULE */
15293
15294 static int numcards = 1;
15295 static int nbdevs = 0;
15296diff -Nru a/drivers/char/ppdev.c b/drivers/char/ppdev.c
15297--- a/drivers/char/ppdev.c Wed May 7 08:47:29 2003
15298+++ b/drivers/char/ppdev.c Tue Aug 26 09:25:41 2003
15299@@ -104,7 +104,7 @@
15300 static ssize_t pp_read (struct file * file, char * buf, size_t count,
15301 loff_t * ppos)
15302 {
15303- unsigned int minor = minor (file->f_dentry->d_inode->i_rdev);
15304+ unsigned int minor = iminor(file->f_dentry->d_inode);
15305 struct pp_struct *pp = file->private_data;
15306 char * kbuffer;
15307 ssize_t bytes_read = 0;
15308@@ -187,7 +187,7 @@
15309 static ssize_t pp_write (struct file * file, const char * buf, size_t count,
15310 loff_t * ppos)
15311 {
15312- unsigned int minor = minor (file->f_dentry->d_inode->i_rdev);
15313+ unsigned int minor = iminor(file->f_dentry->d_inode);
15314 struct pp_struct *pp = file->private_data;
15315 char * kbuffer;
15316 ssize_t bytes_written = 0;
15317@@ -330,7 +330,7 @@
15318 static int pp_ioctl(struct inode *inode, struct file *file,
15319 unsigned int cmd, unsigned long arg)
15320 {
15321- unsigned int minor = minor(inode->i_rdev);
15322+ unsigned int minor = iminor(inode);
15323 struct pp_struct *pp = file->private_data;
15324 struct parport * port;
15325
15326@@ -638,7 +638,7 @@
15327
15328 static int pp_open (struct inode * inode, struct file * file)
15329 {
15330- unsigned int minor = minor (inode->i_rdev);
15331+ unsigned int minor = iminor(inode);
15332 struct pp_struct *pp;
15333
15334 if (minor >= PARPORT_MAX)
15335@@ -667,7 +667,7 @@
15336
15337 static int pp_release (struct inode * inode, struct file * file)
15338 {
15339- unsigned int minor = minor (inode->i_rdev);
15340+ unsigned int minor = iminor(inode);
15341 struct pp_struct *pp = file->private_data;
15342 int compat_negot;
15343
15344diff -Nru a/drivers/char/random.c b/drivers/char/random.c
15345--- a/drivers/char/random.c Wed Aug 6 10:59:31 2003
15346+++ b/drivers/char/random.c Sun Aug 31 16:13:54 2003
15347@@ -269,9 +269,9 @@
15348
15349 /*
15350 * The minimum number of bits of entropy before we wake up a read on
15351- * /dev/random. Should always be at least 8, or at least 1 byte.
15352+ * /dev/random. Should be enough to do a significant reseed.
15353 */
15354-static int random_read_wakeup_thresh = 8;
15355+static int random_read_wakeup_thresh = 64;
15356
15357 /*
15358 * If the entropy count falls under this number of bits, then we
15359@@ -483,9 +483,9 @@
15360 unsigned add_ptr;
15361 int entropy_count;
15362 int input_rotate;
15363- int extract_count;
15364 struct poolinfo poolinfo;
15365 __u32 *pool;
15366+ spinlock_t lock;
15367 };
15368
15369 /*
15370@@ -502,7 +502,7 @@
15371
15372 poolwords = (size + 3) / 4; /* Convert bytes->words */
15373 /* The pool size must be a multiple of 16 32-bit words */
15374- poolwords = ((poolwords + 15) / 16) * 16;
15375+ poolwords = ((poolwords + 15) / 16) * 16;
15376
15377 for (p = poolinfo_table; p->poolwords; p++) {
15378 if (poolwords == p->poolwords)
15379@@ -524,6 +524,7 @@
15380 return -ENOMEM;
15381 }
15382 memset(r->pool, 0, POOLBYTES);
15383+ r->lock = SPIN_LOCK_UNLOCKED;
15384 *ret_bucket = r;
15385 return 0;
15386 }
15387@@ -534,7 +535,6 @@
15388 r->add_ptr = 0;
15389 r->entropy_count = 0;
15390 r->input_rotate = 0;
15391- r->extract_count = 0;
15392 memset(r->pool, 0, r->poolinfo.POOLBYTES);
15393 }
15394 #ifdef CONFIG_SYSCTL
15395@@ -565,6 +565,9 @@
15396 int new_rotate;
15397 int wordmask = r->poolinfo.poolwords - 1;
15398 __u32 w;
15399+ unsigned long flags;
15400+
15401+ spin_lock_irqsave(&r->lock, flags);
15402
15403 while (nwords--) {
15404 w = rotate_left(r->input_rotate, *in++);
15405@@ -589,6 +592,8 @@
15406 w ^= r->pool[i];
15407 r->pool[i] = (w >> 3) ^ twist_table[w & 7];
15408 }
15409+
15410+ spin_unlock_irqrestore(&r->lock, flags);
15411 }
15412
15413 /*
15414@@ -596,6 +601,10 @@
15415 */
15416 static void credit_entropy_store(struct entropy_store *r, int nbits)
15417 {
15418+ unsigned long flags;
15419+
15420+ spin_lock_irqsave(&r->lock, flags);
15421+
15422 if (r->entropy_count + nbits < 0) {
15423 DEBUG_ENT("negative entropy/overflow (%d+%d)\n",
15424 r->entropy_count, nbits);
15425@@ -605,11 +614,15 @@
15426 } else {
15427 r->entropy_count += nbits;
15428 if (nbits)
15429- DEBUG_ENT("%s added %d bits, now %d\n",
15430+ DEBUG_ENT("%04d %04d : added %d bits to %s\n",
15431+ random_state->entropy_count,
15432+ sec_random_state->entropy_count,
15433+ nbits,
15434 r == sec_random_state ? "secondary" :
15435- r == random_state ? "primary" : "unknown",
15436- nbits, r->entropy_count);
15437+ r == random_state ? "primary" : "unknown");
15438 }
15439+
15440+ spin_unlock_irqrestore(&r->lock, flags);
15441 }
15442
15443 /**********************************************************************
15444@@ -620,27 +633,33 @@
15445 *
15446 **********************************************************************/
15447
15448-static __u32 *batch_entropy_pool;
15449-static int *batch_entropy_credit;
15450-static int batch_max;
15451+struct sample {
15452+ __u32 data[2];
15453+ int credit;
15454+};
15455+
15456+static struct sample *batch_entropy_pool, *batch_entropy_copy;
15457 static int batch_head, batch_tail;
15458+static spinlock_t batch_lock = SPIN_LOCK_UNLOCKED;
15459+
15460+static int batch_max;
15461 static void batch_entropy_process(void *private_);
15462 static DECLARE_WORK(batch_work, batch_entropy_process, NULL);
15463
15464 /* note: the size must be a power of 2 */
15465 static int __init batch_entropy_init(int size, struct entropy_store *r)
15466 {
15467- batch_entropy_pool = kmalloc(2*size*sizeof(__u32), GFP_KERNEL);
15468+ batch_entropy_pool = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
15469 if (!batch_entropy_pool)
15470 return -1;
15471- batch_entropy_credit =kmalloc(size*sizeof(int), GFP_KERNEL);
15472- if (!batch_entropy_credit) {
15473+ batch_entropy_copy = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
15474+ if (!batch_entropy_copy) {
15475 kfree(batch_entropy_pool);
15476 return -1;
15477 }
15478 batch_head = batch_tail = 0;
15479- batch_max = size;
15480 batch_work.data = r;
15481+ batch_max = size;
15482 return 0;
15483 }
15484
15485@@ -652,27 +671,33 @@
15486 */
15487 void batch_entropy_store(u32 a, u32 b, int num)
15488 {
15489- int new;
15490+ int new;
15491+ unsigned long flags;
15492
15493 if (!batch_max)
15494 return;
15495-
15496- batch_entropy_pool[2*batch_head] = a;
15497- batch_entropy_pool[(2*batch_head) + 1] = b;
15498- batch_entropy_credit[batch_head] = num;
15499
15500- new = (batch_head+1) & (batch_max-1);
15501- if ((unsigned)(new - batch_tail) >= (unsigned)(batch_max / 2)) {
15502+ spin_lock_irqsave(&batch_lock, flags);
15503+
15504+ batch_entropy_pool[batch_head].data[0] = a;
15505+ batch_entropy_pool[batch_head].data[1] = b;
15506+ batch_entropy_pool[batch_head].credit = num;
15507+
15508+ if (((batch_head - batch_tail) & (batch_max-1)) >= (batch_max / 2)) {
15509 /*
15510 * Schedule it for the next timer tick:
15511 */
15512 schedule_delayed_work(&batch_work, 1);
15513- batch_head = new;
15514- } else if (new == batch_tail) {
15515+ }
15516+
15517+ new = (batch_head+1) & (batch_max-1);
15518+ if (new == batch_tail) {
15519 DEBUG_ENT("batch entropy buffer full\n");
15520 } else {
15521 batch_head = new;
15522 }
15523+
15524+ spin_unlock_irqrestore(&batch_lock, flags);
15525 }
15526
15527 /*
15528@@ -684,20 +709,34 @@
15529 {
15530 struct entropy_store *r = (struct entropy_store *) private_, *p;
15531 int max_entropy = r->poolinfo.POOLBITS;
15532+ unsigned head, tail;
15533
15534- if (!batch_max)
15535- return;
15536+ /* Mixing into the pool is expensive, so copy over the batch
15537+ * data and release the batch lock. The pool is at least half
15538+ * full, so don't worry too much about copying only the used
15539+ * part.
15540+ */
15541+ spin_lock_irq(&batch_lock);
15542+
15543+ memcpy(batch_entropy_copy, batch_entropy_pool,
15544+ batch_max*sizeof(struct sample));
15545+
15546+ head = batch_head;
15547+ tail = batch_tail;
15548+ batch_tail = batch_head;
15549+
15550+ spin_unlock_irq(&batch_lock);
15551
15552 p = r;
15553- while (batch_head != batch_tail) {
15554+ while (head != tail) {
15555 if (r->entropy_count >= max_entropy) {
15556 r = (r == sec_random_state) ? random_state :
15557 sec_random_state;
15558 max_entropy = r->poolinfo.POOLBITS;
15559 }
15560- add_entropy_words(r, batch_entropy_pool + 2*batch_tail, 2);
15561- credit_entropy_store(r, batch_entropy_credit[batch_tail]);
15562- batch_tail = (batch_tail+1) & (batch_max-1);
15563+ add_entropy_words(r, batch_entropy_copy[tail].data, 2);
15564+ credit_entropy_store(r, batch_entropy_copy[tail].credit);
15565+ tail = (tail+1) & (batch_max-1);
15566 }
15567 if (p->entropy_count >= random_read_wakeup_thresh)
15568 wake_up_interruptible(&random_read_wait);
15569@@ -1216,6 +1255,7 @@
15570
15571 #define EXTRACT_ENTROPY_USER 1
15572 #define EXTRACT_ENTROPY_SECONDARY 2
15573+#define EXTRACT_ENTROPY_LIMIT 4
15574 #define TMP_BUF_SIZE (HASH_BUFFER_SIZE + HASH_EXTRA_SIZE)
15575 #define SEC_XFER_SIZE (TMP_BUF_SIZE*4)
15576
15577@@ -1224,36 +1264,28 @@
15578
15579 /*
15580 * This utility inline function is responsible for transfering entropy
15581- * from the primary pool to the secondary extraction pool. We pull
15582- * randomness under two conditions; one is if there isn't enough entropy
15583- * in the secondary pool. The other is after we have extracted 1024 bytes,
15584- * at which point we do a "catastrophic reseeding".
15585+ * from the primary pool to the secondary extraction pool. We make
15586+ * sure we pull enough for a 'catastrophic reseed'.
15587 */
15588 static inline void xfer_secondary_pool(struct entropy_store *r,
15589 size_t nbytes, __u32 *tmp)
15590 {
15591 if (r->entropy_count < nbytes * 8 &&
15592 r->entropy_count < r->poolinfo.POOLBITS) {
15593- int nwords = min_t(int,
15594- r->poolinfo.poolwords - r->entropy_count/32,
15595- sizeof(tmp) / 4);
15596+ int bytes = max_t(int, random_read_wakeup_thresh / 8,
15597+ min_t(int, nbytes, TMP_BUF_SIZE));
15598
15599- DEBUG_ENT("xfer %d from primary to %s (have %d, need %d)\n",
15600- nwords * 32,
15601+ DEBUG_ENT("%04d %04d : going to reseed %s with %d bits "
15602+ "(%d of %d requested)\n",
15603+ random_state->entropy_count,
15604+ sec_random_state->entropy_count,
15605 r == sec_random_state ? "secondary" : "unknown",
15606- r->entropy_count, nbytes * 8);
15607+ bytes * 8, nbytes * 8, r->entropy_count);
15608
15609- extract_entropy(random_state, tmp, nwords * 4, 0);
15610- add_entropy_words(r, tmp, nwords);
15611- credit_entropy_store(r, nwords * 32);
15612- }
15613- if (r->extract_count > 1024) {
15614- DEBUG_ENT("reseeding %s with %d from primary\n",
15615- r == sec_random_state ? "secondary" : "unknown",
15616- sizeof(tmp) * 8);
15617- extract_entropy(random_state, tmp, sizeof(tmp), 0);
15618- add_entropy_words(r, tmp, sizeof(tmp) / 4);
15619- r->extract_count = 0;
15620+ bytes=extract_entropy(random_state, tmp, bytes,
15621+ EXTRACT_ENTROPY_LIMIT);
15622+ add_entropy_words(r, tmp, bytes);
15623+ credit_entropy_store(r, bytes*8);
15624 }
15625 }
15626
15627@@ -1276,8 +1308,8 @@
15628 ssize_t ret, i;
15629 __u32 tmp[TMP_BUF_SIZE];
15630 __u32 x;
15631+ unsigned long cpuflags;
15632
15633- add_timer_randomness(&extract_timer_state, nbytes);
15634
15635 /* Redundant, but just in case... */
15636 if (r->entropy_count > r->poolinfo.POOLBITS)
15637@@ -1286,10 +1318,18 @@
15638 if (flags & EXTRACT_ENTROPY_SECONDARY)
15639 xfer_secondary_pool(r, nbytes, tmp);
15640
15641- DEBUG_ENT("%s has %d bits, want %d bits\n",
15642+ /* Hold lock while accounting */
15643+ spin_lock_irqsave(&r->lock, cpuflags);
15644+
15645+ DEBUG_ENT("%04d %04d : trying to extract %d bits from %s\n",
15646+ random_state->entropy_count,
15647+ sec_random_state->entropy_count,
15648+ nbytes * 8,
15649 r == sec_random_state ? "secondary" :
15650- r == random_state ? "primary" : "unknown",
15651- r->entropy_count, nbytes * 8);
15652+ r == random_state ? "primary" : "unknown");
15653+
15654+ if (flags & EXTRACT_ENTROPY_LIMIT && nbytes >= r->entropy_count / 8)
15655+ nbytes = r->entropy_count / 8;
15656
15657 if (r->entropy_count / 8 >= nbytes)
15658 r->entropy_count -= nbytes*8;
15659@@ -1299,8 +1339,16 @@
15660 if (r->entropy_count < random_write_wakeup_thresh)
15661 wake_up_interruptible(&random_write_wait);
15662
15663- r->extract_count += nbytes;
15664-
15665+ DEBUG_ENT("%04d %04d : debiting %d bits from %s%s\n",
15666+ random_state->entropy_count,
15667+ sec_random_state->entropy_count,
15668+ nbytes * 8,
15669+ r == sec_random_state ? "secondary" :
15670+ r == random_state ? "primary" : "unknown",
15671+ flags & EXTRACT_ENTROPY_LIMIT ? "" : " (unlimited)");
15672+
15673+ spin_unlock_irqrestore(&r->lock, cpuflags);
15674+
15675 ret = 0;
15676 while (nbytes) {
15677 /*
15678@@ -1312,7 +1360,16 @@
15679 ret = -ERESTARTSYS;
15680 break;
15681 }
15682+
15683+ DEBUG_ENT("%04d %04d : extract feeling sleepy (%d bytes left)\n",
15684+ random_state->entropy_count,
15685+ sec_random_state->entropy_count, nbytes);
15686+
15687 schedule();
15688+
15689+ DEBUG_ENT("%04d %04d : extract woke up\n",
15690+ random_state->entropy_count,
15691+ sec_random_state->entropy_count);
15692 }
15693
15694 /* Hash the pool to get the output */
15695@@ -1361,7 +1418,6 @@
15696 nbytes -= i;
15697 buf += i;
15698 ret += i;
15699- add_timer_randomness(&extract_timer_state, nbytes);
15700 }
15701
15702 /* Wipe data just returned from memory */
15703@@ -1488,15 +1544,27 @@
15704 if (nbytes == 0)
15705 return 0;
15706
15707- add_wait_queue(&random_read_wait, &wait);
15708 while (nbytes > 0) {
15709- set_current_state(TASK_INTERRUPTIBLE);
15710-
15711 n = nbytes;
15712 if (n > SEC_XFER_SIZE)
15713 n = SEC_XFER_SIZE;
15714- if (n > random_state->entropy_count / 8)
15715- n = random_state->entropy_count / 8;
15716+
15717+ DEBUG_ENT("%04d %04d : reading %d bits, p: %d s: %d\n",
15718+ random_state->entropy_count,
15719+ sec_random_state->entropy_count,
15720+ n*8, random_state->entropy_count,
15721+ sec_random_state->entropy_count);
15722+
15723+ n = extract_entropy(sec_random_state, buf, n,
15724+ EXTRACT_ENTROPY_USER |
15725+ EXTRACT_ENTROPY_LIMIT |
15726+ EXTRACT_ENTROPY_SECONDARY);
15727+
15728+ DEBUG_ENT("%04d %04d : read got %d bits (%d still needed)\n",
15729+ random_state->entropy_count,
15730+ sec_random_state->entropy_count,
15731+ n*8, (nbytes-n)*8);
15732+
15733 if (n == 0) {
15734 if (file->f_flags & O_NONBLOCK) {
15735 retval = -EAGAIN;
15736@@ -1506,12 +1574,27 @@
15737 retval = -ERESTARTSYS;
15738 break;
15739 }
15740- schedule();
15741+
15742+ DEBUG_ENT("%04d %04d : sleeping?\n",
15743+ random_state->entropy_count,
15744+ sec_random_state->entropy_count);
15745+
15746+ set_current_state(TASK_INTERRUPTIBLE);
15747+ add_wait_queue(&random_read_wait, &wait);
15748+
15749+ if (sec_random_state->entropy_count / 8 == 0)
15750+ schedule();
15751+
15752+ set_current_state(TASK_RUNNING);
15753+ remove_wait_queue(&random_read_wait, &wait);
15754+
15755+ DEBUG_ENT("%04d %04d : waking up\n",
15756+ random_state->entropy_count,
15757+ sec_random_state->entropy_count);
15758+
15759 continue;
15760 }
15761- n = extract_entropy(sec_random_state, buf, n,
15762- EXTRACT_ENTROPY_USER |
15763- EXTRACT_ENTROPY_SECONDARY);
15764+
15765 if (n < 0) {
15766 retval = n;
15767 break;
15768@@ -1522,8 +1605,6 @@
15769 break; /* This break makes the device work */
15770 /* like a named pipe */
15771 }
15772- current->state = TASK_RUNNING;
15773- remove_wait_queue(&random_read_wait, &wait);
15774
15775 /*
15776 * If we gave the user some bytes, update the access time.
15777@@ -1595,8 +1676,9 @@
15778 random_ioctl(struct inode * inode, struct file * file,
15779 unsigned int cmd, unsigned long arg)
15780 {
15781- int *p, size, ent_count;
15782+ int *p, *tmp, size, ent_count;
15783 int retval;
15784+ unsigned long flags;
15785
15786 switch (cmd) {
15787 case RNDGETENTCNT:
15788@@ -1621,17 +1703,36 @@
15789 if (!capable(CAP_SYS_ADMIN))
15790 return -EPERM;
15791 p = (int *) arg;
15792- ent_count = random_state->entropy_count;
15793- if (put_user(ent_count, p++) ||
15794- get_user(size, p) ||
15795+ if (get_user(size, p) ||
15796 put_user(random_state->poolinfo.poolwords, p++))
15797 return -EFAULT;
15798 if (size < 0)
15799- return -EINVAL;
15800+ return -EFAULT;
15801 if (size > random_state->poolinfo.poolwords)
15802 size = random_state->poolinfo.poolwords;
15803- if (copy_to_user(p, random_state->pool, size * sizeof(__u32)))
15804+
15805+ /* prepare to atomically snapshot pool */
15806+
15807+ tmp = kmalloc(size * sizeof(__u32), GFP_KERNEL);
15808+
15809+ if (!tmp)
15810 return -EFAULT;
15811+
15812+ spin_lock_irqsave(&random_state->lock, flags);
15813+ ent_count = random_state->entropy_count;
15814+ memcpy(tmp, random_state->pool, size * sizeof(__u32));
15815+ spin_unlock_irqrestore(&random_state->lock, flags);
15816+
15817+ if (!copy_to_user(p, tmp, size * sizeof(__u32))) {
15818+ kfree(tmp);
15819+ return -EFAULT;
15820+ }
15821+
15822+ kfree(tmp);
15823+
15824+ if(put_user(ent_count, p++))
15825+ return -EFAULT;
15826+
15827 return 0;
15828 case RNDADDENTROPY:
15829 if (!capable(CAP_SYS_ADMIN))
15830diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c
15831--- a/drivers/char/raw.c Fri Jun 20 13:16:17 2003
15832+++ b/drivers/char/raw.c Sun Aug 31 16:14:45 2003
15833@@ -43,7 +43,7 @@
15834 */
15835 static int raw_open(struct inode *inode, struct file *filp)
15836 {
15837- const int minor = minor(inode->i_rdev);
15838+ const int minor = iminor(inode);
15839 struct block_device *bdev;
15840 int err;
15841
15842@@ -60,23 +60,25 @@
15843 bdev = raw_devices[minor].binding;
15844 err = -ENODEV;
15845 if (bdev) {
15846- err = bd_claim(bdev, raw_open);
15847+ err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
15848 if (err)
15849 goto out;
15850- atomic_inc(&bdev->bd_count);
15851- err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
15852+ igrab(bdev->bd_inode);
15853+ err = bd_claim(bdev, raw_open);
15854+ if (err) {
15855+ blkdev_put(bdev, BDEV_RAW);
15856+ goto out;
15857+ }
15858+ err = set_blocksize(bdev, bdev_hardsect_size(bdev));
15859 if (err) {
15860 bd_release(bdev);
15861+ blkdev_put(bdev, BDEV_RAW);
15862 goto out;
15863- } else {
15864- err = set_blocksize(bdev, bdev_hardsect_size(bdev));
15865- if (err == 0) {
15866- filp->f_flags |= O_DIRECT;
15867- if (++raw_devices[minor].inuse == 1)
15868- filp->f_dentry->d_inode->i_mapping =
15869- bdev->bd_inode->i_mapping;
15870- }
15871 }
15872+ filp->f_flags |= O_DIRECT;
15873+ if (++raw_devices[minor].inuse == 1)
15874+ filp->f_dentry->d_inode->i_mapping =
15875+ bdev->bd_inode->i_mapping;
15876 }
15877 filp->private_data = bdev;
15878 out:
15879@@ -90,7 +92,7 @@
15880 */
15881 static int raw_release(struct inode *inode, struct file *filp)
15882 {
15883- const int minor= minor(inode->i_rdev);
15884+ const int minor= iminor(inode);
15885 struct block_device *bdev;
15886
15887 down(&raw_mutex);
15888diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c
15889--- a/drivers/char/rtc.c Tue Aug 12 13:25:18 2003
15890+++ b/drivers/char/rtc.c Sun Aug 31 16:15:40 2003
15891@@ -44,10 +44,12 @@
15892 * 1.11 Takashi Iwai: Kernel access functions
15893 * rtc_register/rtc_unregister/rtc_control
15894 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init
15895+ * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
15896+ * CONFIG_HPET_EMULATE_RTC
15897 *
15898 */
15899
15900-#define RTC_VERSION "1.11a"
15901+#define RTC_VERSION "1.12"
15902
15903 #define RTC_IO_EXTENT 0x8
15904
15905@@ -80,6 +82,10 @@
15906 #include <asm/uaccess.h>
15907 #include <asm/system.h>
15908
15909+#if defined(__i386__)
15910+#include <asm/hpet.h>
15911+#endif
15912+
15913 #ifdef __sparc__
15914 #include <linux/pci.h>
15915 #include <asm/ebus.h>
15916@@ -95,6 +101,17 @@
15917 static int rtc_has_irq = 1;
15918 #endif
15919
15920+#ifndef CONFIG_HPET_EMULATE_RTC
15921+#define is_hpet_enabled() 0
15922+#define hpet_set_alarm_time(hrs, min, sec) 0
15923+#define hpet_set_periodic_freq(arg) 0
15924+#define hpet_mask_rtc_irq_bit(arg) 0
15925+#define hpet_set_rtc_irq_bit(arg) 0
15926+#define hpet_rtc_timer_init() do { } while (0)
15927+#define hpet_rtc_dropped_irq() 0
15928+static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) {return 0;}
15929+#endif
15930+
15931 /*
15932 * We sponge a minor off of the misc major. No need slurping
15933 * up another valuable major dev number for this. If you add
15934@@ -120,7 +137,7 @@
15935 static unsigned int rtc_poll(struct file *file, poll_table *wait);
15936 #endif
15937
15938-static void get_rtc_time (struct rtc_time *rtc_tm);
15939+void get_rtc_time (struct rtc_time *rtc_tm);
15940 static void get_rtc_alm_time (struct rtc_time *alm_tm);
15941 #if RTC_IRQ
15942 static void rtc_dropped_irq(unsigned long data);
15943@@ -182,7 +199,7 @@
15944 * (See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.)
15945 */
15946
15947-static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
15948+irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
15949 {
15950 /*
15951 * Can be an alarm interrupt, update complete interrupt,
15952@@ -194,7 +211,16 @@
15953 spin_lock (&rtc_lock);
15954 rtc_irq_data += 0x100;
15955 rtc_irq_data &= ~0xff;
15956- rtc_irq_data |= (CMOS_READ(RTC_INTR_FLAGS) & 0xF0);
15957+ if (is_hpet_enabled()) {
15958+ /*
15959+ * In this case it is HPET RTC interrupt handler
15960+ * calling us, with the interrupt information
15961+ * passed as arg1, instead of irq.
15962+ */
15963+ rtc_irq_data |= (unsigned long)irq & 0xF0;
15964+ } else {
15965+ rtc_irq_data |= (CMOS_READ(RTC_INTR_FLAGS) & 0xF0);
15966+ }
15967
15968 if (rtc_status & RTC_TIMER_ON)
15969 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq + 2*HZ/100);
15970@@ -429,6 +455,12 @@
15971 sec = alm_tm.tm_sec;
15972
15973 spin_lock_irq(&rtc_lock);
15974+ if (hpet_set_alarm_time(hrs, min, sec)) {
15975+ /*
15976+ * Fallthru and set alarm time in CMOS too,
15977+ * so that we will get proper value in RTC_ALM_READ
15978+ */
15979+ }
15980 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) ||
15981 RTC_ALWAYS_BCD)
15982 {
15983@@ -582,6 +614,10 @@
15984 return -EINVAL;
15985
15986 spin_lock_irq(&rtc_lock);
15987+ if (hpet_set_periodic_freq(arg)) {
15988+ spin_unlock_irq(&rtc_lock);
15989+ return 0;
15990+ }
15991 rtc_freq = arg;
15992
15993 val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0;
15994@@ -667,13 +703,14 @@
15995 */
15996
15997 spin_lock_irq(&rtc_lock);
15998- tmp = CMOS_READ(RTC_CONTROL);
15999- tmp &= ~RTC_PIE;
16000- tmp &= ~RTC_AIE;
16001- tmp &= ~RTC_UIE;
16002- CMOS_WRITE(tmp, RTC_CONTROL);
16003- CMOS_READ(RTC_INTR_FLAGS);
16004-
16005+ if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
16006+ tmp = CMOS_READ(RTC_CONTROL);
16007+ tmp &= ~RTC_PIE;
16008+ tmp &= ~RTC_AIE;
16009+ tmp &= ~RTC_UIE;
16010+ CMOS_WRITE(tmp, RTC_CONTROL);
16011+ CMOS_READ(RTC_INTR_FLAGS);
16012+ }
16013 if (rtc_status & RTC_TIMER_ON) {
16014 rtc_status &= ~RTC_TIMER_ON;
16015 del_timer(&rtc_irq_timer);
16016@@ -765,12 +802,14 @@
16017 rtc_callback = NULL;
16018
16019 /* disable controls */
16020- tmp = CMOS_READ(RTC_CONTROL);
16021- tmp &= ~RTC_PIE;
16022- tmp &= ~RTC_AIE;
16023- tmp &= ~RTC_UIE;
16024- CMOS_WRITE(tmp, RTC_CONTROL);
16025- CMOS_READ(RTC_INTR_FLAGS);
16026+ if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
16027+ tmp = CMOS_READ(RTC_CONTROL);
16028+ tmp &= ~RTC_PIE;
16029+ tmp &= ~RTC_AIE;
16030+ tmp &= ~RTC_UIE;
16031+ CMOS_WRITE(tmp, RTC_CONTROL);
16032+ CMOS_READ(RTC_INTR_FLAGS);
16033+ }
16034 if (rtc_status & RTC_TIMER_ON) {
16035 rtc_status &= ~RTC_TIMER_ON;
16036 del_timer(&rtc_irq_timer);
16037@@ -822,6 +861,10 @@
16038 &rtc_fops
16039 };
16040
16041+#if RTC_IRQ
16042+static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs);
16043+#endif
16044+
16045 static int __init rtc_init(void)
16046 {
16047 #if defined(__alpha__) || defined(__mips__)
16048@@ -889,12 +932,20 @@
16049 }
16050
16051 #if RTC_IRQ
16052- if (request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL)) {
16053+ if (is_hpet_enabled()) {
16054+ rtc_int_handler_ptr = hpet_rtc_interrupt;
16055+ } else {
16056+ rtc_int_handler_ptr = rtc_interrupt;
16057+ }
16058+
16059+ if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) {
16060 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
16061 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
16062 release_region(RTC_PORT(0), RTC_IO_EXTENT);
16063 return -EIO;
16064 }
16065+ hpet_rtc_timer_init();
16066+
16067 #endif
16068
16069 #endif /* __sparc__ vs. others */
16070@@ -965,10 +1016,12 @@
16071 init_timer(&rtc_irq_timer);
16072 rtc_irq_timer.function = rtc_dropped_irq;
16073 spin_lock_irq(&rtc_lock);
16074- /* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
16075- CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
16076- spin_unlock_irq(&rtc_lock);
16077 rtc_freq = 1024;
16078+ if (!hpet_set_periodic_freq(rtc_freq)) {
16079+ /* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
16080+ CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
16081+ }
16082+ spin_unlock_irq(&rtc_lock);
16083 no_irq2:
16084 #endif
16085
16086@@ -1019,6 +1072,11 @@
16087
16088 spin_lock_irq (&rtc_lock);
16089
16090+ if (hpet_rtc_dropped_irq()) {
16091+ spin_unlock_irq(&rtc_lock);
16092+ return;
16093+ }
16094+
16095 /* Just in case someone disabled the timer from behind our back... */
16096 if (rtc_status & RTC_TIMER_ON)
16097 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq + 2*HZ/100);
16098@@ -1148,7 +1206,7 @@
16099 return uip;
16100 }
16101
16102-static void get_rtc_time(struct rtc_time *rtc_tm)
16103+void get_rtc_time(struct rtc_time *rtc_tm)
16104 {
16105 unsigned long uip_watchdog = jiffies;
16106 unsigned char ctrl;
16107@@ -1254,6 +1312,10 @@
16108 unsigned char val;
16109
16110 spin_lock_irq(&rtc_lock);
16111+ if (hpet_mask_rtc_irq_bit(bit)) {
16112+ spin_unlock_irq(&rtc_lock);
16113+ return;
16114+ }
16115 val = CMOS_READ(RTC_CONTROL);
16116 val &= ~bit;
16117 CMOS_WRITE(val, RTC_CONTROL);
16118@@ -1268,6 +1330,10 @@
16119 unsigned char val;
16120
16121 spin_lock_irq(&rtc_lock);
16122+ if (hpet_set_rtc_irq_bit(bit)) {
16123+ spin_unlock_irq(&rtc_lock);
16124+ return;
16125+ }
16126 val = CMOS_READ(RTC_CONTROL);
16127 val |= bit;
16128 CMOS_WRITE(val, RTC_CONTROL);
16129diff -Nru a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
16130--- a/drivers/char/scx200_gpio.c Sat Dec 7 08:54:07 2002
16131+++ b/drivers/char/scx200_gpio.c Tue Aug 26 09:25:41 2003
16132@@ -29,7 +29,7 @@
16133 static ssize_t scx200_gpio_write(struct file *file, const char *data,
16134 size_t len, loff_t *ppos)
16135 {
16136- unsigned m = minor(file->f_dentry->d_inode->i_rdev);
16137+ unsigned m = iminor(file->f_dentry->d_inode);
16138 size_t i;
16139
16140 if (ppos != &file->f_pos)
16141@@ -80,7 +80,7 @@
16142 static ssize_t scx200_gpio_read(struct file *file, char *buf,
16143 size_t len, loff_t *ppos)
16144 {
16145- unsigned m = minor(file->f_dentry->d_inode->i_rdev);
16146+ unsigned m = iminor(file->f_dentry->d_inode);
16147 int value;
16148
16149 if (ppos != &file->f_pos)
16150@@ -95,7 +95,7 @@
16151
16152 static int scx200_gpio_open(struct inode *inode, struct file *file)
16153 {
16154- unsigned m = minor(inode->i_rdev);
16155+ unsigned m = iminor(inode);
16156 if (m > 63)
16157 return -EINVAL;
16158 return 0;
16159diff -Nru a/drivers/char/sonypi.c b/drivers/char/sonypi.c
16160--- a/drivers/char/sonypi.c Fri Jun 13 07:30:24 2003
16161+++ b/drivers/char/sonypi.c Fri Aug 1 05:36:14 2003
16162@@ -308,7 +308,7 @@
16163 int i, j;
16164
16165 v1 = inb_p(sonypi_device.ioport1);
16166- v2 = inb_p(sonypi_device.ioport2);
16167+ v2 = inb_p(sonypi_device.ioport1 + sonypi_device.evtype_offset);
16168
16169 for (i = 0; sonypi_eventtypes[i].model; i++) {
16170 if (sonypi_device.model != sonypi_eventtypes[i].model)
16171@@ -670,11 +670,13 @@
16172 if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2) {
16173 ioport_list = sonypi_type2_ioport_list;
16174 sonypi_device.region_size = SONYPI_TYPE2_REGION_SIZE;
16175+ sonypi_device.evtype_offset = SONYPI_TYPE2_EVTYPE_OFFSET;
16176 irq_list = sonypi_type2_irq_list;
16177 }
16178 else {
16179 ioport_list = sonypi_type1_ioport_list;
16180 sonypi_device.region_size = SONYPI_TYPE1_REGION_SIZE;
16181+ sonypi_device.evtype_offset = SONYPI_TYPE1_EVTYPE_OFFSET;
16182 irq_list = sonypi_type1_irq_list;
16183 }
16184
16185diff -Nru a/drivers/char/sonypi.h b/drivers/char/sonypi.h
16186--- a/drivers/char/sonypi.h Tue Jun 10 03:03:28 2003
16187+++ b/drivers/char/sonypi.h Thu Aug 7 02:36:23 2003
16188@@ -56,12 +56,14 @@
16189 #define SONYPI_BASE 0x50
16190 #define SONYPI_G10A (SONYPI_BASE+0x14)
16191 #define SONYPI_TYPE1_REGION_SIZE 0x08
16192+#define SONYPI_TYPE1_EVTYPE_OFFSET 0x04
16193
16194 /* type2 series specifics */
16195 #define SONYPI_SIRQ 0x9b
16196 #define SONYPI_SLOB 0x9c
16197 #define SONYPI_SHIB 0x9d
16198 #define SONYPI_TYPE2_REGION_SIZE 0x20
16199+#define SONYPI_TYPE2_EVTYPE_OFFSET 0x12
16200
16201 /* battery / brightness addresses */
16202 #define SONYPI_BAT_FLAGS 0x81
16203@@ -167,6 +169,7 @@
16204 #define SONYPI_THUMBPHRASE_MASK 0x00000200
16205 #define SONYPI_MEYE_MASK 0x00000400
16206 #define SONYPI_MEMORYSTICK_MASK 0x00000800
16207+#define SONYPI_BATTERY_MASK 0x00001000
16208
16209 struct sonypi_event {
16210 u8 data;
16211@@ -293,6 +296,13 @@
16212 { 0, 0 }
16213 };
16214
16215+/* The set of possible battery events */
16216+static struct sonypi_event sonypi_batteryev[] = {
16217+ { 0x20, SONYPI_EVENT_BATTERY_INSERT },
16218+ { 0x30, SONYPI_EVENT_BATTERY_REMOVE },
16219+ { 0, 0 }
16220+};
16221+
16222 struct sonypi_eventtypes {
16223 int model;
16224 u8 data;
16225@@ -307,19 +317,22 @@
16226 { SONYPI_DEVICE_MODEL_TYPE1, 0x20, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
16227 { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
16228 { SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_PKEY_MASK, sonypi_pkeyev },
16229+ { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
16230+ { SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_BATTERY_MASK, sonypi_batteryev },
16231
16232 { SONYPI_DEVICE_MODEL_TYPE2, 0, 0xffffffff, sonypi_releaseev },
16233 { SONYPI_DEVICE_MODEL_TYPE2, 0x38, SONYPI_LID_MASK, sonypi_lidev },
16234- { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_JOGGER_MASK, sonypi_joggerev },
16235+ { SONYPI_DEVICE_MODEL_TYPE2, 0x11, SONYPI_JOGGER_MASK, sonypi_joggerev },
16236 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_CAPTURE_MASK, sonypi_captureev },
16237- { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
16238- { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
16239+ { SONYPI_DEVICE_MODEL_TYPE2, 0x21, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
16240+ { SONYPI_DEVICE_MODEL_TYPE2, 0x31, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
16241 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_PKEY_MASK, sonypi_pkeyev },
16242- { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_BACK_MASK, sonypi_backev },
16243+ { SONYPI_DEVICE_MODEL_TYPE2, 0x11, SONYPI_BACK_MASK, sonypi_backev },
16244 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_HELP_MASK, sonypi_helpev },
16245 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_ZOOM_MASK, sonypi_zoomev },
16246 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_THUMBPHRASE_MASK, sonypi_thumbphraseev },
16247- { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
16248+ { SONYPI_DEVICE_MODEL_TYPE2, 0x31, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
16249+ { SONYPI_DEVICE_MODEL_TYPE2, 0x41, SONYPI_BATTERY_MASK, sonypi_batteryev },
16250
16251 { 0, 0, 0, 0 }
16252 };
16253@@ -354,6 +367,7 @@
16254 u16 ioport1;
16255 u16 ioport2;
16256 u16 region_size;
16257+ u16 evtype_offset;
16258 int camera_power;
16259 int bluetooth_power;
16260 struct semaphore lock;
16261diff -Nru a/drivers/char/stallion.c b/drivers/char/stallion.c
16262--- a/drivers/char/stallion.c Wed Jul 30 04:37:51 2003
16263+++ b/drivers/char/stallion.c Sun Aug 24 05:39:23 2003
16264@@ -3078,7 +3078,7 @@
16265 (int) fp, cmd, (int) arg);
16266 #endif
16267
16268- brdnr = minor(ip->i_rdev);
16269+ brdnr = iminor(ip);
16270 if (brdnr >= STL_MAXBRDS)
16271 return(-ENODEV);
16272 rc = 0;
16273@@ -4234,7 +4234,7 @@
16274 misr = inb(ioaddr + EREG_DATA);
16275 if (misr & MISR_DCD) {
16276 set_bit(ASYI_DCDCHANGE, &portp->istate);
16277- schedule_task(&portp->tqueue);
16278+ schedule_work(&portp->tqueue);
16279 portp->stats.modem++;
16280 }
16281
16282@@ -5031,7 +5031,7 @@
16283 if ((len == 0) || ((len < STL_TXBUFLOW) &&
16284 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
16285 set_bit(ASYI_TXLOW, &portp->istate);
16286- schedule_task(&portp->tqueue);
16287+ schedule_work(&portp->tqueue);
16288 }
16289
16290 if (len == 0) {
16291@@ -5248,7 +5248,7 @@
16292 ipr = stl_sc26198getreg(portp, IPR);
16293 if (ipr & IPR_DCDCHANGE) {
16294 set_bit(ASYI_DCDCHANGE, &portp->istate);
16295- schedule_task(&portp->tqueue);
16296+ schedule_work(&portp->tqueue);
16297 portp->stats.modem++;
16298 }
16299 break;
16300diff -Nru a/drivers/char/tipar.c b/drivers/char/tipar.c
16301--- a/drivers/char/tipar.c Wed May 7 08:47:30 2003
16302+++ b/drivers/char/tipar.c Tue Aug 26 09:25:41 2003
16303@@ -248,7 +248,7 @@
16304 static int
16305 tipar_open(struct inode *inode, struct file *file)
16306 {
16307- unsigned int minor = minor(inode->i_rdev) - TIPAR_MINOR;
16308+ unsigned int minor = iminor(inode) - TIPAR_MINOR;
16309
16310 if (minor > tp_count - 1)
16311 return -ENXIO;
16312@@ -266,7 +266,7 @@
16313 static int
16314 tipar_close(struct inode *inode, struct file *file)
16315 {
16316- unsigned int minor = minor(inode->i_rdev) - TIPAR_MINOR;
16317+ unsigned int minor = iminor(inode) - TIPAR_MINOR;
16318
16319 if (minor > tp_count - 1)
16320 return -ENXIO;
16321@@ -279,8 +279,7 @@
16322 static ssize_t
16323 tipar_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
16324 {
16325- unsigned int minor =
16326- minor(file->f_dentry->d_inode->i_rdev) - TIPAR_MINOR;
16327+ unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR;
16328 ssize_t n;
16329
16330 parport_claim_or_block(table[minor].dev);
16331@@ -308,8 +307,7 @@
16332 tipar_read(struct file *file, char *buf, size_t count, loff_t * ppos)
16333 {
16334 int b = 0;
16335- unsigned int minor =
16336- minor(file->f_dentry->d_inode->i_rdev) - TIPAR_MINOR;
16337+ unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR;
16338 ssize_t retval = 0;
16339 ssize_t n = 0;
16340
16341diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
16342--- a/drivers/char/tpqic02.c Wed May 7 08:47:30 2003
16343+++ b/drivers/char/tpqic02.c Tue Aug 26 09:25:41 2003
16344@@ -169,7 +169,7 @@
16345 static volatile unsigned dma_mode; /* !=0 also means DMA in use */
16346 static flag need_rewind = YES;
16347
16348-static kdev_t current_tape_dev;
16349+static int current_type;
16350 static int extra_blocks_left = BLOCKS_BEYOND_EW;
16351 static struct timer_list tp_timer;
16352
16353@@ -677,7 +677,7 @@
16354 * exception flag from previous exception which we are trying to clear.
16355 */
16356
16357- if (TP_DIAGS(current_tape_dev))
16358+ if (TP_DIAGS(current_type))
16359 printk(TPQIC02_NAME ": reading status bytes: ");
16360
16361 for (q = stp; q < stp + size; q++) {
16362@@ -693,7 +693,7 @@
16363
16364 *q = inb_p(QIC02_DATA_PORT); /* read status byte */
16365
16366- if (TP_DIAGS(current_tape_dev))
16367+ if (TP_DIAGS(current_type))
16368 printk("[%1d]=0x%x ", q - stp, (unsigned) (*q) & 0xff);
16369
16370 outb_p(ctlbits | QIC02_CTL_REQUEST, QIC02_CTL_PORT); /* set request */
16371@@ -714,7 +714,7 @@
16372 cpu_relax();
16373 /* wait for ready */
16374
16375- if (TP_DIAGS(current_tape_dev))
16376+ if (TP_DIAGS(current_type))
16377 printk("\n");
16378
16379 return TE_OK;
16380@@ -1614,7 +1614,7 @@
16381
16382 if (status_expect_int) {
16383 #ifdef WANT_EXTRA_FULL_DEBUGGING
16384- if (TP_DIAGS(current_tape_dev))
16385+ if (TP_DIAGS(current_type))
16386 printk("@");
16387 #endif
16388 stat = inb(QIC02_STAT_PORT); /* Knock, knock */
16389@@ -1726,7 +1726,7 @@
16390
16391 static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
16392 {
16393- kdev_t dev = filp->f_dentry->d_inode->i_rdev;
16394+ int type = iminor(filp->f_dentry->d_inode);
16395 unsigned short flags = filp->f_flags;
16396 unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
16397 int stat;
16398@@ -1736,8 +1736,8 @@
16399 return -ENXIO;
16400 }
16401
16402- if (TP_DIAGS(current_tape_dev))
16403- printk(TPQIC02_NAME ": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n", minor(dev), buf,
16404+ if (TP_DIAGS(current_type))
16405+ printk(TPQIC02_NAME ": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n", type, buf,
16406 (long) count, filp->f_pos, flags);
16407
16408 if (count % TAPE_BLKSIZE) { /* Only allow mod 512 bytes at a time. */
16409@@ -1904,7 +1904,7 @@
16410 */
16411 static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
16412 {
16413- kdev_t dev = filp->f_dentry->d_inode->i_rdev;
16414+ int type = iminor(filp->f_dentry->d_inode);
16415 unsigned short flags = filp->f_flags;
16416 unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
16417
16418@@ -1913,9 +1913,9 @@
16419 return -ENXIO;
16420 }
16421
16422- if (TP_DIAGS(current_tape_dev)) {
16423+ if (TP_DIAGS(current_type)) {
16424 printk(TPQIC02_NAME ": request WRITE, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n",
16425- minor(dev), buf, (long) count, filp->f_pos, flags);
16426+ type, buf, (long) count, filp->f_pos, flags);
16427 }
16428
16429 if (count % TAPE_BLKSIZE) { /* only allow mod 512 bytes at a time */
16430@@ -2070,17 +2070,18 @@
16431 static int qic02_tape_open_no_use_count(struct inode *inode,
16432 struct file *filp)
16433 {
16434- kdev_t dev = inode->i_rdev;
16435+ int type = iminor(inode);
16436 unsigned short flags = filp->f_flags;
16437 unsigned short dens = 0;
16438 int s;
16439
16440
16441- if (TP_DIAGS(dev)) {
16442- printk("qic02_tape_open: dev=%s, flags=%x ", cdevname(dev), flags);
16443+ if (TP_DIAGS(type)) {
16444+ printk("qic02_tape_open: dev=tpqic2(%d), flags=%x ",
16445+ type, flags);
16446 }
16447
16448- if (minor(dev) == 255) { /* special case for resetting */
16449+ if (type == 255) { /* special case for resetting */
16450 if (capable(CAP_SYS_ADMIN)) {
16451 return (tape_reset(1) == TE_OK) ? -EAGAIN : -ENXIO;
16452 } else {
16453@@ -2162,7 +2163,7 @@
16454 */
16455
16456 /* not allowed to do QCMD_DENS_* unless tape is rewound */
16457- if ((TP_DENS(dev) != 0) && (TP_DENS(current_tape_dev) != TP_DENS(dev))) {
16458+ if ((TP_DENS(type) != 0) && (TP_DENS(current_type) != TP_DENS(type))) {
16459 /* force rewind if minor bits have changed,
16460 * i.e. user wants to use tape in different format.
16461 * [assuming single drive operation]
16462@@ -2175,7 +2176,7 @@
16463 /* density bits still the same, but TP_DIAGS bit
16464 * may have changed.
16465 */
16466- current_tape_dev = dev;
16467+ current_type = type;
16468 }
16469
16470 if (need_rewind == YES) {
16471@@ -2212,14 +2213,14 @@
16472 * so we must have done a rewind by now. If not, just skip over.
16473 * Only give set density command when minor bits have changed.
16474 */
16475- if (TP_DENS(current_tape_dev) == TP_DENS(dev)) {
16476+ if (TP_DENS(current_type) == TP_DENS(type)) {
16477 return 0;
16478 }
16479
16480- current_tape_dev = dev;
16481+ current_type = type;
16482 need_rewind = NO;
16483 if (TP_HAVE_DENS) {
16484- dens = TP_DENS(dev);
16485+ dens = TP_DENS(type);
16486 }
16487
16488 if (dens < sizeof(format_names) / sizeof(char *))
16489@@ -2227,7 +2228,7 @@
16490 else
16491 tpqputs(TPQD_REWIND, "Wait for retensioning...");
16492
16493- switch (TP_DENS(dev)) {
16494+ switch (TP_DENS(type)) {
16495 case 0: /* Minor 0 is for drives without set-density support */
16496 s = 0;
16497 break;
16498@@ -2254,7 +2255,7 @@
16499 }
16500 if (s != 0) {
16501 status_dead = YES; /* force reset */
16502- current_tape_dev = NODEV;/* earlier 0xff80 */
16503+ current_type = 0;/* earlier 0xff80 */
16504 return -EIO;
16505 }
16506
16507@@ -2264,10 +2265,10 @@
16508
16509 static int qic02_tape_release(struct inode *inode, struct file *filp)
16510 {
16511- kdev_t dev = inode->i_rdev;
16512+ int type = iminor(inode);
16513
16514- if (TP_DIAGS(dev)) {
16515- printk("qic02_tape_release: dev=%s\n", cdevname(dev));
16516+ if (TP_DIAGS(type)) {
16517+ printk("qic02_tape_release: dev=tpqic2(%d)\n", type);
16518 }
16519
16520 if (status_zombie == NO) { /* don't rewind in zombie mode */
16521@@ -2283,7 +2284,7 @@
16522 /* Rewind only if minor number requires it AND
16523 * read/writes have been done. ************* IS THIS CORRECT??????????
16524 */
16525- if ((TP_REWCLOSE(dev)) && (status_bytes_rd | status_bytes_wr)) {
16526+ if (TP_REWCLOSE(type) && (status_bytes_rd | status_bytes_wr)) {
16527 tpqputs(TPQD_REWIND, "release: Doing rewind...");
16528 (void) do_qic_cmd(QCMD_REWIND, TIM_R);
16529 }
16530@@ -2398,7 +2399,7 @@
16531 struct mtpos ioctl_tell;
16532
16533
16534- if (TP_DIAGS(current_tape_dev))
16535+ if (TP_DIAGS(current_type))
16536 printk(TPQIC02_NAME ": ioctl(%4x, %4lx)\n", iocmd, ioarg);
16537
16538 if (!inode)
16539@@ -2459,7 +2460,7 @@
16540 * --- tape at the beginning of the current file.
16541 */
16542
16543- if (TP_DIAGS(current_tape_dev))
16544+ if (TP_DIAGS(current_type))
16545 printk("OP op=%4x, count=%4x\n", operation.mt_op, operation.mt_count);
16546
16547 if (operation.mt_count < 0)
16548@@ -2492,7 +2493,7 @@
16549 return 0;
16550
16551 } else if (c == _IOC_NR(MTIOCGET)) {
16552- if (TP_DIAGS(current_tape_dev))
16553+ if (TP_DIAGS(current_type))
16554 printk("GET ");
16555
16556 CHECK_IOC_SIZE(mtget);
16557@@ -2507,7 +2508,7 @@
16558 return -EFAULT;
16559 return 0;
16560 } else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) {
16561- if (TP_DIAGS(current_tape_dev))
16562+ if (TP_DIAGS(current_type))
16563 printk("POS ");
16564
16565 CHECK_IOC_SIZE(mtpos);
16566@@ -2664,7 +2665,7 @@
16567 return -ENODEV;
16568 }
16569
16570- current_tape_dev = mk_kdev(QIC02_TAPE_MAJOR, 0);
16571+ current_type = 0;
16572
16573 #ifndef CONFIG_QIC02_DYNCONF
16574 printk(TPQIC02_NAME ": IRQ %d, DMA %d, IO 0x%x, IFC %s, %s, %s\n",
16575diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
16576--- a/drivers/char/tty_io.c Fri Aug 1 02:22:20 2003
16577+++ b/drivers/char/tty_io.c Sun Aug 31 16:15:47 2003
16578@@ -177,7 +177,7 @@
16579
16580 EXPORT_SYMBOL(tty_name);
16581
16582-inline int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
16583+inline int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
16584 const char *routine)
16585 {
16586 #ifdef TTY_PARANOIA_CHECK
16587@@ -187,11 +187,11 @@
16588 "Warning: null TTY for (%s) in %s\n";
16589
16590 if (!tty) {
16591- printk(badtty, cdevname(device), routine);
16592+ printk(badtty, cdevname(inode->i_rdev), routine);
16593 return 1;
16594 }
16595 if (tty->magic != TTY_MAGIC) {
16596- printk(badmagic, cdevname(device), routine);
16597+ printk(badmagic, cdevname(inode->i_rdev), routine);
16598 return 1;
16599 }
16600 #endif
16601@@ -646,7 +646,7 @@
16602
16603 tty = (struct tty_struct *)file->private_data;
16604 inode = file->f_dentry->d_inode;
16605- if (tty_paranoia_check(tty, inode->i_rdev, "tty_read"))
16606+ if (tty_paranoia_check(tty, inode, "tty_read"))
16607 return -EIO;
16608 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags)))
16609 return -EIO;
16610@@ -763,7 +763,7 @@
16611 }
16612
16613 tty = (struct tty_struct *)file->private_data;
16614- if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))
16615+ if (tty_paranoia_check(tty, inode, "tty_write"))
16616 return -EIO;
16617 if (!tty || !tty->driver->write || (test_bit(TTY_IO_ERROR, &tty->flags)))
16618 return -EIO;
16619@@ -1023,7 +1023,7 @@
16620 o_tty->magic = 0;
16621 o_tty->driver->refcount--;
16622 file_list_lock();
16623- list_del(&o_tty->tty_files);
16624+ list_del_init(&o_tty->tty_files);
16625 file_list_unlock();
16626 free_tty_struct(o_tty);
16627 }
16628@@ -1037,7 +1037,7 @@
16629 tty->magic = 0;
16630 tty->driver->refcount--;
16631 file_list_lock();
16632- list_del(&tty->tty_files);
16633+ list_del_init(&tty->tty_files);
16634 file_list_unlock();
16635 module_put(tty->driver->owner);
16636 free_tty_struct(tty);
16637@@ -1059,7 +1059,7 @@
16638 char buf[64];
16639
16640 tty = (struct tty_struct *)filp->private_data;
16641- if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "release_dev"))
16642+ if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "release_dev"))
16643 return;
16644
16645 check_tty_count(tty, "release_dev");
16646@@ -1439,7 +1439,7 @@
16647 struct tty_struct * tty;
16648
16649 tty = (struct tty_struct *)filp->private_data;
16650- if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "tty_poll"))
16651+ if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "tty_poll"))
16652 return 0;
16653
16654 if (tty->ldisc.poll)
16655@@ -1453,7 +1453,7 @@
16656 int retval;
16657
16658 tty = (struct tty_struct *)filp->private_data;
16659- if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "tty_fasync"))
16660+ if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "tty_fasync"))
16661 return 0;
16662
16663 retval = fasync_helper(fd, filp, on, &tty->fasync);
16664@@ -1727,7 +1727,7 @@
16665 int retval;
16666
16667 tty = (struct tty_struct *)file->private_data;
16668- if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
16669+ if (tty_paranoia_check(tty, inode, "tty_ioctl"))
16670 return -EINVAL;
16671
16672 real_tty = tty;
16673diff -Nru a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
16674--- a/drivers/char/vc_screen.c Wed May 7 08:47:30 2003
16675+++ b/drivers/char/vc_screen.c Tue Aug 26 09:25:41 2003
16676@@ -49,7 +49,7 @@
16677 vcs_size(struct inode *inode)
16678 {
16679 int size;
16680- int minor = minor(inode->i_rdev);
16681+ int minor = iminor(inode);
16682 int currcons = minor & 127;
16683 if (currcons == 0)
16684 currcons = fg_console;
16685@@ -104,7 +104,7 @@
16686 vcs_read(struct file *file, char *buf, size_t count, loff_t *ppos)
16687 {
16688 struct inode *inode = file->f_dentry->d_inode;
16689- unsigned int currcons = minor(inode->i_rdev);
16690+ unsigned int currcons = iminor(inode);
16691 long pos = *ppos;
16692 long viewed, attr, read;
16693 int col, maxcol;
16694@@ -273,7 +273,7 @@
16695 vcs_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
16696 {
16697 struct inode *inode = file->f_dentry->d_inode;
16698- unsigned int currcons = minor(inode->i_rdev);
16699+ unsigned int currcons = iminor(inode);
16700 long pos = *ppos;
16701 long viewed, attr, size, written;
16702 char *con_buf0;
16703@@ -456,7 +456,7 @@
16704 static int
16705 vcs_open(struct inode *inode, struct file *filp)
16706 {
16707- unsigned int currcons = minor(inode->i_rdev) & 127;
16708+ unsigned int currcons = iminor(inode) & 127;
16709 if(currcons && !vc_cons_allocated(currcons-1))
16710 return -ENXIO;
16711 return 0;
16712diff -Nru a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
16713--- a/drivers/char/watchdog/Kconfig Mon Jul 28 13:28:55 2003
16714+++ b/drivers/char/watchdog/Kconfig Sun Aug 31 11:39:56 2003
16715@@ -346,6 +346,18 @@
16716 module, say M here and read <file:Documentation/modules.txt>. Most
16717 people will say N.
16718
16719+config ALIM1535_WDT
16720+ tristate "ALi M1535 PMU Watchdog Timer"
16721+ depends on WATCHDOG
16722+ ---help---
16723+ This is the driver for the hardware watchdog on the ALi M1535 PMU.
16724+
16725+ This driver is also available as a module ( = code which can be
16726+ inserted in and removed from the running kernel whenever you want).
16727+ The module is called alim1535_wdt. If you want to compile it as a
16728+ module, say M here and read <file:Documentation/modules.txt>. Most
16729+ people will say N.
16730+
16731 config SC1200_WDT
16732 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
16733 depends on WATCHDOG
16734diff -Nru a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
16735--- a/drivers/char/watchdog/Makefile Thu Feb 27 12:38:45 2003
16736+++ b/drivers/char/watchdog/Makefile Sun Aug 31 11:39:56 2003
16737@@ -27,6 +27,7 @@
16738 obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
16739 obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
16740 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
16741+obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
16742 obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
16743 obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
16744 obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
16745diff -Nru a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
16746--- a/drivers/char/watchdog/acquirewdt.c Fri Aug 8 03:28:08 2003
16747+++ b/drivers/char/watchdog/acquirewdt.c Sun Aug 31 14:15:12 2003
16748@@ -1,5 +1,5 @@
16749 /*
16750- * Acquire Single Board Computer Watchdog Timer driver for Linux 2.1.x
16751+ * Acquire Single Board Computer Watchdog Timer driver
16752 *
16753 * Based on wdt.c. Original copyright messages:
16754 *
16755@@ -10,10 +10,10 @@
16756 * modify it under the terms of the GNU General Public License
16757 * as published by the Free Software Foundation; either version
16758 * 2 of the License, or (at your option) any later version.
16759- *
16760- * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
16761- * warranty for any of this software. This material is provided
16762- * "AS-IS" and at no charge.
16763+ *
16764+ * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
16765+ * warranty for any of this software. This material is provided
16766+ * "AS-IS" and at no charge.
16767 *
16768 * (c) Copyright 1995 Alan Cox <alan@redhat.com>
16769 *
16770@@ -22,33 +22,39 @@
16771 * Can't add timeout - driver doesn't allow changing value
16772 */
16773
16774-#include <linux/config.h>
16775 #include <linux/module.h>
16776 #include <linux/moduleparam.h>
16777 #include <linux/types.h>
16778 #include <linux/miscdevice.h>
16779 #include <linux/watchdog.h>
16780+#include <linux/fs.h>
16781 #include <linux/ioport.h>
16782 #include <linux/notifier.h>
16783-#include <linux/fs.h>
16784 #include <linux/reboot.h>
16785 #include <linux/init.h>
16786-#include <linux/spinlock.h>
16787
16788 #include <asm/io.h>
16789 #include <asm/uaccess.h>
16790 #include <asm/system.h>
16791
16792-static int acq_is_open;
16793-static spinlock_t acq_lock;
16794-static int expect_close = 0;
16795+#define WATCHDOG_NAME "Acquire WDT"
16796+#define PFX WATCHDOG_NAME ": "
16797+#define WATCHDOG_TIMEOUT 0 /* ??? Is the timeout hardcoded to 1 minute ??? */
16798+
16799+static unsigned long acq_is_open;
16800+static char expect_close;
16801
16802 /*
16803 * You must set these - there is no sane way to probe for this board.
16804 */
16805-
16806-#define WDT_STOP 0x43
16807-#define WDT_START 0x443
16808+
16809+static int wdt_stop = 0x43;
16810+module_param(wdt_stop, int, 0);
16811+MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)");
16812+
16813+static int wdt_start = 0x443;
16814+module_param(wdt_start, int, 0);
16815+MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");
16816
16817 #ifdef CONFIG_WATCHDOG_NOWAYOUT
16818 static int nowayout = 1;
16819@@ -62,38 +68,52 @@
16820 /*
16821 * Kernel methods.
16822 */
16823-
16824
16825 static void acq_ping(void)
16826 {
16827 /* Write a watchdog value */
16828- inb_p(WDT_START);
16829+ inb_p(wdt_start);
16830 }
16831
16832+static void acq_stop(void)
16833+{
16834+ /* Turn the card off */
16835+ inb_p(wdt_stop);
16836+}
16837+
16838+/*
16839+ * /dev/watchdog handling.
16840+ */
16841+
16842 static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
16843 {
16844 /* Can't seek (pwrite) on this device */
16845 if (ppos != &file->f_pos)
16846 return -ESPIPE;
16847
16848+ /* See if we got the magic character 'V' and reload the timer */
16849 if(count) {
16850 if (!nowayout) {
16851 size_t i;
16852
16853+ /* note: just in case someone wrote the magic character
16854+ * five months ago... */
16855 expect_close = 0;
16856
16857+ /* scan to see wether or not we got the magic character */
16858 for (i = 0; i != count; i++) {
16859 char c;
16860 if (get_user(c, buf + i))
16861 return -EFAULT;
16862 if (c == 'V')
16863- expect_close = 1;
16864+ expect_close = 42;
16865 }
16866 }
16867+
16868+ /* Well, anyhow someone wrote to us, we should return that favour */
16869 acq_ping();
16870- return 1;
16871 }
16872- return 0;
16873+ return count;
16874 }
16875
16876 static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
16877@@ -103,65 +123,75 @@
16878 {
16879 .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
16880 .firmware_version = 1,
16881- .identity = "Acquire WDT"
16882+ .identity = "Acquire WDT",
16883 };
16884-
16885+
16886 switch(cmd)
16887 {
16888 case WDIOC_GETSUPPORT:
16889- if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
16890- return -EFAULT;
16891- break;
16892-
16893+ return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ? -EFAULT : 0;
16894+
16895 case WDIOC_GETSTATUS:
16896- if (copy_to_user((int *)arg, &acq_is_open, sizeof(int)))
16897- return -EFAULT;
16898- break;
16899+ case WDIOC_GETBOOTSTATUS:
16900+ return put_user(0, (int *)arg);
16901
16902 case WDIOC_KEEPALIVE:
16903 acq_ping();
16904- break;
16905+ return 0;
16906+
16907+ case WDIOC_GETTIMEOUT:
16908+ return put_user(WATCHDOG_TIMEOUT, (int *)arg);
16909+
16910+ case WDIOC_SETOPTIONS:
16911+ {
16912+ int options, retval = -EINVAL;
16913+
16914+ if (get_user(options, (int *)arg))
16915+ return -EFAULT;
16916+
16917+ if (options & WDIOS_DISABLECARD)
16918+ {
16919+ acq_stop();
16920+ retval = 0;
16921+ }
16922+
16923+ if (options & WDIOS_ENABLECARD)
16924+ {
16925+ acq_ping();
16926+ retval = 0;
16927+ }
16928+
16929+ return retval;
16930+ }
16931
16932 default:
16933- return -ENOTTY;
16934+ return -ENOIOCTLCMD;
16935 }
16936- return 0;
16937 }
16938
16939 static int acq_open(struct inode *inode, struct file *file)
16940 {
16941- if ((minor(inode->i_rdev) == WATCHDOG_MINOR)) {
16942- spin_lock(&acq_lock);
16943- if(acq_is_open) {
16944- spin_unlock(&acq_lock);
16945- return -EBUSY;
16946- }
16947- if (nowayout)
16948- __module_get(THIS_MODULE);
16949+ if (test_and_set_bit(0, &acq_is_open))
16950+ return -EBUSY;
16951
16952- /* Activate */
16953- acq_is_open=1;
16954- inb_p(WDT_START);
16955- spin_unlock(&acq_lock);
16956- return 0;
16957+ if (nowayout)
16958+ __module_get(THIS_MODULE);
16959
16960- } else {
16961- return -ENODEV;
16962- }
16963+ /* Activate */
16964+ acq_ping();
16965+ return 0;
16966 }
16967
16968 static int acq_close(struct inode *inode, struct file *file)
16969 {
16970- if(minor(inode->i_rdev)==WATCHDOG_MINOR) {
16971- spin_lock(&acq_lock);
16972- if (expect_close)
16973- inb_p(WDT_STOP);
16974- else
16975- printk(KERN_CRIT "WDT closed unexpectedly. WDT will not stop!\n");
16976-
16977- acq_is_open=0;
16978- spin_unlock(&acq_lock);
16979+ if (expect_close == 42) {
16980+ acq_stop();
16981+ } else {
16982+ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
16983+ acq_ping();
16984 }
16985+ clear_bit(0, &acq_is_open);
16986+ expect_close = 0;
16987 return 0;
16988 }
16989
16990@@ -172,20 +202,20 @@
16991 static int acq_notify_sys(struct notifier_block *this, unsigned long code,
16992 void *unused)
16993 {
16994- if(code==SYS_DOWN || code==SYS_HALT)
16995- /* Turn the card off */
16996- inb_p(WDT_STOP);
16997-
16998+ if(code==SYS_DOWN || code==SYS_HALT) {
16999+ /* Turn the WDT off */
17000+ acq_stop();
17001+ }
17002 return NOTIFY_DONE;
17003 }
17004-
17005+
17006 /*
17007 * Kernel Interfaces
17008 */
17009-
17010-
17011+
17012 static struct file_operations acq_fops = {
17013 .owner = THIS_MODULE,
17014+ .llseek = no_llseek,
17015 .write = acq_write,
17016 .ioctl = acq_ioctl,
17017 .open = acq_open,
17018@@ -196,52 +226,84 @@
17019 {
17020 .minor = WATCHDOG_MINOR,
17021 .name = "watchdog",
17022- .fops = &acq_fops
17023+ .fops = &acq_fops,
17024 };
17025
17026-
17027 /*
17028 * The WDT card needs to learn about soft shutdowns in order to
17029- * turn the timebomb registers off.
17030+ * turn the timebomb registers off.
17031 */
17032-
17033+
17034 static struct notifier_block acq_notifier =
17035 {
17036 .notifier_call = acq_notify_sys,
17037 .next = NULL,
17038- .priority = 0
17039+ .priority = 0,
17040 };
17041
17042 static int __init acq_init(void)
17043 {
17044+ int ret;
17045+
17046 printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
17047
17048- spin_lock_init(&acq_lock);
17049- if (misc_register(&acq_miscdev))
17050- return -ENODEV;
17051- if (!request_region(WDT_STOP, 1, "Acquire WDT")) {
17052- misc_deregister(&acq_miscdev);
17053- return -EIO;
17054- }
17055- if (!request_region(WDT_START, 1, "Acquire WDT")) {
17056- release_region(WDT_STOP, 1);
17057- misc_deregister(&acq_miscdev);
17058- return -EIO;
17059+ if (wdt_stop != wdt_start) {
17060+ if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
17061+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17062+ wdt_stop);
17063+ ret = -EIO;
17064+ goto out;
17065+ }
17066 }
17067
17068- register_reboot_notifier(&acq_notifier);
17069- return 0;
17070+ if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
17071+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17072+ wdt_start);
17073+ ret = -EIO;
17074+ goto unreg_stop;
17075+ }
17076+
17077+ ret = register_reboot_notifier(&acq_notifier);
17078+ if (ret != 0) {
17079+ printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
17080+ ret);
17081+ goto unreg_regions;
17082+ }
17083+
17084+ ret = misc_register(&acq_miscdev);
17085+ if (ret != 0) {
17086+ printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
17087+ WATCHDOG_MINOR, ret);
17088+ goto unreg_reboot;
17089+ }
17090+
17091+ printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
17092+ nowayout);
17093+
17094+out:
17095+ return ret;
17096+unreg_reboot:
17097+ unregister_reboot_notifier(&acq_notifier);
17098+unreg_regions:
17099+ release_region(wdt_start, 1);
17100+unreg_stop:
17101+ if (wdt_stop != wdt_start)
17102+ release_region(wdt_stop, 1);
17103+ goto out;
17104 }
17105-
17106+
17107 static void __exit acq_exit(void)
17108 {
17109 misc_deregister(&acq_miscdev);
17110 unregister_reboot_notifier(&acq_notifier);
17111- release_region(WDT_STOP,1);
17112- release_region(WDT_START,1);
17113+ if(wdt_stop != wdt_start)
17114+ release_region(wdt_stop,1);
17115+ release_region(wdt_start,1);
17116 }
17117
17118 module_init(acq_init);
17119 module_exit(acq_exit);
17120
17121 MODULE_LICENSE("GPL");
17122+MODULE_AUTHOR("Unkown");
17123+MODULE_DESCRIPTION("Acquire Single Board Computer Watchdog Timer driver");
17124diff -Nru a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c
17125--- a/drivers/char/watchdog/advantechwdt.c Sat Aug 9 07:00:04 2003
17126+++ b/drivers/char/watchdog/advantechwdt.c Sat Aug 30 04:48:19 2003
17127@@ -133,7 +133,7 @@
17128 static struct watchdog_info ident = {
17129 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
17130 .firmware_version = 1,
17131- .identity = "Advantech WDT"
17132+ .identity = "Advantech WDT",
17133 };
17134
17135 switch (cmd) {
17136diff -Nru a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c
17137--- /dev/null Wed Dec 31 16:00:00 1969
17138+++ b/drivers/char/watchdog/alim1535_wdt.c Sun Aug 31 11:38:01 2003
17139@@ -0,0 +1,465 @@
17140+/*
17141+ * Watchdog for the 7101 PMU version found in the ALi M1535 chipsets
17142+ *
17143+ * This program is free software; you can redistribute it and/or
17144+ * modify it under the terms of the GNU General Public License
17145+ * as published by the Free Software Foundation; either version
17146+ * 2 of the License, or (at your option) any later version.
17147+ */
17148+
17149+#include <linux/module.h>
17150+#include <linux/moduleparam.h>
17151+#include <linux/types.h>
17152+#include <linux/miscdevice.h>
17153+#include <linux/watchdog.h>
17154+#include <linux/ioport.h>
17155+#include <linux/notifier.h>
17156+#include <linux/reboot.h>
17157+#include <linux/init.h>
17158+#include <linux/pci.h>
17159+
17160+#include <asm/uaccess.h>
17161+#include <asm/io.h>
17162+
17163+#define WATCHDOG_NAME "ALi_M1535"
17164+#define PFX WATCHDOG_NAME ": "
17165+#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
17166+
17167+/* internal variables */
17168+static unsigned long ali_is_open;
17169+static char ali_expect_release;
17170+static struct pci_dev *ali_pci;
17171+static u32 ali_timeout_bits; /* stores the computed timeout */
17172+static spinlock_t ali_lock; /* Guards the hardware */
17173+
17174+/* module parameters */
17175+static int timeout = WATCHDOG_TIMEOUT;
17176+module_param(timeout, int, 0);
17177+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
17178+
17179+#ifdef CONFIG_WATCHDOG_NOWAYOUT
17180+static int nowayout = 1;
17181+#else
17182+static int nowayout = 0;
17183+#endif
17184+
17185+module_param(nowayout, int, 0);
17186+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
17187+
17188+/*
17189+ * ali_start - start watchdog countdown
17190+ *
17191+ * Starts the timer running providing the timer has a counter
17192+ * configuration set.
17193+ */
17194+
17195+static void ali_start(void)
17196+{
17197+ u32 val;
17198+
17199+ spin_lock(&ali_lock);
17200+
17201+ pci_read_config_dword(ali_pci, 0xCC, &val);
17202+ val &= ~0x3F; /* Mask count */
17203+ val |= (1<<25) | ali_timeout_bits;
17204+ pci_write_config_dword(ali_pci, 0xCC, val);
17205+
17206+ spin_unlock(&ali_lock);
17207+}
17208+
17209+/*
17210+ * ali_stop - stop the timer countdown
17211+ *
17212+ * Stop the ALi watchdog countdown
17213+ */
17214+
17215+static void ali_stop(void)
17216+{
17217+ u32 val;
17218+
17219+ spin_lock(&ali_lock);
17220+
17221+ pci_read_config_dword(ali_pci, 0xCC, &val);
17222+ val &= ~0x3F; /* Mask count to zero (disabled) */
17223+ val &= ~(1<<25);/* and for safety mask the reset enable */
17224+ pci_write_config_dword(ali_pci, 0xCC, val);
17225+
17226+ spin_unlock(&ali_lock);
17227+}
17228+
17229+/*
17230+ * ali_keepalive - send a keepalive to the watchdog
17231+ *
17232+ * Send a keepalive to the timer (actually we restart the timer).
17233+ */
17234+
17235+static void ali_keepalive(void)
17236+{
17237+ ali_start();
17238+}
17239+
17240+/*
17241+ * ali_settimer - compute the timer reload value
17242+ * @t: time in seconds
17243+ *
17244+ * Computes the timeout values needed
17245+ */
17246+
17247+static int ali_settimer(int t)
17248+{
17249+ if(t < 0)
17250+ return -EINVAL;
17251+ else if(t < 60)
17252+ ali_timeout_bits = t|(1<<6);
17253+ else if(t < 3600)
17254+ ali_timeout_bits = (t/60)|(1<<7);
17255+ else if(t < 18000)
17256+ ali_timeout_bits = (t/300)|(1<<6)|(1<<7);
17257+ else return -EINVAL;
17258+
17259+ timeout = t;
17260+ return 0;
17261+}
17262+
17263+/*
17264+ * /dev/watchdog handling
17265+ */
17266+
17267+/*
17268+ * ali_write - writes to ALi watchdog
17269+ * @file: file from VFS
17270+ * @data: user address of data
17271+ * @len: length of data
17272+ * @ppos: pointer to the file offset
17273+ *
17274+ * Handle a write to the ALi watchdog. Writing to the file pings
17275+ * the watchdog and resets it. Writing the magic 'V' sequence allows
17276+ * the next close to turn off the watchdog.
17277+ */
17278+
17279+static ssize_t ali_write(struct file *file, const char *data,
17280+ size_t len, loff_t * ppos)
17281+{
17282+ /* Can't seek (pwrite) on this device */
17283+ if (ppos != &file->f_pos)
17284+ return -ESPIPE;
17285+
17286+ /* See if we got the magic character 'V' and reload the timer */
17287+ if (len) {
17288+ if (!nowayout) {
17289+ size_t i;
17290+
17291+ /* note: just in case someone wrote the magic character
17292+ * five months ago... */
17293+ ali_expect_release = 0;
17294+
17295+ /* scan to see wether or not we got the magic character */
17296+ for (i = 0; i != len; i++) {
17297+ char c;
17298+ if(get_user(c, data+i))
17299+ return -EFAULT;
17300+ if (c == 'V')
17301+ ali_expect_release = 42;
17302+ }
17303+ }
17304+
17305+ /* someone wrote to us, we should reload the timer */
17306+ ali_start();
17307+ }
17308+ return len;
17309+}
17310+
17311+/*
17312+ * ali_ioctl - handle watchdog ioctls
17313+ * @inode: VFS inode
17314+ * @file: VFS file pointer
17315+ * @cmd: ioctl number
17316+ * @arg: arguments to the ioctl
17317+ *
17318+ * Handle the watchdog ioctls supported by the ALi driver. Really
17319+ * we want an extension to enable irq ack monitoring and the like
17320+ */
17321+
17322+static int ali_ioctl(struct inode *inode, struct file *file,
17323+ unsigned int cmd, unsigned long arg)
17324+{
17325+ static struct watchdog_info ident = {
17326+ .options = WDIOF_KEEPALIVEPING |
17327+ WDIOF_SETTIMEOUT |
17328+ WDIOF_MAGICCLOSE,
17329+ .firmware_version = 0,
17330+ .identity = "ALi M1535 WatchDog Timer",
17331+ };
17332+
17333+ switch (cmd) {
17334+ case WDIOC_GETSUPPORT:
17335+ return copy_to_user((struct watchdog_info *) arg, &ident,
17336+ sizeof (ident)) ? -EFAULT : 0;
17337+
17338+ case WDIOC_GETSTATUS:
17339+ case WDIOC_GETBOOTSTATUS:
17340+ return put_user(0, (int *) arg);
17341+
17342+ case WDIOC_KEEPALIVE:
17343+ ali_keepalive();
17344+ return 0;
17345+
17346+ case WDIOC_SETOPTIONS:
17347+ {
17348+ int new_options, retval = -EINVAL;
17349+
17350+ if (get_user (new_options, (int *) arg))
17351+ return -EFAULT;
17352+
17353+ if (new_options & WDIOS_DISABLECARD) {
17354+ ali_stop();
17355+ retval = 0;
17356+ }
17357+
17358+ if (new_options & WDIOS_ENABLECARD) {
17359+ ali_start();
17360+ retval = 0;
17361+ }
17362+
17363+ return retval;
17364+ }
17365+
17366+ case WDIOC_SETTIMEOUT:
17367+ {
17368+ int new_timeout;
17369+
17370+ if (get_user(new_timeout, (int *) arg))
17371+ return -EFAULT;
17372+
17373+ if (ali_settimer(new_timeout))
17374+ return -EINVAL;
17375+
17376+ ali_keepalive();
17377+ /* Fall */
17378+ }
17379+
17380+ case WDIOC_GETTIMEOUT:
17381+ return put_user(timeout, (int *)arg);
17382+
17383+ default:
17384+ return -ENOIOCTLCMD;
17385+ }
17386+}
17387+
17388+/*
17389+ * ali_open - handle open of ali watchdog
17390+ * @inode: inode from VFS
17391+ * @file: file from VFS
17392+ *
17393+ * Open the ALi watchdog device. Ensure only one person opens it
17394+ * at a time. Also start the watchdog running.
17395+ */
17396+
17397+static int ali_open(struct inode *inode, struct file *file)
17398+{
17399+ /* /dev/watchdog can only be opened once */
17400+ if (test_and_set_bit(0, &ali_is_open))
17401+ return -EBUSY;
17402+
17403+ /* Activate */
17404+ ali_start();
17405+ return 0;
17406+}
17407+
17408+/*
17409+ * ali_release - close an ALi watchdog
17410+ * @inode: inode from VFS
17411+ * @file: file from VFS
17412+ *
17413+ * Close the ALi watchdog device. Actual shutdown of the timer
17414+ * only occurs if the magic sequence has been set.
17415+ */
17416+
17417+static int ali_release(struct inode *inode, struct file *file)
17418+{
17419+ /*
17420+ * Shut off the timer.
17421+ */
17422+ if (ali_expect_release == 42) {
17423+ ali_stop();
17424+ } else {
17425+ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
17426+ ali_keepalive();
17427+ }
17428+ clear_bit(0, &ali_is_open);
17429+ ali_expect_release = 0;
17430+ return 0;
17431+}
17432+
17433+/*
17434+ * ali_notify_sys - System down notifier
17435+ *
17436+ * Notifier for system down
17437+ */
17438+
17439+
17440+static int ali_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
17441+{
17442+ if (code==SYS_DOWN || code==SYS_HALT) {
17443+ /* Turn the WDT off */
17444+ ali_stop();
17445+ }
17446+
17447+ return NOTIFY_DONE;
17448+}
17449+
17450+/*
17451+ * Data for PCI driver interface
17452+ *
17453+ * This data only exists for exporting the supported
17454+ * PCI ids via MODULE_DEVICE_TABLE. We do not actually
17455+ * register a pci_driver, because someone else might one day
17456+ * want to register another driver on the same PCI id.
17457+ */
17458+
17459+static struct pci_device_id ali_pci_tbl[] __initdata = {
17460+ { PCI_VENDOR_ID_AL, 1535, PCI_ANY_ID, PCI_ANY_ID,},
17461+ { 0, },
17462+};
17463+MODULE_DEVICE_TABLE(pci, ali_pci_tbl);
17464+
17465+/*
17466+ * ali_find_watchdog - find a 1535 and 7101
17467+ *
17468+ * Scans the PCI hardware for a 1535 series bridge and matching 7101
17469+ * watchdog device. This may be overtight but it is better to be safe
17470+ */
17471+
17472+static int __init ali_find_watchdog(void)
17473+{
17474+ struct pci_dev *pdev;
17475+ u32 wdog;
17476+
17477+ /* Check for a 1535 series bridge */
17478+ pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x1535, NULL);
17479+ if(pdev == NULL)
17480+ return -ENODEV;
17481+
17482+ /* Check for the a 7101 PMU */
17483+ pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
17484+ if(pdev == NULL)
17485+ return -ENODEV;
17486+
17487+ if(pci_enable_device(pdev))
17488+ return -EIO;
17489+
17490+ ali_pci = pdev;
17491+
17492+ /*
17493+ * Initialize the timer bits
17494+ */
17495+ pci_read_config_dword(pdev, 0xCC, &wdog);
17496+
17497+ wdog &= ~0x3F; /* Timer bits */
17498+ wdog &= ~((1<<27)|(1<<26)|(1<<25)|(1<<24)); /* Issued events */
17499+ wdog &= ~((1<<16)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)); /* No monitor bits */
17500+
17501+ pci_write_config_dword(pdev, 0xCC, wdog);
17502+
17503+ return 0;
17504+}
17505+
17506+/*
17507+ * Kernel Interfaces
17508+ */
17509+
17510+static struct file_operations ali_fops = {
17511+ .owner = THIS_MODULE,
17512+ .llseek = no_llseek,
17513+ .write = ali_write,
17514+ .ioctl = ali_ioctl,
17515+ .open = ali_open,
17516+ .release = ali_release,
17517+};
17518+
17519+static struct miscdevice ali_miscdev = {
17520+ .minor = WATCHDOG_MINOR,
17521+ .name = "watchdog",
17522+ .fops = &ali_fops,
17523+};
17524+
17525+static struct notifier_block ali_notifier = {
17526+ .notifier_call = ali_notify_sys,
17527+ .next = NULL,
17528+ .priority = 0,
17529+};
17530+
17531+/*
17532+ * watchdog_init - module initialiser
17533+ *
17534+ * Scan for a suitable watchdog and if so initialize it. Return an error
17535+ * if we cannot, the error causes the module to unload
17536+ */
17537+
17538+static int __init watchdog_init(void)
17539+{
17540+ int ret;
17541+
17542+ spin_lock_init(&ali_lock);
17543+
17544+ /* Check wether or not the hardware watchdog is there */
17545+ if (ali_find_watchdog() != 0) {
17546+ return -ENODEV;
17547+ }
17548+
17549+ /* Check that the timeout value is within it's range ; if not reset to the default */
17550+ if (timeout < 1 || timeout >= 18000) {
17551+ timeout = WATCHDOG_TIMEOUT;
17552+ printk(KERN_INFO PFX "timeout value must be 0<timeout<18000, using %d\n",
17553+ timeout);
17554+ }
17555+
17556+ /* Calculate the watchdog's timeout */
17557+ ali_settimer(timeout);
17558+
17559+ ret = misc_register(&ali_miscdev);
17560+ if (ret != 0) {
17561+ printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
17562+ WATCHDOG_MINOR, ret);
17563+ goto out;
17564+ }
17565+
17566+ ret = register_reboot_notifier(&ali_notifier);
17567+ if (ret != 0) {
17568+ printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
17569+ ret);
17570+ goto unreg_miscdev;
17571+ }
17572+
17573+ printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
17574+ timeout, nowayout);
17575+
17576+out:
17577+ return ret;
17578+unreg_miscdev:
17579+ misc_deregister(&ali_miscdev);
17580+ goto out;
17581+}
17582+
17583+/*
17584+ * watchdog_exit - module de-initialiser
17585+ *
17586+ * Called while unloading a successfully installed watchdog module.
17587+ */
17588+
17589+static void __exit watchdog_exit(void)
17590+{
17591+ /* Stop the timer before we leave */
17592+ ali_stop();
17593+
17594+ /* Deregister */
17595+ unregister_reboot_notifier(&ali_notifier);
17596+ misc_deregister(&ali_miscdev);
17597+}
17598+
17599+module_init(watchdog_init);
17600+module_exit(watchdog_exit);
17601+
17602+MODULE_AUTHOR("Alan Cox");
17603+MODULE_DESCRIPTION("ALi M1535 PMU Watchdog Timer driver");
17604+MODULE_LICENSE("GPL");
17605diff -Nru a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c
17606--- a/drivers/char/watchdog/cpu5wdt.c Thu Feb 13 06:54:43 2003
17607+++ b/drivers/char/watchdog/cpu5wdt.c Tue Aug 26 09:25:41 2003
17608@@ -134,7 +134,7 @@
17609
17610 static int cpu5wdt_open(struct inode *inode, struct file *file)
17611 {
17612- switch(minor(inode->i_rdev)) {
17613+ switch(iminor(inode)) {
17614 case WATCHDOG_MINOR:
17615 if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
17616 return -EBUSY;
17617@@ -148,7 +148,7 @@
17618
17619 static int cpu5wdt_release(struct inode *inode, struct file *file)
17620 {
17621- if(minor(inode->i_rdev)==WATCHDOG_MINOR) {
17622+ if(iminor(inode)==WATCHDOG_MINOR) {
17623 clear_bit(0, &cpu5wdt_device.inuse);
17624 }
17625 return 0;
17626diff -Nru a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
17627--- a/drivers/char/watchdog/ib700wdt.c Fri Aug 8 03:28:08 2003
17628+++ b/drivers/char/watchdog/ib700wdt.c Tue Aug 26 09:25:41 2003
17629@@ -218,7 +218,7 @@
17630 static int
17631 ibwdt_open(struct inode *inode, struct file *file)
17632 {
17633- if (minor(inode->i_rdev) == WATCHDOG_MINOR) {
17634+ if (iminor(inode) == WATCHDOG_MINOR) {
17635 spin_lock(&ibwdt_lock);
17636 if (ibwdt_is_open) {
17637 spin_unlock(&ibwdt_lock);
17638@@ -240,7 +240,7 @@
17639 static int
17640 ibwdt_close(struct inode *inode, struct file *file)
17641 {
17642- if (minor(inode->i_rdev) == WATCHDOG_MINOR) {
17643+ if (iminor(inode) == WATCHDOG_MINOR) {
17644 spin_lock(&ibwdt_lock);
17645 if (expect_close)
17646 outb_p(wd_times[wd_margin], WDT_STOP);
17647diff -Nru a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
17648--- a/drivers/char/watchdog/machzwd.c Fri Aug 8 03:28:08 2003
17649+++ b/drivers/char/watchdog/machzwd.c Tue Aug 26 09:25:41 2003
17650@@ -377,7 +377,7 @@
17651
17652 static int zf_open(struct inode *inode, struct file *file)
17653 {
17654- switch(minor(inode->i_rdev)){
17655+ switch(iminor(inode)){
17656 case WATCHDOG_MINOR:
17657 spin_lock(&zf_lock);
17658 if(zf_is_open){
17659@@ -402,7 +402,7 @@
17660
17661 static int zf_close(struct inode *inode, struct file *file)
17662 {
17663- if(minor(inode->i_rdev) == WATCHDOG_MINOR){
17664+ if(iminor(inode) == WATCHDOG_MINOR){
17665
17666 if(zf_expect_close){
17667 zf_timer_off();
17668diff -Nru a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
17669--- a/drivers/char/watchdog/pcwd.c Fri Aug 1 03:02:31 2003
17670+++ b/drivers/char/watchdog/pcwd.c Tue Aug 26 09:25:41 2003
17671@@ -426,7 +426,7 @@
17672
17673 static int pcwd_open(struct inode *ino, struct file *filep)
17674 {
17675- switch (minor(ino->i_rdev)) {
17676+ switch (iminor(ino)) {
17677 case WATCHDOG_MINOR:
17678 if (!atomic_dec_and_test(&open_allowed) ) {
17679 atomic_inc( &open_allowed );
17680@@ -457,7 +457,7 @@
17681 /* Can't seek (pread) on this device */
17682 if (ppos != &file->f_pos)
17683 return -ESPIPE;
17684- switch(minor(file->f_dentry->d_inode->i_rdev))
17685+ switch(iminor(file->f_dentry->d_inode))
17686 {
17687 case TEMP_MINOR:
17688 /*
17689@@ -477,7 +477,7 @@
17690
17691 static int pcwd_close(struct inode *ino, struct file *filep)
17692 {
17693- if (minor(ino->i_rdev)==WATCHDOG_MINOR) {
17694+ if (iminor(ino)==WATCHDOG_MINOR) {
17695 if (expect_close) {
17696 /* Disable the board */
17697 if (revision == PCWD_REVISION_C) {
17698diff -Nru a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c
17699--- a/drivers/char/watchdog/wafer5823wdt.c Fri Aug 1 03:02:31 2003
17700+++ b/drivers/char/watchdog/wafer5823wdt.c Sun Aug 31 11:32:43 2003
17701@@ -1,5 +1,5 @@
17702 /*
17703- * ICP Wafer 5823 Single Board Computer WDT driver for Linux 2.4.x
17704+ * ICP Wafer 5823 Single Board Computer WDT driver
17705 * http://www.icpamerica.com/wafer_5823.php
17706 * May also work on other similar models
17707 *
17708@@ -17,10 +17,10 @@
17709 * modify it under the terms of the GNU General Public License
17710 * as published by the Free Software Foundation; either version
17711 * 2 of the License, or (at your option) any later version.
17712- *
17713- * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
17714- * warranty for any of this software. This material is provided
17715- * "AS-IS" and at no charge.
17716+ *
17717+ * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
17718+ * warranty for any of this software. This material is provided
17719+ * "AS-IS" and at no charge.
17720 *
17721 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
17722 *
17723@@ -39,9 +39,13 @@
17724 #include <asm/io.h>
17725 #include <asm/uaccess.h>
17726
17727+#define WATCHDOG_NAME "Wafer 5823 WDT"
17728+#define PFX WATCHDOG_NAME ": "
17729+#define WD_TIMO 60 /* 60 sec default timeout */
17730+
17731 static unsigned long wafwdt_is_open;
17732+static char expect_close;
17733 static spinlock_t wafwdt_lock;
17734-static int expect_close = 0;
17735
17736 /*
17737 * You must set these - there is no sane way to probe for this board.
17738@@ -52,11 +56,17 @@
17739 * to restart it again.
17740 */
17741
17742-#define WDT_START 0x443
17743-#define WDT_STOP 0x843
17744-
17745-#define WD_TIMO 60 /* 1 minute */
17746-static int wd_margin = WD_TIMO;
17747+static int wdt_stop = 0x843;
17748+module_param(wdt_stop, int, 0);
17749+MODULE_PARM_DESC(wdt_stop, "Wafer 5823 WDT 'stop' io port (default 0x843)");
17750+
17751+static int wdt_start = 0x443;
17752+module_param(wdt_start, int, 0);
17753+MODULE_PARM_DESC(wdt_start, "Wafer 5823 WDT 'start' io port (default 0x443)");
17754+
17755+static int timeout = WD_TIMO; /* in seconds */
17756+module_param(timeout, int, 0);
17757+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) ".");
17758
17759 #ifdef CONFIG_WATCHDOG_NOWAYOUT
17760 static int nowayout = 1;
17761@@ -70,24 +80,24 @@
17762 static void wafwdt_ping(void)
17763 {
17764 /* pat watchdog */
17765- spin_lock(&wafwdt_lock);
17766- inb_p(WDT_STOP);
17767- inb_p(WDT_START);
17768- spin_unlock(&wafwdt_lock);
17769+ spin_lock(&wafwdt_lock);
17770+ inb_p(wdt_stop);
17771+ inb_p(wdt_start);
17772+ spin_unlock(&wafwdt_lock);
17773 }
17774
17775 static void wafwdt_start(void)
17776 {
17777 /* start up watchdog */
17778- outb_p(wd_margin, WDT_START);
17779- inb_p(WDT_START);
17780+ outb_p(timeout, wdt_start);
17781+ inb_p(wdt_start);
17782 }
17783
17784 static void
17785 wafwdt_stop(void)
17786 {
17787 /* stop watchdog */
17788- inb_p(WDT_STOP);
17789+ inb_p(wdt_stop);
17790 }
17791
17792 static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
17793@@ -96,6 +106,7 @@
17794 if (ppos != &file->f_pos)
17795 return -ESPIPE;
17796
17797+ /* See if we got the magic character 'V' and reload the timer */
17798 if (count) {
17799 if (!nowayout) {
17800 size_t i;
17801@@ -103,30 +114,30 @@
17802 /* In case it was set long ago */
17803 expect_close = 0;
17804
17805+ /* scan to see wether or not we got the magic character */
17806 for (i = 0; i != count; i++) {
17807 char c;
17808 if (get_user(c, buf + i))
17809 return -EFAULT;
17810 if (c == 'V')
17811- expect_close = 1;
17812+ expect_close = 42;
17813 }
17814 }
17815+ /* Well, anyhow someone wrote to us, we should return that favour */
17816 wafwdt_ping();
17817- return 1;
17818 }
17819- return 0;
17820+ return count;
17821 }
17822
17823 static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
17824 unsigned long arg)
17825 {
17826- int new_margin;
17827+ int new_timeout;
17828 static struct watchdog_info ident = {
17829 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
17830 .firmware_version = 1,
17831- .identity = "Wafer 5823 WDT"
17832+ .identity = "Wafer 5823 WDT",
17833 };
17834- int one=1;
17835
17836 switch (cmd) {
17837 case WDIOC_GETSUPPORT:
17838@@ -136,25 +147,44 @@
17839 break;
17840
17841 case WDIOC_GETSTATUS:
17842- if (copy_to_user((int *) arg, &one, sizeof (int)))
17843- return -EFAULT;
17844- break;
17845+ case WDIOC_GETBOOTSTATUS:
17846+ return put_user(0, (int *)arg);
17847
17848 case WDIOC_KEEPALIVE:
17849 wafwdt_ping();
17850 break;
17851
17852 case WDIOC_SETTIMEOUT:
17853- if (get_user(new_margin, (int *)arg))
17854+ if (get_user(new_timeout, (int *)arg))
17855 return -EFAULT;
17856- if ((new_margin < 1) || (new_margin > 255))
17857+ if ((new_timeout < 1) || (new_timeout > 255))
17858 return -EINVAL;
17859- wd_margin = new_margin;
17860+ timeout = new_timeout;
17861 wafwdt_stop();
17862 wafwdt_start();
17863 /* Fall */
17864 case WDIOC_GETTIMEOUT:
17865- return put_user(wd_margin, (int *)arg);
17866+ return put_user(timeout, (int *)arg);
17867+
17868+ case WDIOC_SETOPTIONS:
17869+ {
17870+ int options, retval = -EINVAL;
17871+
17872+ if (get_user(options, (int *)arg))
17873+ return -EFAULT;
17874+
17875+ if (options & WDIOS_DISABLECARD) {
17876+ wafwdt_start();
17877+ retval = 0;
17878+ }
17879+
17880+ if (options & WDIOS_ENABLECARD) {
17881+ wafwdt_stop();
17882+ retval = 0;
17883+ }
17884+
17885+ return retval;
17886+ }
17887
17888 default:
17889 return -ENOTTY;
17890@@ -166,6 +196,10 @@
17891 {
17892 if (test_and_set_bit(0, &wafwdt_is_open))
17893 return -EBUSY;
17894+
17895+ /*
17896+ * Activate
17897+ */
17898 wafwdt_start();
17899 return 0;
17900 }
17901@@ -173,12 +207,14 @@
17902 static int
17903 wafwdt_close(struct inode *inode, struct file *file)
17904 {
17905- clear_bit(0, &wafwdt_is_open);
17906- if (expect_close) {
17907+ if (expect_close == 42) {
17908 wafwdt_stop();
17909 } else {
17910- printk(KERN_CRIT "WDT device closed unexpectedly. WDT will not stop!\n");
17911+ printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n");
17912+ wafwdt_ping();
17913 }
17914+ clear_bit(0, &wafwdt_is_open);
17915+ expect_close = 0;
17916 return 0;
17917 }
17918
17919@@ -201,6 +237,7 @@
17920
17921 static struct file_operations wafwdt_fops = {
17922 .owner = THIS_MODULE,
17923+ .llseek = no_llseek,
17924 .write = wafwdt_write,
17925 .ioctl = wafwdt_ioctl,
17926 .open = wafwdt_open,
17927@@ -210,53 +247,93 @@
17928 static struct miscdevice wafwdt_miscdev = {
17929 .minor = WATCHDOG_MINOR,
17930 .name = "watchdog",
17931- .fops = &wafwdt_fops
17932+ .fops = &wafwdt_fops,
17933 };
17934
17935 /*
17936 * The WDT needs to learn about soft shutdowns in order to
17937- * turn the timebomb registers off.
17938+ * turn the timebomb registers off.
17939 */
17940
17941 static struct notifier_block wafwdt_notifier = {
17942 .notifier_call = wafwdt_notify_sys,
17943 .next = NULL,
17944- .priority = 0
17945+ .priority = 0,
17946 };
17947
17948 static int __init wafwdt_init(void)
17949 {
17950+ int ret;
17951+
17952 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n");
17953
17954 spin_lock_init(&wafwdt_lock);
17955- if(!request_region(WDT_STOP, 1, "Wafer 5823 WDT"))
17956- goto error;
17957- if(!request_region(WDT_START, 1, "Wafer 5823 WDT"))
17958+
17959+ if (timeout < 1 || timeout > 63) {
17960+ timeout = WD_TIMO;
17961+ printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n",
17962+ timeout);
17963+ }
17964+
17965+ if (wdt_stop != wdt_start) {
17966+ if(!request_region(wdt_stop, 1, "Wafer 5823 WDT")) {
17967+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17968+ wdt_stop);
17969+ ret = -EIO;
17970+ goto error;
17971+ }
17972+ }
17973+
17974+ if(!request_region(wdt_start, 1, "Wafer 5823 WDT")) {
17975+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17976+ wdt_start);
17977+ ret = -EIO;
17978 goto error2;
17979- if(misc_register(&wafwdt_miscdev)<0)
17980+ }
17981+
17982+ ret = register_reboot_notifier(&wafwdt_notifier);
17983+ if (ret != 0) {
17984+ printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
17985+ ret);
17986 goto error3;
17987- register_reboot_notifier(&wafwdt_notifier);
17988- return 0;
17989+ }
17990+
17991+ ret = misc_register(&wafwdt_miscdev);
17992+ if (ret != 0) {
17993+ printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
17994+ WATCHDOG_MINOR, ret);
17995+ goto error4;
17996+ }
17997+
17998+ printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
17999+ timeout, nowayout);
18000+
18001+ return ret;
18002+error4:
18003+ unregister_reboot_notifier(&wafwdt_notifier);
18004 error3:
18005- release_region(WDT_START, 1);
18006+ release_region(wdt_start, 1);
18007 error2:
18008- release_region(WDT_STOP, 1);
18009+ if (wdt_stop != wdt_start)
18010+ release_region(wdt_stop, 1);
18011 error:
18012- return -ENODEV;
18013+ return ret;
18014 }
18015
18016 static void __exit wafwdt_exit(void)
18017 {
18018 misc_deregister(&wafwdt_miscdev);
18019 unregister_reboot_notifier(&wafwdt_notifier);
18020- release_region(WDT_STOP, 1);
18021- release_region(WDT_START, 1);
18022+ if(wdt_stop != wdt_start)
18023+ release_region(wdt_stop, 1);
18024+ release_region(wdt_start, 1);
18025 }
18026
18027 module_init(wafwdt_init);
18028 module_exit(wafwdt_exit);
18029
18030 MODULE_AUTHOR("Justin Cormack");
18031+MODULE_DESCRIPTION("ICP Wafer 5823 Single Board Computer WDT driver");
18032 MODULE_LICENSE("GPL");
18033
18034 /* end of wafer5823wdt.c */
18035diff -Nru a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c
18036--- a/drivers/char/watchdog/wdt.c Thu Apr 24 05:36:57 2003
18037+++ b/drivers/char/watchdog/wdt.c Tue Aug 26 09:25:41 2003
18038@@ -290,7 +290,7 @@
18039 if (ptr != &file->f_pos)
18040 return -ESPIPE;
18041
18042- switch(minor(file->f_dentry->d_inode->i_rdev))
18043+ switch(iminor(file->f_dentry->d_inode))
18044 {
18045 case TEMP_MINOR:
18046 c*=11;
18047@@ -373,7 +373,7 @@
18048
18049 static int wdt_open(struct inode *inode, struct file *file)
18050 {
18051- switch(minor(inode->i_rdev))
18052+ switch(iminor(inode))
18053 {
18054 case WATCHDOG_MINOR:
18055 if(test_and_set_bit(0, &wdt_is_open))
18056@@ -413,7 +413,7 @@
18057
18058 static int wdt_release(struct inode *inode, struct file *file)
18059 {
18060- if(minor(inode->i_rdev)==WATCHDOG_MINOR)
18061+ if(iminor(inode)==WATCHDOG_MINOR)
18062 {
18063 if (expect_close) {
18064 inb_p(WDT_DC); /* Disable counters */
18065diff -Nru a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
18066--- a/drivers/char/watchdog/wdt_pci.c Fri Aug 1 11:59:44 2003
18067+++ b/drivers/char/watchdog/wdt_pci.c Tue Aug 26 09:25:41 2003
18068@@ -276,7 +276,7 @@
18069 if (ptr != &file->f_pos)
18070 return -ESPIPE;
18071
18072- switch(minor(file->f_dentry->d_inode->i_rdev))
18073+ switch(iminor(file->f_dentry->d_inode))
18074 {
18075 case TEMP_MINOR:
18076 c*=11;
18077@@ -361,7 +361,7 @@
18078 {
18079 unsigned long flags;
18080
18081- switch(minor(inode->i_rdev))
18082+ switch(iminor(inode))
18083 {
18084 case WATCHDOG_MINOR:
18085 if (down_trylock(&open_sem))
18086@@ -423,7 +423,7 @@
18087 static int wdtpci_release(struct inode *inode, struct file *file)
18088 {
18089
18090- if (minor(inode->i_rdev)==WATCHDOG_MINOR) {
18091+ if (iminor(inode)==WATCHDOG_MINOR) {
18092 unsigned long flags;
18093 if (expect_close) {
18094 spin_lock_irqsave(&wdtpci_lock, flags);
18095diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
18096--- a/drivers/i2c/i2c-dev.c Wed Aug 6 02:26:55 2003
18097+++ b/drivers/i2c/i2c-dev.c Tue Aug 26 09:25:41 2003
18098@@ -138,7 +138,7 @@
18099 return -ENOMEM;
18100
18101 pr_debug("i2c-dev.o: i2c-%d reading %d bytes.\n",
18102- minor(file->f_dentry->d_inode->i_rdev), count);
18103+ iminor(file->f_dentry->d_inode), count);
18104
18105 ret = i2c_master_recv(client,tmp,count);
18106 if (ret >= 0)
18107@@ -166,7 +166,7 @@
18108 }
18109
18110 pr_debug("i2c-dev.o: i2c-%d writing %d bytes.\n",
18111- minor(file->f_dentry->d_inode->i_rdev), count);
18112+ iminor(file->f_dentry->d_inode), count);
18113
18114 ret = i2c_master_send(client,tmp,count);
18115 kfree(tmp);
18116@@ -186,7 +186,7 @@
18117 unsigned long funcs;
18118
18119 dev_dbg(&client->dev, "i2c-%d ioctl, cmd: 0x%x, arg: %lx.\n",
18120- minor(inode->i_rdev),cmd, arg);
18121+ iminor(inode),cmd, arg);
18122
18123 switch ( cmd ) {
18124 case I2C_SLAVE:
18125@@ -373,7 +373,7 @@
18126
18127 static int i2cdev_open(struct inode *inode, struct file *file)
18128 {
18129- unsigned int minor = minor(inode->i_rdev);
18130+ unsigned int minor = iminor(inode);
18131 struct i2c_client *client;
18132 struct i2c_adapter *adap;
18133 struct i2c_dev *i2c_dev;
18134diff -Nru a/drivers/i2c/i2c-keywest.c b/drivers/i2c/i2c-keywest.c
18135--- a/drivers/i2c/i2c-keywest.c Wed Jul 9 04:45:34 2003
18136+++ b/drivers/i2c/i2c-keywest.c Tue Aug 26 06:35:38 2003
18137@@ -81,9 +81,6 @@
18138 int probe = 0;
18139 int debug = 0;
18140
18141-static struct keywest_iface *ifaces = NULL;
18142-
18143-
18144 static void
18145 do_stop(struct keywest_iface* iface, int result)
18146 {
18147@@ -306,6 +303,7 @@
18148 write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR);
18149 write_reg(reg_ier, KW_I2C_IRQ_MASK);
18150
18151+ /* Wait interrupt operations completion */
18152 wait_for_completion(&iface->complete);
18153
18154 rc = iface->result;
18155@@ -385,6 +383,7 @@
18156 write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR);
18157 write_reg(reg_ier, KW_I2C_IRQ_MASK);
18158
18159+ /* Wait interrupt operations completion */
18160 wait_for_completion(&iface->complete);
18161
18162 rc = iface->result;
18163@@ -409,16 +408,16 @@
18164
18165 /* For now, we only handle combined mode (smbus) */
18166 static struct i2c_algorithm keywest_algorithm = {
18167- name: "Keywest i2c",
18168- id: I2C_ALGO_SMBUS,
18169- smbus_xfer: keywest_smbus_xfer,
18170- master_xfer: keywest_xfer,
18171- functionality: keywest_func,
18172+ .name = "Keywest i2c",
18173+ .id = I2C_ALGO_SMBUS,
18174+ .smbus_xfer = keywest_smbus_xfer,
18175+ .master_xfer = keywest_xfer,
18176+ .functionality = keywest_func,
18177 };
18178
18179
18180 static int
18181-create_iface(struct device_node* np)
18182+create_iface(struct device_node *np, struct device *dev)
18183 {
18184 unsigned long steps, *psteps, *prate;
18185 unsigned bsteps, tsize, i, nchan, addroffset;
18186@@ -487,8 +486,8 @@
18187 *prate);
18188 }
18189
18190- /* Select standard mode by default */
18191- iface->cur_mode |= KW_I2C_MODE_STANDARD;
18192+ /* Select standard sub mode */
18193+ iface->cur_mode |= KW_I2C_MODE_STANDARDSUB;
18194
18195 /* Write mode */
18196 write_reg(reg_mode, iface->cur_mode);
18197@@ -506,11 +505,13 @@
18198 return -ENODEV;
18199 }
18200
18201+ dev_set_drvdata(dev, iface);
18202+
18203 for (i=0; i<nchan; i++) {
18204 struct keywest_chan* chan = &iface->channels[i];
18205 u8 addr;
18206
18207- sprintf(chan->adapter.dev.name, "%s %d", np->parent->name, i);
18208+ sprintf(chan->adapter.name, "%s %d", np->parent->name, i);
18209 chan->iface = iface;
18210 chan->chan_no = i;
18211 chan->adapter.id = I2C_ALGO_SMBUS;
18212@@ -519,11 +520,12 @@
18213 chan->adapter.client_register = NULL;
18214 chan->adapter.client_unregister = NULL;
18215 i2c_set_adapdata(&chan->adapter, chan);
18216+ chan->adapter.dev.parent = dev;
18217
18218 rc = i2c_add_adapter(&chan->adapter);
18219 if (rc) {
18220 printk("i2c-keywest.c: Adapter %s registration failed\n",
18221- chan->adapter.dev.name);
18222+ chan->adapter.name);
18223 i2c_set_adapdata(&chan->adapter, NULL);
18224 }
18225 if (probe) {
18226@@ -540,20 +542,18 @@
18227 printk(KERN_INFO "Found KeyWest i2c on \"%s\", %d channel%s, stepping: %d bits\n",
18228 np->parent->name, nchan, nchan > 1 ? "s" : "", bsteps);
18229
18230- iface->next = ifaces;
18231- ifaces = iface;
18232 return 0;
18233 }
18234
18235-static void
18236-dispose_iface(struct keywest_iface *iface)
18237+static int
18238+dispose_iface(struct device *dev)
18239 {
18240+ struct keywest_iface *iface = dev_get_drvdata(dev);
18241 int i, rc;
18242
18243- ifaces = iface->next;
18244-
18245 /* Make sure we stop all activity */
18246 down(&iface->sem);
18247+
18248 spin_lock_irq(&iface->lock);
18249 while (iface->state != state_idle) {
18250 spin_unlock_irq(&iface->lock);
18251@@ -578,31 +578,76 @@
18252 printk("i2c-keywest.c: i2c_del_adapter failed, that's bad !\n");
18253 }
18254 iounmap((void *)iface->base);
18255+ dev_set_drvdata(dev, NULL);
18256 kfree(iface);
18257+
18258+ return 0;
18259+}
18260+
18261+static int
18262+create_iface_macio(struct macio_dev* dev, const struct of_match *match)
18263+{
18264+ return create_iface(dev->ofdev.node, &dev->ofdev.dev);
18265+}
18266+
18267+static int
18268+dispose_iface_macio(struct macio_dev* dev)
18269+{
18270+ return dispose_iface(&dev->ofdev.dev);
18271+}
18272+
18273+static int
18274+create_iface_of_platform(struct of_device* dev, const struct of_match *match)
18275+{
18276+ return create_iface(dev->node, &dev->dev);
18277+}
18278+
18279+static int
18280+dispose_iface_of_platform(struct of_device* dev)
18281+{
18282+ return dispose_iface(&dev->dev);
18283 }
18284
18285+static struct of_match i2c_keywest_match[] =
18286+{
18287+ {
18288+ .name = OF_ANY_MATCH,
18289+ .type = "i2c",
18290+ .compatible = "keywest"
18291+ },
18292+ {},
18293+};
18294+
18295+static struct macio_driver i2c_keywest_macio_driver =
18296+{
18297+ .name = "i2c-keywest",
18298+ .match_table = i2c_keywest_match,
18299+ .probe = create_iface_macio,
18300+ .remove = dispose_iface_macio
18301+};
18302+
18303+static struct of_platform_driver i2c_keywest_of_platform_driver =
18304+{
18305+ .name = "i2c-keywest",
18306+ .match_table = i2c_keywest_match,
18307+ .probe = create_iface_of_platform,
18308+ .remove = dispose_iface_of_platform
18309+};
18310+
18311 static int __init
18312 i2c_keywest_init(void)
18313 {
18314- struct device_node *np;
18315- int rc = -ENODEV;
18316-
18317- np = find_compatible_devices("i2c", "keywest");
18318- while (np != 0) {
18319- if (np->n_addrs >= 1 && np->n_intrs >= 1)
18320- rc = create_iface(np);
18321- np = np->next;
18322- }
18323- if (ifaces)
18324- rc = 0;
18325- return rc;
18326+ macio_register_driver(&i2c_keywest_macio_driver);
18327+ of_register_driver(&i2c_keywest_of_platform_driver);
18328+
18329+ return 0;
18330 }
18331
18332 static void __exit
18333 i2c_keywest_cleanup(void)
18334 {
18335- while(ifaces)
18336- dispose_iface(ifaces);
18337+ macio_unregister_driver(&i2c_keywest_macio_driver);
18338+ of_unregister_driver(&i2c_keywest_of_platform_driver);
18339 }
18340
18341 module_init(i2c_keywest_init);
18342diff -Nru a/drivers/i2c/i2c-keywest.h b/drivers/i2c/i2c-keywest.h
18343--- a/drivers/i2c/i2c-keywest.h Fri Feb 15 14:32:09 2002
18344+++ b/drivers/i2c/i2c-keywest.h Sun Aug 24 06:10:14 2003
18345@@ -67,7 +67,6 @@
18346 int stopretry;
18347 struct timer_list timeout_timer;
18348 struct completion complete;
18349- struct keywest_iface* next;
18350 };
18351
18352 enum {
18353diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
18354--- a/drivers/ide/Kconfig Wed Aug 13 14:35:06 2003
18355+++ b/drivers/ide/Kconfig Sun Aug 24 06:08:48 2003
18356@@ -815,6 +815,17 @@
18357 most of the recent Apple Power Macintoshes and PowerBooks.
18358 If unsure, say Y.
18359
18360+config BLK_DEV_IDE_PMAC_ATA100FIRST
18361+ bool "Probe internal ATA/100 (Kauai) first"
18362+ depends on BLK_DEV_IDE_PMAC
18363+ help
18364+ This option will cause the ATA/100 controller found in UniNorth2
18365+ based machines (Windtunnel PowerMac, Aluminium PowerBooks, ...)
18366+ to be probed before the ATA/66 and ATA/33 controllers. Without
18367+ these, those machine used to have the hard disk on hdc and the
18368+ CD-ROM on hda. This option changes this to more natural hda for
18369+ hard disk and hdc for CD-ROM.
18370+
18371 config BLK_DEV_IDEDMA_PMAC
18372 bool "PowerMac IDE DMA support"
18373 depends on BLK_DEV_IDE_PMAC
18374diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
18375--- a/drivers/ide/ide-cd.c Wed Aug 20 09:01:03 2003
18376+++ b/drivers/ide/ide-cd.c Fri Aug 22 18:04:49 2003
18377@@ -794,16 +794,16 @@
18378 request or data protect error.*/
18379 ide_dump_status (drive, "command error", stat);
18380 do_end_request = 1;
18381- } else if ((err & ~ABRT_ERR) != 0) {
18382- /* Go to the default handler
18383- for other errors. */
18384- DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
18385- return 1;
18386 } else if (sense_key == MEDIUM_ERROR) {
18387 /* No point in re-trying a zillion times on a bad
18388 * sector... If we got here the error is not correctable */
18389 ide_dump_status (drive, "media error (bad sector)", stat);
18390 do_end_request = 1;
18391+ } else if ((err & ~ABRT_ERR) != 0) {
18392+ /* Go to the default handler
18393+ for other errors. */
18394+ DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
18395+ return 1;
18396 } else if ((++rq->errors > ERROR_MAX)) {
18397 /* We've racked up too many retries. Abort. */
18398 do_end_request = 1;
18399diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
18400--- a/drivers/ide/ide-io.c Thu Aug 7 02:25:24 2003
18401+++ b/drivers/ide/ide-io.c Sun Aug 24 15:33:30 2003
18402@@ -54,8 +54,6 @@
18403 #include <asm/io.h>
18404 #include <asm/bitops.h>
18405
18406-#include "ide_modes.h"
18407-
18408 #if (DISK_RECOVERY_TIME > 0)
18409
18410 #error So the User Has To Fix the Compilation And Stop Hacking Port 0x43. Does anyone ever use this anyway ??
18411diff -Nru a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
18412--- a/drivers/ide/ide-lib.c Thu Aug 7 02:25:25 2003
18413+++ b/drivers/ide/ide-lib.c Sun Aug 24 15:33:30 2003
18414@@ -22,8 +22,6 @@
18415 #include <asm/io.h>
18416 #include <asm/bitops.h>
18417
18418-#include "ide_modes.h"
18419-
18420 /*
18421 * IDE library routines. These are plug in code that most
18422 * drivers can use but occasionally may be weird enough
18423@@ -170,7 +168,7 @@
18424 BUG();
18425 return min(speed, speed_max[mode]);
18426 #else /* !CONFIG_BLK_DEV_IDEDMA */
18427- return min(speed, XFER_PIO_4);
18428+ return min(speed, (u8)XFER_PIO_4);
18429 #endif /* CONFIG_BLK_DEV_IDEDMA */
18430 }
18431
18432@@ -188,6 +186,12 @@
18433
18434 EXPORT_SYMBOL(ide_dma_enable);
18435
18436+/*
18437+ * Standard (generic) timings for PIO modes, from ATA2 specification.
18438+ * These timings are for access to the IDE data port register *only*.
18439+ * Some drives may specify a mode, while also specifying a different
18440+ * value for cycle_time (from drive identification data).
18441+ */
18442 const ide_pio_timings_t ide_pio_timings[6] = {
18443 { 70, 165, 600 }, /* PIO Mode 0 */
18444 { 50, 125, 383 }, /* PIO Mode 1 */
18445@@ -198,6 +202,13 @@
18446 };
18447
18448 EXPORT_SYMBOL_GPL(ide_pio_timings);
18449+
18450+/*
18451+ * Shared data/functions for determining best PIO mode for an IDE drive.
18452+ * Most of this stuff originally lived in cmd640.c, and changes to the
18453+ * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
18454+ * breaking the fragile cmd640.c support.
18455+ */
18456
18457 /*
18458 * Black list. Some drives incorrectly report their maximal PIO mode,
18459diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
18460--- a/drivers/ide/ide-probe.c Thu Aug 14 16:52:06 2003
18461+++ b/drivers/ide/ide-probe.c Sun Aug 24 15:46:28 2003
18462@@ -649,10 +649,13 @@
18463 /* register with global device tree */
18464 strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
18465 hwif->gendev.driver_data = hwif;
18466- if (hwif->pci_dev)
18467- hwif->gendev.parent = &hwif->pci_dev->dev;
18468- else
18469- hwif->gendev.parent = NULL; /* Would like to do = &device_legacy */
18470+ if (hwif->gendev.parent == NULL) {
18471+ if (hwif->pci_dev)
18472+ hwif->gendev.parent = &hwif->pci_dev->dev;
18473+ else
18474+ /* Would like to do = &device_legacy */
18475+ hwif->gendev.parent = NULL;
18476+ }
18477 device_register(&hwif->gendev);
18478 }
18479
18480@@ -770,8 +773,7 @@
18481 */
18482 for (unit = 0; unit < MAX_DRIVES; ++unit) {
18483 ide_drive_t *drive = &hwif->drives[unit];
18484- drive->dn = ((hwif->channel ? 2 : 0) + unit);
18485- hwif->drives[unit].dn = ((hwif->channel ? 2 : 0) + unit);
18486+ drive->dn = (hwif->channel ? 2 : 0) + unit;
18487 (void) probe_for_drive(drive);
18488 if (drive->present && !hwif->present) {
18489 hwif->present = 1;
18490@@ -945,15 +947,10 @@
18491 if (drive->disk)
18492 drive->disk->queue = drive->queue;
18493
18494- return 0;
18495-}
18496-
18497-/*
18498- * Setup the drive for request handling.
18499- */
18500-static void ide_init_drive(ide_drive_t *drive)
18501-{
18502+ /* needs drive->queue to be set */
18503 ide_toggle_bounce(drive, 1);
18504+
18505+ return 0;
18506 }
18507
18508 /*
18509@@ -1068,10 +1065,9 @@
18510 }
18511
18512 /*
18513- * Link any new drives into the hwgroup, allocate
18514- * the block device queue and initialize the drive.
18515- * Note that ide_init_drive sends commands to the new
18516- * drive.
18517+ * For any present drive:
18518+ * - allocate the block device queue
18519+ * - link drive into the hwgroup
18520 */
18521 for (index = 0; index < MAX_DRIVES; ++index) {
18522 ide_drive_t *drive = &hwif->drives[index];
18523@@ -1092,7 +1088,6 @@
18524 hwgroup->drive->next = drive;
18525 }
18526 spin_unlock_irq(&ide_lock);
18527- ide_init_drive(drive);
18528 }
18529
18530 #if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
18531@@ -1303,31 +1298,6 @@
18532
18533 EXPORT_SYMBOL(hwif_init);
18534
18535-int export_ide_init_queue (ide_drive_t *drive)
18536-{
18537- if (ide_init_queue(drive))
18538- return 1;
18539-
18540- ide_init_drive(drive);
18541- return 0;
18542-}
18543-
18544-EXPORT_SYMBOL(export_ide_init_queue);
18545-
18546-u8 export_probe_for_drive (ide_drive_t *drive)
18547-{
18548- return probe_for_drive(drive);
18549-}
18550-
18551-EXPORT_SYMBOL(export_probe_for_drive);
18552-
18553-int ideprobe_init (void);
18554-static ide_module_t ideprobe_module = {
18555- IDE_PROBE_MODULE,
18556- ideprobe_init,
18557- NULL
18558-};
18559-
18560 int ideprobe_init (void)
18561 {
18562 unsigned int index;
18563@@ -1359,7 +1329,7 @@
18564 }
18565 }
18566 if (!ide_probe)
18567- ide_probe = &ideprobe_module;
18568+ ide_probe = &ideprobe_init;
18569 MOD_DEC_USE_COUNT;
18570 return 0;
18571 }
18572diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
18573--- a/drivers/ide/ide-tape.c Wed Aug 20 14:21:56 2003
18574+++ b/drivers/ide/ide-tape.c Tue Aug 26 09:25:41 2003
18575@@ -4922,7 +4922,7 @@
18576 struct inode *inode = file->f_dentry->d_inode;
18577 ide_drive_t *drive = file->private_data;
18578 idetape_tape_t *tape = drive->driver_data;
18579- unsigned int minor = minor(inode->i_rdev);
18580+ unsigned int minor = iminor(inode);
18581 ssize_t retval, actually_written = 0;
18582 int position;
18583
18584@@ -5568,7 +5568,7 @@
18585 */
18586 static int idetape_chrdev_open (struct inode *inode, struct file *filp)
18587 {
18588- unsigned int minor = minor(inode->i_rdev), i = minor & ~0xc0;
18589+ unsigned int minor = iminor(inode), i = minor & ~0xc0;
18590 ide_drive_t *drive;
18591 idetape_tape_t *tape;
18592 idetape_pc_t pc;
18593@@ -5649,7 +5649,7 @@
18594 ide_drive_t *drive = filp->private_data;
18595 idetape_tape_t *tape;
18596 idetape_pc_t pc;
18597- unsigned int minor = minor(inode->i_rdev);
18598+ unsigned int minor = iminor(inode);
18599
18600 lock_kernel();
18601 tape = drive->driver_data;
18602diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
18603--- a/drivers/ide/ide.c Wed Aug 20 09:01:03 2003
18604+++ b/drivers/ide/ide.c Sun Aug 31 16:13:57 2003
18605@@ -161,8 +161,6 @@
18606 #include <asm/io.h>
18607 #include <asm/bitops.h>
18608
18609-#include "ide_modes.h"
18610-
18611
18612 /* default maximum number of failures */
18613 #define IDE_DEFAULT_MAX_FAILURES 1
18614@@ -180,7 +178,9 @@
18615 DECLARE_MUTEX(ide_cfg_sem);
18616 spinlock_t ide_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
18617
18618+#ifdef CONFIG_BLK_DEV_IDEPCI
18619 static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
18620+#endif
18621
18622 #ifdef CONFIG_IDEDMA_AUTO
18623 int noautodma = 0;
18624@@ -190,11 +190,7 @@
18625
18626 EXPORT_SYMBOL(noautodma);
18627
18628-/*
18629- * ide_modules keeps track of the available IDE chipset/probe/driver modules.
18630- */
18631-ide_module_t *ide_chipsets;
18632-ide_module_t *ide_probe;
18633+int (*ide_probe)(void);
18634
18635 /*
18636 * This is declared extern in ide.h, for access by other IDE modules:
18637@@ -452,7 +448,7 @@
18638 (void) request_module("ide-probe-mod");
18639 #endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */
18640 } else {
18641- (void) ide_probe->init();
18642+ (void)ide_probe();
18643 }
18644 }
18645
18646@@ -1046,21 +1042,6 @@
18647 EXPORT_SYMBOL(ide_register_hw);
18648
18649 /*
18650- * Compatibility function with existing drivers. If you want
18651- * something different, use the function above.
18652- */
18653-int ide_register (int arg1, int arg2, int irq)
18654-{
18655- hw_regs_t hw;
18656- ide_init_hwif_ports(&hw, (unsigned long) arg1, (unsigned long) arg2, NULL);
18657- hw.irq = irq;
18658- return ide_register_hw(&hw, NULL);
18659-}
18660-
18661-EXPORT_SYMBOL(ide_register);
18662-
18663-
18664-/*
18665 * Locks for IDE setting functionality
18666 */
18667
18668@@ -1658,11 +1639,15 @@
18669
18670 case HDIO_SCAN_HWIF:
18671 {
18672+ hw_regs_t hw;
18673 int args[3];
18674 if (!capable(CAP_SYS_RAWIO)) return -EACCES;
18675 if (copy_from_user(args, (void *)arg, 3 * sizeof(int)))
18676 return -EFAULT;
18677- if (ide_register(args[0], args[1], args[2]) == -1)
18678+ ide_init_hwif_ports(&hw, (unsigned long) args[0],
18679+ (unsigned long) args[1], NULL);
18680+ hw.irq = args[2];
18681+ if (ide_register_hw(&hw, NULL) == -1)
18682 return -EIO;
18683 return 0;
18684 }
18685@@ -1870,7 +1855,7 @@
18686 * registered. In most cases, only one device
18687 * will be present.
18688 * "hdx=scsi" : the return of the ide-scsi flag, this is useful for
18689- * allowwing ide-floppy, ide-tape, and ide-cdrom|writers
18690+ * allowing ide-floppy, ide-tape, and ide-cdrom|writers
18691 * to use ide-scsi emulation on a device specific option.
18692 * "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz,
18693 * where "xx" is between 20 and 66 inclusive,
18694diff -Nru a/drivers/ide/ide_modes.h b/drivers/ide/ide_modes.h
18695--- a/drivers/ide/ide_modes.h Mon Sep 16 05:54:57 2002
18696+++ /dev/null Wed Dec 31 16:00:00 1969
18697@@ -1,41 +0,0 @@
18698-/*
18699- * linux/drivers/ide/ide_modes.h
18700- *
18701- * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
18702- */
18703-
18704-#ifndef _IDE_MODES_H
18705-#define _IDE_MODES_H
18706-
18707-#include <linux/config.h>
18708-
18709-/*
18710- * Shared data/functions for determining best PIO mode for an IDE drive.
18711- * Most of this stuff originally lived in cmd640.c, and changes to the
18712- * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
18713- * breaking the fragile cmd640.c support.
18714- */
18715-
18716-/*
18717- * Standard (generic) timings for PIO modes, from ATA2 specification.
18718- * These timings are for access to the IDE data port register *only*.
18719- * Some drives may specify a mode, while also specifying a different
18720- * value for cycle_time (from drive identification data).
18721- */
18722-typedef struct ide_pio_timings_s {
18723- int setup_time; /* Address setup (ns) minimum */
18724- int active_time; /* Active pulse (ns) minimum */
18725- int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
18726-} ide_pio_timings_t;
18727-
18728-typedef struct ide_pio_data_s {
18729- u8 pio_mode;
18730- u8 use_iordy;
18731- u8 overridden;
18732- u8 blacklisted;
18733- unsigned int cycle_time;
18734-} ide_pio_data_t;
18735-
18736-u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
18737-extern const ide_pio_timings_t ide_pio_timings[6];
18738-#endif /* _IDE_MODES_H */
18739diff -Nru a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
18740--- a/drivers/ide/legacy/ali14xx.c Tue Aug 12 13:29:09 2003
18741+++ b/drivers/ide/legacy/ali14xx.c Sun Aug 24 15:33:30 2003
18742@@ -54,8 +54,6 @@
18743
18744 #include <asm/io.h>
18745
18746-#include "ide_modes.h"
18747-
18748 /* port addresses for auto-detection */
18749 #define ALI_NUM_PORTS 4
18750 static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4};
18751diff -Nru a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
18752--- a/drivers/ide/legacy/dtc2278.c Tue Aug 12 13:29:09 2003
18753+++ b/drivers/ide/legacy/dtc2278.c Sun Aug 24 15:33:30 2003
18754@@ -21,8 +21,6 @@
18755
18756 #include <asm/io.h>
18757
18758-#include "ide_modes.h"
18759-
18760 /*
18761 * Changing this #undef to #define may solve start up problems in some systems.
18762 */
18763diff -Nru a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
18764--- a/drivers/ide/legacy/ht6560b.c Tue Aug 12 13:29:09 2003
18765+++ b/drivers/ide/legacy/ht6560b.c Sun Aug 24 15:33:30 2003
18766@@ -53,8 +53,6 @@
18767
18768 #include <asm/io.h>
18769
18770-#include "ide_modes.h"
18771-
18772 /* #define DEBUG */ /* remove comments for DEBUG messages */
18773
18774 /*
18775diff -Nru a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
18776--- a/drivers/ide/legacy/macide.c Tue Feb 18 10:06:19 2003
18777+++ b/drivers/ide/legacy/macide.c Sun Aug 24 05:37:06 2003
18778@@ -126,7 +126,7 @@
18779 /* probing the drive which freezes a 190. */
18780
18781 ide_drive_t *drive = &ide_hwifs[index].drives[0];
18782- drive->capacity = drive->cyl*drive->head*drive->sect;
18783+ drive->capacity64 = drive->cyl*drive->head*drive->sect;
18784
18785 #ifdef CONFIG_BLK_DEV_MAC_MEDIABAY
18786 request_irq(IRQ_BABOON_2, macide_mediabay_interrupt,
18787diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
18788--- a/drivers/ide/legacy/qd65xx.c Tue Aug 12 13:29:09 2003
18789+++ b/drivers/ide/legacy/qd65xx.c Sun Aug 24 15:33:30 2003
18790@@ -42,7 +42,6 @@
18791 #include <asm/system.h>
18792 #include <asm/io.h>
18793
18794-#include "ide_modes.h"
18795 #include "qd65xx.h"
18796
18797 /*
18798diff -Nru a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
18799--- a/drivers/ide/legacy/umc8672.c Tue Aug 12 13:29:09 2003
18800+++ b/drivers/ide/legacy/umc8672.c Sun Aug 24 15:33:30 2003
18801@@ -54,8 +54,6 @@
18802
18803 #include <asm/io.h>
18804
18805-#include "ide_modes.h"
18806-
18807 /*
18808 * Default speeds. These can be changed with "auto-tune" and/or hdparm.
18809 */
18810diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
18811--- a/drivers/ide/pci/aec62xx.c Thu Jul 31 08:58:49 2003
18812+++ b/drivers/ide/pci/aec62xx.c Sun Aug 24 15:33:30 2003
18813@@ -16,7 +16,6 @@
18814
18815 #include <asm/io.h>
18816
18817-#include "ide_modes.h"
18818 #include "aec62xx.h"
18819
18820 #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
18821diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
18822--- a/drivers/ide/pci/alim15x3.c Sat Aug 16 06:34:25 2003
18823+++ b/drivers/ide/pci/alim15x3.c Sun Aug 24 15:33:30 2003
18824@@ -37,7 +37,6 @@
18825
18826 #include <asm/io.h>
18827
18828-#include "ide_modes.h"
18829 #include "alim15x3.h"
18830
18831 /*
18832diff -Nru a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
18833--- a/drivers/ide/pci/cmd640.c Thu Mar 13 16:49:44 2003
18834+++ b/drivers/ide/pci/cmd640.c Sun Aug 24 15:33:30 2003
18835@@ -115,8 +115,6 @@
18836
18837 #include <asm/io.h>
18838
18839-#include "ide_modes.h"
18840-
18841 /*
18842 * This flag is set in ide.c by the parameter: ide0=cmd640_vlb
18843 */
18844diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
18845--- a/drivers/ide/pci/cmd64x.c Thu Jul 31 08:58:49 2003
18846+++ b/drivers/ide/pci/cmd64x.c Sun Aug 24 15:33:30 2003
18847@@ -25,7 +25,6 @@
18848
18849 #include <asm/io.h>
18850
18851-#include "ide_modes.h"
18852 #include "cmd64x.h"
18853
18854 #if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
18855diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
18856--- a/drivers/ide/pci/cs5520.c Thu Jul 31 08:58:49 2003
18857+++ b/drivers/ide/pci/cs5520.c Sun Aug 24 15:33:30 2003
18858@@ -51,7 +51,6 @@
18859 #include <asm/io.h>
18860 #include <asm/irq.h>
18861
18862-#include "ide_modes.h"
18863 #include "cs5520.h"
18864
18865 #if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
18866diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
18867--- a/drivers/ide/pci/cs5530.c Thu Jul 31 08:58:49 2003
18868+++ b/drivers/ide/pci/cs5530.c Sun Aug 24 15:33:30 2003
18869@@ -31,7 +31,6 @@
18870 #include <asm/io.h>
18871 #include <asm/irq.h>
18872
18873-#include "ide_modes.h"
18874 #include "cs5530.h"
18875
18876 #if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
18877diff -Nru a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
18878--- a/drivers/ide/pci/cy82c693.c Thu Jul 31 08:58:49 2003
18879+++ b/drivers/ide/pci/cy82c693.c Sun Aug 24 15:33:30 2003
18880@@ -54,7 +54,6 @@
18881
18882 #include <asm/io.h>
18883
18884-#include "ide_modes.h"
18885 #include "cy82c693.h"
18886
18887 /*
18888@@ -113,7 +112,7 @@
18889
18890 /* note: we use the same values for 16bit IOR and IOW
18891 * those are all the same, since I don't have other
18892- * timings than those from ide_modes.h
18893+ * timings than those from ide-lib.c
18894 */
18895
18896 p_pclk->time_16r = (u8)clk1;
18897diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
18898--- a/drivers/ide/pci/hpt34x.c Thu Jul 31 08:58:49 2003
18899+++ b/drivers/ide/pci/hpt34x.c Sun Aug 24 15:33:30 2003
18900@@ -42,7 +42,6 @@
18901 #include <asm/io.h>
18902 #include <asm/irq.h>
18903
18904-#include "ide_modes.h"
18905 #include "hpt34x.h"
18906
18907 #if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS)
18908diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
18909--- a/drivers/ide/pci/hpt366.c Mon Aug 11 09:04:06 2003
18910+++ b/drivers/ide/pci/hpt366.c Sun Aug 24 15:33:30 2003
18911@@ -62,7 +62,6 @@
18912 #include <asm/io.h>
18913 #include <asm/irq.h>
18914
18915-#include "ide_modes.h"
18916 #include "hpt366.h"
18917
18918 #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
18919@@ -989,7 +988,40 @@
18920 hwif->intrproc = &hpt3xx_intrproc;
18921 hwif->maskproc = &hpt3xx_maskproc;
18922
18923- pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66);
18924+ /*
18925+ * The HPT37x uses the CBLID pins as outputs for MA15/MA16
18926+ * address lines to access an external eeprom. To read valid
18927+ * cable detect state the pins must be enabled as inputs.
18928+ */
18929+ if (hpt_minimum_revision(dev, 8) && PCI_FUNC(dev->devfn) & 1) {
18930+ /*
18931+ * HPT374 PCI function 1
18932+ * - set bit 15 of reg 0x52 to enable TCBLID as input
18933+ * - set bit 15 of reg 0x56 to enable FCBLID as input
18934+ */
18935+ u16 mcr3, mcr6;
18936+ pci_read_config_word(dev, 0x52, &mcr3);
18937+ pci_read_config_word(dev, 0x56, &mcr6);
18938+ pci_write_config_word(dev, 0x52, mcr3 | 0x8000);
18939+ pci_write_config_word(dev, 0x56, mcr6 | 0x8000);
18940+ /* now read cable id register */
18941+ pci_read_config_byte(dev, 0x5a, &ata66);
18942+ pci_write_config_word(dev, 0x52, mcr3);
18943+ pci_write_config_word(dev, 0x56, mcr6);
18944+ } else if (hpt_minimum_revision(dev, 3)) {
18945+ /*
18946+ * HPT370/372 and 374 pcifn 0
18947+ * - clear bit 0 of 0x5b to enable P/SCBLID as inputs
18948+ */
18949+ u8 scr2;
18950+ pci_read_config_byte(dev, 0x5b, &scr2);
18951+ pci_write_config_byte(dev, 0x5b, scr2 & ~1);
18952+ /* now read cable id register */
18953+ pci_read_config_byte(dev, 0x5a, &ata66);
18954+ pci_write_config_byte(dev, 0x5b, scr2);
18955+ } else {
18956+ pci_read_config_byte(dev, 0x5a, &ata66);
18957+ }
18958
18959 #ifdef DEBUG
18960 printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n",
18961diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
18962--- a/drivers/ide/pci/it8172.c Thu Jul 31 08:58:49 2003
18963+++ b/drivers/ide/pci/it8172.c Sun Aug 24 15:33:30 2003
18964@@ -42,7 +42,6 @@
18965 #include <asm/io.h>
18966 #include <asm/it8172/it8172_int.h>
18967
18968-#include "ide_modes.h"
18969 #include "it8172.h"
18970
18971 /*
18972diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
18973--- a/drivers/ide/pci/opti621.c Thu Jul 31 08:58:49 2003
18974+++ b/drivers/ide/pci/opti621.c Sun Aug 24 15:33:30 2003
18975@@ -104,7 +104,6 @@
18976
18977 #include <asm/io.h>
18978
18979-#include "ide_modes.h"
18980 #include "opti621.h"
18981
18982 #define OPTI621_MAX_PIO 3
18983diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
18984--- a/drivers/ide/pci/pdc202xx_new.c Thu Jul 31 08:58:49 2003
18985+++ b/drivers/ide/pci/pdc202xx_new.c Sun Aug 24 15:33:30 2003
18986@@ -32,7 +32,6 @@
18987 #include <asm/io.h>
18988 #include <asm/irq.h>
18989
18990-#include "ide_modes.h"
18991 #include "pdc202xx_new.h"
18992
18993 #define PDC202_DEBUG_CABLE 0
18994diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
18995--- a/drivers/ide/pci/pdc202xx_old.c Wed Aug 13 17:45:49 2003
18996+++ b/drivers/ide/pci/pdc202xx_old.c Sun Aug 24 15:33:30 2003
18997@@ -46,7 +46,6 @@
18998 #include <asm/io.h>
18999 #include <asm/irq.h>
19000
19001-#include "ide_modes.h"
19002 #include "pdc202xx_old.h"
19003
19004 #define PDC202_DEBUG_CABLE 0
19005diff -Nru a/drivers/ide/pci/pdcadma.c b/drivers/ide/pci/pdcadma.c
19006--- a/drivers/ide/pci/pdcadma.c Thu Jul 31 08:58:49 2003
19007+++ b/drivers/ide/pci/pdcadma.c Sun Aug 24 15:33:30 2003
19008@@ -24,7 +24,6 @@
19009 #include <asm/io.h>
19010 #include <asm/irq.h>
19011
19012-#include "ide_modes.h"
19013 #include "pdcadma.h"
19014
19015 #if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
19016diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
19017--- a/drivers/ide/pci/piix.c Thu Jul 31 08:58:49 2003
19018+++ b/drivers/ide/pci/piix.c Sun Aug 24 15:33:30 2003
19019@@ -103,7 +103,6 @@
19020
19021 #include <asm/io.h>
19022
19023-#include "ide_modes.h"
19024 #include "piix.h"
19025
19026 static int no_piix_dma;
19027diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
19028--- a/drivers/ide/pci/sc1200.c Thu Jul 31 08:58:49 2003
19029+++ b/drivers/ide/pci/sc1200.c Sun Aug 24 15:33:30 2003
19030@@ -29,7 +29,6 @@
19031 #include <asm/io.h>
19032 #include <asm/irq.h>
19033
19034-#include "ide_modes.h"
19035 #include "sc1200.h"
19036
19037 #define SC1200_REV_A 0x00
19038diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
19039--- a/drivers/ide/pci/serverworks.c Thu Jul 31 08:58:49 2003
19040+++ b/drivers/ide/pci/serverworks.c Sun Aug 24 15:33:30 2003
19041@@ -39,7 +39,6 @@
19042
19043 #include <asm/io.h>
19044
19045-#include "ide_modes.h"
19046 #include "serverworks.h"
19047
19048 static u8 svwks_revision = 0;
19049diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
19050--- a/drivers/ide/pci/siimage.c Wed Aug 13 17:45:20 2003
19051+++ b/drivers/ide/pci/siimage.c Sun Aug 24 15:33:30 2003
19052@@ -15,7 +15,6 @@
19053
19054 #include <asm/io.h>
19055
19056-#include "ide_modes.h"
19057 #include "siimage.h"
19058
19059 #if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
19060diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
19061--- a/drivers/ide/pci/sis5513.c Thu Jul 31 08:58:49 2003
19062+++ b/drivers/ide/pci/sis5513.c Sun Aug 24 15:33:30 2003
19063@@ -63,7 +63,6 @@
19064 #include <asm/irq.h>
19065
19066 #include "ide-timing.h"
19067-#include "ide_modes.h"
19068 #include "sis5513.h"
19069
19070 /* registers layout and init values are chipset family dependant */
19071diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
19072--- a/drivers/ide/pci/sl82c105.c Thu Jul 31 08:58:49 2003
19073+++ b/drivers/ide/pci/sl82c105.c Sun Aug 24 15:33:30 2003
19074@@ -29,7 +29,6 @@
19075 #include <asm/io.h>
19076 #include <asm/dma.h>
19077
19078-#include "ide_modes.h"
19079 #include "sl82c105.h"
19080
19081 #undef DEBUG
19082diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
19083--- a/drivers/ide/pci/slc90e66.c Thu Jul 31 08:58:49 2003
19084+++ b/drivers/ide/pci/slc90e66.c Sun Aug 24 15:33:30 2003
19085@@ -21,7 +21,6 @@
19086
19087 #include <asm/io.h>
19088
19089-#include "ide_modes.h"
19090 #include "slc90e66.h"
19091
19092 #if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
19093diff -Nru a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
19094--- a/drivers/ide/pci/triflex.c Sat Feb 22 15:52:14 2003
19095+++ b/drivers/ide/pci/triflex.c Sun Aug 24 15:33:30 2003
19096@@ -41,7 +41,6 @@
19097 #include <linux/ide.h>
19098 #include <linux/init.h>
19099
19100-#include "ide_modes.h"
19101 #include "triflex.h"
19102
19103 static struct pci_dev *triflex_dev;
19104diff -Nru a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
19105--- a/drivers/ide/ppc/mpc8xx.c Fri May 2 10:53:08 2003
19106+++ b/drivers/ide/ppc/mpc8xx.c Sun Aug 24 15:33:30 2003
19107@@ -42,7 +42,6 @@
19108 #include <asm/machdep.h>
19109 #include <asm/irq.h>
19110
19111-#include "ide_modes.h"
19112 static int identify (volatile u8 *p);
19113 static void print_fixed (volatile u8 *p);
19114 static void print_funcid (int func);
19115diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
19116--- a/drivers/ide/ppc/pmac.c Sat Aug 16 11:46:50 2003
19117+++ b/drivers/ide/ppc/pmac.c Sun Aug 31 14:09:16 2003
19118@@ -5,7 +5,7 @@
19119 * These IDE interfaces are memory-mapped and have a DBDMA channel
19120 * for doing DMA.
19121 *
19122- * Copyright (C) 1998-2001 Paul Mackerras & Ben. Herrenschmidt
19123+ * Copyright (C) 1998-2003 Paul Mackerras & Ben. Herrenschmidt
19124 *
19125 * This program is free software; you can redistribute it and/or
19126 * modify it under the terms of the GNU General Public License
19127@@ -16,6 +16,11 @@
19128 *
19129 * Copyright (c) 1995-1998 Mark Lord
19130 *
19131+ * TODO: - Use pre-calculated (kauai) timing tables all the time and
19132+ * get rid of the "rounded" tables used previously, so we have the
19133+ * same table format for all controllers and can then just have one
19134+ * big table
19135+ *
19136 */
19137 #include <linux/config.h>
19138 #include <linux/types.h>
19139@@ -27,6 +32,8 @@
19140 #include <linux/notifier.h>
19141 #include <linux/reboot.h>
19142 #include <linux/pci.h>
19143+#include <linux/adb.h>
19144+#include <linux/pmu.h>
19145
19146 #include <asm/prom.h>
19147 #include <asm/io.h>
19148@@ -38,26 +45,27 @@
19149 #include <asm/pmac_feature.h>
19150 #include <asm/sections.h>
19151 #include <asm/irq.h>
19152-#ifdef CONFIG_PMAC_PBOOK
19153-#include <linux/adb.h>
19154-#include <linux/pmu.h>
19155-#endif
19156-#include "ide_modes.h"
19157+
19158+#include "ide-timing.h"
19159
19160 extern void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq);
19161
19162 #define IDE_PMAC_DEBUG
19163
19164-#define DMA_WAIT_TIMEOUT 500
19165+#define DMA_WAIT_TIMEOUT 100
19166
19167 typedef struct pmac_ide_hwif {
19168 unsigned long regbase;
19169 int irq;
19170 int kind;
19171 int aapl_bus_id;
19172+ int cable_80 : 1;
19173+ int mediabay : 1;
19174+ int broken_dma : 1;
19175+ int broken_dma_warn : 1;
19176 struct device_node* node;
19177- u32 timings[2];
19178- int index;
19179+ struct macio_dev *mdev;
19180+ u32 timings[4];
19181 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
19182 /* Those fields are duplicating what is in hwif. We currently
19183 * can't use the hwif ones because of some assumptions that are
19184@@ -82,7 +90,15 @@
19185 controller_heathrow, /* Heathrow/Paddington */
19186 controller_kl_ata3, /* KeyLargo ATA-3 */
19187 controller_kl_ata4, /* KeyLargo ATA-4 */
19188- controller_kl_ata4_80 /* KeyLargo ATA-4 with 80 conductor cable */
19189+ controller_un_ata6 /* UniNorth2 ATA-6 */
19190+};
19191+
19192+static const char* model_name[] = {
19193+ "OHare ATA", /* OHare based */
19194+ "Heathrow ATA", /* Heathrow/Paddington */
19195+ "KeyLargo ATA-3", /* KeyLargo ATA-3 */
19196+ "KeyLargo ATA-4", /* KeyLargo ATA-4 */
19197+ "UniNorth ATA-6" /* UniNorth2 ATA-6 */
19198 };
19199
19200 /*
19201@@ -91,6 +107,11 @@
19202 #define IDE_TIMING_CONFIG 0x200
19203 #define IDE_INTERRUPT 0x300
19204
19205+/* Kauai (U2) ATA has different register setup */
19206+#define IDE_KAUAI_PIO_CONFIG 0x200
19207+#define IDE_KAUAI_ULTRA_CONFIG 0x210
19208+#define IDE_KAUAI_POLL_CONFIG 0x220
19209+
19210 /*
19211 * Timing configuration register definitions
19212 */
19213@@ -101,6 +122,28 @@
19214 #define IDE_SYSCLK_NS 30 /* 33Mhz cell */
19215 #define IDE_SYSCLK_66_NS 15 /* 66Mhz cell */
19216
19217+/* 100Mhz cell, found in Uninorth 2. I don't have much infos about
19218+ * this one yet, it appears as a pci device (106b/0033) on uninorth
19219+ * internal PCI bus and it's clock is controlled like gem or fw. It
19220+ * appears to be an evolution of keylargo ATA4 with a timing register
19221+ * extended to 2 32bits registers and a similar DBDMA channel. Other
19222+ * registers seem to exist but I can't tell much about them.
19223+ *
19224+ * So far, I'm using pre-calculated tables for this extracted from
19225+ * the values used by the MacOS X driver.
19226+ *
19227+ * The "PIO" register controls PIO and MDMA timings, the "ULTRA"
19228+ * register controls the UDMA timings. At least, it seems bit 0
19229+ * of this one enables UDMA vs. MDMA, and bits 4..7 are the
19230+ * cycle time in units of 10ns. Bits 8..15 are used by I don't
19231+ * know their meaning yet
19232+ */
19233+#define TR_100_PIOREG_PIO_MASK 0xff000fff
19234+#define TR_100_PIOREG_MDMA_MASK 0x00fff000
19235+#define TR_100_UDMAREG_UDMA_MASK 0x0000ffff
19236+#define TR_100_UDMAREG_UDMA_EN 0x00000001
19237+
19238+
19239 /* 66Mhz cell, found in KeyLargo. Can do ultra mode 0 to 2 on
19240 * 40 connector cable and to 4 on 80 connector one.
19241 * Clock unit is 15ns (66Mhz)
19242@@ -115,8 +158,7 @@
19243 * well, despite a comment that would lead to think it has a
19244 * min value of 45ns.
19245 * Apple also add 60ns to the write data setup (or cycle time ?) on
19246- * reads. I can't explain that, I tried it and it broke everything
19247- * here.
19248+ * reads.
19249 */
19250 #define TR_66_UDMA_MASK 0xfff00000
19251 #define TR_66_UDMA_EN 0x00100000 /* Enable Ultra mode for DMA */
19252@@ -220,12 +262,12 @@
19253 { 0, 0, 0 }
19254 };
19255
19256-/* Ultra DMA timings (rounded) */
19257+/* KeyLargo ATA-4 Ultra DMA timings (rounded) */
19258 struct {
19259 int addrSetup; /* ??? */
19260 int rdy2pause;
19261 int wrDataSetup;
19262-} udma_timings[] __pmacdata =
19263+} kl66_udma_timings[] __pmacdata =
19264 {
19265 { 0, 180, 120 }, /* Mode 0 */
19266 { 0, 150, 90 }, /* 1 */
19267@@ -234,6 +276,63 @@
19268 { 0, 90, 30 } /* 4 */
19269 };
19270
19271+/* UniNorth 2 ATA/100 timings */
19272+struct kauai_timing {
19273+ int cycle_time;
19274+ u32 timing_reg;
19275+};
19276+
19277+static struct kauai_timing kauai_pio_timings[] __pmacdata =
19278+{
19279+ { 930 , 0x08000fff },
19280+ { 600 , 0x08000a92 },
19281+ { 383 , 0x0800060f },
19282+ { 360 , 0x08000492 },
19283+ { 330 , 0x0800048f },
19284+ { 300 , 0x080003cf },
19285+ { 270 , 0x080003cc },
19286+ { 240 , 0x0800038b },
19287+ { 239 , 0x0800030c },
19288+ { 180 , 0x05000249 },
19289+ { 120 , 0x04000148 }
19290+};
19291+
19292+static struct kauai_timing kauai_mdma_timings[] __pmacdata =
19293+{
19294+ { 1260 , 0x00fff000 },
19295+ { 480 , 0x00618000 },
19296+ { 360 , 0x00492000 },
19297+ { 270 , 0x0038e000 },
19298+ { 240 , 0x0030c000 },
19299+ { 210 , 0x002cb000 },
19300+ { 180 , 0x00249000 },
19301+ { 150 , 0x00209000 },
19302+ { 120 , 0x00148000 },
19303+ { 0 , 0 },
19304+};
19305+
19306+static struct kauai_timing kauai_udma_timings[] __pmacdata =
19307+{
19308+ { 120 , 0x000070c0 },
19309+ { 90 , 0x00005d80 },
19310+ { 60 , 0x00004a60 },
19311+ { 45 , 0x00003a50 },
19312+ { 30 , 0x00002a30 },
19313+ { 20 , 0x00002921 },
19314+ { 0 , 0 },
19315+};
19316+
19317+static inline u32
19318+kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
19319+{
19320+ int i;
19321+
19322+ for (i=0; table[i].cycle_time; i++)
19323+ if (cycle_time > table[i+1].cycle_time)
19324+ return table[i].timing_reg;
19325+ return 0;
19326+}
19327+
19328 /* allow up to 256 DBDMA commands per xfer */
19329 #define MAX_DCMDS 256
19330
19331@@ -242,24 +341,106 @@
19332 * NOTE: There is at least one case I know of a disk that needs about 10sec
19333 * before anwering on the bus. I beleive we could add a kernel command
19334 * line arg to override this delay for such cases.
19335+ *
19336+ * NOTE2: This has to be fixed with a BSY wait loop. I'm working on adding
19337+ * that to the generic probe code.
19338 */
19339 #define IDE_WAKEUP_DELAY_MS 2000
19340
19341-static void pmac_ide_setup_dma(struct device_node *np, int ix);
19342-static int pmac_ide_build_dmatable(ide_drive_t *drive, int wr);
19343+static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif);
19344+static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq);
19345 static int pmac_ide_tune_chipset(ide_drive_t *drive, u8 speed);
19346 static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio);
19347 static void pmac_ide_selectproc(ide_drive_t *drive);
19348+static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
19349 static int pmac_ide_dma_begin (ide_drive_t *drive);
19350
19351 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
19352
19353-#ifdef CONFIG_PMAC_PBOOK
19354-static int idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when);
19355-struct pmu_sleep_notifier idepmac_sleep_notifier = {
19356- idepmac_notify_sleep, SLEEP_LEVEL_BLOCK,
19357-};
19358-#endif /* CONFIG_PMAC_PBOOK */
19359+#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
19360+
19361+/* Set to 50ms */
19362+#define PMU_HD_BLINK_TIME (HZ/50)
19363+
19364+static struct adb_request pmu_blink_on, pmu_blink_off;
19365+static spinlock_t pmu_blink_lock;
19366+static unsigned long pmu_blink_stoptime;
19367+static int pmu_blink_ledstate;
19368+static struct timer_list pmu_blink_timer;
19369+static int pmu_ide_blink_enabled;
19370+
19371+
19372+static void
19373+pmu_hd_blink_timeout(unsigned long data)
19374+{
19375+ unsigned long flags;
19376+
19377+ spin_lock_irqsave(&pmu_blink_lock, flags);
19378+
19379+ /* We may have been triggered again in a racy way, check
19380+ * that we really want to switch it off
19381+ */
19382+ if (time_after(pmu_blink_stoptime, jiffies))
19383+ goto done;
19384+
19385+ /* Previous req. not complete, try 100ms more */
19386+ if (pmu_blink_off.complete == 0)
19387+ mod_timer(&pmu_blink_timer, jiffies + PMU_HD_BLINK_TIME);
19388+ else if (pmu_blink_ledstate) {
19389+ pmu_request(&pmu_blink_off, NULL, 4, 0xee, 4, 0, 0);
19390+ pmu_blink_ledstate = 0;
19391+ }
19392+done:
19393+ spin_unlock_irqrestore(&pmu_blink_lock, flags);
19394+}
19395+
19396+static void
19397+pmu_hd_kick_blink(void *data, int rw)
19398+{
19399+ unsigned long flags;
19400+
19401+ pmu_blink_stoptime = jiffies + PMU_HD_BLINK_TIME;
19402+ wmb();
19403+ mod_timer(&pmu_blink_timer, pmu_blink_stoptime);
19404+ if (pmu_blink_ledstate == 1)
19405+ return;
19406+ spin_lock_irqsave(&pmu_blink_lock, flags);
19407+ if (pmu_blink_on.complete && !pmu_blink_ledstate) {
19408+ pmu_request(&pmu_blink_on, NULL, 4, 0xee, 4, 0, 1);
19409+ pmu_blink_ledstate = 1;
19410+ }
19411+ spin_unlock_irqrestore(&pmu_blink_lock, flags);
19412+}
19413+
19414+static int
19415+pmu_hd_blink_init(void)
19416+{
19417+ struct device_node *dt;
19418+ const char *model;
19419+
19420+ if (pmu_get_model() != PMU_KEYLARGO_BASED)
19421+ return 0;
19422+
19423+ dt = find_devices("device-tree");
19424+ if (dt == NULL)
19425+ return 0;
19426+ model = (const char *)get_property(dt, "model", NULL);
19427+ if (model == NULL)
19428+ return 0;
19429+ if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
19430+ strncmp(model, "iBook", strlen("iBook")) != 0)
19431+ return 0;
19432+
19433+ pmu_blink_on.complete = 1;
19434+ pmu_blink_off.complete = 1;
19435+ spin_lock_init(&pmu_blink_lock);
19436+ init_timer(&pmu_blink_timer);
19437+ pmu_blink_timer.function = pmu_hd_blink_timeout;
19438+
19439+ return 1;
19440+}
19441+
19442+#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */
19443
19444 /*
19445 * N.B. this can't be an initfunc, because the media-bay task can
19446@@ -315,6 +496,41 @@
19447 (void)readl((unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
19448 }
19449
19450+static void __pmac
19451+pmac_ide_kauai_selectproc(ide_drive_t *drive)
19452+{
19453+ pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
19454+
19455+ if (pmif == NULL)
19456+ return;
19457+
19458+ if (drive->select.b.unit & 0x01) {
19459+ writel(pmif->timings[1],
19460+ (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
19461+ writel(pmif->timings[3],
19462+ (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG));
19463+ } else {
19464+ writel(pmif->timings[0],
19465+ (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
19466+ writel(pmif->timings[2],
19467+ (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG));
19468+ }
19469+ (void)readl((unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
19470+}
19471+
19472+static void __pmac
19473+pmac_ide_do_update_timings(ide_drive_t *drive)
19474+{
19475+ pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
19476+
19477+ if (pmif == NULL)
19478+ return;
19479+
19480+ if (pmif->kind == controller_un_ata6)
19481+ pmac_ide_kauai_selectproc(drive);
19482+ else
19483+ pmac_ide_selectproc(drive);
19484+}
19485
19486 static int __pmac
19487 pmac_ide_do_setfeature(ide_drive_t *drive, u8 command)
19488@@ -322,7 +538,7 @@
19489 ide_hwif_t *hwif = HWIF(drive);
19490 int result = 1;
19491
19492- disable_irq(hwif->irq); /* disable_irq_nosync ?? */
19493+ disable_irq_nosync(hwif->irq);
19494 udelay(1);
19495 SELECT_DRIVE(drive);
19496 SELECT_MASK(drive, 0);
19497@@ -332,22 +548,22 @@
19498 /* Timeout bumped for some powerbooks */
19499 if (wait_for_ready(drive, 2000)) {
19500 /* Timeout bumped for some powerbooks */
19501- printk(KERN_ERR "pmac_ide_do_setfeature disk not ready "
19502- "before SET_FEATURE!\n");
19503+ printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready "
19504+ "before SET_FEATURE!\n", drive->name);
19505 goto out;
19506 }
19507 udelay(10);
19508 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
19509 hwif->OUTB(command, IDE_NSECTOR_REG);
19510 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
19511- hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG);
19512+ hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
19513 udelay(1);
19514 /* Timeout bumped for some powerbooks */
19515 result = wait_for_ready(drive, 2000);
19516 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
19517 if (result)
19518- printk(KERN_ERR "pmac_ide_do_setfeature disk not ready "
19519- "after SET_FEATURE !\n");
19520+ printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready "
19521+ "after SET_FEATURE !\n", drive->name);
19522 out:
19523 SELECT_MASK(drive, 0);
19524 if (result == 0) {
19525@@ -403,21 +619,27 @@
19526 if (pmif == NULL)
19527 return;
19528
19529+ /* which drive is it ? */
19530+ timings = &pmif->timings[drive->select.b.unit & 0x01];
19531+
19532 pio = ide_get_best_pio_mode(drive, pio, 4, &d);
19533- accessTicks = SYSCLK_TICKS(ide_pio_timings[pio].active_time);
19534- if (drive->select.b.unit & 0x01)
19535- timings = &pmif->timings[1];
19536- else
19537- timings = &pmif->timings[0];
19538
19539- recTime = d.cycle_time - ide_pio_timings[pio].active_time
19540- - ide_pio_timings[pio].setup_time;
19541- recTime = max(recTime, 150U);
19542- accessTime = ide_pio_timings[pio].active_time;
19543- accessTime = max(accessTime, 150U);
19544- if (pmif->kind == controller_kl_ata4 ||
19545- pmif->kind == controller_kl_ata4_80) {
19546+ switch (pmif->kind) {
19547+ case controller_un_ata6: {
19548+ /* 100Mhz cell */
19549+ u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time);
19550+ if (tr == 0)
19551+ return;
19552+ *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr;
19553+ break;
19554+ }
19555+ case controller_kl_ata4:
19556 /* 66Mhz cell */
19557+ recTime = d.cycle_time - ide_pio_timings[pio].active_time
19558+ - ide_pio_timings[pio].setup_time;
19559+ recTime = max(recTime, 150U);
19560+ accessTime = ide_pio_timings[pio].active_time;
19561+ accessTime = max(accessTime, 150U);
19562 accessTicks = SYSCLK_TICKS_66(accessTime);
19563 accessTicks = min(accessTicks, 0x1fU);
19564 recTicks = SYSCLK_TICKS_66(recTime);
19565@@ -425,9 +647,15 @@
19566 *timings = ((*timings) & ~TR_66_PIO_MASK) |
19567 (accessTicks << TR_66_PIO_ACCESS_SHIFT) |
19568 (recTicks << TR_66_PIO_RECOVERY_SHIFT);
19569- } else {
19570+ break;
19571+ default: {
19572 /* 33Mhz cell */
19573 int ebit = 0;
19574+ recTime = d.cycle_time - ide_pio_timings[pio].active_time
19575+ - ide_pio_timings[pio].setup_time;
19576+ recTime = max(recTime, 150U);
19577+ accessTime = ide_pio_timings[pio].active_time;
19578+ accessTime = max(accessTime, 150U);
19579 accessTicks = SYSCLK_TICKS(accessTime);
19580 accessTicks = min(accessTicks, 0x1fU);
19581 accessTicks = max(accessTicks, 4U);
19582@@ -443,26 +671,31 @@
19583 (recTicks << TR_33_PIO_RECOVERY_SHIFT);
19584 if (ebit)
19585 *timings |= TR_33_PIO_E;
19586+ break;
19587+ }
19588 }
19589
19590 #ifdef IDE_PMAC_DEBUG
19591- printk(KERN_ERR "ide_pmac: Set PIO timing for mode %d, reg: 0x%08x\n",
19592- pio, *timings);
19593+ printk(KERN_ERR "%s: Set PIO timing for mode %d, reg: 0x%08x\n",
19594+ drive->name, pio, *timings);
19595 #endif
19596
19597 if (drive->select.all == HWIF(drive)->INB(IDE_SELECT_REG))
19598- pmac_ide_selectproc(drive);
19599+ pmac_ide_do_update_timings(drive);
19600 }
19601
19602 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
19603 static int __pmac
19604-set_timings_udma(u32 *timings, u8 speed)
19605+set_timings_udma_ata4(u32 *timings, u8 speed)
19606 {
19607 unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks;
19608
19609- rdyToPauseTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].rdy2pause);
19610- wrDataSetupTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].wrDataSetup);
19611- addrTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].addrSetup);
19612+ if (speed > XFER_UDMA_4)
19613+ return 1;
19614+
19615+ rdyToPauseTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].rdy2pause);
19616+ wrDataSetupTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].wrDataSetup);
19617+ addrTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].addrSetup);
19618
19619 *timings = ((*timings) & ~(TR_66_UDMA_MASK | TR_66_MDMA_MASK)) |
19620 (wrDataSetupTicks << TR_66_UDMA_WRDATASETUP_SHIFT) |
19621@@ -478,11 +711,29 @@
19622 }
19623
19624 static int __pmac
19625-set_timings_mdma(int intf_type, u32 *timings, u8 speed, int drive_cycle_time)
19626+set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed)
19627+{
19628+ struct ide_timing *t = ide_timing_find_mode(speed);
19629+ u32 tr;
19630+
19631+ if (speed > XFER_UDMA_5 || t == NULL)
19632+ return 1;
19633+ tr = kauai_lookup_timing(kauai_udma_timings, (int)t->udma);
19634+ if (tr == 0)
19635+ return 1;
19636+ *ultra_timings = ((*ultra_timings) & ~TR_100_UDMAREG_UDMA_MASK) | tr;
19637+ *ultra_timings = (*ultra_timings) | TR_100_UDMAREG_UDMA_EN;
19638+
19639+ return 0;
19640+}
19641+
19642+static int __pmac
19643+set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
19644+ u8 speed, int drive_cycle_time)
19645 {
19646 int cycleTime, accessTime, recTime;
19647 unsigned accessTicks, recTicks;
19648- struct mdma_timings_t* tm;
19649+ struct mdma_timings_t* tm = NULL;
19650 int i;
19651
19652 /* Get default cycle time for mode */
19653@@ -491,7 +742,7 @@
19654 case 1: cycleTime = 150; break;
19655 case 2: cycleTime = 120; break;
19656 default:
19657- return -1;
19658+ return 1;
19659 }
19660 /* Adjust for drive */
19661 if (drive_cycle_time && drive_cycle_time > cycleTime)
19662@@ -501,8 +752,9 @@
19663 cycleTime = 150;
19664 /* Get the proper timing array for this controller */
19665 switch(intf_type) {
19666+ case controller_un_ata6:
19667+ break;
19668 case controller_kl_ata4:
19669- case controller_kl_ata4_80:
19670 tm = mdma_timings_66;
19671 break;
19672 case controller_kl_ata3:
19673@@ -512,24 +764,36 @@
19674 tm = mdma_timings_33;
19675 break;
19676 }
19677- /* Lookup matching access & recovery times */
19678- i = -1;
19679- for (;;) {
19680- if (tm[i+1].cycleTime < cycleTime)
19681- break;
19682- i++;
19683- }
19684- if (i < 0)
19685- return -1;
19686- cycleTime = tm[i].cycleTime;
19687- accessTime = tm[i].accessTime;
19688- recTime = tm[i].recoveryTime;
19689+ if (tm != NULL) {
19690+ /* Lookup matching access & recovery times */
19691+ i = -1;
19692+ for (;;) {
19693+ if (tm[i+1].cycleTime < cycleTime)
19694+ break;
19695+ i++;
19696+ }
19697+ if (i < 0)
19698+ return 1;
19699+ cycleTime = tm[i].cycleTime;
19700+ accessTime = tm[i].accessTime;
19701+ recTime = tm[i].recoveryTime;
19702
19703 #ifdef IDE_PMAC_DEBUG
19704- printk(KERN_ERR "ide_pmac: MDMA, cycleTime: %d, accessTime: %d, recTime: %d\n",
19705- cycleTime, accessTime, recTime);
19706-#endif
19707- if (intf_type == controller_kl_ata4 || intf_type == controller_kl_ata4_80) {
19708+ printk(KERN_ERR "%s: MDMA, cycleTime: %d, accessTime: %d, recTime: %d\n",
19709+ drive->name, cycleTime, accessTime, recTime);
19710+#endif
19711+ }
19712+ switch(intf_type) {
19713+ case controller_un_ata6: {
19714+ /* 100Mhz cell */
19715+ u32 tr = kauai_lookup_timing(kauai_mdma_timings, cycleTime);
19716+ if (tr == 0)
19717+ return 1;
19718+ *timings = ((*timings) & ~TR_100_PIOREG_MDMA_MASK) | tr;
19719+ *timings2 = (*timings2) & ~TR_100_UDMAREG_UDMA_EN;
19720+ }
19721+ break;
19722+ case controller_kl_ata4:
19723 /* 66Mhz cell */
19724 accessTicks = SYSCLK_TICKS_66(accessTime);
19725 accessTicks = min(accessTicks, 0x1fU);
19726@@ -541,7 +805,8 @@
19727 *timings = ((*timings) & ~(TR_66_MDMA_MASK | TR_66_UDMA_MASK)) |
19728 (accessTicks << TR_66_MDMA_ACCESS_SHIFT) |
19729 (recTicks << TR_66_MDMA_RECOVERY_SHIFT);
19730- } else if (intf_type == controller_kl_ata3) {
19731+ break;
19732+ case controller_kl_ata3:
19733 /* 33Mhz cell on KeyLargo */
19734 accessTicks = SYSCLK_TICKS(accessTime);
19735 accessTicks = max(accessTicks, 1U);
19736@@ -553,7 +818,8 @@
19737 *timings = ((*timings) & ~TR_33_MDMA_MASK) |
19738 (accessTicks << TR_33_MDMA_ACCESS_SHIFT) |
19739 (recTicks << TR_33_MDMA_RECOVERY_SHIFT);
19740- } else {
19741+ break;
19742+ default: {
19743 /* 33Mhz cell on others */
19744 int halfTick = 0;
19745 int origAccessTime = accessTime;
19746@@ -578,10 +844,11 @@
19747 (recTicks << TR_33_MDMA_RECOVERY_SHIFT);
19748 if (halfTick)
19749 *timings |= TR_33_MDMA_HALFTICK;
19750+ }
19751 }
19752 #ifdef IDE_PMAC_DEBUG
19753- printk(KERN_ERR "ide_pmac: Set MDMA timing for mode %d, reg: 0x%08x\n",
19754- speed & 0xf, *timings);
19755+ printk(KERN_ERR "%s: Set MDMA timing for mode %d, reg: 0x%08x\n",
19756+ drive->name, speed & 0xf, *timings);
19757 #endif
19758 return 0;
19759 }
19760@@ -591,36 +858,42 @@
19761 * our, normal mdma function is supposed to be more precise
19762 */
19763 static int __pmac
19764-pmac_ide_tune_chipset (ide_drive_t *drive, u8 speed)
19765+pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
19766 {
19767 int unit = (drive->select.b.unit & 0x01);
19768 int ret = 0;
19769 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
19770- u32 *timings;
19771-
19772+ u32 *timings, *timings2;
19773+
19774 if (pmif == NULL)
19775 return 1;
19776-
19777+
19778 timings = &pmif->timings[unit];
19779+ timings2 = &pmif->timings[unit+2];
19780
19781 switch(speed) {
19782 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
19783+ case XFER_UDMA_5:
19784+ if (pmif->kind != controller_un_ata6)
19785+ return 1;
19786 case XFER_UDMA_4:
19787 case XFER_UDMA_3:
19788- if (pmif->kind != controller_kl_ata4_80)
19789+ if (HWIF(drive)->udma_four == 0)
19790 return 1;
19791 case XFER_UDMA_2:
19792 case XFER_UDMA_1:
19793 case XFER_UDMA_0:
19794- if (pmif->kind != controller_kl_ata4 &&
19795- pmif->kind != controller_kl_ata4_80)
19796- return 1;
19797- ret = set_timings_udma(timings, speed);
19798+ if (pmif->kind == controller_kl_ata4)
19799+ ret = set_timings_udma_ata4(timings, speed);
19800+ else if (pmif->kind == controller_un_ata6)
19801+ ret = set_timings_udma_ata6(timings, timings2, speed);
19802+ else
19803+ ret = 1;
19804 break;
19805 case XFER_MW_DMA_2:
19806 case XFER_MW_DMA_1:
19807 case XFER_MW_DMA_0:
19808- ret = set_timings_mdma(pmif->kind, timings, speed, 0);
19809+ ret = set_timings_mdma(drive, pmif->kind, timings, timings2, speed, 0);
19810 break;
19811 case XFER_SW_DMA_2:
19812 case XFER_SW_DMA_1:
19813@@ -644,7 +917,7 @@
19814 if (ret)
19815 return ret;
19816
19817- pmac_ide_selectproc(drive);
19818+ pmac_ide_do_update_timings(drive);
19819 drive->current_speed = speed;
19820
19821 return 0;
19822@@ -653,11 +926,14 @@
19823 static void __pmac
19824 sanitize_timings(pmac_ide_hwif_t *pmif)
19825 {
19826- unsigned value;
19827+ unsigned int value, value2 = 0;
19828
19829 switch(pmif->kind) {
19830+ case controller_un_ata6:
19831+ value = 0x08618a92;
19832+ value2 = 0x00002921;
19833+ break;
19834 case controller_kl_ata4:
19835- case controller_kl_ata4_80:
19836 value = 0x0008438c;
19837 break;
19838 case controller_kl_ata3:
19839@@ -670,6 +946,7 @@
19840 break;
19841 }
19842 pmif->timings[0] = pmif->timings[1] = value;
19843+ pmif->timings[2] = pmif->timings[3] = value2;
19844 }
19845
19846 unsigned long __pmac
19847@@ -724,214 +1001,474 @@
19848 return 0;
19849 }
19850
19851-void __init
19852-pmac_ide_probe(void)
19853+/* Suspend call back, should be called after the child devices
19854+ * have actually been suspended
19855+ */
19856+static int
19857+pmac_ide_do_suspend(ide_hwif_t *hwif)
19858 {
19859- struct device_node *np;
19860- int i;
19861- struct device_node *atas;
19862- struct device_node *p, **pp, *removables, **rp;
19863- unsigned long base;
19864- int irq, big_delay;
19865- ide_hwif_t *hwif;
19866+ pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
19867+
19868+ /* We clear the timings */
19869+ pmif->timings[0] = 0;
19870+ pmif->timings[1] = 0;
19871+
19872+#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
19873+ /* Note: This code will be called for every hwif, thus we'll
19874+ * try several time to stop the LED blinker timer, but that
19875+ * should be harmless
19876+ */
19877+ if (pmu_ide_blink_enabled) {
19878+ unsigned long flags;
19879
19880- if (_machine != _MACH_Pmac)
19881- return;
19882- pp = &atas;
19883- rp = &removables;
19884- p = find_devices("ATA");
19885- if (p == NULL)
19886- p = find_devices("IDE");
19887- if (p == NULL)
19888- p = find_type_devices("ide");
19889- if (p == NULL)
19890- p = find_type_devices("ata");
19891- /* Move removable devices such as the media-bay CDROM
19892- on the PB3400 to the end of the list. */
19893- for (; p != NULL; p = p->next) {
19894- if (p->parent && p->parent->type
19895- && strcasecmp(p->parent->type, "media-bay") == 0) {
19896- *rp = p;
19897- rp = &p->next;
19898- } else {
19899- *pp = p;
19900- pp = &p->next;
19901- }
19902+ /* Make sure we don't hit the PMU blink */
19903+ spin_lock_irqsave(&pmu_blink_lock, flags);
19904+ if (pmu_blink_ledstate)
19905+ del_timer(&pmu_blink_timer);
19906+ pmu_blink_ledstate = 0;
19907+ spin_unlock_irqrestore(&pmu_blink_lock, flags);
19908 }
19909- *rp = NULL;
19910- *pp = removables;
19911- big_delay = 0;
19912-
19913- for (i = 0, np = atas; i < MAX_HWIFS && np != NULL; np = np->next) {
19914- struct device_node *tp;
19915- struct pmac_ide_hwif* pmif;
19916- int *bidp;
19917- int in_bay = 0;
19918- u8 pbus, pid;
19919- struct pci_dev *pdev = NULL;
19920-
19921- /*
19922- * If this node is not under a mac-io or dbdma node,
19923- * leave it to the generic PCI driver.
19924- */
19925- for (tp = np->parent; tp != 0; tp = tp->parent)
19926- if (tp->type && (strcmp(tp->type, "mac-io") == 0
19927- || strcmp(tp->type, "dbdma") == 0))
19928- break;
19929- if (tp == 0)
19930- continue;
19931+#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */
19932
19933- if (np->n_addrs == 0) {
19934- printk(KERN_WARNING "ide: no address for device %s\n",
19935- np->full_name);
19936- continue;
19937- }
19938+ /* The media bay will handle itself just fine */
19939+ if (pmif->mediabay)
19940+ return 0;
19941+
19942+ /* Disable the bus */
19943+ ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 0);
19944
19945- /* We need to find the pci_dev of the mac-io holding the
19946- * IDE interface
19947- */
19948- if (pci_device_from_OF_node(tp, &pbus, &pid) == 0)
19949- pdev = pci_find_slot(pbus, pid);
19950- if (pdev == NULL)
19951- printk(KERN_WARNING "ide: no PCI host for device %s, DMA disabled\n",
19952- np->full_name);
19953+ return 0;
19954+}
19955
19956- /*
19957- * If this slot is taken (e.g. by ide-pci.c) try the next one.
19958- */
19959- while (i < MAX_HWIFS
19960- && ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0)
19961- ++i;
19962- if (i >= MAX_HWIFS)
19963- break;
19964- pmif = &pmac_ide[i];
19965+/* Resume call back, should be called before the child devices
19966+ * are resumed
19967+ */
19968+static int
19969+pmac_ide_do_resume(ide_hwif_t *hwif)
19970+{
19971+ pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
19972+
19973+ /* Hard reset & re-enable controller (do we really need to reset ? -BenH) */
19974+ if (!pmif->mediabay) {
19975+ ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 1);
19976+ ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 1);
19977+ mdelay(10);
19978+ ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 0);
19979+ mdelay(100);
19980+ }
19981
19982- /*
19983- * Some older OFs have bogus sizes, causing request_OF_resource
19984- * to fail. We fix them up here
19985- */
19986- if (np->addrs[0].size > 0x1000)
19987- np->addrs[0].size = 0x1000;
19988- if (np->n_addrs > 1 && np->addrs[1].size > 0x100)
19989- np->addrs[1].size = 0x100;
19990+ /* Sanitize drive timings */
19991+ sanitize_timings(pmif);
19992
19993- if (request_OF_resource(np, 0, " (mac-io IDE IO)") == NULL) {
19994- printk(KERN_ERR "ide-pmac(%s): can't request IO resource !\n", np->name);
19995- continue;
19996- }
19997+ return 0;
19998+}
19999
20000- base = (unsigned long) ioremap(np->addrs[0].address, 0x400);
20001+static int
20002+pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
20003+{
20004+ struct device_node *np = pmif->node;
20005+ int *bidp, i;
20006
20007- /* XXX This is bogus. Should be fixed in the registry by checking
20008- the kind of host interrupt controller, a bit like gatwick
20009- fixes in irq.c
20010- */
20011- if (np->n_intrs == 0) {
20012- printk(KERN_WARNING "ide: no intrs for device %s, using 13\n",
20013- np->full_name);
20014- irq = 13;
20015- } else {
20016- irq = np->intrs[0].line;
20017- }
20018- pmif->regbase = base;
20019- pmif->irq = irq;
20020- pmif->node = np;
20021- pmif->index = i;
20022- if (device_is_compatible(np, "keylargo-ata")) {
20023- if (strcmp(np->name, "ata-4") == 0)
20024- pmif->kind = controller_kl_ata4;
20025- else
20026- pmif->kind = controller_kl_ata3;
20027- } else if (device_is_compatible(np, "heathrow-ata"))
20028- pmif->kind = controller_heathrow;
20029+ pmif->cable_80 = 0;
20030+ pmif->broken_dma = pmif->broken_dma_warn = 0;
20031+ if (device_is_compatible(np, "kauai-ata"))
20032+ pmif->kind = controller_un_ata6;
20033+ else if (device_is_compatible(np, "keylargo-ata")) {
20034+ if (strcmp(np->name, "ata-4") == 0)
20035+ pmif->kind = controller_kl_ata4;
20036 else
20037- pmif->kind = controller_ohare;
20038+ pmif->kind = controller_kl_ata3;
20039+ } else if (device_is_compatible(np, "heathrow-ata"))
20040+ pmif->kind = controller_heathrow;
20041+ else {
20042+ pmif->kind = controller_ohare;
20043+ pmif->broken_dma = 1;
20044+ }
20045
20046- bidp = (int *)get_property(np, "AAPL,bus-id", NULL);
20047- pmif->aapl_bus_id = bidp ? *bidp : 0;
20048+ bidp = (int *)get_property(np, "AAPL,bus-id", NULL);
20049+ pmif->aapl_bus_id = bidp ? *bidp : 0;
20050
20051- if (pmif->kind == controller_kl_ata4) {
20052- char* cable = get_property(np, "cable-type", NULL);
20053- if (cable && !strncmp(cable, "80-", 3))
20054- pmif->kind = controller_kl_ata4_80;
20055- }
20056+ /* Get cable type from device-tree */
20057+ if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6) {
20058+ char* cable = get_property(np, "cable-type", NULL);
20059+ if (cable && !strncmp(cable, "80-", 3))
20060+ pmif->cable_80 = 1;
20061+ }
20062
20063- /* Make sure we have sane timings */
20064- sanitize_timings(pmif);
20065+ pmif->mediabay = 0;
20066+
20067+ /* Make sure we have sane timings */
20068+ sanitize_timings(pmif);
20069
20070- if (np->parent && np->parent->name
20071- && strcasecmp(np->parent->name, "media-bay") == 0) {
20072+ /* XXX FIXME: Media bay stuff need re-organizing */
20073+ if (np->parent && np->parent->name
20074+ && strcasecmp(np->parent->name, "media-bay") == 0) {
20075 #ifdef CONFIG_PMAC_PBOOK
20076- media_bay_set_ide_infos(np->parent,base,irq,i);
20077+ media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
20078 #endif /* CONFIG_PMAC_PBOOK */
20079- in_bay = 1;
20080- if (!bidp)
20081- pmif->aapl_bus_id = 1;
20082- } else if (pmif->kind == controller_ohare) {
20083- /* The code below is having trouble on some ohare machines
20084- * (timing related ?). Until I can put my hand on one of these
20085- * units, I keep the old way
20086- */
20087- ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);
20088- } else {
20089- /* This is necessary to enable IDE when net-booting */
20090- printk(KERN_INFO "pmac_ide: enabling IDE bus ID %d\n",
20091- pmif->aapl_bus_id);
20092- ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
20093- ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
20094- mdelay(10);
20095- ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
20096- big_delay = 1;
20097- }
20098+ pmif->mediabay = 1;
20099+ if (!bidp)
20100+ pmif->aapl_bus_id = 1;
20101+ } else if (pmif->kind == controller_ohare) {
20102+ /* The code below is having trouble on some ohare machines
20103+ * (timing related ?). Until I can put my hand on one of these
20104+ * units, I keep the old way
20105+ */
20106+ ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);
20107+ } else {
20108+ /* This is necessary to enable IDE when net-booting */
20109+ ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
20110+ ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
20111+ mdelay(10);
20112+ ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
20113+ mdelay(100);
20114+ }
20115
20116- hwif = &ide_hwifs[i];
20117- /* Setup MMIO ops */
20118- default_hwif_mmiops(hwif);
20119- /* Tell common code _not_ to mess with resources */
20120- hwif->mmio = 2;
20121- hwif->hwif_data = pmif;
20122- pmac_ide_init_hwif_ports(&hwif->hw, base, 0, &hwif->irq);
20123- memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
20124- hwif->chipset = ide_pmac;
20125- hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || in_bay;
20126- hwif->udma_four = (pmif->kind == controller_kl_ata4_80);
20127- hwif->pci_dev = pdev;
20128- hwif->drives[0].unmask = 1;
20129- hwif->drives[1].unmask = 1;
20130- hwif->tuneproc = pmac_ide_tuneproc;
20131+ /* Setup MMIO ops */
20132+ default_hwif_mmiops(hwif);
20133+
20134+ /* Tell common code _not_ to mess with resources */
20135+ hwif->mmio = 2;
20136+ hwif->hwif_data = pmif;
20137+ pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq);
20138+ memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
20139+ hwif->chipset = ide_pmac;
20140+ hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;
20141+ hwif->hold = pmif->mediabay;
20142+ hwif->udma_four = pmif->cable_80;
20143+ hwif->drives[0].unmask = 1;
20144+ hwif->drives[1].unmask = 1;
20145+ hwif->tuneproc = pmac_ide_tuneproc;
20146+ if (pmif->kind == controller_un_ata6)
20147+ hwif->selectproc = pmac_ide_kauai_selectproc;
20148+ else
20149 hwif->selectproc = pmac_ide_selectproc;
20150- hwif->speedproc = pmac_ide_tune_chipset;
20151+ hwif->speedproc = pmac_ide_tune_chipset;
20152+
20153+#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
20154+ pmu_ide_blink_enabled = pmu_hd_blink_init();
20155+
20156+ if (pmu_ide_blink_enabled)
20157+ hwif->led_act = pmu_hd_kick_blink;
20158+#endif
20159+
20160+ printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s\n",
20161+ hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
20162+ pmif->mediabay ? " (mediabay)" : "");
20163+
20164 #ifdef CONFIG_PMAC_PBOOK
20165- if (in_bay && check_media_bay_by_base(base, MB_CD) == 0)
20166- hwif->noprobe = 0;
20167+ if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)
20168+ hwif->noprobe = 0;
20169 #endif /* CONFIG_PMAC_PBOOK */
20170
20171 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20172- if (np->n_addrs >= 2) {
20173- /* has a DBDMA controller channel */
20174- pmac_ide_setup_dma(np, i);
20175- }
20176- hwif->atapi_dma = 1;
20177- hwif->ultra_mask = 0x1f;
20178- hwif->mwdma_mask = 0x07;
20179- hwif->swdma_mask = 0x07;
20180-
20181+ /* has a DBDMA controller channel */
20182+ if (pmif->dma_regs)
20183+ pmac_ide_setup_dma(pmif, hwif);
20184 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
20185
20186+ /* We probe the hwif now */
20187+ probe_hwif_init(hwif);
20188+
20189+ /* The code IDE code will have set hwif->present if we have devices attached,
20190+ * if we don't, the discard the interface except if we are on a media bay slot
20191+ */
20192+ if (!hwif->present && !pmif->mediabay) {
20193+ printk(KERN_INFO "ide%d: Bus empty, interface released.\n",
20194+ hwif->index);
20195+ default_hwif_iops(hwif);
20196+ for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i)
20197+ hwif->io_ports[i] = 0;
20198+ hwif->chipset = ide_unknown;
20199+ hwif->noprobe = 1;
20200+ return -ENODEV;
20201+ }
20202+
20203+ return 0;
20204+}
20205+
20206+static int __devinit
20207+pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match)
20208+{
20209+ unsigned long base, regbase;
20210+ int irq;
20211+ ide_hwif_t *hwif;
20212+ pmac_ide_hwif_t *pmif;
20213+ int i, rc;
20214+
20215+ i = 0;
20216+ while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
20217+ || pmac_ide[i].node != NULL))
20218 ++i;
20219+ if (i >= MAX_HWIFS) {
20220+ printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n");
20221+ printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name);
20222+ return -ENODEV;
20223 }
20224- pmac_ide_count = i;
20225- if (big_delay)
20226- mdelay(IDE_WAKEUP_DELAY_MS);
20227
20228-#ifdef CONFIG_PMAC_PBOOK
20229- pmu_register_sleep_notifier(&idepmac_sleep_notifier);
20230-#endif /* CONFIG_PMAC_PBOOK */
20231+ pmif = &pmac_ide[i];
20232+ hwif = &ide_hwifs[i];
20233+
20234+ if (mdev->ofdev.node->n_addrs == 0) {
20235+ printk(KERN_WARNING "ide%d: no address for %s\n",
20236+ i, mdev->ofdev.node->full_name);
20237+ return -ENXIO;
20238+ }
20239+
20240+ /*
20241+ * Some older OFs have bogus sizes, causing request_OF_resource
20242+ * to fail. We fix them up here
20243+ */
20244+ if (mdev->ofdev.node->addrs[0].size > 0x1000)
20245+ mdev->ofdev.node->addrs[0].size = 0x1000;
20246+ if (mdev->ofdev.node->n_addrs > 1 && mdev->ofdev.node->addrs[1].size > 0x100)
20247+ mdev->ofdev.node->addrs[1].size = 0x100;
20248+
20249+ /* Request memory resource for IO ports */
20250+ if (request_OF_resource(mdev->ofdev.node, 0, " (mac-io ata ports)") == NULL) {
20251+ printk(KERN_ERR "ide%d: can't request mmio resource !\n", i);
20252+ return -EBUSY;
20253+ }
20254+
20255+ /* XXX This is bogus. Should be fixed in the registry by checking
20256+ * the kind of host interrupt controller, a bit like gatwick
20257+ * fixes in irq.c. That works well enough for the single case
20258+ * where that happens though...
20259+ */
20260+ if (mdev->ofdev.node->n_intrs == 0) {
20261+ printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n",
20262+ i, mdev->ofdev.node->full_name);
20263+ irq = 13;
20264+ } else
20265+ irq = mdev->ofdev.node->intrs[0].line;
20266+
20267+ base = (unsigned long) ioremap(mdev->ofdev.node->addrs[0].address, 0x400);
20268+ regbase = base;
20269+
20270+ hwif->pci_dev = mdev->bus->pdev;
20271+ hwif->gendev.parent = &mdev->ofdev.dev;
20272+
20273+ pmif->mdev = mdev;
20274+ pmif->node = mdev->ofdev.node;
20275+ pmif->regbase = regbase;
20276+ pmif->irq = irq;
20277+#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20278+ if (mdev->ofdev.node->n_addrs >= 2)
20279+ pmif->dma_regs = (volatile struct dbdma_regs*)
20280+ ioremap(mdev->ofdev.node->addrs[1].address, 0x1000);
20281+ else
20282+ pmif->dma_regs = NULL;
20283+#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
20284+ dev_set_drvdata(&mdev->ofdev.dev, hwif);
20285+
20286+ rc = pmac_ide_setup_device(pmif, hwif);
20287+ if (rc != 0) {
20288+ /* The inteface is released to the common IDE layer */
20289+ dev_set_drvdata(&mdev->ofdev.dev, NULL);
20290+ iounmap((void *)base);
20291+ if (pmif->dma_regs)
20292+ iounmap((void *)pmif->dma_regs);
20293+ memset(pmif, 0, sizeof(*pmif));
20294+ release_OF_resource(mdev->ofdev.node, 0);
20295+ }
20296+
20297+ return rc;
20298 }
20299
20300+static int
20301+pmac_ide_macio_suspend(struct macio_dev *mdev, u32 state)
20302+{
20303+ ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
20304+ int rc = 0;
20305+
20306+ if (state != mdev->ofdev.dev.power_state && state >= 2) {
20307+ rc = pmac_ide_do_suspend(hwif);
20308+ if (rc == 0)
20309+ mdev->ofdev.dev.power_state = state;
20310+ }
20311+
20312+ return rc;
20313+}
20314+
20315+static int
20316+pmac_ide_macio_resume(struct macio_dev *mdev)
20317+{
20318+ ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
20319+ int rc = 0;
20320+
20321+ if (mdev->ofdev.dev.power_state != 0) {
20322+ rc = pmac_ide_do_resume(hwif);
20323+ if (rc == 0)
20324+ mdev->ofdev.dev.power_state = 0;
20325+ }
20326+
20327+ return rc;
20328+}
20329+
20330+static int __devinit
20331+pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
20332+{
20333+ ide_hwif_t *hwif;
20334+ struct device_node *np;
20335+ pmac_ide_hwif_t *pmif;
20336+ unsigned long base;
20337+ unsigned long rbase, rlen;
20338+ int i, rc;
20339+
20340+ np = pci_device_to_OF_node(pdev);
20341+ if (np == NULL) {
20342+ printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n");
20343+ return -ENODEV;
20344+ }
20345+ i = 0;
20346+ while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
20347+ || pmac_ide[i].node != NULL))
20348+ ++i;
20349+ if (i >= MAX_HWIFS) {
20350+ printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n");
20351+ printk(KERN_ERR " %s\n", np->full_name);
20352+ return -ENODEV;
20353+ }
20354+
20355+ pmif = &pmac_ide[i];
20356+ hwif = &ide_hwifs[i];
20357+
20358+ if (pci_enable_device(pdev)) {
20359+ printk(KERN_WARNING "ide%i: Can't enable PCI device for %s\n",
20360+ i, np->full_name);
20361+ return -ENXIO;
20362+ }
20363+ pci_set_master(pdev);
20364+
20365+ if (pci_request_regions(pdev, "Kauai ATA")) {
20366+ printk(KERN_ERR "ide%d: Cannot obtain PCI resources for %s\n",
20367+ i, np->full_name);
20368+ return -ENXIO;
20369+ }
20370+
20371+ hwif->pci_dev = pdev;
20372+ hwif->gendev.parent = &pdev->dev;
20373+ pmif->mdev = NULL;
20374+ pmif->node = np;
20375+
20376+ rbase = pci_resource_start(pdev, 0);
20377+ rlen = pci_resource_len(pdev, 0);
20378+
20379+ base = (unsigned long) ioremap(rbase, rlen);
20380+ pmif->regbase = base + 0x2000;
20381 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20382+ pmif->dma_regs = (volatile struct dbdma_regs*)(base + 0x1000);
20383+#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
20384+ pmif->irq = pdev->irq;
20385+
20386+ pci_set_drvdata(pdev, hwif);
20387+
20388+ rc = pmac_ide_setup_device(pmif, hwif);
20389+ if (rc != 0) {
20390+ /* The inteface is released to the common IDE layer */
20391+ pci_set_drvdata(pdev, NULL);
20392+ iounmap((void *)base);
20393+ memset(pmif, 0, sizeof(*pmif));
20394+ pci_release_regions(pdev);
20395+ }
20396+
20397+ return rc;
20398+}
20399+
20400+static int
20401+pmac_ide_pci_suspend(struct pci_dev *pdev, u32 state)
20402+{
20403+ ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
20404+ int rc = 0;
20405+
20406+ if (state != pdev->dev.power_state && state >= 2) {
20407+ rc = pmac_ide_do_suspend(hwif);
20408+ if (rc == 0)
20409+ pdev->dev.power_state = state;
20410+ }
20411+
20412+ return rc;
20413+}
20414
20415 static int
20416+pmac_ide_pci_resume(struct pci_dev *pdev)
20417+{
20418+ ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
20419+ int rc = 0;
20420+
20421+ if (pdev->dev.power_state != 0) {
20422+ rc = pmac_ide_do_resume(hwif);
20423+ if (rc == 0)
20424+ pdev->dev.power_state = 0;
20425+ }
20426+
20427+ return rc;
20428+}
20429+
20430+static struct of_match pmac_ide_macio_match[] =
20431+{
20432+ {
20433+ .name = "IDE",
20434+ .type = OF_ANY_MATCH,
20435+ .compatible = OF_ANY_MATCH
20436+ },
20437+ {
20438+ .name = "ATA",
20439+ .type = OF_ANY_MATCH,
20440+ .compatible = OF_ANY_MATCH
20441+ },
20442+ {
20443+ .name = OF_ANY_MATCH,
20444+ .type = "ide",
20445+ .compatible = OF_ANY_MATCH
20446+ },
20447+ {
20448+ .name = OF_ANY_MATCH,
20449+ .type = "ata",
20450+ .compatible = OF_ANY_MATCH
20451+ },
20452+ {},
20453+};
20454+
20455+static struct macio_driver pmac_ide_macio_driver =
20456+{
20457+ .name = "ide-pmac",
20458+ .match_table = pmac_ide_macio_match,
20459+ .probe = pmac_ide_macio_attach,
20460+ .suspend = pmac_ide_macio_suspend,
20461+ .resume = pmac_ide_macio_resume,
20462+};
20463+
20464+static struct pci_device_id pmac_ide_pci_match[] __devinitdata = {
20465+ { PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_KAUAI_ATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
20466+};
20467+
20468+static struct pci_driver pmac_ide_pci_driver = {
20469+ .name = "ide-pmac",
20470+ .id_table = pmac_ide_pci_match,
20471+ .probe = pmac_ide_pci_attach,
20472+ .suspend = pmac_ide_pci_suspend,
20473+ .resume = pmac_ide_pci_resume,
20474+};
20475+
20476+void __init
20477+pmac_ide_probe(void)
20478+{
20479+ if (_machine != _MACH_Pmac)
20480+ return;
20481+
20482+#ifdef CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST
20483+ pci_register_driver(&pmac_ide_pci_driver);
20484+ macio_register_driver(&pmac_ide_macio_driver);
20485+#else
20486+ macio_register_driver(&pmac_ide_macio_driver);
20487+ pci_register_driver(&pmac_ide_pci_driver);
20488+#endif
20489+}
20490+
20491+#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20492+
20493+static int __pmac
20494 pmac_ide_build_sglist(ide_drive_t *drive, struct request *rq)
20495 {
20496 ide_hwif_t *hwif = HWIF(drive);
20497@@ -942,7 +1479,7 @@
20498 if (hwif->sg_dma_active)
20499 BUG();
20500
20501- nents = blk_rq_map_sg(&drive->queue, rq, sg);
20502+ nents = blk_rq_map_sg(drive->queue, rq, sg);
20503
20504 if (rq_data_dir(rq) == READ)
20505 pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
20506@@ -952,7 +1489,7 @@
20507 return pci_map_sg(hwif->pci_dev, sg, nents, pmif->sg_dma_direction);
20508 }
20509
20510-static int
20511+static int __pmac
20512 pmac_ide_raw_build_sglist(ide_drive_t *drive, struct request *rq)
20513 {
20514 ide_hwif_t *hwif = HWIF(drive);
20515@@ -968,14 +1505,14 @@
20516 else
20517 pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
20518
20519- if (sector_count > 127) {
20520+ if (sector_count > 128) {
20521 memset(&sg[nents], 0, sizeof(*sg));
20522 sg[nents].page = virt_to_page(virt_addr);
20523 sg[nents].offset = offset_in_page(virt_addr);
20524- sg[nents].length = 127 * SECTOR_SIZE;
20525+ sg[nents].length = 128 * SECTOR_SIZE;
20526 nents++;
20527- virt_addr = virt_addr + (127 * SECTOR_SIZE);
20528- sector_count -= 127;
20529+ virt_addr = virt_addr + (128 * SECTOR_SIZE);
20530+ sector_count -= 128;
20531 }
20532 memset(&sg[nents], 0, sizeof(*sg));
20533 sg[nents].page = virt_to_page(virt_addr);
20534@@ -990,16 +1527,16 @@
20535 * pmac_ide_build_dmatable builds the DBDMA command list
20536 * for a transfer and sets the DBDMA channel to point to it.
20537 */
20538-static int
20539-pmac_ide_build_dmatable(ide_drive_t *drive, int wr)
20540+static int __pmac
20541+pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
20542 {
20543 struct dbdma_cmd *table;
20544 int i, count = 0;
20545- struct request *rq = HWGROUP(drive)->rq;
20546 ide_hwif_t *hwif = HWIF(drive);
20547 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20548 volatile struct dbdma_regs *dma = pmif->dma_regs;
20549 struct scatterlist *sg;
20550+ int wr = (rq_data_dir(rq) == WRITE);
20551
20552 /* DMA table is already aligned */
20553 table = (struct dbdma_cmd *) pmif->dma_table_cpu;
20554@@ -1026,10 +1563,18 @@
20555 cur_addr = sg_dma_address(sg);
20556 cur_len = sg_dma_len(sg);
20557
20558+ if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) {
20559+ if (pmif->broken_dma_warn == 0) {
20560+ printk(KERN_WARNING "%s: DMA on non aligned address,"
20561+ "switching to PIO on Ohare chipset\n", drive->name);
20562+ pmif->broken_dma_warn = 1;
20563+ }
20564+ goto use_pio_instead;
20565+ }
20566 while (cur_len) {
20567 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
20568
20569- if (++count >= MAX_DCMDS) {
20570+ if (count++ >= MAX_DCMDS) {
20571 printk(KERN_WARNING "%s: DMA table too small\n",
20572 drive->name);
20573 goto use_pio_instead;
20574@@ -1070,7 +1615,7 @@
20575 }
20576
20577 /* Teardown mappings after DMA has completed. */
20578-static void
20579+static void __pmac
20580 pmac_ide_destroy_dmatable (ide_drive_t *drive)
20581 {
20582 struct pci_dev *dev = HWIF(drive)->pci_dev;
20583@@ -1081,67 +1626,25 @@
20584 if (nents) {
20585 pci_unmap_sg(dev, sg, nents, pmif->sg_dma_direction);
20586 pmif->sg_nents = 0;
20587+ HWIF(drive)->sg_dma_active = 0;
20588 }
20589 }
20590
20591-static __inline__ unsigned char
20592-dma_bits_to_command(unsigned char bits)
20593-{
20594- if(bits & 0x04)
20595- return XFER_MW_DMA_2;
20596- if(bits & 0x02)
20597- return XFER_MW_DMA_1;
20598- if(bits & 0x01)
20599- return XFER_MW_DMA_0;
20600- return 0;
20601-}
20602-
20603-static __inline__ unsigned char
20604-udma_bits_to_command(unsigned char bits, int high_speed)
20605-{
20606- if (high_speed) {
20607- if(bits & 0x10)
20608- return XFER_UDMA_4;
20609- if(bits & 0x08)
20610- return XFER_UDMA_3;
20611- }
20612- if(bits & 0x04)
20613- return XFER_UDMA_2;
20614- if(bits & 0x02)
20615- return XFER_UDMA_1;
20616- if(bits & 0x01)
20617- return XFER_UDMA_0;
20618- return 0;
20619-}
20620-
20621 /* Calculate MultiWord DMA timings */
20622 static int __pmac
20623-pmac_ide_mdma_enable(ide_drive_t *drive)
20624+pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
20625 {
20626- u8 bits = drive->id->dma_mword & 0x07;
20627- u8 feature = dma_bits_to_command(bits);
20628- u32 *timings;
20629+ ide_hwif_t *hwif = HWIF(drive);
20630+ pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20631 int drive_cycle_time;
20632 struct hd_driveid *id = drive->id;
20633- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20634+ u32 *timings, *timings2;
20635+ u32 timing_local[2];
20636 int ret;
20637
20638- /* Set feature on drive */
20639- printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, feature & 0xf);
20640- ret = pmac_ide_do_setfeature(drive, feature);
20641- if (ret) {
20642- printk(KERN_WARNING "%s: Failed !\n", drive->name);
20643- return 0;
20644- }
20645-
20646- if (!drive->init_speed)
20647- drive->init_speed = feature;
20648-
20649 /* which drive is it ? */
20650- if (drive->select.b.unit & 0x01)
20651- timings = &pmif->timings[1];
20652- else
20653- timings = &pmif->timings[0];
20654+ timings = &pmif->timings[drive->select.b.unit & 0x01];
20655+ timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
20656
20657 /* Check if drive provide explicit cycle time */
20658 if ((id->field_valid & 2) && (id->eide_dma_time))
20659@@ -1149,201 +1652,220 @@
20660 else
20661 drive_cycle_time = 0;
20662
20663+ /* Copy timings to local image */
20664+ timing_local[0] = *timings;
20665+ timing_local[1] = *timings2;
20666+
20667 /* Calculate controller timings */
20668- set_timings_mdma(pmif->kind, timings, feature, drive_cycle_time);
20669+ ret = set_timings_mdma( drive, pmif->kind,
20670+ &timing_local[0],
20671+ &timing_local[1],
20672+ mode,
20673+ drive_cycle_time);
20674+ if (ret)
20675+ return 0;
20676+
20677+ /* Set feature on drive */
20678+ printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, mode & 0xf);
20679+ ret = pmac_ide_do_setfeature(drive, mode);
20680+ if (ret) {
20681+ printk(KERN_WARNING "%s: Failed !\n", drive->name);
20682+ return 0;
20683+ }
20684+
20685+ /* Apply timings to controller */
20686+ *timings = timing_local[0];
20687+ *timings2 = timing_local[1];
20688+
20689+ /* Set speed info in drive */
20690+ drive->current_speed = mode;
20691+ if (!drive->init_speed)
20692+ drive->init_speed = mode;
20693
20694- drive->current_speed = feature;
20695 return 1;
20696 }
20697
20698 /* Calculate Ultra DMA timings */
20699 static int __pmac
20700-pmac_ide_udma_enable(ide_drive_t *drive, int high_speed)
20701+pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
20702 {
20703- u8 bits = drive->id->dma_ultra & 0x1f;
20704- u8 feature = udma_bits_to_command(bits, high_speed);
20705- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20706- u32 *timings;
20707+ ide_hwif_t *hwif = HWIF(drive);
20708+ pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20709+ u32 *timings, *timings2;
20710+ u32 timing_local[2];
20711 int ret;
20712+
20713+ /* which drive is it ? */
20714+ timings = &pmif->timings[drive->select.b.unit & 0x01];
20715+ timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
20716
20717+ /* Copy timings to local image */
20718+ timing_local[0] = *timings;
20719+ timing_local[1] = *timings2;
20720+
20721+ /* Calculate timings for interface */
20722+ if (pmif->kind == controller_un_ata6)
20723+ ret = set_timings_udma_ata6( &timing_local[0],
20724+ &timing_local[1],
20725+ mode);
20726+ else
20727+ ret = set_timings_udma_ata4(&timing_local[0], mode);
20728+ if (ret)
20729+ return 0;
20730+
20731 /* Set feature on drive */
20732- printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, feature & 0xf);
20733- ret = pmac_ide_do_setfeature(drive, feature);
20734+ printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, mode & 0x0f);
20735+ ret = pmac_ide_do_setfeature(drive, mode);
20736 if (ret) {
20737 printk(KERN_WARNING "%s: Failed !\n", drive->name);
20738 return 0;
20739 }
20740
20741- if (!drive->init_speed)
20742- drive->init_speed = feature;
20743+ /* Apply timings to controller */
20744+ *timings = timing_local[0];
20745+ *timings2 = timing_local[1];
20746
20747- /* which drive is it ? */
20748- if (drive->select.b.unit & 0x01)
20749- timings = &pmif->timings[1];
20750- else
20751- timings = &pmif->timings[0];
20752-
20753- set_timings_udma(timings, feature);
20754+ /* Set speed info in drive */
20755+ drive->current_speed = mode;
20756+ if (!drive->init_speed)
20757+ drive->init_speed = mode;
20758
20759- drive->current_speed = feature;
20760 return 1;
20761 }
20762
20763-int pmac_ide_dma_check(ide_drive_t *drive)
20764+static int __pmac
20765+pmac_ide_dma_check(ide_drive_t *drive)
20766 {
20767- int ata4, udma;
20768 struct hd_driveid *id = drive->id;
20769 ide_hwif_t *hwif = HWIF(drive);
20770 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20771 int enable = 1;
20772-
20773+ int map;
20774 drive->using_dma = 0;
20775
20776- if (pmif == NULL)
20777- return 0;
20778-
20779 if (drive->media == ide_floppy)
20780 enable = 0;
20781- if (((id->capability & 1) == 0) &&
20782- !HWIF(drive)->ide_dma_good_drive(drive))
20783+ if (((id->capability & 1) == 0) && !__ide_dma_good_drive(drive))
20784 enable = 0;
20785- if (HWIF(drive)->ide_dma_bad_drive(drive))
20786+ if (__ide_dma_bad_drive(drive))
20787 enable = 0;
20788- udma = 0;
20789- ata4 = (pmif->kind == controller_kl_ata4 ||
20790- pmif->kind == controller_kl_ata4_80);
20791-
20792- if(enable) {
20793- if (ata4 && (drive->media == ide_disk) &&
20794- (id->field_valid & 0x0004) && (id->dma_ultra & 0x1f)) {
20795- /* UltraDMA modes. */
20796- drive->using_dma = pmac_ide_udma_enable(drive,
20797- pmif->kind == controller_kl_ata4_80);
20798- }
20799- if (!drive->using_dma && (id->dma_mword & 0x0007)) {
20800- /* Normal MultiWord DMA modes. */
20801- drive->using_dma = pmac_ide_mdma_enable(drive);
20802+
20803+ if (enable) {
20804+ short mode;
20805+
20806+ map = XFER_MWDMA;
20807+ if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6) {
20808+ map |= XFER_UDMA;
20809+ if (pmif->cable_80) {
20810+ map |= XFER_UDMA_66;
20811+ if (pmif->kind == controller_un_ata6)
20812+ map |= XFER_UDMA_100;
20813+ }
20814 }
20815+ mode = ide_find_best_mode(drive, map);
20816+ if (mode & XFER_UDMA)
20817+ drive->using_dma = pmac_ide_udma_enable(drive, mode);
20818+ else if (mode & XFER_MWDMA)
20819+ drive->using_dma = pmac_ide_mdma_enable(drive, mode);
20820 hwif->OUTB(0, IDE_CONTROL_REG);
20821 /* Apply settings to controller */
20822- pmac_ide_selectproc(drive);
20823+ pmac_ide_do_update_timings(drive);
20824 }
20825 return 0;
20826 }
20827
20828-static int
20829-pmac_ide_dma_read (ide_drive_t *drive)
20830+static int __pmac
20831+pmac_ide_dma_start(ide_drive_t *drive, int reading)
20832 {
20833 ide_hwif_t *hwif = HWIF(drive);
20834 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20835 struct request *rq = HWGROUP(drive)->rq;
20836-// ide_task_t *args = rq->special;
20837 u8 unit = (drive->select.b.unit & 0x01);
20838 u8 ata4;
20839- u8 lba48 = (drive->addressing == 1) ? 1 : 0;
20840- task_ioreg_t command = WIN_NOP;
20841
20842 if (pmif == NULL)
20843 return 1;
20844+ ata4 = (pmif->kind == controller_kl_ata4);
20845
20846- ata4 = (pmif->kind == controller_kl_ata4 ||
20847- pmif->kind == controller_kl_ata4_80);
20848-
20849- if (!pmac_ide_build_dmatable(drive, 0))
20850+ if (!pmac_ide_build_dmatable(drive, rq))
20851 return 1;
20852+
20853 /* Apple adds 60ns to wrDataSetup on reads */
20854 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
20855- writel(pmif->timings[unit]+0x00800000UL,
20856+ writel(pmif->timings[unit] + (reading ? 0x00800000UL : 0),
20857 (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
20858 (void)readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG));
20859 }
20860+
20861 drive->waiting_for_dma = 1;
20862+
20863+ return 0;
20864+}
20865+
20866+static int __pmac
20867+pmac_ide_dma_read(ide_drive_t *drive)
20868+{
20869+ struct request *rq = HWGROUP(drive)->rq;
20870+ u8 lba48 = (drive->addressing == 1) ? 1 : 0;
20871+ task_ioreg_t command = WIN_NOP;
20872+
20873+ if (pmac_ide_dma_start(drive, 1))
20874+ return 1;
20875+
20876 if (drive->media != ide_disk)
20877 return 0;
20878- if (HWGROUP(drive)->handler != NULL) /* paranoia check */
20879- BUG();
20880- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
20881- /*
20882- * FIX ME to use only ACB ide_task_t args Struct
20883- */
20884-#if 0
20885- {
20886- ide_task_t *args = rq->special;
20887- command = args->tfRegister[IDE_COMMAND_OFFSET];
20888- }
20889-#else
20890+
20891 command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA;
20892+
20893+ if (drive->vdma)
20894+ command = (lba48) ? WIN_READ_EXT: WIN_READ;
20895+
20896 if (rq->flags & REQ_DRIVE_TASKFILE) {
20897 ide_task_t *args = rq->special;
20898 command = args->tfRegister[IDE_COMMAND_OFFSET];
20899 }
20900-#endif
20901+
20902 /* issue cmd to drive */
20903- hwif->OUTB(command, IDE_COMMAND_REG);
20904+ ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
20905
20906 return pmac_ide_dma_begin(drive);
20907 }
20908
20909-static int
20910+static int __pmac
20911 pmac_ide_dma_write (ide_drive_t *drive)
20912 {
20913- ide_hwif_t *hwif = HWIF(drive);
20914- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20915 struct request *rq = HWGROUP(drive)->rq;
20916-// ide_task_t *args = rq->special;
20917- u8 unit = (drive->select.b.unit & 0x01);
20918- u8 ata4;
20919 u8 lba48 = (drive->addressing == 1) ? 1 : 0;
20920 task_ioreg_t command = WIN_NOP;
20921
20922- if (pmif == NULL)
20923+ if (pmac_ide_dma_start(drive, 0))
20924 return 1;
20925
20926- ata4 = (pmif->kind == controller_kl_ata4 ||
20927- pmif->kind == controller_kl_ata4_80);
20928-
20929- if (!pmac_ide_build_dmatable(drive, 1))
20930- return 1;
20931- /* Apple adds 60ns to wrDataSetup on reads */
20932- if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
20933- writel(pmif->timings[unit],
20934- (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
20935- (void)readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG));
20936- }
20937- drive->waiting_for_dma = 1;
20938 if (drive->media != ide_disk)
20939 return 0;
20940- if (HWGROUP(drive)->handler != NULL) /* paranoia check */
20941- BUG();
20942- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
20943- /*
20944- * FIX ME to use only ACB ide_task_t args Struct
20945- */
20946-#if 0
20947- {
20948- ide_task_t *args = rq->special;
20949- command = args->tfRegister[IDE_COMMAND_OFFSET];
20950- }
20951-#else
20952+
20953 command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
20954+ if (drive->vdma)
20955+ command = (lba48) ? WIN_WRITE_EXT: WIN_WRITE;
20956+
20957 if (rq->flags & REQ_DRIVE_TASKFILE) {
20958 ide_task_t *args = rq->special;
20959 command = args->tfRegister[IDE_COMMAND_OFFSET];
20960 }
20961-#endif
20962+
20963 /* issue cmd to drive */
20964- hwif->OUTB(command, IDE_COMMAND_REG);
20965+ ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
20966
20967 return pmac_ide_dma_begin(drive);
20968 }
20969
20970-static int
20971+static int __pmac
20972 pmac_ide_dma_count (ide_drive_t *drive)
20973 {
20974 return HWIF(drive)->ide_dma_begin(drive);
20975 }
20976
20977-static int
20978+static int __pmac
20979 pmac_ide_dma_begin (ide_drive_t *drive)
20980 {
20981 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20982@@ -1359,7 +1881,7 @@
20983 return 0;
20984 }
20985
20986-static int
20987+static int __pmac
20988 pmac_ide_dma_end (ide_drive_t *drive)
20989 {
20990 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20991@@ -1378,7 +1900,7 @@
20992 return (dstat & (RUN|DEAD|ACTIVE)) != RUN;
20993 }
20994
20995-static int
20996+static int __pmac
20997 pmac_ide_dma_test_irq (ide_drive_t *drive)
20998 {
20999 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21000@@ -1418,33 +1940,33 @@
21001 return 1;
21002 if (!drive->waiting_for_dma)
21003 printk(KERN_WARNING "ide%d, ide_dma_test_irq \
21004- called while not waiting\n", pmif->index);
21005+ called while not waiting\n", HWIF(drive)->index);
21006
21007 /* If dbdma didn't execute the STOP command yet, the
21008 * active bit is still set */
21009 drive->waiting_for_dma++;
21010 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {
21011 printk(KERN_WARNING "ide%d, timeout waiting \
21012- for dbdma command stop\n", pmif->index);
21013+ for dbdma command stop\n", HWIF(drive)->index);
21014 return 1;
21015 }
21016- udelay(1);
21017+ udelay(5);
21018 return 0;
21019 }
21020
21021-static int
21022+static int __pmac
21023 pmac_ide_dma_host_off (ide_drive_t *drive)
21024 {
21025 return 0;
21026 }
21027
21028-static int
21029+static int __pmac
21030 pmac_ide_dma_host_on (ide_drive_t *drive)
21031 {
21032 return 0;
21033 }
21034
21035-static int
21036+static int __pmac
21037 pmac_ide_dma_lostirq (ide_drive_t *drive)
21038 {
21039 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21040@@ -1461,316 +1983,87 @@
21041 }
21042
21043 static void __init
21044-pmac_ide_setup_dma(struct device_node *np, int ix)
21045+pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
21046 {
21047- struct pmac_ide_hwif *pmif = &pmac_ide[ix];
21048-
21049- if (request_OF_resource(np, 1, " (mac-io IDE DMA)") == NULL) {
21050- printk(KERN_ERR "ide-pmac(%s): can't request DMA resource !\n", np->name);
21051+ /* We won't need pci_dev if we switch to generic consistent
21052+ * DMA routines ...
21053+ */
21054+ if (hwif->pci_dev == NULL)
21055 return;
21056- }
21057-
21058- pmif->dma_regs =
21059- (volatile struct dbdma_regs*)ioremap(np->addrs[1].address, 0x200);
21060-
21061 /*
21062 * Allocate space for the DBDMA commands.
21063 * The +2 is +1 for the stop command and +1 to allow for
21064 * aligning the start address to a multiple of 16 bytes.
21065 */
21066 pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent(
21067- ide_hwifs[ix].pci_dev,
21068+ hwif->pci_dev,
21069 (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
21070 &pmif->dma_table_dma);
21071 if (pmif->dma_table_cpu == NULL) {
21072 printk(KERN_ERR "%s: unable to allocate DMA command list\n",
21073- ide_hwifs[ix].name);
21074+ hwif->name);
21075 return;
21076 }
21077
21078 pmif->sg_table = kmalloc(sizeof(struct scatterlist) * MAX_DCMDS,
21079 GFP_KERNEL);
21080 if (pmif->sg_table == NULL) {
21081- pci_free_consistent( ide_hwifs[ix].pci_dev,
21082+ pci_free_consistent( hwif->pci_dev,
21083 (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
21084 pmif->dma_table_cpu, pmif->dma_table_dma);
21085 return;
21086 }
21087- ide_hwifs[ix].ide_dma_off = &__ide_dma_off;
21088- ide_hwifs[ix].ide_dma_off_quietly = &__ide_dma_off_quietly;
21089- ide_hwifs[ix].ide_dma_on = &__ide_dma_on;
21090- ide_hwifs[ix].ide_dma_check = &pmac_ide_dma_check;
21091- ide_hwifs[ix].ide_dma_read = &pmac_ide_dma_read;
21092- ide_hwifs[ix].ide_dma_write = &pmac_ide_dma_write;
21093- ide_hwifs[ix].ide_dma_count = &pmac_ide_dma_count;
21094- ide_hwifs[ix].ide_dma_begin = &pmac_ide_dma_begin;
21095- ide_hwifs[ix].ide_dma_end = &pmac_ide_dma_end;
21096- ide_hwifs[ix].ide_dma_test_irq = &pmac_ide_dma_test_irq;
21097- ide_hwifs[ix].ide_dma_host_off = &pmac_ide_dma_host_off;
21098- ide_hwifs[ix].ide_dma_host_on = &pmac_ide_dma_host_on;
21099- ide_hwifs[ix].ide_dma_good_drive = &__ide_dma_good_drive;
21100- ide_hwifs[ix].ide_dma_bad_drive = &__ide_dma_bad_drive;
21101- ide_hwifs[ix].ide_dma_verbose = &__ide_dma_verbose;
21102- ide_hwifs[ix].ide_dma_timeout = &__ide_dma_timeout;
21103- ide_hwifs[ix].ide_dma_retune = &__ide_dma_retune;
21104- ide_hwifs[ix].ide_dma_lostirq = &pmac_ide_dma_lostirq;
21105- ide_hwifs[ix].ide_dma_queued_on = &__ide_dma_queued_on;
21106- ide_hwifs[ix].ide_dma_queued_off = &__ide_dma_queued_off;
21107+ hwif->ide_dma_off = &__ide_dma_off;
21108+ hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
21109+ hwif->ide_dma_on = &__ide_dma_on;
21110+ hwif->ide_dma_check = &pmac_ide_dma_check;
21111+ hwif->ide_dma_read = &pmac_ide_dma_read;
21112+ hwif->ide_dma_write = &pmac_ide_dma_write;
21113+ hwif->ide_dma_count = &pmac_ide_dma_count;
21114+ hwif->ide_dma_begin = &pmac_ide_dma_begin;
21115+ hwif->ide_dma_end = &pmac_ide_dma_end;
21116+ hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq;
21117+ hwif->ide_dma_host_off = &pmac_ide_dma_host_off;
21118+ hwif->ide_dma_host_on = &pmac_ide_dma_host_on;
21119+ hwif->ide_dma_good_drive = &__ide_dma_good_drive;
21120+ hwif->ide_dma_bad_drive = &__ide_dma_bad_drive;
21121+ hwif->ide_dma_verbose = &__ide_dma_verbose;
21122+ hwif->ide_dma_timeout = &__ide_dma_timeout;
21123+ hwif->ide_dma_retune = &__ide_dma_retune;
21124+ hwif->ide_dma_lostirq = &pmac_ide_dma_lostirq;
21125+ hwif->ide_dma_queued_on = &__ide_dma_queued_on;
21126+ hwif->ide_dma_queued_off = &__ide_dma_queued_off;
21127+#ifdef CONFIG_BLK_DEV_IDE_TCQ
21128+ hwif->ide_dma_queued_read = __ide_dma_queued_read;
21129+ hwif->ide_dma_queued_write = __ide_dma_queued_write;
21130+ hwif->ide_dma_queued_start = __ide_dma_queued_start;
21131+#endif
21132
21133 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
21134 if (!noautodma)
21135- ide_hwifs[ix].autodma = 1;
21136+ hwif->autodma = 1;
21137 #endif
21138- ide_hwifs[ix].drives[0].autodma = ide_hwifs[ix].autodma;
21139- ide_hwifs[ix].drives[1].autodma = ide_hwifs[ix].autodma;
21140-}
21141-
21142-#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21143-
21144-static void __pmac
21145-idepmac_sleep_device(ide_drive_t *drive, unsigned base)
21146-{
21147- ide_hwif_t *hwif = HWIF(drive);
21148- int j;
21149-
21150- /* FIXME: We only handle the master IDE disk, we shoud
21151- * try to fix CD-ROMs here
21152- */
21153- switch (drive->media) {
21154- case ide_disk:
21155- /* Spin down the drive */
21156- hwif->OUTB(drive->select.all, base+0x60);
21157- (void) hwif->INB(base+0x60);
21158- udelay(100);
21159- hwif->OUTB(0x0, base+0x30);
21160- hwif->OUTB(0x0, base+0x20);
21161- hwif->OUTB(0x0, base+0x40);
21162- hwif->OUTB(0x0, base+0x50);
21163- hwif->OUTB(0xe0, base+0x70);
21164- hwif->OUTB(0x2, base+0x160);
21165- for (j = 0; j < 10; j++) {
21166- u8 status;
21167- mdelay(100);
21168- status = hwif->INB(base+0x70);
21169- if (!(status & BUSY_STAT) && (status & DRQ_STAT))
21170- break;
21171- }
21172- break;
21173- case ide_cdrom:
21174- // todo
21175- break;
21176- case ide_floppy:
21177- // todo
21178- break;
21179- }
21180-}
21181-
21182-#ifdef CONFIG_PMAC_PBOOK
21183-static void __pmac
21184-idepmac_wake_device(ide_drive_t *drive, int used_dma)
21185-{
21186- /* We force the IDE subdriver to check for a media change
21187- * This must be done first or we may lost the condition
21188- *
21189- * Problem: This can schedule. I moved the block device
21190- * wakeup almost late by priority because of that.
21191- */
21192- //if (DRIVER(drive))
21193- // check_disk_change(MKDEV(drive->disk->major, drive->disk->first_minor));
21194-
21195-#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
21196- /* We re-enable DMA on the drive if it was active. */
21197- /* This doesn't work with the CD-ROM in the media-bay, probably
21198- * because of a pending unit attention. The problem if that if I
21199- * clear the error, the filesystem dies.
21200- */
21201- if (used_dma && !ide_spin_wait_hwgroup(drive)) {
21202- /* Lock HW group */
21203- HWGROUP(drive)->busy = 1;
21204- pmac_ide_dma_check(drive);
21205- HWGROUP(drive)->busy = 0;
21206- if (!list_empty(&drive->queue.queue_head))
21207- ide_do_request(HWGROUP(drive), 0);
21208- spin_unlock_irq(&ide_lock);
21209- }
21210-#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21211-}
21212-
21213-static void __pmac
21214-idepmac_sleep_interface(pmac_ide_hwif_t *pmif, unsigned base, int mediabay)
21215-{
21216- struct device_node* np = pmif->node;
21217-
21218- /* We clear the timings */
21219- pmif->timings[0] = 0;
21220- pmif->timings[1] = 0;
21221-
21222- /* The media bay will handle itself just fine */
21223- if (mediabay)
21224- return;
21225-
21226- /* Disable the bus */
21227- ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 0);
21228-}
21229+ hwif->drives[0].autodma = hwif->autodma;
21230+ hwif->drives[1].autodma = hwif->autodma;
21231
21232-static void __pmac
21233-idepmac_wake_interface(pmac_ide_hwif_t *pmif, unsigned long base, int mediabay)
21234-{
21235- struct device_node* np = pmif->node;
21236-
21237- if (!mediabay) {
21238- /* Revive IDE disk and controller */
21239- ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
21240- ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
21241- mdelay(10);
21242- ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
21243- }
21244-}
21245-
21246-static void
21247-idepmac_sleep_drive(ide_drive_t *drive, unsigned long base)
21248-{
21249- int unlock = 0;
21250-
21251- /* Wait for HW group to complete operations */
21252- if (ide_spin_wait_hwgroup(drive)) {
21253- // What can we do here ? Wake drive we had already
21254- // put to sleep and return an error ?
21255- } else {
21256- unlock = 1;
21257- /* Lock HW group */
21258- HWGROUP(drive)->busy = 1;
21259- /* Stop the device */
21260- idepmac_sleep_device(drive, base);
21261- }
21262- if (unlock)
21263- spin_unlock_irq(&ide_lock);
21264-}
21265-
21266-static void
21267-idepmac_wake_drive(ide_drive_t *drive, unsigned long base)
21268-{
21269- ide_hwif_t *hwif = HWIF(drive);
21270- unsigned long flags;
21271- int j;
21272-
21273- /* Reset timings */
21274- pmac_ide_selectproc(drive);
21275- mdelay(10);
21276-
21277- /* Wait up to 20 seconds for the drive to be ready */
21278- for (j = 0; j < 200; j++) {
21279- u8 status = 0;
21280- mdelay(100);
21281- hwif->OUTB(drive->select.all, base + 0x60);
21282- if ((hwif->INB(base + 0x60)) != drive->select.all)
21283- continue;
21284- status = hwif->INB(base + 0x70);
21285- if (!(status & BUSY_STAT))
21286+ hwif->atapi_dma = 1;
21287+ switch(pmif->kind) {
21288+ case controller_un_ata6:
21289+ hwif->ultra_mask = pmif->cable_80 ? 0x3f : 0x07;
21290+ hwif->mwdma_mask = 0x07;
21291+ hwif->swdma_mask = 0x00;
21292 break;
21293- }
21294-
21295- /* We resume processing on the HW group */
21296- spin_lock_irqsave(&ide_lock, flags);
21297- HWGROUP(drive)->busy = 0;
21298- if (!list_empty(&drive->queue.queue_head))
21299- ide_do_request(HWGROUP(drive), 0);
21300- spin_unlock_irqrestore(&ide_lock, flags);
21301+ case controller_kl_ata4:
21302+ hwif->ultra_mask = pmif->cable_80 ? 0x1f : 0x07;
21303+ hwif->mwdma_mask = 0x07;
21304+ hwif->swdma_mask = 0x00;
21305+ break;
21306+ default:
21307+ hwif->ultra_mask = 0x00;
21308+ hwif->mwdma_mask = 0x07;
21309+ hwif->swdma_mask = 0x00;
21310+ break;
21311+ }
21312 }
21313
21314-/* Note: We support only master drives for now. This will have to be
21315- * improved if we want to handle sleep on the iMacDV where the CD-ROM
21316- * is a slave
21317- */
21318-static int __pmac
21319-idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
21320-{
21321- int i, ret;
21322- unsigned long base;
21323- int big_delay;
21324-
21325- switch (when) {
21326- case PBOOK_SLEEP_REQUEST:
21327- break;
21328- case PBOOK_SLEEP_REJECT:
21329- break;
21330- case PBOOK_SLEEP_NOW:
21331- for (i = 0; i < pmac_ide_count; ++i) {
21332- ide_hwif_t *hwif;
21333- int dn;
21334-
21335- if ((base = pmac_ide[i].regbase) == 0)
21336- continue;
21337-
21338- hwif = &ide_hwifs[i];
21339- for (dn=0; dn<MAX_DRIVES; dn++) {
21340- if (!hwif->drives[dn].present)
21341- continue;
21342- idepmac_sleep_drive(&hwif->drives[dn], base);
21343- }
21344- /* Disable irq during sleep */
21345- disable_irq(pmac_ide[i].irq);
21346-
21347- /* Check if this is a media bay with an IDE device or not
21348- * a media bay.
21349- */
21350- ret = check_media_bay_by_base(base, MB_CD);
21351- if ((ret == 0) || (ret == -ENODEV))
21352- idepmac_sleep_interface(&pmac_ide[i], base, (ret == 0));
21353- }
21354- break;
21355- case PBOOK_WAKE:
21356- big_delay = 0;
21357- for (i = 0; i < pmac_ide_count; ++i) {
21358-
21359- if ((base = pmac_ide[i].regbase) == 0)
21360- continue;
21361-
21362- /* Make sure we have sane timings */
21363- sanitize_timings(&pmac_ide[i]);
21364-
21365- /* Check if this is a media bay with an IDE device or not
21366- * a media bay
21367- */
21368- ret = check_media_bay_by_base(base, MB_CD);
21369- if ((ret == 0) || (ret == -ENODEV)) {
21370- idepmac_wake_interface(&pmac_ide[i], base, (ret == 0));
21371- big_delay = 1;
21372- }
21373-
21374- }
21375- /* Let hardware get up to speed */
21376- if (big_delay)
21377- mdelay(IDE_WAKEUP_DELAY_MS);
21378-
21379- for (i = 0; i < pmac_ide_count; ++i) {
21380- ide_hwif_t *hwif;
21381- int used_dma, dn;
21382- int irq_on = 0;
21383-
21384- if ((base = pmac_ide[i].regbase) == 0)
21385- continue;
21386-
21387- hwif = &ide_hwifs[i];
21388- for (dn=0; dn<MAX_DRIVES; dn++) {
21389- ide_drive_t *drive = &hwif->drives[dn];
21390- if (!drive->present)
21391- continue;
21392- /* We don't have re-configured DMA yet */
21393- used_dma = drive->using_dma;
21394- drive->using_dma = 0;
21395- idepmac_wake_drive(drive, base);
21396- if (!irq_on) {
21397- enable_irq(pmac_ide[i].irq);
21398- irq_on = 1;
21399- }
21400- idepmac_wake_device(drive, used_dma);
21401- }
21402- if (!irq_on)
21403- enable_irq(pmac_ide[i].irq);
21404- }
21405- break;
21406- }
21407- return PBOOK_SLEEP_OK;
21408-}
21409-#endif /* CONFIG_PMAC_PBOOK */
21410+#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21411diff -Nru a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
21412--- a/drivers/ieee1394/ieee1394_core.c Sun Aug 3 17:00:00 2003
21413+++ b/drivers/ieee1394/ieee1394_core.c Tue Aug 26 09:25:41 2003
21414@@ -1124,7 +1124,7 @@
21415 to get the index of the ieee1394_driver
21416 we want */
21417
21418- blocknum = (minor(inode->i_rdev) >> 4) & 0xF;
21419+ blocknum = (iminor(inode) >> 4) & 0xF;
21420
21421 /* look up the driver */
21422
21423diff -Nru a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
21424--- a/drivers/ieee1394/ieee1394_core.h Thu Jul 24 17:00:00 2003
21425+++ b/drivers/ieee1394/ieee1394_core.h Tue Aug 26 09:25:41 2003
21426@@ -202,7 +202,7 @@
21427 /* return the index (within a minor number block) of a file */
21428 static inline unsigned char ieee1394_file_to_instance(struct file *file)
21429 {
21430- unsigned char minor = minor(file->f_dentry->d_inode->i_rdev);
21431+ unsigned char minor = iminor(file->f_dentry->d_inode);
21432
21433 /* return lower 4 bits */
21434 return minor & 0xF;
21435diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
21436--- a/drivers/ieee1394/pcilynx.c Sat Aug 16 05:08:53 2003
21437+++ b/drivers/ieee1394/pcilynx.c Tue Aug 26 09:25:41 2003
21438@@ -875,7 +875,7 @@
21439
21440 static int mem_open(struct inode *inode, struct file *file)
21441 {
21442- int cid = minor(inode->i_rdev);
21443+ int cid = iminor(inode);
21444 enum { t_rom, t_aux, t_ram } type;
21445 struct memdata *md;
21446
21447diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
21448--- a/drivers/input/evdev.c Tue Aug 12 16:21:11 2003
21449+++ b/drivers/input/evdev.c Sun Aug 31 16:14:28 2003
21450@@ -122,7 +122,7 @@
21451 static int evdev_open(struct inode * inode, struct file * file)
21452 {
21453 struct evdev_list *list;
21454- int i = minor(inode->i_rdev) - EVDEV_MINOR_BASE;
21455+ int i = iminor(inode) - EVDEV_MINOR_BASE;
21456 int accept_err;
21457
21458 if (i >= EVDEV_MINORS || !evdev_table[i])
21459@@ -305,6 +305,7 @@
21460 case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;
21461 case EV_REL: bits = dev->relbit; len = REL_MAX; break;
21462 case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
21463+ case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;
21464 case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
21465 case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
21466 case EV_FF: bits = dev->ffbit; len = FF_MAX; break;
21467diff -Nru a/drivers/input/input.c b/drivers/input/input.c
21468--- a/drivers/input/input.c Tue Aug 12 13:29:25 2003
21469+++ b/drivers/input/input.c Tue Aug 26 09:25:41 2003
21470@@ -280,7 +280,7 @@
21471 if (id->id.product != dev->id.product)
21472 continue;
21473
21474- if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
21475+ if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
21476 if (id->id.version != dev->id.version)
21477 continue;
21478
21479@@ -527,7 +527,7 @@
21480
21481 static int input_open_file(struct inode *inode, struct file *file)
21482 {
21483- struct input_handler *handler = input_table[minor(inode->i_rdev) >> 5];
21484+ struct input_handler *handler = input_table[iminor(inode) >> 5];
21485 struct file_operations *old_fops, *new_fops = NULL;
21486 int err;
21487
21488diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
21489--- a/drivers/input/joydev.c Fri May 2 06:55:04 2003
21490+++ b/drivers/input/joydev.c Tue Aug 26 09:25:41 2003
21491@@ -170,7 +170,7 @@
21492 static int joydev_open(struct inode *inode, struct file *file)
21493 {
21494 struct joydev_list *list;
21495- int i = minor(inode->i_rdev) - JOYDEV_MINOR_BASE;
21496+ int i = iminor(inode) - JOYDEV_MINOR_BASE;
21497
21498 if (i >= JOYDEV_MINORS || !joydev_table[i])
21499 return -ENODEV;
21500diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
21501--- a/drivers/input/mousedev.c Fri May 2 06:55:04 2003
21502+++ b/drivers/input/mousedev.c Tue Aug 26 09:25:41 2003
21503@@ -228,11 +228,11 @@
21504 int i;
21505
21506 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
21507- if (major(inode->i_rdev) == MISC_MAJOR)
21508+ if (imajor(inode) == MISC_MAJOR)
21509 i = MOUSEDEV_MIX;
21510 else
21511 #endif
21512- i = minor(inode->i_rdev) - MOUSEDEV_MINOR_BASE;
21513+ i = iminor(inode) - MOUSEDEV_MINOR_BASE;
21514
21515 if (i >= MOUSEDEV_MINORS || !mousedev_table[i])
21516 return -ENODEV;
21517diff -Nru a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
21518--- a/drivers/input/serio/sa1111ps2.c Sat May 17 07:47:27 2003
21519+++ b/drivers/input/serio/sa1111ps2.c Sun Aug 24 07:45:05 2003
21520@@ -62,9 +62,9 @@
21521
21522 serio_interrupt(&ps2if->io, scancode, flag, regs);
21523
21524- status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
21525+ status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
21526
21527- handled = IRQ_HANDLED;
21528+ handled = IRQ_HANDLED;
21529 }
21530
21531 return handled;
21532@@ -232,9 +232,8 @@
21533 /*
21534 * Add one device to this driver.
21535 */
21536-static int ps2_probe(struct device *dev)
21537+static int ps2_probe(struct sa1111_dev *dev)
21538 {
21539- struct sa1111_dev *sadev = SA1111_DEV(dev);
21540 struct ps2if *ps2if;
21541 int ret;
21542
21543@@ -249,20 +248,20 @@
21544 ps2if->io.write = ps2_write;
21545 ps2if->io.open = ps2_open;
21546 ps2if->io.close = ps2_close;
21547- ps2if->io.name = dev->name;
21548- ps2if->io.phys = dev->bus_id;
21549+ ps2if->io.name = dev->dev.bus_id;
21550+ ps2if->io.phys = dev->dev.bus_id;
21551 ps2if->io.driver = ps2if;
21552- ps2if->dev = sadev;
21553- dev->driver_data = ps2if;
21554+ ps2if->dev = dev;
21555+ sa1111_set_drvdata(dev, ps2if);
21556
21557 spin_lock_init(&ps2if->lock);
21558
21559 /*
21560 * Request the physical region for this PS2 port.
21561 */
21562- if (!request_mem_region(sadev->res.start,
21563- sadev->res.end - sadev->res.start + 1,
21564- SA1111_DRIVER_NAME(sadev))) {
21565+ if (!request_mem_region(dev->res.start,
21566+ dev->res.end - dev->res.start + 1,
21567+ SA1111_DRIVER_NAME(dev))) {
21568 ret = -EBUSY;
21569 goto free;
21570 }
21571@@ -270,7 +269,7 @@
21572 /*
21573 * Our parent device has already mapped the region.
21574 */
21575- ps2if->base = (unsigned long)sadev->mapbase;
21576+ ps2if->base = (unsigned long)dev->mapbase;
21577
21578 sa1111_enable_device(ps2if->dev);
21579
21580@@ -301,10 +300,10 @@
21581
21582 out:
21583 sa1111_disable_device(ps2if->dev);
21584- release_mem_region(sadev->res.start,
21585- sadev->res.end - sadev->res.start + 1);
21586+ release_mem_region(dev->res.start,
21587+ dev->res.end - dev->res.start + 1);
21588 free:
21589- dev->driver_data = NULL;
21590+ sa1111_set_drvdata(dev, NULL);
21591 kfree(ps2if);
21592 return ret;
21593 }
21594@@ -312,31 +311,17 @@
21595 /*
21596 * Remove one device from this driver.
21597 */
21598-static int ps2_remove(struct device *dev)
21599+static int ps2_remove(struct sa1111_dev *dev)
21600 {
21601- struct ps2if *ps2if = dev->driver_data;
21602- struct sa1111_dev *sadev = SA1111_DEV(dev);
21603+ struct ps2if *ps2if = sa1111_get_drvdata(dev);
21604
21605 serio_unregister_port(&ps2if->io);
21606- release_mem_region(sadev->res.start,
21607- sadev->res.end - sadev->res.start + 1);
21608- kfree(ps2if);
21609-
21610- dev->driver_data = NULL;
21611-
21612- return 0;
21613-}
21614+ release_mem_region(dev->res.start,
21615+ dev->res.end - dev->res.start + 1);
21616+ sa1111_set_drvdata(dev, NULL);
21617
21618-/*
21619- * We should probably do something here, but what?
21620- */
21621-static int ps2_suspend(struct device *dev, u32 state, u32 level)
21622-{
21623- return 0;
21624-}
21625+ kfree(ps2if);
21626
21627-static int ps2_resume(struct device *dev, u32 level)
21628-{
21629 return 0;
21630 }
21631
21632@@ -345,24 +330,21 @@
21633 */
21634 static struct sa1111_driver ps2_driver = {
21635 .drv = {
21636- .name = "sa1111-ps2",
21637- .bus = &sa1111_bus_type,
21638- .probe = ps2_probe,
21639- .remove = ps2_remove,
21640- .suspend = ps2_suspend,
21641- .resume = ps2_resume,
21642+ .name = "sa1111-ps2",
21643 },
21644- .devid = SA1111_DEVID_PS2,
21645+ .devid = SA1111_DEVID_PS2,
21646+ .probe = ps2_probe,
21647+ .remove = ps2_remove,
21648 };
21649
21650 static int __init ps2_init(void)
21651 {
21652- return driver_register(&ps2_driver.drv);
21653+ return sa1111_driver_register(&ps2_driver);
21654 }
21655
21656 static void __exit ps2_exit(void)
21657 {
21658- driver_unregister(&ps2_driver.drv);
21659+ sa1111_driver_unregister(&ps2_driver);
21660 }
21661
21662 module_init(ps2_init);
21663diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c
21664--- a/drivers/input/tsdev.c Fri May 2 06:55:04 2003
21665+++ b/drivers/input/tsdev.c Tue Aug 26 09:25:41 2003
21666@@ -96,7 +96,7 @@
21667
21668 static int tsdev_open(struct inode *inode, struct file *file)
21669 {
21670- int i = minor(inode->i_rdev) - TSDEV_MINOR_BASE;
21671+ int i = iminor(inode) - TSDEV_MINOR_BASE;
21672 struct tsdev_list *list;
21673
21674 if (i >= TSDEV_MINORS || !tsdev_table[i])
21675diff -Nru a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
21676--- a/drivers/isdn/capi/capi.c Wed Jun 11 12:32:56 2003
21677+++ b/drivers/isdn/capi/capi.c Tue Aug 26 09:25:41 2003
21678@@ -964,7 +964,7 @@
21679 {
21680 struct capiminor *mp;
21681
21682- if ((mp = capiminor_find(minor(file->f_dentry->d_inode->i_rdev))) == 0)
21683+ if ((mp = capiminor_find(iminor(file->f_dentry->d_inode))) == 0)
21684 return -ENXIO;
21685 if (mp->nccip == 0)
21686 return -ENXIO;
21687diff -Nru a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
21688--- a/drivers/isdn/hardware/eicon/divasi.c Mon Jul 21 12:08:32 2003
21689+++ b/drivers/isdn/hardware/eicon/divasi.c Tue Aug 26 09:25:41 2003
21690@@ -432,7 +432,7 @@
21691
21692 static int um_idi_release(struct inode *inode, struct file *file)
21693 {
21694- unsigned int adapter_nr = minor(inode->i_rdev);
21695+ unsigned int adapter_nr = iminor(inode);
21696 int ret = 0;
21697
21698 if (!(file->private_data)) {
21699diff -Nru a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
21700--- a/drivers/isdn/i4l/isdn_common.c Mon Jul 21 11:39:14 2003
21701+++ b/drivers/isdn/i4l/isdn_common.c Tue Aug 26 09:25:41 2003
21702@@ -1432,7 +1432,7 @@
21703 static int
21704 isdn_ctrl_open(struct inode *ino, struct file *file)
21705 {
21706- unsigned int minor = minor(ino->i_rdev);
21707+ unsigned int minor = iminor(ino);
21708 struct isdn_slot *slot = get_slot_by_minor(minor - ISDN_MINOR_CTRL);
21709
21710 if (!slot)
21711@@ -1795,7 +1795,7 @@
21712 static int
21713 isdn_open(struct inode * inode, struct file * file)
21714 {
21715- int minor = minor(inode->i_rdev);
21716+ int minor = iminor(inode);
21717 int err = -ENODEV;
21718 struct file_operations *old_fops, *new_fops = NULL;
21719
21720diff -Nru a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
21721--- a/drivers/isdn/i4l/isdn_ppp.c Tue Jul 15 10:01:29 2003
21722+++ b/drivers/isdn/i4l/isdn_ppp.c Tue Aug 26 09:25:41 2003
21723@@ -119,7 +119,7 @@
21724 ipppd_open(struct inode *ino, struct file *file)
21725 {
21726 unsigned long flags;
21727- unsigned int minor = minor(ino->i_rdev) - ISDN_MINOR_PPP;
21728+ unsigned int minor = iminor(ino) - ISDN_MINOR_PPP;
21729 struct ipppd *ipppd;
21730
21731 ipppd = kmalloc(sizeof(*ipppd), GFP_KERNEL);
21732diff -Nru a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
21733--- a/drivers/macintosh/adb.c Sat Jun 7 00:45:03 2003
21734+++ b/drivers/macintosh/adb.c Tue Aug 26 09:25:41 2003
21735@@ -712,7 +712,7 @@
21736 {
21737 struct adbdev_state *state;
21738
21739- if (minor(inode->i_rdev) > 0 || adb_controller == NULL)
21740+ if (iminor(inode) > 0 || adb_controller == NULL)
21741 return -ENXIO;
21742 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
21743 if (state == 0)
21744diff -Nru a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
21745--- a/drivers/macintosh/macio_asic.c Sat Aug 16 11:47:51 2003
21746+++ b/drivers/macintosh/macio_asic.c Tue Aug 26 06:35:38 2003
21747@@ -23,6 +23,8 @@
21748 #include <asm/prom.h>
21749 #include <asm/pci-bridge.h>
21750
21751+static struct macio_chip *macio_on_hold;
21752+
21753 static int
21754 macio_bus_match(struct device *dev, struct device_driver *drv)
21755 {
21756@@ -36,21 +38,27 @@
21757 return of_match_device(matches, &macio_dev->ofdev) != NULL;
21758 }
21759
21760-struct bus_type macio_bus_type = {
21761- name: "macio",
21762- match: macio_bus_match,
21763-};
21764+struct macio_dev *macio_dev_get(struct macio_dev *dev)
21765+{
21766+ struct device *tmp;
21767
21768-static int __init
21769-macio_bus_driver_init(void)
21770+ if (!dev)
21771+ return NULL;
21772+ tmp = get_device(&dev->ofdev.dev);
21773+ if (tmp)
21774+ return to_macio_device(tmp);
21775+ else
21776+ return NULL;
21777+}
21778+
21779+void macio_dev_put(struct macio_dev *dev)
21780 {
21781- return bus_register(&macio_bus_type);
21782+ if (dev)
21783+ put_device(&dev->ofdev.dev);
21784 }
21785
21786-postcore_initcall(macio_bus_driver_init);
21787
21788-static int
21789-macio_device_probe(struct device *dev)
21790+static int macio_device_probe(struct device *dev)
21791 {
21792 int error = -ENODEV;
21793 struct macio_driver *drv;
21794@@ -63,55 +71,89 @@
21795 if (!drv->probe)
21796 return error;
21797
21798-/* if (!try_module_get(driver->owner)) {
21799- printk(KERN_ERR "Can't get a module reference for %s\n", driver->name);
21800- return error;
21801- }
21802-*/
21803+ macio_dev_get(macio_dev);
21804+
21805 match = of_match_device(drv->match_table, &macio_dev->ofdev);
21806 if (match)
21807 error = drv->probe(macio_dev, match);
21808-/*
21809- module_put(driver->owner);
21810-*/
21811+ if (error)
21812+ macio_dev_put(macio_dev);
21813+
21814 return error;
21815 }
21816
21817-static int
21818-macio_device_remove(struct device *dev)
21819+static int macio_device_remove(struct device *dev)
21820 {
21821 struct macio_dev * macio_dev = to_macio_device(dev);
21822 struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
21823
21824 if (drv && drv->remove)
21825 drv->remove(macio_dev);
21826+ macio_dev_put(macio_dev);
21827+
21828 return 0;
21829 }
21830
21831-static int
21832-macio_device_suspend(struct device *dev, u32 state, u32 level)
21833+static int macio_device_suspend(struct device *dev, u32 state)
21834 {
21835 struct macio_dev * macio_dev = to_macio_device(dev);
21836- struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
21837+ struct macio_driver * drv;
21838 int error = 0;
21839
21840- if (drv && drv->suspend)
21841- error = drv->suspend(macio_dev, state, level);
21842+ if (macio_dev->ofdev.dev.driver == NULL)
21843+ return 0;
21844+ drv = to_macio_driver(macio_dev->ofdev.dev.driver);
21845+ if (drv->suspend)
21846+ error = drv->suspend(macio_dev, state);
21847 return error;
21848 }
21849
21850-static int
21851-macio_device_resume(struct device * dev, u32 level)
21852+static int macio_device_resume(struct device * dev)
21853 {
21854 struct macio_dev * macio_dev = to_macio_device(dev);
21855- struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
21856+ struct macio_driver * drv;
21857 int error = 0;
21858
21859- if (drv && drv->resume)
21860- error = drv->resume(macio_dev, level);
21861+ if (macio_dev->ofdev.dev.driver == NULL)
21862+ return 0;
21863+ drv = to_macio_driver(macio_dev->ofdev.dev.driver);
21864+ if (drv->resume)
21865+ error = drv->resume(macio_dev);
21866 return error;
21867 }
21868
21869+struct bus_type macio_bus_type = {
21870+ .name = "macio",
21871+ .match = macio_bus_match,
21872+ .suspend = macio_device_suspend,
21873+ .resume = macio_device_resume,
21874+};
21875+
21876+static int __init
21877+macio_bus_driver_init(void)
21878+{
21879+ return bus_register(&macio_bus_type);
21880+}
21881+
21882+postcore_initcall(macio_bus_driver_init);
21883+
21884+
21885+/**
21886+ * macio_release_dev - free a macio device structure when all users of it are finished.
21887+ * @dev: device that's been disconnected
21888+ *
21889+ * Will be called only by the device core when all users of this macio device are
21890+ * done. This currently means never as we don't hot remove any macio device yet,
21891+ * though that will happen with mediabay based devices in a later implementation.
21892+ */
21893+static void macio_release_dev(struct device *dev)
21894+{
21895+ struct macio_dev *mdev;
21896+
21897+ mdev = to_macio_device(dev);
21898+ kfree(mdev);
21899+}
21900+
21901 /**
21902 * macio_add_one_device - Add one device from OF node to the device tree
21903 * @chip: pointer to the macio_chip holding the device
21904@@ -121,13 +163,15 @@
21905 * When media-bay is changed to hotswap drivers, this function will
21906 * be exposed to the bay driver some way...
21907 */
21908-static struct macio_dev *
21909-macio_add_one_device(struct macio_chip *chip, struct device *parent,
21910+static struct macio_dev * macio_add_one_device(struct macio_chip *chip, struct device *parent,
21911 struct device_node *np, struct macio_dev *in_bay)
21912 {
21913 struct macio_dev *dev;
21914 u32 *reg;
21915
21916+ if (np == NULL)
21917+ return NULL;
21918+
21919 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
21920 if (!dev)
21921 return NULL;
21922@@ -140,6 +184,7 @@
21923 dev->ofdev.dev.dma_mask = &dev->ofdev.dma_mask;
21924 dev->ofdev.dev.parent = parent;
21925 dev->ofdev.dev.bus = &macio_bus_type;
21926+ dev->ofdev.dev.release = macio_release_dev;
21927
21928 /* MacIO itself has a different reg, we use it's PCI base */
21929 if (np == chip->of_node) {
21930@@ -164,8 +209,7 @@
21931 return dev;
21932 }
21933
21934-static int
21935-macio_skip_device(struct device_node *np)
21936+static int macio_skip_device(struct device_node *np)
21937 {
21938 if (strncmp(np->name, "battery", 7) == 0)
21939 return 1;
21940@@ -185,10 +229,9 @@
21941 * For now, childs of media-bay are added now as well. This will
21942 * change rsn though.
21943 */
21944-static void
21945-macio_pci_add_devices(struct macio_chip *chip)
21946+static void macio_pci_add_devices(struct macio_chip *chip)
21947 {
21948- struct device_node *np;
21949+ struct device_node *np, *pnode;
21950 struct macio_dev *rdev, *mdev, *mbdev = NULL, *sdev = NULL;
21951 struct device *parent = NULL;
21952
21953@@ -196,16 +239,23 @@
21954 #ifdef CONFIG_PCI
21955 if (chip->lbus.pdev)
21956 parent = &chip->lbus.pdev->dev;
21957-#endif
21958- rdev = macio_add_one_device(chip, parent, chip->of_node, NULL);
21959+#endif
21960+ pnode = of_node_get(chip->of_node);
21961+ if (pnode == NULL)
21962+ return;
21963+
21964+ rdev = macio_add_one_device(chip, parent, pnode, NULL);
21965 if (rdev == NULL)
21966 return;
21967
21968 /* First scan 1st level */
21969- for (np = chip->of_node->child; np != NULL; np = np->sibling) {
21970+ for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
21971 if (!macio_skip_device(np)) {
21972+ of_node_get(np);
21973 mdev = macio_add_one_device(chip, &rdev->ofdev.dev, np, NULL);
21974- if (strncmp(np->name, "media-bay", 9) == 0)
21975+ if (mdev == NULL)
21976+ of_node_put(np);
21977+ else if (strncmp(np->name, "media-bay", 9) == 0)
21978 mbdev = mdev;
21979 else if (strncmp(np->name, "escc", 4) == 0)
21980 sdev = mdev;
21981@@ -213,17 +263,21 @@
21982 }
21983
21984 /* Add media bay devices if any */
21985- if (mbdev) {
21986- for (np = mbdev->ofdev.node->child; np != NULL; np = np->sibling)
21987- if (!macio_skip_device(np))
21988- macio_add_one_device(chip, &mbdev->ofdev.dev, np, mbdev);
21989- }
21990+ if (mbdev)
21991+ for (np = NULL; (np = of_get_next_child(mbdev->ofdev.node, np)) != NULL;)
21992+ if (!macio_skip_device(np)) {
21993+ of_node_get(np);
21994+ if (macio_add_one_device(chip, &mbdev->ofdev.dev, np, mbdev) == NULL)
21995+ of_node_put(np);
21996+ }
21997 /* Add serial ports if any */
21998- if (sdev) {
21999- for (np = sdev->ofdev.node->child; np != NULL; np = np->sibling)
22000- if (!macio_skip_device(np))
22001- macio_add_one_device(chip, &sdev->ofdev.dev, np, NULL);
22002- }
22003+ if (sdev)
22004+ for (np = NULL; (np = of_get_next_child(sdev->ofdev.node, np)) != NULL;)
22005+ if (!macio_skip_device(np)) {
22006+ of_node_get(np);
22007+ if (macio_add_one_device(chip, &sdev->ofdev.dev, np, NULL) == NULL)
22008+ of_node_put(np);
22009+ }
22010 }
22011
22012
22013@@ -231,8 +285,7 @@
22014 * macio_register_driver - Registers a new MacIO device driver
22015 * @drv: pointer to the driver definition structure
22016 */
22017-int
22018-macio_register_driver(struct macio_driver *drv)
22019+int macio_register_driver(struct macio_driver *drv)
22020 {
22021 int count = 0;
22022
22023@@ -240,8 +293,6 @@
22024 drv->driver.name = drv->name;
22025 drv->driver.bus = &macio_bus_type;
22026 drv->driver.probe = macio_device_probe;
22027- drv->driver.resume = macio_device_resume;
22028- drv->driver.suspend = macio_device_suspend;
22029 drv->driver.remove = macio_device_remove;
22030
22031 /* register with core */
22032@@ -253,16 +304,14 @@
22033 * macio_unregister_driver - Unregisters a new MacIO device driver
22034 * @drv: pointer to the driver definition structure
22035 */
22036-void
22037-macio_unregister_driver(struct macio_driver *drv)
22038+void macio_unregister_driver(struct macio_driver *drv)
22039 {
22040 driver_unregister(&drv->driver);
22041 }
22042
22043 #ifdef CONFIG_PCI
22044
22045-static int __devinit
22046-macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
22047+static int __devinit macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
22048 {
22049 struct device_node* np;
22050 struct macio_chip* chip;
22051@@ -270,19 +319,27 @@
22052 if (ent->vendor != PCI_VENDOR_ID_APPLE)
22053 return -ENODEV;
22054
22055+ /* Note regarding refcounting: We assume pci_device_to_OF_node() is ported
22056+ * to new OF APIs and returns a node with refcount incremented. This isn't
22057+ * the case today, but on the other hand ppc32 doesn't do refcounting. This
22058+ * will have to be fixed when going to ppc64. --BenH.
22059+ */
22060 np = pci_device_to_OF_node(pdev);
22061 if (np == NULL)
22062 return -ENODEV;
22063
22064+ /* We also assume that pmac_feature will have done a get() on nodes stored
22065+ * in the macio chips array
22066+ */
22067 chip = macio_find(np, macio_unknown);
22068+ of_node_put(np);
22069 if (chip == NULL)
22070 return -ENODEV;
22071
22072- /* XXX Need locking */
22073+ /* XXX Need locking ??? */
22074 if (chip->lbus.pdev == NULL) {
22075 chip->lbus.pdev = pdev;
22076 chip->lbus.chip = chip;
22077-// INIT_LIST_HEAD(&chip->lbus.devices);
22078 pci_set_drvdata(pdev, &chip->lbus);
22079 pci_set_master(pdev);
22080 }
22081@@ -290,13 +347,28 @@
22082 printk(KERN_INFO "MacIO PCI driver attached to %s chipset\n",
22083 chip->name);
22084
22085+ /*
22086+ * HACK ALERT: The WallStreet PowerBook and some OHare based machines
22087+ * have 2 macio ASICs. I must probe the "main" one first or IDE ordering
22088+ * will be incorrect. So I put on "hold" the second one since it seem to
22089+ * appear first on PCI
22090+ */
22091+ if (chip->type == macio_gatwick || chip->type == macio_ohareII)
22092+ if (macio_chips[0].lbus.pdev == NULL) {
22093+ macio_on_hold = chip;
22094+ return 0;
22095+ }
22096+
22097 macio_pci_add_devices(chip);
22098+ if (macio_on_hold && macio_chips[0].lbus.pdev != NULL) {
22099+ macio_pci_add_devices(macio_on_hold);
22100+ macio_on_hold = NULL;
22101+ }
22102
22103 return 0;
22104 }
22105
22106-static void __devexit
22107-macio_pci_remove(struct pci_dev* pdev)
22108+static void __devexit macio_pci_remove(struct pci_dev* pdev)
22109 {
22110 panic("removing of macio-asic not supported !\n");
22111 }
22112@@ -306,10 +378,10 @@
22113 * will then decide wether it applies or not
22114 */
22115 static const struct pci_device_id __devinitdata pci_ids [] = { {
22116- .vendor = PCI_VENDOR_ID_APPLE,
22117- .device = PCI_ANY_ID,
22118- .subvendor = PCI_ANY_ID,
22119- .subdevice = PCI_ANY_ID,
22120+ .vendor = PCI_VENDOR_ID_APPLE,
22121+ .device = PCI_ANY_ID,
22122+ .subvendor = PCI_ANY_ID,
22123+ .subdevice = PCI_ANY_ID,
22124
22125 }, { /* end: all zeroes */ }
22126 };
22127@@ -317,17 +389,16 @@
22128
22129 /* pci driver glue; this is a "new style" PCI driver module */
22130 static struct pci_driver macio_pci_driver = {
22131- .name = (char *) "macio",
22132- .id_table = pci_ids,
22133+ .name = (char *) "macio",
22134+ .id_table = pci_ids,
22135
22136- .probe = macio_pci_probe,
22137- .remove = macio_pci_remove,
22138+ .probe = macio_pci_probe,
22139+ .remove = macio_pci_remove,
22140 };
22141
22142 #endif /* CONFIG_PCI */
22143
22144-static int __init
22145-macio_module_init (void)
22146+static int __init macio_module_init (void)
22147 {
22148 #ifdef CONFIG_PCI
22149 int rc;
22150@@ -339,17 +410,9 @@
22151 return 0;
22152 }
22153
22154-/*
22155-static void __exit
22156-macio_module_cleanup (void)
22157-{
22158-#ifdef CONFIG_PCI
22159- pci_unregister_driver(&macio_pci_driver);
22160-#endif
22161-}
22162-module_exit(macio_module_cleanup);
22163-*/
22164 module_init(macio_module_init);
22165
22166 EXPORT_SYMBOL(macio_register_driver);
22167 EXPORT_SYMBOL(macio_unregister_driver);
22168+EXPORT_SYMBOL(macio_dev_get);
22169+EXPORT_SYMBOL(macio_dev_put);
22170diff -Nru a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
22171--- a/drivers/macintosh/mediabay.c Sat Mar 22 01:11:14 2003
22172+++ b/drivers/macintosh/mediabay.c Mon Aug 25 09:51:43 2003
22173@@ -37,15 +37,7 @@
22174 #include <linux/adb.h>
22175 #include <linux/pmu.h>
22176
22177-#ifdef CONFIG_PMAC_PBOOK
22178-static int mb_notify_sleep(struct pmu_sleep_notifier *self, int when);
22179-static struct pmu_sleep_notifier mb_sleep_notifier = {
22180- mb_notify_sleep,
22181- SLEEP_LEVEL_MEDIABAY,
22182-};
22183-#endif
22184
22185-#undef MB_USE_INTERRUPTS
22186 #define MB_DEBUG
22187 #define MB_IGNORE_SIGNALS
22188
22189@@ -55,13 +47,6 @@
22190 #define MBDBG(fmt, arg...) do { } while (0)
22191 #endif
22192
22193-/* Type of media bay */
22194-enum {
22195- mb_ohare,
22196- mb_heathrow,
22197- mb_keylargo
22198-};
22199-
22200 #define MB_FCR32(bay, r) ((bay)->base + ((r) >> 2))
22201 #define MB_FCR8(bay, r) (((volatile u8*)((bay)->base)) + (r))
22202
22203@@ -76,11 +61,12 @@
22204
22205 struct mb_ops {
22206 char* name;
22207- u8 (*content)(struct media_bay_info* bay);
22208- void (*power)(struct media_bay_info* bay, int on_off);
22209- int (*setup_bus)(struct media_bay_info* bay, u8 device_id);
22210- void (*un_reset)(struct media_bay_info* bay);
22211- void (*un_reset_ide)(struct media_bay_info* bay);
22212+ void (*init)(struct media_bay_info *bay);
22213+ u8 (*content)(struct media_bay_info *bay);
22214+ void (*power)(struct media_bay_info *bay, int on_off);
22215+ int (*setup_bus)(struct media_bay_info *bay, u8 device_id);
22216+ void (*un_reset)(struct media_bay_info *bay);
22217+ void (*un_reset_ide)(struct media_bay_info *bay);
22218 };
22219
22220 struct media_bay_info {
22221@@ -90,11 +76,12 @@
22222 int last_value;
22223 int value_count;
22224 int timer;
22225- struct device_node* dev_node;
22226- int mb_type;
22227+ struct macio_dev *mdev;
22228 struct mb_ops* ops;
22229 int index;
22230 int cached_gpio;
22231+ int sleeping;
22232+ struct semaphore lock;
22233 #ifdef CONFIG_BLK_DEV_IDE
22234 unsigned long cd_base;
22235 int cd_index;
22236@@ -111,13 +98,13 @@
22237 #ifdef CONFIG_BLK_DEV_IDE
22238 /* check the busy bit in the media-bay ide interface
22239 (assumes the media-bay contains an ide device) */
22240-#define MB_IDE_READY(i) ((inb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
22241+#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
22242 #endif
22243
22244 /* Note: All delays are not in milliseconds and converted to HZ relative
22245 * values by the macro below
22246 */
22247-#define MS_TO_HZ(ms) ((ms * HZ) / 1000)
22248+#define MS_TO_HZ(ms) ((ms * HZ + 999) / 1000)
22249
22250 /*
22251 * Consider the media-bay ID value stable if it is the same for
22252@@ -352,38 +339,37 @@
22253 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
22254 }
22255
22256-static void __pmac
22257-heathrow_mb_un_reset(struct media_bay_info* bay)
22258+static void __pmac keylargo_mb_init(struct media_bay_info *bay)
22259+{
22260+ MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
22261+}
22262+
22263+static void __pmac heathrow_mb_un_reset(struct media_bay_info* bay)
22264 {
22265 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
22266 }
22267
22268-static void __pmac
22269-keylargo_mb_un_reset(struct media_bay_info* bay)
22270+static void __pmac keylargo_mb_un_reset(struct media_bay_info* bay)
22271 {
22272 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
22273 }
22274
22275-static void __pmac
22276-ohare_mb_un_reset_ide(struct media_bay_info* bay)
22277+static void __pmac ohare_mb_un_reset_ide(struct media_bay_info* bay)
22278 {
22279 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
22280 }
22281
22282-static void __pmac
22283-heathrow_mb_un_reset_ide(struct media_bay_info* bay)
22284+static void __pmac heathrow_mb_un_reset_ide(struct media_bay_info* bay)
22285 {
22286 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
22287 }
22288
22289-static void __pmac
22290-keylargo_mb_un_reset_ide(struct media_bay_info* bay)
22291+static void __pmac keylargo_mb_un_reset_ide(struct media_bay_info* bay)
22292 {
22293 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
22294 }
22295
22296-static inline void __pmac
22297-set_mb_power(struct media_bay_info* bay, int onoff)
22298+static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff)
22299 {
22300 /* Power up up and assert the bay reset line */
22301 if (onoff) {
22302@@ -399,8 +385,7 @@
22303 bay->timer = MS_TO_HZ(MB_POWER_DELAY);
22304 }
22305
22306-static void __pmac
22307-poll_media_bay(struct media_bay_info* bay)
22308+static void __pmac poll_media_bay(struct media_bay_info* bay)
22309 {
22310 int id = bay->ops->content(bay);
22311
22312@@ -429,15 +414,13 @@
22313 }
22314 }
22315
22316-int __pmac
22317-check_media_bay(struct device_node *which_bay, int what)
22318+int __pmac check_media_bay(struct device_node *which_bay, int what)
22319 {
22320 #ifdef CONFIG_BLK_DEV_IDE
22321 int i;
22322
22323 for (i=0; i<media_bay_count; i++)
22324- if (which_bay == media_bays[i].dev_node)
22325- {
22326+ if (media_bays[i].mdev && which_bay == media_bays[i].mdev->ofdev.node) {
22327 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
22328 return 0;
22329 media_bays[i].cd_index = -1;
22330@@ -447,15 +430,13 @@
22331 return -ENODEV;
22332 }
22333
22334-int __pmac
22335-check_media_bay_by_base(unsigned long base, int what)
22336+int __pmac check_media_bay_by_base(unsigned long base, int what)
22337 {
22338 #ifdef CONFIG_BLK_DEV_IDE
22339 int i;
22340
22341 for (i=0; i<media_bay_count; i++)
22342- if (base == media_bays[i].cd_base)
22343- {
22344+ if (media_bays[i].mdev && base == media_bays[i].cd_base) {
22345 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
22346 return 0;
22347 media_bays[i].cd_index = -1;
22348@@ -466,42 +447,47 @@
22349 return -ENODEV;
22350 }
22351
22352-int __pmac
22353-media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
22354+int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
22355 int irq, int index)
22356 {
22357 #ifdef CONFIG_BLK_DEV_IDE
22358 int i;
22359
22360- for (i=0; i<media_bay_count; i++)
22361- if (which_bay == media_bays[i].dev_node)
22362- {
22363+ for (i=0; i<media_bay_count; i++) {
22364+ struct media_bay_info* bay = &media_bays[i];
22365+
22366+ if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
22367 int timeout = 5000;
22368
22369- media_bays[i].cd_base = base;
22370- media_bays[i].cd_irq = irq;
22371+ down(&bay->lock);
22372
22373- if ((MB_CD != media_bays[i].content_id) || media_bays[i].state != mb_up)
22374- return 0;
22375+ bay->cd_base = base;
22376+ bay->cd_irq = irq;
22377
22378- printk(KERN_DEBUG "Registered ide %d for media bay %d\n", index, i);
22379+ if ((MB_CD != bay->content_id) || bay->state != mb_up) {
22380+ up(&bay->lock);
22381+ return 0;
22382+ }
22383+ printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
22384 do {
22385 if (MB_IDE_READY(i)) {
22386- media_bays[i].cd_index = index;
22387+ bay->cd_index = index;
22388+ up(&bay->lock);
22389 return 0;
22390 }
22391 mdelay(1);
22392 } while(--timeout);
22393 printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
22394+ up(&bay->lock);
22395 return -ENODEV;
22396 }
22397-#endif
22398+ }
22399+#endif /* CONFIG_BLK_DEV_IDE */
22400
22401 return -ENODEV;
22402 }
22403
22404-static void __pmac
22405-media_bay_step(int i)
22406+static void __pmac media_bay_step(int i)
22407 {
22408 struct media_bay_info* bay = &media_bays[i];
22409
22410@@ -567,6 +553,7 @@
22411 if (bay->cd_index < 0) {
22412 hw_regs_t hw;
22413
22414+ printk("mediabay %d, registering IDE...\n", i);
22415 pmu_suspend();
22416 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
22417 hw.irq = bay->cd_irq;
22418@@ -580,13 +567,15 @@
22419 printk("IDE register error\n");
22420 set_mb_power(bay, 0);
22421 } else {
22422- printk(KERN_DEBUG "media-bay %d is ide %d\n", i, bay->cd_index);
22423+ printk(KERN_DEBUG "media-bay %d is ide%d\n", i, bay->cd_index);
22424 MBDBG("mediabay %d IDE ready\n", i);
22425 }
22426 break;
22427- }
22428+ } else if (bay->timer > 0)
22429+ bay->timer--;
22430 if (bay->timer == 0) {
22431- printk("\nIDE Timeout in bay %d !\n", i);
22432+ printk("\nIDE Timeout in bay %d !, IDE state is: 0x%02x\n",
22433+ i, readb(bay->cd_base + 0x70));
22434 MBDBG("mediabay%d: nIDE Timeout !\n", i);
22435 set_mb_power(bay, 0);
22436 }
22437@@ -623,8 +612,7 @@
22438 * with the IDE driver. It needs to be a thread because
22439 * ide_register can't be called from interrupt context.
22440 */
22441-static int __pmac
22442-media_bay_task(void *x)
22443+static int __pmac media_bay_task(void *x)
22444 {
22445 int i;
22446
22447@@ -634,75 +622,140 @@
22448 #endif
22449
22450 for (;;) {
22451- for (i = 0; i < media_bay_count; ++i)
22452- media_bay_step(i);
22453+ for (i = 0; i < media_bay_count; ++i) {
22454+ down(&media_bays[i].lock);
22455+ if (!media_bays[i].sleeping)
22456+ media_bay_step(i);
22457+ up(&media_bays[i].lock);
22458+ }
22459
22460 current->state = TASK_INTERRUPTIBLE;
22461- schedule_timeout(1);
22462+ schedule_timeout(MS_TO_HZ(10));
22463 if (signal_pending(current))
22464 return 0;
22465 }
22466 }
22467
22468-#ifdef MB_USE_INTERRUPTS
22469-static void __pmac
22470-media_bay_intr(int irq, void *devid, struct pt_regs *regs)
22471-{
22472-}
22473-#endif
22474-
22475-#ifdef CONFIG_PMAC_PBOOK
22476-/*
22477- * notify clients before sleep and reset bus afterwards
22478- */
22479-int __pmac
22480-mb_notify_sleep(struct pmu_sleep_notifier *self, int when)
22481+static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_match *match)
22482 {
22483 struct media_bay_info* bay;
22484+ volatile u32 *regbase;
22485+ struct device_node *ofnode;
22486 int i;
22487+
22488+ ofnode = mdev->ofdev.node;
22489+
22490+ if (!request_OF_resource(ofnode, 0, NULL))
22491+ return -ENXIO;
22492+
22493+ /* Media bay registers are located at the beginning of the
22494+ * mac-io chip, we get the parent address for now (hrm...)
22495+ */
22496+ if (ofnode->parent->n_addrs == 0)
22497+ return -ENODEV;
22498+ regbase = (volatile u32 *)ioremap(ofnode->parent->addrs[0].address, 0x100);
22499+ if (regbase == NULL) {
22500+ release_OF_resource(ofnode, 0);
22501+ return -ENOMEM;
22502+ }
22503
22504- switch (when) {
22505- case PBOOK_SLEEP_REQUEST:
22506- case PBOOK_SLEEP_REJECT:
22507- break;
22508-
22509- case PBOOK_SLEEP_NOW:
22510- for (i=0; i<media_bay_count; i++) {
22511- bay = &media_bays[i];
22512- set_mb_power(bay, 0);
22513- mdelay(10);
22514- }
22515- break;
22516- case PBOOK_WAKE:
22517- for (i=0; i<media_bay_count; i++) {
22518- bay = &media_bays[i];
22519- /* We re-enable the bay using it's previous content
22520- only if it did not change. Note those bozo timings,
22521- they seem to help the 3400 get it right.
22522- */
22523- /* Force MB power to 0 */
22524- set_mb_power(bay, 0);
22525- mdelay(MB_POWER_DELAY);
22526- if (bay->ops->content(bay) != bay->content_id)
22527- continue;
22528- set_mb_power(bay, 1);
22529- bay->last_value = bay->content_id;
22530- bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
22531- bay->timer = MS_TO_HZ(MB_POWER_DELAY);
22532-#ifdef CONFIG_BLK_DEV_IDE
22533- bay->cd_retry = 0;
22534-#endif
22535- do {
22536- mdelay(1000/HZ);
22537- media_bay_step(i);
22538- } while((media_bays[i].state != mb_empty) &&
22539- (media_bays[i].state != mb_up));
22540- }
22541- break;
22542+ i = media_bay_count++;
22543+ bay = &media_bays[i];
22544+ bay->mdev = mdev;
22545+ bay->base = regbase;
22546+ bay->index = i;
22547+ bay->ops = match->data;
22548+ bay->sleeping = 0;
22549+ init_MUTEX(&bay->lock);
22550+
22551+ /* Init HW probing */
22552+ if (bay->ops->init)
22553+ bay->ops->init(bay);
22554+
22555+ printk(KERN_INFO "mediabay%d: Registered %s media-bay\n", i, bay->ops->name);
22556+
22557+ /* Force an immediate detect */
22558+ set_mb_power(bay, 0);
22559+ set_current_state(TASK_UNINTERRUPTIBLE);
22560+ schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
22561+ bay->content_id = MB_NO;
22562+ bay->last_value = bay->ops->content(bay);
22563+ bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
22564+ bay->state = mb_empty;
22565+ do {
22566+ set_current_state(TASK_UNINTERRUPTIBLE);
22567+ schedule_timeout(MS_TO_HZ(10));
22568+ media_bay_step(i);
22569+ } while((bay->state != mb_empty) &&
22570+ (bay->state != mb_up));
22571+
22572+ /* Mark us ready by filling our mdev data */
22573+ dev_set_drvdata(&mdev->ofdev.dev, bay);
22574+
22575+ /* Startup kernel thread */
22576+ if (i == 0)
22577+ kernel_thread(media_bay_task, NULL,
22578+ CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
22579+
22580+ return 0;
22581+
22582+}
22583+
22584+static int __pmac media_bay_suspend(struct macio_dev *mdev, u32 state)
22585+{
22586+ struct media_bay_info *bay = dev_get_drvdata(&mdev->ofdev.dev);
22587+
22588+ if (state != mdev->ofdev.dev.power_state && state >= 2) {
22589+ down(&bay->lock);
22590+ bay->sleeping = 1;
22591+ set_mb_power(bay, 0);
22592+ up(&bay->lock);
22593+ set_current_state(TASK_UNINTERRUPTIBLE);
22594+ schedule_timeout(MS_TO_HZ(10));
22595+ mdev->ofdev.dev.power_state = state;
22596 }
22597- return PBOOK_SLEEP_OK;
22598+ return 0;
22599+}
22600+
22601+static int __pmac media_bay_resume(struct macio_dev *mdev)
22602+{
22603+ struct media_bay_info *bay = dev_get_drvdata(&mdev->ofdev.dev);
22604+
22605+ if (mdev->ofdev.dev.power_state != 0) {
22606+ mdev->ofdev.dev.power_state = 0;
22607+
22608+ /* We re-enable the bay using it's previous content
22609+ only if it did not change. Note those bozo timings,
22610+ they seem to help the 3400 get it right.
22611+ */
22612+ /* Force MB power to 0 */
22613+ down(&bay->lock);
22614+ set_mb_power(bay, 0);
22615+ set_current_state(TASK_UNINTERRUPTIBLE);
22616+ schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
22617+ if (bay->ops->content(bay) != bay->content_id) {
22618+ printk("mediabay%d: content changed during sleep...\n", bay->index);
22619+ up(&bay->lock);
22620+ return 0;
22621+ }
22622+ set_mb_power(bay, 1);
22623+ bay->last_value = bay->content_id;
22624+ bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
22625+ bay->timer = MS_TO_HZ(MB_POWER_DELAY);
22626+#ifdef CONFIG_BLK_DEV_IDE
22627+ bay->cd_retry = 0;
22628+#endif
22629+ do {
22630+ set_current_state(TASK_UNINTERRUPTIBLE);
22631+ schedule_timeout(MS_TO_HZ(10));
22632+ media_bay_step(bay->index);
22633+ } while((bay->state != mb_empty) &&
22634+ (bay->state != mb_up));
22635+ bay->sleeping = 0;
22636+ up(&bay->lock);
22637+ }
22638+ return 0;
22639 }
22640-#endif /* CONFIG_PMAC_PBOOK */
22641
22642
22643 /* Definitions of "ops" structures.
22644@@ -727,6 +780,7 @@
22645
22646 static struct mb_ops keylargo_mb_ops __pmacdata = {
22647 .name = "KeyLargo",
22648+ .init = keylargo_mb_init,
22649 .content = keylargo_mb_content,
22650 .power = keylargo_mb_power,
22651 .setup_bus = keylargo_mb_setup_bus,
22652@@ -743,12 +797,42 @@
22653 * Therefore we do it all by polling the media bay once each tick.
22654 */
22655
22656-static int __init
22657-media_bay_init(void)
22658+static struct of_match media_bay_match[] =
22659 {
22660- struct device_node *np;
22661- int n,i;
22662-
22663+ {
22664+ .name = "media-bay",
22665+ .type = OF_ANY_MATCH,
22666+ .compatible = "keylargo-media-bay",
22667+ .data = &keylargo_mb_ops,
22668+ },
22669+ {
22670+ .name = "media-bay",
22671+ .type = OF_ANY_MATCH,
22672+ .compatible = "heathrow-media-bay",
22673+ .data = &heathrow_mb_ops,
22674+ },
22675+ {
22676+ .name = "media-bay",
22677+ .type = OF_ANY_MATCH,
22678+ .compatible = "ohare-media-bay",
22679+ .data = &ohare_mb_ops,
22680+ },
22681+ {},
22682+};
22683+
22684+static struct macio_driver media_bay_driver =
22685+{
22686+ .name = "media-bay",
22687+ .match_table = media_bay_match,
22688+ .probe = media_bay_attach,
22689+ .suspend = media_bay_suspend,
22690+ .resume = media_bay_resume
22691+};
22692+
22693+static int __init media_bay_init(void)
22694+{
22695+ int i;
22696+
22697 for (i=0; i<MAX_BAYS; i++) {
22698 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info));
22699 media_bays[i].content_id = -1;
22700@@ -756,84 +840,12 @@
22701 media_bays[i].cd_index = -1;
22702 #endif
22703 }
22704-
22705- np = find_devices("media-bay");
22706- n = 0;
22707- while(np && (n<MAX_BAYS)) {
22708- struct media_bay_info* bay = &media_bays[n];
22709- if (!np->parent || np->n_addrs == 0 || !request_OF_resource(np, 0, NULL)) {
22710- np = np->next;
22711- printk(KERN_ERR "media-bay: Can't request IO resource !\n");
22712- continue;
22713- }
22714- bay->mb_type = mb_ohare;
22715-
22716- if (device_is_compatible(np, "keylargo-media-bay")) {
22717- bay->mb_type = mb_keylargo;
22718- bay->ops = &keylargo_mb_ops;
22719- } else if (device_is_compatible(np, "heathrow-media-bay")) {
22720- bay->mb_type = mb_heathrow;
22721- bay->ops = &heathrow_mb_ops;
22722- } else if (device_is_compatible(np, "ohare-media-bay")) {
22723- bay->mb_type = mb_ohare;
22724- bay->ops = &ohare_mb_ops;
22725- } else {
22726- printk(KERN_ERR "mediabay: Unknown bay type !\n");
22727- np = np->next;
22728- continue;
22729- }
22730- bay->base = (volatile u32*)ioremap(np->parent->addrs[0].address, 0x1000);
22731-
22732- /* Enable probe logic on keylargo */
22733- if (bay->mb_type == mb_keylargo)
22734- MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
22735-#ifdef MB_USE_INTERRUPTS
22736- if (np->n_intrs == 0) {
22737- printk(KERN_ERR "media bay %d has no irq\n",n);
22738- np = np->next;
22739- continue;
22740- }
22741-
22742- if (request_irq(np->intrs[0].line, media_bay_intr, 0, "Media bay", (void *)n)) {
22743- printk(KERN_ERR "Couldn't get IRQ %d for media bay %d\n",
22744- np->intrs[0].line, n);
22745- np = np->next;
22746- continue;
22747- }
22748-#endif
22749- media_bay_count++;
22750-
22751- printk(KERN_INFO "mediabay%d: Registered %s media-bay\n", n, bay->ops->name);
22752- bay->dev_node = np;
22753- bay->index = n;
22754-
22755- /* Force an immediate detect */
22756- set_mb_power(bay, 0);
22757- mdelay(MB_POWER_DELAY);
22758- bay->content_id = MB_NO;
22759- bay->last_value = bay->ops->content(bay);
22760- bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
22761- bay->state = mb_empty;
22762- do {
22763- mdelay(1000/HZ);
22764- media_bay_step(n);
22765- } while((bay->state != mb_empty) &&
22766- (bay->state != mb_up));
22767-
22768- n++;
22769- np=np->next;
22770- }
22771+ if (_machine != _MACH_Pmac)
22772+ return -ENODEV;
22773
22774- if (media_bay_count)
22775- {
22776-#ifdef CONFIG_PMAC_PBOOK
22777- pmu_register_sleep_notifier(&mb_sleep_notifier);
22778-#endif /* CONFIG_PMAC_PBOOK */
22779+ macio_register_driver(&media_bay_driver);
22780
22781- kernel_thread(media_bay_task, NULL,
22782- CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
22783- }
22784 return 0;
22785 }
22786
22787-subsys_initcall(media_bay_init);
22788+device_initcall(media_bay_init);
22789diff -Nru a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
22790--- a/drivers/macintosh/via-pmu.c Sat Jun 7 00:46:48 2003
22791+++ b/drivers/macintosh/via-pmu.c Mon Aug 25 10:06:34 2003
22792@@ -11,6 +11,14 @@
22793 * Copyright (C) 1998 Paul Mackerras and Fabio Riccardi.
22794 * Copyright (C) 2001-2002 Benjamin Herrenschmidt
22795 *
22796+ * THIS DRIVER IS BECOMING A TOTAL MESS !
22797+ * - Cleanup atomically disabling reply to PMU events after
22798+ * a sleep or a freq. switch
22799+ * - Move sleep code out of here to pmac_pm, merge into new
22800+ * common PM infrastructure
22801+ * - Move backlight code out as well
22802+ * - Save/Restore PCI space properly
22803+ *
22804 */
22805 #include <stdarg.h>
22806 #include <linux/config.h>
22807@@ -34,6 +42,8 @@
22808 #include <linux/proc_fs.h>
22809 #include <linux/init.h>
22810 #include <linux/interrupt.h>
22811+#include <linux/device.h>
22812+#include <linux/suspend.h>
22813 #include <asm/prom.h>
22814 #include <asm/machdep.h>
22815 #include <asm/io.h>
22816@@ -47,6 +57,7 @@
22817 #include <asm/mmu_context.h>
22818 #include <asm/cputable.h>
22819 #include <asm/time.h>
22820+#include <asm/xmon.h>
22821 #ifdef CONFIG_PMAC_BACKLIGHT
22822 #include <asm/backlight.h>
22823 #endif
22824@@ -55,7 +66,6 @@
22825 #undef SUSPEND_USES_PMU
22826 #define DEBUG_SLEEP
22827 #undef HACKED_PCI_SAVE
22828-#define NEW_OHARE_CODE
22829
22830 /* Misc minor number allocated for /dev/pmu */
22831 #define PMU_MINOR 154
22832@@ -63,6 +73,13 @@
22833 /* How many iterations between battery polls */
22834 #define BATTERY_POLLING_COUNT 2
22835
22836+/* Some debugging tools */
22837+#ifdef CONFIG_XMON
22838+//#define LIVE_DEBUG(req) ((req) && (req)->data[0] == 0x7d)
22839+#define LIVE_DEBUG(req) (0)
22840+static int whacky_debug;
22841+#endif /* CONFIG_XMON */
22842+
22843 static volatile unsigned char *via;
22844
22845 /* VIA registers - spaced 0x200 bytes apart */
22846@@ -106,6 +123,7 @@
22847 intack,
22848 reading,
22849 reading_intr,
22850+ locked,
22851 } pmu_state;
22852
22853 static volatile enum int_data_state {
22854@@ -133,6 +151,7 @@
22855 static int pmu_has_adb;
22856 static unsigned char *gpio_reg = NULL;
22857 static int gpio_irq = -1;
22858+static int gpio_irq_enabled = -1;
22859 static volatile int pmu_suspended = 0;
22860 static spinlock_t pmu_lock;
22861 static u8 pmu_intr_mask;
22862@@ -143,9 +162,11 @@
22863 static int sleep_in_progress;
22864 static int can_sleep;
22865 #endif /* CONFIG_PMAC_PBOOK */
22866+static unsigned int pmu_irq_stats[11];
22867
22868 static struct proc_dir_entry *proc_pmu_root;
22869 static struct proc_dir_entry *proc_pmu_info;
22870+static struct proc_dir_entry *proc_pmu_irqstats;
22871 static struct proc_dir_entry *proc_pmu_options;
22872
22873 #ifdef CONFIG_PMAC_PBOOK
22874@@ -184,6 +205,8 @@
22875 static irqreturn_t gpio1_interrupt(int irq, void *arg, struct pt_regs *regs);
22876 static int proc_get_info(char *page, char **start, off_t off,
22877 int count, int *eof, void *data);
22878+static int proc_get_irqstats(char *page, char **start, off_t off,
22879+ int count, int *eof, void *data);
22880 #ifdef CONFIG_PMAC_BACKLIGHT
22881 static int pmu_set_backlight_level(int level, void* data);
22882 static int pmu_set_backlight_enable(int on, int level, void* data);
22883@@ -205,16 +228,12 @@
22884 pmu_init,
22885 pmu_send_request,
22886 pmu_adb_autopoll,
22887- pmu_poll,
22888+ pmu_poll_adb,
22889 pmu_adb_reset_bus
22890 };
22891 #endif /* CONFIG_ADB */
22892
22893 extern void low_sleep_handler(void);
22894-extern void pmac_sleep_save_intrs(int);
22895-extern void pmac_sleep_restore_intrs(void);
22896-extern void openpic_sleep_save_intrs(void);
22897-extern void openpic_sleep_restore_intrs(void);
22898 extern void enable_kernel_altivec(void);
22899 extern void enable_kernel_fp(void);
22900
22901@@ -223,14 +242,6 @@
22902 int pmu_wink(struct adb_request *req);
22903 #endif
22904
22905-#if defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM)
22906-static int generic_notify_sleep(struct pmu_sleep_notifier *self, int when);
22907-static struct pmu_sleep_notifier generic_sleep_notifier = {
22908- generic_notify_sleep,
22909- SLEEP_LEVEL_MISC,
22910-};
22911-#endif /* defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM) */
22912-
22913 /*
22914 * This table indicates for each PMU opcode:
22915 * - the number of data bytes to be sent with the command, or -1
22916@@ -361,11 +372,6 @@
22917
22918 sys_ctrler = SYS_CTRLER_PMU;
22919
22920-#if defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM)
22921- pmu_register_sleep_notifier(&generic_sleep_notifier);
22922- pm_active = 1;
22923-#endif
22924-
22925 return 1;
22926 }
22927
22928@@ -416,6 +422,7 @@
22929 if (pmu_kind == PMU_KEYLARGO_BASED && gpio_irq != -1) {
22930 if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1/ADB", (void *)0))
22931 printk(KERN_ERR "pmu: can't get irq %d (GPIO1)\n", gpio_irq);
22932+ gpio_irq_enabled = 1;
22933 }
22934
22935 /* Enable interrupts */
22936@@ -489,6 +496,8 @@
22937 int i;
22938 proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root,
22939 proc_get_info, NULL);
22940+ proc_pmu_irqstats = create_proc_read_entry("interrupts", 0, proc_pmu_root,
22941+ proc_get_irqstats, NULL);
22942 #ifdef CONFIG_PMAC_PBOOK
22943 for (i=0; i<pmu_battery_count; i++) {
22944 char title[16];
22945@@ -552,15 +561,14 @@
22946
22947 /* Read PMU version */
22948 pmu_request(&req, NULL, 1, PMU_GET_VERSION);
22949- while (!req.complete)
22950- pmu_poll();
22951+ pmu_wait_complete(&req);
22952 if (req.reply_len > 0)
22953 pmu_version = req.reply[0];
22954
22955 return 1;
22956 }
22957
22958-int __pmac
22959+int
22960 pmu_get_model(void)
22961 {
22962 return pmu_kind;
22963@@ -774,6 +782,33 @@
22964 return p - page;
22965 }
22966
22967+static int __pmac
22968+proc_get_irqstats(char *page, char **start, off_t off,
22969+ int count, int *eof, void *data)
22970+{
22971+ int i;
22972+ char* p = page;
22973+ static const char *irq_names[] = {
22974+ "Total CB1 triggered events",
22975+ "Total GPIO1 triggered events",
22976+ "PC-Card eject button",
22977+ "Sound/Brightness button",
22978+ "ADB message",
22979+ "Battery state change",
22980+ "Environment interrupt",
22981+ "Tick timer",
22982+ "Ghost interrupt (zero len)",
22983+ "Empty interrupt (empty mask)",
22984+ "Max irqs in a row"
22985+ };
22986+
22987+ for (i=0; i<11; i++) {
22988+ p += sprintf(p, " %2u: %10u (%s)\n",
22989+ i, pmu_irq_stats[i], irq_names[i]);
22990+ }
22991+ return p - page;
22992+}
22993+
22994 #ifdef CONFIG_PMAC_PBOOK
22995 static int __pmac
22996 proc_get_batt(char *page, char **start, off_t off,
22997@@ -982,8 +1017,7 @@
22998 printk(KERN_ERR "pmu_adb_reset_bus: pmu_queue_request failed\n");
22999 return -EIO;
23000 }
23001- while (!req.complete)
23002- pmu_poll();
23003+ pmu_wait_complete(&req);
23004
23005 if (save_autopoll != 0)
23006 pmu_adb_autopoll(save_autopoll);
23007@@ -1133,6 +1167,12 @@
23008 wait_for_ack();
23009 /* set the shift register to shift out and send a byte */
23010 send_byte(req->data[0]);
23011+#ifdef CONFIG_XMON
23012+ if (LIVE_DEBUG(req))
23013+ xmon_printf("R");
23014+ else
23015+ whacky_debug = 0;
23016+#endif /* CONFIG_XMON */
23017 }
23018
23019 void __openfirmware
23020@@ -1142,15 +1182,33 @@
23021 return;
23022 if (disable_poll)
23023 return;
23024+ via_pmu_interrupt(0, 0, 0);
23025+}
23026+
23027+void __openfirmware
23028+pmu_poll_adb(void)
23029+{
23030+ if (!via)
23031+ return;
23032+ if (disable_poll)
23033+ return;
23034 /* Kicks ADB read when PMU is suspended */
23035- if (pmu_suspended)
23036- adb_int_pending = 1;
23037+ adb_int_pending = 1;
23038 do {
23039 via_pmu_interrupt(0, 0, 0);
23040 } while (pmu_suspended && (adb_int_pending || pmu_state != idle
23041 || req_awaiting_reply));
23042 }
23043
23044+void __openfirmware
23045+pmu_wait_complete(struct adb_request *req)
23046+{
23047+ if (!via)
23048+ return;
23049+ while((pmu_state != idle && pmu_state != locked) || !req->complete)
23050+ via_pmu_interrupt(0, 0, 0);
23051+}
23052+
23053 /* This function loops until the PMU is idle and prevents it from
23054 * anwsering to ADB interrupts. pmu_request can still be called.
23055 * This is done to avoid spurrious shutdowns when we know we'll have
23056@@ -1175,6 +1233,8 @@
23057
23058 do {
23059 spin_unlock_irqrestore(&pmu_lock, flags);
23060+ if (req_awaiting_reply)
23061+ adb_int_pending = 1;
23062 via_pmu_interrupt(0, 0, 0);
23063 spin_lock_irqsave(&pmu_lock, flags);
23064 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
23065@@ -1185,7 +1245,7 @@
23066 pmu_poll();
23067 #else /* SUSPEND_USES_PMU */
23068 if (gpio_irq >= 0)
23069- disable_irq(gpio_irq);
23070+ disable_irq_nosync(gpio_irq);
23071 out_8(&via[IER], CB1_INT | IER_CLR);
23072 spin_unlock_irqrestore(&pmu_lock, flags);
23073 #endif /* SUSPEND_USES_PMU */
23074@@ -1227,16 +1287,47 @@
23075 static void __pmac
23076 pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs)
23077 {
23078+ unsigned char ints, pirq;
23079+ int i = 0;
23080+
23081 asleep = 0;
23082 if (drop_interrupts || len < 1) {
23083 adb_int_pending = 0;
23084+ pmu_irq_stats[8]++;
23085+ return;
23086+ }
23087+
23088+ /* Get PMU interrupt mask */
23089+ ints = data[0];
23090+
23091+ /* Record zero interrupts for stats */
23092+ if (ints == 0)
23093+ pmu_irq_stats[9]++;
23094+
23095+ /* Hack to deal with ADB autopoll flag */
23096+ if (ints & PMU_INT_ADB)
23097+ ints &= ~(PMU_INT_ADB_AUTO | PMU_INT_AUTO_SRQ_POLL);
23098+
23099+next:
23100+
23101+ if (ints == 0) {
23102+ if (i > pmu_irq_stats[10])
23103+ pmu_irq_stats[10] = i;
23104 return;
23105 }
23106+
23107+ for (pirq = 0; pirq < 8; pirq++)
23108+ if (ints & (1 << pirq))
23109+ break;
23110+ pmu_irq_stats[pirq]++;
23111+ i++;
23112+ ints &= ~(1 << pirq);
23113+
23114 /* Note: for some reason, we get an interrupt with len=1,
23115 * data[0]==0 after each normal ADB interrupt, at least
23116 * on the Pismo. Still investigating... --BenH
23117 */
23118- if (data[0] & PMU_INT_ADB) {
23119+ if ((1 << pirq) & PMU_INT_ADB) {
23120 if ((data[0] & PMU_INT_ADB_AUTO) == 0) {
23121 struct adb_request *req = req_awaiting_reply;
23122 if (req == 0) {
23123@@ -1274,29 +1365,37 @@
23124 adb_input(data+1, len-1, regs, 1);
23125 #endif /* CONFIG_ADB */
23126 }
23127- } else {
23128- /* Sound/brightness button pressed */
23129- if ((data[0] & PMU_INT_SNDBRT) && len == 3) {
23130+ }
23131+ /* Sound/brightness button pressed */
23132+ else if ((1 << pirq) & PMU_INT_SNDBRT) {
23133 #ifdef CONFIG_PMAC_BACKLIGHT
23134+ if (len == 3)
23135 #ifdef CONFIG_INPUT_ADBHID
23136 if (!disable_kernel_backlight)
23137 #endif /* CONFIG_INPUT_ADBHID */
23138 set_backlight_level(data[1] >> 4);
23139 #endif /* CONFIG_PMAC_BACKLIGHT */
23140- }
23141+ }
23142+ /* Tick interrupt */
23143+ else if ((1 << pirq) & PMU_INT_TICK) {
23144 #ifdef CONFIG_PMAC_PBOOK
23145 /* Environement or tick interrupt, query batteries */
23146- if (pmu_battery_count && (data[0] & PMU_INT_TICK)) {
23147+ if (pmu_battery_count) {
23148 if ((--query_batt_timer) == 0) {
23149 query_battery_state();
23150 query_batt_timer = BATTERY_POLLING_COUNT;
23151 }
23152- } else if (pmu_battery_count && (data[0] & PMU_INT_ENVIRONMENT))
23153+ }
23154+ }
23155+ else if ((1 << pirq) & PMU_INT_ENVIRONMENT) {
23156+ if (pmu_battery_count)
23157 query_battery_state();
23158- if (data[0])
23159- pmu_pass_intr(data, len);
23160+ pmu_pass_intr(data, len);
23161+ } else
23162+ pmu_pass_intr(data, len);
23163+
23164 #endif /* CONFIG_PMAC_PBOOK */
23165- }
23166+ goto next;
23167 }
23168
23169 static struct adb_request* __pmac
23170@@ -1326,17 +1425,29 @@
23171 case sending:
23172 req = current_req;
23173 if (data_len < 0) {
23174+#ifdef CONFIG_XMON
23175+ if (LIVE_DEBUG(req))
23176+ xmon_printf("s");
23177+#endif /* CONFIG_XMON */
23178 data_len = req->nbytes - 1;
23179 send_byte(data_len);
23180 break;
23181 }
23182 if (data_index <= data_len) {
23183+#ifdef CONFIG_XMON
23184+ if (LIVE_DEBUG(req))
23185+ xmon_printf("S");
23186+#endif /* CONFIG_XMON */
23187 send_byte(req->data[data_index++]);
23188 break;
23189 }
23190 req->sent = 1;
23191 data_len = pmu_data_len[req->data[0]][1];
23192 if (data_len == 0) {
23193+#ifdef CONFIG_XMON
23194+ if (LIVE_DEBUG(req))
23195+ xmon_printf("D");
23196+#endif /* CONFIG_XMON */
23197 pmu_state = idle;
23198 current_req = req->next;
23199 if (req->reply_expected)
23200@@ -1344,6 +1455,10 @@
23201 else
23202 return req;
23203 } else {
23204+#ifdef CONFIG_XMON
23205+ if (LIVE_DEBUG(req))
23206+ xmon_printf("-");
23207+#endif /* CONFIG_XMON */
23208 pmu_state = reading;
23209 data_index = 0;
23210 reply_ptr = req->reply + req->reply_len;
23211@@ -1357,15 +1472,27 @@
23212 pmu_state = reading_intr;
23213 reply_ptr = interrupt_data[int_data_last];
23214 recv_byte();
23215+ if (gpio_irq >= 0 && !gpio_irq_enabled) {
23216+ enable_irq(gpio_irq);
23217+ gpio_irq_enabled = 1;
23218+ }
23219 break;
23220
23221 case reading:
23222 case reading_intr:
23223 if (data_len == -1) {
23224+#ifdef CONFIG_XMON
23225+ if (LIVE_DEBUG(current_req))
23226+ xmon_printf("r");
23227+#endif /* CONFIG_XMON */
23228 data_len = bite;
23229 if (bite > 32)
23230 printk(KERN_ERR "PMU: bad reply len %d\n", bite);
23231 } else if (data_index < 32) {
23232+#ifdef CONFIG_XMON
23233+ if (LIVE_DEBUG(current_req))
23234+ xmon_printf("R");
23235+#endif /* CONFIG_XMON */
23236 reply_ptr[data_index++] = bite;
23237 }
23238 if (data_index < data_len) {
23239@@ -1373,15 +1500,29 @@
23240 break;
23241 }
23242
23243+#ifdef CONFIG_XMON
23244+ if (LIVE_DEBUG(current_req)) {
23245+ whacky_debug = 1;
23246+ xmon_printf("D");
23247+ }
23248+#endif /* CONFIG_XMON */
23249 if (pmu_state == reading_intr) {
23250 pmu_state = idle;
23251 int_data_state[int_data_last] = int_data_ready;
23252 interrupt_data_len[int_data_last] = data_len;
23253 } else {
23254 req = current_req;
23255+ /*
23256+ * For PMU sleep and freq change requests, we lock the
23257+ * PMU until it's explicitely unlocked. This avoids any
23258+ * spurrious event polling getting in
23259+ */
23260 current_req = req->next;
23261 req->reply_len += data_index;
23262- pmu_state = idle;
23263+ if (req->data[0] == PMU_SLEEP || req->data[0] == PMU_CPU_SPEED)
23264+ pmu_state = locked;
23265+ else
23266+ pmu_state = idle;
23267 return req;
23268 }
23269 break;
23270@@ -1411,6 +1552,10 @@
23271 intr = in_8(&via[IFR]) & (SR_INT | CB1_INT);
23272 if (intr == 0)
23273 break;
23274+#ifdef CONFIG_XMON
23275+ if (whacky_debug)
23276+ xmon_printf("|%02x|", intr);
23277+#endif /* CONFIG_XMON */
23278 handled = 1;
23279 if (++nloop > 1000) {
23280 printk(KERN_DEBUG "PMU: stuck in intr loop, "
23281@@ -1419,8 +1564,10 @@
23282 break;
23283 }
23284 out_8(&via[IFR], intr);
23285- if (intr & CB1_INT)
23286+ if (intr & CB1_INT) {
23287 adb_int_pending = 1;
23288+ pmu_irq_stats[0]++;
23289+ }
23290 if (intr & SR_INT) {
23291 req = pmu_sr_intr(regs);
23292 if (req)
23293@@ -1431,6 +1578,10 @@
23294 recheck:
23295 if (pmu_state == idle) {
23296 if (adb_int_pending) {
23297+#ifdef CONFIG_XMON
23298+ if (whacky_debug)
23299+ xmon_printf("!A!");
23300+#endif /* CONFIG_XMON */
23301 if (int_data_state[0] == int_data_empty)
23302 int_data_last = 0;
23303 else if (int_data_state[1] == int_data_empty)
23304@@ -1479,11 +1630,33 @@
23305 return IRQ_RETVAL(handled);
23306 }
23307
23308+void __pmac
23309+pmu_unlock(void)
23310+{
23311+ unsigned long flags;
23312+
23313+ spin_lock_irqsave(&pmu_lock, flags);
23314+ if (pmu_state == locked)
23315+ pmu_state = idle;
23316+ adb_int_pending = 1;
23317+ spin_unlock_irqrestore(&pmu_lock, flags);
23318+}
23319+
23320+
23321 static irqreturn_t __pmac
23322 gpio1_interrupt(int irq, void *arg, struct pt_regs *regs)
23323 {
23324+ unsigned long flags;
23325+
23326 if ((in_8(gpio_reg + 0x9) & 0x02) == 0) {
23327+ spin_lock_irqsave(&pmu_lock, flags);
23328+ if (gpio_irq_enabled > 0) {
23329+ disable_irq_nosync(gpio_irq);
23330+ gpio_irq_enabled = 0;
23331+ }
23332+ pmu_irq_stats[1]++;
23333 adb_int_pending = 1;
23334+ spin_unlock_irqrestore(&pmu_lock, flags);
23335 via_pmu_interrupt(0, 0, 0);
23336 return IRQ_HANDLED;
23337 }
23338@@ -1507,13 +1680,11 @@
23339 if (on) {
23340 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT,
23341 backlight_to_bright[level]);
23342- while (!req.complete)
23343- pmu_poll();
23344+ pmu_wait_complete(&req);
23345 }
23346 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
23347 PMU_POW_BACKLIGHT | (on ? PMU_POW_ON : PMU_POW_OFF));
23348- while (!req.complete)
23349- pmu_poll();
23350+ pmu_wait_complete(&req);
23351
23352 return 0;
23353 }
23354@@ -1549,8 +1720,7 @@
23355
23356 pmu_request(&req, NULL, 2, PMU_POWER_CTRL, PMU_POW_IRLED |
23357 (on ? PMU_POW_ON : PMU_POW_OFF));
23358- while (!req.complete)
23359- pmu_poll();
23360+ pmu_wait_complete(&req);
23361 }
23362
23363 void __pmac
23364@@ -1570,8 +1740,7 @@
23365 }
23366
23367 pmu_request(&req, NULL, 1, PMU_RESET);
23368- while(!req.complete || (pmu_state != idle))
23369- pmu_poll();
23370+ pmu_wait_complete(&req);
23371 for (;;)
23372 ;
23373 }
23374@@ -1588,14 +1757,12 @@
23375 if (pmu_kind != PMU_KEYLARGO_BASED) {
23376 pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, PMU_INT_ADB |
23377 PMU_INT_TICK );
23378- while(!req.complete)
23379- pmu_poll();
23380+ pmu_wait_complete(&req);
23381 }
23382
23383 pmu_request(&req, NULL, 5, PMU_SHUTDOWN,
23384 'M', 'A', 'T', 'T');
23385- while(!req.complete || (pmu_state != idle))
23386- pmu_poll();
23387+ pmu_wait_complete(&req);
23388 for (;;)
23389 ;
23390 }
23391@@ -1606,25 +1773,261 @@
23392 return via != 0;
23393 }
23394
23395-#ifdef CONFIG_PMAC_PBOOK
23396+struct pmu_i2c_hdr {
23397+ u8 bus;
23398+ u8 mode;
23399+ u8 bus2;
23400+ u8 address;
23401+ u8 sub_addr;
23402+ u8 comb_addr;
23403+ u8 count;
23404+};
23405
23406-static LIST_HEAD(sleep_notifiers);
23407+int
23408+pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len)
23409+{
23410+ struct adb_request req;
23411+ struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
23412+ int retry;
23413+ int rc;
23414+
23415+ for (retry=0; retry<16; retry++) {
23416+ memset(&req, 0, sizeof(req));
23417+
23418+ hdr->bus = bus;
23419+ hdr->address = addr & 0xfe;
23420+ hdr->mode = PMU_I2C_MODE_COMBINED;
23421+ hdr->bus2 = 0;
23422+ hdr->sub_addr = subaddr;
23423+ hdr->comb_addr = addr | 1;
23424+ hdr->count = len;
23425+
23426+ req.nbytes = sizeof(struct pmu_i2c_hdr) + 1;
23427+ req.reply_expected = 0;
23428+ req.reply_len = 0;
23429+ req.data[0] = PMU_I2C_CMD;
23430+ req.reply[0] = 0xff;
23431+ rc = pmu_queue_request(&req);
23432+ if (rc)
23433+ return rc;
23434+ while(!req.complete)
23435+ pmu_poll();
23436+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23437+ break;
23438+ mdelay(15);
23439+ }
23440+ if (req.reply[0] != PMU_I2C_STATUS_OK)
23441+ return -1;
23442
23443-#ifdef CONFIG_PM
23444-static int __pmac
23445-generic_notify_sleep(struct pmu_sleep_notifier *self, int when)
23446+ for (retry=0; retry<16; retry++) {
23447+ memset(&req, 0, sizeof(req));
23448+
23449+ mdelay(15);
23450+
23451+ hdr->bus = PMU_I2C_BUS_STATUS;
23452+ req.reply[0] = 0xff;
23453+
23454+ req.nbytes = 2;
23455+ req.reply_expected = 0;
23456+ req.reply_len = 0;
23457+ req.data[0] = PMU_I2C_CMD;
23458+ rc = pmu_queue_request(&req);
23459+ if (rc)
23460+ return rc;
23461+ while(!req.complete)
23462+ pmu_poll();
23463+ if (req.reply[0] == PMU_I2C_STATUS_DATAREAD) {
23464+ memcpy(data, &req.reply[1], req.reply_len - 1);
23465+ return req.reply_len - 1;
23466+ }
23467+ }
23468+ return -1;
23469+}
23470+
23471+int
23472+pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len)
23473 {
23474- switch (when) {
23475- case PBOOK_SLEEP_NOW:
23476- if (pm_send_all(PM_SUSPEND, (void *)3))
23477- return PBOOK_SLEEP_REJECT;
23478+ struct adb_request req;
23479+ struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
23480+ int retry;
23481+ int rc;
23482+
23483+ for (retry=0; retry<16; retry++) {
23484+ memset(&req, 0, sizeof(req));
23485+
23486+ hdr->bus = bus;
23487+ hdr->address = addr & 0xfe;
23488+ hdr->mode = PMU_I2C_MODE_STDSUB;
23489+ hdr->bus2 = 0;
23490+ hdr->sub_addr = subaddr;
23491+ hdr->comb_addr = addr & 0xfe;
23492+ hdr->count = len;
23493+
23494+ req.data[0] = PMU_I2C_CMD;
23495+ memcpy(&req.data[sizeof(struct pmu_i2c_hdr) + 1], data, len);
23496+ req.nbytes = sizeof(struct pmu_i2c_hdr) + len + 1;
23497+ req.reply_expected = 0;
23498+ req.reply_len = 0;
23499+ req.reply[0] = 0xff;
23500+ rc = pmu_queue_request(&req);
23501+ if (rc)
23502+ return rc;
23503+ while(!req.complete)
23504+ pmu_poll();
23505+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23506 break;
23507- case PBOOK_WAKE:
23508- (void) pm_send_all(PM_RESUME, (void *)0);
23509+ mdelay(15);
23510 }
23511- return PBOOK_SLEEP_OK;
23512+ if (req.reply[0] != PMU_I2C_STATUS_OK)
23513+ return -1;
23514+
23515+ for (retry=0; retry<16; retry++) {
23516+ memset(&req, 0, sizeof(req));
23517+
23518+ mdelay(15);
23519+
23520+ hdr->bus = PMU_I2C_BUS_STATUS;
23521+ req.reply[0] = 0xff;
23522+
23523+ req.nbytes = 2;
23524+ req.reply_expected = 0;
23525+ req.reply_len = 0;
23526+ req.data[0] = PMU_I2C_CMD;
23527+ rc = pmu_queue_request(&req);
23528+ if (rc)
23529+ return rc;
23530+ while(!req.complete)
23531+ pmu_poll();
23532+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23533+ return len;
23534+ }
23535+ return -1;
23536 }
23537-#endif /* CONFIG_PM */
23538+
23539+int
23540+pmu_i2c_simple_read(int bus, int addr, u8* data, int len)
23541+{
23542+ struct adb_request req;
23543+ struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
23544+ int retry;
23545+ int rc;
23546+
23547+ for (retry=0; retry<16; retry++) {
23548+ memset(&req, 0, sizeof(req));
23549+
23550+ hdr->bus = bus;
23551+ hdr->address = addr | 1;
23552+ hdr->mode = PMU_I2C_MODE_SIMPLE;
23553+ hdr->bus2 = 0;
23554+ hdr->sub_addr = 0;
23555+ hdr->comb_addr = 0;
23556+ hdr->count = len;
23557+
23558+ req.data[0] = PMU_I2C_CMD;
23559+ req.nbytes = sizeof(struct pmu_i2c_hdr) + 1;
23560+ req.reply_expected = 0;
23561+ req.reply_len = 0;
23562+ req.reply[0] = 0xff;
23563+ rc = pmu_queue_request(&req);
23564+ if (rc)
23565+ return rc;
23566+ while(!req.complete)
23567+ pmu_poll();
23568+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23569+ break;
23570+ mdelay(15);
23571+ }
23572+ if (req.reply[0] != PMU_I2C_STATUS_OK)
23573+ return -1;
23574+
23575+ for (retry=0; retry<16; retry++) {
23576+ memset(&req, 0, sizeof(req));
23577+
23578+ mdelay(15);
23579+
23580+ hdr->bus = PMU_I2C_BUS_STATUS;
23581+ req.reply[0] = 0xff;
23582+
23583+ req.nbytes = 2;
23584+ req.reply_expected = 0;
23585+ req.reply_len = 0;
23586+ req.data[0] = PMU_I2C_CMD;
23587+ rc = pmu_queue_request(&req);
23588+ if (rc)
23589+ return rc;
23590+ while(!req.complete)
23591+ pmu_poll();
23592+ if (req.reply[0] == PMU_I2C_STATUS_DATAREAD) {
23593+ memcpy(data, &req.reply[1], req.reply_len - 1);
23594+ return req.reply_len - 1;
23595+ }
23596+ }
23597+ return -1;
23598+}
23599+
23600+int
23601+pmu_i2c_simple_write(int bus, int addr, u8* data, int len)
23602+{
23603+ struct adb_request req;
23604+ struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
23605+ int retry;
23606+ int rc;
23607+
23608+ for (retry=0; retry<16; retry++) {
23609+ memset(&req, 0, sizeof(req));
23610+
23611+ hdr->bus = bus;
23612+ hdr->address = addr & 0xfe;
23613+ hdr->mode = PMU_I2C_MODE_SIMPLE;
23614+ hdr->bus2 = 0;
23615+ hdr->sub_addr = 0;
23616+ hdr->comb_addr = 0;
23617+ hdr->count = len;
23618+
23619+ req.data[0] = PMU_I2C_CMD;
23620+ memcpy(&req.data[sizeof(struct pmu_i2c_hdr) + 1], data, len);
23621+ req.nbytes = sizeof(struct pmu_i2c_hdr) + len + 1;
23622+ req.reply_expected = 0;
23623+ req.reply_len = 0;
23624+ req.reply[0] = 0xff;
23625+ rc = pmu_queue_request(&req);
23626+ if (rc)
23627+ return rc;
23628+ while(!req.complete)
23629+ pmu_poll();
23630+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23631+ break;
23632+ mdelay(15);
23633+ }
23634+ if (req.reply[0] != PMU_I2C_STATUS_OK)
23635+ return -1;
23636+
23637+ for (retry=0; retry<16; retry++) {
23638+ memset(&req, 0, sizeof(req));
23639+
23640+ mdelay(15);
23641+
23642+ hdr->bus = PMU_I2C_BUS_STATUS;
23643+ req.reply[0] = 0xff;
23644+
23645+ req.nbytes = 2;
23646+ req.reply_expected = 0;
23647+ req.reply_len = 0;
23648+ req.data[0] = PMU_I2C_CMD;
23649+ rc = pmu_queue_request(&req);
23650+ if (rc)
23651+ return rc;
23652+ while(!req.complete)
23653+ pmu_poll();
23654+ if (req.reply[0] == PMU_I2C_STATUS_OK)
23655+ return len;
23656+ }
23657+ return -1;
23658+}
23659+
23660+#ifdef CONFIG_PMAC_PBOOK
23661+
23662+static LIST_HEAD(sleep_notifiers);
23663
23664 int
23665 pmu_register_sleep_notifier(struct pmu_sleep_notifier *n)
23666@@ -1885,90 +2288,166 @@
23667 }
23668
23669 extern long sys_sync(void);
23670+extern void pm_prepare_console(void);
23671+extern void pm_restore_console(void);
23672
23673-#define GRACKLE_PM (1<<7)
23674-#define GRACKLE_DOZE (1<<5)
23675-#define GRACKLE_NAP (1<<4)
23676-#define GRACKLE_SLEEP (1<<3)
23677-
23678-int __pmac
23679-powerbook_sleep_G3(void)
23680+static int __pmac
23681+pmac_suspend_devices(void)
23682 {
23683- unsigned long save_l2cr;
23684- unsigned short pmcr1;
23685- struct adb_request req;
23686 int ret;
23687- struct pci_dev *grackle;
23688-
23689- grackle = pci_find_slot(0, 0);
23690- if (!grackle)
23691- return -ENODEV;
23692-
23693- /* Notify device drivers */
23694+
23695+ pm_prepare_console();
23696+
23697+ /* Notify old-style device drivers & userland */
23698 ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
23699 if (ret != PBOOK_SLEEP_OK) {
23700- printk("pmu: sleep rejected\n");
23701+ printk(KERN_ERR "Sleep rejected by drivers\n");
23702 return -EBUSY;
23703 }
23704
23705 /* Sync the disks. */
23706 /* XXX It would be nice to have some way to ensure that
23707- * nobody is dirtying any new buffers while we wait.
23708- * BenH: Moved to _after_ sleep request and changed video
23709- * drivers to vmalloc() during sleep request. This way, all
23710- * vmalloc's are done before actual sleep of block drivers */
23711+ * nobody is dirtying any new buffers while we wait. That
23712+ * could be acheived using the refrigerator for processes
23713+ * that swsusp uses
23714+ */
23715 sys_sync();
23716
23717 /* Sleep can fail now. May not be very robust but useful for debugging */
23718 ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
23719 if (ret != PBOOK_SLEEP_OK) {
23720- printk("pmu: sleep failed\n");
23721+ printk(KERN_ERR "Driver sleep failed\n");
23722 return -EBUSY;
23723 }
23724
23725- /* Wait for completion of async backlight requests */
23726- while (!bright_req_1.complete || !bright_req_2.complete ||
23727- !bright_req_3.complete || !batt_req.complete)
23728- pmu_poll();
23729+ /* Send suspend call to devices, hold the device core's dpm_sem */
23730+ ret = device_suspend(PM_SUSPEND_MEM);
23731+ if (ret) {
23732+ printk(KERN_ERR "Driver sleep failed\n");
23733+ broadcast_wake();
23734+ return -EBUSY;
23735+ }
23736
23737- /* Turn off various things. Darwin does some retry tests here... */
23738- pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
23739- while (!req.complete)
23740- pmu_poll();
23741- pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
23742- PMU_POW_OFF|PMU_POW_BACKLIGHT|PMU_POW_IRLED|PMU_POW_MEDIABAY);
23743- while (!req.complete)
23744- pmu_poll();
23745-
23746- /* Disable all interrupts */
23747- pmac_sleep_save_intrs(-1);
23748-
23749- /* Make sure the PMU is idle */
23750- while (pmu_state != idle)
23751- pmu_poll();
23752-
23753 /* Make sure the decrementer won't interrupt us */
23754 asm volatile("mtdec %0" : : "r" (0x7fffffff));
23755 /* Make sure any pending DEC interrupt occurring while we did
23756 * the above didn't re-enable the DEC */
23757 mb();
23758 asm volatile("mtdec %0" : : "r" (0x7fffffff));
23759-
23760- /* We can now disable MSR_EE */
23761+
23762+ /* We can now disable MSR_EE. This code of course works properly only
23763+ * on UP machines... For SMP, if we ever implement sleep, we'll have to
23764+ * stop the "other" CPUs way before we do all that stuff.
23765+ */
23766 local_irq_disable();
23767
23768- /* Giveup the FPU */
23769+ /* Broadcast power down irq
23770+ * This isn't that useful in most cases (only directly wired devices can
23771+ * use this but still... This will take care of sysdev's as well, so
23772+ * we exit from here with local irqs disabled and PIC off.
23773+ */
23774+ ret = device_power_down(PM_SUSPEND_MEM);
23775+ if (ret) {
23776+ wakeup_decrementer();
23777+ local_irq_enable();
23778+ device_resume();
23779+ broadcast_wake();
23780+ printk(KERN_ERR "Driver powerdown failed\n");
23781+ return -EBUSY;
23782+ }
23783+
23784+ /* Wait for completion of async backlight requests */
23785+ while (!bright_req_1.complete || !bright_req_2.complete ||
23786+ !bright_req_3.complete || !batt_req.complete)
23787+ pmu_poll();
23788+
23789+ /* Giveup the lazy FPU & vec so we don't have to back them
23790+ * up from the low level code
23791+ */
23792 enable_kernel_fp();
23793
23794+#ifdef CONFIG_ALTIVEC
23795+ if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
23796+ enable_kernel_altivec();
23797+#endif /* CONFIG_ALTIVEC */
23798+
23799+ return 0;
23800+}
23801+
23802+static int __pmac
23803+pmac_wakeup_devices(void)
23804+{
23805+ mdelay(100);
23806+
23807+ /* Power back up system devices (including the PIC) */
23808+ device_power_up();
23809+
23810+ pmu_blink(1);
23811+
23812+ /* Force a poll of ADB interrupts */
23813+ adb_int_pending = 1;
23814+ via_pmu_interrupt(0, 0, 0);
23815+
23816+ /* Restart jiffies & scheduling */
23817+ wakeup_decrementer();
23818+
23819+ /* Re-enable local CPU interrupts */
23820+ local_irq_enable();
23821+
23822+ pmu_blink(1);
23823+
23824+ /* Resume devices */
23825+ device_resume();
23826+
23827+ /* Notify old style drivers */
23828+ broadcast_wake();
23829+
23830+ pm_restore_console();
23831+
23832+ return 0;
23833+}
23834+
23835+#define GRACKLE_PM (1<<7)
23836+#define GRACKLE_DOZE (1<<5)
23837+#define GRACKLE_NAP (1<<4)
23838+#define GRACKLE_SLEEP (1<<3)
23839+
23840+int __pmac
23841+powerbook_sleep_grackle(void)
23842+{
23843+ unsigned long save_l2cr;
23844+ unsigned short pmcr1;
23845+ struct adb_request req;
23846+ int ret;
23847+ struct pci_dev *grackle;
23848+
23849+ grackle = pci_find_slot(0, 0);
23850+ if (!grackle)
23851+ return -ENODEV;
23852+
23853+ ret = pmac_suspend_devices();
23854+ if (ret) {
23855+ printk(KERN_ERR "Sleep rejected by devices\n");
23856+ return ret;
23857+ }
23858+
23859+ /* Turn off various things. Darwin does some retry tests here... */
23860+ pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
23861+ pmu_wait_complete(&req);
23862+ pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
23863+ PMU_POW_OFF|PMU_POW_BACKLIGHT|PMU_POW_IRLED|PMU_POW_MEDIABAY);
23864+ pmu_wait_complete(&req);
23865+
23866 /* For 750, save backside cache setting and disable it */
23867 save_l2cr = _get_L2CR(); /* (returns -1 if not available) */
23868 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
23869 _set_L2CR(save_l2cr & 0x7fffffff);
23870
23871- /* Ask the PMU to put us to sleep */
23872- pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
23873- while (!req.complete)
23874- pmu_poll();
23875+ if (!__fake_sleep) {
23876+ /* Ask the PMU to put us to sleep */
23877+ pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
23878+ pmu_wait_complete(&req);
23879+ }
23880
23881 /* The VIA is supposed not to be restored correctly*/
23882 save_via_state();
23883@@ -1982,7 +2461,10 @@
23884 pci_write_config_word(grackle, 0x70, pmcr1);
23885
23886 /* Call low-level ASM sleep handler */
23887- low_sleep_handler();
23888+ if (__fake_sleep)
23889+ mdelay(5000);
23890+ else
23891+ low_sleep_handler();
23892
23893 /* We're awake again, stop grackle PM */
23894 pci_read_config_word(grackle, 0x70, &pmcr1);
23895@@ -2001,36 +2483,17 @@
23896 set_context(current->active_mm->context, current->active_mm->pgd);
23897
23898 /* Power things up */
23899- pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc);
23900- while (!req.complete)
23901- pmu_poll();
23902+ pmu_unlock();
23903+ pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
23904+ pmu_wait_complete(&req);
23905 pmu_request(&req, NULL, 2, PMU_POWER_CTRL0,
23906 PMU_POW0_ON|PMU_POW0_HARD_DRIVE);
23907- while (!req.complete)
23908- pmu_poll();
23909+ pmu_wait_complete(&req);
23910 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
23911 PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY);
23912- while (!req.complete)
23913- pmu_poll();
23914-
23915- /* reenable interrupt controller */
23916- pmac_sleep_restore_intrs();
23917+ pmu_wait_complete(&req);
23918
23919- /* Leave some time for HW to settle down */
23920- mdelay(100);
23921-
23922- /* Restart jiffies & scheduling */
23923- wakeup_decrementer();
23924-
23925- /* Force a poll of ADB interrupts */
23926- adb_int_pending = 1;
23927- via_pmu_interrupt(0, 0, 0);
23928-
23929- /* Re-enable local CPU interrupts */
23930- local_irq_enable();
23931-
23932- /* Notify drivers */
23933- broadcast_wake();
23934+ pmac_wakeup_devices();
23935
23936 return 0;
23937 }
23938@@ -2048,68 +2511,20 @@
23939 return -ENOSYS;
23940 }
23941
23942- /* Notify device drivers */
23943- ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
23944- if (ret != PBOOK_SLEEP_OK) {
23945- printk("pmu: sleep rejected\n");
23946- return -EBUSY;
23947- }
23948-
23949- /* Sync the disks. */
23950- /* XXX It would be nice to have some way to ensure that
23951- * nobody is dirtying any new buffers while we wait.
23952- * BenH: Moved to _after_ sleep request and changed video
23953- * drivers to vmalloc() during sleep request. This way, all
23954- * vmalloc's are done before actual sleep of block drivers */
23955- sys_sync();
23956-
23957- /* Sleep can fail now. May not be very robust but useful for debugging */
23958- ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
23959- if (ret != PBOOK_SLEEP_OK) {
23960- printk("pmu: sleep failed\n");
23961- return -EBUSY;
23962+ ret = pmac_suspend_devices();
23963+ if (ret) {
23964+ printk(KERN_ERR "Sleep rejected by devices\n");
23965+ return ret;
23966 }
23967- /* Wait for completion of async backlight requests */
23968- while (!bright_req_1.complete || !bright_req_2.complete ||
23969- !bright_req_3.complete || !batt_req.complete)
23970- pmu_poll();
23971-
23972+
23973 /* Tell PMU what events will wake us up */
23974 pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_CLR_WAKEUP_EVENTS,
23975 0xff, 0xff);
23976- while (!req.complete)
23977- pmu_poll();
23978-
23979+ pmu_wait_complete(&req);
23980 pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_SET_WAKEUP_EVENTS,
23981 0, PMU_PWR_WAKEUP_KEY |
23982 (option_lid_wakeup ? PMU_PWR_WAKEUP_LID_OPEN : 0));
23983- while (!req.complete)
23984- pmu_poll();
23985-
23986- /* Save & disable all interrupts */
23987- openpic_sleep_save_intrs();
23988-
23989- /* Make sure the PMU is idle */
23990- while (pmu_state != idle)
23991- pmu_poll();
23992-
23993- /* Make sure the decrementer won't interrupt us */
23994- asm volatile("mtdec %0" : : "r" (0x7fffffff));
23995- /* Make sure any pending DEC interrupt occurring while we did
23996- * the above didn't re-enable the DEC */
23997- mb();
23998- asm volatile("mtdec %0" : : "r" (0x7fffffff));
23999-
24000- /* We can now disable MSR_EE */
24001- local_irq_disable();
24002-
24003- /* Giveup the FPU & vec */
24004- enable_kernel_fp();
24005-
24006-#ifdef CONFIG_ALTIVEC
24007- if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
24008- enable_kernel_altivec();
24009-#endif /* CONFIG_ALTIVEC */
24010+ pmu_wait_complete(&req);
24011
24012 /* Save & disable L2 and L3 caches*/
24013 save_l3cr = _get_L3CR(); /* (returns -1 if not available) */
24014@@ -2125,13 +2540,9 @@
24015 if (!__fake_sleep) {
24016 /* Ask the PMU to put us to sleep */
24017 pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
24018- while (!req.complete && pmu_state != idle)
24019- pmu_poll();
24020+ pmu_wait_complete(&req);
24021 }
24022
24023- out_8(&via[B], in_8(&via[B]) | TREQ);
24024- wait_for_ack();
24025-
24026 /* The VIA is supposed not to be restored correctly*/
24027 save_via_state();
24028
24029@@ -2161,8 +2572,6 @@
24030 /* Don't restore PCI for now, it crashes. Maybe unnecessary on pbook */
24031 //pbook_pci_restore();
24032
24033- pmu_blink(2);
24034-
24035 /* Restore L2 cache */
24036 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
24037 _set_L2CR(save_l2cr);
24038@@ -2174,31 +2583,15 @@
24039 set_context(current->active_mm->context, current->active_mm->pgd);
24040
24041 /* Tell PMU we are ready */
24042+ pmu_unlock();
24043 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2);
24044- while (!req.complete)
24045- pmu_poll();
24046- pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc);
24047- while (!req.complete)
24048- pmu_poll();
24049-
24050- /* reenable interrupt controller */
24051- openpic_sleep_restore_intrs();
24052-
24053- /* Leave some time for HW to settle down */
24054- mdelay(100);
24055-
24056- /* Restart jiffies & scheduling */
24057- wakeup_decrementer();
24058+ pmu_wait_complete(&req);
24059+ pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
24060+ pmu_wait_complete(&req);
24061
24062- /* Force a poll of ADB interrupts */
24063- adb_int_pending = 1;
24064- via_pmu_interrupt(0, 0, 0);
24065+ pmu_blink(1);
24066
24067- /* Re-enable local CPU interrupts */
24068- local_irq_enable();
24069-
24070- /* Notify drivers */
24071- broadcast_wake();
24072+ pmac_wakeup_devices();
24073
24074 return 0;
24075 }
24076@@ -2227,45 +2620,13 @@
24077 /* Allocate room for PCI save */
24078 pbook_alloc_pci_save();
24079
24080- /* Notify device drivers */
24081- ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
24082- if (ret != PBOOK_SLEEP_OK) {
24083- pbook_free_pci_save();
24084- printk("pmu: sleep rejected\n");
24085- return -EBUSY;
24086- }
24087-
24088- /* Sync the disks. */
24089- /* XXX It would be nice to have some way to ensure that
24090- * nobody is dirtying any new buffers while we wait.
24091- * BenH: Moved to _after_ sleep request and changed video
24092- * drivers to vmalloc() during sleep request. This way, all
24093- * vmalloc's are done before actual sleep of block drivers */
24094- sys_sync();
24095-
24096- /* Sleep can fail now. May not be very robust but useful for debugging */
24097- ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
24098- if (ret != PBOOK_SLEEP_OK) {
24099- printk("pmu: sleep failed\n");
24100+ ret = pmac_suspend_devices();
24101+ if (ret) {
24102 pbook_free_pci_save();
24103- return -EBUSY;
24104+ printk(KERN_ERR "Sleep rejected by devices\n");
24105+ return ret;
24106 }
24107
24108- /* Wait for completion of async backlight requests */
24109- while (!bright_req_1.complete || !bright_req_2.complete ||
24110- !bright_req_3.complete || !batt_req.complete)
24111- pmu_poll();
24112-
24113- /* Disable all interrupts except pmu */
24114- pmac_sleep_save_intrs(vias->intrs[0].line);
24115-
24116- /* Make sure the decrementer won't interrupt us */
24117- asm volatile("mtdec %0" : : "r" (0x7fffffff));
24118- /* Make sure any pending DEC interrupt occurring while we did
24119- * the above didn't re-enable the DEC */
24120- mb();
24121- asm volatile("mtdec %0" : : "r" (0x7fffffff));
24122-
24123 /* Save the state of PCI config space for some slots */
24124 pbook_pci_save();
24125
24126@@ -2303,25 +2664,13 @@
24127 out_be32(mem_ctrl_sleep, 0x3f);
24128 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,0);
24129 pbook_pci_restore();
24130+ pmu_unlock();
24131
24132 /* wait for the PMU interrupt sequence to complete */
24133 while (asleep)
24134 mb();
24135
24136- /* reenable interrupts */
24137- pmac_sleep_restore_intrs();
24138-
24139- /* Leave some time for HW to settle down */
24140- mdelay(100);
24141-
24142- /* Restart jiffies & scheduling */
24143- wakeup_decrementer();
24144-
24145- /* Re-enable local CPU interrupts */
24146- local_irq_enable();
24147-
24148- /* Notify drivers */
24149- broadcast_wake();
24150+ pmac_wakeup_devices();
24151
24152 pbook_free_pci_save();
24153 iounmap(mem_ctrl);
24154@@ -2524,7 +2873,7 @@
24155 break;
24156 case PMU_HEATHROW_BASED:
24157 case PMU_PADDINGTON_BASED:
24158- error = powerbook_sleep_G3();
24159+ error = powerbook_sleep_grackle();
24160 break;
24161 case PMU_KEYLARGO_BASED:
24162 error = powerbook_sleep_Core99();
24163@@ -2676,8 +3025,15 @@
24164
24165 EXPORT_SYMBOL(pmu_request);
24166 EXPORT_SYMBOL(pmu_poll);
24167+EXPORT_SYMBOL(pmu_poll_adb);
24168+EXPORT_SYMBOL(pmu_wait_complete);
24169 EXPORT_SYMBOL(pmu_suspend);
24170 EXPORT_SYMBOL(pmu_resume);
24171+EXPORT_SYMBOL(pmu_unlock);
24172+EXPORT_SYMBOL(pmu_i2c_combined_read);
24173+EXPORT_SYMBOL(pmu_i2c_stdsub_write);
24174+EXPORT_SYMBOL(pmu_i2c_simple_read);
24175+EXPORT_SYMBOL(pmu_i2c_simple_write);
24176 #ifdef CONFIG_PMAC_PBOOK
24177 EXPORT_SYMBOL(pmu_register_sleep_notifier);
24178 EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
24179diff -Nru a/drivers/md/md.c b/drivers/md/md.c
24180--- a/drivers/md/md.c Thu Aug 7 02:25:25 2003
24181+++ b/drivers/md/md.c Tue Aug 26 09:25:41 2003
24182@@ -179,7 +179,6 @@
24183 mddev_map[mdidx(mddev)] = NULL;
24184 blk_put_queue(mddev->queue);
24185 kfree(mddev);
24186- MOD_DEC_USE_COUNT;
24187 }
24188 spin_unlock(&all_mddevs_lock);
24189 }
24190@@ -201,7 +200,6 @@
24191 mddev_map[unit] = new;
24192 list_add(&new->all_mddevs, &all_mddevs);
24193 spin_unlock(&all_mddevs_lock);
24194- MOD_INC_USE_COUNT;
24195 return new;
24196 }
24197 spin_unlock(&all_mddevs_lock);
24198@@ -640,14 +638,13 @@
24199 /* make rdev->sb match mddev data..
24200 *
24201 * 1/ zero out disks
24202- * 2/ Add info for each disk, keeping track of highest desc_nr
24203- * 3/ any empty disks < highest become removed
24204+ * 2/ Add info for each disk, keeping track of highest desc_nr (next_spare);
24205+ * 3/ any empty disks < next_spare become removed
24206 *
24207 * disks[0] gets initialised to REMOVED because
24208 * we cannot be sure from other fields if it has
24209 * been initialised or not.
24210 */
24211- int highest = 0;
24212 int i;
24213 int active=0, working=0,failed=0,spare=0,nr_disks=0;
24214
24215@@ -718,17 +715,17 @@
24216 spare++;
24217 working++;
24218 }
24219- if (rdev2->desc_nr > highest)
24220- highest = rdev2->desc_nr;
24221 }
24222
24223- /* now set the "removed" bit on any non-trailing holes */
24224- for (i=0; i<highest; i++) {
24225+ /* now set the "removed" and "faulty" bits on any missing devices */
24226+ for (i=0 ; i < mddev->raid_disks ; i++) {
24227 mdp_disk_t *d = &sb->disks[i];
24228 if (d->state == 0 && d->number == 0) {
24229 d->number = i;
24230 d->raid_disk = i;
24231 d->state = (1<<MD_DISK_REMOVED);
24232+ d->state |= (1<<MD_DISK_FAULTY);
24233+ failed++;
24234 }
24235 }
24236 sb->nr_disks = nr_disks;
24237@@ -1612,12 +1609,6 @@
24238 spin_unlock(&pers_lock);
24239
24240 blk_queue_make_request(mddev->queue, mddev->pers->make_request);
24241- printk("%s: setting max_sectors to %d, segment boundary to %d\n",
24242- disk->disk_name,
24243- chunk_size >> 9,
24244- (chunk_size>>1)-1);
24245- blk_queue_max_sectors(mddev->queue, chunk_size >> 9);
24246- blk_queue_segment_boundary(mddev->queue, (chunk_size>>1) - 1);
24247 mddev->queue->queuedata = mddev;
24248
24249 err = mddev->pers->run(mddev);
24250@@ -2366,17 +2357,14 @@
24251 unsigned int cmd, unsigned long arg)
24252 {
24253 char b[BDEVNAME_SIZE];
24254- unsigned int minor;
24255+ unsigned int minor = iminor(inode);
24256 int err = 0;
24257 struct hd_geometry *loc = (struct hd_geometry *) arg;
24258 mddev_t *mddev = NULL;
24259- kdev_t dev;
24260
24261 if (!capable(CAP_SYS_ADMIN))
24262 return -EACCES;
24263
24264- dev = inode->i_rdev;
24265- minor = minor(dev);
24266 if (minor >= MAX_MD_DEVS) {
24267 MD_BUG();
24268 return -EINVAL;
24269@@ -2615,7 +2603,7 @@
24270 /*
24271 * Succeed if we can find or allocate a mddev structure.
24272 */
24273- mddev_t *mddev = mddev_find(minor(inode->i_rdev));
24274+ mddev_t *mddev = mddev_find(iminor(inode));
24275 int err = -ENOMEM;
24276
24277 if (!mddev)
24278@@ -3590,6 +3578,7 @@
24279 if (!disks[i])
24280 continue;
24281 mddev = disk->private_data;
24282+ export_array(mddev);
24283 del_gendisk(disk);
24284 put_disk(disk);
24285 mddev_put(mddev);
24286diff -Nru a/drivers/md/raid0.c b/drivers/md/raid0.c
24287--- a/drivers/md/raid0.c Thu Aug 14 18:16:17 2003
24288+++ b/drivers/md/raid0.c Sat Aug 23 15:07:18 2003
24289@@ -231,6 +231,13 @@
24290 mdk_rdev_t *rdev;
24291 struct list_head *tmp;
24292
24293+ printk("md%d: setting max_sectors to %d, segment boundary to %d\n",
24294+ mdidx(mddev),
24295+ mddev->chunk_size >> 9,
24296+ (mddev->chunk_size>>1)-1);
24297+ blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9);
24298+ blk_queue_segment_boundary(mddev->queue, (mddev->chunk_size>>1) - 1);
24299+
24300 conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL);
24301 if (!conf)
24302 goto out;
24303diff -Nru a/drivers/md/raid5.c b/drivers/md/raid5.c
24304--- a/drivers/md/raid5.c Sun Aug 10 16:01:44 2003
24305+++ b/drivers/md/raid5.c Sat Aug 23 15:07:16 2003
24306@@ -1326,7 +1326,7 @@
24307 (unsigned long long)new_sector,
24308 (unsigned long long)logical_sector);
24309
24310- sh = get_active_stripe(conf, new_sector, pd_idx, 0/*(bi->bi_rw&RWA_MASK)*/);
24311+ sh = get_active_stripe(conf, new_sector, pd_idx, (bi->bi_rw&RWA_MASK));
24312 if (sh) {
24313
24314 add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK));
24315@@ -1334,7 +1334,12 @@
24316 raid5_plug_device(conf);
24317 handle_stripe(sh);
24318 release_stripe(sh);
24319+ } else {
24320+ /* cannot get stripe for read-ahead, just give-up */
24321+ clear_bit(BIO_UPTODATE, &bi->bi_flags);
24322+ break;
24323 }
24324+
24325 }
24326 spin_lock_irq(&conf->device_lock);
24327 if (--bi->bi_phys_segments == 0) {
24328diff -Nru a/drivers/md/xor.c b/drivers/md/xor.c
24329--- a/drivers/md/xor.c Wed Jul 24 08:36:02 2002
24330+++ b/drivers/md/xor.c Sat Aug 23 15:07:12 2003
24331@@ -134,7 +134,10 @@
24332 return 0;
24333 }
24334
24335+static __exit void xor_exit(void) { }
24336+
24337 EXPORT_SYMBOL(xor_block);
24338 MODULE_LICENSE("GPL");
24339
24340 module_init(calibrate_xor_block);
24341+module_exit(xor_exit);
24342diff -Nru a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
24343--- a/drivers/media/common/saa7146_fops.c Mon Jul 7 04:28:54 2003
24344+++ b/drivers/media/common/saa7146_fops.c Tue Aug 26 09:25:41 2003
24345@@ -157,7 +157,7 @@
24346
24347 static int fops_open(struct inode *inode, struct file *file)
24348 {
24349- unsigned int minor = minor(inode->i_rdev);
24350+ unsigned int minor = iminor(inode);
24351 struct saa7146_dev *h = NULL, *dev = NULL;
24352 struct list_head *list;
24353 struct saa7146_fh *fh = NULL;
24354diff -Nru a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
24355--- a/drivers/media/common/saa7146_video.c Thu Jul 31 16:47:19 2003
24356+++ b/drivers/media/common/saa7146_video.c Sun Aug 31 16:14:08 2003
24357@@ -359,41 +359,41 @@
24358
24359 static struct v4l2_queryctrl controls[] = {
24360 {
24361- id: V4L2_CID_BRIGHTNESS,
24362- name: "Brightness",
24363- minimum: 0,
24364- maximum: 255,
24365- step: 1,
24366- default_value: 128,
24367- type: V4L2_CTRL_TYPE_INTEGER,
24368+ .id = V4L2_CID_BRIGHTNESS,
24369+ .name = "Brightness",
24370+ .minimum = 0,
24371+ .maximum = 255,
24372+ .step = 1,
24373+ .default_value = 128,
24374+ .type = V4L2_CTRL_TYPE_INTEGER,
24375 },{
24376- id: V4L2_CID_CONTRAST,
24377- name: "Contrast",
24378- minimum: 0,
24379- maximum: 127,
24380- step: 1,
24381- default_value: 64,
24382- type: V4L2_CTRL_TYPE_INTEGER,
24383+ .id = V4L2_CID_CONTRAST,
24384+ .name = "Contrast",
24385+ .minimum = 0,
24386+ .maximum = 127,
24387+ .step = 1,
24388+ .default_value = 64,
24389+ .type = V4L2_CTRL_TYPE_INTEGER,
24390 },{
24391- id: V4L2_CID_SATURATION,
24392- name: "Saturation",
24393- minimum: 0,
24394- maximum: 127,
24395- step: 1,
24396- default_value: 64,
24397- type: V4L2_CTRL_TYPE_INTEGER,
24398+ .id = V4L2_CID_SATURATION,
24399+ .name = "Saturation",
24400+ .minimum = 0,
24401+ .maximum = 127,
24402+ .step = 1,
24403+ .default_value = 64,
24404+ .type = V4L2_CTRL_TYPE_INTEGER,
24405 },{
24406- id: V4L2_CID_VFLIP,
24407- name: "Vertical flip",
24408- minimum: 0,
24409- maximum: 1,
24410- type: V4L2_CTRL_TYPE_BOOLEAN,
24411+ .id = V4L2_CID_VFLIP,
24412+ .name = "Vertical flip",
24413+ .minimum = 0,
24414+ .maximum = 1,
24415+ .type = V4L2_CTRL_TYPE_BOOLEAN,
24416 },{
24417- id: V4L2_CID_HFLIP,
24418- name: "Horizontal flip",
24419- minimum: 0,
24420- maximum: 1,
24421- type: V4L2_CTRL_TYPE_BOOLEAN,
24422+ .id = V4L2_CID_HFLIP,
24423+ .name = "Horizontal flip",
24424+ .minimum = 0,
24425+ .maximum = 1,
24426+ .type = V4L2_CTRL_TYPE_BOOLEAN,
24427 },
24428 };
24429 static int NUM_CONTROLS = sizeof(controls)/sizeof(struct v4l2_queryctrl);
24430diff -Nru a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
24431--- a/drivers/media/dvb/dvb-core/dvbdev.c Tue Aug 12 13:25:49 2003
24432+++ b/drivers/media/dvb/dvb-core/dvbdev.c Tue Aug 26 09:25:41 2003
24433@@ -73,7 +73,7 @@
24434 {
24435 struct dvb_device *dvbdev;
24436
24437- dvbdev = dvbdev_find_device (minor(inode->i_rdev));
24438+ dvbdev = dvbdev_find_device (iminor(inode));
24439
24440 if (dvbdev && dvbdev->fops) {
24441 int err = 0;
24442diff -Nru a/drivers/media/dvb/frontends/grundig_29504-401.c b/drivers/media/dvb/frontends/grundig_29504-401.c
24443--- a/drivers/media/dvb/frontends/grundig_29504-401.c Wed Jun 18 05:03:14 2003
24444+++ b/drivers/media/dvb/frontends/grundig_29504-401.c Sun Aug 31 16:14:08 2003
24445@@ -37,15 +37,15 @@
24446
24447
24448 struct dvb_frontend_info grundig_29504_401_info = {
24449- name: "Grundig 29504-401",
24450- type: FE_OFDM,
24451-/* frequency_min: ???,*/
24452-/* frequency_max: ???,*/
24453- frequency_stepsize: 166666,
24454-/* frequency_tolerance: ???,*/
24455-/* symbol_rate_tolerance: ???,*/
24456- notifier_delay: 0,
24457- caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
24458+ .name = "Grundig 29504-401",
24459+ .type = FE_OFDM,
24460+/* .frequency_min = ???,*/
24461+/* .frequency_max = ???,*/
24462+ .frequency_stepsize = 166666,
24463+/* .frequency_tolerance = ???,*/
24464+/* .symbol_rate_tolerance = ???,*/
24465+ .notifier_delay = 0,
24466+ .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
24467 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
24468 FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 |
24469 FE_CAN_MUTE_TS /*| FE_CAN_CLEAN_SETUP*/
24470diff -Nru a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
24471--- a/drivers/media/dvb/frontends/ves1820.c Thu Jun 19 23:48:36 2003
24472+++ b/drivers/media/dvb/frontends/ves1820.c Sun Aug 31 16:14:08 2003
24473@@ -81,9 +81,9 @@
24474 .symbol_rate_min = (XIN/2)/64, /* SACLK/64 == (XIN/2)/64 */
24475 .symbol_rate_max = (XIN/2)/4, /* SACLK/4 */
24476 #if 0
24477- frequency_tolerance: ???,
24478- symbol_rate_tolerance: ???, /* ppm */ /* == 8% (spec p. 5) */
24479- notifier_delay: ?,
24480+ .frequency_tolerance = ???,
24481+ .symbol_rate_tolerance = ???, /* ppm */ /* == 8% (spec p. 5) */
24482+ .notifier_delay = ?,
24483 #endif
24484 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
24485 FE_CAN_QAM_128 | FE_CAN_QAM_256 |
24486diff -Nru a/drivers/media/dvb/ttusb-dec/dec2000_frontend.c b/drivers/media/dvb/ttusb-dec/dec2000_frontend.c
24487--- a/drivers/media/dvb/ttusb-dec/dec2000_frontend.c Mon Jul 14 02:56:39 2003
24488+++ b/drivers/media/dvb/ttusb-dec/dec2000_frontend.c Sun Aug 31 16:14:08 2003
24489@@ -30,12 +30,12 @@
24490 #define dprintk if (debug) printk
24491
24492 static struct dvb_frontend_info dec2000_frontend_info = {
24493- name: "TechnoTrend/Hauppauge DEC-2000-t Frontend",
24494- type: FE_OFDM,
24495- frequency_min: 51000000,
24496- frequency_max: 858000000,
24497- frequency_stepsize: 62500,
24498- caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
24499+ .name = "TechnoTrend/Hauppauge DEC-2000-t Frontend",
24500+ .type = FE_OFDM,
24501+ .frequency_min = 51000000,
24502+ .frequency_max = 858000000,
24503+ .frequency_stepsize = 62500,
24504+ .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
24505 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
24506 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
24507 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
24508diff -Nru a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
24509--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c Sat Aug 9 06:43:04 2003
24510+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c Sun Aug 31 16:14:08 2003
24511@@ -1003,10 +1003,10 @@
24512 };
24513
24514 static struct usb_driver ttusb_dec_driver = {
24515- name: DRIVER_NAME,
24516- probe: ttusb_dec_probe,
24517- disconnect: ttusb_dec_disconnect,
24518- id_table: ttusb_dec_table,
24519+ .name = DRIVER_NAME,
24520+ .probe = ttusb_dec_probe,
24521+ .disconnect = ttusb_dec_disconnect,
24522+ .id_table = ttusb_dec_table,
24523 };
24524
24525 static int __init ttusb_dec_init(void)
24526diff -Nru a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
24527--- a/drivers/media/video/adv7170.c Wed Aug 20 15:29:21 2003
24528+++ b/drivers/media/video/adv7170.c Sun Aug 31 16:14:05 2003
24529@@ -104,6 +104,7 @@
24530 u8 value)
24531 {
24532 struct adv7170 *encoder = i2c_get_clientdata(client);
24533+
24534 encoder->reg[reg] = value;
24535 return i2c_smbus_write_byte_data(client, reg, value);
24536 }
24537@@ -130,6 +131,7 @@
24538 struct adv7170 *encoder = i2c_get_clientdata(client);
24539 struct i2c_msg msg;
24540 u8 block_data[32];
24541+
24542 msg.addr = client->addr;
24543 msg.flags = client->flags;
24544 while (len >= 2) {
24545@@ -143,16 +145,16 @@
24546 data += 2;
24547 } while (len >= 2 && data[0] == reg &&
24548 msg.len < 32);
24549- if ((ret =
24550- i2c_transfer(client->adapter, &msg, 1)) < 0)
24551+ if ((ret = i2c_transfer(client->adapter,
24552+ &msg, 1)) < 0)
24553 break;
24554 }
24555 } else {
24556 /* do some slow I2C emulation kind of thing */
24557 while (len >= 2) {
24558 reg = *data++;
24559- if ((ret =
24560- adv7170_write(client, reg, *data++)) < 0)
24561+ if ((ret = adv7170_write(client, reg,
24562+ *data++)) < 0)
24563 break;
24564 len -= 2;
24565 }
24566@@ -442,6 +444,7 @@
24567 dname = adv7171_name;
24568 } else {
24569 /* We should never get here!!! */
24570+ kfree(client);
24571 return 0;
24572 }
24573 snprintf(I2C_NAME(client), sizeof(I2C_NAME(client)) - 1,
24574@@ -449,6 +452,7 @@
24575
24576 encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL);
24577 if (encoder == NULL) {
24578+ kfree(client);
24579 return -ENOMEM;
24580 }
24581 memset(encoder, 0, sizeof(struct adv7170));
24582diff -Nru a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
24583--- a/drivers/media/video/adv7175.c Wed Aug 20 15:29:21 2003
24584+++ b/drivers/media/video/adv7175.c Sun Aug 31 16:14:05 2003
24585@@ -100,6 +100,7 @@
24586 u8 value)
24587 {
24588 struct adv7175 *encoder = i2c_get_clientdata(client);
24589+
24590 encoder->reg[reg] = value;
24591 return i2c_smbus_write_byte_data(client, reg, value);
24592 }
24593@@ -126,6 +127,7 @@
24594 struct adv7175 *encoder = i2c_get_clientdata(client);
24595 struct i2c_msg msg;
24596 u8 block_data[32];
24597+
24598 msg.addr = client->addr;
24599 msg.flags = client->flags;
24600 while (len >= 2) {
24601@@ -139,16 +141,16 @@
24602 data += 2;
24603 } while (len >= 2 && data[0] == reg &&
24604 msg.len < 32);
24605- if ((ret =
24606- i2c_transfer(client->adapter, &msg, 1)) < 0)
24607+ if ((ret = i2c_transfer(client->adapter,
24608+ &msg, 1)) < 0)
24609 break;
24610 }
24611 } else {
24612 /* do some slow I2C emulation kind of thing */
24613 while (len >= 2) {
24614 reg = *data++;
24615- if ((ret =
24616- adv7175_write(client, reg, *data++)) < 0)
24617+ if ((ret = adv7175_write(client, reg,
24618+ *data++)) < 0)
24619 break;
24620 len -= 2;
24621 }
24622@@ -163,6 +165,7 @@
24623 {
24624 struct adv7175 *encoder = i2c_get_clientdata(client);
24625 int i, j;
24626+
24627 printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client));
24628 for (i = 0; i < 182 / 8; i++) {
24629 printk("%s: 0x%02x -", I2C_NAME(client), i * 8);
24630@@ -463,6 +466,7 @@
24631 dname = adv7176_name;
24632 } else {
24633 /* We should never get here!!! */
24634+ kfree(client);
24635 return 0;
24636 }
24637 snprintf(I2C_NAME(client), sizeof(I2C_NAME(client)) - 1,
24638@@ -470,6 +474,7 @@
24639
24640 encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL);
24641 if (encoder == NULL) {
24642+ kfree(client);
24643 return -ENOMEM;
24644 }
24645 memset(encoder, 0, sizeof(struct adv7175));
24646diff -Nru a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
24647--- a/drivers/media/video/bt819.c Wed Aug 20 15:29:21 2003
24648+++ b/drivers/media/video/bt819.c Sun Aug 31 16:14:05 2003
24649@@ -113,6 +113,7 @@
24650 u8 value)
24651 {
24652 struct bt819 *decoder = i2c_get_clientdata(client);
24653+
24654 decoder->reg[reg] = value;
24655 return i2c_smbus_write_byte_data(client, reg, value);
24656 }
24657@@ -124,6 +125,7 @@
24658 u8 value)
24659 {
24660 struct bt819 *decoder = i2c_get_clientdata(client);
24661+
24662 return bt819_write(client, reg,
24663 (decoder->
24664 reg[reg] & ~(1 << bit)) |
24665@@ -145,6 +147,7 @@
24666 struct bt819 *decoder = i2c_get_clientdata(client);
24667 struct i2c_msg msg;
24668 u8 block_data[32];
24669+
24670 msg.addr = client->addr;
24671 msg.flags = client->flags;
24672 while (len >= 2) {
24673@@ -158,8 +161,8 @@
24674 data += 2;
24675 } while (len >= 2 && data[0] == reg &&
24676 msg.len < 32);
24677- if ((ret =
24678- i2c_transfer(client->adapter, &msg, 1)) < 0)
24679+ if ((ret = i2c_transfer(client->adapter,
24680+ &msg, 1)) < 0)
24681 break;
24682 }
24683 } else {
24684diff -Nru a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
24685--- a/drivers/media/video/bt856.c Wed Aug 20 15:29:21 2003
24686+++ b/drivers/media/video/bt856.c Sun Aug 31 16:14:05 2003
24687@@ -98,6 +98,7 @@
24688 u8 value)
24689 {
24690 struct bt856 *encoder = i2c_get_clientdata(client);
24691+
24692 encoder->reg[reg - REG_OFFSET] = value;
24693 return i2c_smbus_write_byte_data(client, reg, value);
24694 }
24695@@ -109,6 +110,7 @@
24696 u8 value)
24697 {
24698 struct bt856 *encoder = i2c_get_clientdata(client);
24699+
24700 return bt856_write(client, reg,
24701 (encoder->
24702 reg[reg - REG_OFFSET] & ~(1 << bit)) |
24703@@ -120,6 +122,7 @@
24704 {
24705 int i;
24706 struct bt856 *encoder = i2c_get_clientdata(client);
24707+
24708 printk(KERN_INFO "%s: register dump:", I2C_NAME(client));
24709 for (i = 0xd6; i <= 0xde; i += 2)
24710 printk(" %02x", encoder->reg[i - REG_OFFSET]);
24711@@ -341,6 +344,7 @@
24712
24713 encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL);
24714 if (encoder == NULL) {
24715+ kfree(client);
24716 return -ENOMEM;
24717 }
24718 memset(encoder, 0, sizeof(struct bt856));
24719diff -Nru a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
24720--- a/drivers/media/video/bttv-driver.c Thu Aug 7 14:20:17 2003
24721+++ b/drivers/media/video/bttv-driver.c Tue Aug 26 09:25:41 2003
24722@@ -2758,7 +2758,7 @@
24723
24724 static int bttv_open(struct inode *inode, struct file *file)
24725 {
24726- int minor = minor(inode->i_rdev);
24727+ int minor = iminor(inode);
24728 struct bttv *btv = NULL;
24729 struct bttv_fh *fh;
24730 enum v4l2_buf_type type = 0;
24731@@ -2894,7 +2894,7 @@
24732
24733 static int radio_open(struct inode *inode, struct file *file)
24734 {
24735- int minor = minor(inode->i_rdev);
24736+ int minor = iminor(inode);
24737 struct bttv *btv = NULL;
24738 u32 v = 400*16;
24739 unsigned int i;
24740diff -Nru a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
24741--- a/drivers/media/video/saa7110.c Wed Aug 20 15:29:21 2003
24742+++ b/drivers/media/video/saa7110.c Sun Aug 31 16:14:05 2003
24743@@ -86,6 +86,7 @@
24744 u8 value)
24745 {
24746 struct saa7110 *decoder = i2c_get_clientdata(client);
24747+
24748 decoder->reg[reg] = value;
24749 return i2c_smbus_write_byte_data(client, reg, value);
24750 }
24751@@ -97,6 +98,7 @@
24752 {
24753 int ret = -1;
24754 u8 reg = *data++;
24755+
24756 len--;
24757
24758 /* the saa7110 has an autoincrement function, use it if
24759@@ -105,6 +107,7 @@
24760 struct saa7110 *decoder = i2c_get_clientdata(client);
24761 struct i2c_msg msg;
24762 u8 block_data[54];
24763+
24764 msg.len = 0;
24765 msg.buf = (char *) block_data;
24766 msg.addr = client->addr;
24767@@ -119,8 +122,8 @@
24768 }
24769 } else {
24770 while (len-- >= 1) {
24771- if ((ret =
24772- saa7110_write(client, reg++, *data++)) < 0)
24773+ if ((ret = saa7110_write(client, reg++,
24774+ *data++)) < 0)
24775 break;
24776 }
24777 }
24778@@ -279,6 +282,7 @@
24779 case DECODER_GET_CAPABILITIES:
24780 {
24781 struct video_decoder_capability *dc = arg;
24782+
24783 dc->flags =
24784 VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC |
24785 VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO;
24786diff -Nru a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
24787--- a/drivers/media/video/saa7111.c Thu Aug 21 10:13:46 2003
24788+++ b/drivers/media/video/saa7111.c Sun Aug 31 16:14:05 2003
24789@@ -93,6 +93,7 @@
24790 u8 value)
24791 {
24792 struct saa7111 *decoder = i2c_get_clientdata(client);
24793+
24794 decoder->reg[reg] = value;
24795 return i2c_smbus_write_byte_data(client, reg, value);
24796 }
24797@@ -112,6 +113,7 @@
24798 struct saa7111 *decoder = i2c_get_clientdata(client);
24799 struct i2c_msg msg;
24800 u8 block_data[32];
24801+
24802 msg.addr = client->addr;
24803 msg.flags = client->flags;
24804 while (len >= 2) {
24805@@ -125,16 +127,16 @@
24806 data += 2;
24807 } while (len >= 2 && data[0] == reg &&
24808 msg.len < 32);
24809- if ((ret =
24810- i2c_transfer(client->adapter, &msg, 1)) < 0)
24811+ if ((ret = i2c_transfer(client->adapter,
24812+ &msg, 1)) < 0)
24813 break;
24814 }
24815 } else {
24816 /* do some slow I2C emulation kind of thing */
24817 while (len >= 2) {
24818 reg = *data++;
24819- if ((ret =
24820- saa7111_write(client, reg, *data++)) < 0)
24821+ if ((ret = saa7111_write(client, reg,
24822+ *data++)) < 0)
24823 break;
24824 len -= 2;
24825 }
24826diff -Nru a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
24827--- a/drivers/media/video/saa7114.c Wed Aug 20 15:29:21 2003
24828+++ b/drivers/media/video/saa7114.c Sun Aug 31 16:14:05 2003
24829@@ -144,6 +144,7 @@
24830 u8 value)
24831 {
24832 /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
24833+
24834 /*decoder->reg[reg] = value;*/
24835 return i2c_smbus_write_byte_data(client, reg, value);
24836 }
24837@@ -163,6 +164,7 @@
24838 /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
24839 struct i2c_msg msg;
24840 u8 block_data[32];
24841+
24842 msg.addr = client->addr;
24843 msg.flags = client->flags;
24844 while (len >= 2) {
24845@@ -176,16 +178,16 @@
24846 data += 2;
24847 } while (len >= 2 && data[0] == reg &&
24848 msg.len < 32);
24849- if ((ret =
24850- i2c_transfer(client->adapter, &msg, 1)) < 0)
24851+ if ((ret = i2c_transfer(client->adapter,
24852+ &msg, 1)) < 0)
24853 break;
24854 }
24855 } else {
24856 /* do some slow I2C emulation kind of thing */
24857 while (len >= 2) {
24858 reg = *data++;
24859- if ((ret =
24860- saa7114_write(client, reg, *data++)) < 0)
24861+ if ((ret = saa7114_write(client, reg,
24862+ *data++)) < 0)
24863 break;
24864 len -= 2;
24865 }
24866@@ -995,6 +997,8 @@
24867 KERN_ERR
24868 "%s_attach: init error %d at stage %d, leaving attach.\n",
24869 I2C_NAME(client), i, err[i]);
24870+ kfree(decoder);
24871+ kfree(client);
24872 return 0;
24873 }
24874 }
24875@@ -1022,6 +1026,8 @@
24876 KERN_ERR
24877 "%s_attach: init error %d at stage %d, leaving attach.\n",
24878 I2C_NAME(client), i, err[i]);
24879+ kfree(decoder);
24880+ kfree(client);
24881 return 0;
24882 }
24883 }
24884@@ -1068,6 +1074,8 @@
24885 KERN_ERR
24886 "%s_attach: init error %d at stage %d, leaving attach.\n",
24887 I2C_NAME(client), i, err[i]);
24888+ kfree(decoder);
24889+ kfree(client);
24890 return 0;
24891 }
24892 }
24893@@ -1107,6 +1115,8 @@
24894 KERN_ERR
24895 "%s_attach: init error %d at stage %d, leaving attach.\n",
24896 I2C_NAME(client), i, err[i]);
24897+ kfree(decoder);
24898+ kfree(client);
24899 return 0;
24900 }
24901 }
24902@@ -1127,6 +1137,8 @@
24903 KERN_ERR
24904 "%s_attach: init error %d at stage %d, leaving attach.\n",
24905 I2C_NAME(client), i, err[i]);
24906+ kfree(decoder);
24907+ kfree(client);
24908 return 0;
24909 }
24910 }
24911diff -Nru a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
24912--- a/drivers/media/video/saa7134/saa7134-oss.c Sun May 25 17:00:00 2003
24913+++ b/drivers/media/video/saa7134/saa7134-oss.c Tue Aug 26 09:25:41 2003
24914@@ -215,7 +215,7 @@
24915
24916 static int dsp_open(struct inode *inode, struct file *file)
24917 {
24918- int minor = minor(inode->i_rdev);
24919+ int minor = iminor(inode);
24920 struct saa7134_dev *h,*dev = NULL;
24921 struct list_head *list;
24922 int err;
24923@@ -598,7 +598,7 @@
24924
24925 static int mixer_open(struct inode *inode, struct file *file)
24926 {
24927- int minor = minor(inode->i_rdev);
24928+ int minor = iminor(inode);
24929 struct saa7134_dev *h,*dev = NULL;
24930 struct list_head *list;
24931
24932diff -Nru a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
24933--- a/drivers/media/video/saa7134/saa7134-ts.c Thu Jul 31 16:47:19 2003
24934+++ b/drivers/media/video/saa7134/saa7134-ts.c Tue Aug 26 09:25:41 2003
24935@@ -166,7 +166,7 @@
24936
24937 static int ts_open(struct inode *inode, struct file *file)
24938 {
24939- int minor = minor(inode->i_rdev);
24940+ int minor = iminor(inode);
24941 struct saa7134_dev *h,*dev = NULL;
24942 struct list_head *list;
24943 int err;
24944diff -Nru a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
24945--- a/drivers/media/video/saa7134/saa7134-video.c Thu Jul 31 16:47:19 2003
24946+++ b/drivers/media/video/saa7134/saa7134-video.c Tue Aug 26 09:25:41 2003
24947@@ -1131,7 +1131,7 @@
24948
24949 static int video_open(struct inode *inode, struct file *file)
24950 {
24951- int minor = minor(inode->i_rdev);
24952+ int minor = iminor(inode);
24953 struct saa7134_dev *h,*dev = NULL;
24954 struct saa7134_fh *fh;
24955 struct list_head *list;
24956diff -Nru a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
24957--- a/drivers/media/video/saa7185.c Wed Aug 20 15:29:21 2003
24958+++ b/drivers/media/video/saa7185.c Sun Aug 31 16:14:05 2003
24959@@ -98,6 +98,7 @@
24960 u8 value)
24961 {
24962 struct saa7185 *encoder = i2c_get_clientdata(client);
24963+
24964 dprintk(1, KERN_DEBUG "SAA7185: %02x set to %02x\n", reg, value);
24965 encoder->reg[reg] = value;
24966 return i2c_smbus_write_byte_data(client, reg, value);
24967@@ -118,6 +119,7 @@
24968 struct saa7185 *encoder = i2c_get_clientdata(client);
24969 struct i2c_msg msg;
24970 u8 block_data[32];
24971+
24972 msg.addr = client->addr;
24973 msg.flags = client->flags;
24974 while (len >= 2) {
24975@@ -131,16 +133,16 @@
24976 data += 2;
24977 } while (len >= 2 && data[0] == reg &&
24978 msg.len < 32);
24979- if ((ret =
24980- i2c_transfer(client->adapter, &msg, 1)) < 0)
24981+ if ((ret = i2c_transfer(client->adapter,
24982+ &msg, 1)) < 0)
24983 break;
24984 }
24985 } else {
24986 /* do some slow I2C emulation kind of thing */
24987 while (len >= 2) {
24988 reg = *data++;
24989- if ((ret =
24990- saa7185_write(client, reg, *data++)) < 0)
24991+ if ((ret = saa7185_write(client, reg,
24992+ *data++)) < 0)
24993 break;
24994 len -= 2;
24995 }
24996@@ -434,6 +436,7 @@
24997
24998 encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL);
24999 if (encoder == NULL) {
25000+ kfree(client);
25001 return -ENOMEM;
25002 }
25003 memset(encoder, 0, sizeof(struct saa7185));
25004diff -Nru a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
25005--- a/drivers/media/video/stradis.c Thu Apr 24 03:35:23 2003
25006+++ b/drivers/media/video/stradis.c Tue Aug 26 09:25:41 2003
25007@@ -1946,7 +1946,7 @@
25008 static int saa_open(struct inode *inode, struct file *file)
25009 {
25010 struct saa7146 *saa = NULL;
25011- unsigned int minor = minor(inode->i_rdev);
25012+ unsigned int minor = iminor(inode);
25013 int i;
25014
25015 for (i = 0; i < SAA7146_MAX; i++) {
25016diff -Nru a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
25017--- a/drivers/media/video/tvmixer.c Wed Aug 20 15:29:21 2003
25018+++ b/drivers/media/video/tvmixer.c Tue Aug 26 09:25:41 2003
25019@@ -173,7 +173,7 @@
25020
25021 static int tvmixer_open(struct inode *inode, struct file *file)
25022 {
25023- int i, minor = minor(inode->i_rdev);
25024+ int i, minor = iminor(inode);
25025 struct TVMIXER *mix = NULL;
25026 struct i2c_client *client = NULL;
25027
25028diff -Nru a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
25029--- a/drivers/media/video/videodev.c Wed Aug 6 02:51:26 2003
25030+++ b/drivers/media/video/videodev.c Sun Aug 31 16:13:58 2003
25031@@ -99,7 +99,7 @@
25032
25033 struct video_device* video_devdata(struct file *file)
25034 {
25035- return video_device[minor(file->f_dentry->d_inode->i_rdev)];
25036+ return video_device[iminor(file->f_dentry->d_inode)];
25037 }
25038
25039 /*
25040@@ -107,7 +107,7 @@
25041 */
25042 static int video_open(struct inode *inode, struct file *file)
25043 {
25044- unsigned int minor = minor(inode->i_rdev);
25045+ unsigned int minor = iminor(inode);
25046 int err = 0;
25047 struct video_device *vfl;
25048 struct file_operations *old_fops;
25049@@ -349,9 +349,9 @@
25050 if(video_device[vfd->minor]!=vfd)
25051 panic("videodev: bad unregister");
25052
25053- class_device_unregister(&vfd->class_dev);
25054 devfs_remove(vfd->devfs_name);
25055 video_device[vfd->minor]=NULL;
25056+ class_device_unregister(&vfd->class_dev);
25057 up(&videodev_lock);
25058 }
25059
25060diff -Nru a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
25061--- a/drivers/media/video/vpx3220.c Wed Aug 20 15:29:21 2003
25062+++ b/drivers/media/video/vpx3220.c Sun Aug 31 16:14:05 2003
25063@@ -76,6 +76,7 @@
25064 u8 value)
25065 {
25066 struct vpx3220 *decoder = i2c_get_clientdata(client);
25067+
25068 decoder->reg[reg] = value;
25069 return i2c_smbus_write_byte_data(client, reg, value);
25070 }
25071@@ -294,6 +295,7 @@
25072 {
25073 int len = sizeof(init_common);
25074 const unsigned char *data = init_common;
25075+
25076 while (len > 1) {
25077 dprintk(1,
25078 KERN_DEBUG "vpx3216b i2c reg 0x%02x data 0x%02x\n",
25079diff -Nru a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h
25080--- a/drivers/media/video/zoran.h Wed Aug 20 15:29:21 2003
25081+++ b/drivers/media/video/zoran.h Sun Aug 31 16:14:06 2003
25082@@ -146,7 +146,7 @@
25083
25084 #define ZORAN_NAME "ZORAN" /* name of the device */
25085
25086-#define ZR_DEVNAME(zr) pci_name((zr)->pci_dev)
25087+#define ZR_DEVNAME(zr) ((zr)->name)
25088
25089 #define BUZ_MAX_WIDTH (zr->timing->Wa)
25090 #define BUZ_MAX_HEIGHT (zr->timing->Ha)
25091@@ -383,7 +383,7 @@
25092 };
25093
25094 struct zoran {
25095- struct video_device video_dev;
25096+ struct video_device *video_dev;
25097
25098 struct i2c_adapter i2c_adapter; /* */
25099 struct i2c_algo_bit_data i2c_algo; /* */
25100@@ -403,9 +403,7 @@
25101 struct tvnorm *timing;
25102
25103 unsigned short id; /* number of this device */
25104-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
25105 char name[32]; /* name of this device */
25106-#endif
25107 struct pci_dev *pci_dev; /* PCI device */
25108 unsigned char revision; /* revision of zr36057 */
25109 unsigned int zr36057_adr; /* bus address of IO mem returned by PCI BIOS */
25110diff -Nru a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
25111--- a/drivers/media/video/zoran_card.c Wed Aug 20 15:29:21 2003
25112+++ b/drivers/media/video/zoran_card.c Sun Aug 31 16:14:05 2003
25113@@ -136,7 +136,8 @@
25114 MODULE_PARM_DESC(pass_through,
25115 "Pass TV signal through to TV-out when idling");
25116
25117-int debug = 1;
25118+static int debug = 1;
25119+int *zr_debug = &debug;
25120 MODULE_PARM(debug, "i");
25121 MODULE_PARM_DESC(debug, "Debug level (0-4)");
25122
25123@@ -153,7 +154,7 @@
25124
25125 #define dprintk(num, format, args...) \
25126 do { \
25127- if (debug >= num) \
25128+ if (*zr_debug >= num) \
25129 printk(format, ##args); \
25130 } while (0)
25131
25132@@ -623,6 +624,7 @@
25133 zoran_i2c_getsda (void *data)
25134 {
25135 struct zoran *zr = (struct zoran *) data;
25136+
25137 return (btread(ZR36057_I2CBR) >> 1) & 1;
25138 }
25139
25140@@ -630,6 +632,7 @@
25141 zoran_i2c_getscl (void *data)
25142 {
25143 struct zoran *zr = (struct zoran *) data;
25144+
25145 return btread(ZR36057_I2CBR) & 1;
25146 }
25147
25148@@ -638,6 +641,7 @@
25149 int state)
25150 {
25151 struct zoran *zr = (struct zoran *) data;
25152+
25153 if (state)
25154 zr->i2cbr |= 2;
25155 else
25156@@ -650,6 +654,7 @@
25157 int state)
25158 {
25159 struct zoran *zr = (struct zoran *) data;
25160+
25161 if (state)
25162 zr->i2cbr |= 1;
25163 else
25164@@ -766,6 +771,7 @@
25165 struct zoran_jpg_settings *settings)
25166 {
25167 int err = 0, err0 = 0;
25168+
25169 dprintk(4,
25170 KERN_DEBUG
25171 "%s: check_jpg_settings() - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n",
25172@@ -977,7 +983,7 @@
25173 if (timeout) {
25174 dprintk(1, ": time spent: %d\n", 1 * HZ - timeout);
25175 }
25176- if (debug > 1)
25177+ if (*zr_debug > 1)
25178 print_interrupts(zr);
25179 btwrite(icr, ZR36057_ICR);
25180 }
25181@@ -986,6 +992,7 @@
25182 zr36057_init (struct zoran *zr)
25183 {
25184 unsigned long mem;
25185+ void *vdev;
25186 unsigned mem_needed;
25187 int j;
25188 int two = 2;
25189@@ -1040,11 +1047,16 @@
25190 * in case allocation fails */
25191 mem_needed = BUZ_NUM_STAT_COM * 4;
25192 mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL);
25193- if (!mem) {
25194+ vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);
25195+ if (!mem || !vdev) {
25196 dprintk(1,
25197 KERN_ERR
25198 "%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
25199 ZR_DEVNAME(zr));
25200+ if (vdev)
25201+ kfree(vdev);
25202+ if (mem)
25203+ kfree((void *)mem);
25204 return -ENOMEM;
25205 }
25206 memset((void *) mem, 0, mem_needed);
25207@@ -1056,17 +1068,19 @@
25208 /*
25209 * Now add the template and register the device unit.
25210 */
25211- memcpy(&zr->video_dev, &zoran_template, sizeof(zoran_template));
25212- strcpy(zr->video_dev.name, ZR_DEVNAME(zr));
25213- if (video_register_device
25214- (&zr->video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
25215+ zr->video_dev = vdev;
25216+ memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
25217+ strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
25218+ if (video_register_device(zr->video_dev, VFL_TYPE_GRABBER,
25219+ video_nr) < 0) {
25220 zoran_unregister_i2c(zr);
25221 kfree((void *) zr->stat_com);
25222+ kfree(vdev);
25223 return -1;
25224 }
25225
25226 zoran_init_hardware(zr);
25227- if (debug > 2)
25228+ if (*zr_debug > 2)
25229 detect_guest_activity(zr);
25230 test_interrupts(zr);
25231 if (!pass_through) {
25232@@ -1109,7 +1123,14 @@
25233 kfree((void *) zr->stat_com);
25234 zoran_proc_cleanup(zr);
25235 iounmap(zr->zr36057_mem);
25236- video_unregister_device(&zr->video_dev);
25237+ pci_disable_device(zr->pci_dev);
25238+ video_unregister_device(zr->video_dev);
25239+}
25240+
25241+void
25242+zoran_vdev_release (struct video_device *vdev)
25243+{
25244+ kfree(vdev);
25245 }
25246
25247 static struct videocodec_master * __devinit
25248@@ -1207,6 +1228,7 @@
25249 } else {
25250 int i;
25251 unsigned short ss_vendor, ss_device;
25252+
25253 ss_vendor = zr->pci_dev->subsystem_vendor;
25254 ss_device = zr->pci_dev->subsystem_device;
25255 dprintk(1,
25256@@ -1467,6 +1489,7 @@
25257 init_dc10_cards (void)
25258 {
25259 int i;
25260+
25261 memset(zoran, 0, sizeof(zoran));
25262 printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n",
25263 MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION);
25264@@ -1523,6 +1546,7 @@
25265 /* take care of Natoma chipset and a revision 1 zr36057 */
25266 for (i = 0; i < zoran_num; i++) {
25267 struct zoran *zr = &zoran[i];
25268+
25269 if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) {
25270 zr->jpg_buffers.need_contiguous = 1;
25271 dprintk(1,
25272@@ -1546,6 +1570,7 @@
25273 unload_dc10_cards (void)
25274 {
25275 int i;
25276+
25277 for (i = 0; i < zoran_num; i++)
25278 zoran_release(&zoran[i]);
25279 }
25280diff -Nru a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h
25281--- a/drivers/media/video/zoran_card.h Wed Aug 20 14:29:31 2003
25282+++ b/drivers/media/video/zoran_card.h Sun Aug 31 16:14:03 2003
25283@@ -40,5 +40,6 @@
25284 extern int zoran_check_jpg_settings(struct zoran *zr,
25285 struct zoran_jpg_settings *settings);
25286 extern void zoran_open_init_params(struct zoran *zr);
25287+extern void zoran_vdev_release(struct video_device *vdev);
25288
25289 #endif /* __ZORAN_CARD_H__ */
25290diff -Nru a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
25291--- a/drivers/media/video/zoran_device.c Wed Aug 20 14:29:31 2003
25292+++ b/drivers/media/video/zoran_device.c Sun Aug 31 16:14:05 2003
25293@@ -58,11 +58,11 @@
25294 extern const struct zoran_format zoran_formats[];
25295 extern const int zoran_num_formats;
25296
25297-extern int debug;
25298+extern int *zr_debug;
25299
25300 #define dprintk(num, format, args...) \
25301 do { \
25302- if (debug >= num) \
25303+ if (*zr_debug >= num) \
25304 printk(format, ##args); \
25305 } while (0)
25306
25307@@ -170,7 +170,7 @@
25308 static void
25309 dump_guests (struct zoran *zr)
25310 {
25311- if (debug > 2) {
25312+ if (*zr_debug > 2) {
25313 int i, guest[8];
25314
25315 for (i = 1; i < 8; i++) { // Don't read jpeg codec here
25316@@ -190,6 +190,7 @@
25317 get_time (void)
25318 {
25319 struct timeval tv;
25320+
25321 do_gettimeofday(&tv);
25322 return (1000000 * tv.tv_sec + tv.tv_usec);
25323 }
25324@@ -868,8 +869,8 @@
25325 void
25326 print_interrupts (struct zoran *zr)
25327 {
25328- int res, noerr;
25329- noerr = 0;
25330+ int res, noerr = 0;
25331+
25332 printk(KERN_INFO "%s: interrupts received:", ZR_DEVNAME(zr));
25333 if ((res = zr->field_counter) < -1 || res > 1) {
25334 printk(" FD:%d", res);
25335@@ -931,6 +932,7 @@
25336 count_reset_interrupt (struct zoran *zr)
25337 {
25338 u32 isr;
25339+
25340 if ((isr = btread(ZR36057_ISR) & 0x78000000)) {
25341 if (isr & ZR36057_ISR_GIRQ1) {
25342 btwrite(ZR36057_ISR_GIRQ1, ZR36057_ISR);
25343@@ -961,6 +963,7 @@
25344 jpeg_start (struct zoran *zr)
25345 {
25346 int reg;
25347+
25348 zr->frame_num = 0;
25349
25350 /* deassert P_reset, disable code transfer, deassert Active */
25351@@ -1272,7 +1275,7 @@
25352 zr->num_errors++;
25353
25354 /* Report error */
25355- if (debug > 1 && zr->num_errors <= 8) {
25356+ if (*zr_debug > 1 && zr->num_errors <= 8) {
25357 long frame;
25358 frame =
25359 zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
25360@@ -1453,38 +1456,23 @@
25361 0) {
25362 /* it is finished, notify the user */
25363
25364- zr->v4l_buffers.buffer[zr->
25365- v4l_grab_frame].
25366- state = BUZ_STATE_DONE;
25367- zr->v4l_buffers.buffer[zr->
25368- v4l_grab_frame].
25369- bs.seq =
25370- zr->v4l_grab_seq;
25371- do_gettimeofday(&zr->
25372- v4l_buffers.
25373- buffer[zr->
25374- v4l_grab_frame].
25375- bs.
25376- timestamp);
25377- zr->v4l_grab_frame =
25378- NO_GRAB_ACTIVE;
25379+ zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE;
25380+ zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq;
25381+ do_gettimeofday(&zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.timestamp);
25382+ zr->v4l_grab_frame = NO_GRAB_ACTIVE;
25383 zr->v4l_pend_tail++;
25384 }
25385 }
25386
25387 if (zr->v4l_grab_frame == NO_GRAB_ACTIVE)
25388- wake_up_interruptible(&zr->
25389- v4l_capq);
25390+ wake_up_interruptible(&zr->v4l_capq);
25391
25392 /* Check if there is another grab queued */
25393
25394 if (zr->v4l_grab_frame == NO_GRAB_ACTIVE &&
25395- zr->v4l_pend_tail !=
25396- zr->v4l_pend_head) {
25397+ zr->v4l_pend_tail != zr->v4l_pend_head) {
25398
25399- int frame =
25400- zr->v4l_pend[zr->
25401- v4l_pend_tail &
25402+ int frame = zr->v4l_pend[zr->v4l_pend_tail &
25403 V4L_MASK_FRAME];
25404 u32 reg;
25405
25406@@ -1544,7 +1532,7 @@
25407
25408 if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS ||
25409 zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
25410- if (debug > 1 &&
25411+ if (*zr_debug > 1 &&
25412 (!zr->frame_num || zr->JPEG_error)) {
25413 printk(KERN_INFO
25414 "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n",
25415@@ -1559,11 +1547,8 @@
25416 int i;
25417 strcpy(sv, sc);
25418 for (i = 0; i < 4; i++) {
25419- if (zr->
25420- stat_com[i] &
25421- 1)
25422- sv[i] =
25423- '1';
25424+ if (zr->stat_com[i] & 1)
25425+ sv[i] = '1';
25426 }
25427 sv[4] = 0;
25428 printk(KERN_INFO
25429@@ -1584,7 +1569,7 @@
25430 zr->JPEG_missed;
25431 }
25432
25433- if (debug > 2 && zr->frame_num < 6) {
25434+ if (*zr_debug > 2 && zr->frame_num < 6) {
25435 int i;
25436 printk("%s: seq=%ld stat_com:",
25437 ZR_DEVNAME(zr), zr->jpg_seq_num);
25438@@ -1643,10 +1628,11 @@
25439 zoran_set_pci_master (struct zoran *zr,
25440 int set_master)
25441 {
25442- u16 command;
25443 if (set_master) {
25444 pci_set_master(zr->pci_dev);
25445 } else {
25446+ u16 command;
25447+
25448 pci_read_config_word(zr->pci_dev, PCI_COMMAND, &command);
25449 command &= ~PCI_COMMAND_MASTER;
25450 pci_write_config_word(zr->pci_dev, PCI_COMMAND, command);
25451@@ -1657,6 +1643,7 @@
25452 zoran_init_hardware (struct zoran *zr)
25453 {
25454 int j, zero = 0;
25455+
25456 /* Enable bus-mastering */
25457 zoran_set_pci_master(zr, 1);
25458
25459@@ -1718,6 +1705,7 @@
25460 zr36057_init_vfe (struct zoran *zr)
25461 {
25462 u32 reg;
25463+
25464 reg = btread(ZR36057_VFESPFR);
25465 reg |= ZR36057_VFESPFR_LittleEndian;
25466 reg &= ~ZR36057_VFESPFR_VCLKPol;
25467@@ -1748,6 +1736,7 @@
25468 if (zr->card.type == LML33 &&
25469 (cmd == DECODER_SET_NORM || DECODER_SET_INPUT)) {
25470 int res;
25471+
25472 // Bt819 needs to reset its FIFO buffer using #FRST pin and
25473 // LML33 card uses GPIO(7) for that.
25474 GPIO(zr, 7, 0);
25475diff -Nru a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
25476--- a/drivers/media/video/zoran_driver.c Wed Aug 20 14:29:31 2003
25477+++ b/drivers/media/video/zoran_driver.c Sun Aug 31 16:14:05 2003
25478@@ -51,6 +51,7 @@
25479 #include <linux/delay.h>
25480 #include <linux/slab.h>
25481 #include <linux/pci.h>
25482+#include <linux/vmalloc.h>
25483
25484 #include <linux/interrupt.h>
25485 #include <linux/i2c.h>
25486@@ -187,11 +188,11 @@
25487 # include <linux/bigphysarea.h>
25488 #endif
25489
25490-extern int debug;
25491+extern int *zr_debug;
25492
25493 #define dprintk(num, format, args...) \
25494 do { \
25495- if (debug >= num) \
25496+ if (*zr_debug >= num) \
25497 printk(format, ##args); \
25498 } while (0)
25499
25500@@ -370,6 +371,7 @@
25501 int n =
25502 (fh->v4l_buffers.buffer_size + PAGE_SIZE -
25503 1) / PAGE_SIZE;
25504+
25505 mem =
25506 (unsigned char *) bigphysarea_alloc_pages(n, 0,
25507 GFP_KERNEL);
25508@@ -412,6 +414,7 @@
25509 int size =
25510 fh->v4l_buffers.num_buffers *
25511 fh->v4l_buffers.buffer_size;
25512+
25513 pmem = get_high_mem(size);
25514 if (pmem == 0) {
25515 dprintk(1,
25516@@ -847,9 +850,10 @@
25517 if (res)
25518 return res;
25519 }
25520- if ((res =
25521- zoran_v4l_set_format(file, mp->width, mp->height,
25522- &zoran_formats[i])))
25523+ if ((res = zoran_v4l_set_format(file,
25524+ mp->width,
25525+ mp->height,
25526+ &zoran_formats[i])))
25527 return res;
25528 zr->v4l_settings = fh->v4l_settings;
25529
25530@@ -1144,7 +1148,7 @@
25531 frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME];
25532
25533 /* buffer should now be in BUZ_STATE_DONE */
25534- if (debug > 0)
25535+ if (*zr_debug > 0)
25536 if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE)
25537 dprintk(2,
25538 KERN_ERR
25539@@ -1268,7 +1272,7 @@
25540
25541 /* find the device */
25542 for (i = 0; i < zoran_num; i++) {
25543- if (zoran[i].video_dev.minor == minor) {
25544+ if (zoran[i].video_dev->minor == minor) {
25545 zr = &zoran[i];
25546 break;
25547 }
25548@@ -1424,7 +1428,7 @@
25549 /* disable interrupts */
25550 btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR);
25551
25552- if (debug > 1)
25553+ if (*zr_debug > 1)
25554 print_interrupts(zr);
25555
25556 /* Overlay off */
25557@@ -2032,6 +2036,7 @@
25558 case VIDIOCGCAP:
25559 {
25560 struct video_capability *vcap = arg;
25561+
25562 dprintk(3, KERN_DEBUG "%s: VIDIOCGCAP\n", ZR_DEVNAME(zr));
25563
25564 memset(vcap, 0, sizeof(struct video_capability));
25565@@ -2154,6 +2159,7 @@
25566
25567 for (i = 0; i < zoran_num_formats; i++) {
25568 const struct zoran_format *fmt = &zoran_formats[i];
25569+
25570 if (fmt->palette != -1 &&
25571 fmt->flags & ZORAN_FORMAT_OVERLAY &&
25572 fmt->palette == vpict->palette &&
25573@@ -2203,7 +2209,9 @@
25574 case VIDIOCGWIN:
25575 {
25576 struct video_window *vwin = arg;
25577+
25578 dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr));
25579+
25580 memset(vwin, 0, sizeof(struct video_window));
25581 down(&zr->resource_lock);
25582 vwin->x = fh->overlay_settings.x;
25583@@ -2241,7 +2249,9 @@
25584 case VIDIOCGFBUF:
25585 {
25586 struct video_buffer *vbuf = arg;
25587+
25588 dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr));
25589+
25590 down(&zr->resource_lock);
25591 *vbuf = zr->buffer;
25592 up(&zr->resource_lock);
25593@@ -2285,8 +2295,10 @@
25594 case VIDIOCSYNC:
25595 {
25596 int *frame = arg, res;
25597+
25598 dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n",
25599 ZR_DEVNAME(zr), *frame);
25600+
25601 down(&zr->resource_lock);
25602 res = v4l_sync(file, *frame);
25603 up(&zr->resource_lock);
25604@@ -2300,11 +2312,13 @@
25605 {
25606 struct video_mmap *vmap = arg;
25607 int res;
25608+
25609 dprintk(3,
25610 KERN_DEBUG
25611 "%s: VIDIOCMCAPTURE - frame=%d, geom=%dx%d, fmt=%d\n",
25612 ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height,
25613 vmap->format);
25614+
25615 down(&zr->resource_lock);
25616 res = v4l_grab(file, vmap);
25617 up(&zr->resource_lock);
25618@@ -2358,7 +2372,8 @@
25619 struct video_unit *vunit = arg;
25620
25621 dprintk(3, KERN_DEBUG "%s: VIDIOCGUNIT\n", ZR_DEVNAME(zr));
25622- vunit->video = zr->video_dev.minor;
25623+
25624+ vunit->video = zr->video_dev->minor;
25625 vunit->vbi = VIDEO_NO_UNIT;
25626 vunit->radio = VIDEO_NO_UNIT;
25627 vunit->audio = VIDEO_NO_UNIT;
25628@@ -2393,6 +2408,7 @@
25629 case BUZIOC_G_PARAMS:
25630 {
25631 struct zoran_params *bparams = arg;
25632+
25633 dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr));
25634
25635 memset(bparams, 0, sizeof(struct zoran_params));
25636@@ -2686,6 +2702,7 @@
25637 struct v4l2_fmtdesc *fmt = arg;
25638 int index = fmt->index, num = -1, i, flag = 0, type =
25639 fmt->type;
25640+
25641 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUM_FMT - index=%d\n",
25642 ZR_DEVNAME(zr), fmt->index);
25643
25644@@ -3530,6 +3547,7 @@
25645 case VIDIOC_QUERYCTRL:
25646 {
25647 struct v4l2_queryctrl *ctrl = arg;
25648+
25649 dprintk(3, KERN_DEBUG "%s: VIDIOC_QUERYCTRL - id=%d\n",
25650 ZR_DEVNAME(zr), ctrl->id);
25651
25652@@ -3571,6 +3589,7 @@
25653 case VIDIOC_G_CTRL:
25654 {
25655 struct v4l2_control *ctrl = arg;
25656+
25657 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_CTRL - id=%d\n",
25658 ZR_DEVNAME(zr), ctrl->id);
25659
25660@@ -3652,6 +3671,7 @@
25661 case VIDIOC_ENUMSTD:
25662 {
25663 struct v4l2_standard *std = arg;
25664+
25665 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMSTD - index=%d\n",
25666 ZR_DEVNAME(zr), std->index);
25667
25668@@ -3707,6 +3727,7 @@
25669 {
25670 v4l2_std_id *std = arg;
25671 int norm;
25672+
25673 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr));
25674
25675 down(&zr->resource_lock);
25676@@ -3804,6 +3825,7 @@
25677 case VIDIOC_G_INPUT:
25678 {
25679 int *input = arg;
25680+
25681 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr));
25682
25683 down(&zr->resource_lock);
25684@@ -3817,6 +3839,7 @@
25685 case VIDIOC_S_INPUT:
25686 {
25687 int *input = arg, res = 0;
25688+
25689 dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n",
25690 ZR_DEVNAME(zr), *input);
25691
25692@@ -3835,6 +3858,7 @@
25693 case VIDIOC_ENUMOUTPUT:
25694 {
25695 struct v4l2_output *outp = arg;
25696+
25697 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMOUTPUT - index=%d\n",
25698 ZR_DEVNAME(zr), outp->index);
25699
25700@@ -4005,7 +4029,9 @@
25701 case VIDIOC_G_JPEGCOMP:
25702 {
25703 struct v4l2_jpegcompression *params = arg;
25704- dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n", ZR_DEVNAME(zr));
25705+
25706+ dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n",
25707+ ZR_DEVNAME(zr));
25708
25709 memset(params, 0, sizeof(*params));
25710
25711@@ -4175,6 +4201,7 @@
25712 } else if (fmt->type ==
25713 V4L2_BUF_TYPE_VIDEO_CAPTURE) {
25714 int i;
25715+
25716 for (i = 0; i < zoran_num_formats; i++)
25717 if (zoran_formats[i].fourcc ==
25718 fmt->fmt.pix.pixelformat)
25719@@ -4321,6 +4348,7 @@
25720 zoran_vm_open (struct vm_area_struct *vma)
25721 {
25722 struct zoran_mapping *map = vma->vm_private_data;
25723+
25724 map->count++;
25725 }
25726
25727@@ -4665,5 +4693,6 @@
25728 #endif
25729 .hardware = ZORAN_HARDWARE,
25730 .fops = &zoran_fops,
25731+ .release = &zoran_vdev_release,
25732 .minor = -1
25733 };
25734diff -Nru a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c
25735--- a/drivers/media/video/zoran_procfs.c Wed Aug 20 15:38:07 2003
25736+++ b/drivers/media/video/zoran_procfs.c Sun Aug 31 16:14:05 2003
25737@@ -49,11 +49,11 @@
25738 #include "zoran.h"
25739 #include "zoran_procfs.h"
25740
25741-extern int debug;
25742+extern int *zr_debug;
25743
25744 #define dprintk(num, format, args...) \
25745 do { \
25746- if (debug >= num) \
25747+ if (*zr_debug >= num) \
25748 printk(format, ##args); \
25749 } while (0)
25750
25751@@ -248,6 +248,7 @@
25752 {
25753 #ifdef CONFIG_PROC_FS
25754 char name[8];
25755+
25756 snprintf(name, 7, "zoran%d", zr->id);
25757 if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
25758 zr->zoran_proc->read_proc = zoran_read_proc;
25759@@ -272,6 +273,7 @@
25760 {
25761 #ifdef CONFIG_PROC_FS
25762 char name[8];
25763+
25764 snprintf(name, 7, "zoran%d", zr->id);
25765 if (zr->zoran_proc) {
25766 remove_proc_entry(name, 0);
25767diff -Nru a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c
25768--- a/drivers/mtd/maps/ceiva.c Wed May 28 08:01:03 2003
25769+++ b/drivers/mtd/maps/ceiva.c Sun Aug 31 16:14:08 2003
25770@@ -64,23 +64,23 @@
25771
25772 static struct mtd_partition ceiva_partitions[] = {
25773 {
25774- name: "Ceiva BOOT partition",
25775- size: BOOT_PARTITION_SIZE_KiB*1024,
25776- offset: 0,
25777+ .name = "Ceiva BOOT partition",
25778+ .size = BOOT_PARTITION_SIZE_KiB*1024,
25779+ .offset = 0,
25780
25781 },{
25782- name: "Ceiva parameters partition",
25783- size: PARAMS_PARTITION_SIZE_KiB*1024,
25784- offset: (16 + 8) * 1024,
25785+ .name = "Ceiva parameters partition",
25786+ .size = PARAMS_PARTITION_SIZE_KiB*1024,
25787+ .offset = (16 + 8) * 1024,
25788 },{
25789- name: "Ceiva kernel partition",
25790- size: (KERNEL_PARTITION_SIZE_KiB)*1024,
25791- offset: 0x20000,
25792+ .name = "Ceiva kernel partition",
25793+ .size = (KERNEL_PARTITION_SIZE_KiB)*1024,
25794+ .offset = 0x20000,
25795
25796 },{
25797- name: "Ceiva root filesystem partition",
25798- offset: MTDPART_OFS_APPEND,
25799- size: (ROOT_PARTITION_SIZE_KiB)*1024,
25800+ .name = "Ceiva root filesystem partition",
25801+ .offset = MTDPART_OFS_APPEND,
25802+ .size = (ROOT_PARTITION_SIZE_KiB)*1024,
25803 }
25804 };
25805 #endif
25806diff -Nru a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
25807--- a/drivers/mtd/maps/pcmciamtd.c Wed Jun 25 03:30:03 2003
25808+++ b/drivers/mtd/maps/pcmciamtd.c Sat Aug 23 08:27:27 2003
25809@@ -344,9 +344,8 @@
25810 * still open, this will be postponed until it is closed.
25811 */
25812
25813-static void pcmciamtd_release(u_long arg)
25814+static void pcmciamtd_release(dev_link_t *link)
25815 {
25816- dev_link_t *link = (dev_link_t *)arg;
25817 struct pcmciamtd_dev *dev = link->priv;
25818
25819 DEBUG(3, "link = 0x%p", link);
25820@@ -564,7 +563,7 @@
25821
25822 if(!dev->win_size) {
25823 err("Cant allocate memory window");
25824- pcmciamtd_release((u_long)link);
25825+ pcmciamtd_release(link);
25826 return;
25827 }
25828 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
25829@@ -576,7 +575,7 @@
25830 dev->win_base = ioremap(req.Base, req.Size);
25831 if(!dev->win_base) {
25832 err("ioremap(%lu, %u) failed", req.Base, req.Size);
25833- pcmciamtd_release((u_long)link);
25834+ pcmciamtd_release(link);
25835 return;
25836 }
25837 DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x",
25838@@ -631,7 +630,7 @@
25839
25840 if(!mtd) {
25841 DEBUG(1, "Cant find an MTD");
25842- pcmciamtd_release((u_long)link);
25843+ pcmciamtd_release(link);
25844 return;
25845 }
25846
25847@@ -671,7 +670,7 @@
25848 map_destroy(mtd);
25849 dev->mtd_info = NULL;
25850 err("Couldnt register MTD device");
25851- pcmciamtd_release((u_long)link);
25852+ pcmciamtd_release(link);
25853 return;
25854 }
25855 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
25856@@ -683,7 +682,7 @@
25857 cs_failed:
25858 cs_error(link->handle, last_fn, last_ret);
25859 err("CS Error, exiting");
25860- pcmciamtd_release((u_long)link);
25861+ pcmciamtd_release(link);
25862 return;
25863 }
25864
25865@@ -710,7 +709,7 @@
25866 del_mtd_device(dev->mtd_info);
25867 info("mtd%d: Removed", dev->mtd_info->index);
25868 }
25869- mod_timer(&link->release, jiffies + HZ/20);
25870+ pcmciamtd_release(link);
25871 }
25872 break;
25873 case CS_EVENT_CARD_INSERTION:
25874@@ -751,10 +750,8 @@
25875 {
25876 DEBUG(3, "link=0x%p", link);
25877
25878- del_timer(&link->release);
25879-
25880 if(link->state & DEV_CONFIG) {
25881- pcmciamtd_release((u_long)link);
25882+ pcmciamtd_release(link);
25883 }
25884
25885 if (link->handle) {
25886@@ -789,10 +786,6 @@
25887 memset(dev, 0, sizeof(*dev));
25888 link = &dev->link;
25889 link->priv = dev;
25890-
25891- init_timer(&link->release);
25892- link->release.function = &pcmciamtd_release;
25893- link->release.data = (u_long)link;
25894
25895 link->conf.Attributes = 0;
25896 link->conf.IntType = INT_MEMORY;
25897diff -Nru a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
25898--- a/drivers/mtd/mtdchar.c Wed May 28 08:01:05 2003
25899+++ b/drivers/mtd/mtdchar.c Tue Aug 26 09:25:41 2003
25900@@ -59,7 +59,7 @@
25901
25902 static int mtd_open(struct inode *inode, struct file *file)
25903 {
25904- int minor = minor(inode->i_rdev);
25905+ int minor = iminor(inode);
25906 int devnum = minor >> 1;
25907 struct mtd_info *mtd;
25908
25909diff -Nru a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c
25910--- a/drivers/mtd/nand/autcpu12.c Mon Jun 23 05:34:08 2003
25911+++ b/drivers/mtd/nand/autcpu12.c Sun Aug 31 16:14:08 2003
25912@@ -73,39 +73,39 @@
25913 extern struct nand_oobinfo jffs2_oobinfo;
25914
25915 static struct mtd_partition partition_info16k[] = {
25916- { name: "AUTCPU12 flash partition 1",
25917- offset: 0,
25918- size: 8 * SZ_1M },
25919- { name: "AUTCPU12 flash partition 2",
25920- offset: 8 * SZ_1M,
25921- size: 8 * SZ_1M },
25922+ { .name = "AUTCPU12 flash partition 1",
25923+ .offset = 0,
25924+ .size = 8 * SZ_1M },
25925+ { .name = "AUTCPU12 flash partition 2",
25926+ .offset = 8 * SZ_1M,
25927+ .size = 8 * SZ_1M },
25928 };
25929
25930 static struct mtd_partition partition_info32k[] = {
25931- { name: "AUTCPU12 flash partition 1",
25932- offset: 0,
25933- size: 8 * SZ_1M },
25934- { name: "AUTCPU12 flash partition 2",
25935- offset: 8 * SZ_1M,
25936- size: 24 * SZ_1M },
25937+ { .name = "AUTCPU12 flash partition 1",
25938+ .offset = 0,
25939+ .size = 8 * SZ_1M },
25940+ { .name = "AUTCPU12 flash partition 2",
25941+ .offset = 8 * SZ_1M,
25942+ .size = 24 * SZ_1M },
25943 };
25944
25945 static struct mtd_partition partition_info64k[] = {
25946- { name: "AUTCPU12 flash partition 1",
25947- offset: 0,
25948- size: 16 * SZ_1M },
25949- { name: "AUTCPU12 flash partition 2",
25950- offset: 16 * SZ_1M,
25951- size: 48 * SZ_1M },
25952+ { .name = "AUTCPU12 flash partition 1",
25953+ .offset = 0,
25954+ .size = 16 * SZ_1M },
25955+ { .name = "AUTCPU12 flash partition 2",
25956+ .offset = 16 * SZ_1M,
25957+ .size = 48 * SZ_1M },
25958 };
25959
25960 static struct mtd_partition partition_info128k[] = {
25961- { name: "AUTCPU12 flash partition 1",
25962- offset: 0,
25963- size: 16 * SZ_1M },
25964- { name: "AUTCPU12 flash partition 2",
25965- offset: 16 * SZ_1M,
25966- size: 112 * SZ_1M },
25967+ { .name = "AUTCPU12 flash partition 1",
25968+ .offset = 0,
25969+ .size = 16 * SZ_1M },
25970+ { .name = "AUTCPU12 flash partition 2",
25971+ .offset = 16 * SZ_1M,
25972+ .size = 112 * SZ_1M },
25973 };
25974
25975 #define NUM_PARTITIONS16K 2
25976diff -Nru a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c
25977--- a/drivers/mtd/nand/edb7312.c Wed May 28 08:01:25 2003
25978+++ b/drivers/mtd/nand/edb7312.c Sun Aug 31 16:14:08 2003
25979@@ -71,9 +71,9 @@
25980 * Define static partitions for flash device
25981 */
25982 static struct mtd_partition partition_info[] = {
25983- { name: "EP7312 Nand Flash",
25984- offset: 0,
25985- size: 8*1024*1024 }
25986+ { .name = "EP7312 Nand Flash",
25987+ .offset = 0,
25988+ .size = 8*1024*1024 }
25989 };
25990 #define NUM_PARTITIONS 1
25991
25992diff -Nru a/drivers/net/3c501.c b/drivers/net/3c501.c
25993--- a/drivers/net/3c501.c Sun Apr 20 22:41:08 2003
25994+++ b/drivers/net/3c501.c Tue Aug 26 13:21:28 2003
25995@@ -307,7 +307,7 @@
25996 dev->stop = &el1_close;
25997 dev->get_stats = &el1_get_stats;
25998 dev->set_multicast_list = &set_multicast_list;
25999- dev->do_ioctl = netdev_ioctl;
26000+ dev->ethtool_ops = &netdev_ethtool_ops;
26001
26002 /*
26003 * Setup the generic properties
26004@@ -857,86 +857,31 @@
26005 }
26006 }
26007
26008-/**
26009- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26010- * @dev: network interface on which out-of-band action is to be performed
26011- * @useraddr: userspace address to which data is to be read and returned
26012- *
26013- * Process the various commands of the SIOCETHTOOL interface.
26014- */
26015
26016-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26017+static void netdev_get_drvinfo(struct net_device *dev,
26018+ struct ethtool_drvinfo *info)
26019 {
26020- u32 ethcmd;
26021-
26022- /* dev_ioctl() in ../../net/core/dev.c has already checked
26023- capable(CAP_NET_ADMIN), so don't bother with that here. */
26024-
26025- if (get_user(ethcmd, (u32 *)useraddr))
26026- return -EFAULT;
26027-
26028- switch (ethcmd) {
26029-
26030- case ETHTOOL_GDRVINFO: {
26031- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26032- strcpy (info.driver, DRV_NAME);
26033- strcpy (info.version, DRV_VERSION);
26034- sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
26035- if (copy_to_user (useraddr, &info, sizeof (info)))
26036- return -EFAULT;
26037- return 0;
26038- }
26039-
26040- /* get message-level */
26041- case ETHTOOL_GMSGLVL: {
26042- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
26043- edata.data = debug;
26044- if (copy_to_user(useraddr, &edata, sizeof(edata)))
26045- return -EFAULT;
26046- return 0;
26047- }
26048- /* set message-level */
26049- case ETHTOOL_SMSGLVL: {
26050- struct ethtool_value edata;
26051- if (copy_from_user(&edata, useraddr, sizeof(edata)))
26052- return -EFAULT;
26053- debug = edata.data;
26054- return 0;
26055- }
26056-
26057- default:
26058- break;
26059- }
26060-
26061- return -EOPNOTSUPP;
26062+ strcpy(info->driver, DRV_NAME);
26063+ strcpy(info->version, DRV_VERSION);
26064+ sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
26065 }
26066
26067-/**
26068- * netdev_ioctl: Handle network interface ioctls
26069- * @dev: network interface on which out-of-band action is to be performed
26070- * @rq: user request data
26071- * @cmd: command issued by user
26072- *
26073- * Process the various out-of-band ioctls passed to this driver.
26074- */
26075+static u32 netdev_get_msglevel(struct net_device *dev)
26076+{
26077+ return debug;
26078+}
26079
26080-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26081+static void netdev_set_msglevel(struct net_device *dev, u32 level)
26082 {
26083- int rc = 0;
26084+ debug = level;
26085+}
26086
26087- switch (cmd) {
26088- case SIOCETHTOOL:
26089- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26090- break;
26091-
26092- default:
26093- rc = -EOPNOTSUPP;
26094- break;
26095- }
26096+static struct ethtool_ops netdev_ethtool_ops = {
26097+ .get_drvinfo = netdev_get_drvinfo,
26098+ .get_msglevel = netdev_get_msglevel,
26099+ .set_msglevel = netdev_set_msglevel,
26100+};
26101
26102- return rc;
26103-}
26104-
26105 #ifdef MODULE
26106
26107 static struct net_device dev_3c501 = {
26108diff -Nru a/drivers/net/3c501.h b/drivers/net/3c501.h
26109--- a/drivers/net/3c501.h Sun Apr 20 22:41:08 2003
26110+++ b/drivers/net/3c501.h Tue Aug 26 13:21:28 2003
26111@@ -14,7 +14,7 @@
26112 static int el1_close(struct net_device *dev);
26113 static struct net_device_stats *el1_get_stats(struct net_device *dev);
26114 static void set_multicast_list(struct net_device *dev);
26115-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26116+static struct ethtool_ops netdev_ethtool_ops;
26117
26118 #define EL1_IO_EXTENT 16
26119
26120diff -Nru a/drivers/net/3c503.c b/drivers/net/3c503.c
26121--- a/drivers/net/3c503.c Mon Feb 24 10:34:15 2003
26122+++ b/drivers/net/3c503.c Tue Aug 26 13:29:32 2003
26123@@ -80,7 +80,7 @@
26124 int ring_offset);
26125 static void el2_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
26126 int ring_page);
26127-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26128+static struct ethtool_ops netdev_ethtool_ops;
26129
26130 \f
26131 /* This routine probes for a memory-mapped 3c503 board by looking for
26132@@ -308,7 +308,7 @@
26133
26134 dev->open = &el2_open;
26135 dev->stop = &el2_close;
26136- dev->do_ioctl = &netdev_ioctl;
26137+ dev->ethtool_ops = &netdev_ethtool_ops;
26138
26139 if (dev->mem_start)
26140 printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n",
26141@@ -617,69 +617,18 @@
26142 return;
26143 }
26144
26145-/**
26146- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26147- * @dev: network interface on which out-of-band action is to be performed
26148- * @useraddr: userspace address to which data is to be read and returned
26149- *
26150- * Process the various commands of the SIOCETHTOOL interface.
26151- */
26152
26153-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26154+static void netdev_get_drvinfo(struct net_device *dev,
26155+ struct ethtool_drvinfo *info)
26156 {
26157- u32 ethcmd;
26158-
26159- /* dev_ioctl() in ../../net/core/dev.c has already checked
26160- capable(CAP_NET_ADMIN), so don't bother with that here. */
26161-
26162- if (get_user(ethcmd, (u32 *)useraddr))
26163- return -EFAULT;
26164-
26165- switch (ethcmd) {
26166-
26167- case ETHTOOL_GDRVINFO: {
26168- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26169- strcpy (info.driver, DRV_NAME);
26170- strcpy (info.version, DRV_VERSION);
26171- sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
26172- if (copy_to_user (useraddr, &info, sizeof (info)))
26173- return -EFAULT;
26174- return 0;
26175- }
26176-
26177- default:
26178- break;
26179- }
26180-
26181- return -EOPNOTSUPP;
26182+ strcpy(info->driver, DRV_NAME);
26183+ strcpy(info->version, DRV_VERSION);
26184+ sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
26185 }
26186
26187-/**
26188- * netdev_ioctl: Handle network interface ioctls
26189- * @dev: network interface on which out-of-band action is to be performed
26190- * @rq: user request data
26191- * @cmd: command issued by user
26192- *
26193- * Process the various out-of-band ioctls passed to this driver.
26194- */
26195-
26196-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26197-{
26198- int rc = 0;
26199-
26200- switch (cmd) {
26201- case SIOCETHTOOL:
26202- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26203- break;
26204-
26205- default:
26206- rc = -EOPNOTSUPP;
26207- break;
26208- }
26209-
26210- return rc;
26211-}
26212-
26213+static struct ethtool_ops netdev_ethtool_ops = {
26214+ .get_drvinfo = netdev_get_drvinfo,
26215+};
26216
26217 #ifdef MODULE
26218 #define MAX_EL2_CARDS 4 /* Max number of EL2 cards per module */
26219diff -Nru a/drivers/net/3c505.c b/drivers/net/3c505.c
26220--- a/drivers/net/3c505.c Wed Jun 4 06:07:40 2003
26221+++ b/drivers/net/3c505.c Tue Aug 26 13:29:32 2003
26222@@ -1163,86 +1163,30 @@
26223 return &adapter->stats;
26224 }
26225
26226-/**
26227- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26228- * @dev: network interface on which out-of-band action is to be performed
26229- * @useraddr: userspace address to which data is to be read and returned
26230- *
26231- * Process the various commands of the SIOCETHTOOL interface.
26232- */
26233-
26234-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26235-{
26236- u32 ethcmd;
26237-
26238- /* dev_ioctl() in ../../net/core/dev.c has already checked
26239- capable(CAP_NET_ADMIN), so don't bother with that here. */
26240-
26241- if (get_user(ethcmd, (u32 *)useraddr))
26242- return -EFAULT;
26243-
26244- switch (ethcmd) {
26245-
26246- case ETHTOOL_GDRVINFO: {
26247- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26248- strcpy (info.driver, DRV_NAME);
26249- strcpy (info.version, DRV_VERSION);
26250- sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
26251- if (copy_to_user (useraddr, &info, sizeof (info)))
26252- return -EFAULT;
26253- return 0;
26254- }
26255-
26256- /* get message-level */
26257- case ETHTOOL_GMSGLVL: {
26258- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
26259- edata.data = debug;
26260- if (copy_to_user(useraddr, &edata, sizeof(edata)))
26261- return -EFAULT;
26262- return 0;
26263- }
26264- /* set message-level */
26265- case ETHTOOL_SMSGLVL: {
26266- struct ethtool_value edata;
26267- if (copy_from_user(&edata, useraddr, sizeof(edata)))
26268- return -EFAULT;
26269- debug = edata.data;
26270- return 0;
26271- }
26272-
26273- default:
26274- break;
26275- }
26276
26277- return -EOPNOTSUPP;
26278+static void netdev_get_drvinfo(struct net_device *dev,
26279+ struct ethtool_drvinfo *info)
26280+{
26281+ strcpy(info->driver, DRV_NAME);
26282+ strcpy(info->version, DRV_VERSION);
26283+ sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
26284 }
26285
26286-/**
26287- * netdev_ioctl: Handle network interface ioctls
26288- * @dev: network interface on which out-of-band action is to be performed
26289- * @rq: user request data
26290- * @cmd: command issued by user
26291- *
26292- * Process the various out-of-band ioctls passed to this driver.
26293- */
26294-
26295-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26296-{
26297- int rc = 0;
26298-
26299- switch (cmd) {
26300- case SIOCETHTOOL:
26301- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26302- break;
26303-
26304- default:
26305- rc = -EOPNOTSUPP;
26306- break;
26307- }
26308+static u32 netdev_get_msglevel(struct net_device *dev)
26309+{
26310+ return debug;
26311+}
26312
26313- return rc;
26314+static void netdev_set_msglevel(struct net_device *dev, u32 level)
26315+{
26316+ debug = level;
26317 }
26318-
26319+
26320+static struct ethtool_ops netdev_ethtool_ops = {
26321+ .get_drvinfo = netdev_get_drvinfo,
26322+ .get_msglevel = netdev_get_msglevel,
26323+ .set_msglevel = netdev_set_msglevel,
26324+};
26325
26326 /******************************************************
26327 *
26328@@ -1373,7 +1317,7 @@
26329 dev->tx_timeout = elp_timeout; /* local */
26330 dev->watchdog_timeo = 10*HZ;
26331 dev->set_multicast_list = elp_set_mc_list; /* local */
26332- dev->do_ioctl = netdev_ioctl; /* local */
26333+ dev->ethtool_ops = &netdev_ethtool_ops; /* local */
26334
26335 /* Setup the generic properties */
26336 ether_setup(dev);
26337diff -Nru a/drivers/net/3c507.c b/drivers/net/3c507.c
26338--- a/drivers/net/3c507.c Sun Apr 20 22:41:08 2003
26339+++ b/drivers/net/3c507.c Tue Aug 26 13:29:32 2003
26340@@ -299,7 +299,7 @@
26341
26342 static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad);
26343 static void init_82586_mem(struct net_device *dev);
26344-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26345+static struct ethtool_ops netdev_ethtool_ops;
26346
26347 \f
26348 /* Check for a network adaptor of this type, and return '0' iff one exists.
26349@@ -431,7 +431,7 @@
26350 dev->get_stats = el16_get_stats;
26351 dev->tx_timeout = el16_tx_timeout;
26352 dev->watchdog_timeo = TX_TIMEOUT;
26353- dev->do_ioctl = netdev_ioctl;
26354+ dev->ethtool_ops = &netdev_ethtool_ops;
26355
26356 ether_setup(dev); /* Generic ethernet behaviour */
26357
26358@@ -874,86 +874,29 @@
26359 lp->rx_tail = rx_tail;
26360 }
26361
26362-/**
26363- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26364- * @dev: network interface on which out-of-band action is to be performed
26365- * @useraddr: userspace address to which data is to be read and returned
26366- *
26367- * Process the various commands of the SIOCETHTOOL interface.
26368- */
26369-
26370-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26371-{
26372- u32 ethcmd;
26373-
26374- /* dev_ioctl() in ../../net/core/dev.c has already checked
26375- capable(CAP_NET_ADMIN), so don't bother with that here. */
26376-
26377- if (get_user(ethcmd, (u32 *)useraddr))
26378- return -EFAULT;
26379-
26380- switch (ethcmd) {
26381-
26382- case ETHTOOL_GDRVINFO: {
26383- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26384- strcpy (info.driver, DRV_NAME);
26385- strcpy (info.version, DRV_VERSION);
26386- sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
26387- if (copy_to_user (useraddr, &info, sizeof (info)))
26388- return -EFAULT;
26389- return 0;
26390- }
26391-
26392- /* get message-level */
26393- case ETHTOOL_GMSGLVL: {
26394- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
26395- edata.data = debug;
26396- if (copy_to_user(useraddr, &edata, sizeof(edata)))
26397- return -EFAULT;
26398- return 0;
26399- }
26400- /* set message-level */
26401- case ETHTOOL_SMSGLVL: {
26402- struct ethtool_value edata;
26403- if (copy_from_user(&edata, useraddr, sizeof(edata)))
26404- return -EFAULT;
26405- debug = edata.data;
26406- return 0;
26407- }
26408-
26409- default:
26410- break;
26411- }
26412-
26413- return -EOPNOTSUPP;
26414+static void netdev_get_drvinfo(struct net_device *dev,
26415+ struct ethtool_drvinfo *info)
26416+{
26417+ strcpy(info->driver, DRV_NAME);
26418+ strcpy(info->version, DRV_VERSION);
26419+ sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
26420 }
26421
26422-/**
26423- * netdev_ioctl: Handle network interface ioctls
26424- * @dev: network interface on which out-of-band action is to be performed
26425- * @rq: user request data
26426- * @cmd: command issued by user
26427- *
26428- * Process the various out-of-band ioctls passed to this driver.
26429- */
26430-
26431-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26432+static u32 netdev_get_msglevel(struct net_device *dev)
26433 {
26434- int rc = 0;
26435-
26436- switch (cmd) {
26437- case SIOCETHTOOL:
26438- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26439- break;
26440-
26441- default:
26442- rc = -EOPNOTSUPP;
26443- break;
26444- }
26445+ return debug;
26446+}
26447
26448- return rc;
26449+static void netdev_set_msglevel(struct net_device *dev, u32 level)
26450+{
26451+ debug = level;
26452 }
26453-
26454+
26455+static struct ethtool_ops netdev_ethtool_ops = {
26456+ .get_drvinfo = netdev_get_drvinfo,
26457+ .get_msglevel = netdev_get_msglevel,
26458+ .set_msglevel = netdev_set_msglevel,
26459+};
26460
26461 #ifdef MODULE
26462 static struct net_device dev_3c507;
26463diff -Nru a/drivers/net/3c509.c b/drivers/net/3c509.c
26464--- a/drivers/net/3c509.c Tue Aug 19 20:53:14 2003
26465+++ b/drivers/net/3c509.c Sun Aug 31 06:32:07 2003
26466@@ -629,8 +629,6 @@
26467 el3_mca_adapter_names[mdev->index], slot + 1);
26468
26469 /* claim the slot */
26470- strncpy(device->name, el3_mca_adapter_names[mdev->index],
26471- sizeof(device->name));
26472 mca_device_set_claim(mdev, 1);
26473
26474 if_port = pos4 & 0x03;
26475diff -Nru a/drivers/net/3c515.c b/drivers/net/3c515.c
26476--- a/drivers/net/3c515.c Tue Aug 19 20:53:14 2003
26477+++ b/drivers/net/3c515.c Tue Aug 26 13:42:22 2003
26478@@ -392,7 +392,7 @@
26479 static void update_stats(int addr, struct net_device *dev);
26480 static struct net_device_stats *corkscrew_get_stats(struct net_device *dev);
26481 static void set_rx_mode(struct net_device *dev);
26482-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26483+static struct ethtool_ops netdev_ethtool_ops;
26484 \f
26485
26486 /*
26487@@ -718,7 +718,7 @@
26488 dev->stop = &corkscrew_close;
26489 dev->get_stats = &corkscrew_get_stats;
26490 dev->set_multicast_list = &set_rx_mode;
26491- dev->do_ioctl = netdev_ioctl;
26492+ dev->ethtool_ops = &netdev_ethtool_ops;
26493
26494 return 0;
26495 }
26496@@ -1580,86 +1580,30 @@
26497 outw(new_mode, ioaddr + EL3_CMD);
26498 }
26499
26500-/**
26501- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26502- * @dev: network interface on which out-of-band action is to be performed
26503- * @useraddr: userspace address to which data is to be read and returned
26504- *
26505- * Process the various commands of the SIOCETHTOOL interface.
26506- */
26507-
26508-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26509+static void netdev_get_drvinfo(struct net_device *dev,
26510+ struct ethtool_drvinfo *info)
26511 {
26512- u32 ethcmd;
26513-
26514- /* dev_ioctl() in ../../net/core/dev.c has already checked
26515- capable(CAP_NET_ADMIN), so don't bother with that here. */
26516-
26517- if (get_user(ethcmd, (u32 *)useraddr))
26518- return -EFAULT;
26519-
26520- switch (ethcmd) {
26521-
26522- case ETHTOOL_GDRVINFO: {
26523- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26524- strcpy (info.driver, DRV_NAME);
26525- strcpy (info.version, DRV_VERSION);
26526- sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
26527- if (copy_to_user (useraddr, &info, sizeof (info)))
26528- return -EFAULT;
26529- return 0;
26530- }
26531-
26532- /* get message-level */
26533- case ETHTOOL_GMSGLVL: {
26534- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
26535- edata.data = corkscrew_debug;
26536- if (copy_to_user(useraddr, &edata, sizeof(edata)))
26537- return -EFAULT;
26538- return 0;
26539- }
26540- /* set message-level */
26541- case ETHTOOL_SMSGLVL: {
26542- struct ethtool_value edata;
26543- if (copy_from_user(&edata, useraddr, sizeof(edata)))
26544- return -EFAULT;
26545- corkscrew_debug = edata.data;
26546- return 0;
26547- }
26548-
26549- default:
26550- break;
26551- }
26552-
26553- return -EOPNOTSUPP;
26554+ strcpy(info->driver, DRV_NAME);
26555+ strcpy(info->version, DRV_VERSION);
26556+ sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
26557 }
26558
26559-/**
26560- * netdev_ioctl: Handle network interface ioctls
26561- * @dev: network interface on which out-of-band action is to be performed
26562- * @rq: user request data
26563- * @cmd: command issued by user
26564- *
26565- * Process the various out-of-band ioctls passed to this driver.
26566- */
26567-
26568-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26569+static u32 netdev_get_msglevel(struct net_device *dev)
26570 {
26571- int rc = 0;
26572+ return debug;
26573+}
26574
26575- switch (cmd) {
26576- case SIOCETHTOOL:
26577- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26578- break;
26579+static void netdev_set_msglevel(struct net_device *dev, u32 level)
26580+{
26581+ debug = level;
26582+}
26583
26584- default:
26585- rc = -EOPNOTSUPP;
26586- break;
26587- }
26588+static struct ethtool_ops netdev_ethtool_ops = {
26589+ .get_drvinfo = netdev_get_drvinfo,
26590+ .get_msglevel = netdev_get_msglevel,
26591+ .set_msglevel = netdev_set_msglevel,
26592+};
26593
26594- return rc;
26595-}
26596-
26597 \f
26598 #ifdef MODULE
26599 void cleanup_module(void)
26600diff -Nru a/drivers/net/3c523.c b/drivers/net/3c523.c
26601--- a/drivers/net/3c523.c Sun Apr 27 20:36:18 2003
26602+++ b/drivers/net/3c523.c Tue Aug 26 13:42:22 2003
26603@@ -188,7 +188,7 @@
26604 #ifdef ELMC_MULTICAST
26605 static void set_multicast_list(struct net_device *dev);
26606 #endif
26607-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26608+static struct ethtool_ops netdev_ethtool_ops;
26609
26610 /* helper-functions */
26611 static int init586(struct net_device *dev);
26612@@ -571,7 +571,7 @@
26613 #else
26614 dev->set_multicast_list = NULL;
26615 #endif
26616- dev->do_ioctl = netdev_ioctl;
26617+ dev->ethtool_ops = &netdev_ethtool_ops;
26618
26619 ether_setup(dev);
26620
26621@@ -1228,70 +1228,17 @@
26622 }
26623 #endif
26624
26625-/**
26626- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26627- * @dev: network interface on which out-of-band action is to be performed
26628- * @useraddr: userspace address to which data is to be read and returned
26629- *
26630- * Process the various commands of the SIOCETHTOOL interface.
26631- */
26632-
26633-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26634+static void netdev_get_drvinfo(struct net_device *dev,
26635+ struct ethtool_drvinfo *info)
26636 {
26637- u32 ethcmd;
26638-
26639- /* dev_ioctl() in ../../net/core/dev.c has already checked
26640- capable(CAP_NET_ADMIN), so don't bother with that here. */
26641-
26642- if (get_user(ethcmd, (u32 *)useraddr))
26643- return -EFAULT;
26644-
26645- switch (ethcmd) {
26646-
26647- case ETHTOOL_GDRVINFO: {
26648- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26649- strcpy (info.driver, DRV_NAME);
26650- strcpy (info.version, DRV_VERSION);
26651- sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
26652- if (copy_to_user (useraddr, &info, sizeof (info)))
26653- return -EFAULT;
26654- return 0;
26655- }
26656-
26657- default:
26658- break;
26659- }
26660-
26661- return -EOPNOTSUPP;
26662+ strcpy(info->driver, DRV_NAME);
26663+ strcpy(info->version, DRV_VERSION);
26664+ sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
26665 }
26666
26667-/**
26668- * netdev_ioctl: Handle network interface ioctls
26669- * @dev: network interface on which out-of-band action is to be performed
26670- * @rq: user request data
26671- * @cmd: command issued by user
26672- *
26673- * Process the various out-of-band ioctls passed to this driver.
26674- */
26675-
26676-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26677-{
26678- int rc = 0;
26679-
26680- switch (cmd) {
26681- case SIOCETHTOOL:
26682- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26683- break;
26684-
26685- default:
26686- rc = -EOPNOTSUPP;
26687- break;
26688- }
26689-
26690- return rc;
26691-}
26692-
26693-/*************************************************************************/
26694+static struct ethtool_ops netdev_ethtool_ops = {
26695+ .get_drvinfo = netdev_get_drvinfo,
26696+};
26697
26698 #ifdef MODULE
26699
26700diff -Nru a/drivers/net/3c527.c b/drivers/net/3c527.c
26701--- a/drivers/net/3c527.c Sun Apr 27 20:36:18 2003
26702+++ b/drivers/net/3c527.c Sun Aug 31 06:34:16 2003
26703@@ -218,7 +218,7 @@
26704 static struct net_device_stats *mc32_get_stats(struct net_device *dev);
26705 static void mc32_set_multicast_list(struct net_device *dev);
26706 static void mc32_reset_multicast_list(struct net_device *dev);
26707-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
26708+static struct ethtool_ops netdev_ethtool_ops;
26709
26710 /**
26711 * mc32_probe - Search for supported boards
26712@@ -508,7 +508,7 @@
26713 dev->set_multicast_list = mc32_set_multicast_list;
26714 dev->tx_timeout = mc32_timeout;
26715 dev->watchdog_timeo = HZ*5; /* Board does all the work */
26716- dev->do_ioctl = netdev_ioctl;
26717+ dev->ethtool_ops = &netdev_ethtool_ops;
26718
26719 lp->xceiver_state = HALTED;
26720
26721@@ -1081,14 +1081,15 @@
26722 /* NP is the buffer we will be loading */
26723 np=lp->tx_ring[lp->tx_ring_head].p;
26724
26725- /* We will need this to flush the buffer out */
26726- lp->tx_ring[lp->tx_ring_head].skb=skb;
26727-
26728 if (skb->len < ETH_ZLEN) {
26729 skb = skb_padto(skb, ETH_ZLEN);
26730 if (skb == NULL)
26731 goto out;
26732 }
26733+
26734+ /* We will need this to flush the buffer out */
26735+ lp->tx_ring[lp->tx_ring_head].skb = skb;
26736+
26737 np->length = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
26738
26739 np->data = isa_virt_to_bus(skb->data);
26740@@ -1655,86 +1656,30 @@
26741 do_mc32_set_multicast_list(dev,1);
26742 }
26743
26744-/**
26745- * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
26746- * @dev: network interface on which out-of-band action is to be performed
26747- * @useraddr: userspace address to which data is to be read and returned
26748- *
26749- * Process the various commands of the SIOCETHTOOL interface.
26750- */
26751-
26752-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
26753+static void netdev_get_drvinfo(struct net_device *dev,
26754+ struct ethtool_drvinfo *info)
26755 {
26756- u32 ethcmd;
26757-
26758- /* dev_ioctl() in ../../net/core/dev.c has already checked
26759- capable(CAP_NET_ADMIN), so don't bother with that here. */
26760-
26761- if (get_user(ethcmd, (u32 *)useraddr))
26762- return -EFAULT;
26763-
26764- switch (ethcmd) {
26765-
26766- case ETHTOOL_GDRVINFO: {
26767- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
26768- strcpy (info.driver, DRV_NAME);
26769- strcpy (info.version, DRV_VERSION);
26770- sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
26771- if (copy_to_user (useraddr, &info, sizeof (info)))
26772- return -EFAULT;
26773- return 0;
26774- }
26775-
26776- /* get message-level */
26777- case ETHTOOL_GMSGLVL: {
26778- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
26779- edata.data = mc32_debug;
26780- if (copy_to_user(useraddr, &edata, sizeof(edata)))
26781- return -EFAULT;
26782- return 0;
26783- }
26784- /* set message-level */
26785- case ETHTOOL_SMSGLVL: {
26786- struct ethtool_value edata;
26787- if (copy_from_user(&edata, useraddr, sizeof(edata)))
26788- return -EFAULT;
26789- mc32_debug = edata.data;
26790- return 0;
26791- }
26792-
26793- default:
26794- break;
26795- }
26796-
26797- return -EOPNOTSUPP;
26798+ strcpy(info->driver, DRV_NAME);
26799+ strcpy(info->version, DRV_VERSION);
26800+ sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
26801 }
26802
26803-/**
26804- * netdev_ioctl: Handle network interface ioctls
26805- * @dev: network interface on which out-of-band action is to be performed
26806- * @rq: user request data
26807- * @cmd: command issued by user
26808- *
26809- * Process the various out-of-band ioctls passed to this driver.
26810- */
26811+static u32 netdev_get_msglevel(struct net_device *dev)
26812+{
26813+ return mc32_debug;
26814+}
26815
26816-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
26817+static void netdev_set_msglevel(struct net_device *dev, u32 level)
26818 {
26819- int rc = 0;
26820+ mc32_debug = level;
26821+}
26822
26823- switch (cmd) {
26824- case SIOCETHTOOL:
26825- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26826- break;
26827+static struct ethtool_ops netdev_ethtool_ops = {
26828+ .get_drvinfo = netdev_get_drvinfo,
26829+ .get_msglevel = netdev_get_msglevel,
26830+ .set_msglevel = netdev_set_msglevel,
26831+};
26832
26833- default:
26834- rc = -EOPNOTSUPP;
26835- break;
26836- }
26837-
26838- return rc;
26839-}
26840-
26841 #ifdef MODULE
26842
26843 static struct net_device this_device;
26844diff -Nru a/drivers/net/3c59x.c b/drivers/net/3c59x.c
26845--- a/drivers/net/3c59x.c Tue Aug 19 20:53:15 2003
26846+++ b/drivers/net/3c59x.c Tue Aug 26 11:23:22 2003
26847@@ -900,6 +900,7 @@
26848 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
26849 static void vortex_tx_timeout(struct net_device *dev);
26850 static void acpi_set_WOL(struct net_device *dev);
26851+static struct ethtool_ops vortex_ethtool_ops;
26852 \f
26853 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
26854 /* Option count limit only -- unlimited interfaces are supported. */
26855@@ -1445,6 +1446,7 @@
26856 dev->stop = vortex_close;
26857 dev->get_stats = vortex_get_stats;
26858 dev->do_ioctl = vortex_ioctl;
26859+ dev->ethtool_ops = &vortex_ethtool_ops;
26860 dev->set_multicast_list = set_rx_mode;
26861 dev->tx_timeout = vortex_tx_timeout;
26862 dev->watchdog_timeo = (watchdog * HZ) / 1000;
26863@@ -2816,38 +2818,28 @@
26864 }
26865
26866
26867-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
26868+static void vortex_get_drvinfo(struct net_device *dev,
26869+ struct ethtool_drvinfo *info)
26870 {
26871 struct vortex_private *vp = dev->priv;
26872- u32 ethcmd;
26873-
26874- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
26875- return -EFAULT;
26876
26877- switch (ethcmd) {
26878- case ETHTOOL_GDRVINFO: {
26879- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
26880- strcpy(info.driver, DRV_NAME);
26881- strcpy(info.version, DRV_VERSION);
26882- if (VORTEX_PCI(vp))
26883- strcpy(info.bus_info, pci_name(VORTEX_PCI(vp)));
26884- else {
26885- if (VORTEX_EISA(vp))
26886- sprintf (info.bus_info, vp->gendev->bus_id);
26887- else
26888- sprintf(info.bus_info, "EISA 0x%lx %d",
26889- dev->base_addr, dev->irq);
26890- }
26891- if (copy_to_user(useraddr, &info, sizeof(info)))
26892- return -EFAULT;
26893- return 0;
26894+ strcpy(info->driver, DRV_NAME);
26895+ strcpy(info->version, DRV_VERSION);
26896+ if (VORTEX_PCI(vp)) {
26897+ strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
26898+ } else {
26899+ if (VORTEX_EISA(vp))
26900+ sprintf(info->bus_info, vp->gendev->bus_id);
26901+ else
26902+ sprintf(info->bus_info, "EISA 0x%lx %d",
26903+ dev->base_addr, dev->irq);
26904 }
26905-
26906- }
26907-
26908- return -EOPNOTSUPP;
26909 }
26910
26911+static struct ethtool_ops vortex_ethtool_ops = {
26912+ .get_drvinfo = vortex_get_drvinfo,
26913+};
26914+
26915 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
26916 {
26917 struct vortex_private *vp = (struct vortex_private *)dev->priv;
26918@@ -2857,9 +2849,6 @@
26919 int retval;
26920
26921 switch(cmd) {
26922- case SIOCETHTOOL:
26923- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
26924-
26925 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
26926 data->phy_id = phy;
26927
26928diff -Nru a/drivers/net/8139cp.c b/drivers/net/8139cp.c
26929--- a/drivers/net/8139cp.c Tue Aug 19 20:13:55 2003
26930+++ b/drivers/net/8139cp.c Sun Aug 31 08:02:25 2003
26931@@ -24,15 +24,13 @@
26932 PCI suspend/resume - Felipe Damasio <felipewd@terra.com.br>
26933 LinkChg interrupt - Felipe Damasio <felipewd@terra.com.br>
26934
26935- TODO, in rough priority order:
26936+ TODO:
26937 * Test Tx checksumming thoroughly
26938- * dev->tx_timeout
26939- * Constants (module parms?) for Rx work limit
26940+ * Implement dev->tx_timeout
26941+
26942+ Low priority TODO:
26943 * Complete reset on PciErr
26944 * Consider Rx interrupt mitigation using TimerIntr
26945- * Implement 8139C+ statistics dump; maybe not...
26946- h/w stats can be reset only by software reset
26947- * Handle netif_rx return value
26948 * Investigate using skb->priority with h/w VLAN priority
26949 * Investigate using High Priority Tx Queue with skb->priority
26950 * Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error
26951@@ -41,14 +39,17 @@
26952 Tx descriptor bit
26953 * The real minimum of CP_MIN_MTU is 4 bytes. However,
26954 for this to be supported, one must(?) turn on packet padding.
26955- * Support 8169 GMII
26956- * Support external MII transceivers
26957+ * Support external MII transceivers (patch available)
26958+
26959+ NOTES:
26960+ * TX checksumming is considered experimental. It is off by
26961+ default, use ethtool to turn it on.
26962
26963 */
26964
26965 #define DRV_NAME "8139cp"
26966-#define DRV_VERSION "0.3.0"
26967-#define DRV_RELDATE "Sep 29, 2002"
26968+#define DRV_VERSION "1.1"
26969+#define DRV_RELDATE "Aug 30, 2003"
26970
26971
26972 #include <linux/config.h>
26973@@ -71,9 +72,6 @@
26974 #include <asm/io.h>
26975 #include <asm/uaccess.h>
26976
26977-/* experimental TX checksumming feature enable/disable */
26978-#undef CP_TX_CHECKSUM
26979-
26980 /* VLAN tagging feature enable/disable */
26981 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
26982 #define CP_VLAN_TAG_USED 1
26983@@ -86,7 +84,7 @@
26984 #endif
26985
26986 /* These identify the driver base version and may not be removed. */
26987-static char version[] __devinitdata =
26988+static char version[] =
26989 KERN_INFO DRV_NAME ": 10/100 PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n";
26990
26991 MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
26992@@ -160,6 +158,7 @@
26993 TxConfig = 0x40, /* Tx configuration */
26994 ChipVersion = 0x43, /* 8-bit chip version, inside TxConfig */
26995 RxConfig = 0x44, /* Rx configuration */
26996+ RxMissed = 0x4C, /* 24 bits valid, write clears */
26997 Cfg9346 = 0x50, /* EEPROM select/control; Cfg reg [un]lock */
26998 Config1 = 0x52, /* Config1 */
26999 Config3 = 0x59, /* Config3 */
27000@@ -292,12 +291,11 @@
27001 UWF = (1 << 4), /* Accept Unicast wakeup frame */
27002 LANWake = (1 << 1), /* Enable LANWake signal */
27003 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
27004-};
27005
27006-static const unsigned int cp_intr_mask =
27007- PciErr | LinkChg |
27008- RxOK | RxErr | RxEmpty | RxFIFOOvr |
27009- TxOK | TxErr | TxEmpty;
27010+ cp_norx_intr_mask = PciErr | LinkChg | TxOK | TxErr | TxEmpty,
27011+ cp_rx_intr_mask = RxOK | RxErr | RxEmpty | RxFIFOOvr,
27012+ cp_intr_mask = cp_rx_intr_mask | cp_norx_intr_mask,
27013+};
27014
27015 static const unsigned int cp_rx_config =
27016 (RX_FIFO_THRESH << RxCfgFIFOShift) |
27017@@ -364,11 +362,7 @@
27018
27019 struct pci_dev *pdev;
27020 u32 rx_config;
27021-
27022- struct sk_buff *frag_skb;
27023- unsigned dropping_frag : 1;
27024- unsigned pci_using_dac : 1;
27025- unsigned int board_type;
27026+ u16 cpcmd;
27027
27028 unsigned int wol_enabled : 1; /* Is Wake-on-LAN enabled? */
27029 u32 power_state[16];
27030@@ -400,28 +394,9 @@
27031 static void cp_tx (struct cp_private *cp);
27032 static void cp_clean_rings (struct cp_private *cp);
27033
27034-enum board_type {
27035- RTL8139Cp,
27036- RTL8169,
27037-};
27038-
27039-static struct cp_board_info {
27040- const char *name;
27041-} cp_board_tbl[] __devinitdata = {
27042- /* RTL8139Cp */
27043- { "RTL-8139C+" },
27044-
27045- /* RTL8169 */
27046- { "RTL-8169" },
27047-};
27048-
27049 static struct pci_device_id cp_pci_tbl[] = {
27050 { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
27051- PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139Cp },
27052-#if 0
27053- { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8169,
27054- PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8169 },
27055-#endif
27056+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, },
27057 { },
27058 };
27059 MODULE_DEVICE_TABLE(pci, cp_pci_tbl);
27060@@ -446,6 +421,31 @@
27061 };
27062
27063
27064+#if CP_VLAN_TAG_USED
27065+static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
27066+{
27067+ struct cp_private *cp = dev->priv;
27068+
27069+ spin_lock_irq(&cp->lock);
27070+ cp->vlgrp = grp;
27071+ cp->cpcmd |= RxVlanOn;
27072+ cpw16(CpCmd, cp->cpcmd);
27073+ spin_unlock_irq(&cp->lock);
27074+}
27075+
27076+static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
27077+{
27078+ struct cp_private *cp = dev->priv;
27079+
27080+ spin_lock_irq(&cp->lock);
27081+ cp->cpcmd &= ~RxVlanOn;
27082+ cpw16(CpCmd, cp->cpcmd);
27083+ if (cp->vlgrp)
27084+ cp->vlgrp->vlan_devices[vid] = NULL;
27085+ spin_unlock_irq(&cp->lock);
27086+}
27087+#endif /* CP_VLAN_TAG_USED */
27088+
27089 static inline void cp_set_rxbufsize (struct cp_private *cp)
27090 {
27091 unsigned int mtu = cp->dev->mtu;
27092@@ -468,10 +468,11 @@
27093
27094 #if CP_VLAN_TAG_USED
27095 if (cp->vlgrp && (desc->opts2 & RxVlanTagged)) {
27096- vlan_hwaccel_rx(skb, cp->vlgrp, be16_to_cpu(desc->opts2 & 0xffff));
27097+ vlan_hwaccel_receive_skb(skb, cp->vlgrp,
27098+ be16_to_cpu(desc->opts2 & 0xffff));
27099 } else
27100 #endif
27101- netif_rx(skb);
27102+ netif_receive_skb(skb);
27103 }
27104
27105 static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
27106@@ -486,81 +487,14 @@
27107 cp->net_stats.rx_frame_errors++;
27108 if (status & RxErrCRC)
27109 cp->net_stats.rx_crc_errors++;
27110- if (status & RxErrRunt)
27111+ if ((status & RxErrRunt) || (status & RxErrLong))
27112 cp->net_stats.rx_length_errors++;
27113- if (status & RxErrLong)
27114+ if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag))
27115 cp->net_stats.rx_length_errors++;
27116 if (status & RxErrFIFO)
27117 cp->net_stats.rx_fifo_errors++;
27118 }
27119
27120-static void cp_rx_frag (struct cp_private *cp, unsigned rx_tail,
27121- struct sk_buff *skb, u32 status, u32 len)
27122-{
27123- struct sk_buff *copy_skb, *frag_skb = cp->frag_skb;
27124- unsigned orig_len = frag_skb ? frag_skb->len : 0;
27125- unsigned target_len = orig_len + len;
27126- unsigned first_frag = status & FirstFrag;
27127- unsigned last_frag = status & LastFrag;
27128-
27129- if (netif_msg_rx_status (cp))
27130- printk (KERN_DEBUG "%s: rx %s%sfrag, slot %d status 0x%x len %d\n",
27131- cp->dev->name,
27132- cp->dropping_frag ? "dropping " : "",
27133- first_frag ? "first " :
27134- last_frag ? "last " : "",
27135- rx_tail, status, len);
27136-
27137- cp->cp_stats.rx_frags++;
27138-
27139- if (!frag_skb && !first_frag)
27140- cp->dropping_frag = 1;
27141- if (cp->dropping_frag)
27142- goto drop_frag;
27143-
27144- copy_skb = dev_alloc_skb (target_len + RX_OFFSET);
27145- if (!copy_skb) {
27146- printk(KERN_WARNING "%s: rx slot %d alloc failed\n",
27147- cp->dev->name, rx_tail);
27148-
27149- cp->dropping_frag = 1;
27150-drop_frag:
27151- if (frag_skb) {
27152- dev_kfree_skb_irq(frag_skb);
27153- cp->frag_skb = NULL;
27154- }
27155- if (last_frag) {
27156- cp->net_stats.rx_dropped++;
27157- cp->dropping_frag = 0;
27158- }
27159- return;
27160- }
27161-
27162- copy_skb->dev = cp->dev;
27163- skb_reserve(copy_skb, RX_OFFSET);
27164- skb_put(copy_skb, target_len);
27165- if (frag_skb) {
27166- memcpy(copy_skb->data, frag_skb->data, orig_len);
27167- dev_kfree_skb_irq(frag_skb);
27168- }
27169- pci_dma_sync_single(cp->pdev, cp->rx_skb[rx_tail].mapping,
27170- len, PCI_DMA_FROMDEVICE);
27171- memcpy(copy_skb->data + orig_len, skb->data, len);
27172-
27173- copy_skb->ip_summed = CHECKSUM_NONE;
27174-
27175- if (last_frag) {
27176- if (status & (RxError | RxErrFIFO)) {
27177- cp_rx_err_acct(cp, rx_tail, status, len);
27178- dev_kfree_skb_irq(copy_skb);
27179- } else
27180- cp_rx_skb(cp, copy_skb, &cp->rx_ring[rx_tail]);
27181- cp->frag_skb = NULL;
27182- } else {
27183- cp->frag_skb = copy_skb;
27184- }
27185-}
27186-
27187 static inline unsigned int cp_rx_csum_ok (u32 status)
27188 {
27189 unsigned int protocol = (status >> 16) & 0x3;
27190@@ -574,12 +508,18 @@
27191 return 0;
27192 }
27193
27194-static void cp_rx (struct cp_private *cp)
27195+static int cp_rx_poll (struct net_device *dev, int *budget)
27196 {
27197+ struct cp_private *cp = dev->priv;
27198 unsigned rx_tail = cp->rx_tail;
27199- unsigned rx_work = 100;
27200+ unsigned rx_work = dev->quota;
27201+ unsigned rx;
27202+
27203+rx_status_loop:
27204+ rx = 0;
27205+ cpw16(IntrStatus, cp_rx_intr_mask);
27206
27207- while (rx_work--) {
27208+ while (1) {
27209 u32 status, len;
27210 dma_addr_t mapping;
27211 struct sk_buff *skb, *new_skb;
27212@@ -599,7 +539,14 @@
27213 mapping = cp->rx_skb[rx_tail].mapping;
27214
27215 if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag)) {
27216- cp_rx_frag(cp, rx_tail, skb, status, len);
27217+ /* we don't support incoming fragmented frames.
27218+ * instead, we attempt to ensure that the
27219+ * pre-allocated RX skbs are properly sized such
27220+ * that RX fragments are never encountered
27221+ */
27222+ cp_rx_err_acct(cp, rx_tail, status, len);
27223+ cp->net_stats.rx_dropped++;
27224+ cp->cp_stats.rx_frags++;
27225 goto rx_next;
27226 }
27227
27228@@ -640,6 +587,7 @@
27229 cp->rx_skb[rx_tail].skb = new_skb;
27230
27231 cp_rx_skb(cp, skb, desc);
27232+ rx++;
27233
27234 rx_next:
27235 cp->rx_ring[rx_tail].opts2 = 0;
27236@@ -650,12 +598,30 @@
27237 else
27238 desc->opts1 = cpu_to_le32(DescOwn | cp->rx_buf_sz);
27239 rx_tail = NEXT_RX(rx_tail);
27240- }
27241
27242- if (!rx_work)
27243- printk(KERN_WARNING "%s: rx work limit reached\n", cp->dev->name);
27244+ if (!rx_work--)
27245+ break;
27246+ }
27247
27248 cp->rx_tail = rx_tail;
27249+
27250+ dev->quota -= rx;
27251+ *budget -= rx;
27252+
27253+ /* if we did not reach work limit, then we're done with
27254+ * this round of polling
27255+ */
27256+ if (rx_work) {
27257+ if (cpr16(IntrStatus) & cp_rx_intr_mask)
27258+ goto rx_status_loop;
27259+
27260+ cpw16_f(IntrMask, cp_intr_mask);
27261+ netif_rx_complete(dev);
27262+
27263+ return 0; /* done */
27264+ }
27265+
27266+ return 1; /* not done */
27267 }
27268
27269 static irqreturn_t
27270@@ -673,12 +639,16 @@
27271 printk(KERN_DEBUG "%s: intr, status %04x cmd %02x cpcmd %04x\n",
27272 dev->name, status, cpr8(Cmd), cpr16(CpCmd));
27273
27274- cpw16_f(IntrStatus, status);
27275+ cpw16(IntrStatus, status & ~cp_rx_intr_mask);
27276
27277 spin_lock(&cp->lock);
27278
27279- if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
27280- cp_rx(cp);
27281+ if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr)) {
27282+ if (netif_rx_schedule_prep(dev)) {
27283+ cpw16_f(IntrMask, cp_norx_intr_mask);
27284+ __netif_rx_schedule(dev);
27285+ }
27286+ }
27287 if (status & (TxOK | TxErr | TxEmpty | SWInt))
27288 cp_tx(cp);
27289 if (status & LinkChg)
27290@@ -691,6 +661,8 @@
27291 pci_write_config_word(cp->pdev, PCI_STATUS, pci_status);
27292 printk(KERN_ERR "%s: PCI bus error, status=%04x, PCI status=%04x\n",
27293 dev->name, status, pci_status);
27294+
27295+ /* TODO: reset hardware */
27296 }
27297
27298 spin_unlock(&cp->lock);
27299@@ -750,7 +722,7 @@
27300
27301 cp->tx_tail = tx_tail;
27302
27303- if (netif_queue_stopped(cp->dev) && (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1)))
27304+ if (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1))
27305 netif_wake_queue(cp->dev);
27306 }
27307
27308@@ -792,7 +764,6 @@
27309 txd->addr = cpu_to_le64(mapping);
27310 wmb();
27311
27312-#ifdef CP_TX_CHECKSUM
27313 if (skb->ip_summed == CHECKSUM_HW) {
27314 const struct iphdr *ip = skb->nh.iph;
27315 if (ip->protocol == IPPROTO_TCP)
27316@@ -806,7 +777,6 @@
27317 else
27318 BUG();
27319 } else
27320-#endif
27321 txd->opts1 = cpu_to_le32(eor | len | DescOwn |
27322 FirstFrag | LastFrag);
27323 wmb();
27324@@ -820,9 +790,7 @@
27325 u32 first_len, first_eor;
27326 dma_addr_t first_mapping;
27327 int frag, first_entry = entry;
27328-#ifdef CP_TX_CHECKSUM
27329 const struct iphdr *ip = skb->nh.iph;
27330-#endif
27331
27332 /* We must give this initial chunk to the device last.
27333 * Otherwise we could race with the device.
27334@@ -848,7 +816,7 @@
27335 this_frag->page_offset),
27336 len, PCI_DMA_TODEVICE);
27337 eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
27338-#ifdef CP_TX_CHECKSUM
27339+
27340 if (skb->ip_summed == CHECKSUM_HW) {
27341 ctrl = eor | len | DescOwn | IPCS;
27342 if (ip->protocol == IPPROTO_TCP)
27343@@ -858,7 +826,6 @@
27344 else
27345 BUG();
27346 } else
27347-#endif
27348 ctrl = eor | len | DescOwn;
27349
27350 if (frag == skb_shinfo(skb)->nr_frags - 1)
27351@@ -883,7 +850,6 @@
27352 txd->addr = cpu_to_le64(first_mapping);
27353 wmb();
27354
27355-#ifdef CP_TX_CHECKSUM
27356 if (skb->ip_summed == CHECKSUM_HW) {
27357 if (ip->protocol == IPPROTO_TCP)
27358 txd->opts1 = cpu_to_le32(first_eor | first_len |
27359@@ -896,7 +862,6 @@
27360 else
27361 BUG();
27362 } else
27363-#endif
27364 txd->opts1 = cpu_to_le32(first_eor | first_len |
27365 FirstFrag | DescOwn);
27366 wmb();
27367@@ -975,7 +940,9 @@
27368
27369 static void __cp_get_stats(struct cp_private *cp)
27370 {
27371- /* XXX implement */
27372+ /* only lower 24 bits valid; write any value to clear */
27373+ cp->net_stats.rx_missed_errors += (cpr32 (RxMissed) & 0xffffff);
27374+ cpw32 (RxMissed, 0);
27375 }
27376
27377 static struct net_device_stats *cp_get_stats(struct net_device *dev)
27378@@ -995,11 +962,10 @@
27379 {
27380 struct net_device *dev = cp->dev;
27381
27382- cpw16(IntrMask, 0);
27383- cpr16(IntrMask);
27384+ cpw16(IntrStatus, ~(cpr16(IntrStatus)));
27385+ cpw16_f(IntrMask, 0);
27386 cpw8(Cmd, 0);
27387- cpw16(CpCmd, 0);
27388- cpr16(CpCmd);
27389+ cpw16_f(CpCmd, 0);
27390 cpw16(IntrStatus, ~(cpr16(IntrStatus)));
27391 synchronize_irq(dev->irq);
27392 udelay(10);
27393@@ -1031,11 +997,7 @@
27394
27395 static inline void cp_start_hw (struct cp_private *cp)
27396 {
27397- u16 pci_dac = cp->pci_using_dac ? PCIDAC : 0;
27398- if (cp->board_type == RTL8169)
27399- cpw16(CpCmd, pci_dac | PCIMulRW | RxChkSum);
27400- else
27401- cpw16(CpCmd, pci_dac | PCIMulRW | RxChkSum | CpRxOn | CpTxOn);
27402+ cpw16(CpCmd, cp->cpcmd);
27403 cpw8(Cmd, RxOn | TxOn);
27404 }
27405
27406@@ -1059,13 +1021,10 @@
27407
27408 cpw8(Config1, cpr8(Config1) | DriverLoaded | PMEnable);
27409 /* Disable Wake-on-LAN. Can be turned on with ETHTOOL_SWOL */
27410- if (cp->board_type == RTL8139Cp) {
27411- cpw8(Config3, PARMEnable);
27412- cp->wol_enabled = 0;
27413- }
27414+ cpw8(Config3, PARMEnable);
27415+ cp->wol_enabled = 0;
27416+
27417 cpw8(Config5, cpr8(Config5) & PMEStatus);
27418- if (cp->board_type == RTL8169)
27419- cpw16(RxMaxSize, cp->rx_buf_sz);
27420
27421 cpw32_f(HiTxRingAddr, 0);
27422 cpw32_f(HiTxRingAddr + 4, 0);
27423@@ -1258,8 +1217,6 @@
27424
27425 dev->mtu = new_mtu;
27426 cp_set_rxbufsize(cp); /* set new rx buf size */
27427- if (cp->board_type == RTL8169)
27428- cpw16(RxMaxSize, cp->rx_buf_sz);
27429
27430 rc = cp_init_rings(cp); /* realloc and restart h/w */
27431 cp_start_hw(cp);
27432@@ -1304,8 +1261,8 @@
27433 }
27434
27435 /* Set the ethtool Wake-on-LAN settings */
27436-static void netdev_set_wol (struct cp_private *cp,
27437- const struct ethtool_wolinfo *wol)
27438+static int netdev_set_wol (struct cp_private *cp,
27439+ const struct ethtool_wolinfo *wol)
27440 {
27441 u8 options;
27442
27443@@ -1332,6 +1289,8 @@
27444 cpw8 (Config5, options);
27445
27446 cp->wol_enabled = (wol->wolopts) ? 1 : 0;
27447+
27448+ return 0;
27449 }
27450
27451 /* Get the ethtool Wake-on-LAN settings */
27452@@ -1357,308 +1316,216 @@
27453 if (options & MWF) wol->wolopts |= WAKE_MCAST;
27454 }
27455
27456-static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr)
27457+static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
27458 {
27459- u32 ethcmd;
27460+ struct cp_private *cp = dev->priv;
27461
27462- /* dev_ioctl() in ../../net/core/dev.c has already checked
27463- capable(CAP_NET_ADMIN), so don't bother with that here. */
27464+ strcpy (info->driver, DRV_NAME);
27465+ strcpy (info->version, DRV_VERSION);
27466+ strcpy (info->bus_info, pci_name(cp->pdev));
27467+}
27468
27469- if (get_user(ethcmd, (u32 *)useraddr))
27470- return -EFAULT;
27471-
27472- switch (ethcmd) {
27473-
27474- case ETHTOOL_GDRVINFO: {
27475- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
27476- strcpy (info.driver, DRV_NAME);
27477- strcpy (info.version, DRV_VERSION);
27478- strcpy (info.bus_info, pci_name(cp->pdev));
27479- info.regdump_len = CP_REGS_SIZE;
27480- info.n_stats = CP_NUM_STATS;
27481- if (copy_to_user (useraddr, &info, sizeof (info)))
27482- return -EFAULT;
27483- return 0;
27484- }
27485+static int cp_get_regs_len(struct net_device *dev)
27486+{
27487+ return CP_REGS_SIZE;
27488+}
27489
27490- /* get settings */
27491- case ETHTOOL_GSET: {
27492- struct ethtool_cmd ecmd = { ETHTOOL_GSET };
27493- spin_lock_irq(&cp->lock);
27494- mii_ethtool_gset(&cp->mii_if, &ecmd);
27495- spin_unlock_irq(&cp->lock);
27496- if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
27497- return -EFAULT;
27498- return 0;
27499- }
27500- /* set settings */
27501- case ETHTOOL_SSET: {
27502- int r;
27503- struct ethtool_cmd ecmd;
27504- if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
27505- return -EFAULT;
27506- spin_lock_irq(&cp->lock);
27507- r = mii_ethtool_sset(&cp->mii_if, &ecmd);
27508- spin_unlock_irq(&cp->lock);
27509- return r;
27510- }
27511- /* restart autonegotiation */
27512- case ETHTOOL_NWAY_RST: {
27513- return mii_nway_restart(&cp->mii_if);
27514- }
27515- /* get link status */
27516- case ETHTOOL_GLINK: {
27517- struct ethtool_value edata = {ETHTOOL_GLINK};
27518- edata.data = mii_link_ok(&cp->mii_if);
27519- if (copy_to_user(useraddr, &edata, sizeof(edata)))
27520- return -EFAULT;
27521- return 0;
27522- }
27523+static int cp_get_stats_count (struct net_device *dev)
27524+{
27525+ return CP_NUM_STATS;
27526+}
27527
27528- /* get message-level */
27529- case ETHTOOL_GMSGLVL: {
27530- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
27531- edata.data = cp->msg_enable;
27532- if (copy_to_user(useraddr, &edata, sizeof(edata)))
27533- return -EFAULT;
27534- return 0;
27535- }
27536- /* set message-level */
27537- case ETHTOOL_SMSGLVL: {
27538- struct ethtool_value edata;
27539- if (copy_from_user(&edata, useraddr, sizeof(edata)))
27540- return -EFAULT;
27541- cp->msg_enable = edata.data;
27542- return 0;
27543- }
27544+static int cp_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
27545+{
27546+ struct cp_private *cp = dev->priv;
27547+ int rc;
27548
27549- /* NIC register dump */
27550- case ETHTOOL_GREGS: {
27551- struct ethtool_regs regs;
27552- u8 *regbuf = kmalloc(CP_REGS_SIZE, GFP_KERNEL);
27553- int rc;
27554-
27555- if (!regbuf)
27556- return -ENOMEM;
27557- memset(regbuf, 0, CP_REGS_SIZE);
27558+ spin_lock_irq(&cp->lock);
27559+ rc = mii_ethtool_gset(&cp->mii_if, cmd);
27560+ spin_unlock_irq(&cp->lock);
27561
27562- rc = copy_from_user(&regs, useraddr, sizeof(regs));
27563- if (rc) {
27564- rc = -EFAULT;
27565- goto err_out_gregs;
27566- }
27567-
27568- if (regs.len > CP_REGS_SIZE)
27569- regs.len = CP_REGS_SIZE;
27570- if (regs.len < CP_REGS_SIZE) {
27571- rc = -EINVAL;
27572- goto err_out_gregs;
27573- }
27574+ return rc;
27575+}
27576
27577- regs.version = CP_REGS_VER;
27578- rc = copy_to_user(useraddr, &regs, sizeof(regs));
27579- if (rc) {
27580- rc = -EFAULT;
27581- goto err_out_gregs;
27582- }
27583+static int cp_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
27584+{
27585+ struct cp_private *cp = dev->priv;
27586+ int rc;
27587
27588- useraddr += offsetof(struct ethtool_regs, data);
27589+ spin_lock_irq(&cp->lock);
27590+ rc = mii_ethtool_sset(&cp->mii_if, cmd);
27591+ spin_unlock_irq(&cp->lock);
27592
27593- spin_lock_irq(&cp->lock);
27594- memcpy_fromio(regbuf, cp->regs, CP_REGS_SIZE);
27595- spin_unlock_irq(&cp->lock);
27596+ return rc;
27597+}
27598
27599- if (copy_to_user(useraddr, regbuf, regs.len))
27600- rc = -EFAULT;
27601+static int cp_nway_reset(struct net_device *dev)
27602+{
27603+ struct cp_private *cp = dev->priv;
27604+ return mii_nway_restart(&cp->mii_if);
27605+}
27606
27607-err_out_gregs:
27608- kfree(regbuf);
27609- return rc;
27610- }
27611+static u32 cp_get_msglevel(struct net_device *dev)
27612+{
27613+ struct cp_private *cp = dev->priv;
27614+ return cp->msg_enable;
27615+}
27616
27617- /* get/set RX checksumming */
27618- case ETHTOOL_GRXCSUM: {
27619- struct ethtool_value edata = { ETHTOOL_GRXCSUM };
27620- u16 cmd = cpr16(CpCmd) & RxChkSum;
27621-
27622- edata.data = cmd ? 1 : 0;
27623- if (copy_to_user(useraddr, &edata, sizeof(edata)))
27624- return -EFAULT;
27625- return 0;
27626- }
27627- case ETHTOOL_SRXCSUM: {
27628- struct ethtool_value edata;
27629- u16 cmd = cpr16(CpCmd), newcmd;
27630+static void cp_set_msglevel(struct net_device *dev, u32 value)
27631+{
27632+ struct cp_private *cp = dev->priv;
27633+ cp->msg_enable = value;
27634+}
27635
27636- newcmd = cmd;
27637+static u32 cp_get_rx_csum(struct net_device *dev)
27638+{
27639+ struct cp_private *cp = dev->priv;
27640+ return (cpr16(CpCmd) & RxChkSum) ? 1 : 0;
27641+}
27642
27643- if (copy_from_user(&edata, useraddr, sizeof(edata)))
27644- return -EFAULT;
27645+static int cp_set_rx_csum(struct net_device *dev, u32 data)
27646+{
27647+ struct cp_private *cp = dev->priv;
27648+ u16 cmd = cp->cpcmd, newcmd;
27649
27650- if (edata.data)
27651- newcmd |= RxChkSum;
27652- else
27653- newcmd &= ~RxChkSum;
27654+ newcmd = cmd;
27655
27656- if (newcmd == cmd)
27657- return 0;
27658+ if (data)
27659+ newcmd |= RxChkSum;
27660+ else
27661+ newcmd &= ~RxChkSum;
27662
27663+ if (newcmd != cmd) {
27664 spin_lock_irq(&cp->lock);
27665+ cp->cpcmd = newcmd;
27666 cpw16_f(CpCmd, newcmd);
27667 spin_unlock_irq(&cp->lock);
27668 }
27669
27670- /* get/set TX checksumming */
27671- case ETHTOOL_GTXCSUM: {
27672- struct ethtool_value edata = { ETHTOOL_GTXCSUM };
27673-
27674- edata.data = (cp->dev->features & NETIF_F_IP_CSUM) != 0;
27675- if (copy_to_user(useraddr, &edata, sizeof(edata)))
27676- return -EFAULT;
27677- return 0;
27678- }
27679- case ETHTOOL_STXCSUM: {
27680- struct ethtool_value edata;
27681-
27682- if (copy_from_user(&edata, useraddr, sizeof(edata)))
27683- return -EFAULT;
27684+ return 0;
27685+}
27686
27687- if (edata.data)
27688- cp->dev->features |= NETIF_F_IP_CSUM;
27689- else
27690- cp->dev->features &= ~NETIF_F_IP_CSUM;
27691+/* move this to net/core/ethtool.c */
27692+static int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
27693+{
27694+ if (data)
27695+ dev->features |= NETIF_F_IP_CSUM;
27696+ else
27697+ dev->features &= ~NETIF_F_IP_CSUM;
27698
27699- return 0;
27700- }
27701+ return 0;
27702+}
27703
27704- /* get/set scatter-gather */
27705- case ETHTOOL_GSG: {
27706- struct ethtool_value edata = { ETHTOOL_GSG };
27707-
27708- edata.data = (cp->dev->features & NETIF_F_SG) != 0;
27709- if (copy_to_user(useraddr, &edata, sizeof(edata)))
27710- return -EFAULT;
27711- return 0;
27712- }
27713- case ETHTOOL_SSG: {
27714- struct ethtool_value edata;
27715+static void cp_get_regs(struct net_device *dev, struct ethtool_regs *regs,
27716+ void *p)
27717+{
27718+ struct cp_private *cp = dev->priv;
27719
27720- if (copy_from_user(&edata, useraddr, sizeof(edata)))
27721- return -EFAULT;
27722+ if (regs->len < CP_REGS_SIZE)
27723+ return /* -EINVAL */;
27724
27725- if (edata.data)
27726- cp->dev->features |= NETIF_F_SG;
27727- else
27728- cp->dev->features &= ~NETIF_F_SG;
27729+ regs->version = CP_REGS_VER;
27730
27731- return 0;
27732- }
27733+ spin_lock_irq(&cp->lock);
27734+ memcpy_fromio(p, cp->regs, CP_REGS_SIZE);
27735+ spin_unlock_irq(&cp->lock);
27736+}
27737
27738- /* get string list(s) */
27739- case ETHTOOL_GSTRINGS: {
27740- struct ethtool_gstrings estr = { ETHTOOL_GSTRINGS };
27741-
27742- if (copy_from_user(&estr, useraddr, sizeof(estr)))
27743- return -EFAULT;
27744- if (estr.string_set != ETH_SS_STATS)
27745- return -EINVAL;
27746-
27747- estr.len = CP_NUM_STATS;
27748- if (copy_to_user(useraddr, &estr, sizeof(estr)))
27749- return -EFAULT;
27750- if (copy_to_user(useraddr + sizeof(estr),
27751- &ethtool_stats_keys,
27752- sizeof(ethtool_stats_keys)))
27753- return -EFAULT;
27754- return 0;
27755- }
27756+static void cp_get_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
27757+{
27758+ struct cp_private *cp = dev->priv;
27759
27760- /* get NIC-specific statistics */
27761- case ETHTOOL_GSTATS: {
27762- struct ethtool_stats estats = { ETHTOOL_GSTATS };
27763- u64 *tmp_stats;
27764- unsigned int work = 100;
27765- const unsigned int sz = sizeof(u64) * CP_NUM_STATS;
27766- int i;
27767-
27768- /* begin NIC statistics dump */
27769- cpw32(StatsAddr + 4, 0); /* FIXME: 64-bit PCI */
27770- cpw32(StatsAddr, cp->nic_stats_dma | DumpStats);
27771- cpr32(StatsAddr);
27772-
27773- estats.n_stats = CP_NUM_STATS;
27774- if (copy_to_user(useraddr, &estats, sizeof(estats)))
27775- return -EFAULT;
27776-
27777- while (work-- > 0) {
27778- if ((cpr32(StatsAddr) & DumpStats) == 0)
27779- break;
27780- cpu_relax();
27781- }
27782+ spin_lock_irq (&cp->lock);
27783+ netdev_get_wol (cp, wol);
27784+ spin_unlock_irq (&cp->lock);
27785+}
27786
27787- if (cpr32(StatsAddr) & DumpStats)
27788- return -EIO;
27789+static int cp_set_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
27790+{
27791+ struct cp_private *cp = dev->priv;
27792+ int rc;
27793
27794- tmp_stats = kmalloc(sz, GFP_KERNEL);
27795- if (!tmp_stats)
27796- return -ENOMEM;
27797- memset(tmp_stats, 0, sz);
27798-
27799- i = 0;
27800- tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok);
27801- tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok);
27802- tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err);
27803- tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err);
27804- tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo);
27805- tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align);
27806- tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col);
27807- tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol);
27808- tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys);
27809- tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast);
27810- tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast);
27811- tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort);
27812- tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun);
27813- tmp_stats[i++] = cp->cp_stats.rx_frags;
27814- if (i != CP_NUM_STATS)
27815- BUG();
27816+ spin_lock_irq (&cp->lock);
27817+ rc = netdev_set_wol (cp, wol);
27818+ spin_unlock_irq (&cp->lock);
27819
27820- i = copy_to_user(useraddr + sizeof(estats),
27821- tmp_stats, sz);
27822- kfree(tmp_stats);
27823+ return rc;
27824+}
27825
27826- if (i)
27827- return -EFAULT;
27828- return 0;
27829+static void cp_get_strings (struct net_device *dev, u32 stringset, u8 *buf)
27830+{
27831+ switch (stringset) {
27832+ case ETH_SS_STATS:
27833+ memcpy(buf, &ethtool_stats_keys, sizeof(ethtool_stats_keys));
27834+ break;
27835+ default:
27836+ BUG();
27837+ break;
27838 }
27839+}
27840
27841- /* get/set Wake-on-LAN settings */
27842- case ETHTOOL_GWOL: {
27843- struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
27844-
27845- spin_lock_irq (&cp->lock);
27846- netdev_get_wol (cp, &wol);
27847- spin_unlock_irq (&cp->lock);
27848- return ((copy_to_user (useraddr, &wol, sizeof (wol)))? -EFAULT : 0);
27849- }
27850-
27851- case ETHTOOL_SWOL: {
27852- struct ethtool_wolinfo wol;
27853+static void cp_get_ethtool_stats (struct net_device *dev,
27854+ struct ethtool_stats *estats, u64 *tmp_stats)
27855+{
27856+ struct cp_private *cp = dev->priv;
27857+ unsigned int work = 100;
27858+ int i;
27859
27860- if (copy_from_user (&wol, useraddr, sizeof (wol)))
27861- return -EFAULT;
27862- spin_lock_irq (&cp->lock);
27863- netdev_set_wol (cp, &wol);
27864- spin_unlock_irq (&cp->lock);
27865- return 0;
27866- }
27867+ /* begin NIC statistics dump */
27868+ cpw32(StatsAddr + 4, 0); /* FIXME: 64-bit PCI */
27869+ cpw32(StatsAddr, cp->nic_stats_dma | DumpStats);
27870+ cpr32(StatsAddr);
27871
27872- default:
27873- break;
27874+ while (work-- > 0) {
27875+ if ((cpr32(StatsAddr) & DumpStats) == 0)
27876+ break;
27877+ cpu_relax();
27878 }
27879
27880- return -EOPNOTSUPP;
27881+ if (cpr32(StatsAddr) & DumpStats)
27882+ return /* -EIO */;
27883+
27884+ i = 0;
27885+ tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok);
27886+ tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok);
27887+ tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err);
27888+ tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err);
27889+ tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo);
27890+ tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align);
27891+ tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col);
27892+ tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol);
27893+ tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys);
27894+ tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast);
27895+ tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast);
27896+ tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort);
27897+ tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun);
27898+ tmp_stats[i++] = cp->cp_stats.rx_frags;
27899+ if (i != CP_NUM_STATS)
27900+ BUG();
27901 }
27902
27903+static struct ethtool_ops cp_ethtool_ops = {
27904+ .get_drvinfo = cp_get_drvinfo,
27905+ .get_regs_len = cp_get_regs_len,
27906+ .get_stats_count = cp_get_stats_count,
27907+ .get_settings = cp_get_settings,
27908+ .set_settings = cp_set_settings,
27909+ .nway_reset = cp_nway_reset,
27910+ .get_link = ethtool_op_get_link,
27911+ .get_msglevel = cp_get_msglevel,
27912+ .set_msglevel = cp_set_msglevel,
27913+ .get_rx_csum = cp_get_rx_csum,
27914+ .set_rx_csum = cp_set_rx_csum,
27915+ .get_tx_csum = ethtool_op_get_tx_csum,
27916+ .set_tx_csum = ethtool_op_set_tx_csum, /* local! */
27917+ .get_sg = ethtool_op_get_sg,
27918+ .set_sg = ethtool_op_set_sg,
27919+ .get_regs = cp_get_regs,
27920+ .get_wol = cp_get_wol,
27921+ .set_wol = cp_set_wol,
27922+ .get_strings = cp_get_strings,
27923+ .get_ethtool_stats = cp_get_ethtool_stats,
27924+};
27925
27926 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
27927 {
27928@@ -1669,38 +1536,12 @@
27929 if (!netif_running(dev))
27930 return -EINVAL;
27931
27932- if (cmd == SIOCETHTOOL)
27933- return cp_ethtool_ioctl(cp, (void *) rq->ifr_data);
27934-
27935 spin_lock_irq(&cp->lock);
27936 rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL);
27937 spin_unlock_irq(&cp->lock);
27938 return rc;
27939 }
27940
27941-#if CP_VLAN_TAG_USED
27942-static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
27943-{
27944- struct cp_private *cp = dev->priv;
27945-
27946- spin_lock_irq(&cp->lock);
27947- cp->vlgrp = grp;
27948- cpw16(CpCmd, cpr16(CpCmd) | RxVlanOn);
27949- spin_unlock_irq(&cp->lock);
27950-}
27951-
27952-static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
27953-{
27954- struct cp_private *cp = dev->priv;
27955-
27956- spin_lock_irq(&cp->lock);
27957- cpw16(CpCmd, cpr16(CpCmd) & ~RxVlanOn);
27958- if (cp->vlgrp)
27959- cp->vlgrp->vlan_devices[vid] = NULL;
27960- spin_unlock_irq(&cp->lock);
27961-}
27962-#endif
27963-
27964 /* Serial EEPROM section. */
27965
27966 /* EEPROM_Ctrl bits. */
27967@@ -1723,7 +1564,7 @@
27968 #define EE_READ_CMD (6)
27969 #define EE_ERASE_CMD (7)
27970
27971-static int __devinit read_eeprom (void *ioaddr, int location, int addr_len)
27972+static int read_eeprom (void *ioaddr, int location, int addr_len)
27973 {
27974 int i;
27975 unsigned retval = 0;
27976@@ -1769,17 +1610,15 @@
27977 pci_set_power_state (cp->pdev, 3);
27978 }
27979
27980-static int __devinit cp_init_one (struct pci_dev *pdev,
27981- const struct pci_device_id *ent)
27982+static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
27983 {
27984 struct net_device *dev;
27985 struct cp_private *cp;
27986 int rc;
27987 void *regs;
27988 long pciaddr;
27989- unsigned int addr_len, i;
27990+ unsigned int addr_len, i, pci_using_dac;
27991 u8 pci_rev, cache_size;
27992- unsigned int board_type = (unsigned int) ent->driver_data;
27993
27994 #ifndef MODULE
27995 static int version_printed;
27996@@ -1805,7 +1644,6 @@
27997
27998 cp = dev->priv;
27999 cp->pdev = pdev;
28000- cp->board_type = board_type;
28001 cp->dev = dev;
28002 cp->msg_enable = (debug < 0 ? CP_DEF_MSG_ENABLE : debug);
28003 spin_lock_init (&cp->lock);
28004@@ -1846,18 +1684,22 @@
28005 }
28006
28007 /* Configure DMA attributes. */
28008- if (!pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL)) {
28009- cp->pci_using_dac = 1;
28010+ if ((sizeof(dma_addr_t) > 32) &&
28011+ !pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) {
28012+ pci_using_dac = 1;
28013 } else {
28014- rc = pci_set_dma_mask(pdev, (u64) 0xffffffff);
28015+ rc = pci_set_dma_mask(pdev, 0xffffffffULL);
28016 if (rc) {
28017 printk(KERN_ERR PFX "No usable DMA configuration, "
28018 "aborting.\n");
28019 goto err_out_res;
28020 }
28021- cp->pci_using_dac = 0;
28022+ pci_using_dac = 0;
28023 }
28024
28025+ cp->cpcmd = (pci_using_dac ? PCIDAC : 0) |
28026+ PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
28027+
28028 regs = ioremap_nocache(pciaddr, CP_REGS_SIZE);
28029 if (!regs) {
28030 rc = -EIO;
28031@@ -1882,16 +1724,17 @@
28032 dev->hard_start_xmit = cp_start_xmit;
28033 dev->get_stats = cp_get_stats;
28034 dev->do_ioctl = cp_ioctl;
28035+ dev->poll = cp_rx_poll;
28036+ dev->weight = 16; /* arbitrary? from NAPI_HOWTO.txt. */
28037 #ifdef BROKEN
28038 dev->change_mtu = cp_change_mtu;
28039 #endif
28040+ dev->ethtool_ops = &cp_ethtool_ops;
28041 #if 0
28042 dev->tx_timeout = cp_tx_timeout;
28043 dev->watchdog_timeo = TX_TIMEOUT;
28044 #endif
28045-#ifdef CP_TX_CHECKSUM
28046- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
28047-#endif
28048+
28049 #if CP_VLAN_TAG_USED
28050 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
28051 dev->vlan_rx_register = cp_vlan_rx_register;
28052@@ -1904,11 +1747,10 @@
28053 if (rc)
28054 goto err_out_iomap;
28055
28056- printk (KERN_INFO "%s: %s at 0x%lx, "
28057+ printk (KERN_INFO "%s: RTL-8139C+ at 0x%lx, "
28058 "%02x:%02x:%02x:%02x:%02x:%02x, "
28059 "IRQ %d\n",
28060 dev->name,
28061- cp_board_tbl[board_type].name,
28062 dev->base_addr,
28063 dev->dev_addr[0], dev->dev_addr[1],
28064 dev->dev_addr[2], dev->dev_addr[3],
28065@@ -1956,7 +1798,7 @@
28066 return rc;
28067 }
28068
28069-static void __devexit cp_remove_one (struct pci_dev *pdev)
28070+static void cp_remove_one (struct pci_dev *pdev)
28071 {
28072 struct net_device *dev = pci_get_drvdata(pdev);
28073 struct cp_private *cp = dev->priv;
28074@@ -2029,7 +1871,7 @@
28075 .name = DRV_NAME,
28076 .id_table = cp_pci_tbl,
28077 .probe = cp_init_one,
28078- .remove = __devexit_p(cp_remove_one),
28079+ .remove = cp_remove_one,
28080 #ifdef CONFIG_PM
28081 .resume = cp_resume,
28082 .suspend = cp_suspend,
28083diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
28084--- a/drivers/net/8139too.c Tue Aug 19 20:13:55 2003
28085+++ b/drivers/net/8139too.c Sun Aug 31 12:38:16 2003
28086@@ -123,6 +123,11 @@
28087 #define USE_IO_OPS 1
28088 #endif
28089
28090+/* use a 16K rx ring buffer instead of the default 32K */
28091+#ifdef CONFIG_SH_DREAMCAST
28092+#define USE_BUF16K 1
28093+#endif
28094+
28095 /* define to 1 to enable copious debugging info */
28096 #undef RTL8139_DEBUG
28097
28098@@ -165,7 +170,11 @@
28099 static int debug = -1;
28100
28101 /* Size of the in-memory receive ring. */
28102+#ifdef USE_BUF16K
28103+#define RX_BUF_LEN_IDX 1 /* 0==8K, 1==16K, 2==32K, 3==64K */
28104+#else
28105 #define RX_BUF_LEN_IDX 2 /* 0==8K, 1==16K, 2==32K, 3==64K */
28106+#endif
28107 #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX)
28108 #define RX_BUF_PAD 16
28109 #define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */
28110@@ -212,18 +221,7 @@
28111
28112 typedef enum {
28113 RTL8139 = 0,
28114- RTL8139_CB,
28115- SMC1211TX,
28116- /*MPX5030,*/
28117- DELTA8139,
28118- ADDTRON8139,
28119- DFE538TX,
28120- DFE690TXD,
28121- FE2000VX,
28122- ALLIED8139,
28123 RTL8129,
28124- FNW3603TX,
28125- FNW3800TX,
28126 } board_t;
28127
28128
28129@@ -232,36 +230,29 @@
28130 const char *name;
28131 u32 hw_flags;
28132 } board_info[] __devinitdata = {
28133- { "RealTek RTL8139 Fast Ethernet", RTL8139_CAPS },
28134- { "RealTek RTL8139B PCI/CardBus", RTL8139_CAPS },
28135- { "SMC1211TX EZCard 10/100 (RealTek RTL8139)", RTL8139_CAPS },
28136-/* { MPX5030, "Accton MPX5030 (RealTek RTL8139)", RTL8139_CAPS },*/
28137- { "Delta Electronics 8139 10/100BaseTX", RTL8139_CAPS },
28138- { "Addtron Technolgy 8139 10/100BaseTX", RTL8139_CAPS },
28139- { "D-Link DFE-538TX (RealTek RTL8139)", RTL8139_CAPS },
28140- { "D-Link DFE-690TXD (RealTek RTL8139)", RTL8139_CAPS },
28141- { "AboCom FE2000VX (RealTek RTL8139)", RTL8139_CAPS },
28142- { "Allied Telesyn 8139 CardBus", RTL8139_CAPS },
28143+ { "RealTek RTL8139", RTL8139_CAPS },
28144 { "RealTek RTL8129", RTL8129_CAPS },
28145- { "Planex FNW-3603-TX 10/100 CardBus", RTL8139_CAPS },
28146- { "Planex FNW-3800-TX 10/100 CardBus", RTL8139_CAPS },
28147 };
28148
28149
28150 static struct pci_device_id rtl8139_pci_tbl[] = {
28151 {0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28152- {0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139_CB },
28153- {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SMC1211TX },
28154-/* {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MPX5030 },*/
28155- {0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DELTA8139 },
28156- {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
28157- {0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE538TX },
28158- {0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE690TXD },
28159- {0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FE2000VX },
28160- {0x1259, 0xa117, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ALLIED8139 },
28161- {0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FNW3603TX },
28162- {0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FNW3800TX },
28163-
28164+ {0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28165+ {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28166+ {0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28167+ {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28168+ {0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28169+ {0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28170+ {0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28171+ {0x1259, 0xa117, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28172+ {0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28173+ {0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28174+ {0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28175+
28176+#ifdef CONFIG_SH_SECUREEDGE5410
28177+ /* Bogus 8139 silicon reports 8129 without external PROM :-( */
28178+ {0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
28179+#endif
28180 #ifdef CONFIG_8139TOO_8129
28181 {0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8129 },
28182 #endif
28183@@ -271,8 +262,8 @@
28184 * so we simply don't match on the main vendor id.
28185 */
28186 {PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 },
28187- {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, DFE538TX },
28188- {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, FE2000VX },
28189+ {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, RTL8139 },
28190+ {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, RTL8139 },
28191
28192 {0,}
28193 };
28194@@ -302,7 +293,6 @@
28195 IntrMask = 0x3C,
28196 IntrStatus = 0x3E,
28197 TxConfig = 0x40,
28198- ChipVersion = 0x43,
28199 RxConfig = 0x44,
28200 Timer = 0x48, /* A general-purpose counter. */
28201 RxMissed = 0x4C, /* 24 bits valid, write clears. */
28202@@ -461,7 +451,6 @@
28203 RxNoWrap = (1 << 7),
28204 };
28205
28206-
28207 /* Twister tuning parameters from RealTek.
28208 Completely undocumented, but required to tune bad links on some boards. */
28209 enum CSCRBits {
28210@@ -472,36 +461,22 @@
28211 CSCR_LinkDownCmd = 0x0f3c0,
28212 };
28213
28214-
28215 enum Cfg9346Bits {
28216 Cfg9346_Lock = 0x00,
28217 Cfg9346_Unlock = 0xC0,
28218 };
28219
28220-#ifdef CONFIG_8139TOO_TUNE_TWISTER
28221-
28222-enum TwisterParamVals {
28223- PARA78_default = 0x78fa8388,
28224- PARA7c_default = 0xcb38de43, /* param[0][3] */
28225- PARA7c_xxx = 0xcb38de43,
28226-};
28227-
28228-static const unsigned long param[4][4] = {
28229- {0xcb39de43, 0xcb39ce43, 0xfb38de03, 0xcb38de43},
28230- {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
28231- {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
28232- {0xbb39de43, 0xbb39ce43, 0xbb39ce83, 0xbb39ce83}
28233-};
28234-
28235-#endif /* CONFIG_8139TOO_TUNE_TWISTER */
28236-
28237 typedef enum {
28238 CH_8139 = 0,
28239 CH_8139_K,
28240 CH_8139A,
28241+ CH_8139A_G,
28242 CH_8139B,
28243 CH_8130,
28244 CH_8139C,
28245+ CH_8100,
28246+ CH_8100B_8139D,
28247+ CH_8101,
28248 } chip_t;
28249
28250 enum chip_flags {
28251@@ -509,50 +484,65 @@
28252 HasLWake = (1 << 1),
28253 };
28254
28255+#define HW_REVID(b30, b29, b28, b27, b26, b23, b22) \
28256+ (b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22)
28257+#define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1)
28258
28259 /* directly indexed by chip_t, above */
28260 const static struct {
28261 const char *name;
28262- u8 version; /* from RTL8139C docs */
28263- u32 RxConfigMask; /* should clear the bits supported by this chip */
28264+ u32 version; /* from RTL8139C/RTL8139D docs */
28265 u32 flags;
28266 } rtl_chip_info[] = {
28267 { "RTL-8139",
28268- 0x40,
28269- 0xf0fe0040, /* XXX copied from RTL8139A, verify */
28270+ HW_REVID(1, 0, 0, 0, 0, 0, 0),
28271 HasHltClk,
28272 },
28273
28274 { "RTL-8139 rev K",
28275- 0x60,
28276- 0xf0fe0040,
28277+ HW_REVID(1, 1, 0, 0, 0, 0, 0),
28278 HasHltClk,
28279 },
28280
28281 { "RTL-8139A",
28282- 0x70,
28283- 0xf0fe0040,
28284+ HW_REVID(1, 1, 1, 0, 0, 0, 0),
28285+ HasHltClk, /* XXX undocumented? */
28286+ },
28287+
28288+ { "RTL-8139A rev G",
28289+ HW_REVID(1, 1, 1, 0, 0, 1, 0),
28290 HasHltClk, /* XXX undocumented? */
28291 },
28292
28293 { "RTL-8139B",
28294- 0x78,
28295- 0xf0fc0040,
28296+ HW_REVID(1, 1, 1, 1, 0, 0, 0),
28297 HasLWake,
28298 },
28299
28300 { "RTL-8130",
28301- 0x7C,
28302- 0xf0fe0040, /* XXX copied from RTL8139A, verify */
28303+ HW_REVID(1, 1, 1, 1, 1, 0, 0),
28304 HasLWake,
28305 },
28306
28307 { "RTL-8139C",
28308- 0x74,
28309- 0xf0fc0040, /* XXX copied from RTL8139B, verify */
28310+ HW_REVID(1, 1, 1, 0, 1, 0, 0),
28311 HasLWake,
28312 },
28313
28314+ { "RTL-8100",
28315+ HW_REVID(1, 1, 1, 1, 0, 1, 0),
28316+ HasLWake,
28317+ },
28318+
28319+ { "RTL-8100B/8139D",
28320+ HW_REVID(1, 1, 1, 0, 1, 0, 1),
28321+ HasLWake,
28322+ },
28323+
28324+ { "RTL-8101",
28325+ HW_REVID(1, 1, 1, 0, 1, 1, 1),
28326+ HasLWake,
28327+ },
28328 };
28329
28330 struct rtl_extra_stats {
28331@@ -612,7 +602,7 @@
28332 static int mdio_read (struct net_device *dev, int phy_id, int location);
28333 static void mdio_write (struct net_device *dev, int phy_id, int location,
28334 int val);
28335-static int rtl8139_thread (void *data);
28336+static inline void rtl8139_start_thread(struct net_device *dev);
28337 static void rtl8139_tx_timeout (struct net_device *dev);
28338 static void rtl8139_init_ring (struct net_device *dev);
28339 static int rtl8139_start_xmit (struct sk_buff *skb,
28340@@ -625,6 +615,7 @@
28341 static void rtl8139_set_rx_mode (struct net_device *dev);
28342 static void __set_rx_mode (struct net_device *dev);
28343 static void rtl8139_hw_start (struct net_device *dev);
28344+static struct ethtool_ops rtl8139_ethtool_ops;
28345
28346 #ifdef USE_IO_OPS
28347
28348@@ -688,10 +679,17 @@
28349 PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
28350 TxErr | TxOK | RxErr | RxOK;
28351
28352+#ifdef USE_BUF16K
28353+static const unsigned int rtl8139_rx_config =
28354+ RxCfgRcv16K | RxNoWrap |
28355+ (RX_FIFO_THRESH << RxCfgFIFOShift) |
28356+ (RX_DMA_BURST << RxCfgDMAShift);
28357+#else
28358 static const unsigned int rtl8139_rx_config =
28359 RxCfgRcv32K | RxNoWrap |
28360 (RX_FIFO_THRESH << RxCfgFIFOShift) |
28361 (RX_DMA_BURST << RxCfgDMAShift);
28362+#endif
28363
28364 static const unsigned int rtl8139_tx_config =
28365 (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
28366@@ -716,13 +714,6 @@
28367 /* it's ok to call this even if we have no regions to free */
28368 pci_release_regions (pdev);
28369
28370-#ifndef RTL8139_NDEBUG
28371- /* poison memory before freeing */
28372- memset (dev, 0xBC,
28373- sizeof (struct net_device) +
28374- sizeof (struct rtl8139_private));
28375-#endif /* RTL8139_NDEBUG */
28376-
28377 free_netdev(dev);
28378
28379 pci_set_drvdata (pdev, NULL);
28380@@ -757,7 +748,7 @@
28381 unsigned int i;
28382 u32 pio_start, pio_end, pio_flags, pio_len;
28383 unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
28384- u32 tmp;
28385+ u32 version;
28386
28387 assert (pdev != NULL);
28388
28389@@ -859,9 +850,9 @@
28390 }
28391
28392 /* identify chip attached to board */
28393- tmp = RTL_R8 (ChipVersion);
28394+ version = RTL_R32 (TxConfig) & HW_REVID_MASK;
28395 for (i = 0; i < ARRAY_SIZE (rtl_chip_info); i++)
28396- if (tmp == rtl_chip_info[i].version) {
28397+ if (version == rtl_chip_info[i].version) {
28398 tp->chipset = i;
28399 goto match;
28400 }
28401@@ -892,8 +883,11 @@
28402 }
28403 if (rtl_chip_info[tp->chipset].flags & HasLWake) {
28404 tmp8 = RTL_R8 (Config4);
28405- if (tmp8 & LWPTN)
28406+ if (tmp8 & LWPTN) {
28407+ RTL_W8 (Cfg9346, Cfg9346_Unlock);
28408 RTL_W8 (Config4, tmp8 & ~LWPTN);
28409+ RTL_W8 (Cfg9346, Cfg9346_Lock);
28410+ }
28411 }
28412 } else {
28413 DPRINTK("Old chip wakeup\n");
28414@@ -971,6 +965,7 @@
28415 dev->get_stats = rtl8139_get_stats;
28416 dev->set_multicast_list = rtl8139_set_rx_mode;
28417 dev->do_ioctl = netdev_ioctl;
28418+ dev->ethtool_ops = &rtl8139_ethtool_ops;
28419 dev->tx_timeout = rtl8139_tx_timeout;
28420 dev->watchdog_timeo = TX_TIMEOUT;
28421
28422@@ -1318,8 +1313,6 @@
28423
28424 tp->mii.full_duplex = tp->mii.force_media;
28425 tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000;
28426- tp->twistie = (tp->chipset == CH_8139_K) ? 1 : 0;
28427- tp->time_to_die = 0;
28428
28429 rtl8139_init_ring (dev);
28430 rtl8139_hw_start (dev);
28431@@ -1330,32 +1323,18 @@
28432 dev->irq, RTL_R8 (MediaStatus),
28433 tp->mii.full_duplex ? "full" : "half");
28434
28435- tp->thr_pid = kernel_thread (rtl8139_thread, dev, CLONE_FS | CLONE_FILES);
28436- if (tp->thr_pid < 0)
28437- printk (KERN_WARNING "%s: unable to start kernel thread\n",
28438- dev->name);
28439+ rtl8139_start_thread(dev);
28440
28441 return 0;
28442 }
28443
28444
28445-static void rtl_check_media (struct net_device *dev)
28446+static void rtl_check_media (struct net_device *dev, unsigned int init_media)
28447 {
28448 struct rtl8139_private *tp = dev->priv;
28449
28450 if (tp->phys[0] >= 0) {
28451- u16 mii_lpa = mdio_read(dev, tp->phys[0], MII_LPA);
28452- if (mii_lpa == 0xffff)
28453- ; /* Not there */
28454- else if ((mii_lpa & LPA_100FULL) == LPA_100FULL
28455- || (mii_lpa & 0x00C0) == LPA_10FULL)
28456- tp->mii.full_duplex = 1;
28457-
28458- printk (KERN_INFO"%s: Setting %s%s-duplex based on"
28459- " auto-negotiated partner ability %4.4x.\n",
28460- dev->name, mii_lpa == 0 ? "" :
28461- (mii_lpa & 0x0180) ? "100mbps " : "10mbps ",
28462- tp->mii.full_duplex ? "full" : "half", mii_lpa);
28463+ mii_check_media(&tp->mii, 1, init_media);
28464 }
28465 }
28466
28467@@ -1390,7 +1369,7 @@
28468
28469 tp->cur_rx = 0;
28470
28471- rtl_check_media (dev);
28472+ rtl_check_media (dev, 1);
28473
28474 if (tp->chipset >= CH_8139B) {
28475 /* Disable magic packet scanning, which is enabled
28476@@ -1452,6 +1431,19 @@
28477 static inline void rtl8139_tune_twister (struct net_device *dev,
28478 struct rtl8139_private *tp) {}
28479 #else
28480+enum TwisterParamVals {
28481+ PARA78_default = 0x78fa8388,
28482+ PARA7c_default = 0xcb38de43, /* param[0][3] */
28483+ PARA7c_xxx = 0xcb38de43,
28484+};
28485+
28486+static const unsigned long param[4][4] = {
28487+ {0xcb39de43, 0xcb39ce43, 0xfb38de03, 0xcb38de43},
28488+ {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
28489+ {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
28490+ {0xbb39de43, 0xbb39ce43, 0xbb39ce83, 0xbb39ce83}
28491+};
28492+
28493 static void rtl8139_tune_twister (struct net_device *dev,
28494 struct rtl8139_private *tp)
28495 {
28496@@ -1538,7 +1530,6 @@
28497 }
28498 #endif /* CONFIG_8139TOO_TUNE_TWISTER */
28499
28500-
28501 static inline void rtl8139_thread_iter (struct net_device *dev,
28502 struct rtl8139_private *tp,
28503 void *ioaddr)
28504@@ -1585,7 +1576,6 @@
28505 RTL_R8 (Config1));
28506 }
28507
28508-
28509 static int rtl8139_thread (void *data)
28510 {
28511 struct net_device *dev = data;
28512@@ -1619,6 +1609,24 @@
28513 complete_and_exit (&tp->thr_exited, 0);
28514 }
28515
28516+static inline void rtl8139_start_thread(struct net_device *dev)
28517+{
28518+ struct rtl8139_private *tp = dev->priv;
28519+
28520+ tp->thr_pid = -1;
28521+ tp->twistie = 0;
28522+ tp->time_to_die = 0;
28523+ if (tp->chipset == CH_8139_K)
28524+ tp->twistie = 1;
28525+ else if (tp->drv_flags & HAS_LNK_CHNG)
28526+ return;
28527+
28528+ tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
28529+ if (tp->thr_pid < 0) {
28530+ printk (KERN_WARNING "%s: unable to start kernel thread\n",
28531+ dev->name);
28532+ }
28533+}
28534
28535 static void rtl8139_tx_clear (struct rtl8139_private *tp)
28536 {
28537@@ -1999,18 +2007,7 @@
28538
28539 if ((status & RxUnderrun) && link_changed &&
28540 (tp->drv_flags & HAS_LNK_CHNG)) {
28541- /* Really link-change on new chips. */
28542- int lpar = RTL_R16 (NWayLPAR);
28543- int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040
28544- || tp->mii.force_media;
28545- if (tp->mii.full_duplex != duplex) {
28546- tp->mii.full_duplex = duplex;
28547-#if 0
28548- RTL_W8 (Cfg9346, Cfg9346_Unlock);
28549- RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20);
28550- RTL_W8 (Cfg9346, Cfg9346_Lock);
28551-#endif
28552- }
28553+ rtl_check_media(dev, 0);
28554 status &= ~RxUnderrun;
28555 }
28556
28557@@ -2173,11 +2170,12 @@
28558 /* Get the ethtool Wake-on-LAN settings. Assumes that wol points to
28559 kernel memory, *wol has been initialized as {ETHTOOL_GWOL}, and
28560 other threads or interrupts aren't messing with the 8139. */
28561-static void netdev_get_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
28562+static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
28563 {
28564 struct rtl8139_private *np = dev->priv;
28565 void *ioaddr = np->mmio_addr;
28566
28567+ spin_lock_irq(&np->lock);
28568 if (rtl_chip_info[np->chipset].flags & HasLWake) {
28569 u8 cfg3 = RTL_R8 (Config3);
28570 u8 cfg5 = RTL_R8 (Config5);
28571@@ -2199,14 +2197,14 @@
28572 if (cfg5 & Cfg5_BWF)
28573 wol->wolopts |= WAKE_BCAST;
28574 }
28575+ spin_unlock_irq(&np->lock);
28576 }
28577
28578
28579 /* Set the ethtool Wake-on-LAN settings. Return 0 or -errno. Assumes
28580 that wol points to kernel memory and other threads or interrupts
28581 aren't messing with the 8139. */
28582-static int netdev_set_wol (struct net_device *dev,
28583- const struct ethtool_wolinfo *wol)
28584+static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
28585 {
28586 struct rtl8139_private *np = dev->priv;
28587 void *ioaddr = np->mmio_addr;
28588@@ -2220,6 +2218,7 @@
28589 if (wol->wolopts & ~support)
28590 return -EINVAL;
28591
28592+ spin_lock_irq(&np->lock);
28593 cfg3 = RTL_R8 (Config3) & ~(Cfg3_LinkUp | Cfg3_Magic);
28594 if (wol->wolopts & WAKE_PHY)
28595 cfg3 |= Cfg3_LinkUp;
28596@@ -2240,213 +2239,120 @@
28597 if (wol->wolopts & WAKE_BCAST)
28598 cfg5 |= Cfg5_BWF;
28599 RTL_W8 (Config5, cfg5); /* need not unlock via Cfg9346 */
28600+ spin_unlock_irq(&np->lock);
28601
28602 return 0;
28603 }
28604
28605-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
28606+static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
28607 {
28608 struct rtl8139_private *np = dev->priv;
28609- u32 ethcmd;
28610-
28611- /* dev_ioctl() in ../../net/core/dev.c has already checked
28612- capable(CAP_NET_ADMIN), so don't bother with that here. */
28613+ strcpy(info->driver, DRV_NAME);
28614+ strcpy(info->version, DRV_VERSION);
28615+ strcpy(info->bus_info, pci_name(np->pci_dev));
28616+ info->regdump_len = np->regs_len;
28617+}
28618
28619- if (get_user(ethcmd, (u32 *)useraddr))
28620- return -EFAULT;
28621+static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
28622+{
28623+ struct rtl8139_private *np = dev->priv;
28624+ spin_lock_irq(&np->lock);
28625+ mii_ethtool_gset(&np->mii, cmd);
28626+ spin_unlock_irq(&np->lock);
28627+ return 0;
28628+}
28629
28630- switch (ethcmd) {
28631-
28632- case ETHTOOL_GDRVINFO: {
28633- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
28634- strcpy (info.driver, DRV_NAME);
28635- strcpy (info.version, DRV_VERSION);
28636- strcpy (info.bus_info, pci_name(np->pci_dev));
28637- info.regdump_len = np->regs_len;
28638- if (copy_to_user (useraddr, &info, sizeof (info)))
28639- return -EFAULT;
28640- return 0;
28641- }
28642+static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
28643+{
28644+ struct rtl8139_private *np = dev->priv;
28645+ int rc;
28646+ spin_lock_irq(&np->lock);
28647+ rc = mii_ethtool_sset(&np->mii, cmd);
28648+ spin_unlock_irq(&np->lock);
28649+ return rc;
28650+}
28651
28652- /* get settings */
28653- case ETHTOOL_GSET: {
28654- struct ethtool_cmd ecmd = { ETHTOOL_GSET };
28655- spin_lock_irq(&np->lock);
28656- mii_ethtool_gset(&np->mii, &ecmd);
28657- spin_unlock_irq(&np->lock);
28658- if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
28659- return -EFAULT;
28660- return 0;
28661- }
28662- /* set settings */
28663- case ETHTOOL_SSET: {
28664- int r;
28665- struct ethtool_cmd ecmd;
28666- if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
28667- return -EFAULT;
28668- spin_lock_irq(&np->lock);
28669- r = mii_ethtool_sset(&np->mii, &ecmd);
28670- spin_unlock_irq(&np->lock);
28671- return r;
28672- }
28673- /* restart autonegotiation */
28674- case ETHTOOL_NWAY_RST: {
28675- return mii_nway_restart(&np->mii);
28676- }
28677- /* get link status */
28678- case ETHTOOL_GLINK: {
28679- struct ethtool_value edata = {ETHTOOL_GLINK};
28680- edata.data = mii_link_ok(&np->mii);
28681- if (copy_to_user(useraddr, &edata, sizeof(edata)))
28682- return -EFAULT;
28683- return 0;
28684- }
28685+static int rtl8139_nway_reset(struct net_device *dev)
28686+{
28687+ struct rtl8139_private *np = dev->priv;
28688+ return mii_nway_restart(&np->mii);
28689+}
28690
28691- /* get message-level */
28692- case ETHTOOL_GMSGLVL: {
28693- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
28694- edata.data = debug;
28695- if (copy_to_user(useraddr, &edata, sizeof(edata)))
28696- return -EFAULT;
28697- return 0;
28698- }
28699- /* set message-level */
28700- case ETHTOOL_SMSGLVL: {
28701- struct ethtool_value edata;
28702- if (copy_from_user(&edata, useraddr, sizeof(edata)))
28703- return -EFAULT;
28704- debug = edata.data;
28705- return 0;
28706- }
28707+static u32 rtl8139_get_link(struct net_device *dev)
28708+{
28709+ struct rtl8139_private *np = dev->priv;
28710+ return mii_link_ok(&np->mii);
28711+}
28712
28713- case ETHTOOL_GWOL:
28714- {
28715- struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
28716- spin_lock_irq (&np->lock);
28717- netdev_get_wol (dev, &wol);
28718- spin_unlock_irq (&np->lock);
28719- if (copy_to_user (useraddr, &wol, sizeof (wol)))
28720- return -EFAULT;
28721- return 0;
28722- }
28723+static u32 rtl8139_get_msglevel(struct net_device *dev)
28724+{
28725+ return debug;
28726+}
28727
28728- case ETHTOOL_SWOL:
28729- {
28730- struct ethtool_wolinfo wol;
28731- int rc;
28732- if (copy_from_user (&wol, useraddr, sizeof (wol)))
28733- return -EFAULT;
28734- spin_lock_irq (&np->lock);
28735- rc = netdev_set_wol (dev, &wol);
28736- spin_unlock_irq (&np->lock);
28737- return rc;
28738- }
28739+static void rtl8139_set_msglevel(struct net_device *dev, u32 datum)
28740+{
28741+ debug = datum;
28742+}
28743
28744 /* TODO: we are too slack to do reg dumping for pio, for now */
28745-#ifndef CONFIG_8139TOO_PIO
28746- /* NIC register dump */
28747- case ETHTOOL_GREGS: {
28748- struct ethtool_regs regs;
28749- unsigned int regs_len = np->regs_len;
28750- u8 *regbuf = kmalloc(regs_len, GFP_KERNEL);
28751- int rc;
28752-
28753- if (!regbuf)
28754- return -ENOMEM;
28755- memset(regbuf, 0, regs_len);
28756-
28757- rc = copy_from_user(&regs, useraddr, sizeof(regs));
28758- if (rc) {
28759- rc = -EFAULT;
28760- goto err_out_gregs;
28761- }
28762-
28763- if (regs.len > regs_len)
28764- regs.len = regs_len;
28765- if (regs.len < regs_len) {
28766- rc = -EINVAL;
28767- goto err_out_gregs;
28768- }
28769-
28770- regs.version = RTL_REGS_VER;
28771- rc = copy_to_user(useraddr, &regs, sizeof(regs));
28772- if (rc) {
28773- rc = -EFAULT;
28774- goto err_out_gregs;
28775- }
28776-
28777- useraddr += offsetof(struct ethtool_regs, data);
28778-
28779- spin_lock_irq(&np->lock);
28780- memcpy_fromio(regbuf, np->mmio_addr, regs_len);
28781- spin_unlock_irq(&np->lock);
28782-
28783- if (copy_to_user(useraddr, regbuf, regs_len))
28784- rc = -EFAULT;
28785-
28786-err_out_gregs:
28787- kfree(regbuf);
28788- return rc;
28789- }
28790-#endif /* CONFIG_8139TOO_PIO */
28791-
28792- /* get string list(s) */
28793- case ETHTOOL_GSTRINGS: {
28794- struct ethtool_gstrings estr = { ETHTOOL_GSTRINGS };
28795-
28796- if (copy_from_user(&estr, useraddr, sizeof(estr)))
28797- return -EFAULT;
28798- if (estr.string_set != ETH_SS_STATS)
28799- return -EINVAL;
28800-
28801- estr.len = RTL_NUM_STATS;
28802- if (copy_to_user(useraddr, &estr, sizeof(estr)))
28803- return -EFAULT;
28804- if (copy_to_user(useraddr + sizeof(estr),
28805- &ethtool_stats_keys,
28806- sizeof(ethtool_stats_keys)))
28807- return -EFAULT;
28808- return 0;
28809- }
28810+#ifdef CONFIG_8139TOO_PIO
28811+#define rtl8139_get_regs_len NULL
28812+#define rtl8139_get_regs NULL
28813+#else
28814+static int rtl8139_get_regs_len(struct net_device *dev)
28815+{
28816+ struct rtl8139_private *np = dev->priv;
28817+ return np->regs_len;
28818+}
28819
28820- /* get NIC-specific statistics */
28821- case ETHTOOL_GSTATS: {
28822- struct ethtool_stats estats = { ETHTOOL_GSTATS };
28823- u64 *tmp_stats;
28824- const unsigned int sz = sizeof(u64) * RTL_NUM_STATS;
28825- int i;
28826-
28827- estats.n_stats = RTL_NUM_STATS;
28828- if (copy_to_user(useraddr, &estats, sizeof(estats)))
28829- return -EFAULT;
28830-
28831- tmp_stats = kmalloc(sz, GFP_KERNEL);
28832- if (!tmp_stats)
28833- return -ENOMEM;
28834- memset(tmp_stats, 0, sz);
28835-
28836- i = 0;
28837- tmp_stats[i++] = np->xstats.early_rx;
28838- tmp_stats[i++] = np->xstats.tx_buf_mapped;
28839- tmp_stats[i++] = np->xstats.tx_timeouts;
28840- tmp_stats[i++] = np->xstats.rx_lost_in_ring;
28841- if (i != RTL_NUM_STATS)
28842- BUG();
28843+static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf)
28844+{
28845+ struct rtl8139_private *np = dev->priv;
28846
28847- i = copy_to_user(useraddr + sizeof(estats), tmp_stats, sz);
28848- kfree(tmp_stats);
28849+ regs->version = RTL_REGS_VER;
28850
28851- if (i)
28852- return -EFAULT;
28853- return 0;
28854- }
28855- default:
28856- break;
28857- }
28858+ spin_lock_irq(&np->lock);
28859+ memcpy_fromio(regbuf, np->mmio_addr, regs->len);
28860+ spin_unlock_irq(&np->lock);
28861+}
28862+#endif /* CONFIG_8139TOO_MMIO */
28863
28864- return -EOPNOTSUPP;
28865+static int rtl8139_get_stats_count(struct net_device *dev)
28866+{
28867+ return RTL_NUM_STATS;
28868 }
28869
28870+static void rtl8139_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data)
28871+{
28872+ struct rtl8139_private *np = dev->priv;
28873+
28874+ data[0] = np->xstats.early_rx;
28875+ data[1] = np->xstats.tx_buf_mapped;
28876+ data[2] = np->xstats.tx_timeouts;
28877+ data[3] = np->xstats.rx_lost_in_ring;
28878+}
28879+
28880+static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
28881+{
28882+ memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys));
28883+}
28884+
28885+static struct ethtool_ops rtl8139_ethtool_ops = {
28886+ .get_drvinfo = rtl8139_get_drvinfo,
28887+ .get_settings = rtl8139_get_settings,
28888+ .set_settings = rtl8139_set_settings,
28889+ .get_regs_len = rtl8139_get_regs_len,
28890+ .get_regs = rtl8139_get_regs,
28891+ .nway_reset = rtl8139_nway_reset,
28892+ .get_link = rtl8139_get_link,
28893+ .get_msglevel = rtl8139_get_msglevel,
28894+ .set_msglevel = rtl8139_set_msglevel,
28895+ .get_wol = rtl8139_get_wol,
28896+ .set_wol = rtl8139_set_wol,
28897+ .get_strings = rtl8139_get_strings,
28898+ .get_stats_count = rtl8139_get_stats_count,
28899+ .get_ethtool_stats = rtl8139_get_ethtool_stats,
28900+};
28901
28902 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
28903 {
28904@@ -2457,14 +2363,9 @@
28905 if (!netif_running(dev))
28906 return -EINVAL;
28907
28908- if (cmd == SIOCETHTOOL)
28909- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
28910-
28911- else {
28912- spin_lock_irq(&np->lock);
28913- rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
28914- spin_unlock_irq(&np->lock);
28915- }
28916+ spin_lock_irq(&np->lock);
28917+ rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
28918+ spin_unlock_irq(&np->lock);
28919
28920 return rc;
28921 }
28922diff -Nru a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
28923--- a/drivers/net/arcnet/arcnet.c Mon Jul 21 05:31:03 2003
28924+++ b/drivers/net/arcnet/arcnet.c Sun Aug 31 16:14:40 2003
28925@@ -135,7 +135,7 @@
28926 arc_proto_map[count] = arc_proto_default;
28927
28928 BUGLVL(D_DURING)
28929- printk("arcnet: struct sizes: %d %d %d %d %d\n",
28930+ printk("arcnet: struct sizes: %Zd %Zd %Zd %Zd %Zd\n",
28931 sizeof(struct arc_hardware), sizeof(struct arc_rfc1201),
28932 sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap),
28933 sizeof(struct archdr));
28934diff -Nru a/drivers/net/arm/ether00.c b/drivers/net/arm/ether00.c
28935--- a/drivers/net/arm/ether00.c Tue Aug 19 20:53:15 2003
28936+++ b/drivers/net/arm/ether00.c Sun Aug 31 16:14:08 2003
28937@@ -991,9 +991,9 @@
28938 }
28939
28940 static struct pld_hotswap_ops ether00_pldhs_ops={
28941- name: ETHER00_NAME,
28942- add_device: ether00_add_device,
28943- remove_devices: ether00_remove_devices,
28944+ .name = ETHER00_NAME,
28945+ .add_device = ether00_add_device,
28946+ .remove_devices = ether00_remove_devices,
28947 };
28948
28949
28950diff -Nru a/drivers/net/eth16i.c b/drivers/net/eth16i.c
28951--- a/drivers/net/eth16i.c Sun Apr 27 20:36:19 2003
28952+++ b/drivers/net/eth16i.c Sun Aug 31 06:34:16 2003
28953@@ -1053,7 +1053,7 @@
28954 int ioaddr = dev->base_addr;
28955 int status = 0;
28956 ushort length = skb->len;
28957- unsigned char *buf = skb->data;
28958+ unsigned char *buf;
28959 unsigned long flags;
28960
28961 if (length < ETH_ZLEN) {
28962@@ -1062,6 +1062,7 @@
28963 return 0;
28964 length = ETH_ZLEN;
28965 }
28966+ buf = skb->data;
28967
28968 netif_stop_queue(dev);
28969
28970diff -Nru a/drivers/net/fmv18x.c b/drivers/net/fmv18x.c
28971--- a/drivers/net/fmv18x.c Sun May 11 19:48:01 2003
28972+++ b/drivers/net/fmv18x.c Sun Aug 31 06:34:16 2003
28973@@ -367,7 +367,7 @@
28974 struct net_local *lp = dev->priv;
28975 int ioaddr = dev->base_addr;
28976 short length = skb->len;
28977- unsigned char *buf = skb->data;
28978+ unsigned char *buf;
28979 unsigned long flags;
28980
28981 /* Block a transmit from overlapping. */
28982@@ -385,6 +385,7 @@
28983 return 0;
28984 length = ETH_ZLEN;
28985 }
28986+ buf = skb->data;
28987
28988 if (net_debug > 4)
28989 printk("%s: Transmitting a packet of length %lu.\n", dev->name,
28990diff -Nru a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
28991--- a/drivers/net/irda/via-ircc.c Fri Aug 8 18:15:54 2003
28992+++ b/drivers/net/irda/via-ircc.c Sun Aug 31 16:14:08 2003
28993@@ -134,10 +134,10 @@
28994
28995
28996 static struct pci_driver via_driver = {
28997- name: VIA_MODULE_NAME,
28998- id_table: via_pci_tbl,
28999- probe: via_init_one,
29000- remove: via_remove_one,
29001+ .name = VIA_MODULE_NAME,
29002+ .id_table = via_pci_tbl,
29003+ .probe = via_init_one,
29004+ .remove = via_remove_one,
29005 };
29006
29007
29008diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
29009--- a/drivers/net/ixgb/ixgb_main.c Tue Aug 19 20:53:16 2003
29010+++ b/drivers/net/ixgb/ixgb_main.c Sun Aug 31 08:08:53 2003
29011@@ -1914,10 +1914,8 @@
29012 skb->protocol = eth_type_trans(skb, netdev);
29013 if (adapter->vlgrp
29014 && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
29015- vlan_hwaccel_rx(skb, adapter->vlgrp,
29016- (rx_desc->
29017- special &
29018- IXGB_RX_DESC_SPECIAL_VLAN_MASK));
29019+ vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
29020+ (rx_desc-> special & IXGB_RX_DESC_SPECIAL_VLAN_MASK));
29021 } else {
29022 netif_receive_skb(skb);
29023 }
29024diff -Nru a/drivers/net/ni5010.c b/drivers/net/ni5010.c
29025--- a/drivers/net/ni5010.c Sun Apr 20 23:00:41 2003
29026+++ b/drivers/net/ni5010.c Sun Aug 31 16:14:15 2003
29027@@ -96,6 +96,7 @@
29028 struct net_device_stats stats;
29029 int o_pkt_size;
29030 int i_pkt_size;
29031+ spinlock_t lock;
29032 };
29033
29034 /* Index to functions, as function prototypes. */
29035@@ -280,11 +281,16 @@
29036 /* DMA is not supported (yet?), so no use detecting it */
29037
29038 if (dev->priv == NULL) {
29039+ struct ni5010_local* lp;
29040+
29041 dev->priv = kmalloc(sizeof(struct ni5010_local), GFP_KERNEL|GFP_DMA);
29042 if (dev->priv == NULL) {
29043 printk(KERN_WARNING "%s: Failed to allocate private memory\n", dev->name);
29044 return -ENOMEM;
29045 }
29046+
29047+ lp = (struct ni5010_local*)dev->priv;
29048+ spin_lock_init(&lp->lock);
29049 }
29050
29051 PRINTK2((KERN_DEBUG "%s: I/O #10 passed!\n", dev->name));
29052@@ -463,6 +469,7 @@
29053 ioaddr = dev->base_addr;
29054 lp = (struct ni5010_local *)dev->priv;
29055
29056+ spin_lock(&lp->lock);
29057 status = inb(IE_ISTAT);
29058 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status));
29059
29060@@ -479,6 +486,7 @@
29061
29062 if (!xmit_was_error)
29063 reset_receiver(dev);
29064+ spin_unlock(&lp->lock);
29065 return IRQ_HANDLED;
29066 }
29067
29068@@ -693,8 +701,7 @@
29069 buf_offs = NI5010_BUFSIZE - length - pad;
29070 lp->o_pkt_size = length + pad;
29071
29072- save_flags(flags);
29073- cli();
29074+ spin_lock_irqsave(&lp->lock, flags);
29075
29076 outb(0, EDLC_RMASK); /* Mask all receive interrupts */
29077 outb(0, IE_MMODE); /* Put Xmit buffer on system bus */
29078@@ -712,7 +719,7 @@
29079 outb(MM_EN_XMT | MM_MUX, IE_MMODE); /* Begin transmission */
29080 outb(XM_ALL, EDLC_XMASK); /* Cause interrupt after completion or fail */
29081
29082- restore_flags(flags);
29083+ spin_unlock_irqrestore(&lp->lock, flags);
29084
29085 netif_wake_queue(dev);
29086
29087diff -Nru a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
29088--- a/drivers/net/pcmcia/3c574_cs.c Tue Aug 19 20:55:09 2003
29089+++ b/drivers/net/pcmcia/3c574_cs.c Sun Aug 31 05:20:57 2003
29090@@ -253,6 +253,7 @@
29091 static int el3_close(struct net_device *dev);
29092 static void el3_tx_timeout(struct net_device *dev);
29093 static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
29094+static struct ethtool_ops netdev_ethtool_ops;
29095 static void set_rx_mode(struct net_device *dev);
29096
29097 static dev_info_t dev_info = "3c574_cs";
29098@@ -319,6 +320,7 @@
29099 dev->hard_start_xmit = &el3_start_xmit;
29100 dev->get_stats = &el3_get_stats;
29101 dev->do_ioctl = &el3_ioctl;
29102+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29103 dev->set_multicast_list = &set_rx_mode;
29104 dev->open = &el3_open;
29105 dev->stop = &el3_close;
29106@@ -1202,26 +1204,16 @@
29107 return worklimit;
29108 }
29109
29110-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
29111+static void netdev_get_drvinfo(struct net_device *dev,
29112+ struct ethtool_drvinfo *info)
29113 {
29114- u32 ethcmd;
29115-
29116- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
29117- return -EFAULT;
29118-
29119- switch (ethcmd) {
29120- case ETHTOOL_GDRVINFO: {
29121- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
29122- strncpy(info.driver, "3c574_cs", sizeof(info.driver)-1);
29123- if (copy_to_user(useraddr, &info, sizeof(info)))
29124- return -EFAULT;
29125- return 0;
29126- }
29127- }
29128-
29129- return -EOPNOTSUPP;
29130+ strcpy(info->driver, "3c574_cs");
29131 }
29132
29133+static struct ethtool_ops netdev_ethtool_ops = {
29134+ .get_drvinfo = netdev_get_drvinfo,
29135+};
29136+
29137 /* Provide ioctl() calls to examine the MII xcvr state. */
29138 static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29139 {
29140@@ -1235,11 +1227,9 @@
29141 data[0], data[1], data[2], data[3]);
29142
29143 switch(cmd) {
29144- case SIOCETHTOOL:
29145- return netdev_ethtool_ioctl(dev, (void *)rq->ifr_data);
29146- case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
29147+ case SIOCGMIIPHY: /* Get the address of the PHY in use. */
29148 data[0] = phy;
29149- case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
29150+ case SIOCGMIIREG: /* Read the specified MII register. */
29151 {
29152 int saved_window;
29153 unsigned long flags;
29154@@ -1252,7 +1242,7 @@
29155 spin_unlock_irqrestore(&lp->window_lock, flags);
29156 return 0;
29157 }
29158- case SIOCDEVPRIVATE+2: /* Write the specified MII register */
29159+ case SIOCSMIIREG: /* Write the specified MII register */
29160 {
29161 int saved_window;
29162 unsigned long flags;
29163diff -Nru a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
29164--- a/drivers/net/pcmcia/3c589_cs.c Tue Aug 19 20:55:09 2003
29165+++ b/drivers/net/pcmcia/3c589_cs.c Tue Aug 26 14:27:07 2003
29166@@ -165,7 +165,7 @@
29167 static int el3_close(struct net_device *dev);
29168 static void el3_tx_timeout(struct net_device *dev);
29169 static void set_multicast_list(struct net_device *dev);
29170-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
29171+static struct ethtool_ops netdev_ethtool_ops;
29172
29173 static dev_info_t dev_info = "3c589_cs";
29174
29175@@ -249,7 +249,7 @@
29176 dev->tx_timeout = el3_tx_timeout;
29177 dev->watchdog_timeo = TX_TIMEOUT;
29178 #endif
29179- dev->do_ioctl = netdev_ioctl;
29180+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29181
29182 /* Register with Card Services */
29183 link->next = dev_list;
29184@@ -639,70 +639,33 @@
29185 | AdapterFailure, ioaddr + EL3_CMD);
29186 }
29187
29188-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
29189+static void netdev_get_drvinfo(struct net_device *dev,
29190+ struct ethtool_drvinfo *info)
29191 {
29192- u32 ethcmd;
29193-
29194- /* dev_ioctl() in ../../net/core/dev.c has already checked
29195- capable(CAP_NET_ADMIN), so don't bother with that here. */
29196-
29197- if (get_user(ethcmd, (u32 *)useraddr))
29198- return -EFAULT;
29199-
29200- switch (ethcmd) {
29201-
29202- case ETHTOOL_GDRVINFO: {
29203- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
29204- strcpy (info.driver, DRV_NAME);
29205- strcpy (info.version, DRV_VERSION);
29206- sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
29207- if (copy_to_user (useraddr, &info, sizeof (info)))
29208- return -EFAULT;
29209- return 0;
29210- }
29211+ strcpy(info->driver, DRV_NAME);
29212+ strcpy(info->version, DRV_VERSION);
29213+ sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
29214+}
29215
29216 #ifdef PCMCIA_DEBUG
29217- /* get message-level */
29218- case ETHTOOL_GMSGLVL: {
29219- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
29220- edata.data = pc_debug;
29221- if (copy_to_user(useraddr, &edata, sizeof(edata)))
29222- return -EFAULT;
29223- return 0;
29224- }
29225- /* set message-level */
29226- case ETHTOOL_SMSGLVL: {
29227- struct ethtool_value edata;
29228- if (copy_from_user(&edata, useraddr, sizeof(edata)))
29229- return -EFAULT;
29230- pc_debug = edata.data;
29231- return 0;
29232- }
29233-#endif
29234-
29235- default:
29236- break;
29237- }
29238-
29239- return -EOPNOTSUPP;
29240+static u32 netdev_get_msglevel(struct net_device *dev)
29241+{
29242+ return pc_debug;
29243 }
29244
29245-static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
29246+static void netdev_set_msglevel(struct net_device *dev, u32 level)
29247 {
29248- int rc;
29249-
29250- switch (cmd) {
29251- case SIOCETHTOOL:
29252- rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29253- break;
29254-
29255- default:
29256- rc = -EOPNOTSUPP;
29257- break;
29258- }
29259-
29260- return rc;
29261+ pc_debug = level;
29262 }
29263+#endif /* PCMCIA_DEBUG */
29264+
29265+static struct ethtool_ops netdev_ethtool_ops = {
29266+ .get_drvinfo = netdev_get_drvinfo,
29267+#ifdef PCMCIA_DEBUG
29268+ .get_msglevel = netdev_get_msglevel,
29269+ .set_msglevel = netdev_set_msglevel,
29270+#endif /* PCMCIA_DEBUG */
29271+};
29272
29273 static int el3_config(struct net_device *dev, struct ifmap *map)
29274 {
29275diff -Nru a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
29276--- a/drivers/net/pcmcia/axnet_cs.c Tue Aug 19 20:55:09 2003
29277+++ b/drivers/net/pcmcia/axnet_cs.c Sun Aug 31 05:20:58 2003
29278@@ -98,6 +98,7 @@
29279 static int axnet_open(struct net_device *dev);
29280 static int axnet_close(struct net_device *dev);
29281 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
29282+static struct ethtool_ops netdev_ethtool_ops;
29283 static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
29284 static void ei_watchdog(u_long arg);
29285 static void axnet_reset_8390(struct net_device *dev);
29286@@ -209,6 +210,7 @@
29287 dev->open = &axnet_open;
29288 dev->stop = &axnet_close;
29289 dev->do_ioctl = &axnet_ioctl;
29290+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29291
29292 /* Register with Card Services */
29293 link->next = dev_list;
29294@@ -807,26 +809,16 @@
29295 add_timer(&info->watchdog);
29296 }
29297
29298-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
29299+static void netdev_get_drvinfo(struct net_device *dev,
29300+ struct ethtool_drvinfo *info)
29301 {
29302- u32 ethcmd;
29303-
29304- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
29305- return -EFAULT;
29306-
29307- switch (ethcmd) {
29308- case ETHTOOL_GDRVINFO: {
29309- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
29310- strncpy(info.driver, "axnet_cs", sizeof(info.driver)-1);
29311- if (copy_to_user(useraddr, &info, sizeof(info)))
29312- return -EFAULT;
29313- return 0;
29314- }
29315- }
29316-
29317- return -EOPNOTSUPP;
29318+ strcpy(info->driver, "axnet_cs");
29319 }
29320
29321+static struct ethtool_ops netdev_ethtool_ops = {
29322+ .get_drvinfo = netdev_get_drvinfo,
29323+};
29324+
29325 /*====================================================================*/
29326
29327 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29328@@ -835,14 +827,12 @@
29329 u16 *data = (u16 *)&rq->ifr_data;
29330 ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
29331 switch (cmd) {
29332- case SIOCETHTOOL:
29333- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29334- case SIOCDEVPRIVATE:
29335+ case SIOCGMIIPHY:
29336 data[0] = info->phy_id;
29337- case SIOCDEVPRIVATE+1:
29338+ case SIOCGMIIREG: /* Read MII PHY register. */
29339 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
29340 return 0;
29341- case SIOCDEVPRIVATE+2:
29342+ case SIOCSMIIREG: /* Write MII PHY register. */
29343 if (!capable(CAP_NET_ADMIN))
29344 return -EPERM;
29345 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
29346diff -Nru a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
29347--- a/drivers/net/pcmcia/fmvj18x_cs.c Tue Aug 19 20:55:09 2003
29348+++ b/drivers/net/pcmcia/fmvj18x_cs.c Tue Aug 26 14:51:25 2003
29349@@ -113,7 +113,7 @@
29350 static struct net_device_stats *fjn_get_stats(struct net_device *dev);
29351 static void set_rx_mode(struct net_device *dev);
29352 static void fjn_tx_timeout(struct net_device *dev);
29353-static int fjn_ioctl(struct net_device *, struct ifreq *, int);
29354+static struct ethtool_ops netdev_ethtool_ops;
29355
29356 static dev_info_t dev_info = "fmvj18x_cs";
29357 static dev_link_t *dev_list;
29358@@ -312,7 +312,7 @@
29359 dev->tx_timeout = fjn_tx_timeout;
29360 dev->watchdog_timeo = TX_TIMEOUT;
29361 #endif
29362- dev->do_ioctl = fjn_ioctl;
29363+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29364
29365 /* Register with Card Services */
29366 link->next = dev_list;
29367@@ -1186,64 +1186,33 @@
29368
29369 /*====================================================================*/
29370
29371-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
29372+static void netdev_get_drvinfo(struct net_device *dev,
29373+ struct ethtool_drvinfo *info)
29374 {
29375- u32 ethcmd;
29376-
29377- /* dev_ioctl() in ../../net/core/dev.c has already checked
29378- capable(CAP_NET_ADMIN), so don't bother with that here. */
29379-
29380- if (get_user(ethcmd, (u32 *)useraddr))
29381- return -EFAULT;
29382-
29383- switch (ethcmd) {
29384-
29385- case ETHTOOL_GDRVINFO: {
29386- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
29387- strcpy (info.driver, DRV_NAME);
29388- strcpy (info.version, DRV_VERSION);
29389- sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
29390- if (copy_to_user (useraddr, &info, sizeof (info)))
29391- return -EFAULT;
29392- return 0;
29393- }
29394+ strcpy(info->driver, DRV_NAME);
29395+ strcpy(info->version, DRV_VERSION);
29396+ sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
29397+}
29398
29399 #ifdef PCMCIA_DEBUG
29400- /* get message-level */
29401- case ETHTOOL_GMSGLVL: {
29402- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
29403- edata.data = pc_debug;
29404- if (copy_to_user(useraddr, &edata, sizeof(edata)))
29405- return -EFAULT;
29406- return 0;
29407- }
29408- /* set message-level */
29409- case ETHTOOL_SMSGLVL: {
29410- struct ethtool_value edata;
29411- if (copy_from_user(&edata, useraddr, sizeof(edata)))
29412- return -EFAULT;
29413- pc_debug = edata.data;
29414- return 0;
29415- }
29416-#endif
29417-
29418- default:
29419- break;
29420- }
29421-
29422- return -EOPNOTSUPP;
29423+static u32 netdev_get_msglevel(struct net_device *dev)
29424+{
29425+ return pc_debug;
29426 }
29427
29428-static int fjn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29429+static void netdev_set_msglevel(struct net_device *dev, u32 level)
29430 {
29431- switch (cmd) {
29432- case SIOCETHTOOL:
29433- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29434-
29435- default:
29436- return -EOPNOTSUPP;
29437- }
29438+ pc_debug = level;
29439 }
29440+#endif /* PCMCIA_DEBUG */
29441+
29442+static struct ethtool_ops netdev_ethtool_ops = {
29443+ .get_drvinfo = netdev_get_drvinfo,
29444+#ifdef PCMCIA_DEBUG
29445+ .get_msglevel = netdev_get_msglevel,
29446+ .set_msglevel = netdev_set_msglevel,
29447+#endif /* PCMCIA_DEBUG */
29448+};
29449
29450 static int fjn_config(struct net_device *dev, struct ifmap *map){
29451 return 0;
29452diff -Nru a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
29453--- a/drivers/net/pcmcia/ibmtr_cs.c Tue Aug 19 20:55:09 2003
29454+++ b/drivers/net/pcmcia/ibmtr_cs.c Tue Aug 26 14:51:25 2003
29455@@ -157,36 +157,15 @@
29456 }
29457 }
29458
29459-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
29460+static void netdev_get_drvinfo(struct net_device *dev,
29461+ struct ethtool_drvinfo *info)
29462 {
29463- u32 ethcmd;
29464-
29465- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
29466- return -EFAULT;
29467-
29468- switch (ethcmd) {
29469- case ETHTOOL_GDRVINFO: {
29470- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
29471- strncpy(info.driver, "ibmtr_cs", sizeof(info.driver)-1);
29472- if (copy_to_user(useraddr, &info, sizeof(info)))
29473- return -EFAULT;
29474- return 0;
29475- }
29476- }
29477-
29478- return -EOPNOTSUPP;
29479+ strcpy(info->driver, "ibmtr_cs");
29480 }
29481
29482-static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29483-{
29484-
29485- switch(cmd) {
29486- case SIOCETHTOOL:
29487- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29488- default:
29489- return -EOPNOTSUPP;
29490- }
29491-}
29492+static struct ethtool_ops netdev_ethtool_ops = {
29493+ .get_drvinfo = netdev_get_drvinfo,
29494+};
29495
29496 /*======================================================================
29497
29498@@ -235,7 +214,7 @@
29499 link->irq.Instance = info->dev = dev;
29500
29501 dev->init = &ibmtr_probe;
29502- dev->do_ioctl = &private_ioctl;
29503+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29504
29505 /* Register with Card Services */
29506 link->next = dev_list;
29507diff -Nru a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
29508--- a/drivers/net/pcmcia/nmclan_cs.c Tue Aug 19 20:55:09 2003
29509+++ b/drivers/net/pcmcia/nmclan_cs.c Tue Aug 26 14:51:25 2003
29510@@ -442,7 +442,8 @@
29511 static int mace_rx(struct net_device *dev, unsigned char RxCnt);
29512 static void restore_multicast_list(struct net_device *dev);
29513 static void set_multicast_list(struct net_device *dev);
29514-static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
29515+static struct ethtool_ops netdev_ethtool_ops;
29516+
29517
29518 static dev_link_t *nmclan_attach(void);
29519 static void nmclan_detach(dev_link_t *);
29520@@ -515,7 +516,7 @@
29521 dev->set_config = &mace_config;
29522 dev->get_stats = &mace_get_stats;
29523 dev->set_multicast_list = &set_multicast_list;
29524- dev->do_ioctl = &mace_ioctl;
29525+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29526 dev->open = &mace_open;
29527 dev->stop = &mace_close;
29528 #ifdef HAVE_TX_TIMEOUT
29529@@ -1014,65 +1015,33 @@
29530 return 0;
29531 } /* mace_close */
29532
29533-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
29534+static void netdev_get_drvinfo(struct net_device *dev,
29535+ struct ethtool_drvinfo *info)
29536 {
29537- u32 ethcmd;
29538-
29539- /* dev_ioctl() in ../../net/core/dev.c has already checked
29540- capable(CAP_NET_ADMIN), so don't bother with that here. */
29541-
29542- if (get_user(ethcmd, (u32 *)useraddr))
29543- return -EFAULT;
29544-
29545- switch (ethcmd) {
29546-
29547- case ETHTOOL_GDRVINFO: {
29548- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
29549- strcpy (info.driver, DRV_NAME);
29550- strcpy (info.version, DRV_VERSION);
29551- sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
29552- if (copy_to_user (useraddr, &info, sizeof (info)))
29553- return -EFAULT;
29554- return 0;
29555- }
29556+ strcpy(info->driver, DRV_NAME);
29557+ strcpy(info->version, DRV_VERSION);
29558+ sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
29559+}
29560
29561 #ifdef PCMCIA_DEBUG
29562- /* get message-level */
29563- case ETHTOOL_GMSGLVL: {
29564- struct ethtool_value edata = {ETHTOOL_GMSGLVL};
29565- edata.data = pc_debug;
29566- if (copy_to_user(useraddr, &edata, sizeof(edata)))
29567- return -EFAULT;
29568- return 0;
29569- }
29570- /* set message-level */
29571- case ETHTOOL_SMSGLVL: {
29572- struct ethtool_value edata;
29573- if (copy_from_user(&edata, useraddr, sizeof(edata)))
29574- return -EFAULT;
29575- pc_debug = edata.data;
29576- return 0;
29577- }
29578-#endif
29579-
29580- default:
29581- break;
29582- }
29583-
29584- return -EOPNOTSUPP;
29585+static u32 netdev_get_msglevel(struct net_device *dev)
29586+{
29587+ return pc_debug;
29588 }
29589
29590-static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29591+static void netdev_set_msglevel(struct net_device *dev, u32 level)
29592 {
29593- switch (cmd) {
29594- case SIOCETHTOOL:
29595- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29596-
29597- default:
29598- return -EOPNOTSUPP;
29599- }
29600- return 0;
29601+ pc_debug = level;
29602 }
29603+#endif /* PCMCIA_DEBUG */
29604+
29605+static struct ethtool_ops netdev_ethtool_ops = {
29606+ .get_drvinfo = netdev_get_drvinfo,
29607+#ifdef PCMCIA_DEBUG
29608+ .get_msglevel = netdev_get_msglevel,
29609+ .set_msglevel = netdev_set_msglevel,
29610+#endif /* PCMCIA_DEBUG */
29611+};
29612
29613 /* ----------------------------------------------------------------------------
29614 mace_start_xmit
29615diff -Nru a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
29616--- a/drivers/net/pcmcia/pcnet_cs.c Tue Aug 19 20:55:09 2003
29617+++ b/drivers/net/pcmcia/pcnet_cs.c Sun Aug 31 05:20:58 2003
29618@@ -116,7 +116,7 @@
29619 static int pcnet_open(struct net_device *dev);
29620 static int pcnet_close(struct net_device *dev);
29621 static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
29622-static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd);
29623+static struct ethtool_ops netdev_ethtool_ops;
29624 static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
29625 static void ei_watchdog(u_long arg);
29626 static void pcnet_reset_8390(struct net_device *dev);
29627@@ -756,6 +756,7 @@
29628
29629 strcpy(info->node.dev_name, dev->name);
29630 link->dev = &info->node;
29631+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29632
29633 if (info->flags & (IS_DL10019|IS_DL10022)) {
29634 u_char id = inb(dev->base_addr + 0x1a);
29635@@ -769,7 +770,6 @@
29636 printk("PNA, ");
29637 } else {
29638 printk(KERN_INFO "%s: NE2000 Compatible: ", dev->name);
29639- dev->do_ioctl = &do_ioctl_light;
29640 }
29641 printk("io %#3lx, irq %d,", dev->base_addr, dev->irq);
29642 if (info->flags & USE_SHMEM)
29643@@ -1205,26 +1205,16 @@
29644
29645 /*====================================================================*/
29646
29647-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
29648+static void netdev_get_drvinfo(struct net_device *dev,
29649+ struct ethtool_drvinfo *info)
29650 {
29651- u32 ethcmd;
29652-
29653- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
29654- return -EFAULT;
29655-
29656- switch (ethcmd) {
29657- case ETHTOOL_GDRVINFO: {
29658- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
29659- strncpy(info.driver, "pcnet_cs", sizeof(info.driver)-1);
29660- if (copy_to_user(useraddr, &info, sizeof(info)))
29661- return -EFAULT;
29662- return 0;
29663- }
29664- }
29665-
29666- return -EOPNOTSUPP;
29667+ strcpy(info->driver, "pcnet_cs");
29668 }
29669
29670+static struct ethtool_ops netdev_ethtool_ops = {
29671+ .get_drvinfo = netdev_get_drvinfo,
29672+};
29673+
29674 /*====================================================================*/
29675
29676
29677@@ -1234,31 +1224,18 @@
29678 u16 *data = (u16 *)&rq->ifr_data;
29679 ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO;
29680 switch (cmd) {
29681- case SIOCETHTOOL:
29682- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29683- case SIOCDEVPRIVATE:
29684+ case SIOCGMIIPHY:
29685 data[0] = info->phy_id;
29686- case SIOCDEVPRIVATE+1:
29687+ case SIOCGMIIREG: /* Read MII PHY register. */
29688 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
29689 return 0;
29690- case SIOCDEVPRIVATE+2:
29691+ case SIOCSMIIREG: /* Write MII PHY register. */
29692 if (!capable(CAP_NET_ADMIN))
29693 return -EPERM;
29694 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
29695 return 0;
29696 }
29697 return -EOPNOTSUPP;
29698-}
29699-
29700-/*====================================================================*/
29701-
29702-static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd)
29703-{
29704- switch (cmd) {
29705- case SIOCETHTOOL:
29706- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29707- }
29708- return -EOPNOTSUPP;
29709 }
29710
29711 /*====================================================================*/
29712diff -Nru a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
29713--- a/drivers/net/pcmcia/xirc2ps_cs.c Tue Aug 19 20:55:09 2003
29714+++ b/drivers/net/pcmcia/xirc2ps_cs.c Sun Aug 31 05:20:58 2003
29715@@ -382,6 +382,7 @@
29716 static int do_config(struct net_device *dev, struct ifmap *map);
29717 static int do_open(struct net_device *dev);
29718 static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
29719+static struct ethtool_ops netdev_ethtool_ops;
29720 static void hardreset(struct net_device *dev);
29721 static void do_reset(struct net_device *dev, int full);
29722 static int init_mii(struct net_device *dev);
29723@@ -626,6 +627,7 @@
29724 dev->set_config = &do_config;
29725 dev->get_stats = &do_get_stats;
29726 dev->do_ioctl = &do_ioctl;
29727+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
29728 dev->set_multicast_list = &set_multicast_list;
29729 dev->open = &do_open;
29730 dev->stop = &do_stop;
29731@@ -1699,26 +1701,16 @@
29732 return 0;
29733 }
29734
29735-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
29736+static void netdev_get_drvinfo(struct net_device *dev,
29737+ struct ethtool_drvinfo *info)
29738 {
29739- u32 ethcmd;
29740-
29741- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
29742- return -EFAULT;
29743-
29744- switch (ethcmd) {
29745- case ETHTOOL_GDRVINFO: {
29746- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
29747- strncpy(info.driver, "xirc2ps_cs", sizeof(info.driver)-1);
29748- if (copy_to_user(useraddr, &info, sizeof(info)))
29749- return -EFAULT;
29750- return 0;
29751- }
29752- }
29753-
29754- return -EOPNOTSUPP;
29755+ strcpy(info->driver, "xirc2ps_cs");
29756 }
29757
29758+static struct ethtool_ops netdev_ethtool_ops = {
29759+ .get_drvinfo = netdev_get_drvinfo,
29760+};
29761+
29762 static int
29763 do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
29764 {
29765@@ -1734,15 +1726,13 @@
29766 return -EOPNOTSUPP;
29767
29768 switch(cmd) {
29769- case SIOCETHTOOL:
29770- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
29771- case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
29772+ case SIOCGMIIPHY: /* Get the address of the PHY in use. */
29773 data[0] = 0; /* we have only this address */
29774 /* fall trough */
29775- case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
29776+ case SIOCGMIIREG: /* Read the specified MII register. */
29777 data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
29778 break;
29779- case SIOCDEVPRIVATE+2: /* Write the specified MII register */
29780+ case SIOCSMIIREG: /* Write the specified MII register */
29781 if (!capable(CAP_NET_ADMIN))
29782 return -EPERM;
29783 mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
29784diff -Nru a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
29785--- a/drivers/net/pcnet32.c Tue Aug 19 20:53:16 2003
29786+++ b/drivers/net/pcnet32.c Sun Aug 31 16:14:08 2003
29787@@ -1726,6 +1726,7 @@
29788 /* An additional parameter that may be passed in... */
29789 static int debug = -1;
29790 static int tx_start_pt = -1;
29791+static int pcnet32_have_pci;
29792
29793 static int __init pcnet32_init_module(void)
29794 {
29795@@ -1738,7 +1739,8 @@
29796 tx_start = tx_start_pt;
29797
29798 /* find the PCI devices */
29799- pci_module_init(&pcnet32_driver);
29800+ if (!pci_module_init(&pcnet32_driver))
29801+ pcnet32_have_pci = 1;
29802
29803 /* should we find any remaining VLbus devices ? */
29804 if (pcnet32vlb)
29805@@ -1747,7 +1749,7 @@
29806 if (cards_found)
29807 printk(KERN_INFO PFX "%d cards_found.\n", cards_found);
29808
29809- return cards_found ? 0 : -ENODEV;
29810+ return (pcnet32_have_pci + cards_found) ? 0 : -ENODEV;
29811 }
29812
29813 static void __exit pcnet32_cleanup_module(void)
29814@@ -1765,6 +1767,9 @@
29815 free_netdev(pcnet32_dev);
29816 pcnet32_dev = next_dev;
29817 }
29818+
29819+ if (pcnet32_have_pci)
29820+ pci_unregister_driver(&pcnet32_driver);
29821 }
29822
29823 module_init(pcnet32_init_module);
29824diff -Nru a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
29825--- a/drivers/net/seeq8005.c Thu Aug 21 00:05:02 2003
29826+++ b/drivers/net/seeq8005.c Sun Aug 31 06:34:16 2003
29827@@ -378,7 +378,7 @@
29828 {
29829 struct net_local *lp = (struct net_local *)dev->priv;
29830 short length = skb->len;
29831- unsigned char *buf = skb->data;
29832+ unsigned char *buf;
29833
29834 if (length < ETH_ZLEN) {
29835 skb = skb_padto(skb, ETH_ZLEN);
29836@@ -386,6 +386,8 @@
29837 return 0;
29838 length = ETH_ZLEN;
29839 }
29840+ buf = skb->data;
29841+
29842 /* Block a timer-based transmit from overlapping */
29843 netif_stop_queue(dev);
29844
29845diff -Nru a/drivers/net/sis190.c b/drivers/net/sis190.c
29846--- a/drivers/net/sis190.c Tue Aug 19 20:53:16 2003
29847+++ b/drivers/net/sis190.c Sun Aug 31 14:10:18 2003
29848@@ -76,6 +76,8 @@
29849
29850 #define NUM_TX_DESC 64 /* Number of Tx descriptor registers */
29851 #define NUM_RX_DESC 64 /* Number of Rx descriptor registers */
29852+#define TX_DESC_TOTAL_SIZE (NUM_TX_DESC * sizeof (struct TxDesc))
29853+#define RX_DESC_TOTAL_SIZE (NUM_RX_DESC * sizeof (struct RxDesc))
29854 #define RX_BUF_SIZE 1536 /* Rx Buffer size */
29855
29856 #define SiS190_MIN_IO_SIZE 0x80
29857@@ -311,12 +313,8 @@
29858 unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
29859 unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
29860 unsigned long dirty_tx;
29861- void *tx_desc_raw; /* Tx descriptor buffer */
29862- dma_addr_t tx_dma_raw;
29863- dma_addr_t tx_dma_aligned;
29864- void *rx_desc_raw; /* Rx descriptor buffer */
29865- dma_addr_t rx_dma_raw;
29866- dma_addr_t rx_dma_aligned;
29867+ dma_addr_t tx_dma;
29868+ dma_addr_t rx_dma;
29869 struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
29870 struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
29871 unsigned char *RxBufferRings; /* Index of Rx Buffer */
29872@@ -470,6 +468,10 @@
29873 if (rc)
29874 goto err_out;
29875
29876+ rc = pci_set_dma_mask(pdev, 0xffffffffULL);
29877+ if (rc)
29878+ goto err_out;
29879+
29880 mmio_start = pci_resource_start(pdev, 0);
29881 mmio_end = pci_resource_end(pdev, 0);
29882 mmio_flags = pci_resource_flags(pdev, 0);
29883@@ -521,7 +523,6 @@
29884
29885 err_out:
29886 pci_disable_device(pdev);
29887- unregister_netdev(dev);
29888 kfree(dev);
29889 return rc;
29890 }
29891@@ -536,6 +537,7 @@
29892 static int printed_version = 0;
29893 int i, rc;
29894 u16 reg31;
29895+ int val;
29896
29897 assert(pdev != NULL);
29898 assert(ent != NULL);
29899@@ -620,7 +622,7 @@
29900 dev->dev_addr[2], dev->dev_addr[3],
29901 dev->dev_addr[4], dev->dev_addr[5], dev->irq);
29902
29903- int val = smdio_read(ioaddr, PHY_AUTO_NEGO_REG);
29904+ val = smdio_read(ioaddr, PHY_AUTO_NEGO_REG);
29905
29906 printk(KERN_INFO "%s: Auto-negotiation Enabled.\n", dev->name);
29907
29908@@ -714,54 +716,50 @@
29909 SiS190_open(struct net_device *dev)
29910 {
29911 struct sis190_private *tp = dev->priv;
29912- int retval;
29913- u8 diff;
29914 int rc;
29915
29916- retval =
29917- request_irq(dev->irq, SiS190_interrupt, SA_SHIRQ, dev->name, dev);
29918- if (retval) {
29919- return retval;
29920- }
29921+ rc = request_irq(dev->irq, SiS190_interrupt, SA_SHIRQ, dev->name, dev);
29922+ if (rc)
29923+ goto out;
29924
29925- tp->tx_desc_raw = pci_alloc_consistent(tp->pci_dev,
29926- (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
29927- &tp->tx_dma_raw);
29928- if (!tp->tx_desc_raw) {
29929+ /*
29930+ * Rx and Tx descriptors need 256 bytes alignment.
29931+ * pci_alloc_consistent() guarantees a stronger alignment.
29932+ */
29933+ tp->TxDescArray = pci_alloc_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE,
29934+ &tp->tx_dma);
29935+ if (!tp->TxDescArray) {
29936 rc = -ENOMEM;
29937 goto err_out;
29938 }
29939- // Tx Desscriptor needs 256 bytes alignment;
29940- diff = 256 - (tp->tx_dma_raw - ((tp->tx_dma_raw >> 8) << 8));
29941- tp->tx_dma_aligned = tp->tx_dma_raw + diff;
29942- tp->TxDescArray = (struct TxDesc *) (tp->tx_desc_raw + diff);
29943-
29944- tp->rx_desc_raw = pci_alloc_consistent(tp->pci_dev,
29945- (NUM_RX_DESC * sizeof (struct RxDesc)) + 256,
29946- &tp->rx_dma_raw);
29947- if (!tp->rx_desc_raw) {
29948+
29949+ tp->RxDescArray = pci_alloc_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE,
29950+ &tp->rx_dma);
29951+ if (!tp->RxDescArray) {
29952 rc = -ENOMEM;
29953 goto err_out_free_tx;
29954 }
29955- // Rx Desscriptor needs 256 bytes alignment;
29956- diff = 256 - (tp->rx_dma_raw - ((tp->rx_dma_raw >> 8) << 8));
29957- tp->rx_dma_aligned = tp->rx_dma_raw + diff;
29958- tp->RxDescArray = (struct RxDesc *) (tp->rx_desc_raw + diff);
29959
29960 tp->RxBufferRings = kmalloc(RX_BUF_SIZE * NUM_RX_DESC, GFP_KERNEL);
29961 if (tp->RxBufferRings == NULL) {
29962- printk(KERN_INFO "Allocate RxBufferRing failed\n");
29963+ printk(KERN_INFO "%s: allocate RxBufferRing failed\n",
29964+ dev->name);
29965+ rc = -ENOMEM;
29966+ goto err_out_free_rx;
29967 }
29968
29969 SiS190_init_ring(dev);
29970 SiS190_hw_start(dev);
29971
29972- return 0;
29973+out:
29974+ return rc;
29975
29976+err_out_free_rx:
29977+ pci_free_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE, tp->RxDescArray,
29978+ tp->rx_dma);
29979 err_out_free_tx:
29980- pci_free_consistent(tp->pci_dev,
29981- (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
29982- tp->tx_desc_raw, tp->tx_dma_raw);
29983+ pci_free_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE, tp->TxDescArray,
29984+ tp->tx_dma);
29985 err_out:
29986 free_irq(dev->irq, dev);
29987 return rc;
29988@@ -780,10 +778,10 @@
29989 SiS_W32(IntrControl, 0x0);
29990
29991 SiS_W32(0x0, 0x01a00);
29992- SiS_W32(0x4, tp->tx_dma_aligned);
29993+ SiS_W32(0x4, tp->tx_dma);
29994
29995 SiS_W32(0x10, 0x1a00);
29996- SiS_W32(0x14, tp->rx_dma_aligned);
29997+ SiS_W32(0x14, tp->rx_dma);
29998
29999 SiS_W32(0x20, 0xffffffff);
30000 SiS_W32(0x24, 0x0);
30001@@ -830,19 +828,19 @@
30002 tp->Tx_skbuff[i] = NULL;
30003 }
30004 for (i = 0; i < NUM_RX_DESC; i++) {
30005+ struct RxDesc *desc = tp->RxDescArray + i;
30006
30007- tp->RxDescArray[i].PSize = 0x0;
30008+ desc->PSize = 0x0;
30009
30010 if (i == (NUM_RX_DESC - 1))
30011- tp->RxDescArray[i].buf_Len = BIT_31 + RX_BUF_SIZE; //bit 31 is End bit
30012+ desc->buf_Len = BIT_31 + RX_BUF_SIZE; //bit 31 is End bit
30013 else
30014- tp->RxDescArray[i].buf_Len = RX_BUF_SIZE;
30015-
30016-#warning Replace virt_to_bus with DMA mapping
30017- tp->RxBufferRing[i] = &(tp->RxBufferRings[i * RX_BUF_SIZE]);
30018- tp->RxDescArray[i].buf_addr = virt_to_bus(tp->RxBufferRing[i]);
30019- tp->RxDescArray[i].status = OWNbit | INTbit;
30020+ desc->buf_Len = RX_BUF_SIZE;
30021
30022+ tp->RxBufferRing[i] = tp->RxBufferRings + i * RX_BUF_SIZE;
30023+ desc->buf_addr = pci_map_single(tp->pci_dev,
30024+ tp->RxBufferRing[i], RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
30025+ desc->status = OWNbit | INTbit;
30026 }
30027
30028 }
30029@@ -855,7 +853,14 @@
30030 tp->cur_tx = 0;
30031 for (i = 0; i < NUM_TX_DESC; i++) {
30032 if (tp->Tx_skbuff[i] != NULL) {
30033- dev_kfree_skb(tp->Tx_skbuff[i]);
30034+ struct sk_buff *skb;
30035+
30036+ skb = tp->Tx_skbuff[i];
30037+ pci_unmap_single(tp->pci_dev,
30038+ le32_to_cpu(tp->TxDescArray[i].buf_addr),
30039+ skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len,
30040+ PCI_DMA_TODEVICE);
30041+ dev_kfree_skb(skb);
30042 tp->Tx_skbuff[i] = NULL;
30043 tp->stats.tx_dropped++;
30044 }
30045@@ -894,46 +899,58 @@
30046 struct sis190_private *tp = dev->priv;
30047 void *ioaddr = tp->mmio_addr;
30048 int entry = tp->cur_tx % NUM_TX_DESC;
30049+ u32 len;
30050
30051- if (skb->len < ETH_ZLEN) {
30052+ if (unlikely(skb->len < ETH_ZLEN)) {
30053 skb = skb_padto(skb, ETH_ZLEN);
30054 if (skb == NULL)
30055- return 0;
30056+ goto drop_tx;
30057+ len = ETH_ZLEN;
30058+ } else {
30059+ len = skb->len;
30060 }
30061
30062 spin_lock_irq(&tp->lock);
30063
30064- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
30065-#warning Replace virt_to_bus with DMA mapping
30066+ if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) {
30067+ dma_addr_t mapping;
30068+
30069+ mapping = pci_map_single(tp->pci_dev, skb->data, len,
30070+ PCI_DMA_TODEVICE);
30071+
30072 tp->Tx_skbuff[entry] = skb;
30073- tp->TxDescArray[entry].buf_addr = virt_to_bus(skb->data);
30074- tp->TxDescArray[entry].PSize =
30075- ((skb->len > ETH_ZLEN) ? skb->len : ETH_ZLEN);
30076+ tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping);
30077+ tp->TxDescArray[entry].PSize = cpu_to_le32(len);
30078
30079- if (entry != (NUM_TX_DESC - 1)) {
30080- tp->TxDescArray[entry].buf_Len =
30081- tp->TxDescArray[entry].PSize;
30082- } else {
30083+ if (entry != (NUM_TX_DESC - 1))
30084+ tp->TxDescArray[entry].buf_Len = cpu_to_le32(len);
30085+ else
30086 tp->TxDescArray[entry].buf_Len =
30087- tp->TxDescArray[entry].PSize | ENDbit;
30088- }
30089+ cpu_to_le32(len | ENDbit);
30090
30091 tp->TxDescArray[entry].status |=
30092- (OWNbit | INTbit | DEFbit | CRCbit | PADbit);
30093+ cpu_to_le32(OWNbit | INTbit | DEFbit | CRCbit | PADbit);
30094
30095 SiS_W32(TxControl, 0x1a11); //Start Send
30096
30097 dev->trans_start = jiffies;
30098
30099 tp->cur_tx++;
30100+ } else {
30101+ spin_unlock_irq(&tp->lock);
30102+ goto drop_tx;
30103 }
30104
30105+ if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
30106+ netif_stop_queue(dev);
30107+
30108 spin_unlock_irq(&tp->lock);
30109
30110- if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) {
30111- netif_stop_queue(dev);
30112- }
30113+ return 0;
30114
30115+drop_tx:
30116+ tp->stats.tx_dropped++;
30117+ dev_kfree_skb(skb);
30118 return 0;
30119 }
30120
30121@@ -952,10 +969,18 @@
30122 tx_left = tp->cur_tx - dirty_tx;
30123
30124 while (tx_left > 0) {
30125- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
30126- dev_kfree_skb_irq(tp->
30127- Tx_skbuff[dirty_tx % NUM_TX_DESC]);
30128- tp->Tx_skbuff[dirty_tx % NUM_TX_DESC] = NULL;
30129+ if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) {
30130+ struct sk_buff *skb;
30131+
30132+ skb = tp->Tx_skbuff[entry];
30133+
30134+ pci_unmap_single(tp->pci_dev,
30135+ le32_to_cpu(tp->TxDescArray[entry].buf_addr),
30136+ skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len,
30137+ PCI_DMA_TODEVICE);
30138+
30139+ dev_kfree_skb_irq(skb);
30140+ tp->Tx_skbuff[entry] = NULL;
30141 tp->stats.tx_packets++;
30142 dirty_tx++;
30143 tx_left--;
30144@@ -965,8 +990,7 @@
30145
30146 if (tp->dirty_tx != dirty_tx) {
30147 tp->dirty_tx = dirty_tx;
30148- if (netif_queue_stopped(dev))
30149- netif_wake_queue(dev);
30150+ netif_wake_queue(dev);
30151 }
30152 }
30153
30154@@ -974,29 +998,30 @@
30155 SiS190_rx_interrupt(struct net_device *dev, struct sis190_private *tp,
30156 void *ioaddr)
30157 {
30158- int cur_rx;
30159- struct sk_buff *skb;
30160- int pkt_size = 0;
30161+ int cur_rx = tp->cur_rx;
30162+ struct RxDesc *desc = tp->RxDescArray + cur_rx;
30163
30164 assert(dev != NULL);
30165 assert(tp != NULL);
30166 assert(ioaddr != NULL);
30167
30168- cur_rx = tp->cur_rx;
30169- while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) {
30170+ while ((desc->status & OWNbit) == 0) {
30171
30172- if (tp->RxDescArray[cur_rx].PSize & 0x0080000) {
30173+ if (desc->PSize & 0x0080000) {
30174 printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
30175 tp->stats.rx_errors++;
30176 tp->stats.rx_length_errors++;
30177- } else if (!(tp->RxDescArray[cur_rx].PSize & 0x0010000)) {
30178+ } else if (!(desc->PSize & 0x0010000)) {
30179 printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
30180 tp->stats.rx_errors++;
30181 tp->stats.rx_crc_errors++;
30182 } else {
30183- pkt_size =
30184- (int) (tp->RxDescArray[cur_rx].
30185- PSize & 0x0000FFFF) - 4;
30186+ struct sk_buff *skb;
30187+ int pkt_size;
30188+
30189+ pkt_size = (int) (desc->PSize & 0x0000FFFF) - 4;
30190+ pci_dma_sync_single(tp->pci_dev, desc->buf_addr,
30191+ RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
30192 skb = dev_alloc_skb(pkt_size + 2);
30193 if (skb != NULL) {
30194 skb->dev = dev;
30195@@ -1007,24 +1032,18 @@
30196 skb->protocol = eth_type_trans(skb, dev);
30197 netif_rx(skb);
30198
30199- tp->RxDescArray[cur_rx].PSize = 0x0;
30200+ desc->PSize = 0x0;
30201
30202 if (cur_rx == (NUM_RX_DESC - 1))
30203- tp->RxDescArray[cur_rx].buf_Len =
30204- ENDbit + RX_BUF_SIZE;
30205+ desc->buf_Len = ENDbit + RX_BUF_SIZE;
30206 else
30207- tp->RxDescArray[cur_rx].buf_Len =
30208- RX_BUF_SIZE;
30209+ desc->buf_Len = RX_BUF_SIZE;
30210
30211-#warning Replace virt_to_bus with DMA mapping
30212- tp->RxDescArray[cur_rx].buf_addr =
30213- virt_to_bus(tp->RxBufferRing[cur_rx]);
30214 dev->last_rx = jiffies;
30215 tp->stats.rx_bytes += pkt_size;
30216 tp->stats.rx_packets++;
30217
30218- tp->RxDescArray[cur_rx].status =
30219- OWNbit | INTbit;
30220+ desc->status = OWNbit | INTbit;
30221 } else {
30222 printk(KERN_WARNING
30223 "%s: Memory squeeze, deferring packet.\n",
30224@@ -1036,7 +1055,7 @@
30225 }
30226
30227 cur_rx = (cur_rx + 1) % NUM_RX_DESC;
30228-
30229+ desc = tp->RxDescArray + cur_rx;
30230 }
30231
30232 tp->cur_rx = cur_rx;
30233@@ -1111,22 +1130,22 @@
30234
30235 spin_unlock_irq(&tp->lock);
30236
30237- synchronize_irq();
30238+ synchronize_irq(dev->irq);
30239 free_irq(dev->irq, dev);
30240
30241 SiS190_tx_clear(tp);
30242- pci_free_consistent(tp->pci_dev,
30243- (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
30244- tp->tx_desc_raw, tp->tx_dma_raw);
30245- pci_free_consistent(tp->pci_dev,
30246- (NUM_RX_DESC * sizeof (struct RxDesc)) + 256,
30247- tp->rx_desc_raw, tp->rx_dma_raw);
30248+ pci_free_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE, tp->TxDescArray,
30249+ tp->tx_dma);
30250+ pci_free_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE, tp->RxDescArray,
30251+ tp->rx_dma);
30252 tp->TxDescArray = NULL;
30253- tp->RxDescArray = NULL;
30254- kfree(tp->RxBufferRings);
30255 for (i = 0; i < NUM_RX_DESC; i++) {
30256+ pci_unmap_single(tp->pci_dev, tp->RxDescArray[i].buf_addr,
30257+ RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
30258 tp->RxBufferRing[i] = NULL;
30259 }
30260+ tp->RxDescArray = NULL;
30261+ kfree(tp->RxBufferRings);
30262
30263 return 0;
30264 }
30265diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
30266--- a/drivers/net/sis900.c Tue Aug 19 20:53:16 2003
30267+++ b/drivers/net/sis900.c Tue Aug 26 16:37:16 2003
30268@@ -169,6 +169,7 @@
30269 dma_addr_t rx_ring_dma;
30270
30271 unsigned int tx_full; /* The Tx queue is full. */
30272+ u8 host_bridge_rev;
30273 };
30274
30275 MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lho <ollie@sis.com.tw>");
30276@@ -210,6 +211,7 @@
30277 static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr);
30278 static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr);
30279 static void sis900_set_mode (long ioaddr, int speed, int duplex);
30280+static struct ethtool_ops sis900_ethtool_ops;
30281
30282 /**
30283 * sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
30284@@ -367,6 +369,7 @@
30285 {
30286 struct sis900_private *sis_priv;
30287 struct net_device *net_dev;
30288+ struct pci_dev *dev;
30289 dma_addr_t ring_dma;
30290 void *ring_space;
30291 long ioaddr;
30292@@ -440,6 +443,7 @@
30293 net_dev->do_ioctl = &mii_ioctl;
30294 net_dev->tx_timeout = sis900_tx_timeout;
30295 net_dev->watchdog_timeo = TX_TIMEOUT;
30296+ net_dev->ethtool_ops = &sis900_ethtool_ops;
30297
30298 ret = register_netdev(net_dev);
30299 if (ret)
30300@@ -473,6 +477,11 @@
30301 goto err_out_unregister;
30302 }
30303
30304+ /* save our host bridge revision */
30305+ dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);
30306+ if (dev)
30307+ pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);
30308+
30309 /* print some information about our NIC */
30310 printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,
30311 card_name, ioaddr, net_dev->irq);
30312@@ -1108,18 +1117,12 @@
30313 {
30314 struct sis900_private *sis_priv = net_dev->priv;
30315 u16 reg14h, eq_value=0, max_value=0, min_value=0;
30316- u8 host_bridge_rev;
30317 int i, maxcount=10;
30318- struct pci_dev *dev=NULL;
30319
30320 if ( !(revision == SIS630E_900_REV || revision == SIS630EA1_900_REV ||
30321 revision == SIS630A_900_REV || revision == SIS630ET_900_REV) )
30322 return;
30323
30324- dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, dev);
30325- if (dev)
30326- pci_read_config_byte(dev, PCI_CLASS_REVISION, &host_bridge_rev);
30327-
30328 if (netif_carrier_ok(net_dev)) {
30329 reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
30330 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (0x2200 | reg14h) & 0xBFFF);
30331@@ -1142,7 +1145,8 @@
30332 }
30333 /* 630B0&B1 rule to determine the equalizer value */
30334 if (revision == SIS630A_900_REV &&
30335- (host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1)) {
30336+ (sis_priv->host_bridge_rev == SIS630B0 ||
30337+ sis_priv->host_bridge_rev == SIS630B1)) {
30338 if (max_value == 0)
30339 eq_value=3;
30340 else
30341@@ -1157,7 +1161,8 @@
30342 else {
30343 reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
30344 if (revision == SIS630A_900_REV &&
30345- (host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1))
30346+ (sis_priv->host_bridge_rev == SIS630B0 ||
30347+ sis_priv->host_bridge_rev == SIS630B1))
30348 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2200) & 0xBFFF);
30349 else
30350 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2000) & 0xBFFF);
30351@@ -1853,39 +1858,27 @@
30352 }
30353
30354 /**
30355- * netdev_ethtool_ioctl - For the basic support of ethtool
30356- * @net_dev: the net device to command for
30357- * @useraddr: start address of interface request
30358+ * sis900_get_drvinfo - Return information about driver
30359+ * @net_dev: the net device to probe
30360+ * @info: container for info returned
30361 *
30362 * Process ethtool command such as "ehtool -i" to show information
30363 */
30364-
30365-static int netdev_ethtool_ioctl (struct net_device *net_dev, void *useraddr)
30366+
30367+static void sis900_get_drvinfo(struct net_device *net_dev,
30368+ struct ethtool_drvinfo *info)
30369 {
30370 struct sis900_private *sis_priv = net_dev->priv;
30371- u32 ethcmd;
30372
30373- if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd)))
30374- return -EFAULT;
30375-
30376- switch (ethcmd) {
30377- case ETHTOOL_GDRVINFO:
30378- {
30379- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
30380- strcpy (info.driver, SIS900_MODULE_NAME);
30381- strcpy (info.version, SIS900_DRV_VERSION);
30382- strcpy (info.bus_info, pci_name(sis_priv->pci_dev));
30383- if (copy_to_user (useraddr, &info, sizeof (info)))
30384- return -EFAULT;
30385- return 0;
30386- }
30387- default:
30388- break;
30389- }
30390-
30391- return -EOPNOTSUPP;
30392+ strcpy (info->driver, SIS900_MODULE_NAME);
30393+ strcpy (info->version, SIS900_DRV_VERSION);
30394+ strcpy (info->bus_info, pci_name(sis_priv->pci_dev));
30395 }
30396
30397+static struct ethtool_ops sis900_ethtool_ops = {
30398+ .get_drvinfo = sis900_get_drvinfo,
30399+};
30400+
30401 /**
30402 * mii_ioctl - process MII i/o control command
30403 * @net_dev: the net device to command for
30404@@ -1901,9 +1894,6 @@
30405 struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
30406
30407 switch(cmd) {
30408- case SIOCETHTOOL:
30409- return netdev_ethtool_ioctl(net_dev, (void *) rq->ifr_data);
30410-
30411 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
30412 data->phy_id = sis_priv->mii->phy_addr;
30413 /* Fall Through */
30414diff -Nru a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c
30415--- a/drivers/net/sk_mca.c Fri Jul 25 17:15:35 2003
30416+++ b/drivers/net/sk_mca.c Sun Aug 31 08:29:49 2003
30417@@ -124,7 +124,7 @@
30418 /* dump parts of shared memory - only needed during debugging */
30419
30420 #ifdef DEBUG
30421-static void dumpmem(struct SKMCA_NETDEV *dev, u32 start, u32 len)
30422+static void dumpmem(struct net_device *dev, u32 start, u32 len)
30423 {
30424 int z;
30425
30426@@ -217,7 +217,7 @@
30427
30428 /* reset the whole board */
30429
30430-static void ResetBoard(struct SKMCA_NETDEV *dev)
30431+static void ResetBoard(struct net_device *dev)
30432 {
30433 skmca_priv *priv = (skmca_priv *) dev->priv;
30434
30435@@ -228,7 +228,7 @@
30436
30437 /* wait for LANCE interface to become not busy */
30438
30439-static int WaitLANCE(struct SKMCA_NETDEV *dev)
30440+static int WaitLANCE(struct net_device *dev)
30441 {
30442 skmca_priv *priv = (skmca_priv *) dev->priv;
30443 int t = 0;
30444@@ -247,7 +247,7 @@
30445
30446 /* set LANCE register - must be atomic */
30447
30448-static void SetLANCE(struct SKMCA_NETDEV *dev, u16 addr, u16 value)
30449+static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
30450 {
30451 skmca_priv *priv = (skmca_priv *) dev->priv;
30452 unsigned long flags;
30453@@ -280,12 +280,12 @@
30454
30455 /* reenable interrupts */
30456
30457- spin_lock_irqrestore(&priv->lock, flags);
30458+ spin_unlock_irqrestore(&priv->lock, flags);
30459 }
30460
30461 /* get LANCE register */
30462
30463-static u16 GetLANCE(struct SKMCA_NETDEV *dev, u16 addr)
30464+static u16 GetLANCE(struct net_device *dev, u16 addr)
30465 {
30466 skmca_priv *priv = (skmca_priv *) dev->priv;
30467 unsigned long flags;
30468@@ -319,14 +319,14 @@
30469
30470 /* reenable interrupts */
30471
30472- spin_lock_irqrestore(&priv->lock, flags);
30473+ spin_unlock_irqrestore(&priv->lock, flags);
30474
30475 return res;
30476 }
30477
30478 /* build up descriptors in shared RAM */
30479
30480-static void InitDscrs(struct SKMCA_NETDEV *dev)
30481+static void InitDscrs(struct net_device *dev)
30482 {
30483 u32 bufaddr;
30484
30485@@ -422,7 +422,7 @@
30486
30487 /* feed ready-built initialization block into LANCE */
30488
30489-static void InitLANCE(struct SKMCA_NETDEV *dev)
30490+static void InitLANCE(struct net_device *dev)
30491 {
30492 skmca_priv *priv = (skmca_priv *) dev->priv;
30493
30494@@ -452,11 +452,7 @@
30495
30496 /* we don't get ready until the LANCE has read the init block */
30497
30498-#if (LINUX_VERSION_CODE >= 0x02032a)
30499 netif_stop_queue(dev);
30500-#else
30501- dev->tbusy = 1;
30502-#endif
30503
30504 /* let LANCE read the initialization block. LANCE is ready
30505 when we receive the corresponding interrupt. */
30506@@ -466,15 +462,11 @@
30507
30508 /* stop the LANCE so we can reinitialize it */
30509
30510-static void StopLANCE(struct SKMCA_NETDEV *dev)
30511+static void StopLANCE(struct net_device *dev)
30512 {
30513 /* can't take frames any more */
30514
30515-#if (LINUX_VERSION_CODE >= 0x02032a)
30516 netif_stop_queue(dev);
30517-#else
30518- dev->tbusy = 1;
30519-#endif
30520
30521 /* disable interrupts, stop it */
30522
30523@@ -483,7 +475,7 @@
30524
30525 /* initialize card and LANCE for proper operation */
30526
30527-static void InitBoard(struct SKMCA_NETDEV *dev)
30528+static void InitBoard(struct net_device *dev)
30529 {
30530 LANCE_InitBlock block;
30531
30532@@ -508,7 +500,7 @@
30533
30534 /* deinitialize card and LANCE */
30535
30536-static void DeinitBoard(struct SKMCA_NETDEV *dev)
30537+static void DeinitBoard(struct net_device *dev)
30538 {
30539 /* stop LANCE */
30540
30541@@ -521,7 +513,7 @@
30542
30543 /* probe for device's irq */
30544
30545-static int __init ProbeIRQ(struct SKMCA_NETDEV *dev)
30546+static int __init ProbeIRQ(struct net_device *dev)
30547 {
30548 unsigned long imaskval, njiffies, irq;
30549 u16 csr0val;
30550@@ -563,15 +555,11 @@
30551
30552 /* LANCE has read initialization block -> start it */
30553
30554-static u16 irqstart_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
30555+static u16 irqstart_handler(struct net_device *dev, u16 oldcsr0)
30556 {
30557 /* now we're ready to transmit */
30558
30559-#if (LINUX_VERSION_CODE >= 0x02032a)
30560 netif_wake_queue(dev);
30561-#else
30562- dev->tbusy = 0;
30563-#endif
30564
30565 /* reset IDON bit, start LANCE */
30566
30567@@ -581,7 +569,7 @@
30568
30569 /* did we lose blocks due to a FIFO overrun ? */
30570
30571-static u16 irqmiss_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
30572+static u16 irqmiss_handler(struct net_device *dev, u16 oldcsr0)
30573 {
30574 skmca_priv *priv = (skmca_priv *) dev->priv;
30575
30576@@ -597,7 +585,7 @@
30577
30578 /* receive interrupt */
30579
30580-static u16 irqrx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
30581+static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
30582 {
30583 skmca_priv *priv = (skmca_priv *) dev->priv;
30584 LANCE_RxDescr descr;
30585@@ -678,7 +666,7 @@
30586
30587 /* transmit interrupt */
30588
30589-static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
30590+static u16 irqtx_handler(struct net_device *dev, u16 oldcsr0)
30591 {
30592 skmca_priv *priv = (skmca_priv *) dev->priv;
30593 LANCE_TxDescr descr;
30594@@ -740,12 +728,7 @@
30595 a new one */
30596 /* inform upper layers we're in business again */
30597
30598-#if (LINUX_VERSION_CODE >= 0x02032a)
30599 netif_wake_queue(dev);
30600-#else
30601- dev->tbusy = 0;
30602- mark_bh(NET_BH);
30603-#endif
30604
30605 return oldcsr0;
30606 }
30607@@ -754,7 +737,7 @@
30608
30609 static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
30610 {
30611- struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) device;
30612+ struct net_device *dev = (struct net_device *) device;
30613 u16 csr0val;
30614
30615 /* read CSR0 to get interrupt cause */
30616@@ -766,13 +749,9 @@
30617 if ((csr0val & CSR0_INTR) == 0)
30618 return IRQ_NONE;
30619
30620-#if (LINUX_VERSION_CODE >= 0x02032a)
30621 #if 0
30622 set_bit(LINK_STATE_RXSEM, &dev->state);
30623 #endif
30624-#else
30625- dev->interrupt = 1;
30626-#endif
30627
30628 /* loop through the interrupt bits until everything is clear */
30629
30630@@ -796,13 +775,9 @@
30631 }
30632 while ((csr0val & CSR0_INTR) != 0);
30633
30634-#if (LINUX_VERSION_CODE >= 0x02032a)
30635 #if 0
30636 clear_bit(LINK_STATE_RXSEM, &dev->state);
30637 #endif
30638-#else
30639- dev->interrupt = 0;
30640-#endif
30641 return IRQ_HANDLED;
30642 }
30643
30644@@ -815,7 +790,7 @@
30645 static int skmca_getinfo(char *buf, int slot, void *d)
30646 {
30647 int len = 0, i;
30648- struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) d;
30649+ struct net_device *dev = (struct net_device *) d;
30650 skmca_priv *priv;
30651
30652 /* can't say anything about an uninitialized device... */
30653@@ -846,7 +821,7 @@
30654
30655 /* open driver. Means also initialization and start of LANCE */
30656
30657-static int skmca_open(struct SKMCA_NETDEV *dev)
30658+static int skmca_open(struct net_device *dev)
30659 {
30660 int result;
30661 skmca_priv *priv = (skmca_priv *) dev->priv;
30662@@ -868,21 +843,14 @@
30663
30664 /* set up flags */
30665
30666-#if (LINUX_VERSION_CODE >= 0x02032a)
30667 netif_start_queue(dev);
30668-#else
30669- dev->interrupt = 0;
30670- dev->tbusy = 0;
30671- dev->start = 0;
30672- MOD_INC_USE_COUNT;
30673-#endif
30674
30675 return 0;
30676 }
30677
30678 /* close driver. Shut down board and free allocated resources */
30679
30680-static int skmca_close(struct SKMCA_NETDEV *dev)
30681+static int skmca_close(struct net_device *dev)
30682 {
30683 /* turn off board */
30684 DeinitBoard(dev);
30685@@ -892,16 +860,12 @@
30686 free_irq(dev->irq, dev);
30687 dev->irq = 0;
30688
30689-#if (LINUX_VERSION_CODE < 0x02032a)
30690- MOD_DEC_USE_COUNT;
30691-#endif
30692-
30693 return 0;
30694 }
30695
30696 /* transmit a block. */
30697
30698-static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev)
30699+static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
30700 {
30701 skmca_priv *priv = (skmca_priv *) dev->priv;
30702 LANCE_TxDescr descr;
30703@@ -977,11 +941,7 @@
30704 /* are we saturated ? */
30705
30706 if (priv->txbusy >= TXCOUNT)
30707-#if (LINUX_VERSION_CODE >= 0x02032a)
30708 netif_stop_queue(dev);
30709-#else
30710- dev->tbusy = 1;
30711-#endif
30712
30713 /* write descriptor back to RAM */
30714 SKMCA_TOIO(dev->mem_start + address, &descr,
30715@@ -993,7 +953,7 @@
30716 if (priv->txbusy == 0)
30717 SetLANCE(dev, LANCE_CSR0, CSR0_INEA | CSR0_TDMD);
30718
30719- spin_lock_irqrestore(&priv->lock, flags);
30720+ spin_unlock_irqrestore(&priv->lock, flags);
30721
30722 tx_done:
30723
30724@@ -1004,7 +964,7 @@
30725
30726 /* return pointer to Ethernet statistics */
30727
30728-static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev)
30729+static struct net_device_stats *skmca_stats(struct net_device *dev)
30730 {
30731 skmca_priv *priv = (skmca_priv *) dev->priv;
30732
30733@@ -1014,7 +974,7 @@
30734 /* we don't support runtime reconfiguration, since an MCA card can
30735 be unambigously identified by its POS registers. */
30736
30737-static int skmca_config(struct SKMCA_NETDEV *dev, struct ifmap *map)
30738+static int skmca_config(struct net_device *dev, struct ifmap *map)
30739 {
30740 return 0;
30741 }
30742@@ -1022,7 +982,7 @@
30743 /* switch receiver mode. We use the LANCE's multicast filter to prefilter
30744 multicast addresses. */
30745
30746-static void skmca_set_multicast_list(struct SKMCA_NETDEV *dev)
30747+static void skmca_set_multicast_list(struct net_device *dev)
30748 {
30749 LANCE_InitBlock block;
30750
30751@@ -1062,7 +1022,7 @@
30752
30753 static int startslot; /* counts through slots when probing multiple devices */
30754
30755-int __init skmca_probe(struct SKMCA_NETDEV *dev)
30756+int __init skmca_probe(struct net_device *dev)
30757 {
30758 int force_detect = 0;
30759 int junior, slot, i;
30760@@ -1095,14 +1055,12 @@
30761
30762 getaddrs(slot, junior, &base, &irq, &medium);
30763
30764-#if LINUX_VERSION_CODE >= 0x020300
30765 /* slot already in use ? */
30766
30767 if (mca_is_adapter_used(slot)) {
30768 slot = dofind(&junior, slot + 1);
30769 continue;
30770 }
30771-#endif
30772
30773 /* were we looking for something different ? */
30774
30775@@ -1221,24 +1179,13 @@
30776
30777 #define DEVMAX 5
30778
30779-#if (LINUX_VERSION_CODE >= 0x020369)
30780-static struct SKMCA_NETDEV moddevs[DEVMAX] =
30781- { {" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30782-{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30783-{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30784-{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30785-{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
30786-};
30787-#else
30788-static char NameSpace[8 * DEVMAX];
30789-static struct SKMCA_NETDEV moddevs[DEVMAX] =
30790- { {NameSpace + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30791-{NameSpace + 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30792-{NameSpace + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30793-{NameSpace + 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
30794-{NameSpace + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
30795+static struct net_device moddevs[DEVMAX] = {
30796+ { .name = " ", .init = skmca_probe },
30797+ { .name = " ", .init = skmca_probe },
30798+ { .name = " ", .init = skmca_probe },
30799+ { .name = " ", .init = skmca_probe },
30800+ { .name = " ", .init = skmca_probe }
30801 };
30802-#endif
30803
30804 int irq;
30805 int io;
30806@@ -1260,7 +1207,7 @@
30807
30808 void cleanup_module(void)
30809 {
30810- struct SKMCA_NETDEV *dev;
30811+ struct net_device *dev;
30812 skmca_priv *priv;
30813 int z;
30814
30815diff -Nru a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h
30816--- a/drivers/net/sk_mca.h Tue Jul 15 08:10:44 2003
30817+++ b/drivers/net/sk_mca.h Sun Aug 31 08:29:49 2003
30818@@ -5,7 +5,6 @@
30819
30820 /* version-dependent functions/structures */
30821
30822-#if LINUX_VERSION_CODE >= 0x020318
30823 #define SKMCA_READB(addr) isa_readb(addr)
30824 #define SKMCA_READW(addr) isa_readw(addr)
30825 #define SKMCA_WRITEB(data, addr) isa_writeb(data, addr)
30826@@ -13,17 +12,6 @@
30827 #define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len)
30828 #define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len)
30829 #define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len)
30830-#define SKMCA_NETDEV net_device
30831-#else
30832-#define SKMCA_READB(addr) readb(addr)
30833-#define SKMCA_READW(addr) readw(addr)
30834-#define SKMCA_WRITEB(data, addr) writeb(data, addr)
30835-#define SKMCA_WRITEW(data, addr) writew(data, addr)
30836-#define SKMCA_TOIO(dest, src, len) memcpy_toio(dest, src, len)
30837-#define SKMCA_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
30838-#define SKMCA_SETIO(dest, val, len) memset_io(dest, val, len)
30839-#define SKMCA_NETDEV device
30840-#endif
30841
30842 /* Adapter ID's */
30843 #define SKNET_MCA_ID 0x6afd
30844@@ -188,7 +176,7 @@
30845
30846 #endif /* _SK_MCA_DRIVER_ */
30847
30848-extern int skmca_probe(struct SKMCA_NETDEV *);
30849+extern int skmca_probe(struct net_device *);
30850
30851
30852 #endif /* _SK_MCA_INCLUDE_ */
30853diff -Nru a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
30854--- a/drivers/net/sungem_phy.c Mon May 19 23:38:25 2003
30855+++ b/drivers/net/sungem_phy.c Sun Aug 31 16:14:08 2003
30856@@ -634,116 +634,116 @@
30857
30858 /* Broadcom BCM 5201 */
30859 static struct mii_phy_ops bcm5201_phy_ops = {
30860- init: bcm5201_init,
30861- suspend: bcm5201_suspend,
30862- setup_aneg: genmii_setup_aneg,
30863- setup_forced: genmii_setup_forced,
30864- poll_link: genmii_poll_link,
30865- read_link: genmii_read_link,
30866+ .init = bcm5201_init,
30867+ .suspend = bcm5201_suspend,
30868+ .setup_aneg = genmii_setup_aneg,
30869+ .setup_forced = genmii_setup_forced,
30870+ .poll_link = genmii_poll_link,
30871+ .read_link = genmii_read_link,
30872 };
30873
30874 static struct mii_phy_def bcm5201_phy_def = {
30875- phy_id: 0x00406210,
30876- phy_id_mask: 0xfffffff0,
30877- name: "BCM5201",
30878- features: MII_BASIC_FEATURES,
30879- magic_aneg: 0,
30880- ops: &bcm5201_phy_ops
30881+ .phy_id = 0x00406210,
30882+ .phy_id_mask = 0xfffffff0,
30883+ .name = "BCM5201",
30884+ .features = MII_BASIC_FEATURES,
30885+ .magic_aneg = 0,
30886+ .ops = &bcm5201_phy_ops
30887 };
30888
30889 /* Broadcom BCM 5221 */
30890 static struct mii_phy_ops bcm5221_phy_ops = {
30891- suspend: bcm5201_suspend,
30892- init: bcm5221_init,
30893- setup_aneg: genmii_setup_aneg,
30894- setup_forced: genmii_setup_forced,
30895- poll_link: genmii_poll_link,
30896- read_link: genmii_read_link,
30897+ .suspend = bcm5201_suspend,
30898+ .init = bcm5221_init,
30899+ .setup_aneg = genmii_setup_aneg,
30900+ .setup_forced = genmii_setup_forced,
30901+ .poll_link = genmii_poll_link,
30902+ .read_link = genmii_read_link,
30903 };
30904
30905 static struct mii_phy_def bcm5221_phy_def = {
30906- phy_id: 0x004061e0,
30907- phy_id_mask: 0xfffffff0,
30908- name: "BCM5221",
30909- features: MII_BASIC_FEATURES,
30910- magic_aneg: 0,
30911- ops: &bcm5221_phy_ops
30912+ .phy_id = 0x004061e0,
30913+ .phy_id_mask = 0xfffffff0,
30914+ .name = "BCM5221",
30915+ .features = MII_BASIC_FEATURES,
30916+ .magic_aneg = 0,
30917+ .ops = &bcm5221_phy_ops
30918 };
30919
30920 /* Broadcom BCM 5400 */
30921 static struct mii_phy_ops bcm5400_phy_ops = {
30922- init: bcm5400_init,
30923- suspend: bcm5400_suspend,
30924- setup_aneg: bcm54xx_setup_aneg,
30925- setup_forced: bcm54xx_setup_forced,
30926- poll_link: genmii_poll_link,
30927- read_link: bcm54xx_read_link,
30928+ .init = bcm5400_init,
30929+ .suspend = bcm5400_suspend,
30930+ .setup_aneg = bcm54xx_setup_aneg,
30931+ .setup_forced = bcm54xx_setup_forced,
30932+ .poll_link = genmii_poll_link,
30933+ .read_link = bcm54xx_read_link,
30934 };
30935
30936 static struct mii_phy_def bcm5400_phy_def = {
30937- phy_id: 0x00206040,
30938- phy_id_mask: 0xfffffff0,
30939- name: "BCM5400",
30940- features: MII_GBIT_FEATURES,
30941- magic_aneg: 1,
30942- ops: &bcm5400_phy_ops
30943+ .phy_id = 0x00206040,
30944+ .phy_id_mask = 0xfffffff0,
30945+ .name = "BCM5400",
30946+ .features = MII_GBIT_FEATURES,
30947+ .magic_aneg = 1,
30948+ .ops = &bcm5400_phy_ops
30949 };
30950
30951 /* Broadcom BCM 5401 */
30952 static struct mii_phy_ops bcm5401_phy_ops = {
30953- init: bcm5401_init,
30954- suspend: bcm5401_suspend,
30955- setup_aneg: bcm54xx_setup_aneg,
30956- setup_forced: bcm54xx_setup_forced,
30957- poll_link: genmii_poll_link,
30958- read_link: bcm54xx_read_link,
30959+ .init = bcm5401_init,
30960+ .suspend = bcm5401_suspend,
30961+ .setup_aneg = bcm54xx_setup_aneg,
30962+ .setup_forced = bcm54xx_setup_forced,
30963+ .poll_link = genmii_poll_link,
30964+ .read_link = bcm54xx_read_link,
30965 };
30966
30967 static struct mii_phy_def bcm5401_phy_def = {
30968- phy_id: 0x00206050,
30969- phy_id_mask: 0xfffffff0,
30970- name: "BCM5401",
30971- features: MII_GBIT_FEATURES,
30972- magic_aneg: 1,
30973- ops: &bcm5401_phy_ops
30974+ .phy_id = 0x00206050,
30975+ .phy_id_mask = 0xfffffff0,
30976+ .name = "BCM5401",
30977+ .features = MII_GBIT_FEATURES,
30978+ .magic_aneg = 1,
30979+ .ops = &bcm5401_phy_ops
30980 };
30981
30982 /* Broadcom BCM 5411 */
30983 static struct mii_phy_ops bcm5411_phy_ops = {
30984- init: bcm5411_init,
30985- suspend: bcm5411_suspend,
30986- setup_aneg: bcm54xx_setup_aneg,
30987- setup_forced: bcm54xx_setup_forced,
30988- poll_link: genmii_poll_link,
30989- read_link: bcm54xx_read_link,
30990+ .init = bcm5411_init,
30991+ .suspend = bcm5411_suspend,
30992+ .setup_aneg = bcm54xx_setup_aneg,
30993+ .setup_forced = bcm54xx_setup_forced,
30994+ .poll_link = genmii_poll_link,
30995+ .read_link = bcm54xx_read_link,
30996 };
30997
30998 static struct mii_phy_def bcm5411_phy_def = {
30999- phy_id: 0x00206070,
31000- phy_id_mask: 0xfffffff0,
31001- name: "BCM5411",
31002- features: MII_GBIT_FEATURES,
31003- magic_aneg: 1,
31004- ops: &bcm5411_phy_ops
31005+ .phy_id = 0x00206070,
31006+ .phy_id_mask = 0xfffffff0,
31007+ .name = "BCM5411",
31008+ .features = MII_GBIT_FEATURES,
31009+ .magic_aneg = 1,
31010+ .ops = &bcm5411_phy_ops
31011 };
31012
31013 /* Broadcom BCM 5421 */
31014 static struct mii_phy_ops bcm5421_phy_ops = {
31015- init: bcm5421_init,
31016- suspend: bcm5411_suspend,
31017- setup_aneg: bcm54xx_setup_aneg,
31018- setup_forced: bcm54xx_setup_forced,
31019- poll_link: genmii_poll_link,
31020- read_link: bcm54xx_read_link,
31021+ .init = bcm5421_init,
31022+ .suspend = bcm5411_suspend,
31023+ .setup_aneg = bcm54xx_setup_aneg,
31024+ .setup_forced = bcm54xx_setup_forced,
31025+ .poll_link = genmii_poll_link,
31026+ .read_link = bcm54xx_read_link,
31027 };
31028
31029 static struct mii_phy_def bcm5421_phy_def = {
31030- phy_id: 0x002060e0,
31031- phy_id_mask: 0xfffffff0,
31032- name: "BCM5421",
31033- features: MII_GBIT_FEATURES,
31034- magic_aneg: 1,
31035- ops: &bcm5421_phy_ops
31036+ .phy_id = 0x002060e0,
31037+ .phy_id_mask = 0xfffffff0,
31038+ .name = "BCM5421",
31039+ .features = MII_GBIT_FEATURES,
31040+ .magic_aneg = 1,
31041+ .ops = &bcm5421_phy_ops
31042 };
31043
31044 /* Marvell 88E1101 (Apple seem to deal with 2 different revs,
31045@@ -751,36 +751,36 @@
31046 * would be useful here) --BenH.
31047 */
31048 static struct mii_phy_ops marvell_phy_ops = {
31049- setup_aneg: marvell_setup_aneg,
31050- setup_forced: marvell_setup_forced,
31051- poll_link: genmii_poll_link,
31052- read_link: marvell_read_link
31053+ .setup_aneg = marvell_setup_aneg,
31054+ .setup_forced = marvell_setup_forced,
31055+ .poll_link = genmii_poll_link,
31056+ .read_link = marvell_read_link
31057 };
31058
31059 static struct mii_phy_def marvell_phy_def = {
31060- phy_id: 0x01410c00,
31061- phy_id_mask: 0xffffff00,
31062- name: "Marvell 88E1101",
31063- features: MII_GBIT_FEATURES,
31064- magic_aneg: 1,
31065- ops: &marvell_phy_ops
31066+ .phy_id = 0x01410c00,
31067+ .phy_id_mask = 0xffffff00,
31068+ .name = "Marvell 88E1101",
31069+ .features = MII_GBIT_FEATURES,
31070+ .magic_aneg = 1,
31071+ .ops = &marvell_phy_ops
31072 };
31073
31074 /* Generic implementation for most 10/100 PHYs */
31075 static struct mii_phy_ops generic_phy_ops = {
31076- setup_aneg: genmii_setup_aneg,
31077- setup_forced: genmii_setup_forced,
31078- poll_link: genmii_poll_link,
31079- read_link: genmii_read_link
31080+ .setup_aneg = genmii_setup_aneg,
31081+ .setup_forced = genmii_setup_forced,
31082+ .poll_link = genmii_poll_link,
31083+ .read_link = genmii_read_link
31084 };
31085
31086 static struct mii_phy_def genmii_phy_def = {
31087- phy_id: 0x00000000,
31088- phy_id_mask: 0x00000000,
31089- name: "Generic MII",
31090- features: MII_BASIC_FEATURES,
31091- magic_aneg: 0,
31092- ops: &generic_phy_ops
31093+ .phy_id = 0x00000000,
31094+ .phy_id_mask = 0x00000000,
31095+ .name = "Generic MII",
31096+ .features = MII_BASIC_FEATURES,
31097+ .magic_aneg = 0,
31098+ .ops = &generic_phy_ops
31099 };
31100
31101 static struct mii_phy_def* mii_phy_table[] = {
31102diff -Nru a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
31103--- a/drivers/net/tulip/dmfe.c Tue Aug 19 20:53:17 2003
31104+++ b/drivers/net/tulip/dmfe.c Tue Aug 26 13:42:22 2003
31105@@ -296,7 +296,7 @@
31106 static int dmfe_stop(struct DEVICE *);
31107 static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
31108 static void dmfe_set_filter_mode(struct DEVICE *);
31109-static int dmfe_do_ioctl(struct DEVICE *, struct ifreq *, int);
31110+static struct ethtool_ops netdev_ethtool_ops;
31111 static u16 read_srom_word(long ,int);
31112 static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
31113 static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
31114@@ -417,7 +417,7 @@
31115 dev->stop = &dmfe_stop;
31116 dev->get_stats = &dmfe_get_stats;
31117 dev->set_multicast_list = &dmfe_set_filter_mode;
31118- dev->do_ioctl = &dmfe_do_ioctl;
31119+ dev->ethtool_ops = &netdev_ethtool_ops;
31120 spin_lock_init(&db->lock);
31121
31122 pci_read_config_dword(pdev, 0x50, &pci_pmr);
31123@@ -1000,55 +1000,23 @@
31124 spin_unlock_irqrestore(&db->lock, flags);
31125 }
31126
31127-
31128-/*
31129- * Process the ethtool ioctl command
31130- */
31131-
31132-static int dmfe_ethtool_ioctl(struct net_device *dev, void *useraddr)
31133+static void netdev_get_drvinfo(struct net_device *dev,
31134+ struct ethtool_drvinfo *info)
31135 {
31136- struct dmfe_board_info *db = dev->priv;
31137- struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
31138- u32 ethcmd;
31139-
31140- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
31141- return -EFAULT;
31142-
31143- switch (ethcmd) {
31144- case ETHTOOL_GDRVINFO:
31145- strcpy(info.driver, DRV_NAME);
31146- strcpy(info.version, DRV_VERSION);
31147- if (db->pdev)
31148- strcpy(info.bus_info, pci_name(db->pdev));
31149- else
31150- sprintf(info.bus_info, "EISA 0x%lx %d",
31151- dev->base_addr, dev->irq);
31152- if (copy_to_user(useraddr, &info, sizeof(info)))
31153- return -EFAULT;
31154- return 0;
31155- }
31156-
31157- return -EOPNOTSUPP;
31158-}
31159+ struct dmfe_board_info *np = dev->priv;
31160
31161-
31162-/*
31163- * Process the upper socket ioctl command
31164- */
31165-
31166-static int dmfe_do_ioctl(struct DEVICE *dev, struct ifreq *ifr, int cmd)
31167-{
31168- int retval = -EOPNOTSUPP;
31169- DMFE_DBUG(0, "dmfe_do_ioctl()", 0);
31170-
31171- switch(cmd) {
31172- case SIOCETHTOOL:
31173- return dmfe_ethtool_ioctl(dev, (void*)ifr->ifr_data);
31174- }
31175-
31176- return retval;
31177+ strcpy(info->driver, DRV_NAME);
31178+ strcpy(info->version, DRV_VERSION);
31179+ if (np->pdev)
31180+ strcpy(info->bus_info, pci_name(np->pdev));
31181+ else
31182+ sprintf(info->bus_info, "EISA 0x%lx %d",
31183+ dev->base_addr, dev->irq);
31184 }
31185
31186+static struct ethtool_ops netdev_ethtool_ops = {
31187+ .get_drvinfo = netdev_get_drvinfo,
31188+};
31189
31190 /*
31191 * A periodic timer routine
31192diff -Nru a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
31193--- a/drivers/net/tulip/xircom_cb.c Tue Aug 19 20:53:17 2003
31194+++ b/drivers/net/tulip/xircom_cb.c Tue Aug 26 14:52:05 2003
31195@@ -175,37 +175,19 @@
31196 }
31197 #endif
31198
31199-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
31200+static void netdev_get_drvinfo(struct net_device *dev,
31201+ struct ethtool_drvinfo *info)
31202 {
31203- u32 ethcmd;
31204-
31205- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
31206- return -EFAULT;
31207-
31208- switch (ethcmd) {
31209- case ETHTOOL_GDRVINFO: {
31210- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
31211- strncpy(info.driver, "xircom_cb", sizeof(info.driver)-1);
31212- if (copy_to_user(useraddr, &info, sizeof(info)))
31213- return -EFAULT;
31214- return 0;
31215- }
31216- }
31217-
31218- return -EOPNOTSUPP;
31219-}
31220+ struct xircom_private *private = dev->priv;
31221
31222-static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
31223-{
31224-
31225- switch(cmd) {
31226- case SIOCETHTOOL:
31227- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
31228- default:
31229- return -EOPNOTSUPP;
31230- }
31231+ strcpy(info->driver, "xircom_cb");
31232+ strcpy(info->bus_info, pci_name(private->pdev));
31233 }
31234
31235+static struct ethtool_ops netdev_ethtool_ops = {
31236+ .get_drvinfo = netdev_get_drvinfo,
31237+};
31238+
31239 /* xircom_probe is the code that gets called on device insertion.
31240 it sets up the hardware and registers the device to the networklayer.
31241
31242@@ -287,7 +269,7 @@
31243 dev->stop = &xircom_close;
31244 dev->get_stats = &xircom_get_stats;
31245 dev->priv = private;
31246- dev->do_ioctl = &private_ioctl;
31247+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
31248 pci_set_drvdata(pdev, dev);
31249
31250
31251diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
31252--- a/drivers/net/wan/cosa.c Tue Aug 19 21:00:03 2003
31253+++ b/drivers/net/wan/cosa.c Fri Aug 29 22:32:28 2003
31254@@ -632,7 +632,7 @@
31255 {
31256 sppp_detach(chan->pppdev.dev);
31257 unregister_netdev(chan->pppdev.dev);
31258- free_netdev(chan->ppp.dev);
31259+ free_netdev(chan->pppdev.dev);
31260 }
31261
31262 static int cosa_sppp_open(struct net_device *d)
31263@@ -961,12 +961,12 @@
31264 unsigned long flags;
31265 int n;
31266
31267- if ((n=minor(file->f_dentry->d_inode->i_rdev)>>CARD_MINOR_BITS)
31268+ if ((n=iminor(file->f_dentry->d_inode)>>CARD_MINOR_BITS)
31269 >= nr_cards)
31270 return -ENODEV;
31271 cosa = cosa_cards+n;
31272
31273- if ((n=minor(file->f_dentry->d_inode->i_rdev)
31274+ if ((n=iminor(file->f_dentry->d_inode)
31275 & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels)
31276 return -ENODEV;
31277 chan = cosa->chan + n;
31278@@ -1009,7 +1009,7 @@
31279 /* To be done ... */
31280 static int cosa_fasync(struct inode *inode, struct file *file, int on)
31281 {
31282- int port = MINOR(inode->i_rdev);
31283+ int port = iminor(inode);
31284 int rv = fasync_helper(inode, file, on, &fasync[port]);
31285 return rv < 0 ? rv : 0;
31286 }
31287diff -Nru a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
31288--- a/drivers/net/wan/cycx_drv.c Tue Jul 15 10:01:29 2003
31289+++ b/drivers/net/wan/cycx_drv.c Sat Aug 23 20:42:31 2003
31290@@ -70,12 +70,12 @@
31291 static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len);
31292 static void cycx_bootcfg(struct cycx_hw *hw);
31293
31294-static int reset_cyc2x(u32 addr);
31295-static int detect_cyc2x(u32 addr);
31296+static int reset_cyc2x(void *addr);
31297+static int detect_cyc2x(void *addr);
31298
31299 /* Miscellaneous functions */
31300 static void delay_cycx(int sec);
31301-static int get_option_index(u32 *optlist, u32 optval);
31302+static int get_option_index(long *optlist, long optval);
31303 static u16 checksum(u8 *buf, u32 len);
31304
31305 #define wait_cyc(addr) cycx_exec(addr + CMD_OFFSET)
31306@@ -92,14 +92,14 @@
31307 * These are arrays of configuration options used by verification routines.
31308 * The first element of each array is its size (i.e. number of options).
31309 */
31310-static u32 cyc2x_dpmbase_options[] = {
31311+static long cyc2x_dpmbase_options[] = {
31312 20,
31313 0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000, 0xB8000,
31314 0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000, 0xD0000, 0xD4000,
31315 0xD8000, 0xDC000, 0xE0000, 0xE4000, 0xE8000, 0xEC000
31316 };
31317
31318-static u32 cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
31319+static long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
31320
31321 /* Kernel Loadable Module Entry Points */
31322 /* Module 'insert' entry point.
31323@@ -137,7 +137,7 @@
31324 EXPORT_SYMBOL(cycx_setup);
31325 int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len)
31326 {
31327- unsigned long dpmbase = hw->dpmbase;
31328+ long dpmbase = (long)hw->dpmbase;
31329 int err;
31330
31331 /* Verify IRQ configuration options */
31332@@ -147,17 +147,17 @@
31333 }
31334
31335 /* Setup adapter dual-port memory window and test memory */
31336- if (!hw->dpmbase) {
31337+ if (!dpmbase) {
31338 printk(KERN_ERR "%s: you must specify the dpm address!\n",
31339 modname);
31340 return -EINVAL;
31341- } else if (!get_option_index(cyc2x_dpmbase_options, hw->dpmbase)) {
31342+ } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) {
31343 printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n",
31344 modname, dpmbase);
31345 return -EINVAL;
31346 }
31347
31348- hw->dpmbase = (u32)ioremap(dpmbase, CYCX_WINDOWSIZE);
31349+ hw->dpmbase = ioremap(dpmbase, CYCX_WINDOWSIZE);
31350 hw->dpmsize = CYCX_WINDOWSIZE;
31351
31352 if (!detect_cyc2x(hw->dpmbase)) {
31353@@ -181,8 +181,7 @@
31354 EXPORT_SYMBOL(cycx_down);
31355 int cycx_down(struct cycx_hw *hw)
31356 {
31357- iounmap((u32 *)hw->dpmbase);
31358-
31359+ iounmap(hw->dpmbase);
31360 return 0;
31361 }
31362
31363@@ -204,7 +203,7 @@
31364 * o Set exec flag.
31365 * o Busy-wait until flag is reset. */
31366 EXPORT_SYMBOL(cycx_exec);
31367-int cycx_exec(u32 addr)
31368+int cycx_exec(void *addr)
31369 {
31370 u16 i = 0;
31371 /* wait till addr content is zeroed */
31372@@ -250,7 +249,7 @@
31373 /* Load Aux Routines */
31374 /* Reset board hardware.
31375 return 1 if memory exists at addr and 0 if not. */
31376-static int memory_exists(u32 addr)
31377+static int memory_exists(void *addr)
31378 {
31379 int tries = 0;
31380
31381@@ -268,9 +267,9 @@
31382 }
31383
31384 /* Load reset code. */
31385-static void reset_load(u32 addr, u8 *buffer, u32 cnt)
31386+static void reset_load(void *addr, u8 *buffer, u32 cnt)
31387 {
31388- u32 pt_code = addr + RESET_OFFSET;
31389+ void *pt_code = addr + RESET_OFFSET;
31390 u16 i; /*, j; */
31391
31392 for (i = 0 ; i < cnt ; i++) {
31393@@ -282,7 +281,7 @@
31394 /* Load buffer using boot interface.
31395 * o copy data from buffer to Cyclom-X memory
31396 * o wait for reset code to copy it to right portion of memory */
31397-static int buffer_load(u32 addr, u8 *buffer, u32 cnt)
31398+static int buffer_load(void *addr, u8 *buffer, u32 cnt)
31399 {
31400 memcpy_toio(addr + DATA_OFFSET, buffer, cnt);
31401 writew(GEN_BOOT_DAT, addr + CMD_OFFSET);
31402@@ -291,7 +290,7 @@
31403 }
31404
31405 /* Set up entry point and kick start Cyclom-X CPU. */
31406-static void cycx_start(u32 addr)
31407+static void cycx_start(void *addr)
31408 {
31409 /* put in 0x30 offset the jump instruction to the code entry point */
31410 writeb(0xea, addr + 0x30);
31411@@ -305,9 +304,9 @@
31412 }
31413
31414 /* Load and boot reset code. */
31415-static void cycx_reset_boot(u32 addr, u8 *code, u32 len)
31416+static void cycx_reset_boot(void *addr, u8 *code, u32 len)
31417 {
31418- u32 pt_start = addr + START_OFFSET;
31419+ void *pt_start = addr + START_OFFSET;
31420
31421 writeb(0xea, pt_start++); /* jmp to f000:3f00 */
31422 writeb(0x00, pt_start++);
31423@@ -322,9 +321,9 @@
31424 }
31425
31426 /* Load data.bin file through boot (reset) interface. */
31427-static int cycx_data_boot(u32 addr, u8 *code, u32 len)
31428+static int cycx_data_boot(void *addr, u8 *code, u32 len)
31429 {
31430- u32 pt_boot_cmd = addr + CMD_OFFSET;
31431+ void *pt_boot_cmd = addr + CMD_OFFSET;
31432 u32 i;
31433
31434 /* boot buffer lenght */
31435@@ -353,9 +352,9 @@
31436
31437
31438 /* Load code.bin file through boot (reset) interface. */
31439-static int cycx_code_boot(u32 addr, u8 *code, u32 len)
31440+static int cycx_code_boot(void *addr, u8 *code, u32 len)
31441 {
31442- u32 pt_boot_cmd = addr + CMD_OFFSET;
31443+ void *pt_boot_cmd = addr + CMD_OFFSET;
31444 u32 i;
31445
31446 /* boot buffer lenght */
31447@@ -392,7 +391,7 @@
31448 u8 *reset_image,
31449 *data_image,
31450 *code_image;
31451- u32 pt_cycld = hw->dpmbase + 0x400;
31452+ void *pt_cycld = hw->dpmbase + 0x400;
31453 u16 cksum;
31454
31455 /* Announce */
31456@@ -426,7 +425,7 @@
31457 if (cksum != cfm->checksum) {
31458 printk(KERN_ERR "%s:%s: firmware corrupted!\n",
31459 modname, __FUNCTION__);
31460- printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n",
31461+ printk(KERN_ERR " cdsize = 0x%lx (expected 0x%lx)\n",
31462 len - sizeof(struct cycx_firmware) - 1,
31463 cfm->info.codesize);
31464 printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
31465@@ -435,9 +434,7 @@
31466 }
31467
31468 /* If everything is ok, set reset, data and code pointers */
31469-
31470- img_hdr = (struct cycx_fw_header *)(((u8 *)cfm) +
31471- sizeof(struct cycx_firmware) - 1);
31472+ img_hdr = (struct cycx_fw_header *)&cfm->image;
31473 #ifdef FIRMWARE_DEBUG
31474 printk(KERN_INFO "%s:%s: image sizes\n", __FUNCTION__, modname);
31475 printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size);
31476@@ -526,7 +523,7 @@
31477 * Return 1 if detected o.k. or 0 if failed.
31478 * Note: This test is destructive! Adapter will be left in shutdown
31479 * state after the test. */
31480-static int detect_cyc2x(u32 addr)
31481+static int detect_cyc2x(void *addr)
31482 {
31483 reset_cyc2x(addr);
31484
31485@@ -536,7 +533,7 @@
31486 /* Miscellaneous */
31487 /* Get option's index into the options list.
31488 * Return option's index (1 .. N) or zero if option is invalid. */
31489-static int get_option_index(u32 *optlist, u32 optval)
31490+static int get_option_index(long *optlist, long optval)
31491 {
31492 int i = 1;
31493
31494@@ -548,7 +545,7 @@
31495 }
31496
31497 /* Reset adapter's CPU. */
31498-static int reset_cyc2x(u32 addr)
31499+static int reset_cyc2x(void *addr)
31500 {
31501 writeb(0, addr + RST_ENABLE);
31502 delay_cycx(2);
31503diff -Nru a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c
31504--- a/drivers/net/wan/cycx_main.c Tue May 20 07:19:38 2003
31505+++ b/drivers/net/wan/cycx_main.c Sat Aug 23 20:36:33 2003
31506@@ -223,7 +223,7 @@
31507 /* Configure hardware, load firmware, etc. */
31508 memset(&card->hw, 0, sizeof(card->hw));
31509 card->hw.irq = irq;
31510- card->hw.dpmbase = conf->maddr;
31511+ card->hw.dpmbase = (void *)conf->maddr;
31512 card->hw.dpmsize = CYCX_WINDOWSIZE;
31513 card->hw.fwid = CFID_X25_2X;
31514 card->lock = SPIN_LOCK_UNLOCKED;
31515@@ -236,7 +236,7 @@
31516 /* Initialize WAN device data space */
31517 wandev->irq = irq;
31518 wandev->dma = wandev->ioport = 0;
31519- wandev->maddr = card->hw.dpmbase;
31520+ wandev->maddr = (unsigned long)card->hw.dpmbase;
31521 wandev->msize = card->hw.dpmsize;
31522 wandev->hw_opt[2] = 0;
31523 wandev->hw_opt[3] = card->hw.fwid;
31524diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
31525--- a/drivers/net/wireless/airo.c Tue Aug 19 20:13:55 2003
31526+++ b/drivers/net/wireless/airo.c Sun Aug 31 16:14:06 2003
31527@@ -81,12 +81,12 @@
31528 #endif
31529
31530 /* Support Cisco MIC feature */
31531-/* As this feature requires the AES encryption algorithm, it is not included
31532- in the kernel tree. If you want to enable it, you need to download the
31533- aes.h, aestab.h and mic.h files from the CVS at
31534- http://sf.net/projects/airo-linux/ Put the files in the same directory
31535- as airo.c and compile normally */
31536+#define MICSUPPORT
31537+
31538+#if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO)
31539+#warning MIC support requires Crypto API
31540 #undef MICSUPPORT
31541+#endif
31542
31543 /* Hack to do some power saving */
31544 #define POWER_ON_DOWN
31545@@ -615,14 +615,14 @@
31546 u16 arlDelay;
31547 u16 _reserved4[1];
31548 /*---------- Aironet Extensions ----------*/
31549- u16 magicAction;
31550+ u8 magicAction;
31551 #define MAGIC_ACTION_STSCHG 1
31552 #define MACIC_ACTION_RESUME 2
31553 #define MAGIC_IGNORE_MCAST (1<<8)
31554 #define MAGIC_IGNORE_BCAST (1<<9)
31555 #define MAGIC_SWITCH_TO_PSP (0<<10)
31556 #define MAGIC_STAY_IN_CAM (1<<10)
31557- u16 magicControl;
31558+ u8 magicControl;
31559 u16 autoWake;
31560 } ConfigRid;
31561
31562@@ -843,6 +843,7 @@
31563 #define AIROGMICRID 11
31564 #define AIROGMICSTATS 12
31565 #define AIROGFLAGS 13
31566+#define AIRORRID 15
31567
31568 /* Leave gap of 40 commands after AIROGSTATSD32 for future */
31569
31570@@ -994,6 +995,8 @@
31571 static int micsetup(struct airo_info *ai);
31572 static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len);
31573 static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket, u16 payLen);
31574+
31575+#include <linux/crypto.h>
31576 #endif
31577
31578 struct airo_info {
31579@@ -1063,9 +1066,12 @@
31580 #endif /* WIRELESS_SPY */
31581 #endif /* WIRELESS_EXT > 15 */
31582 #endif /* WIRELESS_EXT */
31583+#ifdef MICSUPPORT
31584 /* MIC stuff */
31585+ struct crypto_tfm *tfm;
31586 mic_module mod[2];
31587 mic_statistics micstats;
31588+#endif
31589 };
31590
31591 static inline int bap_read(struct airo_info *ai, u16 *pu16Dst, int bytelen,
31592@@ -1079,7 +1085,462 @@
31593 struct airo_info *apriv );
31594
31595 #ifdef MICSUPPORT
31596-#include "mic.h"
31597+/***********************************************************************
31598+ * MIC ROUTINES *
31599+ ***********************************************************************
31600+ */
31601+
31602+static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq);
31603+static void MoveWindow(miccntx *context, u32 micSeq);
31604+void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *);
31605+void emmh32_init(emmh32_context *context);
31606+void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
31607+void emmh32_final(emmh32_context *context, u8 digest[4]);
31608+
31609+/* micinit - Initialize mic seed */
31610+
31611+static void micinit(struct airo_info *ai)
31612+{
31613+ MICRid mic_rid;
31614+
31615+ clear_bit(JOB_MIC, &ai->flags);
31616+ PC4500_readrid(ai, RID_MIC, &mic_rid, sizeof(mic_rid), 0);
31617+ up(&ai->sem);
31618+
31619+ ai->micstats.enabled = (mic_rid.state & 0x00FF) ? 1 : 0;
31620+
31621+ if (ai->micstats.enabled) {
31622+ /* Key must be valid and different */
31623+ if (mic_rid.multicastValid && (!ai->mod[0].mCtx.valid ||
31624+ (memcmp (ai->mod[0].mCtx.key, mic_rid.multicast,
31625+ sizeof(ai->mod[0].mCtx.key)) != 0))) {
31626+ /* Age current mic Context */
31627+ memcpy(&ai->mod[1].mCtx,&ai->mod[0].mCtx,sizeof(miccntx));
31628+ /* Initialize new context */
31629+ memcpy(&ai->mod[0].mCtx.key,mic_rid.multicast,sizeof(mic_rid.multicast));
31630+ ai->mod[0].mCtx.window = 33; //Window always points to the middle
31631+ ai->mod[0].mCtx.rx = 0; //Rx Sequence numbers
31632+ ai->mod[0].mCtx.tx = 0; //Tx sequence numbers
31633+ ai->mod[0].mCtx.valid = 1; //Key is now valid
31634+
31635+ /* Give key to mic seed */
31636+ emmh32_setseed(&ai->mod[0].mCtx.seed,mic_rid.multicast,sizeof(mic_rid.multicast), ai->tfm);
31637+ }
31638+
31639+ /* Key must be valid and different */
31640+ if (mic_rid.unicastValid && (!ai->mod[0].uCtx.valid ||
31641+ (memcmp(ai->mod[0].uCtx.key, mic_rid.unicast,
31642+ sizeof(ai->mod[0].uCtx.key)) != 0))) {
31643+ /* Age current mic Context */
31644+ memcpy(&ai->mod[1].uCtx,&ai->mod[0].uCtx,sizeof(miccntx));
31645+ /* Initialize new context */
31646+ memcpy(&ai->mod[0].uCtx.key,mic_rid.unicast,sizeof(mic_rid.unicast));
31647+
31648+ ai->mod[0].uCtx.window = 33; //Window always points to the middle
31649+ ai->mod[0].uCtx.rx = 0; //Rx Sequence numbers
31650+ ai->mod[0].uCtx.tx = 0; //Tx sequence numbers
31651+ ai->mod[0].uCtx.valid = 1; //Key is now valid
31652+
31653+ //Give key to mic seed
31654+ emmh32_setseed(&ai->mod[0].uCtx.seed, mic_rid.unicast, sizeof(mic_rid.unicast), ai->tfm);
31655+ }
31656+ } else {
31657+ /* So next time we have a valid key and mic is enabled, we will update
31658+ * the sequence number if the key is the same as before.
31659+ */
31660+ ai->mod[0].uCtx.valid = 0;
31661+ ai->mod[0].mCtx.valid = 0;
31662+ }
31663+}
31664+
31665+/* micsetup - Get ready for business */
31666+
31667+static int micsetup(struct airo_info *ai) {
31668+ int i;
31669+
31670+ if (ai->tfm == NULL)
31671+ ai->tfm = crypto_alloc_tfm("aes", 0);
31672+
31673+ if (ai->tfm == NULL) {
31674+ printk(KERN_ERR "airo: failed to load transform for AES\n");
31675+ return ERROR;
31676+ }
31677+
31678+ for (i=0; i < NUM_MODULES; i++) {
31679+ memset(&ai->mod[i].mCtx,0,sizeof(miccntx));
31680+ memset(&ai->mod[i].uCtx,0,sizeof(miccntx));
31681+ }
31682+ return SUCCESS;
31683+}
31684+
31685+char micsnap[]= {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02};
31686+
31687+/*===========================================================================
31688+ * Description: Mic a packet
31689+ *
31690+ * Inputs: etherHead * pointer to an 802.3 frame
31691+ *
31692+ * Returns: BOOLEAN if successful, otherwise false.
31693+ * PacketTxLen will be updated with the mic'd packets size.
31694+ *
31695+ * Caveats: It is assumed that the frame buffer will already
31696+ * be big enough to hold the largets mic message possible.
31697+ * (No memory allocation is done here).
31698+ *
31699+ * Author: sbraneky (10/15/01)
31700+ * Merciless hacks by rwilcher (1/14/02)
31701+ */
31702+
31703+static int encapsulate(struct airo_info *ai ,etherHead *frame, MICBuffer *mic, int payLen)
31704+{
31705+ miccntx *context;
31706+
31707+ // Determine correct context
31708+ // If not adhoc, always use unicast key
31709+
31710+ if (test_bit(FLAG_ADHOC, &ai->flags) && (frame->da[0] & 0x1))
31711+ context = &ai->mod[0].mCtx;
31712+ else
31713+ context = &ai->mod[0].uCtx;
31714+
31715+ if (!context->valid)
31716+ return ERROR;
31717+
31718+ mic->typelen = htons(payLen + 16); //Length of Mic'd packet
31719+
31720+ memcpy(&mic->u.snap, micsnap, sizeof(micsnap)); // Add Snap
31721+
31722+ // Add Tx sequence
31723+ mic->seq = htonl(context->tx);
31724+ context->tx += 2;
31725+
31726+ emmh32_init(&context->seed); // Mic the packet
31727+ emmh32_update(&context->seed,frame->da,ETH_ALEN * 2); // DA,SA
31728+ emmh32_update(&context->seed,(u8*)&mic->typelen,10); // Type/Length and Snap
31729+ emmh32_update(&context->seed,(u8*)&mic->seq,sizeof(mic->seq)); //SEQ
31730+ emmh32_update(&context->seed,frame->da + ETH_ALEN * 2,payLen); //payload
31731+ emmh32_final(&context->seed, (u8*)&mic->mic);
31732+
31733+ /* New Type/length ?????????? */
31734+ mic->typelen = 0; //Let NIC know it could be an oversized packet
31735+ return SUCCESS;
31736+}
31737+
31738+typedef enum {
31739+ NONE,
31740+ NOMIC,
31741+ NOMICPLUMMED,
31742+ SEQUENCE,
31743+ INCORRECTMIC,
31744+} mic_error;
31745+
31746+/*===========================================================================
31747+ * Description: Decapsulates a MIC'd packet and returns the 802.3 packet
31748+ * (removes the MIC stuff) if packet is a valid packet.
31749+ *
31750+ * Inputs: etherHead pointer to the 802.3 packet
31751+ *
31752+ * Returns: BOOLEAN - TRUE if packet should be dropped otherwise FALSE
31753+ *
31754+ * Author: sbraneky (10/15/01)
31755+ * Merciless hacks by rwilcher (1/14/02)
31756+ *---------------------------------------------------------------------------
31757+ */
31758+
31759+static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *eth, u16 payLen)
31760+{
31761+ int i;
31762+ u32 micSEQ;
31763+ miccntx *context;
31764+ u8 digest[4];
31765+ mic_error micError = NONE;
31766+
31767+ // Check if the packet is a Mic'd packet
31768+
31769+ if (!ai->micstats.enabled) {
31770+ //No Mic set or Mic OFF but we received a MIC'd packet.
31771+ if (memcmp ((u8*)eth + 14, micsnap, sizeof(micsnap)) == 0) {
31772+ ai->micstats.rxMICPlummed++;
31773+ return ERROR;
31774+ }
31775+ return SUCCESS;
31776+ }
31777+
31778+ if (ntohs(mic->typelen) == 0x888E)
31779+ return SUCCESS;
31780+
31781+ if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) {
31782+ // Mic enabled but packet isn't Mic'd
31783+ ai->micstats.rxMICPlummed++;
31784+ return ERROR;
31785+ }
31786+
31787+ micSEQ = ntohl(mic->seq); //store SEQ as CPU order
31788+
31789+ //At this point we a have a mic'd packet and mic is enabled
31790+ //Now do the mic error checking.
31791+
31792+ //Receive seq must be odd
31793+ if ( (micSEQ & 1) == 0 ) {
31794+ ai->micstats.rxWrongSequence++;
31795+ return ERROR;
31796+ }
31797+
31798+ for (i = 0; i < NUM_MODULES; i++) {
31799+ int mcast = eth->da[0] & 1;
31800+ //Determine proper context
31801+ context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx;
31802+
31803+ //Make sure context is valid
31804+ if (!context->valid) {
31805+ if (i == 0)
31806+ micError = NOMICPLUMMED;
31807+ continue;
31808+ }
31809+ //DeMic it
31810+
31811+ if (!mic->typelen)
31812+ mic->typelen = htons(payLen + sizeof(MICBuffer) - 2);
31813+
31814+ emmh32_init(&context->seed);
31815+ emmh32_update(&context->seed, eth->da, ETH_ALEN*2);
31816+ emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap));
31817+ emmh32_update(&context->seed, (u8 *)&mic->seq,sizeof(mic->seq));
31818+ emmh32_update(&context->seed, eth->da + ETH_ALEN*2,payLen);
31819+ //Calculate MIC
31820+ emmh32_final(&context->seed, digest);
31821+
31822+ if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match
31823+ //Invalid Mic
31824+ if (i == 0)
31825+ micError = INCORRECTMIC;
31826+ continue;
31827+ }
31828+
31829+ //Check Sequence number if mics pass
31830+ if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) {
31831+ ai->micstats.rxSuccess++;
31832+ return SUCCESS;
31833+ }
31834+ if (i == 0)
31835+ micError = SEQUENCE;
31836+ }
31837+
31838+ // Update statistics
31839+ switch (micError) {
31840+ case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break;
31841+ case SEQUENCE: ai->micstats.rxWrongSequence++; break;
31842+ case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break;
31843+ case NONE: break;
31844+ case NOMIC: break;
31845+ }
31846+ return ERROR;
31847+}
31848+
31849+/*===========================================================================
31850+ * Description: Checks the Rx Seq number to make sure it is valid
31851+ * and hasn't already been received
31852+ *
31853+ * Inputs: miccntx - mic context to check seq against
31854+ * micSeq - the Mic seq number
31855+ *
31856+ * Returns: TRUE if valid otherwise FALSE.
31857+ *
31858+ * Author: sbraneky (10/15/01)
31859+ * Merciless hacks by rwilcher (1/14/02)
31860+ *---------------------------------------------------------------------------
31861+ */
31862+
31863+static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq)
31864+{
31865+ u32 seq,index;
31866+
31867+ //Allow for the ap being rebooted - if it is then use the next
31868+ //sequence number of the current sequence number - might go backwards
31869+
31870+ if (mcast) {
31871+ if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) {
31872+ clear_bit (FLAG_UPDATE_MULTI, &ai->flags);
31873+ context->window = (micSeq > 33) ? micSeq : 33;
31874+ context->rx = 0; // Reset rx
31875+ }
31876+ } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) {
31877+ clear_bit (FLAG_UPDATE_UNI, &ai->flags);
31878+ context->window = (micSeq > 33) ? micSeq : 33; // Move window
31879+ context->rx = 0; // Reset rx
31880+ }
31881+
31882+ //Make sequence number relative to START of window
31883+ seq = micSeq - (context->window - 33);
31884+
31885+ //Too old of a SEQ number to check.
31886+ if ((u32)seq < 0)
31887+ return ERROR;
31888+
31889+ if ( seq > 64 ) {
31890+ //Window is infinite forward
31891+ MoveWindow(context,micSeq);
31892+ return SUCCESS;
31893+ }
31894+
31895+ // We are in the window. Now check the context rx bit to see if it was already sent
31896+ seq >>= 1; //divide by 2 because we only have odd numbers
31897+ index = 1 << seq; //Get an index number
31898+
31899+ if (!(context->rx & index)) {
31900+ //micSEQ falls inside the window.
31901+ //Add seqence number to the list of received numbers.
31902+ context->rx |= index;
31903+
31904+ MoveWindow(context,micSeq);
31905+
31906+ return SUCCESS;
31907+ }
31908+ return ERROR;
31909+}
31910+
31911+static void MoveWindow(miccntx *context, u32 micSeq)
31912+{
31913+ u32 shift;
31914+
31915+ //Move window if seq greater than the middle of the window
31916+ if (micSeq > context->window) {
31917+ shift = (micSeq - context->window) >> 1;
31918+
31919+ //Shift out old
31920+ if (shift < 32)
31921+ context->rx >>= shift;
31922+ else
31923+ context->rx = 0;
31924+
31925+ context->window = micSeq; //Move window
31926+ }
31927+}
31928+
31929+/*==============================================*/
31930+/*========== EMMH ROUTINES ====================*/
31931+/*==============================================*/
31932+
31933+/* mic accumulate */
31934+#define MIC_ACCUM(val) \
31935+ context->accum += (u64)(val) * context->coeff[coeff_position++];
31936+
31937+static unsigned char aes_counter[16];
31938+
31939+/* expand the key to fill the MMH coefficient array */
31940+void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm)
31941+{
31942+ /* take the keying material, expand if necessary, truncate at 16-bytes */
31943+ /* run through AES counter mode to generate context->coeff[] */
31944+
31945+ int i,j;
31946+ u32 counter;
31947+ u8 *cipher;
31948+ struct scatterlist sg[1];
31949+
31950+ crypto_cipher_setkey(tfm, pkey, 16);
31951+ counter = 0;
31952+ for (i = 0; i < (sizeof(context->coeff)/sizeof(context->coeff[0])); ) {
31953+ aes_counter[15] = (u8)(counter >> 0);
31954+ aes_counter[14] = (u8)(counter >> 8);
31955+ aes_counter[13] = (u8)(counter >> 16);
31956+ aes_counter[12] = (u8)(counter >> 24);
31957+ counter++;
31958+ sg[0].page = virt_to_page(aes_counter);
31959+ sg[0].offset = ((long) aes_counter & ~PAGE_MASK);
31960+ sg[0].length = 16;
31961+ crypto_cipher_encrypt(tfm, sg, sg, 16);
31962+ cipher = kmap(sg[0].page) + sg[0].offset;
31963+ for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) {
31964+ context->coeff[i++] = ntohl(*(u32 *)&cipher[j]);
31965+ j += 4;
31966+ }
31967+ }
31968+}
31969+
31970+/* prepare for calculation of a new mic */
31971+void emmh32_init(emmh32_context *context)
31972+{
31973+ /* prepare for new mic calculation */
31974+ context->accum = 0;
31975+ context->position = 0;
31976+}
31977+
31978+/* add some bytes to the mic calculation */
31979+void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
31980+{
31981+ int coeff_position, byte_position;
31982+
31983+ if (len == 0) return;
31984+
31985+ coeff_position = context->position >> 2;
31986+
31987+ /* deal with partial 32-bit word left over from last update */
31988+ byte_position = context->position & 3;
31989+ if (byte_position) {
31990+ /* have a partial word in part to deal with */
31991+ do {
31992+ if (len == 0) return;
31993+ context->part.d8[byte_position++] = *pOctets++;
31994+ context->position++;
31995+ len--;
31996+ } while (byte_position < 4);
31997+ MIC_ACCUM(htonl(context->part.d32));
31998+ }
31999+
32000+ /* deal with full 32-bit words */
32001+ while (len >= 4) {
32002+ MIC_ACCUM(htonl(*(u32 *)pOctets));
32003+ context->position += 4;
32004+ pOctets += 4;
32005+ len -= 4;
32006+ }
32007+
32008+ /* deal with partial 32-bit word that will be left over from this update */
32009+ byte_position = 0;
32010+ while (len > 0) {
32011+ context->part.d8[byte_position++] = *pOctets++;
32012+ context->position++;
32013+ len--;
32014+ }
32015+}
32016+
32017+/* mask used to zero empty bytes for final partial word */
32018+static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L };
32019+
32020+/* calculate the mic */
32021+void emmh32_final(emmh32_context *context, u8 digest[4])
32022+{
32023+ int coeff_position, byte_position;
32024+ u32 val;
32025+
32026+ u64 sum, utmp;
32027+ s64 stmp;
32028+
32029+ coeff_position = context->position >> 2;
32030+
32031+ /* deal with partial 32-bit word left over from last update */
32032+ byte_position = context->position & 3;
32033+ if (byte_position) {
32034+ /* have a partial word in part to deal with */
32035+ val = htonl(context->part.d32);
32036+ MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */
32037+ }
32038+
32039+ /* reduce the accumulated u64 to a 32-bit MIC */
32040+ sum = context->accum;
32041+ stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15);
32042+ utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15);
32043+ sum = utmp & 0xffffffffLL;
32044+ if (utmp > 0x10000000fLL)
32045+ sum -= 15;
32046+
32047+ val = (u32)sum;
32048+ digest[0] = (val>>24) & 0xFF;
32049+ digest[1] = (val>>16) & 0xFF;
32050+ digest[2] = (val>>8) & 0xFF;
32051+ digest[3] = val & 0xFF;
32052+}
32053 #endif
32054
32055 static int readBSSListRid(struct airo_info *ai, int first,
32056@@ -1556,6 +2017,7 @@
32057 struct sockaddr *addr = p;
32058 Resp rsp;
32059
32060+ readConfigRid(ai, 1);
32061 memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len);
32062 ai->need_commit = 1;
32063 disable_MAC(ai, 1);
32064@@ -1624,6 +2086,10 @@
32065 /* PCMCIA frees this stuff, so only for PCI and ISA */
32066 release_region( dev->base_addr, 64 );
32067 }
32068+#ifdef MICSUPPORT
32069+ if (ai->tfm)
32070+ crypto_free_tfm(ai->tfm);
32071+#endif
32072 del_airo_dev( dev );
32073 free_netdev( dev );
32074 }
32075@@ -1725,6 +2191,9 @@
32076 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
32077 if (ai->thr_pid < 0)
32078 goto err_out_free;
32079+#ifdef MICSUPPORT
32080+ ai->tfm = NULL;
32081+#endif
32082 rc = add_airo_dev( dev );
32083 if (rc)
32084 goto err_out_thr;
32085@@ -2125,146 +2594,149 @@
32086
32087 if (len > 2312) {
32088 printk( KERN_ERR "airo: Bad size %d\n", len );
32089- len = 0;
32090+ goto badrx;
32091 }
32092- if (len) {
32093- if (test_bit(FLAG_802_11, &apriv->flags)) {
32094- bap_read (apriv, (u16*)&fc, sizeof(fc), BAP0);
32095- fc = le16_to_cpu(fc);
32096- switch (fc & 0xc) {
32097- case 4:
32098- if ((fc & 0xe0) == 0xc0)
32099- hdrlen = 10;
32100- else
32101- hdrlen = 16;
32102- break;
32103- case 8:
32104- if ((fc&0x300)==0x300){
32105- hdrlen = 30;
32106- break;
32107- }
32108- default:
32109- hdrlen = 24;
32110- }
32111- } else
32112- hdrlen = ETH_ALEN * 2;
32113+ if (len == 0)
32114+ goto badrx;
32115
32116- skb = dev_alloc_skb( len + hdrlen + 2 );
32117- if ( !skb ) {
32118- apriv->stats.rx_dropped++;
32119- len = 0;
32120- }
32121- }
32122- if (len) {
32123- buffer = (u16*)skb_put (skb, len + hdrlen);
32124- if (test_bit(FLAG_802_11, &apriv->flags)) {
32125- buffer[0] = fc;
32126- bap_read (apriv, buffer + 1, hdrlen - 2, BAP0);
32127- if (hdrlen == 24)
32128- bap_read (apriv, tmpbuf, 6, BAP0);
32129-
32130- bap_read (apriv, &gap, sizeof(gap), BAP0);
32131- gap = le16_to_cpu(gap);
32132- if (gap) {
32133- if (gap <= 8)
32134- bap_read (apriv, tmpbuf, gap, BAP0);
32135+ if (test_bit(FLAG_802_11, &apriv->flags)) {
32136+ bap_read (apriv, (u16*)&fc, sizeof(fc), BAP0);
32137+ fc = le16_to_cpu(fc);
32138+ switch (fc & 0xc) {
32139+ case 4:
32140+ if ((fc & 0xe0) == 0xc0)
32141+ hdrlen = 10;
32142 else
32143- printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n");
32144- }
32145-
32146-
32147- bap_read (apriv, buffer + hdrlen/2, len, BAP0);
32148- } else {
32149- MICBuffer micbuf;
32150- bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
32151- if (apriv->micstats.enabled) {
32152- bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
32153- if (ntohs(micbuf.typelen) > 0x05DC)
32154- bap_setup (apriv, fid, 0x44, BAP0);
32155- else {
32156- len -= sizeof(micbuf);
32157- if (len < 48)
32158- len = 48;
32159- skb_trim (skb, len + hdrlen);
32160+ hdrlen = 16;
32161+ break;
32162+ case 8:
32163+ if ((fc&0x300)==0x300){
32164+ hdrlen = 30;
32165+ break;
32166 }
32167- }
32168- bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
32169+ default:
32170+ hdrlen = 24;
32171+ }
32172+ } else
32173+ hdrlen = ETH_ALEN * 2;
32174+
32175+ skb = dev_alloc_skb( len + hdrlen + 2 );
32176+ if ( !skb ) {
32177+ apriv->stats.rx_dropped++;
32178+ goto badrx;
32179+ }
32180+ buffer = (u16*)skb_put (skb, len + hdrlen);
32181+ if (test_bit(FLAG_802_11, &apriv->flags)) {
32182+ buffer[0] = fc;
32183+ bap_read (apriv, buffer + 1, hdrlen - 2, BAP0);
32184+ if (hdrlen == 24)
32185+ bap_read (apriv, tmpbuf, 6, BAP0);
32186+
32187+ bap_read (apriv, &gap, sizeof(gap), BAP0);
32188+ gap = le16_to_cpu(gap);
32189+ if (gap) {
32190+ if (gap <= 8)
32191+ bap_read (apriv, tmpbuf, gap, BAP0);
32192+ else
32193+ printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n");
32194+ }
32195+ bap_read (apriv, buffer + hdrlen/2, len, BAP0);
32196+ } else {
32197+#ifdef MICSUPPORT
32198+ MICBuffer micbuf;
32199+#endif
32200+ bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
32201 #ifdef MICSUPPORT
32202- if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
32203- dev_kfree_skb_irq (skb);
32204- len = 0;
32205+ if (apriv->micstats.enabled) {
32206+ bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
32207+ if (ntohs(micbuf.typelen) > 0x05DC)
32208+ bap_setup (apriv, fid, 0x44, BAP0);
32209+ else {
32210+ if (len <= sizeof(micbuf))
32211+ goto badmic;
32212+
32213+ len -= sizeof(micbuf);
32214+ skb_trim (skb, len + hdrlen);
32215 }
32216+ }
32217 #endif
32218+ bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
32219+#ifdef MICSUPPORT
32220+ if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
32221+badmic:
32222+ dev_kfree_skb_irq (skb);
32223+badrx:
32224+ OUT4500( apriv, EVACK, EV_RX);
32225+ goto exitrx;
32226 }
32227+#endif
32228 }
32229- if (len) {
32230 #if WIRELESS_EXT > 15
32231 #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
32232- if (apriv->spy_data.spy_number > 0) {
32233- char *sa;
32234- struct iw_quality wstats;
32235- /* Prepare spy data : addr + qual */
32236- if (!test_bit(FLAG_802_11, &apriv->flags)) {
32237- sa = (char*)buffer + 6;
32238- bap_setup (apriv, fid, 8, BAP0);
32239- bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
32240- } else
32241- sa = (char*)buffer + 10;
32242- wstats.qual = hdr.rssi[0];
32243- if (apriv->rssi)
32244- wstats.level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
32245- else
32246- wstats.level = (hdr.rssi[1] + 321) / 2;
32247- wstats.updated = 3;
32248- /* Update spy records */
32249- wireless_spy_update(dev, sa, &wstats);
32250- }
32251+ if (apriv->spy_data.spy_number > 0) {
32252+ char *sa;
32253+ struct iw_quality wstats;
32254+ /* Prepare spy data : addr + qual */
32255+ if (!test_bit(FLAG_802_11, &apriv->flags)) {
32256+ sa = (char*)buffer + 6;
32257+ bap_setup (apriv, fid, 8, BAP0);
32258+ bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
32259+ } else
32260+ sa = (char*)buffer + 10;
32261+ wstats.qual = hdr.rssi[0];
32262+ if (apriv->rssi)
32263+ wstats.level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
32264+ else
32265+ wstats.level = (hdr.rssi[1] + 321) / 2;
32266+ wstats.updated = 3;
32267+ /* Update spy records */
32268+ wireless_spy_update(dev, sa, &wstats);
32269+ }
32270 #endif /* IW_WIRELESS_SPY */
32271 #else /* WIRELESS_EXT > 15 */
32272 #ifdef WIRELESS_SPY
32273- if (apriv->spy_number > 0) {
32274- int i;
32275- char *sa;
32276-
32277- sa = (char*)buffer + (test_bit(FLAG_802_11, &apriv->flags) ? 10 : 6);
32278-
32279- for (i=0; i<apriv->spy_number; i++)
32280- if (!memcmp(sa,apriv->spy_address[i],ETH_ALEN))
32281- {
32282- if (!test_bit(FLAG_802_11, &apriv->flags)) {
32283- bap_setup (apriv, fid, 8, BAP0);
32284- bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
32285- }
32286- apriv->spy_stat[i].qual = hdr.rssi[0];
32287- if (apriv->rssi)
32288- apriv->spy_stat[i].level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
32289- else
32290- apriv->spy_stat[i].level = (hdr.rssi[1] + 321) / 2;
32291- apriv->spy_stat[i].noise = 0;
32292- apriv->spy_stat[i].updated = 3;
32293- break;
32294+ if (apriv->spy_number > 0) {
32295+ int i;
32296+ char *sa;
32297+
32298+ sa = (char*)buffer + (test_bit(FLAG_802_11, &apriv->flags) ? 10 : 6);
32299+
32300+ for (i=0; i<apriv->spy_number; i++)
32301+ if (!memcmp(sa,apriv->spy_address[i],ETH_ALEN))
32302+ {
32303+ if (!test_bit(FLAG_802_11, &apriv->flags)) {
32304+ bap_setup (apriv, fid, 8, BAP0);
32305+ bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
32306 }
32307- }
32308+ apriv->spy_stat[i].qual = hdr.rssi[0];
32309+ if (apriv->rssi)
32310+ apriv->spy_stat[i].level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
32311+ else
32312+ apriv->spy_stat[i].level = (hdr.rssi[1] + 321) / 2;
32313+ apriv->spy_stat[i].noise = 0;
32314+ apriv->spy_stat[i].updated = 3;
32315+ break;
32316+ }
32317+ }
32318 #endif /* WIRELESS_SPY */
32319 #endif /* WIRELESS_EXT > 15 */
32320- OUT4500( apriv, EVACK, EV_RX);
32321+ OUT4500( apriv, EVACK, EV_RX);
32322
32323- if (test_bit(FLAG_802_11, &apriv->flags)) {
32324- skb->mac.raw = skb->data;
32325- skb->pkt_type = PACKET_OTHERHOST;
32326- skb->dev = apriv->wifidev;
32327- skb->protocol = htons(ETH_P_802_2);
32328- } else {
32329- skb->dev = dev;
32330- skb->protocol = eth_type_trans(skb,dev);
32331- }
32332- skb->dev->last_rx = jiffies;
32333- skb->ip_summed = CHECKSUM_NONE;
32334+ if (test_bit(FLAG_802_11, &apriv->flags)) {
32335+ skb->mac.raw = skb->data;
32336+ skb->pkt_type = PACKET_OTHERHOST;
32337+ skb->dev = apriv->wifidev;
32338+ skb->protocol = htons(ETH_P_802_2);
32339+ } else {
32340+ skb->dev = dev;
32341+ skb->protocol = eth_type_trans(skb,dev);
32342+ }
32343+ skb->dev->last_rx = jiffies;
32344+ skb->ip_summed = CHECKSUM_NONE;
32345
32346- netif_rx( skb );
32347- } else
32348- OUT4500( apriv, EVACK, EV_RX);
32349+ netif_rx( skb );
32350 }
32351+exitrx:
32352
32353 /* Check to see if a packet has been transmitted */
32354 if ( status & ( EV_TX|EV_TXEXC ) ) {
32355@@ -2469,6 +2941,9 @@
32356 printk(KERN_WARNING "airo: unknown received signal level scale\n");
32357 }
32358 ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS;
32359+ ai->config.authType = AUTH_OPEN;
32360+ ai->config.modulation = MOD_CCK;
32361+ ai->config._reserved1a[0] = 2; /* ??? */
32362
32363 #ifdef MICSUPPORT
32364 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
32365@@ -2515,6 +2990,7 @@
32366 memcpy(mySsid.ssids[i].ssid, ssids[i],
32367 mySsid.ssids[i].len);
32368 }
32369+ mySsid.len = sizeof(mySsid);
32370 }
32371
32372 status = writeConfigRid(ai, 1);
32373@@ -3692,6 +4168,8 @@
32374 offset < data->writelen ) offset++;
32375 offset++;
32376 }
32377+ if (i)
32378+ SSID_rid.len = sizeof(SSID_rid);
32379 disable_MAC(ai, 1);
32380 writeSsidRid(ai, &SSID_rid);
32381 enable_MAC(ai, &rsp, 1);
32382@@ -4156,7 +4634,7 @@
32383
32384 static int __init airo_init_module( void )
32385 {
32386- int i, rc = 0, have_isa_dev = 0;
32387+ int i, have_isa_dev = 0;
32388
32389 airo_entry = create_proc_entry("aironet",
32390 S_IFDIR | airo_perm,
32391@@ -4174,7 +4652,7 @@
32392
32393 #ifdef CONFIG_PCI
32394 printk( KERN_INFO "airo: Probing for PCI adapters\n" );
32395- rc = pci_module_init(&airo_driver);
32396+ pci_module_init(&airo_driver);
32397 printk( KERN_INFO "airo: Finished probing for PCI adapters\n" );
32398 #endif
32399
32400@@ -4197,8 +4675,11 @@
32401 }
32402 remove_proc_entry("aironet", proc_root_driver);
32403
32404- if (is_pci)
32405+ if (is_pci) {
32406+#ifdef CONFIG_PCI
32407 pci_unregister_driver(&airo_driver);
32408+#endif
32409+ }
32410 }
32411
32412 #ifdef WIRELESS_EXT
32413@@ -4260,6 +4741,7 @@
32414 printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m);
32415 rc = -EINVAL;
32416 } else {
32417+ readConfigRid(local, 1);
32418 /* Yes ! We can set it !!! */
32419 local->config.channelSet = (u16)(channel - 1);
32420 local->need_commit = 1;
32421@@ -4280,6 +4762,7 @@
32422 struct airo_info *local = dev->priv;
32423 StatusRid status_rid; /* Card status info */
32424
32425+ readConfigRid(local, 1);
32426 if ((local->config.opmode & 0xFF) == MODE_STA_ESS)
32427 status_rid.channel = local->config.channelSet;
32428 else
32429@@ -4336,6 +4819,7 @@
32430 sizeof(SSID_rid.ssids[index].ssid));
32431 memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length);
32432 SSID_rid.ssids[index].len = dwrq->length - 1;
32433+ SSID_rid.len = sizeof(SSID_rid);
32434 }
32435 /* Write it to the card */
32436 disable_MAC(local, 1);
32437@@ -4445,6 +4929,7 @@
32438 if(dwrq->length > 16 + 1) {
32439 return -E2BIG;
32440 }
32441+ readConfigRid(local, 1);
32442 memset(local->config.nodeName, 0, sizeof(local->config.nodeName));
32443 memcpy(local->config.nodeName, extra, dwrq->length);
32444 local->need_commit = 1;
32445@@ -4463,6 +4948,7 @@
32446 {
32447 struct airo_info *local = dev->priv;
32448
32449+ readConfigRid(local, 1);
32450 strncpy(extra, local->config.nodeName, 16);
32451 extra[16] = '\0';
32452 dwrq->length = strlen(extra) + 1;
32453@@ -4519,6 +5005,7 @@
32454 return -EINVAL;
32455 }
32456
32457+ readConfigRid(local, 1);
32458 /* Now, check if we want a fixed or auto value */
32459 if(vwrq->fixed == 0) {
32460 /* Fill all the rates up to this max rate */
32461@@ -4555,6 +5042,7 @@
32462
32463 vwrq->value = status_rid.currentXmitRate * 500000;
32464 /* If more than one rate, set auto */
32465+ readConfigRid(local, 1);
32466 vwrq->fixed = (local->config.rates[1] == 0);
32467
32468 return 0;
32469@@ -4577,6 +5065,7 @@
32470 if((rthr < 0) || (rthr > 2312)) {
32471 return -EINVAL;
32472 }
32473+ readConfigRid(local, 1);
32474 local->config.rtsThres = rthr;
32475 local->need_commit = 1;
32476
32477@@ -4594,6 +5083,7 @@
32478 {
32479 struct airo_info *local = dev->priv;
32480
32481+ readConfigRid(local, 1);
32482 vwrq->value = local->config.rtsThres;
32483 vwrq->disabled = (vwrq->value >= 2312);
32484 vwrq->fixed = 1;
32485@@ -4619,6 +5109,7 @@
32486 return -EINVAL;
32487 }
32488 fthr &= ~0x1; /* Get an even value - is it really needed ??? */
32489+ readConfigRid(local, 1);
32490 local->config.fragThresh = (u16)fthr;
32491 local->need_commit = 1;
32492
32493@@ -4636,6 +5127,7 @@
32494 {
32495 struct airo_info *local = dev->priv;
32496
32497+ readConfigRid(local, 1);
32498 vwrq->value = local->config.fragThresh;
32499 vwrq->disabled = (vwrq->value >= 2312);
32500 vwrq->fixed = 1;
32501@@ -4655,6 +5147,7 @@
32502 struct airo_info *local = dev->priv;
32503 int commit = 1;
32504
32505+ readConfigRid(local, 1);
32506 if ((local->config.rmode & 0xff) >= RXMODE_RFMON)
32507 commit = 2;
32508
32509@@ -4714,6 +5207,7 @@
32510 {
32511 struct airo_info *local = dev->priv;
32512
32513+ readConfigRid(local, 1);
32514 /* If not managed, assume it's ad-hoc */
32515 switch (local->config.opmode & 0xFF) {
32516 case MODE_STA_ESS:
32517@@ -4750,6 +5244,7 @@
32518 if(!(cap_rid.softCap & 2)) {
32519 return -EOPNOTSUPP;
32520 } */
32521+ readConfigRid(local, 1);
32522
32523 /* Basic checking: do we have a key to set ?
32524 * Note : with the new API, it's impossible to get a NULL pointer.
32525@@ -4836,6 +5331,7 @@
32526 if(!(cap_rid.softCap & 2)) {
32527 return -EOPNOTSUPP;
32528 }
32529+ readConfigRid(local, 1);
32530 /* Check encryption mode */
32531 switch(local->config.authType) {
32532 case AUTH_ENCRYPT:
32533@@ -4892,6 +5388,7 @@
32534 clear_bit (FLAG_RADIO_OFF, &local->flags);
32535 for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++)
32536 if ((vwrq->value==cap_rid.txPowerLevels[i])) {
32537+ readConfigRid(local, 1);
32538 local->config.txPower = vwrq->value;
32539 local->need_commit = 1;
32540 rc = -EINPROGRESS; /* Call commit handler */
32541@@ -4911,6 +5408,7 @@
32542 {
32543 struct airo_info *local = dev->priv;
32544
32545+ readConfigRid(local, 1);
32546 vwrq->value = local->config.txPower;
32547 vwrq->fixed = 1; /* No power control */
32548 vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags);
32549@@ -4934,6 +5432,7 @@
32550 if(vwrq->disabled) {
32551 return -EINVAL;
32552 }
32553+ readConfigRid(local, 1);
32554 if(vwrq->flags & IW_RETRY_LIMIT) {
32555 if(vwrq->flags & IW_RETRY_MAX)
32556 local->config.longRetryLimit = vwrq->value;
32557@@ -4968,6 +5467,7 @@
32558
32559 vwrq->disabled = 0; /* Can't be disabled */
32560
32561+ readConfigRid(local, 1);
32562 /* Note : by default, display the min retry number */
32563 if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
32564 vwrq->flags = IW_RETRY_LIFETIME;
32565@@ -5106,6 +5606,7 @@
32566 {
32567 struct airo_info *local = dev->priv;
32568
32569+ readConfigRid(local, 1);
32570 if (vwrq->disabled) {
32571 if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) {
32572 return -EINVAL;
32573@@ -5162,6 +5663,7 @@
32574 {
32575 struct airo_info *local = dev->priv;
32576
32577+ readConfigRid(local, 1);
32578 int mode = local->config.powerSaveMode;
32579 if ((vwrq->disabled = (mode == POWERSAVE_CAM)))
32580 return 0;
32581@@ -5191,6 +5693,7 @@
32582 {
32583 struct airo_info *local = dev->priv;
32584
32585+ readConfigRid(local, 1);
32586 local->config.rssiThreshold = vwrq->disabled ? RSSI_DEFAULT : vwrq->value;
32587 local->need_commit = 1;
32588
32589@@ -5208,6 +5711,7 @@
32590 {
32591 struct airo_info *local = dev->priv;
32592
32593+ readConfigRid(local, 1);
32594 vwrq->value = local->config.rssiThreshold;
32595 vwrq->disabled = (vwrq->value == 0);
32596 vwrq->fixed = 1;
32597@@ -6017,7 +6521,7 @@
32598
32599 /* Separate R/W functions bracket legality here
32600 */
32601- if ( com.command <= AIROGMICSTATS )
32602+ if ( com.command <= AIRORRID )
32603 rc = readrids(dev,&com);
32604 else if ( com.command >= AIROPCAP && com.command <= AIROPLEAPUSR )
32605 rc = writerids(dev,&com);
32606@@ -6107,6 +6611,7 @@
32607 static int readrids(struct net_device *dev, aironet_ioctl *comp) {
32608 unsigned short ridcode;
32609 unsigned char *iobuf;
32610+ int len;
32611 struct airo_info *ai = dev->priv;
32612
32613 if (test_bit(FLAG_FLASHING, &ai->flags))
32614@@ -6134,11 +6639,14 @@
32615 case AIROGSTAT: ridcode = RID_STATUS; break;
32616 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
32617 case AIROGSTATSC32: ridcode = RID_STATS; break;
32618+#ifdef MICSUPPORT
32619 case AIROGMICSTATS:
32620 if (copy_to_user(comp->data, &ai->micstats,
32621 min((int)comp->len,(int)sizeof(ai->micstats))))
32622 return -EFAULT;
32623 return 0;
32624+#endif
32625+ case AIRORRID: ridcode = comp->len; break;
32626 default:
32627 return -EINVAL;
32628 break;
32629@@ -6152,9 +6660,12 @@
32630 * then return it to the user
32631 * 9/22/2000 Honor user given length
32632 */
32633+ if (comp->command == AIRORRID)
32634+ len = le16_to_cpu(*(unsigned short *)iobuf); /* Yuck! */
32635+ else
32636+ len = comp->len;
32637
32638- if (copy_to_user(comp->data, iobuf,
32639- min((int)comp->len, (int)RIDS_SIZE))) {
32640+ if (copy_to_user(comp->data, iobuf, min(len, (int)RIDS_SIZE))) {
32641 kfree (iobuf);
32642 return -EFAULT;
32643 }
32644@@ -6222,9 +6733,11 @@
32645
32646 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDS_SIZE, 1);
32647
32648+#ifdef MICSUPPORT
32649 enabled = ai->micstats.enabled;
32650 memset(&ai->micstats,0,sizeof(ai->micstats));
32651 ai->micstats.enabled = enabled;
32652+#endif
32653
32654 if (copy_to_user(comp->data, iobuf,
32655 min((int)comp->len, (int)RIDS_SIZE))) {
32656diff -Nru a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
32657--- a/drivers/net/wireless/airport.c Tue Aug 19 20:53:17 2003
32658+++ b/drivers/net/wireless/airport.c Mon Aug 25 09:51:43 2003
32659@@ -25,8 +25,6 @@
32660 #include <linux/if_arp.h>
32661 #include <linux/etherdevice.h>
32662 #include <linux/wireless.h>
32663-#include <linux/adb.h>
32664-#include <linux/pmu.h>
32665
32666 #include <asm/io.h>
32667 #include <asm/system.h>
32668@@ -48,96 +46,115 @@
32669 int ndev_registered;
32670 };
32671
32672-#ifdef CONFIG_PMAC_PBOOK
32673-static int airport_sleep_notify(struct pmu_sleep_notifier *self, int when);
32674-static struct pmu_sleep_notifier airport_sleep_notifier = {
32675- airport_sleep_notify, SLEEP_LEVEL_NET,
32676-};
32677-#endif
32678+static int
32679+airport_suspend(struct macio_dev *mdev, u32 state)
32680+{
32681+ struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
32682+ struct orinoco_private *priv = dev->priv;
32683+ struct airport *card = priv->card;
32684+ unsigned long flags;
32685+ int err;
32686+
32687+ printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name);
32688+
32689+ err = orinoco_lock(priv, &flags);
32690+ if (err) {
32691+ printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n",
32692+ dev->name);
32693+ return 0;
32694+ }
32695+
32696+ err = __orinoco_down(dev);
32697+ if (err)
32698+ printk(KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n",
32699+ dev->name, err);
32700
32701-/*
32702- * Function prototypes
32703- */
32704+ netif_device_detach(dev);
32705
32706-static struct net_device *airport_attach(struct device_node *of_node);
32707-static void airport_detach(struct net_device *dev);
32708+ priv->hw_unavailable++;
32709
32710-static struct net_device *airport_dev;
32711+ orinoco_unlock(priv, &flags);
32712+
32713+ disable_irq(dev->irq);
32714+ pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
32715+
32716+ return 0;
32717+}
32718
32719-#ifdef CONFIG_PMAC_PBOOK
32720 static int
32721-airport_sleep_notify(struct pmu_sleep_notifier *self, int when)
32722+airport_resume(struct macio_dev *mdev)
32723 {
32724- struct net_device *dev = airport_dev;
32725+ struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
32726 struct orinoco_private *priv = dev->priv;
32727 struct airport *card = priv->card;
32728 unsigned long flags;
32729 int err;
32730-
32731- if (! airport_dev)
32732- return PBOOK_SLEEP_OK;
32733-
32734- switch (when) {
32735- case PBOOK_SLEEP_NOW:
32736- printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name);
32737-
32738- err = orinoco_lock(priv, &flags);
32739- if (err) {
32740- printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n",
32741- dev->name);
32742- break;
32743- }
32744
32745- err = __orinoco_down(dev);
32746- if (err)
32747- printk(KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n",
32748- dev->name, err);
32749+ printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
32750
32751- netif_device_detach(dev);
32752+ pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 1);
32753+ mdelay(200);
32754
32755- priv->hw_unavailable++;
32756+ enable_irq(dev->irq);
32757
32758- orinoco_unlock(priv, &flags);
32759+ err = orinoco_reinit_firmware(dev);
32760+ if (err) {
32761+ printk(KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n",
32762+ dev->name, err);
32763+ return 0;
32764+ }
32765
32766- disable_irq(dev->irq);
32767- pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
32768- break;
32769+ spin_lock_irqsave(&priv->lock, flags);
32770
32771- case PBOOK_WAKE:
32772- printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
32773- pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 1);
32774- mdelay(200);
32775+ netif_device_attach(dev);
32776
32777- enable_irq(dev->irq);
32778+ priv->hw_unavailable--;
32779
32780- err = orinoco_reinit_firmware(dev);
32781- if (err) {
32782- printk(KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n",
32783+ if (priv->open && (! priv->hw_unavailable)) {
32784+ err = __orinoco_up(dev);
32785+ if (err)
32786+ printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
32787 dev->name, err);
32788- break;
32789- }
32790+ }
32791
32792- spin_lock_irqsave(&priv->lock, flags);
32793
32794- netif_device_attach(dev);
32795+ spin_unlock_irqrestore(&priv->lock, flags);
32796
32797- priv->hw_unavailable--;
32798+ return 0;
32799+}
32800
32801- if (priv->open && (! priv->hw_unavailable)) {
32802- err = __orinoco_up(dev);
32803- if (err)
32804- printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
32805- dev->name, err);
32806- }
32807+static int
32808+airport_detach(struct macio_dev *mdev)
32809+{
32810+ struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
32811+ struct orinoco_private *priv = dev->priv;
32812+ struct airport *card = priv->card;
32813
32814+ if (card->ndev_registered)
32815+ unregister_netdev(dev);
32816+ card->ndev_registered = 0;
32817
32818- spin_unlock_irqrestore(&priv->lock, flags);
32819+ if (card->irq_requested)
32820+ free_irq(dev->irq, dev);
32821+ card->irq_requested = 0;
32822
32823- break;
32824- }
32825- return PBOOK_SLEEP_OK;
32826+ if (card->vaddr)
32827+ iounmap(card->vaddr);
32828+ card->vaddr = 0;
32829+
32830+ dev->base_addr = 0;
32831+
32832+ release_OF_resource(card->node, 0);
32833+
32834+ pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
32835+ current->state = TASK_UNINTERRUPTIBLE;
32836+ schedule_timeout(HZ);
32837+
32838+ dev_set_drvdata(&mdev->ofdev.dev, NULL);
32839+ free_netdev(dev);
32840+
32841+ return 0;
32842 }
32843-#endif /* CONFIG_PMAC_PBOOK */
32844
32845 static int airport_hard_reset(struct orinoco_private *priv)
32846 {
32847@@ -170,25 +187,26 @@
32848 return 0;
32849 }
32850
32851-static struct net_device *
32852-airport_attach(struct device_node *of_node)
32853+static int
32854+airport_attach(struct macio_dev *mdev, const struct of_match *match)
32855 {
32856 struct orinoco_private *priv;
32857 struct net_device *dev;
32858 struct airport *card;
32859 unsigned long phys_addr;
32860+ struct device_node *of_node = mdev->ofdev.node;
32861 hermes_t *hw;
32862
32863 if (of_node->n_addrs < 1 || of_node->n_intrs < 1) {
32864 printk(KERN_ERR "airport: wrong interrupt/addresses in OF tree\n");
32865- return NULL;
32866+ return -ENODEV;
32867 }
32868
32869 /* Allocate space for private device-specific data */
32870 dev = alloc_orinocodev(sizeof(*card), airport_hard_reset);
32871 if (! dev) {
32872 printk(KERN_ERR "airport: can't allocate device datas\n");
32873- return NULL;
32874+ return -ENODEV;
32875 }
32876 priv = dev->priv;
32877 card = priv->card;
32878@@ -199,11 +217,14 @@
32879 if (! request_OF_resource(of_node, 0, " (airport)")) {
32880 printk(KERN_ERR "airport: can't request IO resource !\n");
32881 kfree(dev);
32882- return NULL;
32883+ return -ENODEV;
32884 }
32885
32886 dev->name[0] = '\0'; /* register_netdev will give us an ethX name */
32887 SET_MODULE_OWNER(dev);
32888+ SET_NETDEV_DEV(dev, &mdev->ofdev.dev);
32889+
32890+ dev_set_drvdata(&mdev->ofdev.dev, dev);
32891
32892 /* Setup interrupts & base address */
32893 dev->irq = of_node->intrs[0].line;
32894@@ -240,79 +261,50 @@
32895 }
32896 printk(KERN_DEBUG "airport: card registered for interface %s\n", dev->name);
32897 card->ndev_registered = 1;
32898-
32899-#ifdef CONFIG_PMAC_PBOOK
32900- pmu_register_sleep_notifier(&airport_sleep_notifier);
32901-#endif
32902- return dev;
32903-
32904+ return 0;
32905 failed:
32906- airport_detach(dev);
32907- return NULL;
32908+ airport_detach(mdev);
32909+ return -ENODEV;
32910 } /* airport_attach */
32911
32912-/*======================================================================
32913- This deletes a driver "instance".
32914- ======================================================================*/
32915-
32916-static void
32917-airport_detach(struct net_device *dev)
32918-{
32919- struct orinoco_private *priv = dev->priv;
32920- struct airport *card = priv->card;
32921-
32922-#ifdef CONFIG_PMAC_PBOOK
32923- pmu_unregister_sleep_notifier(&airport_sleep_notifier);
32924-#endif
32925- if (card->ndev_registered)
32926- unregister_netdev(dev);
32927- card->ndev_registered = 0;
32928-
32929- if (card->irq_requested)
32930- free_irq(dev->irq, dev);
32931- card->irq_requested = 0;
32932-
32933- if (card->vaddr)
32934- iounmap(card->vaddr);
32935- card->vaddr = 0;
32936-
32937- dev->base_addr = 0;
32938-
32939- release_OF_resource(card->node, 0);
32940-
32941- pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
32942- current->state = TASK_UNINTERRUPTIBLE;
32943- schedule_timeout(HZ);
32944-
32945- free_netdev(dev);
32946-} /* airport_detach */
32947
32948 static char version[] __initdata = "airport.c 0.13e (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
32949 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
32950 MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
32951 MODULE_LICENSE("Dual MPL/GPL");
32952
32953+static struct of_match airport_match[] =
32954+{
32955+ {
32956+ .name = "radio",
32957+ .type = OF_ANY_MATCH,
32958+ .compatible = OF_ANY_MATCH
32959+ },
32960+ {},
32961+};
32962+
32963+static struct macio_driver airport_driver =
32964+{
32965+ .name = "airport",
32966+ .match_table = airport_match,
32967+ .probe = airport_attach,
32968+ .remove = airport_detach,
32969+ .suspend = airport_suspend,
32970+ .resume = airport_resume,
32971+};
32972+
32973 static int __init
32974 init_airport(void)
32975 {
32976- struct device_node *airport_node;
32977-
32978 printk(KERN_DEBUG "%s\n", version);
32979
32980- /* Lookup card in device tree */
32981- airport_node = find_devices("radio");
32982- if (airport_node && !strcmp(airport_node->parent->name, "mac-io"))
32983- airport_dev = airport_attach(airport_node);
32984-
32985- return airport_dev ? 0 : -ENODEV;
32986+ return macio_register_driver(&airport_driver);
32987 }
32988
32989 static void __exit
32990 exit_airport(void)
32991 {
32992- if (airport_dev)
32993- airport_detach(airport_dev);
32994- airport_dev = NULL;
32995+ return macio_unregister_driver(&airport_driver);
32996 }
32997
32998 module_init(init_airport);
32999diff -Nru a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
33000--- a/drivers/net/wireless/ray_cs.c Thu Aug 7 09:17:57 2003
33001+++ b/drivers/net/wireless/ray_cs.c Tue Aug 26 14:55:20 2003
33002@@ -105,6 +105,9 @@
33003 static struct net_device_stats *ray_get_stats(struct net_device *dev);
33004 static int ray_dev_init(struct net_device *dev);
33005 static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
33006+
33007+static struct ethtool_ops netdev_ethtool_ops;
33008+
33009 static int ray_open(struct net_device *dev);
33010 static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev);
33011 static void set_multicast_list(struct net_device *dev);
33012@@ -408,6 +411,7 @@
33013 dev->set_config = &ray_dev_config;
33014 dev->get_stats = &ray_get_stats;
33015 dev->do_ioctl = &ray_dev_ioctl;
33016+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
33017 #if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */
33018 dev->get_wireless_stats = ray_get_wireless_stats;
33019 #endif
33020@@ -1226,26 +1230,16 @@
33021
33022 /*===========================================================================*/
33023
33024-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
33025+static void netdev_get_drvinfo(struct net_device *dev,
33026+ struct ethtool_drvinfo *info)
33027 {
33028- u32 ethcmd;
33029-
33030- if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
33031- return -EFAULT;
33032-
33033- switch (ethcmd) {
33034- case ETHTOOL_GDRVINFO: {
33035- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
33036- strncpy(info.driver, "ray_cs", sizeof(info.driver)-1);
33037- if (copy_to_user(useraddr, &info, sizeof(info)))
33038- return -EFAULT;
33039- return 0;
33040- }
33041- }
33042-
33043- return -EOPNOTSUPP;
33044+ strcpy(info->driver, "ray_cs");
33045 }
33046
33047+static struct ethtool_ops netdev_ethtool_ops = {
33048+ .get_drvinfo = netdev_get_drvinfo,
33049+};
33050+
33051 /*====================================================================*/
33052
33053 static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
33054@@ -1265,10 +1259,6 @@
33055 /* Validate the command */
33056 switch (cmd)
33057 {
33058- case SIOCETHTOOL:
33059- err = netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
33060- break;
33061-
33062 #if WIRELESS_EXT > 7
33063 /* --------------- WIRELESS EXTENSIONS --------------- */
33064 /* Get name */
33065diff -Nru a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
33066--- a/drivers/net/yellowfin.c Tue Aug 19 20:53:17 2003
33067+++ b/drivers/net/yellowfin.c Sun Aug 31 06:34:16 2003
33068@@ -873,8 +873,6 @@
33069 /* Calculate the next Tx descriptor entry. */
33070 entry = yp->cur_tx % TX_RING_SIZE;
33071
33072- yp->tx_skbuff[entry] = skb;
33073-
33074 if (gx_fix) { /* Note: only works for paddable protocols e.g. IP. */
33075 int cacheline_end = ((unsigned long)skb->data + skb->len) % 32;
33076 /* Fix GX chipset errata. */
33077@@ -889,6 +887,8 @@
33078 return 0;
33079 }
33080 }
33081+ yp->tx_skbuff[entry] = skb;
33082+
33083 #ifdef NO_TXSTATS
33084 yp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
33085 skb->data, len, PCI_DMA_TODEVICE));
33086diff -Nru a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
33087--- a/drivers/parport/parport_pc.c Thu Jul 31 08:59:04 2003
33088+++ b/drivers/parport/parport_pc.c Sun Aug 31 16:14:16 2003
33089@@ -93,7 +93,7 @@
33090 int dma;
33091 } superios[NR_SUPERIOS] __devinitdata = { {0,},};
33092
33093-static int user_specified __devinitdata = 0;
33094+static int user_specified;
33095 #if defined(CONFIG_PARPORT_PC_SUPERIO) || \
33096 (defined(CONFIG_PARPORT_1284) && defined(CONFIG_PARPORT_PC_FIFO))
33097 static int verbose_probing;
33098diff -Nru a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
33099--- a/drivers/pcmcia/ds.c Mon Jun 16 13:20:14 2003
33100+++ b/drivers/pcmcia/ds.c Tue Aug 26 09:25:41 2003
33101@@ -495,7 +495,7 @@
33102
33103 static int ds_open(struct inode *inode, struct file *file)
33104 {
33105- socket_t i = minor(inode->i_rdev);
33106+ socket_t i = iminor(inode);
33107 struct pcmcia_bus_socket *s;
33108 user_info_t *user;
33109
33110@@ -529,7 +529,7 @@
33111
33112 static int ds_release(struct inode *inode, struct file *file)
33113 {
33114- socket_t i = minor(inode->i_rdev);
33115+ socket_t i = iminor(inode);
33116 struct pcmcia_bus_socket *s;
33117 user_info_t *user, **link;
33118
33119@@ -563,7 +563,7 @@
33120 static ssize_t ds_read(struct file *file, char *buf,
33121 size_t count, loff_t *ppos)
33122 {
33123- socket_t i = minor(file->f_dentry->d_inode->i_rdev);
33124+ socket_t i = iminor(file->f_dentry->d_inode);
33125 struct pcmcia_bus_socket *s;
33126 user_info_t *user;
33127
33128@@ -594,7 +594,7 @@
33129 static ssize_t ds_write(struct file *file, const char *buf,
33130 size_t count, loff_t *ppos)
33131 {
33132- socket_t i = minor(file->f_dentry->d_inode->i_rdev);
33133+ socket_t i = iminor(file->f_dentry->d_inode);
33134 struct pcmcia_bus_socket *s;
33135 user_info_t *user;
33136
33137@@ -629,7 +629,7 @@
33138 /* No kernel lock - fine */
33139 static u_int ds_poll(struct file *file, poll_table *wait)
33140 {
33141- socket_t i = minor(file->f_dentry->d_inode->i_rdev);
33142+ socket_t i = iminor(file->f_dentry->d_inode);
33143 struct pcmcia_bus_socket *s;
33144 user_info_t *user;
33145
33146@@ -653,7 +653,7 @@
33147 static int ds_ioctl(struct inode * inode, struct file * file,
33148 u_int cmd, u_long arg)
33149 {
33150- socket_t i = minor(inode->i_rdev);
33151+ socket_t i = iminor(inode);
33152 struct pcmcia_bus_socket *s;
33153 u_int size;
33154 int ret, err;
33155diff -Nru a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
33156--- a/drivers/pcmcia/sa1111_generic.c Sun Jun 15 04:35:08 2003
33157+++ b/drivers/pcmcia/sa1111_generic.c Sun Aug 24 07:45:05 2003
33158@@ -16,6 +16,7 @@
33159
33160 #include <asm/hardware.h>
33161 #include <asm/hardware/sa1111.h>
33162+#include <asm/io.h>
33163 #include <asm/irq.h>
33164
33165 #include "sa1111_generic.h"
33166@@ -118,16 +119,15 @@
33167 sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
33168 }
33169
33170-static int pcmcia_probe(struct device *dev)
33171+static int pcmcia_probe(struct sa1111_dev *dev)
33172 {
33173- struct sa1111_dev *sadev = SA1111_DEV(dev);
33174 char *base;
33175
33176- if (!request_mem_region(sadev->res.start, 512,
33177- SA1111_DRIVER_NAME(sadev)))
33178+ if (!request_mem_region(dev->res.start, 512,
33179+ SA1111_DRIVER_NAME(dev)))
33180 return -EBUSY;
33181
33182- base = sadev->mapbase;
33183+ base = dev->mapbase;
33184
33185 /*
33186 * Initialise the suspend state.
33187@@ -136,61 +136,68 @@
33188 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + SA1111_PCCR);
33189
33190 #ifdef CONFIG_SA1100_ADSBITSY
33191- pcmcia_adsbitsy_init(dev);
33192+ pcmcia_adsbitsy_init(&dev->dev);
33193 #endif
33194 #ifdef CONFIG_SA1100_BADGE4
33195- pcmcia_badge4_init(dev);
33196+ pcmcia_badge4_init(&dev->dev);
33197 #endif
33198 #ifdef CONFIG_SA1100_GRAPHICSMASTER
33199- pcmcia_graphicsmaster_init(dev);
33200+ pcmcia_graphicsmaster_init(&dev->dev);
33201 #endif
33202 #ifdef CONFIG_SA1100_JORNADA720
33203- pcmcia_jornada720_init(dev);
33204+ pcmcia_jornada720_init(&dev->dev);
33205 #endif
33206 #ifdef CONFIG_ASSABET_NEPONSET
33207- pcmcia_neponset_init(dev);
33208+ pcmcia_neponset_init(&dev->dev);
33209 #endif
33210 #ifdef CONFIG_SA1100_PFS168
33211- pcmcia_pfs_init(dev);
33212+ pcmcia_pfs_init(&dev->dev);
33213 #endif
33214 #ifdef CONFIG_SA1100_PT_SYSTEM3
33215- pcmcia_system3_init(dev);
33216+ pcmcia_system3_init(&dev->dev);
33217 #endif
33218 #ifdef CONFIG_SA1100_XP860
33219- pcmcia_xp860_init(dev);
33220+ pcmcia_xp860_init(&dev->dev);
33221 #endif
33222 return 0;
33223 }
33224
33225-static int __devexit pcmcia_remove(struct device *dev)
33226+static int __devexit pcmcia_remove(struct sa1111_dev *dev)
33227 {
33228- struct sa1111_dev *sadev = SA1111_DEV(dev);
33229-
33230- sa11xx_drv_pcmcia_remove(dev);
33231- release_mem_region(sadev->res.start, 512);
33232+ sa11xx_drv_pcmcia_remove(&dev->dev);
33233+ release_mem_region(dev->res.start, 512);
33234 return 0;
33235 }
33236
33237+static int pcmcia_suspend(struct sa1111_dev *dev, u32 state)
33238+{
33239+ return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
33240+}
33241+
33242+static int pcmcia_resume(struct sa1111_dev *dev)
33243+{
33244+ return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
33245+}
33246+
33247 static struct sa1111_driver pcmcia_driver = {
33248 .drv = {
33249- .name = "sa1111-pcmcia",
33250- .bus = &sa1111_bus_type,
33251- .probe = pcmcia_probe,
33252- .remove = __devexit_p(pcmcia_remove),
33253- .suspend = pcmcia_socket_dev_suspend,
33254- .resume = pcmcia_socket_dev_resume,
33255+ .name = "sa1111-pcmcia",
33256 },
33257- .devid = SA1111_DEVID_PCMCIA,
33258+ .devid = SA1111_DEVID_PCMCIA,
33259+ .probe = pcmcia_probe,
33260+ .remove = __devexit_p(pcmcia_remove),
33261+ .suspend = pcmcia_suspend,
33262+ .resume = pcmcia_resume,
33263 };
33264
33265 static int __init sa1111_drv_pcmcia_init(void)
33266 {
33267- return driver_register(&pcmcia_driver.drv);
33268+ return sa1111_driver_register(&pcmcia_driver);
33269 }
33270
33271 static void __exit sa1111_drv_pcmcia_exit(void)
33272 {
33273- driver_unregister(&pcmcia_driver.drv);
33274+ sa1111_driver_unregister(&pcmcia_driver);
33275 }
33276
33277 module_init(sa1111_drv_pcmcia_init);
33278diff -Nru a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
33279--- a/drivers/s390/char/tape_char.c Mon May 26 12:20:47 2003
33280+++ b/drivers/s390/char/tape_char.c Tue Aug 26 09:25:41 2003
33281@@ -238,14 +238,14 @@
33282 struct tape_device *device;
33283 int minor, rc;
33284
33285- if (major(filp->f_dentry->d_inode->i_rdev) != tapechar_major)
33286+ if (imajor(filp->f_dentry->d_inode) != tapechar_major)
33287 return -ENODEV;
33288- minor = minor(filp->f_dentry->d_inode->i_rdev);
33289+ minor = iminor(filp->f_dentry->d_inode);
33290 device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
33291 if (IS_ERR(device)) {
33292 return PTR_ERR(device);
33293 }
33294- DBF_EVENT(6, "TCHAR:open: %x\n", minor(inode->i_rdev));
33295+ DBF_EVENT(6, "TCHAR:open: %x\n", iminor(inode));
33296 rc = tape_open(device);
33297 if (rc == 0) {
33298 rc = tape_assign(device);
33299@@ -269,7 +269,7 @@
33300 struct tape_device *device;
33301
33302 device = (struct tape_device *) filp->private_data;
33303- DBF_EVENT(6, "TCHAR:release: %x\n", minor(inode->i_rdev));
33304+ DBF_EVENT(6, "TCHAR:release: %x\n", iminor(inode));
33305 #if 0
33306 // FIXME: this is broken. Either MTWEOF/MTWEOF/MTBSR is done
33307 // EVERYTIME the user switches from write to something different
33308@@ -281,7 +281,7 @@
33309 /*
33310 * If this is the rewinding tape minor then rewind.
33311 */
33312- if ((minor(inode->i_rdev) & 1) != 0)
33313+ if ((iminor(inode) & 1) != 0)
33314 tape_mtop(device, MTREW, 1);
33315 if (device->char_data.idal_buf != NULL) {
33316 idal_buffer_free(device->char_data.idal_buf);
33317diff -Nru a/drivers/s390/char/tubio.h b/drivers/s390/char/tubio.h
33318--- a/drivers/s390/char/tubio.h Wed Jun 11 12:32:58 2003
33319+++ b/drivers/s390/char/tubio.h Tue Aug 26 09:25:41 2003
33320@@ -377,7 +377,7 @@
33321 */
33322 extern inline tub_t *INODE2TUB(struct inode *ip)
33323 {
33324- unsigned int minor = minor(ip->i_rdev);
33325+ unsigned int minor = iminor(ip);
33326 tub_t *tubp = NULL;
33327 if (minor == 0 && current->tty) {
33328 if (current->tty->driver == tty3270_driver)
33329diff -Nru a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c
33330--- a/drivers/s390/net/cu3088.c Sun May 25 17:00:00 2003
33331+++ b/drivers/s390/net/cu3088.c Tue Aug 19 09:22:46 2003
33332@@ -64,7 +64,7 @@
33333 group_write(struct device_driver *drv, const char *buf, size_t count)
33334 {
33335 const char *start, *end;
33336- char bus_ids[2][BUS_ID_SIZE], *argv[2];
33337+ char bus_ids[2][BUS_ID_SIZE+1], *argv[2];
33338 int i;
33339 int ret;
33340 struct ccwgroup_driver *cdrv;
33341@@ -79,7 +79,7 @@
33342
33343 if (!(end = strchr(start, delim[i])))
33344 return count;
33345- len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start);
33346+ len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start)+1;
33347 strlcpy (bus_ids[i], start, len);
33348 argv[i] = bus_ids[i];
33349 start = end + 1;
33350diff -Nru a/drivers/s390/net/qeth.c b/drivers/s390/net/qeth.c
33351--- a/drivers/s390/net/qeth.c Thu Jul 17 10:27:34 2003
33352+++ b/drivers/s390/net/qeth.c Sun Aug 31 16:14:08 2003
33353@@ -9765,19 +9765,19 @@
33354 };
33355
33356 static struct file_operations qeth_procfile_fops = {
33357- ioctl:qeth_procfile_ioctl,
33358- read:qeth_procfile_read,
33359- open:qeth_procfile_open,
33360- release:qeth_procfile_release,
33361+ .ioctl = qeth_procfile_ioctl,
33362+ .read = qeth_procfile_read,
33363+ .open = qeth_procfile_open,
33364+ .release = qeth_procfile_release,
33365 };
33366
33367 static struct proc_dir_entry *qeth_proc_file;
33368
33369 static struct file_operations qeth_ipato_procfile_fops = {
33370- read:qeth_procfile_read, /* same as above! */
33371- write:qeth_ipato_procfile_write,
33372- open:qeth_ipato_procfile_open,
33373- release:qeth_procfile_release /* same as above! */
33374+ .read = qeth_procfile_read, /* same as above! */
33375+ .write = qeth_ipato_procfile_write,
33376+ .open = qeth_ipato_procfile_open,
33377+ .release = qeth_procfile_release /* same as above! */
33378 };
33379
33380 static struct proc_dir_entry *qeth_ipato_proc_file;
33381diff -Nru a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
33382--- a/drivers/sbus/char/bpp.c Wed May 7 08:47:30 2003
33383+++ b/drivers/sbus/char/bpp.c Tue Aug 26 09:25:41 2003
33384@@ -440,7 +440,7 @@
33385 */
33386 static int bpp_open(struct inode *inode, struct file *f)
33387 {
33388- unsigned minor = minor(inode->i_rdev);
33389+ unsigned minor = iminor(inode);
33390 int ret;
33391
33392 spin_lock(&bpp_open_lock);
33393@@ -470,7 +470,7 @@
33394 */
33395 static int bpp_release(struct inode *inode, struct file *f)
33396 {
33397- unsigned minor = minor(inode->i_rdev);
33398+ unsigned minor = iminor(inode);
33399
33400 spin_lock(&bpp_open_lock);
33401 instances[minor].opened = 0;
33402@@ -634,7 +634,7 @@
33403 static ssize_t bpp_read(struct file *f, char *c, size_t cnt, loff_t * ppos)
33404 {
33405 long rc;
33406- const unsigned minor = minor(f->f_dentry->d_inode->i_rdev);
33407+ unsigned minor = iminor(f->f_dentry->d_inode);
33408 if (minor >= BPP_NO) return -ENODEV;
33409 if (!instances[minor].present) return -ENODEV;
33410
33411@@ -787,7 +787,7 @@
33412 static ssize_t bpp_write(struct file *f, const char *c, size_t cnt, loff_t * ppos)
33413 {
33414 long errno = 0;
33415- const unsigned minor = minor(f->f_dentry->d_inode->i_rdev);
33416+ unsigned minor = iminor(f->f_dentry->d_inode);
33417 if (minor >= BPP_NO) return -ENODEV;
33418 if (!instances[minor].present) return -ENODEV;
33419
33420@@ -813,7 +813,7 @@
33421 {
33422 int errno = 0;
33423
33424- unsigned minor = minor(inode->i_rdev);
33425+ unsigned minor = iminor(inode);
33426 if (minor >= BPP_NO) return -ENODEV;
33427 if (!instances[minor].present) return -ENODEV;
33428
33429diff -Nru a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
33430--- a/drivers/sbus/char/cpwatchdog.c Tue Apr 22 23:40:00 2003
33431+++ b/drivers/sbus/char/cpwatchdog.c Tue Aug 26 09:25:41 2003
33432@@ -295,7 +295,7 @@
33433
33434 static int wd_open(struct inode *inode, struct file *f)
33435 {
33436- switch(minor(inode->i_rdev))
33437+ switch(iminor(inode))
33438 {
33439 case WD0_MINOR:
33440 f->private_data = &wd_dev.watchdog[WD0_ID];
33441diff -Nru a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
33442--- a/drivers/sbus/char/display7seg.c Thu Jan 16 11:49:15 2003
33443+++ b/drivers/sbus/char/display7seg.c Tue Aug 26 09:25:41 2003
33444@@ -91,7 +91,7 @@
33445
33446 static int d7s_open(struct inode *inode, struct file *f)
33447 {
33448- if (D7S_MINOR != minor(inode->i_rdev))
33449+ if (D7S_MINOR != iminor(inode))
33450 return -ENODEV;
33451 atomic_inc(&d7s_users);
33452 return 0;
33453@@ -121,7 +121,7 @@
33454 __u8 regs = readb(d7s_regs);
33455 __u8 ireg = 0;
33456
33457- if (D7S_MINOR != minor(inode->i_rdev))
33458+ if (D7S_MINOR != iminor(inode))
33459 return -ENODEV;
33460
33461 switch (cmd) {
33462diff -Nru a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
33463--- a/drivers/sbus/char/vfc_dev.c Wed May 7 08:47:30 2003
33464+++ b/drivers/sbus/char/vfc_dev.c Tue Aug 26 09:25:41 2003
33465@@ -184,7 +184,7 @@
33466 struct vfc_dev *dev;
33467
33468 spin_lock(&vfc_dev_lock);
33469- dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
33470+ dev = vfc_get_dev_ptr(iminor(inode));
33471 if (dev == NULL) {
33472 spin_unlock(&vfc_dev_lock);
33473 return -ENODEV;
33474@@ -215,7 +215,7 @@
33475 struct vfc_dev *dev;
33476
33477 spin_lock(&vfc_dev_lock);
33478- dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
33479+ dev = vfc_get_dev_ptr(iminor(inode));
33480 if (!dev || !dev->busy) {
33481 spin_unlock(&vfc_dev_lock);
33482 return -EINVAL;
33483@@ -557,7 +557,7 @@
33484 unsigned int tmp;
33485 struct vfc_dev *dev;
33486
33487- dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
33488+ dev = vfc_get_dev_ptr(iminor(inode));
33489 if(dev == NULL)
33490 return -ENODEV;
33491
33492@@ -602,7 +602,7 @@
33493 VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCRDINFO)\n", dev->instance));
33494 break;
33495 default:
33496- ret = vfc_debug(vfc_get_dev_ptr(MINOR(inode->i_rdev)),
33497+ ret = vfc_debug(vfc_get_dev_ptr(iminor(inode)),
33498 cmd, arg);
33499 break;
33500 };
33501@@ -616,7 +616,7 @@
33502 unsigned int map_size, ret, map_offset;
33503 struct vfc_dev *dev;
33504
33505- dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
33506+ dev = vfc_get_dev_ptr(iminor(inode));
33507 if(dev == NULL)
33508 return -ENODEV;
33509
33510diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
33511--- a/drivers/scsi/3w-xxxx.c Sat Aug 16 11:46:50 2003
33512+++ b/drivers/scsi/3w-xxxx.c Tue Aug 26 09:25:41 2003
33513@@ -628,7 +628,7 @@
33514 unsigned long *cpu_addr;
33515 TW_New_Ioctl *tw_ioctl;
33516 TW_Passthru *passthru;
33517- TW_Device_Extension *tw_dev = tw_device_extension_list[minor(inode->i_rdev)];
33518+ TW_Device_Extension *tw_dev = tw_device_extension_list[iminor(inode)];
33519 int retval = -EFAULT;
33520
33521 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
33522@@ -786,7 +786,7 @@
33523
33524 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
33525
33526- minor_number = minor(inode->i_rdev);
33527+ minor_number = iminor(inode);
33528 if (minor_number >= tw_device_extension_count)
33529 return -ENODEV;
33530
33531diff -Nru a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
33532--- a/drivers/scsi/aacraid/linit.c Thu Jul 31 07:32:16 2003
33533+++ b/drivers/scsi/aacraid/linit.c Tue Aug 26 09:25:41 2003
33534@@ -565,7 +565,7 @@
33535
33536 static int aac_cfg_open(struct inode * inode, struct file * file )
33537 {
33538- unsigned minor_number = minor(inode->i_rdev);
33539+ unsigned minor_number = iminor(inode);
33540 if(minor_number >= aac_count)
33541 return -ENODEV;
33542 return 0;
33543@@ -601,7 +601,7 @@
33544
33545 static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg )
33546 {
33547- struct aac_dev *dev = aac_devices[minor(inode->i_rdev)];
33548+ struct aac_dev *dev = aac_devices[iminor(inode)];
33549 return aac_do_ioctl(dev, cmd, (void *)arg);
33550 }
33551
33552diff -Nru a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
33553--- a/drivers/scsi/advansys.c Fri May 2 12:35:39 2003
33554+++ b/drivers/scsi/advansys.c Sun Aug 31 16:15:44 2003
33555@@ -6199,7 +6199,9 @@
33556
33557 static Scsi_Host_Template driver_template = {
33558 .proc_name = "advansys",
33559+#ifdef CONFIG_PROC_FS
33560 .proc_info = advansys_proc_info,
33561+#endif
33562 .name = "advansys",
33563 .detect = advansys_detect,
33564 .release = advansys_release,
33565diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
33566--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c Thu Jun 19 16:46:06 2003
33567+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c Sun Aug 31 16:14:08 2003
33568@@ -72,10 +72,10 @@
33569 MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table);
33570
33571 struct pci_driver aic79xx_pci_driver = {
33572- name: "aic79xx",
33573- probe: ahd_linux_pci_dev_probe,
33574- remove: ahd_linux_pci_dev_remove,
33575- id_table: ahd_linux_pci_id_table
33576+ .name = "aic79xx",
33577+ .probe = ahd_linux_pci_dev_probe,
33578+ .remove = ahd_linux_pci_dev_remove,
33579+ .id_table = ahd_linux_pci_id_table
33580 };
33581
33582 static void
33583diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
33584--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c Wed May 14 15:00:40 2003
33585+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c Sun Aug 31 16:14:08 2003
33586@@ -75,10 +75,10 @@
33587 MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table);
33588
33589 struct pci_driver aic7xxx_pci_driver = {
33590- name: "aic7xxx",
33591- probe: ahc_linux_pci_dev_probe,
33592- remove: ahc_linux_pci_dev_remove,
33593- id_table: ahc_linux_pci_id_table
33594+ .name = "aic7xxx",
33595+ .probe = ahc_linux_pci_dev_probe,
33596+ .remove = ahc_linux_pci_dev_remove,
33597+ .id_table = ahc_linux_pci_id_table
33598 };
33599
33600 static void
33601diff -Nru a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
33602--- a/drivers/scsi/dpt_i2o.c Fri May 2 12:45:47 2003
33603+++ b/drivers/scsi/dpt_i2o.c Tue Aug 26 09:25:41 2003
33604@@ -1551,7 +1551,7 @@
33605
33606 //TODO check for root access
33607 //
33608- minor = minor(inode->i_rdev);
33609+ minor = iminor(inode);
33610 if (minor >= hba_count) {
33611 return -ENXIO;
33612 }
33613@@ -1582,7 +1582,7 @@
33614 int minor;
33615 adpt_hba* pHba;
33616
33617- minor = minor(inode->i_rdev);
33618+ minor = iminor(inode);
33619 if (minor >= hba_count) {
33620 return -ENXIO;
33621 }
33622@@ -1878,7 +1878,7 @@
33623 adpt_hba* pHba;
33624 ulong flags;
33625
33626- minor = minor(inode->i_rdev);
33627+ minor = iminor(inode);
33628 if (minor >= DPTI_MAX_HBA){
33629 return -ENXIO;
33630 }
33631diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
33632--- a/drivers/scsi/hosts.c Sat Aug 16 16:09:46 2003
33633+++ b/drivers/scsi/hosts.c Sun Aug 31 16:15:45 2003
33634@@ -158,7 +158,13 @@
33635 scsi_proc_hostdir_rm(shost->hostt);
33636 scsi_destroy_command_freelist(shost);
33637
33638- put_device(parent);
33639+ /*
33640+ * Some drivers (eg aha1542) do scsi_register()/scsi_unregister()
33641+ * during probing without performing a scsi_set_device() in between.
33642+ * In this case dev->parent is NULL.
33643+ */
33644+ if (parent)
33645+ put_device(parent);
33646 kfree(shost);
33647 }
33648
33649diff -Nru a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
33650--- a/drivers/scsi/nsp32.c Tue Aug 19 12:35:44 2003
33651+++ b/drivers/scsi/nsp32.c Sun Aug 31 16:14:08 2003
33652@@ -2809,13 +2809,13 @@
33653 for (j = 0; j < NUMBER(data->lunt[0]); j++) {
33654 int offset = i * NUMBER(data->lunt[0]) + j;
33655 nsp32_lunt tmp = {
33656- SCpnt: NULL,
33657- save_datp: 0,
33658- msgin03: FALSE,
33659- sg_num: 0,
33660- cur_entry: 0,
33661- sglun: &(data->sg_list[offset]),
33662- sglun_paddr: data->sg_paddr + (offset * sizeof(nsp32_sglun)),
33663+ .SCpnt = NULL,
33664+ .save_datp = 0,
33665+ .msgin03 = FALSE,
33666+ .sg_num = 0,
33667+ .cur_entry = 0,
33668+ .sglun = &(data->sg_list[offset]),
33669+ .sglun_paddr = data->sg_paddr + (offset * sizeof(nsp32_sglun)),
33670 };
33671
33672 data->lunt[i][j] = tmp;
33673diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c
33674--- a/drivers/scsi/osst.c Fri May 2 12:38:35 2003
33675+++ b/drivers/scsi/osst.c Tue Aug 26 09:25:41 2003
33676@@ -132,9 +132,9 @@
33677 #define OSST_TIMEOUT (200 * HZ)
33678 #define OSST_LONG_TIMEOUT (1800 * HZ)
33679
33680-#define TAPE_NR(x) (minor(x) & ~(-1 << ST_MODE_SHIFT))
33681-#define TAPE_MODE(x) ((minor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
33682-#define TAPE_REWIND(x) ((minor(x) & 0x80) == 0)
33683+#define TAPE_NR(x) (iminor(x) & ~(-1 << ST_MODE_SHIFT))
33684+#define TAPE_MODE(x) ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
33685+#define TAPE_REWIND(x) ((iminor(x) & 0x80) == 0)
33686 #define TAPE_IS_RAW(x) (TAPE_MODE(x) & (ST_NBR_MODES >> 1))
33687
33688 /* Internal ioctl to set both density (uppermost 8 bits) and blocksize (lower
33689@@ -4215,8 +4215,8 @@
33690 ST_mode * STm;
33691 ST_partstat * STps;
33692 char * name;
33693- int dev = TAPE_NR(inode->i_rdev);
33694- int mode = TAPE_MODE(inode->i_rdev);
33695+ int dev = TAPE_NR(inode);
33696+ int mode = TAPE_MODE(inode);
33697
33698 write_lock(&os_scsi_tapes_lock);
33699 if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
33700@@ -4244,7 +4244,7 @@
33701 filp->private_data = STp;
33702 STp->in_use = 1;
33703 write_unlock(&os_scsi_tapes_lock);
33704- STp->rew_at_close = TAPE_REWIND(inode->i_rdev);
33705+ STp->rew_at_close = TAPE_REWIND(inode);
33706
33707 if( !scsi_block_when_processing_errors(STp->device) ) {
33708 return -ENXIO;
33709@@ -4264,7 +4264,7 @@
33710 flags = filp->f_flags;
33711 STp->write_prot = ((flags & O_ACCMODE) == O_RDONLY);
33712
33713- STp->raw = TAPE_IS_RAW(inode->i_rdev);
33714+ STp->raw = TAPE_IS_RAW(inode);
33715 if (STp->raw)
33716 STp->header_ok = 0;
33717
33718diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
33719--- a/drivers/scsi/sg.c Sat Aug 16 11:46:50 2003
33720+++ b/drivers/scsi/sg.c Tue Aug 26 09:25:41 2003
33721@@ -238,7 +238,7 @@
33722 static int
33723 sg_open(struct inode *inode, struct file *filp)
33724 {
33725- int dev = minor(inode->i_rdev);
33726+ int dev = iminor(inode);
33727 int flags = filp->f_flags;
33728 Sg_device *sdp;
33729 Sg_fd *sfp;
33730diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
33731--- a/drivers/scsi/st.c Mon Aug 11 11:44:45 2003
33732+++ b/drivers/scsi/st.c Tue Aug 26 12:05:16 2003
33733@@ -140,8 +140,8 @@
33734 #define ST_TIMEOUT (900 * HZ)
33735 #define ST_LONG_TIMEOUT (14000 * HZ)
33736
33737-#define TAPE_NR(x) (minor(x) & ~(-1 << ST_MODE_SHIFT))
33738-#define TAPE_MODE(x) ((minor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
33739+#define TAPE_NR(x) (iminor(x) & ~(-1 << ST_MODE_SHIFT))
33740+#define TAPE_MODE(x) ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
33741
33742 /* Internal ioctl to set both density (uppermost 8 bits) and blocksize (lower
33743 24 bits) */
33744@@ -786,7 +786,7 @@
33745 ST_partstat *STps;
33746 char *name = tape_name(STp);
33747 struct inode *inode = filp->f_dentry->d_inode;
33748- int mode = TAPE_MODE(inode->i_rdev);
33749+ int mode = TAPE_MODE(inode);
33750
33751 STp->ready = ST_READY;
33752
33753@@ -980,7 +980,7 @@
33754 int i, retval = (-EIO);
33755 Scsi_Tape *STp;
33756 ST_partstat *STps;
33757- int dev = TAPE_NR(inode->i_rdev);
33758+ int dev = TAPE_NR(inode);
33759 char *name;
33760
33761 write_lock(&st_dev_arr_lock);
33762@@ -1004,7 +1004,7 @@
33763 }
33764 STp->in_use = 1;
33765 write_unlock(&st_dev_arr_lock);
33766- STp->rew_at_close = STp->autorew_dev = (minor(inode->i_rdev) & 0x80) == 0;
33767+ STp->rew_at_close = STp->autorew_dev = (iminor(inode) & 0x80) == 0;
33768
33769
33770 if (!scsi_block_when_processing_errors(STp->device)) {
33771diff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
33772--- a/drivers/serial/Kconfig Fri Aug 1 03:02:30 2003
33773+++ b/drivers/serial/Kconfig Sun Aug 24 08:17:18 2003
33774@@ -430,12 +430,12 @@
33775
33776 config SERIAL_CORE
33777 tristate
33778- default m if SERIAL_AMBA!=y && SERIAL_CLPS711X!=y && SERIAL_21285!=y && !SERIAL_SA1100 && !SERIAL_ANAKIN && !SERIAL_UART00 && SERIAL_8250!=y && SERIAL_MUX!=y && !SERIAL_ROCKETPORT && !SERIAL_SUNCORE && !V850E_UART && (SERIAL_AMBA=m || SERIAL_CLPS711X=m || SERIAL_21285=m || SERIAL_8250=m || SERIAL_MUX=m || SERIAL98=m)
33779- default y if SERIAL_AMBA=y || SERIAL_CLPS711X=y || SERIAL_21285=y || SERIAL_SA1100 || SERIAL_ANAKIN || SERIAL_UART00 || SERIAL_8250=y || SERIAL_MUX=y || SERIAL_ROCKETPORT || SERIAL_SUNCORE || V850E_UART || SERIAL98=y
33780+ default m if SERIAL_AMBA!=y && SERIAL_CLPS711X!=y && SERIAL_21285!=y && !SERIAL_SA1100 && !SERIAL_ANAKIN && !SERIAL_UART00 && SERIAL_8250!=y && SERIAL_MUX!=y && !SERIAL_ROCKETPORT && !SERIAL_SUNCORE && !V850E_UART && SERIAL_PMACZILOG!=y && (SERIAL_AMBA=m || SERIAL_CLPS711X=m || SERIAL_21285=m || SERIAL_8250=m || SERIAL_MUX=m || SERIAL98=m || SERIAL_PMACZILOG=m)
33781+ default y if SERIAL_AMBA=y || SERIAL_CLPS711X=y || SERIAL_21285=y || SERIAL_SA1100 || SERIAL_ANAKIN || SERIAL_UART00 || SERIAL_8250=y || SERIAL_MUX=y || SERIAL_ROCKETPORT || SERIAL_SUNCORE || V850E_UART || SERIAL98=y || SERIAL_PMACZILOG=y
33782
33783 config SERIAL_CORE_CONSOLE
33784 bool
33785- depends on SERIAL_AMBA_CONSOLE || SERIAL_CLPS711X_CONSOLE || SERIAL_21285_CONSOLE || SERIAL_SA1100_CONSOLE || SERIAL_ANAKIN_CONSOLE || SERIAL_UART00_CONSOLE || SERIAL_8250_CONSOLE || SERIAL_MUX_CONSOLE || SERIAL_SUNZILOG_CONSOLE || SERIAL_SUNSU_CONSOLE || SERIAL_SUNSAB_CONSOLE || V850E_UART_CONSOLE || SERIAL98_CONSOLE
33786+ depends on SERIAL_AMBA_CONSOLE || SERIAL_CLPS711X_CONSOLE || SERIAL_21285_CONSOLE || SERIAL_SA1100_CONSOLE || SERIAL_ANAKIN_CONSOLE || SERIAL_UART00_CONSOLE || SERIAL_8250_CONSOLE || SERIAL_MUX_CONSOLE || SERIAL_SUNZILOG_CONSOLE || SERIAL_SUNSU_CONSOLE || SERIAL_SUNSAB_CONSOLE || V850E_UART_CONSOLE || SERIAL98_CONSOLE || SERIAL_PMACZILOG_CONSOLE
33787 default y
33788
33789 config SERIAL_68328
33790@@ -472,6 +472,22 @@
33791 bool
33792 depends on SERIAL_68360_SMC || SERIAL_68360_SCC
33793 default y
33794+
33795+config SERIAL_PMACZILOG
33796+ tristate "PowerMac z85c30 ESCC support"
33797+ depends on PPC_OF
33798+ help
33799+ This driver supports the Zilog z85C30 serial ports found on
33800+ PowerMac machines.
33801+ Say Y or M if you want to be able to these serial ports.
33802+
33803+config SERIAL_PMACZILOG_CONSOLE
33804+ bool "Console on PowerMac z85c30 serial port"
33805+ depends on SERIAL_PMACZILOG=y
33806+ help
33807+ If you would like to be able to use the z85c30 serial port
33808+ on your PowerMac as the console, you can do so by answering
33809+ Y to this option.
33810
33811 endmenu
33812
33813diff -Nru a/drivers/serial/Makefile b/drivers/serial/Makefile
33814--- a/drivers/serial/Makefile Tue Jul 15 03:23:50 2003
33815+++ b/drivers/serial/Makefile Sun Aug 24 08:17:18 2003
33816@@ -31,3 +31,4 @@
33817 obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
33818 obj-$(CONFIG_V850E_UART) += v850e_uart.o
33819 obj-$(CONFIG_SERIAL98) += serial98.o
33820+obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
33821diff -Nru a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
33822--- /dev/null Wed Dec 31 16:00:00 1969
33823+++ b/drivers/serial/pmac_zilog.c Sun Aug 24 08:05:53 2003
33824@@ -0,0 +1,1626 @@
33825+/*
33826+ * linux/drivers/serial/pmac_zilog.c
33827+ *
33828+ * Driver for PowerMac Z85c30 based ESCC cell found in the
33829+ * "macio" ASICs of various PowerMac models
33830+ *
33831+ * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org)
33832+ *
33833+ * Derived from drivers/macintosh/macserial.c by Paul Mackerras
33834+ * and drivers/serial/sunzilog.c by David S. Miller
33835+ *
33836+ * Hrm... actually, I ripped most of sunzilog (Thanks David !) and
33837+ * adapted special tweaks needed for us. I don't think it's worth
33838+ * merging back those though. The DMA code still has to get in
33839+ * and once done, I expect that driver to remain fairly stable in
33840+ * the long term, unless we change the driver model again...
33841+ *
33842+ * This program is free software; you can redistribute it and/or modify
33843+ * it under the terms of the GNU General Public License as published by
33844+ * the Free Software Foundation; either version 2 of the License, or
33845+ * (at your option) any later version.
33846+ *
33847+ * This program is distributed in the hope that it will be useful,
33848+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
33849+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33850+ * GNU General Public License for more details.
33851+ *
33852+ * You should have received a copy of the GNU General Public License
33853+ * along with this program; if not, write to the Free Software
33854+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33855+ *
33856+ * TODO: - Add DMA support
33857+ * - Defer port shutdown to a few seconds after close
33858+ * - maybe put something right into up->clk_divisor
33859+ */
33860+
33861+#undef DEBUG
33862+
33863+#include <linux/config.h>
33864+#include <linux/module.h>
33865+#include <linux/tty.h>
33866+
33867+#include <linux/tty_flip.h>
33868+#include <linux/major.h>
33869+#include <linux/string.h>
33870+#include <linux/fcntl.h>
33871+#include <linux/mm.h>
33872+#include <linux/kernel.h>
33873+#include <linux/delay.h>
33874+#include <linux/init.h>
33875+#include <linux/console.h>
33876+#include <linux/slab.h>
33877+#include <linux/adb.h>
33878+#include <linux/pmu.h>
33879+#include <asm/sections.h>
33880+#include <asm/io.h>
33881+#include <asm/irq.h>
33882+#include <asm/prom.h>
33883+#include <asm/bitops.h>
33884+#include <asm/machdep.h>
33885+#include <asm/pmac_feature.h>
33886+#include <asm/kgdb.h>
33887+#include <asm/dbdma.h>
33888+#include <asm/macio.h>
33889+
33890+#include <linux/serial.h>
33891+#include <linux/serial_core.h>
33892+
33893+#include "pmac_zilog.h"
33894+
33895+
33896+/* Not yet implemented */
33897+#undef HAS_DBDMA
33898+
33899+static char version[] __initdata = "pmac_zilog.c 0.5a (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
33900+MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
33901+MODULE_DESCRIPTION("Driver for the PowerMac serial ports.");
33902+MODULE_LICENSE("GPL");
33903+
33904+#define PWRDBG(fmt, arg...) printk(KERN_DEBUG fmt , ## arg)
33905+
33906+
33907+/*
33908+ * For the sake of early serial console, we can do a pre-probe
33909+ * (optional) of the ports at rather early boot time.
33910+ */
33911+static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS];
33912+static int pmz_ports_count;
33913+
33914+
33915+/*
33916+ * Load all registers to reprogram the port
33917+ * This function must only be called when the TX is not busy. The UART
33918+ * port lock must be held and local interrupts disabled.
33919+ */
33920+static void pmz_load_zsregs(struct uart_pmac_port *up, u8 *regs)
33921+{
33922+ int i;
33923+
33924+ /* Let pending transmits finish. */
33925+ for (i = 0; i < 1000; i++) {
33926+ unsigned char stat = read_zsreg(up, R1);
33927+ if (stat & ALL_SNT)
33928+ break;
33929+ udelay(100);
33930+ }
33931+
33932+ ZS_CLEARERR(up);
33933+ zssync(up);
33934+ ZS_CLEARFIFO(up);
33935+ zssync(up);
33936+ ZS_CLEARERR(up);
33937+
33938+ /* Disable all interrupts. */
33939+ write_zsreg(up, R1,
33940+ regs[R1] & ~(RxINT_MASK | TxINT_ENAB | EXT_INT_ENAB));
33941+
33942+ /* Set parity, sync config, stop bits, and clock divisor. */
33943+ write_zsreg(up, R4, regs[R4]);
33944+
33945+ /* Set misc. TX/RX control bits. */
33946+ write_zsreg(up, R10, regs[R10]);
33947+
33948+ /* Set TX/RX controls sans the enable bits. */
33949+ write_zsreg(up, R3, regs[R3] & ~RxENABLE);
33950+ write_zsreg(up, R5, regs[R5] & ~TxENABLE);
33951+
33952+ /* Synchronous mode config. */
33953+ write_zsreg(up, R6, regs[R6]);
33954+ write_zsreg(up, R7, regs[R7]);
33955+
33956+ /* Disable baud generator. */
33957+ write_zsreg(up, R14, regs[R14] & ~BRENAB);
33958+
33959+ /* Clock mode control. */
33960+ write_zsreg(up, R11, regs[R11]);
33961+
33962+ /* Lower and upper byte of baud rate generator divisor. */
33963+ write_zsreg(up, R12, regs[R12]);
33964+ write_zsreg(up, R13, regs[R13]);
33965+
33966+ /* Now rewrite R14, with BRENAB (if set). */
33967+ write_zsreg(up, R14, regs[R14]);
33968+
33969+ /* External status interrupt control. */
33970+ write_zsreg(up, R15, regs[R15]);
33971+
33972+ /* Reset external status interrupts. */
33973+ write_zsreg(up, R0, RES_EXT_INT);
33974+ write_zsreg(up, R0, RES_EXT_INT);
33975+
33976+ /* Rewrite R3/R5, this time without enables masked. */
33977+ write_zsreg(up, R3, regs[R3]);
33978+ write_zsreg(up, R5, regs[R5]);
33979+
33980+ /* Rewrite R1, this time without IRQ enabled masked. */
33981+ write_zsreg(up, R1, regs[R1]);
33982+
33983+ /* Enable interrupts */
33984+ write_zsreg(up, R9, regs[R9]);
33985+}
33986+
33987+/*
33988+ * We do like sunzilog to avoid disrupting pending Tx
33989+ * Reprogram the Zilog channel HW registers with the copies found in the
33990+ * software state struct. If the transmitter is busy, we defer this update
33991+ * until the next TX complete interrupt. Else, we do it right now.
33992+ *
33993+ * The UART port lock must be held and local interrupts disabled.
33994+ */
33995+static void pmz_maybe_update_regs(struct uart_pmac_port *up)
33996+{
33997+#if 1
33998+ if (!ZS_REGS_HELD(up)) {
33999+ if (ZS_TX_ACTIVE(up)) {
34000+ up->flags |= PMACZILOG_FLAG_REGS_HELD;
34001+ } else {
34002+ pr_debug("pmz: maybe_update_regs: updating\n");
34003+ pmz_load_zsregs(up, up->curregs);
34004+ }
34005+ }
34006+#else
34007+ pr_debug("pmz: maybe_update_regs: updating\n");
34008+ pmz_load_zsregs(up, up->curregs);
34009+#endif
34010+}
34011+
34012+static void pmz_receive_chars(struct uart_pmac_port *up, struct pt_regs *regs)
34013+{
34014+ struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */
34015+
34016+ while (1) {
34017+ unsigned char ch, r1;
34018+
34019+ if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
34020+ tty->flip.work.func((void *)tty);
34021+ if (tty->flip.count >= TTY_FLIPBUF_SIZE)
34022+ /* XXX Ignores SysRq when we need it most. Fix. */
34023+ return;
34024+ }
34025+
34026+ r1 = read_zsreg(up, R1);
34027+ if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
34028+ write_zsreg(up, R0, ERR_RES);
34029+ zssync(up);
34030+ }
34031+
34032+ ch = read_zsreg(up, R0);
34033+
34034+ /* This funny hack depends upon BRK_ABRT not interfering
34035+ * with the other bits we care about in R1.
34036+ */
34037+ if (ch & BRK_ABRT)
34038+ r1 |= BRK_ABRT;
34039+
34040+ ch = read_zsdata(up);
34041+ ch &= up->parity_mask;
34042+
34043+ /* A real serial line, record the character and status. */
34044+ *tty->flip.char_buf_ptr = ch;
34045+ *tty->flip.flag_buf_ptr = TTY_NORMAL;
34046+ up->port.icount.rx++;
34047+ if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) {
34048+ if (r1 & BRK_ABRT) {
34049+ r1 &= ~(PAR_ERR | CRC_ERR);
34050+ up->port.icount.brk++;
34051+ if (uart_handle_break(&up->port))
34052+ goto next_char;
34053+ }
34054+ else if (r1 & PAR_ERR)
34055+ up->port.icount.parity++;
34056+ else if (r1 & CRC_ERR)
34057+ up->port.icount.frame++;
34058+ if (r1 & Rx_OVR)
34059+ up->port.icount.overrun++;
34060+ r1 &= up->port.read_status_mask;
34061+ if (r1 & BRK_ABRT)
34062+ *tty->flip.flag_buf_ptr = TTY_BREAK;
34063+ else if (r1 & PAR_ERR)
34064+ *tty->flip.flag_buf_ptr = TTY_PARITY;
34065+ else if (r1 & CRC_ERR)
34066+ *tty->flip.flag_buf_ptr = TTY_FRAME;
34067+ }
34068+ if (uart_handle_sysrq_char(&up->port, ch, regs))
34069+ goto next_char;
34070+
34071+ if (up->port.ignore_status_mask == 0xff ||
34072+ (r1 & up->port.ignore_status_mask) == 0) {
34073+ tty->flip.flag_buf_ptr++;
34074+ tty->flip.char_buf_ptr++;
34075+ tty->flip.count++;
34076+ }
34077+ if ((r1 & Rx_OVR) &&
34078+ tty->flip.count < TTY_FLIPBUF_SIZE) {
34079+ *tty->flip.flag_buf_ptr = TTY_OVERRUN;
34080+ tty->flip.flag_buf_ptr++;
34081+ tty->flip.char_buf_ptr++;
34082+ tty->flip.count++;
34083+ }
34084+ next_char:
34085+ ch = read_zsreg(up, R0);
34086+ if (!(ch & Rx_CH_AV))
34087+ break;
34088+ }
34089+
34090+ tty_flip_buffer_push(tty);
34091+}
34092+
34093+static void pmz_status_handle(struct uart_pmac_port *up, struct pt_regs *regs)
34094+{
34095+ unsigned char status;
34096+
34097+ status = read_zsreg(up, R0);
34098+ write_zsreg(up, R0, RES_EXT_INT);
34099+ zssync(up);
34100+
34101+ if (ZS_WANTS_MODEM_STATUS(up)) {
34102+ if (status & SYNC_HUNT)
34103+ up->port.icount.dsr++;
34104+
34105+ /* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
34106+ * But it does not tell us which bit has changed, we have to keep
34107+ * track of this ourselves.
34108+ */
34109+ if ((status & DCD) ^ up->prev_status)
34110+ uart_handle_dcd_change(&up->port,
34111+ (status & DCD));
34112+ if ((status & CTS) ^ up->prev_status)
34113+ uart_handle_cts_change(&up->port,
34114+ (status & CTS));
34115+
34116+ wake_up_interruptible(&up->port.info->delta_msr_wait);
34117+ }
34118+
34119+ up->prev_status = status;
34120+}
34121+
34122+static void pmz_transmit_chars(struct uart_pmac_port *up)
34123+{
34124+ struct circ_buf *xmit;
34125+
34126+ if (ZS_IS_CONS(up)) {
34127+ unsigned char status = read_zsreg(up, R0);
34128+
34129+ /* TX still busy? Just wait for the next TX done interrupt.
34130+ *
34131+ * It can occur because of how we do serial console writes. It would
34132+ * be nice to transmit console writes just like we normally would for
34133+ * a TTY line. (ie. buffered and TX interrupt driven). That is not
34134+ * easy because console writes cannot sleep. One solution might be
34135+ * to poll on enough port->xmit space becomming free. -DaveM
34136+ */
34137+ if (!(status & Tx_BUF_EMP))
34138+ return;
34139+ }
34140+
34141+ up->flags &= ~PMACZILOG_FLAG_TX_ACTIVE;
34142+
34143+ if (ZS_REGS_HELD(up)) {
34144+ pmz_load_zsregs(up, up->curregs);
34145+ up->flags &= ~PMACZILOG_FLAG_REGS_HELD;
34146+ }
34147+
34148+ if (ZS_TX_STOPPED(up)) {
34149+ up->flags &= ~PMACZILOG_FLAG_TX_STOPPED;
34150+ goto ack_tx_int;
34151+ }
34152+
34153+ if (up->port.x_char) {
34154+ up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
34155+ write_zsdata(up, up->port.x_char);
34156+ zssync(up);
34157+ up->port.icount.tx++;
34158+ up->port.x_char = 0;
34159+ return;
34160+ }
34161+
34162+ if (up->port.info == NULL)
34163+ goto ack_tx_int;
34164+ xmit = &up->port.info->xmit;
34165+ if (uart_circ_empty(xmit)) {
34166+ uart_write_wakeup(&up->port);
34167+ goto ack_tx_int;
34168+ }
34169+ if (uart_tx_stopped(&up->port))
34170+ goto ack_tx_int;
34171+
34172+ up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
34173+ write_zsdata(up, xmit->buf[xmit->tail]);
34174+ zssync(up);
34175+
34176+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
34177+ up->port.icount.tx++;
34178+
34179+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
34180+ uart_write_wakeup(&up->port);
34181+
34182+ return;
34183+
34184+ack_tx_int:
34185+ write_zsreg(up, R0, RES_Tx_P);
34186+ zssync(up);
34187+}
34188+
34189+/* Hrm... we register that twice, fixme later.... */
34190+static irqreturn_t pmz_interrupt(int irq, void *dev_id, struct pt_regs *regs)
34191+{
34192+ struct uart_pmac_port *up = dev_id;
34193+ struct uart_pmac_port *up_a;
34194+ struct uart_pmac_port *up_b;
34195+ int rc = IRQ_NONE;
34196+ u8 r3;
34197+
34198+ up_a = ZS_IS_CHANNEL_A(up) ? up : up->mate;
34199+ up_b = up_a->mate;
34200+
34201+ spin_lock(&up_a->port.lock);
34202+ r3 = read_zsreg(up, R3);
34203+ pr_debug("pmz_irq: %x\n", r3);
34204+
34205+ /* Channel A */
34206+ if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
34207+ write_zsreg(up_a, R0, RES_H_IUS);
34208+ zssync(up_a);
34209+ pr_debug("pmz: irq channel A: %x\n", r3);
34210+ if (r3 & CHARxIP)
34211+ pmz_receive_chars(up_a, regs);
34212+ if (r3 & CHAEXT)
34213+ pmz_status_handle(up_a, regs);
34214+ if (r3 & CHATxIP)
34215+ pmz_transmit_chars(up_a);
34216+ rc = IRQ_HANDLED;
34217+ }
34218+ spin_unlock(&up_a->port.lock);
34219+
34220+ spin_lock(&up_b->port.lock);
34221+ if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
34222+ write_zsreg(up_b, R0, RES_H_IUS);
34223+ zssync(up_b);
34224+ pr_debug("pmz: irq channel B: %x\n", r3);
34225+ if (r3 & CHBRxIP)
34226+ pmz_receive_chars(up_b, regs);
34227+ if (r3 & CHBEXT)
34228+ pmz_status_handle(up_b, regs);
34229+ if (r3 & CHBTxIP)
34230+ pmz_transmit_chars(up_b);
34231+ rc = IRQ_HANDLED;
34232+ }
34233+ spin_unlock(&up_b->port.lock);
34234+
34235+
34236+ return rc;
34237+}
34238+
34239+/*
34240+ * Peek the status register, lock not held by caller
34241+ */
34242+static inline u8 pmz_peek_status(struct uart_pmac_port *up)
34243+{
34244+ unsigned long flags;
34245+ u8 status;
34246+
34247+ spin_lock_irqsave(&up->port.lock, flags);
34248+ status = read_zsreg(up, R0);
34249+ spin_unlock_irqrestore(&up->port.lock, flags);
34250+
34251+ return status;
34252+}
34253+
34254+/*
34255+ * Check if transmitter is empty
34256+ * The port lock is not held.
34257+ */
34258+static unsigned int pmz_tx_empty(struct uart_port *port)
34259+{
34260+ unsigned char status;
34261+
34262+ status = pmz_peek_status(to_pmz(port));
34263+ if (status & Tx_BUF_EMP)
34264+ return TIOCSER_TEMT;
34265+ return 0;
34266+}
34267+
34268+/*
34269+ * Set Modem Control (RTS & DTR) bits
34270+ * The port lock is held and interrupts are disabled.
34271+ * Note: Shall we really filter out RTS on external ports or
34272+ * should that be dealt at higher level only ?
34273+ */
34274+static void pmz_set_mctrl(struct uart_port *port, unsigned int mctrl)
34275+{
34276+ struct uart_pmac_port *up = to_pmz(port);
34277+ unsigned char set_bits, clear_bits;
34278+
34279+ /* Do nothing for irda for now... */
34280+ if (ZS_IS_IRDA(up))
34281+ return;
34282+
34283+ set_bits = clear_bits = 0;
34284+
34285+ if (ZS_IS_INTMODEM(up)) {
34286+ if (mctrl & TIOCM_RTS)
34287+ set_bits |= RTS;
34288+ else
34289+ clear_bits |= RTS;
34290+ }
34291+ if (mctrl & TIOCM_DTR)
34292+ set_bits |= DTR;
34293+ else
34294+ clear_bits |= DTR;
34295+
34296+ /* NOTE: Not subject to 'transmitter active' rule. */
34297+ up->curregs[R5] |= set_bits;
34298+ up->curregs[R5] &= ~clear_bits;
34299+ write_zsreg(up, R5, up->curregs[R5]);
34300+ zssync(up);
34301+}
34302+
34303+/*
34304+ * Get Modem Control bits (only the input ones, the core will
34305+ * or that with a cached value of the control ones)
34306+ * The port lock is not held.
34307+ */
34308+static unsigned int pmz_get_mctrl(struct uart_port *port)
34309+{
34310+ unsigned char status;
34311+ unsigned int ret;
34312+
34313+ status = pmz_peek_status(to_pmz(port));
34314+
34315+ ret = 0;
34316+ if (status & DCD)
34317+ ret |= TIOCM_CAR;
34318+ if (status & SYNC_HUNT)
34319+ ret |= TIOCM_DSR;
34320+ if (status & CTS)
34321+ ret |= TIOCM_CTS;
34322+
34323+ return ret;
34324+}
34325+
34326+/*
34327+ * Stop TX side. Dealt like sunzilog at next Tx interrupt,
34328+ * though for DMA, we will have to do a bit more. What is
34329+ * the meaning of the tty_stop bit ? XXX
34330+ * The port lock is held and interrupts are disabled.
34331+ */
34332+static void pmz_stop_tx(struct uart_port *port, unsigned int tty_stop)
34333+{
34334+ to_pmz(port)->flags |= PMACZILOG_FLAG_TX_STOPPED;
34335+}
34336+
34337+/*
34338+ * Kick the Tx side.
34339+ * The port lock is held and interrupts are disabled.
34340+ */
34341+static void pmz_start_tx(struct uart_port *port, unsigned int tty_start)
34342+{
34343+ struct uart_pmac_port *up = to_pmz(port);
34344+ unsigned char status;
34345+
34346+ pr_debug("pmz: start_tx()\n");
34347+
34348+ up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
34349+ up->flags &= ~PMACZILOG_FLAG_TX_STOPPED;
34350+
34351+ status = read_zsreg(up, R0);
34352+
34353+ /* TX busy? Just wait for the TX done interrupt. */
34354+ if (!(status & Tx_BUF_EMP))
34355+ return;
34356+
34357+ /* Send the first character to jump-start the TX done
34358+ * IRQ sending engine.
34359+ */
34360+ if (port->x_char) {
34361+ write_zsdata(up, port->x_char);
34362+ zssync(up);
34363+ port->icount.tx++;
34364+ port->x_char = 0;
34365+ } else {
34366+ struct circ_buf *xmit = &port->info->xmit;
34367+
34368+ write_zsdata(up, xmit->buf[xmit->tail]);
34369+ zssync(up);
34370+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
34371+ port->icount.tx++;
34372+
34373+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
34374+ uart_write_wakeup(&up->port);
34375+ }
34376+ pr_debug("pmz: start_tx() done.\n");
34377+}
34378+
34379+/*
34380+ * Stop Rx side, basically disable emitting of
34381+ * Rx interrupts on the port
34382+ * The port lock is held.
34383+ */
34384+static void pmz_stop_rx(struct uart_port *port)
34385+{
34386+ struct uart_pmac_port *up = to_pmz(port);
34387+
34388+ if (ZS_IS_CONS(up))
34389+ return;
34390+
34391+ pr_debug("pmz: stop_rx()()\n");
34392+
34393+ /* Disable all RX interrupts. */
34394+ up->curregs[R1] &= ~RxINT_MASK;
34395+ pmz_maybe_update_regs(up);
34396+
34397+ pr_debug("pmz: stop_rx() done.\n");
34398+}
34399+
34400+/*
34401+ * Enable modem status change interrupts
34402+ * The port lock is not held.
34403+ */
34404+static void pmz_enable_ms(struct uart_port *port)
34405+{
34406+ struct uart_pmac_port *up = to_pmz(port);
34407+ unsigned char new_reg;
34408+ unsigned long flags;
34409+
34410+ spin_lock_irqsave(&port->lock, flags);
34411+
34412+ new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE);
34413+ if (new_reg != up->curregs[R15]) {
34414+ up->curregs[R15] = new_reg;
34415+
34416+ /* NOTE: Not subject to 'transmitter active' rule. */
34417+ write_zsreg(up, R15, up->curregs[R15]);
34418+ }
34419+
34420+ spin_unlock_irqrestore(&port->lock, flags);
34421+}
34422+
34423+/*
34424+ * Control break state emission
34425+ * The port lock is not held.
34426+ */
34427+static void pmz_break_ctl(struct uart_port *port, int break_state)
34428+{
34429+ struct uart_pmac_port *up = to_pmz(port);
34430+ unsigned char set_bits, clear_bits, new_reg;
34431+ unsigned long flags;
34432+
34433+ set_bits = clear_bits = 0;
34434+
34435+ if (break_state)
34436+ set_bits |= SND_BRK;
34437+ else
34438+ clear_bits |= SND_BRK;
34439+
34440+ spin_lock_irqsave(&port->lock, flags);
34441+
34442+ new_reg = (up->curregs[R5] | set_bits) & ~clear_bits;
34443+ if (new_reg != up->curregs[R5]) {
34444+ up->curregs[R5] = new_reg;
34445+
34446+ /* NOTE: Not subject to 'transmitter active' rule. */
34447+ write_zsreg(up, R5, up->curregs[R5]);
34448+ }
34449+
34450+ spin_unlock_irqrestore(&port->lock, flags);
34451+}
34452+
34453+/*
34454+ * Turn power on or off to the SCC and associated stuff
34455+ * (port drivers, modem, IR port, etc.)
34456+ * Returns the number of milliseconds we should wait before
34457+ * trying to use the port.
34458+ */
34459+static int pmz_set_scc_power(struct uart_pmac_port *up, int state)
34460+{
34461+ int delay = 0;
34462+
34463+ if (state) {
34464+ pmac_call_feature(
34465+ PMAC_FTR_SCC_ENABLE, up->node, up->port_type, 1);
34466+ if (ZS_IS_INTMODEM(up)) {
34467+ pmac_call_feature(
34468+ PMAC_FTR_MODEM_ENABLE, up->node, 0, 1);
34469+ delay = 2500; /* wait for 2.5s before using */
34470+ } else if (ZS_IS_IRDA(up))
34471+ mdelay(50); /* Do better here once the problems
34472+ * with blocking have been ironed out
34473+ */
34474+ } else {
34475+ /* TODO: Make that depend on a timer, don't power down
34476+ * immediately
34477+ */
34478+ if (ZS_IS_INTMODEM(up)) {
34479+ pmac_call_feature(
34480+ PMAC_FTR_MODEM_ENABLE, up->node, 0, 0);
34481+ }
34482+ pmac_call_feature(
34483+ PMAC_FTR_SCC_ENABLE, up->node, up->port_type, 0);
34484+ }
34485+ return delay;
34486+}
34487+
34488+/*
34489+ * FixZeroBug....Works around a bug in the SCC receving channel.
34490+ * Taken from Darwin code, 15 Sept. 2000 -DanM
34491+ *
34492+ * The following sequence prevents a problem that is seen with O'Hare ASICs
34493+ * (most versions -- also with some Heathrow and Hydra ASICs) where a zero
34494+ * at the input to the receiver becomes 'stuck' and locks up the receiver.
34495+ * This problem can occur as a result of a zero bit at the receiver input
34496+ * coincident with any of the following events:
34497+ *
34498+ * The SCC is initialized (hardware or software).
34499+ * A framing error is detected.
34500+ * The clocking option changes from synchronous or X1 asynchronous
34501+ * clocking to X16, X32, or X64 asynchronous clocking.
34502+ * The decoding mode is changed among NRZ, NRZI, FM0, or FM1.
34503+ *
34504+ * This workaround attempts to recover from the lockup condition by placing
34505+ * the SCC in synchronous loopback mode with a fast clock before programming
34506+ * any of the asynchronous modes.
34507+ */
34508+static void pmz_fix_zero_bug_scc(struct uart_pmac_port *up)
34509+{
34510+ write_zsreg(up, 9, ZS_IS_CHANNEL_A(up) ? CHRA : CHRB);
34511+ zssync(up);
34512+ udelay(10);
34513+ write_zsreg(up, 9, (ZS_IS_CHANNEL_A(up) ? CHRA : CHRB) | NV);
34514+ zssync(up);
34515+
34516+ write_zsreg(up, 4, (X1CLK | EXTSYNC));
34517+
34518+ /* I think this is wrong....but, I just copying code....
34519+ */
34520+ write_zsreg(up, 3, (8 & ~RxENABLE));
34521+
34522+ write_zsreg(up, 5, (8 & ~TxENABLE));
34523+ write_zsreg(up, 9, NV); /* Didn't we already do this? */
34524+ write_zsreg(up, 11, (RCBR | TCBR));
34525+ write_zsreg(up, 12, 0);
34526+ write_zsreg(up, 13, 0);
34527+ write_zsreg(up, 14, (LOOPBAK | SSBR));
34528+ write_zsreg(up, 14, (LOOPBAK | SSBR | BRENAB));
34529+ write_zsreg(up, 3, (8 | RxENABLE));
34530+ write_zsreg(up, 0, RES_EXT_INT);
34531+ write_zsreg(up, 0, RES_EXT_INT); /* to kill some time */
34532+
34533+ /* The channel should be OK now, but it is probably receiving
34534+ * loopback garbage.
34535+ * Switch to asynchronous mode, disable the receiver,
34536+ * and discard everything in the receive buffer.
34537+ */
34538+ write_zsreg(up, 9, NV);
34539+ write_zsreg(up, 4, PAR_ENAB);
34540+ write_zsreg(up, 3, (8 & ~RxENABLE));
34541+
34542+ while (read_zsreg(up, 0) & Rx_CH_AV) {
34543+ (void)read_zsreg(up, 8);
34544+ write_zsreg(up, 0, RES_EXT_INT);
34545+ write_zsreg(up, 0, ERR_RES);
34546+ }
34547+}
34548+
34549+/*
34550+ * Real startup routine, powers up the hardware and sets up
34551+ * the SCC. Returns a delay in ms where you need to wait before
34552+ * actually using the port, this is typically the internal modem
34553+ * powerup delay. This routine expect the lock to be taken.
34554+ */
34555+static int __pmz_startup(struct uart_pmac_port *up)
34556+{
34557+ int pwr_delay = 0;
34558+
34559+ memset(&up->curregs, 0, sizeof(up->curregs));
34560+
34561+ /* Power up the SCC & underlying hardware (modem/irda) */
34562+ pwr_delay = pmz_set_scc_power(up, 1);
34563+
34564+ /* Nice buggy HW ... */
34565+ pmz_fix_zero_bug_scc(up);
34566+
34567+ /* Reset the chip */
34568+ write_zsreg(up, 9, ZS_IS_CHANNEL_A(up) ? CHRA : CHRB);
34569+ zssync(up);
34570+ udelay(10);
34571+ write_zsreg(up, 9, 0);
34572+ zssync(up);
34573+
34574+ /* Clear the interrupt registers */
34575+ write_zsreg(up, R1, 0);
34576+ write_zsreg(up, R0, ERR_RES);
34577+ write_zsreg(up, R0, ERR_RES);
34578+ write_zsreg(up, R0, RES_H_IUS);
34579+ write_zsreg(up, R0, RES_H_IUS);
34580+
34581+ /* Remember status for DCD/CTS changes */
34582+ up->prev_status = read_zsreg(up, R0);
34583+
34584+ /* Enable receiver and transmitter. */
34585+ up->curregs[R3] |= RxENABLE;
34586+ up->curregs[R5] |= TxENABLE | RTS | DTR;
34587+
34588+ /* Master interrupt enable */
34589+ up->curregs[R9] |= NV | MIE;
34590+
34591+ up->curregs[R1] |= EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
34592+ // pmz_maybe_update_regs(up);
34593+
34594+ return pwr_delay;
34595+}
34596+
34597+/*
34598+ * This is the "normal" startup routine, using the above one
34599+ * wrapped with the lock and doing a schedule delay
34600+ */
34601+static int pmz_startup(struct uart_port *port)
34602+{
34603+ struct uart_pmac_port *up = to_pmz(port);
34604+ unsigned long flags;
34605+ int pwr_delay = 0;
34606+
34607+ pr_debug("pmz: startup()\n");
34608+
34609+ /* A console is never powered down */
34610+ if (!ZS_IS_CONS(up)) {
34611+ spin_lock_irqsave(&port->lock, flags);
34612+ pwr_delay = __pmz_startup(up);
34613+ spin_unlock_irqrestore(&port->lock, flags);
34614+ }
34615+
34616+ if (request_irq(up->port.irq, pmz_interrupt, SA_SHIRQ, "PowerMac Zilog", up)) {
34617+ printk(KERN_ERR "Unable to register zs interrupt handler.\n");
34618+ pmz_set_scc_power(up, 0);
34619+ return -ENXIO;
34620+ }
34621+
34622+ /* Right now, we deal with delay by blocking here, I'll be
34623+ * smarter later on
34624+ */
34625+ if (pwr_delay != 0) {
34626+ pr_debug("pmz: delaying %d ms\n", pwr_delay);
34627+ set_current_state(TASK_UNINTERRUPTIBLE);
34628+ schedule_timeout((pwr_delay * HZ)/1000);
34629+ }
34630+
34631+ pr_debug("pmz: startup() done.\n");
34632+
34633+ return 0;
34634+}
34635+
34636+static void pmz_shutdown(struct uart_port *port)
34637+{
34638+ struct uart_pmac_port *up = to_pmz(port);
34639+ unsigned long flags;
34640+
34641+ pr_debug("pmz: shutdown()\n");
34642+
34643+ /* Release interrupt handler */
34644+ free_irq(up->port.irq, up);
34645+
34646+ if (ZS_IS_CONS(up))
34647+ return;
34648+
34649+ spin_lock_irqsave(&port->lock, flags);
34650+
34651+ /* Disable receiver and transmitter. */
34652+ up->curregs[R3] &= ~RxENABLE;
34653+ up->curregs[R5] &= ~TxENABLE;
34654+
34655+ /* Disable all interrupts and BRK assertion. */
34656+ up->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK);
34657+ up->curregs[R5] &= ~SND_BRK;
34658+ pmz_maybe_update_regs(up);
34659+
34660+ /* Shut the chip down */
34661+ pmz_set_scc_power(up, 0);
34662+
34663+ spin_unlock_irqrestore(&port->lock, flags);
34664+
34665+ pr_debug("pmz: shutdown() done.\n");
34666+}
34667+
34668+/* Shared by TTY driver and serial console setup. The port lock is held
34669+ * and local interrupts are disabled.
34670+ */
34671+static void
34672+pmz_convert_to_zs(struct uart_pmac_port *up, unsigned int cflag,
34673+ unsigned int iflag, int baud)
34674+{
34675+ int brg;
34676+
34677+ switch (baud) {
34678+ case ZS_CLOCK/16: /* 230400 */
34679+ up->curregs[R4] = X16CLK;
34680+ up->curregs[R11] = 0;
34681+ break;
34682+ case ZS_CLOCK/32: /* 115200 */
34683+ up->curregs[R4] = X32CLK;
34684+ up->curregs[R11] = 0;
34685+ break;
34686+ default:
34687+ up->curregs[R4] = X16CLK;
34688+ up->curregs[R11] = TCBR | RCBR;
34689+ brg = BPS_TO_BRG(baud, ZS_CLOCK / 16);
34690+ up->curregs[R12] = (brg & 255);
34691+ up->curregs[R13] = ((brg >> 8) & 255);
34692+ up->curregs[R14] = BRENAB;
34693+ }
34694+
34695+ /* Character size, stop bits, and parity. */
34696+ up->curregs[3] &= ~RxN_MASK;
34697+ up->curregs[5] &= ~TxN_MASK;
34698+
34699+ switch (cflag & CSIZE) {
34700+ case CS5:
34701+ up->curregs[3] |= Rx5;
34702+ up->curregs[5] |= Tx5;
34703+ up->parity_mask = 0x1f;
34704+ break;
34705+ case CS6:
34706+ up->curregs[3] |= Rx6;
34707+ up->curregs[5] |= Tx6;
34708+ up->parity_mask = 0x3f;
34709+ break;
34710+ case CS7:
34711+ up->curregs[3] |= Rx7;
34712+ up->curregs[5] |= Tx7;
34713+ up->parity_mask = 0x7f;
34714+ break;
34715+ case CS8:
34716+ default:
34717+ up->curregs[3] |= Rx8;
34718+ up->curregs[5] |= Tx8;
34719+ up->parity_mask = 0xff;
34720+ break;
34721+ };
34722+ up->curregs[4] &= ~(SB_MASK);
34723+ if (cflag & CSTOPB)
34724+ up->curregs[4] |= SB2;
34725+ else
34726+ up->curregs[4] |= SB1;
34727+ if (cflag & PARENB)
34728+ up->curregs[4] |= PAR_ENAB;
34729+ else
34730+ up->curregs[4] &= ~PAR_ENAB;
34731+ if (!(cflag & PARODD))
34732+ up->curregs[4] |= PAR_EVEN;
34733+ else
34734+ up->curregs[4] &= ~PAR_EVEN;
34735+
34736+ up->port.read_status_mask = Rx_OVR;
34737+ if (iflag & INPCK)
34738+ up->port.read_status_mask |= CRC_ERR | PAR_ERR;
34739+ if (iflag & (BRKINT | PARMRK))
34740+ up->port.read_status_mask |= BRK_ABRT;
34741+
34742+ up->port.ignore_status_mask = 0;
34743+ if (iflag & IGNPAR)
34744+ up->port.ignore_status_mask |= CRC_ERR | PAR_ERR;
34745+ if (iflag & IGNBRK) {
34746+ up->port.ignore_status_mask |= BRK_ABRT;
34747+ if (iflag & IGNPAR)
34748+ up->port.ignore_status_mask |= Rx_OVR;
34749+ }
34750+
34751+ if ((cflag & CREAD) == 0)
34752+ up->port.ignore_status_mask = 0xff;
34753+}
34754+
34755+static void pmz_irda_rts_pulses(struct uart_pmac_port *up, int w)
34756+{
34757+ udelay(w);
34758+ write_zsreg(up, 5, Tx8 | TxENABLE);
34759+ zssync(up);
34760+ udelay(2);
34761+ write_zsreg(up, 5, Tx8 | TxENABLE | RTS);
34762+ zssync(up);
34763+ udelay(8);
34764+ write_zsreg(up, 5, Tx8 | TxENABLE);
34765+ zssync(up);
34766+ udelay(4);
34767+ write_zsreg(up, 5, Tx8 | TxENABLE | RTS);
34768+ zssync(up);
34769+}
34770+
34771+/*
34772+ * Set the irda codec on the imac to the specified baud rate.
34773+ */
34774+static void pmz_irda_setup(struct uart_pmac_port *up, int cflags)
34775+{
34776+ int code, speed, t;
34777+
34778+ speed = cflags & CBAUD;
34779+ if (speed < B2400 || speed > B115200)
34780+ return;
34781+ code = 0x4d + B115200 - speed;
34782+
34783+ /* disable serial interrupts and receive DMA */
34784+ write_zsreg(up, 1, up->curregs[1] & ~0x9f);
34785+
34786+ /* wait for transmitter to drain */
34787+ t = 10000;
34788+ while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0
34789+ || (read_zsreg(up, R1) & ALL_SNT) == 0) {
34790+ if (--t <= 0) {
34791+ printk(KERN_ERR "transmitter didn't drain\n");
34792+ return;
34793+ }
34794+ udelay(10);
34795+ }
34796+ udelay(100);
34797+
34798+ /* set to 8 bits, no parity, 19200 baud, RTS on, DTR off */
34799+ write_zsreg(up, R4, X16CLK | SB1);
34800+ write_zsreg(up, R11, TCBR | RCBR);
34801+ t = BPS_TO_BRG(19200, ZS_CLOCK/16);
34802+ write_zsreg(up, R12, t);
34803+ write_zsreg(up, R13, t >> 8);
34804+ write_zsreg(up, R14, BRENAB);
34805+ write_zsreg(up, R3, Rx8 | RxENABLE);
34806+ write_zsreg(up, R5, Tx8 | TxENABLE | RTS);
34807+ zssync(up);
34808+
34809+ /* set TxD low for ~104us and pulse RTS */
34810+ udelay(1000);
34811+ write_zsdata(up, 0xfe);
34812+ pmz_irda_rts_pulses(up, 150);
34813+ pmz_irda_rts_pulses(up, 180);
34814+ pmz_irda_rts_pulses(up, 50);
34815+ udelay(100);
34816+
34817+ /* assert DTR, wait 30ms, talk to the chip */
34818+ write_zsreg(up, R5, Tx8 | TxENABLE | RTS | DTR);
34819+ zssync(up);
34820+ mdelay(30);
34821+ while (read_zsreg(up, R0) & Rx_CH_AV)
34822+ read_zsdata(up);
34823+
34824+ write_zsdata(up, 1);
34825+ t = 1000;
34826+ while ((read_zsreg(up, R0) & Rx_CH_AV) == 0) {
34827+ if (--t <= 0) {
34828+ printk(KERN_ERR "irda_setup timed out on 1st byte\n");
34829+ goto out;
34830+ }
34831+ udelay(10);
34832+ }
34833+ t = read_zsdata(up);
34834+ if (t != 4)
34835+ printk(KERN_ERR "irda_setup 1st byte = %x\n", t);
34836+
34837+ write_zsdata(up, code);
34838+ t = 1000;
34839+ while ((read_zsreg(up, R0) & Rx_CH_AV) == 0) {
34840+ if (--t <= 0) {
34841+ printk(KERN_ERR "irda_setup timed out on 2nd byte\n");
34842+ goto out;
34843+ }
34844+ udelay(10);
34845+ }
34846+ t = read_zsdata(up);
34847+ if (t != code)
34848+ printk(KERN_ERR "irda_setup 2nd byte = %x (%x)\n", t, code);
34849+
34850+ /* Drop DTR again and do some more RTS pulses */
34851+ out:
34852+ udelay(100);
34853+ write_zsreg(up, R5, Tx8 | TxENABLE | RTS);
34854+ pmz_irda_rts_pulses(up, 80);
34855+
34856+ /* We should be right to go now. We assume that load_zsregs
34857+ will get called soon to load up the correct baud rate etc. */
34858+ up->curregs[R5] = (up->curregs[R5] | RTS) & ~DTR;
34859+}
34860+
34861+/* The port lock is not held. */
34862+static void
34863+pmz_set_termios(struct uart_port *port, struct termios *termios,
34864+ struct termios *old)
34865+{
34866+ struct uart_pmac_port *up = to_pmz(port);
34867+ unsigned long flags;
34868+ int baud;
34869+
34870+ pr_debug("pmz: set_termios()\n");
34871+
34872+ baud = uart_get_baud_rate(port, termios, old, 1200, 230400);
34873+
34874+ spin_lock_irqsave(&up->port.lock, flags);
34875+
34876+ pmz_convert_to_zs(up, termios->c_cflag, termios->c_iflag, baud);
34877+
34878+ if (UART_ENABLE_MS(&up->port, termios->c_cflag))
34879+ up->flags |= PMACZILOG_FLAG_MODEM_STATUS;
34880+ else
34881+ up->flags &= ~PMACZILOG_FLAG_MODEM_STATUS;
34882+
34883+ /* set the irda codec to the right rate */
34884+ if (ZS_IS_IRDA(up))
34885+ pmz_irda_setup(up, termios->c_cflag);
34886+
34887+ /* Load registers to the chip */
34888+ pmz_maybe_update_regs(up);
34889+
34890+ spin_unlock_irqrestore(&up->port.lock, flags);
34891+
34892+ pr_debug("pmz: set_termios() done.\n");
34893+}
34894+
34895+static const char *pmz_type(struct uart_port *port)
34896+{
34897+ return "PowerMac Zilog";
34898+}
34899+
34900+/* We do not request/release mappings of the registers here, this
34901+ * happens at early serial probe time.
34902+ */
34903+static void pmz_release_port(struct uart_port *port)
34904+{
34905+}
34906+
34907+static int pmz_request_port(struct uart_port *port)
34908+{
34909+ return 0;
34910+}
34911+
34912+/* These do not need to do anything interesting either. */
34913+static void pmz_config_port(struct uart_port *port, int flags)
34914+{
34915+}
34916+
34917+/* We do not support letting the user mess with the divisor, IRQ, etc. */
34918+static int pmz_verify_port(struct uart_port *port, struct serial_struct *ser)
34919+{
34920+ return -EINVAL;
34921+}
34922+
34923+static struct uart_ops pmz_pops = {
34924+ .tx_empty = pmz_tx_empty,
34925+ .set_mctrl = pmz_set_mctrl,
34926+ .get_mctrl = pmz_get_mctrl,
34927+ .stop_tx = pmz_stop_tx,
34928+ .start_tx = pmz_start_tx,
34929+ .stop_rx = pmz_stop_rx,
34930+ .enable_ms = pmz_enable_ms,
34931+ .break_ctl = pmz_break_ctl,
34932+ .startup = pmz_startup,
34933+ .shutdown = pmz_shutdown,
34934+ .set_termios = pmz_set_termios,
34935+ .type = pmz_type,
34936+ .release_port = pmz_release_port,
34937+ .request_port = pmz_request_port,
34938+ .config_port = pmz_config_port,
34939+ .verify_port = pmz_verify_port,
34940+};
34941+
34942+/*
34943+ * Setup one port structure after probing, HW is down at this point,
34944+ * Unlike sunzilog, we don't need to pre-init the spinlock as we don't
34945+ * register our console before uart_add_one_port() is called
34946+ */
34947+static int __init pmz_setup_port(struct uart_pmac_port *up, int early)
34948+{
34949+ struct device_node *np = up->node;
34950+ char *conn;
34951+ struct slot_names_prop {
34952+ int count;
34953+ char name[1];
34954+ } *slots;
34955+ int len;
34956+
34957+ /*
34958+ * Request & map chip registers
34959+ */
34960+ if (!early && request_OF_resource(np, 0, NULL) == NULL) {
34961+ printk("pmac_zilog: failed to request resources for %s\n",
34962+ np->full_name);
34963+ return -EBUSY;
34964+ }
34965+ up->port.mapbase = np->addrs[0].address;
34966+ up->port.membase = ioremap(up->port.mapbase, 0x1000);
34967+
34968+ up->control_reg = (volatile u8 *)up->port.membase;
34969+ up->data_reg = up->control_reg + 0x10;
34970+
34971+ /*
34972+ * Request & map DBDMA registers
34973+ */
34974+#ifdef HAS_DBDMA
34975+ if (np->n_addrs >= 3 && np->n_intrs >= 3)
34976+ up->flags |= PMACZILOG_FLAG_HAS_DMA;
34977+#endif
34978+ if (ZS_HAS_DMA(up)) {
34979+ if (!early && request_OF_resource(np, np->n_addrs - 2, " (tx dma)") == NULL) {
34980+ printk(KERN_ERR "pmac_zilog: can't request TX DMA resource !\n");
34981+ up->flags &= ~PMACZILOG_FLAG_HAS_DMA;
34982+ goto no_dma;
34983+ }
34984+ if (!early && request_OF_resource(np, np->n_addrs - 1, " (rx dma)") == NULL) {
34985+ release_OF_resource(np, np->n_addrs - 2);
34986+ printk(KERN_ERR "pmac_zilog: can't request RX DMA resource !\n");
34987+ up->flags &= ~PMACZILOG_FLAG_HAS_DMA;
34988+ goto no_dma;
34989+ }
34990+ up->tx_dma_regs = (volatile struct dbdma_regs *)
34991+ ioremap(np->addrs[np->n_addrs - 2].address, 0x1000);
34992+ up->rx_dma_regs = (volatile struct dbdma_regs *)
34993+ ioremap(np->addrs[np->n_addrs - 1].address, 0x1000);
34994+ up->tx_dma_irq = np->intrs[1].line;
34995+ up->rx_dma_irq = np->intrs[2].line;
34996+ }
34997+no_dma:
34998+ if (!early)
34999+ up->flags |= PMACZILOG_FLAG_RSRC_REQUESTED;
35000+
35001+ /*
35002+ * Detect port type
35003+ */
35004+ if (device_is_compatible(np, "cobalt"))
35005+ up->flags |= PMACZILOG_FLAG_IS_INTMODEM;
35006+ conn = get_property(np, "AAPL,connector", &len);
35007+ if (conn && (strcmp(conn, "infrared") == 0))
35008+ up->flags |= PMACZILOG_FLAG_IS_IRDA;
35009+ up->port_type = PMAC_SCC_ASYNC;
35010+ /* 1999 Powerbook G3 has slot-names property instead */
35011+ slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
35012+ if (slots && slots->count > 0) {
35013+ if (strcmp(slots->name, "IrDA") == 0)
35014+ up->flags |= PMACZILOG_FLAG_IS_IRDA;
35015+ else if (strcmp(slots->name, "Modem") == 0)
35016+ up->flags |= PMACZILOG_FLAG_IS_INTMODEM;
35017+ }
35018+ if (ZS_IS_IRDA(up))
35019+ up->port_type = PMAC_SCC_IRDA;
35020+ if (ZS_IS_INTMODEM(up)) {
35021+ struct device_node* i2c_modem = find_devices("i2c-modem");
35022+ if (i2c_modem) {
35023+ char* mid = get_property(i2c_modem, "modem-id", NULL);
35024+ if (mid) switch(*mid) {
35025+ case 0x04 :
35026+ case 0x05 :
35027+ case 0x07 :
35028+ case 0x08 :
35029+ case 0x0b :
35030+ case 0x0c :
35031+ up->port_type = PMAC_SCC_I2S1;
35032+ }
35033+ printk(KERN_INFO "pmac_zilog: i2c-modem detected, id: %d\n",
35034+ mid ? (*mid) : 0);
35035+ } else {
35036+ printk(KERN_INFO "pmac_zilog: serial modem detected\n");
35037+ }
35038+ }
35039+
35040+ /*
35041+ * Init remaining bits of "port" structure
35042+ */
35043+ up->port.iotype = SERIAL_IO_MEM;
35044+ up->port.irq = np->intrs[0].line;
35045+ up->port.uartclk = ZS_CLOCK;
35046+ up->port.fifosize = 1;
35047+ up->port.ops = &pmz_pops;
35048+ up->port.type = PORT_PMAC_ZILOG;
35049+ up->port.flags = 0;
35050+
35051+ return 0;
35052+}
35053+
35054+/*
35055+ * Get rid of a port on module removal
35056+ */
35057+static void pmz_dispose_port(struct uart_pmac_port *up)
35058+{
35059+ struct device_node *np;
35060+
35061+ if (up->flags & PMACZILOG_FLAG_RSRC_REQUESTED) {
35062+ release_OF_resource(up->node, 0);
35063+ if (ZS_HAS_DMA(up)) {
35064+ release_OF_resource(up->node, up->node->n_addrs - 2);
35065+ release_OF_resource(up->node, up->node->n_addrs - 1);
35066+ }
35067+ }
35068+ iounmap((void *)up->control_reg);
35069+ np = up->node;
35070+ up->node = NULL;
35071+ of_node_put(np);
35072+}
35073+
35074+/*
35075+ * Called upon match with an escc node in the devive-tree.
35076+ */
35077+static int pmz_attach(struct macio_dev *mdev, const struct of_match *match)
35078+{
35079+ int i;
35080+
35081+ /* Iterate the pmz_ports array to find a matching entry
35082+ */
35083+ for (i = 0; i < MAX_ZS_PORTS; i++)
35084+ if (pmz_ports[i].node == mdev->ofdev.node) {
35085+ pmz_ports[i].dev = mdev;
35086+ dev_set_drvdata(&mdev->ofdev.dev, &pmz_ports[i]);
35087+ return 0;
35088+ }
35089+ return -ENODEV;
35090+}
35091+
35092+/*
35093+ * That one should not be called, macio isn't really a hotswap device,
35094+ * we don't expect one of those serial ports to go away...
35095+ */
35096+static int pmz_detach(struct macio_dev *mdev)
35097+{
35098+ struct uart_pmac_port *port = dev_get_drvdata(&mdev->ofdev.dev);
35099+
35100+ if (!port)
35101+ return -ENODEV;
35102+
35103+ dev_set_drvdata(&mdev->ofdev.dev, NULL);
35104+ port->dev = NULL;
35105+
35106+ return 0;
35107+}
35108+
35109+/*
35110+ * Probe all ports in the system and build the ports array, we register
35111+ * with the serial layer at this point, the macio-type probing is only
35112+ * used later to "attach" to the sysfs tree so we get power management
35113+ * events
35114+ */
35115+static int __init pmz_probe(int early)
35116+{
35117+ struct device_node *node_p, *node_a, *node_b, *np;
35118+ int count = 0;
35119+ int rc;
35120+
35121+ /*
35122+ * Find all escc chips in the system
35123+ */
35124+ node_p = of_find_node_by_name(NULL, "escc");
35125+ while (node_p) {
35126+ /*
35127+ * First get channel A/B node pointers
35128+ *
35129+ * TODO: Add routines with proper locking to do that...
35130+ */
35131+ node_a = node_b = NULL;
35132+ for (np = NULL; (np = of_get_next_child(node_p, np)) != NULL;) {
35133+ if (strncmp(np->name, "ch-a", 4) == 0)
35134+ node_a = of_node_get(np);
35135+ else if (strncmp(np->name, "ch-b", 4) == 0)
35136+ node_b = of_node_get(np);
35137+ }
35138+ if (!node_a || !node_b) {
35139+ of_node_put(node_a);
35140+ of_node_put(node_b);
35141+ printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n",
35142+ (!node_a) ? 'a' : 'b', node_p->full_name);
35143+ goto next;
35144+ }
35145+
35146+ /*
35147+ * Fill basic fields in the port structures
35148+ */
35149+ pmz_ports[count].mate = &pmz_ports[count+1];
35150+ pmz_ports[count+1].mate = &pmz_ports[count];
35151+ pmz_ports[count].flags = PMACZILOG_FLAG_IS_CHANNEL_A;
35152+ pmz_ports[count].node = node_a;
35153+ pmz_ports[count+1].node = node_b;
35154+ pmz_ports[count].port.line = count;
35155+ pmz_ports[count+1].port.line = count+1;
35156+
35157+ /*
35158+ * Setup the ports for real
35159+ */
35160+ rc = pmz_setup_port(&pmz_ports[count], early);
35161+ if (rc == 0)
35162+ rc = pmz_setup_port(&pmz_ports[count+1], early);
35163+ if (rc != 0) {
35164+ of_node_put(node_a);
35165+ of_node_put(node_b);
35166+ memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port));
35167+ memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port));
35168+ goto next;
35169+ }
35170+ count += 2;
35171+next:
35172+ node_p = of_find_node_by_name(node_p, "escc");
35173+ }
35174+ pmz_ports_count = count;
35175+
35176+ return 0;
35177+}
35178+
35179+static struct uart_driver pmz_uart_reg = {
35180+ .owner = THIS_MODULE,
35181+ .driver_name = "ttyS",
35182+ .devfs_name = "tts/",
35183+ .dev_name = "ttyS",
35184+ .major = TTY_MAJOR,
35185+};
35186+
35187+#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
35188+
35189+static void pmz_console_write(struct console *con, const char *s, unsigned int count);
35190+static int __init pmz_console_setup(struct console *co, char *options);
35191+
35192+static struct console pmz_console = {
35193+ .name = "ttyS",
35194+ .write = pmz_console_write,
35195+ .device = uart_console_device,
35196+ .setup = pmz_console_setup,
35197+ .flags = CON_PRINTBUFFER,
35198+ .index = -1,
35199+ .data = &pmz_uart_reg,
35200+};
35201+
35202+#define PMACZILOG_CONSOLE &pmz_console
35203+#else /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
35204+#define PMACZILOG_CONSOLE (NULL)
35205+#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
35206+
35207+/*
35208+ * Register the driver, console driver and ports with the serial
35209+ * core
35210+ */
35211+static int __init pmz_register(void)
35212+{
35213+ int i, rc;
35214+
35215+ pmz_uart_reg.nr = pmz_ports_count;
35216+ pmz_uart_reg.cons = PMACZILOG_CONSOLE;
35217+ pmz_uart_reg.minor = 64;
35218+
35219+ /*
35220+ * Register this driver with the serial core
35221+ */
35222+ rc = uart_register_driver(&pmz_uart_reg);
35223+ if (rc != 0)
35224+ return rc;
35225+
35226+ /*
35227+ * Register each port with the serial core
35228+ */
35229+ for (i = 0; i < pmz_ports_count; i++) {
35230+ struct uart_pmac_port *uport = &pmz_ports[i];
35231+ if (uport->node != NULL)
35232+ uart_add_one_port(&pmz_uart_reg, &uport->port);
35233+ }
35234+
35235+ return 0;
35236+}
35237+
35238+static struct of_match pmz_match[] =
35239+{
35240+ {
35241+ .name = "ch-a",
35242+ .type = OF_ANY_MATCH,
35243+ .compatible = OF_ANY_MATCH
35244+ },
35245+ {
35246+ .name = "ch-b",
35247+ .type = OF_ANY_MATCH,
35248+ .compatible = OF_ANY_MATCH
35249+ },
35250+ {},
35251+};
35252+
35253+static struct macio_driver pmz_driver =
35254+{
35255+ .name = "pmac_zilog",
35256+ .match_table = pmz_match,
35257+ .probe = pmz_attach,
35258+ .remove = pmz_detach,
35259+// .suspend = pmz_suspend, *** NYI
35260+// .resume = pmz_resume, *** NYI
35261+};
35262+
35263+static void pmz_fixup_resources(void)
35264+{
35265+ int i;
35266+ for (i=0; i<pmz_ports_count; i++) {
35267+ struct uart_pmac_port *up = &pmz_ports[i];
35268+
35269+ if (up->node == NULL)
35270+ continue;
35271+ if (up->flags & PMACZILOG_FLAG_RSRC_REQUESTED)
35272+ continue;
35273+ if (request_OF_resource(up->node, 0, NULL) == NULL)
35274+ printk(KERN_WARNING "%s: Failed to do late IO resource request, port still active\n",
35275+ up->node->name);
35276+ up->flags |= PMACZILOG_FLAG_RSRC_REQUESTED;
35277+ if (!ZS_HAS_DMA(up))
35278+ continue;
35279+ if (request_OF_resource(up->node, up->node->n_addrs - 2, NULL) == NULL)
35280+ printk(KERN_WARNING "%s: Failed to do late DMA resource request, port still active\n",
35281+ up->node->name);
35282+ if (request_OF_resource(up->node, up->node->n_addrs - 1, NULL) == NULL)
35283+ printk(KERN_WARNING "%s: Failed to do late DMA resource request, port still active\n",
35284+ up->node->name);
35285+ }
35286+
35287+}
35288+
35289+static int __init init_pmz(void)
35290+{
35291+ printk(KERN_DEBUG "%s\n", version);
35292+
35293+ /*
35294+ * If we had serial console, then we didn't request
35295+ * resources yet. We fix that up now
35296+ */
35297+ if (pmz_ports_count > 0)
35298+ pmz_fixup_resources();
35299+
35300+ /*
35301+ * First, we need to do a direct OF-based probe pass. We
35302+ * do that because we want serial console up before the
35303+ * macio stuffs calls us back, and since that makes it
35304+ * easier to pass the proper number of channels to
35305+ * uart_register_driver()
35306+ */
35307+ if (pmz_ports_count == 0)
35308+ pmz_probe(0);
35309+
35310+ /*
35311+ * Bail early if no port found
35312+ */
35313+ if (pmz_ports_count == 0)
35314+ return -ENODEV;
35315+
35316+ /*
35317+ * Now we register with the serial layer
35318+ */
35319+ pmz_register();
35320+
35321+ /*
35322+ * Then we register the macio driver itself
35323+ */
35324+ return macio_register_driver(&pmz_driver);
35325+}
35326+
35327+static void __exit exit_pmz(void)
35328+{
35329+ int i;
35330+
35331+ /* Get rid of macio-driver (detach from macio) */
35332+ macio_unregister_driver(&pmz_driver);
35333+
35334+ /* Unregister UART driver */
35335+ uart_unregister_driver(&pmz_uart_reg);
35336+
35337+ for (i = 0; i < pmz_ports_count; i++) {
35338+ struct uart_pmac_port *uport = &pmz_ports[i];
35339+ if (uport->node != NULL) {
35340+ uart_remove_one_port(&pmz_uart_reg, &uport->port);
35341+ pmz_dispose_port(uport);
35342+ }
35343+ }
35344+}
35345+
35346+#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
35347+
35348+/*
35349+ * Print a string to the serial port trying not to disturb
35350+ * any possible real use of the port...
35351+ */
35352+static void pmz_console_write(struct console *con, const char *s, unsigned int count)
35353+{
35354+ struct uart_pmac_port *up = &pmz_ports[con->index];
35355+ unsigned long flags;
35356+ int i;
35357+
35358+ spin_lock_irqsave(&up->port.lock, flags);
35359+
35360+ /* Turn of interrupts and enable the transmitter. */
35361+ write_zsreg(up, R1, up->curregs[1] & ~TxINT_ENAB);
35362+ write_zsreg(up, R5, up->curregs[5] | TxENABLE | RTS | DTR);
35363+
35364+ for (i = 0; i < count; i++) {
35365+ /* Wait for the transmit buffer to empty. */
35366+ while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0)
35367+ udelay(5);
35368+ write_zsdata(up, s[i]);
35369+ if (s[i] == 10) {
35370+ while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0)
35371+ udelay(5);
35372+ write_zsdata(up, R13);
35373+ }
35374+ }
35375+
35376+ /* Restore the values in the registers. */
35377+ write_zsreg(up, R1, up->curregs[1]);
35378+ /* Don't disable the transmitter. */
35379+
35380+ spin_unlock_irqrestore(&up->port.lock, flags);
35381+}
35382+
35383+/*
35384+ * Setup the serial console
35385+ */
35386+static int __init pmz_console_setup(struct console *co, char *options)
35387+{
35388+ struct uart_port *port;
35389+ int baud = 38400;
35390+ int bits = 8;
35391+ int parity = 'n';
35392+ int flow = 'n';
35393+ unsigned long pwr_delay;
35394+
35395+ /*
35396+ * XServe's default to 57600 bps
35397+ */
35398+ if (machine_is_compatible("RackMac1,1")
35399+ || machine_is_compatible("RackMac1,2"))
35400+ baud = 57600;
35401+
35402+ /*
35403+ * Check whether an invalid uart number has been specified, and
35404+ * if so, search for the first available port that does have
35405+ * console support.
35406+ */
35407+ if (co->index >= pmz_ports_count)
35408+ co->index = 0;
35409+ port = &pmz_ports[co->index].port;
35410+
35411+ /*
35412+ * Mark port as beeing a console
35413+ */
35414+ port->flags |= PMACZILOG_FLAG_IS_CONS;
35415+
35416+ /*
35417+ * Temporary fix for uart layer who didn't setup the spinlock yet
35418+ */
35419+ spin_lock_init(&port->lock);
35420+
35421+ /*
35422+ * Enable the hardware
35423+ */
35424+ pwr_delay = __pmz_startup(&pmz_ports[co->index]);
35425+ if (pwr_delay)
35426+ mdelay(pwr_delay);
35427+
35428+ if (options)
35429+ uart_parse_options(options, &baud, &parity, &bits, &flow);
35430+
35431+ return uart_set_options(port, co, baud, parity, bits, flow);
35432+}
35433+
35434+static int __init pmz_console_init(void)
35435+{
35436+ /* Probe ports */
35437+ pmz_probe(1);
35438+
35439+ /* TODO: Autoprobe console based on OF */
35440+ /* pmz_console.index = i; */
35441+ register_console(&pmz_console);
35442+
35443+ return 0;
35444+
35445+}
35446+console_initcall(pmz_console_init);
35447+#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
35448+
35449+module_init(init_pmz);
35450+module_exit(exit_pmz);
35451diff -Nru a/drivers/serial/pmac_zilog.h b/drivers/serial/pmac_zilog.h
35452--- /dev/null Wed Dec 31 16:00:00 1969
35453+++ b/drivers/serial/pmac_zilog.h Sun Aug 24 08:05:54 2003
35454@@ -0,0 +1,361 @@
35455+#ifndef __PMAC_ZILOG_H__
35456+#define __PMAC_ZILOG_H__
35457+
35458+/*
35459+ * At most 2 ESCCs with 2 ports each
35460+ */
35461+#define MAX_ZS_PORTS 4
35462+
35463+/*
35464+ * We wrap our port structure around the generic uart_port.
35465+ */
35466+#define NUM_ZSREGS 16
35467+
35468+struct uart_pmac_port {
35469+ struct uart_port port;
35470+ struct uart_pmac_port *mate;
35471+
35472+ /* macio_dev for the escc holding this port (maybe be null on
35473+ * early inited port)
35474+ */
35475+ struct macio_dev *dev;
35476+ /* device node to this port, this points to one of 2 childs
35477+ * of "escc" node (ie. ch-a or ch-b)
35478+ */
35479+ struct device_node *node;
35480+
35481+ /* Port type as obtained from device tree (IRDA, modem, ...) */
35482+ int port_type;
35483+ u8 curregs[NUM_ZSREGS];
35484+
35485+ unsigned int flags;
35486+#define PMACZILOG_FLAG_IS_CONS 0x00000001
35487+#define PMACZILOG_FLAG_IS_KGDB 0x00000002
35488+#define PMACZILOG_FLAG_MODEM_STATUS 0x00000004
35489+#define PMACZILOG_FLAG_IS_CHANNEL_A 0x00000008
35490+#define PMACZILOG_FLAG_REGS_HELD 0x00000010
35491+#define PMACZILOG_FLAG_TX_STOPPED 0x00000020
35492+#define PMACZILOG_FLAG_TX_ACTIVE 0x00000040
35493+#define PMACZILOG_FLAG_ENABLED 0x00000080
35494+#define PMACZILOG_FLAG_IS_IRDA 0x00000100
35495+#define PMACZILOG_FLAG_IS_INTMODEM 0x00000200
35496+#define PMACZILOG_FLAG_HAS_DMA 0x00000400
35497+#define PMACZILOG_FLAG_RSRC_REQUESTED 0x00000800
35498+
35499+ unsigned char parity_mask;
35500+ unsigned char prev_status;
35501+
35502+ volatile u8 *control_reg;
35503+ volatile u8 *data_reg;
35504+
35505+ unsigned int tx_dma_irq;
35506+ unsigned int rx_dma_irq;
35507+ volatile struct dbdma_regs *tx_dma_regs;
35508+ volatile struct dbdma_regs *rx_dma_regs;
35509+};
35510+
35511+#define to_pmz(p) ((struct uart_pmac_port *)(p))
35512+
35513+/*
35514+ * Register acessors. Note that we don't need to enforce a recovery
35515+ * delay on PCI PowerMac hardware, it's dealt in HW by the MacIO chip,
35516+ * though if we try to use this driver on older machines, we might have
35517+ * to add it back
35518+ */
35519+static inline u8 read_zsreg(struct uart_pmac_port *port, u8 reg)
35520+{
35521+ if (reg != 0)
35522+ writeb(reg, port->control_reg);
35523+ return readb(port->control_reg);
35524+}
35525+
35526+static inline void write_zsreg(struct uart_pmac_port *port, u8 reg, u8 value)
35527+{
35528+ if (reg != 0)
35529+ writeb(reg, port->control_reg);
35530+ writeb(value, port->control_reg);
35531+}
35532+
35533+static inline u8 read_zsdata(struct uart_pmac_port *port)
35534+{
35535+ return readb(port->data_reg);
35536+}
35537+
35538+static inline void write_zsdata(struct uart_pmac_port *port, u8 data)
35539+{
35540+ writeb(data, port->data_reg);
35541+}
35542+
35543+static inline void zssync(struct uart_pmac_port *port)
35544+{
35545+ (void)readb(port->control_reg);
35546+}
35547+
35548+/* Conversion routines to/from brg time constants from/to bits
35549+ * per second.
35550+ */
35551+#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
35552+#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
35553+
35554+#define ZS_CLOCK 3686400 /* Z8530 RTxC input clock rate */
35555+
35556+/* The Zilog register set */
35557+
35558+#define FLAG 0x7e
35559+
35560+/* Write Register 0 */
35561+#define R0 0 /* Register selects */
35562+#define R1 1
35563+#define R2 2
35564+#define R3 3
35565+#define R4 4
35566+#define R5 5
35567+#define R6 6
35568+#define R7 7
35569+#define R8 8
35570+#define R9 9
35571+#define R10 10
35572+#define R11 11
35573+#define R12 12
35574+#define R13 13
35575+#define R14 14
35576+#define R15 15
35577+
35578+#define NULLCODE 0 /* Null Code */
35579+#define POINT_HIGH 0x8 /* Select upper half of registers */
35580+#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */
35581+#define SEND_ABORT 0x18 /* HDLC Abort */
35582+#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */
35583+#define RES_Tx_P 0x28 /* Reset TxINT Pending */
35584+#define ERR_RES 0x30 /* Error Reset */
35585+#define RES_H_IUS 0x38 /* Reset highest IUS */
35586+
35587+#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */
35588+#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */
35589+#define RES_EOM_L 0xC0 /* Reset EOM latch */
35590+
35591+/* Write Register 1 */
35592+
35593+#define EXT_INT_ENAB 0x1 /* Ext Int Enable */
35594+#define TxINT_ENAB 0x2 /* Tx Int Enable */
35595+#define PAR_SPEC 0x4 /* Parity is special condition */
35596+
35597+#define RxINT_DISAB 0 /* Rx Int Disable */
35598+#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */
35599+#define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */
35600+#define INT_ERR_Rx 0x18 /* Int on error only */
35601+#define RxINT_MASK 0x18
35602+
35603+#define WT_RDY_RT 0x20 /* W/Req reflects recv if 1, xmit if 0 */
35604+#define WT_FN_RDYFN 0x40 /* W/Req pin is DMA request if 1, wait if 0 */
35605+#define WT_RDY_ENAB 0x80 /* Enable W/Req pin */
35606+
35607+/* Write Register #2 (Interrupt Vector) */
35608+
35609+/* Write Register 3 */
35610+
35611+#define RxENABLE 0x1 /* Rx Enable */
35612+#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */
35613+#define ADD_SM 0x4 /* Address Search Mode (SDLC) */
35614+#define RxCRC_ENAB 0x8 /* Rx CRC Enable */
35615+#define ENT_HM 0x10 /* Enter Hunt Mode */
35616+#define AUTO_ENAB 0x20 /* Auto Enables */
35617+#define Rx5 0x0 /* Rx 5 Bits/Character */
35618+#define Rx7 0x40 /* Rx 7 Bits/Character */
35619+#define Rx6 0x80 /* Rx 6 Bits/Character */
35620+#define Rx8 0xc0 /* Rx 8 Bits/Character */
35621+#define RxN_MASK 0xc0
35622+
35623+/* Write Register 4 */
35624+
35625+#define PAR_ENAB 0x1 /* Parity Enable */
35626+#define PAR_EVEN 0x2 /* Parity Even/Odd* */
35627+
35628+#define SYNC_ENAB 0 /* Sync Modes Enable */
35629+#define SB1 0x4 /* 1 stop bit/char */
35630+#define SB15 0x8 /* 1.5 stop bits/char */
35631+#define SB2 0xc /* 2 stop bits/char */
35632+#define SB_MASK 0xc
35633+
35634+#define MONSYNC 0 /* 8 Bit Sync character */
35635+#define BISYNC 0x10 /* 16 bit sync character */
35636+#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */
35637+#define EXTSYNC 0x30 /* External Sync Mode */
35638+
35639+#define X1CLK 0x0 /* x1 clock mode */
35640+#define X16CLK 0x40 /* x16 clock mode */
35641+#define X32CLK 0x80 /* x32 clock mode */
35642+#define X64CLK 0xC0 /* x64 clock mode */
35643+#define XCLK_MASK 0xC0
35644+
35645+/* Write Register 5 */
35646+
35647+#define TxCRC_ENAB 0x1 /* Tx CRC Enable */
35648+#define RTS 0x2 /* RTS */
35649+#define SDLC_CRC 0x4 /* SDLC/CRC-16 */
35650+#define TxENABLE 0x8 /* Tx Enable */
35651+#define SND_BRK 0x10 /* Send Break */
35652+#define Tx5 0x0 /* Tx 5 bits (or less)/character */
35653+#define Tx7 0x20 /* Tx 7 bits/character */
35654+#define Tx6 0x40 /* Tx 6 bits/character */
35655+#define Tx8 0x60 /* Tx 8 bits/character */
35656+#define TxN_MASK 0x60
35657+#define DTR 0x80 /* DTR */
35658+
35659+/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */
35660+
35661+/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */
35662+
35663+/* Write Register 7' (Some enhanced feature control) */
35664+#define ENEXREAD 0x40 /* Enable read of some write registers */
35665+
35666+/* Write Register 8 (transmit buffer) */
35667+
35668+/* Write Register 9 (Master interrupt control) */
35669+#define VIS 1 /* Vector Includes Status */
35670+#define NV 2 /* No Vector */
35671+#define DLC 4 /* Disable Lower Chain */
35672+#define MIE 8 /* Master Interrupt Enable */
35673+#define STATHI 0x10 /* Status high */
35674+#define NORESET 0 /* No reset on write to R9 */
35675+#define CHRB 0x40 /* Reset channel B */
35676+#define CHRA 0x80 /* Reset channel A */
35677+#define FHWRES 0xc0 /* Force hardware reset */
35678+
35679+/* Write Register 10 (misc control bits) */
35680+#define BIT6 1 /* 6 bit/8bit sync */
35681+#define LOOPMODE 2 /* SDLC Loop mode */
35682+#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */
35683+#define MARKIDLE 8 /* Mark/flag on idle */
35684+#define GAOP 0x10 /* Go active on poll */
35685+#define NRZ 0 /* NRZ mode */
35686+#define NRZI 0x20 /* NRZI mode */
35687+#define FM1 0x40 /* FM1 (transition = 1) */
35688+#define FM0 0x60 /* FM0 (transition = 0) */
35689+#define CRCPS 0x80 /* CRC Preset I/O */
35690+
35691+/* Write Register 11 (Clock Mode control) */
35692+#define TRxCXT 0 /* TRxC = Xtal output */
35693+#define TRxCTC 1 /* TRxC = Transmit clock */
35694+#define TRxCBR 2 /* TRxC = BR Generator Output */
35695+#define TRxCDP 3 /* TRxC = DPLL output */
35696+#define TRxCOI 4 /* TRxC O/I */
35697+#define TCRTxCP 0 /* Transmit clock = RTxC pin */
35698+#define TCTRxCP 8 /* Transmit clock = TRxC pin */
35699+#define TCBR 0x10 /* Transmit clock = BR Generator output */
35700+#define TCDPLL 0x18 /* Transmit clock = DPLL output */
35701+#define RCRTxCP 0 /* Receive clock = RTxC pin */
35702+#define RCTRxCP 0x20 /* Receive clock = TRxC pin */
35703+#define RCBR 0x40 /* Receive clock = BR Generator output */
35704+#define RCDPLL 0x60 /* Receive clock = DPLL output */
35705+#define RTxCX 0x80 /* RTxC Xtal/No Xtal */
35706+
35707+/* Write Register 12 (lower byte of baud rate generator time constant) */
35708+
35709+/* Write Register 13 (upper byte of baud rate generator time constant) */
35710+
35711+/* Write Register 14 (Misc control bits) */
35712+#define BRENAB 1 /* Baud rate generator enable */
35713+#define BRSRC 2 /* Baud rate generator source */
35714+#define DTRREQ 4 /* DTR/Request function */
35715+#define AUTOECHO 8 /* Auto Echo */
35716+#define LOOPBAK 0x10 /* Local loopback */
35717+#define SEARCH 0x20 /* Enter search mode */
35718+#define RMC 0x40 /* Reset missing clock */
35719+#define DISDPLL 0x60 /* Disable DPLL */
35720+#define SSBR 0x80 /* Set DPLL source = BR generator */
35721+#define SSRTxC 0xa0 /* Set DPLL source = RTxC */
35722+#define SFMM 0xc0 /* Set FM mode */
35723+#define SNRZI 0xe0 /* Set NRZI mode */
35724+
35725+/* Write Register 15 (external/status interrupt control) */
35726+#define EN85C30 1 /* Enable some 85c30-enhanced registers */
35727+#define ZCIE 2 /* Zero count IE */
35728+#define ENSTFIFO 4 /* Enable status FIFO (SDLC) */
35729+#define DCDIE 8 /* DCD IE */
35730+#define SYNCIE 0x10 /* Sync/hunt IE */
35731+#define CTSIE 0x20 /* CTS IE */
35732+#define TxUIE 0x40 /* Tx Underrun/EOM IE */
35733+#define BRKIE 0x80 /* Break/Abort IE */
35734+
35735+
35736+/* Read Register 0 */
35737+#define Rx_CH_AV 0x1 /* Rx Character Available */
35738+#define ZCOUNT 0x2 /* Zero count */
35739+#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
35740+#define DCD 0x8 /* DCD */
35741+#define SYNC_HUNT 0x10 /* Sync/hunt */
35742+#define CTS 0x20 /* CTS */
35743+#define TxEOM 0x40 /* Tx underrun */
35744+#define BRK_ABRT 0x80 /* Break/Abort */
35745+
35746+/* Read Register 1 */
35747+#define ALL_SNT 0x1 /* All sent */
35748+/* Residue Data for 8 Rx bits/char programmed */
35749+#define RES3 0x8 /* 0/3 */
35750+#define RES4 0x4 /* 0/4 */
35751+#define RES5 0xc /* 0/5 */
35752+#define RES6 0x2 /* 0/6 */
35753+#define RES7 0xa /* 0/7 */
35754+#define RES8 0x6 /* 0/8 */
35755+#define RES18 0xe /* 1/8 */
35756+#define RES28 0x0 /* 2/8 */
35757+/* Special Rx Condition Interrupts */
35758+#define PAR_ERR 0x10 /* Parity error */
35759+#define Rx_OVR 0x20 /* Rx Overrun Error */
35760+#define CRC_ERR 0x40 /* CRC/Framing Error */
35761+#define END_FR 0x80 /* End of Frame (SDLC) */
35762+
35763+/* Read Register 2 (channel b only) - Interrupt vector */
35764+#define CHB_Tx_EMPTY 0x00
35765+#define CHB_EXT_STAT 0x02
35766+#define CHB_Rx_AVAIL 0x04
35767+#define CHB_SPECIAL 0x06
35768+#define CHA_Tx_EMPTY 0x08
35769+#define CHA_EXT_STAT 0x0a
35770+#define CHA_Rx_AVAIL 0x0c
35771+#define CHA_SPECIAL 0x0e
35772+#define STATUS_MASK 0x06
35773+
35774+/* Read Register 3 (interrupt pending register) ch a only */
35775+#define CHBEXT 0x1 /* Channel B Ext/Stat IP */
35776+#define CHBTxIP 0x2 /* Channel B Tx IP */
35777+#define CHBRxIP 0x4 /* Channel B Rx IP */
35778+#define CHAEXT 0x8 /* Channel A Ext/Stat IP */
35779+#define CHATxIP 0x10 /* Channel A Tx IP */
35780+#define CHARxIP 0x20 /* Channel A Rx IP */
35781+
35782+/* Read Register 8 (receive data register) */
35783+
35784+/* Read Register 10 (misc status bits) */
35785+#define ONLOOP 2 /* On loop */
35786+#define LOOPSEND 0x10 /* Loop sending */
35787+#define CLK2MIS 0x40 /* Two clocks missing */
35788+#define CLK1MIS 0x80 /* One clock missing */
35789+
35790+/* Read Register 12 (lower byte of baud rate generator constant) */
35791+
35792+/* Read Register 13 (upper byte of baud rate generator constant) */
35793+
35794+/* Read Register 15 (value of WR 15) */
35795+
35796+/* Misc macros */
35797+#define ZS_CLEARERR(port) (write_zsreg(port, 0, ERR_RES))
35798+#define ZS_CLEARFIFO(port) do { volatile unsigned char garbage; \
35799+ garbage = read_zsdata(port); \
35800+ garbage = read_zsdata(port); \
35801+ garbage = read_zsdata(port); \
35802+ } while(0)
35803+
35804+#define ZS_IS_CONS(UP) ((UP)->flags & PMACZILOG_FLAG_IS_CONS)
35805+#define ZS_IS_KGDB(UP) ((UP)->flags & PMACZILOG_FLAG_IS_KGDB)
35806+#define ZS_IS_CHANNEL_A(UP) ((UP)->flags & PMACZILOG_FLAG_IS_CHANNEL_A)
35807+#define ZS_REGS_HELD(UP) ((UP)->flags & PMACZILOG_FLAG_REGS_HELD)
35808+#define ZS_TX_STOPPED(UP) ((UP)->flags & PMACZILOG_FLAG_TX_STOPPED)
35809+#define ZS_TX_ACTIVE(UP) ((UP)->flags & PMACZILOG_FLAG_TX_ACTIVE)
35810+#define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & PMACZILOG_FLAG_MODEM_STATUS)
35811+#define ZS_IS_IRDA(UP) ((UP)->flags & PMACZILOG_FLAG_IS_IRDA)
35812+#define ZS_IS_INTMODEM(UP) ((UP)->flags & PMACZILOG_FLAG_IS_INTMODEM)
35813+#define ZS_HAS_DMA(UP) ((UP)->flags & PMACZILOG_FLAG_HAS_DMA)
35814+
35815+#endif /* __PMAC_ZILOG_H__ */
35816diff -Nru a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
35817--- a/drivers/telephony/ixj.c Sun Jul 27 12:29:47 2003
35818+++ b/drivers/telephony/ixj.c Tue Aug 26 09:25:41 2003
35819@@ -278,8 +278,8 @@
35820
35821 #include "ixj.h"
35822
35823-#define TYPE(dev) (minor(dev) >> 4)
35824-#define NUM(dev) (minor(dev) & 0xf)
35825+#define TYPE(inode) (iminor(inode) >> 4)
35826+#define NUM(inode) (iminor(inode) & 0xf)
35827
35828 static int ixjdebug;
35829 static int hertz = HZ;
35830@@ -2273,7 +2273,7 @@
35831 schedule_timeout(1);
35832 }
35833 if (ixjdebug & 0x0002)
35834- printk(KERN_INFO "Closing board %d\n", NUM(inode->i_rdev));
35835+ printk(KERN_INFO "Closing board %d\n", NUM(inode));
35836
35837 if (j->cardtype == QTI_PHONECARD)
35838 ixj_set_port(j, PORT_SPEAKER);
35839@@ -2858,7 +2858,7 @@
35840 static ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos)
35841 {
35842 unsigned long i = *ppos;
35843- IXJ * j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
35844+ IXJ * j = get_ixj(NUM(file_p->f_dentry->d_inode));
35845
35846 DECLARE_WAITQUEUE(wait, current);
35847
35848@@ -2915,7 +2915,7 @@
35849 {
35850 int pre_retval;
35851 ssize_t read_retval = 0;
35852- IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
35853+ IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
35854
35855 pre_retval = ixj_PreRead(j, 0L);
35856 switch (pre_retval) {
35857@@ -2994,7 +2994,7 @@
35858 int pre_retval;
35859 ssize_t write_retval = 0;
35860
35861- IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
35862+ IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
35863
35864 pre_retval = ixj_PreWrite(j, 0L);
35865 switch (pre_retval) {
35866@@ -4707,7 +4707,7 @@
35867 {
35868 unsigned int mask = 0;
35869
35870- IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
35871+ IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
35872
35873 poll_wait(file_p, &(j->poll_q), wait);
35874 if (j->read_buffer_ready > 0)
35875@@ -6208,10 +6208,10 @@
35876 IXJ_FILTER_RAW jfr;
35877
35878 unsigned int raise, mant;
35879- unsigned int minor = minor(inode->i_rdev);
35880- int board = NUM(inode->i_rdev);
35881+ unsigned int minor = iminor(inode);
35882+ int board = NUM(inode);
35883
35884- IXJ *j = get_ixj(NUM(inode->i_rdev));
35885+ IXJ *j = get_ixj(NUM(inode));
35886
35887 int retval = 0;
35888
35889@@ -6764,7 +6764,7 @@
35890
35891 static int ixj_fasync(int fd, struct file *file_p, int mode)
35892 {
35893- IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
35894+ IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
35895
35896 return fasync_helper(fd, file_p, mode, &j->async_queue);
35897 }
35898diff -Nru a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
35899--- a/drivers/telephony/phonedev.c Mon Jul 14 09:05:52 2003
35900+++ b/drivers/telephony/phonedev.c Tue Aug 26 09:25:41 2003
35901@@ -46,7 +46,7 @@
35902
35903 static int phone_open(struct inode *inode, struct file *file)
35904 {
35905- unsigned int minor = minor(inode->i_rdev);
35906+ unsigned int minor = iminor(inode);
35907 int err = 0;
35908 struct phone_device *p;
35909 struct file_operations *old_fops, *new_fops = NULL;
35910diff -Nru a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
35911--- a/drivers/usb/class/audio.c Wed Jul 30 11:00:01 2003
35912+++ b/drivers/usb/class/audio.c Tue Aug 26 09:25:41 2003
35913@@ -1955,7 +1955,7 @@
35914
35915 static int usb_audio_open_mixdev(struct inode *inode, struct file *file)
35916 {
35917- unsigned int minor = minor(inode->i_rdev);
35918+ unsigned int minor = iminor(inode);
35919 struct list_head *devs, *mdevs;
35920 struct usb_mixerdev *ms;
35921 struct usb_audio_state *s;
35922@@ -2633,7 +2633,7 @@
35923
35924 static int usb_audio_open(struct inode *inode, struct file *file)
35925 {
35926- unsigned int minor = minor(inode->i_rdev);
35927+ unsigned int minor = iminor(inode);
35928 DECLARE_WAITQUEUE(wait, current);
35929 struct list_head *devs, *adevs;
35930 struct usb_audiodev *as;
35931diff -Nru a/drivers/usb/class/usb-midi.c b/drivers/usb/class/usb-midi.c
35932--- a/drivers/usb/class/usb-midi.c Tue Jul 29 04:28:54 2003
35933+++ b/drivers/usb/class/usb-midi.c Tue Aug 26 09:25:41 2003
35934@@ -812,7 +812,7 @@
35935
35936 static int usb_midi_open(struct inode *inode, struct file *file)
35937 {
35938- int minor = minor(inode->i_rdev);
35939+ int minor = iminor(inode);
35940 DECLARE_WAITQUEUE(wait, current);
35941 struct list_head *devs, *mdevs;
35942 struct usb_midi_state *s;
35943diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
35944--- a/drivers/usb/class/usblp.c Sun Aug 10 02:01:53 2003
35945+++ b/drivers/usb/class/usblp.c Tue Aug 26 09:25:41 2003
35946@@ -318,7 +318,7 @@
35947
35948 static int usblp_open(struct inode *inode, struct file *file)
35949 {
35950- int minor = minor(inode->i_rdev);
35951+ int minor = iminor(inode);
35952 struct usblp *usblp;
35953 struct usb_interface *intf;
35954 int retval;
35955diff -Nru a/drivers/usb/core/file.c b/drivers/usb/core/file.c
35956--- a/drivers/usb/core/file.c Wed Aug 13 06:35:23 2003
35957+++ b/drivers/usb/core/file.c Tue Aug 26 09:25:41 2003
35958@@ -34,7 +34,7 @@
35959
35960 static int usb_open(struct inode * inode, struct file * file)
35961 {
35962- int minor = minor(inode->i_rdev);
35963+ int minor = iminor(inode);
35964 struct file_operations *c;
35965 int err = -ENODEV;
35966 struct file_operations *old_fops, *new_fops = NULL;
35967diff -Nru a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
35968--- a/drivers/usb/host/ohci-sa1111.c Thu Jul 31 13:51:23 2003
35969+++ b/drivers/usb/host/ohci-sa1111.c Sun Aug 24 07:45:05 2003
35970@@ -352,9 +352,8 @@
35971
35972 /*-------------------------------------------------------------------------*/
35973
35974-static int ohci_hcd_sa1111_drv_probe(struct device *_dev)
35975+static int ohci_hcd_sa1111_drv_probe(struct sa1111_dev *dev)
35976 {
35977- struct sa1111_dev *dev = SA1111_DEV(_dev);
35978 struct usb_hcd *hcd = NULL;
35979 int ret;
35980
35981@@ -364,43 +363,29 @@
35982 ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, &hcd, dev);
35983
35984 if (ret == 0)
35985- dev->dev.driver_data = hcd;
35986+ sa1111_set_drvdata(dev, hcd);
35987
35988 return ret;
35989 }
35990
35991-static int ohci_hcd_sa1111_drv_remove(struct device *_dev)
35992+static int ohci_hcd_sa1111_drv_remove(struct sa1111_dev *dev)
35993 {
35994- struct sa1111_dev *dev = SA1111_DEV(_dev);
35995- struct usb_hcd *hcd = dev->dev.driver_data;
35996+ struct usb_hcd *hcd = sa1111_get_drvdata(dev);
35997
35998 usb_hcd_sa1111_remove(hcd, dev);
35999
36000- dev->dev.driver_data = NULL;
36001+ sa1111_set_drvdata(dev, NULL);
36002
36003 return 0;
36004 }
36005
36006-static int ohci_hcd_sa1111_drv_suspend(struct device *dev, u32 state, u32 level)
36007-{
36008- return 0;
36009-}
36010-
36011-static int ohci_hcd_sa1111_drv_resume(struct device *dev, u32 level)
36012-{
36013- return 0;
36014-}
36015-
36016 static struct sa1111_driver ohci_hcd_sa1111_driver = {
36017 .drv = {
36018- .name = "sa1111-ohci",
36019- .bus = &sa1111_bus_type,
36020- .probe = ohci_hcd_sa1111_drv_probe,
36021- .remove = ohci_hcd_sa1111_drv_remove,
36022- .suspend = ohci_hcd_sa1111_drv_suspend,
36023- .resume = ohci_hcd_sa1111_drv_resume,
36024+ .name = "sa1111-ohci",
36025 },
36026- .devid = SA1111_DEVID_USB,
36027+ .devid = SA1111_DEVID_USB,
36028+ .probe = ohci_hcd_sa1111_drv_probe,
36029+ .remove = ohci_hcd_sa1111_drv_remove,
36030 };
36031
36032 static int __init ohci_hcd_sa1111_init (void)
36033@@ -409,12 +394,12 @@
36034 dbg ("block sizes: ed %d td %d",
36035 sizeof (struct ed), sizeof (struct td));
36036
36037- return driver_register(&ohci_hcd_sa1111_driver.drv);
36038+ return sa1111_driver_register(&ohci_hcd_sa1111_driver);
36039 }
36040
36041 static void __exit ohci_hcd_sa1111_cleanup (void)
36042 {
36043- driver_unregister(&ohci_hcd_sa1111_driver.drv);
36044+ sa1111_driver_unregister(&ohci_hcd_sa1111_driver);
36045 }
36046
36047 module_init (ohci_hcd_sa1111_init);
36048diff -Nru a/drivers/usb/image/scanner.h b/drivers/usb/image/scanner.h
36049--- a/drivers/usb/image/scanner.h Tue Jul 15 02:37:52 2003
36050+++ b/drivers/usb/image/scanner.h Tue Aug 26 09:25:41 2003
36051@@ -313,7 +313,7 @@
36052 #define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
36053 #define IS_EP_INTR(ep) ((ep)->bmAttributes == USB_ENDPOINT_XFER_INT ? 1 : 0)
36054
36055-#define USB_SCN_MINOR(X) minor((X)->i_rdev)
36056+#define USB_SCN_MINOR(X) iminor(X)
36057
36058 #ifdef DEBUG
36059 #define SCN_DEBUG(X) X
36060diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
36061--- a/drivers/usb/input/hiddev.c Wed Jun 11 07:58:27 2003
36062+++ b/drivers/usb/input/hiddev.c Tue Aug 26 09:25:41 2003
36063@@ -271,7 +271,7 @@
36064 static int hiddev_open(struct inode * inode, struct file * file) {
36065 struct hiddev_list *list;
36066
36067- int i = minor(inode->i_rdev) - HIDDEV_MINOR_BASE;
36068+ int i = iminor(inode) - HIDDEV_MINOR_BASE;
36069
36070 if (i >= HIDDEV_MINORS || !hiddev_table[i])
36071 return -ENODEV;
36072diff -Nru a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c
36073--- a/drivers/usb/media/dabusb.c Mon Aug 11 07:56:25 2003
36074+++ b/drivers/usb/media/dabusb.c Tue Aug 26 09:25:41 2003
36075@@ -583,7 +583,7 @@
36076
36077 static int dabusb_open (struct inode *inode, struct file *file)
36078 {
36079- int devnum = minor (inode->i_rdev);
36080+ int devnum = iminor(inode);
36081 pdabusb_t s;
36082
36083 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
36084diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
36085--- a/drivers/usb/misc/auerswald.c Wed Jul 30 06:14:48 2003
36086+++ b/drivers/usb/misc/auerswald.c Tue Aug 26 09:25:41 2003
36087@@ -1380,7 +1380,7 @@
36088 /* Open a new character device */
36089 static int auerchar_open (struct inode *inode, struct file *file)
36090 {
36091- int dtindex = minor(inode->i_rdev);
36092+ int dtindex = iminor(inode);
36093 pauerswald_t cp = NULL;
36094 pauerchar_t ccp = NULL;
36095 struct usb_interface *intf;
36096diff -Nru a/drivers/usb/misc/brlvger.c b/drivers/usb/misc/brlvger.c
36097--- a/drivers/usb/misc/brlvger.c Tue Jul 29 04:28:54 2003
36098+++ b/drivers/usb/misc/brlvger.c Tue Aug 26 09:25:41 2003
36099@@ -432,7 +432,7 @@
36100 static int
36101 brlvger_open(struct inode *inode, struct file *file)
36102 {
36103- int devnum = minor (inode->i_rdev);
36104+ int devnum = iminor(inode);
36105 struct usb_interface *intf = NULL;
36106 struct brlvger_priv *priv = NULL;
36107 int n, ret;
36108diff -Nru a/drivers/usb/misc/tiglusb.c b/drivers/usb/misc/tiglusb.c
36109--- a/drivers/usb/misc/tiglusb.c Mon Aug 11 07:56:25 2003
36110+++ b/drivers/usb/misc/tiglusb.c Tue Aug 26 09:25:41 2003
36111@@ -93,7 +93,7 @@
36112 static int
36113 tiglusb_open (struct inode *inode, struct file *filp)
36114 {
36115- int devnum = minor (inode->i_rdev);
36116+ int devnum = iminor(inode);
36117 ptiglusb_t s;
36118
36119 if (devnum < TIUSB_MINOR || devnum >= (TIUSB_MINOR + MAXTIGL))
36120diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
36121--- a/drivers/usb/serial/digi_acceleport.c Wed Aug 13 03:06:57 2003
36122+++ b/drivers/usb/serial/digi_acceleport.c Sun Aug 31 16:14:01 2003
36123@@ -218,7 +218,7 @@
36124 * interrupt time.
36125 * - digi_write_bulk_callback() and digi_read_bulk_callback() are
36126 * called directly from interrupts. Hence spin_lock_irqsave()
36127-* and spin_lock_irqrestore() are used in the rest of the code
36128+* and spin_unlock_irqrestore() are used in the rest of the code
36129 * for any locks they acquire.
36130 * - digi_write_bulk_callback() gets the port lock before waking up
36131 * processes sleeping on the port write_wait. It also schedules
36132@@ -571,7 +571,7 @@
36133 *
36134 * Do spin_unlock_irqrestore and interruptible_sleep_on_timeout
36135 * so that wake ups are not lost if they occur between the unlock
36136-* and the sleep. In other words, spin_lock_irqrestore and
36137+* and the sleep. In other words, spin_unlock_irqrestore and
36138 * interruptible_sleep_on_timeout are "atomic" with respect to
36139 * wake ups. This is used to implement condition variables.
36140 */
36141diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
36142--- a/drivers/usb/usb-skeleton.c Wed Aug 6 02:20:34 2003
36143+++ b/drivers/usb/usb-skeleton.c Tue Aug 26 09:25:41 2003
36144@@ -229,7 +229,7 @@
36145
36146 dbg("%s", __FUNCTION__);
36147
36148- subminor = minor (inode->i_rdev);
36149+ subminor = iminor(inode);
36150
36151 /* prevent disconnects */
36152 down (&disconnect_sem);
36153diff -Nru a/drivers/video/68328fb.c b/drivers/video/68328fb.c
36154--- a/drivers/video/68328fb.c Fri Dec 6 12:36:20 2002
36155+++ b/drivers/video/68328fb.c Sun Aug 31 16:14:08 2003
36156@@ -401,12 +401,12 @@
36157 ((1<<(width))-1)) : 0))
36158
36159 static struct fb_ops mc68328_fb_ops = {
36160- .owner: THIS_MODULE,
36161- .fb_setcolreg: mc68328fb_setcolreg,
36162- .fb_fillrect: cfbfillrect,
36163- .fb_copyarea: cfbcopyarea,
36164- .fb_imageblit: cfbimgblt,
36165- .fb_cursor: softcursor,
36166+ .owner = THIS_MODULE,
36167+ .fb_setcolreg = mc68328fb_setcolreg,
36168+ .fb_fillrect = cfbfillrect,
36169+ .fb_copyarea = cfbcopyarea,
36170+ .fb_imageblit = cfbimgblt,
36171+ .fb_cursor = softcursor,
36172 };
36173
36174
36175diff -Nru a/drivers/video/Makefile b/drivers/video/Makefile
36176--- a/drivers/video/Makefile Sun May 25 08:40:39 2003
36177+++ b/drivers/video/Makefile Sun Aug 24 08:05:27 2003
36178@@ -24,8 +24,8 @@
36179 obj-$(CONFIG_FB_RADEON) += radeonfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36180 obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36181 obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36182-obj-$(CONFIG_FB_CONTROL) += controlfb.o
36183-obj-$(CONFIG_FB_PLATINUM) += platinumfb.o
36184+obj-$(CONFIG_FB_CONTROL) += controlfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36185+obj-$(CONFIG_FB_PLATINUM) += platinumfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36186 obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36187 obj-$(CONFIG_FB_CT65550) += chipsfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36188 obj-$(CONFIG_FB_ANAKIN) += anakinfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
36189diff -Nru a/drivers/video/controlfb.c b/drivers/video/controlfb.c
36190--- a/drivers/video/controlfb.c Thu Apr 24 03:30:41 2003
36191+++ b/drivers/video/controlfb.c Sun Aug 24 06:15:21 2003
36192@@ -475,7 +475,7 @@
36193
36194 /* Apply default var */
36195 var.activate = FB_ACTIVATE_NOW;
36196- rc = fb_set_var(&var, &p->info);
36197+ rc = fb_set_var(&p->info, &var);
36198 if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8))
36199 goto try_again;
36200
36201diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
36202--- a/drivers/video/fbmem.c Wed Jul 23 07:45:30 2003
36203+++ b/drivers/video/fbmem.c Tue Aug 26 09:25:41 2003
36204@@ -768,7 +768,7 @@
36205 {
36206 unsigned long p = *ppos;
36207 struct inode *inode = file->f_dentry->d_inode;
36208- int fbidx = minor(inode->i_rdev);
36209+ int fbidx = iminor(inode);
36210 struct fb_info *info = registered_fb[fbidx];
36211
36212 if (!info || ! info->screen_base)
36213@@ -802,7 +802,7 @@
36214 {
36215 unsigned long p = *ppos;
36216 struct inode *inode = file->f_dentry->d_inode;
36217- int fbidx = minor(inode->i_rdev);
36218+ int fbidx = iminor(inode);
36219 struct fb_info *info = registered_fb[fbidx];
36220 int err;
36221
36222@@ -964,7 +964,7 @@
36223 fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
36224 unsigned long arg)
36225 {
36226- int fbidx = minor(inode->i_rdev);
36227+ int fbidx = iminor(inode);
36228 struct fb_info *info = registered_fb[fbidx];
36229 struct fb_ops *fb = info->fbops;
36230 struct fb_var_screeninfo var;
36231@@ -1050,7 +1050,7 @@
36232 static int
36233 fb_mmap(struct file *file, struct vm_area_struct * vma)
36234 {
36235- int fbidx = minor(file->f_dentry->d_inode->i_rdev);
36236+ int fbidx = iminor(file->f_dentry->d_inode);
36237 struct fb_info *info = registered_fb[fbidx];
36238 struct fb_ops *fb = info->fbops;
36239 unsigned long off;
36240@@ -1149,7 +1149,7 @@
36241 static int
36242 fb_open(struct inode *inode, struct file *file)
36243 {
36244- int fbidx = minor(inode->i_rdev);
36245+ int fbidx = iminor(inode);
36246 struct fb_info *info;
36247 int res = 0;
36248
36249@@ -1174,7 +1174,7 @@
36250 static int
36251 fb_release(struct inode *inode, struct file *file)
36252 {
36253- int fbidx = minor(inode->i_rdev);
36254+ int fbidx = iminor(inode);
36255 struct fb_info *info;
36256
36257 lock_kernel();
36258diff -Nru a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
36259--- a/drivers/video/platinumfb.c Thu Apr 24 03:30:41 2003
36260+++ b/drivers/video/platinumfb.c Sun Aug 24 07:51:47 2003
36261@@ -35,6 +35,7 @@
36262 #include <asm/io.h>
36263 #include <asm/prom.h>
36264 #include <asm/pgtable.h>
36265+#include <asm/of_device.h>
36266
36267 #include "macmodes.h"
36268 #include "platinumfb.h"
36269@@ -87,7 +88,6 @@
36270 * internal functions
36271 */
36272
36273-static void platinum_of_init(struct device_node *dp);
36274 static inline int platinum_vram_reqd(int video_mode, int color_mode);
36275 static int read_platinum_sense(struct fb_info_platinum *info);
36276 static void set_platinum_clock(struct fb_info_platinum *info);
36277@@ -323,7 +323,7 @@
36278 /*
36279 * Set misc info vars for this driver
36280 */
36281-static void __init platinum_init_info(struct fb_info *info, struct fb_info_platinum *p)
36282+static void __devinit platinum_init_info(struct fb_info *info, struct fb_info_platinum *p)
36283 {
36284 /* Fill fb_info */
36285 info->par = &p->par;
36286@@ -349,7 +349,7 @@
36287 }
36288
36289
36290-static int __init init_platinum(struct fb_info_platinum *p)
36291+static int __devinit platinum_init_fb(struct fb_info_platinum *p)
36292 {
36293 struct fb_var_screeninfo var;
36294 int sense, rc;
36295@@ -399,126 +399,21 @@
36296 /* Apply default var */
36297 p->info.var = var;
36298 var.activate = FB_ACTIVATE_NOW;
36299- rc = fb_set_var(&var, &p->info);
36300+ rc = fb_set_var(&p->info, &var);
36301 if (rc && (default_vmode != VMODE_640_480_60 || default_cmode != CMODE_8))
36302 goto try_again;
36303
36304 /* Register with fbdev layer */
36305- if (register_framebuffer(&p->info) < 0)
36306- return 0;
36307+ rc = register_framebuffer(&p->info);
36308+ if (rc < 0)
36309+ return rc;
36310
36311 printk(KERN_INFO "fb%d: platinum frame buffer device\n",
36312 p->info.node);
36313
36314- return 1;
36315-}
36316-
36317-int __init platinum_init(void)
36318-{
36319- struct device_node *dp;
36320-
36321- dp = find_devices("platinum");
36322- if (dp != 0)
36323- platinum_of_init(dp);
36324 return 0;
36325 }
36326
36327-#ifdef __powerpc__
36328-#define invalidate_cache(addr) \
36329- asm volatile("eieio; dcbf 0,%1" \
36330- : "=m" (*(addr)) : "r" (addr) : "memory");
36331-#else
36332-#define invalidate_cache(addr)
36333-#endif
36334-
36335-static void __init platinum_of_init(struct device_node *dp)
36336-{
36337- struct fb_info_platinum *info;
36338- unsigned long addr, size;
36339- volatile __u8 *fbuffer;
36340- int i, bank0, bank1, bank2, bank3;
36341-
36342- if(dp->n_addrs != 2) {
36343- printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs);
36344- return;
36345- }
36346-
36347- info = kmalloc(sizeof(*info), GFP_ATOMIC);
36348- if (info == 0)
36349- return;
36350- memset(info, 0, sizeof(*info));
36351-
36352- /* Map in frame buffer and registers */
36353- for (i = 0; i < dp->n_addrs; ++i) {
36354- addr = dp->addrs[i].address;
36355- size = dp->addrs[i].size;
36356- /* Let's assume we can request either all or nothing */
36357- if (!request_mem_region(addr, size, "platinumfb")) {
36358- kfree(info);
36359- return;
36360- }
36361- if (size >= 0x400000) {
36362- /* frame buffer - map only 4MB */
36363- info->frame_buffer_phys = addr;
36364- info->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
36365- info->base_frame_buffer = info->frame_buffer;
36366- } else {
36367- /* registers */
36368- info->platinum_regs_phys = addr;
36369- info->platinum_regs = ioremap(addr, size);
36370- }
36371- }
36372-
36373- info->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */
36374- request_mem_region(info->cmap_regs_phys, 0x1000, "platinumfb cmap");
36375- info->cmap_regs = ioremap(info->cmap_regs_phys, 0x1000);
36376-
36377- /* Grok total video ram */
36378- out_be32(&info->platinum_regs->reg[16].r, (unsigned)info->frame_buffer_phys);
36379- out_be32(&info->platinum_regs->reg[20].r, 0x1011); /* select max vram */
36380- out_be32(&info->platinum_regs->reg[24].r, 0); /* switch in vram */
36381-
36382- fbuffer = info->base_frame_buffer;
36383- fbuffer[0x100000] = 0x34;
36384- fbuffer[0x100008] = 0x0;
36385- invalidate_cache(&fbuffer[0x100000]);
36386- fbuffer[0x200000] = 0x56;
36387- fbuffer[0x200008] = 0x0;
36388- invalidate_cache(&fbuffer[0x200000]);
36389- fbuffer[0x300000] = 0x78;
36390- fbuffer[0x300008] = 0x0;
36391- invalidate_cache(&fbuffer[0x300000]);
36392- bank0 = 1; /* builtin 1MB vram, always there */
36393- bank1 = fbuffer[0x100000] == 0x34;
36394- bank2 = fbuffer[0x200000] == 0x56;
36395- bank3 = fbuffer[0x300000] == 0x78;
36396- info->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
36397- printk(KERN_INFO "Total VRAM = %dMB %d%d%d%d\n", (int) (info->total_vram / 1024 / 1024), bank3, bank2, bank1, bank0);
36398-
36399- /*
36400- * Try to determine whether we have an old or a new DACula.
36401- */
36402- out_8(&info->cmap_regs->addr, 0x40);
36403- info->dactype = in_8(&info->cmap_regs->d2);
36404- switch (info->dactype) {
36405- case 0x3c:
36406- info->clktype = 1;
36407- break;
36408- case 0x84:
36409- info->clktype = 0;
36410- break;
36411- default:
36412- info->clktype = 0;
36413- printk(KERN_INFO "Unknown DACula type: %x\n", info->dactype);
36414- break;
36415- }
36416-
36417- if (!init_platinum(info)) {
36418- kfree(info);
36419- return;
36420- }
36421-}
36422-
36423 /*
36424 * Get the monitor sense value.
36425 * Note that this can be called before calibrate_delay,
36426@@ -630,4 +525,169 @@
36427 return 0;
36428 }
36429
36430+#ifdef __powerpc__
36431+#define invalidate_cache(addr) \
36432+ asm volatile("eieio; dcbf 0,%1" \
36433+ : "=m" (*(addr)) : "r" (addr) : "memory");
36434+#else
36435+#define invalidate_cache(addr)
36436+#endif
36437+
36438+static int __devinit platinumfb_probe(struct of_device* odev, const struct of_match *match)
36439+{
36440+ struct device_node *dp = odev->node;
36441+ struct fb_info_platinum *info;
36442+ unsigned long addr, size;
36443+ volatile __u8 *fbuffer;
36444+ int i, bank0, bank1, bank2, bank3, rc;
36445+
36446+ if (dp->n_addrs != 2) {
36447+ printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs);
36448+ return -ENXIO;
36449+ }
36450+
36451+ info = kmalloc(sizeof(*info), GFP_ATOMIC);
36452+ if (info == 0)
36453+ return -ENOMEM;
36454+ memset(info, 0, sizeof(*info));
36455+
36456+ /* Map in frame buffer and registers */
36457+ for (i = 0; i < dp->n_addrs; ++i) {
36458+ addr = dp->addrs[i].address;
36459+ size = dp->addrs[i].size;
36460+ /* Let's assume we can request either all or nothing */
36461+ if (!request_mem_region(addr, size, "platinumfb")) {
36462+ kfree(info);
36463+ return -ENXIO;
36464+ }
36465+ if (size >= 0x400000) {
36466+ /* frame buffer - map only 4MB */
36467+ info->frame_buffer_phys = addr;
36468+ info->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
36469+ info->base_frame_buffer = info->frame_buffer;
36470+ } else {
36471+ /* registers */
36472+ info->platinum_regs_phys = addr;
36473+ info->platinum_regs = ioremap(addr, size);
36474+ }
36475+ }
36476+
36477+ info->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */
36478+ request_mem_region(info->cmap_regs_phys, 0x1000, "platinumfb cmap");
36479+ info->cmap_regs = ioremap(info->cmap_regs_phys, 0x1000);
36480+
36481+ /* Grok total video ram */
36482+ out_be32(&info->platinum_regs->reg[16].r, (unsigned)info->frame_buffer_phys);
36483+ out_be32(&info->platinum_regs->reg[20].r, 0x1011); /* select max vram */
36484+ out_be32(&info->platinum_regs->reg[24].r, 0); /* switch in vram */
36485+
36486+ fbuffer = info->base_frame_buffer;
36487+ fbuffer[0x100000] = 0x34;
36488+ fbuffer[0x100008] = 0x0;
36489+ invalidate_cache(&fbuffer[0x100000]);
36490+ fbuffer[0x200000] = 0x56;
36491+ fbuffer[0x200008] = 0x0;
36492+ invalidate_cache(&fbuffer[0x200000]);
36493+ fbuffer[0x300000] = 0x78;
36494+ fbuffer[0x300008] = 0x0;
36495+ invalidate_cache(&fbuffer[0x300000]);
36496+ bank0 = 1; /* builtin 1MB vram, always there */
36497+ bank1 = fbuffer[0x100000] == 0x34;
36498+ bank2 = fbuffer[0x200000] == 0x56;
36499+ bank3 = fbuffer[0x300000] == 0x78;
36500+ info->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
36501+ printk(KERN_INFO "Total VRAM = %dMB %d%d%d%d\n", (int) (info->total_vram / 1024 / 1024), bank3, bank2, bank1, bank0);
36502+
36503+ /*
36504+ * Try to determine whether we have an old or a new DACula.
36505+ */
36506+ out_8(&info->cmap_regs->addr, 0x40);
36507+ info->dactype = in_8(&info->cmap_regs->d2);
36508+ switch (info->dactype) {
36509+ case 0x3c:
36510+ info->clktype = 1;
36511+ break;
36512+ case 0x84:
36513+ info->clktype = 0;
36514+ break;
36515+ default:
36516+ info->clktype = 0;
36517+ printk(KERN_INFO "Unknown DACula type: %x\n", info->dactype);
36518+ break;
36519+ }
36520+ dev_set_drvdata(&odev->dev, info);
36521+
36522+ rc = platinum_init_fb(info);
36523+ if (rc != 0) {
36524+ dev_set_drvdata(&odev->dev, NULL);
36525+ kfree(info);
36526+ }
36527+
36528+ return rc;
36529+}
36530+
36531+static int __devexit platinumfb_remove(struct of_device* odev)
36532+{
36533+ struct fb_info_platinum *pinfo = dev_get_drvdata(&odev->dev);
36534+ struct device_node *dp = odev->node;
36535+ unsigned long addr, size;
36536+ int i;
36537+
36538+ if (!pinfo)
36539+ return 0;
36540+
36541+ unregister_framebuffer (&pinfo->info);
36542+
36543+ /* Unmap frame buffer and registers */
36544+ for (i = 0; i < dp->n_addrs; ++i) {
36545+ addr = dp->addrs[i].address;
36546+ size = dp->addrs[i].size;
36547+ release_mem_region(addr, size);
36548+ }
36549+ iounmap((void *)pinfo->frame_buffer);
36550+ iounmap((void *)pinfo->platinum_regs);
36551+ release_mem_region(pinfo->cmap_regs_phys, 0x1000);
36552+ iounmap((void *)pinfo->cmap_regs);
36553+
36554+ kfree(pinfo);
36555+
36556+ return 0;
36557+}
36558+
36559+static struct of_match platinumfb_match[] =
36560+{
36561+ {
36562+ .name = "platinum",
36563+ .type = OF_ANY_MATCH,
36564+ .compatible = OF_ANY_MATCH,
36565+ },
36566+ {},
36567+};
36568+
36569+static struct of_platform_driver platinum_driver =
36570+{
36571+ .name = "platinumfb",
36572+ .match_table = platinumfb_match,
36573+ .probe = platinumfb_probe,
36574+ .remove = platinumfb_remove,
36575+};
36576+
36577+int __init platinum_init(void)
36578+{
36579+ of_register_driver(&platinum_driver);
36580+
36581+ return 0;
36582+}
36583+
36584+void __exit platinum_exit(void)
36585+{
36586+ of_unregister_driver(&platinum_driver);
36587+}
36588+
36589 MODULE_LICENSE("GPL");
36590+MODULE_DESCRIPTION("framebuffer driver for Apple Platinum video");
36591+
36592+#ifdef MODULE
36593+module_init(platinum_init);
36594+module_exit(platinum_exit);
36595+#endif
36596diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
36597--- a/drivers/video/riva/fbdev.c Thu Jul 31 08:58:45 2003
36598+++ b/drivers/video/riva/fbdev.c Sun Aug 31 16:14:08 2003
36599@@ -297,34 +297,34 @@
36600 #endif
36601
36602 static struct fb_fix_screeninfo rivafb_fix = {
36603- id: "nVidia",
36604- type: FB_TYPE_PACKED_PIXELS,
36605- xpanstep: 1,
36606- ypanstep: 1,
36607+ .id = "nVidia",
36608+ .type = FB_TYPE_PACKED_PIXELS,
36609+ .xpanstep = 1,
36610+ .ypanstep = 1,
36611 };
36612
36613 static struct fb_var_screeninfo rivafb_default_var = {
36614- xres: 640,
36615- yres: 480,
36616- xres_virtual: 640,
36617- yres_virtual: 480,
36618- bits_per_pixel: 8,
36619- red: {0, 8, 0},
36620- green: {0, 8, 0},
36621- blue: {0, 8, 0},
36622- transp: {0, 0, 0},
36623- activate: FB_ACTIVATE_NOW,
36624- height: -1,
36625- width: -1,
36626- accel_flags: FB_ACCELF_TEXT,
36627- pixclock: 39721,
36628- left_margin: 40,
36629- right_margin: 24,
36630- upper_margin: 32,
36631- lower_margin: 11,
36632- hsync_len: 96,
36633- vsync_len: 2,
36634- vmode: FB_VMODE_NONINTERLACED
36635+ .xres = 640,
36636+ .yres = 480,
36637+ .xres_virtual = 640,
36638+ .yres_virtual = 480,
36639+ .bits_per_pixel = 8,
36640+ .red = {0, 8, 0},
36641+ .green = {0, 8, 0},
36642+ .blue = {0, 8, 0},
36643+ .transp = {0, 0, 0},
36644+ .activate = FB_ACTIVATE_NOW,
36645+ .height = -1,
36646+ .width = -1,
36647+ .accel_flags = FB_ACCELF_TEXT,
36648+ .pixclock = 39721,
36649+ .left_margin = 40,
36650+ .right_margin = 24,
36651+ .upper_margin = 32,
36652+ .lower_margin = 11,
36653+ .hsync_len = 96,
36654+ .vsync_len = 2,
36655+ .vmode = FB_VMODE_NONINTERLACED
36656 };
36657
36658 /* from GGI */
36659@@ -1977,10 +1977,10 @@
36660 #endif /* !MODULE */
36661
36662 static struct pci_driver rivafb_driver = {
36663- name: "rivafb",
36664- id_table: rivafb_pci_tbl,
36665- probe: rivafb_probe,
36666- remove: __exit_p(rivafb_remove),
36667+ .name = "rivafb",
36668+ .id_table = rivafb_pci_tbl,
36669+ .probe = rivafb_probe,
36670+ .remove = __exit_p(rivafb_remove),
36671 };
36672
36673
36674diff -Nru a/drivers/video/stifb.c b/drivers/video/stifb.c
36675--- a/drivers/video/stifb.c Sat May 31 23:26:17 2003
36676+++ b/drivers/video/stifb.c Tue Aug 26 09:25:41 2003
36677@@ -890,7 +890,7 @@
36678 {
36679 unsigned long p = *ppos;
36680 struct inode *inode = file->f_dentry->d_inode;
36681- int fbidx = minor(inode->i_rdev);
36682+ int fbidx = iminor(inode);
36683 struct fb_info *info = registered_fb[fbidx];
36684 char tmpbuf[TMPBUFLEN];
36685
36686@@ -922,7 +922,7 @@
36687 stifb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
36688 {
36689 struct inode *inode = file->f_dentry->d_inode;
36690- int fbidx = minor(inode->i_rdev);
36691+ int fbidx = iminor(inode);
36692 struct fb_info *info = registered_fb[fbidx];
36693 unsigned long p = *ppos;
36694 size_t c;
36695diff -Nru a/fs/affs/file.c b/fs/affs/file.c
36696--- a/fs/affs/file.c Sat Dec 14 09:42:09 2002
36697+++ b/fs/affs/file.c Sun Aug 31 16:14:08 2003
36698@@ -793,8 +793,8 @@
36699
36700 struct address_space_operations affs_aops_ofs = {
36701 .readpage = affs_readpage_ofs,
36702- //writepage: affs_writepage_ofs,
36703- //sync_page: affs_sync_page_ofs,
36704+ //.writepage = affs_writepage_ofs,
36705+ //.sync_page = affs_sync_page_ofs,
36706 .prepare_write = affs_prepare_write_ofs,
36707 .commit_write = affs_commit_write_ofs
36708 };
36709diff -Nru a/fs/afs/callback.c b/fs/afs/callback.c
36710--- a/fs/afs/callback.c Tue Oct 8 01:00:44 2002
36711+++ b/fs/afs/callback.c Tue Aug 26 09:37:39 2003
36712@@ -146,7 +146,7 @@
36713 spin_unlock(&vnode->lock);
36714
36715 if (valid) {
36716- invalidate_inode_pages(inode->i_mapping);
36717+ invalidate_remote_inode(inode);
36718 afs_put_server(server);
36719 }
36720 iput(inode);
36721diff -Nru a/fs/afs/dir.c b/fs/afs/dir.c
36722--- a/fs/afs/dir.c Thu Jul 3 06:36:44 2003
36723+++ b/fs/afs/dir.c Tue Aug 26 09:37:39 2003
36724@@ -569,7 +569,7 @@
36725 spin_lock(&AFS_FS_I(inode)->lock);
36726 AFS_FS_I(inode)->flags |= AFS_VNODE_DELETED;
36727 spin_unlock(&AFS_FS_I(inode)->lock);
36728- invalidate_inode_pages(inode->i_mapping);
36729+ invalidate_remote_inode(inode);
36730 goto out_bad;
36731 }
36732
36733diff -Nru a/fs/bad_inode.c b/fs/bad_inode.c
36734--- a/fs/bad_inode.c Tue Dec 3 11:20:54 2002
36735+++ b/fs/bad_inode.c Sun Aug 31 16:14:21 2003
36736@@ -4,6 +4,8 @@
36737 * Copyright (C) 1997, Stephen Tweedie
36738 *
36739 * Provide stub functions for unreadable inodes
36740+ *
36741+ * Fabian Frederick : August 2003 - All file operations assigned to EIO
36742 */
36743
36744 #include <linux/fs.h>
36745@@ -31,8 +33,10 @@
36746 static struct file_operations bad_file_ops =
36747 {
36748 .llseek = EIO_ERROR,
36749+ .aio_read = EIO_ERROR,
36750 .read = EIO_ERROR,
36751 .write = EIO_ERROR,
36752+ .aio_write = EIO_ERROR,
36753 .readdir = EIO_ERROR,
36754 .poll = EIO_ERROR,
36755 .ioctl = EIO_ERROR,
36756@@ -41,8 +45,14 @@
36757 .flush = EIO_ERROR,
36758 .release = EIO_ERROR,
36759 .fsync = EIO_ERROR,
36760+ .aio_fsync = EIO_ERROR,
36761 .fasync = EIO_ERROR,
36762 .lock = EIO_ERROR,
36763+ .readv = EIO_ERROR,
36764+ .writev = EIO_ERROR,
36765+ .sendfile = EIO_ERROR,
36766+ .sendpage = EIO_ERROR,
36767+ .get_unmapped_area = EIO_ERROR,
36768 };
36769
36770 struct inode_operations bad_inode_ops =
36771@@ -61,6 +71,11 @@
36772 .truncate = EIO_ERROR,
36773 .permission = EIO_ERROR,
36774 .getattr = EIO_ERROR,
36775+ .setattr = EIO_ERROR,
36776+ .setxattr = EIO_ERROR,
36777+ .getxattr = EIO_ERROR,
36778+ .listxattr = EIO_ERROR,
36779+ .removexattr = EIO_ERROR,
36780 };
36781
36782
36783diff -Nru a/fs/bio.c b/fs/bio.c
36784--- a/fs/bio.c Fri May 2 11:30:24 2003
36785+++ b/fs/bio.c Thu Aug 21 07:58:40 2003
36786@@ -793,10 +793,6 @@
36787 mempool_free_slab, bp->slab);
36788 if (!bp->pool)
36789 panic("biovec: can't init mempool\n");
36790-
36791- printk("biovec pool[%d]: %3d bvecs: %3d entries (%d bytes)\n",
36792- i, bp->nr_vecs, pool_entries,
36793- size);
36794 }
36795 }
36796
36797@@ -809,8 +805,6 @@
36798 bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
36799 if (!bio_pool)
36800 panic("bio: can't create mempool\n");
36801-
36802- printk("BIO: pool of %d setup, %ZuKb (%Zd bytes/bio)\n", BIO_POOL_SIZE, BIO_POOL_SIZE * sizeof(struct bio) >> 10, sizeof(struct bio));
36803
36804 biovec_init_pools();
36805
36806diff -Nru a/fs/block_dev.c b/fs/block_dev.c
36807--- a/fs/block_dev.c Wed Aug 20 22:31:51 2003
36808+++ b/fs/block_dev.c Tue Aug 26 12:06:15 2003
36809@@ -197,40 +197,36 @@
36810 * pseudo-fs
36811 */
36812
36813-static struct super_block *bd_get_sb(struct file_system_type *fs_type,
36814- int flags, const char *dev_name, void *data)
36815-{
36816- return get_sb_pseudo(fs_type, "bdev:", NULL, 0x62646576);
36817-}
36818+static spinlock_t bdev_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
36819+static kmem_cache_t * bdev_cachep;
36820
36821-static struct file_system_type bd_type = {
36822- .name = "bdev",
36823- .get_sb = bd_get_sb,
36824- .kill_sb = kill_anon_super,
36825+struct bdev_inode {
36826+ struct block_device bdev;
36827+ struct inode vfs_inode;
36828 };
36829
36830-static struct vfsmount *bd_mnt;
36831-struct super_block *blockdev_superblock;
36832-
36833-/*
36834- * bdev cache handling - shamelessly stolen from inode.c
36835- * We use smaller hashtable, though.
36836- */
36837+static inline struct bdev_inode *BDEV_I(struct inode *inode)
36838+{
36839+ return container_of(inode, struct bdev_inode, vfs_inode);
36840+}
36841
36842-#define HASH_BITS 6
36843-#define HASH_SIZE (1UL << HASH_BITS)
36844-#define HASH_MASK (HASH_SIZE-1)
36845-static struct list_head bdev_hashtable[HASH_SIZE];
36846-static spinlock_t bdev_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
36847-static kmem_cache_t * bdev_cachep;
36848+static struct inode *bdev_alloc_inode(struct super_block *sb)
36849+{
36850+ struct bdev_inode *ei = kmem_cache_alloc(bdev_cachep, SLAB_KERNEL);
36851+ if (!ei)
36852+ return NULL;
36853+ return &ei->vfs_inode;
36854+}
36855
36856-#define alloc_bdev() \
36857- ((struct block_device *) kmem_cache_alloc(bdev_cachep, SLAB_KERNEL))
36858-#define destroy_bdev(bdev) kmem_cache_free(bdev_cachep, (bdev))
36859+static void bdev_destroy_inode(struct inode *inode)
36860+{
36861+ kmem_cache_free(bdev_cachep, BDEV_I(inode));
36862+}
36863
36864 static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
36865 {
36866- struct block_device * bdev = (struct block_device *) foo;
36867+ struct bdev_inode *ei = (struct bdev_inode *) foo;
36868+ struct block_device *bdev = &ei->bdev;
36869
36870 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
36871 SLAB_CTOR_CONSTRUCTOR)
36872@@ -238,25 +234,62 @@
36873 memset(bdev, 0, sizeof(*bdev));
36874 sema_init(&bdev->bd_sem, 1);
36875 INIT_LIST_HEAD(&bdev->bd_inodes);
36876+ INIT_LIST_HEAD(&bdev->bd_list);
36877+ inode_init_once(&ei->vfs_inode);
36878 }
36879 }
36880
36881-void __init bdev_cache_init(void)
36882+static inline void __bd_forget(struct inode *inode)
36883+{
36884+ list_del_init(&inode->i_devices);
36885+ inode->i_bdev = NULL;
36886+ inode->i_mapping = &inode->i_data;
36887+}
36888+
36889+static void bdev_clear_inode(struct inode *inode)
36890+{
36891+ struct block_device *bdev = &BDEV_I(inode)->bdev;
36892+ struct list_head *p;
36893+ spin_lock(&bdev_lock);
36894+ while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
36895+ __bd_forget(list_entry(p, struct inode, i_devices));
36896+ }
36897+ list_del_init(&bdev->bd_list);
36898+ spin_unlock(&bdev_lock);
36899+}
36900+
36901+static struct super_operations bdev_sops = {
36902+ .statfs = simple_statfs,
36903+ .alloc_inode = bdev_alloc_inode,
36904+ .destroy_inode = bdev_destroy_inode,
36905+ .drop_inode = generic_delete_inode,
36906+ .clear_inode = bdev_clear_inode,
36907+};
36908+
36909+static struct super_block *bd_get_sb(struct file_system_type *fs_type,
36910+ int flags, const char *dev_name, void *data)
36911 {
36912- int i, err;
36913- struct list_head *head = bdev_hashtable;
36914+ return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
36915+}
36916+
36917+static struct file_system_type bd_type = {
36918+ .name = "bdev",
36919+ .get_sb = bd_get_sb,
36920+ .kill_sb = kill_anon_super,
36921+};
36922
36923- i = HASH_SIZE;
36924- do {
36925- INIT_LIST_HEAD(head);
36926- head++;
36927- i--;
36928- } while (i);
36929+static struct vfsmount *bd_mnt;
36930+struct super_block *blockdev_superblock;
36931
36932+void __init bdev_cache_init(void)
36933+{
36934+ int err;
36935 bdev_cachep = kmem_cache_create("bdev_cache",
36936- sizeof(struct block_device),
36937- 0, SLAB_HWCACHE_ALIGN, init_once,
36938- NULL);
36939+ sizeof(struct bdev_inode),
36940+ 0,
36941+ SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
36942+ init_once,
36943+ NULL);
36944 if (!bdev_cachep)
36945 panic("Cannot create bdev_cache SLAB cache");
36946 err = register_filesystem(&bd_type);
36947@@ -272,123 +305,83 @@
36948 /*
36949 * Most likely _very_ bad one - but then it's hardly critical for small
36950 * /dev and can be fixed when somebody will need really large one.
36951+ * Keep in mind that it will be fed through icache hash function too.
36952 */
36953 static inline unsigned long hash(dev_t dev)
36954 {
36955- unsigned long tmp = dev;
36956- tmp = tmp + (tmp >> HASH_BITS) + (tmp >> HASH_BITS*2);
36957- return tmp & HASH_MASK;
36958+ return MAJOR(dev)+MINOR(dev);
36959 }
36960
36961-static struct block_device *bdfind(dev_t dev, struct list_head *head)
36962+static int bdev_test(struct inode *inode, void *data)
36963 {
36964- struct list_head *p;
36965- struct block_device *bdev;
36966- list_for_each(p, head) {
36967- bdev = list_entry(p, struct block_device, bd_hash);
36968- if (bdev->bd_dev != dev)
36969- continue;
36970- atomic_inc(&bdev->bd_count);
36971- return bdev;
36972- }
36973- return NULL;
36974+ return BDEV_I(inode)->bdev.bd_dev == *(dev_t *)data;
36975 }
36976
36977+static int bdev_set(struct inode *inode, void *data)
36978+{
36979+ BDEV_I(inode)->bdev.bd_dev = *(dev_t *)data;
36980+ return 0;
36981+}
36982+
36983+static LIST_HEAD(all_bdevs);
36984+
36985 struct block_device *bdget(dev_t dev)
36986 {
36987- struct list_head * head = bdev_hashtable + hash(dev);
36988- struct block_device *bdev, *new_bdev;
36989- spin_lock(&bdev_lock);
36990- bdev = bdfind(dev, head);
36991- spin_unlock(&bdev_lock);
36992- if (bdev)
36993- return bdev;
36994- new_bdev = alloc_bdev();
36995- if (new_bdev) {
36996- struct inode *inode = new_inode(bd_mnt->mnt_sb);
36997- if (inode) {
36998- kdev_t kdev = to_kdev_t(dev);
36999-
37000- atomic_set(&new_bdev->bd_count,1);
37001- new_bdev->bd_dev = dev;
37002- new_bdev->bd_contains = NULL;
37003- new_bdev->bd_inode = inode;
37004- new_bdev->bd_block_size = (1 << inode->i_blkbits);
37005- new_bdev->bd_part_count = 0;
37006- new_bdev->bd_invalidated = 0;
37007- inode->i_mode = S_IFBLK;
37008- inode->i_rdev = kdev;
37009- inode->i_bdev = new_bdev;
37010- inode->i_data.a_ops = &def_blk_aops;
37011- mapping_set_gfp_mask(&inode->i_data, GFP_USER);
37012- inode->i_data.backing_dev_info = &default_backing_dev_info;
37013- spin_lock(&bdev_lock);
37014- bdev = bdfind(dev, head);
37015- if (!bdev) {
37016- list_add(&new_bdev->bd_hash, head);
37017- spin_unlock(&bdev_lock);
37018- return new_bdev;
37019- }
37020- spin_unlock(&bdev_lock);
37021- iput(new_bdev->bd_inode);
37022- }
37023- destroy_bdev(new_bdev);
37024+ struct block_device *bdev;
37025+ struct inode *inode;
37026+
37027+ inode = iget5_locked(bd_mnt->mnt_sb, hash(dev),
37028+ bdev_test, bdev_set, &dev);
37029+
37030+ if (!inode)
37031+ return NULL;
37032+
37033+ bdev = &BDEV_I(inode)->bdev;
37034+
37035+ if (inode->i_state & I_NEW) {
37036+ bdev->bd_contains = NULL;
37037+ bdev->bd_inode = inode;
37038+ bdev->bd_block_size = (1 << inode->i_blkbits);
37039+ bdev->bd_part_count = 0;
37040+ bdev->bd_invalidated = 0;
37041+ inode->i_mode = S_IFBLK;
37042+ inode->i_rdev = to_kdev_t(dev);
37043+ inode->i_bdev = bdev;
37044+ inode->i_data.a_ops = &def_blk_aops;
37045+ mapping_set_gfp_mask(&inode->i_data, GFP_USER);
37046+ inode->i_data.backing_dev_info = &default_backing_dev_info;
37047+ spin_lock(&bdev_lock);
37048+ list_add(&bdev->bd_list, &all_bdevs);
37049+ spin_unlock(&bdev_lock);
37050+ unlock_new_inode(inode);
37051 }
37052 return bdev;
37053 }
37054
37055 long nr_blockdev_pages(void)
37056 {
37057+ struct list_head *p;
37058 long ret = 0;
37059- int i;
37060-
37061 spin_lock(&bdev_lock);
37062- for (i = 0; i < ARRAY_SIZE(bdev_hashtable); i++) {
37063- struct list_head *head = &bdev_hashtable[i];
37064- struct list_head *lh;
37065-
37066- if (head == NULL)
37067- continue;
37068- list_for_each(lh, head) {
37069- struct block_device *bdev;
37070-
37071- bdev = list_entry(lh, struct block_device, bd_hash);
37072- ret += bdev->bd_inode->i_mapping->nrpages;
37073- }
37074+ list_for_each(p, &all_bdevs) {
37075+ struct block_device *bdev;
37076+ bdev = list_entry(p, struct block_device, bd_list);
37077+ ret += bdev->bd_inode->i_mapping->nrpages;
37078 }
37079 spin_unlock(&bdev_lock);
37080 return ret;
37081 }
37082
37083-static inline void __bd_forget(struct inode *inode)
37084-{
37085- list_del_init(&inode->i_devices);
37086- inode->i_bdev = NULL;
37087- inode->i_mapping = &inode->i_data;
37088-}
37089-
37090 void bdput(struct block_device *bdev)
37091 {
37092- if (atomic_dec_and_lock(&bdev->bd_count, &bdev_lock)) {
37093- struct list_head *p;
37094- if (bdev->bd_openers)
37095- BUG();
37096- list_del(&bdev->bd_hash);
37097- while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
37098- __bd_forget(list_entry(p, struct inode, i_devices));
37099- }
37100- spin_unlock(&bdev_lock);
37101- iput(bdev->bd_inode);
37102- destroy_bdev(bdev);
37103- }
37104+ iput(bdev->bd_inode);
37105 }
37106
37107 int bd_acquire(struct inode *inode)
37108 {
37109 struct block_device *bdev;
37110 spin_lock(&bdev_lock);
37111- if (inode->i_bdev) {
37112- atomic_inc(&inode->i_bdev->bd_count);
37113+ if (inode->i_bdev && igrab(inode->i_bdev->bd_inode)) {
37114 spin_unlock(&bdev_lock);
37115 return 0;
37116 }
37117@@ -397,12 +390,11 @@
37118 if (!bdev)
37119 return -ENOMEM;
37120 spin_lock(&bdev_lock);
37121- if (!inode->i_bdev) {
37122- inode->i_bdev = bdev;
37123- inode->i_mapping = bdev->bd_inode->i_mapping;
37124- list_add(&inode->i_devices, &bdev->bd_inodes);
37125- } else if (inode->i_bdev != bdev)
37126- BUG();
37127+ if (inode->i_bdev)
37128+ __bd_forget(inode);
37129+ inode->i_bdev = bdev;
37130+ inode->i_mapping = bdev->bd_inode->i_mapping;
37131+ list_add(&inode->i_devices, &bdev->bd_inodes);
37132 spin_unlock(&bdev_lock);
37133 return 0;
37134 }
37135@@ -548,7 +540,6 @@
37136 if (ret)
37137 goto out_first;
37138 }
37139- bdev->bd_offset = 0;
37140 if (!bdev->bd_openers) {
37141 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
37142 bdi = blk_get_backing_dev_info(bdev);
37143@@ -580,7 +571,8 @@
37144 ret = -ENXIO;
37145 goto out_first;
37146 }
37147- bdev->bd_offset = p->start_sect;
37148+ kobject_get(&p->kobj);
37149+ bdev->bd_part = p;
37150 bd_set_size(bdev, (loff_t) p->nr_sects << 9);
37151 up(&whole->bd_sem);
37152 }
37153@@ -701,6 +693,10 @@
37154 put_disk(disk);
37155 module_put(owner);
37156
37157+ if (bdev->bd_contains != bdev) {
37158+ kobject_put(&bdev->bd_part->kobj);
37159+ bdev->bd_part = NULL;
37160+ }
37161 bdev->bd_disk = NULL;
37162 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
37163 if (bdev != bdev->bd_contains) {
37164diff -Nru a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
37165--- a/fs/cifs/cifsfs.c Sun Aug 10 22:50:41 2003
37166+++ b/fs/cifs/cifsfs.c Tue Aug 26 09:37:39 2003
37167@@ -598,10 +598,12 @@
37168 netfid = oplock_item->netfid;
37169 DeleteOplockQEntry(oplock_item);
37170 write_unlock(&GlobalMid_Lock);
37171- rc = filemap_fdatawrite(inode->i_mapping);
37172- if(rc)
37173- CIFS_I(inode)->write_behind_rc
37174- = rc;
37175+ if (S_ISREG(inode->i_mode))
37176+ rc = filemap_fdatawrite(inode->i_mapping);
37177+ else
37178+ rc = 0;
37179+ if (rc)
37180+ CIFS_I(inode)->write_behind_rc = rc;
37181 cFYI(1,("Oplock flush inode %p rc %d",inode,rc));
37182 rc = CIFSSMBLock(0, pTcon, netfid,
37183 0 /* len */ , 0 /* offset */, 0,
37184diff -Nru a/fs/coda/inode.c b/fs/coda/inode.c
37185--- a/fs/coda/inode.c Fri Jun 20 13:16:06 2003
37186+++ b/fs/coda/inode.c Tue Aug 26 09:25:41 2003
37187@@ -115,7 +115,7 @@
37188 inode = file->f_dentry->d_inode;
37189
37190 if(!inode || !S_ISCHR(inode->i_mode) ||
37191- major(inode->i_rdev) != CODA_PSDEV_MAJOR) {
37192+ imajor(inode) != CODA_PSDEV_MAJOR) {
37193 if(file)
37194 fput(file);
37195
37196@@ -123,7 +123,7 @@
37197 return -1;
37198 }
37199
37200- idx = minor(inode->i_rdev);
37201+ idx = iminor(inode);
37202 fput(file);
37203
37204 if(idx < 0 || idx >= MAX_CODADEVS) {
37205diff -Nru a/fs/coda/psdev.c b/fs/coda/psdev.c
37206--- a/fs/coda/psdev.c Wed May 7 08:47:30 2003
37207+++ b/fs/coda/psdev.c Tue Aug 26 09:25:41 2003
37208@@ -279,7 +279,7 @@
37209 int idx;
37210
37211 lock_kernel();
37212- idx = minor(inode->i_rdev);
37213+ idx = iminor(inode);
37214 if(idx >= MAX_CODADEVS) {
37215 unlock_kernel();
37216 return -ENODEV;
37217diff -Nru a/fs/compat.c b/fs/compat.c
37218--- a/fs/compat.c Sun Jul 13 14:26:23 2003
37219+++ b/fs/compat.c Sun Aug 31 16:14:44 2003
37220@@ -227,7 +227,8 @@
37221 #define IOCTL_HASHSIZE 256
37222 struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE];
37223
37224-extern struct ioctl_trans ioctl_start[], ioctl_end[];
37225+extern struct ioctl_trans ioctl_start[];
37226+extern int ioctl_table_size;
37227
37228 static inline unsigned long ioctl32_hash(unsigned long cmd)
37229 {
37230@@ -255,7 +256,7 @@
37231 {
37232 int i;
37233
37234- for (i = 0; &ioctl_start[i] < &ioctl_end[0]; i++) {
37235+ for (i = 0; i < ioctl_table_size; i++) {
37236 if (ioctl_start[i].next != 0) {
37237 printk("ioctl translation %d bad\n",i);
37238 return -1;
37239@@ -318,8 +319,7 @@
37240
37241 static inline int builtin_ioctl(struct ioctl_trans *t)
37242 {
37243- return t >= (struct ioctl_trans *)ioctl_start &&
37244- t < (struct ioctl_trans *)ioctl_end;
37245+ return t >= ioctl_start && t < (ioctl_start + ioctl_table_size);
37246 }
37247
37248 /* Problem:
37249diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c
37250--- a/fs/compat_ioctl.c Thu Jul 3 15:19:48 2003
37251+++ b/fs/compat_ioctl.c Tue Aug 26 09:25:40 2003
37252@@ -1573,7 +1573,7 @@
37253 return -EINVAL;
37254
37255 tty = (struct tty_struct *)file->private_data;
37256- if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
37257+ if (tty_paranoia_check(tty, inode, "tty_ioctl"))
37258 return -EINVAL;
37259
37260 if (tty->driver->ioctl != vt_ioctl)
37261diff -Nru a/fs/dnotify.c b/fs/dnotify.c
37262--- a/fs/dnotify.c Wed Apr 2 22:51:32 2003
37263+++ b/fs/dnotify.c Sun Aug 31 16:14:42 2003
37264@@ -20,8 +20,6 @@
37265 #include <linux/spinlock.h>
37266 #include <linux/slab.h>
37267
37268-extern void send_sigio(struct fown_struct *fown, int fd, int band);
37269-
37270 int dir_notify_enable = 1;
37271
37272 static rwlock_t dn_lock = RW_LOCK_UNLOCKED;
37273@@ -94,7 +92,7 @@
37274 prev = &odn->dn_next;
37275 }
37276
37277- error = f_setown(filp, current->pid, 1);
37278+ error = f_setown(filp, current->tgid, 1);
37279 if (error)
37280 goto out_free;
37281
37282diff -Nru a/fs/ext2/namei.c b/fs/ext2/namei.c
37283--- a/fs/ext2/namei.c Sun Jun 29 23:49:04 2003
37284+++ b/fs/ext2/namei.c Sun Aug 31 16:14:21 2003
37285@@ -143,7 +143,7 @@
37286 int err = PTR_ERR(inode);
37287 if (!IS_ERR(inode)) {
37288 init_special_inode(inode, inode->i_mode, rdev);
37289-#ifdef CONFIG_EXT2_FS_EXT_ATTR
37290+#ifdef CONFIG_EXT2_FS_XATTR
37291 inode->i_op = &ext2_special_inode_operations;
37292 #endif
37293 mark_inode_dirty(inode);
37294diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c
37295--- a/fs/ext3/namei.c Wed Aug 20 22:32:02 2003
37296+++ b/fs/ext3/namei.c Sun Aug 31 16:14:18 2003
37297@@ -1306,7 +1306,7 @@
37298
37299 /* The 0th block becomes the root, move the dirents out */
37300 fde = &root->dotdot;
37301- de = (struct ext3_dir_entry_2 *)((char *)fde + fde->rec_len);
37302+ de = (struct ext3_dir_entry_2 *)((char *)fde + le16_to_cpu(fde->rec_len));
37303 len = ((char *) root) + blocksize - (char *) de;
37304 memcpy (data1, de, len);
37305 de = (struct ext3_dir_entry_2 *) data1;
37306diff -Nru a/fs/ext3/xattr.c b/fs/ext3/xattr.c
37307--- a/fs/ext3/xattr.c Thu Jul 17 22:30:42 2003
37308+++ b/fs/ext3/xattr.c Sun Aug 31 16:15:47 2003
37309@@ -873,17 +873,22 @@
37310 const void *value, size_t value_len, int flags)
37311 {
37312 handle_t *handle;
37313- int error, error2;
37314+ int error;
37315
37316 handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
37317- if (IS_ERR(handle))
37318+ if (IS_ERR(handle)) {
37319 error = PTR_ERR(handle);
37320- else
37321+ } else {
37322+ int error2;
37323+
37324 error = ext3_xattr_set_handle(handle, inode, name_index, name,
37325 value, value_len, flags);
37326- error2 = ext3_journal_stop(handle);
37327+ error2 = ext3_journal_stop(handle);
37328+ if (error == 0)
37329+ error = error2;
37330+ }
37331
37332- return error ? error : error2;
37333+ return error;
37334 }
37335
37336 /*
37337diff -Nru a/fs/fcntl.c b/fs/fcntl.c
37338--- a/fs/fcntl.c Thu Jun 5 23:36:40 2003
37339+++ b/fs/fcntl.c Sun Aug 31 16:14:42 2003
37340@@ -6,6 +6,7 @@
37341
37342 #include <linux/init.h>
37343 #include <linux/mm.h>
37344+#include <linux/fs.h>
37345 #include <linux/file.h>
37346 #include <linux/dnotify.h>
37347 #include <linux/smp_lock.h>
37348@@ -17,9 +18,6 @@
37349 #include <asm/poll.h>
37350 #include <asm/siginfo.h>
37351 #include <asm/uaccess.h>
37352-
37353-extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
37354-extern int fcntl_getlease(struct file *filp);
37355
37356 void set_close_on_exec(unsigned int fd, int flag)
37357 {
37358diff -Nru a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
37359--- a/fs/freevxfs/vxfs_inode.c Sun Nov 17 11:53:57 2002
37360+++ b/fs/freevxfs/vxfs_inode.c Sun Aug 31 16:14:27 2003
37361@@ -171,7 +171,7 @@
37362 return NULL;
37363
37364 fail:
37365- printk(KERN_WARNING "vxfs: unable to read inode %ld\n", ino);
37366+ printk(KERN_WARNING "vxfs: unable to read inode %ld\n", (unsigned long)ino);
37367 vxfs_put_page(pp);
37368 return NULL;
37369 }
37370diff -Nru a/fs/hpfs/namei.c b/fs/hpfs/namei.c
37371--- a/fs/hpfs/namei.c Sun Jun 29 23:49:25 2003
37372+++ b/fs/hpfs/namei.c Tue Aug 26 09:37:39 2003
37373@@ -375,6 +375,7 @@
37374 spin_lock(&dentry->d_lock);
37375 if (atomic_read(&dentry->d_count) > 1 ||
37376 permission(inode, MAY_WRITE, NULL) ||
37377+ !S_ISREG(inode->i_mode) ||
37378 get_write_access(inode)) {
37379 spin_unlock(&dentry->d_lock);
37380 d_rehash(dentry);
37381diff -Nru a/fs/intermezzo/presto.c b/fs/intermezzo/presto.c
37382--- a/fs/intermezzo/presto.c Fri Dec 13 17:27:19 2002
37383+++ b/fs/intermezzo/presto.c Tue Aug 26 09:33:56 2003
37384@@ -66,8 +66,8 @@
37385 cache = presto_get_cache(inode);
37386 CDEBUG(D_PSDEV, "\n");
37387 if ( !cache ) {
37388- CERROR("PRESTO: BAD: cannot find cache for dev %d, ino %ld\n",
37389- inode->i_sb->s_dev, inode->i_ino);
37390+ CERROR("PRESTO: BAD: cannot find cache for dev %s, ino %ld\n",
37391+ inode->i_sb->s_id, inode->i_ino);
37392 EXIT;
37393 return -1;
37394 }
37395diff -Nru a/fs/intermezzo/vfs.c b/fs/intermezzo/vfs.c
37396--- a/fs/intermezzo/vfs.c Thu Aug 7 10:29:14 2003
37397+++ b/fs/intermezzo/vfs.c Tue Aug 26 09:33:56 2003
37398@@ -743,7 +743,7 @@
37399 goto exit_lock;
37400
37401 error = -EXDEV;
37402- if (dir->d_inode->i_sb->s_dev != inode->i_sb->s_dev)
37403+ if (dir->d_inode->i_sb != inode->i_sb)
37404 goto exit_lock;
37405
37406 /*
37407@@ -1800,7 +1800,7 @@
37408 if (error)
37409 return error;
37410
37411- if (new_dir->i_sb->s_dev != old_dir->i_sb->s_dev)
37412+ if (new_dir->i_sb != old_dir->i_sb)
37413 return -EXDEV;
37414
37415 if (!new_dentry->d_inode)
37416@@ -1881,7 +1881,7 @@
37417 if (error)
37418 return error;
37419
37420- if (new_dir->i_sb->s_dev != old_dir->i_sb->s_dev)
37421+ if (new_dir->i_sb != old_dir->i_sb)
37422 return -EXDEV;
37423
37424 if (!new_dentry->d_inode)
37425diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c
37426--- a/fs/jbd/journal.c Sat Aug 16 11:46:50 2003
37427+++ b/fs/jbd/journal.c Sun Aug 31 16:14:25 2003
37428@@ -1890,7 +1890,6 @@
37429 {
37430 int ret;
37431
37432- printk(KERN_INFO "Journalled Block Device driver loaded\n");
37433 ret = journal_init_caches();
37434 if (ret != 0)
37435 journal_destroy_caches();
37436diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
37437--- a/fs/jffs/inode-v23.c Thu Aug 14 18:17:32 2003
37438+++ b/fs/jffs/inode-v23.c Sun Aug 31 16:13:59 2003
37439@@ -1080,9 +1080,11 @@
37440 struct jffs_control *c;
37441 struct inode *inode;
37442 int result = 0;
37443- kdev_t dev = to_kdev_t(rdev);
37444+ u16 data;
37445 int err;
37446
37447+ data = (MAJOR(rdev) << 8) | MINOR(rdev);
37448+
37449 D1(printk("***jffs_mknod()\n"));
37450
37451 lock_kernel();
37452@@ -1114,7 +1116,7 @@
37453 raw_inode.mtime = raw_inode.atime;
37454 raw_inode.ctime = raw_inode.atime;
37455 raw_inode.offset = 0;
37456- raw_inode.dsize = sizeof(kdev_t);
37457+ raw_inode.dsize = 2;
37458 raw_inode.rsize = 0;
37459 raw_inode.nsize = dentry->d_name.len;
37460 raw_inode.nlink = 1;
37461@@ -1124,7 +1126,7 @@
37462
37463 /* Write the new node to the flash. */
37464 if ((err = jffs_write_node(c, node, &raw_inode, dentry->d_name.name,
37465- (unsigned char *)&dev, 0, NULL)) < 0) {
37466+ (unsigned char *)&data, 0, NULL)) < 0) {
37467 D(printk("jffs_mknod(): jffs_write_node() failed.\n"));
37468 result = err;
37469 goto jffs_mknod_err;
37470@@ -1530,7 +1532,7 @@
37471 return err;
37472 } /* jffs_file_write() */
37473
37474-static ssize_t
37475+static int
37476 jffs_prepare_write(struct file *filp, struct page *page,
37477 unsigned from, unsigned to)
37478 {
37479@@ -1543,7 +1545,7 @@
37480 return 0;
37481 } /* jffs_prepare_write() */
37482
37483-static ssize_t
37484+static int
37485 jffs_commit_write(struct file *filp, struct page *page,
37486 unsigned from, unsigned to)
37487 {
37488@@ -1732,9 +1734,10 @@
37489 /* If the node is a device of some sort, then the number of
37490 the device should be read from the flash memory and then
37491 added to the inode's i_rdev member. */
37492- kdev_t rdev;
37493- jffs_read_data(f, (char *)&rdev, 0, sizeof(kdev_t));
37494- init_special_inode(inode, inode->i_mode, kdev_t_to_nr(rdev));
37495+ u16 val;
37496+ jffs_read_data(f, (char *)val, 0, 2);
37497+ init_special_inode(inode, inode->i_mode,
37498+ MKDEV((val >> 8) & 255, val & 255));
37499 }
37500
37501 D3(printk (KERN_NOTICE "read_inode(): up biglock\n"));
37502diff -Nru a/fs/jffs2/file.c b/fs/jffs2/file.c
37503--- a/fs/jffs2/file.c Wed May 28 08:01:06 2003
37504+++ b/fs/jffs2/file.c Tue Aug 26 09:25:41 2003
37505@@ -103,8 +103,8 @@
37506 it out again with the appropriate data attached */
37507 if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
37508 /* For these, we don't actually need to read the old node */
37509- dev = (major(dentry->d_inode->i_rdev) << 8) |
37510- minor(dentry->d_inode->i_rdev);
37511+ dev = (imajor(dentry->d_inode) << 8) |
37512+ iminor(dentry->d_inode);
37513 mdata = (char *)&dev;
37514 mdatalen = sizeof(dev);
37515 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen));
37516diff -Nru a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
37517--- a/fs/jffs2/os-linux.h Mon Jun 23 06:03:50 2003
37518+++ b/fs/jffs2/os-linux.h Tue Aug 26 09:25:41 2003
37519@@ -44,8 +44,8 @@
37520 #define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid)
37521
37522 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,1)
37523-#define JFFS2_F_I_RDEV_MIN(f) (minor(OFNI_EDONI_2SFFJ(f)->i_rdev))
37524-#define JFFS2_F_I_RDEV_MAJ(f) (major(OFNI_EDONI_2SFFJ(f)->i_rdev))
37525+#define JFFS2_F_I_RDEV_MIN(f) (iminor(OFNI_EDONI_2SFFJ(f)))
37526+#define JFFS2_F_I_RDEV_MAJ(f) (imajor(OFNI_EDONI_2SFFJ(f)))
37527 #else
37528 #define JFFS2_F_I_RDEV_MIN(f) (MINOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
37529 #define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
37530diff -Nru a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
37531--- a/fs/jffs2/wbuf.c Wed May 28 08:01:07 2003
37532+++ b/fs/jffs2/wbuf.c Sun Aug 31 16:14:08 2003
37533@@ -37,8 +37,8 @@
37534 #define NAND_JFFS2_OOB16_FSDALEN 8
37535
37536 struct nand_oobinfo jffs2_oobinfo = {
37537- useecc: 1,
37538- eccpos: {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2, JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
37539+ .useecc = 1,
37540+ .eccpos = {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2, JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
37541 };
37542
37543 static inline void jffs2_refile_wbuf_blocks(struct jffs2_sb_info *c)
37544diff -Nru a/fs/nfs/inode.c b/fs/nfs/inode.c
37545--- a/fs/nfs/inode.c Fri Jul 11 10:32:02 2003
37546+++ b/fs/nfs/inode.c Tue Aug 26 09:37:39 2003
37547@@ -620,7 +620,7 @@
37548 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
37549 NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
37550
37551- invalidate_inode_pages(inode->i_mapping);
37552+ invalidate_remote_inode(inode);
37553
37554 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
37555 NFS_CACHEINV(inode);
37556@@ -823,14 +823,15 @@
37557 goto out;
37558 }
37559
37560- if (!S_ISREG(inode->i_mode))
37561+ if (!S_ISREG(inode->i_mode)) {
37562 attr->ia_valid &= ~ATTR_SIZE;
37563-
37564- filemap_fdatawrite(inode->i_mapping);
37565- error = nfs_wb_all(inode);
37566- filemap_fdatawait(inode->i_mapping);
37567- if (error)
37568- goto out;
37569+ } else {
37570+ filemap_fdatawrite(inode->i_mapping);
37571+ error = nfs_wb_all(inode);
37572+ filemap_fdatawait(inode->i_mapping);
37573+ if (error)
37574+ goto out;
37575+ }
37576
37577 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
37578 if (error)
37579@@ -1205,7 +1206,7 @@
37580 if (invalid) {
37581 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
37582 nfsi->attrtimeo_timestamp = jiffies;
37583- invalidate_inode_pages(inode->i_mapping);
37584+ invalidate_remote_inode(inode);
37585 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
37586 } else if (time_after(jiffies, nfsi->attrtimeo_timestamp+nfsi->attrtimeo)) {
37587 if ((nfsi->attrtimeo <<= 1) > NFS_MAXATTRTIMEO(inode))
37588diff -Nru a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
37589--- a/fs/nfsd/nfs4proc.c Thu Jun 26 21:26:02 2003
37590+++ b/fs/nfsd/nfs4proc.c Sun Aug 31 16:14:23 2003
37591@@ -106,7 +106,8 @@
37592 nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
37593 {
37594 int status;
37595- dprintk("NFSD: nfsd4_open filename %.*s\n",open->op_fname.len, open->op_fname.data);
37596+ dprintk("NFSD: nfsd4_open filename %.*s\n",
37597+ (int)open->op_fname.len, open->op_fname.data);
37598
37599 /* This check required by spec. */
37600 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
37601diff -Nru a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
37602--- a/fs/nfsd/nfs4state.c Thu Jul 31 16:53:11 2003
37603+++ b/fs/nfsd/nfs4state.c Sun Aug 31 16:14:23 2003
37604@@ -688,7 +688,7 @@
37605 #define OPENSTATEID_HASH_MASK (OPENSTATEID_HASH_SIZE - 1)
37606
37607 #define file_hashval(x) \
37608- ((unsigned int)((x)->dev + (x)->ino + (x)->generation) & FILE_HASH_MASK)
37609+ hash_ptr(x, FILE_HASH_BITS)
37610 #define openstateid_hashval(owner_id, file_id) \
37611 (((owner_id) + (file_id)) & OPENSTATEID_HASH_MASK)
37612
37613@@ -697,13 +697,13 @@
37614
37615 /* OPEN Share state helper functions */
37616 static inline struct nfs4_file *
37617-alloc_init_file(unsigned int hashval, nfs4_ino_desc_t *ino) {
37618+alloc_init_file(unsigned int hashval, struct inode *ino) {
37619 struct nfs4_file *fp;
37620 if ((fp = kmalloc(sizeof(struct nfs4_file),GFP_KERNEL))) {
37621 INIT_LIST_HEAD(&fp->fi_hash);
37622 INIT_LIST_HEAD(&fp->fi_perfile);
37623 list_add(&fp->fi_hash, &file_hashtbl[hashval]);
37624- memcpy(&fp->fi_ino, ino, sizeof(nfs4_ino_desc_t));
37625+ fp->fi_inode = igrab(ino);
37626 fp->fi_id = current_fileid++;
37627 alloc_file++;
37628 return fp;
37629@@ -841,11 +841,12 @@
37630 {
37631 free_file++;
37632 list_del_init(&fp->fi_hash);
37633+ iput(fp->fi_inode);
37634 kfree(fp);
37635 }
37636
37637 void
37638-release_open_state(struct nfs4_stateid *stp)
37639+release_open_state(struct nfs4_stateid *stp, struct nfsd4_close *cl)
37640 {
37641 struct nfs4_stateowner *sop = stp->st_stateowner;
37642 struct nfs4_file *fp = stp->st_file;
37643@@ -860,6 +861,7 @@
37644 */
37645 if (sop->so_confirmed && list_empty(&sop->so_peropenstate)) {
37646 release_stateowner(sop);
37647+ cl->cl_stateowner = NULL;
37648 }
37649 /* unused nfs4_file's are releseed. XXX slab cache? */
37650 if (list_empty(&fp->fi_perfile)) {
37651@@ -911,13 +913,13 @@
37652
37653 /* search file_hashtbl[] for file */
37654 static int
37655-find_file(unsigned int hashval, nfs4_ino_desc_t *ino, struct nfs4_file **fp) {
37656+find_file(unsigned int hashval, struct inode *ino, struct nfs4_file **fp) {
37657 struct list_head *pos, *next;
37658 struct nfs4_file *local = NULL;
37659
37660 list_for_each_safe(pos, next, &file_hashtbl[hashval]) {
37661 local = list_entry(pos, struct nfs4_file, fi_hash);
37662- if(!memcmp(&local->fi_ino, ino, sizeof(nfs4_ino_desc_t))) {
37663+ if (local->fi_inode == ino) {
37664 *fp = local;
37665 return(1);
37666 }
37667@@ -934,24 +936,10 @@
37668 return 1;
37669 }
37670
37671-static inline void
37672-nfs4_init_ino(nfs4_ino_desc_t *ino, struct svc_fh *fhp)
37673-{
37674- struct inode *inode;
37675- if (!fhp->fh_dentry)
37676- BUG();
37677- inode = fhp->fh_dentry->d_inode;
37678- if (!inode)
37679- BUG();
37680- ino->dev = inode->i_sb->s_dev;
37681- ino->ino = inode->i_ino;
37682- ino->generation = inode->i_generation;
37683-}
37684-
37685 int
37686 nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
37687 {
37688- nfs4_ino_desc_t ino;
37689+ struct inode *ino = current_fh->fh_dentry->d_inode;
37690 unsigned int fi_hashval;
37691 struct nfs4_file *fp;
37692 struct nfs4_stateid *stp;
37693@@ -959,9 +947,8 @@
37694
37695 dprintk("NFSD: nfs4_share_conflict\n");
37696
37697- nfs4_init_ino(&ino, current_fh);
37698- fi_hashval = file_hashval(&ino);
37699- if (find_file(fi_hashval, &ino, &fp)) {
37700+ fi_hashval = file_hashval(ino);
37701+ if (find_file(fi_hashval, ino, &fp)) {
37702 /* Search for conflicting share reservations */
37703 list_for_each_safe(pos, next, &fp->fi_perfile) {
37704 stp = list_entry(pos, struct nfs4_stateid, st_perfile);
37705@@ -1084,7 +1071,7 @@
37706 struct iattr iattr;
37707 struct nfs4_stateowner *sop = open->op_stateowner;
37708 struct nfs4_file *fp;
37709- nfs4_ino_desc_t ino;
37710+ struct inode *ino;
37711 unsigned int fi_hashval;
37712 struct list_head *pos, *next;
37713 struct nfs4_stateid *stq, *stp = NULL;
37714@@ -1094,11 +1081,11 @@
37715 if (!sop)
37716 goto out;
37717
37718- nfs4_init_ino(&ino, current_fh);
37719+ ino = current_fh->fh_dentry->d_inode;
37720
37721 down(&client_sema); /*XXX need finer grained locking */
37722- fi_hashval = file_hashval(&ino);
37723- if (find_file(fi_hashval, &ino, &fp)) {
37724+ fi_hashval = file_hashval(ino);
37725+ if (find_file(fi_hashval, ino, &fp)) {
37726 /* Search for conflicting share reservations */
37727 status = nfserr_share_denied;
37728 list_for_each_safe(pos, next, &fp->fi_perfile) {
37729@@ -1113,7 +1100,7 @@
37730 } else {
37731 /* No nfs4_file found; allocate and init a new one */
37732 status = nfserr_resource;
37733- if ((fp = alloc_init_file(fi_hashval, &ino)) == NULL)
37734+ if ((fp = alloc_init_file(fi_hashval, ino)) == NULL)
37735 goto out;
37736 }
37737
37738@@ -1172,6 +1159,9 @@
37739 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
37740 status = nfs_ok;
37741 out:
37742+ if (fp && list_empty(&fp->fi_perfile))
37743+ release_file(fp);
37744+
37745 /*
37746 * To finish the open response, we just need to set the rflags.
37747 */
37748@@ -1494,7 +1484,7 @@
37749 struct nfs4_stateid *stp;
37750
37751 dprintk("NFSD: nfsd4_open_confirm on file %.*s\n",
37752- current_fh->fh_dentry->d_name.len,
37753+ (int)current_fh->fh_dentry->d_name.len,
37754 current_fh->fh_dentry->d_name.name);
37755 oc->oc_stateowner = NULL;
37756 down(&client_sema); /* XXX need finer grained locking */
37757@@ -1528,7 +1518,7 @@
37758 struct nfs4_stateid *stp;
37759
37760 dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n",
37761- current_fh->fh_dentry->d_name.len,
37762+ (int)current_fh->fh_dentry->d_name.len,
37763 current_fh->fh_dentry->d_name.name);
37764
37765 down(&client_sema); /* XXX need finer grained locking */
37766@@ -1567,7 +1557,7 @@
37767 struct nfs4_stateid *stp;
37768
37769 dprintk("NFSD: nfsd4_close on file %.*s\n",
37770- current_fh->fh_dentry->d_name.len,
37771+ (int)current_fh->fh_dentry->d_name.len,
37772 current_fh->fh_dentry->d_name.name);
37773
37774 down(&client_sema); /* XXX need finer grained locking */
37775@@ -1584,7 +1574,7 @@
37776 memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t));
37777
37778 /* release_open_state() calls nfsd_close() if needed */
37779- release_open_state(stp);
37780+ release_open_state(stp,close);
37781 out:
37782 up(&client_sema);
37783 return status;
37784diff -Nru a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
37785--- a/fs/nfsd/nfs4xdr.c Sun Aug 3 21:42:17 2003
37786+++ b/fs/nfsd/nfs4xdr.c Sat Aug 23 15:07:47 2003
37787@@ -1631,6 +1631,8 @@
37788 WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
37789 ADJUST_ARGS();
37790 }
37791+ if ((close->cl_stateowner) && (close->cl_stateowner->so_confirmed))
37792+ close->cl_stateowner->so_seqid++;
37793 }
37794
37795
37796@@ -1767,6 +1769,8 @@
37797 default:
37798 BUG();
37799 }
37800+
37801+ ENCODE_SEQID_OP_TAIL(open->op_stateowner);
37802 }
37803
37804 static int
37805diff -Nru a/fs/open.c b/fs/open.c
37806--- a/fs/open.c Mon Aug 18 22:38:39 2003
37807+++ b/fs/open.c Sun Aug 31 16:14:00 2003
37808@@ -945,20 +945,12 @@
37809 */
37810 int filp_close(struct file *filp, fl_owner_t id)
37811 {
37812- struct address_space *mapping = filp->f_dentry->d_inode->i_mapping;
37813- int retval = 0, err;
37814+ int retval;
37815
37816 /* Report and clear outstanding errors */
37817- err = filp->f_error;
37818- if (err) {
37819+ retval = filp->f_error;
37820+ if (retval)
37821 filp->f_error = 0;
37822- retval = err;
37823- }
37824-
37825- if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
37826- retval = -ENOSPC;
37827- if (test_and_clear_bit(AS_EIO, &mapping->flags))
37828- retval = -EIO;
37829
37830 if (!file_count(filp)) {
37831 printk(KERN_ERR "VFS: Close: file count is 0\n");
37832@@ -966,7 +958,7 @@
37833 }
37834
37835 if (filp->f_op && filp->f_op->flush) {
37836- err = filp->f_op->flush(filp);
37837+ int err = filp->f_op->flush(filp);
37838 if (!retval)
37839 retval = err;
37840 }
37841diff -Nru a/fs/partitions/check.c b/fs/partitions/check.c
37842--- a/fs/partitions/check.c Tue Aug 12 06:46:16 2003
37843+++ b/fs/partitions/check.c Tue Aug 26 12:06:15 2003
37844@@ -267,7 +267,14 @@
37845
37846 extern struct subsystem block_subsys;
37847
37848+static void part_release(struct kobject *kobj)
37849+{
37850+ struct hd_struct * p = container_of(kobj,struct hd_struct,kobj);
37851+ kfree(p);
37852+}
37853+
37854 struct kobj_type ktype_part = {
37855+ .release = part_release,
37856 .default_attrs = default_attrs,
37857 .sysfs_ops = &part_sysfs_ops,
37858 };
37859@@ -279,13 +286,12 @@
37860 return;
37861 if (!p->nr_sects)
37862 return;
37863+ disk->part[part-1] = NULL;
37864 p->start_sect = 0;
37865 p->nr_sects = 0;
37866 p->reads = p->writes = p->read_sectors = p->write_sectors = 0;
37867 devfs_remove("%s/part%d", disk->devfs_name, part);
37868 kobject_unregister(&p->kobj);
37869- disk->part[part-1] = NULL;
37870- kfree(p);
37871 }
37872
37873 void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
37874@@ -300,7 +306,6 @@
37875 p->start_sect = start;
37876 p->nr_sects = len;
37877 p->partno = part;
37878- disk->part[part-1] = p;
37879
37880 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part),
37881 S_IFBLK|S_IRUSR|S_IWUSR,
37882@@ -310,6 +315,7 @@
37883 p->kobj.parent = &disk->kobj;
37884 p->kobj.ktype = &ktype_part;
37885 kobject_register(&p->kobj);
37886+ disk->part[part-1] = p;
37887 }
37888
37889 static void disk_sysfs_symlinks(struct gendisk *disk)
37890diff -Nru a/fs/proc/base.c b/fs/proc/base.c
37891--- a/fs/proc/base.c Thu Jul 10 22:23:45 2003
37892+++ b/fs/proc/base.c Sun Aug 31 16:13:56 2003
37893@@ -864,19 +864,34 @@
37894 * Exceptional case: normally we are not allowed to unhash a busy
37895 * directory. In this case, however, we can do it - no aliasing problems
37896 * due to the way we treat inodes.
37897+ *
37898+ * Rewrite the inode's ownerships here because the owning task may have
37899+ * performed a setuid(), etc.
37900 */
37901-static int pid_revalidate(struct dentry * dentry, struct nameidata *nd)
37902+static int pid_revalidate(struct dentry *dentry, struct nameidata *nd)
37903 {
37904- if (pid_alive(proc_task(dentry->d_inode)))
37905+ struct inode *inode = dentry->d_inode;
37906+ struct task_struct *task = proc_task(inode);
37907+ if (pid_alive(task)) {
37908+ if (proc_type(inode) == PROC_PID_INO || task_dumpable(task)) {
37909+ inode->i_uid = task->euid;
37910+ inode->i_gid = task->egid;
37911+ } else {
37912+ inode->i_uid = 0;
37913+ inode->i_gid = 0;
37914+ }
37915+ security_task_to_inode(task, inode);
37916 return 1;
37917+ }
37918 d_drop(dentry);
37919 return 0;
37920 }
37921
37922-static int pid_fd_revalidate(struct dentry * dentry, struct nameidata *nd)
37923+static int pid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
37924 {
37925- struct task_struct *task = proc_task(dentry->d_inode);
37926- int fd = proc_type(dentry->d_inode) - PROC_PID_FD_DIR;
37927+ struct inode *inode = dentry->d_inode;
37928+ struct task_struct *task = proc_task(inode);
37929+ int fd = proc_type(inode) - PROC_PID_FD_DIR;
37930 struct files_struct *files;
37931
37932 task_lock(task);
37933@@ -889,6 +904,14 @@
37934 if (fcheck_files(files, fd)) {
37935 spin_unlock(&files->file_lock);
37936 put_files_struct(files);
37937+ if (task_dumpable(task)) {
37938+ inode->i_uid = task->euid;
37939+ inode->i_gid = task->egid;
37940+ } else {
37941+ inode->i_uid = 0;
37942+ inode->i_gid = 0;
37943+ }
37944+ security_task_to_inode(task, inode);
37945 return 1;
37946 }
37947 spin_unlock(&files->file_lock);
37948diff -Nru a/fs/proc/kcore.c b/fs/proc/kcore.c
37949--- a/fs/proc/kcore.c Fri Jun 20 13:16:05 2003
37950+++ b/fs/proc/kcore.c Sun Aug 31 16:14:22 2003
37951@@ -1,5 +1,5 @@
37952 /*
37953- * fs/proc/kcore.c kernel ELF/AOUT core dumper
37954+ * fs/proc/kcore.c kernel ELF core dumper
37955 *
37956 * Modelled on fs/exec.c:aout_core_dump()
37957 * Jeremy Fitzhardinge <jeremy@sw.oz.au>
37958@@ -34,71 +34,6 @@
37959 .open = open_kcore,
37960 };
37961
37962-#ifdef CONFIG_KCORE_AOUT
37963-static ssize_t read_kcore(struct file *file, char *buf, size_t count, loff_t *ppos)
37964-{
37965- unsigned long long p = *ppos, memsize;
37966- ssize_t read;
37967- ssize_t count1;
37968- char * pnt;
37969- struct user dump;
37970-#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
37971-# define FIRST_MAPPED PAGE_SIZE /* we don't have page 0 mapped on x86.. */
37972-#else
37973-# define FIRST_MAPPED 0
37974-#endif
37975-
37976- memset(&dump, 0, sizeof(struct user));
37977- dump.magic = CMAGIC;
37978- dump.u_dsize = (virt_to_phys(high_memory) >> PAGE_SHIFT);
37979-#if defined (__i386__) || defined(__x86_64__)
37980- dump.start_code = PAGE_OFFSET;
37981-#endif
37982-#ifdef __alpha__
37983- dump.start_data = PAGE_OFFSET;
37984-#endif
37985-
37986- memsize = virt_to_phys(high_memory);
37987- if (p >= memsize)
37988- return 0;
37989- if (count > memsize - p)
37990- count = memsize - p;
37991- read = 0;
37992-
37993- if (p < sizeof(struct user) && count > 0) {
37994- count1 = count;
37995- if (p + count1 > sizeof(struct user))
37996- count1 = sizeof(struct user)-p;
37997- pnt = (char *) &dump + p;
37998- if (copy_to_user(buf,(void *) pnt, count1))
37999- return -EFAULT;
38000- buf += count1;
38001- p += count1;
38002- count -= count1;
38003- read += count1;
38004- }
38005-
38006- if (count > 0 && p < PAGE_SIZE + FIRST_MAPPED) {
38007- count1 = PAGE_SIZE + FIRST_MAPPED - p;
38008- if (count1 > count)
38009- count1 = count;
38010- if (clear_user(buf, count1))
38011- return -EFAULT;
38012- buf += count1;
38013- p += count1;
38014- count -= count1;
38015- read += count1;
38016- }
38017- if (count > 0) {
38018- if (copy_to_user(buf, (void *) (PAGE_OFFSET+p-PAGE_SIZE), count))
38019- return -EFAULT;
38020- read += count;
38021- }
38022- *ppos += read;
38023- return read;
38024-}
38025-#else /* CONFIG_KCORE_AOUT */
38026-
38027 #ifndef kc_vaddr_to_offset
38028 #define kc_vaddr_to_offset(v) ((v) - PAGE_OFFSET)
38029 #endif
38030@@ -480,4 +415,3 @@
38031
38032 return acc;
38033 }
38034-#endif /* CONFIG_KCORE_AOUT */
38035diff -Nru a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
38036--- a/fs/proc/task_mmu.c Thu Jun 19 16:57:39 2003
38037+++ b/fs/proc/task_mmu.c Sat Aug 23 05:08:00 2003
38038@@ -90,14 +90,14 @@
38039 ino = inode->i_ino;
38040 }
38041
38042- seq_printf(m, "%0*lx-%0*lx %c%c%c%c %0*lx %02x:%02x %lu %n",
38043- (int) (2*sizeof(void*)), map->vm_start,
38044- (int) (2*sizeof(void*)), map->vm_end,
38045+ seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
38046+ map->vm_start,
38047+ map->vm_end,
38048 flags & VM_READ ? 'r' : '-',
38049 flags & VM_WRITE ? 'w' : '-',
38050 flags & VM_EXEC ? 'x' : '-',
38051 flags & VM_MAYSHARE ? 's' : 'p',
38052- (int) (2*sizeof(void*)), map->vm_pgoff << PAGE_SHIFT,
38053+ map->vm_pgoff << PAGE_SHIFT,
38054 MAJOR(dev), MINOR(dev), ino, &len);
38055
38056 if (map->vm_file) {
38057diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
38058--- a/fs/reiserfs/inode.c Mon Aug 18 22:42:17 2003
38059+++ b/fs/reiserfs/inode.c Sun Aug 31 16:14:17 2003
38060@@ -2048,8 +2048,8 @@
38061 last_offset = inode->i_size & (PAGE_CACHE_SIZE - 1) ;
38062 /* no file contents in this page */
38063 if (page->index >= end_index + 1 || !last_offset) {
38064- error = 0 ;
38065- goto done ;
38066+ unlock_page(page);
38067+ return 0;
38068 }
38069 kaddr = kmap_atomic(page, KM_USER0);
38070 memset(kaddr + last_offset, 0, PAGE_CACHE_SIZE-last_offset) ;
38071diff -Nru a/fs/smbfs/inode.c b/fs/smbfs/inode.c
38072--- a/fs/smbfs/inode.c Wed Jun 25 16:30:54 2003
38073+++ b/fs/smbfs/inode.c Tue Aug 26 09:37:39 2003
38074@@ -212,7 +212,7 @@
38075 (long) last_sz, (long) inode->i_size);
38076
38077 if (!S_ISDIR(inode->i_mode))
38078- invalidate_inode_pages(inode->i_mapping);
38079+ invalidate_remote_inode(inode);
38080 }
38081 }
38082
38083@@ -276,7 +276,7 @@
38084 * But we do want to invalidate the caches ...
38085 */
38086 if (!S_ISDIR(inode->i_mode))
38087- invalidate_inode_pages(inode->i_mapping);
38088+ invalidate_remote_inode(inode);
38089 else
38090 smb_invalid_dir_cache(inode);
38091 error = -EIO;
38092diff -Nru a/include/asm-arm/apm.h b/include/asm-arm/apm.h
38093--- /dev/null Wed Dec 31 16:00:00 1969
38094+++ b/include/asm-arm/apm.h Thu Aug 7 11:38:41 2003
38095@@ -0,0 +1,56 @@
38096+/* -*- linux-c -*-
38097+ *
38098+ * (C) 2003 zecke@handhelds.org
38099+ *
38100+ * GPL version 2
38101+ *
38102+ * based on arch/arm/kernel/apm.c
38103+ * factor out the information needed by architectures to provide
38104+ * apm status
38105+ *
38106+ *
38107+ */
38108+#ifndef ARM_ASM_SA1100_APM_H
38109+#define ARM_ASM_SA1100_APM_H
38110+
38111+#include <linux/config.h>
38112+
38113+#ifdef CONFIG_APM
38114+
38115+
38116+#define APM_AC_OFFLINE 0
38117+#define APM_AC_ONLINE 1
38118+#define APM_AC_BACKUP 2
38119+#define APM_AC_UNKNOWN 0xFF
38120+
38121+#define APM_BATTERY_STATUS_HIGH 0
38122+#define APM_BATTERY_STATUS_LOW 1
38123+#define APM_BATTERY_STATUS_CRITICAL 2
38124+#define APM_BATTERY_STATUS_CHARGING 3
38125+#define APM_BATTERY_STATUS_UNKNOWN 0xFF
38126+
38127+#define APM_BATTERY_LIFE_UNKNOWN 0xFFFF
38128+#define APM_BATTERY_LIFE_MINUTES 0x8000
38129+#define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF
38130+
38131+/*
38132+ * This structure gets filled in by the machine specific 'get_power_status'
38133+ * implementation. Any fields which are not set default to a safe value.
38134+ */
38135+struct apm_power_info {
38136+ unsigned char ac_line_status;
38137+ unsigned char battery_status;
38138+ unsigned char battery_flag;
38139+ unsigned char battery_life;
38140+ int time;
38141+ int units;
38142+};
38143+
38144+/*
38145+ * This allows machines to provide their own "apm get power status" function.
38146+ */
38147+extern void (*apm_get_power_status)(struct apm_power_info *);
38148+#endif
38149+
38150+
38151+#endif
38152diff -Nru a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
38153--- a/include/asm-arm/arch-ebsa285/time.h Tue May 13 08:20:50 2003
38154+++ b/include/asm-arm/arch-ebsa285/time.h Sun Aug 24 07:55:20 2003
38155@@ -181,12 +181,13 @@
38156 }
38157
38158
38159+static unsigned long timer1_latch;
38160
38161 static unsigned long timer1_gettimeoffset (void)
38162 {
38163- unsigned long value = LATCH - *CSR_TIMER1_VALUE;
38164+ unsigned long value = timer1_latch - *CSR_TIMER1_VALUE;
38165
38166- return ((tick_nsec / 1000) * value) / LATCH;
38167+ return ((tick_nsec / 1000) * value) / timer1_latch;
38168 }
38169
38170 static irqreturn_t
38171@@ -260,8 +261,10 @@
38172 machine_is_personal_server()) {
38173 gettimeoffset = timer1_gettimeoffset;
38174
38175+ timer1_latch = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
38176+
38177 *CSR_TIMER1_CLR = 0;
38178- *CSR_TIMER1_LOAD = LATCH;
38179+ *CSR_TIMER1_LOAD = timer1_latch;
38180 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16;
38181
38182 timer_irq.handler = timer1_interrupt;
38183diff -Nru a/include/asm-arm/arch-ebsa285/timex.h b/include/asm-arm/arch-ebsa285/timex.h
38184--- a/include/asm-arm/arch-ebsa285/timex.h Tue Feb 5 09:39:51 2002
38185+++ b/include/asm-arm/arch-ebsa285/timex.h Sun Aug 24 07:55:20 2003
38186@@ -11,8 +11,8 @@
38187 */
38188
38189 /*
38190- * On EBSA285 boards, the clock runs at 50MHz and is
38191- * divided by a 4-bit prescaler. Other boards use an
38192- * ISA derived timer, and this is unused.
38193+ * We assume a constant here; this satisfies the maths in linux/timex.h
38194+ * and linux/time.h. CLOCK_TICK_RATE is actually system dependent, but
38195+ * this must be a constant.
38196 */
38197-#define CLOCK_TICK_RATE (mem_fclk_21285 / 16)
38198+#define CLOCK_TICK_RATE (50000000/16)
38199diff -Nru a/include/asm-arm/arch-iop3xx/iop310.h b/include/asm-arm/arch-iop3xx/iop310.h
38200--- a/include/asm-arm/arch-iop3xx/iop310.h Mon Apr 21 15:43:42 2003
38201+++ b/include/asm-arm/arch-iop3xx/iop310.h Wed Aug 13 16:46:20 2003
38202@@ -12,6 +12,14 @@
38203 #define _IOP310_HW_H_
38204
38205 /*
38206+ * This is needed for mixed drivers that need to work on all
38207+ * IOP3xx variants but behave slightly differently on each.
38208+ */
38209+#ifndef __ASSEMBLY__
38210+#define iop_is_310() ((processor_id & 0xffffe3f0) == 0x69052000)
38211+#endif
38212+
38213+/*
38214 * IOP310 I/O and Mem space regions for PCI autoconfiguration
38215 */
38216 #define IOP310_PCISEC_LOWER_IO 0x90010000
38217diff -Nru a/include/asm-arm/arch-iop3xx/iop321.h b/include/asm-arm/arch-iop3xx/iop321.h
38218--- a/include/asm-arm/arch-iop3xx/iop321.h Fri May 30 07:09:39 2003
38219+++ b/include/asm-arm/arch-iop3xx/iop321.h Wed Aug 13 16:46:20 2003
38220@@ -15,6 +15,10 @@
38221 #define _IOP321_HW_H_
38222
38223
38224+/*
38225+ * This is needed for mixed drivers that need to work on all
38226+ * IOP3xx variants but behave slightly differently on each.
38227+ */
38228 #ifndef __ASSEMBLY__
38229 #define iop_is_321() ((processor_id & 0xfffff7e0) == 0x69052420)
38230 #endif
38231diff -Nru a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h
38232--- a/include/asm-arm/arch-iop3xx/memory.h Tue Apr 15 08:12:47 2003
38233+++ b/include/asm-arm/arch-iop3xx/memory.h Wed Aug 13 16:46:20 2003
38234@@ -66,4 +66,6 @@
38235 extern void *mu_mem;
38236 #endif
38237
38238+#define PFN_TO_NID(addr) (0)
38239+
38240 #endif
38241diff -Nru a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
38242--- a/include/asm-arm/arch-pxa/pxa-regs.h Mon Apr 21 15:43:42 2003
38243+++ b/include/asm-arm/arch-pxa/pxa-regs.h Mon Jun 30 04:20:34 2003
38244@@ -836,7 +836,7 @@
38245
38246 #define GPIO1_RST 1 /* reset */
38247 #define GPIO6_MMCCLK 6 /* MMC Clock */
38248-#define GPIO8_48MHz 7 /* 48 MHz clock output */
38249+#define GPIO7_48MHz 7 /* 48 MHz clock output */
38250 #define GPIO8_MMCCS0 8 /* MMC Chip Select 0 */
38251 #define GPIO9_MMCCS1 9 /* MMC Chip Select 1 */
38252 #define GPIO10_RTCCLK 10 /* real time clock (1 Hz) */
38253@@ -939,7 +939,7 @@
38254
38255 #define GPIO1_RTS_MD ( 1 | GPIO_ALT_FN_1_IN)
38256 #define GPIO6_MMCCLK_MD ( 6 | GPIO_ALT_FN_1_OUT)
38257-#define GPIO8_48MHz_MD ( 8 | GPIO_ALT_FN_1_OUT)
38258+#define GPIO7_48MHz_MD ( 7 | GPIO_ALT_FN_1_OUT)
38259 #define GPIO8_MMCCS0_MD ( 8 | GPIO_ALT_FN_1_OUT)
38260 #define GPIO9_MMCCS1_MD ( 9 | GPIO_ALT_FN_1_OUT)
38261 #define GPIO10_RTCCLK_MD (10 | GPIO_ALT_FN_1_OUT)
38262diff -Nru a/include/asm-arm/arch-sa1100/simpad.h b/include/asm-arm/arch-sa1100/simpad.h
38263--- a/include/asm-arm/arch-sa1100/simpad.h Mon Feb 24 10:29:41 2003
38264+++ b/include/asm-arm/arch-sa1100/simpad.h Thu Aug 7 11:49:10 2003
38265@@ -5,17 +5,13 @@
38266 *
38267 * This file contains the hardware specific definitions for SIMpad
38268 *
38269- * 2001/05/14 Juergen Messerer <juergen.messerer@siemens.ch>
38270+ * 2001/05/14 Juergen Messerer <juergen.messerer@freesurf.ch>
38271 */
38272
38273-#ifndef SIMPAD_H
38274-#define SIMPAD_H
38275+#ifndef __ASM_ARCH_SIMPAD_H
38276+#define __ASM_ARCH_SIMPAD_H
38277
38278
38279-#ifndef __ASM_ARCH_HARDWARE_H
38280-#error "include <asm/hardware.h> instead"
38281-#endif
38282-
38283 #define GPIO_UART1_RTS GPIO_GPIO14
38284 #define GPIO_UART1_DTR GPIO_GPIO7
38285 #define GPIO_UART1_CTS GPIO_GPIO8
38286@@ -28,7 +24,8 @@
38287 #define GPIO_UART3_DCD GPIO_GPIO18
38288 #define GPIO_UART3_DSR GPIO_GPIO17
38289
38290-#define GPIO_UCB1300_IRQ GPIO_GPIO (22) /* UCB GPIO and touchscreen */
38291+#define GPIO_POWER_BUTTON GPIO_GPIO0
38292+#define GPIO_UCB1300_IRQ GPIO_GPIO22 /* UCB GPIO and touchscreen */
38293
38294 #define IRQ_UART1_CTS IRQ_GPIO15
38295 #define IRQ_UART1_DCD GPIO_GPIO23
38296@@ -37,21 +34,26 @@
38297 #define IRQ_UART3_DCD GPIO_GPIO18
38298 #define IRQ_UART3_DSR GPIO_GPIO17
38299
38300-#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
38301+#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
38302+#define IRQ_GPIO_POWER_BUTTON IRQ_GPIO0
38303
38304
38305 /*--- PCMCIA ---*/
38306 #define GPIO_CF_CD GPIO_GPIO24
38307-#define GPIO_CF_IRQ GPIO_GPIO1
38308+#define GPIO_CF_IRQ GPIO_GPIO1
38309 #define IRQ_GPIO_CF_IRQ IRQ_GPIO1
38310-#define IRQ_GPIO_CF_CD IRQ_GPIO24
38311+#define IRQ_GPIO_CF_CD IRQ_GPIO24
38312+
38313+/*--- SmartCard ---*/
38314+#define GPIO_SMART_CARD GPIO_GPIO10
38315+#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10
38316
38317-// CS3 Latch is write only, a shadow is necessary
38318+// CS3 Latch is write only, a shadow is necessary
38319
38320-#define CS3BUSTYPE unsigned volatile long
38321+#define CS3BUSTYPE unsigned volatile long
38322 #define CS3_BASE 0xf1000000
38323
38324-#define VCC_5V_EN 0x0001 // For 5V PCMCIA
38325+#define VCC_5V_EN 0x0001 // For 5V PCMCIA
38326 #define VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
38327 #define EN1 0x0004 // This is only for EPROM's
38328 #define EN0 0x0008 // Both should be enable for 3.3V or 5V
38329@@ -63,15 +65,43 @@
38330 #define IRDA_SD 0x0200 // Shutdown for powersave
38331 #define RS232_ON 0x0400
38332 #define SD_MEDIAQ 0x0800 // Shutdown for powersave
38333-#define LED2_ON 0x1000
38334+#define LED2_ON 0x1000
38335 #define IRDA_MODE 0x2000 // Fast/Slow IrDA mode
38336 #define ENABLE_5V 0x4000 // Enable 5V circuit
38337 #define RESET_SIMCARD 0x8000
38338
38339 #define RS232_ENABLE 0x0440
38340-#define PCMCIAMASK 0x402f
38341+#define PCMCIAMASK 0x402f
38342+
38343+
38344+struct simpad_battery {
38345+ unsigned char ac_status; /* line connected yes/no */
38346+ unsigned char status; /* battery loading yes/no */
38347+ unsigned char percentage; /* percentage loaded */
38348+ unsigned short life; /* life till empty */
38349+};
38350+
38351+/* These should match the apm_bios.h definitions */
38352+#define SIMPAD_AC_STATUS_AC_OFFLINE 0x00
38353+#define SIMPAD_AC_STATUS_AC_ONLINE 0x01
38354+#define SIMPAD_AC_STATUS_AC_BACKUP 0x02 /* What does this mean? */
38355+#define SIMPAD_AC_STATUS_AC_UNKNOWN 0xff
38356+
38357+/* These bitfields are rarely "or'd" together */
38358+#define SIMPAD_BATT_STATUS_HIGH 0x01
38359+#define SIMPAD_BATT_STATUS_LOW 0x02
38360+#define SIMPAD_BATT_STATUS_CRITICAL 0x04
38361+#define SIMPAD_BATT_STATUS_CHARGING 0x08
38362+#define SIMPAD_BATT_STATUS_CHARGE_MAIN 0x10
38363+#define SIMPAD_BATT_STATUS_DEAD 0x20 /* Battery will not charge */
38364+#define SIMPAD_BATT_NOT_INSTALLED 0x20 /* For expansion pack batteries */
38365+#define SIMPAD_BATT_STATUS_FULL 0x40 /* Battery fully charged (and connected to AC) */
38366+#define SIMPAD_BATT_STATUS_NOBATT 0x80
38367+#define SIMPAD_BATT_STATUS_UNKNOWN 0xff
38368+
38369+extern int simpad_get_battery(struct simpad_battery* );
38370
38371-#endif // SIMPAD_H
38372+#endif // __ASM_ARCH_SIMPAD_H
38373
38374
38375
38376diff -Nru a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h
38377--- a/include/asm-arm/checksum.h Tue Oct 15 10:15:06 2002
38378+++ b/include/asm-arm/checksum.h Mon Jun 23 03:41:42 2003
38379@@ -105,7 +105,7 @@
38380 adcs %0, %0, %5 \n\
38381 adc %0, %0, #0"
38382 : "=&r"(sum)
38383- : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len) << 16), "Ir" (proto << 8)
38384+ : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto))
38385 : "cc");
38386 return sum;
38387 }
38388@@ -127,7 +127,7 @@
38389 addcs %0, %0, #0x10000 \n\
38390 mvn %0, %0"
38391 : "=&r"(sum)
38392- : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (proto << 8)
38393+ : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto))
38394 : "cc");
38395 return sum >> 16;
38396 }
38397diff -Nru a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
38398--- a/include/asm-arm/dma-mapping.h Wed Jun 4 08:09:55 2003
38399+++ b/include/asm-arm/dma-mapping.h Wed Aug 13 16:46:20 2003
38400@@ -129,6 +129,28 @@
38401 }
38402
38403 /**
38404+ * dma_map_page - map a portion of a page for streaming DMA
38405+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
38406+ * @page: page that buffer resides in
38407+ * @offset: offset into page for start of buffer
38408+ * @size: size of buffer to map
38409+ * @dir: DMA transfer direction
38410+ *
38411+ * Ensure that any data held in the cache is appropriately discarded
38412+ * or written back.
38413+ *
38414+ * The device owns this memory once this call has completed. The CPU
38415+ * can regain ownership by calling dma_unmap_page() or dma_sync_single().
38416+ */
38417+static inline dma_addr_t
38418+dma_map_page(struct device *dev, struct page *page,
38419+ unsigned long offset, size_t size,
38420+ enum dma_data_direction dir)
38421+{
38422+ return dma_map_single(dev, page_address(page) + offset, size, (int)dir);
38423+}
38424+
38425+/**
38426 * dma_unmap_single - unmap a single buffer previously mapped
38427 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
38428 * @handle: DMA address of buffer
38429@@ -152,21 +174,26 @@
38430 /* nothing to do */
38431 }
38432
38433-#if 0
38434-static inline dma_addr_t
38435-dma_map_page(struct device *dev, struct page *page, unsigned long off,
38436- size_t size, enum dma_data_direction dir)
38437-{
38438- /* fixme */
38439-}
38440-
38441+/**
38442+ * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
38443+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
38444+ * @handle: DMA address of buffer
38445+ * @size: size of buffer to map
38446+ * @dir: DMA transfer direction
38447+ *
38448+ * Unmap a single streaming mode DMA translation. The handle and size
38449+ * must match what was provided in the previous dma_map_single() call.
38450+ * All other usages are undefined.
38451+ *
38452+ * After this call, reads by the CPU to the buffer are guaranteed to see
38453+ * whatever the device wrote there.
38454+ */
38455 static inline void
38456 dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size,
38457 enum dma_data_direction dir)
38458 {
38459- /* fixme */
38460+ dma_unmap_single(dev, handle, size, (int)dir);
38461 }
38462-#endif
38463
38464 /**
38465 * dma_map_sg - map a set of SG buffers for streaming mode DMA
38466diff -Nru a/include/asm-arm/hardware/amba.h b/include/asm-arm/hardware/amba.h
38467--- a/include/asm-arm/hardware/amba.h Wed Jun 18 15:23:24 2003
38468+++ b/include/asm-arm/hardware/amba.h Sun Aug 24 07:16:13 2003
38469@@ -28,8 +28,8 @@
38470 int (*probe)(struct amba_device *, void *);
38471 int (*remove)(struct amba_device *);
38472 void (*shutdown)(struct amba_device *);
38473- int (*suspend)(struct amba_device *, u32, u32);
38474- int (*resume)(struct amba_device *, u32);
38475+ int (*suspend)(struct amba_device *, u32);
38476+ int (*resume)(struct amba_device *);
38477 struct amba_id *id_table;
38478 };
38479
38480diff -Nru a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h
38481--- a/include/asm-arm/hardware/sa1111.h Tue Aug 5 12:36:08 2003
38482+++ b/include/asm-arm/hardware/sa1111.h Sun Aug 24 07:45:05 2003
38483@@ -542,9 +542,16 @@
38484
38485 #define SA1111_DEV(_d) container_of((_d), struct sa1111_dev, dev)
38486
38487+#define sa1111_get_drvdata(d) dev_get_drvdata(&(d)->dev)
38488+#define sa1111_set_drvdata(d,p) dev_get_drvdata(&(d)->dev, p)
38489+
38490 struct sa1111_driver {
38491 struct device_driver drv;
38492 unsigned int devid;
38493+ int (*probe)(struct sa1111_dev *);
38494+ int (*remove)(struct sa1111_dev *);
38495+ int (*suspend)(struct sa1111_dev *, u32);
38496+ int (*resume)(struct sa1111_dev *);
38497 };
38498
38499 #define SA1111_DRV(_d) container_of((_d), struct sa1111_driver, drv)
38500@@ -572,5 +579,8 @@
38501 int sa1111_get_audio_rate(struct sa1111_dev *sadev);
38502
38503 int sa1111_check_dma_bug(dma_addr_t addr);
38504+
38505+int sa1111_driver_register(struct sa1111_driver *);
38506+void sa1111_driver_unregister(struct sa1111_driver *);
38507
38508 #endif /* _ASM_ARCH_SA1111 */
38509diff -Nru a/include/asm-arm/pci.h b/include/asm-arm/pci.h
38510--- a/include/asm-arm/pci.h Mon Jun 9 09:25:33 2003
38511+++ b/include/asm-arm/pci.h Wed Aug 13 16:46:20 2003
38512@@ -96,6 +96,19 @@
38513 return dma_unmap_sg(hwdev ? &hwdev->dev : NULL, sg, nents, dir);
38514 }
38515
38516+static inline dma_addr_t
38517+pci_map_page(struct pci_dev *hwdev, struct page *page, unsigned long offset,
38518+ size_t size, int dir)
38519+{
38520+ return pci_map_single(hwdev, page_address(page) + offset, size, dir);
38521+}
38522+
38523+static inline void
38524+pci_unmap_page(struct pci_dev *hwdev, dma_addr_t handle, size_t size, int dir)
38525+{
38526+ return pci_unmap_single(hwdev, handle, size, dir);
38527+}
38528+
38529 static inline void
38530 pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t handle, size_t size, int dir)
38531 {
38532diff -Nru a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h
38533--- a/include/asm-arm/proc-armo/processor.h Wed May 29 08:06:36 2002
38534+++ b/include/asm-arm/proc-armo/processor.h Sun Aug 31 16:14:08 2003
38535@@ -43,7 +43,7 @@
38536 uaccess_t *uaccess; /* User access functions*/
38537
38538 #define EXTRA_THREAD_STRUCT_INIT \
38539- uaccess: &uaccess_kernel,
38540+ .uaccess = &uaccess_kernel,
38541
38542 #define start_thread(regs,pc,sp) \
38543 ({ \
38544diff -Nru a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
38545--- a/include/asm-arm/unistd.h Tue Jan 14 15:28:43 2003
38546+++ b/include/asm-arm/unistd.h Tue Jul 8 09:40:32 2003
38547@@ -303,7 +303,7 @@
38548 "swi 0\n\t" \
38549 "pop {r7}"
38550 #else
38551-#define __syscall(name) "swi\t" __sys1(__NR_##name) "\n\t"
38552+#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
38553 #endif
38554 #endif
38555
38556@@ -318,24 +318,28 @@
38557
38558 #define _syscall0(type,name) \
38559 type name(void) { \
38560- register long __res __asm__("r0"); \
38561+ register long __res_r0 __asm__("r0"); \
38562+ long __res; \
38563 __asm__ __volatile__ ( \
38564 __syscall(name) \
38565- :"=r" (__res) \
38566+ : "=r" (__res_r0) \
38567 : \
38568 : "lr"); \
38569+ __res = __res_r0; \
38570 __syscall_return(type,__res); \
38571 }
38572
38573 #define _syscall1(type,name,type1,arg1) \
38574 type name(type1 arg1) { \
38575 register long __r0 __asm__("r0") = (long)arg1; \
38576- register long __res __asm__("r0"); \
38577+ register long __res_r0 __asm__("r0"); \
38578+ long __res; \
38579 __asm__ __volatile__ ( \
38580 __syscall(name) \
38581- : "=r" (__res) \
38582+ : "=r" (__res_r0) \
38583 : "r" (__r0) \
38584 : "lr"); \
38585+ __res = __res_r0; \
38586 __syscall_return(type,__res); \
38587 }
38588
38589@@ -343,12 +347,14 @@
38590 type name(type1 arg1,type2 arg2) { \
38591 register long __r0 __asm__("r0") = (long)arg1; \
38592 register long __r1 __asm__("r1") = (long)arg2; \
38593- register long __res __asm__("r0"); \
38594+ register long __res_r0 __asm__("r0"); \
38595+ long __res; \
38596 __asm__ __volatile__ ( \
38597 __syscall(name) \
38598- : "=r" (__res) \
38599+ : "=r" (__res_r0) \
38600 : "r" (__r0),"r" (__r1) \
38601 : "lr"); \
38602+ __res = __res_r0; \
38603 __syscall_return(type,__res); \
38604 }
38605
38606@@ -358,12 +364,14 @@
38607 register long __r0 __asm__("r0") = (long)arg1; \
38608 register long __r1 __asm__("r1") = (long)arg2; \
38609 register long __r2 __asm__("r2") = (long)arg3; \
38610- register long __res __asm__("r0"); \
38611+ register long __res_r0 __asm__("r0"); \
38612+ long __res; \
38613 __asm__ __volatile__ ( \
38614 __syscall(name) \
38615- : "=r" (__res) \
38616+ : "=r" (__res_r0) \
38617 : "r" (__r0),"r" (__r1),"r" (__r2) \
38618 : "lr"); \
38619+ __res = __res_r0; \
38620 __syscall_return(type,__res); \
38621 }
38622
38623@@ -374,12 +382,14 @@
38624 register long __r1 __asm__("r1") = (long)arg2; \
38625 register long __r2 __asm__("r2") = (long)arg3; \
38626 register long __r3 __asm__("r3") = (long)arg4; \
38627- register long __res __asm__("r0"); \
38628+ register long __res_r0 __asm__("r0"); \
38629+ long __res; \
38630 __asm__ __volatile__ ( \
38631 __syscall(name) \
38632- : "=r" (__res) \
38633+ : "=r" (__res_r0) \
38634 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \
38635 : "lr"); \
38636+ __res = __res_r0; \
38637 __syscall_return(type,__res); \
38638 }
38639
38640@@ -391,12 +401,14 @@
38641 register long __r2 __asm__("r2") = (long)arg3; \
38642 register long __r3 __asm__("r3") = (long)arg4; \
38643 register long __r4 __asm__("r4") = (long)arg5; \
38644- register long __res __asm__("r0"); \
38645+ register long __res_r0 __asm__("r0"); \
38646+ long __res; \
38647 __asm__ __volatile__ ( \
38648 __syscall(name) \
38649- : "=r" (__res) \
38650+ : "=r" (__res_r0) \
38651 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \
38652 : "lr"); \
38653+ __res = __res_r0; \
38654 __syscall_return(type,__res); \
38655 }
38656
38657@@ -408,12 +420,14 @@
38658 register long __r3 __asm__("r3") = (long)arg4; \
38659 register long __r4 __asm__("r4") = (long)arg5; \
38660 register long __r5 __asm__("r5") = (long)arg6; \
38661- register long __res __asm__("r0"); \
38662+ register long __res_r0 __asm__("r0"); \
38663+ long __res; \
38664 __asm__ __volatile__ ( \
38665 __syscall(name) \
38666- : "=r" (__res) \
38667+ : "=r" (__res_r0) \
38668 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \
38669 : "lr"); \
38670+ __res = __res_r0; \
38671 __syscall_return(type,__res); \
38672 }
38673
38674diff -Nru a/include/asm-arm/xor.h b/include/asm-arm/xor.h
38675--- a/include/asm-arm/xor.h Mon Feb 4 23:41:12 2002
38676+++ b/include/asm-arm/xor.h Sun Aug 31 16:14:08 2003
38677@@ -125,11 +125,11 @@
38678 }
38679
38680 static struct xor_block_template xor_block_arm4regs = {
38681- name: "arm4regs",
38682- do_2: xor_arm4regs_2,
38683- do_3: xor_arm4regs_3,
38684- do_4: xor_arm4regs_4,
38685- do_5: xor_arm4regs_5,
38686+ .name = "arm4regs",
38687+ .do_2 = xor_arm4regs_2,
38688+ .do_3 = xor_arm4regs_3,
38689+ .do_4 = xor_arm4regs_4,
38690+ .do_5 = xor_arm4regs_5,
38691 };
38692
38693 #undef XOR_TRY_TEMPLATES
38694diff -Nru a/include/asm-arm26/processor.h b/include/asm-arm26/processor.h
38695--- a/include/asm-arm26/processor.h Thu Jun 26 03:24:47 2003
38696+++ b/include/asm-arm26/processor.h Sun Aug 31 16:14:08 2003
38697@@ -51,7 +51,7 @@
38698 uaccess_t *uaccess; /* User access functions*/
38699
38700 #define EXTRA_THREAD_STRUCT_INIT \
38701- uaccess: &uaccess_kernel,
38702+ .uaccess = &uaccess_kernel,
38703
38704 // FIXME?!!
38705
38706diff -Nru a/include/asm-arm26/xor.h b/include/asm-arm26/xor.h
38707--- a/include/asm-arm26/xor.h Wed Jun 4 04:14:11 2003
38708+++ b/include/asm-arm26/xor.h Sun Aug 31 16:14:08 2003
38709@@ -125,11 +125,11 @@
38710 }
38711
38712 static struct xor_block_template xor_block_arm4regs = {
38713- name: "arm4regs",
38714- do_2: xor_arm4regs_2,
38715- do_3: xor_arm4regs_3,
38716- do_4: xor_arm4regs_4,
38717- do_5: xor_arm4regs_5,
38718+ .name = "arm4regs",
38719+ .do_2 = xor_arm4regs_2,
38720+ .do_3 = xor_arm4regs_3,
38721+ .do_4 = xor_arm4regs_4,
38722+ .do_5 = xor_arm4regs_5,
38723 };
38724
38725 #undef XOR_TRY_TEMPLATES
38726diff -Nru a/include/asm-h8300/aki3068net/ne.h b/include/asm-h8300/aki3068net/ne.h
38727--- a/include/asm-h8300/aki3068net/ne.h Sat Jul 19 05:41:33 2003
38728+++ /dev/null Wed Dec 31 16:00:00 1969
38729@@ -1,28 +0,0 @@
38730-/* AE-3068 (aka. aki3068net) RTL8019AS Config */
38731-
38732-#ifndef __H8300_AKI3068NET_NE__
38733-#define __H8300_AKI3068NET_NE__
38734-
38735-#define NE2000_ADDR 0x200000
38736-#define NE2000_IRQ 5
38737-#define NE2000_IRQ_VECTOR (12 + NE2000_IRQ)
38738-#define NE2000_BYTE volatile unsigned short
38739-
38740-#define IER 0xfee015
38741-#define ISR 0xfee016
38742-#define IRQ_MASK (1 << NE2000_IRQ)
38743-
38744-#define WCRL 0xfee023
38745-#define MAR0A 0xffff20
38746-#define ETCR0A 0xffff24
38747-#define DTCR0A 0xffff27
38748-#define MAR0B 0xffff28
38749-#define DTCR0B 0xffff2f
38750-
38751-#define H8300_INIT_NE() \
38752-do { \
38753- wordlength = 1; \
38754- outb_p(0x48, ioaddr + EN0_DCFG); \
38755-} while(0)
38756-
38757-#endif
38758diff -Nru a/include/asm-h8300/aki3068net/timer_rate.h b/include/asm-h8300/aki3068net/timer_rate.h
38759--- a/include/asm-h8300/aki3068net/timer_rate.h Sat Jul 19 09:19:25 2003
38760+++ /dev/null Wed Dec 31 16:00:00 1969
38761@@ -1,9 +0,0 @@
38762-#ifndef __H8300_AKI3068NET_TIMER_RATE__
38763-#define __H8300_AKI3068NET_TIMER_RATE__
38764-
38765-#include <linux/config.h>
38766-
38767-#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
38768-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
38769-
38770-#endif
38771diff -Nru a/include/asm-h8300/edosk2674/timer_rate.h b/include/asm-h8300/edosk2674/timer_rate.h
38772--- a/include/asm-h8300/edosk2674/timer_rate.h Sat Jul 19 09:18:09 2003
38773+++ /dev/null Wed Dec 31 16:00:00 1969
38774@@ -1,4 +0,0 @@
38775-#include <linux/config.h>
38776-
38777-#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
38778-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
38779diff -Nru a/include/asm-h8300/h8300_smsc.h b/include/asm-h8300/h8300_smsc.h
38780--- /dev/null Wed Dec 31 16:00:00 1969
38781+++ b/include/asm-h8300/h8300_smsc.h Sun Aug 31 14:01:50 2003
38782@@ -0,0 +1,20 @@
38783+/****************************************************************************/
38784+
38785+/*
38786+ * h8300_smsc.h -- SMSC in H8/300H and H8S Evalution Board.
38787+ *
38788+ * (C) Copyright 2003, Yoshinori Sato <ysato@users.sourceforge.jp>
38789+ */
38790+
38791+/****************************************************************************/
38792+#ifndef h8300smsc_h
38793+#define h8300smsc_h
38794+/****************************************************************************/
38795+
38796+/* Such a description is OK ? */
38797+#define H8300_SMSC_DEFINE
38798+#include <asm/machine-depend.h>
38799+#undef H8300_SMSC_DEFINE
38800+
38801+/****************************************************************************/
38802+#endif /* h8300smsc_h */
38803diff -Nru a/include/asm-h8300/h8max/machine-depend.h b/include/asm-h8300/h8max/machine-depend.h
38804--- a/include/asm-h8300/h8max/machine-depend.h Thu Aug 21 22:56:17 2003
38805+++ b/include/asm-h8300/h8max/machine-depend.h Wed Aug 27 07:02:04 2003
38806@@ -101,67 +101,3 @@
38807 }
38808
38809 #endif
38810-
38811-/* H8MAX IDE I/F Config */
38812-#ifdef H8300_IDE_DEFINE
38813-
38814-#define H8300_IDE_BASE 0x200000
38815-#define H8300_IDE_CTRL 0x60000c
38816-#define H8300_IDE_IRQ 5
38817-#define H8300_IDE_REG_OFFSET 2
38818-
38819-#undef outb
38820-#undef inb
38821-#undef outb_p
38822-#undef inb_p
38823-#undef outsw
38824-#undef insw
38825-
38826-#define outb(d,a) h8max_outb(d,(unsigned short *)a)
38827-#define inb(a) h8max_inb((unsigned char *)a)
38828-#define outb_p(d,a) h8max_outb(d,(unsigned short *)a)
38829-#define inb_p(a) h8max_inb((unsigned char *)a)
38830-#define outsw(addr,buf,len) h8max_outsw(addr,buf,len);
38831-#define insw(addr,buf,len) h8max_insw(addr,buf,len);
38832-
38833-static inline void h8max_outb(unsigned short d,unsigned short *a)
38834-{
38835- *a = d;
38836-}
38837-
38838-static inline unsigned char h8max_inb(unsigned char *a)
38839-{
38840- return *(a+1);
38841-}
38842-
38843-static inline void h8max_outsw(void *addr, void *buf, int len)
38844-{
38845- unsigned volatile short *ap = (unsigned volatile short *)addr;
38846- unsigned short *bp = (unsigned short *)buf;
38847- unsigned short d;
38848- while(len--) {
38849- d = *bp++;
38850- *ap = (d >> 8) | (d << 8);
38851- }
38852-}
38853-
38854-static inline void h8max_insw(void *addr, void *buf, int len)
38855-{
38856- unsigned volatile short *ap = (unsigned volatile short *)addr;
38857- unsigned short *bp = (unsigned short *)buf;
38858- unsigned short d;
38859- while(len--) {
38860- d = *ap;
38861- *bp++ = (d >> 8) | (d << 8);
38862- }
38863-}
38864-
38865-static inline void target_ide_fix_driveid(struct hd_driveid *id)
38866-{
38867- int c;
38868- unsigned short *p = (unsigned short *)id;
38869- for (c = 0; c < SECTOR_WORDS; c++, p++)
38870- *p = (*p >> 8) | (*p << 8);
38871-}
38872-
38873-#endif
38874diff -Nru a/include/asm-h8300/h8max/ne.h b/include/asm-h8300/h8max/ne.h
38875--- a/include/asm-h8300/h8max/ne.h Sat Jul 19 05:41:33 2003
38876+++ /dev/null Wed Dec 31 16:00:00 1969
38877@@ -1,97 +0,0 @@
38878-/* H8MAX RTL8019AS Config */
38879-
38880-#ifndef __H8300_H8MAX_NE__
38881-#define __H8300_H8MAX_NE__
38882-
38883-#define NE2000_ADDR 0x800600
38884-#define NE2000_IRQ 4
38885-#define NE2000_IRQ_VECTOR (12 + NE2000_IRQ)
38886-#define NE2000_BYTE volatile unsigned short
38887-
38888-#define IER 0xfee015
38889-#define ISR 0xfee016
38890-#define IRQ_MASK (1 << NE2000_IRQ)
38891-/* sorry quick hack */
38892-#if defined(outb)
38893-# undef outb
38894-#endif
38895-#define outb(d,a) h8max_outb((d),(a) - NE2000_ADDR)
38896-#if defined(inb)
38897-# undef inb
38898-#endif
38899-#define inb(a) h8max_inb((a) - NE2000_ADDR)
38900-#if defined(outb_p)
38901-# undef outb_p
38902-#endif
38903-#define outb_p(d,a) h8max_outb((d),(a) - NE2000_ADDR)
38904-#if defined(inb_p)
38905-# undef inb_p
38906-#endif
38907-#define inb_p(a) h8max_inb((a) - NE2000_ADDR)
38908-#if defined(outsw)
38909-# undef outsw
38910-#endif
38911-#define outsw(a,p,l) h8max_outsw((a) - NE2000_ADDR,(unsigned short *)p,l)
38912-#if defined(insw)
38913-# undef insw
38914-#endif
38915-#define insw(a,p,l) h8max_insw((a) - NE2000_ADDR,(unsigned short *)p,l)
38916-#if defined(outsb)
38917-# undef outsb
38918-#endif
38919-#define outsb(a,p,l) h8max_outsb((a) - NE2000_ADDR,(unsigned char *)p,l)
38920-#if defined(insb)
38921-# undef insb
38922-#endif
38923-#define insb(a,p,l) h8max_insb((a) - NE2000_ADDR,(unsigned char *)p,l)
38924-
38925-#define H8300_INIT_NE() \
38926-do { \
38927- wordlength = 2; \
38928- h8max_outb(0x49, ioaddr + EN0_DCFG); \
38929- SA_prom[14] = SA_prom[15] = 0x57;\
38930-} while(0)
38931-
38932-static inline void h8max_outb(unsigned char d,unsigned char a)
38933-{
38934- *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
38935-}
38936-
38937-static inline unsigned char h8max_inb(unsigned char a)
38938-{
38939- return *(unsigned char *)(NE2000_ADDR + (a << 1) +1);
38940-}
38941-
38942-static inline void h8max_outsw(unsigned char a,unsigned short *p,unsigned long l)
38943-{
38944- unsigned short d;
38945- for (; l != 0; --l, p++) {
38946- d = (((*p) >> 8) & 0xff) | ((*p) << 8);
38947- *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
38948- }
38949-}
38950-
38951-static inline void h8max_insw(unsigned char a,unsigned short *p,unsigned long l)
38952-{
38953- unsigned short d;
38954- for (; l != 0; --l, p++) {
38955- d = *(unsigned short *)(NE2000_ADDR + (a << 1));
38956- *p = (d << 8)|((d >> 8) & 0xff);
38957- }
38958-}
38959-
38960-static inline void h8max_outsb(unsigned char a,unsigned char *p,unsigned long l)
38961-{
38962- for (; l != 0; --l, p++) {
38963- *(unsigned short *)(NE2000_ADDR + (a << 1)) = *p;
38964- }
38965-}
38966-
38967-static inline void h8max_insb(unsigned char a,unsigned char *p,unsigned long l)
38968-{
38969- for (; l != 0; --l, p++) {
38970- *p = *((unsigned char *)(NE2000_ADDR + (a << 1))+1);
38971- }
38972-}
38973-
38974-#endif
38975diff -Nru a/include/asm-h8300/h8max/timer_rate.h b/include/asm-h8300/h8max/timer_rate.h
38976--- a/include/asm-h8300/h8max/timer_rate.h Sat Jul 19 09:19:25 2003
38977+++ /dev/null Wed Dec 31 16:00:00 1969
38978@@ -1,10 +0,0 @@
38979-#ifndef __H8300_H8MAX_TIMER_RATE__
38980-#define __H8300_H8MAX_TIMER_RATE__
38981-
38982-#include <linux/config.h>
38983-
38984-#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
38985-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
38986-
38987-#endif
38988-
38989diff -Nru a/include/asm-h8300/ide.h b/include/asm-h8300/ide.h
38990--- a/include/asm-h8300/ide.h Thu Aug 21 08:55:15 2003
38991+++ b/include/asm-h8300/ide.h Wed Aug 27 07:12:57 2003
38992@@ -16,145 +16,26 @@
38993 #ifdef __KERNEL__
38994 /****************************************************************************/
38995
38996-#include <linux/config.h>
38997-#include <linux/interrupt.h>
38998+void h8300_ide_print_resource(char *name, hw_regs_t *hw);
38999+static inline int ide_default_irq(unsigned long base) { return 0; };
39000+static inline ide_ioreg_t ide_default_io_base(int index) { return 0; };
39001
39002-#include <asm/setup.h>
39003-#include <asm/io.h>
39004-#include <asm/irq.h>
39005-
39006-/*
39007- * Some coldfire specifics.
39008- */
39009-
39010-/*
39011- * Save some space, only have 1 interface.
39012- */
39013-#define MAX_HWIFS 1
39014-
39015-/*
39016- * Fix up things that may not have been provided.
39017- */
39018-
39019-#undef SUPPORT_SLOW_DATA_PORTS
39020-#define SUPPORT_SLOW_DATA_PORTS 0
39021-
39022-#undef SUPPORT_VLB_SYNC
39023-#define SUPPORT_VLB_SYNC 0
39024-
39025-/* this definition is used only on startup .. */
39026-#undef HD_DATA
39027-#define HD_DATA NULL
39028-
39029-#define DBGIDE(fmt,a...)
39030-// #define DBGIDE(fmt,a...) printk(fmt, ##a)
39031-#define IDE_INLINE __inline__
39032-// #define IDE_INLINE
39033-
39034-#define ide__sti() __sti()
39035-
39036-/****************************************************************************/
39037-
39038-typedef union {
39039- unsigned all : 8; /* all of the bits together */
39040- struct {
39041- unsigned bit7 : 1; /* always 1 */
39042- unsigned lba : 1; /* using LBA instead of CHS */
39043- unsigned bit5 : 1; /* always 1 */
39044- unsigned unit : 1; /* drive select number, 0 or 1 */
39045- unsigned head : 4; /* always zeros here */
39046- } b;
39047-} select_t;
39048-
39049-/*
39050- * Our list of ports/irq's for different boards.
39051- */
39052-
39053-/* machine depend header include */
39054-#define H8300_IDE_DEFINE
39055-#include <asm/machine-depend.h>
39056-#undef H8300_IDE_DEFINE
39057-
39058-/****************************************************************************/
39059-
39060-static IDE_INLINE int ide_default_irq(ide_ioreg_t base)
39061+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
39062+ unsigned long ctrl_port, int *irq)
39063 {
39064- return H8300_IDE_IRQ+12;
39065 }
39066
39067-static IDE_INLINE ide_ioreg_t ide_default_io_base(int index)
39068-{
39069- return (ide_ioreg_t)H8300_IDE_BASE;
39070-}
39071
39072-/*
39073- * Set up a hw structure for a specified data port, control port and IRQ.
39074- * This should follow whatever the default interface uses.
39075- */
39076-static IDE_INLINE void ide_init_hwif_ports(
39077- hw_regs_t *hw,
39078- ide_ioreg_t data_port,
39079- ide_ioreg_t ctrl_port,
39080- int *irq)
39081+static inline void ide_init_default_hwifs(void)
39082 {
39083- ide_ioreg_t reg = data_port;
39084- int i;
39085-
39086- for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
39087- hw->io_ports[i] = reg;
39088- reg += H8300_IDE_REG_OFFSET;
39089- }
39090- if (ctrl_port) {
39091- hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
39092- } else {
39093- hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t)H8300_IDE_CTRL;
39094- }
39095 }
39096
39097+#define MAX_HWIFS 1
39098
39099-/*
39100- * This registers the standard ports for this architecture with the IDE
39101- * driver.
39102- */
39103-static IDE_INLINE void ide_init_default_hwifs(void)
39104-{
39105- hw_regs_t hw;
39106- ide_ioreg_t base;
39107- int index;
39108-
39109- for (index = 0; index < MAX_HWIFS; index++) {
39110- base = ide_default_io_base(index);
39111- if (!base)
39112- continue;
39113- memset(&hw, 0, sizeof(hw));
39114- ide_init_hwif_ports(&hw, base, 0, NULL);
39115- hw.irq = ide_default_irq(base);
39116- ide_register_hw(&hw, NULL);
39117- }
39118-}
39119-
39120-#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
39121-#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
39122-#define ide_check_region(from,extent) (0)
39123-#define ide_request_region(from,extent,name) do {} while(0)
39124-#define ide_release_region(from,extent) do {} while(0)
39125-
39126-/*
39127- * The following are not needed for the non-m68k ports
39128- */
39129-#define ide_ack_intr(hwif) (1)
39130-#define ide_fix_driveid(id) target_ide_fix_driveid(id)
39131-#define ide_release_lock(lock) do {} while (0)
39132-#define ide_get_lock(lock, hdlr, data) do {} while (0)
39133-
39134-static IDE_INLINE void ide_print_resource(char *name,hw_regs_t *hw)
39135-{
39136- printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name,
39137- (unsigned int)hw->io_ports[IDE_DATA_OFFSET],
39138- (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+(8*H8300_IDE_REG_OFFSET)-1,
39139- (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET],
39140- hw->irq);
39141-}
39142+#define __ide_mm_insw(port,addr,count) do { } while(0)
39143+#define __ide_mm_insl(port,addr,count) do { } while(0)
39144+#define __ide_mm_outsw(port,addr,count) do { } while(0)
39145+#define __ide_mm_outsl(port,addr,count) do { } while(0)
39146
39147 /****************************************************************************/
39148 #endif /* __KERNEL__ */
39149diff -Nru a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
39150--- a/include/asm-h8300/irq.h Sun Jul 13 23:17:52 2003
39151+++ b/include/asm-h8300/irq.h Wed Aug 27 07:02:04 2003
39152@@ -3,11 +3,35 @@
39153
39154 #include <asm/ptrace.h>
39155
39156-#if defined(CONFIG_CPU_H8300H)
39157+#if defined(__H8300H__)
39158 #define NR_IRQS 64
39159+#define EXT_IRQ0 12
39160+#define EXT_IRQ1 13
39161+#define EXT_IRQ2 14
39162+#define EXT_IRQ3 15
39163+#define EXT_IRQ4 16
39164+#define EXT_IRQ5 17
39165+#define EXT_IRQ6 18
39166+#define EXT_IRQ7 19
39167 #endif
39168 #if defined(CONFIG_CPU_H8S)
39169 #define NR_IRQS 128
39170+#define EXT_IRQ0 16
39171+#define EXT_IRQ1 17
39172+#define EXT_IRQ2 18
39173+#define EXT_IRQ3 19
39174+#define EXT_IRQ4 20
39175+#define EXT_IRQ5 21
39176+#define EXT_IRQ6 22
39177+#define EXT_IRQ7 23
39178+#define EXT_IRQ8 24
39179+#define EXT_IRQ9 25
39180+#define EXT_IRQ10 26
39181+#define EXT_IRQ11 27
39182+#define EXT_IRQ12 28
39183+#define EXT_IRQ13 29
39184+#define EXT_IRQ14 30
39185+#define EXT_IRQ15 31
39186 #endif
39187
39188 static __inline__ int irq_canonicalize(int irq)
39189diff -Nru a/include/asm-h8300/machine-depend.h b/include/asm-h8300/machine-depend.h
39190--- a/include/asm-h8300/machine-depend.h Thu Aug 21 22:56:18 2003
39191+++ /dev/null Wed Dec 31 16:00:00 1969
39192@@ -1,70 +0,0 @@
39193-/* EDOSK2674 board depend header */
39194-
39195-/* TIMER rate define */
39196-#ifdef H8300_TIMER_DEFINE
39197-#define H8300_TIMER_COUNT_DATA 33000*10/8192
39198-#define H8300_TIMER_FREQ 33000*1000/8192
39199-#endif
39200-
39201-/* EDOSK-2674R SMSC Network Controler Target Depend impliments */
39202-#ifdef H8300_SMSC_DEFINE
39203-
39204-#define SMSC_BASE 0xf80000
39205-#define SMSC_IRQ 16
39206-
39207-/* sorry quick hack */
39208-#if defined(outw)
39209-# undef outw
39210-#endif
39211-#define outw(d,a) edosk2674_smsc_outw(d,(volatile unsigned short *)(a))
39212-#if defined(inw)
39213-# undef inw
39214-#endif
39215-#define inw(a) edosk2674_smsc_inw((volatile unsigned short *)(a))
39216-#if defined(outsw)
39217-# undef outsw
39218-#endif
39219-#define outsw(a,p,l) edosk2674_smsc_outsw((volatile unsigned short *)(a),p,l)
39220-#if defined(insw)
39221-# undef insw
39222-#endif
39223-#define insw(a,p,l) edosk2674_smsc_insw((volatile unsigned short *)(a),p,l)
39224-
39225-static inline void edosk2674_smsc_outw(
39226- unsigned short d,
39227- volatile unsigned short *a
39228- )
39229-{
39230- *a = (d >> 8) | (d << 8);
39231-}
39232-
39233-static inline unsigned short edosk2674_smsc_inw(
39234- volatile unsigned short *a
39235- )
39236-{
39237- unsigned short d;
39238- d = *a;
39239- return (d >> 8) | (d << 8);
39240-}
39241-
39242-static inline void edosk2674_smsc_outsw(
39243- volatile unsigned short *a,
39244- unsigned short *p,
39245- unsigned long l
39246- )
39247-{
39248- for (; l != 0; --l, p++)
39249- *a = *p;
39250-}
39251-
39252-static inline void edosk2674_smsc_insw(
39253- volatile unsigned short *a,
39254- unsigned short *p,
39255- unsigned long l
39256- )
39257-{
39258- for (; l != 0; --l, p++)
39259- *p = *a;
39260-}
39261-
39262-#endif
39263diff -Nru a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
39264--- a/include/asm-h8300/pci.h Mon Jun 9 09:25:52 2003
39265+++ b/include/asm-h8300/pci.h Wed Aug 27 07:02:04 2003
39266@@ -19,4 +19,6 @@
39267 /* We don't do dynamic PCI IRQ allocation */
39268 }
39269
39270+#define PCI_DMA_BUS_IS_PHYS (1)
39271+
39272 #endif /* _ASM_H8300_PCI_H */
39273diff -Nru a/include/asm-i386/apic.h b/include/asm-i386/apic.h
39274--- a/include/asm-i386/apic.h Sun Jun 15 11:00:08 2003
39275+++ b/include/asm-i386/apic.h Fri Aug 29 03:51:17 2003
39276@@ -64,6 +64,8 @@
39277 apic_write_around(APIC_EOI, 0);
39278 }
39279
39280+extern void (*wait_timer_tick)(void);
39281+
39282 extern int get_maxlvt(void);
39283 extern void clear_local_APIC(void);
39284 extern void connect_bsp_APIC (void);
39285diff -Nru a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
39286--- a/include/asm-i386/bugs.h Sun Apr 20 12:24:22 2003
39287+++ b/include/asm-i386/bugs.h Sun Aug 31 16:14:48 2003
39288@@ -193,11 +193,6 @@
39289 && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11))
39290 panic("Kernel compiled for PMMX+, assumes a local APIC without the read-before-write bug!");
39291 #endif
39292-
39293-#ifdef CONFIG_X86_SSE2
39294- if (!cpu_has_sse2)
39295- panic("Kernel compiled for SSE2, CPU doesn't have it.");
39296-#endif
39297 }
39298
39299 extern void alternative_instructions(void);
39300diff -Nru a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
39301--- /dev/null Wed Dec 31 16:00:00 1969
39302+++ b/include/asm-i386/hpet.h Sun Aug 31 16:15:40 2003
39303@@ -0,0 +1,116 @@
39304+
39305+#ifndef _I386_HPET_H
39306+#define _I386_HPET_H
39307+
39308+#ifdef CONFIG_HPET_TIMER
39309+
39310+#include <linux/errno.h>
39311+#include <linux/module.h>
39312+#include <linux/sched.h>
39313+#include <linux/kernel.h>
39314+#include <linux/param.h>
39315+#include <linux/string.h>
39316+#include <linux/mm.h>
39317+#include <linux/interrupt.h>
39318+#include <linux/time.h>
39319+#include <linux/delay.h>
39320+#include <linux/init.h>
39321+#include <linux/smp.h>
39322+
39323+#include <asm/io.h>
39324+#include <asm/smp.h>
39325+#include <asm/irq.h>
39326+#include <asm/msr.h>
39327+#include <asm/delay.h>
39328+#include <asm/mpspec.h>
39329+#include <asm/uaccess.h>
39330+#include <asm/processor.h>
39331+
39332+#include <linux/timex.h>
39333+#include <linux/config.h>
39334+
39335+#include <asm/fixmap.h>
39336+
39337+/*
39338+ * Documentation on HPET can be found at:
39339+ * http://www.intel.com/ial/home/sp/pcmmspec.htm
39340+ * ftp://download.intel.com/ial/home/sp/mmts098.pdf
39341+ */
39342+
39343+#define HPET_MMAP_SIZE 1024
39344+
39345+#define HPET_ID 0x000
39346+#define HPET_PERIOD 0x004
39347+#define HPET_CFG 0x010
39348+#define HPET_STATUS 0x020
39349+#define HPET_COUNTER 0x0f0
39350+#define HPET_T0_CFG 0x100
39351+#define HPET_T0_CMP 0x108
39352+#define HPET_T0_ROUTE 0x110
39353+#define HPET_T1_CFG 0x120
39354+#define HPET_T1_CMP 0x128
39355+#define HPET_T1_ROUTE 0x130
39356+#define HPET_T2_CFG 0x140
39357+#define HPET_T2_CMP 0x148
39358+#define HPET_T2_ROUTE 0x150
39359+
39360+#define HPET_ID_VENDOR 0xffff0000
39361+#define HPET_ID_LEGSUP 0x00008000
39362+#define HPET_ID_NUMBER 0x00001f00
39363+#define HPET_ID_REV 0x000000ff
39364+
39365+#define HPET_ID_VENDOR_SHIFT 16
39366+#define HPET_ID_VENDOR_8086 0x8086
39367+
39368+#define HPET_CFG_ENABLE 0x001
39369+#define HPET_CFG_LEGACY 0x002
39370+
39371+#define HPET_TN_ENABLE 0x004
39372+#define HPET_TN_PERIODIC 0x008
39373+#define HPET_TN_PERIODIC_CAP 0x010
39374+#define HPET_TN_SETVAL 0x040
39375+#define HPET_TN_32BIT 0x100
39376+
39377+/* Use our own asm for 64 bit multiply/divide */
39378+#define ASM_MUL64_REG(eax_out,edx_out,reg_in,eax_in) \
39379+ __asm__ __volatile__("mull %2" \
39380+ :"=a" (eax_out), "=d" (edx_out) \
39381+ :"r" (reg_in), "0" (eax_in))
39382+
39383+#define ASM_DIV64_REG(eax_out,edx_out,reg_in,eax_in,edx_in) \
39384+ __asm__ __volatile__("divl %2" \
39385+ :"=a" (eax_out), "=d" (edx_out) \
39386+ :"r" (reg_in), "0" (eax_in), "1" (edx_in))
39387+
39388+#define KERNEL_TICK_USEC (1000000UL/HZ) /* tick value in microsec */
39389+/* Max HPET Period is 10^8 femto sec as in HPET spec */
39390+#define HPET_MAX_PERIOD (100000000UL)
39391+/*
39392+ * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
39393+ * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
39394+ */
39395+#define HPET_MIN_PERIOD (100000UL)
39396+
39397+extern unsigned long hpet_period; /* fsecs / HPET clock */
39398+extern unsigned long hpet_tick; /* hpet clks count per tick */
39399+extern unsigned long hpet_address; /* hpet memory map physical address */
39400+
39401+extern int hpet_rtc_timer_init(void);
39402+extern int hpet_enable(void);
39403+extern int is_hpet_enabled(void);
39404+extern int is_hpet_capable(void);
39405+extern int hpet_readl(unsigned long a);
39406+extern void hpet_writel(unsigned long d, unsigned long a);
39407+
39408+#ifdef CONFIG_RTC
39409+#define CONFIG_HPET_EMULATE_RTC 1
39410+extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
39411+extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
39412+extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec);
39413+extern int hpet_set_periodic_freq(unsigned long freq);
39414+extern int hpet_rtc_dropped_irq(void);
39415+extern int hpet_rtc_timer_init(void);
39416+extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
39417+#endif /* CONFIG_RTC */
39418+#endif /* CONFIG_HPET_TIMER */
39419+#endif /* _I386_HPET_H */
39420diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h
39421--- a/include/asm-i386/processor.h Wed Aug 20 11:14:51 2003
39422+++ b/include/asm-i386/processor.h Sun Aug 31 16:13:54 2003
39423@@ -578,6 +578,8 @@
39424 #define ARCH_HAS_PREFETCH
39425 extern inline void prefetch(const void *x)
39426 {
39427+ if (cpu_data[0].x86_vendor == X86_VENDOR_AMD)
39428+ return; /* Some athlons fault if the address is bad */
39429 alternative_input(ASM_NOP4,
39430 "prefetchnta (%1)",
39431 X86_FEATURE_XMM,
39432diff -Nru a/include/asm-i386/smp.h b/include/asm-i386/smp.h
39433--- a/include/asm-i386/smp.h Mon Aug 18 19:46:23 2003
39434+++ b/include/asm-i386/smp.h Sun Aug 31 16:14:42 2003
39435@@ -32,7 +32,6 @@
39436 */
39437
39438 extern void smp_alloc_memory(void);
39439-extern physid_mask_t phys_cpu_present_map;
39440 extern int pic_mode;
39441 extern int smp_num_siblings;
39442 extern int cpu_sibling_map[];
39443diff -Nru a/include/asm-i386/timer.h b/include/asm-i386/timer.h
39444--- a/include/asm-i386/timer.h Wed Jul 2 21:21:34 2003
39445+++ b/include/asm-i386/timer.h Sun Aug 31 16:15:21 2003
39446@@ -38,4 +38,8 @@
39447 extern struct timer_opts timer_cyclone;
39448 #endif
39449
39450+#ifdef CONFIG_HPET_TIMER
39451+extern struct timer_opts timer_hpet;
39452+#endif
39453+
39454 #endif
39455diff -Nru a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
39456--- a/include/asm-ia64/hw_irq.h Tue Jul 29 08:53:10 2003
39457+++ b/include/asm-ia64/hw_irq.h Tue Aug 26 15:09:18 2003
39458@@ -39,9 +39,9 @@
39459 * Vectors 0x10-0x1f are used for low priority interrupts, e.g. CMCI.
39460 */
39461 #define IA64_CPEP_VECTOR 0x1c /* corrected platform error polling vector */
39462-#define IA64_CMCP_VECTOR 0x1d /* correctable machine-check polling vector */
39463+#define IA64_CMCP_VECTOR 0x1d /* corrected machine-check polling vector */
39464 #define IA64_CPE_VECTOR 0x1e /* corrected platform error interrupt vector */
39465-#define IA64_CMC_VECTOR 0x1f /* correctable machine-check interrupt vector */
39466+#define IA64_CMC_VECTOR 0x1f /* corrected machine-check interrupt vector */
39467 /*
39468 * Vectors 0x20-0x2f are reserved for legacy ISA IRQs.
39469 */
39470diff -Nru a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
39471--- a/include/asm-ia64/pci.h Tue Jun 24 14:16:56 2003
39472+++ b/include/asm-ia64/pci.h Mon Aug 25 14:45:43 2003
39473@@ -74,7 +74,7 @@
39474 #define pci_dac_dma_supported(pci_dev, mask) (1)
39475 #define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
39476 #define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
39477-#define pci_dac_dma_to_offset(dev,dma_addr) ((dma_addr) & ~PAGE_MASK)
39478+#define pci_dac_dma_to_offset(dev,dma_addr) offset_in_page(dma_addr)
39479 #define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0)
39480
39481 #define sg_dma_len(sg) ((sg)->dma_length)
39482diff -Nru a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
39483--- a/include/asm-ia64/unistd.h Tue Aug 19 23:13:40 2003
39484+++ b/include/asm-ia64/unistd.h Mon Aug 25 14:47:33 2003
39485@@ -248,6 +248,7 @@
39486 #define __NR_sys_clock_nanosleep 1256
39487 #define __NR_sys_fstatfs64 1257
39488 #define __NR_sys_statfs64 1258
39489+#define __NR_fadvises64_64 1259
39490
39491 #ifdef __KERNEL__
39492
39493diff -Nru a/include/asm-m68k/local.h b/include/asm-m68k/local.h
39494--- /dev/null Wed Dec 31 16:00:00 1969
39495+++ b/include/asm-m68k/local.h Sun Jul 27 17:23:16 2003
39496@@ -0,0 +1,6 @@
39497+#ifndef _ASM_M68K_LOCAL_H
39498+#define _ASM_M68K_LOCAL_H
39499+
39500+#include <asm-generic/local.h>
39501+
39502+#endif /* _ASM_M68K_LOCAL_H */
39503diff -Nru a/include/asm-m68k/sections.h b/include/asm-m68k/sections.h
39504--- /dev/null Wed Dec 31 16:00:00 1969
39505+++ b/include/asm-m68k/sections.h Sun Jul 27 17:23:16 2003
39506@@ -0,0 +1,6 @@
39507+#ifndef _ASM_M68K_SECTIONS_H
39508+#define _ASM_M68K_SECTIONS_H
39509+
39510+#include <asm-generic/sections.h>
39511+
39512+#endif /* _ASM_M68K_SECTIONS_H */
39513diff -Nru a/include/asm-m68k/system.h b/include/asm-m68k/system.h
39514--- a/include/asm-m68k/system.h Wed Feb 26 10:53:19 2003
39515+++ b/include/asm-m68k/system.h Tue Aug 12 05:48:28 2003
39516@@ -36,9 +36,12 @@
39517 #define switch_to(prev,next,last) do { \
39518 register void *_prev __asm__ ("a0") = (prev); \
39519 register void *_next __asm__ ("a1") = (next); \
39520+ register void *_last __asm__ ("d1"); \
39521 __asm__ __volatile__("jbsr resume" \
39522- : : "a" (_prev), "a" (_next) \
39523- : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \
39524+ : "=a" (_prev), "=a" (_next), "=d" (_last) \
39525+ : "0" (_prev), "1" (_next) \
39526+ : "d0", "d2", "d3", "d4", "d5"); \
39527+ (last) = _last; \
39528 } while (0)
39529
39530
39531diff -Nru a/include/asm-ppc/cpm_8260.h b/include/asm-ppc/cpm_8260.h
39532--- a/include/asm-ppc/cpm_8260.h Sun Sep 15 21:52:03 2002
39533+++ b/include/asm-ppc/cpm_8260.h Thu Aug 21 15:26:43 2003
39534@@ -195,7 +195,7 @@
39535
39536 /* SMC uart mode register (Internal memory map).
39537 */
39538-#define SMCMR_REN ((ushort)0x0001)
39539+#define SMCMR_REN ((ushort)0x0001)
39540 #define SMCMR_TEN ((ushort)0x0002)
39541 #define SMCMR_DM ((ushort)0x000c)
39542 #define SMCMR_SM_GCI ((ushort)0x0000)
39543@@ -212,10 +212,12 @@
39544
39545 /* SMC Event and Mask register.
39546 */
39547-#define SMCM_TXE ((unsigned char)0x10)
39548-#define SMCM_BSY ((unsigned char)0x04)
39549-#define SMCM_TX ((unsigned char)0x02)
39550-#define SMCM_RX ((unsigned char)0x01)
39551+#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
39552+#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
39553+#define SMCM_TXE ((unsigned char)0x10)
39554+#define SMCM_BSY ((unsigned char)0x04)
39555+#define SMCM_TX ((unsigned char)0x02)
39556+#define SMCM_RX ((unsigned char)0x01)
39557
39558 /* Baud rate generators.
39559 */
39560@@ -314,10 +316,10 @@
39561
39562 /* SCC Event and Mask register.
39563 */
39564-#define SCCM_TXE ((unsigned char)0x10)
39565-#define SCCM_BSY ((unsigned char)0x04)
39566-#define SCCM_TX ((unsigned char)0x02)
39567-#define SCCM_RX ((unsigned char)0x01)
39568+#define SCCM_TXE ((unsigned char)0x10)
39569+#define SCCM_BSY ((unsigned char)0x04)
39570+#define SCCM_TX ((unsigned char)0x02)
39571+#define SCCM_RX ((unsigned char)0x01)
39572
39573 typedef struct scc_param {
39574 ushort scc_rbase; /* Rx Buffer descriptor base address */
39575diff -Nru a/include/asm-ppc/macio.h b/include/asm-ppc/macio.h
39576--- a/include/asm-ppc/macio.h Sat Aug 9 09:39:19 2003
39577+++ b/include/asm-ppc/macio.h Sun Aug 24 04:06:49 2003
39578@@ -42,6 +42,9 @@
39579 #define to_macio_device(d) container_of(d, struct macio_dev, ofdev.dev)
39580 #define of_to_macio_device(d) container_of(d, struct macio_dev, ofdev)
39581
39582+extern struct macio_dev *macio_dev_get(struct macio_dev *dev);
39583+extern void macio_dev_put(struct macio_dev *dev);
39584+
39585 /*
39586 * A driver for a mac-io chip based device
39587 */
39588@@ -54,8 +57,8 @@
39589 int (*probe)(struct macio_dev* dev, const struct of_match *match);
39590 int (*remove)(struct macio_dev* dev);
39591
39592- int (*suspend)(struct macio_dev* dev, u32 state, u32 level);
39593- int (*resume)(struct macio_dev* dev, u32 level);
39594+ int (*suspend)(struct macio_dev* dev, u32 state);
39595+ int (*resume)(struct macio_dev* dev);
39596 int (*shutdown)(struct macio_dev* dev);
39597
39598 struct device_driver driver;
39599diff -Nru a/include/asm-ppc/of_device.h b/include/asm-ppc/of_device.h
39600--- a/include/asm-ppc/of_device.h Sat Aug 9 09:40:04 2003
39601+++ b/include/asm-ppc/of_device.h Sun Aug 24 04:06:49 2003
39602@@ -39,6 +39,9 @@
39603 extern const struct of_match *of_match_device(
39604 const struct of_match *matches, const struct of_device *dev);
39605
39606+extern struct of_device *of_dev_get(struct of_device *dev);
39607+extern void of_dev_put(struct of_device *dev);
39608+
39609 /*
39610 * An of_platform_driver driver is attached to a basic of_device on
39611 * the "platform bus" (of_platform_bus_type)
39612@@ -52,8 +55,8 @@
39613 int (*probe)(struct of_device* dev, const struct of_match *match);
39614 int (*remove)(struct of_device* dev);
39615
39616- int (*suspend)(struct of_device* dev, u32 state, u32 level);
39617- int (*resume)(struct of_device* dev, u32 level);
39618+ int (*suspend)(struct of_device* dev, u32 state);
39619+ int (*resume)(struct of_device* dev);
39620 int (*shutdown)(struct of_device* dev);
39621
39622 struct device_driver driver;
39623@@ -65,6 +68,7 @@
39624 extern int of_device_register(struct of_device *ofdev);
39625 extern void of_device_unregister(struct of_device *ofdev);
39626 extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id);
39627+extern void of_release_dev(struct device *dev);
39628
39629 #endif /* __OF_DEVICE_H__ */
39630
39631diff -Nru a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
39632--- a/include/asm-ppc/processor.h Wed Jul 16 20:41:10 2003
39633+++ b/include/asm-ppc/processor.h Fri Aug 22 05:26:16 2003
39634@@ -654,6 +654,7 @@
39635 */
39636 #define EISA_bus 0
39637 #define MCA_bus 0
39638+#define MCA_bus__is_a_macro
39639
39640 /* Lazy FPU handling on uni-processor */
39641 extern struct task_struct *last_task_used_math;
39642diff -Nru a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
39643--- a/include/asm-ppc/prom.h Sat Jan 4 03:31:26 2003
39644+++ b/include/asm-ppc/prom.h Sun Aug 24 03:57:52 2003
39645@@ -62,18 +62,35 @@
39646 struct prom_args;
39647 typedef void (*prom_entry)(struct prom_args *);
39648
39649-/* Prototypes */
39650-extern void abort(void);
39651-extern unsigned long prom_init(int, int, prom_entry);
39652-extern void prom_print(const char *msg);
39653-extern void relocate_nodes(void);
39654-extern void finish_device_tree(void);
39655+/* OBSOLETE: Old style node lookup */
39656 extern struct device_node *find_devices(const char *name);
39657 extern struct device_node *find_type_devices(const char *type);
39658 extern struct device_node *find_path_device(const char *path);
39659 extern struct device_node *find_compatible_devices(const char *type,
39660 const char *compat);
39661 extern struct device_node *find_all_nodes(void);
39662+
39663+/* New style node lookup */
39664+extern struct device_node *of_find_node_by_name(struct device_node *from,
39665+ const char *name);
39666+extern struct device_node *of_find_node_by_type(struct device_node *from,
39667+ const char *type);
39668+extern struct device_node *of_find_compatible_node(struct device_node *from,
39669+ const char *type, const char *compat);
39670+extern struct device_node *of_find_node_by_path(const char *path);
39671+extern struct device_node *of_find_all_nodes(struct device_node *prev);
39672+extern struct device_node *of_get_parent(const struct device_node *node);
39673+extern struct device_node *of_get_next_child(const struct device_node *node,
39674+ struct device_node *prev);
39675+extern struct device_node *of_node_get(struct device_node *node);
39676+extern void of_node_put(struct device_node *node);
39677+
39678+/* Other Prototypes */
39679+extern void abort(void);
39680+extern unsigned long prom_init(int, int, prom_entry);
39681+extern void prom_print(const char *msg);
39682+extern void relocate_nodes(void);
39683+extern void finish_device_tree(void);
39684 extern int device_is_compatible(struct device_node *device, const char *);
39685 extern int machine_is_compatible(const char *compat);
39686 extern unsigned char *get_property(struct device_node *node, const char *name,
39687diff -Nru a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
39688--- a/include/asm-ppc/unistd.h Tue Jul 15 04:47:19 2003
39689+++ b/include/asm-ppc/unistd.h Fri Aug 22 19:15:18 2003
39690@@ -258,8 +258,9 @@
39691 #define __NR_utimes 251
39692 #define __NR_statfs64 252
39693 #define __NR_fstatfs64 253
39694+#define __NR_fadvise64_64 254
39695
39696-#define __NR_syscalls 254
39697+#define __NR_syscalls 255
39698
39699 #define __NR(n) #n
39700
39701diff -Nru a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
39702--- a/include/asm-x86_64/bitops.h Mon Aug 18 19:46:23 2003
39703+++ b/include/asm-x86_64/bitops.h Sat Aug 23 04:08:11 2003
39704@@ -466,7 +466,7 @@
39705
39706 __asm__("bsfl %1,%0\n\t"
39707 "cmovzl %2,%0"
39708- : "=r" (r) : "g" (x), "r" (32));
39709+ : "=r" (r) : "g" (x), "r" (-1));
39710 return r+1;
39711 }
39712
39713diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h
39714--- a/include/asm-x86_64/ia32.h Fri May 23 03:22:07 2003
39715+++ b/include/asm-x86_64/ia32.h Sun Aug 31 16:13:59 2003
39716@@ -160,7 +160,6 @@
39717 char f_fpack[6];
39718 };
39719
39720-#define IA32_PAGE_OFFSET 0xffffe000
39721 #define IA32_STACK_TOP IA32_PAGE_OFFSET
39722
39723 #ifdef __KERNEL__
39724diff -Nru a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
39725--- a/include/asm-x86_64/mpspec.h Mon Aug 18 19:46:23 2003
39726+++ b/include/asm-x86_64/mpspec.h Sat Aug 23 05:13:33 2003
39727@@ -169,7 +169,6 @@
39728 extern cpumask_t mp_bus_to_cpumask [MAX_MP_BUSSES];
39729
39730 extern unsigned int boot_cpu_physical_apicid;
39731-extern cpumask_t phys_cpu_present_map;
39732 extern int smp_found_config;
39733 extern void find_smp_config (void);
39734 extern void get_smp_config (void);
39735@@ -197,6 +196,50 @@
39736 extern void mp_config_ioapic_for_sci(int irq);
39737
39738 extern int using_apic_timer;
39739+
39740+#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
39741+
39742+struct physid_mask
39743+{
39744+ unsigned long mask[PHYSID_ARRAY_SIZE];
39745+};
39746+
39747+typedef struct physid_mask physid_mask_t;
39748+
39749+#define physid_set(physid, map) set_bit(physid, (map).mask)
39750+#define physid_clear(physid, map) clear_bit(physid, (map).mask)
39751+#define physid_isset(physid, map) test_bit(physid, (map).mask)
39752+#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
39753+
39754+#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
39755+#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
39756+#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS)
39757+#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
39758+#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
39759+#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
39760+#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
39761+#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
39762+#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
39763+#define physids_coerce(map) ((map).mask[0])
39764+
39765+#define physids_promote(physids) \
39766+ ({ \
39767+ physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
39768+ __physid_mask.mask[0] = physids; \
39769+ __physid_mask; \
39770+ })
39771+
39772+#define physid_mask_of_physid(physid) \
39773+ ({ \
39774+ physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
39775+ physid_set(physid, __physid_mask); \
39776+ __physid_mask; \
39777+ })
39778+
39779+#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
39780+#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
39781+
39782+extern physid_mask_t phys_cpu_present_map;
39783
39784 #endif
39785
39786diff -Nru a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
39787--- a/include/asm-x86_64/percpu.h Fri Aug 8 13:06:56 2003
39788+++ b/include/asm-x86_64/percpu.h Sat Aug 23 05:29:54 2003
39789@@ -31,6 +31,9 @@
39790 memcpy((pcpudst)+__per_cpu_offset(__i), \
39791 (src), (size)); \
39792 } while (0)
39793+
39794+extern void setup_per_cpu_areas(void);
39795+
39796 #else /* ! SMP */
39797
39798 #define DEFINE_PER_CPU(type, name) \
39799@@ -45,7 +48,5 @@
39800
39801 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
39802 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
39803-
39804-extern void setup_per_cpu_areas(void);
39805
39806 #endif /* _ASM_X8664_PERCPU_H_ */
39807diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
39808--- a/include/asm-x86_64/processor.h Wed Aug 20 11:16:28 2003
39809+++ b/include/asm-x86_64/processor.h Sun Aug 31 16:13:59 2003
39810@@ -18,6 +18,7 @@
39811 #include <asm/current.h>
39812 #include <asm/system.h>
39813 #include <asm/mmsegment.h>
39814+#include <linux/personality.h>
39815
39816 #define TF_MASK 0x00000100
39817 #define IF_MASK 0x00000200
39818@@ -172,7 +173,8 @@
39819 /* This decides where the kernel will search for a free chunk of vm
39820 * space during mmap's.
39821 */
39822-#define TASK_UNMAPPED_32 0xa0000000
39823+#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
39824+#define TASK_UNMAPPED_32 (IA32_PAGE_OFFSET / 3)
39825 #define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3)
39826 #define TASK_UNMAPPED_BASE \
39827 (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64)
39828@@ -225,7 +227,6 @@
39829 * 8 bytes, for an extra "long" of ~0UL
39830 */
39831 unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
39832- u32 __cacheline_filler[4]; /* size is 0x100 */
39833 } __attribute__((packed)) ____cacheline_aligned;
39834
39835 struct thread_struct {
39836diff -Nru a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
39837--- a/include/asm-x86_64/smp.h Mon Aug 18 19:46:23 2003
39838+++ b/include/asm-x86_64/smp.h Sat Aug 23 05:14:50 2003
39839@@ -36,7 +36,6 @@
39840 */
39841
39842 extern void smp_alloc_memory(void);
39843-extern cpumask_t phys_cpu_present_map;
39844 extern cpumask_t cpu_online_map;
39845 extern volatile unsigned long smp_invalidate_needed;
39846 extern int pic_mode;
39847diff -Nru a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h
39848--- a/include/asm-x86_64/suspend.h Sat Jun 7 00:54:11 2003
39849+++ b/include/asm-x86_64/suspend.h Sat Aug 23 05:22:09 2003
39850@@ -44,7 +44,7 @@
39851 :"r" ((thread)->debugreg##register))
39852
39853 extern void fix_processor_context(void);
39854-extern void do_magic(int resume);
39855+extern int do_magic(int resume);
39856
39857 #ifdef CONFIG_ACPI_SLEEP
39858 extern unsigned long saved_eip;
39859diff -Nru a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
39860--- a/include/asm-x86_64/topology.h Mon Aug 18 19:46:23 2003
39861+++ b/include/asm-x86_64/topology.h Sat Aug 23 04:00:02 2003
39862@@ -10,21 +10,18 @@
39863 /* Map the K8 CPU local memory controllers to a simple 1:1 CPU:NODE topology */
39864
39865 extern int fake_node;
39866-extern cpumask_t cpu_online_map;
39867+extern unsigned long cpu_online_map;
39868
39869 #define cpu_to_node(cpu) (fake_node ? 0 : (cpu))
39870 #define memblk_to_node(memblk) (fake_node ? 0 : (memblk))
39871 #define parent_node(node) (node)
39872 #define node_to_first_cpu(node) (fake_node ? 0 : (node))
39873-#define node_to_cpu_mask(node) (fake_node ? cpu_online_map : cpumask_of_cpu(node))
39874+#define node_to_cpu_mask(node) (fake_node ? cpu_online_map : (1UL << (node)))
39875 #define node_to_memblk(node) (node)
39876
39877-static inline cpumask_t pcibus_to_cpumask(int bus)
39878+static inline unsigned long pcibus_to_cpumask(int bus)
39879 {
39880- cpumask_t ret;
39881-
39882- cpus_and(ret, mp_bus_to_cpumask[bus], cpu_online_map);
39883- return ret;
39884+ return mp_bus_to_cpumask[bus] & cpu_online_map;
39885 }
39886
39887 #define NODE_BALANCE_RATE 30 /* CHECKME */
39888diff -Nru a/include/linux/cyclomx.h b/include/linux/cyclomx.h
39889--- a/include/linux/cyclomx.h Tue May 20 07:19:38 2003
39890+++ b/include/linux/cyclomx.h Sat Aug 23 20:38:19 2003
39891@@ -52,7 +52,7 @@
39892 char in_isr; /* interrupt-in-service flag */
39893 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
39894 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
39895- u32 mbox; /* -> mailbox */
39896+ void *mbox; /* -> mailbox */
39897 void (*isr)(struct cycx_device* card); /* interrupt service routine */
39898 int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
39899 union {
39900diff -Nru a/include/linux/cycx_cfm.h b/include/linux/cycx_cfm.h
39901--- a/include/linux/cycx_cfm.h Thu May 15 19:24:05 2003
39902+++ b/include/linux/cycx_cfm.h Sat Aug 23 19:57:15 2003
39903@@ -90,7 +90,7 @@
39904 unsigned short reserved[6];
39905 char descr[CFM_DESCR_LEN];
39906 struct cycx_fw_info info;
39907- unsigned char image[1];
39908+ unsigned char image[0];
39909 };
39910
39911 struct cycx_fw_header {
39912diff -Nru a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h
39913--- a/include/linux/cycx_drv.h Thu May 15 19:33:21 2003
39914+++ b/include/linux/cycx_drv.h Sat Aug 23 20:11:44 2003
39915@@ -48,7 +48,7 @@
39916 struct cycx_hw {
39917 u32 fwid;
39918 int irq;
39919- u32 dpmbase;
39920+ void *dpmbase;
39921 u32 dpmsize;
39922 u32 reserved[5];
39923 };
39924@@ -58,7 +58,7 @@
39925 extern int cycx_down(struct cycx_hw *hw);
39926 extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
39927 extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
39928-extern int cycx_exec(u32 addr);
39929+extern int cycx_exec(void *addr);
39930
39931 extern void cycx_inten(struct cycx_hw *hw);
39932 extern void cycx_intr(struct cycx_hw *hw);
39933diff -Nru a/include/linux/fs.h b/include/linux/fs.h
39934--- a/include/linux/fs.h Fri Jul 11 10:32:02 2003
39935+++ b/include/linux/fs.h Sun Aug 31 16:14:42 2003
39936@@ -336,10 +336,8 @@
39937 };
39938
39939 struct block_device {
39940- struct list_head bd_hash;
39941- atomic_t bd_count;
39942- struct inode * bd_inode;
39943 dev_t bd_dev; /* not a kdev_t - it's a search key */
39944+ struct inode * bd_inode; /* will die */
39945 int bd_openers;
39946 struct semaphore bd_sem; /* open/close mutex */
39947 struct list_head bd_inodes;
39948@@ -347,10 +345,11 @@
39949 int bd_holders;
39950 struct block_device * bd_contains;
39951 unsigned bd_block_size;
39952- sector_t bd_offset;
39953+ struct hd_struct * bd_part;
39954 unsigned bd_part_count;
39955 int bd_invalidated;
39956 struct gendisk * bd_disk;
39957+ struct list_head bd_list;
39958 };
39959
39960 /*
39961@@ -468,6 +467,16 @@
39962 #endif
39963 }
39964
39965+static inline unsigned iminor(struct inode *inode)
39966+{
39967+ return minor(inode->i_rdev);
39968+}
39969+
39970+static inline unsigned imajor(struct inode *inode)
39971+{
39972+ return major(inode->i_rdev);
39973+}
39974+
39975 struct fown_struct {
39976 rwlock_t lock; /* protects pid, uid, euid fields */
39977 int pid; /* pid or -pgrp where SIGIO should be sent */
39978@@ -600,6 +609,10 @@
39979 extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *);
39980 #endif
39981
39982+extern void send_sigio(struct fown_struct *fown, int fd, int band);
39983+extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
39984+extern int fcntl_getlease(struct file *filp);
39985+
39986 /* fs/locks.c */
39987 extern void locks_init_lock(struct file_lock *);
39988 extern void locks_copy_lock(struct file_lock *, struct file_lock *);
39989@@ -1176,6 +1189,12 @@
39990 unsigned long invalidate_mapping_pages(struct address_space *mapping,
39991 pgoff_t start, pgoff_t end);
39992 unsigned long invalidate_inode_pages(struct address_space *mapping);
39993+static inline void invalidate_remote_inode(struct inode *inode)
39994+{
39995+ if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
39996+ S_ISLNK(inode->i_mode))
39997+ invalidate_inode_pages(inode->i_mapping);
39998+}
39999 extern void invalidate_inode_pages2(struct address_space *mapping);
40000 extern void write_inode_now(struct inode *, int);
40001 extern int filemap_fdatawrite(struct address_space *);
40002diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h
40003--- a/include/linux/genhd.h Thu Jun 5 23:32:48 2003
40004+++ b/include/linux/genhd.h Sun Aug 31 16:14:27 2003
40005@@ -197,7 +197,7 @@
40006
40007 static inline sector_t get_start_sect(struct block_device *bdev)
40008 {
40009- return bdev->bd_offset;
40010+ return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect;
40011 }
40012 static inline sector_t get_capacity(struct gendisk *disk)
40013 {
40014diff -Nru a/include/linux/ide.h b/include/linux/ide.h
40015--- a/include/linux/ide.h Wed Aug 20 09:01:03 2003
40016+++ b/include/linux/ide.h Sun Aug 24 15:46:28 2003
40017@@ -1242,21 +1242,6 @@
40018
40019 extern int generic_ide_ioctl(struct block_device *, unsigned, unsigned long);
40020
40021-/*
40022- * IDE modules.
40023- */
40024-#define IDE_CHIPSET_MODULE 0 /* not supported yet */
40025-#define IDE_PROBE_MODULE 1
40026-
40027-typedef int (ide_module_init_proc)(void);
40028-
40029-typedef struct ide_module_s {
40030- int type;
40031- ide_module_init_proc *init;
40032- void *info;
40033- struct ide_module_s *next;
40034-} ide_module_t;
40035-
40036 typedef struct ide_devices_s {
40037 char name[4]; /* hdX */
40038 unsigned attached : 1; /* native */
40039@@ -1274,8 +1259,7 @@
40040 */
40041 #ifndef _IDE_C
40042 extern ide_hwif_t ide_hwifs[]; /* master data repository */
40043-extern ide_module_t *ide_chipsets;
40044-extern ide_module_t *ide_probe;
40045+extern int (*ide_probe)(void);
40046
40047 extern ide_devices_t *idedisk;
40048 extern ide_devices_t *idecd;
40049@@ -1772,8 +1756,6 @@
40050 extern void ide_hwif_release_regions(ide_hwif_t* hwif);
40051 extern void ide_unregister (unsigned int index);
40052
40053-extern int export_ide_init_queue(ide_drive_t *);
40054-extern u8 export_probe_for_drive(ide_drive_t *);
40055 extern int probe_hwif_init(ide_hwif_t *);
40056
40057 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
40058@@ -1793,6 +1775,24 @@
40059 extern char *ide_xfer_verbose(u8 xfer_rate);
40060 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
40061 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
40062+
40063+typedef struct ide_pio_timings_s {
40064+ int setup_time; /* Address setup (ns) minimum */
40065+ int active_time; /* Active pulse (ns) minimum */
40066+ int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
40067+} ide_pio_timings_t;
40068+
40069+typedef struct ide_pio_data_s {
40070+ u8 pio_mode;
40071+ u8 use_iordy;
40072+ u8 overridden;
40073+ u8 blacklisted;
40074+ unsigned int cycle_time;
40075+} ide_pio_data_t;
40076+
40077+extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
40078+extern const ide_pio_timings_t ide_pio_timings[6];
40079+
40080
40081 extern spinlock_t ide_lock;
40082 extern struct semaphore ide_cfg_sem;
40083diff -Nru a/include/linux/kdev_t.h b/include/linux/kdev_t.h
40084--- a/include/linux/kdev_t.h Fri Aug 1 02:22:20 2003
40085+++ b/include/linux/kdev_t.h Tue Aug 26 09:25:39 2003
40086@@ -90,22 +90,7 @@
40087 return dev.value;
40088 }
40089
40090-static inline kdev_t val_to_kdev(unsigned int val)
40091-{
40092- kdev_t dev;
40093- dev.value = val;
40094- return dev;
40095-}
40096-
40097-#define HASHDEV(dev) (kdev_val(dev))
40098 #define NODEV (mk_kdev(0,0))
40099-
40100-static inline int kdev_same(kdev_t dev1, kdev_t dev2)
40101-{
40102- return dev1.value == dev2.value;
40103-}
40104-
40105-#define kdev_none(d1) (!kdev_val(d1))
40106
40107 /* Mask off the high bits for now.. */
40108 #define minor(dev) ((dev).value & 0xff)
40109diff -Nru a/include/linux/mmzone.h b/include/linux/mmzone.h
40110--- a/include/linux/mmzone.h Fri Aug 1 03:02:10 2003
40111+++ b/include/linux/mmzone.h Sun Aug 31 16:14:47 2003
40112@@ -89,17 +89,24 @@
40113
40114 ZONE_PADDING(_pad2_)
40115
40116- /*
40117- * measure of scanning intensity for this zone. It is calculated
40118- * as exponentially decaying average of the scanning priority
40119- * required to free enough pages in this zone
40120- * (zone_adj_pressure()).
40121+ /*
40122+ * prev_priority holds the scanning priority for this zone. It is
40123+ * defined as the scanning priority at which we achieved our reclaim
40124+ * target at the previous try_to_free_pages() or balance_pgdat()
40125+ * invokation.
40126 *
40127- * 0 --- low pressure
40128+ * We use prev_priority as a measure of how much stress page reclaim is
40129+ * under - it drives the swappiness decision: whether to unmap mapped
40130+ * pages.
40131 *
40132- * (DEF_PRIORITY << 10) --- high pressure
40133+ * temp_priority is used to remember the scanning priority at which
40134+ * this zone was successfully refilled to free_pages == pages_high.
40135+ *
40136+ * Access to both these fields is quite racy even on uniprocessor. But
40137+ * it is expected to average out OK.
40138 */
40139- int pressure;
40140+ int temp_priority;
40141+ int prev_priority;
40142
40143 /*
40144 * free areas of different sizes
40145diff -Nru a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
40146--- a/include/linux/nfsd/nfsfh.h Mon Feb 17 13:50:11 2003
40147+++ b/include/linux/nfsd/nfsfh.h Tue Aug 26 09:25:41 2003
40148@@ -294,8 +294,8 @@
40149 /* how much do we care for accuracy with MinixFS? */
40150 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
40151 }
40152- fhp->fh_post_rdev[0] = htonl((u32)major(inode->i_rdev));
40153- fhp->fh_post_rdev[1] = htonl((u32)minor(inode->i_rdev));
40154+ fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
40155+ fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
40156 fhp->fh_post_atime = inode->i_atime;
40157 fhp->fh_post_mtime = inode->i_mtime;
40158 fhp->fh_post_ctime = inode->i_ctime;
40159diff -Nru a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
40160--- a/include/linux/nfsd/state.h Thu Jun 26 21:26:02 2003
40161+++ b/include/linux/nfsd/state.h Sat Aug 23 15:07:31 2003
40162@@ -113,21 +113,15 @@
40163 int so_confirmed; /* successful OPEN_CONFIRM? */
40164 };
40165
40166-typedef struct {
40167- u32 dev; /* super_block->s_dev */
40168- unsigned long ino;
40169- u32 generation;
40170-} nfs4_ino_desc_t;
40171-
40172 /*
40173 * nfs4_file: a file opened by some number of (open) nfs4_stateowners.
40174 * o fi_perfile list is used to search for conflicting
40175 * share_acces, share_deny on the file.
40176 */
40177 struct nfs4_file {
40178- struct list_head fi_hash; /* hash by nfs4_ino_desc_t fields */
40179+ struct list_head fi_hash; /* hash by "struct inode *" */
40180 struct list_head fi_perfile; /* list: nfs4_stateid */
40181- nfs4_ino_desc_t fi_ino;
40182+ struct inode *fi_inode;
40183 u32 fi_id; /* used with stateowner->so_id
40184 * for openstateid_hashtbl hash */
40185 };
40186diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
40187--- a/include/linux/pci_ids.h Wed Aug 20 14:33:08 2003
40188+++ b/include/linux/pci_ids.h Sun Aug 31 14:12:07 2003
40189@@ -798,6 +798,7 @@
40190 #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
40191 #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
40192 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
40193+#define PCI_DEVICE_ID_APPLE_KAUAI_ATA 0x003b
40194 #define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
40195 #define PCI_DEVICE_ID_APPLE_TIGON3 0x1645
40196
40197@@ -1115,7 +1116,9 @@
40198 #define PCI_DEVICE_ID_TTI_HPT374 0x0008
40199
40200 #define PCI_VENDOR_ID_VIA 0x1106
40201-#define PCI_DEVICE_ID_VIA_P4X600 0x0198
40202+#define PCI_DEVICE_ID_VIA_8763_0 0x0198
40203+#define PCI_DEVICE_ID_VIA_8380_0 0x0204
40204+#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259
40205 #define PCI_DEVICE_ID_VIA_8363_0 0x0305
40206 #define PCI_DEVICE_ID_VIA_8371_0 0x0391
40207 #define PCI_DEVICE_ID_VIA_8501_0 0x0501
40208@@ -1130,10 +1133,10 @@
40209 #define PCI_DEVICE_ID_VIA_82C597_0 0x0597
40210 #define PCI_DEVICE_ID_VIA_82C598_0 0x0598
40211 #define PCI_DEVICE_ID_VIA_8601_0 0x0601
40212-#define PCI_DEVICE_ID_VIA_82C694X_0 0x0605
40213+#define PCI_DEVICE_ID_VIA_8605_0 0x0605
40214 #define PCI_DEVICE_ID_VIA_82C680 0x0680
40215 #define PCI_DEVICE_ID_VIA_82C686 0x0686
40216-#define PCI_DEVICE_ID_VIA_82C691 0x0691
40217+#define PCI_DEVICE_ID_VIA_82C691_0 0x0691
40218 #define PCI_DEVICE_ID_VIA_82C693 0x0693
40219 #define PCI_DEVICE_ID_VIA_82C693_1 0x0698
40220 #define PCI_DEVICE_ID_VIA_82C926 0x0926
40221@@ -1156,19 +1159,21 @@
40222 #define PCI_DEVICE_ID_VIA_8622 0x3102
40223 #define PCI_DEVICE_ID_VIA_8233C_0 0x3109
40224 #define PCI_DEVICE_ID_VIA_8361 0x3112
40225-#define PCI_DEVICE_ID_VIA_KM266 0x3116
40226-#define PCI_DEVICE_ID_VIA_CLE266 0x3123
40227+#define PCI_DEVICE_ID_VIA_XM266 0x3116
40228+#define PCI_DEVICE_ID_VIA_862X_0 0x3123
40229 #define PCI_DEVICE_ID_VIA_8753_0 0x3128
40230 #define PCI_DEVICE_ID_VIA_8233A 0x3147
40231-#define PCI_DEVICE_ID_VIA_8752 0x3148
40232+#define PCI_DEVICE_ID_VIA_8703_51_0 0x3148
40233 #define PCI_DEVICE_ID_VIA_8237_SATA 0x3149
40234-#define PCI_DEVICE_ID_VIA_KN266 0x3156
40235-#define PCI_DEVICE_ID_VIA_8754 0x3168
40236+#define PCI_DEVICE_ID_VIA_XN266 0x3156
40237+#define PCI_DEVICE_ID_VIA_8754C_0 0x3168
40238 #define PCI_DEVICE_ID_VIA_8235 0x3177
40239 #define PCI_DEVICE_ID_VIA_P4N333 0x3178
40240-#define PCI_DEVICE_ID_VIA_K8T400M_0 0x3188
40241+#define PCI_DEVICE_ID_VIA_8385_0 0x3188
40242 #define PCI_DEVICE_ID_VIA_8377_0 0x3189
40243-#define PCI_DEVICE_ID_VIA_KM400 0x3205
40244+#define PCI_DEVICE_ID_VIA_8378_0 0x3205
40245+#define PCI_DEVICE_ID_VIA_8783_0 0x3208
40246+#define PCI_DEVICE_ID_VIA_PT880 0x3258
40247 #define PCI_DEVICE_ID_VIA_P4M400 0x3209
40248 #define PCI_DEVICE_ID_VIA_8237 0x3227
40249 #define PCI_DEVICE_ID_VIA_86C100A 0x6100
40250@@ -1183,7 +1188,12 @@
40251 #define PCI_DEVICE_ID_VIA_8505_1 0x8605
40252 #define PCI_DEVICE_ID_VIA_8633_1 0xB091
40253 #define PCI_DEVICE_ID_VIA_8367_1 0xB099
40254-#define PCI_DEVICE_ID_VIA_8653_1 0xB101
40255+#define PCI_DEVICE_ID_VIA_P4X266_1 0xB101
40256+#define PCI_DEVICE_ID_VIA_8615_1 0xB103
40257+#define PCI_DEVICE_ID_VIA_8361_1 0xB112
40258+#define PCI_DEVICE_ID_VIA_8235_1 0xB168
40259+#define PCI_DEVICE_ID_VIA_838X_1 0xB188
40260+#define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198
40261
40262 #define PCI_VENDOR_ID_SIEMENS 0x110A
40263 #define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102
40264diff -Nru a/include/linux/personality.h b/include/linux/personality.h
40265--- a/include/linux/personality.h Sun Dec 29 15:44:39 2002
40266+++ b/include/linux/personality.h Sun Aug 31 16:13:59 2003
40267@@ -34,6 +34,7 @@
40268 SHORT_INODE = 0x1000000,
40269 WHOLE_SECONDS = 0x2000000,
40270 STICKY_TIMEOUTS = 0x4000000,
40271+ ADDR_LIMIT_3GB = 0x8000000,
40272 };
40273
40274 /*
40275@@ -56,6 +57,7 @@
40276 PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
40277 PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
40278 PER_LINUX32 = 0x0008,
40279+ PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
40280 PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
40281 PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
40282 PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
40283diff -Nru a/include/linux/pmu.h b/include/linux/pmu.h
40284--- a/include/linux/pmu.h Sun Feb 2 13:51:33 2003
40285+++ b/include/linux/pmu.h Mon Aug 25 10:06:34 2003
40286@@ -33,6 +33,7 @@
40287 #define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */
40288 #define PMU_SLEEP 0x7f /* put CPU to sleep */
40289 #define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */
40290+#define PMU_I2C_CMD 0x9a /* I2C operations */
40291 #define PMU_RESET 0xd0 /* reset CPU */
40292 #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
40293 #define PMU_GET_COVER 0xdc /* report cover open/closed */
40294@@ -69,6 +70,20 @@
40295 * or via PMU_INT_ENVIRONMENT on core99 */
40296 #define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */
40297
40298+/* I2C related definitions */
40299+#define PMU_I2C_MODE_SIMPLE 0
40300+#define PMU_I2C_MODE_STDSUB 1
40301+#define PMU_I2C_MODE_COMBINED 2
40302+
40303+#define PMU_I2C_BUS_STATUS 0
40304+#define PMU_I2C_BUS_SYSCLK 1
40305+#define PMU_I2C_BUS_POWER 2
40306+
40307+#define PMU_I2C_STATUS_OK 0
40308+#define PMU_I2C_STATUS_DATAREAD 1
40309+#define PMU_I2C_STATUS_BUSY 0xfe
40310+
40311+
40312 /* Kind of PMU (model) */
40313 enum {
40314 PMU_UNKNOWN,
40315@@ -127,6 +142,8 @@
40316 void (*done)(struct adb_request *), int nbytes, ...);
40317
40318 extern void pmu_poll(void);
40319+extern void pmu_poll_adb(void); /* For use by xmon */
40320+extern void pmu_wait_complete(struct adb_request *req);
40321
40322 /* For use before switching interrupts off for a long time;
40323 * warning: not stackable
40324@@ -138,9 +155,16 @@
40325
40326 extern void pmu_restart(void);
40327 extern void pmu_shutdown(void);
40328+extern void pmu_unlock(void);
40329
40330 extern int pmu_present(void);
40331 extern int pmu_get_model(void);
40332+
40333+extern int pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len);
40334+extern int pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len);
40335+extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
40336+extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
40337+
40338
40339 #ifdef CONFIG_PMAC_PBOOK
40340 /*
40341diff -Nru a/include/linux/proc_fs.h b/include/linux/proc_fs.h
40342--- a/include/linux/proc_fs.h Thu Jul 10 22:22:53 2003
40343+++ b/include/linux/proc_fs.h Sun Aug 31 16:14:22 2003
40344@@ -182,12 +182,6 @@
40345 remove_proc_entry(name,proc_net);
40346 }
40347
40348-/*
40349- * fs/proc/kcore.c
40350- */
40351-extern void kclist_add(struct kcore_list *, void *, size_t);
40352-extern struct kcore_list *kclist_del(void *);
40353-
40354 #else
40355
40356 #define proc_root_driver NULL
40357@@ -223,6 +217,9 @@
40358
40359 extern struct proc_dir_entry proc_root;
40360
40361+#endif /* CONFIG_PROC_FS */
40362+
40363+#if !defined(CONFIG_PROC_FS)
40364 static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
40365 {
40366 }
40367@@ -230,8 +227,10 @@
40368 {
40369 return NULL;
40370 }
40371-
40372-#endif /* CONFIG_PROC_FS */
40373+#else
40374+extern void kclist_add(struct kcore_list *, void *, size_t);
40375+extern struct kcore_list *kclist_del(void *);
40376+#endif
40377
40378 struct proc_inode {
40379 struct task_struct *task;
40380diff -Nru a/include/linux/sched.h b/include/linux/sched.h
40381--- a/include/linux/sched.h Wed Aug 20 22:32:07 2003
40382+++ b/include/linux/sched.h Sun Aug 31 16:14:26 2003
40383@@ -391,6 +391,7 @@
40384 struct timer_list real_timer;
40385 struct list_head posix_timers; /* POSIX.1b Interval Timers */
40386 unsigned long utime, stime, cutime, cstime;
40387+ unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */
40388 u64 start_time;
40389 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
40390 unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
40391diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h
40392--- a/include/linux/serial_core.h Wed Jul 16 01:49:46 2003
40393+++ b/include/linux/serial_core.h Sun Aug 24 08:17:18 2003
40394@@ -67,6 +67,9 @@
40395 #define PORT_PC9861 45
40396 #define PORT_PC9801_101 46
40397
40398+/* Macintosh Zilog type numbers */
40399+#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
40400+#define PORT_PMAC_ZILOG 51
40401
40402 #ifdef __KERNEL__
40403
40404diff -Nru a/include/linux/sonypi.h b/include/linux/sonypi.h
40405--- a/include/linux/sonypi.h Tue Feb 18 03:32:56 2003
40406+++ b/include/linux/sonypi.h Fri Aug 1 05:36:45 2003
40407@@ -94,6 +94,8 @@
40408 #define SONYPI_EVENT_MEMORYSTICK_INSERT 54
40409 #define SONYPI_EVENT_MEMORYSTICK_EJECT 55
40410 #define SONYPI_EVENT_ANYBUTTON_RELEASED 56
40411+#define SONYPI_EVENT_BATTERY_INSERT 57
40412+#define SONYPI_EVENT_BATTERY_REMOVE 58
40413
40414 /* get/set brightness */
40415 #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
40416diff -Nru a/include/linux/tpqic02.h b/include/linux/tpqic02.h
40417--- a/include/linux/tpqic02.h Mon May 12 20:10:40 2003
40418+++ b/include/linux/tpqic02.h Tue Aug 26 09:25:40 2003
40419@@ -587,10 +587,10 @@
40420 * |___________________ Reserved for diagnostics during debugging.
40421 */
40422
40423-#define TP_REWCLOSE(d) ((minor(d)&0x01) == 1) /* rewind bit */
40424+#define TP_REWCLOSE(d) ((d)&1) /* rewind bit */
40425 /* rewind is only done if data has been transferred */
40426-#define TP_DENS(dev) ((minor(dev) >> 1) & 0x07) /* tape density */
40427-#define TP_UNIT(dev) ((minor(dev) >> 4) & 0x07) /* unit number */
40428+#define TP_DENS(d) (((d) >> 1) & 0x07) /* tape density */
40429+#define TP_UNIT(d) (((d) >> 4) & 0x07) /* unit number */
40430
40431 /* print excessive diagnostics */
40432 #define TP_DIAGS(dev) (QIC02_TAPE_DEBUG & TPQD_DIAGS)
40433diff -Nru a/include/linux/tty.h b/include/linux/tty.h
40434--- a/include/linux/tty.h Thu Jul 17 22:30:53 2003
40435+++ b/include/linux/tty.h Tue Aug 26 09:25:40 2003
40436@@ -367,7 +367,7 @@
40437 extern int macserial_init(void);
40438 extern int a2232board_init(void);
40439
40440-extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
40441+extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
40442 const char *routine);
40443 extern char *tty_name(struct tty_struct *tty, char *buf);
40444 extern void tty_wait_until_sent(struct tty_struct * tty, long timeout);
40445diff -Nru a/include/linux/wait.h b/include/linux/wait.h
40446--- a/include/linux/wait.h Sun May 18 17:00:00 2003
40447+++ b/include/linux/wait.h Sun Aug 31 16:14:00 2003
40448@@ -220,22 +220,6 @@
40449 __remove_wait_queue(q, wait);
40450 }
40451
40452-#define add_wait_queue_cond(q, wait, cond) \
40453- ({ \
40454- unsigned long flags; \
40455- int _raced = 0; \
40456- spin_lock_irqsave(&(q)->lock, flags); \
40457- (wait)->flags = 0; \
40458- __add_wait_queue((q), (wait)); \
40459- rmb(); \
40460- if (!(cond)) { \
40461- _raced = 1; \
40462- __remove_wait_queue((q), (wait)); \
40463- } \
40464- spin_lock_irqrestore(&(q)->lock, flags); \
40465- _raced; \
40466- })
40467-
40468 /*
40469 * These are the old interfaces to sleep waiting for an event.
40470 * They are racy. DO NOT use them, use the wait_event* interfaces above.
40471diff -Nru a/init/main.c b/init/main.c
40472--- a/init/main.c Fri May 2 11:15:48 2003
40473+++ b/init/main.c Sun Aug 31 16:14:48 2003
40474@@ -89,10 +89,6 @@
40475 extern void tc_init(void);
40476 #endif
40477
40478-#if defined(CONFIG_SYSVIPC)
40479-extern void ipc_init(void);
40480-#endif
40481-
40482 /*
40483 * Are we up and running (ie do we have all the infrastructure
40484 * set up)
40485@@ -106,6 +102,8 @@
40486 #define MAX_INIT_ENVS 8
40487
40488 extern void time_init(void);
40489+/* Default late time init is NULL. archs can override this later. */
40490+void (*late_time_init)(void) = NULL;
40491 extern void softirq_init(void);
40492
40493 int rows, cols;
40494@@ -421,7 +419,6 @@
40495 console_init();
40496 profile_init();
40497 local_irq_enable();
40498- calibrate_delay();
40499 #ifdef CONFIG_BLK_DEV_INITRD
40500 if (initrd_start && !initrd_below_start_ok &&
40501 initrd_start < min_low_pfn << PAGE_SHIFT) {
40502@@ -433,6 +430,9 @@
40503 page_address_init();
40504 mem_init();
40505 kmem_cache_init();
40506+ if (late_time_init)
40507+ late_time_init();
40508+ calibrate_delay();
40509 pidmap_init();
40510 pgtable_cache_init();
40511 pte_chain_init();
40512@@ -448,9 +448,6 @@
40513 populate_rootfs();
40514 #ifdef CONFIG_PROC_FS
40515 proc_root_init();
40516-#endif
40517-#if defined(CONFIG_SYSVIPC)
40518- ipc_init();
40519 #endif
40520 check_bugs();
40521 printk("POSIX conformance testing by UNIFIX\n");
40522diff -Nru a/ipc/msg.c b/ipc/msg.c
40523--- a/ipc/msg.c Mon May 12 21:23:19 2003
40524+++ b/ipc/msg.c Thu Aug 28 10:07:51 2003
40525@@ -707,7 +707,7 @@
40526 goto retry;
40527 }
40528
40529- msq->q_lspid = current->pid;
40530+ msq->q_lspid = current->tgid;
40531 msq->q_stime = get_seconds();
40532
40533 if(!pipelined_send(msq,msg)) {
40534@@ -801,7 +801,7 @@
40535 list_del(&msg->m_list);
40536 msq->q_qnum--;
40537 msq->q_rtime = get_seconds();
40538- msq->q_lrpid = current->pid;
40539+ msq->q_lrpid = current->tgid;
40540 msq->q_cbytes -= msg->m_ts;
40541 atomic_sub(msg->m_ts,&msg_bytes);
40542 atomic_dec(&msg_hdrs);
40543diff -Nru a/ipc/sem.c b/ipc/sem.c
40544--- a/ipc/sem.c Sun Jul 13 08:55:51 2003
40545+++ b/ipc/sem.c Thu Aug 28 10:08:09 2003
40546@@ -664,7 +664,7 @@
40547 for (un = sma->undo; un; un = un->id_next)
40548 un->semadj[semnum] = 0;
40549 curr->semval = val;
40550- curr->sempid = current->pid;
40551+ curr->sempid = current->tgid;
40552 sma->sem_ctime = get_seconds();
40553 /* maybe some queued-up processes were waiting for this */
40554 update_queue(sma);
40555@@ -1052,7 +1052,7 @@
40556 if (error)
40557 goto out_unlock_free;
40558
40559- error = try_atomic_semop (sma, sops, nsops, un, current->pid);
40560+ error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
40561 if (error <= 0)
40562 goto update;
40563
40564@@ -1064,7 +1064,7 @@
40565 queue.sops = sops;
40566 queue.nsops = nsops;
40567 queue.undo = un;
40568- queue.pid = current->pid;
40569+ queue.pid = current->tgid;
40570 queue.id = semid;
40571 if (alter)
40572 append_to_queue(sma ,&queue);
40573@@ -1206,7 +1206,7 @@
40574 sem->semval += u->semadj[i];
40575 if (sem->semval < 0)
40576 sem->semval = 0; /* shouldn't happen */
40577- sem->sempid = current->pid;
40578+ sem->sempid = current->tgid;
40579 }
40580 }
40581 sma->sem_otime = get_seconds();
40582diff -Nru a/ipc/shm.c b/ipc/shm.c
40583--- a/ipc/shm.c Thu Jul 10 22:22:59 2003
40584+++ b/ipc/shm.c Thu Aug 28 10:08:22 2003
40585@@ -89,7 +89,7 @@
40586 if(!(shp = shm_lock(id)))
40587 BUG();
40588 shp->shm_atim = get_seconds();
40589- shp->shm_lprid = current->pid;
40590+ shp->shm_lprid = current->tgid;
40591 shp->shm_nattch++;
40592 shm_unlock(shp);
40593 }
40594@@ -136,7 +136,7 @@
40595 /* remove from the list of attaches of the shm segment */
40596 if(!(shp = shm_lock(id)))
40597 BUG();
40598- shp->shm_lprid = current->pid;
40599+ shp->shm_lprid = current->tgid;
40600 shp->shm_dtim = get_seconds();
40601 shp->shm_nattch--;
40602 if(shp->shm_nattch == 0 &&
40603@@ -209,7 +209,7 @@
40604 if(id == -1)
40605 goto no_id;
40606
40607- shp->shm_cprid = current->pid;
40608+ shp->shm_cprid = current->tgid;
40609 shp->shm_lprid = 0;
40610 shp->shm_atim = shp->shm_dtim = 0;
40611 shp->shm_ctim = get_seconds();
40612diff -Nru a/ipc/util.c b/ipc/util.c
40613--- a/ipc/util.c Tue Jul 1 06:04:38 2003
40614+++ b/ipc/util.c Sun Aug 31 16:14:46 2003
40615@@ -36,13 +36,14 @@
40616 * memory are initialised
40617 */
40618
40619-void __init ipc_init (void)
40620+static int __init ipc_init(void)
40621 {
40622 sem_init();
40623 msg_init();
40624 shm_init();
40625- return;
40626+ return 0;
40627 }
40628+__initcall(ipc_init);
40629
40630 /**
40631 * ipc_init_ids - initialise IPC identifiers
40632diff -Nru a/kernel/Makefile b/kernel/Makefile
40633--- a/kernel/Makefile Wed Aug 6 13:59:24 2003
40634+++ b/kernel/Makefile Sun Aug 31 16:13:58 2003
40635@@ -20,9 +20,6 @@
40636 obj-$(CONFIG_COMPAT) += compat.o
40637 obj-$(CONFIG_IKCONFIG) += configs.o
40638
40639-# files to be removed upon make clean
40640-clean-files := ikconfig.h
40641-
40642 ifneq ($(CONFIG_IA64),y)
40643 # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
40644 # needed for x86 only. Why this used to be enabled for all architectures is beyond
40645@@ -32,8 +29,12 @@
40646 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
40647 endif
40648
40649-$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile
40650- $(CONFIG_SHELL) scripts/mkconfigs .config Makefile > $(obj)/ikconfig.h
40651+quiet_cmd_ikconfig = IKCFG $@
40652+ cmd_ikconfig = $(CONFIG_SHELL) $< .config $(srctree)/Makefile > $@
40653+
40654+targets += ikconfig.h
40655+
40656+$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile FORCE
40657+ $(call if_changed,ikconfig)
40658
40659-$(obj)/configs.o: $(obj)/ikconfig.h $(obj)/configs.c \
40660- include/linux/version.h include/linux/compile.h
40661+$(obj)/configs.o: $(obj)/ikconfig.h
40662diff -Nru a/kernel/exit.c b/kernel/exit.c
40663--- a/kernel/exit.c Tue Aug 5 23:04:02 2003
40664+++ b/kernel/exit.c Sun Aug 31 16:14:26 2003
40665@@ -80,6 +80,8 @@
40666 p->parent->cmin_flt += p->min_flt + p->cmin_flt;
40667 p->parent->cmaj_flt += p->maj_flt + p->cmaj_flt;
40668 p->parent->cnswap += p->nswap + p->cnswap;
40669+ p->parent->cnvcsw += p->nvcsw + p->cnvcsw;
40670+ p->parent->cnivcsw += p->nivcsw + p->cnivcsw;
40671 sched_exit(p);
40672 write_unlock_irq(&tasklist_lock);
40673 spin_unlock(&p->proc_lock);
40674diff -Nru a/kernel/fork.c b/kernel/fork.c
40675--- a/kernel/fork.c Wed Aug 20 22:32:07 2003
40676+++ b/kernel/fork.c Sun Aug 31 16:14:26 2003
40677@@ -461,6 +461,7 @@
40678 tsk->min_flt = tsk->maj_flt = 0;
40679 tsk->cmin_flt = tsk->cmaj_flt = 0;
40680 tsk->nswap = tsk->cnswap = 0;
40681+ tsk->nvcsw = tsk->nivcsw = tsk->cnvcsw = tsk->cnivcsw = 0;
40682
40683 tsk->mm = NULL;
40684 tsk->active_mm = NULL;
40685diff -Nru a/kernel/futex.c b/kernel/futex.c
40686--- a/kernel/futex.c Sun May 25 20:39:28 2003
40687+++ b/kernel/futex.c Sun Aug 31 16:14:42 2003
40688@@ -28,6 +28,7 @@
40689 */
40690 #include <linux/slab.h>
40691 #include <linux/poll.h>
40692+#include <linux/fs.h>
40693 #include <linux/file.h>
40694 #include <linux/hash.h>
40695 #include <linux/init.h>
40696@@ -60,8 +61,6 @@
40697 /* The key for the hash is the address + index + offset within page */
40698 static struct list_head futex_queues[1<<FUTEX_HASHBITS];
40699 static spinlock_t futex_lock = SPIN_LOCK_UNLOCKED;
40700-
40701-extern void send_sigio(struct fown_struct *fown, int fd, int band);
40702
40703 /* Futex-fs vfsmount entry: */
40704 static struct vfsmount *futex_mnt;
40705diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c
40706--- a/kernel/kallsyms.c Tue Aug 19 04:58:04 2003
40707+++ b/kernel/kallsyms.c Sun Aug 31 16:14:13 2003
40708@@ -189,9 +189,11 @@
40709 if (pos < iter->pos)
40710 reset_iter(iter);
40711
40712- /* We need to iterate through the previous symbols. */
40713- for (; iter->pos <= pos; iter->pos++)
40714+ /* We need to iterate through the previous symbols: can be slow */
40715+ for (; iter->pos != pos; iter->pos++) {
40716 get_ksymbol_core(iter);
40717+ cond_resched();
40718+ }
40719 return 1;
40720 }
40721
40722@@ -280,8 +282,7 @@
40723 {
40724 struct proc_dir_entry *entry;
40725
40726- /* root-only: could chew up lots of cpu by read, seek back, read... */
40727- entry = create_proc_entry("kallsyms", 0400, NULL);
40728+ entry = create_proc_entry("kallsyms", 0444, NULL);
40729 if (entry)
40730 entry->proc_fops = &kallsyms_operations;
40731 return 0;
40732diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
40733--- a/kernel/ksyms.c Tue Aug 19 09:33:08 2003
40734+++ b/kernel/ksyms.c Thu Aug 28 00:36:28 2003
40735@@ -120,7 +120,6 @@
40736 EXPORT_SYMBOL(max_mapnr);
40737 #endif
40738 EXPORT_SYMBOL(high_memory);
40739-EXPORT_SYMBOL_GPL(invalidate_mmap_range);
40740 EXPORT_SYMBOL(vmtruncate);
40741 EXPORT_SYMBOL(find_vma);
40742 EXPORT_SYMBOL(get_unmapped_area);
40743@@ -198,7 +197,6 @@
40744 EXPORT_SYMBOL(invalidate_inode_pages);
40745 EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
40746 EXPORT_SYMBOL(truncate_inode_pages);
40747-EXPORT_SYMBOL(install_page);
40748 EXPORT_SYMBOL(fsync_bdev);
40749 EXPORT_SYMBOL(permission);
40750 EXPORT_SYMBOL(vfs_permission);
40751diff -Nru a/kernel/sched.c b/kernel/sched.c
40752--- a/kernel/sched.c Mon Aug 18 19:46:23 2003
40753+++ b/kernel/sched.c Sun Aug 31 16:14:26 2003
40754@@ -1325,8 +1325,10 @@
40755 }
40756 default:
40757 deactivate_task(prev, rq);
40758+ prev->nvcsw++;
40759+ break;
40760 case TASK_RUNNING:
40761- ;
40762+ prev->nivcsw++;
40763 }
40764 pick_next_task:
40765 if (unlikely(!rq->nr_running)) {
40766diff -Nru a/kernel/sys.c b/kernel/sys.c
40767--- a/kernel/sys.c Tue Aug 19 21:53:11 2003
40768+++ b/kernel/sys.c Sun Aug 31 16:14:26 2003
40769@@ -1309,6 +1309,8 @@
40770 case RUSAGE_SELF:
40771 jiffies_to_timeval(p->utime, &r.ru_utime);
40772 jiffies_to_timeval(p->stime, &r.ru_stime);
40773+ r.ru_nvcsw = p->nvcsw;
40774+ r.ru_nivcsw = p->nivcsw;
40775 r.ru_minflt = p->min_flt;
40776 r.ru_majflt = p->maj_flt;
40777 r.ru_nswap = p->nswap;
40778@@ -1316,6 +1318,8 @@
40779 case RUSAGE_CHILDREN:
40780 jiffies_to_timeval(p->cutime, &r.ru_utime);
40781 jiffies_to_timeval(p->cstime, &r.ru_stime);
40782+ r.ru_nvcsw = p->cnvcsw;
40783+ r.ru_nivcsw = p->cnivcsw;
40784 r.ru_minflt = p->cmin_flt;
40785 r.ru_majflt = p->cmaj_flt;
40786 r.ru_nswap = p->cnswap;
40787@@ -1323,6 +1327,8 @@
40788 default:
40789 jiffies_to_timeval(p->utime + p->cutime, &r.ru_utime);
40790 jiffies_to_timeval(p->stime + p->cstime, &r.ru_stime);
40791+ r.ru_nvcsw = p->nvcsw + p->cnvcsw;
40792+ r.ru_nivcsw = p->nivcsw + p->cnivcsw;
40793 r.ru_minflt = p->min_flt + p->cmin_flt;
40794 r.ru_majflt = p->maj_flt + p->cmaj_flt;
40795 r.ru_nswap = p->nswap + p->cnswap;
40796diff -Nru a/mm/fremap.c b/mm/fremap.c
40797--- a/mm/fremap.c Sun May 25 14:08:24 2003
40798+++ b/mm/fremap.c Thu Aug 28 00:38:39 2003
40799@@ -3,7 +3,7 @@
40800 *
40801 * Explicit pagetable population and nonlinear (random) mappings support.
40802 *
40803- * started by Ingo Molnar, Copyright (C) 2002
40804+ * started by Ingo Molnar, Copyright (C) 2002, 2003
40805 */
40806
40807 #include <linux/mm.h>
40808@@ -13,6 +13,8 @@
40809 #include <linux/pagemap.h>
40810 #include <linux/swapops.h>
40811 #include <linux/rmap-locking.h>
40812+#include <linux/module.h>
40813+
40814 #include <asm/mmu_context.h>
40815 #include <asm/cacheflush.h>
40816 #include <asm/tlbflush.h>
40817@@ -95,6 +97,8 @@
40818 err:
40819 return err;
40820 }
40821+EXPORT_SYMBOL(install_page);
40822+
40823
40824 /***
40825 * sys_remap_file_pages - remap arbitrary pages of a shared backing store
40826diff -Nru a/mm/memory.c b/mm/memory.c
40827--- a/mm/memory.c Thu Aug 14 18:17:40 2003
40828+++ b/mm/memory.c Sun Aug 31 16:14:24 2003
40829@@ -45,6 +45,7 @@
40830 #include <linux/pagemap.h>
40831 #include <linux/vcache.h>
40832 #include <linux/rmap-locking.h>
40833+#include <linux/module.h>
40834
40835 #include <asm/pgalloc.h>
40836 #include <asm/rmap.h>
40837@@ -810,17 +811,18 @@
40838 static inline int zeromap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address,
40839 unsigned long size, pgprot_t prot)
40840 {
40841- unsigned long end;
40842+ unsigned long base, end;
40843
40844+ base = address & PGDIR_MASK;
40845 address &= ~PGDIR_MASK;
40846 end = address + size;
40847 if (end > PGDIR_SIZE)
40848 end = PGDIR_SIZE;
40849 do {
40850- pte_t * pte = pte_alloc_map(mm, pmd, address);
40851+ pte_t * pte = pte_alloc_map(mm, pmd, base + address);
40852 if (!pte)
40853 return -ENOMEM;
40854- zeromap_pte_range(pte, address, end - address, prot);
40855+ zeromap_pte_range(pte, base + address, end - address, prot);
40856 pte_unmap(pte);
40857 address = (address + PMD_SIZE) & PMD_MASK;
40858 pmd++;
40859@@ -1138,6 +1140,7 @@
40860 invalidate_mmap_range_list(&mapping->i_mmap_shared, hba, hlen);
40861 up(&mapping->i_shared_sem);
40862 }
40863+EXPORT_SYMBOL_GPL(invalidate_mmap_range);
40864
40865 /*
40866 * Handle all mappings that got truncated by a "truncate()"
40867@@ -1384,10 +1387,10 @@
40868 unsigned long address, int write_access, pte_t *page_table, pmd_t *pmd)
40869 {
40870 struct page * new_page;
40871- struct address_space *mapping;
40872+ struct address_space *mapping = NULL;
40873 pte_t entry;
40874 struct pte_chain *pte_chain;
40875- int sequence;
40876+ int sequence = 0;
40877 int ret;
40878
40879 if (!vma->vm_ops || !vma->vm_ops->nopage)
40880@@ -1396,8 +1399,10 @@
40881 pte_unmap(page_table);
40882 spin_unlock(&mm->page_table_lock);
40883
40884- mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
40885- sequence = atomic_read(&mapping->truncate_count);
40886+ if (vma->vm_file) {
40887+ mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
40888+ sequence = atomic_read(&mapping->truncate_count);
40889+ }
40890 smp_rmb(); /* Prevent CPU from reordering lock-free ->nopage() */
40891 retry:
40892 new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0);
40893@@ -1433,7 +1438,8 @@
40894 * invalidated this page. If invalidate_mmap_range got called,
40895 * retry getting the page.
40896 */
40897- if (unlikely(sequence != atomic_read(&mapping->truncate_count))) {
40898+ if (mapping &&
40899+ (unlikely(sequence != atomic_read(&mapping->truncate_count)))) {
40900 sequence = atomic_read(&mapping->truncate_count);
40901 spin_unlock(&mm->page_table_lock);
40902 page_cache_release(new_page);
40903@@ -1453,7 +1459,8 @@
40904 */
40905 /* Only go through if we didn't race with anybody else... */
40906 if (pte_none(*page_table)) {
40907- ++mm->rss;
40908+ if (!PageReserved(new_page))
40909+ ++mm->rss;
40910 flush_icache_page(vma, new_page);
40911 entry = mk_pte(new_page, vma->vm_page_prot);
40912 if (write_access)
40913diff -Nru a/mm/swapfile.c b/mm/swapfile.c
40914--- a/mm/swapfile.c Thu Jul 31 16:52:11 2003
40915+++ b/mm/swapfile.c Sun Aug 31 16:15:45 2003
40916@@ -1403,7 +1403,8 @@
40917 p->max = maxpages;
40918 p->pages = nr_good_pages;
40919
40920- if (setup_swap_extents(p))
40921+ error = setup_swap_extents(p);
40922+ if (error)
40923 goto bad_swap;
40924
40925 swap_list_lock();
40926diff -Nru a/mm/vmscan.c b/mm/vmscan.c
40927--- a/mm/vmscan.c Thu Aug 21 11:57:48 2003
40928+++ b/mm/vmscan.c Sun Aug 31 16:14:47 2003
40929@@ -80,25 +80,6 @@
40930 #endif
40931
40932 /*
40933- * exponentially decaying average
40934- */
40935-static inline int expavg(int avg, int val)
40936-{
40937- return ((val - avg) >> 1) + avg;
40938-}
40939-
40940-static void zone_adj_pressure(struct zone *zone, int priority)
40941-{
40942- zone->pressure = expavg(zone->pressure,
40943- (DEF_PRIORITY - priority) << 10);
40944-}
40945-
40946-static int pressure_to_priority(int pressure)
40947-{
40948- return DEF_PRIORITY - (pressure >> 10);
40949-}
40950-
40951-/*
40952 * The list of shrinker callbacks used by to apply pressure to
40953 * ageable caches.
40954 */
40955@@ -646,7 +627,7 @@
40956 * `distress' is a measure of how much trouble we're having reclaiming
40957 * pages. 0 -> no problems. 100 -> great trouble.
40958 */
40959- distress = 100 >> pressure_to_priority(zone->pressure);
40960+ distress = 100 >> zone->prev_priority;
40961
40962 /*
40963 * The point of this algorithm is to decide when to start reclaiming
40964@@ -830,6 +811,9 @@
40965 int nr_mapped = 0;
40966 int max_scan;
40967
40968+ if (zone->free_pages < zone->pages_high)
40969+ zone->temp_priority = priority;
40970+
40971 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
40972 continue; /* Let kswapd poll it */
40973
40974@@ -843,10 +827,8 @@
40975 ret += shrink_zone(zone, max_scan, gfp_mask,
40976 to_reclaim, &nr_mapped, ps, priority);
40977 *total_scanned += max_scan + nr_mapped;
40978- if (ret >= nr_pages) {
40979- zone_adj_pressure(zone, priority);
40980+ if (ret >= nr_pages)
40981 break;
40982- }
40983 }
40984 return ret;
40985 }
40986@@ -880,6 +862,9 @@
40987
40988 inc_page_state(allocstall);
40989
40990+ for (zone = cz; zone >= cz->zone_pgdat->node_zones; --zone)
40991+ zone->temp_priority = DEF_PRIORITY;
40992+
40993 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
40994 int total_scanned = 0;
40995 struct page_state ps;
40996@@ -912,9 +897,9 @@
40997 }
40998 if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
40999 out_of_memory();
41000- for (zone = cz; zone >= cz->zone_pgdat->node_zones; -- zone)
41001- zone_adj_pressure(zone, -1);
41002 out:
41003+ for (zone = cz; zone >= cz->zone_pgdat->node_zones; --zone)
41004+ zone->prev_priority = zone->temp_priority;
41005 return ret;
41006 }
41007
41008@@ -945,6 +930,12 @@
41009
41010 inc_page_state(pageoutrun);
41011
41012+ for (i = 0; i < pgdat->nr_zones; i++) {
41013+ struct zone *zone = pgdat->node_zones + i;
41014+
41015+ zone->temp_priority = DEF_PRIORITY;
41016+ }
41017+
41018 for (priority = DEF_PRIORITY; priority; priority--) {
41019 int all_zones_ok = 1;
41020
41021@@ -961,11 +952,10 @@
41022 to_reclaim = min(to_free, SWAP_CLUSTER_MAX*8);
41023 } else { /* Zone balancing */
41024 to_reclaim = zone->pages_high-zone->free_pages;
41025- if (to_reclaim <= 0) {
41026- zone_adj_pressure(zone, priority);
41027+ if (to_reclaim <= 0)
41028 continue;
41029- }
41030 }
41031+ zone->temp_priority = priority;
41032 all_zones_ok = 0;
41033 max_scan = zone->nr_inactive >> priority;
41034 if (max_scan < to_reclaim * 2)
41035@@ -989,13 +979,11 @@
41036 if (to_free > 0)
41037 blk_congestion_wait(WRITE, HZ/10);
41038 }
41039- if (priority < 0) {
41040- for (i = 0; i < pgdat->nr_zones; i++) {
41041- struct zone *zone = pgdat->node_zones + i;
41042
41043- if (zone->free_pages < zone->pages_high)
41044- zone_adj_pressure(zone, -1);
41045- }
41046+ for (i = 0; i < pgdat->nr_zones; i++) {
41047+ struct zone *zone = pgdat->node_zones + i;
41048+
41049+ zone->prev_priority = zone->temp_priority;
41050 }
41051 return nr_pages - to_free;
41052 }
41053diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
41054--- a/net/bluetooth/l2cap.c Mon Jun 16 08:11:36 2003
41055+++ b/net/bluetooth/l2cap.c Sun Aug 31 16:14:24 2003
41056@@ -200,7 +200,7 @@
41057 */
41058 static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
41059 {
41060- struct sock *sk, *sk1 = NULL;
41061+ struct sock *sk = NULL, *sk1 = NULL;
41062 struct hlist_node *node;
41063
41064 sk_for_each(sk, node, &l2cap_sk_list.head) {
41065diff -Nru a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
41066--- a/net/bluetooth/rfcomm/sock.c Fri Jul 4 23:52:58 2003
41067+++ b/net/bluetooth/rfcomm/sock.c Sun Aug 31 16:14:24 2003
41068@@ -114,7 +114,7 @@
41069 /* ---- Socket functions ---- */
41070 static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
41071 {
41072- struct sock *sk;
41073+ struct sock *sk = NULL;
41074 struct hlist_node *node;
41075
41076 sk_for_each(sk, node, &rfcomm_sk_list.head) {
41077@@ -131,7 +131,7 @@
41078 */
41079 static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
41080 {
41081- struct sock *sk, *sk1 = NULL;
41082+ struct sock *sk = NULL, *sk1 = NULL;
41083 struct hlist_node *node;
41084
41085 sk_for_each(sk, node, &rfcomm_sk_list.head) {
41086diff -Nru a/net/core/ethtool.c b/net/core/ethtool.c
41087--- a/net/core/ethtool.c Thu Aug 7 13:16:02 2003
41088+++ b/net/core/ethtool.c Wed Aug 27 14:55:06 2003
41089@@ -502,15 +502,15 @@
41090
41091 switch (gstrings.string_set) {
41092 case ETH_SS_TEST:
41093- if (ops->self_test_count)
41094- gstrings.len = ops->self_test_count(dev);
41095- else
41096+ if (!ops->self_test_count)
41097 return -EOPNOTSUPP;
41098+ gstrings.len = ops->self_test_count(dev);
41099+ break;
41100 case ETH_SS_STATS:
41101- if (ops->get_stats_count)
41102- gstrings.len = ops->get_stats_count(dev);
41103- else
41104+ if (!ops->get_stats_count)
41105 return -EOPNOTSUPP;
41106+ gstrings.len = ops->get_stats_count(dev);
41107+ break;
41108 default:
41109 return -EINVAL;
41110 }
41111diff -Nru a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
41112--- a/net/netlink/netlink_dev.c Sun May 25 19:34:11 2003
41113+++ b/net/netlink/netlink_dev.c Tue Aug 26 09:25:41 2003
41114@@ -41,7 +41,7 @@
41115
41116 static unsigned int netlink_poll(struct file *file, poll_table * wait)
41117 {
41118- struct socket *sock = netlink_user[minor(file->f_dentry->d_inode->i_rdev)];
41119+ struct socket *sock = netlink_user[iminor(file->f_dentry->d_inode)];
41120
41121 if (sock->ops->poll==NULL)
41122 return 0;
41123@@ -56,7 +56,7 @@
41124 size_t count, loff_t *pos)
41125 {
41126 struct inode *inode = file->f_dentry->d_inode;
41127- struct socket *sock = netlink_user[minor(inode->i_rdev)];
41128+ struct socket *sock = netlink_user[iminor(inode)];
41129 struct msghdr msg;
41130 struct iovec iov;
41131
41132@@ -80,7 +80,7 @@
41133 size_t count, loff_t *pos)
41134 {
41135 struct inode *inode = file->f_dentry->d_inode;
41136- struct socket *sock = netlink_user[minor(inode->i_rdev)];
41137+ struct socket *sock = netlink_user[iminor(inode)];
41138 struct msghdr msg;
41139 struct iovec iov;
41140
41141@@ -100,7 +100,7 @@
41142
41143 static int netlink_open(struct inode * inode, struct file * file)
41144 {
41145- unsigned int minor = minor(inode->i_rdev);
41146+ unsigned int minor = iminor(inode);
41147 struct socket *sock;
41148 struct sockaddr_nl nladdr;
41149 int err;
41150@@ -132,7 +132,7 @@
41151
41152 static int netlink_release(struct inode * inode, struct file * file)
41153 {
41154- unsigned int minor = minor(inode->i_rdev);
41155+ unsigned int minor = iminor(inode);
41156 struct socket *sock;
41157
41158 sock = netlink_user[minor];
41159@@ -146,7 +146,7 @@
41160 static int netlink_ioctl(struct inode *inode, struct file *file,
41161 unsigned int cmd, unsigned long arg)
41162 {
41163- unsigned int minor = minor(inode->i_rdev);
41164+ unsigned int minor = iminor(inode);
41165 int retval = 0;
41166
41167 if (minor >= MAX_LINKS)
41168diff -Nru a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
41169--- a/scripts/kconfig/Makefile Tue Aug 19 09:27:03 2003
41170+++ b/scripts/kconfig/Makefile Sun Aug 31 16:13:49 2003
41171@@ -2,40 +2,43 @@
41172 # Kernel configuration targets
41173 # These targets are used from top-level makefile
41174
41175-.PHONY: oldconfig xconfig gconfig menuconfig config
41176+.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig
41177
41178-xconfig: scripts/kconfig/qconf
41179- ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
41180+xconfig: $(obj)/qconf
41181+ $< arch/$(ARCH)/Kconfig
41182
41183-gconfig: scripts/kconfig/gconf
41184- ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig
41185+gconfig: $(obj)/gconf
41186+ ./$< arch/$(ARCH)/Kconfig
41187
41188-menuconfig: scripts/kconfig/mconf
41189+menuconfig: $(obj)/mconf
41190 $(Q)$(MAKE) $(build)=scripts/lxdialog
41191- ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
41192+ $< arch/$(ARCH)/Kconfig
41193
41194-config: scripts/kconfig/conf
41195- ./scripts/kconfig/conf arch/$(ARCH)/Kconfig
41196+config: $(obj)/conf
41197+ $< arch/$(ARCH)/Kconfig
41198
41199-oldconfig: scripts/kconfig/conf
41200- ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig
41201+oldconfig: $(obj)/conf
41202+ $< -o arch/$(ARCH)/Kconfig
41203+
41204+silentoldconfig: $(obj)/conf
41205+ $< -s arch/$(ARCH)/Kconfig
41206
41207 .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
41208
41209-randconfig: scripts/kconfig/conf
41210- ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig
41211+randconfig: $(obj)/conf
41212+ $< -r arch/$(ARCH)/Kconfig
41213
41214-allyesconfig: scripts/kconfig/conf
41215- ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig
41216+allyesconfig: $(obj)/conf
41217+ $< -y arch/$(ARCH)/Kconfig
41218
41219-allnoconfig: scripts/kconfig/conf
41220- ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig
41221+allnoconfig: $(obj)/conf
41222+ $< -n arch/$(ARCH)/Kconfig
41223
41224-allmodconfig: scripts/kconfig/conf
41225- ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig
41226+allmodconfig: $(obj)/conf
41227+ $< -m arch/$(ARCH)/Kconfig
41228
41229-defconfig: scripts/kconfig/conf
41230- ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig
41231+defconfig: $(obj)/conf
41232+ $< -d arch/$(ARCH)/Kconfig
41233
41234 # Help text used by make help
41235 help:
41236diff -Nru a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
41237--- a/scripts/kconfig/symbol.c Fri Jun 6 01:28:22 2003
41238+++ b/scripts/kconfig/symbol.c Sun Aug 31 16:14:08 2003
41239@@ -12,21 +12,21 @@
41240 #include "lkc.h"
41241
41242 struct symbol symbol_yes = {
41243- name: "y",
41244- curr: { "y", yes },
41245- flags: SYMBOL_YES|SYMBOL_VALID,
41246+ .name = "y",
41247+ .curr = { "y", yes },
41248+ .flags = SYMBOL_YES|SYMBOL_VALID,
41249 }, symbol_mod = {
41250- name: "m",
41251- curr: { "m", mod },
41252- flags: SYMBOL_MOD|SYMBOL_VALID,
41253+ .name = "m",
41254+ .curr = { "m", mod },
41255+ .flags = SYMBOL_MOD|SYMBOL_VALID,
41256 }, symbol_no = {
41257- name: "n",
41258- curr: { "n", no },
41259- flags: SYMBOL_NO|SYMBOL_VALID,
41260+ .name = "n",
41261+ .curr = { "n", no },
41262+ .flags = SYMBOL_NO|SYMBOL_VALID,
41263 }, symbol_empty = {
41264- name: "",
41265- curr: { "", no },
41266- flags: SYMBOL_VALID,
41267+ .name = "",
41268+ .curr = { "", no },
41269+ .flags = SYMBOL_VALID,
41270 };
41271
41272 int sym_change_count;
41273diff -Nru a/security/capability.c b/security/capability.c
41274--- a/security/capability.c Wed Jul 2 21:22:38 2003
41275+++ b/security/capability.c Sun Aug 31 16:14:14 2003
41276@@ -295,12 +295,7 @@
41277
41278 vm_acct_memory(pages);
41279
41280- /*
41281- * Sometimes we want to use more memory than we have
41282- */
41283- if (sysctl_overcommit_memory == 1)
41284- return 0;
41285-
41286+ /* We estimate memory ourselves (common case) */
41287 if (sysctl_overcommit_memory == 0) {
41288 free = get_page_cache_size();
41289 free += nr_free_pages();
41290@@ -322,10 +317,16 @@
41291
41292 if (free > pages)
41293 return 0;
41294+
41295 vm_unacct_memory(pages);
41296 return -ENOMEM;
41297 }
41298
41299+ /* Kernel assumes allocation */
41300+ if (sysctl_overcommit_memory == 1)
41301+ return 0;
41302+
41303+ /* sysctl_overcommit_memory must be 2 which means strict_overcommit*/
41304 allowed = totalram_pages * sysctl_overcommit_ratio / 100;
41305 allowed += total_swap_pages;
41306
41307diff -Nru a/security/selinux/hooks.c b/security/selinux/hooks.c
41308--- a/security/selinux/hooks.c Mon Aug 18 22:27:19 2003
41309+++ b/security/selinux/hooks.c Sun Aug 31 16:14:20 2003
41310@@ -1332,31 +1332,19 @@
41311
41312 static int selinux_bprm_alloc_security(struct linux_binprm *bprm)
41313 {
41314- int rc;
41315+ struct bprm_security_struct *bsec;
41316
41317- /* Make sure that the secondary module doesn't use the
41318- bprm->security field, since we do not yet support chaining
41319- of multiple security structures on the field. Neither
41320- the dummy nor the capability module use the field. The owlsm
41321- module uses the field if CONFIG_OWLSM_FD is enabled. */
41322- rc = secondary_ops->bprm_alloc_security(bprm);
41323- if (rc)
41324- return rc;
41325- if (bprm->security) {
41326- printk(KERN_WARNING "%s: no support yet for chaining on the "
41327- "security field by secondary modules.\n", __FUNCTION__);
41328- /* Release the secondary module's security object. */
41329- secondary_ops->bprm_free_security(bprm);
41330- /* Unregister the secondary module to prevent problems
41331- with subsequent binprm hooks. This will revert to the
41332- original (dummy) module for the secondary operations. */
41333- rc = security_ops->unregister_security("unknown", secondary_ops);
41334- if (rc)
41335- return rc;
41336- printk(KERN_WARNING "%s: Unregistered the secondary security "
41337- "module.\n", __FUNCTION__);
41338- }
41339- bprm->security = NULL;
41340+ bsec = kmalloc(sizeof(struct bprm_security_struct), GFP_KERNEL);
41341+ if (!bsec)
41342+ return -ENOMEM;
41343+
41344+ memset(bsec, 0, sizeof *bsec);
41345+ bsec->magic = SELINUX_MAGIC;
41346+ bsec->bprm = bprm;
41347+ bsec->sid = SECINITSID_UNLABELED;
41348+ bsec->set = 0;
41349+
41350+ bprm->security = bsec;
41351 return 0;
41352 }
41353
41354@@ -1365,6 +1353,7 @@
41355 struct task_security_struct *tsec;
41356 struct inode *inode = bprm->file->f_dentry->d_inode;
41357 struct inode_security_struct *isec;
41358+ struct bprm_security_struct *bsec;
41359 u32 newsid;
41360 struct avc_audit_data ad;
41361 int rc;
41362@@ -1373,15 +1362,16 @@
41363 if (rc)
41364 return rc;
41365
41366- if (bprm->sh_bang || bprm->security)
41367- /* The security field should already be set properly. */
41368+ bsec = bprm->security;
41369+
41370+ if (bsec->set)
41371 return 0;
41372
41373 tsec = current->security;
41374 isec = inode->i_security;
41375
41376 /* Default to the current task SID. */
41377- bprm->security = (void *)tsec->sid;
41378+ bsec->sid = tsec->sid;
41379
41380 /* Reset create SID on execve. */
41381 tsec->create_sid = 0;
41382@@ -1427,9 +1417,10 @@
41383 return rc;
41384
41385 /* Set the security field to the new SID. */
41386- bprm->security = (void*) newsid;
41387+ bsec->sid = newsid;
41388 }
41389
41390+ bsec->set = 1;
41391 return 0;
41392 }
41393
41394@@ -1463,8 +1454,9 @@
41395
41396 static void selinux_bprm_free_security(struct linux_binprm *bprm)
41397 {
41398- /* Nothing to do - not dynamically allocated. */
41399- return;
41400+ struct bprm_security_struct *bsec = bprm->security;
41401+ bprm->security = NULL;
41402+ kfree(bsec);
41403 }
41404
41405 /* Derived from fs/exec.c:flush_old_files. */
41406@@ -1509,6 +1501,7 @@
41407 static void selinux_bprm_compute_creds(struct linux_binprm *bprm)
41408 {
41409 struct task_security_struct *tsec, *psec;
41410+ struct bprm_security_struct *bsec;
41411 u32 sid;
41412 struct av_decision avd;
41413 int rc;
41414@@ -1517,9 +1510,8 @@
41415
41416 tsec = current->security;
41417
41418- sid = (u32)bprm->security;
41419- if (!sid)
41420- sid = tsec->sid;
41421+ bsec = bprm->security;
41422+ sid = bsec->sid;
41423
41424 tsec->osid = tsec->sid;
41425 if (tsec->sid != sid) {
41426@@ -2057,9 +2049,11 @@
41427 case F_GETLK:
41428 case F_SETLK:
41429 case F_SETLKW:
41430+#if BITS_PER_LONG == 32
41431 case F_GETLK64:
41432 case F_SETLK64:
41433 case F_SETLKW64:
41434+#endif
41435 if (!file->f_dentry || !file->f_dentry->d_inode) {
41436 err = -EINVAL;
41437 break;
41438@@ -3112,9 +3106,8 @@
41439 char *name, void *value, size_t size)
41440 {
41441 struct task_security_struct *tsec;
41442- u32 sid;
41443+ u32 sid, len;
41444 char *context;
41445- size_t len;
41446 int error;
41447
41448 if (current != p) {
41449diff -Nru a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
41450--- a/security/selinux/include/objsec.h Thu Aug 14 18:17:44 2003
41451+++ b/security/selinux/include/objsec.h Sun Aug 31 16:14:20 2003
41452@@ -21,6 +21,7 @@
41453 #include <linux/list.h>
41454 #include <linux/sched.h>
41455 #include <linux/fs.h>
41456+#include <linux/binfmts.h>
41457 #include <linux/in.h>
41458 #include "flask.h"
41459 #include "avc.h"
41460@@ -83,6 +84,13 @@
41461 u16 sclass; /* security class of this object */
41462 u32 sid; /* SID of IPC resource */
41463 struct avc_entry_ref avcr; /* reference to permissions */
41464+};
41465+
41466+struct bprm_security_struct {
41467+ unsigned long magic; /* magic number for this module */
41468+ struct linux_binprm *bprm; /* back pointer to bprm object */
41469+ u32 sid; /* SID for transformed process */
41470+ unsigned char set;
41471 };
41472
41473 extern int inode_security_set_sid(struct inode *inode, u32 sid);
41474diff -Nru a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
41475--- a/security/selinux/ss/avtab.c Thu Jul 17 02:38:01 2003
41476+++ b/security/selinux/ss/avtab.c Sun Aug 31 16:14:19 2003
41477@@ -106,7 +106,7 @@
41478 }
41479 h->htable[i] = NULL;
41480 }
41481- kfree(h->htable);
41482+ vfree(h->htable);
41483 }
41484
41485
41486@@ -138,7 +138,7 @@
41487 {
41488 int i;
41489
41490- h->htable = kmalloc(sizeof(*(h->htable)) * AVTAB_SIZE, GFP_KERNEL);
41491+ h->htable = vmalloc(sizeof(*(h->htable)) * AVTAB_SIZE);
41492 if (!h->htable)
41493 return -ENOMEM;
41494 for (i = 0; i < AVTAB_SIZE; i++)
41495diff -Nru a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
41496--- a/security/selinux/ss/ebitmap.c Thu Jul 17 02:38:01 2003
41497+++ b/security/selinux/ss/ebitmap.c Sun Aug 31 16:14:19 2003
41498@@ -250,8 +250,8 @@
41499 count = le32_to_cpu(buf[2]);
41500
41501 if (mapsize != MAPSIZE) {
41502- printk(KERN_ERR "security: ebitmap: map size %d does not "
41503- "match my size %d (high bit was %d)\n", mapsize,
41504+ printk(KERN_ERR "security: ebitmap: map size %u does not "
41505+ "match my size %Zd (high bit was %d)\n", mapsize,
41506 MAPSIZE, e->highbit);
41507 goto out;
41508 }
41509@@ -261,7 +261,7 @@
41510 }
41511 if (e->highbit & (MAPSIZE - 1)) {
41512 printk(KERN_ERR "security: ebitmap: high bit (%d) is not a "
41513- "multiple of the map size (%d)\n", e->highbit, MAPSIZE);
41514+ "multiple of the map size (%Zd)\n", e->highbit, MAPSIZE);
41515 goto bad;
41516 }
41517 l = NULL;
41518@@ -283,13 +283,13 @@
41519
41520 if (n->startbit & (MAPSIZE - 1)) {
41521 printk(KERN_ERR "security: ebitmap start bit (%d) is "
41522- "not a multiple of the map size (%d)\n",
41523+ "not a multiple of the map size (%Zd)\n",
41524 n->startbit, MAPSIZE);
41525 goto bad_free;
41526 }
41527 if (n->startbit > (e->highbit - MAPSIZE)) {
41528 printk(KERN_ERR "security: ebitmap start bit (%d) is "
41529- "beyond the end of the bitmap (%d)\n",
41530+ "beyond the end of the bitmap (%Zd)\n",
41531 n->startbit, (e->highbit - MAPSIZE));
41532 goto bad_free;
41533 }
41534diff -Nru a/security/selinux/ss/global.h b/security/selinux/ss/global.h
41535--- a/security/selinux/ss/global.h Sun Aug 10 04:22:59 2003
41536+++ b/security/selinux/ss/global.h Sun Aug 31 16:14:19 2003
41537@@ -8,6 +8,7 @@
41538 #include <linux/in.h>
41539 #include <linux/spinlock.h>
41540 #include <linux/sched.h>
41541+#include <linux/vmalloc.h>
41542
41543 #include "flask.h"
41544 #include "avc.h"
41545diff -Nru a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
41546--- a/security/selinux/ss/policydb.c Mon Aug 18 22:27:19 2003
41547+++ b/security/selinux/ss/policydb.c Sun Aug 31 16:14:19 2003
41548@@ -1074,7 +1074,7 @@
41549 len = buf[1];
41550 if (len != strlen(POLICYDB_STRING)) {
41551 printk(KERN_ERR "security: policydb string length %d does not "
41552- "match expected length %d\n",
41553+ "match expected length %Zd\n",
41554 len, strlen(POLICYDB_STRING));
41555 goto bad;
41556 }
41557diff -Nru a/sound/core/control.c b/sound/core/control.c
41558--- a/sound/core/control.c Mon Jul 21 02:29:40 2003
41559+++ b/sound/core/control.c Tue Aug 26 09:25:41 2003
41560@@ -42,7 +42,7 @@
41561
41562 static int snd_ctl_open(struct inode *inode, struct file *file)
41563 {
41564- int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
41565+ int cardnum = SNDRV_MINOR_CARD(iminor(inode));
41566 unsigned long flags;
41567 snd_card_t *card;
41568 snd_ctl_file_t *ctl;
41569diff -Nru a/sound/core/hwdep.c b/sound/core/hwdep.c
41570--- a/sound/core/hwdep.c Sun Jun 1 11:47:53 2003
41571+++ b/sound/core/hwdep.c Tue Aug 26 09:25:41 2003
41572@@ -73,7 +73,7 @@
41573
41574 static int snd_hwdep_open(struct inode *inode, struct file * file)
41575 {
41576- int major = major(inode->i_rdev);
41577+ int major = imajor(inode);
41578 int cardnum;
41579 int device;
41580 snd_hwdep_t *hw;
41581@@ -82,12 +82,12 @@
41582
41583 switch (major) {
41584 case CONFIG_SND_MAJOR:
41585- cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
41586- device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev)) - SNDRV_MINOR_HWDEP;
41587+ cardnum = SNDRV_MINOR_CARD(iminor(inode));
41588+ device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP;
41589 break;
41590 #ifdef CONFIG_SND_OSSEMUL
41591 case SOUND_MAJOR:
41592- cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
41593+ cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
41594 device = 0;
41595 break;
41596 #endif
41597diff -Nru a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
41598--- a/sound/core/oss/mixer_oss.c Sun Jun 1 11:47:53 2003
41599+++ b/sound/core/oss/mixer_oss.c Tue Aug 26 09:25:41 2003
41600@@ -36,7 +36,7 @@
41601
41602 static int snd_mixer_oss_open(struct inode *inode, struct file *file)
41603 {
41604- int cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
41605+ int cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
41606 snd_card_t *card;
41607 snd_mixer_oss_file_t *fmixer;
41608 int err;
41609diff -Nru a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
41610--- a/sound/core/oss/pcm_oss.c Fri Aug 15 19:54:09 2003
41611+++ b/sound/core/oss/pcm_oss.c Tue Aug 26 09:25:41 2003
41612@@ -1681,7 +1681,7 @@
41613
41614 static int snd_pcm_oss_open(struct inode *inode, struct file *file)
41615 {
41616- int minor = minor(inode->i_rdev);
41617+ int minor = iminor(inode);
41618 int cardnum = SNDRV_MINOR_OSS_CARD(minor);
41619 int device;
41620 int err;
41621diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
41622--- a/sound/core/pcm_native.c Mon Jul 28 04:35:00 2003
41623+++ b/sound/core/pcm_native.c Tue Aug 26 09:25:41 2003
41624@@ -1431,11 +1431,11 @@
41625 return 0;
41626 inode = file->f_dentry->d_inode;
41627 if (!S_ISCHR(inode->i_mode) ||
41628- major(inode->i_rdev) != snd_major) {
41629+ imajor(inode) != snd_major) {
41630 fput(file);
41631 return 0;
41632 }
41633- minor = minor(inode->i_rdev);
41634+ minor = iminor(inode);
41635 if (minor >= 256 ||
41636 minor % SNDRV_MINOR_DEVICES < SNDRV_MINOR_PCM_PLAYBACK) {
41637 fput(file);
41638@@ -1940,8 +1940,8 @@
41639
41640 int snd_pcm_open(struct inode *inode, struct file *file)
41641 {
41642- int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
41643- int device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev));
41644+ int cardnum = SNDRV_MINOR_CARD(iminor(inode));
41645+ int device = SNDRV_MINOR_DEVICE(iminor(inode));
41646 int err;
41647 snd_pcm_t *pcm;
41648 snd_pcm_file_t *pcm_file;
41649diff -Nru a/sound/core/rawmidi.c b/sound/core/rawmidi.c
41650--- a/sound/core/rawmidi.c Mon Jul 28 04:35:00 2003
41651+++ b/sound/core/rawmidi.c Tue Aug 26 09:25:41 2003
41652@@ -345,7 +345,7 @@
41653
41654 static int snd_rawmidi_open(struct inode *inode, struct file *file)
41655 {
41656- int maj = major(inode->i_rdev);
41657+ int maj = imajor(inode);
41658 int cardnum;
41659 snd_card_t *card;
41660 int device, subdevice;
41661@@ -359,16 +359,16 @@
41662
41663 switch (maj) {
41664 case CONFIG_SND_MAJOR:
41665- cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
41666+ cardnum = SNDRV_MINOR_CARD(iminor(inode));
41667 cardnum %= SNDRV_CARDS;
41668- device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev)) - SNDRV_MINOR_RAWMIDI;
41669+ device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_RAWMIDI;
41670 device %= SNDRV_MINOR_RAWMIDIS;
41671 break;
41672 #ifdef CONFIG_SND_OSSEMUL
41673 case SOUND_MAJOR:
41674- cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
41675+ cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
41676 cardnum %= SNDRV_CARDS;
41677- device = SNDRV_MINOR_OSS_DEVICE(minor(inode->i_rdev)) == SNDRV_MINOR_OSS_MIDI ?
41678+ device = SNDRV_MINOR_OSS_DEVICE(iminor(inode)) == SNDRV_MINOR_OSS_MIDI ?
41679 midi_map[cardnum] : amidi_map[cardnum];
41680 break;
41681 #endif
41682diff -Nru a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
41683--- a/sound/core/seq/oss/seq_oss.c Sun Jun 1 11:47:54 2003
41684+++ b/sound/core/seq/oss/seq_oss.c Tue Aug 26 09:25:41 2003
41685@@ -121,7 +121,7 @@
41686 {
41687 int level, rc;
41688
41689- if (minor(inode->i_rdev) == SNDRV_MINOR_OSS_MUSIC)
41690+ if (iminor(inode) == SNDRV_MINOR_OSS_MUSIC)
41691 level = SNDRV_SEQ_OSS_MODE_MUSIC;
41692 else
41693 level = SNDRV_SEQ_OSS_MODE_SYNTH;
41694diff -Nru a/sound/core/sound.c b/sound/core/sound.c
41695--- a/sound/core/sound.c Mon Jul 28 04:35:00 2003
41696+++ b/sound/core/sound.c Tue Aug 26 09:25:41 2003
41697@@ -117,7 +117,7 @@
41698
41699 static int snd_open(struct inode *inode, struct file *file)
41700 {
41701- int minor = minor(inode->i_rdev);
41702+ int minor = iminor(inode);
41703 int card = SNDRV_MINOR_CARD(minor);
41704 int dev = SNDRV_MINOR_DEVICE(minor);
41705 snd_minor_t *mptr = NULL;
41706diff -Nru a/sound/oss/ad1889.c b/sound/oss/ad1889.c
41707--- a/sound/oss/ad1889.c Sat Aug 2 23:59:09 2003
41708+++ b/sound/oss/ad1889.c Tue Aug 26 09:25:41 2003
41709@@ -755,7 +755,7 @@
41710 static int ad1889_open(struct inode *inode, struct file *file)
41711 {
41712 /* check minor; only support /dev/dsp atm */
41713- if (minor(inode->i_rdev) != 3)
41714+ if (iminor(inode) != 3)
41715 return -ENXIO;
41716
41717 file->private_data = ad1889_dev;
41718@@ -788,7 +788,7 @@
41719 /************************* /dev/mixer interfaces ************************ */
41720 static int ad1889_mixer_open(struct inode *inode, struct file *file)
41721 {
41722- if (ad1889_dev->ac97_codec->dev_mixer != minor(inode->i_rdev))
41723+ if (ad1889_dev->ac97_codec->dev_mixer != iminor(inode))
41724 return -ENODEV;
41725
41726 file->private_data = ad1889_dev->ac97_codec;
41727diff -Nru a/sound/oss/ali5455.c b/sound/oss/ali5455.c
41728--- a/sound/oss/ali5455.c Sat Aug 2 23:59:09 2003
41729+++ b/sound/oss/ali5455.c Tue Aug 26 09:25:41 2003
41730@@ -3026,7 +3026,7 @@
41731 static int ali_open_mixdev(struct inode *inode, struct file *file)
41732 {
41733 int i;
41734- int minor = minor(inode->i_rdev);
41735+ int minor = iminor(inode);
41736 struct ali_card *card = devs;
41737 for (card = devs; card != NULL; card = card->next) {
41738 /*
41739diff -Nru a/sound/oss/au1000.c b/sound/oss/au1000.c
41740--- a/sound/oss/au1000.c Sat Aug 2 23:59:09 2003
41741+++ b/sound/oss/au1000.c Tue Aug 26 09:25:41 2003
41742@@ -1842,7 +1842,7 @@
41743
41744 static int au1000_open(struct inode *inode, struct file *file)
41745 {
41746- int minor = MINOR(inode->i_rdev);
41747+ int minor = iminor(inode);
41748 DECLARE_WAITQUEUE(wait, current);
41749 struct au1000_state *s = &au1000_state;
41750 int ret;
41751diff -Nru a/sound/oss/btaudio.c b/sound/oss/btaudio.c
41752--- a/sound/oss/btaudio.c Tue Aug 12 13:28:49 2003
41753+++ b/sound/oss/btaudio.c Tue Aug 26 09:25:41 2003
41754@@ -299,7 +299,7 @@
41755
41756 static int btaudio_mixer_open(struct inode *inode, struct file *file)
41757 {
41758- int minor = minor(inode->i_rdev);
41759+ int minor = iminor(inode);
41760 struct btaudio *bta;
41761
41762 for (bta = btaudios; bta != NULL; bta = bta->next)
41763@@ -458,7 +458,7 @@
41764
41765 static int btaudio_dsp_open_digital(struct inode *inode, struct file *file)
41766 {
41767- int minor = minor(inode->i_rdev);
41768+ int minor = iminor(inode);
41769 struct btaudio *bta;
41770
41771 for (bta = btaudios; bta != NULL; bta = bta->next)
41772@@ -474,7 +474,7 @@
41773
41774 static int btaudio_dsp_open_analog(struct inode *inode, struct file *file)
41775 {
41776- int minor = minor(inode->i_rdev);
41777+ int minor = iminor(inode);
41778 struct btaudio *bta;
41779
41780 for (bta = btaudios; bta != NULL; bta = bta->next)
41781diff -Nru a/sound/oss/cmpci.c b/sound/oss/cmpci.c
41782--- a/sound/oss/cmpci.c Wed Jul 23 08:32:08 2003
41783+++ b/sound/oss/cmpci.c Tue Aug 26 09:25:41 2003
41784@@ -1448,7 +1448,7 @@
41785
41786 static int cm_open_mixdev(struct inode *inode, struct file *file)
41787 {
41788- int minor = minor(inode->i_rdev);
41789+ int minor = iminor(inode);
41790 struct cm_state *s = devs;
41791
41792 while (s && s->dev_mixer != minor)
41793@@ -2207,7 +2207,7 @@
41794
41795 static int cm_open(struct inode *inode, struct file *file)
41796 {
41797- int minor = minor(inode->i_rdev);
41798+ int minor = iminor(inode);
41799 struct cm_state *s = devs;
41800 unsigned char fmtm = ~0, fmts = 0;
41801
41802@@ -2462,7 +2462,7 @@
41803
41804 static int cm_midi_open(struct inode *inode, struct file *file)
41805 {
41806- int minor = minor(inode->i_rdev);
41807+ int minor = iminor(inode);
41808 struct cm_state *s = devs;
41809 unsigned long flags;
41810
41811@@ -2679,7 +2679,7 @@
41812
41813 static int cm_dmfm_open(struct inode *inode, struct file *file)
41814 {
41815- int minor = minor(inode->i_rdev);
41816+ int minor = iminor(inode);
41817 struct cm_state *s = devs;
41818
41819 while (s && s->dev_dmfm != minor)
41820diff -Nru a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
41821--- a/sound/oss/cs4281/cs4281m.c Thu Jul 31 08:58:39 2003
41822+++ b/sound/oss/cs4281/cs4281m.c Tue Aug 26 09:25:41 2003
41823@@ -2567,7 +2567,7 @@
41824
41825 static int cs4281_open_mixdev(struct inode *inode, struct file *file)
41826 {
41827- unsigned int minor = minor(inode->i_rdev);
41828+ unsigned int minor = iminor(inode);
41829 struct cs4281_state *s=NULL;
41830 struct list_head *entry;
41831
41832@@ -3624,7 +3624,7 @@
41833
41834 static int cs4281_open(struct inode *inode, struct file *file)
41835 {
41836- unsigned int minor = minor(inode->i_rdev);
41837+ unsigned int minor = iminor(inode);
41838 struct cs4281_state *s=NULL;
41839 struct list_head *entry;
41840
41841@@ -3966,7 +3966,7 @@
41842 static int cs4281_midi_open(struct inode *inode, struct file *file)
41843 {
41844 unsigned long flags, temp1;
41845- unsigned int minor = minor(inode->i_rdev);
41846+ unsigned int minor = iminor(inode);
41847 struct cs4281_state *s=NULL;
41848 struct list_head *entry;
41849 list_for_each(entry, &cs4281_devs)
41850diff -Nru a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
41851--- a/sound/oss/cs46xx.c Tue Aug 12 13:28:49 2003
41852+++ b/sound/oss/cs46xx.c Tue Aug 26 09:25:41 2003
41853@@ -1838,7 +1838,7 @@
41854
41855 static int cs_midi_open(struct inode *inode, struct file *file)
41856 {
41857- unsigned int minor = minor(inode->i_rdev);
41858+ unsigned int minor = iminor(inode);
41859 struct cs_card *card=NULL;
41860 unsigned long flags;
41861 struct list_head *entry;
41862@@ -3200,7 +3200,7 @@
41863 struct cs_state *state = NULL;
41864 struct dmabuf *dmabuf = NULL;
41865 struct list_head *entry;
41866- unsigned int minor = minor(inode->i_rdev);
41867+ unsigned int minor = iminor(inode);
41868 int ret=0;
41869 unsigned int tmp;
41870
41871@@ -4066,7 +4066,7 @@
41872 static int cs_open_mixdev(struct inode *inode, struct file *file)
41873 {
41874 int i=0;
41875- unsigned int minor = minor(inode->i_rdev);
41876+ unsigned int minor = iminor(inode);
41877 struct cs_card *card=NULL;
41878 struct list_head *entry;
41879 unsigned int tmp;
41880@@ -4113,7 +4113,7 @@
41881
41882 static int cs_release_mixdev(struct inode *inode, struct file *file)
41883 {
41884- unsigned int minor = minor(inode->i_rdev);
41885+ unsigned int minor = iminor(inode);
41886 struct cs_card *card=NULL;
41887 struct list_head *entry;
41888 int i;
41889diff -Nru a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
41890--- a/sound/oss/dmasound/dmasound_core.c Tue Aug 12 13:28:49 2003
41891+++ b/sound/oss/dmasound/dmasound_core.c Tue Aug 26 09:25:41 2003
41892@@ -904,7 +904,7 @@
41893 O_RDONLY and dsp1 could be opened O_WRONLY
41894 */
41895
41896- dmasound.minDev = minor(inode->i_rdev) & 0x0f;
41897+ dmasound.minDev = iminor(inode) & 0x0f;
41898
41899 /* OK. - we should make some attempt at consistency. At least the H'ware
41900 options should be set with a valid mode. We will make it that the LL
41901diff -Nru a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c
41902--- a/sound/oss/emu10k1/audio.c Tue Jul 15 10:35:45 2003
41903+++ b/sound/oss/emu10k1/audio.c Tue Aug 26 09:25:41 2003
41904@@ -1112,7 +1112,7 @@
41905
41906 static int emu10k1_audio_open(struct inode *inode, struct file *file)
41907 {
41908- int minor = minor(inode->i_rdev);
41909+ int minor = iminor(inode);
41910 struct emu10k1_card *card = NULL;
41911 struct list_head *entry;
41912 struct emu10k1_wavedevice *wave_dev;
41913diff -Nru a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
41914--- a/sound/oss/emu10k1/midi.c Thu Apr 3 14:52:57 2003
41915+++ b/sound/oss/emu10k1/midi.c Tue Aug 26 09:25:41 2003
41916@@ -86,7 +86,7 @@
41917
41918 static int emu10k1_midi_open(struct inode *inode, struct file *file)
41919 {
41920- int minor = minor(inode->i_rdev);
41921+ int minor = iminor(inode);
41922 struct emu10k1_card *card = NULL;
41923 struct emu10k1_mididevice *midi_dev;
41924 struct list_head *entry;
41925diff -Nru a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c
41926--- a/sound/oss/emu10k1/mixer.c Tue Jul 15 10:35:45 2003
41927+++ b/sound/oss/emu10k1/mixer.c Tue Aug 26 09:25:41 2003
41928@@ -654,7 +654,7 @@
41929
41930 static int emu10k1_mixer_open(struct inode *inode, struct file *file)
41931 {
41932- int minor = minor(inode->i_rdev);
41933+ int minor = iminor(inode);
41934 struct emu10k1_card *card = NULL;
41935 struct list_head *entry;
41936
41937diff -Nru a/sound/oss/es1370.c b/sound/oss/es1370.c
41938--- a/sound/oss/es1370.c Tue Aug 12 16:21:59 2003
41939+++ b/sound/oss/es1370.c Tue Aug 26 09:25:41 2003
41940@@ -1023,7 +1023,7 @@
41941
41942 static int es1370_open_mixdev(struct inode *inode, struct file *file)
41943 {
41944- unsigned int minor = minor(inode->i_rdev);
41945+ unsigned int minor = iminor(inode);
41946 struct list_head *list;
41947 struct es1370_state *s;
41948
41949@@ -1727,7 +1727,7 @@
41950
41951 static int es1370_open(struct inode *inode, struct file *file)
41952 {
41953- unsigned int minor = minor(inode->i_rdev);
41954+ unsigned int minor = iminor(inode);
41955 DECLARE_WAITQUEUE(wait, current);
41956 unsigned long flags;
41957 struct list_head *list;
41958@@ -2165,7 +2165,7 @@
41959
41960 static int es1370_open_dac(struct inode *inode, struct file *file)
41961 {
41962- unsigned int minor = minor(inode->i_rdev);
41963+ unsigned int minor = iminor(inode);
41964 DECLARE_WAITQUEUE(wait, current);
41965 unsigned long flags;
41966 struct list_head *list;
41967@@ -2408,7 +2408,7 @@
41968
41969 static int es1370_midi_open(struct inode *inode, struct file *file)
41970 {
41971- unsigned int minor = minor(inode->i_rdev);
41972+ unsigned int minor = iminor(inode);
41973 DECLARE_WAITQUEUE(wait, current);
41974 unsigned long flags;
41975 struct list_head *list;
41976diff -Nru a/sound/oss/es1371.c b/sound/oss/es1371.c
41977--- a/sound/oss/es1371.c Tue Aug 12 13:28:49 2003
41978+++ b/sound/oss/es1371.c Tue Aug 26 09:25:41 2003
41979@@ -1210,7 +1210,7 @@
41980
41981 static int es1371_open_mixdev(struct inode *inode, struct file *file)
41982 {
41983- int minor = minor(inode->i_rdev);
41984+ int minor = iminor(inode);
41985 struct list_head *list;
41986 struct es1371_state *s;
41987
41988@@ -1914,7 +1914,7 @@
41989
41990 static int es1371_open(struct inode *inode, struct file *file)
41991 {
41992- int minor = minor(inode->i_rdev);
41993+ int minor = iminor(inode);
41994 DECLARE_WAITQUEUE(wait, current);
41995 unsigned long flags;
41996 struct list_head *list;
41997@@ -2345,7 +2345,7 @@
41998
41999 static int es1371_open_dac(struct inode *inode, struct file *file)
42000 {
42001- int minor = minor(inode->i_rdev);
42002+ int minor = iminor(inode);
42003 DECLARE_WAITQUEUE(wait, current);
42004 unsigned long flags;
42005 struct list_head *list;
42006@@ -2587,7 +2587,7 @@
42007
42008 static int es1371_midi_open(struct inode *inode, struct file *file)
42009 {
42010- int minor = minor(inode->i_rdev);
42011+ int minor = iminor(inode);
42012 DECLARE_WAITQUEUE(wait, current);
42013 unsigned long flags;
42014 struct list_head *list;
42015diff -Nru a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
42016--- a/sound/oss/esssolo1.c Thu Jul 31 08:58:39 2003
42017+++ b/sound/oss/esssolo1.c Tue Aug 26 09:25:41 2003
42018@@ -913,7 +913,7 @@
42019
42020 static int solo1_open_mixdev(struct inode *inode, struct file *file)
42021 {
42022- unsigned int minor = minor(inode->i_rdev);
42023+ unsigned int minor = iminor(inode);
42024 struct solo1_state *s = NULL;
42025 struct pci_dev *pci_dev = NULL;
42026
42027@@ -1594,7 +1594,7 @@
42028
42029 static int solo1_open(struct inode *inode, struct file *file)
42030 {
42031- unsigned int minor = minor(inode->i_rdev);
42032+ unsigned int minor = iminor(inode);
42033 DECLARE_WAITQUEUE(wait, current);
42034 struct solo1_state *s = NULL;
42035 struct pci_dev *pci_dev = NULL;
42036@@ -1884,7 +1884,7 @@
42037
42038 static int solo1_midi_open(struct inode *inode, struct file *file)
42039 {
42040- unsigned int minor = minor(inode->i_rdev);
42041+ unsigned int minor = iminor(inode);
42042 DECLARE_WAITQUEUE(wait, current);
42043 unsigned long flags;
42044 struct solo1_state *s = NULL;
42045@@ -2106,7 +2106,7 @@
42046
42047 static int solo1_dmfm_open(struct inode *inode, struct file *file)
42048 {
42049- unsigned int minor = minor(inode->i_rdev);
42050+ unsigned int minor = iminor(inode);
42051 DECLARE_WAITQUEUE(wait, current);
42052 struct solo1_state *s = NULL;
42053 struct pci_dev *pci_dev = NULL;
42054diff -Nru a/sound/oss/hal2.c b/sound/oss/hal2.c
42055--- a/sound/oss/hal2.c Sat Aug 2 23:59:09 2003
42056+++ b/sound/oss/hal2.c Tue Aug 26 09:25:41 2003
42057@@ -867,7 +867,7 @@
42058
42059 static int hal2_open_mixdev(struct inode *inode, struct file *file)
42060 {
42061- hal2_card_t *hal2 = hal2_mixer_find_card(MINOR(inode->i_rdev));
42062+ hal2_card_t *hal2 = hal2_mixer_find_card(iminor(inode));
42063
42064 if (hal2) {
42065 file->private_data = hal2;
42066@@ -1242,7 +1242,7 @@
42067 static int hal2_open(struct inode *inode, struct file *file)
42068 {
42069 int err;
42070- hal2_card_t *hal2 = hal2_dsp_find_card(MINOR(inode->i_rdev));
42071+ hal2_card_t *hal2 = hal2_dsp_find_card(iminor(inode));
42072
42073 DEBUG("opening audio device.\n");
42074
42075diff -Nru a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
42076--- a/sound/oss/i810_audio.c Tue Aug 12 16:21:48 2003
42077+++ b/sound/oss/i810_audio.c Tue Aug 26 09:25:41 2003
42078@@ -2648,7 +2648,7 @@
42079 static int i810_open_mixdev(struct inode *inode, struct file *file)
42080 {
42081 int i;
42082- int minor = minor(inode->i_rdev);
42083+ int minor = iminor(inode);
42084 struct i810_card *card = devs;
42085
42086 for (card = devs; card != NULL; card = card->next) {
42087diff -Nru a/sound/oss/ite8172.c b/sound/oss/ite8172.c
42088--- a/sound/oss/ite8172.c Sun Aug 3 00:02:01 2003
42089+++ b/sound/oss/ite8172.c Sun Aug 31 16:14:08 2003
42090@@ -867,7 +867,7 @@
42091
42092 static int it8172_open_mixdev(struct inode *inode, struct file *file)
42093 {
42094- int minor = MINOR(inode->i_rdev);
42095+ int minor = iminor(inode);
42096 struct list_head *list;
42097 struct it8172_state *s;
42098
42099@@ -1771,7 +1771,7 @@
42100
42101 static int it8172_open(struct inode *inode, struct file *file)
42102 {
42103- int minor = MINOR(inode->i_rdev);
42104+ int minor = iminor(inode);
42105 DECLARE_WAITQUEUE(wait, current);
42106 unsigned long flags;
42107 struct list_head *list;
42108@@ -2198,10 +2198,10 @@
42109 MODULE_DEVICE_TABLE(pci, id_table);
42110
42111 static struct pci_driver it8172_driver = {
42112- name: IT8172_MODULE_NAME,
42113- id_table: id_table,
42114- probe: it8172_probe,
42115- remove: it8172_remove
42116+ .name = IT8172_MODULE_NAME,
42117+ .id_table = id_table,
42118+ .probe = it8172_probe,
42119+ .remove = it8172_remove
42120 };
42121
42122 static int __init init_it8172(void)
42123diff -Nru a/sound/oss/maestro.c b/sound/oss/maestro.c
42124--- a/sound/oss/maestro.c Tue Aug 12 13:28:49 2003
42125+++ b/sound/oss/maestro.c Tue Aug 26 09:25:41 2003
42126@@ -2138,7 +2138,7 @@
42127 /* --------------------------------------------------------------------- */
42128 static int ess_open_mixdev(struct inode *inode, struct file *file)
42129 {
42130- unsigned int minor = minor(inode->i_rdev);
42131+ unsigned int minor = iminor(inode);
42132 struct ess_card *card = NULL;
42133 struct pci_dev *pdev = NULL;
42134 struct pci_driver *drvr;
42135@@ -2983,7 +2983,7 @@
42136 static int
42137 ess_open(struct inode *inode, struct file *file)
42138 {
42139- unsigned int minor = minor(inode->i_rdev);
42140+ unsigned int minor = iminor(inode);
42141 struct ess_state *s = NULL;
42142 unsigned char fmtm = ~0, fmts = 0;
42143 struct pci_dev *pdev = NULL;
42144diff -Nru a/sound/oss/maestro3.c b/sound/oss/maestro3.c
42145--- a/sound/oss/maestro3.c Thu Jul 31 08:58:39 2003
42146+++ b/sound/oss/maestro3.c Tue Aug 26 09:25:41 2003
42147@@ -1980,7 +1980,7 @@
42148
42149 static int m3_open(struct inode *inode, struct file *file)
42150 {
42151- unsigned int minor = minor(inode->i_rdev);
42152+ unsigned int minor = iminor(inode);
42153 struct m3_card *c;
42154 struct m3_state *s = NULL;
42155 int i;
42156@@ -2149,7 +2149,7 @@
42157 /* OSS /dev/mixer file operation methods */
42158 static int m3_open_mixdev(struct inode *inode, struct file *file)
42159 {
42160- unsigned int minor = minor(inode->i_rdev);
42161+ unsigned int minor = iminor(inode);
42162 struct m3_card *card = devs;
42163
42164 for (card = devs; card != NULL; card = card->next) {
42165diff -Nru a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
42166--- a/sound/oss/msnd_pinnacle.c Wed Jul 23 08:32:08 2003
42167+++ b/sound/oss/msnd_pinnacle.c Tue Aug 26 09:25:41 2003
42168@@ -646,7 +646,7 @@
42169
42170 static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
42171 {
42172- int minor = minor(inode->i_rdev);
42173+ int minor = iminor(inode);
42174
42175 if (cmd == OSS_GETVERSION) {
42176 int sound_version = SOUND_VERSION;
42177@@ -758,7 +758,7 @@
42178
42179 static int dev_open(struct inode *inode, struct file *file)
42180 {
42181- int minor = minor(inode->i_rdev);
42182+ int minor = iminor(inode);
42183 int err = 0;
42184
42185 if (minor == dev.dsp_minor) {
42186@@ -793,7 +793,7 @@
42187
42188 static int dev_release(struct inode *inode, struct file *file)
42189 {
42190- int minor = minor(inode->i_rdev);
42191+ int minor = iminor(inode);
42192 int err = 0;
42193
42194 lock_kernel();
42195@@ -983,7 +983,7 @@
42196
42197 static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off)
42198 {
42199- int minor = minor(file->f_dentry->d_inode->i_rdev);
42200+ int minor = iminor(file->f_dentry->d_inode);
42201 if (minor == dev.dsp_minor)
42202 return dsp_read(buf, count);
42203 else
42204@@ -992,7 +992,7 @@
42205
42206 static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off)
42207 {
42208- int minor = minor(file->f_dentry->d_inode->i_rdev);
42209+ int minor = iminor(file->f_dentry->d_inode);
42210 if (minor == dev.dsp_minor)
42211 return dsp_write(buf, count);
42212 else
42213diff -Nru a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
42214--- a/sound/oss/nec_vrc5477.c Tue Aug 12 13:28:49 2003
42215+++ b/sound/oss/nec_vrc5477.c Tue Aug 26 09:25:41 2003
42216@@ -857,7 +857,7 @@
42217
42218 static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
42219 {
42220- int minor = minor(inode->i_rdev);
42221+ int minor = iminor(inode);
42222 struct list_head *list;
42223 struct vrc5477_ac97_state *s;
42224
42225@@ -1569,7 +1569,7 @@
42226
42227 static int vrc5477_ac97_open(struct inode *inode, struct file *file)
42228 {
42229- int minor = minor(inode->i_rdev);
42230+ int minor = iminor(inode);
42231 DECLARE_WAITQUEUE(wait, current);
42232 unsigned long flags;
42233 struct list_head *list;
42234diff -Nru a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
42235--- a/sound/oss/rme96xx.c Thu Jul 31 08:58:39 2003
42236+++ b/sound/oss/rme96xx.c Tue Aug 26 09:25:41 2003
42237@@ -1445,7 +1445,7 @@
42238
42239 static int rme96xx_open(struct inode *in, struct file *f)
42240 {
42241- int minor = minor(in->i_rdev);
42242+ int minor = iminor(in);
42243 struct list_head *list;
42244 int devnum;
42245 rme96xx_info *s;
42246@@ -1769,7 +1769,7 @@
42247
42248 static int rme96xx_mixer_open(struct inode *inode, struct file *file)
42249 {
42250- int minor = minor(inode->i_rdev);
42251+ int minor = iminor(inode);
42252 struct list_head *list;
42253 rme96xx_info *s;
42254
42255diff -Nru a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
42256--- a/sound/oss/sonicvibes.c Tue Aug 12 13:28:49 2003
42257+++ b/sound/oss/sonicvibes.c Tue Aug 26 09:25:41 2003
42258@@ -1238,7 +1238,7 @@
42259
42260 static int sv_open_mixdev(struct inode *inode, struct file *file)
42261 {
42262- int minor = minor(inode->i_rdev);
42263+ int minor = iminor(inode);
42264 struct list_head *list;
42265 struct sv_state *s;
42266
42267@@ -1900,7 +1900,7 @@
42268
42269 static int sv_open(struct inode *inode, struct file *file)
42270 {
42271- int minor = minor(inode->i_rdev);
42272+ int minor = iminor(inode);
42273 DECLARE_WAITQUEUE(wait, current);
42274 unsigned char fmtm = ~0, fmts = 0;
42275 struct list_head *list;
42276@@ -2149,7 +2149,7 @@
42277
42278 static int sv_midi_open(struct inode *inode, struct file *file)
42279 {
42280- int minor = minor(inode->i_rdev);
42281+ int minor = iminor(inode);
42282 DECLARE_WAITQUEUE(wait, current);
42283 unsigned long flags;
42284 struct list_head *list;
42285@@ -2371,7 +2371,7 @@
42286
42287 static int sv_dmfm_open(struct inode *inode, struct file *file)
42288 {
42289- int minor = minor(inode->i_rdev);
42290+ int minor = iminor(inode);
42291 DECLARE_WAITQUEUE(wait, current);
42292 struct list_head *list;
42293 struct sv_state *s;
42294diff -Nru a/sound/oss/soundcard.c b/sound/oss/soundcard.c
42295--- a/sound/oss/soundcard.c Tue Aug 12 13:28:49 2003
42296+++ b/sound/oss/soundcard.c Tue Aug 26 09:25:41 2003
42297@@ -144,7 +144,7 @@
42298
42299 static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos)
42300 {
42301- int dev = minor(file->f_dentry->d_inode->i_rdev);
42302+ int dev = iminor(file->f_dentry->d_inode);
42303 int ret = -EINVAL;
42304
42305 /*
42306@@ -177,7 +177,7 @@
42307
42308 static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
42309 {
42310- int dev = minor(file->f_dentry->d_inode->i_rdev);
42311+ int dev = iminor(file->f_dentry->d_inode);
42312 int ret = -EINVAL;
42313
42314 lock_kernel();
42315@@ -204,7 +204,7 @@
42316
42317 static int sound_open(struct inode *inode, struct file *file)
42318 {
42319- int dev = minor(inode->i_rdev);
42320+ int dev = iminor(inode);
42321 int retval;
42322
42323 DEB(printk("sound_open(dev=%d)\n", dev));
42324@@ -253,7 +253,7 @@
42325
42326 static int sound_release(struct inode *inode, struct file *file)
42327 {
42328- int dev = minor(inode->i_rdev);
42329+ int dev = iminor(inode);
42330
42331 lock_kernel();
42332 DEB(printk("sound_release(dev=%d)\n", dev));
42333@@ -333,7 +333,7 @@
42334 unsigned int cmd, unsigned long arg)
42335 {
42336 int err, len = 0, dtype;
42337- int dev = minor(inode->i_rdev);
42338+ int dev = iminor(inode);
42339
42340 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
42341 /*
42342@@ -396,7 +396,7 @@
42343 static unsigned int sound_poll(struct file *file, poll_table * wait)
42344 {
42345 struct inode *inode = file->f_dentry->d_inode;
42346- int dev = minor(inode->i_rdev);
42347+ int dev = iminor(inode);
42348
42349 DEB(printk("sound_poll(dev=%d)\n", dev));
42350 switch (dev & 0x0f) {
42351@@ -420,7 +420,7 @@
42352 int dev_class;
42353 unsigned long size;
42354 struct dma_buffparms *dmap = NULL;
42355- int dev = minor(file->f_dentry->d_inode->i_rdev);
42356+ int dev = iminor(file->f_dentry->d_inode);
42357
42358 dev_class = dev & 0x0f;
42359 dev >>= 4;
42360diff -Nru a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
42361--- a/sound/oss/swarm_cs4297a.c Sun Aug 3 00:04:24 2003
42362+++ b/sound/oss/swarm_cs4297a.c Tue Aug 26 09:25:41 2003
42363@@ -1537,7 +1537,7 @@
42364
42365 static int cs4297a_open_mixdev(struct inode *inode, struct file *file)
42366 {
42367- int minor = MINOR(inode->i_rdev);
42368+ int minor = iminor(inode);
42369 struct cs4297a_state *s=NULL;
42370 struct list_head *entry;
42371
42372@@ -2386,7 +2386,7 @@
42373
42374 static int cs4297a_open(struct inode *inode, struct file *file)
42375 {
42376- int minor = MINOR(inode->i_rdev);
42377+ int minor = iminor(inode);
42378 struct cs4297a_state *s=NULL;
42379 struct list_head *entry;
42380
42381diff -Nru a/sound/oss/trident.c b/sound/oss/trident.c
42382--- a/sound/oss/trident.c Sat Aug 9 11:53:08 2003
42383+++ b/sound/oss/trident.c Tue Aug 26 09:25:41 2003
42384@@ -2600,7 +2600,7 @@
42385 static int trident_open(struct inode *inode, struct file *file)
42386 {
42387 int i = 0;
42388- int minor = minor(inode->i_rdev);
42389+ int minor = iminor(inode);
42390 struct trident_card *card = devs;
42391 struct trident_state *state = NULL;
42392 struct dmabuf *dmabuf = NULL;
42393@@ -3883,7 +3883,7 @@
42394 static int trident_open_mixdev(struct inode *inode, struct file *file)
42395 {
42396 int i = 0;
42397- int minor = minor(inode->i_rdev);
42398+ int minor = iminor(inode);
42399 struct trident_card *card = devs;
42400
42401 for (card = devs; card != NULL; card = card->next)
42402diff -Nru a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
42403--- a/sound/oss/via82cxxx_audio.c Sun Aug 3 00:05:26 2003
42404+++ b/sound/oss/via82cxxx_audio.c Tue Aug 26 09:25:41 2003
42405@@ -1556,7 +1556,7 @@
42406
42407 static int via_mixer_open (struct inode *inode, struct file *file)
42408 {
42409- int minor = minor(inode->i_rdev);
42410+ int minor = iminor(inode);
42411 struct via_info *card;
42412 struct pci_dev *pdev = NULL;
42413 struct pci_driver *drvr;
42414@@ -3252,7 +3252,7 @@
42415
42416 static int via_dsp_open (struct inode *inode, struct file *file)
42417 {
42418- int minor = minor(inode->i_rdev);
42419+ int minor = iminor(inode);
42420 struct via_info *card;
42421 struct pci_dev *pdev = NULL;
42422 struct via_channel *chan;
42423diff -Nru a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
42424--- a/sound/oss/vwsnd.c Mon Apr 21 00:32:53 2003
42425+++ b/sound/oss/vwsnd.c Tue Aug 26 09:25:41 2003
42426@@ -2916,7 +2916,7 @@
42427 static int vwsnd_audio_open(struct inode *inode, struct file *file)
42428 {
42429 vwsnd_dev_t *devc;
42430- dev_t minor = minor(inode->i_rdev);
42431+ int minor = iminor(inode);
42432 int sw_samplefmt;
42433
42434 DBGE("(inode=0x%p, file=0x%p)\n", inode, file);
42435@@ -3063,7 +3063,7 @@
42436
42437 INC_USE_COUNT;
42438 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)
42439- if (devc->mixer_minor == minor(inode->i_rdev))
42440+ if (devc->mixer_minor == iminor(inode))
42441 break;
42442
42443 if (devc == NULL) {
42444diff -Nru a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
42445--- a/sound/oss/ymfpci.c Mon Aug 18 22:27:20 2003
42446+++ b/sound/oss/ymfpci.c Tue Aug 26 09:25:41 2003
42447@@ -1905,7 +1905,7 @@
42448 struct ymf_state *state;
42449 int err;
42450
42451- minor = minor(inode->i_rdev);
42452+ minor = iminor(inode);
42453 if ((minor & 0x0F) == 3) { /* /dev/dspN */
42454 ;
42455 } else {
42456@@ -2019,7 +2019,7 @@
42457 */
42458 static int ymf_open_mixdev(struct inode *inode, struct file *file)
42459 {
42460- int minor = minor(inode->i_rdev);
42461+ int minor = iminor(inode);
42462 struct list_head *list;
42463 ymfpci_t *unit;
42464 int i;
42465diff -Nru a/sound/pcmcia/vx/vx_entry.c b/sound/pcmcia/vx/vx_entry.c
42466--- a/sound/pcmcia/vx/vx_entry.c Tue Jun 10 07:32:30 2003
42467+++ b/sound/pcmcia/vx/vx_entry.c Fri Aug 22 05:02:18 2003
42468@@ -34,10 +34,8 @@
42469 static int vxpocket_event(event_t event, int priority, event_callback_args_t *args);
42470
42471
42472-static void vxpocket_release(u_long arg)
42473+static void vxpocket_release(dev_link_t* link)
42474 {
42475- dev_link_t *link = (dev_link_t *)arg;
42476-
42477 if (link->state & DEV_CONFIG) {
42478 /* release cs resources */
42479 CardServices(ReleaseConfiguration, link->handle);
42480@@ -56,7 +54,7 @@
42481 struct snd_vxp_entry *hw;
42482 dev_link_t *link = &vxp->link;
42483
42484- vxpocket_release((u_long)link);
42485+ vxpocket_release(link);
42486
42487 /* Break the link with Card Services */
42488 if (link->handle)
42489@@ -148,9 +146,6 @@
42490 link->irq.Handler = &snd_vx_irq_handler;
42491 link->irq.Instance = chip;
42492
42493- link->release.function = &vxpocket_release;
42494- link->release.data = (u_long)link;
42495-
42496 link->conf.Attributes = CONF_ENABLE_IRQ;
42497 link->conf.Vcc = 50;
42498 link->conf.IntType = INT_MEMORY_AND_IO;
42499@@ -229,8 +224,6 @@
42500 {
42501 vx_core_t *chip = snd_magic_cast(vx_core_t, link->priv, return);
42502
42503- del_timer(&link->release);
42504-
42505 snd_printdd(KERN_DEBUG "vxpocket_detach called\n");
42506 /* Remove the interface data from the linked list */
42507 if (hw) {
42508@@ -326,7 +319,6 @@
42509 snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
42510 link->state &= ~DEV_PRESENT;
42511 if (link->state & DEV_CONFIG) {
42512- mod_timer(&link->release, jiffies + HZ/20);
42513 chip->chip_status |= VX_STAT_IS_STALE;
42514 }
42515 break;
42516diff -Nru a/sound/ppc/keywest.c b/sound/ppc/keywest.c
42517--- a/sound/ppc/keywest.c Tue May 20 14:13:01 2003
42518+++ b/sound/ppc/keywest.c Sun Aug 24 06:11:13 2003
42519@@ -50,7 +50,7 @@
42520
42521
42522 #ifndef i2c_device_name
42523-#define i2c_device_name(x) ((x)->dev.name)
42524+#define i2c_device_name(x) ((x)->name)
42525 #endif
42526
42527 static int keywest_attach_adapter(struct i2c_adapter *adapter)
42528diff -Nru a/sound/sound_core.c b/sound/sound_core.c
42529--- a/sound/sound_core.c Sat May 17 12:39:14 2003
42530+++ b/sound/sound_core.c Tue Aug 26 09:25:41 2003
42531@@ -483,7 +483,7 @@
42532 int soundcore_open(struct inode *inode, struct file *file)
42533 {
42534 int chain;
42535- int unit = minor(inode->i_rdev);
42536+ int unit = iminor(inode);
42537 struct sound_unit *s;
42538 struct file_operations *new_fops = NULL;
42539
This page took 5.516335 seconds and 4 git commands to generate.