1 diff -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 @@
9 D: all kinds of driver, filesystem & core kernel hacking
12 D: chief codingstyle nitpicker
22 diff -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
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).
34 diff -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
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
43 2 Modifying System Parameters
44 2.1 /proc/sys/fs - File system data
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
51 +1.8 Miscellaneous kernel statistics in /proc/stat
52 +-------------------------------------------------
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:
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 ...]
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:
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
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
87 +The "ctxt" line gives the total number of context switches across all CPUs.
89 +The "btime" line gives the time at which the system booted, in seconds since
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.
96 +The "procs_running" line gives the number of processes currently running on
99 +The "procs_blocked" line gives the number of processes currently blocked,
100 +waiting for I/O to complete.
103 ------------------------------------------------------------------------------
104 diff -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
109 - Information regarding the Enhanced IDE drive in Linux 2.5
110 + Information regarding the Enhanced IDE drive in Linux 2.6
112 ==============================================================================
115 and quite likely to cause trouble with
116 older/odd IDE drives.
118 + "hdx=biostimings" : driver will NOT attempt to tune interface speed
119 + (DMA/PIO) but always honour BIOS timings.
121 "hdx=slow" : insert a huge pause after each access to the data
122 port. Should be used only as a last resort.
124 + "hdx=swapdata" : when the drive is a disk, byte swap all data
126 + "hdx=bswap" : same as above..........
128 + "hdx=flash" : allows for more than one ata_flash disk to be
129 + registered. In most cases, only one device
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.
136 "hdxlun=xx" : set the drive last logical unit
138 @@ -277,27 +292,41 @@
139 "idex=noautotune" : driver will NOT attempt to tune interface speed
140 This is the default for most chipsets,
143 + "idex=biostimings" : driver will NOT attempt to tune interface speed
144 + (DMA/PIO) but always honour BIOS timings.
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
151 + "idex=four" : four drives on idex and ide(x^1) share same ports
153 "idex=reset" : reset interface after probe
155 "idex=dma" : automatically configure/use DMA if possible.
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
165 + "ide=reverse" : formerly called to pci sub-system, but now local.
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.
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
182 There may be more options than shown -- use the source, Luke!
186 Wed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki, the current
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>
191 diff -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
195 when calculating gettimeofday(). If specicified timesource
196 is not avalible, it defaults to PIT.
197 Format: { pit | tsc | cyclone | ... }
200 + hpet= [IA-32,HPET] option to disable HPET and use PIT.
204 Format: { auto | [<io>,][<irq>] }
206 diff -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
210 see the sysfs documentation for more information.
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
219 Instances of struct kobj_type are not registered; only referenced by
220 diff -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
224 Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
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.
232 It will give access (through a user space utility) to some events those laptops
235 SONYPI_THUMBPHRASE_MASK 0x0200
236 SONYPI_MEYE_MASK 0x0400
237 SONYPI_MEMORYSTICK_MASK 0x0800
238 + SONYPI_BATTERY_MASK 0x1000
240 useinput: if set (which is the default) jogdial events are
241 forwarded to the input subsystem as mouse wheel
242 diff -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
246 by piece basis, or just some 'thematic frobbing'.
248 The subdirs are about:
249 +abi/ execution domains & personalities
251 dev/ device specific information (eg dev/cdrom/info)
252 fs/ specific filesystems
253 diff -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
257 +Documentation for /proc/sys/abi/* kernel version 2.6.0.test2
258 + (c) 2003, Fabian Frederick <ffrederick@users.sourceforge.net>
260 +For general info : README.
262 +==============================================================
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.
269 +Here are the files featuring in 2.6 kernel :
278 +===========================================================
282 +0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE
284 +===========================================================
290 +===========================================================
294 +0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
296 +===========================================================
300 +0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
302 +===========================================================
306 +===========================================================
310 +===========================================================
311 diff -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
316 MJPEG hardware grabbing is supported via a private API (see below).
321 +This driver supports the 'second' version of the MotionEye camera :)
323 +The first version was connected directly on the video bus of the Neomagic
324 +video card and is unsupported.
326 +The second one, made by Kawasaki Steel is fully supported by this
327 +driver (PCI vendor/device is 0x136b/0xff01)
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).
338 diff -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
347 L: dri-devel@lists.sourceforge.net
350 @@ -1087,6 +1085,14 @@
351 L: kbuild-devel@lists.sourceforge.net
352 W: http://kbuild.sourceforge.net
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/
365 diff -Nru a/Makefile b/Makefile
366 --- a/Makefile Fri Aug 22 16:38:51 2003
367 +++ b/Makefile Tue Sep 2 04:33:54 2003
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).
372 +no-dot-config-targets := clean mrproper distclean \
373 + cscope TAGS tags help %docs check%
379 +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
380 + ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
385 ifneq ($(filter config %config,$(MAKECMDGOALS)),)
387 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
393 +ifeq ($(dot-config),1)
394 +# In this section, we need .config
396 +# Read in dependencies to all Kconfig* files, make sure to run
397 +# oldconfig if changes are detected.
398 +-include .config.cmd
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
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
414 include arch/$(ARCH)/Makefile
418 # Here goes the main Makefile
419 # ---------------------------------------------------------------------------
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
426 -# In this section, we need .config
428 --include .config.cmd
430 ifndef CONFIG_FRAME_POINTER
431 CFLAGS += -fomit-frame-pointer
433 @scripts/split-include include/linux/autoconf.h include/config
436 -# if .config is newer than include/linux/autoconf.h, someone tinkered
437 -# with it and forgot to run make oldconfig
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
443 # Generate some files
444 # ---------------------------------------------------------------------------
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";\
455 @rm -rf $(MODLIB)/kernel
456 @rm -f $(MODLIB)/build
457 @mkdir -p $(MODLIB)/kernel
458 diff -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
463 source "drivers/pcmcia/Kconfig"
466 - prompt "Kernel core (/proc/kcore) format"
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
477 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
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.
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.
494 - Not necessary unless you're using a very out-of-date binutils
495 - version. You probably want KCORE_ELF.
500 tristate "SRM environment through procfs"
502 diff -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 @@
507 struct alpha_agp_ops titan_agp_ops =
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
524 diff -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
528 If you do not feel you need a faster FP emulation you should better
532 - prompt "Kernel core (/proc/kcore) format"
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
542 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
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.
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.
559 - Not necessary unless you're using a very out-of-date binutils
560 - version. You probably want KCORE_ELF.
564 source "fs/Kconfig.binfmt"
566 source "drivers/base/Kconfig"
567 diff -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
571 CFLAGS += -mbig-endian
574 +AFLAGS += -mbig-endian
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)
578 diff -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
582 ifeq ($(CONFIG_ARCH_SA1100),y)
583 zreladdr-$(CONFIG_SA1111) := 0xc0208000
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
597 ZRELADDR := $(zreladdr-y)
598 ZTEXTADDR := $(ztextaddr-y)
599 diff -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
603 return amba_lookup(pcdrv->id_table, pcdev) != NULL;
606 +static int amba_suspend(struct device *dev, u32 state)
608 + struct amba_driver *drv = to_amba_driver(dev->driver);
611 + if (dev->driver && drv->suspend)
612 + ret = drv->suspend(to_amba_device(dev), state);
616 +static int amba_resume(struct device *dev)
618 + struct amba_driver *drv = to_amba_driver(dev->driver);
621 + if (dev->driver && drv->resume)
622 + ret = drv->resume(to_amba_device(dev));
627 * Primecells are part of the Advanced Microcontroller Bus Architecture,
628 * so we call the bus "amba".
630 -struct bus_type amba_bustype = {
632 - .match = amba_match,
633 +static struct bus_type amba_bustype = {
635 + .match = amba_match,
636 + .suspend = amba_suspend,
637 + .resume = amba_resume,
640 static int __init amba_init(void)
642 drv->shutdown(to_amba_device(dev));
645 -static int amba_suspend(struct device *dev, u32 state, u32 level)
647 - struct amba_driver *drv = to_amba_driver(dev->driver);
648 - return drv->suspend(to_amba_device(dev), state, level);
651 -static int amba_resume(struct device *dev, u32 level)
653 - struct amba_driver *drv = to_amba_driver(dev->driver);
654 - return drv->resume(to_amba_device(dev), level);
658 * amba_driver_register - register an AMBA device driver
659 * @drv: amba device driver structure
667 return driver_register(&drv->drv);
669 diff -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;
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)
684 + dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
685 if (!dev->saved_state)
688 @@ -804,36 +807,31 @@
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);
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);
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);
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);
732 - if (level == SUSPEND_POWER_DOWN && state == 4) {
733 - unsigned int val = sa1111_readl(sachip->base + SA1111_SKCR);
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);
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);
744 spin_unlock_irqrestore(&sachip->lock, flags);
747 unsigned long flags, id;
750 + if (level != RESUME_ENABLE)
753 save = (struct sa1111_save_data *)dev->saved_state;
756 @@ -878,39 +879,32 @@
758 * First of all, wake up the chip.
760 - if (level == RESUME_POWER_ON) {
761 - sa1111_wake(sachip);
763 - sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0);
764 - sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1);
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);
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);
786 + sa1111_wake(sachip);
787 + sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0);
788 + sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1);
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);
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);
808 spin_unlock_irqrestore(&sachip->lock, flags);
810 - if (level == RESUME_ENABLE) {
811 - dev->saved_state = NULL;
814 + dev->saved_state = NULL;
819 @@ -1135,9 +1129,55 @@
820 return dev->devid == drv->devid;
823 +static int sa1111_bus_suspend(struct device *dev, u32 state)
825 + struct sa1111_dev *sadev = SA1111_DEV(dev);
826 + struct sa1111_driver *drv = SA1111_DRV(dev->driver);
829 + if (drv && drv->suspend)
830 + ret = drv->suspend(sadev, state);
834 +static int sa1111_bus_resume(struct device *dev)
836 + struct sa1111_dev *sadev = SA1111_DEV(dev);
837 + struct sa1111_driver *drv = SA1111_DRV(dev->driver);
840 + if (drv && drv->resume)
841 + ret = drv->resume(sadev);
845 +static int sa1111_bus_probe(struct device *dev)
847 + struct sa1111_dev *sadev = SA1111_DEV(dev);
848 + struct sa1111_driver *drv = SA1111_DRV(dev->driver);
852 + ret = drv->probe(sadev);
856 +static int sa1111_bus_remove(struct device *dev)
858 + struct sa1111_dev *sadev = SA1111_DEV(dev);
859 + struct sa1111_driver *drv = SA1111_DRV(dev->driver);
863 + ret = drv->remove(sadev);
867 struct bus_type sa1111_bus_type = {
869 - .match = sa1111_match,
870 + .name = "sa1111-rab",
871 + .match = sa1111_match,
872 + .suspend = sa1111_bus_suspend,
873 + .resume = sa1111_bus_resume,
876 static int sa1111_rab_bus_init(void)
877 @@ -1147,6 +1187,19 @@
879 postcore_initcall(sa1111_rab_bus_init);
881 +int sa1111_driver_register(struct sa1111_driver *driver)
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);
889 +void sa1111_driver_unregister(struct sa1111_driver *driver)
891 + driver_unregister(&driver->drv);
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);
903 diff -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
907 # CONFIG_BSD_PROCESS_ACCT is not set
909 CONFIG_LOG_BUF_SHIFT=14
910 +# CONFIG_EMBEDDED is not set
915 +CONFIG_IOSCHED_DEADLINE=y
918 # Loadable module support
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
928 # CONFIG_ARCH_SHARK is not set
931 -# Archimedes/A5000 Implementations
935 -# Archimedes/A5000 Implementations (select only ONE)
939 # CLPS711X/EP721X Implementations
943 # IOP3xx Implementation Options
945 CONFIG_ARCH_IQ80310=y
946 +# CONFIG_ARCH_IQ80321 is not set
948 +# CONFIG_ARCH_IOP321 is not set
951 # IOP3xx Chipset Features
953 # CONFIG_IOP3XX_PMON is not set
956 +# ADIFCC Implementation Options
964 # Intel PXA250/210 Implementations
976 # CONFIG_HOTPLUG is not set
979 +# MMC/SD Card support
981 +# CONFIG_MMC is not set
984 # At least one math emulation must be selected
987 +# CONFIG_FPE_NWFPE_XP is not set
988 # CONFIG_FPE_FASTFPE is not set
990 # CONFIG_KCORE_AOUT is not set
993 # CONFIG_FTL is not set
994 # CONFIG_NFTL is not set
995 +# CONFIG_INFTL is not set
998 # RAM/ROM/Flash chip drivers
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 @@
1009 # Mapping drivers for chip access
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
1021 # Self-contained MTD device drivers
1024 # Disk-On-Chip Device Drivers
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
1032 # NAND Flash Device Drivers
1034 # CONFIG_NETLINK_DEV is not set
1036 # CONFIG_NETFILTER_DEBUG is not set
1037 -# CONFIG_FILTER is not set
1039 # CONFIG_NET_KEY is not set
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
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
1056 +# IP: Virtual Server Configuration
1058 +# CONFIG_IP_VS is not set
1059 # CONFIG_IPV6 is not set
1060 +# CONFIG_XFRM_USER is not set
1063 # SCTP Configuration (EXPERIMENTAL)
1066 CONFIG_NET_ETHERNET=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
1078 +# Ethernet (10000 Mbit)
1080 +# CONFIG_IXGB is not set
1081 # CONFIG_FDDI is not set
1082 # CONFIG_HIPPI is not set
1083 # CONFIG_PPP is not set
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
1091 # IDE chipset support/bugfixes
1093 # CONFIG_BLK_DEV_IDEPCI is not set
1097 +# SCSI device support
1099 # CONFIG_SCSI is not set
1103 # I2C Hardware Sensors Chip support
1105 +# CONFIG_I2C_SENSOR is not set
1108 # L3 serial bus support
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
1118 @@ -551,18 +580,29 @@
1120 # Supported Frontend Modules
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
1136 -# Supported DVB Adapters
1137 +# Supported SAA7146 based PCI Adapters
1139 # CONFIG_DVB_AV7110 is not set
1140 +# CONFIG_DVB_BUDGET is not set
1143 +# Supported FlexCopII (B2C2) Adapters
1145 +# CONFIG_DVB_B2C2_SKYSTAR is not set
1146 +# CONFIG_VIDEO_BTCX is not set
1152 # CONFIG_DEVFS_FS is not set
1154 +# CONFIG_DEVPTS_FS_XATTR is not set
1158 @@ -631,13 +672,13 @@
1161 # CONFIG_EXPORTFS is not set
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
1170 -# CONFIG_SUNRPC_GSS is not set
1171 # CONFIG_AFS_FS is not set
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
1186 -# Console display driver support
1188 -# CONFIG_VGA_CONSOLE is not set
1189 -# CONFIG_MDA_CONSOLE is not set
1190 -CONFIG_DUMMY_CONSOLE=y
1195 # CONFIG_SOUND is not set
1199 # CONFIG_USB is not set
1200 +# CONFIG_USB_GADGET is not set
1205 # CONFIG_DEBUG_WAITQ is not set
1206 CONFIG_DEBUG_BUGVERBOSE=y
1207 CONFIG_DEBUG_ERRORS=y
1212 diff -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
1217 # Code maturity level options
1219 -# CONFIG_EXPERIMENTAL is not set
1220 +CONFIG_EXPERIMENTAL=y
1225 # CONFIG_BSD_PROCESS_ACCT is not set
1227 CONFIG_LOG_BUF_SHIFT=14
1228 +# CONFIG_EMBEDDED is not set
1232 +CONFIG_IOSCHED_AS=y
1233 +CONFIG_IOSCHED_DEADLINE=y
1236 # Loadable module support
1239 # CONFIG_MODULE_UNLOAD is not set
1240 CONFIG_OBSOLETE_MODPARM=y
1241 +# CONFIG_MODVERSIONS is not set
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
1254 # CONFIG_ARCH_SHARK is not set
1257 -# Archimedes/A5000 Implementations
1261 -# Archimedes/A5000 Implementations (select only ONE)
1265 # CLPS711X/EP721X Implementations
1270 # IOP3xx Chipset Features
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
1278 +# ADIFCC Implementation Options
1286 # Intel PXA250/210 Implementations
1289 # Processor Features
1291 +# CONFIG_ARM_THUMB is not set
1295 @@ -112,17 +123,25 @@
1296 # CONFIG_HOTPLUG is not set
1299 +# MMC/SD Card support
1301 +# CONFIG_MMC is not set
1304 # At least one math emulation must be selected
1307 +# CONFIG_FPE_NWFPE_XP is not set
1308 +# CONFIG_FPE_FASTFPE is not set
1310 # CONFIG_KCORE_AOUT is not set
1311 CONFIG_BINFMT_AOUT=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
1324 # CONFIG_FTL is not set
1325 # CONFIG_NFTL is not set
1326 +# CONFIG_INFTL is not set
1329 # RAM/ROM/Flash chip drivers
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 @@
1340 # Mapping drivers for chip access
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
1352 # Self-contained MTD device drivers
1355 # Disk-On-Chip Device Drivers
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
1363 # NAND Flash Device Drivers
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
1373 # CONFIG_NETLINK_DEV is not set
1375 # CONFIG_NETFILTER_DEBUG is not set
1376 -# CONFIG_FILTER is not set
1378 # CONFIG_NET_KEY is not set
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
1393 # IP: Netfilter Configuration
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
1403 +# IP: Virtual Server Configuration
1405 +# CONFIG_IP_VS is not set
1406 +# CONFIG_IPV6 is not set
1407 +# CONFIG_XFRM_USER is not set
1410 +# SCTP Configuration (EXPERIMENTAL)
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
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
1436 # Ethernet (10 or 100Mbit)
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
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
1451 # CONFIG_EEPRO100_PIO is not set
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 @@
1462 # CONFIG_ACENIC is not set
1463 # CONFIG_DL2K is not set
1464 -# CONFIG_E1000 is not set
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
1475 +# Ethernet (10000 Mbit)
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
1485 # Token Ring devices (depends on LLC=y)
1487 +# CONFIG_RCPCI is not set
1488 +# CONFIG_SHAPER is not set
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
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
1533 +# SCSI device support
1535 # CONFIG_SCSI is not set
1538 +# IEEE 1394 (FireWire) support (EXPERIMENTAL)
1540 +# CONFIG_IEEE1394 is not set
1543 # I2O device support
1545 # CONFIG_I2O is not set
1546 @@ -450,11 +515,16 @@
1550 +CONFIG_SERIAL_8250=y
1551 +CONFIG_SERIAL_8250_CONSOLE=y
1552 +# CONFIG_SERIAL_8250_EXTENDED is not set
1555 # Non-8250 serial port support
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
1565 # I2C Hardware Sensors Chip support
1567 +# CONFIG_I2C_SENSOR is not set
1570 # L3 serial bus support
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
1582 # Digital Video Broadcasting Devices
1584 # CONFIG_DVB is not set
1585 +# CONFIG_VIDEO_BTCX is not set
1589 @@ -567,16 +642,25 @@
1590 # Pseudo filesystems
1593 +# CONFIG_DEVFS_FS is not set
1595 +# CONFIG_DEVPTS_FS_XATTR is not set
1600 # Miscellaneous filesystems
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
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 @@
1618 # CONFIG_NFS_V3 is not set
1619 +# CONFIG_NFS_V4 is not set
1620 # CONFIG_NFSD is not set
1623 # CONFIG_EXPORTFS is not set
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
1631 +# CONFIG_INTERMEZZO_FS is not set
1632 +# CONFIG_AFS_FS is not set
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
1648 -# Console display driver support
1650 -# CONFIG_VGA_CONSOLE is not set
1651 -# CONFIG_MDA_CONSOLE is not set
1652 -CONFIG_DUMMY_CONSOLE=y
1657 # CONFIG_SOUND is not set
1661 # CONFIG_USB is not set
1662 +# CONFIG_USB_GADGET is not set
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
1676 # CONFIG_DEBUG_WAITQ is not set
1677 CONFIG_DEBUG_BUGVERBOSE=y
1678 CONFIG_DEBUG_ERRORS=y
1679 -# CONFIG_KALLSYMS is not set
1683 diff -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
1687 #include <linux/init.h>
1688 #include <linux/completion.h>
1690 +#include <asm/apm.h> /* apm_power_info */
1691 #include <asm/system.h>
1696 static const char driver_version[] = "1.13"; /* no spaces */
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.
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;
1713 * Compatibility cruft until the IPAQ people move over to the new
1714 @@ -388,18 +378,18 @@
1717 static struct file_operations apm_bios_fops = {
1718 - owner: THIS_MODULE,
1723 - release: apm_release,
1724 + .owner = THIS_MODULE,
1727 + .ioctl = apm_ioctl,
1729 + .release = apm_release,
1732 static struct miscdevice apm_device = {
1733 - minor: APM_MINOR_DEV,
1735 - fops: &apm_bios_fops
1736 + .minor = APM_MINOR_DEV,
1737 + .name = "apm_bios",
1738 + .fops = &apm_bios_fops
1742 diff -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
1746 void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
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);
1754 @@ -362,6 +362,19 @@
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);
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);
1774 diff -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
1778 static ssize_t ecard_show_vendor(struct device *dev, char *buf)
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);
1785 static DEVICE_ATTR(vendor, S_IRUGO, ecard_show_vendor, NULL);
1787 static ssize_t ecard_show_device(struct device *dev, char *buf)
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);
1794 static DEVICE_ATTR(device, S_IRUGO, ecard_show_device, NULL);
1795 diff -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
1801 .macro set_cpsr_c, reg, mode
1803 - /* broken binutils */
1811 .macro disable_irq, temp
1812 diff -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
1820 - * Tell LDM devices we're going to suspend.
1822 - ret = device_suspend(4, SUSPEND_NOTIFY);
1824 - goto resume_legacy;
1827 - * Disable, devices, and save state.
1829 - device_suspend(4, SUSPEND_DISABLE);
1830 - device_suspend(4, SUSPEND_SAVE_STATE);
1833 - * Tell devices that they're going to be powered off.
1835 - device_suspend(4, SUSPEND_POWER_DOWN);
1836 + device_suspend(3);
1838 local_irq_disable();
1839 leds_event(led_stop);
1841 leds_event(led_start);
1845 - * Tell devices that they now have power.
1847 - device_resume(RESUME_POWER_ON);
1850 - * Resume LDM devices.
1852 - device_resume(RESUME_RESTORE_STATE);
1853 - device_resume(RESUME_ENABLE);
1858 - * Resume "legacy" devices.
1860 pm_send_all(PM_RESUME, (void *)0);
1863 diff -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
1867 -#include <linux/config.h>
1869 -#ifdef CONFIG_CPU_26
1871 -#ifdef CONFIG_ROM_KERNEL
1873 -#include "vmlinux-armo-rom.lds.in"
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>
1880 +#include <asm-generic/vmlinux.lds.h>
1885 +jiffies = jiffies_64;
1888 -#include "vmlinux-armo.lds.in"
1894 -#ifdef CONFIG_CPU_32
1896 -#include "vmlinux-armv.lds.in"
1898 +jiffies = jiffies_64 + 4;
1903 + .init : { /* Init code and data */
1909 + __proc_info_begin = .;
1911 + __proc_info_end = .;
1912 + __arch_info_begin = .;
1914 + __arch_info_end = .;
1915 + __tagtable_begin = .;
1917 + __tagtable_end = .;
1920 + __setup_start = .;
1923 + __early_begin = .;
1926 + __start___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 = .;
1945 + __initramfs_start = .;
1946 + usr/built-in.o(.init.ramfs)
1947 + __initramfs_end = .;
1952 + /DISCARD/ : { /* Exit code and data */
1958 + .text : { /* Real text segment */
1959 + _text = .; /* Text and read-only data */
1967 + *(.got) /* Global offset table */
1969 + _etext = .; /* End of text section */
1973 + __ex_table : { /* Exception table */
1974 + __start___ex_table = .;
1976 + __stop___ex_table = .;
1985 + * first, the init task union, aligned
1986 + * to an 8192 byte boundary.
1991 + * then the cacheline aligned data
1994 + *(.data.cacheline_aligned)
1997 + * and the usual data section
2006 + __bss_start = .; /* BSS */
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) }
2020 diff -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
2024 return IRQ_NETWINDER_ETHER10;
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",
2034 diff -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
2041 -static void iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2043 +iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2048 asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (tisr));
2052 + return IRQ_HANDLED;
2055 extern unsigned long (*gettimeoffset)(void);
2056 diff -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
2063 -static void iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2065 +iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
2067 volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
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.
2089 + return IRQ_HANDLED;
2092 extern unsigned long (*gettimeoffset)(void);
2094 volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
2096 gettimeoffset = iq80310_gettimeoffset;
2098 setup_irq(IRQ_IQ80310_TIMER, &timer_irq);
2101 iq80310_write_timer(LATCH);
2103 diff -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
2107 #include <asm/hardware.h>
2108 #include <asm/leds.h>
2109 #include <asm/system.h>
2110 +#include <asm/arch/simpad.h>
2114 diff -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
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 */
2124 leds_event(led_start);
2126 diff -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
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);
2134 diff -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
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>
2143 -#include <asm-generic/vmlinux.lds.h>
2147 -jiffies = jiffies_64;
2151 - .init : { /* Init code and data */
2157 - __proc_info_begin = .;
2159 - __proc_info_end = .;
2160 - __arch_info_begin = .;
2162 - __arch_info_end = .;
2163 - __tagtable_begin = .;
2165 - __tagtable_end = .;
2168 - __setup_start = .;
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 = .;
2192 - /DISCARD/ : { /* Exit code and data */
2198 - .text : { /* Real text segment */
2199 - _text = .; /* Text and read-only data */
2207 - *(.got) /* Global offset table */
2209 - _etext = .; /* End of text section */
2213 - __ex_table : { /* Exception table */
2214 - __start___ex_table = .;
2216 - __stop___ex_table = .;
2223 - * The cacheline aligned data
2226 - *(.data.cacheline_aligned)
2229 - * and the usual data section
2238 - __bss_start = .; /* BSS */
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) }
2252 diff -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
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>
2261 -#include <asm-generic/vmlinux.lds.h>
2266 -jiffies = jiffies_64;
2268 -jiffies = jiffies_64 + 4;
2273 - .init : { /* Init code and data */
2279 - __proc_info_begin = .;
2281 - __proc_info_end = .;
2282 - __arch_info_begin = .;
2284 - __arch_info_end = .;
2285 - __tagtable_begin = .;
2287 - __tagtable_end = .;
2290 - __setup_start = .;
2293 - __early_begin = .;
2296 - __start___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 = .;
2315 - __initramfs_start = .;
2316 - usr/built-in.o(.init.ramfs)
2317 - __initramfs_end = .;
2322 - /DISCARD/ : { /* Exit code and data */
2328 - .text : { /* Real text segment */
2329 - _text = .; /* Text and read-only data */
2337 - *(.got) /* Global offset table */
2339 - _etext = .; /* End of text section */
2343 - __ex_table : { /* Exception table */
2344 - __start___ex_table = .;
2346 - __stop___ex_table = .;
2355 - * first, the init task union, aligned
2356 - * to an 8192 byte boundary.
2361 - * then the cacheline aligned data
2364 - *(.data.cacheline_aligned)
2367 - * and the usual data section
2376 - __bss_start = .; /* BSS */
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) }
2390 diff -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.
2398 - prompt "Kernel core (/proc/kcore) format"
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
2408 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
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.
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.
2425 - Not necessary unless you're using a very out-of-date binutils
2426 - version. You probably want KCORE_ELF.
2430 source "fs/Kconfig.binfmt"
2433 diff -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 @@
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
2454 static int __init parse_tag_videotext(const struct tag *tag)
2455 diff -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
2459 static int eeprom_open(struct inode * inode, struct file * file)
2462 - if(minor(inode->i_rdev) != EEPROM_MINOR_NR)
2463 + if(iminor(inode) != EEPROM_MINOR_NR)
2465 - if(major(inode->i_rdev) != EEPROM_MAJOR_NR)
2466 + if(imajor(inode) != EEPROM_MAJOR_NR)
2469 if( eeprom.size > 0 )
2470 diff -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
2474 gpio_open(struct inode *inode, struct file *filp)
2476 struct gpio_private *priv;
2477 - int p = minor(inode->i_rdev);
2478 + int p = iminor(inode);
2480 if (p > GPIO_MINOR_LAST)
2482 diff -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
2486 int pcf8563_release(struct inode *, struct file *);
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,
2500 diff -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 @@
2505 menu "Executable file formats"
2514 source "fs/Kconfig.binfmt"
2517 diff -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
2523 static const struct console gdb_console = {
2525 - write: gdb_console_output,
2527 - setup: gdb_console_setup,
2528 - flags: CON_PRINTBUFFER,
2530 + .name = "gdb_con",
2531 + .write = gdb_console_output,
2533 + .setup = gdb_console_setup,
2534 + .flags = CON_PRINTBUFFER,
2542 struct seq_operations cpuinfo_op = {
2546 - show: show_cpuinfo,
2550 + .show = show_cpuinfo,
2552 diff -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
2556 #include <asm/regs306x.h>
2557 #include <asm/errno.h>
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
2569 * This structure has only 4 elements for speed reasons
2573 extern unsigned long *interrupt_redirect_table;
2575 +#define CPU_VECTOR ((unsigned long *)0x000000)
2576 +#define ADDR_MASK (0xffffff)
2578 static inline unsigned long *get_vector_address(void)
2580 - unsigned long *rom_vector = (unsigned long *)0x000000;
2581 + unsigned long *rom_vector = CPU_VECTOR;
2582 unsigned long base,tmp;
2585 - base = rom_vector[EXT_IRQ0];
2586 + base = rom_vector[EXT_IRQ0] & ADDR_MASK;
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))
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;
2608 -static void __init enable_kmalloc(void)
2609 +static int __init enable_kmalloc(void)
2614 -__initcall(enable_kmalloc);
2615 +core_initcall(enable_kmalloc);
2616 diff -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
2620 #include <asm/regs267x.h>
2621 #include <asm/errno.h>
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
2641 * This structure has only 4 elements for speed reasons
2645 extern unsigned long *interrupt_redirect_table;
2647 +#define CPU_VECTOR ((unsigned long *)0x000000)
2648 +#define ADDR_MASK (0xffffff)
2650 static inline unsigned long *get_vector_address(void)
2652 - volatile unsigned long *rom_vector = (unsigned long *)0x000000;
2653 + volatile unsigned long *rom_vector = CPU_VECTOR;
2654 unsigned long base,tmp;
2657 - base = rom_vector[EXT_IRQ0];
2658 + base = rom_vector[EXT_IRQ0] & ADDR_MASK;
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))
2671 -__initcall(enable_kmalloc);
2672 +core_initcall(enable_kmalloc);
2673 diff -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 @@
2681 + bool "HPET Timer Support"
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.
2689 + Choose N to continue using the legacy 8254 timer.
2692 bool "Symmetric multi-processing support"
2694 @@ -1155,40 +1166,6 @@
2697 menu "Executable file formats"
2700 - prompt "Kernel core (/proc/kcore) format"
2701 - depends on PROC_FS
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
2711 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
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.
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.
2728 - Not necessary unless you're using a very out-of-date binutils
2729 - version. You probably want KCORE_ELF.
2733 source "fs/Kconfig.binfmt"
2735 diff -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
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
2744 EXTRA_AFLAGS := -traditional
2746 diff -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
2750 #define PREFIX "ACPI: "
2752 extern int acpi_disabled;
2753 +extern int acpi_irq;
2757 @@ -269,6 +270,27 @@
2761 +#ifdef CONFIG_HPET_TIMER
2762 +extern unsigned long hpet_address;
2764 +static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
2766 + struct acpi_table_hpet *hpet_tbl;
2768 + hpet_tbl = __va(phys);
2770 + if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
2771 + printk(KERN_WARNING PREFIX "HPET timers must be located in "
2776 + hpet_address = hpet_tbl->addr.addrl;
2777 + printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", hpet_tbl->id,
2783 unsigned long __init
2784 acpi_find_rsdp (void)
2786 * If MPS is present, it will handle them,
2787 * otherwise the system will stay in PIC mode
2789 - if (acpi_disabled) {
2790 + if (acpi_disabled || !acpi_irq) {
2795 smp_found_config = 1;
2796 clustered_apic_check();
2799 +#ifdef CONFIG_HPET_TIMER
2800 + acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
2804 diff -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
2808 #include <asm/pgalloc.h>
2809 #include <asm/desc.h>
2810 #include <asm/arch_hooks.h>
2811 +#include <asm/hpet.h>
2813 #include <mach_apic.h>
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)
2823 unsigned int curr_count, prev_count=~0;
2825 @@ -801,6 +803,12 @@
2829 + * Default initialization for 8254 timers. If we use other timers like HPET,
2830 + * we override this later
2832 +void (*wait_timer_tick)(void) = wait_8254_wraparound;
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
2840 * Wait for IRQ0's slice:
2842 - wait_8254_wraparound();
2843 + wait_timer_tick();
2845 __setup_APIC_LVTT(clocks);
2848 * (the current tick might have been already half done)
2851 - wait_8254_wraparound();
2852 + wait_timer_tick();
2855 * We wrapped around just now. Let's start:
2857 * Let's wait LOOPS wraprounds:
2859 for (i = 0; i < LOOPS; i++)
2860 - wait_8254_wraparound();
2861 + wait_timer_tick();
2863 tt2 = apic_read(APIC_TMCCT);
2865 diff -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
2870 #define FILE_FCOUNT(f) (((struct seq_file *)((f)->private_data))->private)
2872 +static char *mtrr_strings[MTRR_NUM_TYPES] =
2874 + "uncachable", /* 0 */
2875 + "write-combining", /* 1 */
2878 + "write-through", /* 4 */
2879 + "write-protect", /* 5 */
2880 + "write-back", /* 6 */
2883 +char *mtrr_attrib_to_str(int x)
2885 + return (x <= 6) ? mtrr_strings[x] : "?";
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 @@
2893 # endif /* CONFIG_PROC_FS */
2895 -char * attrib_to_str(int x)
2897 - return (x <= 6) ? mtrr_strings[x] : "?";
2900 static int mtrr_seq_show(struct seq_file *seq, void *offset)
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]);
2912 diff -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;
2919 -static char * attrib_to_str(int x)
2921 - return (x <= 6) ? mtrr_strings[x] : "?";
2924 static void init_table(void)
2928 if (type == MTRR_TYPE_UNCACHABLE)
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));
2938 @@ -703,16 +698,4 @@
2942 -char *mtrr_strings[MTRR_NUM_TYPES] =
2944 - "uncachable", /* 0 */
2945 - "write-combining", /* 1 */
2948 - "write-through", /* 4 */
2949 - "write-protect", /* 5 */
2950 - "write-back", /* 6 */
2953 subsys_initcall(mtrr_init);
2955 diff -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
2960 void finalize_mtrr_state(void);
2961 void mtrr_state_warn(void);
2962 +char *mtrr_attrib_to_str(int x);
2964 extern char * mtrr_if_name[];
2965 diff -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
2972 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
2973 + int cpu = iminor(file->f_dentry->d_inode);
2976 return -EINVAL; /* Invalid chunk size */
2979 static int cpuid_open(struct inode *inode, struct file *file)
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];
2985 if (!cpu_online(cpu))
2986 diff -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
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);
2998 diff -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
3005 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
3006 + int cpu = iminor(file->f_dentry->d_inode);
3014 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
3015 + int cpu = iminor(file->f_dentry->d_inode);
3021 static int msr_open(struct inode *inode, struct file *file)
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];
3027 if (!cpu_online(cpu))
3028 diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
3029 --- a/arch/i386/kernel/process.c Wed Aug 20 10:43:52 2003
3030 +++ b/arch/i386/kernel/process.c Tue Sep 2 00:37:21 2003
3033 /* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
3035 - unlazy_fpu(prev_p);
3036 + __unlazy_fpu(prev_p);
3039 * Reload esp0, LDT and the page table pointer:
3040 diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
3041 --- a/arch/i386/kernel/setup.c Thu Aug 21 11:08:59 2003
3042 +++ b/arch/i386/kernel/setup.c Sun Aug 31 16:14:11 2003
3044 EXPORT_SYMBOL(acpi_disabled);
3046 #ifdef CONFIG_ACPI_BOOT
3047 + int acpi_irq __initdata = 1; /* enable IRQ */
3048 int acpi_ht __initdata = 1; /* enable HT */
3051 @@ -542,6 +543,11 @@
3052 else if (!memcmp(from, "acpi=ht", 7)) {
3054 if (!acpi_force) acpi_disabled = 1;
3057 + /* "pci=noacpi" disables ACPI interrupt routing */
3058 + else if (!memcmp(from, "pci=noacpi", 10)) {
3062 #ifdef CONFIG_X86_LOCAL_APIC
3063 diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
3064 --- a/arch/i386/kernel/time.c Thu Jul 10 22:22:57 2003
3065 +++ b/arch/i386/kernel/time.c Fri Aug 29 03:51:17 2003
3067 #include <linux/timex.h>
3068 #include <linux/config.h>
3070 +#include <asm/hpet.h>
3072 #include <asm/arch_hooks.h>
3074 #include "io_ports.h"
3075 @@ -291,8 +293,38 @@
3077 device_initcall(time_init_device);
3079 +#ifdef CONFIG_HPET_TIMER
3080 +extern void (*late_time_init)(void);
3081 +/* Duplicate of time_init() below, with hpet_enable part added */
3082 +void __init hpet_time_init(void)
3084 + xtime.tv_sec = get_cmos_time();
3085 + wall_to_monotonic.tv_sec = -xtime.tv_sec;
3086 + xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
3087 + wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
3089 + if (hpet_enable() >= 0) {
3090 + printk("Using HPET for base-timer\n");
3093 + cur_timer = select_timer();
3098 void __init time_init(void)
3100 +#ifdef CONFIG_HPET_TIMER
3101 + if (is_hpet_capable()) {
3103 + * HPET initialization needs to do memory-mapped io. So, let
3104 + * us do a late initialization after mem_init().
3106 + late_time_init = hpet_time_init;
3111 xtime.tv_sec = get_cmos_time();
3112 wall_to_monotonic.tv_sec = -xtime.tv_sec;
3113 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
3114 diff -Nru a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c
3115 --- /dev/null Wed Dec 31 16:00:00 1969
3116 +++ b/arch/i386/kernel/time_hpet.c Sun Aug 31 16:15:40 2003
3119 + * linux/arch/i386/kernel/time_hpet.c
3120 + * This code largely copied from arch/x86_64/kernel/time.c
3121 + * See that file for credits.
3123 + * 2003-06-30 Venkatesh Pallipadi - Additional changes for HPET support
3126 +#include <linux/errno.h>
3127 +#include <linux/kernel.h>
3128 +#include <linux/param.h>
3129 +#include <linux/string.h>
3130 +#include <linux/init.h>
3131 +#include <linux/smp.h>
3133 +#include <asm/timer.h>
3134 +#include <asm/fixmap.h>
3135 +#include <asm/apic.h>
3137 +#include <linux/timex.h>
3138 +#include <linux/config.h>
3140 +#include <asm/hpet.h>
3142 +unsigned long hpet_period; /* fsecs / HPET clock */
3143 +unsigned long hpet_tick; /* hpet clks count per tick */
3144 +unsigned long hpet_address; /* hpet memory map physical address */
3146 +static int use_hpet; /* can be used for runtime check of hpet */
3147 +static int boot_hpet_disable; /* boottime override for HPET timer */
3148 +static unsigned long hpet_virt_address; /* hpet kernel virtual address */
3150 +#define FSEC_TO_USEC (1000000000UL)
3152 +int hpet_readl(unsigned long a)
3154 + return readl(hpet_virt_address + a);
3157 +void hpet_writel(unsigned long d, unsigned long a)
3159 + writel(d, hpet_virt_address + a);
3162 +#ifdef CONFIG_X86_LOCAL_APIC
3164 + * HPET counters dont wrap around on every tick. They just change the
3165 + * comparator value and continue. Next tick can be caught by checking
3166 + * for a change in the comparator value. Used in apic.c.
3168 +void __init wait_hpet_tick(void)
3170 + unsigned int start_cmp_val, end_cmp_val;
3172 + start_cmp_val = hpet_readl(HPET_T0_CMP);
3174 + end_cmp_val = hpet_readl(HPET_T0_CMP);
3175 + } while (start_cmp_val == end_cmp_val);
3180 + * Check whether HPET was found by ACPI boot parse. If yes setup HPET
3181 + * counter 0 for kernel base timer.
3183 +int __init hpet_enable(void)
3185 + unsigned int cfg, id;
3186 + unsigned long tick_fsec_low, tick_fsec_high; /* tick in femto sec */
3187 + unsigned long hpet_tick_rem;
3189 + if (boot_hpet_disable)
3192 + if (!hpet_address) {
3195 + hpet_virt_address = (unsigned long) ioremap_nocache(hpet_address,
3198 + * Read the period, compute tick and quotient.
3200 + id = hpet_readl(HPET_ID);
3203 + * We are checking for value '1' or more in number field.
3204 + * So, we are OK with HPET_EMULATE_RTC part too, where we need
3205 + * to have atleast 2 timers.
3207 + if (!(id & HPET_ID_NUMBER) ||
3208 + !(id & HPET_ID_LEGSUP))
3211 + if (((id & HPET_ID_VENDOR) >> HPET_ID_VENDOR_SHIFT) !=
3212 + HPET_ID_VENDOR_8086)
3215 + hpet_period = hpet_readl(HPET_PERIOD);
3216 + if ((hpet_period < HPET_MIN_PERIOD) || (hpet_period > HPET_MAX_PERIOD))
3221 + * First changing tick into fsec
3222 + * Then 64 bit div to find number of hpet clk per tick
3224 + ASM_MUL64_REG(tick_fsec_low, tick_fsec_high,
3225 + KERNEL_TICK_USEC, FSEC_TO_USEC);
3226 + ASM_DIV64_REG(hpet_tick, hpet_tick_rem,
3227 + hpet_period, tick_fsec_low, tick_fsec_high);
3229 + if (hpet_tick_rem > (hpet_period >> 1))
3230 + hpet_tick++; /* rounding the result */
3233 + * Stop the timers and reset the main counter.
3235 + cfg = hpet_readl(HPET_CFG);
3236 + cfg &= ~HPET_CFG_ENABLE;
3237 + hpet_writel(cfg, HPET_CFG);
3238 + hpet_writel(0, HPET_COUNTER);
3239 + hpet_writel(0, HPET_COUNTER + 4);
3242 + * Set up timer 0, as periodic with first interrupt to happen at
3243 + * hpet_tick, and period also hpet_tick.
3245 + cfg = hpet_readl(HPET_T0_CFG);
3246 + cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
3247 + HPET_TN_SETVAL | HPET_TN_32BIT;
3248 + hpet_writel(cfg, HPET_T0_CFG);
3249 + hpet_writel(hpet_tick, HPET_T0_CMP);
3254 + cfg = hpet_readl(HPET_CFG);
3255 + cfg |= HPET_CFG_ENABLE | HPET_CFG_LEGACY;
3256 + hpet_writel(cfg, HPET_CFG);
3259 +#ifdef CONFIG_X86_LOCAL_APIC
3260 + wait_timer_tick = wait_hpet_tick;
3265 +int is_hpet_enabled(void)
3270 +int is_hpet_capable(void)
3272 + if (!boot_hpet_disable && hpet_address)
3277 +static int __init hpet_setup(char* str)
3280 + if (!strncmp("disable", str, 7))
3281 + boot_hpet_disable = 1;
3286 +__setup("hpet=", hpet_setup);
3288 +#ifdef CONFIG_HPET_EMULATE_RTC
3289 +/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET
3290 + * is enabled, we support RTC interrupt functionality in software.
3291 + * RTC has 3 kinds of interrupts:
3292 + * 1) Update Interrupt - generate an interrupt, every sec, when RTC clock
3294 + * 2) Alarm Interrupt - generate an interrupt at a specific time of day
3295 + * 3) Periodic Interrupt - generate periodic interrupt, with frequencies
3296 + * 2Hz-8192Hz (2Hz-64Hz for non-root user) (all freqs in powers of 2)
3297 + * (1) and (2) above are implemented using polling at a frequency of
3298 + * 64 Hz. The exact frequency is a tradeoff between accuracy and interrupt
3299 + * overhead. (DEFAULT_RTC_INT_FREQ)
3300 + * For (3), we use interrupts at 64Hz or user specified periodic
3301 + * frequency, whichever is higher.
3303 +#include <linux/mc146818rtc.h>
3304 +#include <linux/rtc.h>
3306 +extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
3307 +extern void get_rtc_time(struct rtc_time *rtc_tm);
3309 +#define DEFAULT_RTC_INT_FREQ 64
3310 +#define RTC_NUM_INTS 1
3312 +static unsigned long UIE_on;
3313 +static unsigned long prev_update_sec;
3315 +static unsigned long AIE_on;
3316 +static struct rtc_time alarm_time;
3318 +static unsigned long PIE_on;
3319 +static unsigned long PIE_freq = DEFAULT_RTC_INT_FREQ;
3320 +static unsigned long PIE_count;
3322 +static unsigned long hpet_rtc_int_freq; /* RTC interrupt frequency */
3325 + * Timer 1 for RTC, we do not use periodic interrupt feature,
3326 + * even if HPET supports periodic interrupts on Timer 1.
3327 + * The reason being, to set up a periodic interrupt in HPET, we need to
3328 + * stop the main counter. And if we do that everytime someone diables/enables
3329 + * RTC, we will have adverse effect on main kernel timer running on Timer 0.
3330 + * So, for the time being, simulate the periodic interrupt in software.
3332 + * hpet_rtc_timer_init() is called for the first time and during subsequent
3333 + * interuppts reinit happens through hpet_rtc_timer_reinit().
3335 +int hpet_rtc_timer_init(void)
3337 + unsigned int cfg, cnt;
3338 + unsigned long flags;
3340 + if (!is_hpet_enabled())
3343 + * Set the counter 1 and enable the interrupts.
3345 + if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
3346 + hpet_rtc_int_freq = PIE_freq;
3348 + hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
3350 + local_irq_save(flags);
3351 + cnt = hpet_readl(HPET_COUNTER);
3352 + cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq);
3353 + hpet_writel(cnt, HPET_T1_CMP);
3354 + local_irq_restore(flags);
3356 + cfg = hpet_readl(HPET_T1_CFG);
3357 + cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT;
3358 + hpet_writel(cfg, HPET_T1_CFG);
3363 +static void hpet_rtc_timer_reinit(void)
3365 + unsigned int cfg, cnt;
3367 + if (!(PIE_on | AIE_on | UIE_on))
3370 + if (PIE_on && (PIE_freq > DEFAULT_RTC_INT_FREQ))
3371 + hpet_rtc_int_freq = PIE_freq;
3373 + hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
3375 + /* It is more accurate to use the comparator value than current count.*/
3376 + cnt = hpet_readl(HPET_T1_CMP);
3377 + cnt += hpet_tick*HZ/hpet_rtc_int_freq;
3378 + hpet_writel(cnt, HPET_T1_CMP);
3380 + cfg = hpet_readl(HPET_T1_CFG);
3381 + cfg |= HPET_TN_ENABLE | HPET_TN_SETVAL | HPET_TN_32BIT;
3382 + hpet_writel(cfg, HPET_T1_CFG);
3388 + * The functions below are called from rtc driver.
3389 + * Return 0 if HPET is not being used.
3390 + * Otherwise do the necessary changes and return 1.
3392 +int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
3394 + if (!is_hpet_enabled())
3397 + if (bit_mask & RTC_UIE)
3399 + if (bit_mask & RTC_PIE)
3401 + if (bit_mask & RTC_AIE)
3407 +int hpet_set_rtc_irq_bit(unsigned long bit_mask)
3409 + int timer_init_reqd = 0;
3411 + if (!is_hpet_enabled())
3414 + if (!(PIE_on | AIE_on | UIE_on))
3415 + timer_init_reqd = 1;
3417 + if (bit_mask & RTC_UIE) {
3420 + if (bit_mask & RTC_PIE) {
3424 + if (bit_mask & RTC_AIE) {
3428 + if (timer_init_reqd)
3429 + hpet_rtc_timer_init();
3434 +int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec)
3436 + if (!is_hpet_enabled())
3439 + alarm_time.tm_hour = hrs;
3440 + alarm_time.tm_min = min;
3441 + alarm_time.tm_sec = sec;
3446 +int hpet_set_periodic_freq(unsigned long freq)
3448 + if (!is_hpet_enabled())
3457 +int hpet_rtc_dropped_irq(void)
3459 + if (!is_hpet_enabled())
3465 +irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3467 + struct rtc_time curr_time;
3468 + unsigned long rtc_int_flag = 0;
3469 + int call_rtc_interrupt = 0;
3471 + hpet_rtc_timer_reinit();
3473 + if (UIE_on | AIE_on) {
3474 + get_rtc_time(&curr_time);
3477 + if (curr_time.tm_sec != prev_update_sec) {
3478 + /* Set update int info, call real rtc int routine */
3479 + call_rtc_interrupt = 1;
3480 + rtc_int_flag = RTC_UF;
3481 + prev_update_sec = curr_time.tm_sec;
3486 + if (PIE_count >= hpet_rtc_int_freq/PIE_freq) {
3487 + /* Set periodic int info, call real rtc int routine */
3488 + call_rtc_interrupt = 1;
3489 + rtc_int_flag |= RTC_PF;
3494 + if ((curr_time.tm_sec == alarm_time.tm_sec) &&
3495 + (curr_time.tm_min == alarm_time.tm_min) &&
3496 + (curr_time.tm_hour == alarm_time.tm_hour)) {
3497 + /* Set alarm int info, call real rtc int routine */
3498 + call_rtc_interrupt = 1;
3499 + rtc_int_flag |= RTC_AF;
3502 + if (call_rtc_interrupt) {
3503 + rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8));
3504 + rtc_interrupt(rtc_int_flag, dev_id, regs);
3506 + return IRQ_HANDLED;
3510 diff -Nru a/arch/i386/kernel/timers/Makefile b/arch/i386/kernel/timers/Makefile
3511 --- a/arch/i386/kernel/timers/Makefile Sun May 4 23:38:34 2003
3512 +++ b/arch/i386/kernel/timers/Makefile Sun Aug 31 16:14:50 2003
3514 obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o
3516 obj-$(CONFIG_X86_CYCLONE_TIMER) += timer_cyclone.o
3517 +obj-$(CONFIG_HPET_TIMER) += timer_hpet.o
3518 diff -Nru a/arch/i386/kernel/timers/timer.c b/arch/i386/kernel/timers/timer.c
3519 --- a/arch/i386/kernel/timers/timer.c Wed Jul 2 21:21:34 2003
3520 +++ b/arch/i386/kernel/timers/timer.c Sun Aug 31 16:15:21 2003
3522 #include <linux/string.h>
3523 #include <asm/timer.h>
3525 +#ifdef CONFIG_HPET_TIMER
3527 + * HPET memory read is slower than tsc reads, but is more dependable as it
3528 + * always runs at constant frequency and reduces complexity due to
3529 + * cpufreq. So, we prefer HPET timer to tsc based one. Also, we cannot use
3530 + * timer_pit when HPET is active. So, we default to timer_tsc.
3533 /* list of timers, ordered by preference, NULL terminated */
3534 static struct timer_opts* timers[] = {
3535 #ifdef CONFIG_X86_CYCLONE_TIMER
3538 +#ifdef CONFIG_HPET_TIMER
3543 diff -Nru a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c
3544 --- /dev/null Wed Dec 31 16:00:00 1969
3545 +++ b/arch/i386/kernel/timers/timer_hpet.c Sun Aug 31 16:15:29 2003
3548 + * This code largely moved from arch/i386/kernel/time.c.
3549 + * See comments there for proper credits.
3552 +#include <linux/spinlock.h>
3553 +#include <linux/init.h>
3554 +#include <linux/timex.h>
3555 +#include <linux/errno.h>
3556 +#include <linux/string.h>
3557 +#include <linux/jiffies.h>
3559 +#include <asm/timer.h>
3560 +#include <asm/io.h>
3561 +#include <asm/processor.h>
3563 +#include "io_ports.h"
3564 +#include "mach_timer.h"
3565 +#include <asm/hpet.h>
3567 +static unsigned long hpet_usec_quotient; /* convert hpet clks to usec */
3568 +static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */
3569 +static unsigned long hpet_last; /* hpet counter value at last tick*/
3570 +static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */
3571 +static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */
3572 +static unsigned long long monotonic_base;
3573 +static rwlock_t monotonic_lock = RW_LOCK_UNLOCKED;
3575 +/* convert from cycles(64bits) => nanoseconds (64bits)
3577 + * ns = cycles / (freq / ns_per_sec)
3578 + * ns = cycles * (ns_per_sec / freq)
3579 + * ns = cycles * (10^9 / (cpu_mhz * 10^6))
3580 + * ns = cycles * (10^3 / cpu_mhz)
3582 + * Then we use scaling math (suggested by george@mvista.com) to get:
3583 + * ns = cycles * (10^3 * SC / cpu_mhz) / SC
3584 + * ns = cycles * cyc2ns_scale / SC
3586 + * And since SC is a constant power of two, we can convert the div
3588 + * -johnstul@us.ibm.com "math is hard, lets go shopping!"
3590 +static unsigned long cyc2ns_scale;
3591 +#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
3593 +static inline void set_cyc2ns_scale(unsigned long cpu_mhz)
3595 + cyc2ns_scale = (1000 << CYC2NS_SCALE_FACTOR)/cpu_mhz;
3598 +static inline unsigned long long cycles_2_ns(unsigned long long cyc)
3600 + return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
3603 +static unsigned long long monotonic_clock_hpet(void)
3605 + unsigned long long last_offset, this_offset, base;
3607 + /* atomically read monotonic base & last_offset */
3608 + read_lock_irq(&monotonic_lock);
3609 + last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3610 + base = monotonic_base;
3611 + read_unlock_irq(&monotonic_lock);
3613 + /* Read the Time Stamp Counter */
3614 + rdtscll(this_offset);
3616 + /* return the value in ns */
3617 + return base + cycles_2_ns(this_offset - last_offset);
3620 +static unsigned long get_offset_hpet(void)
3622 + register unsigned long eax, edx;
3624 + eax = hpet_readl(HPET_COUNTER);
3625 + eax -= hpet_last; /* hpet delta */
3628 + * Time offset = (hpet delta) * ( usecs per HPET clock )
3629 + * = (hpet delta) * ( usecs per tick / HPET clocks per tick)
3630 + * = (hpet delta) * ( hpet_usec_quotient ) / (2^32)
3633 + * hpet_usec_quotient = (2^32 * usecs per tick)/HPET clocks per tick
3635 + * Using a mull instead of a divl saves some cycles in critical path.
3637 + ASM_MUL64_REG(eax, edx, hpet_usec_quotient, eax);
3639 + /* our adjusted time offset in microseconds */
3643 +static void mark_offset_hpet(void)
3645 + unsigned long long this_offset, last_offset;
3646 + unsigned long offset;
3648 + write_lock(&monotonic_lock);
3649 + last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3650 + rdtsc(last_tsc_low, last_tsc_high);
3652 + offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
3653 + if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
3654 + int lost_ticks = (offset - hpet_last) / hpet_tick;
3655 + jiffies += lost_ticks;
3657 + hpet_last = offset;
3659 + /* update the monotonic base value */
3660 + this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3661 + monotonic_base += cycles_2_ns(this_offset - last_offset);
3662 + write_unlock(&monotonic_lock);
3665 +void delay_hpet(unsigned long loops)
3667 + unsigned long hpet_start, hpet_end;
3668 + unsigned long eax;
3670 + /* loops is the number of cpu cycles. Convert it to hpet clocks */
3671 + ASM_MUL64_REG(eax, loops, tsc_hpet_quotient, loops);
3673 + hpet_start = hpet_readl(HPET_COUNTER);
3676 + hpet_end = hpet_readl(HPET_COUNTER);
3677 + } while ((hpet_end - hpet_start) < (loops));
3680 +/* ------ Calibrate the TSC -------
3681 + * Return 2^32 * (1 / (TSC clocks per usec)) for getting the CPU freq.
3682 + * Set 2^32 * (1 / (tsc per HPET clk)) for delay_hpet().
3683 + * calibrate_tsc() calibrates the processor TSC by comparing
3684 + * it to the HPET timer of known frequency.
3685 + * Too much 64-bit arithmetic here to do this cleanly in C
3687 +#define CALIBRATE_CNT_HPET (5 * hpet_tick)
3688 +#define CALIBRATE_TIME_HPET (5 * KERNEL_TICK_USEC)
3690 +static unsigned long __init calibrate_tsc(void)
3692 + unsigned long tsc_startlow, tsc_starthigh;
3693 + unsigned long tsc_endlow, tsc_endhigh;
3694 + unsigned long hpet_start, hpet_end;
3695 + unsigned long result, remain;
3697 + hpet_start = hpet_readl(HPET_COUNTER);
3698 + rdtsc(tsc_startlow, tsc_starthigh);
3700 + hpet_end = hpet_readl(HPET_COUNTER);
3701 + } while ((hpet_end - hpet_start) < CALIBRATE_CNT_HPET);
3702 + rdtsc(tsc_endlow, tsc_endhigh);
3704 + /* 64-bit subtract - gcc just messes up with long longs */
3705 + __asm__("subl %2,%0\n\t"
3707 + :"=a" (tsc_endlow), "=d" (tsc_endhigh)
3708 + :"g" (tsc_startlow), "g" (tsc_starthigh),
3709 + "0" (tsc_endlow), "1" (tsc_endhigh));
3711 + /* Error: ECPUTOOFAST */
3713 + goto bad_calibration;
3715 + /* Error: ECPUTOOSLOW */
3716 + if (tsc_endlow <= CALIBRATE_TIME_HPET)
3717 + goto bad_calibration;
3719 + ASM_DIV64_REG(result, remain, tsc_endlow, 0, CALIBRATE_TIME_HPET);
3720 + if (remain > (tsc_endlow >> 1))
3721 + result++; /* rounding the result */
3723 + ASM_DIV64_REG(tsc_hpet_quotient, remain, tsc_endlow, 0,
3724 + CALIBRATE_CNT_HPET);
3725 + if (remain > (tsc_endlow >> 1))
3726 + tsc_hpet_quotient++; /* rounding the result */
3731 + * the CPU was so fast/slow that the quotient wouldn't fit in
3737 +static int __init init_hpet(char* override)
3739 + unsigned long result, remain;
3741 + /* check clock override */
3742 + if (override[0] && strncmp(override,"hpet",4))
3745 + if (!is_hpet_enabled())
3748 + printk("Using HPET for gettimeofday\n");
3749 + if (cpu_has_tsc) {
3750 + unsigned long tsc_quotient = calibrate_tsc();
3751 + if (tsc_quotient) {
3752 + /* report CPU clock rate in Hz.
3753 + * The formula is (10^6 * 2^32) / (2^32 * 1 / (clocks/us)) =
3754 + * clock/second. Our precision is about 100 ppm.
3756 + { unsigned long eax=0, edx=1000;
3757 + ASM_DIV64_REG(cpu_khz, edx, tsc_quotient,
3759 + printk("Detected %lu.%03lu MHz processor.\n",
3760 + cpu_khz / 1000, cpu_khz % 1000);
3762 + set_cyc2ns_scale(cpu_khz/1000);
3767 + * Math to calculate hpet to usec multiplier
3768 + * Look for the comments at get_offset_hpet()
3770 + ASM_DIV64_REG(result, remain, hpet_tick, 0, KERNEL_TICK_USEC);
3771 + if (remain > (hpet_tick >> 1))
3772 + result++; /* rounding the result */
3773 + hpet_usec_quotient = result;
3778 +/************************************************************/
3780 +/* tsc timer_opts struct */
3781 +struct timer_opts timer_hpet = {
3782 + .init = init_hpet,
3783 + .mark_offset = mark_offset_hpet,
3784 + .get_offset = get_offset_hpet,
3785 + .monotonic_clock = monotonic_clock_hpet,
3786 + .delay = delay_hpet,
3788 diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
3789 --- a/arch/i386/kernel/timers/timer_tsc.c Mon Aug 18 06:40:02 2003
3790 +++ b/arch/i386/kernel/timers/timer_tsc.c Sun Aug 31 16:15:21 2003
3792 #include "io_ports.h"
3793 #include "mach_timer.h"
3795 +#include <asm/hpet.h>
3797 +#ifdef CONFIG_HPET_TIMER
3798 +static unsigned long hpet_usec_quotient;
3799 +static unsigned long hpet_last;
3800 +struct timer_opts timer_tsc;
3803 int tsc_disable __initdata = 0;
3805 extern spinlock_t i8253_lock;
3806 +extern volatile unsigned long jiffies;
3809 /* Number of usecs that the last interrupt was delayed */
3812 #define CALIBRATE_TIME (5 * 1000020/HZ)
3814 -unsigned long __init calibrate_tsc(void)
3815 +static unsigned long __init calibrate_tsc(void)
3817 mach_prepare_counter();
3819 @@ -282,6 +291,107 @@
3823 +#ifdef CONFIG_HPET_TIMER
3824 +static void mark_offset_tsc_hpet(void)
3826 + unsigned long long this_offset, last_offset;
3827 + unsigned long offset, temp, hpet_current;
3829 + write_lock(&monotonic_lock);
3830 + last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3832 + * It is important that these two operations happen almost at
3833 + * the same time. We do the RDTSC stuff first, since it's
3834 + * faster. To avoid any inconsistencies, we need interrupts
3835 + * disabled locally.
3838 + * Interrupts are just disabled locally since the timer irq
3839 + * has the SA_INTERRUPT flag set. -arca
3841 + /* read Pentium cycle counter */
3843 + hpet_current = hpet_readl(HPET_COUNTER);
3844 + rdtsc(last_tsc_low, last_tsc_high);
3846 + /* lost tick compensation */
3847 + offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
3848 + if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
3849 + int lost_ticks = (offset - hpet_last) / hpet_tick;
3850 + jiffies += lost_ticks;
3852 + hpet_last = hpet_current;
3854 + /* update the monotonic base value */
3855 + this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
3856 + monotonic_base += cycles_2_ns(this_offset - last_offset);
3857 + write_unlock(&monotonic_lock);
3859 + /* calculate delay_at_last_interrupt */
3861 + * Time offset = (hpet delta) * ( usecs per HPET clock )
3862 + * = (hpet delta) * ( usecs per tick / HPET clocks per tick)
3863 + * = (hpet delta) * ( hpet_usec_quotient ) / (2^32)
3865 + * hpet_usec_quotient = (2^32 * usecs per tick)/HPET clocks per tick
3867 + delay_at_last_interrupt = hpet_current - offset;
3868 + ASM_MUL64_REG(temp, delay_at_last_interrupt,
3869 + hpet_usec_quotient, delay_at_last_interrupt);
3872 +/* ------ Calibrate the TSC based on HPET timer -------
3873 + * Return 2^32 * (1 / (TSC clocks per usec)) for do_fast_gettimeoffset().
3874 + * calibrate_tsc() calibrates the processor TSC by comparing
3875 + * it to the HPET timer of known frequency.
3876 + * Too much 64-bit arithmetic here to do this cleanly in C
3879 +#define CALIBRATE_CNT_HPET (5 * hpet_tick)
3880 +#define CALIBRATE_TIME_HPET (5 * KERNEL_TICK_USEC)
3882 +unsigned long __init calibrate_tsc_hpet(void)
3884 + unsigned long tsc_startlow, tsc_starthigh;
3885 + unsigned long tsc_endlow, tsc_endhigh;
3886 + unsigned long hpet_start, hpet_end;
3887 + unsigned long result, remain;
3889 + hpet_start = hpet_readl(HPET_COUNTER);
3890 + rdtsc(tsc_startlow, tsc_starthigh);
3892 + hpet_end = hpet_readl(HPET_COUNTER);
3893 + } while ((hpet_end - hpet_start) < CALIBRATE_CNT_HPET);
3894 + rdtsc(tsc_endlow, tsc_endhigh);
3896 + /* 64-bit subtract - gcc just messes up with long longs */
3897 + __asm__("subl %2,%0\n\t"
3899 + :"=a" (tsc_endlow), "=d" (tsc_endhigh)
3900 + :"g" (tsc_startlow), "g" (tsc_starthigh),
3901 + "0" (tsc_endlow), "1" (tsc_endhigh));
3903 + /* Error: ECPUTOOFAST */
3905 + goto bad_calibration;
3907 + /* Error: ECPUTOOSLOW */
3908 + if (tsc_endlow <= CALIBRATE_TIME_HPET)
3909 + goto bad_calibration;
3911 + ASM_DIV64_REG(result, remain, tsc_endlow, 0, CALIBRATE_TIME_HPET);
3912 + if (remain > (tsc_endlow >> 1))
3913 + result++; /* rounding the result */
3918 + * the CPU was so fast/slow that the quotient wouldn't fit in
3925 #ifdef CONFIG_CPU_FREQ
3926 static unsigned int ref_freq = 0;
3927 @@ -333,8 +443,16 @@
3930 /* check clock override */
3931 - if (override[0] && strncmp(override,"tsc",3))
3932 + if (override[0] && strncmp(override,"tsc",3)) {
3933 +#ifdef CONFIG_HPET_TIMER
3934 + if (is_hpet_enabled()) {
3935 + printk(KERN_ERR "Warning: clock= override failed. Defaulting to tsc\n");
3944 * If we have APM enabled or the CPU clock speed is variable
3945 @@ -368,7 +486,29 @@
3946 count2 = LATCH; /* initialize counter for mark_offset_tsc() */
3949 - unsigned long tsc_quotient = calibrate_tsc();
3950 + unsigned long tsc_quotient;
3951 +#ifdef CONFIG_HPET_TIMER
3952 + if (is_hpet_enabled()){
3953 + unsigned long result, remain;
3954 + printk("Using TSC for gettimeofday\n");
3955 + tsc_quotient = calibrate_tsc_hpet();
3956 + timer_tsc.mark_offset = &mark_offset_tsc_hpet;
3958 + * Math to calculate hpet to usec multiplier
3959 + * Look for the comments at get_offset_tsc_hpet()
3961 + ASM_DIV64_REG(result, remain, hpet_tick,
3962 + 0, KERNEL_TICK_USEC);
3963 + if (remain > (hpet_tick >> 1))
3964 + result++; /* rounding the result */
3966 + hpet_usec_quotient = result;
3970 + tsc_quotient = calibrate_tsc();
3974 fast_gettimeoffset_quotient = tsc_quotient;
3976 diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
3977 --- a/arch/i386/kernel/traps.c Thu Jun 26 12:11:29 2003
3978 +++ b/arch/i386/kernel/traps.c Tue Sep 2 00:37:21 2003
3980 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
3981 * Don't touch unless you *really* know how it works.
3983 - * Must be called with kernel preemption disabled.
3984 + * Must be called with kernel preemption disabled (in this case,
3985 + * local interrupts are disabled at the call-site in entry.S).
3987 asmlinkage void math_state_restore(struct pt_regs regs)
3989 diff -Nru a/arch/i386/mach-visws/mpparse.c b/arch/i386/mach-visws/mpparse.c
3990 --- a/arch/i386/mach-visws/mpparse.c Mon Aug 18 19:46:23 2003
3991 +++ b/arch/i386/mach-visws/mpparse.c Sun Aug 31 16:14:17 2003
3993 void __init MP_processor_info (struct mpc_config_processor *m)
3995 int ver, logical_apicid;
3996 - cpumask_t apic_cpus;
3997 + physid_mask_t apic_cpus;
3999 if (!(m->mpc_cpuflag & CPU_ENABLED))
4001 diff -Nru a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
4002 --- a/arch/i386/mach-voyager/voyager_smp.c Mon Aug 18 19:46:23 2003
4003 +++ b/arch/i386/mach-voyager/voyager_smp.c Sun Aug 31 16:14:42 2003
4008 - for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4009 + for_each_cpu(cpu, cpu_online_map) {
4010 if(cpuset & (1<<cpu)) {
4011 #ifdef VOYAGER_DEBUG
4012 if(!cpu_isset(cpu, cpu_online_map))
4013 @@ -874,10 +874,10 @@
4015 smp_invalidate_interrupt(void)
4017 - __u8 cpu = get_cpu();
4018 + __u8 cpu = smp_processor_id();
4020 - if (!(smp_invalidate_needed & (1UL << cpu)))
4022 + if (!test_bit(cpu, &smp_invalidate_needed))
4024 /* This will flood messages. Don't uncomment unless you see
4025 * Problems with cross cpu invalidation
4026 VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n",
4031 - smp_invalidate_needed |= 1UL << cpu;
4033 - put_cpu_no_resched();
4034 + smp_mb__before_clear_bit();
4035 + clear_bit(cpu, &smp_invalidate_needed);
4036 + smp_mb__after_clear_bit();
4039 /* All the new flush operations for 2.4 */
4041 send_CPI(cpumask, VIC_INVALIDATE_CPI);
4043 while (smp_invalidate_needed) {
4046 printk("***WARNING*** Stuck doing invalidate CPI (CPU%d)\n", smp_processor_id());
4048 @@ -1464,7 +1465,7 @@
4049 cpuset &= 0xff; /* only first 8 CPUs vaild for VIC CPI */
4052 - for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4053 + for_each_cpu(cpu, cpu_online_map) {
4054 if(cpuset & (1<<cpu))
4055 set_bit(cpi, &vic_cpi_mailbox[cpu]);
4057 @@ -1578,7 +1579,7 @@
4058 VDEBUG(("VOYAGER: enable_vic_irq(%d) CPU%d affinity 0x%lx\n",
4059 irq, cpu, cpu_irq_affinity[cpu]));
4060 spin_lock_irqsave(&vic_irq_lock, flags);
4061 - for_each_cpu(real_cpu, mk_cpumask_const(cpu_online_map)) {
4062 + for_each_cpu(real_cpu, cpu_online_map) {
4063 if(!(voyager_extended_vic_processors & (1<<real_cpu)))
4065 if(!(cpu_irq_affinity[real_cpu] & mask)) {
4066 @@ -1723,7 +1724,7 @@
4068 printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
4070 - for_each_cpu(real_cpu, mk_cpumask_const(mask)) {
4071 + for_each_cpu(real_cpu, mask) {
4073 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
4075 @@ -1808,7 +1809,7 @@
4079 - for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4080 + for_each_cpu(cpu, cpu_online_map) {
4081 unsigned long cpu_mask = 1 << cpu;
4083 if(cpu_mask & real_mask) {
4084 @@ -1874,7 +1875,7 @@
4085 int old_cpu = smp_processor_id(), cpu;
4087 /* dump the interrupt masks of each processor */
4088 - for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) {
4089 + for_each_cpu(cpu, cpu_online_map) {
4090 __u16 imr, isr, irr;
4091 unsigned long flags;
4093 diff -Nru a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
4094 --- a/arch/i386/oprofile/nmi_int.c Thu Jul 17 17:21:06 2003
4095 +++ b/arch/i386/oprofile/nmi_int.c Fri Aug 29 09:02:20 2003
4096 @@ -364,10 +364,21 @@
4098 case X86_VENDOR_AMD:
4099 /* Needs to be at least an Athlon (or hammer in 32bit mode) */
4105 - model = &op_athlon_spec;
4106 - nmi_ops.cpu_type = "i386/athlon";
4108 + model = &op_athlon_spec;
4109 + nmi_ops.cpu_type = "i386/athlon";
4111 +#if defined(CONFIG_X86_64)
4113 + model = &op_athlon_spec;
4114 + nmi_ops.cpu_type = "x86-64/hammer";
4116 +#endif /* CONFIG_X86_64 */
4120 #if !defined(CONFIG_X86_64)
4121 diff -Nru a/arch/i386/pci/common.c b/arch/i386/pci/common.c
4122 --- a/arch/i386/pci/common.c Mon Jun 23 12:31:05 2003
4123 +++ b/arch/i386/pci/common.c Mon Sep 1 17:58:12 2003
4125 pci_cache_line_size = 32 >> 2;
4126 if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD)
4127 pci_cache_line_size = 64 >> 2; /* K7 & K8 */
4128 - else if (c->x86 > 6)
4129 + else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL)
4130 pci_cache_line_size = 128 >> 2; /* P4 */
4132 pcibios_resource_survey();
4133 diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig
4134 --- a/arch/ia64/Kconfig Fri Aug 8 10:02:34 2003
4135 +++ b/arch/ia64/Kconfig Sun Aug 31 16:14:22 2003
4140 - bool "Discontiguous memory support" if (IA64_DIG && NUMA)
4141 - default y if IA64_SGI_SN2 || IA64_GENERIC
4142 + bool "Discontiguous memory support" if (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC) && NUMA
4143 + default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA
4145 Say Y to support efficient handling of discontiguous physical memory,
4146 for architectures which are either NUMA (Non-Uniform Memory Access)
4147 @@ -296,29 +296,6 @@
4149 If you are compiling a kernel that will run under SGI's IA-64
4150 simulator (Medusa) then say Y, otherwise say N.
4152 -# On IA-64, we always want an ELF /proc/kcore.
4157 - If you enabled support for /proc file system then the file
4158 - /proc/kcore will contain the kernel core image. This can be used
4161 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
4163 - You have two choices here: ELF and A.OUT. Selecting ELF will make
4164 - /proc/kcore appear in ELF core format as defined by the Executable
4165 - and Linking Format specification. Selecting A.OUT will choose the
4166 - old "a.out" format which may be necessary for some old versions
4167 - of binutils or on some architectures.
4169 - This is especially useful if you have compiled the kernel with the
4170 - "-g" option to preserve debugging information. It is mainly used
4171 - for examining kernel data structures on the live kernel so if you
4172 - don't understand what this means or are not a kernel hacker, just
4173 - leave it at its default value ELF.
4175 config FORCE_MAX_ZONEORDER
4177 diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile
4178 --- a/arch/ia64/Makefile Tue Aug 19 23:13:39 2003
4179 +++ b/arch/ia64/Makefile Sat Aug 23 10:28:23 2003
4182 .PHONY: boot compressed check
4186 compressed: vmlinux.gz
4193 - echo ' compressed - Build compressed kernel image'
4194 + echo '* compressed - Build compressed kernel image'
4195 echo ' boot - Build vmlinux and bootloader for Ski simulator'
4197 diff -Nru a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
4198 --- a/arch/ia64/hp/common/sba_iommu.c Sun Jul 27 12:01:33 2003
4199 +++ b/arch/ia64/hp/common/sba_iommu.c Sun Aug 31 16:14:08 2003
4200 @@ -1935,10 +1935,10 @@
4203 static struct acpi_driver acpi_sba_ioc_driver = {
4204 - name: "IOC IOMMU Driver",
4205 - ids: "HWP0001,HWP0004",
4207 - add: acpi_sba_ioc_add,
4208 + .name = "IOC IOMMU Driver",
4209 + .ids = "HWP0001,HWP0004",
4211 + .add = acpi_sba_ioc_add,
4215 diff -Nru a/arch/ia64/ia32/ia32_ioctl.c b/arch/ia64/ia32/ia32_ioctl.c
4216 --- a/arch/ia64/ia32/ia32_ioctl.c Thu Aug 7 17:00:00 2003
4217 +++ b/arch/ia64/ia32/ia32_ioctl.c Sun Aug 31 16:14:44 2003
4219 #define IOCTL_TABLE_START \
4220 struct ioctl_trans ioctl_start[] = {
4221 #define IOCTL_TABLE_END \
4222 - }; struct ioctl_trans ioctl_end[0];
4226 HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
4228 #include "compat_ioctl.c"
4229 #include <linux/compat_ioctl.h>
4232 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
4233 diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
4234 --- a/arch/ia64/ia32/sys_ia32.c Tue Aug 19 23:13:39 2003
4235 +++ b/arch/ia64/ia32/sys_ia32.c Mon Aug 25 14:45:43 2003
4238 #define OFFSET4K(a) ((a) & 0xfff)
4239 #define PAGE_START(addr) ((addr) & PAGE_MASK)
4240 -#define PAGE_OFF(addr) ((addr) & ~PAGE_MASK)
4242 #define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
4243 #define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
4245 current->thread.map_base = old_map_base;
4246 current->thread.task_size = old_task_size;
4247 set_fs(USER_DS); /* establish new task-size as the address-limit */
4256 @@ -271,11 +270,11 @@
4259 /* copy back the old page contents. */
4260 - if (PAGE_OFF(start))
4261 - copy_to_user((void *) PAGE_START(start), page, PAGE_OFF(start));
4262 - if (PAGE_OFF(end))
4263 - copy_to_user((void *) end, page + PAGE_OFF(end),
4264 - PAGE_SIZE - PAGE_OFF(end));
4265 + if (offset_in_page(start))
4266 + copy_to_user((void *) PAGE_START(start), page, offset_in_page(start));
4267 + if (offset_in_page(end))
4268 + copy_to_user((void *) end, page + offset_in_page(end),
4269 + PAGE_SIZE - offset_in_page(end));
4272 if (!(flags & MAP_ANONYMOUS)) {
4274 "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
4275 current->comm, current->pid, end);
4276 ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
4277 - (off + len) - PAGE_OFF(end));
4278 + (off + len) - offset_in_page(end));
4279 if (IS_ERR((void *) ret))
4282 @@ -347,14 +346,14 @@
4283 tmp = arch_get_unmapped_area(file, pstart - fudge, pend - pstart, 0, flags);
4284 if (tmp != pstart) {
4286 - start = pstart + PAGE_OFF(off); /* make start congruent with off */
4287 + start = pstart + offset_in_page(off); /* make start congruent with off */
4289 pend = PAGE_ALIGN(end);
4293 poff = off + (pstart - start); /* note: (pstart - start) may be negative */
4294 - is_congruent = (flags & MAP_ANONYMOUS) || (PAGE_OFF(poff) == 0);
4295 + is_congruent = (flags & MAP_ANONYMOUS) || (offset_in_page(poff) == 0);
4297 if ((flags & MAP_SHARED) && !is_congruent)
4298 printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
4301 down(&ia32_mmap_sem);
4303 - if (PAGE_OFF(start)) {
4304 + if (offset_in_page(start)) {
4305 /* start address is 4KB aligned but not page aligned. */
4306 retval = mprotect_subpage(PAGE_START(start), prot);
4309 goto out; /* retval is already zero... */
4312 - if (PAGE_OFF(end)) {
4313 + if (offset_in_page(end)) {
4314 /* end address is 4KB aligned but not page aligned. */
4315 retval = mprotect_subpage(PAGE_START(end), prot);
4317 diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
4318 --- a/arch/ia64/kernel/acpi.c Wed Aug 6 12:37:03 2003
4319 +++ b/arch/ia64/kernel/acpi.c Tue Aug 26 15:09:18 2003
4323 if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
4324 - /* correctable platform error interrupt */
4325 + /* corrected platform error interrupt */
4326 vector = platform_intr_list[int_type];
4328 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
4329 diff -Nru a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
4330 --- a/arch/ia64/kernel/entry.S Sat Aug 16 17:16:48 2003
4331 +++ b/arch/ia64/kernel/entry.S Mon Aug 25 14:47:33 2003
4332 @@ -1473,7 +1473,7 @@
4333 data8 sys_clock_nanosleep
4336 - data8 ia64_ni_syscall
4337 + data8 sys_fadvise64_64
4338 data8 ia64_ni_syscall // 1260
4339 data8 ia64_ni_syscall
4340 data8 ia64_ni_syscall
4341 diff -Nru a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
4342 --- a/arch/ia64/kernel/fsys.S Thu Jul 10 18:16:32 2003
4343 +++ b/arch/ia64/kernel/fsys.S Mon Aug 25 14:47:33 2003
4345 data8 0 // clock_gettime
4346 data8 0 // clock_getres // 1255
4347 data8 0 // clock_nanosleep
4351 + data8 0 // fstatfs64
4352 + data8 0 // statfs64
4353 + data8 0 // fadvise64_64
4357 diff -Nru a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
4358 --- a/arch/ia64/kernel/mca.c Tue Aug 19 23:13:39 2003
4359 +++ b/arch/ia64/kernel/mca.c Tue Aug 26 13:42:37 2003
4360 @@ -1145,7 +1145,7 @@
4362 ia64_mca_cmc_int_handler(cpe_irq, arg, ptregs);
4364 - for (++cpuid ; !cpu_online(cpuid) && cpuid < NR_CPUS ; cpuid++);
4365 + for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
4367 if (cpuid < NR_CPUS) {
4368 platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
4369 @@ -1225,7 +1225,7 @@
4371 ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs);
4373 - for (++cpuid ; !cpu_online(cpuid) && cpuid < NR_CPUS ; cpuid++);
4374 + for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
4376 if (cpuid < NR_CPUS) {
4377 platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
4378 diff -Nru a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
4379 --- a/arch/ia64/kernel/perfmon.c Thu Aug 21 15:45:04 2003
4380 +++ b/arch/ia64/kernel/perfmon.c Sun Aug 31 16:14:08 2003
4381 @@ -2109,7 +2109,7 @@
4384 static struct dentry_operations pfmfs_dentry_operations = {
4385 - d_delete: pfmfs_delete_dentry,
4386 + .d_delete = pfmfs_delete_dentry,
4390 diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
4391 --- a/arch/ia64/kernel/smpboot.c Mon Aug 18 19:46:23 2003
4392 +++ b/arch/ia64/kernel/smpboot.c Fri Aug 22 15:20:52 2003
4394 if (cpu_online(cpu))
4395 bogosum += cpu_data(cpu)->loops_per_jiffy;
4397 - printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
4398 + printk(KERN_INFO "Total of %lu processors activated (%lu.%02lu BogoMIPS).\n",
4399 num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
4402 diff -Nru a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
4403 --- a/arch/ia64/kernel/sys_ia64.c Wed Jul 9 09:56:58 2003
4404 +++ b/arch/ia64/kernel/sys_ia64.c Mon Aug 25 14:45:43 2003
4406 asmlinkage unsigned long
4407 sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, long off)
4409 - if ((off & ~PAGE_MASK) != 0)
4410 + if (offset_in_page(off) != 0)
4413 addr = do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
4414 diff -Nru a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile
4415 --- a/arch/ia64/lib/Makefile Fri Jun 20 12:48:24 2003
4416 +++ b/arch/ia64/lib/Makefile Mon Aug 25 09:56:27 2003
4418 lib-$(CONFIG_PERFMON) += carta_random.o
4419 lib-$(CONFIG_MD_RAID5) += xor.o
4421 -IGNORE_FLAGS_OBJS = __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
4422 - __divdi3.o __udivdi3.o __moddi3.o __umoddi3.o
4425 AFLAGS___udivdi3.o = -DUNSIGNED
4426 AFLAGS___moddi3.o = -DMODULO
4428 AFLAGS___modsi3.o = -DMODULO
4429 AFLAGS___umodsi3.o = -DUNSIGNED -DMODULO
4431 -$(obj)/__divdi3.o: $(src)/idiv64.S
4433 +$(obj)/__divdi3.o: $(src)/idiv64.S FORCE
4434 + $(call if_changed_dep,as_o_S)
4436 -$(obj)/__udivdi3.o: $(src)/idiv64.S
4438 +$(obj)/__udivdi3.o: $(src)/idiv64.S FORCE
4439 + $(call if_changed_dep,as_o_S)
4441 -$(obj)/__moddi3.o: $(src)/idiv64.S
4443 +$(obj)/__moddi3.o: $(src)/idiv64.S FORCE
4444 + $(call if_changed_dep,as_o_S)
4446 -$(obj)/__umoddi3.o: $(src)/idiv64.S
4448 +$(obj)/__umoddi3.o: $(src)/idiv64.S FORCE
4449 + $(call if_changed_dep,as_o_S)
4451 -$(obj)/__divsi3.o: $(src)/idiv32.S
4453 +$(obj)/__divsi3.o: $(src)/idiv32.S FORCE
4454 + $(call if_changed_dep,as_o_S)
4456 -$(obj)/__udivsi3.o: $(src)/idiv32.S
4458 +$(obj)/__udivsi3.o: $(src)/idiv32.S FORCE
4459 + $(call if_changed_dep,as_o_S)
4461 -$(obj)/__modsi3.o: $(src)/idiv32.S
4463 +$(obj)/__modsi3.o: $(src)/idiv32.S FORCE
4464 + $(call if_changed_dep,as_o_S)
4466 -$(obj)/__umodsi3.o: $(src)/idiv32.S
4468 +$(obj)/__umodsi3.o: $(src)/idiv32.S FORCE
4469 + $(call if_changed_dep,as_o_S)
4470 diff -Nru a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
4471 --- a/arch/ia64/mm/numa.c Mon Sep 30 06:38:28 2002
4472 +++ b/arch/ia64/mm/numa.c Thu Aug 21 05:02:28 2003
4474 paddr < node_memblk[i].start_paddr + node_memblk[i].size)
4477 - return (i < num_memblks) ? node_memblk[i].nid : -1;
4478 + return (i < num_memblks) ? node_memblk[i].nid : (num_memblks ? -1 : 0);
4480 diff -Nru a/arch/ia64/sn/io/drivers/ioconfig_bus.c b/arch/ia64/sn/io/drivers/ioconfig_bus.c
4481 --- a/arch/ia64/sn/io/drivers/ioconfig_bus.c Mon May 19 05:42:35 2003
4482 +++ b/arch/ia64/sn/io/drivers/ioconfig_bus.c Sun Aug 31 16:14:08 2003
4486 struct file_operations ioconfig_bus_fops = {
4487 - ioctl:ioconfig_bus_ioctl,
4488 - open:ioconfig_bus_open, /* open */
4489 - release:ioconfig_bus_close /* release */
4490 + .ioctl = ioconfig_bus_ioctl,
4491 + .open = ioconfig_bus_open, /* open */
4492 + .release = ioconfig_bus_close /* release */
4496 diff -Nru a/arch/ia64/sn/io/sn2/shub.c b/arch/ia64/sn/io/sn2/shub.c
4497 --- a/arch/ia64/sn/io/sn2/shub.c Mon Aug 4 10:02:37 2003
4498 +++ b/arch/ia64/sn/io/sn2/shub.c Sun Aug 31 16:14:08 2003
4502 struct file_operations shub_mon_fops = {
4503 - ioctl: shubstats_ioctl,
4504 + .ioctl = shubstats_ioctl,
4508 diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
4509 --- a/arch/ia64/sn/kernel/setup.c Sat Aug 16 16:26:35 2003
4510 +++ b/arch/ia64/sn/kernel/setup.c Sun Aug 31 16:14:08 2003
4511 @@ -117,14 +117,14 @@
4512 * VGA color display.
4514 struct screen_info sn_screen_info = {
4517 - orig_video_mode: 3,
4518 - orig_video_cols: 80,
4519 - orig_video_ega_bx: 3,
4520 - orig_video_lines: 25,
4521 - orig_video_isVGA: 1,
4522 - orig_video_points: 16
4525 + .orig_video_mode = 3,
4526 + .orig_video_cols = 80,
4527 + .orig_video_ega_bx = 3,
4528 + .orig_video_lines = 25,
4529 + .orig_video_isVGA = 1,
4530 + .orig_video_points = 16
4534 diff -Nru a/arch/m68k/Kconfig b/arch/m68k/Kconfig
4535 --- a/arch/m68k/Kconfig Sat Aug 2 14:26:16 2003
4536 +++ b/arch/m68k/Kconfig Sun Aug 31 16:14:22 2003
4537 @@ -342,40 +342,6 @@
4539 menu "General setup"
4542 - prompt "Kernel core (/proc/kcore) format"
4543 - depends on PROC_FS
4549 - If you enabled support for /proc file system then the file
4550 - /proc/kcore will contain the kernel core image. This can be used
4553 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
4555 - You have two choices here: ELF and A.OUT. Selecting ELF will make
4556 - /proc/kcore appear in ELF core format as defined by the Executable
4557 - and Linking Format specification. Selecting A.OUT will choose the
4558 - old "a.out" format which may be necessary for some old versions
4559 - of binutils or on some architectures.
4561 - This is especially useful if you have compiled the kernel with the
4562 - "-g" option to preserve debugging information. It is mainly used
4563 - for examining kernel data structures on the live kernel so if you
4564 - don't understand what this means or are not a kernel hacker, just
4565 - leave it at its default value ELF.
4570 - Not necessary unless you're using a very out-of-date binutils
4571 - version. You probably want KCORE_ELF.
4575 source "fs/Kconfig.binfmt"
4578 diff -Nru a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
4579 --- /dev/null Wed Dec 31 16:00:00 1969
4580 +++ b/arch/m68k/kernel/vmlinux-std.lds Sun Jun 15 03:46:43 2003
4582 +/* ld script to make m68k Linux kernel */
4584 +#include <asm-generic/vmlinux.lds.h>
4586 +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4589 +jiffies = jiffies_64 + 4;
4593 + _text = .; /* Text and read-only data */
4600 + . = ALIGN(16); /* Exception table */
4601 + __start___ex_table = .;
4602 + __ex_table : { *(__ex_table) }
4603 + __stop___ex_table = .;
4607 + _etext = .; /* End of text section */
4609 + .data : { /* Data */
4614 + .bss : { *(.bss) } /* BSS */
4617 + .data.cacheline_aligned : { *(.data.cacheline_aligned) }
4619 + _edata = .; /* End of data section */
4621 + /* will be freed after init */
4622 + . = ALIGN(4096); /* Init code and data */
4629 + .init.data : { *(.init.data) }
4631 + __setup_start = .;
4632 + .init.setup : { *(.init.setup) }
4634 + __start___param = .;
4635 + __param : { *(__param) }
4636 + __stop___param = .;
4637 + __initcall_start = .;
4638 + .initcall.init : {
4639 + *(.initcall1.init)
4640 + *(.initcall2.init)
4641 + *(.initcall3.init)
4642 + *(.initcall4.init)
4643 + *(.initcall5.init)
4644 + *(.initcall6.init)
4645 + *(.initcall7.init)
4647 + __initcall_end = .;
4648 + __con_initcall_start = .;
4649 + .con_initcall.init : { *(.con_initcall.init) }
4650 + __con_initcall_end = .;
4653 + __initramfs_start = .;
4654 + .init.ramfs : { *(.init.ramfs) }
4655 + __initramfs_end = .;
4659 + .data.init_task : { *(.data.init_task) } /* The initial task and kernel stack */
4663 + /* Sections to be discarded */
4670 + /* Stabs debugging sections. */
4671 + .stab 0 : { *(.stab) }
4672 + .stabstr 0 : { *(.stabstr) }
4673 + .stab.excl 0 : { *(.stab.excl) }
4674 + .stab.exclstr 0 : { *(.stab.exclstr) }
4675 + .stab.index 0 : { *(.stab.index) }
4676 + .stab.indexstr 0 : { *(.stab.indexstr) }
4677 + .comment 0 : { *(.comment) }
4679 diff -Nru a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
4680 --- /dev/null Wed Dec 31 16:00:00 1969
4681 +++ b/arch/m68k/kernel/vmlinux-sun3.lds Sun Jun 15 03:46:43 2003
4683 +/* ld script to make m68k Linux kernel */
4685 +#include <asm-generic/vmlinux.lds.h>
4687 +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4690 +jiffies = jiffies_64 + 4;
4694 + _text = .; /* Text and read-only data */
4703 + _etext = .; /* End of text section */
4705 + .data : { /* Data */
4708 + . = ALIGN(16); /* Exception table */
4709 + __start___ex_table = .;
4711 + __stop___ex_table = .;
4713 + /* End of data goes *here* so that freeing init code works properly. */
4716 + /* will be freed after init */
4717 + . = ALIGN(8192); /* Init code and data */
4724 + .init.data : { *(.init.data) }
4726 + __setup_start = .;
4727 + .init.setup : { *(.init.setup) }
4729 + __start___param = .;
4730 + __param : { *(__param) }
4731 + __stop___param = .;
4732 + __initcall_start = .;
4733 + .initcall.init : {
4734 + *(.initcall1.init)
4735 + *(.initcall2.init)
4736 + *(.initcall3.init)
4737 + *(.initcall4.init)
4738 + *(.initcall5.init)
4739 + *(.initcall6.init)
4740 + *(.initcall7.init)
4742 + __initcall_end = .;
4743 + __con_initcall_start = .;
4744 + .con_initcall.init : { *(.con_initcall.init) }
4745 + __con_initcall_end = .;
4748 + __initramfs_start = .;
4749 + .init.ramfs : { *(.init.ramfs) }
4750 + __initramfs_end = .;
4753 + .init.task : { *(init_task) }
4756 + .bss : { *(.bss) } /* BSS */
4760 + /* Sections to be discarded */
4768 + /* Stabs debugging sections. */
4780 diff -Nru a/arch/m68k/vmlinux-std.lds b/arch/m68k/vmlinux-std.lds
4781 --- a/arch/m68k/vmlinux-std.lds Wed Jun 11 17:40:05 2003
4782 +++ /dev/null Wed Dec 31 16:00:00 1969
4784 -/* ld script to make m68k Linux kernel */
4786 -#include <asm-generic/vmlinux.lds.h>
4788 -OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4791 -jiffies = jiffies_64 + 4;
4795 - _text = .; /* Text and read-only data */
4802 - . = ALIGN(16); /* Exception table */
4803 - __start___ex_table = .;
4804 - __ex_table : { *(__ex_table) }
4805 - __stop___ex_table = .;
4809 - _etext = .; /* End of text section */
4811 - .data : { /* Data */
4816 - .bss : { *(.bss) } /* BSS */
4819 - .data.cacheline_aligned : { *(.data.cacheline_aligned) }
4821 - _edata = .; /* End of data section */
4823 - /* will be freed after init */
4824 - . = ALIGN(4096); /* Init code and data */
4831 - .init.data : { *(.init.data) }
4833 - __setup_start = .;
4834 - .init.setup : { *(.init.setup) }
4836 - __start___param = .;
4837 - __param : { *(__param) }
4838 - __stop___param = .;
4839 - __initcall_start = .;
4840 - .initcall.init : {
4841 - *(.initcall1.init)
4842 - *(.initcall2.init)
4843 - *(.initcall3.init)
4844 - *(.initcall4.init)
4845 - *(.initcall5.init)
4846 - *(.initcall6.init)
4847 - *(.initcall7.init)
4849 - __initcall_end = .;
4850 - __con_initcall_start = .;
4851 - .con_initcall.init : { *(.con_initcall.init) }
4852 - __con_initcall_end = .;
4855 - __initramfs_start = .;
4856 - .init.ramfs : { *(.init.ramfs) }
4857 - __initramfs_end = .;
4861 - .data.init_task : { *(.data.init_task) } /* The initial task and kernel stack */
4865 - /* Sections to be discarded */
4872 - /* Stabs debugging sections. */
4873 - .stab 0 : { *(.stab) }
4874 - .stabstr 0 : { *(.stabstr) }
4875 - .stab.excl 0 : { *(.stab.excl) }
4876 - .stab.exclstr 0 : { *(.stab.exclstr) }
4877 - .stab.index 0 : { *(.stab.index) }
4878 - .stab.indexstr 0 : { *(.stab.indexstr) }
4879 - .comment 0 : { *(.comment) }
4881 diff -Nru a/arch/m68k/vmlinux-sun3.lds b/arch/m68k/vmlinux-sun3.lds
4882 --- a/arch/m68k/vmlinux-sun3.lds Wed Jun 11 17:40:05 2003
4883 +++ /dev/null Wed Dec 31 16:00:00 1969
4885 -/* ld script to make m68k Linux kernel */
4887 -#include <asm-generic/vmlinux.lds.h>
4889 -OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
4892 -jiffies = jiffies_64 + 4;
4896 - _text = .; /* Text and read-only data */
4905 - _etext = .; /* End of text section */
4907 - .data : { /* Data */
4910 - . = ALIGN(16); /* Exception table */
4911 - __start___ex_table = .;
4913 - __stop___ex_table = .;
4915 - /* End of data goes *here* so that freeing init code works properly. */
4918 - /* will be freed after init */
4919 - . = ALIGN(8192); /* Init code and data */
4926 - .init.data : { *(.init.data) }
4928 - __setup_start = .;
4929 - .init.setup : { *(.init.setup) }
4931 - __start___param = .;
4932 - __param : { *(__param) }
4933 - __stop___param = .;
4934 - __initcall_start = .;
4935 - .initcall.init : {
4936 - *(.initcall1.init)
4937 - *(.initcall2.init)
4938 - *(.initcall3.init)
4939 - *(.initcall4.init)
4940 - *(.initcall5.init)
4941 - *(.initcall6.init)
4942 - *(.initcall7.init)
4944 - __initcall_end = .;
4945 - __con_initcall_start = .;
4946 - .con_initcall.init : { *(.con_initcall.init) }
4947 - __con_initcall_end = .;
4950 - __initramfs_start = .;
4951 - .init.ramfs : { *(.init.ramfs) }
4952 - __initramfs_end = .;
4955 - .init.task : { *(init_task) }
4958 - .bss : { *(.bss) } /* BSS */
4962 - /* Sections to be discarded */
4970 - /* Stabs debugging sections. */
4982 diff -Nru a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
4983 --- a/arch/m68knommu/Kconfig Sat Aug 2 14:26:16 2003
4984 +++ b/arch/m68knommu/Kconfig Sun Aug 31 16:14:22 2003
4985 @@ -490,14 +490,6 @@
4987 menu "Executable file formats"
4997 source "fs/Kconfig.binfmt"
5000 diff -Nru a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c
5001 --- a/arch/m68knommu/platform/5206/config.c Tue May 27 20:13:12 2003
5002 +++ b/arch/m68knommu/platform/5206/config.c Sat Aug 23 06:07:40 2003
5004 #include <linux/sched.h>
5005 #include <linux/param.h>
5006 #include <linux/init.h>
5007 +#include <linux/interrupt.h>
5008 #include <asm/irq.h>
5009 #include <asm/dma.h>
5010 #include <asm/traps.h>
5012 /***************************************************************************/
5014 void coldfire_tick(void);
5015 -void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5016 +void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5017 unsigned long coldfire_timer_offset(void);
5018 void coldfire_trap_init(void);
5019 void coldfire_reset(void);
5020 diff -Nru a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
5021 --- a/arch/m68knommu/platform/5206e/config.c Tue May 27 20:13:12 2003
5022 +++ b/arch/m68knommu/platform/5206e/config.c Sat Aug 23 06:07:40 2003
5024 #include <linux/kernel.h>
5025 #include <linux/sched.h>
5026 #include <linux/param.h>
5027 +#include <linux/interrupt.h>
5028 #include <asm/irq.h>
5029 #include <asm/dma.h>
5030 #include <asm/traps.h>
5032 /***************************************************************************/
5034 void coldfire_tick(void);
5035 -void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5036 +void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5037 unsigned long coldfire_timer_offset(void);
5038 void coldfire_trap_init(void);
5039 void coldfire_reset(void);
5040 diff -Nru a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
5041 --- a/arch/m68knommu/platform/5249/config.c Tue Jun 17 06:35:38 2003
5042 +++ b/arch/m68knommu/platform/5249/config.c Sat Aug 23 06:07:40 2003
5044 /***************************************************************************/
5046 void coldfire_tick(void);
5047 -void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5048 +void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5049 unsigned long coldfire_timer_offset(void);
5050 void coldfire_trap_init(void);
5051 void coldfire_reset(void);
5052 diff -Nru a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
5053 --- a/arch/m68knommu/platform/5272/config.c Tue Jun 17 06:35:38 2003
5054 +++ b/arch/m68knommu/platform/5272/config.c Sat Aug 23 06:07:40 2003
5056 #include <linux/sched.h>
5057 #include <linux/param.h>
5058 #include <linux/init.h>
5059 +#include <linux/interrupt.h>
5060 #include <asm/irq.h>
5061 #include <asm/dma.h>
5062 #include <asm/traps.h>
5064 /***************************************************************************/
5066 void coldfire_tick(void);
5067 -void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *));
5068 +void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
5069 unsigned long coldfire_timer_offset(void);
5070 void coldfire_trap_init(void);
5071 void coldfire_reset(void);
5072 diff -Nru a/arch/mips/Kconfig b/arch/mips/Kconfig
5073 --- a/arch/mips/Kconfig Mon Jul 28 04:57:50 2003
5074 +++ b/arch/mips/Kconfig Sun Aug 31 16:14:22 2003
5075 @@ -1126,31 +1126,6 @@
5077 menu "Executable file formats"
5083 - If you enabled support for /proc file system then the file
5084 - /proc/kcore will contain the kernel core image. This can be used
5087 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
5089 - You have two choices here: ELF and A.OUT. Selecting ELF will make
5090 - /proc/kcore appear in ELF core format as defined by the Executable
5091 - and Linking Format specification. Selecting A.OUT will choose the
5092 - old "a.out" format which may be necessary for some old versions
5093 - of binutils or on some architectures.
5095 - This is especially useful if you have compiled the kernel with the
5096 - "-g" option to preserve debugging information. It is mainly used
5097 - for examining kernel data structures on the live kernel so if you
5098 - don't understand what this means or are not a kernel hacker, just
5099 - leave it at its default value ELF.
5104 source "fs/Kconfig.binfmt"
5107 diff -Nru a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
5108 --- a/arch/mips/au1000/common/dma.c Mon Jun 23 12:12:26 2003
5109 +++ b/arch/mips/au1000/common/dma.c Sun Aug 31 16:14:08 2003
5111 spinlock_t au1000_dma_spin_lock = SPIN_LOCK_UNLOCKED;
5113 struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
5132 // Device FIFO addresses and default DMA modes
5133 diff -Nru a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c
5134 --- a/arch/mips/kernel/ioctl32.c Mon Jul 28 04:57:50 2003
5135 +++ b/arch/mips/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
5137 #define IOCTL_TABLE_START \
5138 struct ioctl_trans ioctl_start[] = {
5139 #define IOCTL_TABLE_END \
5140 - }; struct ioctl_trans ioctl_end[0];
5145 #include <linux/compat_ioctl.h>
5146 @@ -1205,6 +1204,8 @@
5147 COMPATIBLE_IOCTL(RTC_WKALM_SET)
5148 COMPATIBLE_IOCTL(RTC_WKALM_RD)
5151 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
5153 #define NR_IOCTL_TRANS (sizeof(ioctl_translations) / \
5154 sizeof(ioctl_translations[0]))
5155 diff -Nru a/arch/mips/sibyte/cfe/console.c b/arch/mips/sibyte/cfe/console.c
5156 --- a/arch/mips/sibyte/cfe/console.c Mon Jul 28 04:57:50 2003
5157 +++ b/arch/mips/sibyte/cfe/console.c Sun Aug 31 16:14:08 2003
5159 #include "cfe_error.h"
5161 extern int cfe_cons_handle;
5162 -static kdev_t cfe_consdev;
5164 static void cfe_console_write(struct console *cons, const char *str,
5167 #ifdef CONFIG_SIBYTE_SB1250_DUART
5168 if (!strcmp(consdev, "uart0")) {
5170 -// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 0);
5171 } else if (!strcmp(consdev, "uart1")) {
5173 -// cfe_consdev = MKDEV(TTY_MAJOR, SB1250_DUART_MINOR_BASE + 1);
5175 #ifdef CONFIG_VGA_CONSOLE
5176 } else if (!strcmp(consdev, "pcconsole0")) {
5178 -// cfe_consdev = MKDEV(TTY_MAJOR, 0);
5185 static struct console sb1250_cfe_cons = {
5187 - write: cfe_console_write,
5188 - device: cfe_console_device,
5189 - setup: cfe_console_setup,
5190 - flags: CON_PRINTBUFFER,
5193 + .write = cfe_console_write,
5194 + .device = cfe_console_device,
5195 + .setup = cfe_console_setup,
5196 + .flags = CON_PRINTBUFFER,
5200 static int __init sb1250_cfe_console_init(void)
5201 diff -Nru a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
5202 --- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c Mon Jul 28 04:57:50 2003
5203 +++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c Tue Aug 26 09:25:40 2003
5208 - minor = minor(inode->i_rdev);
5209 + minor = iminor(inode);
5217 - minor = minor(inode->i_rdev);
5218 + minor = iminor(inode);
5219 if (minor != 0 || !sbp.open) {
5222 diff -Nru a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
5223 --- a/arch/mips/tx4927/common/tx4927_irq.c Mon Apr 14 20:10:10 2003
5224 +++ b/arch/mips/tx4927/common/tx4927_irq.c Sun Aug 31 16:14:08 2003
5225 @@ -149,26 +149,26 @@
5227 #define TX4927_CP0_NAME "TX4927-CP0"
5228 static struct hw_interrupt_type tx4927_irq_cp0_type = {
5229 - typename: TX4927_CP0_NAME,
5230 - startup: tx4927_irq_cp0_startup,
5231 - shutdown: tx4927_irq_cp0_shutdown,
5232 - enable: tx4927_irq_cp0_enable,
5233 - disable: tx4927_irq_cp0_disable,
5234 - ack: tx4927_irq_cp0_mask_and_ack,
5235 - end: tx4927_irq_cp0_end,
5236 - set_affinity: NULL
5237 + .typename = TX4927_CP0_NAME,
5238 + .startup = tx4927_irq_cp0_startup,
5239 + .shutdown = tx4927_irq_cp0_shutdown,
5240 + .enable = tx4927_irq_cp0_enable,
5241 + .disable = tx4927_irq_cp0_disable,
5242 + .ack = tx4927_irq_cp0_mask_and_ack,
5243 + .end = tx4927_irq_cp0_end,
5244 + .set_affinity = NULL
5247 #define TX4927_PIC_NAME "TX4927-PIC"
5248 static struct hw_interrupt_type tx4927_irq_pic_type = {
5249 - typename: TX4927_PIC_NAME,
5250 - startup: tx4927_irq_pic_startup,
5251 - shutdown: tx4927_irq_pic_shutdown,
5252 - enable: tx4927_irq_pic_enable,
5253 - disable: tx4927_irq_pic_disable,
5254 - ack: tx4927_irq_pic_mask_and_ack,
5255 - end: tx4927_irq_pic_end,
5256 - set_affinity: NULL
5257 + .typename = TX4927_PIC_NAME,
5258 + .startup = tx4927_irq_pic_startup,
5259 + .shutdown = tx4927_irq_pic_shutdown,
5260 + .enable = tx4927_irq_pic_enable,
5261 + .disable = tx4927_irq_pic_disable,
5262 + .ack = tx4927_irq_pic_mask_and_ack,
5263 + .end = tx4927_irq_pic_end,
5264 + .set_affinity = NULL
5267 #define TX4927_PIC_ACTION(s) { no_action, 0, 0, s, NULL, NULL }
5268 diff -Nru a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
5269 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c Thu Jul 3 15:17:43 2003
5270 +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c Sun Aug 31 16:14:08 2003
5271 @@ -255,14 +255,14 @@
5273 #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
5274 static struct hw_interrupt_type toshiba_rbtx4927_irq_ioc_type = {
5275 - typename:TOSHIBA_RBTX4927_IOC_NAME,
5276 - startup:toshiba_rbtx4927_irq_ioc_startup,
5277 - shutdown:toshiba_rbtx4927_irq_ioc_shutdown,
5278 - enable:toshiba_rbtx4927_irq_ioc_enable,
5279 - disable:toshiba_rbtx4927_irq_ioc_disable,
5280 - ack:toshiba_rbtx4927_irq_ioc_mask_and_ack,
5281 - end:toshiba_rbtx4927_irq_ioc_end,
5283 + .typename = TOSHIBA_RBTX4927_IOC_NAME,
5284 + .startup = toshiba_rbtx4927_irq_ioc_startup,
5285 + .shutdown = toshiba_rbtx4927_irq_ioc_shutdown,
5286 + .enable = toshiba_rbtx4927_irq_ioc_enable,
5287 + .disable = toshiba_rbtx4927_irq_ioc_disable,
5288 + .ack = toshiba_rbtx4927_irq_ioc_mask_and_ack,
5289 + .end = toshiba_rbtx4927_irq_ioc_end,
5290 + .set_affinity = NULL
5292 #define TOSHIBA_RBTX4927_IOC_INTR_ENAB 0xbc002000
5293 #define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
5294 @@ -271,14 +271,14 @@
5295 #ifdef CONFIG_TOSHIBA_FPCIB0
5296 #define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
5297 static struct hw_interrupt_type toshiba_rbtx4927_irq_isa_type = {
5298 - typename:TOSHIBA_RBTX4927_ISA_NAME,
5299 - startup:toshiba_rbtx4927_irq_isa_startup,
5300 - shutdown:toshiba_rbtx4927_irq_isa_shutdown,
5301 - enable:toshiba_rbtx4927_irq_isa_enable,
5302 - disable:toshiba_rbtx4927_irq_isa_disable,
5303 - ack:toshiba_rbtx4927_irq_isa_mask_and_ack,
5304 - end:toshiba_rbtx4927_irq_isa_end,
5306 + .typename = TOSHIBA_RBTX4927_ISA_NAME,
5307 + .startup = toshiba_rbtx4927_irq_isa_startup,
5308 + .shutdown = toshiba_rbtx4927_irq_isa_shutdown,
5309 + .enable = toshiba_rbtx4927_irq_isa_enable,
5310 + .disable = toshiba_rbtx4927_irq_isa_disable,
5311 + .ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
5312 + .end = toshiba_rbtx4927_irq_isa_end,
5313 + .set_affinity = NULL
5317 diff -Nru a/arch/mips/vr41xx/common/vrc4173.c b/arch/mips/vr41xx/common/vrc4173.c
5318 --- a/arch/mips/vr41xx/common/vrc4173.c Thu Jul 31 08:59:17 2003
5319 +++ b/arch/mips/vr41xx/common/vrc4173.c Sun Aug 31 16:14:08 2003
5320 @@ -250,10 +250,10 @@
5323 static struct pci_driver vrc4173_driver = {
5324 - name: "NEC VRC4173",
5325 - probe: vrc4173_probe,
5327 - id_table: vrc4173_table,
5328 + .name = "NEC VRC4173",
5329 + .probe = vrc4173_probe,
5331 + .id_table = vrc4173_table,
5334 static int __devinit vrc4173_init(void)
5335 diff -Nru a/arch/parisc/Kconfig b/arch/parisc/Kconfig
5336 --- a/arch/parisc/Kconfig Sat Aug 2 14:26:16 2003
5337 +++ b/arch/parisc/Kconfig Sun Aug 31 16:14:22 2003
5338 @@ -161,11 +161,6 @@
5340 menu "Executable file formats"
5344 - depends on PROC_FS
5347 source "fs/Kconfig.binfmt"
5350 diff -Nru a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
5351 --- a/arch/parisc/kernel/ioctl32.c Fri May 2 10:22:56 2003
5352 +++ b/arch/parisc/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
5353 @@ -1426,7 +1426,7 @@
5356 tty = (struct tty_struct *)file->private_data;
5357 - if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
5358 + if (tty_paranoia_check(tty, inode, "tty_ioctl"))
5361 if (tty->driver->ioctl != vt_ioctl)
5362 @@ -2458,7 +2458,7 @@
5363 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl)
5365 #define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
5366 -#define IOCTL_TABLE_END }; struct ioctl_trans ioctl_end[0];
5367 +#define IOCTL_TABLE_END };
5370 #include <linux/compat_ioctl.h>
5371 @@ -2631,3 +2631,4 @@
5375 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
5376 diff -Nru a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c
5377 --- a/arch/ppc/8260_io/uart.c Wed Jun 11 12:32:53 2003
5378 +++ b/arch/ppc/8260_io/uart.c Tue Aug 26 09:25:39 2003
5380 #include <asm/cpm_8260.h>
5381 #include <asm/irq.h>
5383 +#ifdef CONFIG_MAGIC_SYSRQ
5384 +#include <linux/sysrq.h>
5387 #ifdef CONFIG_SERIAL_CONSOLE
5388 #include <linux/console.h>
5391 static struct tty_driver *serial_driver;
5392 static int serial_console_setup(struct console *co, char *options);
5394 +static void serial_console_write(struct console *c, const char *s,
5396 +static kdev_t serial_console_device(struct console *c);
5398 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5399 +static unsigned long break_pressed; /* break, really ... */
5403 * Serial driver configuration section. Here are the various options:
5405 @@ -208,6 +220,15 @@
5409 +static struct console sercons = {
5411 + .write = serial_console_write,
5412 + .device = serial_console_device,
5413 + .setup = serial_console_setup,
5414 + .flags = CON_PRINTBUFFER,
5415 + .index = CONFIG_SERIAL_CONSOLE_PORT,
5418 static void change_speed(ser_info_t *info);
5419 static void rs_8xx_wait_until_sent(struct tty_struct *tty, int timeout);
5422 schedule_work(&info->tqueue);
5425 -static _INLINE_ void receive_chars(ser_info_t *info)
5426 +static _INLINE_ void receive_chars(ser_info_t *info, struct pt_regs *regs)
5428 struct tty_struct *tty = info->tty;
5429 unsigned char ch, *cp;
5430 @@ -450,6 +471,19 @@
5435 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5436 + if (break_pressed && info->line == sercons.index) {
5437 + if (ch != 0 && time_before(jiffies,
5438 + break_pressed + HZ*5)) {
5439 + handle_sysrq(ch, regs, NULL, NULL);
5440 + break_pressed = 0;
5443 + break_pressed = 0;
5447 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
5450 @@ -458,6 +492,10 @@
5454 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5458 /* This BD is ready to be used again. Clear status.
5461 @@ -475,7 +513,36 @@
5462 schedule_delayed_work(&tty->flip.work, 1);
5465 -static _INLINE_ void transmit_chars(ser_info_t *info)
5466 +static _INLINE_ void receive_break(ser_info_t *info, struct pt_regs *regs)
5468 + struct tty_struct *tty = info->tty;
5470 + info->state->icount.brk++;
5472 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
5473 + if (info->line == sercons.index) {
5474 + if (!break_pressed) {
5475 + break_pressed = jiffies;
5478 + break_pressed = 0;
5482 + /* Check to see if there is room in the tty buffer for
5483 + * the break. If not, we exit now, losing the break. FIXME
5485 + if ((tty->flip.count + 1) >= TTY_FLIPBUF_SIZE)
5487 + *(tty->flip.flag_buf_ptr++) = TTY_BREAK;
5488 + *(tty->flip.char_buf_ptr++) = 0;
5489 + tty->flip.count++;
5491 + queue_task(&tty->flip.tqueue, &tq_timer);
5495 +static _INLINE_ void transmit_chars(ser_info_t *info, struct pt_regs *regs)
5498 if (info->flags & TX_WAKEUP) {
5499 @@ -575,19 +642,23 @@
5500 if ((idx = info->state->smc_scc_num) < SCC_NUM_BASE) {
5501 smcp = &immr->im_smc[idx];
5502 events = smcp->smc_smce;
5503 + if (events & SMCM_BRKE)
5504 + receive_break(info, regs);
5505 if (events & SMCM_RX)
5506 - receive_chars(info);
5507 + receive_chars(info, regs);
5508 if (events & SMCM_TX)
5509 - transmit_chars(info);
5510 + transmit_chars(info, regs);
5511 smcp->smc_smce = events;
5514 sccp = &immr->im_scc[idx - SCC_IDX_BASE];
5515 events = sccp->scc_scce;
5516 + if (events & SMCM_BRKE)
5517 + receive_break(info, regs);
5518 if (events & SCCM_RX)
5519 - receive_chars(info);
5520 + receive_chars(info, regs);
5521 if (events & SCCM_TX)
5522 - transmit_chars(info);
5523 + transmit_chars(info, regs);
5524 sccp->scc_scce = events;
5527 @@ -2207,7 +2278,7 @@
5528 static void serial_console_write(struct console *c, const char *s,
5531 -#if defined(CONFIG_KGDB) && !defined(CONFIG_USE_SERIAL2_KGDB)
5532 +#if defined(CONFIG_KGDB_CONSOLE) && !defined(CONFIG_USE_SERIAL2_KGDB)
5533 /* Try to let stub handle output. Returns true if it did. */
5534 if (kgdb_output_string(s, count))
5536 @@ -2391,21 +2462,11 @@
5540 -static kdev_t serial_console_device(struct console *c)
5541 +static struct tty_driver *serial_console_device(struct console *c, int *index)
5544 return serial_driver;
5548 -static struct console sercons = {
5550 - .write = serial_console_write,
5551 - .device = serial_console_device,
5552 - .setup = serial_console_setup,
5553 - .flags = CON_PRINTBUFFER,
5554 - .index = CONFIG_SERIAL_CONSOLE_PORT,
5559 diff -Nru a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
5560 --- a/arch/ppc/8xx_io/cs4218_tdm.c Tue Jul 15 10:01:29 2003
5561 +++ b/arch/ppc/8xx_io/cs4218_tdm.c Tue Aug 26 09:25:40 2003
5562 @@ -2106,11 +2106,11 @@
5564 cs4218_ctl_write(cs4218_control);
5566 - sound.minDev = MINOR(inode->i_rdev) & 0x0f;
5567 + sound.minDev = iminor(inode) & 0x0f;
5568 sound.soft = sound.dsp;
5569 sound.hard = sound.dsp;
5571 - if ((MINOR(inode->i_rdev) & 0x0f) == SND_DEV_AUDIO) {
5572 + if ((iminor(inode) & 0x0f) == SND_DEV_AUDIO) {
5573 sound_set_speed(8000);
5574 sound_set_stereo(0);
5575 sound_set_format(AFMT_MU_LAW);
5576 diff -Nru a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c
5577 --- a/arch/ppc/8xx_io/uart.c Wed Jun 11 12:32:54 2003
5578 +++ b/arch/ppc/8xx_io/uart.c Thu Aug 21 15:10:37 2003
5579 @@ -1068,7 +1068,7 @@
5580 volatile cbd_t *bdp;
5584 +#ifdef CONFIG_KGDB_CONSOLE
5585 /* Try to let stub handle output. Returns true if it did. */
5586 if (kgdb_output_string(buf, count))
5588 @@ -2271,7 +2271,7 @@
5589 static void serial_console_write(struct console *c, const char *s,
5593 +#ifdef CONFIG_KGDB_CONSOLE
5594 /* Try to let stub handle output. Returns true if it did. */
5595 if (kgdb_output_string(s, count))
5597 diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig
5598 --- a/arch/ppc/Kconfig Mon Aug 4 16:10:57 2003
5599 +++ b/arch/ppc/Kconfig Sun Aug 31 16:14:22 2003
5600 @@ -795,22 +795,6 @@
5601 bool "PCI for Permedia2"
5602 depends on !4xx && !8xx && APUS
5604 -# only elf supported, a.out is not -- Cort
5607 - depends on PROC_FS
5610 - If you enabled support for /proc file system then the file
5611 - /proc/kcore will contain the kernel core image in ELF format. This
5612 - can be used in gdb:
5614 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
5616 - This is especially useful if you have compiled the kernel with the
5617 - "-g" option to preserve debugging information. It is mainly used
5618 - for examining kernel data structures on the live kernel.
5623 @@ -1277,16 +1261,11 @@
5624 floppy controller, say Y here. Most commonly found in PowerMacs.
5627 - tristate "Support for PowerMac serial ports"
5628 + tristate "Support for PowerMac serial ports (OBSOLETE DRIVER)"
5631 - If you have Macintosh style serial ports (8 pin mini-DIN), say Y
5632 - here. If you also have regular serial ports and enable the driver
5633 - for them, you can't currently use the serial console feature.
5635 -config SERIAL_CONSOLE
5636 - bool "Support for console on serial port"
5637 - depends on PPC_PMAC && MAC_SERIAL=y
5638 + This driver is obsolete. Use CONFIG_SERIAL_PMACZILOG in
5639 + "Character devices --> Serial drivers --> PowerMac z85c30" option.
5642 bool "Apple Desktop Bus (ADB) support"
5643 @@ -1426,20 +1405,12 @@
5645 bool "Include kgdb kernel debugger"
5646 depends on DEBUG_KERNEL
5649 Include in-kernel hooks for kgdb, the Linux kernel source level
5650 debugger. See <http://kgdb.sourceforge.net/> for more information.
5651 Unless you are intending to debug the kernel, say N here.
5654 - bool "Compile the kernel with debug info"
5655 - depends on DEBUG_KERNEL
5657 - If you say Y here the resulting kernel image will include
5658 - debugging info resulting in a larger kernel image.
5659 - Say Y here only if you plan to use gdb to debug the kernel.
5660 - If you don't debug the kernel, you can say N.
5663 prompt "Serial Port"
5665 @@ -1459,6 +1430,14 @@
5669 +config KGDB_CONSOLE
5670 + bool "Enable serial console thru kgdb port"
5671 + depends on KGDB && 8xx || 8260
5673 + If you enable this, all serial console messages will be sent
5674 + over the gdb stub.
5678 bool "Include xmon kernel debugger"
5679 depends on DEBUG_KERNEL
5680 @@ -1474,18 +1453,16 @@
5681 Unless you are intending to debug the kernel with one of these
5682 machines, say N here.
5684 -config MORE_COMPILE_OPTIONS
5685 - bool "Add any additional compile options"
5686 - depends on DEBUG_KERNEL && (KGDB || XMON || BDI_SWITCH)
5688 - If you want to add additional CFLAGS to the kernel build, such as -g
5689 - for KGDB or the BDI2000, enable this option and then enter what you
5690 - would like to add in the next question.
5692 -config COMPILE_OPTIONS
5693 - string "Additional compile arguments"
5694 - depends on MORE_COMPILE_OPTIONS
5695 - default "-g -ggdb"
5697 + bool "Compile the kernel with debug info"
5698 + depends on DEBUG_KERNEL
5699 + default y if BDI_SWITCH || XMON
5701 + If you say Y here the resulting kernel image will include
5702 + debugging info resulting in a larger kernel image.
5703 + Say Y here only if you plan to use some sort of debugger to
5705 + If you don't debug the kernel, you can say N.
5708 bool "Support for early boot text console (BootX or OpenFirmware only)"
5709 diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
5710 --- a/arch/ppc/Makefile Sun Jul 27 15:52:30 2003
5711 +++ b/arch/ppc/Makefile Thu Aug 21 15:10:37 2003
5714 cflags-$(CONFIG_4xx) += -Wa,-m405
5715 cflags-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
5716 -# Use sed to remove the quotes.
5717 -cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
5718 - $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
5720 CFLAGS += $(cflags-y)
5722 diff -Nru a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
5723 --- a/arch/ppc/boot/common/ns16550.c Sat Jun 28 11:06:53 2003
5724 +++ b/arch/ppc/boot/common/ns16550.c Wed Aug 20 10:24:16 2003
5728 outb(com_port + (UART_DLL << shift),
5729 - (BASE_BAUD / SERIAL_BAUD));
5730 + (BASE_BAUD / SERIAL_BAUD) & 0xFF);
5731 outb(com_port + (UART_DLM << shift),
5732 (BASE_BAUD / SERIAL_BAUD) >> 8);
5733 /* 8 data, 1 stop, no parity */
5734 diff -Nru a/arch/ppc/boot/common/util.S b/arch/ppc/boot/common/util.S
5735 --- a/arch/ppc/boot/common/util.S Tue Feb 25 11:37:43 2003
5736 +++ b/arch/ppc/boot/common/util.S Thu Aug 21 10:17:00 2003
5737 @@ -160,9 +160,22 @@
5741 +/* udelay (on non-601 processors) needs to know the period of the
5742 + * timebase in nanoseconds. This used to be hardcoded to be 60ns
5743 + * (period of 66MHz/4). Now a variable is used that is initialized to
5744 + * 60 for backward compatibility, but it can be overridden as necessary
5745 + * with code something like this:
5746 + * extern unsigned long timebase_period_ns;
5747 + * timebase_period_ns = 1000000000 / bd->bi_tbfreq;
5750 + .globl timebase_period_ns
5751 +timebase_period_ns:
5756 * Delay for a number of microseconds
5757 - * -- Use the BUS timer (assumes 66MHz)
5761 @@ -180,8 +193,13 @@
5764 mulli r4,r3,1000 /* nanoseconds */
5767 + /* Change r4 to be the number of ticks using:
5768 + * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
5769 + * timebase_period_ns defaults to 60 (16.6MHz) */
5770 + lis r5,timebase_period_ns@h
5771 + lwz r5,timebase_period_ns@l(r5)
5774 divw r4,r4,r5 /* BUS ticks */
5777 diff -Nru a/arch/ppc/boot/include/of1275.h b/arch/ppc/boot/include/of1275.h
5778 --- a/arch/ppc/boot/include/of1275.h Mon Sep 16 21:58:06 2002
5779 +++ b/arch/ppc/boot/include/of1275.h Mon Aug 25 05:13:38 2003
5781 /* function declarations */
5783 void * claim(unsigned int virt, unsigned int size, unsigned int align);
5784 +int map(unsigned int phys, unsigned int virt, unsigned int size);
5787 phandle finddevice(const char *name);
5788 diff -Nru a/arch/ppc/boot/ld.script b/arch/ppc/boot/ld.script
5789 --- a/arch/ppc/boot/ld.script Thu May 29 04:06:53 2003
5790 +++ b/arch/ppc/boot/ld.script Mon Aug 25 05:13:38 2003
5793 PROVIDE (edata = .);
5800 diff -Nru a/arch/ppc/boot/of1275/Makefile b/arch/ppc/boot/of1275/Makefile
5801 --- a/arch/ppc/boot/of1275/Makefile Sun Jun 8 01:12:49 2003
5802 +++ b/arch/ppc/boot/of1275/Makefile Mon Aug 25 09:36:40 2003
5806 lib-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \
5807 - ofstdio.o read.o release.o write.o
5808 + ofstdio.o read.o release.o write.o map.o
5809 diff -Nru a/arch/ppc/boot/of1275/map.c b/arch/ppc/boot/of1275/map.c
5810 --- /dev/null Wed Dec 31 16:00:00 1969
5811 +++ b/arch/ppc/boot/of1275/map.c Mon Aug 25 09:36:40 2003
5815 + * Copyright (C) Paul Mackerras 1997.
5816 + * Copyright (C) Leigh Brown 2002.
5818 + * This program is free software; you can redistribute it and/or
5819 + * modify it under the terms of the GNU General Public License
5820 + * as published by the Free Software Foundation; either version
5821 + * 2 of the License, or (at your option) any later version.
5824 +#include "of1275.h"
5825 +#include "nonstdio.h"
5827 +extern ihandle of_prom_mmu;
5830 +map(unsigned int phys, unsigned int virt, unsigned int size)
5832 + struct prom_args {
5837 + ihandle mmu_ihandle;
5839 + unsigned int phys;
5840 + unsigned int virt;
5841 + unsigned int size;
5846 + if (of_prom_mmu == 0) {
5847 + printf("map() called, no MMU found\n");
5850 + args.service = "call-method";
5853 + args.method = "map";
5854 + args.mmu_ihandle = of_prom_mmu;
5859 + (*of_prom_entry)(&args);
5861 + return (int)args.ret0;
5863 diff -Nru a/arch/ppc/boot/of1275/ofinit.c b/arch/ppc/boot/of1275/ofinit.c
5864 --- a/arch/ppc/boot/of1275/ofinit.c Mon Sep 16 22:18:13 2002
5865 +++ b/arch/ppc/boot/of1275/ofinit.c Mon Aug 25 05:13:38 2003
5869 prom_entry of_prom_entry;
5870 +ihandle of_prom_mmu;
5873 ofinit(prom_entry prom_ptr)
5877 of_prom_entry = prom_ptr;
5879 + if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE)
5881 + if (getprop(chosen, "mmu", &of_prom_mmu, sizeof(ihandle)) != 4)
5884 diff -Nru a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
5885 --- a/arch/ppc/boot/openfirmware/Makefile Wed Jul 23 08:39:58 2003
5886 +++ b/arch/ppc/boot/openfirmware/Makefile Mon Aug 25 05:13:38 2003
5888 images := $(boot)/images
5890 OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
5891 -COFF_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
5892 +COFF_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00500000 -Bstatic
5893 CHRP_LD_ARGS := -T $(boot)/ld.script -e _start -Ttext 0x00800000
5894 NEWWORLD_LD_ARGS:= -T $(boot)/ld.script -e _start -Ttext 0x01000000
5896 diff -Nru a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c
5897 --- a/arch/ppc/boot/openfirmware/coffmain.c Thu Nov 7 03:31:11 2002
5898 +++ b/arch/ppc/boot/openfirmware/coffmain.c Mon Aug 25 05:13:38 2003
5900 char *begin_avail, *end_avail;
5903 -#define RAM_START 0
5904 -#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
5906 -#define PROG_START RAM_START
5907 -#define PROG_SIZE 0x00700000
5909 #define SCRATCH_SIZE (128 << 10)
5911 static char heap[SCRATCH_SIZE];
5913 +static unsigned long ram_start = 0;
5914 +static unsigned long ram_end = 0x1000000;
5915 +static unsigned long prog_start = 0x800000;
5916 +static unsigned long prog_size = 0x800000;
5919 typedef void (*kernel_start_t)(int, int, void *);
5921 void boot(int a1, int a2, void *prom)
5923 unsigned initrd_start, initrd_size;
5925 printf("coffboot starting: loaded at 0x%p\n", &_start);
5926 - setup_bats(RAM_START);
5927 + setup_bats(ram_start);
5929 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
5931 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
5932 + initrd_start = (ram_end - initrd_size) & ~0xFFF;
5935 - claim(initrd_start, RAM_END - initrd_start, 0);
5936 + claim(initrd_start, ram_end - initrd_start, 0);
5937 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
5938 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
5939 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
5940 + prog_size = initrd_start - prog_start;
5944 im = (char *)(&__image_begin);
5945 len = (char *)(&__image_end) - (char *)(&__image_begin);
5946 - /* claim 4MB starting at 0 */
5947 - claim(0, PROG_SIZE, 0);
5948 - dst = (void *) RAM_START;
5949 + /* claim 4MB starting at PROG_START */
5950 + claim(prog_start, prog_size, 0);
5951 + map(prog_start, prog_start, prog_size);
5952 + dst = (void *) prog_start;
5953 if (im[0] == 0x1f && im[1] == 0x8b) {
5954 /* set up scratch space */
5955 begin_avail = avail_high = avail_ram = heap;
5956 end_avail = heap + sizeof(heap);
5957 printf("heap at 0x%p\n", avail_ram);
5958 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
5959 - gunzip(dst, PROG_SIZE, im, &len);
5960 + gunzip(dst, prog_size, im, &len);
5961 printf("done %u bytes\n", len);
5962 printf("%u bytes of heap consumed, max in use %u\n",
5963 avail_high - begin_avail, heap_max);
5966 flush_cache(dst, len);
5967 make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac,
5968 - (PROG_START + PROG_SIZE));
5969 + (prog_start + prog_size));
5971 - sa = (unsigned long)PROG_START;
5972 + sa = (unsigned long)prog_start;
5973 printf("start address = 0x%x\n", sa);
5975 (*(kernel_start_t)sa)(a1, a2, prom);
5976 diff -Nru a/arch/ppc/boot/openfirmware/misc.S b/arch/ppc/boot/openfirmware/misc.S
5977 --- a/arch/ppc/boot/openfirmware/misc.S Mon Sep 16 21:54:12 2002
5978 +++ b/arch/ppc/boot/openfirmware/misc.S Mon Aug 25 05:13:38 2003
5983 - * Use the BAT3 registers to map the 1st 8MB of RAM to
5984 + * Use the BAT2 & 3 registers to map the 1st 16MB of RAM to
5985 * the address given as the 1st argument.
5989 mtibatl 3,0 /* invalidate BAT first */
5990 ori 3,3,4 /* set up BAT registers for 601 */
6001 ori 3,3,0xff /* set up BAT registers for 604 */
6012 diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
6013 --- a/arch/ppc/boot/simple/Makefile Tue Jul 1 17:01:18 2003
6014 +++ b/arch/ppc/boot/simple/Makefile Mon Aug 18 09:44:01 2003
6016 # get_mem_size(), which is memory controller dependent. Add in the correct
6017 # XXX_memory.o file for this to work, as well as editing the $(MISC) file.
6021 boot := arch/ppc/boot
6022 common := $(boot)/common
6025 # Normally, we use the 'misc.c' file for decompress_kernel and
6026 # whatnot. Sometimes we need to override this however.
6028 -ifeq ($(CONFIG_IBM_OPENBIOS),y)
6029 -ZIMAGE := zImage-TREE
6030 -ZIMAGEINITRD := zImage.initrd-TREE
6032 -TFTPIMAGE := /tftpboot/zImage.$(END)
6033 -MISC := misc-embedded.o
6035 -ifeq ($(CONFIG_EMBEDDEDBOOT),y)
6036 -TFTPIMAGE := /tftpboot/zImage.embedded
6037 -MISC := misc-embedded.o
6039 -ifeq ($(CONFIG_EBONY),y)
6040 -ZIMAGE := zImage-TREE
6041 -ZIMAGEINITRD := zImage.initrd-TREE
6043 -ENTRYPOINT := 0x01000000
6044 -TFTPIMAGE := /tftpboot/zImage.$(END)
6046 -ifeq ($(CONFIG_EV64260),y)
6047 -EXTRA := misc-ev64260.o
6048 -TFTPIMAGE := /tftpboot/zImage.ev64260
6050 -ifeq ($(CONFIG_GEMINI),y)
6051 -ZIMAGE := zImage-STRIPELF
6052 -ZIMAGEINITRD := zImage.initrd-STRIPELF
6054 -TFTPIMAGE := /tftpboot/zImage.$(END)
6056 -ifeq ($(CONFIG_K2),y)
6058 -TFTPIMAGE := /tftpboot/zImage.k2
6060 -# kbuild-2.4 'feature', only one of these will ever by 'y' at a time.
6064 +# See arch/ppc/kconfig and arch/ppc/platforms/Kconfig
6065 +# for definition of what platform each config option refer to.
6066 +#----------------------------------------------------------------------------
6067 + zimage-$(CONFIG_IBM_OPENBIOS) := zImage-TREE
6068 +zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE
6069 + end-$(CONFIG_IBM_OPENBIOS) := treeboot
6070 + tftpimage-$(CONFIG_IBM_OPENBIOS) := /tftpboot/zImage.$(end-y)
6071 + misc-$(CONFIG_IBM_OPENBIOS) := misc-embedded.o
6073 + tftpimage-$(CONFIG_EMBEDDEDBOOT) := /tftpboot/zImage.embedded
6074 + misc-$(CONFIG_EMBEDDEDBOOT) := misc-embedded.o
6076 + zimage-$(CONFIG_EBONY) := zImage-TREE
6077 +zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE
6078 + extra.o-$(CONFIG_EBONY) := direct.o
6079 + end-$(CONFIG_EBONY) := ebony
6080 + entrypoint-$(CONFIG_EBONY) := 0x01000000
6081 + tftpimage-$(CONFIG_EBONY) := /tftpboot/zImage.$(end-y)
6083 + extra.o-$(CONFIG_EV64260) := direct.o misc-ev64260.o
6084 + tftpimage-$(CONFIG_EV64260) := /tftpboot/zImage.ev64260
6086 + zimage-$(CONFIG_GEMINI) := zImage-STRIPELF
6087 +zimageinitrd-$(CONFIG_GEMINI) := zImage.initrd-STRIPELF
6088 + end-$(CONFIG_GEMINI) := gemini
6089 + tftpimage-$(CONFIG_GEMINI) := /tftpboot/zImage.$(end-y)
6091 + extra.o-$(CONFIG_K2) := legacy.o
6092 + tftpimage-$(CONFIG_K2) := /tftpboot/zImage.k2
6094 +# kconfig 'feature', only one of these will ever by 'y' at a time.
6095 # The rest will be unset.
6096 -ifeq ($(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750)$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS),y)
6097 -ZIMAGE := zImage-PPLUS
6098 -ZIMAGEINITRD := zImage.initrd-PPLUS
6099 -TFTPIMAGE := /tftpboot/zImage.pplus
6100 -ZNETBOOT := zImage.pplus
6101 -ZNETBOOTRD := zImage.initrd.pplus
6103 -ifeq ($(CONFIG_PPLUS),y)
6106 -ifeq ($(CONFIG_PCORE)$(CONFIG_POWERPMC250),y)
6107 -ZIMAGE := zImage-STRIPELF
6108 -ZIMAGEINITRD := zImage.initrd-STRIPELF
6111 -TFTPIMAGE := /tftpboot/zImage.$(END)
6113 -ifeq ($(CONFIG_SANDPOINT),y)
6114 -TFTPIMAGE := /tftpboot/zImage.sandpoint
6116 -ifeq ($(CONFIG_SPRUCE),y)
6117 -ZIMAGE := zImage-TREE
6118 -ZIMAGEINITRD := zImage.initrd-TREE
6120 -ENTRYPOINT := 0x00800000
6121 -MISC := misc-spruce.o
6122 -TFTPIMAGE := /tftpboot/zImage.$(END)
6124 -ifeq ($(CONFIG_SMP),y)
6127 -ifeq ($(CONFIG_REDWOOD_4),y)
6128 +multi := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \
6129 +$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS)
6130 + zimage-$(multi) := zImage-PPLUS
6131 +zimageinitrd-$(multi) := zImage.initrd-PPLUS
6132 + tftpimage-$(multi) := /tftpboot/zImage.pplus
6133 + znetboot-$(multi) := zImage.pplus
6134 + znetbootrd-$(multi) := zImage.initrd.pplus
6136 +# Overrides previous assingment
6137 + extra.o-$(CONFIG_PPLUS) := legacy.o
6139 + zimage-$(CONFIG_PCORE) := zImage-STRIPELF
6140 +zimageinitrd-$(CONFIG_PCORE) := zImage.initrd-STRIPELF
6141 + extra.o-$(CONFIG_PCORE) := chrpmap.o
6142 + end-$(CONFIG_PCORE) := pcore
6143 + tftpimage-$(CONFIG_PCORE) := /tftpboot/zImage.$(end-y)
6145 + zimage-$(CONFIG_POWERPMC250) := zImage-STRIPELF
6146 +zimageinitrd-$(CONFIG_POWERPMC250) := zImage.initrd-STRIPELF
6147 + extra.o-$(CONFIG_POWERPMC250) := chrpmap.o
6148 + end-$(CONFIG_POWERPMC250) := pcore
6149 + tftpimage-$(CONFIG_POWERPMC250) := /tftpboot/zImage.$(end-y)
6151 + tftpimage-$(CONFIG_SANDPOINT) := /tftpboot/zImage.sandpoint
6153 + zimage-$(CONFIG_SPRUCE) := zImage-TREE
6154 +zimageinitrd-$(CONFIG_SPRUCE) := zImage.initrd-TREE
6155 + end-$(CONFIG_SPRUCE) := spruce
6156 + entrypoint-$(CONFIG_SPRUCE) := 0x00800000
6157 + misc-$(CONFIG_SPRUCE) := misc-spruce.o
6158 + tftpimage-$(CONFIG_SPRUCE) := /tftpboot/zImage.$(end-y)
6161 +# tftp image is prefixed with .smp if compiled for SMP
6162 +tftpimage-$(CONFIG_SMP) += .smp
6164 # This is a treeboot that needs init functions until the
6165 # boot rom is sorted out (i.e. this is short lived)
6166 -EXTRA_AFLAGS := -Wa,-m405
6167 -EXTRA := rw4/rw4_init.o rw4/rw4_init_brd.o
6169 +extra-aflags-$(CONFIG_REDWOOD_4) := -Wa,-m405
6170 +extra.o-$(CONFIG_REDWOOD_4) := rw4/rw4_init.o rw4/rw4_init_brd.o
6171 +EXTRA_AFLAGS := $(extra-aflags-y)
6173 # Linker args. This specifies where the image will be run at.
6174 -LD_ARGS = -T $(boot)/ld.script \
6175 - -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
6176 +LD_ARGS := -T $(boot)/ld.script \
6177 + -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
6178 OBJCOPY_ARGS := -O elf32-powerpc
6180 # head.o and relocate.o must be at the start.
6181 -boot-y := head.o relocate.o $(EXTRA) $(MISC)
6182 +boot-y := head.o relocate.o $(extra.o-y) $(misc-y)
6183 boot-$(CONFIG_40x) += embed_config.o
6184 boot-$(CONFIG_8xx) += embed_config.o
6185 boot-$(CONFIG_8260) += embed_config.o
6186 @@ -160,40 +163,40 @@
6187 -R .stabstr -R .sysmap
6189 # Sort-of dummy rules, that let us format the image we want.
6190 -zImage: $(images)/$(ZIMAGE) $(obj)/zvmlinux
6191 +zImage: $(images)/$(zimage-y) $(obj)/zvmlinux
6192 cp -f $(obj)/zvmlinux $(images)/zImage.elf
6193 rm -f $(obj)/zvmlinux
6195 -zImage.initrd: $(images)/$(ZIMAGEINITRD) $(obj)/zvmlinux.initrd
6196 +zImage.initrd: $(images)/$(zimageinitrd-y) $(obj)/zvmlinux.initrd
6197 cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf
6198 rm -f $(obj)/zvmlinux.initrd
6201 ifneq ($(ZNETBOOT),)
6202 - cp $(images)/$(ZNETBOOT) $(TFTPIMAGE)
6203 + cp $(images)/$(ZNETBOOT) $(tftpimage-y)
6205 - cp $(images)/zImage.* $(TFTPIMAGE)
6206 + cp $(images)/zImage.* $(tftpimage-y)
6209 znetboot.initrd: zImage.initrd
6210 -ifneq ($(ZNETBOOTRD),)
6211 - cp $(images)/$(ZNETBOOTRD) $(TFTPIMAGE)
6212 +ifneq ($(znetbootrd-y),)
6213 + cp $(images)/$(znetbootrd-y) $(tftpimage-y)
6215 - cp $(images)/zImage.* $(TFTPIMAGE)
6216 + cp $(images)/zImage.* $(tftpimage-y)
6219 $(images)/zImage-STRIPELF: $(obj)/zvmlinux
6220 - dd if=$(obj)/zvmlinux of=$(images)/zImage.$(END) skip=64 bs=1k
6221 + dd if=$(obj)/zvmlinux of=$(images)/zImage.$(end-y) skip=64 bs=1k
6223 $(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
6224 - dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(END) \
6225 + dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(end-y) \
6228 $(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE)
6229 - $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(END) $(ENTRYPOINT)
6230 + $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT)
6232 $(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE)
6233 - $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(END) \
6234 + $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \
6237 $(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
6238 diff -Nru a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c
6239 --- a/arch/ppc/boot/simple/embed_config.c Sat Mar 22 17:18:48 2003
6240 +++ b/arch/ppc/boot/simple/embed_config.c Thu Aug 21 10:17:00 2003
6245 +extern unsigned long timebase_period_ns;
6247 /* For those boards that don't provide one.
6250 #if defined(CONFIG_REDWOOD_5) || defined (CONFIG_REDWOOD_6)
6251 bd->bi_tbfreq = 27 * 1000 * 1000;
6253 + timebase_period_ns = 1000000000 / bd->bi_tbfreq;
6255 #endif /* CONFIG_BEECH */
6256 #endif /* CONFIG_IBM_OPENBIOS */
6257 diff -Nru a/arch/ppc/boot/simple/misc-embedded.c b/arch/ppc/boot/simple/misc-embedded.c
6258 --- a/arch/ppc/boot/simple/misc-embedded.c Thu Jun 5 18:06:12 2003
6259 +++ b/arch/ppc/boot/simple/misc-embedded.c Wed Aug 20 15:44:31 2003
6261 extern void embed_config(bd_t **bp);
6264 -decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp)
6265 +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum, bd_t *bp)
6268 int timer = 0, zimage_size;
6269 diff -Nru a/arch/ppc/boot/simple/misc-spruce.c b/arch/ppc/boot/simple/misc-spruce.c
6270 --- a/arch/ppc/boot/simple/misc-spruce.c Tue Feb 11 15:48:52 2003
6271 +++ b/arch/ppc/boot/simple/misc-spruce.c Wed Aug 20 15:44:31 2003
6273 #define MEM_B2EA 0x60
6276 -decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6277 +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6281 diff -Nru a/arch/ppc/boot/simple/misc.c b/arch/ppc/boot/simple/misc.c
6282 --- a/arch/ppc/boot/simple/misc.c Tue Feb 11 15:48:52 2003
6283 +++ b/arch/ppc/boot/simple/misc.c Wed Aug 20 15:44:31 2003
6284 @@ -252,3 +252,10 @@
6286 return (struct bi_record *)rec_loc;
6289 +/* Allow decompress_kernel to be hooked into. This is the default. */
6290 +void * __attribute__ ((weak))
6291 +load_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
6293 + return decompress_kernel(load_addr, num_words, cksum);
6295 diff -Nru a/arch/ppc/boot/simple/relocate.S b/arch/ppc/boot/simple/relocate.S
6296 --- a/arch/ppc/boot/simple/relocate.S Tue Feb 11 15:48:52 2003
6297 +++ b/arch/ppc/boot/simple/relocate.S Wed Aug 20 15:44:31 2003
6299 mr r4,r7 /* Program length */
6300 mr r5,r6 /* Checksum */
6301 mr r6,r11 /* Residual data */
6302 - bl decompress_kernel
6306 * Make sure the kernel knows we don't have things set in
6307 diff -Nru a/arch/ppc/boot/utils/mktree.c b/arch/ppc/boot/utils/mktree.c
6308 --- a/arch/ppc/boot/utils/mktree.c Sun Sep 15 21:51:58 2002
6309 +++ b/arch/ppc/boot/utils/mktree.c Thu Aug 21 15:00:42 2003
6316 for (i=0; i<sizeof(bt)/sizeof(uint); i++)
6319 diff -Nru a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
6320 --- a/arch/ppc/configs/common_defconfig Sat Aug 2 13:06:57 2003
6321 +++ b/arch/ppc/configs/common_defconfig Sat Aug 23 02:33:38 2003
6323 # Code maturity level options
6325 CONFIG_EXPERIMENTAL=y
6326 +# CONFIG_BROKEN is not set
6331 # CONFIG_BSD_PROCESS_ACCT is not set
6333 CONFIG_LOG_BUF_SHIFT=14
6335 +CONFIG_IKCONFIG_PROC=y
6336 # CONFIG_EMBEDDED is not set
6340 +CONFIG_IOSCHED_NOOP=y
6341 +CONFIG_IOSCHED_AS=y
6342 +CONFIG_IOSCHED_DEADLINE=y
6345 # Loadable module support
6348 CONFIG_PCI_DOMAINS=y
6350 -CONFIG_BINFMT_ELF=y
6352 +CONFIG_BINFMT_ELF=y
6353 CONFIG_BINFMT_MISC=m
6354 CONFIG_PCI_LEGACY_PROC=y
6356 @@ -126,6 +133,11 @@
6357 CONFIG_BOOT_LOAD=0x00800000
6360 +# Generic Driver Options
6362 +# CONFIG_FW_LOADER is not set
6365 # Memory Technology Devices (MTD)
6367 # CONFIG_MTD is not set
6368 @@ -144,10 +156,12 @@
6369 # CONFIG_BLK_DEV_DAC960 is not set
6370 # CONFIG_BLK_DEV_UMEM is not set
6371 CONFIG_BLK_DEV_LOOP=y
6372 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6373 # CONFIG_BLK_DEV_NBD is not set
6374 CONFIG_BLK_DEV_RAM=y
6375 CONFIG_BLK_DEV_RAM_SIZE=4096
6376 CONFIG_BLK_DEV_INITRD=y
6380 # Multi-device support (RAID and LVM)
6381 @@ -155,40 +169,38 @@
6382 # CONFIG_MD is not set
6385 -# ATA/IDE/MFM/RLL support
6386 +# ATA/ATAPI/MFM/RLL support
6391 -# IDE, ATA and ATAPI Block devices
6393 CONFIG_BLK_DEV_IDE=y
6396 # Please see Documentation/ide.txt for help/info on IDE drives
6398 -# CONFIG_BLK_DEV_HD is not set
6399 CONFIG_BLK_DEV_IDEDISK=y
6400 # CONFIG_IDEDISK_MULTI_MODE is not set
6401 # CONFIG_IDEDISK_STROKE is not set
6402 CONFIG_BLK_DEV_IDECD=y
6403 +# CONFIG_BLK_DEV_IDETAPE is not set
6404 CONFIG_BLK_DEV_IDEFLOPPY=y
6405 CONFIG_BLK_DEV_IDESCSI=y
6406 # CONFIG_IDE_TASK_IOCTL is not set
6407 +# CONFIG_IDE_TASKFILE_IO is not set
6410 # IDE chipset support/bugfixes
6412 CONFIG_BLK_DEV_IDEPCI=y
6413 -CONFIG_BLK_DEV_GENERIC=y
6414 CONFIG_IDEPCI_SHARE_IRQ=y
6415 +# CONFIG_BLK_DEV_OFFBOARD is not set
6416 +CONFIG_BLK_DEV_GENERIC=y
6417 +# CONFIG_BLK_DEV_OPTI621 is not set
6418 +CONFIG_BLK_DEV_SL82C105=y
6419 CONFIG_BLK_DEV_IDEDMA_PCI=y
6420 # CONFIG_BLK_DEV_IDE_TCQ is not set
6421 -# CONFIG_BLK_DEV_OFFBOARD is not set
6422 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
6423 CONFIG_IDEDMA_PCI_AUTO=y
6424 # CONFIG_IDEDMA_ONLYDISK is not set
6425 -CONFIG_BLK_DEV_IDEDMA=y
6426 # CONFIG_IDEDMA_PCI_WIP is not set
6427 CONFIG_BLK_DEV_ADMA=y
6428 # CONFIG_BLK_DEV_AEC62XX is not set
6429 @@ -198,12 +210,12 @@
6430 # CONFIG_BLK_DEV_TRIFLEX is not set
6431 # CONFIG_BLK_DEV_CY82C693 is not set
6432 # CONFIG_BLK_DEV_CS5520 is not set
6433 +# CONFIG_BLK_DEV_CS5530 is not set
6434 # CONFIG_BLK_DEV_HPT34X is not set
6435 # CONFIG_BLK_DEV_HPT366 is not set
6436 # CONFIG_BLK_DEV_SC1200 is not set
6437 # CONFIG_BLK_DEV_PIIX is not set
6438 # CONFIG_BLK_DEV_NS87415 is not set
6439 -# CONFIG_BLK_DEV_OPTI621 is not set
6440 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
6441 CONFIG_BLK_DEV_PDC202XX_NEW=y
6442 # CONFIG_PDC202XX_FORCE is not set
6443 @@ -212,15 +224,17 @@
6444 # CONFIG_BLK_DEV_SLC90E66 is not set
6445 # CONFIG_BLK_DEV_TRM290 is not set
6446 # CONFIG_BLK_DEV_VIA82CXXX is not set
6447 -CONFIG_BLK_DEV_SL82C105=y
6448 CONFIG_BLK_DEV_IDE_PMAC=y
6449 CONFIG_BLK_DEV_IDEDMA_PMAC=y
6450 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
6451 -CONFIG_IDEDMA_AUTO=y
6452 +CONFIG_BLK_DEV_IDEDMA=y
6453 # CONFIG_IDEDMA_IVB is not set
6454 +CONFIG_IDEDMA_AUTO=y
6455 +# CONFIG_DMA_NONPCI is not set
6456 +# CONFIG_BLK_DEV_HD is not set
6460 +# SCSI device support
6465 # CONFIG_SCSI_AIC79XX is not set
6466 # CONFIG_SCSI_DPT_I2O is not set
6467 CONFIG_SCSI_ADVANSYS=m
6468 -# CONFIG_SCSI_IN2000 is not set
6469 -# CONFIG_SCSI_AM53C974 is not set
6470 # CONFIG_SCSI_MEGARAID is not set
6471 # CONFIG_SCSI_BUSLOGIC is not set
6472 # CONFIG_SCSI_CPQFCTS is not set
6473 @@ -270,11 +282,8 @@
6474 # CONFIG_SCSI_EATA_PIO is not set
6475 # CONFIG_SCSI_FUTURE_DOMAIN is not set
6476 # CONFIG_SCSI_GDTH is not set
6477 -# CONFIG_SCSI_GENERIC_NCR5380 is not set
6478 -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
6479 # CONFIG_SCSI_INITIO is not set
6480 # CONFIG_SCSI_INIA100 is not set
6481 -# CONFIG_SCSI_NCR53C7xx is not set
6482 CONFIG_SCSI_SYM53C8XX_2=y
6483 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
6484 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
6486 # CONFIG_SCSI_QLOGIC_1280 is not set
6487 # CONFIG_SCSI_DC395x is not set
6488 # CONFIG_SCSI_DC390T is not set
6489 -# CONFIG_SCSI_U14_34F is not set
6490 # CONFIG_SCSI_NSP32 is not set
6491 # CONFIG_SCSI_DEBUG is not set
6495 # CONFIG_PACKET_MMAP is not set
6496 # CONFIG_NETLINK_DEV is not set
6498 -# CONFIG_NETFILTER_DEBUG is not set
6500 # CONFIG_NET_KEY is not set
6502 @@ -340,6 +346,16 @@
6503 # CONFIG_INET_IPCOMP is not set
6506 +# IP: Virtual Server Configuration
6508 +# CONFIG_IP_VS is not set
6509 +# CONFIG_IPV6 is not set
6510 +# CONFIG_DECNET is not set
6511 +# CONFIG_BRIDGE is not set
6513 +# CONFIG_NETFILTER_DEBUG is not set
6516 # IP: Netfilter Configuration
6518 CONFIG_IP_NF_CONNTRACK=m
6520 CONFIG_IP_NF_MATCH_MARK=m
6521 CONFIG_IP_NF_MATCH_MULTIPORT=m
6522 CONFIG_IP_NF_MATCH_TOS=m
6523 +CONFIG_IP_NF_MATCH_RECENT=m
6524 CONFIG_IP_NF_MATCH_ECN=m
6525 CONFIG_IP_NF_MATCH_DSCP=m
6526 CONFIG_IP_NF_MATCH_AH_ESP=m
6528 # CONFIG_IP_NF_ARPTABLES is not set
6529 CONFIG_IP_NF_COMPAT_IPCHAINS=m
6530 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
6531 -# CONFIG_IPV6 is not set
6532 -# CONFIG_XFRM_USER is not set
6535 # SCTP Configuration (EXPERIMENTAL)
6537 # CONFIG_ATM is not set
6538 # CONFIG_VLAN_8021Q is not set
6539 # CONFIG_LLC is not set
6540 -# CONFIG_DECNET is not set
6541 -# CONFIG_BRIDGE is not set
6542 # CONFIG_X25 is not set
6543 # CONFIG_LAPB is not set
6544 # CONFIG_NET_DIVERT is not set
6546 # CONFIG_HAMACHI is not set
6547 # CONFIG_YELLOWFIN is not set
6548 # CONFIG_R8169 is not set
6549 +# CONFIG_SIS190 is not set
6550 # CONFIG_SK98LIN is not set
6551 # CONFIG_TIGON3 is not set
6558 +# CONFIG_FB_CIRRUS is not set
6559 # CONFIG_FB_PM2 is not set
6560 # CONFIG_FB_CYBER2000 is not set
6562 @@ -606,11 +620,6 @@
6563 CONFIG_LOGO_LINUX_CLUT224=y
6566 -# Old CD-ROM drivers (not SCSI, not IDE)
6568 -# CONFIG_CD_NO_IDESCSI is not set
6571 # Input device support
6575 CONFIG_SERIO_I8042=y
6576 # CONFIG_SERIO_SERPORT is not set
6577 # CONFIG_SERIO_CT82C710 is not set
6578 +# CONFIG_SERIO_PCIPS2 is not set
6581 # Input Device Drivers
6582 @@ -703,10 +713,12 @@
6584 # I2C Hardware Sensors Mainboard support
6586 +# CONFIG_I2C_ALI1535 is not set
6587 # CONFIG_I2C_ALI15X3 is not set
6588 # CONFIG_I2C_AMD756 is not set
6589 # CONFIG_I2C_AMD8111 is not set
6590 # CONFIG_I2C_I801 is not set
6591 +# CONFIG_I2C_NFORCE2 is not set
6592 # CONFIG_I2C_PIIX4 is not set
6593 # CONFIG_I2C_SIS96X is not set
6594 # CONFIG_I2C_VIAPRO is not set
6596 # CONFIG_SENSORS_IT87 is not set
6597 # CONFIG_SENSORS_LM75 is not set
6598 # CONFIG_SENSORS_LM85 is not set
6599 +# CONFIG_SENSORS_LM78 is not set
6600 # CONFIG_SENSORS_VIA686A is not set
6601 # CONFIG_SENSORS_W83781D is not set
6602 # CONFIG_I2C_SENSOR is not set
6603 @@ -913,13 +926,70 @@
6607 -CONFIG_DMASOUND_AWACS=m
6609 +# CONFIG_DMASOUND_AWACS is not set
6612 # Advanced Linux Sound Architecture
6614 -# CONFIG_SND is not set
6616 +CONFIG_SND_SEQUENCER=m
6617 +# CONFIG_SND_SEQ_DUMMY is not set
6618 +CONFIG_SND_OSSEMUL=y
6619 +CONFIG_SND_MIXER_OSS=m
6620 +CONFIG_SND_PCM_OSS=m
6621 +CONFIG_SND_SEQUENCER_OSS=y
6622 +# CONFIG_SND_VERBOSE_PRINTK is not set
6623 +# CONFIG_SND_DEBUG is not set
6628 +# CONFIG_SND_DUMMY is not set
6629 +# CONFIG_SND_VIRMIDI is not set
6630 +# CONFIG_SND_MTPAV is not set
6631 +# CONFIG_SND_SERIAL_U16550 is not set
6632 +# CONFIG_SND_MPU401 is not set
6637 +# CONFIG_SND_ALI5451 is not set
6638 +# CONFIG_SND_AZT3328 is not set
6639 +# CONFIG_SND_CS46XX is not set
6640 +# CONFIG_SND_CS4281 is not set
6641 +# CONFIG_SND_EMU10K1 is not set
6642 +# CONFIG_SND_KORG1212 is not set
6643 +# CONFIG_SND_NM256 is not set
6644 +# CONFIG_SND_RME32 is not set
6645 +# CONFIG_SND_RME96 is not set
6646 +# CONFIG_SND_RME9652 is not set
6647 +# CONFIG_SND_HDSP is not set
6648 +# CONFIG_SND_TRIDENT is not set
6649 +# CONFIG_SND_YMFPCI is not set
6650 +# CONFIG_SND_ALS4000 is not set
6651 +# CONFIG_SND_CMIPCI is not set
6652 +# CONFIG_SND_ENS1370 is not set
6653 +# CONFIG_SND_ENS1371 is not set
6654 +# CONFIG_SND_ES1938 is not set
6655 +# CONFIG_SND_ES1968 is not set
6656 +# CONFIG_SND_MAESTRO3 is not set
6657 +# CONFIG_SND_FM801 is not set
6658 +# CONFIG_SND_ICE1712 is not set
6659 +# CONFIG_SND_ICE1724 is not set
6660 +# CONFIG_SND_INTEL8X0 is not set
6661 +# CONFIG_SND_SONICVIBES is not set
6662 +# CONFIG_SND_VIA82XX is not set
6663 +# CONFIG_SND_VX222 is not set
6666 +# ALSA PowerMac devices
6668 +CONFIG_SND_POWERMAC=m
6673 +CONFIG_SND_USB_AUDIO=m
6677 @@ -998,6 +1068,7 @@
6679 # USB Network adaptors
6681 +# CONFIG_USB_AX8817X is not set
6682 # CONFIG_USB_CATC is not set
6683 # CONFIG_USB_KAWETH is not set
6684 # CONFIG_USB_PEGASUS is not set
6685 @@ -1074,7 +1145,6 @@
6688 # CONFIG_DEBUG_KERNEL is not set
6693 diff -Nru a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig
6694 --- a/arch/ppc/configs/ibmchrp_defconfig Tue Jul 1 17:01:18 2003
6695 +++ b/arch/ppc/configs/ibmchrp_defconfig Sat Aug 23 02:33:38 2003
6697 # Code maturity level options
6699 CONFIG_EXPERIMENTAL=y
6700 +# CONFIG_BROKEN is not set
6705 # CONFIG_BSD_PROCESS_ACCT is not set
6707 CONFIG_LOG_BUF_SHIFT=14
6709 +CONFIG_IKCONFIG_PROC=y
6710 # CONFIG_EMBEDDED is not set
6714 +CONFIG_IOSCHED_NOOP=y
6715 +CONFIG_IOSCHED_AS=y
6716 +CONFIG_IOSCHED_DEADLINE=y
6719 # Loadable module support
6722 CONFIG_PCI_DOMAINS=y
6724 -CONFIG_BINFMT_ELF=y
6726 +CONFIG_BINFMT_ELF=y
6727 CONFIG_BINFMT_MISC=y
6728 CONFIG_PCI_LEGACY_PROC=y
6730 @@ -116,6 +123,10 @@
6731 CONFIG_BOOT_LOAD=0x00800000
6734 +# Generic Driver Options
6738 # Memory Technology Devices (MTD)
6740 # CONFIG_MTD is not set
6741 @@ -134,10 +145,12 @@
6742 # CONFIG_BLK_DEV_DAC960 is not set
6743 # CONFIG_BLK_DEV_UMEM is not set
6744 CONFIG_BLK_DEV_LOOP=y
6745 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6746 # CONFIG_BLK_DEV_NBD is not set
6747 CONFIG_BLK_DEV_RAM=y
6748 CONFIG_BLK_DEV_RAM_SIZE=4096
6749 CONFIG_BLK_DEV_INITRD=y
6753 # Multi-device support (RAID and LVM)
6754 @@ -145,12 +158,12 @@
6755 # CONFIG_MD is not set
6758 -# ATA/IDE/MFM/RLL support
6759 +# ATA/ATAPI/MFM/RLL support
6761 # CONFIG_IDE is not set
6765 +# SCSI device support
6770 # CONFIG_SCSI_AIC79XX is not set
6771 # CONFIG_SCSI_DPT_I2O is not set
6772 # CONFIG_SCSI_ADVANSYS is not set
6773 -# CONFIG_SCSI_IN2000 is not set
6774 -# CONFIG_SCSI_AM53C974 is not set
6775 # CONFIG_SCSI_MEGARAID is not set
6776 # CONFIG_SCSI_BUSLOGIC is not set
6777 # CONFIG_SCSI_CPQFCTS is not set
6778 @@ -193,11 +204,8 @@
6779 # CONFIG_SCSI_EATA_PIO is not set
6780 # CONFIG_SCSI_FUTURE_DOMAIN is not set
6781 # CONFIG_SCSI_GDTH is not set
6782 -# CONFIG_SCSI_GENERIC_NCR5380 is not set
6783 -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
6784 # CONFIG_SCSI_INITIO is not set
6785 # CONFIG_SCSI_INIA100 is not set
6786 -# CONFIG_SCSI_NCR53C7xx is not set
6787 CONFIG_SCSI_SYM53C8XX_2=y
6788 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
6789 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
6791 # CONFIG_SCSI_QLOGIC_1280 is not set
6792 # CONFIG_SCSI_DC395x is not set
6793 # CONFIG_SCSI_DC390T is not set
6794 -# CONFIG_SCSI_U14_34F is not set
6795 # CONFIG_SCSI_NSP32 is not set
6796 # CONFIG_SCSI_DEBUG is not set
6797 # CONFIG_SCSI_MESH is not set
6800 # CONFIG_PACKET_MMAP is not set
6801 # CONFIG_NETLINK_DEV is not set
6803 -# CONFIG_NETFILTER_DEBUG is not set
6805 # CONFIG_NET_KEY is not set
6807 @@ -261,6 +266,16 @@
6808 # CONFIG_INET_IPCOMP is not set
6811 +# IP: Virtual Server Configuration
6813 +# CONFIG_IP_VS is not set
6814 +# CONFIG_IPV6 is not set
6815 +# CONFIG_DECNET is not set
6816 +# CONFIG_BRIDGE is not set
6818 +# CONFIG_NETFILTER_DEBUG is not set
6821 # IP: Netfilter Configuration
6823 CONFIG_IP_NF_CONNTRACK=m
6825 CONFIG_IP_NF_MATCH_MARK=m
6826 CONFIG_IP_NF_MATCH_MULTIPORT=m
6827 CONFIG_IP_NF_MATCH_TOS=m
6828 +CONFIG_IP_NF_MATCH_RECENT=m
6829 CONFIG_IP_NF_MATCH_ECN=m
6830 CONFIG_IP_NF_MATCH_DSCP=m
6831 CONFIG_IP_NF_MATCH_AH_ESP=m
6832 @@ -306,10 +322,9 @@
6833 CONFIG_IP_NF_TARGET_TCPMSS=m
6834 CONFIG_IP_NF_ARPTABLES=m
6835 CONFIG_IP_NF_ARPFILTER=m
6836 +CONFIG_IP_NF_ARP_MANGLE=m
6837 CONFIG_IP_NF_COMPAT_IPCHAINS=m
6838 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
6839 -# CONFIG_IPV6 is not set
6840 -# CONFIG_XFRM_USER is not set
6843 # SCTP Configuration (EXPERIMENTAL)
6845 # CONFIG_ATM is not set
6846 # CONFIG_VLAN_8021Q is not set
6847 # CONFIG_LLC is not set
6848 -# CONFIG_DECNET is not set
6849 -# CONFIG_BRIDGE is not set
6850 # CONFIG_X25 is not set
6851 # CONFIG_LAPB is not set
6852 # CONFIG_NET_DIVERT is not set
6854 # CONFIG_HAMACHI is not set
6855 # CONFIG_YELLOWFIN is not set
6856 # CONFIG_R8169 is not set
6857 +# CONFIG_SIS190 is not set
6858 # CONFIG_SK98LIN is not set
6859 # CONFIG_TIGON3 is not set
6861 @@ -495,11 +509,6 @@
6862 CONFIG_LOGO_LINUX_CLUT224=y
6865 -# Old CD-ROM drivers (not SCSI, not IDE)
6867 -# CONFIG_CD_NO_IDESCSI is not set
6870 # Input device support
6874 CONFIG_SERIO_I8042=y
6875 CONFIG_SERIO_SERPORT=y
6876 # CONFIG_SERIO_CT82C710 is not set
6877 +# CONFIG_SERIO_PCIPS2 is not set
6880 # Input Device Drivers
6884 # CONFIG_DEBUG_KERNEL is not set
6886 # CONFIG_BOOTX_TEXT is not set
6889 diff -Nru a/arch/ppc/configs/mcpn765_defconfig b/arch/ppc/configs/mcpn765_defconfig
6890 --- a/arch/ppc/configs/mcpn765_defconfig Tue Jul 1 17:01:18 2003
6891 +++ b/arch/ppc/configs/mcpn765_defconfig Mon Jul 21 09:05:22 2003
6894 CONFIG_LOG_BUF_SHIFT=14
6895 # CONFIG_EMBEDDED is not set
6902 CONFIG_PCI_DOMAINS=y
6904 -CONFIG_BINFMT_ELF=y
6906 +CONFIG_BINFMT_ELF=y
6907 # CONFIG_BINFMT_MISC is not set
6908 # CONFIG_PCI_LEGACY_PROC is not set
6909 # CONFIG_PCI_NAMES is not set
6910 @@ -104,6 +105,11 @@
6911 CONFIG_BOOT_LOAD=0x00800000
6914 +# Generic Driver Options
6916 +# CONFIG_FW_LOADER is not set
6919 # Memory Technology Devices (MTD)
6921 # CONFIG_MTD is not set
6922 @@ -122,10 +128,12 @@
6923 # CONFIG_BLK_DEV_DAC960 is not set
6924 # CONFIG_BLK_DEV_UMEM is not set
6925 CONFIG_BLK_DEV_LOOP=y
6926 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
6927 # CONFIG_BLK_DEV_NBD is not set
6928 CONFIG_BLK_DEV_RAM=y
6929 CONFIG_BLK_DEV_RAM_SIZE=4096
6930 CONFIG_BLK_DEV_INITRD=y
6931 +# CONFIG_LBD is not set
6934 # Multi-device support (RAID and LVM)
6935 @@ -133,12 +141,12 @@
6936 # CONFIG_MD is not set
6939 -# ATA/IDE/MFM/RLL support
6940 +# ATA/ATAPI/MFM/RLL support
6942 # CONFIG_IDE is not set
6946 +# SCSI device support
6948 # CONFIG_SCSI is not set
6950 @@ -320,11 +328,6 @@
6951 # CONFIG_FB is not set
6954 -# Old CD-ROM drivers (not SCSI, not IDE)
6956 -# CONFIG_CD_NO_IDESCSI is not set
6959 # Input device support
6961 # CONFIG_INPUT is not set
6965 # CONFIG_DEBUG_KERNEL is not set
6966 -# CONFIG_KALLSYMS is not set
6967 # CONFIG_SERIAL_TEXT_DEBUG is not set
6970 diff -Nru a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
6971 --- a/arch/ppc/configs/pmac_defconfig Sat Aug 2 13:06:57 2003
6972 +++ b/arch/ppc/configs/pmac_defconfig Sat Aug 23 02:33:38 2003
6974 # Code maturity level options
6976 CONFIG_EXPERIMENTAL=y
6977 +# CONFIG_BROKEN is not set
6982 # CONFIG_BSD_PROCESS_ACCT is not set
6984 CONFIG_LOG_BUF_SHIFT=14
6986 +CONFIG_IKCONFIG_PROC=y
6987 # CONFIG_EMBEDDED is not set
6991 +CONFIG_IOSCHED_NOOP=y
6992 +CONFIG_IOSCHED_AS=y
6993 +CONFIG_IOSCHED_DEADLINE=y
6996 # Loadable module support
6998 # CONFIG_TAU_INT is not set
6999 # CONFIG_TAU_AVERAGE is not set
7001 +CONFIG_CPU_FREQ_TABLE=y
7002 CONFIG_CPU_FREQ_PROC_INTF=y
7003 CONFIG_CPU_FREQ_24_API=y
7004 CONFIG_CPU_FREQ_PMAC=y
7007 CONFIG_PCI_DOMAINS=y
7009 -CONFIG_BINFMT_ELF=y
7011 +CONFIG_BINFMT_ELF=y
7012 CONFIG_BINFMT_MISC=m
7013 CONFIG_PCI_LEGACY_PROC=y
7016 # PCMCIA/CardBus support
7026 @@ -131,6 +139,11 @@
7027 CONFIG_BOOT_LOAD=0x00800000
7030 +# Generic Driver Options
7032 +# CONFIG_FW_LOADER is not set
7035 # Memory Technology Devices (MTD)
7037 # CONFIG_MTD is not set
7038 @@ -149,10 +162,12 @@
7039 # CONFIG_BLK_DEV_DAC960 is not set
7040 # CONFIG_BLK_DEV_UMEM is not set
7041 CONFIG_BLK_DEV_LOOP=y
7042 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7043 # CONFIG_BLK_DEV_NBD is not set
7044 CONFIG_BLK_DEV_RAM=y
7045 CONFIG_BLK_DEV_RAM_SIZE=4096
7046 CONFIG_BLK_DEV_INITRD=y
7050 # Multi-device support (RAID and LVM)
7051 @@ -160,41 +175,39 @@
7052 # CONFIG_MD is not set
7055 -# ATA/IDE/MFM/RLL support
7056 +# ATA/ATAPI/MFM/RLL support
7061 -# IDE, ATA and ATAPI Block devices
7063 CONFIG_BLK_DEV_IDE=y
7066 # Please see Documentation/ide.txt for help/info on IDE drives
7068 -# CONFIG_BLK_DEV_HD is not set
7069 CONFIG_BLK_DEV_IDEDISK=y
7070 # CONFIG_IDEDISK_MULTI_MODE is not set
7071 # CONFIG_IDEDISK_STROKE is not set
7072 CONFIG_BLK_DEV_IDECS=m
7073 CONFIG_BLK_DEV_IDECD=y
7074 +# CONFIG_BLK_DEV_IDETAPE is not set
7075 CONFIG_BLK_DEV_IDEFLOPPY=y
7076 CONFIG_BLK_DEV_IDESCSI=y
7077 # CONFIG_IDE_TASK_IOCTL is not set
7078 +# CONFIG_IDE_TASKFILE_IO is not set
7081 # IDE chipset support/bugfixes
7083 CONFIG_BLK_DEV_IDEPCI=y
7084 -CONFIG_BLK_DEV_GENERIC=y
7085 CONFIG_IDEPCI_SHARE_IRQ=y
7086 +# CONFIG_BLK_DEV_OFFBOARD is not set
7087 +CONFIG_BLK_DEV_GENERIC=y
7088 +# CONFIG_BLK_DEV_OPTI621 is not set
7089 +CONFIG_BLK_DEV_SL82C105=y
7090 CONFIG_BLK_DEV_IDEDMA_PCI=y
7091 # CONFIG_BLK_DEV_IDE_TCQ is not set
7092 -# CONFIG_BLK_DEV_OFFBOARD is not set
7093 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
7094 CONFIG_IDEDMA_PCI_AUTO=y
7095 # CONFIG_IDEDMA_ONLYDISK is not set
7096 -CONFIG_BLK_DEV_IDEDMA=y
7097 # CONFIG_IDEDMA_PCI_WIP is not set
7098 CONFIG_BLK_DEV_ADMA=y
7099 # CONFIG_BLK_DEV_AEC62XX is not set
7100 @@ -204,12 +217,12 @@
7101 # CONFIG_BLK_DEV_TRIFLEX is not set
7102 # CONFIG_BLK_DEV_CY82C693 is not set
7103 # CONFIG_BLK_DEV_CS5520 is not set
7104 +# CONFIG_BLK_DEV_CS5530 is not set
7105 # CONFIG_BLK_DEV_HPT34X is not set
7106 # CONFIG_BLK_DEV_HPT366 is not set
7107 # CONFIG_BLK_DEV_SC1200 is not set
7108 # CONFIG_BLK_DEV_PIIX is not set
7109 # CONFIG_BLK_DEV_NS87415 is not set
7110 -# CONFIG_BLK_DEV_OPTI621 is not set
7111 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
7112 CONFIG_BLK_DEV_PDC202XX_NEW=y
7113 # CONFIG_PDC202XX_FORCE is not set
7114 @@ -218,15 +231,17 @@
7115 # CONFIG_BLK_DEV_SLC90E66 is not set
7116 # CONFIG_BLK_DEV_TRM290 is not set
7117 # CONFIG_BLK_DEV_VIA82CXXX is not set
7118 -CONFIG_BLK_DEV_SL82C105=y
7119 CONFIG_BLK_DEV_IDE_PMAC=y
7120 CONFIG_BLK_DEV_IDEDMA_PMAC=y
7121 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
7122 -CONFIG_IDEDMA_AUTO=y
7123 +CONFIG_BLK_DEV_IDEDMA=y
7124 # CONFIG_IDEDMA_IVB is not set
7125 +CONFIG_IDEDMA_AUTO=y
7126 +# CONFIG_DMA_NONPCI is not set
7127 +# CONFIG_BLK_DEV_HD is not set
7131 +# SCSI device support
7136 # CONFIG_SCSI_AIC79XX is not set
7137 # CONFIG_SCSI_DPT_I2O is not set
7138 CONFIG_SCSI_ADVANSYS=m
7139 -# CONFIG_SCSI_IN2000 is not set
7140 -# CONFIG_SCSI_AM53C974 is not set
7141 # CONFIG_SCSI_MEGARAID is not set
7142 # CONFIG_SCSI_BUSLOGIC is not set
7143 # CONFIG_SCSI_CPQFCTS is not set
7144 @@ -276,11 +289,8 @@
7145 # CONFIG_SCSI_EATA_PIO is not set
7146 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7147 # CONFIG_SCSI_GDTH is not set
7148 -# CONFIG_SCSI_GENERIC_NCR5380 is not set
7149 -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7150 # CONFIG_SCSI_INITIO is not set
7151 # CONFIG_SCSI_INIA100 is not set
7152 -# CONFIG_SCSI_NCR53C7xx is not set
7153 CONFIG_SCSI_SYM53C8XX_2=y
7154 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
7155 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7157 # CONFIG_SCSI_QLOGIC_1280 is not set
7158 # CONFIG_SCSI_DC395x is not set
7159 # CONFIG_SCSI_DC390T is not set
7160 -# CONFIG_SCSI_U14_34F is not set
7161 # CONFIG_SCSI_NSP32 is not set
7162 # CONFIG_SCSI_DEBUG is not set
7166 # CONFIG_PACKET_MMAP is not set
7167 # CONFIG_NETLINK_DEV is not set
7169 -# CONFIG_NETFILTER_DEBUG is not set
7171 # CONFIG_NET_KEY is not set
7173 @@ -380,6 +387,16 @@
7174 # CONFIG_INET_IPCOMP is not set
7177 +# IP: Virtual Server Configuration
7179 +# CONFIG_IP_VS is not set
7180 +# CONFIG_IPV6 is not set
7181 +# CONFIG_DECNET is not set
7182 +# CONFIG_BRIDGE is not set
7184 +# CONFIG_NETFILTER_DEBUG is not set
7187 # IP: Netfilter Configuration
7189 CONFIG_IP_NF_CONNTRACK=m
7191 CONFIG_IP_NF_MATCH_MARK=m
7192 CONFIG_IP_NF_MATCH_MULTIPORT=m
7193 CONFIG_IP_NF_MATCH_TOS=m
7194 +CONFIG_IP_NF_MATCH_RECENT=m
7195 CONFIG_IP_NF_MATCH_ECN=m
7196 CONFIG_IP_NF_MATCH_DSCP=m
7197 CONFIG_IP_NF_MATCH_AH_ESP=m
7198 @@ -425,10 +443,9 @@
7199 CONFIG_IP_NF_TARGET_TCPMSS=m
7200 CONFIG_IP_NF_ARPTABLES=m
7201 CONFIG_IP_NF_ARPFILTER=m
7202 +CONFIG_IP_NF_ARP_MANGLE=m
7203 CONFIG_IP_NF_COMPAT_IPCHAINS=m
7204 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
7205 -# CONFIG_IPV6 is not set
7206 -# CONFIG_XFRM_USER is not set
7209 # SCTP Configuration (EXPERIMENTAL)
7211 # CONFIG_ATM is not set
7212 # CONFIG_VLAN_8021Q is not set
7213 # CONFIG_LLC is not set
7214 -# CONFIG_DECNET is not set
7215 -# CONFIG_BRIDGE is not set
7216 # CONFIG_X25 is not set
7217 # CONFIG_LAPB is not set
7218 # CONFIG_NET_DIVERT is not set
7220 # CONFIG_HAMACHI is not set
7221 # CONFIG_YELLOWFIN is not set
7222 # CONFIG_R8169 is not set
7223 +# CONFIG_SIS190 is not set
7224 # CONFIG_SK98LIN is not set
7225 # CONFIG_TIGON3 is not set
7228 CONFIG_PCMCIA_HERMES=m
7229 # CONFIG_AIRO_CS is not set
7230 # CONFIG_PCMCIA_ATMEL is not set
7231 +# CONFIG_PCMCIA_WL3501 is not set
7232 CONFIG_NET_WIRELESS=y
7235 @@ -637,25 +654,18 @@
7237 # Old SIR device drivers
7239 -# CONFIG_IRTTY_OLD is not set
7240 # CONFIG_IRPORT_SIR is not set
7243 # Old Serial dongle support
7245 -# CONFIG_DONGLE_OLD is not set
7248 # FIR device drivers
7250 # CONFIG_USB_IRDA is not set
7251 -# CONFIG_NSC_FIR is not set
7252 -# CONFIG_WINBOND_FIR is not set
7253 # CONFIG_TOSHIBA_OLD is not set
7254 # CONFIG_TOSHIBA_FIR is not set
7255 -# CONFIG_SMC_IRCC_OLD is not set
7256 -# CONFIG_SMC_IRCC_FIR is not set
7257 -# CONFIG_ALI_FIR is not set
7258 # CONFIG_VLSI_FIR is not set
7261 @@ -721,11 +731,6 @@
7262 CONFIG_LOGO_LINUX_CLUT224=y
7265 -# Old CD-ROM drivers (not SCSI, not IDE)
7267 -# CONFIG_CD_NO_IDESCSI is not set
7270 # Input device support
7275 CONFIG_PMAC_APM_EMU=y
7276 CONFIG_PMAC_BACKLIGHT=y
7277 -CONFIG_MAC_FLOPPY=y
7278 +# CONFIG_MAC_FLOPPY is not set
7282 @@ -808,10 +813,12 @@
7284 # I2C Hardware Sensors Mainboard support
7286 +# CONFIG_I2C_ALI1535 is not set
7287 # CONFIG_I2C_ALI15X3 is not set
7288 # CONFIG_I2C_AMD756 is not set
7289 # CONFIG_I2C_AMD8111 is not set
7290 # CONFIG_I2C_I801 is not set
7291 +# CONFIG_I2C_NFORCE2 is not set
7292 # CONFIG_I2C_PIIX4 is not set
7293 # CONFIG_I2C_SIS96X is not set
7294 # CONFIG_I2C_VIAPRO is not set
7296 # CONFIG_SENSORS_IT87 is not set
7297 # CONFIG_SENSORS_LM75 is not set
7298 # CONFIG_SENSORS_LM85 is not set
7299 +# CONFIG_SENSORS_LM78 is not set
7300 # CONFIG_SENSORS_VIA686A is not set
7301 # CONFIG_SENSORS_W83781D is not set
7302 # CONFIG_I2C_SENSOR is not set
7303 @@ -1028,8 +1036,7 @@
7307 -CONFIG_DMASOUND_AWACS=m
7309 +# CONFIG_DMASOUND_AWACS is not set
7312 # Advanced Linux Sound Architecture
7313 @@ -1168,6 +1175,7 @@
7315 # USB Network adaptors
7317 +# CONFIG_USB_AX8817X is not set
7318 # CONFIG_USB_CATC is not set
7319 # CONFIG_USB_KAWETH is not set
7320 # CONFIG_USB_PEGASUS is not set
7321 @@ -1231,7 +1239,6 @@
7324 # CONFIG_DEBUG_KERNEL is not set
7329 diff -Nru a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
7330 --- a/arch/ppc/configs/power3_defconfig Tue Jul 1 17:01:18 2003
7331 +++ b/arch/ppc/configs/power3_defconfig Sat Aug 23 02:33:38 2003
7333 # Code maturity level options
7335 CONFIG_EXPERIMENTAL=y
7336 +# CONFIG_BROKEN is not set
7341 # CONFIG_BSD_PROCESS_ACCT is not set
7343 CONFIG_LOG_BUF_SHIFT=15
7345 +CONFIG_IKCONFIG_PROC=y
7346 # CONFIG_EMBEDDED is not set
7350 +CONFIG_IOSCHED_NOOP=y
7351 +CONFIG_IOSCHED_AS=y
7352 +CONFIG_IOSCHED_DEADLINE=y
7355 # Loadable module support
7358 CONFIG_PCI_DOMAINS=y
7360 -CONFIG_BINFMT_ELF=y
7362 +CONFIG_BINFMT_ELF=y
7363 CONFIG_BINFMT_MISC=y
7364 CONFIG_PCI_LEGACY_PROC=y
7366 @@ -121,6 +128,10 @@
7367 CONFIG_BOOT_LOAD=0x00800000
7370 +# Generic Driver Options
7374 # Memory Technology Devices (MTD)
7376 # CONFIG_MTD is not set
7377 @@ -140,10 +151,12 @@
7378 # CONFIG_BLK_DEV_DAC960 is not set
7379 # CONFIG_BLK_DEV_UMEM is not set
7380 CONFIG_BLK_DEV_LOOP=y
7381 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7382 # CONFIG_BLK_DEV_NBD is not set
7383 CONFIG_BLK_DEV_RAM=y
7384 CONFIG_BLK_DEV_RAM_SIZE=4096
7385 CONFIG_BLK_DEV_INITRD=y
7389 # Multi-device support (RAID and LVM)
7390 @@ -156,14 +169,15 @@
7392 # CONFIG_MD_MULTIPATH is not set
7394 +CONFIG_DM_IOCTL_V4=y
7397 -# ATA/IDE/MFM/RLL support
7398 +# ATA/ATAPI/MFM/RLL support
7400 # CONFIG_IDE is not set
7404 +# SCSI device support
7409 # CONFIG_SCSI_AIC79XX is not set
7410 # CONFIG_SCSI_DPT_I2O is not set
7411 # CONFIG_SCSI_ADVANSYS is not set
7412 -# CONFIG_SCSI_IN2000 is not set
7413 -# CONFIG_SCSI_AM53C974 is not set
7414 # CONFIG_SCSI_MEGARAID is not set
7415 # CONFIG_SCSI_BUSLOGIC is not set
7416 # CONFIG_SCSI_CPQFCTS is not set
7417 @@ -206,13 +218,10 @@
7418 # CONFIG_SCSI_EATA_PIO is not set
7419 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7420 # CONFIG_SCSI_GDTH is not set
7421 -# CONFIG_SCSI_GENERIC_NCR5380 is not set
7422 -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7423 # CONFIG_SCSI_INITIO is not set
7424 # CONFIG_SCSI_INIA100 is not set
7425 # CONFIG_SCSI_PPA is not set
7426 # CONFIG_SCSI_IMM is not set
7427 -# CONFIG_SCSI_NCR53C7xx is not set
7428 CONFIG_SCSI_SYM53C8XX_2=y
7429 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
7430 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7432 # CONFIG_SCSI_QLOGIC_1280 is not set
7433 # CONFIG_SCSI_DC395x is not set
7434 # CONFIG_SCSI_DC390T is not set
7435 -# CONFIG_SCSI_U14_34F is not set
7436 # CONFIG_SCSI_NSP32 is not set
7437 # CONFIG_SCSI_DEBUG is not set
7438 # CONFIG_SCSI_MESH is not set
7441 # CONFIG_PACKET_MMAP is not set
7442 # CONFIG_NETLINK_DEV is not set
7443 -# CONFIG_NETFILTER is not set
7445 # CONFIG_NET_KEY is not set
7448 # CONFIG_INET_ESP is not set
7449 # CONFIG_INET_IPCOMP is not set
7450 # CONFIG_IPV6 is not set
7451 -# CONFIG_XFRM_USER is not set
7452 +# CONFIG_DECNET is not set
7453 +# CONFIG_BRIDGE is not set
7454 +# CONFIG_NETFILTER is not set
7457 # SCTP Configuration (EXPERIMENTAL)
7459 # CONFIG_ATM is not set
7460 # CONFIG_VLAN_8021Q is not set
7461 # CONFIG_LLC is not set
7462 -# CONFIG_DECNET is not set
7463 -# CONFIG_BRIDGE is not set
7464 # CONFIG_X25 is not set
7465 # CONFIG_LAPB is not set
7466 # CONFIG_NET_DIVERT is not set
7468 # CONFIG_HAMACHI is not set
7469 # CONFIG_YELLOWFIN is not set
7470 # CONFIG_R8169 is not set
7471 +# CONFIG_SIS190 is not set
7472 # CONFIG_SK98LIN is not set
7473 # CONFIG_TIGON3 is not set
7475 @@ -464,11 +472,6 @@
7476 CONFIG_LOGO_LINUX_CLUT224=y
7479 -# Old CD-ROM drivers (not SCSI, not IDE)
7481 -# CONFIG_CD_NO_IDESCSI is not set
7484 # Input device support
7488 CONFIG_SERIO_SERPORT=y
7489 # CONFIG_SERIO_CT82C710 is not set
7490 # CONFIG_SERIO_PARKBD is not set
7491 +# CONFIG_SERIO_PCIPS2 is not set
7494 # Input Device Drivers
7498 CONFIG_I2C_ALGOBIT=y
7499 +# CONFIG_I2C_PROSAVAGE is not set
7500 # CONFIG_I2C_PHILIPSPAR is not set
7501 -# CONFIG_I2C_ELV is not set
7502 -# CONFIG_I2C_VELLEMAN is not set
7503 # CONFIG_SCx200_ACB is not set
7504 CONFIG_I2C_ALGOPCF=y
7505 # CONFIG_I2C_ELEKTOR is not set
7506 @@ -566,10 +569,12 @@
7508 # I2C Hardware Sensors Mainboard support
7510 +# CONFIG_I2C_ALI1535 is not set
7511 # CONFIG_I2C_ALI15X3 is not set
7512 # CONFIG_I2C_AMD756 is not set
7513 # CONFIG_I2C_AMD8111 is not set
7514 # CONFIG_I2C_I801 is not set
7515 +# CONFIG_I2C_NFORCE2 is not set
7516 # CONFIG_I2C_PIIX4 is not set
7517 # CONFIG_I2C_SIS96X is not set
7518 # CONFIG_I2C_VIAPRO is not set
7520 # CONFIG_SENSORS_IT87 is not set
7521 # CONFIG_SENSORS_LM75 is not set
7522 # CONFIG_SENSORS_LM85 is not set
7523 +# CONFIG_SENSORS_LM78 is not set
7524 # CONFIG_SENSORS_VIA686A is not set
7525 # CONFIG_SENSORS_W83781D is not set
7526 # CONFIG_I2C_SENSOR is not set
7530 # CONFIG_DEBUG_KERNEL is not set
7535 diff -Nru a/arch/ppc/defconfig b/arch/ppc/defconfig
7536 --- a/arch/ppc/defconfig Sat Aug 2 12:59:32 2003
7537 +++ b/arch/ppc/defconfig Sat Aug 23 02:33:38 2003
7539 # Code maturity level options
7541 CONFIG_EXPERIMENTAL=y
7542 +# CONFIG_BROKEN is not set
7547 # CONFIG_BSD_PROCESS_ACCT is not set
7549 CONFIG_LOG_BUF_SHIFT=14
7551 +CONFIG_IKCONFIG_PROC=y
7552 # CONFIG_EMBEDDED is not set
7556 +CONFIG_IOSCHED_NOOP=y
7557 +CONFIG_IOSCHED_AS=y
7558 +CONFIG_IOSCHED_DEADLINE=y
7561 # Loadable module support
7563 # CONFIG_TAU_INT is not set
7564 # CONFIG_TAU_AVERAGE is not set
7566 +CONFIG_CPU_FREQ_TABLE=y
7567 CONFIG_CPU_FREQ_PROC_INTF=y
7568 CONFIG_CPU_FREQ_24_API=y
7569 CONFIG_CPU_FREQ_PMAC=y
7572 CONFIG_PCI_DOMAINS=y
7574 -CONFIG_BINFMT_ELF=y
7576 +CONFIG_BINFMT_ELF=y
7577 CONFIG_BINFMT_MISC=m
7578 CONFIG_PCI_LEGACY_PROC=y
7580 @@ -128,6 +136,11 @@
7581 CONFIG_BOOT_LOAD=0x00800000
7584 +# Generic Driver Options
7586 +# CONFIG_FW_LOADER is not set
7589 # Memory Technology Devices (MTD)
7591 # CONFIG_MTD is not set
7592 @@ -146,10 +159,12 @@
7593 # CONFIG_BLK_DEV_DAC960 is not set
7594 # CONFIG_BLK_DEV_UMEM is not set
7595 CONFIG_BLK_DEV_LOOP=y
7596 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
7597 # CONFIG_BLK_DEV_NBD is not set
7598 CONFIG_BLK_DEV_RAM=y
7599 CONFIG_BLK_DEV_RAM_SIZE=4096
7600 CONFIG_BLK_DEV_INITRD=y
7604 # Multi-device support (RAID and LVM)
7605 @@ -157,40 +172,38 @@
7606 # CONFIG_MD is not set
7609 -# ATA/IDE/MFM/RLL support
7610 +# ATA/ATAPI/MFM/RLL support
7615 -# IDE, ATA and ATAPI Block devices
7617 CONFIG_BLK_DEV_IDE=y
7620 # Please see Documentation/ide.txt for help/info on IDE drives
7622 -# CONFIG_BLK_DEV_HD is not set
7623 CONFIG_BLK_DEV_IDEDISK=y
7624 # CONFIG_IDEDISK_MULTI_MODE is not set
7625 # CONFIG_IDEDISK_STROKE is not set
7626 CONFIG_BLK_DEV_IDECD=y
7627 +# CONFIG_BLK_DEV_IDETAPE is not set
7628 CONFIG_BLK_DEV_IDEFLOPPY=y
7629 CONFIG_BLK_DEV_IDESCSI=y
7630 # CONFIG_IDE_TASK_IOCTL is not set
7631 +# CONFIG_IDE_TASKFILE_IO is not set
7634 # IDE chipset support/bugfixes
7636 CONFIG_BLK_DEV_IDEPCI=y
7637 -CONFIG_BLK_DEV_GENERIC=y
7638 CONFIG_IDEPCI_SHARE_IRQ=y
7639 +# CONFIG_BLK_DEV_OFFBOARD is not set
7640 +CONFIG_BLK_DEV_GENERIC=y
7641 +# CONFIG_BLK_DEV_OPTI621 is not set
7642 +CONFIG_BLK_DEV_SL82C105=y
7643 CONFIG_BLK_DEV_IDEDMA_PCI=y
7644 # CONFIG_BLK_DEV_IDE_TCQ is not set
7645 -# CONFIG_BLK_DEV_OFFBOARD is not set
7646 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
7647 CONFIG_IDEDMA_PCI_AUTO=y
7648 # CONFIG_IDEDMA_ONLYDISK is not set
7649 -CONFIG_BLK_DEV_IDEDMA=y
7650 # CONFIG_IDEDMA_PCI_WIP is not set
7651 CONFIG_BLK_DEV_ADMA=y
7652 # CONFIG_BLK_DEV_AEC62XX is not set
7653 @@ -200,12 +213,12 @@
7654 # CONFIG_BLK_DEV_TRIFLEX is not set
7655 # CONFIG_BLK_DEV_CY82C693 is not set
7656 # CONFIG_BLK_DEV_CS5520 is not set
7657 +# CONFIG_BLK_DEV_CS5530 is not set
7658 # CONFIG_BLK_DEV_HPT34X is not set
7659 # CONFIG_BLK_DEV_HPT366 is not set
7660 # CONFIG_BLK_DEV_SC1200 is not set
7661 # CONFIG_BLK_DEV_PIIX is not set
7662 # CONFIG_BLK_DEV_NS87415 is not set
7663 -# CONFIG_BLK_DEV_OPTI621 is not set
7664 # CONFIG_BLK_DEV_PDC202XX_OLD is not set
7665 # CONFIG_BLK_DEV_PDC202XX_NEW is not set
7666 # CONFIG_BLK_DEV_SVWKS is not set
7667 @@ -213,15 +226,17 @@
7668 # CONFIG_BLK_DEV_SLC90E66 is not set
7669 # CONFIG_BLK_DEV_TRM290 is not set
7670 # CONFIG_BLK_DEV_VIA82CXXX is not set
7671 -CONFIG_BLK_DEV_SL82C105=y
7672 CONFIG_BLK_DEV_IDE_PMAC=y
7673 CONFIG_BLK_DEV_IDEDMA_PMAC=y
7674 CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
7675 -CONFIG_IDEDMA_AUTO=y
7676 +CONFIG_BLK_DEV_IDEDMA=y
7677 # CONFIG_IDEDMA_IVB is not set
7678 +CONFIG_IDEDMA_AUTO=y
7679 +# CONFIG_DMA_NONPCI is not set
7680 +# CONFIG_BLK_DEV_HD is not set
7684 +# SCSI device support
7689 # CONFIG_SCSI_AIC79XX is not set
7690 # CONFIG_SCSI_DPT_I2O is not set
7691 CONFIG_SCSI_ADVANSYS=m
7692 -# CONFIG_SCSI_IN2000 is not set
7693 -# CONFIG_SCSI_AM53C974 is not set
7694 # CONFIG_SCSI_MEGARAID is not set
7695 # CONFIG_SCSI_BUSLOGIC is not set
7696 # CONFIG_SCSI_CPQFCTS is not set
7697 @@ -271,11 +284,8 @@
7698 # CONFIG_SCSI_EATA_PIO is not set
7699 # CONFIG_SCSI_FUTURE_DOMAIN is not set
7700 # CONFIG_SCSI_GDTH is not set
7701 -# CONFIG_SCSI_GENERIC_NCR5380 is not set
7702 -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
7703 # CONFIG_SCSI_INITIO is not set
7704 # CONFIG_SCSI_INIA100 is not set
7705 -# CONFIG_SCSI_NCR53C7xx is not set
7706 CONFIG_SCSI_SYM53C8XX_2=y
7707 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
7708 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
7710 # CONFIG_SCSI_QLOGIC_1280 is not set
7711 # CONFIG_SCSI_DC395x is not set
7712 # CONFIG_SCSI_DC390T is not set
7713 -# CONFIG_SCSI_U14_34F is not set
7714 # CONFIG_SCSI_NSP32 is not set
7715 # CONFIG_SCSI_DEBUG is not set
7719 # CONFIG_PACKET_MMAP is not set
7720 # CONFIG_NETLINK_DEV is not set
7722 -# CONFIG_NETFILTER_DEBUG is not set
7724 # CONFIG_NET_KEY is not set
7726 @@ -341,6 +348,16 @@
7727 # CONFIG_INET_IPCOMP is not set
7730 +# IP: Virtual Server Configuration
7732 +# CONFIG_IP_VS is not set
7733 +# CONFIG_IPV6 is not set
7734 +# CONFIG_DECNET is not set
7735 +# CONFIG_BRIDGE is not set
7737 +# CONFIG_NETFILTER_DEBUG is not set
7740 # IP: Netfilter Configuration
7742 CONFIG_IP_NF_CONNTRACK=m
7744 CONFIG_IP_NF_MATCH_MARK=m
7745 CONFIG_IP_NF_MATCH_MULTIPORT=m
7746 CONFIG_IP_NF_MATCH_TOS=m
7747 +CONFIG_IP_NF_MATCH_RECENT=m
7748 CONFIG_IP_NF_MATCH_ECN=m
7749 CONFIG_IP_NF_MATCH_DSCP=m
7750 CONFIG_IP_NF_MATCH_AH_ESP=m
7751 @@ -386,10 +404,9 @@
7752 CONFIG_IP_NF_TARGET_TCPMSS=m
7753 CONFIG_IP_NF_ARPTABLES=m
7754 CONFIG_IP_NF_ARPFILTER=m
7755 +CONFIG_IP_NF_ARP_MANGLE=m
7756 CONFIG_IP_NF_COMPAT_IPCHAINS=m
7757 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
7758 -# CONFIG_IPV6 is not set
7759 -# CONFIG_XFRM_USER is not set
7762 # SCTP Configuration (EXPERIMENTAL)
7764 # CONFIG_ATM is not set
7765 # CONFIG_VLAN_8021Q is not set
7766 # CONFIG_LLC is not set
7767 -# CONFIG_DECNET is not set
7768 -# CONFIG_BRIDGE is not set
7769 # CONFIG_X25 is not set
7770 # CONFIG_LAPB is not set
7771 # CONFIG_NET_DIVERT is not set
7773 # CONFIG_HAMACHI is not set
7774 # CONFIG_YELLOWFIN is not set
7775 # CONFIG_R8169 is not set
7776 +# CONFIG_SIS190 is not set
7777 # CONFIG_SK98LIN is not set
7778 # CONFIG_TIGON3 is not set
7785 +# CONFIG_FB_CIRRUS is not set
7786 # CONFIG_FB_PM2 is not set
7787 # CONFIG_FB_CYBER2000 is not set
7789 @@ -602,11 +618,6 @@
7790 CONFIG_LOGO_LINUX_CLUT224=y
7793 -# Old CD-ROM drivers (not SCSI, not IDE)
7795 -# CONFIG_CD_NO_IDESCSI is not set
7798 # Input device support
7802 CONFIG_SERIO_I8042=y
7803 CONFIG_SERIO_SERPORT=y
7804 # CONFIG_SERIO_CT82C710 is not set
7805 +# CONFIG_SERIO_PCIPS2 is not set
7808 # Input Device Drivers
7809 @@ -698,10 +710,12 @@
7811 # I2C Hardware Sensors Mainboard support
7813 +# CONFIG_I2C_ALI1535 is not set
7814 # CONFIG_I2C_ALI15X3 is not set
7815 # CONFIG_I2C_AMD756 is not set
7816 # CONFIG_I2C_AMD8111 is not set
7817 # CONFIG_I2C_I801 is not set
7818 +# CONFIG_I2C_NFORCE2 is not set
7819 # CONFIG_I2C_PIIX4 is not set
7820 # CONFIG_I2C_SIS96X is not set
7821 # CONFIG_I2C_VIAPRO is not set
7823 # CONFIG_SENSORS_IT87 is not set
7824 # CONFIG_SENSORS_LM75 is not set
7825 # CONFIG_SENSORS_LM85 is not set
7826 +# CONFIG_SENSORS_LM78 is not set
7827 # CONFIG_SENSORS_VIA686A is not set
7828 # CONFIG_SENSORS_W83781D is not set
7829 # CONFIG_I2C_SENSOR is not set
7830 @@ -1047,6 +1062,7 @@
7832 # USB Network adaptors
7834 +# CONFIG_USB_AX8817X is not set
7835 # CONFIG_USB_CATC is not set
7836 # CONFIG_USB_KAWETH is not set
7837 # CONFIG_USB_PEGASUS is not set
7838 @@ -1123,7 +1139,6 @@
7841 # CONFIG_DEBUG_KERNEL is not set
7846 diff -Nru a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
7847 --- a/arch/ppc/kernel/cputable.c Sun Apr 27 05:41:48 2003
7848 +++ b/arch/ppc/kernel/cputable.c Sun Aug 24 03:04:21 2003
7849 @@ -154,6 +154,15 @@
7853 + { /* 750FX rev 1.x */
7854 + 0xffffff00, 0x70000100, "750FX",
7855 + CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
7856 + CPU_FTR_L2CR | CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_CAN_NAP |
7857 + CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM,
7862 { /* 750FX rev 2.0 must disable HID0[DPM] */
7863 0xffffffff, 0x70000200, "750FX",
7864 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
7865 diff -Nru a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
7866 --- a/arch/ppc/kernel/head.S Wed Jun 4 20:07:15 2003
7867 +++ b/arch/ppc/kernel/head.S Tue Aug 26 06:38:51 2003
7868 @@ -355,11 +355,6 @@
7876 -END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
7880 diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
7881 --- a/arch/ppc/kernel/misc.S Tue Jul 15 04:47:19 2003
7882 +++ b/arch/ppc/kernel/misc.S Fri Aug 22 19:15:18 2003
7883 @@ -1380,3 +1380,4 @@
7887 + .long ppc_fadvise64_64
7888 diff -Nru a/arch/ppc/kernel/ppc-stub.c b/arch/ppc/kernel/ppc-stub.c
7889 --- a/arch/ppc/kernel/ppc-stub.c Mon Jun 30 10:10:33 2003
7890 +++ b/arch/ppc/kernel/ppc-stub.c Mon Aug 25 11:39:55 2003
7892 #include <linux/smp.h>
7893 #include <linux/smp_lock.h>
7895 +#include <asm/cacheflush.h>
7896 #include <asm/system.h>
7897 #include <asm/signal.h>
7898 #include <asm/kgdb.h>
7900 /* typedef void (*trapfunc_t)(void); */
7902 static void kgdb_fault_handler(struct pt_regs *regs);
7903 -static void handle_exception (struct pt_regs *regs);
7904 +static int handle_exception (struct pt_regs *regs);
7907 /* Install an exception handler for kgdb */
7911 static unsigned char *
7912 -mem2hex(char *mem, char *buf, int count)
7913 +mem2hex(const char *mem, char *buf, int count)
7916 unsigned short tmp_s;
7917 @@ -460,14 +461,12 @@
7919 int kgdb_bpt(struct pt_regs *regs)
7921 - handle_exception(regs);
7923 + return handle_exception(regs);
7926 int kgdb_sstep(struct pt_regs *regs)
7928 - handle_exception(regs);
7930 + return handle_exception(regs);
7933 void kgdb(struct pt_regs *regs)
7934 @@ -477,16 +476,14 @@
7936 int kgdb_iabr_match(struct pt_regs *regs)
7938 - printk("kgdb doesn't support iabr, what?!?\n");
7939 - handle_exception(regs);
7941 + printk(KERN_ERR "kgdb doesn't support iabr, what?!?\n");
7942 + return handle_exception(regs);
7945 int kgdb_dabr_match(struct pt_regs *regs)
7947 - printk("kgdb doesn't support dabr, what?!?\n");
7948 - handle_exception(regs);
7950 + printk(KERN_ERR "kgdb doesn't support dabr, what?!?\n");
7951 + return handle_exception(regs);
7954 /* Convert the hardware trap type code to a unix signal number. */
7957 * This function does all command processing for interfacing to gdb.
7961 handle_exception (struct pt_regs *regs)
7964 @@ -568,14 +565,19 @@
7968 + /* We don't handle user-mode breakpoints. */
7969 + if (user_mode(regs))
7972 if (debugger_fault_handler) {
7973 debugger_fault_handler(regs);
7974 panic("kgdb longjump failed!\n");
7977 - printk("interrupt while in kgdb, returning\n");
7979 + printk(KERN_ERR "interrupt while in kgdb, returning\n");
7987 printk("remcomInBuffer: %s\n", remcomInBuffer);
7988 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
7994 kgdb_flush_cache_all();
7996 printk("remcomInBuffer: %s\n", remcomInBuffer);
7997 printk("remcomOutBuffer: %s\n", remcomOutBuffer);
8002 case 'r': /* Reset (if user process..exit ???)*/
8003 panic("kgdb reset.");
8004 @@ -828,11 +830,11 @@
8008 - asm(" .globl breakinst
8009 - breakinst: .long 0x7d821008
8011 + asm(" .globl breakinst \n\
8012 + breakinst: .long 0x7d821008");
8015 +#ifdef CONFIG_KGDB_CONSOLE
8016 /* Output string in GDB O-packet format if GDB has connected. If nothing
8017 output, returns 0 (caller must then handle output). */
8024 diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
8025 --- a/arch/ppc/kernel/ppc_ksyms.c Tue Jul 1 10:57:22 2003
8026 +++ b/arch/ppc/kernel/ppc_ksyms.c Sun Aug 24 03:57:52 2003
8028 EXPORT_SYMBOL(flush_icache_user_range);
8029 EXPORT_SYMBOL(flush_dcache_page);
8030 EXPORT_SYMBOL(flush_tlb_kernel_range);
8031 +EXPORT_SYMBOL(flush_tlb_page);
8032 #ifdef CONFIG_ALTIVEC
8033 EXPORT_SYMBOL(last_task_used_altivec);
8034 EXPORT_SYMBOL(giveup_altivec);
8035 @@ -259,6 +260,15 @@
8036 EXPORT_SYMBOL(pci_busdev_to_OF_node);
8037 EXPORT_SYMBOL(pci_device_to_OF_node);
8038 EXPORT_SYMBOL(pci_device_from_OF_node);
8039 +EXPORT_SYMBOL(of_find_node_by_name);
8040 +EXPORT_SYMBOL(of_find_node_by_type);
8041 +EXPORT_SYMBOL(of_find_compatible_node);
8042 +EXPORT_SYMBOL(of_find_node_by_path);
8043 +EXPORT_SYMBOL(of_find_all_nodes);
8044 +EXPORT_SYMBOL(of_get_parent);
8045 +EXPORT_SYMBOL(of_get_next_child);
8046 +EXPORT_SYMBOL(of_node_get);
8047 +EXPORT_SYMBOL(of_node_put);
8048 #endif /* CONFIG_PPC_OF */
8049 #if defined(CONFIG_BOOTX_TEXT)
8050 EXPORT_SYMBOL(btext_update_display);
8051 diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
8052 --- a/arch/ppc/kernel/setup.c Mon Aug 18 19:46:23 2003
8053 +++ b/arch/ppc/kernel/setup.c Mon Aug 25 11:11:43 2003
8054 @@ -624,12 +624,10 @@
8055 #if defined(CONFIG_KGDB)
8058 - if (strstr(cmd_line, "nokgdb"))
8059 - printk("kgdb default breakpoint deactivated on command line\n");
8061 + if (strstr(cmd_line, "gdb")) {
8062 if (ppc_md.progress)
8063 ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
8064 - printk("kgdb default breakpoint activated\n");
8065 + printk("kgdb breakpoint activated\n");
8069 diff -Nru a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
8070 --- a/arch/ppc/kernel/smp.c Mon Aug 18 19:46:23 2003
8071 +++ b/arch/ppc/kernel/smp.c Fri Aug 22 19:58:08 2003
8073 DEFINE_PER_CPU(unsigned int, prof_multiplier);
8074 DEFINE_PER_CPU(unsigned int, prof_counter);
8075 unsigned long cache_decay_ticks = HZ/100;
8076 -unsigned long cpu_online_map = cpumask_of_cpu(0);
8077 -unsigned long cpu_possible_map = 1UL;
8078 +cpumask_t cpu_online_map;
8079 +cpumask_t cpu_possible_map;
8080 int smp_hw_index[NR_CPUS];
8081 struct thread_info *secondary_ti;
8085 void __init smp_prepare_cpus(unsigned int max_cpus)
8090 /* Fixup boot cpu */
8091 smp_store_cpu_info(smp_processor_id());
8094 /* Probe platform for CPUs: always linear. */
8095 num_cpus = smp_ops->probe();
8096 - cpu_possible_map = (1 << num_cpus)-1;
8097 + for (i = 0; i < num_cpus; ++i)
8098 + cpu_set(i, cpu_possible_map);
8100 /* Backup CPU 0 state */
8102 diff -Nru a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
8103 --- a/arch/ppc/kernel/syscalls.c Tue Jul 15 04:49:49 2003
8104 +++ b/arch/ppc/kernel/syscalls.c Fri Aug 22 19:15:18 2003
8105 @@ -262,4 +262,14 @@
8110 + * We put the arguments in a different order so we only use 6
8111 + * registers for arguments, rather than 7 as sys_fadvise64_64 needs
8112 + * (because `offset' goes in r5/r6).
8114 +long ppc_fadvise64_64(int fd, int advice, loff_t offset, loff_t len)
8116 + return sys_fadvise64_64(fd, offset, len, advice);
8119 cond_syscall(sys_pciconfig_iobase);
8120 diff -Nru a/arch/ppc/platforms/mcpn765_serial.h b/arch/ppc/platforms/mcpn765_serial.h
8121 --- a/arch/ppc/platforms/mcpn765_serial.h Tue Feb 11 15:48:53 2003
8122 +++ b/arch/ppc/platforms/mcpn765_serial.h Mon Jul 21 09:05:22 2003
8126 /* Rate for the 1.8432 Mhz clock for the onboard serial chip */
8127 -#define BASE_BAUD ( 1843200 / 16 )
8128 +#define BASE_BAUD ( 1843200 / 16 )
8129 +#define UART_CLK 1843200
8131 #ifdef CONFIG_SERIAL_DETECT_IRQ
8132 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
8133 diff -Nru a/arch/ppc/platforms/mcpn765_setup.c b/arch/ppc/platforms/mcpn765_setup.c
8134 --- a/arch/ppc/platforms/mcpn765_setup.c Wed Apr 23 00:49:34 2003
8135 +++ b/arch/ppc/platforms/mcpn765_setup.c Mon Jul 21 09:05:22 2003
8137 #include <linux/ide.h>
8138 #include <linux/seq_file.h>
8139 #include <linux/root_dev.h>
8140 +#include <linux/serial.h>
8141 +#include <linux/tty.h> /* for linux/serial_core.h */
8142 +#include <linux/serial_core.h>
8144 #include <asm/system.h>
8145 #include <asm/pgtable.h>
8147 #include <asm/pplus.h>
8149 #include "mcpn765.h"
8150 +#include "mcpn765_serial.h"
8153 static u_char mcpn765_openpic_initsenses[] __initdata = {
8154 - 0, /* 16: i8259 cascade (active high) */
8155 - 1, /* 17: COM1,2,3,4 */
8156 - 1, /* 18: Enet 1 (front panel) */
8157 - 1, /* 19: HAWK WDT XXXX */
8158 - 1, /* 20: 21554 PCI-PCI bridge */
8159 - 1, /* 21: cPCI INTA# */
8160 - 1, /* 22: cPCI INTB# */
8161 - 1, /* 23: cPCI INTC# */
8162 - 1, /* 24: cPCI INTD# */
8163 - 1, /* 25: PMC1 INTA#, PMC2 INTB# */
8164 - 1, /* 26: PMC1 INTB#, PMC2 INTC# */
8165 - 1, /* 27: PMC1 INTC#, PMC2 INTD# */
8166 - 1, /* 28: PMC1 INTD#, PMC2 INTA# */
8167 - 1, /* 29: Enet 2 (connected to J3) */
8168 - 1, /* 30: Abort Switch */
8169 - 1, /* 31: RTC Alarm */
8170 + (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE),/* 16: i8259 cascade */
8171 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 17: COM1,2,3,4 */
8172 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 18: Enet 1 (front) */
8173 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 19: HAWK WDT XXXX */
8174 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 20: 21554 bridge */
8175 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 21: cPCI INTA# */
8176 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 22: cPCI INTB# */
8177 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 23: cPCI INTC# */
8178 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 24: cPCI INTD# */
8179 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 25: PMC1 INTA#,PMC2 INTB#*/
8180 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 26: PMC1 INTB#,PMC2 INTC#*/
8181 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 27: PMC1 INTC#,PMC2 INTD#*/
8182 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 28: PMC1 INTD#,PMC2 INTA#*/
8183 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 29: Enet 2 (J3) */
8184 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 30: Abort Switch */
8185 + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),/* 31: RTC Alarm */
8189 extern u_int openpic_irq(void);
8190 extern char cmd_line[];
8192 +extern void gen550_progress(char *, unsigned short);
8193 +extern void gen550_init(int, struct uart_port *);
8195 int use_of_interrupt_tree = 0;
8197 static void mcpn765_halt(void);
8201 +#if defined(CONFIG_SERIAL_8250) && \
8202 + (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG))
8204 +mcpn765_early_serial_map(void)
8206 + struct uart_port serial_req;
8208 + /* Setup serial port access */
8209 + memset(&serial_req, 0, sizeof(serial_req));
8210 + serial_req.uartclk = UART_CLK;
8211 + serial_req.irq = 17;
8212 + serial_req.flags = STD_COM_FLAGS;
8213 + serial_req.iotype = SERIAL_IO_MEM;
8214 + serial_req.membase = (u_char *)MCPN765_SERIAL_1;
8215 + serial_req.regshift = 4;
8217 + gen550_init(0, &serial_req);
8219 + if (early_serial_setup(&serial_req) != 0)
8220 + printk(KERN_ERR "Early serial init of port 0 failed\n");
8222 + /* Assume early_serial_setup() doesn't modify serial_req */
8223 + serial_req.line = 1;
8224 + serial_req.irq = 17;
8225 + serial_req.membase = (u_char *)MCPN765_SERIAL_2;
8227 + gen550_init(1, &serial_req);
8229 + if (early_serial_setup(&serial_req) != 0)
8230 + printk(KERN_ERR "Early serial init of port 1 failed\n");
8232 + /* Assume early_serial_setup() doesn't modify serial_req */
8233 + serial_req.line = 2;
8234 + serial_req.irq = 17;
8235 + serial_req.membase = (u_char *)MCPN765_SERIAL_3;
8237 + gen550_init(2, &serial_req);
8239 + if (early_serial_setup(&serial_req) != 0)
8240 + printk(KERN_ERR "Early serial init of port 2 failed\n");
8242 + /* Assume early_serial_setup() doesn't modify serial_req */
8243 + serial_req.line = 3;
8244 + serial_req.irq = 17;
8245 + serial_req.membase = (u_char *)MCPN765_SERIAL_4;
8247 + gen550_init(3, &serial_req);
8249 + if (early_serial_setup(&serial_req) != 0)
8250 + printk(KERN_ERR "Early serial init of port 3 failed\n");
8255 mcpn765_setup_arch(void)
8257 @@ -187,12 +248,12 @@
8258 if ( ppc_md.progress )
8259 ppc_md.progress("init_irq: enter", 0);
8261 - openpic_init(1, NUM_8259_INTERRUPTS, NULL, -1);
8262 + openpic_init(NUM_8259_INTERRUPTS);
8264 for(i=0; i < NUM_8259_INTERRUPTS; i++)
8265 irq_desc[i].handler = &i8259_pic;
8270 if ( ppc_md.progress )
8271 ppc_md.progress("init_irq: exit", 0);
8272 @@ -361,65 +422,15 @@
8273 static __inline__ void
8274 mcpn765_set_bat(void)
8276 - unsigned long bat3u, bat3l;
8277 - static int mapping_set = 0;
8279 - if (!mapping_set) {
8281 - __asm__ __volatile__(
8282 - " lis %0,0xf000\n \
8283 - ori %1,%0,0x002a\n \
8284 - ori %0,%0,0x1ffe\n \
8285 - mtspr 0x21e,%0\n \
8286 - mtspr 0x21f,%1\n \
8289 - : "=r" (bat3u), "=r" (bat3l));
8297 -#ifdef CONFIG_SERIAL_TEXT_DEBUG
8298 -#include <linux/serialP.h>
8299 -#include <linux/serial_reg.h>
8300 -#include <asm/serial.h>
8302 -static struct serial_state rs_table[RS_TABLE_SIZE] = {
8303 - SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
8307 -mcpn765_progress(char *s, unsigned short hex)
8310 - volatile unsigned long com_port;
8313 - com_port = rs_table[0].port;
8314 - shift = rs_table[0].iomem_reg_shift;
8316 - while ((c = *s++) != 0) {
8317 - while ((*((volatile unsigned char *)com_port +
8318 - (UART_LSR << shift)) & UART_LSR_THRE) == 0)
8320 - *(volatile unsigned char *)com_port = c;
8323 - while ((*((volatile unsigned char *)com_port +
8324 - (UART_LSR << shift)) & UART_LSR_THRE) == 0)
8326 - *(volatile unsigned char *)com_port = '\r';
8330 + mtspr(DBAT1U, 0xfe8000fe);
8331 + mtspr(DBAT1L, 0xfe80002a);
8334 -#endif /* CONFIG_SERIAL_TEXT_DEBUG */
8337 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
8338 - unsigned long r6, unsigned long r7)
8339 + unsigned long r6, unsigned long r7)
8341 parse_bootinfo(find_bootinfo());
8343 @@ -458,11 +469,13 @@
8344 ppc_md.heartbeat_reset = 0;
8345 ppc_md.heartbeat_count = 0;
8347 -#ifdef CONFIG_SERIAL_TEXT_DEBUG
8348 - ppc_md.progress = mcpn765_progress;
8349 -#else /* !CONFIG_SERIAL_TEXT_DEBUG */
8350 - ppc_md.progress = NULL;
8351 -#endif /* CONFIG_SERIAL_TEXT_DEBUG */
8352 +#if defined(CONFIG_SERIAL_8250) && \
8353 + (defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG))
8354 + mcpn765_early_serial_map();
8355 +#ifdef CONFIG_SERIAL_TEXT_DEBUG
8356 + ppc_md.progress = gen550_progress;
8360 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
8361 ppc_ide_md.default_irq = mcpn765_ide_default_irq;
8362 diff -Nru a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
8363 --- a/arch/ppc/platforms/pmac_cpufreq.c Wed Jul 23 17:04:23 2003
8364 +++ b/arch/ppc/platforms/pmac_cpufreq.c Mon Aug 25 09:51:43 2003
8366 #include <linux/slab.h>
8367 #include <linux/cpufreq.h>
8368 #include <linux/init.h>
8369 +#include <linux/sysdev.h>
8370 #include <asm/prom.h>
8371 #include <asm/machdep.h>
8372 #include <asm/irq.h>
8374 #include <asm/cputable.h>
8375 #include <asm/time.h>
8377 +/* WARNING !!! This will cause calibrate_delay() to be called,
8378 + * but this is an __init function ! So you MUST go edit
8379 + * init/main.c to make it non-init before enabling DEBUG_FREQ
8383 extern void low_choose_750fx_pll(int pll);
8384 extern void low_sleep_handler(void);
8385 -extern void openpic_sleep_save_intrs(void);
8386 -extern void openpic_sleep_restore_intrs(void);
8387 +extern void openpic_suspend(struct sys_device *sysdev, u32 state);
8388 +extern void openpic_resume(struct sys_device *sysdev);
8389 extern void enable_kernel_altivec(void);
8390 extern void enable_kernel_fp(void);
8392 @@ -116,10 +121,7 @@
8393 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
8395 /* Disable all interrupt sources on openpic */
8396 - openpic_sleep_save_intrs();
8398 - /* Make sure the PMU is idle */
8400 + openpic_suspend(NULL, 1);
8402 /* Make sure the decrementer won't interrupt us */
8403 asm volatile("mtdec %0" : : "r" (0x7fffffff));
8404 @@ -153,11 +155,16 @@
8405 pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed);
8406 while (!req.complete)
8409 - pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
8411 + /* Prepare the northbridge for the speed transition */
8412 + pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
8414 + /* Call low level code to backup CPU state and recover from
8417 low_sleep_handler();
8419 + /* Restore the northbridge */
8420 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0);
8422 /* Restore L2 cache */
8423 @@ -174,13 +181,14 @@
8424 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
8427 + /* Restore low level PMU operations */
8430 /* Restore decrementer */
8431 wakeup_decrementer();
8433 /* Restore interrupts */
8434 - openpic_sleep_restore_intrs();
8437 + openpic_resume(NULL);
8439 /* Let interrupts flow again ... */
8441 @@ -195,13 +203,16 @@
8443 do_set_cpu_speed(int speed_mode)
8445 - struct cpufreq_freqs freqs;
8446 + struct cpufreq_freqs freqs;
8449 freqs.old = cur_freq;
8450 freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq;
8451 freqs.cpu = smp_processor_id();
8453 + if (freqs.old == freqs.new)
8456 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
8457 if (cpufreq_uses_pmu)
8458 rc = pmu_set_cpu_speed(speed_mode);
8459 @@ -275,7 +286,10 @@
8460 struct device_node *cpunode;
8462 int has_freq_ctl = 0;
8465 + if (strstr(cmd_line, "nocpufreq"))
8468 /* Assume only one CPU */
8469 cpunode = find_type_devices("cpu");
8471 diff -Nru a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
8472 --- a/arch/ppc/platforms/pmac_pic.c Wed Apr 30 05:41:43 2003
8473 +++ b/arch/ppc/platforms/pmac_pic.c Sun Aug 24 04:12:57 2003
8475 #include <linux/signal.h>
8476 #include <linux/pci.h>
8477 #include <linux/interrupt.h>
8478 +#include <linux/sysdev.h>
8479 +#include <linux/adb.h>
8480 +#include <linux/pmu.h>
8482 #include <asm/sections.h>
8485 #endif /* CONFIG_XMON */
8488 -#ifdef CONFIG_PMAC_PBOOK
8491 * These procedures are used in implementing sleep on the powerbooks.
8492 * sleep_save_intrs() saves the states of all interrupt enables
8493 @@ -515,9 +518,32 @@
8495 unsigned long sleep_save_mask[2];
8498 -pmac_sleep_save_intrs(int viaint)
8499 +/* This used to be passed by the PMU driver but that link got
8500 + * broken with the new driver model. We use this tweak for now...
8502 +static int pmacpic_find_viaint(void)
8506 +#ifdef CONFIG_ADB_PMU
8507 + struct device_node *np;
8509 + if (pmu_get_model() != PMU_OHARE_BASED)
8511 + np = of_find_node_by_name(NULL, "via-pmu");
8514 + viaint = np->intrs[0].line;
8515 +#endif /* CONFIG_ADB_PMU */
8521 +static int pmacpic_suspend(struct sys_device *sysdev, u32 state)
8523 + int viaint = pmacpic_find_viaint();
8525 sleep_save_mask[0] = ppc_cached_irq_mask[0];
8526 sleep_save_mask[1] = ppc_cached_irq_mask[1];
8527 ppc_cached_irq_mask[0] = 0;
8528 @@ -531,10 +557,11 @@
8529 /* make sure mask gets to controller before we return to caller */
8531 (void)in_le32(&pmac_irq_hw[0]->enable);
8537 -pmac_sleep_restore_intrs(void)
8538 +static int pmacpic_resume(struct sys_device *sysdev)
8542 @@ -545,5 +572,39 @@
8543 for (i = 0; i < max_real_irqs; ++i)
8544 if (test_bit(i, sleep_save_mask))
8549 -#endif /* CONFIG_PMAC_PBOOK */
8551 +#endif /* CONFIG_PM */
8553 +static struct sysdev_class pmacpic_sysclass = {
8554 + set_kset_name("pmac_pic"),
8557 +static struct sys_device device_pmacpic = {
8559 + .cls = &pmacpic_sysclass,
8562 +static struct sysdev_driver driver_pmacpic = {
8564 + .suspend = &pmacpic_suspend,
8565 + .resume = &pmacpic_resume,
8566 +#endif /* CONFIG_PM */
8569 +static int __init init_pmacpic_sysfs(void)
8571 + if (max_irqs == 0)
8574 + printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
8575 + sysdev_class_register(&pmacpic_sysclass);
8576 + sys_device_register(&device_pmacpic);
8577 + sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
8581 +subsys_initcall(init_pmacpic_sysfs);
8583 diff -Nru a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
8584 --- a/arch/ppc/platforms/sandpoint.c Tue Jul 1 10:56:46 2003
8585 +++ b/arch/ppc/platforms/sandpoint.c Thu Aug 21 10:19:10 2003
8586 @@ -357,6 +357,21 @@
8590 + * Fix IDE interrupts.
8593 +sandpoint_fix_winbond_83553(void)
8595 + /* Make all 8259 interrupt level sensitive */
8596 + outb(0xf8, 0x4d0);
8597 + outb(0xde, 0x4d1);
8602 +arch_initcall(sandpoint_fix_winbond_83553);
8605 * Initialize the ISA devices on the Nat'l PC87308VUL SuperIO chip.
8608 @@ -390,21 +405,6 @@
8611 arch_initcall(sandpoint_setup_natl_87308);
8614 - * Fix IDE interrupts.
8617 -sandpoint_fix_winbond_83553(void)
8619 - /* Make all 8259 interrupt level sensitive */
8620 - outb(0xf8, 0x4d0);
8621 - outb(0xde, 0x4d1);
8626 -arch_initcall(sandpoint_fix_winbond_83553);
8629 sandpoint_request_io(void)
8630 diff -Nru a/arch/ppc/platforms/sandpoint.h b/arch/ppc/platforms/sandpoint.h
8631 --- a/arch/ppc/platforms/sandpoint.h Tue Jul 1 10:56:46 2003
8632 +++ b/arch/ppc/platforms/sandpoint.h Thu Aug 21 10:19:10 2003
8634 #define UART_CLK 1843200
8636 #ifdef CONFIG_SERIAL_DETECT_IRQ
8637 -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
8638 +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
8640 -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
8641 +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
8644 #define STD_SERIAL_PORT_DFNS \
8645 diff -Nru a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
8646 --- a/arch/ppc/syslib/of_device.c Sat Aug 16 11:48:20 2003
8647 +++ b/arch/ppc/syslib/of_device.c Tue Aug 26 06:35:38 2003
8649 * Used by a driver to check whether an of_device present in the
8650 * system is in its list of supported devices.
8652 -const struct of_match *
8653 -of_match_device(const struct of_match *matches, const struct of_device *dev)
8654 +const struct of_match * of_match_device(const struct of_match *matches,
8655 + const struct of_device *dev)
8664 -of_platform_bus_match(struct device *dev, struct device_driver *drv)
8665 +static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
8667 struct of_device * of_dev = to_of_device(dev);
8668 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
8670 return of_match_device(matches, of_dev) != NULL;
8673 -struct bus_type of_platform_bus_type = {
8674 - name: "of_platform",
8675 - match: of_platform_bus_match,
8677 +struct of_device *of_dev_get(struct of_device *dev)
8679 + struct device *tmp;
8683 + tmp = get_device(&dev->dev);
8685 + return to_of_device(tmp);
8691 -of_bus_driver_init(void)
8692 +void of_dev_put(struct of_device *dev)
8694 - return bus_register(&of_platform_bus_type);
8696 + put_device(&dev->dev);
8699 -postcore_initcall(of_bus_driver_init);
8702 -of_device_probe(struct device *dev)
8703 +static int of_device_probe(struct device *dev)
8705 int error = -ENODEV;
8706 struct of_platform_driver *drv;
8711 -/* if (!try_module_get(driver->owner)) {
8712 - printk(KERN_ERR "Can't get a module reference for %s\n", driver->name);
8716 + of_dev_get(of_dev);
8718 match = of_match_device(drv->match_table, of_dev);
8720 error = drv->probe(of_dev, match);
8722 - module_put(driver->owner);
8725 + of_dev_put(of_dev);
8731 -of_device_remove(struct device *dev)
8732 +static int of_device_remove(struct device *dev)
8734 struct of_device * of_dev = to_of_device(dev);
8735 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8736 @@ -103,32 +104,43 @@
8741 -of_device_suspend(struct device *dev, u32 state, u32 level)
8742 +static int of_device_suspend(struct device *dev, u32 state)
8744 struct of_device * of_dev = to_of_device(dev);
8745 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8748 if (drv && drv->suspend)
8749 - error = drv->suspend(of_dev, state, level);
8750 + error = drv->suspend(of_dev, state);
8755 -of_device_resume(struct device * dev, u32 level)
8756 +static int of_device_resume(struct device * dev)
8758 struct of_device * of_dev = to_of_device(dev);
8759 struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
8762 if (drv && drv->resume)
8763 - error = drv->resume(of_dev, level);
8764 + error = drv->resume(of_dev);
8769 -of_register_driver(struct of_platform_driver *drv)
8770 +struct bus_type of_platform_bus_type = {
8771 + .name = "of_platform",
8772 + .match = of_platform_bus_match,
8773 + .suspend = of_device_suspend,
8774 + .resume = of_device_resume,
8777 +static int __init of_bus_driver_init(void)
8779 + return bus_register(&of_platform_bus_type);
8782 +postcore_initcall(of_bus_driver_init);
8784 +int of_register_driver(struct of_platform_driver *drv)
8789 drv->driver.name = drv->name;
8790 drv->driver.bus = &of_platform_bus_type;
8791 drv->driver.probe = of_device_probe;
8792 - drv->driver.resume = of_device_resume;
8793 - drv->driver.suspend = of_device_suspend;
8794 drv->driver.remove = of_device_remove;
8796 /* register with core */
8797 @@ -145,15 +155,13 @@
8798 return count ? count : 1;
8802 -of_unregister_driver(struct of_platform_driver *drv)
8803 +void of_unregister_driver(struct of_platform_driver *drv)
8805 driver_unregister(&drv->driver);
8810 -dev_show_devspec(struct device *dev, char *buf)
8811 +static ssize_t dev_show_devspec(struct device *dev, char *buf)
8813 struct of_device *ofdev;
8815 @@ -163,8 +171,22 @@
8817 static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
8820 -of_device_register(struct of_device *ofdev)
8822 + * of_release_dev - free an of device structure when all users of it are finished.
8823 + * @dev: device that's been disconnected
8825 + * Will be called only by the device core when all users of this of device are
8828 +void of_release_dev(struct device *dev)
8830 + struct of_device *ofdev;
8832 + ofdev = to_of_device(dev);
8836 +int of_device_register(struct of_device *ofdev)
8839 struct of_device **odprop;
8840 @@ -197,21 +219,20 @@
8845 -of_device_unregister(struct of_device *ofdev)
8846 +void of_device_unregister(struct of_device *ofdev)
8848 struct of_device **odprop;
8850 device_remove_file(&ofdev->dev, &dev_attr_devspec);
8851 - device_unregister(&ofdev->dev);
8853 odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
8857 + device_unregister(&ofdev->dev);
8861 -of_platform_device_create(struct device_node *np, const char *bus_id)
8862 +struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id)
8864 struct of_device *dev;
8867 dev->dev.dma_mask = &dev->dma_mask;
8868 dev->dev.parent = NULL;
8869 dev->dev.bus = &of_platform_bus_type;
8870 + dev->dev.release = of_release_dev;
8872 reg = (u32 *)get_property(np, "reg", NULL);
8873 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
8875 EXPORT_SYMBOL(of_unregister_driver);
8876 EXPORT_SYMBOL(of_device_register);
8877 EXPORT_SYMBOL(of_device_unregister);
8878 +EXPORT_SYMBOL(of_dev_get);
8879 +EXPORT_SYMBOL(of_dev_put);
8880 EXPORT_SYMBOL(of_platform_device_create);
8881 +EXPORT_SYMBOL(of_release_dev);
8882 diff -Nru a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
8883 --- a/arch/ppc/syslib/open_pic.c Tue Jul 15 10:01:29 2003
8884 +++ b/arch/ppc/syslib/open_pic.c Sun Aug 24 04:11:21 2003
8886 #include <linux/init.h>
8887 #include <linux/irq.h>
8888 #include <linux/interrupt.h>
8889 +#include <linux/sysdev.h>
8890 #include <asm/ptrace.h>
8891 #include <asm/signal.h>
8897 -#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PMAC_PBOOK)
8898 +#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PM)
8899 static void openpic_reset(void)
8901 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
8903 openpic_write(&OpenPIC->Global.Processor_Initialization, mask);
8906 -#if defined(CONFIG_SMP) || defined(CONFIG_PMAC_PBOOK)
8907 +#if defined(CONFIG_SMP) || defined(CONFIG_PM)
8908 static spinlock_t openpic_setup_lock = SPIN_LOCK_UNLOCKED;
8911 @@ -864,20 +865,55 @@
8913 #endif /* CONFIG_SMP */
8915 -#ifdef CONFIG_PMAC_PBOOK
8919 + * We implement the IRQ controller as a sysdev and put it
8920 + * to sleep at powerdown stage (the callback is named suspend,
8921 + * but it's old semantics, for the Device Model, it's really
8922 + * powerdown). The possible problem is that another sysdev that
8923 + * happens to be suspend after this one will have interrupts off,
8924 + * that may be an issue... For now, this isn't an issue on pmac
8928 static u32 save_ipi_vp[OPENPIC_NUM_IPI];
8929 static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
8930 static u32 save_irq_src_dest[OPENPIC_MAX_SOURCES];
8931 static u32 save_cpu_task_pri[OPENPIC_MAX_PROCESSORS];
8932 +static int openpic_suspend_count;
8934 +static void openpic_cached_enable_irq(u_int irq)
8936 + check_arg_irq(irq);
8937 + save_irq_src_vp[irq - open_pic_irq_offset] &= ~OPENPIC_MASK;
8941 -openpic_sleep_save_intrs(void)
8942 +static void openpic_cached_disable_irq(u_int irq)
8944 + check_arg_irq(irq);
8945 + save_irq_src_vp[irq - open_pic_irq_offset] |= OPENPIC_MASK;
8948 +/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
8949 + * we need something better to deal with that... Maybe switch to S1 for
8952 +int openpic_suspend(struct sys_device *sysdev, u32 state)
8955 unsigned long flags;
8957 spin_lock_irqsave(&openpic_setup_lock, flags);
8959 + if (openpic_suspend_count++ > 0) {
8960 + spin_unlock_irqrestore(&openpic_setup_lock, flags);
8964 + open_pic.enable = openpic_cached_enable_irq;
8965 + open_pic.disable = openpic_cached_disable_irq;
8967 for (i=0; i<NumProcessors; i++) {
8968 save_cpu_task_pri[i] = openpic_read(&OpenPIC->Processor[i].Current_Task_Priority);
8969 openpic_writefield(&OpenPIC->Processor[i].Current_Task_Priority,
8970 @@ -889,38 +925,112 @@
8971 for (i=0; i<NumSources; i++) {
8974 - save_irq_src_vp[i] = openpic_read(&ISR[i]->Vector_Priority)
8975 - & ~OPENPIC_ACTIVITY;
8976 + save_irq_src_vp[i] = openpic_read(&ISR[i]->Vector_Priority) & ~OPENPIC_ACTIVITY;
8977 save_irq_src_dest[i] = openpic_read(&ISR[i]->Destination);
8980 spin_unlock_irqrestore(&openpic_setup_lock, flags);
8986 -openpic_sleep_restore_intrs(void)
8987 +/* WARNING: Can be called directly by the cpufreq code with NULL parameter,
8988 + * we need something better to deal with that... Maybe switch to S1 for
8991 +int openpic_resume(struct sys_device *sysdev)
8994 unsigned long flags;
8995 + u32 vppmask = OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
8996 + OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK |
8999 spin_lock_irqsave(&openpic_setup_lock, flags);
9001 + if ((--openpic_suspend_count) > 0) {
9002 + spin_unlock_irqrestore(&openpic_setup_lock, flags);
9008 + /* OpenPIC sometimes seem to need some time to be fully back up... */
9010 + openpic_set_spurious(OPENPIC_VEC_SPURIOUS+open_pic_irq_offset);
9011 + } while(openpic_readfield(&OpenPIC->Global.Spurious_Vector, OPENPIC_VECTOR_MASK)
9012 + != (OPENPIC_VEC_SPURIOUS + open_pic_irq_offset));
9014 + openpic_disable_8259_pass_through();
9016 for (i=0; i<OPENPIC_NUM_IPI; i++)
9017 openpic_write(&OpenPIC->Global.IPI_Vector_Priority(i),
9019 for (i=0; i<NumSources; i++) {
9022 - openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
9023 openpic_write(&ISR[i]->Destination, save_irq_src_dest[i]);
9024 + openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
9025 + /* make sure mask gets to controller before we return to user */
9027 + openpic_write(&ISR[i]->Vector_Priority, save_irq_src_vp[i]);
9028 + } while (openpic_readfield(&ISR[i]->Vector_Priority, vppmask)
9029 + != (save_irq_src_vp[i] & vppmask));
9031 - openpic_set_spurious(OPENPIC_VEC_SPURIOUS+open_pic_irq_offset);
9032 - openpic_disable_8259_pass_through();
9033 for (i=0; i<NumProcessors; i++)
9034 openpic_write(&OpenPIC->Processor[i].Current_Task_Priority,
9035 save_cpu_task_pri[i]);
9037 + open_pic.enable = openpic_enable_irq;
9038 + open_pic.disable = openpic_disable_irq;
9040 spin_unlock_irqrestore(&openpic_setup_lock, flags);
9045 +#endif /* CONFIG_PM */
9047 +static struct sysdev_class openpic_sysclass = {
9048 + set_kset_name("openpic"),
9051 +static struct sys_device device_openpic = {
9053 + .cls = &openpic_sysclass,
9056 +static struct sysdev_driver driver_openpic = {
9058 + .suspend = &openpic_suspend,
9059 + .resume = &openpic_resume,
9060 +#endif /* CONFIG_PM */
9063 +static int __init init_openpic_sysfs(void)
9067 + if (!OpenPIC_Addr)
9069 + printk(KERN_DEBUG "Registering openpic with sysfs...\n");
9070 + rc = sysdev_class_register(&openpic_sysclass);
9072 + printk(KERN_ERR "Failed registering openpic sys class\n");
9075 + rc = sys_device_register(&device_openpic);
9077 + printk(KERN_ERR "Failed registering openpic sys device\n");
9080 + rc = sysdev_driver_register(&openpic_sysclass, &driver_openpic);
9082 + printk(KERN_ERR "Failed registering openpic sys driver\n");
9087 -#endif /* CONFIG_PMAC_PBOOK */
9089 +subsys_initcall(init_openpic_sysfs);
9091 diff -Nru a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c
9092 --- a/arch/ppc/syslib/prom.c Sat Jun 7 02:18:01 2003
9093 +++ b/arch/ppc/syslib/prom.c Sun Aug 24 03:57:52 2003
9094 @@ -941,6 +941,184 @@
9100 + * New implementation of the OF "find" APIs, return a refcounted
9101 + * object, call of_node_put() when done. Currently, still lacks
9102 + * locking as old implementation, this is beeing done for ppc64.
9104 + * Note that property management will need some locking as well,
9105 + * this isn't dealt with yet
9110 + * of_find_node_by_name - Find a node by it's "name" property
9111 + * @from: The node to start searching from or NULL, the node
9112 + * you pass will not be searched, only the next one
9113 + * will; typically, you pass what the previous call
9114 + * returned. of_node_put() will be called on it
9115 + * @name: The name string to match against
9117 + * Returns a node pointer with refcount incremented, use
9118 + * of_node_put() on it when done.
9120 +struct device_node *of_find_node_by_name(struct device_node *from,
9123 + struct device_node *np = from ? from->allnext : allnodes;
9125 + for (; np != 0; np = np->allnext)
9126 + if (np->name != 0 && strcasecmp(np->name, name) == 0)
9129 + of_node_put(from);
9130 + return of_node_get(np);
9134 + * of_find_node_by_type - Find a node by it's "device_type" property
9135 + * @from: The node to start searching from or NULL, the node
9136 + * you pass will not be searched, only the next one
9137 + * will; typically, you pass what the previous call
9138 + * returned. of_node_put() will be called on it
9139 + * @name: The type string to match against
9141 + * Returns a node pointer with refcount incremented, use
9142 + * of_node_put() on it when done.
9144 +struct device_node *of_find_node_by_type(struct device_node *from,
9147 + struct device_node *np = from ? from->allnext : allnodes;
9149 + for (; np != 0; np = np->allnext)
9150 + if (np->type != 0 && strcasecmp(np->type, type) == 0)
9153 + of_node_put(from);
9154 + return of_node_get(np);
9158 + * of_find_compatible_node - Find a node based on type and one of the
9159 + * tokens in it's "compatible" property
9160 + * @from: The node to start searching from or NULL, the node
9161 + * you pass will not be searched, only the next one
9162 + * will; typically, you pass what the previous call
9163 + * returned. of_node_put() will be called on it
9164 + * @type: The type string to match "device_type" or NULL to ignore
9165 + * @compatible: The string to match to one of the tokens in the device
9166 + * "compatible" list.
9168 + * Returns a node pointer with refcount incremented, use
9169 + * of_node_put() on it when done.
9171 +struct device_node *of_find_compatible_node(struct device_node *from,
9172 + const char *type, const char *compatible)
9174 + struct device_node *np = from ? from->allnext : allnodes;
9176 + for (; np != 0; np = np->allnext) {
9178 + && !(np->type != 0 && strcasecmp(np->type, type) == 0))
9180 + if (device_is_compatible(np, compatible))
9184 + of_node_put(from);
9185 + return of_node_get(np);
9189 + * of_find_node_by_path - Find a node matching a full OF path
9190 + * @path: The full path to match
9192 + * Returns a node pointer with refcount incremented, use
9193 + * of_node_put() on it when done.
9195 +struct device_node *of_find_node_by_path(const char *path)
9197 + struct device_node *np = allnodes;
9199 + for (; np != 0; np = np->allnext)
9200 + if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
9202 + return of_node_get(np);
9206 + * of_find_all_nodes - Get next node in global list
9207 + * @prev: Previous node or NULL to start iteration
9208 + * of_node_put() will be called on it
9210 + * Returns a node pointer with refcount incremented, use
9211 + * of_node_put() on it when done.
9213 +struct device_node *of_find_all_nodes(struct device_node *prev)
9215 + return of_node_get(prev ? prev->allnext : allnodes);
9219 + * of_get_parent - Get a node's parent if any
9220 + * @node: Node to get parent
9222 + * Returns a node pointer with refcount incremented, use
9223 + * of_node_put() on it when done.
9225 +struct device_node *of_get_parent(const struct device_node *node)
9227 + return node ? of_node_get(node->parent) : NULL;
9231 + * of_get_next_child - Iterate a node childs
9232 + * @node: parent node
9233 + * @prev: previous child of the parent node, or NULL to get first
9235 + * Returns a node pointer with refcount incremented, use
9236 + * of_node_put() on it when done.
9238 +struct device_node *of_get_next_child(const struct device_node *node,
9239 + struct device_node *prev)
9241 + struct device_node *next = prev ? prev->sibling : node->child;
9243 + for (; next != 0; next = next->sibling)
9244 + if (of_node_get(next))
9247 + of_node_put(prev);
9252 + * of_node_get - Increment refcount of a node
9253 + * @node: Node to inc refcount, NULL is supported to
9254 + * simplify writing of callers
9256 + * Returns the node itself or NULL if gone. Current implementation
9257 + * does nothing as we don't yet do dynamic node allocation on ppc32
9259 +struct device_node *of_node_get(struct device_node *node)
9265 + * of_node_put - Decrement refcount of a node
9266 + * @node: Node to dec refcount, NULL is supported to
9267 + * simplify writing of callers
9269 + * Current implementation does nothing as we don't yet do dynamic node
9270 + * allocation on ppc32
9272 +void of_node_put(struct device_node *node)
9277 * Find the device_node with a given phandle.
9279 diff -Nru a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
9280 --- a/arch/ppc/xmon/start.c Sat Jun 7 02:18:02 2003
9281 +++ b/arch/ppc/xmon/start.c Sun Aug 24 07:39:33 2003
9282 @@ -225,14 +225,13 @@
9283 static int scc_initialized = 0;
9285 void xmon_init_scc(void);
9286 -extern void pmu_poll(void);
9287 extern void cuda_poll(void);
9289 static inline void do_poll_adb(void)
9291 #ifdef CONFIG_ADB_PMU
9292 if (sys_ctrler == SYS_CTRLER_PMU)
9295 #endif /* CONFIG_ADB_PMU */
9296 #ifdef CONFIG_ADB_CUDA
9297 if (sys_ctrler == SYS_CTRLER_CUDA)
9298 diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
9299 --- a/arch/ppc64/Kconfig Mon Aug 18 19:46:23 2003
9300 +++ b/arch/ppc64/Kconfig Sun Aug 31 16:14:22 2003
9301 @@ -175,22 +175,6 @@
9305 -# only elf supported, a.out is not -- Cort
9308 - depends on PROC_FS
9311 - If you enabled support for /proc file system then the file
9312 - /proc/kcore will contain the kernel core image in ELF format. This
9313 - can be used in gdb:
9315 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
9317 - This is especially useful if you have compiled the kernel with the
9318 - "-g" option to preserve debugging information. It is mainly used
9319 - for examining kernel data structures on the live kernel.
9321 source "fs/Kconfig.binfmt"
9323 source "drivers/pci/Kconfig"
9324 diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c
9325 --- a/arch/ppc64/kernel/ioctl32.c Fri Aug 8 14:53:47 2003
9326 +++ b/arch/ppc64/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
9328 #define IOCTL_TABLE_START \
9329 struct ioctl_trans ioctl_start[] = {
9330 #define IOCTL_TABLE_END \
9331 - }; struct ioctl_trans ioctl_end[0];
9335 #include <linux/compat_ioctl.h>
9337 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb)
9338 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
9341 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
9342 diff -Nru a/arch/ppc64/kernel/proc_ppc64.c b/arch/ppc64/kernel/proc_ppc64.c
9343 --- a/arch/ppc64/kernel/proc_ppc64.c Tue Mar 25 20:30:59 2003
9344 +++ b/arch/ppc64/kernel/proc_ppc64.c Sun Aug 31 16:14:08 2003
9346 static int page_map_mmap( struct file *file, struct vm_area_struct *vma );
9348 static struct file_operations page_map_fops = {
9349 - llseek: page_map_seek,
9350 - read: page_map_read,
9351 - mmap: page_map_mmap
9352 + .llseek = page_map_seek,
9353 + .read = page_map_read,
9354 + .mmap = page_map_mmap
9358 diff -Nru a/arch/ppc64/kernel/scanlog.c b/arch/ppc64/kernel/scanlog.c
9359 --- a/arch/ppc64/kernel/scanlog.c Thu Feb 13 00:47:26 2003
9360 +++ b/arch/ppc64/kernel/scanlog.c Sun Aug 31 16:14:08 2003
9361 @@ -190,11 +190,11 @@
9364 struct file_operations scanlog_fops = {
9365 - owner: THIS_MODULE,
9366 - read: scanlog_read,
9367 - write: scanlog_write,
9368 - open: scanlog_open,
9369 - release: scanlog_release,
9370 + .owner = THIS_MODULE,
9371 + .read = scanlog_read,
9372 + .write = scanlog_write,
9373 + .open = scanlog_open,
9374 + .release = scanlog_release,
9377 int __init scanlog_init(void)
9378 diff -Nru a/arch/s390/Kconfig b/arch/s390/Kconfig
9379 --- a/arch/s390/Kconfig Mon Jul 21 13:25:16 2003
9380 +++ b/arch/s390/Kconfig Sun Aug 31 16:14:22 2003
9381 @@ -217,10 +217,6 @@
9389 source "fs/Kconfig.binfmt"
9391 config PROCESS_DEBUG
9392 diff -Nru a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c
9393 --- a/arch/s390/kernel/compat_ioctl.c Tue May 27 12:34:41 2003
9394 +++ b/arch/s390/kernel/compat_ioctl.c Sun Aug 31 16:14:44 2003
9396 #define IOCTL_TABLE_START \
9397 struct ioctl_trans ioctl_start[] = {
9398 #define IOCTL_TABLE_END \
9399 - }; struct ioctl_trans ioctl_end[0];
9403 #include <linux/compat_ioctl.h>
9405 HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans)
9409 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
9410 diff -Nru a/arch/sh/Kconfig b/arch/sh/Kconfig
9411 --- a/arch/sh/Kconfig Sat Aug 2 14:26:16 2003
9412 +++ b/arch/sh/Kconfig Sun Aug 31 16:14:22 2003
9413 @@ -729,40 +729,6 @@
9415 menu "Executable file formats"
9418 - prompt "Kernel core (/proc/kcore) format"
9419 - depends on PROC_FS
9425 - If you enabled support for /proc file system then the file
9426 - /proc/kcore will contain the kernel core image. This can be used
9429 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
9431 - You have two choices here: ELF and A.OUT. Selecting ELF will make
9432 - /proc/kcore appear in ELF core format as defined by the Executable
9433 - and Linking Format specification. Selecting A.OUT will choose the
9434 - old "a.out" format which may be necessary for some old versions
9435 - of binutils or on some architectures.
9437 - This is especially useful if you have compiled the kernel with the
9438 - "-g" option to preserve debugging information. It is mainly used
9439 - for examining kernel data structures on the live kernel so if you
9440 - don't understand what this means or are not a kernel hacker, just
9441 - leave it at its default value ELF.
9446 - Not necessary unless you're using a very out-of-date binutils
9447 - version. You probably want KCORE_ELF.
9451 source "fs/Kconfig.binfmt"
9454 diff -Nru a/arch/sh/boards/adx/mach.c b/arch/sh/boards/adx/mach.c
9455 --- a/arch/sh/boards/adx/mach.c Mon May 19 16:04:36 2003
9456 +++ b/arch/sh/boards/adx/mach.c Sun Aug 31 16:14:08 2003
9460 struct sh_machine_vector mv_adx __initmv = {
9467 - mv_outb: adx_outb,
9468 - mv_outw: adx_outw,
9469 - mv_outl: adx_outl,
9471 - mv_inb_p: adx_inb_p,
9472 - mv_inw_p: adx_inw,
9473 - mv_inl_p: adx_inl,
9474 - mv_outb_p: adx_outb_p,
9475 - mv_outw_p: adx_outw,
9476 - mv_outl_p: adx_outl,
9478 - mv_insb: adx_insb,
9479 - mv_insw: adx_insw,
9480 - mv_insl: adx_insl,
9481 - mv_outsb: adx_outsb,
9482 - mv_outsw: adx_outsw,
9483 - mv_outsl: adx_outsl,
9485 - mv_readb: adx_readb,
9486 - mv_readw: adx_readw,
9487 - mv_readl: adx_readl,
9488 - mv_writeb: adx_writeb,
9489 - mv_writew: adx_writew,
9490 - mv_writel: adx_writel,
9491 + .mv_inb = adx_inb,
9492 + .mv_inw = adx_inw,
9493 + .mv_inl = adx_inl,
9494 + .mv_outb = adx_outb,
9495 + .mv_outw = adx_outw,
9496 + .mv_outl = adx_outl,
9498 + .mv_inb_p = adx_inb_p,
9499 + .mv_inw_p = adx_inw,
9500 + .mv_inl_p = adx_inl,
9501 + .mv_outb_p = adx_outb_p,
9502 + .mv_outw_p = adx_outw,
9503 + .mv_outl_p = adx_outl,
9505 + .mv_insb = adx_insb,
9506 + .mv_insw = adx_insw,
9507 + .mv_insl = adx_insl,
9508 + .mv_outsb = adx_outsb,
9509 + .mv_outsw = adx_outsw,
9510 + .mv_outsl = adx_outsl,
9512 + .mv_readb = adx_readb,
9513 + .mv_readw = adx_readw,
9514 + .mv_readl = adx_readl,
9515 + .mv_writeb = adx_writeb,
9516 + .mv_writew = adx_writew,
9517 + .mv_writel = adx_writel,
9519 - mv_ioremap: adx_ioremap,
9520 - mv_iounmap: adx_iounmap,
9521 + .mv_ioremap = adx_ioremap,
9522 + .mv_iounmap = adx_iounmap,
9524 - mv_isa_port2addr: adx_isa_port2addr,
9525 + .mv_isa_port2addr = adx_isa_port2addr,
9527 - mv_init_irq: init_adx_IRQ,
9528 + .mv_init_irq = init_adx_IRQ,
9531 diff -Nru a/arch/sh/boards/bigsur/mach.c b/arch/sh/boards/bigsur/mach.c
9532 --- a/arch/sh/boards/bigsur/mach.c Sat Mar 2 08:57:07 2002
9533 +++ b/arch/sh/boards/bigsur/mach.c Sun Aug 31 16:14:08 2003
9535 extern void init_bigsur_IRQ(void);
9537 struct sh_machine_vector mv_bigsur __initmv = {
9538 - mv_nr_irqs: NR_IRQS, // Defined in <asm/irq.h>
9539 - mv_inb: bigsur_inb,
9540 - mv_inw: bigsur_inw,
9541 - mv_inl: bigsur_inl,
9542 - mv_outb: bigsur_outb,
9543 - mv_outw: bigsur_outw,
9544 - mv_outl: bigsur_outl,
9546 - mv_inb_p: bigsur_inb_p,
9547 - mv_inw_p: bigsur_inw,
9548 - mv_inl_p: bigsur_inl,
9549 - mv_outb_p: bigsur_outb_p,
9550 - mv_outw_p: bigsur_outw,
9551 - mv_outl_p: bigsur_outl,
9553 - mv_insb: bigsur_insb,
9554 - mv_insw: bigsur_insw,
9555 - mv_insl: bigsur_insl,
9556 - mv_outsb: bigsur_outsb,
9557 - mv_outsw: bigsur_outsw,
9558 - mv_outsl: bigsur_outsl,
9560 - mv_readb: generic_readb,
9561 - mv_readw: generic_readw,
9562 - mv_readl: generic_readl,
9563 - mv_writeb: generic_writeb,
9564 - mv_writew: generic_writew,
9565 - mv_writel: generic_writel,
9566 + .mv_nr_irqs = NR_IRQS, // Defined in <asm/irq.h>
9567 + .mv_inb = bigsur_inb,
9568 + .mv_inw = bigsur_inw,
9569 + .mv_inl = bigsur_inl,
9570 + .mv_outb = bigsur_outb,
9571 + .mv_outw = bigsur_outw,
9572 + .mv_outl = bigsur_outl,
9574 + .mv_inb_p = bigsur_inb_p,
9575 + .mv_inw_p = bigsur_inw,
9576 + .mv_inl_p = bigsur_inl,
9577 + .mv_outb_p = bigsur_outb_p,
9578 + .mv_outw_p = bigsur_outw,
9579 + .mv_outl_p = bigsur_outl,
9581 + .mv_insb = bigsur_insb,
9582 + .mv_insw = bigsur_insw,
9583 + .mv_insl = bigsur_insl,
9584 + .mv_outsb = bigsur_outsb,
9585 + .mv_outsw = bigsur_outsw,
9586 + .mv_outsl = bigsur_outsl,
9588 + .mv_readb = generic_readb,
9589 + .mv_readw = generic_readw,
9590 + .mv_readl = generic_readl,
9591 + .mv_writeb = generic_writeb,
9592 + .mv_writew = generic_writew,
9593 + .mv_writel = generic_writel,
9595 - mv_ioremap: generic_ioremap,
9596 - mv_iounmap: generic_iounmap,
9597 + .mv_ioremap = generic_ioremap,
9598 + .mv_iounmap = generic_iounmap,
9600 - mv_isa_port2addr: bigsur_isa_port2addr,
9601 - mv_irq_demux: bigsur_irq_demux,
9602 + .mv_isa_port2addr = bigsur_isa_port2addr,
9603 + .mv_irq_demux = bigsur_irq_demux,
9605 - mv_init_irq: init_bigsur_IRQ,
9606 + .mv_init_irq = init_bigsur_IRQ,
9607 #ifdef CONFIG_HEARTBEAT
9608 - mv_heartbeat: heartbeat_bigsur,
9609 + .mv_heartbeat = heartbeat_bigsur,
9613 diff -Nru a/arch/sh/boards/cat68701/mach.c b/arch/sh/boards/cat68701/mach.c
9614 --- a/arch/sh/boards/cat68701/mach.c Sat Mar 2 08:57:07 2002
9615 +++ b/arch/sh/boards/cat68701/mach.c Sun Aug 31 16:14:08 2003
9619 struct sh_machine_vector mv_cat68701 __initmv = {
9621 - mv_inb: cat68701_inb,
9622 - mv_inw: cat68701_inw,
9623 - mv_inl: cat68701_inl,
9624 - mv_outb: cat68701_outb,
9625 - mv_outw: cat68701_outw,
9626 - mv_outl: cat68701_outl,
9628 - mv_inb_p: cat68701_inb_p,
9629 - mv_inw_p: cat68701_inw,
9630 - mv_inl_p: cat68701_inl,
9631 - mv_outb_p: cat68701_outb_p,
9632 - mv_outw_p: cat68701_outw,
9633 - mv_outl_p: cat68701_outl,
9635 - mv_insb: cat68701_insb,
9636 - mv_insw: cat68701_insw,
9637 - mv_insl: cat68701_insl,
9638 - mv_outsb: cat68701_outsb,
9639 - mv_outsw: cat68701_outsw,
9640 - mv_outsl: cat68701_outsl,
9642 - mv_readb: cat68701_readb,
9643 - mv_readw: cat68701_readw,
9644 - mv_readl: cat68701_readl,
9645 - mv_writeb: cat68701_writeb,
9646 - mv_writew: cat68701_writew,
9647 - mv_writel: cat68701_writel,
9649 + .mv_inb = cat68701_inb,
9650 + .mv_inw = cat68701_inw,
9651 + .mv_inl = cat68701_inl,
9652 + .mv_outb = cat68701_outb,
9653 + .mv_outw = cat68701_outw,
9654 + .mv_outl = cat68701_outl,
9656 + .mv_inb_p = cat68701_inb_p,
9657 + .mv_inw_p = cat68701_inw,
9658 + .mv_inl_p = cat68701_inl,
9659 + .mv_outb_p = cat68701_outb_p,
9660 + .mv_outw_p = cat68701_outw,
9661 + .mv_outl_p = cat68701_outl,
9663 + .mv_insb = cat68701_insb,
9664 + .mv_insw = cat68701_insw,
9665 + .mv_insl = cat68701_insl,
9666 + .mv_outsb = cat68701_outsb,
9667 + .mv_outsw = cat68701_outsw,
9668 + .mv_outsl = cat68701_outsl,
9670 + .mv_readb = cat68701_readb,
9671 + .mv_readw = cat68701_readw,
9672 + .mv_readl = cat68701_readl,
9673 + .mv_writeb = cat68701_writeb,
9674 + .mv_writew = cat68701_writew,
9675 + .mv_writel = cat68701_writel,
9677 - mv_ioremap: cat68701_ioremap,
9678 - mv_iounmap: cat68701_iounmap,
9679 + .mv_ioremap = cat68701_ioremap,
9680 + .mv_iounmap = cat68701_iounmap,
9682 - mv_isa_port2addr: cat68701_isa_port2addr,
9683 - mv_irq_demux: cat68701_irq_demux,
9684 + .mv_isa_port2addr = cat68701_isa_port2addr,
9685 + .mv_irq_demux = cat68701_irq_demux,
9687 - mv_init_irq: init_cat68701_IRQ,
9688 + .mv_init_irq = init_cat68701_IRQ,
9689 #ifdef CONFIG_HEARTBEAT
9690 - mv_heartbeat: heartbeat_cat68701,
9691 + .mv_heartbeat = heartbeat_cat68701,
9695 diff -Nru a/arch/sh/boards/cqreek/mach.c b/arch/sh/boards/cqreek/mach.c
9696 --- a/arch/sh/boards/cqreek/mach.c Sat Jun 14 11:02:09 2003
9697 +++ b/arch/sh/boards/cqreek/mach.c Sun Aug 31 16:14:08 2003
9700 struct sh_machine_vector mv_cqreek __initmv = {
9701 #if defined(CONFIG_CPU_SH4)
9704 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
9707 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
9712 - mv_inb: generic_inb,
9713 - mv_inw: generic_inw,
9714 - mv_inl: generic_inl,
9715 - mv_outb: generic_outb,
9716 - mv_outw: generic_outw,
9717 - mv_outl: generic_outl,
9719 - mv_inb_p: generic_inb_p,
9720 - mv_inw_p: generic_inw_p,
9721 - mv_inl_p: generic_inl_p,
9722 - mv_outb_p: generic_outb_p,
9723 - mv_outw_p: generic_outw_p,
9724 - mv_outl_p: generic_outl_p,
9726 - mv_insb: generic_insb,
9727 - mv_insw: generic_insw,
9728 - mv_insl: generic_insl,
9729 - mv_outsb: generic_outsb,
9730 - mv_outsw: generic_outsw,
9731 - mv_outsl: generic_outsl,
9733 - mv_readb: generic_readb,
9734 - mv_readw: generic_readw,
9735 - mv_readl: generic_readl,
9736 - mv_writeb: generic_writeb,
9737 - mv_writew: generic_writew,
9738 - mv_writel: generic_writel,
9739 + .mv_inb = generic_inb,
9740 + .mv_inw = generic_inw,
9741 + .mv_inl = generic_inl,
9742 + .mv_outb = generic_outb,
9743 + .mv_outw = generic_outw,
9744 + .mv_outl = generic_outl,
9746 + .mv_inb_p = generic_inb_p,
9747 + .mv_inw_p = generic_inw_p,
9748 + .mv_inl_p = generic_inl_p,
9749 + .mv_outb_p = generic_outb_p,
9750 + .mv_outw_p = generic_outw_p,
9751 + .mv_outl_p = generic_outl_p,
9753 + .mv_insb = generic_insb,
9754 + .mv_insw = generic_insw,
9755 + .mv_insl = generic_insl,
9756 + .mv_outsb = generic_outsb,
9757 + .mv_outsw = generic_outsw,
9758 + .mv_outsl = generic_outsl,
9760 + .mv_readb = generic_readb,
9761 + .mv_readw = generic_readw,
9762 + .mv_readl = generic_readl,
9763 + .mv_writeb = generic_writeb,
9764 + .mv_writew = generic_writew,
9765 + .mv_writel = generic_writel,
9767 - mv_init_irq: init_cqreek_IRQ,
9768 + .mv_init_irq = init_cqreek_IRQ,
9770 - mv_isa_port2addr: cqreek_port2addr,
9771 + .mv_isa_port2addr = cqreek_port2addr,
9773 - mv_ioremap: generic_ioremap,
9774 - mv_iounmap: generic_iounmap,
9775 + .mv_ioremap = generic_ioremap,
9776 + .mv_iounmap = generic_iounmap,
9779 diff -Nru a/arch/sh/boards/dmida/mach.c b/arch/sh/boards/dmida/mach.c
9780 --- a/arch/sh/boards/dmida/mach.c Mon May 19 16:04:36 2003
9781 +++ b/arch/sh/boards/dmida/mach.c Sun Aug 31 16:14:08 2003
9785 struct sh_machine_vector mv_dmida __initmv = {
9787 + .mv_name = "DMIDA",
9789 - mv_nr_irqs: HD64465_IRQ_BASE+HD64465_IRQ_NUM,
9790 + .mv_nr_irqs = HD64465_IRQ_BASE+HD64465_IRQ_NUM,
9792 - mv_inb: hd64465_inb,
9793 - mv_inw: hd64465_inw,
9794 - mv_inl: hd64465_inl,
9795 - mv_outb: hd64465_outb,
9796 - mv_outw: hd64465_outw,
9797 - mv_outl: hd64465_outl,
9799 - mv_inb_p: hd64465_inb_p,
9800 - mv_inw_p: hd64465_inw,
9801 - mv_inl_p: hd64465_inl,
9802 - mv_outb_p: hd64465_outb_p,
9803 - mv_outw_p: hd64465_outw,
9804 - mv_outl_p: hd64465_outl,
9806 - mv_insb: hd64465_insb,
9807 - mv_insw: hd64465_insw,
9808 - mv_insl: hd64465_insl,
9809 - mv_outsb: hd64465_outsb,
9810 - mv_outsw: hd64465_outsw,
9811 - mv_outsl: hd64465_outsl,
9813 - mv_readb: generic_readb,
9814 - mv_readw: generic_readw,
9815 - mv_readl: generic_readl,
9816 - mv_writeb: generic_writeb,
9817 - mv_writew: generic_writew,
9818 - mv_writel: generic_writel,
9819 + .mv_inb = hd64465_inb,
9820 + .mv_inw = hd64465_inw,
9821 + .mv_inl = hd64465_inl,
9822 + .mv_outb = hd64465_outb,
9823 + .mv_outw = hd64465_outw,
9824 + .mv_outl = hd64465_outl,
9826 + .mv_inb_p = hd64465_inb_p,
9827 + .mv_inw_p = hd64465_inw,
9828 + .mv_inl_p = hd64465_inl,
9829 + .mv_outb_p = hd64465_outb_p,
9830 + .mv_outw_p = hd64465_outw,
9831 + .mv_outl_p = hd64465_outl,
9833 + .mv_insb = hd64465_insb,
9834 + .mv_insw = hd64465_insw,
9835 + .mv_insl = hd64465_insl,
9836 + .mv_outsb = hd64465_outsb,
9837 + .mv_outsw = hd64465_outsw,
9838 + .mv_outsl = hd64465_outsl,
9840 + .mv_readb = generic_readb,
9841 + .mv_readw = generic_readw,
9842 + .mv_readl = generic_readl,
9843 + .mv_writeb = generic_writeb,
9844 + .mv_writew = generic_writew,
9845 + .mv_writel = generic_writel,
9847 - mv_irq_demux: hd64465_irq_demux,
9848 + .mv_irq_demux = hd64465_irq_demux,
9850 - mv_rtc_gettimeofday: sh_rtc_gettimeofday,
9851 - mv_rtc_settimeofday: sh_rtc_settimeofday,
9852 + .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
9853 + .mv_rtc_settimeofday = sh_rtc_settimeofday,
9857 diff -Nru a/arch/sh/boards/dreamcast/irq.c b/arch/sh/boards/dreamcast/irq.c
9858 --- a/arch/sh/boards/dreamcast/irq.c Sat Jun 14 11:02:09 2003
9859 +++ b/arch/sh/boards/dreamcast/irq.c Sun Aug 31 16:14:08 2003
9860 @@ -110,13 +110,13 @@
9863 struct hw_interrupt_type systemasic_int = {
9864 - typename: "System ASIC",
9865 - startup: startup_systemasic_irq,
9866 - shutdown: shutdown_systemasic_irq,
9867 - enable: enable_systemasic_irq,
9868 - disable: disable_systemasic_irq,
9869 - ack: ack_systemasic_irq,
9870 - end: end_systemasic_irq,
9871 + .typename = "System ASIC",
9872 + .startup = startup_systemasic_irq,
9873 + .shutdown = shutdown_systemasic_irq,
9874 + .enable = enable_systemasic_irq,
9875 + .disable = disable_systemasic_irq,
9876 + .ack = ack_systemasic_irq,
9877 + .end = end_systemasic_irq,
9881 diff -Nru a/arch/sh/boards/dreamcast/mach.c b/arch/sh/boards/dreamcast/mach.c
9882 --- a/arch/sh/boards/dreamcast/mach.c Mon May 19 16:04:36 2003
9883 +++ b/arch/sh/boards/dreamcast/mach.c Sun Aug 31 16:14:08 2003
9887 struct sh_machine_vector mv_dreamcast __initmv = {
9888 - mv_nr_irqs: NR_IRQS,
9889 + .mv_nr_irqs = NR_IRQS,
9891 - mv_inb: generic_inb,
9892 - mv_inw: generic_inw,
9893 - mv_inl: generic_inl,
9894 - mv_outb: generic_outb,
9895 - mv_outw: generic_outw,
9896 - mv_outl: generic_outl,
9898 - mv_inb_p: generic_inb_p,
9899 - mv_inw_p: generic_inw,
9900 - mv_inl_p: generic_inl,
9901 - mv_outb_p: generic_outb_p,
9902 - mv_outw_p: generic_outw,
9903 - mv_outl_p: generic_outl,
9905 - mv_insb: generic_insb,
9906 - mv_insw: generic_insw,
9907 - mv_insl: generic_insl,
9908 - mv_outsb: generic_outsb,
9909 - mv_outsw: generic_outsw,
9910 - mv_outsl: generic_outsl,
9912 - mv_readb: generic_readb,
9913 - mv_readw: generic_readw,
9914 - mv_readl: generic_readl,
9915 - mv_writeb: generic_writeb,
9916 - mv_writew: generic_writew,
9917 - mv_writel: generic_writel,
9918 + .mv_inb = generic_inb,
9919 + .mv_inw = generic_inw,
9920 + .mv_inl = generic_inl,
9921 + .mv_outb = generic_outb,
9922 + .mv_outw = generic_outw,
9923 + .mv_outl = generic_outl,
9925 + .mv_inb_p = generic_inb_p,
9926 + .mv_inw_p = generic_inw,
9927 + .mv_inl_p = generic_inl,
9928 + .mv_outb_p = generic_outb_p,
9929 + .mv_outw_p = generic_outw,
9930 + .mv_outl_p = generic_outl,
9932 + .mv_insb = generic_insb,
9933 + .mv_insw = generic_insw,
9934 + .mv_insl = generic_insl,
9935 + .mv_outsb = generic_outsb,
9936 + .mv_outsw = generic_outsw,
9937 + .mv_outsl = generic_outsl,
9939 + .mv_readb = generic_readb,
9940 + .mv_readw = generic_readw,
9941 + .mv_readl = generic_readl,
9942 + .mv_writeb = generic_writeb,
9943 + .mv_writew = generic_writew,
9944 + .mv_writel = generic_writel,
9946 - mv_ioremap: generic_ioremap,
9947 - mv_iounmap: generic_iounmap,
9948 + .mv_ioremap = generic_ioremap,
9949 + .mv_iounmap = generic_iounmap,
9951 - mv_isa_port2addr: dreamcast_isa_port2addr,
9952 - mv_irq_demux: systemasic_irq_demux,
9953 + .mv_isa_port2addr = dreamcast_isa_port2addr,
9954 + .mv_irq_demux = systemasic_irq_demux,
9957 diff -Nru a/arch/sh/boards/ec3104/irq.c b/arch/sh/boards/ec3104/irq.c
9958 --- a/arch/sh/boards/ec3104/irq.c Sat Jun 14 11:02:09 2003
9959 +++ b/arch/sh/boards/ec3104/irq.c Sun Aug 31 16:14:08 2003
9960 @@ -169,13 +169,13 @@
9963 static struct hw_interrupt_type ec3104_int = {
9964 - typename: "EC3104",
9965 - enable: enable_ec3104_irq,
9966 - disable: disable_ec3104_irq,
9967 - ack: mask_and_ack_ec3104_irq,
9968 - end: end_ec3104_irq,
9969 - startup: startup_ec3104_irq,
9970 - shutdown: shutdown_ec3104_irq,
9971 + .typename = "EC3104",
9972 + .enable = enable_ec3104_irq,
9973 + .disable = disable_ec3104_irq,
9974 + .ack = mask_and_ack_ec3104_irq,
9975 + .end = end_ec3104_irq,
9976 + .startup = startup_ec3104_irq,
9977 + .shutdown = shutdown_ec3104_irq,
9980 /* Yuck. the _demux API is ugly */
9981 diff -Nru a/arch/sh/boards/ec3104/mach.c b/arch/sh/boards/ec3104/mach.c
9982 --- a/arch/sh/boards/ec3104/mach.c Sat Jan 19 10:54:19 2002
9983 +++ b/arch/sh/boards/ec3104/mach.c Sun Aug 31 16:14:08 2003
9987 struct sh_machine_vector mv_ec3104 __initmv = {
9988 - mv_name: "EC3104",
9989 + .mv_name = "EC3104",
9994 - mv_inb: ec3104_inb,
9995 - mv_inw: ec3104_inw,
9996 - mv_inl: ec3104_inl,
9997 - mv_outb: ec3104_outb,
9998 - mv_outw: ec3104_outw,
9999 - mv_outl: ec3104_outl,
10001 - mv_inb_p: generic_inb_p,
10002 - mv_inw_p: generic_inw,
10003 - mv_inl_p: generic_inl,
10004 - mv_outb_p: generic_outb_p,
10005 - mv_outw_p: generic_outw,
10006 - mv_outl_p: generic_outl,
10008 - mv_insb: generic_insb,
10009 - mv_insw: generic_insw,
10010 - mv_insl: generic_insl,
10011 - mv_outsb: generic_outsb,
10012 - mv_outsw: generic_outsw,
10013 - mv_outsl: generic_outsl,
10015 - mv_readb: generic_readb,
10016 - mv_readw: generic_readw,
10017 - mv_readl: generic_readl,
10018 - mv_writeb: generic_writeb,
10019 - mv_writew: generic_writew,
10020 - mv_writel: generic_writel,
10021 + .mv_inb = ec3104_inb,
10022 + .mv_inw = ec3104_inw,
10023 + .mv_inl = ec3104_inl,
10024 + .mv_outb = ec3104_outb,
10025 + .mv_outw = ec3104_outw,
10026 + .mv_outl = ec3104_outl,
10028 + .mv_inb_p = generic_inb_p,
10029 + .mv_inw_p = generic_inw,
10030 + .mv_inl_p = generic_inl,
10031 + .mv_outb_p = generic_outb_p,
10032 + .mv_outw_p = generic_outw,
10033 + .mv_outl_p = generic_outl,
10035 + .mv_insb = generic_insb,
10036 + .mv_insw = generic_insw,
10037 + .mv_insl = generic_insl,
10038 + .mv_outsb = generic_outsb,
10039 + .mv_outsw = generic_outsw,
10040 + .mv_outsl = generic_outsl,
10042 + .mv_readb = generic_readb,
10043 + .mv_readw = generic_readw,
10044 + .mv_readl = generic_readl,
10045 + .mv_writeb = generic_writeb,
10046 + .mv_writew = generic_writew,
10047 + .mv_writel = generic_writel,
10049 - mv_irq_demux: ec3104_irq_demux,
10050 + .mv_irq_demux = ec3104_irq_demux,
10052 - mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10053 - mv_rtc_settimeofday: sh_rtc_settimeofday,
10054 + .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10055 + .mv_rtc_settimeofday = sh_rtc_settimeofday,
10059 diff -Nru a/arch/sh/boards/harp/mach.c b/arch/sh/boards/harp/mach.c
10060 --- a/arch/sh/boards/harp/mach.c Sat Mar 2 08:57:07 2002
10061 +++ b/arch/sh/boards/harp/mach.c Sun Aug 31 16:14:08 2003
10062 @@ -26,46 +26,46 @@
10065 struct sh_machine_vector mv_harp __initmv = {
10066 - mv_nr_irqs: 89 + HD64465_IRQ_NUM,
10067 + .mv_nr_irqs = 89 + HD64465_IRQ_NUM,
10069 - mv_inb: hd64465_inb,
10070 - mv_inw: hd64465_inw,
10071 - mv_inl: hd64465_inl,
10072 - mv_outb: hd64465_outb,
10073 - mv_outw: hd64465_outw,
10074 - mv_outl: hd64465_outl,
10076 - mv_inb_p: hd64465_inb_p,
10077 - mv_inw_p: hd64465_inw,
10078 - mv_inl_p: hd64465_inl,
10079 - mv_outb_p: hd64465_outb_p,
10080 - mv_outw_p: hd64465_outw,
10081 - mv_outl_p: hd64465_outl,
10083 - mv_insb: hd64465_insb,
10084 - mv_insw: hd64465_insw,
10085 - mv_insl: hd64465_insl,
10086 - mv_outsb: hd64465_outsb,
10087 - mv_outsw: hd64465_outsw,
10088 - mv_outsl: hd64465_outsl,
10090 - mv_readb: generic_readb,
10091 - mv_readw: generic_readw,
10092 - mv_readl: generic_readl,
10093 - mv_writeb: generic_writeb,
10094 - mv_writew: generic_writew,
10095 - mv_writel: generic_writel,
10096 + .mv_inb = hd64465_inb,
10097 + .mv_inw = hd64465_inw,
10098 + .mv_inl = hd64465_inl,
10099 + .mv_outb = hd64465_outb,
10100 + .mv_outw = hd64465_outw,
10101 + .mv_outl = hd64465_outl,
10103 + .mv_inb_p = hd64465_inb_p,
10104 + .mv_inw_p = hd64465_inw,
10105 + .mv_inl_p = hd64465_inl,
10106 + .mv_outb_p = hd64465_outb_p,
10107 + .mv_outw_p = hd64465_outw,
10108 + .mv_outl_p = hd64465_outl,
10110 + .mv_insb = hd64465_insb,
10111 + .mv_insw = hd64465_insw,
10112 + .mv_insl = hd64465_insl,
10113 + .mv_outsb = hd64465_outsb,
10114 + .mv_outsw = hd64465_outsw,
10115 + .mv_outsl = hd64465_outsl,
10117 + .mv_readb = generic_readb,
10118 + .mv_readw = generic_readw,
10119 + .mv_readl = generic_readl,
10120 + .mv_writeb = generic_writeb,
10121 + .mv_writew = generic_writew,
10122 + .mv_writel = generic_writel,
10124 - mv_ioremap: generic_ioremap,
10125 - mv_iounmap: generic_iounmap,
10126 + .mv_ioremap = generic_ioremap,
10127 + .mv_iounmap = generic_iounmap,
10129 - mv_isa_port2addr: hd64465_isa_port2addr,
10130 + .mv_isa_port2addr = hd64465_isa_port2addr,
10133 - mv_init_irq: init_harp_irq,
10134 + .mv_init_irq = init_harp_irq,
10136 #ifdef CONFIG_HEARTBEAT
10137 - mv_heartbeat: heartbeat_harp,
10138 + .mv_heartbeat = heartbeat_harp,
10142 diff -Nru a/arch/sh/boards/hp6xx/hp620/mach.c b/arch/sh/boards/hp6xx/hp620/mach.c
10143 --- a/arch/sh/boards/hp6xx/hp620/mach.c Mon May 19 16:04:36 2003
10144 +++ b/arch/sh/boards/hp6xx/hp620/mach.c Sun Aug 31 16:14:08 2003
10145 @@ -24,41 +24,41 @@
10148 struct sh_machine_vector mv_hp620 __initmv = {
10149 - mv_name: "hp620",
10150 + .mv_name = "hp620",
10152 - mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10153 + .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10155 - mv_inb: hd64461_inb,
10156 - mv_inw: hd64461_inw,
10157 - mv_inl: hd64461_inl,
10158 - mv_outb: hd64461_outb,
10159 - mv_outw: hd64461_outw,
10160 - mv_outl: hd64461_outl,
10162 - mv_inb_p: hd64461_inb_p,
10163 - mv_inw_p: hd64461_inw,
10164 - mv_inl_p: hd64461_inl,
10165 - mv_outb_p: hd64461_outb_p,
10166 - mv_outw_p: hd64461_outw,
10167 - mv_outl_p: hd64461_outl,
10169 - mv_insb: hd64461_insb,
10170 - mv_insw: hd64461_insw,
10171 - mv_insl: hd64461_insl,
10172 - mv_outsb: hd64461_outsb,
10173 - mv_outsw: hd64461_outsw,
10174 - mv_outsl: hd64461_outsl,
10176 - mv_readb: generic_readb,
10177 - mv_readw: generic_readw,
10178 - mv_readl: generic_readl,
10179 - mv_writeb: generic_writeb,
10180 - mv_writew: generic_writew,
10181 - mv_writel: generic_writel,
10182 + .mv_inb = hd64461_inb,
10183 + .mv_inw = hd64461_inw,
10184 + .mv_inl = hd64461_inl,
10185 + .mv_outb = hd64461_outb,
10186 + .mv_outw = hd64461_outw,
10187 + .mv_outl = hd64461_outl,
10189 + .mv_inb_p = hd64461_inb_p,
10190 + .mv_inw_p = hd64461_inw,
10191 + .mv_inl_p = hd64461_inl,
10192 + .mv_outb_p = hd64461_outb_p,
10193 + .mv_outw_p = hd64461_outw,
10194 + .mv_outl_p = hd64461_outl,
10196 + .mv_insb = hd64461_insb,
10197 + .mv_insw = hd64461_insw,
10198 + .mv_insl = hd64461_insl,
10199 + .mv_outsb = hd64461_outsb,
10200 + .mv_outsw = hd64461_outsw,
10201 + .mv_outsl = hd64461_outsl,
10203 + .mv_readb = generic_readb,
10204 + .mv_readw = generic_readw,
10205 + .mv_readl = generic_readl,
10206 + .mv_writeb = generic_writeb,
10207 + .mv_writew = generic_writew,
10208 + .mv_writel = generic_writel,
10210 - mv_irq_demux: hd64461_irq_demux,
10211 + .mv_irq_demux = hd64461_irq_demux,
10213 - mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10214 - mv_rtc_settimeofday: sh_rtc_settimeofday,
10215 + .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10216 + .mv_rtc_settimeofday = sh_rtc_settimeofday,
10219 diff -Nru a/arch/sh/boards/hp6xx/hp680/mach.c b/arch/sh/boards/hp6xx/hp680/mach.c
10220 --- a/arch/sh/boards/hp6xx/hp680/mach.c Mon May 19 16:04:37 2003
10221 +++ b/arch/sh/boards/hp6xx/hp680/mach.c Sun Aug 31 16:14:08 2003
10222 @@ -20,41 +20,41 @@
10223 #include <asm/irq.h>
10225 struct sh_machine_vector mv_hp680 __initmv = {
10226 - mv_name: "hp680",
10227 + .mv_name = "hp680",
10229 - mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10230 + .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10232 - mv_inb: hd64461_inb,
10233 - mv_inw: hd64461_inw,
10234 - mv_inl: hd64461_inl,
10235 - mv_outb: hd64461_outb,
10236 - mv_outw: hd64461_outw,
10237 - mv_outl: hd64461_outl,
10239 - mv_inb_p: hd64461_inb_p,
10240 - mv_inw_p: hd64461_inw,
10241 - mv_inl_p: hd64461_inl,
10242 - mv_outb_p: hd64461_outb_p,
10243 - mv_outw_p: hd64461_outw,
10244 - mv_outl_p: hd64461_outl,
10246 - mv_insb: hd64461_insb,
10247 - mv_insw: hd64461_insw,
10248 - mv_insl: hd64461_insl,
10249 - mv_outsb: hd64461_outsb,
10250 - mv_outsw: hd64461_outsw,
10251 - mv_outsl: hd64461_outsl,
10253 - mv_readb: generic_readb,
10254 - mv_readw: generic_readw,
10255 - mv_readl: generic_readl,
10256 - mv_writeb: generic_writeb,
10257 - mv_writew: generic_writew,
10258 - mv_writel: generic_writel,
10259 + .mv_inb = hd64461_inb,
10260 + .mv_inw = hd64461_inw,
10261 + .mv_inl = hd64461_inl,
10262 + .mv_outb = hd64461_outb,
10263 + .mv_outw = hd64461_outw,
10264 + .mv_outl = hd64461_outl,
10266 + .mv_inb_p = hd64461_inb_p,
10267 + .mv_inw_p = hd64461_inw,
10268 + .mv_inl_p = hd64461_inl,
10269 + .mv_outb_p = hd64461_outb_p,
10270 + .mv_outw_p = hd64461_outw,
10271 + .mv_outl_p = hd64461_outl,
10273 + .mv_insb = hd64461_insb,
10274 + .mv_insw = hd64461_insw,
10275 + .mv_insl = hd64461_insl,
10276 + .mv_outsb = hd64461_outsb,
10277 + .mv_outsw = hd64461_outsw,
10278 + .mv_outsl = hd64461_outsl,
10280 + .mv_readb = generic_readb,
10281 + .mv_readw = generic_readw,
10282 + .mv_readl = generic_readl,
10283 + .mv_writeb = generic_writeb,
10284 + .mv_writew = generic_writew,
10285 + .mv_writel = generic_writel,
10287 - mv_irq_demux: hd64461_irq_demux,
10288 + .mv_irq_demux = hd64461_irq_demux,
10290 - mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10291 - mv_rtc_settimeofday: sh_rtc_settimeofday,
10292 + .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10293 + .mv_rtc_settimeofday = sh_rtc_settimeofday,
10296 diff -Nru a/arch/sh/boards/hp6xx/hp690/mach.c b/arch/sh/boards/hp6xx/hp690/mach.c
10297 --- a/arch/sh/boards/hp6xx/hp690/mach.c Mon May 19 16:04:37 2003
10298 +++ b/arch/sh/boards/hp6xx/hp690/mach.c Sun Aug 31 16:14:08 2003
10299 @@ -20,41 +20,41 @@
10300 #include <asm/irq.h>
10302 struct sh_machine_vector mv_hp690 __initmv = {
10303 - mv_name: "hp690",
10304 + .mv_name = "hp690",
10306 - mv_nr_irqs: HD64461_IRQBASE+HD64461_IRQ_NUM,
10307 + .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
10309 - mv_inb: hd64461_inb,
10310 - mv_inw: hd64461_inw,
10311 - mv_inl: hd64461_inl,
10312 - mv_outb: hd64461_outb,
10313 - mv_outw: hd64461_outw,
10314 - mv_outl: hd64461_outl,
10316 - mv_inb_p: hd64461_inb_p,
10317 - mv_inw_p: hd64461_inw,
10318 - mv_inl_p: hd64461_inl,
10319 - mv_outb_p: hd64461_outb_p,
10320 - mv_outw_p: hd64461_outw,
10321 - mv_outl_p: hd64461_outl,
10323 - mv_insb: hd64461_insb,
10324 - mv_insw: hd64461_insw,
10325 - mv_insl: hd64461_insl,
10326 - mv_outsb: hd64461_outsb,
10327 - mv_outsw: hd64461_outsw,
10328 - mv_outsl: hd64461_outsl,
10330 - mv_readb: generic_readb,
10331 - mv_readw: generic_readw,
10332 - mv_readl: generic_readl,
10333 - mv_writeb: generic_writeb,
10334 - mv_writew: generic_writew,
10335 - mv_writel: generic_writel,
10336 + .mv_inb = hd64461_inb,
10337 + .mv_inw = hd64461_inw,
10338 + .mv_inl = hd64461_inl,
10339 + .mv_outb = hd64461_outb,
10340 + .mv_outw = hd64461_outw,
10341 + .mv_outl = hd64461_outl,
10343 + .mv_inb_p = hd64461_inb_p,
10344 + .mv_inw_p = hd64461_inw,
10345 + .mv_inl_p = hd64461_inl,
10346 + .mv_outb_p = hd64461_outb_p,
10347 + .mv_outw_p = hd64461_outw,
10348 + .mv_outl_p = hd64461_outl,
10350 + .mv_insb = hd64461_insb,
10351 + .mv_insw = hd64461_insw,
10352 + .mv_insl = hd64461_insl,
10353 + .mv_outsb = hd64461_outsb,
10354 + .mv_outsw = hd64461_outsw,
10355 + .mv_outsl = hd64461_outsl,
10357 + .mv_readb = generic_readb,
10358 + .mv_readw = generic_readw,
10359 + .mv_readl = generic_readl,
10360 + .mv_writeb = generic_writeb,
10361 + .mv_writew = generic_writew,
10362 + .mv_writel = generic_writel,
10364 - mv_irq_demux: hd64461_irq_demux,
10365 + .mv_irq_demux = hd64461_irq_demux,
10367 - mv_rtc_gettimeofday: sh_rtc_gettimeofday,
10368 - mv_rtc_settimeofday: sh_rtc_settimeofday,
10369 + .mv_rtc_gettimeofday = sh_rtc_gettimeofday,
10370 + .mv_rtc_settimeofday = sh_rtc_settimeofday,
10373 diff -Nru a/arch/sh/boards/overdrive/mach.c b/arch/sh/boards/overdrive/mach.c
10374 --- a/arch/sh/boards/overdrive/mach.c Sat Jun 14 11:02:09 2003
10375 +++ b/arch/sh/boards/overdrive/mach.c Sun Aug 31 16:14:08 2003
10376 @@ -28,46 +28,46 @@
10379 struct sh_machine_vector mv_od __initmv = {
10381 + .mv_nr_irqs = 48,
10386 - mv_outb: od_outb,
10387 - mv_outw: od_outw,
10388 - mv_outl: od_outl,
10390 - mv_inb_p: od_inb_p,
10391 - mv_inw_p: od_inw_p,
10392 - mv_inl_p: od_inl_p,
10393 - mv_outb_p: od_outb_p,
10394 - mv_outw_p: od_outw_p,
10395 - mv_outl_p: od_outl_p,
10397 - mv_insb: od_insb,
10398 - mv_insw: od_insw,
10399 - mv_insl: od_insl,
10400 - mv_outsb: od_outsb,
10401 - mv_outsw: od_outsw,
10402 - mv_outsl: od_outsl,
10404 - mv_readb: generic_readb,
10405 - mv_readw: generic_readw,
10406 - mv_readl: generic_readl,
10407 - mv_writeb: generic_writeb,
10408 - mv_writew: generic_writew,
10409 - mv_writel: generic_writel,
10410 + .mv_inb = od_inb,
10411 + .mv_inw = od_inw,
10412 + .mv_inl = od_inl,
10413 + .mv_outb = od_outb,
10414 + .mv_outw = od_outw,
10415 + .mv_outl = od_outl,
10417 + .mv_inb_p = od_inb_p,
10418 + .mv_inw_p = od_inw_p,
10419 + .mv_inl_p = od_inl_p,
10420 + .mv_outb_p = od_outb_p,
10421 + .mv_outw_p = od_outw_p,
10422 + .mv_outl_p = od_outl_p,
10424 + .mv_insb = od_insb,
10425 + .mv_insw = od_insw,
10426 + .mv_insl = od_insl,
10427 + .mv_outsb = od_outsb,
10428 + .mv_outsw = od_outsw,
10429 + .mv_outsl = od_outsl,
10431 + .mv_readb = generic_readb,
10432 + .mv_readw = generic_readw,
10433 + .mv_readl = generic_readl,
10434 + .mv_writeb = generic_writeb,
10435 + .mv_writew = generic_writew,
10436 + .mv_writel = generic_writel,
10438 - mv_ioremap: generic_ioremap,
10439 - mv_iounmap: generic_iounmap,
10440 + .mv_ioremap = generic_ioremap,
10441 + .mv_iounmap = generic_iounmap,
10443 - mv_isa_port2addr: generic_isa_port2addr,
10444 + .mv_isa_port2addr = generic_isa_port2addr,
10447 - mv_init_irq: init_overdrive_irq,
10448 + .mv_init_irq = init_overdrive_irq,
10450 #ifdef CONFIG_HEARTBEAT
10451 - mv_heartbeat: heartbeat_od,
10452 + .mv_heartbeat = heartbeat_od,
10456 diff -Nru a/arch/sh/boards/saturn/irq.c b/arch/sh/boards/saturn/irq.c
10457 --- a/arch/sh/boards/saturn/irq.c Sat Jun 14 11:02:09 2003
10458 +++ b/arch/sh/boards/saturn/irq.c Sun Aug 31 16:14:08 2003
10459 @@ -102,13 +102,13 @@
10462 static struct hw_interrupt_type saturn_int = {
10463 - typename: "Saturn",
10464 - enable: enable_saturn_irq,
10465 - disable: disable_saturn_irq,
10466 - ack: mask_and_ack_saturn_irq,
10467 - end: end_saturn_irq,
10468 - startup: startup_saturn_irq,
10469 - shutdown: shutdown_saturn_irq,
10470 + .typename = "Saturn",
10471 + .enable = enable_saturn_irq,
10472 + .disable = disable_saturn_irq,
10473 + .ack = mask_and_ack_saturn_irq,
10474 + .end = end_saturn_irq,
10475 + .startup = startup_saturn_irq,
10476 + .shutdown = shutdown_saturn_irq,
10479 int saturn_irq_demux(int irq_nr)
10480 diff -Nru a/arch/sh/boards/saturn/mach.c b/arch/sh/boards/saturn/mach.c
10481 --- a/arch/sh/boards/saturn/mach.c Mon May 19 16:04:39 2003
10482 +++ b/arch/sh/boards/saturn/mach.c Sun Aug 31 16:14:08 2003
10483 @@ -18,41 +18,41 @@
10484 * The Machine Vector
10486 struct sh_machine_vector mv_saturn __initmv = {
10487 - mv_nr_irqs: 80, /* Fix this later */
10488 + .mv_nr_irqs = 80, /* Fix this later */
10490 - mv_inb: generic_inb,
10491 - mv_inw: generic_inw,
10492 - mv_inl: generic_inl,
10493 - mv_outb: generic_outb,
10494 - mv_outw: generic_outw,
10495 - mv_outl: generic_outl,
10497 - mv_inb_p: generic_inb_p,
10498 - mv_inw_p: generic_inw_p,
10499 - mv_inl_p: generic_inl_p,
10500 - mv_outb_p: generic_outb_p,
10501 - mv_outw_p: generic_outw_p,
10502 - mv_outl_p: generic_outl_p,
10504 - mv_insb: generic_insb,
10505 - mv_insw: generic_insw,
10506 - mv_insl: generic_insl,
10507 - mv_outsb: generic_outsb,
10508 - mv_outsw: generic_outsw,
10509 - mv_outsl: generic_outsl,
10511 - mv_readb: generic_readb,
10512 - mv_readw: generic_readw,
10513 - mv_readl: generic_readl,
10514 - mv_writeb: generic_writeb,
10515 - mv_writew: generic_writew,
10516 - mv_writel: generic_writel,
10517 + .mv_inb = generic_inb,
10518 + .mv_inw = generic_inw,
10519 + .mv_inl = generic_inl,
10520 + .mv_outb = generic_outb,
10521 + .mv_outw = generic_outw,
10522 + .mv_outl = generic_outl,
10524 + .mv_inb_p = generic_inb_p,
10525 + .mv_inw_p = generic_inw_p,
10526 + .mv_inl_p = generic_inl_p,
10527 + .mv_outb_p = generic_outb_p,
10528 + .mv_outw_p = generic_outw_p,
10529 + .mv_outl_p = generic_outl_p,
10531 + .mv_insb = generic_insb,
10532 + .mv_insw = generic_insw,
10533 + .mv_insl = generic_insl,
10534 + .mv_outsb = generic_outsb,
10535 + .mv_outsw = generic_outsw,
10536 + .mv_outsl = generic_outsl,
10538 + .mv_readb = generic_readb,
10539 + .mv_readw = generic_readw,
10540 + .mv_readl = generic_readl,
10541 + .mv_writeb = generic_writeb,
10542 + .mv_writew = generic_writew,
10543 + .mv_writel = generic_writel,
10545 - mv_isa_port2addr: saturn_isa_port2addr,
10546 - mv_irq_demux: saturn_irq_demux,
10547 + .mv_isa_port2addr = saturn_isa_port2addr,
10548 + .mv_irq_demux = saturn_irq_demux,
10550 - mv_ioremap: saturn_ioremap,
10551 - mv_iounmap: saturn_iounmap,
10552 + .mv_ioremap = saturn_ioremap,
10553 + .mv_iounmap = saturn_iounmap,
10557 diff -Nru a/arch/sh/boards/se/770x/mach.c b/arch/sh/boards/se/770x/mach.c
10558 --- a/arch/sh/boards/se/770x/mach.c Mon May 19 16:04:39 2003
10559 +++ b/arch/sh/boards/se/770x/mach.c Sun Aug 31 16:14:08 2003
10560 @@ -28,49 +28,49 @@
10562 struct sh_machine_vector mv_se __initmv = {
10563 #if defined(CONFIG_CPU_SH4)
10565 + .mv_nr_irqs = 48,
10566 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
10568 + .mv_nr_irqs = 32,
10569 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
10571 + .mv_nr_irqs = 61,
10577 - mv_outb: se_outb,
10578 - mv_outw: se_outw,
10579 - mv_outl: se_outl,
10581 - mv_inb_p: se_inb_p,
10582 - mv_inw_p: se_inw,
10583 - mv_inl_p: se_inl,
10584 - mv_outb_p: se_outb_p,
10585 - mv_outw_p: se_outw,
10586 - mv_outl_p: se_outl,
10588 - mv_insb: se_insb,
10589 - mv_insw: se_insw,
10590 - mv_insl: se_insl,
10591 - mv_outsb: se_outsb,
10592 - mv_outsw: se_outsw,
10593 - mv_outsl: se_outsl,
10595 - mv_readb: se_readb,
10596 - mv_readw: se_readw,
10597 - mv_readl: se_readl,
10598 - mv_writeb: se_writeb,
10599 - mv_writew: se_writew,
10600 - mv_writel: se_writel,
10601 + .mv_inb = se_inb,
10602 + .mv_inw = se_inw,
10603 + .mv_inl = se_inl,
10604 + .mv_outb = se_outb,
10605 + .mv_outw = se_outw,
10606 + .mv_outl = se_outl,
10608 + .mv_inb_p = se_inb_p,
10609 + .mv_inw_p = se_inw,
10610 + .mv_inl_p = se_inl,
10611 + .mv_outb_p = se_outb_p,
10612 + .mv_outw_p = se_outw,
10613 + .mv_outl_p = se_outl,
10615 + .mv_insb = se_insb,
10616 + .mv_insw = se_insw,
10617 + .mv_insl = se_insl,
10618 + .mv_outsb = se_outsb,
10619 + .mv_outsw = se_outsw,
10620 + .mv_outsl = se_outsl,
10622 + .mv_readb = se_readb,
10623 + .mv_readw = se_readw,
10624 + .mv_readl = se_readl,
10625 + .mv_writeb = se_writeb,
10626 + .mv_writew = se_writew,
10627 + .mv_writel = se_writel,
10629 - mv_ioremap: generic_ioremap,
10630 - mv_iounmap: generic_iounmap,
10631 + .mv_ioremap = generic_ioremap,
10632 + .mv_iounmap = generic_iounmap,
10634 - mv_isa_port2addr: se_isa_port2addr,
10635 + .mv_isa_port2addr = se_isa_port2addr,
10637 - mv_init_irq: init_se_IRQ,
10638 + .mv_init_irq = init_se_IRQ,
10639 #ifdef CONFIG_HEARTBEAT
10640 - mv_heartbeat: heartbeat_se,
10641 + .mv_heartbeat = heartbeat_se,
10645 diff -Nru a/arch/sh/boards/se/7751/mach.c b/arch/sh/boards/se/7751/mach.c
10646 --- a/arch/sh/boards/se/7751/mach.c Mon May 19 16:04:39 2003
10647 +++ b/arch/sh/boards/se/7751/mach.c Sun Aug 31 16:14:08 2003
10648 @@ -26,44 +26,44 @@
10651 struct sh_machine_vector mv_7751se __initmv = {
10653 + .mv_nr_irqs = 72,
10655 - mv_inb: sh7751se_inb,
10656 - mv_inw: sh7751se_inw,
10657 - mv_inl: sh7751se_inl,
10658 - mv_outb: sh7751se_outb,
10659 - mv_outw: sh7751se_outw,
10660 - mv_outl: sh7751se_outl,
10662 - mv_inb_p: sh7751se_inb_p,
10663 - mv_inw_p: sh7751se_inw,
10664 - mv_inl_p: sh7751se_inl,
10665 - mv_outb_p: sh7751se_outb_p,
10666 - mv_outw_p: sh7751se_outw,
10667 - mv_outl_p: sh7751se_outl,
10669 - mv_insb: sh7751se_insb,
10670 - mv_insw: sh7751se_insw,
10671 - mv_insl: sh7751se_insl,
10672 - mv_outsb: sh7751se_outsb,
10673 - mv_outsw: sh7751se_outsw,
10674 - mv_outsl: sh7751se_outsl,
10676 - mv_readb: sh7751se_readb,
10677 - mv_readw: sh7751se_readw,
10678 - mv_readl: sh7751se_readl,
10679 - mv_writeb: sh7751se_writeb,
10680 - mv_writew: sh7751se_writew,
10681 - mv_writel: sh7751se_writel,
10682 + .mv_inb = sh7751se_inb,
10683 + .mv_inw = sh7751se_inw,
10684 + .mv_inl = sh7751se_inl,
10685 + .mv_outb = sh7751se_outb,
10686 + .mv_outw = sh7751se_outw,
10687 + .mv_outl = sh7751se_outl,
10689 + .mv_inb_p = sh7751se_inb_p,
10690 + .mv_inw_p = sh7751se_inw,
10691 + .mv_inl_p = sh7751se_inl,
10692 + .mv_outb_p = sh7751se_outb_p,
10693 + .mv_outw_p = sh7751se_outw,
10694 + .mv_outl_p = sh7751se_outl,
10696 + .mv_insb = sh7751se_insb,
10697 + .mv_insw = sh7751se_insw,
10698 + .mv_insl = sh7751se_insl,
10699 + .mv_outsb = sh7751se_outsb,
10700 + .mv_outsw = sh7751se_outsw,
10701 + .mv_outsl = sh7751se_outsl,
10703 + .mv_readb = sh7751se_readb,
10704 + .mv_readw = sh7751se_readw,
10705 + .mv_readl = sh7751se_readl,
10706 + .mv_writeb = sh7751se_writeb,
10707 + .mv_writew = sh7751se_writew,
10708 + .mv_writel = sh7751se_writel,
10710 - mv_ioremap: generic_ioremap,
10711 - mv_iounmap: generic_iounmap,
10712 + .mv_ioremap = generic_ioremap,
10713 + .mv_iounmap = generic_iounmap,
10715 - mv_isa_port2addr: sh7751se_isa_port2addr,
10716 + .mv_isa_port2addr = sh7751se_isa_port2addr,
10718 - mv_init_irq: init_7751se_IRQ,
10719 + .mv_init_irq = init_7751se_IRQ,
10720 #ifdef CONFIG_HEARTBEAT
10721 - mv_heartbeat: heartbeat_7751se,
10722 + .mv_heartbeat = heartbeat_7751se,
10726 diff -Nru a/arch/sh/boards/sh2000/mach.c b/arch/sh/boards/sh2000/mach.c
10727 --- a/arch/sh/boards/sh2000/mach.c Mon May 19 16:04:40 2003
10728 +++ b/arch/sh/boards/sh2000/mach.c Sun Aug 31 16:14:08 2003
10729 @@ -19,39 +19,39 @@
10732 struct sh_machine_vector mv_sh2000 __initmv = {
10734 + .mv_nr_irqs = 80,
10736 - mv_inb: generic_inb,
10737 - mv_inw: generic_inw,
10738 - mv_inl: generic_inl,
10739 - mv_outb: generic_outb,
10740 - mv_outw: generic_outw,
10741 - mv_outl: generic_outl,
10743 - mv_inb_p: generic_inb_p,
10744 - mv_inw_p: generic_inw_p,
10745 - mv_inl_p: generic_inl_p,
10746 - mv_outb_p: generic_outb_p,
10747 - mv_outw_p: generic_outw_p,
10748 - mv_outl_p: generic_outl_p,
10750 - mv_insb: generic_insb,
10751 - mv_insw: generic_insw,
10752 - mv_insl: generic_insl,
10753 - mv_outsb: generic_outsb,
10754 - mv_outsw: generic_outsw,
10755 - mv_outsl: generic_outsl,
10757 - mv_readb: generic_readb,
10758 - mv_readw: generic_readw,
10759 - mv_readl: generic_readl,
10760 - mv_writeb: generic_writeb,
10761 - mv_writew: generic_writew,
10762 - mv_writel: generic_writel,
10763 + .mv_inb = generic_inb,
10764 + .mv_inw = generic_inw,
10765 + .mv_inl = generic_inl,
10766 + .mv_outb = generic_outb,
10767 + .mv_outw = generic_outw,
10768 + .mv_outl = generic_outl,
10770 + .mv_inb_p = generic_inb_p,
10771 + .mv_inw_p = generic_inw_p,
10772 + .mv_inl_p = generic_inl_p,
10773 + .mv_outb_p = generic_outb_p,
10774 + .mv_outw_p = generic_outw_p,
10775 + .mv_outl_p = generic_outl_p,
10777 + .mv_insb = generic_insb,
10778 + .mv_insw = generic_insw,
10779 + .mv_insl = generic_insl,
10780 + .mv_outsb = generic_outsb,
10781 + .mv_outsw = generic_outsw,
10782 + .mv_outsl = generic_outsl,
10784 + .mv_readb = generic_readb,
10785 + .mv_readw = generic_readw,
10786 + .mv_readl = generic_readl,
10787 + .mv_writeb = generic_writeb,
10788 + .mv_writew = generic_writew,
10789 + .mv_writel = generic_writel,
10791 - mv_isa_port2addr: sh2000_isa_port2addr,
10792 + .mv_isa_port2addr = sh2000_isa_port2addr,
10794 - mv_ioremap: generic_ioremap,
10795 - mv_iounmap: generic_iounmap,
10796 + .mv_ioremap = generic_ioremap,
10797 + .mv_iounmap = generic_iounmap,
10800 diff -Nru a/arch/sh/boards/unknown/mach.c b/arch/sh/boards/unknown/mach.c
10801 --- a/arch/sh/boards/unknown/mach.c Fri Jan 10 04:26:40 2003
10802 +++ b/arch/sh/boards/unknown/mach.c Sun Aug 31 16:14:08 2003
10803 @@ -24,44 +24,44 @@
10805 struct sh_machine_vector mv_unknown __initmv = {
10806 #if defined(CONFIG_CPU_SH4)
10808 + .mv_nr_irqs = 48,
10809 #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
10811 + .mv_nr_irqs = 32,
10812 #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
10814 + .mv_nr_irqs = 61,
10817 - mv_inb: unknown_inb,
10818 - mv_inw: unknown_inw,
10819 - mv_inl: unknown_inl,
10820 - mv_outb: unknown_outb,
10821 - mv_outw: unknown_outw,
10822 - mv_outl: unknown_outl,
10824 - mv_inb_p: unknown_inb_p,
10825 - mv_inw_p: unknown_inw_p,
10826 - mv_inl_p: unknown_inl_p,
10827 - mv_outb_p: unknown_outb_p,
10828 - mv_outw_p: unknown_outw_p,
10829 - mv_outl_p: unknown_outl_p,
10831 - mv_insb: unknown_insb,
10832 - mv_insw: unknown_insw,
10833 - mv_insl: unknown_insl,
10834 - mv_outsb: unknown_outsb,
10835 - mv_outsw: unknown_outsw,
10836 - mv_outsl: unknown_outsl,
10838 - mv_readb: unknown_readb,
10839 - mv_readw: unknown_readw,
10840 - mv_readl: unknown_readl,
10841 - mv_writeb: unknown_writeb,
10842 - mv_writew: unknown_writew,
10843 - mv_writel: unknown_writel,
10844 + .mv_inb = unknown_inb,
10845 + .mv_inw = unknown_inw,
10846 + .mv_inl = unknown_inl,
10847 + .mv_outb = unknown_outb,
10848 + .mv_outw = unknown_outw,
10849 + .mv_outl = unknown_outl,
10851 + .mv_inb_p = unknown_inb_p,
10852 + .mv_inw_p = unknown_inw_p,
10853 + .mv_inl_p = unknown_inl_p,
10854 + .mv_outb_p = unknown_outb_p,
10855 + .mv_outw_p = unknown_outw_p,
10856 + .mv_outl_p = unknown_outl_p,
10858 + .mv_insb = unknown_insb,
10859 + .mv_insw = unknown_insw,
10860 + .mv_insl = unknown_insl,
10861 + .mv_outsb = unknown_outsb,
10862 + .mv_outsw = unknown_outsw,
10863 + .mv_outsl = unknown_outsl,
10865 + .mv_readb = unknown_readb,
10866 + .mv_readw = unknown_readw,
10867 + .mv_readl = unknown_readl,
10868 + .mv_writeb = unknown_writeb,
10869 + .mv_writew = unknown_writew,
10870 + .mv_writel = unknown_writel,
10872 - mv_ioremap: unknown_ioremap,
10873 - mv_iounmap: unknown_iounmap,
10874 + .mv_ioremap = unknown_ioremap,
10875 + .mv_iounmap = unknown_iounmap,
10877 - mv_isa_port2addr: unknown_isa_port2addr,
10878 + .mv_isa_port2addr = unknown_isa_port2addr,
10881 diff -Nru a/arch/sh/cchips/hd6446x/hd64465/setup.c b/arch/sh/cchips/hd6446x/hd64465/setup.c
10882 --- a/arch/sh/cchips/hd6446x/hd64465/setup.c Mon Nov 4 07:33:57 2002
10883 +++ b/arch/sh/cchips/hd6446x/hd64465/setup.c Sun Aug 31 16:14:08 2003
10884 @@ -89,13 +89,13 @@
10887 static struct hw_interrupt_type hd64465_irq_type = {
10888 - typename: "HD64465-IRQ",
10889 - startup: startup_hd64465_irq,
10890 - shutdown: shutdown_hd64465_irq,
10891 - enable: enable_hd64465_irq,
10892 - disable: disable_hd64465_irq,
10893 - ack: mask_and_ack_hd64465,
10894 - end: end_hd64465_irq
10895 + .typename = "HD64465-IRQ",
10896 + .startup = startup_hd64465_irq,
10897 + .shutdown = shutdown_hd64465_irq,
10898 + .enable = enable_hd64465_irq,
10899 + .disable = disable_hd64465_irq,
10900 + .ack = mask_and_ack_hd64465,
10901 + .end = end_hd64465_irq
10905 diff -Nru a/arch/sparc/Kconfig b/arch/sparc/Kconfig
10906 --- a/arch/sparc/Kconfig Sat Aug 2 14:26:16 2003
10907 +++ b/arch/sparc/Kconfig Sun Aug 31 16:14:22 2003
10908 @@ -254,29 +254,6 @@
10909 <file:Documentation/modules.txt>.
10910 The module will be called openpromfs. If unsure, say M.
10914 - depends on PROC_FS
10917 - If you enabled support for /proc file system then the file
10918 - /proc/kcore will contain the kernel core image. This can be used
10921 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
10923 - You have two choices here: ELF and A.OUT. Selecting ELF will make
10924 - /proc/kcore appear in ELF core format as defined by the Executable
10925 - and Linking Format specification. Selecting A.OUT will choose the
10926 - old "a.out" format which may be necessary for some old versions
10927 - of binutils or on some architectures.
10929 - This is especially useful if you have compiled the kernel with the
10930 - "-g" option to preserve debugging information. It is mainly used
10931 - for examining kernel data structures on the live kernel so if you
10932 - don't understand what this means or are not a kernel hacker, just
10933 - leave it at its default value ELF.
10935 source "fs/Kconfig.binfmt"
10938 diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
10939 --- a/arch/sparc/boot/Makefile Sat Jul 12 22:05:29 2003
10940 +++ b/arch/sparc/boot/Makefile Thu Aug 28 00:18:36 2003
10943 BTOBJS := $(HEAD_Y) $(INIT_Y)
10944 BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
10945 -LDFLAGS_image := -T arch/sparc/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group
10946 +LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group
10949 $(obj)/image: $(obj)/btfix.o FORCE
10950 diff -Nru a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
10951 --- a/arch/sparc/kernel/entry.S Sat Aug 16 14:13:18 2003
10952 +++ b/arch/sparc/kernel/entry.S Wed Aug 27 23:52:25 2003
10957 -#define NR_SYSCALLS 266 /* Each OS is different... */
10958 +#define NR_SYSCALLS 267 /* Each OS is different... */
10960 /* These are just handy. */
10961 #define _SV save %sp, -STACKFRAME_SZ, %sp
10962 diff -Nru a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
10963 --- a/arch/sparc/kernel/ioport.c Sun May 25 17:00:00 2003
10964 +++ b/arch/sparc/kernel/ioport.c Thu Aug 28 01:15:54 2003
10965 @@ -511,6 +511,26 @@
10970 + * Same as pci_map_single, but with pages.
10972 +dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page,
10973 + unsigned long offset, size_t size, int direction)
10975 + if (direction == PCI_DMA_NONE)
10977 + /* IIep is write-through, not flushing. */
10978 + return page_to_phys(page) + offset;
10981 +void pci_unmap_page(struct pci_dev *hwdev,
10982 + dma_addr_t dma_address, size_t size, int direction)
10984 + if (direction == PCI_DMA_NONE)
10986 + /* mmu_inval_dma_area XXX */
10989 /* Map a set of buffers described by scatterlist in streaming
10990 * mode for DMA. This is the scather-gather version of the
10991 * above pci_map_single interface. Here the scatter gather list
10992 diff -Nru a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
10993 --- a/arch/sparc/kernel/sys_sunos.c Sun May 25 17:00:00 2003
10994 +++ b/arch/sparc/kernel/sys_sunos.c Tue Aug 26 09:25:41 2003
10996 * SunOS is so stupid some times... hmph!
10999 - if(major(file->f_dentry->d_inode->i_rdev) == MEM_MAJOR &&
11000 - minor(file->f_dentry->d_inode->i_rdev) == 5) {
11001 + if(imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
11002 + iminor(file->f_dentry->d_inode) == 5) {
11003 flags |= MAP_ANONYMOUS;
11006 diff -Nru a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
11007 --- a/arch/sparc/kernel/systbls.S Sat Aug 16 14:13:18 2003
11008 +++ b/arch/sparc/kernel/systbls.S Thu Aug 28 01:35:18 2003
11010 /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
11011 /*255*/ .long sys_nis_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
11012 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
11013 -/*261*/ .long sys_timer_delete, sys_nis_syscall
11014 +/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall
11016 #ifdef CONFIG_SUNOS_EMUL
11017 /* Now the SunOS syscall table. */
11018 @@ -171,6 +171,6 @@
11020 /*260*/ .long sunos_nosys, sunos_nosys, sunos_nosys
11021 .long sunos_nosys, sunos_nosys, sunos_nosys
11022 - .long sunos_nosys
11023 + .long sunos_nosys, sunos_nosys
11026 diff -Nru a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
11027 --- a/arch/sparc64/Kconfig Sat Aug 2 14:26:53 2003
11028 +++ b/arch/sparc64/Kconfig Sun Aug 31 16:14:22 2003
11029 @@ -363,29 +363,6 @@
11030 <file:Documentation/modules.txt>.
11031 The module will be called openpromfs. If unsure, say M.
11035 - depends on PROC_FS
11038 - If you enabled support for /proc file system then the file
11039 - /proc/kcore will contain the kernel core image. This can be used
11042 - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
11044 - You have two choices here: ELF and A.OUT. Selecting ELF will make
11045 - /proc/kcore appear in ELF core format as defined by the Executable
11046 - and Linking Format specification. Selecting A.OUT will choose the
11047 - old "a.out" format which may be necessary for some old versions
11048 - of binutils or on some architectures.
11050 - This is especially useful if you have compiled the kernel with the
11051 - "-g" option to preserve debugging information. It is mainly used
11052 - for examining kernel data structures on the live kernel so if you
11053 - don't understand what this means or are not a kernel hacker, just
11054 - leave it at its default value ELF.
11056 config SPARC32_COMPAT
11057 bool "Kernel support for Linux/Sparc 32bit binary compatibility"
11059 diff -Nru a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
11060 --- a/arch/sparc64/kernel/entry.S Sat Aug 16 14:13:18 2003
11061 +++ b/arch/sparc64/kernel/entry.S Wed Aug 27 23:52:25 2003
11066 -#define NR_SYSCALLS 266 /* Each OS is different... */
11067 +#define NR_SYSCALLS 267 /* Each OS is different... */
11071 diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
11072 --- a/arch/sparc64/kernel/ioctl32.c Fri Aug 8 14:53:47 2003
11073 +++ b/arch/sparc64/kernel/ioctl32.c Sun Aug 31 16:14:44 2003
11074 @@ -1388,7 +1388,7 @@
11075 #define IOCTL_TABLE_START \
11076 struct ioctl_trans ioctl_start[] = {
11077 #define IOCTL_TABLE_END \
11078 - }; struct ioctl_trans ioctl_end[0];
11082 #include <linux/compat_ioctl.h>
11083 @@ -1583,3 +1583,5 @@
11084 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
11085 /* take care of sizeof(sizeof()) breakage */
11088 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
11089 diff -Nru a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
11090 --- a/arch/sparc64/kernel/irq.c Tue Aug 19 19:00:31 2003
11091 +++ b/arch/sparc64/kernel/irq.c Thu Aug 28 17:10:27 2003
11092 @@ -1097,6 +1097,18 @@
11094 memset(__irq_work + smp_processor_id(), 0, sizeof(*workp));
11096 + /* Make sure we are called with PSTATE_IE disabled. */
11097 + __asm__ __volatile__("rdpr %%pstate, %0\n\t"
11099 + if (tmp & PSTATE_IE) {
11100 + prom_printf("BUG: init_irqwork_curcpu() called with "
11101 + "PSTATE_IE enabled, bailing.\n");
11102 + __asm__ __volatile__("mov %%i7, %0\n\t"
11104 + prom_printf("BUG: Called from %lx\n", tmp);
11108 /* Set interrupt globals. */
11109 workp = &__irq_work[smp_processor_id()];
11110 __asm__ __volatile__(
11111 @@ -1105,7 +1117,7 @@
11113 "wrpr %0, 0x0, %%pstate\n\t"
11115 - : "i" (PSTATE_IG | PSTATE_IE), "r" (workp));
11116 + : "i" (PSTATE_IG), "r" (workp));
11119 /* Only invoked on boot processor. */
11120 diff -Nru a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
11121 --- a/arch/sparc64/kernel/pci_psycho.c Fri Jul 25 08:40:56 2003
11122 +++ b/arch/sparc64/kernel/pci_psycho.c Sun Aug 24 03:18:58 2003
11123 @@ -874,6 +874,46 @@
11124 #define PSYCHO_PCI_AFAR_A 0x2018UL
11125 #define PSYCHO_PCI_AFAR_B 0x4018UL
11127 +static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm_a)
11129 + unsigned long csr_reg, csr, csr_error_bits;
11130 + irqreturn_t ret = IRQ_NONE;
11134 + csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL;
11136 + csr_reg = pbm->controller_regs + PSYCHO_PCIB_CTRL;
11138 + csr = psycho_read(csr_reg);
11140 + csr & (PSYCHO_PCICTRL_SBH_ERR | PSYCHO_PCICTRL_SERR);
11141 + if (csr_error_bits) {
11142 + /* Clear the errors. */
11143 + psycho_write(csr_reg, csr);
11146 + if (csr_error_bits & PSYCHO_PCICTRL_SBH_ERR)
11147 + printk("%s: PCI streaming byte hole error asserted.\n",
11149 + if (csr_error_bits & PSYCHO_PCICTRL_SERR)
11150 + printk("%s: PCI SERR signal asserted.\n", pbm->name);
11151 + ret = IRQ_HANDLED;
11153 + pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat);
11154 + if (stat & (PCI_STATUS_PARITY |
11155 + PCI_STATUS_SIG_TARGET_ABORT |
11156 + PCI_STATUS_REC_TARGET_ABORT |
11157 + PCI_STATUS_REC_MASTER_ABORT |
11158 + PCI_STATUS_SIG_SYSTEM_ERROR)) {
11159 + printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
11160 + pbm->name, stat);
11161 + pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff);
11162 + ret = IRQ_HANDLED;
11167 static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs)
11169 struct pci_pbm_info *pbm = dev_id;
11170 @@ -902,7 +942,7 @@
11171 PSYCHO_PCIAFSR_SMA | PSYCHO_PCIAFSR_STA |
11172 PSYCHO_PCIAFSR_SRTRY | PSYCHO_PCIAFSR_SPERR);
11175 + return psycho_pcierr_intr_other(pbm, is_pbm_a);
11176 psycho_write(afsr_reg, error_bits);
11178 /* Log the error. */
11179 @@ -1008,6 +1048,7 @@
11184 irq = psycho_irq_build(pbm, NULL, (portid << 6) | PSYCHO_PCIERR_A_INO);
11185 if (request_irq(irq, psycho_pcierr_intr,
11186 SA_SHIRQ, "PSYCHO PCIERR", &p->pbm_A) < 0) {
11187 @@ -1016,6 +1057,7 @@
11192 irq = psycho_irq_build(pbm, NULL, (portid << 6) | PSYCHO_PCIERR_B_INO);
11193 if (request_irq(irq, psycho_pcierr_intr,
11194 SA_SHIRQ, "PSYCHO PCIERR", &p->pbm_B) < 0) {
11195 diff -Nru a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
11196 --- a/arch/sparc64/kernel/pci_sabre.c Tue Aug 19 16:00:48 2003
11197 +++ b/arch/sparc64/kernel/pci_sabre.c Sun Aug 24 03:18:58 2003
11198 @@ -221,6 +221,7 @@
11199 ((unsigned long)(REG)))
11201 static int hummingbird_p;
11202 +static struct pci_bus *sabre_root_bus;
11204 static void *sabre_pci_config_mkaddr(struct pci_pbm_info *pbm,
11206 @@ -860,6 +861,42 @@
11207 return IRQ_HANDLED;
11210 +static irqreturn_t sabre_pcierr_intr_other(struct pci_controller_info *p)
11212 + unsigned long csr_reg, csr, csr_error_bits;
11213 + irqreturn_t ret = IRQ_NONE;
11216 + csr_reg = p->pbm_A.controller_regs + SABRE_PCICTRL;
11217 + csr = sabre_read(csr_reg);
11219 + csr & SABRE_PCICTRL_SERR;
11220 + if (csr_error_bits) {
11221 + /* Clear the errors. */
11222 + sabre_write(csr_reg, csr);
11225 + if (csr_error_bits & SABRE_PCICTRL_SERR)
11226 + printk("SABRE%d: PCI SERR signal asserted.\n",
11228 + ret = IRQ_HANDLED;
11230 + pci_read_config_word(sabre_root_bus->self,
11231 + PCI_STATUS, &stat);
11232 + if (stat & (PCI_STATUS_PARITY |
11233 + PCI_STATUS_SIG_TARGET_ABORT |
11234 + PCI_STATUS_REC_TARGET_ABORT |
11235 + PCI_STATUS_REC_MASTER_ABORT |
11236 + PCI_STATUS_SIG_SYSTEM_ERROR)) {
11237 + printk("SABRE%d: PCI bus error, PCI_STATUS[%04x]\n",
11239 + pci_write_config_word(sabre_root_bus->self,
11240 + PCI_STATUS, 0xffff);
11241 + ret = IRQ_HANDLED;
11246 static irqreturn_t sabre_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs)
11248 struct pci_controller_info *p = dev_id;
11249 @@ -881,7 +918,7 @@
11250 SABRE_PIOAFSR_SMA | SABRE_PIOAFSR_STA |
11251 SABRE_PIOAFSR_SRTRY | SABRE_PIOAFSR_SPERR);
11254 + return sabre_pcierr_intr_other(p);
11255 sabre_write(afsr_reg, error_bits);
11257 /* Log the error. */
11258 @@ -1167,6 +1204,8 @@
11260 pci_fixup_host_bridge_self(sabre_bus);
11261 sabre_bus->self->sysdata = cookie;
11263 + sabre_root_bus = sabre_bus;
11265 apb_init(p, sabre_bus);
11267 diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
11268 --- a/arch/sparc64/kernel/pci_schizo.c Sat Aug 2 18:21:52 2003
11269 +++ b/arch/sparc64/kernel/pci_schizo.c Sun Aug 24 03:18:58 2003
11270 @@ -845,6 +845,88 @@
11271 #define SCHIZO_PCIAFSR_MEM 0x0000000020000000UL /* Schizo/Tomatillo */
11272 #define SCHIZO_PCIAFSR_IO 0x0000000010000000UL /* Schizo/Tomatillo */
11274 +#define SCHIZO_PCI_CTRL (0x2000UL)
11275 +#define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */
11276 +#define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */
11277 +#define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */
11278 +#define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */
11279 +#define SCHIZO_PCICTRL_TTO_ERR (1UL << 38UL) /* Safari/Tomatillo */
11280 +#define SCHIZO_PCICTRL_RTRY_ERR (1UL << 37UL) /* Safari/Tomatillo */
11281 +#define SCHIZO_PCICTRL_DTO_ERR (1UL << 36UL) /* Safari/Tomatillo */
11282 +#define SCHIZO_PCICTRL_SBH_ERR (1UL << 35UL) /* Safari */
11283 +#define SCHIZO_PCICTRL_SERR (1UL << 34UL) /* Safari/Tomatillo */
11284 +#define SCHIZO_PCICTRL_PCISPD (1UL << 33UL) /* Safari */
11285 +#define SCHIZO_PCICTRL_MRM_PREF (1UL << 28UL) /* Tomatillo */
11286 +#define SCHIZO_PCICTRL_RDO_PREF (1UL << 27UL) /* Tomatillo */
11287 +#define SCHIZO_PCICTRL_RDL_PREF (1UL << 26UL) /* Tomatillo */
11288 +#define SCHIZO_PCICTRL_PTO (3UL << 24UL) /* Safari/Tomatillo */
11289 +#define SCHIZO_PCICTRL_PTO_SHIFT 24UL
11290 +#define SCHIZO_PCICTRL_TRWSW (7UL << 21UL) /* Tomatillo */
11291 +#define SCHIZO_PCICTRL_F_TGT_A (1UL << 20UL) /* Tomatillo */
11292 +#define SCHIZO_PCICTRL_S_DTO_INT (1UL << 19UL) /* Safari */
11293 +#define SCHIZO_PCICTRL_F_TGT_RT (1UL << 19UL) /* Tomatillo */
11294 +#define SCHIZO_PCICTRL_SBH_INT (1UL << 18UL) /* Safari */
11295 +#define SCHIZO_PCICTRL_T_DTO_INT (1UL << 18UL) /* Tomatillo */
11296 +#define SCHIZO_PCICTRL_EEN (1UL << 17UL) /* Safari/Tomatillo */
11297 +#define SCHIZO_PCICTRL_PARK (1UL << 16UL) /* Safari/Tomatillo */
11298 +#define SCHIZO_PCICTRL_PCIRST (1UL << 8UL) /* Safari */
11299 +#define SCHIZO_PCICTRL_ARB_S (0x3fUL << 0UL) /* Safari */
11300 +#define SCHIZO_PCICTRL_ARB_T (0xffUL << 0UL) /* Tomatillo */
11302 +static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm)
11304 + unsigned long csr_reg, csr, csr_error_bits;
11305 + irqreturn_t ret = IRQ_NONE;
11308 + csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL;
11309 + csr = schizo_read(csr_reg);
11311 + csr & (SCHIZO_PCICTRL_BUS_UNUS |
11312 + SCHIZO_PCICTRL_TTO_ERR |
11313 + SCHIZO_PCICTRL_RTRY_ERR |
11314 + SCHIZO_PCICTRL_DTO_ERR |
11315 + SCHIZO_PCICTRL_SBH_ERR |
11316 + SCHIZO_PCICTRL_SERR);
11317 + if (csr_error_bits) {
11318 + /* Clear the errors. */
11319 + schizo_write(csr_reg, csr);
11322 + if (csr_error_bits & SCHIZO_PCICTRL_BUS_UNUS)
11323 + printk("%s: Bus unusable error asserted.\n",
11325 + if (csr_error_bits & SCHIZO_PCICTRL_TTO_ERR)
11326 + printk("%s: PCI TRDY# timeout error asserted.\n",
11328 + if (csr_error_bits & SCHIZO_PCICTRL_RTRY_ERR)
11329 + printk("%s: PCI excessive retry error asserted.\n",
11331 + if (csr_error_bits & SCHIZO_PCICTRL_DTO_ERR)
11332 + printk("%s: PCI discard timeout error asserted.\n",
11334 + if (csr_error_bits & SCHIZO_PCICTRL_SBH_ERR)
11335 + printk("%s: PCI streaming byte hole error asserted.\n",
11337 + if (csr_error_bits & SCHIZO_PCICTRL_SERR)
11338 + printk("%s: PCI SERR signal asserted.\n",
11340 + ret = IRQ_HANDLED;
11342 + pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat);
11343 + if (stat & (PCI_STATUS_PARITY |
11344 + PCI_STATUS_SIG_TARGET_ABORT |
11345 + PCI_STATUS_REC_TARGET_ABORT |
11346 + PCI_STATUS_REC_MASTER_ABORT |
11347 + PCI_STATUS_SIG_SYSTEM_ERROR)) {
11348 + printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
11349 + pbm->name, stat);
11350 + pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff);
11351 + ret = IRQ_HANDLED;
11356 static irqreturn_t schizo_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs)
11358 struct pci_pbm_info *pbm = dev_id;
11359 @@ -871,7 +953,7 @@
11360 SCHIZO_PCIAFSR_SRTRY | SCHIZO_PCIAFSR_SPERR |
11361 SCHIZO_PCIAFSR_STTO | SCHIZO_PCIAFSR_SUNUS);
11364 + return schizo_pcierr_intr_other(pbm);
11365 schizo_write(afsr_reg, error_bits);
11367 /* Log the error. */
11368 @@ -1043,34 +1125,6 @@
11369 #define SCHIZO_PCIERR_A_INO 0x32 /* PBM A PCI bus error */
11370 #define SCHIZO_PCIERR_B_INO 0x33 /* PBM B PCI bus error */
11371 #define SCHIZO_SERR_INO 0x34 /* Safari interface error */
11373 -#define SCHIZO_PCI_CTRL (0x2000UL)
11374 -#define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */
11375 -#define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */
11376 -#define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */
11377 -#define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */
11378 -#define SCHIZO_PCICTRL_TTO_ERR (1UL << 38UL) /* Safari/Tomatillo */
11379 -#define SCHIZO_PCICTRL_RTRY_ERR (1UL << 37UL) /* Safari/Tomatillo */
11380 -#define SCHIZO_PCICTRL_DTO_ERR (1UL << 36UL) /* Safari/Tomatillo */
11381 -#define SCHIZO_PCICTRL_SBH_ERR (1UL << 35UL) /* Safari */
11382 -#define SCHIZO_PCICTRL_SERR (1UL << 34UL) /* Safari/Tomatillo */
11383 -#define SCHIZO_PCICTRL_PCISPD (1UL << 33UL) /* Safari */
11384 -#define SCHIZO_PCICTRL_MRM_PREF (1UL << 28UL) /* Tomatillo */
11385 -#define SCHIZO_PCICTRL_RDO_PREF (1UL << 27UL) /* Tomatillo */
11386 -#define SCHIZO_PCICTRL_RDL_PREF (1UL << 26UL) /* Tomatillo */
11387 -#define SCHIZO_PCICTRL_PTO (3UL << 24UL) /* Safari/Tomatillo */
11388 -#define SCHIZO_PCICTRL_PTO_SHIFT 24UL
11389 -#define SCHIZO_PCICTRL_TRWSW (7UL << 21UL) /* Tomatillo */
11390 -#define SCHIZO_PCICTRL_F_TGT_A (1UL << 20UL) /* Tomatillo */
11391 -#define SCHIZO_PCICTRL_S_DTO_INT (1UL << 19UL) /* Safari */
11392 -#define SCHIZO_PCICTRL_F_TGT_RT (1UL << 19UL) /* Tomatillo */
11393 -#define SCHIZO_PCICTRL_SBH_INT (1UL << 18UL) /* Safari */
11394 -#define SCHIZO_PCICTRL_T_DTO_INT (1UL << 18UL) /* Tomatillo */
11395 -#define SCHIZO_PCICTRL_EEN (1UL << 17UL) /* Safari/Tomatillo */
11396 -#define SCHIZO_PCICTRL_PARK (1UL << 16UL) /* Safari/Tomatillo */
11397 -#define SCHIZO_PCICTRL_PCIRST (1UL << 8UL) /* Safari */
11398 -#define SCHIZO_PCICTRL_ARB_S (0x3fUL << 0UL) /* Safari */
11399 -#define SCHIZO_PCICTRL_ARB_T (0xffUL << 0UL) /* Tomatillo */
11401 struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
11403 diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
11404 --- a/arch/sparc64/kernel/sys_sparc32.c Sat Aug 16 07:09:56 2003
11405 +++ b/arch/sparc64/kernel/sys_sparc32.c Sat Aug 30 22:29:28 2003
11406 @@ -388,7 +388,7 @@
11408 * This is really horribly ugly.
11410 -#define IPCOP_MASK(__x) (1UL << (__x))
11411 +#define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64))
11412 static int do_sys32_semctl(int first, int second, int third, void *uptr)
11414 union semun fourth;
11415 @@ -400,7 +400,7 @@
11417 if (get_user (pad, (u32 *)uptr))
11419 - if(third == SETVAL)
11420 + if ((third & ~IPC_64) == SETVAL)
11421 fourth.val = (int)pad;
11423 fourth.__pad = (void *)A(pad);
11424 @@ -2779,3 +2779,41 @@
11425 return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
11429 +extern asmlinkage long
11430 +sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec,
11431 + timer_t * created_timer_id);
11434 +sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
11436 + struct sigevent se;
11437 + mm_segment_t oldfs;
11441 + if (se32 == NULL)
11442 + return sys_timer_create(clock, NULL, timer_id);
11444 + memset(&se, 0, sizeof(struct sigevent));
11445 + if (get_user(se.sigev_value.sival_int, &se32->sigev_value.sival_int) ||
11446 + __get_user(se.sigev_signo, &se32->sigev_signo) ||
11447 + __get_user(se.sigev_notify, &se32->sigev_notify) ||
11448 + __copy_from_user(&se._sigev_un._pad, &se32->_sigev_un._pad,
11449 + sizeof(se._sigev_un._pad)))
11452 + if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
11455 + oldfs = get_fs();
11456 + set_fs(KERNEL_DS);
11457 + err = sys_timer_create(clock, &se, &t);
11461 + err = __put_user (t, timer_id);
11466 diff -Nru a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
11467 --- a/arch/sparc64/kernel/sys_sunos32.c Sun May 25 17:00:00 2003
11468 +++ b/arch/sparc64/kernel/sys_sunos32.c Tue Aug 26 09:25:41 2003
11472 inode = file->f_dentry->d_inode;
11473 - if (minor(inode->i_rdev) == MEM_MAJOR && minor(inode->i_rdev) == 5) {
11474 + if (imajor(inode) == MEM_MAJOR && iminor(inode) == 5) {
11475 flags |= MAP_ANONYMOUS;
11478 diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
11479 --- a/arch/sparc64/kernel/systbls.S Sat Aug 16 14:55:44 2003
11480 +++ b/arch/sparc64/kernel/systbls.S Thu Aug 28 01:35:18 2003
11482 /*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
11483 .word sys_ni_syscall, compat_clock_settime, compat_clock_gettime, compat_clock_getres, compat_clock_nanosleep
11484 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, compat_timer_settime, compat_timer_gettime, sys_timer_getoverrun
11485 - .word sys_timer_delete, sys_ni_syscall
11486 + .word sys_timer_delete, sys32_timer_create, sys_ni_syscall
11488 /* Now the 64-bit native Linux syscall table. */
11490 @@ -133,7 +133,7 @@
11491 /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
11492 .word sys_ni_syscall, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
11493 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
11494 - .word sys_timer_delete, sys_ni_syscall
11495 + .word sys_timer_delete, sys_timer_create, sys_ni_syscall
11497 #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
11498 defined(CONFIG_SOLARIS_EMUL_MODULE)
11499 @@ -228,10 +228,10 @@
11500 .word sunos_nosys, sunos_nosys, sunos_nosys
11501 .word sunos_nosys, sunos_nosys
11502 /*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys
11503 - .word sunos_nosys, sunos_nosys, sys_ni_syscall
11504 - .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
11505 - .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
11506 - .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
11507 - .word sys_ni_syscall, sys_ni_syscall
11508 + .word sunos_nosys, sunos_nosys, sunos_nosys
11509 + .word sunos_nosys, sunos_nosys, sunos_nosys
11510 + .word sunos_nosys, sunos_nosys, sunos_nosys
11511 + .word sunos_nosys, sunos_nosys, sunos_nosys
11512 + .word sunos_nosys, sunos_nosys, sunos_nosys
11515 diff -Nru a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
11516 --- a/arch/sparc64/mm/hugetlbpage.c Mon Feb 24 23:13:11 2003
11517 +++ b/arch/sparc64/mm/hugetlbpage.c Tue Aug 26 09:41:27 2003
11518 @@ -380,207 +380,6 @@
11522 -static struct inode *set_new_inode(unsigned long len, int prot, int flag, int key)
11524 - struct inode *inode;
11527 - for (i = 0; i < MAX_ID; i++) {
11528 - if (htlbpagek[i].key == 0)
11533 - inode = kmalloc(sizeof (struct inode), GFP_KERNEL);
11534 - if (inode == NULL)
11537 - inode_init_once(inode);
11538 - atomic_inc(&inode->i_writecount);
11539 - inode->i_mapping = &inode->i_data;
11540 - inode->i_mapping->host = inode;
11541 - inode->i_ino = (unsigned long)key;
11543 - htlbpagek[i].key = key;
11544 - htlbpagek[i].in = inode;
11545 - inode->i_uid = current->fsuid;
11546 - inode->i_gid = current->fsgid;
11547 - inode->i_mode = prot;
11548 - inode->i_size = len;
11552 -static int check_size_prot(struct inode *inode, unsigned long len, int prot, int flag)
11554 - if (inode->i_uid != current->fsuid)
11556 - if (inode->i_gid != current->fsgid)
11558 - if (inode->i_size != len)
11563 -static int alloc_shared_hugetlb_pages(int key, unsigned long addr, unsigned long len,
11564 - int prot, int flag)
11566 - struct mm_struct *mm = current->mm;
11567 - struct vm_area_struct *vma;
11568 - struct inode *inode;
11569 - struct address_space *mapping;
11570 - struct page *page;
11572 - int retval = -ENOMEM;
11573 - int newalloc = 0;
11576 - spin_lock(&htlbpage_lock);
11578 - inode = find_key_inode(key);
11579 - if (inode == NULL) {
11580 - if (!capable(CAP_SYS_ADMIN)) {
11581 - if (!in_group_p(0)) {
11586 - if (!(flag & IPC_CREAT)) {
11587 - retval = -ENOENT;
11590 - inode = set_new_inode(len, prot, flag, key);
11591 - if (inode == NULL)
11595 - if (check_size_prot(inode, len, prot, flag) < 0) {
11596 - retval = -EINVAL;
11598 - } else if (atomic_read(&inode->i_writecount)) {
11599 - spin_unlock(&htlbpage_lock);
11603 - spin_unlock(&htlbpage_lock);
11604 - mapping = inode->i_mapping;
11606 - addr = do_mmap_pgoff(NULL, addr, len, (unsigned long) prot,
11607 - MAP_NORESERVE|MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, 0);
11608 - if (IS_ERR((void *) addr))
11611 - vma = find_vma(mm, addr);
11613 - retval = -EINVAL;
11617 - spin_lock(&mm->page_table_lock);
11619 - pte_t *pte = huge_pte_alloc_map(mm, addr);
11621 - if (!pte || !pte_none(pte)) {
11627 - idx = (addr - vma->vm_start) >> HPAGE_SHIFT;
11628 - page = find_get_page(mapping, idx);
11629 - if (page == NULL) {
11630 - page = alloc_hugetlb_page();
11631 - if (page == NULL) {
11633 - retval = -ENOMEM;
11636 - retval = add_to_page_cache(page, mapping,
11637 - idx, GFP_ATOMIC);
11640 - free_hugetlb_page(page);
11644 - set_huge_pte(mm, vma, page, pte,
11645 - (vma->vm_flags & VM_WRITE));
11648 - addr += HPAGE_SIZE;
11649 - } while (addr < vma->vm_end);
11652 - vma->vm_flags |= (VM_HUGETLB | VM_RESERVED);
11653 - vma->vm_ops = &hugetlb_vm_ops;
11654 - spin_unlock(&mm->page_table_lock);
11655 - spin_lock(&htlbpage_lock);
11656 - atomic_set(&inode->i_writecount, 0);
11657 - spin_unlock(&htlbpage_lock);
11662 - if (addr > vma->vm_start) {
11663 - unsigned long raddr;
11664 - raddr = vma->vm_end;
11665 - vma->vm_end = addr;
11667 - flush_cache_range(vma, vma->vm_start, vma->vm_end);
11668 - zap_hugetlb_resources(vma);
11669 - flush_tlb_range(vma, vma->vm_start, vma->vm_end);
11671 - vma->vm_end = raddr;
11673 - spin_unlock(&mm->page_table_lock);
11674 - do_munmap(mm, vma->vm_start, len);
11681 - spin_unlock(&htlbpage_lock);
11685 - for (idx = 0; idx < MAX_ID; idx++) {
11686 - if (htlbpagek[idx].key == inode->i_ino) {
11687 - htlbpagek[idx].key = 0;
11688 - htlbpagek[idx].in = NULL;
11697 -static int alloc_private_hugetlb_pages(int key, unsigned long addr, unsigned long len,
11698 - int prot, int flag)
11700 - if (!capable(CAP_SYS_ADMIN)) {
11701 - if (!in_group_p(0))
11704 - addr = do_mmap_pgoff(NULL, addr, len, prot,
11705 - MAP_NORESERVE|MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0);
11706 - if (IS_ERR((void *) addr))
11708 - if (make_hugetlb_pages_present(addr, (addr + len), flag) < 0) {
11709 - do_munmap(current->mm, addr, len);
11715 -int alloc_hugetlb_pages(int key, unsigned long addr, unsigned long len, int prot,
11719 - return alloc_shared_hugetlb_pages(key, addr, len, prot, flag);
11720 - return alloc_private_hugetlb_pages(key, addr, len, prot, flag);
11723 extern long htlbzone_pages;
11724 extern struct list_head htlbpage_freelist;
11726 diff -Nru a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
11727 --- a/arch/sparc64/solaris/misc.c Tue Aug 19 12:12:41 2003
11728 +++ b/arch/sparc64/solaris/misc.c Tue Aug 26 09:25:41 2003
11732 struct inode * inode = file->f_dentry->d_inode;
11733 - if(major(inode->i_rdev) == MEM_MAJOR &&
11734 - minor(inode->i_rdev) == 5) {
11735 + if(imajor(inode) == MEM_MAJOR &&
11736 + iminor(inode) == 5) {
11737 flags |= MAP_ANONYMOUS;
11740 diff -Nru a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c
11741 --- a/arch/sparc64/solaris/socksys.c Wed May 7 08:47:29 2003
11742 +++ b/arch/sparc64/solaris/socksys.c Tue Aug 26 09:25:40 2003
11743 @@ -70,14 +70,14 @@
11744 (int (*)(int,int,int))SUNOS(97);
11745 struct sol_socket_struct * sock;
11747 - family = ((minor(inode->i_rdev) >> 4) & 0xf);
11748 + family = ((iminor(inode) >> 4) & 0xf);
11751 type = SOCK_STREAM;
11755 - protocol = af_inet_protocols[minor(inode->i_rdev) & 0xf];
11756 + protocol = af_inet_protocols[iminor(inode) & 0xf];
11757 switch (protocol) {
11758 case IPPROTO_TCP: type = SOCK_STREAM; break;
11759 case IPPROTO_UDP: type = SOCK_DGRAM; break;
11760 diff -Nru a/arch/sparc64/solaris/systbl.S b/arch/sparc64/solaris/systbl.S
11761 --- a/arch/sparc64/solaris/systbl.S Mon Aug 18 01:08:52 2003
11762 +++ b/arch/sparc64/solaris/systbl.S Wed Aug 27 23:52:25 2003
11763 @@ -294,4 +294,5 @@
11764 .word solaris_unimplemented /* 264 */
11765 .word solaris_unimplemented /* 265 */
11766 .word solaris_unimplemented /* 266 */
11767 + .word solaris_unimplemented /* 267 */
11769 diff -Nru a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c
11770 --- a/arch/sparc64/solaris/timod.c Fri Jun 6 04:40:53 2003
11771 +++ b/arch/sparc64/solaris/timod.c Tue Aug 26 09:25:41 2003
11772 @@ -924,7 +924,7 @@
11773 if (!ino) goto out;
11775 if (!ino->i_sock &&
11776 - (major(ino->i_rdev) != 30 || minor(ino->i_rdev) != 1))
11777 + (imajor(ino) != 30 || iminor(ino) != 1))
11780 ctlptr = (struct strbuf *)A(arg1);
11781 diff -Nru a/arch/v850/Kconfig b/arch/v850/Kconfig
11782 --- a/arch/v850/Kconfig Sat Aug 2 14:26:16 2003
11783 +++ b/arch/v850/Kconfig Sun Aug 31 16:14:22 2003
11784 @@ -262,14 +262,6 @@
11786 menu "Executable file formats"
11796 source "fs/Kconfig.binfmt"
11799 diff -Nru a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
11800 --- a/arch/v850/kernel/vmlinux.lds.S Mon Aug 4 20:42:12 2003
11801 +++ b/arch/v850/kernel/vmlinux.lds.S Tue Aug 26 00:21:26 2003
11803 *(.intv.mach) /* Machine-specific int. vectors. */ \
11806 +#define RODATA_CONTENTS \
11807 + . = ALIGN (16) ; \
11808 + *(.rodata) *(.rodata.*) \
11809 + *(__vermagic) /* Kernel version magic */ \
11811 + /* Kernel symbol table: Normal symbols */ \
11812 + ___start___ksymtab = .; \
11814 + ___stop___ksymtab = .; \
11815 + /* Kernel symbol table: GPL-only symbols */ \
11816 + ___start___ksymtab_gpl = .; \
11817 + *(__ksymtab_gpl) \
11818 + ___stop___ksymtab_gpl = .; \
11819 + /* Kernel symbol table: strings */ \
11820 + *(__ksymtab_strings) \
11821 + /* Kernel symbol table: Normal symbols */ \
11822 + ___start___kcrctab = .; \
11824 + ___stop___kcrctab = .; \
11825 + /* Kernel symbol table: GPL-only symbols */ \
11826 + ___start___kcrctab_gpl = .; \
11827 + *(__kcrctab_gpl) \
11828 + ___stop___kcrctab_gpl = .; \
11830 /* Kernel text segment, and some constant data areas. */
11831 #define TEXT_CONTENTS \
11835 *(.exitcall.exit) \
11836 __real_etext = . ; /* There may be data after here. */ \
11838 + RODATA_CONTENTS \
11840 *(.call_table_data) \
11841 *(.call_table_text) \
11842 diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
11843 --- a/arch/x86_64/Kconfig Sat Aug 2 14:26:16 2003
11844 +++ b/arch/x86_64/Kconfig Sun Aug 31 16:14:22 2003
11845 @@ -370,11 +370,6 @@
11847 menu "Executable file formats / Emulations"
11851 - depends on PROC_FS
11854 source "fs/Kconfig.binfmt"
11856 config IA32_EMULATION
11857 diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig
11858 --- a/arch/x86_64/defconfig Sat Aug 9 07:53:46 2003
11859 +++ b/arch/x86_64/defconfig Sat Aug 23 04:57:05 2003
11861 # Code maturity level options
11863 CONFIG_EXPERIMENTAL=y
11864 +# CONFIG_BROKEN is not set
11868 @@ -23,10 +24,12 @@
11869 # CONFIG_BSD_PROCESS_ACCT is not set
11871 CONFIG_LOG_BUF_SHIFT=18
11872 +# CONFIG_IKCONFIG is not set
11873 # CONFIG_EMBEDDED is not set
11877 +CONFIG_IOSCHED_NOOP=y
11878 CONFIG_IOSCHED_AS=y
11879 CONFIG_IOSCHED_DEADLINE=y
11881 @@ -72,10 +75,10 @@
11882 CONFIG_SOFTWARE_SUSPEND=y
11886 +# ACPI (Advanced Configuration and Power Interface) Support
11888 +# CONFIG_ACPI_HT is not set
11890 -# CONFIG_ACPI_HT_ONLY is not set
11892 CONFIG_ACPI_SLEEP=y
11893 CONFIG_ACPI_SLEEP_PROC_FS=y
11894 @@ -117,7 +120,6 @@
11896 # Generic Driver Options
11898 -# CONFIG_FW_LOADER is not set
11901 # Memory Technology Devices (MTD)
11902 @@ -159,6 +161,7 @@
11903 CONFIG_IDEDISK_MULTI_MODE=y
11904 # CONFIG_IDEDISK_STROKE is not set
11905 CONFIG_BLK_DEV_IDECD=y
11906 +# CONFIG_BLK_DEV_IDETAPE is not set
11907 # CONFIG_BLK_DEV_IDEFLOPPY is not set
11908 # CONFIG_BLK_DEV_IDESCSI is not set
11909 # CONFIG_IDE_TASK_IOCTL is not set
11910 @@ -318,7 +321,6 @@
11911 # CONFIG_DECNET is not set
11912 # CONFIG_BRIDGE is not set
11913 # CONFIG_NETFILTER is not set
11914 -# CONFIG_XFRM_USER is not set
11917 # SCTP Configuration (EXPERIMENTAL)
11918 @@ -405,6 +407,7 @@
11919 # CONFIG_HAMACHI is not set
11920 # CONFIG_YELLOWFIN is not set
11921 # CONFIG_R8169 is not set
11922 +# CONFIG_SIS190 is not set
11923 # CONFIG_SK98LIN is not set
11926 @@ -595,10 +598,7 @@
11927 CONFIG_REISERFS_FS=y
11928 # CONFIG_REISERFS_CHECK is not set
11929 # CONFIG_REISERFS_PROC_INFO is not set
11931 -CONFIG_JFS_POSIX_ACL=y
11932 -# CONFIG_JFS_DEBUG is not set
11933 -# CONFIG_JFS_STATISTICS is not set
11934 +# CONFIG_JFS_FS is not set
11935 CONFIG_FS_POSIX_ACL=y
11936 # CONFIG_XFS_FS is not set
11937 # CONFIG_MINIX_FS is not set
11938 @@ -674,49 +674,6 @@
11940 # CONFIG_PARTITION_ADVANCED is not set
11941 CONFIG_MSDOS_PARTITION=y
11945 -# Native Language Support
11947 -CONFIG_NLS_DEFAULT="iso8859-1"
11948 -# CONFIG_NLS_CODEPAGE_437 is not set
11949 -# CONFIG_NLS_CODEPAGE_737 is not set
11950 -# CONFIG_NLS_CODEPAGE_775 is not set
11951 -# CONFIG_NLS_CODEPAGE_850 is not set
11952 -# CONFIG_NLS_CODEPAGE_852 is not set
11953 -# CONFIG_NLS_CODEPAGE_855 is not set
11954 -# CONFIG_NLS_CODEPAGE_857 is not set
11955 -# CONFIG_NLS_CODEPAGE_860 is not set
11956 -# CONFIG_NLS_CODEPAGE_861 is not set
11957 -# CONFIG_NLS_CODEPAGE_862 is not set
11958 -# CONFIG_NLS_CODEPAGE_863 is not set
11959 -# CONFIG_NLS_CODEPAGE_864 is not set
11960 -# CONFIG_NLS_CODEPAGE_865 is not set
11961 -# CONFIG_NLS_CODEPAGE_866 is not set
11962 -# CONFIG_NLS_CODEPAGE_869 is not set
11963 -# CONFIG_NLS_CODEPAGE_936 is not set
11964 -# CONFIG_NLS_CODEPAGE_950 is not set
11965 -# CONFIG_NLS_CODEPAGE_932 is not set
11966 -# CONFIG_NLS_CODEPAGE_949 is not set
11967 -# CONFIG_NLS_CODEPAGE_874 is not set
11968 -# CONFIG_NLS_ISO8859_8 is not set
11969 -# CONFIG_NLS_CODEPAGE_1250 is not set
11970 -# CONFIG_NLS_CODEPAGE_1251 is not set
11971 -# CONFIG_NLS_ISO8859_1 is not set
11972 -# CONFIG_NLS_ISO8859_2 is not set
11973 -# CONFIG_NLS_ISO8859_3 is not set
11974 -# CONFIG_NLS_ISO8859_4 is not set
11975 -# CONFIG_NLS_ISO8859_5 is not set
11976 -# CONFIG_NLS_ISO8859_6 is not set
11977 -# CONFIG_NLS_ISO8859_7 is not set
11978 -# CONFIG_NLS_ISO8859_9 is not set
11979 -# CONFIG_NLS_ISO8859_13 is not set
11980 -# CONFIG_NLS_ISO8859_14 is not set
11981 -# CONFIG_NLS_ISO8859_15 is not set
11982 -# CONFIG_NLS_KOI8_R is not set
11983 -# CONFIG_NLS_KOI8_U is not set
11984 -# CONFIG_NLS_UTF8 is not set
11988 diff -Nru a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
11989 --- a/arch/x86_64/ia32/ia32_ioctl.c Fri Jul 11 05:14:13 2003
11990 +++ b/arch/x86_64/ia32/ia32_ioctl.c Sun Aug 31 16:14:44 2003
11991 @@ -673,12 +673,10 @@
11995 -#define REF_SYMBOL(handler) if (0) (void)handler;
11996 -#define HANDLE_IOCTL2(cmd,handler) REF_SYMBOL(handler); asm volatile(".quad %P0, " #handler ",0"::"i" (cmd));
11997 -#define HANDLE_IOCTL(cmd,handler) HANDLE_IOCTL2(cmd,handler)
11998 +#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
11999 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
12000 -#define IOCTL_TABLE_START void ioctl_dummy(void) { asm volatile("\n.global ioctl_start\nioctl_start:\n\t" );
12001 -#define IOCTL_TABLE_END asm volatile("\n.global ioctl_end;\nioctl_end:\n"); }
12002 +#define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
12003 +#define IOCTL_TABLE_END };
12006 #include <linux/compat_ioctl.h>
12007 @@ -765,3 +763,4 @@
12008 HANDLE_IOCTL(MTRRIOC32_KILL_PAGE_ENTRY, mtrr_ioctl32)
12011 +int ioctl_table_size = ARRAY_SIZE(ioctl_start);
12012 diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
12013 --- a/arch/x86_64/ia32/sys_ia32.c Mon Jul 14 04:19:39 2003
12014 +++ b/arch/x86_64/ia32/sys_ia32.c Sun Aug 31 05:33:07 2003
12015 @@ -1170,8 +1170,6 @@
12019 -extern void check_pending(int signum);
12021 asmlinkage long sys_utimes(char *, struct timeval *);
12024 diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
12025 --- a/arch/x86_64/kernel/apic.c Mon Aug 18 19:46:23 2003
12026 +++ b/arch/x86_64/kernel/apic.c Sat Aug 23 05:13:33 2003
12027 @@ -299,7 +299,7 @@
12028 * This is meaningless in clustered apic mode, so we skip it.
12030 if (!clustered_apic_mode &&
12031 - !cpu_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map))
12032 + !physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map))
12036 @@ -993,7 +993,7 @@
12038 connect_bsp_APIC();
12040 - phys_cpu_present_map = cpumask_of_cpu(0);
12041 + phys_cpu_present_map = physid_mask_of_physid(0);
12042 apic_write_around(APIC_ID, boot_cpu_id);
12044 setup_local_APIC();
12045 diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
12046 --- a/arch/x86_64/kernel/io_apic.c Tue Aug 19 07:45:10 2003
12047 +++ b/arch/x86_64/kernel/io_apic.c Sat Aug 23 05:13:33 2003
12048 @@ -1014,7 +1014,7 @@
12049 static void __init setup_ioapic_ids_from_mpc (void)
12051 union IO_APIC_reg_00 reg_00;
12052 - cpumask_t phys_id_present_map = phys_cpu_present_map;
12053 + physid_mask_t phys_id_present_map = phys_cpu_present_map;
12056 unsigned char old_id;
12057 @@ -1047,22 +1047,22 @@
12058 * system must have a unique ID or we get lots of nice
12059 * 'stuck on smp_invalidate_needed IPI wait' messages.
12061 - if (cpu_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map)) {
12062 + if (physid_isset(mp_ioapics[apic].mpc_apicid, phys_id_present_map)) {
12063 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
12064 apic, mp_ioapics[apic].mpc_apicid);
12065 for (i = 0; i < 0xf; i++)
12066 - if (!cpu_isset(i, phys_id_present_map))
12067 + if (!physid_isset(i, phys_id_present_map))
12070 panic("Max APIC ID exceeded!\n");
12071 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
12073 - cpu_set(i, phys_id_present_map);
12074 + physid_set(i, phys_id_present_map);
12075 mp_ioapics[apic].mpc_apicid = i;
12078 "Using IO-APIC %d\n", mp_ioapics[apic].mpc_apicid);
12079 - cpu_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
12080 + physid_set(mp_ioapics[apic].mpc_apicid, phys_id_present_map);
12084 @@ -1642,7 +1642,7 @@
12085 int __init io_apic_get_unique_id (int ioapic, int apic_id)
12087 union IO_APIC_reg_00 reg_00;
12088 - static cpumask_t apic_id_map;
12089 + static physid_mask_t apic_id_map;
12090 unsigned long flags;
12093 @@ -1655,7 +1655,7 @@
12094 * advantage of new APIC bus architecture.
12097 - if (!cpus_empty(apic_id_map))
12098 + if (!physids_empty(apic_id_map))
12099 apic_id_map = phys_cpu_present_map;
12101 spin_lock_irqsave(&ioapic_lock, flags);
12102 @@ -1672,10 +1672,10 @@
12103 * Every APIC in a system must have a unique ID or we get lots of nice
12104 * 'stuck on smp_invalidate_needed IPI wait' messages.
12106 - if (cpu_isset(apic_id, apic_id_map)) {
12107 + if (physid_isset(apic_id, apic_id_map)) {
12109 for (i = 0; i < IO_APIC_MAX_ID; i++) {
12110 - if (!cpu_isset(i, apic_id_map))
12111 + if (!physid_isset(i, apic_id_map))
12115 @@ -1688,7 +1688,7 @@
12119 - cpu_set(apic_id, apic_id_map);
12120 + physid_set(apic_id, apic_id_map);
12122 if (reg_00.bits.ID != apic_id) {
12123 reg_00.bits.ID = apic_id;
12124 diff -Nru a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c
12125 --- a/arch/x86_64/kernel/ioport.c Wed Aug 20 10:43:52 2003
12126 +++ b/arch/x86_64/kernel/ioport.c Sat Aug 23 05:03:34 2003
12127 @@ -10,12 +10,11 @@
12128 #include <linux/errno.h>
12129 #include <linux/types.h>
12130 #include <linux/ioport.h>
12131 -#include <linux/mm.h>
12132 #include <linux/smp.h>
12133 #include <linux/smp_lock.h>
12134 #include <linux/stddef.h>
12135 #include <linux/slab.h>
12136 -#include <asm/io.h>
12137 +#include <linux/thread_info.h>
12139 /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
12140 static void set_bitmap(unsigned long *bitmap, unsigned int base, unsigned int extent, int new_value)
12141 @@ -118,12 +117,7 @@
12144 regs.eflags = (regs.eflags &~ 0x3000UL) | (level << 12);
12145 + /* Make sure we return the long way (not sysenter) */
12146 + set_thread_flag(TIF_IRET);
12150 -void eat_key(void)
12152 - if (inb(0x60) & 1)
12156 diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
12157 --- a/arch/x86_64/kernel/mpparse.c Tue Aug 19 07:45:28 2003
12158 +++ b/arch/x86_64/kernel/mpparse.c Sat Aug 23 05:13:33 2003
12160 static unsigned int num_processors = 0;
12162 /* Bitmask of physically existing CPUs */
12163 -cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
12164 +physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
12166 /* ACPI MADT entry parsing functions */
12167 #ifdef CONFIG_ACPI_BOOT
12168 @@ -126,7 +126,7 @@
12170 ver = m->mpc_apicver;
12172 - cpu_set(m->mpc_apicid, phys_cpu_present_map);
12173 + physid_set(m->mpc_apicid, phys_cpu_present_map);
12177 diff -Nru a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c
12178 --- a/arch/x86_64/kernel/msr.c Mon Aug 18 19:46:23 2003
12179 +++ b/arch/x86_64/kernel/msr.c Tue Aug 26 09:25:40 2003
12180 @@ -194,7 +194,7 @@
12184 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
12185 + int cpu = iminor(file->f_dentry->d_inode);
12189 @@ -219,7 +219,7 @@
12193 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
12194 + int cpu = iminor(file->f_dentry->d_inode);
12198 @@ -239,7 +239,7 @@
12200 static int msr_open(struct inode *inode, struct file *file)
12202 - int cpu = minor(file->f_dentry->d_inode->i_rdev);
12203 + int cpu = iminor(file->f_dentry->d_inode);
12204 struct cpuinfo_x86 *c = &(cpu_data)[cpu];
12206 if (!cpu_online(cpu))
12207 diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
12208 --- a/arch/x86_64/kernel/setup.c Mon Aug 18 19:46:23 2003
12209 +++ b/arch/x86_64/kernel/setup.c Sat Aug 23 04:55:48 2003
12210 @@ -243,6 +243,8 @@
12212 void __init setup_arch(char **cmdline_p)
12214 + unsigned long low_mem_size;
12216 ROOT_DEV = ORIG_ROOT_DEV;
12217 drive_info = DRIVE_INFO;
12218 screen_info = SCREEN_INFO;
12219 @@ -378,7 +380,13 @@
12220 request_resource(&ioport_resource, standard_io_resources+i);
12223 - pci_mem_start = IOMAP_START;
12224 + /* Will likely break when you have unassigned resources with more
12225 + than 4GB memory and bridges that don't support more than 4GB.
12226 + Doing it properly would require to allocate GFP_DMA memory
12228 + low_mem_size = ((end_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
12229 + if (low_mem_size > pci_mem_start)
12230 + pci_mem_start = low_mem_size;
12232 #ifdef CONFIG_GART_IOMMU
12234 diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
12235 --- a/arch/x86_64/kernel/smpboot.c Mon Aug 18 19:46:23 2003
12236 +++ b/arch/x86_64/kernel/smpboot.c Sat Aug 23 05:13:33 2003
12237 @@ -734,10 +734,10 @@
12238 current_thread_info()->cpu = 0;
12239 smp_tune_scheduling();
12241 - if (!cpu_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
12242 + if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
12243 printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
12244 hard_smp_processor_id());
12245 - cpu_set(hard_smp_processor_id(), phys_cpu_present_map);
12246 + physid_set(hard_smp_processor_id(), phys_cpu_present_map);
12250 @@ -748,7 +748,7 @@
12251 printk(KERN_NOTICE "SMP motherboard not detected.\n");
12253 cpu_online_map = cpumask_of_cpu(0);
12254 - phys_cpu_present_map = cpumask_of_cpu(0);
12255 + phys_cpu_present_map = physid_mask_of_physid(0);
12256 if (APIC_init_uniprocessor())
12257 printk(KERN_NOTICE "Local APIC not detected."
12258 " Using dummy APIC emulation.\n");
12259 @@ -759,10 +759,10 @@
12260 * Should not be necessary because the MP table should list the boot
12261 * CPU too, but we do it for the sake of robustness anyway.
12263 - if (!cpu_isset(boot_cpu_id, phys_cpu_present_map)) {
12264 + if (!physid_isset(boot_cpu_id, phys_cpu_present_map)) {
12265 printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n",
12267 - cpu_set(hard_smp_processor_id(), phys_cpu_present_map);
12268 + physid_set(hard_smp_processor_id(), phys_cpu_present_map);
12272 @@ -774,7 +774,7 @@
12273 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
12275 cpu_online_map = cpumask_of_cpu(0);
12276 - phys_cpu_present_map = cpumask_of_cpu(0);
12277 + phys_cpu_present_map = physid_mask_of_physid(0);
12281 @@ -789,7 +789,7 @@
12282 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
12284 cpu_online_map = cpumask_of_cpu(0);
12285 - phys_cpu_present_map = cpumask_of_cpu(0);
12286 + phys_cpu_present_map = physid_mask_of_physid(0);
12290 @@ -803,7 +803,7 @@
12292 * Now scan the CPU present map and fire up the other CPUs.
12294 - Dprintk("CPU present map: %lx\n", phys_cpu_present_map);
12295 + Dprintk("CPU present map: %lx\n", physids_coerce(phys_cpu_present_map));
12297 for (apicid = 0; apicid < NR_CPUS; apicid++) {
12299 diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
12300 --- a/arch/x86_64/kernel/time.c Thu Jul 10 22:22:57 2003
12301 +++ b/arch/x86_64/kernel/time.c Sat Aug 23 04:31:18 2003
12306 + if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */
12307 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32;
12310 diff -Nru a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
12311 --- a/arch/x86_64/kernel/vsyscall.c Fri Jun 13 01:16:29 2003
12312 +++ b/arch/x86_64/kernel/vsyscall.c Sat Aug 23 04:31:40 2003
12314 if (__vxtime.mode == VXTIME_TSC) {
12317 + if (t < __vxtime.last_tsc) t = __vxtime.last_tsc;
12318 usec += ((t - __vxtime.last_tsc) *
12319 __vxtime.tsc_quot) >> 32;
12321 diff -Nru a/drivers/Makefile b/drivers/Makefile
12322 --- a/drivers/Makefile Tue Aug 12 08:42:21 2003
12323 +++ b/drivers/Makefile Sun Aug 24 07:59:26 2003
12325 obj-y += base/ block/ misc/ net/ media/
12326 obj-$(CONFIG_NUBUS) += nubus/
12327 obj-$(CONFIG_ATM) += atm/
12328 +obj-$(CONFIG_PPC_PMAC) += macintosh/
12329 obj-$(CONFIG_IDE) += ide/
12330 obj-$(CONFIG_FC4) += fc4/
12331 obj-$(CONFIG_SCSI) += scsi/
12333 obj-$(CONFIG_DIO) += dio/
12334 obj-$(CONFIG_SBUS) += sbus/
12335 obj-$(CONFIG_ZORRO) += zorro/
12336 -obj-$(CONFIG_PPC_PMAC) += macintosh/
12337 obj-$(CONFIG_MAC) += macintosh/
12338 obj-$(CONFIG_PARIDE) += block/paride/
12339 obj-$(CONFIG_TC) += tc/
12340 diff -Nru a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
12341 --- a/drivers/acorn/block/fd1772.c Thu Aug 7 02:25:23 2003
12342 +++ b/drivers/acorn/block/fd1772.c Tue Aug 26 09:25:40 2003
12343 @@ -1455,8 +1455,8 @@
12345 static int floppy_open(struct inode *inode, struct file *filp)
12347 - int drive = minor(inode->i_rdev) & 3;
12348 - int type = minor(inode->i_rdev) >> 2;
12349 + int drive = iminor(inode) & 3;
12350 + int type = iminor(inode) >> 2;
12351 int old_dev = fd_device[drive];
12353 if (fd_ref[drive] && old_dev != type)
12354 @@ -1490,7 +1490,7 @@
12356 static int floppy_release(struct inode *inode, struct file *filp)
12358 - int drive = minor(inode->i_rdev) & 3;
12359 + int drive = iminor(inode) & 3;
12361 if (fd_ref[drive] < 0)
12363 diff -Nru a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
12364 --- a/drivers/acpi/Kconfig Wed Aug 20 09:06:49 2003
12365 +++ b/drivers/acpi/Kconfig Sat Aug 23 04:07:34 2003
12367 bool "Sleep States (EXPERIMENTAL)"
12368 depends on X86 && ACPI
12369 depends on EXPERIMENTAL && PM
12370 + select SOFTWARE_SUSPEND
12373 This option adds support for ACPI suspend states.
12374 diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
12375 --- a/drivers/acpi/pci_link.c Tue Jul 29 13:28:29 2003
12376 +++ b/drivers/acpi/pci_link.c Sun Aug 31 16:14:25 2003
12377 @@ -516,9 +516,8 @@
12381 - if (acpi_pci_link_allocate(link)) {
12384 + if (acpi_pci_link_allocate(link))
12387 if (!link->irq.active) {
12388 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link disabled\n"));
12389 diff -Nru a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
12390 --- a/drivers/atm/ambassador.c Tue Aug 19 21:10:45 2003
12391 +++ b/drivers/atm/ambassador.c Wed Aug 27 23:17:10 2003
12392 @@ -310,10 +310,11 @@
12396 +static void do_housekeeping (unsigned long arg);
12397 /********** globals **********/
12399 static amb_dev * amb_devs = NULL;
12400 -static struct timer_list housekeeping;
12401 +static struct timer_list housekeeping = TIMER_INITIALIZER(do_housekeeping, 0, 1);
12403 static unsigned short debug = 0;
12404 static unsigned int cmds = 8;
12405 @@ -937,63 +938,6 @@
12406 return IRQ_HANDLED;
12409 -/********** don't panic... yeah, right **********/
12411 -#ifdef DEBUG_AMBASSADOR
12412 -static void dont_panic (amb_dev * dev) {
12413 - amb_cq * cq = &dev->cq;
12414 - volatile amb_cq_ptrs * ptrs = &cq->ptrs;
12419 - tx_simple * tx_descr;
12420 - unsigned char pool;
12423 - unsigned long flags;
12424 - save_flags (flags);
12427 - PRINTK (KERN_INFO, "don't panic - putting adapter into reset");
12428 - wr_plain (dev, offsetof(amb_mem, reset_control),
12429 - rd_plain (dev, offsetof(amb_mem, reset_control)) | AMB_RESET_BITS);
12431 - PRINTK (KERN_INFO, "marking all commands complete");
12432 - for (cmd = ptrs->start; cmd < ptrs->limit; ++cmd)
12433 - cmd->request = cpu_to_be32 (SRB_COMPLETE);
12435 - PRINTK (KERN_INFO, "completing all TXs");
12437 - tx = txq->in.ptr;
12438 - while (txq->pending--) {
12439 - if (tx == txq->in.start)
12440 - tx = txq->in.limit;
12442 - tx_descr = bus_to_virt (be32_to_cpu (tx->tx_descr_addr));
12443 - amb_kfree_skb (tx_descr->skb);
12444 - kfree (tx_descr);
12447 - PRINTK (KERN_INFO, "freeing all RX buffers");
12448 - for (pool = 0; pool < NUM_RX_POOLS; ++pool) {
12449 - rxq = &dev->rxq[pool];
12450 - rx = rxq->in.ptr;
12451 - while (rxq->pending--) {
12452 - if (rx == rxq->in.start)
12453 - rx = rxq->in.limit;
12455 - dev_kfree_skb_any (bus_to_virt (rx->handle));
12459 - PRINTK (KERN_INFO, "don't panic over - close all VCs and rmmod");
12460 - set_bit (dead, &dev->flags);
12461 - restore_flags (flags);
12466 /********** make rate (not quite as much fun as Horizon) **********/
12468 static unsigned int make_rate (unsigned int rate, rounding r,
12469 @@ -1420,32 +1364,6 @@
12473 -/********** Debug
\17Ioctl **********/
12476 -static int amb_ioctl (struct atm_dev * dev, unsigned int cmd, void * arg) {
12477 - unsigned short newdebug;
12478 - if (cmd == AMB_SETDEBUG) {
12479 - if (!capable(CAP_NET_ADMIN))
12481 - if (copy_from_user (&newdebug, arg, sizeof(newdebug))) {
12485 - debug = newdebug;
12488 - } else if (cmd == AMB_DONTPANIC) {
12489 - if (!capable(CAP_NET_ADMIN))
12491 - dont_panic (dev);
12494 - return -ENOIOCTLCMD;
12499 /********** Set socket options for a VC **********/
12501 // int amb_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen);
12502 @@ -1524,33 +1442,6 @@
12503 tx.tx_descr_length = cpu_to_be16 (sizeof(tx_frag)+sizeof(tx_frag_end));
12504 tx.tx_descr_addr = cpu_to_be32 (virt_to_bus (&tx_descr->tx_frag));
12506 -#ifdef DEBUG_AMBASSADOR
12508 - if (vc == 1023) {
12510 - unsigned short d = 0;
12511 - char * s = skb->data;
12514 - for (i = 0; i < 4; ++i) {
12515 - d = (d<<4) | ((*s <= '9') ? (*s - '0') : (*s - 'a' + 10));
12518 - PRINTK (KERN_INFO, "debug bitmap is now %hx", debug = d);
12522 - if (*s++ == 'e' && *s++ == 's' && *s++ == 'e' && *s++ == 't')
12523 - dont_panic (dev);
12533 while (tx_give (dev, &tx))
12536 @@ -1663,21 +1554,14 @@
12537 /********** Operation Structure **********/
12539 static const struct atmdev_ops amb_ops = {
12540 - .open = amb_open,
12541 + .open = amb_open,
12542 .close = amb_close,
12543 - .send = amb_send,
12544 + .send = amb_send,
12545 .proc_read = amb_proc_read,
12546 .owner = THIS_MODULE,
12549 /********** housekeeping **********/
12551 -static inline void set_timer (struct timer_list * timer, unsigned long delay) {
12552 - timer->expires = jiffies + delay;
12553 - add_timer (timer);
12557 static void do_housekeeping (unsigned long arg) {
12558 amb_dev * dev = amb_devs;
12559 // data is set to zero at module unload
12560 @@ -1693,7 +1577,7 @@
12564 - set_timer (&housekeeping, 10*HZ);
12565 + mod_timer(&housekeeping, jiffies + 10*HZ);
12569 @@ -2579,11 +2463,7 @@
12570 devs = amb_probe();
12573 - init_timer (&housekeeping);
12574 - housekeeping.function = do_housekeeping;
12576 - housekeeping.data = 1;
12577 - set_timer (&housekeeping, 0);
12578 + mod_timer (&housekeeping, jiffies);
12580 PRINTK (KERN_INFO, "no (usable) adapters found");
12582 @@ -2600,7 +2480,7 @@
12585 housekeeping.data = 0;
12586 - del_timer (&housekeeping);
12587 + del_timer_sync(&housekeeping);
12591 diff -Nru a/drivers/atm/eni.c b/drivers/atm/eni.c
12592 --- a/drivers/atm/eni.c Tue Aug 19 21:10:45 2003
12593 +++ b/drivers/atm/eni.c Mon Sep 1 08:23:55 2003
12594 @@ -1809,10 +1809,6 @@
12595 "master (0x%02x)\n",dev->number,error);
12598 -#ifdef __sparc_v9__ /* copied from drivers/net/sunhme.c */
12599 - /* NOTE: Cache line size is in 32-bit word units. */
12600 - pci_write_config_byte(eni_dev->pci_dev, PCI_CACHE_LINE_SIZE, 0x10);
12602 if ((error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,
12604 printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap "
12605 @@ -2345,7 +2341,7 @@
12606 struct sk_buff *skb; /* dummy for sizeof */
12608 if (sizeof(skb->cb) < sizeof(struct eni_skb_prv)) {
12609 - printk(KERN_ERR "eni_detect: skb->cb is too small (%d < %d)\n",
12610 + printk(KERN_ERR "eni_detect: skb->cb is too small (%Zd < %Zd)\n",
12611 sizeof(skb->cb),sizeof(struct eni_skb_prv));
12614 diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c
12615 --- a/drivers/atm/firestream.c Tue Aug 19 21:10:45 2003
12616 +++ b/drivers/atm/firestream.c Sun Aug 31 16:14:27 2003
12617 @@ -895,7 +895,7 @@
12618 /* XXX handle qos parameters (rate limiting) ? */
12620 vcc = kmalloc(sizeof(struct fs_vcc), GFP_KERNEL);
12621 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc VCC: %p(%d)\n", vcc, sizeof(struct fs_vcc));
12622 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc VCC: %p(%Zd)\n", vcc, sizeof(struct fs_vcc));
12624 clear_bit(ATM_VF_ADDR, &atm_vcc->flags);
12626 @@ -946,7 +946,7 @@
12628 if (DO_DIRECTION (txtp)) {
12629 tc = kmalloc (sizeof (struct fs_transmit_config), GFP_KERNEL);
12630 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc tc: %p(%d)\n",
12631 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc tc: %p(%Zd)\n",
12632 tc, sizeof (struct fs_transmit_config));
12634 fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n");
12635 @@ -1180,7 +1180,7 @@
12636 vcc->last_skb = skb;
12638 td = kmalloc (sizeof (struct FS_BPENTRY), GFP_ATOMIC);
12639 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc transd: %p(%d)\n", td, sizeof (struct FS_BPENTRY));
12640 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc transd: %p(%Zd)\n", td, sizeof (struct FS_BPENTRY));
12642 /* Oops out of mem */
12644 @@ -1487,7 +1487,7 @@
12645 fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-skb: %p(%d)\n", skb, fp->bufsize);
12647 ne = kmalloc (sizeof (struct FS_BPENTRY), gfp_flags);
12648 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-d: %p(%d)\n", ne, sizeof (struct FS_BPENTRY));
12649 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc rec-d: %p(%Zd)\n", ne, sizeof (struct FS_BPENTRY));
12651 fs_dprintk (FS_DEBUG_ALLOC, "Free rec-skb: %p\n", skb);
12652 dev_kfree_skb_any (skb);
12653 @@ -1792,7 +1792,7 @@
12655 dev->atm_vccs = kmalloc (dev->nchannels * sizeof (struct atm_vcc *),
12657 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%d)\n",
12658 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%Zd)\n",
12659 dev->atm_vccs, dev->nchannels * sizeof (struct atm_vcc *));
12661 if (!dev->atm_vccs) {
12662 @@ -1900,7 +1900,7 @@
12665 fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
12666 - fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%d)\n",
12667 + fs_dprintk (FS_DEBUG_ALLOC, "Alloc fs-dev: %p(%Zd)\n",
12668 fs_dev, sizeof (struct fs_dev));
12671 diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
12672 --- a/drivers/block/DAC960.c Fri Aug 15 09:39:48 2003
12673 +++ b/drivers/block/DAC960.c Sun Aug 31 16:13:56 2003
12675 #include <linux/version.h>
12676 #include <linux/module.h>
12677 #include <linux/types.h>
12678 +#include <linux/miscdevice.h>
12679 #include <linux/blkdev.h>
12680 #include <linux/bio.h>
12681 #include <linux/completion.h>
12683 #include <asm/uaccess.h>
12684 #include "DAC960.h"
12686 +#define DAC960_GAM_MINOR 252
12689 static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers];
12690 static int DAC960_ControllerCount;
12692 DAC960_Controller_T *p = disk->queue->queuedata;
12693 int drive_nr = (int)disk->private_data;
12695 - /* bad hack for the "user" ioctls */
12696 - if (!p->ControllerNumber && !drive_nr && (file->f_flags & O_NONBLOCK))
12699 if (p->FirmwareType == DAC960_V1_Controller) {
12700 if (p->V1.LogicalDriveInformation[drive_nr].
12701 LogicalDriveState == DAC960_V1_LogicalDrive_Offline)
12702 @@ -101,9 +100,6 @@
12703 int drive_nr = (int)disk->private_data;
12704 struct hd_geometry g, *loc = (struct hd_geometry *)arg;
12706 - if (file && (file->f_flags & O_NONBLOCK))
12707 - return DAC960_UserIOCTL(inode, file, cmd, arg);
12709 if (cmd != HDIO_GETGEO || !loc)
12712 @@ -5569,407 +5565,6 @@
12716 - DAC960_UserIOCTL is the User IOCTL Function for the DAC960 Driver.
12719 -static int DAC960_UserIOCTL(struct inode *inode, struct file *file,
12720 - unsigned int Request, unsigned long Argument)
12722 - int ErrorCode = 0;
12723 - if (!capable(CAP_SYS_ADMIN)) return -EACCES;
12726 - case DAC960_IOCTL_GET_CONTROLLER_COUNT:
12727 - return DAC960_ControllerCount;
12728 - case DAC960_IOCTL_GET_CONTROLLER_INFO:
12730 - DAC960_ControllerInfo_T *UserSpaceControllerInfo =
12731 - (DAC960_ControllerInfo_T *) Argument;
12732 - DAC960_ControllerInfo_T ControllerInfo;
12733 - DAC960_Controller_T *Controller;
12734 - int ControllerNumber;
12735 - if (UserSpaceControllerInfo == NULL) return -EINVAL;
12736 - ErrorCode = get_user(ControllerNumber,
12737 - &UserSpaceControllerInfo->ControllerNumber);
12738 - if (ErrorCode != 0) return ErrorCode;
12739 - if (ControllerNumber < 0 ||
12740 - ControllerNumber > DAC960_ControllerCount - 1)
12742 - Controller = DAC960_Controllers[ControllerNumber];
12743 - if (Controller == NULL) return -ENXIO;
12744 - memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T));
12745 - ControllerInfo.ControllerNumber = ControllerNumber;
12746 - ControllerInfo.FirmwareType = Controller->FirmwareType;
12747 - ControllerInfo.Channels = Controller->Channels;
12748 - ControllerInfo.Targets = Controller->Targets;
12749 - ControllerInfo.PCI_Bus = Controller->Bus;
12750 - ControllerInfo.PCI_Device = Controller->Device;
12751 - ControllerInfo.PCI_Function = Controller->Function;
12752 - ControllerInfo.IRQ_Channel = Controller->IRQ_Channel;
12753 - ControllerInfo.PCI_Address = Controller->PCI_Address;
12754 - strcpy(ControllerInfo.ModelName, Controller->ModelName);
12755 - strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion);
12756 - return (copy_to_user(UserSpaceControllerInfo, &ControllerInfo,
12757 - sizeof(DAC960_ControllerInfo_T)) ? -EFAULT : 0);
12759 - case DAC960_IOCTL_V1_EXECUTE_COMMAND:
12761 - DAC960_V1_UserCommand_T *UserSpaceUserCommand =
12762 - (DAC960_V1_UserCommand_T *) Argument;
12763 - DAC960_V1_UserCommand_T UserCommand;
12764 - DAC960_Controller_T *Controller;
12765 - DAC960_Command_T *Command = NULL;
12766 - DAC960_V1_CommandOpcode_T CommandOpcode;
12767 - DAC960_V1_CommandStatus_T CommandStatus;
12768 - DAC960_V1_DCDB_T DCDB;
12769 - DAC960_V1_DCDB_T *DCDB_IOBUF = NULL;
12770 - dma_addr_t DCDB_IOBUFDMA;
12771 - unsigned long flags;
12772 - int ControllerNumber, DataTransferLength;
12773 - unsigned char *DataTransferBuffer = NULL;
12774 - dma_addr_t DataTransferBufferDMA;
12775 - if (UserSpaceUserCommand == NULL) return -EINVAL;
12776 - if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12777 - sizeof(DAC960_V1_UserCommand_T))) {
12778 - ErrorCode = -EFAULT;
12781 - ControllerNumber = UserCommand.ControllerNumber;
12782 - if (ControllerNumber < 0 ||
12783 - ControllerNumber > DAC960_ControllerCount - 1)
12785 - Controller = DAC960_Controllers[ControllerNumber];
12786 - if (Controller == NULL) return -ENXIO;
12787 - if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL;
12788 - CommandOpcode = UserCommand.CommandMailbox.Common.CommandOpcode;
12789 - DataTransferLength = UserCommand.DataTransferLength;
12790 - if (CommandOpcode & 0x80) return -EINVAL;
12791 - if (CommandOpcode == DAC960_V1_DCDB)
12793 - if (copy_from_user(&DCDB, UserCommand.DCDB,
12794 - sizeof(DAC960_V1_DCDB_T))) {
12795 - ErrorCode = -EFAULT;
12798 - if (DCDB.Channel >= DAC960_V1_MaxChannels) return -EINVAL;
12799 - if (!((DataTransferLength == 0 &&
12801 - == DAC960_V1_DCDB_NoDataTransfer) ||
12802 - (DataTransferLength > 0 &&
12804 - == DAC960_V1_DCDB_DataTransferDeviceToSystem) ||
12805 - (DataTransferLength < 0 &&
12807 - == DAC960_V1_DCDB_DataTransferSystemToDevice)))
12809 - if (((DCDB.TransferLengthHigh4 << 16) | DCDB.TransferLength)
12810 - != abs(DataTransferLength))
12812 - DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice,
12813 - sizeof(DAC960_V1_DCDB_T), &DCDB_IOBUFDMA);
12814 - if (DCDB_IOBUF == NULL)
12817 - if (DataTransferLength > 0)
12819 - DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12820 - DataTransferLength, &DataTransferBufferDMA);
12821 - if (DataTransferBuffer == NULL) {
12822 - ErrorCode = -ENOMEM;
12825 - memset(DataTransferBuffer, 0, DataTransferLength);
12827 - else if (DataTransferLength < 0)
12829 - DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12830 - -DataTransferLength, &DataTransferBufferDMA);
12831 - if (DataTransferBuffer == NULL) {
12832 - ErrorCode = -ENOMEM;
12835 - if (copy_from_user(DataTransferBuffer,
12836 - UserCommand.DataTransferBuffer,
12837 - -DataTransferLength)) {
12838 - ErrorCode = -EFAULT;
12842 - if (CommandOpcode == DAC960_V1_DCDB)
12844 - spin_lock_irqsave(&Controller->queue_lock, flags);
12845 - while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12846 - DAC960_WaitForCommand(Controller);
12847 - while (Controller->V1.DirectCommandActive[DCDB.Channel]
12850 - spin_unlock_irq(&Controller->queue_lock);
12851 - __wait_event(Controller->CommandWaitQueue,
12852 - !Controller->V1.DirectCommandActive
12853 - [DCDB.Channel][DCDB.TargetID]);
12854 - spin_lock_irq(&Controller->queue_lock);
12856 - Controller->V1.DirectCommandActive[DCDB.Channel]
12857 - [DCDB.TargetID] = true;
12858 - spin_unlock_irqrestore(&Controller->queue_lock, flags);
12859 - DAC960_V1_ClearCommand(Command);
12860 - Command->CommandType = DAC960_ImmediateCommand;
12861 - memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12862 - sizeof(DAC960_V1_CommandMailbox_T));
12863 - Command->V1.CommandMailbox.Type3.BusAddress = DCDB_IOBUFDMA;
12864 - DCDB.BusAddress = DataTransferBufferDMA;
12865 - memcpy(DCDB_IOBUF, &DCDB, sizeof(DAC960_V1_DCDB_T));
12869 - spin_lock_irqsave(&Controller->queue_lock, flags);
12870 - while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12871 - DAC960_WaitForCommand(Controller);
12872 - spin_unlock_irqrestore(&Controller->queue_lock, flags);
12873 - DAC960_V1_ClearCommand(Command);
12874 - Command->CommandType = DAC960_ImmediateCommand;
12875 - memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
12876 - sizeof(DAC960_V1_CommandMailbox_T));
12877 - if (DataTransferBuffer != NULL)
12878 - Command->V1.CommandMailbox.Type3.BusAddress =
12879 - DataTransferBufferDMA;
12881 - DAC960_ExecuteCommand(Command);
12882 - CommandStatus = Command->V1.CommandStatus;
12883 - spin_lock_irqsave(&Controller->queue_lock, flags);
12884 - DAC960_DeallocateCommand(Command);
12885 - spin_unlock_irqrestore(&Controller->queue_lock, flags);
12886 - if (DataTransferLength > 0)
12888 - if (copy_to_user(UserCommand.DataTransferBuffer,
12889 - DataTransferBuffer, DataTransferLength)) {
12890 - ErrorCode = -EFAULT;
12894 - if (CommandOpcode == DAC960_V1_DCDB)
12897 - I don't believe Target or Channel in the DCDB_IOBUF
12898 - should be any different from the contents of DCDB.
12900 - Controller->V1.DirectCommandActive[DCDB.Channel]
12901 - [DCDB.TargetID] = false;
12902 - if (copy_to_user(UserCommand.DCDB, DCDB_IOBUF,
12903 - sizeof(DAC960_V1_DCDB_T))) {
12904 - ErrorCode = -EFAULT;
12908 - ErrorCode = CommandStatus;
12910 - if (DataTransferBuffer != NULL)
12911 - pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
12912 - DataTransferBuffer, DataTransferBufferDMA);
12913 - if (DCDB_IOBUF != NULL)
12914 - pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T),
12915 - DCDB_IOBUF, DCDB_IOBUFDMA);
12917 - return ErrorCode;
12919 - case DAC960_IOCTL_V2_EXECUTE_COMMAND:
12921 - DAC960_V2_UserCommand_T *UserSpaceUserCommand =
12922 - (DAC960_V2_UserCommand_T *) Argument;
12923 - DAC960_V2_UserCommand_T UserCommand;
12924 - DAC960_Controller_T *Controller;
12925 - DAC960_Command_T *Command = NULL;
12926 - DAC960_V2_CommandMailbox_T *CommandMailbox;
12927 - DAC960_V2_CommandStatus_T CommandStatus;
12928 - unsigned long flags;
12929 - int ControllerNumber, DataTransferLength;
12930 - int DataTransferResidue, RequestSenseLength;
12931 - unsigned char *DataTransferBuffer = NULL;
12932 - dma_addr_t DataTransferBufferDMA;
12933 - unsigned char *RequestSenseBuffer = NULL;
12934 - dma_addr_t RequestSenseBufferDMA;
12935 - if (UserSpaceUserCommand == NULL) return -EINVAL;
12936 - if (copy_from_user(&UserCommand, UserSpaceUserCommand,
12937 - sizeof(DAC960_V2_UserCommand_T))) {
12938 - ErrorCode = -EFAULT;
12941 - ControllerNumber = UserCommand.ControllerNumber;
12942 - if (ControllerNumber < 0 ||
12943 - ControllerNumber > DAC960_ControllerCount - 1)
12945 - Controller = DAC960_Controllers[ControllerNumber];
12946 - if (Controller == NULL) return -ENXIO;
12947 - if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
12948 - DataTransferLength = UserCommand.DataTransferLength;
12949 - if (DataTransferLength > 0)
12951 - DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12952 - DataTransferLength, &DataTransferBufferDMA);
12953 - if (DataTransferBuffer == NULL) return -ENOMEM;
12954 - memset(DataTransferBuffer, 0, DataTransferLength);
12956 - else if (DataTransferLength < 0)
12958 - DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
12959 - -DataTransferLength, &DataTransferBufferDMA);
12960 - if (DataTransferBuffer == NULL) return -ENOMEM;
12961 - if (copy_from_user(DataTransferBuffer,
12962 - UserCommand.DataTransferBuffer,
12963 - -DataTransferLength)) {
12964 - ErrorCode = -EFAULT;
12968 - RequestSenseLength = UserCommand.RequestSenseLength;
12969 - if (RequestSenseLength > 0)
12971 - RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
12972 - RequestSenseLength, &RequestSenseBufferDMA);
12973 - if (RequestSenseBuffer == NULL)
12975 - ErrorCode = -ENOMEM;
12978 - memset(RequestSenseBuffer, 0, RequestSenseLength);
12980 - spin_lock_irqsave(&Controller->queue_lock, flags);
12981 - while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
12982 - DAC960_WaitForCommand(Controller);
12983 - spin_unlock_irqrestore(&Controller->queue_lock, flags);
12984 - DAC960_V2_ClearCommand(Command);
12985 - Command->CommandType = DAC960_ImmediateCommand;
12986 - CommandMailbox = &Command->V2.CommandMailbox;
12987 - memcpy(CommandMailbox, &UserCommand.CommandMailbox,
12988 - sizeof(DAC960_V2_CommandMailbox_T));
12989 - CommandMailbox->Common.CommandControlBits
12990 - .AdditionalScatterGatherListMemory = false;
12991 - CommandMailbox->Common.CommandControlBits
12992 - .NoAutoRequestSense = true;
12993 - CommandMailbox->Common.DataTransferSize = 0;
12994 - CommandMailbox->Common.DataTransferPageNumber = 0;
12995 - memset(&CommandMailbox->Common.DataTransferMemoryAddress, 0,
12996 - sizeof(DAC960_V2_DataTransferMemoryAddress_T));
12997 - if (DataTransferLength != 0)
12999 - if (DataTransferLength > 0)
13001 - CommandMailbox->Common.CommandControlBits
13002 - .DataTransferControllerToHost = true;
13003 - CommandMailbox->Common.DataTransferSize = DataTransferLength;
13007 - CommandMailbox->Common.CommandControlBits
13008 - .DataTransferControllerToHost = false;
13009 - CommandMailbox->Common.DataTransferSize = -DataTransferLength;
13011 - CommandMailbox->Common.DataTransferMemoryAddress
13012 - .ScatterGatherSegments[0]
13013 - .SegmentDataPointer = DataTransferBufferDMA;
13014 - CommandMailbox->Common.DataTransferMemoryAddress
13015 - .ScatterGatherSegments[0]
13016 - .SegmentByteCount =
13017 - CommandMailbox->Common.DataTransferSize;
13019 - if (RequestSenseLength > 0)
13021 - CommandMailbox->Common.CommandControlBits
13022 - .NoAutoRequestSense = false;
13023 - CommandMailbox->Common.RequestSenseSize = RequestSenseLength;
13024 - CommandMailbox->Common.RequestSenseBusAddress =
13025 - RequestSenseBufferDMA;
13027 - DAC960_ExecuteCommand(Command);
13028 - CommandStatus = Command->V2.CommandStatus;
13029 - RequestSenseLength = Command->V2.RequestSenseLength;
13030 - DataTransferResidue = Command->V2.DataTransferResidue;
13031 - spin_lock_irqsave(&Controller->queue_lock, flags);
13032 - DAC960_DeallocateCommand(Command);
13033 - spin_unlock_irqrestore(&Controller->queue_lock, flags);
13034 - if (RequestSenseLength > UserCommand.RequestSenseLength)
13035 - RequestSenseLength = UserCommand.RequestSenseLength;
13036 - if (copy_to_user(&UserSpaceUserCommand->DataTransferLength,
13037 - &DataTransferResidue,
13038 - sizeof(DataTransferResidue))) {
13039 - ErrorCode = -EFAULT;
13042 - if (copy_to_user(&UserSpaceUserCommand->RequestSenseLength,
13043 - &RequestSenseLength, sizeof(RequestSenseLength))) {
13044 - ErrorCode = -EFAULT;
13047 - if (DataTransferLength > 0)
13049 - if (copy_to_user(UserCommand.DataTransferBuffer,
13050 - DataTransferBuffer, DataTransferLength)) {
13051 - ErrorCode = -EFAULT;
13055 - if (RequestSenseLength > 0)
13057 - if (copy_to_user(UserCommand.RequestSenseBuffer,
13058 - RequestSenseBuffer, RequestSenseLength)) {
13059 - ErrorCode = -EFAULT;
13063 - ErrorCode = CommandStatus;
13065 - pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
13066 - DataTransferBuffer, DataTransferBufferDMA);
13067 - if (RequestSenseBuffer != NULL)
13068 - pci_free_consistent(Controller->PCIDevice, RequestSenseLength,
13069 - RequestSenseBuffer, RequestSenseBufferDMA);
13071 - return ErrorCode;
13073 - case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
13075 - DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
13076 - (DAC960_V2_GetHealthStatus_T *) Argument;
13077 - DAC960_V2_GetHealthStatus_T GetHealthStatus;
13078 - DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
13079 - DAC960_Controller_T *Controller;
13080 - int ControllerNumber;
13081 - if (UserSpaceGetHealthStatus == NULL) return -EINVAL;
13082 - if (copy_from_user(&GetHealthStatus, UserSpaceGetHealthStatus,
13083 - sizeof(DAC960_V2_GetHealthStatus_T)))
13085 - ControllerNumber = GetHealthStatus.ControllerNumber;
13086 - if (ControllerNumber < 0 ||
13087 - ControllerNumber > DAC960_ControllerCount - 1)
13089 - Controller = DAC960_Controllers[ControllerNumber];
13090 - if (Controller == NULL) return -ENXIO;
13091 - if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
13092 - if (copy_from_user(&HealthStatusBuffer,
13093 - GetHealthStatus.HealthStatusBuffer,
13094 - sizeof(DAC960_V2_HealthStatusBuffer_T)))
13096 - while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
13097 - == HealthStatusBuffer.StatusChangeCounter &&
13098 - Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
13099 - == HealthStatusBuffer.NextEventSequenceNumber)
13101 - interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
13102 - DAC960_MonitoringTimerInterval);
13103 - if (signal_pending(current)) return -EINTR;
13105 - if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
13106 - Controller->V2.HealthStatusBuffer,
13107 - sizeof(DAC960_V2_HealthStatusBuffer_T)))
13117 DAC960_CheckStatusBuffer verifies that there is room to hold ByteCount
13118 additional bytes in the Combined Status Buffer and grows the buffer if
13119 necessary. It returns true if there is enough room and false otherwise.
13120 @@ -6901,6 +6496,436 @@
13121 Controller->ControllerProcEntry = NULL;
13124 +#ifdef DAC960_GAM_MINOR
13127 + * DAC960_gam_ioctl is the ioctl function for performing RAID operations.
13130 +static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
13131 + unsigned int Request, unsigned long Argument)
13133 + int ErrorCode = 0;
13134 + if (!capable(CAP_SYS_ADMIN)) return -EACCES;
13137 + case DAC960_IOCTL_GET_CONTROLLER_COUNT:
13138 + return DAC960_ControllerCount;
13139 + case DAC960_IOCTL_GET_CONTROLLER_INFO:
13141 + DAC960_ControllerInfo_T *UserSpaceControllerInfo =
13142 + (DAC960_ControllerInfo_T *) Argument;
13143 + DAC960_ControllerInfo_T ControllerInfo;
13144 + DAC960_Controller_T *Controller;
13145 + int ControllerNumber;
13146 + if (UserSpaceControllerInfo == NULL) return -EINVAL;
13147 + ErrorCode = get_user(ControllerNumber,
13148 + &UserSpaceControllerInfo->ControllerNumber);
13149 + if (ErrorCode != 0) return ErrorCode;
13150 + if (ControllerNumber < 0 ||
13151 + ControllerNumber > DAC960_ControllerCount - 1)
13153 + Controller = DAC960_Controllers[ControllerNumber];
13154 + if (Controller == NULL) return -ENXIO;
13155 + memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T));
13156 + ControllerInfo.ControllerNumber = ControllerNumber;
13157 + ControllerInfo.FirmwareType = Controller->FirmwareType;
13158 + ControllerInfo.Channels = Controller->Channels;
13159 + ControllerInfo.Targets = Controller->Targets;
13160 + ControllerInfo.PCI_Bus = Controller->Bus;
13161 + ControllerInfo.PCI_Device = Controller->Device;
13162 + ControllerInfo.PCI_Function = Controller->Function;
13163 + ControllerInfo.IRQ_Channel = Controller->IRQ_Channel;
13164 + ControllerInfo.PCI_Address = Controller->PCI_Address;
13165 + strcpy(ControllerInfo.ModelName, Controller->ModelName);
13166 + strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion);
13167 + return (copy_to_user(UserSpaceControllerInfo, &ControllerInfo,
13168 + sizeof(DAC960_ControllerInfo_T)) ? -EFAULT : 0);
13170 + case DAC960_IOCTL_V1_EXECUTE_COMMAND:
13172 + DAC960_V1_UserCommand_T *UserSpaceUserCommand =
13173 + (DAC960_V1_UserCommand_T *) Argument;
13174 + DAC960_V1_UserCommand_T UserCommand;
13175 + DAC960_Controller_T *Controller;
13176 + DAC960_Command_T *Command = NULL;
13177 + DAC960_V1_CommandOpcode_T CommandOpcode;
13178 + DAC960_V1_CommandStatus_T CommandStatus;
13179 + DAC960_V1_DCDB_T DCDB;
13180 + DAC960_V1_DCDB_T *DCDB_IOBUF = NULL;
13181 + dma_addr_t DCDB_IOBUFDMA;
13182 + unsigned long flags;
13183 + int ControllerNumber, DataTransferLength;
13184 + unsigned char *DataTransferBuffer = NULL;
13185 + dma_addr_t DataTransferBufferDMA;
13186 + if (UserSpaceUserCommand == NULL) return -EINVAL;
13187 + if (copy_from_user(&UserCommand, UserSpaceUserCommand,
13188 + sizeof(DAC960_V1_UserCommand_T))) {
13189 + ErrorCode = -EFAULT;
13192 + ControllerNumber = UserCommand.ControllerNumber;
13193 + if (ControllerNumber < 0 ||
13194 + ControllerNumber > DAC960_ControllerCount - 1)
13196 + Controller = DAC960_Controllers[ControllerNumber];
13197 + if (Controller == NULL) return -ENXIO;
13198 + if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL;
13199 + CommandOpcode = UserCommand.CommandMailbox.Common.CommandOpcode;
13200 + DataTransferLength = UserCommand.DataTransferLength;
13201 + if (CommandOpcode & 0x80) return -EINVAL;
13202 + if (CommandOpcode == DAC960_V1_DCDB)
13204 + if (copy_from_user(&DCDB, UserCommand.DCDB,
13205 + sizeof(DAC960_V1_DCDB_T))) {
13206 + ErrorCode = -EFAULT;
13209 + if (DCDB.Channel >= DAC960_V1_MaxChannels) return -EINVAL;
13210 + if (!((DataTransferLength == 0 &&
13212 + == DAC960_V1_DCDB_NoDataTransfer) ||
13213 + (DataTransferLength > 0 &&
13215 + == DAC960_V1_DCDB_DataTransferDeviceToSystem) ||
13216 + (DataTransferLength < 0 &&
13218 + == DAC960_V1_DCDB_DataTransferSystemToDevice)))
13220 + if (((DCDB.TransferLengthHigh4 << 16) | DCDB.TransferLength)
13221 + != abs(DataTransferLength))
13223 + DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice,
13224 + sizeof(DAC960_V1_DCDB_T), &DCDB_IOBUFDMA);
13225 + if (DCDB_IOBUF == NULL)
13228 + if (DataTransferLength > 0)
13230 + DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
13231 + DataTransferLength, &DataTransferBufferDMA);
13232 + if (DataTransferBuffer == NULL) {
13233 + ErrorCode = -ENOMEM;
13236 + memset(DataTransferBuffer, 0, DataTransferLength);
13238 + else if (DataTransferLength < 0)
13240 + DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
13241 + -DataTransferLength, &DataTransferBufferDMA);
13242 + if (DataTransferBuffer == NULL) {
13243 + ErrorCode = -ENOMEM;
13246 + if (copy_from_user(DataTransferBuffer,
13247 + UserCommand.DataTransferBuffer,
13248 + -DataTransferLength)) {
13249 + ErrorCode = -EFAULT;
13253 + if (CommandOpcode == DAC960_V1_DCDB)
13255 + spin_lock_irqsave(&Controller->queue_lock, flags);
13256 + while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
13257 + DAC960_WaitForCommand(Controller);
13258 + while (Controller->V1.DirectCommandActive[DCDB.Channel]
13261 + spin_unlock_irq(&Controller->queue_lock);
13262 + __wait_event(Controller->CommandWaitQueue,
13263 + !Controller->V1.DirectCommandActive
13264 + [DCDB.Channel][DCDB.TargetID]);
13265 + spin_lock_irq(&Controller->queue_lock);
13267 + Controller->V1.DirectCommandActive[DCDB.Channel]
13268 + [DCDB.TargetID] = true;
13269 + spin_unlock_irqrestore(&Controller->queue_lock, flags);
13270 + DAC960_V1_ClearCommand(Command);
13271 + Command->CommandType = DAC960_ImmediateCommand;
13272 + memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
13273 + sizeof(DAC960_V1_CommandMailbox_T));
13274 + Command->V1.CommandMailbox.Type3.BusAddress = DCDB_IOBUFDMA;
13275 + DCDB.BusAddress = DataTransferBufferDMA;
13276 + memcpy(DCDB_IOBUF, &DCDB, sizeof(DAC960_V1_DCDB_T));
13280 + spin_lock_irqsave(&Controller->queue_lock, flags);
13281 + while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
13282 + DAC960_WaitForCommand(Controller);
13283 + spin_unlock_irqrestore(&Controller->queue_lock, flags);
13284 + DAC960_V1_ClearCommand(Command);
13285 + Command->CommandType = DAC960_ImmediateCommand;
13286 + memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
13287 + sizeof(DAC960_V1_CommandMailbox_T));
13288 + if (DataTransferBuffer != NULL)
13289 + Command->V1.CommandMailbox.Type3.BusAddress =
13290 + DataTransferBufferDMA;
13292 + DAC960_ExecuteCommand(Command);
13293 + CommandStatus = Command->V1.CommandStatus;
13294 + spin_lock_irqsave(&Controller->queue_lock, flags);
13295 + DAC960_DeallocateCommand(Command);
13296 + spin_unlock_irqrestore(&Controller->queue_lock, flags);
13297 + if (DataTransferLength > 0)
13299 + if (copy_to_user(UserCommand.DataTransferBuffer,
13300 + DataTransferBuffer, DataTransferLength)) {
13301 + ErrorCode = -EFAULT;
13305 + if (CommandOpcode == DAC960_V1_DCDB)
13308 + I don't believe Target or Channel in the DCDB_IOBUF
13309 + should be any different from the contents of DCDB.
13311 + Controller->V1.DirectCommandActive[DCDB.Channel]
13312 + [DCDB.TargetID] = false;
13313 + if (copy_to_user(UserCommand.DCDB, DCDB_IOBUF,
13314 + sizeof(DAC960_V1_DCDB_T))) {
13315 + ErrorCode = -EFAULT;
13319 + ErrorCode = CommandStatus;
13321 + if (DataTransferBuffer != NULL)
13322 + pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
13323 + DataTransferBuffer, DataTransferBufferDMA);
13324 + if (DCDB_IOBUF != NULL)
13325 + pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T),
13326 + DCDB_IOBUF, DCDB_IOBUFDMA);
13328 + return ErrorCode;
13330 + case DAC960_IOCTL_V2_EXECUTE_COMMAND:
13332 + DAC960_V2_UserCommand_T *UserSpaceUserCommand =
13333 + (DAC960_V2_UserCommand_T *) Argument;
13334 + DAC960_V2_UserCommand_T UserCommand;
13335 + DAC960_Controller_T *Controller;
13336 + DAC960_Command_T *Command = NULL;
13337 + DAC960_V2_CommandMailbox_T *CommandMailbox;
13338 + DAC960_V2_CommandStatus_T CommandStatus;
13339 + unsigned long flags;
13340 + int ControllerNumber, DataTransferLength;
13341 + int DataTransferResidue, RequestSenseLength;
13342 + unsigned char *DataTransferBuffer = NULL;
13343 + dma_addr_t DataTransferBufferDMA;
13344 + unsigned char *RequestSenseBuffer = NULL;
13345 + dma_addr_t RequestSenseBufferDMA;
13346 + if (UserSpaceUserCommand == NULL) return -EINVAL;
13347 + if (copy_from_user(&UserCommand, UserSpaceUserCommand,
13348 + sizeof(DAC960_V2_UserCommand_T))) {
13349 + ErrorCode = -EFAULT;
13352 + ControllerNumber = UserCommand.ControllerNumber;
13353 + if (ControllerNumber < 0 ||
13354 + ControllerNumber > DAC960_ControllerCount - 1)
13356 + Controller = DAC960_Controllers[ControllerNumber];
13357 + if (Controller == NULL) return -ENXIO;
13358 + if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
13359 + DataTransferLength = UserCommand.DataTransferLength;
13360 + if (DataTransferLength > 0)
13362 + DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
13363 + DataTransferLength, &DataTransferBufferDMA);
13364 + if (DataTransferBuffer == NULL) return -ENOMEM;
13365 + memset(DataTransferBuffer, 0, DataTransferLength);
13367 + else if (DataTransferLength < 0)
13369 + DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
13370 + -DataTransferLength, &DataTransferBufferDMA);
13371 + if (DataTransferBuffer == NULL) return -ENOMEM;
13372 + if (copy_from_user(DataTransferBuffer,
13373 + UserCommand.DataTransferBuffer,
13374 + -DataTransferLength)) {
13375 + ErrorCode = -EFAULT;
13379 + RequestSenseLength = UserCommand.RequestSenseLength;
13380 + if (RequestSenseLength > 0)
13382 + RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
13383 + RequestSenseLength, &RequestSenseBufferDMA);
13384 + if (RequestSenseBuffer == NULL)
13386 + ErrorCode = -ENOMEM;
13389 + memset(RequestSenseBuffer, 0, RequestSenseLength);
13391 + spin_lock_irqsave(&Controller->queue_lock, flags);
13392 + while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
13393 + DAC960_WaitForCommand(Controller);
13394 + spin_unlock_irqrestore(&Controller->queue_lock, flags);
13395 + DAC960_V2_ClearCommand(Command);
13396 + Command->CommandType = DAC960_ImmediateCommand;
13397 + CommandMailbox = &Command->V2.CommandMailbox;
13398 + memcpy(CommandMailbox, &UserCommand.CommandMailbox,
13399 + sizeof(DAC960_V2_CommandMailbox_T));
13400 + CommandMailbox->Common.CommandControlBits
13401 + .AdditionalScatterGatherListMemory = false;
13402 + CommandMailbox->Common.CommandControlBits
13403 + .NoAutoRequestSense = true;
13404 + CommandMailbox->Common.DataTransferSize = 0;
13405 + CommandMailbox->Common.DataTransferPageNumber = 0;
13406 + memset(&CommandMailbox->Common.DataTransferMemoryAddress, 0,
13407 + sizeof(DAC960_V2_DataTransferMemoryAddress_T));
13408 + if (DataTransferLength != 0)
13410 + if (DataTransferLength > 0)
13412 + CommandMailbox->Common.CommandControlBits
13413 + .DataTransferControllerToHost = true;
13414 + CommandMailbox->Common.DataTransferSize = DataTransferLength;
13418 + CommandMailbox->Common.CommandControlBits
13419 + .DataTransferControllerToHost = false;
13420 + CommandMailbox->Common.DataTransferSize = -DataTransferLength;
13422 + CommandMailbox->Common.DataTransferMemoryAddress
13423 + .ScatterGatherSegments[0]
13424 + .SegmentDataPointer = DataTransferBufferDMA;
13425 + CommandMailbox->Common.DataTransferMemoryAddress
13426 + .ScatterGatherSegments[0]
13427 + .SegmentByteCount =
13428 + CommandMailbox->Common.DataTransferSize;
13430 + if (RequestSenseLength > 0)
13432 + CommandMailbox->Common.CommandControlBits
13433 + .NoAutoRequestSense = false;
13434 + CommandMailbox->Common.RequestSenseSize = RequestSenseLength;
13435 + CommandMailbox->Common.RequestSenseBusAddress =
13436 + RequestSenseBufferDMA;
13438 + DAC960_ExecuteCommand(Command);
13439 + CommandStatus = Command->V2.CommandStatus;
13440 + RequestSenseLength = Command->V2.RequestSenseLength;
13441 + DataTransferResidue = Command->V2.DataTransferResidue;
13442 + spin_lock_irqsave(&Controller->queue_lock, flags);
13443 + DAC960_DeallocateCommand(Command);
13444 + spin_unlock_irqrestore(&Controller->queue_lock, flags);
13445 + if (RequestSenseLength > UserCommand.RequestSenseLength)
13446 + RequestSenseLength = UserCommand.RequestSenseLength;
13447 + if (copy_to_user(&UserSpaceUserCommand->DataTransferLength,
13448 + &DataTransferResidue,
13449 + sizeof(DataTransferResidue))) {
13450 + ErrorCode = -EFAULT;
13453 + if (copy_to_user(&UserSpaceUserCommand->RequestSenseLength,
13454 + &RequestSenseLength, sizeof(RequestSenseLength))) {
13455 + ErrorCode = -EFAULT;
13458 + if (DataTransferLength > 0)
13460 + if (copy_to_user(UserCommand.DataTransferBuffer,
13461 + DataTransferBuffer, DataTransferLength)) {
13462 + ErrorCode = -EFAULT;
13466 + if (RequestSenseLength > 0)
13468 + if (copy_to_user(UserCommand.RequestSenseBuffer,
13469 + RequestSenseBuffer, RequestSenseLength)) {
13470 + ErrorCode = -EFAULT;
13474 + ErrorCode = CommandStatus;
13476 + pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
13477 + DataTransferBuffer, DataTransferBufferDMA);
13478 + if (RequestSenseBuffer != NULL)
13479 + pci_free_consistent(Controller->PCIDevice, RequestSenseLength,
13480 + RequestSenseBuffer, RequestSenseBufferDMA);
13482 + return ErrorCode;
13484 + case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
13486 + DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
13487 + (DAC960_V2_GetHealthStatus_T *) Argument;
13488 + DAC960_V2_GetHealthStatus_T GetHealthStatus;
13489 + DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
13490 + DAC960_Controller_T *Controller;
13491 + int ControllerNumber;
13492 + if (UserSpaceGetHealthStatus == NULL) return -EINVAL;
13493 + if (copy_from_user(&GetHealthStatus, UserSpaceGetHealthStatus,
13494 + sizeof(DAC960_V2_GetHealthStatus_T)))
13496 + ControllerNumber = GetHealthStatus.ControllerNumber;
13497 + if (ControllerNumber < 0 ||
13498 + ControllerNumber > DAC960_ControllerCount - 1)
13500 + Controller = DAC960_Controllers[ControllerNumber];
13501 + if (Controller == NULL) return -ENXIO;
13502 + if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
13503 + if (copy_from_user(&HealthStatusBuffer,
13504 + GetHealthStatus.HealthStatusBuffer,
13505 + sizeof(DAC960_V2_HealthStatusBuffer_T)))
13507 + while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
13508 + == HealthStatusBuffer.StatusChangeCounter &&
13509 + Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
13510 + == HealthStatusBuffer.NextEventSequenceNumber)
13512 + interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
13513 + DAC960_MonitoringTimerInterval);
13514 + if (signal_pending(current)) return -EINTR;
13516 + if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
13517 + Controller->V2.HealthStatusBuffer,
13518 + sizeof(DAC960_V2_HealthStatusBuffer_T)))
13526 +static struct file_operations DAC960_gam_fops = {
13527 + .owner = THIS_MODULE,
13528 + .ioctl = DAC960_gam_ioctl
13531 +static struct miscdevice DAC960_gam_dev = {
13532 + DAC960_GAM_MINOR,
13537 +static int DAC960_gam_init(void)
13541 + ret = misc_register(&DAC960_gam_dev);
13543 + printk(KERN_ERR "DAC960_gam: can't misc_register on minor %d\n", DAC960_GAM_MINOR);
13547 +static void DAC960_gam_cleanup(void)
13549 + misc_deregister(&DAC960_gam_dev);
13552 +#endif /* DAC960_GAM_MINOR */
13554 static struct DAC960_privdata DAC960_BA_privdata = {
13555 .HardwareType = DAC960_BA_Controller,
13556 .FirmwareType = DAC960_V2_Controller,
13557 @@ -7000,12 +7025,23 @@
13559 static int DAC960_init_module(void)
13561 - return pci_module_init(&DAC960_pci_driver);
13564 + ret = pci_module_init(&DAC960_pci_driver);
13565 +#ifdef DAC960_GAM_MINOR
13567 + DAC960_gam_init();
13572 static void DAC960_cleanup_module(void)
13576 +#ifdef DAC960_GAM_MINOR
13577 + DAC960_gam_cleanup();
13580 for (i = 0; i < DAC960_ControllerCount; i++) {
13581 DAC960_Controller_T *Controller = DAC960_Controllers[i];
13582 diff -Nru a/drivers/block/DAC960.h b/drivers/block/DAC960.h
13583 --- a/drivers/block/DAC960.h Thu Aug 7 06:13:28 2003
13584 +++ b/drivers/block/DAC960.h Sun Aug 31 16:13:56 2003
13585 @@ -4138,8 +4138,6 @@
13586 static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
13587 static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
13588 static void DAC960_MonitoringTimerFunction(unsigned long);
13589 -static int DAC960_UserIOCTL(struct inode *, struct file *,
13590 - unsigned int, unsigned long);
13591 static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
13592 DAC960_Controller_T *, ...);
13593 static void DAC960_CreateProcEntries(DAC960_Controller_T *);
13594 diff -Nru a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
13595 --- a/drivers/block/acsi_slm.c Sun Jun 8 04:05:16 2003
13596 +++ b/drivers/block/acsi_slm.c Tue Aug 26 09:25:40 2003
13597 @@ -374,7 +374,7 @@
13598 if (!(page = __get_free_page( GFP_KERNEL )))
13601 - length = slm_getstats( (char *)page, MINOR(node->i_rdev) );
13602 + length = slm_getstats( (char *)page, iminor(node) );
13606 @@ -622,7 +622,7 @@
13609 struct inode *node = file->f_dentry->d_inode;
13610 - int device = MINOR( node->i_rdev );
13611 + int device = iminor(node);
13612 int n, filled, w, h;
13614 while( SLMState == PRINTING ||
13615 @@ -694,7 +694,7 @@
13616 static int slm_ioctl( struct inode *inode, struct file *file,
13617 unsigned int cmd, unsigned long arg )
13619 -{ int device = MINOR( inode->i_rdev ), err;
13620 +{ int device = iminor(inode), err;
13622 /* I can think of setting:
13624 @@ -768,7 +768,7 @@
13628 - device = MINOR(inode->i_rdev);
13629 + device = iminor(inode);
13630 if (device >= N_SLM_Printers)
13632 sip = &slm_info[device];
13633 @@ -797,7 +797,7 @@
13637 - device = MINOR(inode->i_rdev);
13638 + device = iminor(inode);
13639 sip = &slm_info[device];
13641 if (file->f_mode & 2)
13642 diff -Nru a/drivers/block/amiflop.c b/drivers/block/amiflop.c
13643 --- a/drivers/block/amiflop.c Thu Aug 7 02:25:23 2003
13644 +++ b/drivers/block/amiflop.c Tue Jul 29 16:35:37 2003
13645 @@ -55,24 +55,15 @@
13647 #include <linux/module.h>
13649 -#include <linux/sched.h>
13650 -#include <linux/fs.h>
13651 -#include <linux/fcntl.h>
13652 -#include <linux/kernel.h>
13653 -#include <linux/timer.h>
13654 #include <linux/fd.h>
13655 #include <linux/hdreg.h>
13656 -#include <linux/errno.h>
13657 -#include <linux/types.h>
13658 #include <linux/delay.h>
13659 -#include <linux/string.h>
13660 -#include <linux/slab.h>
13661 #include <linux/init.h>
13662 #include <linux/amifdreg.h>
13663 #include <linux/amifd.h>
13664 -#include <linux/ioport.h>
13665 #include <linux/buffer_head.h>
13666 -#include <linux/interrupt.h>
13667 +#include <linux/blkdev.h>
13668 +#include <linux/elevator.h>
13670 #include <asm/setup.h>
13671 #include <asm/uaccess.h>
13672 @@ -1446,7 +1437,7 @@
13673 static int fd_ioctl(struct inode *inode, struct file *filp,
13674 unsigned int cmd, unsigned long param)
13676 - int drive = minor(inode->i_rdev) & 3;
13677 + int drive = iminor(inode) & 3;
13678 static struct floppy_struct getprm;
13681 @@ -1570,8 +1561,8 @@
13683 static int floppy_open(struct inode *inode, struct file *filp)
13685 - int drive = minor(inode->i_rdev) & 3;
13686 - int system = (minor(inode->i_rdev) & 4) >> 2;
13687 + int drive = iminor(inode) & 3;
13688 + int system = (iminor(inode) & 4) >> 2;
13690 unsigned long flags;
13692 @@ -1618,7 +1609,7 @@
13694 static int floppy_release(struct inode * inode, struct file * filp)
13696 - int drive = minor(inode->i_rdev) & 3;
13697 + int drive = iminor(inode) & 3;
13699 if (unit[drive].dirty == 1) {
13700 del_timer (flush_track_timer + drive);
13701 diff -Nru a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
13702 --- a/drivers/block/as-iosched.c Fri Aug 15 00:57:28 2003
13703 +++ b/drivers/block/as-iosched.c Sun Aug 31 16:14:29 2003
13704 @@ -709,6 +709,14 @@
13708 + if (aic->seek_samples == 0 || aic->ttime_samples == 0) {
13710 + * Process has just started IO so default to not anticipate.
13711 + * Maybe should be smarter.
13716 if (aic->ttime_mean > ad->antic_expire) {
13717 /* the process thinks too much between requests */
13719 diff -Nru a/drivers/block/ataflop.c b/drivers/block/ataflop.c
13720 --- a/drivers/block/ataflop.c Thu Aug 7 02:25:23 2003
13721 +++ b/drivers/block/ataflop.c Wed Jul 30 15:49:57 2003
13722 @@ -63,35 +63,16 @@
13724 #include <linux/module.h>
13726 -#include <linux/sched.h>
13727 -#include <linux/string.h>
13728 -#include <linux/fs.h>
13729 -#include <linux/fcntl.h>
13730 -#include <linux/kernel.h>
13731 -#include <linux/timer.h>
13732 #include <linux/fd.h>
13733 -#include <linux/errno.h>
13734 -#include <linux/types.h>
13735 #include <linux/delay.h>
13736 -#include <linux/mm.h>
13737 -#include <linux/slab.h>
13738 #include <linux/init.h>
13739 -#include <linux/buffer_head.h> /* for invalidate_buffers() */
13741 -#include <asm/setup.h>
13742 -#include <asm/system.h>
13743 -#include <asm/bitops.h>
13744 -#include <asm/irq.h>
13745 -#include <asm/pgtable.h>
13746 -#include <asm/uaccess.h>
13747 +#include <linux/blkdev.h>
13749 #include <asm/atafd.h>
13750 #include <asm/atafdreg.h>
13751 -#include <asm/atarihw.h>
13752 #include <asm/atariints.h>
13753 #include <asm/atari_stdma.h>
13754 #include <asm/atari_stram.h>
13755 -#include <linux/blkpg.h>
13757 #define FD_MAX_UNITS 2
13759 @@ -1838,7 +1819,7 @@
13760 static int floppy_open( struct inode *inode, struct file *filp )
13762 struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data;
13763 - int type = minor(inode->i_rdev) >> 2;
13764 + int type = iminor(inode) >> 2;
13766 DPRINT(("fd_open: type=%d\n",type));
13767 if (p->ref && p->type != type)
13768 diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
13769 --- a/drivers/block/cciss.c Thu Aug 7 06:13:28 2003
13770 +++ b/drivers/block/cciss.c Tue Aug 26 09:25:41 2003
13771 @@ -356,11 +356,11 @@
13773 static int cciss_open(struct inode *inode, struct file *filep)
13775 - int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13776 - int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13777 + int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13778 + int dsk = iminor(inode) >> NWD_SHIFT;
13781 - printk(KERN_DEBUG "cciss_open %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
13782 + printk(KERN_DEBUG "cciss_open %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
13783 #endif /* CCISS_DEBUG */
13785 if (ctlr >= MAX_CTLR || hba[ctlr] == NULL)
13786 @@ -372,7 +372,7 @@
13787 * for "raw controller".
13789 if (hba[ctlr]->drv[dsk].nr_blocks == 0) {
13790 - if (minor(inode->i_rdev) != 0)
13791 + if (iminor(inode) != 0)
13793 if (!capable(CAP_SYS_ADMIN))
13795 @@ -386,11 +386,11 @@
13797 static int cciss_release(struct inode *inode, struct file *filep)
13799 - int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13800 - int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13801 + int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13802 + int dsk = iminor(inode) >> NWD_SHIFT;
13805 - printk(KERN_DEBUG "cciss_release %x (%x:%x)\n", inode->i_rdev, ctlr, dsk);
13806 + printk(KERN_DEBUG "cciss_release %s (%x:%x)\n", inode->i_bdev->bd_disk->disk_name, ctlr, dsk);
13807 #endif /* CCISS_DEBUG */
13809 /* fsync_dev(inode->i_rdev); */
13810 @@ -406,8 +406,8 @@
13811 static int cciss_ioctl(struct inode *inode, struct file *filep,
13812 unsigned int cmd, unsigned long arg)
13814 - int ctlr = major(inode->i_rdev) - COMPAQ_CISS_MAJOR;
13815 - int dsk = minor(inode->i_rdev) >> NWD_SHIFT;
13816 + int ctlr = imajor(inode) - COMPAQ_CISS_MAJOR;
13817 + int dsk = iminor(inode) >> NWD_SHIFT;
13820 printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg);
13821 @@ -2525,6 +2525,9 @@
13825 + hba[i]->queue = q;
13826 + q->queuedata = hba[i];
13828 /* Initialize the pdev driver private data.
13829 have it point to hba[i]. */
13830 pci_set_drvdata(pdev, hba[i]);
13831 @@ -2545,7 +2548,6 @@
13835 - q->queuedata = hba[i];
13836 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
13838 /* This is a hardware imposed limit. */
13839 diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
13840 --- a/drivers/block/cpqarray.c Thu Aug 7 02:25:24 2003
13841 +++ b/drivers/block/cpqarray.c Tue Aug 26 09:25:41 2003
13842 @@ -1078,7 +1078,7 @@
13843 put_user(host->ctlr_sig, (int*)arg);
13845 case IDAREVALIDATEVOLS:
13846 - if (minor(inode->i_rdev) != 0)
13847 + if (iminor(inode) != 0)
13849 return revalidate_allvol(host);
13850 case IDADRIVERVERSION:
13851 diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
13852 --- a/drivers/block/floppy.c Fri Aug 15 10:27:03 2003
13853 +++ b/drivers/block/floppy.c Sun Aug 31 16:14:41 2003
13854 @@ -695,23 +695,9 @@
13855 spin_unlock_irqrestore(&floppy_lock, flags);
13858 -static int maximum(int a, int b)
13865 -#define INFBOUND(a,b) (a)=maximum((a),(b));
13866 +#define INFBOUND(a,b) (a)=max_t(int, a, b)
13868 -static int minimum(int a, int b)
13875 -#define SUPBOUND(a,b) (a)=minimum((a),(b));
13876 +#define SUPBOUND(a,b) (a)=min_t(int, a, b)
13880 @@ -1021,9 +1007,9 @@
13882 static DECLARE_WORK(floppy_work, NULL, NULL);
13884 -static void schedule_bh( void (*handler)(void*) )
13885 +static void schedule_bh(void (*handler) (void))
13887 - PREPARE_WORK(&floppy_work, handler, NULL);
13888 + PREPARE_WORK(&floppy_work, (void (*)(void *))handler, NULL);
13889 schedule_work(&floppy_work);
13892 @@ -1035,7 +1021,7 @@
13894 spin_lock_irqsave(&floppy_lock, flags);
13896 - PREPARE_WORK(&floppy_work, (void*)(void*)empty, NULL);
13897 + PREPARE_WORK(&floppy_work, (void*)empty, NULL);
13898 del_timer(&fd_timer);
13899 spin_unlock_irqrestore(&floppy_lock, flags);
13901 @@ -1813,9 +1799,9 @@
13903 } while ((ST0 & 0x83) != UNIT(current_drive) && inr == 2 && max_sensei);
13906 - schedule_bh( (void *)(void *) handler);
13909 + schedule_bh(handler);
13912 is_alive("normal interrupt end");
13914 @@ -2058,26 +2044,26 @@
13915 wake_up(&command_done);
13918 -static struct cont_t wakeup_cont={
13923 +static struct cont_t wakeup_cont = {
13924 + .interrupt = empty,
13925 + .redo = do_wakeup,
13927 + .done = (done_f) empty
13931 -static struct cont_t intr_cont={
13933 - process_fd_request,
13936 +static struct cont_t intr_cont = {
13937 + .interrupt = empty,
13938 + .redo = process_fd_request,
13940 + .done = (done_f) empty
13943 static int wait_til_done(void (*handler)(void), int interruptible)
13947 - schedule_bh((void *)(void *)handler);
13948 + schedule_bh(handler);
13950 if (command_status < 2 && NO_SIGNAL) {
13951 DECLARE_WAITQUEUE(wait, current);
13952 @@ -2281,11 +2267,12 @@
13956 -static struct cont_t format_cont={
13957 - format_interrupt,
13961 +static struct cont_t format_cont = {
13962 + .interrupt = format_interrupt,
13963 + .redo = redo_format,
13964 + .error = bad_flp_intr,
13965 + .done = generic_done
13968 static int do_format(int drive, struct format_descr *tmp_format_req)
13970 @@ -2523,12 +2510,12 @@
13973 max_sector = transfer_size(ssize,
13974 - minimum(max_sector, max_sector_2),
13975 + min(max_sector, max_sector_2),
13976 current_req->nr_sectors);
13978 if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
13979 buffer_max > fsector_t + current_req->nr_sectors)
13980 - current_count_sectors = minimum(buffer_max - fsector_t,
13981 + current_count_sectors = min_t(int, buffer_max - fsector_t,
13982 current_req->nr_sectors);
13984 remaining = current_count_sectors << 9;
13985 @@ -2546,7 +2533,7 @@
13989 - buffer_max = maximum(max_sector, buffer_max);
13990 + buffer_max = max(max_sector, buffer_max);
13992 dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9);
13994 @@ -2697,7 +2684,7 @@
13995 if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){
13996 max_sector = 2 * _floppy->sect / 3;
13997 if (fsector_t >= max_sector){
13998 - current_count_sectors = minimum(_floppy->sect - fsector_t,
13999 + current_count_sectors = min_t(int, _floppy->sect - fsector_t,
14000 current_req->nr_sectors);
14003 @@ -2987,7 +2974,7 @@
14005 if (TESTF(FD_NEED_TWADDLE))
14007 - schedule_bh( (void *)(void *) floppy_start);
14008 + schedule_bh(floppy_start);
14010 debugt("queue fd request");
14012 @@ -2996,16 +2983,17 @@
14016 -static struct cont_t rw_cont={
14021 +static struct cont_t rw_cont = {
14022 + .interrupt = rw_interrupt,
14023 + .redo = redo_fd_request,
14024 + .error = bad_flp_intr,
14025 + .done = request_done
14028 static void process_fd_request(void)
14031 - schedule_bh( (void *)(void *) redo_fd_request);
14032 + schedule_bh(redo_fd_request);
14035 static void do_fd_request(request_queue_t * q)
14036 @@ -3031,11 +3019,12 @@
14037 is_alive("do fd request");
14040 -static struct cont_t poll_cont={
14041 - success_and_wakeup,
14045 +static struct cont_t poll_cont = {
14046 + .interrupt = success_and_wakeup,
14047 + .redo = floppy_ready,
14048 + .error = generic_failure,
14049 + .done = generic_done
14052 static int poll_drive(int interruptible, int flag)
14054 @@ -3066,11 +3055,12 @@
14055 printk("weird, reset interrupt called\n");
14058 -static struct cont_t reset_cont={
14060 - success_and_wakeup,
14063 +static struct cont_t reset_cont = {
14064 + .interrupt = reset_intr,
14065 + .redo = success_and_wakeup,
14066 + .error = generic_failure,
14067 + .done = generic_done
14070 static int user_reset_fdc(int drive, int arg, int interruptible)
14072 @@ -3174,11 +3164,11 @@
14076 -static struct cont_t raw_cmd_cont={
14077 - success_and_wakeup,
14081 +static struct cont_t raw_cmd_cont = {
14082 + .interrupt = success_and_wakeup,
14083 + .redo = floppy_start,
14084 + .error = generic_failure,
14085 + .done = raw_cmd_done
14088 static inline int raw_cmd_copyout(int cmd, char *param,
14089 @@ -3781,9 +3771,9 @@
14093 - UDRS->fd_device = minor(inode->i_rdev);
14094 - set_capacity(disks[drive], floppy_sizes[minor(inode->i_rdev)]);
14095 - if (old_dev != -1 && old_dev != minor(inode->i_rdev)) {
14096 + UDRS->fd_device = iminor(inode);
14097 + set_capacity(disks[drive], floppy_sizes[iminor(inode)]);
14098 + if (old_dev != -1 && old_dev != iminor(inode)) {
14099 if (buffer_drive == drive)
14102 @@ -3910,22 +3900,6 @@
14106 -static int floppy_read_block_0(struct gendisk *disk)
14108 - struct block_device *bdev;
14111 - bdev = bdget_disk(disk, 0);
14113 - printk("No block device for %s\n", disk->disk_name);
14116 - bdev->bd_disk = disk; /* ewww */
14117 - ret = __floppy_read_block_0(bdev);
14118 - atomic_dec(&bdev->bd_count);
14122 /* revalidate the floppy disk, i.e. trigger format autodetection by reading
14123 * the bootblock (block 0). "Autodetection" is also needed to check whether
14124 * there is a disk in the drive at all... Thus we also do it for fixed
14125 @@ -3961,7 +3935,7 @@
14126 UDRS->generation++;
14129 - res = floppy_read_block_0(disk);
14130 + res = __floppy_read_block_0(opened_bdev[drive]);
14133 poll_drive(0, FD_RAW_NEED_DISK);
14134 diff -Nru a/drivers/block/floppy98.c b/drivers/block/floppy98.c
14135 --- a/drivers/block/floppy98.c Thu Aug 7 02:25:24 2003
14136 +++ b/drivers/block/floppy98.c Tue Aug 26 09:44:42 2003
14137 @@ -3844,9 +3844,9 @@
14141 - UDRS->fd_device = minor(inode->i_rdev);
14142 - set_capacity(disks[drive], floppy_sizes[minor(inode->i_rdev)]);
14143 - if (old_dev != -1 && old_dev != minor(inode->i_rdev)) {
14144 + UDRS->fd_device = iminor(inode);
14145 + set_capacity(disks[drive], floppy_sizes[iminor(inode)]);
14146 + if (old_dev != -1 && old_dev != iminor(inode)) {
14147 if (buffer_drive == drive)
14150 @@ -3989,22 +3989,6 @@
14154 -static int floppy_read_block_0(struct gendisk *disk)
14156 - struct block_device *bdev;
14159 - bdev = bdget_disk(disk, 0);
14161 - printk("No block device for %s\n", disk->disk_name);
14164 - bdev->bd_disk = disk; /* ewww */
14165 - ret = __floppy_read_block_0(bdev);
14166 - atomic_dec(&bdev->bd_count);
14170 /* revalidate the floppy disk, i.e. trigger format autodetection by reading
14171 * the bootblock (block 0). "Autodetection" is also needed to check whether
14172 * there is a disk in the drive at all... Thus we also do it for fixed
14173 @@ -4040,7 +4024,7 @@
14174 UDRS->generation++;
14177 - res = floppy_read_block_0(disk);
14178 + res = __floppy_read_block_0(opened_bdev[drive]);
14181 poll_drive(0, FD_RAW_NEED_DISK);
14182 diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
14183 --- a/drivers/block/genhd.c Fri Aug 1 02:22:20 2003
14184 +++ b/drivers/block/genhd.c Tue Aug 26 12:06:15 2003
14185 @@ -576,13 +576,10 @@
14187 void set_device_ro(struct block_device *bdev, int flag)
14189 - struct gendisk *disk = bdev->bd_disk;
14190 - if (bdev->bd_contains != bdev) {
14191 - int part = bdev->bd_dev - MKDEV(disk->major, disk->first_minor);
14192 - struct hd_struct *p = disk->part[part-1];
14193 - if (p) p->policy = flag;
14195 - disk->policy = flag;
14196 + if (bdev->bd_contains != bdev)
14197 + bdev->bd_part->policy = flag;
14199 + bdev->bd_disk->policy = flag;
14202 void set_disk_ro(struct gendisk *disk, int flag)
14203 @@ -595,17 +592,12 @@
14205 int bdev_read_only(struct block_device *bdev)
14207 - struct gendisk *disk;
14210 - disk = bdev->bd_disk;
14211 - if (bdev->bd_contains != bdev) {
14212 - int part = bdev->bd_dev - MKDEV(disk->major, disk->first_minor);
14213 - struct hd_struct *p = disk->part[part-1];
14214 - if (p) return p->policy;
14217 - return disk->policy;
14218 + else if (bdev->bd_contains != bdev)
14219 + return bdev->bd_part->policy;
14221 + return bdev->bd_disk->policy;
14224 int invalidate_partition(struct gendisk *disk, int index)
14225 diff -Nru a/drivers/block/ioctl.c b/drivers/block/ioctl.c
14226 --- a/drivers/block/ioctl.c Thu Jul 17 22:30:42 2003
14227 +++ b/drivers/block/ioctl.c Tue Aug 26 12:06:15 2003
14229 static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg *arg)
14231 struct block_device *bdevp;
14233 struct gendisk *disk;
14234 struct blkpg_ioctl_arg a;
14235 struct blkpg_partition p;
14239 /* partition number in use? */
14240 - if (disk->part[part - 1])
14241 + down(&bdev->bd_sem);
14242 + if (disk->part[part - 1]) {
14243 + up(&bdev->bd_sem);
14247 for (i = 0; i < disk->minors - 1; i++) {
14248 struct hd_struct *s = disk->part[i];
14249 @@ -50,22 +52,26 @@
14252 if (!(start+length <= s->start_sect ||
14253 - start >= s->start_sect + s->nr_sects))
14254 + start >= s->start_sect + s->nr_sects)) {
14255 + up(&bdev->bd_sem);
14260 add_partition(disk, part, start, length);
14261 + up(&bdev->bd_sem);
14263 case BLKPG_DEL_PARTITION:
14264 if (!disk->part[part-1])
14266 if (disk->part[part - 1]->nr_sects == 0)
14268 - /* partition in use? Incomplete check for now. */
14269 bdevp = bdget_disk(disk, part);
14272 - if (bd_claim(bdevp, &holder) < 0) {
14273 + down(&bdevp->bd_sem);
14274 + if (bdevp->bd_openers) {
14275 + up(&bdevp->bd_sem);
14281 invalidate_bdev(bdevp, 0);
14283 + down(&bdev->bd_sem);
14284 delete_partition(disk, part);
14285 - bd_release(bdevp);
14286 + up(&bdev->bd_sem);
14287 + up(&bdevp->bd_sem);
14293 diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
14294 --- a/drivers/block/ll_rw_blk.c Mon Aug 18 22:28:54 2003
14295 +++ b/drivers/block/ll_rw_blk.c Mon Sep 1 04:55:34 2003
14296 @@ -136,6 +136,12 @@
14300 +void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
14302 + q->activity_fn = fn;
14303 + q->activity_data = data;
14307 * blk_queue_prep_rq - set a prepare_request function for queue
14309 @@ -225,6 +231,8 @@
14310 blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
14312 INIT_LIST_HEAD(&q->plug_list);
14314 + blk_queue_activity_fn(q, NULL, NULL);
14318 @@ -1314,7 +1322,7 @@
14322 - printk("Using %s elevator\n", chosen_elevator->elevator_name);
14323 + printk("Using %s io scheduler\n", chosen_elevator->elevator_name);
14326 if (elevator_init(q, chosen_elevator))
14327 @@ -1666,6 +1674,9 @@
14329 drive_stat_acct(req, req->nr_sectors, 1);
14331 + if (q->activity_fn)
14332 + q->activity_fn(q->activity_data, rq_data_dir(req));
14335 * elevator indicated where it wants this request to be
14336 * inserted at elevator_merge time
14337 @@ -2043,24 +2054,23 @@
14338 static inline void blk_partition_remap(struct bio *bio)
14340 struct block_device *bdev = bio->bi_bdev;
14341 - struct gendisk *disk = bdev->bd_disk;
14342 - struct hd_struct *p;
14343 - if (bdev == bdev->bd_contains)
14346 - p = disk->part[bdev->bd_dev-MKDEV(disk->major,disk->first_minor)-1];
14347 - switch (bio->bi_rw) {
14349 - p->read_sectors += bio_sectors(bio);
14353 - p->write_sectors += bio_sectors(bio);
14356 + if (bdev != bdev->bd_contains) {
14357 + struct hd_struct *p = bdev->bd_part;
14359 + switch (bio->bi_rw) {
14361 + p->read_sectors += bio_sectors(bio);
14365 + p->write_sectors += bio_sectors(bio);
14369 + bio->bi_sector += p->start_sect;
14370 + bio->bi_bdev = bdev->bd_contains;
14372 - bio->bi_sector += bdev->bd_offset;
14373 - bio->bi_bdev = bdev->bd_contains;
14377 diff -Nru a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
14378 --- a/drivers/block/paride/pg.c Sun May 25 02:45:05 2003
14379 +++ b/drivers/block/paride/pg.c Tue Aug 26 09:25:41 2003
14380 @@ -527,11 +527,9 @@
14384 -#define DEVICE_NR(dev) (minor(dev) & 0x7F)
14386 static int pg_open(struct inode *inode, struct file *file)
14388 - int unit = DEVICE_NR(inode->i_rdev);
14389 + int unit = iminor(inode) & 0x7f;
14390 struct pg *dev = &devices[unit];
14392 if ((unit >= PG_UNITS) || (!dev->present))
14393 diff -Nru a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
14394 --- a/drivers/block/paride/pt.c Sun May 25 02:45:06 2003
14395 +++ b/drivers/block/paride/pt.c Tue Aug 26 09:25:41 2003
14396 @@ -670,11 +670,11 @@
14400 -#define DEVICE_NR(dev) (minor(dev) & 0x7F)
14401 +#define DEVICE_NR(inode) (iminor(inode) & 0x7F)
14403 static int pt_open(struct inode *inode, struct file *file)
14405 - int unit = DEVICE_NR(inode->i_rdev);
14406 + int unit = DEVICE_NR(inode);
14408 if ((unit >= PT_UNITS) || (!PT.present))
14410 @@ -696,7 +696,7 @@
14414 - if (!(minor(inode->i_rdev) & 128))
14415 + if (!(iminor(inode) & 128))
14416 PT.flags |= PT_REWIND;
14418 PT.bufptr = kmalloc(PT_BUFSIZE, GFP_KERNEL);
14419 @@ -715,7 +715,7 @@
14423 - unit = DEVICE_NR(inode->i_rdev);
14424 + unit = DEVICE_NR(inode);
14425 if (unit >= PT_UNITS)
14428 @@ -753,7 +753,7 @@
14430 pt_release(struct inode *inode, struct file *file)
14432 - int unit = DEVICE_NR(inode->i_rdev);
14433 + int unit = DEVICE_NR(inode);
14435 if ((unit >= PT_UNITS) || (atomic_read(&PT.available) > 1))
14437 @@ -776,7 +776,7 @@
14438 static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
14440 struct inode *ino = filp->f_dentry->d_inode;
14441 - int unit = DEVICE_NR(ino->i_rdev);
14442 + int unit = DEVICE_NR(ino);
14443 char rd_cmd[12] = { ATAPI_READ_6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
14444 int k, n, r, p, s, t, b;
14446 @@ -873,7 +873,7 @@
14447 static ssize_t pt_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
14449 struct inode *ino = filp->f_dentry->d_inode;
14450 - int unit = DEVICE_NR(ino->i_rdev);
14451 + int unit = DEVICE_NR(ino);
14452 char wr_cmd[12] = { ATAPI_WRITE_6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
14453 int k, n, r, p, s, t, b;
14455 diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
14456 --- a/drivers/block/rd.c Thu Aug 7 02:25:24 2003
14457 +++ b/drivers/block/rd.c Tue Aug 26 10:05:56 2003
14458 @@ -245,6 +245,7 @@
14459 static int rd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
14462 + struct block_device *bdev = inode->i_bdev;
14464 if (cmd != BLKFLSBUF)
14466 @@ -253,12 +254,12 @@
14467 it's not like with the other blockdevices where
14468 this ioctl only flushes away the buffer cache. */
14470 - down(&inode->i_bdev->bd_sem);
14471 - if (inode->i_bdev->bd_openers <= 2) {
14472 - truncate_inode_pages(inode->i_mapping, 0);
14473 + down(&bdev->bd_sem);
14474 + if (bdev->bd_openers <= 2) {
14475 + truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
14478 - up(&inode->i_bdev->bd_sem);
14479 + up(&bdev->bd_sem);
14483 @@ -269,18 +270,18 @@
14485 static int rd_open(struct inode * inode, struct file * filp)
14487 - unsigned unit = minor(inode->i_rdev);
14488 + unsigned unit = iminor(inode);
14491 * Immunize device against invalidate_buffers() and prune_icache().
14493 if (rd_bdev[unit] == NULL) {
14494 struct block_device *bdev = inode->i_bdev;
14495 - atomic_inc(&bdev->bd_count);
14496 + inode = igrab(bdev->bd_inode);
14497 rd_bdev[unit] = bdev;
14498 bdev->bd_openers++;
14499 bdev->bd_block_size = rd_blocksize;
14500 - bdev->bd_inode->i_size = get_capacity(rd_disks[unit])<<9;
14501 + inode->i_size = get_capacity(rd_disks[unit])<<9;
14502 inode->i_mapping->a_ops = &ramdisk_aops;
14503 inode->i_mapping->backing_dev_info = &rd_backing_dev_info;
14505 diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
14506 --- a/drivers/block/scsi_ioctl.c Thu Aug 7 11:22:15 2003
14507 +++ b/drivers/block/scsi_ioctl.c Mon Sep 1 12:24:06 2003
14508 @@ -438,11 +438,7 @@
14509 err = sg_emulated_host(q, (int *) arg);
14512 - err = bd_claim(bdev, current);
14515 err = sg_io(q, bdev, (struct sg_io_hdr *) arg);
14516 - bd_release(bdev);
14519 * old junk scsi send command ioctl
14520 @@ -452,11 +448,7 @@
14524 - err = bd_claim(bdev, current);
14527 err = sg_scsi_ioctl(q, bdev, (Scsi_Ioctl_Command *)arg);
14528 - bd_release(bdev);
14530 case CDROMCLOSETRAY:
14532 diff -Nru a/drivers/block/z2ram.c b/drivers/block/z2ram.c
14533 --- a/drivers/block/z2ram.c Thu Aug 7 02:25:24 2003
14534 +++ b/drivers/block/z2ram.c Wed Jul 30 15:20:18 2003
14535 @@ -28,10 +28,10 @@
14536 #define DEVICE_NAME "Z2RAM"
14538 #include <linux/major.h>
14539 -#include <linux/slab.h>
14540 #include <linux/vmalloc.h>
14541 #include <linux/init.h>
14542 #include <linux/module.h>
14543 +#include <linux/blkdev.h>
14545 #include <asm/setup.h>
14546 #include <asm/bitops.h>
14547 @@ -150,7 +150,7 @@
14548 sizeof( z2ram_map[0] );
14551 - device = minor( inode->i_rdev );
14552 + device = iminor(inode);
14554 if ( current_device != -1 && current_device != device )
14556 diff -Nru a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
14557 --- a/drivers/char/agp/Kconfig Fri Aug 15 07:33:19 2003
14558 +++ b/drivers/char/agp/Kconfig Thu Aug 28 16:22:00 2003
14559 @@ -63,15 +63,19 @@
14560 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
14561 use GLX or DRI. If unsure, say N.
14563 +# RED-PEN this option is misnamed, it's not 8151 specific
14564 config AGP_AMD_8151
14565 - tristate "AMD Opteron/Athlon64 on-CPU GART support"
14566 + tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
14567 depends on AGP && X86
14568 - default GART_IOMMU
14569 + default y if GART_IOMMU
14571 This option gives you AGP support for the GLX component of
14572 - XFree86 4.x using the on-CPU AGP bridge of the AMD Athlon64/Opteron CPUs.
14573 + XFree86 4.x using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
14574 + You still need an external AGP bridge like the AMD 8151, VIA
14575 + K8T400M, SiS755. It may also support other AGP bridges when loaded
14576 + with agp_try_unsupported=1.
14577 You should say Y here if you use XFree86 3.3.6 or 4.x and want to
14578 - use GLX or DRI. If unsure, say N
14579 + use GLX or DRI. If unsure, say Y
14582 tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support"
14583 diff -Nru a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
14584 --- a/drivers/char/agp/agp.h Fri Aug 15 06:28:58 2003
14585 +++ b/drivers/char/agp/agp.h Thu Aug 28 18:04:31 2003
14586 @@ -167,8 +167,10 @@
14588 #define PGE_EMPTY(b, p) (!(p) || (p) == (unsigned long) (b)->scratch_page)
14590 -/* intel register */
14591 -#define INTEL_APBASE 0x10
14592 +/* Chipset independant registers (from AGP Spec) */
14593 +#define AGP_APBASE 0x10
14595 +/* Intel registers */
14596 #define INTEL_APSIZE 0xb4
14597 #define INTEL_ATTBASE 0xb8
14598 #define INTEL_AGPCTRL 0xb0
14599 @@ -176,7 +178,6 @@
14600 #define INTEL_ERRSTS 0x91
14602 /* Intel 460GX Registers */
14603 -#define INTEL_I460_APBASE 0x10
14604 #define INTEL_I460_BAPBASE 0x98
14605 #define INTEL_I460_GXBCTL 0xa0
14606 #define INTEL_I460_AGPSIZ 0xa2
14607 @@ -184,7 +185,7 @@
14608 #define INTEL_I460_GATT_VALID (1UL << 24)
14609 #define INTEL_I460_GATT_COHERENT (1UL << 25)
14611 -/* intel i830 registers */
14612 +/* Intel i830 registers */
14613 #define I830_GMCH_CTRL 0x52
14614 #define I830_GMCH_ENABLED 0x4
14615 #define I830_GMCH_MEM_MASK 0x1
14616 @@ -218,31 +219,31 @@
14617 #define I852_GME 0x2
14618 #define I852_GM 0x5
14620 -/* intel 815 register */
14621 +/* Intel 815 register */
14622 #define INTEL_815_APCONT 0x51
14623 #define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF
14625 -/* intel i820 registers */
14626 +/* Intel i820 registers */
14627 #define INTEL_I820_RDCR 0x51
14628 #define INTEL_I820_ERRSTS 0xc8
14630 -/* intel i840 registers */
14631 +/* Intel i840 registers */
14632 #define INTEL_I840_MCHCFG 0x50
14633 #define INTEL_I840_ERRSTS 0xc8
14635 -/* intel i845 registers */
14636 +/* Intel i845 registers */
14637 #define INTEL_I845_AGPM 0x51
14638 #define INTEL_I845_ERRSTS 0xc8
14640 -/* intel i850 registers */
14641 +/* Intel i850 registers */
14642 #define INTEL_I850_MCHCFG 0x50
14643 #define INTEL_I850_ERRSTS 0xc8
14645 -/* intel i860 registers */
14646 +/* Intel i860 registers */
14647 #define INTEL_I860_MCHCFG 0x50
14648 #define INTEL_I860_ERRSTS 0xc8
14650 -/* intel i810 registers */
14651 +/* Intel i810 registers */
14652 #define I810_GMADDR 0x10
14653 #define I810_MMADDR 0x14
14654 #define I810_PTE_BASE 0x10000
14655 @@ -261,7 +262,6 @@
14656 #define I810_DRAM_ROW_0_SDRAM 0x00000001
14658 /* Intel 7505 registers */
14659 -#define INTEL_I7505_NAPBASELO 0x10
14660 #define INTEL_I7505_APSIZE 0x74
14661 #define INTEL_I7505_NCAPID 0x60
14662 #define INTEL_I7505_NISTAT 0x6c
14663 @@ -271,26 +271,23 @@
14664 #define INTEL_I7505_MCHCFG 0x50
14667 -#define VIA_APBASE 0x10
14668 #define VIA_GARTCTRL 0x80
14669 #define VIA_APSIZE 0x84
14670 #define VIA_ATTBASE 0x88
14673 #define VIA_AGP3_GARTCTRL 0x90
14674 -#define VIA_AGP3_APSIZE 0x94
14675 +#define VIA_AGP3_APSIZE 0x94
14676 #define VIA_AGP3_ATTBASE 0x98
14677 -#define VIA_AGPSEL 0xfd
14678 +#define VIA_AGPSEL 0xfd
14680 /* SiS registers */
14681 -#define SIS_APBASE 0x10
14682 #define SIS_ATTBASE 0x90
14683 #define SIS_APSIZE 0x94
14684 #define SIS_TLBCNTRL 0x97
14685 #define SIS_TLBFLUSH 0x98
14687 /* AMD registers */
14688 -#define AMD_APBASE 0x10
14689 #define AMD_MMBASE 0x14
14690 #define AMD_APSIZE 0xac
14691 #define AMD_MODECNTL 0xb0
14692 @@ -300,24 +297,14 @@
14693 #define AMD_TLBFLUSH 0x0c /* In mmio region (32-bit register) */
14694 #define AMD_CACHEENTRY 0x10 /* In mmio region (32-bit register) */
14696 -#define AMD_8151_APSIZE 0xb4
14697 -#define AMD_8151_GARTBLOCK 0xb8
14699 -#define AMD_X86_64_GARTAPERTURECTL 0x90
14700 -#define AMD_X86_64_GARTAPERTUREBASE 0x94
14701 -#define AMD_X86_64_GARTTABLEBASE 0x98
14702 -#define AMD_X86_64_GARTCACHECTL 0x9c
14703 -#define AMD_X86_64_GARTEN 1<<0
14705 -#define AMD_8151_VMAPERTURE 0x10
14706 -#define AMD_8151_AGP_CTL 0xb0
14707 -#define AMD_8151_APERTURESIZE 0xb4
14708 -#define AMD_8151_GARTPTR 0xb8
14709 -#define AMD_8151_GTLBEN 1<<7
14710 -#define AMD_8151_APEREN 1<<8
14711 +/* AMD64 registers */
14712 +#define AMD64_GARTAPERTURECTL 0x90
14713 +#define AMD64_GARTAPERTUREBASE 0x94
14714 +#define AMD64_GARTTABLEBASE 0x98
14715 +#define AMD64_GARTCACHECTL 0x9c
14716 +#define AMD64_GARTEN 1<<0
14718 /* ALi registers */
14719 -#define ALI_APBASE 0x10
14720 #define ALI_AGPCTRL 0xb8
14721 #define ALI_ATTBASE 0xbc
14722 #define ALI_TLBCTRL 0xc0
14723 @@ -327,19 +314,17 @@
14724 #define ALI_CACHE_FLUSH_EN 0x100
14727 -#define ATI_APBASE 0x10
14728 -#define ATI_GART_MMBASE_ADDR 0x14
14729 -#define ATI_RS100_APSIZE 0xac
14730 -#define ATI_RS300_APSIZE 0xf8
14731 -#define ATI_RS100_IG_AGPMODE 0xb0
14732 -#define ATI_RS300_IG_AGPMODE 0xfc
14734 -#define ATI_GART_FEATURE_ID 0x00
14735 -#define ATI_GART_BASE 0x04
14736 -#define ATI_GART_CACHE_SZBASE 0x08
14737 -#define ATI_GART_CACHE_CNTRL 0x0c
14738 -#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
14740 +#define ATI_GART_MMBASE_ADDR 0x14
14741 +#define ATI_RS100_APSIZE 0xac
14742 +#define ATI_RS300_APSIZE 0xf8
14743 +#define ATI_RS100_IG_AGPMODE 0xb0
14744 +#define ATI_RS300_IG_AGPMODE 0xfc
14746 +#define ATI_GART_FEATURE_ID 0x00
14747 +#define ATI_GART_BASE 0x04
14748 +#define ATI_GART_CACHE_SZBASE 0x08
14749 +#define ATI_GART_CACHE_CNTRL 0x0c
14750 +#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
14752 /* Serverworks Registers */
14753 #define SVWRKS_APSIZE 0x10
14754 @@ -369,6 +354,17 @@
14755 #define HP_ZX1_PDIR_BASE 0x320
14756 #define HP_ZX1_CACHE_FLUSH 0x428
14758 +/* NVIDIA registers */
14759 +#define NVIDIA_0_APSIZE 0x80
14760 +#define NVIDIA_1_WBC 0xf0
14761 +#define NVIDIA_2_GARTCTRL 0xd0
14762 +#define NVIDIA_2_APBASE 0xd8
14763 +#define NVIDIA_2_APLIMIT 0xdc
14764 +#define NVIDIA_2_ATTBASE(i) (0xe0 + (i) * 4)
14765 +#define NVIDIA_3_APBASE 0x50
14766 +#define NVIDIA_3_APLIMIT 0x54
14769 struct agp_device_ids {
14770 unsigned short device_id; /* first, to make table easier to read */
14771 enum chipset_type chipset;
14772 @@ -405,6 +401,9 @@
14773 void global_cache_flush(void);
14774 void get_agp_version(struct agp_bridge_data *bridge);
14775 unsigned long agp_generic_mask_memory(unsigned long addr, int type);
14777 +extern int agp_off;
14778 +extern int agp_try_unsupported_boot;
14780 /* Standard agp registers */
14781 #define AGPSTAT 0x4
14782 diff -Nru a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
14783 --- a/drivers/char/agp/ali-agp.c Mon Aug 18 10:39:21 2003
14784 +++ b/drivers/char/agp/ali-agp.c Thu Aug 28 16:44:18 2003
14786 pci_write_config_dword(agp_bridge->dev, ALI_TLBCTRL, ((temp & 0xffffff00) | 0x00000010));
14788 /* address to map to */
14789 - pci_read_config_dword(agp_bridge->dev, ALI_APBASE, &temp);
14790 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14791 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14794 diff -Nru a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
14795 --- a/drivers/char/agp/amd-k7-agp.c Mon Aug 18 10:39:21 2003
14796 +++ b/drivers/char/agp/amd-k7-agp.c Thu Aug 28 16:44:18 2003
14797 @@ -148,7 +148,7 @@
14798 * used to program the agp master not the cpu
14801 - pci_read_config_dword(agp_bridge->dev, AMD_APBASE, &temp);
14802 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
14803 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
14804 agp_bridge->gart_bus_addr = addr;
14806 diff -Nru a/drivers/char/agp/amd-k8-agp.c b/drivers/char/agp/amd-k8-agp.c
14807 --- a/drivers/char/agp/amd-k8-agp.c Thu Jul 31 08:58:45 2003
14808 +++ b/drivers/char/agp/amd-k8-agp.c Thu Aug 28 18:04:31 2003
14810 * work is done in the northbridge(s).
14814 - * On x86-64 the AGP driver needs to be initialized early by the IOMMU
14815 - * code. When you use this driver as a template for a new K8 AGP bridge
14816 - * driver don't forget to change arch/x86_64/kernel/pci-gart.c too -AK.
14819 #include <linux/module.h>
14820 #include <linux/pci.h>
14821 #include <linux/init.h>
14825 /* Will need to be increased if hammer ever goes >8-way. */
14827 #define MAX_HAMMER_GARTS 8
14829 +#define MAX_HAMMER_GARTS 1
14833 #define GPTE_VALID 1
14835 static int nr_garts;
14836 static struct pci_dev * hammers[MAX_HAMMER_GARTS];
14838 +static int __initdata agp_try_unsupported;
14840 static int gart_iterator;
14841 #define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++)
14847 - pci_read_config_dword (dev, AMD_X86_64_GARTCACHECTL, &tmp);
14848 + pci_read_config_dword (dev, AMD64_GARTCACHECTL, &tmp);
14850 - pci_write_config_dword (dev, AMD_X86_64_GARTCACHECTL, tmp);
14851 + pci_write_config_dword (dev, AMD64_GARTCACHECTL, tmp);
14854 static void amd_x86_64_tlbflush(struct agp_memory *temp)
14855 @@ -135,7 +135,7 @@
14859 - pci_read_config_dword(dev, AMD_X86_64_GARTAPERTURECTL, &temp);
14860 + pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &temp);
14861 temp = (temp & 0xe);
14862 values = A_SIZE_32(x86_64_aperture_sizes);
14864 @@ -162,7 +162,7 @@
14865 u64 addr, aper_base;
14867 /* Address to map to */
14868 - pci_read_config_dword (hammer, AMD_X86_64_GARTAPERTUREBASE, &tmp);
14869 + pci_read_config_dword (hammer, AMD64_GARTAPERTUREBASE, &tmp);
14870 aperturebase = tmp << 25;
14871 aper_base = (aperturebase & PCI_BASE_ADDRESS_MEM_MASK);
14873 @@ -171,13 +171,13 @@
14875 tmp = (u32) addr<<4;
14877 - pci_write_config_dword (hammer, AMD_X86_64_GARTTABLEBASE, tmp);
14878 + pci_write_config_dword (hammer, AMD64_GARTTABLEBASE, tmp);
14880 /* Enable GART translation for this hammer. */
14881 - pci_read_config_dword(hammer, AMD_X86_64_GARTAPERTURECTL, &tmp);
14882 + pci_read_config_dword(hammer, AMD64_GARTAPERTURECTL, &tmp);
14884 tmp &= ~(DISGARTCPU | DISGARTIO);
14885 - pci_write_config_dword(hammer, AMD_X86_64_GARTAPERTURECTL, tmp);
14886 + pci_write_config_dword(hammer, AMD64_GARTAPERTURECTL, tmp);
14888 /* keep CPU's coherent. */
14889 flush_x86_64_tlb (hammer);
14890 @@ -216,9 +216,9 @@
14893 /* disable gart translation */
14894 - pci_read_config_dword (hammers[gart_iterator], AMD_X86_64_GARTAPERTURECTL, &tmp);
14895 - tmp &= ~(AMD_X86_64_GARTEN);
14896 - pci_write_config_dword (hammers[gart_iterator], AMD_X86_64_GARTAPERTURECTL, tmp);
14897 + pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp);
14898 + tmp &= ~AMD64_GARTEN;
14899 + pci_write_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, tmp);
14903 @@ -246,24 +246,123 @@
14904 .agp_destroy_page = agp_generic_destroy_page,
14907 +/* Some basic sanity checks for the aperture. */
14908 +static int __init aperture_valid(u64 aper, u32 size)
14910 + static int not_first_call;
14913 + printk(KERN_ERR "No aperture\n");
14916 + if (size < 32*1024*1024) {
14917 + printk(KERN_ERR "Aperture too small (%d MB)\n", size>>20);
14920 + if (aper + size > 0xffffffff) {
14921 + printk(KERN_ERR "Aperture out of bounds\n");
14924 + pfn = aper >> PAGE_SHIFT;
14925 + for (c = 0; c < size/PAGE_SIZE; c++) {
14926 + if (!pfn_valid(pfn + c))
14928 + if (!PageReserved(pfn_to_page(pfn + c))) {
14929 + printk(KERN_ERR "Aperture pointing to RAM\n");
14935 -static int cache_nbs (void)
14936 + /* Request the Aperture. This catches cases when someone else
14937 + already put a mapping in there - happens with some very broken BIOS
14939 + Maybe better to use pci_assign_resource/pci_enable_device instead trusting
14941 + if (!not_first_call && request_mem_region(aper, size, "aperture") < 0) {
14942 + printk(KERN_ERR "Aperture conflicts with PCI mapping.\n");
14946 + not_first_call = 1;
14951 + * W*s centric BIOS sometimes only set up the aperture in the AGP
14952 + * bridge, not the northbridge. On AMD64 this is handled early
14953 + * in aperture.c, but when GART_IOMMU is not enabled or we run
14954 + * on a 32bit kernel this needs to be redone.
14955 + * Unfortunately it is impossible to fix the aperture here because it's too late
14956 + * to allocate that much memory. But at least error out cleanly instead of
14959 +static __init int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
14962 + u32 aper_low, aper_hi;
14963 + u64 aper, nb_aper;
14965 + u32 nb_order, nb_base;
14968 + pci_read_config_dword(nb, 0x90, &nb_order);
14969 + nb_order = (nb_order >> 1) & 7;
14970 + pci_read_config_dword(nb, 0x94, &nb_base);
14971 + nb_aper = nb_base << 25;
14972 + if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) {
14976 + /* Northbridge seems to contain crap. Try the AGP bridge. */
14978 + pci_read_config_word(agp, cap+0x14, &apsize);
14979 + if (apsize == 0xffff)
14983 + /* Some BIOS use weird encodings not in the AGPv3 table. */
14984 + if (apsize & 0xff)
14986 + order = 7 - hweight16(apsize);
14988 + pci_read_config_dword(agp, 0x10, &aper_low);
14989 + pci_read_config_dword(agp, 0x14, &aper_hi);
14990 + aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
14991 + printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order);
14992 + if (order < 0 || !aperture_valid(aper, (32*1024*1024)<<order))
14995 + pci_write_config_dword(nb, 0x90, order << 1);
14996 + pci_write_config_dword(nb, 0x94, aper >> 25);
15001 +static __init int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
15003 struct pci_dev *loop_dev = NULL;
15006 /* cache pci_devs of northbridges. */
15007 - while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) {
15008 + while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev))
15010 + if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) {
15011 + printk("No usable aperture found.\n");
15013 + /* should port this to i386 */
15014 + printk("Consider rebooting with iommu=memaper=2 to get a good aperture.\n");
15018 hammers[i++] = loop_dev;
15020 - if (i == MAX_HAMMER_GARTS)
15021 + if (i == MAX_HAMMER_GARTS) {
15022 + printk(KERN_INFO "Too many northbridges for AGP\n");
15027 + return i == 0 ? -1 : 0;
15032 static int __init agp_amdk8_probe(struct pci_dev *pdev,
15033 const struct pci_device_id *ent)
15034 @@ -277,7 +376,7 @@
15038 - printk(KERN_INFO PFX "Detected Opteron/Athlon64 on-CPU GART\n");
15039 + /* Could check for AGPv3 here */
15041 bridge = agp_alloc_bridge();
15043 @@ -311,6 +410,9 @@
15044 bridge->major_version = 3;
15045 bridge->minor_version = 0;
15048 + printk(KERN_INFO PFX "Detected AGP bridge %x\n",
15052 bridge->driver = &amd_8151_driver;
15053 @@ -320,22 +422,10 @@
15054 /* Fill in the mode register */
15055 pci_read_config_dword(pdev, bridge->capndx+PCI_AGP_STATUS, &bridge->mode);
15058 - if (cache_nbs() == -1) {
15059 + if (cache_nbs(pdev, cap_ptr) == -1) {
15060 agp_put_bridge(bridge);
15065 - struct pci_dev *loop_dev = NULL;
15066 - while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) {
15067 - /* For UP, we only care about the first GART. */
15068 - hammers[0] = loop_dev;
15076 pci_set_drvdata(pdev, bridge);
15077 return agp_add_bridge(bridge);
15078 @@ -345,6 +435,8 @@
15080 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
15082 + release_mem_region(virt_to_phys(bridge->gatt_table_real),
15083 + x86_64_aperture_sizes[bridge->aperture_size_idx].size);
15084 agp_remove_bridge(bridge);
15085 agp_put_bridge(bridge);
15087 @@ -358,11 +450,21 @@
15088 .subvendor = PCI_ANY_ID,
15089 .subdevice = PCI_ANY_ID,
15093 .class = (PCI_CLASS_BRIDGE_HOST << 8),
15095 .vendor = PCI_VENDOR_ID_VIA,
15096 - .device = PCI_DEVICE_ID_VIA_K8T400M_0,
15097 + .device = PCI_DEVICE_ID_VIA_8385_0,
15098 + .subvendor = PCI_ANY_ID,
15099 + .subdevice = PCI_ANY_ID,
15101 + /* VIA K8M800 / K8N800 */
15103 + .class = (PCI_CLASS_BRIDGE_HOST << 8),
15104 + .class_mask = ~0,
15105 + .vendor = PCI_VENDOR_ID_VIA,
15106 + .device = PCI_DEVICE_ID_VIA_8380_0,
15107 .subvendor = PCI_ANY_ID,
15108 .subdevice = PCI_ANY_ID,
15110 @@ -386,10 +488,43 @@
15111 .remove = agp_amdk8_remove,
15115 /* Not static due to IOMMU code calling it early. */
15116 int __init agp_amdk8_init(void)
15118 - return pci_module_init(&agp_amdk8_pci_driver);
15122 + if (pci_module_init(&agp_amdk8_pci_driver) == 0) {
15123 + struct pci_dev *dev;
15124 + if (!agp_try_unsupported && !agp_try_unsupported_boot) {
15125 + printk(KERN_INFO "No supported AGP bridge found.\n");
15127 + printk(KERN_INFO "You can try agp_try_unsupported=1\n");
15129 + printk(KERN_INFO "You can boot with agp=try_unsupported\n");
15134 + /* First check that we have at least one K8 NB */
15135 + if (!pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, NULL))
15138 + /* Look for any AGP bridge */
15141 + while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
15142 + if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
15144 + /* Only one bridge supported right now */
15145 + if (agp_amdk8_probe(dev, NULL) == 0) {
15154 static void __exit agp_amdk8_cleanup(void)
15155 @@ -404,6 +539,6 @@
15156 module_exit(agp_amdk8_cleanup);
15159 -MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
15160 +MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>, Andi Kleen");
15161 +MODULE_PARM(agp_try_unsupported, "1i");
15162 MODULE_LICENSE("GPL and additional rights");
15164 diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
15165 --- a/drivers/char/agp/ati-agp.c Mon Aug 18 10:39:21 2003
15166 +++ b/drivers/char/agp/ati-agp.c Thu Aug 28 16:44:18 2003
15169 - * ALi AGPGART routines.
15170 + * ATi AGPGART routines.
15173 #include <linux/types.h>
15174 @@ -212,7 +212,7 @@
15176 /* address to map too */
15178 - pci_read_config_dword(agp_bridge.dev, ATI_APBASE, &temp);
15179 + pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp);
15180 agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15181 printk(KERN_INFO "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr);
15183 @@ -355,7 +355,7 @@
15184 * This is a bus address even on the alpha, b/c its
15185 * used to program the agp master not the cpu
15187 - pci_read_config_dword(agp_bridge->dev, ATI_APBASE, &temp);
15188 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15189 addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15190 agp_bridge->gart_bus_addr = addr;
15192 diff -Nru a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
15193 --- a/drivers/char/agp/backend.c Wed Aug 13 10:20:16 2003
15194 +++ b/drivers/char/agp/backend.c Thu Aug 28 16:22:00 2003
15195 @@ -301,9 +301,14 @@
15197 EXPORT_SYMBOL_GPL(agp_remove_bridge);
15200 +int agp_try_unsupported_boot;
15201 +EXPORT_SYMBOL(agp_off);
15202 +EXPORT_SYMBOL(agp_try_unsupported_boot);
15204 static int __init agp_init(void)
15207 printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
15208 AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
15210 @@ -313,6 +318,15 @@
15214 +static __init int agp_setup(char *s)
15216 + if (!strcmp(s,"off"))
15218 + if (!strcmp(s,"try_unsupported"))
15219 + agp_try_unsupported_boot = 1;
15222 +__setup("agp=", agp_setup);
15224 MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
15225 MODULE_DESCRIPTION("AGP GART driver");
15226 diff -Nru a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
15227 --- a/drivers/char/agp/frontend.c Sun Jul 13 05:36:05 2003
15228 +++ b/drivers/char/agp/frontend.c Tue Aug 26 09:25:41 2003
15229 @@ -698,7 +698,7 @@
15231 static int agp_open(struct inode *inode, struct file *file)
15233 - int minor = minor(inode->i_rdev);
15234 + int minor = iminor(inode);
15235 struct agp_file_private *priv;
15236 struct agp_client *client;
15238 diff -Nru a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
15239 --- a/drivers/char/agp/generic.c Wed Aug 13 01:35:50 2003
15240 +++ b/drivers/char/agp/generic.c Wed Aug 27 11:06:10 2003
15241 @@ -577,12 +577,12 @@
15242 agp_device_command(command, TRUE);
15245 - /* Disable calibration cycle in RX91<1> when not in AGP3.0 mode of operation.*/
15246 + /* Disable calibration cycle in RX91<1> when not in AGP3.0 mode of operation.*/
15247 command &= ~(7<<10) ;
15248 pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &temp);
15250 pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, temp);
15253 printk (KERN_INFO PFX "Device is in legacy mode,"
15254 " falling back to 2.x\n");
15256 diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
15257 --- a/drivers/char/agp/intel-agp.c Fri Aug 15 07:25:05 2003
15258 +++ b/drivers/char/agp/intel-agp.c Thu Aug 28 16:44:18 2003
15259 @@ -618,7 +618,7 @@
15260 pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15262 /* address to map to */
15263 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15264 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15265 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15267 /* attbase - aperture base */
15268 @@ -657,7 +657,7 @@
15269 current_size->size_value);
15271 /* address to map to */
15272 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15273 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15274 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15276 pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
15277 @@ -708,7 +708,7 @@
15278 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15280 /* address to map to */
15281 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15282 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15283 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15285 /* attbase - aperture base */
15286 @@ -739,7 +739,7 @@
15287 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15289 /* address to map to */
15290 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15291 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15292 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15294 /* attbase - aperture base */
15295 @@ -768,7 +768,7 @@
15296 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15298 /* address to map to */
15299 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15300 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15301 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15303 /* attbase - aperture base */
15304 @@ -797,7 +797,7 @@
15305 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15307 /* address to map to */
15308 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15309 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15310 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15312 /* attbase - aperture base */
15313 @@ -826,7 +826,7 @@
15314 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15316 /* address to map to */
15317 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15318 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15319 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15321 /* attbase - aperture base */
15322 @@ -855,7 +855,7 @@
15323 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15325 /* address to map to */
15326 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15327 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15328 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15330 /* attbase - aperture base */
15331 @@ -884,7 +884,7 @@
15332 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
15334 /* address to map to */
15335 - pci_read_config_dword(agp_bridge->dev, INTEL_APBASE, &temp);
15336 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15337 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15339 /* attbase - aperture base */
15340 diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
15341 --- a/drivers/char/agp/nvidia-agp.c Fri Aug 15 07:22:22 2003
15342 +++ b/drivers/char/agp/nvidia-agp.c Thu Aug 28 16:56:50 2003
15344 #include <linux/mm.h>
15349 -#define NVIDIA_0_APBASE 0x10
15350 -#define NVIDIA_0_APSIZE 0x80
15351 -#define NVIDIA_1_WBC 0xf0
15352 -#define NVIDIA_2_GARTCTRL 0xd0
15353 -#define NVIDIA_2_APBASE 0xd8
15354 -#define NVIDIA_2_APLIMIT 0xdc
15355 -#define NVIDIA_2_ATTBASE(i) (0xe0 + (i) * 4)
15356 -#define NVIDIA_3_APBASE 0x50
15357 -#define NVIDIA_3_APLIMIT 0x54
15359 static struct _nvidia_private {
15360 struct pci_dev *dev_1;
15361 struct pci_dev *dev_2;
15363 current_size->size_value);
15365 /* address to map to */
15366 - pci_read_config_dword(agp_bridge->dev, NVIDIA_0_APBASE, &apbase);
15367 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &apbase);
15368 apbase &= PCI_BASE_ADDRESS_MEM_MASK;
15369 agp_bridge->gart_bus_addr = apbase;
15370 aplimit = apbase + (current_size->size * 1024 * 1024) - 1;
15371 diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
15372 --- a/drivers/char/agp/sis-agp.c Mon Aug 18 10:39:21 2003
15373 +++ b/drivers/char/agp/sis-agp.c Thu Aug 28 16:44:18 2003
15376 current_size = A_SIZE_8(agp_bridge->current_size);
15377 pci_write_config_byte(agp_bridge->dev, SIS_TLBCNTRL, 0x05);
15378 - pci_read_config_dword(agp_bridge->dev, SIS_APBASE, &temp);
15379 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15380 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15381 pci_write_config_dword(agp_bridge->dev, SIS_ATTBASE,
15382 agp_bridge->gatt_bus_addr);
15383 diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
15384 --- a/drivers/char/agp/via-agp.c Wed Aug 13 01:41:04 2003
15385 +++ b/drivers/char/agp/via-agp.c Thu Aug 28 17:14:45 2003
15387 pci_write_config_byte(agp_bridge->dev, VIA_APSIZE,
15388 current_size->size_value);
15389 /* address to map too */
15390 - pci_read_config_dword(agp_bridge->dev, VIA_APBASE, &temp);
15391 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15392 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15394 /* GART control register */
15395 @@ -114,7 +114,7 @@
15396 current_size = A_SIZE_16(agp_bridge->current_size);
15398 /* address to map too */
15399 - pci_read_config_dword(agp_bridge->dev, VIA_APBASE, &temp);
15400 + pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
15401 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
15403 /* attbase - aperture GATT base */
15404 @@ -215,52 +215,52 @@
15407 .device_id = PCI_DEVICE_ID_VIA_82C597_0,
15408 - .chipset_name = "VP3",
15409 + .chipset_name = "Apollo VP3",
15413 .device_id = PCI_DEVICE_ID_VIA_82C598_0,
15414 - .chipset_name = "MVP3",
15415 + .chipset_name = "Apollo MVP3",
15419 .device_id = PCI_DEVICE_ID_VIA_8501_0,
15420 - .chipset_name = "MVP4",
15421 + .chipset_name = "Apollo MVP4",
15426 .device_id = PCI_DEVICE_ID_VIA_8601_0,
15427 - .chipset_name = "PLE133 ProMedia",
15428 + .chipset_name = "Apollo ProMedia/PLE133Ta",
15431 /* VT82C693A / VT28C694T */
15433 - .device_id = PCI_DEVICE_ID_VIA_82C691,
15434 + .device_id = PCI_DEVICE_ID_VIA_82C691_0,
15435 .chipset_name = "Apollo Pro 133",
15439 .device_id = PCI_DEVICE_ID_VIA_8371_0,
15440 - .chipset_name = "Apollo Pro KX133",
15441 + .chipset_name = "KX133",
15446 .device_id = PCI_DEVICE_ID_VIA_8633_0,
15447 - .chipset_name = "Apollo Pro 266",
15448 + .chipset_name = "Pro 266",
15453 .device_id = PCI_DEVICE_ID_VIA_8361,
15454 - .chipset_name = "Apollo KLE133",
15455 + .chipset_name = "KLE133",
15458 /* VT8365 / VT8362 */
15460 .device_id = PCI_DEVICE_ID_VIA_8363_0,
15461 - .chipset_name = "Apollo Pro KT133/KM133/TwisterK",
15462 + .chipset_name = "Twister-K/KT133x/KM133",
15466 @@ -272,79 +272,79 @@
15469 .device_id = PCI_DEVICE_ID_VIA_8367_0,
15470 - .chipset_name = "Apollo Pro KT266/KT333",
15471 + .chipset_name = "KT266/KY266x/KT333",
15474 /* VT8633 (for CuMine/ Celeron) */
15476 .device_id = PCI_DEVICE_ID_VIA_8653_0,
15477 - .chipset_name = "Apollo Pro 266T",
15478 + .chipset_name = "Pro266T",
15481 /* KM266 / PM266 */
15483 - .device_id = PCI_DEVICE_ID_VIA_KM266,
15484 - .chipset_name = "KM266/PM266",
15485 + .device_id = PCI_DEVICE_ID_VIA_XM266,
15486 + .chipset_name = "PM266/KM266",
15491 - .device_id = PCI_DEVICE_ID_VIA_CLE266,
15492 + .device_id = PCI_DEVICE_ID_VIA_862X_0,
15493 .chipset_name = "CLE266",
15497 .device_id = PCI_DEVICE_ID_VIA_8377_0,
15498 - .chipset_name = "Apollo Pro KT400",
15499 + .chipset_name = "KT400/KT400A/KT600",
15502 - /* VT8604 / VT8605 / VT8603 / TwisterT
15503 + /* VT8604 / VT8605 / VT8603
15504 * (Apollo Pro133A chipset with S3 Savage4) */
15506 - .device_id = PCI_DEVICE_ID_VIA_82C694X_0,
15507 - .chipset_name = "Apollo ProSavage PM133/PL133/PN133/Twister"
15508 + .device_id = PCI_DEVICE_ID_VIA_8605_0,
15509 + .chipset_name = "ProSavage PM133/PL133/PN133"
15513 + /* P4M266x/P4N266 */
15515 - .device_id = PCI_DEVICE_ID_VIA_8752,
15516 - .chipset_name = "ProSavage DDR P4M266",
15517 + .device_id = PCI_DEVICE_ID_VIA_8703_51_0,
15518 + .chipset_name = "P4M266x/P4N266",
15521 - /* KN266/PN266 */
15524 - .device_id = PCI_DEVICE_ID_VIA_KN266,
15525 - .chipset_name = "KN266/PN266",
15526 + .device_id = PCI_DEVICE_ID_VIA_8754C_0,
15527 + .chipset_name = "PT800",
15533 - .device_id = PCI_DEVICE_ID_VIA_8754,
15534 - .chipset_name = "Apollo P4X333/P4X400"
15535 + .device_id = PCI_DEVICE_ID_VIA_8763_0,
15536 + .chipset_name = "P4X600"
15542 - .device_id = PCI_DEVICE_ID_VIA_P4N333,
15543 - .chipset_name = "P4N333",
15544 + .device_id = PCI_DEVICE_ID_VIA_8378_0,
15545 + .chipset_name = "KM400/KM400A",
15551 - .device_id = PCI_DEVICE_ID_VIA_P4X600,
15552 - .chipset_name = "P4X600",
15553 + .device_id = PCI_DEVICE_ID_VIA_PT880,
15554 + .chipset_name = "PT880",
15560 - .device_id = PCI_DEVICE_ID_VIA_KM400,
15561 - .chipset_name = "KM400",
15562 + .device_id = PCI_DEVICE_ID_VIA_8783_0,
15563 + .chipset_name = "PT890",
15567 + /* PM800/PN800/PM880/PN880 */
15569 - .device_id = PCI_DEVICE_ID_VIA_P4M400,
15570 - .chipset_name = "P4M400",
15571 + .device_id = PCI_DEVICE_ID_VIA_PX8X0_0,
15572 + .chipset_name = "PM800/PN800/PM880/PN880",
15575 { }, /* dummy final entry, always present */
15576 diff -Nru a/drivers/char/busmouse.c b/drivers/char/busmouse.c
15577 --- a/drivers/char/busmouse.c Fri Jul 11 23:17:17 2003
15578 +++ b/drivers/char/busmouse.c Tue Aug 26 09:25:41 2003
15582 #define FIRST_MOUSE 0
15583 -#define DEV_TO_MOUSE(dev) MINOR_TO_MOUSE(minor(dev))
15584 +#define DEV_TO_MOUSE(inode) MINOR_TO_MOUSE(iminor(inode))
15585 #define MINOR_TO_MOUSE(minor) ((minor) - FIRST_MOUSE)
15588 @@ -190,7 +190,7 @@
15589 unsigned int mousedev;
15592 - mousedev = DEV_TO_MOUSE(inode->i_rdev);
15593 + mousedev = DEV_TO_MOUSE(inode);
15594 if (mousedev >= NR_MICE)
15597 diff -Nru a/drivers/char/cyclades.c b/drivers/char/cyclades.c
15598 --- a/drivers/char/cyclades.c Fri Aug 1 02:20:44 2003
15599 +++ b/drivers/char/cyclades.c Sun Aug 31 16:14:39 2003
15600 @@ -1050,14 +1050,14 @@
15603 /* Enable the Tx interrupts on the CD1400 */
15604 - save_flags(flags); cli();
15605 + local_irq_save(flags);
15606 cy_writeb((u_long)address + (CyCAR<<index), 0);
15607 cyy_issue_cmd(address, CyCHAN_CTL|CyENB_XMTR, index);
15609 cy_writeb((u_long)address + (CyCAR<<index), 0);
15610 cy_writeb((u_long)address + (CySRER<<index),
15611 cy_readb(address + (CySRER<<index)) | CyTxRdy);
15612 - restore_flags(flags);
15613 + local_irq_restore(flags);
15617 @@ -5665,7 +5665,7 @@
15618 cy_cleanup_module(void)
15623 unsigned long flags;
15625 #ifndef CONFIG_CYZ_INTR
15626 @@ -5675,13 +5675,10 @@
15628 #endif /* CONFIG_CYZ_INTR */
15630 - save_flags(flags); cli();
15632 if ((e1 = tty_unregister_driver(cy_serial_driver)))
15633 printk("cyc: failed to unregister Cyclades serial driver(%d)\n",
15636 - restore_flags(flags);
15637 put_tty_driver(cy_serial_driver);
15639 for (i = 0; i < NR_CARDS; i++) {
15640 diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h
15641 --- a/drivers/char/drm/drm_drv.h Thu Aug 7 15:37:26 2003
15642 +++ b/drivers/char/drm/drm_drv.h Tue Aug 26 09:25:41 2003
15643 @@ -795,7 +795,7 @@
15646 for (i = 0; i < DRM(numdevs); i++) {
15647 - if (minor(inode->i_rdev) == DRM(minor)[i]) {
15648 + if (iminor(inode) == DRM(minor)[i]) {
15649 dev = &(DRM(device)[i]);
15652 diff -Nru a/drivers/char/drm/drm_fops.h b/drivers/char/drm/drm_fops.h
15653 --- a/drivers/char/drm/drm_fops.h Thu Jul 10 23:18:01 2003
15654 +++ b/drivers/char/drm/drm_fops.h Tue Aug 26 09:25:41 2003
15657 int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
15659 - int minor = minor(inode->i_rdev);
15660 + int minor = iminor(inode);
15663 if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
15664 diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h
15665 --- a/drivers/char/drm/drm_stub.h Thu Jul 10 23:18:01 2003
15666 +++ b/drivers/char/drm/drm_stub.h Tue Aug 26 09:25:41 2003
15669 static int DRM(stub_open)(struct inode *inode, struct file *filp)
15671 - int minor = minor(inode->i_rdev);
15672 + int minor = iminor(inode);
15674 struct file_operations *old_fops;
15676 diff -Nru a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
15677 --- a/drivers/char/dsp56k.c Wed May 7 08:47:29 2003
15678 +++ b/drivers/char/dsp56k.c Tue Aug 26 09:25:41 2003
15679 @@ -207,7 +207,7 @@
15682 struct inode *inode = file->f_dentry->d_inode;
15683 - int dev = minor(inode->i_rdev) & 0x0f;
15684 + int dev = iminor(inode) & 0x0f;
15688 @@ -270,7 +270,7 @@
15691 struct inode *inode = file->f_dentry->d_inode;
15692 - int dev = minor(inode->i_rdev) & 0x0f;
15693 + int dev = iminor(inode) & 0x0f;
15697 @@ -331,7 +331,7 @@
15698 static int dsp56k_ioctl(struct inode *inode, struct file *file,
15699 unsigned int cmd, unsigned long arg)
15701 - int dev = minor(inode->i_rdev) & 0x0f;
15702 + int dev = iminor(inode) & 0x0f;
15706 @@ -424,7 +424,7 @@
15708 static unsigned int dsp56k_poll(struct file *file, poll_table *wait)
15710 - int dev = minor(file->f_dentry->d_inode->i_rdev) & 0x0f;
15711 + int dev = iminor(file->f_dentry->d_inode) & 0x0f;
15715 @@ -441,7 +441,7 @@
15717 static int dsp56k_open(struct inode *inode, struct file *file)
15719 - int dev = minor(inode->i_rdev) & 0x0f;
15720 + int dev = iminor(inode) & 0x0f;
15724 @@ -472,7 +472,7 @@
15726 static int dsp56k_release(struct inode *inode, struct file *file)
15728 - int dev = minor(inode->i_rdev) & 0x0f;
15729 + int dev = iminor(inode) & 0x0f;
15733 diff -Nru a/drivers/char/dtlk.c b/drivers/char/dtlk.c
15734 --- a/drivers/char/dtlk.c Fri Jul 11 06:34:28 2003
15735 +++ b/drivers/char/dtlk.c Tue Aug 26 09:25:41 2003
15736 @@ -125,7 +125,7 @@
15737 static ssize_t dtlk_read(struct file *file, char *buf,
15738 size_t count, loff_t * ppos)
15740 - unsigned int minor = minor(file->f_dentry->d_inode->i_rdev);
15741 + unsigned int minor = iminor(file->f_dentry->d_inode);
15743 int i = 0, retries;
15745 @@ -185,7 +185,7 @@
15746 if (ppos != &file->f_pos)
15749 - if (minor(file->f_dentry->d_inode->i_rdev) != DTLK_MINOR)
15750 + if (iminor(file->f_dentry->d_inode) != DTLK_MINOR)
15754 @@ -304,7 +304,7 @@
15756 TRACE_TEXT("(dtlk_open");
15758 - switch (minor(inode->i_rdev)) {
15759 + switch (iminor(inode)) {
15763 @@ -319,7 +319,7 @@
15765 TRACE_TEXT("(dtlk_release");
15767 - switch (minor(inode->i_rdev)) {
15768 + switch (iminor(inode)) {
15772 diff -Nru a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c
15773 --- a/drivers/char/ftape/lowlevel/fdc-io.c Tue Jul 15 10:01:29 2003
15774 +++ b/drivers/char/ftape/lowlevel/fdc-io.c Sun Aug 31 16:13:58 2003
15775 @@ -1305,7 +1305,7 @@
15777 TRACE(ft_t_bug, "Unexpected ftape interrupt");
15779 - return IRQ_RETVAL(handled);
15780 + TRACE_EXIT IRQ_RETVAL(handled);
15783 int fdc_grab_irq_and_dma(void)
15784 diff -Nru a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
15785 --- a/drivers/char/ftape/zftape/zftape-init.c Tue Jul 15 10:01:29 2003
15786 +++ b/drivers/char/ftape/zftape/zftape-init.c Tue Aug 26 09:25:41 2003
15787 @@ -110,11 +110,11 @@
15789 TRACE_FUN(ft_t_flow);
15791 - TRACE(ft_t_flow, "called for minor %d", minor(ino->i_rdev));
15792 + TRACE(ft_t_flow, "called for minor %d", iminor(ino));
15793 if ( test_and_set_bit(0,&busy_flag) ) {
15794 TRACE_ABORT(-EBUSY, ft_t_warn, "failed: already busy");
15796 - if ((minor(ino->i_rdev) & ~(ZFT_MINOR_OP_MASK | FTAPE_NO_REWIND))
15797 + if ((iminor(ino) & ~(ZFT_MINOR_OP_MASK | FTAPE_NO_REWIND))
15800 clear_bit(0,&busy_flag);
15801 @@ -122,7 +122,7 @@
15803 orig_sigmask = current->blocked;
15804 sigfillset(¤t->blocked);
15805 - result = _zft_open(minor(ino->i_rdev), filep->f_flags & O_ACCMODE);
15806 + result = _zft_open(iminor(ino), filep->f_flags & O_ACCMODE);
15808 current->blocked = orig_sigmask; /* restore mask */
15809 clear_bit(0,&busy_flag);
15810 @@ -144,7 +144,7 @@
15812 TRACE_FUN(ft_t_flow);
15814 - if ( !test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit) {
15815 + if ( !test_bit(0,&busy_flag) || iminor(ino) != zft_unit) {
15816 TRACE(ft_t_err, "failed: not busy or wrong unit");
15819 @@ -167,7 +167,7 @@
15820 sigset_t old_sigmask;
15821 TRACE_FUN(ft_t_flow);
15823 - if ( !test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
15824 + if ( !test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
15825 TRACE_ABORT(-EIO, ft_t_err,
15826 "failed: not busy, failure or wrong unit");
15828 @@ -188,7 +188,7 @@
15829 TRACE_FUN(ft_t_flow);
15831 if ( !test_bit(0,&busy_flag) ||
15832 - minor(filep->f_dentry->d_inode->i_rdev) != zft_unit ||
15833 + iminor(filep->f_dentry->d_inode) != zft_unit ||
15836 TRACE_ABORT(-EIO, ft_t_err,
15837 @@ -217,7 +217,7 @@
15838 TRACE_FUN(ft_t_flow);
15840 TRACE(ft_t_data_flow, "called with count: %ld", (unsigned long)req_len);
15841 - if (!test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
15842 + if (!test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
15843 TRACE_ABORT(-EIO, ft_t_err,
15844 "failed: not busy, failure or wrong unit");
15846 @@ -240,7 +240,7 @@
15847 TRACE_FUN(ft_t_flow);
15849 TRACE(ft_t_flow, "called with count: %ld", (unsigned long)req_len);
15850 - if (!test_bit(0,&busy_flag) || minor(ino->i_rdev) != zft_unit || ft_failure) {
15851 + if (!test_bit(0,&busy_flag) || iminor(ino) != zft_unit || ft_failure) {
15852 TRACE_ABORT(-EIO, ft_t_err,
15853 "failed: not busy, failure or wrong unit");
15855 diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
15856 --- a/drivers/char/ip2main.c Mon Jul 14 06:47:09 2003
15857 +++ b/drivers/char/ip2main.c Tue Aug 26 09:25:41 2003
15858 @@ -2733,7 +2733,7 @@
15860 ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off )
15862 - unsigned int minor = minor( pFile->f_dentry->d_inode->i_rdev );
15863 + unsigned int minor = iminor(pFile->f_dentry->d_inode);
15866 #ifdef IP2DEBUG_IPL
15867 @@ -2863,7 +2863,7 @@
15869 ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
15871 - unsigned int iplminor = minor(pInode->i_rdev);
15872 + unsigned int iplminor = iminor(pInode);
15874 ULONG *pIndex = (ULONG*)arg;
15875 i2eBordStrPtr pB = i2BoardPtrTable[iplminor / 4];
15876 @@ -2998,7 +2998,7 @@
15878 ip2_ipl_open( struct inode *pInode, struct file *pFile )
15880 - unsigned int iplminor = minor(pInode->i_rdev);
15881 + unsigned int iplminor = iminor(pInode);
15885 diff -Nru a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
15886 --- a/drivers/char/ipmi/ipmi_devintf.c Wed May 7 08:47:29 2003
15887 +++ b/drivers/char/ipmi/ipmi_devintf.c Tue Aug 26 09:25:41 2003
15888 @@ -110,7 +110,7 @@
15890 static int ipmi_open(struct inode *inode, struct file *file)
15892 - int if_num = minor(inode->i_rdev);
15893 + int if_num = iminor(inode);
15895 struct ipmi_file_private *priv;
15897 diff -Nru a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
15898 --- a/drivers/char/ipmi/ipmi_watchdog.c Mon Aug 11 04:34:37 2003
15899 +++ b/drivers/char/ipmi/ipmi_watchdog.c Tue Aug 26 09:25:41 2003
15900 @@ -645,7 +645,7 @@
15902 static int ipmi_open(struct inode *ino, struct file *filep)
15904 - switch (minor(ino->i_rdev))
15905 + switch (iminor(ino))
15907 case WATCHDOG_MINOR:
15908 if (ipmi_wdog_open)
15909 @@ -688,7 +688,7 @@
15911 static int ipmi_close(struct inode *ino, struct file *filep)
15913 - if (minor(ino->i_rdev)==WATCHDOG_MINOR)
15914 + if (iminor(ino)==WATCHDOG_MINOR)
15916 #ifndef CONFIG_WATCHDOG_NOWAYOUT
15917 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
15918 diff -Nru a/drivers/char/istallion.c b/drivers/char/istallion.c
15919 --- a/drivers/char/istallion.c Mon Jun 23 18:43:58 2003
15920 +++ b/drivers/char/istallion.c Tue Aug 26 09:25:41 2003
15921 @@ -4805,7 +4805,7 @@
15922 (int) fp, (int) buf, count, (int) offp);
15925 - brdnr = minor(fp->f_dentry->d_inode->i_rdev);
15926 + brdnr = iminor(fp->f_dentry->d_inode);
15927 if (brdnr >= stli_nrbrds)
15929 brdp = stli_brds[brdnr];
15930 @@ -4860,7 +4860,7 @@
15931 (int) fp, (int) buf, count, (int) offp);
15934 - brdnr = minor(fp->f_dentry->d_inode->i_rdev);
15935 + brdnr = iminor(fp->f_dentry->d_inode);
15936 if (brdnr >= stli_nrbrds)
15938 brdp = stli_brds[brdnr];
15939 @@ -5201,7 +5201,7 @@
15940 * Now handle the board specific ioctls. These all depend on the
15941 * minor number of the device they were called from.
15943 - brdnr = minor(ip->i_rdev);
15944 + brdnr = iminor(ip);
15945 if (brdnr >= STL_MAXBRDS)
15947 brdp = stli_brds[brdnr];
15948 diff -Nru a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
15949 --- a/drivers/char/ite_gpio.c Thu Mar 6 14:03:51 2003
15950 +++ b/drivers/char/ite_gpio.c Tue Aug 26 09:25:41 2003
15951 @@ -238,7 +238,7 @@
15953 static int ite_gpio_open(struct inode *inode, struct file *file)
15955 - unsigned int minor = minor(inode->i_rdev);
15956 + unsigned int minor = iminor(inode);
15957 if (minor != GPIO_MINOR)
15960 diff -Nru a/drivers/char/lcd.c b/drivers/char/lcd.c
15961 --- a/drivers/char/lcd.c Wed May 29 12:05:13 2002
15962 +++ b/drivers/char/lcd.c Sun Aug 31 16:14:08 2003
15963 @@ -551,9 +551,9 @@
15966 static struct file_operations lcd_fops = {
15968 - ioctl: lcd_ioctl,
15970 + .read = lcd_read,
15971 + .ioctl = lcd_ioctl,
15972 + .open = lcd_open,
15975 static struct miscdevice lcd_dev=
15976 diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
15977 --- a/drivers/char/lp.c Wed May 7 08:47:29 2003
15978 +++ b/drivers/char/lp.c Tue Aug 26 09:25:41 2003
15979 @@ -292,7 +292,7 @@
15980 static ssize_t lp_write(struct file * file, const char * buf,
15981 size_t count, loff_t *ppos)
15983 - unsigned int minor = minor(file->f_dentry->d_inode->i_rdev);
15984 + unsigned int minor = iminor(file->f_dentry->d_inode);
15985 struct parport *port = lp_table[minor].dev->port;
15986 char *kbuf = lp_table[minor].lp_buffer;
15988 @@ -408,7 +408,7 @@
15989 static ssize_t lp_read(struct file * file, char * buf,
15990 size_t count, loff_t *ppos)
15992 - unsigned int minor=minor(file->f_dentry->d_inode->i_rdev);
15993 + unsigned int minor=iminor(file->f_dentry->d_inode);
15994 struct parport *port = lp_table[minor].dev->port;
15995 ssize_t retval = 0;
15996 char *kbuf = lp_table[minor].lp_buffer;
15997 @@ -483,7 +483,7 @@
15999 static int lp_open(struct inode * inode, struct file * file)
16001 - unsigned int minor = minor(inode->i_rdev);
16002 + unsigned int minor = iminor(inode);
16004 if (minor >= LP_NO)
16006 @@ -540,7 +540,7 @@
16008 static int lp_release(struct inode * inode, struct file * file)
16010 - unsigned int minor = minor(inode->i_rdev);
16011 + unsigned int minor = iminor(inode);
16013 lp_claim_parport_or_block (&lp_table[minor]);
16014 parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);
16015 @@ -555,7 +555,7 @@
16016 static int lp_ioctl(struct inode *inode, struct file *file,
16017 unsigned int cmd, unsigned long arg)
16019 - unsigned int minor = minor(inode->i_rdev);
16020 + unsigned int minor = iminor(inode);
16024 diff -Nru a/drivers/char/lp_old98.c b/drivers/char/lp_old98.c
16025 --- a/drivers/char/lp_old98.c Thu Apr 24 03:30:40 2003
16026 +++ b/drivers/char/lp_old98.c Tue Aug 26 09:25:41 2003
16027 @@ -219,7 +219,7 @@
16029 static int lp_old98_open(struct inode * inode, struct file * file)
16031 - if (minor(inode->i_rdev) != 0)
16032 + if (iminor(inode) != 0)
16035 if (lp.flags & LP_BUSY)
16036 diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
16037 --- a/drivers/char/mem.c Tue Jun 10 23:33:17 2003
16038 +++ b/drivers/char/mem.c Tue Aug 26 09:25:41 2003
16039 @@ -607,7 +607,7 @@
16041 static int memory_open(struct inode * inode, struct file * filp)
16043 - switch (minor(inode->i_rdev)) {
16044 + switch (iminor(inode)) {
16046 filp->f_op = &mem_fops;
16048 diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
16049 --- a/drivers/char/misc.c Sat May 17 12:39:13 2003
16050 +++ b/drivers/char/misc.c Tue Aug 26 09:25:41 2003
16051 @@ -100,7 +100,7 @@
16053 static int misc_open(struct inode * inode, struct file * file)
16055 - int minor = minor(inode->i_rdev);
16056 + int minor = iminor(inode);
16057 struct miscdevice *c;
16059 struct file_operations *old_fops, *new_fops = NULL;
16060 diff -Nru a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
16061 --- a/drivers/char/n_hdlc.c Fri May 30 19:53:01 2003
16062 +++ b/drivers/char/n_hdlc.c Sun Aug 31 16:14:27 2003
16063 @@ -182,9 +182,9 @@
16065 /* TTY callbacks */
16067 -static int n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
16068 +static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
16069 __u8 *buf, size_t nr);
16070 -static int n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
16071 +static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
16072 const __u8 *buf, size_t nr);
16073 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
16074 unsigned int cmd, unsigned long arg);
16075 @@ -572,7 +572,7 @@
16077 * Returns the number of bytes returned or error code.
16079 -static int n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
16080 +static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
16081 __u8 *buf, size_t nr)
16083 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
16084 @@ -649,7 +649,7 @@
16086 * Returns the number of bytes written (or error code).
16088 -static int n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
16089 +static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
16090 const __u8 *data, size_t count)
16092 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
16093 @@ -658,7 +658,7 @@
16094 struct n_hdlc_buf *tbuf;
16096 if (debuglevel >= DEBUG_LEVEL_INFO)
16097 - printk("%s(%d)n_hdlc_tty_write() called count=%d\n",
16098 + printk("%s(%d)n_hdlc_tty_write() called count=%Zd\n",
16099 __FILE__,__LINE__,count);
16101 /* Verify pointers */
16102 @@ -673,7 +673,7 @@
16103 if (debuglevel & DEBUG_LEVEL_INFO)
16104 printk (KERN_WARNING
16105 "n_hdlc_tty_write: truncating user packet "
16106 - "from %lu to %d\n", (unsigned long) count,
16107 + "from %lu to %Zd\n", (unsigned long) count,
16111 diff -Nru a/drivers/char/pcxx.c b/drivers/char/pcxx.c
16112 --- a/drivers/char/pcxx.c Wed Aug 20 14:20:10 2003
16113 +++ b/drivers/char/pcxx.c Sun Aug 31 16:14:07 2003
16114 @@ -121,7 +121,7 @@
16115 MODULE_PARM(altpin, "1-4i");
16116 MODULE_PARM(numports, "1-4i");
16119 +#endif /* MODULE */
16121 static int numcards = 1;
16122 static int nbdevs = 0;
16123 diff -Nru a/drivers/char/ppdev.c b/drivers/char/ppdev.c
16124 --- a/drivers/char/ppdev.c Wed May 7 08:47:29 2003
16125 +++ b/drivers/char/ppdev.c Tue Aug 26 09:25:41 2003
16126 @@ -104,7 +104,7 @@
16127 static ssize_t pp_read (struct file * file, char * buf, size_t count,
16130 - unsigned int minor = minor (file->f_dentry->d_inode->i_rdev);
16131 + unsigned int minor = iminor(file->f_dentry->d_inode);
16132 struct pp_struct *pp = file->private_data;
16134 ssize_t bytes_read = 0;
16135 @@ -187,7 +187,7 @@
16136 static ssize_t pp_write (struct file * file, const char * buf, size_t count,
16139 - unsigned int minor = minor (file->f_dentry->d_inode->i_rdev);
16140 + unsigned int minor = iminor(file->f_dentry->d_inode);
16141 struct pp_struct *pp = file->private_data;
16143 ssize_t bytes_written = 0;
16144 @@ -330,7 +330,7 @@
16145 static int pp_ioctl(struct inode *inode, struct file *file,
16146 unsigned int cmd, unsigned long arg)
16148 - unsigned int minor = minor(inode->i_rdev);
16149 + unsigned int minor = iminor(inode);
16150 struct pp_struct *pp = file->private_data;
16151 struct parport * port;
16153 @@ -638,7 +638,7 @@
16155 static int pp_open (struct inode * inode, struct file * file)
16157 - unsigned int minor = minor (inode->i_rdev);
16158 + unsigned int minor = iminor(inode);
16159 struct pp_struct *pp;
16161 if (minor >= PARPORT_MAX)
16162 @@ -667,7 +667,7 @@
16164 static int pp_release (struct inode * inode, struct file * file)
16166 - unsigned int minor = minor (inode->i_rdev);
16167 + unsigned int minor = iminor(inode);
16168 struct pp_struct *pp = file->private_data;
16171 diff -Nru a/drivers/char/random.c b/drivers/char/random.c
16172 --- a/drivers/char/random.c Wed Aug 6 10:59:31 2003
16173 +++ b/drivers/char/random.c Sun Aug 31 16:13:54 2003
16174 @@ -269,9 +269,9 @@
16177 * The minimum number of bits of entropy before we wake up a read on
16178 - * /dev/random. Should always be at least 8, or at least 1 byte.
16179 + * /dev/random. Should be enough to do a significant reseed.
16181 -static int random_read_wakeup_thresh = 8;
16182 +static int random_read_wakeup_thresh = 64;
16185 * If the entropy count falls under this number of bits, then we
16186 @@ -483,9 +483,9 @@
16190 - int extract_count;
16191 struct poolinfo poolinfo;
16197 @@ -502,7 +502,7 @@
16199 poolwords = (size + 3) / 4; /* Convert bytes->words */
16200 /* The pool size must be a multiple of 16 32-bit words */
16201 - poolwords = ((poolwords + 15) / 16) * 16;
16202 + poolwords = ((poolwords + 15) / 16) * 16;
16204 for (p = poolinfo_table; p->poolwords; p++) {
16205 if (poolwords == p->poolwords)
16206 @@ -524,6 +524,7 @@
16209 memset(r->pool, 0, POOLBYTES);
16210 + r->lock = SPIN_LOCK_UNLOCKED;
16214 @@ -534,7 +535,6 @@
16216 r->entropy_count = 0;
16217 r->input_rotate = 0;
16218 - r->extract_count = 0;
16219 memset(r->pool, 0, r->poolinfo.POOLBYTES);
16221 #ifdef CONFIG_SYSCTL
16222 @@ -565,6 +565,9 @@
16224 int wordmask = r->poolinfo.poolwords - 1;
16226 + unsigned long flags;
16228 + spin_lock_irqsave(&r->lock, flags);
16231 w = rotate_left(r->input_rotate, *in++);
16232 @@ -589,6 +592,8 @@
16234 r->pool[i] = (w >> 3) ^ twist_table[w & 7];
16237 + spin_unlock_irqrestore(&r->lock, flags);
16241 @@ -596,6 +601,10 @@
16243 static void credit_entropy_store(struct entropy_store *r, int nbits)
16245 + unsigned long flags;
16247 + spin_lock_irqsave(&r->lock, flags);
16249 if (r->entropy_count + nbits < 0) {
16250 DEBUG_ENT("negative entropy/overflow (%d+%d)\n",
16251 r->entropy_count, nbits);
16252 @@ -605,11 +614,15 @@
16254 r->entropy_count += nbits;
16256 - DEBUG_ENT("%s added %d bits, now %d\n",
16257 + DEBUG_ENT("%04d %04d : added %d bits to %s\n",
16258 + random_state->entropy_count,
16259 + sec_random_state->entropy_count,
16261 r == sec_random_state ? "secondary" :
16262 - r == random_state ? "primary" : "unknown",
16263 - nbits, r->entropy_count);
16264 + r == random_state ? "primary" : "unknown");
16267 + spin_unlock_irqrestore(&r->lock, flags);
16270 /**********************************************************************
16271 @@ -620,27 +633,33 @@
16273 **********************************************************************/
16275 -static __u32 *batch_entropy_pool;
16276 -static int *batch_entropy_credit;
16277 -static int batch_max;
16283 +static struct sample *batch_entropy_pool, *batch_entropy_copy;
16284 static int batch_head, batch_tail;
16285 +static spinlock_t batch_lock = SPIN_LOCK_UNLOCKED;
16287 +static int batch_max;
16288 static void batch_entropy_process(void *private_);
16289 static DECLARE_WORK(batch_work, batch_entropy_process, NULL);
16291 /* note: the size must be a power of 2 */
16292 static int __init batch_entropy_init(int size, struct entropy_store *r)
16294 - batch_entropy_pool = kmalloc(2*size*sizeof(__u32), GFP_KERNEL);
16295 + batch_entropy_pool = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
16296 if (!batch_entropy_pool)
16298 - batch_entropy_credit =kmalloc(size*sizeof(int), GFP_KERNEL);
16299 - if (!batch_entropy_credit) {
16300 + batch_entropy_copy = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
16301 + if (!batch_entropy_copy) {
16302 kfree(batch_entropy_pool);
16305 batch_head = batch_tail = 0;
16306 - batch_max = size;
16307 batch_work.data = r;
16308 + batch_max = size;
16312 @@ -652,27 +671,33 @@
16314 void batch_entropy_store(u32 a, u32 b, int num)
16318 + unsigned long flags;
16323 - batch_entropy_pool[2*batch_head] = a;
16324 - batch_entropy_pool[(2*batch_head) + 1] = b;
16325 - batch_entropy_credit[batch_head] = num;
16327 - new = (batch_head+1) & (batch_max-1);
16328 - if ((unsigned)(new - batch_tail) >= (unsigned)(batch_max / 2)) {
16329 + spin_lock_irqsave(&batch_lock, flags);
16331 + batch_entropy_pool[batch_head].data[0] = a;
16332 + batch_entropy_pool[batch_head].data[1] = b;
16333 + batch_entropy_pool[batch_head].credit = num;
16335 + if (((batch_head - batch_tail) & (batch_max-1)) >= (batch_max / 2)) {
16337 * Schedule it for the next timer tick:
16339 schedule_delayed_work(&batch_work, 1);
16340 - batch_head = new;
16341 - } else if (new == batch_tail) {
16344 + new = (batch_head+1) & (batch_max-1);
16345 + if (new == batch_tail) {
16346 DEBUG_ENT("batch entropy buffer full\n");
16351 + spin_unlock_irqrestore(&batch_lock, flags);
16355 @@ -684,20 +709,34 @@
16357 struct entropy_store *r = (struct entropy_store *) private_, *p;
16358 int max_entropy = r->poolinfo.POOLBITS;
16359 + unsigned head, tail;
16363 + /* Mixing into the pool is expensive, so copy over the batch
16364 + * data and release the batch lock. The pool is at least half
16365 + * full, so don't worry too much about copying only the used
16368 + spin_lock_irq(&batch_lock);
16370 + memcpy(batch_entropy_copy, batch_entropy_pool,
16371 + batch_max*sizeof(struct sample));
16373 + head = batch_head;
16374 + tail = batch_tail;
16375 + batch_tail = batch_head;
16377 + spin_unlock_irq(&batch_lock);
16380 - while (batch_head != batch_tail) {
16381 + while (head != tail) {
16382 if (r->entropy_count >= max_entropy) {
16383 r = (r == sec_random_state) ? random_state :
16385 max_entropy = r->poolinfo.POOLBITS;
16387 - add_entropy_words(r, batch_entropy_pool + 2*batch_tail, 2);
16388 - credit_entropy_store(r, batch_entropy_credit[batch_tail]);
16389 - batch_tail = (batch_tail+1) & (batch_max-1);
16390 + add_entropy_words(r, batch_entropy_copy[tail].data, 2);
16391 + credit_entropy_store(r, batch_entropy_copy[tail].credit);
16392 + tail = (tail+1) & (batch_max-1);
16394 if (p->entropy_count >= random_read_wakeup_thresh)
16395 wake_up_interruptible(&random_read_wait);
16396 @@ -1216,6 +1255,7 @@
16398 #define EXTRACT_ENTROPY_USER 1
16399 #define EXTRACT_ENTROPY_SECONDARY 2
16400 +#define EXTRACT_ENTROPY_LIMIT 4
16401 #define TMP_BUF_SIZE (HASH_BUFFER_SIZE + HASH_EXTRA_SIZE)
16402 #define SEC_XFER_SIZE (TMP_BUF_SIZE*4)
16404 @@ -1224,36 +1264,28 @@
16407 * This utility inline function is responsible for transfering entropy
16408 - * from the primary pool to the secondary extraction pool. We pull
16409 - * randomness under two conditions; one is if there isn't enough entropy
16410 - * in the secondary pool. The other is after we have extracted 1024 bytes,
16411 - * at which point we do a "catastrophic reseeding".
16412 + * from the primary pool to the secondary extraction pool. We make
16413 + * sure we pull enough for a 'catastrophic reseed'.
16415 static inline void xfer_secondary_pool(struct entropy_store *r,
16416 size_t nbytes, __u32 *tmp)
16418 if (r->entropy_count < nbytes * 8 &&
16419 r->entropy_count < r->poolinfo.POOLBITS) {
16420 - int nwords = min_t(int,
16421 - r->poolinfo.poolwords - r->entropy_count/32,
16422 - sizeof(tmp) / 4);
16423 + int bytes = max_t(int, random_read_wakeup_thresh / 8,
16424 + min_t(int, nbytes, TMP_BUF_SIZE));
16426 - DEBUG_ENT("xfer %d from primary to %s (have %d, need %d)\n",
16428 + DEBUG_ENT("%04d %04d : going to reseed %s with %d bits "
16429 + "(%d of %d requested)\n",
16430 + random_state->entropy_count,
16431 + sec_random_state->entropy_count,
16432 r == sec_random_state ? "secondary" : "unknown",
16433 - r->entropy_count, nbytes * 8);
16434 + bytes * 8, nbytes * 8, r->entropy_count);
16436 - extract_entropy(random_state, tmp, nwords * 4, 0);
16437 - add_entropy_words(r, tmp, nwords);
16438 - credit_entropy_store(r, nwords * 32);
16440 - if (r->extract_count > 1024) {
16441 - DEBUG_ENT("reseeding %s with %d from primary\n",
16442 - r == sec_random_state ? "secondary" : "unknown",
16443 - sizeof(tmp) * 8);
16444 - extract_entropy(random_state, tmp, sizeof(tmp), 0);
16445 - add_entropy_words(r, tmp, sizeof(tmp) / 4);
16446 - r->extract_count = 0;
16447 + bytes=extract_entropy(random_state, tmp, bytes,
16448 + EXTRACT_ENTROPY_LIMIT);
16449 + add_entropy_words(r, tmp, bytes);
16450 + credit_entropy_store(r, bytes*8);
16454 @@ -1276,8 +1308,8 @@
16456 __u32 tmp[TMP_BUF_SIZE];
16458 + unsigned long cpuflags;
16460 - add_timer_randomness(&extract_timer_state, nbytes);
16462 /* Redundant, but just in case... */
16463 if (r->entropy_count > r->poolinfo.POOLBITS)
16464 @@ -1286,10 +1318,18 @@
16465 if (flags & EXTRACT_ENTROPY_SECONDARY)
16466 xfer_secondary_pool(r, nbytes, tmp);
16468 - DEBUG_ENT("%s has %d bits, want %d bits\n",
16469 + /* Hold lock while accounting */
16470 + spin_lock_irqsave(&r->lock, cpuflags);
16472 + DEBUG_ENT("%04d %04d : trying to extract %d bits from %s\n",
16473 + random_state->entropy_count,
16474 + sec_random_state->entropy_count,
16476 r == sec_random_state ? "secondary" :
16477 - r == random_state ? "primary" : "unknown",
16478 - r->entropy_count, nbytes * 8);
16479 + r == random_state ? "primary" : "unknown");
16481 + if (flags & EXTRACT_ENTROPY_LIMIT && nbytes >= r->entropy_count / 8)
16482 + nbytes = r->entropy_count / 8;
16484 if (r->entropy_count / 8 >= nbytes)
16485 r->entropy_count -= nbytes*8;
16486 @@ -1299,8 +1339,16 @@
16487 if (r->entropy_count < random_write_wakeup_thresh)
16488 wake_up_interruptible(&random_write_wait);
16490 - r->extract_count += nbytes;
16492 + DEBUG_ENT("%04d %04d : debiting %d bits from %s%s\n",
16493 + random_state->entropy_count,
16494 + sec_random_state->entropy_count,
16496 + r == sec_random_state ? "secondary" :
16497 + r == random_state ? "primary" : "unknown",
16498 + flags & EXTRACT_ENTROPY_LIMIT ? "" : " (unlimited)");
16500 + spin_unlock_irqrestore(&r->lock, cpuflags);
16505 @@ -1312,7 +1360,16 @@
16506 ret = -ERESTARTSYS;
16510 + DEBUG_ENT("%04d %04d : extract feeling sleepy (%d bytes left)\n",
16511 + random_state->entropy_count,
16512 + sec_random_state->entropy_count, nbytes);
16516 + DEBUG_ENT("%04d %04d : extract woke up\n",
16517 + random_state->entropy_count,
16518 + sec_random_state->entropy_count);
16521 /* Hash the pool to get the output */
16522 @@ -1361,7 +1418,6 @@
16526 - add_timer_randomness(&extract_timer_state, nbytes);
16529 /* Wipe data just returned from memory */
16530 @@ -1488,15 +1544,27 @@
16534 - add_wait_queue(&random_read_wait, &wait);
16535 while (nbytes > 0) {
16536 - set_current_state(TASK_INTERRUPTIBLE);
16539 if (n > SEC_XFER_SIZE)
16541 - if (n > random_state->entropy_count / 8)
16542 - n = random_state->entropy_count / 8;
16544 + DEBUG_ENT("%04d %04d : reading %d bits, p: %d s: %d\n",
16545 + random_state->entropy_count,
16546 + sec_random_state->entropy_count,
16547 + n*8, random_state->entropy_count,
16548 + sec_random_state->entropy_count);
16550 + n = extract_entropy(sec_random_state, buf, n,
16551 + EXTRACT_ENTROPY_USER |
16552 + EXTRACT_ENTROPY_LIMIT |
16553 + EXTRACT_ENTROPY_SECONDARY);
16555 + DEBUG_ENT("%04d %04d : read got %d bits (%d still needed)\n",
16556 + random_state->entropy_count,
16557 + sec_random_state->entropy_count,
16558 + n*8, (nbytes-n)*8);
16561 if (file->f_flags & O_NONBLOCK) {
16563 @@ -1506,12 +1574,27 @@
16564 retval = -ERESTARTSYS;
16569 + DEBUG_ENT("%04d %04d : sleeping?\n",
16570 + random_state->entropy_count,
16571 + sec_random_state->entropy_count);
16573 + set_current_state(TASK_INTERRUPTIBLE);
16574 + add_wait_queue(&random_read_wait, &wait);
16576 + if (sec_random_state->entropy_count / 8 == 0)
16579 + set_current_state(TASK_RUNNING);
16580 + remove_wait_queue(&random_read_wait, &wait);
16582 + DEBUG_ENT("%04d %04d : waking up\n",
16583 + random_state->entropy_count,
16584 + sec_random_state->entropy_count);
16588 - n = extract_entropy(sec_random_state, buf, n,
16589 - EXTRACT_ENTROPY_USER |
16590 - EXTRACT_ENTROPY_SECONDARY);
16595 @@ -1522,8 +1605,6 @@
16596 break; /* This break makes the device work */
16597 /* like a named pipe */
16599 - current->state = TASK_RUNNING;
16600 - remove_wait_queue(&random_read_wait, &wait);
16603 * If we gave the user some bytes, update the access time.
16604 @@ -1595,8 +1676,9 @@
16605 random_ioctl(struct inode * inode, struct file * file,
16606 unsigned int cmd, unsigned long arg)
16608 - int *p, size, ent_count;
16609 + int *p, *tmp, size, ent_count;
16611 + unsigned long flags;
16615 @@ -1621,17 +1703,36 @@
16616 if (!capable(CAP_SYS_ADMIN))
16619 - ent_count = random_state->entropy_count;
16620 - if (put_user(ent_count, p++) ||
16621 - get_user(size, p) ||
16622 + if (get_user(size, p) ||
16623 put_user(random_state->poolinfo.poolwords, p++))
16628 if (size > random_state->poolinfo.poolwords)
16629 size = random_state->poolinfo.poolwords;
16630 - if (copy_to_user(p, random_state->pool, size * sizeof(__u32)))
16632 + /* prepare to atomically snapshot pool */
16634 + tmp = kmalloc(size * sizeof(__u32), GFP_KERNEL);
16639 + spin_lock_irqsave(&random_state->lock, flags);
16640 + ent_count = random_state->entropy_count;
16641 + memcpy(tmp, random_state->pool, size * sizeof(__u32));
16642 + spin_unlock_irqrestore(&random_state->lock, flags);
16644 + if (!copy_to_user(p, tmp, size * sizeof(__u32))) {
16651 + if(put_user(ent_count, p++))
16655 case RNDADDENTROPY:
16656 if (!capable(CAP_SYS_ADMIN))
16657 diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c
16658 --- a/drivers/char/raw.c Fri Jun 20 13:16:17 2003
16659 +++ b/drivers/char/raw.c Sun Aug 31 16:14:45 2003
16662 static int raw_open(struct inode *inode, struct file *filp)
16664 - const int minor = minor(inode->i_rdev);
16665 + const int minor = iminor(inode);
16666 struct block_device *bdev;
16669 @@ -60,23 +60,25 @@
16670 bdev = raw_devices[minor].binding;
16673 - err = bd_claim(bdev, raw_open);
16674 + err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
16677 - atomic_inc(&bdev->bd_count);
16678 - err = blkdev_get(bdev, filp->f_mode, 0, BDEV_RAW);
16679 + igrab(bdev->bd_inode);
16680 + err = bd_claim(bdev, raw_open);
16682 + blkdev_put(bdev, BDEV_RAW);
16685 + err = set_blocksize(bdev, bdev_hardsect_size(bdev));
16688 + blkdev_put(bdev, BDEV_RAW);
16691 - err = set_blocksize(bdev, bdev_hardsect_size(bdev));
16693 - filp->f_flags |= O_DIRECT;
16694 - if (++raw_devices[minor].inuse == 1)
16695 - filp->f_dentry->d_inode->i_mapping =
16696 - bdev->bd_inode->i_mapping;
16699 + filp->f_flags |= O_DIRECT;
16700 + if (++raw_devices[minor].inuse == 1)
16701 + filp->f_dentry->d_inode->i_mapping =
16702 + bdev->bd_inode->i_mapping;
16704 filp->private_data = bdev;
16708 static int raw_release(struct inode *inode, struct file *filp)
16710 - const int minor= minor(inode->i_rdev);
16711 + const int minor= iminor(inode);
16712 struct block_device *bdev;
16715 diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c
16716 --- a/drivers/char/rtc.c Tue Aug 12 13:25:18 2003
16717 +++ b/drivers/char/rtc.c Sun Aug 31 16:15:40 2003
16718 @@ -44,10 +44,12 @@
16719 * 1.11 Takashi Iwai: Kernel access functions
16720 * rtc_register/rtc_unregister/rtc_control
16721 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init
16722 + * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
16723 + * CONFIG_HPET_EMULATE_RTC
16727 -#define RTC_VERSION "1.11a"
16728 +#define RTC_VERSION "1.12"
16730 #define RTC_IO_EXTENT 0x8
16733 #include <asm/uaccess.h>
16734 #include <asm/system.h>
16736 +#if defined(__i386__)
16737 +#include <asm/hpet.h>
16741 #include <linux/pci.h>
16742 #include <asm/ebus.h>
16743 @@ -95,6 +101,17 @@
16744 static int rtc_has_irq = 1;
16747 +#ifndef CONFIG_HPET_EMULATE_RTC
16748 +#define is_hpet_enabled() 0
16749 +#define hpet_set_alarm_time(hrs, min, sec) 0
16750 +#define hpet_set_periodic_freq(arg) 0
16751 +#define hpet_mask_rtc_irq_bit(arg) 0
16752 +#define hpet_set_rtc_irq_bit(arg) 0
16753 +#define hpet_rtc_timer_init() do { } while (0)
16754 +#define hpet_rtc_dropped_irq() 0
16755 +static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) {return 0;}
16759 * We sponge a minor off of the misc major. No need slurping
16760 * up another valuable major dev number for this. If you add
16761 @@ -120,7 +137,7 @@
16762 static unsigned int rtc_poll(struct file *file, poll_table *wait);
16765 -static void get_rtc_time (struct rtc_time *rtc_tm);
16766 +void get_rtc_time (struct rtc_time *rtc_tm);
16767 static void get_rtc_alm_time (struct rtc_time *alm_tm);
16769 static void rtc_dropped_irq(unsigned long data);
16770 @@ -182,7 +199,7 @@
16771 * (See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.)
16774 -static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
16775 +irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
16778 * Can be an alarm interrupt, update complete interrupt,
16779 @@ -194,7 +211,16 @@
16780 spin_lock (&rtc_lock);
16781 rtc_irq_data += 0x100;
16782 rtc_irq_data &= ~0xff;
16783 - rtc_irq_data |= (CMOS_READ(RTC_INTR_FLAGS) & 0xF0);
16784 + if (is_hpet_enabled()) {
16786 + * In this case it is HPET RTC interrupt handler
16787 + * calling us, with the interrupt information
16788 + * passed as arg1, instead of irq.
16790 + rtc_irq_data |= (unsigned long)irq & 0xF0;
16792 + rtc_irq_data |= (CMOS_READ(RTC_INTR_FLAGS) & 0xF0);
16795 if (rtc_status & RTC_TIMER_ON)
16796 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq + 2*HZ/100);
16797 @@ -429,6 +455,12 @@
16798 sec = alm_tm.tm_sec;
16800 spin_lock_irq(&rtc_lock);
16801 + if (hpet_set_alarm_time(hrs, min, sec)) {
16803 + * Fallthru and set alarm time in CMOS too,
16804 + * so that we will get proper value in RTC_ALM_READ
16807 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) ||
16810 @@ -582,6 +614,10 @@
16813 spin_lock_irq(&rtc_lock);
16814 + if (hpet_set_periodic_freq(arg)) {
16815 + spin_unlock_irq(&rtc_lock);
16820 val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0;
16821 @@ -667,13 +703,14 @@
16824 spin_lock_irq(&rtc_lock);
16825 - tmp = CMOS_READ(RTC_CONTROL);
16829 - CMOS_WRITE(tmp, RTC_CONTROL);
16830 - CMOS_READ(RTC_INTR_FLAGS);
16832 + if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
16833 + tmp = CMOS_READ(RTC_CONTROL);
16837 + CMOS_WRITE(tmp, RTC_CONTROL);
16838 + CMOS_READ(RTC_INTR_FLAGS);
16840 if (rtc_status & RTC_TIMER_ON) {
16841 rtc_status &= ~RTC_TIMER_ON;
16842 del_timer(&rtc_irq_timer);
16843 @@ -765,12 +802,14 @@
16844 rtc_callback = NULL;
16846 /* disable controls */
16847 - tmp = CMOS_READ(RTC_CONTROL);
16851 - CMOS_WRITE(tmp, RTC_CONTROL);
16852 - CMOS_READ(RTC_INTR_FLAGS);
16853 + if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
16854 + tmp = CMOS_READ(RTC_CONTROL);
16858 + CMOS_WRITE(tmp, RTC_CONTROL);
16859 + CMOS_READ(RTC_INTR_FLAGS);
16861 if (rtc_status & RTC_TIMER_ON) {
16862 rtc_status &= ~RTC_TIMER_ON;
16863 del_timer(&rtc_irq_timer);
16864 @@ -822,6 +861,10 @@
16869 +static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs);
16872 static int __init rtc_init(void)
16874 #if defined(__alpha__) || defined(__mips__)
16875 @@ -889,12 +932,20 @@
16879 - if (request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL)) {
16880 + if (is_hpet_enabled()) {
16881 + rtc_int_handler_ptr = hpet_rtc_interrupt;
16883 + rtc_int_handler_ptr = rtc_interrupt;
16886 + if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) {
16887 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
16888 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
16889 release_region(RTC_PORT(0), RTC_IO_EXTENT);
16892 + hpet_rtc_timer_init();
16896 #endif /* __sparc__ vs. others */
16897 @@ -965,10 +1016,12 @@
16898 init_timer(&rtc_irq_timer);
16899 rtc_irq_timer.function = rtc_dropped_irq;
16900 spin_lock_irq(&rtc_lock);
16901 - /* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
16902 - CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
16903 - spin_unlock_irq(&rtc_lock);
16905 + if (!hpet_set_periodic_freq(rtc_freq)) {
16906 + /* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
16907 + CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
16909 + spin_unlock_irq(&rtc_lock);
16913 @@ -1019,6 +1072,11 @@
16915 spin_lock_irq (&rtc_lock);
16917 + if (hpet_rtc_dropped_irq()) {
16918 + spin_unlock_irq(&rtc_lock);
16922 /* Just in case someone disabled the timer from behind our back... */
16923 if (rtc_status & RTC_TIMER_ON)
16924 mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq + 2*HZ/100);
16925 @@ -1148,7 +1206,7 @@
16929 -static void get_rtc_time(struct rtc_time *rtc_tm)
16930 +void get_rtc_time(struct rtc_time *rtc_tm)
16932 unsigned long uip_watchdog = jiffies;
16933 unsigned char ctrl;
16934 @@ -1254,6 +1312,10 @@
16937 spin_lock_irq(&rtc_lock);
16938 + if (hpet_mask_rtc_irq_bit(bit)) {
16939 + spin_unlock_irq(&rtc_lock);
16942 val = CMOS_READ(RTC_CONTROL);
16944 CMOS_WRITE(val, RTC_CONTROL);
16945 @@ -1268,6 +1330,10 @@
16948 spin_lock_irq(&rtc_lock);
16949 + if (hpet_set_rtc_irq_bit(bit)) {
16950 + spin_unlock_irq(&rtc_lock);
16953 val = CMOS_READ(RTC_CONTROL);
16955 CMOS_WRITE(val, RTC_CONTROL);
16956 diff -Nru a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
16957 --- a/drivers/char/scx200_gpio.c Sat Dec 7 08:54:07 2002
16958 +++ b/drivers/char/scx200_gpio.c Tue Aug 26 09:25:41 2003
16960 static ssize_t scx200_gpio_write(struct file *file, const char *data,
16961 size_t len, loff_t *ppos)
16963 - unsigned m = minor(file->f_dentry->d_inode->i_rdev);
16964 + unsigned m = iminor(file->f_dentry->d_inode);
16967 if (ppos != &file->f_pos)
16969 static ssize_t scx200_gpio_read(struct file *file, char *buf,
16970 size_t len, loff_t *ppos)
16972 - unsigned m = minor(file->f_dentry->d_inode->i_rdev);
16973 + unsigned m = iminor(file->f_dentry->d_inode);
16976 if (ppos != &file->f_pos)
16979 static int scx200_gpio_open(struct inode *inode, struct file *file)
16981 - unsigned m = minor(inode->i_rdev);
16982 + unsigned m = iminor(inode);
16986 diff -Nru a/drivers/char/sonypi.c b/drivers/char/sonypi.c
16987 --- a/drivers/char/sonypi.c Fri Jun 13 07:30:24 2003
16988 +++ b/drivers/char/sonypi.c Fri Aug 1 05:36:14 2003
16989 @@ -308,7 +308,7 @@
16992 v1 = inb_p(sonypi_device.ioport1);
16993 - v2 = inb_p(sonypi_device.ioport2);
16994 + v2 = inb_p(sonypi_device.ioport1 + sonypi_device.evtype_offset);
16996 for (i = 0; sonypi_eventtypes[i].model; i++) {
16997 if (sonypi_device.model != sonypi_eventtypes[i].model)
16998 @@ -670,11 +670,13 @@
16999 if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2) {
17000 ioport_list = sonypi_type2_ioport_list;
17001 sonypi_device.region_size = SONYPI_TYPE2_REGION_SIZE;
17002 + sonypi_device.evtype_offset = SONYPI_TYPE2_EVTYPE_OFFSET;
17003 irq_list = sonypi_type2_irq_list;
17006 ioport_list = sonypi_type1_ioport_list;
17007 sonypi_device.region_size = SONYPI_TYPE1_REGION_SIZE;
17008 + sonypi_device.evtype_offset = SONYPI_TYPE1_EVTYPE_OFFSET;
17009 irq_list = sonypi_type1_irq_list;
17012 diff -Nru a/drivers/char/sonypi.h b/drivers/char/sonypi.h
17013 --- a/drivers/char/sonypi.h Tue Jun 10 03:03:28 2003
17014 +++ b/drivers/char/sonypi.h Mon Sep 1 03:37:24 2003
17015 @@ -56,12 +56,14 @@
17016 #define SONYPI_BASE 0x50
17017 #define SONYPI_G10A (SONYPI_BASE+0x14)
17018 #define SONYPI_TYPE1_REGION_SIZE 0x08
17019 +#define SONYPI_TYPE1_EVTYPE_OFFSET 0x04
17021 /* type2 series specifics */
17022 #define SONYPI_SIRQ 0x9b
17023 #define SONYPI_SLOB 0x9c
17024 #define SONYPI_SHIB 0x9d
17025 #define SONYPI_TYPE2_REGION_SIZE 0x20
17026 +#define SONYPI_TYPE2_EVTYPE_OFFSET 0x12
17028 /* battery / brightness addresses */
17029 #define SONYPI_BAT_FLAGS 0x81
17030 @@ -167,6 +169,7 @@
17031 #define SONYPI_THUMBPHRASE_MASK 0x00000200
17032 #define SONYPI_MEYE_MASK 0x00000400
17033 #define SONYPI_MEMORYSTICK_MASK 0x00000800
17034 +#define SONYPI_BATTERY_MASK 0x00001000
17036 struct sonypi_event {
17038 @@ -293,6 +296,13 @@
17042 +/* The set of possible battery events */
17043 +static struct sonypi_event sonypi_batteryev[] = {
17044 + { 0x20, SONYPI_EVENT_BATTERY_INSERT },
17045 + { 0x30, SONYPI_EVENT_BATTERY_REMOVE },
17049 struct sonypi_eventtypes {
17052 @@ -307,19 +317,22 @@
17053 { SONYPI_DEVICE_MODEL_TYPE1, 0x20, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
17054 { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
17055 { SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_PKEY_MASK, sonypi_pkeyev },
17056 + { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
17057 + { SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_BATTERY_MASK, sonypi_batteryev },
17059 { SONYPI_DEVICE_MODEL_TYPE2, 0, 0xffffffff, sonypi_releaseev },
17060 { SONYPI_DEVICE_MODEL_TYPE2, 0x38, SONYPI_LID_MASK, sonypi_lidev },
17061 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_JOGGER_MASK, sonypi_joggerev },
17062 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_CAPTURE_MASK, sonypi_captureev },
17063 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
17064 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
17065 + { SONYPI_DEVICE_MODEL_TYPE2, 0x11, SONYPI_JOGGER_MASK, sonypi_joggerev },
17066 + { SONYPI_DEVICE_MODEL_TYPE2, 0x61, SONYPI_CAPTURE_MASK, sonypi_captureev },
17067 + { SONYPI_DEVICE_MODEL_TYPE2, 0x21, SONYPI_FNKEY_MASK, sonypi_fnkeyev },
17068 + { SONYPI_DEVICE_MODEL_TYPE2, 0x31, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
17069 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_PKEY_MASK, sonypi_pkeyev },
17070 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_BACK_MASK, sonypi_backev },
17071 + { SONYPI_DEVICE_MODEL_TYPE2, 0x11, SONYPI_BACK_MASK, sonypi_backev },
17072 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_HELP_MASK, sonypi_helpev },
17073 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_ZOOM_MASK, sonypi_zoomev },
17074 { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_THUMBPHRASE_MASK, sonypi_thumbphraseev },
17075 - { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
17076 + { SONYPI_DEVICE_MODEL_TYPE2, 0x31, SONYPI_MEMORYSTICK_MASK, sonypi_memorystickev },
17077 + { SONYPI_DEVICE_MODEL_TYPE2, 0x41, SONYPI_BATTERY_MASK, sonypi_batteryev },
17081 @@ -354,6 +367,7 @@
17085 + u16 evtype_offset;
17087 int bluetooth_power;
17088 struct semaphore lock;
17089 diff -Nru a/drivers/char/stallion.c b/drivers/char/stallion.c
17090 --- a/drivers/char/stallion.c Wed Jul 30 04:37:51 2003
17091 +++ b/drivers/char/stallion.c Sun Aug 24 05:39:23 2003
17092 @@ -3078,7 +3078,7 @@
17093 (int) fp, cmd, (int) arg);
17096 - brdnr = minor(ip->i_rdev);
17097 + brdnr = iminor(ip);
17098 if (brdnr >= STL_MAXBRDS)
17101 @@ -4234,7 +4234,7 @@
17102 misr = inb(ioaddr + EREG_DATA);
17103 if (misr & MISR_DCD) {
17104 set_bit(ASYI_DCDCHANGE, &portp->istate);
17105 - schedule_task(&portp->tqueue);
17106 + schedule_work(&portp->tqueue);
17107 portp->stats.modem++;
17110 @@ -5031,7 +5031,7 @@
17111 if ((len == 0) || ((len < STL_TXBUFLOW) &&
17112 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
17113 set_bit(ASYI_TXLOW, &portp->istate);
17114 - schedule_task(&portp->tqueue);
17115 + schedule_work(&portp->tqueue);
17119 @@ -5248,7 +5248,7 @@
17120 ipr = stl_sc26198getreg(portp, IPR);
17121 if (ipr & IPR_DCDCHANGE) {
17122 set_bit(ASYI_DCDCHANGE, &portp->istate);
17123 - schedule_task(&portp->tqueue);
17124 + schedule_work(&portp->tqueue);
17125 portp->stats.modem++;
17128 diff -Nru a/drivers/char/tipar.c b/drivers/char/tipar.c
17129 --- a/drivers/char/tipar.c Wed May 7 08:47:30 2003
17130 +++ b/drivers/char/tipar.c Tue Aug 26 09:25:41 2003
17131 @@ -248,7 +248,7 @@
17133 tipar_open(struct inode *inode, struct file *file)
17135 - unsigned int minor = minor(inode->i_rdev) - TIPAR_MINOR;
17136 + unsigned int minor = iminor(inode) - TIPAR_MINOR;
17138 if (minor > tp_count - 1)
17140 @@ -266,7 +266,7 @@
17142 tipar_close(struct inode *inode, struct file *file)
17144 - unsigned int minor = minor(inode->i_rdev) - TIPAR_MINOR;
17145 + unsigned int minor = iminor(inode) - TIPAR_MINOR;
17147 if (minor > tp_count - 1)
17149 @@ -279,8 +279,7 @@
17151 tipar_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
17153 - unsigned int minor =
17154 - minor(file->f_dentry->d_inode->i_rdev) - TIPAR_MINOR;
17155 + unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR;
17158 parport_claim_or_block(table[minor].dev);
17159 @@ -308,8 +307,7 @@
17160 tipar_read(struct file *file, char *buf, size_t count, loff_t * ppos)
17163 - unsigned int minor =
17164 - minor(file->f_dentry->d_inode->i_rdev) - TIPAR_MINOR;
17165 + unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR;
17166 ssize_t retval = 0;
17169 diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
17170 --- a/drivers/char/tpqic02.c Wed May 7 08:47:30 2003
17171 +++ b/drivers/char/tpqic02.c Tue Aug 26 09:25:41 2003
17172 @@ -169,7 +169,7 @@
17173 static volatile unsigned dma_mode; /* !=0 also means DMA in use */
17174 static flag need_rewind = YES;
17176 -static kdev_t current_tape_dev;
17177 +static int current_type;
17178 static int extra_blocks_left = BLOCKS_BEYOND_EW;
17179 static struct timer_list tp_timer;
17181 @@ -677,7 +677,7 @@
17182 * exception flag from previous exception which we are trying to clear.
17185 - if (TP_DIAGS(current_tape_dev))
17186 + if (TP_DIAGS(current_type))
17187 printk(TPQIC02_NAME ": reading status bytes: ");
17189 for (q = stp; q < stp + size; q++) {
17190 @@ -693,7 +693,7 @@
17192 *q = inb_p(QIC02_DATA_PORT); /* read status byte */
17194 - if (TP_DIAGS(current_tape_dev))
17195 + if (TP_DIAGS(current_type))
17196 printk("[%1d]=0x%x ", q - stp, (unsigned) (*q) & 0xff);
17198 outb_p(ctlbits | QIC02_CTL_REQUEST, QIC02_CTL_PORT); /* set request */
17199 @@ -714,7 +714,7 @@
17201 /* wait for ready */
17203 - if (TP_DIAGS(current_tape_dev))
17204 + if (TP_DIAGS(current_type))
17208 @@ -1614,7 +1614,7 @@
17210 if (status_expect_int) {
17211 #ifdef WANT_EXTRA_FULL_DEBUGGING
17212 - if (TP_DIAGS(current_tape_dev))
17213 + if (TP_DIAGS(current_type))
17216 stat = inb(QIC02_STAT_PORT); /* Knock, knock */
17217 @@ -1726,7 +1726,7 @@
17219 static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
17221 - kdev_t dev = filp->f_dentry->d_inode->i_rdev;
17222 + int type = iminor(filp->f_dentry->d_inode);
17223 unsigned short flags = filp->f_flags;
17224 unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
17226 @@ -1736,8 +1736,8 @@
17230 - if (TP_DIAGS(current_tape_dev))
17231 - printk(TPQIC02_NAME ": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n", minor(dev), buf,
17232 + if (TP_DIAGS(current_type))
17233 + printk(TPQIC02_NAME ": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n", type, buf,
17234 (long) count, filp->f_pos, flags);
17236 if (count % TAPE_BLKSIZE) { /* Only allow mod 512 bytes at a time. */
17237 @@ -1904,7 +1904,7 @@
17239 static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
17241 - kdev_t dev = filp->f_dentry->d_inode->i_rdev;
17242 + int type = iminor(filp->f_dentry->d_inode);
17243 unsigned short flags = filp->f_flags;
17244 unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
17246 @@ -1913,9 +1913,9 @@
17250 - if (TP_DIAGS(current_tape_dev)) {
17251 + if (TP_DIAGS(current_type)) {
17252 printk(TPQIC02_NAME ": request WRITE, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n",
17253 - minor(dev), buf, (long) count, filp->f_pos, flags);
17254 + type, buf, (long) count, filp->f_pos, flags);
17257 if (count % TAPE_BLKSIZE) { /* only allow mod 512 bytes at a time */
17258 @@ -2070,17 +2070,18 @@
17259 static int qic02_tape_open_no_use_count(struct inode *inode,
17262 - kdev_t dev = inode->i_rdev;
17263 + int type = iminor(inode);
17264 unsigned short flags = filp->f_flags;
17265 unsigned short dens = 0;
17269 - if (TP_DIAGS(dev)) {
17270 - printk("qic02_tape_open: dev=%s, flags=%x ", cdevname(dev), flags);
17271 + if (TP_DIAGS(type)) {
17272 + printk("qic02_tape_open: dev=tpqic2(%d), flags=%x ",
17276 - if (minor(dev) == 255) { /* special case for resetting */
17277 + if (type == 255) { /* special case for resetting */
17278 if (capable(CAP_SYS_ADMIN)) {
17279 return (tape_reset(1) == TE_OK) ? -EAGAIN : -ENXIO;
17281 @@ -2162,7 +2163,7 @@
17284 /* not allowed to do QCMD_DENS_* unless tape is rewound */
17285 - if ((TP_DENS(dev) != 0) && (TP_DENS(current_tape_dev) != TP_DENS(dev))) {
17286 + if ((TP_DENS(type) != 0) && (TP_DENS(current_type) != TP_DENS(type))) {
17287 /* force rewind if minor bits have changed,
17288 * i.e. user wants to use tape in different format.
17289 * [assuming single drive operation]
17290 @@ -2175,7 +2176,7 @@
17291 /* density bits still the same, but TP_DIAGS bit
17292 * may have changed.
17294 - current_tape_dev = dev;
17295 + current_type = type;
17298 if (need_rewind == YES) {
17299 @@ -2212,14 +2213,14 @@
17300 * so we must have done a rewind by now. If not, just skip over.
17301 * Only give set density command when minor bits have changed.
17303 - if (TP_DENS(current_tape_dev) == TP_DENS(dev)) {
17304 + if (TP_DENS(current_type) == TP_DENS(type)) {
17308 - current_tape_dev = dev;
17309 + current_type = type;
17311 if (TP_HAVE_DENS) {
17312 - dens = TP_DENS(dev);
17313 + dens = TP_DENS(type);
17316 if (dens < sizeof(format_names) / sizeof(char *))
17317 @@ -2227,7 +2228,7 @@
17319 tpqputs(TPQD_REWIND, "Wait for retensioning...");
17321 - switch (TP_DENS(dev)) {
17322 + switch (TP_DENS(type)) {
17323 case 0: /* Minor 0 is for drives without set-density support */
17326 @@ -2254,7 +2255,7 @@
17329 status_dead = YES; /* force reset */
17330 - current_tape_dev = NODEV;/* earlier 0xff80 */
17331 + current_type = 0;/* earlier 0xff80 */
17335 @@ -2264,10 +2265,10 @@
17337 static int qic02_tape_release(struct inode *inode, struct file *filp)
17339 - kdev_t dev = inode->i_rdev;
17340 + int type = iminor(inode);
17342 - if (TP_DIAGS(dev)) {
17343 - printk("qic02_tape_release: dev=%s\n", cdevname(dev));
17344 + if (TP_DIAGS(type)) {
17345 + printk("qic02_tape_release: dev=tpqic2(%d)\n", type);
17348 if (status_zombie == NO) { /* don't rewind in zombie mode */
17349 @@ -2283,7 +2284,7 @@
17350 /* Rewind only if minor number requires it AND
17351 * read/writes have been done. ************* IS THIS CORRECT??????????
17353 - if ((TP_REWCLOSE(dev)) && (status_bytes_rd | status_bytes_wr)) {
17354 + if (TP_REWCLOSE(type) && (status_bytes_rd | status_bytes_wr)) {
17355 tpqputs(TPQD_REWIND, "release: Doing rewind...");
17356 (void) do_qic_cmd(QCMD_REWIND, TIM_R);
17358 @@ -2398,7 +2399,7 @@
17359 struct mtpos ioctl_tell;
17362 - if (TP_DIAGS(current_tape_dev))
17363 + if (TP_DIAGS(current_type))
17364 printk(TPQIC02_NAME ": ioctl(%4x, %4lx)\n", iocmd, ioarg);
17367 @@ -2459,7 +2460,7 @@
17368 * --- tape at the beginning of the current file.
17371 - if (TP_DIAGS(current_tape_dev))
17372 + if (TP_DIAGS(current_type))
17373 printk("OP op=%4x, count=%4x\n", operation.mt_op, operation.mt_count);
17375 if (operation.mt_count < 0)
17376 @@ -2492,7 +2493,7 @@
17379 } else if (c == _IOC_NR(MTIOCGET)) {
17380 - if (TP_DIAGS(current_tape_dev))
17381 + if (TP_DIAGS(current_type))
17384 CHECK_IOC_SIZE(mtget);
17385 @@ -2507,7 +2508,7 @@
17388 } else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) {
17389 - if (TP_DIAGS(current_tape_dev))
17390 + if (TP_DIAGS(current_type))
17393 CHECK_IOC_SIZE(mtpos);
17394 @@ -2664,7 +2665,7 @@
17398 - current_tape_dev = mk_kdev(QIC02_TAPE_MAJOR, 0);
17399 + current_type = 0;
17401 #ifndef CONFIG_QIC02_DYNCONF
17402 printk(TPQIC02_NAME ": IRQ %d, DMA %d, IO 0x%x, IFC %s, %s, %s\n",
17403 diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
17404 --- a/drivers/char/tty_io.c Fri Aug 1 02:22:20 2003
17405 +++ b/drivers/char/tty_io.c Sun Aug 31 16:15:47 2003
17406 @@ -177,7 +177,7 @@
17408 EXPORT_SYMBOL(tty_name);
17410 -inline int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
17411 +inline int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
17412 const char *routine)
17414 #ifdef TTY_PARANOIA_CHECK
17415 @@ -187,11 +187,11 @@
17416 "Warning: null TTY for (%s) in %s\n";
17419 - printk(badtty, cdevname(device), routine);
17420 + printk(badtty, cdevname(inode->i_rdev), routine);
17423 if (tty->magic != TTY_MAGIC) {
17424 - printk(badmagic, cdevname(device), routine);
17425 + printk(badmagic, cdevname(inode->i_rdev), routine);
17429 @@ -646,7 +646,7 @@
17431 tty = (struct tty_struct *)file->private_data;
17432 inode = file->f_dentry->d_inode;
17433 - if (tty_paranoia_check(tty, inode->i_rdev, "tty_read"))
17434 + if (tty_paranoia_check(tty, inode, "tty_read"))
17436 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags)))
17438 @@ -763,7 +763,7 @@
17441 tty = (struct tty_struct *)file->private_data;
17442 - if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))
17443 + if (tty_paranoia_check(tty, inode, "tty_write"))
17445 if (!tty || !tty->driver->write || (test_bit(TTY_IO_ERROR, &tty->flags)))
17447 @@ -1023,7 +1023,7 @@
17449 o_tty->driver->refcount--;
17451 - list_del(&o_tty->tty_files);
17452 + list_del_init(&o_tty->tty_files);
17453 file_list_unlock();
17454 free_tty_struct(o_tty);
17456 @@ -1037,7 +1037,7 @@
17458 tty->driver->refcount--;
17460 - list_del(&tty->tty_files);
17461 + list_del_init(&tty->tty_files);
17462 file_list_unlock();
17463 module_put(tty->driver->owner);
17464 free_tty_struct(tty);
17465 @@ -1059,7 +1059,7 @@
17468 tty = (struct tty_struct *)filp->private_data;
17469 - if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "release_dev"))
17470 + if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "release_dev"))
17473 check_tty_count(tty, "release_dev");
17474 @@ -1439,7 +1439,7 @@
17475 struct tty_struct * tty;
17477 tty = (struct tty_struct *)filp->private_data;
17478 - if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "tty_poll"))
17479 + if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "tty_poll"))
17482 if (tty->ldisc.poll)
17483 @@ -1453,7 +1453,7 @@
17486 tty = (struct tty_struct *)filp->private_data;
17487 - if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "tty_fasync"))
17488 + if (tty_paranoia_check(tty, filp->f_dentry->d_inode, "tty_fasync"))
17491 retval = fasync_helper(fd, filp, on, &tty->fasync);
17492 @@ -1727,7 +1727,7 @@
17495 tty = (struct tty_struct *)file->private_data;
17496 - if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
17497 + if (tty_paranoia_check(tty, inode, "tty_ioctl"))
17501 diff -Nru a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
17502 --- a/drivers/char/vc_screen.c Wed May 7 08:47:30 2003
17503 +++ b/drivers/char/vc_screen.c Tue Aug 26 09:25:41 2003
17505 vcs_size(struct inode *inode)
17508 - int minor = minor(inode->i_rdev);
17509 + int minor = iminor(inode);
17510 int currcons = minor & 127;
17512 currcons = fg_console;
17513 @@ -104,7 +104,7 @@
17514 vcs_read(struct file *file, char *buf, size_t count, loff_t *ppos)
17516 struct inode *inode = file->f_dentry->d_inode;
17517 - unsigned int currcons = minor(inode->i_rdev);
17518 + unsigned int currcons = iminor(inode);
17520 long viewed, attr, read;
17522 @@ -273,7 +273,7 @@
17523 vcs_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
17525 struct inode *inode = file->f_dentry->d_inode;
17526 - unsigned int currcons = minor(inode->i_rdev);
17527 + unsigned int currcons = iminor(inode);
17529 long viewed, attr, size, written;
17531 @@ -456,7 +456,7 @@
17533 vcs_open(struct inode *inode, struct file *filp)
17535 - unsigned int currcons = minor(inode->i_rdev) & 127;
17536 + unsigned int currcons = iminor(inode) & 127;
17537 if(currcons && !vc_cons_allocated(currcons-1))
17540 diff -Nru a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
17541 --- a/drivers/char/watchdog/Kconfig Mon Jul 28 13:28:55 2003
17542 +++ b/drivers/char/watchdog/Kconfig Sun Aug 31 11:39:56 2003
17543 @@ -346,6 +346,18 @@
17544 module, say M here and read <file:Documentation/modules.txt>. Most
17547 +config ALIM1535_WDT
17548 + tristate "ALi M1535 PMU Watchdog Timer"
17549 + depends on WATCHDOG
17551 + This is the driver for the hardware watchdog on the ALi M1535 PMU.
17553 + This driver is also available as a module ( = code which can be
17554 + inserted in and removed from the running kernel whenever you want).
17555 + The module is called alim1535_wdt. If you want to compile it as a
17556 + module, say M here and read <file:Documentation/modules.txt>. Most
17557 + people will say N.
17560 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
17561 depends on WATCHDOG
17562 diff -Nru a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
17563 --- a/drivers/char/watchdog/Makefile Thu Feb 27 12:38:45 2003
17564 +++ b/drivers/char/watchdog/Makefile Sun Aug 31 11:39:56 2003
17566 obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
17567 obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
17568 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
17569 +obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
17570 obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
17571 obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
17572 obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
17573 diff -Nru a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
17574 --- a/drivers/char/watchdog/acquirewdt.c Fri Aug 8 03:28:08 2003
17575 +++ b/drivers/char/watchdog/acquirewdt.c Sun Aug 31 14:15:12 2003
17578 - * Acquire Single Board Computer Watchdog Timer driver for Linux 2.1.x
17579 + * Acquire Single Board Computer Watchdog Timer driver
17581 * Based on wdt.c. Original copyright messages:
17583 @@ -10,10 +10,10 @@
17584 * modify it under the terms of the GNU General Public License
17585 * as published by the Free Software Foundation; either version
17586 * 2 of the License, or (at your option) any later version.
17588 - * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
17589 - * warranty for any of this software. This material is provided
17590 - * "AS-IS" and at no charge.
17592 + * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
17593 + * warranty for any of this software. This material is provided
17594 + * "AS-IS" and at no charge.
17596 * (c) Copyright 1995 Alan Cox <alan@redhat.com>
17598 @@ -22,33 +22,39 @@
17599 * Can't add timeout - driver doesn't allow changing value
17602 -#include <linux/config.h>
17603 #include <linux/module.h>
17604 #include <linux/moduleparam.h>
17605 #include <linux/types.h>
17606 #include <linux/miscdevice.h>
17607 #include <linux/watchdog.h>
17608 +#include <linux/fs.h>
17609 #include <linux/ioport.h>
17610 #include <linux/notifier.h>
17611 -#include <linux/fs.h>
17612 #include <linux/reboot.h>
17613 #include <linux/init.h>
17614 -#include <linux/spinlock.h>
17616 #include <asm/io.h>
17617 #include <asm/uaccess.h>
17618 #include <asm/system.h>
17620 -static int acq_is_open;
17621 -static spinlock_t acq_lock;
17622 -static int expect_close = 0;
17623 +#define WATCHDOG_NAME "Acquire WDT"
17624 +#define PFX WATCHDOG_NAME ": "
17625 +#define WATCHDOG_TIMEOUT 0 /* ??? Is the timeout hardcoded to 1 minute ??? */
17627 +static unsigned long acq_is_open;
17628 +static char expect_close;
17631 * You must set these - there is no sane way to probe for this board.
17634 -#define WDT_STOP 0x43
17635 -#define WDT_START 0x443
17637 +static int wdt_stop = 0x43;
17638 +module_param(wdt_stop, int, 0);
17639 +MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)");
17641 +static int wdt_start = 0x443;
17642 +module_param(wdt_start, int, 0);
17643 +MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");
17645 #ifdef CONFIG_WATCHDOG_NOWAYOUT
17646 static int nowayout = 1;
17647 @@ -62,38 +68,52 @@
17653 static void acq_ping(void)
17655 /* Write a watchdog value */
17656 - inb_p(WDT_START);
17657 + inb_p(wdt_start);
17660 +static void acq_stop(void)
17662 + /* Turn the card off */
17667 + * /dev/watchdog handling.
17670 static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
17672 /* Can't seek (pwrite) on this device */
17673 if (ppos != &file->f_pos)
17676 + /* See if we got the magic character 'V' and reload the timer */
17681 + /* note: just in case someone wrote the magic character
17682 + * five months ago... */
17685 + /* scan to see wether or not we got the magic character */
17686 for (i = 0; i != count; i++) {
17688 if (get_user(c, buf + i))
17691 - expect_close = 1;
17692 + expect_close = 42;
17696 + /* Well, anyhow someone wrote to us, we should return that favour */
17704 static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
17705 @@ -103,65 +123,75 @@
17707 .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
17708 .firmware_version = 1,
17709 - .identity = "Acquire WDT"
17710 + .identity = "Acquire WDT",
17716 case WDIOC_GETSUPPORT:
17717 - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
17721 + return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ? -EFAULT : 0;
17723 case WDIOC_GETSTATUS:
17724 - if (copy_to_user((int *)arg, &acq_is_open, sizeof(int)))
17727 + case WDIOC_GETBOOTSTATUS:
17728 + return put_user(0, (int *)arg);
17730 case WDIOC_KEEPALIVE:
17735 + case WDIOC_GETTIMEOUT:
17736 + return put_user(WATCHDOG_TIMEOUT, (int *)arg);
17738 + case WDIOC_SETOPTIONS:
17740 + int options, retval = -EINVAL;
17742 + if (get_user(options, (int *)arg))
17745 + if (options & WDIOS_DISABLECARD)
17751 + if (options & WDIOS_ENABLECARD)
17762 + return -ENOIOCTLCMD;
17767 static int acq_open(struct inode *inode, struct file *file)
17769 - if ((minor(inode->i_rdev) == WATCHDOG_MINOR)) {
17770 - spin_lock(&acq_lock);
17771 - if(acq_is_open) {
17772 - spin_unlock(&acq_lock);
17776 - __module_get(THIS_MODULE);
17777 + if (test_and_set_bit(0, &acq_is_open))
17782 - inb_p(WDT_START);
17783 - spin_unlock(&acq_lock);
17786 + __module_get(THIS_MODULE);
17796 static int acq_close(struct inode *inode, struct file *file)
17798 - if(minor(inode->i_rdev)==WATCHDOG_MINOR) {
17799 - spin_lock(&acq_lock);
17800 - if (expect_close)
17803 - printk(KERN_CRIT "WDT closed unexpectedly. WDT will not stop!\n");
17806 - spin_unlock(&acq_lock);
17807 + if (expect_close == 42) {
17810 + printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
17813 + clear_bit(0, &acq_is_open);
17814 + expect_close = 0;
17818 @@ -172,20 +202,20 @@
17819 static int acq_notify_sys(struct notifier_block *this, unsigned long code,
17822 - if(code==SYS_DOWN || code==SYS_HALT)
17823 - /* Turn the card off */
17826 + if(code==SYS_DOWN || code==SYS_HALT) {
17827 + /* Turn the WDT off */
17830 return NOTIFY_DONE;
17835 * Kernel Interfaces
17840 static struct file_operations acq_fops = {
17841 .owner = THIS_MODULE,
17842 + .llseek = no_llseek,
17843 .write = acq_write,
17844 .ioctl = acq_ioctl,
17846 @@ -196,52 +226,84 @@
17848 .minor = WATCHDOG_MINOR,
17849 .name = "watchdog",
17850 - .fops = &acq_fops
17851 + .fops = &acq_fops,
17856 * The WDT card needs to learn about soft shutdowns in order to
17857 - * turn the timebomb registers off.
17858 + * turn the timebomb registers off.
17862 static struct notifier_block acq_notifier =
17864 .notifier_call = acq_notify_sys,
17870 static int __init acq_init(void)
17874 printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
17876 - spin_lock_init(&acq_lock);
17877 - if (misc_register(&acq_miscdev))
17879 - if (!request_region(WDT_STOP, 1, "Acquire WDT")) {
17880 - misc_deregister(&acq_miscdev);
17883 - if (!request_region(WDT_START, 1, "Acquire WDT")) {
17884 - release_region(WDT_STOP, 1);
17885 - misc_deregister(&acq_miscdev);
17887 + if (wdt_stop != wdt_start) {
17888 + if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
17889 + printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17896 - register_reboot_notifier(&acq_notifier);
17898 + if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
17899 + printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
17905 + ret = register_reboot_notifier(&acq_notifier);
17907 + printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
17909 + goto unreg_regions;
17912 + ret = misc_register(&acq_miscdev);
17914 + printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
17915 + WATCHDOG_MINOR, ret);
17916 + goto unreg_reboot;
17919 + printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
17925 + unregister_reboot_notifier(&acq_notifier);
17927 + release_region(wdt_start, 1);
17929 + if (wdt_stop != wdt_start)
17930 + release_region(wdt_stop, 1);
17935 static void __exit acq_exit(void)
17937 misc_deregister(&acq_miscdev);
17938 unregister_reboot_notifier(&acq_notifier);
17939 - release_region(WDT_STOP,1);
17940 - release_region(WDT_START,1);
17941 + if(wdt_stop != wdt_start)
17942 + release_region(wdt_stop,1);
17943 + release_region(wdt_start,1);
17946 module_init(acq_init);
17947 module_exit(acq_exit);
17949 MODULE_LICENSE("GPL");
17950 +MODULE_AUTHOR("Unkown");
17951 +MODULE_DESCRIPTION("Acquire Single Board Computer Watchdog Timer driver");
17952 diff -Nru a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c
17953 --- a/drivers/char/watchdog/advantechwdt.c Sat Aug 9 07:00:04 2003
17954 +++ b/drivers/char/watchdog/advantechwdt.c Sat Aug 30 04:48:19 2003
17955 @@ -133,7 +133,7 @@
17956 static struct watchdog_info ident = {
17957 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
17958 .firmware_version = 1,
17959 - .identity = "Advantech WDT"
17960 + .identity = "Advantech WDT",
17964 diff -Nru a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c
17965 --- /dev/null Wed Dec 31 16:00:00 1969
17966 +++ b/drivers/char/watchdog/alim1535_wdt.c Sun Aug 31 11:38:01 2003
17969 + * Watchdog for the 7101 PMU version found in the ALi M1535 chipsets
17971 + * This program is free software; you can redistribute it and/or
17972 + * modify it under the terms of the GNU General Public License
17973 + * as published by the Free Software Foundation; either version
17974 + * 2 of the License, or (at your option) any later version.
17977 +#include <linux/module.h>
17978 +#include <linux/moduleparam.h>
17979 +#include <linux/types.h>
17980 +#include <linux/miscdevice.h>
17981 +#include <linux/watchdog.h>
17982 +#include <linux/ioport.h>
17983 +#include <linux/notifier.h>
17984 +#include <linux/reboot.h>
17985 +#include <linux/init.h>
17986 +#include <linux/pci.h>
17988 +#include <asm/uaccess.h>
17989 +#include <asm/io.h>
17991 +#define WATCHDOG_NAME "ALi_M1535"
17992 +#define PFX WATCHDOG_NAME ": "
17993 +#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
17995 +/* internal variables */
17996 +static unsigned long ali_is_open;
17997 +static char ali_expect_release;
17998 +static struct pci_dev *ali_pci;
17999 +static u32 ali_timeout_bits; /* stores the computed timeout */
18000 +static spinlock_t ali_lock; /* Guards the hardware */
18002 +/* module parameters */
18003 +static int timeout = WATCHDOG_TIMEOUT;
18004 +module_param(timeout, int, 0);
18005 +MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
18007 +#ifdef CONFIG_WATCHDOG_NOWAYOUT
18008 +static int nowayout = 1;
18010 +static int nowayout = 0;
18013 +module_param(nowayout, int, 0);
18014 +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
18017 + * ali_start - start watchdog countdown
18019 + * Starts the timer running providing the timer has a counter
18020 + * configuration set.
18023 +static void ali_start(void)
18027 + spin_lock(&ali_lock);
18029 + pci_read_config_dword(ali_pci, 0xCC, &val);
18030 + val &= ~0x3F; /* Mask count */
18031 + val |= (1<<25) | ali_timeout_bits;
18032 + pci_write_config_dword(ali_pci, 0xCC, val);
18034 + spin_unlock(&ali_lock);
18038 + * ali_stop - stop the timer countdown
18040 + * Stop the ALi watchdog countdown
18043 +static void ali_stop(void)
18047 + spin_lock(&ali_lock);
18049 + pci_read_config_dword(ali_pci, 0xCC, &val);
18050 + val &= ~0x3F; /* Mask count to zero (disabled) */
18051 + val &= ~(1<<25);/* and for safety mask the reset enable */
18052 + pci_write_config_dword(ali_pci, 0xCC, val);
18054 + spin_unlock(&ali_lock);
18058 + * ali_keepalive - send a keepalive to the watchdog
18060 + * Send a keepalive to the timer (actually we restart the timer).
18063 +static void ali_keepalive(void)
18069 + * ali_settimer - compute the timer reload value
18070 + * @t: time in seconds
18072 + * Computes the timeout values needed
18075 +static int ali_settimer(int t)
18080 + ali_timeout_bits = t|(1<<6);
18081 + else if(t < 3600)
18082 + ali_timeout_bits = (t/60)|(1<<7);
18083 + else if(t < 18000)
18084 + ali_timeout_bits = (t/300)|(1<<6)|(1<<7);
18085 + else return -EINVAL;
18092 + * /dev/watchdog handling
18096 + * ali_write - writes to ALi watchdog
18097 + * @file: file from VFS
18098 + * @data: user address of data
18099 + * @len: length of data
18100 + * @ppos: pointer to the file offset
18102 + * Handle a write to the ALi watchdog. Writing to the file pings
18103 + * the watchdog and resets it. Writing the magic 'V' sequence allows
18104 + * the next close to turn off the watchdog.
18107 +static ssize_t ali_write(struct file *file, const char *data,
18108 + size_t len, loff_t * ppos)
18110 + /* Can't seek (pwrite) on this device */
18111 + if (ppos != &file->f_pos)
18114 + /* See if we got the magic character 'V' and reload the timer */
18119 + /* note: just in case someone wrote the magic character
18120 + * five months ago... */
18121 + ali_expect_release = 0;
18123 + /* scan to see wether or not we got the magic character */
18124 + for (i = 0; i != len; i++) {
18126 + if(get_user(c, data+i))
18129 + ali_expect_release = 42;
18133 + /* someone wrote to us, we should reload the timer */
18140 + * ali_ioctl - handle watchdog ioctls
18141 + * @inode: VFS inode
18142 + * @file: VFS file pointer
18143 + * @cmd: ioctl number
18144 + * @arg: arguments to the ioctl
18146 + * Handle the watchdog ioctls supported by the ALi driver. Really
18147 + * we want an extension to enable irq ack monitoring and the like
18150 +static int ali_ioctl(struct inode *inode, struct file *file,
18151 + unsigned int cmd, unsigned long arg)
18153 + static struct watchdog_info ident = {
18154 + .options = WDIOF_KEEPALIVEPING |
18155 + WDIOF_SETTIMEOUT |
18156 + WDIOF_MAGICCLOSE,
18157 + .firmware_version = 0,
18158 + .identity = "ALi M1535 WatchDog Timer",
18162 + case WDIOC_GETSUPPORT:
18163 + return copy_to_user((struct watchdog_info *) arg, &ident,
18164 + sizeof (ident)) ? -EFAULT : 0;
18166 + case WDIOC_GETSTATUS:
18167 + case WDIOC_GETBOOTSTATUS:
18168 + return put_user(0, (int *) arg);
18170 + case WDIOC_KEEPALIVE:
18174 + case WDIOC_SETOPTIONS:
18176 + int new_options, retval = -EINVAL;
18178 + if (get_user (new_options, (int *) arg))
18181 + if (new_options & WDIOS_DISABLECARD) {
18186 + if (new_options & WDIOS_ENABLECARD) {
18194 + case WDIOC_SETTIMEOUT:
18198 + if (get_user(new_timeout, (int *) arg))
18201 + if (ali_settimer(new_timeout))
18208 + case WDIOC_GETTIMEOUT:
18209 + return put_user(timeout, (int *)arg);
18212 + return -ENOIOCTLCMD;
18217 + * ali_open - handle open of ali watchdog
18218 + * @inode: inode from VFS
18219 + * @file: file from VFS
18221 + * Open the ALi watchdog device. Ensure only one person opens it
18222 + * at a time. Also start the watchdog running.
18225 +static int ali_open(struct inode *inode, struct file *file)
18227 + /* /dev/watchdog can only be opened once */
18228 + if (test_and_set_bit(0, &ali_is_open))
18237 + * ali_release - close an ALi watchdog
18238 + * @inode: inode from VFS
18239 + * @file: file from VFS
18241 + * Close the ALi watchdog device. Actual shutdown of the timer
18242 + * only occurs if the magic sequence has been set.
18245 +static int ali_release(struct inode *inode, struct file *file)
18248 + * Shut off the timer.
18250 + if (ali_expect_release == 42) {
18253 + printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
18256 + clear_bit(0, &ali_is_open);
18257 + ali_expect_release = 0;
18262 + * ali_notify_sys - System down notifier
18264 + * Notifier for system down
18268 +static int ali_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
18270 + if (code==SYS_DOWN || code==SYS_HALT) {
18271 + /* Turn the WDT off */
18275 + return NOTIFY_DONE;
18279 + * Data for PCI driver interface
18281 + * This data only exists for exporting the supported
18282 + * PCI ids via MODULE_DEVICE_TABLE. We do not actually
18283 + * register a pci_driver, because someone else might one day
18284 + * want to register another driver on the same PCI id.
18287 +static struct pci_device_id ali_pci_tbl[] __initdata = {
18288 + { PCI_VENDOR_ID_AL, 1535, PCI_ANY_ID, PCI_ANY_ID,},
18291 +MODULE_DEVICE_TABLE(pci, ali_pci_tbl);
18294 + * ali_find_watchdog - find a 1535 and 7101
18296 + * Scans the PCI hardware for a 1535 series bridge and matching 7101
18297 + * watchdog device. This may be overtight but it is better to be safe
18300 +static int __init ali_find_watchdog(void)
18302 + struct pci_dev *pdev;
18305 + /* Check for a 1535 series bridge */
18306 + pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x1535, NULL);
18310 + /* Check for the a 7101 PMU */
18311 + pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
18315 + if(pci_enable_device(pdev))
18321 + * Initialize the timer bits
18323 + pci_read_config_dword(pdev, 0xCC, &wdog);
18325 + wdog &= ~0x3F; /* Timer bits */
18326 + wdog &= ~((1<<27)|(1<<26)|(1<<25)|(1<<24)); /* Issued events */
18327 + wdog &= ~((1<<16)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)); /* No monitor bits */
18329 + pci_write_config_dword(pdev, 0xCC, wdog);
18335 + * Kernel Interfaces
18338 +static struct file_operations ali_fops = {
18339 + .owner = THIS_MODULE,
18340 + .llseek = no_llseek,
18341 + .write = ali_write,
18342 + .ioctl = ali_ioctl,
18343 + .open = ali_open,
18344 + .release = ali_release,
18347 +static struct miscdevice ali_miscdev = {
18348 + .minor = WATCHDOG_MINOR,
18349 + .name = "watchdog",
18350 + .fops = &ali_fops,
18353 +static struct notifier_block ali_notifier = {
18354 + .notifier_call = ali_notify_sys,
18360 + * watchdog_init - module initialiser
18362 + * Scan for a suitable watchdog and if so initialize it. Return an error
18363 + * if we cannot, the error causes the module to unload
18366 +static int __init watchdog_init(void)
18370 + spin_lock_init(&ali_lock);
18372 + /* Check wether or not the hardware watchdog is there */
18373 + if (ali_find_watchdog() != 0) {
18377 + /* Check that the timeout value is within it's range ; if not reset to the default */
18378 + if (timeout < 1 || timeout >= 18000) {
18379 + timeout = WATCHDOG_TIMEOUT;
18380 + printk(KERN_INFO PFX "timeout value must be 0<timeout<18000, using %d\n",
18384 + /* Calculate the watchdog's timeout */
18385 + ali_settimer(timeout);
18387 + ret = misc_register(&ali_miscdev);
18389 + printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
18390 + WATCHDOG_MINOR, ret);
18394 + ret = register_reboot_notifier(&ali_notifier);
18396 + printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
18398 + goto unreg_miscdev;
18401 + printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
18402 + timeout, nowayout);
18407 + misc_deregister(&ali_miscdev);
18412 + * watchdog_exit - module de-initialiser
18414 + * Called while unloading a successfully installed watchdog module.
18417 +static void __exit watchdog_exit(void)
18419 + /* Stop the timer before we leave */
18423 + unregister_reboot_notifier(&ali_notifier);
18424 + misc_deregister(&ali_miscdev);
18427 +module_init(watchdog_init);
18428 +module_exit(watchdog_exit);
18430 +MODULE_AUTHOR("Alan Cox");
18431 +MODULE_DESCRIPTION("ALi M1535 PMU Watchdog Timer driver");
18432 +MODULE_LICENSE("GPL");
18433 diff -Nru a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c
18434 --- a/drivers/char/watchdog/cpu5wdt.c Thu Feb 13 06:54:43 2003
18435 +++ b/drivers/char/watchdog/cpu5wdt.c Tue Aug 26 09:25:41 2003
18436 @@ -134,7 +134,7 @@
18438 static int cpu5wdt_open(struct inode *inode, struct file *file)
18440 - switch(minor(inode->i_rdev)) {
18441 + switch(iminor(inode)) {
18442 case WATCHDOG_MINOR:
18443 if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
18445 @@ -148,7 +148,7 @@
18447 static int cpu5wdt_release(struct inode *inode, struct file *file)
18449 - if(minor(inode->i_rdev)==WATCHDOG_MINOR) {
18450 + if(iminor(inode)==WATCHDOG_MINOR) {
18451 clear_bit(0, &cpu5wdt_device.inuse);
18454 diff -Nru a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
18455 --- a/drivers/char/watchdog/ib700wdt.c Fri Aug 8 03:28:08 2003
18456 +++ b/drivers/char/watchdog/ib700wdt.c Tue Aug 26 09:25:41 2003
18457 @@ -218,7 +218,7 @@
18459 ibwdt_open(struct inode *inode, struct file *file)
18461 - if (minor(inode->i_rdev) == WATCHDOG_MINOR) {
18462 + if (iminor(inode) == WATCHDOG_MINOR) {
18463 spin_lock(&ibwdt_lock);
18464 if (ibwdt_is_open) {
18465 spin_unlock(&ibwdt_lock);
18466 @@ -240,7 +240,7 @@
18468 ibwdt_close(struct inode *inode, struct file *file)
18470 - if (minor(inode->i_rdev) == WATCHDOG_MINOR) {
18471 + if (iminor(inode) == WATCHDOG_MINOR) {
18472 spin_lock(&ibwdt_lock);
18474 outb_p(wd_times[wd_margin], WDT_STOP);
18475 diff -Nru a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
18476 --- a/drivers/char/watchdog/machzwd.c Fri Aug 8 03:28:08 2003
18477 +++ b/drivers/char/watchdog/machzwd.c Tue Aug 26 09:25:41 2003
18478 @@ -377,7 +377,7 @@
18480 static int zf_open(struct inode *inode, struct file *file)
18482 - switch(minor(inode->i_rdev)){
18483 + switch(iminor(inode)){
18484 case WATCHDOG_MINOR:
18485 spin_lock(&zf_lock);
18487 @@ -402,7 +402,7 @@
18489 static int zf_close(struct inode *inode, struct file *file)
18491 - if(minor(inode->i_rdev) == WATCHDOG_MINOR){
18492 + if(iminor(inode) == WATCHDOG_MINOR){
18494 if(zf_expect_close){
18496 diff -Nru a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
18497 --- a/drivers/char/watchdog/pcwd.c Fri Aug 1 03:02:31 2003
18498 +++ b/drivers/char/watchdog/pcwd.c Tue Aug 26 09:25:41 2003
18499 @@ -426,7 +426,7 @@
18501 static int pcwd_open(struct inode *ino, struct file *filep)
18503 - switch (minor(ino->i_rdev)) {
18504 + switch (iminor(ino)) {
18505 case WATCHDOG_MINOR:
18506 if (!atomic_dec_and_test(&open_allowed) ) {
18507 atomic_inc( &open_allowed );
18508 @@ -457,7 +457,7 @@
18509 /* Can't seek (pread) on this device */
18510 if (ppos != &file->f_pos)
18512 - switch(minor(file->f_dentry->d_inode->i_rdev))
18513 + switch(iminor(file->f_dentry->d_inode))
18517 @@ -477,7 +477,7 @@
18519 static int pcwd_close(struct inode *ino, struct file *filep)
18521 - if (minor(ino->i_rdev)==WATCHDOG_MINOR) {
18522 + if (iminor(ino)==WATCHDOG_MINOR) {
18523 if (expect_close) {
18524 /* Disable the board */
18525 if (revision == PCWD_REVISION_C) {
18526 diff -Nru a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c
18527 --- a/drivers/char/watchdog/wafer5823wdt.c Fri Aug 1 03:02:31 2003
18528 +++ b/drivers/char/watchdog/wafer5823wdt.c Sun Aug 31 11:32:43 2003
18531 - * ICP Wafer 5823 Single Board Computer WDT driver for Linux 2.4.x
18532 + * ICP Wafer 5823 Single Board Computer WDT driver
18533 * http://www.icpamerica.com/wafer_5823.php
18534 * May also work on other similar models
18536 @@ -17,10 +17,10 @@
18537 * modify it under the terms of the GNU General Public License
18538 * as published by the Free Software Foundation; either version
18539 * 2 of the License, or (at your option) any later version.
18541 - * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
18542 - * warranty for any of this software. This material is provided
18543 - * "AS-IS" and at no charge.
18545 + * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
18546 + * warranty for any of this software. This material is provided
18547 + * "AS-IS" and at no charge.
18549 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
18552 #include <asm/io.h>
18553 #include <asm/uaccess.h>
18555 +#define WATCHDOG_NAME "Wafer 5823 WDT"
18556 +#define PFX WATCHDOG_NAME ": "
18557 +#define WD_TIMO 60 /* 60 sec default timeout */
18559 static unsigned long wafwdt_is_open;
18560 +static char expect_close;
18561 static spinlock_t wafwdt_lock;
18562 -static int expect_close = 0;
18565 * You must set these - there is no sane way to probe for this board.
18566 @@ -52,11 +56,17 @@
18567 * to restart it again.
18570 -#define WDT_START 0x443
18571 -#define WDT_STOP 0x843
18573 -#define WD_TIMO 60 /* 1 minute */
18574 -static int wd_margin = WD_TIMO;
18575 +static int wdt_stop = 0x843;
18576 +module_param(wdt_stop, int, 0);
18577 +MODULE_PARM_DESC(wdt_stop, "Wafer 5823 WDT 'stop' io port (default 0x843)");
18579 +static int wdt_start = 0x443;
18580 +module_param(wdt_start, int, 0);
18581 +MODULE_PARM_DESC(wdt_start, "Wafer 5823 WDT 'start' io port (default 0x443)");
18583 +static int timeout = WD_TIMO; /* in seconds */
18584 +module_param(timeout, int, 0);
18585 +MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) ".");
18587 #ifdef CONFIG_WATCHDOG_NOWAYOUT
18588 static int nowayout = 1;
18589 @@ -70,24 +80,24 @@
18590 static void wafwdt_ping(void)
18593 - spin_lock(&wafwdt_lock);
18595 - inb_p(WDT_START);
18596 - spin_unlock(&wafwdt_lock);
18597 + spin_lock(&wafwdt_lock);
18599 + inb_p(wdt_start);
18600 + spin_unlock(&wafwdt_lock);
18603 static void wafwdt_start(void)
18605 /* start up watchdog */
18606 - outb_p(wd_margin, WDT_START);
18607 - inb_p(WDT_START);
18608 + outb_p(timeout, wdt_start);
18609 + inb_p(wdt_start);
18615 /* stop watchdog */
18620 static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
18622 if (ppos != &file->f_pos)
18625 + /* See if we got the magic character 'V' and reload the timer */
18629 @@ -103,30 +114,30 @@
18630 /* In case it was set long ago */
18633 + /* scan to see wether or not we got the magic character */
18634 for (i = 0; i != count; i++) {
18636 if (get_user(c, buf + i))
18639 - expect_close = 1;
18640 + expect_close = 42;
18643 + /* Well, anyhow someone wrote to us, we should return that favour */
18651 static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
18656 static struct watchdog_info ident = {
18657 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
18658 .firmware_version = 1,
18659 - .identity = "Wafer 5823 WDT"
18660 + .identity = "Wafer 5823 WDT",
18665 case WDIOC_GETSUPPORT:
18666 @@ -136,25 +147,44 @@
18669 case WDIOC_GETSTATUS:
18670 - if (copy_to_user((int *) arg, &one, sizeof (int)))
18673 + case WDIOC_GETBOOTSTATUS:
18674 + return put_user(0, (int *)arg);
18676 case WDIOC_KEEPALIVE:
18680 case WDIOC_SETTIMEOUT:
18681 - if (get_user(new_margin, (int *)arg))
18682 + if (get_user(new_timeout, (int *)arg))
18684 - if ((new_margin < 1) || (new_margin > 255))
18685 + if ((new_timeout < 1) || (new_timeout > 255))
18687 - wd_margin = new_margin;
18688 + timeout = new_timeout;
18692 case WDIOC_GETTIMEOUT:
18693 - return put_user(wd_margin, (int *)arg);
18694 + return put_user(timeout, (int *)arg);
18696 + case WDIOC_SETOPTIONS:
18698 + int options, retval = -EINVAL;
18700 + if (get_user(options, (int *)arg))
18703 + if (options & WDIOS_DISABLECARD) {
18708 + if (options & WDIOS_ENABLECARD) {
18718 @@ -166,6 +196,10 @@
18720 if (test_and_set_bit(0, &wafwdt_is_open))
18729 @@ -173,12 +207,14 @@
18731 wafwdt_close(struct inode *inode, struct file *file)
18733 - clear_bit(0, &wafwdt_is_open);
18734 - if (expect_close) {
18735 + if (expect_close == 42) {
18738 - printk(KERN_CRIT "WDT device closed unexpectedly. WDT will not stop!\n");
18739 + printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n");
18742 + clear_bit(0, &wafwdt_is_open);
18743 + expect_close = 0;
18747 @@ -201,6 +237,7 @@
18749 static struct file_operations wafwdt_fops = {
18750 .owner = THIS_MODULE,
18751 + .llseek = no_llseek,
18752 .write = wafwdt_write,
18753 .ioctl = wafwdt_ioctl,
18754 .open = wafwdt_open,
18755 @@ -210,53 +247,93 @@
18756 static struct miscdevice wafwdt_miscdev = {
18757 .minor = WATCHDOG_MINOR,
18758 .name = "watchdog",
18759 - .fops = &wafwdt_fops
18760 + .fops = &wafwdt_fops,
18764 * The WDT needs to learn about soft shutdowns in order to
18765 - * turn the timebomb registers off.
18766 + * turn the timebomb registers off.
18769 static struct notifier_block wafwdt_notifier = {
18770 .notifier_call = wafwdt_notify_sys,
18776 static int __init wafwdt_init(void)
18780 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n");
18782 spin_lock_init(&wafwdt_lock);
18783 - if(!request_region(WDT_STOP, 1, "Wafer 5823 WDT"))
18785 - if(!request_region(WDT_START, 1, "Wafer 5823 WDT"))
18787 + if (timeout < 1 || timeout > 63) {
18788 + timeout = WD_TIMO;
18789 + printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n",
18793 + if (wdt_stop != wdt_start) {
18794 + if(!request_region(wdt_stop, 1, "Wafer 5823 WDT")) {
18795 + printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
18802 + if(!request_region(wdt_start, 1, "Wafer 5823 WDT")) {
18803 + printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
18807 - if(misc_register(&wafwdt_miscdev)<0)
18810 + ret = register_reboot_notifier(&wafwdt_notifier);
18812 + printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
18815 - register_reboot_notifier(&wafwdt_notifier);
18819 + ret = misc_register(&wafwdt_miscdev);
18821 + printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
18822 + WATCHDOG_MINOR, ret);
18826 + printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
18827 + timeout, nowayout);
18831 + unregister_reboot_notifier(&wafwdt_notifier);
18833 - release_region(WDT_START, 1);
18834 + release_region(wdt_start, 1);
18836 - release_region(WDT_STOP, 1);
18837 + if (wdt_stop != wdt_start)
18838 + release_region(wdt_stop, 1);
18844 static void __exit wafwdt_exit(void)
18846 misc_deregister(&wafwdt_miscdev);
18847 unregister_reboot_notifier(&wafwdt_notifier);
18848 - release_region(WDT_STOP, 1);
18849 - release_region(WDT_START, 1);
18850 + if(wdt_stop != wdt_start)
18851 + release_region(wdt_stop, 1);
18852 + release_region(wdt_start, 1);
18855 module_init(wafwdt_init);
18856 module_exit(wafwdt_exit);
18858 MODULE_AUTHOR("Justin Cormack");
18859 +MODULE_DESCRIPTION("ICP Wafer 5823 Single Board Computer WDT driver");
18860 MODULE_LICENSE("GPL");
18862 /* end of wafer5823wdt.c */
18863 diff -Nru a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c
18864 --- a/drivers/char/watchdog/wdt.c Thu Apr 24 05:36:57 2003
18865 +++ b/drivers/char/watchdog/wdt.c Tue Aug 26 09:25:41 2003
18866 @@ -290,7 +290,7 @@
18867 if (ptr != &file->f_pos)
18870 - switch(minor(file->f_dentry->d_inode->i_rdev))
18871 + switch(iminor(file->f_dentry->d_inode))
18875 @@ -373,7 +373,7 @@
18877 static int wdt_open(struct inode *inode, struct file *file)
18879 - switch(minor(inode->i_rdev))
18880 + switch(iminor(inode))
18882 case WATCHDOG_MINOR:
18883 if(test_and_set_bit(0, &wdt_is_open))
18884 @@ -413,7 +413,7 @@
18886 static int wdt_release(struct inode *inode, struct file *file)
18888 - if(minor(inode->i_rdev)==WATCHDOG_MINOR)
18889 + if(iminor(inode)==WATCHDOG_MINOR)
18891 if (expect_close) {
18892 inb_p(WDT_DC); /* Disable counters */
18893 diff -Nru a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
18894 --- a/drivers/char/watchdog/wdt_pci.c Fri Aug 1 11:59:44 2003
18895 +++ b/drivers/char/watchdog/wdt_pci.c Tue Aug 26 09:25:41 2003
18896 @@ -276,7 +276,7 @@
18897 if (ptr != &file->f_pos)
18900 - switch(minor(file->f_dentry->d_inode->i_rdev))
18901 + switch(iminor(file->f_dentry->d_inode))
18905 @@ -361,7 +361,7 @@
18907 unsigned long flags;
18909 - switch(minor(inode->i_rdev))
18910 + switch(iminor(inode))
18912 case WATCHDOG_MINOR:
18913 if (down_trylock(&open_sem))
18914 @@ -423,7 +423,7 @@
18915 static int wdtpci_release(struct inode *inode, struct file *file)
18918 - if (minor(inode->i_rdev)==WATCHDOG_MINOR) {
18919 + if (iminor(inode)==WATCHDOG_MINOR) {
18920 unsigned long flags;
18921 if (expect_close) {
18922 spin_lock_irqsave(&wdtpci_lock, flags);
18923 diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
18924 --- a/drivers/i2c/i2c-dev.c Wed Aug 6 02:26:55 2003
18925 +++ b/drivers/i2c/i2c-dev.c Tue Aug 26 09:25:41 2003
18926 @@ -138,7 +138,7 @@
18929 pr_debug("i2c-dev.o: i2c-%d reading %d bytes.\n",
18930 - minor(file->f_dentry->d_inode->i_rdev), count);
18931 + iminor(file->f_dentry->d_inode), count);
18933 ret = i2c_master_recv(client,tmp,count);
18935 @@ -166,7 +166,7 @@
18938 pr_debug("i2c-dev.o: i2c-%d writing %d bytes.\n",
18939 - minor(file->f_dentry->d_inode->i_rdev), count);
18940 + iminor(file->f_dentry->d_inode), count);
18942 ret = i2c_master_send(client,tmp,count);
18944 @@ -186,7 +186,7 @@
18945 unsigned long funcs;
18947 dev_dbg(&client->dev, "i2c-%d ioctl, cmd: 0x%x, arg: %lx.\n",
18948 - minor(inode->i_rdev),cmd, arg);
18949 + iminor(inode),cmd, arg);
18953 @@ -373,7 +373,7 @@
18955 static int i2cdev_open(struct inode *inode, struct file *file)
18957 - unsigned int minor = minor(inode->i_rdev);
18958 + unsigned int minor = iminor(inode);
18959 struct i2c_client *client;
18960 struct i2c_adapter *adap;
18961 struct i2c_dev *i2c_dev;
18962 diff -Nru a/drivers/i2c/i2c-keywest.c b/drivers/i2c/i2c-keywest.c
18963 --- a/drivers/i2c/i2c-keywest.c Wed Jul 9 04:45:34 2003
18964 +++ b/drivers/i2c/i2c-keywest.c Tue Aug 26 06:35:38 2003
18969 -static struct keywest_iface *ifaces = NULL;
18973 do_stop(struct keywest_iface* iface, int result)
18975 @@ -306,6 +303,7 @@
18976 write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR);
18977 write_reg(reg_ier, KW_I2C_IRQ_MASK);
18979 + /* Wait interrupt operations completion */
18980 wait_for_completion(&iface->complete);
18982 rc = iface->result;
18983 @@ -385,6 +383,7 @@
18984 write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR);
18985 write_reg(reg_ier, KW_I2C_IRQ_MASK);
18987 + /* Wait interrupt operations completion */
18988 wait_for_completion(&iface->complete);
18990 rc = iface->result;
18991 @@ -409,16 +408,16 @@
18993 /* For now, we only handle combined mode (smbus) */
18994 static struct i2c_algorithm keywest_algorithm = {
18995 - name: "Keywest i2c",
18996 - id: I2C_ALGO_SMBUS,
18997 - smbus_xfer: keywest_smbus_xfer,
18998 - master_xfer: keywest_xfer,
18999 - functionality: keywest_func,
19000 + .name = "Keywest i2c",
19001 + .id = I2C_ALGO_SMBUS,
19002 + .smbus_xfer = keywest_smbus_xfer,
19003 + .master_xfer = keywest_xfer,
19004 + .functionality = keywest_func,
19009 -create_iface(struct device_node* np)
19010 +create_iface(struct device_node *np, struct device *dev)
19012 unsigned long steps, *psteps, *prate;
19013 unsigned bsteps, tsize, i, nchan, addroffset;
19014 @@ -487,8 +486,8 @@
19018 - /* Select standard mode by default */
19019 - iface->cur_mode |= KW_I2C_MODE_STANDARD;
19020 + /* Select standard sub mode */
19021 + iface->cur_mode |= KW_I2C_MODE_STANDARDSUB;
19024 write_reg(reg_mode, iface->cur_mode);
19025 @@ -506,11 +505,13 @@
19029 + dev_set_drvdata(dev, iface);
19031 for (i=0; i<nchan; i++) {
19032 struct keywest_chan* chan = &iface->channels[i];
19035 - sprintf(chan->adapter.dev.name, "%s %d", np->parent->name, i);
19036 + sprintf(chan->adapter.name, "%s %d", np->parent->name, i);
19037 chan->iface = iface;
19039 chan->adapter.id = I2C_ALGO_SMBUS;
19040 @@ -519,11 +520,12 @@
19041 chan->adapter.client_register = NULL;
19042 chan->adapter.client_unregister = NULL;
19043 i2c_set_adapdata(&chan->adapter, chan);
19044 + chan->adapter.dev.parent = dev;
19046 rc = i2c_add_adapter(&chan->adapter);
19048 printk("i2c-keywest.c: Adapter %s registration failed\n",
19049 - chan->adapter.dev.name);
19050 + chan->adapter.name);
19051 i2c_set_adapdata(&chan->adapter, NULL);
19054 @@ -540,20 +542,18 @@
19055 printk(KERN_INFO "Found KeyWest i2c on \"%s\", %d channel%s, stepping: %d bits\n",
19056 np->parent->name, nchan, nchan > 1 ? "s" : "", bsteps);
19058 - iface->next = ifaces;
19064 -dispose_iface(struct keywest_iface *iface)
19066 +dispose_iface(struct device *dev)
19068 + struct keywest_iface *iface = dev_get_drvdata(dev);
19071 - ifaces = iface->next;
19073 /* Make sure we stop all activity */
19076 spin_lock_irq(&iface->lock);
19077 while (iface->state != state_idle) {
19078 spin_unlock_irq(&iface->lock);
19079 @@ -578,31 +578,76 @@
19080 printk("i2c-keywest.c: i2c_del_adapter failed, that's bad !\n");
19082 iounmap((void *)iface->base);
19083 + dev_set_drvdata(dev, NULL);
19090 +create_iface_macio(struct macio_dev* dev, const struct of_match *match)
19092 + return create_iface(dev->ofdev.node, &dev->ofdev.dev);
19096 +dispose_iface_macio(struct macio_dev* dev)
19098 + return dispose_iface(&dev->ofdev.dev);
19102 +create_iface_of_platform(struct of_device* dev, const struct of_match *match)
19104 + return create_iface(dev->node, &dev->dev);
19108 +dispose_iface_of_platform(struct of_device* dev)
19110 + return dispose_iface(&dev->dev);
19113 +static struct of_match i2c_keywest_match[] =
19116 + .name = OF_ANY_MATCH,
19118 + .compatible = "keywest"
19123 +static struct macio_driver i2c_keywest_macio_driver =
19125 + .name = "i2c-keywest",
19126 + .match_table = i2c_keywest_match,
19127 + .probe = create_iface_macio,
19128 + .remove = dispose_iface_macio
19131 +static struct of_platform_driver i2c_keywest_of_platform_driver =
19133 + .name = "i2c-keywest",
19134 + .match_table = i2c_keywest_match,
19135 + .probe = create_iface_of_platform,
19136 + .remove = dispose_iface_of_platform
19140 i2c_keywest_init(void)
19142 - struct device_node *np;
19143 - int rc = -ENODEV;
19145 - np = find_compatible_devices("i2c", "keywest");
19146 - while (np != 0) {
19147 - if (np->n_addrs >= 1 && np->n_intrs >= 1)
19148 - rc = create_iface(np);
19154 + macio_register_driver(&i2c_keywest_macio_driver);
19155 + of_register_driver(&i2c_keywest_of_platform_driver);
19161 i2c_keywest_cleanup(void)
19164 - dispose_iface(ifaces);
19165 + macio_unregister_driver(&i2c_keywest_macio_driver);
19166 + of_unregister_driver(&i2c_keywest_of_platform_driver);
19169 module_init(i2c_keywest_init);
19170 diff -Nru a/drivers/i2c/i2c-keywest.h b/drivers/i2c/i2c-keywest.h
19171 --- a/drivers/i2c/i2c-keywest.h Fri Feb 15 14:32:09 2002
19172 +++ b/drivers/i2c/i2c-keywest.h Sun Aug 24 06:10:14 2003
19175 struct timer_list timeout_timer;
19176 struct completion complete;
19177 - struct keywest_iface* next;
19181 diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
19182 --- a/drivers/ide/Kconfig Wed Aug 13 14:35:06 2003
19183 +++ b/drivers/ide/Kconfig Sun Aug 24 06:08:48 2003
19184 @@ -815,6 +815,17 @@
19185 most of the recent Apple Power Macintoshes and PowerBooks.
19188 +config BLK_DEV_IDE_PMAC_ATA100FIRST
19189 + bool "Probe internal ATA/100 (Kauai) first"
19190 + depends on BLK_DEV_IDE_PMAC
19192 + This option will cause the ATA/100 controller found in UniNorth2
19193 + based machines (Windtunnel PowerMac, Aluminium PowerBooks, ...)
19194 + to be probed before the ATA/66 and ATA/33 controllers. Without
19195 + these, those machine used to have the hard disk on hdc and the
19196 + CD-ROM on hda. This option changes this to more natural hda for
19197 + hard disk and hdc for CD-ROM.
19199 config BLK_DEV_IDEDMA_PMAC
19200 bool "PowerMac IDE DMA support"
19201 depends on BLK_DEV_IDE_PMAC
19202 diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
19203 --- a/drivers/ide/ide-cd.c Wed Aug 20 09:01:03 2003
19204 +++ b/drivers/ide/ide-cd.c Fri Aug 22 18:04:49 2003
19205 @@ -794,16 +794,16 @@
19206 request or data protect error.*/
19207 ide_dump_status (drive, "command error", stat);
19208 do_end_request = 1;
19209 - } else if ((err & ~ABRT_ERR) != 0) {
19210 - /* Go to the default handler
19211 - for other errors. */
19212 - DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
19214 } else if (sense_key == MEDIUM_ERROR) {
19215 /* No point in re-trying a zillion times on a bad
19216 * sector... If we got here the error is not correctable */
19217 ide_dump_status (drive, "media error (bad sector)", stat);
19218 do_end_request = 1;
19219 + } else if ((err & ~ABRT_ERR) != 0) {
19220 + /* Go to the default handler
19221 + for other errors. */
19222 + DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
19224 } else if ((++rq->errors > ERROR_MAX)) {
19225 /* We've racked up too many retries. Abort. */
19226 do_end_request = 1;
19227 diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
19228 --- a/drivers/ide/ide-io.c Thu Aug 7 02:25:24 2003
19229 +++ b/drivers/ide/ide-io.c Sun Aug 24 15:33:30 2003
19231 #include <asm/io.h>
19232 #include <asm/bitops.h>
19234 -#include "ide_modes.h"
19236 #if (DISK_RECOVERY_TIME > 0)
19238 #error So the User Has To Fix the Compilation And Stop Hacking Port 0x43. Does anyone ever use this anyway ??
19239 diff -Nru a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
19240 --- a/drivers/ide/ide-lib.c Thu Aug 7 02:25:25 2003
19241 +++ b/drivers/ide/ide-lib.c Sun Aug 24 15:33:30 2003
19243 #include <asm/io.h>
19244 #include <asm/bitops.h>
19246 -#include "ide_modes.h"
19249 * IDE library routines. These are plug in code that most
19250 * drivers can use but occasionally may be weird enough
19251 @@ -170,7 +168,7 @@
19253 return min(speed, speed_max[mode]);
19254 #else /* !CONFIG_BLK_DEV_IDEDMA */
19255 - return min(speed, XFER_PIO_4);
19256 + return min(speed, (u8)XFER_PIO_4);
19257 #endif /* CONFIG_BLK_DEV_IDEDMA */
19260 @@ -188,6 +186,12 @@
19262 EXPORT_SYMBOL(ide_dma_enable);
19265 + * Standard (generic) timings for PIO modes, from ATA2 specification.
19266 + * These timings are for access to the IDE data port register *only*.
19267 + * Some drives may specify a mode, while also specifying a different
19268 + * value for cycle_time (from drive identification data).
19270 const ide_pio_timings_t ide_pio_timings[6] = {
19271 { 70, 165, 600 }, /* PIO Mode 0 */
19272 { 50, 125, 383 }, /* PIO Mode 1 */
19273 @@ -198,6 +202,13 @@
19276 EXPORT_SYMBOL_GPL(ide_pio_timings);
19279 + * Shared data/functions for determining best PIO mode for an IDE drive.
19280 + * Most of this stuff originally lived in cmd640.c, and changes to the
19281 + * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
19282 + * breaking the fragile cmd640.c support.
19286 * Black list. Some drives incorrectly report their maximal PIO mode,
19287 diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
19288 --- a/drivers/ide/ide-probe.c Thu Aug 14 16:52:06 2003
19289 +++ b/drivers/ide/ide-probe.c Sun Aug 24 15:46:28 2003
19290 @@ -649,10 +649,13 @@
19291 /* register with global device tree */
19292 strlcpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
19293 hwif->gendev.driver_data = hwif;
19294 - if (hwif->pci_dev)
19295 - hwif->gendev.parent = &hwif->pci_dev->dev;
19297 - hwif->gendev.parent = NULL; /* Would like to do = &device_legacy */
19298 + if (hwif->gendev.parent == NULL) {
19299 + if (hwif->pci_dev)
19300 + hwif->gendev.parent = &hwif->pci_dev->dev;
19302 + /* Would like to do = &device_legacy */
19303 + hwif->gendev.parent = NULL;
19305 device_register(&hwif->gendev);
19308 @@ -770,8 +773,7 @@
19310 for (unit = 0; unit < MAX_DRIVES; ++unit) {
19311 ide_drive_t *drive = &hwif->drives[unit];
19312 - drive->dn = ((hwif->channel ? 2 : 0) + unit);
19313 - hwif->drives[unit].dn = ((hwif->channel ? 2 : 0) + unit);
19314 + drive->dn = (hwif->channel ? 2 : 0) + unit;
19315 (void) probe_for_drive(drive);
19316 if (drive->present && !hwif->present) {
19318 @@ -945,15 +947,10 @@
19320 drive->disk->queue = drive->queue;
19326 - * Setup the drive for request handling.
19328 -static void ide_init_drive(ide_drive_t *drive)
19330 + /* needs drive->queue to be set */
19331 ide_toggle_bounce(drive, 1);
19337 @@ -1068,10 +1065,9 @@
19341 - * Link any new drives into the hwgroup, allocate
19342 - * the block device queue and initialize the drive.
19343 - * Note that ide_init_drive sends commands to the new
19345 + * For any present drive:
19346 + * - allocate the block device queue
19347 + * - link drive into the hwgroup
19349 for (index = 0; index < MAX_DRIVES; ++index) {
19350 ide_drive_t *drive = &hwif->drives[index];
19351 @@ -1092,7 +1088,6 @@
19352 hwgroup->drive->next = drive;
19354 spin_unlock_irq(&ide_lock);
19355 - ide_init_drive(drive);
19358 #if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
19359 @@ -1303,31 +1298,6 @@
19361 EXPORT_SYMBOL(hwif_init);
19363 -int export_ide_init_queue (ide_drive_t *drive)
19365 - if (ide_init_queue(drive))
19368 - ide_init_drive(drive);
19372 -EXPORT_SYMBOL(export_ide_init_queue);
19374 -u8 export_probe_for_drive (ide_drive_t *drive)
19376 - return probe_for_drive(drive);
19379 -EXPORT_SYMBOL(export_probe_for_drive);
19381 -int ideprobe_init (void);
19382 -static ide_module_t ideprobe_module = {
19383 - IDE_PROBE_MODULE,
19388 int ideprobe_init (void)
19390 unsigned int index;
19391 @@ -1359,7 +1329,7 @@
19395 - ide_probe = &ideprobe_module;
19396 + ide_probe = &ideprobe_init;
19400 diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
19401 --- a/drivers/ide/ide-tape.c Wed Aug 20 14:21:56 2003
19402 +++ b/drivers/ide/ide-tape.c Tue Aug 26 09:25:41 2003
19403 @@ -4922,7 +4922,7 @@
19404 struct inode *inode = file->f_dentry->d_inode;
19405 ide_drive_t *drive = file->private_data;
19406 idetape_tape_t *tape = drive->driver_data;
19407 - unsigned int minor = minor(inode->i_rdev);
19408 + unsigned int minor = iminor(inode);
19409 ssize_t retval, actually_written = 0;
19412 @@ -5568,7 +5568,7 @@
19414 static int idetape_chrdev_open (struct inode *inode, struct file *filp)
19416 - unsigned int minor = minor(inode->i_rdev), i = minor & ~0xc0;
19417 + unsigned int minor = iminor(inode), i = minor & ~0xc0;
19418 ide_drive_t *drive;
19419 idetape_tape_t *tape;
19421 @@ -5649,7 +5649,7 @@
19422 ide_drive_t *drive = filp->private_data;
19423 idetape_tape_t *tape;
19425 - unsigned int minor = minor(inode->i_rdev);
19426 + unsigned int minor = iminor(inode);
19429 tape = drive->driver_data;
19430 diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
19431 --- a/drivers/ide/ide.c Wed Aug 20 09:01:03 2003
19432 +++ b/drivers/ide/ide.c Sun Aug 31 16:13:57 2003
19433 @@ -161,8 +161,6 @@
19434 #include <asm/io.h>
19435 #include <asm/bitops.h>
19437 -#include "ide_modes.h"
19440 /* default maximum number of failures */
19441 #define IDE_DEFAULT_MAX_FAILURES 1
19442 @@ -180,7 +178,9 @@
19443 DECLARE_MUTEX(ide_cfg_sem);
19444 spinlock_t ide_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
19446 +#ifdef CONFIG_BLK_DEV_IDEPCI
19447 static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
19450 #ifdef CONFIG_IDEDMA_AUTO
19452 @@ -190,11 +190,7 @@
19454 EXPORT_SYMBOL(noautodma);
19457 - * ide_modules keeps track of the available IDE chipset/probe/driver modules.
19459 -ide_module_t *ide_chipsets;
19460 -ide_module_t *ide_probe;
19461 +int (*ide_probe)(void);
19464 * This is declared extern in ide.h, for access by other IDE modules:
19465 @@ -452,7 +448,7 @@
19466 (void) request_module("ide-probe-mod");
19467 #endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */
19469 - (void) ide_probe->init();
19470 + (void)ide_probe();
19474 @@ -1046,21 +1042,6 @@
19475 EXPORT_SYMBOL(ide_register_hw);
19478 - * Compatibility function with existing drivers. If you want
19479 - * something different, use the function above.
19481 -int ide_register (int arg1, int arg2, int irq)
19484 - ide_init_hwif_ports(&hw, (unsigned long) arg1, (unsigned long) arg2, NULL);
19486 - return ide_register_hw(&hw, NULL);
19489 -EXPORT_SYMBOL(ide_register);
19493 * Locks for IDE setting functionality
19496 @@ -1658,11 +1639,15 @@
19498 case HDIO_SCAN_HWIF:
19502 if (!capable(CAP_SYS_RAWIO)) return -EACCES;
19503 if (copy_from_user(args, (void *)arg, 3 * sizeof(int)))
19505 - if (ide_register(args[0], args[1], args[2]) == -1)
19506 + ide_init_hwif_ports(&hw, (unsigned long) args[0],
19507 + (unsigned long) args[1], NULL);
19508 + hw.irq = args[2];
19509 + if (ide_register_hw(&hw, NULL) == -1)
19513 @@ -1870,7 +1855,7 @@
19514 * registered. In most cases, only one device
19516 * "hdx=scsi" : the return of the ide-scsi flag, this is useful for
19517 - * allowwing ide-floppy, ide-tape, and ide-cdrom|writers
19518 + * allowing ide-floppy, ide-tape, and ide-cdrom|writers
19519 * to use ide-scsi emulation on a device specific option.
19520 * "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz,
19521 * where "xx" is between 20 and 66 inclusive,
19522 diff -Nru a/drivers/ide/ide_modes.h b/drivers/ide/ide_modes.h
19523 --- a/drivers/ide/ide_modes.h Mon Sep 16 05:54:57 2002
19524 +++ /dev/null Wed Dec 31 16:00:00 1969
19527 - * linux/drivers/ide/ide_modes.h
19529 - * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
19532 -#ifndef _IDE_MODES_H
19533 -#define _IDE_MODES_H
19535 -#include <linux/config.h>
19538 - * Shared data/functions for determining best PIO mode for an IDE drive.
19539 - * Most of this stuff originally lived in cmd640.c, and changes to the
19540 - * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
19541 - * breaking the fragile cmd640.c support.
19545 - * Standard (generic) timings for PIO modes, from ATA2 specification.
19546 - * These timings are for access to the IDE data port register *only*.
19547 - * Some drives may specify a mode, while also specifying a different
19548 - * value for cycle_time (from drive identification data).
19550 -typedef struct ide_pio_timings_s {
19551 - int setup_time; /* Address setup (ns) minimum */
19552 - int active_time; /* Active pulse (ns) minimum */
19553 - int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
19554 -} ide_pio_timings_t;
19556 -typedef struct ide_pio_data_s {
19561 - unsigned int cycle_time;
19564 -u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
19565 -extern const ide_pio_timings_t ide_pio_timings[6];
19566 -#endif /* _IDE_MODES_H */
19567 diff -Nru a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
19568 --- a/drivers/ide/legacy/ali14xx.c Tue Aug 12 13:29:09 2003
19569 +++ b/drivers/ide/legacy/ali14xx.c Sun Aug 24 15:33:30 2003
19572 #include <asm/io.h>
19574 -#include "ide_modes.h"
19576 /* port addresses for auto-detection */
19577 #define ALI_NUM_PORTS 4
19578 static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4};
19579 diff -Nru a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
19580 --- a/drivers/ide/legacy/dtc2278.c Tue Aug 12 13:29:09 2003
19581 +++ b/drivers/ide/legacy/dtc2278.c Sun Aug 24 15:33:30 2003
19584 #include <asm/io.h>
19586 -#include "ide_modes.h"
19589 * Changing this #undef to #define may solve start up problems in some systems.
19591 diff -Nru a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
19592 --- a/drivers/ide/legacy/ht6560b.c Tue Aug 12 13:29:09 2003
19593 +++ b/drivers/ide/legacy/ht6560b.c Sun Aug 24 15:33:30 2003
19596 #include <asm/io.h>
19598 -#include "ide_modes.h"
19600 /* #define DEBUG */ /* remove comments for DEBUG messages */
19603 diff -Nru a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
19604 --- a/drivers/ide/legacy/macide.c Tue Feb 18 10:06:19 2003
19605 +++ b/drivers/ide/legacy/macide.c Sun Aug 24 05:37:06 2003
19606 @@ -126,7 +126,7 @@
19607 /* probing the drive which freezes a 190. */
19609 ide_drive_t *drive = &ide_hwifs[index].drives[0];
19610 - drive->capacity = drive->cyl*drive->head*drive->sect;
19611 + drive->capacity64 = drive->cyl*drive->head*drive->sect;
19613 #ifdef CONFIG_BLK_DEV_MAC_MEDIABAY
19614 request_irq(IRQ_BABOON_2, macide_mediabay_interrupt,
19615 diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
19616 --- a/drivers/ide/legacy/qd65xx.c Tue Aug 12 13:29:09 2003
19617 +++ b/drivers/ide/legacy/qd65xx.c Sun Aug 24 15:33:30 2003
19619 #include <asm/system.h>
19620 #include <asm/io.h>
19622 -#include "ide_modes.h"
19623 #include "qd65xx.h"
19626 diff -Nru a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
19627 --- a/drivers/ide/legacy/umc8672.c Tue Aug 12 13:29:09 2003
19628 +++ b/drivers/ide/legacy/umc8672.c Sun Aug 24 15:33:30 2003
19631 #include <asm/io.h>
19633 -#include "ide_modes.h"
19636 * Default speeds. These can be changed with "auto-tune" and/or hdparm.
19638 diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
19639 --- a/drivers/ide/pci/aec62xx.c Thu Jul 31 08:58:49 2003
19640 +++ b/drivers/ide/pci/aec62xx.c Sun Aug 24 15:33:30 2003
19643 #include <asm/io.h>
19645 -#include "ide_modes.h"
19646 #include "aec62xx.h"
19648 #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
19649 diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
19650 --- a/drivers/ide/pci/alim15x3.c Sat Aug 16 06:34:25 2003
19651 +++ b/drivers/ide/pci/alim15x3.c Sun Aug 24 15:33:30 2003
19654 #include <asm/io.h>
19656 -#include "ide_modes.h"
19657 #include "alim15x3.h"
19660 diff -Nru a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
19661 --- a/drivers/ide/pci/cmd640.c Thu Mar 13 16:49:44 2003
19662 +++ b/drivers/ide/pci/cmd640.c Sun Aug 24 15:33:30 2003
19663 @@ -115,8 +115,6 @@
19665 #include <asm/io.h>
19667 -#include "ide_modes.h"
19670 * This flag is set in ide.c by the parameter: ide0=cmd640_vlb
19672 diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
19673 --- a/drivers/ide/pci/cmd64x.c Thu Jul 31 08:58:49 2003
19674 +++ b/drivers/ide/pci/cmd64x.c Mon Sep 1 08:23:55 2003
19677 #include <asm/io.h>
19679 -#include "ide_modes.h"
19680 #include "cmd64x.h"
19682 #if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS)
19683 @@ -629,10 +628,7 @@
19685 /* Set a good latency timer and cache line size value. */
19686 (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
19687 -#ifdef __sparc_v9__
19688 - (void) pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x10);
19691 + /* FIXME: pci_set_master() to ensure a good latency timer value */
19693 /* Setup interrupts. */
19694 (void) pci_read_config_byte(dev, MRDMODE, &mrdmode);
19695 diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
19696 --- a/drivers/ide/pci/cs5520.c Thu Jul 31 08:58:49 2003
19697 +++ b/drivers/ide/pci/cs5520.c Sun Aug 24 15:33:30 2003
19699 #include <asm/io.h>
19700 #include <asm/irq.h>
19702 -#include "ide_modes.h"
19703 #include "cs5520.h"
19705 #if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
19706 diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
19707 --- a/drivers/ide/pci/cs5530.c Thu Jul 31 08:58:49 2003
19708 +++ b/drivers/ide/pci/cs5530.c Sun Aug 24 15:33:30 2003
19710 #include <asm/io.h>
19711 #include <asm/irq.h>
19713 -#include "ide_modes.h"
19714 #include "cs5530.h"
19716 #if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
19717 diff -Nru a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
19718 --- a/drivers/ide/pci/cy82c693.c Thu Jul 31 08:58:49 2003
19719 +++ b/drivers/ide/pci/cy82c693.c Sun Aug 24 15:33:30 2003
19722 #include <asm/io.h>
19724 -#include "ide_modes.h"
19725 #include "cy82c693.h"
19728 @@ -113,7 +112,7 @@
19730 /* note: we use the same values for 16bit IOR and IOW
19731 * those are all the same, since I don't have other
19732 - * timings than those from ide_modes.h
19733 + * timings than those from ide-lib.c
19736 p_pclk->time_16r = (u8)clk1;
19737 diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
19738 --- a/drivers/ide/pci/hpt34x.c Thu Jul 31 08:58:49 2003
19739 +++ b/drivers/ide/pci/hpt34x.c Sun Aug 24 15:33:30 2003
19741 #include <asm/io.h>
19742 #include <asm/irq.h>
19744 -#include "ide_modes.h"
19745 #include "hpt34x.h"
19747 #if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS)
19748 diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
19749 --- a/drivers/ide/pci/hpt366.c Mon Aug 11 09:04:06 2003
19750 +++ b/drivers/ide/pci/hpt366.c Sun Aug 24 15:33:30 2003
19752 #include <asm/io.h>
19753 #include <asm/irq.h>
19755 -#include "ide_modes.h"
19756 #include "hpt366.h"
19758 #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
19759 @@ -989,7 +988,40 @@
19760 hwif->intrproc = &hpt3xx_intrproc;
19761 hwif->maskproc = &hpt3xx_maskproc;
19763 - pci_read_config_byte(hwif->pci_dev, 0x5a, &ata66);
19765 + * The HPT37x uses the CBLID pins as outputs for MA15/MA16
19766 + * address lines to access an external eeprom. To read valid
19767 + * cable detect state the pins must be enabled as inputs.
19769 + if (hpt_minimum_revision(dev, 8) && PCI_FUNC(dev->devfn) & 1) {
19771 + * HPT374 PCI function 1
19772 + * - set bit 15 of reg 0x52 to enable TCBLID as input
19773 + * - set bit 15 of reg 0x56 to enable FCBLID as input
19776 + pci_read_config_word(dev, 0x52, &mcr3);
19777 + pci_read_config_word(dev, 0x56, &mcr6);
19778 + pci_write_config_word(dev, 0x52, mcr3 | 0x8000);
19779 + pci_write_config_word(dev, 0x56, mcr6 | 0x8000);
19780 + /* now read cable id register */
19781 + pci_read_config_byte(dev, 0x5a, &ata66);
19782 + pci_write_config_word(dev, 0x52, mcr3);
19783 + pci_write_config_word(dev, 0x56, mcr6);
19784 + } else if (hpt_minimum_revision(dev, 3)) {
19786 + * HPT370/372 and 374 pcifn 0
19787 + * - clear bit 0 of 0x5b to enable P/SCBLID as inputs
19790 + pci_read_config_byte(dev, 0x5b, &scr2);
19791 + pci_write_config_byte(dev, 0x5b, scr2 & ~1);
19792 + /* now read cable id register */
19793 + pci_read_config_byte(dev, 0x5a, &ata66);
19794 + pci_write_config_byte(dev, 0x5b, scr2);
19796 + pci_read_config_byte(dev, 0x5a, &ata66);
19800 printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n",
19801 diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
19802 --- a/drivers/ide/pci/it8172.c Thu Jul 31 08:58:49 2003
19803 +++ b/drivers/ide/pci/it8172.c Sun Aug 24 15:33:30 2003
19805 #include <asm/io.h>
19806 #include <asm/it8172/it8172_int.h>
19808 -#include "ide_modes.h"
19809 #include "it8172.h"
19812 diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
19813 --- a/drivers/ide/pci/ns87415.c Thu Jul 31 08:58:49 2003
19814 +++ b/drivers/ide/pci/ns87415.c Mon Sep 1 08:23:55 2003
19815 @@ -147,9 +147,7 @@
19817 /* Set a good latency timer and cache line size value. */
19818 (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
19819 -#ifdef __sparc_v9__
19820 - (void) pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x10);
19822 + /* FIXME: use pci_set_master() to ensure good latency timer value */
19825 * We cannot probe for IRQ: both ports share common IRQ on INTA.
19826 diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
19827 --- a/drivers/ide/pci/opti621.c Thu Jul 31 08:58:49 2003
19828 +++ b/drivers/ide/pci/opti621.c Sun Aug 24 15:33:30 2003
19829 @@ -104,7 +104,6 @@
19831 #include <asm/io.h>
19833 -#include "ide_modes.h"
19834 #include "opti621.h"
19836 #define OPTI621_MAX_PIO 3
19837 diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
19838 --- a/drivers/ide/pci/pdc202xx_new.c Thu Jul 31 08:58:49 2003
19839 +++ b/drivers/ide/pci/pdc202xx_new.c Sun Aug 24 15:33:30 2003
19841 #include <asm/io.h>
19842 #include <asm/irq.h>
19844 -#include "ide_modes.h"
19845 #include "pdc202xx_new.h"
19847 #define PDC202_DEBUG_CABLE 0
19848 diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
19849 --- a/drivers/ide/pci/pdc202xx_old.c Wed Aug 13 17:45:49 2003
19850 +++ b/drivers/ide/pci/pdc202xx_old.c Sun Aug 24 15:33:30 2003
19852 #include <asm/io.h>
19853 #include <asm/irq.h>
19855 -#include "ide_modes.h"
19856 #include "pdc202xx_old.h"
19858 #define PDC202_DEBUG_CABLE 0
19859 diff -Nru a/drivers/ide/pci/pdcadma.c b/drivers/ide/pci/pdcadma.c
19860 --- a/drivers/ide/pci/pdcadma.c Thu Jul 31 08:58:49 2003
19861 +++ b/drivers/ide/pci/pdcadma.c Sun Aug 24 15:33:30 2003
19863 #include <asm/io.h>
19864 #include <asm/irq.h>
19866 -#include "ide_modes.h"
19867 #include "pdcadma.h"
19869 #if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
19870 diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
19871 --- a/drivers/ide/pci/piix.c Thu Jul 31 08:58:49 2003
19872 +++ b/drivers/ide/pci/piix.c Sun Aug 24 15:33:30 2003
19873 @@ -103,7 +103,6 @@
19875 #include <asm/io.h>
19877 -#include "ide_modes.h"
19880 static int no_piix_dma;
19881 diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
19882 --- a/drivers/ide/pci/sc1200.c Thu Jul 31 08:58:49 2003
19883 +++ b/drivers/ide/pci/sc1200.c Sun Aug 24 15:33:30 2003
19885 #include <asm/io.h>
19886 #include <asm/irq.h>
19888 -#include "ide_modes.h"
19889 #include "sc1200.h"
19891 #define SC1200_REV_A 0x00
19892 diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
19893 --- a/drivers/ide/pci/serverworks.c Thu Jul 31 08:58:49 2003
19894 +++ b/drivers/ide/pci/serverworks.c Sun Aug 24 15:33:30 2003
19897 #include <asm/io.h>
19899 -#include "ide_modes.h"
19900 #include "serverworks.h"
19902 static u8 svwks_revision = 0;
19903 diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
19904 --- a/drivers/ide/pci/siimage.c Wed Aug 13 17:45:20 2003
19905 +++ b/drivers/ide/pci/siimage.c Sun Aug 24 15:33:30 2003
19908 #include <asm/io.h>
19910 -#include "ide_modes.h"
19911 #include "siimage.h"
19913 #if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
19914 diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
19915 --- a/drivers/ide/pci/sis5513.c Thu Jul 31 08:58:49 2003
19916 +++ b/drivers/ide/pci/sis5513.c Sun Aug 24 15:33:30 2003
19918 #include <asm/irq.h>
19920 #include "ide-timing.h"
19921 -#include "ide_modes.h"
19922 #include "sis5513.h"
19924 /* registers layout and init values are chipset family dependant */
19925 diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
19926 --- a/drivers/ide/pci/sl82c105.c Thu Jul 31 08:58:49 2003
19927 +++ b/drivers/ide/pci/sl82c105.c Sun Aug 24 15:33:30 2003
19929 #include <asm/io.h>
19930 #include <asm/dma.h>
19932 -#include "ide_modes.h"
19933 #include "sl82c105.h"
19936 diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
19937 --- a/drivers/ide/pci/slc90e66.c Thu Jul 31 08:58:49 2003
19938 +++ b/drivers/ide/pci/slc90e66.c Sun Aug 24 15:33:30 2003
19941 #include <asm/io.h>
19943 -#include "ide_modes.h"
19944 #include "slc90e66.h"
19946 #if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
19947 diff -Nru a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
19948 --- a/drivers/ide/pci/triflex.c Sat Feb 22 15:52:14 2003
19949 +++ b/drivers/ide/pci/triflex.c Sun Aug 24 15:33:30 2003
19951 #include <linux/ide.h>
19952 #include <linux/init.h>
19954 -#include "ide_modes.h"
19955 #include "triflex.h"
19957 static struct pci_dev *triflex_dev;
19958 diff -Nru a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
19959 --- a/drivers/ide/ppc/mpc8xx.c Fri May 2 10:53:08 2003
19960 +++ b/drivers/ide/ppc/mpc8xx.c Sun Aug 24 15:33:30 2003
19962 #include <asm/machdep.h>
19963 #include <asm/irq.h>
19965 -#include "ide_modes.h"
19966 static int identify (volatile u8 *p);
19967 static void print_fixed (volatile u8 *p);
19968 static void print_funcid (int func);
19969 diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
19970 --- a/drivers/ide/ppc/pmac.c Sat Aug 16 11:46:50 2003
19971 +++ b/drivers/ide/ppc/pmac.c Sun Aug 31 14:09:16 2003
19973 * These IDE interfaces are memory-mapped and have a DBDMA channel
19976 - * Copyright (C) 1998-2001 Paul Mackerras & Ben. Herrenschmidt
19977 + * Copyright (C) 1998-2003 Paul Mackerras & Ben. Herrenschmidt
19979 * This program is free software; you can redistribute it and/or
19980 * modify it under the terms of the GNU General Public License
19983 * Copyright (c) 1995-1998 Mark Lord
19985 + * TODO: - Use pre-calculated (kauai) timing tables all the time and
19986 + * get rid of the "rounded" tables used previously, so we have the
19987 + * same table format for all controllers and can then just have one
19991 #include <linux/config.h>
19992 #include <linux/types.h>
19994 #include <linux/notifier.h>
19995 #include <linux/reboot.h>
19996 #include <linux/pci.h>
19997 +#include <linux/adb.h>
19998 +#include <linux/pmu.h>
20000 #include <asm/prom.h>
20001 #include <asm/io.h>
20002 @@ -38,26 +45,27 @@
20003 #include <asm/pmac_feature.h>
20004 #include <asm/sections.h>
20005 #include <asm/irq.h>
20006 -#ifdef CONFIG_PMAC_PBOOK
20007 -#include <linux/adb.h>
20008 -#include <linux/pmu.h>
20010 -#include "ide_modes.h"
20012 +#include "ide-timing.h"
20014 extern void ide_do_request(ide_hwgroup_t *hwgroup, int masked_irq);
20016 #define IDE_PMAC_DEBUG
20018 -#define DMA_WAIT_TIMEOUT 500
20019 +#define DMA_WAIT_TIMEOUT 100
20021 typedef struct pmac_ide_hwif {
20022 unsigned long regbase;
20026 + int cable_80 : 1;
20027 + int mediabay : 1;
20028 + int broken_dma : 1;
20029 + int broken_dma_warn : 1;
20030 struct device_node* node;
20033 + struct macio_dev *mdev;
20035 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20036 /* Those fields are duplicating what is in hwif. We currently
20037 * can't use the hwif ones because of some assumptions that are
20039 controller_heathrow, /* Heathrow/Paddington */
20040 controller_kl_ata3, /* KeyLargo ATA-3 */
20041 controller_kl_ata4, /* KeyLargo ATA-4 */
20042 - controller_kl_ata4_80 /* KeyLargo ATA-4 with 80 conductor cable */
20043 + controller_un_ata6 /* UniNorth2 ATA-6 */
20046 +static const char* model_name[] = {
20047 + "OHare ATA", /* OHare based */
20048 + "Heathrow ATA", /* Heathrow/Paddington */
20049 + "KeyLargo ATA-3", /* KeyLargo ATA-3 */
20050 + "KeyLargo ATA-4", /* KeyLargo ATA-4 */
20051 + "UniNorth ATA-6" /* UniNorth2 ATA-6 */
20055 @@ -91,6 +107,11 @@
20056 #define IDE_TIMING_CONFIG 0x200
20057 #define IDE_INTERRUPT 0x300
20059 +/* Kauai (U2) ATA has different register setup */
20060 +#define IDE_KAUAI_PIO_CONFIG 0x200
20061 +#define IDE_KAUAI_ULTRA_CONFIG 0x210
20062 +#define IDE_KAUAI_POLL_CONFIG 0x220
20065 * Timing configuration register definitions
20067 @@ -101,6 +122,28 @@
20068 #define IDE_SYSCLK_NS 30 /* 33Mhz cell */
20069 #define IDE_SYSCLK_66_NS 15 /* 66Mhz cell */
20071 +/* 100Mhz cell, found in Uninorth 2. I don't have much infos about
20072 + * this one yet, it appears as a pci device (106b/0033) on uninorth
20073 + * internal PCI bus and it's clock is controlled like gem or fw. It
20074 + * appears to be an evolution of keylargo ATA4 with a timing register
20075 + * extended to 2 32bits registers and a similar DBDMA channel. Other
20076 + * registers seem to exist but I can't tell much about them.
20078 + * So far, I'm using pre-calculated tables for this extracted from
20079 + * the values used by the MacOS X driver.
20081 + * The "PIO" register controls PIO and MDMA timings, the "ULTRA"
20082 + * register controls the UDMA timings. At least, it seems bit 0
20083 + * of this one enables UDMA vs. MDMA, and bits 4..7 are the
20084 + * cycle time in units of 10ns. Bits 8..15 are used by I don't
20085 + * know their meaning yet
20087 +#define TR_100_PIOREG_PIO_MASK 0xff000fff
20088 +#define TR_100_PIOREG_MDMA_MASK 0x00fff000
20089 +#define TR_100_UDMAREG_UDMA_MASK 0x0000ffff
20090 +#define TR_100_UDMAREG_UDMA_EN 0x00000001
20093 /* 66Mhz cell, found in KeyLargo. Can do ultra mode 0 to 2 on
20094 * 40 connector cable and to 4 on 80 connector one.
20095 * Clock unit is 15ns (66Mhz)
20096 @@ -115,8 +158,7 @@
20097 * well, despite a comment that would lead to think it has a
20098 * min value of 45ns.
20099 * Apple also add 60ns to the write data setup (or cycle time ?) on
20100 - * reads. I can't explain that, I tried it and it broke everything
20104 #define TR_66_UDMA_MASK 0xfff00000
20105 #define TR_66_UDMA_EN 0x00100000 /* Enable Ultra mode for DMA */
20106 @@ -220,12 +262,12 @@
20110 -/* Ultra DMA timings (rounded) */
20111 +/* KeyLargo ATA-4 Ultra DMA timings (rounded) */
20113 int addrSetup; /* ??? */
20116 -} udma_timings[] __pmacdata =
20117 +} kl66_udma_timings[] __pmacdata =
20119 { 0, 180, 120 }, /* Mode 0 */
20120 { 0, 150, 90 }, /* 1 */
20121 @@ -234,6 +276,63 @@
20122 { 0, 90, 30 } /* 4 */
20125 +/* UniNorth 2 ATA/100 timings */
20126 +struct kauai_timing {
20131 +static struct kauai_timing kauai_pio_timings[] __pmacdata =
20133 + { 930 , 0x08000fff },
20134 + { 600 , 0x08000a92 },
20135 + { 383 , 0x0800060f },
20136 + { 360 , 0x08000492 },
20137 + { 330 , 0x0800048f },
20138 + { 300 , 0x080003cf },
20139 + { 270 , 0x080003cc },
20140 + { 240 , 0x0800038b },
20141 + { 239 , 0x0800030c },
20142 + { 180 , 0x05000249 },
20143 + { 120 , 0x04000148 }
20146 +static struct kauai_timing kauai_mdma_timings[] __pmacdata =
20148 + { 1260 , 0x00fff000 },
20149 + { 480 , 0x00618000 },
20150 + { 360 , 0x00492000 },
20151 + { 270 , 0x0038e000 },
20152 + { 240 , 0x0030c000 },
20153 + { 210 , 0x002cb000 },
20154 + { 180 , 0x00249000 },
20155 + { 150 , 0x00209000 },
20156 + { 120 , 0x00148000 },
20160 +static struct kauai_timing kauai_udma_timings[] __pmacdata =
20162 + { 120 , 0x000070c0 },
20163 + { 90 , 0x00005d80 },
20164 + { 60 , 0x00004a60 },
20165 + { 45 , 0x00003a50 },
20166 + { 30 , 0x00002a30 },
20167 + { 20 , 0x00002921 },
20172 +kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
20176 + for (i=0; table[i].cycle_time; i++)
20177 + if (cycle_time > table[i+1].cycle_time)
20178 + return table[i].timing_reg;
20182 /* allow up to 256 DBDMA commands per xfer */
20183 #define MAX_DCMDS 256
20185 @@ -242,24 +341,106 @@
20186 * NOTE: There is at least one case I know of a disk that needs about 10sec
20187 * before anwering on the bus. I beleive we could add a kernel command
20188 * line arg to override this delay for such cases.
20190 + * NOTE2: This has to be fixed with a BSY wait loop. I'm working on adding
20191 + * that to the generic probe code.
20193 #define IDE_WAKEUP_DELAY_MS 2000
20195 -static void pmac_ide_setup_dma(struct device_node *np, int ix);
20196 -static int pmac_ide_build_dmatable(ide_drive_t *drive, int wr);
20197 +static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif);
20198 +static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq);
20199 static int pmac_ide_tune_chipset(ide_drive_t *drive, u8 speed);
20200 static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio);
20201 static void pmac_ide_selectproc(ide_drive_t *drive);
20202 +static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
20203 static int pmac_ide_dma_begin (ide_drive_t *drive);
20205 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
20207 -#ifdef CONFIG_PMAC_PBOOK
20208 -static int idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when);
20209 -struct pmu_sleep_notifier idepmac_sleep_notifier = {
20210 - idepmac_notify_sleep, SLEEP_LEVEL_BLOCK,
20212 -#endif /* CONFIG_PMAC_PBOOK */
20213 +#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
20216 +#define PMU_HD_BLINK_TIME (HZ/50)
20218 +static struct adb_request pmu_blink_on, pmu_blink_off;
20219 +static spinlock_t pmu_blink_lock;
20220 +static unsigned long pmu_blink_stoptime;
20221 +static int pmu_blink_ledstate;
20222 +static struct timer_list pmu_blink_timer;
20223 +static int pmu_ide_blink_enabled;
20227 +pmu_hd_blink_timeout(unsigned long data)
20229 + unsigned long flags;
20231 + spin_lock_irqsave(&pmu_blink_lock, flags);
20233 + /* We may have been triggered again in a racy way, check
20234 + * that we really want to switch it off
20236 + if (time_after(pmu_blink_stoptime, jiffies))
20239 + /* Previous req. not complete, try 100ms more */
20240 + if (pmu_blink_off.complete == 0)
20241 + mod_timer(&pmu_blink_timer, jiffies + PMU_HD_BLINK_TIME);
20242 + else if (pmu_blink_ledstate) {
20243 + pmu_request(&pmu_blink_off, NULL, 4, 0xee, 4, 0, 0);
20244 + pmu_blink_ledstate = 0;
20247 + spin_unlock_irqrestore(&pmu_blink_lock, flags);
20251 +pmu_hd_kick_blink(void *data, int rw)
20253 + unsigned long flags;
20255 + pmu_blink_stoptime = jiffies + PMU_HD_BLINK_TIME;
20257 + mod_timer(&pmu_blink_timer, pmu_blink_stoptime);
20258 + if (pmu_blink_ledstate == 1)
20260 + spin_lock_irqsave(&pmu_blink_lock, flags);
20261 + if (pmu_blink_on.complete && !pmu_blink_ledstate) {
20262 + pmu_request(&pmu_blink_on, NULL, 4, 0xee, 4, 0, 1);
20263 + pmu_blink_ledstate = 1;
20265 + spin_unlock_irqrestore(&pmu_blink_lock, flags);
20269 +pmu_hd_blink_init(void)
20271 + struct device_node *dt;
20272 + const char *model;
20274 + if (pmu_get_model() != PMU_KEYLARGO_BASED)
20277 + dt = find_devices("device-tree");
20280 + model = (const char *)get_property(dt, "model", NULL);
20281 + if (model == NULL)
20283 + if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
20284 + strncmp(model, "iBook", strlen("iBook")) != 0)
20287 + pmu_blink_on.complete = 1;
20288 + pmu_blink_off.complete = 1;
20289 + spin_lock_init(&pmu_blink_lock);
20290 + init_timer(&pmu_blink_timer);
20291 + pmu_blink_timer.function = pmu_hd_blink_timeout;
20296 +#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */
20299 * N.B. this can't be an initfunc, because the media-bay task can
20300 @@ -315,6 +496,41 @@
20301 (void)readl((unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
20304 +static void __pmac
20305 +pmac_ide_kauai_selectproc(ide_drive_t *drive)
20307 + pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20309 + if (pmif == NULL)
20312 + if (drive->select.b.unit & 0x01) {
20313 + writel(pmif->timings[1],
20314 + (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
20315 + writel(pmif->timings[3],
20316 + (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG));
20318 + writel(pmif->timings[0],
20319 + (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
20320 + writel(pmif->timings[2],
20321 + (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG));
20323 + (void)readl((unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG));
20326 +static void __pmac
20327 +pmac_ide_do_update_timings(ide_drive_t *drive)
20329 + pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20331 + if (pmif == NULL)
20334 + if (pmif->kind == controller_un_ata6)
20335 + pmac_ide_kauai_selectproc(drive);
20337 + pmac_ide_selectproc(drive);
20341 pmac_ide_do_setfeature(ide_drive_t *drive, u8 command)
20342 @@ -322,7 +538,7 @@
20343 ide_hwif_t *hwif = HWIF(drive);
20346 - disable_irq(hwif->irq); /* disable_irq_nosync ?? */
20347 + disable_irq_nosync(hwif->irq);
20349 SELECT_DRIVE(drive);
20350 SELECT_MASK(drive, 0);
20351 @@ -332,22 +548,22 @@
20352 /* Timeout bumped for some powerbooks */
20353 if (wait_for_ready(drive, 2000)) {
20354 /* Timeout bumped for some powerbooks */
20355 - printk(KERN_ERR "pmac_ide_do_setfeature disk not ready "
20356 - "before SET_FEATURE!\n");
20357 + printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready "
20358 + "before SET_FEATURE!\n", drive->name);
20362 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
20363 hwif->OUTB(command, IDE_NSECTOR_REG);
20364 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
20365 - hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG);
20366 + hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
20368 /* Timeout bumped for some powerbooks */
20369 result = wait_for_ready(drive, 2000);
20370 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
20372 - printk(KERN_ERR "pmac_ide_do_setfeature disk not ready "
20373 - "after SET_FEATURE !\n");
20374 + printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready "
20375 + "after SET_FEATURE !\n", drive->name);
20377 SELECT_MASK(drive, 0);
20379 @@ -403,21 +619,27 @@
20383 + /* which drive is it ? */
20384 + timings = &pmif->timings[drive->select.b.unit & 0x01];
20386 pio = ide_get_best_pio_mode(drive, pio, 4, &d);
20387 - accessTicks = SYSCLK_TICKS(ide_pio_timings[pio].active_time);
20388 - if (drive->select.b.unit & 0x01)
20389 - timings = &pmif->timings[1];
20391 - timings = &pmif->timings[0];
20393 - recTime = d.cycle_time - ide_pio_timings[pio].active_time
20394 - - ide_pio_timings[pio].setup_time;
20395 - recTime = max(recTime, 150U);
20396 - accessTime = ide_pio_timings[pio].active_time;
20397 - accessTime = max(accessTime, 150U);
20398 - if (pmif->kind == controller_kl_ata4 ||
20399 - pmif->kind == controller_kl_ata4_80) {
20400 + switch (pmif->kind) {
20401 + case controller_un_ata6: {
20402 + /* 100Mhz cell */
20403 + u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time);
20406 + *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr;
20409 + case controller_kl_ata4:
20411 + recTime = d.cycle_time - ide_pio_timings[pio].active_time
20412 + - ide_pio_timings[pio].setup_time;
20413 + recTime = max(recTime, 150U);
20414 + accessTime = ide_pio_timings[pio].active_time;
20415 + accessTime = max(accessTime, 150U);
20416 accessTicks = SYSCLK_TICKS_66(accessTime);
20417 accessTicks = min(accessTicks, 0x1fU);
20418 recTicks = SYSCLK_TICKS_66(recTime);
20419 @@ -425,9 +647,15 @@
20420 *timings = ((*timings) & ~TR_66_PIO_MASK) |
20421 (accessTicks << TR_66_PIO_ACCESS_SHIFT) |
20422 (recTicks << TR_66_PIO_RECOVERY_SHIFT);
20428 + recTime = d.cycle_time - ide_pio_timings[pio].active_time
20429 + - ide_pio_timings[pio].setup_time;
20430 + recTime = max(recTime, 150U);
20431 + accessTime = ide_pio_timings[pio].active_time;
20432 + accessTime = max(accessTime, 150U);
20433 accessTicks = SYSCLK_TICKS(accessTime);
20434 accessTicks = min(accessTicks, 0x1fU);
20435 accessTicks = max(accessTicks, 4U);
20436 @@ -443,26 +671,31 @@
20437 (recTicks << TR_33_PIO_RECOVERY_SHIFT);
20439 *timings |= TR_33_PIO_E;
20444 #ifdef IDE_PMAC_DEBUG
20445 - printk(KERN_ERR "ide_pmac: Set PIO timing for mode %d, reg: 0x%08x\n",
20447 + printk(KERN_ERR "%s: Set PIO timing for mode %d, reg: 0x%08x\n",
20448 + drive->name, pio, *timings);
20451 if (drive->select.all == HWIF(drive)->INB(IDE_SELECT_REG))
20452 - pmac_ide_selectproc(drive);
20453 + pmac_ide_do_update_timings(drive);
20456 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20458 -set_timings_udma(u32 *timings, u8 speed)
20459 +set_timings_udma_ata4(u32 *timings, u8 speed)
20461 unsigned rdyToPauseTicks, wrDataSetupTicks, addrTicks;
20463 - rdyToPauseTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].rdy2pause);
20464 - wrDataSetupTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].wrDataSetup);
20465 - addrTicks = SYSCLK_TICKS_66(udma_timings[speed & 0xf].addrSetup);
20466 + if (speed > XFER_UDMA_4)
20469 + rdyToPauseTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].rdy2pause);
20470 + wrDataSetupTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].wrDataSetup);
20471 + addrTicks = SYSCLK_TICKS_66(kl66_udma_timings[speed & 0xf].addrSetup);
20473 *timings = ((*timings) & ~(TR_66_UDMA_MASK | TR_66_MDMA_MASK)) |
20474 (wrDataSetupTicks << TR_66_UDMA_WRDATASETUP_SHIFT) |
20475 @@ -478,11 +711,29 @@
20479 -set_timings_mdma(int intf_type, u32 *timings, u8 speed, int drive_cycle_time)
20480 +set_timings_udma_ata6(u32 *pio_timings, u32 *ultra_timings, u8 speed)
20482 + struct ide_timing *t = ide_timing_find_mode(speed);
20485 + if (speed > XFER_UDMA_5 || t == NULL)
20487 + tr = kauai_lookup_timing(kauai_udma_timings, (int)t->udma);
20490 + *ultra_timings = ((*ultra_timings) & ~TR_100_UDMAREG_UDMA_MASK) | tr;
20491 + *ultra_timings = (*ultra_timings) | TR_100_UDMAREG_UDMA_EN;
20497 +set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
20498 + u8 speed, int drive_cycle_time)
20500 int cycleTime, accessTime, recTime;
20501 unsigned accessTicks, recTicks;
20502 - struct mdma_timings_t* tm;
20503 + struct mdma_timings_t* tm = NULL;
20506 /* Get default cycle time for mode */
20507 @@ -491,7 +742,7 @@
20508 case 1: cycleTime = 150; break;
20509 case 2: cycleTime = 120; break;
20514 /* Adjust for drive */
20515 if (drive_cycle_time && drive_cycle_time > cycleTime)
20516 @@ -501,8 +752,9 @@
20518 /* Get the proper timing array for this controller */
20519 switch(intf_type) {
20520 + case controller_un_ata6:
20522 case controller_kl_ata4:
20523 - case controller_kl_ata4_80:
20524 tm = mdma_timings_66;
20526 case controller_kl_ata3:
20527 @@ -512,24 +764,36 @@
20528 tm = mdma_timings_33;
20531 - /* Lookup matching access & recovery times */
20534 - if (tm[i+1].cycleTime < cycleTime)
20540 - cycleTime = tm[i].cycleTime;
20541 - accessTime = tm[i].accessTime;
20542 - recTime = tm[i].recoveryTime;
20543 + if (tm != NULL) {
20544 + /* Lookup matching access & recovery times */
20547 + if (tm[i+1].cycleTime < cycleTime)
20553 + cycleTime = tm[i].cycleTime;
20554 + accessTime = tm[i].accessTime;
20555 + recTime = tm[i].recoveryTime;
20557 #ifdef IDE_PMAC_DEBUG
20558 - printk(KERN_ERR "ide_pmac: MDMA, cycleTime: %d, accessTime: %d, recTime: %d\n",
20559 - cycleTime, accessTime, recTime);
20561 - if (intf_type == controller_kl_ata4 || intf_type == controller_kl_ata4_80) {
20562 + printk(KERN_ERR "%s: MDMA, cycleTime: %d, accessTime: %d, recTime: %d\n",
20563 + drive->name, cycleTime, accessTime, recTime);
20566 + switch(intf_type) {
20567 + case controller_un_ata6: {
20568 + /* 100Mhz cell */
20569 + u32 tr = kauai_lookup_timing(kauai_mdma_timings, cycleTime);
20572 + *timings = ((*timings) & ~TR_100_PIOREG_MDMA_MASK) | tr;
20573 + *timings2 = (*timings2) & ~TR_100_UDMAREG_UDMA_EN;
20576 + case controller_kl_ata4:
20578 accessTicks = SYSCLK_TICKS_66(accessTime);
20579 accessTicks = min(accessTicks, 0x1fU);
20580 @@ -541,7 +805,8 @@
20581 *timings = ((*timings) & ~(TR_66_MDMA_MASK | TR_66_UDMA_MASK)) |
20582 (accessTicks << TR_66_MDMA_ACCESS_SHIFT) |
20583 (recTicks << TR_66_MDMA_RECOVERY_SHIFT);
20584 - } else if (intf_type == controller_kl_ata3) {
20586 + case controller_kl_ata3:
20587 /* 33Mhz cell on KeyLargo */
20588 accessTicks = SYSCLK_TICKS(accessTime);
20589 accessTicks = max(accessTicks, 1U);
20590 @@ -553,7 +818,8 @@
20591 *timings = ((*timings) & ~TR_33_MDMA_MASK) |
20592 (accessTicks << TR_33_MDMA_ACCESS_SHIFT) |
20593 (recTicks << TR_33_MDMA_RECOVERY_SHIFT);
20597 /* 33Mhz cell on others */
20599 int origAccessTime = accessTime;
20600 @@ -578,10 +844,11 @@
20601 (recTicks << TR_33_MDMA_RECOVERY_SHIFT);
20603 *timings |= TR_33_MDMA_HALFTICK;
20606 #ifdef IDE_PMAC_DEBUG
20607 - printk(KERN_ERR "ide_pmac: Set MDMA timing for mode %d, reg: 0x%08x\n",
20608 - speed & 0xf, *timings);
20609 + printk(KERN_ERR "%s: Set MDMA timing for mode %d, reg: 0x%08x\n",
20610 + drive->name, speed & 0xf, *timings);
20614 @@ -591,36 +858,42 @@
20615 * our, normal mdma function is supposed to be more precise
20618 -pmac_ide_tune_chipset (ide_drive_t *drive, u8 speed)
20619 +pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
20621 int unit = (drive->select.b.unit & 0x01);
20623 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
20626 + u32 *timings, *timings2;
20632 timings = &pmif->timings[unit];
20633 + timings2 = &pmif->timings[unit+2];
20636 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
20637 + case XFER_UDMA_5:
20638 + if (pmif->kind != controller_un_ata6)
20642 - if (pmif->kind != controller_kl_ata4_80)
20643 + if (HWIF(drive)->udma_four == 0)
20648 - if (pmif->kind != controller_kl_ata4 &&
20649 - pmif->kind != controller_kl_ata4_80)
20651 - ret = set_timings_udma(timings, speed);
20652 + if (pmif->kind == controller_kl_ata4)
20653 + ret = set_timings_udma_ata4(timings, speed);
20654 + else if (pmif->kind == controller_un_ata6)
20655 + ret = set_timings_udma_ata6(timings, timings2, speed);
20659 case XFER_MW_DMA_2:
20660 case XFER_MW_DMA_1:
20661 case XFER_MW_DMA_0:
20662 - ret = set_timings_mdma(pmif->kind, timings, speed, 0);
20663 + ret = set_timings_mdma(drive, pmif->kind, timings, timings2, speed, 0);
20665 case XFER_SW_DMA_2:
20666 case XFER_SW_DMA_1:
20667 @@ -644,7 +917,7 @@
20671 - pmac_ide_selectproc(drive);
20672 + pmac_ide_do_update_timings(drive);
20673 drive->current_speed = speed;
20676 @@ -653,11 +926,14 @@
20678 sanitize_timings(pmac_ide_hwif_t *pmif)
20681 + unsigned int value, value2 = 0;
20683 switch(pmif->kind) {
20684 + case controller_un_ata6:
20685 + value = 0x08618a92;
20686 + value2 = 0x00002921;
20688 case controller_kl_ata4:
20689 - case controller_kl_ata4_80:
20690 value = 0x0008438c;
20692 case controller_kl_ata3:
20693 @@ -670,6 +946,7 @@
20696 pmif->timings[0] = pmif->timings[1] = value;
20697 + pmif->timings[2] = pmif->timings[3] = value2;
20700 unsigned long __pmac
20701 @@ -724,214 +1001,474 @@
20706 -pmac_ide_probe(void)
20707 +/* Suspend call back, should be called after the child devices
20708 + * have actually been suspended
20711 +pmac_ide_do_suspend(ide_hwif_t *hwif)
20713 - struct device_node *np;
20715 - struct device_node *atas;
20716 - struct device_node *p, **pp, *removables, **rp;
20717 - unsigned long base;
20718 - int irq, big_delay;
20719 - ide_hwif_t *hwif;
20720 + pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20722 + /* We clear the timings */
20723 + pmif->timings[0] = 0;
20724 + pmif->timings[1] = 0;
20726 +#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
20727 + /* Note: This code will be called for every hwif, thus we'll
20728 + * try several time to stop the LED blinker timer, but that
20729 + * should be harmless
20731 + if (pmu_ide_blink_enabled) {
20732 + unsigned long flags;
20734 - if (_machine != _MACH_Pmac)
20737 - rp = &removables;
20738 - p = find_devices("ATA");
20740 - p = find_devices("IDE");
20742 - p = find_type_devices("ide");
20744 - p = find_type_devices("ata");
20745 - /* Move removable devices such as the media-bay CDROM
20746 - on the PB3400 to the end of the list. */
20747 - for (; p != NULL; p = p->next) {
20748 - if (p->parent && p->parent->type
20749 - && strcasecmp(p->parent->type, "media-bay") == 0) {
20756 + /* Make sure we don't hit the PMU blink */
20757 + spin_lock_irqsave(&pmu_blink_lock, flags);
20758 + if (pmu_blink_ledstate)
20759 + del_timer(&pmu_blink_timer);
20760 + pmu_blink_ledstate = 0;
20761 + spin_unlock_irqrestore(&pmu_blink_lock, flags);
20764 - *pp = removables;
20767 - for (i = 0, np = atas; i < MAX_HWIFS && np != NULL; np = np->next) {
20768 - struct device_node *tp;
20769 - struct pmac_ide_hwif* pmif;
20773 - struct pci_dev *pdev = NULL;
20776 - * If this node is not under a mac-io or dbdma node,
20777 - * leave it to the generic PCI driver.
20779 - for (tp = np->parent; tp != 0; tp = tp->parent)
20780 - if (tp->type && (strcmp(tp->type, "mac-io") == 0
20781 - || strcmp(tp->type, "dbdma") == 0))
20785 +#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */
20787 - if (np->n_addrs == 0) {
20788 - printk(KERN_WARNING "ide: no address for device %s\n",
20792 + /* The media bay will handle itself just fine */
20793 + if (pmif->mediabay)
20796 + /* Disable the bus */
20797 + ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 0);
20799 - /* We need to find the pci_dev of the mac-io holding the
20802 - if (pci_device_from_OF_node(tp, &pbus, &pid) == 0)
20803 - pdev = pci_find_slot(pbus, pid);
20804 - if (pdev == NULL)
20805 - printk(KERN_WARNING "ide: no PCI host for device %s, DMA disabled\n",
20811 - * If this slot is taken (e.g. by ide-pci.c) try the next one.
20813 - while (i < MAX_HWIFS
20814 - && ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0)
20816 - if (i >= MAX_HWIFS)
20818 - pmif = &pmac_ide[i];
20819 +/* Resume call back, should be called before the child devices
20823 +pmac_ide_do_resume(ide_hwif_t *hwif)
20825 + pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
20827 + /* Hard reset & re-enable controller (do we really need to reset ? -BenH) */
20828 + if (!pmif->mediabay) {
20829 + ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 1);
20830 + ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 1);
20832 + ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 0);
20837 - * Some older OFs have bogus sizes, causing request_OF_resource
20838 - * to fail. We fix them up here
20840 - if (np->addrs[0].size > 0x1000)
20841 - np->addrs[0].size = 0x1000;
20842 - if (np->n_addrs > 1 && np->addrs[1].size > 0x100)
20843 - np->addrs[1].size = 0x100;
20844 + /* Sanitize drive timings */
20845 + sanitize_timings(pmif);
20847 - if (request_OF_resource(np, 0, " (mac-io IDE IO)") == NULL) {
20848 - printk(KERN_ERR "ide-pmac(%s): can't request IO resource !\n", np->name);
20854 - base = (unsigned long) ioremap(np->addrs[0].address, 0x400);
20856 +pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
20858 + struct device_node *np = pmif->node;
20861 - /* XXX This is bogus. Should be fixed in the registry by checking
20862 - the kind of host interrupt controller, a bit like gatwick
20865 - if (np->n_intrs == 0) {
20866 - printk(KERN_WARNING "ide: no intrs for device %s, using 13\n",
20870 - irq = np->intrs[0].line;
20872 - pmif->regbase = base;
20876 - if (device_is_compatible(np, "keylargo-ata")) {
20877 - if (strcmp(np->name, "ata-4") == 0)
20878 - pmif->kind = controller_kl_ata4;
20880 - pmif->kind = controller_kl_ata3;
20881 - } else if (device_is_compatible(np, "heathrow-ata"))
20882 - pmif->kind = controller_heathrow;
20883 + pmif->cable_80 = 0;
20884 + pmif->broken_dma = pmif->broken_dma_warn = 0;
20885 + if (device_is_compatible(np, "kauai-ata"))
20886 + pmif->kind = controller_un_ata6;
20887 + else if (device_is_compatible(np, "keylargo-ata")) {
20888 + if (strcmp(np->name, "ata-4") == 0)
20889 + pmif->kind = controller_kl_ata4;
20891 - pmif->kind = controller_ohare;
20892 + pmif->kind = controller_kl_ata3;
20893 + } else if (device_is_compatible(np, "heathrow-ata"))
20894 + pmif->kind = controller_heathrow;
20896 + pmif->kind = controller_ohare;
20897 + pmif->broken_dma = 1;
20900 - bidp = (int *)get_property(np, "AAPL,bus-id", NULL);
20901 - pmif->aapl_bus_id = bidp ? *bidp : 0;
20902 + bidp = (int *)get_property(np, "AAPL,bus-id", NULL);
20903 + pmif->aapl_bus_id = bidp ? *bidp : 0;
20905 - if (pmif->kind == controller_kl_ata4) {
20906 - char* cable = get_property(np, "cable-type", NULL);
20907 - if (cable && !strncmp(cable, "80-", 3))
20908 - pmif->kind = controller_kl_ata4_80;
20910 + /* Get cable type from device-tree */
20911 + if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6) {
20912 + char* cable = get_property(np, "cable-type", NULL);
20913 + if (cable && !strncmp(cable, "80-", 3))
20914 + pmif->cable_80 = 1;
20917 - /* Make sure we have sane timings */
20918 - sanitize_timings(pmif);
20919 + pmif->mediabay = 0;
20921 + /* Make sure we have sane timings */
20922 + sanitize_timings(pmif);
20924 - if (np->parent && np->parent->name
20925 - && strcasecmp(np->parent->name, "media-bay") == 0) {
20926 + /* XXX FIXME: Media bay stuff need re-organizing */
20927 + if (np->parent && np->parent->name
20928 + && strcasecmp(np->parent->name, "media-bay") == 0) {
20929 #ifdef CONFIG_PMAC_PBOOK
20930 - media_bay_set_ide_infos(np->parent,base,irq,i);
20931 + media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
20932 #endif /* CONFIG_PMAC_PBOOK */
20935 - pmif->aapl_bus_id = 1;
20936 - } else if (pmif->kind == controller_ohare) {
20937 - /* The code below is having trouble on some ohare machines
20938 - * (timing related ?). Until I can put my hand on one of these
20939 - * units, I keep the old way
20941 - ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);
20943 - /* This is necessary to enable IDE when net-booting */
20944 - printk(KERN_INFO "pmac_ide: enabling IDE bus ID %d\n",
20945 - pmif->aapl_bus_id);
20946 - ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
20947 - ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
20949 - ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
20952 + pmif->mediabay = 1;
20954 + pmif->aapl_bus_id = 1;
20955 + } else if (pmif->kind == controller_ohare) {
20956 + /* The code below is having trouble on some ohare machines
20957 + * (timing related ?). Until I can put my hand on one of these
20958 + * units, I keep the old way
20960 + ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);
20962 + /* This is necessary to enable IDE when net-booting */
20963 + ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
20964 + ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
20966 + ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
20970 - hwif = &ide_hwifs[i];
20971 - /* Setup MMIO ops */
20972 - default_hwif_mmiops(hwif);
20973 - /* Tell common code _not_ to mess with resources */
20975 - hwif->hwif_data = pmif;
20976 - pmac_ide_init_hwif_ports(&hwif->hw, base, 0, &hwif->irq);
20977 - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
20978 - hwif->chipset = ide_pmac;
20979 - hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || in_bay;
20980 - hwif->udma_four = (pmif->kind == controller_kl_ata4_80);
20981 - hwif->pci_dev = pdev;
20982 - hwif->drives[0].unmask = 1;
20983 - hwif->drives[1].unmask = 1;
20984 - hwif->tuneproc = pmac_ide_tuneproc;
20985 + /* Setup MMIO ops */
20986 + default_hwif_mmiops(hwif);
20988 + /* Tell common code _not_ to mess with resources */
20990 + hwif->hwif_data = pmif;
20991 + pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq);
20992 + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
20993 + hwif->chipset = ide_pmac;
20994 + hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;
20995 + hwif->hold = pmif->mediabay;
20996 + hwif->udma_four = pmif->cable_80;
20997 + hwif->drives[0].unmask = 1;
20998 + hwif->drives[1].unmask = 1;
20999 + hwif->tuneproc = pmac_ide_tuneproc;
21000 + if (pmif->kind == controller_un_ata6)
21001 + hwif->selectproc = pmac_ide_kauai_selectproc;
21003 hwif->selectproc = pmac_ide_selectproc;
21004 - hwif->speedproc = pmac_ide_tune_chipset;
21005 + hwif->speedproc = pmac_ide_tune_chipset;
21007 +#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
21008 + pmu_ide_blink_enabled = pmu_hd_blink_init();
21010 + if (pmu_ide_blink_enabled)
21011 + hwif->led_act = pmu_hd_kick_blink;
21014 + printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s\n",
21015 + hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
21016 + pmif->mediabay ? " (mediabay)" : "");
21018 #ifdef CONFIG_PMAC_PBOOK
21019 - if (in_bay && check_media_bay_by_base(base, MB_CD) == 0)
21020 - hwif->noprobe = 0;
21021 + if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)
21022 + hwif->noprobe = 0;
21023 #endif /* CONFIG_PMAC_PBOOK */
21025 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
21026 - if (np->n_addrs >= 2) {
21027 - /* has a DBDMA controller channel */
21028 - pmac_ide_setup_dma(np, i);
21030 - hwif->atapi_dma = 1;
21031 - hwif->ultra_mask = 0x1f;
21032 - hwif->mwdma_mask = 0x07;
21033 - hwif->swdma_mask = 0x07;
21035 + /* has a DBDMA controller channel */
21036 + if (pmif->dma_regs)
21037 + pmac_ide_setup_dma(pmif, hwif);
21038 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21040 + /* We probe the hwif now */
21041 + probe_hwif_init(hwif);
21043 + /* The code IDE code will have set hwif->present if we have devices attached,
21044 + * if we don't, the discard the interface except if we are on a media bay slot
21046 + if (!hwif->present && !pmif->mediabay) {
21047 + printk(KERN_INFO "ide%d: Bus empty, interface released.\n",
21049 + default_hwif_iops(hwif);
21050 + for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i)
21051 + hwif->io_ports[i] = 0;
21052 + hwif->chipset = ide_unknown;
21053 + hwif->noprobe = 1;
21060 +static int __devinit
21061 +pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match)
21063 + unsigned long base, regbase;
21065 + ide_hwif_t *hwif;
21066 + pmac_ide_hwif_t *pmif;
21070 + while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
21071 + || pmac_ide[i].node != NULL))
21073 + if (i >= MAX_HWIFS) {
21074 + printk(KERN_ERR "ide-pmac: MacIO interface attach with no slot\n");
21075 + printk(KERN_ERR " %s\n", mdev->ofdev.node->full_name);
21078 - pmac_ide_count = i;
21080 - mdelay(IDE_WAKEUP_DELAY_MS);
21082 -#ifdef CONFIG_PMAC_PBOOK
21083 - pmu_register_sleep_notifier(&idepmac_sleep_notifier);
21084 -#endif /* CONFIG_PMAC_PBOOK */
21085 + pmif = &pmac_ide[i];
21086 + hwif = &ide_hwifs[i];
21088 + if (mdev->ofdev.node->n_addrs == 0) {
21089 + printk(KERN_WARNING "ide%d: no address for %s\n",
21090 + i, mdev->ofdev.node->full_name);
21095 + * Some older OFs have bogus sizes, causing request_OF_resource
21096 + * to fail. We fix them up here
21098 + if (mdev->ofdev.node->addrs[0].size > 0x1000)
21099 + mdev->ofdev.node->addrs[0].size = 0x1000;
21100 + if (mdev->ofdev.node->n_addrs > 1 && mdev->ofdev.node->addrs[1].size > 0x100)
21101 + mdev->ofdev.node->addrs[1].size = 0x100;
21103 + /* Request memory resource for IO ports */
21104 + if (request_OF_resource(mdev->ofdev.node, 0, " (mac-io ata ports)") == NULL) {
21105 + printk(KERN_ERR "ide%d: can't request mmio resource !\n", i);
21109 + /* XXX This is bogus. Should be fixed in the registry by checking
21110 + * the kind of host interrupt controller, a bit like gatwick
21111 + * fixes in irq.c. That works well enough for the single case
21112 + * where that happens though...
21114 + if (mdev->ofdev.node->n_intrs == 0) {
21115 + printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n",
21116 + i, mdev->ofdev.node->full_name);
21119 + irq = mdev->ofdev.node->intrs[0].line;
21121 + base = (unsigned long) ioremap(mdev->ofdev.node->addrs[0].address, 0x400);
21124 + hwif->pci_dev = mdev->bus->pdev;
21125 + hwif->gendev.parent = &mdev->ofdev.dev;
21127 + pmif->mdev = mdev;
21128 + pmif->node = mdev->ofdev.node;
21129 + pmif->regbase = regbase;
21131 +#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
21132 + if (mdev->ofdev.node->n_addrs >= 2)
21133 + pmif->dma_regs = (volatile struct dbdma_regs*)
21134 + ioremap(mdev->ofdev.node->addrs[1].address, 0x1000);
21136 + pmif->dma_regs = NULL;
21137 +#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21138 + dev_set_drvdata(&mdev->ofdev.dev, hwif);
21140 + rc = pmac_ide_setup_device(pmif, hwif);
21142 + /* The inteface is released to the common IDE layer */
21143 + dev_set_drvdata(&mdev->ofdev.dev, NULL);
21144 + iounmap((void *)base);
21145 + if (pmif->dma_regs)
21146 + iounmap((void *)pmif->dma_regs);
21147 + memset(pmif, 0, sizeof(*pmif));
21148 + release_OF_resource(mdev->ofdev.node, 0);
21155 +pmac_ide_macio_suspend(struct macio_dev *mdev, u32 state)
21157 + ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
21160 + if (state != mdev->ofdev.dev.power_state && state >= 2) {
21161 + rc = pmac_ide_do_suspend(hwif);
21163 + mdev->ofdev.dev.power_state = state;
21170 +pmac_ide_macio_resume(struct macio_dev *mdev)
21172 + ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
21175 + if (mdev->ofdev.dev.power_state != 0) {
21176 + rc = pmac_ide_do_resume(hwif);
21178 + mdev->ofdev.dev.power_state = 0;
21184 +static int __devinit
21185 +pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
21187 + ide_hwif_t *hwif;
21188 + struct device_node *np;
21189 + pmac_ide_hwif_t *pmif;
21190 + unsigned long base;
21191 + unsigned long rbase, rlen;
21194 + np = pci_device_to_OF_node(pdev);
21195 + if (np == NULL) {
21196 + printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n");
21200 + while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
21201 + || pmac_ide[i].node != NULL))
21203 + if (i >= MAX_HWIFS) {
21204 + printk(KERN_ERR "ide-pmac: PCI interface attach with no slot\n");
21205 + printk(KERN_ERR " %s\n", np->full_name);
21209 + pmif = &pmac_ide[i];
21210 + hwif = &ide_hwifs[i];
21212 + if (pci_enable_device(pdev)) {
21213 + printk(KERN_WARNING "ide%i: Can't enable PCI device for %s\n",
21214 + i, np->full_name);
21217 + pci_set_master(pdev);
21219 + if (pci_request_regions(pdev, "Kauai ATA")) {
21220 + printk(KERN_ERR "ide%d: Cannot obtain PCI resources for %s\n",
21221 + i, np->full_name);
21225 + hwif->pci_dev = pdev;
21226 + hwif->gendev.parent = &pdev->dev;
21227 + pmif->mdev = NULL;
21230 + rbase = pci_resource_start(pdev, 0);
21231 + rlen = pci_resource_len(pdev, 0);
21233 + base = (unsigned long) ioremap(rbase, rlen);
21234 + pmif->regbase = base + 0x2000;
21235 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
21236 + pmif->dma_regs = (volatile struct dbdma_regs*)(base + 0x1000);
21237 +#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21238 + pmif->irq = pdev->irq;
21240 + pci_set_drvdata(pdev, hwif);
21242 + rc = pmac_ide_setup_device(pmif, hwif);
21244 + /* The inteface is released to the common IDE layer */
21245 + pci_set_drvdata(pdev, NULL);
21246 + iounmap((void *)base);
21247 + memset(pmif, 0, sizeof(*pmif));
21248 + pci_release_regions(pdev);
21255 +pmac_ide_pci_suspend(struct pci_dev *pdev, u32 state)
21257 + ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
21260 + if (state != pdev->dev.power_state && state >= 2) {
21261 + rc = pmac_ide_do_suspend(hwif);
21263 + pdev->dev.power_state = state;
21270 +pmac_ide_pci_resume(struct pci_dev *pdev)
21272 + ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
21275 + if (pdev->dev.power_state != 0) {
21276 + rc = pmac_ide_do_resume(hwif);
21278 + pdev->dev.power_state = 0;
21284 +static struct of_match pmac_ide_macio_match[] =
21288 + .type = OF_ANY_MATCH,
21289 + .compatible = OF_ANY_MATCH
21293 + .type = OF_ANY_MATCH,
21294 + .compatible = OF_ANY_MATCH
21297 + .name = OF_ANY_MATCH,
21299 + .compatible = OF_ANY_MATCH
21302 + .name = OF_ANY_MATCH,
21304 + .compatible = OF_ANY_MATCH
21309 +static struct macio_driver pmac_ide_macio_driver =
21311 + .name = "ide-pmac",
21312 + .match_table = pmac_ide_macio_match,
21313 + .probe = pmac_ide_macio_attach,
21314 + .suspend = pmac_ide_macio_suspend,
21315 + .resume = pmac_ide_macio_resume,
21318 +static struct pci_device_id pmac_ide_pci_match[] __devinitdata = {
21319 + { PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_KAUAI_ATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
21322 +static struct pci_driver pmac_ide_pci_driver = {
21323 + .name = "ide-pmac",
21324 + .id_table = pmac_ide_pci_match,
21325 + .probe = pmac_ide_pci_attach,
21326 + .suspend = pmac_ide_pci_suspend,
21327 + .resume = pmac_ide_pci_resume,
21331 +pmac_ide_probe(void)
21333 + if (_machine != _MACH_Pmac)
21336 +#ifdef CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST
21337 + pci_register_driver(&pmac_ide_pci_driver);
21338 + macio_register_driver(&pmac_ide_macio_driver);
21340 + macio_register_driver(&pmac_ide_macio_driver);
21341 + pci_register_driver(&pmac_ide_pci_driver);
21345 +#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
21348 pmac_ide_build_sglist(ide_drive_t *drive, struct request *rq)
21350 ide_hwif_t *hwif = HWIF(drive);
21351 @@ -942,7 +1479,7 @@
21352 if (hwif->sg_dma_active)
21355 - nents = blk_rq_map_sg(&drive->queue, rq, sg);
21356 + nents = blk_rq_map_sg(drive->queue, rq, sg);
21358 if (rq_data_dir(rq) == READ)
21359 pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
21360 @@ -952,7 +1489,7 @@
21361 return pci_map_sg(hwif->pci_dev, sg, nents, pmif->sg_dma_direction);
21366 pmac_ide_raw_build_sglist(ide_drive_t *drive, struct request *rq)
21368 ide_hwif_t *hwif = HWIF(drive);
21369 @@ -968,14 +1505,14 @@
21371 pmif->sg_dma_direction = PCI_DMA_FROMDEVICE;
21373 - if (sector_count > 127) {
21374 + if (sector_count > 128) {
21375 memset(&sg[nents], 0, sizeof(*sg));
21376 sg[nents].page = virt_to_page(virt_addr);
21377 sg[nents].offset = offset_in_page(virt_addr);
21378 - sg[nents].length = 127 * SECTOR_SIZE;
21379 + sg[nents].length = 128 * SECTOR_SIZE;
21381 - virt_addr = virt_addr + (127 * SECTOR_SIZE);
21382 - sector_count -= 127;
21383 + virt_addr = virt_addr + (128 * SECTOR_SIZE);
21384 + sector_count -= 128;
21386 memset(&sg[nents], 0, sizeof(*sg));
21387 sg[nents].page = virt_to_page(virt_addr);
21388 @@ -990,16 +1527,16 @@
21389 * pmac_ide_build_dmatable builds the DBDMA command list
21390 * for a transfer and sets the DBDMA channel to point to it.
21393 -pmac_ide_build_dmatable(ide_drive_t *drive, int wr)
21395 +pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
21397 struct dbdma_cmd *table;
21399 - struct request *rq = HWGROUP(drive)->rq;
21400 ide_hwif_t *hwif = HWIF(drive);
21401 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21402 volatile struct dbdma_regs *dma = pmif->dma_regs;
21403 struct scatterlist *sg;
21404 + int wr = (rq_data_dir(rq) == WRITE);
21406 /* DMA table is already aligned */
21407 table = (struct dbdma_cmd *) pmif->dma_table_cpu;
21408 @@ -1026,10 +1563,18 @@
21409 cur_addr = sg_dma_address(sg);
21410 cur_len = sg_dma_len(sg);
21412 + if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) {
21413 + if (pmif->broken_dma_warn == 0) {
21414 + printk(KERN_WARNING "%s: DMA on non aligned address,"
21415 + "switching to PIO on Ohare chipset\n", drive->name);
21416 + pmif->broken_dma_warn = 1;
21418 + goto use_pio_instead;
21421 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
21423 - if (++count >= MAX_DCMDS) {
21424 + if (count++ >= MAX_DCMDS) {
21425 printk(KERN_WARNING "%s: DMA table too small\n",
21427 goto use_pio_instead;
21428 @@ -1070,7 +1615,7 @@
21431 /* Teardown mappings after DMA has completed. */
21433 +static void __pmac
21434 pmac_ide_destroy_dmatable (ide_drive_t *drive)
21436 struct pci_dev *dev = HWIF(drive)->pci_dev;
21437 @@ -1081,67 +1626,25 @@
21439 pci_unmap_sg(dev, sg, nents, pmif->sg_dma_direction);
21440 pmif->sg_nents = 0;
21441 + HWIF(drive)->sg_dma_active = 0;
21445 -static __inline__ unsigned char
21446 -dma_bits_to_command(unsigned char bits)
21449 - return XFER_MW_DMA_2;
21451 - return XFER_MW_DMA_1;
21453 - return XFER_MW_DMA_0;
21457 -static __inline__ unsigned char
21458 -udma_bits_to_command(unsigned char bits, int high_speed)
21460 - if (high_speed) {
21462 - return XFER_UDMA_4;
21464 - return XFER_UDMA_3;
21467 - return XFER_UDMA_2;
21469 - return XFER_UDMA_1;
21471 - return XFER_UDMA_0;
21475 /* Calculate MultiWord DMA timings */
21477 -pmac_ide_mdma_enable(ide_drive_t *drive)
21478 +pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
21480 - u8 bits = drive->id->dma_mword & 0x07;
21481 - u8 feature = dma_bits_to_command(bits);
21483 + ide_hwif_t *hwif = HWIF(drive);
21484 + pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21485 int drive_cycle_time;
21486 struct hd_driveid *id = drive->id;
21487 - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21488 + u32 *timings, *timings2;
21489 + u32 timing_local[2];
21492 - /* Set feature on drive */
21493 - printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, feature & 0xf);
21494 - ret = pmac_ide_do_setfeature(drive, feature);
21496 - printk(KERN_WARNING "%s: Failed !\n", drive->name);
21500 - if (!drive->init_speed)
21501 - drive->init_speed = feature;
21503 /* which drive is it ? */
21504 - if (drive->select.b.unit & 0x01)
21505 - timings = &pmif->timings[1];
21507 - timings = &pmif->timings[0];
21508 + timings = &pmif->timings[drive->select.b.unit & 0x01];
21509 + timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
21511 /* Check if drive provide explicit cycle time */
21512 if ((id->field_valid & 2) && (id->eide_dma_time))
21513 @@ -1149,201 +1652,220 @@
21515 drive_cycle_time = 0;
21517 + /* Copy timings to local image */
21518 + timing_local[0] = *timings;
21519 + timing_local[1] = *timings2;
21521 /* Calculate controller timings */
21522 - set_timings_mdma(pmif->kind, timings, feature, drive_cycle_time);
21523 + ret = set_timings_mdma( drive, pmif->kind,
21524 + &timing_local[0],
21525 + &timing_local[1],
21527 + drive_cycle_time);
21531 + /* Set feature on drive */
21532 + printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, mode & 0xf);
21533 + ret = pmac_ide_do_setfeature(drive, mode);
21535 + printk(KERN_WARNING "%s: Failed !\n", drive->name);
21539 + /* Apply timings to controller */
21540 + *timings = timing_local[0];
21541 + *timings2 = timing_local[1];
21543 + /* Set speed info in drive */
21544 + drive->current_speed = mode;
21545 + if (!drive->init_speed)
21546 + drive->init_speed = mode;
21548 - drive->current_speed = feature;
21552 /* Calculate Ultra DMA timings */
21554 -pmac_ide_udma_enable(ide_drive_t *drive, int high_speed)
21555 +pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
21557 - u8 bits = drive->id->dma_ultra & 0x1f;
21558 - u8 feature = udma_bits_to_command(bits, high_speed);
21559 - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21561 + ide_hwif_t *hwif = HWIF(drive);
21562 + pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21563 + u32 *timings, *timings2;
21564 + u32 timing_local[2];
21567 + /* which drive is it ? */
21568 + timings = &pmif->timings[drive->select.b.unit & 0x01];
21569 + timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
21571 + /* Copy timings to local image */
21572 + timing_local[0] = *timings;
21573 + timing_local[1] = *timings2;
21575 + /* Calculate timings for interface */
21576 + if (pmif->kind == controller_un_ata6)
21577 + ret = set_timings_udma_ata6( &timing_local[0],
21578 + &timing_local[1],
21581 + ret = set_timings_udma_ata4(&timing_local[0], mode);
21585 /* Set feature on drive */
21586 - printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, feature & 0xf);
21587 - ret = pmac_ide_do_setfeature(drive, feature);
21588 + printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, mode & 0x0f);
21589 + ret = pmac_ide_do_setfeature(drive, mode);
21591 printk(KERN_WARNING "%s: Failed !\n", drive->name);
21595 - if (!drive->init_speed)
21596 - drive->init_speed = feature;
21597 + /* Apply timings to controller */
21598 + *timings = timing_local[0];
21599 + *timings2 = timing_local[1];
21601 - /* which drive is it ? */
21602 - if (drive->select.b.unit & 0x01)
21603 - timings = &pmif->timings[1];
21605 - timings = &pmif->timings[0];
21607 - set_timings_udma(timings, feature);
21608 + /* Set speed info in drive */
21609 + drive->current_speed = mode;
21610 + if (!drive->init_speed)
21611 + drive->init_speed = mode;
21613 - drive->current_speed = feature;
21617 -int pmac_ide_dma_check(ide_drive_t *drive)
21619 +pmac_ide_dma_check(ide_drive_t *drive)
21622 struct hd_driveid *id = drive->id;
21623 ide_hwif_t *hwif = HWIF(drive);
21624 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21628 drive->using_dma = 0;
21630 - if (pmif == NULL)
21633 if (drive->media == ide_floppy)
21635 - if (((id->capability & 1) == 0) &&
21636 - !HWIF(drive)->ide_dma_good_drive(drive))
21637 + if (((id->capability & 1) == 0) && !__ide_dma_good_drive(drive))
21639 - if (HWIF(drive)->ide_dma_bad_drive(drive))
21640 + if (__ide_dma_bad_drive(drive))
21643 - ata4 = (pmif->kind == controller_kl_ata4 ||
21644 - pmif->kind == controller_kl_ata4_80);
21647 - if (ata4 && (drive->media == ide_disk) &&
21648 - (id->field_valid & 0x0004) && (id->dma_ultra & 0x1f)) {
21649 - /* UltraDMA modes. */
21650 - drive->using_dma = pmac_ide_udma_enable(drive,
21651 - pmif->kind == controller_kl_ata4_80);
21653 - if (!drive->using_dma && (id->dma_mword & 0x0007)) {
21654 - /* Normal MultiWord DMA modes. */
21655 - drive->using_dma = pmac_ide_mdma_enable(drive);
21660 + map = XFER_MWDMA;
21661 + if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6) {
21662 + map |= XFER_UDMA;
21663 + if (pmif->cable_80) {
21664 + map |= XFER_UDMA_66;
21665 + if (pmif->kind == controller_un_ata6)
21666 + map |= XFER_UDMA_100;
21669 + mode = ide_find_best_mode(drive, map);
21670 + if (mode & XFER_UDMA)
21671 + drive->using_dma = pmac_ide_udma_enable(drive, mode);
21672 + else if (mode & XFER_MWDMA)
21673 + drive->using_dma = pmac_ide_mdma_enable(drive, mode);
21674 hwif->OUTB(0, IDE_CONTROL_REG);
21675 /* Apply settings to controller */
21676 - pmac_ide_selectproc(drive);
21677 + pmac_ide_do_update_timings(drive);
21683 -pmac_ide_dma_read (ide_drive_t *drive)
21685 +pmac_ide_dma_start(ide_drive_t *drive, int reading)
21687 ide_hwif_t *hwif = HWIF(drive);
21688 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21689 struct request *rq = HWGROUP(drive)->rq;
21690 -// ide_task_t *args = rq->special;
21691 u8 unit = (drive->select.b.unit & 0x01);
21693 - u8 lba48 = (drive->addressing == 1) ? 1 : 0;
21694 - task_ioreg_t command = WIN_NOP;
21698 + ata4 = (pmif->kind == controller_kl_ata4);
21700 - ata4 = (pmif->kind == controller_kl_ata4 ||
21701 - pmif->kind == controller_kl_ata4_80);
21703 - if (!pmac_ide_build_dmatable(drive, 0))
21704 + if (!pmac_ide_build_dmatable(drive, rq))
21707 /* Apple adds 60ns to wrDataSetup on reads */
21708 if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
21709 - writel(pmif->timings[unit]+0x00800000UL,
21710 + writel(pmif->timings[unit] + (reading ? 0x00800000UL : 0),
21711 (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
21712 (void)readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG));
21715 drive->waiting_for_dma = 1;
21721 +pmac_ide_dma_read(ide_drive_t *drive)
21723 + struct request *rq = HWGROUP(drive)->rq;
21724 + u8 lba48 = (drive->addressing == 1) ? 1 : 0;
21725 + task_ioreg_t command = WIN_NOP;
21727 + if (pmac_ide_dma_start(drive, 1))
21730 if (drive->media != ide_disk)
21732 - if (HWGROUP(drive)->handler != NULL) /* paranoia check */
21734 - ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
21736 - * FIX ME to use only ACB ide_task_t args Struct
21740 - ide_task_t *args = rq->special;
21741 - command = args->tfRegister[IDE_COMMAND_OFFSET];
21745 command = (lba48) ? WIN_READDMA_EXT : WIN_READDMA;
21748 + command = (lba48) ? WIN_READ_EXT: WIN_READ;
21750 if (rq->flags & REQ_DRIVE_TASKFILE) {
21751 ide_task_t *args = rq->special;
21752 command = args->tfRegister[IDE_COMMAND_OFFSET];
21756 /* issue cmd to drive */
21757 - hwif->OUTB(command, IDE_COMMAND_REG);
21758 + ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
21760 return pmac_ide_dma_begin(drive);
21765 pmac_ide_dma_write (ide_drive_t *drive)
21767 - ide_hwif_t *hwif = HWIF(drive);
21768 - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
21769 struct request *rq = HWGROUP(drive)->rq;
21770 -// ide_task_t *args = rq->special;
21771 - u8 unit = (drive->select.b.unit & 0x01);
21773 u8 lba48 = (drive->addressing == 1) ? 1 : 0;
21774 task_ioreg_t command = WIN_NOP;
21776 - if (pmif == NULL)
21777 + if (pmac_ide_dma_start(drive, 0))
21780 - ata4 = (pmif->kind == controller_kl_ata4 ||
21781 - pmif->kind == controller_kl_ata4_80);
21783 - if (!pmac_ide_build_dmatable(drive, 1))
21785 - /* Apple adds 60ns to wrDataSetup on reads */
21786 - if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
21787 - writel(pmif->timings[unit],
21788 - (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG));
21789 - (void)readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG));
21791 - drive->waiting_for_dma = 1;
21792 if (drive->media != ide_disk)
21794 - if (HWGROUP(drive)->handler != NULL) /* paranoia check */
21796 - ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
21798 - * FIX ME to use only ACB ide_task_t args Struct
21802 - ide_task_t *args = rq->special;
21803 - command = args->tfRegister[IDE_COMMAND_OFFSET];
21807 command = (lba48) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
21809 + command = (lba48) ? WIN_WRITE_EXT: WIN_WRITE;
21811 if (rq->flags & REQ_DRIVE_TASKFILE) {
21812 ide_task_t *args = rq->special;
21813 command = args->tfRegister[IDE_COMMAND_OFFSET];
21817 /* issue cmd to drive */
21818 - hwif->OUTB(command, IDE_COMMAND_REG);
21819 + ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL);
21821 return pmac_ide_dma_begin(drive);
21826 pmac_ide_dma_count (ide_drive_t *drive)
21828 return HWIF(drive)->ide_dma_begin(drive);
21833 pmac_ide_dma_begin (ide_drive_t *drive)
21835 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21836 @@ -1359,7 +1881,7 @@
21842 pmac_ide_dma_end (ide_drive_t *drive)
21844 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21845 @@ -1378,7 +1900,7 @@
21846 return (dstat & (RUN|DEAD|ACTIVE)) != RUN;
21851 pmac_ide_dma_test_irq (ide_drive_t *drive)
21853 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21854 @@ -1418,33 +1940,33 @@
21856 if (!drive->waiting_for_dma)
21857 printk(KERN_WARNING "ide%d, ide_dma_test_irq \
21858 - called while not waiting\n", pmif->index);
21859 + called while not waiting\n", HWIF(drive)->index);
21861 /* If dbdma didn't execute the STOP command yet, the
21862 * active bit is still set */
21863 drive->waiting_for_dma++;
21864 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {
21865 printk(KERN_WARNING "ide%d, timeout waiting \
21866 - for dbdma command stop\n", pmif->index);
21867 + for dbdma command stop\n", HWIF(drive)->index);
21877 pmac_ide_dma_host_off (ide_drive_t *drive)
21884 pmac_ide_dma_host_on (ide_drive_t *drive)
21891 pmac_ide_dma_lostirq (ide_drive_t *drive)
21893 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
21894 @@ -1461,316 +1983,87 @@
21898 -pmac_ide_setup_dma(struct device_node *np, int ix)
21899 +pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
21901 - struct pmac_ide_hwif *pmif = &pmac_ide[ix];
21903 - if (request_OF_resource(np, 1, " (mac-io IDE DMA)") == NULL) {
21904 - printk(KERN_ERR "ide-pmac(%s): can't request DMA resource !\n", np->name);
21905 + /* We won't need pci_dev if we switch to generic consistent
21906 + * DMA routines ...
21908 + if (hwif->pci_dev == NULL)
21913 - (volatile struct dbdma_regs*)ioremap(np->addrs[1].address, 0x200);
21916 * Allocate space for the DBDMA commands.
21917 * The +2 is +1 for the stop command and +1 to allow for
21918 * aligning the start address to a multiple of 16 bytes.
21920 pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent(
21921 - ide_hwifs[ix].pci_dev,
21923 (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
21924 &pmif->dma_table_dma);
21925 if (pmif->dma_table_cpu == NULL) {
21926 printk(KERN_ERR "%s: unable to allocate DMA command list\n",
21927 - ide_hwifs[ix].name);
21932 pmif->sg_table = kmalloc(sizeof(struct scatterlist) * MAX_DCMDS,
21934 if (pmif->sg_table == NULL) {
21935 - pci_free_consistent( ide_hwifs[ix].pci_dev,
21936 + pci_free_consistent( hwif->pci_dev,
21937 (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
21938 pmif->dma_table_cpu, pmif->dma_table_dma);
21941 - ide_hwifs[ix].ide_dma_off = &__ide_dma_off;
21942 - ide_hwifs[ix].ide_dma_off_quietly = &__ide_dma_off_quietly;
21943 - ide_hwifs[ix].ide_dma_on = &__ide_dma_on;
21944 - ide_hwifs[ix].ide_dma_check = &pmac_ide_dma_check;
21945 - ide_hwifs[ix].ide_dma_read = &pmac_ide_dma_read;
21946 - ide_hwifs[ix].ide_dma_write = &pmac_ide_dma_write;
21947 - ide_hwifs[ix].ide_dma_count = &pmac_ide_dma_count;
21948 - ide_hwifs[ix].ide_dma_begin = &pmac_ide_dma_begin;
21949 - ide_hwifs[ix].ide_dma_end = &pmac_ide_dma_end;
21950 - ide_hwifs[ix].ide_dma_test_irq = &pmac_ide_dma_test_irq;
21951 - ide_hwifs[ix].ide_dma_host_off = &pmac_ide_dma_host_off;
21952 - ide_hwifs[ix].ide_dma_host_on = &pmac_ide_dma_host_on;
21953 - ide_hwifs[ix].ide_dma_good_drive = &__ide_dma_good_drive;
21954 - ide_hwifs[ix].ide_dma_bad_drive = &__ide_dma_bad_drive;
21955 - ide_hwifs[ix].ide_dma_verbose = &__ide_dma_verbose;
21956 - ide_hwifs[ix].ide_dma_timeout = &__ide_dma_timeout;
21957 - ide_hwifs[ix].ide_dma_retune = &__ide_dma_retune;
21958 - ide_hwifs[ix].ide_dma_lostirq = &pmac_ide_dma_lostirq;
21959 - ide_hwifs[ix].ide_dma_queued_on = &__ide_dma_queued_on;
21960 - ide_hwifs[ix].ide_dma_queued_off = &__ide_dma_queued_off;
21961 + hwif->ide_dma_off = &__ide_dma_off;
21962 + hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
21963 + hwif->ide_dma_on = &__ide_dma_on;
21964 + hwif->ide_dma_check = &pmac_ide_dma_check;
21965 + hwif->ide_dma_read = &pmac_ide_dma_read;
21966 + hwif->ide_dma_write = &pmac_ide_dma_write;
21967 + hwif->ide_dma_count = &pmac_ide_dma_count;
21968 + hwif->ide_dma_begin = &pmac_ide_dma_begin;
21969 + hwif->ide_dma_end = &pmac_ide_dma_end;
21970 + hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq;
21971 + hwif->ide_dma_host_off = &pmac_ide_dma_host_off;
21972 + hwif->ide_dma_host_on = &pmac_ide_dma_host_on;
21973 + hwif->ide_dma_good_drive = &__ide_dma_good_drive;
21974 + hwif->ide_dma_bad_drive = &__ide_dma_bad_drive;
21975 + hwif->ide_dma_verbose = &__ide_dma_verbose;
21976 + hwif->ide_dma_timeout = &__ide_dma_timeout;
21977 + hwif->ide_dma_retune = &__ide_dma_retune;
21978 + hwif->ide_dma_lostirq = &pmac_ide_dma_lostirq;
21979 + hwif->ide_dma_queued_on = &__ide_dma_queued_on;
21980 + hwif->ide_dma_queued_off = &__ide_dma_queued_off;
21981 +#ifdef CONFIG_BLK_DEV_IDE_TCQ
21982 + hwif->ide_dma_queued_read = __ide_dma_queued_read;
21983 + hwif->ide_dma_queued_write = __ide_dma_queued_write;
21984 + hwif->ide_dma_queued_start = __ide_dma_queued_start;
21987 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
21989 - ide_hwifs[ix].autodma = 1;
21990 + hwif->autodma = 1;
21992 - ide_hwifs[ix].drives[0].autodma = ide_hwifs[ix].autodma;
21993 - ide_hwifs[ix].drives[1].autodma = ide_hwifs[ix].autodma;
21996 -#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
21998 -static void __pmac
21999 -idepmac_sleep_device(ide_drive_t *drive, unsigned base)
22001 - ide_hwif_t *hwif = HWIF(drive);
22004 - /* FIXME: We only handle the master IDE disk, we shoud
22005 - * try to fix CD-ROMs here
22007 - switch (drive->media) {
22009 - /* Spin down the drive */
22010 - hwif->OUTB(drive->select.all, base+0x60);
22011 - (void) hwif->INB(base+0x60);
22013 - hwif->OUTB(0x0, base+0x30);
22014 - hwif->OUTB(0x0, base+0x20);
22015 - hwif->OUTB(0x0, base+0x40);
22016 - hwif->OUTB(0x0, base+0x50);
22017 - hwif->OUTB(0xe0, base+0x70);
22018 - hwif->OUTB(0x2, base+0x160);
22019 - for (j = 0; j < 10; j++) {
22022 - status = hwif->INB(base+0x70);
22023 - if (!(status & BUSY_STAT) && (status & DRQ_STAT))
22036 -#ifdef CONFIG_PMAC_PBOOK
22037 -static void __pmac
22038 -idepmac_wake_device(ide_drive_t *drive, int used_dma)
22040 - /* We force the IDE subdriver to check for a media change
22041 - * This must be done first or we may lost the condition
22043 - * Problem: This can schedule. I moved the block device
22044 - * wakeup almost late by priority because of that.
22046 - //if (DRIVER(drive))
22047 - // check_disk_change(MKDEV(drive->disk->major, drive->disk->first_minor));
22049 -#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
22050 - /* We re-enable DMA on the drive if it was active. */
22051 - /* This doesn't work with the CD-ROM in the media-bay, probably
22052 - * because of a pending unit attention. The problem if that if I
22053 - * clear the error, the filesystem dies.
22055 - if (used_dma && !ide_spin_wait_hwgroup(drive)) {
22056 - /* Lock HW group */
22057 - HWGROUP(drive)->busy = 1;
22058 - pmac_ide_dma_check(drive);
22059 - HWGROUP(drive)->busy = 0;
22060 - if (!list_empty(&drive->queue.queue_head))
22061 - ide_do_request(HWGROUP(drive), 0);
22062 - spin_unlock_irq(&ide_lock);
22064 -#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
22067 -static void __pmac
22068 -idepmac_sleep_interface(pmac_ide_hwif_t *pmif, unsigned base, int mediabay)
22070 - struct device_node* np = pmif->node;
22072 - /* We clear the timings */
22073 - pmif->timings[0] = 0;
22074 - pmif->timings[1] = 0;
22076 - /* The media bay will handle itself just fine */
22080 - /* Disable the bus */
22081 - ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 0);
22083 + hwif->drives[0].autodma = hwif->autodma;
22084 + hwif->drives[1].autodma = hwif->autodma;
22086 -static void __pmac
22087 -idepmac_wake_interface(pmac_ide_hwif_t *pmif, unsigned long base, int mediabay)
22089 - struct device_node* np = pmif->node;
22092 - /* Revive IDE disk and controller */
22093 - ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
22094 - ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
22096 - ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 0);
22101 -idepmac_sleep_drive(ide_drive_t *drive, unsigned long base)
22105 - /* Wait for HW group to complete operations */
22106 - if (ide_spin_wait_hwgroup(drive)) {
22107 - // What can we do here ? Wake drive we had already
22108 - // put to sleep and return an error ?
22111 - /* Lock HW group */
22112 - HWGROUP(drive)->busy = 1;
22113 - /* Stop the device */
22114 - idepmac_sleep_device(drive, base);
22117 - spin_unlock_irq(&ide_lock);
22121 -idepmac_wake_drive(ide_drive_t *drive, unsigned long base)
22123 - ide_hwif_t *hwif = HWIF(drive);
22124 - unsigned long flags;
22127 - /* Reset timings */
22128 - pmac_ide_selectproc(drive);
22131 - /* Wait up to 20 seconds for the drive to be ready */
22132 - for (j = 0; j < 200; j++) {
22135 - hwif->OUTB(drive->select.all, base + 0x60);
22136 - if ((hwif->INB(base + 0x60)) != drive->select.all)
22138 - status = hwif->INB(base + 0x70);
22139 - if (!(status & BUSY_STAT))
22140 + hwif->atapi_dma = 1;
22141 + switch(pmif->kind) {
22142 + case controller_un_ata6:
22143 + hwif->ultra_mask = pmif->cable_80 ? 0x3f : 0x07;
22144 + hwif->mwdma_mask = 0x07;
22145 + hwif->swdma_mask = 0x00;
22149 - /* We resume processing on the HW group */
22150 - spin_lock_irqsave(&ide_lock, flags);
22151 - HWGROUP(drive)->busy = 0;
22152 - if (!list_empty(&drive->queue.queue_head))
22153 - ide_do_request(HWGROUP(drive), 0);
22154 - spin_unlock_irqrestore(&ide_lock, flags);
22155 + case controller_kl_ata4:
22156 + hwif->ultra_mask = pmif->cable_80 ? 0x1f : 0x07;
22157 + hwif->mwdma_mask = 0x07;
22158 + hwif->swdma_mask = 0x00;
22161 + hwif->ultra_mask = 0x00;
22162 + hwif->mwdma_mask = 0x07;
22163 + hwif->swdma_mask = 0x00;
22168 -/* Note: We support only master drives for now. This will have to be
22169 - * improved if we want to handle sleep on the iMacDV where the CD-ROM
22173 -idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
22176 - unsigned long base;
22180 - case PBOOK_SLEEP_REQUEST:
22182 - case PBOOK_SLEEP_REJECT:
22184 - case PBOOK_SLEEP_NOW:
22185 - for (i = 0; i < pmac_ide_count; ++i) {
22186 - ide_hwif_t *hwif;
22189 - if ((base = pmac_ide[i].regbase) == 0)
22192 - hwif = &ide_hwifs[i];
22193 - for (dn=0; dn<MAX_DRIVES; dn++) {
22194 - if (!hwif->drives[dn].present)
22196 - idepmac_sleep_drive(&hwif->drives[dn], base);
22198 - /* Disable irq during sleep */
22199 - disable_irq(pmac_ide[i].irq);
22201 - /* Check if this is a media bay with an IDE device or not
22204 - ret = check_media_bay_by_base(base, MB_CD);
22205 - if ((ret == 0) || (ret == -ENODEV))
22206 - idepmac_sleep_interface(&pmac_ide[i], base, (ret == 0));
22211 - for (i = 0; i < pmac_ide_count; ++i) {
22213 - if ((base = pmac_ide[i].regbase) == 0)
22216 - /* Make sure we have sane timings */
22217 - sanitize_timings(&pmac_ide[i]);
22219 - /* Check if this is a media bay with an IDE device or not
22222 - ret = check_media_bay_by_base(base, MB_CD);
22223 - if ((ret == 0) || (ret == -ENODEV)) {
22224 - idepmac_wake_interface(&pmac_ide[i], base, (ret == 0));
22229 - /* Let hardware get up to speed */
22231 - mdelay(IDE_WAKEUP_DELAY_MS);
22233 - for (i = 0; i < pmac_ide_count; ++i) {
22234 - ide_hwif_t *hwif;
22235 - int used_dma, dn;
22238 - if ((base = pmac_ide[i].regbase) == 0)
22241 - hwif = &ide_hwifs[i];
22242 - for (dn=0; dn<MAX_DRIVES; dn++) {
22243 - ide_drive_t *drive = &hwif->drives[dn];
22244 - if (!drive->present)
22246 - /* We don't have re-configured DMA yet */
22247 - used_dma = drive->using_dma;
22248 - drive->using_dma = 0;
22249 - idepmac_wake_drive(drive, base);
22251 - enable_irq(pmac_ide[i].irq);
22254 - idepmac_wake_device(drive, used_dma);
22257 - enable_irq(pmac_ide[i].irq);
22261 - return PBOOK_SLEEP_OK;
22263 -#endif /* CONFIG_PMAC_PBOOK */
22264 +#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
22265 diff -Nru a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c
22266 --- a/drivers/ieee1394/csr.c Wed Aug 20 14:21:56 2003
22267 +++ b/drivers/ieee1394/csr.c Mon Sep 1 17:00:00 2003
22269 #include <linux/module.h>
22270 #include <linux/moduleparam.h>
22271 #include <linux/param.h>
22272 +#include <linux/spinlock.h>
22274 #include "ieee1394_types.h"
22276 diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
22277 --- a/drivers/ieee1394/eth1394.c Tue Aug 19 20:56:01 2003
22278 +++ b/drivers/ieee1394/eth1394.c Mon Sep 1 17:00:00 2003
22280 #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
22282 static char version[] __devinitdata =
22283 - "$Rev: 1020 $ Ben Collins <bcollins@debian.org>";
22284 + "$Rev: 1043 $ Ben Collins <bcollins@debian.org>";
22286 struct fragment_info {
22287 struct list_head list;
22288 @@ -1349,21 +1349,20 @@
22290 ptask->addr, ptask->skb->data,
22293 + free_hpsb_packet(packet);
22297 ptask->packet = packet;
22298 hpsb_set_packet_complete_task(ptask->packet, ether1394_complete_cb,
22301 - if (hpsb_send_packet(packet))
22306 + if (!hpsb_send_packet(packet)) {
22307 ether1394_free_packet(packet);
22316 @@ -1600,7 +1599,7 @@
22317 case ETHTOOL_GDRVINFO: {
22318 struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
22319 strcpy (info.driver, driver_name);
22320 - strcpy (info.version, "$Rev: 1020 $");
22321 + strcpy (info.version, "$Rev: 1043 $");
22322 /* FIXME XXX provide sane businfo */
22323 strcpy (info.bus_info, "ieee1394");
22324 if (copy_to_user (useraddr, &info, sizeof (info)))
22325 diff -Nru a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
22326 --- a/drivers/ieee1394/ieee1394_core.c Sun Aug 3 17:00:00 2003
22327 +++ b/drivers/ieee1394/ieee1394_core.c Mon Sep 1 17:00:00 2003
22328 @@ -1124,7 +1124,7 @@
22329 to get the index of the ieee1394_driver
22332 - blocknum = (minor(inode->i_rdev) >> 4) & 0xF;
22333 + blocknum = (iminor(inode) >> 4) & 0xF;
22335 /* look up the driver */
22337 @@ -1237,6 +1237,7 @@
22338 EXPORT_SYMBOL(hpsb_free_tlabel);
22339 EXPORT_SYMBOL(hpsb_make_readpacket);
22340 EXPORT_SYMBOL(hpsb_make_writepacket);
22341 +EXPORT_SYMBOL(hpsb_make_streampacket);
22342 EXPORT_SYMBOL(hpsb_make_lockpacket);
22343 EXPORT_SYMBOL(hpsb_make_lock64packet);
22344 EXPORT_SYMBOL(hpsb_make_phypacket);
22345 diff -Nru a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
22346 --- a/drivers/ieee1394/ieee1394_core.h Thu Jul 24 17:00:00 2003
22347 +++ b/drivers/ieee1394/ieee1394_core.h Tue Aug 26 09:25:41 2003
22348 @@ -202,7 +202,7 @@
22349 /* return the index (within a minor number block) of a file */
22350 static inline unsigned char ieee1394_file_to_instance(struct file *file)
22352 - unsigned char minor = minor(file->f_dentry->d_inode->i_rdev);
22353 + unsigned char minor = iminor(file->f_dentry->d_inode);
22355 /* return lower 4 bits */
22356 return minor & 0xF;
22357 diff -Nru a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
22358 --- a/drivers/ieee1394/ieee1394_transactions.c Tue Aug 5 10:11:00 2003
22359 +++ b/drivers/ieee1394/ieee1394_transactions.c Mon Sep 1 17:00:00 2003
22360 @@ -104,7 +104,7 @@
22361 int channel, int tag, int sync)
22363 packet->header[0] = (length << 16) | (tag << 14) | (channel << 8)
22364 - | (TCODE_STREAM_DATA << 4) | sync;
22365 + | (TCODE_STREAM_DATA << 4) | sync;
22367 packet->header_size = 4;
22368 packet->data_size = length;
22369 @@ -317,6 +317,35 @@
22373 +struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, int length,
22374 + int channel, int tag, int sync)
22376 + struct hpsb_packet *packet;
22381 + packet = alloc_hpsb_packet(length + (length % 4 ? 4 - (length % 4) : 0));
22385 + if (length % 4) { /* zero padding bytes */
22386 + packet->data[length >> 2] = 0;
22388 + packet->host = host;
22390 + if (hpsb_get_tlabel(packet)) {
22391 + free_hpsb_packet(packet);
22395 + fill_async_stream_packet(packet, length, channel, tag, sync);
22397 + memcpy(packet->data, buffer, length);
22402 struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
22403 u64 addr, int extcode, quadlet_t *data,
22405 @@ -580,25 +609,18 @@
22406 u16 specifier_id_hi = (specifier_id & 0x00ffff00) >> 8;
22407 u8 specifier_id_lo = specifier_id & 0xff;
22409 - HPSB_VERBOSE("Send GASP: channel = %d, length = %d", channel, length);
22410 + HPSB_VERBOSE("Send GASP: channel = %d, length = %Zd", channel, length);
22414 - packet = alloc_hpsb_packet(length + (length % 4 ? 4 - (length % 4) : 0));
22416 + packet = hpsb_make_streampacket(host, NULL, length, channel, 3, 0);
22420 - if (length % 4) {
22421 - packet->data[length / 4] = 0;
22424 - packet->host = host;
22425 - fill_async_stream_packet(packet, length, channel, 3, 0);
22427 packet->data[0] = cpu_to_be32((host->node_id << 16) | specifier_id_hi);
22428 packet->data[1] = cpu_to_be32((specifier_id_lo << 24) | (version & 0x00ffffff));
22430 - memcpy(&(packet->data[2]), buffer, length - 4);
22431 + memcpy(&(packet->data[2]), buffer, length - 8);
22433 packet->generation = generation;
22435 diff -Nru a/drivers/ieee1394/ieee1394_transactions.h b/drivers/ieee1394/ieee1394_transactions.h
22436 --- a/drivers/ieee1394/ieee1394_transactions.h Sun Aug 3 17:00:00 2003
22437 +++ b/drivers/ieee1394/ieee1394_transactions.h Mon Sep 1 17:00:00 2003
22439 int tag, int sync);
22440 struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node,
22441 u64 addr, quadlet_t *buffer, size_t length);
22442 +struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,
22443 + int length, int channel, int tag, int sync);
22446 * hpsb_packet_success - Make sense of the ack and reply codes and
22447 diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
22448 --- a/drivers/ieee1394/nodemgr.c Sat Aug 16 05:08:09 2003
22449 +++ b/drivers/ieee1394/nodemgr.c Mon Sep 1 17:00:00 2003
22450 @@ -1304,12 +1304,14 @@
22451 * unregister all the unit directories. */
22452 nodemgr_remove_node_uds(ne);
22454 + /* With all the ud's gone, mark the generation current,
22455 + * this way the probe will succeed. */
22456 + ne->generation = generation;
22458 /* This will re-register our unitdir's */
22459 nodemgr_process_config_rom (hi, ne, busoptions);
22462 - /* Since that's done, we can declare this record current */
22463 - ne->generation = generation;
22465 + ne->generation = generation;
22467 /* Update unit_dirs with attached drivers */
22468 bus_for_each_dev(&ieee1394_bus_type, NULL, ne,
22469 diff -Nru a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
22470 --- a/drivers/ieee1394/ohci1394.c Sun Aug 3 17:00:00 2003
22471 +++ b/drivers/ieee1394/ohci1394.c Mon Sep 1 17:00:00 2003
22472 @@ -161,7 +161,7 @@
22473 printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
22475 static char version[] __devinitdata =
22476 - "$Rev: 1023 $ Ben Collins <bcollins@debian.org>";
22477 + "$Rev: 1045 $ Ben Collins <bcollins@debian.org>";
22479 /* Module Parameters */
22480 static int phys_dma = 1;
22481 @@ -1451,7 +1451,7 @@
22483 /* set sync flag on first DMA descriptor */
22484 struct dma_cmd *cmd = &recv->block[recv->block_dma];
22485 - cmd->control |= DMA_CTL_WAIT;
22486 + cmd->control |= cpu_to_le32(DMA_CTL_WAIT);
22488 /* match sync field */
22489 contextMatch |= (sync&0xf)<<8;
22490 @@ -1675,10 +1675,10 @@
22491 struct dma_cmd *im = &recv->block[recv->block_dma];
22493 /* check the DMA descriptor for new writes to xferStatus */
22494 - u16 xferstatus = im->status >> 16;
22495 + u16 xferstatus = le32_to_cpu(im->status) >> 16;
22497 /* rescount is the number of bytes *remaining to be written* in the block */
22498 - u16 rescount = im->status & 0xFFFF;
22499 + u16 rescount = le32_to_cpu(im->status) & 0xFFFF;
22501 unsigned char event = xferstatus & 0x1F;
22503 diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
22504 --- a/drivers/ieee1394/pcilynx.c Sat Aug 16 05:08:53 2003
22505 +++ b/drivers/ieee1394/pcilynx.c Tue Aug 26 09:25:41 2003
22506 @@ -875,7 +875,7 @@
22508 static int mem_open(struct inode *inode, struct file *file)
22510 - int cid = minor(inode->i_rdev);
22511 + int cid = iminor(inode);
22512 enum { t_rom, t_aux, t_ram } type;
22513 struct memdata *md;
22515 diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
22516 --- a/drivers/ieee1394/raw1394.c Sun Aug 3 17:00:00 2003
22517 +++ b/drivers/ieee1394/raw1394.c Mon Sep 1 17:00:00 2003
22518 @@ -180,6 +180,7 @@
22520 if ((req->req.type == RAW1394_REQ_ASYNC_READ) ||
22521 (req->req.type == RAW1394_REQ_ASYNC_WRITE) ||
22522 + (req->req.type == RAW1394_REQ_ASYNC_STREAM) ||
22523 (req->req.type == RAW1394_REQ_LOCK) ||
22524 (req->req.type == RAW1394_REQ_LOCK64))
22525 hpsb_free_tlabel(packet);
22526 @@ -689,6 +690,21 @@
22527 req->req.length = 0;
22530 + case RAW1394_REQ_ASYNC_STREAM:
22531 + DBGMSG("stream_request called");
22533 + packet = hpsb_make_streampacket(fi->host, NULL, req->req.length, node & 0x3f/*channel*/,
22534 + (req->req.misc >> 16) & 0x3, req->req.misc & 0xf);
22538 + if (copy_from_user(packet->data, int2ptr(req->req.sendb),
22539 + req->req.length))
22540 + req->req.error = RAW1394_ERROR_MEMFAULT;
22542 + req->req.length = 0;
22545 case RAW1394_REQ_LOCK:
22546 DBGMSG("lock_request called");
22547 if ((req->req.misc == EXTCODE_FETCH_ADD)
22548 @@ -892,7 +908,7 @@
22549 struct arm_request_response *arm_req_resp = NULL;
22551 DBGMSG("arm_read called by node: %X"
22552 - "addr: %4.4x %8.8x length: %u", nodeid,
22553 + "addr: %4.4x %8.8x length: %Zu", nodeid,
22554 (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
22556 spin_lock(&host_info_lock);
22557 @@ -1028,7 +1044,7 @@
22558 struct arm_request_response *arm_req_resp = NULL;
22560 DBGMSG("arm_write called by node: %X"
22561 - "addr: %4.4x %8.8x length: %u", nodeid,
22562 + "addr: %4.4x %8.8x length: %Zu", nodeid,
22563 (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
22565 spin_lock(&host_info_lock);
22566 @@ -1566,8 +1582,8 @@
22567 req->req.length, ((req->req.misc >> 8) & 0xFF),
22568 (req->req.misc & 0xFF),((req->req.misc >> 16) & 0xFFFF));
22569 /* check addressrange */
22570 - if ((((req->req.address) & ~((u64)0xFFFFFFFFFFFFLL)) != 0) ||
22571 - (((req->req.address + req->req.length) & ~((u64)0xFFFFFFFFFFFFLL)) != 0)) {
22572 + if ((((req->req.address) & ~(0xFFFFFFFFFFFFULL)) != 0) ||
22573 + (((req->req.address + req->req.length) & ~(0xFFFFFFFFFFFFULL)) != 0)) {
22574 req->req.length = 0;
22577 @@ -1578,7 +1594,7 @@
22580 /* allocation of addr_space_buffer */
22581 - addr->addr_space_buffer = (u8 *)kmalloc(req->req.length,SLAB_KERNEL);
22582 + addr->addr_space_buffer = (u8 *)vmalloc(req->req.length);
22583 if (!(addr->addr_space_buffer)) {
22585 req->req.length = 0;
22586 @@ -1592,7 +1608,7 @@
22587 /* init: user -> kernel */
22588 if (copy_from_user(addr->addr_space_buffer,int2ptr(req->req.sendb),
22589 req->req.length)) {
22590 - kfree(addr->addr_space_buffer);
22591 + vfree(addr->addr_space_buffer);
22595 @@ -1633,7 +1649,7 @@
22598 /* addressrange occupied by same host */
22599 - kfree(addr->addr_space_buffer);
22600 + vfree(addr->addr_space_buffer);
22602 spin_unlock_irqrestore(&host_info_lock, flags);
22603 return (-EALREADY);
22604 @@ -1668,7 +1684,7 @@
22605 int2ptr(&addr->start),sizeof(u64))) {
22606 printk(KERN_ERR "raw1394: arm_register failed "
22607 " address-range-entry is invalid -> EFAULT !!!\n");
22608 - kfree(addr->addr_space_buffer);
22609 + vfree(addr->addr_space_buffer);
22611 spin_unlock_irqrestore(&host_info_lock, flags);
22613 @@ -1686,7 +1702,7 @@
22614 list_add_tail(&addr->addr_list, &fi->addr_list);
22616 DBGMSG("arm_register failed errno: %d \n",retval);
22617 - kfree(addr->addr_space_buffer);
22618 + vfree(addr->addr_space_buffer);
22620 spin_unlock_irqrestore(&host_info_lock, flags);
22621 return (-EALREADY);
22622 @@ -1760,7 +1776,7 @@
22623 if (another_host) {
22624 DBGMSG("delete entry from list -> success");
22625 list_del(&addr->addr_list);
22626 - kfree(addr->addr_space_buffer);
22627 + vfree(addr->addr_space_buffer);
22629 free_pending_request(req); /* immediate success or fail */
22630 spin_unlock_irqrestore(&host_info_lock, flags);
22631 @@ -1775,7 +1791,7 @@
22632 DBGMSG("delete entry from list -> success");
22633 list_del(&addr->addr_list);
22634 spin_unlock_irqrestore(&host_info_lock, flags);
22635 - kfree(addr->addr_space_buffer);
22636 + vfree(addr->addr_space_buffer);
22638 free_pending_request(req); /* immediate success or fail */
22639 return sizeof(struct raw1394_request);
22640 @@ -2440,7 +2456,7 @@
22642 DBGMSG("raw1394_release: delete addr_entry from list");
22643 list_del(&addr->addr_list);
22644 - kfree(addr->addr_space_buffer);
22645 + vfree(addr->addr_space_buffer);
22648 spin_unlock_irq(&host_info_lock);
22649 diff -Nru a/drivers/ieee1394/raw1394.h b/drivers/ieee1394/raw1394.h
22650 --- a/drivers/ieee1394/raw1394.h Wed Feb 12 20:57:18 2003
22651 +++ b/drivers/ieee1394/raw1394.h Mon Sep 1 17:00:00 2003
22653 #define RAW1394_REQ_LOCK64 103
22654 #define RAW1394_REQ_ISO_SEND 104
22655 #define RAW1394_REQ_ASYNC_SEND 105
22656 +#define RAW1394_REQ_ASYNC_STREAM 106
22658 #define RAW1394_REQ_ISO_LISTEN 200
22659 #define RAW1394_REQ_FCP_LISTEN 201
22660 diff -Nru a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
22661 --- a/drivers/ieee1394/sbp2.c Sun Aug 10 22:11:01 2003
22662 +++ b/drivers/ieee1394/sbp2.c Mon Sep 1 17:00:00 2003
22666 static char version[] __devinitdata =
22667 - "$Rev: 1018 $ Ben Collins <bcollins@debian.org>";
22668 + "$Rev: 1034 $ Ben Collins <bcollins@debian.org>";
22671 * Module load parameter definitions
22672 @@ -1002,9 +1002,8 @@
22673 sbp2scsi_complete_all_commands(scsi_id, DID_NO_CONNECT);
22675 /* Remove it from the scsi layer now */
22678 scsi_remove_device(sdev);
22681 sbp2util_remove_command_orb_pool(scsi_id);
22683 diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
22684 --- a/drivers/input/evdev.c Tue Aug 12 16:21:11 2003
22685 +++ b/drivers/input/evdev.c Sun Aug 31 16:14:28 2003
22686 @@ -122,7 +122,7 @@
22687 static int evdev_open(struct inode * inode, struct file * file)
22689 struct evdev_list *list;
22690 - int i = minor(inode->i_rdev) - EVDEV_MINOR_BASE;
22691 + int i = iminor(inode) - EVDEV_MINOR_BASE;
22694 if (i >= EVDEV_MINORS || !evdev_table[i])
22695 @@ -305,6 +305,7 @@
22696 case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;
22697 case EV_REL: bits = dev->relbit; len = REL_MAX; break;
22698 case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
22699 + case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;
22700 case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
22701 case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
22702 case EV_FF: bits = dev->ffbit; len = FF_MAX; break;
22703 diff -Nru a/drivers/input/input.c b/drivers/input/input.c
22704 --- a/drivers/input/input.c Tue Aug 12 13:29:25 2003
22705 +++ b/drivers/input/input.c Tue Aug 26 09:25:41 2003
22706 @@ -280,7 +280,7 @@
22707 if (id->id.product != dev->id.product)
22710 - if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
22711 + if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
22712 if (id->id.version != dev->id.version)
22715 @@ -527,7 +527,7 @@
22717 static int input_open_file(struct inode *inode, struct file *file)
22719 - struct input_handler *handler = input_table[minor(inode->i_rdev) >> 5];
22720 + struct input_handler *handler = input_table[iminor(inode) >> 5];
22721 struct file_operations *old_fops, *new_fops = NULL;
22724 diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
22725 --- a/drivers/input/joydev.c Fri May 2 06:55:04 2003
22726 +++ b/drivers/input/joydev.c Tue Aug 26 09:25:41 2003
22727 @@ -170,7 +170,7 @@
22728 static int joydev_open(struct inode *inode, struct file *file)
22730 struct joydev_list *list;
22731 - int i = minor(inode->i_rdev) - JOYDEV_MINOR_BASE;
22732 + int i = iminor(inode) - JOYDEV_MINOR_BASE;
22734 if (i >= JOYDEV_MINORS || !joydev_table[i])
22736 diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
22737 --- a/drivers/input/mousedev.c Fri May 2 06:55:04 2003
22738 +++ b/drivers/input/mousedev.c Tue Aug 26 09:25:41 2003
22739 @@ -228,11 +228,11 @@
22742 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
22743 - if (major(inode->i_rdev) == MISC_MAJOR)
22744 + if (imajor(inode) == MISC_MAJOR)
22748 - i = minor(inode->i_rdev) - MOUSEDEV_MINOR_BASE;
22749 + i = iminor(inode) - MOUSEDEV_MINOR_BASE;
22751 if (i >= MOUSEDEV_MINORS || !mousedev_table[i])
22753 diff -Nru a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
22754 --- a/drivers/input/serio/sa1111ps2.c Sat May 17 07:47:27 2003
22755 +++ b/drivers/input/serio/sa1111ps2.c Sun Aug 24 07:45:05 2003
22758 serio_interrupt(&ps2if->io, scancode, flag, regs);
22760 - status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
22761 + status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
22763 - handled = IRQ_HANDLED;
22764 + handled = IRQ_HANDLED;
22768 @@ -232,9 +232,8 @@
22770 * Add one device to this driver.
22772 -static int ps2_probe(struct device *dev)
22773 +static int ps2_probe(struct sa1111_dev *dev)
22775 - struct sa1111_dev *sadev = SA1111_DEV(dev);
22776 struct ps2if *ps2if;
22779 @@ -249,20 +248,20 @@
22780 ps2if->io.write = ps2_write;
22781 ps2if->io.open = ps2_open;
22782 ps2if->io.close = ps2_close;
22783 - ps2if->io.name = dev->name;
22784 - ps2if->io.phys = dev->bus_id;
22785 + ps2if->io.name = dev->dev.bus_id;
22786 + ps2if->io.phys = dev->dev.bus_id;
22787 ps2if->io.driver = ps2if;
22788 - ps2if->dev = sadev;
22789 - dev->driver_data = ps2if;
22790 + ps2if->dev = dev;
22791 + sa1111_set_drvdata(dev, ps2if);
22793 spin_lock_init(&ps2if->lock);
22796 * Request the physical region for this PS2 port.
22798 - if (!request_mem_region(sadev->res.start,
22799 - sadev->res.end - sadev->res.start + 1,
22800 - SA1111_DRIVER_NAME(sadev))) {
22801 + if (!request_mem_region(dev->res.start,
22802 + dev->res.end - dev->res.start + 1,
22803 + SA1111_DRIVER_NAME(dev))) {
22807 @@ -270,7 +269,7 @@
22809 * Our parent device has already mapped the region.
22811 - ps2if->base = (unsigned long)sadev->mapbase;
22812 + ps2if->base = (unsigned long)dev->mapbase;
22814 sa1111_enable_device(ps2if->dev);
22816 @@ -301,10 +300,10 @@
22819 sa1111_disable_device(ps2if->dev);
22820 - release_mem_region(sadev->res.start,
22821 - sadev->res.end - sadev->res.start + 1);
22822 + release_mem_region(dev->res.start,
22823 + dev->res.end - dev->res.start + 1);
22825 - dev->driver_data = NULL;
22826 + sa1111_set_drvdata(dev, NULL);
22830 @@ -312,31 +311,17 @@
22832 * Remove one device from this driver.
22834 -static int ps2_remove(struct device *dev)
22835 +static int ps2_remove(struct sa1111_dev *dev)
22837 - struct ps2if *ps2if = dev->driver_data;
22838 - struct sa1111_dev *sadev = SA1111_DEV(dev);
22839 + struct ps2if *ps2if = sa1111_get_drvdata(dev);
22841 serio_unregister_port(&ps2if->io);
22842 - release_mem_region(sadev->res.start,
22843 - sadev->res.end - sadev->res.start + 1);
22846 - dev->driver_data = NULL;
22850 + release_mem_region(dev->res.start,
22851 + dev->res.end - dev->res.start + 1);
22852 + sa1111_set_drvdata(dev, NULL);
22855 - * We should probably do something here, but what?
22857 -static int ps2_suspend(struct device *dev, u32 state, u32 level)
22863 -static int ps2_resume(struct device *dev, u32 level)
22868 @@ -345,24 +330,21 @@
22870 static struct sa1111_driver ps2_driver = {
22872 - .name = "sa1111-ps2",
22873 - .bus = &sa1111_bus_type,
22874 - .probe = ps2_probe,
22875 - .remove = ps2_remove,
22876 - .suspend = ps2_suspend,
22877 - .resume = ps2_resume,
22878 + .name = "sa1111-ps2",
22880 - .devid = SA1111_DEVID_PS2,
22881 + .devid = SA1111_DEVID_PS2,
22882 + .probe = ps2_probe,
22883 + .remove = ps2_remove,
22886 static int __init ps2_init(void)
22888 - return driver_register(&ps2_driver.drv);
22889 + return sa1111_driver_register(&ps2_driver);
22892 static void __exit ps2_exit(void)
22894 - driver_unregister(&ps2_driver.drv);
22895 + sa1111_driver_unregister(&ps2_driver);
22898 module_init(ps2_init);
22899 diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c
22900 --- a/drivers/input/tsdev.c Fri May 2 06:55:04 2003
22901 +++ b/drivers/input/tsdev.c Tue Aug 26 09:25:41 2003
22904 static int tsdev_open(struct inode *inode, struct file *file)
22906 - int i = minor(inode->i_rdev) - TSDEV_MINOR_BASE;
22907 + int i = iminor(inode) - TSDEV_MINOR_BASE;
22908 struct tsdev_list *list;
22910 if (i >= TSDEV_MINORS || !tsdev_table[i])
22911 diff -Nru a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
22912 --- a/drivers/isdn/capi/capi.c Wed Jun 11 12:32:56 2003
22913 +++ b/drivers/isdn/capi/capi.c Tue Aug 26 09:25:41 2003
22914 @@ -964,7 +964,7 @@
22916 struct capiminor *mp;
22918 - if ((mp = capiminor_find(minor(file->f_dentry->d_inode->i_rdev))) == 0)
22919 + if ((mp = capiminor_find(iminor(file->f_dentry->d_inode))) == 0)
22921 if (mp->nccip == 0)
22923 diff -Nru a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
22924 --- a/drivers/isdn/hardware/eicon/divasi.c Mon Jul 21 12:08:32 2003
22925 +++ b/drivers/isdn/hardware/eicon/divasi.c Tue Aug 26 09:25:41 2003
22926 @@ -432,7 +432,7 @@
22928 static int um_idi_release(struct inode *inode, struct file *file)
22930 - unsigned int adapter_nr = minor(inode->i_rdev);
22931 + unsigned int adapter_nr = iminor(inode);
22934 if (!(file->private_data)) {
22935 diff -Nru a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
22936 --- a/drivers/isdn/i4l/isdn_common.c Mon Jul 21 11:39:14 2003
22937 +++ b/drivers/isdn/i4l/isdn_common.c Tue Aug 26 09:25:41 2003
22938 @@ -1432,7 +1432,7 @@
22940 isdn_ctrl_open(struct inode *ino, struct file *file)
22942 - unsigned int minor = minor(ino->i_rdev);
22943 + unsigned int minor = iminor(ino);
22944 struct isdn_slot *slot = get_slot_by_minor(minor - ISDN_MINOR_CTRL);
22947 @@ -1795,7 +1795,7 @@
22949 isdn_open(struct inode * inode, struct file * file)
22951 - int minor = minor(inode->i_rdev);
22952 + int minor = iminor(inode);
22954 struct file_operations *old_fops, *new_fops = NULL;
22956 diff -Nru a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
22957 --- a/drivers/isdn/i4l/isdn_ppp.c Tue Jul 15 10:01:29 2003
22958 +++ b/drivers/isdn/i4l/isdn_ppp.c Tue Aug 26 09:25:41 2003
22959 @@ -119,7 +119,7 @@
22960 ipppd_open(struct inode *ino, struct file *file)
22962 unsigned long flags;
22963 - unsigned int minor = minor(ino->i_rdev) - ISDN_MINOR_PPP;
22964 + unsigned int minor = iminor(ino) - ISDN_MINOR_PPP;
22965 struct ipppd *ipppd;
22967 ipppd = kmalloc(sizeof(*ipppd), GFP_KERNEL);
22968 diff -Nru a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
22969 --- a/drivers/macintosh/adb.c Sat Jun 7 00:45:03 2003
22970 +++ b/drivers/macintosh/adb.c Tue Aug 26 09:25:41 2003
22971 @@ -712,7 +712,7 @@
22973 struct adbdev_state *state;
22975 - if (minor(inode->i_rdev) > 0 || adb_controller == NULL)
22976 + if (iminor(inode) > 0 || adb_controller == NULL)
22978 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
22980 diff -Nru a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
22981 --- a/drivers/macintosh/macio_asic.c Sat Aug 16 11:47:51 2003
22982 +++ b/drivers/macintosh/macio_asic.c Tue Aug 26 06:35:38 2003
22984 #include <asm/prom.h>
22985 #include <asm/pci-bridge.h>
22987 +static struct macio_chip *macio_on_hold;
22990 macio_bus_match(struct device *dev, struct device_driver *drv)
22992 @@ -36,21 +38,27 @@
22993 return of_match_device(matches, &macio_dev->ofdev) != NULL;
22996 -struct bus_type macio_bus_type = {
22998 - match: macio_bus_match,
23000 +struct macio_dev *macio_dev_get(struct macio_dev *dev)
23002 + struct device *tmp;
23005 -macio_bus_driver_init(void)
23008 + tmp = get_device(&dev->ofdev.dev);
23010 + return to_macio_device(tmp);
23015 +void macio_dev_put(struct macio_dev *dev)
23017 - return bus_register(&macio_bus_type);
23019 + put_device(&dev->ofdev.dev);
23022 -postcore_initcall(macio_bus_driver_init);
23025 -macio_device_probe(struct device *dev)
23026 +static int macio_device_probe(struct device *dev)
23028 int error = -ENODEV;
23029 struct macio_driver *drv;
23030 @@ -63,55 +71,89 @@
23034 -/* if (!try_module_get(driver->owner)) {
23035 - printk(KERN_ERR "Can't get a module reference for %s\n", driver->name);
23039 + macio_dev_get(macio_dev);
23041 match = of_match_device(drv->match_table, &macio_dev->ofdev);
23043 error = drv->probe(macio_dev, match);
23045 - module_put(driver->owner);
23048 + macio_dev_put(macio_dev);
23054 -macio_device_remove(struct device *dev)
23055 +static int macio_device_remove(struct device *dev)
23057 struct macio_dev * macio_dev = to_macio_device(dev);
23058 struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
23060 if (drv && drv->remove)
23061 drv->remove(macio_dev);
23062 + macio_dev_put(macio_dev);
23068 -macio_device_suspend(struct device *dev, u32 state, u32 level)
23069 +static int macio_device_suspend(struct device *dev, u32 state)
23071 struct macio_dev * macio_dev = to_macio_device(dev);
23072 - struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
23073 + struct macio_driver * drv;
23076 - if (drv && drv->suspend)
23077 - error = drv->suspend(macio_dev, state, level);
23078 + if (macio_dev->ofdev.dev.driver == NULL)
23080 + drv = to_macio_driver(macio_dev->ofdev.dev.driver);
23081 + if (drv->suspend)
23082 + error = drv->suspend(macio_dev, state);
23087 -macio_device_resume(struct device * dev, u32 level)
23088 +static int macio_device_resume(struct device * dev)
23090 struct macio_dev * macio_dev = to_macio_device(dev);
23091 - struct macio_driver * drv = to_macio_driver(macio_dev->ofdev.dev.driver);
23092 + struct macio_driver * drv;
23095 - if (drv && drv->resume)
23096 - error = drv->resume(macio_dev, level);
23097 + if (macio_dev->ofdev.dev.driver == NULL)
23099 + drv = to_macio_driver(macio_dev->ofdev.dev.driver);
23101 + error = drv->resume(macio_dev);
23105 +struct bus_type macio_bus_type = {
23107 + .match = macio_bus_match,
23108 + .suspend = macio_device_suspend,
23109 + .resume = macio_device_resume,
23113 +macio_bus_driver_init(void)
23115 + return bus_register(&macio_bus_type);
23118 +postcore_initcall(macio_bus_driver_init);
23122 + * macio_release_dev - free a macio device structure when all users of it are finished.
23123 + * @dev: device that's been disconnected
23125 + * Will be called only by the device core when all users of this macio device are
23126 + * done. This currently means never as we don't hot remove any macio device yet,
23127 + * though that will happen with mediabay based devices in a later implementation.
23129 +static void macio_release_dev(struct device *dev)
23131 + struct macio_dev *mdev;
23133 + mdev = to_macio_device(dev);
23138 * macio_add_one_device - Add one device from OF node to the device tree
23139 * @chip: pointer to the macio_chip holding the device
23140 @@ -121,13 +163,15 @@
23141 * When media-bay is changed to hotswap drivers, this function will
23142 * be exposed to the bay driver some way...
23144 -static struct macio_dev *
23145 -macio_add_one_device(struct macio_chip *chip, struct device *parent,
23146 +static struct macio_dev * macio_add_one_device(struct macio_chip *chip, struct device *parent,
23147 struct device_node *np, struct macio_dev *in_bay)
23149 struct macio_dev *dev;
23155 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
23158 @@ -140,6 +184,7 @@
23159 dev->ofdev.dev.dma_mask = &dev->ofdev.dma_mask;
23160 dev->ofdev.dev.parent = parent;
23161 dev->ofdev.dev.bus = &macio_bus_type;
23162 + dev->ofdev.dev.release = macio_release_dev;
23164 /* MacIO itself has a different reg, we use it's PCI base */
23165 if (np == chip->of_node) {
23166 @@ -164,8 +209,7 @@
23171 -macio_skip_device(struct device_node *np)
23172 +static int macio_skip_device(struct device_node *np)
23174 if (strncmp(np->name, "battery", 7) == 0)
23176 @@ -185,10 +229,9 @@
23177 * For now, childs of media-bay are added now as well. This will
23178 * change rsn though.
23181 -macio_pci_add_devices(struct macio_chip *chip)
23182 +static void macio_pci_add_devices(struct macio_chip *chip)
23184 - struct device_node *np;
23185 + struct device_node *np, *pnode;
23186 struct macio_dev *rdev, *mdev, *mbdev = NULL, *sdev = NULL;
23187 struct device *parent = NULL;
23189 @@ -196,16 +239,23 @@
23191 if (chip->lbus.pdev)
23192 parent = &chip->lbus.pdev->dev;
23194 - rdev = macio_add_one_device(chip, parent, chip->of_node, NULL);
23196 + pnode = of_node_get(chip->of_node);
23197 + if (pnode == NULL)
23200 + rdev = macio_add_one_device(chip, parent, pnode, NULL);
23204 /* First scan 1st level */
23205 - for (np = chip->of_node->child; np != NULL; np = np->sibling) {
23206 + for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
23207 if (!macio_skip_device(np)) {
23209 mdev = macio_add_one_device(chip, &rdev->ofdev.dev, np, NULL);
23210 - if (strncmp(np->name, "media-bay", 9) == 0)
23211 + if (mdev == NULL)
23213 + else if (strncmp(np->name, "media-bay", 9) == 0)
23215 else if (strncmp(np->name, "escc", 4) == 0)
23217 @@ -213,17 +263,21 @@
23220 /* Add media bay devices if any */
23222 - for (np = mbdev->ofdev.node->child; np != NULL; np = np->sibling)
23223 - if (!macio_skip_device(np))
23224 - macio_add_one_device(chip, &mbdev->ofdev.dev, np, mbdev);
23227 + for (np = NULL; (np = of_get_next_child(mbdev->ofdev.node, np)) != NULL;)
23228 + if (!macio_skip_device(np)) {
23230 + if (macio_add_one_device(chip, &mbdev->ofdev.dev, np, mbdev) == NULL)
23233 /* Add serial ports if any */
23235 - for (np = sdev->ofdev.node->child; np != NULL; np = np->sibling)
23236 - if (!macio_skip_device(np))
23237 - macio_add_one_device(chip, &sdev->ofdev.dev, np, NULL);
23240 + for (np = NULL; (np = of_get_next_child(sdev->ofdev.node, np)) != NULL;)
23241 + if (!macio_skip_device(np)) {
23243 + if (macio_add_one_device(chip, &sdev->ofdev.dev, np, NULL) == NULL)
23249 @@ -231,8 +285,7 @@
23250 * macio_register_driver - Registers a new MacIO device driver
23251 * @drv: pointer to the driver definition structure
23254 -macio_register_driver(struct macio_driver *drv)
23255 +int macio_register_driver(struct macio_driver *drv)
23259 @@ -240,8 +293,6 @@
23260 drv->driver.name = drv->name;
23261 drv->driver.bus = &macio_bus_type;
23262 drv->driver.probe = macio_device_probe;
23263 - drv->driver.resume = macio_device_resume;
23264 - drv->driver.suspend = macio_device_suspend;
23265 drv->driver.remove = macio_device_remove;
23267 /* register with core */
23268 @@ -253,16 +304,14 @@
23269 * macio_unregister_driver - Unregisters a new MacIO device driver
23270 * @drv: pointer to the driver definition structure
23273 -macio_unregister_driver(struct macio_driver *drv)
23274 +void macio_unregister_driver(struct macio_driver *drv)
23276 driver_unregister(&drv->driver);
23281 -static int __devinit
23282 -macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
23283 +static int __devinit macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
23285 struct device_node* np;
23286 struct macio_chip* chip;
23287 @@ -270,19 +319,27 @@
23288 if (ent->vendor != PCI_VENDOR_ID_APPLE)
23291 + /* Note regarding refcounting: We assume pci_device_to_OF_node() is ported
23292 + * to new OF APIs and returns a node with refcount incremented. This isn't
23293 + * the case today, but on the other hand ppc32 doesn't do refcounting. This
23294 + * will have to be fixed when going to ppc64. --BenH.
23296 np = pci_device_to_OF_node(pdev);
23300 + /* We also assume that pmac_feature will have done a get() on nodes stored
23301 + * in the macio chips array
23303 chip = macio_find(np, macio_unknown);
23308 - /* XXX Need locking */
23309 + /* XXX Need locking ??? */
23310 if (chip->lbus.pdev == NULL) {
23311 chip->lbus.pdev = pdev;
23312 chip->lbus.chip = chip;
23313 -// INIT_LIST_HEAD(&chip->lbus.devices);
23314 pci_set_drvdata(pdev, &chip->lbus);
23315 pci_set_master(pdev);
23317 @@ -290,13 +347,28 @@
23318 printk(KERN_INFO "MacIO PCI driver attached to %s chipset\n",
23322 + * HACK ALERT: The WallStreet PowerBook and some OHare based machines
23323 + * have 2 macio ASICs. I must probe the "main" one first or IDE ordering
23324 + * will be incorrect. So I put on "hold" the second one since it seem to
23325 + * appear first on PCI
23327 + if (chip->type == macio_gatwick || chip->type == macio_ohareII)
23328 + if (macio_chips[0].lbus.pdev == NULL) {
23329 + macio_on_hold = chip;
23333 macio_pci_add_devices(chip);
23334 + if (macio_on_hold && macio_chips[0].lbus.pdev != NULL) {
23335 + macio_pci_add_devices(macio_on_hold);
23336 + macio_on_hold = NULL;
23342 -static void __devexit
23343 -macio_pci_remove(struct pci_dev* pdev)
23344 +static void __devexit macio_pci_remove(struct pci_dev* pdev)
23346 panic("removing of macio-asic not supported !\n");
23348 @@ -306,10 +378,10 @@
23349 * will then decide wether it applies or not
23351 static const struct pci_device_id __devinitdata pci_ids [] = { {
23352 - .vendor = PCI_VENDOR_ID_APPLE,
23353 - .device = PCI_ANY_ID,
23354 - .subvendor = PCI_ANY_ID,
23355 - .subdevice = PCI_ANY_ID,
23356 + .vendor = PCI_VENDOR_ID_APPLE,
23357 + .device = PCI_ANY_ID,
23358 + .subvendor = PCI_ANY_ID,
23359 + .subdevice = PCI_ANY_ID,
23361 }, { /* end: all zeroes */ }
23363 @@ -317,17 +389,16 @@
23365 /* pci driver glue; this is a "new style" PCI driver module */
23366 static struct pci_driver macio_pci_driver = {
23367 - .name = (char *) "macio",
23368 - .id_table = pci_ids,
23369 + .name = (char *) "macio",
23370 + .id_table = pci_ids,
23372 - .probe = macio_pci_probe,
23373 - .remove = macio_pci_remove,
23374 + .probe = macio_pci_probe,
23375 + .remove = macio_pci_remove,
23378 #endif /* CONFIG_PCI */
23381 -macio_module_init (void)
23382 +static int __init macio_module_init (void)
23386 @@ -339,17 +410,9 @@
23391 -static void __exit
23392 -macio_module_cleanup (void)
23395 - pci_unregister_driver(&macio_pci_driver);
23398 -module_exit(macio_module_cleanup);
23400 module_init(macio_module_init);
23402 EXPORT_SYMBOL(macio_register_driver);
23403 EXPORT_SYMBOL(macio_unregister_driver);
23404 +EXPORT_SYMBOL(macio_dev_get);
23405 +EXPORT_SYMBOL(macio_dev_put);
23406 diff -Nru a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
23407 --- a/drivers/macintosh/mediabay.c Sat Mar 22 01:11:14 2003
23408 +++ b/drivers/macintosh/mediabay.c Mon Aug 25 09:51:43 2003
23410 #include <linux/adb.h>
23411 #include <linux/pmu.h>
23413 -#ifdef CONFIG_PMAC_PBOOK
23414 -static int mb_notify_sleep(struct pmu_sleep_notifier *self, int when);
23415 -static struct pmu_sleep_notifier mb_sleep_notifier = {
23417 - SLEEP_LEVEL_MEDIABAY,
23421 -#undef MB_USE_INTERRUPTS
23423 #define MB_IGNORE_SIGNALS
23426 #define MBDBG(fmt, arg...) do { } while (0)
23429 -/* Type of media bay */
23436 #define MB_FCR32(bay, r) ((bay)->base + ((r) >> 2))
23437 #define MB_FCR8(bay, r) (((volatile u8*)((bay)->base)) + (r))
23439 @@ -76,11 +61,12 @@
23443 - u8 (*content)(struct media_bay_info* bay);
23444 - void (*power)(struct media_bay_info* bay, int on_off);
23445 - int (*setup_bus)(struct media_bay_info* bay, u8 device_id);
23446 - void (*un_reset)(struct media_bay_info* bay);
23447 - void (*un_reset_ide)(struct media_bay_info* bay);
23448 + void (*init)(struct media_bay_info *bay);
23449 + u8 (*content)(struct media_bay_info *bay);
23450 + void (*power)(struct media_bay_info *bay, int on_off);
23451 + int (*setup_bus)(struct media_bay_info *bay, u8 device_id);
23452 + void (*un_reset)(struct media_bay_info *bay);
23453 + void (*un_reset_ide)(struct media_bay_info *bay);
23456 struct media_bay_info {
23457 @@ -90,11 +76,12 @@
23461 - struct device_node* dev_node;
23463 + struct macio_dev *mdev;
23464 struct mb_ops* ops;
23468 + struct semaphore lock;
23469 #ifdef CONFIG_BLK_DEV_IDE
23470 unsigned long cd_base;
23472 @@ -111,13 +98,13 @@
23473 #ifdef CONFIG_BLK_DEV_IDE
23474 /* check the busy bit in the media-bay ide interface
23475 (assumes the media-bay contains an ide device) */
23476 -#define MB_IDE_READY(i) ((inb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
23477 +#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
23480 /* Note: All delays are not in milliseconds and converted to HZ relative
23481 * values by the macro below
23483 -#define MS_TO_HZ(ms) ((ms * HZ) / 1000)
23484 +#define MS_TO_HZ(ms) ((ms * HZ + 999) / 1000)
23487 * Consider the media-bay ID value stable if it is the same for
23488 @@ -352,38 +339,37 @@
23489 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
23492 -static void __pmac
23493 -heathrow_mb_un_reset(struct media_bay_info* bay)
23494 +static void __pmac keylargo_mb_init(struct media_bay_info *bay)
23496 + MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
23499 +static void __pmac heathrow_mb_un_reset(struct media_bay_info* bay)
23501 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
23504 -static void __pmac
23505 -keylargo_mb_un_reset(struct media_bay_info* bay)
23506 +static void __pmac keylargo_mb_un_reset(struct media_bay_info* bay)
23508 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
23511 -static void __pmac
23512 -ohare_mb_un_reset_ide(struct media_bay_info* bay)
23513 +static void __pmac ohare_mb_un_reset_ide(struct media_bay_info* bay)
23515 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
23518 -static void __pmac
23519 -heathrow_mb_un_reset_ide(struct media_bay_info* bay)
23520 +static void __pmac heathrow_mb_un_reset_ide(struct media_bay_info* bay)
23522 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
23525 -static void __pmac
23526 -keylargo_mb_un_reset_ide(struct media_bay_info* bay)
23527 +static void __pmac keylargo_mb_un_reset_ide(struct media_bay_info* bay)
23529 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
23532 -static inline void __pmac
23533 -set_mb_power(struct media_bay_info* bay, int onoff)
23534 +static inline void __pmac set_mb_power(struct media_bay_info* bay, int onoff)
23536 /* Power up up and assert the bay reset line */
23538 @@ -399,8 +385,7 @@
23539 bay->timer = MS_TO_HZ(MB_POWER_DELAY);
23542 -static void __pmac
23543 -poll_media_bay(struct media_bay_info* bay)
23544 +static void __pmac poll_media_bay(struct media_bay_info* bay)
23546 int id = bay->ops->content(bay);
23548 @@ -429,15 +414,13 @@
23553 -check_media_bay(struct device_node *which_bay, int what)
23554 +int __pmac check_media_bay(struct device_node *which_bay, int what)
23556 #ifdef CONFIG_BLK_DEV_IDE
23559 for (i=0; i<media_bay_count; i++)
23560 - if (which_bay == media_bays[i].dev_node)
23562 + if (media_bays[i].mdev && which_bay == media_bays[i].mdev->ofdev.node) {
23563 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
23565 media_bays[i].cd_index = -1;
23566 @@ -447,15 +430,13 @@
23571 -check_media_bay_by_base(unsigned long base, int what)
23572 +int __pmac check_media_bay_by_base(unsigned long base, int what)
23574 #ifdef CONFIG_BLK_DEV_IDE
23577 for (i=0; i<media_bay_count; i++)
23578 - if (base == media_bays[i].cd_base)
23580 + if (media_bays[i].mdev && base == media_bays[i].cd_base) {
23581 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
23583 media_bays[i].cd_index = -1;
23584 @@ -466,42 +447,47 @@
23589 -media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
23590 +int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
23591 int irq, int index)
23593 #ifdef CONFIG_BLK_DEV_IDE
23596 - for (i=0; i<media_bay_count; i++)
23597 - if (which_bay == media_bays[i].dev_node)
23599 + for (i=0; i<media_bay_count; i++) {
23600 + struct media_bay_info* bay = &media_bays[i];
23602 + if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
23603 int timeout = 5000;
23605 - media_bays[i].cd_base = base;
23606 - media_bays[i].cd_irq = irq;
23607 + down(&bay->lock);
23609 - if ((MB_CD != media_bays[i].content_id) || media_bays[i].state != mb_up)
23611 + bay->cd_base = base;
23612 + bay->cd_irq = irq;
23614 - printk(KERN_DEBUG "Registered ide %d for media bay %d\n", index, i);
23615 + if ((MB_CD != bay->content_id) || bay->state != mb_up) {
23619 + printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
23621 if (MB_IDE_READY(i)) {
23622 - media_bays[i].cd_index = index;
23623 + bay->cd_index = index;
23628 } while(--timeout);
23629 printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
23635 +#endif /* CONFIG_BLK_DEV_IDE */
23640 -static void __pmac
23641 -media_bay_step(int i)
23642 +static void __pmac media_bay_step(int i)
23644 struct media_bay_info* bay = &media_bays[i];
23646 @@ -567,6 +553,7 @@
23647 if (bay->cd_index < 0) {
23650 + printk("mediabay %d, registering IDE...\n", i);
23652 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
23653 hw.irq = bay->cd_irq;
23654 @@ -580,13 +567,15 @@
23655 printk("IDE register error\n");
23656 set_mb_power(bay, 0);
23658 - printk(KERN_DEBUG "media-bay %d is ide %d\n", i, bay->cd_index);
23659 + printk(KERN_DEBUG "media-bay %d is ide%d\n", i, bay->cd_index);
23660 MBDBG("mediabay %d IDE ready\n", i);
23664 + } else if (bay->timer > 0)
23666 if (bay->timer == 0) {
23667 - printk("\nIDE Timeout in bay %d !\n", i);
23668 + printk("\nIDE Timeout in bay %d !, IDE state is: 0x%02x\n",
23669 + i, readb(bay->cd_base + 0x70));
23670 MBDBG("mediabay%d: nIDE Timeout !\n", i);
23671 set_mb_power(bay, 0);
23673 @@ -623,8 +612,7 @@
23674 * with the IDE driver. It needs to be a thread because
23675 * ide_register can't be called from interrupt context.
23678 -media_bay_task(void *x)
23679 +static int __pmac media_bay_task(void *x)
23683 @@ -634,75 +622,140 @@
23687 - for (i = 0; i < media_bay_count; ++i)
23688 - media_bay_step(i);
23689 + for (i = 0; i < media_bay_count; ++i) {
23690 + down(&media_bays[i].lock);
23691 + if (!media_bays[i].sleeping)
23692 + media_bay_step(i);
23693 + up(&media_bays[i].lock);
23696 current->state = TASK_INTERRUPTIBLE;
23697 - schedule_timeout(1);
23698 + schedule_timeout(MS_TO_HZ(10));
23699 if (signal_pending(current))
23704 -#ifdef MB_USE_INTERRUPTS
23705 -static void __pmac
23706 -media_bay_intr(int irq, void *devid, struct pt_regs *regs)
23711 -#ifdef CONFIG_PMAC_PBOOK
23713 - * notify clients before sleep and reset bus afterwards
23716 -mb_notify_sleep(struct pmu_sleep_notifier *self, int when)
23717 +static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_match *match)
23719 struct media_bay_info* bay;
23720 + volatile u32 *regbase;
23721 + struct device_node *ofnode;
23724 + ofnode = mdev->ofdev.node;
23726 + if (!request_OF_resource(ofnode, 0, NULL))
23729 + /* Media bay registers are located at the beginning of the
23730 + * mac-io chip, we get the parent address for now (hrm...)
23732 + if (ofnode->parent->n_addrs == 0)
23734 + regbase = (volatile u32 *)ioremap(ofnode->parent->addrs[0].address, 0x100);
23735 + if (regbase == NULL) {
23736 + release_OF_resource(ofnode, 0);
23741 - case PBOOK_SLEEP_REQUEST:
23742 - case PBOOK_SLEEP_REJECT:
23745 - case PBOOK_SLEEP_NOW:
23746 - for (i=0; i<media_bay_count; i++) {
23747 - bay = &media_bays[i];
23748 - set_mb_power(bay, 0);
23753 - for (i=0; i<media_bay_count; i++) {
23754 - bay = &media_bays[i];
23755 - /* We re-enable the bay using it's previous content
23756 - only if it did not change. Note those bozo timings,
23757 - they seem to help the 3400 get it right.
23759 - /* Force MB power to 0 */
23760 - set_mb_power(bay, 0);
23761 - mdelay(MB_POWER_DELAY);
23762 - if (bay->ops->content(bay) != bay->content_id)
23764 - set_mb_power(bay, 1);
23765 - bay->last_value = bay->content_id;
23766 - bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
23767 - bay->timer = MS_TO_HZ(MB_POWER_DELAY);
23768 -#ifdef CONFIG_BLK_DEV_IDE
23769 - bay->cd_retry = 0;
23773 - media_bay_step(i);
23774 - } while((media_bays[i].state != mb_empty) &&
23775 - (media_bays[i].state != mb_up));
23778 + i = media_bay_count++;
23779 + bay = &media_bays[i];
23780 + bay->mdev = mdev;
23781 + bay->base = regbase;
23783 + bay->ops = match->data;
23784 + bay->sleeping = 0;
23785 + init_MUTEX(&bay->lock);
23787 + /* Init HW probing */
23788 + if (bay->ops->init)
23789 + bay->ops->init(bay);
23791 + printk(KERN_INFO "mediabay%d: Registered %s media-bay\n", i, bay->ops->name);
23793 + /* Force an immediate detect */
23794 + set_mb_power(bay, 0);
23795 + set_current_state(TASK_UNINTERRUPTIBLE);
23796 + schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
23797 + bay->content_id = MB_NO;
23798 + bay->last_value = bay->ops->content(bay);
23799 + bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
23800 + bay->state = mb_empty;
23802 + set_current_state(TASK_UNINTERRUPTIBLE);
23803 + schedule_timeout(MS_TO_HZ(10));
23804 + media_bay_step(i);
23805 + } while((bay->state != mb_empty) &&
23806 + (bay->state != mb_up));
23808 + /* Mark us ready by filling our mdev data */
23809 + dev_set_drvdata(&mdev->ofdev.dev, bay);
23811 + /* Startup kernel thread */
23813 + kernel_thread(media_bay_task, NULL,
23814 + CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
23820 +static int __pmac media_bay_suspend(struct macio_dev *mdev, u32 state)
23822 + struct media_bay_info *bay = dev_get_drvdata(&mdev->ofdev.dev);
23824 + if (state != mdev->ofdev.dev.power_state && state >= 2) {
23825 + down(&bay->lock);
23826 + bay->sleeping = 1;
23827 + set_mb_power(bay, 0);
23829 + set_current_state(TASK_UNINTERRUPTIBLE);
23830 + schedule_timeout(MS_TO_HZ(10));
23831 + mdev->ofdev.dev.power_state = state;
23833 - return PBOOK_SLEEP_OK;
23837 +static int __pmac media_bay_resume(struct macio_dev *mdev)
23839 + struct media_bay_info *bay = dev_get_drvdata(&mdev->ofdev.dev);
23841 + if (mdev->ofdev.dev.power_state != 0) {
23842 + mdev->ofdev.dev.power_state = 0;
23844 + /* We re-enable the bay using it's previous content
23845 + only if it did not change. Note those bozo timings,
23846 + they seem to help the 3400 get it right.
23848 + /* Force MB power to 0 */
23849 + down(&bay->lock);
23850 + set_mb_power(bay, 0);
23851 + set_current_state(TASK_UNINTERRUPTIBLE);
23852 + schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
23853 + if (bay->ops->content(bay) != bay->content_id) {
23854 + printk("mediabay%d: content changed during sleep...\n", bay->index);
23858 + set_mb_power(bay, 1);
23859 + bay->last_value = bay->content_id;
23860 + bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
23861 + bay->timer = MS_TO_HZ(MB_POWER_DELAY);
23862 +#ifdef CONFIG_BLK_DEV_IDE
23863 + bay->cd_retry = 0;
23866 + set_current_state(TASK_UNINTERRUPTIBLE);
23867 + schedule_timeout(MS_TO_HZ(10));
23868 + media_bay_step(bay->index);
23869 + } while((bay->state != mb_empty) &&
23870 + (bay->state != mb_up));
23871 + bay->sleeping = 0;
23876 -#endif /* CONFIG_PMAC_PBOOK */
23879 /* Definitions of "ops" structures.
23880 @@ -727,6 +780,7 @@
23882 static struct mb_ops keylargo_mb_ops __pmacdata = {
23883 .name = "KeyLargo",
23884 + .init = keylargo_mb_init,
23885 .content = keylargo_mb_content,
23886 .power = keylargo_mb_power,
23887 .setup_bus = keylargo_mb_setup_bus,
23888 @@ -743,12 +797,42 @@
23889 * Therefore we do it all by polling the media bay once each tick.
23893 -media_bay_init(void)
23894 +static struct of_match media_bay_match[] =
23896 - struct device_node *np;
23900 + .name = "media-bay",
23901 + .type = OF_ANY_MATCH,
23902 + .compatible = "keylargo-media-bay",
23903 + .data = &keylargo_mb_ops,
23906 + .name = "media-bay",
23907 + .type = OF_ANY_MATCH,
23908 + .compatible = "heathrow-media-bay",
23909 + .data = &heathrow_mb_ops,
23912 + .name = "media-bay",
23913 + .type = OF_ANY_MATCH,
23914 + .compatible = "ohare-media-bay",
23915 + .data = &ohare_mb_ops,
23920 +static struct macio_driver media_bay_driver =
23922 + .name = "media-bay",
23923 + .match_table = media_bay_match,
23924 + .probe = media_bay_attach,
23925 + .suspend = media_bay_suspend,
23926 + .resume = media_bay_resume
23929 +static int __init media_bay_init(void)
23933 for (i=0; i<MAX_BAYS; i++) {
23934 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info));
23935 media_bays[i].content_id = -1;
23936 @@ -756,84 +840,12 @@
23937 media_bays[i].cd_index = -1;
23941 - np = find_devices("media-bay");
23943 - while(np && (n<MAX_BAYS)) {
23944 - struct media_bay_info* bay = &media_bays[n];
23945 - if (!np->parent || np->n_addrs == 0 || !request_OF_resource(np, 0, NULL)) {
23947 - printk(KERN_ERR "media-bay: Can't request IO resource !\n");
23950 - bay->mb_type = mb_ohare;
23952 - if (device_is_compatible(np, "keylargo-media-bay")) {
23953 - bay->mb_type = mb_keylargo;
23954 - bay->ops = &keylargo_mb_ops;
23955 - } else if (device_is_compatible(np, "heathrow-media-bay")) {
23956 - bay->mb_type = mb_heathrow;
23957 - bay->ops = &heathrow_mb_ops;
23958 - } else if (device_is_compatible(np, "ohare-media-bay")) {
23959 - bay->mb_type = mb_ohare;
23960 - bay->ops = &ohare_mb_ops;
23962 - printk(KERN_ERR "mediabay: Unknown bay type !\n");
23966 - bay->base = (volatile u32*)ioremap(np->parent->addrs[0].address, 0x1000);
23968 - /* Enable probe logic on keylargo */
23969 - if (bay->mb_type == mb_keylargo)
23970 - MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
23971 -#ifdef MB_USE_INTERRUPTS
23972 - if (np->n_intrs == 0) {
23973 - printk(KERN_ERR "media bay %d has no irq\n",n);
23978 - if (request_irq(np->intrs[0].line, media_bay_intr, 0, "Media bay", (void *)n)) {
23979 - printk(KERN_ERR "Couldn't get IRQ %d for media bay %d\n",
23980 - np->intrs[0].line, n);
23985 - media_bay_count++;
23987 - printk(KERN_INFO "mediabay%d: Registered %s media-bay\n", n, bay->ops->name);
23988 - bay->dev_node = np;
23991 - /* Force an immediate detect */
23992 - set_mb_power(bay, 0);
23993 - mdelay(MB_POWER_DELAY);
23994 - bay->content_id = MB_NO;
23995 - bay->last_value = bay->ops->content(bay);
23996 - bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
23997 - bay->state = mb_empty;
24000 - media_bay_step(n);
24001 - } while((bay->state != mb_empty) &&
24002 - (bay->state != mb_up));
24007 + if (_machine != _MACH_Pmac)
24010 - if (media_bay_count)
24012 -#ifdef CONFIG_PMAC_PBOOK
24013 - pmu_register_sleep_notifier(&mb_sleep_notifier);
24014 -#endif /* CONFIG_PMAC_PBOOK */
24015 + macio_register_driver(&media_bay_driver);
24017 - kernel_thread(media_bay_task, NULL,
24018 - CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
24023 -subsys_initcall(media_bay_init);
24024 +device_initcall(media_bay_init);
24025 diff -Nru a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
24026 --- a/drivers/macintosh/via-pmu.c Sat Jun 7 00:46:48 2003
24027 +++ b/drivers/macintosh/via-pmu.c Mon Aug 25 10:06:34 2003
24029 * Copyright (C) 1998 Paul Mackerras and Fabio Riccardi.
24030 * Copyright (C) 2001-2002 Benjamin Herrenschmidt
24032 + * THIS DRIVER IS BECOMING A TOTAL MESS !
24033 + * - Cleanup atomically disabling reply to PMU events after
24034 + * a sleep or a freq. switch
24035 + * - Move sleep code out of here to pmac_pm, merge into new
24036 + * common PM infrastructure
24037 + * - Move backlight code out as well
24038 + * - Save/Restore PCI space properly
24041 #include <stdarg.h>
24042 #include <linux/config.h>
24044 #include <linux/proc_fs.h>
24045 #include <linux/init.h>
24046 #include <linux/interrupt.h>
24047 +#include <linux/device.h>
24048 +#include <linux/suspend.h>
24049 #include <asm/prom.h>
24050 #include <asm/machdep.h>
24051 #include <asm/io.h>
24053 #include <asm/mmu_context.h>
24054 #include <asm/cputable.h>
24055 #include <asm/time.h>
24056 +#include <asm/xmon.h>
24057 #ifdef CONFIG_PMAC_BACKLIGHT
24058 #include <asm/backlight.h>
24061 #undef SUSPEND_USES_PMU
24062 #define DEBUG_SLEEP
24063 #undef HACKED_PCI_SAVE
24064 -#define NEW_OHARE_CODE
24066 /* Misc minor number allocated for /dev/pmu */
24067 #define PMU_MINOR 154
24069 /* How many iterations between battery polls */
24070 #define BATTERY_POLLING_COUNT 2
24072 +/* Some debugging tools */
24073 +#ifdef CONFIG_XMON
24074 +//#define LIVE_DEBUG(req) ((req) && (req)->data[0] == 0x7d)
24075 +#define LIVE_DEBUG(req) (0)
24076 +static int whacky_debug;
24077 +#endif /* CONFIG_XMON */
24079 static volatile unsigned char *via;
24081 /* VIA registers - spaced 0x200 bytes apart */
24082 @@ -106,6 +123,7 @@
24089 static volatile enum int_data_state {
24090 @@ -133,6 +151,7 @@
24091 static int pmu_has_adb;
24092 static unsigned char *gpio_reg = NULL;
24093 static int gpio_irq = -1;
24094 +static int gpio_irq_enabled = -1;
24095 static volatile int pmu_suspended = 0;
24096 static spinlock_t pmu_lock;
24097 static u8 pmu_intr_mask;
24098 @@ -143,9 +162,11 @@
24099 static int sleep_in_progress;
24100 static int can_sleep;
24101 #endif /* CONFIG_PMAC_PBOOK */
24102 +static unsigned int pmu_irq_stats[11];
24104 static struct proc_dir_entry *proc_pmu_root;
24105 static struct proc_dir_entry *proc_pmu_info;
24106 +static struct proc_dir_entry *proc_pmu_irqstats;
24107 static struct proc_dir_entry *proc_pmu_options;
24109 #ifdef CONFIG_PMAC_PBOOK
24110 @@ -184,6 +205,8 @@
24111 static irqreturn_t gpio1_interrupt(int irq, void *arg, struct pt_regs *regs);
24112 static int proc_get_info(char *page, char **start, off_t off,
24113 int count, int *eof, void *data);
24114 +static int proc_get_irqstats(char *page, char **start, off_t off,
24115 + int count, int *eof, void *data);
24116 #ifdef CONFIG_PMAC_BACKLIGHT
24117 static int pmu_set_backlight_level(int level, void* data);
24118 static int pmu_set_backlight_enable(int on, int level, void* data);
24119 @@ -205,16 +228,12 @@
24127 #endif /* CONFIG_ADB */
24129 extern void low_sleep_handler(void);
24130 -extern void pmac_sleep_save_intrs(int);
24131 -extern void pmac_sleep_restore_intrs(void);
24132 -extern void openpic_sleep_save_intrs(void);
24133 -extern void openpic_sleep_restore_intrs(void);
24134 extern void enable_kernel_altivec(void);
24135 extern void enable_kernel_fp(void);
24137 @@ -223,14 +242,6 @@
24138 int pmu_wink(struct adb_request *req);
24141 -#if defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM)
24142 -static int generic_notify_sleep(struct pmu_sleep_notifier *self, int when);
24143 -static struct pmu_sleep_notifier generic_sleep_notifier = {
24144 - generic_notify_sleep,
24145 - SLEEP_LEVEL_MISC,
24147 -#endif /* defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM) */
24150 * This table indicates for each PMU opcode:
24151 * - the number of data bytes to be sent with the command, or -1
24152 @@ -361,11 +372,6 @@
24154 sys_ctrler = SYS_CTRLER_PMU;
24156 -#if defined(CONFIG_PMAC_PBOOK) && defined(CONFIG_PM)
24157 - pmu_register_sleep_notifier(&generic_sleep_notifier);
24164 @@ -416,6 +422,7 @@
24165 if (pmu_kind == PMU_KEYLARGO_BASED && gpio_irq != -1) {
24166 if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1/ADB", (void *)0))
24167 printk(KERN_ERR "pmu: can't get irq %d (GPIO1)\n", gpio_irq);
24168 + gpio_irq_enabled = 1;
24171 /* Enable interrupts */
24172 @@ -489,6 +496,8 @@
24174 proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root,
24175 proc_get_info, NULL);
24176 + proc_pmu_irqstats = create_proc_read_entry("interrupts", 0, proc_pmu_root,
24177 + proc_get_irqstats, NULL);
24178 #ifdef CONFIG_PMAC_PBOOK
24179 for (i=0; i<pmu_battery_count; i++) {
24181 @@ -552,15 +561,14 @@
24183 /* Read PMU version */
24184 pmu_request(&req, NULL, 1, PMU_GET_VERSION);
24185 - while (!req.complete)
24187 + pmu_wait_complete(&req);
24188 if (req.reply_len > 0)
24189 pmu_version = req.reply[0];
24196 pmu_get_model(void)
24199 @@ -774,6 +782,33 @@
24204 +proc_get_irqstats(char *page, char **start, off_t off,
24205 + int count, int *eof, void *data)
24209 + static const char *irq_names[] = {
24210 + "Total CB1 triggered events",
24211 + "Total GPIO1 triggered events",
24212 + "PC-Card eject button",
24213 + "Sound/Brightness button",
24215 + "Battery state change",
24216 + "Environment interrupt",
24218 + "Ghost interrupt (zero len)",
24219 + "Empty interrupt (empty mask)",
24220 + "Max irqs in a row"
24223 + for (i=0; i<11; i++) {
24224 + p += sprintf(p, " %2u: %10u (%s)\n",
24225 + i, pmu_irq_stats[i], irq_names[i]);
24230 #ifdef CONFIG_PMAC_PBOOK
24232 proc_get_batt(char *page, char **start, off_t off,
24233 @@ -982,8 +1017,7 @@
24234 printk(KERN_ERR "pmu_adb_reset_bus: pmu_queue_request failed\n");
24237 - while (!req.complete)
24239 + pmu_wait_complete(&req);
24241 if (save_autopoll != 0)
24242 pmu_adb_autopoll(save_autopoll);
24243 @@ -1133,6 +1167,12 @@
24245 /* set the shift register to shift out and send a byte */
24246 send_byte(req->data[0]);
24247 +#ifdef CONFIG_XMON
24248 + if (LIVE_DEBUG(req))
24249 + xmon_printf("R");
24251 + whacky_debug = 0;
24252 +#endif /* CONFIG_XMON */
24255 void __openfirmware
24256 @@ -1142,15 +1182,33 @@
24260 + via_pmu_interrupt(0, 0, 0);
24263 +void __openfirmware
24264 +pmu_poll_adb(void)
24268 + if (disable_poll)
24270 /* Kicks ADB read when PMU is suspended */
24271 - if (pmu_suspended)
24272 - adb_int_pending = 1;
24273 + adb_int_pending = 1;
24275 via_pmu_interrupt(0, 0, 0);
24276 } while (pmu_suspended && (adb_int_pending || pmu_state != idle
24277 || req_awaiting_reply));
24280 +void __openfirmware
24281 +pmu_wait_complete(struct adb_request *req)
24285 + while((pmu_state != idle && pmu_state != locked) || !req->complete)
24286 + via_pmu_interrupt(0, 0, 0);
24289 /* This function loops until the PMU is idle and prevents it from
24290 * anwsering to ADB interrupts. pmu_request can still be called.
24291 * This is done to avoid spurrious shutdowns when we know we'll have
24292 @@ -1175,6 +1233,8 @@
24295 spin_unlock_irqrestore(&pmu_lock, flags);
24296 + if (req_awaiting_reply)
24297 + adb_int_pending = 1;
24298 via_pmu_interrupt(0, 0, 0);
24299 spin_lock_irqsave(&pmu_lock, flags);
24300 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
24301 @@ -1185,7 +1245,7 @@
24303 #else /* SUSPEND_USES_PMU */
24305 - disable_irq(gpio_irq);
24306 + disable_irq_nosync(gpio_irq);
24307 out_8(&via[IER], CB1_INT | IER_CLR);
24308 spin_unlock_irqrestore(&pmu_lock, flags);
24309 #endif /* SUSPEND_USES_PMU */
24310 @@ -1227,16 +1287,47 @@
24312 pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs)
24314 + unsigned char ints, pirq;
24318 if (drop_interrupts || len < 1) {
24319 adb_int_pending = 0;
24320 + pmu_irq_stats[8]++;
24324 + /* Get PMU interrupt mask */
24327 + /* Record zero interrupts for stats */
24329 + pmu_irq_stats[9]++;
24331 + /* Hack to deal with ADB autopoll flag */
24332 + if (ints & PMU_INT_ADB)
24333 + ints &= ~(PMU_INT_ADB_AUTO | PMU_INT_AUTO_SRQ_POLL);
24338 + if (i > pmu_irq_stats[10])
24339 + pmu_irq_stats[10] = i;
24343 + for (pirq = 0; pirq < 8; pirq++)
24344 + if (ints & (1 << pirq))
24346 + pmu_irq_stats[pirq]++;
24348 + ints &= ~(1 << pirq);
24350 /* Note: for some reason, we get an interrupt with len=1,
24351 * data[0]==0 after each normal ADB interrupt, at least
24352 * on the Pismo. Still investigating... --BenH
24354 - if (data[0] & PMU_INT_ADB) {
24355 + if ((1 << pirq) & PMU_INT_ADB) {
24356 if ((data[0] & PMU_INT_ADB_AUTO) == 0) {
24357 struct adb_request *req = req_awaiting_reply;
24359 @@ -1274,29 +1365,37 @@
24360 adb_input(data+1, len-1, regs, 1);
24361 #endif /* CONFIG_ADB */
24364 - /* Sound/brightness button pressed */
24365 - if ((data[0] & PMU_INT_SNDBRT) && len == 3) {
24367 + /* Sound/brightness button pressed */
24368 + else if ((1 << pirq) & PMU_INT_SNDBRT) {
24369 #ifdef CONFIG_PMAC_BACKLIGHT
24371 #ifdef CONFIG_INPUT_ADBHID
24372 if (!disable_kernel_backlight)
24373 #endif /* CONFIG_INPUT_ADBHID */
24374 set_backlight_level(data[1] >> 4);
24375 #endif /* CONFIG_PMAC_BACKLIGHT */
24378 + /* Tick interrupt */
24379 + else if ((1 << pirq) & PMU_INT_TICK) {
24380 #ifdef CONFIG_PMAC_PBOOK
24381 /* Environement or tick interrupt, query batteries */
24382 - if (pmu_battery_count && (data[0] & PMU_INT_TICK)) {
24383 + if (pmu_battery_count) {
24384 if ((--query_batt_timer) == 0) {
24385 query_battery_state();
24386 query_batt_timer = BATTERY_POLLING_COUNT;
24388 - } else if (pmu_battery_count && (data[0] & PMU_INT_ENVIRONMENT))
24391 + else if ((1 << pirq) & PMU_INT_ENVIRONMENT) {
24392 + if (pmu_battery_count)
24393 query_battery_state();
24395 - pmu_pass_intr(data, len);
24396 + pmu_pass_intr(data, len);
24398 + pmu_pass_intr(data, len);
24400 #endif /* CONFIG_PMAC_PBOOK */
24405 static struct adb_request* __pmac
24406 @@ -1326,17 +1425,29 @@
24409 if (data_len < 0) {
24410 +#ifdef CONFIG_XMON
24411 + if (LIVE_DEBUG(req))
24412 + xmon_printf("s");
24413 +#endif /* CONFIG_XMON */
24414 data_len = req->nbytes - 1;
24415 send_byte(data_len);
24418 if (data_index <= data_len) {
24419 +#ifdef CONFIG_XMON
24420 + if (LIVE_DEBUG(req))
24421 + xmon_printf("S");
24422 +#endif /* CONFIG_XMON */
24423 send_byte(req->data[data_index++]);
24427 data_len = pmu_data_len[req->data[0]][1];
24428 if (data_len == 0) {
24429 +#ifdef CONFIG_XMON
24430 + if (LIVE_DEBUG(req))
24431 + xmon_printf("D");
24432 +#endif /* CONFIG_XMON */
24434 current_req = req->next;
24435 if (req->reply_expected)
24436 @@ -1344,6 +1455,10 @@
24440 +#ifdef CONFIG_XMON
24441 + if (LIVE_DEBUG(req))
24442 + xmon_printf("-");
24443 +#endif /* CONFIG_XMON */
24444 pmu_state = reading;
24446 reply_ptr = req->reply + req->reply_len;
24447 @@ -1357,15 +1472,27 @@
24448 pmu_state = reading_intr;
24449 reply_ptr = interrupt_data[int_data_last];
24451 + if (gpio_irq >= 0 && !gpio_irq_enabled) {
24452 + enable_irq(gpio_irq);
24453 + gpio_irq_enabled = 1;
24459 if (data_len == -1) {
24460 +#ifdef CONFIG_XMON
24461 + if (LIVE_DEBUG(current_req))
24462 + xmon_printf("r");
24463 +#endif /* CONFIG_XMON */
24466 printk(KERN_ERR "PMU: bad reply len %d\n", bite);
24467 } else if (data_index < 32) {
24468 +#ifdef CONFIG_XMON
24469 + if (LIVE_DEBUG(current_req))
24470 + xmon_printf("R");
24471 +#endif /* CONFIG_XMON */
24472 reply_ptr[data_index++] = bite;
24474 if (data_index < data_len) {
24475 @@ -1373,15 +1500,29 @@
24479 +#ifdef CONFIG_XMON
24480 + if (LIVE_DEBUG(current_req)) {
24481 + whacky_debug = 1;
24482 + xmon_printf("D");
24484 +#endif /* CONFIG_XMON */
24485 if (pmu_state == reading_intr) {
24487 int_data_state[int_data_last] = int_data_ready;
24488 interrupt_data_len[int_data_last] = data_len;
24492 + * For PMU sleep and freq change requests, we lock the
24493 + * PMU until it's explicitely unlocked. This avoids any
24494 + * spurrious event polling getting in
24496 current_req = req->next;
24497 req->reply_len += data_index;
24498 - pmu_state = idle;
24499 + if (req->data[0] == PMU_SLEEP || req->data[0] == PMU_CPU_SPEED)
24500 + pmu_state = locked;
24502 + pmu_state = idle;
24506 @@ -1411,6 +1552,10 @@
24507 intr = in_8(&via[IFR]) & (SR_INT | CB1_INT);
24510 +#ifdef CONFIG_XMON
24511 + if (whacky_debug)
24512 + xmon_printf("|%02x|", intr);
24513 +#endif /* CONFIG_XMON */
24515 if (++nloop > 1000) {
24516 printk(KERN_DEBUG "PMU: stuck in intr loop, "
24517 @@ -1419,8 +1564,10 @@
24520 out_8(&via[IFR], intr);
24521 - if (intr & CB1_INT)
24522 + if (intr & CB1_INT) {
24523 adb_int_pending = 1;
24524 + pmu_irq_stats[0]++;
24526 if (intr & SR_INT) {
24527 req = pmu_sr_intr(regs);
24529 @@ -1431,6 +1578,10 @@
24531 if (pmu_state == idle) {
24532 if (adb_int_pending) {
24533 +#ifdef CONFIG_XMON
24534 + if (whacky_debug)
24535 + xmon_printf("!A!");
24536 +#endif /* CONFIG_XMON */
24537 if (int_data_state[0] == int_data_empty)
24539 else if (int_data_state[1] == int_data_empty)
24540 @@ -1479,11 +1630,33 @@
24541 return IRQ_RETVAL(handled);
24547 + unsigned long flags;
24549 + spin_lock_irqsave(&pmu_lock, flags);
24550 + if (pmu_state == locked)
24551 + pmu_state = idle;
24552 + adb_int_pending = 1;
24553 + spin_unlock_irqrestore(&pmu_lock, flags);
24557 static irqreturn_t __pmac
24558 gpio1_interrupt(int irq, void *arg, struct pt_regs *regs)
24560 + unsigned long flags;
24562 if ((in_8(gpio_reg + 0x9) & 0x02) == 0) {
24563 + spin_lock_irqsave(&pmu_lock, flags);
24564 + if (gpio_irq_enabled > 0) {
24565 + disable_irq_nosync(gpio_irq);
24566 + gpio_irq_enabled = 0;
24568 + pmu_irq_stats[1]++;
24569 adb_int_pending = 1;
24570 + spin_unlock_irqrestore(&pmu_lock, flags);
24571 via_pmu_interrupt(0, 0, 0);
24572 return IRQ_HANDLED;
24574 @@ -1507,13 +1680,11 @@
24576 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT,
24577 backlight_to_bright[level]);
24578 - while (!req.complete)
24580 + pmu_wait_complete(&req);
24582 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
24583 PMU_POW_BACKLIGHT | (on ? PMU_POW_ON : PMU_POW_OFF));
24584 - while (!req.complete)
24586 + pmu_wait_complete(&req);
24590 @@ -1549,8 +1720,7 @@
24592 pmu_request(&req, NULL, 2, PMU_POWER_CTRL, PMU_POW_IRLED |
24593 (on ? PMU_POW_ON : PMU_POW_OFF));
24594 - while (!req.complete)
24596 + pmu_wait_complete(&req);
24600 @@ -1570,8 +1740,7 @@
24603 pmu_request(&req, NULL, 1, PMU_RESET);
24604 - while(!req.complete || (pmu_state != idle))
24606 + pmu_wait_complete(&req);
24610 @@ -1588,14 +1757,12 @@
24611 if (pmu_kind != PMU_KEYLARGO_BASED) {
24612 pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, PMU_INT_ADB |
24614 - while(!req.complete)
24616 + pmu_wait_complete(&req);
24619 pmu_request(&req, NULL, 5, PMU_SHUTDOWN,
24620 'M', 'A', 'T', 'T');
24621 - while(!req.complete || (pmu_state != idle))
24623 + pmu_wait_complete(&req);
24627 @@ -1606,25 +1773,261 @@
24631 -#ifdef CONFIG_PMAC_PBOOK
24632 +struct pmu_i2c_hdr {
24642 -static LIST_HEAD(sleep_notifiers);
24644 +pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len)
24646 + struct adb_request req;
24647 + struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
24651 + for (retry=0; retry<16; retry++) {
24652 + memset(&req, 0, sizeof(req));
24655 + hdr->address = addr & 0xfe;
24656 + hdr->mode = PMU_I2C_MODE_COMBINED;
24658 + hdr->sub_addr = subaddr;
24659 + hdr->comb_addr = addr | 1;
24660 + hdr->count = len;
24662 + req.nbytes = sizeof(struct pmu_i2c_hdr) + 1;
24663 + req.reply_expected = 0;
24664 + req.reply_len = 0;
24665 + req.data[0] = PMU_I2C_CMD;
24666 + req.reply[0] = 0xff;
24667 + rc = pmu_queue_request(&req);
24670 + while(!req.complete)
24672 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24676 + if (req.reply[0] != PMU_I2C_STATUS_OK)
24681 -generic_notify_sleep(struct pmu_sleep_notifier *self, int when)
24682 + for (retry=0; retry<16; retry++) {
24683 + memset(&req, 0, sizeof(req));
24687 + hdr->bus = PMU_I2C_BUS_STATUS;
24688 + req.reply[0] = 0xff;
24691 + req.reply_expected = 0;
24692 + req.reply_len = 0;
24693 + req.data[0] = PMU_I2C_CMD;
24694 + rc = pmu_queue_request(&req);
24697 + while(!req.complete)
24699 + if (req.reply[0] == PMU_I2C_STATUS_DATAREAD) {
24700 + memcpy(data, &req.reply[1], req.reply_len - 1);
24701 + return req.reply_len - 1;
24708 +pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len)
24711 - case PBOOK_SLEEP_NOW:
24712 - if (pm_send_all(PM_SUSPEND, (void *)3))
24713 - return PBOOK_SLEEP_REJECT;
24714 + struct adb_request req;
24715 + struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
24719 + for (retry=0; retry<16; retry++) {
24720 + memset(&req, 0, sizeof(req));
24723 + hdr->address = addr & 0xfe;
24724 + hdr->mode = PMU_I2C_MODE_STDSUB;
24726 + hdr->sub_addr = subaddr;
24727 + hdr->comb_addr = addr & 0xfe;
24728 + hdr->count = len;
24730 + req.data[0] = PMU_I2C_CMD;
24731 + memcpy(&req.data[sizeof(struct pmu_i2c_hdr) + 1], data, len);
24732 + req.nbytes = sizeof(struct pmu_i2c_hdr) + len + 1;
24733 + req.reply_expected = 0;
24734 + req.reply_len = 0;
24735 + req.reply[0] = 0xff;
24736 + rc = pmu_queue_request(&req);
24739 + while(!req.complete)
24741 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24744 - (void) pm_send_all(PM_RESUME, (void *)0);
24747 - return PBOOK_SLEEP_OK;
24748 + if (req.reply[0] != PMU_I2C_STATUS_OK)
24751 + for (retry=0; retry<16; retry++) {
24752 + memset(&req, 0, sizeof(req));
24756 + hdr->bus = PMU_I2C_BUS_STATUS;
24757 + req.reply[0] = 0xff;
24760 + req.reply_expected = 0;
24761 + req.reply_len = 0;
24762 + req.data[0] = PMU_I2C_CMD;
24763 + rc = pmu_queue_request(&req);
24766 + while(!req.complete)
24768 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24773 -#endif /* CONFIG_PM */
24776 +pmu_i2c_simple_read(int bus, int addr, u8* data, int len)
24778 + struct adb_request req;
24779 + struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
24783 + for (retry=0; retry<16; retry++) {
24784 + memset(&req, 0, sizeof(req));
24787 + hdr->address = addr | 1;
24788 + hdr->mode = PMU_I2C_MODE_SIMPLE;
24790 + hdr->sub_addr = 0;
24791 + hdr->comb_addr = 0;
24792 + hdr->count = len;
24794 + req.data[0] = PMU_I2C_CMD;
24795 + req.nbytes = sizeof(struct pmu_i2c_hdr) + 1;
24796 + req.reply_expected = 0;
24797 + req.reply_len = 0;
24798 + req.reply[0] = 0xff;
24799 + rc = pmu_queue_request(&req);
24802 + while(!req.complete)
24804 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24808 + if (req.reply[0] != PMU_I2C_STATUS_OK)
24811 + for (retry=0; retry<16; retry++) {
24812 + memset(&req, 0, sizeof(req));
24816 + hdr->bus = PMU_I2C_BUS_STATUS;
24817 + req.reply[0] = 0xff;
24820 + req.reply_expected = 0;
24821 + req.reply_len = 0;
24822 + req.data[0] = PMU_I2C_CMD;
24823 + rc = pmu_queue_request(&req);
24826 + while(!req.complete)
24828 + if (req.reply[0] == PMU_I2C_STATUS_DATAREAD) {
24829 + memcpy(data, &req.reply[1], req.reply_len - 1);
24830 + return req.reply_len - 1;
24837 +pmu_i2c_simple_write(int bus, int addr, u8* data, int len)
24839 + struct adb_request req;
24840 + struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req.data[1];
24844 + for (retry=0; retry<16; retry++) {
24845 + memset(&req, 0, sizeof(req));
24848 + hdr->address = addr & 0xfe;
24849 + hdr->mode = PMU_I2C_MODE_SIMPLE;
24851 + hdr->sub_addr = 0;
24852 + hdr->comb_addr = 0;
24853 + hdr->count = len;
24855 + req.data[0] = PMU_I2C_CMD;
24856 + memcpy(&req.data[sizeof(struct pmu_i2c_hdr) + 1], data, len);
24857 + req.nbytes = sizeof(struct pmu_i2c_hdr) + len + 1;
24858 + req.reply_expected = 0;
24859 + req.reply_len = 0;
24860 + req.reply[0] = 0xff;
24861 + rc = pmu_queue_request(&req);
24864 + while(!req.complete)
24866 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24870 + if (req.reply[0] != PMU_I2C_STATUS_OK)
24873 + for (retry=0; retry<16; retry++) {
24874 + memset(&req, 0, sizeof(req));
24878 + hdr->bus = PMU_I2C_BUS_STATUS;
24879 + req.reply[0] = 0xff;
24882 + req.reply_expected = 0;
24883 + req.reply_len = 0;
24884 + req.data[0] = PMU_I2C_CMD;
24885 + rc = pmu_queue_request(&req);
24888 + while(!req.complete)
24890 + if (req.reply[0] == PMU_I2C_STATUS_OK)
24896 +#ifdef CONFIG_PMAC_PBOOK
24898 +static LIST_HEAD(sleep_notifiers);
24901 pmu_register_sleep_notifier(struct pmu_sleep_notifier *n)
24902 @@ -1885,90 +2288,166 @@
24905 extern long sys_sync(void);
24906 +extern void pm_prepare_console(void);
24907 +extern void pm_restore_console(void);
24909 -#define GRACKLE_PM (1<<7)
24910 -#define GRACKLE_DOZE (1<<5)
24911 -#define GRACKLE_NAP (1<<4)
24912 -#define GRACKLE_SLEEP (1<<3)
24915 -powerbook_sleep_G3(void)
24917 +pmac_suspend_devices(void)
24919 - unsigned long save_l2cr;
24920 - unsigned short pmcr1;
24921 - struct adb_request req;
24923 - struct pci_dev *grackle;
24925 - grackle = pci_find_slot(0, 0);
24929 - /* Notify device drivers */
24931 + pm_prepare_console();
24933 + /* Notify old-style device drivers & userland */
24934 ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
24935 if (ret != PBOOK_SLEEP_OK) {
24936 - printk("pmu: sleep rejected\n");
24937 + printk(KERN_ERR "Sleep rejected by drivers\n");
24941 /* Sync the disks. */
24942 /* XXX It would be nice to have some way to ensure that
24943 - * nobody is dirtying any new buffers while we wait.
24944 - * BenH: Moved to _after_ sleep request and changed video
24945 - * drivers to vmalloc() during sleep request. This way, all
24946 - * vmalloc's are done before actual sleep of block drivers */
24947 + * nobody is dirtying any new buffers while we wait. That
24948 + * could be acheived using the refrigerator for processes
24949 + * that swsusp uses
24953 /* Sleep can fail now. May not be very robust but useful for debugging */
24954 ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
24955 if (ret != PBOOK_SLEEP_OK) {
24956 - printk("pmu: sleep failed\n");
24957 + printk(KERN_ERR "Driver sleep failed\n");
24961 - /* Wait for completion of async backlight requests */
24962 - while (!bright_req_1.complete || !bright_req_2.complete ||
24963 - !bright_req_3.complete || !batt_req.complete)
24965 + /* Send suspend call to devices, hold the device core's dpm_sem */
24966 + ret = device_suspend(PM_SUSPEND_MEM);
24968 + printk(KERN_ERR "Driver sleep failed\n");
24969 + broadcast_wake();
24973 - /* Turn off various things. Darwin does some retry tests here... */
24974 - pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
24975 - while (!req.complete)
24977 - pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
24978 - PMU_POW_OFF|PMU_POW_BACKLIGHT|PMU_POW_IRLED|PMU_POW_MEDIABAY);
24979 - while (!req.complete)
24982 - /* Disable all interrupts */
24983 - pmac_sleep_save_intrs(-1);
24985 - /* Make sure the PMU is idle */
24986 - while (pmu_state != idle)
24989 /* Make sure the decrementer won't interrupt us */
24990 asm volatile("mtdec %0" : : "r" (0x7fffffff));
24991 /* Make sure any pending DEC interrupt occurring while we did
24992 * the above didn't re-enable the DEC */
24994 asm volatile("mtdec %0" : : "r" (0x7fffffff));
24996 - /* We can now disable MSR_EE */
24998 + /* We can now disable MSR_EE. This code of course works properly only
24999 + * on UP machines... For SMP, if we ever implement sleep, we'll have to
25000 + * stop the "other" CPUs way before we do all that stuff.
25002 local_irq_disable();
25004 - /* Giveup the FPU */
25005 + /* Broadcast power down irq
25006 + * This isn't that useful in most cases (only directly wired devices can
25007 + * use this but still... This will take care of sysdev's as well, so
25008 + * we exit from here with local irqs disabled and PIC off.
25010 + ret = device_power_down(PM_SUSPEND_MEM);
25012 + wakeup_decrementer();
25013 + local_irq_enable();
25015 + broadcast_wake();
25016 + printk(KERN_ERR "Driver powerdown failed\n");
25020 + /* Wait for completion of async backlight requests */
25021 + while (!bright_req_1.complete || !bright_req_2.complete ||
25022 + !bright_req_3.complete || !batt_req.complete)
25025 + /* Giveup the lazy FPU & vec so we don't have to back them
25026 + * up from the low level code
25028 enable_kernel_fp();
25030 +#ifdef CONFIG_ALTIVEC
25031 + if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
25032 + enable_kernel_altivec();
25033 +#endif /* CONFIG_ALTIVEC */
25039 +pmac_wakeup_devices(void)
25043 + /* Power back up system devices (including the PIC) */
25044 + device_power_up();
25048 + /* Force a poll of ADB interrupts */
25049 + adb_int_pending = 1;
25050 + via_pmu_interrupt(0, 0, 0);
25052 + /* Restart jiffies & scheduling */
25053 + wakeup_decrementer();
25055 + /* Re-enable local CPU interrupts */
25056 + local_irq_enable();
25060 + /* Resume devices */
25063 + /* Notify old style drivers */
25064 + broadcast_wake();
25066 + pm_restore_console();
25071 +#define GRACKLE_PM (1<<7)
25072 +#define GRACKLE_DOZE (1<<5)
25073 +#define GRACKLE_NAP (1<<4)
25074 +#define GRACKLE_SLEEP (1<<3)
25077 +powerbook_sleep_grackle(void)
25079 + unsigned long save_l2cr;
25080 + unsigned short pmcr1;
25081 + struct adb_request req;
25083 + struct pci_dev *grackle;
25085 + grackle = pci_find_slot(0, 0);
25089 + ret = pmac_suspend_devices();
25091 + printk(KERN_ERR "Sleep rejected by devices\n");
25095 + /* Turn off various things. Darwin does some retry tests here... */
25096 + pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
25097 + pmu_wait_complete(&req);
25098 + pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
25099 + PMU_POW_OFF|PMU_POW_BACKLIGHT|PMU_POW_IRLED|PMU_POW_MEDIABAY);
25100 + pmu_wait_complete(&req);
25102 /* For 750, save backside cache setting and disable it */
25103 save_l2cr = _get_L2CR(); /* (returns -1 if not available) */
25104 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
25105 _set_L2CR(save_l2cr & 0x7fffffff);
25107 - /* Ask the PMU to put us to sleep */
25108 - pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
25109 - while (!req.complete)
25111 + if (!__fake_sleep) {
25112 + /* Ask the PMU to put us to sleep */
25113 + pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
25114 + pmu_wait_complete(&req);
25117 /* The VIA is supposed not to be restored correctly*/
25119 @@ -1982,7 +2461,10 @@
25120 pci_write_config_word(grackle, 0x70, pmcr1);
25122 /* Call low-level ASM sleep handler */
25123 - low_sleep_handler();
25124 + if (__fake_sleep)
25127 + low_sleep_handler();
25129 /* We're awake again, stop grackle PM */
25130 pci_read_config_word(grackle, 0x70, &pmcr1);
25131 @@ -2001,36 +2483,17 @@
25132 set_context(current->active_mm->context, current->active_mm->pgd);
25134 /* Power things up */
25135 - pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc);
25136 - while (!req.complete)
25139 + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
25140 + pmu_wait_complete(&req);
25141 pmu_request(&req, NULL, 2, PMU_POWER_CTRL0,
25142 PMU_POW0_ON|PMU_POW0_HARD_DRIVE);
25143 - while (!req.complete)
25145 + pmu_wait_complete(&req);
25146 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
25147 PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY);
25148 - while (!req.complete)
25151 - /* reenable interrupt controller */
25152 - pmac_sleep_restore_intrs();
25153 + pmu_wait_complete(&req);
25155 - /* Leave some time for HW to settle down */
25158 - /* Restart jiffies & scheduling */
25159 - wakeup_decrementer();
25161 - /* Force a poll of ADB interrupts */
25162 - adb_int_pending = 1;
25163 - via_pmu_interrupt(0, 0, 0);
25165 - /* Re-enable local CPU interrupts */
25166 - local_irq_enable();
25168 - /* Notify drivers */
25169 - broadcast_wake();
25170 + pmac_wakeup_devices();
25174 @@ -2048,68 +2511,20 @@
25178 - /* Notify device drivers */
25179 - ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
25180 - if (ret != PBOOK_SLEEP_OK) {
25181 - printk("pmu: sleep rejected\n");
25185 - /* Sync the disks. */
25186 - /* XXX It would be nice to have some way to ensure that
25187 - * nobody is dirtying any new buffers while we wait.
25188 - * BenH: Moved to _after_ sleep request and changed video
25189 - * drivers to vmalloc() during sleep request. This way, all
25190 - * vmalloc's are done before actual sleep of block drivers */
25193 - /* Sleep can fail now. May not be very robust but useful for debugging */
25194 - ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
25195 - if (ret != PBOOK_SLEEP_OK) {
25196 - printk("pmu: sleep failed\n");
25198 + ret = pmac_suspend_devices();
25200 + printk(KERN_ERR "Sleep rejected by devices\n");
25203 - /* Wait for completion of async backlight requests */
25204 - while (!bright_req_1.complete || !bright_req_2.complete ||
25205 - !bright_req_3.complete || !batt_req.complete)
25209 /* Tell PMU what events will wake us up */
25210 pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_CLR_WAKEUP_EVENTS,
25212 - while (!req.complete)
25215 + pmu_wait_complete(&req);
25216 pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_SET_WAKEUP_EVENTS,
25217 0, PMU_PWR_WAKEUP_KEY |
25218 (option_lid_wakeup ? PMU_PWR_WAKEUP_LID_OPEN : 0));
25219 - while (!req.complete)
25222 - /* Save & disable all interrupts */
25223 - openpic_sleep_save_intrs();
25225 - /* Make sure the PMU is idle */
25226 - while (pmu_state != idle)
25229 - /* Make sure the decrementer won't interrupt us */
25230 - asm volatile("mtdec %0" : : "r" (0x7fffffff));
25231 - /* Make sure any pending DEC interrupt occurring while we did
25232 - * the above didn't re-enable the DEC */
25234 - asm volatile("mtdec %0" : : "r" (0x7fffffff));
25236 - /* We can now disable MSR_EE */
25237 - local_irq_disable();
25239 - /* Giveup the FPU & vec */
25240 - enable_kernel_fp();
25242 -#ifdef CONFIG_ALTIVEC
25243 - if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
25244 - enable_kernel_altivec();
25245 -#endif /* CONFIG_ALTIVEC */
25246 + pmu_wait_complete(&req);
25248 /* Save & disable L2 and L3 caches*/
25249 save_l3cr = _get_L3CR(); /* (returns -1 if not available) */
25250 @@ -2125,13 +2540,9 @@
25251 if (!__fake_sleep) {
25252 /* Ask the PMU to put us to sleep */
25253 pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
25254 - while (!req.complete && pmu_state != idle)
25256 + pmu_wait_complete(&req);
25259 - out_8(&via[B], in_8(&via[B]) | TREQ);
25262 /* The VIA is supposed not to be restored correctly*/
25265 @@ -2161,8 +2572,6 @@
25266 /* Don't restore PCI for now, it crashes. Maybe unnecessary on pbook */
25267 //pbook_pci_restore();
25271 /* Restore L2 cache */
25272 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
25273 _set_L2CR(save_l2cr);
25274 @@ -2174,31 +2583,15 @@
25275 set_context(current->active_mm->context, current->active_mm->pgd);
25277 /* Tell PMU we are ready */
25279 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2);
25280 - while (!req.complete)
25282 - pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc);
25283 - while (!req.complete)
25286 - /* reenable interrupt controller */
25287 - openpic_sleep_restore_intrs();
25289 - /* Leave some time for HW to settle down */
25292 - /* Restart jiffies & scheduling */
25293 - wakeup_decrementer();
25294 + pmu_wait_complete(&req);
25295 + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
25296 + pmu_wait_complete(&req);
25298 - /* Force a poll of ADB interrupts */
25299 - adb_int_pending = 1;
25300 - via_pmu_interrupt(0, 0, 0);
25303 - /* Re-enable local CPU interrupts */
25304 - local_irq_enable();
25306 - /* Notify drivers */
25307 - broadcast_wake();
25308 + pmac_wakeup_devices();
25312 @@ -2227,45 +2620,13 @@
25313 /* Allocate room for PCI save */
25314 pbook_alloc_pci_save();
25316 - /* Notify device drivers */
25317 - ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
25318 - if (ret != PBOOK_SLEEP_OK) {
25319 - pbook_free_pci_save();
25320 - printk("pmu: sleep rejected\n");
25324 - /* Sync the disks. */
25325 - /* XXX It would be nice to have some way to ensure that
25326 - * nobody is dirtying any new buffers while we wait.
25327 - * BenH: Moved to _after_ sleep request and changed video
25328 - * drivers to vmalloc() during sleep request. This way, all
25329 - * vmalloc's are done before actual sleep of block drivers */
25332 - /* Sleep can fail now. May not be very robust but useful for debugging */
25333 - ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
25334 - if (ret != PBOOK_SLEEP_OK) {
25335 - printk("pmu: sleep failed\n");
25336 + ret = pmac_suspend_devices();
25338 pbook_free_pci_save();
25340 + printk(KERN_ERR "Sleep rejected by devices\n");
25344 - /* Wait for completion of async backlight requests */
25345 - while (!bright_req_1.complete || !bright_req_2.complete ||
25346 - !bright_req_3.complete || !batt_req.complete)
25349 - /* Disable all interrupts except pmu */
25350 - pmac_sleep_save_intrs(vias->intrs[0].line);
25352 - /* Make sure the decrementer won't interrupt us */
25353 - asm volatile("mtdec %0" : : "r" (0x7fffffff));
25354 - /* Make sure any pending DEC interrupt occurring while we did
25355 - * the above didn't re-enable the DEC */
25357 - asm volatile("mtdec %0" : : "r" (0x7fffffff));
25359 /* Save the state of PCI config space for some slots */
25362 @@ -2303,25 +2664,13 @@
25363 out_be32(mem_ctrl_sleep, 0x3f);
25364 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,0);
25365 pbook_pci_restore();
25368 /* wait for the PMU interrupt sequence to complete */
25372 - /* reenable interrupts */
25373 - pmac_sleep_restore_intrs();
25375 - /* Leave some time for HW to settle down */
25378 - /* Restart jiffies & scheduling */
25379 - wakeup_decrementer();
25381 - /* Re-enable local CPU interrupts */
25382 - local_irq_enable();
25384 - /* Notify drivers */
25385 - broadcast_wake();
25386 + pmac_wakeup_devices();
25388 pbook_free_pci_save();
25390 @@ -2524,7 +2873,7 @@
25392 case PMU_HEATHROW_BASED:
25393 case PMU_PADDINGTON_BASED:
25394 - error = powerbook_sleep_G3();
25395 + error = powerbook_sleep_grackle();
25397 case PMU_KEYLARGO_BASED:
25398 error = powerbook_sleep_Core99();
25399 @@ -2676,8 +3025,15 @@
25401 EXPORT_SYMBOL(pmu_request);
25402 EXPORT_SYMBOL(pmu_poll);
25403 +EXPORT_SYMBOL(pmu_poll_adb);
25404 +EXPORT_SYMBOL(pmu_wait_complete);
25405 EXPORT_SYMBOL(pmu_suspend);
25406 EXPORT_SYMBOL(pmu_resume);
25407 +EXPORT_SYMBOL(pmu_unlock);
25408 +EXPORT_SYMBOL(pmu_i2c_combined_read);
25409 +EXPORT_SYMBOL(pmu_i2c_stdsub_write);
25410 +EXPORT_SYMBOL(pmu_i2c_simple_read);
25411 +EXPORT_SYMBOL(pmu_i2c_simple_write);
25412 #ifdef CONFIG_PMAC_PBOOK
25413 EXPORT_SYMBOL(pmu_register_sleep_notifier);
25414 EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
25415 diff -Nru a/drivers/md/md.c b/drivers/md/md.c
25416 --- a/drivers/md/md.c Thu Aug 7 02:25:25 2003
25417 +++ b/drivers/md/md.c Tue Aug 26 09:25:41 2003
25418 @@ -179,7 +179,6 @@
25419 mddev_map[mdidx(mddev)] = NULL;
25420 blk_put_queue(mddev->queue);
25422 - MOD_DEC_USE_COUNT;
25424 spin_unlock(&all_mddevs_lock);
25426 @@ -201,7 +200,6 @@
25427 mddev_map[unit] = new;
25428 list_add(&new->all_mddevs, &all_mddevs);
25429 spin_unlock(&all_mddevs_lock);
25430 - MOD_INC_USE_COUNT;
25433 spin_unlock(&all_mddevs_lock);
25434 @@ -640,14 +638,13 @@
25435 /* make rdev->sb match mddev data..
25437 * 1/ zero out disks
25438 - * 2/ Add info for each disk, keeping track of highest desc_nr
25439 - * 3/ any empty disks < highest become removed
25440 + * 2/ Add info for each disk, keeping track of highest desc_nr (next_spare);
25441 + * 3/ any empty disks < next_spare become removed
25443 * disks[0] gets initialised to REMOVED because
25444 * we cannot be sure from other fields if it has
25445 * been initialised or not.
25449 int active=0, working=0,failed=0,spare=0,nr_disks=0;
25451 @@ -718,17 +715,17 @@
25455 - if (rdev2->desc_nr > highest)
25456 - highest = rdev2->desc_nr;
25459 - /* now set the "removed" bit on any non-trailing holes */
25460 - for (i=0; i<highest; i++) {
25461 + /* now set the "removed" and "faulty" bits on any missing devices */
25462 + for (i=0 ; i < mddev->raid_disks ; i++) {
25463 mdp_disk_t *d = &sb->disks[i];
25464 if (d->state == 0 && d->number == 0) {
25467 d->state = (1<<MD_DISK_REMOVED);
25468 + d->state |= (1<<MD_DISK_FAULTY);
25472 sb->nr_disks = nr_disks;
25473 @@ -1612,12 +1609,6 @@
25474 spin_unlock(&pers_lock);
25476 blk_queue_make_request(mddev->queue, mddev->pers->make_request);
25477 - printk("%s: setting max_sectors to %d, segment boundary to %d\n",
25480 - (chunk_size>>1)-1);
25481 - blk_queue_max_sectors(mddev->queue, chunk_size >> 9);
25482 - blk_queue_segment_boundary(mddev->queue, (chunk_size>>1) - 1);
25483 mddev->queue->queuedata = mddev;
25485 err = mddev->pers->run(mddev);
25486 @@ -2366,17 +2357,14 @@
25487 unsigned int cmd, unsigned long arg)
25489 char b[BDEVNAME_SIZE];
25490 - unsigned int minor;
25491 + unsigned int minor = iminor(inode);
25493 struct hd_geometry *loc = (struct hd_geometry *) arg;
25494 mddev_t *mddev = NULL;
25497 if (!capable(CAP_SYS_ADMIN))
25500 - dev = inode->i_rdev;
25501 - minor = minor(dev);
25502 if (minor >= MAX_MD_DEVS) {
25505 @@ -2615,7 +2603,7 @@
25507 * Succeed if we can find or allocate a mddev structure.
25509 - mddev_t *mddev = mddev_find(minor(inode->i_rdev));
25510 + mddev_t *mddev = mddev_find(iminor(inode));
25514 @@ -3590,6 +3578,7 @@
25517 mddev = disk->private_data;
25518 + export_array(mddev);
25522 diff -Nru a/drivers/md/raid0.c b/drivers/md/raid0.c
25523 --- a/drivers/md/raid0.c Thu Aug 14 18:16:17 2003
25524 +++ b/drivers/md/raid0.c Sat Aug 23 15:07:18 2003
25525 @@ -231,6 +231,13 @@
25527 struct list_head *tmp;
25529 + printk("md%d: setting max_sectors to %d, segment boundary to %d\n",
25531 + mddev->chunk_size >> 9,
25532 + (mddev->chunk_size>>1)-1);
25533 + blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9);
25534 + blk_queue_segment_boundary(mddev->queue, (mddev->chunk_size>>1) - 1);
25536 conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL);
25539 diff -Nru a/drivers/md/raid5.c b/drivers/md/raid5.c
25540 --- a/drivers/md/raid5.c Sun Aug 10 16:01:44 2003
25541 +++ b/drivers/md/raid5.c Sat Aug 23 15:07:16 2003
25542 @@ -1326,7 +1326,7 @@
25543 (unsigned long long)new_sector,
25544 (unsigned long long)logical_sector);
25546 - sh = get_active_stripe(conf, new_sector, pd_idx, 0/*(bi->bi_rw&RWA_MASK)*/);
25547 + sh = get_active_stripe(conf, new_sector, pd_idx, (bi->bi_rw&RWA_MASK));
25550 add_stripe_bio(sh, bi, dd_idx, (bi->bi_rw&RW_MASK));
25551 @@ -1334,7 +1334,12 @@
25552 raid5_plug_device(conf);
25554 release_stripe(sh);
25556 + /* cannot get stripe for read-ahead, just give-up */
25557 + clear_bit(BIO_UPTODATE, &bi->bi_flags);
25562 spin_lock_irq(&conf->device_lock);
25563 if (--bi->bi_phys_segments == 0) {
25564 diff -Nru a/drivers/md/xor.c b/drivers/md/xor.c
25565 --- a/drivers/md/xor.c Wed Jul 24 08:36:02 2002
25566 +++ b/drivers/md/xor.c Sat Aug 23 15:07:12 2003
25567 @@ -134,7 +134,10 @@
25571 +static __exit void xor_exit(void) { }
25573 EXPORT_SYMBOL(xor_block);
25574 MODULE_LICENSE("GPL");
25576 module_init(calibrate_xor_block);
25577 +module_exit(xor_exit);
25578 diff -Nru a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
25579 --- a/drivers/media/common/saa7146_fops.c Mon Jul 7 04:28:54 2003
25580 +++ b/drivers/media/common/saa7146_fops.c Tue Aug 26 09:25:41 2003
25581 @@ -157,7 +157,7 @@
25583 static int fops_open(struct inode *inode, struct file *file)
25585 - unsigned int minor = minor(inode->i_rdev);
25586 + unsigned int minor = iminor(inode);
25587 struct saa7146_dev *h = NULL, *dev = NULL;
25588 struct list_head *list;
25589 struct saa7146_fh *fh = NULL;
25590 diff -Nru a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
25591 --- a/drivers/media/common/saa7146_video.c Thu Jul 31 16:47:19 2003
25592 +++ b/drivers/media/common/saa7146_video.c Sun Aug 31 16:14:08 2003
25593 @@ -359,41 +359,41 @@
25595 static struct v4l2_queryctrl controls[] = {
25597 - id: V4L2_CID_BRIGHTNESS,
25598 - name: "Brightness",
25602 - default_value: 128,
25603 - type: V4L2_CTRL_TYPE_INTEGER,
25604 + .id = V4L2_CID_BRIGHTNESS,
25605 + .name = "Brightness",
25609 + .default_value = 128,
25610 + .type = V4L2_CTRL_TYPE_INTEGER,
25612 - id: V4L2_CID_CONTRAST,
25613 - name: "Contrast",
25617 - default_value: 64,
25618 - type: V4L2_CTRL_TYPE_INTEGER,
25619 + .id = V4L2_CID_CONTRAST,
25620 + .name = "Contrast",
25624 + .default_value = 64,
25625 + .type = V4L2_CTRL_TYPE_INTEGER,
25627 - id: V4L2_CID_SATURATION,
25628 - name: "Saturation",
25632 - default_value: 64,
25633 - type: V4L2_CTRL_TYPE_INTEGER,
25634 + .id = V4L2_CID_SATURATION,
25635 + .name = "Saturation",
25639 + .default_value = 64,
25640 + .type = V4L2_CTRL_TYPE_INTEGER,
25642 - id: V4L2_CID_VFLIP,
25643 - name: "Vertical flip",
25646 - type: V4L2_CTRL_TYPE_BOOLEAN,
25647 + .id = V4L2_CID_VFLIP,
25648 + .name = "Vertical flip",
25651 + .type = V4L2_CTRL_TYPE_BOOLEAN,
25653 - id: V4L2_CID_HFLIP,
25654 - name: "Horizontal flip",
25657 - type: V4L2_CTRL_TYPE_BOOLEAN,
25658 + .id = V4L2_CID_HFLIP,
25659 + .name = "Horizontal flip",
25662 + .type = V4L2_CTRL_TYPE_BOOLEAN,
25665 static int NUM_CONTROLS = sizeof(controls)/sizeof(struct v4l2_queryctrl);
25666 diff -Nru a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
25667 --- a/drivers/media/dvb/dvb-core/dvbdev.c Tue Aug 12 13:25:49 2003
25668 +++ b/drivers/media/dvb/dvb-core/dvbdev.c Tue Aug 26 09:25:41 2003
25671 struct dvb_device *dvbdev;
25673 - dvbdev = dvbdev_find_device (minor(inode->i_rdev));
25674 + dvbdev = dvbdev_find_device (iminor(inode));
25676 if (dvbdev && dvbdev->fops) {
25678 diff -Nru a/drivers/media/dvb/frontends/grundig_29504-401.c b/drivers/media/dvb/frontends/grundig_29504-401.c
25679 --- a/drivers/media/dvb/frontends/grundig_29504-401.c Wed Jun 18 05:03:14 2003
25680 +++ b/drivers/media/dvb/frontends/grundig_29504-401.c Sun Aug 31 16:14:08 2003
25681 @@ -37,15 +37,15 @@
25684 struct dvb_frontend_info grundig_29504_401_info = {
25685 - name: "Grundig 29504-401",
25687 -/* frequency_min: ???,*/
25688 -/* frequency_max: ???,*/
25689 - frequency_stepsize: 166666,
25690 -/* frequency_tolerance: ???,*/
25691 -/* symbol_rate_tolerance: ???,*/
25692 - notifier_delay: 0,
25693 - caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
25694 + .name = "Grundig 29504-401",
25696 +/* .frequency_min = ???,*/
25697 +/* .frequency_max = ???,*/
25698 + .frequency_stepsize = 166666,
25699 +/* .frequency_tolerance = ???,*/
25700 +/* .symbol_rate_tolerance = ???,*/
25701 + .notifier_delay = 0,
25702 + .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
25703 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
25704 FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 |
25705 FE_CAN_MUTE_TS /*| FE_CAN_CLEAN_SETUP*/
25706 diff -Nru a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
25707 --- a/drivers/media/dvb/frontends/ves1820.c Thu Jun 19 23:48:36 2003
25708 +++ b/drivers/media/dvb/frontends/ves1820.c Sun Aug 31 16:14:08 2003
25710 .symbol_rate_min = (XIN/2)/64, /* SACLK/64 == (XIN/2)/64 */
25711 .symbol_rate_max = (XIN/2)/4, /* SACLK/4 */
25713 - frequency_tolerance: ???,
25714 - symbol_rate_tolerance: ???, /* ppm */ /* == 8% (spec p. 5) */
25715 - notifier_delay: ?,
25716 + .frequency_tolerance = ???,
25717 + .symbol_rate_tolerance = ???, /* ppm */ /* == 8% (spec p. 5) */
25718 + .notifier_delay = ?,
25720 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
25721 FE_CAN_QAM_128 | FE_CAN_QAM_256 |
25722 diff -Nru a/drivers/media/dvb/ttusb-dec/dec2000_frontend.c b/drivers/media/dvb/ttusb-dec/dec2000_frontend.c
25723 --- a/drivers/media/dvb/ttusb-dec/dec2000_frontend.c Mon Jul 14 02:56:39 2003
25724 +++ b/drivers/media/dvb/ttusb-dec/dec2000_frontend.c Sun Aug 31 16:14:08 2003
25725 @@ -30,12 +30,12 @@
25726 #define dprintk if (debug) printk
25728 static struct dvb_frontend_info dec2000_frontend_info = {
25729 - name: "TechnoTrend/Hauppauge DEC-2000-t Frontend",
25731 - frequency_min: 51000000,
25732 - frequency_max: 858000000,
25733 - frequency_stepsize: 62500,
25734 - caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
25735 + .name = "TechnoTrend/Hauppauge DEC-2000-t Frontend",
25737 + .frequency_min = 51000000,
25738 + .frequency_max = 858000000,
25739 + .frequency_stepsize = 62500,
25740 + .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
25741 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
25742 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
25743 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
25744 diff -Nru a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
25745 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c Sat Aug 9 06:43:04 2003
25746 +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c Sun Aug 31 16:14:08 2003
25747 @@ -1003,10 +1003,10 @@
25750 static struct usb_driver ttusb_dec_driver = {
25751 - name: DRIVER_NAME,
25752 - probe: ttusb_dec_probe,
25753 - disconnect: ttusb_dec_disconnect,
25754 - id_table: ttusb_dec_table,
25755 + .name = DRIVER_NAME,
25756 + .probe = ttusb_dec_probe,
25757 + .disconnect = ttusb_dec_disconnect,
25758 + .id_table = ttusb_dec_table,
25761 static int __init ttusb_dec_init(void)
25762 diff -Nru a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
25763 --- a/drivers/media/video/adv7170.c Wed Aug 20 15:29:21 2003
25764 +++ b/drivers/media/video/adv7170.c Sun Aug 31 16:14:05 2003
25765 @@ -104,6 +104,7 @@
25768 struct adv7170 *encoder = i2c_get_clientdata(client);
25770 encoder->reg[reg] = value;
25771 return i2c_smbus_write_byte_data(client, reg, value);
25773 @@ -130,6 +131,7 @@
25774 struct adv7170 *encoder = i2c_get_clientdata(client);
25775 struct i2c_msg msg;
25778 msg.addr = client->addr;
25779 msg.flags = client->flags;
25781 @@ -143,16 +145,16 @@
25783 } while (len >= 2 && data[0] == reg &&
25786 - i2c_transfer(client->adapter, &msg, 1)) < 0)
25787 + if ((ret = i2c_transfer(client->adapter,
25792 /* do some slow I2C emulation kind of thing */
25796 - adv7170_write(client, reg, *data++)) < 0)
25797 + if ((ret = adv7170_write(client, reg,
25802 @@ -442,6 +444,7 @@
25803 dname = adv7171_name;
25805 /* We should never get here!!! */
25809 snprintf(I2C_NAME(client), sizeof(I2C_NAME(client)) - 1,
25810 @@ -449,6 +452,7 @@
25812 encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL);
25813 if (encoder == NULL) {
25817 memset(encoder, 0, sizeof(struct adv7170));
25818 diff -Nru a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
25819 --- a/drivers/media/video/adv7175.c Wed Aug 20 15:29:21 2003
25820 +++ b/drivers/media/video/adv7175.c Sun Aug 31 16:14:05 2003
25821 @@ -100,6 +100,7 @@
25824 struct adv7175 *encoder = i2c_get_clientdata(client);
25826 encoder->reg[reg] = value;
25827 return i2c_smbus_write_byte_data(client, reg, value);
25829 @@ -126,6 +127,7 @@
25830 struct adv7175 *encoder = i2c_get_clientdata(client);
25831 struct i2c_msg msg;
25834 msg.addr = client->addr;
25835 msg.flags = client->flags;
25837 @@ -139,16 +141,16 @@
25839 } while (len >= 2 && data[0] == reg &&
25842 - i2c_transfer(client->adapter, &msg, 1)) < 0)
25843 + if ((ret = i2c_transfer(client->adapter,
25848 /* do some slow I2C emulation kind of thing */
25852 - adv7175_write(client, reg, *data++)) < 0)
25853 + if ((ret = adv7175_write(client, reg,
25858 @@ -163,6 +165,7 @@
25860 struct adv7175 *encoder = i2c_get_clientdata(client);
25863 printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client));
25864 for (i = 0; i < 182 / 8; i++) {
25865 printk("%s: 0x%02x -", I2C_NAME(client), i * 8);
25866 @@ -463,6 +466,7 @@
25867 dname = adv7176_name;
25869 /* We should never get here!!! */
25873 snprintf(I2C_NAME(client), sizeof(I2C_NAME(client)) - 1,
25874 @@ -470,6 +474,7 @@
25876 encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL);
25877 if (encoder == NULL) {
25881 memset(encoder, 0, sizeof(struct adv7175));
25882 diff -Nru a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
25883 --- a/drivers/media/video/bt819.c Wed Aug 20 15:29:21 2003
25884 +++ b/drivers/media/video/bt819.c Sun Aug 31 16:14:05 2003
25885 @@ -113,6 +113,7 @@
25888 struct bt819 *decoder = i2c_get_clientdata(client);
25890 decoder->reg[reg] = value;
25891 return i2c_smbus_write_byte_data(client, reg, value);
25893 @@ -124,6 +125,7 @@
25896 struct bt819 *decoder = i2c_get_clientdata(client);
25898 return bt819_write(client, reg,
25900 reg[reg] & ~(1 << bit)) |
25901 @@ -145,6 +147,7 @@
25902 struct bt819 *decoder = i2c_get_clientdata(client);
25903 struct i2c_msg msg;
25906 msg.addr = client->addr;
25907 msg.flags = client->flags;
25909 @@ -158,8 +161,8 @@
25911 } while (len >= 2 && data[0] == reg &&
25914 - i2c_transfer(client->adapter, &msg, 1)) < 0)
25915 + if ((ret = i2c_transfer(client->adapter,
25920 diff -Nru a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
25921 --- a/drivers/media/video/bt856.c Wed Aug 20 15:29:21 2003
25922 +++ b/drivers/media/video/bt856.c Sun Aug 31 16:14:05 2003
25926 struct bt856 *encoder = i2c_get_clientdata(client);
25928 encoder->reg[reg - REG_OFFSET] = value;
25929 return i2c_smbus_write_byte_data(client, reg, value);
25931 @@ -109,6 +110,7 @@
25934 struct bt856 *encoder = i2c_get_clientdata(client);
25936 return bt856_write(client, reg,
25938 reg[reg - REG_OFFSET] & ~(1 << bit)) |
25939 @@ -120,6 +122,7 @@
25942 struct bt856 *encoder = i2c_get_clientdata(client);
25944 printk(KERN_INFO "%s: register dump:", I2C_NAME(client));
25945 for (i = 0xd6; i <= 0xde; i += 2)
25946 printk(" %02x", encoder->reg[i - REG_OFFSET]);
25947 @@ -341,6 +344,7 @@
25949 encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL);
25950 if (encoder == NULL) {
25954 memset(encoder, 0, sizeof(struct bt856));
25955 diff -Nru a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
25956 --- a/drivers/media/video/bttv-driver.c Thu Aug 7 14:20:17 2003
25957 +++ b/drivers/media/video/bttv-driver.c Tue Aug 26 09:25:41 2003
25958 @@ -2758,7 +2758,7 @@
25960 static int bttv_open(struct inode *inode, struct file *file)
25962 - int minor = minor(inode->i_rdev);
25963 + int minor = iminor(inode);
25964 struct bttv *btv = NULL;
25965 struct bttv_fh *fh;
25966 enum v4l2_buf_type type = 0;
25967 @@ -2894,7 +2894,7 @@
25969 static int radio_open(struct inode *inode, struct file *file)
25971 - int minor = minor(inode->i_rdev);
25972 + int minor = iminor(inode);
25973 struct bttv *btv = NULL;
25976 diff -Nru a/drivers/media/video/meye.c b/drivers/media/video/meye.c
25977 --- a/drivers/media/video/meye.c Thu Jul 31 08:59:04 2003
25978 +++ b/drivers/media/video/meye.c Wed Aug 27 04:24:51 2003
25979 @@ -920,7 +920,7 @@
25982 struct video_capability *b = arg;
25983 - strcpy(b->name,meye.video_dev.name);
25984 + strcpy(b->name,meye.video_dev->name);
25985 b->type = VID_TYPE_CAPTURE;
25988 @@ -1225,6 +1225,8 @@
25989 .type = VID_TYPE_CAPTURE,
25990 .hardware = VID_HARDWARE_MEYE,
25991 .fops = &meye_fops,
25992 + .release = video_device_release,
25997 @@ -1275,10 +1277,17 @@
26001 - sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 1);
26003 meye.mchip_dev = pcidev;
26004 - memcpy(&meye.video_dev, &meye_template, sizeof(meye_template));
26005 + meye.video_dev = video_device_alloc();
26006 + if (!meye.video_dev) {
26007 + printk(KERN_ERR "meye: video_device_alloc() failed!\n");
26011 + memcpy(meye.video_dev, &meye_template, sizeof(meye_template));
26012 + meye.video_dev->dev = &meye.mchip_dev->dev;
26014 + sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 1);
26016 if ((ret = pci_enable_device(meye.mchip_dev))) {
26017 printk(KERN_ERR "meye: pci_enable_device failed\n");
26018 @@ -1335,7 +1344,7 @@
26020 mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
26022 - if (video_register_device(&meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
26023 + if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
26025 printk(KERN_ERR "meye: video_register_device failed\n");
26027 @@ -1383,6 +1392,9 @@
26029 pci_disable_device(meye.mchip_dev);
26031 + video_device_release(meye.video_dev);
26032 + meye.video_dev = NULL;
26034 sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 0);
26037 @@ -1390,7 +1402,7 @@
26039 static void __devexit meye_remove(struct pci_dev *pcidev) {
26041 - video_unregister_device(&meye.video_dev);
26042 + video_unregister_device(meye.video_dev);
26046 diff -Nru a/drivers/media/video/meye.h b/drivers/media/video/meye.h
26047 --- a/drivers/media/video/meye.h Wed Apr 16 03:01:38 2003
26048 +++ b/drivers/media/video/meye.h Tue Aug 26 09:48:06 2003
26049 @@ -312,7 +312,7 @@
26051 struct meye_queue grabq; /* queue for buffers to be grabbed */
26053 - struct video_device video_dev; /* video device parameters */
26054 + struct video_device *video_dev; /* video device parameters */
26055 struct video_picture picture; /* video picture parameters */
26056 struct meye_params params; /* additional parameters */
26058 diff -Nru a/drivers/media/video/planb.c b/drivers/media/video/planb.c
26059 --- a/drivers/media/video/planb.c Tue Aug 12 13:24:31 2003
26060 +++ b/drivers/media/video/planb.c Mon Sep 1 08:41:30 2003
26061 @@ -2158,6 +2158,7 @@
26062 unsigned int old_base, new_base;
26064 struct pci_dev *pdev;
26067 if (_machine != _MACH_Pmac)
26069 @@ -2211,18 +2212,25 @@
26071 pdev = pci_find_slot (bus, dev_fn);
26073 - printk(KERN_ERR "cannot find slot\n");
26074 - /* XXX handle error */
26075 + printk(KERN_ERR "planb: cannot find slot\n");
26079 /* Enable response in memory space, bus mastering,
26080 use memory write and invalidate */
26081 - pci_write_config_word (pdev, PCI_COMMAND,
26082 - PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
26083 - PCI_COMMAND_INVALIDATE);
26084 - /* Set PCI Cache line size & latency timer */
26085 - pci_write_config_byte (pdev, PCI_CACHE_LINE_SIZE, 0x8);
26086 - pci_write_config_byte (pdev, PCI_LATENCY_TIMER, 0x40);
26087 + rc = pci_enable_device(pdev);
26089 + printk(KERN_ERR "planb: cannot enable PCI device %s\n",
26093 + rc = pci_set_mwi(pdev);
26095 + printk(KERN_ERR "planb: cannot enable MWI on PCI device %s\n",
26097 + goto err_out_disable;
26099 + pci_set_master(pdev);
26101 /* Set the new base address */
26102 pci_write_config_dword (pdev, confreg, new_base);
26103 @@ -2234,6 +2242,12 @@
26109 + pci_disable_device(pdev);
26111 + /* FIXME handle error */ /* comment moved from pci_find_slot, above */
26115 static void release_planb(void)
26116 diff -Nru a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
26117 --- a/drivers/media/video/saa7110.c Wed Aug 20 15:29:21 2003
26118 +++ b/drivers/media/video/saa7110.c Sun Aug 31 16:14:05 2003
26122 struct saa7110 *decoder = i2c_get_clientdata(client);
26124 decoder->reg[reg] = value;
26125 return i2c_smbus_write_byte_data(client, reg, value);
26134 /* the saa7110 has an autoincrement function, use it if
26135 @@ -105,6 +107,7 @@
26136 struct saa7110 *decoder = i2c_get_clientdata(client);
26137 struct i2c_msg msg;
26141 msg.buf = (char *) block_data;
26142 msg.addr = client->addr;
26143 @@ -119,8 +122,8 @@
26146 while (len-- >= 1) {
26148 - saa7110_write(client, reg++, *data++)) < 0)
26149 + if ((ret = saa7110_write(client, reg++,
26154 @@ -279,6 +282,7 @@
26155 case DECODER_GET_CAPABILITIES:
26157 struct video_decoder_capability *dc = arg;
26160 VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC |
26161 VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO;
26162 diff -Nru a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
26163 --- a/drivers/media/video/saa7111.c Thu Aug 21 10:13:46 2003
26164 +++ b/drivers/media/video/saa7111.c Sun Aug 31 16:14:05 2003
26168 struct saa7111 *decoder = i2c_get_clientdata(client);
26170 decoder->reg[reg] = value;
26171 return i2c_smbus_write_byte_data(client, reg, value);
26173 @@ -112,6 +113,7 @@
26174 struct saa7111 *decoder = i2c_get_clientdata(client);
26175 struct i2c_msg msg;
26178 msg.addr = client->addr;
26179 msg.flags = client->flags;
26181 @@ -125,16 +127,16 @@
26183 } while (len >= 2 && data[0] == reg &&
26186 - i2c_transfer(client->adapter, &msg, 1)) < 0)
26187 + if ((ret = i2c_transfer(client->adapter,
26192 /* do some slow I2C emulation kind of thing */
26196 - saa7111_write(client, reg, *data++)) < 0)
26197 + if ((ret = saa7111_write(client, reg,
26202 diff -Nru a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
26203 --- a/drivers/media/video/saa7114.c Wed Aug 20 15:29:21 2003
26204 +++ b/drivers/media/video/saa7114.c Sun Aug 31 16:14:05 2003
26205 @@ -144,6 +144,7 @@
26208 /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
26210 /*decoder->reg[reg] = value;*/
26211 return i2c_smbus_write_byte_data(client, reg, value);
26213 @@ -163,6 +164,7 @@
26214 /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
26215 struct i2c_msg msg;
26218 msg.addr = client->addr;
26219 msg.flags = client->flags;
26221 @@ -176,16 +178,16 @@
26223 } while (len >= 2 && data[0] == reg &&
26226 - i2c_transfer(client->adapter, &msg, 1)) < 0)
26227 + if ((ret = i2c_transfer(client->adapter,
26232 /* do some slow I2C emulation kind of thing */
26236 - saa7114_write(client, reg, *data++)) < 0)
26237 + if ((ret = saa7114_write(client, reg,
26242 @@ -995,6 +997,8 @@
26244 "%s_attach: init error %d at stage %d, leaving attach.\n",
26245 I2C_NAME(client), i, err[i]);
26251 @@ -1022,6 +1026,8 @@
26253 "%s_attach: init error %d at stage %d, leaving attach.\n",
26254 I2C_NAME(client), i, err[i]);
26260 @@ -1068,6 +1074,8 @@
26262 "%s_attach: init error %d at stage %d, leaving attach.\n",
26263 I2C_NAME(client), i, err[i]);
26269 @@ -1107,6 +1115,8 @@
26271 "%s_attach: init error %d at stage %d, leaving attach.\n",
26272 I2C_NAME(client), i, err[i]);
26278 @@ -1127,6 +1137,8 @@
26280 "%s_attach: init error %d at stage %d, leaving attach.\n",
26281 I2C_NAME(client), i, err[i]);
26287 diff -Nru a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
26288 --- a/drivers/media/video/saa7134/saa7134-oss.c Sun May 25 17:00:00 2003
26289 +++ b/drivers/media/video/saa7134/saa7134-oss.c Tue Aug 26 09:25:41 2003
26290 @@ -215,7 +215,7 @@
26292 static int dsp_open(struct inode *inode, struct file *file)
26294 - int minor = minor(inode->i_rdev);
26295 + int minor = iminor(inode);
26296 struct saa7134_dev *h,*dev = NULL;
26297 struct list_head *list;
26299 @@ -598,7 +598,7 @@
26301 static int mixer_open(struct inode *inode, struct file *file)
26303 - int minor = minor(inode->i_rdev);
26304 + int minor = iminor(inode);
26305 struct saa7134_dev *h,*dev = NULL;
26306 struct list_head *list;
26308 diff -Nru a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
26309 --- a/drivers/media/video/saa7134/saa7134-ts.c Thu Jul 31 16:47:19 2003
26310 +++ b/drivers/media/video/saa7134/saa7134-ts.c Tue Aug 26 09:25:41 2003
26311 @@ -166,7 +166,7 @@
26313 static int ts_open(struct inode *inode, struct file *file)
26315 - int minor = minor(inode->i_rdev);
26316 + int minor = iminor(inode);
26317 struct saa7134_dev *h,*dev = NULL;
26318 struct list_head *list;
26320 diff -Nru a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
26321 --- a/drivers/media/video/saa7134/saa7134-video.c Thu Jul 31 16:47:19 2003
26322 +++ b/drivers/media/video/saa7134/saa7134-video.c Tue Aug 26 09:25:41 2003
26323 @@ -1131,7 +1131,7 @@
26325 static int video_open(struct inode *inode, struct file *file)
26327 - int minor = minor(inode->i_rdev);
26328 + int minor = iminor(inode);
26329 struct saa7134_dev *h,*dev = NULL;
26330 struct saa7134_fh *fh;
26331 struct list_head *list;
26332 diff -Nru a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
26333 --- a/drivers/media/video/saa7185.c Wed Aug 20 15:29:21 2003
26334 +++ b/drivers/media/video/saa7185.c Sun Aug 31 16:14:05 2003
26338 struct saa7185 *encoder = i2c_get_clientdata(client);
26340 dprintk(1, KERN_DEBUG "SAA7185: %02x set to %02x\n", reg, value);
26341 encoder->reg[reg] = value;
26342 return i2c_smbus_write_byte_data(client, reg, value);
26343 @@ -118,6 +119,7 @@
26344 struct saa7185 *encoder = i2c_get_clientdata(client);
26345 struct i2c_msg msg;
26348 msg.addr = client->addr;
26349 msg.flags = client->flags;
26351 @@ -131,16 +133,16 @@
26353 } while (len >= 2 && data[0] == reg &&
26356 - i2c_transfer(client->adapter, &msg, 1)) < 0)
26357 + if ((ret = i2c_transfer(client->adapter,
26362 /* do some slow I2C emulation kind of thing */
26366 - saa7185_write(client, reg, *data++)) < 0)
26367 + if ((ret = saa7185_write(client, reg,
26372 @@ -434,6 +436,7 @@
26374 encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL);
26375 if (encoder == NULL) {
26379 memset(encoder, 0, sizeof(struct saa7185));
26380 diff -Nru a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
26381 --- a/drivers/media/video/stradis.c Thu Apr 24 03:35:23 2003
26382 +++ b/drivers/media/video/stradis.c Tue Aug 26 09:25:41 2003
26383 @@ -1946,7 +1946,7 @@
26384 static int saa_open(struct inode *inode, struct file *file)
26386 struct saa7146 *saa = NULL;
26387 - unsigned int minor = minor(inode->i_rdev);
26388 + unsigned int minor = iminor(inode);
26391 for (i = 0; i < SAA7146_MAX; i++) {
26392 diff -Nru a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
26393 --- a/drivers/media/video/tvmixer.c Wed Aug 20 15:29:21 2003
26394 +++ b/drivers/media/video/tvmixer.c Tue Aug 26 09:25:41 2003
26395 @@ -173,7 +173,7 @@
26397 static int tvmixer_open(struct inode *inode, struct file *file)
26399 - int i, minor = minor(inode->i_rdev);
26400 + int i, minor = iminor(inode);
26401 struct TVMIXER *mix = NULL;
26402 struct i2c_client *client = NULL;
26404 diff -Nru a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
26405 --- a/drivers/media/video/videodev.c Wed Aug 6 02:51:26 2003
26406 +++ b/drivers/media/video/videodev.c Sun Aug 31 16:13:58 2003
26409 struct video_device* video_devdata(struct file *file)
26411 - return video_device[minor(file->f_dentry->d_inode->i_rdev)];
26412 + return video_device[iminor(file->f_dentry->d_inode)];
26416 @@ -107,7 +107,7 @@
26418 static int video_open(struct inode *inode, struct file *file)
26420 - unsigned int minor = minor(inode->i_rdev);
26421 + unsigned int minor = iminor(inode);
26423 struct video_device *vfl;
26424 struct file_operations *old_fops;
26425 @@ -349,9 +349,9 @@
26426 if(video_device[vfd->minor]!=vfd)
26427 panic("videodev: bad unregister");
26429 - class_device_unregister(&vfd->class_dev);
26430 devfs_remove(vfd->devfs_name);
26431 video_device[vfd->minor]=NULL;
26432 + class_device_unregister(&vfd->class_dev);
26433 up(&videodev_lock);
26436 diff -Nru a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
26437 --- a/drivers/media/video/vpx3220.c Wed Aug 20 15:29:21 2003
26438 +++ b/drivers/media/video/vpx3220.c Sun Aug 31 16:14:05 2003
26442 struct vpx3220 *decoder = i2c_get_clientdata(client);
26444 decoder->reg[reg] = value;
26445 return i2c_smbus_write_byte_data(client, reg, value);
26447 @@ -294,6 +295,7 @@
26449 int len = sizeof(init_common);
26450 const unsigned char *data = init_common;
26454 KERN_DEBUG "vpx3216b i2c reg 0x%02x data 0x%02x\n",
26455 diff -Nru a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h
26456 --- a/drivers/media/video/zoran.h Wed Aug 20 15:29:21 2003
26457 +++ b/drivers/media/video/zoran.h Sun Aug 31 16:14:06 2003
26458 @@ -146,7 +146,7 @@
26460 #define ZORAN_NAME "ZORAN" /* name of the device */
26462 -#define ZR_DEVNAME(zr) pci_name((zr)->pci_dev)
26463 +#define ZR_DEVNAME(zr) ((zr)->name)
26465 #define BUZ_MAX_WIDTH (zr->timing->Wa)
26466 #define BUZ_MAX_HEIGHT (zr->timing->Ha)
26467 @@ -383,7 +383,7 @@
26471 - struct video_device video_dev;
26472 + struct video_device *video_dev;
26474 struct i2c_adapter i2c_adapter; /* */
26475 struct i2c_algo_bit_data i2c_algo; /* */
26476 @@ -403,9 +403,7 @@
26477 struct tvnorm *timing;
26479 unsigned short id; /* number of this device */
26480 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
26481 char name[32]; /* name of this device */
26483 struct pci_dev *pci_dev; /* PCI device */
26484 unsigned char revision; /* revision of zr36057 */
26485 unsigned int zr36057_adr; /* bus address of IO mem returned by PCI BIOS */
26486 diff -Nru a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
26487 --- a/drivers/media/video/zoran_card.c Wed Aug 20 15:29:21 2003
26488 +++ b/drivers/media/video/zoran_card.c Sun Aug 31 16:14:05 2003
26489 @@ -136,7 +136,8 @@
26490 MODULE_PARM_DESC(pass_through,
26491 "Pass TV signal through to TV-out when idling");
26494 +static int debug = 1;
26495 +int *zr_debug = &debug;
26496 MODULE_PARM(debug, "i");
26497 MODULE_PARM_DESC(debug, "Debug level (0-4)");
26499 @@ -153,7 +154,7 @@
26501 #define dprintk(num, format, args...) \
26503 - if (debug >= num) \
26504 + if (*zr_debug >= num) \
26505 printk(format, ##args); \
26508 @@ -623,6 +624,7 @@
26509 zoran_i2c_getsda (void *data)
26511 struct zoran *zr = (struct zoran *) data;
26513 return (btread(ZR36057_I2CBR) >> 1) & 1;
26516 @@ -630,6 +632,7 @@
26517 zoran_i2c_getscl (void *data)
26519 struct zoran *zr = (struct zoran *) data;
26521 return btread(ZR36057_I2CBR) & 1;
26524 @@ -638,6 +641,7 @@
26527 struct zoran *zr = (struct zoran *) data;
26532 @@ -650,6 +654,7 @@
26535 struct zoran *zr = (struct zoran *) data;
26540 @@ -766,6 +771,7 @@
26541 struct zoran_jpg_settings *settings)
26543 int err = 0, err0 = 0;
26547 "%s: check_jpg_settings() - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n",
26548 @@ -977,7 +983,7 @@
26550 dprintk(1, ": time spent: %d\n", 1 * HZ - timeout);
26553 + if (*zr_debug > 1)
26554 print_interrupts(zr);
26555 btwrite(icr, ZR36057_ICR);
26557 @@ -986,6 +992,7 @@
26558 zr36057_init (struct zoran *zr)
26562 unsigned mem_needed;
26565 @@ -1040,11 +1047,16 @@
26566 * in case allocation fails */
26567 mem_needed = BUZ_NUM_STAT_COM * 4;
26568 mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL);
26570 + vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);
26571 + if (!mem || !vdev) {
26574 "%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
26579 + kfree((void *)mem);
26582 memset((void *) mem, 0, mem_needed);
26583 @@ -1056,17 +1068,19 @@
26585 * Now add the template and register the device unit.
26587 - memcpy(&zr->video_dev, &zoran_template, sizeof(zoran_template));
26588 - strcpy(zr->video_dev.name, ZR_DEVNAME(zr));
26589 - if (video_register_device
26590 - (&zr->video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
26591 + zr->video_dev = vdev;
26592 + memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
26593 + strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
26594 + if (video_register_device(zr->video_dev, VFL_TYPE_GRABBER,
26596 zoran_unregister_i2c(zr);
26597 kfree((void *) zr->stat_com);
26602 zoran_init_hardware(zr);
26604 + if (*zr_debug > 2)
26605 detect_guest_activity(zr);
26606 test_interrupts(zr);
26607 if (!pass_through) {
26608 @@ -1109,7 +1123,14 @@
26609 kfree((void *) zr->stat_com);
26610 zoran_proc_cleanup(zr);
26611 iounmap(zr->zr36057_mem);
26612 - video_unregister_device(&zr->video_dev);
26613 + pci_disable_device(zr->pci_dev);
26614 + video_unregister_device(zr->video_dev);
26618 +zoran_vdev_release (struct video_device *vdev)
26623 static struct videocodec_master * __devinit
26624 @@ -1207,6 +1228,7 @@
26627 unsigned short ss_vendor, ss_device;
26629 ss_vendor = zr->pci_dev->subsystem_vendor;
26630 ss_device = zr->pci_dev->subsystem_device;
26632 @@ -1467,6 +1489,7 @@
26633 init_dc10_cards (void)
26637 memset(zoran, 0, sizeof(zoran));
26638 printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n",
26639 MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION);
26640 @@ -1523,6 +1546,7 @@
26641 /* take care of Natoma chipset and a revision 1 zr36057 */
26642 for (i = 0; i < zoran_num; i++) {
26643 struct zoran *zr = &zoran[i];
26645 if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) {
26646 zr->jpg_buffers.need_contiguous = 1;
26648 @@ -1546,6 +1570,7 @@
26649 unload_dc10_cards (void)
26653 for (i = 0; i < zoran_num; i++)
26654 zoran_release(&zoran[i]);
26656 diff -Nru a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h
26657 --- a/drivers/media/video/zoran_card.h Wed Aug 20 14:29:31 2003
26658 +++ b/drivers/media/video/zoran_card.h Sun Aug 31 16:14:03 2003
26660 extern int zoran_check_jpg_settings(struct zoran *zr,
26661 struct zoran_jpg_settings *settings);
26662 extern void zoran_open_init_params(struct zoran *zr);
26663 +extern void zoran_vdev_release(struct video_device *vdev);
26665 #endif /* __ZORAN_CARD_H__ */
26666 diff -Nru a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
26667 --- a/drivers/media/video/zoran_device.c Wed Aug 20 14:29:31 2003
26668 +++ b/drivers/media/video/zoran_device.c Sun Aug 31 16:14:05 2003
26669 @@ -58,11 +58,11 @@
26670 extern const struct zoran_format zoran_formats[];
26671 extern const int zoran_num_formats;
26674 +extern int *zr_debug;
26676 #define dprintk(num, format, args...) \
26678 - if (debug >= num) \
26679 + if (*zr_debug >= num) \
26680 printk(format, ##args); \
26683 @@ -170,7 +170,7 @@
26685 dump_guests (struct zoran *zr)
26688 + if (*zr_debug > 2) {
26691 for (i = 1; i < 8; i++) { // Don't read jpeg codec here
26692 @@ -190,6 +190,7 @@
26697 do_gettimeofday(&tv);
26698 return (1000000 * tv.tv_sec + tv.tv_usec);
26700 @@ -868,8 +869,8 @@
26702 print_interrupts (struct zoran *zr)
26706 + int res, noerr = 0;
26708 printk(KERN_INFO "%s: interrupts received:", ZR_DEVNAME(zr));
26709 if ((res = zr->field_counter) < -1 || res > 1) {
26710 printk(" FD:%d", res);
26711 @@ -931,6 +932,7 @@
26712 count_reset_interrupt (struct zoran *zr)
26716 if ((isr = btread(ZR36057_ISR) & 0x78000000)) {
26717 if (isr & ZR36057_ISR_GIRQ1) {
26718 btwrite(ZR36057_ISR_GIRQ1, ZR36057_ISR);
26719 @@ -961,6 +963,7 @@
26720 jpeg_start (struct zoran *zr)
26726 /* deassert P_reset, disable code transfer, deassert Active */
26727 @@ -1272,7 +1275,7 @@
26731 - if (debug > 1 && zr->num_errors <= 8) {
26732 + if (*zr_debug > 1 && zr->num_errors <= 8) {
26735 zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
26736 @@ -1453,38 +1456,23 @@
26738 /* it is finished, notify the user */
26740 - zr->v4l_buffers.buffer[zr->
26742 - state = BUZ_STATE_DONE;
26743 - zr->v4l_buffers.buffer[zr->
26746 - zr->v4l_grab_seq;
26747 - do_gettimeofday(&zr->
26753 - zr->v4l_grab_frame =
26755 + zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE;
26756 + zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq;
26757 + do_gettimeofday(&zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.timestamp);
26758 + zr->v4l_grab_frame = NO_GRAB_ACTIVE;
26759 zr->v4l_pend_tail++;
26763 if (zr->v4l_grab_frame == NO_GRAB_ACTIVE)
26764 - wake_up_interruptible(&zr->
26766 + wake_up_interruptible(&zr->v4l_capq);
26768 /* Check if there is another grab queued */
26770 if (zr->v4l_grab_frame == NO_GRAB_ACTIVE &&
26771 - zr->v4l_pend_tail !=
26772 - zr->v4l_pend_head) {
26773 + zr->v4l_pend_tail != zr->v4l_pend_head) {
26776 - zr->v4l_pend[zr->
26778 + int frame = zr->v4l_pend[zr->v4l_pend_tail &
26782 @@ -1544,7 +1532,7 @@
26784 if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS ||
26785 zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
26787 + if (*zr_debug > 1 &&
26788 (!zr->frame_num || zr->JPEG_error)) {
26790 "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n",
26791 @@ -1559,11 +1547,8 @@
26794 for (i = 0; i < 4; i++) {
26800 + if (zr->stat_com[i] & 1)
26805 @@ -1584,7 +1569,7 @@
26809 - if (debug > 2 && zr->frame_num < 6) {
26810 + if (*zr_debug > 2 && zr->frame_num < 6) {
26812 printk("%s: seq=%ld stat_com:",
26813 ZR_DEVNAME(zr), zr->jpg_seq_num);
26814 @@ -1643,10 +1628,11 @@
26815 zoran_set_pci_master (struct zoran *zr,
26820 pci_set_master(zr->pci_dev);
26824 pci_read_config_word(zr->pci_dev, PCI_COMMAND, &command);
26825 command &= ~PCI_COMMAND_MASTER;
26826 pci_write_config_word(zr->pci_dev, PCI_COMMAND, command);
26827 @@ -1657,6 +1643,7 @@
26828 zoran_init_hardware (struct zoran *zr)
26832 /* Enable bus-mastering */
26833 zoran_set_pci_master(zr, 1);
26835 @@ -1718,6 +1705,7 @@
26836 zr36057_init_vfe (struct zoran *zr)
26840 reg = btread(ZR36057_VFESPFR);
26841 reg |= ZR36057_VFESPFR_LittleEndian;
26842 reg &= ~ZR36057_VFESPFR_VCLKPol;
26843 @@ -1748,6 +1736,7 @@
26844 if (zr->card.type == LML33 &&
26845 (cmd == DECODER_SET_NORM || DECODER_SET_INPUT)) {
26848 // Bt819 needs to reset its FIFO buffer using #FRST pin and
26849 // LML33 card uses GPIO(7) for that.
26851 diff -Nru a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
26852 --- a/drivers/media/video/zoran_driver.c Wed Aug 20 14:29:31 2003
26853 +++ b/drivers/media/video/zoran_driver.c Sun Aug 31 16:14:05 2003
26855 #include <linux/delay.h>
26856 #include <linux/slab.h>
26857 #include <linux/pci.h>
26858 +#include <linux/vmalloc.h>
26860 #include <linux/interrupt.h>
26861 #include <linux/i2c.h>
26862 @@ -187,11 +188,11 @@
26863 # include <linux/bigphysarea.h>
26867 +extern int *zr_debug;
26869 #define dprintk(num, format, args...) \
26871 - if (debug >= num) \
26872 + if (*zr_debug >= num) \
26873 printk(format, ##args); \
26876 @@ -370,6 +371,7 @@
26878 (fh->v4l_buffers.buffer_size + PAGE_SIZE -
26882 (unsigned char *) bigphysarea_alloc_pages(n, 0,
26884 @@ -412,6 +414,7 @@
26886 fh->v4l_buffers.num_buffers *
26887 fh->v4l_buffers.buffer_size;
26889 pmem = get_high_mem(size);
26892 @@ -847,9 +850,10 @@
26897 - zoran_v4l_set_format(file, mp->width, mp->height,
26898 - &zoran_formats[i])))
26899 + if ((res = zoran_v4l_set_format(file,
26902 + &zoran_formats[i])))
26904 zr->v4l_settings = fh->v4l_settings;
26906 @@ -1144,7 +1148,7 @@
26907 frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME];
26909 /* buffer should now be in BUZ_STATE_DONE */
26911 + if (*zr_debug > 0)
26912 if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE)
26915 @@ -1268,7 +1272,7 @@
26917 /* find the device */
26918 for (i = 0; i < zoran_num; i++) {
26919 - if (zoran[i].video_dev.minor == minor) {
26920 + if (zoran[i].video_dev->minor == minor) {
26924 @@ -1424,7 +1428,7 @@
26925 /* disable interrupts */
26926 btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR);
26929 + if (*zr_debug > 1)
26930 print_interrupts(zr);
26933 @@ -2032,6 +2036,7 @@
26936 struct video_capability *vcap = arg;
26938 dprintk(3, KERN_DEBUG "%s: VIDIOCGCAP\n", ZR_DEVNAME(zr));
26940 memset(vcap, 0, sizeof(struct video_capability));
26941 @@ -2154,6 +2159,7 @@
26943 for (i = 0; i < zoran_num_formats; i++) {
26944 const struct zoran_format *fmt = &zoran_formats[i];
26946 if (fmt->palette != -1 &&
26947 fmt->flags & ZORAN_FORMAT_OVERLAY &&
26948 fmt->palette == vpict->palette &&
26949 @@ -2203,7 +2209,9 @@
26952 struct video_window *vwin = arg;
26954 dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr));
26956 memset(vwin, 0, sizeof(struct video_window));
26957 down(&zr->resource_lock);
26958 vwin->x = fh->overlay_settings.x;
26959 @@ -2241,7 +2249,9 @@
26962 struct video_buffer *vbuf = arg;
26964 dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr));
26966 down(&zr->resource_lock);
26967 *vbuf = zr->buffer;
26968 up(&zr->resource_lock);
26969 @@ -2285,8 +2295,10 @@
26972 int *frame = arg, res;
26974 dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n",
26975 ZR_DEVNAME(zr), *frame);
26977 down(&zr->resource_lock);
26978 res = v4l_sync(file, *frame);
26979 up(&zr->resource_lock);
26980 @@ -2300,11 +2312,13 @@
26982 struct video_mmap *vmap = arg;
26987 "%s: VIDIOCMCAPTURE - frame=%d, geom=%dx%d, fmt=%d\n",
26988 ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height,
26991 down(&zr->resource_lock);
26992 res = v4l_grab(file, vmap);
26993 up(&zr->resource_lock);
26994 @@ -2358,7 +2372,8 @@
26995 struct video_unit *vunit = arg;
26997 dprintk(3, KERN_DEBUG "%s: VIDIOCGUNIT\n", ZR_DEVNAME(zr));
26998 - vunit->video = zr->video_dev.minor;
27000 + vunit->video = zr->video_dev->minor;
27001 vunit->vbi = VIDEO_NO_UNIT;
27002 vunit->radio = VIDEO_NO_UNIT;
27003 vunit->audio = VIDEO_NO_UNIT;
27004 @@ -2393,6 +2408,7 @@
27005 case BUZIOC_G_PARAMS:
27007 struct zoran_params *bparams = arg;
27009 dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr));
27011 memset(bparams, 0, sizeof(struct zoran_params));
27012 @@ -2686,6 +2702,7 @@
27013 struct v4l2_fmtdesc *fmt = arg;
27014 int index = fmt->index, num = -1, i, flag = 0, type =
27017 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUM_FMT - index=%d\n",
27018 ZR_DEVNAME(zr), fmt->index);
27020 @@ -3530,6 +3547,7 @@
27021 case VIDIOC_QUERYCTRL:
27023 struct v4l2_queryctrl *ctrl = arg;
27025 dprintk(3, KERN_DEBUG "%s: VIDIOC_QUERYCTRL - id=%d\n",
27026 ZR_DEVNAME(zr), ctrl->id);
27028 @@ -3571,6 +3589,7 @@
27029 case VIDIOC_G_CTRL:
27031 struct v4l2_control *ctrl = arg;
27033 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_CTRL - id=%d\n",
27034 ZR_DEVNAME(zr), ctrl->id);
27036 @@ -3652,6 +3671,7 @@
27037 case VIDIOC_ENUMSTD:
27039 struct v4l2_standard *std = arg;
27041 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMSTD - index=%d\n",
27042 ZR_DEVNAME(zr), std->index);
27044 @@ -3707,6 +3727,7 @@
27046 v4l2_std_id *std = arg;
27049 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr));
27051 down(&zr->resource_lock);
27052 @@ -3804,6 +3825,7 @@
27053 case VIDIOC_G_INPUT:
27057 dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr));
27059 down(&zr->resource_lock);
27060 @@ -3817,6 +3839,7 @@
27061 case VIDIOC_S_INPUT:
27063 int *input = arg, res = 0;
27065 dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n",
27066 ZR_DEVNAME(zr), *input);
27068 @@ -3835,6 +3858,7 @@
27069 case VIDIOC_ENUMOUTPUT:
27071 struct v4l2_output *outp = arg;
27073 dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMOUTPUT - index=%d\n",
27074 ZR_DEVNAME(zr), outp->index);
27076 @@ -4005,7 +4029,9 @@
27077 case VIDIOC_G_JPEGCOMP:
27079 struct v4l2_jpegcompression *params = arg;
27080 - dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n", ZR_DEVNAME(zr));
27082 + dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n",
27085 memset(params, 0, sizeof(*params));
27087 @@ -4175,6 +4201,7 @@
27088 } else if (fmt->type ==
27089 V4L2_BUF_TYPE_VIDEO_CAPTURE) {
27092 for (i = 0; i < zoran_num_formats; i++)
27093 if (zoran_formats[i].fourcc ==
27094 fmt->fmt.pix.pixelformat)
27095 @@ -4321,6 +4348,7 @@
27096 zoran_vm_open (struct vm_area_struct *vma)
27098 struct zoran_mapping *map = vma->vm_private_data;
27103 @@ -4665,5 +4693,6 @@
27105 .hardware = ZORAN_HARDWARE,
27106 .fops = &zoran_fops,
27107 + .release = &zoran_vdev_release,
27110 diff -Nru a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c
27111 --- a/drivers/media/video/zoran_procfs.c Wed Aug 20 15:38:07 2003
27112 +++ b/drivers/media/video/zoran_procfs.c Sun Aug 31 16:14:05 2003
27113 @@ -49,11 +49,11 @@
27115 #include "zoran_procfs.h"
27118 +extern int *zr_debug;
27120 #define dprintk(num, format, args...) \
27122 - if (debug >= num) \
27123 + if (*zr_debug >= num) \
27124 printk(format, ##args); \
27127 @@ -248,6 +248,7 @@
27129 #ifdef CONFIG_PROC_FS
27132 snprintf(name, 7, "zoran%d", zr->id);
27133 if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
27134 zr->zoran_proc->read_proc = zoran_read_proc;
27135 @@ -272,6 +273,7 @@
27137 #ifdef CONFIG_PROC_FS
27140 snprintf(name, 7, "zoran%d", zr->id);
27141 if (zr->zoran_proc) {
27142 remove_proc_entry(name, 0);
27143 diff -Nru a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c
27144 --- a/drivers/mtd/maps/ceiva.c Wed May 28 08:01:03 2003
27145 +++ b/drivers/mtd/maps/ceiva.c Sun Aug 31 16:14:08 2003
27146 @@ -64,23 +64,23 @@
27148 static struct mtd_partition ceiva_partitions[] = {
27150 - name: "Ceiva BOOT partition",
27151 - size: BOOT_PARTITION_SIZE_KiB*1024,
27153 + .name = "Ceiva BOOT partition",
27154 + .size = BOOT_PARTITION_SIZE_KiB*1024,
27158 - name: "Ceiva parameters partition",
27159 - size: PARAMS_PARTITION_SIZE_KiB*1024,
27160 - offset: (16 + 8) * 1024,
27161 + .name = "Ceiva parameters partition",
27162 + .size = PARAMS_PARTITION_SIZE_KiB*1024,
27163 + .offset = (16 + 8) * 1024,
27165 - name: "Ceiva kernel partition",
27166 - size: (KERNEL_PARTITION_SIZE_KiB)*1024,
27168 + .name = "Ceiva kernel partition",
27169 + .size = (KERNEL_PARTITION_SIZE_KiB)*1024,
27170 + .offset = 0x20000,
27173 - name: "Ceiva root filesystem partition",
27174 - offset: MTDPART_OFS_APPEND,
27175 - size: (ROOT_PARTITION_SIZE_KiB)*1024,
27176 + .name = "Ceiva root filesystem partition",
27177 + .offset = MTDPART_OFS_APPEND,
27178 + .size = (ROOT_PARTITION_SIZE_KiB)*1024,
27182 diff -Nru a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
27183 --- a/drivers/mtd/maps/pcmciamtd.c Wed Jun 25 03:30:03 2003
27184 +++ b/drivers/mtd/maps/pcmciamtd.c Sat Aug 23 08:27:27 2003
27185 @@ -344,9 +344,8 @@
27186 * still open, this will be postponed until it is closed.
27189 -static void pcmciamtd_release(u_long arg)
27190 +static void pcmciamtd_release(dev_link_t *link)
27192 - dev_link_t *link = (dev_link_t *)arg;
27193 struct pcmciamtd_dev *dev = link->priv;
27195 DEBUG(3, "link = 0x%p", link);
27196 @@ -564,7 +563,7 @@
27198 if(!dev->win_size) {
27199 err("Cant allocate memory window");
27200 - pcmciamtd_release((u_long)link);
27201 + pcmciamtd_release(link);
27204 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
27205 @@ -576,7 +575,7 @@
27206 dev->win_base = ioremap(req.Base, req.Size);
27207 if(!dev->win_base) {
27208 err("ioremap(%lu, %u) failed", req.Base, req.Size);
27209 - pcmciamtd_release((u_long)link);
27210 + pcmciamtd_release(link);
27213 DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x",
27214 @@ -631,7 +630,7 @@
27217 DEBUG(1, "Cant find an MTD");
27218 - pcmciamtd_release((u_long)link);
27219 + pcmciamtd_release(link);
27223 @@ -671,7 +670,7 @@
27225 dev->mtd_info = NULL;
27226 err("Couldnt register MTD device");
27227 - pcmciamtd_release((u_long)link);
27228 + pcmciamtd_release(link);
27231 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
27232 @@ -683,7 +682,7 @@
27234 cs_error(link->handle, last_fn, last_ret);
27235 err("CS Error, exiting");
27236 - pcmciamtd_release((u_long)link);
27237 + pcmciamtd_release(link);
27241 @@ -710,7 +709,7 @@
27242 del_mtd_device(dev->mtd_info);
27243 info("mtd%d: Removed", dev->mtd_info->index);
27245 - mod_timer(&link->release, jiffies + HZ/20);
27246 + pcmciamtd_release(link);
27249 case CS_EVENT_CARD_INSERTION:
27250 @@ -751,10 +750,8 @@
27252 DEBUG(3, "link=0x%p", link);
27254 - del_timer(&link->release);
27256 if(link->state & DEV_CONFIG) {
27257 - pcmciamtd_release((u_long)link);
27258 + pcmciamtd_release(link);
27261 if (link->handle) {
27262 @@ -789,10 +786,6 @@
27263 memset(dev, 0, sizeof(*dev));
27267 - init_timer(&link->release);
27268 - link->release.function = &pcmciamtd_release;
27269 - link->release.data = (u_long)link;
27271 link->conf.Attributes = 0;
27272 link->conf.IntType = INT_MEMORY;
27273 diff -Nru a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
27274 --- a/drivers/mtd/mtdchar.c Wed May 28 08:01:05 2003
27275 +++ b/drivers/mtd/mtdchar.c Tue Aug 26 09:25:41 2003
27278 static int mtd_open(struct inode *inode, struct file *file)
27280 - int minor = minor(inode->i_rdev);
27281 + int minor = iminor(inode);
27282 int devnum = minor >> 1;
27283 struct mtd_info *mtd;
27285 diff -Nru a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c
27286 --- a/drivers/mtd/nand/autcpu12.c Mon Jun 23 05:34:08 2003
27287 +++ b/drivers/mtd/nand/autcpu12.c Sun Aug 31 16:14:08 2003
27288 @@ -73,39 +73,39 @@
27289 extern struct nand_oobinfo jffs2_oobinfo;
27291 static struct mtd_partition partition_info16k[] = {
27292 - { name: "AUTCPU12 flash partition 1",
27294 - size: 8 * SZ_1M },
27295 - { name: "AUTCPU12 flash partition 2",
27296 - offset: 8 * SZ_1M,
27297 - size: 8 * SZ_1M },
27298 + { .name = "AUTCPU12 flash partition 1",
27300 + .size = 8 * SZ_1M },
27301 + { .name = "AUTCPU12 flash partition 2",
27302 + .offset = 8 * SZ_1M,
27303 + .size = 8 * SZ_1M },
27306 static struct mtd_partition partition_info32k[] = {
27307 - { name: "AUTCPU12 flash partition 1",
27309 - size: 8 * SZ_1M },
27310 - { name: "AUTCPU12 flash partition 2",
27311 - offset: 8 * SZ_1M,
27312 - size: 24 * SZ_1M },
27313 + { .name = "AUTCPU12 flash partition 1",
27315 + .size = 8 * SZ_1M },
27316 + { .name = "AUTCPU12 flash partition 2",
27317 + .offset = 8 * SZ_1M,
27318 + .size = 24 * SZ_1M },
27321 static struct mtd_partition partition_info64k[] = {
27322 - { name: "AUTCPU12 flash partition 1",
27324 - size: 16 * SZ_1M },
27325 - { name: "AUTCPU12 flash partition 2",
27326 - offset: 16 * SZ_1M,
27327 - size: 48 * SZ_1M },
27328 + { .name = "AUTCPU12 flash partition 1",
27330 + .size = 16 * SZ_1M },
27331 + { .name = "AUTCPU12 flash partition 2",
27332 + .offset = 16 * SZ_1M,
27333 + .size = 48 * SZ_1M },
27336 static struct mtd_partition partition_info128k[] = {
27337 - { name: "AUTCPU12 flash partition 1",
27339 - size: 16 * SZ_1M },
27340 - { name: "AUTCPU12 flash partition 2",
27341 - offset: 16 * SZ_1M,
27342 - size: 112 * SZ_1M },
27343 + { .name = "AUTCPU12 flash partition 1",
27345 + .size = 16 * SZ_1M },
27346 + { .name = "AUTCPU12 flash partition 2",
27347 + .offset = 16 * SZ_1M,
27348 + .size = 112 * SZ_1M },
27351 #define NUM_PARTITIONS16K 2
27352 diff -Nru a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c
27353 --- a/drivers/mtd/nand/edb7312.c Wed May 28 08:01:25 2003
27354 +++ b/drivers/mtd/nand/edb7312.c Sun Aug 31 16:14:08 2003
27356 * Define static partitions for flash device
27358 static struct mtd_partition partition_info[] = {
27359 - { name: "EP7312 Nand Flash",
27361 - size: 8*1024*1024 }
27362 + { .name = "EP7312 Nand Flash",
27364 + .size = 8*1024*1024 }
27366 #define NUM_PARTITIONS 1
27368 diff -Nru a/drivers/net/3c501.c b/drivers/net/3c501.c
27369 --- a/drivers/net/3c501.c Sun Apr 20 22:41:08 2003
27370 +++ b/drivers/net/3c501.c Tue Aug 26 13:21:28 2003
27371 @@ -307,7 +307,7 @@
27372 dev->stop = &el1_close;
27373 dev->get_stats = &el1_get_stats;
27374 dev->set_multicast_list = &set_multicast_list;
27375 - dev->do_ioctl = netdev_ioctl;
27376 + dev->ethtool_ops = &netdev_ethtool_ops;
27379 * Setup the generic properties
27380 @@ -857,86 +857,31 @@
27385 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
27386 - * @dev: network interface on which out-of-band action is to be performed
27387 - * @useraddr: userspace address to which data is to be read and returned
27389 - * Process the various commands of the SIOCETHTOOL interface.
27392 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
27393 +static void netdev_get_drvinfo(struct net_device *dev,
27394 + struct ethtool_drvinfo *info)
27398 - /* dev_ioctl() in ../../net/core/dev.c has already checked
27399 - capable(CAP_NET_ADMIN), so don't bother with that here. */
27401 - if (get_user(ethcmd, (u32 *)useraddr))
27404 - switch (ethcmd) {
27406 - case ETHTOOL_GDRVINFO: {
27407 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
27408 - strcpy (info.driver, DRV_NAME);
27409 - strcpy (info.version, DRV_VERSION);
27410 - sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
27411 - if (copy_to_user (useraddr, &info, sizeof (info)))
27416 - /* get message-level */
27417 - case ETHTOOL_GMSGLVL: {
27418 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
27419 - edata.data = debug;
27420 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
27424 - /* set message-level */
27425 - case ETHTOOL_SMSGLVL: {
27426 - struct ethtool_value edata;
27427 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
27429 - debug = edata.data;
27437 - return -EOPNOTSUPP;
27438 + strcpy(info->driver, DRV_NAME);
27439 + strcpy(info->version, DRV_VERSION);
27440 + sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
27444 - * netdev_ioctl: Handle network interface ioctls
27445 - * @dev: network interface on which out-of-band action is to be performed
27446 - * @rq: user request data
27447 - * @cmd: command issued by user
27449 - * Process the various out-of-band ioctls passed to this driver.
27451 +static u32 netdev_get_msglevel(struct net_device *dev)
27456 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
27457 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
27464 - case SIOCETHTOOL:
27465 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
27469 - rc = -EOPNOTSUPP;
27472 +static struct ethtool_ops netdev_ethtool_ops = {
27473 + .get_drvinfo = netdev_get_drvinfo,
27474 + .get_msglevel = netdev_get_msglevel,
27475 + .set_msglevel = netdev_set_msglevel,
27483 static struct net_device dev_3c501 = {
27484 diff -Nru a/drivers/net/3c501.h b/drivers/net/3c501.h
27485 --- a/drivers/net/3c501.h Sun Apr 20 22:41:08 2003
27486 +++ b/drivers/net/3c501.h Tue Aug 26 13:21:28 2003
27488 static int el1_close(struct net_device *dev);
27489 static struct net_device_stats *el1_get_stats(struct net_device *dev);
27490 static void set_multicast_list(struct net_device *dev);
27491 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
27492 +static struct ethtool_ops netdev_ethtool_ops;
27494 #define EL1_IO_EXTENT 16
27496 diff -Nru a/drivers/net/3c503.c b/drivers/net/3c503.c
27497 --- a/drivers/net/3c503.c Mon Feb 24 10:34:15 2003
27498 +++ b/drivers/net/3c503.c Tue Aug 26 13:29:32 2003
27501 static void el2_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
27503 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
27504 +static struct ethtool_ops netdev_ethtool_ops;
27507 /* This routine probes for a memory-mapped 3c503 board by looking for
27508 @@ -308,7 +308,7 @@
27510 dev->open = &el2_open;
27511 dev->stop = &el2_close;
27512 - dev->do_ioctl = &netdev_ioctl;
27513 + dev->ethtool_ops = &netdev_ethtool_ops;
27515 if (dev->mem_start)
27516 printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n",
27517 @@ -617,69 +617,18 @@
27522 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
27523 - * @dev: network interface on which out-of-band action is to be performed
27524 - * @useraddr: userspace address to which data is to be read and returned
27526 - * Process the various commands of the SIOCETHTOOL interface.
27529 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
27530 +static void netdev_get_drvinfo(struct net_device *dev,
27531 + struct ethtool_drvinfo *info)
27535 - /* dev_ioctl() in ../../net/core/dev.c has already checked
27536 - capable(CAP_NET_ADMIN), so don't bother with that here. */
27538 - if (get_user(ethcmd, (u32 *)useraddr))
27541 - switch (ethcmd) {
27543 - case ETHTOOL_GDRVINFO: {
27544 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
27545 - strcpy (info.driver, DRV_NAME);
27546 - strcpy (info.version, DRV_VERSION);
27547 - sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
27548 - if (copy_to_user (useraddr, &info, sizeof (info)))
27557 - return -EOPNOTSUPP;
27558 + strcpy(info->driver, DRV_NAME);
27559 + strcpy(info->version, DRV_VERSION);
27560 + sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
27564 - * netdev_ioctl: Handle network interface ioctls
27565 - * @dev: network interface on which out-of-band action is to be performed
27566 - * @rq: user request data
27567 - * @cmd: command issued by user
27569 - * Process the various out-of-band ioctls passed to this driver.
27572 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
27577 - case SIOCETHTOOL:
27578 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
27582 - rc = -EOPNOTSUPP;
27589 +static struct ethtool_ops netdev_ethtool_ops = {
27590 + .get_drvinfo = netdev_get_drvinfo,
27594 #define MAX_EL2_CARDS 4 /* Max number of EL2 cards per module */
27595 diff -Nru a/drivers/net/3c505.c b/drivers/net/3c505.c
27596 --- a/drivers/net/3c505.c Wed Jun 4 06:07:40 2003
27597 +++ b/drivers/net/3c505.c Tue Aug 26 13:29:32 2003
27598 @@ -1163,86 +1163,30 @@
27599 return &adapter->stats;
27603 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
27604 - * @dev: network interface on which out-of-band action is to be performed
27605 - * @useraddr: userspace address to which data is to be read and returned
27607 - * Process the various commands of the SIOCETHTOOL interface.
27610 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
27614 - /* dev_ioctl() in ../../net/core/dev.c has already checked
27615 - capable(CAP_NET_ADMIN), so don't bother with that here. */
27617 - if (get_user(ethcmd, (u32 *)useraddr))
27620 - switch (ethcmd) {
27622 - case ETHTOOL_GDRVINFO: {
27623 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
27624 - strcpy (info.driver, DRV_NAME);
27625 - strcpy (info.version, DRV_VERSION);
27626 - sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
27627 - if (copy_to_user (useraddr, &info, sizeof (info)))
27632 - /* get message-level */
27633 - case ETHTOOL_GMSGLVL: {
27634 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
27635 - edata.data = debug;
27636 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
27640 - /* set message-level */
27641 - case ETHTOOL_SMSGLVL: {
27642 - struct ethtool_value edata;
27643 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
27645 - debug = edata.data;
27653 - return -EOPNOTSUPP;
27654 +static void netdev_get_drvinfo(struct net_device *dev,
27655 + struct ethtool_drvinfo *info)
27657 + strcpy(info->driver, DRV_NAME);
27658 + strcpy(info->version, DRV_VERSION);
27659 + sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
27663 - * netdev_ioctl: Handle network interface ioctls
27664 - * @dev: network interface on which out-of-band action is to be performed
27665 - * @rq: user request data
27666 - * @cmd: command issued by user
27668 - * Process the various out-of-band ioctls passed to this driver.
27671 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
27676 - case SIOCETHTOOL:
27677 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
27681 - rc = -EOPNOTSUPP;
27684 +static u32 netdev_get_msglevel(struct net_device *dev)
27690 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
27696 +static struct ethtool_ops netdev_ethtool_ops = {
27697 + .get_drvinfo = netdev_get_drvinfo,
27698 + .get_msglevel = netdev_get_msglevel,
27699 + .set_msglevel = netdev_set_msglevel,
27702 /******************************************************
27704 @@ -1373,7 +1317,7 @@
27705 dev->tx_timeout = elp_timeout; /* local */
27706 dev->watchdog_timeo = 10*HZ;
27707 dev->set_multicast_list = elp_set_mc_list; /* local */
27708 - dev->do_ioctl = netdev_ioctl; /* local */
27709 + dev->ethtool_ops = &netdev_ethtool_ops; /* local */
27711 /* Setup the generic properties */
27713 diff -Nru a/drivers/net/3c507.c b/drivers/net/3c507.c
27714 --- a/drivers/net/3c507.c Sun Apr 20 22:41:08 2003
27715 +++ b/drivers/net/3c507.c Tue Aug 26 13:29:32 2003
27716 @@ -299,7 +299,7 @@
27718 static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad);
27719 static void init_82586_mem(struct net_device *dev);
27720 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
27721 +static struct ethtool_ops netdev_ethtool_ops;
27724 /* Check for a network adaptor of this type, and return '0' iff one exists.
27725 @@ -431,7 +431,7 @@
27726 dev->get_stats = el16_get_stats;
27727 dev->tx_timeout = el16_tx_timeout;
27728 dev->watchdog_timeo = TX_TIMEOUT;
27729 - dev->do_ioctl = netdev_ioctl;
27730 + dev->ethtool_ops = &netdev_ethtool_ops;
27732 ether_setup(dev); /* Generic ethernet behaviour */
27734 @@ -874,86 +874,29 @@
27735 lp->rx_tail = rx_tail;
27739 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
27740 - * @dev: network interface on which out-of-band action is to be performed
27741 - * @useraddr: userspace address to which data is to be read and returned
27743 - * Process the various commands of the SIOCETHTOOL interface.
27746 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
27750 - /* dev_ioctl() in ../../net/core/dev.c has already checked
27751 - capable(CAP_NET_ADMIN), so don't bother with that here. */
27753 - if (get_user(ethcmd, (u32 *)useraddr))
27756 - switch (ethcmd) {
27758 - case ETHTOOL_GDRVINFO: {
27759 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
27760 - strcpy (info.driver, DRV_NAME);
27761 - strcpy (info.version, DRV_VERSION);
27762 - sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
27763 - if (copy_to_user (useraddr, &info, sizeof (info)))
27768 - /* get message-level */
27769 - case ETHTOOL_GMSGLVL: {
27770 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
27771 - edata.data = debug;
27772 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
27776 - /* set message-level */
27777 - case ETHTOOL_SMSGLVL: {
27778 - struct ethtool_value edata;
27779 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
27781 - debug = edata.data;
27789 - return -EOPNOTSUPP;
27790 +static void netdev_get_drvinfo(struct net_device *dev,
27791 + struct ethtool_drvinfo *info)
27793 + strcpy(info->driver, DRV_NAME);
27794 + strcpy(info->version, DRV_VERSION);
27795 + sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
27799 - * netdev_ioctl: Handle network interface ioctls
27800 - * @dev: network interface on which out-of-band action is to be performed
27801 - * @rq: user request data
27802 - * @cmd: command issued by user
27804 - * Process the various out-of-band ioctls passed to this driver.
27807 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
27808 +static u32 netdev_get_msglevel(struct net_device *dev)
27813 - case SIOCETHTOOL:
27814 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
27818 - rc = -EOPNOTSUPP;
27825 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
27831 +static struct ethtool_ops netdev_ethtool_ops = {
27832 + .get_drvinfo = netdev_get_drvinfo,
27833 + .get_msglevel = netdev_get_msglevel,
27834 + .set_msglevel = netdev_set_msglevel,
27838 static struct net_device dev_3c507;
27839 diff -Nru a/drivers/net/3c509.c b/drivers/net/3c509.c
27840 --- a/drivers/net/3c509.c Tue Aug 19 20:53:14 2003
27841 +++ b/drivers/net/3c509.c Sun Aug 31 22:52:48 2003
27842 @@ -300,10 +300,11 @@
27844 * Both call el3_common_init/el3_common_remove. */
27846 -static void __init el3_common_init(struct net_device *dev)
27847 +static int __init el3_common_init(struct net_device *dev)
27849 struct el3_private *lp = dev->priv;
27853 spin_lock_init(&lp->lock);
27855 @@ -314,10 +315,29 @@
27856 dev->if_port |= (dev->mem_start & 0x08);
27859 + /* The EL3-specific entries in the device structure. */
27860 + dev->open = &el3_open;
27861 + dev->hard_start_xmit = &el3_start_xmit;
27862 + dev->stop = &el3_close;
27863 + dev->get_stats = &el3_get_stats;
27864 + dev->set_multicast_list = &set_multicast_list;
27865 + dev->tx_timeout = el3_tx_timeout;
27866 + dev->watchdog_timeo = TX_TIMEOUT;
27867 + dev->do_ioctl = netdev_ioctl;
27869 + err = register_netdev(dev);
27871 + printk(KERN_ERR "Failed to register 3c5x9 at %#3.3lx, IRQ %d.\n",
27872 + dev->base_addr, dev->irq);
27873 + release_region(dev->base_addr, EL3_IO_EXTENT);
27878 const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
27879 - printk("%s: 3c5x9 at %#3.3lx, %s port, address ",
27880 - dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)]);
27881 + printk("%s: 3c5x9 found at %#3.3lx, %s port, address ",
27882 + dev->name, dev->base_addr,
27883 + if_names[(dev->if_port & 0x03)]);
27886 /* Read in the station address. */
27887 @@ -327,16 +347,8 @@
27890 printk(KERN_INFO "%s" KERN_INFO "%s", versionA, versionB);
27893 - /* The EL3-specific entries in the device structure. */
27894 - dev->open = &el3_open;
27895 - dev->hard_start_xmit = &el3_start_xmit;
27896 - dev->stop = &el3_close;
27897 - dev->get_stats = &el3_get_stats;
27898 - dev->set_multicast_list = &set_multicast_list;
27899 - dev->tx_timeout = el3_tx_timeout;
27900 - dev->watchdog_timeo = TX_TIMEOUT;
27901 - dev->do_ioctl = netdev_ioctl;
27904 static void el3_common_remove (struct net_device *dev)
27905 @@ -564,9 +576,8 @@
27906 #if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
27907 lp->dev = &idev->dev;
27909 - el3_common_init(dev);
27910 + err = el3_common_init(dev);
27912 - err = register_netdev(dev);
27916 @@ -588,7 +599,6 @@
27920 - release_region(ioaddr, EL3_IO_EXTENT);
27921 #if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
27923 pnp_device_detach(idev);
27924 @@ -629,8 +639,8 @@
27925 el3_mca_adapter_names[mdev->index], slot + 1);
27927 /* claim the slot */
27928 - strncpy(device->name, el3_mca_adapter_names[mdev->index],
27929 - sizeof(device->name));
27930 + strncpy(mdev->name, el3_mca_adapter_names[mdev->index],
27931 + sizeof(mdev->name));
27932 mca_device_set_claim(mdev, 1);
27934 if_port = pos4 & 0x03;
27935 @@ -662,11 +672,9 @@
27937 lp->type = EL3_MCA;
27938 device->driver_data = dev;
27939 - el3_common_init(dev);
27940 + err = el3_common_init(dev);
27942 - err = register_netdev(dev);
27944 - release_region(ioaddr, EL3_IO_EXTENT);
27948 @@ -723,11 +731,9 @@
27950 lp->type = EL3_EISA;
27951 eisa_set_drvdata (edev, dev);
27952 - el3_common_init(dev);
27953 + err = el3_common_init(dev);
27955 - err = register_netdev(dev);
27957 - release_region(ioaddr, EL3_IO_EXTENT);
27961 diff -Nru a/drivers/net/3c515.c b/drivers/net/3c515.c
27962 --- a/drivers/net/3c515.c Tue Aug 19 20:53:14 2003
27963 +++ b/drivers/net/3c515.c Tue Aug 26 13:42:22 2003
27964 @@ -392,7 +392,7 @@
27965 static void update_stats(int addr, struct net_device *dev);
27966 static struct net_device_stats *corkscrew_get_stats(struct net_device *dev);
27967 static void set_rx_mode(struct net_device *dev);
27968 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
27969 +static struct ethtool_ops netdev_ethtool_ops;
27973 @@ -718,7 +718,7 @@
27974 dev->stop = &corkscrew_close;
27975 dev->get_stats = &corkscrew_get_stats;
27976 dev->set_multicast_list = &set_rx_mode;
27977 - dev->do_ioctl = netdev_ioctl;
27978 + dev->ethtool_ops = &netdev_ethtool_ops;
27982 @@ -1580,86 +1580,30 @@
27983 outw(new_mode, ioaddr + EL3_CMD);
27987 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
27988 - * @dev: network interface on which out-of-band action is to be performed
27989 - * @useraddr: userspace address to which data is to be read and returned
27991 - * Process the various commands of the SIOCETHTOOL interface.
27994 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
27995 +static void netdev_get_drvinfo(struct net_device *dev,
27996 + struct ethtool_drvinfo *info)
28000 - /* dev_ioctl() in ../../net/core/dev.c has already checked
28001 - capable(CAP_NET_ADMIN), so don't bother with that here. */
28003 - if (get_user(ethcmd, (u32 *)useraddr))
28006 - switch (ethcmd) {
28008 - case ETHTOOL_GDRVINFO: {
28009 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
28010 - strcpy (info.driver, DRV_NAME);
28011 - strcpy (info.version, DRV_VERSION);
28012 - sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
28013 - if (copy_to_user (useraddr, &info, sizeof (info)))
28018 - /* get message-level */
28019 - case ETHTOOL_GMSGLVL: {
28020 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
28021 - edata.data = corkscrew_debug;
28022 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
28026 - /* set message-level */
28027 - case ETHTOOL_SMSGLVL: {
28028 - struct ethtool_value edata;
28029 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
28031 - corkscrew_debug = edata.data;
28039 - return -EOPNOTSUPP;
28040 + strcpy(info->driver, DRV_NAME);
28041 + strcpy(info->version, DRV_VERSION);
28042 + sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
28046 - * netdev_ioctl: Handle network interface ioctls
28047 - * @dev: network interface on which out-of-band action is to be performed
28048 - * @rq: user request data
28049 - * @cmd: command issued by user
28051 - * Process the various out-of-band ioctls passed to this driver.
28054 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
28055 +static u32 netdev_get_msglevel(struct net_device *dev)
28062 - case SIOCETHTOOL:
28063 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
28065 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
28071 - rc = -EOPNOTSUPP;
28074 +static struct ethtool_ops netdev_ethtool_ops = {
28075 + .get_drvinfo = netdev_get_drvinfo,
28076 + .get_msglevel = netdev_get_msglevel,
28077 + .set_msglevel = netdev_set_msglevel,
28085 void cleanup_module(void)
28086 diff -Nru a/drivers/net/3c523.c b/drivers/net/3c523.c
28087 --- a/drivers/net/3c523.c Sun Apr 27 20:36:18 2003
28088 +++ b/drivers/net/3c523.c Tue Aug 26 13:42:22 2003
28089 @@ -188,7 +188,7 @@
28090 #ifdef ELMC_MULTICAST
28091 static void set_multicast_list(struct net_device *dev);
28093 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
28094 +static struct ethtool_ops netdev_ethtool_ops;
28096 /* helper-functions */
28097 static int init586(struct net_device *dev);
28098 @@ -571,7 +571,7 @@
28100 dev->set_multicast_list = NULL;
28102 - dev->do_ioctl = netdev_ioctl;
28103 + dev->ethtool_ops = &netdev_ethtool_ops;
28107 @@ -1228,70 +1228,17 @@
28112 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
28113 - * @dev: network interface on which out-of-band action is to be performed
28114 - * @useraddr: userspace address to which data is to be read and returned
28116 - * Process the various commands of the SIOCETHTOOL interface.
28119 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
28120 +static void netdev_get_drvinfo(struct net_device *dev,
28121 + struct ethtool_drvinfo *info)
28125 - /* dev_ioctl() in ../../net/core/dev.c has already checked
28126 - capable(CAP_NET_ADMIN), so don't bother with that here. */
28128 - if (get_user(ethcmd, (u32 *)useraddr))
28131 - switch (ethcmd) {
28133 - case ETHTOOL_GDRVINFO: {
28134 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
28135 - strcpy (info.driver, DRV_NAME);
28136 - strcpy (info.version, DRV_VERSION);
28137 - sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
28138 - if (copy_to_user (useraddr, &info, sizeof (info)))
28147 - return -EOPNOTSUPP;
28148 + strcpy(info->driver, DRV_NAME);
28149 + strcpy(info->version, DRV_VERSION);
28150 + sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
28154 - * netdev_ioctl: Handle network interface ioctls
28155 - * @dev: network interface on which out-of-band action is to be performed
28156 - * @rq: user request data
28157 - * @cmd: command issued by user
28159 - * Process the various out-of-band ioctls passed to this driver.
28162 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
28167 - case SIOCETHTOOL:
28168 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
28172 - rc = -EOPNOTSUPP;
28179 -/*************************************************************************/
28180 +static struct ethtool_ops netdev_ethtool_ops = {
28181 + .get_drvinfo = netdev_get_drvinfo,
28186 diff -Nru a/drivers/net/3c527.c b/drivers/net/3c527.c
28187 --- a/drivers/net/3c527.c Sun Apr 27 20:36:18 2003
28188 +++ b/drivers/net/3c527.c Sun Aug 31 06:34:16 2003
28189 @@ -218,7 +218,7 @@
28190 static struct net_device_stats *mc32_get_stats(struct net_device *dev);
28191 static void mc32_set_multicast_list(struct net_device *dev);
28192 static void mc32_reset_multicast_list(struct net_device *dev);
28193 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
28194 +static struct ethtool_ops netdev_ethtool_ops;
28197 * mc32_probe - Search for supported boards
28198 @@ -508,7 +508,7 @@
28199 dev->set_multicast_list = mc32_set_multicast_list;
28200 dev->tx_timeout = mc32_timeout;
28201 dev->watchdog_timeo = HZ*5; /* Board does all the work */
28202 - dev->do_ioctl = netdev_ioctl;
28203 + dev->ethtool_ops = &netdev_ethtool_ops;
28205 lp->xceiver_state = HALTED;
28207 @@ -1081,14 +1081,15 @@
28208 /* NP is the buffer we will be loading */
28209 np=lp->tx_ring[lp->tx_ring_head].p;
28211 - /* We will need this to flush the buffer out */
28212 - lp->tx_ring[lp->tx_ring_head].skb=skb;
28214 if (skb->len < ETH_ZLEN) {
28215 skb = skb_padto(skb, ETH_ZLEN);
28220 + /* We will need this to flush the buffer out */
28221 + lp->tx_ring[lp->tx_ring_head].skb = skb;
28223 np->length = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
28225 np->data = isa_virt_to_bus(skb->data);
28226 @@ -1655,86 +1656,30 @@
28227 do_mc32_set_multicast_list(dev,1);
28231 - * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
28232 - * @dev: network interface on which out-of-band action is to be performed
28233 - * @useraddr: userspace address to which data is to be read and returned
28235 - * Process the various commands of the SIOCETHTOOL interface.
28238 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
28239 +static void netdev_get_drvinfo(struct net_device *dev,
28240 + struct ethtool_drvinfo *info)
28244 - /* dev_ioctl() in ../../net/core/dev.c has already checked
28245 - capable(CAP_NET_ADMIN), so don't bother with that here. */
28247 - if (get_user(ethcmd, (u32 *)useraddr))
28250 - switch (ethcmd) {
28252 - case ETHTOOL_GDRVINFO: {
28253 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
28254 - strcpy (info.driver, DRV_NAME);
28255 - strcpy (info.version, DRV_VERSION);
28256 - sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
28257 - if (copy_to_user (useraddr, &info, sizeof (info)))
28262 - /* get message-level */
28263 - case ETHTOOL_GMSGLVL: {
28264 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
28265 - edata.data = mc32_debug;
28266 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
28270 - /* set message-level */
28271 - case ETHTOOL_SMSGLVL: {
28272 - struct ethtool_value edata;
28273 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
28275 - mc32_debug = edata.data;
28283 - return -EOPNOTSUPP;
28284 + strcpy(info->driver, DRV_NAME);
28285 + strcpy(info->version, DRV_VERSION);
28286 + sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
28290 - * netdev_ioctl: Handle network interface ioctls
28291 - * @dev: network interface on which out-of-band action is to be performed
28292 - * @rq: user request data
28293 - * @cmd: command issued by user
28295 - * Process the various out-of-band ioctls passed to this driver.
28297 +static u32 netdev_get_msglevel(struct net_device *dev)
28299 + return mc32_debug;
28302 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
28303 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
28306 + mc32_debug = level;
28310 - case SIOCETHTOOL:
28311 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
28313 +static struct ethtool_ops netdev_ethtool_ops = {
28314 + .get_drvinfo = netdev_get_drvinfo,
28315 + .get_msglevel = netdev_get_msglevel,
28316 + .set_msglevel = netdev_set_msglevel,
28320 - rc = -EOPNOTSUPP;
28329 static struct net_device this_device;
28330 diff -Nru a/drivers/net/3c59x.c b/drivers/net/3c59x.c
28331 --- a/drivers/net/3c59x.c Tue Aug 19 20:53:15 2003
28332 +++ b/drivers/net/3c59x.c Tue Aug 26 11:23:22 2003
28333 @@ -900,6 +900,7 @@
28334 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
28335 static void vortex_tx_timeout(struct net_device *dev);
28336 static void acpi_set_WOL(struct net_device *dev);
28337 +static struct ethtool_ops vortex_ethtool_ops;
28339 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
28340 /* Option count limit only -- unlimited interfaces are supported. */
28341 @@ -1445,6 +1446,7 @@
28342 dev->stop = vortex_close;
28343 dev->get_stats = vortex_get_stats;
28344 dev->do_ioctl = vortex_ioctl;
28345 + dev->ethtool_ops = &vortex_ethtool_ops;
28346 dev->set_multicast_list = set_rx_mode;
28347 dev->tx_timeout = vortex_tx_timeout;
28348 dev->watchdog_timeo = (watchdog * HZ) / 1000;
28349 @@ -2816,38 +2818,28 @@
28353 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
28354 +static void vortex_get_drvinfo(struct net_device *dev,
28355 + struct ethtool_drvinfo *info)
28357 struct vortex_private *vp = dev->priv;
28360 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
28363 - switch (ethcmd) {
28364 - case ETHTOOL_GDRVINFO: {
28365 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
28366 - strcpy(info.driver, DRV_NAME);
28367 - strcpy(info.version, DRV_VERSION);
28368 - if (VORTEX_PCI(vp))
28369 - strcpy(info.bus_info, pci_name(VORTEX_PCI(vp)));
28371 - if (VORTEX_EISA(vp))
28372 - sprintf (info.bus_info, vp->gendev->bus_id);
28374 - sprintf(info.bus_info, "EISA 0x%lx %d",
28375 - dev->base_addr, dev->irq);
28377 - if (copy_to_user(useraddr, &info, sizeof(info)))
28380 + strcpy(info->driver, DRV_NAME);
28381 + strcpy(info->version, DRV_VERSION);
28382 + if (VORTEX_PCI(vp)) {
28383 + strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
28385 + if (VORTEX_EISA(vp))
28386 + sprintf(info->bus_info, vp->gendev->bus_id);
28388 + sprintf(info->bus_info, "EISA 0x%lx %d",
28389 + dev->base_addr, dev->irq);
28394 - return -EOPNOTSUPP;
28397 +static struct ethtool_ops vortex_ethtool_ops = {
28398 + .get_drvinfo = vortex_get_drvinfo,
28401 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
28403 struct vortex_private *vp = (struct vortex_private *)dev->priv;
28404 @@ -2857,9 +2849,6 @@
28408 - case SIOCETHTOOL:
28409 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
28411 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
28412 data->phy_id = phy;
28414 diff -Nru a/drivers/net/8139cp.c b/drivers/net/8139cp.c
28415 --- a/drivers/net/8139cp.c Tue Aug 19 20:13:55 2003
28416 +++ b/drivers/net/8139cp.c Mon Sep 1 17:25:54 2003
28417 @@ -24,15 +24,13 @@
28418 PCI suspend/resume - Felipe Damasio <felipewd@terra.com.br>
28419 LinkChg interrupt - Felipe Damasio <felipewd@terra.com.br>
28421 - TODO, in rough priority order:
28423 * Test Tx checksumming thoroughly
28424 - * dev->tx_timeout
28425 - * Constants (module parms?) for Rx work limit
28426 + * Implement dev->tx_timeout
28428 + Low priority TODO:
28429 * Complete reset on PciErr
28430 * Consider Rx interrupt mitigation using TimerIntr
28431 - * Implement 8139C+ statistics dump; maybe not...
28432 - h/w stats can be reset only by software reset
28433 - * Handle netif_rx return value
28434 * Investigate using skb->priority with h/w VLAN priority
28435 * Investigate using High Priority Tx Queue with skb->priority
28436 * Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error
28437 @@ -41,14 +39,17 @@
28439 * The real minimum of CP_MIN_MTU is 4 bytes. However,
28440 for this to be supported, one must(?) turn on packet padding.
28441 - * Support 8169 GMII
28442 - * Support external MII transceivers
28443 + * Support external MII transceivers (patch available)
28446 + * TX checksumming is considered experimental. It is off by
28447 + default, use ethtool to turn it on.
28451 #define DRV_NAME "8139cp"
28452 -#define DRV_VERSION "0.3.0"
28453 -#define DRV_RELDATE "Sep 29, 2002"
28454 +#define DRV_VERSION "1.1"
28455 +#define DRV_RELDATE "Aug 30, 2003"
28458 #include <linux/config.h>
28460 #include <asm/io.h>
28461 #include <asm/uaccess.h>
28463 -/* experimental TX checksumming feature enable/disable */
28464 -#undef CP_TX_CHECKSUM
28466 /* VLAN tagging feature enable/disable */
28467 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
28468 #define CP_VLAN_TAG_USED 1
28472 /* These identify the driver base version and may not be removed. */
28473 -static char version[] __devinitdata =
28474 +static char version[] =
28475 KERN_INFO DRV_NAME ": 10/100 PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")\n";
28477 MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
28478 @@ -160,6 +158,7 @@
28479 TxConfig = 0x40, /* Tx configuration */
28480 ChipVersion = 0x43, /* 8-bit chip version, inside TxConfig */
28481 RxConfig = 0x44, /* Rx configuration */
28482 + RxMissed = 0x4C, /* 24 bits valid, write clears */
28483 Cfg9346 = 0x50, /* EEPROM select/control; Cfg reg [un]lock */
28484 Config1 = 0x52, /* Config1 */
28485 Config3 = 0x59, /* Config3 */
28486 @@ -292,12 +291,11 @@
28487 UWF = (1 << 4), /* Accept Unicast wakeup frame */
28488 LANWake = (1 << 1), /* Enable LANWake signal */
28489 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
28492 -static const unsigned int cp_intr_mask =
28493 - PciErr | LinkChg |
28494 - RxOK | RxErr | RxEmpty | RxFIFOOvr |
28495 - TxOK | TxErr | TxEmpty;
28496 + cp_norx_intr_mask = PciErr | LinkChg | TxOK | TxErr | TxEmpty,
28497 + cp_rx_intr_mask = RxOK | RxErr | RxEmpty | RxFIFOOvr,
28498 + cp_intr_mask = cp_rx_intr_mask | cp_norx_intr_mask,
28501 static const unsigned int cp_rx_config =
28502 (RX_FIFO_THRESH << RxCfgFIFOShift) |
28503 @@ -364,11 +362,7 @@
28505 struct pci_dev *pdev;
28508 - struct sk_buff *frag_skb;
28509 - unsigned dropping_frag : 1;
28510 - unsigned pci_using_dac : 1;
28511 - unsigned int board_type;
28514 unsigned int wol_enabled : 1; /* Is Wake-on-LAN enabled? */
28515 u32 power_state[16];
28516 @@ -400,28 +394,9 @@
28517 static void cp_tx (struct cp_private *cp);
28518 static void cp_clean_rings (struct cp_private *cp);
28525 -static struct cp_board_info {
28526 - const char *name;
28527 -} cp_board_tbl[] __devinitdata = {
28529 - { "RTL-8139C+" },
28535 static struct pci_device_id cp_pci_tbl[] = {
28536 { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
28537 - PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139Cp },
28539 - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8169,
28540 - PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8169 },
28542 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, },
28545 MODULE_DEVICE_TABLE(pci, cp_pci_tbl);
28546 @@ -446,6 +421,31 @@
28550 +#if CP_VLAN_TAG_USED
28551 +static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
28553 + struct cp_private *cp = dev->priv;
28555 + spin_lock_irq(&cp->lock);
28557 + cp->cpcmd |= RxVlanOn;
28558 + cpw16(CpCmd, cp->cpcmd);
28559 + spin_unlock_irq(&cp->lock);
28562 +static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
28564 + struct cp_private *cp = dev->priv;
28566 + spin_lock_irq(&cp->lock);
28567 + cp->cpcmd &= ~RxVlanOn;
28568 + cpw16(CpCmd, cp->cpcmd);
28570 + cp->vlgrp->vlan_devices[vid] = NULL;
28571 + spin_unlock_irq(&cp->lock);
28573 +#endif /* CP_VLAN_TAG_USED */
28575 static inline void cp_set_rxbufsize (struct cp_private *cp)
28577 unsigned int mtu = cp->dev->mtu;
28578 @@ -468,10 +468,11 @@
28580 #if CP_VLAN_TAG_USED
28581 if (cp->vlgrp && (desc->opts2 & RxVlanTagged)) {
28582 - vlan_hwaccel_rx(skb, cp->vlgrp, be16_to_cpu(desc->opts2 & 0xffff));
28583 + vlan_hwaccel_receive_skb(skb, cp->vlgrp,
28584 + be16_to_cpu(desc->opts2 & 0xffff));
28588 + netif_receive_skb(skb);
28591 static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
28592 @@ -486,81 +487,14 @@
28593 cp->net_stats.rx_frame_errors++;
28594 if (status & RxErrCRC)
28595 cp->net_stats.rx_crc_errors++;
28596 - if (status & RxErrRunt)
28597 + if ((status & RxErrRunt) || (status & RxErrLong))
28598 cp->net_stats.rx_length_errors++;
28599 - if (status & RxErrLong)
28600 + if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag))
28601 cp->net_stats.rx_length_errors++;
28602 if (status & RxErrFIFO)
28603 cp->net_stats.rx_fifo_errors++;
28606 -static void cp_rx_frag (struct cp_private *cp, unsigned rx_tail,
28607 - struct sk_buff *skb, u32 status, u32 len)
28609 - struct sk_buff *copy_skb, *frag_skb = cp->frag_skb;
28610 - unsigned orig_len = frag_skb ? frag_skb->len : 0;
28611 - unsigned target_len = orig_len + len;
28612 - unsigned first_frag = status & FirstFrag;
28613 - unsigned last_frag = status & LastFrag;
28615 - if (netif_msg_rx_status (cp))
28616 - printk (KERN_DEBUG "%s: rx %s%sfrag, slot %d status 0x%x len %d\n",
28618 - cp->dropping_frag ? "dropping " : "",
28619 - first_frag ? "first " :
28620 - last_frag ? "last " : "",
28621 - rx_tail, status, len);
28623 - cp->cp_stats.rx_frags++;
28625 - if (!frag_skb && !first_frag)
28626 - cp->dropping_frag = 1;
28627 - if (cp->dropping_frag)
28630 - copy_skb = dev_alloc_skb (target_len + RX_OFFSET);
28632 - printk(KERN_WARNING "%s: rx slot %d alloc failed\n",
28633 - cp->dev->name, rx_tail);
28635 - cp->dropping_frag = 1;
28638 - dev_kfree_skb_irq(frag_skb);
28639 - cp->frag_skb = NULL;
28642 - cp->net_stats.rx_dropped++;
28643 - cp->dropping_frag = 0;
28648 - copy_skb->dev = cp->dev;
28649 - skb_reserve(copy_skb, RX_OFFSET);
28650 - skb_put(copy_skb, target_len);
28652 - memcpy(copy_skb->data, frag_skb->data, orig_len);
28653 - dev_kfree_skb_irq(frag_skb);
28655 - pci_dma_sync_single(cp->pdev, cp->rx_skb[rx_tail].mapping,
28656 - len, PCI_DMA_FROMDEVICE);
28657 - memcpy(copy_skb->data + orig_len, skb->data, len);
28659 - copy_skb->ip_summed = CHECKSUM_NONE;
28662 - if (status & (RxError | RxErrFIFO)) {
28663 - cp_rx_err_acct(cp, rx_tail, status, len);
28664 - dev_kfree_skb_irq(copy_skb);
28666 - cp_rx_skb(cp, copy_skb, &cp->rx_ring[rx_tail]);
28667 - cp->frag_skb = NULL;
28669 - cp->frag_skb = copy_skb;
28673 static inline unsigned int cp_rx_csum_ok (u32 status)
28675 unsigned int protocol = (status >> 16) & 0x3;
28676 @@ -574,12 +508,18 @@
28680 -static void cp_rx (struct cp_private *cp)
28681 +static int cp_rx_poll (struct net_device *dev, int *budget)
28683 + struct cp_private *cp = dev->priv;
28684 unsigned rx_tail = cp->rx_tail;
28685 - unsigned rx_work = 100;
28686 + unsigned rx_work = dev->quota;
28691 + cpw16(IntrStatus, cp_rx_intr_mask);
28693 - while (rx_work--) {
28696 dma_addr_t mapping;
28697 struct sk_buff *skb, *new_skb;
28698 @@ -599,7 +539,14 @@
28699 mapping = cp->rx_skb[rx_tail].mapping;
28701 if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag)) {
28702 - cp_rx_frag(cp, rx_tail, skb, status, len);
28703 + /* we don't support incoming fragmented frames.
28704 + * instead, we attempt to ensure that the
28705 + * pre-allocated RX skbs are properly sized such
28706 + * that RX fragments are never encountered
28708 + cp_rx_err_acct(cp, rx_tail, status, len);
28709 + cp->net_stats.rx_dropped++;
28710 + cp->cp_stats.rx_frags++;
28714 @@ -640,6 +587,7 @@
28715 cp->rx_skb[rx_tail].skb = new_skb;
28717 cp_rx_skb(cp, skb, desc);
28721 cp->rx_ring[rx_tail].opts2 = 0;
28722 @@ -650,12 +598,30 @@
28724 desc->opts1 = cpu_to_le32(DescOwn | cp->rx_buf_sz);
28725 rx_tail = NEXT_RX(rx_tail);
28729 - printk(KERN_WARNING "%s: rx work limit reached\n", cp->dev->name);
28734 cp->rx_tail = rx_tail;
28736 + dev->quota -= rx;
28739 + /* if we did not reach work limit, then we're done with
28740 + * this round of polling
28743 + if (cpr16(IntrStatus) & cp_rx_intr_mask)
28744 + goto rx_status_loop;
28746 + cpw16_f(IntrMask, cp_intr_mask);
28747 + netif_rx_complete(dev);
28749 + return 0; /* done */
28752 + return 1; /* not done */
28756 @@ -673,12 +639,16 @@
28757 printk(KERN_DEBUG "%s: intr, status %04x cmd %02x cpcmd %04x\n",
28758 dev->name, status, cpr8(Cmd), cpr16(CpCmd));
28760 - cpw16_f(IntrStatus, status);
28761 + cpw16(IntrStatus, status & ~cp_rx_intr_mask);
28763 spin_lock(&cp->lock);
28765 - if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
28767 + if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr)) {
28768 + if (netif_rx_schedule_prep(dev)) {
28769 + cpw16_f(IntrMask, cp_norx_intr_mask);
28770 + __netif_rx_schedule(dev);
28773 if (status & (TxOK | TxErr | TxEmpty | SWInt))
28775 if (status & LinkChg)
28776 @@ -691,6 +661,8 @@
28777 pci_write_config_word(cp->pdev, PCI_STATUS, pci_status);
28778 printk(KERN_ERR "%s: PCI bus error, status=%04x, PCI status=%04x\n",
28779 dev->name, status, pci_status);
28781 + /* TODO: reset hardware */
28784 spin_unlock(&cp->lock);
28785 @@ -750,7 +722,7 @@
28787 cp->tx_tail = tx_tail;
28789 - if (netif_queue_stopped(cp->dev) && (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1)))
28790 + if (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1))
28791 netif_wake_queue(cp->dev);
28794 @@ -792,7 +764,6 @@
28795 txd->addr = cpu_to_le64(mapping);
28798 -#ifdef CP_TX_CHECKSUM
28799 if (skb->ip_summed == CHECKSUM_HW) {
28800 const struct iphdr *ip = skb->nh.iph;
28801 if (ip->protocol == IPPROTO_TCP)
28802 @@ -806,7 +777,6 @@
28807 txd->opts1 = cpu_to_le32(eor | len | DescOwn |
28808 FirstFrag | LastFrag);
28810 @@ -820,9 +790,7 @@
28811 u32 first_len, first_eor;
28812 dma_addr_t first_mapping;
28813 int frag, first_entry = entry;
28814 -#ifdef CP_TX_CHECKSUM
28815 const struct iphdr *ip = skb->nh.iph;
28818 /* We must give this initial chunk to the device last.
28819 * Otherwise we could race with the device.
28820 @@ -848,7 +816,7 @@
28821 this_frag->page_offset),
28822 len, PCI_DMA_TODEVICE);
28823 eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
28824 -#ifdef CP_TX_CHECKSUM
28826 if (skb->ip_summed == CHECKSUM_HW) {
28827 ctrl = eor | len | DescOwn | IPCS;
28828 if (ip->protocol == IPPROTO_TCP)
28829 @@ -858,7 +826,6 @@
28834 ctrl = eor | len | DescOwn;
28836 if (frag == skb_shinfo(skb)->nr_frags - 1)
28837 @@ -883,7 +850,6 @@
28838 txd->addr = cpu_to_le64(first_mapping);
28841 -#ifdef CP_TX_CHECKSUM
28842 if (skb->ip_summed == CHECKSUM_HW) {
28843 if (ip->protocol == IPPROTO_TCP)
28844 txd->opts1 = cpu_to_le32(first_eor | first_len |
28845 @@ -896,7 +862,6 @@
28850 txd->opts1 = cpu_to_le32(first_eor | first_len |
28851 FirstFrag | DescOwn);
28853 @@ -975,7 +940,9 @@
28855 static void __cp_get_stats(struct cp_private *cp)
28857 - /* XXX implement */
28858 + /* only lower 24 bits valid; write any value to clear */
28859 + cp->net_stats.rx_missed_errors += (cpr32 (RxMissed) & 0xffffff);
28860 + cpw32 (RxMissed, 0);
28863 static struct net_device_stats *cp_get_stats(struct net_device *dev)
28864 @@ -995,11 +962,10 @@
28866 struct net_device *dev = cp->dev;
28868 - cpw16(IntrMask, 0);
28870 + cpw16(IntrStatus, ~(cpr16(IntrStatus)));
28871 + cpw16_f(IntrMask, 0);
28875 + cpw16_f(CpCmd, 0);
28876 cpw16(IntrStatus, ~(cpr16(IntrStatus)));
28877 synchronize_irq(dev->irq);
28879 @@ -1031,11 +997,7 @@
28881 static inline void cp_start_hw (struct cp_private *cp)
28883 - u16 pci_dac = cp->pci_using_dac ? PCIDAC : 0;
28884 - if (cp->board_type == RTL8169)
28885 - cpw16(CpCmd, pci_dac | PCIMulRW | RxChkSum);
28887 - cpw16(CpCmd, pci_dac | PCIMulRW | RxChkSum | CpRxOn | CpTxOn);
28888 + cpw16(CpCmd, cp->cpcmd);
28889 cpw8(Cmd, RxOn | TxOn);
28892 @@ -1059,13 +1021,10 @@
28894 cpw8(Config1, cpr8(Config1) | DriverLoaded | PMEnable);
28895 /* Disable Wake-on-LAN. Can be turned on with ETHTOOL_SWOL */
28896 - if (cp->board_type == RTL8139Cp) {
28897 - cpw8(Config3, PARMEnable);
28898 - cp->wol_enabled = 0;
28900 + cpw8(Config3, PARMEnable);
28901 + cp->wol_enabled = 0;
28903 cpw8(Config5, cpr8(Config5) & PMEStatus);
28904 - if (cp->board_type == RTL8169)
28905 - cpw16(RxMaxSize, cp->rx_buf_sz);
28907 cpw32_f(HiTxRingAddr, 0);
28908 cpw32_f(HiTxRingAddr + 4, 0);
28909 @@ -1258,8 +1217,6 @@
28911 dev->mtu = new_mtu;
28912 cp_set_rxbufsize(cp); /* set new rx buf size */
28913 - if (cp->board_type == RTL8169)
28914 - cpw16(RxMaxSize, cp->rx_buf_sz);
28916 rc = cp_init_rings(cp); /* realloc and restart h/w */
28918 @@ -1304,8 +1261,8 @@
28921 /* Set the ethtool Wake-on-LAN settings */
28922 -static void netdev_set_wol (struct cp_private *cp,
28923 - const struct ethtool_wolinfo *wol)
28924 +static int netdev_set_wol (struct cp_private *cp,
28925 + const struct ethtool_wolinfo *wol)
28929 @@ -1332,6 +1289,8 @@
28930 cpw8 (Config5, options);
28932 cp->wol_enabled = (wol->wolopts) ? 1 : 0;
28937 /* Get the ethtool Wake-on-LAN settings */
28938 @@ -1357,308 +1316,205 @@
28939 if (options & MWF) wol->wolopts |= WAKE_MCAST;
28942 -static int cp_ethtool_ioctl (struct cp_private *cp, void *useraddr)
28943 +static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
28946 + struct cp_private *cp = dev->priv;
28948 - /* dev_ioctl() in ../../net/core/dev.c has already checked
28949 - capable(CAP_NET_ADMIN), so don't bother with that here. */
28950 + strcpy (info->driver, DRV_NAME);
28951 + strcpy (info->version, DRV_VERSION);
28952 + strcpy (info->bus_info, pci_name(cp->pdev));
28955 - if (get_user(ethcmd, (u32 *)useraddr))
28958 - switch (ethcmd) {
28960 - case ETHTOOL_GDRVINFO: {
28961 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
28962 - strcpy (info.driver, DRV_NAME);
28963 - strcpy (info.version, DRV_VERSION);
28964 - strcpy (info.bus_info, pci_name(cp->pdev));
28965 - info.regdump_len = CP_REGS_SIZE;
28966 - info.n_stats = CP_NUM_STATS;
28967 - if (copy_to_user (useraddr, &info, sizeof (info)))
28971 +static int cp_get_regs_len(struct net_device *dev)
28973 + return CP_REGS_SIZE;
28976 - /* get settings */
28977 - case ETHTOOL_GSET: {
28978 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
28979 - spin_lock_irq(&cp->lock);
28980 - mii_ethtool_gset(&cp->mii_if, &ecmd);
28981 - spin_unlock_irq(&cp->lock);
28982 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
28986 - /* set settings */
28987 - case ETHTOOL_SSET: {
28989 - struct ethtool_cmd ecmd;
28990 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
28992 - spin_lock_irq(&cp->lock);
28993 - r = mii_ethtool_sset(&cp->mii_if, &ecmd);
28994 - spin_unlock_irq(&cp->lock);
28997 - /* restart autonegotiation */
28998 - case ETHTOOL_NWAY_RST: {
28999 - return mii_nway_restart(&cp->mii_if);
29001 - /* get link status */
29002 - case ETHTOOL_GLINK: {
29003 - struct ethtool_value edata = {ETHTOOL_GLINK};
29004 - edata.data = mii_link_ok(&cp->mii_if);
29005 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
29009 +static int cp_get_stats_count (struct net_device *dev)
29011 + return CP_NUM_STATS;
29014 - /* get message-level */
29015 - case ETHTOOL_GMSGLVL: {
29016 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
29017 - edata.data = cp->msg_enable;
29018 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
29022 - /* set message-level */
29023 - case ETHTOOL_SMSGLVL: {
29024 - struct ethtool_value edata;
29025 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
29027 - cp->msg_enable = edata.data;
29030 +static int cp_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
29032 + struct cp_private *cp = dev->priv;
29035 - /* NIC register dump */
29036 - case ETHTOOL_GREGS: {
29037 - struct ethtool_regs regs;
29038 - u8 *regbuf = kmalloc(CP_REGS_SIZE, GFP_KERNEL);
29043 - memset(regbuf, 0, CP_REGS_SIZE);
29044 + spin_lock_irq(&cp->lock);
29045 + rc = mii_ethtool_gset(&cp->mii_if, cmd);
29046 + spin_unlock_irq(&cp->lock);
29048 - rc = copy_from_user(®s, useraddr, sizeof(regs));
29051 - goto err_out_gregs;
29054 - if (regs.len > CP_REGS_SIZE)
29055 - regs.len = CP_REGS_SIZE;
29056 - if (regs.len < CP_REGS_SIZE) {
29058 - goto err_out_gregs;
29063 - regs.version = CP_REGS_VER;
29064 - rc = copy_to_user(useraddr, ®s, sizeof(regs));
29067 - goto err_out_gregs;
29069 +static int cp_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
29071 + struct cp_private *cp = dev->priv;
29074 - useraddr += offsetof(struct ethtool_regs, data);
29075 + spin_lock_irq(&cp->lock);
29076 + rc = mii_ethtool_sset(&cp->mii_if, cmd);
29077 + spin_unlock_irq(&cp->lock);
29079 - spin_lock_irq(&cp->lock);
29080 - memcpy_fromio(regbuf, cp->regs, CP_REGS_SIZE);
29081 - spin_unlock_irq(&cp->lock);
29085 - if (copy_to_user(useraddr, regbuf, regs.len))
29087 +static int cp_nway_reset(struct net_device *dev)
29089 + struct cp_private *cp = dev->priv;
29090 + return mii_nway_restart(&cp->mii_if);
29097 +static u32 cp_get_msglevel(struct net_device *dev)
29099 + struct cp_private *cp = dev->priv;
29100 + return cp->msg_enable;
29103 - /* get/set RX checksumming */
29104 - case ETHTOOL_GRXCSUM: {
29105 - struct ethtool_value edata = { ETHTOOL_GRXCSUM };
29106 - u16 cmd = cpr16(CpCmd) & RxChkSum;
29108 - edata.data = cmd ? 1 : 0;
29109 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
29113 - case ETHTOOL_SRXCSUM: {
29114 - struct ethtool_value edata;
29115 - u16 cmd = cpr16(CpCmd), newcmd;
29116 +static void cp_set_msglevel(struct net_device *dev, u32 value)
29118 + struct cp_private *cp = dev->priv;
29119 + cp->msg_enable = value;
29123 +static u32 cp_get_rx_csum(struct net_device *dev)
29125 + struct cp_private *cp = dev->priv;
29126 + return (cpr16(CpCmd) & RxChkSum) ? 1 : 0;
29129 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
29131 +static int cp_set_rx_csum(struct net_device *dev, u32 data)
29133 + struct cp_private *cp = dev->priv;
29134 + u16 cmd = cp->cpcmd, newcmd;
29137 - newcmd |= RxChkSum;
29139 - newcmd &= ~RxChkSum;
29142 - if (newcmd == cmd)
29145 + newcmd |= RxChkSum;
29147 + newcmd &= ~RxChkSum;
29149 + if (newcmd != cmd) {
29150 spin_lock_irq(&cp->lock);
29151 + cp->cpcmd = newcmd;
29152 cpw16_f(CpCmd, newcmd);
29153 spin_unlock_irq(&cp->lock);
29156 - /* get/set TX checksumming */
29157 - case ETHTOOL_GTXCSUM: {
29158 - struct ethtool_value edata = { ETHTOOL_GTXCSUM };
29160 - edata.data = (cp->dev->features & NETIF_F_IP_CSUM) != 0;
29161 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
29165 - case ETHTOOL_STXCSUM: {
29166 - struct ethtool_value edata;
29168 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
29172 - cp->dev->features |= NETIF_F_IP_CSUM;
29174 - cp->dev->features &= ~NETIF_F_IP_CSUM;
29181 - /* get/set scatter-gather */
29182 - case ETHTOOL_GSG: {
29183 - struct ethtool_value edata = { ETHTOOL_GSG };
29185 - edata.data = (cp->dev->features & NETIF_F_SG) != 0;
29186 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
29190 - case ETHTOOL_SSG: {
29191 - struct ethtool_value edata;
29192 +static void cp_get_regs(struct net_device *dev, struct ethtool_regs *regs,
29195 + struct cp_private *cp = dev->priv;
29197 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
29199 + if (regs->len < CP_REGS_SIZE)
29200 + return /* -EINVAL */;
29203 - cp->dev->features |= NETIF_F_SG;
29205 - cp->dev->features &= ~NETIF_F_SG;
29206 + regs->version = CP_REGS_VER;
29210 + spin_lock_irq(&cp->lock);
29211 + memcpy_fromio(p, cp->regs, CP_REGS_SIZE);
29212 + spin_unlock_irq(&cp->lock);
29215 - /* get string list(s) */
29216 - case ETHTOOL_GSTRINGS: {
29217 - struct ethtool_gstrings estr = { ETHTOOL_GSTRINGS };
29219 - if (copy_from_user(&estr, useraddr, sizeof(estr)))
29221 - if (estr.string_set != ETH_SS_STATS)
29224 - estr.len = CP_NUM_STATS;
29225 - if (copy_to_user(useraddr, &estr, sizeof(estr)))
29227 - if (copy_to_user(useraddr + sizeof(estr),
29228 - ðtool_stats_keys,
29229 - sizeof(ethtool_stats_keys)))
29233 +static void cp_get_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
29235 + struct cp_private *cp = dev->priv;
29237 - /* get NIC-specific statistics */
29238 - case ETHTOOL_GSTATS: {
29239 - struct ethtool_stats estats = { ETHTOOL_GSTATS };
29241 - unsigned int work = 100;
29242 - const unsigned int sz = sizeof(u64) * CP_NUM_STATS;
29245 - /* begin NIC statistics dump */
29246 - cpw32(StatsAddr + 4, 0); /* FIXME: 64-bit PCI */
29247 - cpw32(StatsAddr, cp->nic_stats_dma | DumpStats);
29248 - cpr32(StatsAddr);
29250 - estats.n_stats = CP_NUM_STATS;
29251 - if (copy_to_user(useraddr, &estats, sizeof(estats)))
29254 - while (work-- > 0) {
29255 - if ((cpr32(StatsAddr) & DumpStats) == 0)
29259 + spin_lock_irq (&cp->lock);
29260 + netdev_get_wol (cp, wol);
29261 + spin_unlock_irq (&cp->lock);
29264 - if (cpr32(StatsAddr) & DumpStats)
29266 +static int cp_set_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
29268 + struct cp_private *cp = dev->priv;
29271 - tmp_stats = kmalloc(sz, GFP_KERNEL);
29274 - memset(tmp_stats, 0, sz);
29277 - tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok);
29278 - tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok);
29279 - tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err);
29280 - tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err);
29281 - tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo);
29282 - tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align);
29283 - tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col);
29284 - tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol);
29285 - tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys);
29286 - tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast);
29287 - tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast);
29288 - tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort);
29289 - tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun);
29290 - tmp_stats[i++] = cp->cp_stats.rx_frags;
29291 - if (i != CP_NUM_STATS)
29293 + spin_lock_irq (&cp->lock);
29294 + rc = netdev_set_wol (cp, wol);
29295 + spin_unlock_irq (&cp->lock);
29297 - i = copy_to_user(useraddr + sizeof(estats),
29299 - kfree(tmp_stats);
29306 +static void cp_get_strings (struct net_device *dev, u32 stringset, u8 *buf)
29308 + switch (stringset) {
29309 + case ETH_SS_STATS:
29310 + memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys));
29318 - /* get/set Wake-on-LAN settings */
29319 - case ETHTOOL_GWOL: {
29320 - struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
29322 - spin_lock_irq (&cp->lock);
29323 - netdev_get_wol (cp, &wol);
29324 - spin_unlock_irq (&cp->lock);
29325 - return ((copy_to_user (useraddr, &wol, sizeof (wol)))? -EFAULT : 0);
29328 - case ETHTOOL_SWOL: {
29329 - struct ethtool_wolinfo wol;
29330 +static void cp_get_ethtool_stats (struct net_device *dev,
29331 + struct ethtool_stats *estats, u64 *tmp_stats)
29333 + struct cp_private *cp = dev->priv;
29334 + unsigned int work = 100;
29337 - if (copy_from_user (&wol, useraddr, sizeof (wol)))
29339 - spin_lock_irq (&cp->lock);
29340 - netdev_set_wol (cp, &wol);
29341 - spin_unlock_irq (&cp->lock);
29344 + /* begin NIC statistics dump */
29345 + cpw32(StatsAddr + 4, 0); /* FIXME: 64-bit PCI */
29346 + cpw32(StatsAddr, cp->nic_stats_dma | DumpStats);
29347 + cpr32(StatsAddr);
29351 + while (work-- > 0) {
29352 + if ((cpr32(StatsAddr) & DumpStats) == 0)
29357 - return -EOPNOTSUPP;
29358 + if (cpr32(StatsAddr) & DumpStats)
29359 + return /* -EIO */;
29362 + tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_ok);
29363 + tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok);
29364 + tmp_stats[i++] = le64_to_cpu(cp->nic_stats->tx_err);
29365 + tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_err);
29366 + tmp_stats[i++] = le16_to_cpu(cp->nic_stats->rx_fifo);
29367 + tmp_stats[i++] = le16_to_cpu(cp->nic_stats->frame_align);
29368 + tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_1col);
29369 + tmp_stats[i++] = le32_to_cpu(cp->nic_stats->tx_ok_mcol);
29370 + tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_phys);
29371 + tmp_stats[i++] = le64_to_cpu(cp->nic_stats->rx_ok_bcast);
29372 + tmp_stats[i++] = le32_to_cpu(cp->nic_stats->rx_ok_mcast);
29373 + tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_abort);
29374 + tmp_stats[i++] = le16_to_cpu(cp->nic_stats->tx_underrun);
29375 + tmp_stats[i++] = cp->cp_stats.rx_frags;
29376 + if (i != CP_NUM_STATS)
29380 +static struct ethtool_ops cp_ethtool_ops = {
29381 + .get_drvinfo = cp_get_drvinfo,
29382 + .get_regs_len = cp_get_regs_len,
29383 + .get_stats_count = cp_get_stats_count,
29384 + .get_settings = cp_get_settings,
29385 + .set_settings = cp_set_settings,
29386 + .nway_reset = cp_nway_reset,
29387 + .get_link = ethtool_op_get_link,
29388 + .get_msglevel = cp_get_msglevel,
29389 + .set_msglevel = cp_set_msglevel,
29390 + .get_rx_csum = cp_get_rx_csum,
29391 + .set_rx_csum = cp_set_rx_csum,
29392 + .get_tx_csum = ethtool_op_get_tx_csum,
29393 + .set_tx_csum = ethtool_op_set_tx_csum, /* local! */
29394 + .get_sg = ethtool_op_get_sg,
29395 + .set_sg = ethtool_op_set_sg,
29396 + .get_regs = cp_get_regs,
29397 + .get_wol = cp_get_wol,
29398 + .set_wol = cp_set_wol,
29399 + .get_strings = cp_get_strings,
29400 + .get_ethtool_stats = cp_get_ethtool_stats,
29403 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
29405 @@ -1669,38 +1525,12 @@
29406 if (!netif_running(dev))
29409 - if (cmd == SIOCETHTOOL)
29410 - return cp_ethtool_ioctl(cp, (void *) rq->ifr_data);
29412 spin_lock_irq(&cp->lock);
29413 rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL);
29414 spin_unlock_irq(&cp->lock);
29418 -#if CP_VLAN_TAG_USED
29419 -static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
29421 - struct cp_private *cp = dev->priv;
29423 - spin_lock_irq(&cp->lock);
29425 - cpw16(CpCmd, cpr16(CpCmd) | RxVlanOn);
29426 - spin_unlock_irq(&cp->lock);
29429 -static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
29431 - struct cp_private *cp = dev->priv;
29433 - spin_lock_irq(&cp->lock);
29434 - cpw16(CpCmd, cpr16(CpCmd) & ~RxVlanOn);
29436 - cp->vlgrp->vlan_devices[vid] = NULL;
29437 - spin_unlock_irq(&cp->lock);
29441 /* Serial EEPROM section. */
29443 /* EEPROM_Ctrl bits. */
29444 @@ -1723,7 +1553,7 @@
29445 #define EE_READ_CMD (6)
29446 #define EE_ERASE_CMD (7)
29448 -static int __devinit read_eeprom (void *ioaddr, int location, int addr_len)
29449 +static int read_eeprom (void *ioaddr, int location, int addr_len)
29452 unsigned retval = 0;
29453 @@ -1769,17 +1599,15 @@
29454 pci_set_power_state (cp->pdev, 3);
29457 -static int __devinit cp_init_one (struct pci_dev *pdev,
29458 - const struct pci_device_id *ent)
29459 +static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
29461 struct net_device *dev;
29462 struct cp_private *cp;
29466 - unsigned int addr_len, i;
29467 - u8 pci_rev, cache_size;
29468 - unsigned int board_type = (unsigned int) ent->driver_data;
29469 + unsigned int addr_len, i, pci_using_dac;
29473 static int version_printed;
29474 @@ -1805,7 +1633,6 @@
29478 - cp->board_type = board_type;
29480 cp->msg_enable = (debug < 0 ? CP_DEF_MSG_ENABLE : debug);
29481 spin_lock_init (&cp->lock);
29482 @@ -1821,10 +1648,14 @@
29486 - rc = pci_request_regions(pdev, DRV_NAME);
29487 + rc = pci_set_mwi(pdev);
29489 goto err_out_disable;
29491 + rc = pci_request_regions(pdev, DRV_NAME);
29493 + goto err_out_mwi;
29495 if (pdev->irq < 2) {
29497 printk(KERN_ERR PFX "invalid irq (%d) for pci dev %s\n",
29498 @@ -1846,18 +1677,22 @@
29501 /* Configure DMA attributes. */
29502 - if (!pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL)) {
29503 - cp->pci_using_dac = 1;
29504 + if ((sizeof(dma_addr_t) > 32) &&
29505 + !pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) {
29506 + pci_using_dac = 1;
29508 - rc = pci_set_dma_mask(pdev, (u64) 0xffffffff);
29509 + rc = pci_set_dma_mask(pdev, 0xffffffffULL);
29511 printk(KERN_ERR PFX "No usable DMA configuration, "
29515 - cp->pci_using_dac = 0;
29516 + pci_using_dac = 0;
29519 + cp->cpcmd = (pci_using_dac ? PCIDAC : 0) |
29520 + PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
29522 regs = ioremap_nocache(pciaddr, CP_REGS_SIZE);
29525 @@ -1882,16 +1717,17 @@
29526 dev->hard_start_xmit = cp_start_xmit;
29527 dev->get_stats = cp_get_stats;
29528 dev->do_ioctl = cp_ioctl;
29529 + dev->poll = cp_rx_poll;
29530 + dev->weight = 16; /* arbitrary? from NAPI_HOWTO.txt. */
29532 dev->change_mtu = cp_change_mtu;
29534 + dev->ethtool_ops = &cp_ethtool_ops;
29536 dev->tx_timeout = cp_tx_timeout;
29537 dev->watchdog_timeo = TX_TIMEOUT;
29539 -#ifdef CP_TX_CHECKSUM
29540 - dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
29543 #if CP_VLAN_TAG_USED
29544 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
29545 dev->vlan_rx_register = cp_vlan_rx_register;
29546 @@ -1904,11 +1740,10 @@
29548 goto err_out_iomap;
29550 - printk (KERN_INFO "%s: %s at 0x%lx, "
29551 + printk (KERN_INFO "%s: RTL-8139C+ at 0x%lx, "
29552 "%02x:%02x:%02x:%02x:%02x:%02x, "
29555 - cp_board_tbl[board_type].name,
29557 dev->dev_addr[0], dev->dev_addr[1],
29558 dev->dev_addr[2], dev->dev_addr[3],
29559 @@ -1917,29 +1752,8 @@
29561 pci_set_drvdata(pdev, dev);
29564 - * Looks like this is necessary to deal with on all architectures,
29565 - * even this %$#%$# N440BX Intel based thing doesn't get it right.
29566 - * Ie. having two NICs in the machine, one will have the cache
29567 - * line set at boot time, the other will not.
29569 - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_size);
29570 - cache_size <<= 2;
29571 - if (cache_size != SMP_CACHE_BYTES) {
29572 - printk(KERN_INFO "%s: PCI cache line size set incorrectly "
29573 - "(%i bytes) by BIOS/FW, ", dev->name, cache_size);
29574 - if (cache_size > SMP_CACHE_BYTES)
29575 - printk("expecting %i\n", SMP_CACHE_BYTES);
29577 - printk("correcting to %i\n", SMP_CACHE_BYTES);
29578 - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
29579 - SMP_CACHE_BYTES >> 2);
29583 /* enable busmastering and memory-write-invalidate */
29584 pci_set_master(pdev);
29585 - pci_set_mwi(pdev);
29587 if (cp->wol_enabled) cp_set_d3_state (cp);
29589 @@ -1949,6 +1763,8 @@
29592 pci_release_regions(pdev);
29594 + pci_clear_mwi(pdev);
29596 pci_disable_device(pdev);
29598 @@ -1956,7 +1772,7 @@
29602 -static void __devexit cp_remove_one (struct pci_dev *pdev)
29603 +static void cp_remove_one (struct pci_dev *pdev)
29605 struct net_device *dev = pci_get_drvdata(pdev);
29606 struct cp_private *cp = dev->priv;
29607 @@ -1967,6 +1783,7 @@
29609 if (cp->wol_enabled) pci_set_power_state (pdev, 0);
29610 pci_release_regions(pdev);
29611 + pci_clear_mwi(pdev);
29612 pci_disable_device(pdev);
29613 pci_set_drvdata(pdev, NULL);
29615 @@ -2029,7 +1846,7 @@
29617 .id_table = cp_pci_tbl,
29618 .probe = cp_init_one,
29619 - .remove = __devexit_p(cp_remove_one),
29620 + .remove = cp_remove_one,
29622 .resume = cp_resume,
29623 .suspend = cp_suspend,
29624 diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
29625 --- a/drivers/net/8139too.c Tue Aug 19 20:13:55 2003
29626 +++ b/drivers/net/8139too.c Sun Aug 31 12:38:16 2003
29627 @@ -123,6 +123,11 @@
29628 #define USE_IO_OPS 1
29631 +/* use a 16K rx ring buffer instead of the default 32K */
29632 +#ifdef CONFIG_SH_DREAMCAST
29633 +#define USE_BUF16K 1
29636 /* define to 1 to enable copious debugging info */
29637 #undef RTL8139_DEBUG
29639 @@ -165,7 +170,11 @@
29640 static int debug = -1;
29642 /* Size of the in-memory receive ring. */
29644 +#define RX_BUF_LEN_IDX 1 /* 0==8K, 1==16K, 2==32K, 3==64K */
29646 #define RX_BUF_LEN_IDX 2 /* 0==8K, 1==16K, 2==32K, 3==64K */
29648 #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX)
29649 #define RX_BUF_PAD 16
29650 #define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */
29651 @@ -212,18 +221,7 @@
29670 @@ -232,36 +230,29 @@
29673 } board_info[] __devinitdata = {
29674 - { "RealTek RTL8139 Fast Ethernet", RTL8139_CAPS },
29675 - { "RealTek RTL8139B PCI/CardBus", RTL8139_CAPS },
29676 - { "SMC1211TX EZCard 10/100 (RealTek RTL8139)", RTL8139_CAPS },
29677 -/* { MPX5030, "Accton MPX5030 (RealTek RTL8139)", RTL8139_CAPS },*/
29678 - { "Delta Electronics 8139 10/100BaseTX", RTL8139_CAPS },
29679 - { "Addtron Technolgy 8139 10/100BaseTX", RTL8139_CAPS },
29680 - { "D-Link DFE-538TX (RealTek RTL8139)", RTL8139_CAPS },
29681 - { "D-Link DFE-690TXD (RealTek RTL8139)", RTL8139_CAPS },
29682 - { "AboCom FE2000VX (RealTek RTL8139)", RTL8139_CAPS },
29683 - { "Allied Telesyn 8139 CardBus", RTL8139_CAPS },
29684 + { "RealTek RTL8139", RTL8139_CAPS },
29685 { "RealTek RTL8129", RTL8129_CAPS },
29686 - { "Planex FNW-3603-TX 10/100 CardBus", RTL8139_CAPS },
29687 - { "Planex FNW-3800-TX 10/100 CardBus", RTL8139_CAPS },
29691 static struct pci_device_id rtl8139_pci_tbl[] = {
29692 {0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29693 - {0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139_CB },
29694 - {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SMC1211TX },
29695 -/* {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MPX5030 },*/
29696 - {0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DELTA8139 },
29697 - {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
29698 - {0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE538TX },
29699 - {0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE690TXD },
29700 - {0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FE2000VX },
29701 - {0x1259, 0xa117, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ALLIED8139 },
29702 - {0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FNW3603TX },
29703 - {0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FNW3800TX },
29705 + {0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29706 + {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29707 + {0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29708 + {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29709 + {0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29710 + {0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29711 + {0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29712 + {0x1259, 0xa117, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29713 + {0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29714 + {0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29715 + {0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29717 +#ifdef CONFIG_SH_SECUREEDGE5410
29718 + /* Bogus 8139 silicon reports 8129 without external PROM :-( */
29719 + {0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
29721 #ifdef CONFIG_8139TOO_8129
29722 {0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8129 },
29724 @@ -271,8 +262,8 @@
29725 * so we simply don't match on the main vendor id.
29727 {PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 },
29728 - {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, DFE538TX },
29729 - {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, FE2000VX },
29730 + {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, RTL8139 },
29731 + {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, RTL8139 },
29735 @@ -302,7 +293,6 @@
29739 - ChipVersion = 0x43,
29741 Timer = 0x48, /* A general-purpose counter. */
29742 RxMissed = 0x4C, /* 24 bits valid, write clears. */
29743 @@ -461,7 +451,6 @@
29744 RxNoWrap = (1 << 7),
29748 /* Twister tuning parameters from RealTek.
29749 Completely undocumented, but required to tune bad links on some boards. */
29751 @@ -472,36 +461,22 @@
29752 CSCR_LinkDownCmd = 0x0f3c0,
29757 Cfg9346_Lock = 0x00,
29758 Cfg9346_Unlock = 0xC0,
29761 -#ifdef CONFIG_8139TOO_TUNE_TWISTER
29763 -enum TwisterParamVals {
29764 - PARA78_default = 0x78fa8388,
29765 - PARA7c_default = 0xcb38de43, /* param[0][3] */
29766 - PARA7c_xxx = 0xcb38de43,
29769 -static const unsigned long param[4][4] = {
29770 - {0xcb39de43, 0xcb39ce43, 0xfb38de03, 0xcb38de43},
29771 - {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
29772 - {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
29773 - {0xbb39de43, 0xbb39ce43, 0xbb39ce83, 0xbb39ce83}
29776 -#endif /* CONFIG_8139TOO_TUNE_TWISTER */
29792 @@ -509,50 +484,65 @@
29793 HasLWake = (1 << 1),
29796 +#define HW_REVID(b30, b29, b28, b27, b26, b23, b22) \
29797 + (b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22)
29798 +#define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1)
29800 /* directly indexed by chip_t, above */
29801 const static struct {
29803 - u8 version; /* from RTL8139C docs */
29804 - u32 RxConfigMask; /* should clear the bits supported by this chip */
29805 + u32 version; /* from RTL8139C/RTL8139D docs */
29807 } rtl_chip_info[] = {
29810 - 0xf0fe0040, /* XXX copied from RTL8139A, verify */
29811 + HW_REVID(1, 0, 0, 0, 0, 0, 0),
29815 { "RTL-8139 rev K",
29818 + HW_REVID(1, 1, 0, 0, 0, 0, 0),
29825 + HW_REVID(1, 1, 1, 0, 0, 0, 0),
29826 + HasHltClk, /* XXX undocumented? */
29829 + { "RTL-8139A rev G",
29830 + HW_REVID(1, 1, 1, 0, 0, 1, 0),
29831 HasHltClk, /* XXX undocumented? */
29837 + HW_REVID(1, 1, 1, 1, 0, 0, 0),
29843 - 0xf0fe0040, /* XXX copied from RTL8139A, verify */
29844 + HW_REVID(1, 1, 1, 1, 1, 0, 0),
29850 - 0xf0fc0040, /* XXX copied from RTL8139B, verify */
29851 + HW_REVID(1, 1, 1, 0, 1, 0, 0),
29856 + HW_REVID(1, 1, 1, 1, 0, 1, 0),
29860 + { "RTL-8100B/8139D",
29861 + HW_REVID(1, 1, 1, 0, 1, 0, 1),
29866 + HW_REVID(1, 1, 1, 0, 1, 1, 1),
29871 struct rtl_extra_stats {
29872 @@ -612,7 +602,7 @@
29873 static int mdio_read (struct net_device *dev, int phy_id, int location);
29874 static void mdio_write (struct net_device *dev, int phy_id, int location,
29876 -static int rtl8139_thread (void *data);
29877 +static inline void rtl8139_start_thread(struct net_device *dev);
29878 static void rtl8139_tx_timeout (struct net_device *dev);
29879 static void rtl8139_init_ring (struct net_device *dev);
29880 static int rtl8139_start_xmit (struct sk_buff *skb,
29881 @@ -625,6 +615,7 @@
29882 static void rtl8139_set_rx_mode (struct net_device *dev);
29883 static void __set_rx_mode (struct net_device *dev);
29884 static void rtl8139_hw_start (struct net_device *dev);
29885 +static struct ethtool_ops rtl8139_ethtool_ops;
29889 @@ -688,10 +679,17 @@
29890 PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
29891 TxErr | TxOK | RxErr | RxOK;
29894 +static const unsigned int rtl8139_rx_config =
29895 + RxCfgRcv16K | RxNoWrap |
29896 + (RX_FIFO_THRESH << RxCfgFIFOShift) |
29897 + (RX_DMA_BURST << RxCfgDMAShift);
29899 static const unsigned int rtl8139_rx_config =
29900 RxCfgRcv32K | RxNoWrap |
29901 (RX_FIFO_THRESH << RxCfgFIFOShift) |
29902 (RX_DMA_BURST << RxCfgDMAShift);
29905 static const unsigned int rtl8139_tx_config =
29906 (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
29907 @@ -716,13 +714,6 @@
29908 /* it's ok to call this even if we have no regions to free */
29909 pci_release_regions (pdev);
29911 -#ifndef RTL8139_NDEBUG
29912 - /* poison memory before freeing */
29913 - memset (dev, 0xBC,
29914 - sizeof (struct net_device) +
29915 - sizeof (struct rtl8139_private));
29916 -#endif /* RTL8139_NDEBUG */
29920 pci_set_drvdata (pdev, NULL);
29921 @@ -757,7 +748,7 @@
29923 u32 pio_start, pio_end, pio_flags, pio_len;
29924 unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
29928 assert (pdev != NULL);
29930 @@ -859,9 +850,9 @@
29933 /* identify chip attached to board */
29934 - tmp = RTL_R8 (ChipVersion);
29935 + version = RTL_R32 (TxConfig) & HW_REVID_MASK;
29936 for (i = 0; i < ARRAY_SIZE (rtl_chip_info); i++)
29937 - if (tmp == rtl_chip_info[i].version) {
29938 + if (version == rtl_chip_info[i].version) {
29942 @@ -892,8 +883,11 @@
29944 if (rtl_chip_info[tp->chipset].flags & HasLWake) {
29945 tmp8 = RTL_R8 (Config4);
29946 - if (tmp8 & LWPTN)
29947 + if (tmp8 & LWPTN) {
29948 + RTL_W8 (Cfg9346, Cfg9346_Unlock);
29949 RTL_W8 (Config4, tmp8 & ~LWPTN);
29950 + RTL_W8 (Cfg9346, Cfg9346_Lock);
29954 DPRINTK("Old chip wakeup\n");
29955 @@ -971,6 +965,7 @@
29956 dev->get_stats = rtl8139_get_stats;
29957 dev->set_multicast_list = rtl8139_set_rx_mode;
29958 dev->do_ioctl = netdev_ioctl;
29959 + dev->ethtool_ops = &rtl8139_ethtool_ops;
29960 dev->tx_timeout = rtl8139_tx_timeout;
29961 dev->watchdog_timeo = TX_TIMEOUT;
29963 @@ -1318,8 +1313,6 @@
29965 tp->mii.full_duplex = tp->mii.force_media;
29966 tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000;
29967 - tp->twistie = (tp->chipset == CH_8139_K) ? 1 : 0;
29968 - tp->time_to_die = 0;
29970 rtl8139_init_ring (dev);
29971 rtl8139_hw_start (dev);
29972 @@ -1330,32 +1323,18 @@
29973 dev->irq, RTL_R8 (MediaStatus),
29974 tp->mii.full_duplex ? "full" : "half");
29976 - tp->thr_pid = kernel_thread (rtl8139_thread, dev, CLONE_FS | CLONE_FILES);
29977 - if (tp->thr_pid < 0)
29978 - printk (KERN_WARNING "%s: unable to start kernel thread\n",
29980 + rtl8139_start_thread(dev);
29986 -static void rtl_check_media (struct net_device *dev)
29987 +static void rtl_check_media (struct net_device *dev, unsigned int init_media)
29989 struct rtl8139_private *tp = dev->priv;
29991 if (tp->phys[0] >= 0) {
29992 - u16 mii_lpa = mdio_read(dev, tp->phys[0], MII_LPA);
29993 - if (mii_lpa == 0xffff)
29994 - ; /* Not there */
29995 - else if ((mii_lpa & LPA_100FULL) == LPA_100FULL
29996 - || (mii_lpa & 0x00C0) == LPA_10FULL)
29997 - tp->mii.full_duplex = 1;
29999 - printk (KERN_INFO"%s: Setting %s%s-duplex based on"
30000 - " auto-negotiated partner ability %4.4x.\n",
30001 - dev->name, mii_lpa == 0 ? "" :
30002 - (mii_lpa & 0x0180) ? "100mbps " : "10mbps ",
30003 - tp->mii.full_duplex ? "full" : "half", mii_lpa);
30004 + mii_check_media(&tp->mii, 1, init_media);
30008 @@ -1390,7 +1369,7 @@
30012 - rtl_check_media (dev);
30013 + rtl_check_media (dev, 1);
30015 if (tp->chipset >= CH_8139B) {
30016 /* Disable magic packet scanning, which is enabled
30017 @@ -1452,6 +1431,19 @@
30018 static inline void rtl8139_tune_twister (struct net_device *dev,
30019 struct rtl8139_private *tp) {}
30021 +enum TwisterParamVals {
30022 + PARA78_default = 0x78fa8388,
30023 + PARA7c_default = 0xcb38de43, /* param[0][3] */
30024 + PARA7c_xxx = 0xcb38de43,
30027 +static const unsigned long param[4][4] = {
30028 + {0xcb39de43, 0xcb39ce43, 0xfb38de03, 0xcb38de43},
30029 + {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
30030 + {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83},
30031 + {0xbb39de43, 0xbb39ce43, 0xbb39ce83, 0xbb39ce83}
30034 static void rtl8139_tune_twister (struct net_device *dev,
30035 struct rtl8139_private *tp)
30037 @@ -1538,7 +1530,6 @@
30039 #endif /* CONFIG_8139TOO_TUNE_TWISTER */
30042 static inline void rtl8139_thread_iter (struct net_device *dev,
30043 struct rtl8139_private *tp,
30045 @@ -1585,7 +1576,6 @@
30050 static int rtl8139_thread (void *data)
30052 struct net_device *dev = data;
30053 @@ -1619,6 +1609,24 @@
30054 complete_and_exit (&tp->thr_exited, 0);
30057 +static inline void rtl8139_start_thread(struct net_device *dev)
30059 + struct rtl8139_private *tp = dev->priv;
30061 + tp->thr_pid = -1;
30063 + tp->time_to_die = 0;
30064 + if (tp->chipset == CH_8139_K)
30066 + else if (tp->drv_flags & HAS_LNK_CHNG)
30069 + tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
30070 + if (tp->thr_pid < 0) {
30071 + printk (KERN_WARNING "%s: unable to start kernel thread\n",
30076 static void rtl8139_tx_clear (struct rtl8139_private *tp)
30078 @@ -1999,18 +2007,7 @@
30080 if ((status & RxUnderrun) && link_changed &&
30081 (tp->drv_flags & HAS_LNK_CHNG)) {
30082 - /* Really link-change on new chips. */
30083 - int lpar = RTL_R16 (NWayLPAR);
30084 - int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040
30085 - || tp->mii.force_media;
30086 - if (tp->mii.full_duplex != duplex) {
30087 - tp->mii.full_duplex = duplex;
30089 - RTL_W8 (Cfg9346, Cfg9346_Unlock);
30090 - RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20);
30091 - RTL_W8 (Cfg9346, Cfg9346_Lock);
30094 + rtl_check_media(dev, 0);
30095 status &= ~RxUnderrun;
30098 @@ -2173,11 +2170,12 @@
30099 /* Get the ethtool Wake-on-LAN settings. Assumes that wol points to
30100 kernel memory, *wol has been initialized as {ETHTOOL_GWOL}, and
30101 other threads or interrupts aren't messing with the 8139. */
30102 -static void netdev_get_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
30103 +static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
30105 struct rtl8139_private *np = dev->priv;
30106 void *ioaddr = np->mmio_addr;
30108 + spin_lock_irq(&np->lock);
30109 if (rtl_chip_info[np->chipset].flags & HasLWake) {
30110 u8 cfg3 = RTL_R8 (Config3);
30111 u8 cfg5 = RTL_R8 (Config5);
30112 @@ -2199,14 +2197,14 @@
30113 if (cfg5 & Cfg5_BWF)
30114 wol->wolopts |= WAKE_BCAST;
30116 + spin_unlock_irq(&np->lock);
30120 /* Set the ethtool Wake-on-LAN settings. Return 0 or -errno. Assumes
30121 that wol points to kernel memory and other threads or interrupts
30122 aren't messing with the 8139. */
30123 -static int netdev_set_wol (struct net_device *dev,
30124 - const struct ethtool_wolinfo *wol)
30125 +static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
30127 struct rtl8139_private *np = dev->priv;
30128 void *ioaddr = np->mmio_addr;
30129 @@ -2220,6 +2218,7 @@
30130 if (wol->wolopts & ~support)
30133 + spin_lock_irq(&np->lock);
30134 cfg3 = RTL_R8 (Config3) & ~(Cfg3_LinkUp | Cfg3_Magic);
30135 if (wol->wolopts & WAKE_PHY)
30136 cfg3 |= Cfg3_LinkUp;
30137 @@ -2240,213 +2239,120 @@
30138 if (wol->wolopts & WAKE_BCAST)
30140 RTL_W8 (Config5, cfg5); /* need not unlock via Cfg9346 */
30141 + spin_unlock_irq(&np->lock);
30146 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
30147 +static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
30149 struct rtl8139_private *np = dev->priv;
30152 - /* dev_ioctl() in ../../net/core/dev.c has already checked
30153 - capable(CAP_NET_ADMIN), so don't bother with that here. */
30154 + strcpy(info->driver, DRV_NAME);
30155 + strcpy(info->version, DRV_VERSION);
30156 + strcpy(info->bus_info, pci_name(np->pci_dev));
30157 + info->regdump_len = np->regs_len;
30160 - if (get_user(ethcmd, (u32 *)useraddr))
30162 +static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30164 + struct rtl8139_private *np = dev->priv;
30165 + spin_lock_irq(&np->lock);
30166 + mii_ethtool_gset(&np->mii, cmd);
30167 + spin_unlock_irq(&np->lock);
30171 - switch (ethcmd) {
30173 - case ETHTOOL_GDRVINFO: {
30174 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
30175 - strcpy (info.driver, DRV_NAME);
30176 - strcpy (info.version, DRV_VERSION);
30177 - strcpy (info.bus_info, pci_name(np->pci_dev));
30178 - info.regdump_len = np->regs_len;
30179 - if (copy_to_user (useraddr, &info, sizeof (info)))
30183 +static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30185 + struct rtl8139_private *np = dev->priv;
30187 + spin_lock_irq(&np->lock);
30188 + rc = mii_ethtool_sset(&np->mii, cmd);
30189 + spin_unlock_irq(&np->lock);
30193 - /* get settings */
30194 - case ETHTOOL_GSET: {
30195 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
30196 - spin_lock_irq(&np->lock);
30197 - mii_ethtool_gset(&np->mii, &ecmd);
30198 - spin_unlock_irq(&np->lock);
30199 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
30203 - /* set settings */
30204 - case ETHTOOL_SSET: {
30206 - struct ethtool_cmd ecmd;
30207 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
30209 - spin_lock_irq(&np->lock);
30210 - r = mii_ethtool_sset(&np->mii, &ecmd);
30211 - spin_unlock_irq(&np->lock);
30214 - /* restart autonegotiation */
30215 - case ETHTOOL_NWAY_RST: {
30216 - return mii_nway_restart(&np->mii);
30218 - /* get link status */
30219 - case ETHTOOL_GLINK: {
30220 - struct ethtool_value edata = {ETHTOOL_GLINK};
30221 - edata.data = mii_link_ok(&np->mii);
30222 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30226 +static int rtl8139_nway_reset(struct net_device *dev)
30228 + struct rtl8139_private *np = dev->priv;
30229 + return mii_nway_restart(&np->mii);
30232 - /* get message-level */
30233 - case ETHTOOL_GMSGLVL: {
30234 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
30235 - edata.data = debug;
30236 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30240 - /* set message-level */
30241 - case ETHTOOL_SMSGLVL: {
30242 - struct ethtool_value edata;
30243 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
30245 - debug = edata.data;
30248 +static u32 rtl8139_get_link(struct net_device *dev)
30250 + struct rtl8139_private *np = dev->priv;
30251 + return mii_link_ok(&np->mii);
30254 - case ETHTOOL_GWOL:
30256 - struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
30257 - spin_lock_irq (&np->lock);
30258 - netdev_get_wol (dev, &wol);
30259 - spin_unlock_irq (&np->lock);
30260 - if (copy_to_user (useraddr, &wol, sizeof (wol)))
30264 +static u32 rtl8139_get_msglevel(struct net_device *dev)
30269 - case ETHTOOL_SWOL:
30271 - struct ethtool_wolinfo wol;
30273 - if (copy_from_user (&wol, useraddr, sizeof (wol)))
30275 - spin_lock_irq (&np->lock);
30276 - rc = netdev_set_wol (dev, &wol);
30277 - spin_unlock_irq (&np->lock);
30280 +static void rtl8139_set_msglevel(struct net_device *dev, u32 datum)
30285 /* TODO: we are too slack to do reg dumping for pio, for now */
30286 -#ifndef CONFIG_8139TOO_PIO
30287 - /* NIC register dump */
30288 - case ETHTOOL_GREGS: {
30289 - struct ethtool_regs regs;
30290 - unsigned int regs_len = np->regs_len;
30291 - u8 *regbuf = kmalloc(regs_len, GFP_KERNEL);
30296 - memset(regbuf, 0, regs_len);
30298 - rc = copy_from_user(®s, useraddr, sizeof(regs));
30301 - goto err_out_gregs;
30304 - if (regs.len > regs_len)
30305 - regs.len = regs_len;
30306 - if (regs.len < regs_len) {
30308 - goto err_out_gregs;
30311 - regs.version = RTL_REGS_VER;
30312 - rc = copy_to_user(useraddr, ®s, sizeof(regs));
30315 - goto err_out_gregs;
30318 - useraddr += offsetof(struct ethtool_regs, data);
30320 - spin_lock_irq(&np->lock);
30321 - memcpy_fromio(regbuf, np->mmio_addr, regs_len);
30322 - spin_unlock_irq(&np->lock);
30324 - if (copy_to_user(useraddr, regbuf, regs_len))
30331 -#endif /* CONFIG_8139TOO_PIO */
30333 - /* get string list(s) */
30334 - case ETHTOOL_GSTRINGS: {
30335 - struct ethtool_gstrings estr = { ETHTOOL_GSTRINGS };
30337 - if (copy_from_user(&estr, useraddr, sizeof(estr)))
30339 - if (estr.string_set != ETH_SS_STATS)
30342 - estr.len = RTL_NUM_STATS;
30343 - if (copy_to_user(useraddr, &estr, sizeof(estr)))
30345 - if (copy_to_user(useraddr + sizeof(estr),
30346 - ðtool_stats_keys,
30347 - sizeof(ethtool_stats_keys)))
30351 +#ifdef CONFIG_8139TOO_PIO
30352 +#define rtl8139_get_regs_len NULL
30353 +#define rtl8139_get_regs NULL
30355 +static int rtl8139_get_regs_len(struct net_device *dev)
30357 + struct rtl8139_private *np = dev->priv;
30358 + return np->regs_len;
30361 - /* get NIC-specific statistics */
30362 - case ETHTOOL_GSTATS: {
30363 - struct ethtool_stats estats = { ETHTOOL_GSTATS };
30365 - const unsigned int sz = sizeof(u64) * RTL_NUM_STATS;
30368 - estats.n_stats = RTL_NUM_STATS;
30369 - if (copy_to_user(useraddr, &estats, sizeof(estats)))
30372 - tmp_stats = kmalloc(sz, GFP_KERNEL);
30375 - memset(tmp_stats, 0, sz);
30378 - tmp_stats[i++] = np->xstats.early_rx;
30379 - tmp_stats[i++] = np->xstats.tx_buf_mapped;
30380 - tmp_stats[i++] = np->xstats.tx_timeouts;
30381 - tmp_stats[i++] = np->xstats.rx_lost_in_ring;
30382 - if (i != RTL_NUM_STATS)
30384 +static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf)
30386 + struct rtl8139_private *np = dev->priv;
30388 - i = copy_to_user(useraddr + sizeof(estats), tmp_stats, sz);
30389 - kfree(tmp_stats);
30390 + regs->version = RTL_REGS_VER;
30399 + spin_lock_irq(&np->lock);
30400 + memcpy_fromio(regbuf, np->mmio_addr, regs->len);
30401 + spin_unlock_irq(&np->lock);
30403 +#endif /* CONFIG_8139TOO_MMIO */
30405 - return -EOPNOTSUPP;
30406 +static int rtl8139_get_stats_count(struct net_device *dev)
30408 + return RTL_NUM_STATS;
30411 +static void rtl8139_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data)
30413 + struct rtl8139_private *np = dev->priv;
30415 + data[0] = np->xstats.early_rx;
30416 + data[1] = np->xstats.tx_buf_mapped;
30417 + data[2] = np->xstats.tx_timeouts;
30418 + data[3] = np->xstats.rx_lost_in_ring;
30421 +static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data)
30423 + memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys));
30426 +static struct ethtool_ops rtl8139_ethtool_ops = {
30427 + .get_drvinfo = rtl8139_get_drvinfo,
30428 + .get_settings = rtl8139_get_settings,
30429 + .set_settings = rtl8139_set_settings,
30430 + .get_regs_len = rtl8139_get_regs_len,
30431 + .get_regs = rtl8139_get_regs,
30432 + .nway_reset = rtl8139_nway_reset,
30433 + .get_link = rtl8139_get_link,
30434 + .get_msglevel = rtl8139_get_msglevel,
30435 + .set_msglevel = rtl8139_set_msglevel,
30436 + .get_wol = rtl8139_get_wol,
30437 + .set_wol = rtl8139_set_wol,
30438 + .get_strings = rtl8139_get_strings,
30439 + .get_stats_count = rtl8139_get_stats_count,
30440 + .get_ethtool_stats = rtl8139_get_ethtool_stats,
30443 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
30445 @@ -2457,14 +2363,9 @@
30446 if (!netif_running(dev))
30449 - if (cmd == SIOCETHTOOL)
30450 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
30453 - spin_lock_irq(&np->lock);
30454 - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30455 - spin_unlock_irq(&np->lock);
30457 + spin_lock_irq(&np->lock);
30458 + rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30459 + spin_unlock_irq(&np->lock);
30463 diff -Nru a/drivers/net/8390.c b/drivers/net/8390.c
30464 --- a/drivers/net/8390.c Sun Apr 20 21:26:41 2003
30465 +++ b/drivers/net/8390.c Mon Sep 1 09:50:20 2003
30466 @@ -997,6 +997,11 @@
30467 spin_unlock_irqrestore(&ei_local->page_lock, flags);
30470 +static inline void ei_device_init(struct ei_device *ei_local)
30472 + spin_lock_init(&ei_local->page_lock);
30476 * ethdev_init - init rest of 8390 device struct
30477 * @dev: network device structure to init
30478 @@ -1012,14 +1017,11 @@
30480 if (dev->priv == NULL)
30482 - struct ei_device *ei_local;
30484 dev->priv = kmalloc(sizeof(struct ei_device), GFP_KERNEL);
30485 if (dev->priv == NULL)
30487 memset(dev->priv, 0, sizeof(struct ei_device));
30488 - ei_local = (struct ei_device *)dev->priv;
30489 - spin_lock_init(&ei_local->page_lock);
30490 + ei_device_init(dev->priv);
30493 dev->hard_start_xmit = &ei_start_xmit;
30494 @@ -1030,6 +1032,29 @@
30499 +/* wrapper to make alloc_netdev happy; probably should just cast... */
30500 +static void __ethdev_init(struct net_device *dev)
30502 + ethdev_init(dev);
30506 + * alloc_ei_netdev - alloc_etherdev counterpart for 8390
30508 + * Allocate 8390-specific net_device.
30510 +struct net_device *alloc_ei_netdev(void)
30512 + struct net_device *dev;
30514 + dev = alloc_netdev(sizeof(struct ei_device), "eth%d", __ethdev_init);
30516 + ei_device_init(dev->priv);
30524 @@ -1133,6 +1158,7 @@
30525 EXPORT_SYMBOL(ei_tx_timeout);
30526 EXPORT_SYMBOL(ethdev_init);
30527 EXPORT_SYMBOL(NS8390_init);
30528 +EXPORT_SYMBOL(alloc_ei_netdev);
30530 #if defined(MODULE)
30532 diff -Nru a/drivers/net/8390.h b/drivers/net/8390.h
30533 --- a/drivers/net/8390.h Sat Jun 28 10:57:01 2003
30534 +++ b/drivers/net/8390.h Mon Sep 1 09:50:20 2003
30536 extern int ei_open(struct net_device *dev);
30537 extern int ei_close(struct net_device *dev);
30538 extern irqreturn_t ei_interrupt(int irq, void *dev_id, struct pt_regs *regs);
30539 +extern struct net_device *alloc_ei_netdev(void);
30541 /* You have one of these per-board */
30543 diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig
30544 --- a/drivers/net/Kconfig Mon Aug 18 20:59:59 2003
30545 +++ b/drivers/net/Kconfig Mon Sep 1 02:42:02 2003
30546 @@ -502,7 +502,7 @@
30548 config SGI_IOC3_ETH
30549 bool "SGI IOC3 Ethernet"
30550 - depends on NET_ETHERNET && (IA64_SGI_SN1 || SGI_IP27)
30551 + depends on NET_ETHERNET && SGI_IP27
30553 If you have a network (Ethernet) card of this type, say Y and read
30554 the Ethernet-HOWTO, available from
30555 diff -Nru a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
30556 --- a/drivers/net/arcnet/arcnet.c Mon Jul 21 05:31:03 2003
30557 +++ b/drivers/net/arcnet/arcnet.c Sun Aug 31 16:14:40 2003
30558 @@ -135,7 +135,7 @@
30559 arc_proto_map[count] = arc_proto_default;
30562 - printk("arcnet: struct sizes: %d %d %d %d %d\n",
30563 + printk("arcnet: struct sizes: %Zd %Zd %Zd %Zd %Zd\n",
30564 sizeof(struct arc_hardware), sizeof(struct arc_rfc1201),
30565 sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap),
30566 sizeof(struct archdr));
30567 diff -Nru a/drivers/net/arm/ether00.c b/drivers/net/arm/ether00.c
30568 --- a/drivers/net/arm/ether00.c Tue Aug 19 20:53:15 2003
30569 +++ b/drivers/net/arm/ether00.c Sun Aug 31 16:14:08 2003
30570 @@ -991,9 +991,9 @@
30573 static struct pld_hotswap_ops ether00_pldhs_ops={
30574 - name: ETHER00_NAME,
30575 - add_device: ether00_add_device,
30576 - remove_devices: ether00_remove_devices,
30577 + .name = ETHER00_NAME,
30578 + .add_device = ether00_add_device,
30579 + .remove_devices = ether00_remove_devices,
30583 diff -Nru a/drivers/net/dummy.c b/drivers/net/dummy.c
30584 --- a/drivers/net/dummy.c Tue Aug 19 20:53:15 2003
30585 +++ b/drivers/net/dummy.c Sun Aug 24 04:54:46 2003
30587 Alan Cox, 30th May 1994
30590 -/* To have statistics (just packets sent) define this */
30592 #include <linux/config.h>
30593 #include <linux/module.h>
30594 #include <linux/kernel.h>
30595 diff -Nru a/drivers/net/epic100.c b/drivers/net/epic100.c
30596 --- a/drivers/net/epic100.c Tue Aug 19 20:53:15 2003
30597 +++ b/drivers/net/epic100.c Mon Sep 1 14:05:11 2003
30598 @@ -362,6 +362,7 @@
30599 static int epic_rx(struct net_device *dev);
30600 static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
30601 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
30602 +static struct ethtool_ops netdev_ethtool_ops;
30603 static int epic_close(struct net_device *dev);
30604 static struct net_device_stats *epic_get_stats(struct net_device *dev);
30605 static void set_rx_mode(struct net_device *dev);
30606 @@ -539,6 +540,7 @@
30607 dev->get_stats = &epic_get_stats;
30608 dev->set_multicast_list = &set_rx_mode;
30609 dev->do_ioctl = &netdev_ioctl;
30610 + dev->ethtool_ops = &netdev_ethtool_ops;
30611 dev->watchdog_timeo = TX_TIMEOUT;
30612 dev->tx_timeout = &epic_tx_timeout;
30614 @@ -1361,82 +1363,73 @@
30618 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
30619 +static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
30621 struct epic_private *np = dev->priv;
30624 - if (copy_from_user (ðcmd, useraddr, sizeof (ethcmd)))
30626 + strcpy (info->driver, DRV_NAME);
30627 + strcpy (info->version, DRV_VERSION);
30628 + strcpy (info->bus_info, pci_name(np->pci_dev));
30631 - switch (ethcmd) {
30632 - case ETHTOOL_GDRVINFO: {
30633 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
30634 - strcpy (info.driver, DRV_NAME);
30635 - strcpy (info.version, DRV_VERSION);
30636 - strcpy (info.bus_info, pci_name(np->pci_dev));
30637 - if (copy_to_user (useraddr, &info, sizeof (info)))
30642 - /* get settings */
30643 - case ETHTOOL_GSET: {
30644 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
30645 - spin_lock_irq(&np->lock);
30646 - mii_ethtool_gset(&np->mii, &ecmd);
30647 - spin_unlock_irq(&np->lock);
30648 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
30652 - /* set settings */
30653 - case ETHTOOL_SSET: {
30655 - struct ethtool_cmd ecmd;
30656 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
30658 - spin_lock_irq(&np->lock);
30659 - r = mii_ethtool_sset(&np->mii, &ecmd);
30660 - spin_unlock_irq(&np->lock);
30663 - /* restart autonegotiation */
30664 - case ETHTOOL_NWAY_RST: {
30665 - return mii_nway_restart(&np->mii);
30667 - /* get link status */
30668 - case ETHTOOL_GLINK: {
30669 - struct ethtool_value edata = {ETHTOOL_GLINK};
30670 - edata.data = mii_link_ok(&np->mii);
30671 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30676 - /* get message-level */
30677 - case ETHTOOL_GMSGLVL: {
30678 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
30679 - edata.data = debug;
30680 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30684 - /* set message-level */
30685 - case ETHTOOL_SMSGLVL: {
30686 - struct ethtool_value edata;
30687 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
30689 - debug = edata.data;
30695 +static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30697 + struct epic_private *np = dev->priv;
30700 + spin_lock_irq(&np->lock);
30701 + rc = mii_ethtool_gset(&np->mii, cmd);
30702 + spin_unlock_irq(&np->lock);
30707 +static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30709 + struct epic_private *np = dev->priv;
30712 + spin_lock_irq(&np->lock);
30713 + rc = mii_ethtool_sset(&np->mii, cmd);
30714 + spin_unlock_irq(&np->lock);
30719 +static int netdev_nway_reset(struct net_device *dev)
30721 + struct epic_private *np = dev->priv;
30722 + return mii_nway_restart(&np->mii);
30725 - return -EOPNOTSUPP;
30726 +static u32 netdev_get_link(struct net_device *dev)
30728 + struct epic_private *np = dev->priv;
30729 + return mii_link_ok(&np->mii);
30732 +static u32 netdev_get_msglevel(struct net_device *dev)
30737 +static void netdev_set_msglevel(struct net_device *dev, u32 value)
30742 +static struct ethtool_ops netdev_ethtool_ops = {
30743 + .get_drvinfo = netdev_get_drvinfo,
30744 + .get_settings = netdev_get_settings,
30745 + .set_settings = netdev_set_settings,
30746 + .nway_reset = netdev_nway_reset,
30747 + .get_link = netdev_get_link,
30748 + .get_msglevel = netdev_get_msglevel,
30749 + .set_msglevel = netdev_set_msglevel,
30750 + .get_sg = ethtool_op_get_sg,
30751 + .get_tx_csum = ethtool_op_get_tx_csum,
30754 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
30756 struct epic_private *np = dev->priv;
30757 @@ -1450,16 +1443,10 @@
30758 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
30761 - /* ethtool commands */
30762 - if (cmd == SIOCETHTOOL)
30763 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
30765 - /* all other ioctls (the SIOC[GS]MIIxxx ioctls) */
30767 - spin_lock_irq(&np->lock);
30768 - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30769 - spin_unlock_irq(&np->lock);
30771 + /* all non-ethtool ioctls (the SIOC[GS]MIIxxx ioctls) */
30772 + spin_lock_irq(&np->lock);
30773 + rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30774 + spin_unlock_irq(&np->lock);
30776 /* power-down, if interface is down */
30777 if (! netif_running(dev)) {
30778 diff -Nru a/drivers/net/eth16i.c b/drivers/net/eth16i.c
30779 --- a/drivers/net/eth16i.c Sun Apr 27 20:36:19 2003
30780 +++ b/drivers/net/eth16i.c Sun Aug 31 06:34:16 2003
30781 @@ -1053,7 +1053,7 @@
30782 int ioaddr = dev->base_addr;
30784 ushort length = skb->len;
30785 - unsigned char *buf = skb->data;
30786 + unsigned char *buf;
30787 unsigned long flags;
30789 if (length < ETH_ZLEN) {
30790 @@ -1062,6 +1062,7 @@
30796 netif_stop_queue(dev);
30798 diff -Nru a/drivers/net/fealnx.c b/drivers/net/fealnx.c
30799 --- a/drivers/net/fealnx.c Tue Aug 19 20:53:16 2003
30800 +++ b/drivers/net/fealnx.c Mon Sep 1 14:18:01 2003
30801 @@ -443,6 +443,7 @@
30802 static void set_rx_mode(struct net_device *dev);
30803 static struct net_device_stats *get_stats(struct net_device *dev);
30804 static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
30805 +static struct ethtool_ops netdev_ethtool_ops;
30806 static int netdev_close(struct net_device *dev);
30807 static void reset_rx_descriptors(struct net_device *dev);
30809 @@ -667,6 +668,7 @@
30810 dev->get_stats = &get_stats;
30811 dev->set_multicast_list = &set_rx_mode;
30812 dev->do_ioctl = &mii_ioctl;
30813 + dev->ethtool_ops = &netdev_ethtool_ops;
30814 dev->tx_timeout = tx_timeout;
30815 dev->watchdog_timeo = TX_TIMEOUT;
30817 @@ -938,7 +940,7 @@
30819 // np->bcrvalue=0x38;
30820 np->bcrvalue = 0x10;
30821 - np->cralue = 0xe00; /* rx 128 burst length */
30822 + np->crvalue = 0xe00; /* rx 128 burst length */
30823 #warning Processor architecture undefined!
30826 @@ -1760,82 +1762,72 @@
30827 writel(np->crvalue, ioaddr + TCRRCR);
30830 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
30831 +static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
30833 struct netdev_private *np = dev->priv;
30836 - if (copy_from_user (ðcmd, useraddr, sizeof (ethcmd)))
30838 + strcpy (info->driver, DRV_NAME);
30839 + strcpy (info->version, DRV_VERSION);
30840 + strcpy (info->bus_info, pci_name(np->pci_dev));
30843 - switch (ethcmd) {
30844 - case ETHTOOL_GDRVINFO: {
30845 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
30846 - strcpy (info.driver, DRV_NAME);
30847 - strcpy (info.version, DRV_VERSION);
30848 - strcpy (info.bus_info, pci_name(np->pci_dev));
30849 - if (copy_to_user (useraddr, &info, sizeof (info)))
30854 - /* get settings */
30855 - case ETHTOOL_GSET: {
30856 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
30857 - spin_lock_irq(&np->lock);
30858 - mii_ethtool_gset(&np->mii, &ecmd);
30859 - spin_unlock_irq(&np->lock);
30860 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
30864 - /* set settings */
30865 - case ETHTOOL_SSET: {
30867 - struct ethtool_cmd ecmd;
30868 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
30870 - spin_lock_irq(&np->lock);
30871 - r = mii_ethtool_sset(&np->mii, &ecmd);
30872 - spin_unlock_irq(&np->lock);
30875 - /* restart autonegotiation */
30876 - case ETHTOOL_NWAY_RST: {
30877 - return mii_nway_restart(&np->mii);
30879 - /* get link status */
30880 - case ETHTOOL_GLINK: {
30881 - struct ethtool_value edata = {ETHTOOL_GLINK};
30882 - edata.data = mii_link_ok(&np->mii);
30883 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30888 - /* get message-level */
30889 - case ETHTOOL_GMSGLVL: {
30890 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
30891 - edata.data = debug;
30892 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
30896 - /* set message-level */
30897 - case ETHTOOL_SMSGLVL: {
30898 - struct ethtool_value edata;
30899 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
30901 - debug = edata.data;
30907 +static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30909 + struct netdev_private *np = dev->priv;
30912 + spin_lock_irq(&np->lock);
30913 + rc = mii_ethtool_gset(&np->mii, cmd);
30914 + spin_unlock_irq(&np->lock);
30919 +static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30921 + struct netdev_private *np = dev->priv;
30924 + spin_lock_irq(&np->lock);
30925 + rc = mii_ethtool_sset(&np->mii, cmd);
30926 + spin_unlock_irq(&np->lock);
30931 +static int netdev_nway_reset(struct net_device *dev)
30933 + struct netdev_private *np = dev->priv;
30934 + return mii_nway_restart(&np->mii);
30937 +static u32 netdev_get_link(struct net_device *dev)
30939 + struct netdev_private *np = dev->priv;
30940 + return mii_link_ok(&np->mii);
30943 +static u32 netdev_get_msglevel(struct net_device *dev)
30948 - return -EOPNOTSUPP;
30949 +static void netdev_set_msglevel(struct net_device *dev, u32 value)
30954 +static struct ethtool_ops netdev_ethtool_ops = {
30955 + .get_drvinfo = netdev_get_drvinfo,
30956 + .get_settings = netdev_get_settings,
30957 + .set_settings = netdev_set_settings,
30958 + .nway_reset = netdev_nway_reset,
30959 + .get_link = netdev_get_link,
30960 + .get_msglevel = netdev_get_msglevel,
30961 + .set_msglevel = netdev_set_msglevel,
30962 + .get_sg = ethtool_op_get_sg,
30963 + .get_tx_csum = ethtool_op_get_tx_csum,
30966 static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
30968 @@ -1846,14 +1838,9 @@
30969 if (!netif_running(dev))
30972 - if (cmd == SIOCETHTOOL)
30973 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
30976 - spin_lock_irq(&np->lock);
30977 - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30978 - spin_unlock_irq(&np->lock);
30980 + spin_lock_irq(&np->lock);
30981 + rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
30982 + spin_unlock_irq(&np->lock);
30986 diff -Nru a/drivers/net/fmv18x.c b/drivers/net/fmv18x.c
30987 --- a/drivers/net/fmv18x.c Sun May 11 19:48:01 2003
30988 +++ b/drivers/net/fmv18x.c Sun Aug 31 06:34:16 2003
30989 @@ -367,7 +367,7 @@
30990 struct net_local *lp = dev->priv;
30991 int ioaddr = dev->base_addr;
30992 short length = skb->len;
30993 - unsigned char *buf = skb->data;
30994 + unsigned char *buf;
30995 unsigned long flags;
30997 /* Block a transmit from overlapping. */
30998 @@ -385,6 +385,7 @@
31005 printk("%s: Transmitting a packet of length %lu.\n", dev->name,
31006 diff -Nru a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
31007 --- a/drivers/net/hamradio/bpqether.c Tue Aug 19 20:58:55 2003
31008 +++ b/drivers/net/hamradio/bpqether.c Wed Aug 27 23:48:03 2003
31009 @@ -605,6 +605,7 @@
31013 +#ifdef CONFIG_PROC_FS
31014 if (!proc_net_fops_create("bpqether", S_IRUGO, &bpq_info_fops)) {
31016 "bpq: cannot create /proc/net/bpqether entry.\n");
31017 @@ -612,6 +613,7 @@
31018 dev_remove_pack(&bpq_packet_type);
31021 +#endif /* CONFIG_PROC_FS */
31024 for (dev = dev_base; dev != NULL; dev = dev->next) {
31025 diff -Nru a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
31026 --- a/drivers/net/hamradio/yam.c Tue Aug 19 20:53:16 2003
31027 +++ b/drivers/net/hamradio/yam.c Thu Aug 28 01:23:35 2003
31028 @@ -807,7 +807,7 @@
31029 seq_printf(seq, " RxInt %u\n", yp->nb_rxint);
31030 seq_printf(seq, " RxOver %lu\n", yp->stats.rx_fifo_errors);
31031 seq_printf(seq, "\n");
31036 static struct seq_operations yam_seqops = {
31037 diff -Nru a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
31038 --- a/drivers/net/irda/Kconfig Tue Aug 19 21:06:58 2003
31039 +++ b/drivers/net/irda/Kconfig Sun Aug 24 04:40:39 2003
31040 @@ -319,7 +319,7 @@
31043 tristate "VLSI 82C147 SIR/MIR/FIR (EXPERIMENTAL)"
31044 - depends on EXPERIMENTAL && IRDA
31045 + depends on EXPERIMENTAL && IRDA && PCI
31047 Say Y here if you want to build support for the VLSI 82C147
31048 PCI-IrDA Controller. This controller is used by the HP OmniBook 800
31049 diff -Nru a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
31050 --- a/drivers/net/irda/via-ircc.c Fri Aug 8 18:15:54 2003
31051 +++ b/drivers/net/irda/via-ircc.c Sun Aug 31 16:14:08 2003
31052 @@ -134,10 +134,10 @@
31055 static struct pci_driver via_driver = {
31056 - name: VIA_MODULE_NAME,
31057 - id_table: via_pci_tbl,
31058 - probe: via_init_one,
31059 - remove: via_remove_one,
31060 + .name = VIA_MODULE_NAME,
31061 + .id_table = via_pci_tbl,
31062 + .probe = via_init_one,
31063 + .remove = via_remove_one,
31067 diff -Nru a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
31068 --- a/drivers/net/irda/vlsi_ir.c Wed Aug 20 15:31:21 2003
31069 +++ b/drivers/net/irda/vlsi_ir.c Sun Aug 24 04:45:26 2003
31070 @@ -21,18 +21,20 @@
31072 ********************************************************************/
31074 +#include <linux/config.h>
31075 #include <linux/module.h>
31077 -MODULE_DESCRIPTION("IrDA SIR/MIR/FIR driver for VLSI 82C147");
31078 -MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");
31079 -MODULE_LICENSE("GPL");
31080 +#define DRIVER_NAME "vlsi_ir"
31081 +#define DRIVER_VERSION "v0.5"
31082 +#define DRIVER_DESCRIPTION "IrDA SIR/MIR/FIR driver for VLSI 82C147"
31083 +#define DRIVER_AUTHOR "Martin Diehl <info@mdiehl.de>"
31085 -#define DRIVER_NAME "vlsi_ir"
31086 -#define DRIVER_VERSION "v0.4a"
31087 +MODULE_DESCRIPTION(DRIVER_DESCRIPTION);
31088 +MODULE_AUTHOR(DRIVER_AUTHOR);
31089 +MODULE_LICENSE("GPL");
31091 /********************************************************/
31093 -#include <linux/config.h>
31094 #include <linux/kernel.h>
31095 #include <linux/init.h>
31096 #include <linux/pci.h>
31097 @@ -44,10 +46,12 @@
31098 #include <linux/proc_fs.h>
31099 #include <linux/smp_lock.h>
31100 #include <asm/uaccess.h>
31101 +#include <asm/byteorder.h>
31103 #include <net/irda/irda.h>
31104 #include <net/irda/irda_device.h>
31105 #include <net/irda/wrapper.h>
31106 +#include <net/irda/crc.h>
31108 #include <net/irda/vlsi_ir.h>
31110 @@ -55,14 +59,16 @@
31112 static /* const */ char drivername[] = DRIVER_NAME;
31114 -#define PCI_CLASS_WIRELESS_IRDA 0x0d00
31116 -static struct pci_device_id vlsi_irda_table [] = { {
31118 - .class = PCI_CLASS_WIRELESS_IRDA << 8,
31119 - .vendor = PCI_VENDOR_ID_VLSI,
31120 - .device = PCI_DEVICE_ID_VLSI_82C147,
31121 - }, { /* all zeroes */ }
31122 +static struct pci_device_id vlsi_irda_table [] = {
31124 + .class = PCI_CLASS_WIRELESS_IRDA << 8,
31125 + .class_mask = PCI_CLASS_SUBCLASS_MASK << 8,
31126 + .vendor = PCI_VENDOR_ID_VLSI,
31127 + .device = PCI_DEVICE_ID_VLSI_82C147,
31128 + .subvendor = PCI_ANY_ID,
31129 + .subdevice = PCI_ANY_ID,
31131 + { /* all zeroes */ }
31134 MODULE_DEVICE_TABLE(pci, vlsi_irda_table);
31135 @@ -114,7 +120,7 @@
31137 MODULE_PARM(qos_mtt_bits, "i");
31138 MODULE_PARM_DESC(qos_mtt_bits, "IrLAP bitfield representing min-turn-time");
31139 -static int qos_mtt_bits = 0x04; /* default is 1 ms */
31140 +static int qos_mtt_bits = 0x07; /* default is 1 ms or more */
31142 /********************************************************/
31144 @@ -164,7 +170,7 @@
31147 out += sprintf(out, "\n%s (vid/did: %04x/%04x)\n",
31148 - pci_name(pdev), (int)pdev->vendor, (int)pdev->device);
31149 + PCIDEV_NAME(pdev), (int)pdev->vendor, (int)pdev->device);
31150 out += sprintf(out, "pci-power-state: %u\n", (unsigned) pdev->current_state);
31151 out += sprintf(out, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n",
31152 pdev->irq, (unsigned)pci_resource_start(pdev, 0), (u64)pdev->dma_mask);
31153 @@ -198,13 +204,13 @@
31155 out += sprintf(out, "\nhw-state:\n");
31156 pci_read_config_byte(idev->pdev, VLSI_PCI_IRMISC, &byte);
31157 - out += sprintf(out, "IRMISC:%s%s%s UART%s",
31158 + out += sprintf(out, "IRMISC:%s%s%s uart%s",
31159 (byte&IRMISC_IRRAIL) ? " irrail" : "",
31160 (byte&IRMISC_IRPD) ? " irpd" : "",
31161 (byte&IRMISC_UARTTST) ? " uarttest" : "",
31162 - (byte&IRMISC_UARTEN) ? "" : " disabled\n");
31163 + (byte&IRMISC_UARTEN) ? "@" : " disabled\n");
31164 if (byte&IRMISC_UARTEN) {
31165 - out += sprintf(out, "@0x%s\n",
31166 + out += sprintf(out, "0x%s\n",
31167 (byte&2) ? ((byte&1) ? "3e8" : "2e8")
31168 : ((byte&1) ? "3f8" : "2f8"));
31170 @@ -254,7 +260,7 @@
31171 (word&IRCFG_RXPOL) ? " RXPOL" : "");
31172 word = inw(iobase+VLSI_PIO_IRENABLE);
31173 out += sprintf(out, "IRENABLE:%s%s%s%s%s%s%s%s\n",
31174 - (word&IRENABLE_IREN) ? " IRENABLE" : "",
31175 + (word&IRENABLE_PHYANDCLOCK) ? " PHYANDCLOCK" : "",
31176 (word&IRENABLE_CFGER) ? " CFGERR" : "",
31177 (word&IRENABLE_FIR_ON) ? " FIR_ON" : "",
31178 (word&IRENABLE_MIR_ON) ? " MIR_ON" : "",
31179 @@ -358,7 +364,7 @@
31182 if (!ndev || !ndev->priv) {
31183 - printk(KERN_ERR "%s: invalid ptr!\n", __FUNCTION__);
31184 + ERROR("%s: invalid ptr!\n", __FUNCTION__);
31188 @@ -539,7 +545,14 @@
31189 memset(rd, 0, sizeof(*rd));
31190 rd->hw = hwmap + i;
31191 rd->buf = kmalloc(len, GFP_KERNEL|GFP_DMA);
31192 - if (rd->buf == NULL) {
31193 + if (rd->buf == NULL
31194 + || !(busaddr = pci_map_single(pdev, rd->buf, len, dir))) {
31196 + ERROR("%s: failed to create PCI-MAP for %p",
31197 + __FUNCTION__, rd->buf);
31201 for (j = 0; j < i; j++) {
31203 busaddr = rd_get_addr(rd);
31204 @@ -552,12 +565,6 @@
31208 - busaddr = pci_map_single(pdev, rd->buf, len, dir);
31210 - printk(KERN_ERR "%s: failed to create PCI-MAP for %p",
31211 - __FUNCTION__, rd->buf);
31214 rd_set_addr_status(rd, busaddr, 0);
31215 pci_dma_sync_single(pdev, busaddr, len, dir);
31216 /* initially, the dma buffer is owned by the CPU */
31217 @@ -597,8 +604,7 @@
31219 ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr);
31221 - printk(KERN_ERR "%s: insufficient memory for descriptor rings\n",
31223 + ERROR("%s: insufficient memory for descriptor rings\n", __FUNCTION__);
31226 memset(ringarea, 0, HW_RING_AREA_SIZE);
31227 @@ -666,33 +672,52 @@
31228 ret |= VLSI_RX_FRAME;
31229 if (status & RD_RX_CRCERR)
31230 ret |= VLSI_RX_CRC;
31234 - len = rd_get_count(rd);
31235 - crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16);
31236 - len -= crclen; /* remove trailing CRC */
31238 - printk(KERN_ERR "%s: strange frame (len=%d)\n",
31239 - __FUNCTION__, len);
31240 - ret |= VLSI_RX_DROP;
31242 - else if (!rd->skb) {
31243 - printk(KERN_ERR "%s: rx packet dropped\n", __FUNCTION__);
31244 - ret |= VLSI_RX_DROP;
31250 - memcpy(skb_put(skb,len), rd->buf, len);
31251 - skb->mac.raw = skb->data;
31252 - if (in_interrupt())
31255 - netif_rx_ni(skb);
31256 - ndev->last_rx = jiffies;
31258 + len = rd_get_count(rd);
31259 + crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16);
31260 + len -= crclen; /* remove trailing CRC */
31262 + IRDA_DEBUG(0, "%s: strange frame (len=%d)\n", __FUNCTION__, len);
31263 + ret |= VLSI_RX_DROP;
31267 + if (idev->mode == IFF_SIR) { /* hw checks CRC in MIR, FIR mode */
31269 + /* rd->buf is a streaming PCI_DMA_FROMDEVICE map. Doing the
31270 + * endian-adjustment there just in place will dirty a cache line
31271 + * which belongs to the map and thus we must be sure it will
31272 + * get flushed before giving the buffer back to hardware.
31273 + * vlsi_fill_rx() will do this anyway - but here we rely on.
31275 + le16_to_cpus(rd->buf+len);
31276 + if (irda_calc_crc16(INIT_FCS,rd->buf,len+crclen) != GOOD_FCS) {
31277 + IRDA_DEBUG(0, "%s: crc error\n", __FUNCTION__);
31278 + ret |= VLSI_RX_CRC;
31284 + WARNING("%s: rx packet lost\n", __FUNCTION__);
31285 + ret |= VLSI_RX_DROP;
31292 + memcpy(skb_put(skb,len), rd->buf, len);
31293 + skb->mac.raw = skb->data;
31294 + if (in_interrupt())
31297 + netif_rx_ni(skb);
31298 + ndev->last_rx = jiffies;
31301 rd_set_status(rd, 0);
31302 rd_set_count(rd, 0);
31303 /* buffer still owned by CPU */
31304 @@ -706,7 +731,9 @@
31306 for (rd = ring_last(r); rd != NULL; rd = ring_put(r)) {
31307 if (rd_is_active(rd)) {
31309 + WARNING("%s: driver bug: rx descr race with hw\n",
31311 + vlsi_ring_debug(r);
31315 @@ -764,7 +791,7 @@
31317 if (ring_first(r) == NULL) {
31318 /* we are in big trouble, if this should ever happen */
31319 - printk(KERN_ERR "%s: rx ring exhausted!\n", __FUNCTION__);
31320 + ERROR("%s: rx ring exhausted!\n", __FUNCTION__);
31321 vlsi_ring_debug(r);
31324 @@ -785,7 +812,7 @@
31325 if (rd_is_active(rd)) {
31326 rd_set_status(rd, 0);
31327 if (rd_get_count(rd)) {
31328 - printk(KERN_INFO "%s - dropping rx packet\n", __FUNCTION__);
31329 + IRDA_DEBUG(0, "%s - dropping rx packet\n", __FUNCTION__);
31330 ret = -VLSI_RX_DROP;
31332 rd_set_count(rd, 0);
31333 @@ -850,24 +877,17 @@
31334 return (ret) ? -ret : len;
31337 -static int vlsi_set_baud(struct net_device *ndev, int dolock)
31338 +static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
31340 - vlsi_irda_dev_t *idev = ndev->priv;
31341 - unsigned long flags;
31346 - unsigned idle_retry;
31349 - int fifocnt = 0; /* Keep compiler happy */
31352 baudrate = idev->new_baud;
31353 - iobase = ndev->base_addr;
31355 - printk(KERN_DEBUG "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud);
31357 + IRDA_DEBUG(2, "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud);
31358 if (baudrate == 4000000) {
31360 config = IRCFG_FIR;
31361 @@ -883,7 +903,7 @@
31362 config = IRCFG_SIR | IRCFG_SIRFILT | IRCFG_RXANY;
31365 - printk(KERN_ERR "%s: undefined baudrate %d - fallback to 9600!\n",
31366 + WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
31367 __FUNCTION__, baudrate);
31370 @@ -897,40 +917,18 @@
31374 + config |= IRCFG_MSTR | IRCFG_ENRX;
31377 - spin_lock_irqsave(&idev->lock, flags);
31379 - flags = 0xdead; /* prevent bogus warning about possible uninitialized use */
31381 - for (idle_retry=0; idle_retry < 100; idle_retry++) {
31382 - fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
31383 - if (fifocnt == 0)
31386 - printk(KERN_WARNING "%s: waiting for rx fifo to become empty(%d)\n",
31387 - __FUNCTION__, fifocnt);
31389 - spin_unlock_irqrestore(&idev->lock, flags);
31391 - spin_lock_irqsave(&idev->lock, flags);
31395 + fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
31396 + if (fifocnt != 0) {
31397 + IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
31399 - if (fifocnt != 0)
31400 - printk(KERN_ERR "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
31402 outw(0, iobase+VLSI_PIO_IRENABLE);
31405 - config |= IRCFG_MSTR | IRCFG_ENRX;
31407 outw(config, iobase+VLSI_PIO_IRCFG);
31409 outw(nphyctl, iobase+VLSI_PIO_NPHYCTL);
31411 - outw(IRENABLE_IREN, iobase+VLSI_PIO_IRENABLE);
31412 + outw(IRENABLE_PHYANDCLOCK, iobase+VLSI_PIO_IRENABLE);
31415 udelay(1); /* chip applies IRCFG on next rising edge of its 8MHz clock */
31416 @@ -946,14 +944,14 @@
31418 config ^= IRENABLE_SIR_ON;
31420 - if (config != (IRENABLE_IREN|IRENABLE_ENRXST)) {
31421 - printk(KERN_ERR "%s: failed to set %s mode!\n", __FUNCTION__,
31422 + if (config != (IRENABLE_PHYANDCLOCK|IRENABLE_ENRXST)) {
31423 + WARNING("%s: failed to set %s mode!\n", __FUNCTION__,
31424 (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR"));
31428 if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) {
31429 - printk(KERN_ERR "%s: failed to apply baudrate %d\n",
31430 + WARNING("%s: failed to apply baudrate %d\n",
31431 __FUNCTION__, baudrate);
31434 @@ -964,8 +962,6 @@
31439 - spin_unlock_irqrestore(&idev->lock, flags);
31442 vlsi_reg_debug(iobase,__FUNCTION__);
31443 @@ -973,16 +969,6 @@
31447 -static inline int vlsi_set_baud_lock(struct net_device *ndev)
31449 - return vlsi_set_baud(ndev, 1);
31452 -static inline int vlsi_set_baud_nolock(struct net_device *ndev)
31454 - return vlsi_set_baud(ndev, 0);
31457 static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
31459 vlsi_irda_dev_t *idev = ndev->priv;
31460 @@ -995,79 +981,100 @@
31463 struct timeval now, ready;
31464 + char *msg = NULL;
31466 speed = irda_get_next_speed(skb);
31467 + spin_lock_irqsave(&idev->lock, flags);
31468 if (speed != -1 && speed != idev->baud) {
31469 netif_stop_queue(ndev);
31470 idev->new_baud = speed;
31472 - dev_kfree_skb_any(skb);
31474 - /* due to the completely asynch tx operation we might have
31475 - * IrLAP racing with the hardware here, f.e. if the controller
31476 - * is just sending the last packet with current speed while
31477 - * the LAP is already switching the speed using synchronous
31478 - * len=0 packet. Immediate execution would lead to hw lockup
31479 - * requiring a powercycle to reset. Good candidate to trigger
31480 - * this is the final UA:RSP packet after receiving a DISC:CMD
31481 - * when getting the LAP down.
31482 - * Note that we are not protected by the queue_stop approach
31483 - * because the final UA:RSP arrives _without_ request to apply
31484 - * new-speed-after-this-packet - hence the driver doesn't know
31485 - * this was the last packet and doesn't stop the queue. So the
31486 - * forced switch to default speed from LAP gets through as fast
31487 - * as only some 10 usec later while the UA:RSP is still processed
31488 - * by the hardware and we would get screwed.
31489 - * Note: no locking required since we (netdev->xmit) are the only
31490 - * supplier for tx and the network layer provides serialization
31492 - spin_lock_irqsave(&idev->lock, flags);
31493 - if (ring_first(idev->tx_ring) == NULL) {
31494 - /* no race - tx-ring already empty */
31495 - vlsi_set_baud_nolock(ndev);
31496 - netif_wake_queue(ndev);
31499 - ; /* keep the speed change pending like it would
31500 - * for any len>0 packet. tx completion interrupt
31501 - * will apply it when the tx ring becomes empty.
31503 - spin_unlock_irqrestore(&idev->lock, flags);
31506 status = RD_TX_CLRENTX; /* stop tx-ring after this frame */
31511 if (skb->len == 0) {
31512 - printk(KERN_ERR "%s: dropping len=0 packet\n", __FUNCTION__);
31514 + /* handle zero packets - should be speed change */
31515 + if (status == 0) {
31516 + msg = "bogus zero-length packet";
31517 + goto drop_unlock;
31520 + /* due to the completely asynch tx operation we might have
31521 + * IrLAP racing with the hardware here, f.e. if the controller
31522 + * is just sending the last packet with current speed while
31523 + * the LAP is already switching the speed using synchronous
31524 + * len=0 packet. Immediate execution would lead to hw lockup
31525 + * requiring a powercycle to reset. Good candidate to trigger
31526 + * this is the final UA:RSP packet after receiving a DISC:CMD
31527 + * when getting the LAP down.
31528 + * Note that we are not protected by the queue_stop approach
31529 + * because the final UA:RSP arrives _without_ request to apply
31530 + * new-speed-after-this-packet - hence the driver doesn't know
31531 + * this was the last packet and doesn't stop the queue. So the
31532 + * forced switch to default speed from LAP gets through as fast
31533 + * as only some 10 usec later while the UA:RSP is still processed
31534 + * by the hardware and we would get screwed.
31537 + if (ring_first(idev->tx_ring) == NULL) {
31538 + /* no race - tx-ring already empty */
31539 + vlsi_set_baud(idev, iobase);
31540 + netif_wake_queue(ndev);
31544 + /* keep the speed change pending like it would
31545 + * for any len>0 packet. tx completion interrupt
31546 + * will apply it when the tx ring becomes empty.
31548 + spin_unlock_irqrestore(&idev->lock, flags);
31549 + dev_kfree_skb_any(skb);
31553 - /* sanity checks - should never happen!
31554 - * simply BUGging the violation and dropping the packet
31556 + /* sanity checks - simply drop the packet */
31559 - if (!rd) { /* ring full - queue should have been stopped! */
31563 + msg = "ring full, but queue wasn't stopped";
31564 + goto drop_unlock;
31567 - if (rd_is_active(rd)) { /* entry still owned by hw! */
31570 + if (rd_is_active(rd)) {
31571 + msg = "entry still owned by hw";
31572 + goto drop_unlock;
31575 - if (!rd->buf) { /* no memory for this tx entry - weird! */
31579 + msg = "tx ring entry without pci buffer";
31580 + goto drop_unlock;
31583 - if (rd->skb) { /* hm, associated old skb still there */
31587 + msg = "ring entry with old skb still attached";
31588 + goto drop_unlock;
31591 + /* no need for serialization or interrupt disable during mtt */
31592 + spin_unlock_irqrestore(&idev->lock, flags);
31594 + if ((mtt = irda_get_mtt(skb)) > 0) {
31596 + ready.tv_usec = idev->last_rx.tv_usec + mtt;
31597 + ready.tv_sec = idev->last_rx.tv_sec;
31598 + if (ready.tv_usec >= 1000000) {
31599 + ready.tv_usec -= 1000000;
31600 + ready.tv_sec++; /* IrLAP 1.1: mtt always < 1 sec */
31603 + do_gettimeofday(&now);
31604 + if (now.tv_sec > ready.tv_sec
31605 + || (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
31608 + /* must not sleep here - we are called under xmit_lock! */
31612 /* tx buffer already owned by CPU due to pci_dma_sync_single() either
31613 @@ -1089,7 +1096,7 @@
31616 if (len >= r->len-5)
31617 - printk(KERN_WARNING "%s: possible buffer overflow with SIR wrapping!\n",
31618 + WARNING("%s: possible buffer overflow with SIR wrapping!\n",
31622 @@ -1097,34 +1104,13 @@
31623 status |= RD_TX_PULSE; /* send 2 us highspeed indication pulse */
31625 if (len > r->len) {
31626 - printk(KERN_ERR "%s: no space - skb too big (%d)\n",
31627 - __FUNCTION__, skb->len);
31628 + msg = "frame exceeds tx buffer length";
31632 memcpy(rd->buf, skb->data, len);
31635 - /* do mtt delay before we need to disable interrupts! */
31637 - if ((mtt = irda_get_mtt(skb)) > 0) {
31639 - ready.tv_usec = idev->last_rx.tv_usec + mtt;
31640 - ready.tv_sec = idev->last_rx.tv_sec;
31641 - if (ready.tv_usec >= 1000000) {
31642 - ready.tv_usec -= 1000000;
31643 - ready.tv_sec++; /* IrLAP 1.1: mtt always < 1 sec */
31646 - do_gettimeofday(&now);
31647 - if (now.tv_sec > ready.tv_sec
31648 - || (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
31651 - /* must not sleep here - we are called under xmit_lock! */
31655 rd->skb = skb; /* remember skb for tx-complete stats */
31657 rd_set_count(rd, len);
31658 @@ -1136,10 +1122,7 @@
31660 pci_dma_prep_single(r->pdev, rd_get_addr(rd), r->len, r->dir);
31663 - * We need to disable IR output in order to switch to TX mode.
31664 - * Better not do this blindly anytime we want to transmit something
31665 - * because TX may already run. However we are racing with the controller
31666 +/* Switching to TX mode here races with the controller
31667 * which may stop TX at any time when fetching an inactive descriptor
31668 * or one with CLR_ENTX set. So we switch on TX only, if TX was not running
31669 * _after_ the new descriptor was activated on the ring. This ensures
31670 @@ -1158,31 +1141,39 @@
31673 fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
31674 - if (fifocnt != 0)
31675 - printk(KERN_WARNING "%s: rx fifo not empty(%d)\n",
31676 - __FUNCTION__, fifocnt);
31677 + if (fifocnt != 0) {
31678 + IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
31681 config = inw(iobase+VLSI_PIO_IRCFG);
31683 - outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
31685 + outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
31687 outw(0, iobase+VLSI_PIO_PROMPT);
31689 ndev->trans_start = jiffies;
31691 if (ring_put(r) == NULL) {
31692 netif_stop_queue(ndev);
31693 - printk(KERN_DEBUG "%s: tx ring full - queue stopped\n", __FUNCTION__);
31694 + IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __FUNCTION__);
31696 spin_unlock_irqrestore(&idev->lock, flags);
31701 + spin_unlock_irqrestore(&idev->lock, flags);
31703 + WARNING("%s: dropping packet - %s\n", __FUNCTION__, msg);
31704 dev_kfree_skb_any(skb);
31705 idev->stats.tx_errors++;
31706 idev->stats.tx_dropped++;
31708 + /* Don't even think about returning NET_XMIT_DROP (=1) here!
31709 + * In fact any retval!=0 causes the packet scheduler to requeue the
31710 + * packet for later retry of transmission - which isn't exactly
31711 + * what we want after we've just called dev_kfree_skb_any ;-)
31716 static void vlsi_tx_interrupt(struct net_device *ndev)
31717 @@ -1215,12 +1206,12 @@
31721 + iobase = ndev->base_addr;
31723 if (idev->new_baud && rd == NULL) /* tx ring empty and speed change pending */
31724 - vlsi_set_baud_lock(ndev);
31725 + vlsi_set_baud(idev, iobase);
31727 - iobase = ndev->base_addr;
31728 config = inw(iobase+VLSI_PIO_IRCFG);
31730 if (rd == NULL) /* tx ring empty: re-enable rx */
31731 outw((config & ~IRCFG_ENTX) | IRCFG_ENRX, iobase+VLSI_PIO_IRCFG);
31733 @@ -1228,9 +1219,10 @@
31736 fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
31737 - if (fifocnt != 0)
31738 - printk(KERN_WARNING "%s: rx fifo not empty(%d)\n",
31739 + if (fifocnt != 0) {
31740 + IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n",
31741 __FUNCTION__, fifocnt);
31743 outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
31746 @@ -1238,7 +1230,7 @@
31748 if (netif_queue_stopped(ndev) && !idev->new_baud) {
31749 netif_wake_queue(ndev);
31750 - printk(KERN_DEBUG "%s: queue awoken\n", __FUNCTION__);
31751 + IRDA_DEBUG(3, "%s: queue awoken\n", __FUNCTION__);
31755 @@ -1261,7 +1253,7 @@
31756 dev_kfree_skb_any(rd->skb);
31759 - printk(KERN_INFO "%s - dropping tx packet\n", __FUNCTION__);
31760 + IRDA_DEBUG(0, "%s - dropping tx packet\n", __FUNCTION__);
31761 ret = -VLSI_TX_DROP;
31764 @@ -1310,8 +1302,7 @@
31767 if (clksrc == 1) { /* explicitly asked for PLL hence bail out */
31768 - printk(KERN_ERR "%s: no PLL or failed to lock!\n",
31770 + ERROR("%s: no PLL or failed to lock!\n", __FUNCTION__);
31771 clkctl = CLKCTL_CLKSTP;
31772 pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl);
31774 @@ -1319,7 +1310,7 @@
31775 else /* was: clksrc=0(auto) */
31776 clksrc = 3; /* fallback to 40MHz XCLK (OB800) */
31778 - printk(KERN_INFO "%s: PLL not locked, fallback to clksrc=%d\n",
31779 + IRDA_DEBUG(0, "%s: PLL not locked, fallback to clksrc=%d\n",
31780 __FUNCTION__, clksrc);
31783 @@ -1392,9 +1383,7 @@
31784 /* start the clock and clean the registers */
31786 if (vlsi_start_clock(pdev)) {
31787 - printk(KERN_ERR "%s: no valid clock source\n",
31789 - pci_disable_device(pdev);
31790 + ERROR("%s: no valid clock source\n", __FUNCTION__);
31793 iobase = ndev->base_addr;
31794 @@ -1422,7 +1411,7 @@
31795 atomic_set(&idev->tx_ring->head, RINGPTR_GET_TX(ptr));
31796 atomic_set(&idev->tx_ring->tail, RINGPTR_GET_TX(ptr));
31798 - vlsi_set_baud_lock(ndev); /* idev->new_baud used as provided by caller */
31799 + vlsi_set_baud(idev, iobase); /* idev->new_baud used as provided by caller */
31801 outb(IRINTR_INT_MASK, iobase+VLSI_PIO_IRINTR); /* just in case - w/c pending IRQ's */
31803 @@ -1455,7 +1444,10 @@
31804 pci_write_config_byte(pdev, VLSI_PCI_MSTRPAGE, MSTRPAGE_VALUE);
31805 pci_set_master(pdev);
31807 - vlsi_init_chip(pdev);
31808 + if (vlsi_init_chip(pdev) < 0) {
31809 + pci_disable_device(pdev);
31813 vlsi_fill_rx(idev->rx_ring);
31815 @@ -1476,10 +1468,11 @@
31816 spin_lock_irqsave(&idev->lock,flags);
31817 outw(0, iobase+VLSI_PIO_IRENABLE);
31818 outw(0, iobase+VLSI_PIO_IRCFG); /* disable everything */
31821 - outb(IRINTR_INT_MASK, iobase+VLSI_PIO_IRINTR); /* w/c pending + disable further IRQ */
31823 + /* disable and w/c irqs */
31824 + outb(0, iobase+VLSI_PIO_IRINTR);
31826 + outb(IRINTR_INT_MASK, iobase+VLSI_PIO_IRINTR);
31827 spin_unlock_irqrestore(&idev->lock,flags);
31829 vlsi_unarm_tx(idev);
31830 @@ -1521,8 +1514,8 @@
31831 idev->new_baud = idev->baud; /* keep current baudrate */
31833 if (vlsi_start_hw(idev))
31834 - printk(KERN_CRIT "%s: failed to restart hw - %s(%s) unusable!\n",
31835 - __FUNCTION__, pci_name(idev->pdev), ndev->name);
31836 + ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
31837 + __FUNCTION__, PCIDEV_NAME(idev->pdev), ndev->name);
31839 netif_start_queue(ndev);
31841 @@ -1547,7 +1540,7 @@
31842 * if the stack tries to change speed concurrently - which would be
31843 * pretty strange anyway with the userland having full control...
31845 - vlsi_set_baud_nolock(ndev);
31846 + vlsi_set_baud(idev, ndev->base_addr);
31847 spin_unlock_irqrestore(&idev->lock, flags);
31849 case SIOCSMEDIABUSY:
31850 @@ -1566,8 +1559,7 @@
31851 irq->ifr_receiving = (fifocnt!=0) ? 1 : 0;
31854 - printk(KERN_ERR "%s: notsupp - cmd=%04x\n",
31855 - __FUNCTION__, cmd);
31856 + WARNING("%s: notsupp - cmd=%04x\n", __FUNCTION__, cmd);
31860 @@ -1583,41 +1575,36 @@
31861 vlsi_irda_dev_t *idev = ndev->priv;
31864 - int boguscount = 32;
31865 - unsigned got_act;
31866 + int boguscount = 5;
31867 unsigned long flags;
31871 iobase = ndev->base_addr;
31872 + spin_lock_irqsave(&idev->lock,flags);
31874 - spin_lock_irqsave(&idev->lock,flags);
31875 irintr = inb(iobase+VLSI_PIO_IRINTR);
31877 - outb(irintr, iobase+VLSI_PIO_IRINTR); /* acknowledge asap */
31878 - spin_unlock_irqrestore(&idev->lock,flags);
31880 + outb(irintr, iobase+VLSI_PIO_IRINTR); /* acknowledge asap */
31882 if (!(irintr&=IRINTR_INT_MASK)) /* not our INT - probably shared */
31887 + if (unlikely(!(irintr & ~IRINTR_ACTIVITY)))
31888 + break; /* nothing todo if only activity */
31890 if (irintr&IRINTR_RPKTINT)
31891 vlsi_rx_interrupt(ndev);
31893 if (irintr&IRINTR_TPKTINT)
31894 vlsi_tx_interrupt(ndev);
31896 - if (!(irintr & ~IRINTR_ACTIVITY))
31897 - break; /* done if only activity remaining */
31899 - if (irintr & ~(IRINTR_RPKTINT|IRINTR_TPKTINT|IRINTR_ACTIVITY)) {
31900 - printk(KERN_DEBUG "%s: IRINTR = %02x\n",
31901 - __FUNCTION__, (unsigned)irintr);
31902 - vlsi_reg_debug(iobase,__FUNCTION__);
31904 } while (--boguscount > 0);
31905 + spin_unlock_irqrestore(&idev->lock,flags);
31907 if (boguscount <= 0)
31908 - printk(KERN_WARNING "%s: too much work in interrupt!\n", __FUNCTION__);
31909 + MESSAGE("%s: too much work in interrupt!\n", __FUNCTION__);
31910 return IRQ_RETVAL(handled);
31913 @@ -1630,7 +1617,7 @@
31916 if (pci_request_regions(idev->pdev, drivername)) {
31917 - printk(KERN_ERR "%s: io resource busy\n", __FUNCTION__);
31918 + WARNING("%s: io resource busy\n", __FUNCTION__);
31921 ndev->base_addr = pci_resource_start(idev->pdev,0);
31922 @@ -1644,8 +1631,7 @@
31924 if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ,
31925 drivername, ndev)) {
31926 - printk(KERN_ERR "%s: couldn't get IRQ: %d\n",
31927 - __FUNCTION__, ndev->irq);
31928 + WARNING("%s: couldn't get IRQ: %d\n", __FUNCTION__, ndev->irq);
31932 @@ -1666,7 +1652,7 @@
31934 netif_start_queue(ndev);
31936 - printk(KERN_INFO "%s: device %s operational\n", __FUNCTION__, ndev->name);
31937 + MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name);
31941 @@ -1700,7 +1686,7 @@
31943 pci_release_regions(idev->pdev);
31945 - printk(KERN_INFO "%s: device %s stopped\n", __FUNCTION__, ndev->name);
31946 + MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name);
31950 @@ -1721,8 +1707,7 @@
31952 if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW)
31953 || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) {
31954 - printk(KERN_ERR "%s: aborting due to PCI BM-DMA address limitations\n",
31956 + ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__);
31960 @@ -1771,12 +1756,12 @@
31962 pdev->current_state = 0; /* hw must be running now */
31964 - printk(KERN_INFO "%s: IrDA PCI controller %s detected\n",
31965 - drivername, pci_name(pdev));
31966 + MESSAGE("%s: IrDA PCI controller %s detected\n",
31967 + drivername, PCIDEV_NAME(pdev));
31969 if ( !pci_resource_start(pdev,0)
31970 || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
31971 - printk(KERN_ERR "%s: bar 0 invalid", __FUNCTION__);
31972 + ERROR("%s: bar 0 invalid", __FUNCTION__);
31976 @@ -1784,8 +1769,7 @@
31978 ndev = (struct net_device *) kmalloc (alloc_size, GFP_KERNEL);
31980 - printk(KERN_ERR "%s: Unable to allocate device memory.\n",
31982 + ERROR("%s: Unable to allocate device memory.\n", __FUNCTION__);
31986 @@ -1801,37 +1785,33 @@
31987 ndev->init = vlsi_irda_init;
31988 strcpy(ndev->name,"irda%d");
31989 if (register_netdev(ndev)) {
31990 - printk(KERN_ERR "%s: register_netdev failed\n",
31992 + ERROR("%s: register_netdev failed\n", __FUNCTION__);
31996 + idev->proc_entry = NULL;
31997 if (vlsi_proc_root != NULL) {
31998 struct proc_dir_entry *ent;
32000 ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root);
32002 - printk(KERN_ERR "%s: failed to create proc entry\n", __FUNCTION__);
32003 - goto out_unregister;
32004 + WARNING("%s: failed to create proc entry\n", __FUNCTION__);
32005 + idev->proc_entry = NULL;
32007 - ent->data = ndev;
32008 - ent->proc_fops = VLSI_PROC_FOPS;
32010 - idev->proc_entry = ent;
32012 - idev->proc_entry = NULL;
32014 - printk(KERN_INFO "%s: registered device %s\n", drivername, ndev->name);
32016 + ent->data = ndev;
32017 + ent->proc_fops = VLSI_PROC_FOPS;
32019 + idev->proc_entry = ent;
32022 + MESSAGE("%s: registered device %s\n", drivername, ndev->name);
32024 pci_set_drvdata(pdev, ndev);
32031 - unregister_netdev(ndev);
32032 - goto out_disable;
32036 @@ -1848,14 +1828,12 @@
32037 vlsi_irda_dev_t *idev;
32040 - printk(KERN_CRIT "%s: lost netdevice?\n", drivername);
32041 + ERROR("%s: lost netdevice?\n", drivername);
32047 - pci_set_drvdata(pdev, NULL);
32048 - pci_disable_device(pdev);
32049 if (idev->proc_entry) {
32050 remove_proc_entry(ndev->name, vlsi_proc_root);
32051 idev->proc_entry = NULL;
32052 @@ -1867,7 +1845,9 @@
32053 * ndev->destructor called (if present) when going to free
32056 - printk(KERN_INFO "%s: %s removed\n", drivername, pci_name(pdev));
32057 + pci_set_drvdata(pdev, NULL);
32059 + MESSAGE("%s: %s removed\n", drivername, PCIDEV_NAME(pdev));
32063 @@ -1882,8 +1862,8 @@
32064 static int vlsi_irda_save_state(struct pci_dev *pdev, u32 state)
32066 if (state < 1 || state > 3 ) {
32067 - printk( KERN_ERR "%s - %s: invalid pm state request: %u\n",
32068 - __FUNCTION__, pci_name(pdev), state);
32069 + ERROR("%s - %s: invalid pm state request: %u\n",
32070 + __FUNCTION__, PCIDEV_NAME(pdev), state);
32074 @@ -1895,12 +1875,12 @@
32075 vlsi_irda_dev_t *idev;
32077 if (state < 1 || state > 3 ) {
32078 - printk( KERN_ERR "%s - %s: invalid pm state request: %u\n",
32079 - __FUNCTION__, pci_name(pdev), state);
32080 + ERROR("%s - %s: invalid pm state request: %u\n",
32081 + __FUNCTION__, PCIDEV_NAME(pdev), state);
32085 - printk(KERN_ERR "%s - %s: no netdevice \n", __FUNCTION__, pci_name(pdev));
32086 + ERROR("%s - %s: no netdevice \n", __FUNCTION__, PCIDEV_NAME(pdev));
32090 @@ -1911,8 +1891,8 @@
32091 pdev->current_state = state;
32094 - printk(KERN_ERR "%s - %s: invalid suspend request %u -> %u\n",
32095 - __FUNCTION__, pci_name(pdev), pdev->current_state, state);
32096 + ERROR("%s - %s: invalid suspend request %u -> %u\n",
32097 + __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state);
32101 @@ -1939,14 +1919,14 @@
32102 vlsi_irda_dev_t *idev;
32105 - printk(KERN_ERR "%s - %s: no netdevice \n", __FUNCTION__, pci_name(pdev));
32106 + ERROR("%s - %s: no netdevice \n", __FUNCTION__, PCIDEV_NAME(pdev));
32111 if (pdev->current_state == 0) {
32113 - printk(KERN_ERR "%s - %s: already resumed\n", __FUNCTION__, pci_name(pdev));
32114 + WARNING("%s - %s: already resumed\n", __FUNCTION__, PCIDEV_NAME(pdev));
32118 @@ -1965,7 +1945,7 @@
32119 * now we explicitly set pdev->current_state = 0 after enabling the
32120 * device and independently resume_ok should catch any garbage config.
32122 - printk(KERN_ERR "%s - hm, nothing to resume?\n", __FUNCTION__);
32123 + WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
32127 @@ -2003,7 +1983,7 @@
32130 if (clksrc < 0 || clksrc > 3) {
32131 - printk(KERN_ERR "%s: invalid clksrc=%d\n", drivername, clksrc);
32132 + ERROR("%s: invalid clksrc=%d\n", drivername, clksrc);
32136 @@ -2016,9 +1996,8 @@
32140 - printk(KERN_WARNING "%s: invalid %s ringsize %d",
32141 + WARNING("%s: invalid %s ringsize %d, using default=8",
32142 drivername, (i)?"rx":"tx", ringsize[i]);
32143 - printk(", using default=8\n");
32147 diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
32148 --- a/drivers/net/ixgb/ixgb_main.c Tue Aug 19 20:53:16 2003
32149 +++ b/drivers/net/ixgb/ixgb_main.c Sun Aug 31 08:08:53 2003
32150 @@ -1914,10 +1914,8 @@
32151 skb->protocol = eth_type_trans(skb, netdev);
32153 && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
32154 - vlan_hwaccel_rx(skb, adapter->vlgrp,
32157 - IXGB_RX_DESC_SPECIAL_VLAN_MASK));
32158 + vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
32159 + (rx_desc-> special & IXGB_RX_DESC_SPECIAL_VLAN_MASK));
32161 netif_receive_skb(skb);
32163 diff -Nru a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
32164 --- a/drivers/net/ne2k-pci.c Tue Aug 19 20:53:16 2003
32165 +++ b/drivers/net/ne2k-pci.c Mon Sep 1 10:03:04 2003
32166 @@ -174,7 +174,7 @@
32167 struct sk_buff *skb, int ring_offset);
32168 static void ne2k_pci_block_output(struct net_device *dev, const int count,
32169 const unsigned char *buf, const int start_page);
32170 -static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32171 +static struct ethtool_ops ne2k_pci_ethtool_ops;
32175 @@ -259,7 +259,8 @@
32179 - dev = alloc_etherdev(0);
32180 + /* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */
32181 + dev = alloc_ei_netdev();
32183 printk (KERN_ERR PFX "cannot allocate ethernet device\n");
32184 goto err_out_free_res;
32185 @@ -331,13 +332,6 @@
32186 dev->base_addr = ioaddr;
32187 pci_set_drvdata(pdev, dev);
32189 - /* Allocate dev->priv and fill in 8390 specific dev fields. */
32190 - if (ethdev_init(dev)) {
32191 - printk (KERN_ERR "ne2kpci(%s): unable to get memory for dev->priv.\n",
32193 - goto err_out_free_netdev;
32196 ei_status.name = pci_clone_list[chip_idx].name;
32197 ei_status.tx_start_page = start_page;
32198 ei_status.stop_page = stop_page;
32199 @@ -361,12 +355,12 @@
32200 ei_status.priv = (unsigned long) pdev;
32201 dev->open = &ne2k_pci_open;
32202 dev->stop = &ne2k_pci_close;
32203 - dev->do_ioctl = &netdev_ioctl;
32204 + dev->ethtool_ops = &ne2k_pci_ethtool_ops;
32205 NS8390_init(dev, 0);
32207 i = register_netdev(dev);
32209 - goto err_out_free_8390;
32210 + goto err_out_free_netdev;
32212 printk("%s: %s found at %#lx, IRQ %d, ",
32213 dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);
32214 @@ -377,10 +371,8 @@
32218 -err_out_free_8390:
32219 - kfree(dev->priv);
32220 err_out_free_netdev:
32222 + free_netdev (dev);
32224 release_region (ioaddr, NE_IO_EXTENT);
32225 pci_set_drvdata (pdev, NULL);
32226 @@ -591,41 +583,23 @@
32230 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
32231 +static void ne2k_pci_get_drvinfo(struct net_device *dev,
32232 + struct ethtool_drvinfo *info)
32234 struct ei_device *ei = dev->priv;
32235 struct pci_dev *pci_dev = (struct pci_dev *) ei->priv;
32238 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
32241 - switch (ethcmd) {
32242 - case ETHTOOL_GDRVINFO: {
32243 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
32244 - strcpy(info.driver, DRV_NAME);
32245 - strcpy(info.version, DRV_VERSION);
32246 - strcpy(info.bus_info, pci_name(pci_dev));
32247 - if (copy_to_user(useraddr, &info, sizeof(info)))
32254 - return -EOPNOTSUPP;
32257 -static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32260 - case SIOCETHTOOL:
32261 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32263 - return -EOPNOTSUPP;
32265 + strcpy(info->driver, DRV_NAME);
32266 + strcpy(info->version, DRV_VERSION);
32267 + strcpy(info->bus_info, pci_name(pci_dev));
32270 +static struct ethtool_ops ne2k_pci_ethtool_ops = {
32271 + .get_drvinfo = ne2k_pci_get_drvinfo,
32272 + .get_tx_csum = ethtool_op_get_tx_csum,
32273 + .get_sg = ethtool_op_get_sg,
32276 static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
32278 struct net_device *dev = pci_get_drvdata(pdev);
32279 @@ -635,8 +609,8 @@
32281 unregister_netdev(dev);
32282 release_region(dev->base_addr, NE_IO_EXTENT);
32283 - kfree(dev->priv);
32285 + pci_disable_device(pdev);
32286 pci_set_drvdata(pdev, NULL);
32289 diff -Nru a/drivers/net/ni5010.c b/drivers/net/ni5010.c
32290 --- a/drivers/net/ni5010.c Sun Apr 20 23:00:41 2003
32291 +++ b/drivers/net/ni5010.c Sun Aug 31 16:14:15 2003
32293 struct net_device_stats stats;
32299 /* Index to functions, as function prototypes. */
32300 @@ -280,11 +281,16 @@
32301 /* DMA is not supported (yet?), so no use detecting it */
32303 if (dev->priv == NULL) {
32304 + struct ni5010_local* lp;
32306 dev->priv = kmalloc(sizeof(struct ni5010_local), GFP_KERNEL|GFP_DMA);
32307 if (dev->priv == NULL) {
32308 printk(KERN_WARNING "%s: Failed to allocate private memory\n", dev->name);
32312 + lp = (struct ni5010_local*)dev->priv;
32313 + spin_lock_init(&lp->lock);
32316 PRINTK2((KERN_DEBUG "%s: I/O #10 passed!\n", dev->name));
32317 @@ -463,6 +469,7 @@
32318 ioaddr = dev->base_addr;
32319 lp = (struct ni5010_local *)dev->priv;
32321 + spin_lock(&lp->lock);
32322 status = inb(IE_ISTAT);
32323 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status));
32325 @@ -479,6 +486,7 @@
32327 if (!xmit_was_error)
32328 reset_receiver(dev);
32329 + spin_unlock(&lp->lock);
32330 return IRQ_HANDLED;
32333 @@ -693,8 +701,7 @@
32334 buf_offs = NI5010_BUFSIZE - length - pad;
32335 lp->o_pkt_size = length + pad;
32337 - save_flags(flags);
32339 + spin_lock_irqsave(&lp->lock, flags);
32341 outb(0, EDLC_RMASK); /* Mask all receive interrupts */
32342 outb(0, IE_MMODE); /* Put Xmit buffer on system bus */
32343 @@ -712,7 +719,7 @@
32344 outb(MM_EN_XMT | MM_MUX, IE_MMODE); /* Begin transmission */
32345 outb(XM_ALL, EDLC_XMASK); /* Cause interrupt after completion or fail */
32347 - restore_flags(flags);
32348 + spin_unlock_irqrestore(&lp->lock, flags);
32350 netif_wake_queue(dev);
32352 diff -Nru a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
32353 --- a/drivers/net/pcmcia/3c574_cs.c Tue Aug 19 20:55:09 2003
32354 +++ b/drivers/net/pcmcia/3c574_cs.c Sun Aug 31 05:20:57 2003
32355 @@ -253,6 +253,7 @@
32356 static int el3_close(struct net_device *dev);
32357 static void el3_tx_timeout(struct net_device *dev);
32358 static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32359 +static struct ethtool_ops netdev_ethtool_ops;
32360 static void set_rx_mode(struct net_device *dev);
32362 static dev_info_t dev_info = "3c574_cs";
32363 @@ -319,6 +320,7 @@
32364 dev->hard_start_xmit = &el3_start_xmit;
32365 dev->get_stats = &el3_get_stats;
32366 dev->do_ioctl = &el3_ioctl;
32367 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32368 dev->set_multicast_list = &set_rx_mode;
32369 dev->open = &el3_open;
32370 dev->stop = &el3_close;
32371 @@ -1202,26 +1204,16 @@
32375 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
32376 +static void netdev_get_drvinfo(struct net_device *dev,
32377 + struct ethtool_drvinfo *info)
32381 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
32384 - switch (ethcmd) {
32385 - case ETHTOOL_GDRVINFO: {
32386 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
32387 - strncpy(info.driver, "3c574_cs", sizeof(info.driver)-1);
32388 - if (copy_to_user(useraddr, &info, sizeof(info)))
32394 - return -EOPNOTSUPP;
32395 + strcpy(info->driver, "3c574_cs");
32398 +static struct ethtool_ops netdev_ethtool_ops = {
32399 + .get_drvinfo = netdev_get_drvinfo,
32402 /* Provide ioctl() calls to examine the MII xcvr state. */
32403 static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32405 @@ -1235,11 +1227,9 @@
32406 data[0], data[1], data[2], data[3]);
32409 - case SIOCETHTOOL:
32410 - return netdev_ethtool_ioctl(dev, (void *)rq->ifr_data);
32411 - case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
32412 + case SIOCGMIIPHY: /* Get the address of the PHY in use. */
32414 - case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
32415 + case SIOCGMIIREG: /* Read the specified MII register. */
32418 unsigned long flags;
32419 @@ -1252,7 +1242,7 @@
32420 spin_unlock_irqrestore(&lp->window_lock, flags);
32423 - case SIOCDEVPRIVATE+2: /* Write the specified MII register */
32424 + case SIOCSMIIREG: /* Write the specified MII register */
32427 unsigned long flags;
32428 diff -Nru a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
32429 --- a/drivers/net/pcmcia/3c589_cs.c Tue Aug 19 20:55:09 2003
32430 +++ b/drivers/net/pcmcia/3c589_cs.c Tue Aug 26 14:27:07 2003
32431 @@ -165,7 +165,7 @@
32432 static int el3_close(struct net_device *dev);
32433 static void el3_tx_timeout(struct net_device *dev);
32434 static void set_multicast_list(struct net_device *dev);
32435 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
32436 +static struct ethtool_ops netdev_ethtool_ops;
32438 static dev_info_t dev_info = "3c589_cs";
32440 @@ -249,7 +249,7 @@
32441 dev->tx_timeout = el3_tx_timeout;
32442 dev->watchdog_timeo = TX_TIMEOUT;
32444 - dev->do_ioctl = netdev_ioctl;
32445 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32447 /* Register with Card Services */
32448 link->next = dev_list;
32449 @@ -639,70 +639,33 @@
32450 | AdapterFailure, ioaddr + EL3_CMD);
32453 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
32454 +static void netdev_get_drvinfo(struct net_device *dev,
32455 + struct ethtool_drvinfo *info)
32459 - /* dev_ioctl() in ../../net/core/dev.c has already checked
32460 - capable(CAP_NET_ADMIN), so don't bother with that here. */
32462 - if (get_user(ethcmd, (u32 *)useraddr))
32465 - switch (ethcmd) {
32467 - case ETHTOOL_GDRVINFO: {
32468 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
32469 - strcpy (info.driver, DRV_NAME);
32470 - strcpy (info.version, DRV_VERSION);
32471 - sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
32472 - if (copy_to_user (useraddr, &info, sizeof (info)))
32476 + strcpy(info->driver, DRV_NAME);
32477 + strcpy(info->version, DRV_VERSION);
32478 + sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
32481 #ifdef PCMCIA_DEBUG
32482 - /* get message-level */
32483 - case ETHTOOL_GMSGLVL: {
32484 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
32485 - edata.data = pc_debug;
32486 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
32490 - /* set message-level */
32491 - case ETHTOOL_SMSGLVL: {
32492 - struct ethtool_value edata;
32493 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
32495 - pc_debug = edata.data;
32504 - return -EOPNOTSUPP;
32505 +static u32 netdev_get_msglevel(struct net_device *dev)
32510 -static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
32511 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
32516 - case SIOCETHTOOL:
32517 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32521 - rc = -EOPNOTSUPP;
32526 + pc_debug = level;
32528 +#endif /* PCMCIA_DEBUG */
32530 +static struct ethtool_ops netdev_ethtool_ops = {
32531 + .get_drvinfo = netdev_get_drvinfo,
32532 +#ifdef PCMCIA_DEBUG
32533 + .get_msglevel = netdev_get_msglevel,
32534 + .set_msglevel = netdev_set_msglevel,
32535 +#endif /* PCMCIA_DEBUG */
32538 static int el3_config(struct net_device *dev, struct ifmap *map)
32540 diff -Nru a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
32541 --- a/drivers/net/pcmcia/axnet_cs.c Tue Aug 19 20:55:09 2003
32542 +++ b/drivers/net/pcmcia/axnet_cs.c Sun Aug 31 05:20:58 2003
32544 static int axnet_open(struct net_device *dev);
32545 static int axnet_close(struct net_device *dev);
32546 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32547 +static struct ethtool_ops netdev_ethtool_ops;
32548 static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
32549 static void ei_watchdog(u_long arg);
32550 static void axnet_reset_8390(struct net_device *dev);
32551 @@ -209,6 +210,7 @@
32552 dev->open = &axnet_open;
32553 dev->stop = &axnet_close;
32554 dev->do_ioctl = &axnet_ioctl;
32555 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32557 /* Register with Card Services */
32558 link->next = dev_list;
32559 @@ -807,26 +809,16 @@
32560 add_timer(&info->watchdog);
32563 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
32564 +static void netdev_get_drvinfo(struct net_device *dev,
32565 + struct ethtool_drvinfo *info)
32569 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
32572 - switch (ethcmd) {
32573 - case ETHTOOL_GDRVINFO: {
32574 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
32575 - strncpy(info.driver, "axnet_cs", sizeof(info.driver)-1);
32576 - if (copy_to_user(useraddr, &info, sizeof(info)))
32582 - return -EOPNOTSUPP;
32583 + strcpy(info->driver, "axnet_cs");
32586 +static struct ethtool_ops netdev_ethtool_ops = {
32587 + .get_drvinfo = netdev_get_drvinfo,
32590 /*====================================================================*/
32592 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32593 @@ -835,14 +827,12 @@
32594 u16 *data = (u16 *)&rq->ifr_data;
32595 ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
32597 - case SIOCETHTOOL:
32598 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32599 - case SIOCDEVPRIVATE:
32600 + case SIOCGMIIPHY:
32601 data[0] = info->phy_id;
32602 - case SIOCDEVPRIVATE+1:
32603 + case SIOCGMIIREG: /* Read MII PHY register. */
32604 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
32606 - case SIOCDEVPRIVATE+2:
32607 + case SIOCSMIIREG: /* Write MII PHY register. */
32608 if (!capable(CAP_NET_ADMIN))
32610 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
32611 diff -Nru a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
32612 --- a/drivers/net/pcmcia/fmvj18x_cs.c Tue Aug 19 20:55:09 2003
32613 +++ b/drivers/net/pcmcia/fmvj18x_cs.c Tue Aug 26 14:51:25 2003
32614 @@ -113,7 +113,7 @@
32615 static struct net_device_stats *fjn_get_stats(struct net_device *dev);
32616 static void set_rx_mode(struct net_device *dev);
32617 static void fjn_tx_timeout(struct net_device *dev);
32618 -static int fjn_ioctl(struct net_device *, struct ifreq *, int);
32619 +static struct ethtool_ops netdev_ethtool_ops;
32621 static dev_info_t dev_info = "fmvj18x_cs";
32622 static dev_link_t *dev_list;
32623 @@ -312,7 +312,7 @@
32624 dev->tx_timeout = fjn_tx_timeout;
32625 dev->watchdog_timeo = TX_TIMEOUT;
32627 - dev->do_ioctl = fjn_ioctl;
32628 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32630 /* Register with Card Services */
32631 link->next = dev_list;
32632 @@ -1186,64 +1186,33 @@
32634 /*====================================================================*/
32636 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
32637 +static void netdev_get_drvinfo(struct net_device *dev,
32638 + struct ethtool_drvinfo *info)
32642 - /* dev_ioctl() in ../../net/core/dev.c has already checked
32643 - capable(CAP_NET_ADMIN), so don't bother with that here. */
32645 - if (get_user(ethcmd, (u32 *)useraddr))
32648 - switch (ethcmd) {
32650 - case ETHTOOL_GDRVINFO: {
32651 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
32652 - strcpy (info.driver, DRV_NAME);
32653 - strcpy (info.version, DRV_VERSION);
32654 - sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
32655 - if (copy_to_user (useraddr, &info, sizeof (info)))
32659 + strcpy(info->driver, DRV_NAME);
32660 + strcpy(info->version, DRV_VERSION);
32661 + sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
32664 #ifdef PCMCIA_DEBUG
32665 - /* get message-level */
32666 - case ETHTOOL_GMSGLVL: {
32667 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
32668 - edata.data = pc_debug;
32669 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
32673 - /* set message-level */
32674 - case ETHTOOL_SMSGLVL: {
32675 - struct ethtool_value edata;
32676 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
32678 - pc_debug = edata.data;
32687 - return -EOPNOTSUPP;
32688 +static u32 netdev_get_msglevel(struct net_device *dev)
32693 -static int fjn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32694 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
32697 - case SIOCETHTOOL:
32698 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32701 - return -EOPNOTSUPP;
32703 + pc_debug = level;
32705 +#endif /* PCMCIA_DEBUG */
32707 +static struct ethtool_ops netdev_ethtool_ops = {
32708 + .get_drvinfo = netdev_get_drvinfo,
32709 +#ifdef PCMCIA_DEBUG
32710 + .get_msglevel = netdev_get_msglevel,
32711 + .set_msglevel = netdev_set_msglevel,
32712 +#endif /* PCMCIA_DEBUG */
32715 static int fjn_config(struct net_device *dev, struct ifmap *map){
32717 diff -Nru a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
32718 --- a/drivers/net/pcmcia/ibmtr_cs.c Tue Aug 19 20:55:09 2003
32719 +++ b/drivers/net/pcmcia/ibmtr_cs.c Tue Aug 26 14:51:25 2003
32720 @@ -157,36 +157,15 @@
32724 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
32725 +static void netdev_get_drvinfo(struct net_device *dev,
32726 + struct ethtool_drvinfo *info)
32730 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
32733 - switch (ethcmd) {
32734 - case ETHTOOL_GDRVINFO: {
32735 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
32736 - strncpy(info.driver, "ibmtr_cs", sizeof(info.driver)-1);
32737 - if (copy_to_user(useraddr, &info, sizeof(info)))
32743 - return -EOPNOTSUPP;
32744 + strcpy(info->driver, "ibmtr_cs");
32747 -static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32751 - case SIOCETHTOOL:
32752 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32754 - return -EOPNOTSUPP;
32757 +static struct ethtool_ops netdev_ethtool_ops = {
32758 + .get_drvinfo = netdev_get_drvinfo,
32761 /*======================================================================
32763 @@ -235,7 +214,7 @@
32764 link->irq.Instance = info->dev = dev;
32766 dev->init = &ibmtr_probe;
32767 - dev->do_ioctl = &private_ioctl;
32768 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32770 /* Register with Card Services */
32771 link->next = dev_list;
32772 diff -Nru a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
32773 --- a/drivers/net/pcmcia/nmclan_cs.c Tue Aug 19 20:55:09 2003
32774 +++ b/drivers/net/pcmcia/nmclan_cs.c Tue Aug 26 14:51:25 2003
32775 @@ -442,7 +442,8 @@
32776 static int mace_rx(struct net_device *dev, unsigned char RxCnt);
32777 static void restore_multicast_list(struct net_device *dev);
32778 static void set_multicast_list(struct net_device *dev);
32779 -static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32780 +static struct ethtool_ops netdev_ethtool_ops;
32783 static dev_link_t *nmclan_attach(void);
32784 static void nmclan_detach(dev_link_t *);
32785 @@ -515,7 +516,7 @@
32786 dev->set_config = &mace_config;
32787 dev->get_stats = &mace_get_stats;
32788 dev->set_multicast_list = &set_multicast_list;
32789 - dev->do_ioctl = &mace_ioctl;
32790 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32791 dev->open = &mace_open;
32792 dev->stop = &mace_close;
32793 #ifdef HAVE_TX_TIMEOUT
32794 @@ -1014,65 +1015,33 @@
32798 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
32799 +static void netdev_get_drvinfo(struct net_device *dev,
32800 + struct ethtool_drvinfo *info)
32804 - /* dev_ioctl() in ../../net/core/dev.c has already checked
32805 - capable(CAP_NET_ADMIN), so don't bother with that here. */
32807 - if (get_user(ethcmd, (u32 *)useraddr))
32810 - switch (ethcmd) {
32812 - case ETHTOOL_GDRVINFO: {
32813 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
32814 - strcpy (info.driver, DRV_NAME);
32815 - strcpy (info.version, DRV_VERSION);
32816 - sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
32817 - if (copy_to_user (useraddr, &info, sizeof (info)))
32821 + strcpy(info->driver, DRV_NAME);
32822 + strcpy(info->version, DRV_VERSION);
32823 + sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
32826 #ifdef PCMCIA_DEBUG
32827 - /* get message-level */
32828 - case ETHTOOL_GMSGLVL: {
32829 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
32830 - edata.data = pc_debug;
32831 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
32835 - /* set message-level */
32836 - case ETHTOOL_SMSGLVL: {
32837 - struct ethtool_value edata;
32838 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
32840 - pc_debug = edata.data;
32849 - return -EOPNOTSUPP;
32850 +static u32 netdev_get_msglevel(struct net_device *dev)
32855 -static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
32856 +static void netdev_set_msglevel(struct net_device *dev, u32 level)
32859 - case SIOCETHTOOL:
32860 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32863 - return -EOPNOTSUPP;
32866 + pc_debug = level;
32868 +#endif /* PCMCIA_DEBUG */
32870 +static struct ethtool_ops netdev_ethtool_ops = {
32871 + .get_drvinfo = netdev_get_drvinfo,
32872 +#ifdef PCMCIA_DEBUG
32873 + .get_msglevel = netdev_get_msglevel,
32874 + .set_msglevel = netdev_set_msglevel,
32875 +#endif /* PCMCIA_DEBUG */
32878 /* ----------------------------------------------------------------------------
32880 diff -Nru a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
32881 --- a/drivers/net/pcmcia/pcnet_cs.c Tue Aug 19 20:55:09 2003
32882 +++ b/drivers/net/pcmcia/pcnet_cs.c Sun Aug 31 05:20:58 2003
32883 @@ -116,7 +116,7 @@
32884 static int pcnet_open(struct net_device *dev);
32885 static int pcnet_close(struct net_device *dev);
32886 static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32887 -static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd);
32888 +static struct ethtool_ops netdev_ethtool_ops;
32889 static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
32890 static void ei_watchdog(u_long arg);
32891 static void pcnet_reset_8390(struct net_device *dev);
32892 @@ -756,6 +756,7 @@
32894 strcpy(info->node.dev_name, dev->name);
32895 link->dev = &info->node;
32896 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32898 if (info->flags & (IS_DL10019|IS_DL10022)) {
32899 u_char id = inb(dev->base_addr + 0x1a);
32900 @@ -769,7 +770,6 @@
32903 printk(KERN_INFO "%s: NE2000 Compatible: ", dev->name);
32904 - dev->do_ioctl = &do_ioctl_light;
32906 printk("io %#3lx, irq %d,", dev->base_addr, dev->irq);
32907 if (info->flags & USE_SHMEM)
32908 @@ -1205,26 +1205,16 @@
32910 /*====================================================================*/
32912 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
32913 +static void netdev_get_drvinfo(struct net_device *dev,
32914 + struct ethtool_drvinfo *info)
32918 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
32921 - switch (ethcmd) {
32922 - case ETHTOOL_GDRVINFO: {
32923 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
32924 - strncpy(info.driver, "pcnet_cs", sizeof(info.driver)-1);
32925 - if (copy_to_user(useraddr, &info, sizeof(info)))
32931 - return -EOPNOTSUPP;
32932 + strcpy(info->driver, "pcnet_cs");
32935 +static struct ethtool_ops netdev_ethtool_ops = {
32936 + .get_drvinfo = netdev_get_drvinfo,
32939 /*====================================================================*/
32942 @@ -1234,31 +1224,18 @@
32943 u16 *data = (u16 *)&rq->ifr_data;
32944 ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO;
32946 - case SIOCETHTOOL:
32947 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32948 - case SIOCDEVPRIVATE:
32949 + case SIOCGMIIPHY:
32950 data[0] = info->phy_id;
32951 - case SIOCDEVPRIVATE+1:
32952 + case SIOCGMIIREG: /* Read MII PHY register. */
32953 data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
32955 - case SIOCDEVPRIVATE+2:
32956 + case SIOCSMIIREG: /* Write MII PHY register. */
32957 if (!capable(CAP_NET_ADMIN))
32959 mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
32962 return -EOPNOTSUPP;
32965 -/*====================================================================*/
32967 -static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd)
32970 - case SIOCETHTOOL:
32971 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
32973 - return -EOPNOTSUPP;
32976 /*====================================================================*/
32977 diff -Nru a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
32978 --- a/drivers/net/pcmcia/xirc2ps_cs.c Tue Aug 19 20:55:09 2003
32979 +++ b/drivers/net/pcmcia/xirc2ps_cs.c Sun Aug 31 05:20:58 2003
32980 @@ -382,6 +382,7 @@
32981 static int do_config(struct net_device *dev, struct ifmap *map);
32982 static int do_open(struct net_device *dev);
32983 static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
32984 +static struct ethtool_ops netdev_ethtool_ops;
32985 static void hardreset(struct net_device *dev);
32986 static void do_reset(struct net_device *dev, int full);
32987 static int init_mii(struct net_device *dev);
32988 @@ -626,6 +627,7 @@
32989 dev->set_config = &do_config;
32990 dev->get_stats = &do_get_stats;
32991 dev->do_ioctl = &do_ioctl;
32992 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
32993 dev->set_multicast_list = &set_multicast_list;
32994 dev->open = &do_open;
32995 dev->stop = &do_stop;
32996 @@ -1699,26 +1701,16 @@
33000 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
33001 +static void netdev_get_drvinfo(struct net_device *dev,
33002 + struct ethtool_drvinfo *info)
33006 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
33009 - switch (ethcmd) {
33010 - case ETHTOOL_GDRVINFO: {
33011 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
33012 - strncpy(info.driver, "xirc2ps_cs", sizeof(info.driver)-1);
33013 - if (copy_to_user(useraddr, &info, sizeof(info)))
33019 - return -EOPNOTSUPP;
33020 + strcpy(info->driver, "xirc2ps_cs");
33023 +static struct ethtool_ops netdev_ethtool_ops = {
33024 + .get_drvinfo = netdev_get_drvinfo,
33028 do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
33030 @@ -1734,15 +1726,13 @@
33031 return -EOPNOTSUPP;
33034 - case SIOCETHTOOL:
33035 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
33036 - case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
33037 + case SIOCGMIIPHY: /* Get the address of the PHY in use. */
33038 data[0] = 0; /* we have only this address */
33040 - case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
33041 + case SIOCGMIIREG: /* Read the specified MII register. */
33042 data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
33044 - case SIOCDEVPRIVATE+2: /* Write the specified MII register */
33045 + case SIOCSMIIREG: /* Write the specified MII register */
33046 if (!capable(CAP_NET_ADMIN))
33048 mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
33049 diff -Nru a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
33050 --- a/drivers/net/pcnet32.c Tue Aug 19 20:53:16 2003
33051 +++ b/drivers/net/pcnet32.c Sun Aug 31 16:14:08 2003
33052 @@ -1726,6 +1726,7 @@
33053 /* An additional parameter that may be passed in... */
33054 static int debug = -1;
33055 static int tx_start_pt = -1;
33056 +static int pcnet32_have_pci;
33058 static int __init pcnet32_init_module(void)
33060 @@ -1738,7 +1739,8 @@
33061 tx_start = tx_start_pt;
33063 /* find the PCI devices */
33064 - pci_module_init(&pcnet32_driver);
33065 + if (!pci_module_init(&pcnet32_driver))
33066 + pcnet32_have_pci = 1;
33068 /* should we find any remaining VLbus devices ? */
33070 @@ -1747,7 +1749,7 @@
33072 printk(KERN_INFO PFX "%d cards_found.\n", cards_found);
33074 - return cards_found ? 0 : -ENODEV;
33075 + return (pcnet32_have_pci + cards_found) ? 0 : -ENODEV;
33078 static void __exit pcnet32_cleanup_module(void)
33079 @@ -1765,6 +1767,9 @@
33080 free_netdev(pcnet32_dev);
33081 pcnet32_dev = next_dev;
33084 + if (pcnet32_have_pci)
33085 + pci_unregister_driver(&pcnet32_driver);
33088 module_init(pcnet32_init_module);
33089 diff -Nru a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
33090 --- a/drivers/net/seeq8005.c Thu Aug 21 00:05:02 2003
33091 +++ b/drivers/net/seeq8005.c Sun Aug 31 06:34:16 2003
33092 @@ -378,7 +378,7 @@
33094 struct net_local *lp = (struct net_local *)dev->priv;
33095 short length = skb->len;
33096 - unsigned char *buf = skb->data;
33097 + unsigned char *buf;
33099 if (length < ETH_ZLEN) {
33100 skb = skb_padto(skb, ETH_ZLEN);
33101 @@ -386,6 +386,8 @@
33107 /* Block a timer-based transmit from overlapping */
33108 netif_stop_queue(dev);
33110 diff -Nru a/drivers/net/sis190.c b/drivers/net/sis190.c
33111 --- a/drivers/net/sis190.c Tue Aug 19 20:53:16 2003
33112 +++ b/drivers/net/sis190.c Sun Aug 31 14:10:18 2003
33115 #define NUM_TX_DESC 64 /* Number of Tx descriptor registers */
33116 #define NUM_RX_DESC 64 /* Number of Rx descriptor registers */
33117 +#define TX_DESC_TOTAL_SIZE (NUM_TX_DESC * sizeof (struct TxDesc))
33118 +#define RX_DESC_TOTAL_SIZE (NUM_RX_DESC * sizeof (struct RxDesc))
33119 #define RX_BUF_SIZE 1536 /* Rx Buffer size */
33121 #define SiS190_MIN_IO_SIZE 0x80
33122 @@ -311,12 +313,8 @@
33123 unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
33124 unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
33125 unsigned long dirty_tx;
33126 - void *tx_desc_raw; /* Tx descriptor buffer */
33127 - dma_addr_t tx_dma_raw;
33128 - dma_addr_t tx_dma_aligned;
33129 - void *rx_desc_raw; /* Rx descriptor buffer */
33130 - dma_addr_t rx_dma_raw;
33131 - dma_addr_t rx_dma_aligned;
33132 + dma_addr_t tx_dma;
33133 + dma_addr_t rx_dma;
33134 struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
33135 struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
33136 unsigned char *RxBufferRings; /* Index of Rx Buffer */
33137 @@ -470,6 +468,10 @@
33141 + rc = pci_set_dma_mask(pdev, 0xffffffffULL);
33145 mmio_start = pci_resource_start(pdev, 0);
33146 mmio_end = pci_resource_end(pdev, 0);
33147 mmio_flags = pci_resource_flags(pdev, 0);
33148 @@ -521,7 +523,6 @@
33151 pci_disable_device(pdev);
33152 - unregister_netdev(dev);
33156 @@ -536,6 +537,7 @@
33157 static int printed_version = 0;
33162 assert(pdev != NULL);
33163 assert(ent != NULL);
33164 @@ -620,7 +622,7 @@
33165 dev->dev_addr[2], dev->dev_addr[3],
33166 dev->dev_addr[4], dev->dev_addr[5], dev->irq);
33168 - int val = smdio_read(ioaddr, PHY_AUTO_NEGO_REG);
33169 + val = smdio_read(ioaddr, PHY_AUTO_NEGO_REG);
33171 printk(KERN_INFO "%s: Auto-negotiation Enabled.\n", dev->name);
33173 @@ -714,54 +716,50 @@
33174 SiS190_open(struct net_device *dev)
33176 struct sis190_private *tp = dev->priv;
33182 - request_irq(dev->irq, SiS190_interrupt, SA_SHIRQ, dev->name, dev);
33186 + rc = request_irq(dev->irq, SiS190_interrupt, SA_SHIRQ, dev->name, dev);
33190 - tp->tx_desc_raw = pci_alloc_consistent(tp->pci_dev,
33191 - (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
33192 - &tp->tx_dma_raw);
33193 - if (!tp->tx_desc_raw) {
33195 + * Rx and Tx descriptors need 256 bytes alignment.
33196 + * pci_alloc_consistent() guarantees a stronger alignment.
33198 + tp->TxDescArray = pci_alloc_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE,
33200 + if (!tp->TxDescArray) {
33204 - // Tx Desscriptor needs 256 bytes alignment;
33205 - diff = 256 - (tp->tx_dma_raw - ((tp->tx_dma_raw >> 8) << 8));
33206 - tp->tx_dma_aligned = tp->tx_dma_raw + diff;
33207 - tp->TxDescArray = (struct TxDesc *) (tp->tx_desc_raw + diff);
33209 - tp->rx_desc_raw = pci_alloc_consistent(tp->pci_dev,
33210 - (NUM_RX_DESC * sizeof (struct RxDesc)) + 256,
33211 - &tp->rx_dma_raw);
33212 - if (!tp->rx_desc_raw) {
33214 + tp->RxDescArray = pci_alloc_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE,
33216 + if (!tp->RxDescArray) {
33218 goto err_out_free_tx;
33220 - // Rx Desscriptor needs 256 bytes alignment;
33221 - diff = 256 - (tp->rx_dma_raw - ((tp->rx_dma_raw >> 8) << 8));
33222 - tp->rx_dma_aligned = tp->rx_dma_raw + diff;
33223 - tp->RxDescArray = (struct RxDesc *) (tp->rx_desc_raw + diff);
33225 tp->RxBufferRings = kmalloc(RX_BUF_SIZE * NUM_RX_DESC, GFP_KERNEL);
33226 if (tp->RxBufferRings == NULL) {
33227 - printk(KERN_INFO "Allocate RxBufferRing failed\n");
33228 + printk(KERN_INFO "%s: allocate RxBufferRing failed\n",
33231 + goto err_out_free_rx;
33234 SiS190_init_ring(dev);
33235 SiS190_hw_start(dev);
33242 + pci_free_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE, tp->RxDescArray,
33245 - pci_free_consistent(tp->pci_dev,
33246 - (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
33247 - tp->tx_desc_raw, tp->tx_dma_raw);
33248 + pci_free_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE, tp->TxDescArray,
33251 free_irq(dev->irq, dev);
33253 @@ -780,10 +778,10 @@
33254 SiS_W32(IntrControl, 0x0);
33256 SiS_W32(0x0, 0x01a00);
33257 - SiS_W32(0x4, tp->tx_dma_aligned);
33258 + SiS_W32(0x4, tp->tx_dma);
33260 SiS_W32(0x10, 0x1a00);
33261 - SiS_W32(0x14, tp->rx_dma_aligned);
33262 + SiS_W32(0x14, tp->rx_dma);
33264 SiS_W32(0x20, 0xffffffff);
33265 SiS_W32(0x24, 0x0);
33266 @@ -830,19 +828,19 @@
33267 tp->Tx_skbuff[i] = NULL;
33269 for (i = 0; i < NUM_RX_DESC; i++) {
33270 + struct RxDesc *desc = tp->RxDescArray + i;
33272 - tp->RxDescArray[i].PSize = 0x0;
33273 + desc->PSize = 0x0;
33275 if (i == (NUM_RX_DESC - 1))
33276 - tp->RxDescArray[i].buf_Len = BIT_31 + RX_BUF_SIZE; //bit 31 is End bit
33277 + desc->buf_Len = BIT_31 + RX_BUF_SIZE; //bit 31 is End bit
33279 - tp->RxDescArray[i].buf_Len = RX_BUF_SIZE;
33281 -#warning Replace virt_to_bus with DMA mapping
33282 - tp->RxBufferRing[i] = &(tp->RxBufferRings[i * RX_BUF_SIZE]);
33283 - tp->RxDescArray[i].buf_addr = virt_to_bus(tp->RxBufferRing[i]);
33284 - tp->RxDescArray[i].status = OWNbit | INTbit;
33285 + desc->buf_Len = RX_BUF_SIZE;
33287 + tp->RxBufferRing[i] = tp->RxBufferRings + i * RX_BUF_SIZE;
33288 + desc->buf_addr = pci_map_single(tp->pci_dev,
33289 + tp->RxBufferRing[i], RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
33290 + desc->status = OWNbit | INTbit;
33294 @@ -855,7 +853,14 @@
33296 for (i = 0; i < NUM_TX_DESC; i++) {
33297 if (tp->Tx_skbuff[i] != NULL) {
33298 - dev_kfree_skb(tp->Tx_skbuff[i]);
33299 + struct sk_buff *skb;
33301 + skb = tp->Tx_skbuff[i];
33302 + pci_unmap_single(tp->pci_dev,
33303 + le32_to_cpu(tp->TxDescArray[i].buf_addr),
33304 + skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len,
33305 + PCI_DMA_TODEVICE);
33306 + dev_kfree_skb(skb);
33307 tp->Tx_skbuff[i] = NULL;
33308 tp->stats.tx_dropped++;
33310 @@ -894,46 +899,58 @@
33311 struct sis190_private *tp = dev->priv;
33312 void *ioaddr = tp->mmio_addr;
33313 int entry = tp->cur_tx % NUM_TX_DESC;
33316 - if (skb->len < ETH_ZLEN) {
33317 + if (unlikely(skb->len < ETH_ZLEN)) {
33318 skb = skb_padto(skb, ETH_ZLEN);
33327 spin_lock_irq(&tp->lock);
33329 - if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
33330 -#warning Replace virt_to_bus with DMA mapping
33331 + if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) {
33332 + dma_addr_t mapping;
33334 + mapping = pci_map_single(tp->pci_dev, skb->data, len,
33335 + PCI_DMA_TODEVICE);
33337 tp->Tx_skbuff[entry] = skb;
33338 - tp->TxDescArray[entry].buf_addr = virt_to_bus(skb->data);
33339 - tp->TxDescArray[entry].PSize =
33340 - ((skb->len > ETH_ZLEN) ? skb->len : ETH_ZLEN);
33341 + tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping);
33342 + tp->TxDescArray[entry].PSize = cpu_to_le32(len);
33344 - if (entry != (NUM_TX_DESC - 1)) {
33345 - tp->TxDescArray[entry].buf_Len =
33346 - tp->TxDescArray[entry].PSize;
33348 + if (entry != (NUM_TX_DESC - 1))
33349 + tp->TxDescArray[entry].buf_Len = cpu_to_le32(len);
33351 tp->TxDescArray[entry].buf_Len =
33352 - tp->TxDescArray[entry].PSize | ENDbit;
33354 + cpu_to_le32(len | ENDbit);
33356 tp->TxDescArray[entry].status |=
33357 - (OWNbit | INTbit | DEFbit | CRCbit | PADbit);
33358 + cpu_to_le32(OWNbit | INTbit | DEFbit | CRCbit | PADbit);
33360 SiS_W32(TxControl, 0x1a11); //Start Send
33362 dev->trans_start = jiffies;
33366 + spin_unlock_irq(&tp->lock);
33370 + if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
33371 + netif_stop_queue(dev);
33373 spin_unlock_irq(&tp->lock);
33375 - if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) {
33376 - netif_stop_queue(dev);
33381 + tp->stats.tx_dropped++;
33382 + dev_kfree_skb(skb);
33386 @@ -952,10 +969,18 @@
33387 tx_left = tp->cur_tx - dirty_tx;
33389 while (tx_left > 0) {
33390 - if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
33391 - dev_kfree_skb_irq(tp->
33392 - Tx_skbuff[dirty_tx % NUM_TX_DESC]);
33393 - tp->Tx_skbuff[dirty_tx % NUM_TX_DESC] = NULL;
33394 + if ((le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit) == 0) {
33395 + struct sk_buff *skb;
33397 + skb = tp->Tx_skbuff[entry];
33399 + pci_unmap_single(tp->pci_dev,
33400 + le32_to_cpu(tp->TxDescArray[entry].buf_addr),
33401 + skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len,
33402 + PCI_DMA_TODEVICE);
33404 + dev_kfree_skb_irq(skb);
33405 + tp->Tx_skbuff[entry] = NULL;
33406 tp->stats.tx_packets++;
33409 @@ -965,8 +990,7 @@
33411 if (tp->dirty_tx != dirty_tx) {
33412 tp->dirty_tx = dirty_tx;
33413 - if (netif_queue_stopped(dev))
33414 - netif_wake_queue(dev);
33415 + netif_wake_queue(dev);
33419 @@ -974,29 +998,30 @@
33420 SiS190_rx_interrupt(struct net_device *dev, struct sis190_private *tp,
33424 - struct sk_buff *skb;
33425 - int pkt_size = 0;
33426 + int cur_rx = tp->cur_rx;
33427 + struct RxDesc *desc = tp->RxDescArray + cur_rx;
33429 assert(dev != NULL);
33430 assert(tp != NULL);
33431 assert(ioaddr != NULL);
33433 - cur_rx = tp->cur_rx;
33434 - while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) {
33435 + while ((desc->status & OWNbit) == 0) {
33437 - if (tp->RxDescArray[cur_rx].PSize & 0x0080000) {
33438 + if (desc->PSize & 0x0080000) {
33439 printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
33440 tp->stats.rx_errors++;
33441 tp->stats.rx_length_errors++;
33442 - } else if (!(tp->RxDescArray[cur_rx].PSize & 0x0010000)) {
33443 + } else if (!(desc->PSize & 0x0010000)) {
33444 printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
33445 tp->stats.rx_errors++;
33446 tp->stats.rx_crc_errors++;
33449 - (int) (tp->RxDescArray[cur_rx].
33450 - PSize & 0x0000FFFF) - 4;
33451 + struct sk_buff *skb;
33454 + pkt_size = (int) (desc->PSize & 0x0000FFFF) - 4;
33455 + pci_dma_sync_single(tp->pci_dev, desc->buf_addr,
33456 + RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
33457 skb = dev_alloc_skb(pkt_size + 2);
33460 @@ -1007,24 +1032,18 @@
33461 skb->protocol = eth_type_trans(skb, dev);
33464 - tp->RxDescArray[cur_rx].PSize = 0x0;
33465 + desc->PSize = 0x0;
33467 if (cur_rx == (NUM_RX_DESC - 1))
33468 - tp->RxDescArray[cur_rx].buf_Len =
33469 - ENDbit + RX_BUF_SIZE;
33470 + desc->buf_Len = ENDbit + RX_BUF_SIZE;
33472 - tp->RxDescArray[cur_rx].buf_Len =
33474 + desc->buf_Len = RX_BUF_SIZE;
33476 -#warning Replace virt_to_bus with DMA mapping
33477 - tp->RxDescArray[cur_rx].buf_addr =
33478 - virt_to_bus(tp->RxBufferRing[cur_rx]);
33479 dev->last_rx = jiffies;
33480 tp->stats.rx_bytes += pkt_size;
33481 tp->stats.rx_packets++;
33483 - tp->RxDescArray[cur_rx].status =
33485 + desc->status = OWNbit | INTbit;
33487 printk(KERN_WARNING
33488 "%s: Memory squeeze, deferring packet.\n",
33489 @@ -1036,7 +1055,7 @@
33492 cur_rx = (cur_rx + 1) % NUM_RX_DESC;
33494 + desc = tp->RxDescArray + cur_rx;
33497 tp->cur_rx = cur_rx;
33498 @@ -1111,22 +1130,22 @@
33500 spin_unlock_irq(&tp->lock);
33502 - synchronize_irq();
33503 + synchronize_irq(dev->irq);
33504 free_irq(dev->irq, dev);
33506 SiS190_tx_clear(tp);
33507 - pci_free_consistent(tp->pci_dev,
33508 - (NUM_TX_DESC * sizeof (struct TxDesc)) + 256,
33509 - tp->tx_desc_raw, tp->tx_dma_raw);
33510 - pci_free_consistent(tp->pci_dev,
33511 - (NUM_RX_DESC * sizeof (struct RxDesc)) + 256,
33512 - tp->rx_desc_raw, tp->rx_dma_raw);
33513 + pci_free_consistent(tp->pci_dev, TX_DESC_TOTAL_SIZE, tp->TxDescArray,
33515 + pci_free_consistent(tp->pci_dev, RX_DESC_TOTAL_SIZE, tp->RxDescArray,
33517 tp->TxDescArray = NULL;
33518 - tp->RxDescArray = NULL;
33519 - kfree(tp->RxBufferRings);
33520 for (i = 0; i < NUM_RX_DESC; i++) {
33521 + pci_unmap_single(tp->pci_dev, tp->RxDescArray[i].buf_addr,
33522 + RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
33523 tp->RxBufferRing[i] = NULL;
33525 + tp->RxDescArray = NULL;
33526 + kfree(tp->RxBufferRings);
33530 diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
33531 --- a/drivers/net/sis900.c Tue Aug 19 20:53:16 2003
33532 +++ b/drivers/net/sis900.c Tue Aug 26 16:37:16 2003
33533 @@ -169,6 +169,7 @@
33534 dma_addr_t rx_ring_dma;
33536 unsigned int tx_full; /* The Tx queue is full. */
33537 + u8 host_bridge_rev;
33540 MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lho <ollie@sis.com.tw>");
33541 @@ -210,6 +211,7 @@
33542 static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr);
33543 static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr);
33544 static void sis900_set_mode (long ioaddr, int speed, int duplex);
33545 +static struct ethtool_ops sis900_ethtool_ops;
33548 * sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
33549 @@ -367,6 +369,7 @@
33551 struct sis900_private *sis_priv;
33552 struct net_device *net_dev;
33553 + struct pci_dev *dev;
33554 dma_addr_t ring_dma;
33557 @@ -440,6 +443,7 @@
33558 net_dev->do_ioctl = &mii_ioctl;
33559 net_dev->tx_timeout = sis900_tx_timeout;
33560 net_dev->watchdog_timeo = TX_TIMEOUT;
33561 + net_dev->ethtool_ops = &sis900_ethtool_ops;
33563 ret = register_netdev(net_dev);
33565 @@ -473,6 +477,11 @@
33566 goto err_out_unregister;
33569 + /* save our host bridge revision */
33570 + dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);
33572 + pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);
33574 /* print some information about our NIC */
33575 printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,
33576 card_name, ioaddr, net_dev->irq);
33577 @@ -1108,18 +1117,12 @@
33579 struct sis900_private *sis_priv = net_dev->priv;
33580 u16 reg14h, eq_value=0, max_value=0, min_value=0;
33581 - u8 host_bridge_rev;
33582 int i, maxcount=10;
33583 - struct pci_dev *dev=NULL;
33585 if ( !(revision == SIS630E_900_REV || revision == SIS630EA1_900_REV ||
33586 revision == SIS630A_900_REV || revision == SIS630ET_900_REV) )
33589 - dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, dev);
33591 - pci_read_config_byte(dev, PCI_CLASS_REVISION, &host_bridge_rev);
33593 if (netif_carrier_ok(net_dev)) {
33594 reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
33595 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (0x2200 | reg14h) & 0xBFFF);
33596 @@ -1142,7 +1145,8 @@
33598 /* 630B0&B1 rule to determine the equalizer value */
33599 if (revision == SIS630A_900_REV &&
33600 - (host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1)) {
33601 + (sis_priv->host_bridge_rev == SIS630B0 ||
33602 + sis_priv->host_bridge_rev == SIS630B1)) {
33603 if (max_value == 0)
33606 @@ -1157,7 +1161,8 @@
33608 reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
33609 if (revision == SIS630A_900_REV &&
33610 - (host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1))
33611 + (sis_priv->host_bridge_rev == SIS630B0 ||
33612 + sis_priv->host_bridge_rev == SIS630B1))
33613 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2200) & 0xBFFF);
33615 mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2000) & 0xBFFF);
33616 @@ -1853,39 +1858,27 @@
33620 - * netdev_ethtool_ioctl - For the basic support of ethtool
33621 - * @net_dev: the net device to command for
33622 - * @useraddr: start address of interface request
33623 + * sis900_get_drvinfo - Return information about driver
33624 + * @net_dev: the net device to probe
33625 + * @info: container for info returned
33627 * Process ethtool command such as "ehtool -i" to show information
33630 -static int netdev_ethtool_ioctl (struct net_device *net_dev, void *useraddr)
33632 +static void sis900_get_drvinfo(struct net_device *net_dev,
33633 + struct ethtool_drvinfo *info)
33635 struct sis900_private *sis_priv = net_dev->priv;
33638 - if (copy_from_user (ðcmd, useraddr, sizeof (ethcmd)))
33641 - switch (ethcmd) {
33642 - case ETHTOOL_GDRVINFO:
33644 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
33645 - strcpy (info.driver, SIS900_MODULE_NAME);
33646 - strcpy (info.version, SIS900_DRV_VERSION);
33647 - strcpy (info.bus_info, pci_name(sis_priv->pci_dev));
33648 - if (copy_to_user (useraddr, &info, sizeof (info)))
33656 - return -EOPNOTSUPP;
33657 + strcpy (info->driver, SIS900_MODULE_NAME);
33658 + strcpy (info->version, SIS900_DRV_VERSION);
33659 + strcpy (info->bus_info, pci_name(sis_priv->pci_dev));
33662 +static struct ethtool_ops sis900_ethtool_ops = {
33663 + .get_drvinfo = sis900_get_drvinfo,
33667 * mii_ioctl - process MII i/o control command
33668 * @net_dev: the net device to command for
33669 @@ -1901,9 +1894,6 @@
33670 struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
33673 - case SIOCETHTOOL:
33674 - return netdev_ethtool_ioctl(net_dev, (void *) rq->ifr_data);
33676 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
33677 data->phy_id = sis_priv->mii->phy_addr;
33679 diff -Nru a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c
33680 --- a/drivers/net/sk_mca.c Fri Jul 25 17:15:35 2003
33681 +++ b/drivers/net/sk_mca.c Sun Aug 31 22:50:10 2003
33682 @@ -124,7 +124,7 @@
33683 /* dump parts of shared memory - only needed during debugging */
33686 -static void dumpmem(struct SKMCA_NETDEV *dev, u32 start, u32 len)
33687 +static void dumpmem(struct net_device *dev, u32 start, u32 len)
33691 @@ -217,7 +217,7 @@
33693 /* reset the whole board */
33695 -static void ResetBoard(struct SKMCA_NETDEV *dev)
33696 +static void ResetBoard(struct net_device *dev)
33698 skmca_priv *priv = (skmca_priv *) dev->priv;
33700 @@ -228,7 +228,7 @@
33702 /* wait for LANCE interface to become not busy */
33704 -static int WaitLANCE(struct SKMCA_NETDEV *dev)
33705 +static int WaitLANCE(struct net_device *dev)
33707 skmca_priv *priv = (skmca_priv *) dev->priv;
33709 @@ -247,7 +247,7 @@
33711 /* set LANCE register - must be atomic */
33713 -static void SetLANCE(struct SKMCA_NETDEV *dev, u16 addr, u16 value)
33714 +static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
33716 skmca_priv *priv = (skmca_priv *) dev->priv;
33717 unsigned long flags;
33718 @@ -280,12 +280,12 @@
33720 /* reenable interrupts */
33722 - spin_lock_irqrestore(&priv->lock, flags);
33723 + spin_unlock_irqrestore(&priv->lock, flags);
33726 /* get LANCE register */
33728 -static u16 GetLANCE(struct SKMCA_NETDEV *dev, u16 addr)
33729 +static u16 GetLANCE(struct net_device *dev, u16 addr)
33731 skmca_priv *priv = (skmca_priv *) dev->priv;
33732 unsigned long flags;
33733 @@ -319,14 +319,14 @@
33735 /* reenable interrupts */
33737 - spin_lock_irqrestore(&priv->lock, flags);
33738 + spin_unlock_irqrestore(&priv->lock, flags);
33743 /* build up descriptors in shared RAM */
33745 -static void InitDscrs(struct SKMCA_NETDEV *dev)
33746 +static void InitDscrs(struct net_device *dev)
33750 @@ -422,7 +422,7 @@
33752 /* feed ready-built initialization block into LANCE */
33754 -static void InitLANCE(struct SKMCA_NETDEV *dev)
33755 +static void InitLANCE(struct net_device *dev)
33757 skmca_priv *priv = (skmca_priv *) dev->priv;
33759 @@ -452,11 +452,7 @@
33761 /* we don't get ready until the LANCE has read the init block */
33763 -#if (LINUX_VERSION_CODE >= 0x02032a)
33764 netif_stop_queue(dev);
33769 /* let LANCE read the initialization block. LANCE is ready
33770 when we receive the corresponding interrupt. */
33771 @@ -466,15 +462,11 @@
33773 /* stop the LANCE so we can reinitialize it */
33775 -static void StopLANCE(struct SKMCA_NETDEV *dev)
33776 +static void StopLANCE(struct net_device *dev)
33778 /* can't take frames any more */
33780 -#if (LINUX_VERSION_CODE >= 0x02032a)
33781 netif_stop_queue(dev);
33786 /* disable interrupts, stop it */
33788 @@ -483,7 +475,7 @@
33790 /* initialize card and LANCE for proper operation */
33792 -static void InitBoard(struct SKMCA_NETDEV *dev)
33793 +static void InitBoard(struct net_device *dev)
33795 LANCE_InitBlock block;
33797 @@ -508,7 +500,7 @@
33799 /* deinitialize card and LANCE */
33801 -static void DeinitBoard(struct SKMCA_NETDEV *dev)
33802 +static void DeinitBoard(struct net_device *dev)
33806 @@ -521,7 +513,7 @@
33808 /* probe for device's irq */
33810 -static int __init ProbeIRQ(struct SKMCA_NETDEV *dev)
33811 +static int __init ProbeIRQ(struct net_device *dev)
33813 unsigned long imaskval, njiffies, irq;
33815 @@ -563,15 +555,11 @@
33817 /* LANCE has read initialization block -> start it */
33819 -static u16 irqstart_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
33820 +static u16 irqstart_handler(struct net_device *dev, u16 oldcsr0)
33822 /* now we're ready to transmit */
33824 -#if (LINUX_VERSION_CODE >= 0x02032a)
33825 netif_wake_queue(dev);
33830 /* reset IDON bit, start LANCE */
33832 @@ -581,7 +569,7 @@
33834 /* did we lose blocks due to a FIFO overrun ? */
33836 -static u16 irqmiss_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
33837 +static u16 irqmiss_handler(struct net_device *dev, u16 oldcsr0)
33839 skmca_priv *priv = (skmca_priv *) dev->priv;
33841 @@ -597,7 +585,7 @@
33843 /* receive interrupt */
33845 -static u16 irqrx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
33846 +static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
33848 skmca_priv *priv = (skmca_priv *) dev->priv;
33849 LANCE_RxDescr descr;
33850 @@ -678,7 +666,7 @@
33852 /* transmit interrupt */
33854 -static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
33855 +static u16 irqtx_handler(struct net_device *dev, u16 oldcsr0)
33857 skmca_priv *priv = (skmca_priv *) dev->priv;
33858 LANCE_TxDescr descr;
33859 @@ -740,12 +728,7 @@
33861 /* inform upper layers we're in business again */
33863 -#if (LINUX_VERSION_CODE >= 0x02032a)
33864 netif_wake_queue(dev);
33872 @@ -754,7 +737,7 @@
33874 static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
33876 - struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) device;
33877 + struct net_device *dev = (struct net_device *) device;
33880 /* read CSR0 to get interrupt cause */
33881 @@ -766,13 +749,9 @@
33882 if ((csr0val & CSR0_INTR) == 0)
33885 -#if (LINUX_VERSION_CODE >= 0x02032a)
33887 set_bit(LINK_STATE_RXSEM, &dev->state);
33890 - dev->interrupt = 1;
33893 /* loop through the interrupt bits until everything is clear */
33895 @@ -796,13 +775,9 @@
33897 while ((csr0val & CSR0_INTR) != 0);
33899 -#if (LINUX_VERSION_CODE >= 0x02032a)
33901 clear_bit(LINK_STATE_RXSEM, &dev->state);
33904 - dev->interrupt = 0;
33906 return IRQ_HANDLED;
33909 @@ -815,7 +790,7 @@
33910 static int skmca_getinfo(char *buf, int slot, void *d)
33913 - struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) d;
33914 + struct net_device *dev = (struct net_device *) d;
33917 /* can't say anything about an uninitialized device... */
33918 @@ -846,7 +821,7 @@
33920 /* open driver. Means also initialization and start of LANCE */
33922 -static int skmca_open(struct SKMCA_NETDEV *dev)
33923 +static int skmca_open(struct net_device *dev)
33926 skmca_priv *priv = (skmca_priv *) dev->priv;
33927 @@ -868,21 +843,14 @@
33931 -#if (LINUX_VERSION_CODE >= 0x02032a)
33932 netif_start_queue(dev);
33934 - dev->interrupt = 0;
33937 - MOD_INC_USE_COUNT;
33943 /* close driver. Shut down board and free allocated resources */
33945 -static int skmca_close(struct SKMCA_NETDEV *dev)
33946 +static int skmca_close(struct net_device *dev)
33948 /* turn off board */
33950 @@ -892,16 +860,12 @@
33951 free_irq(dev->irq, dev);
33954 -#if (LINUX_VERSION_CODE < 0x02032a)
33955 - MOD_DEC_USE_COUNT;
33961 /* transmit a block. */
33963 -static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev)
33964 +static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
33966 skmca_priv *priv = (skmca_priv *) dev->priv;
33967 LANCE_TxDescr descr;
33968 @@ -977,11 +941,7 @@
33969 /* are we saturated ? */
33971 if (priv->txbusy >= TXCOUNT)
33972 -#if (LINUX_VERSION_CODE >= 0x02032a)
33973 netif_stop_queue(dev);
33978 /* write descriptor back to RAM */
33979 SKMCA_TOIO(dev->mem_start + address, &descr,
33980 @@ -993,7 +953,7 @@
33981 if (priv->txbusy == 0)
33982 SetLANCE(dev, LANCE_CSR0, CSR0_INEA | CSR0_TDMD);
33984 - spin_lock_irqrestore(&priv->lock, flags);
33985 + spin_unlock_irqrestore(&priv->lock, flags);
33989 @@ -1004,7 +964,7 @@
33991 /* return pointer to Ethernet statistics */
33993 -static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev)
33994 +static struct net_device_stats *skmca_stats(struct net_device *dev)
33996 skmca_priv *priv = (skmca_priv *) dev->priv;
33998 @@ -1014,7 +974,7 @@
33999 /* we don't support runtime reconfiguration, since an MCA card can
34000 be unambigously identified by its POS registers. */
34002 -static int skmca_config(struct SKMCA_NETDEV *dev, struct ifmap *map)
34003 +static int skmca_config(struct net_device *dev, struct ifmap *map)
34007 @@ -1022,7 +982,7 @@
34008 /* switch receiver mode. We use the LANCE's multicast filter to prefilter
34009 multicast addresses. */
34011 -static void skmca_set_multicast_list(struct SKMCA_NETDEV *dev)
34012 +static void skmca_set_multicast_list(struct net_device *dev)
34014 LANCE_InitBlock block;
34016 @@ -1062,7 +1022,7 @@
34018 static int startslot; /* counts through slots when probing multiple devices */
34020 -int __init skmca_probe(struct SKMCA_NETDEV *dev)
34021 +int __init skmca_probe(struct net_device *dev)
34023 int force_detect = 0;
34024 int junior, slot, i;
34025 @@ -1095,14 +1055,12 @@
34027 getaddrs(slot, junior, &base, &irq, &medium);
34029 -#if LINUX_VERSION_CODE >= 0x020300
34030 /* slot already in use ? */
34032 if (mca_is_adapter_used(slot)) {
34033 slot = dofind(&junior, slot + 1);
34038 /* were we looking for something different ? */
34040 @@ -1221,24 +1179,13 @@
34044 -#if (LINUX_VERSION_CODE >= 0x020369)
34045 -static struct SKMCA_NETDEV moddevs[DEVMAX] =
34046 - { {" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34047 -{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34048 -{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34049 -{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34050 -{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
34053 -static char NameSpace[8 * DEVMAX];
34054 -static struct SKMCA_NETDEV moddevs[DEVMAX] =
34055 - { {NameSpace + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34056 -{NameSpace + 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34057 -{NameSpace + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34058 -{NameSpace + 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
34059 -{NameSpace + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
34060 +static struct net_device moddevs[DEVMAX] = {
34061 + { .name = " ", .init = skmca_probe },
34062 + { .name = " ", .init = skmca_probe },
34063 + { .name = " ", .init = skmca_probe },
34064 + { .name = " ", .init = skmca_probe },
34065 + { .name = " ", .init = skmca_probe }
34071 @@ -1260,7 +1207,7 @@
34073 void cleanup_module(void)
34075 - struct SKMCA_NETDEV *dev;
34076 + struct net_device *dev;
34080 diff -Nru a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h
34081 --- a/drivers/net/sk_mca.h Tue Jul 15 08:10:44 2003
34082 +++ b/drivers/net/sk_mca.h Sun Aug 31 08:29:49 2003
34085 /* version-dependent functions/structures */
34087 -#if LINUX_VERSION_CODE >= 0x020318
34088 #define SKMCA_READB(addr) isa_readb(addr)
34089 #define SKMCA_READW(addr) isa_readw(addr)
34090 #define SKMCA_WRITEB(data, addr) isa_writeb(data, addr)
34092 #define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len)
34093 #define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len)
34094 #define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len)
34095 -#define SKMCA_NETDEV net_device
34097 -#define SKMCA_READB(addr) readb(addr)
34098 -#define SKMCA_READW(addr) readw(addr)
34099 -#define SKMCA_WRITEB(data, addr) writeb(data, addr)
34100 -#define SKMCA_WRITEW(data, addr) writew(data, addr)
34101 -#define SKMCA_TOIO(dest, src, len) memcpy_toio(dest, src, len)
34102 -#define SKMCA_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
34103 -#define SKMCA_SETIO(dest, val, len) memset_io(dest, val, len)
34104 -#define SKMCA_NETDEV device
34108 #define SKNET_MCA_ID 0x6afd
34109 @@ -188,7 +176,7 @@
34111 #endif /* _SK_MCA_DRIVER_ */
34113 -extern int skmca_probe(struct SKMCA_NETDEV *);
34114 +extern int skmca_probe(struct net_device *);
34117 #endif /* _SK_MCA_INCLUDE_ */
34118 diff -Nru a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
34119 --- a/drivers/net/sunbmac.c Tue Aug 19 20:53:16 2003
34120 +++ b/drivers/net/sunbmac.c Sun Aug 24 05:58:18 2003
34123 * sunbmac.c: Driver for Sparc BigMAC 100baseT ethernet adapters.
34125 - * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
34126 + * Copyright (C) 1997, 1998, 1999, 2003 David S. Miller (davem@redhat.com)
34129 #include <linux/module.h>
34131 #include <linux/init.h>
34132 #include <linux/crc32.h>
34133 #include <linux/errno.h>
34134 +#include <linux/ethtool.h>
34135 #include <linux/netdevice.h>
34136 #include <linux/etherdevice.h>
34137 #include <linux/skbuff.h>
34139 #include "sunbmac.h"
34141 static char version[] __initdata =
34142 - "sunbmac.c:v1.9 11/Sep/99 David S. Miller (davem@redhat.com)\n";
34143 + "sunbmac.c:v2.0 24/Nov/03 David S. Miller (davem@redhat.com)\n";
34147 @@ -1035,6 +1036,33 @@
34148 sbus_writel(tmp, bregs + BMAC_RXCFG);
34151 +/* Ethtool support... */
34152 +static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
34154 + struct bigmac *bp = dev->priv;
34156 + strcpy(info->driver, "sunbmac");
34157 + strcpy(info->version, "2.0");
34158 + sprintf(info->bus_info, "SBUS:%d",
34159 + bp->qec_sdev->slot);
34162 +static u32 bigmac_get_link(struct net_device *dev)
34164 + struct bigmac *bp = dev->priv;
34166 + spin_lock_irq(&bp->lock);
34167 + bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, BIGMAC_BMSR);
34168 + spin_unlock_irq(&bp->lock);
34170 + return (bp->sw_bmsr & BMSR_LSTATUS);
34173 +static struct ethtool_ops bigmac_ethtool_ops = {
34174 + .get_drvinfo = bigmac_get_drvinfo,
34175 + .get_link = bigmac_get_link,
34178 static int __init bigmac_ether_init(struct sbus_dev *qec_sdev)
34180 struct net_device *dev;
34181 @@ -1169,6 +1197,7 @@
34182 dev->open = &bigmac_open;
34183 dev->stop = &bigmac_close;
34184 dev->hard_start_xmit = &bigmac_start_xmit;
34185 + dev->ethtool_ops = &bigmac_ethtool_ops;
34187 /* Set links to BigMAC statistic and multi-cast loading code. */
34188 dev->get_stats = &bigmac_get_stats;
34189 diff -Nru a/drivers/net/sungem.c b/drivers/net/sungem.c
34190 --- a/drivers/net/sungem.c Tue Aug 19 20:53:16 2003
34191 +++ b/drivers/net/sungem.c Sun Aug 24 05:58:18 2003
34194 * sungem.c: Sun GEM ethernet driver.
34196 - * Copyright (C) 2000, 2001, 2002 David S. Miller (davem@redhat.com)
34197 + * Copyright (C) 2000, 2001, 2002, 2003 David S. Miller (davem@redhat.com)
34199 * Support for Apple GMAC and assorted PHYs by
34200 * Benjamin Herrenscmidt (benh@kernel.crashing.org)
34202 SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full)
34204 #define DRV_NAME "sungem"
34205 -#define DRV_VERSION "0.97"
34206 -#define DRV_RELDATE "3/20/02"
34207 +#define DRV_VERSION "0.98"
34208 +#define DRV_RELDATE "8/24/03"
34209 #define DRV_AUTHOR "David S. Miller (davem@redhat.com)"
34211 static char version[] __devinitdata =
34212 @@ -2317,177 +2317,134 @@
34213 spin_unlock_irq(&gp->lock);
34216 -/* Eventually add support for changing the advertisement
34219 -static int gem_ethtool_ioctl(struct net_device *dev, void *ep_user)
34220 +static void gem_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
34222 + struct gem *gp = dev->priv;
34224 + strcpy(info->driver, DRV_NAME);
34225 + strcpy(info->version, DRV_VERSION);
34226 + strcpy(info->bus_info, pci_name(gp->pdev));
34229 +static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
34231 struct gem *gp = dev->priv;
34232 - struct ethtool_cmd ecmd;
34234 - if (copy_from_user(&ecmd, ep_user, sizeof(ecmd)))
34237 - switch(ecmd.cmd) {
34238 - case ETHTOOL_GDRVINFO: {
34239 - struct ethtool_drvinfo info = { .cmd = ETHTOOL_GDRVINFO };
34241 - strncpy(info.driver, DRV_NAME, ETHTOOL_BUSINFO_LEN);
34242 - strncpy(info.version, DRV_VERSION, ETHTOOL_BUSINFO_LEN);
34243 - info.fw_version[0] = '\0';
34244 - strncpy(info.bus_info, pci_name(gp->pdev), ETHTOOL_BUSINFO_LEN);
34245 - info.regdump_len = 0; /*SUNGEM_NREGS;*/
34247 - if (copy_to_user(ep_user, &info, sizeof(info)))
34249 + if (gp->phy_type == phy_mii_mdio0 ||
34250 + gp->phy_type == phy_mii_mdio1) {
34251 + if (gp->phy_mii.def)
34252 + cmd->supported = gp->phy_mii.def->features;
34254 + cmd->supported = (SUPPORTED_10baseT_Half |
34255 + SUPPORTED_10baseT_Full);
34259 + /* XXX hardcoded stuff for now */
34260 + cmd->port = PORT_MII;
34261 + cmd->transceiver = XCVR_EXTERNAL;
34262 + cmd->phy_address = 0; /* XXX fixed PHYAD */
34264 - case ETHTOOL_GSET:
34265 - if (gp->phy_type == phy_mii_mdio0 ||
34266 - gp->phy_type == phy_mii_mdio1) {
34267 - if (gp->phy_mii.def)
34268 - ecmd.supported = gp->phy_mii.def->features;
34270 - ecmd.supported = SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full;
34272 - /* XXX hardcoded stuff for now */
34273 - ecmd.port = PORT_MII;
34274 - ecmd.transceiver = XCVR_EXTERNAL;
34275 - ecmd.phy_address = 0; /* XXX fixed PHYAD */
34277 - /* Return current PHY settings */
34278 - spin_lock_irq(&gp->lock);
34279 - ecmd.autoneg = gp->want_autoneg;
34280 - ecmd.speed = gp->phy_mii.speed;
34281 - ecmd.duplex = gp->phy_mii.duplex;
34282 - ecmd.advertising = gp->phy_mii.advertising;
34283 - /* If we started with a forced mode, we don't have a default
34284 - * advertise set, we need to return something sensible so
34285 - * userland can re-enable autoneg properly */
34286 - if (ecmd.advertising == 0)
34287 - ecmd.advertising = ecmd.supported;
34288 - spin_unlock_irq(&gp->lock);
34289 - } else { // XXX PCS ?
34291 + /* Return current PHY settings */
34292 + spin_lock_irq(&gp->lock);
34293 + cmd->autoneg = gp->want_autoneg;
34294 + cmd->speed = gp->phy_mii.speed;
34295 + cmd->duplex = gp->phy_mii.duplex;
34296 + cmd->advertising = gp->phy_mii.advertising;
34298 + /* If we started with a forced mode, we don't have a default
34299 + * advertise set, we need to return something sensible so
34300 + * userland can re-enable autoneg properly.
34302 + if (cmd->advertising == 0)
34303 + cmd->advertising = cmd->supported;
34304 + spin_unlock_irq(&gp->lock);
34305 + } else { // XXX PCS ?
34307 (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
34308 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
34309 SUPPORTED_Autoneg);
34310 - ecmd.advertising = ecmd.supported;
34312 - if (copy_to_user(ep_user, &ecmd, sizeof(ecmd)))
34315 + cmd->advertising = cmd->supported;
34317 + cmd->duplex = cmd->port = cmd->phy_address =
34318 + cmd->transceiver = cmd->autoneg = 0;
34320 + cmd->maxtxpkt = cmd->maxrxpkt = 0;
34322 - case ETHTOOL_SSET:
34323 - /* Verify the settings we care about. */
34324 - if (ecmd.autoneg != AUTONEG_ENABLE &&
34325 - ecmd.autoneg != AUTONEG_DISABLE)
34328 - if (ecmd.autoneg == AUTONEG_ENABLE &&
34329 - ecmd.advertising == 0)
34332 - if (ecmd.autoneg == AUTONEG_DISABLE &&
34333 - ((ecmd.speed != SPEED_1000 &&
34334 - ecmd.speed != SPEED_100 &&
34335 - ecmd.speed != SPEED_10) ||
34336 - (ecmd.duplex != DUPLEX_HALF &&
34337 - ecmd.duplex != DUPLEX_FULL)))
34340 - /* Apply settings and restart link process. */
34341 - spin_lock_irq(&gp->lock);
34342 - gem_begin_auto_negotiation(gp, &ecmd);
34343 - spin_unlock_irq(&gp->lock);
34348 +static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
34350 + struct gem *gp = dev->priv;
34352 - case ETHTOOL_NWAY_RST:
34353 - if (!gp->want_autoneg)
34355 + /* Verify the settings we care about. */
34356 + if (cmd->autoneg != AUTONEG_ENABLE &&
34357 + cmd->autoneg != AUTONEG_DISABLE)
34360 - /* Restart link process. */
34361 - spin_lock_irq(&gp->lock);
34362 - gem_begin_auto_negotiation(gp, NULL);
34363 - spin_unlock_irq(&gp->lock);
34364 + if (cmd->autoneg == AUTONEG_ENABLE &&
34365 + cmd->advertising == 0)
34369 + if (cmd->autoneg == AUTONEG_DISABLE &&
34370 + ((cmd->speed != SPEED_1000 &&
34371 + cmd->speed != SPEED_100 &&
34372 + cmd->speed != SPEED_10) ||
34373 + (cmd->duplex != DUPLEX_HALF &&
34374 + cmd->duplex != DUPLEX_FULL)))
34377 + /* Apply settings and restart link process. */
34378 + spin_lock_irq(&gp->lock);
34379 + gem_begin_auto_negotiation(gp, cmd);
34380 + spin_unlock_irq(&gp->lock);
34382 - case ETHTOOL_GWOL:
34383 - case ETHTOOL_SWOL:
34384 - break; /* todo */
34386 - /* get link status */
34387 - case ETHTOOL_GLINK: {
34388 - struct ethtool_value edata = { .cmd = ETHTOOL_GLINK };
34390 - edata.data = (gp->lstate == link_up);
34391 - if (copy_to_user(ep_user, &edata, sizeof(edata)))
34398 - /* get message-level */
34399 - case ETHTOOL_GMSGLVL: {
34400 - struct ethtool_value edata = { .cmd = ETHTOOL_GMSGLVL };
34402 - edata.data = gp->msg_enable;
34403 - if (copy_to_user(ep_user, &edata, sizeof(edata)))
34407 +static int gem_nway_reset(struct net_device *dev)
34409 + struct gem *gp = dev->priv;
34411 - /* set message-level */
34412 - case ETHTOOL_SMSGLVL: {
34413 - struct ethtool_value edata;
34415 - if (copy_from_user(&edata, ep_user, sizeof(edata)))
34417 - gp->msg_enable = edata.data;
34420 + if (!gp->want_autoneg)
34424 - case ETHTOOL_GREGS: {
34425 - struct ethtool_regs regs;
34428 + /* Restart link process. */
34429 + spin_lock_irq(&gp->lock);
34430 + gem_begin_auto_negotiation(gp, NULL);
34431 + spin_unlock_irq(&gp->lock);
34433 - if (copy_from_user(®s, useraddr, sizeof(regs)))
34436 - if (regs.len > SUNGEM_NREGS) {
34437 - regs.len = SUNGEM_NREGS;
34439 - regs.version = 0;
34440 - if (copy_to_user(useraddr, ®s, sizeof(regs)))
34445 - if (!gp->hw_running)
34447 - useraddr += offsetof(struct ethtool_regs, data);
34448 +static u32 gem_get_link(struct net_device *dev)
34450 + struct gem *gp = dev->priv;
34452 - /* Use kmalloc to avoid bloating the stack */
34453 - regbuf = kmalloc(4 * SUNGEM_NREGS, GFP_KERNEL);
34456 - spin_lock_irq(&np->lock);
34457 - gem_get_regs(gp, regbuf);
34458 - spin_unlock_irq(&np->lock);
34460 - if (copy_to_user(useraddr, regbuf, regs.len*sizeof(u32)))
34467 + return (gp->lstate == link_up);
34470 - return -EOPNOTSUPP;
34471 +static u32 gem_get_msglevel(struct net_device *dev)
34473 + struct gem *gp = dev->priv;
34474 + return gp->msg_enable;
34477 +static void gem_set_msglevel(struct net_device *dev, u32 value)
34479 + struct gem *gp = dev->priv;
34480 + gp->msg_enable = value;
34483 +static struct ethtool_ops gem_ethtool_ops = {
34484 + .get_drvinfo = gem_get_drvinfo,
34485 + .get_link = ethtool_op_get_link,
34486 + .get_settings = gem_get_settings,
34487 + .set_settings = gem_set_settings,
34488 + .nway_reset = gem_nway_reset,
34489 + .get_link = gem_get_link,
34490 + .get_msglevel = gem_get_msglevel,
34491 + .set_msglevel = gem_set_msglevel,
34494 static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
34496 @@ -2501,10 +2458,6 @@
34500 - case SIOCETHTOOL:
34501 - rc = gem_ethtool_ioctl(dev, ifr->ifr_data);
34504 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
34505 data->phy_id = gp->mii_phy_addr;
34506 /* Fallthrough... */
34507 @@ -2812,6 +2765,7 @@
34508 dev->get_stats = gem_get_stats;
34509 dev->set_multicast_list = gem_set_multicast;
34510 dev->do_ioctl = gem_ioctl;
34511 + dev->ethtool_ops = &gem_ethtool_ops;
34512 dev->tx_timeout = gem_tx_timeout;
34513 dev->watchdog_timeo = 5 * HZ;
34514 dev->change_mtu = gem_change_mtu;
34515 diff -Nru a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
34516 --- a/drivers/net/sungem_phy.c Mon May 19 23:38:25 2003
34517 +++ b/drivers/net/sungem_phy.c Sun Aug 31 16:14:08 2003
34518 @@ -634,116 +634,116 @@
34520 /* Broadcom BCM 5201 */
34521 static struct mii_phy_ops bcm5201_phy_ops = {
34522 - init: bcm5201_init,
34523 - suspend: bcm5201_suspend,
34524 - setup_aneg: genmii_setup_aneg,
34525 - setup_forced: genmii_setup_forced,
34526 - poll_link: genmii_poll_link,
34527 - read_link: genmii_read_link,
34528 + .init = bcm5201_init,
34529 + .suspend = bcm5201_suspend,
34530 + .setup_aneg = genmii_setup_aneg,
34531 + .setup_forced = genmii_setup_forced,
34532 + .poll_link = genmii_poll_link,
34533 + .read_link = genmii_read_link,
34536 static struct mii_phy_def bcm5201_phy_def = {
34537 - phy_id: 0x00406210,
34538 - phy_id_mask: 0xfffffff0,
34540 - features: MII_BASIC_FEATURES,
34542 - ops: &bcm5201_phy_ops
34543 + .phy_id = 0x00406210,
34544 + .phy_id_mask = 0xfffffff0,
34545 + .name = "BCM5201",
34546 + .features = MII_BASIC_FEATURES,
34548 + .ops = &bcm5201_phy_ops
34551 /* Broadcom BCM 5221 */
34552 static struct mii_phy_ops bcm5221_phy_ops = {
34553 - suspend: bcm5201_suspend,
34554 - init: bcm5221_init,
34555 - setup_aneg: genmii_setup_aneg,
34556 - setup_forced: genmii_setup_forced,
34557 - poll_link: genmii_poll_link,
34558 - read_link: genmii_read_link,
34559 + .suspend = bcm5201_suspend,
34560 + .init = bcm5221_init,
34561 + .setup_aneg = genmii_setup_aneg,
34562 + .setup_forced = genmii_setup_forced,
34563 + .poll_link = genmii_poll_link,
34564 + .read_link = genmii_read_link,
34567 static struct mii_phy_def bcm5221_phy_def = {
34568 - phy_id: 0x004061e0,
34569 - phy_id_mask: 0xfffffff0,
34571 - features: MII_BASIC_FEATURES,
34573 - ops: &bcm5221_phy_ops
34574 + .phy_id = 0x004061e0,
34575 + .phy_id_mask = 0xfffffff0,
34576 + .name = "BCM5221",
34577 + .features = MII_BASIC_FEATURES,
34579 + .ops = &bcm5221_phy_ops
34582 /* Broadcom BCM 5400 */
34583 static struct mii_phy_ops bcm5400_phy_ops = {
34584 - init: bcm5400_init,
34585 - suspend: bcm5400_suspend,
34586 - setup_aneg: bcm54xx_setup_aneg,
34587 - setup_forced: bcm54xx_setup_forced,
34588 - poll_link: genmii_poll_link,
34589 - read_link: bcm54xx_read_link,
34590 + .init = bcm5400_init,
34591 + .suspend = bcm5400_suspend,
34592 + .setup_aneg = bcm54xx_setup_aneg,
34593 + .setup_forced = bcm54xx_setup_forced,
34594 + .poll_link = genmii_poll_link,
34595 + .read_link = bcm54xx_read_link,
34598 static struct mii_phy_def bcm5400_phy_def = {
34599 - phy_id: 0x00206040,
34600 - phy_id_mask: 0xfffffff0,
34602 - features: MII_GBIT_FEATURES,
34604 - ops: &bcm5400_phy_ops
34605 + .phy_id = 0x00206040,
34606 + .phy_id_mask = 0xfffffff0,
34607 + .name = "BCM5400",
34608 + .features = MII_GBIT_FEATURES,
34610 + .ops = &bcm5400_phy_ops
34613 /* Broadcom BCM 5401 */
34614 static struct mii_phy_ops bcm5401_phy_ops = {
34615 - init: bcm5401_init,
34616 - suspend: bcm5401_suspend,
34617 - setup_aneg: bcm54xx_setup_aneg,
34618 - setup_forced: bcm54xx_setup_forced,
34619 - poll_link: genmii_poll_link,
34620 - read_link: bcm54xx_read_link,
34621 + .init = bcm5401_init,
34622 + .suspend = bcm5401_suspend,
34623 + .setup_aneg = bcm54xx_setup_aneg,
34624 + .setup_forced = bcm54xx_setup_forced,
34625 + .poll_link = genmii_poll_link,
34626 + .read_link = bcm54xx_read_link,
34629 static struct mii_phy_def bcm5401_phy_def = {
34630 - phy_id: 0x00206050,
34631 - phy_id_mask: 0xfffffff0,
34633 - features: MII_GBIT_FEATURES,
34635 - ops: &bcm5401_phy_ops
34636 + .phy_id = 0x00206050,
34637 + .phy_id_mask = 0xfffffff0,
34638 + .name = "BCM5401",
34639 + .features = MII_GBIT_FEATURES,
34641 + .ops = &bcm5401_phy_ops
34644 /* Broadcom BCM 5411 */
34645 static struct mii_phy_ops bcm5411_phy_ops = {
34646 - init: bcm5411_init,
34647 - suspend: bcm5411_suspend,
34648 - setup_aneg: bcm54xx_setup_aneg,
34649 - setup_forced: bcm54xx_setup_forced,
34650 - poll_link: genmii_poll_link,
34651 - read_link: bcm54xx_read_link,
34652 + .init = bcm5411_init,
34653 + .suspend = bcm5411_suspend,
34654 + .setup_aneg = bcm54xx_setup_aneg,
34655 + .setup_forced = bcm54xx_setup_forced,
34656 + .poll_link = genmii_poll_link,
34657 + .read_link = bcm54xx_read_link,
34660 static struct mii_phy_def bcm5411_phy_def = {
34661 - phy_id: 0x00206070,
34662 - phy_id_mask: 0xfffffff0,
34664 - features: MII_GBIT_FEATURES,
34666 - ops: &bcm5411_phy_ops
34667 + .phy_id = 0x00206070,
34668 + .phy_id_mask = 0xfffffff0,
34669 + .name = "BCM5411",
34670 + .features = MII_GBIT_FEATURES,
34672 + .ops = &bcm5411_phy_ops
34675 /* Broadcom BCM 5421 */
34676 static struct mii_phy_ops bcm5421_phy_ops = {
34677 - init: bcm5421_init,
34678 - suspend: bcm5411_suspend,
34679 - setup_aneg: bcm54xx_setup_aneg,
34680 - setup_forced: bcm54xx_setup_forced,
34681 - poll_link: genmii_poll_link,
34682 - read_link: bcm54xx_read_link,
34683 + .init = bcm5421_init,
34684 + .suspend = bcm5411_suspend,
34685 + .setup_aneg = bcm54xx_setup_aneg,
34686 + .setup_forced = bcm54xx_setup_forced,
34687 + .poll_link = genmii_poll_link,
34688 + .read_link = bcm54xx_read_link,
34691 static struct mii_phy_def bcm5421_phy_def = {
34692 - phy_id: 0x002060e0,
34693 - phy_id_mask: 0xfffffff0,
34695 - features: MII_GBIT_FEATURES,
34697 - ops: &bcm5421_phy_ops
34698 + .phy_id = 0x002060e0,
34699 + .phy_id_mask = 0xfffffff0,
34700 + .name = "BCM5421",
34701 + .features = MII_GBIT_FEATURES,
34703 + .ops = &bcm5421_phy_ops
34706 /* Marvell 88E1101 (Apple seem to deal with 2 different revs,
34707 @@ -751,36 +751,36 @@
34708 * would be useful here) --BenH.
34710 static struct mii_phy_ops marvell_phy_ops = {
34711 - setup_aneg: marvell_setup_aneg,
34712 - setup_forced: marvell_setup_forced,
34713 - poll_link: genmii_poll_link,
34714 - read_link: marvell_read_link
34715 + .setup_aneg = marvell_setup_aneg,
34716 + .setup_forced = marvell_setup_forced,
34717 + .poll_link = genmii_poll_link,
34718 + .read_link = marvell_read_link
34721 static struct mii_phy_def marvell_phy_def = {
34722 - phy_id: 0x01410c00,
34723 - phy_id_mask: 0xffffff00,
34724 - name: "Marvell 88E1101",
34725 - features: MII_GBIT_FEATURES,
34727 - ops: &marvell_phy_ops
34728 + .phy_id = 0x01410c00,
34729 + .phy_id_mask = 0xffffff00,
34730 + .name = "Marvell 88E1101",
34731 + .features = MII_GBIT_FEATURES,
34733 + .ops = &marvell_phy_ops
34736 /* Generic implementation for most 10/100 PHYs */
34737 static struct mii_phy_ops generic_phy_ops = {
34738 - setup_aneg: genmii_setup_aneg,
34739 - setup_forced: genmii_setup_forced,
34740 - poll_link: genmii_poll_link,
34741 - read_link: genmii_read_link
34742 + .setup_aneg = genmii_setup_aneg,
34743 + .setup_forced = genmii_setup_forced,
34744 + .poll_link = genmii_poll_link,
34745 + .read_link = genmii_read_link
34748 static struct mii_phy_def genmii_phy_def = {
34749 - phy_id: 0x00000000,
34750 - phy_id_mask: 0x00000000,
34751 - name: "Generic MII",
34752 - features: MII_BASIC_FEATURES,
34754 - ops: &generic_phy_ops
34755 + .phy_id = 0x00000000,
34756 + .phy_id_mask = 0x00000000,
34757 + .name = "Generic MII",
34758 + .features = MII_BASIC_FEATURES,
34760 + .ops = &generic_phy_ops
34763 static struct mii_phy_def* mii_phy_table[] = {
34764 diff -Nru a/drivers/net/sunhme.c b/drivers/net/sunhme.c
34765 --- a/drivers/net/sunhme.c Tue Aug 19 20:53:16 2003
34766 +++ b/drivers/net/sunhme.c Sun Aug 24 05:58:18 2003
34768 * auto carrier detecting ethernet driver. Also known as the
34769 * "Happy Meal Ethernet" found on SunSwift SBUS cards.
34771 - * Copyright (C) 1996, 1998, 1999, 2002 David S. Miller (davem@redhat.com)
34772 + * Copyright (C) 1996, 1998, 1999, 2002, 2003 David S. Miller (davem@redhat.com)
34775 * 2000/11/11 Willy Tarreau <willy AT meta-x.org>
34779 static char version[] =
34780 - "sunhme.c:v2.01 26/Mar/2002 David S. Miller (davem@redhat.com)\n";
34781 + "sunhme.c:v2.02 24/Aug/2003 David S. Miller (davem@redhat.com)\n";
34783 #include <linux/module.h>
34784 #include <linux/config.h>
34785 @@ -2426,85 +2426,109 @@
34788 /* Ethtool support... */
34789 -static int happy_meal_ioctl(struct net_device *dev,
34790 - struct ifreq *rq, int cmd)
34791 +static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
34793 struct happy_meal *hp = dev->priv;
34794 - struct ethtool_cmd *ep_user = (struct ethtool_cmd *) rq->ifr_data;
34795 - struct ethtool_cmd ecmd;
34797 - if (cmd != SIOCETHTOOL)
34798 - return -EOPNOTSUPP;
34799 - if (copy_from_user(&ecmd, ep_user, sizeof(ecmd)))
34802 - if (ecmd.cmd == ETHTOOL_GSET) {
34804 - (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
34805 - SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
34806 - SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
34808 - /* XXX hardcoded stuff for now */
34809 - ecmd.port = PORT_TP; /* XXX no MII support */
34810 - ecmd.transceiver = XCVR_INTERNAL; /* XXX no external xcvr support */
34811 - ecmd.phy_address = 0; /* XXX fixed PHYAD */
34813 - /* Record PHY settings. */
34814 - spin_lock_irq(&hp->happy_lock);
34815 - hp->sw_bmcr = happy_meal_tcvr_read(hp, hp->tcvregs, MII_BMCR);
34816 - hp->sw_lpa = happy_meal_tcvr_read(hp, hp->tcvregs, MII_LPA);
34817 - spin_unlock_irq(&hp->happy_lock);
34819 + (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
34820 + SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
34821 + SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
34823 + /* XXX hardcoded stuff for now */
34824 + cmd->port = PORT_TP; /* XXX no MII support */
34825 + cmd->transceiver = XCVR_INTERNAL; /* XXX no external xcvr support */
34826 + cmd->phy_address = 0; /* XXX fixed PHYAD */
34828 - if (hp->sw_bmcr & BMCR_ANENABLE) {
34829 - ecmd.autoneg = AUTONEG_ENABLE;
34831 - (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
34832 - SPEED_100 : SPEED_10;
34833 - if (ecmd.speed == SPEED_100)
34835 - (hp->sw_lpa & (LPA_100FULL)) ?
34836 - DUPLEX_FULL : DUPLEX_HALF;
34839 - (hp->sw_lpa & (LPA_10FULL)) ?
34840 - DUPLEX_FULL : DUPLEX_HALF;
34842 - ecmd.autoneg = AUTONEG_DISABLE;
34844 - (hp->sw_bmcr & BMCR_SPEED100) ?
34845 - SPEED_100 : SPEED_10;
34847 - (hp->sw_bmcr & BMCR_FULLDPLX) ?
34848 + /* Record PHY settings. */
34849 + spin_lock_irq(&hp->happy_lock);
34850 + hp->sw_bmcr = happy_meal_tcvr_read(hp, hp->tcvregs, MII_BMCR);
34851 + hp->sw_lpa = happy_meal_tcvr_read(hp, hp->tcvregs, MII_LPA);
34852 + spin_unlock_irq(&hp->happy_lock);
34854 + if (hp->sw_bmcr & BMCR_ANENABLE) {
34855 + cmd->autoneg = AUTONEG_ENABLE;
34857 + (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
34858 + SPEED_100 : SPEED_10;
34859 + if (cmd->speed == SPEED_100)
34861 + (hp->sw_lpa & (LPA_100FULL)) ?
34862 DUPLEX_FULL : DUPLEX_HALF;
34864 - if (copy_to_user(ep_user, &ecmd, sizeof(ecmd)))
34867 - } else if (ecmd.cmd == ETHTOOL_SSET) {
34868 - /* Verify the settings we care about. */
34869 - if (ecmd.autoneg != AUTONEG_ENABLE &&
34870 - ecmd.autoneg != AUTONEG_DISABLE)
34872 - if (ecmd.autoneg == AUTONEG_DISABLE &&
34873 - ((ecmd.speed != SPEED_100 &&
34874 - ecmd.speed != SPEED_10) ||
34875 - (ecmd.duplex != DUPLEX_HALF &&
34876 - ecmd.duplex != DUPLEX_FULL)))
34879 - /* Ok, do it to it. */
34880 - spin_lock_irq(&hp->happy_lock);
34881 - del_timer(&hp->happy_timer);
34882 - happy_meal_begin_auto_negotiation(hp,
34885 - spin_unlock_irq(&hp->happy_lock);
34888 + (hp->sw_lpa & (LPA_10FULL)) ?
34889 + DUPLEX_FULL : DUPLEX_HALF;
34891 + cmd->autoneg = AUTONEG_DISABLE;
34893 + (hp->sw_bmcr & BMCR_SPEED100) ?
34894 + SPEED_100 : SPEED_10;
34896 + (hp->sw_bmcr & BMCR_FULLDPLX) ?
34897 + DUPLEX_FULL : DUPLEX_HALF;
34904 - return -EOPNOTSUPP;
34905 +static int hme_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
34907 + struct happy_meal *hp = dev->priv;
34909 + /* Verify the settings we care about. */
34910 + if (cmd->autoneg != AUTONEG_ENABLE &&
34911 + cmd->autoneg != AUTONEG_DISABLE)
34913 + if (cmd->autoneg == AUTONEG_DISABLE &&
34914 + ((cmd->speed != SPEED_100 &&
34915 + cmd->speed != SPEED_10) ||
34916 + (cmd->duplex != DUPLEX_HALF &&
34917 + cmd->duplex != DUPLEX_FULL)))
34920 + /* Ok, do it to it. */
34921 + spin_lock_irq(&hp->happy_lock);
34922 + del_timer(&hp->happy_timer);
34923 + happy_meal_begin_auto_negotiation(hp, hp->tcvregs, cmd);
34924 + spin_unlock_irq(&hp->happy_lock);
34929 +static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
34931 + struct happy_meal *hp = dev->priv;
34933 + strcpy(info->driver, "sunhme");
34934 + strcpy(info->version, "2.02");
34935 + if (hp->happy_flags & HFLAG_PCI) {
34936 + struct pci_dev *pdev = hp->happy_dev;
34937 + strcpy(info->bus_info, pci_name(pdev));
34939 + struct sbus_dev *sdev = hp->happy_dev;
34940 + sprintf(info->bus_info, "SBUS:%d",
34945 +static u32 hme_get_link(struct net_device *dev)
34947 + struct happy_meal *hp = dev->priv;
34949 + spin_lock_irq(&hp->happy_lock);
34950 + hp->sw_bmcr = happy_meal_tcvr_read(hp, hp->tcvregs, MII_BMCR);
34951 + spin_unlock_irq(&hp->happy_lock);
34953 + return (hp->sw_bmsr & BMSR_LSTATUS);
34956 +static struct ethtool_ops hme_ethtool_ops = {
34957 + .get_settings = hme_get_settings,
34958 + .set_settings = hme_set_settings,
34959 + .get_drvinfo = hme_get_drvinfo,
34960 + .get_link = hme_get_link,
34963 static int hme_version_printed;
34966 @@ -2797,7 +2821,7 @@
34967 dev->set_multicast_list = &happy_meal_set_multicast;
34968 dev->tx_timeout = &happy_meal_tx_timeout;
34969 dev->watchdog_timeo = 5*HZ;
34970 - dev->do_ioctl = &happy_meal_ioctl;
34971 + dev->ethtool_ops = &hme_ethtool_ops;
34973 /* Happy Meal can do it all... except VLAN. */
34974 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_VLAN_CHALLENGED;
34975 @@ -3141,7 +3165,7 @@
34976 dev->set_multicast_list = &happy_meal_set_multicast;
34977 dev->tx_timeout = &happy_meal_tx_timeout;
34978 dev->watchdog_timeo = 5*HZ;
34979 - dev->do_ioctl = &happy_meal_ioctl;
34980 + dev->ethtool_ops = &hme_ethtool_ops;
34981 dev->irq = pdev->irq;
34984 diff -Nru a/drivers/net/sunlance.c b/drivers/net/sunlance.c
34985 --- a/drivers/net/sunlance.c Tue Aug 19 20:53:17 2003
34986 +++ b/drivers/net/sunlance.c Sun Aug 24 05:58:18 2003
34988 #undef DEBUG_DRIVER
34990 static char version[] =
34991 - "sunlance.c:v2.01 08/Nov/01 Miguel de Icaza (miguel@nuclecu.unam.mx)\n";
34992 + "sunlance.c:v2.02 24/Aug/03 Miguel de Icaza (miguel@nuclecu.unam.mx)\n";
34994 static char lancestr[] = "LANCE";
34997 #include <linux/netdevice.h>
34998 #include <linux/etherdevice.h>
34999 #include <linux/skbuff.h>
35000 +#include <linux/ethtool.h>
35002 #include <asm/system.h>
35003 #include <asm/bitops.h>
35004 @@ -1287,6 +1288,30 @@
35008 +/* Ethtool support... */
35009 +static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
35011 + struct lance_private *lp = dev->priv;
35013 + strcpy(info->driver, "sunlance");
35014 + strcpy(info->version, "2.02");
35015 + sprintf(info->bus_info, "SBUS:%d",
35019 +static u32 sparc_lance_get_link(struct net_device *dev)
35021 + /* We really do not keep track of this, but this
35022 + * is better than not reporting anything at all.
35027 +static struct ethtool_ops sparc_lance_ethtool_ops = {
35028 + .get_drvinfo = sparc_lance_get_drvinfo,
35029 + .get_link = sparc_lance_get_link,
35032 static int __init sparc_lance_init(struct net_device *dev,
35033 struct sbus_dev *sdev,
35034 struct sbus_dma *ledma,
35035 @@ -1456,6 +1481,7 @@
35036 dev->watchdog_timeo = 5*HZ;
35037 dev->get_stats = &lance_get_stats;
35038 dev->set_multicast_list = &lance_set_multicast;
35039 + dev->ethtool_ops = &sparc_lance_ethtool_ops;
35041 dev->irq = sdev->irqs[0];
35043 diff -Nru a/drivers/net/sunqe.c b/drivers/net/sunqe.c
35044 --- a/drivers/net/sunqe.c Tue Aug 19 20:53:17 2003
35045 +++ b/drivers/net/sunqe.c Sun Aug 24 05:58:18 2003
35047 * controller out there can be most efficiently programmed
35048 * if you make it look like a LANCE.
35050 - * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com)
35051 + * Copyright (C) 1996, 1999, 2003 David S. Miller (davem@redhat.com)
35054 static char version[] =
35055 - "sunqe.c:v2.9 9/11/99 David S. Miller (davem@redhat.com)\n";
35056 + "sunqe.c:v3.0 8/24/03 David S. Miller (davem@redhat.com)\n";
35058 #include <linux/module.h>
35059 #include <linux/kernel.h>
35061 #include <linux/netdevice.h>
35062 #include <linux/etherdevice.h>
35063 #include <linux/skbuff.h>
35064 +#include <linux/ethtool.h>
35066 #include <asm/system.h>
35067 #include <asm/bitops.h>
35068 @@ -684,6 +685,35 @@
35069 netif_wake_queue(dev);
35072 +/* Ethtool support... */
35073 +static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
35075 + struct sunqe *qep = dev->priv;
35077 + strcpy(info->driver, "sunqe");
35078 + strcpy(info->version, "3.0");
35079 + sprintf(info->bus_info, "SBUS:%d",
35080 + qep->qe_sdev->slot);
35083 +static u32 qe_get_link(struct net_device *dev)
35085 + struct sunqe *qep = dev->priv;
35086 + unsigned long mregs = qep->mregs;
35089 + spin_lock_irq(&qep->lock);
35090 + phyconfig = sbus_readb(mregs + MREGS_PHYCONFIG);
35091 + spin_unlock_irq(&qep->lock);
35093 + return (phyconfig & MREGS_PHYCONFIG_LSTAT);
35096 +static struct ethtool_ops qe_ethtool_ops = {
35097 + .get_drvinfo = qe_get_drvinfo,
35098 + .get_link = qe_get_link,
35101 /* This is only called once at boot time for each card probed. */
35102 static inline void qec_init_once(struct sunqec *qecp, struct sbus_dev *qsdev)
35104 @@ -850,6 +880,7 @@
35105 qe_devs[i]->watchdog_timeo = 5*HZ;
35106 qe_devs[i]->irq = sdev->irqs[0];
35107 qe_devs[i]->dma = 0;
35108 + qe_devs[i]->ethtool_ops = &qe_ethtool_ops;
35111 /* QEC receives interrupts from each QE, then it sends the actual
35112 diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
35113 --- a/drivers/net/tg3.c Tue Aug 19 20:53:17 2003
35114 +++ b/drivers/net/tg3.c Mon Sep 1 12:14:20 2003
35116 * tg3.c: Broadcom Tigon3 ethernet driver.
35118 * Copyright (C) 2001, 2002, 2003 David S. Miller (davem@redhat.com)
35119 - * Copyright (C) 2001, 2002 Jeff Garzik (jgarzik@pobox.com)
35120 + * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com)
35123 #include <linux/config.h>
35125 #include <linux/tcp.h>
35126 #include <linux/workqueue.h>
35128 +#include <net/checksum.h>
35130 #include <asm/system.h>
35131 #include <asm/io.h>
35132 #include <asm/byteorder.h>
35133 @@ -45,20 +47,17 @@
35137 -/* XXX Works but still disabled, decreases TCP performance to 7MB/sec even
35138 - * XXX over gigabit.
35140 -#define TG3_DO_TSO 0
35141 +#define TG3_TSO_SUPPORT 1
35143 -#define TG3_DO_TSO 0
35144 +#define TG3_TSO_SUPPORT 0
35149 #define DRV_MODULE_NAME "tg3"
35150 #define PFX DRV_MODULE_NAME ": "
35151 -#define DRV_MODULE_VERSION "1.9"
35152 -#define DRV_MODULE_RELDATE "August 3, 2003"
35153 +#define DRV_MODULE_VERSION "2.2"
35154 +#define DRV_MODULE_RELDATE "August 24, 2003"
35156 #define TG3_DEF_MAC_MODE 0
35157 #define TG3_DEF_RX_MODE 0
35160 /* hardware minimum and maximum for a single frame's data payload */
35161 #define TG3_MIN_MTU 60
35162 -#define TG3_MAX_MTU 9000
35163 +#define TG3_MAX_MTU(tp) \
35164 + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 ? 9000 : 1500)
35166 /* These numbers seem to be hard coded in the NIC firmware somehow.
35167 * You can't change the ring sizes, but you can change where you place
35169 #define TG3_DEF_RX_RING_PENDING 200
35170 #define TG3_RX_JUMBO_RING_SIZE 256
35171 #define TG3_DEF_RX_JUMBO_RING_PENDING 100
35172 -#define TG3_RX_RCB_RING_SIZE 1024
35174 +/* Do not place this n-ring entries value into the tp struct itself,
35175 + * we really want to expose these constants to GCC so that modulo et
35176 + * al. operations are done with shifts and masks instead of with
35177 + * hw multiply/modulo instructions. Another solution would be to
35178 + * replace things like '% foo' with '& (foo - 1)'.
35180 +#define TG3_RX_RCB_RING_SIZE(tp) \
35181 + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ? \
35184 #define TG3_TX_RING_SIZE 512
35185 #define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1)
35189 #define TG3_RX_JUMBO_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * \
35190 TG3_RX_JUMBO_RING_SIZE)
35191 -#define TG3_RX_RCB_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * \
35192 - TG3_RX_RCB_RING_SIZE)
35193 +#define TG3_RX_RCB_RING_BYTES(tp) (sizeof(struct tg3_rx_buffer_desc) * \
35194 + TG3_RX_RCB_RING_SIZE(tp))
35195 #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \
35197 #define TX_RING_GAP(TP) \
35198 @@ -140,6 +150,14 @@
35199 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35200 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5702FE,
35201 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35202 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705,
35203 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35204 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705_2,
35205 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35206 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705M,
35207 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35208 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705M_2,
35209 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35210 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5702X,
35211 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35212 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5703X,
35213 @@ -150,12 +168,24 @@
35214 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35215 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5703A3,
35216 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35217 - { PCI_VENDOR_ID_SYSKONNECT, 0x4400,
35218 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5782,
35219 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35220 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5788,
35221 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35222 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901,
35223 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35224 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901_2,
35225 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35226 + { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX,
35227 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35228 + { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX,
35229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35230 { PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000,
35231 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35232 { PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1001,
35233 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35234 + { PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1003,
35235 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35236 { PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC9100,
35237 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
35239 @@ -237,38 +267,6 @@
35243 -/* these netif_xxx funcs should be moved into generic net layer */
35244 -static void netif_poll_disable(struct net_device *dev)
35246 - while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
35247 - current->state = TASK_INTERRUPTIBLE;
35248 - schedule_timeout(1);
35252 -static inline void netif_poll_enable(struct net_device *dev)
35254 - clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
35257 -/* same as netif_rx_complete, except that local_irq_save(flags)
35258 - * has already been issued
35260 -static inline void __netif_rx_complete(struct net_device *dev)
35262 - if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
35263 - list_del(&dev->poll_list);
35264 - smp_mb__before_clear_bit();
35265 - clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
35268 -static inline void netif_tx_disable(struct net_device *dev)
35270 - spin_lock_bh(&dev->xmit_lock);
35271 - netif_stop_queue(dev);
35272 - spin_unlock_bh(&dev->xmit_lock);
35275 static inline void tg3_netif_stop(struct tg3 *tp)
35277 netif_poll_disable(tp->dev);
35278 @@ -288,17 +286,28 @@
35280 static void tg3_switch_clocks(struct tg3 *tp)
35282 - if (tr32(TG3PCI_CLOCK_CTRL) & CLOCK_CTRL_44MHZ_CORE) {
35283 + u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL);
35284 + u32 orig_clock_ctrl;
35286 + orig_clock_ctrl = clock_ctrl;
35287 + clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN |
35288 + CLOCK_CTRL_CLKRUN_OENABLE |
35290 + tp->pci_clock_ctrl = clock_ctrl;
35292 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
35293 + (orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) {
35294 tw32(TG3PCI_CLOCK_CTRL,
35296 (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK));
35297 tr32(TG3PCI_CLOCK_CTRL);
35299 tw32(TG3PCI_CLOCK_CTRL,
35300 - (CLOCK_CTRL_ALTCLK));
35301 + clock_ctrl | (CLOCK_CTRL_ALTCLK));
35302 tr32(TG3PCI_CLOCK_CTRL);
35305 - tw32(TG3PCI_CLOCK_CTRL, 0);
35306 + tw32(TG3PCI_CLOCK_CTRL, clock_ctrl);
35307 tr32(TG3PCI_CLOCK_CTRL);
35310 @@ -401,24 +410,22 @@
35314 -/* This will reset the tigon3 PHY if there is no valid
35315 - * link unless the FORCE argument is non-zero.
35317 -static int tg3_phy_reset(struct tg3 *tp, int force)
35318 +static void tg3_phy_set_wirespeed(struct tg3 *tp)
35320 - u32 phy_status, phy_control;
35324 - err = tg3_readphy(tp, MII_BMSR, &phy_status);
35325 - err |= tg3_readphy(tp, MII_BMSR, &phy_status);
35328 + if (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED)
35331 - /* If we have link, and not forcing a reset, then nothing
35334 - if ((phy_status & BMSR_LSTATUS) != 0 && (force == 0))
35336 + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007);
35337 + tg3_readphy(tp, MII_TG3_AUX_CTRL, &val);
35338 + tg3_writephy(tp, MII_TG3_AUX_CTRL, (val | (1 << 15) | (1 << 4)));
35341 +static int tg3_bmcr_reset(struct tg3 *tp)
35346 /* OK, reset it, and poll the BMCR_RESET bit until it
35347 * clears or we time out.
35348 @@ -436,12 +443,303 @@
35350 if ((phy_control & BMCR_RESET) == 0) {
35363 +static int tg3_wait_macro_done(struct tg3 *tp)
35367 + while (limit--) {
35370 + tg3_readphy(tp, 0x16, &tmp32);
35371 + if ((tmp32 & 0x1000) == 0)
35380 +static int tg3_phy_write_and_check_testpat(struct tg3 *tp, int *resetp)
35382 + static const u32 test_pat[4][6] = {
35383 + { 0x00005555, 0x00000005, 0x00002aaa, 0x0000000a, 0x00003456, 0x00000003 },
35384 + { 0x00002aaa, 0x0000000a, 0x00003333, 0x00000003, 0x0000789a, 0x00000005 },
35385 + { 0x00005a5a, 0x00000005, 0x00002a6a, 0x0000000a, 0x00001bcd, 0x00000003 },
35386 + { 0x00002a5a, 0x0000000a, 0x000033c3, 0x00000003, 0x00002ef1, 0x00000005 }
35390 + for (chan = 0; chan < 4; chan++) {
35393 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
35394 + (chan * 0x2000) | 0x0200);
35395 + tg3_writephy(tp, 0x16, 0x0002);
35397 + for (i = 0; i < 6; i++)
35398 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT,
35399 + test_pat[chan][i]);
35401 + tg3_writephy(tp, 0x16, 0x0202);
35402 + if (tg3_wait_macro_done(tp)) {
35407 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
35408 + (chan * 0x2000) | 0x0200);
35409 + tg3_writephy(tp, 0x16, 0x0082);
35410 + if (tg3_wait_macro_done(tp)) {
35415 + tg3_writephy(tp, 0x16, 0x0802);
35416 + if (tg3_wait_macro_done(tp)) {
35421 + for (i = 0; i < 6; i += 2) {
35424 + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &low);
35425 + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &high);
35426 + if (tg3_wait_macro_done(tp)) {
35432 + if (low != test_pat[chan][i] ||
35433 + high != test_pat[chan][i+1]) {
35434 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000b);
35435 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4001);
35436 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4005);
35447 +static int tg3_phy_reset_chanpat(struct tg3 *tp)
35451 + for (chan = 0; chan < 4; chan++) {
35454 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
35455 + (chan * 0x2000) | 0x0200);
35456 + tg3_writephy(tp, 0x16, 0x0002);
35457 + for (i = 0; i < 6; i++)
35458 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x000);
35459 + tg3_writephy(tp, 0x16, 0x0202);
35460 + if (tg3_wait_macro_done(tp))
35467 +static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
35469 + u32 reg32, phy9_orig;
35470 + int retries, do_phy_reset, err;
35473 + do_phy_reset = 1;
35475 + if (do_phy_reset) {
35476 + err = tg3_bmcr_reset(tp);
35479 + do_phy_reset = 0;
35482 + /* Disable transmitter and interrupt. */
35483 + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32);
35485 + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32);
35487 + /* Set full-duplex, 1000 mbps. */
35488 + tg3_writephy(tp, MII_BMCR,
35489 + BMCR_FULLDPLX | TG3_BMCR_SPEED1000);
35491 + /* Set to master mode. */
35492 + tg3_readphy(tp, MII_TG3_CTRL, &phy9_orig);
35493 + tg3_writephy(tp, MII_TG3_CTRL,
35494 + (MII_TG3_CTRL_AS_MASTER |
35495 + MII_TG3_CTRL_ENABLE_AS_MASTER));
35497 + /* Enable SM_DSP_CLOCK and 6dB. */
35498 + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
35500 + /* Block the PHY control access. */
35501 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005);
35502 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0800);
35504 + err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset);
35507 + } while (--retries);
35509 + err = tg3_phy_reset_chanpat(tp);
35513 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005);
35514 + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0000);
35516 + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
35517 + tg3_writephy(tp, 0x16, 0x0000);
35519 + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
35521 + tg3_writephy(tp, MII_TG3_CTRL, phy9_orig);
35523 + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32);
35524 + reg32 &= ~0x3000;
35525 + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32);
35530 +/* This will reset the tigon3 PHY if there is no valid
35531 + * link unless the FORCE argument is non-zero.
35533 +static int tg3_phy_reset(struct tg3 *tp, int force)
35538 + err = tg3_readphy(tp, MII_BMSR, &phy_status);
35539 + err |= tg3_readphy(tp, MII_BMSR, &phy_status);
35543 + /* If we have link, and not forcing a reset, then nothing
35546 + if ((phy_status & BMSR_LSTATUS) != 0 && (force == 0))
35549 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
35550 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
35551 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35552 + err = tg3_phy_reset_5703_4_5(tp);
35558 + err = tg3_bmcr_reset(tp);
35563 + tg3_phy_set_wirespeed(tp);
35567 +static void tg3_frob_aux_power(struct tg3 *tp)
35569 + struct tg3 *tp_peer = tp;
35571 + if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0)
35574 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
35575 + tp_peer = pci_get_drvdata(tp->pdev_peer);
35581 + if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 ||
35582 + (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0) {
35583 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35584 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
35585 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35586 + (GRC_LCLCTRL_GPIO_OE0 |
35587 + GRC_LCLCTRL_GPIO_OE1 |
35588 + GRC_LCLCTRL_GPIO_OE2 |
35589 + GRC_LCLCTRL_GPIO_OUTPUT0 |
35590 + GRC_LCLCTRL_GPIO_OUTPUT1));
35591 + tr32(GRC_LOCAL_CTRL);
35594 + if (tp_peer != tp &&
35595 + (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
35598 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35599 + (GRC_LCLCTRL_GPIO_OE0 |
35600 + GRC_LCLCTRL_GPIO_OE1 |
35601 + GRC_LCLCTRL_GPIO_OE2 |
35602 + GRC_LCLCTRL_GPIO_OUTPUT1 |
35603 + GRC_LCLCTRL_GPIO_OUTPUT2));
35604 + tr32(GRC_LOCAL_CTRL);
35607 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35608 + (GRC_LCLCTRL_GPIO_OE0 |
35609 + GRC_LCLCTRL_GPIO_OE1 |
35610 + GRC_LCLCTRL_GPIO_OE2 |
35611 + GRC_LCLCTRL_GPIO_OUTPUT0 |
35612 + GRC_LCLCTRL_GPIO_OUTPUT1 |
35613 + GRC_LCLCTRL_GPIO_OUTPUT2));
35614 + tr32(GRC_LOCAL_CTRL);
35617 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35618 + (GRC_LCLCTRL_GPIO_OE0 |
35619 + GRC_LCLCTRL_GPIO_OE1 |
35620 + GRC_LCLCTRL_GPIO_OE2 |
35621 + GRC_LCLCTRL_GPIO_OUTPUT0 |
35622 + GRC_LCLCTRL_GPIO_OUTPUT1));
35623 + tr32(GRC_LOCAL_CTRL);
35627 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
35628 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
35629 + if (tp_peer != tp &&
35630 + (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
35633 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35634 + (GRC_LCLCTRL_GPIO_OE1 |
35635 + GRC_LCLCTRL_GPIO_OUTPUT1));
35636 + tr32(GRC_LOCAL_CTRL);
35639 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35640 + (GRC_LCLCTRL_GPIO_OE1));
35641 + tr32(GRC_LOCAL_CTRL);
35644 + tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
35645 + (GRC_LCLCTRL_GPIO_OE1 |
35646 + GRC_LCLCTRL_GPIO_OUTPUT1));
35647 + tr32(GRC_LOCAL_CTRL);
35653 static int tg3_setup_phy(struct tg3 *);
35654 @@ -547,89 +845,65 @@
35658 - if (tp->tg3_flags & TG3_FLAG_WOL_SPEED_100MB) {
35659 + if (!(tp->tg3_flags & TG3_FLAG_WOL_SPEED_100MB) &&
35660 + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35661 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) {
35665 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35666 - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)
35667 - base_val |= (CLOCK_CTRL_RXCLK_DISABLE |
35668 - CLOCK_CTRL_TXCLK_DISABLE);
35670 - tw32(TG3PCI_CLOCK_CTRL, base_val |
35671 - CLOCK_CTRL_ALTCLK);
35672 - tr32(TG3PCI_CLOCK_CTRL);
35674 + base_val = tp->pci_clock_ctrl;
35675 + base_val |= (CLOCK_CTRL_RXCLK_DISABLE |
35676 + CLOCK_CTRL_TXCLK_DISABLE);
35678 tw32(TG3PCI_CLOCK_CTRL, base_val |
35679 CLOCK_CTRL_ALTCLK |
35680 - CLOCK_CTRL_44MHZ_CORE);
35681 - tr32(TG3PCI_CLOCK_CTRL);
35684 - tw32(TG3PCI_CLOCK_CTRL, base_val |
35685 - CLOCK_CTRL_44MHZ_CORE);
35686 + CLOCK_CTRL_PWRDOWN_PLL133);
35687 tr32(TG3PCI_CLOCK_CTRL);
35691 + u32 newbits1, newbits2;
35694 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35695 - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)
35696 - base_val |= (CLOCK_CTRL_RXCLK_DISABLE |
35697 - CLOCK_CTRL_TXCLK_DISABLE);
35698 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
35699 + newbits1 = (CLOCK_CTRL_RXCLK_DISABLE |
35700 + CLOCK_CTRL_TXCLK_DISABLE |
35701 + CLOCK_CTRL_ALTCLK);
35702 + newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE;
35703 + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35704 + newbits1 = CLOCK_CTRL_625_CORE;
35705 + newbits2 = newbits1 | CLOCK_CTRL_ALTCLK;
35707 + newbits1 = CLOCK_CTRL_ALTCLK;
35708 + newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE;
35711 - tw32(TG3PCI_CLOCK_CTRL, base_val |
35712 - CLOCK_CTRL_ALTCLK |
35713 - CLOCK_CTRL_PWRDOWN_PLL133);
35714 + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits1);
35715 tr32(TG3PCI_CLOCK_CTRL);
35719 - if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) &&
35720 - (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)) {
35721 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35722 - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
35723 - tw32(GRC_LOCAL_CTRL,
35724 - (GRC_LCLCTRL_GPIO_OE0 |
35725 - GRC_LCLCTRL_GPIO_OE1 |
35726 - GRC_LCLCTRL_GPIO_OE2 |
35727 - GRC_LCLCTRL_GPIO_OUTPUT0 |
35728 - GRC_LCLCTRL_GPIO_OUTPUT1));
35729 - tr32(GRC_LOCAL_CTRL);
35732 - tw32(GRC_LOCAL_CTRL,
35733 - (GRC_LCLCTRL_GPIO_OE0 |
35734 - GRC_LCLCTRL_GPIO_OE1 |
35735 - GRC_LCLCTRL_GPIO_OE2 |
35736 - GRC_LCLCTRL_GPIO_OUTPUT1 |
35737 - GRC_LCLCTRL_GPIO_OUTPUT2));
35738 - tr32(GRC_LOCAL_CTRL);
35740 + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2);
35741 + tr32(TG3PCI_CLOCK_CTRL);
35744 - tw32(GRC_LOCAL_CTRL,
35745 - (GRC_LCLCTRL_GPIO_OE0 |
35746 - GRC_LCLCTRL_GPIO_OE1 |
35747 - GRC_LCLCTRL_GPIO_OE2 |
35748 - GRC_LCLCTRL_GPIO_OUTPUT0 |
35749 - GRC_LCLCTRL_GPIO_OUTPUT1 |
35750 - GRC_LCLCTRL_GPIO_OUTPUT2));
35751 - tr32(GRC_LOCAL_CTRL);
35753 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
35756 - tw32(GRC_LOCAL_CTRL,
35757 - (GRC_LCLCTRL_GPIO_OE0 |
35758 - GRC_LCLCTRL_GPIO_OE1 |
35759 - GRC_LCLCTRL_GPIO_OE2 |
35760 - GRC_LCLCTRL_GPIO_OUTPUT0 |
35761 - GRC_LCLCTRL_GPIO_OUTPUT1));
35762 - tr32(GRC_LOCAL_CTRL);
35764 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
35765 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
35766 + newbits3 = (CLOCK_CTRL_RXCLK_DISABLE |
35767 + CLOCK_CTRL_TXCLK_DISABLE |
35768 + CLOCK_CTRL_44MHZ_CORE);
35770 + newbits3 = CLOCK_CTRL_44MHZ_CORE;
35773 + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits3);
35774 + tr32(TG3PCI_CLOCK_CTRL);
35779 + tg3_frob_aux_power(tp);
35781 /* Finally, set the new power state. */
35782 pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
35784 @@ -948,11 +1222,10 @@
35786 /* Some third-party PHYs need to be reset on link going
35789 - * XXX 5705 note: This workaround also applies to 5705_a0
35791 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
35792 - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) &&
35793 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
35794 + tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) &&
35795 netif_carrier_ok(tp->dev)) {
35796 tg3_readphy(tp, MII_BMSR, &bmsr);
35797 tg3_readphy(tp, MII_BMSR, &bmsr);
35798 @@ -1942,7 +2215,7 @@
35801 hw_idx = tp->hw_status->idx[0].rx_producer;
35802 - sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE;
35803 + sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE(tp);
35806 while (sw_idx != hw_idx && budget > 0) {
35807 @@ -2043,13 +2316,13 @@
35811 - sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE;
35812 + sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE(tp);
35815 /* ACK the status ring. */
35816 tp->rx_rcb_ptr = rx_rcb_ptr;
35817 tw32_mailbox(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW,
35818 - (rx_rcb_ptr % TG3_RX_RCB_RING_SIZE));
35819 + (rx_rcb_ptr % TG3_RX_RCB_RING_SIZE(tp)));
35820 if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)
35821 tr32(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW);
35823 @@ -2388,19 +2661,34 @@
35825 if (skb->ip_summed == CHECKSUM_HW)
35826 base_flags |= TXD_FLAG_TCPUDP_CSUM;
35827 -#if TG3_DO_TSO != 0
35828 - if ((mss = skb_shinfo(skb)->tso_size) != 0) {
35829 - static int times = 0;
35830 +#if TG3_TSO_SUPPORT != 0
35832 + if (skb->len > (tp->dev->mtu + ETH_HLEN) &&
35833 + (mss = skb_shinfo(skb)->tso_size) != 0) {
35834 + int tcp_opt_len, ip_tcp_len;
35836 + tcp_opt_len = ((skb->h.th->doff - 5) * 4);
35837 + ip_tcp_len = (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr);
35839 - mss += ((skb->h.th->doff * 4) - 20);
35840 base_flags |= (TXD_FLAG_CPU_PRE_DMA |
35841 TXD_FLAG_CPU_POST_DMA);
35843 - if (times++ < 5) {
35844 - printk("tg3_xmit: tso_size[%u] tso_segs[%u] len[%u]\n",
35845 - (unsigned int) skb_shinfo(skb)->tso_size,
35846 - (unsigned int) skb_shinfo(skb)->tso_segs,
35848 + skb->nh.iph->check = 0;
35849 + skb->nh.iph->tot_len = ntohs(mss + ip_tcp_len + tcp_opt_len);
35850 + skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
35851 + skb->nh.iph->daddr,
35852 + 0, IPPROTO_TCP, 0);
35854 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35855 + if (tcp_opt_len || skb->nh.iph->ihl > 5) {
35858 + tsflags = ((skb->nh.iph->ihl - 5) +
35859 + (tcp_opt_len >> 2));
35860 + mss |= (tsflags << 11);
35863 + mss += tcp_opt_len;
35867 @@ -2580,23 +2868,34 @@
35869 if (skb->ip_summed == CHECKSUM_HW)
35870 base_flags |= TXD_FLAG_TCPUDP_CSUM;
35871 -#if TG3_DO_TSO != 0
35872 - if ((mss = skb_shinfo(skb)->tso_size) != 0) {
35873 - static int times = 0;
35874 +#if TG3_TSO_SUPPORT != 0
35876 + if (skb->len > (tp->dev->mtu + ETH_HLEN) &&
35877 + (mss = skb_shinfo(skb)->tso_size) != 0) {
35878 + int tcp_opt_len, ip_tcp_len;
35880 - /* TSO firmware wants TCP options included in
35881 - * tx descriptor MSS value.
35883 - mss += ((skb->h.th->doff * 4) - 20);
35884 + tcp_opt_len = ((skb->h.th->doff - 5) * 4);
35885 + ip_tcp_len = (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr);
35887 base_flags |= (TXD_FLAG_CPU_PRE_DMA |
35888 TXD_FLAG_CPU_POST_DMA);
35890 - if (times++ < 5) {
35891 - printk("tg3_xmit: tso_size[%u] tso_segs[%u] len[%u]\n",
35892 - (unsigned int) skb_shinfo(skb)->tso_size,
35893 - (unsigned int) skb_shinfo(skb)->tso_segs,
35895 + skb->nh.iph->check = 0;
35896 + skb->nh.iph->tot_len = ntohs(mss + ip_tcp_len + tcp_opt_len);
35897 + skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
35898 + skb->nh.iph->daddr,
35899 + 0, IPPROTO_TCP, 0);
35901 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35902 + if (tcp_opt_len || skb->nh.iph->ihl > 5) {
35905 + tsflags = ((skb->nh.iph->ihl - 5) +
35906 + (tcp_opt_len >> 2));
35907 + mss |= (tsflags << 11);
35910 + mss += tcp_opt_len;
35914 @@ -2698,7 +2997,7 @@
35916 struct tg3 *tp = dev->priv;
35918 - if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU)
35919 + if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
35922 if (!netif_running(dev)) {
35923 @@ -2816,7 +3115,7 @@
35924 /* Zero out all descriptors. */
35925 memset(tp->rx_std, 0, TG3_RX_RING_BYTES);
35926 memset(tp->rx_jumbo, 0, TG3_RX_JUMBO_RING_BYTES);
35927 - memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES);
35928 + memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
35930 if (tp->tg3_flags & TG3_FLAG_HOST_TXDS) {
35931 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES);
35932 @@ -2899,7 +3198,7 @@
35933 tp->rx_jumbo = NULL;
35936 - pci_free_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES,
35937 + pci_free_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES(tp),
35938 tp->rx_rcb, tp->rx_rcb_mapping);
35941 @@ -2957,7 +3256,7 @@
35945 - tp->rx_rcb = pci_alloc_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES,
35946 + tp->rx_rcb = pci_alloc_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES(tp),
35947 &tp->rx_rcb_mapping);
35950 @@ -3004,6 +3303,23 @@
35954 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35956 + case RCVLSC_MODE:
35958 + case MBFREE_MODE:
35959 + case BUFMGR_MODE:
35960 + case MEMARB_MODE:
35961 + /* We can't enable/disable these bits of the
35962 + * 5705, just say success.
35972 val &= ~enable_bit;
35974 @@ -3127,7 +3443,10 @@
35975 tp->tg3_flags &= ~TG3_FLAG_5701_REG_WRITE_BUG;
35978 - tw32(GRC_MISC_CFG, GRC_MISC_CFG_CORECLK_RESET);
35979 + val = GRC_MISC_CFG_CORECLK_RESET;
35980 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
35981 + val |= GRC_MISC_CFG_KEEP_GPHY_POWER;
35982 + tw32(GRC_MISC_CFG, val);
35984 /* restore 5701 hardware bug workaround flag */
35985 tp->tg3_flags = flags_save;
35986 @@ -3163,6 +3482,13 @@
35988 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
35990 + if ((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0 &&
35991 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
35992 + tp->pci_clock_ctrl |=
35993 + (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE);
35994 + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
35997 tw32(TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl);
36000 @@ -3358,28 +3684,32 @@
36001 #define TX_CPU_SCRATCH_SIZE 0x04000
36003 /* tp->lock is held. */
36004 -static int tg3_reset_cpu(struct tg3 *tp, u32 offset)
36005 +static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
36009 - tw32(offset + CPU_STATE, 0xffffffff);
36010 - tw32(offset + CPU_MODE, CPU_MODE_RESET);
36011 + if (offset == TX_CPU_BASE &&
36012 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
36015 if (offset == RX_CPU_BASE) {
36016 - for (i = 0; i < 10000; i++)
36017 - if (!(tr32(offset + CPU_MODE) & CPU_MODE_RESET))
36018 + for (i = 0; i < 10000; i++) {
36019 + tw32(offset + CPU_STATE, 0xffffffff);
36020 + tw32(offset + CPU_MODE, CPU_MODE_HALT);
36021 + if (tr32(offset + CPU_MODE) & CPU_MODE_HALT)
36025 tw32(offset + CPU_STATE, 0xffffffff);
36026 - tw32(offset + CPU_MODE, CPU_MODE_RESET);
36027 + tw32(offset + CPU_MODE, CPU_MODE_HALT);
36028 tr32(offset + CPU_MODE);
36031 for (i = 0; i < 10000; i++) {
36032 - if (!(tr32(offset + CPU_MODE) & CPU_MODE_RESET))
36034 tw32(offset + CPU_STATE, 0xffffffff);
36035 - tw32(offset + CPU_MODE, CPU_MODE_RESET);
36036 - tr32(offset + CPU_MODE);
36038 + tw32(offset + CPU_MODE, CPU_MODE_HALT);
36039 + if (tr32(offset + CPU_MODE) & CPU_MODE_HALT)
36044 @@ -3411,38 +3741,52 @@
36047 u32 orig_tg3_flags = tp->tg3_flags;
36048 + void (*write_op)(struct tg3 *, u32, u32);
36050 + if (cpu_base == TX_CPU_BASE &&
36051 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
36052 + printk(KERN_ERR PFX "tg3_load_firmware_cpu: Trying to load "
36053 + "TX cpu firmware on %s which is 5705.\n",
36058 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
36059 + write_op = tg3_write_mem;
36061 + write_op = tg3_write_indirect_reg32;
36063 /* Force use of PCI config space for indirect register
36066 tp->tg3_flags |= TG3_FLAG_PCIX_TARGET_HWBUG;
36068 - err = tg3_reset_cpu(tp, cpu_base);
36069 + err = tg3_halt_cpu(tp, cpu_base);
36073 for (i = 0; i < cpu_scratch_size; i += sizeof(u32))
36074 - tg3_write_indirect_reg32(tp, cpu_scratch_base + i, 0);
36075 + write_op(tp, cpu_scratch_base + i, 0);
36076 tw32(cpu_base + CPU_STATE, 0xffffffff);
36077 tw32(cpu_base + CPU_MODE, tr32(cpu_base+CPU_MODE)|CPU_MODE_HALT);
36078 for (i = 0; i < (info->text_len / sizeof(u32)); i++)
36079 - tg3_write_indirect_reg32(tp, (cpu_scratch_base +
36080 - (info->text_base & 0xffff) +
36081 - (i * sizeof(u32))),
36082 - (info->text_data ?
36083 - info->text_data[i] : 0));
36084 + write_op(tp, (cpu_scratch_base +
36085 + (info->text_base & 0xffff) +
36086 + (i * sizeof(u32))),
36087 + (info->text_data ?
36088 + info->text_data[i] : 0));
36089 for (i = 0; i < (info->rodata_len / sizeof(u32)); i++)
36090 - tg3_write_indirect_reg32(tp, (cpu_scratch_base +
36091 - (info->rodata_base & 0xffff) +
36092 - (i * sizeof(u32))),
36093 - (info->rodata_data ?
36094 - info->rodata_data[i] : 0));
36095 + write_op(tp, (cpu_scratch_base +
36096 + (info->rodata_base & 0xffff) +
36097 + (i * sizeof(u32))),
36098 + (info->rodata_data ?
36099 + info->rodata_data[i] : 0));
36100 for (i = 0; i < (info->data_len / sizeof(u32)); i++)
36101 - tg3_write_indirect_reg32(tp, (cpu_scratch_base +
36102 - (info->data_base & 0xffff) +
36103 - (i * sizeof(u32))),
36104 - (info->data_data ?
36105 - info->data_data[i] : 0));
36106 + write_op(tp, (cpu_scratch_base +
36107 + (info->data_base & 0xffff) +
36108 + (i * sizeof(u32))),
36109 + (info->data_data ?
36110 + info->data_data[i] : 0));
36114 @@ -3513,269 +3857,318 @@
36118 -#if TG3_DO_TSO != 0
36119 +#if TG3_TSO_SUPPORT != 0
36121 #define TG3_TSO_FW_RELEASE_MAJOR 0x1
36122 -#define TG3_TSO_FW_RELASE_MINOR 0x8
36123 +#define TG3_TSO_FW_RELASE_MINOR 0x3
36124 #define TG3_TSO_FW_RELEASE_FIX 0x0
36125 #define TG3_TSO_FW_START_ADDR 0x08000000
36126 #define TG3_TSO_FW_TEXT_ADDR 0x08000000
36127 -#define TG3_TSO_FW_TEXT_LEN 0x1650
36128 +#define TG3_TSO_FW_TEXT_LEN 0x1ac0
36129 #define TG3_TSO_FW_RODATA_ADDR 0x08001650
36130 -#define TG3_TSO_FW_RODATA_LEN 0x30
36131 +#define TG3_TSO_FW_RODATA_LEN 0x60
36132 #define TG3_TSO_FW_DATA_ADDR 0x080016a0
36133 #define TG3_TSO_FW_DATA_LEN 0x20
36134 #define TG3_TSO_FW_SBSS_ADDR 0x080016c0
36135 -#define TG3_TSO_FW_SBSS_LEN 0x14
36136 +#define TG3_TSO_FW_SBSS_LEN 0x2c
36137 #define TG3_TSO_FW_BSS_ADDR 0x080016e0
36138 -#define TG3_TSO_FW_BSS_LEN 0x8fc
36139 +#define TG3_TSO_FW_BSS_LEN 0x890
36141 static u32 tg3TsoFwText[] = {
36142 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c1d0800,
36143 0x37bd4000, 0x03a0f021, 0x3c100800, 0x26100000, 0x0e000010, 0x00000000,
36144 - 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0x3c1bc000,
36145 - 0xafbf0018, 0x0e000058, 0xaf60680c, 0x3c040800, 0x24841650, 0x03602821,
36146 - 0x24060001, 0x24070004, 0xafa00010, 0x0e00006c, 0xafa00014, 0x8f625c50,
36147 - 0x34420001, 0xaf625c50, 0x8f625c90, 0x34420001, 0xaf625c90, 0x2402ffff,
36148 - 0x0e000098, 0xaf625404, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x00000000,
36149 - 0x00000000, 0x00000000, 0x24030b60, 0x24050fff, 0xac000b50, 0x00002021,
36150 - 0xac640000, 0x24630004, 0x0065102b, 0x1440fffc, 0x24840001, 0x24030b60,
36151 - 0x0065102b, 0x10400011, 0x00002021, 0x24090b54, 0x3c06dead, 0x34c6beef,
36152 - 0x24080b58, 0x24070b5c, 0x8c620000, 0x50440006, 0x24630004, 0xad260000,
36153 - 0x8c620000, 0xace40000, 0xad020000, 0x24630004, 0x0065102b, 0x1440fff6,
36154 - 0x24840001, 0x03e00008, 0x00000000, 0x27bdfff8, 0x18800009, 0x00002821,
36155 - 0x8f63680c, 0x8f62680c, 0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a,
36156 - 0x1440fff9, 0x00000000, 0x03e00008, 0x27bd0008, 0x3c020800, 0x34423000,
36157 - 0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac2216c4,
36158 - 0x24020040, 0x3c010800, 0xac2216c8, 0x3c010800, 0xac2016c0, 0xac600000,
36159 - 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
36160 - 0x00804821, 0x8faa0010, 0x3c020800, 0x8c4216c0, 0x3c040800, 0x8c8416c8,
36161 - 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac2316c0, 0x14400003,
36162 - 0x00004021, 0x3c010800, 0xac2016c0, 0x3c020800, 0x8c4216c0, 0x3c030800,
36163 - 0x8c6316c4, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
36164 - 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c4216c0,
36165 - 0x3c030800, 0x8c6316c4, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008,
36166 - 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
36167 - 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf0018, 0xafb10014, 0x0e0000b6,
36168 - 0xafb00010, 0x24110001, 0x8f706820, 0x32020100, 0x10400003, 0x00000000,
36169 - 0x0e000127, 0x00000000, 0x8f706820, 0x32022000, 0x10400004, 0x32020001,
36170 - 0x0e00025a, 0x24040001, 0x32020001, 0x10400003, 0x00000000, 0x0e0000e6,
36171 - 0x00000000, 0x0a00009e, 0xaf715028, 0x8fbf0018, 0x8fb10014, 0x8fb00010,
36172 - 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841660, 0x00002821,
36173 - 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00006c, 0xafa00014,
36174 - 0x3c010800, 0xa4201fb8, 0x3c010800, 0xa02016f8, 0x3c010800, 0xac2016fc,
36175 - 0x3c010800, 0xac201700, 0x3c010800, 0xac201704, 0x3c010800, 0xac20170c,
36176 - 0x3c010800, 0xac201718, 0x3c010800, 0xac20171c, 0x8f624434, 0x3c010800,
36177 - 0xac2216e8, 0x8f624438, 0x3c010800, 0xac2216ec, 0x8f624410, 0x3c010800,
36178 - 0xac2016e0, 0x3c010800, 0xac2016e4, 0x3c010800, 0xac201fc0, 0x3c010800,
36179 - 0xac201f68, 0x3c010800, 0xac201f6c, 0x3c010800, 0xac2216f0, 0x8fbf0018,
36180 - 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x2484166c, 0x00002821,
36181 - 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00006c, 0xafa00014,
36182 - 0x3c040800, 0x24841660, 0x00002821, 0x00003021, 0x00003821, 0xafa00010,
36183 - 0x0e00006c, 0xafa00014, 0x3c010800, 0xa4201fb8, 0x3c010800, 0xa02016f8,
36184 - 0x3c010800, 0xac2016fc, 0x3c010800, 0xac201700, 0x3c010800, 0xac201704,
36185 - 0x3c010800, 0xac20170c, 0x3c010800, 0xac201718, 0x3c010800, 0xac20171c,
36186 - 0x8f624434, 0x3c010800, 0xac2216e8, 0x8f624438, 0x3c010800, 0xac2216ec,
36187 - 0x8f624410, 0x3c010800, 0xac2016e0, 0x3c010800, 0xac2016e4, 0x3c010800,
36188 - 0xac201fc0, 0x3c010800, 0xac201f68, 0x3c010800, 0xac201f6c, 0x3c010800,
36189 - 0xac2216f0, 0x0e000120, 0x00002021, 0x8fbf0018, 0x03e00008, 0x27bd0020,
36190 - 0x24020001, 0x8f636820, 0x00821004, 0x00021027, 0x00621824, 0x03e00008,
36191 - 0xaf636820, 0x27bdffd0, 0x3c0300ff, 0xafbf002c, 0xafb60028, 0xafb50024,
36192 - 0xafb40020, 0xafb3001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x8f665c5c,
36193 - 0x3c040800, 0x2484171c, 0x8c820000, 0x3463fff8, 0x14460005, 0x00c38824,
36194 - 0x3c020800, 0x904216f8, 0x14400115, 0x00000000, 0x00111902, 0x306300ff,
36195 - 0x30c20003, 0x000211c0, 0x00623825, 0x00e02821, 0x00061602, 0xac860000,
36196 - 0x3c030800, 0x906316f8, 0x3044000f, 0x1460002b, 0x00804021, 0x24020001,
36197 - 0x3c010800, 0xa02216f8, 0x00071100, 0x00821025, 0x3c010800, 0xac2016fc,
36198 - 0x3c010800, 0xac201700, 0x3c010800, 0xac201704, 0x3c010800, 0xac20170c,
36199 - 0x3c010800, 0xac201718, 0x3c010800, 0xac201710, 0x3c010800, 0xac201714,
36200 - 0x3c010800, 0xa4221fb8, 0x9623000c, 0x30628000, 0x10400008, 0x30627fff,
36201 - 0x2442003e, 0x3c010800, 0xa42216f6, 0x24020001, 0x3c010800, 0x0a00016e,
36202 - 0xac221fd4, 0x24620036, 0x3c010800, 0xa42216f6, 0x3c010800, 0xac201fd4,
36203 - 0x3c010800, 0xac201fd0, 0x3c010800, 0x0a000176, 0xac201fd8, 0x9622000c,
36204 - 0x3c010800, 0xa4221fcc, 0x3c040800, 0x248416fc, 0x8c820000, 0x00021100,
36205 - 0x3c010800, 0x00220821, 0xac311728, 0x8c820000, 0x00021100, 0x3c010800,
36206 - 0x00220821, 0xac26172c, 0x8c820000, 0x24a30001, 0x306701ff, 0x00021100,
36207 - 0x3c010800, 0x00220821, 0xac271730, 0x8c820000, 0x00021100, 0x3c010800,
36208 - 0x00220821, 0xac281734, 0x96230008, 0x3c020800, 0x8c42170c, 0x00432821,
36209 - 0x3c010800, 0xac25170c, 0x9622000a, 0x30420004, 0x14400019, 0x00071100,
36210 - 0x3c02c000, 0x00c21825, 0xaf635c5c, 0x8f625c50, 0x30420002, 0x1440fffc,
36211 - 0x00000000, 0x8f630c14, 0x3063000f, 0x2c620002, 0x1440001e, 0x00000000,
36212 - 0x8f630c14, 0x3c020800, 0x8c4216b4, 0x3063000f, 0x24420001, 0x3c010800,
36213 - 0xac2216b4, 0x2c620002, 0x1040fff7, 0x00000000, 0x0a0001c1, 0x00000000,
36214 - 0x3c030800, 0x8c6316e0, 0x3c040800, 0x948416f4, 0x01021025, 0x3c010800,
36215 - 0xa4221fba, 0x24020001, 0x3c010800, 0xac221718, 0x24630001, 0x0085202a,
36216 - 0x3c010800, 0x10800003, 0xac2316e0, 0x3c010800, 0xa42516f4, 0x3c030800,
36217 - 0x246316fc, 0x8c620000, 0x24420001, 0xac620000, 0x28420080, 0x14400005,
36218 - 0x24020001, 0x0e0002df, 0x24040002, 0x0a000250, 0x00000000, 0x3c030800,
36219 - 0x906316f8, 0x1462007c, 0x24020003, 0x3c160800, 0x96d616f6, 0x3c050800,
36220 - 0x8ca5170c, 0x32c4ffff, 0x00a4102a, 0x14400078, 0x00000000, 0x3c020800,
36221 - 0x8c421718, 0x10400005, 0x32c2ffff, 0x14a40003, 0x00000000, 0x3c010800,
36222 - 0xac231fd0, 0x10400062, 0x00009021, 0x0040a021, 0x3c150800, 0x26b51700,
36223 - 0x26b30010, 0x8ea20000, 0x00028100, 0x3c110800, 0x02308821, 0x0e0002e1,
36224 - 0x8e311728, 0x00403021, 0x10c00059, 0x00000000, 0x9628000a, 0x31020040,
36225 - 0x10400004, 0x2407180c, 0x8e22000c, 0x2407188c, 0xacc20018, 0x31021000,
36226 - 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, 0x00623825, 0x3c030800,
36227 - 0x00701821, 0x8c631730, 0x3c020800, 0x00501021, 0x8c421734, 0x00031d00,
36228 - 0x00021400, 0x00621825, 0xacc30014, 0x8ea30004, 0x96220008, 0x00432023,
36229 - 0x3242ffff, 0x3083ffff, 0x00431021, 0x0282102a, 0x14400002, 0x02d22823,
36230 - 0x00802821, 0x8e620000, 0x30a4ffff, 0x00441021, 0xae620000, 0x8e220000,
36231 - 0xacc20000, 0x8e220004, 0x8e63fff4, 0x00431021, 0xacc20004, 0xa4c5000e,
36232 - 0x8e62fff4, 0x00441021, 0xae62fff4, 0x96230008, 0x0043102a, 0x14400005,
36233 - 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, 0xae62fff0, 0xacc00008,
36234 - 0x3242ffff, 0x14540008, 0x24020305, 0x31020080, 0x54400001, 0x34e70010,
36235 - 0x24020905, 0xa4c2000c, 0x0a000233, 0x34e70020, 0xa4c2000c, 0x30e2ffff,
36236 - 0xacc20010, 0x3c020800, 0x8c421fd0, 0x10400003, 0x3c024b65, 0x0a00023d,
36237 - 0x34427654, 0x3c02b49a, 0x344289ab, 0xacc2001c, 0x0e000560, 0x00c02021,
36238 - 0x3242ffff, 0x0054102b, 0x1440ffa4, 0x00000000, 0x24020002, 0x3c010800,
36239 - 0x0a000250, 0xa02216f8, 0x8ea208bc, 0x24420001, 0x0a000250, 0xaea208bc,
36240 - 0x14620003, 0x00000000, 0x0e000450, 0x00000000, 0x8fbf002c, 0x8fb60028,
36241 - 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010,
36242 - 0x03e00008, 0x27bd0030, 0x27bdffd8, 0xafb3001c, 0x00809821, 0xafbf0020,
36243 - 0xafb20018, 0xafb10014, 0xafb00010, 0x8f725c9c, 0x3c0200ff, 0x3442fff8,
36244 - 0x3c040800, 0x24841714, 0x02428824, 0x9623000e, 0x8c820000, 0x00431021,
36245 - 0xac820000, 0x8e220010, 0x30420020, 0x14400011, 0x00000000, 0x0e0002f7,
36246 + 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0x3c04fefe,
36247 + 0xafbf0018, 0x0e0005e0, 0x34840002, 0x0e000670, 0x00000000, 0x3c030800,
36248 + 0x90631b78, 0x24020002, 0x3c040800, 0x24841acc, 0x14620003, 0x24050001,
36249 + 0x3c040800, 0x24841ac0, 0x24060002, 0x00003821, 0xafa00010, 0x0e000684,
36250 + 0xafa00014, 0x8f625c50, 0x34420001, 0xaf625c50, 0x8f625c90, 0x34420001,
36251 + 0xaf625c90, 0x2402ffff, 0x0e000034, 0xaf625404, 0x8fbf0018, 0x03e00008,
36252 + 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf0018,
36253 + 0xafb10014, 0x0e000052, 0xafb00010, 0x24110001, 0x8f706820, 0x32020100,
36254 + 0x10400003, 0x00000000, 0x0e0000b2, 0x00000000, 0x8f706820, 0x32022000,
36255 + 0x10400004, 0x32020001, 0x0e0001e3, 0x24040001, 0x32020001, 0x10400003,
36256 + 0x00000000, 0x0e00009a, 0x00000000, 0x0a00003a, 0xaf715028, 0x8fbf0018,
36257 + 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800,
36258 + 0x24841ae0, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
36259 + 0x0e000684, 0xafa00014, 0x3c040800, 0x248423e8, 0xa4800000, 0x3c010800,
36260 + 0xa0201ba8, 0x3c010800, 0xac201bac, 0x3c010800, 0xac201bb0, 0x3c010800,
36261 + 0xac201bb4, 0x3c010800, 0xac201bbc, 0x3c010800, 0xac201bc8, 0x3c010800,
36262 + 0xac201bcc, 0x8f624434, 0x3c010800, 0xac221b98, 0x8f624438, 0x3c010800,
36263 + 0xac221b9c, 0x8f624410, 0xac80f7a8, 0x3c010800, 0xac201b94, 0x3c010800,
36264 + 0xac2023f0, 0x3c010800, 0xac2023d8, 0x3c010800, 0xac2023dc, 0x3c010800,
36265 + 0xac202410, 0x3c010800, 0xac221ba0, 0x8f620068, 0x24030007, 0x00021702,
36266 + 0x10430005, 0x00000000, 0x8f620068, 0x00021702, 0x14400004, 0x24020001,
36267 + 0x3c010800, 0x0a00008e, 0xac20241c, 0xac820034, 0x3c040800, 0x24841aec,
36268 + 0x3c050800, 0x8ca5241c, 0x00003021, 0x00003821, 0xafa00010, 0x0e000684,
36269 + 0xafa00014, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x27bdffe0, 0x3c040800,
36270 + 0x24841af8, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
36271 + 0x0e000684, 0xafa00014, 0x0e000052, 0x00000000, 0x0e0000ab, 0x00002021,
36272 + 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x24020001, 0x8f636820, 0x00821004,
36273 + 0x00021027, 0x00621824, 0x03e00008, 0xaf636820, 0x27bdffd0, 0xafbf002c,
36274 + 0xafb60028, 0xafb50024, 0xafb40020, 0xafb3001c, 0xafb20018, 0xafb10014,
36275 + 0xafb00010, 0x8f665c5c, 0x3c030800, 0x24631bcc, 0x8c620000, 0x14460005,
36276 + 0x3c0200ff, 0x3c020800, 0x90421ba8, 0x14400115, 0x3c0200ff, 0x3442fff8,
36277 + 0x00c28824, 0xac660000, 0x00111902, 0x306300ff, 0x30c20003, 0x000211c0,
36278 + 0x00623825, 0x00e02821, 0x00061602, 0x3c030800, 0x90631ba8, 0x3044000f,
36279 + 0x1460002b, 0x00804021, 0x24020001, 0x3c010800, 0xa0221ba8, 0x00071100,
36280 + 0x00821025, 0x3c010800, 0xac201bac, 0x3c010800, 0xac201bb0, 0x3c010800,
36281 + 0xac201bb4, 0x3c010800, 0xac201bbc, 0x3c010800, 0xac201bc8, 0x3c010800,
36282 + 0xac201bc0, 0x3c010800, 0xac201bc4, 0x3c010800, 0xa42223e8, 0x9623000c,
36283 + 0x30628000, 0x10400008, 0x30627fff, 0x2442003e, 0x3c010800, 0xa4221ba6,
36284 + 0x24020001, 0x3c010800, 0x0a0000f9, 0xac222404, 0x24620036, 0x3c010800,
36285 + 0xa4221ba6, 0x3c010800, 0xac202404, 0x3c010800, 0xac202400, 0x3c010800,
36286 + 0x0a000101, 0xac202408, 0x9622000c, 0x3c010800, 0xa42223fc, 0x3c040800,
36287 + 0x24841bac, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac311bd8,
36288 + 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac261bdc, 0x8c820000,
36289 + 0x24a30001, 0x306701ff, 0x00021100, 0x3c010800, 0x00220821, 0xac271be0,
36290 + 0x8c820000, 0x00021100, 0x3c010800, 0x00220821, 0xac281be4, 0x96230008,
36291 + 0x3c020800, 0x8c421bbc, 0x00432821, 0x3c010800, 0xac251bbc, 0x9622000a,
36292 + 0x30420004, 0x14400018, 0x00071100, 0x8f630c14, 0x3063000f, 0x2c620002,
36293 + 0x1440000b, 0x3c02c000, 0x8f630c14, 0x3c020800, 0x8c421b50, 0x3063000f,
36294 + 0x24420001, 0x3c010800, 0xac221b50, 0x2c620002, 0x1040fff7, 0x3c02c000,
36295 + 0x00c21825, 0xaf635c5c, 0x8f625c50, 0x30420002, 0x10400014, 0x00000000,
36296 + 0x0a000133, 0x00000000, 0x3c030800, 0x8c631b90, 0x3c040800, 0x94841ba4,
36297 + 0x01021025, 0x3c010800, 0xa42223ea, 0x24020001, 0x3c010800, 0xac221bc8,
36298 + 0x24630001, 0x0085202a, 0x3c010800, 0x10800003, 0xac231b90, 0x3c010800,
36299 + 0xa4251ba4, 0x3c060800, 0x24c61bac, 0x8cc20000, 0x24420001, 0xacc20000,
36300 + 0x28420080, 0x14400005, 0x00000000, 0x0e00065e, 0x24040002, 0x0a0001d9,
36301 + 0x00000000, 0x3c020800, 0x8c421bc8, 0x1040007f, 0x24020001, 0x3c040800,
36302 + 0x90841ba8, 0x14820077, 0x24020003, 0x3c150800, 0x96b51ba6, 0x3c050800,
36303 + 0x8ca51bbc, 0x32a3ffff, 0x00a3102a, 0x14400073, 0x00000000, 0x14a30003,
36304 + 0x00000000, 0x3c010800, 0xac242400, 0x10600061, 0x00009021, 0x24d60004,
36305 + 0x0060a021, 0x24d30014, 0x8ec20000, 0x00028100, 0x3c110800, 0x02308821,
36306 + 0x0e00062d, 0x8e311bd8, 0x00403021, 0x10c00059, 0x00000000, 0x9628000a,
36307 + 0x31020040, 0x10400004, 0x2407180c, 0x8e22000c, 0x2407188c, 0xacc20018,
36308 + 0x31021000, 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, 0x00623825,
36309 + 0x3c030800, 0x00701821, 0x8c631be0, 0x3c020800, 0x00501021, 0x8c421be4,
36310 + 0x00031d00, 0x00021400, 0x00621825, 0xacc30014, 0x8ec30004, 0x96220008,
36311 + 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, 0x0282102a, 0x14400002,
36312 + 0x02b22823, 0x00802821, 0x8e620000, 0x30a4ffff, 0x00441021, 0xae620000,
36313 + 0x8e220000, 0xacc20000, 0x8e220004, 0x8e63fff4, 0x00431021, 0xacc20004,
36314 + 0xa4c5000e, 0x8e62fff4, 0x00441021, 0xae62fff4, 0x96230008, 0x0043102a,
36315 + 0x14400005, 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, 0xae62fff0,
36316 + 0xacc00008, 0x3242ffff, 0x14540008, 0x24020305, 0x31020080, 0x54400001,
36317 + 0x34e70010, 0x24020905, 0xa4c2000c, 0x0a0001bc, 0x34e70020, 0xa4c2000c,
36318 + 0x3c020800, 0x8c422400, 0x10400003, 0x3c024b65, 0x0a0001c4, 0x34427654,
36319 + 0x3c02b49a, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005aa,
36320 + 0x00c02021, 0x3242ffff, 0x0054102b, 0x1440ffa4, 0x00000000, 0x24020002,
36321 + 0x3c010800, 0x0a0001d9, 0xa0221ba8, 0x8ec2083c, 0x24420001, 0x0a0001d9,
36322 + 0xaec2083c, 0x14820003, 0x00000000, 0x0e0004b9, 0x00000000, 0x8fbf002c,
36323 + 0x8fb60028, 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
36324 + 0x8fb00010, 0x03e00008, 0x27bd0030, 0x27bdffd0, 0xafbf0028, 0xafb30024,
36325 + 0xafb20020, 0xafb1001c, 0xafb00018, 0x8f725c9c, 0x3c0200ff, 0x3442fff8,
36326 + 0x3c060800, 0x24c61bc4, 0x02428824, 0x9623000e, 0x8cc20000, 0x00431021,
36327 + 0xacc20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821, 0x0e000643,
36328 0x02202021, 0x3c02c000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002,
36329 - 0x10400061, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1040005c,
36330 - 0x00000000, 0x0a000278, 0x00000000, 0x8e220008, 0x00021c02, 0x000321c0,
36331 - 0x3042ffff, 0x3c030800, 0x906316f8, 0x000229c0, 0x24020002, 0x14620003,
36332 - 0x3c034b65, 0x0a000290, 0x00008021, 0x8e22001c, 0x34637654, 0x10430002,
36333 - 0x24100002, 0x24100001, 0x0e000300, 0x02003021, 0x24020003, 0x3c010800,
36334 - 0xa02216f8, 0x24020002, 0x1202000a, 0x24020001, 0x3c030800, 0x8c631fd0,
36335 - 0x10620006, 0x00000000, 0x3c020800, 0x94421fb8, 0x00021400, 0x0a0002cd,
36336 - 0xae220014, 0x3c040800, 0x24841fba, 0x94820000, 0x00021400, 0xae220014,
36337 - 0x3c020800, 0x8c42171c, 0x3c03c000, 0x3c010800, 0xa02016f8, 0x00431025,
36338 - 0xaf625c5c, 0x8f625c50, 0x30420002, 0x10400009, 0x00000000, 0x2484f762,
36339 + 0x10400121, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1040011c,
36340 + 0x00000000, 0x0a000200, 0x00000000, 0x8e240008, 0x8e230014, 0x00041402,
36341 + 0x000241c0, 0x00031502, 0x304201ff, 0x2442ffff, 0x3042007f, 0x00031942,
36342 + 0x30637800, 0x00021100, 0x24424000, 0x00625021, 0x9542000a, 0x3084ffff,
36343 + 0x30420008, 0x104000b3, 0x000429c0, 0x3c020800, 0x8c422410, 0x1440002d,
36344 + 0x25050008, 0x95020014, 0x3c010800, 0xa42223e0, 0x8d070010, 0x00071402,
36345 + 0x3c010800, 0xa42223e2, 0x3c010800, 0xa42723e4, 0x9502000e, 0x30e3ffff,
36346 + 0x00431023, 0x3c010800, 0xac222418, 0x8f626800, 0x3c030010, 0x00431024,
36347 + 0x10400005, 0x00000000, 0x9503001a, 0x9502001c, 0x0a000235, 0x00431021,
36348 + 0x9502001a, 0x3c010800, 0xac22240c, 0x3c02c000, 0x02421825, 0x3c010800,
36349 + 0xac282410, 0x3c010800, 0xac322414, 0xaf635c9c, 0x8f625c90, 0x30420002,
36350 + 0x104000df, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000da,
36351 + 0x00000000, 0x0a000242, 0x00000000, 0x9502000e, 0x3c030800, 0x946323e4,
36352 + 0x00434823, 0x3123ffff, 0x2c620008, 0x1040001c, 0x00000000, 0x95020014,
36353 + 0x24420028, 0x00a22821, 0x00031042, 0x1840000b, 0x00002021, 0x24c60848,
36354 + 0x00403821, 0x94a30000, 0x8cc20000, 0x24840001, 0x00431021, 0xacc20000,
36355 + 0x0087102a, 0x1440fff9, 0x24a50002, 0x31220001, 0x1040001f, 0x3c024000,
36356 + 0x3c040800, 0x2484240c, 0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021,
36357 + 0x0a000281, 0xac820000, 0x8f626800, 0x3c030010, 0x00431024, 0x10400009,
36358 + 0x00000000, 0x9502001a, 0x3c030800, 0x8c63240c, 0x00431021, 0x3c010800,
36359 + 0xac22240c, 0x0a000282, 0x3c024000, 0x9502001a, 0x9504001c, 0x3c030800,
36360 + 0x8c63240c, 0x00441023, 0x00621821, 0x3c010800, 0xac23240c, 0x3c024000,
36361 + 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000,
36362 + 0x9542000a, 0x30420010, 0x10400095, 0x00000000, 0x3c060800, 0x24c62410,
36363 + 0x3c020800, 0x944223e4, 0x8cc50000, 0x3c040800, 0x8c842418, 0x24420030,
36364 + 0x00a22821, 0x94a20004, 0x3c030800, 0x8c63240c, 0x00441023, 0x00621821,
36365 + 0x00603821, 0x00032402, 0x30e2ffff, 0x00823821, 0x00071402, 0x00e23821,
36366 + 0x00071027, 0x3c010800, 0xac23240c, 0xa4a20006, 0x3c030800, 0x8c632414,
36367 + 0x3c0200ff, 0x3442fff8, 0x00628824, 0x96220008, 0x24040001, 0x24034000,
36368 + 0x000241c0, 0x00e01021, 0xa502001a, 0xa500001c, 0xacc00000, 0x3c010800,
36369 + 0xac241b70, 0xaf635cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000,
36370 + 0x3c010800, 0xac201b70, 0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002,
36371 + 0x10400003, 0x00000000, 0x3c010800, 0xac201b70, 0x3c020800, 0x8c421b70,
36372 + 0x1040ffec, 0x00000000, 0x3c040800, 0x0e000643, 0x8c842414, 0x0a000320,
36373 + 0x00000000, 0x3c030800, 0x90631ba8, 0x24020002, 0x14620003, 0x3c034b65,
36374 + 0x0a0002d7, 0x00008021, 0x8e22001c, 0x34637654, 0x10430002, 0x24100002,
36375 + 0x24100001, 0x01002021, 0x0e000346, 0x02003021, 0x24020003, 0x3c010800,
36376 + 0xa0221ba8, 0x24020002, 0x1202000a, 0x24020001, 0x3c030800, 0x8c632400,
36377 + 0x10620006, 0x00000000, 0x3c020800, 0x944223e8, 0x00021400, 0x0a000315,
36378 + 0xae220014, 0x3c040800, 0x248423ea, 0x94820000, 0x00021400, 0xae220014,
36379 + 0x3c020800, 0x8c421bcc, 0x3c03c000, 0x3c010800, 0xa0201ba8, 0x00431025,
36380 + 0xaf625c5c, 0x8f625c50, 0x30420002, 0x10400009, 0x00000000, 0x2484f7e2,
36381 0x8c820000, 0x00431025, 0xaf625c5c, 0x8f625c50, 0x30420002, 0x1440fffa,
36382 - 0x00000000, 0x3c020800, 0x244216e4, 0x8c430000, 0x24630001, 0xac430000,
36383 - 0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000b, 0x00009821, 0x8f630c14,
36384 - 0x3c020800, 0x8c4216b4, 0x3063000f, 0x24420001, 0x3c010800, 0xac2216b4,
36385 - 0x2c620002, 0x1040fff7, 0x00009821, 0x3c024000, 0x02421825, 0xaf635c9c,
36386 + 0x00000000, 0x3c020800, 0x24421b94, 0x8c430000, 0x24630001, 0xac430000,
36387 + 0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000c, 0x3c024000, 0x8f630c14,
36388 + 0x3c020800, 0x8c421b50, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b50,
36389 + 0x2c620002, 0x1040fff7, 0x00000000, 0x3c024000, 0x02421825, 0xaf635c9c,
36390 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, 0x12600003, 0x00000000,
36391 - 0x0e000450, 0x00000000, 0x8fbf0020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
36392 - 0x8fb00010, 0x03e00008, 0x27bd0028, 0x0a0002df, 0x00000000, 0x8f634450,
36393 - 0x3c040800, 0x248416e8, 0x8c820000, 0x00031c02, 0x0043102b, 0x14400007,
36394 - 0x3c038000, 0x8c840004, 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc,
36395 - 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000,
36396 - 0x8f624448, 0x03e00008, 0x3042ffff, 0x3c024000, 0x00822025, 0xaf645c38,
36397 - 0x8f625c30, 0x30420002, 0x1440fffc, 0x00000000, 0x03e00008, 0x00000000,
36398 - 0x27bdffe0, 0x00805021, 0x14c00017, 0x254c0008, 0x3c020800, 0x8c421fd4,
36399 - 0x1040000a, 0x2402003e, 0x3c010800, 0xa4221fb0, 0x24020016, 0x3c010800,
36400 - 0xa4221fb2, 0x2402002a, 0x3c010800, 0x0a00031a, 0xa4221fb4, 0x95420014,
36401 - 0x3c010800, 0xa4221fb0, 0x8d430010, 0x00031402, 0x3c010800, 0xa4221fb2,
36402 - 0x3c010800, 0xa4231fb4, 0x3c040800, 0x94841fb4, 0x3c030800, 0x94631fb2,
36403 - 0x958d0006, 0x3c020800, 0x94421fb0, 0x00832023, 0x01a27023, 0x3065ffff,
36404 - 0x24a20028, 0x01824021, 0x3082ffff, 0x14c0001a, 0x01025821, 0x9562000c,
36405 - 0x3042003f, 0x3c010800, 0xa4221fb6, 0x95620004, 0x95630006, 0x3c010800,
36406 - 0xac201fc4, 0x3c010800, 0xac201fc8, 0x00021400, 0x00431025, 0x3c010800,
36407 - 0xac221720, 0x95020004, 0x3c010800, 0xa4221724, 0x95030002, 0x01a51023,
36408 - 0x0043102a, 0x10400010, 0x24020001, 0x3c010800, 0x0a00034e, 0xac221fd8,
36409 - 0x3c030800, 0x8c631fc8, 0x3c020800, 0x94421724, 0x00431021, 0xa5020004,
36410 - 0x3c020800, 0x94421720, 0xa5620004, 0x3c020800, 0x8c421720, 0xa5620006,
36411 - 0x3c020800, 0x8c421fd0, 0x3c070800, 0x8ce71fc4, 0x3c050800, 0x144000c7,
36412 - 0x8ca51fc8, 0x3c020800, 0x94421724, 0x00451821, 0x3063ffff, 0x0062182b,
36413 - 0x24020002, 0x10c2000d, 0x00a32823, 0x3c020800, 0x94421fb6, 0x30420009,
36414 - 0x10400008, 0x00000000, 0x9562000c, 0x3042fff6, 0xa562000c, 0x3c020800,
36415 - 0x94421fb6, 0x30420009, 0x00e23823, 0x3c020800, 0x8c421fd8, 0x1040004b,
36416 - 0x24020002, 0x01003021, 0x3c020800, 0x94421fb2, 0x00003821, 0xa500000a,
36417 - 0x01a21023, 0xa5020002, 0x3082ffff, 0x00021042, 0x18400008, 0x00002821,
36418 - 0x00401821, 0x94c20000, 0x24e70001, 0x00a22821, 0x00e3102a, 0x1440fffb,
36419 - 0x24c60002, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402, 0x00a22821,
36420 - 0x00a04821, 0x00051027, 0xa502000a, 0x00002821, 0x2506000c, 0x00003821,
36421 - 0x94c20000, 0x24e70001, 0x00a22821, 0x2ce20004, 0x1440fffb, 0x24c60002,
36422 - 0x95020002, 0x00003821, 0x91030009, 0x00442023, 0x01603021, 0x3082ffff,
36423 - 0xa4c00010, 0x00621821, 0x00021042, 0x18400010, 0x00a32821, 0x00404021,
36424 - 0x94c20000, 0x24c60002, 0x00a22821, 0x30c2007f, 0x14400006, 0x24e70001,
36425 - 0x8d430000, 0x3c02007f, 0x3442ff80, 0x00625024, 0x25460008, 0x00e8102a,
36426 - 0x1440fff3, 0x00000000, 0x30820001, 0x10400005, 0x00051c02, 0xa0c00001,
36427 - 0x94c20000, 0x00a22821, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402,
36428 - 0x00a22821, 0x0a000415, 0x30a5ffff, 0x14c20063, 0x00000000, 0x3c090800,
36429 - 0x95291fb2, 0x95030002, 0x01a91023, 0x1062005d, 0x01003021, 0x00003821,
36430 - 0x00002821, 0x01a91023, 0xa5020002, 0x3082ffff, 0x00021042, 0x18400008,
36431 - 0xa500000a, 0x00401821, 0x94c20000, 0x24e70001, 0x00a22821, 0x00e3102a,
36432 - 0x1440fffb, 0x24c60002, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402,
36433 - 0x00a22821, 0x00a04821, 0x00051027, 0xa502000a, 0x00002821, 0x2506000c,
36434 - 0x00003821, 0x94c20000, 0x24e70001, 0x00a22821, 0x2ce20004, 0x1440fffb,
36435 - 0x24c60002, 0x95020002, 0x00003821, 0x91030009, 0x00442023, 0x01603021,
36436 - 0x3082ffff, 0xa4c00010, 0x3c040800, 0x94841fb4, 0x00621821, 0x00a32821,
36437 - 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051c02, 0x3c020800, 0x94421fb0,
36438 - 0x00a34021, 0x00441023, 0x00021fc2, 0x00431021, 0x00021043, 0x18400010,
36439 - 0x00002821, 0x00402021, 0x94c20000, 0x24c60002, 0x00a22821, 0x30c2007f,
36440 - 0x14400006, 0x24e70001, 0x8d430000, 0x3c02007f, 0x3442ff80, 0x00625024,
36441 - 0x25460008, 0x00e4102a, 0x1440fff3, 0x00000000, 0x3c020800, 0x94421fcc,
36442 - 0x00a22821, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402, 0x00a22821,
36443 - 0x3102ffff, 0x00a22821, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402,
36444 - 0x00a22821, 0x00a02021, 0x00051027, 0xa5620010, 0xad800014, 0x0a000435,
36445 - 0xad800000, 0x8d830010, 0x00602021, 0x10a00007, 0x00034c02, 0x01252821,
36446 - 0x00051402, 0x30a3ffff, 0x00432821, 0x00051402, 0x00a24821, 0x00091027,
36447 - 0xa502000a, 0x3c030800, 0x94631fb4, 0x3082ffff, 0x01a21021, 0x00432823,
36448 - 0x00a72821, 0x00051c02, 0x30a2ffff, 0x00622821, 0x00051402, 0x00a22821,
36449 - 0x00a02021, 0x00051027, 0xa5620010, 0x3082ffff, 0x00091c00, 0x00431025,
36450 - 0xad820010, 0x3c020800, 0x8c421fd4, 0x10400002, 0x25a2fff2, 0xa5820034,
36451 - 0x3c020800, 0x8c421fc8, 0x3c030800, 0x8c631720, 0x24420001, 0x3c010800,
36452 - 0xac221fc8, 0x3c020800, 0x8c421fc4, 0x31c4ffff, 0x00641821, 0x3c010800,
36453 - 0xac231720, 0x00441021, 0x3c010800, 0xac221fc4, 0x03e00008, 0x27bd0020,
36454 - 0x27bdffc8, 0x3c040800, 0x248416f8, 0xafbf0034, 0xafbe0030, 0xafb7002c,
36455 - 0xafb60028, 0xafb50024, 0xafb40020, 0xafb3001c, 0xafb20018, 0xafb10014,
36456 - 0xafb00010, 0x90830000, 0x24020003, 0x146200f4, 0x00000000, 0x3c020800,
36457 - 0x8c421710, 0x3c030800, 0x8c63170c, 0x3c1e0800, 0x97de16f6, 0x0043102a,
36458 - 0x104000eb, 0x3c168000, 0x249708c4, 0x33d5ffff, 0x24920018, 0x3c020800,
36459 - 0x8c421718, 0x104000e4, 0x00000000, 0x3c140800, 0x96941fb0, 0x3282ffff,
36460 - 0x104000d6, 0x00008021, 0x00409821, 0x00008821, 0x8f634450, 0x3c020800,
36461 - 0x8c4216e8, 0x00031c02, 0x0043102b, 0x14400008, 0x00000000, 0x3c040800,
36462 - 0x8c8416ec, 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x00000000,
36463 - 0xaf764444, 0x8f624444, 0x00561024, 0x10400006, 0x00000000, 0x3c038000,
36464 - 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x3046ffff,
36465 - 0x10c0005f, 0x00000000, 0x3c090800, 0x01314821, 0x8d291728, 0x9528000a,
36466 - 0x31020040, 0x10400004, 0x2407180c, 0x8d22000c, 0x2407188c, 0xacc20018,
36467 - 0x31021000, 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, 0x00623825,
36468 - 0x31020080, 0x54400001, 0x34e70010, 0x3c020800, 0x00511021, 0x8c421730,
36469 - 0x3c030800, 0x00711821, 0x8c631734, 0x00021500, 0x00031c00, 0x00431025,
36470 - 0xacc20014, 0x95240008, 0x3202ffff, 0x00821021, 0x0262102a, 0x14400002,
36471 - 0x02902823, 0x00802821, 0x8d220000, 0x02058021, 0xacc20000, 0x8d220004,
36472 - 0x00c02021, 0x26310010, 0xac820004, 0x30e2ffff, 0xac800008, 0xa485000e,
36473 - 0xac820010, 0x24020305, 0x0e000560, 0xa482000c, 0x3202ffff, 0x0053102b,
36474 - 0x1440ffaf, 0x3202ffff, 0x0a00054c, 0x00000000, 0x8e420000, 0x8e43fffc,
36475 - 0x0043102a, 0x10400084, 0x00000000, 0x8e45fff0, 0x8f644450, 0x3c030800,
36476 - 0x8c6316e8, 0x00051100, 0x3c090800, 0x01224821, 0x8d291728, 0x00041402,
36477 - 0x0062182b, 0x14600008, 0x00000000, 0x3c030800, 0x8c6316ec, 0x8f624450,
36478 - 0x00021402, 0x0062102b, 0x1040fffc, 0x00000000, 0xaf764444, 0x8f624444,
36479 - 0x00561024, 0x10400006, 0x00000000, 0x3c038000, 0x8f624444, 0x00431024,
36480 - 0x1440fffd, 0x00000000, 0x8f624448, 0x3046ffff, 0x14c00005, 0x00000000,
36481 - 0x8ee20000, 0x24420001, 0x0a000554, 0xaee20000, 0x9528000a, 0x31020040,
36482 - 0x10400004, 0x2407180c, 0x8d22000c, 0x2407188c, 0xacc20018, 0x31021000,
36483 - 0x10400004, 0x34e32000, 0x00081040, 0x3042c000, 0x00623825, 0x00051900,
36484 - 0x3c020800, 0x00431021, 0x8c421730, 0x3c010800, 0x00230821, 0x8c231734,
36485 - 0x00021500, 0x00031c00, 0x00431025, 0xacc20014, 0x3c030800, 0x8c631704,
36486 - 0x95220008, 0x00432023, 0x3202ffff, 0x3083ffff, 0x00431021, 0x02a2102a,
36487 - 0x14400002, 0x03d02823, 0x00802821, 0x8e420000, 0x30a4ffff, 0x00441021,
36488 - 0xae420000, 0xa4c5000e, 0x8d220000, 0xacc20000, 0x8d220004, 0x8e43fff4,
36489 - 0x00431021, 0xacc20004, 0x8e43fff4, 0x95220008, 0x00641821, 0x0062102a,
36490 - 0x14400006, 0x02058021, 0x8e42fff0, 0xae40fff4, 0x24420001, 0x0a000530,
36491 - 0xae42fff0, 0xae43fff4, 0xacc00008, 0x3202ffff, 0x10550003, 0x31020004,
36492 - 0x10400006, 0x24020305, 0x31020080, 0x54400001, 0x34e70010, 0x34e70020,
36493 - 0x24020905, 0xa4c2000c, 0x30e2ffff, 0xacc20010, 0x3c030800, 0x8c63170c,
36494 - 0x3c020800, 0x8c421710, 0x54620004, 0x3c02b49a, 0x3c024b65, 0x0a000548,
36495 - 0x34427654, 0x344289ab, 0xacc2001c, 0x0e000560, 0x00c02021, 0x3202ffff,
36496 - 0x0055102b, 0x1440ff7e, 0x00000000, 0x8e420000, 0x8e43fffc, 0x0043102a,
36497 - 0x1440ff1a, 0x00000000, 0x8fbf0034, 0x8fbe0030, 0x8fb7002c, 0x8fb60028,
36498 - 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010,
36499 - 0x03e00008, 0x27bd0038, 0x27bdffe8, 0xafbf0014, 0xafb00010, 0x8f624450,
36500 - 0x8f634410, 0x0a00056f, 0x00808021, 0x8f626820, 0x30422000, 0x10400003,
36501 - 0x00000000, 0x0e00025a, 0x00002021, 0x8f624450, 0x8f634410, 0x3042ffff,
36502 - 0x0043102b, 0x1440fff5, 0x00000000, 0x8f630c14, 0x3063000f, 0x2c620002,
36503 - 0x1440000b, 0x00000000, 0x8f630c14, 0x3c020800, 0x8c4216b4, 0x3063000f,
36504 - 0x24420001, 0x3c010800, 0xac2216b4, 0x2c620002, 0x1040fff7, 0x00000000,
36505 - 0xaf705c18, 0x8f625c10, 0x30420002, 0x10400009, 0x00000000, 0x8f626820,
36506 - 0x30422000, 0x1040fff8, 0x00000000, 0x0e00025a, 0x00002021, 0x0a000582,
36507 - 0x00000000, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x00000000,
36509 + 0x0e0004b9, 0x00000000, 0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c,
36510 + 0x8fb00018, 0x03e00008, 0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b98,
36511 + 0x8c820000, 0x00031c02, 0x0043102b, 0x14400007, 0x3c038000, 0x8c840004,
36512 + 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444,
36513 + 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008,
36514 + 0x3042ffff, 0x3c024000, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002,
36515 + 0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00805821,
36516 + 0x14c00017, 0x256e0008, 0x3c020800, 0x8c422404, 0x1040000a, 0x2402003e,
36517 + 0x3c010800, 0xa42223e0, 0x24020016, 0x3c010800, 0xa42223e2, 0x2402002a,
36518 + 0x3c010800, 0x0a000360, 0xa42223e4, 0x95620014, 0x3c010800, 0xa42223e0,
36519 + 0x8d670010, 0x00071402, 0x3c010800, 0xa42223e2, 0x3c010800, 0xa42723e4,
36520 + 0x3c040800, 0x948423e4, 0x3c030800, 0x946323e2, 0x95cf0006, 0x3c020800,
36521 + 0x944223e0, 0x00832023, 0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821,
36522 + 0x3082ffff, 0x14c0001a, 0x01226021, 0x9582000c, 0x3042003f, 0x3c010800,
36523 + 0xa42223e6, 0x95820004, 0x95830006, 0x3c010800, 0xac2023f4, 0x3c010800,
36524 + 0xac2023f8, 0x00021400, 0x00431025, 0x3c010800, 0xac221bd0, 0x95220004,
36525 + 0x3c010800, 0xa4221bd4, 0x95230002, 0x01e51023, 0x0043102a, 0x10400010,
36526 + 0x24020001, 0x3c010800, 0x0a000394, 0xac222408, 0x3c030800, 0x8c6323f8,
36527 + 0x3c020800, 0x94421bd4, 0x00431021, 0xa5220004, 0x3c020800, 0x94421bd0,
36528 + 0xa5820004, 0x3c020800, 0x8c421bd0, 0xa5820006, 0x3c020800, 0x8c422400,
36529 + 0x3c0d0800, 0x8dad23f4, 0x3c0a0800, 0x144000e5, 0x8d4a23f8, 0x3c020800,
36530 + 0x94421bd4, 0x004a1821, 0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d,
36531 + 0x01435023, 0x3c020800, 0x944223e6, 0x30420009, 0x10400008, 0x00000000,
36532 + 0x9582000c, 0x3042fff6, 0xa582000c, 0x3c020800, 0x944223e6, 0x30420009,
36533 + 0x01a26823, 0x3c020800, 0x8c422408, 0x1040004a, 0x01203821, 0x3c020800,
36534 + 0x944223e2, 0x00004021, 0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff,
36535 + 0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001,
36536 + 0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff,
36537 + 0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a,
36538 + 0x00003021, 0x2527000c, 0x00004021, 0x94e20000, 0x25080001, 0x00c23021,
36539 + 0x2d020004, 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021, 0x91230009,
36540 + 0x00442023, 0x01803821, 0x3082ffff, 0xa4e00010, 0x00621821, 0x00021042,
36541 + 0x18400010, 0x00c33021, 0x00404821, 0x94e20000, 0x24e70002, 0x00c23021,
36542 + 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80,
36543 + 0x00625824, 0x25670008, 0x0109102a, 0x1440fff3, 0x00000000, 0x30820001,
36544 + 0x10400005, 0x00061c02, 0xa0e00001, 0x94e20000, 0x00c23021, 0x00061c02,
36545 + 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x0a000479, 0x30c6ffff,
36546 + 0x24020002, 0x14c20081, 0x00000000, 0x3c020800, 0x8c42241c, 0x14400007,
36547 + 0x00000000, 0x3c020800, 0x944223e2, 0x95230002, 0x01e21023, 0x10620077,
36548 + 0x00000000, 0x3c020800, 0x944223e2, 0x01e21023, 0xa5220002, 0x3c020800,
36549 + 0x8c42241c, 0x1040001a, 0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421ba6,
36550 + 0x00e04021, 0x00072c02, 0x00aa2021, 0x00431023, 0x00823823, 0x00072402,
36551 + 0x30e2ffff, 0x00823821, 0x00071027, 0xa522000a, 0x3102ffff, 0x3c040800,
36552 + 0x948423e4, 0x00453023, 0x00e02821, 0x00641823, 0x006d1821, 0x00c33021,
36553 + 0x00061c02, 0x30c2ffff, 0x0a000479, 0x00623021, 0x01203821, 0x00004021,
36554 + 0x3082ffff, 0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000,
36555 + 0x25080001, 0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02,
36556 + 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027,
36557 + 0xa522000a, 0x00003021, 0x2527000c, 0x00004021, 0x94e20000, 0x25080001,
36558 + 0x00c23021, 0x2d020004, 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021,
36559 + 0x91230009, 0x00442023, 0x01803821, 0x3082ffff, 0xa4e00010, 0x3c040800,
36560 + 0x948423e4, 0x00621821, 0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021,
36561 + 0x00061c02, 0x3c020800, 0x944223e0, 0x00c34821, 0x00441023, 0x00021fc2,
36562 + 0x00431021, 0x00021043, 0x18400010, 0x00003021, 0x00402021, 0x94e20000,
36563 + 0x24e70002, 0x00c23021, 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000,
36564 + 0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008, 0x0104102a, 0x1440fff3,
36565 + 0x00000000, 0x3c020800, 0x944223fc, 0x00c23021, 0x3122ffff, 0x00c23021,
36566 + 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021,
36567 + 0x00061027, 0xa5820010, 0xadc00014, 0x0a000499, 0xadc00000, 0x8dc70010,
36568 + 0x00e04021, 0x11400007, 0x00072c02, 0x00aa3021, 0x00061402, 0x30c3ffff,
36569 + 0x00433021, 0x00061402, 0x00c22821, 0x00051027, 0xa522000a, 0x3c030800,
36570 + 0x946323e4, 0x3102ffff, 0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02,
36571 + 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021, 0x00061027,
36572 + 0xa5820010, 0x3102ffff, 0x00051c00, 0x00431025, 0xadc20010, 0x3c020800,
36573 + 0x8c422404, 0x10400002, 0x25e2fff2, 0xa5c20034, 0x3c020800, 0x8c4223f8,
36574 + 0x3c040800, 0x8c8423f4, 0x24420001, 0x3c010800, 0xac2223f8, 0x3c020800,
36575 + 0x8c421bd0, 0x3303ffff, 0x00832021, 0x3c010800, 0xac2423f4, 0x00431821,
36576 + 0x0062102b, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223f4, 0x3c010800,
36577 + 0xac231bd0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800, 0x24a51ba8,
36578 + 0xafbf0044, 0xafbe0040, 0xafb7003c, 0xafb60038, 0xafb50034, 0xafb40030,
36579 + 0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x90a30000, 0x24020003,
36580 + 0x146200d5, 0x00000000, 0x3c090800, 0x95291ba6, 0x3c020800, 0x944223e0,
36581 + 0x3c030800, 0x8c631bc0, 0x3c040800, 0x8c841bbc, 0x01221023, 0x0064182a,
36582 + 0xa7a9001e, 0x106000c8, 0xa7a20016, 0x24be0020, 0x97b6001e, 0x24b30018,
36583 + 0x24b70014, 0x8fc20000, 0x14400008, 0x00000000, 0x8fc2fff8, 0x97a30016,
36584 + 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000ba, 0x00000000, 0x97d50818,
36585 + 0x32a2ffff, 0x104000ad, 0x00009021, 0x0040a021, 0x00008821, 0x0e00062d,
36586 + 0x00000000, 0x00403021, 0x14c00007, 0x00000000, 0x3c020800, 0x8c4223ec,
36587 + 0x24420001, 0x3c010800, 0x0a00059e, 0xac2223ec, 0x3c100800, 0x02118021,
36588 + 0x8e101bd8, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c,
36589 + 0x2407188c, 0xacc20018, 0x31021000, 0x10400004, 0x34e32000, 0x00081040,
36590 + 0x3042c000, 0x00623825, 0x31020080, 0x54400001, 0x34e70010, 0x3c020800,
36591 + 0x00511021, 0x8c421be0, 0x3c030800, 0x00711821, 0x8c631be4, 0x00021500,
36592 + 0x00031c00, 0x00431025, 0xacc20014, 0x96040008, 0x3242ffff, 0x00821021,
36593 + 0x0282102a, 0x14400002, 0x02b22823, 0x00802821, 0x8e020000, 0x02459021,
36594 + 0xacc20000, 0x8e020004, 0x00c02021, 0x26310010, 0xac820004, 0x30e2ffff,
36595 + 0xac800008, 0xa485000e, 0xac820010, 0x24020305, 0x0e0005aa, 0xa482000c,
36596 + 0x3242ffff, 0x0054102b, 0x1440ffc0, 0x3242ffff, 0x0a000596, 0x00000000,
36597 + 0x8e620000, 0x8e63fffc, 0x0043102a, 0x1040006c, 0x00000000, 0x8e62fff0,
36598 + 0x00028900, 0x3c100800, 0x02118021, 0x0e00062d, 0x8e101bd8, 0x00403021,
36599 + 0x14c00005, 0x00000000, 0x8e62082c, 0x24420001, 0x0a00059e, 0xae62082c,
36600 + 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c, 0x2407188c,
36601 + 0xacc20018, 0x31021000, 0x10400004, 0x34e32000, 0x00081040, 0x3042c000,
36602 + 0x00623825, 0x3c020800, 0x00511021, 0x8c421be0, 0x3c030800, 0x00711821,
36603 + 0x8c631be4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014, 0x8e63fff4,
36604 + 0x96020008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021, 0x02c2102a,
36605 + 0x10400003, 0x00802821, 0x97a9001e, 0x01322823, 0x8e620000, 0x30a4ffff,
36606 + 0x00441021, 0xae620000, 0xa4c5000e, 0x8e020000, 0xacc20000, 0x8e020004,
36607 + 0x8e63fff4, 0x00431021, 0xacc20004, 0x8e63fff4, 0x96020008, 0x00641821,
36608 + 0x0062102a, 0x14400006, 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001,
36609 + 0x0a000579, 0xae62fff0, 0xae63fff4, 0xacc00008, 0x3242ffff, 0x10560003,
36610 + 0x31020004, 0x10400006, 0x24020305, 0x31020080, 0x54400001, 0x34e70010,
36611 + 0x34e70020, 0x24020905, 0xa4c2000c, 0x8ee30000, 0x8ee20004, 0x14620007,
36612 + 0x3c02b49a, 0x8ee20860, 0x54400001, 0x34e70400, 0x3c024b65, 0x0a000590,
36613 + 0x34427654, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005aa,
36614 + 0x00c02021, 0x3242ffff, 0x0056102b, 0x1440ff96, 0x00000000, 0x8e620000,
36615 + 0x8e63fffc, 0x0043102a, 0x1440ff3e, 0x00000000, 0x8fbf0044, 0x8fbe0040,
36616 + 0x8fb7003c, 0x8fb60038, 0x8fb50034, 0x8fb40030, 0x8fb3002c, 0x8fb20028,
36617 + 0x8fb10024, 0x8fb00020, 0x03e00008, 0x27bd0048, 0x27bdffe8, 0xafbf0014,
36618 + 0xafb00010, 0x8f624450, 0x8f634410, 0x0a0005b9, 0x00808021, 0x8f626820,
36619 + 0x30422000, 0x10400003, 0x00000000, 0x0e0001e3, 0x00002021, 0x8f624450,
36620 + 0x8f634410, 0x3042ffff, 0x0043102b, 0x1440fff5, 0x00000000, 0x8f630c14,
36621 + 0x3063000f, 0x2c620002, 0x1440000b, 0x00000000, 0x8f630c14, 0x3c020800,
36622 + 0x8c421b50, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b50, 0x2c620002,
36623 + 0x1040fff7, 0x00000000, 0xaf705c18, 0x8f625c10, 0x30420002, 0x10400009,
36624 + 0x00000000, 0x8f626820, 0x30422000, 0x1040fff8, 0x00000000, 0x0e0001e3,
36625 + 0x00002021, 0x0a0005cc, 0x00000000, 0x8fbf0014, 0x8fb00010, 0x03e00008,
36626 + 0x27bd0018, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000,
36627 + 0xafbf0014, 0xafb00010, 0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804,
36628 + 0x8f634000, 0x24020b50, 0x3c010800, 0xac221b64, 0x24020b78, 0x3c010800,
36629 + 0xac221b74, 0x34630002, 0xaf634000, 0x0e00060d, 0x00808021, 0x3c010800,
36630 + 0xa0221b78, 0x304200ff, 0x24030002, 0x14430005, 0x00000000, 0x3c020800,
36631 + 0x8c421b64, 0x0a000600, 0xac5000c0, 0x3c020800, 0x8c421b64, 0xac5000bc,
36632 + 0x8f624434, 0x8f634438, 0x8f644410, 0x3c010800, 0xac221b6c, 0x3c010800,
36633 + 0xac231b7c, 0x3c010800, 0xac241b68, 0x8fbf0014, 0x8fb00010, 0x03e00008,
36634 + 0x27bd0018, 0x3c040800, 0x8c870000, 0x3c03aa55, 0x3463aa55, 0x3c06c003,
36635 + 0xac830000, 0x8cc20000, 0x14430007, 0x24050002, 0x3c0355aa, 0x346355aa,
36636 + 0xac830000, 0x8cc20000, 0x50430001, 0x24050001, 0x3c020800, 0xac470000,
36637 + 0x03e00008, 0x00a01021, 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c,
36638 + 0x8f62680c, 0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9,
36639 + 0x00000000, 0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b6c,
36640 + 0x00031c02, 0x0043102b, 0x14400008, 0x3c038000, 0x3c040800, 0x8c841b7c,
36641 + 0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444,
36642 + 0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008,
36643 + 0x3042ffff, 0x3082ffff, 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000,
36644 + 0x0a000650, 0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002,
36645 + 0x1440fffc, 0x00001021, 0x03e00008, 0x00000000, 0x8f624450, 0x3c030800,
36646 + 0x8c631b68, 0x0a000659, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b,
36647 + 0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821,
36648 + 0x3c040800, 0x24841b10, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
36649 + 0x0e000684, 0xafa00014, 0x0a000668, 0x00000000, 0x8fbf0018, 0x03e00008,
36650 + 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x3c020800, 0x34423000,
36651 + 0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac221b84,
36652 + 0x24020040, 0x3c010800, 0xac221b88, 0x3c010800, 0xac201b80, 0xac600000,
36653 + 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
36654 + 0x00804821, 0x8faa0010, 0x3c020800, 0x8c421b80, 0x3c040800, 0x8c841b88,
36655 + 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac231b80, 0x14400003,
36656 + 0x00004021, 0x3c010800, 0xac201b80, 0x3c020800, 0x8c421b80, 0x3c030800,
36657 + 0x8c631b84, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
36658 + 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b80,
36659 + 0x3c030800, 0x8c631b84, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008,
36660 + 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
36661 + 0x00000000, 0x00000000,
36664 u32 tg3TsoFwRodata[] = {
36665 - 0x4d61696e, 0x43707542, 0x00000000, 0x00000000, 0x74637073, 0x6567496e,
36666 - 0x00000000, 0x53774576, 0x656e7430, 0x00000000, 0x00000000, 0x00000000,
36668 + 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541,
36669 + 0x00000000, 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64,
36670 + 0x496e0000, 0x73746b6f, 0x66662a2a, 0x00000000, 0x53774576,
36671 + 0x656e7430, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
36672 + 0x66617461, 0x6c457272, 0x00000000, 0x00000000, 0x00000000
36675 #if 0 /* All zeros, don't eat up space with it. */
36676 @@ -3785,63 +4178,274 @@
36680 +/* 5705 needs a special version of the TSO firmware. */
36681 +#define TG3_TSO5_FW_RELEASE_MAJOR 0x1
36682 +#define TG3_TSO5_FW_RELASE_MINOR 0x1
36683 +#define TG3_TSO5_FW_RELEASE_FIX 0x0
36684 +#define TG3_TSO5_FW_START_ADDR 0x00010000
36685 +#define TG3_TSO5_FW_TEXT_ADDR 0x00010000
36686 +#define TG3_TSO5_FW_TEXT_LEN 0xeb0
36687 +#define TG3_TSO5_FW_RODATA_ADDR 0x00010eb0
36688 +#define TG3_TSO5_FW_RODATA_LEN 0x50
36689 +#define TG3_TSO5_FW_DATA_ADDR 0x00010f20
36690 +#define TG3_TSO5_FW_DATA_LEN 0x20
36691 +#define TG3_TSO5_FW_SBSS_ADDR 0x00010f40
36692 +#define TG3_TSO5_FW_SBSS_LEN 0x28
36693 +#define TG3_TSO5_FW_BSS_ADDR 0x00010f70
36694 +#define TG3_TSO5_FW_BSS_LEN 0x88
36696 +static u32 tg3Tso5FwText[] = {
36697 + 0x0c004003, 0x00000000, 0x00010f30, 0x00000000, 0x10000003, 0x00000000,
36698 + 0x0000000d, 0x0000000d, 0x3c1d0001, 0x37bde000, 0x03a0f021, 0x3c100001,
36699 + 0x26100000, 0x0c004010, 0x00000000, 0x0000000d, 0x27bdffe0, 0x3c04fefe,
36700 + 0xafbf0018, 0x0c0042f0, 0x34840002, 0x0c00436c, 0x00000000, 0x3c030001,
36701 + 0x90630f54, 0x24020002, 0x3c040001, 0x24840ebc, 0x14620003, 0x24050001,
36702 + 0x3c040001, 0x24840eb0, 0x24060001, 0x00003821, 0xafa00010, 0x0c004380,
36703 + 0xafa00014, 0x0c00402c, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020,
36704 + 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c, 0xafb20018, 0xafb10014,
36705 + 0x0c0042d3, 0xafb00010, 0x3c128000, 0x24110001, 0x8f706810, 0x32020400,
36706 + 0x10400007, 0x00000000, 0x8f641008, 0x00921024, 0x14400003, 0x00000000,
36707 + 0x0c004064, 0x00000000, 0x3c020001, 0x90420f76, 0x10510003, 0x32020200,
36708 + 0x1040fff1, 0x00000000, 0x0c0041b4, 0x00000000, 0x08004034, 0x00000000,
36709 + 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020,
36710 + 0x27bdffe0, 0x3c040001, 0x24840ed0, 0x00002821, 0x00003021, 0x00003821,
36711 + 0xafbf0018, 0xafa00010, 0x0c004380, 0xafa00014, 0x0000d021, 0x24020130,
36712 + 0xaf625000, 0x3c010001, 0xa4200f70, 0x3c010001, 0xa0200f77, 0x8fbf0018,
36713 + 0x03e00008, 0x27bd0020, 0x00000000, 0x00000000, 0x3c030001, 0x24630f80,
36714 + 0x90620000, 0x27bdfff0, 0x14400003, 0x0080c021, 0x08004073, 0x00004821,
36715 + 0x3c022000, 0x03021024, 0x10400003, 0x24090002, 0x08004073, 0xa0600000,
36716 + 0x24090001, 0x00181040, 0x30431f80, 0x346f8008, 0x1520004b, 0x25eb0028,
36717 + 0x3c040001, 0x00832021, 0x8c848010, 0x3c050001, 0x24a50f9a, 0x00041402,
36718 + 0xa0a20000, 0x3c010001, 0xa0240f9b, 0x3c020001, 0x00431021, 0x94428014,
36719 + 0x3c010001, 0xa0220f9c, 0x3c0c0001, 0x01836021, 0x8d8c8018, 0x304200ff,
36720 + 0x24420008, 0x000220c3, 0x24020001, 0x3c010001, 0xa0220f80, 0x0124102b,
36721 + 0x1040000c, 0x00003821, 0x24a6000e, 0x01602821, 0x8ca20000, 0x8ca30004,
36722 + 0x24a50008, 0x24e70001, 0xacc20000, 0xacc30004, 0x00e4102b, 0x1440fff8,
36723 + 0x24c60008, 0x00003821, 0x3c080001, 0x25080f9b, 0x91060000, 0x3c020001,
36724 + 0x90420f9c, 0x2503000d, 0x00c32821, 0x00461023, 0x00021fc2, 0x00431021,
36725 + 0x00021043, 0x1840000c, 0x00002021, 0x91020001, 0x00461023, 0x00021fc2,
36726 + 0x00431021, 0x00021843, 0x94a20000, 0x24e70001, 0x00822021, 0x00e3102a,
36727 + 0x1440fffb, 0x24a50002, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
36728 + 0x00822021, 0x3c02ffff, 0x01821024, 0x3083ffff, 0x00431025, 0x3c010001,
36729 + 0x080040fa, 0xac220fa0, 0x3c050001, 0x24a50f9c, 0x90a20000, 0x3c0c0001,
36730 + 0x01836021, 0x8d8c8018, 0x000220c2, 0x1080000e, 0x00003821, 0x01603021,
36731 + 0x24a5000c, 0x8ca20000, 0x8ca30004, 0x24a50008, 0x24e70001, 0xacc20000,
36732 + 0xacc30004, 0x00e4102b, 0x1440fff8, 0x24c60008, 0x3c050001, 0x24a50f9c,
36733 + 0x90a20000, 0x30430007, 0x24020004, 0x10620011, 0x28620005, 0x10400005,
36734 + 0x24020002, 0x10620008, 0x000710c0, 0x080040fa, 0x00000000, 0x24020006,
36735 + 0x1062000e, 0x000710c0, 0x080040fa, 0x00000000, 0x00a21821, 0x9463000c,
36736 + 0x004b1021, 0x080040fa, 0xa4430000, 0x000710c0, 0x00a21821, 0x8c63000c,
36737 + 0x004b1021, 0x080040fa, 0xac430000, 0x00a21821, 0x8c63000c, 0x004b2021,
36738 + 0x00a21021, 0xac830000, 0x94420010, 0xa4820004, 0x95e70006, 0x3c020001,
36739 + 0x90420f9c, 0x3c030001, 0x90630f9a, 0x00e2c823, 0x3c020001, 0x90420f9b,
36740 + 0x24630028, 0x01e34021, 0x24420028, 0x15200012, 0x01e23021, 0x94c2000c,
36741 + 0x3c010001, 0xa4220f98, 0x94c20004, 0x94c30006, 0x3c010001, 0xa4200f96,
36742 + 0x3c010001, 0xa4200f92, 0x00021400, 0x00431025, 0x3c010001, 0xac220f8c,
36743 + 0x95020004, 0x3c010001, 0x08004124, 0xa4220f90, 0x3c020001, 0x94420f90,
36744 + 0x3c030001, 0x94630f92, 0x00431021, 0xa5020004, 0x3c020001, 0x94420f8c,
36745 + 0xa4c20004, 0x3c020001, 0x8c420f8c, 0xa4c20006, 0x3c040001, 0x94840f92,
36746 + 0x3c020001, 0x94420f90, 0x3c0a0001, 0x954a0f96, 0x00441821, 0x3063ffff,
36747 + 0x0062182a, 0x24020002, 0x1122000b, 0x00832023, 0x3c030001, 0x94630f98,
36748 + 0x30620009, 0x10400006, 0x3062fff6, 0xa4c2000c, 0x3c020001, 0x94420f98,
36749 + 0x30420009, 0x01425023, 0x24020001, 0x1122001b, 0x29220002, 0x50400005,
36750 + 0x24020002, 0x11200007, 0x31a2ffff, 0x08004197, 0x00000000, 0x1122001d,
36751 + 0x24020016, 0x08004197, 0x31a2ffff, 0x3c0e0001, 0x95ce0fa0, 0x10800005,
36752 + 0x01806821, 0x01c42021, 0x00041c02, 0x3082ffff, 0x00627021, 0x000e1027,
36753 + 0xa502000a, 0x3c030001, 0x90630f9b, 0x31a2ffff, 0x00e21021, 0x0800418d,
36754 + 0x00432023, 0x3c020001, 0x94420fa0, 0x00442021, 0x00041c02, 0x3082ffff,
36755 + 0x00622021, 0x00807021, 0x00041027, 0x08004185, 0xa502000a, 0x3c050001,
36756 + 0x24a50f9a, 0x90a30000, 0x14620002, 0x24e2fff2, 0xa5e20034, 0x90a20000,
36757 + 0x00e21023, 0xa5020002, 0x3c030001, 0x94630fa0, 0x3c020001, 0x94420f7a,
36758 + 0x30e5ffff, 0x00641821, 0x00451023, 0x00622023, 0x00041c02, 0x3082ffff,
36759 + 0x00622021, 0x00041027, 0xa502000a, 0x3c030001, 0x90630f9c, 0x24620001,
36760 + 0x14a20005, 0x00807021, 0x01631021, 0x90420000, 0x08004185, 0x00026200,
36761 + 0x24620002, 0x14a20003, 0x306200fe, 0x004b1021, 0x944c0000, 0x3c020001,
36762 + 0x94420fa2, 0x3183ffff, 0x3c040001, 0x90840f9b, 0x00431021, 0x00e21021,
36763 + 0x00442023, 0x008a2021, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
36764 + 0x00822021, 0x00806821, 0x00041027, 0xa4c20010, 0x31a2ffff, 0x000e1c00,
36765 + 0x00431025, 0x3c040001, 0x24840f92, 0xade20010, 0x94820000, 0x3c050001,
36766 + 0x94a50f96, 0x3c030001, 0x8c630f8c, 0x24420001, 0x00b92821, 0xa4820000,
36767 + 0x3322ffff, 0x00622021, 0x0083182b, 0x3c010001, 0xa4250f96, 0x10600003,
36768 + 0x24a2ffff, 0x3c010001, 0xa4220f96, 0x3c024000, 0x03021025, 0x3c010001,
36769 + 0xac240f8c, 0xaf621008, 0x03e00008, 0x27bd0010, 0x3c030001, 0x90630f76,
36770 + 0x27bdffe8, 0x24020001, 0xafbf0014, 0x10620026, 0xafb00010, 0x8f620cf4,
36771 + 0x2442ffff, 0x3042007f, 0x00021100, 0x8c434000, 0x3c010001, 0xac230f84,
36772 + 0x8c434008, 0x24444000, 0x8c5c4004, 0x30620040, 0x14400002, 0x24020088,
36773 + 0x24020008, 0x3c010001, 0xa4220f88, 0x30620004, 0x10400005, 0x24020001,
36774 + 0x3c010001, 0xa0220f77, 0x080041d5, 0x00031402, 0x3c010001, 0xa0200f77,
36775 + 0x00031402, 0x3c010001, 0xa4220f74, 0x9483000c, 0x24020001, 0x3c010001,
36776 + 0xa4200f70, 0x3c010001, 0xa0220f76, 0x3c010001, 0xa4230f82, 0x24020001,
36777 + 0x1342001e, 0x00000000, 0x13400005, 0x24020003, 0x13420067, 0x00000000,
36778 + 0x080042cf, 0x00000000, 0x3c020001, 0x94420f82, 0x241a0001, 0x3c010001,
36779 + 0xa4200f7e, 0x3c010001, 0xa4200f72, 0x304407ff, 0x00021bc2, 0x00031823,
36780 + 0x3063003e, 0x34630036, 0x00021242, 0x3042003c, 0x00621821, 0x3c010001,
36781 + 0xa4240f78, 0x00832021, 0x24630030, 0x3c010001, 0xa4240f7a, 0x3c010001,
36782 + 0xa4230f7c, 0x3c060001, 0x24c60f72, 0x94c50000, 0x94c30002, 0x3c040001,
36783 + 0x94840f7a, 0x00651021, 0x0044102a, 0x10400013, 0x3c108000, 0x00a31021,
36784 + 0xa4c20000, 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f76, 0x8f641008,
36785 + 0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4,
36786 + 0x00501024, 0x104000b7, 0x00000000, 0x0800420f, 0x00000000, 0x3c030001,
36787 + 0x94630f70, 0x00851023, 0xa4c40000, 0x00621821, 0x3042ffff, 0x3c010001,
36788 + 0xa4230f70, 0xaf620ce8, 0x3c020001, 0x94420f88, 0x34420024, 0xaf620cec,
36789 + 0x94c30002, 0x3c020001, 0x94420f70, 0x14620012, 0x3c028000, 0x3c108000,
36790 + 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f76, 0x8f641008, 0x00901024,
36791 + 0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024,
36792 + 0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003, 0xaf620cf4, 0x3c108000,
36793 + 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000,
36794 + 0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003,
36795 + 0x3c070001, 0x24e70f70, 0x94e20000, 0x03821021, 0xaf620ce0, 0x3c020001,
36796 + 0x8c420f84, 0xaf620ce4, 0x3c050001, 0x94a50f74, 0x94e30000, 0x3c040001,
36797 + 0x94840f78, 0x3c020001, 0x94420f7e, 0x00a32823, 0x00822023, 0x30a6ffff,
36798 + 0x3083ffff, 0x00c3102b, 0x14400043, 0x00000000, 0x3c020001, 0x94420f7c,
36799 + 0x00021400, 0x00621025, 0xaf620ce8, 0x94e20000, 0x3c030001, 0x94630f74,
36800 + 0x00441021, 0xa4e20000, 0x3042ffff, 0x14430021, 0x3c020008, 0x3c020001,
36801 + 0x90420f77, 0x10400006, 0x3c03000c, 0x3c020001, 0x94420f88, 0x34630624,
36802 + 0x0800427c, 0x0000d021, 0x3c020001, 0x94420f88, 0x3c030008, 0x34630624,
36803 + 0x00431025, 0xaf620cec, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
36804 + 0xa0200f76, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
36805 + 0x00000000, 0x8f620cf4, 0x00501024, 0x10400015, 0x00000000, 0x08004283,
36806 + 0x00000000, 0x3c030001, 0x94630f88, 0x34420624, 0x3c108000, 0x00621825,
36807 + 0x3c028000, 0xaf630cec, 0xaf620cf4, 0x8f641008, 0x00901024, 0x14400003,
36808 + 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7,
36809 + 0x00000000, 0x3c010001, 0x080042cf, 0xa4200f7e, 0x3c020001, 0x94420f7c,
36810 + 0x00021400, 0x00c21025, 0xaf620ce8, 0x3c020001, 0x90420f77, 0x10400009,
36811 + 0x3c03000c, 0x3c020001, 0x94420f88, 0x34630624, 0x0000d021, 0x00431025,
36812 + 0xaf620cec, 0x080042c1, 0x3c108000, 0x3c020001, 0x94420f88, 0x3c030008,
36813 + 0x34630604, 0x00431025, 0xaf620cec, 0x3c020001, 0x94420f7e, 0x00451021,
36814 + 0x3c010001, 0xa4220f7e, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
36815 + 0xa0200f76, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
36816 + 0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x8fbf0014,
36817 + 0x8fb00010, 0x03e00008, 0x27bd0018, 0x27bdffe0, 0x3c040001, 0x24840ee0,
36818 + 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0c004380,
36819 + 0xafa00014, 0x0000d021, 0x24020130, 0xaf625000, 0x3c010001, 0xa4200f70,
36820 + 0x3c010001, 0xa0200f77, 0x8f636804, 0x3c020001, 0x3442e000, 0x00621824,
36821 + 0x3c020001, 0x14620003, 0x00000000, 0x080042eb, 0x00000000, 0x8fbf0018,
36822 + 0x03e00008, 0x27bd0020, 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010,
36823 + 0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804, 0x8f634000, 0x24020b50,
36824 + 0x3c010001, 0xac220f40, 0x24020b78, 0x3c010001, 0xac220f50, 0x34630002,
36825 + 0xaf634000, 0x0c00431d, 0x00808021, 0x3c010001, 0xa0220f54, 0x304200ff,
36826 + 0x24030002, 0x14430005, 0x00000000, 0x3c020001, 0x8c420f40, 0x08004310,
36827 + 0xac5000c0, 0x3c020001, 0x8c420f40, 0xac5000bc, 0x8f624434, 0x8f634438,
36828 + 0x8f644410, 0x3c010001, 0xac220f48, 0x3c010001, 0xac230f58, 0x3c010001,
36829 + 0xac240f44, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x03e00008,
36830 + 0x24020001, 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c,
36831 + 0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000,
36832 + 0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020001, 0x8c420f48, 0x00031c02,
36833 + 0x0043102b, 0x14400008, 0x3c038000, 0x3c040001, 0x8c840f58, 0x8f624450,
36834 + 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444,
36835 + 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff,
36836 + 0x3082ffff, 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000, 0x0800434f,
36837 + 0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc,
36838 + 0x00001021, 0x03e00008, 0x00000000, 0x8f624450, 0x3c030001, 0x8c630f44,
36839 + 0x08004358, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc,
36840 + 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821, 0x3c040001,
36841 + 0x24840ef0, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0c004380,
36842 + 0xafa00014, 0x08004367, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020,
36843 + 0x3c020001, 0x3442d600, 0x3c030001, 0x3463d600, 0x3c040001, 0x3484ddff,
36844 + 0x3c010001, 0xac220f60, 0x24020040, 0x3c010001, 0xac220f64, 0x3c010001,
36845 + 0xac200f5c, 0xac600000, 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000,
36846 + 0x03e00008, 0x00000000, 0x00804821, 0x8faa0010, 0x3c020001, 0x8c420f5c,
36847 + 0x3c040001, 0x8c840f64, 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010001,
36848 + 0xac230f5c, 0x14400003, 0x00004021, 0x3c010001, 0xac200f5c, 0x3c020001,
36849 + 0x8c420f5c, 0x3c030001, 0x8c630f60, 0x91240000, 0x00021140, 0x00431021,
36850 + 0x00481021, 0x25080001, 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001,
36851 + 0x3c020001, 0x8c420f5c, 0x3c030001, 0x8c630f60, 0x8f64680c, 0x00021140,
36852 + 0x00431021, 0xac440008, 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018,
36853 + 0x03e00008, 0xac4b001c, 0x00000000, 0x00000000,
36856 +u32 tg3Tso5FwRodata[] = {
36857 + 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, 0x00000000,
36858 + 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x00000000, 0x00000000,
36859 + 0x73746b6f, 0x66666c64, 0x00000000, 0x00000000, 0x66617461, 0x6c457272,
36860 + 0x00000000, 0x00000000, 0x00000000
36863 +u32 tg3Tso5FwData[] = {
36864 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x73746b6f,
36865 + 0x66666c64, 0x5f76312e, 0x312e3000, 0x00000000
36868 /* tp->lock is held. */
36869 static int tg3_load_tso_firmware(struct tg3 *tp)
36871 struct fw_info info;
36872 + unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size;
36875 - info.text_base = TG3_TSO_FW_TEXT_ADDR;
36876 - info.text_len = TG3_TSO_FW_TEXT_LEN;
36877 - info.text_data = &tg3TsoFwText[0];
36878 - info.rodata_base = TG3_TSO_FW_RODATA_ADDR;
36879 - info.rodata_len = TG3_TSO_FW_RODATA_LEN;
36880 - info.rodata_data = &tg3TsoFwRodata[0];
36881 - info.data_base = TG3_TSO_FW_DATA_ADDR;
36882 - info.data_len = TG3_TSO_FW_DATA_LEN;
36883 - info.data_data = NULL;
36884 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
36885 + info.text_base = TG3_TSO5_FW_TEXT_ADDR;
36886 + info.text_len = TG3_TSO5_FW_TEXT_LEN;
36887 + info.text_data = &tg3Tso5FwText[0];
36888 + info.rodata_base = TG3_TSO5_FW_RODATA_ADDR;
36889 + info.rodata_len = TG3_TSO5_FW_RODATA_LEN;
36890 + info.rodata_data = &tg3Tso5FwRodata[0];
36891 + info.data_base = TG3_TSO5_FW_DATA_ADDR;
36892 + info.data_len = TG3_TSO5_FW_DATA_LEN;
36893 + info.data_data = &tg3Tso5FwData[0];
36894 + cpu_base = RX_CPU_BASE;
36895 + cpu_scratch_base = NIC_SRAM_MBUF_POOL_BASE5705;
36896 + cpu_scratch_size = (info.text_len +
36897 + info.rodata_len +
36899 + TG3_TSO5_FW_SBSS_LEN +
36900 + TG3_TSO5_FW_BSS_LEN);
36902 + info.text_base = TG3_TSO_FW_TEXT_ADDR;
36903 + info.text_len = TG3_TSO_FW_TEXT_LEN;
36904 + info.text_data = &tg3TsoFwText[0];
36905 + info.rodata_base = TG3_TSO_FW_RODATA_ADDR;
36906 + info.rodata_len = TG3_TSO_FW_RODATA_LEN;
36907 + info.rodata_data = &tg3TsoFwRodata[0];
36908 + info.data_base = TG3_TSO_FW_DATA_ADDR;
36909 + info.data_len = TG3_TSO_FW_DATA_LEN;
36910 + info.data_data = NULL;
36911 + cpu_base = TX_CPU_BASE;
36912 + cpu_scratch_base = TX_CPU_SCRATCH_BASE;
36913 + cpu_scratch_size = TX_CPU_SCRATCH_SIZE;
36916 - err = tg3_load_firmware_cpu(tp, TX_CPU_BASE,
36917 - TX_CPU_SCRATCH_BASE, TX_CPU_SCRATCH_SIZE,
36918 + err = tg3_load_firmware_cpu(tp, cpu_base,
36919 + cpu_scratch_base, cpu_scratch_size,
36924 - /* Now startup only the TX cpu. */
36925 - tw32(TX_CPU_BASE + CPU_STATE, 0xffffffff);
36926 - tw32(TX_CPU_BASE + CPU_PC, TG3_TSO_FW_TEXT_ADDR);
36927 + /* Now startup the cpu. */
36928 + tw32(cpu_base + CPU_STATE, 0xffffffff);
36929 + tw32(cpu_base + CPU_PC, info.text_base);
36931 /* Flush posted writes. */
36932 - tr32(TX_CPU_BASE + CPU_PC);
36933 + tr32(cpu_base + CPU_PC);
36934 for (i = 0; i < 5; i++) {
36935 - if (tr32(TX_CPU_BASE + CPU_PC) == TG3_TSO_FW_TEXT_ADDR)
36936 + if (tr32(cpu_base + CPU_PC) == info.text_base)
36938 - tw32(TX_CPU_BASE + CPU_STATE, 0xffffffff);
36939 - tw32(TX_CPU_BASE + CPU_MODE, CPU_MODE_HALT);
36940 - tw32(TX_CPU_BASE + CPU_PC, TG3_TSO_FW_TEXT_ADDR);
36941 + tw32(cpu_base + CPU_STATE, 0xffffffff);
36942 + tw32(cpu_base + CPU_MODE, CPU_MODE_HALT);
36943 + tw32(cpu_base + CPU_PC, info.text_base);
36945 /* Flush posted writes. */
36946 - tr32(TX_CPU_BASE + CPU_PC);
36947 + tr32(cpu_base + CPU_PC);
36952 printk(KERN_ERR PFX "tg3_load_tso_firmware fails for %s "
36953 - "to set TX CPU PC, is %08x should be %08x\n",
36954 - tp->dev->name, tr32(TX_CPU_BASE + CPU_PC),
36955 - TG3_TSO_FW_TEXT_ADDR);
36956 + "to set CPU PC, is %08x should be %08x\n",
36957 + tp->dev->name, tr32(cpu_base + CPU_PC),
36961 - tw32(TX_CPU_BASE + CPU_STATE, 0xffffffff);
36962 - tw32(TX_CPU_BASE + CPU_MODE, 0x00000000);
36963 + tw32(cpu_base + CPU_STATE, 0xffffffff);
36964 + tw32(cpu_base + CPU_MODE, 0x00000000);
36966 /* Flush posted writes. */
36967 - tr32(TX_CPU_BASE + CPU_MODE);
36968 + tr32(cpu_base + CPU_MODE);
36973 -#endif /* TG3_DO_TSO != 0 */
36974 +#endif /* TG3_TSO_SUPPORT != 0 */
36976 /* tp->lock is held. */
36977 static void __tg3_set_mac_addr(struct tg3 *tp)
36978 @@ -3860,6 +4464,15 @@
36979 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
36982 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
36983 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701 &&
36984 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
36985 + for (i = 0; i < 12; i++) {
36986 + tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high);
36987 + tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low);
36991 addr_high = (tp->dev->dev_addr[0] +
36992 tp->dev->dev_addr[1] +
36993 tp->dev->dev_addr[2] +
36994 @@ -3893,23 +4506,19 @@
36999 - TG3_BDINFO_HOST_ADDR +
37000 - TG3_64BIT_REG_HIGH),
37001 + (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH),
37002 ((u64) mapping >> 32));
37005 - TG3_BDINFO_HOST_ADDR +
37006 - TG3_64BIT_REG_LOW),
37007 + (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW),
37008 ((u64) mapping & 0xffffffff));
37011 - TG3_BDINFO_MAXLEN_FLAGS),
37012 + (bdinfo_addr + TG3_BDINFO_MAXLEN_FLAGS),
37014 - tg3_write_mem(tp,
37016 - TG3_BDINFO_NIC_ADDR),
37019 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
37020 + tg3_write_mem(tp,
37021 + (bdinfo_addr + TG3_BDINFO_NIC_ADDR),
37025 static void __tg3_set_rx_mode(struct net_device *);
37026 @@ -3917,8 +4526,8 @@
37027 /* tp->lock is held. */
37028 static int tg3_reset_hw(struct tg3 *tp)
37032 + u32 val, rdmac_mode;
37033 + int i, err, limit;
37035 tg3_disable_ints(tp);
37037 @@ -3970,9 +4579,8 @@
37038 * B3 tigon3 silicon. This bit has no effect on any
37041 - val = tr32(TG3PCI_CLOCK_CTRL);
37042 - val |= CLOCK_CTRL_DELAY_PCI_GRANT;
37043 - tw32(TG3PCI_CLOCK_CTRL, val);
37044 + tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT;
37045 + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
37046 tr32(TG3PCI_CLOCK_CTRL);
37048 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
37049 @@ -3990,11 +4598,13 @@
37050 tg3_init_rings(tp);
37052 /* Clear statistics/status block in chip, and status block in ram. */
37053 - for (i = NIC_SRAM_STATS_BLK;
37054 - i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
37055 - i += sizeof(u32)) {
37056 - tg3_write_mem(tp, i, 0);
37058 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37059 + for (i = NIC_SRAM_STATS_BLK;
37060 + i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
37061 + i += sizeof(u32)) {
37062 + tg3_write_mem(tp, i, 0);
37066 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
37068 @@ -4025,13 +4635,31 @@
37069 (65 << GRC_MISC_CFG_PRESCALAR_SHIFT));
37071 /* Initialize MBUF/DESC pool. */
37072 - tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE);
37073 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
37074 - tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64);
37076 - tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96);
37077 - tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE);
37078 - tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE);
37079 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37080 + tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE);
37081 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
37082 + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64);
37084 + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96);
37085 + tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE);
37086 + tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE);
37088 +#if TG3_TSO_SUPPORT != 0
37089 + else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
37092 + fw_len = (TG3_TSO5_FW_TEXT_LEN +
37093 + TG3_TSO5_FW_RODATA_LEN +
37094 + TG3_TSO5_FW_DATA_LEN +
37095 + TG3_TSO5_FW_SBSS_LEN +
37096 + TG3_TSO5_FW_BSS_LEN);
37097 + fw_len = (fw_len + (0x80 - 1)) & ~(0x80 - 1);
37098 + tw32(BUFMGR_MB_POOL_ADDR,
37099 + NIC_SRAM_MBUF_POOL_BASE5705 + fw_len);
37100 + tw32(BUFMGR_MB_POOL_SIZE,
37101 + NIC_SRAM_MBUF_POOL_SIZE5705 - fw_len - 0xa00);
37105 if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) {
37106 tw32(BUFMGR_MB_RDMA_LOW_WATER,
37107 @@ -4078,6 +4706,9 @@
37111 + /* Setup replenish threshold. */
37112 + tw32(RCVBDI_STD_THRESH, tp->rx_pending / 8);
37114 /* Initialize TG3_BDINFO's at:
37115 * RCVDBDI_STD_BD: standard eth size rx ring
37116 * RCVDBDI_JUMBO_BD: jumbo frame rx ring
37117 @@ -4099,35 +4730,50 @@
37118 ((u64) tp->rx_std_mapping >> 32));
37119 tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
37120 ((u64) tp->rx_std_mapping & 0xffffffff));
37121 - tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS,
37122 - RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT);
37123 tw32(RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR,
37124 NIC_SRAM_RX_BUFFER_DESC);
37126 - tw32(RCVDBDI_MINI_BD + TG3_BDINFO_MAXLEN_FLAGS,
37127 - BDINFO_FLAGS_DISABLED);
37129 - if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) {
37130 - tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH,
37131 - ((u64) tp->rx_jumbo_mapping >> 32));
37132 - tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
37133 - ((u64) tp->rx_jumbo_mapping & 0xffffffff));
37134 - tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
37135 - RX_JUMBO_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT);
37136 - tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_NIC_ADDR,
37137 - NIC_SRAM_RX_JUMBO_BUFFER_DESC);
37138 + /* Don't even try to program the JUMBO/MINI buffer descriptor
37139 + * configs on 5705.
37141 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
37142 + tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS,
37143 + RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT);
37145 - tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
37146 + tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS,
37147 + RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT);
37149 + tw32(RCVDBDI_MINI_BD + TG3_BDINFO_MAXLEN_FLAGS,
37150 BDINFO_FLAGS_DISABLED);
37153 - /* Setup replenish thresholds. */
37154 - tw32(RCVBDI_STD_THRESH, tp->rx_pending / 8);
37155 - tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8);
37156 + /* Setup replenish threshold. */
37157 + tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8);
37159 - /* Clear out send RCB ring in SRAM. */
37160 - for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE)
37161 - tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED);
37162 + if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) {
37163 + tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH,
37164 + ((u64) tp->rx_jumbo_mapping >> 32));
37165 + tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
37166 + ((u64) tp->rx_jumbo_mapping & 0xffffffff));
37167 + tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
37168 + RX_JUMBO_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT);
37169 + tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_NIC_ADDR,
37170 + NIC_SRAM_RX_JUMBO_BUFFER_DESC);
37172 + tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
37173 + BDINFO_FLAGS_DISABLED);
37178 + /* There is only one send ring on 5705, no need to explicitly
37179 + * disable the others.
37181 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37182 + /* Clear out send RCB ring in SRAM. */
37183 + for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE)
37184 + tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
37185 + BDINFO_FLAGS_DISABLED);
37190 @@ -4149,9 +4795,15 @@
37191 NIC_SRAM_TX_BUFFER_DESC);
37194 - for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK; i += TG3_BDINFO_SIZE) {
37195 - tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
37196 - BDINFO_FLAGS_DISABLED);
37197 + /* There is only one receive return ring on 5705, no need to explicitly
37198 + * disable the others.
37200 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37201 + for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK;
37202 + i += TG3_BDINFO_SIZE) {
37203 + tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
37204 + BDINFO_FLAGS_DISABLED);
37208 tp->rx_rcb_ptr = 0;
37209 @@ -4161,7 +4813,7 @@
37211 tg3_set_bdinfo(tp, NIC_SRAM_RCV_RET_RCB,
37212 tp->rx_rcb_mapping,
37213 - (TG3_RX_RCB_RING_SIZE <<
37214 + (TG3_RX_RCB_RING_SIZE(tp) <<
37215 BDINFO_FLAGS_MAXLEN_SHIFT),
37218 @@ -4198,8 +4850,36 @@
37219 tw32(MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS);
37220 tw32(RCVLPC_CONFIG, 0x0181);
37222 + /* Calculate RDMAC_MODE setting early, we need it to determine
37223 + * the RCVLPC_STATE_ENABLE mask.
37225 + rdmac_mode = (RDMAC_MODE_ENABLE | RDMAC_MODE_TGTABORT_ENAB |
37226 + RDMAC_MODE_MSTABORT_ENAB | RDMAC_MODE_PARITYERR_ENAB |
37227 + RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
37228 + RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
37229 + RDMAC_MODE_LNGREAD_ENAB);
37230 + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
37231 + rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
37232 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
37233 + if (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) {
37234 + if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
37235 + rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128;
37236 + } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
37237 + !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
37238 + rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
37243 /* Receive/send statistics. */
37244 - tw32(RCVLPC_STATS_ENABLE, 0xffffff);
37245 + if ((rdmac_mode & RDMAC_MODE_FIFO_SIZE_128) &&
37246 + (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
37247 + val = tr32(RCVLPC_STATS_ENABLE);
37248 + val &= ~RCVLPC_STATSENAB_LNGBRST_RFIX;
37249 + tw32(RCVLPC_STATS_ENABLE, val);
37251 + tw32(RCVLPC_STATS_ENABLE, 0xffffff);
37253 tw32(RCVLPC_STATSCTRL, RCVLPC_STATSCTRL_ENABLE);
37254 tw32(SNDDATAI_STATSENAB, 0xffffff);
37255 tw32(SNDDATAI_STATSCTRL,
37256 @@ -4215,33 +4895,43 @@
37259 tw32(HOSTCC_RXCOL_TICKS, 0);
37260 - tw32(HOSTCC_RXMAX_FRAMES, 1);
37261 - tw32(HOSTCC_RXCOAL_TICK_INT, 0);
37262 - tw32(HOSTCC_RXCOAL_MAXF_INT, 1);
37263 tw32(HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS);
37264 + tw32(HOSTCC_RXMAX_FRAMES, 1);
37265 tw32(HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES);
37266 - tw32(HOSTCC_TXCOAL_TICK_INT, 0);
37267 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
37268 + tw32(HOSTCC_RXCOAL_TICK_INT, 0);
37269 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
37270 + tw32(HOSTCC_TXCOAL_TICK_INT, 0);
37271 + tw32(HOSTCC_RXCOAL_MAXF_INT, 1);
37272 tw32(HOSTCC_TXCOAL_MAXF_INT, 0);
37273 - tw32(HOSTCC_STAT_COAL_TICKS,
37274 - DEFAULT_STAT_COAL_TICKS);
37276 - /* Status/statistics block address. */
37277 - tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
37278 - ((u64) tp->stats_mapping >> 32));
37279 - tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
37280 - ((u64) tp->stats_mapping & 0xffffffff));
37281 + /* set status block DMA address */
37282 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
37283 ((u64) tp->status_mapping >> 32));
37284 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
37285 ((u64) tp->status_mapping & 0xffffffff));
37286 - tw32(HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK);
37287 - tw32(HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK);
37289 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37290 + /* Status/statistics block address. See tg3_timer,
37291 + * the tg3_periodic_fetch_stats call there, and
37292 + * tg3_get_stats to see how this works for 5705 chips.
37294 + tw32(HOSTCC_STAT_COAL_TICKS,
37295 + DEFAULT_STAT_COAL_TICKS);
37296 + tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
37297 + ((u64) tp->stats_mapping >> 32));
37298 + tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
37299 + ((u64) tp->stats_mapping & 0xffffffff));
37300 + tw32(HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK);
37301 + tw32(HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK);
37304 tw32(HOSTCC_MODE, HOSTCC_MODE_ENABLE | tp->coalesce_mode);
37306 tw32(RCVCC_MODE, RCVCC_MODE_ENABLE | RCVCC_MODE_ATTN_ENABLE);
37307 tw32(RCVLPC_MODE, RCVLPC_MODE_ENABLE);
37308 - tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE);
37309 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
37310 + tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE);
37312 tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE |
37313 MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE;
37314 @@ -4260,42 +4950,47 @@
37315 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0);
37316 tr32(MAILBOX_INTERRUPT_0);
37318 - tw32(DMAC_MODE, DMAC_MODE_ENABLE);
37321 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
37322 + tw32(DMAC_MODE, DMAC_MODE_ENABLE);
37327 - tw32(WDMAC_MODE, (WDMAC_MODE_ENABLE | WDMAC_MODE_TGTABORT_ENAB |
37328 - WDMAC_MODE_MSTABORT_ENAB | WDMAC_MODE_PARITYERR_ENAB |
37329 - WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB |
37330 - WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB |
37331 - WDMAC_MODE_LNGREAD_ENAB));
37332 + val = (WDMAC_MODE_ENABLE | WDMAC_MODE_TGTABORT_ENAB |
37333 + WDMAC_MODE_MSTABORT_ENAB | WDMAC_MODE_PARITYERR_ENAB |
37334 + WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB |
37335 + WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB |
37336 + WDMAC_MODE_LNGREAD_ENAB);
37337 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
37338 + (tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) != 0 &&
37339 + !(tp->tg3_flags2 & TG3_FLG2_IS_5788))
37340 + val |= WDMAC_MODE_RX_ACCEL;
37341 + tw32(WDMAC_MODE, val);
37345 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
37346 - (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) {
37347 + if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) {
37348 val = tr32(TG3PCI_X_CAPS);
37349 - val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
37350 - val |= (PCIX_CAPS_MAX_BURST_5704 << PCIX_CAPS_BURST_SHIFT);
37351 - if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
37352 - val |= (tp->split_mode_max_reqs <<
37353 - PCIX_CAPS_SPLIT_SHIFT);
37354 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) {
37355 + val &= ~PCIX_CAPS_BURST_MASK;
37356 + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
37357 + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
37358 + val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
37359 + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
37360 + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
37361 + val |= (tp->split_mode_max_reqs <<
37362 + PCIX_CAPS_SPLIT_SHIFT);
37364 tw32(TG3PCI_X_CAPS, val);
37367 - val = (RDMAC_MODE_ENABLE | RDMAC_MODE_TGTABORT_ENAB |
37368 - RDMAC_MODE_MSTABORT_ENAB | RDMAC_MODE_PARITYERR_ENAB |
37369 - RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
37370 - RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
37371 - RDMAC_MODE_LNGREAD_ENAB);
37372 - if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
37373 - val |= RDMAC_MODE_SPLIT_ENABLE;
37374 - tw32(RDMAC_MODE, val);
37375 + tw32(RDMAC_MODE, rdmac_mode);
37379 tw32(RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE);
37380 - tw32(MBFREE_MODE, MBFREE_MODE_ENABLE);
37381 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
37382 + tw32(MBFREE_MODE, MBFREE_MODE_ENABLE);
37383 tw32(SNDDATAC_MODE, SNDDATAC_MODE_ENABLE);
37384 tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE);
37385 tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB);
37386 @@ -4310,8 +5005,8 @@
37390 -#if TG3_DO_TSO != 0
37391 - if (tp->dev->features & NETIF_F_TSO) {
37392 +#if TG3_TSO_SUPPORT != 0
37393 + if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
37394 err = tg3_load_tso_firmware(tp);
37397 @@ -4342,9 +5037,11 @@
37399 tw32(MAC_LED_CTRL, 0);
37400 tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
37401 - tw32(MAC_RX_MODE, RX_MODE_RESET);
37402 - tr32(MAC_RX_MODE);
37404 + if (tp->phy_id == PHY_ID_SERDES) {
37405 + tw32(MAC_RX_MODE, RX_MODE_RESET);
37406 + tr32(MAC_RX_MODE);
37409 tw32(MAC_RX_MODE, tp->rx_mode);
37412 @@ -4378,22 +5075,48 @@
37413 tw32(MAC_RCV_VALUE_0, 0xffffffff & RCV_RULE_DISABLE_MASK);
37414 tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK);
37415 tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK);
37417 - tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0);
37418 - tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0);
37420 - tw32(MAC_RCV_RULE_4, 0); tw32(MAC_RCV_VALUE_4, 0);
37421 - tw32(MAC_RCV_RULE_5, 0); tw32(MAC_RCV_VALUE_5, 0);
37422 - tw32(MAC_RCV_RULE_6, 0); tw32(MAC_RCV_VALUE_6, 0);
37423 - tw32(MAC_RCV_RULE_7, 0); tw32(MAC_RCV_VALUE_7, 0);
37424 - tw32(MAC_RCV_RULE_8, 0); tw32(MAC_RCV_VALUE_8, 0);
37425 - tw32(MAC_RCV_RULE_9, 0); tw32(MAC_RCV_VALUE_9, 0);
37426 - tw32(MAC_RCV_RULE_10, 0); tw32(MAC_RCV_VALUE_10, 0);
37427 - tw32(MAC_RCV_RULE_11, 0); tw32(MAC_RCV_VALUE_11, 0);
37428 - tw32(MAC_RCV_RULE_12, 0); tw32(MAC_RCV_VALUE_12, 0);
37429 - tw32(MAC_RCV_RULE_13, 0); tw32(MAC_RCV_VALUE_13, 0);
37430 - tw32(MAC_RCV_RULE_14, 0); tw32(MAC_RCV_VALUE_14, 0);
37431 - tw32(MAC_RCV_RULE_15, 0); tw32(MAC_RCV_VALUE_15, 0);
37433 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
37437 + if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF)
37441 + tw32(MAC_RCV_RULE_15, 0); tw32(MAC_RCV_VALUE_15, 0);
37443 + tw32(MAC_RCV_RULE_14, 0); tw32(MAC_RCV_VALUE_14, 0);
37445 + tw32(MAC_RCV_RULE_13, 0); tw32(MAC_RCV_VALUE_13, 0);
37447 + tw32(MAC_RCV_RULE_12, 0); tw32(MAC_RCV_VALUE_12, 0);
37449 + tw32(MAC_RCV_RULE_11, 0); tw32(MAC_RCV_VALUE_11, 0);
37451 + tw32(MAC_RCV_RULE_10, 0); tw32(MAC_RCV_VALUE_10, 0);
37453 + tw32(MAC_RCV_RULE_9, 0); tw32(MAC_RCV_VALUE_9, 0);
37455 + tw32(MAC_RCV_RULE_8, 0); tw32(MAC_RCV_VALUE_8, 0);
37457 + tw32(MAC_RCV_RULE_7, 0); tw32(MAC_RCV_VALUE_7, 0);
37459 + tw32(MAC_RCV_RULE_6, 0); tw32(MAC_RCV_VALUE_6, 0);
37461 + tw32(MAC_RCV_RULE_5, 0); tw32(MAC_RCV_VALUE_5, 0);
37463 + tw32(MAC_RCV_RULE_4, 0); tw32(MAC_RCV_VALUE_4, 0);
37465 + /* tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0); */
37467 + /* tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0); */
37475 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)
37476 tg3_enable_ints(tp);
37477 @@ -4423,6 +5146,50 @@
37481 +#define TG3_STAT_ADD32(PSTAT, REG) \
37482 +do { u32 __val = tr32(REG); \
37483 + (PSTAT)->low += __val; \
37484 + if ((PSTAT)->low < __val) \
37485 + (PSTAT)->high += 1; \
37488 +static void tg3_periodic_fetch_stats(struct tg3 *tp)
37490 + struct tg3_hw_stats *sp = tp->hw_stats;
37492 + if (!netif_carrier_ok(tp->dev))
37495 + TG3_STAT_ADD32(&sp->tx_octets, MAC_TX_STATS_OCTETS);
37496 + TG3_STAT_ADD32(&sp->tx_collisions, MAC_TX_STATS_COLLISIONS);
37497 + TG3_STAT_ADD32(&sp->tx_xon_sent, MAC_TX_STATS_XON_SENT);
37498 + TG3_STAT_ADD32(&sp->tx_xoff_sent, MAC_TX_STATS_XOFF_SENT);
37499 + TG3_STAT_ADD32(&sp->tx_mac_errors, MAC_TX_STATS_MAC_ERRORS);
37500 + TG3_STAT_ADD32(&sp->tx_single_collisions, MAC_TX_STATS_SINGLE_COLLISIONS);
37501 + TG3_STAT_ADD32(&sp->tx_mult_collisions, MAC_TX_STATS_MULT_COLLISIONS);
37502 + TG3_STAT_ADD32(&sp->tx_deferred, MAC_TX_STATS_DEFERRED);
37503 + TG3_STAT_ADD32(&sp->tx_excessive_collisions, MAC_TX_STATS_EXCESSIVE_COL);
37504 + TG3_STAT_ADD32(&sp->tx_late_collisions, MAC_TX_STATS_LATE_COL);
37505 + TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST);
37506 + TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST);
37507 + TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST);
37509 + TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS);
37510 + TG3_STAT_ADD32(&sp->rx_fragments, MAC_RX_STATS_FRAGMENTS);
37511 + TG3_STAT_ADD32(&sp->rx_ucast_packets, MAC_RX_STATS_UCAST);
37512 + TG3_STAT_ADD32(&sp->rx_mcast_packets, MAC_RX_STATS_MCAST);
37513 + TG3_STAT_ADD32(&sp->rx_bcast_packets, MAC_RX_STATS_BCAST);
37514 + TG3_STAT_ADD32(&sp->rx_fcs_errors, MAC_RX_STATS_FCS_ERRORS);
37515 + TG3_STAT_ADD32(&sp->rx_align_errors, MAC_RX_STATS_ALIGN_ERRORS);
37516 + TG3_STAT_ADD32(&sp->rx_xon_pause_rcvd, MAC_RX_STATS_XON_PAUSE_RECVD);
37517 + TG3_STAT_ADD32(&sp->rx_xoff_pause_rcvd, MAC_RX_STATS_XOFF_PAUSE_RECVD);
37518 + TG3_STAT_ADD32(&sp->rx_mac_ctrl_rcvd, MAC_RX_STATS_MAC_CTRL_RECVD);
37519 + TG3_STAT_ADD32(&sp->rx_xoff_entered, MAC_RX_STATS_XOFF_ENTERED);
37520 + TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG);
37521 + TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS);
37522 + TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE);
37525 static void tg3_timer(unsigned long __opaque)
37527 struct tg3 *tp = (struct tg3 *) __opaque;
37528 @@ -4451,6 +5218,9 @@
37532 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
37533 + tg3_periodic_fetch_stats(tp);
37535 /* This part only runs once per second. */
37536 if (!--tp->timer_counter) {
37537 if (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) {
37538 @@ -4908,7 +5678,9 @@
37539 get_stat64(&hw_stats->rx_bcast_packets);
37541 stats->tx_packets = old_stats->tx_packets +
37542 - get_stat64(&hw_stats->COS_out_packets[0]);
37543 + get_stat64(&hw_stats->tx_ucast_packets) +
37544 + get_stat64(&hw_stats->tx_mcast_packets) +
37545 + get_stat64(&hw_stats->tx_bcast_packets);
37547 stats->rx_bytes = old_stats->rx_bytes +
37548 get_stat64(&hw_stats->rx_octets);
37549 @@ -5232,6 +6004,20 @@
37550 tp->msg_enable = value;
37553 +#if TG3_TSO_SUPPORT != 0
37554 +static int tg3_set_tso(struct net_device *dev, u32 value)
37556 + struct tg3 *tp = dev->priv;
37558 + if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
37563 + return ethtool_op_set_tso(dev, value);
37567 static int tg3_nway_reset(struct net_device *dev)
37569 struct tg3 *tp = dev->priv;
37570 @@ -5279,11 +6065,14 @@
37571 spin_lock(&tp->tx_lock);
37573 tp->rx_pending = ering->rx_pending;
37575 + if ((tp->tg3_flags2 & TG3_FLG2_MAX_RXPEND_64) &&
37576 + tp->rx_pending > 64)
37577 + tp->rx_pending = 64;
37578 tp->rx_jumbo_pending = ering->rx_jumbo_pending;
37579 tp->tx_pending = ering->tx_pending;
37582 - tg3_init_rings(tp);
37584 netif_wake_queue(tp->dev);
37585 spin_unlock(&tp->tx_lock);
37586 @@ -5322,7 +6111,6 @@
37588 tp->tg3_flags &= ~TG3_FLAG_PAUSE_TX;
37590 - tg3_init_rings(tp);
37592 spin_unlock(&tp->tx_lock);
37593 spin_unlock_irq(&tp->lock);
37594 @@ -5467,6 +6255,10 @@
37595 .set_tx_csum = tg3_set_tx_csum,
37596 .get_sg = ethtool_op_get_sg,
37597 .set_sg = ethtool_op_set_sg,
37598 +#if TG3_TSO_SUPPORT != 0
37599 + .get_tso = ethtool_op_get_tso,
37600 + .set_tso = tg3_set_tso,
37604 /* Chips other than 5700/5701 use the NVRAM for fetching info. */
37605 @@ -5669,6 +6461,7 @@
37608 tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg);
37609 + tp->nic_sram_data_cfg = nic_cfg;
37611 eeprom_signature_found = 1;
37613 @@ -5702,8 +6495,10 @@
37614 eeprom_led_mode = led_mode_auto;
37617 - if ((tp->pci_chip_rev_id == CHIPREV_ID_5703_A1 ||
37618 - tp->pci_chip_rev_id == CHIPREV_ID_5703_A2) &&
37620 + if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
37621 + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
37622 + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) &&
37623 (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP))
37624 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
37626 @@ -5785,9 +6580,7 @@
37629 /* Enable Ethernet@WireSpeed */
37630 - tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007);
37631 - tg3_readphy(tp, MII_TG3_AUX_CTRL, &val);
37632 - tg3_writephy(tp, MII_TG3_AUX_CTRL, (val | (1 << 15) | (1 << 4)));
37633 + tg3_phy_set_wirespeed(tp);
37635 if (!err && ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401)) {
37636 err = tg3_init_5401phy_dsp(tp);
37637 @@ -5927,7 +6720,7 @@
37638 tp->tg3_flags2 |= TG3_FLG2_SUN_5704;
37641 - /* If we have an AMD 762 or Intel ICH/ICH0 chipset, write
37642 + /* If we have an AMD 762 or Intel ICH/ICH0/ICH2 chipset, write
37643 * reordering to the mailbox registers done by the host
37644 * controller can cause major troubles. We read back from
37645 * every mailbox register write to force the writes to be
37646 @@ -5937,6 +6730,10 @@
37647 PCI_DEVICE_ID_INTEL_82801AA_8, NULL) ||
37648 pci_find_device(PCI_VENDOR_ID_INTEL,
37649 PCI_DEVICE_ID_INTEL_82801AB_8, NULL) ||
37650 + pci_find_device(PCI_VENDOR_ID_INTEL,
37651 + PCI_DEVICE_ID_INTEL_82801BA_11, NULL) ||
37652 + pci_find_device(PCI_VENDOR_ID_INTEL,
37653 + PCI_DEVICE_ID_INTEL_82801BA_6, NULL) ||
37654 pci_find_device(PCI_VENDOR_ID_AMD,
37655 PCI_DEVICE_ID_AMD_FE_GATE_700C, NULL))
37656 tp->tg3_flags |= TG3_FLAG_MBOX_WRITE_REORDER;
37657 @@ -6085,7 +6882,15 @@
37658 tp->tg3_flags |= TG3_FLAG_WOL_SPEED_100MB;
37661 + /* A few boards don't want Ethernet@WireSpeed phy feature */
37662 + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
37663 + ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
37664 + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
37665 + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)))
37666 + tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED;
37668 /* Only 5701 and later support tagged irq status mode.
37669 + * Also, 5788 chips cannot use tagged irq status.
37671 * However, since we are using NAPI avoid tagged irq status
37672 * because the interrupt condition is more difficult to
37673 @@ -6142,7 +6947,8 @@
37674 /* Determine if TX descriptors will reside in
37675 * main memory or in the chip SRAM.
37677 - if (tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG)
37678 + if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0 ||
37679 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
37680 tp->tg3_flags |= TG3_FLAG_HOST_TXDS;
37682 grc_misc_cfg = tr32(GRC_MISC_CFG);
37683 @@ -6154,8 +6960,18 @@
37684 tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
37687 - /* this one is limited to 10/100 only */
37688 - if (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5702FE)
37689 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
37690 + (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
37691 + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
37692 + tp->tg3_flags2 |= TG3_FLG2_IS_5788;
37694 + /* these are limited to 10/100 only */
37695 + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
37696 + (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) ||
37697 + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
37698 + tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
37699 + (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901 ||
37700 + tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901_2)))
37701 tp->tg3_flags |= TG3_FLAG_10_100_ONLY;
37703 err = tg3_phy_probe(tp);
37704 @@ -6414,8 +7230,6 @@
37708 - tw32(TG3PCI_CLOCK_CTRL, 0);
37710 if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) == 0) {
37712 (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
37713 @@ -6423,7 +7237,9 @@
37714 (0x7 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
37715 (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) |
37716 (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT);
37717 - /* XXX 5705 note: set MIN_DMA to zero here */
37718 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
37719 + tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA
37720 + << DMA_RWCTRL_MIN_DMA_SHIFT);
37722 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
37724 @@ -6524,8 +7340,15 @@
37725 tp->dma_rwctrl |= DMA_RWCTRL_USE_MEM_READ_MULT;
37728 + tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE;
37730 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
37733 + /* Unneeded, already done by tg3_get_invariants. */
37734 + tg3_switch_clocks(tp);
37738 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
37739 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701)
37740 @@ -6630,12 +7453,35 @@
37741 case PHY_ID_BCM5701: return "5701";
37742 case PHY_ID_BCM5703: return "5703";
37743 case PHY_ID_BCM5704: return "5704";
37744 + case PHY_ID_BCM5705: return "5705";
37745 case PHY_ID_BCM8002: return "8002";
37746 case PHY_ID_SERDES: return "serdes";
37747 default: return "unknown";
37751 +static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp)
37753 + struct pci_dev *peer = NULL;
37754 + unsigned int func;
37756 + for (func = 0; func < 7; func++) {
37757 + unsigned int devfn = tp->pdev->devfn;
37762 + if (devfn == tp->pdev->devfn)
37764 + peer = pci_find_slot(tp->pdev->bus->number, devfn);
37768 + if (!peer || peer == tp->pdev)
37773 static int __devinit tg3_init_one(struct pci_dev *pdev,
37774 const struct pci_device_id *ent)
37776 @@ -6688,7 +7534,7 @@
37777 goto err_out_free_res;
37780 - err = pci_set_dma_mask(pdev, (u64) 0xffffffff);
37781 + err = pci_set_dma_mask(pdev, 0xffffffffULL);
37783 printk(KERN_ERR PFX "No usable DMA configuration, "
37785 @@ -6794,6 +7640,44 @@
37786 goto err_out_iounmap;
37789 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
37790 + tp->bufmgr_config.mbuf_read_dma_low_water =
37791 + DEFAULT_MB_RDMA_LOW_WATER_5705;
37792 + tp->bufmgr_config.mbuf_mac_rx_low_water =
37793 + DEFAULT_MB_MACRX_LOW_WATER_5705;
37794 + tp->bufmgr_config.mbuf_high_water =
37795 + DEFAULT_MB_HIGH_WATER_5705;
37798 +#if TG3_TSO_SUPPORT != 0
37799 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
37800 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
37801 + tp->pci_chip_rev_id == CHIPREV_ID_5705_A0 ||
37802 + (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 ||
37803 + (tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
37804 + tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
37806 + tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
37809 + /* TSO is off by default, user can enable using ethtool. */
37811 + if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)
37812 + dev->features |= NETIF_F_TSO;
37817 + if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 &&
37818 + !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) &&
37819 + !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) {
37820 + tp->tg3_flags2 |= TG3_FLG2_MAX_RXPEND_64;
37821 + tp->rx_pending = 64;
37824 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
37825 + tp->pdev_peer = tg3_find_5704_peer(tp);
37827 err = tg3_get_device_address(tp);
37829 printk(KERN_ERR PFX "Could not obtain valid ethernet address, "
37830 @@ -6816,16 +7700,8 @@
37832 tp->tg3_flags &= ~TG3_FLAG_RX_CHECKSUMS;
37834 -#if TG3_DO_TSO != 0
37835 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
37836 - (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
37837 - tp->pci_chip_rev_id <= CHIPREV_ID_5701_B2)) {
37838 - /* Not TSO capable. */
37839 - dev->features &= ~NETIF_F_TSO;
37841 - dev->features |= NETIF_F_TSO;
37844 + if (tp->tg3_flags2 & TG3_FLG2_IS_5788)
37845 + dev->features &= ~NETIF_F_HIGHDMA;
37847 err = register_netdev(dev);
37849 diff -Nru a/drivers/net/tg3.h b/drivers/net/tg3.h
37850 --- a/drivers/net/tg3.h Sat Aug 2 18:24:21 2003
37851 +++ b/drivers/net/tg3.h Sat Aug 23 21:07:46 2003
37853 #define RX_COPY_THRESHOLD 256
37855 #define RX_STD_MAX_SIZE 1536
37856 +#define RX_STD_MAX_SIZE_5705 512
37857 #define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */
37859 /* First 256 bytes are a mirror of PCI config space. */
37861 #define PCIX_CAPS_SPLIT_SHIFT 20
37862 #define PCIX_CAPS_BURST_MASK 0x000c0000
37863 #define PCIX_CAPS_BURST_SHIFT 18
37864 -#define PCIX_CAPS_MAX_BURST_5704 2
37865 +#define PCIX_CAPS_MAX_BURST_CPIOB 2
37866 #define TG3PCI_PM_CAP_PTR 0x00000041
37867 #define TG3PCI_X_COMMAND 0x00000042
37868 #define TG3PCI_X_STATUS 0x00000044
37869 @@ -115,11 +116,14 @@
37870 #define CHIPREV_ID_5704_A0 0x2000
37871 #define CHIPREV_ID_5704_A1 0x2001
37872 #define CHIPREV_ID_5704_A2 0x2002
37873 +#define CHIPREV_ID_5705_A0 0x3000
37874 +#define CHIPREV_ID_5705_A1 0x3001
37875 #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
37876 #define ASIC_REV_5700 0x07
37877 #define ASIC_REV_5701 0x00
37878 #define ASIC_REV_5703 0x01
37879 #define ASIC_REV_5704 0x02
37880 +#define ASIC_REV_5705 0x03
37881 #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8)
37882 #define CHIPREV_5700_AX 0x70
37883 #define CHIPREV_5700_BX 0x71
37884 @@ -180,6 +184,9 @@
37885 #define CLOCK_CTRL_ALTCLK 0x00001000
37886 #define CLOCK_CTRL_PWRDOWN_PLL133 0x00008000
37887 #define CLOCK_CTRL_44MHZ_CORE 0x00040000
37888 +#define CLOCK_CTRL_625_CORE 0x00100000
37889 +#define CLOCK_CTRL_FORCE_CLKRUN 0x00200000
37890 +#define CLOCK_CTRL_CLKRUN_OENABLE 0x00400000
37891 #define CLOCK_CTRL_DELAY_PCI_GRANT 0x80000000
37892 #define TG3PCI_REG_BASE_ADDR 0x00000078
37893 #define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c
37894 @@ -457,17 +464,89 @@
37895 #define MAC_RCV_RULE_CFG 0x00000500
37896 #define RCV_RULE_CFG_DEFAULT_CLASS 0x00000008
37897 #define MAC_LOW_WMARK_MAX_RX_FRAME 0x00000504
37898 -/* 0x504 --> 0x590 unused */
37899 +/* 0x508 --> 0x520 unused */
37900 +#define MAC_HASHREGU_0 0x00000520
37901 +#define MAC_HASHREGU_1 0x00000524
37902 +#define MAC_HASHREGU_2 0x00000528
37903 +#define MAC_HASHREGU_3 0x0000052c
37904 +#define MAC_EXTADDR_0_HIGH 0x00000530
37905 +#define MAC_EXTADDR_0_LOW 0x00000534
37906 +#define MAC_EXTADDR_1_HIGH 0x00000538
37907 +#define MAC_EXTADDR_1_LOW 0x0000053c
37908 +#define MAC_EXTADDR_2_HIGH 0x00000540
37909 +#define MAC_EXTADDR_2_LOW 0x00000544
37910 +#define MAC_EXTADDR_3_HIGH 0x00000548
37911 +#define MAC_EXTADDR_3_LOW 0x0000054c
37912 +#define MAC_EXTADDR_4_HIGH 0x00000550
37913 +#define MAC_EXTADDR_4_LOW 0x00000554
37914 +#define MAC_EXTADDR_5_HIGH 0x00000558
37915 +#define MAC_EXTADDR_5_LOW 0x0000055c
37916 +#define MAC_EXTADDR_6_HIGH 0x00000560
37917 +#define MAC_EXTADDR_6_LOW 0x00000564
37918 +#define MAC_EXTADDR_7_HIGH 0x00000568
37919 +#define MAC_EXTADDR_7_LOW 0x0000056c
37920 +#define MAC_EXTADDR_8_HIGH 0x00000570
37921 +#define MAC_EXTADDR_8_LOW 0x00000574
37922 +#define MAC_EXTADDR_9_HIGH 0x00000578
37923 +#define MAC_EXTADDR_9_LOW 0x0000057c
37924 +#define MAC_EXTADDR_10_HIGH 0x00000580
37925 +#define MAC_EXTADDR_10_LOW 0x00000584
37926 +#define MAC_EXTADDR_11_HIGH 0x00000588
37927 +#define MAC_EXTADDR_11_LOW 0x0000058c
37928 #define MAC_SERDES_CFG 0x00000590
37929 #define MAC_SERDES_STAT 0x00000594
37930 /* 0x598 --> 0x600 unused */
37931 #define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */
37932 #define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */
37933 /* 0x624 --> 0x800 unused */
37934 -#define MAC_RX_STATS_BASE 0x00000800 /* 26 32-bit words */
37935 -/* 0x868 --> 0x880 unused */
37936 -#define MAC_TX_STATS_BASE 0x00000880 /* 28 32-bit words */
37937 -/* 0x8f0 --> 0xc00 unused */
37938 +#define MAC_TX_STATS_OCTETS 0x00000800
37939 +#define MAC_TX_STATS_RESV1 0x00000804
37940 +#define MAC_TX_STATS_COLLISIONS 0x00000808
37941 +#define MAC_TX_STATS_XON_SENT 0x0000080c
37942 +#define MAC_TX_STATS_XOFF_SENT 0x00000810
37943 +#define MAC_TX_STATS_RESV2 0x00000814
37944 +#define MAC_TX_STATS_MAC_ERRORS 0x00000818
37945 +#define MAC_TX_STATS_SINGLE_COLLISIONS 0x0000081c
37946 +#define MAC_TX_STATS_MULT_COLLISIONS 0x00000820
37947 +#define MAC_TX_STATS_DEFERRED 0x00000824
37948 +#define MAC_TX_STATS_RESV3 0x00000828
37949 +#define MAC_TX_STATS_EXCESSIVE_COL 0x0000082c
37950 +#define MAC_TX_STATS_LATE_COL 0x00000830
37951 +#define MAC_TX_STATS_RESV4_1 0x00000834
37952 +#define MAC_TX_STATS_RESV4_2 0x00000838
37953 +#define MAC_TX_STATS_RESV4_3 0x0000083c
37954 +#define MAC_TX_STATS_RESV4_4 0x00000840
37955 +#define MAC_TX_STATS_RESV4_5 0x00000844
37956 +#define MAC_TX_STATS_RESV4_6 0x00000848
37957 +#define MAC_TX_STATS_RESV4_7 0x0000084c
37958 +#define MAC_TX_STATS_RESV4_8 0x00000850
37959 +#define MAC_TX_STATS_RESV4_9 0x00000854
37960 +#define MAC_TX_STATS_RESV4_10 0x00000858
37961 +#define MAC_TX_STATS_RESV4_11 0x0000085c
37962 +#define MAC_TX_STATS_RESV4_12 0x00000860
37963 +#define MAC_TX_STATS_RESV4_13 0x00000864
37964 +#define MAC_TX_STATS_RESV4_14 0x00000868
37965 +#define MAC_TX_STATS_UCAST 0x0000086c
37966 +#define MAC_TX_STATS_MCAST 0x00000870
37967 +#define MAC_TX_STATS_BCAST 0x00000874
37968 +#define MAC_TX_STATS_RESV5_1 0x00000878
37969 +#define MAC_TX_STATS_RESV5_2 0x0000087c
37970 +#define MAC_RX_STATS_OCTETS 0x00000880
37971 +#define MAC_RX_STATS_RESV1 0x00000884
37972 +#define MAC_RX_STATS_FRAGMENTS 0x00000888
37973 +#define MAC_RX_STATS_UCAST 0x0000088c
37974 +#define MAC_RX_STATS_MCAST 0x00000890
37975 +#define MAC_RX_STATS_BCAST 0x00000894
37976 +#define MAC_RX_STATS_FCS_ERRORS 0x00000898
37977 +#define MAC_RX_STATS_ALIGN_ERRORS 0x0000089c
37978 +#define MAC_RX_STATS_XON_PAUSE_RECVD 0x000008a0
37979 +#define MAC_RX_STATS_XOFF_PAUSE_RECVD 0x000008a4
37980 +#define MAC_RX_STATS_MAC_CTRL_RECVD 0x000008a8
37981 +#define MAC_RX_STATS_XOFF_ENTERED 0x000008ac
37982 +#define MAC_RX_STATS_FRAME_TOO_LONG 0x000008b0
37983 +#define MAC_RX_STATS_JABBERS 0x000008b4
37984 +#define MAC_RX_STATS_UNDERSIZE 0x000008b8
37985 +/* 0x8bc --> 0xc00 unused */
37987 /* Send data initiator control registers */
37988 #define SNDDATAI_MODE 0x00000c00
37989 @@ -599,6 +678,7 @@
37990 #define RCVLPC_STATSCTRL_ENABLE 0x00000001
37991 #define RCVLPC_STATSCTRL_FASTUPD 0x00000002
37992 #define RCVLPC_STATS_ENABLE 0x00002018
37993 +#define RCVLPC_STATSENAB_LNGBRST_RFIX 0x00400000
37994 #define RCVLPC_STATS_INCMASK 0x0000201c
37995 /* 0x2020 --> 0x2100 unused */
37996 #define RCVLPC_SELLST_BASE 0x00002100 /* 16 16-byte entries */
37997 @@ -812,13 +892,16 @@
37998 #define BUFMGR_MB_POOL_ADDR 0x00004408
37999 #define BUFMGR_MB_POOL_SIZE 0x0000440c
38000 #define BUFMGR_MB_RDMA_LOW_WATER 0x00004410
38001 -#define DEFAULT_MB_RDMA_LOW_WATER 0x00000040
38002 +#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050
38003 +#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000
38004 #define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130
38005 #define BUFMGR_MB_MACRX_LOW_WATER 0x00004414
38006 #define DEFAULT_MB_MACRX_LOW_WATER 0x00000020
38007 +#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010
38008 #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098
38009 #define BUFMGR_MB_HIGH_WATER 0x00004418
38010 #define DEFAULT_MB_HIGH_WATER 0x00000060
38011 +#define DEFAULT_MB_HIGH_WATER_5705 0x00000060
38012 #define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c
38013 #define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c
38014 #define BUFMGR_MB_ALLOC_BIT 0x10000000
38015 @@ -854,6 +937,8 @@
38016 #define RDMAC_MODE_LNGREAD_ENAB 0x00000200
38017 #define RDMAC_MODE_SPLIT_ENABLE 0x00000800
38018 #define RDMAC_MODE_SPLIT_RESET 0x00001000
38019 +#define RDMAC_MODE_FIFO_SIZE_128 0x00020000
38020 +#define RDMAC_MODE_FIFO_LONG_BURST 0x00030000
38021 #define RDMAC_STATUS 0x00004804
38022 #define RDMAC_STATUS_TGTABORT 0x00000004
38023 #define RDMAC_STATUS_MSTABORT 0x00000008
38024 @@ -877,6 +962,7 @@
38025 #define WDMAC_MODE_FIFOURUN_ENAB 0x00000080
38026 #define WDMAC_MODE_FIFOOREAD_ENAB 0x00000100
38027 #define WDMAC_MODE_LNGREAD_ENAB 0x00000200
38028 +#define WDMAC_MODE_RX_ACCEL 0x00000400
38029 #define WDMAC_STATUS 0x00004c04
38030 #define WDMAC_STATUS_TGTABORT 0x00000004
38031 #define WDMAC_STATUS_MSTABORT 0x00000008
38032 @@ -1140,7 +1226,10 @@
38033 #define GRC_MISC_CFG_BOARD_ID_5704 0x00000000
38034 #define GRC_MISC_CFG_BOARD_ID_5704CIOBE 0x00004000
38035 #define GRC_MISC_CFG_BOARD_ID_5704_A2 0x00008000
38036 +#define GRC_MISC_CFG_BOARD_ID_5788 0x00010000
38037 +#define GRC_MISC_CFG_BOARD_ID_5788M 0x00018000
38038 #define GRC_MISC_CFG_BOARD_ID_AC91002A1 0x00018000
38039 +#define GRC_MISC_CFG_KEEP_GPHY_POWER 0x04000000
38040 #define GRC_LOCAL_CTRL 0x00006808
38041 #define GRC_LCLCTRL_INT_ACTIVE 0x00000001
38042 #define GRC_LCLCTRL_CLEARINT 0x00000002
38043 @@ -1275,6 +1364,7 @@
38044 #define NIC_SRAM_DATA_CFG_WOL_ENABLE 0x00000040
38045 #define NIC_SRAM_DATA_CFG_ASF_ENABLE 0x00000080
38046 #define NIC_SRAM_DATA_CFG_EEPROM_WP 0x00000100
38047 +#define NIC_SRAM_DATA_CFG_MINI_PCI 0x00001000
38048 #define NIC_SRAM_DATA_CFG_FIBER_WOL 0x00004000
38050 #define NIC_SRAM_DATA_PHY_ID 0x00000b74
38051 @@ -1312,6 +1402,8 @@
38052 #define NIC_SRAM_MBUF_POOL_BASE 0x00008000
38053 #define NIC_SRAM_MBUF_POOL_SIZE96 0x00018000
38054 #define NIC_SRAM_MBUF_POOL_SIZE64 0x00010000
38055 +#define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000
38056 +#define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000
38058 /* Currently this is fixed. */
38059 #define PHY_ADDR 0x01
38060 @@ -1824,6 +1916,10 @@
38062 #define TG3_FLG2_RESTART_TIMER 0x00000001
38063 #define TG3_FLG2_SUN_5704 0x00000002
38064 +#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004
38065 +#define TG3_FLG2_IS_5788 0x00000008
38066 +#define TG3_FLG2_MAX_RXPEND_64 0x00000010
38067 +#define TG3_FLG2_TSO_CAPABLE 0x00000020
38069 u32 split_mode_max_reqs;
38070 #define SPLIT_MODE_5704_MAX_REQ 3
38071 @@ -1868,6 +1964,7 @@
38072 #define PHY_ID_BCM5701 0x60008110
38073 #define PHY_ID_BCM5703 0x60008160
38074 #define PHY_ID_BCM5704 0x60008190
38075 +#define PHY_ID_BCM5705 0x600081a0
38076 #define PHY_ID_BCM8002 0x60010140
38077 #define PHY_ID_SERDES 0xfeedbee0
38078 #define PHY_ID_INVALID 0xffffffff
38079 @@ -1880,6 +1977,9 @@
38080 enum phy_led_mode led_mode;
38082 char board_part_number[24];
38083 + u32 nic_sram_data_cfg;
38084 + u32 pci_clock_ctrl;
38085 + struct pci_dev *pdev_peer;
38087 /* This macro assumes the passed PHY ID is already masked
38088 * with PHY_ID_MASK.
38089 @@ -1888,6 +1988,7 @@
38090 ((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \
38091 (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
38092 (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
38093 + (X) == PHY_ID_BCM5705 || \
38094 (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES)
38096 struct tg3_hw_stats *hw_stats;
38097 diff -Nru a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
38098 --- a/drivers/net/tokenring/lanstreamer.c Tue Aug 19 20:54:17 2003
38099 +++ b/drivers/net/tokenring/lanstreamer.c Mon Sep 1 08:30:59 2003
38100 @@ -228,7 +228,6 @@
38102 static int card_no=-1;
38107 printk("lanstreamer::streamer_init_one, entry pdev %p\n",pdev);
38108 @@ -254,14 +253,16 @@
38112 - if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
38113 + rc = pci_set_dma_mask(pdev, 0xFFFFFFFFULL);
38115 printk(KERN_ERR "%s: No suitable PCI mapping available.\n",
38121 - if (pci_enable_device(pdev)) {
38122 + rc = pci_enable_device(pdev);
38124 printk(KERN_ERR "lanstreamer: unable to enable pci device\n");
38127 @@ -269,6 +270,12 @@
38129 pci_set_master(pdev);
38131 + rc = pci_set_mwi(pdev);
38133 + printk(KERN_ERR "lanstreamer: unable to enable MWI on pci device\n");
38134 + goto err_out_disable;
38137 pio_start = pci_resource_start(pdev, 0);
38138 pio_end = pci_resource_end(pdev, 0);
38139 pio_flags = pci_resource_flags(pdev, 0);
38140 @@ -290,7 +297,7 @@
38141 printk(KERN_ERR "lanstreamer: unable to get pci io addr %lx\n",
38145 + goto err_out_mwi;
38148 if (!request_mem_region(mmio_start, mmio_len, "lanstreamer")) {
38149 @@ -341,26 +348,9 @@
38151 spin_lock_init(&streamer_priv->streamer_lock);
38153 - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cls);
38155 - if (cls != SMP_CACHE_BYTES) {
38156 - printk(KERN_INFO " PCI cache line size set incorrectly "
38157 - "(%i bytes) by BIOS/FW, ", cls);
38158 - if (cls > SMP_CACHE_BYTES)
38159 - printk("expecting %i\n", SMP_CACHE_BYTES);
38161 - printk("correcting to %i\n", SMP_CACHE_BYTES);
38162 - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
38163 - SMP_CACHE_BYTES >> 2);
38167 pci_read_config_word (pdev, PCI_COMMAND, &pcr);
38169 - pcr |= (PCI_COMMAND_INVALIDATE | PCI_COMMAND_SERR);
38171 + pcr |= PCI_COMMAND_SERR;
38172 pci_write_config_word (pdev, PCI_COMMAND, pcr);
38173 - pci_read_config_word (pdev, PCI_COMMAND, &pcr);
38175 printk("%s \n", version);
38176 printk("%s: %s. I/O at %hx, MMIO at %p, using irq %d\n",dev->name,
38177 @@ -383,8 +373,12 @@
38178 release_mem_region(mmio_start, mmio_len);
38180 release_region(pio_start, pio_len);
38182 + pci_clear_mwi(pdev);
38184 + pci_disable_device(pdev);
38187 + free_netdev(dev);
38189 printk("lanstreamer: Exit error %x\n",rc);
38191 @@ -430,9 +424,11 @@
38194 unregister_netdev(dev);
38195 - /* shouldn't we do iounmap here? */
38196 - release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev,0));
38197 + iounmap(streamer_priv->streamer_mmio);
38198 release_mem_region(pci_resource_start(pdev, 1), pci_resource_len(pdev,1));
38199 + release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev,0));
38200 + pci_clear_mwi(pdev);
38201 + pci_disable_device(pdev);
38203 pci_set_drvdata(pdev, NULL);
38205 diff -Nru a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
38206 --- a/drivers/net/tulip/de2104x.c Tue Aug 19 20:53:17 2003
38207 +++ b/drivers/net/tulip/de2104x.c Mon Sep 1 08:05:06 2003
38209 /* de2104x.c: A Linux PCI Ethernet driver for Intel/Digital 21040/1 chips. */
38211 - Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
38212 + Copyright 2001,2003 Jeff Garzik <jgarzik@pobox.com>
38214 Copyright 1994, 1995 Digital Equipment Corporation. [de4x5.c]
38215 Written/copyright 1994-2001 by Donald Becker. [tulip.c]
38219 #define DRV_NAME "de2104x"
38220 -#define DRV_VERSION "0.5.4"
38221 -#define DRV_RELDATE "Jan 1, 2002"
38222 +#define DRV_VERSION "0.6"
38223 +#define DRV_RELDATE "Sep 1, 2003"
38225 #include <linux/config.h>
38226 #include <linux/module.h>
38227 @@ -1464,7 +1464,7 @@
38228 netif_wake_queue(dev);
38231 -static int de_get_regs(struct de_private *de, u8 *buf)
38232 +static void __de_get_regs(struct de_private *de, u8 *buf)
38235 u32 *rbuf = (u32 *)buf;
38236 @@ -1475,11 +1475,9 @@
38238 /* handle self-clearing RxMissed counter, CSR8 */
38239 de_rx_missed(de, rbuf[8]);
38244 -static int de_ethtool_gset(struct de_private *de, struct ethtool_cmd *ecmd)
38245 +static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
38247 ecmd->supported = de->media_supported;
38248 ecmd->transceiver = XCVR_INTERNAL;
38249 @@ -1516,7 +1514,7 @@
38253 -static int de_ethtool_sset(struct de_private *de, struct ethtool_cmd *ecmd)
38254 +static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
38257 unsigned int media_lock;
38258 @@ -1584,169 +1582,121 @@
38262 -static int de_ethtool_ioctl (struct de_private *de, void *useraddr)
38263 +static void de_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info)
38266 + struct de_private *de = dev->priv;
38268 - /* dev_ioctl() in ../../net/core/dev.c has already checked
38269 - capable(CAP_NET_ADMIN), so don't bother with that here. */
38270 + strcpy (info->driver, DRV_NAME);
38271 + strcpy (info->version, DRV_VERSION);
38272 + strcpy (info->bus_info, pci_name(de->pdev));
38273 + info->eedump_len = DE_EEPROM_SIZE;
38276 - if (get_user(ethcmd, (u32 *)useraddr))
38279 - switch (ethcmd) {
38281 - case ETHTOOL_GDRVINFO: {
38282 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
38283 - strcpy (info.driver, DRV_NAME);
38284 - strcpy (info.version, DRV_VERSION);
38285 - strcpy (info.bus_info, pci_name(de->pdev));
38286 - info.eedump_len = DE_EEPROM_SIZE;
38287 - info.regdump_len = DE_REGS_SIZE;
38288 - if (copy_to_user (useraddr, &info, sizeof (info)))
38293 - /* get settings */
38294 - case ETHTOOL_GSET: {
38295 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
38296 - spin_lock_irq(&de->lock);
38297 - de_ethtool_gset(de, &ecmd);
38298 - spin_unlock_irq(&de->lock);
38299 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
38303 - /* set settings */
38304 - case ETHTOOL_SSET: {
38305 - struct ethtool_cmd ecmd;
38307 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
38309 - spin_lock_irq(&de->lock);
38310 - r = de_ethtool_sset(de, &ecmd);
38311 - spin_unlock_irq(&de->lock);
38314 +static int de_get_regs_len(struct net_device *dev)
38316 + return DE_REGS_SIZE;
38319 - /* restart autonegotiation */
38320 - case ETHTOOL_NWAY_RST: {
38322 +static int de_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
38324 + struct de_private *de = dev->priv;
38327 - if (de->media_type != DE_MEDIA_TP_AUTO)
38329 - if (netif_carrier_ok(de->dev))
38330 - de_link_down(de);
38331 + spin_lock_irq(&de->lock);
38332 + rc = __de_get_settings(de, ecmd);
38333 + spin_unlock_irq(&de->lock);
38335 - status = dr32(SIAStatus);
38336 - dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
38337 - if (netif_msg_link(de))
38338 - printk(KERN_INFO "%s: link nway restart, status %x,%x\n",
38339 - de->dev->name, status, dr32(SIAStatus));
38343 - /* get link status */
38344 - case ETHTOOL_GLINK: {
38345 - struct ethtool_value edata = {ETHTOOL_GLINK};
38346 - edata.data = (netif_carrier_ok(de->dev)) ? 1 : 0;
38347 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38352 - /* get message-level */
38353 - case ETHTOOL_GMSGLVL: {
38354 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
38355 - edata.data = de->msg_enable;
38356 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38360 - /* set message-level */
38361 - case ETHTOOL_SMSGLVL: {
38362 - struct ethtool_value edata;
38363 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
38365 - de->msg_enable = edata.data;
38369 - /* get registers */
38370 - case ETHTOOL_GREGS: {
38371 - struct ethtool_regs regs;
38372 - u8 regbuf[DE_REGS_SIZE];
38377 - if (copy_from_user(®s, useraddr, sizeof(regs)))
38380 - if (regs.len > DE_REGS_SIZE) {
38381 - regs.len = DE_REGS_SIZE;
38383 - regs.version = (DE_REGS_VER << 2) | de->de21040;
38384 - if (copy_to_user(useraddr, ®s, sizeof(regs)))
38386 +static int de_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
38388 + struct de_private *de = dev->priv;
38391 - useraddr += offsetof(struct ethtool_regs, data);
38392 + spin_lock_irq(&de->lock);
38393 + rc = __de_set_settings(de, ecmd);
38394 + spin_unlock_irq(&de->lock);
38396 - spin_lock_irq(&de->lock);
38397 - r = de_get_regs(de, regbuf);
38398 - spin_unlock_irq(&de->lock);
38404 - if (copy_to_user(useraddr, regbuf, regs.len))
38408 +static u32 de_get_msglevel(struct net_device *dev)
38410 + struct de_private *de = dev->priv;
38412 - /* get SROM dump */
38413 - case ETHTOOL_GEEPROM: {
38414 - struct ethtool_eeprom eeprom;
38415 + return de->msg_enable;
38418 - if (!de->ee_data)
38420 - if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
38422 - if ((eeprom.offset != 0) || (eeprom.magic != 0) ||
38423 - (eeprom.len != DE_EEPROM_SIZE))
38425 +static void de_set_msglevel(struct net_device *dev, u32 msglvl)
38427 + struct de_private *de = dev->priv;
38429 - useraddr += offsetof(struct ethtool_regs, data);
38430 - if (copy_to_user(useraddr, de->ee_data, DE_EEPROM_SIZE))
38433 + de->msg_enable = msglvl;
38439 +static int de_get_eeprom(struct net_device *dev,
38440 + struct ethtool_eeprom *eeprom, u8 *data)
38442 + struct de_private *de = dev->priv;
38444 - return -EOPNOTSUPP;
38446 + if (!de->ee_data)
38447 + return -EOPNOTSUPP;
38448 + if ((eeprom->offset != 0) || (eeprom->magic != 0) ||
38449 + (eeprom->len != DE_EEPROM_SIZE))
38451 + memcpy(data, de->ee_data, eeprom->len);
38456 -static int de_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
38457 +static int de_nway_reset(struct net_device *dev)
38459 struct de_private *de = dev->priv;
38463 - if (!netif_running(dev))
38464 + if (de->media_type != DE_MEDIA_TP_AUTO)
38468 - case SIOCETHTOOL:
38469 - return de_ethtool_ioctl(de, (void *) rq->ifr_data);
38470 + if (netif_carrier_ok(de->dev))
38471 + de_link_down(de);
38474 - rc = -EOPNOTSUPP;
38477 + status = dr32(SIAStatus);
38478 + dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
38479 + if (netif_msg_link(de))
38480 + printk(KERN_INFO "%s: link nway restart, status %x,%x\n",
38481 + de->dev->name, status, dr32(SIAStatus));
38486 +static void de_get_regs(struct net_device *dev, struct ethtool_regs *regs,
38489 + struct de_private *de = dev->priv;
38491 + if (regs->len > DE_REGS_SIZE)
38492 + regs->len = DE_REGS_SIZE;
38493 + regs->version = (DE_REGS_VER << 2) | de->de21040;
38495 + spin_lock_irq(&de->lock);
38496 + __de_get_regs(de, data);
38497 + spin_unlock_irq(&de->lock);
38500 +static struct ethtool_ops de_ethtool_ops = {
38501 + .get_link = ethtool_op_get_link,
38502 + .get_tx_csum = ethtool_op_get_tx_csum,
38503 + .get_sg = ethtool_op_get_sg,
38504 + .get_drvinfo = de_get_drvinfo,
38505 + .get_regs_len = de_get_regs_len,
38506 + .get_settings = de_get_settings,
38507 + .set_settings = de_set_settings,
38508 + .get_msglevel = de_get_msglevel,
38509 + .set_msglevel = de_set_msglevel,
38510 + .get_eeprom = de_get_eeprom,
38511 + .nway_reset = de_nway_reset,
38512 + .get_regs = de_get_regs,
38515 static void __init de21040_get_mac_address (struct de_private *de)
38518 @@ -2011,7 +1961,7 @@
38519 dev->set_multicast_list = de_set_rx_mode;
38520 dev->hard_start_xmit = de_start_xmit;
38521 dev->get_stats = de_get_stats;
38522 - dev->do_ioctl = de_ioctl;
38523 + dev->ethtool_ops = &de_ethtool_ops;
38524 dev->tx_timeout = de_tx_timeout;
38525 dev->watchdog_timeo = TX_TIMEOUT;
38527 diff -Nru a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
38528 --- a/drivers/net/tulip/dmfe.c Tue Aug 19 20:53:17 2003
38529 +++ b/drivers/net/tulip/dmfe.c Tue Aug 26 13:42:22 2003
38530 @@ -296,7 +296,7 @@
38531 static int dmfe_stop(struct DEVICE *);
38532 static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
38533 static void dmfe_set_filter_mode(struct DEVICE *);
38534 -static int dmfe_do_ioctl(struct DEVICE *, struct ifreq *, int);
38535 +static struct ethtool_ops netdev_ethtool_ops;
38536 static u16 read_srom_word(long ,int);
38537 static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
38538 static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
38539 @@ -417,7 +417,7 @@
38540 dev->stop = &dmfe_stop;
38541 dev->get_stats = &dmfe_get_stats;
38542 dev->set_multicast_list = &dmfe_set_filter_mode;
38543 - dev->do_ioctl = &dmfe_do_ioctl;
38544 + dev->ethtool_ops = &netdev_ethtool_ops;
38545 spin_lock_init(&db->lock);
38547 pci_read_config_dword(pdev, 0x50, &pci_pmr);
38548 @@ -1000,55 +1000,23 @@
38549 spin_unlock_irqrestore(&db->lock, flags);
38554 - * Process the ethtool ioctl command
38557 -static int dmfe_ethtool_ioctl(struct net_device *dev, void *useraddr)
38558 +static void netdev_get_drvinfo(struct net_device *dev,
38559 + struct ethtool_drvinfo *info)
38561 - struct dmfe_board_info *db = dev->priv;
38562 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
38565 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
38568 - switch (ethcmd) {
38569 - case ETHTOOL_GDRVINFO:
38570 - strcpy(info.driver, DRV_NAME);
38571 - strcpy(info.version, DRV_VERSION);
38573 - strcpy(info.bus_info, pci_name(db->pdev));
38575 - sprintf(info.bus_info, "EISA 0x%lx %d",
38576 - dev->base_addr, dev->irq);
38577 - if (copy_to_user(useraddr, &info, sizeof(info)))
38582 - return -EOPNOTSUPP;
38584 + struct dmfe_board_info *np = dev->priv;
38588 - * Process the upper socket ioctl command
38591 -static int dmfe_do_ioctl(struct DEVICE *dev, struct ifreq *ifr, int cmd)
38593 - int retval = -EOPNOTSUPP;
38594 - DMFE_DBUG(0, "dmfe_do_ioctl()", 0);
38597 - case SIOCETHTOOL:
38598 - return dmfe_ethtool_ioctl(dev, (void*)ifr->ifr_data);
38602 + strcpy(info->driver, DRV_NAME);
38603 + strcpy(info->version, DRV_VERSION);
38605 + strcpy(info->bus_info, pci_name(np->pdev));
38607 + sprintf(info->bus_info, "EISA 0x%lx %d",
38608 + dev->base_addr, dev->irq);
38611 +static struct ethtool_ops netdev_ethtool_ops = {
38612 + .get_drvinfo = netdev_get_drvinfo,
38616 * A periodic timer routine
38617 diff -Nru a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
38618 --- a/drivers/net/tulip/winbond-840.c Tue Aug 19 20:53:17 2003
38619 +++ b/drivers/net/tulip/winbond-840.c Mon Sep 1 14:05:11 2003
38620 @@ -392,6 +392,7 @@
38621 static void set_rx_mode(struct net_device *dev);
38622 static struct net_device_stats *get_stats(struct net_device *dev);
38623 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
38624 +static struct ethtool_ops netdev_ethtool_ops;
38625 static int netdev_close(struct net_device *dev);
38628 @@ -482,6 +483,7 @@
38629 dev->get_stats = &get_stats;
38630 dev->set_multicast_list = &set_rx_mode;
38631 dev->do_ioctl = &netdev_ioctl;
38632 + dev->ethtool_ops = &netdev_ethtool_ops;
38633 dev->tx_timeout = &tx_timeout;
38634 dev->watchdog_timeo = TX_TIMEOUT;
38636 @@ -1452,88 +1454,79 @@
38637 spin_unlock_irq(&np->lock);
38640 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
38641 +static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
38643 struct netdev_private *np = dev->priv;
38646 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
38649 - switch (ethcmd) {
38650 - case ETHTOOL_GDRVINFO: {
38651 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
38652 - strcpy(info.driver, DRV_NAME);
38653 - strcpy(info.version, DRV_VERSION);
38654 - strcpy(info.bus_info, pci_name(np->pci_dev));
38655 - if (copy_to_user(useraddr, &info, sizeof(info)))
38660 - /* get settings */
38661 - case ETHTOOL_GSET: {
38662 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
38663 - spin_lock_irq(&np->lock);
38664 - mii_ethtool_gset(&np->mii_if, &ecmd);
38665 - spin_unlock_irq(&np->lock);
38666 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
38670 - /* set settings */
38671 - case ETHTOOL_SSET: {
38673 - struct ethtool_cmd ecmd;
38674 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
38676 - spin_lock_irq(&np->lock);
38677 - r = mii_ethtool_sset(&np->mii_if, &ecmd);
38678 - spin_unlock_irq(&np->lock);
38681 - /* restart autonegotiation */
38682 - case ETHTOOL_NWAY_RST: {
38683 - return mii_nway_restart(&np->mii_if);
38685 - /* get link status */
38686 - case ETHTOOL_GLINK: {
38687 - struct ethtool_value edata = {ETHTOOL_GLINK};
38688 - edata.data = mii_link_ok(&np->mii_if);
38689 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38694 - /* get message-level */
38695 - case ETHTOOL_GMSGLVL: {
38696 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
38697 - edata.data = debug;
38698 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38702 - /* set message-level */
38703 - case ETHTOOL_SMSGLVL: {
38704 - struct ethtool_value edata;
38705 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
38707 - debug = edata.data;
38712 - return -EOPNOTSUPP;
38714 + strcpy (info->driver, DRV_NAME);
38715 + strcpy (info->version, DRV_VERSION);
38716 + strcpy (info->bus_info, pci_name(np->pci_dev));
38719 +static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
38721 + struct netdev_private *np = dev->priv;
38724 + spin_lock_irq(&np->lock);
38725 + rc = mii_ethtool_gset(&np->mii_if, cmd);
38726 + spin_unlock_irq(&np->lock);
38731 +static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
38733 + struct netdev_private *np = dev->priv;
38736 + spin_lock_irq(&np->lock);
38737 + rc = mii_ethtool_sset(&np->mii_if, cmd);
38738 + spin_unlock_irq(&np->lock);
38743 +static int netdev_nway_reset(struct net_device *dev)
38745 + struct netdev_private *np = dev->priv;
38746 + return mii_nway_restart(&np->mii_if);
38749 +static u32 netdev_get_link(struct net_device *dev)
38751 + struct netdev_private *np = dev->priv;
38752 + return mii_link_ok(&np->mii_if);
38755 +static u32 netdev_get_msglevel(struct net_device *dev)
38760 +static void netdev_set_msglevel(struct net_device *dev, u32 value)
38765 +static struct ethtool_ops netdev_ethtool_ops = {
38766 + .get_drvinfo = netdev_get_drvinfo,
38767 + .get_settings = netdev_get_settings,
38768 + .set_settings = netdev_set_settings,
38769 + .nway_reset = netdev_nway_reset,
38770 + .get_link = netdev_get_link,
38771 + .get_msglevel = netdev_get_msglevel,
38772 + .set_msglevel = netdev_set_msglevel,
38773 + .get_sg = ethtool_op_get_sg,
38774 + .get_tx_csum = ethtool_op_get_tx_csum,
38777 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
38779 struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
38780 struct netdev_private *np = dev->priv;
38783 - case SIOCETHTOOL:
38784 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
38785 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
38786 data->phy_id = ((struct netdev_private *)dev->priv)->phys[0] & 0x1f;
38788 diff -Nru a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
38789 --- a/drivers/net/tulip/xircom_cb.c Tue Aug 19 20:53:17 2003
38790 +++ b/drivers/net/tulip/xircom_cb.c Tue Aug 26 14:52:05 2003
38791 @@ -175,37 +175,19 @@
38795 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
38796 +static void netdev_get_drvinfo(struct net_device *dev,
38797 + struct ethtool_drvinfo *info)
38801 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
38804 - switch (ethcmd) {
38805 - case ETHTOOL_GDRVINFO: {
38806 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
38807 - strncpy(info.driver, "xircom_cb", sizeof(info.driver)-1);
38808 - if (copy_to_user(useraddr, &info, sizeof(info)))
38814 - return -EOPNOTSUPP;
38816 + struct xircom_private *private = dev->priv;
38818 -static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
38822 - case SIOCETHTOOL:
38823 - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
38825 - return -EOPNOTSUPP;
38827 + strcpy(info->driver, "xircom_cb");
38828 + strcpy(info->bus_info, pci_name(private->pdev));
38831 +static struct ethtool_ops netdev_ethtool_ops = {
38832 + .get_drvinfo = netdev_get_drvinfo,
38835 /* xircom_probe is the code that gets called on device insertion.
38836 it sets up the hardware and registers the device to the networklayer.
38838 @@ -287,7 +269,7 @@
38839 dev->stop = &xircom_close;
38840 dev->get_stats = &xircom_get_stats;
38841 dev->priv = private;
38842 - dev->do_ioctl = &private_ioctl;
38843 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
38844 pci_set_drvdata(pdev, dev);
38847 diff -Nru a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
38848 --- a/drivers/net/via-rhine.c Tue Aug 19 20:53:17 2003
38849 +++ b/drivers/net/via-rhine.c Mon Sep 1 14:05:11 2003
38850 @@ -547,6 +547,7 @@
38851 static void via_rhine_set_rx_mode(struct net_device *dev);
38852 static struct net_device_stats *via_rhine_get_stats(struct net_device *dev);
38853 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
38854 +static struct ethtool_ops netdev_ethtool_ops;
38855 static int via_rhine_close(struct net_device *dev);
38857 static inline u32 get_intr_status(struct net_device *dev)
38858 @@ -780,6 +781,7 @@
38859 dev->get_stats = via_rhine_get_stats;
38860 dev->set_multicast_list = via_rhine_set_rx_mode;
38861 dev->do_ioctl = netdev_ioctl;
38862 + dev->ethtool_ops = &netdev_ethtool_ops;
38863 dev->tx_timeout = via_rhine_tx_timeout;
38864 dev->watchdog_timeo = TX_TIMEOUT;
38865 if (np->drv_flags & ReqTxAlign)
38866 @@ -1741,90 +1743,87 @@
38867 writeb(np->rx_thresh | rx_mode, ioaddr + RxConfig);
38870 -static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
38871 +static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
38873 struct netdev_private *np = dev->priv;
38876 - if (get_user(ethcmd, (u32 *)useraddr))
38878 + strcpy (info->driver, DRV_NAME);
38879 + strcpy (info->version, DRV_VERSION);
38880 + strcpy (info->bus_info, pci_name(np->pdev));
38883 - switch (ethcmd) {
38884 - case ETHTOOL_GDRVINFO: {
38885 - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
38886 - strcpy (info.driver, DRV_NAME);
38887 - strcpy (info.version, DRV_VERSION);
38888 - strcpy (info.bus_info, pci_name(np->pdev));
38889 - if (copy_to_user (useraddr, &info, sizeof (info)))
38893 +static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
38895 + struct netdev_private *np = dev->priv;
38898 - /* get settings */
38899 - case ETHTOOL_GSET: {
38900 - struct ethtool_cmd ecmd = { ETHTOOL_GSET };
38901 - if (!(np->drv_flags & CanHaveMII))
38903 - spin_lock_irq(&np->lock);
38904 - mii_ethtool_gset(&np->mii_if, &ecmd);
38905 - spin_unlock_irq(&np->lock);
38906 - if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
38910 - /* set settings */
38911 - case ETHTOOL_SSET: {
38913 - struct ethtool_cmd ecmd;
38914 - if (!(np->drv_flags & CanHaveMII))
38916 - if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
38918 - spin_lock_irq(&np->lock);
38919 - r = mii_ethtool_sset(&np->mii_if, &ecmd);
38920 - spin_unlock_irq(&np->lock);
38923 - /* restart autonegotiation */
38924 - case ETHTOOL_NWAY_RST: {
38925 - if (!(np->drv_flags & CanHaveMII))
38927 - return mii_nway_restart(&np->mii_if);
38929 - /* get link status */
38930 - case ETHTOOL_GLINK: {
38931 - struct ethtool_value edata = {ETHTOOL_GLINK};
38932 - if (!(np->drv_flags & CanHaveMII))
38934 - edata.data = mii_link_ok(&np->mii_if);
38935 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38940 - /* get message-level */
38941 - case ETHTOOL_GMSGLVL: {
38942 - struct ethtool_value edata = {ETHTOOL_GMSGLVL};
38943 - edata.data = debug;
38944 - if (copy_to_user(useraddr, &edata, sizeof(edata)))
38948 - /* set message-level */
38949 - case ETHTOOL_SMSGLVL: {
38950 - struct ethtool_value edata;
38951 - if (copy_from_user(&edata, useraddr, sizeof(edata)))
38953 - debug = edata.data;
38959 + if (!(np->drv_flags & CanHaveMII))
38962 + spin_lock_irq(&np->lock);
38963 + rc = mii_ethtool_gset(&np->mii_if, cmd);
38964 + spin_unlock_irq(&np->lock);
38969 +static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
38971 + struct netdev_private *np = dev->priv;
38974 + if (!(np->drv_flags & CanHaveMII))
38977 + spin_lock_irq(&np->lock);
38978 + rc = mii_ethtool_sset(&np->mii_if, cmd);
38979 + spin_unlock_irq(&np->lock);
38981 - return -EOPNOTSUPP;
38985 +static int netdev_nway_reset(struct net_device *dev)
38987 + struct netdev_private *np = dev->priv;
38989 + if (!(np->drv_flags & CanHaveMII))
38992 + return mii_nway_restart(&np->mii_if);
38995 +static u32 netdev_get_link(struct net_device *dev)
38997 + struct netdev_private *np = dev->priv;
38999 + if (!(np->drv_flags & CanHaveMII))
39000 + return 0; /* -EINVAL */
39002 + return mii_link_ok(&np->mii_if);
39005 +static u32 netdev_get_msglevel(struct net_device *dev)
39010 +static void netdev_set_msglevel(struct net_device *dev, u32 value)
39015 +static struct ethtool_ops netdev_ethtool_ops = {
39016 + .get_drvinfo = netdev_get_drvinfo,
39017 + .get_settings = netdev_get_settings,
39018 + .set_settings = netdev_set_settings,
39019 + .nway_reset = netdev_nway_reset,
39020 + .get_link = netdev_get_link,
39021 + .get_msglevel = netdev_get_msglevel,
39022 + .set_msglevel = netdev_set_msglevel,
39023 + .get_sg = ethtool_op_get_sg,
39024 + .get_tx_csum = ethtool_op_get_tx_csum,
39027 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
39029 struct netdev_private *np = dev->priv;
39030 @@ -1834,14 +1833,9 @@
39031 if (!netif_running(dev))
39034 - if (cmd == SIOCETHTOOL)
39035 - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
39038 - spin_lock_irq(&np->lock);
39039 - rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
39040 - spin_unlock_irq(&np->lock);
39042 + spin_lock_irq(&np->lock);
39043 + rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
39044 + spin_unlock_irq(&np->lock);
39048 diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
39049 --- a/drivers/net/wan/cosa.c Tue Aug 19 21:00:03 2003
39050 +++ b/drivers/net/wan/cosa.c Fri Aug 29 22:32:28 2003
39051 @@ -632,7 +632,7 @@
39053 sppp_detach(chan->pppdev.dev);
39054 unregister_netdev(chan->pppdev.dev);
39055 - free_netdev(chan->ppp.dev);
39056 + free_netdev(chan->pppdev.dev);
39059 static int cosa_sppp_open(struct net_device *d)
39060 @@ -961,12 +961,12 @@
39061 unsigned long flags;
39064 - if ((n=minor(file->f_dentry->d_inode->i_rdev)>>CARD_MINOR_BITS)
39065 + if ((n=iminor(file->f_dentry->d_inode)>>CARD_MINOR_BITS)
39068 cosa = cosa_cards+n;
39070 - if ((n=minor(file->f_dentry->d_inode->i_rdev)
39071 + if ((n=iminor(file->f_dentry->d_inode)
39072 & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels)
39074 chan = cosa->chan + n;
39075 @@ -1009,7 +1009,7 @@
39076 /* To be done ... */
39077 static int cosa_fasync(struct inode *inode, struct file *file, int on)
39079 - int port = MINOR(inode->i_rdev);
39080 + int port = iminor(inode);
39081 int rv = fasync_helper(inode, file, on, &fasync[port]);
39082 return rv < 0 ? rv : 0;
39084 diff -Nru a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
39085 --- a/drivers/net/wan/cycx_drv.c Tue Jul 15 10:01:29 2003
39086 +++ b/drivers/net/wan/cycx_drv.c Sat Aug 23 20:42:31 2003
39087 @@ -70,12 +70,12 @@
39088 static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len);
39089 static void cycx_bootcfg(struct cycx_hw *hw);
39091 -static int reset_cyc2x(u32 addr);
39092 -static int detect_cyc2x(u32 addr);
39093 +static int reset_cyc2x(void *addr);
39094 +static int detect_cyc2x(void *addr);
39096 /* Miscellaneous functions */
39097 static void delay_cycx(int sec);
39098 -static int get_option_index(u32 *optlist, u32 optval);
39099 +static int get_option_index(long *optlist, long optval);
39100 static u16 checksum(u8 *buf, u32 len);
39102 #define wait_cyc(addr) cycx_exec(addr + CMD_OFFSET)
39103 @@ -92,14 +92,14 @@
39104 * These are arrays of configuration options used by verification routines.
39105 * The first element of each array is its size (i.e. number of options).
39107 -static u32 cyc2x_dpmbase_options[] = {
39108 +static long cyc2x_dpmbase_options[] = {
39110 0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000, 0xB8000,
39111 0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000, 0xD0000, 0xD4000,
39112 0xD8000, 0xDC000, 0xE0000, 0xE4000, 0xE8000, 0xEC000
39115 -static u32 cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
39116 +static long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
39118 /* Kernel Loadable Module Entry Points */
39119 /* Module 'insert' entry point.
39120 @@ -137,7 +137,7 @@
39121 EXPORT_SYMBOL(cycx_setup);
39122 int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len)
39124 - unsigned long dpmbase = hw->dpmbase;
39125 + long dpmbase = (long)hw->dpmbase;
39128 /* Verify IRQ configuration options */
39129 @@ -147,17 +147,17 @@
39132 /* Setup adapter dual-port memory window and test memory */
39133 - if (!hw->dpmbase) {
39135 printk(KERN_ERR "%s: you must specify the dpm address!\n",
39138 - } else if (!get_option_index(cyc2x_dpmbase_options, hw->dpmbase)) {
39139 + } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) {
39140 printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n",
39145 - hw->dpmbase = (u32)ioremap(dpmbase, CYCX_WINDOWSIZE);
39146 + hw->dpmbase = ioremap(dpmbase, CYCX_WINDOWSIZE);
39147 hw->dpmsize = CYCX_WINDOWSIZE;
39149 if (!detect_cyc2x(hw->dpmbase)) {
39150 @@ -181,8 +181,7 @@
39151 EXPORT_SYMBOL(cycx_down);
39152 int cycx_down(struct cycx_hw *hw)
39154 - iounmap((u32 *)hw->dpmbase);
39156 + iounmap(hw->dpmbase);
39160 @@ -204,7 +203,7 @@
39162 * o Busy-wait until flag is reset. */
39163 EXPORT_SYMBOL(cycx_exec);
39164 -int cycx_exec(u32 addr)
39165 +int cycx_exec(void *addr)
39168 /* wait till addr content is zeroed */
39169 @@ -250,7 +249,7 @@
39170 /* Load Aux Routines */
39171 /* Reset board hardware.
39172 return 1 if memory exists at addr and 0 if not. */
39173 -static int memory_exists(u32 addr)
39174 +static int memory_exists(void *addr)
39178 @@ -268,9 +267,9 @@
39181 /* Load reset code. */
39182 -static void reset_load(u32 addr, u8 *buffer, u32 cnt)
39183 +static void reset_load(void *addr, u8 *buffer, u32 cnt)
39185 - u32 pt_code = addr + RESET_OFFSET;
39186 + void *pt_code = addr + RESET_OFFSET;
39189 for (i = 0 ; i < cnt ; i++) {
39190 @@ -282,7 +281,7 @@
39191 /* Load buffer using boot interface.
39192 * o copy data from buffer to Cyclom-X memory
39193 * o wait for reset code to copy it to right portion of memory */
39194 -static int buffer_load(u32 addr, u8 *buffer, u32 cnt)
39195 +static int buffer_load(void *addr, u8 *buffer, u32 cnt)
39197 memcpy_toio(addr + DATA_OFFSET, buffer, cnt);
39198 writew(GEN_BOOT_DAT, addr + CMD_OFFSET);
39199 @@ -291,7 +290,7 @@
39202 /* Set up entry point and kick start Cyclom-X CPU. */
39203 -static void cycx_start(u32 addr)
39204 +static void cycx_start(void *addr)
39206 /* put in 0x30 offset the jump instruction to the code entry point */
39207 writeb(0xea, addr + 0x30);
39208 @@ -305,9 +304,9 @@
39211 /* Load and boot reset code. */
39212 -static void cycx_reset_boot(u32 addr, u8 *code, u32 len)
39213 +static void cycx_reset_boot(void *addr, u8 *code, u32 len)
39215 - u32 pt_start = addr + START_OFFSET;
39216 + void *pt_start = addr + START_OFFSET;
39218 writeb(0xea, pt_start++); /* jmp to f000:3f00 */
39219 writeb(0x00, pt_start++);
39220 @@ -322,9 +321,9 @@
39223 /* Load data.bin file through boot (reset) interface. */
39224 -static int cycx_data_boot(u32 addr, u8 *code, u32 len)
39225 +static int cycx_data_boot(void *addr, u8 *code, u32 len)
39227 - u32 pt_boot_cmd = addr + CMD_OFFSET;
39228 + void *pt_boot_cmd = addr + CMD_OFFSET;
39231 /* boot buffer lenght */
39232 @@ -353,9 +352,9 @@
39235 /* Load code.bin file through boot (reset) interface. */
39236 -static int cycx_code_boot(u32 addr, u8 *code, u32 len)
39237 +static int cycx_code_boot(void *addr, u8 *code, u32 len)
39239 - u32 pt_boot_cmd = addr + CMD_OFFSET;
39240 + void *pt_boot_cmd = addr + CMD_OFFSET;
39243 /* boot buffer lenght */
39244 @@ -392,7 +391,7 @@
39248 - u32 pt_cycld = hw->dpmbase + 0x400;
39249 + void *pt_cycld = hw->dpmbase + 0x400;
39253 @@ -426,7 +425,7 @@
39254 if (cksum != cfm->checksum) {
39255 printk(KERN_ERR "%s:%s: firmware corrupted!\n",
39256 modname, __FUNCTION__);
39257 - printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n",
39258 + printk(KERN_ERR " cdsize = 0x%lx (expected 0x%lx)\n",
39259 len - sizeof(struct cycx_firmware) - 1,
39260 cfm->info.codesize);
39261 printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
39262 @@ -435,9 +434,7 @@
39265 /* If everything is ok, set reset, data and code pointers */
39267 - img_hdr = (struct cycx_fw_header *)(((u8 *)cfm) +
39268 - sizeof(struct cycx_firmware) - 1);
39269 + img_hdr = (struct cycx_fw_header *)&cfm->image;
39270 #ifdef FIRMWARE_DEBUG
39271 printk(KERN_INFO "%s:%s: image sizes\n", __FUNCTION__, modname);
39272 printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size);
39273 @@ -526,7 +523,7 @@
39274 * Return 1 if detected o.k. or 0 if failed.
39275 * Note: This test is destructive! Adapter will be left in shutdown
39276 * state after the test. */
39277 -static int detect_cyc2x(u32 addr)
39278 +static int detect_cyc2x(void *addr)
39282 @@ -536,7 +533,7 @@
39283 /* Miscellaneous */
39284 /* Get option's index into the options list.
39285 * Return option's index (1 .. N) or zero if option is invalid. */
39286 -static int get_option_index(u32 *optlist, u32 optval)
39287 +static int get_option_index(long *optlist, long optval)
39291 @@ -548,7 +545,7 @@
39294 /* Reset adapter's CPU. */
39295 -static int reset_cyc2x(u32 addr)
39296 +static int reset_cyc2x(void *addr)
39298 writeb(0, addr + RST_ENABLE);
39300 diff -Nru a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c
39301 --- a/drivers/net/wan/cycx_main.c Tue May 20 07:19:38 2003
39302 +++ b/drivers/net/wan/cycx_main.c Sat Aug 23 20:36:33 2003
39303 @@ -223,7 +223,7 @@
39304 /* Configure hardware, load firmware, etc. */
39305 memset(&card->hw, 0, sizeof(card->hw));
39306 card->hw.irq = irq;
39307 - card->hw.dpmbase = conf->maddr;
39308 + card->hw.dpmbase = (void *)conf->maddr;
39309 card->hw.dpmsize = CYCX_WINDOWSIZE;
39310 card->hw.fwid = CFID_X25_2X;
39311 card->lock = SPIN_LOCK_UNLOCKED;
39312 @@ -236,7 +236,7 @@
39313 /* Initialize WAN device data space */
39315 wandev->dma = wandev->ioport = 0;
39316 - wandev->maddr = card->hw.dpmbase;
39317 + wandev->maddr = (unsigned long)card->hw.dpmbase;
39318 wandev->msize = card->hw.dpmsize;
39319 wandev->hw_opt[2] = 0;
39320 wandev->hw_opt[3] = card->hw.fwid;
39321 diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
39322 --- a/drivers/net/wireless/airo.c Tue Aug 19 20:13:55 2003
39323 +++ b/drivers/net/wireless/airo.c Sun Aug 31 16:14:06 2003
39324 @@ -81,12 +81,12 @@
39327 /* Support Cisco MIC feature */
39328 -/* As this feature requires the AES encryption algorithm, it is not included
39329 - in the kernel tree. If you want to enable it, you need to download the
39330 - aes.h, aestab.h and mic.h files from the CVS at
39331 - http://sf.net/projects/airo-linux/ Put the files in the same directory
39332 - as airo.c and compile normally */
39333 +#define MICSUPPORT
39335 +#if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO)
39336 +#warning MIC support requires Crypto API
39340 /* Hack to do some power saving */
39341 #define POWER_ON_DOWN
39342 @@ -615,14 +615,14 @@
39345 /*---------- Aironet Extensions ----------*/
39348 #define MAGIC_ACTION_STSCHG 1
39349 #define MACIC_ACTION_RESUME 2
39350 #define MAGIC_IGNORE_MCAST (1<<8)
39351 #define MAGIC_IGNORE_BCAST (1<<9)
39352 #define MAGIC_SWITCH_TO_PSP (0<<10)
39353 #define MAGIC_STAY_IN_CAM (1<<10)
39354 - u16 magicControl;
39359 @@ -843,6 +843,7 @@
39360 #define AIROGMICRID 11
39361 #define AIROGMICSTATS 12
39362 #define AIROGFLAGS 13
39363 +#define AIRORRID 15
39365 /* Leave gap of 40 commands after AIROGSTATSD32 for future */
39367 @@ -994,6 +995,8 @@
39368 static int micsetup(struct airo_info *ai);
39369 static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len);
39370 static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket, u16 payLen);
39372 +#include <linux/crypto.h>
39376 @@ -1063,9 +1066,12 @@
39377 #endif /* WIRELESS_SPY */
39378 #endif /* WIRELESS_EXT > 15 */
39379 #endif /* WIRELESS_EXT */
39382 + struct crypto_tfm *tfm;
39384 mic_statistics micstats;
39388 static inline int bap_read(struct airo_info *ai, u16 *pu16Dst, int bytelen,
39389 @@ -1079,7 +1085,462 @@
39390 struct airo_info *apriv );
39394 +/***********************************************************************
39396 + ***********************************************************************
39399 +static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq);
39400 +static void MoveWindow(miccntx *context, u32 micSeq);
39401 +void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *);
39402 +void emmh32_init(emmh32_context *context);
39403 +void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
39404 +void emmh32_final(emmh32_context *context, u8 digest[4]);
39406 +/* micinit - Initialize mic seed */
39408 +static void micinit(struct airo_info *ai)
39412 + clear_bit(JOB_MIC, &ai->flags);
39413 + PC4500_readrid(ai, RID_MIC, &mic_rid, sizeof(mic_rid), 0);
39416 + ai->micstats.enabled = (mic_rid.state & 0x00FF) ? 1 : 0;
39418 + if (ai->micstats.enabled) {
39419 + /* Key must be valid and different */
39420 + if (mic_rid.multicastValid && (!ai->mod[0].mCtx.valid ||
39421 + (memcmp (ai->mod[0].mCtx.key, mic_rid.multicast,
39422 + sizeof(ai->mod[0].mCtx.key)) != 0))) {
39423 + /* Age current mic Context */
39424 + memcpy(&ai->mod[1].mCtx,&ai->mod[0].mCtx,sizeof(miccntx));
39425 + /* Initialize new context */
39426 + memcpy(&ai->mod[0].mCtx.key,mic_rid.multicast,sizeof(mic_rid.multicast));
39427 + ai->mod[0].mCtx.window = 33; //Window always points to the middle
39428 + ai->mod[0].mCtx.rx = 0; //Rx Sequence numbers
39429 + ai->mod[0].mCtx.tx = 0; //Tx sequence numbers
39430 + ai->mod[0].mCtx.valid = 1; //Key is now valid
39432 + /* Give key to mic seed */
39433 + emmh32_setseed(&ai->mod[0].mCtx.seed,mic_rid.multicast,sizeof(mic_rid.multicast), ai->tfm);
39436 + /* Key must be valid and different */
39437 + if (mic_rid.unicastValid && (!ai->mod[0].uCtx.valid ||
39438 + (memcmp(ai->mod[0].uCtx.key, mic_rid.unicast,
39439 + sizeof(ai->mod[0].uCtx.key)) != 0))) {
39440 + /* Age current mic Context */
39441 + memcpy(&ai->mod[1].uCtx,&ai->mod[0].uCtx,sizeof(miccntx));
39442 + /* Initialize new context */
39443 + memcpy(&ai->mod[0].uCtx.key,mic_rid.unicast,sizeof(mic_rid.unicast));
39445 + ai->mod[0].uCtx.window = 33; //Window always points to the middle
39446 + ai->mod[0].uCtx.rx = 0; //Rx Sequence numbers
39447 + ai->mod[0].uCtx.tx = 0; //Tx sequence numbers
39448 + ai->mod[0].uCtx.valid = 1; //Key is now valid
39450 + //Give key to mic seed
39451 + emmh32_setseed(&ai->mod[0].uCtx.seed, mic_rid.unicast, sizeof(mic_rid.unicast), ai->tfm);
39454 + /* So next time we have a valid key and mic is enabled, we will update
39455 + * the sequence number if the key is the same as before.
39457 + ai->mod[0].uCtx.valid = 0;
39458 + ai->mod[0].mCtx.valid = 0;
39462 +/* micsetup - Get ready for business */
39464 +static int micsetup(struct airo_info *ai) {
39467 + if (ai->tfm == NULL)
39468 + ai->tfm = crypto_alloc_tfm("aes", 0);
39470 + if (ai->tfm == NULL) {
39471 + printk(KERN_ERR "airo: failed to load transform for AES\n");
39475 + for (i=0; i < NUM_MODULES; i++) {
39476 + memset(&ai->mod[i].mCtx,0,sizeof(miccntx));
39477 + memset(&ai->mod[i].uCtx,0,sizeof(miccntx));
39482 +char micsnap[]= {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02};
39484 +/*===========================================================================
39485 + * Description: Mic a packet
39487 + * Inputs: etherHead * pointer to an 802.3 frame
39489 + * Returns: BOOLEAN if successful, otherwise false.
39490 + * PacketTxLen will be updated with the mic'd packets size.
39492 + * Caveats: It is assumed that the frame buffer will already
39493 + * be big enough to hold the largets mic message possible.
39494 + * (No memory allocation is done here).
39496 + * Author: sbraneky (10/15/01)
39497 + * Merciless hacks by rwilcher (1/14/02)
39500 +static int encapsulate(struct airo_info *ai ,etherHead *frame, MICBuffer *mic, int payLen)
39502 + miccntx *context;
39504 + // Determine correct context
39505 + // If not adhoc, always use unicast key
39507 + if (test_bit(FLAG_ADHOC, &ai->flags) && (frame->da[0] & 0x1))
39508 + context = &ai->mod[0].mCtx;
39510 + context = &ai->mod[0].uCtx;
39512 + if (!context->valid)
39515 + mic->typelen = htons(payLen + 16); //Length of Mic'd packet
39517 + memcpy(&mic->u.snap, micsnap, sizeof(micsnap)); // Add Snap
39519 + // Add Tx sequence
39520 + mic->seq = htonl(context->tx);
39521 + context->tx += 2;
39523 + emmh32_init(&context->seed); // Mic the packet
39524 + emmh32_update(&context->seed,frame->da,ETH_ALEN * 2); // DA,SA
39525 + emmh32_update(&context->seed,(u8*)&mic->typelen,10); // Type/Length and Snap
39526 + emmh32_update(&context->seed,(u8*)&mic->seq,sizeof(mic->seq)); //SEQ
39527 + emmh32_update(&context->seed,frame->da + ETH_ALEN * 2,payLen); //payload
39528 + emmh32_final(&context->seed, (u8*)&mic->mic);
39530 + /* New Type/length ?????????? */
39531 + mic->typelen = 0; //Let NIC know it could be an oversized packet
39543 +/*===========================================================================
39544 + * Description: Decapsulates a MIC'd packet and returns the 802.3 packet
39545 + * (removes the MIC stuff) if packet is a valid packet.
39547 + * Inputs: etherHead pointer to the 802.3 packet
39549 + * Returns: BOOLEAN - TRUE if packet should be dropped otherwise FALSE
39551 + * Author: sbraneky (10/15/01)
39552 + * Merciless hacks by rwilcher (1/14/02)
39553 + *---------------------------------------------------------------------------
39556 +static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *eth, u16 payLen)
39560 + miccntx *context;
39562 + mic_error micError = NONE;
39564 + // Check if the packet is a Mic'd packet
39566 + if (!ai->micstats.enabled) {
39567 + //No Mic set or Mic OFF but we received a MIC'd packet.
39568 + if (memcmp ((u8*)eth + 14, micsnap, sizeof(micsnap)) == 0) {
39569 + ai->micstats.rxMICPlummed++;
39575 + if (ntohs(mic->typelen) == 0x888E)
39578 + if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) {
39579 + // Mic enabled but packet isn't Mic'd
39580 + ai->micstats.rxMICPlummed++;
39584 + micSEQ = ntohl(mic->seq); //store SEQ as CPU order
39586 + //At this point we a have a mic'd packet and mic is enabled
39587 + //Now do the mic error checking.
39589 + //Receive seq must be odd
39590 + if ( (micSEQ & 1) == 0 ) {
39591 + ai->micstats.rxWrongSequence++;
39595 + for (i = 0; i < NUM_MODULES; i++) {
39596 + int mcast = eth->da[0] & 1;
39597 + //Determine proper context
39598 + context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx;
39600 + //Make sure context is valid
39601 + if (!context->valid) {
39603 + micError = NOMICPLUMMED;
39608 + if (!mic->typelen)
39609 + mic->typelen = htons(payLen + sizeof(MICBuffer) - 2);
39611 + emmh32_init(&context->seed);
39612 + emmh32_update(&context->seed, eth->da, ETH_ALEN*2);
39613 + emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap));
39614 + emmh32_update(&context->seed, (u8 *)&mic->seq,sizeof(mic->seq));
39615 + emmh32_update(&context->seed, eth->da + ETH_ALEN*2,payLen);
39617 + emmh32_final(&context->seed, digest);
39619 + if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match
39622 + micError = INCORRECTMIC;
39626 + //Check Sequence number if mics pass
39627 + if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) {
39628 + ai->micstats.rxSuccess++;
39632 + micError = SEQUENCE;
39635 + // Update statistics
39636 + switch (micError) {
39637 + case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break;
39638 + case SEQUENCE: ai->micstats.rxWrongSequence++; break;
39639 + case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break;
39640 + case NONE: break;
39641 + case NOMIC: break;
39646 +/*===========================================================================
39647 + * Description: Checks the Rx Seq number to make sure it is valid
39648 + * and hasn't already been received
39650 + * Inputs: miccntx - mic context to check seq against
39651 + * micSeq - the Mic seq number
39653 + * Returns: TRUE if valid otherwise FALSE.
39655 + * Author: sbraneky (10/15/01)
39656 + * Merciless hacks by rwilcher (1/14/02)
39657 + *---------------------------------------------------------------------------
39660 +static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq)
39664 + //Allow for the ap being rebooted - if it is then use the next
39665 + //sequence number of the current sequence number - might go backwards
39668 + if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) {
39669 + clear_bit (FLAG_UPDATE_MULTI, &ai->flags);
39670 + context->window = (micSeq > 33) ? micSeq : 33;
39671 + context->rx = 0; // Reset rx
39673 + } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) {
39674 + clear_bit (FLAG_UPDATE_UNI, &ai->flags);
39675 + context->window = (micSeq > 33) ? micSeq : 33; // Move window
39676 + context->rx = 0; // Reset rx
39679 + //Make sequence number relative to START of window
39680 + seq = micSeq - (context->window - 33);
39682 + //Too old of a SEQ number to check.
39683 + if ((u32)seq < 0)
39686 + if ( seq > 64 ) {
39687 + //Window is infinite forward
39688 + MoveWindow(context,micSeq);
39692 + // We are in the window. Now check the context rx bit to see if it was already sent
39693 + seq >>= 1; //divide by 2 because we only have odd numbers
39694 + index = 1 << seq; //Get an index number
39696 + if (!(context->rx & index)) {
39697 + //micSEQ falls inside the window.
39698 + //Add seqence number to the list of received numbers.
39699 + context->rx |= index;
39701 + MoveWindow(context,micSeq);
39708 +static void MoveWindow(miccntx *context, u32 micSeq)
39712 + //Move window if seq greater than the middle of the window
39713 + if (micSeq > context->window) {
39714 + shift = (micSeq - context->window) >> 1;
39718 + context->rx >>= shift;
39722 + context->window = micSeq; //Move window
39726 +/*==============================================*/
39727 +/*========== EMMH ROUTINES ====================*/
39728 +/*==============================================*/
39730 +/* mic accumulate */
39731 +#define MIC_ACCUM(val) \
39732 + context->accum += (u64)(val) * context->coeff[coeff_position++];
39734 +static unsigned char aes_counter[16];
39736 +/* expand the key to fill the MMH coefficient array */
39737 +void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm)
39739 + /* take the keying material, expand if necessary, truncate at 16-bytes */
39740 + /* run through AES counter mode to generate context->coeff[] */
39745 + struct scatterlist sg[1];
39747 + crypto_cipher_setkey(tfm, pkey, 16);
39749 + for (i = 0; i < (sizeof(context->coeff)/sizeof(context->coeff[0])); ) {
39750 + aes_counter[15] = (u8)(counter >> 0);
39751 + aes_counter[14] = (u8)(counter >> 8);
39752 + aes_counter[13] = (u8)(counter >> 16);
39753 + aes_counter[12] = (u8)(counter >> 24);
39755 + sg[0].page = virt_to_page(aes_counter);
39756 + sg[0].offset = ((long) aes_counter & ~PAGE_MASK);
39757 + sg[0].length = 16;
39758 + crypto_cipher_encrypt(tfm, sg, sg, 16);
39759 + cipher = kmap(sg[0].page) + sg[0].offset;
39760 + for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) {
39761 + context->coeff[i++] = ntohl(*(u32 *)&cipher[j]);
39767 +/* prepare for calculation of a new mic */
39768 +void emmh32_init(emmh32_context *context)
39770 + /* prepare for new mic calculation */
39771 + context->accum = 0;
39772 + context->position = 0;
39775 +/* add some bytes to the mic calculation */
39776 +void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
39778 + int coeff_position, byte_position;
39780 + if (len == 0) return;
39782 + coeff_position = context->position >> 2;
39784 + /* deal with partial 32-bit word left over from last update */
39785 + byte_position = context->position & 3;
39786 + if (byte_position) {
39787 + /* have a partial word in part to deal with */
39789 + if (len == 0) return;
39790 + context->part.d8[byte_position++] = *pOctets++;
39791 + context->position++;
39793 + } while (byte_position < 4);
39794 + MIC_ACCUM(htonl(context->part.d32));
39797 + /* deal with full 32-bit words */
39798 + while (len >= 4) {
39799 + MIC_ACCUM(htonl(*(u32 *)pOctets));
39800 + context->position += 4;
39805 + /* deal with partial 32-bit word that will be left over from this update */
39806 + byte_position = 0;
39807 + while (len > 0) {
39808 + context->part.d8[byte_position++] = *pOctets++;
39809 + context->position++;
39814 +/* mask used to zero empty bytes for final partial word */
39815 +static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L };
39817 +/* calculate the mic */
39818 +void emmh32_final(emmh32_context *context, u8 digest[4])
39820 + int coeff_position, byte_position;
39826 + coeff_position = context->position >> 2;
39828 + /* deal with partial 32-bit word left over from last update */
39829 + byte_position = context->position & 3;
39830 + if (byte_position) {
39831 + /* have a partial word in part to deal with */
39832 + val = htonl(context->part.d32);
39833 + MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */
39836 + /* reduce the accumulated u64 to a 32-bit MIC */
39837 + sum = context->accum;
39838 + stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15);
39839 + utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15);
39840 + sum = utmp & 0xffffffffLL;
39841 + if (utmp > 0x10000000fLL)
39845 + digest[0] = (val>>24) & 0xFF;
39846 + digest[1] = (val>>16) & 0xFF;
39847 + digest[2] = (val>>8) & 0xFF;
39848 + digest[3] = val & 0xFF;
39852 static int readBSSListRid(struct airo_info *ai, int first,
39853 @@ -1556,6 +2017,7 @@
39854 struct sockaddr *addr = p;
39857 + readConfigRid(ai, 1);
39858 memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len);
39859 ai->need_commit = 1;
39860 disable_MAC(ai, 1);
39861 @@ -1624,6 +2086,10 @@
39862 /* PCMCIA frees this stuff, so only for PCI and ISA */
39863 release_region( dev->base_addr, 64 );
39867 + crypto_free_tfm(ai->tfm);
39869 del_airo_dev( dev );
39870 free_netdev( dev );
39872 @@ -1725,6 +2191,9 @@
39873 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
39874 if (ai->thr_pid < 0)
39879 rc = add_airo_dev( dev );
39882 @@ -2125,146 +2594,149 @@
39885 printk( KERN_ERR "airo: Bad size %d\n", len );
39890 - if (test_bit(FLAG_802_11, &apriv->flags)) {
39891 - bap_read (apriv, (u16*)&fc, sizeof(fc), BAP0);
39892 - fc = le16_to_cpu(fc);
39893 - switch (fc & 0xc) {
39895 - if ((fc & 0xe0) == 0xc0)
39901 - if ((fc&0x300)==0x300){
39909 - hdrlen = ETH_ALEN * 2;
39913 - skb = dev_alloc_skb( len + hdrlen + 2 );
39915 - apriv->stats.rx_dropped++;
39920 - buffer = (u16*)skb_put (skb, len + hdrlen);
39921 - if (test_bit(FLAG_802_11, &apriv->flags)) {
39923 - bap_read (apriv, buffer + 1, hdrlen - 2, BAP0);
39924 - if (hdrlen == 24)
39925 - bap_read (apriv, tmpbuf, 6, BAP0);
39927 - bap_read (apriv, &gap, sizeof(gap), BAP0);
39928 - gap = le16_to_cpu(gap);
39931 - bap_read (apriv, tmpbuf, gap, BAP0);
39932 + if (test_bit(FLAG_802_11, &apriv->flags)) {
39933 + bap_read (apriv, (u16*)&fc, sizeof(fc), BAP0);
39934 + fc = le16_to_cpu(fc);
39935 + switch (fc & 0xc) {
39937 + if ((fc & 0xe0) == 0xc0)
39940 - printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n");
39944 - bap_read (apriv, buffer + hdrlen/2, len, BAP0);
39946 - MICBuffer micbuf;
39947 - bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
39948 - if (apriv->micstats.enabled) {
39949 - bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
39950 - if (ntohs(micbuf.typelen) > 0x05DC)
39951 - bap_setup (apriv, fid, 0x44, BAP0);
39953 - len -= sizeof(micbuf);
39956 - skb_trim (skb, len + hdrlen);
39960 + if ((fc&0x300)==0x300){
39965 - bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
39970 + hdrlen = ETH_ALEN * 2;
39972 + skb = dev_alloc_skb( len + hdrlen + 2 );
39974 + apriv->stats.rx_dropped++;
39977 + buffer = (u16*)skb_put (skb, len + hdrlen);
39978 + if (test_bit(FLAG_802_11, &apriv->flags)) {
39980 + bap_read (apriv, buffer + 1, hdrlen - 2, BAP0);
39981 + if (hdrlen == 24)
39982 + bap_read (apriv, tmpbuf, 6, BAP0);
39984 + bap_read (apriv, &gap, sizeof(gap), BAP0);
39985 + gap = le16_to_cpu(gap);
39988 + bap_read (apriv, tmpbuf, gap, BAP0);
39990 + printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n");
39992 + bap_read (apriv, buffer + hdrlen/2, len, BAP0);
39995 + MICBuffer micbuf;
39997 + bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
39999 - if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
40000 - dev_kfree_skb_irq (skb);
40002 + if (apriv->micstats.enabled) {
40003 + bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
40004 + if (ntohs(micbuf.typelen) > 0x05DC)
40005 + bap_setup (apriv, fid, 0x44, BAP0);
40007 + if (len <= sizeof(micbuf))
40010 + len -= sizeof(micbuf);
40011 + skb_trim (skb, len + hdrlen);
40015 + bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
40017 + if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
40019 + dev_kfree_skb_irq (skb);
40021 + OUT4500( apriv, EVACK, EV_RX);
40027 #if WIRELESS_EXT > 15
40028 #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */
40029 - if (apriv->spy_data.spy_number > 0) {
40031 - struct iw_quality wstats;
40032 - /* Prepare spy data : addr + qual */
40033 - if (!test_bit(FLAG_802_11, &apriv->flags)) {
40034 - sa = (char*)buffer + 6;
40035 - bap_setup (apriv, fid, 8, BAP0);
40036 - bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
40038 - sa = (char*)buffer + 10;
40039 - wstats.qual = hdr.rssi[0];
40041 - wstats.level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
40043 - wstats.level = (hdr.rssi[1] + 321) / 2;
40044 - wstats.updated = 3;
40045 - /* Update spy records */
40046 - wireless_spy_update(dev, sa, &wstats);
40048 + if (apriv->spy_data.spy_number > 0) {
40050 + struct iw_quality wstats;
40051 + /* Prepare spy data : addr + qual */
40052 + if (!test_bit(FLAG_802_11, &apriv->flags)) {
40053 + sa = (char*)buffer + 6;
40054 + bap_setup (apriv, fid, 8, BAP0);
40055 + bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
40057 + sa = (char*)buffer + 10;
40058 + wstats.qual = hdr.rssi[0];
40060 + wstats.level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
40062 + wstats.level = (hdr.rssi[1] + 321) / 2;
40063 + wstats.updated = 3;
40064 + /* Update spy records */
40065 + wireless_spy_update(dev, sa, &wstats);
40067 #endif /* IW_WIRELESS_SPY */
40068 #else /* WIRELESS_EXT > 15 */
40069 #ifdef WIRELESS_SPY
40070 - if (apriv->spy_number > 0) {
40074 - sa = (char*)buffer + (test_bit(FLAG_802_11, &apriv->flags) ? 10 : 6);
40076 - for (i=0; i<apriv->spy_number; i++)
40077 - if (!memcmp(sa,apriv->spy_address[i],ETH_ALEN))
40079 - if (!test_bit(FLAG_802_11, &apriv->flags)) {
40080 - bap_setup (apriv, fid, 8, BAP0);
40081 - bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
40083 - apriv->spy_stat[i].qual = hdr.rssi[0];
40085 - apriv->spy_stat[i].level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
40087 - apriv->spy_stat[i].level = (hdr.rssi[1] + 321) / 2;
40088 - apriv->spy_stat[i].noise = 0;
40089 - apriv->spy_stat[i].updated = 3;
40091 + if (apriv->spy_number > 0) {
40095 + sa = (char*)buffer + (test_bit(FLAG_802_11, &apriv->flags) ? 10 : 6);
40097 + for (i=0; i<apriv->spy_number; i++)
40098 + if (!memcmp(sa,apriv->spy_address[i],ETH_ALEN))
40100 + if (!test_bit(FLAG_802_11, &apriv->flags)) {
40101 + bap_setup (apriv, fid, 8, BAP0);
40102 + bap_read (apriv, (u16*)hdr.rssi, 2, BAP0);
40105 + apriv->spy_stat[i].qual = hdr.rssi[0];
40107 + apriv->spy_stat[i].level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
40109 + apriv->spy_stat[i].level = (hdr.rssi[1] + 321) / 2;
40110 + apriv->spy_stat[i].noise = 0;
40111 + apriv->spy_stat[i].updated = 3;
40115 #endif /* WIRELESS_SPY */
40116 #endif /* WIRELESS_EXT > 15 */
40117 - OUT4500( apriv, EVACK, EV_RX);
40118 + OUT4500( apriv, EVACK, EV_RX);
40120 - if (test_bit(FLAG_802_11, &apriv->flags)) {
40121 - skb->mac.raw = skb->data;
40122 - skb->pkt_type = PACKET_OTHERHOST;
40123 - skb->dev = apriv->wifidev;
40124 - skb->protocol = htons(ETH_P_802_2);
40127 - skb->protocol = eth_type_trans(skb,dev);
40129 - skb->dev->last_rx = jiffies;
40130 - skb->ip_summed = CHECKSUM_NONE;
40131 + if (test_bit(FLAG_802_11, &apriv->flags)) {
40132 + skb->mac.raw = skb->data;
40133 + skb->pkt_type = PACKET_OTHERHOST;
40134 + skb->dev = apriv->wifidev;
40135 + skb->protocol = htons(ETH_P_802_2);
40138 + skb->protocol = eth_type_trans(skb,dev);
40140 + skb->dev->last_rx = jiffies;
40141 + skb->ip_summed = CHECKSUM_NONE;
40145 - OUT4500( apriv, EVACK, EV_RX);
40150 /* Check to see if a packet has been transmitted */
40151 if ( status & ( EV_TX|EV_TXEXC ) ) {
40152 @@ -2469,6 +2941,9 @@
40153 printk(KERN_WARNING "airo: unknown received signal level scale\n");
40155 ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS;
40156 + ai->config.authType = AUTH_OPEN;
40157 + ai->config.modulation = MOD_CCK;
40158 + ai->config._reserved1a[0] = 2; /* ??? */
40161 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
40162 @@ -2515,6 +2990,7 @@
40163 memcpy(mySsid.ssids[i].ssid, ssids[i],
40164 mySsid.ssids[i].len);
40166 + mySsid.len = sizeof(mySsid);
40169 status = writeConfigRid(ai, 1);
40170 @@ -3692,6 +4168,8 @@
40171 offset < data->writelen ) offset++;
40175 + SSID_rid.len = sizeof(SSID_rid);
40176 disable_MAC(ai, 1);
40177 writeSsidRid(ai, &SSID_rid);
40178 enable_MAC(ai, &rsp, 1);
40179 @@ -4156,7 +4634,7 @@
40181 static int __init airo_init_module( void )
40183 - int i, rc = 0, have_isa_dev = 0;
40184 + int i, have_isa_dev = 0;
40186 airo_entry = create_proc_entry("aironet",
40187 S_IFDIR | airo_perm,
40188 @@ -4174,7 +4652,7 @@
40191 printk( KERN_INFO "airo: Probing for PCI adapters\n" );
40192 - rc = pci_module_init(&airo_driver);
40193 + pci_module_init(&airo_driver);
40194 printk( KERN_INFO "airo: Finished probing for PCI adapters\n" );
40197 @@ -4197,8 +4675,11 @@
40199 remove_proc_entry("aironet", proc_root_driver);
40204 pci_unregister_driver(&airo_driver);
40209 #ifdef WIRELESS_EXT
40210 @@ -4260,6 +4741,7 @@
40211 printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m);
40214 + readConfigRid(local, 1);
40215 /* Yes ! We can set it !!! */
40216 local->config.channelSet = (u16)(channel - 1);
40217 local->need_commit = 1;
40218 @@ -4280,6 +4762,7 @@
40219 struct airo_info *local = dev->priv;
40220 StatusRid status_rid; /* Card status info */
40222 + readConfigRid(local, 1);
40223 if ((local->config.opmode & 0xFF) == MODE_STA_ESS)
40224 status_rid.channel = local->config.channelSet;
40226 @@ -4336,6 +4819,7 @@
40227 sizeof(SSID_rid.ssids[index].ssid));
40228 memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length);
40229 SSID_rid.ssids[index].len = dwrq->length - 1;
40230 + SSID_rid.len = sizeof(SSID_rid);
40232 /* Write it to the card */
40233 disable_MAC(local, 1);
40234 @@ -4445,6 +4929,7 @@
40235 if(dwrq->length > 16 + 1) {
40238 + readConfigRid(local, 1);
40239 memset(local->config.nodeName, 0, sizeof(local->config.nodeName));
40240 memcpy(local->config.nodeName, extra, dwrq->length);
40241 local->need_commit = 1;
40242 @@ -4463,6 +4948,7 @@
40244 struct airo_info *local = dev->priv;
40246 + readConfigRid(local, 1);
40247 strncpy(extra, local->config.nodeName, 16);
40249 dwrq->length = strlen(extra) + 1;
40250 @@ -4519,6 +5005,7 @@
40254 + readConfigRid(local, 1);
40255 /* Now, check if we want a fixed or auto value */
40256 if(vwrq->fixed == 0) {
40257 /* Fill all the rates up to this max rate */
40258 @@ -4555,6 +5042,7 @@
40260 vwrq->value = status_rid.currentXmitRate * 500000;
40261 /* If more than one rate, set auto */
40262 + readConfigRid(local, 1);
40263 vwrq->fixed = (local->config.rates[1] == 0);
40266 @@ -4577,6 +5065,7 @@
40267 if((rthr < 0) || (rthr > 2312)) {
40270 + readConfigRid(local, 1);
40271 local->config.rtsThres = rthr;
40272 local->need_commit = 1;
40274 @@ -4594,6 +5083,7 @@
40276 struct airo_info *local = dev->priv;
40278 + readConfigRid(local, 1);
40279 vwrq->value = local->config.rtsThres;
40280 vwrq->disabled = (vwrq->value >= 2312);
40282 @@ -4619,6 +5109,7 @@
40285 fthr &= ~0x1; /* Get an even value - is it really needed ??? */
40286 + readConfigRid(local, 1);
40287 local->config.fragThresh = (u16)fthr;
40288 local->need_commit = 1;
40290 @@ -4636,6 +5127,7 @@
40292 struct airo_info *local = dev->priv;
40294 + readConfigRid(local, 1);
40295 vwrq->value = local->config.fragThresh;
40296 vwrq->disabled = (vwrq->value >= 2312);
40298 @@ -4655,6 +5147,7 @@
40299 struct airo_info *local = dev->priv;
40302 + readConfigRid(local, 1);
40303 if ((local->config.rmode & 0xff) >= RXMODE_RFMON)
40306 @@ -4714,6 +5207,7 @@
40308 struct airo_info *local = dev->priv;
40310 + readConfigRid(local, 1);
40311 /* If not managed, assume it's ad-hoc */
40312 switch (local->config.opmode & 0xFF) {
40314 @@ -4750,6 +5244,7 @@
40315 if(!(cap_rid.softCap & 2)) {
40316 return -EOPNOTSUPP;
40318 + readConfigRid(local, 1);
40320 /* Basic checking: do we have a key to set ?
40321 * Note : with the new API, it's impossible to get a NULL pointer.
40322 @@ -4836,6 +5331,7 @@
40323 if(!(cap_rid.softCap & 2)) {
40324 return -EOPNOTSUPP;
40326 + readConfigRid(local, 1);
40327 /* Check encryption mode */
40328 switch(local->config.authType) {
40330 @@ -4892,6 +5388,7 @@
40331 clear_bit (FLAG_RADIO_OFF, &local->flags);
40332 for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++)
40333 if ((vwrq->value==cap_rid.txPowerLevels[i])) {
40334 + readConfigRid(local, 1);
40335 local->config.txPower = vwrq->value;
40336 local->need_commit = 1;
40337 rc = -EINPROGRESS; /* Call commit handler */
40338 @@ -4911,6 +5408,7 @@
40340 struct airo_info *local = dev->priv;
40342 + readConfigRid(local, 1);
40343 vwrq->value = local->config.txPower;
40344 vwrq->fixed = 1; /* No power control */
40345 vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags);
40346 @@ -4934,6 +5432,7 @@
40347 if(vwrq->disabled) {
40350 + readConfigRid(local, 1);
40351 if(vwrq->flags & IW_RETRY_LIMIT) {
40352 if(vwrq->flags & IW_RETRY_MAX)
40353 local->config.longRetryLimit = vwrq->value;
40354 @@ -4968,6 +5467,7 @@
40356 vwrq->disabled = 0; /* Can't be disabled */
40358 + readConfigRid(local, 1);
40359 /* Note : by default, display the min retry number */
40360 if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
40361 vwrq->flags = IW_RETRY_LIFETIME;
40362 @@ -5106,6 +5606,7 @@
40364 struct airo_info *local = dev->priv;
40366 + readConfigRid(local, 1);
40367 if (vwrq->disabled) {
40368 if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) {
40370 @@ -5162,6 +5663,7 @@
40372 struct airo_info *local = dev->priv;
40374 + readConfigRid(local, 1);
40375 int mode = local->config.powerSaveMode;
40376 if ((vwrq->disabled = (mode == POWERSAVE_CAM)))
40378 @@ -5191,6 +5693,7 @@
40380 struct airo_info *local = dev->priv;
40382 + readConfigRid(local, 1);
40383 local->config.rssiThreshold = vwrq->disabled ? RSSI_DEFAULT : vwrq->value;
40384 local->need_commit = 1;
40386 @@ -5208,6 +5711,7 @@
40388 struct airo_info *local = dev->priv;
40390 + readConfigRid(local, 1);
40391 vwrq->value = local->config.rssiThreshold;
40392 vwrq->disabled = (vwrq->value == 0);
40394 @@ -6017,7 +6521,7 @@
40396 /* Separate R/W functions bracket legality here
40398 - if ( com.command <= AIROGMICSTATS )
40399 + if ( com.command <= AIRORRID )
40400 rc = readrids(dev,&com);
40401 else if ( com.command >= AIROPCAP && com.command <= AIROPLEAPUSR )
40402 rc = writerids(dev,&com);
40403 @@ -6107,6 +6611,7 @@
40404 static int readrids(struct net_device *dev, aironet_ioctl *comp) {
40405 unsigned short ridcode;
40406 unsigned char *iobuf;
40408 struct airo_info *ai = dev->priv;
40410 if (test_bit(FLAG_FLASHING, &ai->flags))
40411 @@ -6134,11 +6639,14 @@
40412 case AIROGSTAT: ridcode = RID_STATUS; break;
40413 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
40414 case AIROGSTATSC32: ridcode = RID_STATS; break;
40416 case AIROGMICSTATS:
40417 if (copy_to_user(comp->data, &ai->micstats,
40418 min((int)comp->len,(int)sizeof(ai->micstats))))
40422 + case AIRORRID: ridcode = comp->len; break;
40426 @@ -6152,9 +6660,12 @@
40427 * then return it to the user
40428 * 9/22/2000 Honor user given length
40430 + if (comp->command == AIRORRID)
40431 + len = le16_to_cpu(*(unsigned short *)iobuf); /* Yuck! */
40435 - if (copy_to_user(comp->data, iobuf,
40436 - min((int)comp->len, (int)RIDS_SIZE))) {
40437 + if (copy_to_user(comp->data, iobuf, min(len, (int)RIDS_SIZE))) {
40441 @@ -6222,9 +6733,11 @@
40443 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDS_SIZE, 1);
40446 enabled = ai->micstats.enabled;
40447 memset(&ai->micstats,0,sizeof(ai->micstats));
40448 ai->micstats.enabled = enabled;
40451 if (copy_to_user(comp->data, iobuf,
40452 min((int)comp->len, (int)RIDS_SIZE))) {
40453 diff -Nru a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
40454 --- a/drivers/net/wireless/airport.c Tue Aug 19 20:53:17 2003
40455 +++ b/drivers/net/wireless/airport.c Mon Aug 25 09:51:43 2003
40457 #include <linux/if_arp.h>
40458 #include <linux/etherdevice.h>
40459 #include <linux/wireless.h>
40460 -#include <linux/adb.h>
40461 -#include <linux/pmu.h>
40463 #include <asm/io.h>
40464 #include <asm/system.h>
40465 @@ -48,96 +46,115 @@
40466 int ndev_registered;
40469 -#ifdef CONFIG_PMAC_PBOOK
40470 -static int airport_sleep_notify(struct pmu_sleep_notifier *self, int when);
40471 -static struct pmu_sleep_notifier airport_sleep_notifier = {
40472 - airport_sleep_notify, SLEEP_LEVEL_NET,
40476 +airport_suspend(struct macio_dev *mdev, u32 state)
40478 + struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
40479 + struct orinoco_private *priv = dev->priv;
40480 + struct airport *card = priv->card;
40481 + unsigned long flags;
40484 + printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name);
40486 + err = orinoco_lock(priv, &flags);
40488 + printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n",
40493 + err = __orinoco_down(dev);
40495 + printk(KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n",
40499 - * Function prototypes
40501 + netif_device_detach(dev);
40503 -static struct net_device *airport_attach(struct device_node *of_node);
40504 -static void airport_detach(struct net_device *dev);
40505 + priv->hw_unavailable++;
40507 -static struct net_device *airport_dev;
40508 + orinoco_unlock(priv, &flags);
40510 + disable_irq(dev->irq);
40511 + pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
40516 -#ifdef CONFIG_PMAC_PBOOK
40518 -airport_sleep_notify(struct pmu_sleep_notifier *self, int when)
40519 +airport_resume(struct macio_dev *mdev)
40521 - struct net_device *dev = airport_dev;
40522 + struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
40523 struct orinoco_private *priv = dev->priv;
40524 struct airport *card = priv->card;
40525 unsigned long flags;
40528 - if (! airport_dev)
40529 - return PBOOK_SLEEP_OK;
40532 - case PBOOK_SLEEP_NOW:
40533 - printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name);
40535 - err = orinoco_lock(priv, &flags);
40537 - printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n",
40542 - err = __orinoco_down(dev);
40544 - printk(KERN_WARNING "%s: PBOOK_SLEEP_NOW: Error %d downing interface\n",
40546 + printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
40548 - netif_device_detach(dev);
40549 + pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 1);
40552 - priv->hw_unavailable++;
40553 + enable_irq(dev->irq);
40555 - orinoco_unlock(priv, &flags);
40556 + err = orinoco_reinit_firmware(dev);
40558 + printk(KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n",
40563 - disable_irq(dev->irq);
40564 - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
40566 + spin_lock_irqsave(&priv->lock, flags);
40569 - printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
40570 - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 1);
40572 + netif_device_attach(dev);
40574 - enable_irq(dev->irq);
40575 + priv->hw_unavailable--;
40577 - err = orinoco_reinit_firmware(dev);
40579 - printk(KERN_ERR "%s: Error %d re-initializing firmware on PBOOK_WAKE\n",
40580 + if (priv->open && (! priv->hw_unavailable)) {
40581 + err = __orinoco_up(dev);
40583 + printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
40589 - spin_lock_irqsave(&priv->lock, flags);
40591 - netif_device_attach(dev);
40592 + spin_unlock_irqrestore(&priv->lock, flags);
40594 - priv->hw_unavailable--;
40598 - if (priv->open && (! priv->hw_unavailable)) {
40599 - err = __orinoco_up(dev);
40601 - printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
40605 +airport_detach(struct macio_dev *mdev)
40607 + struct net_device *dev = dev_get_drvdata(&mdev->ofdev.dev);
40608 + struct orinoco_private *priv = dev->priv;
40609 + struct airport *card = priv->card;
40611 + if (card->ndev_registered)
40612 + unregister_netdev(dev);
40613 + card->ndev_registered = 0;
40615 - spin_unlock_irqrestore(&priv->lock, flags);
40616 + if (card->irq_requested)
40617 + free_irq(dev->irq, dev);
40618 + card->irq_requested = 0;
40622 - return PBOOK_SLEEP_OK;
40624 + iounmap(card->vaddr);
40627 + dev->base_addr = 0;
40629 + release_OF_resource(card->node, 0);
40631 + pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
40632 + current->state = TASK_UNINTERRUPTIBLE;
40633 + schedule_timeout(HZ);
40635 + dev_set_drvdata(&mdev->ofdev.dev, NULL);
40636 + free_netdev(dev);
40640 -#endif /* CONFIG_PMAC_PBOOK */
40642 static int airport_hard_reset(struct orinoco_private *priv)
40644 @@ -170,25 +187,26 @@
40648 -static struct net_device *
40649 -airport_attach(struct device_node *of_node)
40651 +airport_attach(struct macio_dev *mdev, const struct of_match *match)
40653 struct orinoco_private *priv;
40654 struct net_device *dev;
40655 struct airport *card;
40656 unsigned long phys_addr;
40657 + struct device_node *of_node = mdev->ofdev.node;
40660 if (of_node->n_addrs < 1 || of_node->n_intrs < 1) {
40661 printk(KERN_ERR "airport: wrong interrupt/addresses in OF tree\n");
40666 /* Allocate space for private device-specific data */
40667 dev = alloc_orinocodev(sizeof(*card), airport_hard_reset);
40669 printk(KERN_ERR "airport: can't allocate device datas\n");
40675 @@ -199,11 +217,14 @@
40676 if (! request_OF_resource(of_node, 0, " (airport)")) {
40677 printk(KERN_ERR "airport: can't request IO resource !\n");
40683 dev->name[0] = '\0'; /* register_netdev will give us an ethX name */
40684 SET_MODULE_OWNER(dev);
40685 + SET_NETDEV_DEV(dev, &mdev->ofdev.dev);
40687 + dev_set_drvdata(&mdev->ofdev.dev, dev);
40689 /* Setup interrupts & base address */
40690 dev->irq = of_node->intrs[0].line;
40691 @@ -240,79 +261,50 @@
40693 printk(KERN_DEBUG "airport: card registered for interface %s\n", dev->name);
40694 card->ndev_registered = 1;
40696 -#ifdef CONFIG_PMAC_PBOOK
40697 - pmu_register_sleep_notifier(&airport_sleep_notifier);
40703 - airport_detach(dev);
40705 + airport_detach(mdev);
40707 } /* airport_attach */
40709 -/*======================================================================
40710 - This deletes a driver "instance".
40711 - ======================================================================*/
40714 -airport_detach(struct net_device *dev)
40716 - struct orinoco_private *priv = dev->priv;
40717 - struct airport *card = priv->card;
40719 -#ifdef CONFIG_PMAC_PBOOK
40720 - pmu_unregister_sleep_notifier(&airport_sleep_notifier);
40722 - if (card->ndev_registered)
40723 - unregister_netdev(dev);
40724 - card->ndev_registered = 0;
40726 - if (card->irq_requested)
40727 - free_irq(dev->irq, dev);
40728 - card->irq_requested = 0;
40731 - iounmap(card->vaddr);
40734 - dev->base_addr = 0;
40736 - release_OF_resource(card->node, 0);
40738 - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, card->node, 0, 0);
40739 - current->state = TASK_UNINTERRUPTIBLE;
40740 - schedule_timeout(HZ);
40742 - free_netdev(dev);
40743 -} /* airport_detach */
40745 static char version[] __initdata = "airport.c 0.13e (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
40746 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
40747 MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
40748 MODULE_LICENSE("Dual MPL/GPL");
40750 +static struct of_match airport_match[] =
40754 + .type = OF_ANY_MATCH,
40755 + .compatible = OF_ANY_MATCH
40760 +static struct macio_driver airport_driver =
40762 + .name = "airport",
40763 + .match_table = airport_match,
40764 + .probe = airport_attach,
40765 + .remove = airport_detach,
40766 + .suspend = airport_suspend,
40767 + .resume = airport_resume,
40773 - struct device_node *airport_node;
40775 printk(KERN_DEBUG "%s\n", version);
40777 - /* Lookup card in device tree */
40778 - airport_node = find_devices("radio");
40779 - if (airport_node && !strcmp(airport_node->parent->name, "mac-io"))
40780 - airport_dev = airport_attach(airport_node);
40782 - return airport_dev ? 0 : -ENODEV;
40783 + return macio_register_driver(&airport_driver);
40790 - airport_detach(airport_dev);
40791 - airport_dev = NULL;
40792 + return macio_unregister_driver(&airport_driver);
40795 module_init(init_airport);
40796 diff -Nru a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
40797 --- a/drivers/net/wireless/ray_cs.c Thu Aug 7 09:17:57 2003
40798 +++ b/drivers/net/wireless/ray_cs.c Tue Aug 26 14:55:20 2003
40799 @@ -105,6 +105,9 @@
40800 static struct net_device_stats *ray_get_stats(struct net_device *dev);
40801 static int ray_dev_init(struct net_device *dev);
40802 static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
40804 +static struct ethtool_ops netdev_ethtool_ops;
40806 static int ray_open(struct net_device *dev);
40807 static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev);
40808 static void set_multicast_list(struct net_device *dev);
40809 @@ -408,6 +411,7 @@
40810 dev->set_config = &ray_dev_config;
40811 dev->get_stats = &ray_get_stats;
40812 dev->do_ioctl = &ray_dev_ioctl;
40813 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
40814 #if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */
40815 dev->get_wireless_stats = ray_get_wireless_stats;
40817 @@ -1226,26 +1230,16 @@
40819 /*===========================================================================*/
40821 -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
40822 +static void netdev_get_drvinfo(struct net_device *dev,
40823 + struct ethtool_drvinfo *info)
40827 - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
40830 - switch (ethcmd) {
40831 - case ETHTOOL_GDRVINFO: {
40832 - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
40833 - strncpy(info.driver, "ray_cs", sizeof(info.driver)-1);
40834 - if (copy_to_user(useraddr, &info, sizeof(info)))
40840 - return -EOPNOTSUPP;
40841 + strcpy(info->driver, "ray_cs");
40844 +static struct ethtool_ops netdev_ethtool_ops = {
40845 + .get_drvinfo = netdev_get_drvinfo,
40848 /*====================================================================*/
40850 static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
40851 @@ -1265,10 +1259,6 @@
40852 /* Validate the command */
40855 - case SIOCETHTOOL:
40856 - err = netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
40859 #if WIRELESS_EXT > 7
40860 /* --------------- WIRELESS EXTENSIONS --------------- */
40862 diff -Nru a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
40863 --- a/drivers/net/yellowfin.c Tue Aug 19 20:53:17 2003
40864 +++ b/drivers/net/yellowfin.c Sun Aug 31 06:34:16 2003
40865 @@ -873,8 +873,6 @@
40866 /* Calculate the next Tx descriptor entry. */
40867 entry = yp->cur_tx % TX_RING_SIZE;
40869 - yp->tx_skbuff[entry] = skb;
40871 if (gx_fix) { /* Note: only works for paddable protocols e.g. IP. */
40872 int cacheline_end = ((unsigned long)skb->data + skb->len) % 32;
40873 /* Fix GX chipset errata. */
40874 @@ -889,6 +887,8 @@
40878 + yp->tx_skbuff[entry] = skb;
40881 yp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
40882 skb->data, len, PCI_DMA_TODEVICE));
40883 diff -Nru a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
40884 --- a/drivers/parport/parport_pc.c Thu Jul 31 08:59:04 2003
40885 +++ b/drivers/parport/parport_pc.c Sun Aug 31 16:14:16 2003
40888 } superios[NR_SUPERIOS] __devinitdata = { {0,},};
40890 -static int user_specified __devinitdata = 0;
40891 +static int user_specified;
40892 #if defined(CONFIG_PARPORT_PC_SUPERIO) || \
40893 (defined(CONFIG_PARPORT_1284) && defined(CONFIG_PARPORT_PC_FIFO))
40894 static int verbose_probing;
40895 diff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
40896 --- a/drivers/pci/pci.ids Wed Aug 6 12:32:59 2003
40897 +++ b/drivers/pci/pci.ids Thu Aug 28 00:24:56 2003
40898 @@ -3247,7 +3247,8 @@
40899 1148 5061 SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter
40900 1148 5071 SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter
40901 1148 9521 SK-9521 10/100/1000Base-T Adapter
40902 - 4400 Gigabit Ethernet
40903 + 4400 SK-9Dxx Gigabit Ethernet Adapter
40904 + 4500 SK-9Mxx Gigabit Ethernet Adapter
40905 1149 Win System Corporation
40907 5579 VMIPCI-5579 (Reflective Memory Card)
40908 @@ -5313,9 +5314,12 @@
40909 1166 1648 NetXtreme CIOB-E 1000Base-T
40910 164d NetXtreme BCM5702FE Gigabit Ethernet
40911 1653 NetXtreme BCM5705 Gigabit Ethernet
40912 + 1654 NetXtreme BCM5705 Gigabit Ethernet
40913 165d NetXtreme BCM5705M Gigabit Ethernet
40914 + 165e NetXtreme BCM5705M Gigabit Ethernet
40915 1696 NetXtreme BCM5782 Gigabit Ethernet
40916 14e4 000d NetXtreme BCM5782 1000Base-T
40917 + 169c NetXtreme BCM5788 Gigabit Ethernet
40918 16a6 NetXtreme BCM5702 Gigabit Ethernet
40919 0e11 00bb NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
40920 1028 0126 BCM5702 1000Base-T
40921 @@ -5337,6 +5341,8 @@
40922 16c7 NetXtreme BCM5703 Gigabit Ethernet
40923 14e4 0009 NetXtreme BCM5703 1000Base-T
40924 14e4 000a NetXtreme BCM5703 1000Base-SX
40925 + 170d NetXtreme BCM5901 Gigabit Ethernet
40926 + 170e NetXtreme BCM5901 Gigabit Ethernet
40927 4210 BCM4210 iLine10 HomePNA 2.0
40928 4211 BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem
40929 4212 BCM4212 v.90 56k modem
40930 @@ -5877,6 +5883,8 @@
40931 03e8 AC1000 Gigabit Ethernet
40932 03e9 AC1001 Gigabit Ethernet
40933 03ea AC9100 Gigabit Ethernet
40935 + 03eb AC1003 Gigabit Ethernet
40937 8139 ROL/F-100 Fast Ethernet Adapter with ROL
40938 174b PC Partner Limited
40939 diff -Nru a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
40940 --- a/drivers/pcmcia/cistpl.c Sun Jul 6 16:03:10 2003
40941 +++ b/drivers/pcmcia/cistpl.c Wed Aug 27 13:25:31 2003
40942 @@ -293,15 +293,17 @@
40944 ret = read_cis_mem(s, attr, addr, len, ptr);
40946 - /* Copy data into the cache */
40947 - cis = kmalloc(sizeof(struct cis_cache_entry) + len, GFP_KERNEL);
40949 - cis->addr = addr;
40951 - cis->attr = attr;
40952 - memcpy(cis->cache, ptr, len);
40953 - list_add(&cis->node, &s->cis_cache);
40956 + /* Copy data into the cache */
40957 + cis = kmalloc(sizeof(struct cis_cache_entry) + len, GFP_KERNEL);
40959 + cis->addr = addr;
40961 + cis->attr = attr;
40962 + memcpy(cis->cache, ptr, len);
40963 + list_add(&cis->node, &s->cis_cache);
40969 diff -Nru a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
40970 --- a/drivers/pcmcia/ds.c Mon Jun 16 13:20:14 2003
40971 +++ b/drivers/pcmcia/ds.c Tue Aug 26 09:25:41 2003
40972 @@ -495,7 +495,7 @@
40974 static int ds_open(struct inode *inode, struct file *file)
40976 - socket_t i = minor(inode->i_rdev);
40977 + socket_t i = iminor(inode);
40978 struct pcmcia_bus_socket *s;
40981 @@ -529,7 +529,7 @@
40983 static int ds_release(struct inode *inode, struct file *file)
40985 - socket_t i = minor(inode->i_rdev);
40986 + socket_t i = iminor(inode);
40987 struct pcmcia_bus_socket *s;
40988 user_info_t *user, **link;
40990 @@ -563,7 +563,7 @@
40991 static ssize_t ds_read(struct file *file, char *buf,
40992 size_t count, loff_t *ppos)
40994 - socket_t i = minor(file->f_dentry->d_inode->i_rdev);
40995 + socket_t i = iminor(file->f_dentry->d_inode);
40996 struct pcmcia_bus_socket *s;
40999 @@ -594,7 +594,7 @@
41000 static ssize_t ds_write(struct file *file, const char *buf,
41001 size_t count, loff_t *ppos)
41003 - socket_t i = minor(file->f_dentry->d_inode->i_rdev);
41004 + socket_t i = iminor(file->f_dentry->d_inode);
41005 struct pcmcia_bus_socket *s;
41008 @@ -629,7 +629,7 @@
41009 /* No kernel lock - fine */
41010 static u_int ds_poll(struct file *file, poll_table *wait)
41012 - socket_t i = minor(file->f_dentry->d_inode->i_rdev);
41013 + socket_t i = iminor(file->f_dentry->d_inode);
41014 struct pcmcia_bus_socket *s;
41017 @@ -653,7 +653,7 @@
41018 static int ds_ioctl(struct inode * inode, struct file * file,
41019 u_int cmd, u_long arg)
41021 - socket_t i = minor(inode->i_rdev);
41022 + socket_t i = iminor(inode);
41023 struct pcmcia_bus_socket *s;
41026 diff -Nru a/drivers/pcmcia/ricoh.h b/drivers/pcmcia/ricoh.h
41027 --- a/drivers/pcmcia/ricoh.h Mon Jul 14 07:42:47 2003
41028 +++ b/drivers/pcmcia/ricoh.h Wed Aug 27 12:42:52 2003
41029 @@ -142,59 +142,61 @@
41030 config_writeb(socket, RL5C4XX_MISC_CONTROL, reg);
41033 -static void ricoh_set_zv(struct pcmcia_socket *sock)
41034 +static void ricoh_set_zv(struct yenta_socket *socket)
41036 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41037 if(socket->dev->vendor == PCI_VENDOR_ID_RICOH)
41039 switch(socket->dev->device)
41041 /* There may be more .. */
41042 case PCI_DEVICE_ID_RICOH_RL5C478:
41043 - sock->zoom_video = ricoh_zoom_video;
41044 + socket->socket.zoom_video = ricoh_zoom_video;
41050 -static int ricoh_init(struct pcmcia_socket *sock)
41051 +static void ricoh_save_state(struct yenta_socket *socket)
41053 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41054 - yenta_init(sock);
41055 - ricoh_set_zv(sock);
41056 + rl_misc(socket) = config_readw(socket, RL5C4XX_MISC);
41057 + rl_ctl(socket) = config_readw(socket, RL5C4XX_16BIT_CTL);
41058 + rl_io(socket) = config_readw(socket, RL5C4XX_16BIT_IO_0);
41059 + rl_mem(socket) = config_readw(socket, RL5C4XX_16BIT_MEM_0);
41060 + rl_config(socket) = config_readw(socket, RL5C4XX_CONFIG);
41063 +static void ricoh_restore_state(struct yenta_socket *socket)
41065 config_writew(socket, RL5C4XX_MISC, rl_misc(socket));
41066 config_writew(socket, RL5C4XX_16BIT_CTL, rl_ctl(socket));
41067 config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket));
41068 config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket));
41069 config_writew(socket, RL5C4XX_CONFIG, rl_config(socket));
41076 - * Magic Ricoh initialization code.. Save state at
41077 - * beginning, re-initialize it after suspend.
41078 + * Magic Ricoh initialization code..
41080 static int ricoh_override(struct yenta_socket *socket)
41082 - rl_misc(socket) = config_readw(socket, RL5C4XX_MISC);
41083 - rl_ctl(socket) = config_readw(socket, RL5C4XX_16BIT_CTL);
41084 - rl_io(socket) = config_readw(socket, RL5C4XX_16BIT_IO_0);
41085 - rl_mem(socket) = config_readw(socket, RL5C4XX_16BIT_MEM_0);
41086 - rl_config(socket) = config_readw(socket, RL5C4XX_CONFIG);
41089 + config = config_readw(socket, RL5C4XX_CONFIG);
41091 /* Set the default timings, don't trust the original values */
41092 - rl_ctl(socket) = RL5C4XX_16CTL_IO_TIMING | RL5C4XX_16CTL_MEM_TIMING;
41093 + ctl = RL5C4XX_16CTL_IO_TIMING | RL5C4XX_16CTL_MEM_TIMING;
41095 if(socket->dev->device < PCI_DEVICE_ID_RICOH_RL5C475) {
41096 - rl_ctl(socket) |= RL5C46X_16CTL_LEVEL_1 | RL5C46X_16CTL_LEVEL_2;
41097 + ctl |= RL5C46X_16CTL_LEVEL_1 | RL5C46X_16CTL_LEVEL_2;
41099 - rl_config(socket) |= RL5C4XX_CONFIG_PREFETCH;
41100 + config |= RL5C4XX_CONFIG_PREFETCH;
41103 - socket->socket.ops->init = ricoh_init;
41104 + config_writew(socket, RL5C4XX_16BIT_CTL, ctl);
41105 + config_writew(socket, RL5C4XX_CONFIG, config);
41107 + ricoh_set_zv(socket);
41111 diff -Nru a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
41112 --- a/drivers/pcmcia/sa1111_generic.c Sun Jun 15 04:35:08 2003
41113 +++ b/drivers/pcmcia/sa1111_generic.c Sun Aug 24 07:45:05 2003
41116 #include <asm/hardware.h>
41117 #include <asm/hardware/sa1111.h>
41118 +#include <asm/io.h>
41119 #include <asm/irq.h>
41121 #include "sa1111_generic.h"
41122 @@ -118,16 +119,15 @@
41123 sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
41126 -static int pcmcia_probe(struct device *dev)
41127 +static int pcmcia_probe(struct sa1111_dev *dev)
41129 - struct sa1111_dev *sadev = SA1111_DEV(dev);
41132 - if (!request_mem_region(sadev->res.start, 512,
41133 - SA1111_DRIVER_NAME(sadev)))
41134 + if (!request_mem_region(dev->res.start, 512,
41135 + SA1111_DRIVER_NAME(dev)))
41138 - base = sadev->mapbase;
41139 + base = dev->mapbase;
41142 * Initialise the suspend state.
41143 @@ -136,61 +136,68 @@
41144 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + SA1111_PCCR);
41146 #ifdef CONFIG_SA1100_ADSBITSY
41147 - pcmcia_adsbitsy_init(dev);
41148 + pcmcia_adsbitsy_init(&dev->dev);
41150 #ifdef CONFIG_SA1100_BADGE4
41151 - pcmcia_badge4_init(dev);
41152 + pcmcia_badge4_init(&dev->dev);
41154 #ifdef CONFIG_SA1100_GRAPHICSMASTER
41155 - pcmcia_graphicsmaster_init(dev);
41156 + pcmcia_graphicsmaster_init(&dev->dev);
41158 #ifdef CONFIG_SA1100_JORNADA720
41159 - pcmcia_jornada720_init(dev);
41160 + pcmcia_jornada720_init(&dev->dev);
41162 #ifdef CONFIG_ASSABET_NEPONSET
41163 - pcmcia_neponset_init(dev);
41164 + pcmcia_neponset_init(&dev->dev);
41166 #ifdef CONFIG_SA1100_PFS168
41167 - pcmcia_pfs_init(dev);
41168 + pcmcia_pfs_init(&dev->dev);
41170 #ifdef CONFIG_SA1100_PT_SYSTEM3
41171 - pcmcia_system3_init(dev);
41172 + pcmcia_system3_init(&dev->dev);
41174 #ifdef CONFIG_SA1100_XP860
41175 - pcmcia_xp860_init(dev);
41176 + pcmcia_xp860_init(&dev->dev);
41181 -static int __devexit pcmcia_remove(struct device *dev)
41182 +static int __devexit pcmcia_remove(struct sa1111_dev *dev)
41184 - struct sa1111_dev *sadev = SA1111_DEV(dev);
41186 - sa11xx_drv_pcmcia_remove(dev);
41187 - release_mem_region(sadev->res.start, 512);
41188 + sa11xx_drv_pcmcia_remove(&dev->dev);
41189 + release_mem_region(dev->res.start, 512);
41193 +static int pcmcia_suspend(struct sa1111_dev *dev, u32 state)
41195 + return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
41198 +static int pcmcia_resume(struct sa1111_dev *dev)
41200 + return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
41203 static struct sa1111_driver pcmcia_driver = {
41205 - .name = "sa1111-pcmcia",
41206 - .bus = &sa1111_bus_type,
41207 - .probe = pcmcia_probe,
41208 - .remove = __devexit_p(pcmcia_remove),
41209 - .suspend = pcmcia_socket_dev_suspend,
41210 - .resume = pcmcia_socket_dev_resume,
41211 + .name = "sa1111-pcmcia",
41213 - .devid = SA1111_DEVID_PCMCIA,
41214 + .devid = SA1111_DEVID_PCMCIA,
41215 + .probe = pcmcia_probe,
41216 + .remove = __devexit_p(pcmcia_remove),
41217 + .suspend = pcmcia_suspend,
41218 + .resume = pcmcia_resume,
41221 static int __init sa1111_drv_pcmcia_init(void)
41223 - return driver_register(&pcmcia_driver.drv);
41224 + return sa1111_driver_register(&pcmcia_driver);
41227 static void __exit sa1111_drv_pcmcia_exit(void)
41229 - driver_unregister(&pcmcia_driver.drv);
41230 + sa1111_driver_unregister(&pcmcia_driver);
41233 module_init(sa1111_drv_pcmcia_init);
41234 diff -Nru a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
41235 --- a/drivers/pcmcia/ti113x.h Wed Aug 6 15:59:05 2003
41236 +++ b/drivers/pcmcia/ti113x.h Wed Aug 27 12:58:54 2003
41237 @@ -136,16 +136,34 @@
41239 #ifdef CONFIG_CARDBUS
41241 -static int ti_intctl(struct yenta_socket *socket)
41243 + * Texas Instruments CardBus controller overrides.
41245 +#define ti_sysctl(socket) ((socket)->private[0])
41246 +#define ti_cardctl(socket) ((socket)->private[1])
41247 +#define ti_devctl(socket) ((socket)->private[2])
41248 +#define ti_diag(socket) ((socket)->private[3])
41249 +#define ti_irqmux(socket) ((socket)->private[4])
41252 + * These are the TI specific power management handlers.
41254 +static void ti_save_state(struct yenta_socket *socket)
41256 - u8 new, reg = exca_readb(socket, I365_INTCTL);
41257 + ti_sysctl(socket) = config_readl(socket, TI113X_SYSTEM_CONTROL);
41258 + ti_irqmux(socket) = config_readl(socket, TI122X_IRQMUX);
41259 + ti_cardctl(socket) = config_readb(socket, TI113X_CARD_CONTROL);
41260 + ti_devctl(socket) = config_readb(socket, TI113X_DEVICE_CONTROL);
41261 + ti_diag(socket) = config_readb(socket, TI1250_DIAGNOSTIC);
41264 - new = reg & ~I365_INTR_ENA;
41265 - if (socket->cb_irq)
41266 - new |= I365_INTR_ENA;
41268 - exca_writeb(socket, I365_INTCTL, new);
41270 +static void ti_restore_state(struct yenta_socket *socket)
41272 + config_writel(socket, TI113X_SYSTEM_CONTROL, ti_sysctl(socket));
41273 + config_writel(socket, TI122X_IRQMUX, ti_irqmux(socket));
41274 + config_writeb(socket, TI113X_CARD_CONTROL, ti_cardctl(socket));
41275 + config_writeb(socket, TI113X_DEVICE_CONTROL, ti_devctl(socket));
41276 + config_writeb(socket, TI1250_DIAGNOSTIC, ti_diag(socket));
41280 @@ -185,8 +203,8 @@
41282 ti_zoom_video(sock, onoff);
41284 - reg = config_readb(socket, 0x84);
41285 - reg |= (1<<7); /* ZV bus enable */
41286 + reg = config_readb(socket, TI1250_MULTIMEDIA_CTL);
41287 + reg |= TI1250_MMC_ZVOUTEN; /* ZV bus enable */
41289 if(PCI_FUNC(socket->dev->devfn)==1)
41291 @@ -204,12 +222,11 @@
41292 reg &= ~(1<<shift); /* Socket zoon video off */
41295 - config_writeb(socket, 0x84, reg);
41296 + config_writeb(socket, TI1250_MULTIMEDIA_CTL, reg);
41299 -static void ti_set_zv(struct pcmcia_socket *sock)
41300 +static void ti_set_zv(struct yenta_socket *socket)
41302 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41303 if(socket->dev->vendor == PCI_VENDOR_ID_TI)
41305 switch(socket->dev->device)
41306 @@ -218,24 +235,16 @@
41307 case PCI_DEVICE_ID_TI_1220:
41308 case PCI_DEVICE_ID_TI_1221:
41309 case PCI_DEVICE_ID_TI_1225:
41310 - sock->zoom_video = ti_zoom_video;
41311 + socket->socket.zoom_video = ti_zoom_video;
41313 case PCI_DEVICE_ID_TI_1250:
41314 case PCI_DEVICE_ID_TI_1251A:
41315 case PCI_DEVICE_ID_TI_1251B:
41316 case PCI_DEVICE_ID_TI_1450:
41317 - sock->zoom_video = ti1250_zoom_video;
41318 + socket->socket.zoom_video = ti1250_zoom_video;
41322 -static int ti_init(struct pcmcia_socket *sock)
41324 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41325 - yenta_init(sock);
41327 - ti_intctl(socket);
41333 @@ -250,6 +259,18 @@
41334 * This makes us correctly get PCI CSC interrupt
41337 +static int ti_init(struct yenta_socket *socket)
41339 + u8 new, reg = exca_readb(socket, I365_INTCTL);
41341 + new = reg & ~I365_INTR_ENA;
41342 + if (socket->cb_irq)
41343 + new |= I365_INTR_ENA;
41345 + exca_writeb(socket, I365_INTCTL, new);
41349 static int ti_override(struct yenta_socket *socket)
41351 u8 new, reg = exca_readb(socket, I365_INTCTL);
41352 @@ -258,6 +279,8 @@
41354 exca_writeb(socket, I365_INTCTL, new);
41356 + ti_set_zv(socket);
41360 * If ISA interrupts don't work, then fall back to routing card
41361 @@ -285,83 +308,85 @@
41365 - socket->socket.ops->init = ti_init;
41369 -#define ti_sysctl(socket) ((socket)->private[0])
41370 -#define ti_cardctl(socket) ((socket)->private[1])
41371 -#define ti_devctl(socket) ((socket)->private[2])
41372 -#define ti_diag(socket) ((socket)->private[3])
41373 -#define ti_irqmux(socket) ((socket)->private[4])
41376 -static int ti113x_init(struct pcmcia_socket *sock)
41378 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41379 - yenta_init(sock);
41382 - config_writel(socket, TI113X_SYSTEM_CONTROL, ti_sysctl(socket));
41383 - config_writeb(socket, TI113X_CARD_CONTROL, ti_cardctl(socket));
41384 - config_writeb(socket, TI113X_DEVICE_CONTROL, ti_devctl(socket));
41385 - ti_intctl(socket);
41389 static int ti113x_override(struct yenta_socket *socket)
41391 - ti_sysctl(socket) = config_readl(socket, TI113X_SYSTEM_CONTROL);
41392 - ti_cardctl(socket) = config_readb(socket, TI113X_CARD_CONTROL);
41393 - ti_devctl(socket) = config_readb(socket, TI113X_DEVICE_CONTROL);
41396 - ti_cardctl(socket) &= ~(TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_IREQ | TI113X_CCR_PCI_CSC);
41397 + cardctl = config_readb(socket, TI113X_CARD_CONTROL);
41398 + cardctl &= ~(TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_IREQ | TI113X_CCR_PCI_CSC);
41399 if (socket->cb_irq)
41400 - ti_cardctl(socket) |= TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_CSC | TI113X_CCR_PCI_IREQ;
41401 - ti_override(socket);
41402 - socket->socket.ops->init = ti113x_init;
41404 + cardctl |= TI113X_CCR_PCI_IRQ_ENA | TI113X_CCR_PCI_CSC | TI113X_CCR_PCI_IREQ;
41405 + config_writeb(socket, TI113X_CARD_CONTROL, cardctl);
41407 + return ti_override(socket);
41411 -static int ti1250_init(struct pcmcia_socket *sock)
41412 +static int ti12xx_override(struct yenta_socket *socket)
41414 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41415 - ti113x_init(sock);
41416 - ti_irqmux(socket) = config_readl(socket, TI122X_IRQMUX);
41418 - ti_irqmux(socket) = (ti_irqmux(socket) & ~0x0f) | 0x02; /* route INTA */
41419 - if (!(ti_sysctl(socket) & TI122X_SCR_INTRTIE))
41420 - ti_irqmux(socket) |= 0x20; /* route INTB */
41423 - config_writel(socket, TI122X_IRQMUX, ti_irqmux(socket));
41425 - config_writeb(socket, TI1250_DIAGNOSTIC, ti_diag(socket));
41429 + /* make sure that memory burst is active */
41430 + val = config_readl(socket, TI113X_SYSTEM_CONTROL);
41431 + if (!(val & TI122X_SCR_MRBURSTUP)) {
41432 + printk(KERN_INFO "Yenta: Enabling burst memory read transactions\n");
41433 + val |= TI122X_SCR_MRBURSTUP;
41434 + config_writel(socket, TI113X_SYSTEM_CONTROL, val);
41438 + * Yenta expects controllers to use CSCINT to route
41439 + * CSC interrupts to PCI rather than INTVAL.
41441 + val = config_readb(socket, TI1250_DIAGNOSTIC);
41442 + printk(KERN_INFO "Yenta: Using %s to route CSC interrupts to PCI\n",
41443 + (val & TI1250_DIAG_PCI_CSC) ? "CSCINT" : "INTVAL");
41444 + printk(KERN_INFO "Yenta: Routing CardBus interrupts to %s\n",
41445 + (val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA");
41447 + return ti_override(socket);
41451 static int ti1250_override(struct yenta_socket *socket)
41453 - ti_diag(socket) = config_readb(socket, TI1250_DIAGNOSTIC);
41456 - ti_diag(socket) &= ~(TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ);
41457 + old = config_readb(socket, TI1250_DIAGNOSTIC);
41458 + diag = old & ~(TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ);
41459 if (socket->cb_irq)
41460 - ti_diag(socket) |= TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ;
41461 - ti113x_override(socket);
41462 - socket->socket.ops->init = ti1250_init;
41465 + diag |= TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ;
41467 + if (diag != old) {
41468 + printk(KERN_INFO "Yenta: adjusting diagnostic: %02x -> %02x\n",
41470 + config_writeb(socket, TI1250_DIAGNOSTIC, diag);
41473 -static int ti12xx_override(struct yenta_socket *socket)
41475 - /* make sure that memory burst is active */
41476 - ti_sysctl(socket) = config_readl(socket, TI113X_SYSTEM_CONTROL);
41477 - ti_sysctl(socket) |= TI122X_SCR_MRBURSTUP;
41478 - config_writel(socket, TI113X_SYSTEM_CONTROL, ti_sysctl(socket));
41481 + * This is highly machine specific, and we should NOT touch
41482 + * this register - we have no knowledge how the hardware
41483 + * is actually wired.
41485 + * If we're going to do this, we should probably look into
41486 + * using the subsystem IDs.
41488 + * On ThinkPad 380XD, this changes MFUNC0 from the ISA IRQ3
41489 + * output (which it is) to IRQ2. We also change MFUNC1
41490 + * from ISA IRQ4 to IRQ6.
41492 + irqmux = config_readl(socket, TI122X_IRQMUX);
41493 + irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
41494 + if (!(ti_sysctl(socket) & TI122X_SCR_INTRTIE))
41495 + irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
41496 + config_writel(socket, TI122X_IRQMUX, irqmux);
41499 - return ti113x_override(socket);
41500 + return ti12xx_override(socket);
41503 #endif /* CONFIG_CARDBUS */
41504 diff -Nru a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h
41505 --- a/drivers/pcmcia/topic.h Fri Oct 18 16:11:25 2002
41506 +++ b/drivers/pcmcia/topic.h Wed Aug 27 13:19:32 2003
41508 #ifndef _LINUX_TOPIC_H
41509 #define _LINUX_TOPIC_H
41511 -#ifndef PCI_VENDOR_ID_TOSHIBA
41512 -#define PCI_VENDOR_ID_TOSHIBA 0x1179
41514 -#ifndef PCI_DEVICE_ID_TOSHIBA_TOPIC95_A
41515 -#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_A 0x0603
41517 -#ifndef PCI_DEVICE_ID_TOSHIBA_TOPIC95_B
41518 -#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_B 0x060a
41520 -#ifndef PCI_DEVICE_ID_TOSHIBA_TOPIC97
41521 -#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f
41524 -/* Register definitions for Toshiba ToPIC95 controllers */
41525 +/* Register definitions for Toshiba ToPIC95/97/100 controllers */
41527 #define TOPIC_SOCKET_CONTROL 0x0090 /* 32 bit */
41528 #define TOPIC_SCR_IRQSEL 0x00000001
41530 #define TOPIC97_RCR_RI_DISABLE 0x00000004
41531 #define TOPIC97_RCR_CAUDIO_OFF 0x00000002
41532 #define TOPIC_RCR_CAUDIO_INVERT 0x00000001
41534 +#define TOPIC97_MISC1 0x00ad /* 8bit */
41535 +#define TOPIC97_MISC1_CLOCKRUN_ENABLE 0x80
41536 +#define TOPIC97_MISC1_CLOCKRUN_MODE 0x40
41537 +#define TOPIC97_MISC1_DETECT_REQ_ENA 0x10
41538 +#define TOPIC97_MISC1_SCK_CLEAR_DIS 0x04
41539 +#define TOPIC97_MISC1_R2_LOW_ENABLE 0x10
41541 +#define TOPIC97_MISC2 0x00ae /* 8 bit */
41542 +#define TOPIC97_MISC2_SPWRCLK_MASK 0x70
41543 +#define TOPIC97_MISC2_SPWRMOD 0x08
41544 +#define TOPIC97_MISC2_SPWR_ENABLE 0x04
41545 +#define TOPIC97_MISC2_ZV_MODE 0x02
41546 +#define TOPIC97_MISC2_ZV_ENABLE 0x01
41548 +#define TOPIC97_ZOOM_VIDEO_CONTROL 0x009c /* 8 bit */
41549 +#define TOPIC97_ZV_CONTROL_ENABLE 0x01
41551 +#define TOPIC97_AUDIO_VIDEO_SWITCH 0x003c /* 8 bit */
41552 +#define TOPIC97_AVS_AUDIO_CONTROL 0x02
41553 +#define TOPIC97_AVS_VIDEO_CONTROL 0x01
41556 +static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff)
41558 + struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41561 + reg_zv = config_readb(socket, TOPIC97_ZOOM_VIDEO_CONTROL);
41563 + reg_zv |= TOPIC97_ZV_CONTROL_ENABLE;
41564 + config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv);
41566 + reg = config_readb(socket, TOPIC97_MISC2);
41567 + reg |= TOPIC97_MISC2_ZV_ENABLE;
41568 + config_writeb(socket, TOPIC97_MISC2, reg);
41570 + /* not sure this is needed, doc is unclear */
41572 + reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH);
41573 + reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL;
41574 + config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg);
41578 + reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE;
41579 + config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv);
41584 +static int topic97_override(struct yenta_socket *socket)
41586 + /* ToPIC97/100 support ZV */
41587 + socket->socket.zoom_video = topic97_zoom_video;
41591 #endif /* _LINUX_TOPIC_H */
41592 diff -Nru a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
41593 --- a/drivers/pcmcia/yenta_socket.c Thu Aug 14 16:53:49 2003
41594 +++ b/drivers/pcmcia/yenta_socket.c Wed Aug 27 13:19:32 2003
41595 @@ -443,73 +443,6 @@
41596 add_timer(&socket->poll_timer);
41600 - * Only probe "regular" interrupts, don't
41601 - * touch dangerous spots like the mouse irq,
41602 - * because there are mice that apparently
41603 - * get really confused if they get fondled
41604 - * too intimately.
41606 - * Default to 11, 10, 9, 7, 6, 5, 4, 3.
41608 -static u32 isa_interrupts = 0x0ef8;
41610 -static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask)
41613 - unsigned long val;
41617 - /* Set up ISA irq routing to probe the ISA irqs.. */
41618 - bridge_ctrl = config_readw(socket, CB_BRIDGE_CONTROL);
41619 - if (!(bridge_ctrl & CB_BRIDGE_INTR)) {
41620 - bridge_ctrl |= CB_BRIDGE_INTR;
41621 - config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl);
41625 - * Probe for usable interrupts using the force
41626 - * register to generate bogus card status events.
41628 - cb_writel(socket, CB_SOCKET_EVENT, -1);
41629 - cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
41630 - exca_writeb(socket, I365_CSCINT, 0);
41631 - val = probe_irq_on() & isa_irq_mask;
41632 - for (i = 1; i < 16; i++) {
41633 - if (!((val >> i) & 1))
41635 - exca_writeb(socket, I365_CSCINT, I365_CSC_STSCHG | (i << 4));
41636 - cb_writel(socket, CB_SOCKET_FORCE, CB_FCARDSTS);
41638 - cb_writel(socket, CB_SOCKET_EVENT, -1);
41640 - cb_writel(socket, CB_SOCKET_MASK, 0);
41641 - exca_writeb(socket, I365_CSCINT, 0);
41643 - mask = probe_irq_mask(val) & 0xffff;
41645 - bridge_ctrl &= ~CB_BRIDGE_INTR;
41646 - config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl);
41652 - * Set static data that doesn't need re-initializing..
41654 -static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
41656 - socket->socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
41657 - socket->socket.map_size = 0x1000;
41658 - socket->socket.pci_irq = socket->cb_irq;
41659 - socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
41660 - socket->socket.cb_dev = socket->dev;
41662 - printk("Yenta IRQ list %04x, PCI irq%d\n", socket->socket.irq_mask, socket->cb_irq);
41666 static void yenta_clear_maps(struct yenta_socket *socket)
41669 @@ -528,42 +461,13 @@
41674 - * Initialize the standard cardbus registers
41676 -static void yenta_config_init(struct yenta_socket *socket)
41677 +/* Called at resume and initialization events */
41678 +static int yenta_sock_init(struct pcmcia_socket *sock)
41680 + struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41682 - struct pci_dev *dev = socket->dev;
41684 - pci_set_power_state(socket->dev, 0);
41686 - config_writel(socket, CB_LEGACY_MODE_BASE, 0);
41687 - config_writel(socket, PCI_BASE_ADDRESS_0, dev->resource[0].start);
41688 - config_writew(socket, PCI_COMMAND,
41690 - PCI_COMMAND_MEMORY |
41691 - PCI_COMMAND_MASTER |
41692 - PCI_COMMAND_WAIT);
41694 - /* MAGIC NUMBERS! Fixme */
41695 - config_writeb(socket, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);
41696 - config_writeb(socket, PCI_LATENCY_TIMER, 168);
41697 - config_writel(socket, PCI_PRIMARY_BUS,
41698 - (176 << 24) | /* sec. latency timer */
41699 - (dev->subordinate->subordinate << 16) | /* subordinate bus */
41700 - (dev->subordinate->secondary << 8) | /* secondary bus */
41701 - dev->subordinate->primary); /* primary bus */
41704 - * Set up the bridging state:
41705 - * - enable write posting.
41706 - * - memory window 0 prefetchable, window 1 non-prefetchable
41707 - * - PCI interrupts enabled if a PCI interrupt exists..
41709 - bridge = config_readw(socket, CB_BRIDGE_CONTROL);
41710 - bridge &= ~(CB_BRIDGE_CRST | CB_BRIDGE_PREFETCH1 | CB_BRIDGE_INTR | CB_BRIDGE_ISAEN | CB_BRIDGE_VGAEN);
41711 - bridge |= CB_BRIDGE_PREFETCH0 | CB_BRIDGE_POSTEN;
41712 + bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~CB_BRIDGE_INTR;
41713 if (!socket->cb_irq)
41714 bridge |= CB_BRIDGE_INTR;
41715 config_writew(socket, CB_BRIDGE_CONTROL, bridge);
41716 @@ -573,41 +477,27 @@
41718 /* Redo card voltage interrogation */
41719 cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);
41722 -/* Called at resume and initialization events */
41723 -static int yenta_init(struct pcmcia_socket *sock)
41725 - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41726 - yenta_config_init(socket);
41727 yenta_clear_maps(socket);
41729 - /* Re-enable interrupts */
41730 + if (socket->type && socket->type->sock_init)
41731 + socket->type->sock_init(socket);
41733 + /* Re-enable CSC interrupts */
41734 cb_writel(socket, CB_SOCKET_MASK, CB_CDMASK);
41739 -static int yenta_suspend(struct pcmcia_socket *sock)
41740 +static int yenta_sock_suspend(struct pcmcia_socket *sock)
41742 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
41744 yenta_set_socket(sock, &dead_socket);
41746 - /* Disable interrupts */
41747 + /* Disable CSC interrupts */
41748 cb_writel(socket, CB_SOCKET_MASK, 0x0);
41751 - * This does not work currently. The controller
41752 - * loses too much information during D3 to come up
41753 - * cleanly. We should probably fix yenta_init()
41754 - * to update all the critical registers, notably
41755 - * the IO and MEM bridging region data.. That is
41756 - * something that pci_set_power_state() should
41757 - * probably know about bridges anyway.
41759 - pci_set_power_state(socket->dev, 3);
41765 @@ -758,8 +648,8 @@
41768 static struct pccard_operations yenta_socket_operations = {
41769 - .init = yenta_init,
41770 - .suspend = yenta_suspend,
41771 + .init = yenta_sock_init,
41772 + .suspend = yenta_sock_suspend,
41773 .get_status = yenta_get_status,
41774 .get_socket = yenta_get_socket,
41775 .set_socket = yenta_set_socket,
41776 @@ -770,52 +660,165 @@
41778 #include "ti113x.h"
41780 +#include "topic.h"
41783 + CARDBUS_TYPE_DEFAULT = -1,
41785 + CARDBUS_TYPE_TI113X,
41786 + CARDBUS_TYPE_TI12XX,
41787 + CARDBUS_TYPE_TI1250,
41788 + CARDBUS_TYPE_RICOH,
41789 + CARDBUS_TYPE_TOPIC97
41793 * Different cardbus controllers have slightly different
41794 * initialization sequences etc details. List them here..
41796 -#define PD(x,y) PCI_VENDOR_ID_##x, PCI_DEVICE_ID_##x##_##y
41797 -struct cardbus_override_struct {
41798 - unsigned short vendor;
41799 - unsigned short device;
41800 - int (*override) (struct yenta_socket *socket);
41801 -} cardbus_override[] = {
41802 - { PD(TI,1031), &ti_override },
41804 - /* TBD: Check if these TI variants can use more
41805 - * advanced overrides instead */
41806 - { PD(TI,1210), &ti_override },
41807 - { PD(TI,1211), &ti_override },
41808 - { PD(TI,1251A), &ti_override },
41809 - { PD(TI,1251B), &ti_override },
41810 - { PD(TI,1420), &ti_override },
41811 - { PD(TI,1450), &ti_override },
41812 - { PD(TI,4410), &ti_override },
41813 - { PD(TI,4451), &ti_override },
41815 - { PD(TI,1130), &ti113x_override },
41816 - { PD(TI,1131), &ti113x_override },
41818 - { PD(TI,1220), &ti12xx_override },
41819 - { PD(TI,1221), &ti12xx_override },
41820 - { PD(TI,1225), &ti12xx_override },
41821 - { PD(TI,1520), &ti12xx_override },
41823 - { PD(TI,1250), &ti1250_override },
41824 - { PD(TI,1410), &ti1250_override },
41826 - { PD(RICOH,RL5C465), &ricoh_override },
41827 - { PD(RICOH,RL5C466), &ricoh_override },
41828 - { PD(RICOH,RL5C475), &ricoh_override },
41829 - { PD(RICOH,RL5C476), &ricoh_override },
41830 - { PD(RICOH,RL5C478), &ricoh_override },
41832 - { }, /* all zeroes */
41833 +struct cardbus_type cardbus_type[] = {
41834 + [CARDBUS_TYPE_TI] = {
41835 + .override = ti_override,
41836 + .save_state = ti_save_state,
41837 + .restore_state = ti_restore_state,
41838 + .sock_init = ti_init,
41840 + [CARDBUS_TYPE_TI113X] = {
41841 + .override = ti113x_override,
41842 + .save_state = ti_save_state,
41843 + .restore_state = ti_restore_state,
41844 + .sock_init = ti_init,
41846 + [CARDBUS_TYPE_TI12XX] = {
41847 + .override = ti12xx_override,
41848 + .save_state = ti_save_state,
41849 + .restore_state = ti_restore_state,
41850 + .sock_init = ti_init,
41852 + [CARDBUS_TYPE_TI1250] = {
41853 + .override = ti1250_override,
41854 + .save_state = ti_save_state,
41855 + .restore_state = ti_restore_state,
41856 + .sock_init = ti_init,
41858 + [CARDBUS_TYPE_RICOH] = {
41859 + .override = ricoh_override,
41860 + .save_state = ricoh_save_state,
41861 + .restore_state = ricoh_restore_state,
41863 + [CARDBUS_TYPE_TOPIC97] = {
41864 + .override = topic97_override,
41870 + * Only probe "regular" interrupts, don't
41871 + * touch dangerous spots like the mouse irq,
41872 + * because there are mice that apparently
41873 + * get really confused if they get fondled
41874 + * too intimately.
41876 + * Default to 11, 10, 9, 7, 6, 5, 4, 3.
41878 +static u32 isa_interrupts = 0x0ef8;
41880 +static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask)
41883 + unsigned long val;
41887 + /* Set up ISA irq routing to probe the ISA irqs.. */
41888 + bridge_ctrl = config_readw(socket, CB_BRIDGE_CONTROL);
41889 + if (!(bridge_ctrl & CB_BRIDGE_INTR)) {
41890 + bridge_ctrl |= CB_BRIDGE_INTR;
41891 + config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl);
41895 + * Probe for usable interrupts using the force
41896 + * register to generate bogus card status events.
41898 + cb_writel(socket, CB_SOCKET_EVENT, -1);
41899 + cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
41900 + exca_writeb(socket, I365_CSCINT, 0);
41901 + val = probe_irq_on() & isa_irq_mask;
41902 + for (i = 1; i < 16; i++) {
41903 + if (!((val >> i) & 1))
41905 + exca_writeb(socket, I365_CSCINT, I365_CSC_STSCHG | (i << 4));
41906 + cb_writel(socket, CB_SOCKET_FORCE, CB_FCARDSTS);
41908 + cb_writel(socket, CB_SOCKET_EVENT, -1);
41910 + cb_writel(socket, CB_SOCKET_MASK, 0);
41911 + exca_writeb(socket, I365_CSCINT, 0);
41913 + mask = probe_irq_mask(val) & 0xffff;
41915 + bridge_ctrl &= ~CB_BRIDGE_INTR;
41916 + config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl);
41922 + * Set static data that doesn't need re-initializing..
41924 +static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
41926 + socket->socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
41927 + socket->socket.map_size = 0x1000;
41928 + socket->socket.pci_irq = socket->cb_irq;
41929 + socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
41930 + socket->socket.cb_dev = socket->dev;
41932 + printk(KERN_INFO "Yenta: ISA IRQ list %04x, PCI irq%d\n",
41933 + socket->socket.irq_mask, socket->cb_irq);
41937 + * Initialize the standard cardbus registers
41939 +static void yenta_config_init(struct yenta_socket *socket)
41942 + struct pci_dev *dev = socket->dev;
41944 + pci_set_power_state(socket->dev, 0);
41946 + config_writel(socket, CB_LEGACY_MODE_BASE, 0);
41947 + config_writel(socket, PCI_BASE_ADDRESS_0, dev->resource[0].start);
41948 + config_writew(socket, PCI_COMMAND,
41950 + PCI_COMMAND_MEMORY |
41951 + PCI_COMMAND_MASTER |
41952 + PCI_COMMAND_WAIT);
41954 + /* MAGIC NUMBERS! Fixme */
41955 + config_writeb(socket, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);
41956 + config_writeb(socket, PCI_LATENCY_TIMER, 168);
41957 + config_writel(socket, PCI_PRIMARY_BUS,
41958 + (176 << 24) | /* sec. latency timer */
41959 + (dev->subordinate->subordinate << 16) | /* subordinate bus */
41960 + (dev->subordinate->secondary << 8) | /* secondary bus */
41961 + dev->subordinate->primary); /* primary bus */
41964 + * Set up the bridging state:
41965 + * - enable write posting.
41966 + * - memory window 0 prefetchable, window 1 non-prefetchable
41967 + * - PCI interrupts enabled if a PCI interrupt exists..
41969 + bridge = config_readw(socket, CB_BRIDGE_CONTROL);
41970 + bridge &= ~(CB_BRIDGE_CRST | CB_BRIDGE_PREFETCH1 | CB_BRIDGE_INTR | CB_BRIDGE_ISAEN | CB_BRIDGE_VGAEN);
41971 + bridge |= CB_BRIDGE_PREFETCH0 | CB_BRIDGE_POSTEN | CB_BRIDGE_INTR;
41972 + config_writew(socket, CB_BRIDGE_CONTROL, bridge);
41976 * Initialize a cardbus controller. Make sure we have a usable
41977 * interrupt, and that we can map the cardbus area. Fill in the
41978 * socket information structure..
41979 @@ -823,7 +826,6 @@
41980 static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_id *id)
41982 struct yenta_socket *socket;
41983 - struct cardbus_override_struct *d;
41986 socket = kmalloc(sizeof(struct yenta_socket), GFP_KERNEL);
41987 @@ -887,14 +889,13 @@
41988 socket->cb_irq = dev->irq;
41990 /* Do we have special options for the device? */
41991 - d = cardbus_override;
41992 - while (d->override) {
41993 - if ((dev->vendor == d->vendor) && (dev->device == d->device)) {
41994 - ret = d->override(socket);
41999 + if (id->driver_data != CARDBUS_TYPE_DEFAULT &&
42000 + id->driver_data < ARRAY_SIZE(cardbus_type)) {
42001 + socket->type = &cardbus_type[id->driver_data];
42003 + ret = socket->type->override(socket);
42008 /* We must finish initialization here */
42009 @@ -933,25 +934,97 @@
42011 static int yenta_dev_suspend (struct pci_dev *dev, u32 state)
42013 - return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
42014 + struct yenta_socket *socket = pci_get_drvdata(dev);
42017 + ret = pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
42020 + if (socket->type && socket->type->save_state)
42021 + socket->type->save_state(socket);
42023 + /* FIXME: pci_save_state needs to have a better interface */
42024 + pci_save_state(dev, socket->saved_state);
42025 + pci_read_config_dword(dev, 16*4, &socket->saved_state[16]);
42026 + pci_read_config_dword(dev, 17*4, &socket->saved_state[17]);
42027 + pci_set_power_state(dev, 3);
42034 static int yenta_dev_resume (struct pci_dev *dev)
42036 + struct yenta_socket *socket = pci_get_drvdata(dev);
42039 + pci_set_power_state(dev, 0);
42040 + /* FIXME: pci_restore_state needs to have a better interface */
42041 + pci_restore_state(dev, socket->saved_state);
42042 + pci_write_config_dword(dev, 16*4, socket->saved_state[16]);
42043 + pci_write_config_dword(dev, 17*4, socket->saved_state[17]);
42045 + if (socket->type && socket->type->restore_state)
42046 + socket->type->restore_state(socket);
42049 return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
42053 -static struct pci_device_id yenta_table [] = { {
42054 - .class = PCI_CLASS_BRIDGE_CARDBUS << 8,
42055 - .class_mask = ~0,
42057 - .vendor = PCI_ANY_ID,
42058 - .device = PCI_ANY_ID,
42059 - .subvendor = PCI_ANY_ID,
42060 - .subdevice = PCI_ANY_ID,
42061 -}, { /* all zeroes */ }
42062 +#define CB_ID(vend,dev,type) \
42064 + .vendor = vend, \
42066 + .subvendor = PCI_ANY_ID, \
42067 + .subdevice = PCI_ANY_ID, \
42068 + .class = PCI_CLASS_BRIDGE_CARDBUS << 8, \
42069 + .class_mask = ~0, \
42070 + .driver_data = CARDBUS_TYPE_##type, \
42073 +static struct pci_device_id yenta_table [] = {
42074 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI),
42077 + * TBD: Check if these TI variants can use more
42078 + * advanced overrides instead. (I can't get the
42079 + * data sheets for these devices. --rmk)
42081 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1210, TI),
42082 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1251B, TI),
42084 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1130, TI113X),
42085 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1131, TI113X),
42087 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1211, TI12XX),
42088 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1220, TI12XX),
42089 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1221, TI12XX),
42090 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1225, TI12XX),
42091 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1251A, TI12XX),
42092 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1420, TI12XX),
42093 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1450, TI12XX),
42094 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, TI12XX),
42095 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4410, TI12XX),
42096 +// CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4450, TI12XX),
42097 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4451, TI12XX),
42099 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1250, TI1250),
42100 + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1410, TI1250),
42102 + CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C465, RICOH),
42103 + CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C466, RICOH),
42104 + CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C475, RICOH),
42105 + CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C476, RICOH),
42106 + CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C478, RICOH),
42108 + CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC97, TOPIC97),
42109 + CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC100, TOPIC97),
42111 + /* match any cardbus bridge */
42112 + CB_ID(PCI_ANY_ID, PCI_ANY_ID, DEFAULT),
42113 + { /* all zeroes */ }
42115 MODULE_DEVICE_TABLE(pci, yenta_table);
42117 diff -Nru a/drivers/pcmcia/yenta_socket.h b/drivers/pcmcia/yenta_socket.h
42118 --- a/drivers/pcmcia/yenta_socket.h Mon Jun 30 13:33:00 2003
42119 +++ b/drivers/pcmcia/yenta_socket.h Wed Aug 27 12:42:53 2003
42122 #define CB_MEM_PAGE(map) (0x40 + (map))
42124 +struct yenta_socket;
42126 +struct cardbus_type {
42127 + int (*override)(struct yenta_socket *);
42128 + void (*save_state)(struct yenta_socket *);
42129 + void (*restore_state)(struct yenta_socket *);
42130 + int (*sock_init)(struct yenta_socket *);
42133 struct yenta_socket {
42134 struct pci_dev *dev;
42135 int cb_irq, io_irq;
42136 @@ -102,9 +111,13 @@
42137 struct timer_list poll_timer;
42139 struct pcmcia_socket socket;
42140 + struct cardbus_type *type;
42142 /* A few words of private data for special stuff of overrides... */
42143 unsigned int private[8];
42145 + /* PCI saved state */
42146 + u32 saved_state[18];
42150 diff -Nru a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
42151 --- a/drivers/s390/char/tape_char.c Mon May 26 12:20:47 2003
42152 +++ b/drivers/s390/char/tape_char.c Tue Aug 26 09:25:41 2003
42153 @@ -238,14 +238,14 @@
42154 struct tape_device *device;
42157 - if (major(filp->f_dentry->d_inode->i_rdev) != tapechar_major)
42158 + if (imajor(filp->f_dentry->d_inode) != tapechar_major)
42160 - minor = minor(filp->f_dentry->d_inode->i_rdev);
42161 + minor = iminor(filp->f_dentry->d_inode);
42162 device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
42163 if (IS_ERR(device)) {
42164 return PTR_ERR(device);
42166 - DBF_EVENT(6, "TCHAR:open: %x\n", minor(inode->i_rdev));
42167 + DBF_EVENT(6, "TCHAR:open: %x\n", iminor(inode));
42168 rc = tape_open(device);
42170 rc = tape_assign(device);
42171 @@ -269,7 +269,7 @@
42172 struct tape_device *device;
42174 device = (struct tape_device *) filp->private_data;
42175 - DBF_EVENT(6, "TCHAR:release: %x\n", minor(inode->i_rdev));
42176 + DBF_EVENT(6, "TCHAR:release: %x\n", iminor(inode));
42178 // FIXME: this is broken. Either MTWEOF/MTWEOF/MTBSR is done
42179 // EVERYTIME the user switches from write to something different
42180 @@ -281,7 +281,7 @@
42182 * If this is the rewinding tape minor then rewind.
42184 - if ((minor(inode->i_rdev) & 1) != 0)
42185 + if ((iminor(inode) & 1) != 0)
42186 tape_mtop(device, MTREW, 1);
42187 if (device->char_data.idal_buf != NULL) {
42188 idal_buffer_free(device->char_data.idal_buf);
42189 diff -Nru a/drivers/s390/char/tubio.h b/drivers/s390/char/tubio.h
42190 --- a/drivers/s390/char/tubio.h Wed Jun 11 12:32:58 2003
42191 +++ b/drivers/s390/char/tubio.h Tue Aug 26 09:25:41 2003
42192 @@ -377,7 +377,7 @@
42194 extern inline tub_t *INODE2TUB(struct inode *ip)
42196 - unsigned int minor = minor(ip->i_rdev);
42197 + unsigned int minor = iminor(ip);
42198 tub_t *tubp = NULL;
42199 if (minor == 0 && current->tty) {
42200 if (current->tty->driver == tty3270_driver)
42201 diff -Nru a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c
42202 --- a/drivers/s390/net/cu3088.c Sun May 25 17:00:00 2003
42203 +++ b/drivers/s390/net/cu3088.c Tue Aug 19 09:22:46 2003
42205 group_write(struct device_driver *drv, const char *buf, size_t count)
42207 const char *start, *end;
42208 - char bus_ids[2][BUS_ID_SIZE], *argv[2];
42209 + char bus_ids[2][BUS_ID_SIZE+1], *argv[2];
42212 struct ccwgroup_driver *cdrv;
42215 if (!(end = strchr(start, delim[i])))
42217 - len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start);
42218 + len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start)+1;
42219 strlcpy (bus_ids[i], start, len);
42220 argv[i] = bus_ids[i];
42222 diff -Nru a/drivers/s390/net/qeth.c b/drivers/s390/net/qeth.c
42223 --- a/drivers/s390/net/qeth.c Thu Jul 17 10:27:34 2003
42224 +++ b/drivers/s390/net/qeth.c Sun Aug 31 16:14:08 2003
42225 @@ -9765,19 +9765,19 @@
42228 static struct file_operations qeth_procfile_fops = {
42229 - ioctl:qeth_procfile_ioctl,
42230 - read:qeth_procfile_read,
42231 - open:qeth_procfile_open,
42232 - release:qeth_procfile_release,
42233 + .ioctl = qeth_procfile_ioctl,
42234 + .read = qeth_procfile_read,
42235 + .open = qeth_procfile_open,
42236 + .release = qeth_procfile_release,
42239 static struct proc_dir_entry *qeth_proc_file;
42241 static struct file_operations qeth_ipato_procfile_fops = {
42242 - read:qeth_procfile_read, /* same as above! */
42243 - write:qeth_ipato_procfile_write,
42244 - open:qeth_ipato_procfile_open,
42245 - release:qeth_procfile_release /* same as above! */
42246 + .read = qeth_procfile_read, /* same as above! */
42247 + .write = qeth_ipato_procfile_write,
42248 + .open = qeth_ipato_procfile_open,
42249 + .release = qeth_procfile_release /* same as above! */
42252 static struct proc_dir_entry *qeth_ipato_proc_file;
42253 diff -Nru a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
42254 --- a/drivers/sbus/char/bpp.c Wed May 7 08:47:30 2003
42255 +++ b/drivers/sbus/char/bpp.c Tue Aug 26 09:25:41 2003
42256 @@ -440,7 +440,7 @@
42258 static int bpp_open(struct inode *inode, struct file *f)
42260 - unsigned minor = minor(inode->i_rdev);
42261 + unsigned minor = iminor(inode);
42264 spin_lock(&bpp_open_lock);
42265 @@ -470,7 +470,7 @@
42267 static int bpp_release(struct inode *inode, struct file *f)
42269 - unsigned minor = minor(inode->i_rdev);
42270 + unsigned minor = iminor(inode);
42272 spin_lock(&bpp_open_lock);
42273 instances[minor].opened = 0;
42274 @@ -634,7 +634,7 @@
42275 static ssize_t bpp_read(struct file *f, char *c, size_t cnt, loff_t * ppos)
42278 - const unsigned minor = minor(f->f_dentry->d_inode->i_rdev);
42279 + unsigned minor = iminor(f->f_dentry->d_inode);
42280 if (minor >= BPP_NO) return -ENODEV;
42281 if (!instances[minor].present) return -ENODEV;
42283 @@ -787,7 +787,7 @@
42284 static ssize_t bpp_write(struct file *f, const char *c, size_t cnt, loff_t * ppos)
42287 - const unsigned minor = minor(f->f_dentry->d_inode->i_rdev);
42288 + unsigned minor = iminor(f->f_dentry->d_inode);
42289 if (minor >= BPP_NO) return -ENODEV;
42290 if (!instances[minor].present) return -ENODEV;
42292 @@ -813,7 +813,7 @@
42296 - unsigned minor = minor(inode->i_rdev);
42297 + unsigned minor = iminor(inode);
42298 if (minor >= BPP_NO) return -ENODEV;
42299 if (!instances[minor].present) return -ENODEV;
42301 diff -Nru a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
42302 --- a/drivers/sbus/char/cpwatchdog.c Tue Apr 22 23:40:00 2003
42303 +++ b/drivers/sbus/char/cpwatchdog.c Tue Aug 26 09:25:41 2003
42304 @@ -295,7 +295,7 @@
42306 static int wd_open(struct inode *inode, struct file *f)
42308 - switch(minor(inode->i_rdev))
42309 + switch(iminor(inode))
42312 f->private_data = &wd_dev.watchdog[WD0_ID];
42313 diff -Nru a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
42314 --- a/drivers/sbus/char/display7seg.c Thu Jan 16 11:49:15 2003
42315 +++ b/drivers/sbus/char/display7seg.c Tue Aug 26 09:25:41 2003
42318 static int d7s_open(struct inode *inode, struct file *f)
42320 - if (D7S_MINOR != minor(inode->i_rdev))
42321 + if (D7S_MINOR != iminor(inode))
42323 atomic_inc(&d7s_users);
42325 @@ -121,7 +121,7 @@
42326 __u8 regs = readb(d7s_regs);
42329 - if (D7S_MINOR != minor(inode->i_rdev))
42330 + if (D7S_MINOR != iminor(inode))
42334 diff -Nru a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c
42335 --- a/drivers/sbus/char/rtc.c Thu Jul 18 23:11:59 2002
42336 +++ b/drivers/sbus/char/rtc.c Mon Sep 1 00:27:41 2003
42338 static int rtc_busy = 0;
42340 /* Retrieve the current date and time from the real time clock. */
42341 -void get_rtc_time(struct rtc_time *t)
42342 +static void get_rtc_time(struct rtc_time *t)
42344 unsigned long regs = mstk48t02_regs;
42346 diff -Nru a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
42347 --- a/drivers/sbus/char/vfc_dev.c Wed May 7 08:47:30 2003
42348 +++ b/drivers/sbus/char/vfc_dev.c Tue Aug 26 09:25:41 2003
42349 @@ -184,7 +184,7 @@
42350 struct vfc_dev *dev;
42352 spin_lock(&vfc_dev_lock);
42353 - dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
42354 + dev = vfc_get_dev_ptr(iminor(inode));
42356 spin_unlock(&vfc_dev_lock);
42358 @@ -215,7 +215,7 @@
42359 struct vfc_dev *dev;
42361 spin_lock(&vfc_dev_lock);
42362 - dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
42363 + dev = vfc_get_dev_ptr(iminor(inode));
42364 if (!dev || !dev->busy) {
42365 spin_unlock(&vfc_dev_lock);
42367 @@ -557,7 +557,7 @@
42369 struct vfc_dev *dev;
42371 - dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
42372 + dev = vfc_get_dev_ptr(iminor(inode));
42376 @@ -602,7 +602,7 @@
42377 VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCRDINFO)\n", dev->instance));
42380 - ret = vfc_debug(vfc_get_dev_ptr(MINOR(inode->i_rdev)),
42381 + ret = vfc_debug(vfc_get_dev_ptr(iminor(inode)),
42385 @@ -616,7 +616,7 @@
42386 unsigned int map_size, ret, map_offset;
42387 struct vfc_dev *dev;
42389 - dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
42390 + dev = vfc_get_dev_ptr(iminor(inode));
42394 diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
42395 --- a/drivers/scsi/3w-xxxx.c Sat Aug 16 11:46:50 2003
42396 +++ b/drivers/scsi/3w-xxxx.c Tue Aug 26 09:25:41 2003
42397 @@ -628,7 +628,7 @@
42398 unsigned long *cpu_addr;
42399 TW_New_Ioctl *tw_ioctl;
42400 TW_Passthru *passthru;
42401 - TW_Device_Extension *tw_dev = tw_device_extension_list[minor(inode->i_rdev)];
42402 + TW_Device_Extension *tw_dev = tw_device_extension_list[iminor(inode)];
42403 int retval = -EFAULT;
42405 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
42406 @@ -786,7 +786,7 @@
42408 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
42410 - minor_number = minor(inode->i_rdev);
42411 + minor_number = iminor(inode);
42412 if (minor_number >= tw_device_extension_count)
42415 diff -Nru a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
42416 --- a/drivers/scsi/aacraid/linit.c Thu Jul 31 07:32:16 2003
42417 +++ b/drivers/scsi/aacraid/linit.c Tue Aug 26 09:25:41 2003
42418 @@ -565,7 +565,7 @@
42420 static int aac_cfg_open(struct inode * inode, struct file * file )
42422 - unsigned minor_number = minor(inode->i_rdev);
42423 + unsigned minor_number = iminor(inode);
42424 if(minor_number >= aac_count)
42427 @@ -601,7 +601,7 @@
42429 static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg )
42431 - struct aac_dev *dev = aac_devices[minor(inode->i_rdev)];
42432 + struct aac_dev *dev = aac_devices[iminor(inode)];
42433 return aac_do_ioctl(dev, cmd, (void *)arg);
42436 diff -Nru a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
42437 --- a/drivers/scsi/advansys.c Fri May 2 12:35:39 2003
42438 +++ b/drivers/scsi/advansys.c Sun Aug 31 16:15:44 2003
42439 @@ -6199,7 +6199,9 @@
42441 static Scsi_Host_Template driver_template = {
42442 .proc_name = "advansys",
42443 +#ifdef CONFIG_PROC_FS
42444 .proc_info = advansys_proc_info,
42446 .name = "advansys",
42447 .detect = advansys_detect,
42448 .release = advansys_release,
42449 diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
42450 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c Thu Jun 19 16:46:06 2003
42451 +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c Sun Aug 31 16:14:08 2003
42452 @@ -72,10 +72,10 @@
42453 MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table);
42455 struct pci_driver aic79xx_pci_driver = {
42457 - probe: ahd_linux_pci_dev_probe,
42458 - remove: ahd_linux_pci_dev_remove,
42459 - id_table: ahd_linux_pci_id_table
42460 + .name = "aic79xx",
42461 + .probe = ahd_linux_pci_dev_probe,
42462 + .remove = ahd_linux_pci_dev_remove,
42463 + .id_table = ahd_linux_pci_id_table
42467 diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
42468 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c Wed May 14 15:00:40 2003
42469 +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c Sun Aug 31 16:14:08 2003
42470 @@ -75,10 +75,10 @@
42471 MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table);
42473 struct pci_driver aic7xxx_pci_driver = {
42475 - probe: ahc_linux_pci_dev_probe,
42476 - remove: ahc_linux_pci_dev_remove,
42477 - id_table: ahc_linux_pci_id_table
42478 + .name = "aic7xxx",
42479 + .probe = ahc_linux_pci_dev_probe,
42480 + .remove = ahc_linux_pci_dev_remove,
42481 + .id_table = ahc_linux_pci_id_table
42485 diff -Nru a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
42486 --- a/drivers/scsi/dpt_i2o.c Fri May 2 12:45:47 2003
42487 +++ b/drivers/scsi/dpt_i2o.c Tue Aug 26 09:25:41 2003
42488 @@ -1551,7 +1551,7 @@
42490 //TODO check for root access
42492 - minor = minor(inode->i_rdev);
42493 + minor = iminor(inode);
42494 if (minor >= hba_count) {
42497 @@ -1582,7 +1582,7 @@
42501 - minor = minor(inode->i_rdev);
42502 + minor = iminor(inode);
42503 if (minor >= hba_count) {
42506 @@ -1878,7 +1878,7 @@
42510 - minor = minor(inode->i_rdev);
42511 + minor = iminor(inode);
42512 if (minor >= DPTI_MAX_HBA){
42515 diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
42516 --- a/drivers/scsi/hosts.c Sat Aug 16 16:09:46 2003
42517 +++ b/drivers/scsi/hosts.c Sun Aug 31 16:15:45 2003
42518 @@ -158,7 +158,13 @@
42519 scsi_proc_hostdir_rm(shost->hostt);
42520 scsi_destroy_command_freelist(shost);
42522 - put_device(parent);
42524 + * Some drivers (eg aha1542) do scsi_register()/scsi_unregister()
42525 + * during probing without performing a scsi_set_device() in between.
42526 + * In this case dev->parent is NULL.
42529 + put_device(parent);
42533 diff -Nru a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h
42534 --- a/drivers/scsi/hosts.h Mon Jun 23 04:00:34 2003
42535 +++ b/drivers/scsi/hosts.h Mon Sep 1 13:56:57 2003
42539 #include <linux/config.h>
42540 -#include <linux/proc_fs.h>
42542 #include <scsi/scsi_host.h>
42544 diff -Nru a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
42545 --- a/drivers/scsi/megaraid.c Sat Aug 16 11:46:50 2003
42546 +++ b/drivers/scsi/megaraid.c Mon Sep 1 13:56:57 2003
42548 #include <asm/uaccess.h>
42549 #include <asm/io.h>
42550 #include <linux/delay.h>
42551 +#include <linux/proc_fs.h>
42552 #include <linux/reboot.h>
42553 #include <linux/module.h>
42554 #include <linux/list.h>
42555 diff -Nru a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
42556 --- a/drivers/scsi/nsp32.c Tue Aug 19 12:35:44 2003
42557 +++ b/drivers/scsi/nsp32.c Sun Aug 31 16:14:08 2003
42558 @@ -2809,13 +2809,13 @@
42559 for (j = 0; j < NUMBER(data->lunt[0]); j++) {
42560 int offset = i * NUMBER(data->lunt[0]) + j;
42567 - sglun: &(data->sg_list[offset]),
42568 - sglun_paddr: data->sg_paddr + (offset * sizeof(nsp32_sglun)),
42571 + .msgin03 = FALSE,
42574 + .sglun = &(data->sg_list[offset]),
42575 + .sglun_paddr = data->sg_paddr + (offset * sizeof(nsp32_sglun)),
42578 data->lunt[i][j] = tmp;
42579 diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c
42580 --- a/drivers/scsi/osst.c Fri May 2 12:38:35 2003
42581 +++ b/drivers/scsi/osst.c Tue Aug 26 09:25:41 2003
42582 @@ -132,9 +132,9 @@
42583 #define OSST_TIMEOUT (200 * HZ)
42584 #define OSST_LONG_TIMEOUT (1800 * HZ)
42586 -#define TAPE_NR(x) (minor(x) & ~(-1 << ST_MODE_SHIFT))
42587 -#define TAPE_MODE(x) ((minor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
42588 -#define TAPE_REWIND(x) ((minor(x) & 0x80) == 0)
42589 +#define TAPE_NR(x) (iminor(x) & ~(-1 << ST_MODE_SHIFT))
42590 +#define TAPE_MODE(x) ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
42591 +#define TAPE_REWIND(x) ((iminor(x) & 0x80) == 0)
42592 #define TAPE_IS_RAW(x) (TAPE_MODE(x) & (ST_NBR_MODES >> 1))
42594 /* Internal ioctl to set both density (uppermost 8 bits) and blocksize (lower
42595 @@ -4215,8 +4215,8 @@
42597 ST_partstat * STps;
42599 - int dev = TAPE_NR(inode->i_rdev);
42600 - int mode = TAPE_MODE(inode->i_rdev);
42601 + int dev = TAPE_NR(inode);
42602 + int mode = TAPE_MODE(inode);
42604 write_lock(&os_scsi_tapes_lock);
42605 if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
42606 @@ -4244,7 +4244,7 @@
42607 filp->private_data = STp;
42609 write_unlock(&os_scsi_tapes_lock);
42610 - STp->rew_at_close = TAPE_REWIND(inode->i_rdev);
42611 + STp->rew_at_close = TAPE_REWIND(inode);
42613 if( !scsi_block_when_processing_errors(STp->device) ) {
42615 @@ -4264,7 +4264,7 @@
42616 flags = filp->f_flags;
42617 STp->write_prot = ((flags & O_ACCMODE) == O_RDONLY);
42619 - STp->raw = TAPE_IS_RAW(inode->i_rdev);
42620 + STp->raw = TAPE_IS_RAW(inode);
42622 STp->header_ok = 0;
42624 diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
42625 --- a/drivers/scsi/sg.c Sat Aug 16 11:46:50 2003
42626 +++ b/drivers/scsi/sg.c Tue Aug 26 09:25:41 2003
42627 @@ -238,7 +238,7 @@
42629 sg_open(struct inode *inode, struct file *filp)
42631 - int dev = minor(inode->i_rdev);
42632 + int dev = iminor(inode);
42633 int flags = filp->f_flags;
42636 diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
42637 --- a/drivers/scsi/sr.c Thu Jul 31 08:28:30 2003
42638 +++ b/drivers/scsi/sr.c Mon Sep 1 06:28:41 2003
42639 @@ -695,6 +695,10 @@
42640 unsigned char *buffer;
42642 struct scsi_mode_data data;
42643 + struct scsi_request *SRpnt;
42644 + unsigned char cmd[MAX_COMMAND_SIZE];
42645 + unsigned int the_result;
42648 static char *loadmech[] =
42650 @@ -708,11 +712,46 @@
42654 + /* allocate a request for the TEST_UNIT_READY */
42655 + SRpnt = scsi_allocate_request(cd->device);
42657 + printk(KERN_WARNING "(get_capabilities:) Request allocation "
42662 + /* allocate transfer buffer */
42663 buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
42665 printk(KERN_ERR "sr: out of memory.\n");
42666 + scsi_release_request(SRpnt);
42670 + /* issue TEST_UNIT_READY until the initial startup UNIT_ATTENTION
42671 + * conditions are gone, or a timeout happens
42675 + memset((void *)cmd, 0, MAX_COMMAND_SIZE);
42676 + cmd[0] = TEST_UNIT_READY;
42678 + SRpnt->sr_cmd_len = 0;
42679 + SRpnt->sr_sense_buffer[0] = 0;
42680 + SRpnt->sr_sense_buffer[2] = 0;
42681 + SRpnt->sr_data_direction = DMA_NONE;
42683 + scsi_wait_req (SRpnt, (void *) cmd, buffer,
42684 + 0, SR_TIMEOUT, MAX_RETRIES);
42686 + the_result = SRpnt->sr_result;
42688 + } while (retries < 5 &&
42689 + (!scsi_status_is_good(the_result) ||
42690 + ((driver_byte(the_result) & DRIVER_SENSE) &&
42691 + SRpnt->sr_sense_buffer[2] == UNIT_ATTENTION)));
42693 + /* ask for mode page 0x2a */
42694 rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, 128,
42695 SR_TIMEOUT, 3, &data);
42697 @@ -722,6 +761,7 @@
42698 cd->cdi.mask |= (CDC_CD_R | CDC_CD_RW | CDC_DVD_R |
42699 CDC_DVD | CDC_DVD_RAM |
42700 CDC_SELECT_DISC | CDC_SELECT_SPEED);
42701 + scsi_release_request(SRpnt);
42703 printk("%s: scsi-1 drive\n", cd->cdi.name);
42705 @@ -775,6 +815,7 @@
42706 /*else I don't think it can close its tray
42707 cd->cdi.mask |= CDC_CLOSE_TRAY; */
42709 + scsi_release_request(SRpnt);
42713 diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
42714 --- a/drivers/scsi/st.c Mon Aug 11 11:44:45 2003
42715 +++ b/drivers/scsi/st.c Tue Aug 26 12:05:16 2003
42716 @@ -140,8 +140,8 @@
42717 #define ST_TIMEOUT (900 * HZ)
42718 #define ST_LONG_TIMEOUT (14000 * HZ)
42720 -#define TAPE_NR(x) (minor(x) & ~(-1 << ST_MODE_SHIFT))
42721 -#define TAPE_MODE(x) ((minor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
42722 +#define TAPE_NR(x) (iminor(x) & ~(-1 << ST_MODE_SHIFT))
42723 +#define TAPE_MODE(x) ((iminor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)
42725 /* Internal ioctl to set both density (uppermost 8 bits) and blocksize (lower
42727 @@ -786,7 +786,7 @@
42729 char *name = tape_name(STp);
42730 struct inode *inode = filp->f_dentry->d_inode;
42731 - int mode = TAPE_MODE(inode->i_rdev);
42732 + int mode = TAPE_MODE(inode);
42734 STp->ready = ST_READY;
42736 @@ -980,7 +980,7 @@
42737 int i, retval = (-EIO);
42740 - int dev = TAPE_NR(inode->i_rdev);
42741 + int dev = TAPE_NR(inode);
42744 write_lock(&st_dev_arr_lock);
42745 @@ -1004,7 +1004,7 @@
42748 write_unlock(&st_dev_arr_lock);
42749 - STp->rew_at_close = STp->autorew_dev = (minor(inode->i_rdev) & 0x80) == 0;
42750 + STp->rew_at_close = STp->autorew_dev = (iminor(inode) & 0x80) == 0;
42753 if (!scsi_block_when_processing_errors(STp->device)) {
42754 diff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
42755 --- a/drivers/serial/Kconfig Fri Aug 1 03:02:30 2003
42756 +++ b/drivers/serial/Kconfig Sun Aug 24 08:17:18 2003
42757 @@ -430,12 +430,12 @@
42761 - 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)
42762 - 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
42763 + 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)
42764 + 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
42766 config SERIAL_CORE_CONSOLE
42768 - 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
42769 + 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
42772 config SERIAL_68328
42773 @@ -472,6 +472,22 @@
42775 depends on SERIAL_68360_SMC || SERIAL_68360_SCC
42778 +config SERIAL_PMACZILOG
42779 + tristate "PowerMac z85c30 ESCC support"
42780 + depends on PPC_OF
42782 + This driver supports the Zilog z85C30 serial ports found on
42783 + PowerMac machines.
42784 + Say Y or M if you want to be able to these serial ports.
42786 +config SERIAL_PMACZILOG_CONSOLE
42787 + bool "Console on PowerMac z85c30 serial port"
42788 + depends on SERIAL_PMACZILOG=y
42790 + If you would like to be able to use the z85c30 serial port
42791 + on your PowerMac as the console, you can do so by answering
42792 + Y to this option.
42796 diff -Nru a/drivers/serial/Makefile b/drivers/serial/Makefile
42797 --- a/drivers/serial/Makefile Tue Jul 15 03:23:50 2003
42798 +++ b/drivers/serial/Makefile Sun Aug 24 08:17:18 2003
42800 obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
42801 obj-$(CONFIG_V850E_UART) += v850e_uart.o
42802 obj-$(CONFIG_SERIAL98) += serial98.o
42803 +obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
42804 diff -Nru a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
42805 --- /dev/null Wed Dec 31 16:00:00 1969
42806 +++ b/drivers/serial/pmac_zilog.c Sun Aug 24 08:05:53 2003
42809 + * linux/drivers/serial/pmac_zilog.c
42811 + * Driver for PowerMac Z85c30 based ESCC cell found in the
42812 + * "macio" ASICs of various PowerMac models
42814 + * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org)
42816 + * Derived from drivers/macintosh/macserial.c by Paul Mackerras
42817 + * and drivers/serial/sunzilog.c by David S. Miller
42819 + * Hrm... actually, I ripped most of sunzilog (Thanks David !) and
42820 + * adapted special tweaks needed for us. I don't think it's worth
42821 + * merging back those though. The DMA code still has to get in
42822 + * and once done, I expect that driver to remain fairly stable in
42823 + * the long term, unless we change the driver model again...
42825 + * This program is free software; you can redistribute it and/or modify
42826 + * it under the terms of the GNU General Public License as published by
42827 + * the Free Software Foundation; either version 2 of the License, or
42828 + * (at your option) any later version.
42830 + * This program is distributed in the hope that it will be useful,
42831 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
42832 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42833 + * GNU General Public License for more details.
42835 + * You should have received a copy of the GNU General Public License
42836 + * along with this program; if not, write to the Free Software
42837 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42839 + * TODO: - Add DMA support
42840 + * - Defer port shutdown to a few seconds after close
42841 + * - maybe put something right into up->clk_divisor
42846 +#include <linux/config.h>
42847 +#include <linux/module.h>
42848 +#include <linux/tty.h>
42850 +#include <linux/tty_flip.h>
42851 +#include <linux/major.h>
42852 +#include <linux/string.h>
42853 +#include <linux/fcntl.h>
42854 +#include <linux/mm.h>
42855 +#include <linux/kernel.h>
42856 +#include <linux/delay.h>
42857 +#include <linux/init.h>
42858 +#include <linux/console.h>
42859 +#include <linux/slab.h>
42860 +#include <linux/adb.h>
42861 +#include <linux/pmu.h>
42862 +#include <asm/sections.h>
42863 +#include <asm/io.h>
42864 +#include <asm/irq.h>
42865 +#include <asm/prom.h>
42866 +#include <asm/bitops.h>
42867 +#include <asm/machdep.h>
42868 +#include <asm/pmac_feature.h>
42869 +#include <asm/kgdb.h>
42870 +#include <asm/dbdma.h>
42871 +#include <asm/macio.h>
42873 +#include <linux/serial.h>
42874 +#include <linux/serial_core.h>
42876 +#include "pmac_zilog.h"
42879 +/* Not yet implemented */
42882 +static char version[] __initdata = "pmac_zilog.c 0.5a (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
42883 +MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
42884 +MODULE_DESCRIPTION("Driver for the PowerMac serial ports.");
42885 +MODULE_LICENSE("GPL");
42887 +#define PWRDBG(fmt, arg...) printk(KERN_DEBUG fmt , ## arg)
42891 + * For the sake of early serial console, we can do a pre-probe
42892 + * (optional) of the ports at rather early boot time.
42894 +static struct uart_pmac_port pmz_ports[MAX_ZS_PORTS];
42895 +static int pmz_ports_count;
42899 + * Load all registers to reprogram the port
42900 + * This function must only be called when the TX is not busy. The UART
42901 + * port lock must be held and local interrupts disabled.
42903 +static void pmz_load_zsregs(struct uart_pmac_port *up, u8 *regs)
42907 + /* Let pending transmits finish. */
42908 + for (i = 0; i < 1000; i++) {
42909 + unsigned char stat = read_zsreg(up, R1);
42910 + if (stat & ALL_SNT)
42917 + ZS_CLEARFIFO(up);
42921 + /* Disable all interrupts. */
42922 + write_zsreg(up, R1,
42923 + regs[R1] & ~(RxINT_MASK | TxINT_ENAB | EXT_INT_ENAB));
42925 + /* Set parity, sync config, stop bits, and clock divisor. */
42926 + write_zsreg(up, R4, regs[R4]);
42928 + /* Set misc. TX/RX control bits. */
42929 + write_zsreg(up, R10, regs[R10]);
42931 + /* Set TX/RX controls sans the enable bits. */
42932 + write_zsreg(up, R3, regs[R3] & ~RxENABLE);
42933 + write_zsreg(up, R5, regs[R5] & ~TxENABLE);
42935 + /* Synchronous mode config. */
42936 + write_zsreg(up, R6, regs[R6]);
42937 + write_zsreg(up, R7, regs[R7]);
42939 + /* Disable baud generator. */
42940 + write_zsreg(up, R14, regs[R14] & ~BRENAB);
42942 + /* Clock mode control. */
42943 + write_zsreg(up, R11, regs[R11]);
42945 + /* Lower and upper byte of baud rate generator divisor. */
42946 + write_zsreg(up, R12, regs[R12]);
42947 + write_zsreg(up, R13, regs[R13]);
42949 + /* Now rewrite R14, with BRENAB (if set). */
42950 + write_zsreg(up, R14, regs[R14]);
42952 + /* External status interrupt control. */
42953 + write_zsreg(up, R15, regs[R15]);
42955 + /* Reset external status interrupts. */
42956 + write_zsreg(up, R0, RES_EXT_INT);
42957 + write_zsreg(up, R0, RES_EXT_INT);
42959 + /* Rewrite R3/R5, this time without enables masked. */
42960 + write_zsreg(up, R3, regs[R3]);
42961 + write_zsreg(up, R5, regs[R5]);
42963 + /* Rewrite R1, this time without IRQ enabled masked. */
42964 + write_zsreg(up, R1, regs[R1]);
42966 + /* Enable interrupts */
42967 + write_zsreg(up, R9, regs[R9]);
42971 + * We do like sunzilog to avoid disrupting pending Tx
42972 + * Reprogram the Zilog channel HW registers with the copies found in the
42973 + * software state struct. If the transmitter is busy, we defer this update
42974 + * until the next TX complete interrupt. Else, we do it right now.
42976 + * The UART port lock must be held and local interrupts disabled.
42978 +static void pmz_maybe_update_regs(struct uart_pmac_port *up)
42981 + if (!ZS_REGS_HELD(up)) {
42982 + if (ZS_TX_ACTIVE(up)) {
42983 + up->flags |= PMACZILOG_FLAG_REGS_HELD;
42985 + pr_debug("pmz: maybe_update_regs: updating\n");
42986 + pmz_load_zsregs(up, up->curregs);
42990 + pr_debug("pmz: maybe_update_regs: updating\n");
42991 + pmz_load_zsregs(up, up->curregs);
42995 +static void pmz_receive_chars(struct uart_pmac_port *up, struct pt_regs *regs)
42997 + struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */
43000 + unsigned char ch, r1;
43002 + if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
43003 + tty->flip.work.func((void *)tty);
43004 + if (tty->flip.count >= TTY_FLIPBUF_SIZE)
43005 + /* XXX Ignores SysRq when we need it most. Fix. */
43009 + r1 = read_zsreg(up, R1);
43010 + if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
43011 + write_zsreg(up, R0, ERR_RES);
43015 + ch = read_zsreg(up, R0);
43017 + /* This funny hack depends upon BRK_ABRT not interfering
43018 + * with the other bits we care about in R1.
43020 + if (ch & BRK_ABRT)
43023 + ch = read_zsdata(up);
43024 + ch &= up->parity_mask;
43026 + /* A real serial line, record the character and status. */
43027 + *tty->flip.char_buf_ptr = ch;
43028 + *tty->flip.flag_buf_ptr = TTY_NORMAL;
43029 + up->port.icount.rx++;
43030 + if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) {
43031 + if (r1 & BRK_ABRT) {
43032 + r1 &= ~(PAR_ERR | CRC_ERR);
43033 + up->port.icount.brk++;
43034 + if (uart_handle_break(&up->port))
43037 + else if (r1 & PAR_ERR)
43038 + up->port.icount.parity++;
43039 + else if (r1 & CRC_ERR)
43040 + up->port.icount.frame++;
43042 + up->port.icount.overrun++;
43043 + r1 &= up->port.read_status_mask;
43044 + if (r1 & BRK_ABRT)
43045 + *tty->flip.flag_buf_ptr = TTY_BREAK;
43046 + else if (r1 & PAR_ERR)
43047 + *tty->flip.flag_buf_ptr = TTY_PARITY;
43048 + else if (r1 & CRC_ERR)
43049 + *tty->flip.flag_buf_ptr = TTY_FRAME;
43051 + if (uart_handle_sysrq_char(&up->port, ch, regs))
43054 + if (up->port.ignore_status_mask == 0xff ||
43055 + (r1 & up->port.ignore_status_mask) == 0) {
43056 + tty->flip.flag_buf_ptr++;
43057 + tty->flip.char_buf_ptr++;
43058 + tty->flip.count++;
43060 + if ((r1 & Rx_OVR) &&
43061 + tty->flip.count < TTY_FLIPBUF_SIZE) {
43062 + *tty->flip.flag_buf_ptr = TTY_OVERRUN;
43063 + tty->flip.flag_buf_ptr++;
43064 + tty->flip.char_buf_ptr++;
43065 + tty->flip.count++;
43068 + ch = read_zsreg(up, R0);
43069 + if (!(ch & Rx_CH_AV))
43073 + tty_flip_buffer_push(tty);
43076 +static void pmz_status_handle(struct uart_pmac_port *up, struct pt_regs *regs)
43078 + unsigned char status;
43080 + status = read_zsreg(up, R0);
43081 + write_zsreg(up, R0, RES_EXT_INT);
43084 + if (ZS_WANTS_MODEM_STATUS(up)) {
43085 + if (status & SYNC_HUNT)
43086 + up->port.icount.dsr++;
43088 + /* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
43089 + * But it does not tell us which bit has changed, we have to keep
43090 + * track of this ourselves.
43092 + if ((status & DCD) ^ up->prev_status)
43093 + uart_handle_dcd_change(&up->port,
43095 + if ((status & CTS) ^ up->prev_status)
43096 + uart_handle_cts_change(&up->port,
43099 + wake_up_interruptible(&up->port.info->delta_msr_wait);
43102 + up->prev_status = status;
43105 +static void pmz_transmit_chars(struct uart_pmac_port *up)
43107 + struct circ_buf *xmit;
43109 + if (ZS_IS_CONS(up)) {
43110 + unsigned char status = read_zsreg(up, R0);
43112 + /* TX still busy? Just wait for the next TX done interrupt.
43114 + * It can occur because of how we do serial console writes. It would
43115 + * be nice to transmit console writes just like we normally would for
43116 + * a TTY line. (ie. buffered and TX interrupt driven). That is not
43117 + * easy because console writes cannot sleep. One solution might be
43118 + * to poll on enough port->xmit space becomming free. -DaveM
43120 + if (!(status & Tx_BUF_EMP))
43124 + up->flags &= ~PMACZILOG_FLAG_TX_ACTIVE;
43126 + if (ZS_REGS_HELD(up)) {
43127 + pmz_load_zsregs(up, up->curregs);
43128 + up->flags &= ~PMACZILOG_FLAG_REGS_HELD;
43131 + if (ZS_TX_STOPPED(up)) {
43132 + up->flags &= ~PMACZILOG_FLAG_TX_STOPPED;
43136 + if (up->port.x_char) {
43137 + up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
43138 + write_zsdata(up, up->port.x_char);
43140 + up->port.icount.tx++;
43141 + up->port.x_char = 0;
43145 + if (up->port.info == NULL)
43147 + xmit = &up->port.info->xmit;
43148 + if (uart_circ_empty(xmit)) {
43149 + uart_write_wakeup(&up->port);
43152 + if (uart_tx_stopped(&up->port))
43155 + up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
43156 + write_zsdata(up, xmit->buf[xmit->tail]);
43159 + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
43160 + up->port.icount.tx++;
43162 + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
43163 + uart_write_wakeup(&up->port);
43168 + write_zsreg(up, R0, RES_Tx_P);
43172 +/* Hrm... we register that twice, fixme later.... */
43173 +static irqreturn_t pmz_interrupt(int irq, void *dev_id, struct pt_regs *regs)
43175 + struct uart_pmac_port *up = dev_id;
43176 + struct uart_pmac_port *up_a;
43177 + struct uart_pmac_port *up_b;
43178 + int rc = IRQ_NONE;
43181 + up_a = ZS_IS_CHANNEL_A(up) ? up : up->mate;
43182 + up_b = up_a->mate;
43184 + spin_lock(&up_a->port.lock);
43185 + r3 = read_zsreg(up, R3);
43186 + pr_debug("pmz_irq: %x\n", r3);
43189 + if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
43190 + write_zsreg(up_a, R0, RES_H_IUS);
43192 + pr_debug("pmz: irq channel A: %x\n", r3);
43193 + if (r3 & CHARxIP)
43194 + pmz_receive_chars(up_a, regs);
43196 + pmz_status_handle(up_a, regs);
43197 + if (r3 & CHATxIP)
43198 + pmz_transmit_chars(up_a);
43199 + rc = IRQ_HANDLED;
43201 + spin_unlock(&up_a->port.lock);
43203 + spin_lock(&up_b->port.lock);
43204 + if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
43205 + write_zsreg(up_b, R0, RES_H_IUS);
43207 + pr_debug("pmz: irq channel B: %x\n", r3);
43208 + if (r3 & CHBRxIP)
43209 + pmz_receive_chars(up_b, regs);
43211 + pmz_status_handle(up_b, regs);
43212 + if (r3 & CHBTxIP)
43213 + pmz_transmit_chars(up_b);
43214 + rc = IRQ_HANDLED;
43216 + spin_unlock(&up_b->port.lock);
43223 + * Peek the status register, lock not held by caller
43225 +static inline u8 pmz_peek_status(struct uart_pmac_port *up)
43227 + unsigned long flags;
43230 + spin_lock_irqsave(&up->port.lock, flags);
43231 + status = read_zsreg(up, R0);
43232 + spin_unlock_irqrestore(&up->port.lock, flags);
43238 + * Check if transmitter is empty
43239 + * The port lock is not held.
43241 +static unsigned int pmz_tx_empty(struct uart_port *port)
43243 + unsigned char status;
43245 + status = pmz_peek_status(to_pmz(port));
43246 + if (status & Tx_BUF_EMP)
43247 + return TIOCSER_TEMT;
43252 + * Set Modem Control (RTS & DTR) bits
43253 + * The port lock is held and interrupts are disabled.
43254 + * Note: Shall we really filter out RTS on external ports or
43255 + * should that be dealt at higher level only ?
43257 +static void pmz_set_mctrl(struct uart_port *port, unsigned int mctrl)
43259 + struct uart_pmac_port *up = to_pmz(port);
43260 + unsigned char set_bits, clear_bits;
43262 + /* Do nothing for irda for now... */
43263 + if (ZS_IS_IRDA(up))
43266 + set_bits = clear_bits = 0;
43268 + if (ZS_IS_INTMODEM(up)) {
43269 + if (mctrl & TIOCM_RTS)
43272 + clear_bits |= RTS;
43274 + if (mctrl & TIOCM_DTR)
43277 + clear_bits |= DTR;
43279 + /* NOTE: Not subject to 'transmitter active' rule. */
43280 + up->curregs[R5] |= set_bits;
43281 + up->curregs[R5] &= ~clear_bits;
43282 + write_zsreg(up, R5, up->curregs[R5]);
43287 + * Get Modem Control bits (only the input ones, the core will
43288 + * or that with a cached value of the control ones)
43289 + * The port lock is not held.
43291 +static unsigned int pmz_get_mctrl(struct uart_port *port)
43293 + unsigned char status;
43294 + unsigned int ret;
43296 + status = pmz_peek_status(to_pmz(port));
43299 + if (status & DCD)
43300 + ret |= TIOCM_CAR;
43301 + if (status & SYNC_HUNT)
43302 + ret |= TIOCM_DSR;
43303 + if (status & CTS)
43304 + ret |= TIOCM_CTS;
43310 + * Stop TX side. Dealt like sunzilog at next Tx interrupt,
43311 + * though for DMA, we will have to do a bit more. What is
43312 + * the meaning of the tty_stop bit ? XXX
43313 + * The port lock is held and interrupts are disabled.
43315 +static void pmz_stop_tx(struct uart_port *port, unsigned int tty_stop)
43317 + to_pmz(port)->flags |= PMACZILOG_FLAG_TX_STOPPED;
43321 + * Kick the Tx side.
43322 + * The port lock is held and interrupts are disabled.
43324 +static void pmz_start_tx(struct uart_port *port, unsigned int tty_start)
43326 + struct uart_pmac_port *up = to_pmz(port);
43327 + unsigned char status;
43329 + pr_debug("pmz: start_tx()\n");
43331 + up->flags |= PMACZILOG_FLAG_TX_ACTIVE;
43332 + up->flags &= ~PMACZILOG_FLAG_TX_STOPPED;
43334 + status = read_zsreg(up, R0);
43336 + /* TX busy? Just wait for the TX done interrupt. */
43337 + if (!(status & Tx_BUF_EMP))
43340 + /* Send the first character to jump-start the TX done
43341 + * IRQ sending engine.
43343 + if (port->x_char) {
43344 + write_zsdata(up, port->x_char);
43346 + port->icount.tx++;
43347 + port->x_char = 0;
43349 + struct circ_buf *xmit = &port->info->xmit;
43351 + write_zsdata(up, xmit->buf[xmit->tail]);
43353 + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
43354 + port->icount.tx++;
43356 + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
43357 + uart_write_wakeup(&up->port);
43359 + pr_debug("pmz: start_tx() done.\n");
43363 + * Stop Rx side, basically disable emitting of
43364 + * Rx interrupts on the port
43365 + * The port lock is held.
43367 +static void pmz_stop_rx(struct uart_port *port)
43369 + struct uart_pmac_port *up = to_pmz(port);
43371 + if (ZS_IS_CONS(up))
43374 + pr_debug("pmz: stop_rx()()\n");
43376 + /* Disable all RX interrupts. */
43377 + up->curregs[R1] &= ~RxINT_MASK;
43378 + pmz_maybe_update_regs(up);
43380 + pr_debug("pmz: stop_rx() done.\n");
43384 + * Enable modem status change interrupts
43385 + * The port lock is not held.
43387 +static void pmz_enable_ms(struct uart_port *port)
43389 + struct uart_pmac_port *up = to_pmz(port);
43390 + unsigned char new_reg;
43391 + unsigned long flags;
43393 + spin_lock_irqsave(&port->lock, flags);
43395 + new_reg = up->curregs[R15] | (DCDIE | SYNCIE | CTSIE);
43396 + if (new_reg != up->curregs[R15]) {
43397 + up->curregs[R15] = new_reg;
43399 + /* NOTE: Not subject to 'transmitter active' rule. */
43400 + write_zsreg(up, R15, up->curregs[R15]);
43403 + spin_unlock_irqrestore(&port->lock, flags);
43407 + * Control break state emission
43408 + * The port lock is not held.
43410 +static void pmz_break_ctl(struct uart_port *port, int break_state)
43412 + struct uart_pmac_port *up = to_pmz(port);
43413 + unsigned char set_bits, clear_bits, new_reg;
43414 + unsigned long flags;
43416 + set_bits = clear_bits = 0;
43419 + set_bits |= SND_BRK;
43421 + clear_bits |= SND_BRK;
43423 + spin_lock_irqsave(&port->lock, flags);
43425 + new_reg = (up->curregs[R5] | set_bits) & ~clear_bits;
43426 + if (new_reg != up->curregs[R5]) {
43427 + up->curregs[R5] = new_reg;
43429 + /* NOTE: Not subject to 'transmitter active' rule. */
43430 + write_zsreg(up, R5, up->curregs[R5]);
43433 + spin_unlock_irqrestore(&port->lock, flags);
43437 + * Turn power on or off to the SCC and associated stuff
43438 + * (port drivers, modem, IR port, etc.)
43439 + * Returns the number of milliseconds we should wait before
43440 + * trying to use the port.
43442 +static int pmz_set_scc_power(struct uart_pmac_port *up, int state)
43447 + pmac_call_feature(
43448 + PMAC_FTR_SCC_ENABLE, up->node, up->port_type, 1);
43449 + if (ZS_IS_INTMODEM(up)) {
43450 + pmac_call_feature(
43451 + PMAC_FTR_MODEM_ENABLE, up->node, 0, 1);
43452 + delay = 2500; /* wait for 2.5s before using */
43453 + } else if (ZS_IS_IRDA(up))
43454 + mdelay(50); /* Do better here once the problems
43455 + * with blocking have been ironed out
43458 + /* TODO: Make that depend on a timer, don't power down
43461 + if (ZS_IS_INTMODEM(up)) {
43462 + pmac_call_feature(
43463 + PMAC_FTR_MODEM_ENABLE, up->node, 0, 0);
43465 + pmac_call_feature(
43466 + PMAC_FTR_SCC_ENABLE, up->node, up->port_type, 0);
43472 + * FixZeroBug....Works around a bug in the SCC receving channel.
43473 + * Taken from Darwin code, 15 Sept. 2000 -DanM
43475 + * The following sequence prevents a problem that is seen with O'Hare ASICs
43476 + * (most versions -- also with some Heathrow and Hydra ASICs) where a zero
43477 + * at the input to the receiver becomes 'stuck' and locks up the receiver.
43478 + * This problem can occur as a result of a zero bit at the receiver input
43479 + * coincident with any of the following events:
43481 + * The SCC is initialized (hardware or software).
43482 + * A framing error is detected.
43483 + * The clocking option changes from synchronous or X1 asynchronous
43484 + * clocking to X16, X32, or X64 asynchronous clocking.
43485 + * The decoding mode is changed among NRZ, NRZI, FM0, or FM1.
43487 + * This workaround attempts to recover from the lockup condition by placing
43488 + * the SCC in synchronous loopback mode with a fast clock before programming
43489 + * any of the asynchronous modes.
43491 +static void pmz_fix_zero_bug_scc(struct uart_pmac_port *up)
43493 + write_zsreg(up, 9, ZS_IS_CHANNEL_A(up) ? CHRA : CHRB);
43496 + write_zsreg(up, 9, (ZS_IS_CHANNEL_A(up) ? CHRA : CHRB) | NV);
43499 + write_zsreg(up, 4, (X1CLK | EXTSYNC));
43501 + /* I think this is wrong....but, I just copying code....
43503 + write_zsreg(up, 3, (8 & ~RxENABLE));
43505 + write_zsreg(up, 5, (8 & ~TxENABLE));
43506 + write_zsreg(up, 9, NV); /* Didn't we already do this? */
43507 + write_zsreg(up, 11, (RCBR | TCBR));
43508 + write_zsreg(up, 12, 0);
43509 + write_zsreg(up, 13, 0);
43510 + write_zsreg(up, 14, (LOOPBAK | SSBR));
43511 + write_zsreg(up, 14, (LOOPBAK | SSBR | BRENAB));
43512 + write_zsreg(up, 3, (8 | RxENABLE));
43513 + write_zsreg(up, 0, RES_EXT_INT);
43514 + write_zsreg(up, 0, RES_EXT_INT); /* to kill some time */
43516 + /* The channel should be OK now, but it is probably receiving
43517 + * loopback garbage.
43518 + * Switch to asynchronous mode, disable the receiver,
43519 + * and discard everything in the receive buffer.
43521 + write_zsreg(up, 9, NV);
43522 + write_zsreg(up, 4, PAR_ENAB);
43523 + write_zsreg(up, 3, (8 & ~RxENABLE));
43525 + while (read_zsreg(up, 0) & Rx_CH_AV) {
43526 + (void)read_zsreg(up, 8);
43527 + write_zsreg(up, 0, RES_EXT_INT);
43528 + write_zsreg(up, 0, ERR_RES);
43533 + * Real startup routine, powers up the hardware and sets up
43534 + * the SCC. Returns a delay in ms where you need to wait before
43535 + * actually using the port, this is typically the internal modem
43536 + * powerup delay. This routine expect the lock to be taken.
43538 +static int __pmz_startup(struct uart_pmac_port *up)
43540 + int pwr_delay = 0;
43542 + memset(&up->curregs, 0, sizeof(up->curregs));
43544 + /* Power up the SCC & underlying hardware (modem/irda) */
43545 + pwr_delay = pmz_set_scc_power(up, 1);
43547 + /* Nice buggy HW ... */
43548 + pmz_fix_zero_bug_scc(up);
43550 + /* Reset the chip */
43551 + write_zsreg(up, 9, ZS_IS_CHANNEL_A(up) ? CHRA : CHRB);
43554 + write_zsreg(up, 9, 0);
43557 + /* Clear the interrupt registers */
43558 + write_zsreg(up, R1, 0);
43559 + write_zsreg(up, R0, ERR_RES);
43560 + write_zsreg(up, R0, ERR_RES);
43561 + write_zsreg(up, R0, RES_H_IUS);
43562 + write_zsreg(up, R0, RES_H_IUS);
43564 + /* Remember status for DCD/CTS changes */
43565 + up->prev_status = read_zsreg(up, R0);
43567 + /* Enable receiver and transmitter. */
43568 + up->curregs[R3] |= RxENABLE;
43569 + up->curregs[R5] |= TxENABLE | RTS | DTR;
43571 + /* Master interrupt enable */
43572 + up->curregs[R9] |= NV | MIE;
43574 + up->curregs[R1] |= EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB;
43575 + // pmz_maybe_update_regs(up);
43577 + return pwr_delay;
43581 + * This is the "normal" startup routine, using the above one
43582 + * wrapped with the lock and doing a schedule delay
43584 +static int pmz_startup(struct uart_port *port)
43586 + struct uart_pmac_port *up = to_pmz(port);
43587 + unsigned long flags;
43588 + int pwr_delay = 0;
43590 + pr_debug("pmz: startup()\n");
43592 + /* A console is never powered down */
43593 + if (!ZS_IS_CONS(up)) {
43594 + spin_lock_irqsave(&port->lock, flags);
43595 + pwr_delay = __pmz_startup(up);
43596 + spin_unlock_irqrestore(&port->lock, flags);
43599 + if (request_irq(up->port.irq, pmz_interrupt, SA_SHIRQ, "PowerMac Zilog", up)) {
43600 + printk(KERN_ERR "Unable to register zs interrupt handler.\n");
43601 + pmz_set_scc_power(up, 0);
43605 + /* Right now, we deal with delay by blocking here, I'll be
43606 + * smarter later on
43608 + if (pwr_delay != 0) {
43609 + pr_debug("pmz: delaying %d ms\n", pwr_delay);
43610 + set_current_state(TASK_UNINTERRUPTIBLE);
43611 + schedule_timeout((pwr_delay * HZ)/1000);
43614 + pr_debug("pmz: startup() done.\n");
43619 +static void pmz_shutdown(struct uart_port *port)
43621 + struct uart_pmac_port *up = to_pmz(port);
43622 + unsigned long flags;
43624 + pr_debug("pmz: shutdown()\n");
43626 + /* Release interrupt handler */
43627 + free_irq(up->port.irq, up);
43629 + if (ZS_IS_CONS(up))
43632 + spin_lock_irqsave(&port->lock, flags);
43634 + /* Disable receiver and transmitter. */
43635 + up->curregs[R3] &= ~RxENABLE;
43636 + up->curregs[R5] &= ~TxENABLE;
43638 + /* Disable all interrupts and BRK assertion. */
43639 + up->curregs[R1] &= ~(EXT_INT_ENAB | TxINT_ENAB | RxINT_MASK);
43640 + up->curregs[R5] &= ~SND_BRK;
43641 + pmz_maybe_update_regs(up);
43643 + /* Shut the chip down */
43644 + pmz_set_scc_power(up, 0);
43646 + spin_unlock_irqrestore(&port->lock, flags);
43648 + pr_debug("pmz: shutdown() done.\n");
43651 +/* Shared by TTY driver and serial console setup. The port lock is held
43652 + * and local interrupts are disabled.
43655 +pmz_convert_to_zs(struct uart_pmac_port *up, unsigned int cflag,
43656 + unsigned int iflag, int baud)
43661 + case ZS_CLOCK/16: /* 230400 */
43662 + up->curregs[R4] = X16CLK;
43663 + up->curregs[R11] = 0;
43665 + case ZS_CLOCK/32: /* 115200 */
43666 + up->curregs[R4] = X32CLK;
43667 + up->curregs[R11] = 0;
43670 + up->curregs[R4] = X16CLK;
43671 + up->curregs[R11] = TCBR | RCBR;
43672 + brg = BPS_TO_BRG(baud, ZS_CLOCK / 16);
43673 + up->curregs[R12] = (brg & 255);
43674 + up->curregs[R13] = ((brg >> 8) & 255);
43675 + up->curregs[R14] = BRENAB;
43678 + /* Character size, stop bits, and parity. */
43679 + up->curregs[3] &= ~RxN_MASK;
43680 + up->curregs[5] &= ~TxN_MASK;
43682 + switch (cflag & CSIZE) {
43684 + up->curregs[3] |= Rx5;
43685 + up->curregs[5] |= Tx5;
43686 + up->parity_mask = 0x1f;
43689 + up->curregs[3] |= Rx6;
43690 + up->curregs[5] |= Tx6;
43691 + up->parity_mask = 0x3f;
43694 + up->curregs[3] |= Rx7;
43695 + up->curregs[5] |= Tx7;
43696 + up->parity_mask = 0x7f;
43700 + up->curregs[3] |= Rx8;
43701 + up->curregs[5] |= Tx8;
43702 + up->parity_mask = 0xff;
43705 + up->curregs[4] &= ~(SB_MASK);
43706 + if (cflag & CSTOPB)
43707 + up->curregs[4] |= SB2;
43709 + up->curregs[4] |= SB1;
43710 + if (cflag & PARENB)
43711 + up->curregs[4] |= PAR_ENAB;
43713 + up->curregs[4] &= ~PAR_ENAB;
43714 + if (!(cflag & PARODD))
43715 + up->curregs[4] |= PAR_EVEN;
43717 + up->curregs[4] &= ~PAR_EVEN;
43719 + up->port.read_status_mask = Rx_OVR;
43720 + if (iflag & INPCK)
43721 + up->port.read_status_mask |= CRC_ERR | PAR_ERR;
43722 + if (iflag & (BRKINT | PARMRK))
43723 + up->port.read_status_mask |= BRK_ABRT;
43725 + up->port.ignore_status_mask = 0;
43726 + if (iflag & IGNPAR)
43727 + up->port.ignore_status_mask |= CRC_ERR | PAR_ERR;
43728 + if (iflag & IGNBRK) {
43729 + up->port.ignore_status_mask |= BRK_ABRT;
43730 + if (iflag & IGNPAR)
43731 + up->port.ignore_status_mask |= Rx_OVR;
43734 + if ((cflag & CREAD) == 0)
43735 + up->port.ignore_status_mask = 0xff;
43738 +static void pmz_irda_rts_pulses(struct uart_pmac_port *up, int w)
43741 + write_zsreg(up, 5, Tx8 | TxENABLE);
43744 + write_zsreg(up, 5, Tx8 | TxENABLE | RTS);
43747 + write_zsreg(up, 5, Tx8 | TxENABLE);
43750 + write_zsreg(up, 5, Tx8 | TxENABLE | RTS);
43755 + * Set the irda codec on the imac to the specified baud rate.
43757 +static void pmz_irda_setup(struct uart_pmac_port *up, int cflags)
43759 + int code, speed, t;
43761 + speed = cflags & CBAUD;
43762 + if (speed < B2400 || speed > B115200)
43764 + code = 0x4d + B115200 - speed;
43766 + /* disable serial interrupts and receive DMA */
43767 + write_zsreg(up, 1, up->curregs[1] & ~0x9f);
43769 + /* wait for transmitter to drain */
43771 + while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0
43772 + || (read_zsreg(up, R1) & ALL_SNT) == 0) {
43774 + printk(KERN_ERR "transmitter didn't drain\n");
43781 + /* set to 8 bits, no parity, 19200 baud, RTS on, DTR off */
43782 + write_zsreg(up, R4, X16CLK | SB1);
43783 + write_zsreg(up, R11, TCBR | RCBR);
43784 + t = BPS_TO_BRG(19200, ZS_CLOCK/16);
43785 + write_zsreg(up, R12, t);
43786 + write_zsreg(up, R13, t >> 8);
43787 + write_zsreg(up, R14, BRENAB);
43788 + write_zsreg(up, R3, Rx8 | RxENABLE);
43789 + write_zsreg(up, R5, Tx8 | TxENABLE | RTS);
43792 + /* set TxD low for ~104us and pulse RTS */
43794 + write_zsdata(up, 0xfe);
43795 + pmz_irda_rts_pulses(up, 150);
43796 + pmz_irda_rts_pulses(up, 180);
43797 + pmz_irda_rts_pulses(up, 50);
43800 + /* assert DTR, wait 30ms, talk to the chip */
43801 + write_zsreg(up, R5, Tx8 | TxENABLE | RTS | DTR);
43804 + while (read_zsreg(up, R0) & Rx_CH_AV)
43807 + write_zsdata(up, 1);
43809 + while ((read_zsreg(up, R0) & Rx_CH_AV) == 0) {
43811 + printk(KERN_ERR "irda_setup timed out on 1st byte\n");
43816 + t = read_zsdata(up);
43818 + printk(KERN_ERR "irda_setup 1st byte = %x\n", t);
43820 + write_zsdata(up, code);
43822 + while ((read_zsreg(up, R0) & Rx_CH_AV) == 0) {
43824 + printk(KERN_ERR "irda_setup timed out on 2nd byte\n");
43829 + t = read_zsdata(up);
43831 + printk(KERN_ERR "irda_setup 2nd byte = %x (%x)\n", t, code);
43833 + /* Drop DTR again and do some more RTS pulses */
43836 + write_zsreg(up, R5, Tx8 | TxENABLE | RTS);
43837 + pmz_irda_rts_pulses(up, 80);
43839 + /* We should be right to go now. We assume that load_zsregs
43840 + will get called soon to load up the correct baud rate etc. */
43841 + up->curregs[R5] = (up->curregs[R5] | RTS) & ~DTR;
43844 +/* The port lock is not held. */
43846 +pmz_set_termios(struct uart_port *port, struct termios *termios,
43847 + struct termios *old)
43849 + struct uart_pmac_port *up = to_pmz(port);
43850 + unsigned long flags;
43853 + pr_debug("pmz: set_termios()\n");
43855 + baud = uart_get_baud_rate(port, termios, old, 1200, 230400);
43857 + spin_lock_irqsave(&up->port.lock, flags);
43859 + pmz_convert_to_zs(up, termios->c_cflag, termios->c_iflag, baud);
43861 + if (UART_ENABLE_MS(&up->port, termios->c_cflag))
43862 + up->flags |= PMACZILOG_FLAG_MODEM_STATUS;
43864 + up->flags &= ~PMACZILOG_FLAG_MODEM_STATUS;
43866 + /* set the irda codec to the right rate */
43867 + if (ZS_IS_IRDA(up))
43868 + pmz_irda_setup(up, termios->c_cflag);
43870 + /* Load registers to the chip */
43871 + pmz_maybe_update_regs(up);
43873 + spin_unlock_irqrestore(&up->port.lock, flags);
43875 + pr_debug("pmz: set_termios() done.\n");
43878 +static const char *pmz_type(struct uart_port *port)
43880 + return "PowerMac Zilog";
43883 +/* We do not request/release mappings of the registers here, this
43884 + * happens at early serial probe time.
43886 +static void pmz_release_port(struct uart_port *port)
43890 +static int pmz_request_port(struct uart_port *port)
43895 +/* These do not need to do anything interesting either. */
43896 +static void pmz_config_port(struct uart_port *port, int flags)
43900 +/* We do not support letting the user mess with the divisor, IRQ, etc. */
43901 +static int pmz_verify_port(struct uart_port *port, struct serial_struct *ser)
43906 +static struct uart_ops pmz_pops = {
43907 + .tx_empty = pmz_tx_empty,
43908 + .set_mctrl = pmz_set_mctrl,
43909 + .get_mctrl = pmz_get_mctrl,
43910 + .stop_tx = pmz_stop_tx,
43911 + .start_tx = pmz_start_tx,
43912 + .stop_rx = pmz_stop_rx,
43913 + .enable_ms = pmz_enable_ms,
43914 + .break_ctl = pmz_break_ctl,
43915 + .startup = pmz_startup,
43916 + .shutdown = pmz_shutdown,
43917 + .set_termios = pmz_set_termios,
43918 + .type = pmz_type,
43919 + .release_port = pmz_release_port,
43920 + .request_port = pmz_request_port,
43921 + .config_port = pmz_config_port,
43922 + .verify_port = pmz_verify_port,
43926 + * Setup one port structure after probing, HW is down at this point,
43927 + * Unlike sunzilog, we don't need to pre-init the spinlock as we don't
43928 + * register our console before uart_add_one_port() is called
43930 +static int __init pmz_setup_port(struct uart_pmac_port *up, int early)
43932 + struct device_node *np = up->node;
43934 + struct slot_names_prop {
43941 + * Request & map chip registers
43943 + if (!early && request_OF_resource(np, 0, NULL) == NULL) {
43944 + printk("pmac_zilog: failed to request resources for %s\n",
43948 + up->port.mapbase = np->addrs[0].address;
43949 + up->port.membase = ioremap(up->port.mapbase, 0x1000);
43951 + up->control_reg = (volatile u8 *)up->port.membase;
43952 + up->data_reg = up->control_reg + 0x10;
43955 + * Request & map DBDMA registers
43958 + if (np->n_addrs >= 3 && np->n_intrs >= 3)
43959 + up->flags |= PMACZILOG_FLAG_HAS_DMA;
43961 + if (ZS_HAS_DMA(up)) {
43962 + if (!early && request_OF_resource(np, np->n_addrs - 2, " (tx dma)") == NULL) {
43963 + printk(KERN_ERR "pmac_zilog: can't request TX DMA resource !\n");
43964 + up->flags &= ~PMACZILOG_FLAG_HAS_DMA;
43967 + if (!early && request_OF_resource(np, np->n_addrs - 1, " (rx dma)") == NULL) {
43968 + release_OF_resource(np, np->n_addrs - 2);
43969 + printk(KERN_ERR "pmac_zilog: can't request RX DMA resource !\n");
43970 + up->flags &= ~PMACZILOG_FLAG_HAS_DMA;
43973 + up->tx_dma_regs = (volatile struct dbdma_regs *)
43974 + ioremap(np->addrs[np->n_addrs - 2].address, 0x1000);
43975 + up->rx_dma_regs = (volatile struct dbdma_regs *)
43976 + ioremap(np->addrs[np->n_addrs - 1].address, 0x1000);
43977 + up->tx_dma_irq = np->intrs[1].line;
43978 + up->rx_dma_irq = np->intrs[2].line;
43982 + up->flags |= PMACZILOG_FLAG_RSRC_REQUESTED;
43985 + * Detect port type
43987 + if (device_is_compatible(np, "cobalt"))
43988 + up->flags |= PMACZILOG_FLAG_IS_INTMODEM;
43989 + conn = get_property(np, "AAPL,connector", &len);
43990 + if (conn && (strcmp(conn, "infrared") == 0))
43991 + up->flags |= PMACZILOG_FLAG_IS_IRDA;
43992 + up->port_type = PMAC_SCC_ASYNC;
43993 + /* 1999 Powerbook G3 has slot-names property instead */
43994 + slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
43995 + if (slots && slots->count > 0) {
43996 + if (strcmp(slots->name, "IrDA") == 0)
43997 + up->flags |= PMACZILOG_FLAG_IS_IRDA;
43998 + else if (strcmp(slots->name, "Modem") == 0)
43999 + up->flags |= PMACZILOG_FLAG_IS_INTMODEM;
44001 + if (ZS_IS_IRDA(up))
44002 + up->port_type = PMAC_SCC_IRDA;
44003 + if (ZS_IS_INTMODEM(up)) {
44004 + struct device_node* i2c_modem = find_devices("i2c-modem");
44006 + char* mid = get_property(i2c_modem, "modem-id", NULL);
44007 + if (mid) switch(*mid) {
44014 + up->port_type = PMAC_SCC_I2S1;
44016 + printk(KERN_INFO "pmac_zilog: i2c-modem detected, id: %d\n",
44017 + mid ? (*mid) : 0);
44019 + printk(KERN_INFO "pmac_zilog: serial modem detected\n");
44024 + * Init remaining bits of "port" structure
44026 + up->port.iotype = SERIAL_IO_MEM;
44027 + up->port.irq = np->intrs[0].line;
44028 + up->port.uartclk = ZS_CLOCK;
44029 + up->port.fifosize = 1;
44030 + up->port.ops = &pmz_pops;
44031 + up->port.type = PORT_PMAC_ZILOG;
44032 + up->port.flags = 0;
44038 + * Get rid of a port on module removal
44040 +static void pmz_dispose_port(struct uart_pmac_port *up)
44042 + struct device_node *np;
44044 + if (up->flags & PMACZILOG_FLAG_RSRC_REQUESTED) {
44045 + release_OF_resource(up->node, 0);
44046 + if (ZS_HAS_DMA(up)) {
44047 + release_OF_resource(up->node, up->node->n_addrs - 2);
44048 + release_OF_resource(up->node, up->node->n_addrs - 1);
44051 + iounmap((void *)up->control_reg);
44058 + * Called upon match with an escc node in the devive-tree.
44060 +static int pmz_attach(struct macio_dev *mdev, const struct of_match *match)
44064 + /* Iterate the pmz_ports array to find a matching entry
44066 + for (i = 0; i < MAX_ZS_PORTS; i++)
44067 + if (pmz_ports[i].node == mdev->ofdev.node) {
44068 + pmz_ports[i].dev = mdev;
44069 + dev_set_drvdata(&mdev->ofdev.dev, &pmz_ports[i]);
44076 + * That one should not be called, macio isn't really a hotswap device,
44077 + * we don't expect one of those serial ports to go away...
44079 +static int pmz_detach(struct macio_dev *mdev)
44081 + struct uart_pmac_port *port = dev_get_drvdata(&mdev->ofdev.dev);
44086 + dev_set_drvdata(&mdev->ofdev.dev, NULL);
44087 + port->dev = NULL;
44093 + * Probe all ports in the system and build the ports array, we register
44094 + * with the serial layer at this point, the macio-type probing is only
44095 + * used later to "attach" to the sysfs tree so we get power management
44098 +static int __init pmz_probe(int early)
44100 + struct device_node *node_p, *node_a, *node_b, *np;
44105 + * Find all escc chips in the system
44107 + node_p = of_find_node_by_name(NULL, "escc");
44110 + * First get channel A/B node pointers
44112 + * TODO: Add routines with proper locking to do that...
44114 + node_a = node_b = NULL;
44115 + for (np = NULL; (np = of_get_next_child(node_p, np)) != NULL;) {
44116 + if (strncmp(np->name, "ch-a", 4) == 0)
44117 + node_a = of_node_get(np);
44118 + else if (strncmp(np->name, "ch-b", 4) == 0)
44119 + node_b = of_node_get(np);
44121 + if (!node_a || !node_b) {
44122 + of_node_put(node_a);
44123 + of_node_put(node_b);
44124 + printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n",
44125 + (!node_a) ? 'a' : 'b', node_p->full_name);
44130 + * Fill basic fields in the port structures
44132 + pmz_ports[count].mate = &pmz_ports[count+1];
44133 + pmz_ports[count+1].mate = &pmz_ports[count];
44134 + pmz_ports[count].flags = PMACZILOG_FLAG_IS_CHANNEL_A;
44135 + pmz_ports[count].node = node_a;
44136 + pmz_ports[count+1].node = node_b;
44137 + pmz_ports[count].port.line = count;
44138 + pmz_ports[count+1].port.line = count+1;
44141 + * Setup the ports for real
44143 + rc = pmz_setup_port(&pmz_ports[count], early);
44145 + rc = pmz_setup_port(&pmz_ports[count+1], early);
44147 + of_node_put(node_a);
44148 + of_node_put(node_b);
44149 + memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port));
44150 + memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port));
44155 + node_p = of_find_node_by_name(node_p, "escc");
44157 + pmz_ports_count = count;
44162 +static struct uart_driver pmz_uart_reg = {
44163 + .owner = THIS_MODULE,
44164 + .driver_name = "ttyS",
44165 + .devfs_name = "tts/",
44166 + .dev_name = "ttyS",
44167 + .major = TTY_MAJOR,
44170 +#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
44172 +static void pmz_console_write(struct console *con, const char *s, unsigned int count);
44173 +static int __init pmz_console_setup(struct console *co, char *options);
44175 +static struct console pmz_console = {
44177 + .write = pmz_console_write,
44178 + .device = uart_console_device,
44179 + .setup = pmz_console_setup,
44180 + .flags = CON_PRINTBUFFER,
44182 + .data = &pmz_uart_reg,
44185 +#define PMACZILOG_CONSOLE &pmz_console
44186 +#else /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
44187 +#define PMACZILOG_CONSOLE (NULL)
44188 +#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
44191 + * Register the driver, console driver and ports with the serial
44194 +static int __init pmz_register(void)
44198 + pmz_uart_reg.nr = pmz_ports_count;
44199 + pmz_uart_reg.cons = PMACZILOG_CONSOLE;
44200 + pmz_uart_reg.minor = 64;
44203 + * Register this driver with the serial core
44205 + rc = uart_register_driver(&pmz_uart_reg);
44210 + * Register each port with the serial core
44212 + for (i = 0; i < pmz_ports_count; i++) {
44213 + struct uart_pmac_port *uport = &pmz_ports[i];
44214 + if (uport->node != NULL)
44215 + uart_add_one_port(&pmz_uart_reg, &uport->port);
44221 +static struct of_match pmz_match[] =
44225 + .type = OF_ANY_MATCH,
44226 + .compatible = OF_ANY_MATCH
44230 + .type = OF_ANY_MATCH,
44231 + .compatible = OF_ANY_MATCH
44236 +static struct macio_driver pmz_driver =
44238 + .name = "pmac_zilog",
44239 + .match_table = pmz_match,
44240 + .probe = pmz_attach,
44241 + .remove = pmz_detach,
44242 +// .suspend = pmz_suspend, *** NYI
44243 +// .resume = pmz_resume, *** NYI
44246 +static void pmz_fixup_resources(void)
44249 + for (i=0; i<pmz_ports_count; i++) {
44250 + struct uart_pmac_port *up = &pmz_ports[i];
44252 + if (up->node == NULL)
44254 + if (up->flags & PMACZILOG_FLAG_RSRC_REQUESTED)
44256 + if (request_OF_resource(up->node, 0, NULL) == NULL)
44257 + printk(KERN_WARNING "%s: Failed to do late IO resource request, port still active\n",
44259 + up->flags |= PMACZILOG_FLAG_RSRC_REQUESTED;
44260 + if (!ZS_HAS_DMA(up))
44262 + if (request_OF_resource(up->node, up->node->n_addrs - 2, NULL) == NULL)
44263 + printk(KERN_WARNING "%s: Failed to do late DMA resource request, port still active\n",
44265 + if (request_OF_resource(up->node, up->node->n_addrs - 1, NULL) == NULL)
44266 + printk(KERN_WARNING "%s: Failed to do late DMA resource request, port still active\n",
44272 +static int __init init_pmz(void)
44274 + printk(KERN_DEBUG "%s\n", version);
44277 + * If we had serial console, then we didn't request
44278 + * resources yet. We fix that up now
44280 + if (pmz_ports_count > 0)
44281 + pmz_fixup_resources();
44284 + * First, we need to do a direct OF-based probe pass. We
44285 + * do that because we want serial console up before the
44286 + * macio stuffs calls us back, and since that makes it
44287 + * easier to pass the proper number of channels to
44288 + * uart_register_driver()
44290 + if (pmz_ports_count == 0)
44294 + * Bail early if no port found
44296 + if (pmz_ports_count == 0)
44300 + * Now we register with the serial layer
44305 + * Then we register the macio driver itself
44307 + return macio_register_driver(&pmz_driver);
44310 +static void __exit exit_pmz(void)
44314 + /* Get rid of macio-driver (detach from macio) */
44315 + macio_unregister_driver(&pmz_driver);
44317 + /* Unregister UART driver */
44318 + uart_unregister_driver(&pmz_uart_reg);
44320 + for (i = 0; i < pmz_ports_count; i++) {
44321 + struct uart_pmac_port *uport = &pmz_ports[i];
44322 + if (uport->node != NULL) {
44323 + uart_remove_one_port(&pmz_uart_reg, &uport->port);
44324 + pmz_dispose_port(uport);
44329 +#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
44332 + * Print a string to the serial port trying not to disturb
44333 + * any possible real use of the port...
44335 +static void pmz_console_write(struct console *con, const char *s, unsigned int count)
44337 + struct uart_pmac_port *up = &pmz_ports[con->index];
44338 + unsigned long flags;
44341 + spin_lock_irqsave(&up->port.lock, flags);
44343 + /* Turn of interrupts and enable the transmitter. */
44344 + write_zsreg(up, R1, up->curregs[1] & ~TxINT_ENAB);
44345 + write_zsreg(up, R5, up->curregs[5] | TxENABLE | RTS | DTR);
44347 + for (i = 0; i < count; i++) {
44348 + /* Wait for the transmit buffer to empty. */
44349 + while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0)
44351 + write_zsdata(up, s[i]);
44352 + if (s[i] == 10) {
44353 + while ((read_zsreg(up, R0) & Tx_BUF_EMP) == 0)
44355 + write_zsdata(up, R13);
44359 + /* Restore the values in the registers. */
44360 + write_zsreg(up, R1, up->curregs[1]);
44361 + /* Don't disable the transmitter. */
44363 + spin_unlock_irqrestore(&up->port.lock, flags);
44367 + * Setup the serial console
44369 +static int __init pmz_console_setup(struct console *co, char *options)
44371 + struct uart_port *port;
44372 + int baud = 38400;
44374 + int parity = 'n';
44376 + unsigned long pwr_delay;
44379 + * XServe's default to 57600 bps
44381 + if (machine_is_compatible("RackMac1,1")
44382 + || machine_is_compatible("RackMac1,2"))
44386 + * Check whether an invalid uart number has been specified, and
44387 + * if so, search for the first available port that does have
44388 + * console support.
44390 + if (co->index >= pmz_ports_count)
44392 + port = &pmz_ports[co->index].port;
44395 + * Mark port as beeing a console
44397 + port->flags |= PMACZILOG_FLAG_IS_CONS;
44400 + * Temporary fix for uart layer who didn't setup the spinlock yet
44402 + spin_lock_init(&port->lock);
44405 + * Enable the hardware
44407 + pwr_delay = __pmz_startup(&pmz_ports[co->index]);
44409 + mdelay(pwr_delay);
44412 + uart_parse_options(options, &baud, &parity, &bits, &flow);
44414 + return uart_set_options(port, co, baud, parity, bits, flow);
44417 +static int __init pmz_console_init(void)
44419 + /* Probe ports */
44422 + /* TODO: Autoprobe console based on OF */
44423 + /* pmz_console.index = i; */
44424 + register_console(&pmz_console);
44429 +console_initcall(pmz_console_init);
44430 +#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
44432 +module_init(init_pmz);
44433 +module_exit(exit_pmz);
44434 diff -Nru a/drivers/serial/pmac_zilog.h b/drivers/serial/pmac_zilog.h
44435 --- /dev/null Wed Dec 31 16:00:00 1969
44436 +++ b/drivers/serial/pmac_zilog.h Sun Aug 24 08:05:54 2003
44438 +#ifndef __PMAC_ZILOG_H__
44439 +#define __PMAC_ZILOG_H__
44442 + * At most 2 ESCCs with 2 ports each
44444 +#define MAX_ZS_PORTS 4
44447 + * We wrap our port structure around the generic uart_port.
44449 +#define NUM_ZSREGS 16
44451 +struct uart_pmac_port {
44452 + struct uart_port port;
44453 + struct uart_pmac_port *mate;
44455 + /* macio_dev for the escc holding this port (maybe be null on
44456 + * early inited port)
44458 + struct macio_dev *dev;
44459 + /* device node to this port, this points to one of 2 childs
44460 + * of "escc" node (ie. ch-a or ch-b)
44462 + struct device_node *node;
44464 + /* Port type as obtained from device tree (IRDA, modem, ...) */
44466 + u8 curregs[NUM_ZSREGS];
44468 + unsigned int flags;
44469 +#define PMACZILOG_FLAG_IS_CONS 0x00000001
44470 +#define PMACZILOG_FLAG_IS_KGDB 0x00000002
44471 +#define PMACZILOG_FLAG_MODEM_STATUS 0x00000004
44472 +#define PMACZILOG_FLAG_IS_CHANNEL_A 0x00000008
44473 +#define PMACZILOG_FLAG_REGS_HELD 0x00000010
44474 +#define PMACZILOG_FLAG_TX_STOPPED 0x00000020
44475 +#define PMACZILOG_FLAG_TX_ACTIVE 0x00000040
44476 +#define PMACZILOG_FLAG_ENABLED 0x00000080
44477 +#define PMACZILOG_FLAG_IS_IRDA 0x00000100
44478 +#define PMACZILOG_FLAG_IS_INTMODEM 0x00000200
44479 +#define PMACZILOG_FLAG_HAS_DMA 0x00000400
44480 +#define PMACZILOG_FLAG_RSRC_REQUESTED 0x00000800
44482 + unsigned char parity_mask;
44483 + unsigned char prev_status;
44485 + volatile u8 *control_reg;
44486 + volatile u8 *data_reg;
44488 + unsigned int tx_dma_irq;
44489 + unsigned int rx_dma_irq;
44490 + volatile struct dbdma_regs *tx_dma_regs;
44491 + volatile struct dbdma_regs *rx_dma_regs;
44494 +#define to_pmz(p) ((struct uart_pmac_port *)(p))
44497 + * Register acessors. Note that we don't need to enforce a recovery
44498 + * delay on PCI PowerMac hardware, it's dealt in HW by the MacIO chip,
44499 + * though if we try to use this driver on older machines, we might have
44502 +static inline u8 read_zsreg(struct uart_pmac_port *port, u8 reg)
44505 + writeb(reg, port->control_reg);
44506 + return readb(port->control_reg);
44509 +static inline void write_zsreg(struct uart_pmac_port *port, u8 reg, u8 value)
44512 + writeb(reg, port->control_reg);
44513 + writeb(value, port->control_reg);
44516 +static inline u8 read_zsdata(struct uart_pmac_port *port)
44518 + return readb(port->data_reg);
44521 +static inline void write_zsdata(struct uart_pmac_port *port, u8 data)
44523 + writeb(data, port->data_reg);
44526 +static inline void zssync(struct uart_pmac_port *port)
44528 + (void)readb(port->control_reg);
44531 +/* Conversion routines to/from brg time constants from/to bits
44534 +#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
44535 +#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
44537 +#define ZS_CLOCK 3686400 /* Z8530 RTxC input clock rate */
44539 +/* The Zilog register set */
44543 +/* Write Register 0 */
44544 +#define R0 0 /* Register selects */
44561 +#define NULLCODE 0 /* Null Code */
44562 +#define POINT_HIGH 0x8 /* Select upper half of registers */
44563 +#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */
44564 +#define SEND_ABORT 0x18 /* HDLC Abort */
44565 +#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */
44566 +#define RES_Tx_P 0x28 /* Reset TxINT Pending */
44567 +#define ERR_RES 0x30 /* Error Reset */
44568 +#define RES_H_IUS 0x38 /* Reset highest IUS */
44570 +#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */
44571 +#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */
44572 +#define RES_EOM_L 0xC0 /* Reset EOM latch */
44574 +/* Write Register 1 */
44576 +#define EXT_INT_ENAB 0x1 /* Ext Int Enable */
44577 +#define TxINT_ENAB 0x2 /* Tx Int Enable */
44578 +#define PAR_SPEC 0x4 /* Parity is special condition */
44580 +#define RxINT_DISAB 0 /* Rx Int Disable */
44581 +#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */
44582 +#define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */
44583 +#define INT_ERR_Rx 0x18 /* Int on error only */
44584 +#define RxINT_MASK 0x18
44586 +#define WT_RDY_RT 0x20 /* W/Req reflects recv if 1, xmit if 0 */
44587 +#define WT_FN_RDYFN 0x40 /* W/Req pin is DMA request if 1, wait if 0 */
44588 +#define WT_RDY_ENAB 0x80 /* Enable W/Req pin */
44590 +/* Write Register #2 (Interrupt Vector) */
44592 +/* Write Register 3 */
44594 +#define RxENABLE 0x1 /* Rx Enable */
44595 +#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */
44596 +#define ADD_SM 0x4 /* Address Search Mode (SDLC) */
44597 +#define RxCRC_ENAB 0x8 /* Rx CRC Enable */
44598 +#define ENT_HM 0x10 /* Enter Hunt Mode */
44599 +#define AUTO_ENAB 0x20 /* Auto Enables */
44600 +#define Rx5 0x0 /* Rx 5 Bits/Character */
44601 +#define Rx7 0x40 /* Rx 7 Bits/Character */
44602 +#define Rx6 0x80 /* Rx 6 Bits/Character */
44603 +#define Rx8 0xc0 /* Rx 8 Bits/Character */
44604 +#define RxN_MASK 0xc0
44606 +/* Write Register 4 */
44608 +#define PAR_ENAB 0x1 /* Parity Enable */
44609 +#define PAR_EVEN 0x2 /* Parity Even/Odd* */
44611 +#define SYNC_ENAB 0 /* Sync Modes Enable */
44612 +#define SB1 0x4 /* 1 stop bit/char */
44613 +#define SB15 0x8 /* 1.5 stop bits/char */
44614 +#define SB2 0xc /* 2 stop bits/char */
44615 +#define SB_MASK 0xc
44617 +#define MONSYNC 0 /* 8 Bit Sync character */
44618 +#define BISYNC 0x10 /* 16 bit sync character */
44619 +#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */
44620 +#define EXTSYNC 0x30 /* External Sync Mode */
44622 +#define X1CLK 0x0 /* x1 clock mode */
44623 +#define X16CLK 0x40 /* x16 clock mode */
44624 +#define X32CLK 0x80 /* x32 clock mode */
44625 +#define X64CLK 0xC0 /* x64 clock mode */
44626 +#define XCLK_MASK 0xC0
44628 +/* Write Register 5 */
44630 +#define TxCRC_ENAB 0x1 /* Tx CRC Enable */
44631 +#define RTS 0x2 /* RTS */
44632 +#define SDLC_CRC 0x4 /* SDLC/CRC-16 */
44633 +#define TxENABLE 0x8 /* Tx Enable */
44634 +#define SND_BRK 0x10 /* Send Break */
44635 +#define Tx5 0x0 /* Tx 5 bits (or less)/character */
44636 +#define Tx7 0x20 /* Tx 7 bits/character */
44637 +#define Tx6 0x40 /* Tx 6 bits/character */
44638 +#define Tx8 0x60 /* Tx 8 bits/character */
44639 +#define TxN_MASK 0x60
44640 +#define DTR 0x80 /* DTR */
44642 +/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */
44644 +/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */
44646 +/* Write Register 7' (Some enhanced feature control) */
44647 +#define ENEXREAD 0x40 /* Enable read of some write registers */
44649 +/* Write Register 8 (transmit buffer) */
44651 +/* Write Register 9 (Master interrupt control) */
44652 +#define VIS 1 /* Vector Includes Status */
44653 +#define NV 2 /* No Vector */
44654 +#define DLC 4 /* Disable Lower Chain */
44655 +#define MIE 8 /* Master Interrupt Enable */
44656 +#define STATHI 0x10 /* Status high */
44657 +#define NORESET 0 /* No reset on write to R9 */
44658 +#define CHRB 0x40 /* Reset channel B */
44659 +#define CHRA 0x80 /* Reset channel A */
44660 +#define FHWRES 0xc0 /* Force hardware reset */
44662 +/* Write Register 10 (misc control bits) */
44663 +#define BIT6 1 /* 6 bit/8bit sync */
44664 +#define LOOPMODE 2 /* SDLC Loop mode */
44665 +#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */
44666 +#define MARKIDLE 8 /* Mark/flag on idle */
44667 +#define GAOP 0x10 /* Go active on poll */
44668 +#define NRZ 0 /* NRZ mode */
44669 +#define NRZI 0x20 /* NRZI mode */
44670 +#define FM1 0x40 /* FM1 (transition = 1) */
44671 +#define FM0 0x60 /* FM0 (transition = 0) */
44672 +#define CRCPS 0x80 /* CRC Preset I/O */
44674 +/* Write Register 11 (Clock Mode control) */
44675 +#define TRxCXT 0 /* TRxC = Xtal output */
44676 +#define TRxCTC 1 /* TRxC = Transmit clock */
44677 +#define TRxCBR 2 /* TRxC = BR Generator Output */
44678 +#define TRxCDP 3 /* TRxC = DPLL output */
44679 +#define TRxCOI 4 /* TRxC O/I */
44680 +#define TCRTxCP 0 /* Transmit clock = RTxC pin */
44681 +#define TCTRxCP 8 /* Transmit clock = TRxC pin */
44682 +#define TCBR 0x10 /* Transmit clock = BR Generator output */
44683 +#define TCDPLL 0x18 /* Transmit clock = DPLL output */
44684 +#define RCRTxCP 0 /* Receive clock = RTxC pin */
44685 +#define RCTRxCP 0x20 /* Receive clock = TRxC pin */
44686 +#define RCBR 0x40 /* Receive clock = BR Generator output */
44687 +#define RCDPLL 0x60 /* Receive clock = DPLL output */
44688 +#define RTxCX 0x80 /* RTxC Xtal/No Xtal */
44690 +/* Write Register 12 (lower byte of baud rate generator time constant) */
44692 +/* Write Register 13 (upper byte of baud rate generator time constant) */
44694 +/* Write Register 14 (Misc control bits) */
44695 +#define BRENAB 1 /* Baud rate generator enable */
44696 +#define BRSRC 2 /* Baud rate generator source */
44697 +#define DTRREQ 4 /* DTR/Request function */
44698 +#define AUTOECHO 8 /* Auto Echo */
44699 +#define LOOPBAK 0x10 /* Local loopback */
44700 +#define SEARCH 0x20 /* Enter search mode */
44701 +#define RMC 0x40 /* Reset missing clock */
44702 +#define DISDPLL 0x60 /* Disable DPLL */
44703 +#define SSBR 0x80 /* Set DPLL source = BR generator */
44704 +#define SSRTxC 0xa0 /* Set DPLL source = RTxC */
44705 +#define SFMM 0xc0 /* Set FM mode */
44706 +#define SNRZI 0xe0 /* Set NRZI mode */
44708 +/* Write Register 15 (external/status interrupt control) */
44709 +#define EN85C30 1 /* Enable some 85c30-enhanced registers */
44710 +#define ZCIE 2 /* Zero count IE */
44711 +#define ENSTFIFO 4 /* Enable status FIFO (SDLC) */
44712 +#define DCDIE 8 /* DCD IE */
44713 +#define SYNCIE 0x10 /* Sync/hunt IE */
44714 +#define CTSIE 0x20 /* CTS IE */
44715 +#define TxUIE 0x40 /* Tx Underrun/EOM IE */
44716 +#define BRKIE 0x80 /* Break/Abort IE */
44719 +/* Read Register 0 */
44720 +#define Rx_CH_AV 0x1 /* Rx Character Available */
44721 +#define ZCOUNT 0x2 /* Zero count */
44722 +#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
44723 +#define DCD 0x8 /* DCD */
44724 +#define SYNC_HUNT 0x10 /* Sync/hunt */
44725 +#define CTS 0x20 /* CTS */
44726 +#define TxEOM 0x40 /* Tx underrun */
44727 +#define BRK_ABRT 0x80 /* Break/Abort */
44729 +/* Read Register 1 */
44730 +#define ALL_SNT 0x1 /* All sent */
44731 +/* Residue Data for 8 Rx bits/char programmed */
44732 +#define RES3 0x8 /* 0/3 */
44733 +#define RES4 0x4 /* 0/4 */
44734 +#define RES5 0xc /* 0/5 */
44735 +#define RES6 0x2 /* 0/6 */
44736 +#define RES7 0xa /* 0/7 */
44737 +#define RES8 0x6 /* 0/8 */
44738 +#define RES18 0xe /* 1/8 */
44739 +#define RES28 0x0 /* 2/8 */
44740 +/* Special Rx Condition Interrupts */
44741 +#define PAR_ERR 0x10 /* Parity error */
44742 +#define Rx_OVR 0x20 /* Rx Overrun Error */
44743 +#define CRC_ERR 0x40 /* CRC/Framing Error */
44744 +#define END_FR 0x80 /* End of Frame (SDLC) */
44746 +/* Read Register 2 (channel b only) - Interrupt vector */
44747 +#define CHB_Tx_EMPTY 0x00
44748 +#define CHB_EXT_STAT 0x02
44749 +#define CHB_Rx_AVAIL 0x04
44750 +#define CHB_SPECIAL 0x06
44751 +#define CHA_Tx_EMPTY 0x08
44752 +#define CHA_EXT_STAT 0x0a
44753 +#define CHA_Rx_AVAIL 0x0c
44754 +#define CHA_SPECIAL 0x0e
44755 +#define STATUS_MASK 0x06
44757 +/* Read Register 3 (interrupt pending register) ch a only */
44758 +#define CHBEXT 0x1 /* Channel B Ext/Stat IP */
44759 +#define CHBTxIP 0x2 /* Channel B Tx IP */
44760 +#define CHBRxIP 0x4 /* Channel B Rx IP */
44761 +#define CHAEXT 0x8 /* Channel A Ext/Stat IP */
44762 +#define CHATxIP 0x10 /* Channel A Tx IP */
44763 +#define CHARxIP 0x20 /* Channel A Rx IP */
44765 +/* Read Register 8 (receive data register) */
44767 +/* Read Register 10 (misc status bits) */
44768 +#define ONLOOP 2 /* On loop */
44769 +#define LOOPSEND 0x10 /* Loop sending */
44770 +#define CLK2MIS 0x40 /* Two clocks missing */
44771 +#define CLK1MIS 0x80 /* One clock missing */
44773 +/* Read Register 12 (lower byte of baud rate generator constant) */
44775 +/* Read Register 13 (upper byte of baud rate generator constant) */
44777 +/* Read Register 15 (value of WR 15) */
44780 +#define ZS_CLEARERR(port) (write_zsreg(port, 0, ERR_RES))
44781 +#define ZS_CLEARFIFO(port) do { volatile unsigned char garbage; \
44782 + garbage = read_zsdata(port); \
44783 + garbage = read_zsdata(port); \
44784 + garbage = read_zsdata(port); \
44787 +#define ZS_IS_CONS(UP) ((UP)->flags & PMACZILOG_FLAG_IS_CONS)
44788 +#define ZS_IS_KGDB(UP) ((UP)->flags & PMACZILOG_FLAG_IS_KGDB)
44789 +#define ZS_IS_CHANNEL_A(UP) ((UP)->flags & PMACZILOG_FLAG_IS_CHANNEL_A)
44790 +#define ZS_REGS_HELD(UP) ((UP)->flags & PMACZILOG_FLAG_REGS_HELD)
44791 +#define ZS_TX_STOPPED(UP) ((UP)->flags & PMACZILOG_FLAG_TX_STOPPED)
44792 +#define ZS_TX_ACTIVE(UP) ((UP)->flags & PMACZILOG_FLAG_TX_ACTIVE)
44793 +#define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & PMACZILOG_FLAG_MODEM_STATUS)
44794 +#define ZS_IS_IRDA(UP) ((UP)->flags & PMACZILOG_FLAG_IS_IRDA)
44795 +#define ZS_IS_INTMODEM(UP) ((UP)->flags & PMACZILOG_FLAG_IS_INTMODEM)
44796 +#define ZS_HAS_DMA(UP) ((UP)->flags & PMACZILOG_FLAG_HAS_DMA)
44798 +#endif /* __PMAC_ZILOG_H__ */
44799 diff -Nru a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
44800 --- a/drivers/telephony/ixj.c Sun Jul 27 12:29:47 2003
44801 +++ b/drivers/telephony/ixj.c Tue Aug 26 09:25:41 2003
44802 @@ -278,8 +278,8 @@
44806 -#define TYPE(dev) (minor(dev) >> 4)
44807 -#define NUM(dev) (minor(dev) & 0xf)
44808 +#define TYPE(inode) (iminor(inode) >> 4)
44809 +#define NUM(inode) (iminor(inode) & 0xf)
44811 static int ixjdebug;
44812 static int hertz = HZ;
44813 @@ -2273,7 +2273,7 @@
44814 schedule_timeout(1);
44816 if (ixjdebug & 0x0002)
44817 - printk(KERN_INFO "Closing board %d\n", NUM(inode->i_rdev));
44818 + printk(KERN_INFO "Closing board %d\n", NUM(inode));
44820 if (j->cardtype == QTI_PHONECARD)
44821 ixj_set_port(j, PORT_SPEAKER);
44822 @@ -2858,7 +2858,7 @@
44823 static ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos)
44825 unsigned long i = *ppos;
44826 - IXJ * j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
44827 + IXJ * j = get_ixj(NUM(file_p->f_dentry->d_inode));
44829 DECLARE_WAITQUEUE(wait, current);
44831 @@ -2915,7 +2915,7 @@
44834 ssize_t read_retval = 0;
44835 - IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
44836 + IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
44838 pre_retval = ixj_PreRead(j, 0L);
44839 switch (pre_retval) {
44840 @@ -2994,7 +2994,7 @@
44842 ssize_t write_retval = 0;
44844 - IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
44845 + IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
44847 pre_retval = ixj_PreWrite(j, 0L);
44848 switch (pre_retval) {
44849 @@ -4707,7 +4707,7 @@
44851 unsigned int mask = 0;
44853 - IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
44854 + IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
44856 poll_wait(file_p, &(j->poll_q), wait);
44857 if (j->read_buffer_ready > 0)
44858 @@ -6208,10 +6208,10 @@
44859 IXJ_FILTER_RAW jfr;
44861 unsigned int raise, mant;
44862 - unsigned int minor = minor(inode->i_rdev);
44863 - int board = NUM(inode->i_rdev);
44864 + unsigned int minor = iminor(inode);
44865 + int board = NUM(inode);
44867 - IXJ *j = get_ixj(NUM(inode->i_rdev));
44868 + IXJ *j = get_ixj(NUM(inode));
44872 @@ -6764,7 +6764,7 @@
44874 static int ixj_fasync(int fd, struct file *file_p, int mode)
44876 - IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode->i_rdev));
44877 + IXJ *j = get_ixj(NUM(file_p->f_dentry->d_inode));
44879 return fasync_helper(fd, file_p, mode, &j->async_queue);
44881 diff -Nru a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
44882 --- a/drivers/telephony/phonedev.c Mon Jul 14 09:05:52 2003
44883 +++ b/drivers/telephony/phonedev.c Tue Aug 26 09:25:41 2003
44886 static int phone_open(struct inode *inode, struct file *file)
44888 - unsigned int minor = minor(inode->i_rdev);
44889 + unsigned int minor = iminor(inode);
44891 struct phone_device *p;
44892 struct file_operations *old_fops, *new_fops = NULL;
44893 diff -Nru a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
44894 --- a/drivers/usb/class/audio.c Wed Jul 30 11:00:01 2003
44895 +++ b/drivers/usb/class/audio.c Tue Aug 26 09:25:41 2003
44896 @@ -1955,7 +1955,7 @@
44898 static int usb_audio_open_mixdev(struct inode *inode, struct file *file)
44900 - unsigned int minor = minor(inode->i_rdev);
44901 + unsigned int minor = iminor(inode);
44902 struct list_head *devs, *mdevs;
44903 struct usb_mixerdev *ms;
44904 struct usb_audio_state *s;
44905 @@ -2633,7 +2633,7 @@
44907 static int usb_audio_open(struct inode *inode, struct file *file)
44909 - unsigned int minor = minor(inode->i_rdev);
44910 + unsigned int minor = iminor(inode);
44911 DECLARE_WAITQUEUE(wait, current);
44912 struct list_head *devs, *adevs;
44913 struct usb_audiodev *as;
44914 diff -Nru a/drivers/usb/class/usb-midi.c b/drivers/usb/class/usb-midi.c
44915 --- a/drivers/usb/class/usb-midi.c Tue Jul 29 04:28:54 2003
44916 +++ b/drivers/usb/class/usb-midi.c Tue Aug 26 09:25:41 2003
44917 @@ -812,7 +812,7 @@
44919 static int usb_midi_open(struct inode *inode, struct file *file)
44921 - int minor = minor(inode->i_rdev);
44922 + int minor = iminor(inode);
44923 DECLARE_WAITQUEUE(wait, current);
44924 struct list_head *devs, *mdevs;
44925 struct usb_midi_state *s;
44926 diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
44927 --- a/drivers/usb/class/usblp.c Sun Aug 10 02:01:53 2003
44928 +++ b/drivers/usb/class/usblp.c Tue Aug 26 09:25:41 2003
44929 @@ -318,7 +318,7 @@
44931 static int usblp_open(struct inode *inode, struct file *file)
44933 - int minor = minor(inode->i_rdev);
44934 + int minor = iminor(inode);
44935 struct usblp *usblp;
44936 struct usb_interface *intf;
44938 diff -Nru a/drivers/usb/core/file.c b/drivers/usb/core/file.c
44939 --- a/drivers/usb/core/file.c Wed Aug 13 06:35:23 2003
44940 +++ b/drivers/usb/core/file.c Tue Aug 26 09:25:41 2003
44943 static int usb_open(struct inode * inode, struct file * file)
44945 - int minor = minor(inode->i_rdev);
44946 + int minor = iminor(inode);
44947 struct file_operations *c;
44949 struct file_operations *old_fops, *new_fops = NULL;
44950 diff -Nru a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
44951 --- a/drivers/usb/host/ohci-sa1111.c Thu Jul 31 13:51:23 2003
44952 +++ b/drivers/usb/host/ohci-sa1111.c Sun Aug 24 07:45:05 2003
44953 @@ -352,9 +352,8 @@
44955 /*-------------------------------------------------------------------------*/
44957 -static int ohci_hcd_sa1111_drv_probe(struct device *_dev)
44958 +static int ohci_hcd_sa1111_drv_probe(struct sa1111_dev *dev)
44960 - struct sa1111_dev *dev = SA1111_DEV(_dev);
44961 struct usb_hcd *hcd = NULL;
44964 @@ -364,43 +363,29 @@
44965 ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, &hcd, dev);
44968 - dev->dev.driver_data = hcd;
44969 + sa1111_set_drvdata(dev, hcd);
44974 -static int ohci_hcd_sa1111_drv_remove(struct device *_dev)
44975 +static int ohci_hcd_sa1111_drv_remove(struct sa1111_dev *dev)
44977 - struct sa1111_dev *dev = SA1111_DEV(_dev);
44978 - struct usb_hcd *hcd = dev->dev.driver_data;
44979 + struct usb_hcd *hcd = sa1111_get_drvdata(dev);
44981 usb_hcd_sa1111_remove(hcd, dev);
44983 - dev->dev.driver_data = NULL;
44984 + sa1111_set_drvdata(dev, NULL);
44989 -static int ohci_hcd_sa1111_drv_suspend(struct device *dev, u32 state, u32 level)
44994 -static int ohci_hcd_sa1111_drv_resume(struct device *dev, u32 level)
44999 static struct sa1111_driver ohci_hcd_sa1111_driver = {
45001 - .name = "sa1111-ohci",
45002 - .bus = &sa1111_bus_type,
45003 - .probe = ohci_hcd_sa1111_drv_probe,
45004 - .remove = ohci_hcd_sa1111_drv_remove,
45005 - .suspend = ohci_hcd_sa1111_drv_suspend,
45006 - .resume = ohci_hcd_sa1111_drv_resume,
45007 + .name = "sa1111-ohci",
45009 - .devid = SA1111_DEVID_USB,
45010 + .devid = SA1111_DEVID_USB,
45011 + .probe = ohci_hcd_sa1111_drv_probe,
45012 + .remove = ohci_hcd_sa1111_drv_remove,
45015 static int __init ohci_hcd_sa1111_init (void)
45016 @@ -409,12 +394,12 @@
45017 dbg ("block sizes: ed %d td %d",
45018 sizeof (struct ed), sizeof (struct td));
45020 - return driver_register(&ohci_hcd_sa1111_driver.drv);
45021 + return sa1111_driver_register(&ohci_hcd_sa1111_driver);
45024 static void __exit ohci_hcd_sa1111_cleanup (void)
45026 - driver_unregister(&ohci_hcd_sa1111_driver.drv);
45027 + sa1111_driver_unregister(&ohci_hcd_sa1111_driver);
45030 module_init (ohci_hcd_sa1111_init);
45031 diff -Nru a/drivers/usb/image/scanner.h b/drivers/usb/image/scanner.h
45032 --- a/drivers/usb/image/scanner.h Tue Jul 15 02:37:52 2003
45033 +++ b/drivers/usb/image/scanner.h Tue Aug 26 09:25:41 2003
45034 @@ -313,7 +313,7 @@
45035 #define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
45036 #define IS_EP_INTR(ep) ((ep)->bmAttributes == USB_ENDPOINT_XFER_INT ? 1 : 0)
45038 -#define USB_SCN_MINOR(X) minor((X)->i_rdev)
45039 +#define USB_SCN_MINOR(X) iminor(X)
45042 #define SCN_DEBUG(X) X
45043 diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
45044 --- a/drivers/usb/input/hiddev.c Wed Jun 11 07:58:27 2003
45045 +++ b/drivers/usb/input/hiddev.c Tue Aug 26 09:25:41 2003
45046 @@ -271,7 +271,7 @@
45047 static int hiddev_open(struct inode * inode, struct file * file) {
45048 struct hiddev_list *list;
45050 - int i = minor(inode->i_rdev) - HIDDEV_MINOR_BASE;
45051 + int i = iminor(inode) - HIDDEV_MINOR_BASE;
45053 if (i >= HIDDEV_MINORS || !hiddev_table[i])
45055 diff -Nru a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c
45056 --- a/drivers/usb/media/dabusb.c Mon Aug 11 07:56:25 2003
45057 +++ b/drivers/usb/media/dabusb.c Tue Aug 26 09:25:41 2003
45058 @@ -583,7 +583,7 @@
45060 static int dabusb_open (struct inode *inode, struct file *file)
45062 - int devnum = minor (inode->i_rdev);
45063 + int devnum = iminor(inode);
45066 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
45067 diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
45068 --- a/drivers/usb/misc/auerswald.c Wed Jul 30 06:14:48 2003
45069 +++ b/drivers/usb/misc/auerswald.c Tue Aug 26 09:25:41 2003
45070 @@ -1380,7 +1380,7 @@
45071 /* Open a new character device */
45072 static int auerchar_open (struct inode *inode, struct file *file)
45074 - int dtindex = minor(inode->i_rdev);
45075 + int dtindex = iminor(inode);
45076 pauerswald_t cp = NULL;
45077 pauerchar_t ccp = NULL;
45078 struct usb_interface *intf;
45079 diff -Nru a/drivers/usb/misc/brlvger.c b/drivers/usb/misc/brlvger.c
45080 --- a/drivers/usb/misc/brlvger.c Tue Jul 29 04:28:54 2003
45081 +++ b/drivers/usb/misc/brlvger.c Tue Aug 26 09:25:41 2003
45082 @@ -432,7 +432,7 @@
45084 brlvger_open(struct inode *inode, struct file *file)
45086 - int devnum = minor (inode->i_rdev);
45087 + int devnum = iminor(inode);
45088 struct usb_interface *intf = NULL;
45089 struct brlvger_priv *priv = NULL;
45091 diff -Nru a/drivers/usb/misc/tiglusb.c b/drivers/usb/misc/tiglusb.c
45092 --- a/drivers/usb/misc/tiglusb.c Mon Aug 11 07:56:25 2003
45093 +++ b/drivers/usb/misc/tiglusb.c Tue Aug 26 09:25:41 2003
45096 tiglusb_open (struct inode *inode, struct file *filp)
45098 - int devnum = minor (inode->i_rdev);
45099 + int devnum = iminor(inode);
45102 if (devnum < TIUSB_MINOR || devnum >= (TIUSB_MINOR + MAXTIGL))
45103 diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
45104 --- a/drivers/usb/serial/digi_acceleport.c Wed Aug 13 03:06:57 2003
45105 +++ b/drivers/usb/serial/digi_acceleport.c Sun Aug 31 16:14:01 2003
45106 @@ -218,7 +218,7 @@
45108 * - digi_write_bulk_callback() and digi_read_bulk_callback() are
45109 * called directly from interrupts. Hence spin_lock_irqsave()
45110 -* and spin_lock_irqrestore() are used in the rest of the code
45111 +* and spin_unlock_irqrestore() are used in the rest of the code
45112 * for any locks they acquire.
45113 * - digi_write_bulk_callback() gets the port lock before waking up
45114 * processes sleeping on the port write_wait. It also schedules
45115 @@ -571,7 +571,7 @@
45117 * Do spin_unlock_irqrestore and interruptible_sleep_on_timeout
45118 * so that wake ups are not lost if they occur between the unlock
45119 -* and the sleep. In other words, spin_lock_irqrestore and
45120 +* and the sleep. In other words, spin_unlock_irqrestore and
45121 * interruptible_sleep_on_timeout are "atomic" with respect to
45122 * wake ups. This is used to implement condition variables.
45124 diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
45125 --- a/drivers/usb/usb-skeleton.c Wed Aug 6 02:20:34 2003
45126 +++ b/drivers/usb/usb-skeleton.c Tue Aug 26 09:25:41 2003
45127 @@ -229,7 +229,7 @@
45129 dbg("%s", __FUNCTION__);
45131 - subminor = minor (inode->i_rdev);
45132 + subminor = iminor(inode);
45134 /* prevent disconnects */
45135 down (&disconnect_sem);
45136 diff -Nru a/drivers/video/68328fb.c b/drivers/video/68328fb.c
45137 --- a/drivers/video/68328fb.c Fri Dec 6 12:36:20 2002
45138 +++ b/drivers/video/68328fb.c Sun Aug 31 16:14:08 2003
45139 @@ -401,12 +401,12 @@
45140 ((1<<(width))-1)) : 0))
45142 static struct fb_ops mc68328_fb_ops = {
45143 - .owner: THIS_MODULE,
45144 - .fb_setcolreg: mc68328fb_setcolreg,
45145 - .fb_fillrect: cfbfillrect,
45146 - .fb_copyarea: cfbcopyarea,
45147 - .fb_imageblit: cfbimgblt,
45148 - .fb_cursor: softcursor,
45149 + .owner = THIS_MODULE,
45150 + .fb_setcolreg = mc68328fb_setcolreg,
45151 + .fb_fillrect = cfbfillrect,
45152 + .fb_copyarea = cfbcopyarea,
45153 + .fb_imageblit = cfbimgblt,
45154 + .fb_cursor = softcursor,
45158 diff -Nru a/drivers/video/Makefile b/drivers/video/Makefile
45159 --- a/drivers/video/Makefile Sun May 25 08:40:39 2003
45160 +++ b/drivers/video/Makefile Sun Aug 24 08:05:27 2003
45162 obj-$(CONFIG_FB_RADEON) += radeonfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45163 obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45164 obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45165 -obj-$(CONFIG_FB_CONTROL) += controlfb.o
45166 -obj-$(CONFIG_FB_PLATINUM) += platinumfb.o
45167 +obj-$(CONFIG_FB_CONTROL) += controlfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45168 +obj-$(CONFIG_FB_PLATINUM) += platinumfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45169 obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45170 obj-$(CONFIG_FB_CT65550) += chipsfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45171 obj-$(CONFIG_FB_ANAKIN) += anakinfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
45172 diff -Nru a/drivers/video/controlfb.c b/drivers/video/controlfb.c
45173 --- a/drivers/video/controlfb.c Thu Apr 24 03:30:41 2003
45174 +++ b/drivers/video/controlfb.c Sun Aug 24 06:15:21 2003
45175 @@ -475,7 +475,7 @@
45177 /* Apply default var */
45178 var.activate = FB_ACTIVATE_NOW;
45179 - rc = fb_set_var(&var, &p->info);
45180 + rc = fb_set_var(&p->info, &var);
45181 if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8))
45184 diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
45185 --- a/drivers/video/fbmem.c Wed Jul 23 07:45:30 2003
45186 +++ b/drivers/video/fbmem.c Tue Aug 26 09:25:41 2003
45187 @@ -768,7 +768,7 @@
45189 unsigned long p = *ppos;
45190 struct inode *inode = file->f_dentry->d_inode;
45191 - int fbidx = minor(inode->i_rdev);
45192 + int fbidx = iminor(inode);
45193 struct fb_info *info = registered_fb[fbidx];
45195 if (!info || ! info->screen_base)
45196 @@ -802,7 +802,7 @@
45198 unsigned long p = *ppos;
45199 struct inode *inode = file->f_dentry->d_inode;
45200 - int fbidx = minor(inode->i_rdev);
45201 + int fbidx = iminor(inode);
45202 struct fb_info *info = registered_fb[fbidx];
45205 @@ -964,7 +964,7 @@
45206 fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
45209 - int fbidx = minor(inode->i_rdev);
45210 + int fbidx = iminor(inode);
45211 struct fb_info *info = registered_fb[fbidx];
45212 struct fb_ops *fb = info->fbops;
45213 struct fb_var_screeninfo var;
45214 @@ -1050,7 +1050,7 @@
45216 fb_mmap(struct file *file, struct vm_area_struct * vma)
45218 - int fbidx = minor(file->f_dentry->d_inode->i_rdev);
45219 + int fbidx = iminor(file->f_dentry->d_inode);
45220 struct fb_info *info = registered_fb[fbidx];
45221 struct fb_ops *fb = info->fbops;
45223 @@ -1149,7 +1149,7 @@
45225 fb_open(struct inode *inode, struct file *file)
45227 - int fbidx = minor(inode->i_rdev);
45228 + int fbidx = iminor(inode);
45229 struct fb_info *info;
45232 @@ -1174,7 +1174,7 @@
45234 fb_release(struct inode *inode, struct file *file)
45236 - int fbidx = minor(inode->i_rdev);
45237 + int fbidx = iminor(inode);
45238 struct fb_info *info;
45241 diff -Nru a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
45242 --- a/drivers/video/platinumfb.c Thu Apr 24 03:30:41 2003
45243 +++ b/drivers/video/platinumfb.c Sun Aug 24 07:51:47 2003
45245 #include <asm/io.h>
45246 #include <asm/prom.h>
45247 #include <asm/pgtable.h>
45248 +#include <asm/of_device.h>
45250 #include "macmodes.h"
45251 #include "platinumfb.h"
45253 * internal functions
45256 -static void platinum_of_init(struct device_node *dp);
45257 static inline int platinum_vram_reqd(int video_mode, int color_mode);
45258 static int read_platinum_sense(struct fb_info_platinum *info);
45259 static void set_platinum_clock(struct fb_info_platinum *info);
45260 @@ -323,7 +323,7 @@
45262 * Set misc info vars for this driver
45264 -static void __init platinum_init_info(struct fb_info *info, struct fb_info_platinum *p)
45265 +static void __devinit platinum_init_info(struct fb_info *info, struct fb_info_platinum *p)
45268 info->par = &p->par;
45269 @@ -349,7 +349,7 @@
45273 -static int __init init_platinum(struct fb_info_platinum *p)
45274 +static int __devinit platinum_init_fb(struct fb_info_platinum *p)
45276 struct fb_var_screeninfo var;
45278 @@ -399,126 +399,21 @@
45279 /* Apply default var */
45281 var.activate = FB_ACTIVATE_NOW;
45282 - rc = fb_set_var(&var, &p->info);
45283 + rc = fb_set_var(&p->info, &var);
45284 if (rc && (default_vmode != VMODE_640_480_60 || default_cmode != CMODE_8))
45287 /* Register with fbdev layer */
45288 - if (register_framebuffer(&p->info) < 0)
45290 + rc = register_framebuffer(&p->info);
45294 printk(KERN_INFO "fb%d: platinum frame buffer device\n",
45300 -int __init platinum_init(void)
45302 - struct device_node *dp;
45304 - dp = find_devices("platinum");
45306 - platinum_of_init(dp);
45310 -#ifdef __powerpc__
45311 -#define invalidate_cache(addr) \
45312 - asm volatile("eieio; dcbf 0,%1" \
45313 - : "=m" (*(addr)) : "r" (addr) : "memory");
45315 -#define invalidate_cache(addr)
45318 -static void __init platinum_of_init(struct device_node *dp)
45320 - struct fb_info_platinum *info;
45321 - unsigned long addr, size;
45322 - volatile __u8 *fbuffer;
45323 - int i, bank0, bank1, bank2, bank3;
45325 - if(dp->n_addrs != 2) {
45326 - printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs);
45330 - info = kmalloc(sizeof(*info), GFP_ATOMIC);
45333 - memset(info, 0, sizeof(*info));
45335 - /* Map in frame buffer and registers */
45336 - for (i = 0; i < dp->n_addrs; ++i) {
45337 - addr = dp->addrs[i].address;
45338 - size = dp->addrs[i].size;
45339 - /* Let's assume we can request either all or nothing */
45340 - if (!request_mem_region(addr, size, "platinumfb")) {
45344 - if (size >= 0x400000) {
45345 - /* frame buffer - map only 4MB */
45346 - info->frame_buffer_phys = addr;
45347 - info->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
45348 - info->base_frame_buffer = info->frame_buffer;
45351 - info->platinum_regs_phys = addr;
45352 - info->platinum_regs = ioremap(addr, size);
45356 - info->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */
45357 - request_mem_region(info->cmap_regs_phys, 0x1000, "platinumfb cmap");
45358 - info->cmap_regs = ioremap(info->cmap_regs_phys, 0x1000);
45360 - /* Grok total video ram */
45361 - out_be32(&info->platinum_regs->reg[16].r, (unsigned)info->frame_buffer_phys);
45362 - out_be32(&info->platinum_regs->reg[20].r, 0x1011); /* select max vram */
45363 - out_be32(&info->platinum_regs->reg[24].r, 0); /* switch in vram */
45365 - fbuffer = info->base_frame_buffer;
45366 - fbuffer[0x100000] = 0x34;
45367 - fbuffer[0x100008] = 0x0;
45368 - invalidate_cache(&fbuffer[0x100000]);
45369 - fbuffer[0x200000] = 0x56;
45370 - fbuffer[0x200008] = 0x0;
45371 - invalidate_cache(&fbuffer[0x200000]);
45372 - fbuffer[0x300000] = 0x78;
45373 - fbuffer[0x300008] = 0x0;
45374 - invalidate_cache(&fbuffer[0x300000]);
45375 - bank0 = 1; /* builtin 1MB vram, always there */
45376 - bank1 = fbuffer[0x100000] == 0x34;
45377 - bank2 = fbuffer[0x200000] == 0x56;
45378 - bank3 = fbuffer[0x300000] == 0x78;
45379 - info->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
45380 - printk(KERN_INFO "Total VRAM = %dMB %d%d%d%d\n", (int) (info->total_vram / 1024 / 1024), bank3, bank2, bank1, bank0);
45383 - * Try to determine whether we have an old or a new DACula.
45385 - out_8(&info->cmap_regs->addr, 0x40);
45386 - info->dactype = in_8(&info->cmap_regs->d2);
45387 - switch (info->dactype) {
45389 - info->clktype = 1;
45392 - info->clktype = 0;
45395 - info->clktype = 0;
45396 - printk(KERN_INFO "Unknown DACula type: %x\n", info->dactype);
45400 - if (!init_platinum(info)) {
45407 * Get the monitor sense value.
45408 * Note that this can be called before calibrate_delay,
45409 @@ -630,4 +525,169 @@
45413 +#ifdef __powerpc__
45414 +#define invalidate_cache(addr) \
45415 + asm volatile("eieio; dcbf 0,%1" \
45416 + : "=m" (*(addr)) : "r" (addr) : "memory");
45418 +#define invalidate_cache(addr)
45421 +static int __devinit platinumfb_probe(struct of_device* odev, const struct of_match *match)
45423 + struct device_node *dp = odev->node;
45424 + struct fb_info_platinum *info;
45425 + unsigned long addr, size;
45426 + volatile __u8 *fbuffer;
45427 + int i, bank0, bank1, bank2, bank3, rc;
45429 + if (dp->n_addrs != 2) {
45430 + printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs);
45434 + info = kmalloc(sizeof(*info), GFP_ATOMIC);
45437 + memset(info, 0, sizeof(*info));
45439 + /* Map in frame buffer and registers */
45440 + for (i = 0; i < dp->n_addrs; ++i) {
45441 + addr = dp->addrs[i].address;
45442 + size = dp->addrs[i].size;
45443 + /* Let's assume we can request either all or nothing */
45444 + if (!request_mem_region(addr, size, "platinumfb")) {
45448 + if (size >= 0x400000) {
45449 + /* frame buffer - map only 4MB */
45450 + info->frame_buffer_phys = addr;
45451 + info->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU);
45452 + info->base_frame_buffer = info->frame_buffer;
45455 + info->platinum_regs_phys = addr;
45456 + info->platinum_regs = ioremap(addr, size);
45460 + info->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */
45461 + request_mem_region(info->cmap_regs_phys, 0x1000, "platinumfb cmap");
45462 + info->cmap_regs = ioremap(info->cmap_regs_phys, 0x1000);
45464 + /* Grok total video ram */
45465 + out_be32(&info->platinum_regs->reg[16].r, (unsigned)info->frame_buffer_phys);
45466 + out_be32(&info->platinum_regs->reg[20].r, 0x1011); /* select max vram */
45467 + out_be32(&info->platinum_regs->reg[24].r, 0); /* switch in vram */
45469 + fbuffer = info->base_frame_buffer;
45470 + fbuffer[0x100000] = 0x34;
45471 + fbuffer[0x100008] = 0x0;
45472 + invalidate_cache(&fbuffer[0x100000]);
45473 + fbuffer[0x200000] = 0x56;
45474 + fbuffer[0x200008] = 0x0;
45475 + invalidate_cache(&fbuffer[0x200000]);
45476 + fbuffer[0x300000] = 0x78;
45477 + fbuffer[0x300008] = 0x0;
45478 + invalidate_cache(&fbuffer[0x300000]);
45479 + bank0 = 1; /* builtin 1MB vram, always there */
45480 + bank1 = fbuffer[0x100000] == 0x34;
45481 + bank2 = fbuffer[0x200000] == 0x56;
45482 + bank3 = fbuffer[0x300000] == 0x78;
45483 + info->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
45484 + printk(KERN_INFO "Total VRAM = %dMB %d%d%d%d\n", (int) (info->total_vram / 1024 / 1024), bank3, bank2, bank1, bank0);
45487 + * Try to determine whether we have an old or a new DACula.
45489 + out_8(&info->cmap_regs->addr, 0x40);
45490 + info->dactype = in_8(&info->cmap_regs->d2);
45491 + switch (info->dactype) {
45493 + info->clktype = 1;
45496 + info->clktype = 0;
45499 + info->clktype = 0;
45500 + printk(KERN_INFO "Unknown DACula type: %x\n", info->dactype);
45503 + dev_set_drvdata(&odev->dev, info);
45505 + rc = platinum_init_fb(info);
45507 + dev_set_drvdata(&odev->dev, NULL);
45514 +static int __devexit platinumfb_remove(struct of_device* odev)
45516 + struct fb_info_platinum *pinfo = dev_get_drvdata(&odev->dev);
45517 + struct device_node *dp = odev->node;
45518 + unsigned long addr, size;
45524 + unregister_framebuffer (&pinfo->info);
45526 + /* Unmap frame buffer and registers */
45527 + for (i = 0; i < dp->n_addrs; ++i) {
45528 + addr = dp->addrs[i].address;
45529 + size = dp->addrs[i].size;
45530 + release_mem_region(addr, size);
45532 + iounmap((void *)pinfo->frame_buffer);
45533 + iounmap((void *)pinfo->platinum_regs);
45534 + release_mem_region(pinfo->cmap_regs_phys, 0x1000);
45535 + iounmap((void *)pinfo->cmap_regs);
45542 +static struct of_match platinumfb_match[] =
45545 + .name = "platinum",
45546 + .type = OF_ANY_MATCH,
45547 + .compatible = OF_ANY_MATCH,
45552 +static struct of_platform_driver platinum_driver =
45554 + .name = "platinumfb",
45555 + .match_table = platinumfb_match,
45556 + .probe = platinumfb_probe,
45557 + .remove = platinumfb_remove,
45560 +int __init platinum_init(void)
45562 + of_register_driver(&platinum_driver);
45567 +void __exit platinum_exit(void)
45569 + of_unregister_driver(&platinum_driver);
45572 MODULE_LICENSE("GPL");
45573 +MODULE_DESCRIPTION("framebuffer driver for Apple Platinum video");
45576 +module_init(platinum_init);
45577 +module_exit(platinum_exit);
45579 diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
45580 --- a/drivers/video/riva/fbdev.c Thu Jul 31 08:58:45 2003
45581 +++ b/drivers/video/riva/fbdev.c Sun Aug 31 16:14:08 2003
45582 @@ -297,34 +297,34 @@
45585 static struct fb_fix_screeninfo rivafb_fix = {
45587 - type: FB_TYPE_PACKED_PIXELS,
45591 + .type = FB_TYPE_PACKED_PIXELS,
45596 static struct fb_var_screeninfo rivafb_default_var = {
45599 - xres_virtual: 640,
45600 - yres_virtual: 480,
45601 - bits_per_pixel: 8,
45603 - green: {0, 8, 0},
45605 - transp: {0, 0, 0},
45606 - activate: FB_ACTIVATE_NOW,
45609 - accel_flags: FB_ACCELF_TEXT,
45612 - right_margin: 24,
45613 - upper_margin: 32,
45614 - lower_margin: 11,
45617 - vmode: FB_VMODE_NONINTERLACED
45620 + .xres_virtual = 640,
45621 + .yres_virtual = 480,
45622 + .bits_per_pixel = 8,
45623 + .red = {0, 8, 0},
45624 + .green = {0, 8, 0},
45625 + .blue = {0, 8, 0},
45626 + .transp = {0, 0, 0},
45627 + .activate = FB_ACTIVATE_NOW,
45630 + .accel_flags = FB_ACCELF_TEXT,
45631 + .pixclock = 39721,
45632 + .left_margin = 40,
45633 + .right_margin = 24,
45634 + .upper_margin = 32,
45635 + .lower_margin = 11,
45638 + .vmode = FB_VMODE_NONINTERLACED
45642 @@ -1977,10 +1977,10 @@
45643 #endif /* !MODULE */
45645 static struct pci_driver rivafb_driver = {
45647 - id_table: rivafb_pci_tbl,
45648 - probe: rivafb_probe,
45649 - remove: __exit_p(rivafb_remove),
45650 + .name = "rivafb",
45651 + .id_table = rivafb_pci_tbl,
45652 + .probe = rivafb_probe,
45653 + .remove = __exit_p(rivafb_remove),
45657 diff -Nru a/drivers/video/stifb.c b/drivers/video/stifb.c
45658 --- a/drivers/video/stifb.c Sat May 31 23:26:17 2003
45659 +++ b/drivers/video/stifb.c Tue Aug 26 09:25:41 2003
45660 @@ -890,7 +890,7 @@
45662 unsigned long p = *ppos;
45663 struct inode *inode = file->f_dentry->d_inode;
45664 - int fbidx = minor(inode->i_rdev);
45665 + int fbidx = iminor(inode);
45666 struct fb_info *info = registered_fb[fbidx];
45667 char tmpbuf[TMPBUFLEN];
45669 @@ -922,7 +922,7 @@
45670 stifb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
45672 struct inode *inode = file->f_dentry->d_inode;
45673 - int fbidx = minor(inode->i_rdev);
45674 + int fbidx = iminor(inode);
45675 struct fb_info *info = registered_fb[fbidx];
45676 unsigned long p = *ppos;
45678 diff -Nru a/fs/affs/file.c b/fs/affs/file.c
45679 --- a/fs/affs/file.c Sat Dec 14 09:42:09 2002
45680 +++ b/fs/affs/file.c Sun Aug 31 16:14:08 2003
45681 @@ -793,8 +793,8 @@
45683 struct address_space_operations affs_aops_ofs = {
45684 .readpage = affs_readpage_ofs,
45685 - //writepage: affs_writepage_ofs,
45686 - //sync_page: affs_sync_page_ofs,
45687 + //.writepage = affs_writepage_ofs,
45688 + //.sync_page = affs_sync_page_ofs,
45689 .prepare_write = affs_prepare_write_ofs,
45690 .commit_write = affs_commit_write_ofs
45692 diff -Nru a/fs/afs/callback.c b/fs/afs/callback.c
45693 --- a/fs/afs/callback.c Tue Oct 8 01:00:44 2002
45694 +++ b/fs/afs/callback.c Tue Aug 26 09:37:39 2003
45695 @@ -146,7 +146,7 @@
45696 spin_unlock(&vnode->lock);
45699 - invalidate_inode_pages(inode->i_mapping);
45700 + invalidate_remote_inode(inode);
45701 afs_put_server(server);
45704 diff -Nru a/fs/afs/dir.c b/fs/afs/dir.c
45705 --- a/fs/afs/dir.c Thu Jul 3 06:36:44 2003
45706 +++ b/fs/afs/dir.c Tue Aug 26 09:37:39 2003
45707 @@ -569,7 +569,7 @@
45708 spin_lock(&AFS_FS_I(inode)->lock);
45709 AFS_FS_I(inode)->flags |= AFS_VNODE_DELETED;
45710 spin_unlock(&AFS_FS_I(inode)->lock);
45711 - invalidate_inode_pages(inode->i_mapping);
45712 + invalidate_remote_inode(inode);
45716 diff -Nru a/fs/bad_inode.c b/fs/bad_inode.c
45717 --- a/fs/bad_inode.c Tue Dec 3 11:20:54 2002
45718 +++ b/fs/bad_inode.c Sun Aug 31 16:14:21 2003
45720 * Copyright (C) 1997, Stephen Tweedie
45722 * Provide stub functions for unreadable inodes
45724 + * Fabian Frederick : August 2003 - All file operations assigned to EIO
45727 #include <linux/fs.h>
45729 static struct file_operations bad_file_ops =
45731 .llseek = EIO_ERROR,
45732 + .aio_read = EIO_ERROR,
45734 .write = EIO_ERROR,
45735 + .aio_write = EIO_ERROR,
45736 .readdir = EIO_ERROR,
45738 .ioctl = EIO_ERROR,
45740 .flush = EIO_ERROR,
45741 .release = EIO_ERROR,
45742 .fsync = EIO_ERROR,
45743 + .aio_fsync = EIO_ERROR,
45744 .fasync = EIO_ERROR,
45746 + .readv = EIO_ERROR,
45747 + .writev = EIO_ERROR,
45748 + .sendfile = EIO_ERROR,
45749 + .sendpage = EIO_ERROR,
45750 + .get_unmapped_area = EIO_ERROR,
45753 struct inode_operations bad_inode_ops =
45755 .truncate = EIO_ERROR,
45756 .permission = EIO_ERROR,
45757 .getattr = EIO_ERROR,
45758 + .setattr = EIO_ERROR,
45759 + .setxattr = EIO_ERROR,
45760 + .getxattr = EIO_ERROR,
45761 + .listxattr = EIO_ERROR,
45762 + .removexattr = EIO_ERROR,
45766 diff -Nru a/fs/bio.c b/fs/bio.c
45767 --- a/fs/bio.c Fri May 2 11:30:24 2003
45768 +++ b/fs/bio.c Thu Aug 21 07:58:40 2003
45769 @@ -793,10 +793,6 @@
45770 mempool_free_slab, bp->slab);
45772 panic("biovec: can't init mempool\n");
45774 - printk("biovec pool[%d]: %3d bvecs: %3d entries (%d bytes)\n",
45775 - i, bp->nr_vecs, pool_entries,
45780 @@ -809,8 +805,6 @@
45781 bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
45783 panic("bio: can't create mempool\n");
45785 - printk("BIO: pool of %d setup, %ZuKb (%Zd bytes/bio)\n", BIO_POOL_SIZE, BIO_POOL_SIZE * sizeof(struct bio) >> 10, sizeof(struct bio));
45787 biovec_init_pools();
45789 diff -Nru a/fs/block_dev.c b/fs/block_dev.c
45790 --- a/fs/block_dev.c Wed Aug 20 22:31:51 2003
45791 +++ b/fs/block_dev.c Tue Aug 26 12:06:15 2003
45792 @@ -197,40 +197,36 @@
45796 -static struct super_block *bd_get_sb(struct file_system_type *fs_type,
45797 - int flags, const char *dev_name, void *data)
45799 - return get_sb_pseudo(fs_type, "bdev:", NULL, 0x62646576);
45801 +static spinlock_t bdev_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
45802 +static kmem_cache_t * bdev_cachep;
45804 -static struct file_system_type bd_type = {
45806 - .get_sb = bd_get_sb,
45807 - .kill_sb = kill_anon_super,
45808 +struct bdev_inode {
45809 + struct block_device bdev;
45810 + struct inode vfs_inode;
45813 -static struct vfsmount *bd_mnt;
45814 -struct super_block *blockdev_superblock;
45817 - * bdev cache handling - shamelessly stolen from inode.c
45818 - * We use smaller hashtable, though.
45820 +static inline struct bdev_inode *BDEV_I(struct inode *inode)
45822 + return container_of(inode, struct bdev_inode, vfs_inode);
45825 -#define HASH_BITS 6
45826 -#define HASH_SIZE (1UL << HASH_BITS)
45827 -#define HASH_MASK (HASH_SIZE-1)
45828 -static struct list_head bdev_hashtable[HASH_SIZE];
45829 -static spinlock_t bdev_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
45830 -static kmem_cache_t * bdev_cachep;
45831 +static struct inode *bdev_alloc_inode(struct super_block *sb)
45833 + struct bdev_inode *ei = kmem_cache_alloc(bdev_cachep, SLAB_KERNEL);
45836 + return &ei->vfs_inode;
45839 -#define alloc_bdev() \
45840 - ((struct block_device *) kmem_cache_alloc(bdev_cachep, SLAB_KERNEL))
45841 -#define destroy_bdev(bdev) kmem_cache_free(bdev_cachep, (bdev))
45842 +static void bdev_destroy_inode(struct inode *inode)
45844 + kmem_cache_free(bdev_cachep, BDEV_I(inode));
45847 static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
45849 - struct block_device * bdev = (struct block_device *) foo;
45850 + struct bdev_inode *ei = (struct bdev_inode *) foo;
45851 + struct block_device *bdev = &ei->bdev;
45853 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
45854 SLAB_CTOR_CONSTRUCTOR)
45855 @@ -238,25 +234,62 @@
45856 memset(bdev, 0, sizeof(*bdev));
45857 sema_init(&bdev->bd_sem, 1);
45858 INIT_LIST_HEAD(&bdev->bd_inodes);
45859 + INIT_LIST_HEAD(&bdev->bd_list);
45860 + inode_init_once(&ei->vfs_inode);
45864 -void __init bdev_cache_init(void)
45865 +static inline void __bd_forget(struct inode *inode)
45867 + list_del_init(&inode->i_devices);
45868 + inode->i_bdev = NULL;
45869 + inode->i_mapping = &inode->i_data;
45872 +static void bdev_clear_inode(struct inode *inode)
45874 + struct block_device *bdev = &BDEV_I(inode)->bdev;
45875 + struct list_head *p;
45876 + spin_lock(&bdev_lock);
45877 + while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
45878 + __bd_forget(list_entry(p, struct inode, i_devices));
45880 + list_del_init(&bdev->bd_list);
45881 + spin_unlock(&bdev_lock);
45884 +static struct super_operations bdev_sops = {
45885 + .statfs = simple_statfs,
45886 + .alloc_inode = bdev_alloc_inode,
45887 + .destroy_inode = bdev_destroy_inode,
45888 + .drop_inode = generic_delete_inode,
45889 + .clear_inode = bdev_clear_inode,
45892 +static struct super_block *bd_get_sb(struct file_system_type *fs_type,
45893 + int flags, const char *dev_name, void *data)
45896 - struct list_head *head = bdev_hashtable;
45897 + return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
45900 +static struct file_system_type bd_type = {
45902 + .get_sb = bd_get_sb,
45903 + .kill_sb = kill_anon_super,
45908 - INIT_LIST_HEAD(head);
45912 +static struct vfsmount *bd_mnt;
45913 +struct super_block *blockdev_superblock;
45915 +void __init bdev_cache_init(void)
45918 bdev_cachep = kmem_cache_create("bdev_cache",
45919 - sizeof(struct block_device),
45920 - 0, SLAB_HWCACHE_ALIGN, init_once,
45922 + sizeof(struct bdev_inode),
45924 + SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
45928 panic("Cannot create bdev_cache SLAB cache");
45929 err = register_filesystem(&bd_type);
45930 @@ -272,123 +305,83 @@
45932 * Most likely _very_ bad one - but then it's hardly critical for small
45933 * /dev and can be fixed when somebody will need really large one.
45934 + * Keep in mind that it will be fed through icache hash function too.
45936 static inline unsigned long hash(dev_t dev)
45938 - unsigned long tmp = dev;
45939 - tmp = tmp + (tmp >> HASH_BITS) + (tmp >> HASH_BITS*2);
45940 - return tmp & HASH_MASK;
45941 + return MAJOR(dev)+MINOR(dev);
45944 -static struct block_device *bdfind(dev_t dev, struct list_head *head)
45945 +static int bdev_test(struct inode *inode, void *data)
45947 - struct list_head *p;
45948 - struct block_device *bdev;
45949 - list_for_each(p, head) {
45950 - bdev = list_entry(p, struct block_device, bd_hash);
45951 - if (bdev->bd_dev != dev)
45953 - atomic_inc(&bdev->bd_count);
45957 + return BDEV_I(inode)->bdev.bd_dev == *(dev_t *)data;
45960 +static int bdev_set(struct inode *inode, void *data)
45962 + BDEV_I(inode)->bdev.bd_dev = *(dev_t *)data;
45966 +static LIST_HEAD(all_bdevs);
45968 struct block_device *bdget(dev_t dev)
45970 - struct list_head * head = bdev_hashtable + hash(dev);
45971 - struct block_device *bdev, *new_bdev;
45972 - spin_lock(&bdev_lock);
45973 - bdev = bdfind(dev, head);
45974 - spin_unlock(&bdev_lock);
45977 - new_bdev = alloc_bdev();
45979 - struct inode *inode = new_inode(bd_mnt->mnt_sb);
45981 - kdev_t kdev = to_kdev_t(dev);
45983 - atomic_set(&new_bdev->bd_count,1);
45984 - new_bdev->bd_dev = dev;
45985 - new_bdev->bd_contains = NULL;
45986 - new_bdev->bd_inode = inode;
45987 - new_bdev->bd_block_size = (1 << inode->i_blkbits);
45988 - new_bdev->bd_part_count = 0;
45989 - new_bdev->bd_invalidated = 0;
45990 - inode->i_mode = S_IFBLK;
45991 - inode->i_rdev = kdev;
45992 - inode->i_bdev = new_bdev;
45993 - inode->i_data.a_ops = &def_blk_aops;
45994 - mapping_set_gfp_mask(&inode->i_data, GFP_USER);
45995 - inode->i_data.backing_dev_info = &default_backing_dev_info;
45996 - spin_lock(&bdev_lock);
45997 - bdev = bdfind(dev, head);
45999 - list_add(&new_bdev->bd_hash, head);
46000 - spin_unlock(&bdev_lock);
46003 - spin_unlock(&bdev_lock);
46004 - iput(new_bdev->bd_inode);
46006 - destroy_bdev(new_bdev);
46007 + struct block_device *bdev;
46008 + struct inode *inode;
46010 + inode = iget5_locked(bd_mnt->mnt_sb, hash(dev),
46011 + bdev_test, bdev_set, &dev);
46016 + bdev = &BDEV_I(inode)->bdev;
46018 + if (inode->i_state & I_NEW) {
46019 + bdev->bd_contains = NULL;
46020 + bdev->bd_inode = inode;
46021 + bdev->bd_block_size = (1 << inode->i_blkbits);
46022 + bdev->bd_part_count = 0;
46023 + bdev->bd_invalidated = 0;
46024 + inode->i_mode = S_IFBLK;
46025 + inode->i_rdev = to_kdev_t(dev);
46026 + inode->i_bdev = bdev;
46027 + inode->i_data.a_ops = &def_blk_aops;
46028 + mapping_set_gfp_mask(&inode->i_data, GFP_USER);
46029 + inode->i_data.backing_dev_info = &default_backing_dev_info;
46030 + spin_lock(&bdev_lock);
46031 + list_add(&bdev->bd_list, &all_bdevs);
46032 + spin_unlock(&bdev_lock);
46033 + unlock_new_inode(inode);
46038 long nr_blockdev_pages(void)
46040 + struct list_head *p;
46044 spin_lock(&bdev_lock);
46045 - for (i = 0; i < ARRAY_SIZE(bdev_hashtable); i++) {
46046 - struct list_head *head = &bdev_hashtable[i];
46047 - struct list_head *lh;
46049 - if (head == NULL)
46051 - list_for_each(lh, head) {
46052 - struct block_device *bdev;
46054 - bdev = list_entry(lh, struct block_device, bd_hash);
46055 - ret += bdev->bd_inode->i_mapping->nrpages;
46057 + list_for_each(p, &all_bdevs) {
46058 + struct block_device *bdev;
46059 + bdev = list_entry(p, struct block_device, bd_list);
46060 + ret += bdev->bd_inode->i_mapping->nrpages;
46062 spin_unlock(&bdev_lock);
46066 -static inline void __bd_forget(struct inode *inode)
46068 - list_del_init(&inode->i_devices);
46069 - inode->i_bdev = NULL;
46070 - inode->i_mapping = &inode->i_data;
46073 void bdput(struct block_device *bdev)
46075 - if (atomic_dec_and_lock(&bdev->bd_count, &bdev_lock)) {
46076 - struct list_head *p;
46077 - if (bdev->bd_openers)
46079 - list_del(&bdev->bd_hash);
46080 - while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
46081 - __bd_forget(list_entry(p, struct inode, i_devices));
46083 - spin_unlock(&bdev_lock);
46084 - iput(bdev->bd_inode);
46085 - destroy_bdev(bdev);
46087 + iput(bdev->bd_inode);
46090 int bd_acquire(struct inode *inode)
46092 struct block_device *bdev;
46093 spin_lock(&bdev_lock);
46094 - if (inode->i_bdev) {
46095 - atomic_inc(&inode->i_bdev->bd_count);
46096 + if (inode->i_bdev && igrab(inode->i_bdev->bd_inode)) {
46097 spin_unlock(&bdev_lock);
46100 @@ -397,12 +390,11 @@
46103 spin_lock(&bdev_lock);
46104 - if (!inode->i_bdev) {
46105 - inode->i_bdev = bdev;
46106 - inode->i_mapping = bdev->bd_inode->i_mapping;
46107 - list_add(&inode->i_devices, &bdev->bd_inodes);
46108 - } else if (inode->i_bdev != bdev)
46110 + if (inode->i_bdev)
46111 + __bd_forget(inode);
46112 + inode->i_bdev = bdev;
46113 + inode->i_mapping = bdev->bd_inode->i_mapping;
46114 + list_add(&inode->i_devices, &bdev->bd_inodes);
46115 spin_unlock(&bdev_lock);
46118 @@ -548,7 +540,6 @@
46122 - bdev->bd_offset = 0;
46123 if (!bdev->bd_openers) {
46124 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
46125 bdi = blk_get_backing_dev_info(bdev);
46126 @@ -580,7 +571,8 @@
46130 - bdev->bd_offset = p->start_sect;
46131 + kobject_get(&p->kobj);
46132 + bdev->bd_part = p;
46133 bd_set_size(bdev, (loff_t) p->nr_sects << 9);
46134 up(&whole->bd_sem);
46136 @@ -701,6 +693,10 @@
46140 + if (bdev->bd_contains != bdev) {
46141 + kobject_put(&bdev->bd_part->kobj);
46142 + bdev->bd_part = NULL;
46144 bdev->bd_disk = NULL;
46145 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
46146 if (bdev != bdev->bd_contains) {
46147 diff -Nru a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
46148 --- a/fs/cifs/cifsfs.c Sun Aug 10 22:50:41 2003
46149 +++ b/fs/cifs/cifsfs.c Tue Aug 26 09:37:39 2003
46150 @@ -598,10 +598,12 @@
46151 netfid = oplock_item->netfid;
46152 DeleteOplockQEntry(oplock_item);
46153 write_unlock(&GlobalMid_Lock);
46154 - rc = filemap_fdatawrite(inode->i_mapping);
46156 - CIFS_I(inode)->write_behind_rc
46158 + if (S_ISREG(inode->i_mode))
46159 + rc = filemap_fdatawrite(inode->i_mapping);
46163 + CIFS_I(inode)->write_behind_rc = rc;
46164 cFYI(1,("Oplock flush inode %p rc %d",inode,rc));
46165 rc = CIFSSMBLock(0, pTcon, netfid,
46166 0 /* len */ , 0 /* offset */, 0,
46167 diff -Nru a/fs/coda/inode.c b/fs/coda/inode.c
46168 --- a/fs/coda/inode.c Fri Jun 20 13:16:06 2003
46169 +++ b/fs/coda/inode.c Tue Aug 26 09:25:41 2003
46170 @@ -115,7 +115,7 @@
46171 inode = file->f_dentry->d_inode;
46173 if(!inode || !S_ISCHR(inode->i_mode) ||
46174 - major(inode->i_rdev) != CODA_PSDEV_MAJOR) {
46175 + imajor(inode) != CODA_PSDEV_MAJOR) {
46179 @@ -123,7 +123,7 @@
46183 - idx = minor(inode->i_rdev);
46184 + idx = iminor(inode);
46187 if(idx < 0 || idx >= MAX_CODADEVS) {
46188 diff -Nru a/fs/coda/psdev.c b/fs/coda/psdev.c
46189 --- a/fs/coda/psdev.c Wed May 7 08:47:30 2003
46190 +++ b/fs/coda/psdev.c Tue Aug 26 09:25:41 2003
46191 @@ -279,7 +279,7 @@
46195 - idx = minor(inode->i_rdev);
46196 + idx = iminor(inode);
46197 if(idx >= MAX_CODADEVS) {
46200 diff -Nru a/fs/compat.c b/fs/compat.c
46201 --- a/fs/compat.c Sun Jul 13 14:26:23 2003
46202 +++ b/fs/compat.c Sun Aug 31 16:14:44 2003
46203 @@ -227,7 +227,8 @@
46204 #define IOCTL_HASHSIZE 256
46205 struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE];
46207 -extern struct ioctl_trans ioctl_start[], ioctl_end[];
46208 +extern struct ioctl_trans ioctl_start[];
46209 +extern int ioctl_table_size;
46211 static inline unsigned long ioctl32_hash(unsigned long cmd)
46213 @@ -255,7 +256,7 @@
46217 - for (i = 0; &ioctl_start[i] < &ioctl_end[0]; i++) {
46218 + for (i = 0; i < ioctl_table_size; i++) {
46219 if (ioctl_start[i].next != 0) {
46220 printk("ioctl translation %d bad\n",i);
46222 @@ -318,8 +319,7 @@
46224 static inline int builtin_ioctl(struct ioctl_trans *t)
46226 - return t >= (struct ioctl_trans *)ioctl_start &&
46227 - t < (struct ioctl_trans *)ioctl_end;
46228 + return t >= ioctl_start && t < (ioctl_start + ioctl_table_size);
46232 diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c
46233 --- a/fs/compat_ioctl.c Thu Jul 3 15:19:48 2003
46234 +++ b/fs/compat_ioctl.c Tue Aug 26 09:25:40 2003
46235 @@ -1573,7 +1573,7 @@
46238 tty = (struct tty_struct *)file->private_data;
46239 - if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
46240 + if (tty_paranoia_check(tty, inode, "tty_ioctl"))
46243 if (tty->driver->ioctl != vt_ioctl)
46244 diff -Nru a/fs/dnotify.c b/fs/dnotify.c
46245 --- a/fs/dnotify.c Wed Apr 2 22:51:32 2003
46246 +++ b/fs/dnotify.c Sun Aug 31 16:14:42 2003
46248 #include <linux/spinlock.h>
46249 #include <linux/slab.h>
46251 -extern void send_sigio(struct fown_struct *fown, int fd, int band);
46253 int dir_notify_enable = 1;
46255 static rwlock_t dn_lock = RW_LOCK_UNLOCKED;
46257 prev = &odn->dn_next;
46260 - error = f_setown(filp, current->pid, 1);
46261 + error = f_setown(filp, current->tgid, 1);
46265 diff -Nru a/fs/ext2/namei.c b/fs/ext2/namei.c
46266 --- a/fs/ext2/namei.c Sun Jun 29 23:49:04 2003
46267 +++ b/fs/ext2/namei.c Sun Aug 31 16:14:21 2003
46268 @@ -143,7 +143,7 @@
46269 int err = PTR_ERR(inode);
46270 if (!IS_ERR(inode)) {
46271 init_special_inode(inode, inode->i_mode, rdev);
46272 -#ifdef CONFIG_EXT2_FS_EXT_ATTR
46273 +#ifdef CONFIG_EXT2_FS_XATTR
46274 inode->i_op = &ext2_special_inode_operations;
46276 mark_inode_dirty(inode);
46277 diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c
46278 --- a/fs/ext3/namei.c Wed Aug 20 22:32:02 2003
46279 +++ b/fs/ext3/namei.c Sun Aug 31 16:14:18 2003
46280 @@ -1306,7 +1306,7 @@
46282 /* The 0th block becomes the root, move the dirents out */
46283 fde = &root->dotdot;
46284 - de = (struct ext3_dir_entry_2 *)((char *)fde + fde->rec_len);
46285 + de = (struct ext3_dir_entry_2 *)((char *)fde + le16_to_cpu(fde->rec_len));
46286 len = ((char *) root) + blocksize - (char *) de;
46287 memcpy (data1, de, len);
46288 de = (struct ext3_dir_entry_2 *) data1;
46289 diff -Nru a/fs/ext3/xattr.c b/fs/ext3/xattr.c
46290 --- a/fs/ext3/xattr.c Thu Jul 17 22:30:42 2003
46291 +++ b/fs/ext3/xattr.c Sun Aug 31 16:15:47 2003
46292 @@ -873,17 +873,22 @@
46293 const void *value, size_t value_len, int flags)
46296 - int error, error2;
46299 handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
46300 - if (IS_ERR(handle))
46301 + if (IS_ERR(handle)) {
46302 error = PTR_ERR(handle);
46307 error = ext3_xattr_set_handle(handle, inode, name_index, name,
46308 value, value_len, flags);
46309 - error2 = ext3_journal_stop(handle);
46310 + error2 = ext3_journal_stop(handle);
46315 - return error ? error : error2;
46320 diff -Nru a/fs/fcntl.c b/fs/fcntl.c
46321 --- a/fs/fcntl.c Thu Jun 5 23:36:40 2003
46322 +++ b/fs/fcntl.c Sun Aug 31 16:14:42 2003
46325 #include <linux/init.h>
46326 #include <linux/mm.h>
46327 +#include <linux/fs.h>
46328 #include <linux/file.h>
46329 #include <linux/dnotify.h>
46330 #include <linux/smp_lock.h>
46332 #include <asm/poll.h>
46333 #include <asm/siginfo.h>
46334 #include <asm/uaccess.h>
46336 -extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
46337 -extern int fcntl_getlease(struct file *filp);
46339 void set_close_on_exec(unsigned int fd, int flag)
46341 diff -Nru a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
46342 --- a/fs/freevxfs/vxfs_inode.c Sun Nov 17 11:53:57 2002
46343 +++ b/fs/freevxfs/vxfs_inode.c Sun Aug 31 16:14:27 2003
46344 @@ -171,7 +171,7 @@
46348 - printk(KERN_WARNING "vxfs: unable to read inode %ld\n", ino);
46349 + printk(KERN_WARNING "vxfs: unable to read inode %ld\n", (unsigned long)ino);
46353 diff -Nru a/fs/hpfs/namei.c b/fs/hpfs/namei.c
46354 --- a/fs/hpfs/namei.c Sun Jun 29 23:49:25 2003
46355 +++ b/fs/hpfs/namei.c Tue Aug 26 09:37:39 2003
46356 @@ -375,6 +375,7 @@
46357 spin_lock(&dentry->d_lock);
46358 if (atomic_read(&dentry->d_count) > 1 ||
46359 permission(inode, MAY_WRITE, NULL) ||
46360 + !S_ISREG(inode->i_mode) ||
46361 get_write_access(inode)) {
46362 spin_unlock(&dentry->d_lock);
46364 diff -Nru a/fs/intermezzo/presto.c b/fs/intermezzo/presto.c
46365 --- a/fs/intermezzo/presto.c Fri Dec 13 17:27:19 2002
46366 +++ b/fs/intermezzo/presto.c Tue Aug 26 09:33:56 2003
46368 cache = presto_get_cache(inode);
46369 CDEBUG(D_PSDEV, "\n");
46371 - CERROR("PRESTO: BAD: cannot find cache for dev %d, ino %ld\n",
46372 - inode->i_sb->s_dev, inode->i_ino);
46373 + CERROR("PRESTO: BAD: cannot find cache for dev %s, ino %ld\n",
46374 + inode->i_sb->s_id, inode->i_ino);
46378 diff -Nru a/fs/intermezzo/vfs.c b/fs/intermezzo/vfs.c
46379 --- a/fs/intermezzo/vfs.c Thu Aug 7 10:29:14 2003
46380 +++ b/fs/intermezzo/vfs.c Tue Aug 26 09:33:56 2003
46381 @@ -743,7 +743,7 @@
46385 - if (dir->d_inode->i_sb->s_dev != inode->i_sb->s_dev)
46386 + if (dir->d_inode->i_sb != inode->i_sb)
46390 @@ -1800,7 +1800,7 @@
46394 - if (new_dir->i_sb->s_dev != old_dir->i_sb->s_dev)
46395 + if (new_dir->i_sb != old_dir->i_sb)
46398 if (!new_dentry->d_inode)
46399 @@ -1881,7 +1881,7 @@
46403 - if (new_dir->i_sb->s_dev != old_dir->i_sb->s_dev)
46404 + if (new_dir->i_sb != old_dir->i_sb)
46407 if (!new_dentry->d_inode)
46408 diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c
46409 --- a/fs/jbd/journal.c Sat Aug 16 11:46:50 2003
46410 +++ b/fs/jbd/journal.c Sun Aug 31 16:14:25 2003
46411 @@ -1890,7 +1890,6 @@
46415 - printk(KERN_INFO "Journalled Block Device driver loaded\n");
46416 ret = journal_init_caches();
46418 journal_destroy_caches();
46419 diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
46420 --- a/fs/jffs/inode-v23.c Thu Aug 14 18:17:32 2003
46421 +++ b/fs/jffs/inode-v23.c Sun Aug 31 16:13:59 2003
46422 @@ -1080,9 +1080,11 @@
46423 struct jffs_control *c;
46424 struct inode *inode;
46426 - kdev_t dev = to_kdev_t(rdev);
46430 + data = (MAJOR(rdev) << 8) | MINOR(rdev);
46432 D1(printk("***jffs_mknod()\n"));
46435 @@ -1114,7 +1116,7 @@
46436 raw_inode.mtime = raw_inode.atime;
46437 raw_inode.ctime = raw_inode.atime;
46438 raw_inode.offset = 0;
46439 - raw_inode.dsize = sizeof(kdev_t);
46440 + raw_inode.dsize = 2;
46441 raw_inode.rsize = 0;
46442 raw_inode.nsize = dentry->d_name.len;
46443 raw_inode.nlink = 1;
46444 @@ -1124,7 +1126,7 @@
46446 /* Write the new node to the flash. */
46447 if ((err = jffs_write_node(c, node, &raw_inode, dentry->d_name.name,
46448 - (unsigned char *)&dev, 0, NULL)) < 0) {
46449 + (unsigned char *)&data, 0, NULL)) < 0) {
46450 D(printk("jffs_mknod(): jffs_write_node() failed.\n"));
46452 goto jffs_mknod_err;
46453 @@ -1530,7 +1532,7 @@
46455 } /* jffs_file_write() */
46459 jffs_prepare_write(struct file *filp, struct page *page,
46460 unsigned from, unsigned to)
46462 @@ -1543,7 +1545,7 @@
46464 } /* jffs_prepare_write() */
46468 jffs_commit_write(struct file *filp, struct page *page,
46469 unsigned from, unsigned to)
46471 @@ -1732,9 +1734,10 @@
46472 /* If the node is a device of some sort, then the number of
46473 the device should be read from the flash memory and then
46474 added to the inode's i_rdev member. */
46476 - jffs_read_data(f, (char *)&rdev, 0, sizeof(kdev_t));
46477 - init_special_inode(inode, inode->i_mode, kdev_t_to_nr(rdev));
46479 + jffs_read_data(f, (char *)val, 0, 2);
46480 + init_special_inode(inode, inode->i_mode,
46481 + MKDEV((val >> 8) & 255, val & 255));
46484 D3(printk (KERN_NOTICE "read_inode(): up biglock\n"));
46485 diff -Nru a/fs/jffs2/file.c b/fs/jffs2/file.c
46486 --- a/fs/jffs2/file.c Wed May 28 08:01:06 2003
46487 +++ b/fs/jffs2/file.c Tue Aug 26 09:25:41 2003
46488 @@ -103,8 +103,8 @@
46489 it out again with the appropriate data attached */
46490 if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
46491 /* For these, we don't actually need to read the old node */
46492 - dev = (major(dentry->d_inode->i_rdev) << 8) |
46493 - minor(dentry->d_inode->i_rdev);
46494 + dev = (imajor(dentry->d_inode) << 8) |
46495 + iminor(dentry->d_inode);
46496 mdata = (char *)&dev;
46497 mdatalen = sizeof(dev);
46498 D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen));
46499 diff -Nru a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
46500 --- a/fs/jffs2/os-linux.h Mon Jun 23 06:03:50 2003
46501 +++ b/fs/jffs2/os-linux.h Tue Aug 26 09:25:41 2003
46503 #define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid)
46505 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,1)
46506 -#define JFFS2_F_I_RDEV_MIN(f) (minor(OFNI_EDONI_2SFFJ(f)->i_rdev))
46507 -#define JFFS2_F_I_RDEV_MAJ(f) (major(OFNI_EDONI_2SFFJ(f)->i_rdev))
46508 +#define JFFS2_F_I_RDEV_MIN(f) (iminor(OFNI_EDONI_2SFFJ(f)))
46509 +#define JFFS2_F_I_RDEV_MAJ(f) (imajor(OFNI_EDONI_2SFFJ(f)))
46511 #define JFFS2_F_I_RDEV_MIN(f) (MINOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
46512 #define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
46513 diff -Nru a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
46514 --- a/fs/jffs2/wbuf.c Wed May 28 08:01:07 2003
46515 +++ b/fs/jffs2/wbuf.c Sun Aug 31 16:14:08 2003
46517 #define NAND_JFFS2_OOB16_FSDALEN 8
46519 struct nand_oobinfo jffs2_oobinfo = {
46521 - eccpos: {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2, JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
46523 + .eccpos = {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2, JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
46526 static inline void jffs2_refile_wbuf_blocks(struct jffs2_sb_info *c)
46527 diff -Nru a/fs/nfs/inode.c b/fs/nfs/inode.c
46528 --- a/fs/nfs/inode.c Fri Jul 11 10:32:02 2003
46529 +++ b/fs/nfs/inode.c Tue Aug 26 09:37:39 2003
46530 @@ -620,7 +620,7 @@
46531 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
46532 NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
46534 - invalidate_inode_pages(inode->i_mapping);
46535 + invalidate_remote_inode(inode);
46537 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
46538 NFS_CACHEINV(inode);
46539 @@ -823,14 +823,15 @@
46543 - if (!S_ISREG(inode->i_mode))
46544 + if (!S_ISREG(inode->i_mode)) {
46545 attr->ia_valid &= ~ATTR_SIZE;
46547 - filemap_fdatawrite(inode->i_mapping);
46548 - error = nfs_wb_all(inode);
46549 - filemap_fdatawait(inode->i_mapping);
46553 + filemap_fdatawrite(inode->i_mapping);
46554 + error = nfs_wb_all(inode);
46555 + filemap_fdatawait(inode->i_mapping);
46560 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
46562 @@ -1205,7 +1206,7 @@
46564 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
46565 nfsi->attrtimeo_timestamp = jiffies;
46566 - invalidate_inode_pages(inode->i_mapping);
46567 + invalidate_remote_inode(inode);
46568 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
46569 } else if (time_after(jiffies, nfsi->attrtimeo_timestamp+nfsi->attrtimeo)) {
46570 if ((nfsi->attrtimeo <<= 1) > NFS_MAXATTRTIMEO(inode))
46571 diff -Nru a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
46572 --- a/fs/nfsd/nfs4proc.c Thu Jun 26 21:26:02 2003
46573 +++ b/fs/nfsd/nfs4proc.c Sun Aug 31 16:14:23 2003
46574 @@ -106,7 +106,8 @@
46575 nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
46578 - dprintk("NFSD: nfsd4_open filename %.*s\n",open->op_fname.len, open->op_fname.data);
46579 + dprintk("NFSD: nfsd4_open filename %.*s\n",
46580 + (int)open->op_fname.len, open->op_fname.data);
46582 /* This check required by spec. */
46583 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
46584 diff -Nru a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
46585 --- a/fs/nfsd/nfs4state.c Thu Jul 31 16:53:11 2003
46586 +++ b/fs/nfsd/nfs4state.c Sun Aug 31 16:14:23 2003
46587 @@ -688,7 +688,7 @@
46588 #define OPENSTATEID_HASH_MASK (OPENSTATEID_HASH_SIZE - 1)
46590 #define file_hashval(x) \
46591 - ((unsigned int)((x)->dev + (x)->ino + (x)->generation) & FILE_HASH_MASK)
46592 + hash_ptr(x, FILE_HASH_BITS)
46593 #define openstateid_hashval(owner_id, file_id) \
46594 (((owner_id) + (file_id)) & OPENSTATEID_HASH_MASK)
46596 @@ -697,13 +697,13 @@
46598 /* OPEN Share state helper functions */
46599 static inline struct nfs4_file *
46600 -alloc_init_file(unsigned int hashval, nfs4_ino_desc_t *ino) {
46601 +alloc_init_file(unsigned int hashval, struct inode *ino) {
46602 struct nfs4_file *fp;
46603 if ((fp = kmalloc(sizeof(struct nfs4_file),GFP_KERNEL))) {
46604 INIT_LIST_HEAD(&fp->fi_hash);
46605 INIT_LIST_HEAD(&fp->fi_perfile);
46606 list_add(&fp->fi_hash, &file_hashtbl[hashval]);
46607 - memcpy(&fp->fi_ino, ino, sizeof(nfs4_ino_desc_t));
46608 + fp->fi_inode = igrab(ino);
46609 fp->fi_id = current_fileid++;
46612 @@ -841,11 +841,12 @@
46615 list_del_init(&fp->fi_hash);
46616 + iput(fp->fi_inode);
46621 -release_open_state(struct nfs4_stateid *stp)
46622 +release_open_state(struct nfs4_stateid *stp, struct nfsd4_close *cl)
46624 struct nfs4_stateowner *sop = stp->st_stateowner;
46625 struct nfs4_file *fp = stp->st_file;
46626 @@ -860,6 +861,7 @@
46628 if (sop->so_confirmed && list_empty(&sop->so_peropenstate)) {
46629 release_stateowner(sop);
46630 + cl->cl_stateowner = NULL;
46632 /* unused nfs4_file's are releseed. XXX slab cache? */
46633 if (list_empty(&fp->fi_perfile)) {
46634 @@ -911,13 +913,13 @@
46636 /* search file_hashtbl[] for file */
46638 -find_file(unsigned int hashval, nfs4_ino_desc_t *ino, struct nfs4_file **fp) {
46639 +find_file(unsigned int hashval, struct inode *ino, struct nfs4_file **fp) {
46640 struct list_head *pos, *next;
46641 struct nfs4_file *local = NULL;
46643 list_for_each_safe(pos, next, &file_hashtbl[hashval]) {
46644 local = list_entry(pos, struct nfs4_file, fi_hash);
46645 - if(!memcmp(&local->fi_ino, ino, sizeof(nfs4_ino_desc_t))) {
46646 + if (local->fi_inode == ino) {
46650 @@ -934,24 +936,10 @@
46654 -static inline void
46655 -nfs4_init_ino(nfs4_ino_desc_t *ino, struct svc_fh *fhp)
46657 - struct inode *inode;
46658 - if (!fhp->fh_dentry)
46660 - inode = fhp->fh_dentry->d_inode;
46663 - ino->dev = inode->i_sb->s_dev;
46664 - ino->ino = inode->i_ino;
46665 - ino->generation = inode->i_generation;
46669 nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
46671 - nfs4_ino_desc_t ino;
46672 + struct inode *ino = current_fh->fh_dentry->d_inode;
46673 unsigned int fi_hashval;
46674 struct nfs4_file *fp;
46675 struct nfs4_stateid *stp;
46676 @@ -959,9 +947,8 @@
46678 dprintk("NFSD: nfs4_share_conflict\n");
46680 - nfs4_init_ino(&ino, current_fh);
46681 - fi_hashval = file_hashval(&ino);
46682 - if (find_file(fi_hashval, &ino, &fp)) {
46683 + fi_hashval = file_hashval(ino);
46684 + if (find_file(fi_hashval, ino, &fp)) {
46685 /* Search for conflicting share reservations */
46686 list_for_each_safe(pos, next, &fp->fi_perfile) {
46687 stp = list_entry(pos, struct nfs4_stateid, st_perfile);
46688 @@ -1084,7 +1071,7 @@
46689 struct iattr iattr;
46690 struct nfs4_stateowner *sop = open->op_stateowner;
46691 struct nfs4_file *fp;
46692 - nfs4_ino_desc_t ino;
46693 + struct inode *ino;
46694 unsigned int fi_hashval;
46695 struct list_head *pos, *next;
46696 struct nfs4_stateid *stq, *stp = NULL;
46697 @@ -1094,11 +1081,11 @@
46701 - nfs4_init_ino(&ino, current_fh);
46702 + ino = current_fh->fh_dentry->d_inode;
46704 down(&client_sema); /*XXX need finer grained locking */
46705 - fi_hashval = file_hashval(&ino);
46706 - if (find_file(fi_hashval, &ino, &fp)) {
46707 + fi_hashval = file_hashval(ino);
46708 + if (find_file(fi_hashval, ino, &fp)) {
46709 /* Search for conflicting share reservations */
46710 status = nfserr_share_denied;
46711 list_for_each_safe(pos, next, &fp->fi_perfile) {
46712 @@ -1113,7 +1100,7 @@
46714 /* No nfs4_file found; allocate and init a new one */
46715 status = nfserr_resource;
46716 - if ((fp = alloc_init_file(fi_hashval, &ino)) == NULL)
46717 + if ((fp = alloc_init_file(fi_hashval, ino)) == NULL)
46721 @@ -1172,6 +1159,9 @@
46722 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
46725 + if (fp && list_empty(&fp->fi_perfile))
46726 + release_file(fp);
46729 * To finish the open response, we just need to set the rflags.
46731 @@ -1494,7 +1484,7 @@
46732 struct nfs4_stateid *stp;
46734 dprintk("NFSD: nfsd4_open_confirm on file %.*s\n",
46735 - current_fh->fh_dentry->d_name.len,
46736 + (int)current_fh->fh_dentry->d_name.len,
46737 current_fh->fh_dentry->d_name.name);
46738 oc->oc_stateowner = NULL;
46739 down(&client_sema); /* XXX need finer grained locking */
46740 @@ -1528,7 +1518,7 @@
46741 struct nfs4_stateid *stp;
46743 dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n",
46744 - current_fh->fh_dentry->d_name.len,
46745 + (int)current_fh->fh_dentry->d_name.len,
46746 current_fh->fh_dentry->d_name.name);
46748 down(&client_sema); /* XXX need finer grained locking */
46749 @@ -1567,7 +1557,7 @@
46750 struct nfs4_stateid *stp;
46752 dprintk("NFSD: nfsd4_close on file %.*s\n",
46753 - current_fh->fh_dentry->d_name.len,
46754 + (int)current_fh->fh_dentry->d_name.len,
46755 current_fh->fh_dentry->d_name.name);
46757 down(&client_sema); /* XXX need finer grained locking */
46758 @@ -1584,7 +1574,7 @@
46759 memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t));
46761 /* release_open_state() calls nfsd_close() if needed */
46762 - release_open_state(stp);
46763 + release_open_state(stp,close);
46767 diff -Nru a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
46768 --- a/fs/nfsd/nfs4xdr.c Sun Aug 3 21:42:17 2003
46769 +++ b/fs/nfsd/nfs4xdr.c Sat Aug 23 15:07:47 2003
46770 @@ -1631,6 +1631,8 @@
46771 WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
46774 + if ((close->cl_stateowner) && (close->cl_stateowner->so_confirmed))
46775 + close->cl_stateowner->so_seqid++;
46779 @@ -1767,6 +1769,8 @@
46784 + ENCODE_SEQID_OP_TAIL(open->op_stateowner);
46788 diff -Nru a/fs/open.c b/fs/open.c
46789 --- a/fs/open.c Mon Aug 18 22:38:39 2003
46790 +++ b/fs/open.c Sun Aug 31 16:14:00 2003
46791 @@ -945,20 +945,12 @@
46793 int filp_close(struct file *filp, fl_owner_t id)
46795 - struct address_space *mapping = filp->f_dentry->d_inode->i_mapping;
46796 - int retval = 0, err;
46799 /* Report and clear outstanding errors */
46800 - err = filp->f_error;
46802 + retval = filp->f_error;
46808 - if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
46809 - retval = -ENOSPC;
46810 - if (test_and_clear_bit(AS_EIO, &mapping->flags))
46813 if (!file_count(filp)) {
46814 printk(KERN_ERR "VFS: Close: file count is 0\n");
46815 @@ -966,7 +958,7 @@
46818 if (filp->f_op && filp->f_op->flush) {
46819 - err = filp->f_op->flush(filp);
46820 + int err = filp->f_op->flush(filp);
46824 diff -Nru a/fs/partitions/check.c b/fs/partitions/check.c
46825 --- a/fs/partitions/check.c Tue Aug 12 06:46:16 2003
46826 +++ b/fs/partitions/check.c Tue Aug 26 12:06:15 2003
46827 @@ -267,7 +267,14 @@
46829 extern struct subsystem block_subsys;
46831 +static void part_release(struct kobject *kobj)
46833 + struct hd_struct * p = container_of(kobj,struct hd_struct,kobj);
46837 struct kobj_type ktype_part = {
46838 + .release = part_release,
46839 .default_attrs = default_attrs,
46840 .sysfs_ops = &part_sysfs_ops,
46842 @@ -279,13 +286,12 @@
46846 + disk->part[part-1] = NULL;
46849 p->reads = p->writes = p->read_sectors = p->write_sectors = 0;
46850 devfs_remove("%s/part%d", disk->devfs_name, part);
46851 kobject_unregister(&p->kobj);
46852 - disk->part[part-1] = NULL;
46856 void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
46857 @@ -300,7 +306,6 @@
46858 p->start_sect = start;
46861 - disk->part[part-1] = p;
46863 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part),
46864 S_IFBLK|S_IRUSR|S_IWUSR,
46865 @@ -310,6 +315,7 @@
46866 p->kobj.parent = &disk->kobj;
46867 p->kobj.ktype = &ktype_part;
46868 kobject_register(&p->kobj);
46869 + disk->part[part-1] = p;
46872 static void disk_sysfs_symlinks(struct gendisk *disk)
46873 diff -Nru a/fs/proc/base.c b/fs/proc/base.c
46874 --- a/fs/proc/base.c Thu Jul 10 22:23:45 2003
46875 +++ b/fs/proc/base.c Sun Aug 31 16:13:56 2003
46876 @@ -864,19 +864,34 @@
46877 * Exceptional case: normally we are not allowed to unhash a busy
46878 * directory. In this case, however, we can do it - no aliasing problems
46879 * due to the way we treat inodes.
46881 + * Rewrite the inode's ownerships here because the owning task may have
46882 + * performed a setuid(), etc.
46884 -static int pid_revalidate(struct dentry * dentry, struct nameidata *nd)
46885 +static int pid_revalidate(struct dentry *dentry, struct nameidata *nd)
46887 - if (pid_alive(proc_task(dentry->d_inode)))
46888 + struct inode *inode = dentry->d_inode;
46889 + struct task_struct *task = proc_task(inode);
46890 + if (pid_alive(task)) {
46891 + if (proc_type(inode) == PROC_PID_INO || task_dumpable(task)) {
46892 + inode->i_uid = task->euid;
46893 + inode->i_gid = task->egid;
46895 + inode->i_uid = 0;
46896 + inode->i_gid = 0;
46898 + security_task_to_inode(task, inode);
46905 -static int pid_fd_revalidate(struct dentry * dentry, struct nameidata *nd)
46906 +static int pid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
46908 - struct task_struct *task = proc_task(dentry->d_inode);
46909 - int fd = proc_type(dentry->d_inode) - PROC_PID_FD_DIR;
46910 + struct inode *inode = dentry->d_inode;
46911 + struct task_struct *task = proc_task(inode);
46912 + int fd = proc_type(inode) - PROC_PID_FD_DIR;
46913 struct files_struct *files;
46916 @@ -889,6 +904,14 @@
46917 if (fcheck_files(files, fd)) {
46918 spin_unlock(&files->file_lock);
46919 put_files_struct(files);
46920 + if (task_dumpable(task)) {
46921 + inode->i_uid = task->euid;
46922 + inode->i_gid = task->egid;
46924 + inode->i_uid = 0;
46925 + inode->i_gid = 0;
46927 + security_task_to_inode(task, inode);
46930 spin_unlock(&files->file_lock);
46931 diff -Nru a/fs/proc/kcore.c b/fs/proc/kcore.c
46932 --- a/fs/proc/kcore.c Fri Jun 20 13:16:05 2003
46933 +++ b/fs/proc/kcore.c Sun Aug 31 16:14:22 2003
46936 - * fs/proc/kcore.c kernel ELF/AOUT core dumper
46937 + * fs/proc/kcore.c kernel ELF core dumper
46939 * Modelled on fs/exec.c:aout_core_dump()
46940 * Jeremy Fitzhardinge <jeremy@sw.oz.au>
46942 .open = open_kcore,
46945 -#ifdef CONFIG_KCORE_AOUT
46946 -static ssize_t read_kcore(struct file *file, char *buf, size_t count, loff_t *ppos)
46948 - unsigned long long p = *ppos, memsize;
46952 - struct user dump;
46953 -#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
46954 -# define FIRST_MAPPED PAGE_SIZE /* we don't have page 0 mapped on x86.. */
46956 -# define FIRST_MAPPED 0
46959 - memset(&dump, 0, sizeof(struct user));
46960 - dump.magic = CMAGIC;
46961 - dump.u_dsize = (virt_to_phys(high_memory) >> PAGE_SHIFT);
46962 -#if defined (__i386__) || defined(__x86_64__)
46963 - dump.start_code = PAGE_OFFSET;
46966 - dump.start_data = PAGE_OFFSET;
46969 - memsize = virt_to_phys(high_memory);
46970 - if (p >= memsize)
46972 - if (count > memsize - p)
46973 - count = memsize - p;
46976 - if (p < sizeof(struct user) && count > 0) {
46978 - if (p + count1 > sizeof(struct user))
46979 - count1 = sizeof(struct user)-p;
46980 - pnt = (char *) &dump + p;
46981 - if (copy_to_user(buf,(void *) pnt, count1))
46989 - if (count > 0 && p < PAGE_SIZE + FIRST_MAPPED) {
46990 - count1 = PAGE_SIZE + FIRST_MAPPED - p;
46991 - if (count1 > count)
46993 - if (clear_user(buf, count1))
47001 - if (copy_to_user(buf, (void *) (PAGE_OFFSET+p-PAGE_SIZE), count))
47008 -#else /* CONFIG_KCORE_AOUT */
47010 #ifndef kc_vaddr_to_offset
47011 #define kc_vaddr_to_offset(v) ((v) - PAGE_OFFSET)
47013 @@ -480,4 +415,3 @@
47017 -#endif /* CONFIG_KCORE_AOUT */
47018 diff -Nru a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
47019 --- a/fs/proc/task_mmu.c Thu Jun 19 16:57:39 2003
47020 +++ b/fs/proc/task_mmu.c Sat Aug 23 05:08:00 2003
47021 @@ -90,14 +90,14 @@
47022 ino = inode->i_ino;
47025 - seq_printf(m, "%0*lx-%0*lx %c%c%c%c %0*lx %02x:%02x %lu %n",
47026 - (int) (2*sizeof(void*)), map->vm_start,
47027 - (int) (2*sizeof(void*)), map->vm_end,
47028 + seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
47031 flags & VM_READ ? 'r' : '-',
47032 flags & VM_WRITE ? 'w' : '-',
47033 flags & VM_EXEC ? 'x' : '-',
47034 flags & VM_MAYSHARE ? 's' : 'p',
47035 - (int) (2*sizeof(void*)), map->vm_pgoff << PAGE_SHIFT,
47036 + map->vm_pgoff << PAGE_SHIFT,
47037 MAJOR(dev), MINOR(dev), ino, &len);
47039 if (map->vm_file) {
47040 diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
47041 --- a/fs/reiserfs/inode.c Mon Aug 18 22:42:17 2003
47042 +++ b/fs/reiserfs/inode.c Sun Aug 31 16:14:17 2003
47043 @@ -2048,8 +2048,8 @@
47044 last_offset = inode->i_size & (PAGE_CACHE_SIZE - 1) ;
47045 /* no file contents in this page */
47046 if (page->index >= end_index + 1 || !last_offset) {
47049 + unlock_page(page);
47052 kaddr = kmap_atomic(page, KM_USER0);
47053 memset(kaddr + last_offset, 0, PAGE_CACHE_SIZE-last_offset) ;
47054 diff -Nru a/fs/smbfs/inode.c b/fs/smbfs/inode.c
47055 --- a/fs/smbfs/inode.c Wed Jun 25 16:30:54 2003
47056 +++ b/fs/smbfs/inode.c Tue Aug 26 09:37:39 2003
47057 @@ -212,7 +212,7 @@
47058 (long) last_sz, (long) inode->i_size);
47060 if (!S_ISDIR(inode->i_mode))
47061 - invalidate_inode_pages(inode->i_mapping);
47062 + invalidate_remote_inode(inode);
47066 @@ -276,7 +276,7 @@
47067 * But we do want to invalidate the caches ...
47069 if (!S_ISDIR(inode->i_mode))
47070 - invalidate_inode_pages(inode->i_mapping);
47071 + invalidate_remote_inode(inode);
47073 smb_invalid_dir_cache(inode);
47075 diff -Nru a/fs/vfat/namei.c b/fs/vfat/namei.c
47076 --- a/fs/vfat/namei.c Sat Aug 2 15:10:30 2003
47077 +++ b/fs/vfat/namei.c Mon Sep 1 08:45:36 2003
47078 @@ -200,20 +200,6 @@
47082 -/* MS-DOS "device special files" */
47084 -static const unsigned char *reserved3_names[] = {
47085 - "con ", "prn ", "nul ", "aux ", NULL
47088 -static const unsigned char *reserved4_names[] = {
47089 - "com1 ", "com2 ", "com3 ", "com4 ", "com5 ",
47090 - "com6 ", "com7 ", "com8 ", "com9 ",
47091 - "lpt1 ", "lpt2 ", "lpt3 ", "lpt4 ", "lpt5 ",
47092 - "lpt6 ", "lpt7 ", "lpt8 ", "lpt9 ",
47096 /* Characters that are undesirable in an MS-DOS file name */
47098 static wchar_t bad_chars[] = {
47099 @@ -255,38 +241,31 @@
47103 -/* Checks the validity of a long MS-DOS filename */
47104 -/* Returns negative number on error, 0 for a normal
47105 - * return, and 1 for . or .. */
47107 -static int vfat_valid_longname(const unsigned char *name, int len, int xlate)
47108 +static int vfat_valid_longname(const unsigned char *name, unsigned int len)
47110 - const unsigned char **reserved, *walk;
47113 if (len && name[len-1] == ' ')
47121 - for (walk = name; *walk != 0 && *walk != '.'; walk++)
47123 - baselen = walk - name;
47125 - if (baselen == 3) {
47126 - for (reserved = reserved3_names; *reserved; reserved++) {
47127 - if (!strnicmp(name,*reserved,baselen))
47130 - } else if (baselen == 4) {
47131 - for (reserved = reserved4_names; *reserved; reserved++) {
47132 - if (!strnicmp(name,*reserved,baselen))
47134 + /* MS-DOS "device special files" */
47135 + if (len == 3 || (len > 3 && name[3] == '.')) { /* basename == 3 */
47136 + if (!strnicmp(name, "aux", 3) ||
47137 + !strnicmp(name, "con", 3) ||
47138 + !strnicmp(name, "nul", 3) ||
47139 + !strnicmp(name, "prn", 3))
47142 + if (len == 4 || (len > 4 && name[4] == '.')) { /* basename == 4 */
47143 + /* "com1", "com2", ... */
47144 + if ('1' <= name[3] && name[3] <= '9') {
47145 + if (!strnicmp(name, "com", 3) ||
47146 + !strnicmp(name, "lpt", 3))
47155 static int vfat_find_form(struct inode *dir, unsigned char *name)
47156 @@ -684,9 +663,8 @@
47160 - res = vfat_valid_longname(name, len, opts->unicode_xlate);
47163 + if (!vfat_valid_longname(name, len))
47166 if(!(page = __get_free_page(GFP_KERNEL)))
47168 diff -Nru a/include/asm-arm/apm.h b/include/asm-arm/apm.h
47169 --- /dev/null Wed Dec 31 16:00:00 1969
47170 +++ b/include/asm-arm/apm.h Thu Aug 7 11:38:41 2003
47172 +/* -*- linux-c -*-
47174 + * (C) 2003 zecke@handhelds.org
47178 + * based on arch/arm/kernel/apm.c
47179 + * factor out the information needed by architectures to provide
47184 +#ifndef ARM_ASM_SA1100_APM_H
47185 +#define ARM_ASM_SA1100_APM_H
47187 +#include <linux/config.h>
47192 +#define APM_AC_OFFLINE 0
47193 +#define APM_AC_ONLINE 1
47194 +#define APM_AC_BACKUP 2
47195 +#define APM_AC_UNKNOWN 0xFF
47197 +#define APM_BATTERY_STATUS_HIGH 0
47198 +#define APM_BATTERY_STATUS_LOW 1
47199 +#define APM_BATTERY_STATUS_CRITICAL 2
47200 +#define APM_BATTERY_STATUS_CHARGING 3
47201 +#define APM_BATTERY_STATUS_UNKNOWN 0xFF
47203 +#define APM_BATTERY_LIFE_UNKNOWN 0xFFFF
47204 +#define APM_BATTERY_LIFE_MINUTES 0x8000
47205 +#define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF
47208 + * This structure gets filled in by the machine specific 'get_power_status'
47209 + * implementation. Any fields which are not set default to a safe value.
47211 +struct apm_power_info {
47212 + unsigned char ac_line_status;
47213 + unsigned char battery_status;
47214 + unsigned char battery_flag;
47215 + unsigned char battery_life;
47221 + * This allows machines to provide their own "apm get power status" function.
47223 +extern void (*apm_get_power_status)(struct apm_power_info *);
47228 diff -Nru a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
47229 --- a/include/asm-arm/arch-ebsa285/time.h Tue May 13 08:20:50 2003
47230 +++ b/include/asm-arm/arch-ebsa285/time.h Sun Aug 24 07:55:20 2003
47231 @@ -181,12 +181,13 @@
47235 +static unsigned long timer1_latch;
47237 static unsigned long timer1_gettimeoffset (void)
47239 - unsigned long value = LATCH - *CSR_TIMER1_VALUE;
47240 + unsigned long value = timer1_latch - *CSR_TIMER1_VALUE;
47242 - return ((tick_nsec / 1000) * value) / LATCH;
47243 + return ((tick_nsec / 1000) * value) / timer1_latch;
47247 @@ -260,8 +261,10 @@
47248 machine_is_personal_server()) {
47249 gettimeoffset = timer1_gettimeoffset;
47251 + timer1_latch = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
47253 *CSR_TIMER1_CLR = 0;
47254 - *CSR_TIMER1_LOAD = LATCH;
47255 + *CSR_TIMER1_LOAD = timer1_latch;
47256 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16;
47258 timer_irq.handler = timer1_interrupt;
47259 diff -Nru a/include/asm-arm/arch-ebsa285/timex.h b/include/asm-arm/arch-ebsa285/timex.h
47260 --- a/include/asm-arm/arch-ebsa285/timex.h Tue Feb 5 09:39:51 2002
47261 +++ b/include/asm-arm/arch-ebsa285/timex.h Sun Aug 24 07:55:20 2003
47266 - * On EBSA285 boards, the clock runs at 50MHz and is
47267 - * divided by a 4-bit prescaler. Other boards use an
47268 - * ISA derived timer, and this is unused.
47269 + * We assume a constant here; this satisfies the maths in linux/timex.h
47270 + * and linux/time.h. CLOCK_TICK_RATE is actually system dependent, but
47271 + * this must be a constant.
47273 -#define CLOCK_TICK_RATE (mem_fclk_21285 / 16)
47274 +#define CLOCK_TICK_RATE (50000000/16)
47275 diff -Nru a/include/asm-arm/arch-iop3xx/iop310.h b/include/asm-arm/arch-iop3xx/iop310.h
47276 --- a/include/asm-arm/arch-iop3xx/iop310.h Mon Apr 21 15:43:42 2003
47277 +++ b/include/asm-arm/arch-iop3xx/iop310.h Wed Aug 13 16:46:20 2003
47279 #define _IOP310_HW_H_
47282 + * This is needed for mixed drivers that need to work on all
47283 + * IOP3xx variants but behave slightly differently on each.
47285 +#ifndef __ASSEMBLY__
47286 +#define iop_is_310() ((processor_id & 0xffffe3f0) == 0x69052000)
47290 * IOP310 I/O and Mem space regions for PCI autoconfiguration
47292 #define IOP310_PCISEC_LOWER_IO 0x90010000
47293 diff -Nru a/include/asm-arm/arch-iop3xx/iop321.h b/include/asm-arm/arch-iop3xx/iop321.h
47294 --- a/include/asm-arm/arch-iop3xx/iop321.h Fri May 30 07:09:39 2003
47295 +++ b/include/asm-arm/arch-iop3xx/iop321.h Wed Aug 13 16:46:20 2003
47297 #define _IOP321_HW_H_
47301 + * This is needed for mixed drivers that need to work on all
47302 + * IOP3xx variants but behave slightly differently on each.
47304 #ifndef __ASSEMBLY__
47305 #define iop_is_321() ((processor_id & 0xfffff7e0) == 0x69052420)
47307 diff -Nru a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h
47308 --- a/include/asm-arm/arch-iop3xx/memory.h Tue Apr 15 08:12:47 2003
47309 +++ b/include/asm-arm/arch-iop3xx/memory.h Wed Aug 13 16:46:20 2003
47311 extern void *mu_mem;
47314 +#define PFN_TO_NID(addr) (0)
47317 diff -Nru a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
47318 --- a/include/asm-arm/arch-pxa/pxa-regs.h Mon Apr 21 15:43:42 2003
47319 +++ b/include/asm-arm/arch-pxa/pxa-regs.h Mon Jun 30 04:20:34 2003
47320 @@ -836,7 +836,7 @@
47322 #define GPIO1_RST 1 /* reset */
47323 #define GPIO6_MMCCLK 6 /* MMC Clock */
47324 -#define GPIO8_48MHz 7 /* 48 MHz clock output */
47325 +#define GPIO7_48MHz 7 /* 48 MHz clock output */
47326 #define GPIO8_MMCCS0 8 /* MMC Chip Select 0 */
47327 #define GPIO9_MMCCS1 9 /* MMC Chip Select 1 */
47328 #define GPIO10_RTCCLK 10 /* real time clock (1 Hz) */
47329 @@ -939,7 +939,7 @@
47331 #define GPIO1_RTS_MD ( 1 | GPIO_ALT_FN_1_IN)
47332 #define GPIO6_MMCCLK_MD ( 6 | GPIO_ALT_FN_1_OUT)
47333 -#define GPIO8_48MHz_MD ( 8 | GPIO_ALT_FN_1_OUT)
47334 +#define GPIO7_48MHz_MD ( 7 | GPIO_ALT_FN_1_OUT)
47335 #define GPIO8_MMCCS0_MD ( 8 | GPIO_ALT_FN_1_OUT)
47336 #define GPIO9_MMCCS1_MD ( 9 | GPIO_ALT_FN_1_OUT)
47337 #define GPIO10_RTCCLK_MD (10 | GPIO_ALT_FN_1_OUT)
47338 diff -Nru a/include/asm-arm/arch-sa1100/simpad.h b/include/asm-arm/arch-sa1100/simpad.h
47339 --- a/include/asm-arm/arch-sa1100/simpad.h Mon Feb 24 10:29:41 2003
47340 +++ b/include/asm-arm/arch-sa1100/simpad.h Thu Aug 7 11:49:10 2003
47343 * This file contains the hardware specific definitions for SIMpad
47345 - * 2001/05/14 Juergen Messerer <juergen.messerer@siemens.ch>
47346 + * 2001/05/14 Juergen Messerer <juergen.messerer@freesurf.ch>
47351 +#ifndef __ASM_ARCH_SIMPAD_H
47352 +#define __ASM_ARCH_SIMPAD_H
47355 -#ifndef __ASM_ARCH_HARDWARE_H
47356 -#error "include <asm/hardware.h> instead"
47359 #define GPIO_UART1_RTS GPIO_GPIO14
47360 #define GPIO_UART1_DTR GPIO_GPIO7
47361 #define GPIO_UART1_CTS GPIO_GPIO8
47363 #define GPIO_UART3_DCD GPIO_GPIO18
47364 #define GPIO_UART3_DSR GPIO_GPIO17
47366 -#define GPIO_UCB1300_IRQ GPIO_GPIO (22) /* UCB GPIO and touchscreen */
47367 +#define GPIO_POWER_BUTTON GPIO_GPIO0
47368 +#define GPIO_UCB1300_IRQ GPIO_GPIO22 /* UCB GPIO and touchscreen */
47370 #define IRQ_UART1_CTS IRQ_GPIO15
47371 #define IRQ_UART1_DCD GPIO_GPIO23
47372 @@ -37,21 +34,26 @@
47373 #define IRQ_UART3_DCD GPIO_GPIO18
47374 #define IRQ_UART3_DSR GPIO_GPIO17
47376 -#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
47377 +#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
47378 +#define IRQ_GPIO_POWER_BUTTON IRQ_GPIO0
47382 #define GPIO_CF_CD GPIO_GPIO24
47383 -#define GPIO_CF_IRQ GPIO_GPIO1
47384 +#define GPIO_CF_IRQ GPIO_GPIO1
47385 #define IRQ_GPIO_CF_IRQ IRQ_GPIO1
47386 -#define IRQ_GPIO_CF_CD IRQ_GPIO24
47387 +#define IRQ_GPIO_CF_CD IRQ_GPIO24
47389 +/*--- SmartCard ---*/
47390 +#define GPIO_SMART_CARD GPIO_GPIO10
47391 +#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10
47393 -// CS3 Latch is write only, a shadow is necessary
47394 +// CS3 Latch is write only, a shadow is necessary
47396 -#define CS3BUSTYPE unsigned volatile long
47397 +#define CS3BUSTYPE unsigned volatile long
47398 #define CS3_BASE 0xf1000000
47400 -#define VCC_5V_EN 0x0001 // For 5V PCMCIA
47401 +#define VCC_5V_EN 0x0001 // For 5V PCMCIA
47402 #define VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
47403 #define EN1 0x0004 // This is only for EPROM's
47404 #define EN0 0x0008 // Both should be enable for 3.3V or 5V
47405 @@ -63,15 +65,43 @@
47406 #define IRDA_SD 0x0200 // Shutdown for powersave
47407 #define RS232_ON 0x0400
47408 #define SD_MEDIAQ 0x0800 // Shutdown for powersave
47409 -#define LED2_ON 0x1000
47410 +#define LED2_ON 0x1000
47411 #define IRDA_MODE 0x2000 // Fast/Slow IrDA mode
47412 #define ENABLE_5V 0x4000 // Enable 5V circuit
47413 #define RESET_SIMCARD 0x8000
47415 #define RS232_ENABLE 0x0440
47416 -#define PCMCIAMASK 0x402f
47417 +#define PCMCIAMASK 0x402f
47420 +struct simpad_battery {
47421 + unsigned char ac_status; /* line connected yes/no */
47422 + unsigned char status; /* battery loading yes/no */
47423 + unsigned char percentage; /* percentage loaded */
47424 + unsigned short life; /* life till empty */
47427 +/* These should match the apm_bios.h definitions */
47428 +#define SIMPAD_AC_STATUS_AC_OFFLINE 0x00
47429 +#define SIMPAD_AC_STATUS_AC_ONLINE 0x01
47430 +#define SIMPAD_AC_STATUS_AC_BACKUP 0x02 /* What does this mean? */
47431 +#define SIMPAD_AC_STATUS_AC_UNKNOWN 0xff
47433 +/* These bitfields are rarely "or'd" together */
47434 +#define SIMPAD_BATT_STATUS_HIGH 0x01
47435 +#define SIMPAD_BATT_STATUS_LOW 0x02
47436 +#define SIMPAD_BATT_STATUS_CRITICAL 0x04
47437 +#define SIMPAD_BATT_STATUS_CHARGING 0x08
47438 +#define SIMPAD_BATT_STATUS_CHARGE_MAIN 0x10
47439 +#define SIMPAD_BATT_STATUS_DEAD 0x20 /* Battery will not charge */
47440 +#define SIMPAD_BATT_NOT_INSTALLED 0x20 /* For expansion pack batteries */
47441 +#define SIMPAD_BATT_STATUS_FULL 0x40 /* Battery fully charged (and connected to AC) */
47442 +#define SIMPAD_BATT_STATUS_NOBATT 0x80
47443 +#define SIMPAD_BATT_STATUS_UNKNOWN 0xff
47445 +extern int simpad_get_battery(struct simpad_battery* );
47447 -#endif // SIMPAD_H
47448 +#endif // __ASM_ARCH_SIMPAD_H
47452 diff -Nru a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h
47453 --- a/include/asm-arm/checksum.h Tue Oct 15 10:15:06 2002
47454 +++ b/include/asm-arm/checksum.h Mon Jun 23 03:41:42 2003
47455 @@ -105,7 +105,7 @@
47456 adcs %0, %0, %5 \n\
47459 - : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len) << 16), "Ir" (proto << 8)
47460 + : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto))
47464 @@ -127,7 +127,7 @@
47465 addcs %0, %0, #0x10000 \n\
47468 - : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (proto << 8)
47469 + : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto))
47473 diff -Nru a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
47474 --- a/include/asm-arm/dma-mapping.h Wed Jun 4 08:09:55 2003
47475 +++ b/include/asm-arm/dma-mapping.h Wed Aug 13 16:46:20 2003
47476 @@ -129,6 +129,28 @@
47480 + * dma_map_page - map a portion of a page for streaming DMA
47481 + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
47482 + * @page: page that buffer resides in
47483 + * @offset: offset into page for start of buffer
47484 + * @size: size of buffer to map
47485 + * @dir: DMA transfer direction
47487 + * Ensure that any data held in the cache is appropriately discarded
47488 + * or written back.
47490 + * The device owns this memory once this call has completed. The CPU
47491 + * can regain ownership by calling dma_unmap_page() or dma_sync_single().
47493 +static inline dma_addr_t
47494 +dma_map_page(struct device *dev, struct page *page,
47495 + unsigned long offset, size_t size,
47496 + enum dma_data_direction dir)
47498 + return dma_map_single(dev, page_address(page) + offset, size, (int)dir);
47502 * dma_unmap_single - unmap a single buffer previously mapped
47503 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
47504 * @handle: DMA address of buffer
47505 @@ -152,21 +174,26 @@
47506 /* nothing to do */
47510 -static inline dma_addr_t
47511 -dma_map_page(struct device *dev, struct page *page, unsigned long off,
47512 - size_t size, enum dma_data_direction dir)
47518 + * dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
47519 + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
47520 + * @handle: DMA address of buffer
47521 + * @size: size of buffer to map
47522 + * @dir: DMA transfer direction
47524 + * Unmap a single streaming mode DMA translation. The handle and size
47525 + * must match what was provided in the previous dma_map_single() call.
47526 + * All other usages are undefined.
47528 + * After this call, reads by the CPU to the buffer are guaranteed to see
47529 + * whatever the device wrote there.
47532 dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size,
47533 enum dma_data_direction dir)
47536 + dma_unmap_single(dev, handle, size, (int)dir);
47541 * dma_map_sg - map a set of SG buffers for streaming mode DMA
47542 diff -Nru a/include/asm-arm/hardware/amba.h b/include/asm-arm/hardware/amba.h
47543 --- a/include/asm-arm/hardware/amba.h Wed Jun 18 15:23:24 2003
47544 +++ b/include/asm-arm/hardware/amba.h Sun Aug 24 07:16:13 2003
47546 int (*probe)(struct amba_device *, void *);
47547 int (*remove)(struct amba_device *);
47548 void (*shutdown)(struct amba_device *);
47549 - int (*suspend)(struct amba_device *, u32, u32);
47550 - int (*resume)(struct amba_device *, u32);
47551 + int (*suspend)(struct amba_device *, u32);
47552 + int (*resume)(struct amba_device *);
47553 struct amba_id *id_table;
47556 diff -Nru a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h
47557 --- a/include/asm-arm/hardware/sa1111.h Tue Aug 5 12:36:08 2003
47558 +++ b/include/asm-arm/hardware/sa1111.h Sun Aug 24 07:45:05 2003
47559 @@ -542,9 +542,16 @@
47561 #define SA1111_DEV(_d) container_of((_d), struct sa1111_dev, dev)
47563 +#define sa1111_get_drvdata(d) dev_get_drvdata(&(d)->dev)
47564 +#define sa1111_set_drvdata(d,p) dev_get_drvdata(&(d)->dev, p)
47566 struct sa1111_driver {
47567 struct device_driver drv;
47568 unsigned int devid;
47569 + int (*probe)(struct sa1111_dev *);
47570 + int (*remove)(struct sa1111_dev *);
47571 + int (*suspend)(struct sa1111_dev *, u32);
47572 + int (*resume)(struct sa1111_dev *);
47575 #define SA1111_DRV(_d) container_of((_d), struct sa1111_driver, drv)
47576 @@ -572,5 +579,8 @@
47577 int sa1111_get_audio_rate(struct sa1111_dev *sadev);
47579 int sa1111_check_dma_bug(dma_addr_t addr);
47581 +int sa1111_driver_register(struct sa1111_driver *);
47582 +void sa1111_driver_unregister(struct sa1111_driver *);
47584 #endif /* _ASM_ARCH_SA1111 */
47585 diff -Nru a/include/asm-arm/pci.h b/include/asm-arm/pci.h
47586 --- a/include/asm-arm/pci.h Mon Jun 9 09:25:33 2003
47587 +++ b/include/asm-arm/pci.h Wed Aug 13 16:46:20 2003
47589 return dma_unmap_sg(hwdev ? &hwdev->dev : NULL, sg, nents, dir);
47592 +static inline dma_addr_t
47593 +pci_map_page(struct pci_dev *hwdev, struct page *page, unsigned long offset,
47594 + size_t size, int dir)
47596 + return pci_map_single(hwdev, page_address(page) + offset, size, dir);
47599 +static inline void
47600 +pci_unmap_page(struct pci_dev *hwdev, dma_addr_t handle, size_t size, int dir)
47602 + return pci_unmap_single(hwdev, handle, size, dir);
47606 pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t handle, size_t size, int dir)
47608 diff -Nru a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h
47609 --- a/include/asm-arm/proc-armo/processor.h Wed May 29 08:06:36 2002
47610 +++ b/include/asm-arm/proc-armo/processor.h Sun Aug 31 16:14:08 2003
47612 uaccess_t *uaccess; /* User access functions*/
47614 #define EXTRA_THREAD_STRUCT_INIT \
47615 - uaccess: &uaccess_kernel,
47616 + .uaccess = &uaccess_kernel,
47618 #define start_thread(regs,pc,sp) \
47620 diff -Nru a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
47621 --- a/include/asm-arm/unistd.h Tue Jan 14 15:28:43 2003
47622 +++ b/include/asm-arm/unistd.h Tue Jul 8 09:40:32 2003
47623 @@ -303,7 +303,7 @@
47627 -#define __syscall(name) "swi\t" __sys1(__NR_##name) "\n\t"
47628 +#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
47632 @@ -318,24 +318,28 @@
47634 #define _syscall0(type,name) \
47635 type name(void) { \
47636 - register long __res __asm__("r0"); \
47637 + register long __res_r0 __asm__("r0"); \
47639 __asm__ __volatile__ ( \
47642 + : "=r" (__res_r0) \
47645 + __res = __res_r0; \
47646 __syscall_return(type,__res); \
47649 #define _syscall1(type,name,type1,arg1) \
47650 type name(type1 arg1) { \
47651 register long __r0 __asm__("r0") = (long)arg1; \
47652 - register long __res __asm__("r0"); \
47653 + register long __res_r0 __asm__("r0"); \
47655 __asm__ __volatile__ ( \
47658 + : "=r" (__res_r0) \
47661 + __res = __res_r0; \
47662 __syscall_return(type,__res); \
47665 @@ -343,12 +347,14 @@
47666 type name(type1 arg1,type2 arg2) { \
47667 register long __r0 __asm__("r0") = (long)arg1; \
47668 register long __r1 __asm__("r1") = (long)arg2; \
47669 - register long __res __asm__("r0"); \
47670 + register long __res_r0 __asm__("r0"); \
47672 __asm__ __volatile__ ( \
47675 + : "=r" (__res_r0) \
47676 : "r" (__r0),"r" (__r1) \
47678 + __res = __res_r0; \
47679 __syscall_return(type,__res); \
47682 @@ -358,12 +364,14 @@
47683 register long __r0 __asm__("r0") = (long)arg1; \
47684 register long __r1 __asm__("r1") = (long)arg2; \
47685 register long __r2 __asm__("r2") = (long)arg3; \
47686 - register long __res __asm__("r0"); \
47687 + register long __res_r0 __asm__("r0"); \
47689 __asm__ __volatile__ ( \
47692 + : "=r" (__res_r0) \
47693 : "r" (__r0),"r" (__r1),"r" (__r2) \
47695 + __res = __res_r0; \
47696 __syscall_return(type,__res); \
47699 @@ -374,12 +382,14 @@
47700 register long __r1 __asm__("r1") = (long)arg2; \
47701 register long __r2 __asm__("r2") = (long)arg3; \
47702 register long __r3 __asm__("r3") = (long)arg4; \
47703 - register long __res __asm__("r0"); \
47704 + register long __res_r0 __asm__("r0"); \
47706 __asm__ __volatile__ ( \
47709 + : "=r" (__res_r0) \
47710 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \
47712 + __res = __res_r0; \
47713 __syscall_return(type,__res); \
47716 @@ -391,12 +401,14 @@
47717 register long __r2 __asm__("r2") = (long)arg3; \
47718 register long __r3 __asm__("r3") = (long)arg4; \
47719 register long __r4 __asm__("r4") = (long)arg5; \
47720 - register long __res __asm__("r0"); \
47721 + register long __res_r0 __asm__("r0"); \
47723 __asm__ __volatile__ ( \
47726 + : "=r" (__res_r0) \
47727 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \
47729 + __res = __res_r0; \
47730 __syscall_return(type,__res); \
47733 @@ -408,12 +420,14 @@
47734 register long __r3 __asm__("r3") = (long)arg4; \
47735 register long __r4 __asm__("r4") = (long)arg5; \
47736 register long __r5 __asm__("r5") = (long)arg6; \
47737 - register long __res __asm__("r0"); \
47738 + register long __res_r0 __asm__("r0"); \
47740 __asm__ __volatile__ ( \
47743 + : "=r" (__res_r0) \
47744 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \
47746 + __res = __res_r0; \
47747 __syscall_return(type,__res); \
47750 diff -Nru a/include/asm-arm/xor.h b/include/asm-arm/xor.h
47751 --- a/include/asm-arm/xor.h Mon Feb 4 23:41:12 2002
47752 +++ b/include/asm-arm/xor.h Sun Aug 31 16:14:08 2003
47753 @@ -125,11 +125,11 @@
47756 static struct xor_block_template xor_block_arm4regs = {
47757 - name: "arm4regs",
47758 - do_2: xor_arm4regs_2,
47759 - do_3: xor_arm4regs_3,
47760 - do_4: xor_arm4regs_4,
47761 - do_5: xor_arm4regs_5,
47762 + .name = "arm4regs",
47763 + .do_2 = xor_arm4regs_2,
47764 + .do_3 = xor_arm4regs_3,
47765 + .do_4 = xor_arm4regs_4,
47766 + .do_5 = xor_arm4regs_5,
47769 #undef XOR_TRY_TEMPLATES
47770 diff -Nru a/include/asm-arm26/processor.h b/include/asm-arm26/processor.h
47771 --- a/include/asm-arm26/processor.h Thu Jun 26 03:24:47 2003
47772 +++ b/include/asm-arm26/processor.h Sun Aug 31 16:14:08 2003
47774 uaccess_t *uaccess; /* User access functions*/
47776 #define EXTRA_THREAD_STRUCT_INIT \
47777 - uaccess: &uaccess_kernel,
47778 + .uaccess = &uaccess_kernel,
47782 diff -Nru a/include/asm-arm26/xor.h b/include/asm-arm26/xor.h
47783 --- a/include/asm-arm26/xor.h Wed Jun 4 04:14:11 2003
47784 +++ b/include/asm-arm26/xor.h Sun Aug 31 16:14:08 2003
47785 @@ -125,11 +125,11 @@
47788 static struct xor_block_template xor_block_arm4regs = {
47789 - name: "arm4regs",
47790 - do_2: xor_arm4regs_2,
47791 - do_3: xor_arm4regs_3,
47792 - do_4: xor_arm4regs_4,
47793 - do_5: xor_arm4regs_5,
47794 + .name = "arm4regs",
47795 + .do_2 = xor_arm4regs_2,
47796 + .do_3 = xor_arm4regs_3,
47797 + .do_4 = xor_arm4regs_4,
47798 + .do_5 = xor_arm4regs_5,
47801 #undef XOR_TRY_TEMPLATES
47802 diff -Nru a/include/asm-h8300/aki3068net/ne.h b/include/asm-h8300/aki3068net/ne.h
47803 --- a/include/asm-h8300/aki3068net/ne.h Sat Jul 19 05:41:33 2003
47804 +++ /dev/null Wed Dec 31 16:00:00 1969
47806 -/* AE-3068 (aka. aki3068net) RTL8019AS Config */
47808 -#ifndef __H8300_AKI3068NET_NE__
47809 -#define __H8300_AKI3068NET_NE__
47811 -#define NE2000_ADDR 0x200000
47812 -#define NE2000_IRQ 5
47813 -#define NE2000_IRQ_VECTOR (12 + NE2000_IRQ)
47814 -#define NE2000_BYTE volatile unsigned short
47816 -#define IER 0xfee015
47817 -#define ISR 0xfee016
47818 -#define IRQ_MASK (1 << NE2000_IRQ)
47820 -#define WCRL 0xfee023
47821 -#define MAR0A 0xffff20
47822 -#define ETCR0A 0xffff24
47823 -#define DTCR0A 0xffff27
47824 -#define MAR0B 0xffff28
47825 -#define DTCR0B 0xffff2f
47827 -#define H8300_INIT_NE() \
47829 - wordlength = 1; \
47830 - outb_p(0x48, ioaddr + EN0_DCFG); \
47834 diff -Nru a/include/asm-h8300/aki3068net/timer_rate.h b/include/asm-h8300/aki3068net/timer_rate.h
47835 --- a/include/asm-h8300/aki3068net/timer_rate.h Sat Jul 19 09:19:25 2003
47836 +++ /dev/null Wed Dec 31 16:00:00 1969
47838 -#ifndef __H8300_AKI3068NET_TIMER_RATE__
47839 -#define __H8300_AKI3068NET_TIMER_RATE__
47841 -#include <linux/config.h>
47843 -#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
47844 -#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
47847 diff -Nru a/include/asm-h8300/edosk2674/timer_rate.h b/include/asm-h8300/edosk2674/timer_rate.h
47848 --- a/include/asm-h8300/edosk2674/timer_rate.h Sat Jul 19 09:18:09 2003
47849 +++ /dev/null Wed Dec 31 16:00:00 1969
47851 -#include <linux/config.h>
47853 -#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
47854 -#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
47855 diff -Nru a/include/asm-h8300/h8300_smsc.h b/include/asm-h8300/h8300_smsc.h
47856 --- /dev/null Wed Dec 31 16:00:00 1969
47857 +++ b/include/asm-h8300/h8300_smsc.h Sun Aug 31 14:01:50 2003
47859 +/****************************************************************************/
47862 + * h8300_smsc.h -- SMSC in H8/300H and H8S Evalution Board.
47864 + * (C) Copyright 2003, Yoshinori Sato <ysato@users.sourceforge.jp>
47867 +/****************************************************************************/
47868 +#ifndef h8300smsc_h
47869 +#define h8300smsc_h
47870 +/****************************************************************************/
47872 +/* Such a description is OK ? */
47873 +#define H8300_SMSC_DEFINE
47874 +#include <asm/machine-depend.h>
47875 +#undef H8300_SMSC_DEFINE
47877 +/****************************************************************************/
47878 +#endif /* h8300smsc_h */
47879 diff -Nru a/include/asm-h8300/h8max/machine-depend.h b/include/asm-h8300/h8max/machine-depend.h
47880 --- a/include/asm-h8300/h8max/machine-depend.h Thu Aug 21 22:56:17 2003
47881 +++ b/include/asm-h8300/h8max/machine-depend.h Wed Aug 27 07:02:04 2003
47882 @@ -101,67 +101,3 @@
47887 -/* H8MAX IDE I/F Config */
47888 -#ifdef H8300_IDE_DEFINE
47890 -#define H8300_IDE_BASE 0x200000
47891 -#define H8300_IDE_CTRL 0x60000c
47892 -#define H8300_IDE_IRQ 5
47893 -#define H8300_IDE_REG_OFFSET 2
47902 -#define outb(d,a) h8max_outb(d,(unsigned short *)a)
47903 -#define inb(a) h8max_inb((unsigned char *)a)
47904 -#define outb_p(d,a) h8max_outb(d,(unsigned short *)a)
47905 -#define inb_p(a) h8max_inb((unsigned char *)a)
47906 -#define outsw(addr,buf,len) h8max_outsw(addr,buf,len);
47907 -#define insw(addr,buf,len) h8max_insw(addr,buf,len);
47909 -static inline void h8max_outb(unsigned short d,unsigned short *a)
47914 -static inline unsigned char h8max_inb(unsigned char *a)
47919 -static inline void h8max_outsw(void *addr, void *buf, int len)
47921 - unsigned volatile short *ap = (unsigned volatile short *)addr;
47922 - unsigned short *bp = (unsigned short *)buf;
47923 - unsigned short d;
47926 - *ap = (d >> 8) | (d << 8);
47930 -static inline void h8max_insw(void *addr, void *buf, int len)
47932 - unsigned volatile short *ap = (unsigned volatile short *)addr;
47933 - unsigned short *bp = (unsigned short *)buf;
47934 - unsigned short d;
47937 - *bp++ = (d >> 8) | (d << 8);
47941 -static inline void target_ide_fix_driveid(struct hd_driveid *id)
47944 - unsigned short *p = (unsigned short *)id;
47945 - for (c = 0; c < SECTOR_WORDS; c++, p++)
47946 - *p = (*p >> 8) | (*p << 8);
47950 diff -Nru a/include/asm-h8300/h8max/ne.h b/include/asm-h8300/h8max/ne.h
47951 --- a/include/asm-h8300/h8max/ne.h Sat Jul 19 05:41:33 2003
47952 +++ /dev/null Wed Dec 31 16:00:00 1969
47954 -/* H8MAX RTL8019AS Config */
47956 -#ifndef __H8300_H8MAX_NE__
47957 -#define __H8300_H8MAX_NE__
47959 -#define NE2000_ADDR 0x800600
47960 -#define NE2000_IRQ 4
47961 -#define NE2000_IRQ_VECTOR (12 + NE2000_IRQ)
47962 -#define NE2000_BYTE volatile unsigned short
47964 -#define IER 0xfee015
47965 -#define ISR 0xfee016
47966 -#define IRQ_MASK (1 << NE2000_IRQ)
47967 -/* sorry quick hack */
47971 -#define outb(d,a) h8max_outb((d),(a) - NE2000_ADDR)
47975 -#define inb(a) h8max_inb((a) - NE2000_ADDR)
47976 -#if defined(outb_p)
47979 -#define outb_p(d,a) h8max_outb((d),(a) - NE2000_ADDR)
47980 -#if defined(inb_p)
47983 -#define inb_p(a) h8max_inb((a) - NE2000_ADDR)
47984 -#if defined(outsw)
47987 -#define outsw(a,p,l) h8max_outsw((a) - NE2000_ADDR,(unsigned short *)p,l)
47991 -#define insw(a,p,l) h8max_insw((a) - NE2000_ADDR,(unsigned short *)p,l)
47992 -#if defined(outsb)
47995 -#define outsb(a,p,l) h8max_outsb((a) - NE2000_ADDR,(unsigned char *)p,l)
47999 -#define insb(a,p,l) h8max_insb((a) - NE2000_ADDR,(unsigned char *)p,l)
48001 -#define H8300_INIT_NE() \
48003 - wordlength = 2; \
48004 - h8max_outb(0x49, ioaddr + EN0_DCFG); \
48005 - SA_prom[14] = SA_prom[15] = 0x57;\
48008 -static inline void h8max_outb(unsigned char d,unsigned char a)
48010 - *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
48013 -static inline unsigned char h8max_inb(unsigned char a)
48015 - return *(unsigned char *)(NE2000_ADDR + (a << 1) +1);
48018 -static inline void h8max_outsw(unsigned char a,unsigned short *p,unsigned long l)
48020 - unsigned short d;
48021 - for (; l != 0; --l, p++) {
48022 - d = (((*p) >> 8) & 0xff) | ((*p) << 8);
48023 - *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
48027 -static inline void h8max_insw(unsigned char a,unsigned short *p,unsigned long l)
48029 - unsigned short d;
48030 - for (; l != 0; --l, p++) {
48031 - d = *(unsigned short *)(NE2000_ADDR + (a << 1));
48032 - *p = (d << 8)|((d >> 8) & 0xff);
48036 -static inline void h8max_outsb(unsigned char a,unsigned char *p,unsigned long l)
48038 - for (; l != 0; --l, p++) {
48039 - *(unsigned short *)(NE2000_ADDR + (a << 1)) = *p;
48043 -static inline void h8max_insb(unsigned char a,unsigned char *p,unsigned long l)
48045 - for (; l != 0; --l, p++) {
48046 - *p = *((unsigned char *)(NE2000_ADDR + (a << 1))+1);
48051 diff -Nru a/include/asm-h8300/h8max/timer_rate.h b/include/asm-h8300/h8max/timer_rate.h
48052 --- a/include/asm-h8300/h8max/timer_rate.h Sat Jul 19 09:19:25 2003
48053 +++ /dev/null Wed Dec 31 16:00:00 1969
48055 -#ifndef __H8300_H8MAX_TIMER_RATE__
48056 -#define __H8300_H8MAX_TIMER_RATE__
48058 -#include <linux/config.h>
48060 -#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
48061 -#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
48065 diff -Nru a/include/asm-h8300/ide.h b/include/asm-h8300/ide.h
48066 --- a/include/asm-h8300/ide.h Thu Aug 21 08:55:15 2003
48067 +++ b/include/asm-h8300/ide.h Wed Aug 27 07:12:57 2003
48068 @@ -16,145 +16,26 @@
48070 /****************************************************************************/
48072 -#include <linux/config.h>
48073 -#include <linux/interrupt.h>
48074 +void h8300_ide_print_resource(char *name, hw_regs_t *hw);
48075 +static inline int ide_default_irq(unsigned long base) { return 0; };
48076 +static inline ide_ioreg_t ide_default_io_base(int index) { return 0; };
48078 -#include <asm/setup.h>
48079 -#include <asm/io.h>
48080 -#include <asm/irq.h>
48083 - * Some coldfire specifics.
48087 - * Save some space, only have 1 interface.
48089 -#define MAX_HWIFS 1
48092 - * Fix up things that may not have been provided.
48095 -#undef SUPPORT_SLOW_DATA_PORTS
48096 -#define SUPPORT_SLOW_DATA_PORTS 0
48098 -#undef SUPPORT_VLB_SYNC
48099 -#define SUPPORT_VLB_SYNC 0
48101 -/* this definition is used only on startup .. */
48103 -#define HD_DATA NULL
48105 -#define DBGIDE(fmt,a...)
48106 -// #define DBGIDE(fmt,a...) printk(fmt, ##a)
48107 -#define IDE_INLINE __inline__
48108 -// #define IDE_INLINE
48110 -#define ide__sti() __sti()
48112 -/****************************************************************************/
48115 - unsigned all : 8; /* all of the bits together */
48117 - unsigned bit7 : 1; /* always 1 */
48118 - unsigned lba : 1; /* using LBA instead of CHS */
48119 - unsigned bit5 : 1; /* always 1 */
48120 - unsigned unit : 1; /* drive select number, 0 or 1 */
48121 - unsigned head : 4; /* always zeros here */
48126 - * Our list of ports/irq's for different boards.
48129 -/* machine depend header include */
48130 -#define H8300_IDE_DEFINE
48131 -#include <asm/machine-depend.h>
48132 -#undef H8300_IDE_DEFINE
48134 -/****************************************************************************/
48136 -static IDE_INLINE int ide_default_irq(ide_ioreg_t base)
48137 +static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
48138 + unsigned long ctrl_port, int *irq)
48140 - return H8300_IDE_IRQ+12;
48143 -static IDE_INLINE ide_ioreg_t ide_default_io_base(int index)
48145 - return (ide_ioreg_t)H8300_IDE_BASE;
48149 - * Set up a hw structure for a specified data port, control port and IRQ.
48150 - * This should follow whatever the default interface uses.
48152 -static IDE_INLINE void ide_init_hwif_ports(
48154 - ide_ioreg_t data_port,
48155 - ide_ioreg_t ctrl_port,
48157 +static inline void ide_init_default_hwifs(void)
48159 - ide_ioreg_t reg = data_port;
48162 - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
48163 - hw->io_ports[i] = reg;
48164 - reg += H8300_IDE_REG_OFFSET;
48167 - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
48169 - hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t)H8300_IDE_CTRL;
48173 +#define MAX_HWIFS 1
48176 - * This registers the standard ports for this architecture with the IDE
48179 -static IDE_INLINE void ide_init_default_hwifs(void)
48182 - ide_ioreg_t base;
48185 - for (index = 0; index < MAX_HWIFS; index++) {
48186 - base = ide_default_io_base(index);
48189 - memset(&hw, 0, sizeof(hw));
48190 - ide_init_hwif_ports(&hw, base, 0, NULL);
48191 - hw.irq = ide_default_irq(base);
48192 - ide_register_hw(&hw, NULL);
48196 -#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
48197 -#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
48198 -#define ide_check_region(from,extent) (0)
48199 -#define ide_request_region(from,extent,name) do {} while(0)
48200 -#define ide_release_region(from,extent) do {} while(0)
48203 - * The following are not needed for the non-m68k ports
48205 -#define ide_ack_intr(hwif) (1)
48206 -#define ide_fix_driveid(id) target_ide_fix_driveid(id)
48207 -#define ide_release_lock(lock) do {} while (0)
48208 -#define ide_get_lock(lock, hdlr, data) do {} while (0)
48210 -static IDE_INLINE void ide_print_resource(char *name,hw_regs_t *hw)
48212 - printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name,
48213 - (unsigned int)hw->io_ports[IDE_DATA_OFFSET],
48214 - (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+(8*H8300_IDE_REG_OFFSET)-1,
48215 - (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET],
48218 +#define __ide_mm_insw(port,addr,count) do { } while(0)
48219 +#define __ide_mm_insl(port,addr,count) do { } while(0)
48220 +#define __ide_mm_outsw(port,addr,count) do { } while(0)
48221 +#define __ide_mm_outsl(port,addr,count) do { } while(0)
48223 /****************************************************************************/
48224 #endif /* __KERNEL__ */
48225 diff -Nru a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
48226 --- a/include/asm-h8300/irq.h Sun Jul 13 23:17:52 2003
48227 +++ b/include/asm-h8300/irq.h Wed Aug 27 07:02:04 2003
48230 #include <asm/ptrace.h>
48232 -#if defined(CONFIG_CPU_H8300H)
48233 +#if defined(__H8300H__)
48235 +#define EXT_IRQ0 12
48236 +#define EXT_IRQ1 13
48237 +#define EXT_IRQ2 14
48238 +#define EXT_IRQ3 15
48239 +#define EXT_IRQ4 16
48240 +#define EXT_IRQ5 17
48241 +#define EXT_IRQ6 18
48242 +#define EXT_IRQ7 19
48244 #if defined(CONFIG_CPU_H8S)
48245 #define NR_IRQS 128
48246 +#define EXT_IRQ0 16
48247 +#define EXT_IRQ1 17
48248 +#define EXT_IRQ2 18
48249 +#define EXT_IRQ3 19
48250 +#define EXT_IRQ4 20
48251 +#define EXT_IRQ5 21
48252 +#define EXT_IRQ6 22
48253 +#define EXT_IRQ7 23
48254 +#define EXT_IRQ8 24
48255 +#define EXT_IRQ9 25
48256 +#define EXT_IRQ10 26
48257 +#define EXT_IRQ11 27
48258 +#define EXT_IRQ12 28
48259 +#define EXT_IRQ13 29
48260 +#define EXT_IRQ14 30
48261 +#define EXT_IRQ15 31
48264 static __inline__ int irq_canonicalize(int irq)
48265 diff -Nru a/include/asm-h8300/machine-depend.h b/include/asm-h8300/machine-depend.h
48266 --- a/include/asm-h8300/machine-depend.h Thu Aug 21 22:56:18 2003
48267 +++ /dev/null Wed Dec 31 16:00:00 1969
48269 -/* EDOSK2674 board depend header */
48271 -/* TIMER rate define */
48272 -#ifdef H8300_TIMER_DEFINE
48273 -#define H8300_TIMER_COUNT_DATA 33000*10/8192
48274 -#define H8300_TIMER_FREQ 33000*1000/8192
48277 -/* EDOSK-2674R SMSC Network Controler Target Depend impliments */
48278 -#ifdef H8300_SMSC_DEFINE
48280 -#define SMSC_BASE 0xf80000
48281 -#define SMSC_IRQ 16
48283 -/* sorry quick hack */
48287 -#define outw(d,a) edosk2674_smsc_outw(d,(volatile unsigned short *)(a))
48291 -#define inw(a) edosk2674_smsc_inw((volatile unsigned short *)(a))
48292 -#if defined(outsw)
48295 -#define outsw(a,p,l) edosk2674_smsc_outsw((volatile unsigned short *)(a),p,l)
48299 -#define insw(a,p,l) edosk2674_smsc_insw((volatile unsigned short *)(a),p,l)
48301 -static inline void edosk2674_smsc_outw(
48302 - unsigned short d,
48303 - volatile unsigned short *a
48306 - *a = (d >> 8) | (d << 8);
48309 -static inline unsigned short edosk2674_smsc_inw(
48310 - volatile unsigned short *a
48313 - unsigned short d;
48315 - return (d >> 8) | (d << 8);
48318 -static inline void edosk2674_smsc_outsw(
48319 - volatile unsigned short *a,
48320 - unsigned short *p,
48324 - for (; l != 0; --l, p++)
48328 -static inline void edosk2674_smsc_insw(
48329 - volatile unsigned short *a,
48330 - unsigned short *p,
48334 - for (; l != 0; --l, p++)
48339 diff -Nru a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
48340 --- a/include/asm-h8300/pci.h Mon Jun 9 09:25:52 2003
48341 +++ b/include/asm-h8300/pci.h Wed Aug 27 07:02:04 2003
48343 /* We don't do dynamic PCI IRQ allocation */
48346 +#define PCI_DMA_BUS_IS_PHYS (1)
48348 #endif /* _ASM_H8300_PCI_H */
48349 diff -Nru a/include/asm-i386/apic.h b/include/asm-i386/apic.h
48350 --- a/include/asm-i386/apic.h Sun Jun 15 11:00:08 2003
48351 +++ b/include/asm-i386/apic.h Fri Aug 29 03:51:17 2003
48353 apic_write_around(APIC_EOI, 0);
48356 +extern void (*wait_timer_tick)(void);
48358 extern int get_maxlvt(void);
48359 extern void clear_local_APIC(void);
48360 extern void connect_bsp_APIC (void);
48361 diff -Nru a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
48362 --- a/include/asm-i386/bugs.h Sun Apr 20 12:24:22 2003
48363 +++ b/include/asm-i386/bugs.h Sun Aug 31 16:14:48 2003
48364 @@ -193,11 +193,6 @@
48365 && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11))
48366 panic("Kernel compiled for PMMX+, assumes a local APIC without the read-before-write bug!");
48369 -#ifdef CONFIG_X86_SSE2
48370 - if (!cpu_has_sse2)
48371 - panic("Kernel compiled for SSE2, CPU doesn't have it.");
48375 extern void alternative_instructions(void);
48376 diff -Nru a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
48377 --- /dev/null Wed Dec 31 16:00:00 1969
48378 +++ b/include/asm-i386/hpet.h Sun Aug 31 16:15:40 2003
48381 +#ifndef _I386_HPET_H
48382 +#define _I386_HPET_H
48384 +#ifdef CONFIG_HPET_TIMER
48386 +#include <linux/errno.h>
48387 +#include <linux/module.h>
48388 +#include <linux/sched.h>
48389 +#include <linux/kernel.h>
48390 +#include <linux/param.h>
48391 +#include <linux/string.h>
48392 +#include <linux/mm.h>
48393 +#include <linux/interrupt.h>
48394 +#include <linux/time.h>
48395 +#include <linux/delay.h>
48396 +#include <linux/init.h>
48397 +#include <linux/smp.h>
48399 +#include <asm/io.h>
48400 +#include <asm/smp.h>
48401 +#include <asm/irq.h>
48402 +#include <asm/msr.h>
48403 +#include <asm/delay.h>
48404 +#include <asm/mpspec.h>
48405 +#include <asm/uaccess.h>
48406 +#include <asm/processor.h>
48408 +#include <linux/timex.h>
48409 +#include <linux/config.h>
48411 +#include <asm/fixmap.h>
48414 + * Documentation on HPET can be found at:
48415 + * http://www.intel.com/ial/home/sp/pcmmspec.htm
48416 + * ftp://download.intel.com/ial/home/sp/mmts098.pdf
48419 +#define HPET_MMAP_SIZE 1024
48421 +#define HPET_ID 0x000
48422 +#define HPET_PERIOD 0x004
48423 +#define HPET_CFG 0x010
48424 +#define HPET_STATUS 0x020
48425 +#define HPET_COUNTER 0x0f0
48426 +#define HPET_T0_CFG 0x100
48427 +#define HPET_T0_CMP 0x108
48428 +#define HPET_T0_ROUTE 0x110
48429 +#define HPET_T1_CFG 0x120
48430 +#define HPET_T1_CMP 0x128
48431 +#define HPET_T1_ROUTE 0x130
48432 +#define HPET_T2_CFG 0x140
48433 +#define HPET_T2_CMP 0x148
48434 +#define HPET_T2_ROUTE 0x150
48436 +#define HPET_ID_VENDOR 0xffff0000
48437 +#define HPET_ID_LEGSUP 0x00008000
48438 +#define HPET_ID_NUMBER 0x00001f00
48439 +#define HPET_ID_REV 0x000000ff
48441 +#define HPET_ID_VENDOR_SHIFT 16
48442 +#define HPET_ID_VENDOR_8086 0x8086
48444 +#define HPET_CFG_ENABLE 0x001
48445 +#define HPET_CFG_LEGACY 0x002
48447 +#define HPET_TN_ENABLE 0x004
48448 +#define HPET_TN_PERIODIC 0x008
48449 +#define HPET_TN_PERIODIC_CAP 0x010
48450 +#define HPET_TN_SETVAL 0x040
48451 +#define HPET_TN_32BIT 0x100
48453 +/* Use our own asm for 64 bit multiply/divide */
48454 +#define ASM_MUL64_REG(eax_out,edx_out,reg_in,eax_in) \
48455 + __asm__ __volatile__("mull %2" \
48456 + :"=a" (eax_out), "=d" (edx_out) \
48457 + :"r" (reg_in), "0" (eax_in))
48459 +#define ASM_DIV64_REG(eax_out,edx_out,reg_in,eax_in,edx_in) \
48460 + __asm__ __volatile__("divl %2" \
48461 + :"=a" (eax_out), "=d" (edx_out) \
48462 + :"r" (reg_in), "0" (eax_in), "1" (edx_in))
48464 +#define KERNEL_TICK_USEC (1000000UL/HZ) /* tick value in microsec */
48465 +/* Max HPET Period is 10^8 femto sec as in HPET spec */
48466 +#define HPET_MAX_PERIOD (100000000UL)
48468 + * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
48469 + * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
48471 +#define HPET_MIN_PERIOD (100000UL)
48473 +extern unsigned long hpet_period; /* fsecs / HPET clock */
48474 +extern unsigned long hpet_tick; /* hpet clks count per tick */
48475 +extern unsigned long hpet_address; /* hpet memory map physical address */
48477 +extern int hpet_rtc_timer_init(void);
48478 +extern int hpet_enable(void);
48479 +extern int is_hpet_enabled(void);
48480 +extern int is_hpet_capable(void);
48481 +extern int hpet_readl(unsigned long a);
48482 +extern void hpet_writel(unsigned long d, unsigned long a);
48485 +#define CONFIG_HPET_EMULATE_RTC 1
48486 +extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
48487 +extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
48488 +extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec);
48489 +extern int hpet_set_periodic_freq(unsigned long freq);
48490 +extern int hpet_rtc_dropped_irq(void);
48491 +extern int hpet_rtc_timer_init(void);
48492 +extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
48493 +#endif /* CONFIG_RTC */
48494 +#endif /* CONFIG_HPET_TIMER */
48495 +#endif /* _I386_HPET_H */
48496 diff -Nru a/include/asm-i386/i387.h b/include/asm-i386/i387.h
48497 --- a/include/asm-i386/i387.h Fri May 9 14:22:55 2003
48498 +++ b/include/asm-i386/i387.h Tue Sep 2 00:37:21 2003
48500 extern void kernel_fpu_begin(void);
48501 #define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
48505 + * These must be called with preempt disabled
48507 static inline void __save_init_fpu( struct task_struct *tsk )
48509 if ( cpu_has_fxsr ) {
48510 @@ -39,19 +41,12 @@
48511 tsk->thread_info->status &= ~TS_USEDFPU;
48514 -static inline void save_init_fpu( struct task_struct *tsk )
48516 - __save_init_fpu(tsk);
48521 -#define unlazy_fpu( tsk ) do { \
48522 +#define __unlazy_fpu( tsk ) do { \
48523 if ((tsk)->thread_info->status & TS_USEDFPU) \
48524 save_init_fpu( tsk ); \
48527 -#define clear_fpu( tsk ) \
48528 +#define __clear_fpu( tsk ) \
48530 if ((tsk)->thread_info->status & TS_USEDFPU) { \
48531 asm volatile("fwait"); \
48538 + * These disable preemption on their own and are safe
48540 +static inline void save_init_fpu( struct task_struct *tsk )
48542 + preempt_disable();
48543 + __save_init_fpu(tsk);
48545 + preempt_enable();
48548 +#define unlazy_fpu( tsk ) do { \
48549 + preempt_disable(); \
48550 + __unlazy_fpu(tsk); \
48551 + preempt_enable(); \
48554 +#define clear_fpu( tsk ) do { \
48555 + preempt_disable(); \
48556 + __clear_fpu( tsk ); \
48557 + preempt_enable(); \
48561 * FPU state interaction...
48563 diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h
48564 --- a/include/asm-i386/processor.h Wed Aug 20 11:14:51 2003
48565 +++ b/include/asm-i386/processor.h Sun Aug 31 16:13:54 2003
48566 @@ -578,6 +578,8 @@
48567 #define ARCH_HAS_PREFETCH
48568 extern inline void prefetch(const void *x)
48570 + if (cpu_data[0].x86_vendor == X86_VENDOR_AMD)
48571 + return; /* Some athlons fault if the address is bad */
48572 alternative_input(ASM_NOP4,
48573 "prefetchnta (%1)",
48575 diff -Nru a/include/asm-i386/smp.h b/include/asm-i386/smp.h
48576 --- a/include/asm-i386/smp.h Mon Aug 18 19:46:23 2003
48577 +++ b/include/asm-i386/smp.h Sun Aug 31 16:14:42 2003
48581 extern void smp_alloc_memory(void);
48582 -extern physid_mask_t phys_cpu_present_map;
48583 extern int pic_mode;
48584 extern int smp_num_siblings;
48585 extern int cpu_sibling_map[];
48586 diff -Nru a/include/asm-i386/timer.h b/include/asm-i386/timer.h
48587 --- a/include/asm-i386/timer.h Wed Jul 2 21:21:34 2003
48588 +++ b/include/asm-i386/timer.h Sun Aug 31 16:15:21 2003
48590 extern struct timer_opts timer_cyclone;
48593 +#ifdef CONFIG_HPET_TIMER
48594 +extern struct timer_opts timer_hpet;
48598 diff -Nru a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
48599 --- a/include/asm-ia64/hw_irq.h Tue Jul 29 08:53:10 2003
48600 +++ b/include/asm-ia64/hw_irq.h Tue Aug 26 15:09:18 2003
48602 * Vectors 0x10-0x1f are used for low priority interrupts, e.g. CMCI.
48604 #define IA64_CPEP_VECTOR 0x1c /* corrected platform error polling vector */
48605 -#define IA64_CMCP_VECTOR 0x1d /* correctable machine-check polling vector */
48606 +#define IA64_CMCP_VECTOR 0x1d /* corrected machine-check polling vector */
48607 #define IA64_CPE_VECTOR 0x1e /* corrected platform error interrupt vector */
48608 -#define IA64_CMC_VECTOR 0x1f /* correctable machine-check interrupt vector */
48609 +#define IA64_CMC_VECTOR 0x1f /* corrected machine-check interrupt vector */
48611 * Vectors 0x20-0x2f are reserved for legacy ISA IRQs.
48613 diff -Nru a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
48614 --- a/include/asm-ia64/pci.h Tue Jun 24 14:16:56 2003
48615 +++ b/include/asm-ia64/pci.h Mon Aug 25 14:45:43 2003
48617 #define pci_dac_dma_supported(pci_dev, mask) (1)
48618 #define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
48619 #define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
48620 -#define pci_dac_dma_to_offset(dev,dma_addr) ((dma_addr) & ~PAGE_MASK)
48621 +#define pci_dac_dma_to_offset(dev,dma_addr) offset_in_page(dma_addr)
48622 #define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { mb(); } while (0)
48624 #define sg_dma_len(sg) ((sg)->dma_length)
48625 diff -Nru a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
48626 --- a/include/asm-ia64/unistd.h Tue Aug 19 23:13:40 2003
48627 +++ b/include/asm-ia64/unistd.h Mon Aug 25 14:47:33 2003
48628 @@ -248,6 +248,7 @@
48629 #define __NR_sys_clock_nanosleep 1256
48630 #define __NR_sys_fstatfs64 1257
48631 #define __NR_sys_statfs64 1258
48632 +#define __NR_fadvises64_64 1259
48636 diff -Nru a/include/asm-m68k/local.h b/include/asm-m68k/local.h
48637 --- /dev/null Wed Dec 31 16:00:00 1969
48638 +++ b/include/asm-m68k/local.h Sun Jul 27 17:23:16 2003
48640 +#ifndef _ASM_M68K_LOCAL_H
48641 +#define _ASM_M68K_LOCAL_H
48643 +#include <asm-generic/local.h>
48645 +#endif /* _ASM_M68K_LOCAL_H */
48646 diff -Nru a/include/asm-m68k/sections.h b/include/asm-m68k/sections.h
48647 --- /dev/null Wed Dec 31 16:00:00 1969
48648 +++ b/include/asm-m68k/sections.h Sun Jul 27 17:23:16 2003
48650 +#ifndef _ASM_M68K_SECTIONS_H
48651 +#define _ASM_M68K_SECTIONS_H
48653 +#include <asm-generic/sections.h>
48655 +#endif /* _ASM_M68K_SECTIONS_H */
48656 diff -Nru a/include/asm-m68k/system.h b/include/asm-m68k/system.h
48657 --- a/include/asm-m68k/system.h Wed Feb 26 10:53:19 2003
48658 +++ b/include/asm-m68k/system.h Tue Aug 12 05:48:28 2003
48660 #define switch_to(prev,next,last) do { \
48661 register void *_prev __asm__ ("a0") = (prev); \
48662 register void *_next __asm__ ("a1") = (next); \
48663 + register void *_last __asm__ ("d1"); \
48664 __asm__ __volatile__("jbsr resume" \
48665 - : : "a" (_prev), "a" (_next) \
48666 - : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \
48667 + : "=a" (_prev), "=a" (_next), "=d" (_last) \
48668 + : "0" (_prev), "1" (_next) \
48669 + : "d0", "d2", "d3", "d4", "d5"); \
48670 + (last) = _last; \
48674 diff -Nru a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
48675 --- a/include/asm-m68knommu/irq.h Fri Nov 1 08:37:46 2002
48676 +++ b/include/asm-m68knommu/irq.h Sat Aug 23 06:08:54 2003
48678 #define _M68K_IRQ_H_
48680 #include <linux/config.h>
48681 +#include <linux/interrupt.h>
48682 #include <asm/ptrace.h>
48684 #ifdef CONFIG_COLDFIRE
48686 extern void (*mach_disable_irq)(unsigned int);
48688 extern int sys_request_irq(unsigned int,
48689 - void (*)(int, void *, struct pt_regs *),
48690 + irqreturn_t (*)(int, void *, struct pt_regs *),
48691 unsigned long, const char *, void *);
48692 extern void sys_free_irq(unsigned int, void *);
48695 * interrupt source (if it supports chaining).
48697 typedef struct irq_node {
48698 - void (*handler)(int, void *, struct pt_regs *);
48699 + irqreturn_t (*handler)(int, void *, struct pt_regs *);
48700 unsigned long flags;
48702 const char *devname;
48703 @@ -102,7 +103,7 @@
48704 * This structure has only 4 elements for speed reasons
48706 typedef struct irq_handler {
48707 - void (*handler)(int, void *, struct pt_regs *);
48708 + irqreturn_t (*handler)(int, void *, struct pt_regs *);
48709 unsigned long flags;
48711 const char *devname;
48712 diff -Nru a/include/asm-m68knommu/local.h b/include/asm-m68knommu/local.h
48713 --- /dev/null Wed Dec 31 16:00:00 1969
48714 +++ b/include/asm-m68knommu/local.h Sat Aug 23 06:08:54 2003
48716 +#ifndef __M68KNOMMU_LOCAL_H
48717 +#define __M68KNOMMU_LOCAL_H
48719 +#include <asm-generic/local.h>
48721 +#endif /* __M68KNOMMU_LOCAL_H */
48722 diff -Nru a/include/asm-m68knommu/sections.h b/include/asm-m68knommu/sections.h
48723 --- /dev/null Wed Dec 31 16:00:00 1969
48724 +++ b/include/asm-m68knommu/sections.h Sat Aug 23 06:08:54 2003
48726 +#ifndef _M68KNOMMU_SECTIONS_H
48727 +#define _M68KNOMMU_SECTIONS_H
48729 +/* nothing to see, move along */
48730 +#include <asm-generic/sections.h>
48733 diff -Nru a/include/asm-ppc/cpm_8260.h b/include/asm-ppc/cpm_8260.h
48734 --- a/include/asm-ppc/cpm_8260.h Sun Sep 15 21:52:03 2002
48735 +++ b/include/asm-ppc/cpm_8260.h Thu Aug 21 15:26:43 2003
48736 @@ -195,7 +195,7 @@
48738 /* SMC uart mode register (Internal memory map).
48740 -#define SMCMR_REN ((ushort)0x0001)
48741 +#define SMCMR_REN ((ushort)0x0001)
48742 #define SMCMR_TEN ((ushort)0x0002)
48743 #define SMCMR_DM ((ushort)0x000c)
48744 #define SMCMR_SM_GCI ((ushort)0x0000)
48745 @@ -212,10 +212,12 @@
48747 /* SMC Event and Mask register.
48749 -#define SMCM_TXE ((unsigned char)0x10)
48750 -#define SMCM_BSY ((unsigned char)0x04)
48751 -#define SMCM_TX ((unsigned char)0x02)
48752 -#define SMCM_RX ((unsigned char)0x01)
48753 +#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
48754 +#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
48755 +#define SMCM_TXE ((unsigned char)0x10)
48756 +#define SMCM_BSY ((unsigned char)0x04)
48757 +#define SMCM_TX ((unsigned char)0x02)
48758 +#define SMCM_RX ((unsigned char)0x01)
48760 /* Baud rate generators.
48762 @@ -314,10 +316,10 @@
48764 /* SCC Event and Mask register.
48766 -#define SCCM_TXE ((unsigned char)0x10)
48767 -#define SCCM_BSY ((unsigned char)0x04)
48768 -#define SCCM_TX ((unsigned char)0x02)
48769 -#define SCCM_RX ((unsigned char)0x01)
48770 +#define SCCM_TXE ((unsigned char)0x10)
48771 +#define SCCM_BSY ((unsigned char)0x04)
48772 +#define SCCM_TX ((unsigned char)0x02)
48773 +#define SCCM_RX ((unsigned char)0x01)
48775 typedef struct scc_param {
48776 ushort scc_rbase; /* Rx Buffer descriptor base address */
48777 diff -Nru a/include/asm-ppc/macio.h b/include/asm-ppc/macio.h
48778 --- a/include/asm-ppc/macio.h Sat Aug 9 09:39:19 2003
48779 +++ b/include/asm-ppc/macio.h Sun Aug 24 04:06:49 2003
48781 #define to_macio_device(d) container_of(d, struct macio_dev, ofdev.dev)
48782 #define of_to_macio_device(d) container_of(d, struct macio_dev, ofdev)
48784 +extern struct macio_dev *macio_dev_get(struct macio_dev *dev);
48785 +extern void macio_dev_put(struct macio_dev *dev);
48788 * A driver for a mac-io chip based device
48791 int (*probe)(struct macio_dev* dev, const struct of_match *match);
48792 int (*remove)(struct macio_dev* dev);
48794 - int (*suspend)(struct macio_dev* dev, u32 state, u32 level);
48795 - int (*resume)(struct macio_dev* dev, u32 level);
48796 + int (*suspend)(struct macio_dev* dev, u32 state);
48797 + int (*resume)(struct macio_dev* dev);
48798 int (*shutdown)(struct macio_dev* dev);
48800 struct device_driver driver;
48801 diff -Nru a/include/asm-ppc/of_device.h b/include/asm-ppc/of_device.h
48802 --- a/include/asm-ppc/of_device.h Sat Aug 9 09:40:04 2003
48803 +++ b/include/asm-ppc/of_device.h Sun Aug 24 04:06:49 2003
48805 extern const struct of_match *of_match_device(
48806 const struct of_match *matches, const struct of_device *dev);
48808 +extern struct of_device *of_dev_get(struct of_device *dev);
48809 +extern void of_dev_put(struct of_device *dev);
48812 * An of_platform_driver driver is attached to a basic of_device on
48813 * the "platform bus" (of_platform_bus_type)
48815 int (*probe)(struct of_device* dev, const struct of_match *match);
48816 int (*remove)(struct of_device* dev);
48818 - int (*suspend)(struct of_device* dev, u32 state, u32 level);
48819 - int (*resume)(struct of_device* dev, u32 level);
48820 + int (*suspend)(struct of_device* dev, u32 state);
48821 + int (*resume)(struct of_device* dev);
48822 int (*shutdown)(struct of_device* dev);
48824 struct device_driver driver;
48826 extern int of_device_register(struct of_device *ofdev);
48827 extern void of_device_unregister(struct of_device *ofdev);
48828 extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id);
48829 +extern void of_release_dev(struct device *dev);
48831 #endif /* __OF_DEVICE_H__ */
48833 diff -Nru a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
48834 --- a/include/asm-ppc/processor.h Wed Jul 16 20:41:10 2003
48835 +++ b/include/asm-ppc/processor.h Fri Aug 22 05:26:16 2003
48836 @@ -654,6 +654,7 @@
48840 +#define MCA_bus__is_a_macro
48842 /* Lazy FPU handling on uni-processor */
48843 extern struct task_struct *last_task_used_math;
48844 diff -Nru a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
48845 --- a/include/asm-ppc/prom.h Sat Jan 4 03:31:26 2003
48846 +++ b/include/asm-ppc/prom.h Sun Aug 24 03:57:52 2003
48847 @@ -62,18 +62,35 @@
48849 typedef void (*prom_entry)(struct prom_args *);
48852 -extern void abort(void);
48853 -extern unsigned long prom_init(int, int, prom_entry);
48854 -extern void prom_print(const char *msg);
48855 -extern void relocate_nodes(void);
48856 -extern void finish_device_tree(void);
48857 +/* OBSOLETE: Old style node lookup */
48858 extern struct device_node *find_devices(const char *name);
48859 extern struct device_node *find_type_devices(const char *type);
48860 extern struct device_node *find_path_device(const char *path);
48861 extern struct device_node *find_compatible_devices(const char *type,
48862 const char *compat);
48863 extern struct device_node *find_all_nodes(void);
48865 +/* New style node lookup */
48866 +extern struct device_node *of_find_node_by_name(struct device_node *from,
48867 + const char *name);
48868 +extern struct device_node *of_find_node_by_type(struct device_node *from,
48869 + const char *type);
48870 +extern struct device_node *of_find_compatible_node(struct device_node *from,
48871 + const char *type, const char *compat);
48872 +extern struct device_node *of_find_node_by_path(const char *path);
48873 +extern struct device_node *of_find_all_nodes(struct device_node *prev);
48874 +extern struct device_node *of_get_parent(const struct device_node *node);
48875 +extern struct device_node *of_get_next_child(const struct device_node *node,
48876 + struct device_node *prev);
48877 +extern struct device_node *of_node_get(struct device_node *node);
48878 +extern void of_node_put(struct device_node *node);
48880 +/* Other Prototypes */
48881 +extern void abort(void);
48882 +extern unsigned long prom_init(int, int, prom_entry);
48883 +extern void prom_print(const char *msg);
48884 +extern void relocate_nodes(void);
48885 +extern void finish_device_tree(void);
48886 extern int device_is_compatible(struct device_node *device, const char *);
48887 extern int machine_is_compatible(const char *compat);
48888 extern unsigned char *get_property(struct device_node *node, const char *name,
48889 diff -Nru a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
48890 --- a/include/asm-ppc/unistd.h Tue Jul 15 04:47:19 2003
48891 +++ b/include/asm-ppc/unistd.h Fri Aug 22 19:15:18 2003
48892 @@ -258,8 +258,9 @@
48893 #define __NR_utimes 251
48894 #define __NR_statfs64 252
48895 #define __NR_fstatfs64 253
48896 +#define __NR_fadvise64_64 254
48898 -#define __NR_syscalls 254
48899 +#define __NR_syscalls 255
48903 diff -Nru a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
48904 --- a/include/asm-sparc/pci.h Mon Jun 9 09:27:29 2003
48905 +++ b/include/asm-sparc/pci.h Thu Aug 28 01:15:54 2003
48907 #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
48908 (((PTR)->LEN_NAME) = (VAL))
48911 + * Same as above, only with pages instead of mapped addresses.
48913 +extern dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page,
48914 + unsigned long offset, size_t size, int direction);
48915 +extern void pci_unmap_page(struct pci_dev *hwdev,
48916 + dma_addr_t dma_address, size_t size, int direction);
48918 /* Map a set of buffers described by scatterlist in streaming
48919 * mode for DMA. This is the scather-gather version of the
48920 * above pci_map_single interface. Here the scatter gather list
48921 diff -Nru a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
48922 --- a/include/asm-sparc/smp.h Mon Aug 18 19:46:23 2003
48923 +++ b/include/asm-sparc/smp.h Thu Aug 28 00:18:36 2003
48926 #include <linux/config.h>
48927 #include <linux/threads.h>
48928 -#include <linux/cpumask.h>
48929 #include <asm/head.h>
48930 #include <asm/btfixup.h>
48932 #ifndef __ASSEMBLY__
48934 +#include <linux/cpumask.h>
48936 /* PROM provided per-processor information we need
48937 * to start them all up.
48939 diff -Nru a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
48940 --- a/include/asm-sparc/unistd.h Sat Aug 16 14:13:18 2003
48941 +++ b/include/asm-sparc/unistd.h Wed Aug 27 23:52:25 2003
48942 @@ -282,10 +282,11 @@
48943 #define __NR_timer_gettime 263
48944 #define __NR_timer_getoverrun 264
48945 #define __NR_timer_delete 265
48946 -/* WARNING: You MAY NOT add syscall numbers larger than 265, since
48947 +#define __NR_timer_create 266
48948 +/* WARNING: You MAY NOT add syscall numbers larger than 266, since
48949 * all of the syscall tables in the Sparc kernel are
48950 - * sized to have 266 entries (starting at zero). Therefore
48951 - * find a free slot in the 0-265 range.
48952 + * sized to have 267 entries (starting at zero). Therefore
48953 + * find a free slot in the 0-266 range.
48956 #define _syscall0(type,name) \
48957 diff -Nru a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
48958 --- a/include/asm-sparc64/siginfo.h Sun Jan 5 23:08:44 2003
48959 +++ b/include/asm-sparc64/siginfo.h Thu Aug 28 01:31:51 2003
48963 typedef struct sigevent32 {
48964 - sigval_t sigev_value;
48965 + sigval_t32 sigev_value;
48969 diff -Nru a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
48970 --- a/include/asm-sparc64/unistd.h Sat Aug 16 14:13:18 2003
48971 +++ b/include/asm-sparc64/unistd.h Wed Aug 27 23:52:25 2003
48972 @@ -284,10 +284,11 @@
48973 #define __NR_timer_gettime 263
48974 #define __NR_timer_getoverrun 264
48975 #define __NR_timer_delete 265
48976 -/* WARNING: You MAY NOT add syscall numbers larger than 265, since
48977 +#define __NR_timer_create 266
48978 +/* WARNING: You MAY NOT add syscall numbers larger than 266, since
48979 * all of the syscall tables in the Sparc kernel are
48980 - * sized to have 266 entries (starting at zero). Therefore
48981 - * find a free slot in the 0-265 range.
48982 + * sized to have 267 entries (starting at zero). Therefore
48983 + * find a free slot in the 0-266 range.
48986 #define _syscall0(type,name) \
48987 diff -Nru a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
48988 --- a/include/asm-x86_64/bitops.h Mon Aug 18 19:46:23 2003
48989 +++ b/include/asm-x86_64/bitops.h Sat Aug 23 04:08:11 2003
48990 @@ -466,7 +466,7 @@
48992 __asm__("bsfl %1,%0\n\t"
48994 - : "=r" (r) : "g" (x), "r" (32));
48995 + : "=r" (r) : "g" (x), "r" (-1));
48999 diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h
49000 --- a/include/asm-x86_64/ia32.h Fri May 23 03:22:07 2003
49001 +++ b/include/asm-x86_64/ia32.h Sun Aug 31 16:13:59 2003
49002 @@ -160,7 +160,6 @@
49006 -#define IA32_PAGE_OFFSET 0xffffe000
49007 #define IA32_STACK_TOP IA32_PAGE_OFFSET
49010 diff -Nru a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
49011 --- a/include/asm-x86_64/mpspec.h Mon Aug 18 19:46:23 2003
49012 +++ b/include/asm-x86_64/mpspec.h Sat Aug 23 05:13:33 2003
49013 @@ -169,7 +169,6 @@
49014 extern cpumask_t mp_bus_to_cpumask [MAX_MP_BUSSES];
49016 extern unsigned int boot_cpu_physical_apicid;
49017 -extern cpumask_t phys_cpu_present_map;
49018 extern int smp_found_config;
49019 extern void find_smp_config (void);
49020 extern void get_smp_config (void);
49021 @@ -197,6 +196,50 @@
49022 extern void mp_config_ioapic_for_sci(int irq);
49024 extern int using_apic_timer;
49026 +#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
49028 +struct physid_mask
49030 + unsigned long mask[PHYSID_ARRAY_SIZE];
49033 +typedef struct physid_mask physid_mask_t;
49035 +#define physid_set(physid, map) set_bit(physid, (map).mask)
49036 +#define physid_clear(physid, map) clear_bit(physid, (map).mask)
49037 +#define physid_isset(physid, map) test_bit(physid, (map).mask)
49038 +#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
49040 +#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
49041 +#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
49042 +#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS)
49043 +#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
49044 +#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
49045 +#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
49046 +#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
49047 +#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
49048 +#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
49049 +#define physids_coerce(map) ((map).mask[0])
49051 +#define physids_promote(physids) \
49053 + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
49054 + __physid_mask.mask[0] = physids; \
49058 +#define physid_mask_of_physid(physid) \
49060 + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
49061 + physid_set(physid, __physid_mask); \
49065 +#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
49066 +#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
49068 +extern physid_mask_t phys_cpu_present_map;
49072 diff -Nru a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
49073 --- a/include/asm-x86_64/percpu.h Fri Aug 8 13:06:56 2003
49074 +++ b/include/asm-x86_64/percpu.h Sat Aug 23 05:29:54 2003
49076 memcpy((pcpudst)+__per_cpu_offset(__i), \
49080 +extern void setup_per_cpu_areas(void);
49084 #define DEFINE_PER_CPU(type, name) \
49087 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
49088 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
49090 -extern void setup_per_cpu_areas(void);
49092 #endif /* _ASM_X8664_PERCPU_H_ */
49093 diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
49094 --- a/include/asm-x86_64/processor.h Wed Aug 20 11:16:28 2003
49095 +++ b/include/asm-x86_64/processor.h Sun Aug 31 16:13:59 2003
49097 #include <asm/current.h>
49098 #include <asm/system.h>
49099 #include <asm/mmsegment.h>
49100 +#include <linux/personality.h>
49102 #define TF_MASK 0x00000100
49103 #define IF_MASK 0x00000200
49104 @@ -172,7 +173,8 @@
49105 /* This decides where the kernel will search for a free chunk of vm
49106 * space during mmap's.
49108 -#define TASK_UNMAPPED_32 0xa0000000
49109 +#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? 0xc0000000 : 0xFFFFe000)
49110 +#define TASK_UNMAPPED_32 (IA32_PAGE_OFFSET / 3)
49111 #define TASK_UNMAPPED_64 PAGE_ALIGN(TASK_SIZE/3)
49112 #define TASK_UNMAPPED_BASE \
49113 (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64)
49114 @@ -225,7 +227,6 @@
49115 * 8 bytes, for an extra "long" of ~0UL
49117 unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
49118 - u32 __cacheline_filler[4]; /* size is 0x100 */
49119 } __attribute__((packed)) ____cacheline_aligned;
49121 struct thread_struct {
49122 diff -Nru a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
49123 --- a/include/asm-x86_64/smp.h Mon Aug 18 19:46:23 2003
49124 +++ b/include/asm-x86_64/smp.h Sat Aug 23 05:14:50 2003
49128 extern void smp_alloc_memory(void);
49129 -extern cpumask_t phys_cpu_present_map;
49130 extern cpumask_t cpu_online_map;
49131 extern volatile unsigned long smp_invalidate_needed;
49132 extern int pic_mode;
49133 diff -Nru a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h
49134 --- a/include/asm-x86_64/suspend.h Sat Jun 7 00:54:11 2003
49135 +++ b/include/asm-x86_64/suspend.h Sat Aug 23 05:22:09 2003
49137 :"r" ((thread)->debugreg##register))
49139 extern void fix_processor_context(void);
49140 -extern void do_magic(int resume);
49141 +extern int do_magic(int resume);
49143 #ifdef CONFIG_ACPI_SLEEP
49144 extern unsigned long saved_eip;
49145 diff -Nru a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
49146 --- a/include/asm-x86_64/topology.h Mon Aug 18 19:46:23 2003
49147 +++ b/include/asm-x86_64/topology.h Sat Aug 23 04:00:02 2003
49148 @@ -10,21 +10,18 @@
49149 /* Map the K8 CPU local memory controllers to a simple 1:1 CPU:NODE topology */
49151 extern int fake_node;
49152 -extern cpumask_t cpu_online_map;
49153 +extern unsigned long cpu_online_map;
49155 #define cpu_to_node(cpu) (fake_node ? 0 : (cpu))
49156 #define memblk_to_node(memblk) (fake_node ? 0 : (memblk))
49157 #define parent_node(node) (node)
49158 #define node_to_first_cpu(node) (fake_node ? 0 : (node))
49159 -#define node_to_cpu_mask(node) (fake_node ? cpu_online_map : cpumask_of_cpu(node))
49160 +#define node_to_cpu_mask(node) (fake_node ? cpu_online_map : (1UL << (node)))
49161 #define node_to_memblk(node) (node)
49163 -static inline cpumask_t pcibus_to_cpumask(int bus)
49164 +static inline unsigned long pcibus_to_cpumask(int bus)
49168 - cpus_and(ret, mp_bus_to_cpumask[bus], cpu_online_map);
49170 + return mp_bus_to_cpumask[bus] & cpu_online_map;
49173 #define NODE_BALANCE_RATE 30 /* CHECKME */
49174 diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h
49175 --- a/include/linux/blkdev.h Thu Aug 14 18:16:17 2003
49176 +++ b/include/linux/blkdev.h Mon Sep 1 04:03:21 2003
49177 @@ -243,6 +243,7 @@
49180 typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
49181 +typedef void (activity_fn) (void *data, int rw);
49183 enum blk_queue_state {
49185 @@ -283,6 +284,7 @@
49186 prep_rq_fn *prep_rq_fn;
49187 unplug_fn *unplug_fn;
49188 merge_bvec_fn *merge_bvec_fn;
49189 + activity_fn *activity_fn;
49192 * Auto-unplugging state
49193 @@ -300,6 +302,8 @@
49197 + void *activity_data;
49200 * queue needs bounce pages for pages above this limit
49202 @@ -504,6 +508,7 @@
49203 extern void blk_stop_queue(request_queue_t *q);
49204 extern void __blk_stop_queue(request_queue_t *q);
49205 extern void blk_run_queue(request_queue_t *q);
49206 +extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
49208 static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
49210 diff -Nru a/include/linux/cyclomx.h b/include/linux/cyclomx.h
49211 --- a/include/linux/cyclomx.h Tue May 20 07:19:38 2003
49212 +++ b/include/linux/cyclomx.h Sat Aug 23 20:38:19 2003
49214 char in_isr; /* interrupt-in-service flag */
49215 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
49216 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
49217 - u32 mbox; /* -> mailbox */
49218 + void *mbox; /* -> mailbox */
49219 void (*isr)(struct cycx_device* card); /* interrupt service routine */
49220 int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
49222 diff -Nru a/include/linux/cycx_cfm.h b/include/linux/cycx_cfm.h
49223 --- a/include/linux/cycx_cfm.h Thu May 15 19:24:05 2003
49224 +++ b/include/linux/cycx_cfm.h Sat Aug 23 19:57:15 2003
49226 unsigned short reserved[6];
49227 char descr[CFM_DESCR_LEN];
49228 struct cycx_fw_info info;
49229 - unsigned char image[1];
49230 + unsigned char image[0];
49233 struct cycx_fw_header {
49234 diff -Nru a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h
49235 --- a/include/linux/cycx_drv.h Thu May 15 19:33:21 2003
49236 +++ b/include/linux/cycx_drv.h Sat Aug 23 20:11:44 2003
49247 extern int cycx_down(struct cycx_hw *hw);
49248 extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
49249 extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
49250 -extern int cycx_exec(u32 addr);
49251 +extern int cycx_exec(void *addr);
49253 extern void cycx_inten(struct cycx_hw *hw);
49254 extern void cycx_intr(struct cycx_hw *hw);
49255 diff -Nru a/include/linux/ethtool.h b/include/linux/ethtool.h
49256 --- a/include/linux/ethtool.h Thu Aug 7 13:16:01 2003
49257 +++ b/include/linux/ethtool.h Mon Sep 1 17:25:54 2003
49258 @@ -255,8 +255,11 @@
49259 /* Some generic methods drivers may use in their ethtool_ops */
49260 u32 ethtool_op_get_link(struct net_device *dev);
49261 u32 ethtool_op_get_tx_csum(struct net_device *dev);
49262 +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
49263 u32 ethtool_op_get_sg(struct net_device *dev);
49264 int ethtool_op_set_sg(struct net_device *dev, u32 data);
49265 +u32 ethtool_op_get_tso(struct net_device *dev);
49266 +int ethtool_op_set_tso(struct net_device *dev, u32 data);
49269 * ðtool_ops - Alter and report network device settings
49270 @@ -284,6 +287,8 @@
49271 * set_tx_csum: Turn transmit checksums on or off
49272 * get_sg: Report whether scatter-gather is enabled
49273 * set_sg: Turn scatter-gather on or off
49274 + * get_tso: Report whether TCP segmentation offload is enabled
49275 + * set_tso: Turn TCP segmentation offload on or off
49276 * self_test: Run specified self-tests
49277 * get_strings: Return a set of strings that describe the requested objects
49278 * phys_id: Identify the device
49279 @@ -337,6 +342,8 @@
49280 int (*set_tx_csum)(struct net_device *, u32);
49281 u32 (*get_sg)(struct net_device *);
49282 int (*set_sg)(struct net_device *, u32);
49283 + u32 (*get_tso)(struct net_device *);
49284 + int (*set_tso)(struct net_device *, u32);
49285 int (*self_test_count)(struct net_device *);
49286 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
49287 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
49288 diff -Nru a/include/linux/fs.h b/include/linux/fs.h
49289 --- a/include/linux/fs.h Fri Jul 11 10:32:02 2003
49290 +++ b/include/linux/fs.h Sun Aug 31 16:14:42 2003
49291 @@ -336,10 +336,8 @@
49294 struct block_device {
49295 - struct list_head bd_hash;
49296 - atomic_t bd_count;
49297 - struct inode * bd_inode;
49298 dev_t bd_dev; /* not a kdev_t - it's a search key */
49299 + struct inode * bd_inode; /* will die */
49301 struct semaphore bd_sem; /* open/close mutex */
49302 struct list_head bd_inodes;
49303 @@ -347,10 +345,11 @@
49305 struct block_device * bd_contains;
49306 unsigned bd_block_size;
49307 - sector_t bd_offset;
49308 + struct hd_struct * bd_part;
49309 unsigned bd_part_count;
49310 int bd_invalidated;
49311 struct gendisk * bd_disk;
49312 + struct list_head bd_list;
49316 @@ -468,6 +467,16 @@
49320 +static inline unsigned iminor(struct inode *inode)
49322 + return minor(inode->i_rdev);
49325 +static inline unsigned imajor(struct inode *inode)
49327 + return major(inode->i_rdev);
49330 struct fown_struct {
49331 rwlock_t lock; /* protects pid, uid, euid fields */
49332 int pid; /* pid or -pgrp where SIGIO should be sent */
49333 @@ -600,6 +609,10 @@
49334 extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 __user *);
49337 +extern void send_sigio(struct fown_struct *fown, int fd, int band);
49338 +extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
49339 +extern int fcntl_getlease(struct file *filp);
49342 extern void locks_init_lock(struct file_lock *);
49343 extern void locks_copy_lock(struct file_lock *, struct file_lock *);
49344 @@ -1176,6 +1189,12 @@
49345 unsigned long invalidate_mapping_pages(struct address_space *mapping,
49346 pgoff_t start, pgoff_t end);
49347 unsigned long invalidate_inode_pages(struct address_space *mapping);
49348 +static inline void invalidate_remote_inode(struct inode *inode)
49350 + if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
49351 + S_ISLNK(inode->i_mode))
49352 + invalidate_inode_pages(inode->i_mapping);
49354 extern void invalidate_inode_pages2(struct address_space *mapping);
49355 extern void write_inode_now(struct inode *, int);
49356 extern int filemap_fdatawrite(struct address_space *);
49357 diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h
49358 --- a/include/linux/genhd.h Thu Jun 5 23:32:48 2003
49359 +++ b/include/linux/genhd.h Sun Aug 31 16:14:27 2003
49360 @@ -197,7 +197,7 @@
49362 static inline sector_t get_start_sect(struct block_device *bdev)
49364 - return bdev->bd_offset;
49365 + return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect;
49367 static inline sector_t get_capacity(struct gendisk *disk)
49369 diff -Nru a/include/linux/ide.h b/include/linux/ide.h
49370 --- a/include/linux/ide.h Wed Aug 20 09:01:03 2003
49371 +++ b/include/linux/ide.h Mon Sep 1 04:03:22 2003
49372 @@ -1044,6 +1044,8 @@
49373 void *hwif_data; /* extra hwif data */
49377 + void (*led_act)(void *data, int rw);
49381 @@ -1242,21 +1244,6 @@
49383 extern int generic_ide_ioctl(struct block_device *, unsigned, unsigned long);
49388 -#define IDE_CHIPSET_MODULE 0 /* not supported yet */
49389 -#define IDE_PROBE_MODULE 1
49391 -typedef int (ide_module_init_proc)(void);
49393 -typedef struct ide_module_s {
49395 - ide_module_init_proc *init;
49397 - struct ide_module_s *next;
49400 typedef struct ide_devices_s {
49401 char name[4]; /* hdX */
49402 unsigned attached : 1; /* native */
49403 @@ -1274,8 +1261,7 @@
49406 extern ide_hwif_t ide_hwifs[]; /* master data repository */
49407 -extern ide_module_t *ide_chipsets;
49408 -extern ide_module_t *ide_probe;
49409 +extern int (*ide_probe)(void);
49411 extern ide_devices_t *idedisk;
49412 extern ide_devices_t *idecd;
49413 @@ -1772,8 +1758,6 @@
49414 extern void ide_hwif_release_regions(ide_hwif_t* hwif);
49415 extern void ide_unregister (unsigned int index);
49417 -extern int export_ide_init_queue(ide_drive_t *);
49418 -extern u8 export_probe_for_drive(ide_drive_t *);
49419 extern int probe_hwif_init(ide_hwif_t *);
49421 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
49422 @@ -1793,6 +1777,24 @@
49423 extern char *ide_xfer_verbose(u8 xfer_rate);
49424 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
49425 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
49427 +typedef struct ide_pio_timings_s {
49428 + int setup_time; /* Address setup (ns) minimum */
49429 + int active_time; /* Active pulse (ns) minimum */
49430 + int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
49431 +} ide_pio_timings_t;
49433 +typedef struct ide_pio_data_s {
49438 + unsigned int cycle_time;
49441 +extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
49442 +extern const ide_pio_timings_t ide_pio_timings[6];
49445 extern spinlock_t ide_lock;
49446 extern struct semaphore ide_cfg_sem;
49447 diff -Nru a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
49448 --- a/include/linux/ipv6_route.h Wed Jul 23 02:57:57 2003
49449 +++ b/include/linux/ipv6_route.h Sat Aug 30 21:26:12 2003
49451 #define RTF_CACHE 0x01000000 /* cache entry */
49452 #define RTF_FLOW 0x02000000 /* flow significant route */
49453 #define RTF_POLICY 0x04000000 /* policy route */
49454 +#define RTF_NDISC 0x08000000 /* ndisc route */
49456 #define RTF_LOCAL 0x80000000
49458 diff -Nru a/include/linux/kdev_t.h b/include/linux/kdev_t.h
49459 --- a/include/linux/kdev_t.h Fri Aug 1 02:22:20 2003
49460 +++ b/include/linux/kdev_t.h Tue Aug 26 09:25:39 2003
49465 -static inline kdev_t val_to_kdev(unsigned int val)
49472 -#define HASHDEV(dev) (kdev_val(dev))
49473 #define NODEV (mk_kdev(0,0))
49475 -static inline int kdev_same(kdev_t dev1, kdev_t dev2)
49477 - return dev1.value == dev2.value;
49480 -#define kdev_none(d1) (!kdev_val(d1))
49482 /* Mask off the high bits for now.. */
49483 #define minor(dev) ((dev).value & 0xff)
49484 diff -Nru a/include/linux/mmzone.h b/include/linux/mmzone.h
49485 --- a/include/linux/mmzone.h Fri Aug 1 03:02:10 2003
49486 +++ b/include/linux/mmzone.h Sun Aug 31 16:14:47 2003
49487 @@ -89,17 +89,24 @@
49489 ZONE_PADDING(_pad2_)
49492 - * measure of scanning intensity for this zone. It is calculated
49493 - * as exponentially decaying average of the scanning priority
49494 - * required to free enough pages in this zone
49495 - * (zone_adj_pressure()).
49497 + * prev_priority holds the scanning priority for this zone. It is
49498 + * defined as the scanning priority at which we achieved our reclaim
49499 + * target at the previous try_to_free_pages() or balance_pgdat()
49502 - * 0 --- low pressure
49503 + * We use prev_priority as a measure of how much stress page reclaim is
49504 + * under - it drives the swappiness decision: whether to unmap mapped
49507 - * (DEF_PRIORITY << 10) --- high pressure
49508 + * temp_priority is used to remember the scanning priority at which
49509 + * this zone was successfully refilled to free_pages == pages_high.
49511 + * Access to both these fields is quite racy even on uniprocessor. But
49512 + * it is expected to average out OK.
49515 + int temp_priority;
49516 + int prev_priority;
49519 * free areas of different sizes
49520 diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
49521 --- a/include/linux/netdevice.h Tue Aug 19 21:01:19 2003
49522 +++ b/include/linux/netdevice.h Mon Sep 1 12:14:20 2003
49523 @@ -168,9 +168,9 @@
49524 unsigned fastroute_deferred_out;
49525 unsigned fastroute_latency_reduction;
49526 unsigned cpu_collision;
49527 -} ____cacheline_aligned;
49530 -extern struct netif_rx_stats netdev_rx_stat[];
49531 +DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
49535 @@ -830,6 +830,38 @@
49536 smp_mb__before_clear_bit();
49537 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
49538 local_irq_restore(flags);
49541 +static inline void netif_poll_disable(struct net_device *dev)
49543 + while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
49545 + current->state = TASK_INTERRUPTIBLE;
49546 + schedule_timeout(1);
49550 +static inline void netif_poll_enable(struct net_device *dev)
49552 + clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
49555 +/* same as netif_rx_complete, except that local_irq_save(flags)
49556 + * has already been issued
49558 +static inline void __netif_rx_complete(struct net_device *dev)
49560 + if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
49561 + list_del(&dev->poll_list);
49562 + smp_mb__before_clear_bit();
49563 + clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
49566 +static inline void netif_tx_disable(struct net_device *dev)
49568 + spin_lock_bh(&dev->xmit_lock);
49569 + netif_stop_queue(dev);
49570 + spin_unlock_bh(&dev->xmit_lock);
49573 /* These functions live elsewhere (drivers/net/net_init.c, but related) */
49574 diff -Nru a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
49575 --- /dev/null Wed Dec 31 16:00:00 1969
49576 +++ b/include/linux/netfilter_bridge/ebt_802_3.h Sat Aug 30 20:40:29 2003
49578 +#ifndef __LINUX_BRIDGE_EBT_802_3_H
49579 +#define __LINUX_BRIDGE_EBT_802_3_H
49581 +#define EBT_802_3_SAP 0x01
49582 +#define EBT_802_3_TYPE 0x02
49584 +#define EBT_802_3_MATCH "802_3"
49587 + * If frame has DSAP/SSAP value 0xaa you must check the SNAP type
49588 + * to discover what kind of packet we're carrying.
49590 +#define CHECK_TYPE 0xaa
49593 + * Control field may be one or two bytes. If the first byte has
49594 + * the value 0x03 then the entire length is one byte, otherwise it is two.
49595 + * One byte controls are used in Unnumbered Information frames.
49596 + * Two byte controls are used in Numbered Information frames.
49598 +#define IS_UI 0x03
49600 +#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3)
49602 +/* ui has one byte ctrl, ni has two */
49619 +struct ebt_802_3_hdr {
49620 + uint8_t daddr[6];
49621 + uint8_t saddr[6];
49624 + struct hdr_ui ui;
49625 + struct hdr_ni ni;
49629 +struct ebt_802_3_info
49634 + uint8_t invflags;
49638 diff -Nru a/include/linux/netfilter_bridge/ebt_arpreply.h b/include/linux/netfilter_bridge/ebt_arpreply.h
49639 --- /dev/null Wed Dec 31 16:00:00 1969
49640 +++ b/include/linux/netfilter_bridge/ebt_arpreply.h Sun Aug 24 04:31:45 2003
49642 +#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H
49643 +#define __LINUX_BRIDGE_EBT_ARPREPLY_H
49645 +struct ebt_arpreply_info
49647 + unsigned char mac[ETH_ALEN];
49650 +#define EBT_ARPREPLY_TARGET "arpreply"
49653 diff -Nru a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
49654 --- a/include/linux/netfilter_bridge.h Sun Apr 27 18:39:57 2003
49655 +++ b/include/linux/netfilter_bridge.h Mon Sep 1 01:44:26 2003
49658 #include <linux/config.h>
49659 #include <linux/netfilter.h>
49660 -#if defined(__KERNEL__) && defined(CONFIG_NETFILTER)
49661 +#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER)
49662 #include <asm/atomic.h>
49669 -#define BRNF_PKT_TYPE 0x01
49670 -#define BRNF_BRIDGED_DNAT 0x02
49671 -#define BRNF_DONT_TAKE_PARENT 0x04
49672 -#define BRNF_BRIDGED 0x08
49674 enum nf_br_hook_priorities {
49675 NF_BR_PRI_FIRST = INT_MIN,
49676 NF_BR_PRI_NAT_DST_BRIDGED = -300,
49678 NF_BR_PRI_LAST = INT_MAX,
49681 -#ifdef CONFIG_NETFILTER
49682 +#ifdef CONFIG_BRIDGE_NETFILTER
49684 +#define BRNF_PKT_TYPE 0x01
49685 +#define BRNF_BRIDGED_DNAT 0x02
49686 +#define BRNF_DONT_TAKE_PARENT 0x04
49687 +#define BRNF_BRIDGED 0x08
49690 struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
49696 -#endif /* CONFIG_NETFILTER */
49697 +#endif /* CONFIG_BRIDGE_NETFILTER */
49699 #endif /* __KERNEL__ */
49701 diff -Nru a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
49702 --- /dev/null Wed Dec 31 16:00:00 1969
49703 +++ b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h Sun Aug 24 17:25:17 2003
49705 +#ifndef _IPT_CLASSIFY_H
49706 +#define _IPT_CLASSIFY_H
49708 +struct ipt_classify_target_info {
49709 + u_int32_t priority;
49712 +#endif /*_IPT_CLASSIFY_H */
49713 diff -Nru a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
49714 --- /dev/null Wed Dec 31 16:00:00 1969
49715 +++ b/include/linux/netfilter_ipv4/ipt_SAME.h Sun Aug 24 17:25:18 2003
49717 +#ifndef _IPT_SAME_H
49718 +#define _IPT_SAME_H
49720 +#define IPT_SAME_MAX_RANGE 10
49722 +#define IPT_SAME_NODST 0x01
49724 +struct ipt_same_info
49726 + unsigned char info;
49727 + u_int32_t rangesize;
49729 + u_int32_t *iparray;
49731 + /* hangs off end. */
49732 + struct ip_nat_range range[IPT_SAME_MAX_RANGE];
49735 +#endif /*_IPT_SAME_H*/
49736 diff -Nru a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
49737 --- /dev/null Wed Dec 31 16:00:00 1969
49738 +++ b/include/linux/netfilter_ipv4/ipt_iprange.h Sun Aug 24 17:25:18 2003
49740 +#ifndef _IPT_IPRANGE_H
49741 +#define _IPT_IPRANGE_H
49743 +#define IPRANGE_SRC 0x01 /* Match source IP address */
49744 +#define IPRANGE_DST 0x02 /* Match destination IP address */
49745 +#define IPRANGE_SRC_INV 0x10 /* Negate the condition */
49746 +#define IPRANGE_DST_INV 0x20 /* Negate the condition */
49748 +struct ipt_iprange {
49749 + /* Inclusive: network order. */
49750 + u_int32_t min_ip, max_ip;
49753 +struct ipt_iprange_info
49755 + struct ipt_iprange src;
49756 + struct ipt_iprange dst;
49758 + /* Flags from above */
49762 +#endif /* _IPT_IPRANGE_H */
49763 diff -Nru a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
49764 --- a/include/linux/nfsd/nfsfh.h Mon Feb 17 13:50:11 2003
49765 +++ b/include/linux/nfsd/nfsfh.h Tue Aug 26 09:25:41 2003
49766 @@ -294,8 +294,8 @@
49767 /* how much do we care for accuracy with MinixFS? */
49768 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
49770 - fhp->fh_post_rdev[0] = htonl((u32)major(inode->i_rdev));
49771 - fhp->fh_post_rdev[1] = htonl((u32)minor(inode->i_rdev));
49772 + fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
49773 + fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
49774 fhp->fh_post_atime = inode->i_atime;
49775 fhp->fh_post_mtime = inode->i_mtime;
49776 fhp->fh_post_ctime = inode->i_ctime;
49777 diff -Nru a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
49778 --- a/include/linux/nfsd/state.h Thu Jun 26 21:26:02 2003
49779 +++ b/include/linux/nfsd/state.h Sat Aug 23 15:07:31 2003
49780 @@ -113,21 +113,15 @@
49781 int so_confirmed; /* successful OPEN_CONFIRM? */
49785 - u32 dev; /* super_block->s_dev */
49786 - unsigned long ino;
49788 -} nfs4_ino_desc_t;
49791 * nfs4_file: a file opened by some number of (open) nfs4_stateowners.
49792 * o fi_perfile list is used to search for conflicting
49793 * share_acces, share_deny on the file.
49796 - struct list_head fi_hash; /* hash by nfs4_ino_desc_t fields */
49797 + struct list_head fi_hash; /* hash by "struct inode *" */
49798 struct list_head fi_perfile; /* list: nfs4_stateid */
49799 - nfs4_ino_desc_t fi_ino;
49800 + struct inode *fi_inode;
49801 u32 fi_id; /* used with stateowner->so_id
49802 * for openstateid_hashtbl hash */
49804 diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
49805 --- a/include/linux/pci_ids.h Wed Aug 20 14:33:08 2003
49806 +++ b/include/linux/pci_ids.h Mon Sep 1 17:32:02 2003
49807 @@ -798,6 +798,7 @@
49808 #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
49809 #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
49810 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
49811 +#define PCI_DEVICE_ID_APPLE_KAUAI_ATA 0x003b
49812 #define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
49813 #define PCI_DEVICE_ID_APPLE_TIGON3 0x1645
49815 @@ -1115,7 +1116,9 @@
49816 #define PCI_DEVICE_ID_TTI_HPT374 0x0008
49818 #define PCI_VENDOR_ID_VIA 0x1106
49819 -#define PCI_DEVICE_ID_VIA_P4X600 0x0198
49820 +#define PCI_DEVICE_ID_VIA_8763_0 0x0198
49821 +#define PCI_DEVICE_ID_VIA_8380_0 0x0204
49822 +#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259
49823 #define PCI_DEVICE_ID_VIA_8363_0 0x0305
49824 #define PCI_DEVICE_ID_VIA_8371_0 0x0391
49825 #define PCI_DEVICE_ID_VIA_8501_0 0x0501
49826 @@ -1130,10 +1133,10 @@
49827 #define PCI_DEVICE_ID_VIA_82C597_0 0x0597
49828 #define PCI_DEVICE_ID_VIA_82C598_0 0x0598
49829 #define PCI_DEVICE_ID_VIA_8601_0 0x0601
49830 -#define PCI_DEVICE_ID_VIA_82C694X_0 0x0605
49831 +#define PCI_DEVICE_ID_VIA_8605_0 0x0605
49832 #define PCI_DEVICE_ID_VIA_82C680 0x0680
49833 #define PCI_DEVICE_ID_VIA_82C686 0x0686
49834 -#define PCI_DEVICE_ID_VIA_82C691 0x0691
49835 +#define PCI_DEVICE_ID_VIA_82C691_0 0x0691
49836 #define PCI_DEVICE_ID_VIA_82C693 0x0693
49837 #define PCI_DEVICE_ID_VIA_82C693_1 0x0698
49838 #define PCI_DEVICE_ID_VIA_82C926 0x0926
49839 @@ -1156,19 +1159,21 @@
49840 #define PCI_DEVICE_ID_VIA_8622 0x3102
49841 #define PCI_DEVICE_ID_VIA_8233C_0 0x3109
49842 #define PCI_DEVICE_ID_VIA_8361 0x3112
49843 -#define PCI_DEVICE_ID_VIA_KM266 0x3116
49844 -#define PCI_DEVICE_ID_VIA_CLE266 0x3123
49845 +#define PCI_DEVICE_ID_VIA_XM266 0x3116
49846 +#define PCI_DEVICE_ID_VIA_862X_0 0x3123
49847 #define PCI_DEVICE_ID_VIA_8753_0 0x3128
49848 #define PCI_DEVICE_ID_VIA_8233A 0x3147
49849 -#define PCI_DEVICE_ID_VIA_8752 0x3148
49850 +#define PCI_DEVICE_ID_VIA_8703_51_0 0x3148
49851 #define PCI_DEVICE_ID_VIA_8237_SATA 0x3149
49852 -#define PCI_DEVICE_ID_VIA_KN266 0x3156
49853 -#define PCI_DEVICE_ID_VIA_8754 0x3168
49854 +#define PCI_DEVICE_ID_VIA_XN266 0x3156
49855 +#define PCI_DEVICE_ID_VIA_8754C_0 0x3168
49856 #define PCI_DEVICE_ID_VIA_8235 0x3177
49857 #define PCI_DEVICE_ID_VIA_P4N333 0x3178
49858 -#define PCI_DEVICE_ID_VIA_K8T400M_0 0x3188
49859 +#define PCI_DEVICE_ID_VIA_8385_0 0x3188
49860 #define PCI_DEVICE_ID_VIA_8377_0 0x3189
49861 -#define PCI_DEVICE_ID_VIA_KM400 0x3205
49862 +#define PCI_DEVICE_ID_VIA_8378_0 0x3205
49863 +#define PCI_DEVICE_ID_VIA_8783_0 0x3208
49864 +#define PCI_DEVICE_ID_VIA_PT880 0x3258
49865 #define PCI_DEVICE_ID_VIA_P4M400 0x3209
49866 #define PCI_DEVICE_ID_VIA_8237 0x3227
49867 #define PCI_DEVICE_ID_VIA_86C100A 0x6100
49868 @@ -1183,7 +1188,12 @@
49869 #define PCI_DEVICE_ID_VIA_8505_1 0x8605
49870 #define PCI_DEVICE_ID_VIA_8633_1 0xB091
49871 #define PCI_DEVICE_ID_VIA_8367_1 0xB099
49872 -#define PCI_DEVICE_ID_VIA_8653_1 0xB101
49873 +#define PCI_DEVICE_ID_VIA_P4X266_1 0xB101
49874 +#define PCI_DEVICE_ID_VIA_8615_1 0xB103
49875 +#define PCI_DEVICE_ID_VIA_8361_1 0xB112
49876 +#define PCI_DEVICE_ID_VIA_8235_1 0xB168
49877 +#define PCI_DEVICE_ID_VIA_838X_1 0xB188
49878 +#define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198
49880 #define PCI_VENDOR_ID_SIEMENS 0x110A
49881 #define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102
49882 @@ -1274,6 +1284,9 @@
49883 #define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000
49884 #define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200
49885 #define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300
49886 +#define PCI_DEVICE_ID_SYSKONNECT_YU 0x4320
49887 +#define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400
49888 +#define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500
49890 #define PCI_VENDOR_ID_VMIC 0x114a
49891 #define PCI_DEVICE_ID_VMIC_VME 0x7587
49892 @@ -1332,7 +1345,10 @@
49893 #define PCI_VENDOR_ID_TOSHIBA 0x1179
49894 #define PCI_DEVICE_ID_TOSHIBA_601 0x0601
49895 #define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a
49896 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_A 0x0603
49897 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_B 0x060a
49898 #define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f
49899 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617
49901 #define PCI_VENDOR_ID_TOSHIBA_2 0x102f
49902 #define PCI_DEVICE_ID_TOSHIBA_TX3927 0x000a
49903 @@ -1758,11 +1774,19 @@
49904 #define PCI_DEVICE_ID_TIGON3_5703 0x1647
49905 #define PCI_DEVICE_ID_TIGON3_5704 0x1648
49906 #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
49907 +#define PCI_DEVICE_ID_TIGON3_5705 0x1653
49908 +#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
49909 +#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
49910 +#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
49911 +#define PCI_DEVICE_ID_TIGON3_5782 0x1696
49912 +#define PCI_DEVICE_ID_TIGON3_5788 0x169c
49913 #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
49914 #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
49915 #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
49916 #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
49917 #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
49918 +#define PCI_DEVICE_ID_TIGON3_5901 0x170d
49919 +#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
49920 #define PCI_DEVICE_ID_BCM4401 0x4401
49922 #define PCI_VENDOR_ID_SYBA 0x1592
49923 @@ -1790,6 +1814,7 @@
49924 #define PCI_DEVICE_ID_ALTIMA_AC1000 0x03e8
49925 #define PCI_DEVICE_ID_ALTIMA_AC1001 0x03e9
49926 #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
49927 +#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
49929 #define PCI_VENDOR_ID_SYMPHONY 0x1c1c
49930 #define PCI_DEVICE_ID_SYMPHONY_101 0x0001
49931 diff -Nru a/include/linux/personality.h b/include/linux/personality.h
49932 --- a/include/linux/personality.h Sun Dec 29 15:44:39 2002
49933 +++ b/include/linux/personality.h Sun Aug 31 16:13:59 2003
49935 SHORT_INODE = 0x1000000,
49936 WHOLE_SECONDS = 0x2000000,
49937 STICKY_TIMEOUTS = 0x4000000,
49938 + ADDR_LIMIT_3GB = 0x8000000,
49943 PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
49944 PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
49945 PER_LINUX32 = 0x0008,
49946 + PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
49947 PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
49948 PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
49949 PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
49950 diff -Nru a/include/linux/pmu.h b/include/linux/pmu.h
49951 --- a/include/linux/pmu.h Sun Feb 2 13:51:33 2003
49952 +++ b/include/linux/pmu.h Mon Aug 25 10:06:34 2003
49954 #define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */
49955 #define PMU_SLEEP 0x7f /* put CPU to sleep */
49956 #define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */
49957 +#define PMU_I2C_CMD 0x9a /* I2C operations */
49958 #define PMU_RESET 0xd0 /* reset CPU */
49959 #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
49960 #define PMU_GET_COVER 0xdc /* report cover open/closed */
49962 * or via PMU_INT_ENVIRONMENT on core99 */
49963 #define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */
49965 +/* I2C related definitions */
49966 +#define PMU_I2C_MODE_SIMPLE 0
49967 +#define PMU_I2C_MODE_STDSUB 1
49968 +#define PMU_I2C_MODE_COMBINED 2
49970 +#define PMU_I2C_BUS_STATUS 0
49971 +#define PMU_I2C_BUS_SYSCLK 1
49972 +#define PMU_I2C_BUS_POWER 2
49974 +#define PMU_I2C_STATUS_OK 0
49975 +#define PMU_I2C_STATUS_DATAREAD 1
49976 +#define PMU_I2C_STATUS_BUSY 0xfe
49979 /* Kind of PMU (model) */
49982 @@ -127,6 +142,8 @@
49983 void (*done)(struct adb_request *), int nbytes, ...);
49985 extern void pmu_poll(void);
49986 +extern void pmu_poll_adb(void); /* For use by xmon */
49987 +extern void pmu_wait_complete(struct adb_request *req);
49989 /* For use before switching interrupts off for a long time;
49990 * warning: not stackable
49991 @@ -138,9 +155,16 @@
49993 extern void pmu_restart(void);
49994 extern void pmu_shutdown(void);
49995 +extern void pmu_unlock(void);
49997 extern int pmu_present(void);
49998 extern int pmu_get_model(void);
50000 +extern int pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len);
50001 +extern int pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len);
50002 +extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
50003 +extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
50006 #ifdef CONFIG_PMAC_PBOOK
50008 diff -Nru a/include/linux/proc_fs.h b/include/linux/proc_fs.h
50009 --- a/include/linux/proc_fs.h Thu Jul 10 22:22:53 2003
50010 +++ b/include/linux/proc_fs.h Sun Aug 31 16:14:22 2003
50011 @@ -182,12 +182,6 @@
50012 remove_proc_entry(name,proc_net);
50016 - * fs/proc/kcore.c
50018 -extern void kclist_add(struct kcore_list *, void *, size_t);
50019 -extern struct kcore_list *kclist_del(void *);
50023 #define proc_root_driver NULL
50024 @@ -223,6 +217,9 @@
50026 extern struct proc_dir_entry proc_root;
50028 +#endif /* CONFIG_PROC_FS */
50030 +#if !defined(CONFIG_PROC_FS)
50031 static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
50034 @@ -230,8 +227,10 @@
50039 -#endif /* CONFIG_PROC_FS */
50041 +extern void kclist_add(struct kcore_list *, void *, size_t);
50042 +extern struct kcore_list *kclist_del(void *);
50045 struct proc_inode {
50046 struct task_struct *task;
50047 diff -Nru a/include/linux/sched.h b/include/linux/sched.h
50048 --- a/include/linux/sched.h Wed Aug 20 22:32:07 2003
50049 +++ b/include/linux/sched.h Sun Aug 31 16:14:26 2003
50050 @@ -391,6 +391,7 @@
50051 struct timer_list real_timer;
50052 struct list_head posix_timers; /* POSIX.1b Interval Timers */
50053 unsigned long utime, stime, cutime, cstime;
50054 + unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */
50056 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
50057 unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
50058 diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h
50059 --- a/include/linux/serial_core.h Wed Jul 16 01:49:46 2003
50060 +++ b/include/linux/serial_core.h Sun Aug 24 08:17:18 2003
50062 #define PORT_PC9861 45
50063 #define PORT_PC9801_101 46
50065 +/* Macintosh Zilog type numbers */
50066 +#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
50067 +#define PORT_PMAC_ZILOG 51
50071 diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
50072 --- a/include/linux/skbuff.h Thu Aug 7 14:30:45 2003
50073 +++ b/include/linux/skbuff.h Mon Sep 1 01:44:26 2003
50075 struct nf_conntrack *master;
50078 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
50079 +#ifdef CONFIG_BRIDGE_NETFILTER
50080 struct nf_bridge_info {
50082 struct net_device *physindev;
50083 @@ -244,7 +244,7 @@
50084 #ifdef CONFIG_NETFILTER_DEBUG
50085 unsigned int nf_debug;
50087 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
50088 +#ifdef CONFIG_BRIDGE_NETFILTER
50089 struct nf_bridge_info *nf_bridge;
50091 #endif /* CONFIG_NETFILTER */
50092 @@ -1195,7 +1195,7 @@
50093 atomic_inc(&nfct->master->use);
50096 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
50097 +#ifdef CONFIG_BRIDGE_NETFILTER
50098 static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
50100 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
50101 diff -Nru a/include/linux/sonypi.h b/include/linux/sonypi.h
50102 --- a/include/linux/sonypi.h Tue Feb 18 03:32:56 2003
50103 +++ b/include/linux/sonypi.h Fri Aug 1 05:36:45 2003
50105 #define SONYPI_EVENT_MEMORYSTICK_INSERT 54
50106 #define SONYPI_EVENT_MEMORYSTICK_EJECT 55
50107 #define SONYPI_EVENT_ANYBUTTON_RELEASED 56
50108 +#define SONYPI_EVENT_BATTERY_INSERT 57
50109 +#define SONYPI_EVENT_BATTERY_REMOVE 58
50111 /* get/set brightness */
50112 #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
50113 diff -Nru a/include/linux/tpqic02.h b/include/linux/tpqic02.h
50114 --- a/include/linux/tpqic02.h Mon May 12 20:10:40 2003
50115 +++ b/include/linux/tpqic02.h Tue Aug 26 09:25:40 2003
50116 @@ -587,10 +587,10 @@
50117 * |___________________ Reserved for diagnostics during debugging.
50120 -#define TP_REWCLOSE(d) ((minor(d)&0x01) == 1) /* rewind bit */
50121 +#define TP_REWCLOSE(d) ((d)&1) /* rewind bit */
50122 /* rewind is only done if data has been transferred */
50123 -#define TP_DENS(dev) ((minor(dev) >> 1) & 0x07) /* tape density */
50124 -#define TP_UNIT(dev) ((minor(dev) >> 4) & 0x07) /* unit number */
50125 +#define TP_DENS(d) (((d) >> 1) & 0x07) /* tape density */
50126 +#define TP_UNIT(d) (((d) >> 4) & 0x07) /* unit number */
50128 /* print excessive diagnostics */
50129 #define TP_DIAGS(dev) (QIC02_TAPE_DEBUG & TPQD_DIAGS)
50130 diff -Nru a/include/linux/tty.h b/include/linux/tty.h
50131 --- a/include/linux/tty.h Thu Jul 17 22:30:53 2003
50132 +++ b/include/linux/tty.h Tue Aug 26 09:25:40 2003
50133 @@ -367,7 +367,7 @@
50134 extern int macserial_init(void);
50135 extern int a2232board_init(void);
50137 -extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
50138 +extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
50139 const char *routine);
50140 extern char *tty_name(struct tty_struct *tty, char *buf);
50141 extern void tty_wait_until_sent(struct tty_struct * tty, long timeout);
50142 diff -Nru a/include/linux/wait.h b/include/linux/wait.h
50143 --- a/include/linux/wait.h Sun May 18 17:00:00 2003
50144 +++ b/include/linux/wait.h Sun Aug 31 16:14:00 2003
50145 @@ -220,22 +220,6 @@
50146 __remove_wait_queue(q, wait);
50149 -#define add_wait_queue_cond(q, wait, cond) \
50151 - unsigned long flags; \
50152 - int _raced = 0; \
50153 - spin_lock_irqsave(&(q)->lock, flags); \
50154 - (wait)->flags = 0; \
50155 - __add_wait_queue((q), (wait)); \
50159 - __remove_wait_queue((q), (wait)); \
50161 - spin_lock_irqrestore(&(q)->lock, flags); \
50166 * These are the old interfaces to sleep waiting for an event.
50167 * They are racy. DO NOT use them, use the wait_event* interfaces above.
50168 diff -Nru a/include/net/ax25.h b/include/net/ax25.h
50169 --- a/include/net/ax25.h Thu Aug 21 11:59:08 2003
50170 +++ b/include/net/ax25.h Sun Aug 24 04:34:01 2003
50171 @@ -314,7 +314,7 @@
50173 extern void ax25_rt_device_down(struct net_device *);
50174 extern int ax25_rt_ioctl(unsigned int, void *);
50175 -extern int ax25_rt_get_info(char *, char **, off_t, int);
50176 +extern struct file_operations ax25_route_fops;
50177 extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
50178 extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *,
50179 struct net_device *);
50180 @@ -373,7 +373,7 @@
50181 extern int ax25_uid_policy;
50182 extern ax25_address *ax25_findbyuid(uid_t);
50183 extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *);
50184 -extern int ax25_uid_get_info(char *, char **, off_t, int);
50185 +extern struct file_operations ax25_uid_fops;
50186 extern void ax25_uid_free(void);
50188 /* sysctl_net_ax25.c */
50189 diff -Nru a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
50190 --- a/include/net/ip6_tunnel.h Mon Jun 9 07:56:44 2003
50191 +++ b/include/net/ip6_tunnel.h Mon Sep 1 01:55:01 2003
50193 int recursion; /* depth of hard_start_xmit recursion */
50194 struct ip6_tnl_parm parms; /* tunnel configuration paramters */
50195 struct flowi fl; /* flowi template for xmit */
50196 + struct dst_entry *dst_cache; /* cached dst */
50200 /* Tunnel encapsulation limit destination sub-option */
50201 diff -Nru a/include/net/irda/vlsi_ir.h b/include/net/irda/vlsi_ir.h
50202 --- a/include/net/irda/vlsi_ir.h Tue Jun 10 16:16:15 2003
50203 +++ b/include/net/irda/vlsi_ir.h Sun Aug 24 04:45:26 2003
50206 * vlsi_ir.h: VLSI82C147 PCI IrDA controller driver for Linux
50211 * Copyright (c) 2001-2003 Martin Diehl
50213 @@ -27,18 +27,71 @@
50214 #ifndef IRDA_VLSI_FIR_H
50215 #define IRDA_VLSI_FIR_H
50218 - * #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,xx)
50220 - * missing pci-dma api call to give streaming dma buffer back to hw
50221 - * patch floating on lkml - probably present in 2.5.26 or later
50222 - * otherwise defining it as noop is ok, since the vlsi-ir is only
50223 - * used on two oldish x86-based notebooks which are cache-coherent
50224 +/* ================================================================
50225 + * compatibility stuff
50227 -#define pci_dma_prep_single(dev, addr, size, direction) /* nothing */
50231 +/* definitions not present in pci_ids.h */
50233 +#ifndef PCI_CLASS_WIRELESS_IRDA
50234 +#define PCI_CLASS_WIRELESS_IRDA 0x0d00
50237 +#ifndef PCI_CLASS_SUBCLASS_MASK
50238 +#define PCI_CLASS_SUBCLASS_MASK 0xffff
50241 +/* missing pci-dma api call to give streaming dma buffer back to hw
50242 + * patch was floating on lkml around 2.5.2x and might be present later.
50243 + * Defining it this way is ok, since the vlsi-ir is only
50244 + * used on two oldish x86-based notebooks which are cache-coherent
50245 + * (and flush_write_buffers also handles PPro errata and C3 OOstore)
50248 +#include <asm-i386/io.h>
50249 +#define pci_dma_prep_single(dev, addr, size, direction) flush_write_buffers()
50251 +#error missing pci dma api call
50254 +/* in recent 2.5 interrupt handlers have non-void return value */
50255 +#ifndef IRQ_RETVAL
50256 +typedef void irqreturn_t;
50258 +#define IRQ_HANDLED
50259 +#define IRQ_RETVAL(x)
50262 +/* some stuff need to check kernelversion. Not all 2.5 stuff was present
50263 + * in early 2.5.x - the test is merely to separate 2.4 from 2.5
50265 +#include <linux/version.h>
50267 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
50269 +/* PDE() introduced in 2.5.4 */
50270 +#ifdef CONFIG_PROC_FS
50271 +#define PDE(inode) ((inode)->u.generic_ip)
50274 +/* irda crc16 calculation exported in 2.5.42 */
50275 +#define irda_calc_crc16(fcs,buf,len) (GOOD_FCS)
50277 +/* we use this for unified pci device name access */
50278 +#define PCIDEV_NAME(pdev) ((pdev)->name)
50280 +#else /* 2.5 or later */
50282 +/* recent 2.5/2.6 stores pci device names at varying places ;-) */
50283 +#ifdef CONFIG_PCI_NAMES
50284 +/* human readable name */
50285 +#define PCIDEV_NAME(pdev) ((pdev)->pretty_name)
50287 +/* whatever we get from the associated struct device - bus:slot:dev.fn id */
50288 +#define PCIDEV_NAME(pdev) (pci_name(pdev))
50293 /* ================================================================ */
50295 @@ -138,7 +191,7 @@
50296 * - IRMISC_UARTSEL configured
50297 * - IRCFG_MASTER must be cleared
50298 * - IRCFG_SIR must be set
50299 - * - IRENABLE_IREN must be asserted 0->1 (and hence IRENABLE_SIR_ON)
50300 + * - IRENABLE_PHYANDCLOCK must be asserted 0->1 (and hence IRENABLE_SIR_ON)
50303 enum vlsi_pci_irmisc {
50304 @@ -298,7 +351,7 @@
50306 * - not more than one SIR/MIR/FIR bit must be set at any time
50307 * - SIR, MIR, FIR and CRC16 select the configuration which will
50308 - * be applied on next 0->1 transition of IRENABLE_IREN (see below).
50309 + * be applied on next 0->1 transition of IRENABLE_PHYANDCLOCK (see below).
50310 * - besides allowing the PCI interface to execute busmaster cycles
50311 * and therefore the ring SM to operate, the MSTR bit has side-effects:
50312 * when MSTR is cleared, the RINGPTR's get reset and the legacy UART mode
50313 @@ -349,7 +402,7 @@
50316 enum vlsi_pio_irenable {
50317 - IRENABLE_IREN = 0x8000, /* enable IR phy and gate the mode config (rw) */
50318 + IRENABLE_PHYANDCLOCK = 0x8000, /* enable IR phy and gate the mode config (rw) */
50319 IRENABLE_CFGER = 0x4000, /* mode configuration error (ro) */
50320 IRENABLE_FIR_ON = 0x2000, /* FIR on status (ro) */
50321 IRENABLE_MIR_ON = 0x1000, /* MIR on status (ro) */
50322 @@ -366,7 +419,7 @@
50323 /* VLSI_PIO_PHYCTL: IR Physical Layer Current Control Register (u16, ro) */
50325 /* read-back of the currently applied physical layer status.
50326 - * applied from VLSI_PIO_NPHYCTL at rising edge of IRENABLE_IREN
50327 + * applied from VLSI_PIO_NPHYCTL at rising edge of IRENABLE_PHYANDCLOCK
50328 * contents identical to VLSI_PIO_NPHYCTL (see below)
50331 @@ -374,7 +427,7 @@
50333 /* VLSI_PIO_NPHYCTL: IR Physical Layer Next Control Register (u16, rw) */
50335 -/* latched during IRENABLE_IREN=0 and applied at 0-1 transition
50336 +/* latched during IRENABLE_PHYANDCLOCK=0 and applied at 0-1 transition
50338 * consists of BAUD[15:10], PLSWID[9:5] and PREAMB[4:0] bits defined as follows:
50340 @@ -616,21 +669,22 @@
50343 if ((a & ~DMA_MASK_MSTRPAGE)>>24 != MSTRPAGE_VALUE) {
50345 + ERROR("%s: pci busaddr inconsistency!\n", __FUNCTION__);
50350 a &= DMA_MASK_MSTRPAGE; /* clear highbyte to make sure we won't write
50351 * to status - just in case MSTRPAGE_VALUE!=0
50353 - rd->hw->rd_addr = a;
50354 + rd->hw->rd_addr = cpu_to_le32(a);
50356 rd_set_status(rd, s); /* may pass ownership to the hardware */
50359 static inline void rd_set_count(struct ring_descr *rd, u16 c)
50361 - rd->hw->rd_count = c;
50362 + rd->hw->rd_count = cpu_to_le16(c);
50365 static inline u8 rd_get_status(struct ring_descr *rd)
50366 @@ -642,13 +696,13 @@
50370 - a = (rd->hw->rd_addr & DMA_MASK_MSTRPAGE) | (MSTRPAGE_VALUE << 24);
50372 + a = le32_to_cpu(rd->hw->rd_addr);
50373 + return (a & DMA_MASK_MSTRPAGE) | (MSTRPAGE_VALUE << 24);
50376 static inline u16 rd_get_count(struct ring_descr *rd)
50378 - return rd->hw->rd_count;
50379 + return le16_to_cpu(rd->hw->rd_count);
50382 /******************************************************************/
50383 diff -Nru a/init/main.c b/init/main.c
50384 --- a/init/main.c Fri May 2 11:15:48 2003
50385 +++ b/init/main.c Sun Aug 31 16:14:48 2003
50387 extern void tc_init(void);
50390 -#if defined(CONFIG_SYSVIPC)
50391 -extern void ipc_init(void);
50395 * Are we up and running (ie do we have all the infrastructure
50397 @@ -106,6 +102,8 @@
50398 #define MAX_INIT_ENVS 8
50400 extern void time_init(void);
50401 +/* Default late time init is NULL. archs can override this later. */
50402 +void (*late_time_init)(void) = NULL;
50403 extern void softirq_init(void);
50406 @@ -421,7 +419,6 @@
50409 local_irq_enable();
50410 - calibrate_delay();
50411 #ifdef CONFIG_BLK_DEV_INITRD
50412 if (initrd_start && !initrd_below_start_ok &&
50413 initrd_start < min_low_pfn << PAGE_SHIFT) {
50414 @@ -433,6 +430,9 @@
50415 page_address_init();
50418 + if (late_time_init)
50419 + late_time_init();
50420 + calibrate_delay();
50422 pgtable_cache_init();
50424 @@ -448,9 +448,6 @@
50426 #ifdef CONFIG_PROC_FS
50429 -#if defined(CONFIG_SYSVIPC)
50433 printk("POSIX conformance testing by UNIFIX\n");
50434 diff -Nru a/ipc/msg.c b/ipc/msg.c
50435 --- a/ipc/msg.c Mon May 12 21:23:19 2003
50436 +++ b/ipc/msg.c Thu Aug 28 10:07:51 2003
50437 @@ -707,7 +707,7 @@
50441 - msq->q_lspid = current->pid;
50442 + msq->q_lspid = current->tgid;
50443 msq->q_stime = get_seconds();
50445 if(!pipelined_send(msq,msg)) {
50446 @@ -801,7 +801,7 @@
50447 list_del(&msg->m_list);
50449 msq->q_rtime = get_seconds();
50450 - msq->q_lrpid = current->pid;
50451 + msq->q_lrpid = current->tgid;
50452 msq->q_cbytes -= msg->m_ts;
50453 atomic_sub(msg->m_ts,&msg_bytes);
50454 atomic_dec(&msg_hdrs);
50455 diff -Nru a/ipc/sem.c b/ipc/sem.c
50456 --- a/ipc/sem.c Sun Jul 13 08:55:51 2003
50457 +++ b/ipc/sem.c Thu Aug 28 10:08:09 2003
50458 @@ -664,7 +664,7 @@
50459 for (un = sma->undo; un; un = un->id_next)
50460 un->semadj[semnum] = 0;
50461 curr->semval = val;
50462 - curr->sempid = current->pid;
50463 + curr->sempid = current->tgid;
50464 sma->sem_ctime = get_seconds();
50465 /* maybe some queued-up processes were waiting for this */
50467 @@ -1052,7 +1052,7 @@
50469 goto out_unlock_free;
50471 - error = try_atomic_semop (sma, sops, nsops, un, current->pid);
50472 + error = try_atomic_semop (sma, sops, nsops, un, current->tgid);
50476 @@ -1064,7 +1064,7 @@
50478 queue.nsops = nsops;
50480 - queue.pid = current->pid;
50481 + queue.pid = current->tgid;
50484 append_to_queue(sma ,&queue);
50485 @@ -1206,7 +1206,7 @@
50486 sem->semval += u->semadj[i];
50487 if (sem->semval < 0)
50488 sem->semval = 0; /* shouldn't happen */
50489 - sem->sempid = current->pid;
50490 + sem->sempid = current->tgid;
50493 sma->sem_otime = get_seconds();
50494 diff -Nru a/ipc/shm.c b/ipc/shm.c
50495 --- a/ipc/shm.c Thu Jul 10 22:22:59 2003
50496 +++ b/ipc/shm.c Thu Aug 28 10:08:22 2003
50498 if(!(shp = shm_lock(id)))
50500 shp->shm_atim = get_seconds();
50501 - shp->shm_lprid = current->pid;
50502 + shp->shm_lprid = current->tgid;
50506 @@ -136,7 +136,7 @@
50507 /* remove from the list of attaches of the shm segment */
50508 if(!(shp = shm_lock(id)))
50510 - shp->shm_lprid = current->pid;
50511 + shp->shm_lprid = current->tgid;
50512 shp->shm_dtim = get_seconds();
50514 if(shp->shm_nattch == 0 &&
50515 @@ -209,7 +209,7 @@
50519 - shp->shm_cprid = current->pid;
50520 + shp->shm_cprid = current->tgid;
50521 shp->shm_lprid = 0;
50522 shp->shm_atim = shp->shm_dtim = 0;
50523 shp->shm_ctim = get_seconds();
50524 diff -Nru a/ipc/util.c b/ipc/util.c
50525 --- a/ipc/util.c Tue Jul 1 06:04:38 2003
50526 +++ b/ipc/util.c Sun Aug 31 16:14:46 2003
50527 @@ -36,13 +36,14 @@
50528 * memory are initialised
50531 -void __init ipc_init (void)
50532 +static int __init ipc_init(void)
50540 +__initcall(ipc_init);
50543 * ipc_init_ids - initialise IPC identifiers
50544 diff -Nru a/kernel/Makefile b/kernel/Makefile
50545 --- a/kernel/Makefile Wed Aug 6 13:59:24 2003
50546 +++ b/kernel/Makefile Sun Aug 31 16:13:58 2003
50548 obj-$(CONFIG_COMPAT) += compat.o
50549 obj-$(CONFIG_IKCONFIG) += configs.o
50551 -# files to be removed upon make clean
50552 -clean-files := ikconfig.h
50554 ifneq ($(CONFIG_IA64),y)
50555 # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
50556 # needed for x86 only. Why this used to be enabled for all architectures is beyond
50558 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
50561 -$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile
50562 - $(CONFIG_SHELL) scripts/mkconfigs .config Makefile > $(obj)/ikconfig.h
50563 +quiet_cmd_ikconfig = IKCFG $@
50564 + cmd_ikconfig = $(CONFIG_SHELL) $< .config $(srctree)/Makefile > $@
50566 +targets += ikconfig.h
50568 +$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile FORCE
50569 + $(call if_changed,ikconfig)
50571 -$(obj)/configs.o: $(obj)/ikconfig.h $(obj)/configs.c \
50572 - include/linux/version.h include/linux/compile.h
50573 +$(obj)/configs.o: $(obj)/ikconfig.h
50574 diff -Nru a/kernel/compat.c b/kernel/compat.c
50575 --- a/kernel/compat.c Sat Aug 9 07:50:24 2003
50576 +++ b/kernel/compat.c Wed Aug 27 23:55:00 2003
50577 @@ -464,6 +464,7 @@
50578 if (get_compat_itimerspec(&newts, new))
50581 + set_fs(KERNEL_DS);
50582 err = sys_timer_settime(timer_id, flags, &newts, &oldts);
50584 if (!err && old && put_compat_itimerspec(old, &oldts))
50585 @@ -477,6 +478,7 @@
50586 mm_segment_t oldfs;
50587 struct itimerspec ts;
50589 + set_fs(KERNEL_DS);
50590 err = sys_timer_gettime(timer_id, &ts);
50592 if (!err && put_compat_itimerspec(setting, &ts))
50593 @@ -494,7 +496,8 @@
50594 struct timespec ts;
50595 if (get_compat_timespec(&ts, tp))
50597 - oldfs = get_fs();
50598 + oldfs = get_fs();
50599 + set_fs(KERNEL_DS);
50600 err = sys_clock_settime(which_clock, &ts);
50603 @@ -508,7 +511,8 @@
50605 mm_segment_t oldfs;
50606 struct timespec ts;
50607 - oldfs = get_fs();
50608 + oldfs = get_fs();
50609 + set_fs(KERNEL_DS);
50610 err = sys_clock_gettime(which_clock, &ts);
50612 if (!err && put_compat_timespec(&ts, tp))
50613 @@ -524,7 +528,8 @@
50615 mm_segment_t oldfs;
50616 struct timespec ts;
50617 - oldfs = get_fs();
50618 + oldfs = get_fs();
50619 + set_fs(KERNEL_DS);
50620 err = sys_clock_getres(which_clock, &ts);
50622 if (!err && put_compat_timespec(&ts, tp))
50623 @@ -546,7 +551,8 @@
50624 struct timespec in, out;
50625 if (get_compat_timespec(&in, rqtp))
50627 - oldfs = get_fs();
50628 + oldfs = get_fs();
50629 + set_fs(KERNEL_DS);
50630 err = sys_clock_nanosleep(which_clock, flags, &in, &out);
50632 if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
50633 diff -Nru a/kernel/exit.c b/kernel/exit.c
50634 --- a/kernel/exit.c Tue Aug 5 23:04:02 2003
50635 +++ b/kernel/exit.c Sun Aug 31 16:14:26 2003
50637 p->parent->cmin_flt += p->min_flt + p->cmin_flt;
50638 p->parent->cmaj_flt += p->maj_flt + p->cmaj_flt;
50639 p->parent->cnswap += p->nswap + p->cnswap;
50640 + p->parent->cnvcsw += p->nvcsw + p->cnvcsw;
50641 + p->parent->cnivcsw += p->nivcsw + p->cnivcsw;
50643 write_unlock_irq(&tasklist_lock);
50644 spin_unlock(&p->proc_lock);
50645 diff -Nru a/kernel/fork.c b/kernel/fork.c
50646 --- a/kernel/fork.c Wed Aug 20 22:32:07 2003
50647 +++ b/kernel/fork.c Sun Aug 31 16:14:26 2003
50648 @@ -461,6 +461,7 @@
50649 tsk->min_flt = tsk->maj_flt = 0;
50650 tsk->cmin_flt = tsk->cmaj_flt = 0;
50651 tsk->nswap = tsk->cnswap = 0;
50652 + tsk->nvcsw = tsk->nivcsw = tsk->cnvcsw = tsk->cnivcsw = 0;
50655 tsk->active_mm = NULL;
50656 diff -Nru a/kernel/futex.c b/kernel/futex.c
50657 --- a/kernel/futex.c Sun May 25 20:39:28 2003
50658 +++ b/kernel/futex.c Sun Aug 31 16:14:42 2003
50661 #include <linux/slab.h>
50662 #include <linux/poll.h>
50663 +#include <linux/fs.h>
50664 #include <linux/file.h>
50665 #include <linux/hash.h>
50666 #include <linux/init.h>
50668 /* The key for the hash is the address + index + offset within page */
50669 static struct list_head futex_queues[1<<FUTEX_HASHBITS];
50670 static spinlock_t futex_lock = SPIN_LOCK_UNLOCKED;
50672 -extern void send_sigio(struct fown_struct *fown, int fd, int band);
50674 /* Futex-fs vfsmount entry: */
50675 static struct vfsmount *futex_mnt;
50676 diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c
50677 --- a/kernel/kallsyms.c Tue Aug 19 04:58:04 2003
50678 +++ b/kernel/kallsyms.c Sun Aug 31 16:14:13 2003
50679 @@ -189,9 +189,11 @@
50680 if (pos < iter->pos)
50683 - /* We need to iterate through the previous symbols. */
50684 - for (; iter->pos <= pos; iter->pos++)
50685 + /* We need to iterate through the previous symbols: can be slow */
50686 + for (; iter->pos != pos; iter->pos++) {
50687 get_ksymbol_core(iter);
50693 @@ -280,8 +282,7 @@
50695 struct proc_dir_entry *entry;
50697 - /* root-only: could chew up lots of cpu by read, seek back, read... */
50698 - entry = create_proc_entry("kallsyms", 0400, NULL);
50699 + entry = create_proc_entry("kallsyms", 0444, NULL);
50701 entry->proc_fops = &kallsyms_operations;
50703 diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
50704 --- a/kernel/ksyms.c Tue Aug 19 09:33:08 2003
50705 +++ b/kernel/ksyms.c Thu Aug 28 00:36:28 2003
50706 @@ -120,7 +120,6 @@
50707 EXPORT_SYMBOL(max_mapnr);
50709 EXPORT_SYMBOL(high_memory);
50710 -EXPORT_SYMBOL_GPL(invalidate_mmap_range);
50711 EXPORT_SYMBOL(vmtruncate);
50712 EXPORT_SYMBOL(find_vma);
50713 EXPORT_SYMBOL(get_unmapped_area);
50714 @@ -198,7 +197,6 @@
50715 EXPORT_SYMBOL(invalidate_inode_pages);
50716 EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
50717 EXPORT_SYMBOL(truncate_inode_pages);
50718 -EXPORT_SYMBOL(install_page);
50719 EXPORT_SYMBOL(fsync_bdev);
50720 EXPORT_SYMBOL(permission);
50721 EXPORT_SYMBOL(vfs_permission);
50722 diff -Nru a/kernel/posix-timers.c b/kernel/posix-timers.c
50723 --- a/kernel/posix-timers.c Sat Jun 14 16:15:58 2003
50724 +++ b/kernel/posix-timers.c Sat Aug 30 22:24:41 2003
50725 @@ -948,11 +948,15 @@
50727 static int do_posix_gettime(struct k_clock *clock, struct timespec *tp)
50729 + struct timeval tv;
50731 if (clock->clock_get)
50732 return clock->clock_get(tp);
50734 - do_gettimeofday((struct timeval *) tp);
50735 - tp->tv_nsec *= NSEC_PER_USEC;
50736 + do_gettimeofday(&tv);
50737 + tp->tv_sec = tv.tv_sec;
50738 + tp->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
50743 diff -Nru a/kernel/sched.c b/kernel/sched.c
50744 --- a/kernel/sched.c Mon Aug 18 19:46:23 2003
50745 +++ b/kernel/sched.c Sun Aug 31 16:14:26 2003
50746 @@ -1325,8 +1325,10 @@
50749 deactivate_task(prev, rq);
50757 if (unlikely(!rq->nr_running)) {
50758 diff -Nru a/kernel/sys.c b/kernel/sys.c
50759 --- a/kernel/sys.c Tue Aug 19 21:53:11 2003
50760 +++ b/kernel/sys.c Sun Aug 31 16:14:26 2003
50761 @@ -1309,6 +1309,8 @@
50763 jiffies_to_timeval(p->utime, &r.ru_utime);
50764 jiffies_to_timeval(p->stime, &r.ru_stime);
50765 + r.ru_nvcsw = p->nvcsw;
50766 + r.ru_nivcsw = p->nivcsw;
50767 r.ru_minflt = p->min_flt;
50768 r.ru_majflt = p->maj_flt;
50769 r.ru_nswap = p->nswap;
50770 @@ -1316,6 +1318,8 @@
50771 case RUSAGE_CHILDREN:
50772 jiffies_to_timeval(p->cutime, &r.ru_utime);
50773 jiffies_to_timeval(p->cstime, &r.ru_stime);
50774 + r.ru_nvcsw = p->cnvcsw;
50775 + r.ru_nivcsw = p->cnivcsw;
50776 r.ru_minflt = p->cmin_flt;
50777 r.ru_majflt = p->cmaj_flt;
50778 r.ru_nswap = p->cnswap;
50779 @@ -1323,6 +1327,8 @@
50781 jiffies_to_timeval(p->utime + p->cutime, &r.ru_utime);
50782 jiffies_to_timeval(p->stime + p->cstime, &r.ru_stime);
50783 + r.ru_nvcsw = p->nvcsw + p->cnvcsw;
50784 + r.ru_nivcsw = p->nivcsw + p->cnivcsw;
50785 r.ru_minflt = p->min_flt + p->cmin_flt;
50786 r.ru_majflt = p->maj_flt + p->cmaj_flt;
50787 r.ru_nswap = p->nswap + p->cnswap;
50788 diff -Nru a/kernel/timer.c b/kernel/timer.c
50789 --- a/kernel/timer.c Thu Aug 14 17:00:00 2003
50790 +++ b/kernel/timer.c Tue Sep 2 00:05:52 2003
50791 @@ -338,6 +338,7 @@
50796 if (timer_pending(timer))
50799 diff -Nru a/mm/fremap.c b/mm/fremap.c
50800 --- a/mm/fremap.c Sun May 25 14:08:24 2003
50801 +++ b/mm/fremap.c Thu Aug 28 00:38:39 2003
50804 * Explicit pagetable population and nonlinear (random) mappings support.
50806 - * started by Ingo Molnar, Copyright (C) 2002
50807 + * started by Ingo Molnar, Copyright (C) 2002, 2003
50810 #include <linux/mm.h>
50812 #include <linux/pagemap.h>
50813 #include <linux/swapops.h>
50814 #include <linux/rmap-locking.h>
50815 +#include <linux/module.h>
50817 #include <asm/mmu_context.h>
50818 #include <asm/cacheflush.h>
50819 #include <asm/tlbflush.h>
50824 +EXPORT_SYMBOL(install_page);
50828 * sys_remap_file_pages - remap arbitrary pages of a shared backing store
50829 diff -Nru a/mm/memory.c b/mm/memory.c
50830 --- a/mm/memory.c Thu Aug 14 18:17:40 2003
50831 +++ b/mm/memory.c Sun Aug 31 16:14:24 2003
50833 #include <linux/pagemap.h>
50834 #include <linux/vcache.h>
50835 #include <linux/rmap-locking.h>
50836 +#include <linux/module.h>
50838 #include <asm/pgalloc.h>
50839 #include <asm/rmap.h>
50840 @@ -810,17 +811,18 @@
50841 static inline int zeromap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address,
50842 unsigned long size, pgprot_t prot)
50844 - unsigned long end;
50845 + unsigned long base, end;
50847 + base = address & PGDIR_MASK;
50848 address &= ~PGDIR_MASK;
50849 end = address + size;
50850 if (end > PGDIR_SIZE)
50853 - pte_t * pte = pte_alloc_map(mm, pmd, address);
50854 + pte_t * pte = pte_alloc_map(mm, pmd, base + address);
50857 - zeromap_pte_range(pte, address, end - address, prot);
50858 + zeromap_pte_range(pte, base + address, end - address, prot);
50860 address = (address + PMD_SIZE) & PMD_MASK;
50862 @@ -1138,6 +1140,7 @@
50863 invalidate_mmap_range_list(&mapping->i_mmap_shared, hba, hlen);
50864 up(&mapping->i_shared_sem);
50866 +EXPORT_SYMBOL_GPL(invalidate_mmap_range);
50869 * Handle all mappings that got truncated by a "truncate()"
50870 @@ -1384,10 +1387,10 @@
50871 unsigned long address, int write_access, pte_t *page_table, pmd_t *pmd)
50873 struct page * new_page;
50874 - struct address_space *mapping;
50875 + struct address_space *mapping = NULL;
50877 struct pte_chain *pte_chain;
50879 + int sequence = 0;
50882 if (!vma->vm_ops || !vma->vm_ops->nopage)
50883 @@ -1396,8 +1399,10 @@
50884 pte_unmap(page_table);
50885 spin_unlock(&mm->page_table_lock);
50887 - mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
50888 - sequence = atomic_read(&mapping->truncate_count);
50889 + if (vma->vm_file) {
50890 + mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
50891 + sequence = atomic_read(&mapping->truncate_count);
50893 smp_rmb(); /* Prevent CPU from reordering lock-free ->nopage() */
50895 new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0);
50896 @@ -1433,7 +1438,8 @@
50897 * invalidated this page. If invalidate_mmap_range got called,
50898 * retry getting the page.
50900 - if (unlikely(sequence != atomic_read(&mapping->truncate_count))) {
50902 + (unlikely(sequence != atomic_read(&mapping->truncate_count)))) {
50903 sequence = atomic_read(&mapping->truncate_count);
50904 spin_unlock(&mm->page_table_lock);
50905 page_cache_release(new_page);
50906 @@ -1453,7 +1459,8 @@
50908 /* Only go through if we didn't race with anybody else... */
50909 if (pte_none(*page_table)) {
50911 + if (!PageReserved(new_page))
50913 flush_icache_page(vma, new_page);
50914 entry = mk_pte(new_page, vma->vm_page_prot);
50916 diff -Nru a/mm/swapfile.c b/mm/swapfile.c
50917 --- a/mm/swapfile.c Thu Jul 31 16:52:11 2003
50918 +++ b/mm/swapfile.c Sun Aug 31 16:15:45 2003
50919 @@ -1403,7 +1403,8 @@
50921 p->pages = nr_good_pages;
50923 - if (setup_swap_extents(p))
50924 + error = setup_swap_extents(p);
50929 diff -Nru a/mm/vmscan.c b/mm/vmscan.c
50930 --- a/mm/vmscan.c Thu Aug 21 11:57:48 2003
50931 +++ b/mm/vmscan.c Sun Aug 31 16:14:47 2003
50936 - * exponentially decaying average
50938 -static inline int expavg(int avg, int val)
50940 - return ((val - avg) >> 1) + avg;
50943 -static void zone_adj_pressure(struct zone *zone, int priority)
50945 - zone->pressure = expavg(zone->pressure,
50946 - (DEF_PRIORITY - priority) << 10);
50949 -static int pressure_to_priority(int pressure)
50951 - return DEF_PRIORITY - (pressure >> 10);
50955 * The list of shrinker callbacks used by to apply pressure to
50958 @@ -646,7 +627,7 @@
50959 * `distress' is a measure of how much trouble we're having reclaiming
50960 * pages. 0 -> no problems. 100 -> great trouble.
50962 - distress = 100 >> pressure_to_priority(zone->pressure);
50963 + distress = 100 >> zone->prev_priority;
50966 * The point of this algorithm is to decide when to start reclaiming
50967 @@ -830,6 +811,9 @@
50971 + if (zone->free_pages < zone->pages_high)
50972 + zone->temp_priority = priority;
50974 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
50975 continue; /* Let kswapd poll it */
50977 @@ -843,10 +827,8 @@
50978 ret += shrink_zone(zone, max_scan, gfp_mask,
50979 to_reclaim, &nr_mapped, ps, priority);
50980 *total_scanned += max_scan + nr_mapped;
50981 - if (ret >= nr_pages) {
50982 - zone_adj_pressure(zone, priority);
50983 + if (ret >= nr_pages)
50989 @@ -880,6 +862,9 @@
50991 inc_page_state(allocstall);
50993 + for (zone = cz; zone >= cz->zone_pgdat->node_zones; --zone)
50994 + zone->temp_priority = DEF_PRIORITY;
50996 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
50997 int total_scanned = 0;
50998 struct page_state ps;
50999 @@ -912,9 +897,9 @@
51001 if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
51003 - for (zone = cz; zone >= cz->zone_pgdat->node_zones; -- zone)
51004 - zone_adj_pressure(zone, -1);
51006 + for (zone = cz; zone >= cz->zone_pgdat->node_zones; --zone)
51007 + zone->prev_priority = zone->temp_priority;
51011 @@ -945,6 +930,12 @@
51013 inc_page_state(pageoutrun);
51015 + for (i = 0; i < pgdat->nr_zones; i++) {
51016 + struct zone *zone = pgdat->node_zones + i;
51018 + zone->temp_priority = DEF_PRIORITY;
51021 for (priority = DEF_PRIORITY; priority; priority--) {
51022 int all_zones_ok = 1;
51024 @@ -961,11 +952,10 @@
51025 to_reclaim = min(to_free, SWAP_CLUSTER_MAX*8);
51026 } else { /* Zone balancing */
51027 to_reclaim = zone->pages_high-zone->free_pages;
51028 - if (to_reclaim <= 0) {
51029 - zone_adj_pressure(zone, priority);
51030 + if (to_reclaim <= 0)
51034 + zone->temp_priority = priority;
51036 max_scan = zone->nr_inactive >> priority;
51037 if (max_scan < to_reclaim * 2)
51038 @@ -989,13 +979,11 @@
51040 blk_congestion_wait(WRITE, HZ/10);
51042 - if (priority < 0) {
51043 - for (i = 0; i < pgdat->nr_zones; i++) {
51044 - struct zone *zone = pgdat->node_zones + i;
51046 - if (zone->free_pages < zone->pages_high)
51047 - zone_adj_pressure(zone, -1);
51049 + for (i = 0; i < pgdat->nr_zones; i++) {
51050 + struct zone *zone = pgdat->node_zones + i;
51052 + zone->prev_priority = zone->temp_priority;
51054 return nr_pages - to_free;
51056 diff -Nru a/net/Kconfig b/net/Kconfig
51057 --- a/net/Kconfig Tue Aug 19 21:12:36 2003
51058 +++ b/net/Kconfig Mon Sep 1 01:44:26 2003
51059 @@ -191,9 +191,11 @@
51062 If you enable iptables support along with the bridge support then you
51063 - turn your bridge into a bridging firewall.
51064 + turn your bridge into a bridging IP firewall.
51065 iptables will then see the IP packets being bridged, so you need to
51066 take this into account when setting up your firewall rules.
51067 + Enabling arptables support when bridging will let arptables see
51068 + bridged ARP traffic in the arptables FORWARD chain.
51070 If you want to compile this code as a module ( = code which can be
51071 inserted in and removed from the running kernel whenever you want),
51072 @@ -243,6 +245,12 @@
51073 box can transparently forward the traffic to a local server,
51074 typically a caching proxy server.
51076 + Yet another use of Netfilter is building a bridging firewall. Using
51077 + a bridge with Network packet filtering enabled makes iptables "see"
51078 + the bridged traffic. For filtering on the lower network and Ethernet
51079 + protocols over the bridge, use ebtables (under bridge netfilter
51082 Various modules exist for netfilter which replace the previous
51083 masquerading (ipmasqadm), packet filtering (ipchains), transparent
51084 proxying, and portforwarding mechanisms. Please see
51085 @@ -263,6 +271,19 @@
51087 You can say Y here if you want to get additional messages useful in
51088 debugging the netfilter code.
51090 +config BRIDGE_NETFILTER
51091 + bool "Bridged IP/ARP packets filtering"
51092 + depends on BRIDGE && NETFILTER && INET
51095 + Enabling this option will let arptables resp. iptables see bridged
51096 + ARP resp. IP traffic. If you want a bridging firewall, you probably
51097 + want this option enabled.
51098 + Enabling or disabling this option doesn't enable or disable
51101 + If unsure, say N.
51103 source "net/ipv4/netfilter/Kconfig"
51104 source "net/ipv6/netfilter/Kconfig"
51105 diff -Nru a/net/appletalk/aarp.c b/net/appletalk/aarp.c
51106 --- a/net/appletalk/aarp.c Wed Jun 4 17:57:07 2003
51107 +++ b/net/appletalk/aarp.c Sat Aug 30 19:27:36 2003
51109 #include <linux/atalk.h>
51110 #include <linux/init.h>
51111 #include <linux/proc_fs.h>
51112 +#include <linux/seq_file.h>
51114 int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME;
51115 int sysctl_aarp_tick_time = AARP_TICK_TIME;
51116 @@ -145,6 +146,7 @@
51117 aarp_dl->request(aarp_dl, skb, aarp_eth_multicast);
51118 /* Update the sending count */
51120 + a->last_sent = jiffies;
51123 /* This runs under aarp_lock and in softint context, so only atomic memory
51124 @@ -338,6 +340,32 @@
51125 return NOTIFY_DONE;
51128 +/* Expire all entries in a hash chain */
51129 +static void __aarp_expire_all(struct aarp_entry **n)
51131 + struct aarp_entry *t;
51136 + __aarp_expire(t);
51140 +/* Cleanup all hash chains -- module unloading */
51141 +static void aarp_purge(void)
51145 + write_lock_bh(&aarp_lock);
51146 + for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
51147 + __aarp_expire_all(&resolved[ct]);
51148 + __aarp_expire_all(&unresolved[ct]);
51149 + __aarp_expire_all(&proxies[ct]);
51151 + write_unlock_bh(&aarp_lock);
51155 * Create a new aarp entry. This must use GFP_ATOMIC because it
51156 * runs while holding spinlocks.
51157 @@ -861,112 +889,181 @@
51158 write_unlock_bh(&aarp_lock);
51161 -/* Called from proc fs */
51162 -static int aarp_get_info(char *buffer, char **start, off_t offset, int length)
51163 +#ifdef CONFIG_PROC_FS
51164 +struct aarp_iter_state {
51166 + struct aarp_entry **table;
51170 + * Get the aarp entry that is in the chain described
51171 + * by the iterator.
51172 + * If pos is set then skip till that index.
51173 + * pos = 1 is the first entry
51175 +static struct aarp_entry *iter_next(struct aarp_iter_state *iter, loff_t *pos)
51177 - /* we should dump all our AARP entries */
51178 + int ct = iter->bucket;
51179 + struct aarp_entry **table = iter->table;
51181 struct aarp_entry *entry;
51182 - int ct, len = sprintf(buffer,
51183 - "%-10.10s %-10.10s%-18.18s%12.12s%12.12s "
51184 - "xmit_count status\n",
51185 - "address", "device", "hw addr", "last_sent",
51189 + while(ct < AARP_HASH_SIZE) {
51190 + for (entry = table[ct]; entry; entry = entry->next) {
51191 + if (!pos || ++off == *pos) {
51192 + iter->table = table;
51193 + iter->bucket = ct;
51200 + if (table == resolved) {
51202 + table = unresolved;
51205 + if (table == unresolved) {
51213 +static void *aarp_seq_start(struct seq_file *seq, loff_t *pos)
51215 + struct aarp_iter_state *iter = seq->private;
51217 read_lock_bh(&aarp_lock);
51218 + iter->table = resolved;
51219 + iter->bucket = 0;
51221 - for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
51222 - for (entry = resolved[ct]; entry; entry = entry->next) {
51223 - len += sprintf(buffer + len, "%6u:%-3u ",
51224 - (unsigned int)ntohs(entry->target_addr.s_net),
51225 - (unsigned int)(entry->target_addr.s_node));
51226 - len += sprintf(buffer + len, "%-10.10s",
51227 - entry->dev->name);
51228 - len += sprintf(buffer + len,
51229 - "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
51230 - (int)(entry->hwaddr[0] & 0x000000FF),
51231 - (int)(entry->hwaddr[1] & 0x000000FF),
51232 - (int)(entry->hwaddr[2] & 0x000000FF),
51233 - (int)(entry->hwaddr[3] & 0x000000FF),
51234 - (int)(entry->hwaddr[4] & 0x000000FF),
51235 - (int)(entry->hwaddr[5] & 0x000000FF));
51236 - len += sprintf(buffer + len, "%12lu ""%12lu ",
51237 - (unsigned long)entry->last_sent,
51238 - (unsigned long)entry->expires_at);
51239 - len += sprintf(buffer + len, "%10u",
51240 - (unsigned int)entry->xmit_count);
51241 + return *pos ? iter_next(iter, pos) : ((void *)1);
51244 - len += sprintf(buffer + len, " resolved\n");
51247 +static void *aarp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
51249 + struct aarp_entry *entry = v;
51250 + struct aarp_iter_state *iter = seq->private;
51252 - for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
51253 - for (entry = unresolved[ct]; entry; entry = entry->next) {
51254 - len += sprintf(buffer + len, "%6u:%-3u ",
51255 - (unsigned int)ntohs(entry->target_addr.s_net),
51256 - (unsigned int)(entry->target_addr.s_node));
51257 - len += sprintf(buffer + len, "%-10.10s",
51258 - entry->dev->name);
51259 - len += sprintf(buffer + len,
51260 - "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
51261 - (int)(entry->hwaddr[0] & 0x000000FF),
51262 - (int)(entry->hwaddr[1] & 0x000000FF),
51263 - (int)(entry->hwaddr[2] & 0x000000FF),
51264 - (int)(entry->hwaddr[3] & 0x000000FF),
51265 - (int)(entry->hwaddr[4] & 0x000000FF),
51266 - (int)(entry->hwaddr[5] & 0x000000FF));
51267 - len += sprintf(buffer + len, "%12lu ""%12lu ",
51268 - (unsigned long)entry->last_sent,
51269 - (unsigned long)entry->expires_at);
51270 - len += sprintf(buffer + len, "%10u",
51271 - (unsigned int)entry->xmit_count);
51272 - len += sprintf(buffer + len, " unresolved\n");
51277 - for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
51278 - for (entry = proxies[ct]; entry; entry = entry->next) {
51279 - len += sprintf(buffer + len, "%6u:%-3u ",
51280 - (unsigned int)ntohs(entry->target_addr.s_net),
51281 - (unsigned int)(entry->target_addr.s_node));
51282 - len += sprintf(buffer + len, "%-10.10s",
51283 - entry->dev->name);
51284 - len += sprintf(buffer + len,
51285 - "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
51286 - (int)(entry->hwaddr[0] & 0x000000FF),
51287 - (int)(entry->hwaddr[1] & 0x000000FF),
51288 - (int)(entry->hwaddr[2] & 0x000000FF),
51289 - (int)(entry->hwaddr[3] & 0x000000FF),
51290 - (int)(entry->hwaddr[4] & 0x000000FF),
51291 - (int)(entry->hwaddr[5] & 0x000000FF));
51292 - len += sprintf(buffer + len, "%12lu ""%12lu ",
51293 - (unsigned long)entry->last_sent,
51294 - (unsigned long)entry->expires_at);
51295 - len += sprintf(buffer + len, "%10u",
51296 - (unsigned int)entry->xmit_count);
51297 - len += sprintf(buffer + len, " proxy\n");
51299 + /* first line after header */
51300 + if (v == ((void *)1))
51301 + entry = iter_next(iter, NULL);
51303 + /* next entry in current bucket */
51304 + else if (entry->next)
51305 + entry = entry->next;
51307 + /* next bucket or table */
51310 + entry = iter_next(iter, NULL);
51315 +static void aarp_seq_stop(struct seq_file *seq, void *v)
51317 read_unlock_bh(&aarp_lock);
51321 -/* General module cleanup. Called from cleanup_module() in ddp.c. */
51322 -void aarp_cleanup_module(void)
51323 +static const char *dt2str(unsigned long ticks)
51325 - del_timer(&aarp_timer);
51326 - unregister_netdevice_notifier(&aarp_notifier);
51327 - unregister_snap_client(aarp_dl);
51328 + static char buf[32];
51330 + sprintf(buf, "%ld.%02ld", ticks / HZ, ((ticks % HZ) * 100 ) / HZ);
51335 -#ifdef CONFIG_PROC_FS
51336 -void aarp_register_proc_fs(void)
51337 +static int aarp_seq_show(struct seq_file *seq, void *v)
51339 - proc_net_create("aarp", 0, aarp_get_info);
51340 + struct aarp_iter_state *iter = seq->private;
51341 + struct aarp_entry *entry = v;
51342 + unsigned long now = jiffies;
51344 + if (v == ((void *)1))
51346 + "Address Interface Hardware Address"
51347 + " Expires LastSend Retry Status\n");
51349 + seq_printf(seq, "%04X:%02X %-12s",
51350 + ntohs(entry->target_addr.s_net),
51351 + (unsigned int) entry->target_addr.s_node,
51352 + entry->dev ? entry->dev->name : "????");
51353 + seq_printf(seq, "%02X:%02X:%02X:%02X:%02X:%02X",
51354 + entry->hwaddr[0] & 0xFF,
51355 + entry->hwaddr[1] & 0xFF,
51356 + entry->hwaddr[2] & 0xFF,
51357 + entry->hwaddr[3] & 0xFF,
51358 + entry->hwaddr[4] & 0xFF,
51359 + entry->hwaddr[5] & 0xFF);
51360 + seq_printf(seq, " %8s",
51361 + dt2str((long)entry->expires_at - (long)now));
51362 + if (iter->table == unresolved)
51363 + seq_printf(seq, " %8s %6hu",
51364 + dt2str(now - entry->last_sent),
51365 + entry->xmit_count);
51367 + seq_puts(seq, " ");
51368 + seq_printf(seq, " %s\n",
51369 + (iter->table == resolved) ? "resolved"
51370 + : (iter->table == unresolved) ? "unresolved"
51371 + : (iter->table == proxies) ? "proxies"
51377 -void aarp_unregister_proc_fs(void)
51378 +static struct seq_operations aarp_seq_ops = {
51379 + .start = aarp_seq_start,
51380 + .next = aarp_seq_next,
51381 + .stop = aarp_seq_stop,
51382 + .show = aarp_seq_show,
51385 +static int aarp_seq_open(struct inode *inode, struct file *file)
51387 - proc_net_remove("aarp");
51388 + struct seq_file *seq;
51389 + int rc = -ENOMEM;
51390 + struct aarp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
51395 + rc = seq_open(file, &aarp_seq_ops);
51399 + seq = file->private_data;
51400 + seq->private = s;
51401 + memset(s, 0, sizeof(*s));
51409 +struct file_operations atalk_seq_arp_fops = {
51410 + .owner = THIS_MODULE,
51411 + .open = aarp_seq_open,
51412 + .read = seq_read,
51413 + .llseek = seq_lseek,
51414 + .release = seq_release_private,
51418 +/* General module cleanup. Called from cleanup_module() in ddp.c. */
51419 +void aarp_cleanup_module(void)
51421 + del_timer_sync(&aarp_timer);
51422 + unregister_netdevice_notifier(&aarp_notifier);
51423 + unregister_snap_client(aarp_dl);
51426 diff -Nru a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c
51427 --- a/net/appletalk/atalk_proc.c Mon Jun 16 08:11:36 2003
51428 +++ b/net/appletalk/atalk_proc.c Sat Aug 30 19:27:36 2003
51430 #include <linux/atalk.h>
51432 #ifdef CONFIG_PROC_FS
51433 +extern struct file_operations atalk_seq_arp_fops;
51435 static __inline__ struct atalk_iface *atalk_get_interface_idx(loff_t pos)
51437 struct atalk_iface *i;
51439 struct atalk_iface *iface;
51441 if (v == (void *)1) {
51442 - seq_puts(seq, "Interface Address Networks "
51443 + seq_puts(seq, "Interface Address Networks "
51447 @@ -275,6 +277,7 @@
51448 atalk_proc_dir = proc_mkdir("atalk", proc_net);
51449 if (!atalk_proc_dir)
51451 + atalk_proc_dir->owner = THIS_MODULE;
51453 p = create_proc_entry("interface", S_IRUGO, atalk_proc_dir);
51455 @@ -291,9 +294,16 @@
51457 p->proc_fops = &atalk_seq_socket_fops;
51459 + p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir);
51462 + p->proc_fops = &atalk_seq_arp_fops;
51468 + remove_proc_entry("socket", atalk_proc_dir);
51470 remove_proc_entry("route", atalk_proc_dir);
51472 @@ -308,6 +318,7 @@
51473 remove_proc_entry("interface", atalk_proc_dir);
51474 remove_proc_entry("route", atalk_proc_dir);
51475 remove_proc_entry("socket", atalk_proc_dir);
51476 + remove_proc_entry("arp", atalk_proc_dir);
51477 remove_proc_entry("atalk", proc_net);
51480 diff -Nru a/net/appletalk/ddp.c b/net/appletalk/ddp.c
51481 --- a/net/appletalk/ddp.c Mon Jun 16 08:11:36 2003
51482 +++ b/net/appletalk/ddp.c Sat Aug 30 19:29:20 2003
51484 #include <net/route.h>
51485 #include <linux/atalk.h>
51487 -#ifdef CONFIG_PROC_FS
51488 -extern void aarp_register_proc_fs(void);
51489 -extern void aarp_unregister_proc_fs(void);
51492 extern void aarp_cleanup_module(void);
51494 extern void aarp_probe_network(struct atalk_iface *atif);
51495 @@ -183,13 +178,12 @@
51497 struct sock *sk = (struct sock *)data;
51499 - if (!atomic_read(&sk->sk_wmem_alloc) &&
51500 - !atomic_read(&sk->sk_rmem_alloc) && sock_flag(sk, SOCK_DEAD))
51503 + if (atomic_read(&sk->sk_wmem_alloc) ||
51504 + atomic_read(&sk->sk_rmem_alloc)) {
51505 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME;
51506 add_timer(&sk->sk_timer);
51512 static inline void atalk_destroy_socket(struct sock *sk)
51513 @@ -197,16 +191,15 @@
51514 atalk_remove_socket(sk);
51515 skb_queue_purge(&sk->sk_receive_queue);
51517 - if (!atomic_read(&sk->sk_wmem_alloc) &&
51518 - !atomic_read(&sk->sk_rmem_alloc) && sock_flag(sk, SOCK_DEAD))
51521 + if (atomic_read(&sk->sk_wmem_alloc) ||
51522 + atomic_read(&sk->sk_rmem_alloc)) {
51523 init_timer(&sk->sk_timer);
51524 sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME;
51525 sk->sk_timer.function = atalk_destroy_timer;
51526 sk->sk_timer.data = (unsigned long)sk;
51527 add_timer(&sk->sk_timer);
51533 /**************************************************************************\
51534 @@ -239,6 +232,7 @@
51535 while ((tmp = *iface) != NULL) {
51536 if (tmp->dev == dev) {
51537 *iface = tmp->next;
51540 dev->atalk_ptr = NULL;
51542 @@ -255,6 +249,7 @@
51548 dev->atalk_ptr = iface;
51549 iface->address = *sa;
51550 @@ -616,6 +611,7 @@
51551 (!(tmp->flags&RTF_GATEWAY) ||
51552 tmp->target.s_node == addr->s_node)) {
51554 + dev_put(tmp->dev);
51558 @@ -640,6 +636,7 @@
51559 while ((tmp = *r) != NULL) {
51560 if (tmp->dev == dev) {
51566 @@ -935,24 +932,95 @@
51567 * Checksum: This is 'optional'. It's quite likely also a good
51568 * candidate for assembler hackery 8)
51570 -unsigned short atalk_checksum(struct ddpehdr *ddp, int len)
51571 +static unsigned long atalk_sum_partial(const unsigned char *data,
51572 + int len, unsigned long sum)
51574 - unsigned long sum = 0; /* Assume unsigned long is >16 bits */
51575 - unsigned char *data = (unsigned char *)ddp;
51577 - len -= 4; /* skip header 4 bytes */
51580 /* This ought to be unwrapped neatly. I'll trust gcc for now */
51585 - if (sum & 0x10000) {
51588 + sum = ((sum >> 16) + sum) & 0xFFFF;
51593 +/* Checksum skb data -- similar to skb_checksum */
51594 +static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
51595 + int len, unsigned long sum)
51597 + int start = skb_headlen(skb);
51600 + /* checksum stuff in header space */
51601 + if ( (copy = start - offset) > 0) {
51604 + sum = atalk_sum_partial(skb->data + offset, copy, sum);
51605 + if ( (len -= copy) == 0)
51611 + /* checksum stuff in frags */
51612 + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
51615 + BUG_TRAP(start <= offset + len);
51617 + end = start + skb_shinfo(skb)->frags[i].size;
51618 + if ((copy = end - offset) > 0) {
51620 + skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
51624 + vaddr = kmap_skb_frag(frag);
51625 + sum = atalk_sum_partial(vaddr + frag->page_offset +
51626 + offset - start, copy, sum);
51627 + kunmap_skb_frag(vaddr);
51629 + if (!(len -= copy))
51636 + if (skb_shinfo(skb)->frag_list) {
51637 + struct sk_buff *list = skb_shinfo(skb)->frag_list;
51639 + for (; list; list = list->next) {
51642 + BUG_TRAP(start <= offset + len);
51644 + end = start + list->len;
51645 + if ((copy = end - offset) > 0) {
51648 + sum = atalk_sum_skb(list, offset - start,
51650 + if ((len -= copy) == 0)
51664 +static unsigned short atalk_checksum(const struct sk_buff *skb, int len)
51666 + unsigned long sum;
51668 + /* skip header 4 bytes */
51669 + sum = atalk_sum_skb(skb, 4, len-4, 0);
51671 /* Use 0xFFFF for 0. 0 itself means none */
51672 return sum ? htons((unsigned short)sum) : 0xFFFF;
51674 @@ -983,6 +1051,8 @@
51676 sock->ops = &atalk_dgram_ops;
51677 sock_init_data(sock, sk);
51678 + sk_set_owner(sk, THIS_MODULE);
51680 /* Checksums on by default */
51683 @@ -998,10 +1068,7 @@
51684 struct sock *sk = sock->sk;
51687 - if (!sock_flag(sk, SOCK_DEAD)) {
51688 - sk->sk_state_change(sk);
51689 - sock_set_flag(sk, SOCK_DEAD);
51693 atalk_destroy_socket(sk);
51695 @@ -1335,25 +1402,27 @@
51696 static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
51697 struct packet_type *pt)
51699 - struct ddpehdr *ddp = ddp_hdr(skb);
51700 + struct ddpehdr *ddp;
51702 struct atalk_iface *atif;
51703 struct sockaddr_at tosat;
51705 struct ddpebits ddphv;
51708 - if (skb->len < sizeof(*ddp))
51709 + /* Don't mangle buffer if shared */
51710 + if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
51713 + /* Size check and make sure header is contiguous */
51714 + if (!pskb_may_pull(skb, sizeof(*ddp)))
51717 + ddp = ddp_hdr(skb);
51720 * Fix up the length field [Ok this is horrible but otherwise
51721 * I end up with unions of bit fields and messy bit field order
51722 * compiler/endian dependencies..]
51724 - * FIXME: This is a write to a shared object. Granted it
51725 - * happens to be safe BUT.. (Its safe as user space will not
51726 - * run until we put it back)
51728 *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp));
51730 @@ -1374,7 +1443,7 @@
51731 * valid for net byte orders all over the networking code...
51733 if (ddp->deh_sum &&
51734 - atalk_checksum(ddp, ddphv.deh_len) != ddp->deh_sum)
51735 + atalk_checksum(skb, ddphv.deh_len) != ddp->deh_sum)
51736 /* Not a valid AppleTalk frame - dustbin time */
51739 @@ -1433,14 +1502,16 @@
51741 if (!ap || skb->len < sizeof(struct ddpshdr))
51744 + /* Don't mangle buffer if shared */
51745 + if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
51749 * The push leaves us with a ddephdr not an shdr, and
51750 * handily the port bytes in the right place preset.
51753 - skb_push(skb, sizeof(*ddp) - 4);
51754 - /* FIXME: use skb->cb to be able to use shared skbs */
51755 - ddp = (struct ddpehdr *)skb->data;
51756 + ddp = (struct ddpehdr *) skb_push(skb, sizeof(*ddp) - 4);
51758 /* Now fill in the long header */
51760 @@ -1592,7 +1663,7 @@
51761 if (sk->sk_no_check == 1)
51764 - ddp->deh_sum = atalk_checksum(ddp, len + sizeof(*ddp));
51765 + ddp->deh_sum = atalk_checksum(skb, len + sizeof(*ddp));
51768 * Loopback broadcast packets to non gateway targets (ie routes
51769 @@ -1801,11 +1872,13 @@
51770 struct packet_type ltalk_packet_type = {
51771 .type = __constant_htons(ETH_P_LOCALTALK),
51773 + .data = (void *)1,
51776 struct packet_type ppptalk_packet_type = {
51777 .type = __constant_htons(ETH_P_PPPTALK),
51779 + .data = (void *)1,
51782 static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B };
51783 @@ -1834,9 +1907,6 @@
51784 register_netdevice_notifier(&ddp_notifier);
51787 -#ifdef CONFIG_PROC_FS
51788 - aarp_register_proc_fs();
51789 -#endif /* CONFIG_PROC_FS */
51790 atalk_register_sysctl();
51791 printk(atalk_banner);
51793 @@ -1844,13 +1914,10 @@
51794 module_init(atalk_init);
51797 - * Note on MOD_{INC,DEC}_USE_COUNT:
51799 - * Use counts are incremented/decremented when
51800 - * sockets are created/deleted.
51802 - * AppleTalk interfaces are not incremented until atalkd is run
51803 - * and are only decremented when they are downed.
51804 + * No explicit module reference count manipulation is needed in the
51805 + * protocol. Socket layer sets module reference count for us
51806 + * and interfaces reference counting is done
51807 + * by the network device layer.
51809 * Ergo, before the AppleTalk module can be removed, all AppleTalk
51810 * sockets be closed from user space.
51811 @@ -1861,9 +1928,6 @@
51812 atalk_unregister_sysctl();
51813 #endif /* CONFIG_SYSCTL */
51815 -#ifdef CONFIG_PROC_FS
51816 - aarp_unregister_proc_fs();
51817 -#endif /* CONFIG_PROC_FS */
51818 aarp_cleanup_module(); /* General aarp clean-up. */
51819 unregister_netdevice_notifier(&ddp_notifier);
51820 dev_remove_pack(<alk_packet_type);
51821 diff -Nru a/net/atm/common.c b/net/atm/common.c
51822 --- a/net/atm/common.c Tue Aug 19 21:10:45 2003
51823 +++ b/net/atm/common.c Sat Aug 30 19:13:39 2003
51824 @@ -279,6 +279,7 @@
51827 sock_init_data(sock, sk);
51828 + sk_set_owner(sk, THIS_MODULE);
51829 sk->sk_state_change = vcc_def_wakeup;
51830 sk->sk_write_space = vcc_write_space;
51832 diff -Nru a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
51833 --- a/net/ax25/af_ax25.c Thu Aug 21 11:59:08 2003
51834 +++ b/net/ax25/af_ax25.c Sun Aug 24 04:34:01 2003
51835 @@ -1842,81 +1842,107 @@
51839 -static int ax25_get_info(char *buffer, char **start, off_t offset, int length)
51840 +#ifdef CONFIG_PROC_FS
51842 +static void *ax25_info_start(struct seq_file *seq, loff_t *pos)
51849 + struct ax25_cb *ax25;
51850 struct hlist_node *node;
51853 spin_lock_bh(&ax25_list_lock);
51854 + ax25_for_each(ax25, node, &ax25_list) {
51862 +static void *ax25_info_next(struct seq_file *seq, void *v, loff_t *pos)
51866 + return hlist_entry( ((struct ax25_cb *)v)->ax25_node.next,
51867 + struct ax25_cb, ax25_node);
51870 +static void ax25_info_stop(struct seq_file *seq, void *v)
51872 + spin_unlock_bh(&ax25_list_lock);
51875 +static int ax25_info_show(struct seq_file *seq, void *v)
51877 + ax25_cb *ax25 = v;
51883 * magic dev src_addr dest_addr,digi1,digi2,.. st vs vr va t1 t1 t2 t2 t3 t3 idle idle n2 n2 rtt window paclen Snd-Q Rcv-Q inode
51886 - ax25_for_each(ax25, node, &ax25_list) {
51887 - len += sprintf(buffer+len, "%8.8lx %s %s%s ",
51889 - ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name,
51890 - ax2asc(&ax25->source_addr),
51891 - ax25->iamdigi? "*":"");
51893 - len += sprintf(buffer+len, "%s", ax2asc(&ax25->dest_addr));
51895 - for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) {
51896 - len += sprintf(buffer+len, ",%s%s",
51897 - ax2asc(&ax25->digipeat->calls[k]),
51898 - ax25->digipeat->repeated[k]? "*":"");
51901 - len += sprintf(buffer+len, " %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %d %d",
51903 - ax25->vs, ax25->vr, ax25->va,
51904 - ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ,
51905 - ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ,
51906 - ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ,
51907 - ax25_display_timer(&ax25->idletimer) / (60 * HZ),
51908 - ax25->idle / (60 * HZ),
51909 - ax25->n2count, ax25->n2,
51914 - if (ax25->sk != NULL) {
51915 - bh_lock_sock(ax25->sk);
51916 - len += sprintf(buffer + len, " %d %d %ld\n",
51917 - atomic_read(&ax25->sk->sk_wmem_alloc),
51918 - atomic_read(&ax25->sk->sk_rmem_alloc),
51919 - ax25->sk->sk_socket != NULL ? SOCK_INODE(ax25->sk->sk_socket)->i_ino : 0L);
51920 - bh_unlock_sock(ax25->sk);
51922 - len += sprintf(buffer + len, " * * *\n");
51925 - pos = begin + len;
51927 - if (pos < offset) {
51931 + seq_printf(seq, "%8.8lx %s %s%s ",
51933 + ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name,
51934 + ax2asc(&ax25->source_addr),
51935 + ax25->iamdigi? "*":"");
51936 + seq_printf(seq, "%s", ax2asc(&ax25->dest_addr));
51938 + for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) {
51939 + seq_printf(seq, ",%s%s",
51940 + ax2asc(&ax25->digipeat->calls[k]),
51941 + ax25->digipeat->repeated[k]? "*":"");
51944 - if (pos > offset + length)
51946 + seq_printf(seq, " %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %d %d",
51948 + ax25->vs, ax25->vr, ax25->va,
51949 + ax25_display_timer(&ax25->t1timer) / HZ, ax25->t1 / HZ,
51950 + ax25_display_timer(&ax25->t2timer) / HZ, ax25->t2 / HZ,
51951 + ax25_display_timer(&ax25->t3timer) / HZ, ax25->t3 / HZ,
51952 + ax25_display_timer(&ax25->idletimer) / (60 * HZ),
51953 + ax25->idle / (60 * HZ),
51954 + ax25->n2count, ax25->n2,
51959 + if (ax25->sk != NULL) {
51960 + bh_lock_sock(ax25->sk);
51961 + seq_printf(seq," %d %d %ld\n",
51962 + atomic_read(&ax25->sk->sk_wmem_alloc),
51963 + atomic_read(&ax25->sk->sk_rmem_alloc),
51964 + ax25->sk->sk_socket != NULL ? SOCK_INODE(ax25->sk->sk_socket)->i_ino : 0L);
51965 + bh_unlock_sock(ax25->sk);
51967 + seq_puts(seq, " * * *\n");
51972 - spin_unlock_bh(&ax25_list_lock);
51973 +static struct seq_operations ax25_info_seqops = {
51974 + .start = ax25_info_start,
51975 + .next = ax25_info_next,
51976 + .stop = ax25_info_stop,
51977 + .show = ax25_info_show,
51980 - *start = buffer + (offset - begin);
51981 - len -= (offset - begin);
51982 +static int ax25_info_open(struct inode *inode, struct file *file)
51984 + return seq_open(file, &ax25_info_seqops);
51987 - if (len > length) len = length;
51988 +static struct file_operations ax25_info_fops = {
51989 + .owner = THIS_MODULE,
51990 + .open = ax25_info_open,
51991 + .read = seq_read,
51992 + .llseek = seq_lseek,
51993 + .release = seq_release,
52000 static struct net_proto_family ax25_family_ops = {
52002 @@ -1986,9 +2012,9 @@
52003 register_netdevice_notifier(&ax25_dev_notifier);
52004 ax25_register_sysctl();
52006 - proc_net_create("ax25_route", 0, ax25_rt_get_info);
52007 - proc_net_create("ax25", 0, ax25_get_info);
52008 - proc_net_create("ax25_calls", 0, ax25_uid_get_info);
52009 + proc_net_fops_create("ax25_route", S_IRUGO, &ax25_route_fops);
52010 + proc_net_fops_create("ax25", S_IRUGO, &ax25_info_fops);
52011 + proc_net_fops_create("ax25_calls", S_IRUGO, &ax25_uid_fops);
52015 diff -Nru a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
52016 --- a/net/ax25/ax25_dev.c Thu Jun 5 01:01:36 2003
52017 +++ b/net/ax25/ax25_dev.c Sun Aug 24 04:32:46 2003
52020 dev->ax25_ptr = ax25_dev;
52021 ax25_dev->dev = dev;
52023 ax25_dev->forward = NULL;
52025 ax25_dev->values[AX25_VALUES_IPDEFMODE] = AX25_DEF_IPDEFMODE;
52026 @@ -121,6 +122,7 @@
52027 if ((s = ax25_dev_list) == ax25_dev) {
52028 ax25_dev_list = s->next;
52029 spin_unlock_bh(&ax25_dev_lock);
52032 ax25_register_sysctl();
52034 @@ -130,6 +132,7 @@
52035 if (s->next == ax25_dev) {
52036 s->next = ax25_dev->next;
52037 spin_unlock_bh(&ax25_dev_lock);
52040 ax25_register_sysctl();
52042 @@ -196,8 +199,8 @@
52043 ax25_dev = ax25_dev_list;
52044 while (ax25_dev != NULL) {
52046 + dev_put(ax25_dev->dev);
52047 ax25_dev = ax25_dev->next;
52051 ax25_dev_list = NULL;
52052 diff -Nru a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
52053 --- a/net/ax25/ax25_route.c Thu Aug 21 11:59:08 2003
52054 +++ b/net/ax25/ax25_route.c Sun Aug 24 04:34:01 2003
52056 #include <linux/mm.h>
52057 #include <linux/interrupt.h>
52058 #include <linux/init.h>
52059 +#include <linux/seq_file.h>
52061 static ax25_route *ax25_route_list;
52062 static rwlock_t ax25_route_lock = RW_LOCK_UNLOCKED;
52063 @@ -278,66 +279,100 @@
52067 -int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length)
52069 - ax25_route *ax25_rt;
52075 +#ifdef CONFIG_PROC_FS
52077 - read_lock(&ax25_route_lock);
52078 +#define AX25_PROC_START ((void *)1)
52080 - len += sprintf(buffer, "callsign dev mode digipeaters\n");
52081 +static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos)
52083 + struct ax25_route *ax25_rt;
52086 + read_lock(&ax25_route_lock);
52088 + return AX25_PROC_START;
52090 for (ax25_rt = ax25_route_list; ax25_rt != NULL; ax25_rt = ax25_rt->next) {
52099 +static void *ax25_rt_seq_next(struct seq_file *seq, void *v, loff_t *pos)
52102 + return (v == AX25_PROC_START) ? ax25_route_list :
52103 + ((struct ax25_route *) v)->next;
52106 +static void ax25_rt_seq_stop(struct seq_file *seq, void *v)
52108 + read_unlock(&ax25_route_lock);
52111 +static int ax25_rt_seq_show(struct seq_file *seq, void *v)
52113 + if (v == AX25_PROC_START)
52114 + seq_puts(seq, "callsign dev mode digipeaters\n");
52116 + struct ax25_route *ax25_rt = v;
52117 + const char *callsign;
52120 if (ax25cmp(&ax25_rt->callsign, &null_ax25_address) == 0)
52121 callsign = "default";
52123 callsign = ax2asc(&ax25_rt->callsign);
52124 - len += sprintf(buffer + len, "%-9s %-4s",
52126 + seq_printf(seq, "%-9s %-4s",
52128 ax25_rt->dev ? ax25_rt->dev->name : "???");
52130 switch (ax25_rt->ip_mode) {
52132 - len += sprintf(buffer + len, " vc");
52133 + seq_puts(seq, " vc");
52136 - len += sprintf(buffer + len, " dg");
52137 + seq_puts(seq, " dg");
52140 - len += sprintf(buffer + len, " *");
52141 + seq_puts(seq, " *");
52145 if (ax25_rt->digipeat != NULL)
52146 for (i = 0; i < ax25_rt->digipeat->ndigi; i++)
52147 - len += sprintf(buffer + len, " %s", ax2asc(&ax25_rt->digipeat->calls[i]));
52149 - len += sprintf(buffer + len, "\n");
52150 + seq_printf(seq, " %s", ax2asc(&ax25_rt->digipeat->calls[i]));
52152 - pos = begin + len;
52154 - if (pos < offset) {
52159 - if (pos > offset + length)
52161 + seq_puts(seq, "\n");
52163 - read_unlock(&ax25_route_lock);
52165 - *start = buffer + (offset - begin);
52166 - len -= (offset - begin);
52170 - if (len > length)
52172 +static struct seq_operations ax25_rt_seqops = {
52173 + .start = ax25_rt_seq_start,
52174 + .next = ax25_rt_seq_next,
52175 + .stop = ax25_rt_seq_stop,
52176 + .show = ax25_rt_seq_show,
52180 +static int ax25_rt_info_open(struct inode *inode, struct file *file)
52182 + return seq_open(file, &ax25_rt_seqops);
52185 +struct file_operations ax25_route_fops = {
52186 + .owner = THIS_MODULE,
52187 + .open = ax25_rt_info_open,
52188 + .read = seq_read,
52189 + .llseek = seq_lseek,
52190 + .release = seq_release,
52197 diff -Nru a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
52198 --- a/net/ax25/ax25_uid.c Mon Aug 5 06:20:38 2002
52199 +++ b/net/ax25/ax25_uid.c Sun Aug 24 04:34:01 2003
52201 #include <linux/interrupt.h>
52202 #include <linux/notifier.h>
52203 #include <linux/proc_fs.h>
52204 +#include <linux/seq_file.h>
52205 #include <linux/stat.h>
52206 #include <linux/netfilter.h>
52207 #include <linux/sysctl.h>
52208 @@ -141,39 +142,73 @@
52209 return -EINVAL; /*NOTREACHED */
52212 -int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length)
52213 +#ifdef CONFIG_PROC_FS
52215 +#define AX25_PROC_START ((void *)1)
52217 +static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
52219 - ax25_uid_assoc *pt;
52223 + struct ax25_uid_assoc *pt;
52226 read_lock(&ax25_uid_lock);
52227 - len += sprintf(buffer, "Policy: %d\n", ax25_uid_policy);
52229 + return AX25_PROC_START;
52231 for (pt = ax25_uid_list; pt != NULL; pt = pt->next) {
52232 - len += sprintf(buffer + len, "%6d %s\n", pt->uid, ax2asc(&pt->call));
52234 - pos = begin + len;
52242 - if (pos < offset) {
52246 +static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
52249 + return (v == AX25_PROC_START) ? ax25_uid_list :
52250 + ((struct ax25_uid_assoc *) v)->next;
52253 - if (pos > offset + length)
52256 +static void ax25_uid_seq_stop(struct seq_file *seq, void *v)
52258 read_unlock(&ax25_uid_lock);
52261 +static int ax25_uid_seq_show(struct seq_file *seq, void *v)
52263 + if (v == AX25_PROC_START)
52264 + seq_printf(seq, "Policy: %d\n", ax25_uid_policy);
52266 + struct ax25_uid_assoc *pt = v;
52269 - *start = buffer + (offset - begin);
52270 - len -= offset - begin;
52271 + seq_printf(seq, "%6d %s\n", pt->uid, ax2asc(&pt->call));
52276 - if (len > length)
52278 +static struct seq_operations ax25_uid_seqops = {
52279 + .start = ax25_uid_seq_start,
52280 + .next = ax25_uid_seq_next,
52281 + .stop = ax25_uid_seq_stop,
52282 + .show = ax25_uid_seq_show,
52286 +static int ax25_uid_info_open(struct inode *inode, struct file *file)
52288 + return seq_open(file, &ax25_uid_seqops);
52291 +struct file_operations ax25_uid_fops = {
52292 + .owner = THIS_MODULE,
52293 + .open = ax25_uid_info_open,
52294 + .read = seq_read,
52295 + .llseek = seq_lseek,
52296 + .release = seq_release,
52302 * Free all memory associated with UID/Callsign structures.
52303 diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
52304 --- a/net/bluetooth/af_bluetooth.c Wed Jun 18 13:59:01 2003
52305 +++ b/net/bluetooth/af_bluetooth.c Sat Aug 30 19:30:42 2003
52306 @@ -130,6 +130,7 @@
52309 sock_init_data(sock, sk);
52310 + sk_set_owner(sk, THIS_MODULE);
52311 INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
52314 diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
52315 --- a/net/bluetooth/l2cap.c Mon Jun 16 08:11:36 2003
52316 +++ b/net/bluetooth/l2cap.c Sun Aug 31 16:14:24 2003
52317 @@ -200,7 +200,7 @@
52319 static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
52321 - struct sock *sk, *sk1 = NULL;
52322 + struct sock *sk = NULL, *sk1 = NULL;
52323 struct hlist_node *node;
52325 sk_for_each(sk, node, &l2cap_sk_list.head) {
52326 diff -Nru a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
52327 --- a/net/bluetooth/rfcomm/sock.c Fri Jul 4 23:52:58 2003
52328 +++ b/net/bluetooth/rfcomm/sock.c Sun Aug 31 16:14:24 2003
52329 @@ -114,7 +114,7 @@
52330 /* ---- Socket functions ---- */
52331 static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
52334 + struct sock *sk = NULL;
52335 struct hlist_node *node;
52337 sk_for_each(sk, node, &rfcomm_sk_list.head) {
52338 @@ -131,7 +131,7 @@
52340 static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
52342 - struct sock *sk, *sk1 = NULL;
52343 + struct sock *sk = NULL, *sk1 = NULL;
52344 struct hlist_node *node;
52346 sk_for_each(sk, node, &rfcomm_sk_list.head) {
52347 diff -Nru a/net/bridge/Makefile b/net/bridge/Makefile
52348 --- a/net/bridge/Makefile Sun Aug 3 15:08:32 2003
52349 +++ b/net/bridge/Makefile Mon Sep 1 01:44:26 2003
52351 br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \
52352 br_stp_if.o br_stp_timer.o
52354 -# br_netfilter only deals with IPv4 and ARP filtering, both are INET protocols
52355 -ifeq ($(CONFIG_INET),y)
52356 -bridge-$(CONFIG_NETFILTER) += br_netfilter.o
52358 +bridge-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o
52360 obj-$(CONFIG_BRIDGE_NF_EBTABLES) += netfilter/
52361 diff -Nru a/net/bridge/br_forward.c b/net/bridge/br_forward.c
52362 --- a/net/bridge/br_forward.c Sun May 25 20:10:58 2003
52363 +++ b/net/bridge/br_forward.c Mon Sep 1 01:44:26 2003
52366 int br_dev_queue_push_xmit(struct sk_buff *skb)
52368 -#ifdef CONFIG_NETFILTER
52369 +#ifdef CONFIG_BRIDGE_NETFILTER
52370 /* ip_refrag calls ip_fragment, which doesn't copy the MAC header. */
52371 if (skb->nf_bridge)
52372 memcpy(skb->data - 16, skb->nf_bridge->hh, 16);
52373 diff -Nru a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig
52374 --- a/net/bridge/netfilter/Kconfig Thu Jul 17 23:40:19 2003
52375 +++ b/net/bridge/netfilter/Kconfig Sat Aug 30 20:40:35 2003
52378 # Bridge netfilter configuration
52381 +menu "Bridge: Netfilter Configuration"
52382 + depends on BRIDGE && NETFILTER
52384 config BRIDGE_NF_EBTABLES
52385 - tristate "Bridge: ebtables"
52386 - depends on NETFILTER && BRIDGE
52387 + tristate "Ethernet Bridge tables (ebtables) support"
52389 + ebtables is a general, extensible frame/packet identification
52390 + framework. Say 'Y' or 'M' here if you want to do Ethernet
52391 + filtering/NAT/brouting on the Ethernet bridge.
52395 +config BRIDGE_EBT_BROUTE
52396 + tristate "ebt: broute table support"
52397 + depends on BRIDGE_NF_EBTABLES
52399 + The ebtables broute table is used to define rules that decide between
52400 + bridging and routing frames, giving Linux the functionality of a
52401 + brouter. See the man page for ebtables(8) and examples on the ebtables
52404 + If you want to compile it as a module, say M here and read
52405 + <file:Documentation/modules.txt>. If unsure, say `N'.
52407 config BRIDGE_EBT_T_FILTER
52408 tristate "ebt: filter table support"
52409 @@ -26,35 +47,14 @@
52411 If you want to compile it as a module, say M here and read
52412 <file:Documentation/modules.txt>. If unsure, say `N'.
52414 -config BRIDGE_EBT_BROUTE
52415 - tristate "ebt: broute table support"
52419 +config BRIDGE_EBT_802_3
52420 + tristate "ebt: 802.3 filter support"
52421 depends on BRIDGE_NF_EBTABLES
52423 - The ebtables broute table is used to define rules that decide between
52424 - bridging and routing frames, giving Linux the functionality of a
52425 - brouter. See the man page for ebtables(8) and examples on the ebtables
52428 - If you want to compile it as a module, say M here and read
52429 - <file:Documentation/modules.txt>. If unsure, say `N'.
52431 -config BRIDGE_EBT_LOG
52432 - tristate "ebt: log support"
52433 - depends on BRIDGE_NF_EBTABLES
52435 - This option adds the log target, that you can use in any rule in
52436 - any ebtables table. It records the frame header to the syslog.
52438 - If you want to compile it as a module, say M here and read
52439 - <file:Documentation/modules.txt>. If unsure, say `N'.
52441 -config BRIDGE_EBT_IP
52442 - tristate "ebt: IP filter support"
52443 - depends on BRIDGE_NF_EBTABLES
52445 - This option adds the IP match, which allows basic IP header field
52447 + This option adds matching support for 802.3 Ethernet frames.
52449 If you want to compile it as a module, say M here and read
52450 <file:Documentation/modules.txt>. If unsure, say `N'.
52451 @@ -69,12 +69,12 @@
52452 If you want to compile it as a module, say M here and read
52453 <file:Documentation/modules.txt>. If unsure, say `N'.
52455 -config BRIDGE_EBT_VLAN
52456 - tristate "ebt: 802.1Q VLAN filter support"
52457 +config BRIDGE_EBT_IP
52458 + tristate "ebt: IP filter support"
52459 depends on BRIDGE_NF_EBTABLES
52461 - This option adds the 802.1Q vlan match, which allows the filtering of
52462 - 802.1Q vlan fields.
52463 + This option adds the IP match, which allows basic IP header field
52466 If you want to compile it as a module, say M here and read
52467 <file:Documentation/modules.txt>. If unsure, say `N'.
52468 @@ -113,12 +113,24 @@
52469 If you want to compile it as a module, say M here and read
52470 <file:Documentation/modules.txt>. If unsure, say `N'.
52472 -config BRIDGE_EBT_SNAT
52473 - tristate "ebt: snat target support"
52474 +config BRIDGE_EBT_VLAN
52475 + tristate "ebt: 802.1Q VLAN filter support"
52476 depends on BRIDGE_NF_EBTABLES
52478 - This option adds the MAC SNAT target, which allows altering the MAC
52479 - source address of frames.
52480 + This option adds the 802.1Q vlan match, which allows the filtering of
52481 + 802.1Q vlan fields.
52483 + If you want to compile it as a module, say M here and read
52484 + <file:Documentation/modules.txt>. If unsure, say `N'.
52488 +config BRIDGE_EBT_ARPREPLY
52489 + tristate "ebt: arp reply target support"
52490 + depends on BRIDGE_NF_EBTABLES
52492 + This option adds the arp reply target, which allows
52493 + automatically sending arp replies to arp requests.
52495 If you want to compile it as a module, say M here and read
52496 <file:Documentation/modules.txt>. If unsure, say `N'.
52497 @@ -133,6 +145,18 @@
52498 If you want to compile it as a module, say M here and read
52499 <file:Documentation/modules.txt>. If unsure, say `N'.
52501 +config BRIDGE_EBT_MARK_T
52502 + tristate "ebt: mark target support"
52503 + depends on BRIDGE_NF_EBTABLES
52505 + This option adds the mark target, which allows marking frames by
52506 + setting the 'nfmark' value in the frame.
52507 + This value is the same as the one used in the iptables mark match and
52510 + If you want to compile it as a module, say M here and read
52511 + <file:Documentation/modules.txt>. If unsure, say `N'.
52513 config BRIDGE_EBT_REDIRECT
52514 tristate "ebt: redirect target support"
52515 depends on BRIDGE_NF_EBTABLES
52516 @@ -143,15 +167,26 @@
52517 If you want to compile it as a module, say M here and read
52518 <file:Documentation/modules.txt>. If unsure, say `N'.
52520 -config BRIDGE_EBT_MARK_T
52521 - tristate "ebt: mark target support"
52522 +config BRIDGE_EBT_SNAT
52523 + tristate "ebt: snat target support"
52524 depends on BRIDGE_NF_EBTABLES
52526 - This option adds the mark target, which allows marking frames by
52527 - setting the 'nfmark' value in the frame.
52528 - This value is the same as the one used in the iptables mark match and
52530 + This option adds the MAC SNAT target, which allows altering the MAC
52531 + source address of frames.
52533 + If you want to compile it as a module, say M here and read
52534 + <file:Documentation/modules.txt>. If unsure, say `N'.
52538 +config BRIDGE_EBT_LOG
52539 + tristate "ebt: log support"
52540 + depends on BRIDGE_NF_EBTABLES
52542 + This option adds the log target, that you can use in any rule in
52543 + any ebtables table. It records the frame header to the syslog.
52545 If you want to compile it as a module, say M here and read
52546 <file:Documentation/modules.txt>. If unsure, say `N'.
52549 diff -Nru a/net/bridge/netfilter/Makefile b/net/bridge/netfilter/Makefile
52550 --- a/net/bridge/netfilter/Makefile Thu Jul 17 23:40:19 2003
52551 +++ b/net/bridge/netfilter/Makefile Sat Aug 30 20:40:35 2003
52555 obj-$(CONFIG_BRIDGE_NF_EBTABLES) += ebtables.o
52558 +obj-$(CONFIG_BRIDGE_EBT_BROUTE) += ebtable_broute.o
52559 obj-$(CONFIG_BRIDGE_EBT_T_FILTER) += ebtable_filter.o
52560 obj-$(CONFIG_BRIDGE_EBT_T_NAT) += ebtable_nat.o
52561 -obj-$(CONFIG_BRIDGE_EBT_BROUTE) += ebtable_broute.o
52562 -obj-$(CONFIG_BRIDGE_EBT_IP) += ebt_ip.o
52565 +obj-$(CONFIG_BRIDGE_EBT_802_3) += ebt_802_3.o
52566 obj-$(CONFIG_BRIDGE_EBT_ARP) += ebt_arp.o
52567 -obj-$(CONFIG_BRIDGE_EBT_VLAN) += ebt_vlan.o
52568 +obj-$(CONFIG_BRIDGE_EBT_IP) += ebt_ip.o
52569 obj-$(CONFIG_BRIDGE_EBT_MARK) += ebt_mark_m.o
52570 obj-$(CONFIG_BRIDGE_EBT_PKTTYPE) += ebt_pkttype.o
52571 obj-$(CONFIG_BRIDGE_EBT_STP) += ebt_stp.o
52572 -obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_log.o
52573 -obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o
52574 +obj-$(CONFIG_BRIDGE_EBT_VLAN) += ebt_vlan.o
52577 +obj-$(CONFIG_BRIDGE_EBT_ARPREPLY) += ebt_arpreply.o
52578 +obj-$(CONFIG_BRIDGE_EBT_MARK_T) += ebt_mark.o
52579 obj-$(CONFIG_BRIDGE_EBT_DNAT) += ebt_dnat.o
52580 obj-$(CONFIG_BRIDGE_EBT_REDIRECT) += ebt_redirect.o
52581 -obj-$(CONFIG_BRIDGE_EBT_MARK_T) += ebt_mark.o
52582 +obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o
52585 +obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_log.o
52586 diff -Nru a/net/bridge/netfilter/ebt_802_3.c b/net/bridge/netfilter/ebt_802_3.c
52587 --- /dev/null Wed Dec 31 16:00:00 1969
52588 +++ b/net/bridge/netfilter/ebt_802_3.c Sat Aug 30 20:40:29 2003
52594 + * Chris Vitale csv@bluetail.com
52600 +#include <linux/netfilter_bridge/ebtables.h>
52601 +#include <linux/netfilter_bridge/ebt_802_3.h>
52602 +#include <linux/module.h>
52604 +static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *in,
52605 + const struct net_device *out, const void *data, unsigned int datalen)
52607 + struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
52608 + struct ebt_802_3_hdr *hdr = (struct ebt_802_3_hdr *)skb->mac.ethernet;
52609 + uint16_t type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
52611 + if (info->bitmask & EBT_802_3_SAP) {
52612 + if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP))
52613 + return EBT_NOMATCH;
52614 + if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP))
52615 + return EBT_NOMATCH;
52618 + if (info->bitmask & EBT_802_3_TYPE) {
52619 + if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE))
52620 + return EBT_NOMATCH;
52621 + if (FWINV(info->type != type, EBT_802_3_TYPE))
52622 + return EBT_NOMATCH;
52625 + return EBT_MATCH;
52628 +static struct ebt_match filter_802_3;
52629 +static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
52630 + const struct ebt_entry *e, void *data, unsigned int datalen)
52632 + struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
52634 + if (datalen < sizeof(struct ebt_802_3_info))
52636 + if (info->bitmask & ~EBT_802_3_MASK || info->invflags & ~EBT_802_3_MASK)
52642 +static struct ebt_match filter_802_3 =
52644 + .name = EBT_802_3_MATCH,
52645 + .match = ebt_filter_802_3,
52646 + .check = ebt_802_3_check,
52647 + .me = THIS_MODULE,
52650 +static int __init init(void)
52652 + return ebt_register_match(&filter_802_3);
52655 +static void __exit fini(void)
52657 + ebt_unregister_match(&filter_802_3);
52660 +module_init(init);
52661 +module_exit(fini);
52662 +MODULE_LICENSE("GPL");
52663 diff -Nru a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c
52664 --- /dev/null Wed Dec 31 16:00:00 1969
52665 +++ b/net/bridge/netfilter/ebt_arpreply.c Sun Aug 24 04:31:46 2003
52671 + * Grzegorz Borowiak <grzes@gnu.univ.gda.pl>
52672 + * Bart De Schuymer <bdschuym@pandora.be>
52678 +#include <linux/netfilter_bridge/ebtables.h>
52679 +#include <linux/netfilter_bridge/ebt_arpreply.h>
52680 +#include <linux/if_arp.h>
52681 +#include <net/arp.h>
52682 +#include <linux/module.h>
52684 +static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr,
52685 + const struct net_device *in, const struct net_device *out,
52686 + const void *data, unsigned int datalen)
52688 + struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data;
52690 + struct arphdr ah;
52691 + unsigned char sha[ETH_ALEN];
52692 + struct sk_buff *skb = *pskb;
52694 + if (skb_copy_bits(skb, 0, &ah, sizeof(ah)))
52697 + if (ah.ar_op != __constant_htons(ARPOP_REQUEST) || ah.ar_hln != ETH_ALEN
52698 + || ah.ar_pro != __constant_htons(ETH_P_IP) || ah.ar_pln != 4)
52699 + return EBT_CONTINUE;
52701 + if (skb_copy_bits(skb, sizeof(ah), &sha, ETH_ALEN))
52704 + if (skb_copy_bits(skb, sizeof(ah) + ETH_ALEN, &sip, sizeof(sip)))
52707 + if (skb_copy_bits(skb, sizeof(ah) + 2 * ETH_ALEN + sizeof(sip),
52708 + &dip, sizeof(dip)))
52711 + arp_send(ARPOP_REPLY, ETH_P_ARP, sip, (struct net_device *)in,
52712 + dip, sha, info->mac, sha);
52714 + return info->target;
52717 +static int ebt_target_reply_check(const char *tablename, unsigned int hookmask,
52718 + const struct ebt_entry *e, void *data, unsigned int datalen)
52720 + struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data;
52722 + if (datalen != EBT_ALIGN(sizeof(struct ebt_arpreply_info)))
52724 + if (BASE_CHAIN && info->target == EBT_RETURN)
52726 + if (e->ethproto != __constant_htons(ETH_P_ARP) ||
52727 + e->invflags & EBT_IPROTO)
52729 + CLEAR_BASE_CHAIN_BIT;
52730 + if (strcmp(tablename, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING))
52735 +static struct ebt_target reply_target =
52737 + .name = EBT_ARPREPLY_TARGET,
52738 + .target = ebt_target_reply,
52739 + .check = ebt_target_reply_check,
52740 + .me = THIS_MODULE,
52743 +static int __init init(void)
52745 + return ebt_register_target(&reply_target);
52748 +static void __exit fini(void)
52750 + ebt_unregister_target(&reply_target);
52753 +module_init(init);
52754 +module_exit(fini);
52755 +MODULE_LICENSE("GPL");
52756 diff -Nru a/net/core/dev.c b/net/core/dev.c
52757 --- a/net/core/dev.c Tue Aug 19 21:04:26 2003
52758 +++ b/net/core/dev.c Mon Sep 1 12:14:20 2003
52759 @@ -845,11 +845,7 @@
52760 * engine, but this requires more changes in devices. */
52762 smp_mb__after_clear_bit(); /* Commit netif_running(). */
52763 - while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
52765 - current->state = TASK_INTERRUPTIBLE;
52766 - schedule_timeout(1);
52768 + netif_poll_disable(dev);
52771 * Call the device specific close. This cannot fail.
52772 @@ -1210,7 +1206,7 @@
52774 int mod_cong = 290;
52776 -struct netif_rx_stats netdev_rx_stat[NR_CPUS];
52777 +DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
52780 #ifdef CONFIG_NET_HW_FLOWCONTROL
52781 @@ -1359,7 +1355,7 @@
52782 this_cpu = smp_processor_id();
52783 queue = &__get_cpu_var(softnet_data);
52785 - netdev_rx_stat[this_cpu].total++;
52786 + __get_cpu_var(netdev_rx_stat).total++;
52787 if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
52788 if (queue->input_pkt_queue.qlen) {
52789 if (queue->throttle)
52790 @@ -1389,14 +1385,14 @@
52792 if (!queue->throttle) {
52793 queue->throttle = 1;
52794 - netdev_rx_stat[this_cpu].throttled++;
52795 + __get_cpu_var(netdev_rx_stat).throttled++;
52796 #ifdef CONFIG_NET_HW_FLOWCONTROL
52797 atomic_inc(&netdev_dropping);
52802 - netdev_rx_stat[this_cpu].dropped++;
52803 + __get_cpu_var(netdev_rx_stat).dropped++;
52804 local_irq_restore(flags);
52807 @@ -1537,11 +1533,11 @@
52811 - netdev_rx_stat[smp_processor_id()].total++;
52812 + __get_cpu_var(netdev_rx_stat).total++;
52814 #ifdef CONFIG_NET_FASTROUTE
52815 if (skb->pkt_type == PACKET_FASTROUTE) {
52816 - netdev_rx_stat[smp_processor_id()].fastroute_deferred_out++;
52817 + __get_cpu_var(netdev_rx_stat).fastroute_deferred_out++;
52818 return dev_queue_xmit(skb);
52821 @@ -1657,7 +1653,7 @@
52823 list_del(&backlog_dev->poll_list);
52824 smp_mb__before_clear_bit();
52825 - clear_bit(__LINK_STATE_RX_SCHED, &backlog_dev->state);
52826 + netif_poll_enable(backlog_dev);
52828 if (queue->throttle) {
52829 queue->throttle = 0;
52830 @@ -1672,7 +1668,6 @@
52832 static void net_rx_action(struct softirq_action *h)
52834 - int this_cpu = smp_processor_id();
52835 struct softnet_data *queue = &__get_cpu_var(softnet_data);
52836 unsigned long start_time = jiffies;
52837 int budget = netdev_max_backlog;
52838 @@ -1711,7 +1706,7 @@
52842 - netdev_rx_stat[this_cpu].time_squeeze++;
52843 + __get_cpu_var(netdev_rx_stat).time_squeeze++;
52844 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
52847 @@ -1912,7 +1907,7 @@
52849 while (*pos < NR_CPUS)
52850 if (cpu_online(*pos)) {
52851 - rc = &netdev_rx_stat[*pos];
52852 + rc = &per_cpu(netdev_rx_stat, *pos);
52856 diff -Nru a/net/core/ethtool.c b/net/core/ethtool.c
52857 --- a/net/core/ethtool.c Thu Aug 7 13:16:02 2003
52858 +++ b/net/core/ethtool.c Mon Sep 1 17:25:54 2003
52860 #include <linux/errno.h>
52861 #include <linux/ethtool.h>
52862 #include <linux/netdevice.h>
52863 +#include <asm/uaccess.h>
52866 * Some useful ethtool_ops methods that're device independent.
52868 return (dev->features & NETIF_F_IP_CSUM) != 0;
52871 +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
52874 + dev->features |= NETIF_F_IP_CSUM;
52876 + dev->features &= ~NETIF_F_IP_CSUM;
52881 u32 ethtool_op_get_sg(struct net_device *dev)
52883 return (dev->features & NETIF_F_SG) != 0;
52888 +u32 ethtool_op_get_tso(struct net_device *dev)
52890 + return (dev->features & NETIF_F_TSO) != 0;
52893 +int ethtool_op_set_tso(struct net_device *dev, u32 data)
52896 + dev->features |= NETIF_F_TSO;
52898 + dev->features &= ~NETIF_F_TSO;
52903 /* Handlers for each ethtool command */
52905 static int ethtool_get_settings(struct net_device *dev, void *useraddr)
52906 @@ -454,6 +480,33 @@
52907 return dev->ethtool_ops->set_sg(dev, edata.data);
52910 +static int ethtool_get_tso(struct net_device *dev, char *useraddr)
52912 + struct ethtool_value edata = { ETHTOOL_GTSO };
52914 + if (!dev->ethtool_ops->get_tso)
52915 + return -EOPNOTSUPP;
52917 + edata.data = dev->ethtool_ops->get_tso(dev);
52919 + if (copy_to_user(useraddr, &edata, sizeof(edata)))
52924 +static int ethtool_set_tso(struct net_device *dev, char *useraddr)
52926 + struct ethtool_value edata;
52928 + if (!dev->ethtool_ops->set_tso)
52929 + return -EOPNOTSUPP;
52931 + if (copy_from_user(&edata, useraddr, sizeof(edata)))
52934 + return dev->ethtool_ops->set_tso(dev, edata.data);
52937 static int ethtool_self_test(struct net_device *dev, char *useraddr)
52939 struct ethtool_test test;
52940 @@ -502,15 +555,15 @@
52942 switch (gstrings.string_set) {
52944 - if (ops->self_test_count)
52945 - gstrings.len = ops->self_test_count(dev);
52947 + if (!ops->self_test_count)
52948 return -EOPNOTSUPP;
52949 + gstrings.len = ops->self_test_count(dev);
52952 - if (ops->get_stats_count)
52953 - gstrings.len = ops->get_stats_count(dev);
52955 + if (!ops->get_stats_count)
52956 return -EOPNOTSUPP;
52957 + gstrings.len = ops->get_stats_count(dev);
52962 @@ -653,6 +706,10 @@
52963 return ethtool_get_sg(dev, useraddr);
52965 return ethtool_set_sg(dev, useraddr);
52966 + case ETHTOOL_GTSO:
52967 + return ethtool_get_tso(dev, useraddr);
52968 + case ETHTOOL_STSO:
52969 + return ethtool_set_tso(dev, useraddr);
52971 return ethtool_self_test(dev, useraddr);
52972 case ETHTOOL_GSTRINGS:
52973 diff -Nru a/net/core/netfilter.c b/net/core/netfilter.c
52974 --- a/net/core/netfilter.c Wed Jul 30 16:57:26 2003
52975 +++ b/net/core/netfilter.c Mon Sep 1 01:44:26 2003
52976 @@ -430,7 +430,7 @@
52979 struct nf_info *info;
52980 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
52981 +#ifdef CONFIG_BRIDGE_NETFILTER
52982 struct net_device *physindev = NULL;
52983 struct net_device *physoutdev = NULL;
52985 @@ -467,7 +467,7 @@
52986 if (indev) dev_hold(indev);
52987 if (outdev) dev_hold(outdev);
52989 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
52990 +#ifdef CONFIG_BRIDGE_NETFILTER
52991 if (skb->nf_bridge) {
52992 physindev = skb->nf_bridge->physindev;
52993 if (physindev) dev_hold(physindev);
52994 @@ -483,7 +483,7 @@
52995 /* James M doesn't say fuck enough. */
52996 if (indev) dev_put(indev);
52997 if (outdev) dev_put(outdev);
52998 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
52999 +#ifdef CONFIG_BRIDGE_NETFILTER
53000 if (physindev) dev_put(physindev);
53001 if (physoutdev) dev_put(physoutdev);
53003 @@ -560,7 +560,7 @@
53004 /* Release those devices we held, or Alexey will kill me. */
53005 if (info->indev) dev_put(info->indev);
53006 if (info->outdev) dev_put(info->outdev);
53007 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53008 +#ifdef CONFIG_BRIDGE_NETFILTER
53009 if (skb->nf_bridge) {
53010 if (skb->nf_bridge->physindev)
53011 dev_put(skb->nf_bridge->physindev);
53012 diff -Nru a/net/core/scm.c b/net/core/scm.c
53013 --- a/net/core/scm.c Sun Mar 23 22:06:53 2003
53014 +++ b/net/core/scm.c Sun Aug 24 05:14:27 2003
53017 static __inline__ int scm_check_creds(struct ucred *creds)
53019 - if ((creds->pid == current->pid || capable(CAP_SYS_ADMIN)) &&
53020 + if ((creds->pid == current->tgid || capable(CAP_SYS_ADMIN)) &&
53021 ((creds->uid == current->uid || creds->uid == current->euid ||
53022 creds->uid == current->suid) || capable(CAP_SETUID)) &&
53023 ((creds->gid == current->gid || creds->gid == current->egid ||
53024 diff -Nru a/net/core/skbuff.c b/net/core/skbuff.c
53025 --- a/net/core/skbuff.c Sat Aug 9 02:14:55 2003
53026 +++ b/net/core/skbuff.c Mon Sep 1 01:44:26 2003
53027 @@ -236,7 +236,7 @@
53029 #ifdef CONFIG_NETFILTER
53030 nf_conntrack_put(skb->nfct);
53031 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53032 +#ifdef CONFIG_BRIDGE_NETFILTER
53033 nf_bridge_put(skb->nf_bridge);
53036 @@ -301,7 +301,7 @@
53037 #ifdef CONFIG_NETFILTER_DEBUG
53040 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53041 +#ifdef CONFIG_BRIDGE_NETFILTER
53043 nf_bridge_get(skb->nf_bridge);
53045 @@ -359,7 +359,7 @@
53046 #ifdef CONFIG_NETFILTER_DEBUG
53047 new->nf_debug = old->nf_debug;
53049 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53050 +#ifdef CONFIG_BRIDGE_NETFILTER
53051 new->nf_bridge = old->nf_bridge;
53052 nf_bridge_get(old->nf_bridge);
53054 diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c
53055 --- a/net/econet/af_econet.c Wed Jun 18 13:59:01 2003
53056 +++ b/net/econet/af_econet.c Sat Aug 30 19:12:14 2003
53057 @@ -562,6 +562,7 @@
53059 sock->ops = &econet_ops;
53060 sock_init_data(sock,sk);
53061 + sk_set_owner(sk, THIS_MODULE);
53063 eo = ec_sk(sk) = kmalloc(sizeof(*eo), GFP_KERNEL);
53065 diff -Nru a/net/ipv4/igmp.c b/net/ipv4/igmp.c
53066 --- a/net/ipv4/igmp.c Wed Aug 20 10:42:42 2003
53067 +++ b/net/ipv4/igmp.c Wed Aug 27 23:45:13 2003
53068 @@ -2122,6 +2122,7 @@
53071 read_unlock(&in_dev->lock);
53072 + in_dev_put(in_dev);
53076 @@ -2181,7 +2182,9 @@
53077 if (likely(state->in_dev != NULL)) {
53078 read_unlock(&state->in_dev->lock);
53079 in_dev_put(state->in_dev);
53080 + state->in_dev = NULL;
53082 + state->dev = NULL;
53083 read_unlock(&dev_base_lock);
53086 @@ -2284,6 +2287,7 @@
53087 spin_unlock_bh(&im->lock);
53089 read_unlock_bh(&idev->lock);
53090 + in_dev_put(idev);
53094 @@ -2350,12 +2354,16 @@
53095 static void igmp_mcf_seq_stop(struct seq_file *seq, void *v)
53097 struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
53098 - if (likely(state->im != NULL))
53099 + if (likely(state->im != NULL)) {
53100 spin_unlock_bh(&state->im->lock);
53101 + state->im = NULL;
53103 if (likely(state->idev != NULL)) {
53104 read_unlock_bh(&state->idev->lock);
53105 in_dev_put(state->idev);
53106 + state->idev = NULL;
53108 + state->dev = NULL;
53109 read_unlock(&dev_base_lock);
53112 diff -Nru a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
53113 --- a/net/ipv4/ip_output.c Fri Jul 25 13:42:43 2003
53114 +++ b/net/ipv4/ip_output.c Mon Sep 1 01:44:26 2003
53115 @@ -414,7 +414,7 @@
53116 /* Connection association is same as pre-frag packet */
53117 to->nfct = from->nfct;
53118 nf_conntrack_get(to->nfct);
53119 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53120 +#ifdef CONFIG_BRIDGE_NETFILTER
53121 to->nf_bridge = from->nf_bridge;
53122 nf_bridge_get(to->nf_bridge);
53124 diff -Nru a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
53125 --- a/net/ipv4/ipvs/ip_vs_conn.c Mon Jul 21 02:35:25 2003
53126 +++ b/net/ipv4/ipvs/ip_vs_conn.c Thu Aug 28 01:21:50 2003
53127 @@ -837,7 +837,7 @@
53128 "(size=%d, memory=%ldKbytes)\n",
53129 IP_VS_CONN_TAB_SIZE,
53130 (long)(IP_VS_CONN_TAB_SIZE*sizeof(struct list_head))/1024);
53131 - IP_VS_DBG(0, "Each connection entry needs %d bytes at least\n",
53132 + IP_VS_DBG(0, "Each connection entry needs %Zd bytes at least\n",
53133 sizeof(struct ip_vs_conn));
53135 for (idx = 0; idx < IP_VS_CONN_TAB_SIZE; idx++) {
53136 diff -Nru a/net/ipv4/ipvs/ip_vs_dh.c b/net/ipv4/ipvs/ip_vs_dh.c
53137 --- a/net/ipv4/ipvs/ip_vs_dh.c Sat Jul 12 22:20:28 2003
53138 +++ b/net/ipv4/ipvs/ip_vs_dh.c Thu Aug 28 01:21:50 2003
53139 @@ -147,7 +147,7 @@
53142 svc->sched_data = tbl;
53143 - IP_VS_DBG(6, "DH hash table (memory=%dbytes) allocated for "
53144 + IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for "
53145 "current service\n",
53146 sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE);
53148 @@ -167,7 +167,7 @@
53150 /* release the table itself */
53151 kfree(svc->sched_data);
53152 - IP_VS_DBG(6, "DH hash table (memory=%dbytes) released\n",
53153 + IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) released\n",
53154 sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE);
53157 diff -Nru a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
53158 --- a/net/ipv4/ipvs/ip_vs_lblc.c Sat Jul 12 22:20:28 2003
53159 +++ b/net/ipv4/ipvs/ip_vs_lblc.c Thu Aug 28 01:21:50 2003
53160 @@ -396,7 +396,7 @@
53163 svc->sched_data = tbl;
53164 - IP_VS_DBG(6, "LBLC hash table (memory=%dbytes) allocated for "
53165 + IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for "
53166 "current service\n",
53167 sizeof(struct ip_vs_lblc_table));
53169 @@ -436,7 +436,7 @@
53171 /* release the table itself */
53172 kfree(svc->sched_data);
53173 - IP_VS_DBG(6, "LBLC hash table (memory=%dbytes) released\n",
53174 + IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) released\n",
53175 sizeof(struct ip_vs_lblc_table));
53178 diff -Nru a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
53179 --- a/net/ipv4/ipvs/ip_vs_lblcr.c Sat Jul 12 22:20:28 2003
53180 +++ b/net/ipv4/ipvs/ip_vs_lblcr.c Thu Aug 28 01:21:50 2003
53181 @@ -649,7 +649,7 @@
53184 svc->sched_data = tbl;
53185 - IP_VS_DBG(6, "LBLCR hash table (memory=%dbytes) allocated for "
53186 + IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for "
53187 "current service\n",
53188 sizeof(struct ip_vs_lblcr_table));
53190 @@ -692,7 +692,7 @@
53192 /* release the table itself */
53193 kfree(svc->sched_data);
53194 - IP_VS_DBG(6, "LBLCR hash table (memory=%dbytes) released\n",
53195 + IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) released\n",
53196 sizeof(struct ip_vs_lblcr_table));
53199 diff -Nru a/net/ipv4/ipvs/ip_vs_sh.c b/net/ipv4/ipvs/ip_vs_sh.c
53200 --- a/net/ipv4/ipvs/ip_vs_sh.c Sat Jul 12 22:20:28 2003
53201 +++ b/net/ipv4/ipvs/ip_vs_sh.c Thu Aug 28 01:21:50 2003
53202 @@ -144,7 +144,7 @@
53205 svc->sched_data = tbl;
53206 - IP_VS_DBG(6, "SH hash table (memory=%dbytes) allocated for "
53207 + IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for "
53208 "current service\n",
53209 sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE);
53211 @@ -164,7 +164,7 @@
53213 /* release the table itself */
53214 kfree(svc->sched_data);
53215 - IP_VS_DBG(6, "SH hash table (memory=%dbytes) released\n",
53216 + IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) released\n",
53217 sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE);
53220 diff -Nru a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
53221 --- a/net/ipv4/ipvs/ip_vs_sync.c Sat Jul 12 22:20:28 2003
53222 +++ b/net/ipv4/ipvs/ip_vs_sync.c Thu Aug 28 01:21:50 2003
53223 @@ -851,7 +851,7 @@
53226 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
53227 - IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %d bytes\n",
53228 + IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n",
53229 sizeof(struct ip_vs_sync_conn));
53231 ip_vs_sync_state |= state;
53232 diff -Nru a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
53233 --- a/net/ipv4/netfilter/Kconfig Wed Jun 25 23:28:43 2003
53234 +++ b/net/ipv4/netfilter/Kconfig Mon Sep 1 01:44:26 2003
53236 <file:Documentation/modules.txt>. If unsure, say `Y'.
53239 - tristate "Userspace queueing via NETLINK (EXPERIMENTAL)"
53240 - depends on EXPERIMENTAL
53241 + tristate "Userspace queueing via NETLINK"
53243 Netfilter has the ability to queue packets to user space: the
53244 netlink device can be used to access them using this driver.
53245 @@ -106,6 +105,16 @@
53246 If you want to compile it as a module, say M here and read
53247 <file:Documentation/modules.txt>. If unsure, say `N'.
53249 +config IP_NF_MATCH_IPRANGE
53250 + tristate "IP range match support"
53251 + depends on IP_NF_IPTABLES
53253 + This option makes possible to match IP addresses against IP address
53256 + If you want to compile it as a module, say M here and read
53257 + <file:Documentation/modules.txt>. If unsure, say `N'.
53259 config IP_NF_MATCH_MAC
53260 tristate "MAC address match support"
53261 depends on IP_NF_IPTABLES
53262 @@ -239,7 +248,7 @@
53264 config IP_NF_MATCH_HELPER
53265 tristate "Helper match support"
53266 - depends on IP_NF_CONNTRACK!=n && IP_NF_IPTABLES
53267 + depends on IP_NF_CONNTRACK && IP_NF_IPTABLES
53269 Helper matching allows you to match packets in dynamic connections
53270 tracked by a conntrack-helper, ie. ip_conntrack_ftp
53271 @@ -271,19 +280,9 @@
53272 If you want to compile it as a module, say M here and read
53273 Documentation/modules.txt. If unsure, say `N'.
53275 -config IP_NF_MATCH_UNCLEAN
53276 - tristate "Unclean match support (EXPERIMENTAL)"
53277 - depends on EXPERIMENTAL && IP_NF_IPTABLES
53279 - Unclean packet matching matches any strange or invalid packets, by
53280 - looking at a series of fields in the IP, TCP, UDP and ICMP headers.
53282 - If you want to compile it as a module, say M here and read
53283 - <file:Documentation/modules.txt>. If unsure, say `N'.
53285 config IP_NF_MATCH_OWNER
53286 - tristate "Owner match support (EXPERIMENTAL)"
53287 - depends on EXPERIMENTAL && IP_NF_IPTABLES
53288 + tristate "Owner match support"
53289 + depends on IP_NF_IPTABLES
53291 Packet owner matching allows you to match locally-generated packets
53292 based on who created them: the user, group, process or session.
53293 @@ -293,7 +292,7 @@
53295 config IP_NF_MATCH_PHYSDEV
53296 tristate "Physdev match support"
53297 - depends on IP_NF_IPTABLES!=n && BRIDGE!=n
53298 + depends on IP_NF_IPTABLES!=n && BRIDGE_NETFILTER
53300 Physdev packet matching matches against the physical bridge ports
53301 the IP packet arrived on or will leave by.
53302 @@ -324,16 +323,6 @@
53303 If you want to compile it as a module, say M here and read
53304 <file:Documentation/modules.txt>. If unsure, say `N'.
53306 -config IP_NF_TARGET_MIRROR
53307 - tristate "MIRROR target support (EXPERIMENTAL)"
53308 - depends on EXPERIMENTAL && IP_NF_FILTER
53310 - The MIRROR target allows a filtering rule to specify that an
53311 - incoming packet should be bounced back to the sender.
53313 - If you want to compile it as a module, say M here and read
53314 - <file:Documentation/modules.txt>. If unsure, say `N'.
53317 tristate "Full NAT"
53318 depends on IP_NF_IPTABLES && IP_NF_CONNTRACK
53319 @@ -375,6 +364,28 @@
53320 If you want to compile it as a module, say M here and read
53321 <file:Documentation/modules.txt>. If unsure, say `N'.
53323 +config IP_NF_TARGET_NETMAP
53324 + tristate "NETMAP target support"
53325 + depends on IP_NF_NAT
53327 + NETMAP is an implementation of static 1:1 NAT mapping of network
53328 + addresses. It maps the network address part, while keeping the host
53329 + address part intact. It is similar to Fast NAT, except that
53330 + Netfilter's connection tracking doesn't work well with Fast NAT.
53332 + If you want to compile it as a module, say M here and read
53333 + <file:Documentation/modules.txt>. If unsure, say `N'.
53335 +config IP_NF_TARGET_SAME
53336 + tristate "SAME target support"
53337 + depends on IP_NF_NAT
53339 + This option adds a `SAME' target, which works like the standard SNAT
53340 + target, but attempts to give clients the same IP for all connections.
53342 + If you want to compile it as a module, say M here and read
53343 + Documentation/modules.txt. If unsure, say `N'.
53345 config IP_NF_NAT_LOCAL
53346 bool "NAT of local connections (READ HELP)"
53347 depends on IP_NF_NAT
53348 @@ -490,6 +501,19 @@
53349 the routing method (see `Use netfilter MARK value as routing
53350 key') and can also be used by other subsystems to change their
53353 + If you want to compile it as a module, say M here and read
53354 + <file:Documentation/modules.txt>. If unsure, say `N'.
53356 +config IP_NF_TARGET_CLASSIFY
53357 + tristate "CLASSIFY target support"
53358 + depends on IP_NF_MANGLE
53360 + This option adds a `CLASSIFY' target, which enables the user to set
53361 + the priority of a packet. Some qdiscs can use this value for
53362 + classification, among these are:
53364 + atm, cbq, dsmark, pfifo_fast, htb, prio
53366 If you want to compile it as a module, say M here and read
53367 <file:Documentation/modules.txt>. If unsure, say `N'.
53368 diff -Nru a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile
53369 --- a/net/ipv4/netfilter/Makefile Wed Jun 25 23:28:43 2003
53370 +++ b/net/ipv4/netfilter/Makefile Sun Aug 24 17:25:23 2003
53372 obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o
53373 obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o
53374 obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
53375 +obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
53377 obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o
53378 obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o
53379 @@ -61,20 +62,21 @@
53380 obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o
53381 obj-$(CONFIG_IP_NF_MATCH_STATE) += ipt_state.o
53382 obj-$(CONFIG_IP_NF_MATCH_CONNTRACK) += ipt_conntrack.o
53383 -obj-$(CONFIG_IP_NF_MATCH_UNCLEAN) += ipt_unclean.o
53384 obj-$(CONFIG_IP_NF_MATCH_TCPMSS) += ipt_tcpmss.o
53386 obj-$(CONFIG_IP_NF_MATCH_PHYSDEV) += ipt_physdev.o
53389 obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o
53390 -obj-$(CONFIG_IP_NF_TARGET_MIRROR) += ipt_MIRROR.o
53391 obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
53392 obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
53393 obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o
53394 obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
53395 obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
53396 obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
53397 +obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
53398 +obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o
53399 +obj-$(CONFIG_IP_NF_TARGET_CLASSIFY) += ipt_CLASSIFY.o
53400 obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
53401 obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
53402 obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
53403 diff -Nru a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
53404 --- a/net/ipv4/netfilter/arp_tables.c Sat Aug 2 18:29:28 2003
53405 +++ b/net/ipv4/netfilter/arp_tables.c Sun Aug 24 05:00:28 2003
53408 #include <linux/netfilter_arp/arp_tables.h>
53410 +MODULE_LICENSE("GPL");
53411 +MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
53412 +MODULE_DESCRIPTION("arptables core");
53414 /*#define DEBUG_ARP_TABLES*/
53415 /*#define DEBUG_ARP_TABLES_USER*/
53417 @@ -1324,4 +1328,3 @@
53421 -MODULE_LICENSE("GPL");
53422 diff -Nru a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c
53423 --- a/net/ipv4/netfilter/arpt_mangle.c Wed Jun 25 23:28:48 2003
53424 +++ b/net/ipv4/netfilter/arpt_mangle.c Sun Aug 24 05:00:28 2003
53426 #include <linux/netfilter_arp/arpt_mangle.h>
53427 #include <net/sock.h>
53429 +MODULE_LICENSE("GPL");
53430 +MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
53431 +MODULE_DESCRIPTION("arptables mangle table");
53433 static unsigned int
53434 target(struct sk_buff **pskb, unsigned int hooknum, const struct net_device *in,
53435 const struct net_device *out, const void *targinfo, void *userinfo)
53440 -MODULE_LICENSE("GPL");
53441 diff -Nru a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
53442 --- a/net/ipv4/netfilter/arptable_filter.c Thu Jun 19 12:42:06 2003
53443 +++ b/net/ipv4/netfilter/arptable_filter.c Sun Aug 24 05:00:28 2003
53445 #include <linux/module.h>
53446 #include <linux/netfilter_arp/arp_tables.h>
53448 +MODULE_LICENSE("GPL");
53449 +MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
53450 +MODULE_DESCRIPTION("arptables filter table");
53452 #define FILTER_VALID_HOOKS ((1 << NF_ARP_IN) | (1 << NF_ARP_OUT) | \
53453 (1 << NF_ARP_FORWARD))
53455 @@ -209,4 +213,3 @@
53459 -MODULE_LICENSE("GPL");
53460 diff -Nru a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
53461 --- a/net/ipv4/netfilter/ip_conntrack_core.c Sat Aug 2 18:29:28 2003
53462 +++ b/net/ipv4/netfilter/ip_conntrack_core.c Sat Aug 30 20:35:04 2003
53464 * - export ip_conntrack[_expect]_{find_get,put} functions
53467 -#include <linux/version.h>
53468 #include <linux/config.h>
53469 #include <linux/types.h>
53470 #include <linux/icmp.h>
53471 @@ -285,14 +284,15 @@
53473 clean_from_lists(struct ip_conntrack *ct)
53475 + unsigned int ho, hr;
53477 DEBUGP("clean_from_lists(%p)\n", ct);
53478 MUST_BE_WRITE_LOCKED(&ip_conntrack_lock);
53479 - LIST_DELETE(&ip_conntrack_hash
53480 - [hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple)],
53481 - &ct->tuplehash[IP_CT_DIR_ORIGINAL]);
53482 - LIST_DELETE(&ip_conntrack_hash
53483 - [hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple)],
53484 - &ct->tuplehash[IP_CT_DIR_REPLY]);
53486 + ho = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
53487 + hr = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
53488 + LIST_DELETE(&ip_conntrack_hash[ho], &ct->tuplehash[IP_CT_DIR_ORIGINAL]);
53489 + LIST_DELETE(&ip_conntrack_hash[hr], &ct->tuplehash[IP_CT_DIR_REPLY]);
53491 /* Destroy all un-established, pending expectations */
53492 remove_expectations(ct, 1);
53493 @@ -364,9 +364,10 @@
53494 const struct ip_conntrack *ignored_conntrack)
53496 struct ip_conntrack_tuple_hash *h;
53497 + unsigned int hash = hash_conntrack(tuple);
53499 MUST_BE_READ_LOCKED(&ip_conntrack_lock);
53500 - h = LIST_FIND(&ip_conntrack_hash[hash_conntrack(tuple)],
53501 + h = LIST_FIND(&ip_conntrack_hash[hash],
53502 conntrack_tuple_cmp,
53503 struct ip_conntrack_tuple_hash *,
53504 tuple, ignored_conntrack);
53505 diff -Nru a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
53506 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c Sat Aug 2 18:29:28 2003
53507 +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c Sun Aug 24 05:00:28 2003
53509 #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
53510 #include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
53512 +MODULE_LICENSE("GPL");
53513 +MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
53514 +MODULE_DESCRIPTION("ftp connection tracking helper");
53516 /* This is slow, but it's simple. --RR */
53517 static char ftp_buffer[65536];
53519 @@ -439,6 +443,5 @@
53520 PROVIDES_CONNTRACK(ftp);
53521 EXPORT_SYMBOL(ip_ftp_lock);
53523 -MODULE_LICENSE("GPL");
53526 diff -Nru a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c
53527 --- a/net/ipv4/netfilter/ip_conntrack_irc.c Sat Aug 2 18:29:28 2003
53528 +++ b/net/ipv4/netfilter/ip_conntrack_irc.c Sun Aug 24 05:00:28 2003
53530 /* This is slow, but it's simple. --RR */
53531 static char irc_buffer[65536];
53533 -MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
53534 -MODULE_DESCRIPTION("IRC (DCC) connection tracking module");
53535 +MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
53536 +MODULE_DESCRIPTION("IRC (DCC) connection tracking helper");
53537 MODULE_LICENSE("GPL");
53539 MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
53540 diff -Nru a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
53541 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c Mon Apr 28 02:27:56 2003
53542 +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c Sat Aug 30 20:35:04 2003
53544 #include <linux/module.h>
53545 #include <linux/skbuff.h>
53546 #include <linux/proc_fs.h>
53547 -#include <linux/version.h>
53548 #include <net/checksum.h>
53550 #define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_conntrack_lock)
53551 diff -Nru a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c
53552 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c Sat Aug 2 18:29:28 2003
53553 +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c Sun Aug 24 05:00:28 2003
53555 #include <linux/netfilter_ipv4/ip_conntrack_tftp.h>
53557 MODULE_AUTHOR("Magnus Boden <mb@ozaba.mine.nu>");
53558 -MODULE_DESCRIPTION("Netfilter connection tracking module for tftp");
53559 +MODULE_DESCRIPTION("tftp connection tracking helper");
53560 MODULE_LICENSE("GPL");
53562 #define MAX_PORTS 8
53565 if (skb_copy_bits(skb, skb->nh.iph->ihl * 4 + sizeof(struct udphdr),
53566 &tftph, sizeof(tftph)) != 0)
53568 + return NF_ACCEPT;
53570 switch (ntohs(tftph.opcode)) {
53571 /* RRQ and WRQ works the same way */
53572 diff -Nru a/net/ipv4/netfilter/ip_fw_compat_masq.c b/net/ipv4/netfilter/ip_fw_compat_masq.c
53573 --- a/net/ipv4/netfilter/ip_fw_compat_masq.c Sun May 11 22:12:07 2003
53574 +++ b/net/ipv4/netfilter/ip_fw_compat_masq.c Sat Aug 30 20:35:04 2003
53576 #include <linux/netdevice.h>
53577 #include <linux/inetdevice.h>
53578 #include <linux/proc_fs.h>
53579 -#include <linux/version.h>
53580 #include <linux/module.h>
53581 #include <net/route.h>
53583 diff -Nru a/net/ipv4/netfilter/ip_nat_amanda.c b/net/ipv4/netfilter/ip_nat_amanda.c
53584 --- a/net/ipv4/netfilter/ip_nat_amanda.c Tue Jun 24 15:34:39 2003
53585 +++ b/net/ipv4/netfilter/ip_nat_amanda.c Sun Aug 24 05:00:28 2003
53589 MODULE_AUTHOR("Brian J. Murrell <netfilter@interlinx.bc.ca>");
53590 -MODULE_DESCRIPTION("Amanda network address translation module");
53591 +MODULE_DESCRIPTION("Amanda NAT helper");
53592 MODULE_LICENSE("GPL");
53594 /* protects amanda part of conntracks */
53595 diff -Nru a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
53596 --- a/net/ipv4/netfilter/ip_nat_core.c Sat Aug 2 18:29:28 2003
53597 +++ b/net/ipv4/netfilter/ip_nat_core.c Sat Aug 30 20:35:04 2003
53600 /* (c) 1999 Paul `Rusty' Russell. Licenced under the GNU General
53602 -#include <linux/version.h>
53603 #include <linux/module.h>
53604 #include <linux/types.h>
53605 #include <linux/timer.h>
53607 static void ip_nat_cleanup_conntrack(struct ip_conntrack *conn)
53609 struct ip_nat_info *info = &conn->nat.info;
53610 + unsigned int hs, hp;
53612 if (!info->initialized)
53614 @@ -75,21 +75,18 @@
53615 IP_NF_ASSERT(info->bysource.conntrack);
53616 IP_NF_ASSERT(info->byipsproto.conntrack);
53618 + hs = hash_by_src(&conn->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src,
53619 + conn->tuplehash[IP_CT_DIR_ORIGINAL]
53620 + .tuple.dst.protonum);
53622 + hp = hash_by_ipsproto(conn->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip,
53623 + conn->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip,
53624 + conn->tuplehash[IP_CT_DIR_REPLY]
53625 + .tuple.dst.protonum);
53627 WRITE_LOCK(&ip_nat_lock);
53628 - LIST_DELETE(&bysource[hash_by_src(&conn->tuplehash[IP_CT_DIR_ORIGINAL]
53630 - conn->tuplehash[IP_CT_DIR_ORIGINAL]
53631 - .tuple.dst.protonum)],
53632 - &info->bysource);
53634 - LIST_DELETE(&byipsproto
53635 - [hash_by_ipsproto(conn->tuplehash[IP_CT_DIR_REPLY]
53637 - conn->tuplehash[IP_CT_DIR_REPLY]
53639 - conn->tuplehash[IP_CT_DIR_REPLY]
53640 - .tuple.dst.protonum)],
53641 - &info->byipsproto);
53642 + LIST_DELETE(&bysource[hs], &info->bysource);
53643 + LIST_DELETE(&byipsproto[hp], &info->byipsproto);
53644 WRITE_UNLOCK(&ip_nat_lock);
53647 @@ -246,11 +243,12 @@
53648 const struct ip_conntrack *conntrack)
53650 unsigned int score = 0;
53653 MUST_BE_READ_LOCKED(&ip_nat_lock);
53654 - LIST_FIND(&byipsproto[hash_by_ipsproto(src, dst, protonum)],
53655 - fake_cmp, struct ip_nat_hash *, src, dst, protonum, &score,
53657 + h = hash_by_ipsproto(src, dst, protonum);
53658 + LIST_FIND(&byipsproto[h], fake_cmp, struct ip_nat_hash *,
53659 + src, dst, protonum, &score, conntrack);
53663 diff -Nru a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c
53664 --- a/net/ipv4/netfilter/ip_nat_ftp.c Sat Aug 2 18:29:28 2003
53665 +++ b/net/ipv4/netfilter/ip_nat_ftp.c Sun Aug 24 05:00:28 2003
53667 #include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
53668 #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
53670 +MODULE_LICENSE("GPL");
53671 +MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
53672 +MODULE_DESCRIPTION("ftp NAT helper");
53675 #define DEBUGP printk
53677 @@ -342,4 +346,3 @@
53681 -MODULE_LICENSE("GPL");
53682 diff -Nru a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c
53683 --- a/net/ipv4/netfilter/ip_nat_helper.c Thu Jul 17 14:50:26 2003
53684 +++ b/net/ipv4/netfilter/ip_nat_helper.c Sat Aug 30 20:35:04 2003
53686 * - make ip_nat_resize_packet more generic (TCP and UDP)
53687 * - add ip_nat_mangle_udp_packet
53689 -#include <linux/version.h>
53690 #include <linux/config.h>
53691 #include <linux/module.h>
53692 #include <linux/kmod.h>
53693 diff -Nru a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c
53694 --- a/net/ipv4/netfilter/ip_nat_irc.c Sat Aug 2 18:29:28 2003
53695 +++ b/net/ipv4/netfilter/ip_nat_irc.c Sun Aug 24 05:00:28 2003
53697 static int ports_c;
53699 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
53700 -MODULE_DESCRIPTION("IRC (DCC) network address translation module");
53701 +MODULE_DESCRIPTION("IRC (DCC) NAT helper");
53702 MODULE_LICENSE("GPL");
53704 MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
53705 diff -Nru a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
53706 --- a/net/ipv4/netfilter/ip_nat_rule.c Wed May 21 16:29:38 2003
53707 +++ b/net/ipv4/netfilter/ip_nat_rule.c Sat Aug 30 20:35:04 2003
53709 #include <linux/proc_fs.h>
53710 #include <net/checksum.h>
53711 #include <linux/bitops.h>
53712 -#include <linux/version.h>
53714 #define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock)
53715 #define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock)
53716 diff -Nru a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c
53717 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c Sat Aug 2 18:29:28 2003
53718 +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c Sun Aug 24 05:00:28 2003
53720 #include <asm/uaccess.h>
53721 #include <asm/checksum.h>
53724 +MODULE_LICENSE("GPL");
53725 +MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
53726 +MODULE_DESCRIPTION("Basic SNMP Application Layer Gateway");
53728 #define SNMP_PORT 161
53729 #define SNMP_TRAP_PORT 162
53730 @@ -1357,5 +1359,3 @@
53733 MODULE_PARM(debug, "i");
53734 -MODULE_DESCRIPTION("Basic SNMP Application Layer Gateway");
53735 -MODULE_LICENSE("GPL");
53736 diff -Nru a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
53737 --- a/net/ipv4/netfilter/ip_nat_standalone.c Sat May 17 22:10:44 2003
53738 +++ b/net/ipv4/netfilter/ip_nat_standalone.c Sat Aug 30 20:35:04 2003
53740 #include <linux/proc_fs.h>
53741 #include <net/checksum.h>
53742 #include <linux/spinlock.h>
53743 -#include <linux/version.h>
53745 #define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock)
53746 #define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock)
53747 diff -Nru a/net/ipv4/netfilter/ip_nat_tftp.c b/net/ipv4/netfilter/ip_nat_tftp.c
53748 --- a/net/ipv4/netfilter/ip_nat_tftp.c Tue May 6 01:04:01 2003
53749 +++ b/net/ipv4/netfilter/ip_nat_tftp.c Sun Aug 24 05:00:28 2003
53751 #include <linux/netfilter_ipv4/ip_nat_rule.h>
53753 MODULE_AUTHOR("Magnus Boden <mb@ozaba.mine.nu>");
53754 -MODULE_DESCRIPTION("Netfilter NAT helper for tftp");
53755 +MODULE_DESCRIPTION("tfpt NAT helper");
53756 MODULE_LICENSE("GPL");
53758 #define MAX_PORTS 8
53759 diff -Nru a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
53760 --- a/net/ipv4/netfilter/ip_tables.c Sat Aug 2 18:29:28 2003
53761 +++ b/net/ipv4/netfilter/ip_tables.c Sun Aug 24 05:00:28 2003
53764 #include <linux/netfilter_ipv4/ip_tables.h>
53766 +MODULE_LICENSE("GPL");
53767 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
53768 +MODULE_DESCRIPTION("IPv4 packet filter");
53770 /*#define DEBUG_IP_FIREWALL*/
53771 /*#define DEBUG_ALLOW_ALL*/ /* Useful for remote debugging */
53772 /*#define DEBUG_IP_FIREWALL_USER*/
53773 @@ -1845,4 +1849,3 @@
53777 -MODULE_LICENSE("GPL");
53778 diff -Nru a/net/ipv4/netfilter/ipchains_core.c b/net/ipv4/netfilter/ipchains_core.c
53779 --- a/net/ipv4/netfilter/ipchains_core.c Wed Jun 4 17:57:08 2003
53780 +++ b/net/ipv4/netfilter/ipchains_core.c Sun Aug 24 05:00:28 2003
53781 @@ -100,6 +100,9 @@
53782 #include <linux/proc_fs.h>
53783 #include <linux/stat.h>
53785 +MODULE_LICENSE("Dual BSD/GPL");
53786 +MODULE_DESCRIPTION("ipchains backwards compatibility layer");
53788 /* Understanding locking in this code: (thanks to Alan Cox for using
53789 * little words to explain this to me). -- PR
53791 @@ -1842,4 +1845,3 @@
53795 -MODULE_LICENSE("Dual BSD/GPL");
53796 diff -Nru a/net/ipv4/netfilter/ipfwadm_core.c b/net/ipv4/netfilter/ipfwadm_core.c
53797 --- a/net/ipv4/netfilter/ipfwadm_core.c Wed Jun 4 17:57:08 2003
53798 +++ b/net/ipv4/netfilter/ipfwadm_core.c Sat Aug 30 20:35:04 2003
53799 @@ -131,9 +131,9 @@
53800 #include <net/checksum.h>
53801 #include <linux/proc_fs.h>
53802 #include <linux/stat.h>
53803 -#include <linux/version.h>
53805 MODULE_LICENSE("Dual BSD/GPL");
53806 +MODULE_DESCRIPTION("ipfwadm backwards compatibility layer");
53809 * Implement IP packet firewall
53810 diff -Nru a/net/ipv4/netfilter/ipt_CLASSIFY.c b/net/ipv4/netfilter/ipt_CLASSIFY.c
53811 --- /dev/null Wed Dec 31 16:00:00 1969
53812 +++ b/net/ipv4/netfilter/ipt_CLASSIFY.c Sun Aug 24 19:51:27 2003
53815 + * This is a module which is used for setting the skb->priority field
53816 + * of an skb for qdisc classification.
53819 +#include <linux/module.h>
53820 +#include <linux/skbuff.h>
53821 +#include <linux/ip.h>
53822 +#include <net/checksum.h>
53824 +#include <linux/netfilter_ipv4/ip_tables.h>
53825 +#include <linux/netfilter_ipv4/ipt_CLASSIFY.h>
53827 +MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
53828 +MODULE_LICENSE("GPL");
53829 +MODULE_DESCRIPTION("iptables qdisc classification target module");
53831 +static unsigned int
53832 +target(struct sk_buff **pskb,
53833 + const struct net_device *in,
53834 + const struct net_device *out,
53835 + unsigned int hooknum,
53836 + const void *targinfo,
53839 + const struct ipt_classify_target_info *clinfo = targinfo;
53841 + if((*pskb)->priority != clinfo->priority) {
53842 + (*pskb)->priority = clinfo->priority;
53843 + (*pskb)->nfcache |= NFC_ALTERED;
53846 + return IPT_CONTINUE;
53850 +checkentry(const char *tablename,
53851 + const struct ipt_entry *e,
53853 + unsigned int targinfosize,
53854 + unsigned int hook_mask)
53856 + if (targinfosize != IPT_ALIGN(sizeof(struct ipt_classify_target_info))){
53857 + printk(KERN_ERR "CLASSIFY: invalid size (%u != %Zu).\n",
53859 + IPT_ALIGN(sizeof(struct ipt_classify_target_info)));
53863 + if (hook_mask & ~(1 << NF_IP_POST_ROUTING)) {
53864 + printk(KERN_ERR "CLASSIFY: only valid in POST_ROUTING.\n");
53868 + if (strcmp(tablename, "mangle") != 0) {
53869 + printk(KERN_WARNING "CLASSIFY: can only be called from "
53870 + "\"mangle\" table, not \"%s\".\n",
53878 +static struct ipt_target ipt_classify_reg = {
53879 + .name = "CLASSIFY",
53880 + .target = target,
53881 + .checkentry = checkentry,
53882 + .me = THIS_MODULE,
53885 +static int __init init(void)
53887 + if (ipt_register_target(&ipt_classify_reg))
53893 +static void __exit fini(void)
53895 + ipt_unregister_target(&ipt_classify_reg);
53898 +module_init(init);
53899 +module_exit(fini);
53900 diff -Nru a/net/ipv4/netfilter/ipt_DSCP.c b/net/ipv4/netfilter/ipt_DSCP.c
53901 --- a/net/ipv4/netfilter/ipt_DSCP.c Wed May 21 16:36:54 2003
53902 +++ b/net/ipv4/netfilter/ipt_DSCP.c Sun Aug 24 05:00:28 2003
53904 #include <linux/netfilter_ipv4/ip_tables.h>
53905 #include <linux/netfilter_ipv4/ipt_DSCP.h>
53907 -MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
53908 -MODULE_DESCRIPTION("IP tables DSCP modification module");
53909 +MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
53910 +MODULE_DESCRIPTION("iptables DSCP modification module");
53911 MODULE_LICENSE("GPL");
53913 static unsigned int
53914 diff -Nru a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c
53915 --- a/net/ipv4/netfilter/ipt_ECN.c Wed May 21 16:36:54 2003
53916 +++ b/net/ipv4/netfilter/ipt_ECN.c Sun Aug 24 05:00:28 2003
53918 #include <linux/netfilter_ipv4/ipt_ECN.h>
53920 MODULE_LICENSE("GPL");
53921 +MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
53922 +MODULE_DESCRIPTION("iptables ECN modification module");
53924 /* set ECT codepoint from IP header.
53925 * return 0 if there was an error. */
53926 diff -Nru a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
53927 --- a/net/ipv4/netfilter/ipt_LOG.c Sat Aug 2 22:47:01 2003
53928 +++ b/net/ipv4/netfilter/ipt_LOG.c Mon Sep 1 01:44:26 2003
53930 #include <linux/netfilter_ipv4/ip_tables.h>
53931 #include <linux/netfilter_ipv4/ipt_LOG.h>
53933 +MODULE_LICENSE("GPL");
53934 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
53935 +MODULE_DESCRIPTION("iptables syslog logging module");
53938 #define DEBUGP printk
53940 @@ -329,7 +333,7 @@
53942 in ? in->name : "",
53943 out ? out->name : "");
53944 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
53945 +#ifdef CONFIG_BRIDGE_NETFILTER
53946 if ((*pskb)->nf_bridge) {
53947 struct net_device *physindev = (*pskb)->nf_bridge->physindev;
53948 struct net_device *physoutdev = (*pskb)->nf_bridge->physoutdev;
53949 @@ -413,4 +417,3 @@
53953 -MODULE_LICENSE("GPL");
53954 diff -Nru a/net/ipv4/netfilter/ipt_MARK.c b/net/ipv4/netfilter/ipt_MARK.c
53955 --- a/net/ipv4/netfilter/ipt_MARK.c Wed May 21 16:36:54 2003
53956 +++ b/net/ipv4/netfilter/ipt_MARK.c Sun Aug 24 05:00:28 2003
53958 #include <linux/netfilter_ipv4/ip_tables.h>
53959 #include <linux/netfilter_ipv4/ipt_MARK.h>
53961 +MODULE_LICENSE("GPL");
53962 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
53963 +MODULE_DESCRIPTION("iptables MARK modification module");
53965 static unsigned int
53966 target(struct sk_buff **pskb,
53967 const struct net_device *in,
53972 -MODULE_LICENSE("GPL");
53973 diff -Nru a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
53974 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c Mon Aug 11 22:46:31 2003
53975 +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c Sun Aug 24 05:00:28 2003
53977 #include <linux/netfilter_ipv4/ip_nat_rule.h>
53978 #include <linux/netfilter_ipv4/ip_tables.h>
53980 +MODULE_LICENSE("GPL");
53981 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
53982 +MODULE_DESCRIPTION("iptables MASQUERADE target module");
53985 #define DEBUGP printk
53987 @@ -213,4 +217,3 @@
53991 -MODULE_LICENSE("GPL");
53992 diff -Nru a/net/ipv4/netfilter/ipt_MIRROR.c b/net/ipv4/netfilter/ipt_MIRROR.c
53993 --- a/net/ipv4/netfilter/ipt_MIRROR.c Fri Jul 25 15:22:30 2003
53994 +++ /dev/null Wed Dec 31 16:00:00 1969
53997 - This is a module which is used for resending packets with inverted src and dst.
53999 - Based on code from: ip_nat_dumb.c,v 1.9 1999/08/20
54000 - and various sources.
54002 - Copyright (C) 2000 Emmanuel Roger <winfield@freegates.be>
54005 - 25 Aug 2001 Harald Welte <laforge@gnumonks.org>
54006 - - decrement and check TTL if not called from FORWARD hook
54007 - 18 Jul 2003 Harald Welte <laforge@netfilter.org>
54008 - - merge Patrick McHardy's mirror fixes from 2.4.22 to
54010 - 19 Jul 2003 Harald Welte <laforge@netfilter.org>
54011 - - merge Patrick McHardy's rp_filter fixes from 2.4.22 to
54014 - This program is free software; you can redistribute it and/or modify it
54015 - under the terms of the GNU General Public License as published by the
54016 - Free Software Foundation; either version 2 of the License, or (at your
54017 - option) any later version.
54019 - This program is distributed in the hope that it will be useful, but
54020 - WITHOUT ANY WARRANTY; without even the implied warranty of
54021 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
54022 - General Public License for more details.
54024 - You should have received a copy of the GNU General Public License
54025 - along with this program; if not, write to the Free Software Foundation,
54026 - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
54028 -#include <linux/module.h>
54029 -#include <linux/skbuff.h>
54030 -#include <linux/ip.h>
54031 -#include <net/ip.h>
54032 -#include <net/icmp.h>
54033 -#include <linux/netfilter_ipv4/ip_tables.h>
54034 -#include <linux/netdevice.h>
54035 -#include <linux/route.h>
54036 -#include <net/route.h>
54039 -#define DEBUGP printk
54041 -#define DEBUGP(format, args...)
54044 -static inline struct rtable *route_mirror(struct sk_buff *skb, int local)
54046 - struct iphdr *iph = skb->nh.iph;
54047 - struct dst_entry *odst;
54048 - struct flowi fl = {};
54049 - struct rtable *rt;
54052 - fl.nl_u.ip4_u.daddr = iph->saddr;
54053 - fl.nl_u.ip4_u.saddr = iph->daddr;
54054 - fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);
54056 - if (ip_route_output_key(&rt, &fl) != 0)
54059 - /* non-local src, find valid iif to satisfy
54060 - * rp-filter when calling ip_route_input(). */
54061 - fl.nl_u.ip4_u.daddr = iph->daddr;
54062 - if (ip_route_output_key(&rt, &fl) != 0)
54066 - if (ip_route_input(skb, iph->saddr, iph->daddr,
54067 - RT_TOS(iph->tos), rt->u.dst.dev) != 0) {
54068 - dst_release(&rt->u.dst);
54071 - dst_release(&rt->u.dst);
54072 - rt = (struct rtable *)skb->dst;
54076 - if (rt->u.dst.error) {
54077 - dst_release(&rt->u.dst);
54084 -static inline void ip_rewrite(struct sk_buff *skb)
54086 - u32 odaddr, osaddr;
54088 - odaddr = skb->nh.iph->saddr;
54089 - osaddr = skb->nh.iph->daddr;
54091 - skb->nfcache |= NFC_ALTERED;
54093 - /* Rewrite IP header */
54094 - skb->nh.iph->daddr = odaddr;
54095 - skb->nh.iph->saddr = osaddr;
54098 -/* Stolen from ip_finish_output2 */
54099 -static void ip_direct_send(struct sk_buff *skb)
54101 - struct dst_entry *dst = skb->dst;
54102 - struct hh_cache *hh = dst->hh;
54107 - read_lock_bh(&hh->hh_lock);
54108 - hh_alen = HH_DATA_ALIGN(hh->hh_len);
54109 - memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
54110 - read_unlock_bh(&hh->hh_lock);
54111 - skb_push(skb, hh->hh_len);
54112 - hh->hh_output(skb);
54113 - } else if (dst->neighbour)
54114 - dst->neighbour->output(skb);
54116 - printk(KERN_DEBUG "khm in MIRROR\n");
54121 -static unsigned int ipt_mirror_target(struct sk_buff **pskb,
54122 - const struct net_device *in,
54123 - const struct net_device *out,
54124 - unsigned int hooknum,
54125 - const void *targinfo,
54128 - struct rtable *rt;
54129 - struct sk_buff *nskb;
54130 - unsigned int hh_len;
54132 - /* Make skb writable */
54133 - if (!skb_ip_make_writable(pskb, sizeof(struct iphdr)))
54136 - /* If we are not at FORWARD hook (INPUT/PREROUTING),
54137 - * the TTL isn't decreased by the IP stack */
54138 - if (hooknum != NF_IP_FORWARD) {
54139 - if ((*pskb)->nh.iph->ttl <= 1) {
54140 - /* this will traverse normal stack, and
54141 - * thus call conntrack on the icmp packet */
54142 - icmp_send(*pskb, ICMP_TIME_EXCEEDED,
54143 - ICMP_EXC_TTL, 0);
54146 - ip_decrease_ttl((*pskb)->nh.iph);
54149 - if ((rt = route_mirror(*pskb, hooknum == NF_IP_LOCAL_IN)) == NULL)
54152 - hh_len = (rt->u.dst.dev->hard_header_len + 15) & ~15;
54154 - /* Copy skb (even if skb is about to be dropped, we can't just
54155 - * clone it because there may be other things, such as tcpdump,
54156 - * interested in it). We also need to expand headroom in case
54157 - * hh_len of incoming interface < hh_len of outgoing interface */
54158 - nskb = skb_copy_expand(*pskb, hh_len, skb_tailroom(*pskb), GFP_ATOMIC);
54159 - if (nskb == NULL) {
54160 - dst_release(&rt->u.dst);
54164 - dst_release(nskb->dst);
54165 - nskb->dst = &rt->u.dst;
54167 - ip_rewrite(nskb);
54168 - /* Don't let conntrack code see this packet:
54169 - * it will think we are starting a new
54170 - * connection! --RR */
54171 - ip_direct_send(nskb);
54176 -static int ipt_mirror_checkentry(const char *tablename,
54177 - const struct ipt_entry *e,
54179 - unsigned int targinfosize,
54180 - unsigned int hook_mask)
54182 - /* Only on INPUT, FORWARD or PRE_ROUTING, otherwise loop danger. */
54183 - if (hook_mask & ~((1 << NF_IP_PRE_ROUTING)
54184 - | (1 << NF_IP_FORWARD)
54185 - | (1 << NF_IP_LOCAL_IN))) {
54186 - DEBUGP("MIRROR: bad hook\n");
54190 - if (targinfosize != IPT_ALIGN(0)) {
54191 - DEBUGP("MIRROR: targinfosize %u != 0\n", targinfosize);
54198 -static struct ipt_target ipt_mirror_reg = {
54199 - .name = "MIRROR",
54200 - .target = ipt_mirror_target,
54201 - .checkentry = ipt_mirror_checkentry,
54202 - .me = THIS_MODULE,
54205 -static int __init init(void)
54207 - return ipt_register_target(&ipt_mirror_reg);
54210 -static void __exit fini(void)
54212 - ipt_unregister_target(&ipt_mirror_reg);
54215 -module_init(init);
54216 -module_exit(fini);
54217 -MODULE_LICENSE("GPL");
54218 diff -Nru a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c
54219 --- /dev/null Wed Dec 31 16:00:00 1969
54220 +++ b/net/ipv4/netfilter/ipt_NETMAP.c Sun Aug 24 17:25:18 2003
54222 +/* NETMAP - static NAT mapping of IP network addresses (1:1).
54223 + The mapping can be applied to source (POSTROUTING),
54224 + destination (PREROUTING), or both (with separate rules).
54226 + Author: Svenning Soerensen <svenning@post5.tele.dk>
54229 +#include <linux/config.h>
54230 +#include <linux/ip.h>
54231 +#include <linux/module.h>
54232 +#include <linux/netdevice.h>
54233 +#include <linux/netfilter.h>
54234 +#include <linux/netfilter_ipv4.h>
54235 +#include <linux/netfilter_ipv4/ip_nat_rule.h>
54237 +#define MODULENAME "NETMAP"
54238 +MODULE_LICENSE("GPL");
54239 +MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>");
54240 +MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target");
54243 +#define DEBUGP printk
54245 +#define DEBUGP(format, args...)
54249 +check(const char *tablename,
54250 + const struct ipt_entry *e,
54252 + unsigned int targinfosize,
54253 + unsigned int hook_mask)
54255 + const struct ip_nat_multi_range *mr = targinfo;
54257 + if (strcmp(tablename, "nat") != 0) {
54258 + DEBUGP(MODULENAME":check: bad table `%s'.\n", tablename);
54261 + if (targinfosize != IPT_ALIGN(sizeof(*mr))) {
54262 + DEBUGP(MODULENAME":check: size %u.\n", targinfosize);
54265 + if (hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING))) {
54266 + DEBUGP(MODULENAME":check: bad hooks %x.\n", hook_mask);
54269 + if (!(mr->range[0].flags & IP_NAT_RANGE_MAP_IPS)) {
54270 + DEBUGP(MODULENAME":check: bad MAP_IPS.\n");
54273 + if (mr->rangesize != 1) {
54274 + DEBUGP(MODULENAME":check: bad rangesize %u.\n", mr->rangesize);
54280 +static unsigned int
54281 +target(struct sk_buff **pskb,
54282 + const struct net_device *in,
54283 + const struct net_device *out,
54284 + unsigned int hooknum,
54285 + const void *targinfo,
54288 + struct ip_conntrack *ct;
54289 + enum ip_conntrack_info ctinfo;
54290 + u_int32_t new_ip, netmask;
54291 + const struct ip_nat_multi_range *mr = targinfo;
54292 + struct ip_nat_multi_range newrange;
54294 + IP_NF_ASSERT(hooknum == NF_IP_PRE_ROUTING
54295 + || hooknum == NF_IP_POST_ROUTING);
54296 + ct = ip_conntrack_get(*pskb, &ctinfo);
54298 + netmask = ~(mr->range[0].min_ip ^ mr->range[0].max_ip);
54300 + if (hooknum == NF_IP_PRE_ROUTING)
54301 + new_ip = (*pskb)->nh.iph->daddr & ~netmask;
54303 + new_ip = (*pskb)->nh.iph->saddr & ~netmask;
54304 + new_ip |= mr->range[0].min_ip & netmask;
54306 + newrange = ((struct ip_nat_multi_range)
54307 + { 1, { { mr->range[0].flags | IP_NAT_RANGE_MAP_IPS,
54309 + mr->range[0].min, mr->range[0].max } } });
54311 + /* Hand modified range to generic setup. */
54312 + return ip_nat_setup_info(ct, &newrange, hooknum);
54315 +static struct ipt_target target_module = {
54316 + .name = MODULENAME,
54317 + .target = target,
54318 + .checkentry = check,
54319 + .me = THIS_MODULE
54322 +static int __init init(void)
54324 + return ipt_register_target(&target_module);
54327 +static void __exit fini(void)
54329 + ipt_unregister_target(&target_module);
54332 +module_init(init);
54333 +module_exit(fini);
54334 diff -Nru a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c
54335 --- a/net/ipv4/netfilter/ipt_REDIRECT.c Wed May 21 16:36:54 2003
54336 +++ b/net/ipv4/netfilter/ipt_REDIRECT.c Sun Aug 24 05:00:28 2003
54338 #include <linux/netfilter_ipv4.h>
54339 #include <linux/netfilter_ipv4/ip_nat_rule.h>
54341 +MODULE_LICENSE("GPL");
54342 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
54343 +MODULE_DESCRIPTION("iptables REDIRECT target module");
54346 #define DEBUGP printk
54348 @@ -115,4 +119,3 @@
54352 -MODULE_LICENSE("GPL");
54353 diff -Nru a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
54354 --- a/net/ipv4/netfilter/ipt_REJECT.c Sun Jul 27 16:03:33 2003
54355 +++ b/net/ipv4/netfilter/ipt_REJECT.c Sun Aug 24 05:00:28 2003
54357 #include <linux/netfilter_ipv4/ip_tables.h>
54358 #include <linux/netfilter_ipv4/ipt_REJECT.h>
54360 +MODULE_LICENSE("GPL");
54361 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
54362 +MODULE_DESCRIPTION("iptables REJECT target module");
54365 #define DEBUGP printk
54367 @@ -137,6 +141,10 @@
54368 nskb->nf_debug = 0;
54371 +#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
54372 + nf_bridge_put(nskb->nf_bridge);
54373 + nskb->nf_bridge = NULL;
54376 tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
54378 @@ -462,4 +470,3 @@
54382 -MODULE_LICENSE("GPL");
54383 diff -Nru a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c
54384 --- /dev/null Wed Dec 31 16:00:00 1969
54385 +++ b/net/ipv4/netfilter/ipt_SAME.c Sun Aug 24 17:25:18 2003
54387 +/* Same. Just like SNAT, only try to make the connections
54388 + * between client A and server B always have the same source ip.
54390 + * (C) 2000 Rusty Russell. GPL.
54392 + * 010320 Martin Josefsson <gandalf@wlug.westbo.se>
54393 + * * copied ipt_BALANCE.c to ipt_SAME.c and changed a few things.
54394 + * 010728 Martin Josefsson <gandalf@wlug.westbo.se>
54395 + * * added --nodst to not include destination-ip in new source
54397 + * * added some more sanity-checks.
54398 + * 010729 Martin Josefsson <gandalf@wlug.westbo.se>
54399 + * * fixed a buggy if-statement in same_check(), should have
54400 + * used ntohl() but didn't.
54401 + * * added support for multiple ranges. IPT_SAME_MAX_RANGE is
54402 + * defined in linux/include/linux/netfilter_ipv4/ipt_SAME.h
54403 + * and is currently set to 10.
54404 + * * added support for 1-address range, nice to have now that
54405 + * we have multiple ranges.
54407 +#include <linux/types.h>
54408 +#include <linux/ip.h>
54409 +#include <linux/timer.h>
54410 +#include <linux/module.h>
54411 +#include <linux/netfilter.h>
54412 +#include <linux/netdevice.h>
54413 +#include <linux/if.h>
54414 +#include <linux/inetdevice.h>
54415 +#include <net/protocol.h>
54416 +#include <net/checksum.h>
54417 +#include <linux/netfilter_ipv4.h>
54418 +#include <linux/netfilter_ipv4/ip_nat_rule.h>
54419 +#include <linux/netfilter_ipv4/ipt_SAME.h>
54421 +MODULE_LICENSE("GPL");
54422 +MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>");
54423 +MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip");
54426 +#define DEBUGP printk
54428 +#define DEBUGP(format, args...)
54432 +same_check(const char *tablename,
54433 + const struct ipt_entry *e,
54435 + unsigned int targinfosize,
54436 + unsigned int hook_mask)
54438 + unsigned int count, countess, rangeip, index = 0;
54439 + struct ipt_same_info *mr = targinfo;
54443 + if (strcmp(tablename, "nat") != 0) {
54444 + DEBUGP("same_check: bad table `%s'.\n", tablename);
54447 + if (targinfosize != IPT_ALIGN(sizeof(*mr))) {
54448 + DEBUGP("same_check: size %u.\n", targinfosize);
54451 + if (hook_mask & ~(1 << NF_IP_PRE_ROUTING | 1 << NF_IP_POST_ROUTING)) {
54452 + DEBUGP("same_check: bad hooks %x.\n", hook_mask);
54455 + if (mr->rangesize < 1) {
54456 + DEBUGP("same_check: need at least one dest range.\n");
54459 + if (mr->rangesize > IPT_SAME_MAX_RANGE) {
54460 + DEBUGP("same_check: too many ranges specified, maximum "
54461 + "is %u ranges\n",
54462 + IPT_SAME_MAX_RANGE);
54465 + for (count = 0; count < mr->rangesize; count++) {
54466 + if (ntohl(mr->range[count].min_ip) >
54467 + ntohl(mr->range[count].max_ip)) {
54468 + DEBUGP("same_check: min_ip is larger than max_ip in "
54469 + "range `%u.%u.%u.%u-%u.%u.%u.%u'.\n",
54470 + NIPQUAD(mr->range[count].min_ip),
54471 + NIPQUAD(mr->range[count].max_ip));
54474 + if (!(mr->range[count].flags & IP_NAT_RANGE_MAP_IPS)) {
54475 + DEBUGP("same_check: bad MAP_IPS.\n");
54478 + rangeip = (ntohl(mr->range[count].max_ip) -
54479 + ntohl(mr->range[count].min_ip) + 1);
54480 + mr->ipnum += rangeip;
54482 + DEBUGP("same_check: range %u, ipnum = %u\n", count, rangeip);
54484 + DEBUGP("same_check: total ipaddresses = %u\n", mr->ipnum);
54486 + mr->iparray = kmalloc((sizeof(u_int32_t) * mr->ipnum), GFP_KERNEL);
54487 + if (!mr->iparray) {
54488 + DEBUGP("same_check: Couldn't allocate %u bytes "
54489 + "for %u ipaddresses!\n",
54490 + (sizeof(u_int32_t) * mr->ipnum), mr->ipnum);
54493 + DEBUGP("same_check: Allocated %u bytes for %u ipaddresses.\n",
54494 + (sizeof(u_int32_t) * mr->ipnum), mr->ipnum);
54496 + for (count = 0; count < mr->rangesize; count++) {
54497 + for (countess = ntohl(mr->range[count].min_ip);
54498 + countess <= ntohl(mr->range[count].max_ip);
54500 + mr->iparray[index] = countess;
54501 + DEBUGP("same_check: Added ipaddress `%u.%u.%u.%u' "
54502 + "in index %u.\n",
54503 + HIPQUAD(countess), index);
54511 +same_destroy(void *targinfo,
54512 + unsigned int targinfosize)
54514 + struct ipt_same_info *mr = targinfo;
54516 + kfree(mr->iparray);
54518 + DEBUGP("same_destroy: Deallocated %u bytes for %u ipaddresses.\n",
54519 + (sizeof(u_int32_t) * mr->ipnum), mr->ipnum);
54522 +static unsigned int
54523 +same_target(struct sk_buff **pskb,
54524 + const struct net_device *in,
54525 + const struct net_device *out,
54526 + unsigned int hooknum,
54527 + const void *targinfo,
54530 + struct ip_conntrack *ct;
54531 + enum ip_conntrack_info ctinfo;
54532 + u_int32_t tmpip, aindex, new_ip;
54533 + const struct ipt_same_info *mr = targinfo;
54534 + struct ip_nat_multi_range newrange;
54535 + const struct ip_conntrack_tuple *t;
54537 + IP_NF_ASSERT(hooknum == NF_IP_PRE_ROUTING ||
54538 + hooknum == NF_IP_POST_ROUTING);
54539 + ct = ip_conntrack_get(*pskb, &ctinfo);
54541 + t = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
54543 + /* Base new source on real src ip and optionally dst ip,
54544 + giving some hope for consistency across reboots.
54545 + Here we calculate the index in mr->iparray which
54546 + holds the ipaddress we should use */
54548 + tmpip = ntohl(t->src.ip);
54550 + if (!(mr->info & IPT_SAME_NODST))
54551 + tmpip += ntohl(t->dst.ip);
54553 + aindex = tmpip % mr->ipnum;
54555 + new_ip = htonl(mr->iparray[aindex]);
54557 + DEBUGP("ipt_SAME: src=%u.%u.%u.%u dst=%u.%u.%u.%u, "
54558 + "new src=%u.%u.%u.%u\n",
54559 + NIPQUAD(t->src.ip), NIPQUAD(t->dst.ip),
54560 + NIPQUAD(new_ip));
54562 + /* Transfer from original range. */
54563 + newrange = ((struct ip_nat_multi_range)
54564 + { 1, { { mr->range[0].flags | IP_NAT_RANGE_MAP_IPS,
54566 + mr->range[0].min, mr->range[0].max } } });
54568 + /* Hand modified range to generic setup. */
54569 + return ip_nat_setup_info(ct, &newrange, hooknum);
54572 +static struct ipt_target same_reg = {
54574 + .target = same_target,
54575 + .checkentry = same_check,
54576 + .destroy = same_destroy,
54577 + .me = THIS_MODULE,
54580 +static int __init init(void)
54582 + return ipt_register_target(&same_reg);
54585 +static void __exit fini(void)
54587 + ipt_unregister_target(&same_reg);
54590 +module_init(init);
54591 +module_exit(fini);
54593 diff -Nru a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c
54594 --- a/net/ipv4/netfilter/ipt_TCPMSS.c Wed May 21 16:36:54 2003
54595 +++ b/net/ipv4/netfilter/ipt_TCPMSS.c Sun Aug 24 05:00:28 2003
54597 #include <linux/netfilter_ipv4/ip_tables.h>
54598 #include <linux/netfilter_ipv4/ipt_TCPMSS.h>
54600 +MODULE_LICENSE("GPL");
54601 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
54602 +MODULE_DESCRIPTION("iptables TCP MSS modification module");
54605 #define DEBUGP printk
54607 @@ -250,4 +254,3 @@
54611 -MODULE_LICENSE("GPL");
54612 diff -Nru a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
54613 --- a/net/ipv4/netfilter/ipt_TOS.c Wed May 21 16:36:54 2003
54614 +++ b/net/ipv4/netfilter/ipt_TOS.c Sun Aug 24 05:00:28 2003
54616 #include <linux/netfilter_ipv4/ip_tables.h>
54617 #include <linux/netfilter_ipv4/ipt_TOS.h>
54619 +MODULE_LICENSE("GPL");
54620 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
54621 +MODULE_DESCRIPTION("iptables TOS mangling module");
54623 static unsigned int
54624 target(struct sk_buff **pskb,
54625 const struct net_device *in,
54630 -MODULE_LICENSE("GPL");
54631 diff -Nru a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
54632 --- a/net/ipv4/netfilter/ipt_ULOG.c Tue Jun 24 15:36:11 2003
54633 +++ b/net/ipv4/netfilter/ipt_ULOG.c Sat Aug 30 20:35:04 2003
54637 #include <linux/module.h>
54638 -#include <linux/version.h>
54639 #include <linux/config.h>
54640 #include <linux/spinlock.h>
54641 #include <linux/socket.h>
54644 MODULE_LICENSE("GPL");
54645 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
54646 -MODULE_DESCRIPTION("IP tables userspace logging module");
54647 +MODULE_DESCRIPTION("iptables userspace logging module");
54649 #define ULOG_NL_EVENT 111 /* Harald's favorite number */
54650 #define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */
54651 diff -Nru a/net/ipv4/netfilter/ipt_ah.c b/net/ipv4/netfilter/ipt_ah.c
54652 --- a/net/ipv4/netfilter/ipt_ah.c Sat Aug 2 22:49:54 2003
54653 +++ b/net/ipv4/netfilter/ipt_ah.c Sun Aug 24 05:00:28 2003
54655 #include <linux/netfilter_ipv4/ip_tables.h>
54657 MODULE_LICENSE("GPL");
54658 +MODULE_AUTHOR("Yon Uriarte <yon@astaro.de>");
54659 +MODULE_DESCRIPTION("iptables AH SPI match module");
54661 #ifdef DEBUG_CONNTRACK
54662 #define duprintf(format, args...) printk(format , ## args)
54663 diff -Nru a/net/ipv4/netfilter/ipt_conntrack.c b/net/ipv4/netfilter/ipt_conntrack.c
54664 --- a/net/ipv4/netfilter/ipt_conntrack.c Wed May 21 16:35:36 2003
54665 +++ b/net/ipv4/netfilter/ipt_conntrack.c Sun Aug 24 05:00:28 2003
54667 #include <linux/netfilter_ipv4/ip_tables.h>
54668 #include <linux/netfilter_ipv4/ipt_conntrack.h>
54670 +MODULE_LICENSE("GPL");
54671 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
54672 +MODULE_DESCRIPTION("iptables connection tracking match module");
54675 match(const struct sk_buff *skb,
54676 const struct net_device *in,
54677 @@ -122,4 +126,3 @@
54681 -MODULE_LICENSE("GPL");
54682 diff -Nru a/net/ipv4/netfilter/ipt_dscp.c b/net/ipv4/netfilter/ipt_dscp.c
54683 --- a/net/ipv4/netfilter/ipt_dscp.c Wed May 21 16:35:36 2003
54684 +++ b/net/ipv4/netfilter/ipt_dscp.c Sun Aug 24 05:00:28 2003
54686 #include <linux/netfilter_ipv4/ipt_dscp.h>
54687 #include <linux/netfilter_ipv4/ip_tables.h>
54689 -MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
54690 -MODULE_DESCRIPTION("IP tables DSCP matching module");
54691 +MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
54692 +MODULE_DESCRIPTION("iptables DSCP matching module");
54693 MODULE_LICENSE("GPL");
54695 static int match(const struct sk_buff *skb, const struct net_device *in,
54696 diff -Nru a/net/ipv4/netfilter/ipt_ecn.c b/net/ipv4/netfilter/ipt_ecn.c
54697 --- a/net/ipv4/netfilter/ipt_ecn.c Wed May 21 16:35:36 2003
54698 +++ b/net/ipv4/netfilter/ipt_ecn.c Sun Aug 24 05:00:28 2003
54700 #include <linux/netfilter_ipv4/ip_tables.h>
54701 #include <linux/netfilter_ipv4/ipt_ecn.h>
54703 -MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
54704 -MODULE_DESCRIPTION("IP tables ECN matching module");
54705 +MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
54706 +MODULE_DESCRIPTION("iptables ECN matching module");
54707 MODULE_LICENSE("GPL");
54709 static inline int match_ip(const struct sk_buff *skb,
54710 diff -Nru a/net/ipv4/netfilter/ipt_esp.c b/net/ipv4/netfilter/ipt_esp.c
54711 --- a/net/ipv4/netfilter/ipt_esp.c Sat Aug 2 22:51:04 2003
54712 +++ b/net/ipv4/netfilter/ipt_esp.c Sun Aug 24 05:00:28 2003
54714 #include <linux/netfilter_ipv4/ip_tables.h>
54716 MODULE_LICENSE("GPL");
54717 +MODULE_AUTHOR("Yon Uriarte <yon@astaro.de>");
54718 +MODULE_DESCRIPTION("iptables ESP SPI match module");
54720 #ifdef DEBUG_CONNTRACK
54721 #define duprintf(format, args...) printk(format , ## args)
54722 diff -Nru a/net/ipv4/netfilter/ipt_helper.c b/net/ipv4/netfilter/ipt_helper.c
54723 --- a/net/ipv4/netfilter/ipt_helper.c Fri Aug 1 03:02:18 2003
54724 +++ b/net/ipv4/netfilter/ipt_helper.c Sun Aug 24 05:00:28 2003
54726 #include <linux/netfilter_ipv4/ipt_helper.h>
54728 MODULE_LICENSE("GPL");
54729 +MODULE_AUTHOR("Martin Josefsson <gandalf@netfilter.org>");
54730 +MODULE_DESCRIPTION("iptables helper match module");
54733 #define DEBUGP printk
54734 diff -Nru a/net/ipv4/netfilter/ipt_iprange.c b/net/ipv4/netfilter/ipt_iprange.c
54735 --- /dev/null Wed Dec 31 16:00:00 1969
54736 +++ b/net/ipv4/netfilter/ipt_iprange.c Sun Aug 24 17:25:18 2003
54739 + * iptables module to match IP address ranges
54740 + * (c) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
54742 + * Released under the terms of GNU GPLv2.
54745 +#include <linux/module.h>
54746 +#include <linux/skbuff.h>
54747 +#include <linux/ip.h>
54748 +#include <linux/netfilter_ipv4/ip_tables.h>
54749 +#include <linux/netfilter_ipv4/ipt_iprange.h>
54751 +MODULE_LICENSE("GPL");
54752 +MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
54753 +MODULE_DESCRIPTION("iptables arbitrary IP range match module");
54756 +#define DEBUGP printk
54758 +#define DEBUGP(format, args...)
54762 +match(const struct sk_buff *skb,
54763 + const struct net_device *in,
54764 + const struct net_device *out,
54765 + const void *matchinfo,
54766 + int offset, int *hotdrop)
54768 + const struct ipt_iprange_info *info = matchinfo;
54769 + const struct iphdr *iph = skb->nh.iph;
54771 + if (info->flags & IPRANGE_SRC) {
54772 + if (((ntohl(iph->saddr) < ntohl(info->src.min_ip))
54773 + || (ntohl(iph->saddr) > ntohl(info->src.max_ip)))
54774 + ^ !!(info->flags & IPRANGE_SRC_INV)) {
54775 + DEBUGP("src IP %u.%u.%u.%u NOT in range %s"
54776 + "%u.%u.%u.%u-%u.%u.%u.%u\n",
54777 + NIPQUAD(iph->saddr),
54778 + info->flags & IPRANGE_SRC_INV ? "(INV) " : "",
54779 + NIPQUAD(info->src.min_ip),
54780 + NIPQUAD(info->src.max_ip));
54784 + if (info->flags & IPRANGE_DST) {
54785 + if (((ntohl(iph->daddr) < ntohl(info->dst.min_ip))
54786 + || (ntohl(iph->daddr) > ntohl(info->dst.max_ip)))
54787 + ^ !!(info->flags & IPRANGE_DST_INV)) {
54788 + DEBUGP("dst IP %u.%u.%u.%u NOT in range %s"
54789 + "%u.%u.%u.%u-%u.%u.%u.%u\n",
54790 + NIPQUAD(iph->daddr),
54791 + info->flags & IPRANGE_DST_INV ? "(INV) " : "",
54792 + NIPQUAD(info->dst.min_ip),
54793 + NIPQUAD(info->dst.max_ip));
54800 +static int check(const char *tablename,
54801 + const struct ipt_ip *ip,
54803 + unsigned int matchsize,
54804 + unsigned int hook_mask)
54806 + /* verify size */
54807 + if (matchsize != IPT_ALIGN(sizeof(struct ipt_iprange_info)))
54813 +static struct ipt_match iprange_match =
54815 + .list = { NULL, NULL },
54816 + .name = "iprange",
54818 + .checkentry = &check,
54820 + .me = THIS_MODULE
54823 +static int __init init(void)
54825 + return ipt_register_match(&iprange_match);
54828 +static void __exit fini(void)
54830 + ipt_unregister_match(&iprange_match);
54833 +module_init(init);
54834 +module_exit(fini);
54835 diff -Nru a/net/ipv4/netfilter/ipt_limit.c b/net/ipv4/netfilter/ipt_limit.c
54836 --- a/net/ipv4/netfilter/ipt_limit.c Wed May 21 16:35:36 2003
54837 +++ b/net/ipv4/netfilter/ipt_limit.c Sun Aug 24 05:00:28 2003
54839 #include <linux/netfilter_ipv4/ip_tables.h>
54840 #include <linux/netfilter_ipv4/ipt_limit.h>
54842 +MODULE_LICENSE("GPL");
54843 +MODULE_AUTHOR("Herve Eychenne <rv@wallfire.org>");
54844 +MODULE_DESCRIPTION("iptables rate limit match");
54846 /* The algorithm used is the Simple Token Bucket Filter (TBF)
54847 * see net/sched/sch_tbf.c in the linux source tree
54849 @@ -134,4 +138,3 @@
54853 -MODULE_LICENSE("GPL");
54854 diff -Nru a/net/ipv4/netfilter/ipt_mac.c b/net/ipv4/netfilter/ipt_mac.c
54855 --- a/net/ipv4/netfilter/ipt_mac.c Wed May 21 16:35:36 2003
54856 +++ b/net/ipv4/netfilter/ipt_mac.c Sun Aug 24 05:00:28 2003
54858 #include <linux/netfilter_ipv4/ipt_mac.h>
54859 #include <linux/netfilter_ipv4/ip_tables.h>
54861 +MODULE_LICENSE("GPL");
54862 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
54863 +MODULE_DESCRIPTION("iptables mac matching module");
54866 match(const struct sk_buff *skb,
54867 const struct net_device *in,
54872 -MODULE_LICENSE("GPL");
54873 diff -Nru a/net/ipv4/netfilter/ipt_mark.c b/net/ipv4/netfilter/ipt_mark.c
54874 --- a/net/ipv4/netfilter/ipt_mark.c Wed May 21 16:35:36 2003
54875 +++ b/net/ipv4/netfilter/ipt_mark.c Sun Aug 24 05:00:28 2003
54877 #include <linux/netfilter_ipv4/ipt_mark.h>
54878 #include <linux/netfilter_ipv4/ip_tables.h>
54880 +MODULE_LICENSE("GPL");
54881 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
54882 +MODULE_DESCRIPTION("iptables mark matching module");
54885 match(const struct sk_buff *skb,
54886 const struct net_device *in,
54891 -MODULE_LICENSE("GPL");
54892 diff -Nru a/net/ipv4/netfilter/ipt_multiport.c b/net/ipv4/netfilter/ipt_multiport.c
54893 --- a/net/ipv4/netfilter/ipt_multiport.c Wed May 21 16:35:36 2003
54894 +++ b/net/ipv4/netfilter/ipt_multiport.c Sun Aug 24 05:00:28 2003
54896 #include <linux/netfilter_ipv4/ipt_multiport.h>
54897 #include <linux/netfilter_ipv4/ip_tables.h>
54899 +MODULE_LICENSE("GPL");
54900 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
54901 +MODULE_DESCRIPTION("iptables multiple port match module");
54904 #define duprintf(format, args...) printk(format , ## args)
54906 @@ -106,4 +110,3 @@
54910 -MODULE_LICENSE("GPL");
54911 diff -Nru a/net/ipv4/netfilter/ipt_owner.c b/net/ipv4/netfilter/ipt_owner.c
54912 --- a/net/ipv4/netfilter/ipt_owner.c Wed Jun 4 17:57:08 2003
54913 +++ b/net/ipv4/netfilter/ipt_owner.c Sun Aug 24 05:00:28 2003
54915 #include <linux/netfilter_ipv4/ipt_owner.h>
54916 #include <linux/netfilter_ipv4/ip_tables.h>
54918 +MODULE_LICENSE("GPL");
54919 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
54920 +MODULE_DESCRIPTION("iptables owner match");
54923 match_comm(const struct sk_buff *skb, const char *comm)
54925 @@ -198,4 +202,3 @@
54929 -MODULE_LICENSE("GPL");
54930 diff -Nru a/net/ipv4/netfilter/ipt_physdev.c b/net/ipv4/netfilter/ipt_physdev.c
54931 --- a/net/ipv4/netfilter/ipt_physdev.c Sat Aug 2 18:29:28 2003
54932 +++ b/net/ipv4/netfilter/ipt_physdev.c Sat Aug 30 20:47:18 2003
54937 +MODULE_LICENSE("GPL");
54938 +MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
54939 +MODULE_DESCRIPTION("iptables bridge physical device match module");
54942 match(const struct sk_buff *skb,
54943 const struct net_device *in,
54944 @@ -120,4 +124,3 @@
54948 -MODULE_LICENSE("GPL");
54949 diff -Nru a/net/ipv4/netfilter/ipt_state.c b/net/ipv4/netfilter/ipt_state.c
54950 --- a/net/ipv4/netfilter/ipt_state.c Wed May 21 16:35:36 2003
54951 +++ b/net/ipv4/netfilter/ipt_state.c Sun Aug 24 05:00:28 2003
54953 #include <linux/netfilter_ipv4/ip_tables.h>
54954 #include <linux/netfilter_ipv4/ipt_state.h>
54956 +MODULE_LICENSE("GPL");
54957 +MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
54958 +MODULE_DESCRIPTION("iptables connection tracking state match module");
54961 match(const struct sk_buff *skb,
54962 const struct net_device *in,
54967 -MODULE_LICENSE("GPL");
54968 diff -Nru a/net/ipv4/netfilter/ipt_tcpmss.c b/net/ipv4/netfilter/ipt_tcpmss.c
54969 --- a/net/ipv4/netfilter/ipt_tcpmss.c Wed May 21 16:35:36 2003
54970 +++ b/net/ipv4/netfilter/ipt_tcpmss.c Sun Aug 24 05:00:28 2003
54973 #define TH_SYN 0x02
54975 +MODULE_LICENSE("GPL");
54976 +MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
54977 +MODULE_DESCRIPTION("iptables TCP MSS match module");
54979 /* Returns 1 if the mss option is set and matched by the range, 0 otherwise */
54981 mssoption_match(u_int16_t min, u_int16_t max,
54982 @@ -117,4 +121,3 @@
54986 -MODULE_LICENSE("GPL");
54987 diff -Nru a/net/ipv4/netfilter/ipt_tos.c b/net/ipv4/netfilter/ipt_tos.c
54988 --- a/net/ipv4/netfilter/ipt_tos.c Wed May 21 16:35:36 2003
54989 +++ b/net/ipv4/netfilter/ipt_tos.c Sun Aug 24 05:00:28 2003
54991 #include <linux/netfilter_ipv4/ipt_tos.h>
54992 #include <linux/netfilter_ipv4/ip_tables.h>
54994 +MODULE_LICENSE("GPL");
54995 +MODULE_DESCRIPTION("iptables TOS match module");
54998 match(const struct sk_buff *skb,
54999 const struct net_device *in,
55004 -MODULE_LICENSE("GPL");
55005 diff -Nru a/net/ipv4/netfilter/ipt_unclean.c b/net/ipv4/netfilter/ipt_unclean.c
55006 --- a/net/ipv4/netfilter/ipt_unclean.c Wed May 21 16:35:36 2003
55007 +++ /dev/null Wed Dec 31 16:00:00 1969
55009 -/* Kernel module to match suspect packets. */
55010 -#include <linux/module.h>
55011 -#include <linux/skbuff.h>
55012 -#include <linux/ip.h>
55013 -#include <linux/udp.h>
55014 -#include <linux/tcp.h>
55015 -#include <linux/icmp.h>
55016 -#include <net/checksum.h>
55018 -#include <linux/netfilter_ipv4/ip_tables.h>
55020 -#define limpk(format, args...) \
55022 - if (net_ratelimit()) \
55023 - printk("ipt_unclean: %s" format, \
55024 - embedded ? "(embedded packet) " : "" , ## args); \
55027 -enum icmp_error_status
55029 - ICMP_MAY_BE_ERROR,
55036 - size_t min_len, max_len;
55037 - enum icmp_error_status err;
55038 - u_int8_t min_code, max_code;
55042 -check_ip(const struct sk_buff *skb, unsigned int offset);
55044 -/* ICMP-specific checks. */
55046 -check_icmp(const struct sk_buff *skb,
55047 - unsigned int offset,
55048 - unsigned int fragoff,
55052 - struct icmphdr icmph;
55053 - static struct icmp_info info[]
55054 - = { [ICMP_ECHOREPLY]
55055 - = { 8, 65536, ICMP_NOT_ERROR, 0, 0 },
55056 - [ICMP_DEST_UNREACH]
55057 - = { 8 + 28, 65536, ICMP_IS_ERROR, 0, 15 },
55058 - [ICMP_SOURCE_QUENCH]
55059 - = { 8 + 28, 65536, ICMP_IS_ERROR, 0, 0 },
55061 - = { 8 + 28, 65536, ICMP_IS_ERROR, 0, 3 },
55063 - = { 8, 65536, ICMP_NOT_ERROR, 0, 0 },
55064 - /* Router advertisement. */
55066 - = { 8, 8 + 255 * 8, ICMP_NOT_ERROR, 0, 0 },
55067 - /* Router solicitation. */
55069 - = { 8, 8, ICMP_NOT_ERROR, 0, 0 },
55070 - [ICMP_TIME_EXCEEDED]
55071 - = { 8 + 28, 65536, ICMP_IS_ERROR, 0, 1 },
55072 - [ICMP_PARAMETERPROB]
55073 - = { 8 + 28, 65536, ICMP_IS_ERROR, 0, 1 },
55075 - = { 20, 20, ICMP_NOT_ERROR, 0, 0 },
55076 - [ICMP_TIMESTAMPREPLY]
55077 - = { 20, 20, ICMP_NOT_ERROR, 0, 0 },
55078 - [ICMP_INFO_REQUEST]
55079 - = { 8, 65536, ICMP_NOT_ERROR, 0, 0 },
55080 - [ICMP_INFO_REPLY]
55081 - = { 8, 65536, ICMP_NOT_ERROR, 0, 0 },
55083 - = { 12, 12, ICMP_NOT_ERROR, 0, 0 },
55084 - [ICMP_ADDRESSREPLY]
55085 - = { 12, 12, ICMP_NOT_ERROR, 0, 0 } };
55087 - /* Can't do anything if it's a fragment. */
55091 - /* CHECK: Must have whole header.. */
55092 - if (skb_copy_bits(skb, offset, &icmph, sizeof(icmph)) < 0) {
55093 - limpk("ICMP len=%u too short\n", skb->len - offset);
55097 - /* If not embedded in an ICMP error already. */
55099 - /* CHECK: Truncated ICMP (even if first fragment). */
55100 - if (icmph.type < sizeof(info)/sizeof(struct icmp_info)
55101 - && info[icmph.type].min_len != 0
55102 - && skb->len - offset < info[icmph.type].min_len) {
55103 - limpk("ICMP type %u len %u too short\n",
55104 - icmph.type, skb->len - offset);
55108 - /* CHECK: Check within known error ICMPs. */
55109 - if (icmph.type < sizeof(info)/sizeof(struct icmp_info)
55110 - && info[icmph.type].err == ICMP_IS_ERROR) {
55111 - /* Max IP header size = 60 */
55112 - char inner[60 + 8];
55113 - struct iphdr *inner_ip = (struct iphdr *)inner;
55115 - /* CHECK: Embedded packet must be at least
55116 - length of iph + 8 bytes. */
55117 - if (skb_copy_bits(skb, offset + sizeof(icmph),
55118 - inner, sizeof(struct iphdr)+8) < 0) {
55119 - limpk("ICMP error internal way too short\n");
55123 - /* iphhdr may actually be longer: still need 8
55124 - actual protocol bytes. */
55125 - if (offset + sizeof(icmph) + inner_ip->ihl*4 + 8
55127 - limpk("ICMP error internal too short\n");
55130 - if (!check_ip(skb, offset + sizeof(icmph)))
55134 - /* CHECK: Can't embed ICMP unless known non-error. */
55135 - if (icmph.type >= sizeof(info)/sizeof(struct icmp_info)
55136 - || info[icmph.type].err != ICMP_NOT_ERROR) {
55137 - limpk("ICMP type %u not embeddable\n",
55143 - /* CHECK: Invalid ICMP codes. */
55144 - if (icmph.type < sizeof(info)/sizeof(struct icmp_info)
55145 - && (icmph.code < info[icmph.type].min_code
55146 - || icmph.code > info[icmph.type].max_code)) {
55147 - limpk("ICMP type=%u code=%u\n",
55148 - icmph.type, icmph.code);
55152 - /* CHECK: Above maximum length. */
55153 - if (icmph.type < sizeof(info)/sizeof(struct icmp_info)
55154 - && info[icmph.type].max_len != 0
55155 - && skb->len - offset > info[icmph.type].max_len) {
55156 - limpk("ICMP type=%u too long: %u bytes\n",
55157 - icmph.type, skb->len - offset);
55161 - switch (icmph.type) {
55162 - case ICMP_PARAMETERPROB: {
55163 - /* CHECK: Problem param must be within error packet's
55165 - u_int32_t arg = ntohl(icmph.un.gateway);
55167 - if (icmph.code == 0) {
55168 - /* We've already made sure it's long enough. */
55169 - struct iphdr iph;
55170 - skb_copy_bits(skb, offset + sizeof(icmph), &iph,
55172 - /* Code 0 means that upper 8 bits is pointer
55174 - if ((arg >> 24) >= iph.ihl*4) {
55175 - limpk("ICMP PARAMETERPROB ptr = %u\n",
55176 - ntohl(icmph.un.gateway) >> 24);
55179 - arg &= 0x00FFFFFF;
55182 - /* CHECK: Rest must be zero. */
55184 - limpk("ICMP PARAMETERPROB nonzero arg = %u\n",
55191 - case ICMP_TIME_EXCEEDED:
55192 - case ICMP_SOURCE_QUENCH:
55193 - /* CHECK: Unused must be zero. */
55194 - if (icmph.un.gateway != 0) {
55195 - limpk("ICMP type=%u unused = %u\n",
55196 - icmph.type, ntohl(icmph.un.gateway));
55205 -/* UDP-specific checks. */
55207 -check_udp(const struct sk_buff *skb,
55208 - unsigned int offset,
55209 - unsigned int fragoff,
55213 - struct udphdr udph;
55215 - /* Can't do anything if it's a fragment. */
55219 - /* CHECK: Must cover UDP header. */
55220 - if (skb_copy_bits(skb, offset, &udph, sizeof(udph)) < 0) {
55221 - limpk("UDP len=%u too short\n", skb->len - offset);
55225 - /* CHECK: Destination port can't be zero. */
55226 - if (!udph.dest) {
55227 - limpk("UDP zero destination port\n");
55231 - if (!more_frags) {
55233 - /* CHECK: UDP length must match. */
55234 - if (ntohs(udph.len) != skb->len - offset) {
55235 - limpk("UDP len too short %u vs %u\n",
55236 - ntohs(udph.len), skb->len - offset);
55240 - /* CHECK: UDP length be >= this truncated pkt. */
55241 - if (ntohs(udph.len) < skb->len - offset) {
55242 - limpk("UDP len too long %u vs %u\n",
55243 - ntohs(udph.len), skb->len - offset);
55248 - /* CHECK: UDP length must be > this frag's length. */
55249 - if (ntohs(udph.len) <= skb->len - offset) {
55250 - limpk("UDP fragment len too short %u vs %u\n",
55251 - ntohs(udph.len), skb->len - offset);
55259 -/* TCP-specific checks. */
55261 -check_tcp(const struct sk_buff *skb,
55262 - unsigned int offset,
55263 - unsigned int fragoff,
55267 - struct tcphdr tcph;
55268 - unsigned char opt[15 * 4 - sizeof(struct tcphdr)];
55270 - int end_of_options = 0;
55271 - unsigned int i, optlen;
55273 - /* CHECK: Can't have offset=1: used to override TCP syn-checks. */
55274 - /* In fact, this is caught below (offset < 516). */
55276 - /* Can't do anything if it's a fragment. */
55280 - /* CHECK: Smaller than minimal TCP hdr. */
55281 - if (skb_copy_bits(skb, offset, &tcph, sizeof(tcph)) < 0) {
55285 - limpk("Packet length %u < TCP header.\n",
55286 - skb->len - offset);
55290 - /* Must have ports available (datalen >= 8), from
55291 - check_icmp which set embedded = 1 */
55292 - /* CHECK: TCP ports inside ICMP error */
55293 - skb_copy_bits(skb, offset, ports, sizeof(ports));
55294 - if (!ports[0] || !ports[1]) {
55295 - limpk("Zero TCP ports %u/%u.\n",
55296 - htons(ports[0]), htons(ports[1]));
55302 - /* CHECK: TCP header claims tiny size. */
55303 - if (tcph.doff * 4 < sizeof(tcph)) {
55304 - limpk("TCP header claims tiny size %u\n", tcph.doff * 4);
55308 - /* CHECK: Packet smaller than actual TCP hdr. */
55309 - optlen = tcph.doff*4 - sizeof(tcph);
55310 - if (skb_copy_bits(skb, offset + sizeof(tcph), opt, optlen) < 0) {
55312 - limpk("Packet length %u < actual TCP header.\n",
55313 - skb->len - offset);
55319 - /* CHECK: TCP ports non-zero */
55320 - if (!tcph.source || !tcph.dest) {
55321 - limpk("Zero TCP ports %u/%u.\n",
55322 - htons(tcph.source), htons(tcph.dest));
55326 - tcpflags = tcp_flag_word(&tcph);
55328 - /* CHECK: TCP reserved bits zero. */
55329 - if (tcpflags & TCP_RESERVED_BITS) {
55330 - limpk("TCP reserved bits not zero\n");
55334 - tcpflags &= ~(TCP_DATA_OFFSET | TCP_FLAG_CWR | TCP_FLAG_ECE
55335 - | __constant_htonl(0x0000FFFF));
55337 - /* CHECK: TCP flags. */
55338 - if (tcpflags != TCP_FLAG_SYN
55339 - && tcpflags != (TCP_FLAG_SYN|TCP_FLAG_ACK)
55340 - && tcpflags != TCP_FLAG_RST
55341 - && tcpflags != (TCP_FLAG_RST|TCP_FLAG_ACK)
55342 - && tcpflags != (TCP_FLAG_RST|TCP_FLAG_ACK|TCP_FLAG_PSH)
55343 - && tcpflags != (TCP_FLAG_FIN|TCP_FLAG_ACK)
55344 - && tcpflags != TCP_FLAG_ACK
55345 - && tcpflags != (TCP_FLAG_ACK|TCP_FLAG_PSH)
55346 - && tcpflags != (TCP_FLAG_ACK|TCP_FLAG_URG)
55347 - && tcpflags != (TCP_FLAG_ACK|TCP_FLAG_URG|TCP_FLAG_PSH)
55348 - && tcpflags != (TCP_FLAG_FIN|TCP_FLAG_ACK|TCP_FLAG_PSH)
55349 - && tcpflags != (TCP_FLAG_FIN|TCP_FLAG_ACK|TCP_FLAG_URG)
55350 - && tcpflags != (TCP_FLAG_FIN|TCP_FLAG_ACK|TCP_FLAG_URG
55351 - |TCP_FLAG_PSH)) {
55352 - limpk("TCP flags bad: 0x%04X\n", ntohl(tcpflags) >> 16);
55356 - for (i = 0; i < optlen; ) {
55357 - switch (opt[i]) {
55359 - end_of_options = 1;
55366 - /* CHECK: options after EOO. */
55367 - if (end_of_options) {
55368 - limpk("TCP option %u after end\n",
55372 - /* CHECK: options at tail. */
55373 - else if (i+1 >= optlen) {
55374 - limpk("TCP option %u at tail\n",
55378 - /* CHECK: zero-length options. */
55379 - else if (opt[i+1] == 0) {
55380 - limpk("TCP option %u 0 len\n",
55384 - /* CHECK: oversize options. */
55385 - else if (i + opt[i+1] > optlen) {
55386 - limpk("TCP option %u at %u too long\n",
55387 - (unsigned int) opt[i], i);
55390 - /* Move to next option */
55398 -/* Returns 1 if ok */
55399 -/* Standard IP checks. */
55401 -check_ip(const struct sk_buff *skb, unsigned int offset)
55403 - int end_of_options = 0;
55404 - unsigned int datalen, optlen;
55406 - unsigned int fragoff;
55407 - struct iphdr iph;
55408 - unsigned char opt[15 * 4 - sizeof(struct iphdr)];
55409 - int embedded = offset;
55411 - /* Should only happen for local outgoing raw-socket packets. */
55412 - /* CHECK: length >= ip header. */
55413 - if (skb_copy_bits(skb, offset, &iph, sizeof(iph)) < 0) {
55414 - limpk("Packet length %u < IP header.\n", skb->len - offset);
55417 - if (iph.ihl * 4 < sizeof(iph)) {
55418 - limpk("IP len %u < minimum IP header.\n", iph.ihl*4);
55422 - optlen = iph.ihl * 4 - sizeof(iph);
55423 - if (skb_copy_bits(skb, offset+sizeof(struct iphdr), opt, optlen)<0) {
55424 - limpk("Packet length %u < IP header %u.\n",
55425 - skb->len - offset, iph.ihl * 4);
55429 - fragoff = (ntohs(iph.frag_off) & IP_OFFSET);
55430 - datalen = skb->len - (offset + sizeof(struct iphdr) + optlen);
55432 - /* CHECK: Embedded fragment. */
55433 - if (offset && fragoff) {
55434 - limpk("Embedded fragment.\n");
55438 - for (i = 0; i < optlen; ) {
55439 - switch (opt[i]) {
55441 - end_of_options = 1;
55448 - /* CHECK: options after EOO. */
55449 - if (end_of_options) {
55450 - limpk("IP option %u after end\n",
55454 - /* CHECK: options at tail. */
55455 - else if (i+1 >= optlen) {
55456 - limpk("IP option %u at tail\n",
55460 - /* CHECK: zero-length or one-length options. */
55461 - else if (opt[i+1] < 2) {
55462 - limpk("IP option %u %u len\n",
55463 - opt[i], opt[i+1]);
55466 - /* CHECK: oversize options. */
55467 - else if (i + opt[i+1] > optlen) {
55468 - limpk("IP option %u at %u too long\n",
55472 - /* Move to next option */
55477 - /* Fragment checks. */
55479 - /* CHECK: More fragments, but doesn't fill 8-byte boundary. */
55480 - if ((ntohs(iph.frag_off) & IP_MF)
55481 - && (ntohs(iph.tot_len) % 8) != 0) {
55482 - limpk("Truncated fragment %u long.\n", ntohs(iph.tot_len));
55486 - /* CHECK: Oversize fragment a-la Ping of Death. */
55487 - if (fragoff * 8 + datalen > 65535) {
55488 - limpk("Oversize fragment to %u.\n", fragoff * 8);
55492 - /* CHECK: DF set and fragoff or MF set. */
55493 - if ((ntohs(iph.frag_off) & IP_DF)
55494 - && (fragoff || (ntohs(iph.frag_off) & IP_MF))) {
55495 - limpk("DF set and offset=%u, MF=%u.\n",
55496 - fragoff, ntohs(iph.frag_off) & IP_MF);
55500 - /* CHECK: Zero-sized fragments. */
55501 - if ((fragoff || (ntohs(iph.frag_off) & IP_MF))
55502 - && datalen == 0) {
55503 - limpk("Zero size fragment offset=%u\n", fragoff);
55507 - /* Note: we can have even middle fragments smaller than this:
55508 - consider a large packet passing through a 600MTU then
55509 - 576MTU link: this gives a fragment of 24 data bytes. But
55510 - everyone packs fragments largest first, hence a fragment
55511 - can't START before 576 - MAX_IP_HEADER_LEN. */
55513 - /* Used to be min-size 576: I recall Alan Cox saying ax25 goes
55514 - down to 128 (576 taken from RFC 791: All hosts must be
55515 - prepared to accept datagrams of up to 576 octets). Use 128
55517 -#define MIN_LIKELY_MTU 128
55518 - /* CHECK: Min size of first frag = 128. */
55519 - if ((ntohs(iph.frag_off) & IP_MF)
55521 - && ntohs(iph.tot_len) < MIN_LIKELY_MTU) {
55522 - limpk("First fragment size %u < %u\n", ntohs(iph.tot_len),
55527 - /* CHECK: Min offset of frag = 128 - IP hdr len. */
55528 - if (fragoff && fragoff * 8 < MIN_LIKELY_MTU - iph.ihl * 4) {
55529 - limpk("Fragment starts at %u < %u\n", fragoff * 8,
55530 - MIN_LIKELY_MTU - iph.ihl * 4);
55534 - /* CHECK: Protocol specification non-zero. */
55535 - if (iph.protocol == 0) {
55536 - limpk("Zero protocol\n");
55540 - /* FIXME: This is already checked for in "Oversize fragment"
55542 - /* CHECK: Do not use what is unused.
55543 - * First bit of fragmentation flags should be unused.
55544 - * May be used by OS fingerprinting tools.
55545 - * 04 Jun 2002, Maciej Soltysiak, solt@dns.toxicfilms.tv
55547 - if (ntohs(iph.frag_off)>>15) {
55548 - limpk("IP unused bit set\n");
55552 - /* Per-protocol checks. */
55553 - switch (iph.protocol) {
55554 - case IPPROTO_ICMP:
55555 - return check_icmp(skb, offset + iph.ihl*4, fragoff,
55556 - (ntohs(iph.frag_off) & IP_MF),
55559 - case IPPROTO_UDP:
55560 - return check_udp(skb, offset + iph.ihl*4, fragoff,
55561 - (ntohs(iph.frag_off) & IP_MF),
55564 - case IPPROTO_TCP:
55565 - return check_tcp(skb, offset + iph.ihl*4, fragoff,
55566 - (ntohs(iph.frag_off) & IP_MF),
55569 - /* Ignorance is bliss. */
55575 -match(const struct sk_buff *skb,
55576 - const struct net_device *in,
55577 - const struct net_device *out,
55578 - const void *matchinfo,
55582 - return !check_ip(skb, 0);
55585 -/* Called when user tries to insert an entry of this type. */
55587 -checkentry(const char *tablename,
55588 - const struct ipt_ip *ip,
55590 - unsigned int matchsize,
55591 - unsigned int hook_mask)
55593 - if (matchsize != IPT_ALIGN(0))
55599 -static struct ipt_match unclean_match = {
55600 - .name = "unclean",
55602 - .checkentry = &checkentry,
55603 - .me = THIS_MODULE,
55606 -static int __init init(void)
55608 - return ipt_register_match(&unclean_match);
55611 -static void __exit fini(void)
55613 - ipt_unregister_match(&unclean_match);
55616 -module_init(init);
55617 -module_exit(fini);
55618 -MODULE_LICENSE("GPL");
55619 diff -Nru a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
55620 --- a/net/ipv4/netfilter/iptable_filter.c Wed Jun 11 23:34:58 2003
55621 +++ b/net/ipv4/netfilter/iptable_filter.c Sun Aug 24 05:00:28 2003
55623 #include <linux/module.h>
55624 #include <linux/netfilter_ipv4/ip_tables.h>
55626 +MODULE_LICENSE("GPL");
55627 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
55628 +MODULE_DESCRIPTION("iptables filter table");
55630 #define FILTER_VALID_HOOKS ((1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) | (1 << NF_IP_LOCAL_OUT))
55632 /* Standard entry. */
55633 @@ -200,4 +204,3 @@
55637 -MODULE_LICENSE("GPL");
55638 diff -Nru a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
55639 --- a/net/ipv4/netfilter/iptable_mangle.c Wed Jun 11 23:34:58 2003
55640 +++ b/net/ipv4/netfilter/iptable_mangle.c Sun Aug 24 05:00:28 2003
55642 #include <net/route.h>
55643 #include <linux/ip.h>
55645 +MODULE_LICENSE("GPL");
55646 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
55647 +MODULE_DESCRIPTION("iptables mangle table");
55649 #define MANGLE_VALID_HOOKS ((1 << NF_IP_PRE_ROUTING) | \
55650 (1 << NF_IP_LOCAL_IN) | \
55651 (1 << NF_IP_FORWARD) | \
55652 @@ -267,4 +271,3 @@
55656 -MODULE_LICENSE("GPL");
55657 diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
55658 --- a/net/ipv4/route.c Sat Aug 16 12:08:34 2003
55659 +++ b/net/ipv4/route.c Thu Aug 28 00:02:15 2003
55660 @@ -312,49 +312,6 @@
55664 -static int rt_cache_stat_get_info(char *buffer, char **start, off_t offset, int length)
55666 - unsigned int dst_entries = atomic_read(&ipv4_dst_ops.entries);
55670 - for (i = 0; i < NR_CPUS; i++) {
55671 - if (!cpu_possible(i))
55673 - len += sprintf(buffer+len, "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
55675 - per_cpu_ptr(rt_cache_stat, i)->in_hit,
55676 - per_cpu_ptr(rt_cache_stat, i)->in_slow_tot,
55677 - per_cpu_ptr(rt_cache_stat, i)->in_slow_mc,
55678 - per_cpu_ptr(rt_cache_stat, i)->in_no_route,
55679 - per_cpu_ptr(rt_cache_stat, i)->in_brd,
55680 - per_cpu_ptr(rt_cache_stat, i)->in_martian_dst,
55681 - per_cpu_ptr(rt_cache_stat, i)->in_martian_src,
55683 - per_cpu_ptr(rt_cache_stat, i)->out_hit,
55684 - per_cpu_ptr(rt_cache_stat, i)->out_slow_tot,
55685 - per_cpu_ptr(rt_cache_stat, i)->out_slow_mc,
55687 - per_cpu_ptr(rt_cache_stat, i)->gc_total,
55688 - per_cpu_ptr(rt_cache_stat, i)->gc_ignored,
55689 - per_cpu_ptr(rt_cache_stat, i)->gc_goal_miss,
55690 - per_cpu_ptr(rt_cache_stat, i)->gc_dst_overflow,
55691 - per_cpu_ptr(rt_cache_stat, i)->in_hlist_search,
55692 - per_cpu_ptr(rt_cache_stat, i)->out_hlist_search
55698 - if (len > length)
55703 - *start = buffer + offset;
55707 static struct seq_operations rt_cache_seq_ops = {
55708 .start = rt_cache_seq_start,
55709 .next = rt_cache_seq_next,
55710 @@ -391,22 +348,89 @@
55711 .release = seq_release_private,
55714 -int __init rt_cache_proc_init(void)
55716 +static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos)
55719 - struct proc_dir_entry *p = create_proc_entry("rt_cache", S_IRUGO,
55722 - p->proc_fops = &rt_cache_seq_fops;
55728 + for (cpu = *pos; cpu < NR_CPUS; ++cpu) {
55729 + if (!cpu_possible(cpu))
55732 + return per_cpu_ptr(rt_cache_stat, cpu);
55737 +static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
55741 + for (cpu = *pos + 1; cpu < NR_CPUS; ++cpu) {
55742 + if (!cpu_possible(cpu))
55745 + return per_cpu_ptr(rt_cache_stat, cpu);
55751 -void __init rt_cache_proc_exit(void)
55752 +static void rt_cpu_seq_stop(struct seq_file *seq, void *v)
55754 - remove_proc_entry("rt_cache", proc_net);
55758 +static int rt_cpu_seq_show(struct seq_file *seq, void *v)
55760 + struct rt_cache_stat *st = v;
55762 + seq_printf(seq,"%08x %08x %08x %08x %08x %08x %08x %08x "
55763 + " %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
55764 + atomic_read(&ipv4_dst_ops.entries),
55770 + st->in_martian_dst,
55771 + st->in_martian_src,
55774 + st->out_slow_tot,
55779 + st->gc_goal_miss,
55780 + st->gc_dst_overflow,
55781 + st->in_hlist_search,
55782 + st->out_hlist_search
55787 +static struct seq_operations rt_cpu_seq_ops = {
55788 + .start = rt_cpu_seq_start,
55789 + .next = rt_cpu_seq_next,
55790 + .stop = rt_cpu_seq_stop,
55791 + .show = rt_cpu_seq_show,
55795 +static int rt_cpu_seq_open(struct inode *inode, struct file *file)
55797 + return seq_open(file, &rt_cpu_seq_ops);
55800 +static struct file_operations rt_cpu_seq_fops = {
55801 + .owner = THIS_MODULE,
55802 + .open = rt_cpu_seq_open,
55803 + .read = seq_read,
55804 + .llseek = seq_lseek,
55805 + .release = seq_release_private,
55808 #endif /* CONFIG_PROC_FS */
55810 static __inline__ void rt_free(struct rtable *rt)
55811 @@ -2779,11 +2803,12 @@
55812 add_timer(&rt_secret_timer);
55814 #ifdef CONFIG_PROC_FS
55815 - if (rt_cache_proc_init())
55816 + if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) ||
55817 + !proc_net_fops_create("rt_cache_stat", S_IRUGO, &rt_cpu_seq_fops))
55819 - proc_net_create ("rt_cache_stat", 0, rt_cache_stat_get_info);
55821 #ifdef CONFIG_NET_CLS_ROUTE
55822 - create_proc_read_entry("net/rt_acct", 0, 0, ip_rt_acct_read, NULL);
55823 + create_proc_read_entry("rt_acct", 0, proc_net, ip_rt_acct_read, NULL);
55827 diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c
55828 --- a/net/ipv6/icmp.c Mon Aug 18 03:38:34 2003
55829 +++ b/net/ipv6/icmp.c Mon Sep 1 01:38:00 2003
55830 @@ -70,12 +70,14 @@
55831 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
55834 - * ICMP socket(s) for flow control.
55835 + * The ICMP socket(s). This is the most convenient way to flow control
55836 + * our ICMP output as well as maintain a clean interface throughout
55837 + * all layers. All Socketless IP sends will soon be gone.
55839 + * On SMP we have one ICMP socket per-cpu.
55842 -/* XXX We can't use per_cpu because this can be modular... */
55843 -static struct socket *__icmpv6_socket[NR_CPUS];
55844 -#define icmpv6_socket __icmpv6_socket[smp_processor_id()]
55845 +static DEFINE_PER_CPU(struct socket *, __icmpv6_socket) = NULL;
55846 +#define icmpv6_socket __get_cpu_var(__icmpv6_socket)
55848 static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp);
55850 @@ -93,11 +95,19 @@
55854 -static __inline__ void icmpv6_xmit_lock(void)
55855 +static __inline__ int icmpv6_xmit_lock(void)
55857 local_bh_disable();
55858 - if (unlikely(!spin_trylock(&icmpv6_socket->sk->sk_lock.slock)))
55861 + if (unlikely(!spin_trylock(&icmpv6_socket->sk->sk_lock.slock))) {
55862 + /* This can happen if the output path (f.e. SIT or
55863 + * ip6ip6 tunnel) signals dst_link_failure() for an
55864 + * outgoing ICMP6 packet.
55866 + local_bh_enable();
55872 static __inline__ void icmpv6_xmit_unlock(void)
55873 @@ -342,7 +352,8 @@
55874 fl.fl_icmp_type = type;
55875 fl.fl_icmp_code = code;
55877 - icmpv6_xmit_lock();
55878 + if (icmpv6_xmit_lock())
55881 if (!icmpv6_xrlim_allow(sk, type, &fl))
55883 @@ -432,7 +443,8 @@
55884 fl.oif = skb->dev->ifindex;
55885 fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
55887 - icmpv6_xmit_lock();
55888 + if (icmpv6_xmit_lock())
55891 if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
55892 fl.oif = np->mcast_oif;
55893 @@ -657,33 +669,23 @@
55894 int __init icmpv6_init(struct net_proto_family *ops)
55900 for (i = 0; i < NR_CPUS; i++) {
55903 if (!cpu_possible(i))
55906 err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6,
55907 - &__icmpv6_socket[i]);
55908 + &per_cpu(__icmpv6_socket, i));
55913 "Failed to initialize the ICMP6 control socket "
55916 - for (j = 0; j < i; j++) {
55917 - if (!cpu_possible(j))
55919 - sock_release(__icmpv6_socket[j]);
55920 - __icmpv6_socket[j] = NULL; /* for safety */
55926 - sk = __icmpv6_socket[i]->sk;
55927 + sk = per_cpu(__icmpv6_socket, i)->sk;
55928 sk->sk_allocation = GFP_ATOMIC;
55929 sk->sk_sndbuf = SK_WMEM_MAX * 2;
55930 sk->sk_prot->unhash(sk);
55931 @@ -692,16 +694,20 @@
55933 if (inet6_add_protocol(&icmpv6_protocol, IPPROTO_ICMPV6) < 0) {
55934 printk(KERN_ERR "Failed to register ICMP6 protocol\n");
55935 - for (i = 0; i < NR_CPUS; i++) {
55936 - if (!cpu_possible(i))
55938 - sock_release(__icmpv6_socket[i]);
55939 - __icmpv6_socket[i] = NULL;
55949 + for (j = 0; j < i; j++) {
55950 + if (!cpu_possible(j))
55952 + sock_release(per_cpu(__icmpv6_socket, j));
55958 void icmpv6_cleanup(void)
55959 @@ -711,8 +717,7 @@
55960 for (i = 0; i < NR_CPUS; i++) {
55961 if (!cpu_possible(i))
55963 - sock_release(__icmpv6_socket[i]);
55964 - __icmpv6_socket[i] = NULL; /* For safety. */
55965 + sock_release(per_cpu(__icmpv6_socket, i));
55967 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);
55969 diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
55970 --- a/net/ipv6/ip6_output.c Mon Aug 18 03:38:34 2003
55971 +++ b/net/ipv6/ip6_output.c Mon Sep 1 01:44:26 2003
55972 @@ -876,7 +876,7 @@
55973 /* Connection association is same as pre-frag packet */
55974 to->nfct = from->nfct;
55975 nf_conntrack_get(to->nfct);
55976 -#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
55977 +#ifdef CONFIG_BRIDGE_NETFILTER
55978 to->nf_bridge = from->nf_bridge;
55979 nf_bridge_get(to->nf_bridge);
55981 diff -Nru a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
55982 --- a/net/ipv6/ip6_tunnel.c Mon Aug 18 04:52:14 2003
55983 +++ b/net/ipv6/ip6_tunnel.c Mon Sep 1 01:55:01 2003
55985 #include <linux/module.h>
55986 #include <linux/errno.h>
55987 #include <linux/types.h>
55988 -#include <linux/socket.h>
55989 #include <linux/sockios.h>
55990 #include <linux/if.h>
55991 #include <linux/in.h>
55992 @@ -37,12 +36,12 @@
55993 #include <linux/init.h>
55994 #include <linux/route.h>
55995 #include <linux/rtnetlink.h>
55996 +#include <linux/netfilter_ipv6.h>
55998 #include <asm/uaccess.h>
55999 #include <asm/atomic.h>
56001 #include <net/ip.h>
56002 -#include <net/sock.h>
56003 #include <net/ipv6.h>
56004 #include <net/protocol.h>
56005 #include <net/ip6_route.h>
56008 #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
56010 -/* socket(s) used by ip6ip6_tnl_xmit() for resending packets */
56011 -static struct socket *__ip6_socket[NR_CPUS];
56012 -#define ip6_socket __ip6_socket[smp_processor_id()]
56014 -static void ip6_xmit_lock(void)
56016 - local_bh_disable();
56017 - if (unlikely(!spin_trylock(&ip6_socket->sk->sk_lock.slock)))
56021 -static void ip6_xmit_unlock(void)
56023 - spin_unlock_bh(&ip6_socket->sk->sk_lock.slock);
56026 #define HASH_SIZE 32
56028 #define HASH(addr) (((addr)->s6_addr32[0] ^ (addr)->s6_addr32[1] ^ \
56029 @@ -101,6 +84,33 @@
56030 /* lock for the tunnel lists */
56031 static rwlock_t ip6ip6_lock = RW_LOCK_UNLOCKED;
56033 +static inline struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
56035 + struct dst_entry *dst = t->dst_cache;
56037 + if (dst && dst->obsolete &&
56038 + dst->ops->check(dst, t->dst_cookie) == NULL) {
56039 + t->dst_cache = NULL;
56046 +static inline void ip6_tnl_dst_reset(struct ip6_tnl *t)
56048 + dst_release(t->dst_cache);
56049 + t->dst_cache = NULL;
56052 +static inline void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst)
56054 + struct rt6_info *rt = (struct rt6_info *) dst;
56055 + t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
56056 + dst_release(t->dst_cache);
56057 + t->dst_cache = dst;
56061 * ip6ip6_tnl_lookup - fetch tunnel matching the end-point addresses
56062 * @remote: the address of the tunnel exit-point
56063 @@ -294,13 +304,16 @@
56065 ip6ip6_tnl_dev_uninit(struct net_device *dev)
56067 + struct ip6_tnl *t = dev->priv;
56069 if (dev == ip6ip6_fb_tnl_dev) {
56070 write_lock_bh(&ip6ip6_lock);
56072 write_unlock_bh(&ip6ip6_lock);
56074 - ip6ip6_tnl_unlink((struct ip6_tnl *) dev->priv);
56075 + ip6ip6_tnl_unlink(t);
56077 + ip6_tnl_dst_reset(t);
56081 @@ -421,7 +434,7 @@
56083 teli = parse_tlv_tnl_enc_lim(skb, skb->data);
56085 - if (teli && teli == info - 2) {
56086 + if (teli && teli == ntohl(info) - 2) {
56087 tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
56088 if (tel->encap_limit == 0) {
56089 if (net_ratelimit())
56090 @@ -434,10 +447,9 @@
56093 case ICMPV6_PKT_TOOBIG:
56094 - mtu = info - offset;
56095 - if (mtu <= IPV6_MIN_MTU) {
56096 + mtu = ntohl(info) - offset;
56097 + if (mtu < IPV6_MIN_MTU)
56098 mtu = IPV6_MIN_MTU;
56102 if ((len = sizeof (*ipv6h) + ipv6h->payload_len) > mtu) {
56103 @@ -523,112 +535,34 @@
56108 - * txopt_len - get necessary size for new &struct ipv6_txoptions
56109 - * @orig_opt: old options
56112 - * Size of old one plus size of tunnel encapsulation limit option
56116 -txopt_len(struct ipv6_txoptions *orig_opt)
56118 - int len = sizeof (*orig_opt) + 8;
56120 - if (orig_opt && orig_opt->dst0opt)
56121 - len += ipv6_optlen(orig_opt->dst0opt);
56126 - * merge_options - add encapsulation limit to original options
56127 - * @encap_limit: number of allowed encapsulation limits
56128 - * @orig_opt: original options
56131 - * Pointer to new &struct ipv6_txoptions containing the tunnel
56132 - * encapsulation limit
56135 -static struct ipv6_txoptions *
56136 -merge_options(struct sock *sk, __u8 encap_limit,
56137 - struct ipv6_txoptions *orig_opt)
56138 +static inline struct ipv6_txoptions *create_tel(__u8 encap_limit)
56140 struct ipv6_tlv_tnl_enc_lim *tel;
56141 struct ipv6_txoptions *opt;
56144 - int opt_len = txopt_len(orig_opt);
56146 - if (!(opt = sock_kmalloc(sk, opt_len, GFP_ATOMIC))) {
56147 + int opt_len = sizeof(*opt) + 8;
56149 + if (!(opt = kmalloc(opt_len, GFP_ATOMIC))) {
56153 memset(opt, 0, opt_len);
56154 opt->tot_len = opt_len;
56155 opt->dst0opt = (struct ipv6_opt_hdr *) (opt + 1);
56156 opt->opt_nflen = 8;
56158 - raw = (__u8 *) opt->dst0opt;
56160 tel = (struct ipv6_tlv_tnl_enc_lim *) (opt->dst0opt + 1);
56161 tel->type = IPV6_TLV_TNL_ENCAP_LIMIT;
56163 tel->encap_limit = encap_limit;
56168 - opt->hopopt = orig_opt->hopopt;
56170 - /* Keep the original destination options properly
56171 - aligned and merge possible old paddings to the
56172 - new padding option */
56173 - if ((orig_raw = (__u8 *) orig_opt->dst0opt) != NULL) {
56175 - int i = sizeof (struct ipv6_opt_hdr);
56176 - pad_to += sizeof (struct ipv6_opt_hdr);
56177 - while (i < ipv6_optlen(orig_opt->dst0opt)) {
56178 - type = orig_raw[i++];
56179 - if (type == IPV6_TLV_PAD0)
56181 - else if (type == IPV6_TLV_PADN) {
56182 - int len = orig_raw[i++];
56184 - pad_to += len + 2;
56189 - opt->dst0opt->hdrlen = orig_opt->dst0opt->hdrlen + 1;
56190 - memcpy(raw + pad_to, orig_raw + pad_to - 8,
56191 - opt_len - sizeof (*opt) - pad_to);
56193 - opt->srcrt = orig_opt->srcrt;
56194 - opt->opt_nflen += orig_opt->opt_nflen;
56196 - opt->dst1opt = orig_opt->dst1opt;
56197 - opt->auth = orig_opt->auth;
56198 - opt->opt_flen = orig_opt->opt_flen;
56200 + raw = (__u8 *) opt->dst0opt;
56201 raw[5] = IPV6_TLV_PADN;
56203 - /* subtract lengths of destination suboption header,
56204 - tunnel encapsulation limit and pad N header */
56205 - raw[6] = pad_to - 7;
56212 -ip6ip6_getfrag(void *from, char *to, int offset, int len, int odd,
56213 - struct sk_buff *skb)
56215 - memcpy(to, (char *) from + offset, len);
56220 * ip6ip6_tnl_addr_conflict - compare packet addresses to tunnel's own
56221 * @t: the outgoing tunnel device
56222 @@ -656,7 +590,7 @@
56225 * Build new header and do some sanity checks on the packet before sending
56226 - * it to ip6_build_xmit().
56231 @@ -667,18 +601,17 @@
56232 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv;
56233 struct net_device_stats *stats = &t->stat;
56234 struct ipv6hdr *ipv6h = skb->nh.ipv6h;
56235 - struct ipv6_txoptions *orig_opt = NULL;
56236 struct ipv6_txoptions *opt = NULL;
56237 int encap_limit = -1;
56240 - struct ip6_flowlabel *fl_lbl = NULL;
56242 struct dst_entry *dst;
56243 - int link_failure = 0;
56244 - struct sock *sk = ip6_socket->sk;
56245 - struct ipv6_pinfo *np = inet6_sk(sk);
56246 + struct net_device *tdev;
56248 + int max_headroom = sizeof(struct ipv6hdr);
56253 if (t->recursion++) {
56254 stats->collisions++;
56255 @@ -701,58 +634,39 @@
56256 } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) {
56257 encap_limit = t->parms.encap_limit;
56261 memcpy(&fl, &t->fl, sizeof (fl));
56262 + proto = fl.proto;
56264 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
56265 fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_TCLASS_MASK);
56266 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL))
56267 fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_FLOWLABEL_MASK);
56269 - if (fl.fl6_flowlabel) {
56270 - fl_lbl = fl6_sock_lookup(sk, fl.fl6_flowlabel);
56272 - orig_opt = fl_lbl->opt;
56274 - if (encap_limit >= 0) {
56275 - if (!(opt = merge_options(sk, encap_limit, orig_opt))) {
56276 - goto tx_err_free_fl_lbl;
56281 - dst = __sk_dst_check(sk, np->dst_cookie);
56282 + if (encap_limit >= 0 && (opt = create_tel(encap_limit)) == NULL)
56286 - if (np->daddr_cache == NULL ||
56287 - ipv6_addr_cmp(&fl.fl6_dst, np->daddr_cache) ||
56288 - (fl.oif && fl.oif != dst->dev->ifindex)) {
56292 - if (dst == NULL) {
56293 - dst = ip6_route_output(sk, &fl);
56294 - if (dst->error) {
56295 - stats->tx_carrier_errors++;
56296 - link_failure = 1;
56297 - goto tx_err_dst_release;
56299 - /* local routing loop */
56300 - if (dst->dev == dev) {
56301 - stats->collisions++;
56302 - if (net_ratelimit())
56303 - printk(KERN_WARNING
56304 - "%s: Local routing loop detected!\n",
56306 - goto tx_err_dst_release;
56308 - ipv6_addr_copy(&np->daddr, &fl.fl6_dst);
56309 - ipv6_addr_copy(&np->saddr, &fl.fl6_src);
56310 + if ((dst = ip6_tnl_dst_check(t)) != NULL)
56313 + dst = ip6_route_output(NULL, &fl);
56315 + if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0) < 0)
56316 + goto tx_err_link_failure;
56320 + if (tdev == dev) {
56321 + stats->collisions++;
56322 + if (net_ratelimit())
56323 + printk(KERN_WARNING
56324 + "%s: Local routing loop detected!\n",
56326 + goto tx_err_dst_release;
56328 mtu = dst_pmtu(dst) - sizeof (*ipv6h);
56330 - mtu -= (opt->opt_nflen + opt->opt_flen);
56331 + max_headroom += 8;
56334 if (mtu < IPV6_MIN_MTU)
56335 mtu = IPV6_MIN_MTU;
56336 @@ -765,41 +679,71 @@
56337 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev);
56338 goto tx_err_dst_release;
56340 - err = ip6_append_data(sk, ip6ip6_getfrag, skb->nh.raw, skb->len, 0,
56341 - t->parms.hop_limit, opt, &fl,
56342 - (struct rt6_info *)dst, MSG_DONTWAIT);
56343 + skb->h.raw = skb->nh.raw;
56346 - ip6_flush_pending_frames(sk);
56348 - err = ip6_push_pending_frames(sk);
56349 - err = (err < 0 ? err : 0);
56351 + * Okay, now see if we can stuff it in the buffer as-is.
56353 + max_headroom += LL_RESERVED_SPACE(tdev);
56355 + if (skb_headroom(skb) < max_headroom ||
56356 + skb_cloned(skb) || skb_shared(skb)) {
56357 + struct sk_buff *new_skb;
56359 + if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))
56360 + goto tx_err_dst_release;
56363 + skb_set_owner_w(new_skb, skb->sk);
56368 - stats->tx_bytes += skb->len;
56369 + dst_release(skb->dst);
56370 + skb->dst = dst_clone(dst);
56373 + ipv6_push_nfrag_opts(skb, opt, &proto, NULL);
56375 + skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr));
56376 + ipv6h = skb->nh.ipv6h;
56377 + *(u32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000);
56378 + ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
56379 + ipv6h->hop_limit = t->parms.hop_limit;
56380 + ipv6h->nexthdr = proto;
56381 + ipv6_addr_copy(&ipv6h->saddr, &fl.fl6_src);
56382 + ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst);
56383 +#ifdef CONFIG_NETFILTER
56384 + nf_conntrack_put(skb->nfct);
56385 + skb->nfct = NULL;
56386 +#ifdef CONFIG_NETFILTER_DEBUG
56387 + skb->nf_debug = 0;
56390 + pkt_len = skb->len;
56391 + err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL,
56392 + skb->dst->dev, dst_output);
56394 + if (err == NET_XMIT_SUCCESS || err == NET_XMIT_CN) {
56395 + stats->tx_bytes += pkt_len;
56396 stats->tx_packets++;
56398 stats->tx_errors++;
56399 stats->tx_aborted_errors++;
56401 - if (opt && opt != orig_opt)
56402 - sock_kfree_s(sk, opt, opt->tot_len);
56403 + ip6_tnl_dst_store(t, dst);
56408 - fl6_sock_release(fl_lbl);
56409 - ip6_dst_store(sk, dst, &np->daddr);
56410 - ip6_xmit_unlock();
56414 +tx_err_link_failure:
56415 + stats->tx_carrier_errors++;
56416 + dst_link_failure(skb);
56417 tx_err_dst_release:
56419 - if (opt && opt != orig_opt)
56420 - sock_kfree_s(sk, opt, opt->tot_len);
56421 -tx_err_free_fl_lbl:
56422 - fl6_sock_release(fl_lbl);
56423 - ip6_xmit_unlock();
56424 - if (link_failure)
56425 - dst_link_failure(skb);
56429 stats->tx_errors++;
56430 stats->tx_dropped++;
56431 @@ -851,9 +795,12 @@
56433 struct net_device *dev = t->dev;
56434 struct ip6_tnl_parm *p = &t->parms;
56435 - struct flowi *fl;
56436 + struct flowi *fl = &t->fl;
56438 + memcpy(&dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
56439 + memcpy(&dev->broadcast, &p->raddr, sizeof(struct in6_addr));
56441 /* Set up flowi template */
56443 ipv6_addr_copy(&fl->fl6_src, &p->laddr);
56444 ipv6_addr_copy(&fl->fl6_dst, &p->raddr);
56446 @@ -878,10 +825,7 @@
56450 - /* as long as tunnels use the same socket for transmission,
56451 - locally nested tunnels won't work */
56453 - if (rt->rt6i_dev && rt->rt6i_dev->type != ARPHRD_TUNNEL6) {
56454 + if (rt->rt6i_dev) {
56455 dev->iflink = rt->rt6i_dev->ifindex;
56457 dev->hard_header_len = rt->rt6i_dev->hard_header_len +
56458 @@ -1083,7 +1027,7 @@
56460 SET_MODULE_OWNER(dev);
56461 dev->uninit = ip6ip6_tnl_dev_uninit;
56462 - dev->destructor = (void (*)(struct net_device *))kfree;
56463 + dev->destructor = free_netdev;
56464 dev->hard_start_xmit = ip6ip6_tnl_xmit;
56465 dev->get_stats = ip6ip6_tnl_get_stats;
56466 dev->do_ioctl = ip6ip6_tnl_ioctl;
56467 @@ -1094,10 +1038,7 @@
56468 dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr);
56469 dev->flags |= IFF_NOARP;
56471 - /* Hmm... MAX_ADDR_LEN is 8, so the ipv6 addresses can't be
56472 - copied to dev->dev_addr and dev->broadcast, like the ipv4
56473 - addresses were in ipip.c, ip_gre.c and sit.c. */
56474 - dev->addr_len = 0;
56475 + dev->addr_len = sizeof(struct in6_addr);
56479 @@ -1139,7 +1080,7 @@
56480 int ip6ip6_fb_tnl_dev_init(struct net_device *dev)
56482 struct ip6_tnl *t = dev->priv;
56483 - ip6ip6_tnl_dev_init_gen(dev);
56484 + ip6ip6_tnl_dev_init_gen(dev);
56488 @@ -1159,61 +1100,28 @@
56490 int __init ip6_tunnel_init(void)
56494 - struct ipv6_pinfo *np;
56496 - for (i = 0; i < NR_CPUS; i++) {
56497 - if (!cpu_possible(i))
56500 - err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_IPV6,
56501 - &__ip6_socket[i]);
56504 - "Failed to create the IPv6 tunnel socket "
56509 - sk = __ip6_socket[i]->sk;
56510 - sk->sk_allocation = GFP_ATOMIC;
56512 - np = inet6_sk(sk);
56513 - np->hop_limit = 255;
56517 - sk->sk_prot->unhash(sk);
56519 if ((err = inet6_add_protocol(&ip6ip6_protocol, IPPROTO_IPV6)) < 0) {
56520 printk(KERN_ERR "Failed to register IPv6 protocol\n");
56526 ip6ip6_fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6tnl0",
56527 ip6ip6_tnl_dev_setup);
56529 if (!ip6ip6_fb_tnl_dev) {
56534 ip6ip6_fb_tnl_dev->init = ip6ip6_fb_tnl_dev_init;
56536 if ((err = register_netdev(ip6ip6_fb_tnl_dev))) {
56537 kfree(ip6ip6_fb_tnl_dev);
56543 - inet6_del_protocol(&ip6ip6_protocol, IPPROTO_IPV6);
56545 - for (j = 0; j < i; j++) {
56546 - if (!cpu_possible(j))
56548 - sock_release(__ip6_socket[j]);
56549 - __ip6_socket[j] = NULL;
56551 + inet6_del_protocol(&ip6ip6_protocol, IPPROTO_IPV6);
56555 @@ -1223,18 +1131,8 @@
56557 void ip6_tunnel_cleanup(void)
56561 unregister_netdev(ip6ip6_fb_tnl_dev);
56563 inet6_del_protocol(&ip6ip6_protocol, IPPROTO_IPV6);
56565 - for (i = 0; i < NR_CPUS; i++) {
56566 - if (!cpu_possible(i))
56568 - sock_release(__ip6_socket[i]);
56569 - __ip6_socket[i] = NULL;
56574 diff -Nru a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c
56575 --- a/net/ipv6/ipv6_syms.c Sat Aug 9 02:14:55 2003
56576 +++ b/net/ipv6/ipv6_syms.c Mon Sep 1 01:55:02 2003
56578 EXPORT_SYMBOL(ip6_append_data);
56579 EXPORT_SYMBOL(ip6_flush_pending_frames);
56580 EXPORT_SYMBOL(ip6_push_pending_frames);
56581 +EXPORT_SYMBOL(ipv6_push_nfrag_opts);
56582 diff -Nru a/net/ipv6/mcast.c b/net/ipv6/mcast.c
56583 --- a/net/ipv6/mcast.c Thu Aug 21 14:48:55 2003
56584 +++ b/net/ipv6/mcast.c Wed Aug 27 23:45:13 2003
56585 @@ -2078,6 +2078,7 @@
56588 read_unlock_bh(&idev->lock);
56589 + in6_dev_put(idev);
56593 @@ -2135,7 +2136,9 @@
56594 if (likely(state->idev != NULL)) {
56595 read_unlock_bh(&state->idev->lock);
56596 in6_dev_put(state->idev);
56597 + state->idev = NULL;
56599 + state->dev = NULL;
56600 read_unlock(&dev_base_lock);
56603 @@ -2225,6 +2228,7 @@
56604 spin_unlock_bh(&im->mca_lock);
56606 read_unlock_bh(&idev->lock);
56607 + in6_dev_put(idev);
56611 @@ -2291,12 +2295,16 @@
56612 static void igmp6_mcf_seq_stop(struct seq_file *seq, void *v)
56614 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
56615 - if (likely(state->im != NULL))
56616 + if (likely(state->im != NULL)) {
56617 spin_unlock_bh(&state->im->mca_lock);
56618 + state->im = NULL;
56620 if (likely(state->idev != NULL)) {
56621 read_unlock_bh(&state->idev->lock);
56622 in6_dev_put(state->idev);
56623 + state->idev = NULL;
56625 + state->dev = NULL;
56626 read_unlock(&dev_base_lock);
56629 diff -Nru a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
56630 --- a/net/ipv6/netfilter/Kconfig Mon Mar 3 01:40:45 2003
56631 +++ b/net/ipv6/netfilter/Kconfig Sun Aug 24 04:58:54 2003
56635 menu "IPv6: Netfilter Configuration"
56636 - depends on INET && EXPERIMENTAL && IPV6!=n && NETFILTER
56637 + depends on INET && IPV6!=n && NETFILTER
56639 #tristate 'Connection tracking (required for masq/NAT)' CONFIG_IP6_NF_CONNTRACK
56640 #if [ "$CONFIG_IP6_NF_CONNTRACK" != "n" ]; then
56641 # dep_tristate ' FTP protocol support' CONFIG_IP6_NF_FTP $CONFIG_IP6_NF_CONNTRACK
56643 config IP6_NF_QUEUE
56644 - tristate "Userspace queueing via NETLINK (EXPERIMENTAL)"
56645 + tristate "Userspace queueing via NETLINK"
56648 This option adds a queue handler to the kernel for IPv6
56651 config IP6_NF_MATCH_RT
56652 tristate "Routing header match support"
56653 - depends on IP6_NF_IPTABLES && EXPERIMENTAL
56654 + depends on IP6_NF_IPTABLES
56656 rt matching allows you to match packets based on the routing
56657 header of the packet.
56660 config IP6_NF_MATCH_OPTS
56661 tristate "Hop-by-hop and Dst opts header match support"
56662 - depends on IP6_NF_IPTABLES && EXPERIMENTAL
56663 + depends on IP6_NF_IPTABLES
56665 This allows one to match packets based on the hop-by-hop
56666 and destination options headers of a packet.
56669 config IP6_NF_MATCH_FRAG
56670 tristate "Fragmentation header match support"
56671 - depends on IP6_NF_IPTABLES && EXPERIMENTAL
56672 + depends on IP6_NF_IPTABLES
56674 frag matching allows you to match packets based on the fragmentation
56675 header of the packet.
56676 @@ -112,7 +112,7 @@
56677 <file:Documentation/modules.txt>. If unsure, say `N'.
56679 config IP6_NF_MATCH_OWNER
56680 - tristate "Owner match support (EXPERIMENTAL)"
56681 + tristate "Owner match support"
56682 depends on IP6_NF_IPTABLES
56684 Packet owner matching allows you to match locally-generated packets
56685 @@ -134,8 +134,8 @@
56686 <file:Documentation/modules.txt>. If unsure, say `N'.
56688 config IP6_NF_MATCH_IPV6HEADER
56689 - tristate "IPv6 Extension Headers Match (EXPERIMENTAL)"
56690 - depends on IP6_NF_IPTABLES && EXPERIMENTAL
56691 + tristate "IPv6 Extension Headers Match"
56692 + depends on IP6_NF_IPTABLES
56694 This module allows one to match packets based upon
56695 the ipv6 extension headers.
56696 @@ -144,8 +144,8 @@
56697 <file:Documentation/modules.txt>. If unsure, say `N'.
56699 config IP6_NF_MATCH_AHESP
56700 - tristate "AH/ESP match support (EXPERIMENTAL)"
56701 - depends on IP6_NF_IPTABLES && EXPERIMENTAL
56702 + tristate "AH/ESP match support"
56703 + depends on IP6_NF_IPTABLES
56705 This module allows one to match AH and ESP packets.
56707 @@ -163,7 +163,7 @@
56708 Documentation/modules.txt. If unsure, say `N'.
56710 config IP6_NF_MATCH_EUI64
56711 - tristate "EUI64 address check (EXPERIMENTAL)"
56712 + tristate "EUI64 address check"
56713 depends on IP6_NF_IPTABLES
56715 This module performs checking on the IPv6 source address
56716 diff -Nru a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
56717 --- a/net/ipv6/netfilter/ip6_tables.c Sat Aug 2 18:29:29 2003
56718 +++ b/net/ipv6/netfilter/ip6_tables.c Sun Aug 24 05:00:28 2003
56721 #include <linux/netfilter_ipv6/ip6_tables.h>
56723 +MODULE_LICENSE("GPL");
56724 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56725 +MODULE_DESCRIPTION("IPv6 packet filter");
56727 #define IPV6_HDR_LEN (sizeof(struct ipv6hdr))
56728 #define IPV6_OPTHDR_LEN (sizeof(struct ipv6_opt_hdr))
56730 @@ -1923,4 +1927,3 @@
56734 -MODULE_LICENSE("GPL");
56735 diff -Nru a/net/ipv6/netfilter/ip6t_MARK.c b/net/ipv6/netfilter/ip6t_MARK.c
56736 --- a/net/ipv6/netfilter/ip6t_MARK.c Tue Feb 5 07:24:40 2002
56737 +++ b/net/ipv6/netfilter/ip6t_MARK.c Sun Aug 24 05:00:28 2003
56739 #include <linux/netfilter_ipv6/ip6_tables.h>
56740 #include <linux/netfilter_ipv6/ip6t_MARK.h>
56742 +MODULE_LICENSE("GPL");
56743 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56745 static unsigned int
56746 target(struct sk_buff **pskb,
56747 unsigned int hooknum,
56752 -MODULE_LICENSE("GPL");
56753 diff -Nru a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c
56754 --- a/net/ipv6/netfilter/ip6t_eui64.c Thu Mar 20 00:43:40 2003
56755 +++ b/net/ipv6/netfilter/ip6t_eui64.c Sun Aug 24 05:00:28 2003
56758 #include <linux/netfilter_ipv6/ip6_tables.h>
56760 +MODULE_DESCRIPTION("IPv6 EUI64 address checking match");
56761 +MODULE_LICENSE("GPL");
56762 +MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
56765 match(const struct sk_buff *skb,
56766 const struct net_device *in,
56771 -MODULE_DESCRIPTION("IPv6 EUI64 address checking match");
56772 -MODULE_LICENSE("GPL");
56773 -MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
56774 diff -Nru a/net/ipv6/netfilter/ip6t_length.c b/net/ipv6/netfilter/ip6t_length.c
56775 --- a/net/ipv6/netfilter/ip6t_length.c Thu Mar 20 00:43:40 2003
56776 +++ b/net/ipv6/netfilter/ip6t_length.c Sun Aug 24 05:00:28 2003
56778 #include <linux/netfilter_ipv6/ip6t_length.h>
56779 #include <linux/netfilter_ipv6/ip6_tables.h>
56781 +MODULE_LICENSE("GPL");
56782 +MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
56783 +MODULE_DESCRIPTION("IPv6 packet length match");
56786 match(const struct sk_buff *skb,
56787 const struct net_device *in,
56788 diff -Nru a/net/ipv6/netfilter/ip6t_limit.c b/net/ipv6/netfilter/ip6t_limit.c
56789 --- a/net/ipv6/netfilter/ip6t_limit.c Thu Mar 20 00:43:40 2003
56790 +++ b/net/ipv6/netfilter/ip6t_limit.c Sun Aug 24 05:00:28 2003
56792 #include <linux/netfilter_ipv6/ip6_tables.h>
56793 #include <linux/netfilter_ipv6/ip6t_limit.h>
56795 +MODULE_LICENSE("GPL");
56796 +MODULE_AUTHOR("Herve Eychenne <rv@wallfire.org>");
56797 +MODULE_DESCRIPTION("rate limiting within ip6tables");
56799 /* The algorithm used is the Simple Token Bucket Filter (TBF)
56800 * see net/sched/sch_tbf.c in the linux source tree
56802 @@ -136,4 +140,3 @@
56806 -MODULE_LICENSE("GPL");
56807 diff -Nru a/net/ipv6/netfilter/ip6t_mac.c b/net/ipv6/netfilter/ip6t_mac.c
56808 --- a/net/ipv6/netfilter/ip6t_mac.c Thu Mar 20 00:43:40 2003
56809 +++ b/net/ipv6/netfilter/ip6t_mac.c Sun Aug 24 05:00:28 2003
56811 #include <linux/netfilter_ipv6/ip6t_mac.h>
56812 #include <linux/netfilter_ipv6/ip6_tables.h>
56814 +MODULE_LICENSE("GPL");
56815 +MODULE_DESCRIPTION("MAC address matching module for IPv6");
56816 +MODULE_AUTHOR("Netfilter Core Teaam <coreteam@netfilter.org>");
56819 match(const struct sk_buff *skb,
56820 const struct net_device *in,
56825 -MODULE_LICENSE("GPL");
56826 -MODULE_DESCRIPTION("MAC address matching module for IPv6");
56827 diff -Nru a/net/ipv6/netfilter/ip6t_mark.c b/net/ipv6/netfilter/ip6t_mark.c
56828 --- a/net/ipv6/netfilter/ip6t_mark.c Thu Mar 20 00:43:40 2003
56829 +++ b/net/ipv6/netfilter/ip6t_mark.c Sun Aug 24 05:00:28 2003
56831 #include <linux/netfilter_ipv6/ip6t_mark.h>
56832 #include <linux/netfilter_ipv6/ip6_tables.h>
56834 +MODULE_LICENSE("GPL");
56835 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56836 +MODULE_DESCRIPTION("ip6tables mark match");
56839 match(const struct sk_buff *skb,
56840 const struct net_device *in,
56845 -MODULE_LICENSE("GPL");
56846 diff -Nru a/net/ipv6/netfilter/ip6t_multiport.c b/net/ipv6/netfilter/ip6t_multiport.c
56847 --- a/net/ipv6/netfilter/ip6t_multiport.c Thu Mar 20 00:43:40 2003
56848 +++ b/net/ipv6/netfilter/ip6t_multiport.c Sun Aug 24 05:00:28 2003
56850 #include <linux/netfilter_ipv6/ip6t_multiport.h>
56851 #include <linux/netfilter_ipv6/ip6_tables.h>
56853 +MODULE_LICENSE("GPL");
56854 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56855 +MODULE_DESCRIPTION("ip6tables match for multiple ports");
56858 #define duprintf(format, args...) printk(format , ## args)
56860 diff -Nru a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
56861 --- a/net/ipv6/netfilter/ip6table_filter.c Mon Apr 28 02:27:56 2003
56862 +++ b/net/ipv6/netfilter/ip6table_filter.c Sun Aug 24 05:00:28 2003
56864 #include <linux/module.h>
56865 #include <linux/netfilter_ipv6/ip6_tables.h>
56867 +MODULE_LICENSE("GPL");
56868 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56869 +MODULE_DESCRIPTION("ip6tables filter table");
56871 #define FILTER_VALID_HOOKS ((1 << NF_IP6_LOCAL_IN) | (1 << NF_IP6_FORWARD) | (1 << NF_IP6_LOCAL_OUT))
56873 /* Standard entry. */
56874 @@ -202,4 +206,3 @@
56878 -MODULE_LICENSE("GPL");
56879 diff -Nru a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
56880 --- a/net/ipv6/netfilter/ip6table_mangle.c Mon Apr 28 02:27:56 2003
56881 +++ b/net/ipv6/netfilter/ip6table_mangle.c Sun Aug 24 05:00:28 2003
56883 #include <linux/module.h>
56884 #include <linux/netfilter_ipv6/ip6_tables.h>
56886 +MODULE_LICENSE("GPL");
56887 +MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
56888 +MODULE_DESCRIPTION("ip6tables mangle table");
56890 #define MANGLE_VALID_HOOKS ((1 << NF_IP6_PRE_ROUTING) | \
56891 (1 << NF_IP6_LOCAL_IN) | \
56892 (1 << NF_IP6_FORWARD) | \
56893 @@ -279,4 +283,3 @@
56897 -MODULE_LICENSE("GPL");
56898 diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c
56899 --- a/net/ipv6/route.c Mon Aug 18 03:49:00 2003
56900 +++ b/net/ipv6/route.c Sat Aug 30 21:26:12 2003
56901 @@ -577,7 +577,7 @@
56902 rt->rt6i_dev = dev;
56903 rt->rt6i_nexthop = neigh;
56904 rt->rt6i_expires = 0;
56905 - rt->rt6i_flags = RTF_LOCAL;
56906 + rt->rt6i_flags = RTF_LOCAL | RTF_NDISC;
56907 rt->rt6i_metric = 0;
56908 atomic_set(&rt->u.dst.__refcnt, 1);
56909 rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255;
56910 @@ -831,7 +831,7 @@
56914 - rt->rt6i_flags = rtmsg->rtmsg_flags;
56915 + rt->rt6i_flags = rtmsg->rtmsg_flags & ~RTF_NDISC;
56918 if (rta && rta[RTA_METRICS-1]) {
56919 @@ -1123,6 +1123,8 @@
56920 static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
56922 struct rt6_info *rt = ip6_dst_alloc();
56924 + BUG_ON(ort->rt6i_flags & RTF_NDISC);
56927 rt->u.dst.input = ort->u.dst.input;
56928 diff -Nru a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
56929 --- a/net/ipv6/xfrm6_policy.c Sun Jul 27 19:22:27 2003
56930 +++ b/net/ipv6/xfrm6_policy.c Sat Aug 30 21:26:12 2003
56931 @@ -55,12 +55,22 @@
56932 __xfrm6_find_bundle(struct flowi *fl, struct rtable *rt, struct xfrm_policy *policy)
56934 struct dst_entry *dst;
56935 + u32 ndisc_bit = 0;
56937 + if (fl->proto == IPPROTO_ICMPV6 &&
56938 + (fl->fl_icmp_type == NDISC_NEIGHBOUR_ADVERTISEMENT ||
56939 + fl->fl_icmp_type == NDISC_NEIGHBOUR_SOLICITATION ||
56940 + fl->fl_icmp_type == NDISC_ROUTER_SOLICITATION))
56941 + ndisc_bit = RTF_NDISC;
56943 /* Still not clear if we should set fl->fl6_{src,dst}... */
56944 read_lock_bh(&policy->lock);
56945 for (dst = policy->bundles; dst; dst = dst->next) {
56946 struct xfrm_dst *xdst = (struct xfrm_dst*)dst;
56947 struct in6_addr fl_dst_prefix, fl_src_prefix;
56949 + if ((xdst->u.rt6.rt6i_flags & RTF_NDISC) != ndisc_bit)
56952 ipv6_addr_prefix(&fl_dst_prefix,
56954 diff -Nru a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
56955 --- a/net/ipx/af_ipx.c Wed Jun 18 13:59:01 2003
56956 +++ b/net/ipx/af_ipx.c Sat Aug 30 19:12:56 2003
56957 @@ -1365,6 +1365,7 @@
56958 atomic_read(&ipx_sock_nr));
56960 sock_init_data(sock, sk);
56961 + sk_set_owner(sk, THIS_MODULE);
56962 sk->sk_no_check = 1; /* Checksum off by default */
56965 diff -Nru a/net/irda/af_irda.c b/net/irda/af_irda.c
56966 --- a/net/irda/af_irda.c Wed Jun 4 17:57:09 2003
56967 +++ b/net/irda/af_irda.c Sat Aug 30 19:15:30 2003
56968 @@ -1098,6 +1098,7 @@
56970 /* Initialise networking socket struct */
56971 sock_init_data(sock, sk); /* Note : set sk->sk_refcnt to 1 */
56972 + sk_set_owner(sk, THIS_MODULE);
56973 sk->sk_family = PF_IRDA;
56974 sk->sk_protocol = protocol;
56975 /* Link networking socket and IrDA socket structs together */
56976 diff -Nru a/net/llc/llc_mac.c b/net/llc/llc_mac.c
56977 --- a/net/llc/llc_mac.c Wed Jun 4 17:57:09 2003
56978 +++ b/net/llc/llc_mac.c Sat Aug 30 19:09:25 2003
56981 u8 llc_mac_null_var[IFHWADDRLEN];
56983 -static void fix_up_incoming_skb(struct sk_buff *skb);
56984 +static int fix_up_incoming_skb(struct sk_buff *skb);
56985 static void llc_station_rcv(struct sk_buff *skb);
56986 static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb);
56989 skb = skb_share_check(skb, GFP_ATOMIC);
56992 - fix_up_incoming_skb(skb);
56993 + if (!fix_up_incoming_skb(skb))
56995 pdu = llc_pdu_sn_hdr(skb);
56996 if (!pdu->dsap) { /* NULL DSAP, refer to station */
56997 dprintk("%s: calling llc_station_rcv!\n", __FUNCTION__);
56998 @@ -172,11 +173,15 @@
56999 * by looking at the two lowest-order bits of the first control field
57000 * byte; field is either 3 or 4 bytes long.
57002 -static void fix_up_incoming_skb(struct sk_buff *skb)
57003 +static int fix_up_incoming_skb(struct sk_buff *skb)
57006 - struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->data;
57007 + struct llc_pdu_sn *pdu;
57009 + if (!pskb_may_pull(skb, sizeof(*pdu)))
57012 + pdu = (struct llc_pdu_sn *)skb->data;
57013 if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) == LLC_PDU_TYPE_U)
57016 @@ -188,6 +193,7 @@
57018 skb_trim(skb, data_size);
57024 diff -Nru a/net/llc/llc_main.c b/net/llc/llc_main.c
57025 --- a/net/llc/llc_main.c Mon Jun 16 08:11:36 2003
57026 +++ b/net/llc/llc_main.c Sat Aug 30 19:10:22 2003
57027 @@ -229,6 +229,7 @@
57028 if (llc_sk_init(sk))
57030 sock_init_data(NULL, sk);
57031 + sk_set_owner(sk, THIS_MODULE);
57032 #ifdef LLC_REFCNT_DEBUG
57033 atomic_inc(&llc_sock_nr);
57034 printk(KERN_DEBUG "LLC socket %p created in %s, now we have %d alive\n", sk,
57035 diff -Nru a/net/llc/llc_proc.c b/net/llc/llc_proc.c
57036 --- a/net/llc/llc_proc.c Mon Jun 16 08:11:36 2003
57037 +++ b/net/llc/llc_proc.c Sat Aug 30 19:11:23 2003
57038 @@ -245,6 +245,7 @@
57039 llc_proc_dir = proc_mkdir("llc", proc_net);
57042 + llc_proc_dir->owner = THIS_MODULE;
57044 p = create_proc_entry("socket", S_IRUGO, llc_proc_dir);
57046 diff -Nru a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
57047 --- a/net/netlink/netlink_dev.c Sun May 25 19:34:11 2003
57048 +++ b/net/netlink/netlink_dev.c Tue Aug 26 09:25:41 2003
57051 static unsigned int netlink_poll(struct file *file, poll_table * wait)
57053 - struct socket *sock = netlink_user[minor(file->f_dentry->d_inode->i_rdev)];
57054 + struct socket *sock = netlink_user[iminor(file->f_dentry->d_inode)];
57056 if (sock->ops->poll==NULL)
57059 size_t count, loff_t *pos)
57061 struct inode *inode = file->f_dentry->d_inode;
57062 - struct socket *sock = netlink_user[minor(inode->i_rdev)];
57063 + struct socket *sock = netlink_user[iminor(inode)];
57068 size_t count, loff_t *pos)
57070 struct inode *inode = file->f_dentry->d_inode;
57071 - struct socket *sock = netlink_user[minor(inode->i_rdev)];
57072 + struct socket *sock = netlink_user[iminor(inode)];
57076 @@ -100,7 +100,7 @@
57078 static int netlink_open(struct inode * inode, struct file * file)
57080 - unsigned int minor = minor(inode->i_rdev);
57081 + unsigned int minor = iminor(inode);
57082 struct socket *sock;
57083 struct sockaddr_nl nladdr;
57085 @@ -132,7 +132,7 @@
57087 static int netlink_release(struct inode * inode, struct file * file)
57089 - unsigned int minor = minor(inode->i_rdev);
57090 + unsigned int minor = iminor(inode);
57091 struct socket *sock;
57093 sock = netlink_user[minor];
57094 @@ -146,7 +146,7 @@
57095 static int netlink_ioctl(struct inode *inode, struct file *file,
57096 unsigned int cmd, unsigned long arg)
57098 - unsigned int minor = minor(inode->i_rdev);
57099 + unsigned int minor = iminor(inode);
57102 if (minor >= MAX_LINKS)
57103 diff -Nru a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
57104 --- a/net/netrom/af_netrom.c Thu Aug 14 21:16:39 2003
57105 +++ b/net/netrom/af_netrom.c Sat Aug 30 19:14:38 2003
57106 @@ -433,6 +433,7 @@
57109 sock_init_data(sock, sk);
57110 + sk_set_owner(sk, THIS_MODULE);
57112 sock->ops = &nr_proto_ops;
57113 sk->sk_protocol = protocol;
57114 @@ -473,6 +474,7 @@
57117 sock_init_data(NULL, sk);
57118 + sk_set_owner(sk, THIS_MODULE);
57120 sk->sk_type = osk->sk_type;
57121 sk->sk_socket = osk->sk_socket;
57122 diff -Nru a/net/netsyms.c b/net/netsyms.c
57123 --- a/net/netsyms.c Tue Aug 19 22:13:11 2003
57124 +++ b/net/netsyms.c Mon Sep 1 17:25:54 2003
57125 @@ -631,7 +631,10 @@
57127 EXPORT_SYMBOL(ethtool_op_get_link);
57128 EXPORT_SYMBOL(ethtool_op_get_tx_csum);
57129 +EXPORT_SYMBOL(ethtool_op_set_tx_csum);
57130 EXPORT_SYMBOL(ethtool_op_get_sg);
57131 EXPORT_SYMBOL(ethtool_op_set_sg);
57132 +EXPORT_SYMBOL(ethtool_op_get_tso);
57133 +EXPORT_SYMBOL(ethtool_op_set_tso);
57135 #endif /* CONFIG_NET */
57136 diff -Nru a/net/rose/af_rose.c b/net/rose/af_rose.c
57137 --- a/net/rose/af_rose.c Tue Aug 19 20:57:58 2003
57138 +++ b/net/rose/af_rose.c Sat Aug 30 19:14:39 2003
57139 @@ -518,6 +518,7 @@
57140 rose = rose_sk(sk);
57142 sock_init_data(sock, sk);
57143 + sk_set_owner(sk, THIS_MODULE);
57145 skb_queue_head_init(&rose->ack_queue);
57147 @@ -556,6 +557,7 @@
57148 rose = rose_sk(sk);
57150 sock_init_data(NULL, sk);
57151 + sk_set_owner(sk, THIS_MODULE);
57153 skb_queue_head_init(&rose->ack_queue);
57155 diff -Nru a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c
57156 --- a/net/rxrpc/krxiod.c Tue Feb 11 14:57:54 2003
57157 +++ b/net/rxrpc/krxiod.c Sat Aug 30 20:36:03 2003
57159 * 2 of the License, or (at your option) any later version.
57162 -#include <linux/version.h>
57163 #include <linux/sched.h>
57164 #include <linux/completion.h>
57165 #include <linux/spinlock.h>
57166 diff -Nru a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c
57167 --- a/net/rxrpc/krxsecd.c Tue Feb 11 14:57:54 2003
57168 +++ b/net/rxrpc/krxsecd.c Sat Aug 30 20:36:03 2003
57170 * - responding to security challenges on outbound connections
57173 -#include <linux/version.h>
57174 #include <linux/module.h>
57175 #include <linux/sched.h>
57176 #include <linux/completion.h>
57177 diff -Nru a/net/rxrpc/krxtimod.c b/net/rxrpc/krxtimod.c
57178 --- a/net/rxrpc/krxtimod.c Sun Apr 20 07:45:44 2003
57179 +++ b/net/rxrpc/krxtimod.c Sat Aug 30 20:36:03 2003
57181 * 2 of the License, or (at your option) any later version.
57184 -#include <linux/version.h>
57185 #include <linux/module.h>
57186 #include <linux/init.h>
57187 #include <linux/sched.h>
57188 diff -Nru a/net/sched/sch_generic.c b/net/sched/sch_generic.c
57189 --- a/net/sched/sch_generic.c Sun Apr 20 00:57:16 2003
57190 +++ b/net/sched/sch_generic.c Mon Sep 1 01:18:30 2003
57191 @@ -121,7 +121,7 @@
57192 printk(KERN_DEBUG "Dead loop on netdevice %s, fix it urgently!\n", dev->name);
57195 - netdev_rx_stat[smp_processor_id()].cpu_collision++;
57196 + __get_cpu_var(netdev_rx_stat).cpu_collision++;
57199 /* Device kicked us out :(
57200 diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c
57201 --- a/net/sctp/socket.c Mon Aug 4 10:35:40 2003
57202 +++ b/net/sctp/socket.c Thu Aug 28 01:21:04 2003
57203 @@ -852,7 +852,7 @@
57204 associd = sinfo->sinfo_assoc_id;
57207 - SCTP_DEBUG_PRINTK("msg_len: %Zd, sinfo_flags: 0x%x\n",
57208 + SCTP_DEBUG_PRINTK("msg_len: %d, sinfo_flags: 0x%x\n",
57209 msg_len, sinfo_flags);
57211 /* MSG_EOF or MSG_ABORT cannot be set on a TCP-style socket. */
57212 diff -Nru a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
57213 --- a/net/sunrpc/rpc_pipe.c Sat Jun 14 16:58:21 2003
57214 +++ b/net/sunrpc/rpc_pipe.c Sat Aug 30 20:35:33 2003
57217 #include <linux/config.h>
57218 #include <linux/module.h>
57219 -#include <linux/version.h>
57220 #include <linux/slab.h>
57221 #include <linux/string.h>
57222 #include <linux/pagemap.h>
57223 diff -Nru a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
57224 --- a/net/sunrpc/svcsock.c Mon Aug 18 15:49:47 2003
57225 +++ b/net/sunrpc/svcsock.c Sat Aug 30 20:35:33 2003
57227 #include <linux/inet.h>
57228 #include <linux/udp.h>
57229 #include <linux/tcp.h>
57230 -#include <linux/version.h>
57231 #include <linux/unistd.h>
57232 #include <linux/slab.h>
57233 #include <linux/netdevice.h>
57234 diff -Nru a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
57235 --- a/net/sunrpc/sysctl.c Mon Aug 11 22:33:48 2003
57236 +++ b/net/sunrpc/sysctl.c Sat Aug 30 20:35:33 2003
57240 #include <linux/config.h>
57241 -#include <linux/version.h>
57242 #include <linux/types.h>
57243 #include <linux/linkage.h>
57244 #include <linux/ctype.h>
57245 diff -Nru a/net/sunrpc/timer.c b/net/sunrpc/timer.c
57246 --- a/net/sunrpc/timer.c Thu Aug 21 18:32:56 2003
57247 +++ b/net/sunrpc/timer.c Sat Aug 30 20:35:33 2003
57250 #include <asm/param.h>
57252 -#include <linux/version.h>
57253 #include <linux/types.h>
57254 #include <linux/unistd.h>
57256 diff -Nru a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
57257 --- a/net/sunrpc/xprt.c Thu Aug 21 18:41:58 2003
57258 +++ b/net/sunrpc/xprt.c Sat Aug 30 20:35:33 2003
57261 #define __KERNEL_SYSCALLS__
57263 -#include <linux/version.h>
57264 #include <linux/types.h>
57265 #include <linux/slab.h>
57266 #include <linux/capability.h>
57267 diff -Nru a/net/x25/af_x25.c b/net/x25/af_x25.c
57268 --- a/net/x25/af_x25.c Tue Aug 5 17:31:06 2003
57269 +++ b/net/x25/af_x25.c Sat Aug 30 19:14:39 2003
57270 @@ -449,6 +449,7 @@
57273 sock_init_data(NULL, sk);
57274 + sk_set_owner(sk, THIS_MODULE);
57276 skb_queue_head_init(&x25->ack_queue);
57277 skb_queue_head_init(&x25->fragment_queue);
57278 @@ -478,6 +479,7 @@
57281 sock_init_data(sock, sk);
57282 + sk_set_owner(sk, THIS_MODULE);
57284 init_timer(&x25->timer);
57286 diff -Nru a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
57287 --- a/net/xfrm/xfrm_user.c Thu Aug 7 21:04:46 2003
57288 +++ b/net/xfrm/xfrm_user.c Mon Sep 1 01:12:32 2003
57289 @@ -1195,3 +1195,4 @@
57291 module_init(xfrm_user_init);
57292 module_exit(xfrm_user_exit);
57293 +MODULE_LICENSE("GPL");
57294 diff -Nru a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
57295 --- a/scripts/kconfig/Makefile Tue Aug 19 09:27:03 2003
57296 +++ b/scripts/kconfig/Makefile Sun Aug 31 16:13:49 2003
57298 # Kernel configuration targets
57299 # These targets are used from top-level makefile
57301 -.PHONY: oldconfig xconfig gconfig menuconfig config
57302 +.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig
57304 -xconfig: scripts/kconfig/qconf
57305 - ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
57306 +xconfig: $(obj)/qconf
57307 + $< arch/$(ARCH)/Kconfig
57309 -gconfig: scripts/kconfig/gconf
57310 - ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig
57311 +gconfig: $(obj)/gconf
57312 + ./$< arch/$(ARCH)/Kconfig
57314 -menuconfig: scripts/kconfig/mconf
57315 +menuconfig: $(obj)/mconf
57316 $(Q)$(MAKE) $(build)=scripts/lxdialog
57317 - ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
57318 + $< arch/$(ARCH)/Kconfig
57320 -config: scripts/kconfig/conf
57321 - ./scripts/kconfig/conf arch/$(ARCH)/Kconfig
57322 +config: $(obj)/conf
57323 + $< arch/$(ARCH)/Kconfig
57325 -oldconfig: scripts/kconfig/conf
57326 - ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig
57327 +oldconfig: $(obj)/conf
57328 + $< -o arch/$(ARCH)/Kconfig
57330 +silentoldconfig: $(obj)/conf
57331 + $< -s arch/$(ARCH)/Kconfig
57333 .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
57335 -randconfig: scripts/kconfig/conf
57336 - ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig
57337 +randconfig: $(obj)/conf
57338 + $< -r arch/$(ARCH)/Kconfig
57340 -allyesconfig: scripts/kconfig/conf
57341 - ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig
57342 +allyesconfig: $(obj)/conf
57343 + $< -y arch/$(ARCH)/Kconfig
57345 -allnoconfig: scripts/kconfig/conf
57346 - ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig
57347 +allnoconfig: $(obj)/conf
57348 + $< -n arch/$(ARCH)/Kconfig
57350 -allmodconfig: scripts/kconfig/conf
57351 - ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig
57352 +allmodconfig: $(obj)/conf
57353 + $< -m arch/$(ARCH)/Kconfig
57355 -defconfig: scripts/kconfig/conf
57356 - ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig
57357 +defconfig: $(obj)/conf
57358 + $< -d arch/$(ARCH)/Kconfig
57360 # Help text used by make help
57362 diff -Nru a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
57363 --- a/scripts/kconfig/symbol.c Fri Jun 6 01:28:22 2003
57364 +++ b/scripts/kconfig/symbol.c Sun Aug 31 16:14:08 2003
57365 @@ -12,21 +12,21 @@
57368 struct symbol symbol_yes = {
57370 - curr: { "y", yes },
57371 - flags: SYMBOL_YES|SYMBOL_VALID,
57373 + .curr = { "y", yes },
57374 + .flags = SYMBOL_YES|SYMBOL_VALID,
57377 - curr: { "m", mod },
57378 - flags: SYMBOL_MOD|SYMBOL_VALID,
57380 + .curr = { "m", mod },
57381 + .flags = SYMBOL_MOD|SYMBOL_VALID,
57384 - curr: { "n", no },
57385 - flags: SYMBOL_NO|SYMBOL_VALID,
57387 + .curr = { "n", no },
57388 + .flags = SYMBOL_NO|SYMBOL_VALID,
57389 }, symbol_empty = {
57391 - curr: { "", no },
57392 - flags: SYMBOL_VALID,
57394 + .curr = { "", no },
57395 + .flags = SYMBOL_VALID,
57398 int sym_change_count;
57399 diff -Nru a/security/capability.c b/security/capability.c
57400 --- a/security/capability.c Wed Jul 2 21:22:38 2003
57401 +++ b/security/capability.c Sun Aug 31 16:14:14 2003
57402 @@ -295,12 +295,7 @@
57404 vm_acct_memory(pages);
57407 - * Sometimes we want to use more memory than we have
57409 - if (sysctl_overcommit_memory == 1)
57412 + /* We estimate memory ourselves (common case) */
57413 if (sysctl_overcommit_memory == 0) {
57414 free = get_page_cache_size();
57415 free += nr_free_pages();
57416 @@ -322,10 +317,16 @@
57421 vm_unacct_memory(pages);
57425 + /* Kernel assumes allocation */
57426 + if (sysctl_overcommit_memory == 1)
57429 + /* sysctl_overcommit_memory must be 2 which means strict_overcommit*/
57430 allowed = totalram_pages * sysctl_overcommit_ratio / 100;
57431 allowed += total_swap_pages;
57433 diff -Nru a/security/selinux/hooks.c b/security/selinux/hooks.c
57434 --- a/security/selinux/hooks.c Mon Aug 18 22:27:19 2003
57435 +++ b/security/selinux/hooks.c Sun Aug 31 16:14:20 2003
57436 @@ -1332,31 +1332,19 @@
57438 static int selinux_bprm_alloc_security(struct linux_binprm *bprm)
57441 + struct bprm_security_struct *bsec;
57443 - /* Make sure that the secondary module doesn't use the
57444 - bprm->security field, since we do not yet support chaining
57445 - of multiple security structures on the field. Neither
57446 - the dummy nor the capability module use the field. The owlsm
57447 - module uses the field if CONFIG_OWLSM_FD is enabled. */
57448 - rc = secondary_ops->bprm_alloc_security(bprm);
57451 - if (bprm->security) {
57452 - printk(KERN_WARNING "%s: no support yet for chaining on the "
57453 - "security field by secondary modules.\n", __FUNCTION__);
57454 - /* Release the secondary module's security object. */
57455 - secondary_ops->bprm_free_security(bprm);
57456 - /* Unregister the secondary module to prevent problems
57457 - with subsequent binprm hooks. This will revert to the
57458 - original (dummy) module for the secondary operations. */
57459 - rc = security_ops->unregister_security("unknown", secondary_ops);
57462 - printk(KERN_WARNING "%s: Unregistered the secondary security "
57463 - "module.\n", __FUNCTION__);
57465 - bprm->security = NULL;
57466 + bsec = kmalloc(sizeof(struct bprm_security_struct), GFP_KERNEL);
57470 + memset(bsec, 0, sizeof *bsec);
57471 + bsec->magic = SELINUX_MAGIC;
57472 + bsec->bprm = bprm;
57473 + bsec->sid = SECINITSID_UNLABELED;
57476 + bprm->security = bsec;
57480 @@ -1365,6 +1353,7 @@
57481 struct task_security_struct *tsec;
57482 struct inode *inode = bprm->file->f_dentry->d_inode;
57483 struct inode_security_struct *isec;
57484 + struct bprm_security_struct *bsec;
57486 struct avc_audit_data ad;
57488 @@ -1373,15 +1362,16 @@
57492 - if (bprm->sh_bang || bprm->security)
57493 - /* The security field should already be set properly. */
57494 + bsec = bprm->security;
57499 tsec = current->security;
57500 isec = inode->i_security;
57502 /* Default to the current task SID. */
57503 - bprm->security = (void *)tsec->sid;
57504 + bsec->sid = tsec->sid;
57506 /* Reset create SID on execve. */
57507 tsec->create_sid = 0;
57508 @@ -1427,9 +1417,10 @@
57511 /* Set the security field to the new SID. */
57512 - bprm->security = (void*) newsid;
57513 + bsec->sid = newsid;
57520 @@ -1463,8 +1454,9 @@
57522 static void selinux_bprm_free_security(struct linux_binprm *bprm)
57524 - /* Nothing to do - not dynamically allocated. */
57526 + struct bprm_security_struct *bsec = bprm->security;
57527 + bprm->security = NULL;
57531 /* Derived from fs/exec.c:flush_old_files. */
57532 @@ -1509,6 +1501,7 @@
57533 static void selinux_bprm_compute_creds(struct linux_binprm *bprm)
57535 struct task_security_struct *tsec, *psec;
57536 + struct bprm_security_struct *bsec;
57538 struct av_decision avd;
57540 @@ -1517,9 +1510,8 @@
57542 tsec = current->security;
57544 - sid = (u32)bprm->security;
57547 + bsec = bprm->security;
57550 tsec->osid = tsec->sid;
57551 if (tsec->sid != sid) {
57552 @@ -2057,9 +2049,11 @@
57556 +#if BITS_PER_LONG == 32
57561 if (!file->f_dentry || !file->f_dentry->d_inode) {
57564 @@ -3112,9 +3106,8 @@
57565 char *name, void *value, size_t size)
57567 struct task_security_struct *tsec;
57574 if (current != p) {
57575 diff -Nru a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
57576 --- a/security/selinux/include/objsec.h Thu Aug 14 18:17:44 2003
57577 +++ b/security/selinux/include/objsec.h Sun Aug 31 16:14:20 2003
57579 #include <linux/list.h>
57580 #include <linux/sched.h>
57581 #include <linux/fs.h>
57582 +#include <linux/binfmts.h>
57583 #include <linux/in.h>
57587 u16 sclass; /* security class of this object */
57588 u32 sid; /* SID of IPC resource */
57589 struct avc_entry_ref avcr; /* reference to permissions */
57592 +struct bprm_security_struct {
57593 + unsigned long magic; /* magic number for this module */
57594 + struct linux_binprm *bprm; /* back pointer to bprm object */
57595 + u32 sid; /* SID for transformed process */
57596 + unsigned char set;
57599 extern int inode_security_set_sid(struct inode *inode, u32 sid);
57600 diff -Nru a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
57601 --- a/security/selinux/ss/avtab.c Thu Jul 17 02:38:01 2003
57602 +++ b/security/selinux/ss/avtab.c Sun Aug 31 16:14:19 2003
57603 @@ -106,7 +106,7 @@
57605 h->htable[i] = NULL;
57607 - kfree(h->htable);
57608 + vfree(h->htable);
57612 @@ -138,7 +138,7 @@
57616 - h->htable = kmalloc(sizeof(*(h->htable)) * AVTAB_SIZE, GFP_KERNEL);
57617 + h->htable = vmalloc(sizeof(*(h->htable)) * AVTAB_SIZE);
57620 for (i = 0; i < AVTAB_SIZE; i++)
57621 diff -Nru a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
57622 --- a/security/selinux/ss/ebitmap.c Thu Jul 17 02:38:01 2003
57623 +++ b/security/selinux/ss/ebitmap.c Sun Aug 31 16:14:19 2003
57624 @@ -250,8 +250,8 @@
57625 count = le32_to_cpu(buf[2]);
57627 if (mapsize != MAPSIZE) {
57628 - printk(KERN_ERR "security: ebitmap: map size %d does not "
57629 - "match my size %d (high bit was %d)\n", mapsize,
57630 + printk(KERN_ERR "security: ebitmap: map size %u does not "
57631 + "match my size %Zd (high bit was %d)\n", mapsize,
57632 MAPSIZE, e->highbit);
57635 @@ -261,7 +261,7 @@
57637 if (e->highbit & (MAPSIZE - 1)) {
57638 printk(KERN_ERR "security: ebitmap: high bit (%d) is not a "
57639 - "multiple of the map size (%d)\n", e->highbit, MAPSIZE);
57640 + "multiple of the map size (%Zd)\n", e->highbit, MAPSIZE);
57644 @@ -283,13 +283,13 @@
57646 if (n->startbit & (MAPSIZE - 1)) {
57647 printk(KERN_ERR "security: ebitmap start bit (%d) is "
57648 - "not a multiple of the map size (%d)\n",
57649 + "not a multiple of the map size (%Zd)\n",
57650 n->startbit, MAPSIZE);
57653 if (n->startbit > (e->highbit - MAPSIZE)) {
57654 printk(KERN_ERR "security: ebitmap start bit (%d) is "
57655 - "beyond the end of the bitmap (%d)\n",
57656 + "beyond the end of the bitmap (%Zd)\n",
57657 n->startbit, (e->highbit - MAPSIZE));
57660 diff -Nru a/security/selinux/ss/global.h b/security/selinux/ss/global.h
57661 --- a/security/selinux/ss/global.h Sun Aug 10 04:22:59 2003
57662 +++ b/security/selinux/ss/global.h Sun Aug 31 16:14:19 2003
57664 #include <linux/in.h>
57665 #include <linux/spinlock.h>
57666 #include <linux/sched.h>
57667 +#include <linux/vmalloc.h>
57671 diff -Nru a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
57672 --- a/security/selinux/ss/policydb.c Mon Aug 18 22:27:19 2003
57673 +++ b/security/selinux/ss/policydb.c Sun Aug 31 16:14:19 2003
57674 @@ -1074,7 +1074,7 @@
57676 if (len != strlen(POLICYDB_STRING)) {
57677 printk(KERN_ERR "security: policydb string length %d does not "
57678 - "match expected length %d\n",
57679 + "match expected length %Zd\n",
57680 len, strlen(POLICYDB_STRING));
57683 diff -Nru a/sound/core/control.c b/sound/core/control.c
57684 --- a/sound/core/control.c Mon Jul 21 02:29:40 2003
57685 +++ b/sound/core/control.c Tue Aug 26 09:25:41 2003
57688 static int snd_ctl_open(struct inode *inode, struct file *file)
57690 - int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
57691 + int cardnum = SNDRV_MINOR_CARD(iminor(inode));
57692 unsigned long flags;
57694 snd_ctl_file_t *ctl;
57695 diff -Nru a/sound/core/hwdep.c b/sound/core/hwdep.c
57696 --- a/sound/core/hwdep.c Sun Jun 1 11:47:53 2003
57697 +++ b/sound/core/hwdep.c Tue Aug 26 09:25:41 2003
57700 static int snd_hwdep_open(struct inode *inode, struct file * file)
57702 - int major = major(inode->i_rdev);
57703 + int major = imajor(inode);
57707 @@ -82,12 +82,12 @@
57710 case CONFIG_SND_MAJOR:
57711 - cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
57712 - device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev)) - SNDRV_MINOR_HWDEP;
57713 + cardnum = SNDRV_MINOR_CARD(iminor(inode));
57714 + device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP;
57716 #ifdef CONFIG_SND_OSSEMUL
57718 - cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
57719 + cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
57723 diff -Nru a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
57724 --- a/sound/core/oss/mixer_oss.c Sun Jun 1 11:47:53 2003
57725 +++ b/sound/core/oss/mixer_oss.c Tue Aug 26 09:25:41 2003
57728 static int snd_mixer_oss_open(struct inode *inode, struct file *file)
57730 - int cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
57731 + int cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
57733 snd_mixer_oss_file_t *fmixer;
57735 diff -Nru a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
57736 --- a/sound/core/oss/pcm_oss.c Fri Aug 15 19:54:09 2003
57737 +++ b/sound/core/oss/pcm_oss.c Tue Aug 26 09:25:41 2003
57738 @@ -1681,7 +1681,7 @@
57740 static int snd_pcm_oss_open(struct inode *inode, struct file *file)
57742 - int minor = minor(inode->i_rdev);
57743 + int minor = iminor(inode);
57744 int cardnum = SNDRV_MINOR_OSS_CARD(minor);
57747 diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
57748 --- a/sound/core/pcm_native.c Mon Jul 28 04:35:00 2003
57749 +++ b/sound/core/pcm_native.c Tue Aug 26 09:25:41 2003
57750 @@ -1431,11 +1431,11 @@
57752 inode = file->f_dentry->d_inode;
57753 if (!S_ISCHR(inode->i_mode) ||
57754 - major(inode->i_rdev) != snd_major) {
57755 + imajor(inode) != snd_major) {
57759 - minor = minor(inode->i_rdev);
57760 + minor = iminor(inode);
57761 if (minor >= 256 ||
57762 minor % SNDRV_MINOR_DEVICES < SNDRV_MINOR_PCM_PLAYBACK) {
57764 @@ -1940,8 +1940,8 @@
57766 int snd_pcm_open(struct inode *inode, struct file *file)
57768 - int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
57769 - int device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev));
57770 + int cardnum = SNDRV_MINOR_CARD(iminor(inode));
57771 + int device = SNDRV_MINOR_DEVICE(iminor(inode));
57774 snd_pcm_file_t *pcm_file;
57775 diff -Nru a/sound/core/rawmidi.c b/sound/core/rawmidi.c
57776 --- a/sound/core/rawmidi.c Mon Jul 28 04:35:00 2003
57777 +++ b/sound/core/rawmidi.c Tue Aug 26 09:25:41 2003
57778 @@ -345,7 +345,7 @@
57780 static int snd_rawmidi_open(struct inode *inode, struct file *file)
57782 - int maj = major(inode->i_rdev);
57783 + int maj = imajor(inode);
57786 int device, subdevice;
57787 @@ -359,16 +359,16 @@
57790 case CONFIG_SND_MAJOR:
57791 - cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev));
57792 + cardnum = SNDRV_MINOR_CARD(iminor(inode));
57793 cardnum %= SNDRV_CARDS;
57794 - device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev)) - SNDRV_MINOR_RAWMIDI;
57795 + device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_RAWMIDI;
57796 device %= SNDRV_MINOR_RAWMIDIS;
57798 #ifdef CONFIG_SND_OSSEMUL
57800 - cardnum = SNDRV_MINOR_OSS_CARD(minor(inode->i_rdev));
57801 + cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
57802 cardnum %= SNDRV_CARDS;
57803 - device = SNDRV_MINOR_OSS_DEVICE(minor(inode->i_rdev)) == SNDRV_MINOR_OSS_MIDI ?
57804 + device = SNDRV_MINOR_OSS_DEVICE(iminor(inode)) == SNDRV_MINOR_OSS_MIDI ?
57805 midi_map[cardnum] : amidi_map[cardnum];
57808 diff -Nru a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
57809 --- a/sound/core/seq/oss/seq_oss.c Sun Jun 1 11:47:54 2003
57810 +++ b/sound/core/seq/oss/seq_oss.c Tue Aug 26 09:25:41 2003
57811 @@ -121,7 +121,7 @@
57815 - if (minor(inode->i_rdev) == SNDRV_MINOR_OSS_MUSIC)
57816 + if (iminor(inode) == SNDRV_MINOR_OSS_MUSIC)
57817 level = SNDRV_SEQ_OSS_MODE_MUSIC;
57819 level = SNDRV_SEQ_OSS_MODE_SYNTH;
57820 diff -Nru a/sound/core/sound.c b/sound/core/sound.c
57821 --- a/sound/core/sound.c Mon Jul 28 04:35:00 2003
57822 +++ b/sound/core/sound.c Tue Aug 26 09:25:41 2003
57823 @@ -117,7 +117,7 @@
57825 static int snd_open(struct inode *inode, struct file *file)
57827 - int minor = minor(inode->i_rdev);
57828 + int minor = iminor(inode);
57829 int card = SNDRV_MINOR_CARD(minor);
57830 int dev = SNDRV_MINOR_DEVICE(minor);
57831 snd_minor_t *mptr = NULL;
57832 diff -Nru a/sound/oss/ad1889.c b/sound/oss/ad1889.c
57833 --- a/sound/oss/ad1889.c Sat Aug 2 23:59:09 2003
57834 +++ b/sound/oss/ad1889.c Tue Aug 26 09:25:41 2003
57835 @@ -755,7 +755,7 @@
57836 static int ad1889_open(struct inode *inode, struct file *file)
57838 /* check minor; only support /dev/dsp atm */
57839 - if (minor(inode->i_rdev) != 3)
57840 + if (iminor(inode) != 3)
57843 file->private_data = ad1889_dev;
57844 @@ -788,7 +788,7 @@
57845 /************************* /dev/mixer interfaces ************************ */
57846 static int ad1889_mixer_open(struct inode *inode, struct file *file)
57848 - if (ad1889_dev->ac97_codec->dev_mixer != minor(inode->i_rdev))
57849 + if (ad1889_dev->ac97_codec->dev_mixer != iminor(inode))
57852 file->private_data = ad1889_dev->ac97_codec;
57853 diff -Nru a/sound/oss/ali5455.c b/sound/oss/ali5455.c
57854 --- a/sound/oss/ali5455.c Sat Aug 2 23:59:09 2003
57855 +++ b/sound/oss/ali5455.c Tue Aug 26 09:25:41 2003
57856 @@ -3026,7 +3026,7 @@
57857 static int ali_open_mixdev(struct inode *inode, struct file *file)
57860 - int minor = minor(inode->i_rdev);
57861 + int minor = iminor(inode);
57862 struct ali_card *card = devs;
57863 for (card = devs; card != NULL; card = card->next) {
57865 diff -Nru a/sound/oss/au1000.c b/sound/oss/au1000.c
57866 --- a/sound/oss/au1000.c Sat Aug 2 23:59:09 2003
57867 +++ b/sound/oss/au1000.c Tue Aug 26 09:25:41 2003
57868 @@ -1842,7 +1842,7 @@
57870 static int au1000_open(struct inode *inode, struct file *file)
57872 - int minor = MINOR(inode->i_rdev);
57873 + int minor = iminor(inode);
57874 DECLARE_WAITQUEUE(wait, current);
57875 struct au1000_state *s = &au1000_state;
57877 diff -Nru a/sound/oss/btaudio.c b/sound/oss/btaudio.c
57878 --- a/sound/oss/btaudio.c Tue Aug 12 13:28:49 2003
57879 +++ b/sound/oss/btaudio.c Tue Aug 26 09:25:41 2003
57880 @@ -299,7 +299,7 @@
57882 static int btaudio_mixer_open(struct inode *inode, struct file *file)
57884 - int minor = minor(inode->i_rdev);
57885 + int minor = iminor(inode);
57886 struct btaudio *bta;
57888 for (bta = btaudios; bta != NULL; bta = bta->next)
57889 @@ -458,7 +458,7 @@
57891 static int btaudio_dsp_open_digital(struct inode *inode, struct file *file)
57893 - int minor = minor(inode->i_rdev);
57894 + int minor = iminor(inode);
57895 struct btaudio *bta;
57897 for (bta = btaudios; bta != NULL; bta = bta->next)
57898 @@ -474,7 +474,7 @@
57900 static int btaudio_dsp_open_analog(struct inode *inode, struct file *file)
57902 - int minor = minor(inode->i_rdev);
57903 + int minor = iminor(inode);
57904 struct btaudio *bta;
57906 for (bta = btaudios; bta != NULL; bta = bta->next)
57907 diff -Nru a/sound/oss/cmpci.c b/sound/oss/cmpci.c
57908 --- a/sound/oss/cmpci.c Wed Jul 23 08:32:08 2003
57909 +++ b/sound/oss/cmpci.c Tue Aug 26 09:25:41 2003
57910 @@ -1448,7 +1448,7 @@
57912 static int cm_open_mixdev(struct inode *inode, struct file *file)
57914 - int minor = minor(inode->i_rdev);
57915 + int minor = iminor(inode);
57916 struct cm_state *s = devs;
57918 while (s && s->dev_mixer != minor)
57919 @@ -2207,7 +2207,7 @@
57921 static int cm_open(struct inode *inode, struct file *file)
57923 - int minor = minor(inode->i_rdev);
57924 + int minor = iminor(inode);
57925 struct cm_state *s = devs;
57926 unsigned char fmtm = ~0, fmts = 0;
57928 @@ -2462,7 +2462,7 @@
57930 static int cm_midi_open(struct inode *inode, struct file *file)
57932 - int minor = minor(inode->i_rdev);
57933 + int minor = iminor(inode);
57934 struct cm_state *s = devs;
57935 unsigned long flags;
57937 @@ -2679,7 +2679,7 @@
57939 static int cm_dmfm_open(struct inode *inode, struct file *file)
57941 - int minor = minor(inode->i_rdev);
57942 + int minor = iminor(inode);
57943 struct cm_state *s = devs;
57945 while (s && s->dev_dmfm != minor)
57946 diff -Nru a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
57947 --- a/sound/oss/cs4281/cs4281m.c Thu Jul 31 08:58:39 2003
57948 +++ b/sound/oss/cs4281/cs4281m.c Tue Aug 26 09:25:41 2003
57949 @@ -2567,7 +2567,7 @@
57951 static int cs4281_open_mixdev(struct inode *inode, struct file *file)
57953 - unsigned int minor = minor(inode->i_rdev);
57954 + unsigned int minor = iminor(inode);
57955 struct cs4281_state *s=NULL;
57956 struct list_head *entry;
57958 @@ -3624,7 +3624,7 @@
57960 static int cs4281_open(struct inode *inode, struct file *file)
57962 - unsigned int minor = minor(inode->i_rdev);
57963 + unsigned int minor = iminor(inode);
57964 struct cs4281_state *s=NULL;
57965 struct list_head *entry;
57967 @@ -3966,7 +3966,7 @@
57968 static int cs4281_midi_open(struct inode *inode, struct file *file)
57970 unsigned long flags, temp1;
57971 - unsigned int minor = minor(inode->i_rdev);
57972 + unsigned int minor = iminor(inode);
57973 struct cs4281_state *s=NULL;
57974 struct list_head *entry;
57975 list_for_each(entry, &cs4281_devs)
57976 diff -Nru a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
57977 --- a/sound/oss/cs46xx.c Tue Aug 12 13:28:49 2003
57978 +++ b/sound/oss/cs46xx.c Tue Aug 26 09:25:41 2003
57979 @@ -1838,7 +1838,7 @@
57981 static int cs_midi_open(struct inode *inode, struct file *file)
57983 - unsigned int minor = minor(inode->i_rdev);
57984 + unsigned int minor = iminor(inode);
57985 struct cs_card *card=NULL;
57986 unsigned long flags;
57987 struct list_head *entry;
57988 @@ -3200,7 +3200,7 @@
57989 struct cs_state *state = NULL;
57990 struct dmabuf *dmabuf = NULL;
57991 struct list_head *entry;
57992 - unsigned int minor = minor(inode->i_rdev);
57993 + unsigned int minor = iminor(inode);
57997 @@ -4066,7 +4066,7 @@
57998 static int cs_open_mixdev(struct inode *inode, struct file *file)
58001 - unsigned int minor = minor(inode->i_rdev);
58002 + unsigned int minor = iminor(inode);
58003 struct cs_card *card=NULL;
58004 struct list_head *entry;
58006 @@ -4113,7 +4113,7 @@
58008 static int cs_release_mixdev(struct inode *inode, struct file *file)
58010 - unsigned int minor = minor(inode->i_rdev);
58011 + unsigned int minor = iminor(inode);
58012 struct cs_card *card=NULL;
58013 struct list_head *entry;
58015 diff -Nru a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
58016 --- a/sound/oss/dmasound/dmasound_core.c Tue Aug 12 13:28:49 2003
58017 +++ b/sound/oss/dmasound/dmasound_core.c Tue Aug 26 09:25:41 2003
58018 @@ -904,7 +904,7 @@
58019 O_RDONLY and dsp1 could be opened O_WRONLY
58022 - dmasound.minDev = minor(inode->i_rdev) & 0x0f;
58023 + dmasound.minDev = iminor(inode) & 0x0f;
58025 /* OK. - we should make some attempt at consistency. At least the H'ware
58026 options should be set with a valid mode. We will make it that the LL
58027 diff -Nru a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c
58028 --- a/sound/oss/emu10k1/audio.c Tue Jul 15 10:35:45 2003
58029 +++ b/sound/oss/emu10k1/audio.c Tue Aug 26 09:25:41 2003
58030 @@ -1112,7 +1112,7 @@
58032 static int emu10k1_audio_open(struct inode *inode, struct file *file)
58034 - int minor = minor(inode->i_rdev);
58035 + int minor = iminor(inode);
58036 struct emu10k1_card *card = NULL;
58037 struct list_head *entry;
58038 struct emu10k1_wavedevice *wave_dev;
58039 diff -Nru a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
58040 --- a/sound/oss/emu10k1/midi.c Thu Apr 3 14:52:57 2003
58041 +++ b/sound/oss/emu10k1/midi.c Tue Aug 26 09:25:41 2003
58044 static int emu10k1_midi_open(struct inode *inode, struct file *file)
58046 - int minor = minor(inode->i_rdev);
58047 + int minor = iminor(inode);
58048 struct emu10k1_card *card = NULL;
58049 struct emu10k1_mididevice *midi_dev;
58050 struct list_head *entry;
58051 diff -Nru a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c
58052 --- a/sound/oss/emu10k1/mixer.c Tue Jul 15 10:35:45 2003
58053 +++ b/sound/oss/emu10k1/mixer.c Tue Aug 26 09:25:41 2003
58054 @@ -654,7 +654,7 @@
58056 static int emu10k1_mixer_open(struct inode *inode, struct file *file)
58058 - int minor = minor(inode->i_rdev);
58059 + int minor = iminor(inode);
58060 struct emu10k1_card *card = NULL;
58061 struct list_head *entry;
58063 diff -Nru a/sound/oss/es1370.c b/sound/oss/es1370.c
58064 --- a/sound/oss/es1370.c Tue Aug 12 16:21:59 2003
58065 +++ b/sound/oss/es1370.c Tue Aug 26 09:25:41 2003
58066 @@ -1023,7 +1023,7 @@
58068 static int es1370_open_mixdev(struct inode *inode, struct file *file)
58070 - unsigned int minor = minor(inode->i_rdev);
58071 + unsigned int minor = iminor(inode);
58072 struct list_head *list;
58073 struct es1370_state *s;
58075 @@ -1727,7 +1727,7 @@
58077 static int es1370_open(struct inode *inode, struct file *file)
58079 - unsigned int minor = minor(inode->i_rdev);
58080 + unsigned int minor = iminor(inode);
58081 DECLARE_WAITQUEUE(wait, current);
58082 unsigned long flags;
58083 struct list_head *list;
58084 @@ -2165,7 +2165,7 @@
58086 static int es1370_open_dac(struct inode *inode, struct file *file)
58088 - unsigned int minor = minor(inode->i_rdev);
58089 + unsigned int minor = iminor(inode);
58090 DECLARE_WAITQUEUE(wait, current);
58091 unsigned long flags;
58092 struct list_head *list;
58093 @@ -2408,7 +2408,7 @@
58095 static int es1370_midi_open(struct inode *inode, struct file *file)
58097 - unsigned int minor = minor(inode->i_rdev);
58098 + unsigned int minor = iminor(inode);
58099 DECLARE_WAITQUEUE(wait, current);
58100 unsigned long flags;
58101 struct list_head *list;
58102 diff -Nru a/sound/oss/es1371.c b/sound/oss/es1371.c
58103 --- a/sound/oss/es1371.c Tue Aug 12 13:28:49 2003
58104 +++ b/sound/oss/es1371.c Tue Aug 26 09:25:41 2003
58105 @@ -1210,7 +1210,7 @@
58107 static int es1371_open_mixdev(struct inode *inode, struct file *file)
58109 - int minor = minor(inode->i_rdev);
58110 + int minor = iminor(inode);
58111 struct list_head *list;
58112 struct es1371_state *s;
58114 @@ -1914,7 +1914,7 @@
58116 static int es1371_open(struct inode *inode, struct file *file)
58118 - int minor = minor(inode->i_rdev);
58119 + int minor = iminor(inode);
58120 DECLARE_WAITQUEUE(wait, current);
58121 unsigned long flags;
58122 struct list_head *list;
58123 @@ -2345,7 +2345,7 @@
58125 static int es1371_open_dac(struct inode *inode, struct file *file)
58127 - int minor = minor(inode->i_rdev);
58128 + int minor = iminor(inode);
58129 DECLARE_WAITQUEUE(wait, current);
58130 unsigned long flags;
58131 struct list_head *list;
58132 @@ -2587,7 +2587,7 @@
58134 static int es1371_midi_open(struct inode *inode, struct file *file)
58136 - int minor = minor(inode->i_rdev);
58137 + int minor = iminor(inode);
58138 DECLARE_WAITQUEUE(wait, current);
58139 unsigned long flags;
58140 struct list_head *list;
58141 diff -Nru a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
58142 --- a/sound/oss/esssolo1.c Thu Jul 31 08:58:39 2003
58143 +++ b/sound/oss/esssolo1.c Tue Aug 26 09:25:41 2003
58144 @@ -913,7 +913,7 @@
58146 static int solo1_open_mixdev(struct inode *inode, struct file *file)
58148 - unsigned int minor = minor(inode->i_rdev);
58149 + unsigned int minor = iminor(inode);
58150 struct solo1_state *s = NULL;
58151 struct pci_dev *pci_dev = NULL;
58153 @@ -1594,7 +1594,7 @@
58155 static int solo1_open(struct inode *inode, struct file *file)
58157 - unsigned int minor = minor(inode->i_rdev);
58158 + unsigned int minor = iminor(inode);
58159 DECLARE_WAITQUEUE(wait, current);
58160 struct solo1_state *s = NULL;
58161 struct pci_dev *pci_dev = NULL;
58162 @@ -1884,7 +1884,7 @@
58164 static int solo1_midi_open(struct inode *inode, struct file *file)
58166 - unsigned int minor = minor(inode->i_rdev);
58167 + unsigned int minor = iminor(inode);
58168 DECLARE_WAITQUEUE(wait, current);
58169 unsigned long flags;
58170 struct solo1_state *s = NULL;
58171 @@ -2106,7 +2106,7 @@
58173 static int solo1_dmfm_open(struct inode *inode, struct file *file)
58175 - unsigned int minor = minor(inode->i_rdev);
58176 + unsigned int minor = iminor(inode);
58177 DECLARE_WAITQUEUE(wait, current);
58178 struct solo1_state *s = NULL;
58179 struct pci_dev *pci_dev = NULL;
58180 diff -Nru a/sound/oss/hal2.c b/sound/oss/hal2.c
58181 --- a/sound/oss/hal2.c Sat Aug 2 23:59:09 2003
58182 +++ b/sound/oss/hal2.c Tue Aug 26 09:25:41 2003
58183 @@ -867,7 +867,7 @@
58185 static int hal2_open_mixdev(struct inode *inode, struct file *file)
58187 - hal2_card_t *hal2 = hal2_mixer_find_card(MINOR(inode->i_rdev));
58188 + hal2_card_t *hal2 = hal2_mixer_find_card(iminor(inode));
58191 file->private_data = hal2;
58192 @@ -1242,7 +1242,7 @@
58193 static int hal2_open(struct inode *inode, struct file *file)
58196 - hal2_card_t *hal2 = hal2_dsp_find_card(MINOR(inode->i_rdev));
58197 + hal2_card_t *hal2 = hal2_dsp_find_card(iminor(inode));
58199 DEBUG("opening audio device.\n");
58201 diff -Nru a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
58202 --- a/sound/oss/i810_audio.c Tue Aug 12 16:21:48 2003
58203 +++ b/sound/oss/i810_audio.c Tue Aug 26 09:25:41 2003
58204 @@ -2648,7 +2648,7 @@
58205 static int i810_open_mixdev(struct inode *inode, struct file *file)
58208 - int minor = minor(inode->i_rdev);
58209 + int minor = iminor(inode);
58210 struct i810_card *card = devs;
58212 for (card = devs; card != NULL; card = card->next) {
58213 diff -Nru a/sound/oss/ite8172.c b/sound/oss/ite8172.c
58214 --- a/sound/oss/ite8172.c Sun Aug 3 00:02:01 2003
58215 +++ b/sound/oss/ite8172.c Sun Aug 31 16:14:08 2003
58216 @@ -867,7 +867,7 @@
58218 static int it8172_open_mixdev(struct inode *inode, struct file *file)
58220 - int minor = MINOR(inode->i_rdev);
58221 + int minor = iminor(inode);
58222 struct list_head *list;
58223 struct it8172_state *s;
58225 @@ -1771,7 +1771,7 @@
58227 static int it8172_open(struct inode *inode, struct file *file)
58229 - int minor = MINOR(inode->i_rdev);
58230 + int minor = iminor(inode);
58231 DECLARE_WAITQUEUE(wait, current);
58232 unsigned long flags;
58233 struct list_head *list;
58234 @@ -2198,10 +2198,10 @@
58235 MODULE_DEVICE_TABLE(pci, id_table);
58237 static struct pci_driver it8172_driver = {
58238 - name: IT8172_MODULE_NAME,
58239 - id_table: id_table,
58240 - probe: it8172_probe,
58241 - remove: it8172_remove
58242 + .name = IT8172_MODULE_NAME,
58243 + .id_table = id_table,
58244 + .probe = it8172_probe,
58245 + .remove = it8172_remove
58248 static int __init init_it8172(void)
58249 diff -Nru a/sound/oss/maestro.c b/sound/oss/maestro.c
58250 --- a/sound/oss/maestro.c Tue Aug 12 13:28:49 2003
58251 +++ b/sound/oss/maestro.c Tue Aug 26 09:25:41 2003
58252 @@ -2138,7 +2138,7 @@
58253 /* --------------------------------------------------------------------- */
58254 static int ess_open_mixdev(struct inode *inode, struct file *file)
58256 - unsigned int minor = minor(inode->i_rdev);
58257 + unsigned int minor = iminor(inode);
58258 struct ess_card *card = NULL;
58259 struct pci_dev *pdev = NULL;
58260 struct pci_driver *drvr;
58261 @@ -2983,7 +2983,7 @@
58263 ess_open(struct inode *inode, struct file *file)
58265 - unsigned int minor = minor(inode->i_rdev);
58266 + unsigned int minor = iminor(inode);
58267 struct ess_state *s = NULL;
58268 unsigned char fmtm = ~0, fmts = 0;
58269 struct pci_dev *pdev = NULL;
58270 diff -Nru a/sound/oss/maestro3.c b/sound/oss/maestro3.c
58271 --- a/sound/oss/maestro3.c Thu Jul 31 08:58:39 2003
58272 +++ b/sound/oss/maestro3.c Tue Aug 26 09:25:41 2003
58273 @@ -1980,7 +1980,7 @@
58275 static int m3_open(struct inode *inode, struct file *file)
58277 - unsigned int minor = minor(inode->i_rdev);
58278 + unsigned int minor = iminor(inode);
58280 struct m3_state *s = NULL;
58282 @@ -2149,7 +2149,7 @@
58283 /* OSS /dev/mixer file operation methods */
58284 static int m3_open_mixdev(struct inode *inode, struct file *file)
58286 - unsigned int minor = minor(inode->i_rdev);
58287 + unsigned int minor = iminor(inode);
58288 struct m3_card *card = devs;
58290 for (card = devs; card != NULL; card = card->next) {
58291 diff -Nru a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
58292 --- a/sound/oss/msnd_pinnacle.c Wed Jul 23 08:32:08 2003
58293 +++ b/sound/oss/msnd_pinnacle.c Tue Aug 26 09:25:41 2003
58294 @@ -646,7 +646,7 @@
58296 static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
58298 - int minor = minor(inode->i_rdev);
58299 + int minor = iminor(inode);
58301 if (cmd == OSS_GETVERSION) {
58302 int sound_version = SOUND_VERSION;
58303 @@ -758,7 +758,7 @@
58305 static int dev_open(struct inode *inode, struct file *file)
58307 - int minor = minor(inode->i_rdev);
58308 + int minor = iminor(inode);
58311 if (minor == dev.dsp_minor) {
58312 @@ -793,7 +793,7 @@
58314 static int dev_release(struct inode *inode, struct file *file)
58316 - int minor = minor(inode->i_rdev);
58317 + int minor = iminor(inode);
58321 @@ -983,7 +983,7 @@
58323 static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off)
58325 - int minor = minor(file->f_dentry->d_inode->i_rdev);
58326 + int minor = iminor(file->f_dentry->d_inode);
58327 if (minor == dev.dsp_minor)
58328 return dsp_read(buf, count);
58330 @@ -992,7 +992,7 @@
58332 static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off)
58334 - int minor = minor(file->f_dentry->d_inode->i_rdev);
58335 + int minor = iminor(file->f_dentry->d_inode);
58336 if (minor == dev.dsp_minor)
58337 return dsp_write(buf, count);
58339 diff -Nru a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
58340 --- a/sound/oss/nec_vrc5477.c Tue Aug 12 13:28:49 2003
58341 +++ b/sound/oss/nec_vrc5477.c Tue Aug 26 09:25:41 2003
58342 @@ -857,7 +857,7 @@
58344 static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
58346 - int minor = minor(inode->i_rdev);
58347 + int minor = iminor(inode);
58348 struct list_head *list;
58349 struct vrc5477_ac97_state *s;
58351 @@ -1569,7 +1569,7 @@
58353 static int vrc5477_ac97_open(struct inode *inode, struct file *file)
58355 - int minor = minor(inode->i_rdev);
58356 + int minor = iminor(inode);
58357 DECLARE_WAITQUEUE(wait, current);
58358 unsigned long flags;
58359 struct list_head *list;
58360 diff -Nru a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
58361 --- a/sound/oss/rme96xx.c Thu Jul 31 08:58:39 2003
58362 +++ b/sound/oss/rme96xx.c Tue Aug 26 09:25:41 2003
58363 @@ -1445,7 +1445,7 @@
58365 static int rme96xx_open(struct inode *in, struct file *f)
58367 - int minor = minor(in->i_rdev);
58368 + int minor = iminor(in);
58369 struct list_head *list;
58372 @@ -1769,7 +1769,7 @@
58374 static int rme96xx_mixer_open(struct inode *inode, struct file *file)
58376 - int minor = minor(inode->i_rdev);
58377 + int minor = iminor(inode);
58378 struct list_head *list;
58381 diff -Nru a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
58382 --- a/sound/oss/sonicvibes.c Tue Aug 12 13:28:49 2003
58383 +++ b/sound/oss/sonicvibes.c Tue Aug 26 09:25:41 2003
58384 @@ -1238,7 +1238,7 @@
58386 static int sv_open_mixdev(struct inode *inode, struct file *file)
58388 - int minor = minor(inode->i_rdev);
58389 + int minor = iminor(inode);
58390 struct list_head *list;
58391 struct sv_state *s;
58393 @@ -1900,7 +1900,7 @@
58395 static int sv_open(struct inode *inode, struct file *file)
58397 - int minor = minor(inode->i_rdev);
58398 + int minor = iminor(inode);
58399 DECLARE_WAITQUEUE(wait, current);
58400 unsigned char fmtm = ~0, fmts = 0;
58401 struct list_head *list;
58402 @@ -2149,7 +2149,7 @@
58404 static int sv_midi_open(struct inode *inode, struct file *file)
58406 - int minor = minor(inode->i_rdev);
58407 + int minor = iminor(inode);
58408 DECLARE_WAITQUEUE(wait, current);
58409 unsigned long flags;
58410 struct list_head *list;
58411 @@ -2371,7 +2371,7 @@
58413 static int sv_dmfm_open(struct inode *inode, struct file *file)
58415 - int minor = minor(inode->i_rdev);
58416 + int minor = iminor(inode);
58417 DECLARE_WAITQUEUE(wait, current);
58418 struct list_head *list;
58419 struct sv_state *s;
58420 diff -Nru a/sound/oss/soundcard.c b/sound/oss/soundcard.c
58421 --- a/sound/oss/soundcard.c Tue Aug 12 13:28:49 2003
58422 +++ b/sound/oss/soundcard.c Tue Aug 26 09:25:41 2003
58423 @@ -144,7 +144,7 @@
58425 static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos)
58427 - int dev = minor(file->f_dentry->d_inode->i_rdev);
58428 + int dev = iminor(file->f_dentry->d_inode);
58432 @@ -177,7 +177,7 @@
58434 static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
58436 - int dev = minor(file->f_dentry->d_inode->i_rdev);
58437 + int dev = iminor(file->f_dentry->d_inode);
58441 @@ -204,7 +204,7 @@
58443 static int sound_open(struct inode *inode, struct file *file)
58445 - int dev = minor(inode->i_rdev);
58446 + int dev = iminor(inode);
58449 DEB(printk("sound_open(dev=%d)\n", dev));
58450 @@ -253,7 +253,7 @@
58452 static int sound_release(struct inode *inode, struct file *file)
58454 - int dev = minor(inode->i_rdev);
58455 + int dev = iminor(inode);
58458 DEB(printk("sound_release(dev=%d)\n", dev));
58459 @@ -333,7 +333,7 @@
58460 unsigned int cmd, unsigned long arg)
58462 int err, len = 0, dtype;
58463 - int dev = minor(inode->i_rdev);
58464 + int dev = iminor(inode);
58466 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
58468 @@ -396,7 +396,7 @@
58469 static unsigned int sound_poll(struct file *file, poll_table * wait)
58471 struct inode *inode = file->f_dentry->d_inode;
58472 - int dev = minor(inode->i_rdev);
58473 + int dev = iminor(inode);
58475 DEB(printk("sound_poll(dev=%d)\n", dev));
58476 switch (dev & 0x0f) {
58477 @@ -420,7 +420,7 @@
58479 unsigned long size;
58480 struct dma_buffparms *dmap = NULL;
58481 - int dev = minor(file->f_dentry->d_inode->i_rdev);
58482 + int dev = iminor(file->f_dentry->d_inode);
58484 dev_class = dev & 0x0f;
58486 diff -Nru a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
58487 --- a/sound/oss/swarm_cs4297a.c Sun Aug 3 00:04:24 2003
58488 +++ b/sound/oss/swarm_cs4297a.c Tue Aug 26 09:25:41 2003
58489 @@ -1537,7 +1537,7 @@
58491 static int cs4297a_open_mixdev(struct inode *inode, struct file *file)
58493 - int minor = MINOR(inode->i_rdev);
58494 + int minor = iminor(inode);
58495 struct cs4297a_state *s=NULL;
58496 struct list_head *entry;
58498 @@ -2386,7 +2386,7 @@
58500 static int cs4297a_open(struct inode *inode, struct file *file)
58502 - int minor = MINOR(inode->i_rdev);
58503 + int minor = iminor(inode);
58504 struct cs4297a_state *s=NULL;
58505 struct list_head *entry;
58507 diff -Nru a/sound/oss/trident.c b/sound/oss/trident.c
58508 --- a/sound/oss/trident.c Sat Aug 9 11:53:08 2003
58509 +++ b/sound/oss/trident.c Tue Aug 26 09:25:41 2003
58510 @@ -2600,7 +2600,7 @@
58511 static int trident_open(struct inode *inode, struct file *file)
58514 - int minor = minor(inode->i_rdev);
58515 + int minor = iminor(inode);
58516 struct trident_card *card = devs;
58517 struct trident_state *state = NULL;
58518 struct dmabuf *dmabuf = NULL;
58519 @@ -3883,7 +3883,7 @@
58520 static int trident_open_mixdev(struct inode *inode, struct file *file)
58523 - int minor = minor(inode->i_rdev);
58524 + int minor = iminor(inode);
58525 struct trident_card *card = devs;
58527 for (card = devs; card != NULL; card = card->next)
58528 diff -Nru a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
58529 --- a/sound/oss/via82cxxx_audio.c Sun Aug 3 00:05:26 2003
58530 +++ b/sound/oss/via82cxxx_audio.c Tue Aug 26 09:25:41 2003
58531 @@ -1556,7 +1556,7 @@
58533 static int via_mixer_open (struct inode *inode, struct file *file)
58535 - int minor = minor(inode->i_rdev);
58536 + int minor = iminor(inode);
58537 struct via_info *card;
58538 struct pci_dev *pdev = NULL;
58539 struct pci_driver *drvr;
58540 @@ -3252,7 +3252,7 @@
58542 static int via_dsp_open (struct inode *inode, struct file *file)
58544 - int minor = minor(inode->i_rdev);
58545 + int minor = iminor(inode);
58546 struct via_info *card;
58547 struct pci_dev *pdev = NULL;
58548 struct via_channel *chan;
58549 diff -Nru a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
58550 --- a/sound/oss/vwsnd.c Mon Apr 21 00:32:53 2003
58551 +++ b/sound/oss/vwsnd.c Tue Aug 26 09:25:41 2003
58552 @@ -2916,7 +2916,7 @@
58553 static int vwsnd_audio_open(struct inode *inode, struct file *file)
58556 - dev_t minor = minor(inode->i_rdev);
58557 + int minor = iminor(inode);
58560 DBGE("(inode=0x%p, file=0x%p)\n", inode, file);
58561 @@ -3063,7 +3063,7 @@
58564 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)
58565 - if (devc->mixer_minor == minor(inode->i_rdev))
58566 + if (devc->mixer_minor == iminor(inode))
58569 if (devc == NULL) {
58570 diff -Nru a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
58571 --- a/sound/oss/ymfpci.c Mon Aug 18 22:27:20 2003
58572 +++ b/sound/oss/ymfpci.c Tue Aug 26 09:25:41 2003
58573 @@ -1905,7 +1905,7 @@
58574 struct ymf_state *state;
58577 - minor = minor(inode->i_rdev);
58578 + minor = iminor(inode);
58579 if ((minor & 0x0F) == 3) { /* /dev/dspN */
58582 @@ -2019,7 +2019,7 @@
58584 static int ymf_open_mixdev(struct inode *inode, struct file *file)
58586 - int minor = minor(inode->i_rdev);
58587 + int minor = iminor(inode);
58588 struct list_head *list;
58591 diff -Nru a/sound/pcmcia/vx/vx_entry.c b/sound/pcmcia/vx/vx_entry.c
58592 --- a/sound/pcmcia/vx/vx_entry.c Tue Jun 10 07:32:30 2003
58593 +++ b/sound/pcmcia/vx/vx_entry.c Fri Aug 22 05:02:18 2003
58595 static int vxpocket_event(event_t event, int priority, event_callback_args_t *args);
58598 -static void vxpocket_release(u_long arg)
58599 +static void vxpocket_release(dev_link_t* link)
58601 - dev_link_t *link = (dev_link_t *)arg;
58603 if (link->state & DEV_CONFIG) {
58604 /* release cs resources */
58605 CardServices(ReleaseConfiguration, link->handle);
58607 struct snd_vxp_entry *hw;
58608 dev_link_t *link = &vxp->link;
58610 - vxpocket_release((u_long)link);
58611 + vxpocket_release(link);
58613 /* Break the link with Card Services */
58615 @@ -148,9 +146,6 @@
58616 link->irq.Handler = &snd_vx_irq_handler;
58617 link->irq.Instance = chip;
58619 - link->release.function = &vxpocket_release;
58620 - link->release.data = (u_long)link;
58622 link->conf.Attributes = CONF_ENABLE_IRQ;
58623 link->conf.Vcc = 50;
58624 link->conf.IntType = INT_MEMORY_AND_IO;
58625 @@ -229,8 +224,6 @@
58627 vx_core_t *chip = snd_magic_cast(vx_core_t, link->priv, return);
58629 - del_timer(&link->release);
58631 snd_printdd(KERN_DEBUG "vxpocket_detach called\n");
58632 /* Remove the interface data from the linked list */
58634 @@ -326,7 +319,6 @@
58635 snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
58636 link->state &= ~DEV_PRESENT;
58637 if (link->state & DEV_CONFIG) {
58638 - mod_timer(&link->release, jiffies + HZ/20);
58639 chip->chip_status |= VX_STAT_IS_STALE;
58642 diff -Nru a/sound/ppc/keywest.c b/sound/ppc/keywest.c
58643 --- a/sound/ppc/keywest.c Tue May 20 14:13:01 2003
58644 +++ b/sound/ppc/keywest.c Sun Aug 24 06:11:13 2003
58648 #ifndef i2c_device_name
58649 -#define i2c_device_name(x) ((x)->dev.name)
58650 +#define i2c_device_name(x) ((x)->name)
58653 static int keywest_attach_adapter(struct i2c_adapter *adapter)
58654 diff -Nru a/sound/sound_core.c b/sound/sound_core.c
58655 --- a/sound/sound_core.c Sat May 17 12:39:14 2003
58656 +++ b/sound/sound_core.c Tue Aug 26 09:25:41 2003
58657 @@ -483,7 +483,7 @@
58658 int soundcore_open(struct inode *inode, struct file *file)
58661 - int unit = minor(inode->i_rdev);
58662 + int unit = iminor(inode);
58663 struct sound_unit *s;
58664 struct file_operations *new_fops = NULL;