diff options
391 files changed, 8728 insertions, 11749 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 9474501dd6cc..b4a1ea762698 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -123,6 +123,15 @@ Who: Christoph Hellwig <hch@lst.de> | |||
123 | 123 | ||
124 | --------------------------- | 124 | --------------------------- |
125 | 125 | ||
126 | What: CONFIG_FORCED_INLINING | ||
127 | When: June 2006 | ||
128 | Why: Config option is there to see if gcc is good enough. (in january | ||
129 | 2006). If it is, the behavior should just be the default. If it's not, | ||
130 | the option should just go away entirely. | ||
131 | Who: Arjan van de Ven | ||
132 | |||
133 | --------------------------- | ||
134 | |||
126 | What: START_ARRAY ioctl for md | 135 | What: START_ARRAY ioctl for md |
127 | When: July 2006 | 136 | When: July 2006 |
128 | Files: drivers/md/md.c | 137 | Files: drivers/md/md.c |
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt index 0d783c504ead..dbe4d87d2615 100644 --- a/Documentation/filesystems/tmpfs.txt +++ b/Documentation/filesystems/tmpfs.txt | |||
@@ -78,6 +78,18 @@ use up all the memory on the machine; but enhances the scalability of | |||
78 | that instance in a system with many cpus making intensive use of it. | 78 | that instance in a system with many cpus making intensive use of it. |
79 | 79 | ||
80 | 80 | ||
81 | tmpfs has a mount option to set the NUMA memory allocation policy for | ||
82 | all files in that instance: | ||
83 | mpol=interleave prefers to allocate memory from each node in turn | ||
84 | mpol=default prefers to allocate memory from the local node | ||
85 | mpol=bind prefers to allocate from mpol_nodelist | ||
86 | mpol=preferred prefers to allocate from first node in mpol_nodelist | ||
87 | |||
88 | The following mount option is used in conjunction with mpol=interleave, | ||
89 | mpol=bind or mpol=preferred: | ||
90 | mpol_nodelist: nodelist suitable for parsing with nodelist_parse. | ||
91 | |||
92 | |||
81 | To specify the initial root directory you can use the following mount | 93 | To specify the initial root directory you can use the following mount |
82 | options: | 94 | options: |
83 | 95 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index fe11fccf7e41..1cbcf65b764b 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -471,7 +471,7 @@ running once the system is up. | |||
471 | arch/i386/kernel/cpu/cpufreq/elanfreq.c. | 471 | arch/i386/kernel/cpu/cpufreq/elanfreq.c. |
472 | 472 | ||
473 | elevator= [IOSCHED] | 473 | elevator= [IOSCHED] |
474 | Format: {"as" | "cfq" | "deadline" | "noop"} | 474 | Format: {"anticipatory" | "cfq" | "deadline" | "noop"} |
475 | See Documentation/block/as-iosched.txt and | 475 | See Documentation/block/as-iosched.txt and |
476 | Documentation/block/deadline-iosched.txt for details. | 476 | Documentation/block/deadline-iosched.txt for details. |
477 | 477 | ||
@@ -712,9 +712,17 @@ running once the system is up. | |||
712 | load_ramdisk= [RAM] List of ramdisks to load from floppy | 712 | load_ramdisk= [RAM] List of ramdisks to load from floppy |
713 | See Documentation/ramdisk.txt. | 713 | See Documentation/ramdisk.txt. |
714 | 714 | ||
715 | lockd.udpport= [NFS] | 715 | lockd.nlm_grace_period=P [NFS] Assign grace period. |
716 | Format: <integer> | ||
717 | |||
718 | lockd.nlm_tcpport=N [NFS] Assign TCP port. | ||
719 | Format: <integer> | ||
716 | 720 | ||
717 | lockd.tcpport= [NFS] | 721 | lockd.nlm_timeout=T [NFS] Assign timeout value. |
722 | Format: <integer> | ||
723 | |||
724 | lockd.nlm_udpport=M [NFS] Assign UDP port. | ||
725 | Format: <integer> | ||
718 | 726 | ||
719 | logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver | 727 | logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver |
720 | Format: <irq> | 728 | Format: <irq> |
diff --git a/MAINTAINERS b/MAINTAINERS index 873c3f7cf0ff..6d1b048c62a1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1301,6 +1301,12 @@ M: ttb@tentacle.dhs.org and rml@novell.com | |||
1301 | L: linux-kernel@vger.kernel.org | 1301 | L: linux-kernel@vger.kernel.org |
1302 | S: Maintained | 1302 | S: Maintained |
1303 | 1303 | ||
1304 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) | ||
1305 | P: Sylvain Meyer | ||
1306 | M: sylvain.meyer@worldonline.fr | ||
1307 | L: linux-fbdev-devel@lists.sourceforge.net | ||
1308 | S: Maintained | ||
1309 | |||
1304 | INTEL 810/815 FRAMEBUFFER DRIVER | 1310 | INTEL 810/815 FRAMEBUFFER DRIVER |
1305 | P: Antonino Daplas | 1311 | P: Antonino Daplas |
1306 | M: adaplas@pol.net | 1312 | M: adaplas@pol.net |
@@ -1890,11 +1896,11 @@ W: http://linux-ntfs.sf.net/ | |||
1890 | T: git kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git | 1896 | T: git kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git |
1891 | S: Maintained | 1897 | S: Maintained |
1892 | 1898 | ||
1893 | NVIDIA (RIVA) FRAMEBUFFER DRIVER | 1899 | NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER |
1894 | P: Ani Joshi | 1900 | P: Antonino Daplas |
1895 | M: ajoshi@shell.unixbox.com | 1901 | M: adaplas@pol.net |
1896 | L: linux-nvidia@lists.surfsouth.com | 1902 | L: linux-fbdev-devel@lists.sourceforge.net |
1897 | S: Maintained | 1903 | S: Maintained |
1898 | 1904 | ||
1899 | ORACLE CLUSTER FILESYSTEM 2 (OCFS2) | 1905 | ORACLE CLUSTER FILESYSTEM 2 (OCFS2) |
1900 | P: Mark Fasheh | 1906 | P: Mark Fasheh |
@@ -2189,6 +2195,12 @@ L: rtl@rtlinux.org | |||
2189 | W: www.rtlinux.org | 2195 | W: www.rtlinux.org |
2190 | S: Maintained | 2196 | S: Maintained |
2191 | 2197 | ||
2198 | S3 SAVAGE FRAMEBUFFER DRIVER | ||
2199 | P: Antonino Daplas | ||
2200 | M: adaplas@pol.net | ||
2201 | L: linux-fbdev-devel@lists.sourceforge.net | ||
2202 | S: Maintained | ||
2203 | |||
2192 | S390 | 2204 | S390 |
2193 | P: Martin Schwidefsky | 2205 | P: Martin Schwidefsky |
2194 | M: schwidefsky@de.ibm.com | 2206 | M: schwidefsky@de.ibm.com |
@@ -2954,6 +2966,12 @@ M: dm@sangoma.com | |||
2954 | W: http://www.sangoma.com | 2966 | W: http://www.sangoma.com |
2955 | S: Supported | 2967 | S: Supported |
2956 | 2968 | ||
2969 | WATCHDOG DEVICE DRIVERS | ||
2970 | P: Wim Van Sebroeck | ||
2971 | M: wim@iguana.be | ||
2972 | T: git kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git | ||
2973 | S: Maintained | ||
2974 | |||
2957 | WAVELAN NETWORK DRIVER & WIRELESS EXTENSIONS | 2975 | WAVELAN NETWORK DRIVER & WIRELESS EXTENSIONS |
2958 | P: Jean Tourrilhes | 2976 | P: Jean Tourrilhes |
2959 | M: jt@hpl.hp.com | 2977 | M: jt@hpl.hp.com |
@@ -151,7 +151,7 @@ export srctree objtree VPATH TOPDIR | |||
151 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | 151 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ |
152 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | 152 | -e s/arm.*/arm/ -e s/sa110/arm/ \ |
153 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | 153 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
154 | -e s/ppc64/powerpc/ ) | 154 | -e s/ppc.*/powerpc/ ) |
155 | 155 | ||
156 | # Cross compiling and selecting different set of gcc/bin-utils | 156 | # Cross compiling and selecting different set of gcc/bin-utils |
157 | # --------------------------------------------------------------------------- | 157 | # --------------------------------------------------------------------------- |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 3cfd82a05b20..5959e36c3b4c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -180,6 +180,7 @@ config ARCH_OMAP | |||
180 | config ARCH_VERSATILE | 180 | config ARCH_VERSATILE |
181 | bool "Versatile" | 181 | bool "Versatile" |
182 | select ARM_AMBA | 182 | select ARM_AMBA |
183 | select ARM_VIC | ||
183 | select ICST307 | 184 | select ICST307 |
184 | help | 185 | help |
185 | This enables support for ARM Ltd Versatile board. | 186 | This enables support for ARM Ltd Versatile board. |
@@ -400,6 +401,38 @@ config NO_IDLE_HZ | |||
400 | Currently at least OMAP, PXA2xx and SA11x0 platforms are known | 401 | Currently at least OMAP, PXA2xx and SA11x0 platforms are known |
401 | to have accurate timekeeping with dynamic tick. | 402 | to have accurate timekeeping with dynamic tick. |
402 | 403 | ||
404 | config AEABI | ||
405 | bool "Use the ARM EABI to compile the kernel" | ||
406 | help | ||
407 | This option allows for the kernel to be compiled using the latest | ||
408 | ARM ABI (aka EABI). This is only useful if you are using a user | ||
409 | space environment that is also compiled with EABI. | ||
410 | |||
411 | Since there are major incompatibilities between the legacy ABI and | ||
412 | EABI, especially with regard to structure member alignment, this | ||
413 | option also changes the kernel syscall calling convention to | ||
414 | disambiguate both ABIs and allow for backward compatibility support | ||
415 | (selected with CONFIG_OABI_COMPAT). | ||
416 | |||
417 | To use this you need GCC version 4.0.0 or later. | ||
418 | |||
419 | config OABI_COMPAT | ||
420 | bool "Allow old ABI binaries to run with this kernel" | ||
421 | depends on AEABI | ||
422 | default y | ||
423 | help | ||
424 | This option preserves the old syscall interface along with the | ||
425 | new (ARM EABI) one. It also provides a compatibility layer to | ||
426 | intercept syscalls that have structure arguments which layout | ||
427 | in memory differs between the legacy ABI and the new ARM EABI | ||
428 | (only for non "thumb" binaries). This option adds a tiny | ||
429 | overhead to all syscalls and produces a slightly larger kernel. | ||
430 | If you know you'll be using only pure EABI user space then you | ||
431 | can say N here. If this option is not selected and you attempt | ||
432 | to execute a legacy ABI binary then the result will be | ||
433 | UNPREDICTABLE (in fact it can be predicted that it won't work | ||
434 | at all). If in doubt say Y. | ||
435 | |||
403 | config ARCH_DISCONTIGMEM_ENABLE | 436 | config ARCH_DISCONTIGMEM_ENABLE |
404 | bool | 437 | bool |
405 | default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) | 438 | default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) |
@@ -586,6 +619,7 @@ comment "At least one emulation must be selected" | |||
586 | 619 | ||
587 | config FPE_NWFPE | 620 | config FPE_NWFPE |
588 | bool "NWFPE math emulation" | 621 | bool "NWFPE math emulation" |
622 | depends on !AEABI || OABI_COMPAT | ||
589 | ---help--- | 623 | ---help--- |
590 | Say Y to include the NWFPE floating point emulator in the kernel. | 624 | Say Y to include the NWFPE floating point emulator in the kernel. |
591 | This is necessary to run most binaries. Linux does not currently | 625 | This is necessary to run most binaries. Linux does not currently |
@@ -609,7 +643,7 @@ config FPE_NWFPE_XP | |||
609 | 643 | ||
610 | config FPE_FASTFPE | 644 | config FPE_FASTFPE |
611 | bool "FastFPE math emulation (EXPERIMENTAL)" | 645 | bool "FastFPE math emulation (EXPERIMENTAL)" |
612 | depends on !CPU_32v3 && EXPERIMENTAL | 646 | depends on (!AEABI || OABI_COMPAT) && !CPU_32v3 && EXPERIMENTAL |
613 | ---help--- | 647 | ---help--- |
614 | Say Y here to include the FAST floating point emulator in the kernel. | 648 | Say Y here to include the FAST floating point emulator in the kernel. |
615 | This is an experimental much faster emulator which now also has full | 649 | This is an experimental much faster emulator which now also has full |
@@ -641,6 +675,7 @@ source "fs/Kconfig.binfmt" | |||
641 | 675 | ||
642 | config ARTHUR | 676 | config ARTHUR |
643 | tristate "RISC OS personality" | 677 | tristate "RISC OS personality" |
678 | depends on !AEABI | ||
644 | help | 679 | help |
645 | Say Y here to include the kernel code necessary if you want to run | 680 | Say Y here to include the kernel code necessary if you want to run |
646 | Acorn RISC OS/Arthur binaries under Linux. This code is still very | 681 | Acorn RISC OS/Arthur binaries under Linux. This code is still very |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 1fa2a1011584..fbfc14a56b96 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -56,8 +56,13 @@ tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 | |||
56 | tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale | 56 | tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale |
57 | tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) | 57 | tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) |
58 | 58 | ||
59 | # Need -Uarm for gcc < 3.x | 59 | ifeq ($(CONFIG_AEABI),y) |
60 | CFLAGS_ABI :=-mabi=aapcs -mno-thumb-interwork | ||
61 | else | ||
60 | CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) | 62 | CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) |
63 | endif | ||
64 | |||
65 | # Need -Uarm for gcc < 3.x | ||
61 | CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm | 66 | CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm |
62 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float | 67 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float |
63 | 68 | ||
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index d7509c7a3c5e..5e34ca6d38b6 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig | |||
@@ -1,7 +1,10 @@ | |||
1 | config ICST525 | 1 | config ARM_GIC |
2 | bool | 2 | bool |
3 | 3 | ||
4 | config ARM_GIC | 4 | config ARM_VIC |
5 | bool | ||
6 | |||
7 | config ICST525 | ||
5 | bool | 8 | bool |
6 | 9 | ||
7 | config ICST307 | 10 | config ICST307 |
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index ec8d17c96906..c81a2ff6b5be 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | obj-y += rtctime.o | 5 | obj-y += rtctime.o |
6 | obj-$(CONFIG_ARM_GIC) += gic.o | 6 | obj-$(CONFIG_ARM_GIC) += gic.o |
7 | obj-$(CONFIG_ARM_VIC) += vic.o | ||
7 | obj-$(CONFIG_ICST525) += icst525.o | 8 | obj-$(CONFIG_ICST525) += icst525.o |
8 | obj-$(CONFIG_ICST307) += icst307.o | 9 | obj-$(CONFIG_ICST307) += icst307.o |
9 | obj-$(CONFIG_SA1111) += sa1111.o | 10 | obj-$(CONFIG_SA1111) += sa1111.o |
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c new file mode 100644 index 000000000000..a45ed1687a59 --- /dev/null +++ b/arch/arm/common/vic.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/common/vic.c | ||
3 | * | ||
4 | * Copyright (C) 1999 - 2003 ARM Limited | ||
5 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/list.h> | ||
23 | |||
24 | #include <asm/io.h> | ||
25 | #include <asm/irq.h> | ||
26 | #include <asm/mach/irq.h> | ||
27 | #include <asm/hardware/vic.h> | ||
28 | |||
29 | static void __iomem *vic_base; | ||
30 | |||
31 | static void vic_mask_irq(unsigned int irq) | ||
32 | { | ||
33 | irq -= IRQ_VIC_START; | ||
34 | writel(1 << irq, vic_base + VIC_INT_ENABLE_CLEAR); | ||
35 | } | ||
36 | |||
37 | static void vic_unmask_irq(unsigned int irq) | ||
38 | { | ||
39 | irq -= IRQ_VIC_START; | ||
40 | writel(1 << irq, vic_base + VIC_INT_ENABLE); | ||
41 | } | ||
42 | |||
43 | static struct irqchip vic_chip = { | ||
44 | .ack = vic_mask_irq, | ||
45 | .mask = vic_mask_irq, | ||
46 | .unmask = vic_unmask_irq, | ||
47 | }; | ||
48 | |||
49 | void __init vic_init(void __iomem *base, u32 vic_sources) | ||
50 | { | ||
51 | unsigned int i; | ||
52 | |||
53 | vic_base = base; | ||
54 | |||
55 | /* Disable all interrupts initially. */ | ||
56 | |||
57 | writel(0, vic_base + VIC_INT_SELECT); | ||
58 | writel(0, vic_base + VIC_INT_ENABLE); | ||
59 | writel(~0, vic_base + VIC_INT_ENABLE_CLEAR); | ||
60 | writel(0, vic_base + VIC_IRQ_STATUS); | ||
61 | writel(0, vic_base + VIC_ITCR); | ||
62 | writel(~0, vic_base + VIC_INT_SOFT_CLEAR); | ||
63 | |||
64 | /* | ||
65 | * Make sure we clear all existing interrupts | ||
66 | */ | ||
67 | writel(0, vic_base + VIC_VECT_ADDR); | ||
68 | for (i = 0; i < 19; i++) { | ||
69 | unsigned int value; | ||
70 | |||
71 | value = readl(vic_base + VIC_VECT_ADDR); | ||
72 | writel(value, vic_base + VIC_VECT_ADDR); | ||
73 | } | ||
74 | |||
75 | for (i = 0; i < 16; i++) { | ||
76 | void __iomem *reg = vic_base + VIC_VECT_CNTL0 + (i * 4); | ||
77 | writel(VIC_VECT_CNTL_ENABLE | i, reg); | ||
78 | } | ||
79 | |||
80 | writel(32, vic_base + VIC_DEF_VECT_ADDR); | ||
81 | |||
82 | for (i = 0; i < 32; i++) { | ||
83 | unsigned int irq = IRQ_VIC_START + i; | ||
84 | |||
85 | set_irq_chip(irq, &vic_chip); | ||
86 | |||
87 | if (vic_sources & (1 << i)) { | ||
88 | set_irq_handler(irq, do_level_IRQ); | ||
89 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
90 | } | ||
91 | } | ||
92 | } | ||
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index de94b0f3ee2a..2ce0e3a27a45 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -20,6 +20,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o | |||
20 | obj-$(CONFIG_ISA_DMA) += dma-isa.o | 20 | obj-$(CONFIG_ISA_DMA) += dma-isa.o |
21 | obj-$(CONFIG_PCI) += bios32.o | 21 | obj-$(CONFIG_PCI) += bios32.o |
22 | obj-$(CONFIG_SMP) += smp.o | 22 | obj-$(CONFIG_SMP) += smp.o |
23 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o | ||
23 | 24 | ||
24 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | 25 | obj-$(CONFIG_IWMMXT) += iwmmxt.o |
25 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | 26 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt |
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 9997098009a9..1574941ebfe1 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -35,6 +35,16 @@ extern void __udivsi3(void); | |||
35 | extern void __umodsi3(void); | 35 | extern void __umodsi3(void); |
36 | extern void __do_div64(void); | 36 | extern void __do_div64(void); |
37 | 37 | ||
38 | extern void __aeabi_idiv(void); | ||
39 | extern void __aeabi_idivmod(void); | ||
40 | extern void __aeabi_lasr(void); | ||
41 | extern void __aeabi_llsl(void); | ||
42 | extern void __aeabi_llsr(void); | ||
43 | extern void __aeabi_lmul(void); | ||
44 | extern void __aeabi_uidiv(void); | ||
45 | extern void __aeabi_uidivmod(void); | ||
46 | extern void __aeabi_ulcmp(void); | ||
47 | |||
38 | extern void fpundefinstr(void); | 48 | extern void fpundefinstr(void); |
39 | extern void fp_enter(void); | 49 | extern void fp_enter(void); |
40 | 50 | ||
@@ -141,6 +151,18 @@ EXPORT_SYMBOL(__udivsi3); | |||
141 | EXPORT_SYMBOL(__umodsi3); | 151 | EXPORT_SYMBOL(__umodsi3); |
142 | EXPORT_SYMBOL(__do_div64); | 152 | EXPORT_SYMBOL(__do_div64); |
143 | 153 | ||
154 | #ifdef CONFIG_AEABI | ||
155 | EXPORT_SYMBOL(__aeabi_idiv); | ||
156 | EXPORT_SYMBOL(__aeabi_idivmod); | ||
157 | EXPORT_SYMBOL(__aeabi_lasr); | ||
158 | EXPORT_SYMBOL(__aeabi_llsl); | ||
159 | EXPORT_SYMBOL(__aeabi_llsr); | ||
160 | EXPORT_SYMBOL(__aeabi_lmul); | ||
161 | EXPORT_SYMBOL(__aeabi_uidiv); | ||
162 | EXPORT_SYMBOL(__aeabi_uidivmod); | ||
163 | EXPORT_SYMBOL(__aeabi_ulcmp); | ||
164 | #endif | ||
165 | |||
144 | /* bitops */ | 166 | /* bitops */ |
145 | EXPORT_SYMBOL(_set_bit_le); | 167 | EXPORT_SYMBOL(_set_bit_le); |
146 | EXPORT_SYMBOL(_test_and_set_bit_le); | 168 | EXPORT_SYMBOL(_test_and_set_bit_le); |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 55076a75e5bf..75e6f9a94713 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -13,7 +13,7 @@ | |||
13 | #define NR_syscalls 328 | 13 | #define NR_syscalls 328 |
14 | #else | 14 | #else |
15 | 15 | ||
16 | __syscall_start: | 16 | 100: |
17 | /* 0 */ .long sys_restart_syscall | 17 | /* 0 */ .long sys_restart_syscall |
18 | .long sys_exit | 18 | .long sys_exit |
19 | .long sys_fork_wrapper | 19 | .long sys_fork_wrapper |
@@ -27,7 +27,7 @@ __syscall_start: | |||
27 | /* 10 */ .long sys_unlink | 27 | /* 10 */ .long sys_unlink |
28 | .long sys_execve_wrapper | 28 | .long sys_execve_wrapper |
29 | .long sys_chdir | 29 | .long sys_chdir |
30 | .long sys_time /* used by libc4 */ | 30 | .long OBSOLETE(sys_time) /* used by libc4 */ |
31 | .long sys_mknod | 31 | .long sys_mknod |
32 | /* 15 */ .long sys_chmod | 32 | /* 15 */ .long sys_chmod |
33 | .long sys_lchown16 | 33 | .long sys_lchown16 |
@@ -36,15 +36,15 @@ __syscall_start: | |||
36 | .long sys_lseek | 36 | .long sys_lseek |
37 | /* 20 */ .long sys_getpid | 37 | /* 20 */ .long sys_getpid |
38 | .long sys_mount | 38 | .long sys_mount |
39 | .long sys_oldumount /* used by libc4 */ | 39 | .long OBSOLETE(sys_oldumount) /* used by libc4 */ |
40 | .long sys_setuid16 | 40 | .long sys_setuid16 |
41 | .long sys_getuid16 | 41 | .long sys_getuid16 |
42 | /* 25 */ .long sys_stime | 42 | /* 25 */ .long OBSOLETE(sys_stime) |
43 | .long sys_ptrace | 43 | .long sys_ptrace |
44 | .long sys_alarm /* used by libc4 */ | 44 | .long OBSOLETE(sys_alarm) /* used by libc4 */ |
45 | .long sys_ni_syscall /* was sys_fstat */ | 45 | .long sys_ni_syscall /* was sys_fstat */ |
46 | .long sys_pause | 46 | .long sys_pause |
47 | /* 30 */ .long sys_utime /* used by libc4 */ | 47 | /* 30 */ .long OBSOLETE(sys_utime) /* used by libc4 */ |
48 | .long sys_ni_syscall /* was sys_stty */ | 48 | .long sys_ni_syscall /* was sys_stty */ |
49 | .long sys_ni_syscall /* was sys_getty */ | 49 | .long sys_ni_syscall /* was sys_getty */ |
50 | .long sys_access | 50 | .long sys_access |
@@ -90,21 +90,21 @@ __syscall_start: | |||
90 | .long sys_sigpending | 90 | .long sys_sigpending |
91 | .long sys_sethostname | 91 | .long sys_sethostname |
92 | /* 75 */ .long sys_setrlimit | 92 | /* 75 */ .long sys_setrlimit |
93 | .long sys_old_getrlimit /* used by libc4 */ | 93 | .long OBSOLETE(sys_old_getrlimit) /* used by libc4 */ |
94 | .long sys_getrusage | 94 | .long sys_getrusage |
95 | .long sys_gettimeofday | 95 | .long sys_gettimeofday |
96 | .long sys_settimeofday | 96 | .long sys_settimeofday |
97 | /* 80 */ .long sys_getgroups16 | 97 | /* 80 */ .long sys_getgroups16 |
98 | .long sys_setgroups16 | 98 | .long sys_setgroups16 |
99 | .long old_select /* used by libc4 */ | 99 | .long OBSOLETE(old_select) /* used by libc4 */ |
100 | .long sys_symlink | 100 | .long sys_symlink |
101 | .long sys_ni_syscall /* was sys_lstat */ | 101 | .long sys_ni_syscall /* was sys_lstat */ |
102 | /* 85 */ .long sys_readlink | 102 | /* 85 */ .long sys_readlink |
103 | .long sys_uselib | 103 | .long sys_uselib |
104 | .long sys_swapon | 104 | .long sys_swapon |
105 | .long sys_reboot | 105 | .long sys_reboot |
106 | .long old_readdir /* used by libc4 */ | 106 | .long OBSOLETE(old_readdir) /* used by libc4 */ |
107 | /* 90 */ .long old_mmap /* used by libc4 */ | 107 | /* 90 */ .long OBSOLETE(old_mmap) /* used by libc4 */ |
108 | .long sys_munmap | 108 | .long sys_munmap |
109 | .long sys_truncate | 109 | .long sys_truncate |
110 | .long sys_ftruncate | 110 | .long sys_ftruncate |
@@ -116,7 +116,7 @@ __syscall_start: | |||
116 | .long sys_statfs | 116 | .long sys_statfs |
117 | /* 100 */ .long sys_fstatfs | 117 | /* 100 */ .long sys_fstatfs |
118 | .long sys_ni_syscall | 118 | .long sys_ni_syscall |
119 | .long sys_socketcall | 119 | .long OBSOLETE(sys_socketcall) |
120 | .long sys_syslog | 120 | .long sys_syslog |
121 | .long sys_setitimer | 121 | .long sys_setitimer |
122 | /* 105 */ .long sys_getitimer | 122 | /* 105 */ .long sys_getitimer |
@@ -127,11 +127,11 @@ __syscall_start: | |||
127 | /* 110 */ .long sys_ni_syscall /* was sys_iopl */ | 127 | /* 110 */ .long sys_ni_syscall /* was sys_iopl */ |
128 | .long sys_vhangup | 128 | .long sys_vhangup |
129 | .long sys_ni_syscall | 129 | .long sys_ni_syscall |
130 | .long sys_syscall /* call a syscall */ | 130 | .long OBSOLETE(sys_syscall) /* call a syscall */ |
131 | .long sys_wait4 | 131 | .long sys_wait4 |
132 | /* 115 */ .long sys_swapoff | 132 | /* 115 */ .long sys_swapoff |
133 | .long sys_sysinfo | 133 | .long sys_sysinfo |
134 | .long sys_ipc | 134 | .long OBSOLETE(ABI(sys_ipc, sys_oabi_ipc)) |
135 | .long sys_fsync | 135 | .long sys_fsync |
136 | .long sys_sigreturn_wrapper | 136 | .long sys_sigreturn_wrapper |
137 | /* 120 */ .long sys_clone_wrapper | 137 | /* 120 */ .long sys_clone_wrapper |
@@ -194,8 +194,8 @@ __syscall_start: | |||
194 | .long sys_rt_sigtimedwait | 194 | .long sys_rt_sigtimedwait |
195 | .long sys_rt_sigqueueinfo | 195 | .long sys_rt_sigqueueinfo |
196 | .long sys_rt_sigsuspend_wrapper | 196 | .long sys_rt_sigsuspend_wrapper |
197 | /* 180 */ .long sys_pread64 | 197 | /* 180 */ .long ABI(sys_pread64, sys_oabi_pread64) |
198 | .long sys_pwrite64 | 198 | .long ABI(sys_pwrite64, sys_oabi_pwrite64) |
199 | .long sys_chown16 | 199 | .long sys_chown16 |
200 | .long sys_getcwd | 200 | .long sys_getcwd |
201 | .long sys_capget | 201 | .long sys_capget |
@@ -207,11 +207,11 @@ __syscall_start: | |||
207 | /* 190 */ .long sys_vfork_wrapper | 207 | /* 190 */ .long sys_vfork_wrapper |
208 | .long sys_getrlimit | 208 | .long sys_getrlimit |
209 | .long sys_mmap2 | 209 | .long sys_mmap2 |
210 | .long sys_truncate64 | 210 | .long ABI(sys_truncate64, sys_oabi_truncate64) |
211 | .long sys_ftruncate64 | 211 | .long ABI(sys_ftruncate64, sys_oabi_ftruncate64) |
212 | /* 195 */ .long sys_stat64 | 212 | /* 195 */ .long ABI(sys_stat64, sys_oabi_stat64) |
213 | .long sys_lstat64 | 213 | .long ABI(sys_lstat64, sys_oabi_lstat64) |
214 | .long sys_fstat64 | 214 | .long ABI(sys_fstat64, sys_oabi_fstat64) |
215 | .long sys_lchown | 215 | .long sys_lchown |
216 | .long sys_getuid | 216 | .long sys_getuid |
217 | /* 200 */ .long sys_getgid | 217 | /* 200 */ .long sys_getgid |
@@ -235,11 +235,11 @@ __syscall_start: | |||
235 | .long sys_pivot_root | 235 | .long sys_pivot_root |
236 | .long sys_mincore | 236 | .long sys_mincore |
237 | /* 220 */ .long sys_madvise | 237 | /* 220 */ .long sys_madvise |
238 | .long sys_fcntl64 | 238 | .long ABI(sys_fcntl64, sys_oabi_fcntl64) |
239 | .long sys_ni_syscall /* TUX */ | 239 | .long sys_ni_syscall /* TUX */ |
240 | .long sys_ni_syscall | 240 | .long sys_ni_syscall |
241 | .long sys_gettid | 241 | .long sys_gettid |
242 | /* 225 */ .long sys_readahead | 242 | /* 225 */ .long ABI(sys_readahead, sys_oabi_readahead) |
243 | .long sys_setxattr | 243 | .long sys_setxattr |
244 | .long sys_lsetxattr | 244 | .long sys_lsetxattr |
245 | .long sys_fsetxattr | 245 | .long sys_fsetxattr |
@@ -265,8 +265,8 @@ __syscall_start: | |||
265 | .long sys_exit_group | 265 | .long sys_exit_group |
266 | .long sys_lookup_dcookie | 266 | .long sys_lookup_dcookie |
267 | /* 250 */ .long sys_epoll_create | 267 | /* 250 */ .long sys_epoll_create |
268 | .long sys_epoll_ctl | 268 | .long ABI(sys_epoll_ctl, sys_oabi_epoll_ctl) |
269 | .long sys_epoll_wait | 269 | .long ABI(sys_epoll_wait, sys_oabi_epoll_wait) |
270 | .long sys_remap_file_pages | 270 | .long sys_remap_file_pages |
271 | .long sys_ni_syscall /* sys_set_thread_area */ | 271 | .long sys_ni_syscall /* sys_set_thread_area */ |
272 | /* 255 */ .long sys_ni_syscall /* sys_get_thread_area */ | 272 | /* 255 */ .long sys_ni_syscall /* sys_get_thread_area */ |
@@ -280,8 +280,8 @@ __syscall_start: | |||
280 | .long sys_clock_gettime | 280 | .long sys_clock_gettime |
281 | .long sys_clock_getres | 281 | .long sys_clock_getres |
282 | /* 265 */ .long sys_clock_nanosleep | 282 | /* 265 */ .long sys_clock_nanosleep |
283 | .long sys_statfs64 | 283 | .long sys_statfs64_wrapper |
284 | .long sys_fstatfs64 | 284 | .long sys_fstatfs64_wrapper |
285 | .long sys_tgkill | 285 | .long sys_tgkill |
286 | .long sys_utimes | 286 | .long sys_utimes |
287 | /* 270 */ .long sys_arm_fadvise64_64 | 287 | /* 270 */ .long sys_arm_fadvise64_64 |
@@ -312,7 +312,7 @@ __syscall_start: | |||
312 | /* 295 */ .long sys_getsockopt | 312 | /* 295 */ .long sys_getsockopt |
313 | .long sys_sendmsg | 313 | .long sys_sendmsg |
314 | .long sys_recvmsg | 314 | .long sys_recvmsg |
315 | .long sys_semop | 315 | .long ABI(sys_semop, sys_oabi_semop) |
316 | .long sys_semget | 316 | .long sys_semget |
317 | /* 300 */ .long sys_semctl | 317 | /* 300 */ .long sys_semctl |
318 | .long sys_msgsnd | 318 | .long sys_msgsnd |
@@ -326,7 +326,7 @@ __syscall_start: | |||
326 | .long sys_add_key | 326 | .long sys_add_key |
327 | /* 310 */ .long sys_request_key | 327 | /* 310 */ .long sys_request_key |
328 | .long sys_keyctl | 328 | .long sys_keyctl |
329 | .long sys_semtimedop | 329 | .long ABI(sys_semtimedop, sys_oabi_semtimedop) |
330 | /* vserver */ .long sys_ni_syscall | 330 | /* vserver */ .long sys_ni_syscall |
331 | .long sys_ioprio_set | 331 | .long sys_ioprio_set |
332 | /* 315 */ .long sys_ioprio_get | 332 | /* 315 */ .long sys_ioprio_get |
@@ -336,9 +336,8 @@ __syscall_start: | |||
336 | .long sys_mbind | 336 | .long sys_mbind |
337 | /* 320 */ .long sys_get_mempolicy | 337 | /* 320 */ .long sys_get_mempolicy |
338 | .long sys_set_mempolicy | 338 | .long sys_set_mempolicy |
339 | __syscall_end: | ||
340 | 339 | ||
341 | .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 | 340 | .rept NR_syscalls - (. - 100b) / 4 |
342 | .long sys_ni_syscall | 341 | .long sys_ni_syscall |
343 | .endr | 342 | .endr |
344 | #endif | 343 | #endif |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a52baedf6262..874e6bb79405 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1996,1997,1998 Russell King. | 4 | * Copyright (C) 1996,1997,1998 Russell King. |
5 | * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) | 5 | * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) |
6 | * nommu support by Hyok S. Choi (hyok.choi@samsung.com) | ||
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -104,14 +105,24 @@ common_invalid: | |||
104 | /* | 105 | /* |
105 | * SVC mode handlers | 106 | * SVC mode handlers |
106 | */ | 107 | */ |
108 | |||
109 | #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) | ||
110 | #define SPFIX(code...) code | ||
111 | #else | ||
112 | #define SPFIX(code...) | ||
113 | #endif | ||
114 | |||
107 | .macro svc_entry | 115 | .macro svc_entry |
108 | sub sp, sp, #S_FRAME_SIZE | 116 | sub sp, sp, #S_FRAME_SIZE |
117 | SPFIX( tst sp, #4 ) | ||
118 | SPFIX( bicne sp, sp, #4 ) | ||
109 | stmib sp, {r1 - r12} | 119 | stmib sp, {r1 - r12} |
110 | 120 | ||
111 | ldmia r0, {r1 - r3} | 121 | ldmia r0, {r1 - r3} |
112 | add r5, sp, #S_SP @ here for interlock avoidance | 122 | add r5, sp, #S_SP @ here for interlock avoidance |
113 | mov r4, #-1 @ "" "" "" "" | 123 | mov r4, #-1 @ "" "" "" "" |
114 | add r0, sp, #S_FRAME_SIZE @ "" "" "" "" | 124 | add r0, sp, #S_FRAME_SIZE @ "" "" "" "" |
125 | SPFIX( addne r0, r0, #4 ) | ||
115 | str r1, [sp] @ save the "real" r0 copied | 126 | str r1, [sp] @ save the "real" r0 copied |
116 | @ from the exception stack | 127 | @ from the exception stack |
117 | 128 | ||
@@ -302,7 +313,14 @@ __pabt_svc: | |||
302 | 313 | ||
303 | /* | 314 | /* |
304 | * User mode handlers | 315 | * User mode handlers |
316 | * | ||
317 | * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE | ||
305 | */ | 318 | */ |
319 | |||
320 | #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7) | ||
321 | #error "sizeof(struct pt_regs) must be a multiple of 8" | ||
322 | #endif | ||
323 | |||
306 | .macro usr_entry | 324 | .macro usr_entry |
307 | sub sp, sp, #S_FRAME_SIZE | 325 | sub sp, sp, #S_FRAME_SIZE |
308 | stmib sp, {r1 - r12} | 326 | stmib sp, {r1 - r12} |
@@ -538,7 +556,11 @@ ENTRY(__switch_to) | |||
538 | add ip, r1, #TI_CPU_SAVE | 556 | add ip, r1, #TI_CPU_SAVE |
539 | ldr r3, [r2, #TI_TP_VALUE] | 557 | ldr r3, [r2, #TI_TP_VALUE] |
540 | stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack | 558 | stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack |
559 | #ifndef CONFIG_MMU | ||
560 | add r2, r2, #TI_CPU_DOMAIN | ||
561 | #else | ||
541 | ldr r6, [r2, #TI_CPU_DOMAIN]! | 562 | ldr r6, [r2, #TI_CPU_DOMAIN]! |
563 | #endif | ||
542 | #if __LINUX_ARM_ARCH__ >= 6 | 564 | #if __LINUX_ARM_ARCH__ >= 6 |
543 | #ifdef CONFIG_CPU_MPCORE | 565 | #ifdef CONFIG_CPU_MPCORE |
544 | clrex | 566 | clrex |
@@ -556,7 +578,9 @@ ENTRY(__switch_to) | |||
556 | mov r4, #0xffff0fff | 578 | mov r4, #0xffff0fff |
557 | str r3, [r4, #-15] @ TLS val at 0xffff0ff0 | 579 | str r3, [r4, #-15] @ TLS val at 0xffff0ff0 |
558 | #endif | 580 | #endif |
581 | #ifdef CONFIG_MMU | ||
559 | mcr p15, 0, r6, c3, c0, 0 @ Set domain register | 582 | mcr p15, 0, r6, c3, c0, 0 @ Set domain register |
583 | #endif | ||
560 | #ifdef CONFIG_VFP | 584 | #ifdef CONFIG_VFP |
561 | @ Always disable VFP so we can lazily save/restore the old | 585 | @ Always disable VFP so we can lazily save/restore the old |
562 | @ state. This occurs in the context of the previous thread. | 586 | @ state. This occurs in the context of the previous thread. |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index e2b42997ad33..2b92ce85f97f 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -98,20 +98,14 @@ ENTRY(ret_from_fork) | |||
98 | run on an ARM7 and we can save a couple of instructions. | 98 | run on an ARM7 and we can save a couple of instructions. |
99 | --pb */ | 99 | --pb */ |
100 | #ifdef CONFIG_CPU_ARM710 | 100 | #ifdef CONFIG_CPU_ARM710 |
101 | .macro arm710_bug_check, instr, temp | 101 | #define A710(code...) code |
102 | and \temp, \instr, #0x0f000000 @ check for SWI | 102 | .Larm710bug: |
103 | teq \temp, #0x0f000000 | ||
104 | bne .Larm700bug | ||
105 | .endm | ||
106 | |||
107 | .Larm700bug: | ||
108 | ldmia sp, {r0 - lr}^ @ Get calling r0 - lr | 103 | ldmia sp, {r0 - lr}^ @ Get calling r0 - lr |
109 | mov r0, r0 | 104 | mov r0, r0 |
110 | add sp, sp, #S_FRAME_SIZE | 105 | add sp, sp, #S_FRAME_SIZE |
111 | subs pc, lr, #4 | 106 | subs pc, lr, #4 |
112 | #else | 107 | #else |
113 | .macro arm710_bug_check, instr, temp | 108 | #define A710(code...) |
114 | .endm | ||
115 | #endif | 109 | #endif |
116 | 110 | ||
117 | .align 5 | 111 | .align 5 |
@@ -129,14 +123,50 @@ ENTRY(vector_swi) | |||
129 | /* | 123 | /* |
130 | * Get the system call number. | 124 | * Get the system call number. |
131 | */ | 125 | */ |
126 | |||
127 | #if defined(CONFIG_OABI_COMPAT) | ||
128 | |||
129 | /* | ||
130 | * If we have CONFIG_OABI_COMPAT then we need to look at the swi | ||
131 | * value to determine if it is an EABI or an old ABI call. | ||
132 | */ | ||
132 | #ifdef CONFIG_ARM_THUMB | 133 | #ifdef CONFIG_ARM_THUMB |
134 | tst r8, #PSR_T_BIT | ||
135 | movne r10, #0 @ no thumb OABI emulation | ||
136 | ldreq r10, [lr, #-4] @ get SWI instruction | ||
137 | #else | ||
138 | ldr r10, [lr, #-4] @ get SWI instruction | ||
139 | A710( and ip, r10, #0x0f000000 @ check for SWI ) | ||
140 | A710( teq ip, #0x0f000000 ) | ||
141 | A710( bne .Larm710bug ) | ||
142 | #endif | ||
143 | |||
144 | #elif defined(CONFIG_AEABI) | ||
145 | |||
146 | /* | ||
147 | * Pure EABI user space always put syscall number into scno (r7). | ||
148 | */ | ||
149 | A710( ldr ip, [lr, #-4] @ get SWI instruction ) | ||
150 | A710( and ip, ip, #0x0f000000 @ check for SWI ) | ||
151 | A710( teq ip, #0x0f000000 ) | ||
152 | A710( bne .Larm710bug ) | ||
153 | |||
154 | #elif defined(CONFIG_ARM_THUMB) | ||
155 | |||
156 | /* Legacy ABI only, possibly thumb mode. */ | ||
133 | tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs | 157 | tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs |
134 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in | 158 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in |
135 | ldreq scno, [lr, #-4] | 159 | ldreq scno, [lr, #-4] |
160 | |||
136 | #else | 161 | #else |
162 | |||
163 | /* Legacy ABI only. */ | ||
137 | ldr scno, [lr, #-4] @ get SWI instruction | 164 | ldr scno, [lr, #-4] @ get SWI instruction |
165 | A710( and ip, scno, #0x0f000000 @ check for SWI ) | ||
166 | A710( teq ip, #0x0f000000 ) | ||
167 | A710( bne .Larm710bug ) | ||
168 | |||
138 | #endif | 169 | #endif |
139 | arm710_bug_check scno, ip | ||
140 | 170 | ||
141 | #ifdef CONFIG_ALIGNMENT_TRAP | 171 | #ifdef CONFIG_ALIGNMENT_TRAP |
142 | ldr ip, __cr_alignment | 172 | ldr ip, __cr_alignment |
@@ -145,18 +175,31 @@ ENTRY(vector_swi) | |||
145 | #endif | 175 | #endif |
146 | enable_irq | 176 | enable_irq |
147 | 177 | ||
148 | stmdb sp!, {r4, r5} @ push fifth and sixth args | ||
149 | |||
150 | get_thread_info tsk | 178 | get_thread_info tsk |
179 | adr tbl, sys_call_table @ load syscall table pointer | ||
151 | ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing | 180 | ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing |
181 | |||
182 | #if defined(CONFIG_OABI_COMPAT) | ||
183 | /* | ||
184 | * If the swi argument is zero, this is an EABI call and we do nothing. | ||
185 | * | ||
186 | * If this is an old ABI call, get the syscall number into scno and | ||
187 | * get the old ABI syscall table address. | ||
188 | */ | ||
189 | bics r10, r10, #0xff000000 | ||
190 | eorne scno, r10, #__NR_OABI_SYSCALL_BASE | ||
191 | ldrne tbl, =sys_oabi_call_table | ||
192 | #elif !defined(CONFIG_AEABI) | ||
152 | bic scno, scno, #0xff000000 @ mask off SWI op-code | 193 | bic scno, scno, #0xff000000 @ mask off SWI op-code |
153 | eor scno, scno, #__NR_SYSCALL_BASE @ check OS number | 194 | eor scno, scno, #__NR_SYSCALL_BASE @ check OS number |
154 | adr tbl, sys_call_table @ load syscall table pointer | 195 | #endif |
196 | |||
197 | stmdb sp!, {r4, r5} @ push fifth and sixth args | ||
155 | tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? | 198 | tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? |
156 | bne __sys_trace | 199 | bne __sys_trace |
157 | 200 | ||
158 | adr lr, ret_fast_syscall @ return address | ||
159 | cmp scno, #NR_syscalls @ check upper syscall limit | 201 | cmp scno, #NR_syscalls @ check upper syscall limit |
202 | adr lr, ret_fast_syscall @ return address | ||
160 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine | 203 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine |
161 | 204 | ||
162 | add r1, sp, #S_OFF | 205 | add r1, sp, #S_OFF |
@@ -171,11 +214,13 @@ ENTRY(vector_swi) | |||
171 | * context switches, and waiting for our parent to respond. | 214 | * context switches, and waiting for our parent to respond. |
172 | */ | 215 | */ |
173 | __sys_trace: | 216 | __sys_trace: |
217 | mov r2, scno | ||
174 | add r1, sp, #S_OFF | 218 | add r1, sp, #S_OFF |
175 | mov r0, #0 @ trace entry [IP = 0] | 219 | mov r0, #0 @ trace entry [IP = 0] |
176 | bl syscall_trace | 220 | bl syscall_trace |
177 | 221 | ||
178 | adr lr, __sys_trace_return @ return address | 222 | adr lr, __sys_trace_return @ return address |
223 | mov scno, r0 @ syscall number (possibly new) | ||
179 | add r1, sp, #S_R0 + S_OFF @ pointer to regs | 224 | add r1, sp, #S_R0 + S_OFF @ pointer to regs |
180 | cmp scno, #NR_syscalls @ check upper syscall limit | 225 | cmp scno, #NR_syscalls @ check upper syscall limit |
181 | ldmccia r1, {r0 - r3} @ have to reload r0 - r3 | 226 | ldmccia r1, {r0 - r3} @ have to reload r0 - r3 |
@@ -184,6 +229,7 @@ __sys_trace: | |||
184 | 229 | ||
185 | __sys_trace_return: | 230 | __sys_trace_return: |
186 | str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 | 231 | str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
232 | mov r2, scno | ||
187 | mov r1, sp | 233 | mov r1, sp |
188 | mov r0, #1 @ trace exit [IP = 1] | 234 | mov r0, #1 @ trace exit [IP = 1] |
189 | bl syscall_trace | 235 | bl syscall_trace |
@@ -195,10 +241,24 @@ __sys_trace_return: | |||
195 | __cr_alignment: | 241 | __cr_alignment: |
196 | .word cr_alignment | 242 | .word cr_alignment |
197 | #endif | 243 | #endif |
244 | .ltorg | ||
245 | |||
246 | /* | ||
247 | * This is the syscall table declaration for native ABI syscalls. | ||
248 | * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall. | ||
249 | */ | ||
250 | #define ABI(native, compat) native | ||
251 | #ifdef CONFIG_AEABI | ||
252 | #define OBSOLETE(syscall) sys_ni_syscall | ||
253 | #else | ||
254 | #define OBSOLETE(syscall) syscall | ||
255 | #endif | ||
198 | 256 | ||
199 | .type sys_call_table, #object | 257 | .type sys_call_table, #object |
200 | ENTRY(sys_call_table) | 258 | ENTRY(sys_call_table) |
201 | #include "calls.S" | 259 | #include "calls.S" |
260 | #undef ABI | ||
261 | #undef OBSOLETE | ||
202 | 262 | ||
203 | /*============================================================================ | 263 | /*============================================================================ |
204 | * Special system call wrappers | 264 | * Special system call wrappers |
@@ -207,7 +267,7 @@ ENTRY(sys_call_table) | |||
207 | @ r8 = syscall table | 267 | @ r8 = syscall table |
208 | .type sys_syscall, #function | 268 | .type sys_syscall, #function |
209 | sys_syscall: | 269 | sys_syscall: |
210 | eor scno, r0, #__NR_SYSCALL_BASE | 270 | eor scno, r0, #__NR_OABI_SYSCALL_BASE |
211 | cmp scno, #__NR_syscall - __NR_SYSCALL_BASE | 271 | cmp scno, #__NR_syscall - __NR_SYSCALL_BASE |
212 | cmpne scno, #NR_syscalls @ check range | 272 | cmpne scno, #NR_syscalls @ check range |
213 | stmloia sp, {r5, r6} @ shuffle args | 273 | stmloia sp, {r5, r6} @ shuffle args |
@@ -255,6 +315,16 @@ sys_sigaltstack_wrapper: | |||
255 | ldr r2, [sp, #S_OFF + S_SP] | 315 | ldr r2, [sp, #S_OFF + S_SP] |
256 | b do_sigaltstack | 316 | b do_sigaltstack |
257 | 317 | ||
318 | sys_statfs64_wrapper: | ||
319 | teq r1, #88 | ||
320 | moveq r1, #84 | ||
321 | b sys_statfs64 | ||
322 | |||
323 | sys_fstatfs64_wrapper: | ||
324 | teq r1, #88 | ||
325 | moveq r1, #84 | ||
326 | b sys_fstatfs64 | ||
327 | |||
258 | /* | 328 | /* |
259 | * Note: off_4k (r5) is always units of 4K. If we can't do the requested | 329 | * Note: off_4k (r5) is always units of 4K. If we can't do the requested |
260 | * offset, we return EINVAL. | 330 | * offset, we return EINVAL. |
@@ -271,3 +341,49 @@ sys_mmap2: | |||
271 | str r5, [sp, #4] | 341 | str r5, [sp, #4] |
272 | b do_mmap2 | 342 | b do_mmap2 |
273 | #endif | 343 | #endif |
344 | |||
345 | #ifdef CONFIG_OABI_COMPAT | ||
346 | |||
347 | /* | ||
348 | * These are syscalls with argument register differences | ||
349 | */ | ||
350 | |||
351 | sys_oabi_pread64: | ||
352 | stmia sp, {r3, r4} | ||
353 | b sys_pread64 | ||
354 | |||
355 | sys_oabi_pwrite64: | ||
356 | stmia sp, {r3, r4} | ||
357 | b sys_pwrite64 | ||
358 | |||
359 | sys_oabi_truncate64: | ||
360 | mov r3, r2 | ||
361 | mov r2, r1 | ||
362 | b sys_truncate64 | ||
363 | |||
364 | sys_oabi_ftruncate64: | ||
365 | mov r3, r2 | ||
366 | mov r2, r1 | ||
367 | b sys_ftruncate64 | ||
368 | |||
369 | sys_oabi_readahead: | ||
370 | str r3, [sp] | ||
371 | mov r3, r2 | ||
372 | mov r2, r1 | ||
373 | b sys_readahead | ||
374 | |||
375 | /* | ||
376 | * Let's declare a second syscall table for old ABI binaries | ||
377 | * using the compatibility syscall entries. | ||
378 | */ | ||
379 | #define ABI(native, compat) compat | ||
380 | #define OBSOLETE(syscall) syscall | ||
381 | |||
382 | .type sys_oabi_call_table, #object | ||
383 | ENTRY(sys_oabi_call_table) | ||
384 | #include "calls.S" | ||
385 | #undef ABI | ||
386 | #undef OBSOLETE | ||
387 | |||
388 | #endif | ||
389 | |||
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 648cfff93138..55c99cdab7d6 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S | |||
@@ -19,6 +19,7 @@ | |||
19 | @ | 19 | @ |
20 | @ Most of the stack format comes from struct pt_regs, but with | 20 | @ Most of the stack format comes from struct pt_regs, but with |
21 | @ the addition of 8 bytes for storing syscall args 5 and 6. | 21 | @ the addition of 8 bytes for storing syscall args 5 and 6. |
22 | @ This _must_ remain a multiple of 8 for EABI. | ||
22 | @ | 23 | @ |
23 | #define S_OFF 8 | 24 | #define S_OFF 8 |
24 | 25 | ||
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 1e985f2cd70f..1aca1775b28f 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -251,12 +251,11 @@ __turn_mmu_on: | |||
251 | * r10 = procinfo | 251 | * r10 = procinfo |
252 | * | 252 | * |
253 | * Returns: | 253 | * Returns: |
254 | * r0, r3, r5, r6, r7 corrupted | 254 | * r0, r3, r6, r7 corrupted |
255 | * r4 = physical page table address | 255 | * r4 = physical page table address |
256 | */ | 256 | */ |
257 | .type __create_page_tables, %function | 257 | .type __create_page_tables, %function |
258 | __create_page_tables: | 258 | __create_page_tables: |
259 | ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram | ||
260 | pgtbl r4 @ page table address | 259 | pgtbl r4 @ page table address |
261 | 260 | ||
262 | /* | 261 | /* |
@@ -303,7 +302,7 @@ __create_page_tables: | |||
303 | * Then map first 1MB of ram in case it contains our boot params. | 302 | * Then map first 1MB of ram in case it contains our boot params. |
304 | */ | 303 | */ |
305 | add r0, r4, #PAGE_OFFSET >> 18 | 304 | add r0, r4, #PAGE_OFFSET >> 18 |
306 | orr r6, r5, r7 | 305 | orr r6, r7, #PHYS_OFFSET |
307 | str r6, [r0] | 306 | str r6, [r0] |
308 | 307 | ||
309 | #ifdef CONFIG_XIP_KERNEL | 308 | #ifdef CONFIG_XIP_KERNEL |
@@ -311,7 +310,7 @@ __create_page_tables: | |||
311 | * Map some ram to cover our .data and .bss areas. | 310 | * Map some ram to cover our .data and .bss areas. |
312 | * Mapping 3MB should be plenty. | 311 | * Mapping 3MB should be plenty. |
313 | */ | 312 | */ |
314 | sub r3, r4, r5 | 313 | sub r3, r4, #PHYS_OFFSET |
315 | mov r3, r3, lsr #20 | 314 | mov r3, r3, lsr #20 |
316 | add r0, r0, r3, lsl #2 | 315 | add r0, r0, r3, lsl #2 |
317 | add r6, r6, r3, lsl #20 | 316 | add r6, r6, r3, lsl #20 |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index e591f72bcdeb..7b6256bb590e 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -766,6 +766,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
766 | (unsigned long __user *) data); | 766 | (unsigned long __user *) data); |
767 | break; | 767 | break; |
768 | 768 | ||
769 | case PTRACE_SET_SYSCALL: | ||
770 | ret = 0; | ||
771 | child->ptrace_message = data; | ||
772 | break; | ||
773 | |||
769 | default: | 774 | default: |
770 | ret = ptrace_request(child, request, addr, data); | 775 | ret = ptrace_request(child, request, addr, data); |
771 | break; | 776 | break; |
@@ -774,14 +779,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
774 | return ret; | 779 | return ret; |
775 | } | 780 | } |
776 | 781 | ||
777 | asmlinkage void syscall_trace(int why, struct pt_regs *regs) | 782 | asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) |
778 | { | 783 | { |
779 | unsigned long ip; | 784 | unsigned long ip; |
780 | 785 | ||
781 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 786 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
782 | return; | 787 | return scno; |
783 | if (!(current->ptrace & PT_PTRACED)) | 788 | if (!(current->ptrace & PT_PTRACED)) |
784 | return; | 789 | return scno; |
785 | 790 | ||
786 | /* | 791 | /* |
787 | * Save IP. IP is used to denote syscall entry/exit: | 792 | * Save IP. IP is used to denote syscall entry/exit: |
@@ -790,6 +795,8 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs) | |||
790 | ip = regs->ARM_ip; | 795 | ip = regs->ARM_ip; |
791 | regs->ARM_ip = why; | 796 | regs->ARM_ip = why; |
792 | 797 | ||
798 | current->ptrace_message = scno; | ||
799 | |||
793 | /* the 0x80 provides a way for the tracing parent to distinguish | 800 | /* the 0x80 provides a way for the tracing parent to distinguish |
794 | between a syscall stop and SIGTRAP delivery */ | 801 | between a syscall stop and SIGTRAP delivery */ |
795 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 802 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) |
@@ -804,4 +811,6 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs) | |||
804 | current->exit_code = 0; | 811 | current->exit_code = 0; |
805 | } | 812 | } |
806 | regs->ARM_ip = ip; | 813 | regs->ARM_ip = ip; |
814 | |||
815 | return current->ptrace_message; | ||
807 | } | 816 | } |
diff --git a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c index 4c31f2923055..981fe5c6ccbe 100644 --- a/arch/arm/kernel/semaphore.c +++ b/arch/arm/kernel/semaphore.c | |||
@@ -177,41 +177,42 @@ int __down_trylock(struct semaphore * sem) | |||
177 | * ip contains the semaphore pointer on entry. Save the C-clobbered | 177 | * ip contains the semaphore pointer on entry. Save the C-clobbered |
178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return | 178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return |
179 | * value in some cases.. | 179 | * value in some cases.. |
180 | * To remain AAPCS compliant (64-bit stack align) we save r4 as well. | ||
180 | */ | 181 | */ |
181 | asm(" .section .sched.text,\"ax\",%progbits \n\ | 182 | asm(" .section .sched.text,\"ax\",%progbits \n\ |
182 | .align 5 \n\ | 183 | .align 5 \n\ |
183 | .globl __down_failed \n\ | 184 | .globl __down_failed \n\ |
184 | __down_failed: \n\ | 185 | __down_failed: \n\ |
185 | stmfd sp!, {r0 - r3, lr} \n\ | 186 | stmfd sp!, {r0 - r4, lr} \n\ |
186 | mov r0, ip \n\ | 187 | mov r0, ip \n\ |
187 | bl __down \n\ | 188 | bl __down \n\ |
188 | ldmfd sp!, {r0 - r3, pc} \n\ | 189 | ldmfd sp!, {r0 - r4, pc} \n\ |
189 | \n\ | 190 | \n\ |
190 | .align 5 \n\ | 191 | .align 5 \n\ |
191 | .globl __down_interruptible_failed \n\ | 192 | .globl __down_interruptible_failed \n\ |
192 | __down_interruptible_failed: \n\ | 193 | __down_interruptible_failed: \n\ |
193 | stmfd sp!, {r0 - r3, lr} \n\ | 194 | stmfd sp!, {r0 - r4, lr} \n\ |
194 | mov r0, ip \n\ | 195 | mov r0, ip \n\ |
195 | bl __down_interruptible \n\ | 196 | bl __down_interruptible \n\ |
196 | mov ip, r0 \n\ | 197 | mov ip, r0 \n\ |
197 | ldmfd sp!, {r0 - r3, pc} \n\ | 198 | ldmfd sp!, {r0 - r4, pc} \n\ |
198 | \n\ | 199 | \n\ |
199 | .align 5 \n\ | 200 | .align 5 \n\ |
200 | .globl __down_trylock_failed \n\ | 201 | .globl __down_trylock_failed \n\ |
201 | __down_trylock_failed: \n\ | 202 | __down_trylock_failed: \n\ |
202 | stmfd sp!, {r0 - r3, lr} \n\ | 203 | stmfd sp!, {r0 - r4, lr} \n\ |
203 | mov r0, ip \n\ | 204 | mov r0, ip \n\ |
204 | bl __down_trylock \n\ | 205 | bl __down_trylock \n\ |
205 | mov ip, r0 \n\ | 206 | mov ip, r0 \n\ |
206 | ldmfd sp!, {r0 - r3, pc} \n\ | 207 | ldmfd sp!, {r0 - r4, pc} \n\ |
207 | \n\ | 208 | \n\ |
208 | .align 5 \n\ | 209 | .align 5 \n\ |
209 | .globl __up_wakeup \n\ | 210 | .globl __up_wakeup \n\ |
210 | __up_wakeup: \n\ | 211 | __up_wakeup: \n\ |
211 | stmfd sp!, {r0 - r3, lr} \n\ | 212 | stmfd sp!, {r0 - r4, lr} \n\ |
212 | mov r0, ip \n\ | 213 | mov r0, ip \n\ |
213 | bl __up \n\ | 214 | bl __up \n\ |
214 | ldmfd sp!, {r0 - r3, pc} \n\ | 215 | ldmfd sp!, {r0 - r4, pc} \n\ |
215 | "); | 216 | "); |
216 | 217 | ||
217 | EXPORT_SYMBOL(__down_failed); | 218 | EXPORT_SYMBOL(__down_failed); |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index ea569ba482b1..a491de2d9024 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
@@ -147,6 +147,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg) | |||
147 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | 147 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); |
148 | } | 148 | } |
149 | 149 | ||
150 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
150 | /* | 151 | /* |
151 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 152 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
152 | * | 153 | * |
@@ -226,6 +227,7 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third, | |||
226 | return -ENOSYS; | 227 | return -ENOSYS; |
227 | } | 228 | } |
228 | } | 229 | } |
230 | #endif | ||
229 | 231 | ||
230 | /* Fork a new task - this creates a new program thread. | 232 | /* Fork a new task - this creates a new program thread. |
231 | * This is called indirectly via a small wrapper | 233 | * This is called indirectly via a small wrapper |
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c new file mode 100644 index 000000000000..eafa8e5284af --- /dev/null +++ b/arch/arm/kernel/sys_oabi-compat.c | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * arch/arm/kernel/sys_oabi-compat.c | ||
3 | * | ||
4 | * Compatibility wrappers for syscalls that are used from | ||
5 | * old ABI user space binaries with an EABI kernel. | ||
6 | * | ||
7 | * Author: Nicolas Pitre | ||
8 | * Created: Oct 7, 2005 | ||
9 | * Copyright: MontaVista Software, Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * The legacy ABI and the new ARM EABI have different rules making some | ||
18 | * syscalls incompatible especially with structure arguments. | ||
19 | * Most notably, Eabi says 64-bit members should be 64-bit aligned instead of | ||
20 | * simply word aligned. EABI also pads structures to the size of the largest | ||
21 | * member it contains instead of the invariant 32-bit. | ||
22 | * | ||
23 | * The following syscalls are affected: | ||
24 | * | ||
25 | * sys_stat64: | ||
26 | * sys_lstat64: | ||
27 | * sys_fstat64: | ||
28 | * | ||
29 | * struct stat64 has different sizes and some members are shifted | ||
30 | * Compatibility wrappers are needed for them and provided below. | ||
31 | * | ||
32 | * sys_fcntl64: | ||
33 | * | ||
34 | * struct flock64 has different sizes and some members are shifted | ||
35 | * A compatibility wrapper is needed and provided below. | ||
36 | * | ||
37 | * sys_statfs64: | ||
38 | * sys_fstatfs64: | ||
39 | * | ||
40 | * struct statfs64 has extra padding with EABI growing its size from | ||
41 | * 84 to 88. This struct is now __attribute__((packed,aligned(4))) | ||
42 | * with a small assembly wrapper to force the sz argument to 84 if it is 88 | ||
43 | * to avoid copying the extra padding over user space unexpecting it. | ||
44 | * | ||
45 | * sys_newuname: | ||
46 | * | ||
47 | * struct new_utsname has no padding with EABI. No problem there. | ||
48 | * | ||
49 | * sys_epoll_ctl: | ||
50 | * sys_epoll_wait: | ||
51 | * | ||
52 | * struct epoll_event has its second member shifted also affecting the | ||
53 | * structure size. Compatibility wrappers are needed and provided below. | ||
54 | * | ||
55 | * sys_ipc: | ||
56 | * sys_semop: | ||
57 | * sys_semtimedop: | ||
58 | * | ||
59 | * struct sembuf loses its padding with EABI. Since arrays of them are | ||
60 | * used they have to be copyed to remove the padding. Compatibility wrappers | ||
61 | * provided below. | ||
62 | */ | ||
63 | |||
64 | #include <linux/syscalls.h> | ||
65 | #include <linux/errno.h> | ||
66 | #include <linux/fs.h> | ||
67 | #include <linux/fcntl.h> | ||
68 | #include <linux/eventpoll.h> | ||
69 | #include <linux/sem.h> | ||
70 | #include <asm/ipc.h> | ||
71 | #include <asm/uaccess.h> | ||
72 | |||
73 | struct oldabi_stat64 { | ||
74 | unsigned long long st_dev; | ||
75 | unsigned int __pad1; | ||
76 | unsigned long __st_ino; | ||
77 | unsigned int st_mode; | ||
78 | unsigned int st_nlink; | ||
79 | |||
80 | unsigned long st_uid; | ||
81 | unsigned long st_gid; | ||
82 | |||
83 | unsigned long long st_rdev; | ||
84 | unsigned int __pad2; | ||
85 | |||
86 | long long st_size; | ||
87 | unsigned long st_blksize; | ||
88 | unsigned long long st_blocks; | ||
89 | |||
90 | unsigned long st_atime; | ||
91 | unsigned long st_atime_nsec; | ||
92 | |||
93 | unsigned long st_mtime; | ||
94 | unsigned long st_mtime_nsec; | ||
95 | |||
96 | unsigned long st_ctime; | ||
97 | unsigned long st_ctime_nsec; | ||
98 | |||
99 | unsigned long long st_ino; | ||
100 | } __attribute__ ((packed,aligned(4))); | ||
101 | |||
102 | static long cp_oldabi_stat64(struct kstat *stat, | ||
103 | struct oldabi_stat64 __user *statbuf) | ||
104 | { | ||
105 | struct oldabi_stat64 tmp; | ||
106 | |||
107 | tmp.st_dev = huge_encode_dev(stat->dev); | ||
108 | tmp.__pad1 = 0; | ||
109 | tmp.__st_ino = stat->ino; | ||
110 | tmp.st_mode = stat->mode; | ||
111 | tmp.st_nlink = stat->nlink; | ||
112 | tmp.st_uid = stat->uid; | ||
113 | tmp.st_gid = stat->gid; | ||
114 | tmp.st_rdev = huge_encode_dev(stat->rdev); | ||
115 | tmp.st_size = stat->size; | ||
116 | tmp.st_blocks = stat->blocks; | ||
117 | tmp.__pad2 = 0; | ||
118 | tmp.st_blksize = stat->blksize; | ||
119 | tmp.st_atime = stat->atime.tv_sec; | ||
120 | tmp.st_atime_nsec = stat->atime.tv_nsec; | ||
121 | tmp.st_mtime = stat->mtime.tv_sec; | ||
122 | tmp.st_mtime_nsec = stat->mtime.tv_nsec; | ||
123 | tmp.st_ctime = stat->ctime.tv_sec; | ||
124 | tmp.st_ctime_nsec = stat->ctime.tv_nsec; | ||
125 | tmp.st_ino = stat->ino; | ||
126 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; | ||
127 | } | ||
128 | |||
129 | asmlinkage long sys_oabi_stat64(char __user * filename, | ||
130 | struct oldabi_stat64 __user * statbuf) | ||
131 | { | ||
132 | struct kstat stat; | ||
133 | int error = vfs_stat(filename, &stat); | ||
134 | if (!error) | ||
135 | error = cp_oldabi_stat64(&stat, statbuf); | ||
136 | return error; | ||
137 | } | ||
138 | |||
139 | asmlinkage long sys_oabi_lstat64(char __user * filename, | ||
140 | struct oldabi_stat64 __user * statbuf) | ||
141 | { | ||
142 | struct kstat stat; | ||
143 | int error = vfs_lstat(filename, &stat); | ||
144 | if (!error) | ||
145 | error = cp_oldabi_stat64(&stat, statbuf); | ||
146 | return error; | ||
147 | } | ||
148 | |||
149 | asmlinkage long sys_oabi_fstat64(unsigned long fd, | ||
150 | struct oldabi_stat64 __user * statbuf) | ||
151 | { | ||
152 | struct kstat stat; | ||
153 | int error = vfs_fstat(fd, &stat); | ||
154 | if (!error) | ||
155 | error = cp_oldabi_stat64(&stat, statbuf); | ||
156 | return error; | ||
157 | } | ||
158 | |||
159 | struct oabi_flock64 { | ||
160 | short l_type; | ||
161 | short l_whence; | ||
162 | loff_t l_start; | ||
163 | loff_t l_len; | ||
164 | pid_t l_pid; | ||
165 | } __attribute__ ((packed,aligned(4))); | ||
166 | |||
167 | asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd, | ||
168 | unsigned long arg) | ||
169 | { | ||
170 | struct oabi_flock64 user; | ||
171 | struct flock64 kernel; | ||
172 | mm_segment_t fs = USER_DS; /* initialized to kill a warning */ | ||
173 | unsigned long local_arg = arg; | ||
174 | int ret; | ||
175 | |||
176 | switch (cmd) { | ||
177 | case F_GETLK64: | ||
178 | case F_SETLK64: | ||
179 | case F_SETLKW64: | ||
180 | if (copy_from_user(&user, (struct oabi_flock64 __user *)arg, | ||
181 | sizeof(user))) | ||
182 | return -EFAULT; | ||
183 | kernel.l_type = user.l_type; | ||
184 | kernel.l_whence = user.l_whence; | ||
185 | kernel.l_start = user.l_start; | ||
186 | kernel.l_len = user.l_len; | ||
187 | kernel.l_pid = user.l_pid; | ||
188 | local_arg = (unsigned long)&kernel; | ||
189 | fs = get_fs(); | ||
190 | set_fs(KERNEL_DS); | ||
191 | } | ||
192 | |||
193 | ret = sys_fcntl64(fd, cmd, local_arg); | ||
194 | |||
195 | switch (cmd) { | ||
196 | case F_GETLK64: | ||
197 | if (!ret) { | ||
198 | user.l_type = kernel.l_type; | ||
199 | user.l_whence = kernel.l_whence; | ||
200 | user.l_start = kernel.l_start; | ||
201 | user.l_len = kernel.l_len; | ||
202 | user.l_pid = kernel.l_pid; | ||
203 | if (copy_to_user((struct oabi_flock64 __user *)arg, | ||
204 | &user, sizeof(user))) | ||
205 | ret = -EFAULT; | ||
206 | } | ||
207 | case F_SETLK64: | ||
208 | case F_SETLKW64: | ||
209 | set_fs(fs); | ||
210 | } | ||
211 | |||
212 | return ret; | ||
213 | } | ||
214 | |||
215 | struct oabi_epoll_event { | ||
216 | __u32 events; | ||
217 | __u64 data; | ||
218 | } __attribute__ ((packed,aligned(4))); | ||
219 | |||
220 | asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, | ||
221 | struct oabi_epoll_event __user *event) | ||
222 | { | ||
223 | struct oabi_epoll_event user; | ||
224 | struct epoll_event kernel; | ||
225 | mm_segment_t fs; | ||
226 | long ret; | ||
227 | |||
228 | if (op == EPOLL_CTL_DEL) | ||
229 | return sys_epoll_ctl(epfd, op, fd, NULL); | ||
230 | if (copy_from_user(&user, event, sizeof(user))) | ||
231 | return -EFAULT; | ||
232 | kernel.events = user.events; | ||
233 | kernel.data = user.data; | ||
234 | fs = get_fs(); | ||
235 | set_fs(KERNEL_DS); | ||
236 | ret = sys_epoll_ctl(epfd, op, fd, &kernel); | ||
237 | set_fs(fs); | ||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | asmlinkage long sys_oabi_epoll_wait(int epfd, | ||
242 | struct oabi_epoll_event __user *events, | ||
243 | int maxevents, int timeout) | ||
244 | { | ||
245 | struct epoll_event *kbuf; | ||
246 | mm_segment_t fs; | ||
247 | long ret, err, i; | ||
248 | |||
249 | if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event))) | ||
250 | return -EINVAL; | ||
251 | kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL); | ||
252 | if (!kbuf) | ||
253 | return -ENOMEM; | ||
254 | fs = get_fs(); | ||
255 | set_fs(KERNEL_DS); | ||
256 | ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout); | ||
257 | set_fs(fs); | ||
258 | err = 0; | ||
259 | for (i = 0; i < ret; i++) { | ||
260 | __put_user_error(kbuf[i].events, &events->events, err); | ||
261 | __put_user_error(kbuf[i].data, &events->data, err); | ||
262 | events++; | ||
263 | } | ||
264 | kfree(kbuf); | ||
265 | return err ? -EFAULT : ret; | ||
266 | } | ||
267 | |||
268 | struct oabi_sembuf { | ||
269 | unsigned short sem_num; | ||
270 | short sem_op; | ||
271 | short sem_flg; | ||
272 | unsigned short __pad; | ||
273 | }; | ||
274 | |||
275 | asmlinkage long sys_oabi_semtimedop(int semid, | ||
276 | struct oabi_sembuf __user *tsops, | ||
277 | unsigned nsops, | ||
278 | const struct timespec __user *timeout) | ||
279 | { | ||
280 | struct sembuf *sops; | ||
281 | struct timespec local_timeout; | ||
282 | long err; | ||
283 | int i; | ||
284 | |||
285 | if (nsops < 1) | ||
286 | return -EINVAL; | ||
287 | sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); | ||
288 | if (!sops) | ||
289 | return -ENOMEM; | ||
290 | err = 0; | ||
291 | for (i = 0; i < nsops; i++) { | ||
292 | __get_user_error(sops[i].sem_num, &tsops->sem_num, err); | ||
293 | __get_user_error(sops[i].sem_op, &tsops->sem_op, err); | ||
294 | __get_user_error(sops[i].sem_flg, &tsops->sem_flg, err); | ||
295 | tsops++; | ||
296 | } | ||
297 | if (timeout) { | ||
298 | /* copy this as well before changing domain protection */ | ||
299 | err |= copy_from_user(&local_timeout, timeout, sizeof(*timeout)); | ||
300 | timeout = &local_timeout; | ||
301 | } | ||
302 | if (err) { | ||
303 | err = -EFAULT; | ||
304 | } else { | ||
305 | mm_segment_t fs = get_fs(); | ||
306 | set_fs(KERNEL_DS); | ||
307 | err = sys_semtimedop(semid, sops, nsops, timeout); | ||
308 | set_fs(fs); | ||
309 | } | ||
310 | kfree(sops); | ||
311 | return err; | ||
312 | } | ||
313 | |||
314 | asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops, | ||
315 | unsigned nsops) | ||
316 | { | ||
317 | return sys_oabi_semtimedop(semid, tsops, nsops, NULL); | ||
318 | } | ||
319 | |||
320 | extern asmlinkage int sys_ipc(uint call, int first, int second, int third, | ||
321 | void __user *ptr, long fifth); | ||
322 | |||
323 | asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third, | ||
324 | void __user *ptr, long fifth) | ||
325 | { | ||
326 | switch (call & 0xffff) { | ||
327 | case SEMOP: | ||
328 | return sys_oabi_semtimedop(first, | ||
329 | (struct oabi_sembuf __user *)ptr, | ||
330 | second, NULL); | ||
331 | case SEMTIMEDOP: | ||
332 | return sys_oabi_semtimedop(first, | ||
333 | (struct oabi_sembuf __user *)ptr, | ||
334 | second, | ||
335 | (const struct timespec __user *)fifth); | ||
336 | default: | ||
337 | return sys_ipc(call, first, second, third, ptr, fifth); | ||
338 | } | ||
339 | } | ||
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 93cfd3ffcc72..10235b01582e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -404,7 +404,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
404 | struct thread_info *thread = current_thread_info(); | 404 | struct thread_info *thread = current_thread_info(); |
405 | siginfo_t info; | 405 | siginfo_t info; |
406 | 406 | ||
407 | if ((no >> 16) != 0x9f) | 407 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) |
408 | return bad_syscall(no, regs); | 408 | return bad_syscall(no, regs); |
409 | 409 | ||
410 | switch (no & 0xffff) { | 410 | switch (no & 0xffff) { |
diff --git a/arch/arm/lib/ashldi3.S b/arch/arm/lib/ashldi3.S index 561e20717b30..55e57a1c2e6d 100644 --- a/arch/arm/lib/ashldi3.S +++ b/arch/arm/lib/ashldi3.S | |||
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | ENTRY(__ashldi3) | 39 | ENTRY(__ashldi3) |
40 | ENTRY(__aeabi_llsl) | ||
40 | 41 | ||
41 | subs r3, r2, #32 | 42 | subs r3, r2, #32 |
42 | rsb ip, r2, #32 | 43 | rsb ip, r2, #32 |
diff --git a/arch/arm/lib/ashrdi3.S b/arch/arm/lib/ashrdi3.S index 86fb2a90c301..0b31398f89b2 100644 --- a/arch/arm/lib/ashrdi3.S +++ b/arch/arm/lib/ashrdi3.S | |||
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | ENTRY(__ashrdi3) | 39 | ENTRY(__ashrdi3) |
40 | ENTRY(__aeabi_lasr) | ||
40 | 41 | ||
41 | subs r3, r2, #32 | 42 | subs r3, r2, #32 |
42 | rsb ip, r2, #32 | 43 | rsb ip, r2, #32 |
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S index 59026029d017..4e492f4b3f0e 100644 --- a/arch/arm/lib/lib1funcs.S +++ b/arch/arm/lib/lib1funcs.S | |||
@@ -206,6 +206,7 @@ Boston, MA 02111-1307, USA. */ | |||
206 | 206 | ||
207 | 207 | ||
208 | ENTRY(__udivsi3) | 208 | ENTRY(__udivsi3) |
209 | ENTRY(__aeabi_uidiv) | ||
209 | 210 | ||
210 | subs r2, r1, #1 | 211 | subs r2, r1, #1 |
211 | moveq pc, lr | 212 | moveq pc, lr |
@@ -246,6 +247,7 @@ ENTRY(__umodsi3) | |||
246 | 247 | ||
247 | 248 | ||
248 | ENTRY(__divsi3) | 249 | ENTRY(__divsi3) |
250 | ENTRY(__aeabi_idiv) | ||
249 | 251 | ||
250 | cmp r1, #0 | 252 | cmp r1, #0 |
251 | eor ip, r0, r1 @ save the sign of the result. | 253 | eor ip, r0, r1 @ save the sign of the result. |
@@ -303,12 +305,33 @@ ENTRY(__modsi3) | |||
303 | rsbmi r0, r0, #0 | 305 | rsbmi r0, r0, #0 |
304 | mov pc, lr | 306 | mov pc, lr |
305 | 307 | ||
308 | #ifdef CONFIG_AEABI | ||
309 | |||
310 | ENTRY(__aeabi_uidivmod) | ||
311 | |||
312 | stmfd sp!, {r0, r1, ip, lr} | ||
313 | bl __aeabi_uidiv | ||
314 | ldmfd sp!, {r1, r2, ip, lr} | ||
315 | mul r3, r0, r2 | ||
316 | sub r1, r1, r3 | ||
317 | mov pc, lr | ||
318 | |||
319 | ENTRY(__aeabi_idivmod) | ||
320 | |||
321 | stmfd sp!, {r0, r1, ip, lr} | ||
322 | bl __aeabi_idiv | ||
323 | ldmfd sp!, {r1, r2, ip, lr} | ||
324 | mul r3, r0, r2 | ||
325 | sub r1, r1, r3 | ||
326 | mov pc, lr | ||
327 | |||
328 | #endif | ||
306 | 329 | ||
307 | Ldiv0: | 330 | Ldiv0: |
308 | 331 | ||
309 | str lr, [sp, #-4]! | 332 | str lr, [sp, #-8]! |
310 | bl __div0 | 333 | bl __div0 |
311 | mov r0, #0 @ About as wrong as it could be. | 334 | mov r0, #0 @ About as wrong as it could be. |
312 | ldr pc, [sp], #4 | 335 | ldr pc, [sp], #8 |
313 | 336 | ||
314 | 337 | ||
diff --git a/arch/arm/lib/lshrdi3.S b/arch/arm/lib/lshrdi3.S index 46c2ed19ec95..a86dbdd59cc4 100644 --- a/arch/arm/lib/lshrdi3.S +++ b/arch/arm/lib/lshrdi3.S | |||
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | ENTRY(__lshrdi3) | 39 | ENTRY(__lshrdi3) |
40 | ENTRY(__aeabi_llsr) | ||
40 | 41 | ||
41 | subs r3, r2, #32 | 42 | subs r3, r2, #32 |
42 | rsb ip, r2, #32 | 43 | rsb ip, r2, #32 |
diff --git a/arch/arm/lib/muldi3.S b/arch/arm/lib/muldi3.S index c7fbdf005319..72d594184b8a 100644 --- a/arch/arm/lib/muldi3.S +++ b/arch/arm/lib/muldi3.S | |||
@@ -25,6 +25,7 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | ENTRY(__muldi3) | 27 | ENTRY(__muldi3) |
28 | ENTRY(__aeabi_lmul) | ||
28 | 29 | ||
29 | mul xh, yl, xh | 30 | mul xh, yl, xh |
30 | mla xh, xl, yh, xh | 31 | mla xh, xl, yh, xh |
diff --git a/arch/arm/lib/ucmpdi2.S b/arch/arm/lib/ucmpdi2.S index 112630f93e5d..d847a62834cb 100644 --- a/arch/arm/lib/ucmpdi2.S +++ b/arch/arm/lib/ucmpdi2.S | |||
@@ -10,6 +10,7 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
13 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
14 | 15 | ||
15 | #ifdef __ARMEB__ | 16 | #ifdef __ARMEB__ |
@@ -33,3 +34,16 @@ ENTRY(__ucmpdi2) | |||
33 | movhi r0, #2 | 34 | movhi r0, #2 |
34 | mov pc, lr | 35 | mov pc, lr |
35 | 36 | ||
37 | #ifdef CONFIG_AEABI | ||
38 | |||
39 | ENTRY(__aeabi_ulcmp) | ||
40 | |||
41 | cmp xh, yh | ||
42 | cmpeq xl, yl | ||
43 | movlo r0, #-1 | ||
44 | moveq r0, #0 | ||
45 | movhi r0, #1 | ||
46 | mov pc, lr | ||
47 | |||
48 | #endif | ||
49 | |||
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c index f5ef69702296..dc5fa8e5ebef 100644 --- a/arch/arm/mach-aaec2000/aaed2000.c +++ b/arch/arm/mach-aaec2000/aaed2000.c | |||
@@ -90,7 +90,6 @@ static void __init aaed2000_map_io(void) | |||
90 | 90 | ||
91 | MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") | 91 | MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") |
92 | /* Maintainer: Nicolas Bellido Y Ortega */ | 92 | /* Maintainer: Nicolas Bellido Y Ortega */ |
93 | .phys_ram = 0xf0000000, | ||
94 | .phys_io = PIO_BASE, | 93 | .phys_io = PIO_BASE, |
95 | .io_pg_offst = ((VIO_BASE) >> 18) & 0xfffc, | 94 | .io_pg_offst = ((VIO_BASE) >> 18) & 0xfffc, |
96 | .map_io = aaed2000_map_io, | 95 | .map_io = aaed2000_map_io, |
diff --git a/arch/arm/mach-at91rm9200/board-csb337.c b/arch/arm/mach-at91rm9200/board-csb337.c index 4aec834ee47f..54022e58d50d 100644 --- a/arch/arm/mach-at91rm9200/board-csb337.c +++ b/arch/arm/mach-at91rm9200/board-csb337.c | |||
@@ -132,7 +132,6 @@ static void __init csb337_board_init(void) | |||
132 | 132 | ||
133 | MACHINE_START(CSB337, "Cogent CSB337") | 133 | MACHINE_START(CSB337, "Cogent CSB337") |
134 | /* Maintainer: Bill Gatliff */ | 134 | /* Maintainer: Bill Gatliff */ |
135 | .phys_ram = AT91_SDRAM_BASE, | ||
136 | .phys_io = AT91_BASE_SYS, | 135 | .phys_io = AT91_BASE_SYS, |
137 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | 136 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, |
138 | .boot_params = AT91_SDRAM_BASE + 0x100, | 137 | .boot_params = AT91_SDRAM_BASE + 0x100, |
diff --git a/arch/arm/mach-at91rm9200/board-csb637.c b/arch/arm/mach-at91rm9200/board-csb637.c index 23e4cc21481a..8195f9d919ea 100644 --- a/arch/arm/mach-at91rm9200/board-csb637.c +++ b/arch/arm/mach-at91rm9200/board-csb637.c | |||
@@ -105,7 +105,6 @@ static void __init csb637_board_init(void) | |||
105 | 105 | ||
106 | MACHINE_START(CSB637, "Cogent CSB637") | 106 | MACHINE_START(CSB637, "Cogent CSB637") |
107 | /* Maintainer: Bill Gatliff */ | 107 | /* Maintainer: Bill Gatliff */ |
108 | .phys_ram = AT91_SDRAM_BASE, | ||
109 | .phys_io = AT91_BASE_SYS, | 108 | .phys_io = AT91_BASE_SYS, |
110 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | 109 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, |
111 | .boot_params = AT91_SDRAM_BASE + 0x100, | 110 | .boot_params = AT91_SDRAM_BASE + 0x100, |
diff --git a/arch/arm/mach-at91rm9200/board-dk.c b/arch/arm/mach-at91rm9200/board-dk.c index 8c747a31b95a..8a783368366e 100644 --- a/arch/arm/mach-at91rm9200/board-dk.c +++ b/arch/arm/mach-at91rm9200/board-dk.c | |||
@@ -127,7 +127,6 @@ static void __init dk_board_init(void) | |||
127 | 127 | ||
128 | MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK") | 128 | MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK") |
129 | /* Maintainer: SAN People/Atmel */ | 129 | /* Maintainer: SAN People/Atmel */ |
130 | .phys_ram = AT91_SDRAM_BASE, | ||
131 | .phys_io = AT91_BASE_SYS, | 130 | .phys_io = AT91_BASE_SYS, |
132 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | 131 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, |
133 | .boot_params = AT91_SDRAM_BASE + 0x100, | 132 | .boot_params = AT91_SDRAM_BASE + 0x100, |
diff --git a/arch/arm/mach-at91rm9200/board-ek.c b/arch/arm/mach-at91rm9200/board-ek.c index d140645711be..fd0752eba897 100644 --- a/arch/arm/mach-at91rm9200/board-ek.c +++ b/arch/arm/mach-at91rm9200/board-ek.c | |||
@@ -120,7 +120,6 @@ static void __init ek_board_init(void) | |||
120 | 120 | ||
121 | MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK") | 121 | MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK") |
122 | /* Maintainer: SAN People/Atmel */ | 122 | /* Maintainer: SAN People/Atmel */ |
123 | .phys_ram = AT91_SDRAM_BASE, | ||
124 | .phys_io = AT91_BASE_SYS, | 123 | .phys_io = AT91_BASE_SYS, |
125 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, | 124 | .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, |
126 | .boot_params = AT91_SDRAM_BASE + 0x100, | 125 | .boot_params = AT91_SDRAM_BASE + 0x100, |
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c index 43b9423d1440..c13ca6c56baa 100644 --- a/arch/arm/mach-clps711x/autcpu12.c +++ b/arch/arm/mach-clps711x/autcpu12.c | |||
@@ -64,7 +64,6 @@ void __init autcpu12_map_io(void) | |||
64 | 64 | ||
65 | MACHINE_START(AUTCPU12, "autronix autcpu12") | 65 | MACHINE_START(AUTCPU12, "autronix autcpu12") |
66 | /* Maintainer: Thomas Gleixner */ | 66 | /* Maintainer: Thomas Gleixner */ |
67 | .phys_ram = 0xc0000000, | ||
68 | .phys_io = 0x80000000, | 67 | .phys_io = 0x80000000, |
69 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 68 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
70 | .boot_params = 0xc0020000, | 69 | .boot_params = 0xc0020000, |
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c index cba7be5a06c3..831df007f6c7 100644 --- a/arch/arm/mach-clps711x/cdb89712.c +++ b/arch/arm/mach-clps711x/cdb89712.c | |||
@@ -55,7 +55,6 @@ static void __init cdb89712_map_io(void) | |||
55 | 55 | ||
56 | MACHINE_START(CDB89712, "Cirrus-CDB89712") | 56 | MACHINE_START(CDB89712, "Cirrus-CDB89712") |
57 | /* Maintainer: Ray Lehtiniemi */ | 57 | /* Maintainer: Ray Lehtiniemi */ |
58 | .phys_ram = 0xc0000000, | ||
59 | .phys_io = 0x80000000, | 58 | .phys_io = 0x80000000, |
60 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 59 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
61 | .boot_params = 0xc0000100, | 60 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c index 35d51a759b59..e2b2c5ac8a83 100644 --- a/arch/arm/mach-clps711x/ceiva.c +++ b/arch/arm/mach-clps711x/ceiva.c | |||
@@ -56,7 +56,6 @@ static void __init ceiva_map_io(void) | |||
56 | 56 | ||
57 | MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") | 57 | MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") |
58 | /* Maintainer: Rob Scott */ | 58 | /* Maintainer: Rob Scott */ |
59 | .phys_ram = 0xc0000000, | ||
60 | .phys_io = 0x80000000, | 59 | .phys_io = 0x80000000, |
61 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 60 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
62 | .boot_params = 0xc0000100, | 61 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c index c83f3fd68fcd..09fb57e45213 100644 --- a/arch/arm/mach-clps711x/clep7312.c +++ b/arch/arm/mach-clps711x/clep7312.c | |||
@@ -38,7 +38,6 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags, | |||
38 | 38 | ||
39 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") | 39 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") |
40 | /* Maintainer: Nobody */ | 40 | /* Maintainer: Nobody */ |
41 | .phys_ram = 0xc0000000, | ||
42 | .phys_io = 0x80000000, | 41 | .phys_io = 0x80000000, |
43 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 42 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
44 | .boot_params = 0xc0000100, | 43 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c index 255c98b63e15..dc81cc68595d 100644 --- a/arch/arm/mach-clps711x/edb7211-arch.c +++ b/arch/arm/mach-clps711x/edb7211-arch.c | |||
@@ -52,7 +52,6 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags, | |||
52 | 52 | ||
53 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") | 53 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") |
54 | /* Maintainer: Jon McClintock */ | 54 | /* Maintainer: Jon McClintock */ |
55 | .phys_ram = 0xc0000000, | ||
56 | .phys_io = 0x80000000, | 55 | .phys_io = 0x80000000, |
57 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 56 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
58 | .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ | 57 | .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ |
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c index 3d88da0c287b..ff26a85aa4ba 100644 --- a/arch/arm/mach-clps711x/fortunet.c +++ b/arch/arm/mach-clps711x/fortunet.c | |||
@@ -78,7 +78,6 @@ fortunet_fixup(struct machine_desc *desc, struct tag *tags, | |||
78 | 78 | ||
79 | MACHINE_START(FORTUNET, "ARM-FortuNet") | 79 | MACHINE_START(FORTUNET, "ARM-FortuNet") |
80 | /* Maintainer: FortuNet Inc. */ | 80 | /* Maintainer: FortuNet Inc. */ |
81 | .phys_ram = 0xc0000000, | ||
82 | .phys_io = 0x80000000, | 81 | .phys_io = 0x80000000, |
83 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, | 82 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
84 | .boot_params = 0x00000000, | 83 | .boot_params = 0x00000000, |
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index a1acb945fb51..9ba45f4d5a7e 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c | |||
@@ -90,7 +90,6 @@ static void __init p720t_map_io(void) | |||
90 | 90 | ||
91 | MACHINE_START(P720T, "ARM-Prospector720T") | 91 | MACHINE_START(P720T, "ARM-Prospector720T") |
92 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 92 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
93 | .phys_ram = 0xc0000000, | ||
94 | .phys_io = 0x80000000, | 93 | .phys_io = 0x80000000, |
95 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | 94 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
96 | .boot_params = 0xc0000100, | 95 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c index d869af0023f8..5b12cab0e691 100644 --- a/arch/arm/mach-clps7500/core.c +++ b/arch/arm/mach-clps7500/core.c | |||
@@ -384,7 +384,6 @@ static void __init clps7500_init(void) | |||
384 | 384 | ||
385 | MACHINE_START(CLPS7500, "CL-PS7500") | 385 | MACHINE_START(CLPS7500, "CL-PS7500") |
386 | /* Maintainer: Philip Blundell */ | 386 | /* Maintainer: Philip Blundell */ |
387 | .phys_ram = 0x10000000, | ||
388 | .phys_io = 0x03000000, | 387 | .phys_io = 0x03000000, |
389 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, | 388 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
390 | .map_io = clps7500_map_io, | 389 | .map_io = clps7500_map_io, |
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c index ed4614983adb..6d620d8268cc 100644 --- a/arch/arm/mach-ebsa110/core.c +++ b/arch/arm/mach-ebsa110/core.c | |||
@@ -284,7 +284,6 @@ arch_initcall(ebsa110_init); | |||
284 | 284 | ||
285 | MACHINE_START(EBSA110, "EBSA110") | 285 | MACHINE_START(EBSA110, "EBSA110") |
286 | /* Maintainer: Russell King */ | 286 | /* Maintainer: Russell King */ |
287 | .phys_ram = 0x00000000, | ||
288 | .phys_io = 0xe0000000, | 287 | .phys_io = 0xe0000000, |
289 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, | 288 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
290 | .boot_params = 0x00000400, | 289 | .boot_params = 0x00000400, |
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c index 49b898af0032..5b64d5c5b967 100644 --- a/arch/arm/mach-footbridge/cats-hw.c +++ b/arch/arm/mach-footbridge/cats-hw.c | |||
@@ -85,7 +85,6 @@ fixup_cats(struct machine_desc *desc, struct tag *tags, | |||
85 | 85 | ||
86 | MACHINE_START(CATS, "Chalice-CATS") | 86 | MACHINE_START(CATS, "Chalice-CATS") |
87 | /* Maintainer: Philip Blundell */ | 87 | /* Maintainer: Philip Blundell */ |
88 | .phys_ram = 0x00000000, | ||
89 | .phys_io = DC21285_ARMCSR_BASE, | 88 | .phys_io = DC21285_ARMCSR_BASE, |
90 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, | 89 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
91 | .boot_params = 0x00000100, | 90 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-footbridge/co285.c b/arch/arm/mach-footbridge/co285.c index 548a79081688..4545576ad8d9 100644 --- a/arch/arm/mach-footbridge/co285.c +++ b/arch/arm/mach-footbridge/co285.c | |||
@@ -29,7 +29,6 @@ fixup_coebsa285(struct machine_desc *desc, struct tag *tags, | |||
29 | 29 | ||
30 | MACHINE_START(CO285, "co-EBSA285") | 30 | MACHINE_START(CO285, "co-EBSA285") |
31 | /* Maintainer: Mark van Doesburg */ | 31 | /* Maintainer: Mark van Doesburg */ |
32 | .phys_ram = 0x00000000, | ||
33 | .phys_io = DC21285_ARMCSR_BASE, | 32 | .phys_io = DC21285_ARMCSR_BASE, |
34 | .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc, | 33 | .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc, |
35 | .fixup = fixup_coebsa285, | 34 | .fixup = fixup_coebsa285, |
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index 1c37605268d5..b1d3bf20a41e 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | MACHINE_START(EBSA285, "EBSA285") | 15 | MACHINE_START(EBSA285, "EBSA285") |
16 | /* Maintainer: Russell King */ | 16 | /* Maintainer: Russell King */ |
17 | .phys_ram = 0x00000000, | ||
18 | .phys_io = DC21285_ARMCSR_BASE, | 17 | .phys_io = DC21285_ARMCSR_BASE, |
19 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, | 18 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
20 | .boot_params = 0x00000100, | 19 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c index 9e563de465b5..229bf0585e40 100644 --- a/arch/arm/mach-footbridge/netwinder-hw.c +++ b/arch/arm/mach-footbridge/netwinder-hw.c | |||
@@ -649,7 +649,6 @@ fixup_netwinder(struct machine_desc *desc, struct tag *tags, | |||
649 | 649 | ||
650 | MACHINE_START(NETWINDER, "Rebel-NetWinder") | 650 | MACHINE_START(NETWINDER, "Rebel-NetWinder") |
651 | /* Maintainer: Russell King/Rebel.com */ | 651 | /* Maintainer: Russell King/Rebel.com */ |
652 | .phys_ram = 0x00000000, | ||
653 | .phys_io = DC21285_ARMCSR_BASE, | 652 | .phys_io = DC21285_ARMCSR_BASE, |
654 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, | 653 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
655 | .boot_params = 0x00000100, | 654 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-footbridge/personal.c b/arch/arm/mach-footbridge/personal.c index 0146b8bb59da..c4f843fc099d 100644 --- a/arch/arm/mach-footbridge/personal.c +++ b/arch/arm/mach-footbridge/personal.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer") | 15 | MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer") |
16 | /* Maintainer: Jamey Hicks / George France */ | 16 | /* Maintainer: Jamey Hicks / George France */ |
17 | .phys_ram = 0x00000000, | ||
18 | .phys_io = DC21285_ARMCSR_BASE, | 17 | .phys_io = DC21285_ARMCSR_BASE, |
19 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, | 18 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
20 | .boot_params = 0x00000100, | 19 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c index fa59e9e2a5c8..193f968edac3 100644 --- a/arch/arm/mach-h720x/h7201-eval.c +++ b/arch/arm/mach-h720x/h7201-eval.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | MACHINE_START(H7201, "Hynix GMS30C7201") | 32 | MACHINE_START(H7201, "Hynix GMS30C7201") |
33 | /* Maintainer: Robert Schwebel, Pengutronix */ | 33 | /* Maintainer: Robert Schwebel, Pengutronix */ |
34 | .phys_ram = 0x40000000, | ||
35 | .phys_io = 0x80000000, | 34 | .phys_io = 0x80000000, |
36 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, | 35 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
37 | .boot_params = 0xc0001000, | 36 | .boot_params = 0xc0001000, |
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c index d75c8221d2a5..36266896979c 100644 --- a/arch/arm/mach-h720x/h7202-eval.c +++ b/arch/arm/mach-h720x/h7202-eval.c | |||
@@ -72,7 +72,6 @@ static void __init init_eval_h7202(void) | |||
72 | 72 | ||
73 | MACHINE_START(H7202, "Hynix HMS30C7202") | 73 | MACHINE_START(H7202, "Hynix HMS30C7202") |
74 | /* Maintainer: Robert Schwebel, Pengutronix */ | 74 | /* Maintainer: Robert Schwebel, Pengutronix */ |
75 | .phys_ram = 0x40000000, | ||
76 | .phys_io = 0x80000000, | 75 | .phys_io = 0x80000000, |
77 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, | 76 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
78 | .boot_params = 0x40000100, | 77 | .boot_params = 0x40000100, |
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c index c9e0cd8ed016..dc31e3fd6c57 100644 --- a/arch/arm/mach-imx/mx1ads.c +++ b/arch/arm/mach-imx/mx1ads.c | |||
@@ -69,7 +69,6 @@ mx1ads_map_io(void) | |||
69 | 69 | ||
70 | MACHINE_START(MX1ADS, "Motorola MX1ADS") | 70 | MACHINE_START(MX1ADS, "Motorola MX1ADS") |
71 | /* Maintainer: Sascha Hauer, Pengutronix */ | 71 | /* Maintainer: Sascha Hauer, Pengutronix */ |
72 | .phys_ram = 0x08000000, | ||
73 | .phys_io = 0x00200000, | 72 | .phys_io = 0x00200000, |
74 | .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, | 73 | .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, |
75 | .boot_params = 0x08000100, | 74 | .boot_params = 0x08000100, |
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 3afedeb56a6e..d8d3c2a5a97e 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -347,7 +347,6 @@ static struct sys_timer ap_timer = { | |||
347 | 347 | ||
348 | MACHINE_START(INTEGRATOR, "ARM-Integrator") | 348 | MACHINE_START(INTEGRATOR, "ARM-Integrator") |
349 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 349 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
350 | .phys_ram = 0x00000000, | ||
351 | .phys_io = 0x16000000, | 350 | .phys_io = 0x16000000, |
352 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, | 351 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, |
353 | .boot_params = 0x00000100, | 352 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 16cf2482a3e9..31820170f306 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -578,7 +578,6 @@ static struct sys_timer cp_timer = { | |||
578 | 578 | ||
579 | MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") | 579 | MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") |
580 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 580 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
581 | .phys_ram = 0x00000000, | ||
582 | .phys_io = 0x16000000, | 581 | .phys_io = 0x16000000, |
583 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, | 582 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, |
584 | .boot_params = 0x00000100, | 583 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c index 80770233b8d4..e4f4c52d93d4 100644 --- a/arch/arm/mach-iop3xx/iop321-setup.c +++ b/arch/arm/mach-iop3xx/iop321-setup.c | |||
@@ -151,7 +151,6 @@ extern void iop321_init_time(void); | |||
151 | #if defined(CONFIG_ARCH_IQ80321) | 151 | #if defined(CONFIG_ARCH_IQ80321) |
152 | MACHINE_START(IQ80321, "Intel IQ80321") | 152 | MACHINE_START(IQ80321, "Intel IQ80321") |
153 | /* Maintainer: Intel Corporation */ | 153 | /* Maintainer: Intel Corporation */ |
154 | .phys_ram = PHYS_OFFSET, | ||
155 | .phys_io = IQ80321_UART, | 154 | .phys_io = IQ80321_UART, |
156 | .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc, | 155 | .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc, |
157 | .map_io = iq80321_map_io, | 156 | .map_io = iq80321_map_io, |
@@ -163,7 +162,6 @@ MACHINE_END | |||
163 | #elif defined(CONFIG_ARCH_IQ31244) | 162 | #elif defined(CONFIG_ARCH_IQ31244) |
164 | MACHINE_START(IQ31244, "Intel IQ31244") | 163 | MACHINE_START(IQ31244, "Intel IQ31244") |
165 | /* Maintainer: Intel Corp. */ | 164 | /* Maintainer: Intel Corp. */ |
166 | .phys_ram = PHYS_OFFSET, | ||
167 | .phys_io = IQ31244_UART, | 165 | .phys_io = IQ31244_UART, |
168 | .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc, | 166 | .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc, |
169 | .map_io = iq31244_map_io, | 167 | .map_io = iq31244_map_io, |
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c index e6ea1cba6a17..63585485123e 100644 --- a/arch/arm/mach-iop3xx/iop331-setup.c +++ b/arch/arm/mach-iop3xx/iop331-setup.c | |||
@@ -195,7 +195,6 @@ extern void iq80332_map_io(void); | |||
195 | #if defined(CONFIG_ARCH_IQ80331) | 195 | #if defined(CONFIG_ARCH_IQ80331) |
196 | MACHINE_START(IQ80331, "Intel IQ80331") | 196 | MACHINE_START(IQ80331, "Intel IQ80331") |
197 | /* Maintainer: Intel Corp. */ | 197 | /* Maintainer: Intel Corp. */ |
198 | .phys_ram = PHYS_OFFSET, | ||
199 | .phys_io = 0xfefff000, | 198 | .phys_io = 0xfefff000, |
200 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical | 199 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
201 | .map_io = iq80331_map_io, | 200 | .map_io = iq80331_map_io, |
@@ -208,7 +207,6 @@ MACHINE_END | |||
208 | #elif defined(CONFIG_MACH_IQ80332) | 207 | #elif defined(CONFIG_MACH_IQ80332) |
209 | MACHINE_START(IQ80332, "Intel IQ80332") | 208 | MACHINE_START(IQ80332, "Intel IQ80332") |
210 | /* Maintainer: Intel Corp. */ | 209 | /* Maintainer: Intel Corp. */ |
211 | .phys_ram = PHYS_OFFSET, | ||
212 | .phys_io = 0xfefff000, | 210 | .phys_io = 0xfefff000, |
213 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical | 211 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
214 | .map_io = iq80332_map_io, | 212 | .map_io = iq80332_map_io, |
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c index 6851abaf5524..cfd5bef3190b 100644 --- a/arch/arm/mach-ixp2000/core.c +++ b/arch/arm/mach-ixp2000/core.c | |||
@@ -106,6 +106,16 @@ static struct map_desc ixp2000_io_desc[] __initdata = { | |||
106 | .length = IXP2000_MSF_SIZE, | 106 | .length = IXP2000_MSF_SIZE, |
107 | .type = MT_IXP2000_DEVICE, | 107 | .type = MT_IXP2000_DEVICE, |
108 | }, { | 108 | }, { |
109 | .virtual = IXP2000_SCRATCH_RING_VIRT_BASE, | ||
110 | .pfn = __phys_to_pfn(IXP2000_SCRATCH_RING_PHYS_BASE), | ||
111 | .length = IXP2000_SCRATCH_RING_SIZE, | ||
112 | .type = MT_IXP2000_DEVICE, | ||
113 | }, { | ||
114 | .virtual = IXP2000_SRAM0_VIRT_BASE, | ||
115 | .pfn = __phys_to_pfn(IXP2000_SRAM0_PHYS_BASE), | ||
116 | .length = IXP2000_SRAM0_SIZE, | ||
117 | .type = MT_IXP2000_DEVICE, | ||
118 | }, { | ||
109 | .virtual = IXP2000_PCI_IO_VIRT_BASE, | 119 | .virtual = IXP2000_PCI_IO_VIRT_BASE, |
110 | .pfn = __phys_to_pfn(IXP2000_PCI_IO_PHYS_BASE), | 120 | .pfn = __phys_to_pfn(IXP2000_PCI_IO_PHYS_BASE), |
111 | .length = IXP2000_PCI_IO_SIZE, | 121 | .length = IXP2000_PCI_IO_SIZE, |
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c index 61f6006241bd..9e5a13bb39d0 100644 --- a/arch/arm/mach-ixp2000/enp2611.c +++ b/arch/arm/mach-ixp2000/enp2611.c | |||
@@ -254,7 +254,6 @@ static void __init enp2611_init_machine(void) | |||
254 | 254 | ||
255 | MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board") | 255 | MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board") |
256 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | 256 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
257 | .phys_ram = 0x00000000, | ||
258 | .phys_io = IXP2000_UART_PHYS_BASE, | 257 | .phys_io = IXP2000_UART_PHYS_BASE, |
259 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, | 258 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
260 | .boot_params = 0x00000100, | 259 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c index fd280a93637e..7c782403042a 100644 --- a/arch/arm/mach-ixp2000/ixdp2400.c +++ b/arch/arm/mach-ixp2000/ixdp2400.c | |||
@@ -169,7 +169,6 @@ void ixdp2400_init_irq(void) | |||
169 | 169 | ||
170 | MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform") | 170 | MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform") |
171 | /* Maintainer: MontaVista Software, Inc. */ | 171 | /* Maintainer: MontaVista Software, Inc. */ |
172 | .phys_ram = 0x00000000, | ||
173 | .phys_io = IXP2000_UART_PHYS_BASE, | 172 | .phys_io = IXP2000_UART_PHYS_BASE, |
174 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, | 173 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
175 | .boot_params = 0x00000100, | 174 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c index f9073aa28615..076e3f8acc96 100644 --- a/arch/arm/mach-ixp2000/ixdp2800.c +++ b/arch/arm/mach-ixp2000/ixdp2800.c | |||
@@ -285,7 +285,6 @@ void ixdp2800_init_irq(void) | |||
285 | 285 | ||
286 | MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform") | 286 | MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform") |
287 | /* Maintainer: MontaVista Software, Inc. */ | 287 | /* Maintainer: MontaVista Software, Inc. */ |
288 | .phys_ram = 0x00000000, | ||
289 | .phys_io = IXP2000_UART_PHYS_BASE, | 288 | .phys_io = IXP2000_UART_PHYS_BASE, |
290 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, | 289 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
291 | .boot_params = 0x00000100, | 290 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c index e6a882f35da2..10f06606d460 100644 --- a/arch/arm/mach-ixp2000/ixdp2x01.c +++ b/arch/arm/mach-ixp2000/ixdp2x01.c | |||
@@ -376,7 +376,6 @@ static void __init ixdp2x01_init_machine(void) | |||
376 | #ifdef CONFIG_ARCH_IXDP2401 | 376 | #ifdef CONFIG_ARCH_IXDP2401 |
377 | MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform") | 377 | MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform") |
378 | /* Maintainer: MontaVista Software, Inc. */ | 378 | /* Maintainer: MontaVista Software, Inc. */ |
379 | .phys_ram = 0x00000000, | ||
380 | .phys_io = IXP2000_UART_PHYS_BASE, | 379 | .phys_io = IXP2000_UART_PHYS_BASE, |
381 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, | 380 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
382 | .boot_params = 0x00000100, | 381 | .boot_params = 0x00000100, |
@@ -390,7 +389,6 @@ MACHINE_END | |||
390 | #ifdef CONFIG_ARCH_IXDP2801 | 389 | #ifdef CONFIG_ARCH_IXDP2801 |
391 | MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform") | 390 | MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform") |
392 | /* Maintainer: MontaVista Software, Inc. */ | 391 | /* Maintainer: MontaVista Software, Inc. */ |
393 | .phys_ram = 0x00000000, | ||
394 | .phys_io = IXP2000_UART_PHYS_BASE, | 392 | .phys_io = IXP2000_UART_PHYS_BASE, |
395 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, | 393 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
396 | .boot_params = 0x00000100, | 394 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c index 679594a73981..13f8a7ac3ba9 100644 --- a/arch/arm/mach-ixp4xx/coyote-setup.c +++ b/arch/arm/mach-ixp4xx/coyote-setup.c | |||
@@ -101,7 +101,6 @@ static void __init coyote_init(void) | |||
101 | #ifdef CONFIG_ARCH_ADI_COYOTE | 101 | #ifdef CONFIG_ARCH_ADI_COYOTE |
102 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") | 102 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") |
103 | /* Maintainer: MontaVista Software, Inc. */ | 103 | /* Maintainer: MontaVista Software, Inc. */ |
104 | .phys_ram = PHYS_OFFSET, | ||
105 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 104 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
106 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 105 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
107 | .map_io = ixp4xx_map_io, | 106 | .map_io = ixp4xx_map_io, |
@@ -119,7 +118,6 @@ MACHINE_END | |||
119 | #ifdef CONFIG_MACH_IXDPG425 | 118 | #ifdef CONFIG_MACH_IXDPG425 |
120 | MACHINE_START(IXDPG425, "Intel IXDPG425") | 119 | MACHINE_START(IXDPG425, "Intel IXDPG425") |
121 | /* Maintainer: MontaVista Software, Inc. */ | 120 | /* Maintainer: MontaVista Software, Inc. */ |
122 | .phys_ram = PHYS_OFFSET, | ||
123 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 121 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
124 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 122 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
125 | .map_io = ixp4xx_map_io, | 123 | .map_io = ixp4xx_map_io, |
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index 038670489970..654e2eed81fb 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c | |||
@@ -142,7 +142,6 @@ static void __init gtwx5715_init(void) | |||
142 | 142 | ||
143 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") | 143 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") |
144 | /* Maintainer: George Joseph */ | 144 | /* Maintainer: George Joseph */ |
145 | .phys_ram = PHYS_OFFSET, | ||
146 | .phys_io = IXP4XX_UART2_BASE_PHYS, | 145 | .phys_io = IXP4XX_UART2_BASE_PHYS, |
147 | .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc, | 146 | .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc, |
148 | .map_io = ixp4xx_map_io, | 147 | .map_io = ixp4xx_map_io, |
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index c2e105c89c95..da72383ee301 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c | |||
@@ -121,7 +121,6 @@ static void __init ixdp425_init(void) | |||
121 | #ifdef CONFIG_ARCH_IXDP425 | 121 | #ifdef CONFIG_ARCH_IXDP425 |
122 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") | 122 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") |
123 | /* Maintainer: MontaVista Software, Inc. */ | 123 | /* Maintainer: MontaVista Software, Inc. */ |
124 | .phys_ram = PHYS_OFFSET, | ||
125 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 124 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
126 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 125 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
127 | .map_io = ixp4xx_map_io, | 126 | .map_io = ixp4xx_map_io, |
@@ -135,7 +134,6 @@ MACHINE_END | |||
135 | #ifdef CONFIG_MACH_IXDP465 | 134 | #ifdef CONFIG_MACH_IXDP465 |
136 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") | 135 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") |
137 | /* Maintainer: MontaVista Software, Inc. */ | 136 | /* Maintainer: MontaVista Software, Inc. */ |
138 | .phys_ram = PHYS_OFFSET, | ||
139 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 137 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
140 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 138 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
141 | .map_io = ixp4xx_map_io, | 139 | .map_io = ixp4xx_map_io, |
@@ -149,7 +147,6 @@ MACHINE_END | |||
149 | #ifdef CONFIG_ARCH_PRPMC1100 | 147 | #ifdef CONFIG_ARCH_PRPMC1100 |
150 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") | 148 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") |
151 | /* Maintainer: MontaVista Software, Inc. */ | 149 | /* Maintainer: MontaVista Software, Inc. */ |
152 | .phys_ram = PHYS_OFFSET, | ||
153 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 150 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
154 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 151 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
155 | .map_io = ixp4xx_map_io, | 152 | .map_io = ixp4xx_map_io, |
@@ -169,7 +166,6 @@ MACHINE_END | |||
169 | #ifdef CONFIG_ARCH_AVILA | 166 | #ifdef CONFIG_ARCH_AVILA |
170 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") | 167 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") |
171 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ | 168 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ |
172 | .phys_ram = PHYS_OFFSET, | ||
173 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 169 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
174 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, | 170 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
175 | .map_io = ixp4xx_map_io, | 171 | .map_io = ixp4xx_map_io, |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 49998a8bd4e8..856d56f3b2ae 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -124,7 +124,6 @@ static void __init nas100d_init(void) | |||
124 | 124 | ||
125 | MACHINE_START(NAS100D, "Iomega NAS 100d") | 125 | MACHINE_START(NAS100D, "Iomega NAS 100d") |
126 | /* Maintainer: www.nslu2-linux.org */ | 126 | /* Maintainer: www.nslu2-linux.org */ |
127 | .phys_ram = PHYS_OFFSET, | ||
128 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 127 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
129 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | 128 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, |
130 | .boot_params = 0x00000100, | 129 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 289e94cb65c2..da9340a53434 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -123,7 +123,6 @@ static void __init nslu2_init(void) | |||
123 | 123 | ||
124 | MACHINE_START(NSLU2, "Linksys NSLU2") | 124 | MACHINE_START(NSLU2, "Linksys NSLU2") |
125 | /* Maintainer: www.nslu2-linux.org */ | 125 | /* Maintainer: www.nslu2-linux.org */ |
126 | .phys_ram = PHYS_OFFSET, | ||
127 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 126 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
128 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | 127 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, |
129 | .boot_params = 0x00000100, | 128 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c index 03ed742ae2be..ac626436e96f 100644 --- a/arch/arm/mach-l7200/core.c +++ b/arch/arm/mach-l7200/core.c | |||
@@ -91,7 +91,6 @@ static void __init l7200_map_io(void) | |||
91 | 91 | ||
92 | MACHINE_START(L7200, "LinkUp Systems L7200") | 92 | MACHINE_START(L7200, "LinkUp Systems L7200") |
93 | /* Maintainer: Steve Hill / Scott McConnell */ | 93 | /* Maintainer: Steve Hill / Scott McConnell */ |
94 | .phys_ram = 0xf0000000, | ||
95 | .phys_io = 0x80040000, | 94 | .phys_io = 0x80040000, |
96 | .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc, | 95 | .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc, |
97 | .map_io = l7200_map_io, | 96 | .map_io = l7200_map_io, |
diff --git a/arch/arm/mach-lh7a40x/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c index 19f2fa2244c4..2cccc27c62e4 100644 --- a/arch/arm/mach-lh7a40x/arch-kev7a400.c +++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c | |||
@@ -112,7 +112,6 @@ void __init lh7a40x_init_board_irq (void) | |||
112 | 112 | ||
113 | MACHINE_START (KEV7A400, "Sharp KEV7a400") | 113 | MACHINE_START (KEV7A400, "Sharp KEV7a400") |
114 | /* Maintainer: Marc Singer */ | 114 | /* Maintainer: Marc Singer */ |
115 | .phys_ram = 0xc0000000, | ||
116 | .phys_io = 0x80000000, | 115 | .phys_io = 0x80000000, |
117 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, | 116 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
118 | .boot_params = 0xc0000100, | 117 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c index 4eb962fdb3a8..12e23277c5ea 100644 --- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c +++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c | |||
@@ -317,7 +317,6 @@ lpd7a400_map_io(void) | |||
317 | 317 | ||
318 | MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10") | 318 | MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10") |
319 | /* Maintainer: Marc Singer */ | 319 | /* Maintainer: Marc Singer */ |
320 | .phys_ram = 0xc0000000, | ||
321 | .phys_io = 0x80000000, | 320 | .phys_io = 0x80000000, |
322 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, | 321 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
323 | .boot_params = 0xc0000100, | 322 | .boot_params = 0xc0000100, |
@@ -333,7 +332,6 @@ MACHINE_END | |||
333 | 332 | ||
334 | MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10") | 333 | MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10") |
335 | /* Maintainer: Marc Singer */ | 334 | /* Maintainer: Marc Singer */ |
336 | .phys_ram = 0xc0000000, | ||
337 | .phys_io = 0x80000000, | 335 | .phys_io = 0x80000000, |
338 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, | 336 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
339 | .boot_params = 0xc0000100, | 337 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c index 4b292e93fbe2..bdc20b51b076 100644 --- a/arch/arm/mach-omap1/board-generic.c +++ b/arch/arm/mach-omap1/board-generic.c | |||
@@ -109,7 +109,6 @@ static void __init omap_generic_map_io(void) | |||
109 | 109 | ||
110 | MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") | 110 | MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") |
111 | /* Maintainer: Tony Lindgren <tony@atomide.com> */ | 111 | /* Maintainer: Tony Lindgren <tony@atomide.com> */ |
112 | .phys_ram = 0x10000000, | ||
113 | .phys_io = 0xfff00000, | 112 | .phys_io = 0xfff00000, |
114 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 113 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
115 | .boot_params = 0x10000100, | 114 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index a07e2c9307fa..9533c36a92df 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -199,7 +199,6 @@ static void __init h2_map_io(void) | |||
199 | 199 | ||
200 | MACHINE_START(OMAP_H2, "TI-H2") | 200 | MACHINE_START(OMAP_H2, "TI-H2") |
201 | /* Maintainer: Imre Deak <imre.deak@nokia.com> */ | 201 | /* Maintainer: Imre Deak <imre.deak@nokia.com> */ |
202 | .phys_ram = 0x10000000, | ||
203 | .phys_io = 0xfff00000, | 202 | .phys_io = 0xfff00000, |
204 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 203 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
205 | .boot_params = 0x10000100, | 204 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index 668e278433c2..d665efc1c344 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -215,7 +215,6 @@ static void __init h3_map_io(void) | |||
215 | 215 | ||
216 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") | 216 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") |
217 | /* Maintainer: Texas Instruments, Inc. */ | 217 | /* Maintainer: Texas Instruments, Inc. */ |
218 | .phys_ram = 0x10000000, | ||
219 | .phys_io = 0xfff00000, | 218 | .phys_io = 0xfff00000, |
220 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 219 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
221 | .boot_params = 0x10000100, | 220 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 95f1ff36cdcb..652f37c7f906 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c | |||
@@ -303,7 +303,6 @@ static void __init innovator_map_io(void) | |||
303 | 303 | ||
304 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") | 304 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") |
305 | /* Maintainer: MontaVista Software, Inc. */ | 305 | /* Maintainer: MontaVista Software, Inc. */ |
306 | .phys_ram = 0x10000000, | ||
307 | .phys_io = 0xfff00000, | 306 | .phys_io = 0xfff00000, |
308 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 307 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
309 | .boot_params = 0x10000100, | 308 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c index 0448fa7de8a4..58f783930d45 100644 --- a/arch/arm/mach-omap1/board-netstar.c +++ b/arch/arm/mach-omap1/board-netstar.c | |||
@@ -149,7 +149,6 @@ postcore_initcall(netstar_late_init); | |||
149 | 149 | ||
150 | MACHINE_START(NETSTAR, "NetStar OMAP5910") | 150 | MACHINE_START(NETSTAR, "NetStar OMAP5910") |
151 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ | 151 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ |
152 | .phys_ram = 0x10000000, | ||
153 | .phys_io = 0xfff00000, | 152 | .phys_io = 0xfff00000, |
154 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 153 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
155 | .boot_params = 0x10000100, | 154 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index e990e1bc1669..e5d126e8f276 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -274,7 +274,6 @@ static void __init osk_map_io(void) | |||
274 | 274 | ||
275 | MACHINE_START(OMAP_OSK, "TI-OSK") | 275 | MACHINE_START(OMAP_OSK, "TI-OSK") |
276 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ | 276 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ |
277 | .phys_ram = 0x10000000, | ||
278 | .phys_io = 0xfff00000, | 277 | .phys_io = 0xfff00000, |
279 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 278 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
280 | .boot_params = 0x10000100, | 279 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c index 5c975eb5c34b..67fada207622 100644 --- a/arch/arm/mach-omap1/board-palmte.c +++ b/arch/arm/mach-omap1/board-palmte.c | |||
@@ -76,7 +76,6 @@ static void __init omap_generic_map_io(void) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") | 78 | MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") |
79 | .phys_ram = 0x10000000, | ||
80 | .phys_io = 0xfff00000, | 79 | .phys_io = 0xfff00000, |
81 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 80 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
82 | .boot_params = 0x10000100, | 81 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c index 92ff5dc07351..88708a0c52a2 100644 --- a/arch/arm/mach-omap1/board-perseus2.c +++ b/arch/arm/mach-omap1/board-perseus2.c | |||
@@ -199,7 +199,6 @@ static void __init omap_perseus2_map_io(void) | |||
199 | 199 | ||
200 | MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") | 200 | MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") |
201 | /* Maintainer: Kevin Hilman <kjh@hilman.org> */ | 201 | /* Maintainer: Kevin Hilman <kjh@hilman.org> */ |
202 | .phys_ram = 0x10000000, | ||
203 | .phys_io = 0xfff00000, | 202 | .phys_io = 0xfff00000, |
204 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 203 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
205 | .boot_params = 0x10000100, | 204 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c index 6f9a6220e78a..959b4b847c87 100644 --- a/arch/arm/mach-omap1/board-voiceblue.c +++ b/arch/arm/mach-omap1/board-voiceblue.c | |||
@@ -281,7 +281,6 @@ EXPORT_SYMBOL(voiceblue_wdt_ping); | |||
281 | 281 | ||
282 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") | 282 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") |
283 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ | 283 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ |
284 | .phys_ram = 0x10000000, | ||
285 | .phys_io = 0xfff00000, | 284 | .phys_io = 0xfff00000, |
286 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, | 285 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
287 | .boot_params = 0x10000100, | 286 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index c602e7a3d93e..b937123e5c65 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -69,7 +69,6 @@ static void __init omap_generic_map_io(void) | |||
69 | 69 | ||
70 | MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") | 70 | MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") |
71 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ | 71 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ |
72 | .phys_ram = 0x80000000, | ||
73 | .phys_io = 0x48000000, | 72 | .phys_io = 0x48000000, |
74 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | 73 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, |
75 | .boot_params = 0x80000100, | 74 | .boot_params = 0x80000100, |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index f2554469a76a..c3c35d40378a 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -186,7 +186,6 @@ static void __init omap_h4_map_io(void) | |||
186 | 186 | ||
187 | MACHINE_START(OMAP_H4, "OMAP2420 H4 board") | 187 | MACHINE_START(OMAP_H4, "OMAP2420 H4 board") |
188 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ | 188 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ |
189 | .phys_ram = 0x80000000, | ||
190 | .phys_io = 0x48000000, | 189 | .phys_io = 0x48000000, |
191 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | 190 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, |
192 | .boot_params = 0x80000100, | 191 | .boot_params = 0x80000100, |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 5a7b873f29b3..7ffd2de8f2f3 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -342,7 +342,6 @@ static void __init fixup_corgi(struct machine_desc *desc, | |||
342 | 342 | ||
343 | #ifdef CONFIG_MACH_CORGI | 343 | #ifdef CONFIG_MACH_CORGI |
344 | MACHINE_START(CORGI, "SHARP Corgi") | 344 | MACHINE_START(CORGI, "SHARP Corgi") |
345 | .phys_ram = 0xa0000000, | ||
346 | .phys_io = 0x40000000, | 345 | .phys_io = 0x40000000, |
347 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 346 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
348 | .fixup = fixup_corgi, | 347 | .fixup = fixup_corgi, |
@@ -355,7 +354,6 @@ MACHINE_END | |||
355 | 354 | ||
356 | #ifdef CONFIG_MACH_SHEPHERD | 355 | #ifdef CONFIG_MACH_SHEPHERD |
357 | MACHINE_START(SHEPHERD, "SHARP Shepherd") | 356 | MACHINE_START(SHEPHERD, "SHARP Shepherd") |
358 | .phys_ram = 0xa0000000, | ||
359 | .phys_io = 0x40000000, | 357 | .phys_io = 0x40000000, |
360 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 358 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
361 | .fixup = fixup_corgi, | 359 | .fixup = fixup_corgi, |
@@ -368,7 +366,6 @@ MACHINE_END | |||
368 | 366 | ||
369 | #ifdef CONFIG_MACH_HUSKY | 367 | #ifdef CONFIG_MACH_HUSKY |
370 | MACHINE_START(HUSKY, "SHARP Husky") | 368 | MACHINE_START(HUSKY, "SHARP Husky") |
371 | .phys_ram = 0xa0000000, | ||
372 | .phys_io = 0x40000000, | 369 | .phys_io = 0x40000000, |
373 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 370 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
374 | .fixup = fixup_corgi, | 371 | .fixup = fixup_corgi, |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 7de159e2ab42..347b9dea24c6 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -183,7 +183,6 @@ static void __init idp_map_io(void) | |||
183 | 183 | ||
184 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 184 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") |
185 | /* Maintainer: Vibren Technologies */ | 185 | /* Maintainer: Vibren Technologies */ |
186 | .phys_ram = 0xa0000000, | ||
187 | .phys_io = 0x40000000, | 186 | .phys_io = 0x40000000, |
188 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 187 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
189 | .map_io = idp_map_io, | 188 | .map_io = idp_map_io, |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index b464bc88ff93..3e26d7ce5bb2 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -437,7 +437,6 @@ static void __init lubbock_map_io(void) | |||
437 | 437 | ||
438 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | 438 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") |
439 | /* Maintainer: MontaVista Software Inc. */ | 439 | /* Maintainer: MontaVista Software Inc. */ |
440 | .phys_ram = 0xa0000000, | ||
441 | .phys_io = 0x40000000, | 440 | .phys_io = 0x40000000, |
442 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 441 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
443 | .map_io = lubbock_map_io, | 442 | .map_io = lubbock_map_io, |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 8da9d3efe9a0..d5bda60209ec 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -489,7 +489,6 @@ static void __init mainstone_map_io(void) | |||
489 | 489 | ||
490 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 490 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
491 | /* Maintainer: MontaVista Software Inc. */ | 491 | /* Maintainer: MontaVista Software Inc. */ |
492 | .phys_ram = 0xa0000000, | ||
493 | .phys_io = 0x40000000, | 492 | .phys_io = 0x40000000, |
494 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 493 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
495 | .map_io = mainstone_map_io, | 494 | .map_io = mainstone_map_io, |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 663c95005985..911e6ff5a9bd 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -311,7 +311,6 @@ static void __init fixup_poodle(struct machine_desc *desc, | |||
311 | } | 311 | } |
312 | 312 | ||
313 | MACHINE_START(POODLE, "SHARP Poodle") | 313 | MACHINE_START(POODLE, "SHARP Poodle") |
314 | .phys_ram = 0xa0000000, | ||
315 | .phys_io = 0x40000000, | 314 | .phys_io = 0x40000000, |
316 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 315 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
317 | .fixup = fixup_poodle, | 316 | .fixup = fixup_poodle, |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index a9eacc06555f..c094d99ebf56 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -497,7 +497,6 @@ static void __init fixup_spitz(struct machine_desc *desc, | |||
497 | 497 | ||
498 | #ifdef CONFIG_MACH_SPITZ | 498 | #ifdef CONFIG_MACH_SPITZ |
499 | MACHINE_START(SPITZ, "SHARP Spitz") | 499 | MACHINE_START(SPITZ, "SHARP Spitz") |
500 | .phys_ram = 0xa0000000, | ||
501 | .phys_io = 0x40000000, | 500 | .phys_io = 0x40000000, |
502 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 501 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
503 | .fixup = fixup_spitz, | 502 | .fixup = fixup_spitz, |
@@ -510,7 +509,6 @@ MACHINE_END | |||
510 | 509 | ||
511 | #ifdef CONFIG_MACH_BORZOI | 510 | #ifdef CONFIG_MACH_BORZOI |
512 | MACHINE_START(BORZOI, "SHARP Borzoi") | 511 | MACHINE_START(BORZOI, "SHARP Borzoi") |
513 | .phys_ram = 0xa0000000, | ||
514 | .phys_io = 0x40000000, | 512 | .phys_io = 0x40000000, |
515 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 513 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
516 | .fixup = fixup_spitz, | 514 | .fixup = fixup_spitz, |
@@ -523,7 +521,6 @@ MACHINE_END | |||
523 | 521 | ||
524 | #ifdef CONFIG_MACH_AKITA | 522 | #ifdef CONFIG_MACH_AKITA |
525 | MACHINE_START(AKITA, "SHARP Akita") | 523 | MACHINE_START(AKITA, "SHARP Akita") |
526 | .phys_ram = 0xa0000000, | ||
527 | .phys_io = 0x40000000, | 524 | .phys_io = 0x40000000, |
528 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 525 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
529 | .fixup = fixup_spitz, | 526 | .fixup = fixup_spitz, |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index e4f92efc616e..d168286ed470 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -295,7 +295,6 @@ static void __init fixup_tosa(struct machine_desc *desc, | |||
295 | } | 295 | } |
296 | 296 | ||
297 | MACHINE_START(TOSA, "SHARP Tosa") | 297 | MACHINE_START(TOSA, "SHARP Tosa") |
298 | .phys_ram = 0xa0000000, | ||
299 | .phys_io = 0x40000000, | 298 | .phys_io = 0x40000000, |
300 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 299 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
301 | .fixup = fixup_tosa, | 300 | .fixup = fixup_tosa, |
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig index 129976866d47..17f5f4439fe7 100644 --- a/arch/arm/mach-realview/Kconfig +++ b/arch/arm/mach-realview/Kconfig | |||
@@ -3,7 +3,6 @@ menu "RealView platform type" | |||
3 | 3 | ||
4 | config MACH_REALVIEW_EB | 4 | config MACH_REALVIEW_EB |
5 | bool "Support RealView/EB platform" | 5 | bool "Support RealView/EB platform" |
6 | default n | ||
7 | select ARM_GIC | 6 | select ARM_GIC |
8 | help | 7 | help |
9 | Include support for the ARM(R) RealView Emulation Baseboard platform. | 8 | Include support for the ARM(R) RealView Emulation Baseboard platform. |
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 112f7592aca9..d4a586e38d5b 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -166,7 +166,6 @@ static void __init realview_eb_init(void) | |||
166 | 166 | ||
167 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") | 167 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") |
168 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 168 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
169 | .phys_ram = 0x00000000, | ||
170 | .phys_io = REALVIEW_UART0_BASE, | 169 | .phys_io = REALVIEW_UART0_BASE, |
171 | .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, | 170 | .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, |
172 | .boot_params = 0x00000100, | 171 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c index 5c4ac1c008a6..208a2b5dba1b 100644 --- a/arch/arm/mach-rpc/riscpc.c +++ b/arch/arm/mach-rpc/riscpc.c | |||
@@ -177,7 +177,6 @@ extern struct sys_timer ioc_timer; | |||
177 | 177 | ||
178 | MACHINE_START(RISCPC, "Acorn-RiscPC") | 178 | MACHINE_START(RISCPC, "Acorn-RiscPC") |
179 | /* Maintainer: Russell King */ | 179 | /* Maintainer: Russell King */ |
180 | .phys_ram = 0x10000000, | ||
181 | .phys_io = 0x03000000, | 180 | .phys_io = 0x03000000, |
182 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, | 181 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
183 | .boot_params = 0x10000100, | 182 | .boot_params = 0x10000100, |
diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c index 0f81fc0c2f7f..3e327b8e46be 100644 --- a/arch/arm/mach-s3c2410/mach-anubis.c +++ b/arch/arm/mach-s3c2410/mach-anubis.c | |||
@@ -294,7 +294,6 @@ static void __init anubis_map_io(void) | |||
294 | 294 | ||
295 | MACHINE_START(ANUBIS, "Simtec-Anubis") | 295 | MACHINE_START(ANUBIS, "Simtec-Anubis") |
296 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 296 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
297 | .phys_ram = S3C2410_SDRAM_PA, | ||
298 | .phys_io = S3C2410_PA_UART, | 297 | .phys_io = S3C2410_PA_UART, |
299 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 298 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
300 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 299 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 4d962717fdf7..995bb8add331 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -527,7 +527,6 @@ static void __init bast_init(void) | |||
527 | 527 | ||
528 | MACHINE_START(BAST, "Simtec-BAST") | 528 | MACHINE_START(BAST, "Simtec-BAST") |
529 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 529 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
530 | .phys_ram = S3C2410_SDRAM_PA, | ||
531 | .phys_io = S3C2410_PA_UART, | 530 | .phys_io = S3C2410_PA_UART, |
532 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 531 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
533 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 532 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index 0aa8760598f7..1c316f14ed94 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -171,7 +171,6 @@ static void __init h1940_init(void) | |||
171 | 171 | ||
172 | MACHINE_START(H1940, "IPAQ-H1940") | 172 | MACHINE_START(H1940, "IPAQ-H1940") |
173 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 173 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
174 | .phys_ram = S3C2410_SDRAM_PA, | ||
175 | .phys_io = S3C2410_PA_UART, | 174 | .phys_io = S3C2410_PA_UART, |
176 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 175 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
177 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 176 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c index 378d640ab00b..116ac3169966 100644 --- a/arch/arm/mach-s3c2410/mach-n30.c +++ b/arch/arm/mach-s3c2410/mach-n30.c | |||
@@ -128,7 +128,6 @@ MACHINE_START(N30, "Acer-N30") | |||
128 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, | 128 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, |
129 | Ben Dooks <ben-linux@fluff.org> | 129 | Ben Dooks <ben-linux@fluff.org> |
130 | */ | 130 | */ |
131 | .phys_ram = S3C2410_SDRAM_PA, | ||
132 | .phys_io = S3C2410_PA_UART, | 131 | .phys_io = S3C2410_PA_UART, |
133 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 132 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
134 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 133 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-nexcoder.c b/arch/arm/mach-s3c2410/mach-nexcoder.c index 42b0eeff2e0f..07d09509a626 100644 --- a/arch/arm/mach-s3c2410/mach-nexcoder.c +++ b/arch/arm/mach-s3c2410/mach-nexcoder.c | |||
@@ -148,7 +148,6 @@ static void __init nexcoder_map_io(void) | |||
148 | 148 | ||
149 | MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | 149 | MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") |
150 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ | 150 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ |
151 | .phys_ram = S3C2410_SDRAM_PA, | ||
152 | .phys_io = S3C2410_PA_UART, | 151 | .phys_io = S3C2410_PA_UART, |
153 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 152 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
154 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 153 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c index a2eb9ed48fcd..b39daedf93ca 100644 --- a/arch/arm/mach-s3c2410/mach-otom.c +++ b/arch/arm/mach-s3c2410/mach-otom.c | |||
@@ -116,7 +116,6 @@ static void __init otom11_map_io(void) | |||
116 | 116 | ||
117 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | 117 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") |
118 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ | 118 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ |
119 | .phys_ram = S3C2410_SDRAM_PA, | ||
120 | .phys_io = S3C2410_PA_UART, | 119 | .phys_io = S3C2410_PA_UART, |
121 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 120 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
122 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 121 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c index f8d86d1e16b6..0260ed5ab946 100644 --- a/arch/arm/mach-s3c2410/mach-rx3715.c +++ b/arch/arm/mach-s3c2410/mach-rx3715.c | |||
@@ -205,7 +205,6 @@ static void __init rx3715_init_machine(void) | |||
205 | 205 | ||
206 | MACHINE_START(RX3715, "IPAQ-RX3715") | 206 | MACHINE_START(RX3715, "IPAQ-RX3715") |
207 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 207 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
208 | .phys_ram = S3C2410_SDRAM_PA, | ||
209 | .phys_io = S3C2410_PA_UART, | 208 | .phys_io = S3C2410_PA_UART, |
210 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 209 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
211 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 210 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c index 2c91965ee1c8..1e76e1fdfcea 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2410.c +++ b/arch/arm/mach-s3c2410/mach-smdk2410.c | |||
@@ -115,7 +115,6 @@ static void __init smdk2410_init_irq(void) | |||
115 | MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch | 115 | MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch |
116 | * to SMDK2410 */ | 116 | * to SMDK2410 */ |
117 | /* Maintainer: Jonas Dietsche */ | 117 | /* Maintainer: Jonas Dietsche */ |
118 | .phys_ram = S3C2410_SDRAM_PA, | ||
119 | .phys_io = S3C2410_PA_UART, | 118 | .phys_io = S3C2410_PA_UART, |
120 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 119 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
121 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 120 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c index 4e31118533e6..f4315721c3b8 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2440.c +++ b/arch/arm/mach-s3c2410/mach-smdk2440.c | |||
@@ -216,7 +216,6 @@ static void __init smdk2440_machine_init(void) | |||
216 | 216 | ||
217 | MACHINE_START(S3C2440, "SMDK2440") | 217 | MACHINE_START(S3C2440, "SMDK2440") |
218 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 218 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
219 | .phys_ram = S3C2410_SDRAM_PA, | ||
220 | .phys_io = S3C2410_PA_UART, | 219 | .phys_io = S3C2410_PA_UART, |
221 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 220 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
222 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 221 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index ae7e099bf6c8..785fc9cdcf7c 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c | |||
@@ -395,7 +395,6 @@ static void __init vr1000_map_io(void) | |||
395 | 395 | ||
396 | MACHINE_START(VR1000, "Thorcom-VR1000") | 396 | MACHINE_START(VR1000, "Thorcom-VR1000") |
397 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 397 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
398 | .phys_ram = S3C2410_SDRAM_PA, | ||
399 | .phys_io = S3C2410_PA_UART, | 398 | .phys_io = S3C2410_PA_UART, |
400 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 399 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
401 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 400 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index a66ac61233a2..a599bb0d4ab8 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -447,7 +447,6 @@ static void __init assabet_map_io(void) | |||
447 | 447 | ||
448 | 448 | ||
449 | MACHINE_START(ASSABET, "Intel-Assabet") | 449 | MACHINE_START(ASSABET, "Intel-Assabet") |
450 | .phys_ram = 0xc0000000, | ||
451 | .phys_io = 0x80000000, | 450 | .phys_io = 0x80000000, |
452 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 451 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
453 | .boot_params = 0xc0000100, | 452 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c index edccd5eb06be..f60b7a66dfa0 100644 --- a/arch/arm/mach-sa1100/badge4.c +++ b/arch/arm/mach-sa1100/badge4.c | |||
@@ -297,7 +297,6 @@ static void __init badge4_map_io(void) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") | 299 | MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") |
300 | .phys_ram = 0xc0000000, | ||
301 | .phys_io = 0x80000000, | 300 | .phys_io = 0x80000000, |
302 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 301 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
303 | .boot_params = 0xc0000100, | 302 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c index 508593722bc7..8269a9ef9afe 100644 --- a/arch/arm/mach-sa1100/cerf.c +++ b/arch/arm/mach-sa1100/cerf.c | |||
@@ -135,7 +135,6 @@ static void __init cerf_init(void) | |||
135 | 135 | ||
136 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") | 136 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") |
137 | /* Maintainer: support@intrinsyc.com */ | 137 | /* Maintainer: support@intrinsyc.com */ |
138 | .phys_ram = 0xc0000000, | ||
139 | .phys_io = 0x80000000, | 138 | .phys_io = 0x80000000, |
140 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 139 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
141 | .map_io = cerf_map_io, | 140 | .map_io = cerf_map_io, |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 522abc036d3a..6888816a1935 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -191,7 +191,6 @@ static void __init collie_map_io(void) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | MACHINE_START(COLLIE, "Sharp-Collie") | 193 | MACHINE_START(COLLIE, "Sharp-Collie") |
194 | .phys_ram = 0xc0000000, | ||
195 | .phys_io = 0x80000000, | 194 | .phys_io = 0x80000000, |
196 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 195 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
197 | .map_io = collie_map_io, | 196 | .map_io = collie_map_io, |
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index e8352b7f74b0..b04d92271020 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c | |||
@@ -392,7 +392,6 @@ static void __init h3100_map_io(void) | |||
392 | } | 392 | } |
393 | 393 | ||
394 | MACHINE_START(H3100, "Compaq iPAQ H3100") | 394 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
395 | .phys_ram = 0xc0000000, | ||
396 | .phys_io = 0x80000000, | 395 | .phys_io = 0x80000000, |
397 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 396 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
398 | .boot_params = 0xc0000100, | 397 | .boot_params = 0xc0000100, |
@@ -510,7 +509,6 @@ static void __init h3600_map_io(void) | |||
510 | } | 509 | } |
511 | 510 | ||
512 | MACHINE_START(H3600, "Compaq iPAQ H3600") | 511 | MACHINE_START(H3600, "Compaq iPAQ H3600") |
513 | .phys_ram = 0xc0000000, | ||
514 | .phys_io = 0x80000000, | 512 | .phys_io = 0x80000000, |
515 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 513 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
516 | .boot_params = 0xc0000100, | 514 | .boot_params = 0xc0000100, |
@@ -897,7 +895,6 @@ static void __init h3800_map_io(void) | |||
897 | } | 895 | } |
898 | 896 | ||
899 | MACHINE_START(H3800, "Compaq iPAQ H3800") | 897 | MACHINE_START(H3800, "Compaq iPAQ H3800") |
900 | .phys_ram = 0xc0000000, | ||
901 | .phys_io = 0x80000000, | 898 | .phys_io = 0x80000000, |
902 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 899 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
903 | .boot_params = 0xc0000100, | 900 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c index c922e043c424..046b213efd5b 100644 --- a/arch/arm/mach-sa1100/hackkit.c +++ b/arch/arm/mach-sa1100/hackkit.c | |||
@@ -195,7 +195,6 @@ static void __init hackkit_init(void) | |||
195 | */ | 195 | */ |
196 | 196 | ||
197 | MACHINE_START(HACKKIT, "HackKit Cpu Board") | 197 | MACHINE_START(HACKKIT, "HackKit Cpu Board") |
198 | .phys_ram = 0xc0000000, | ||
199 | .phys_io = 0x80000000, | 198 | .phys_io = 0x80000000, |
200 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 199 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
201 | .boot_params = 0xc0000100, | 200 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c index 2f671cc3cb99..17f5a43acdb7 100644 --- a/arch/arm/mach-sa1100/jornada720.c +++ b/arch/arm/mach-sa1100/jornada720.c | |||
@@ -173,7 +173,6 @@ static void __init jornada720_mach_init(void) | |||
173 | 173 | ||
174 | MACHINE_START(JORNADA720, "HP Jornada 720") | 174 | MACHINE_START(JORNADA720, "HP Jornada 720") |
175 | /* Maintainer: Michael Gernoth <michael@gernoth.net> */ | 175 | /* Maintainer: Michael Gernoth <michael@gernoth.net> */ |
176 | .phys_ram = 0xc0000000, | ||
177 | .phys_io = 0x80000000, | 176 | .phys_io = 0x80000000, |
178 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 177 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
179 | .boot_params = 0xc0000100, | 178 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c index 8c9e3dd52942..07d3a696ae7f 100644 --- a/arch/arm/mach-sa1100/lart.c +++ b/arch/arm/mach-sa1100/lart.c | |||
@@ -60,7 +60,6 @@ static void __init lart_map_io(void) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | MACHINE_START(LART, "LART") | 62 | MACHINE_START(LART, "LART") |
63 | .phys_ram = 0xc0000000, | ||
64 | .phys_io = 0x80000000, | 63 | .phys_io = 0x80000000, |
65 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 64 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
66 | .boot_params = 0xc0000100, | 65 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c index 58c18f9e9b7b..0709ebab531c 100644 --- a/arch/arm/mach-sa1100/pleb.c +++ b/arch/arm/mach-sa1100/pleb.c | |||
@@ -146,7 +146,6 @@ static void __init pleb_map_io(void) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | MACHINE_START(PLEB, "PLEB") | 148 | MACHINE_START(PLEB, "PLEB") |
149 | .phys_ram = 0xc0000000, | ||
150 | .phys_io = 0x80000000, | 149 | .phys_io = 0x80000000, |
151 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 150 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
152 | .map_io = pleb_map_io, | 151 | .map_io = pleb_map_io, |
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c index 7482288278d9..5aafe0b56992 100644 --- a/arch/arm/mach-sa1100/shannon.c +++ b/arch/arm/mach-sa1100/shannon.c | |||
@@ -83,7 +83,6 @@ static void __init shannon_map_io(void) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") | 85 | MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") |
86 | .phys_ram = 0xc0000000, | ||
87 | .phys_io = 0x80000000, | 86 | .phys_io = 0x80000000, |
88 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 87 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
89 | .boot_params = 0xc0000100, | 88 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index 439ddc9b06d6..d2c23b2c34d1 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c | |||
@@ -229,7 +229,6 @@ arch_initcall(simpad_init); | |||
229 | 229 | ||
230 | MACHINE_START(SIMPAD, "Simpad") | 230 | MACHINE_START(SIMPAD, "Simpad") |
231 | /* Maintainer: Holger Freyther */ | 231 | /* Maintainer: Holger Freyther */ |
232 | .phys_ram = 0xc0000000, | ||
233 | .phys_io = 0x80000000, | 232 | .phys_io = 0x80000000, |
234 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | 233 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
235 | .boot_params = 0xc0000100, | 234 | .boot_params = 0xc0000100, |
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c index 2d428b6dbb58..877600e212dd 100644 --- a/arch/arm/mach-shark/core.c +++ b/arch/arm/mach-shark/core.c | |||
@@ -111,7 +111,6 @@ static struct sys_timer shark_timer = { | |||
111 | 111 | ||
112 | MACHINE_START(SHARK, "Shark") | 112 | MACHINE_START(SHARK, "Shark") |
113 | /* Maintainer: Alexander Schulz */ | 113 | /* Maintainer: Alexander Schulz */ |
114 | .phys_ram = 0x08000000, | ||
115 | .phys_io = 0x40000000, | 114 | .phys_io = 0x40000000, |
116 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, | 115 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
117 | .boot_params = 0x08003000, | 116 | .boot_params = 0x08003000, |
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig index 8d787f4c78e6..95096afd5271 100644 --- a/arch/arm/mach-versatile/Kconfig +++ b/arch/arm/mach-versatile/Kconfig | |||
@@ -9,7 +9,6 @@ config ARCH_VERSATILE_PB | |||
9 | 9 | ||
10 | config MACH_VERSATILE_AB | 10 | config MACH_VERSATILE_AB |
11 | bool "Support Versatile/AB platform" | 11 | bool "Support Versatile/AB platform" |
12 | default n | ||
13 | help | 12 | help |
14 | Include support for the ARM(R) Versatile/AP platform. | 13 | Include support for the ARM(R) Versatile/AP platform. |
15 | 14 | ||
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 90023745b23a..9ebbe808b41d 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/leds.h> | 35 | #include <asm/leds.h> |
36 | #include <asm/hardware/arm_timer.h> | 36 | #include <asm/hardware/arm_timer.h> |
37 | #include <asm/hardware/icst307.h> | 37 | #include <asm/hardware/icst307.h> |
38 | #include <asm/hardware/vic.h> | ||
38 | 39 | ||
39 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
40 | #include <asm/mach/flash.h> | 41 | #include <asm/mach/flash.h> |
@@ -56,24 +57,6 @@ | |||
56 | #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) | 57 | #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) |
57 | #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) | 58 | #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) |
58 | 59 | ||
59 | static void vic_mask_irq(unsigned int irq) | ||
60 | { | ||
61 | irq -= IRQ_VIC_START; | ||
62 | writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR); | ||
63 | } | ||
64 | |||
65 | static void vic_unmask_irq(unsigned int irq) | ||
66 | { | ||
67 | irq -= IRQ_VIC_START; | ||
68 | writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE); | ||
69 | } | ||
70 | |||
71 | static struct irqchip vic_chip = { | ||
72 | .ack = vic_mask_irq, | ||
73 | .mask = vic_mask_irq, | ||
74 | .unmask = vic_unmask_irq, | ||
75 | }; | ||
76 | |||
77 | static void sic_mask_irq(unsigned int irq) | 60 | static void sic_mask_irq(unsigned int irq) |
78 | { | 61 | { |
79 | irq -= IRQ_SIC_START; | 62 | irq -= IRQ_SIC_START; |
@@ -127,43 +110,12 @@ sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) | |||
127 | 110 | ||
128 | void __init versatile_init_irq(void) | 111 | void __init versatile_init_irq(void) |
129 | { | 112 | { |
130 | unsigned int i, value; | 113 | unsigned int i; |
131 | |||
132 | /* Disable all interrupts initially. */ | ||
133 | 114 | ||
134 | writel(0, VA_VIC_BASE + VIC_INT_SELECT); | 115 | vic_init(VA_VIC_BASE, ~(1 << 31)); |
135 | writel(0, VA_VIC_BASE + VIC_IRQ_ENABLE); | ||
136 | writel(~0, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR); | ||
137 | writel(0, VA_VIC_BASE + VIC_IRQ_STATUS); | ||
138 | writel(0, VA_VIC_BASE + VIC_ITCR); | ||
139 | writel(~0, VA_VIC_BASE + VIC_IRQ_SOFT_CLEAR); | ||
140 | |||
141 | /* | ||
142 | * Make sure we clear all existing interrupts | ||
143 | */ | ||
144 | writel(0, VA_VIC_BASE + VIC_VECT_ADDR); | ||
145 | for (i = 0; i < 19; i++) { | ||
146 | value = readl(VA_VIC_BASE + VIC_VECT_ADDR); | ||
147 | writel(value, VA_VIC_BASE + VIC_VECT_ADDR); | ||
148 | } | ||
149 | |||
150 | for (i = 0; i < 16; i++) { | ||
151 | value = readl(VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4)); | ||
152 | writel(value | VICVectCntl_Enable | i, VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4)); | ||
153 | } | ||
154 | |||
155 | writel(32, VA_VIC_BASE + VIC_DEF_VECT_ADDR); | ||
156 | |||
157 | for (i = IRQ_VIC_START; i <= IRQ_VIC_END; i++) { | ||
158 | if (i != IRQ_VICSOURCE31) { | ||
159 | set_irq_chip(i, &vic_chip); | ||
160 | set_irq_handler(i, do_level_IRQ); | ||
161 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | ||
162 | } | ||
163 | } | ||
164 | 116 | ||
165 | set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); | 117 | set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); |
166 | vic_unmask_irq(IRQ_VICSOURCE31); | 118 | enable_irq(IRQ_VICSOURCE31); |
167 | 119 | ||
168 | /* Do second interrupt controller */ | 120 | /* Do second interrupt controller */ |
169 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); | 121 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); |
@@ -877,7 +829,7 @@ static unsigned long versatile_gettimeoffset(void) | |||
877 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; | 829 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; |
878 | do { | 830 | do { |
879 | ticks1 = ticks2; | 831 | ticks1 = ticks2; |
880 | status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS); | 832 | status = __raw_readl(VA_IC_BASE + VIC_RAW_STATUS); |
881 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; | 833 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; |
882 | } while (ticks2 > ticks1); | 834 | } while (ticks2 > ticks1); |
883 | 835 | ||
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c index e74c8a2fbb95..1eb596782078 100644 --- a/arch/arm/mach-versatile/versatile_ab.c +++ b/arch/arm/mach-versatile/versatile_ab.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") | 37 | MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") |
38 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 38 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
39 | .phys_ram = 0x00000000, | ||
40 | .phys_io = 0x101f1000, | 39 | .phys_io = 0x101f1000, |
41 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, | 40 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, |
42 | .boot_params = 0x00000100, | 41 | .boot_params = 0x00000100, |
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c index 22d5ca07f75d..f17ab4fb548a 100644 --- a/arch/arm/mach-versatile/versatile_pb.c +++ b/arch/arm/mach-versatile/versatile_pb.c | |||
@@ -100,7 +100,6 @@ arch_initcall(versatile_pb_init); | |||
100 | 100 | ||
101 | MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") | 101 | MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") |
102 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 102 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
103 | .phys_ram = 0x00000000, | ||
104 | .phys_io = 0x101f1000, | 103 | .phys_io = 0x101f1000, |
105 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, | 104 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, |
106 | .boot_params = 0x00000100, | 105 | .boot_params = 0x00000100, |
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h index da4c616b6c49..28cd79a451d3 100644 --- a/arch/arm/nwfpe/fpa11.h +++ b/arch/arm/nwfpe/fpa11.h | |||
@@ -62,7 +62,7 @@ typedef union tagFPREG { | |||
62 | #else | 62 | #else |
63 | u32 padding[3]; | 63 | u32 padding[3]; |
64 | #endif | 64 | #endif |
65 | } FPREG; | 65 | } __attribute__ ((packed,aligned(4))) FPREG; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * FPA11 device model. | 68 | * FPA11 device model. |
@@ -89,7 +89,7 @@ typedef struct tagFPA11 { | |||
89 | so we can use it to detect whether this | 89 | so we can use it to detect whether this |
90 | instance of the emulator needs to be | 90 | instance of the emulator needs to be |
91 | initialised. */ | 91 | initialised. */ |
92 | } FPA11; | 92 | } __attribute__ ((packed,aligned(4))) FPA11; |
93 | 93 | ||
94 | extern int8 SetRoundingMode(const unsigned int); | 94 | extern int8 SetRoundingMode(const unsigned int); |
95 | extern int8 SetRoundingPrecision(const unsigned int); | 95 | extern int8 SetRoundingPrecision(const unsigned int); |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 9693e9b4ffd1..0887bb2a2551 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -22,7 +22,6 @@ comment "OMAP Feature Selections" | |||
22 | config OMAP_RESET_CLOCKS | 22 | config OMAP_RESET_CLOCKS |
23 | bool "Reset unused clocks during boot" | 23 | bool "Reset unused clocks during boot" |
24 | depends on ARCH_OMAP | 24 | depends on ARCH_OMAP |
25 | default n | ||
26 | help | 25 | help |
27 | Say Y if you want to reset unused clocks during boot. | 26 | Say Y if you want to reset unused clocks during boot. |
28 | This option saves power, but assumes all drivers are | 27 | This option saves power, but assumes all drivers are |
@@ -44,7 +43,6 @@ config OMAP_MUX | |||
44 | config OMAP_MUX_DEBUG | 43 | config OMAP_MUX_DEBUG |
45 | bool "Multiplexing debug output" | 44 | bool "Multiplexing debug output" |
46 | depends on OMAP_MUX | 45 | depends on OMAP_MUX |
47 | default n | ||
48 | help | 46 | help |
49 | Makes the multiplexing functions print out a lot of debug info. | 47 | Makes the multiplexing functions print out a lot of debug info. |
50 | This is useful if you want to find out the correct values of the | 48 | This is useful if you want to find out the correct values of the |
@@ -93,7 +91,6 @@ config OMAP_32K_TIMER_HZ | |||
93 | 91 | ||
94 | config OMAP_DM_TIMER | 92 | config OMAP_DM_TIMER |
95 | bool "Use dual-mode timer" | 93 | bool "Use dual-mode timer" |
96 | default n | ||
97 | depends on ARCH_OMAP16XX | 94 | depends on ARCH_OMAP16XX |
98 | help | 95 | help |
99 | Select this option if you want to use OMAP Dual-Mode timers. | 96 | Select this option if you want to use OMAP Dual-Mode timers. |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index d5d0df7f04fc..cbde675bc95c 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -702,6 +702,15 @@ config PHYSICAL_START | |||
702 | 702 | ||
703 | Don't change this unless you know what you are doing. | 703 | Don't change this unless you know what you are doing. |
704 | 704 | ||
705 | config HOTPLUG_CPU | ||
706 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | ||
707 | depends on SMP && HOTPLUG && EXPERIMENTAL | ||
708 | ---help--- | ||
709 | Say Y here to experiment with turning CPUs off and on. CPUs | ||
710 | can be controlled through /sys/devices/system/cpu. | ||
711 | |||
712 | Say N. | ||
713 | |||
705 | endmenu | 714 | endmenu |
706 | 715 | ||
707 | 716 | ||
@@ -988,15 +997,6 @@ config SCx200 | |||
988 | This support is also available as a module. If compiled as a | 997 | This support is also available as a module. If compiled as a |
989 | module, it will be called scx200. | 998 | module, it will be called scx200. |
990 | 999 | ||
991 | config HOTPLUG_CPU | ||
992 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | ||
993 | depends on SMP && HOTPLUG && EXPERIMENTAL | ||
994 | ---help--- | ||
995 | Say Y here to experiment with turning CPUs off and on. CPUs | ||
996 | can be controlled through /sys/devices/system/cpu. | ||
997 | |||
998 | Say N. | ||
999 | |||
1000 | source "drivers/pcmcia/Kconfig" | 1000 | source "drivers/pcmcia/Kconfig" |
1001 | 1001 | ||
1002 | source "drivers/pci/hotplug/Kconfig" | 1002 | source "drivers/pci/hotplug/Kconfig" |
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index d3c0409d201c..bd2d53a9dd2b 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile | |||
@@ -42,9 +42,9 @@ include $(srctree)/arch/i386/Makefile.cpu | |||
42 | cflags-$(CONFIG_REGPARM) += $(shell if [ $(call cc-version) -ge 0300 ] ; then \ | 42 | cflags-$(CONFIG_REGPARM) += $(shell if [ $(call cc-version) -ge 0300 ] ; then \ |
43 | echo "-mregparm=3"; fi ;) | 43 | echo "-mregparm=3"; fi ;) |
44 | 44 | ||
45 | # Disable unit-at-a-time mode, it makes gcc use a lot more stack | 45 | # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use |
46 | # due to the lack of sharing of stacklots. | 46 | # a lot more stack due to the lack of sharing of stacklots: |
47 | CFLAGS += $(call cc-option,-fno-unit-at-a-time) | 47 | CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) |
48 | 48 | ||
49 | CFLAGS += $(cflags-y) | 49 | CFLAGS += $(cflags-y) |
50 | 50 | ||
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index b9f0030a2ebb..0aaebf3e1cfa 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -112,33 +112,38 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) | |||
112 | p < (void *)tinfo + THREAD_SIZE - 3; | 112 | p < (void *)tinfo + THREAD_SIZE - 3; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void print_addr_and_symbol(unsigned long addr, char *log_lvl) | ||
116 | { | ||
117 | printk(log_lvl); | ||
118 | printk(" [<%08lx>] ", addr); | ||
119 | print_symbol("%s", addr); | ||
120 | printk("\n"); | ||
121 | } | ||
122 | |||
115 | static inline unsigned long print_context_stack(struct thread_info *tinfo, | 123 | static inline unsigned long print_context_stack(struct thread_info *tinfo, |
116 | unsigned long *stack, unsigned long ebp) | 124 | unsigned long *stack, unsigned long ebp, |
125 | char *log_lvl) | ||
117 | { | 126 | { |
118 | unsigned long addr; | 127 | unsigned long addr; |
119 | 128 | ||
120 | #ifdef CONFIG_FRAME_POINTER | 129 | #ifdef CONFIG_FRAME_POINTER |
121 | while (valid_stack_ptr(tinfo, (void *)ebp)) { | 130 | while (valid_stack_ptr(tinfo, (void *)ebp)) { |
122 | addr = *(unsigned long *)(ebp + 4); | 131 | addr = *(unsigned long *)(ebp + 4); |
123 | printk(KERN_EMERG " [<%08lx>] ", addr); | 132 | print_addr_and_symbol(addr, log_lvl); |
124 | print_symbol("%s", addr); | ||
125 | printk("\n"); | ||
126 | ebp = *(unsigned long *)ebp; | 133 | ebp = *(unsigned long *)ebp; |
127 | } | 134 | } |
128 | #else | 135 | #else |
129 | while (valid_stack_ptr(tinfo, stack)) { | 136 | while (valid_stack_ptr(tinfo, stack)) { |
130 | addr = *stack++; | 137 | addr = *stack++; |
131 | if (__kernel_text_address(addr)) { | 138 | if (__kernel_text_address(addr)) |
132 | printk(KERN_EMERG " [<%08lx>]", addr); | 139 | print_addr_and_symbol(addr, log_lvl); |
133 | print_symbol(" %s", addr); | ||
134 | printk("\n"); | ||
135 | } | ||
136 | } | 140 | } |
137 | #endif | 141 | #endif |
138 | return ebp; | 142 | return ebp; |
139 | } | 143 | } |
140 | 144 | ||
141 | void show_trace(struct task_struct *task, unsigned long * stack) | 145 | static void show_trace_log_lvl(struct task_struct *task, |
146 | unsigned long *stack, char *log_lvl) | ||
142 | { | 147 | { |
143 | unsigned long ebp; | 148 | unsigned long ebp; |
144 | 149 | ||
@@ -157,7 +162,7 @@ void show_trace(struct task_struct *task, unsigned long * stack) | |||
157 | struct thread_info *context; | 162 | struct thread_info *context; |
158 | context = (struct thread_info *) | 163 | context = (struct thread_info *) |
159 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); | 164 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); |
160 | ebp = print_context_stack(context, stack, ebp); | 165 | ebp = print_context_stack(context, stack, ebp, log_lvl); |
161 | stack = (unsigned long*)context->previous_esp; | 166 | stack = (unsigned long*)context->previous_esp; |
162 | if (!stack) | 167 | if (!stack) |
163 | break; | 168 | break; |
@@ -165,7 +170,13 @@ void show_trace(struct task_struct *task, unsigned long * stack) | |||
165 | } | 170 | } |
166 | } | 171 | } |
167 | 172 | ||
168 | void show_stack(struct task_struct *task, unsigned long *esp) | 173 | void show_trace(struct task_struct *task, unsigned long * stack) |
174 | { | ||
175 | show_trace_log_lvl(task, stack, ""); | ||
176 | } | ||
177 | |||
178 | static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp, | ||
179 | char *log_lvl) | ||
169 | { | 180 | { |
170 | unsigned long *stack; | 181 | unsigned long *stack; |
171 | int i; | 182 | int i; |
@@ -178,16 +189,26 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
178 | } | 189 | } |
179 | 190 | ||
180 | stack = esp; | 191 | stack = esp; |
181 | printk(KERN_EMERG); | 192 | printk(log_lvl); |
182 | for(i = 0; i < kstack_depth_to_print; i++) { | 193 | for(i = 0; i < kstack_depth_to_print; i++) { |
183 | if (kstack_end(stack)) | 194 | if (kstack_end(stack)) |
184 | break; | 195 | break; |
185 | if (i && ((i % 8) == 0)) | 196 | if (i && ((i % 8) == 0)) { |
186 | printk("\n" KERN_EMERG " "); | 197 | printk("\n"); |
198 | printk(log_lvl); | ||
199 | printk(" "); | ||
200 | } | ||
187 | printk("%08lx ", *stack++); | 201 | printk("%08lx ", *stack++); |
188 | } | 202 | } |
189 | printk("\n" KERN_EMERG "Call Trace:\n"); | 203 | printk("\n"); |
190 | show_trace(task, esp); | 204 | printk(log_lvl); |
205 | printk("Call Trace:\n"); | ||
206 | show_trace_log_lvl(task, esp, log_lvl); | ||
207 | } | ||
208 | |||
209 | void show_stack(struct task_struct *task, unsigned long *esp) | ||
210 | { | ||
211 | show_stack_log_lvl(task, esp, ""); | ||
191 | } | 212 | } |
192 | 213 | ||
193 | /* | 214 | /* |
@@ -238,7 +259,7 @@ void show_registers(struct pt_regs *regs) | |||
238 | u8 __user *eip; | 259 | u8 __user *eip; |
239 | 260 | ||
240 | printk("\n" KERN_EMERG "Stack: "); | 261 | printk("\n" KERN_EMERG "Stack: "); |
241 | show_stack(NULL, (unsigned long*)esp); | 262 | show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG); |
242 | 263 | ||
243 | printk(KERN_EMERG "Code: "); | 264 | printk(KERN_EMERG "Code: "); |
244 | 265 | ||
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c index 65f67070db64..83c3645ccc43 100644 --- a/arch/i386/pci/fixup.c +++ b/arch/i386/pci/fixup.c | |||
@@ -449,3 +449,19 @@ static void __devinit pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev) | |||
449 | } | 449 | } |
450 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, | 450 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, |
451 | pci_post_fixup_toshiba_ohci1394); | 451 | pci_post_fixup_toshiba_ohci1394); |
452 | |||
453 | |||
454 | /* | ||
455 | * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device | ||
456 | * configuration space. | ||
457 | */ | ||
458 | static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev) | ||
459 | { | ||
460 | u8 r; | ||
461 | /* clear 'F4 Video Configuration Trap' bit */ | ||
462 | pci_read_config_byte(dev, 0x42, &r); | ||
463 | r &= 0xfd; | ||
464 | pci_write_config_byte(dev, 0x42, r); | ||
465 | } | ||
466 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, | ||
467 | pci_early_fixup_cyrix_5530); | ||
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig index 80f8663bc6d9..1d07d8072ec2 100644 --- a/arch/ia64/configs/gensparse_defconfig +++ b/arch/ia64/configs/gensparse_defconfig | |||
@@ -701,6 +701,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y | |||
701 | CONFIG_SERIAL_SGI_L1_CONSOLE=y | 701 | CONFIG_SERIAL_SGI_L1_CONSOLE=y |
702 | # CONFIG_SERIAL_JSM is not set | 702 | # CONFIG_SERIAL_JSM is not set |
703 | CONFIG_SERIAL_SGI_IOC4=y | 703 | CONFIG_SERIAL_SGI_IOC4=y |
704 | CONFIG_SERIAL_SGI_IOC3=y | ||
704 | CONFIG_UNIX98_PTYS=y | 705 | CONFIG_UNIX98_PTYS=y |
705 | CONFIG_LEGACY_PTYS=y | 706 | CONFIG_LEGACY_PTYS=y |
706 | CONFIG_LEGACY_PTY_COUNT=256 | 707 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -1046,6 +1047,7 @@ CONFIG_INFINIBAND_IPOIB=m | |||
1046 | # SN Devices | 1047 | # SN Devices |
1047 | # | 1048 | # |
1048 | CONFIG_SGI_IOC4=y | 1049 | CONFIG_SGI_IOC4=y |
1050 | CONFIG_SGI_IOC3=y | ||
1049 | 1051 | ||
1050 | # | 1052 | # |
1051 | # File systems | 1053 | # File systems |
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index ff8bb3770c9d..3cb503b659e6 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig | |||
@@ -659,6 +659,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y | |||
659 | CONFIG_SERIAL_SGI_L1_CONSOLE=y | 659 | CONFIG_SERIAL_SGI_L1_CONSOLE=y |
660 | # CONFIG_SERIAL_JSM is not set | 660 | # CONFIG_SERIAL_JSM is not set |
661 | CONFIG_SERIAL_SGI_IOC4=y | 661 | CONFIG_SERIAL_SGI_IOC4=y |
662 | CONFIG_SERIAL_SGI_IOC3=y | ||
662 | CONFIG_UNIX98_PTYS=y | 663 | CONFIG_UNIX98_PTYS=y |
663 | CONFIG_LEGACY_PTYS=y | 664 | CONFIG_LEGACY_PTYS=y |
664 | CONFIG_LEGACY_PTY_COUNT=256 | 665 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -899,6 +900,7 @@ CONFIG_INFINIBAND_SRP=m | |||
899 | # SN Devices | 900 | # SN Devices |
900 | # | 901 | # |
901 | CONFIG_SGI_IOC4=y | 902 | CONFIG_SGI_IOC4=y |
903 | CONFIG_SGI_IOC3=y | ||
902 | 904 | ||
903 | # | 905 | # |
904 | # File systems | 906 | # File systems |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 01feed0e2a15..df338c5cc910 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -78,17 +78,6 @@ config PPC_UDBG_16550 | |||
78 | bool | 78 | bool |
79 | default n | 79 | default n |
80 | 80 | ||
81 | config CRASH_DUMP | ||
82 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
83 | depends on PPC_MULTIPLATFORM | ||
84 | depends on EXPERIMENTAL | ||
85 | help | ||
86 | Build a kernel suitable for use as a kdump capture kernel. | ||
87 | The kernel will be linked at a different address than normal, and | ||
88 | so can only be used for Kdump. | ||
89 | |||
90 | Don't change this unless you know what you are doing. | ||
91 | |||
92 | config GENERIC_TBSYNC | 81 | config GENERIC_TBSYNC |
93 | bool | 82 | bool |
94 | default y if PPC32 && SMP | 83 | default y if PPC32 && SMP |
@@ -584,6 +573,16 @@ config KEXEC | |||
584 | support. As of this writing the exact hardware interface is | 573 | support. As of this writing the exact hardware interface is |
585 | strongly in flux, so no good recommendation can be made. | 574 | strongly in flux, so no good recommendation can be made. |
586 | 575 | ||
576 | config CRASH_DUMP | ||
577 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
578 | depends on PPC_MULTIPLATFORM && PPC64 && EXPERIMENTAL | ||
579 | help | ||
580 | Build a kernel suitable for use as a kdump capture kernel. | ||
581 | The kernel will be linked at a different address than normal, and | ||
582 | so can only be used for Kdump. | ||
583 | |||
584 | Don't change this unless you know what you are doing. | ||
585 | |||
587 | config EMBEDDEDBOOT | 586 | config EMBEDDEDBOOT |
588 | bool | 587 | bool |
589 | depends on 8xx || 8260 | 588 | depends on 8xx || 8260 |
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 788dec4c7ef3..840ae595a617 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -27,6 +27,7 @@ BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ | |||
27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc | 27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
28 | OBJCOPYFLAGS := contents,alloc,load,readonly,data | 28 | OBJCOPYFLAGS := contents,alloc,load,readonly,data |
29 | OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 | 29 | OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 |
30 | OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | ||
30 | 31 | ||
31 | zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c | 32 | zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c |
32 | zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h | 33 | zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h |
@@ -90,11 +91,11 @@ gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | |||
90 | hostprogs-y := addnote addRamDisk hack-coff | 91 | hostprogs-y := addnote addRamDisk hack-coff |
91 | 92 | ||
92 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ | 93 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ |
93 | zImage.coff zImage.initrd.coff \ | 94 | zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \ |
94 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ | 95 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ |
95 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ | 96 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ |
96 | $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ | 97 | $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ |
97 | vmlinux.initrd | 98 | vmlinux.initrd dummy.o |
98 | extra-y := initrd.o | 99 | extra-y := initrd.o |
99 | 100 | ||
100 | quiet_cmd_ramdisk = RAMDISK $@ | 101 | quiet_cmd_ramdisk = RAMDISK $@ |
@@ -116,6 +117,10 @@ quiet_cmd_addsection = ADDSEC $@ | |||
116 | quiet_cmd_addnote = ADDNOTE $@ | 117 | quiet_cmd_addnote = ADDNOTE $@ |
117 | cmd_addnote = $(obj)/addnote $@ | 118 | cmd_addnote = $(obj)/addnote $@ |
118 | 119 | ||
120 | quiet_cmd_gen-miboot = GEN $@ | ||
121 | cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \ | ||
122 | --add-section=$1=$(word 2, $^) $< $@ | ||
123 | |||
119 | quiet_cmd_gencoff = COFF $@ | 124 | quiet_cmd_gencoff = COFF $@ |
120 | cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \ | 125 | cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \ |
121 | $(obj)/hack-coff $@ | 126 | $(obj)/hack-coff $@ |
@@ -141,19 +146,25 @@ $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec | |||
141 | $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds | 146 | $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds |
142 | $(call cmd,bootld,$(obj-boot),zImage.lds) | 147 | $(call cmd,bootld,$(obj-boot),zImage.lds) |
143 | 148 | ||
144 | # For 32-bit powermacs, build the COFF images as well as the ELF images. | 149 | # For 32-bit powermacs, build the COFF and miboot images |
150 | # as well as the ELF images. | ||
145 | coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff | 151 | coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff |
146 | coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff | 152 | coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff |
153 | mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image | ||
154 | mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image | ||
147 | 155 | ||
148 | $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) | 156 | $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \ |
157 | $(mibootimg-y-y) | ||
149 | @cp -f $< $@ | 158 | @cp -f $< $@ |
150 | $(call if_changed,addnote) | 159 | $(call if_changed,addnote) |
151 | 160 | ||
152 | $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote $(coffrdimg-y-y) | 161 | $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \ |
162 | $(coffrdimg-y-y) $(mibrdimg-y-y) | ||
153 | @cp -f $< $@ | 163 | @cp -f $< $@ |
154 | $(call if_changed,addnote) | 164 | $(call if_changed,addnote) |
155 | 165 | ||
156 | $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | 166 | $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \ |
167 | $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | ||
157 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | 168 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) |
158 | $(call cmd,gencoff) | 169 | $(call cmd,gencoff) |
159 | 170 | ||
@@ -162,6 +173,12 @@ $(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \ | |||
162 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | 173 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) |
163 | $(call cmd,gencoff) | 174 | $(call cmd,gencoff) |
164 | 175 | ||
176 | $(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz | ||
177 | $(call cmd,gen-miboot,image) | ||
178 | |||
179 | $(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz | ||
180 | $(call cmd,gen-miboot,initrd) | ||
181 | |||
165 | #----------------------------------------------------------- | 182 | #----------------------------------------------------------- |
166 | # build u-boot images | 183 | # build u-boot images |
167 | #----------------------------------------------------------- | 184 | #----------------------------------------------------------- |
diff --git a/arch/powerpc/boot/dummy.c b/arch/powerpc/boot/dummy.c new file mode 100644 index 000000000000..31dbf45bf99c --- /dev/null +++ b/arch/powerpc/boot/dummy.c | |||
@@ -0,0 +1,4 @@ | |||
1 | int main(void) | ||
2 | { | ||
3 | return 0; | ||
4 | } | ||
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig index 398203bd98eb..2ace57d1e333 100644 --- a/arch/powerpc/configs/pmac32_defconfig +++ b/arch/powerpc/configs/pmac32_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.15-rc5 | 3 | # Linux kernel version: 2.6.15 |
4 | # Tue Dec 13 17:24:05 2005 | 4 | # Sat Jan 14 16:26:08 2006 |
5 | # | 5 | # |
6 | # CONFIG_PPC64 is not set | 6 | # CONFIG_PPC64 is not set |
7 | CONFIG_PPC32=y | 7 | CONFIG_PPC32=y |
@@ -15,11 +15,15 @@ CONFIG_EARLY_PRINTK=y | |||
15 | CONFIG_GENERIC_NVRAM=y | 15 | CONFIG_GENERIC_NVRAM=y |
16 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | 16 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y |
17 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | 17 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y |
18 | CONFIG_PPC_OF=y | ||
19 | # CONFIG_PPC_UDBG_16550 is not set | ||
20 | # CONFIG_CRASH_DUMP is not set | ||
21 | # CONFIG_GENERIC_TBSYNC is not set | ||
18 | 22 | ||
19 | # | 23 | # |
20 | # Processor support | 24 | # Processor support |
21 | # | 25 | # |
22 | CONFIG_6xx=y | 26 | CONFIG_CLASSIC32=y |
23 | # CONFIG_PPC_52xx is not set | 27 | # CONFIG_PPC_52xx is not set |
24 | # CONFIG_PPC_82xx is not set | 28 | # CONFIG_PPC_82xx is not set |
25 | # CONFIG_PPC_83xx is not set | 29 | # CONFIG_PPC_83xx is not set |
@@ -28,6 +32,7 @@ CONFIG_6xx=y | |||
28 | # CONFIG_8xx is not set | 32 | # CONFIG_8xx is not set |
29 | # CONFIG_E200 is not set | 33 | # CONFIG_E200 is not set |
30 | # CONFIG_E500 is not set | 34 | # CONFIG_E500 is not set |
35 | CONFIG_6xx=y | ||
31 | CONFIG_PPC_FPU=y | 36 | CONFIG_PPC_FPU=y |
32 | CONFIG_ALTIVEC=y | 37 | CONFIG_ALTIVEC=y |
33 | CONFIG_PPC_STD_MMU=y | 38 | CONFIG_PPC_STD_MMU=y |
@@ -53,17 +58,18 @@ CONFIG_POSIX_MQUEUE=y | |||
53 | # CONFIG_BSD_PROCESS_ACCT is not set | 58 | # CONFIG_BSD_PROCESS_ACCT is not set |
54 | CONFIG_SYSCTL=y | 59 | CONFIG_SYSCTL=y |
55 | # CONFIG_AUDIT is not set | 60 | # CONFIG_AUDIT is not set |
56 | CONFIG_HOTPLUG=y | ||
57 | CONFIG_KOBJECT_UEVENT=y | ||
58 | CONFIG_IKCONFIG=y | 61 | CONFIG_IKCONFIG=y |
59 | CONFIG_IKCONFIG_PROC=y | 62 | CONFIG_IKCONFIG_PROC=y |
60 | CONFIG_INITRAMFS_SOURCE="" | 63 | CONFIG_INITRAMFS_SOURCE="" |
64 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
61 | # CONFIG_EMBEDDED is not set | 65 | # CONFIG_EMBEDDED is not set |
62 | CONFIG_KALLSYMS=y | 66 | CONFIG_KALLSYMS=y |
63 | # CONFIG_KALLSYMS_ALL is not set | 67 | # CONFIG_KALLSYMS_ALL is not set |
64 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 68 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
69 | CONFIG_HOTPLUG=y | ||
65 | CONFIG_PRINTK=y | 70 | CONFIG_PRINTK=y |
66 | CONFIG_BUG=y | 71 | CONFIG_BUG=y |
72 | CONFIG_ELF_CORE=y | ||
67 | CONFIG_BASE_FULL=y | 73 | CONFIG_BASE_FULL=y |
68 | CONFIG_FUTEX=y | 74 | CONFIG_FUTEX=y |
69 | CONFIG_EPOLL=y | 75 | CONFIG_EPOLL=y |
@@ -72,8 +78,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0 | |||
72 | CONFIG_CC_ALIGN_LABELS=0 | 78 | CONFIG_CC_ALIGN_LABELS=0 |
73 | CONFIG_CC_ALIGN_LOOPS=0 | 79 | CONFIG_CC_ALIGN_LOOPS=0 |
74 | CONFIG_CC_ALIGN_JUMPS=0 | 80 | CONFIG_CC_ALIGN_JUMPS=0 |
81 | CONFIG_SLAB=y | ||
75 | # CONFIG_TINY_SHMEM is not set | 82 | # CONFIG_TINY_SHMEM is not set |
76 | CONFIG_BASE_SMALL=0 | 83 | CONFIG_BASE_SMALL=0 |
84 | # CONFIG_SLOB is not set | ||
77 | 85 | ||
78 | # | 86 | # |
79 | # Loadable module support | 87 | # Loadable module support |
@@ -113,13 +121,10 @@ CONFIG_PPC_MULTIPLATFORM=y | |||
113 | # CONFIG_APUS is not set | 121 | # CONFIG_APUS is not set |
114 | # CONFIG_PPC_CHRP is not set | 122 | # CONFIG_PPC_CHRP is not set |
115 | CONFIG_PPC_PMAC=y | 123 | CONFIG_PPC_PMAC=y |
116 | CONFIG_PPC_OF=y | ||
117 | CONFIG_MPIC=y | 124 | CONFIG_MPIC=y |
118 | # CONFIG_PPC_RTAS is not set | 125 | # CONFIG_PPC_RTAS is not set |
119 | # CONFIG_MMIO_NVRAM is not set | 126 | # CONFIG_MMIO_NVRAM is not set |
120 | # CONFIG_CRASH_DUMP is not set | ||
121 | CONFIG_PPC_MPC106=y | 127 | CONFIG_PPC_MPC106=y |
122 | # CONFIG_GENERIC_TBSYNC is not set | ||
123 | CONFIG_CPU_FREQ=y | 128 | CONFIG_CPU_FREQ=y |
124 | CONFIG_CPU_FREQ_TABLE=y | 129 | CONFIG_CPU_FREQ_TABLE=y |
125 | # CONFIG_CPU_FREQ_DEBUG is not set | 130 | # CONFIG_CPU_FREQ_DEBUG is not set |
@@ -195,6 +200,11 @@ CONFIG_CARDBUS=y | |||
195 | # PC-card bridges | 200 | # PC-card bridges |
196 | # | 201 | # |
197 | CONFIG_YENTA=m | 202 | CONFIG_YENTA=m |
203 | CONFIG_YENTA_O2=y | ||
204 | CONFIG_YENTA_RICOH=y | ||
205 | CONFIG_YENTA_TI=y | ||
206 | CONFIG_YENTA_ENE_TUNE=y | ||
207 | CONFIG_YENTA_TOSHIBA=y | ||
198 | # CONFIG_PD6729 is not set | 208 | # CONFIG_PD6729 is not set |
199 | # CONFIG_I82092 is not set | 209 | # CONFIG_I82092 is not set |
200 | CONFIG_PCCARD_NONSTATIC=m | 210 | CONFIG_PCCARD_NONSTATIC=m |
@@ -464,7 +474,7 @@ CONFIG_IEEE80211_CRYPT_TKIP=m | |||
464 | # | 474 | # |
465 | # CONFIG_STANDALONE is not set | 475 | # CONFIG_STANDALONE is not set |
466 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 476 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
467 | CONFIG_FW_LOADER=m | 477 | CONFIG_FW_LOADER=y |
468 | # CONFIG_DEBUG_DRIVER is not set | 478 | # CONFIG_DEBUG_DRIVER is not set |
469 | 479 | ||
470 | # | 480 | # |
@@ -491,7 +501,7 @@ CONFIG_PROC_EVENTS=y | |||
491 | # Block devices | 501 | # Block devices |
492 | # | 502 | # |
493 | # CONFIG_BLK_DEV_FD is not set | 503 | # CONFIG_BLK_DEV_FD is not set |
494 | CONFIG_MAC_FLOPPY=y | 504 | CONFIG_MAC_FLOPPY=m |
495 | # CONFIG_BLK_CPQ_DA is not set | 505 | # CONFIG_BLK_CPQ_DA is not set |
496 | # CONFIG_BLK_CPQ_CISS_DA is not set | 506 | # CONFIG_BLK_CPQ_CISS_DA is not set |
497 | # CONFIG_BLK_DEV_DAC960 is not set | 507 | # CONFIG_BLK_DEV_DAC960 is not set |
@@ -603,7 +613,7 @@ CONFIG_SCSI_CONSTANTS=y | |||
603 | # SCSI Transport Attributes | 613 | # SCSI Transport Attributes |
604 | # | 614 | # |
605 | CONFIG_SCSI_SPI_ATTRS=y | 615 | CONFIG_SCSI_SPI_ATTRS=y |
606 | # CONFIG_SCSI_FC_ATTRS is not set | 616 | CONFIG_SCSI_FC_ATTRS=y |
607 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 617 | # CONFIG_SCSI_ISCSI_ATTRS is not set |
608 | # CONFIG_SCSI_SAS_ATTRS is not set | 618 | # CONFIG_SCSI_SAS_ATTRS is not set |
609 | 619 | ||
@@ -645,12 +655,7 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 | |||
645 | # CONFIG_SCSI_QLOGIC_FC is not set | 655 | # CONFIG_SCSI_QLOGIC_FC is not set |
646 | # CONFIG_SCSI_QLOGIC_1280 is not set | 656 | # CONFIG_SCSI_QLOGIC_1280 is not set |
647 | CONFIG_SCSI_QLA2XXX=y | 657 | CONFIG_SCSI_QLA2XXX=y |
648 | # CONFIG_SCSI_QLA21XX is not set | 658 | # CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set |
649 | # CONFIG_SCSI_QLA22XX is not set | ||
650 | # CONFIG_SCSI_QLA2300 is not set | ||
651 | # CONFIG_SCSI_QLA2322 is not set | ||
652 | # CONFIG_SCSI_QLA6312 is not set | ||
653 | # CONFIG_SCSI_QLA24XX is not set | ||
654 | # CONFIG_SCSI_LPFC is not set | 659 | # CONFIG_SCSI_LPFC is not set |
655 | # CONFIG_SCSI_DC395x is not set | 660 | # CONFIG_SCSI_DC395x is not set |
656 | # CONFIG_SCSI_DC390T is not set | 661 | # CONFIG_SCSI_DC390T is not set |
@@ -658,7 +663,7 @@ CONFIG_SCSI_QLA2XXX=y | |||
658 | # CONFIG_SCSI_DEBUG is not set | 663 | # CONFIG_SCSI_DEBUG is not set |
659 | CONFIG_SCSI_MESH=y | 664 | CONFIG_SCSI_MESH=y |
660 | CONFIG_SCSI_MESH_SYNC_RATE=5 | 665 | CONFIG_SCSI_MESH_SYNC_RATE=5 |
661 | CONFIG_SCSI_MESH_RESET_DELAY_MS=1000 | 666 | CONFIG_SCSI_MESH_RESET_DELAY_MS=4000 |
662 | CONFIG_SCSI_MAC53C94=y | 667 | CONFIG_SCSI_MAC53C94=y |
663 | 668 | ||
664 | # | 669 | # |
@@ -727,7 +732,6 @@ CONFIG_IEEE1394_SBP2=m | |||
727 | CONFIG_IEEE1394_ETH1394=m | 732 | CONFIG_IEEE1394_ETH1394=m |
728 | CONFIG_IEEE1394_DV1394=m | 733 | CONFIG_IEEE1394_DV1394=m |
729 | CONFIG_IEEE1394_RAWIO=m | 734 | CONFIG_IEEE1394_RAWIO=m |
730 | # CONFIG_IEEE1394_CMP is not set | ||
731 | 735 | ||
732 | # | 736 | # |
733 | # I2O device support | 737 | # I2O device support |
@@ -740,7 +744,7 @@ CONFIG_IEEE1394_RAWIO=m | |||
740 | CONFIG_ADB=y | 744 | CONFIG_ADB=y |
741 | CONFIG_ADB_CUDA=y | 745 | CONFIG_ADB_CUDA=y |
742 | CONFIG_ADB_PMU=y | 746 | CONFIG_ADB_PMU=y |
743 | CONFIG_PMAC_APM_EMU=y | 747 | CONFIG_PMAC_APM_EMU=m |
744 | CONFIG_PMAC_MEDIABAY=y | 748 | CONFIG_PMAC_MEDIABAY=y |
745 | CONFIG_PMAC_BACKLIGHT=y | 749 | CONFIG_PMAC_BACKLIGHT=y |
746 | CONFIG_INPUT_ADBHID=y | 750 | CONFIG_INPUT_ADBHID=y |
@@ -819,6 +823,7 @@ CONFIG_PCNET32=y | |||
819 | # CONFIG_R8169 is not set | 823 | # CONFIG_R8169 is not set |
820 | # CONFIG_SIS190 is not set | 824 | # CONFIG_SIS190 is not set |
821 | # CONFIG_SKGE is not set | 825 | # CONFIG_SKGE is not set |
826 | # CONFIG_SKY2 is not set | ||
822 | # CONFIG_SK98LIN is not set | 827 | # CONFIG_SK98LIN is not set |
823 | # CONFIG_VIA_VELOCITY is not set | 828 | # CONFIG_VIA_VELOCITY is not set |
824 | # CONFIG_TIGON3 is not set | 829 | # CONFIG_TIGON3 is not set |
@@ -978,14 +983,14 @@ CONFIG_HW_CONSOLE=y | |||
978 | CONFIG_SERIAL_8250=m | 983 | CONFIG_SERIAL_8250=m |
979 | # CONFIG_SERIAL_8250_CS is not set | 984 | # CONFIG_SERIAL_8250_CS is not set |
980 | CONFIG_SERIAL_8250_NR_UARTS=4 | 985 | CONFIG_SERIAL_8250_NR_UARTS=4 |
986 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
981 | # CONFIG_SERIAL_8250_EXTENDED is not set | 987 | # CONFIG_SERIAL_8250_EXTENDED is not set |
982 | 988 | ||
983 | # | 989 | # |
984 | # Non-8250 serial port support | 990 | # Non-8250 serial port support |
985 | # | 991 | # |
986 | CONFIG_SERIAL_CORE=m | 992 | CONFIG_SERIAL_CORE=m |
987 | # CONFIG_SERIAL_PMACZILOG is not set | 993 | CONFIG_SERIAL_PMACZILOG=m |
988 | # CONFIG_SERIAL_JSM is not set | ||
989 | CONFIG_UNIX98_PTYS=y | 994 | CONFIG_UNIX98_PTYS=y |
990 | CONFIG_LEGACY_PTYS=y | 995 | CONFIG_LEGACY_PTYS=y |
991 | CONFIG_LEGACY_PTY_COUNT=256 | 996 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -1058,7 +1063,7 @@ CONFIG_I2C_ALGOBIT=y | |||
1058 | # CONFIG_I2C_I801 is not set | 1063 | # CONFIG_I2C_I801 is not set |
1059 | # CONFIG_I2C_I810 is not set | 1064 | # CONFIG_I2C_I810 is not set |
1060 | # CONFIG_I2C_PIIX4 is not set | 1065 | # CONFIG_I2C_PIIX4 is not set |
1061 | CONFIG_I2C_KEYWEST=m | 1066 | CONFIG_I2C_POWERMAC=y |
1062 | # CONFIG_I2C_MPC is not set | 1067 | # CONFIG_I2C_MPC is not set |
1063 | # CONFIG_I2C_NFORCE2 is not set | 1068 | # CONFIG_I2C_NFORCE2 is not set |
1064 | # CONFIG_I2C_PARPORT_LIGHT is not set | 1069 | # CONFIG_I2C_PARPORT_LIGHT is not set |
@@ -1160,7 +1165,6 @@ CONFIG_FB_ATY128=y | |||
1160 | CONFIG_FB_ATY=y | 1165 | CONFIG_FB_ATY=y |
1161 | CONFIG_FB_ATY_CT=y | 1166 | CONFIG_FB_ATY_CT=y |
1162 | # CONFIG_FB_ATY_GENERIC_LCD is not set | 1167 | # CONFIG_FB_ATY_GENERIC_LCD is not set |
1163 | # CONFIG_FB_ATY_XL_INIT is not set | ||
1164 | CONFIG_FB_ATY_GX=y | 1168 | CONFIG_FB_ATY_GX=y |
1165 | # CONFIG_FB_SAVAGE is not set | 1169 | # CONFIG_FB_SAVAGE is not set |
1166 | # CONFIG_FB_SIS is not set | 1170 | # CONFIG_FB_SIS is not set |
@@ -1169,7 +1173,6 @@ CONFIG_FB_ATY_GX=y | |||
1169 | CONFIG_FB_3DFX=y | 1173 | CONFIG_FB_3DFX=y |
1170 | # CONFIG_FB_3DFX_ACCEL is not set | 1174 | # CONFIG_FB_3DFX_ACCEL is not set |
1171 | # CONFIG_FB_VOODOO1 is not set | 1175 | # CONFIG_FB_VOODOO1 is not set |
1172 | # CONFIG_FB_CYBLA is not set | ||
1173 | # CONFIG_FB_TRIDENT is not set | 1176 | # CONFIG_FB_TRIDENT is not set |
1174 | # CONFIG_FB_VIRTUAL is not set | 1177 | # CONFIG_FB_VIRTUAL is not set |
1175 | 1178 | ||
@@ -1214,9 +1217,10 @@ CONFIG_SND_OSSEMUL=y | |||
1214 | CONFIG_SND_MIXER_OSS=m | 1217 | CONFIG_SND_MIXER_OSS=m |
1215 | CONFIG_SND_PCM_OSS=m | 1218 | CONFIG_SND_PCM_OSS=m |
1216 | CONFIG_SND_SEQUENCER_OSS=y | 1219 | CONFIG_SND_SEQUENCER_OSS=y |
1220 | # CONFIG_SND_DYNAMIC_MINORS is not set | ||
1221 | CONFIG_SND_SUPPORT_OLD_API=y | ||
1217 | # CONFIG_SND_VERBOSE_PRINTK is not set | 1222 | # CONFIG_SND_VERBOSE_PRINTK is not set |
1218 | # CONFIG_SND_DEBUG is not set | 1223 | # CONFIG_SND_DEBUG is not set |
1219 | CONFIG_SND_GENERIC_DRIVER=y | ||
1220 | 1224 | ||
1221 | # | 1225 | # |
1222 | # Generic devices | 1226 | # Generic devices |
@@ -1230,6 +1234,8 @@ CONFIG_SND_DUMMY=m | |||
1230 | # | 1234 | # |
1231 | # PCI devices | 1235 | # PCI devices |
1232 | # | 1236 | # |
1237 | # CONFIG_SND_AD1889 is not set | ||
1238 | # CONFIG_SND_ALS4000 is not set | ||
1233 | # CONFIG_SND_ALI5451 is not set | 1239 | # CONFIG_SND_ALI5451 is not set |
1234 | # CONFIG_SND_ATIIXP is not set | 1240 | # CONFIG_SND_ATIIXP is not set |
1235 | # CONFIG_SND_ATIIXP_MODEM is not set | 1241 | # CONFIG_SND_ATIIXP_MODEM is not set |
@@ -1238,45 +1244,44 @@ CONFIG_SND_DUMMY=m | |||
1238 | # CONFIG_SND_AU8830 is not set | 1244 | # CONFIG_SND_AU8830 is not set |
1239 | # CONFIG_SND_AZT3328 is not set | 1245 | # CONFIG_SND_AZT3328 is not set |
1240 | # CONFIG_SND_BT87X is not set | 1246 | # CONFIG_SND_BT87X is not set |
1241 | # CONFIG_SND_CS46XX is not set | 1247 | # CONFIG_SND_CA0106 is not set |
1248 | # CONFIG_SND_CMIPCI is not set | ||
1242 | # CONFIG_SND_CS4281 is not set | 1249 | # CONFIG_SND_CS4281 is not set |
1250 | # CONFIG_SND_CS46XX is not set | ||
1243 | # CONFIG_SND_EMU10K1 is not set | 1251 | # CONFIG_SND_EMU10K1 is not set |
1244 | # CONFIG_SND_EMU10K1X is not set | 1252 | # CONFIG_SND_EMU10K1X is not set |
1245 | # CONFIG_SND_CA0106 is not set | ||
1246 | # CONFIG_SND_KORG1212 is not set | ||
1247 | # CONFIG_SND_MIXART is not set | ||
1248 | # CONFIG_SND_NM256 is not set | ||
1249 | # CONFIG_SND_RME32 is not set | ||
1250 | # CONFIG_SND_RME96 is not set | ||
1251 | # CONFIG_SND_RME9652 is not set | ||
1252 | # CONFIG_SND_HDSP is not set | ||
1253 | # CONFIG_SND_HDSPM is not set | ||
1254 | # CONFIG_SND_TRIDENT is not set | ||
1255 | # CONFIG_SND_YMFPCI is not set | ||
1256 | # CONFIG_SND_AD1889 is not set | ||
1257 | # CONFIG_SND_ALS4000 is not set | ||
1258 | # CONFIG_SND_CMIPCI is not set | ||
1259 | # CONFIG_SND_ENS1370 is not set | 1253 | # CONFIG_SND_ENS1370 is not set |
1260 | # CONFIG_SND_ENS1371 is not set | 1254 | # CONFIG_SND_ENS1371 is not set |
1261 | # CONFIG_SND_ES1938 is not set | 1255 | # CONFIG_SND_ES1938 is not set |
1262 | # CONFIG_SND_ES1968 is not set | 1256 | # CONFIG_SND_ES1968 is not set |
1263 | # CONFIG_SND_MAESTRO3 is not set | ||
1264 | # CONFIG_SND_FM801 is not set | 1257 | # CONFIG_SND_FM801 is not set |
1258 | # CONFIG_SND_HDA_INTEL is not set | ||
1259 | # CONFIG_SND_HDSP is not set | ||
1260 | # CONFIG_SND_HDSPM is not set | ||
1265 | # CONFIG_SND_ICE1712 is not set | 1261 | # CONFIG_SND_ICE1712 is not set |
1266 | # CONFIG_SND_ICE1724 is not set | 1262 | # CONFIG_SND_ICE1724 is not set |
1267 | # CONFIG_SND_INTEL8X0 is not set | 1263 | # CONFIG_SND_INTEL8X0 is not set |
1268 | # CONFIG_SND_INTEL8X0M is not set | 1264 | # CONFIG_SND_INTEL8X0M is not set |
1265 | # CONFIG_SND_KORG1212 is not set | ||
1266 | # CONFIG_SND_MAESTRO3 is not set | ||
1267 | # CONFIG_SND_MIXART is not set | ||
1268 | # CONFIG_SND_NM256 is not set | ||
1269 | # CONFIG_SND_PCXHR is not set | ||
1270 | # CONFIG_SND_RME32 is not set | ||
1271 | # CONFIG_SND_RME96 is not set | ||
1272 | # CONFIG_SND_RME9652 is not set | ||
1269 | # CONFIG_SND_SONICVIBES is not set | 1273 | # CONFIG_SND_SONICVIBES is not set |
1274 | # CONFIG_SND_TRIDENT is not set | ||
1270 | # CONFIG_SND_VIA82XX is not set | 1275 | # CONFIG_SND_VIA82XX is not set |
1271 | # CONFIG_SND_VIA82XX_MODEM is not set | 1276 | # CONFIG_SND_VIA82XX_MODEM is not set |
1272 | # CONFIG_SND_VX222 is not set | 1277 | # CONFIG_SND_VX222 is not set |
1273 | # CONFIG_SND_HDA_INTEL is not set | 1278 | # CONFIG_SND_YMFPCI is not set |
1274 | 1279 | ||
1275 | # | 1280 | # |
1276 | # ALSA PowerMac devices | 1281 | # ALSA PowerMac devices |
1277 | # | 1282 | # |
1278 | CONFIG_SND_POWERMAC=m | 1283 | CONFIG_SND_POWERMAC=m |
1279 | # CONFIG_SND_POWERMAC_AUTO_DRC is not set | 1284 | CONFIG_SND_POWERMAC_AUTO_DRC=y |
1280 | 1285 | ||
1281 | # | 1286 | # |
1282 | # USB devices | 1287 | # USB devices |
@@ -1336,6 +1341,7 @@ CONFIG_USB_PRINTER=m | |||
1336 | # may also be needed; see USB_STORAGE Help for more information | 1341 | # may also be needed; see USB_STORAGE Help for more information |
1337 | # | 1342 | # |
1338 | # CONFIG_USB_STORAGE is not set | 1343 | # CONFIG_USB_STORAGE is not set |
1344 | # CONFIG_USB_LIBUSUAL is not set | ||
1339 | 1345 | ||
1340 | # | 1346 | # |
1341 | # USB Input Devices | 1347 | # USB Input Devices |
@@ -1355,6 +1361,7 @@ CONFIG_USB_HIDINPUT=y | |||
1355 | # CONFIG_USB_YEALINK is not set | 1361 | # CONFIG_USB_YEALINK is not set |
1356 | # CONFIG_USB_XPAD is not set | 1362 | # CONFIG_USB_XPAD is not set |
1357 | # CONFIG_USB_ATI_REMOTE is not set | 1363 | # CONFIG_USB_ATI_REMOTE is not set |
1364 | # CONFIG_USB_ATI_REMOTE2 is not set | ||
1358 | # CONFIG_USB_KEYSPAN_REMOTE is not set | 1365 | # CONFIG_USB_KEYSPAN_REMOTE is not set |
1359 | CONFIG_USB_APPLETOUCH=y | 1366 | CONFIG_USB_APPLETOUCH=y |
1360 | 1367 | ||
@@ -1501,6 +1508,7 @@ CONFIG_FS_MBCACHE=y | |||
1501 | # CONFIG_JFS_FS is not set | 1508 | # CONFIG_JFS_FS is not set |
1502 | # CONFIG_FS_POSIX_ACL is not set | 1509 | # CONFIG_FS_POSIX_ACL is not set |
1503 | # CONFIG_XFS_FS is not set | 1510 | # CONFIG_XFS_FS is not set |
1511 | # CONFIG_OCFS2_FS is not set | ||
1504 | # CONFIG_MINIX_FS is not set | 1512 | # CONFIG_MINIX_FS is not set |
1505 | # CONFIG_ROMFS_FS is not set | 1513 | # CONFIG_ROMFS_FS is not set |
1506 | CONFIG_INOTIFY=y | 1514 | CONFIG_INOTIFY=y |
@@ -1540,6 +1548,7 @@ CONFIG_TMPFS=y | |||
1540 | # CONFIG_HUGETLB_PAGE is not set | 1548 | # CONFIG_HUGETLB_PAGE is not set |
1541 | CONFIG_RAMFS=y | 1549 | CONFIG_RAMFS=y |
1542 | CONFIG_RELAYFS_FS=m | 1550 | CONFIG_RELAYFS_FS=m |
1551 | # CONFIG_CONFIGFS_FS is not set | ||
1543 | 1552 | ||
1544 | # | 1553 | # |
1545 | # Miscellaneous filesystems | 1554 | # Miscellaneous filesystems |
@@ -1670,12 +1679,13 @@ CONFIG_OPROFILE=y | |||
1670 | # Kernel hacking | 1679 | # Kernel hacking |
1671 | # | 1680 | # |
1672 | # CONFIG_PRINTK_TIME is not set | 1681 | # CONFIG_PRINTK_TIME is not set |
1673 | CONFIG_DEBUG_KERNEL=y | ||
1674 | # CONFIG_MAGIC_SYSRQ is not set | 1682 | # CONFIG_MAGIC_SYSRQ is not set |
1683 | CONFIG_DEBUG_KERNEL=y | ||
1675 | CONFIG_LOG_BUF_SHIFT=14 | 1684 | CONFIG_LOG_BUF_SHIFT=14 |
1676 | CONFIG_DETECT_SOFTLOCKUP=y | 1685 | CONFIG_DETECT_SOFTLOCKUP=y |
1677 | # CONFIG_SCHEDSTATS is not set | 1686 | # CONFIG_SCHEDSTATS is not set |
1678 | # CONFIG_DEBUG_SLAB is not set | 1687 | # CONFIG_DEBUG_SLAB is not set |
1688 | # CONFIG_DEBUG_MUTEXES is not set | ||
1679 | # CONFIG_DEBUG_SPINLOCK is not set | 1689 | # CONFIG_DEBUG_SPINLOCK is not set |
1680 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1690 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1681 | # CONFIG_DEBUG_KOBJECT is not set | 1691 | # CONFIG_DEBUG_KOBJECT is not set |
@@ -1688,6 +1698,11 @@ CONFIG_XMON=y | |||
1688 | CONFIG_XMON_DEFAULT=y | 1698 | CONFIG_XMON_DEFAULT=y |
1689 | # CONFIG_BDI_SWITCH is not set | 1699 | # CONFIG_BDI_SWITCH is not set |
1690 | CONFIG_BOOTX_TEXT=y | 1700 | CONFIG_BOOTX_TEXT=y |
1701 | # CONFIG_PPC_EARLY_DEBUG_LPAR is not set | ||
1702 | # CONFIG_PPC_EARLY_DEBUG_G5 is not set | ||
1703 | # CONFIG_PPC_EARLY_DEBUG_RTAS is not set | ||
1704 | # CONFIG_PPC_EARLY_DEBUG_MAPLE is not set | ||
1705 | # CONFIG_PPC_EARLY_DEBUG_ISERIES is not set | ||
1691 | 1706 | ||
1692 | # | 1707 | # |
1693 | # Security options | 1708 | # Security options |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a94699d8dc52..c287980b7e65 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -60,7 +60,8 @@ obj-$(CONFIG_MODULES) += $(module-y) | |||
60 | 60 | ||
61 | pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ | 61 | pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ |
62 | pci_direct_iommu.o iomap.o | 62 | pci_direct_iommu.o iomap.o |
63 | obj-$(CONFIG_PCI) += $(pci64-y) | 63 | pci32-$(CONFIG_PPC32) := pci_32.o |
64 | obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y) | ||
64 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o crash.o | 65 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o crash.o |
65 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o | 66 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o |
66 | obj-$(CONFIG_KEXEC) += machine_kexec.o $(kexec-y) | 67 | obj-$(CONFIG_KEXEC) += machine_kexec.o $(kexec-y) |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 5f248e3fdf82..8c21d378f5d2 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -84,7 +84,10 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
84 | * squirrelled away. ELF notes happen to provide | 84 | * squirrelled away. ELF notes happen to provide |
85 | * all of that that no need to invent something new. | 85 | * all of that that no need to invent something new. |
86 | */ | 86 | */ |
87 | buf = &crash_notes[cpu][0]; | 87 | buf = (u32*)per_cpu_ptr(crash_notes, cpu); |
88 | if (!buf) | ||
89 | return; | ||
90 | |||
88 | memset(&prstatus, 0, sizeof(prstatus)); | 91 | memset(&prstatus, 0, sizeof(prstatus)); |
89 | prstatus.pr_pid = current->pid; | 92 | prstatus.pr_pid = current->pid; |
90 | elf_core_copy_regs(&prstatus.pr_reg, regs); | 93 | elf_core_copy_regs(&prstatus.pr_reg, regs); |
@@ -93,76 +96,6 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
93 | final_note(buf); | 96 | final_note(buf); |
94 | } | 97 | } |
95 | 98 | ||
96 | /* FIXME Merge this with xmon_save_regs ?? */ | ||
97 | static inline void crash_get_current_regs(struct pt_regs *regs) | ||
98 | { | ||
99 | unsigned long tmp1, tmp2; | ||
100 | |||
101 | __asm__ __volatile__ ( | ||
102 | "std 0,0(%2)\n" | ||
103 | "std 1,8(%2)\n" | ||
104 | "std 2,16(%2)\n" | ||
105 | "std 3,24(%2)\n" | ||
106 | "std 4,32(%2)\n" | ||
107 | "std 5,40(%2)\n" | ||
108 | "std 6,48(%2)\n" | ||
109 | "std 7,56(%2)\n" | ||
110 | "std 8,64(%2)\n" | ||
111 | "std 9,72(%2)\n" | ||
112 | "std 10,80(%2)\n" | ||
113 | "std 11,88(%2)\n" | ||
114 | "std 12,96(%2)\n" | ||
115 | "std 13,104(%2)\n" | ||
116 | "std 14,112(%2)\n" | ||
117 | "std 15,120(%2)\n" | ||
118 | "std 16,128(%2)\n" | ||
119 | "std 17,136(%2)\n" | ||
120 | "std 18,144(%2)\n" | ||
121 | "std 19,152(%2)\n" | ||
122 | "std 20,160(%2)\n" | ||
123 | "std 21,168(%2)\n" | ||
124 | "std 22,176(%2)\n" | ||
125 | "std 23,184(%2)\n" | ||
126 | "std 24,192(%2)\n" | ||
127 | "std 25,200(%2)\n" | ||
128 | "std 26,208(%2)\n" | ||
129 | "std 27,216(%2)\n" | ||
130 | "std 28,224(%2)\n" | ||
131 | "std 29,232(%2)\n" | ||
132 | "std 30,240(%2)\n" | ||
133 | "std 31,248(%2)\n" | ||
134 | "mfmsr %0\n" | ||
135 | "std %0, 264(%2)\n" | ||
136 | "mfctr %0\n" | ||
137 | "std %0, 280(%2)\n" | ||
138 | "mflr %0\n" | ||
139 | "std %0, 288(%2)\n" | ||
140 | "bl 1f\n" | ||
141 | "1: mflr %1\n" | ||
142 | "std %1, 256(%2)\n" | ||
143 | "mtlr %0\n" | ||
144 | "mfxer %0\n" | ||
145 | "std %0, 296(%2)\n" | ||
146 | : "=&r" (tmp1), "=&r" (tmp2) | ||
147 | : "b" (regs)); | ||
148 | } | ||
149 | |||
150 | /* We may have saved_regs from where the error came from | ||
151 | * or it is NULL if via a direct panic(). | ||
152 | */ | ||
153 | static void crash_save_self(struct pt_regs *saved_regs) | ||
154 | { | ||
155 | struct pt_regs regs; | ||
156 | int cpu; | ||
157 | |||
158 | cpu = smp_processor_id(); | ||
159 | if (saved_regs) | ||
160 | memcpy(®s, saved_regs, sizeof(regs)); | ||
161 | else | ||
162 | crash_get_current_regs(®s); | ||
163 | crash_save_this_cpu(®s, cpu); | ||
164 | } | ||
165 | |||
166 | #ifdef CONFIG_SMP | 99 | #ifdef CONFIG_SMP |
167 | static atomic_t waiting_for_crash_ipi; | 100 | static atomic_t waiting_for_crash_ipi; |
168 | 101 | ||
@@ -260,5 +193,5 @@ void default_machine_crash_shutdown(struct pt_regs *regs) | |||
260 | */ | 193 | */ |
261 | crashing_cpu = smp_processor_id(); | 194 | crashing_cpu = smp_processor_id(); |
262 | crash_kexec_prepare_cpus(); | 195 | crash_kexec_prepare_cpus(); |
263 | crash_save_self(regs); | 196 | crash_save_this_cpu(regs, crashing_cpu); |
264 | } | 197 | } |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c new file mode 100644 index 000000000000..704c846b2b0f --- /dev/null +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -0,0 +1,1897 @@ | |||
1 | /* | ||
2 | * Common pmac/prep/chrp pci routines. -- Cort | ||
3 | */ | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/pci.h> | ||
8 | #include <linux/delay.h> | ||
9 | #include <linux/string.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/capability.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/bootmem.h> | ||
15 | |||
16 | #include <asm/processor.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <asm/prom.h> | ||
19 | #include <asm/sections.h> | ||
20 | #include <asm/pci-bridge.h> | ||
21 | #include <asm/byteorder.h> | ||
22 | #include <asm/irq.h> | ||
23 | #include <asm/uaccess.h> | ||
24 | #include <asm/machdep.h> | ||
25 | |||
26 | #undef DEBUG | ||
27 | |||
28 | #ifdef DEBUG | ||
29 | #define DBG(x...) printk(x) | ||
30 | #else | ||
31 | #define DBG(x...) | ||
32 | #endif | ||
33 | |||
34 | unsigned long isa_io_base = 0; | ||
35 | unsigned long isa_mem_base = 0; | ||
36 | unsigned long pci_dram_offset = 0; | ||
37 | int pcibios_assign_bus_offset = 1; | ||
38 | |||
39 | void pcibios_make_OF_bus_map(void); | ||
40 | |||
41 | static int pci_relocate_bridge_resource(struct pci_bus *bus, int i); | ||
42 | static int probe_resource(struct pci_bus *parent, struct resource *pr, | ||
43 | struct resource *res, struct resource **conflict); | ||
44 | static void update_bridge_base(struct pci_bus *bus, int i); | ||
45 | static void pcibios_fixup_resources(struct pci_dev* dev); | ||
46 | static void fixup_broken_pcnet32(struct pci_dev* dev); | ||
47 | static int reparent_resources(struct resource *parent, struct resource *res); | ||
48 | static void fixup_cpc710_pci64(struct pci_dev* dev); | ||
49 | #ifdef CONFIG_PPC_OF | ||
50 | static u8* pci_to_OF_bus_map; | ||
51 | #endif | ||
52 | |||
53 | /* By default, we don't re-assign bus numbers. We do this only on | ||
54 | * some pmacs | ||
55 | */ | ||
56 | int pci_assign_all_buses; | ||
57 | |||
58 | struct pci_controller* hose_head; | ||
59 | struct pci_controller** hose_tail = &hose_head; | ||
60 | |||
61 | static int pci_bus_count; | ||
62 | |||
63 | static void | ||
64 | fixup_broken_pcnet32(struct pci_dev* dev) | ||
65 | { | ||
66 | if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) { | ||
67 | dev->vendor = PCI_VENDOR_ID_AMD; | ||
68 | pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD); | ||
69 | } | ||
70 | } | ||
71 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32); | ||
72 | |||
73 | static void | ||
74 | fixup_cpc710_pci64(struct pci_dev* dev) | ||
75 | { | ||
76 | /* Hide the PCI64 BARs from the kernel as their content doesn't | ||
77 | * fit well in the resource management | ||
78 | */ | ||
79 | dev->resource[0].start = dev->resource[0].end = 0; | ||
80 | dev->resource[0].flags = 0; | ||
81 | dev->resource[1].start = dev->resource[1].end = 0; | ||
82 | dev->resource[1].flags = 0; | ||
83 | } | ||
84 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64); | ||
85 | |||
86 | static void | ||
87 | pcibios_fixup_resources(struct pci_dev *dev) | ||
88 | { | ||
89 | struct pci_controller* hose = (struct pci_controller *)dev->sysdata; | ||
90 | int i; | ||
91 | unsigned long offset; | ||
92 | |||
93 | if (!hose) { | ||
94 | printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev)); | ||
95 | return; | ||
96 | } | ||
97 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
98 | struct resource *res = dev->resource + i; | ||
99 | if (!res->flags) | ||
100 | continue; | ||
101 | if (res->end == 0xffffffff) { | ||
102 | DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", | ||
103 | pci_name(dev), i, res->start, res->end); | ||
104 | res->end -= res->start; | ||
105 | res->start = 0; | ||
106 | res->flags |= IORESOURCE_UNSET; | ||
107 | continue; | ||
108 | } | ||
109 | offset = 0; | ||
110 | if (res->flags & IORESOURCE_MEM) { | ||
111 | offset = hose->pci_mem_offset; | ||
112 | } else if (res->flags & IORESOURCE_IO) { | ||
113 | offset = (unsigned long) hose->io_base_virt | ||
114 | - isa_io_base; | ||
115 | } | ||
116 | if (offset != 0) { | ||
117 | res->start += offset; | ||
118 | res->end += offset; | ||
119 | #ifdef DEBUG | ||
120 | printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n", | ||
121 | i, res->flags, pci_name(dev), | ||
122 | res->start - offset, res->start); | ||
123 | #endif | ||
124 | } | ||
125 | } | ||
126 | |||
127 | /* Call machine specific resource fixup */ | ||
128 | if (ppc_md.pcibios_fixup_resources) | ||
129 | ppc_md.pcibios_fixup_resources(dev); | ||
130 | } | ||
131 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); | ||
132 | |||
133 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
134 | struct resource *res) | ||
135 | { | ||
136 | unsigned long offset = 0; | ||
137 | struct pci_controller *hose = dev->sysdata; | ||
138 | |||
139 | if (hose && res->flags & IORESOURCE_IO) | ||
140 | offset = (unsigned long)hose->io_base_virt - isa_io_base; | ||
141 | else if (hose && res->flags & IORESOURCE_MEM) | ||
142 | offset = hose->pci_mem_offset; | ||
143 | region->start = res->start - offset; | ||
144 | region->end = res->end - offset; | ||
145 | } | ||
146 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
147 | |||
148 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
149 | struct pci_bus_region *region) | ||
150 | { | ||
151 | unsigned long offset = 0; | ||
152 | struct pci_controller *hose = dev->sysdata; | ||
153 | |||
154 | if (hose && res->flags & IORESOURCE_IO) | ||
155 | offset = (unsigned long)hose->io_base_virt - isa_io_base; | ||
156 | else if (hose && res->flags & IORESOURCE_MEM) | ||
157 | offset = hose->pci_mem_offset; | ||
158 | res->start = region->start + offset; | ||
159 | res->end = region->end + offset; | ||
160 | } | ||
161 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
162 | |||
163 | /* | ||
164 | * We need to avoid collisions with `mirrored' VGA ports | ||
165 | * and other strange ISA hardware, so we always want the | ||
166 | * addresses to be allocated in the 0x000-0x0ff region | ||
167 | * modulo 0x400. | ||
168 | * | ||
169 | * Why? Because some silly external IO cards only decode | ||
170 | * the low 10 bits of the IO address. The 0x00-0xff region | ||
171 | * is reserved for motherboard devices that decode all 16 | ||
172 | * bits, so it's ok to allocate at, say, 0x2800-0x28ff, | ||
173 | * but we want to try to avoid allocating at 0x2900-0x2bff | ||
174 | * which might have be mirrored at 0x0100-0x03ff.. | ||
175 | */ | ||
176 | void pcibios_align_resource(void *data, struct resource *res, unsigned long size, | ||
177 | unsigned long align) | ||
178 | { | ||
179 | struct pci_dev *dev = data; | ||
180 | |||
181 | if (res->flags & IORESOURCE_IO) { | ||
182 | unsigned long start = res->start; | ||
183 | |||
184 | if (size > 0x100) { | ||
185 | printk(KERN_ERR "PCI: I/O Region %s/%d too large" | ||
186 | " (%ld bytes)\n", pci_name(dev), | ||
187 | dev->resource - res, size); | ||
188 | } | ||
189 | |||
190 | if (start & 0x300) { | ||
191 | start = (start + 0x3ff) & ~0x3ff; | ||
192 | res->start = start; | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | EXPORT_SYMBOL(pcibios_align_resource); | ||
197 | |||
198 | /* | ||
199 | * Handle resources of PCI devices. If the world were perfect, we could | ||
200 | * just allocate all the resource regions and do nothing more. It isn't. | ||
201 | * On the other hand, we cannot just re-allocate all devices, as it would | ||
202 | * require us to know lots of host bridge internals. So we attempt to | ||
203 | * keep as much of the original configuration as possible, but tweak it | ||
204 | * when it's found to be wrong. | ||
205 | * | ||
206 | * Known BIOS problems we have to work around: | ||
207 | * - I/O or memory regions not configured | ||
208 | * - regions configured, but not enabled in the command register | ||
209 | * - bogus I/O addresses above 64K used | ||
210 | * - expansion ROMs left enabled (this may sound harmless, but given | ||
211 | * the fact the PCI specs explicitly allow address decoders to be | ||
212 | * shared between expansion ROMs and other resource regions, it's | ||
213 | * at least dangerous) | ||
214 | * | ||
215 | * Our solution: | ||
216 | * (1) Allocate resources for all buses behind PCI-to-PCI bridges. | ||
217 | * This gives us fixed barriers on where we can allocate. | ||
218 | * (2) Allocate resources for all enabled devices. If there is | ||
219 | * a collision, just mark the resource as unallocated. Also | ||
220 | * disable expansion ROMs during this step. | ||
221 | * (3) Try to allocate resources for disabled devices. If the | ||
222 | * resources were assigned correctly, everything goes well, | ||
223 | * if they weren't, they won't disturb allocation of other | ||
224 | * resources. | ||
225 | * (4) Assign new addresses to resources which were either | ||
226 | * not configured at all or misconfigured. If explicitly | ||
227 | * requested by the user, configure expansion ROM address | ||
228 | * as well. | ||
229 | */ | ||
230 | |||
231 | static void __init | ||
232 | pcibios_allocate_bus_resources(struct list_head *bus_list) | ||
233 | { | ||
234 | struct pci_bus *bus; | ||
235 | int i; | ||
236 | struct resource *res, *pr; | ||
237 | |||
238 | /* Depth-First Search on bus tree */ | ||
239 | list_for_each_entry(bus, bus_list, node) { | ||
240 | for (i = 0; i < 4; ++i) { | ||
241 | if ((res = bus->resource[i]) == NULL || !res->flags | ||
242 | || res->start > res->end) | ||
243 | continue; | ||
244 | if (bus->parent == NULL) | ||
245 | pr = (res->flags & IORESOURCE_IO)? | ||
246 | &ioport_resource: &iomem_resource; | ||
247 | else { | ||
248 | pr = pci_find_parent_resource(bus->self, res); | ||
249 | if (pr == res) { | ||
250 | /* this happens when the generic PCI | ||
251 | * code (wrongly) decides that this | ||
252 | * bridge is transparent -- paulus | ||
253 | */ | ||
254 | continue; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n", | ||
259 | res->start, res->end, res->flags, pr); | ||
260 | if (pr) { | ||
261 | if (request_resource(pr, res) == 0) | ||
262 | continue; | ||
263 | /* | ||
264 | * Must be a conflict with an existing entry. | ||
265 | * Move that entry (or entries) under the | ||
266 | * bridge resource and try again. | ||
267 | */ | ||
268 | if (reparent_resources(pr, res) == 0) | ||
269 | continue; | ||
270 | } | ||
271 | printk(KERN_ERR "PCI: Cannot allocate resource region " | ||
272 | "%d of PCI bridge %d\n", i, bus->number); | ||
273 | if (pci_relocate_bridge_resource(bus, i)) | ||
274 | bus->resource[i] = NULL; | ||
275 | } | ||
276 | pcibios_allocate_bus_resources(&bus->children); | ||
277 | } | ||
278 | } | ||
279 | |||
280 | /* | ||
281 | * Reparent resource children of pr that conflict with res | ||
282 | * under res, and make res replace those children. | ||
283 | */ | ||
284 | static int __init | ||
285 | reparent_resources(struct resource *parent, struct resource *res) | ||
286 | { | ||
287 | struct resource *p, **pp; | ||
288 | struct resource **firstpp = NULL; | ||
289 | |||
290 | for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) { | ||
291 | if (p->end < res->start) | ||
292 | continue; | ||
293 | if (res->end < p->start) | ||
294 | break; | ||
295 | if (p->start < res->start || p->end > res->end) | ||
296 | return -1; /* not completely contained */ | ||
297 | if (firstpp == NULL) | ||
298 | firstpp = pp; | ||
299 | } | ||
300 | if (firstpp == NULL) | ||
301 | return -1; /* didn't find any conflicting entries? */ | ||
302 | res->parent = parent; | ||
303 | res->child = *firstpp; | ||
304 | res->sibling = *pp; | ||
305 | *firstpp = res; | ||
306 | *pp = NULL; | ||
307 | for (p = res->child; p != NULL; p = p->sibling) { | ||
308 | p->parent = res; | ||
309 | DBG(KERN_INFO "PCI: reparented %s [%lx..%lx] under %s\n", | ||
310 | p->name, p->start, p->end, res->name); | ||
311 | } | ||
312 | return 0; | ||
313 | } | ||
314 | |||
315 | /* | ||
316 | * A bridge has been allocated a range which is outside the range | ||
317 | * of its parent bridge, so it needs to be moved. | ||
318 | */ | ||
319 | static int __init | ||
320 | pci_relocate_bridge_resource(struct pci_bus *bus, int i) | ||
321 | { | ||
322 | struct resource *res, *pr, *conflict; | ||
323 | unsigned long try, size; | ||
324 | int j; | ||
325 | struct pci_bus *parent = bus->parent; | ||
326 | |||
327 | if (parent == NULL) { | ||
328 | /* shouldn't ever happen */ | ||
329 | printk(KERN_ERR "PCI: can't move host bridge resource\n"); | ||
330 | return -1; | ||
331 | } | ||
332 | res = bus->resource[i]; | ||
333 | if (res == NULL) | ||
334 | return -1; | ||
335 | pr = NULL; | ||
336 | for (j = 0; j < 4; j++) { | ||
337 | struct resource *r = parent->resource[j]; | ||
338 | if (!r) | ||
339 | continue; | ||
340 | if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM)) | ||
341 | continue; | ||
342 | if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH)) { | ||
343 | pr = r; | ||
344 | break; | ||
345 | } | ||
346 | if (res->flags & IORESOURCE_PREFETCH) | ||
347 | pr = r; | ||
348 | } | ||
349 | if (pr == NULL) | ||
350 | return -1; | ||
351 | size = res->end - res->start; | ||
352 | if (pr->start > pr->end || size > pr->end - pr->start) | ||
353 | return -1; | ||
354 | try = pr->end; | ||
355 | for (;;) { | ||
356 | res->start = try - size; | ||
357 | res->end = try; | ||
358 | if (probe_resource(bus->parent, pr, res, &conflict) == 0) | ||
359 | break; | ||
360 | if (conflict->start <= pr->start + size) | ||
361 | return -1; | ||
362 | try = conflict->start - 1; | ||
363 | } | ||
364 | if (request_resource(pr, res)) { | ||
365 | DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n", | ||
366 | res->start, res->end); | ||
367 | return -1; /* "can't happen" */ | ||
368 | } | ||
369 | update_bridge_base(bus, i); | ||
370 | printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n", | ||
371 | bus->number, i, res->start, res->end); | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | static int __init | ||
376 | probe_resource(struct pci_bus *parent, struct resource *pr, | ||
377 | struct resource *res, struct resource **conflict) | ||
378 | { | ||
379 | struct pci_bus *bus; | ||
380 | struct pci_dev *dev; | ||
381 | struct resource *r; | ||
382 | int i; | ||
383 | |||
384 | for (r = pr->child; r != NULL; r = r->sibling) { | ||
385 | if (r->end >= res->start && res->end >= r->start) { | ||
386 | *conflict = r; | ||
387 | return 1; | ||
388 | } | ||
389 | } | ||
390 | list_for_each_entry(bus, &parent->children, node) { | ||
391 | for (i = 0; i < 4; ++i) { | ||
392 | if ((r = bus->resource[i]) == NULL) | ||
393 | continue; | ||
394 | if (!r->flags || r->start > r->end || r == res) | ||
395 | continue; | ||
396 | if (pci_find_parent_resource(bus->self, r) != pr) | ||
397 | continue; | ||
398 | if (r->end >= res->start && res->end >= r->start) { | ||
399 | *conflict = r; | ||
400 | return 1; | ||
401 | } | ||
402 | } | ||
403 | } | ||
404 | list_for_each_entry(dev, &parent->devices, bus_list) { | ||
405 | for (i = 0; i < 6; ++i) { | ||
406 | r = &dev->resource[i]; | ||
407 | if (!r->flags || (r->flags & IORESOURCE_UNSET)) | ||
408 | continue; | ||
409 | if (pci_find_parent_resource(dev, r) != pr) | ||
410 | continue; | ||
411 | if (r->end >= res->start && res->end >= r->start) { | ||
412 | *conflict = r; | ||
413 | return 1; | ||
414 | } | ||
415 | } | ||
416 | } | ||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | static void __init | ||
421 | update_bridge_base(struct pci_bus *bus, int i) | ||
422 | { | ||
423 | struct resource *res = bus->resource[i]; | ||
424 | u8 io_base_lo, io_limit_lo; | ||
425 | u16 mem_base, mem_limit; | ||
426 | u16 cmd; | ||
427 | unsigned long start, end, off; | ||
428 | struct pci_dev *dev = bus->self; | ||
429 | struct pci_controller *hose = dev->sysdata; | ||
430 | |||
431 | if (!hose) { | ||
432 | printk("update_bridge_base: no hose?\n"); | ||
433 | return; | ||
434 | } | ||
435 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
436 | pci_write_config_word(dev, PCI_COMMAND, | ||
437 | cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); | ||
438 | if (res->flags & IORESOURCE_IO) { | ||
439 | off = (unsigned long) hose->io_base_virt - isa_io_base; | ||
440 | start = res->start - off; | ||
441 | end = res->end - off; | ||
442 | io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK; | ||
443 | io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK; | ||
444 | if (end > 0xffff) { | ||
445 | pci_write_config_word(dev, PCI_IO_BASE_UPPER16, | ||
446 | start >> 16); | ||
447 | pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16, | ||
448 | end >> 16); | ||
449 | io_base_lo |= PCI_IO_RANGE_TYPE_32; | ||
450 | } else | ||
451 | io_base_lo |= PCI_IO_RANGE_TYPE_16; | ||
452 | pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo); | ||
453 | pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo); | ||
454 | |||
455 | } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH)) | ||
456 | == IORESOURCE_MEM) { | ||
457 | off = hose->pci_mem_offset; | ||
458 | mem_base = ((res->start - off) >> 16) & PCI_MEMORY_RANGE_MASK; | ||
459 | mem_limit = ((res->end - off) >> 16) & PCI_MEMORY_RANGE_MASK; | ||
460 | pci_write_config_word(dev, PCI_MEMORY_BASE, mem_base); | ||
461 | pci_write_config_word(dev, PCI_MEMORY_LIMIT, mem_limit); | ||
462 | |||
463 | } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH)) | ||
464 | == (IORESOURCE_MEM | IORESOURCE_PREFETCH)) { | ||
465 | off = hose->pci_mem_offset; | ||
466 | mem_base = ((res->start - off) >> 16) & PCI_PREF_RANGE_MASK; | ||
467 | mem_limit = ((res->end - off) >> 16) & PCI_PREF_RANGE_MASK; | ||
468 | pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, mem_base); | ||
469 | pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, mem_limit); | ||
470 | |||
471 | } else { | ||
472 | DBG(KERN_ERR "PCI: ugh, bridge %s res %d has flags=%lx\n", | ||
473 | pci_name(dev), i, res->flags); | ||
474 | } | ||
475 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
476 | } | ||
477 | |||
478 | static inline void alloc_resource(struct pci_dev *dev, int idx) | ||
479 | { | ||
480 | struct resource *pr, *r = &dev->resource[idx]; | ||
481 | |||
482 | DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n", | ||
483 | pci_name(dev), idx, r->start, r->end, r->flags); | ||
484 | pr = pci_find_parent_resource(dev, r); | ||
485 | if (!pr || request_resource(pr, r) < 0) { | ||
486 | printk(KERN_ERR "PCI: Cannot allocate resource region %d" | ||
487 | " of device %s\n", idx, pci_name(dev)); | ||
488 | if (pr) | ||
489 | DBG("PCI: parent is %p: %08lx-%08lx (f=%lx)\n", | ||
490 | pr, pr->start, pr->end, pr->flags); | ||
491 | /* We'll assign a new address later */ | ||
492 | r->flags |= IORESOURCE_UNSET; | ||
493 | r->end -= r->start; | ||
494 | r->start = 0; | ||
495 | } | ||
496 | } | ||
497 | |||
498 | static void __init | ||
499 | pcibios_allocate_resources(int pass) | ||
500 | { | ||
501 | struct pci_dev *dev = NULL; | ||
502 | int idx, disabled; | ||
503 | u16 command; | ||
504 | struct resource *r; | ||
505 | |||
506 | for_each_pci_dev(dev) { | ||
507 | pci_read_config_word(dev, PCI_COMMAND, &command); | ||
508 | for (idx = 0; idx < 6; idx++) { | ||
509 | r = &dev->resource[idx]; | ||
510 | if (r->parent) /* Already allocated */ | ||
511 | continue; | ||
512 | if (!r->flags || (r->flags & IORESOURCE_UNSET)) | ||
513 | continue; /* Not assigned at all */ | ||
514 | if (r->flags & IORESOURCE_IO) | ||
515 | disabled = !(command & PCI_COMMAND_IO); | ||
516 | else | ||
517 | disabled = !(command & PCI_COMMAND_MEMORY); | ||
518 | if (pass == disabled) | ||
519 | alloc_resource(dev, idx); | ||
520 | } | ||
521 | if (pass) | ||
522 | continue; | ||
523 | r = &dev->resource[PCI_ROM_RESOURCE]; | ||
524 | if (r->flags & IORESOURCE_ROM_ENABLE) { | ||
525 | /* Turn the ROM off, leave the resource region, but keep it unregistered. */ | ||
526 | u32 reg; | ||
527 | DBG("PCI: Switching off ROM of %s\n", pci_name(dev)); | ||
528 | r->flags &= ~IORESOURCE_ROM_ENABLE; | ||
529 | pci_read_config_dword(dev, dev->rom_base_reg, ®); | ||
530 | pci_write_config_dword(dev, dev->rom_base_reg, | ||
531 | reg & ~PCI_ROM_ADDRESS_ENABLE); | ||
532 | } | ||
533 | } | ||
534 | } | ||
535 | |||
536 | static void __init | ||
537 | pcibios_assign_resources(void) | ||
538 | { | ||
539 | struct pci_dev *dev = NULL; | ||
540 | int idx; | ||
541 | struct resource *r; | ||
542 | |||
543 | for_each_pci_dev(dev) { | ||
544 | int class = dev->class >> 8; | ||
545 | |||
546 | /* Don't touch classless devices and host bridges */ | ||
547 | if (!class || class == PCI_CLASS_BRIDGE_HOST) | ||
548 | continue; | ||
549 | |||
550 | for (idx = 0; idx < 6; idx++) { | ||
551 | r = &dev->resource[idx]; | ||
552 | |||
553 | /* | ||
554 | * We shall assign a new address to this resource, | ||
555 | * either because the BIOS (sic) forgot to do so | ||
556 | * or because we have decided the old address was | ||
557 | * unusable for some reason. | ||
558 | */ | ||
559 | if ((r->flags & IORESOURCE_UNSET) && r->end && | ||
560 | (!ppc_md.pcibios_enable_device_hook || | ||
561 | !ppc_md.pcibios_enable_device_hook(dev, 1))) { | ||
562 | r->flags &= ~IORESOURCE_UNSET; | ||
563 | pci_assign_resource(dev, idx); | ||
564 | } | ||
565 | } | ||
566 | |||
567 | #if 0 /* don't assign ROMs */ | ||
568 | r = &dev->resource[PCI_ROM_RESOURCE]; | ||
569 | r->end -= r->start; | ||
570 | r->start = 0; | ||
571 | if (r->end) | ||
572 | pci_assign_resource(dev, PCI_ROM_RESOURCE); | ||
573 | #endif | ||
574 | } | ||
575 | } | ||
576 | |||
577 | |||
578 | int | ||
579 | pcibios_enable_resources(struct pci_dev *dev, int mask) | ||
580 | { | ||
581 | u16 cmd, old_cmd; | ||
582 | int idx; | ||
583 | struct resource *r; | ||
584 | |||
585 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
586 | old_cmd = cmd; | ||
587 | for (idx=0; idx<6; idx++) { | ||
588 | /* Only set up the requested stuff */ | ||
589 | if (!(mask & (1<<idx))) | ||
590 | continue; | ||
591 | |||
592 | r = &dev->resource[idx]; | ||
593 | if (r->flags & IORESOURCE_UNSET) { | ||
594 | printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); | ||
595 | return -EINVAL; | ||
596 | } | ||
597 | if (r->flags & IORESOURCE_IO) | ||
598 | cmd |= PCI_COMMAND_IO; | ||
599 | if (r->flags & IORESOURCE_MEM) | ||
600 | cmd |= PCI_COMMAND_MEMORY; | ||
601 | } | ||
602 | if (dev->resource[PCI_ROM_RESOURCE].start) | ||
603 | cmd |= PCI_COMMAND_MEMORY; | ||
604 | if (cmd != old_cmd) { | ||
605 | printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); | ||
606 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
607 | } | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | static int next_controller_index; | ||
612 | |||
613 | struct pci_controller * __init | ||
614 | pcibios_alloc_controller(void) | ||
615 | { | ||
616 | struct pci_controller *hose; | ||
617 | |||
618 | hose = (struct pci_controller *)alloc_bootmem(sizeof(*hose)); | ||
619 | memset(hose, 0, sizeof(struct pci_controller)); | ||
620 | |||
621 | *hose_tail = hose; | ||
622 | hose_tail = &hose->next; | ||
623 | |||
624 | hose->index = next_controller_index++; | ||
625 | |||
626 | return hose; | ||
627 | } | ||
628 | |||
629 | #ifdef CONFIG_PPC_OF | ||
630 | /* | ||
631 | * Functions below are used on OpenFirmware machines. | ||
632 | */ | ||
633 | static void | ||
634 | make_one_node_map(struct device_node* node, u8 pci_bus) | ||
635 | { | ||
636 | int *bus_range; | ||
637 | int len; | ||
638 | |||
639 | if (pci_bus >= pci_bus_count) | ||
640 | return; | ||
641 | bus_range = (int *) get_property(node, "bus-range", &len); | ||
642 | if (bus_range == NULL || len < 2 * sizeof(int)) { | ||
643 | printk(KERN_WARNING "Can't get bus-range for %s, " | ||
644 | "assuming it starts at 0\n", node->full_name); | ||
645 | pci_to_OF_bus_map[pci_bus] = 0; | ||
646 | } else | ||
647 | pci_to_OF_bus_map[pci_bus] = bus_range[0]; | ||
648 | |||
649 | for (node=node->child; node != 0;node = node->sibling) { | ||
650 | struct pci_dev* dev; | ||
651 | unsigned int *class_code, *reg; | ||
652 | |||
653 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | ||
654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | ||
655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | ||
656 | continue; | ||
657 | reg = (unsigned int *)get_property(node, "reg", NULL); | ||
658 | if (!reg) | ||
659 | continue; | ||
660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); | ||
661 | if (!dev || !dev->subordinate) | ||
662 | continue; | ||
663 | make_one_node_map(node, dev->subordinate->number); | ||
664 | } | ||
665 | } | ||
666 | |||
667 | void | ||
668 | pcibios_make_OF_bus_map(void) | ||
669 | { | ||
670 | int i; | ||
671 | struct pci_controller* hose; | ||
672 | u8* of_prop_map; | ||
673 | |||
674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); | ||
675 | if (!pci_to_OF_bus_map) { | ||
676 | printk(KERN_ERR "Can't allocate OF bus map !\n"); | ||
677 | return; | ||
678 | } | ||
679 | |||
680 | /* We fill the bus map with invalid values, that helps | ||
681 | * debugging. | ||
682 | */ | ||
683 | for (i=0; i<pci_bus_count; i++) | ||
684 | pci_to_OF_bus_map[i] = 0xff; | ||
685 | |||
686 | /* For each hose, we begin searching bridges */ | ||
687 | for(hose=hose_head; hose; hose=hose->next) { | ||
688 | struct device_node* node; | ||
689 | node = (struct device_node *)hose->arch_data; | ||
690 | if (!node) | ||
691 | continue; | ||
692 | make_one_node_map(node, hose->first_busno); | ||
693 | } | ||
694 | of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); | ||
695 | if (of_prop_map) | ||
696 | memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); | ||
697 | #ifdef DEBUG | ||
698 | printk("PCI->OF bus map:\n"); | ||
699 | for (i=0; i<pci_bus_count; i++) { | ||
700 | if (pci_to_OF_bus_map[i] == 0xff) | ||
701 | continue; | ||
702 | printk("%d -> %d\n", i, pci_to_OF_bus_map[i]); | ||
703 | } | ||
704 | #endif | ||
705 | } | ||
706 | |||
707 | typedef int (*pci_OF_scan_iterator)(struct device_node* node, void* data); | ||
708 | |||
709 | static struct device_node* | ||
710 | scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* data) | ||
711 | { | ||
712 | struct device_node* sub_node; | ||
713 | |||
714 | for (; node != 0;node = node->sibling) { | ||
715 | unsigned int *class_code; | ||
716 | |||
717 | if (filter(node, data)) | ||
718 | return node; | ||
719 | |||
720 | /* For PCI<->PCI bridges or CardBus bridges, we go down | ||
721 | * Note: some OFs create a parent node "multifunc-device" as | ||
722 | * a fake root for all functions of a multi-function device, | ||
723 | * we go down them as well. | ||
724 | */ | ||
725 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | ||
726 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | ||
727 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && | ||
728 | strcmp(node->name, "multifunc-device")) | ||
729 | continue; | ||
730 | sub_node = scan_OF_pci_childs(node->child, filter, data); | ||
731 | if (sub_node) | ||
732 | return sub_node; | ||
733 | } | ||
734 | return NULL; | ||
735 | } | ||
736 | |||
737 | static int | ||
738 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) | ||
739 | { | ||
740 | unsigned int *reg; | ||
741 | u8* fdata = (u8*)data; | ||
742 | |||
743 | reg = (unsigned int *) get_property(node, "reg", NULL); | ||
744 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] | ||
745 | && ((reg[0] >> 16) & 0xff) == fdata[0]) | ||
746 | return 1; | ||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static struct device_node* | ||
751 | scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn) | ||
752 | { | ||
753 | u8 filter_data[2] = {bus, dev_fn}; | ||
754 | |||
755 | return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data); | ||
756 | } | ||
757 | |||
758 | /* | ||
759 | * Scans the OF tree for a device node matching a PCI device | ||
760 | */ | ||
761 | struct device_node * | ||
762 | pci_busdev_to_OF_node(struct pci_bus *bus, int devfn) | ||
763 | { | ||
764 | struct pci_controller *hose; | ||
765 | struct device_node *node; | ||
766 | int busnr; | ||
767 | |||
768 | if (!have_of) | ||
769 | return NULL; | ||
770 | |||
771 | /* Lookup the hose */ | ||
772 | busnr = bus->number; | ||
773 | hose = pci_bus_to_hose(busnr); | ||
774 | if (!hose) | ||
775 | return NULL; | ||
776 | |||
777 | /* Check it has an OF node associated */ | ||
778 | node = (struct device_node *) hose->arch_data; | ||
779 | if (!node) | ||
780 | return NULL; | ||
781 | |||
782 | /* Fixup bus number according to what OF think it is. */ | ||
783 | #ifdef CONFIG_PPC_PMAC | ||
784 | /* The G5 need a special case here. Basically, we don't remap all | ||
785 | * busses on it so we don't create the pci-OF-map. However, we do | ||
786 | * remap the AGP bus and so have to deal with it. A future better | ||
787 | * fix has to be done by making the remapping per-host and always | ||
788 | * filling the pci_to_OF map. --BenH | ||
789 | */ | ||
790 | if (_machine == _MACH_Pmac && busnr >= 0xf0) | ||
791 | busnr -= 0xf0; | ||
792 | else | ||
793 | #endif | ||
794 | if (pci_to_OF_bus_map) | ||
795 | busnr = pci_to_OF_bus_map[busnr]; | ||
796 | if (busnr == 0xff) | ||
797 | return NULL; | ||
798 | |||
799 | /* Now, lookup childs of the hose */ | ||
800 | return scan_OF_childs_for_device(node->child, busnr, devfn); | ||
801 | } | ||
802 | EXPORT_SYMBOL(pci_busdev_to_OF_node); | ||
803 | |||
804 | struct device_node* | ||
805 | pci_device_to_OF_node(struct pci_dev *dev) | ||
806 | { | ||
807 | return pci_busdev_to_OF_node(dev->bus, dev->devfn); | ||
808 | } | ||
809 | EXPORT_SYMBOL(pci_device_to_OF_node); | ||
810 | |||
811 | /* This routine is meant to be used early during boot, when the | ||
812 | * PCI bus numbers have not yet been assigned, and you need to | ||
813 | * issue PCI config cycles to an OF device. | ||
814 | * It could also be used to "fix" RTAS config cycles if you want | ||
815 | * to set pci_assign_all_buses to 1 and still use RTAS for PCI | ||
816 | * config cycles. | ||
817 | */ | ||
818 | struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node) | ||
819 | { | ||
820 | if (!have_of) | ||
821 | return NULL; | ||
822 | while(node) { | ||
823 | struct pci_controller* hose; | ||
824 | for (hose=hose_head;hose;hose=hose->next) | ||
825 | if (hose->arch_data == node) | ||
826 | return hose; | ||
827 | node=node->parent; | ||
828 | } | ||
829 | return NULL; | ||
830 | } | ||
831 | |||
832 | static int | ||
833 | find_OF_pci_device_filter(struct device_node* node, void* data) | ||
834 | { | ||
835 | return ((void *)node == data); | ||
836 | } | ||
837 | |||
838 | /* | ||
839 | * Returns the PCI device matching a given OF node | ||
840 | */ | ||
841 | int | ||
842 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | ||
843 | { | ||
844 | unsigned int *reg; | ||
845 | struct pci_controller* hose; | ||
846 | struct pci_dev* dev = NULL; | ||
847 | |||
848 | if (!have_of) | ||
849 | return -ENODEV; | ||
850 | /* Make sure it's really a PCI device */ | ||
851 | hose = pci_find_hose_for_OF_device(node); | ||
852 | if (!hose || !hose->arch_data) | ||
853 | return -ENODEV; | ||
854 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, | ||
855 | find_OF_pci_device_filter, (void *)node)) | ||
856 | return -ENODEV; | ||
857 | reg = (unsigned int *) get_property(node, "reg", NULL); | ||
858 | if (!reg) | ||
859 | return -ENODEV; | ||
860 | *bus = (reg[0] >> 16) & 0xff; | ||
861 | *devfn = ((reg[0] >> 8) & 0xff); | ||
862 | |||
863 | /* Ok, here we need some tweak. If we have already renumbered | ||
864 | * all busses, we can't rely on the OF bus number any more. | ||
865 | * the pci_to_OF_bus_map is not enough as several PCI busses | ||
866 | * may match the same OF bus number. | ||
867 | */ | ||
868 | if (!pci_to_OF_bus_map) | ||
869 | return 0; | ||
870 | |||
871 | for_each_pci_dev(dev) | ||
872 | if (pci_to_OF_bus_map[dev->bus->number] == *bus && | ||
873 | dev->devfn == *devfn) { | ||
874 | *bus = dev->bus->number; | ||
875 | pci_dev_put(dev); | ||
876 | return 0; | ||
877 | } | ||
878 | |||
879 | return -ENODEV; | ||
880 | } | ||
881 | EXPORT_SYMBOL(pci_device_from_OF_node); | ||
882 | |||
883 | void __init | ||
884 | pci_process_bridge_OF_ranges(struct pci_controller *hose, | ||
885 | struct device_node *dev, int primary) | ||
886 | { | ||
887 | static unsigned int static_lc_ranges[256] __initdata; | ||
888 | unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; | ||
889 | unsigned int size; | ||
890 | int rlen = 0, orig_rlen; | ||
891 | int memno = 0; | ||
892 | struct resource *res; | ||
893 | int np, na = prom_n_addr_cells(dev); | ||
894 | np = na + 5; | ||
895 | |||
896 | /* First we try to merge ranges to fix a problem with some pmacs | ||
897 | * that can have more than 3 ranges, fortunately using contiguous | ||
898 | * addresses -- BenH | ||
899 | */ | ||
900 | dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | ||
901 | if (!dt_ranges) | ||
902 | return; | ||
903 | /* Sanity check, though hopefully that never happens */ | ||
904 | if (rlen > sizeof(static_lc_ranges)) { | ||
905 | printk(KERN_WARNING "OF ranges property too large !\n"); | ||
906 | rlen = sizeof(static_lc_ranges); | ||
907 | } | ||
908 | lc_ranges = static_lc_ranges; | ||
909 | memcpy(lc_ranges, dt_ranges, rlen); | ||
910 | orig_rlen = rlen; | ||
911 | |||
912 | /* Let's work on a copy of the "ranges" property instead of damaging | ||
913 | * the device-tree image in memory | ||
914 | */ | ||
915 | ranges = lc_ranges; | ||
916 | prev = NULL; | ||
917 | while ((rlen -= np * sizeof(unsigned int)) >= 0) { | ||
918 | if (prev) { | ||
919 | if (prev[0] == ranges[0] && prev[1] == ranges[1] && | ||
920 | (prev[2] + prev[na+4]) == ranges[2] && | ||
921 | (prev[na+2] + prev[na+4]) == ranges[na+2]) { | ||
922 | prev[na+4] += ranges[na+4]; | ||
923 | ranges[0] = 0; | ||
924 | ranges += np; | ||
925 | continue; | ||
926 | } | ||
927 | } | ||
928 | prev = ranges; | ||
929 | ranges += np; | ||
930 | } | ||
931 | |||
932 | /* | ||
933 | * The ranges property is laid out as an array of elements, | ||
934 | * each of which comprises: | ||
935 | * cells 0 - 2: a PCI address | ||
936 | * cells 3 or 3+4: a CPU physical address | ||
937 | * (size depending on dev->n_addr_cells) | ||
938 | * cells 4+5 or 5+6: the size of the range | ||
939 | */ | ||
940 | ranges = lc_ranges; | ||
941 | rlen = orig_rlen; | ||
942 | while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) { | ||
943 | res = NULL; | ||
944 | size = ranges[na+4]; | ||
945 | switch ((ranges[0] >> 24) & 0x3) { | ||
946 | case 1: /* I/O space */ | ||
947 | if (ranges[2] != 0) | ||
948 | break; | ||
949 | hose->io_base_phys = ranges[na+2]; | ||
950 | /* limit I/O space to 16MB */ | ||
951 | if (size > 0x01000000) | ||
952 | size = 0x01000000; | ||
953 | hose->io_base_virt = ioremap(ranges[na+2], size); | ||
954 | if (primary) | ||
955 | isa_io_base = (unsigned long) hose->io_base_virt; | ||
956 | res = &hose->io_resource; | ||
957 | res->flags = IORESOURCE_IO; | ||
958 | res->start = ranges[2]; | ||
959 | DBG("PCI: IO 0x%lx -> 0x%lx\n", | ||
960 | res->start, res->start + size - 1); | ||
961 | break; | ||
962 | case 2: /* memory space */ | ||
963 | memno = 0; | ||
964 | if (ranges[1] == 0 && ranges[2] == 0 | ||
965 | && ranges[na+4] <= (16 << 20)) { | ||
966 | /* 1st 16MB, i.e. ISA memory area */ | ||
967 | if (primary) | ||
968 | isa_mem_base = ranges[na+2]; | ||
969 | memno = 1; | ||
970 | } | ||
971 | while (memno < 3 && hose->mem_resources[memno].flags) | ||
972 | ++memno; | ||
973 | if (memno == 0) | ||
974 | hose->pci_mem_offset = ranges[na+2] - ranges[2]; | ||
975 | if (memno < 3) { | ||
976 | res = &hose->mem_resources[memno]; | ||
977 | res->flags = IORESOURCE_MEM; | ||
978 | if(ranges[0] & 0x40000000) | ||
979 | res->flags |= IORESOURCE_PREFETCH; | ||
980 | res->start = ranges[na+2]; | ||
981 | DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno, | ||
982 | res->start, res->start + size - 1); | ||
983 | } | ||
984 | break; | ||
985 | } | ||
986 | if (res != NULL) { | ||
987 | res->name = dev->full_name; | ||
988 | res->end = res->start + size - 1; | ||
989 | res->parent = NULL; | ||
990 | res->sibling = NULL; | ||
991 | res->child = NULL; | ||
992 | } | ||
993 | ranges += np; | ||
994 | } | ||
995 | } | ||
996 | |||
997 | /* We create the "pci-OF-bus-map" property now so it appears in the | ||
998 | * /proc device tree | ||
999 | */ | ||
1000 | void __init | ||
1001 | pci_create_OF_bus_map(void) | ||
1002 | { | ||
1003 | struct property* of_prop; | ||
1004 | |||
1005 | of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256); | ||
1006 | if (of_prop && find_path_device("/")) { | ||
1007 | memset(of_prop, -1, sizeof(struct property) + 256); | ||
1008 | of_prop->name = "pci-OF-bus-map"; | ||
1009 | of_prop->length = 256; | ||
1010 | of_prop->value = (unsigned char *)&of_prop[1]; | ||
1011 | prom_add_property(find_path_device("/"), of_prop); | ||
1012 | } | ||
1013 | } | ||
1014 | |||
1015 | static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) | ||
1016 | { | ||
1017 | struct pci_dev *pdev; | ||
1018 | struct device_node *np; | ||
1019 | |||
1020 | pdev = to_pci_dev (dev); | ||
1021 | np = pci_device_to_OF_node(pdev); | ||
1022 | if (np == NULL || np->full_name == NULL) | ||
1023 | return 0; | ||
1024 | return sprintf(buf, "%s", np->full_name); | ||
1025 | } | ||
1026 | static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); | ||
1027 | |||
1028 | #else /* CONFIG_PPC_OF */ | ||
1029 | void pcibios_make_OF_bus_map(void) | ||
1030 | { | ||
1031 | } | ||
1032 | #endif /* CONFIG_PPC_OF */ | ||
1033 | |||
1034 | /* Add sysfs properties */ | ||
1035 | void pcibios_add_platform_entries(struct pci_dev *pdev) | ||
1036 | { | ||
1037 | #ifdef CONFIG_PPC_OF | ||
1038 | device_create_file(&pdev->dev, &dev_attr_devspec); | ||
1039 | #endif /* CONFIG_PPC_OF */ | ||
1040 | } | ||
1041 | |||
1042 | |||
1043 | #ifdef CONFIG_PPC_PMAC | ||
1044 | /* | ||
1045 | * This set of routines checks for PCI<->PCI bridges that have closed | ||
1046 | * IO resources and have child devices. It tries to re-open an IO | ||
1047 | * window on them. | ||
1048 | * | ||
1049 | * This is a _temporary_ fix to workaround a problem with Apple's OF | ||
1050 | * closing IO windows on P2P bridges when the OF drivers of cards | ||
1051 | * below this bridge don't claim any IO range (typically ATI or | ||
1052 | * Adaptec). | ||
1053 | * | ||
1054 | * A more complete fix would be to use drivers/pci/setup-bus.c, which | ||
1055 | * involves a working pcibios_fixup_pbus_ranges(), some more care about | ||
1056 | * ordering when creating the host bus resources, and maybe a few more | ||
1057 | * minor tweaks | ||
1058 | */ | ||
1059 | |||
1060 | /* Initialize bridges with base/limit values we have collected */ | ||
1061 | static void __init | ||
1062 | do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga) | ||
1063 | { | ||
1064 | struct pci_dev *bridge = bus->self; | ||
1065 | struct pci_controller* hose = (struct pci_controller *)bridge->sysdata; | ||
1066 | u32 l; | ||
1067 | u16 w; | ||
1068 | struct resource res; | ||
1069 | |||
1070 | if (bus->resource[0] == NULL) | ||
1071 | return; | ||
1072 | res = *(bus->resource[0]); | ||
1073 | |||
1074 | DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge)); | ||
1075 | res.start -= ((unsigned long) hose->io_base_virt - isa_io_base); | ||
1076 | res.end -= ((unsigned long) hose->io_base_virt - isa_io_base); | ||
1077 | DBG(" IO window: %08lx-%08lx\n", res.start, res.end); | ||
1078 | |||
1079 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | ||
1080 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); | ||
1081 | l &= 0xffff000f; | ||
1082 | l |= (res.start >> 8) & 0x00f0; | ||
1083 | l |= res.end & 0xf000; | ||
1084 | pci_write_config_dword(bridge, PCI_IO_BASE, l); | ||
1085 | |||
1086 | if ((l & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { | ||
1087 | l = (res.start >> 16) | (res.end & 0xffff0000); | ||
1088 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l); | ||
1089 | } | ||
1090 | |||
1091 | pci_read_config_word(bridge, PCI_COMMAND, &w); | ||
1092 | w |= PCI_COMMAND_IO; | ||
1093 | pci_write_config_word(bridge, PCI_COMMAND, w); | ||
1094 | |||
1095 | #if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */ | ||
1096 | if (enable_vga) { | ||
1097 | pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &w); | ||
1098 | w |= PCI_BRIDGE_CTL_VGA; | ||
1099 | pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w); | ||
1100 | } | ||
1101 | #endif | ||
1102 | } | ||
1103 | |||
1104 | /* This function is pretty basic and actually quite broken for the | ||
1105 | * general case, it's enough for us right now though. It's supposed | ||
1106 | * to tell us if we need to open an IO range at all or not and what | ||
1107 | * size. | ||
1108 | */ | ||
1109 | static int __init | ||
1110 | check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga) | ||
1111 | { | ||
1112 | struct pci_dev *dev; | ||
1113 | int i; | ||
1114 | int rc = 0; | ||
1115 | |||
1116 | #define push_end(res, size) do { unsigned long __sz = (size) ; \ | ||
1117 | res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \ | ||
1118 | } while (0) | ||
1119 | |||
1120 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
1121 | u16 class = dev->class >> 8; | ||
1122 | |||
1123 | if (class == PCI_CLASS_DISPLAY_VGA || | ||
1124 | class == PCI_CLASS_NOT_DEFINED_VGA) | ||
1125 | *found_vga = 1; | ||
1126 | if (class >> 8 == PCI_BASE_CLASS_BRIDGE && dev->subordinate) | ||
1127 | rc |= check_for_io_childs(dev->subordinate, res, found_vga); | ||
1128 | if (class == PCI_CLASS_BRIDGE_CARDBUS) | ||
1129 | push_end(res, 0xfff); | ||
1130 | |||
1131 | for (i=0; i<PCI_NUM_RESOURCES; i++) { | ||
1132 | struct resource *r; | ||
1133 | unsigned long r_size; | ||
1134 | |||
1135 | if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI | ||
1136 | && i >= PCI_BRIDGE_RESOURCES) | ||
1137 | continue; | ||
1138 | r = &dev->resource[i]; | ||
1139 | r_size = r->end - r->start; | ||
1140 | if (r_size < 0xfff) | ||
1141 | r_size = 0xfff; | ||
1142 | if (r->flags & IORESOURCE_IO && (r_size) != 0) { | ||
1143 | rc = 1; | ||
1144 | push_end(res, r_size); | ||
1145 | } | ||
1146 | } | ||
1147 | } | ||
1148 | |||
1149 | return rc; | ||
1150 | } | ||
1151 | |||
1152 | /* Here we scan all P2P bridges of a given level that have a closed | ||
1153 | * IO window. Note that the test for the presence of a VGA card should | ||
1154 | * be improved to take into account already configured P2P bridges, | ||
1155 | * currently, we don't see them and might end up configuring 2 bridges | ||
1156 | * with VGA pass through enabled | ||
1157 | */ | ||
1158 | static void __init | ||
1159 | do_fixup_p2p_level(struct pci_bus *bus) | ||
1160 | { | ||
1161 | struct pci_bus *b; | ||
1162 | int i, parent_io; | ||
1163 | int has_vga = 0; | ||
1164 | |||
1165 | for (parent_io=0; parent_io<4; parent_io++) | ||
1166 | if (bus->resource[parent_io] | ||
1167 | && bus->resource[parent_io]->flags & IORESOURCE_IO) | ||
1168 | break; | ||
1169 | if (parent_io >= 4) | ||
1170 | return; | ||
1171 | |||
1172 | list_for_each_entry(b, &bus->children, node) { | ||
1173 | struct pci_dev *d = b->self; | ||
1174 | struct pci_controller* hose = (struct pci_controller *)d->sysdata; | ||
1175 | struct resource *res = b->resource[0]; | ||
1176 | struct resource tmp_res; | ||
1177 | unsigned long max; | ||
1178 | int found_vga = 0; | ||
1179 | |||
1180 | memset(&tmp_res, 0, sizeof(tmp_res)); | ||
1181 | tmp_res.start = bus->resource[parent_io]->start; | ||
1182 | |||
1183 | /* We don't let low addresses go through that closed P2P bridge, well, | ||
1184 | * that may not be necessary but I feel safer that way | ||
1185 | */ | ||
1186 | if (tmp_res.start == 0) | ||
1187 | tmp_res.start = 0x1000; | ||
1188 | |||
1189 | if (!list_empty(&b->devices) && res && res->flags == 0 && | ||
1190 | res != bus->resource[parent_io] && | ||
1191 | (d->class >> 8) == PCI_CLASS_BRIDGE_PCI && | ||
1192 | check_for_io_childs(b, &tmp_res, &found_vga)) { | ||
1193 | u8 io_base_lo; | ||
1194 | |||
1195 | printk(KERN_INFO "Fixing up IO bus %s\n", b->name); | ||
1196 | |||
1197 | if (found_vga) { | ||
1198 | if (has_vga) { | ||
1199 | printk(KERN_WARNING "Skipping VGA, already active" | ||
1200 | " on bus segment\n"); | ||
1201 | found_vga = 0; | ||
1202 | } else | ||
1203 | has_vga = 1; | ||
1204 | } | ||
1205 | pci_read_config_byte(d, PCI_IO_BASE, &io_base_lo); | ||
1206 | |||
1207 | if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) | ||
1208 | max = ((unsigned long) hose->io_base_virt | ||
1209 | - isa_io_base) + 0xffffffff; | ||
1210 | else | ||
1211 | max = ((unsigned long) hose->io_base_virt | ||
1212 | - isa_io_base) + 0xffff; | ||
1213 | |||
1214 | *res = tmp_res; | ||
1215 | res->flags = IORESOURCE_IO; | ||
1216 | res->name = b->name; | ||
1217 | |||
1218 | /* Find a resource in the parent where we can allocate */ | ||
1219 | for (i = 0 ; i < 4; i++) { | ||
1220 | struct resource *r = bus->resource[i]; | ||
1221 | if (!r) | ||
1222 | continue; | ||
1223 | if ((r->flags & IORESOURCE_IO) == 0) | ||
1224 | continue; | ||
1225 | DBG("Trying to allocate from %08lx, size %08lx from parent" | ||
1226 | " res %d: %08lx -> %08lx\n", | ||
1227 | res->start, res->end, i, r->start, r->end); | ||
1228 | |||
1229 | if (allocate_resource(r, res, res->end + 1, res->start, max, | ||
1230 | res->end + 1, NULL, NULL) < 0) { | ||
1231 | DBG("Failed !\n"); | ||
1232 | continue; | ||
1233 | } | ||
1234 | do_update_p2p_io_resource(b, found_vga); | ||
1235 | break; | ||
1236 | } | ||
1237 | } | ||
1238 | do_fixup_p2p_level(b); | ||
1239 | } | ||
1240 | } | ||
1241 | |||
1242 | static void | ||
1243 | pcibios_fixup_p2p_bridges(void) | ||
1244 | { | ||
1245 | struct pci_bus *b; | ||
1246 | |||
1247 | list_for_each_entry(b, &pci_root_buses, node) | ||
1248 | do_fixup_p2p_level(b); | ||
1249 | } | ||
1250 | |||
1251 | #endif /* CONFIG_PPC_PMAC */ | ||
1252 | |||
1253 | static int __init | ||
1254 | pcibios_init(void) | ||
1255 | { | ||
1256 | struct pci_controller *hose; | ||
1257 | struct pci_bus *bus; | ||
1258 | int next_busno; | ||
1259 | |||
1260 | printk(KERN_INFO "PCI: Probing PCI hardware\n"); | ||
1261 | |||
1262 | /* Scan all of the recorded PCI controllers. */ | ||
1263 | for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { | ||
1264 | if (pci_assign_all_buses) | ||
1265 | hose->first_busno = next_busno; | ||
1266 | hose->last_busno = 0xff; | ||
1267 | bus = pci_scan_bus(hose->first_busno, hose->ops, hose); | ||
1268 | hose->last_busno = bus->subordinate; | ||
1269 | if (pci_assign_all_buses || next_busno <= hose->last_busno) | ||
1270 | next_busno = hose->last_busno + pcibios_assign_bus_offset; | ||
1271 | } | ||
1272 | pci_bus_count = next_busno; | ||
1273 | |||
1274 | /* OpenFirmware based machines need a map of OF bus | ||
1275 | * numbers vs. kernel bus numbers since we may have to | ||
1276 | * remap them. | ||
1277 | */ | ||
1278 | if (pci_assign_all_buses && have_of) | ||
1279 | pcibios_make_OF_bus_map(); | ||
1280 | |||
1281 | /* Do machine dependent PCI interrupt routing */ | ||
1282 | if (ppc_md.pci_swizzle && ppc_md.pci_map_irq) | ||
1283 | pci_fixup_irqs(ppc_md.pci_swizzle, ppc_md.pci_map_irq); | ||
1284 | |||
1285 | /* Call machine dependent fixup */ | ||
1286 | if (ppc_md.pcibios_fixup) | ||
1287 | ppc_md.pcibios_fixup(); | ||
1288 | |||
1289 | /* Allocate and assign resources */ | ||
1290 | pcibios_allocate_bus_resources(&pci_root_buses); | ||
1291 | pcibios_allocate_resources(0); | ||
1292 | pcibios_allocate_resources(1); | ||
1293 | #ifdef CONFIG_PPC_PMAC | ||
1294 | pcibios_fixup_p2p_bridges(); | ||
1295 | #endif /* CONFIG_PPC_PMAC */ | ||
1296 | pcibios_assign_resources(); | ||
1297 | |||
1298 | /* Call machine dependent post-init code */ | ||
1299 | if (ppc_md.pcibios_after_init) | ||
1300 | ppc_md.pcibios_after_init(); | ||
1301 | |||
1302 | return 0; | ||
1303 | } | ||
1304 | |||
1305 | subsys_initcall(pcibios_init); | ||
1306 | |||
1307 | unsigned char __init | ||
1308 | common_swizzle(struct pci_dev *dev, unsigned char *pinp) | ||
1309 | { | ||
1310 | struct pci_controller *hose = dev->sysdata; | ||
1311 | |||
1312 | if (dev->bus->number != hose->first_busno) { | ||
1313 | u8 pin = *pinp; | ||
1314 | do { | ||
1315 | pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); | ||
1316 | /* Move up the chain of bridges. */ | ||
1317 | dev = dev->bus->self; | ||
1318 | } while (dev->bus->self); | ||
1319 | *pinp = pin; | ||
1320 | |||
1321 | /* The slot is the idsel of the last bridge. */ | ||
1322 | } | ||
1323 | return PCI_SLOT(dev->devfn); | ||
1324 | } | ||
1325 | |||
1326 | unsigned long resource_fixup(struct pci_dev * dev, struct resource * res, | ||
1327 | unsigned long start, unsigned long size) | ||
1328 | { | ||
1329 | return start; | ||
1330 | } | ||
1331 | |||
1332 | void __init pcibios_fixup_bus(struct pci_bus *bus) | ||
1333 | { | ||
1334 | struct pci_controller *hose = (struct pci_controller *) bus->sysdata; | ||
1335 | unsigned long io_offset; | ||
1336 | struct resource *res; | ||
1337 | int i; | ||
1338 | |||
1339 | io_offset = (unsigned long)hose->io_base_virt - isa_io_base; | ||
1340 | if (bus->parent == NULL) { | ||
1341 | /* This is a host bridge - fill in its resources */ | ||
1342 | hose->bus = bus; | ||
1343 | |||
1344 | bus->resource[0] = res = &hose->io_resource; | ||
1345 | if (!res->flags) { | ||
1346 | if (io_offset) | ||
1347 | printk(KERN_ERR "I/O resource not set for host" | ||
1348 | " bridge %d\n", hose->index); | ||
1349 | res->start = 0; | ||
1350 | res->end = IO_SPACE_LIMIT; | ||
1351 | res->flags = IORESOURCE_IO; | ||
1352 | } | ||
1353 | res->start += io_offset; | ||
1354 | res->end += io_offset; | ||
1355 | |||
1356 | for (i = 0; i < 3; ++i) { | ||
1357 | res = &hose->mem_resources[i]; | ||
1358 | if (!res->flags) { | ||
1359 | if (i > 0) | ||
1360 | continue; | ||
1361 | printk(KERN_ERR "Memory resource not set for " | ||
1362 | "host bridge %d\n", hose->index); | ||
1363 | res->start = hose->pci_mem_offset; | ||
1364 | res->end = ~0U; | ||
1365 | res->flags = IORESOURCE_MEM; | ||
1366 | } | ||
1367 | bus->resource[i+1] = res; | ||
1368 | } | ||
1369 | } else { | ||
1370 | /* This is a subordinate bridge */ | ||
1371 | pci_read_bridge_bases(bus); | ||
1372 | |||
1373 | for (i = 0; i < 4; ++i) { | ||
1374 | if ((res = bus->resource[i]) == NULL) | ||
1375 | continue; | ||
1376 | if (!res->flags) | ||
1377 | continue; | ||
1378 | if (io_offset && (res->flags & IORESOURCE_IO)) { | ||
1379 | res->start += io_offset; | ||
1380 | res->end += io_offset; | ||
1381 | } else if (hose->pci_mem_offset | ||
1382 | && (res->flags & IORESOURCE_MEM)) { | ||
1383 | res->start += hose->pci_mem_offset; | ||
1384 | res->end += hose->pci_mem_offset; | ||
1385 | } | ||
1386 | } | ||
1387 | } | ||
1388 | |||
1389 | if (ppc_md.pcibios_fixup_bus) | ||
1390 | ppc_md.pcibios_fixup_bus(bus); | ||
1391 | } | ||
1392 | |||
1393 | char __init *pcibios_setup(char *str) | ||
1394 | { | ||
1395 | return str; | ||
1396 | } | ||
1397 | |||
1398 | /* the next one is stolen from the alpha port... */ | ||
1399 | void __init | ||
1400 | pcibios_update_irq(struct pci_dev *dev, int irq) | ||
1401 | { | ||
1402 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | ||
1403 | /* XXX FIXME - update OF device tree node interrupt property */ | ||
1404 | } | ||
1405 | |||
1406 | int pcibios_enable_device(struct pci_dev *dev, int mask) | ||
1407 | { | ||
1408 | u16 cmd, old_cmd; | ||
1409 | int idx; | ||
1410 | struct resource *r; | ||
1411 | |||
1412 | if (ppc_md.pcibios_enable_device_hook) | ||
1413 | if (ppc_md.pcibios_enable_device_hook(dev, 0)) | ||
1414 | return -EINVAL; | ||
1415 | |||
1416 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
1417 | old_cmd = cmd; | ||
1418 | for (idx=0; idx<6; idx++) { | ||
1419 | r = &dev->resource[idx]; | ||
1420 | if (r->flags & IORESOURCE_UNSET) { | ||
1421 | printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); | ||
1422 | return -EINVAL; | ||
1423 | } | ||
1424 | if (r->flags & IORESOURCE_IO) | ||
1425 | cmd |= PCI_COMMAND_IO; | ||
1426 | if (r->flags & IORESOURCE_MEM) | ||
1427 | cmd |= PCI_COMMAND_MEMORY; | ||
1428 | } | ||
1429 | if (cmd != old_cmd) { | ||
1430 | printk("PCI: Enabling device %s (%04x -> %04x)\n", | ||
1431 | pci_name(dev), old_cmd, cmd); | ||
1432 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
1433 | } | ||
1434 | return 0; | ||
1435 | } | ||
1436 | |||
1437 | struct pci_controller* | ||
1438 | pci_bus_to_hose(int bus) | ||
1439 | { | ||
1440 | struct pci_controller* hose = hose_head; | ||
1441 | |||
1442 | for (; hose; hose = hose->next) | ||
1443 | if (bus >= hose->first_busno && bus <= hose->last_busno) | ||
1444 | return hose; | ||
1445 | return NULL; | ||
1446 | } | ||
1447 | |||
1448 | void __iomem * | ||
1449 | pci_bus_io_base(unsigned int bus) | ||
1450 | { | ||
1451 | struct pci_controller *hose; | ||
1452 | |||
1453 | hose = pci_bus_to_hose(bus); | ||
1454 | if (!hose) | ||
1455 | return NULL; | ||
1456 | return hose->io_base_virt; | ||
1457 | } | ||
1458 | |||
1459 | unsigned long | ||
1460 | pci_bus_io_base_phys(unsigned int bus) | ||
1461 | { | ||
1462 | struct pci_controller *hose; | ||
1463 | |||
1464 | hose = pci_bus_to_hose(bus); | ||
1465 | if (!hose) | ||
1466 | return 0; | ||
1467 | return hose->io_base_phys; | ||
1468 | } | ||
1469 | |||
1470 | unsigned long | ||
1471 | pci_bus_mem_base_phys(unsigned int bus) | ||
1472 | { | ||
1473 | struct pci_controller *hose; | ||
1474 | |||
1475 | hose = pci_bus_to_hose(bus); | ||
1476 | if (!hose) | ||
1477 | return 0; | ||
1478 | return hose->pci_mem_offset; | ||
1479 | } | ||
1480 | |||
1481 | unsigned long | ||
1482 | pci_resource_to_bus(struct pci_dev *pdev, struct resource *res) | ||
1483 | { | ||
1484 | /* Hack alert again ! See comments in chrp_pci.c | ||
1485 | */ | ||
1486 | struct pci_controller* hose = | ||
1487 | (struct pci_controller *)pdev->sysdata; | ||
1488 | if (hose && res->flags & IORESOURCE_MEM) | ||
1489 | return res->start - hose->pci_mem_offset; | ||
1490 | /* We may want to do something with IOs here... */ | ||
1491 | return res->start; | ||
1492 | } | ||
1493 | |||
1494 | |||
1495 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | ||
1496 | unsigned long *offset, | ||
1497 | enum pci_mmap_state mmap_state) | ||
1498 | { | ||
1499 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | ||
1500 | unsigned long io_offset = 0; | ||
1501 | int i, res_bit; | ||
1502 | |||
1503 | if (hose == 0) | ||
1504 | return NULL; /* should never happen */ | ||
1505 | |||
1506 | /* If memory, add on the PCI bridge address offset */ | ||
1507 | if (mmap_state == pci_mmap_mem) { | ||
1508 | *offset += hose->pci_mem_offset; | ||
1509 | res_bit = IORESOURCE_MEM; | ||
1510 | } else { | ||
1511 | io_offset = hose->io_base_virt - ___IO_BASE; | ||
1512 | *offset += io_offset; | ||
1513 | res_bit = IORESOURCE_IO; | ||
1514 | } | ||
1515 | |||
1516 | /* | ||
1517 | * Check that the offset requested corresponds to one of the | ||
1518 | * resources of the device. | ||
1519 | */ | ||
1520 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) { | ||
1521 | struct resource *rp = &dev->resource[i]; | ||
1522 | int flags = rp->flags; | ||
1523 | |||
1524 | /* treat ROM as memory (should be already) */ | ||
1525 | if (i == PCI_ROM_RESOURCE) | ||
1526 | flags |= IORESOURCE_MEM; | ||
1527 | |||
1528 | /* Active and same type? */ | ||
1529 | if ((flags & res_bit) == 0) | ||
1530 | continue; | ||
1531 | |||
1532 | /* In the range of this resource? */ | ||
1533 | if (*offset < (rp->start & PAGE_MASK) || *offset > rp->end) | ||
1534 | continue; | ||
1535 | |||
1536 | /* found it! construct the final physical address */ | ||
1537 | if (mmap_state == pci_mmap_io) | ||
1538 | *offset += hose->io_base_phys - io_offset; | ||
1539 | return rp; | ||
1540 | } | ||
1541 | |||
1542 | return NULL; | ||
1543 | } | ||
1544 | |||
1545 | /* | ||
1546 | * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci | ||
1547 | * device mapping. | ||
1548 | */ | ||
1549 | static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | ||
1550 | pgprot_t protection, | ||
1551 | enum pci_mmap_state mmap_state, | ||
1552 | int write_combine) | ||
1553 | { | ||
1554 | unsigned long prot = pgprot_val(protection); | ||
1555 | |||
1556 | /* Write combine is always 0 on non-memory space mappings. On | ||
1557 | * memory space, if the user didn't pass 1, we check for a | ||
1558 | * "prefetchable" resource. This is a bit hackish, but we use | ||
1559 | * this to workaround the inability of /sysfs to provide a write | ||
1560 | * combine bit | ||
1561 | */ | ||
1562 | if (mmap_state != pci_mmap_mem) | ||
1563 | write_combine = 0; | ||
1564 | else if (write_combine == 0) { | ||
1565 | if (rp->flags & IORESOURCE_PREFETCH) | ||
1566 | write_combine = 1; | ||
1567 | } | ||
1568 | |||
1569 | /* XXX would be nice to have a way to ask for write-through */ | ||
1570 | prot |= _PAGE_NO_CACHE; | ||
1571 | if (write_combine) | ||
1572 | prot &= ~_PAGE_GUARDED; | ||
1573 | else | ||
1574 | prot |= _PAGE_GUARDED; | ||
1575 | |||
1576 | printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, | ||
1577 | prot); | ||
1578 | |||
1579 | return __pgprot(prot); | ||
1580 | } | ||
1581 | |||
1582 | /* | ||
1583 | * This one is used by /dev/mem and fbdev who have no clue about the | ||
1584 | * PCI device, it tries to find the PCI device first and calls the | ||
1585 | * above routine | ||
1586 | */ | ||
1587 | pgprot_t pci_phys_mem_access_prot(struct file *file, | ||
1588 | unsigned long pfn, | ||
1589 | unsigned long size, | ||
1590 | pgprot_t protection) | ||
1591 | { | ||
1592 | struct pci_dev *pdev = NULL; | ||
1593 | struct resource *found = NULL; | ||
1594 | unsigned long prot = pgprot_val(protection); | ||
1595 | unsigned long offset = pfn << PAGE_SHIFT; | ||
1596 | int i; | ||
1597 | |||
1598 | if (page_is_ram(pfn)) | ||
1599 | return prot; | ||
1600 | |||
1601 | prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; | ||
1602 | |||
1603 | for_each_pci_dev(pdev) { | ||
1604 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) { | ||
1605 | struct resource *rp = &pdev->resource[i]; | ||
1606 | int flags = rp->flags; | ||
1607 | |||
1608 | /* Active and same type? */ | ||
1609 | if ((flags & IORESOURCE_MEM) == 0) | ||
1610 | continue; | ||
1611 | /* In the range of this resource? */ | ||
1612 | if (offset < (rp->start & PAGE_MASK) || | ||
1613 | offset > rp->end) | ||
1614 | continue; | ||
1615 | found = rp; | ||
1616 | break; | ||
1617 | } | ||
1618 | if (found) | ||
1619 | break; | ||
1620 | } | ||
1621 | if (found) { | ||
1622 | if (found->flags & IORESOURCE_PREFETCH) | ||
1623 | prot &= ~_PAGE_GUARDED; | ||
1624 | pci_dev_put(pdev); | ||
1625 | } | ||
1626 | |||
1627 | DBG("non-PCI map for %lx, prot: %lx\n", offset, prot); | ||
1628 | |||
1629 | return __pgprot(prot); | ||
1630 | } | ||
1631 | |||
1632 | |||
1633 | /* | ||
1634 | * Perform the actual remap of the pages for a PCI device mapping, as | ||
1635 | * appropriate for this architecture. The region in the process to map | ||
1636 | * is described by vm_start and vm_end members of VMA, the base physical | ||
1637 | * address is found in vm_pgoff. | ||
1638 | * The pci device structure is provided so that architectures may make mapping | ||
1639 | * decisions on a per-device or per-bus basis. | ||
1640 | * | ||
1641 | * Returns a negative error code on failure, zero on success. | ||
1642 | */ | ||
1643 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | ||
1644 | enum pci_mmap_state mmap_state, | ||
1645 | int write_combine) | ||
1646 | { | ||
1647 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | ||
1648 | struct resource *rp; | ||
1649 | int ret; | ||
1650 | |||
1651 | rp = __pci_mmap_make_offset(dev, &offset, mmap_state); | ||
1652 | if (rp == NULL) | ||
1653 | return -EINVAL; | ||
1654 | |||
1655 | vma->vm_pgoff = offset >> PAGE_SHIFT; | ||
1656 | vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO; | ||
1657 | vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp, | ||
1658 | vma->vm_page_prot, | ||
1659 | mmap_state, write_combine); | ||
1660 | |||
1661 | ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, | ||
1662 | vma->vm_end - vma->vm_start, vma->vm_page_prot); | ||
1663 | |||
1664 | return ret; | ||
1665 | } | ||
1666 | |||
1667 | /* Obsolete functions. Should be removed once the symbios driver | ||
1668 | * is fixed | ||
1669 | */ | ||
1670 | unsigned long | ||
1671 | phys_to_bus(unsigned long pa) | ||
1672 | { | ||
1673 | struct pci_controller *hose; | ||
1674 | int i; | ||
1675 | |||
1676 | for (hose = hose_head; hose; hose = hose->next) { | ||
1677 | for (i = 0; i < 3; ++i) { | ||
1678 | if (pa >= hose->mem_resources[i].start | ||
1679 | && pa <= hose->mem_resources[i].end) { | ||
1680 | /* | ||
1681 | * XXX the hose->pci_mem_offset really | ||
1682 | * only applies to mem_resources[0]. | ||
1683 | * We need a way to store an offset for | ||
1684 | * the others. -- paulus | ||
1685 | */ | ||
1686 | if (i == 0) | ||
1687 | pa -= hose->pci_mem_offset; | ||
1688 | return pa; | ||
1689 | } | ||
1690 | } | ||
1691 | } | ||
1692 | /* hmmm, didn't find it */ | ||
1693 | return 0; | ||
1694 | } | ||
1695 | |||
1696 | unsigned long | ||
1697 | pci_phys_to_bus(unsigned long pa, int busnr) | ||
1698 | { | ||
1699 | struct pci_controller* hose = pci_bus_to_hose(busnr); | ||
1700 | if (!hose) | ||
1701 | return pa; | ||
1702 | return pa - hose->pci_mem_offset; | ||
1703 | } | ||
1704 | |||
1705 | unsigned long | ||
1706 | pci_bus_to_phys(unsigned int ba, int busnr) | ||
1707 | { | ||
1708 | struct pci_controller* hose = pci_bus_to_hose(busnr); | ||
1709 | if (!hose) | ||
1710 | return ba; | ||
1711 | return ba + hose->pci_mem_offset; | ||
1712 | } | ||
1713 | |||
1714 | /* Provide information on locations of various I/O regions in physical | ||
1715 | * memory. Do this on a per-card basis so that we choose the right | ||
1716 | * root bridge. | ||
1717 | * Note that the returned IO or memory base is a physical address | ||
1718 | */ | ||
1719 | |||
1720 | long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | ||
1721 | { | ||
1722 | struct pci_controller* hose; | ||
1723 | long result = -EOPNOTSUPP; | ||
1724 | |||
1725 | /* Argh ! Please forgive me for that hack, but that's the | ||
1726 | * simplest way to get existing XFree to not lockup on some | ||
1727 | * G5 machines... So when something asks for bus 0 io base | ||
1728 | * (bus 0 is HT root), we return the AGP one instead. | ||
1729 | */ | ||
1730 | #ifdef CONFIG_PPC_PMAC | ||
1731 | if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4")) | ||
1732 | if (bus == 0) | ||
1733 | bus = 0xf0; | ||
1734 | #endif /* CONFIG_PPC_PMAC */ | ||
1735 | |||
1736 | hose = pci_bus_to_hose(bus); | ||
1737 | if (!hose) | ||
1738 | return -ENODEV; | ||
1739 | |||
1740 | switch (which) { | ||
1741 | case IOBASE_BRIDGE_NUMBER: | ||
1742 | return (long)hose->first_busno; | ||
1743 | case IOBASE_MEMORY: | ||
1744 | return (long)hose->pci_mem_offset; | ||
1745 | case IOBASE_IO: | ||
1746 | return (long)hose->io_base_phys; | ||
1747 | case IOBASE_ISA_IO: | ||
1748 | return (long)isa_io_base; | ||
1749 | case IOBASE_ISA_MEM: | ||
1750 | return (long)isa_mem_base; | ||
1751 | } | ||
1752 | |||
1753 | return result; | ||
1754 | } | ||
1755 | |||
1756 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
1757 | const struct resource *rsrc, | ||
1758 | u64 *start, u64 *end) | ||
1759 | { | ||
1760 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | ||
1761 | unsigned long offset = 0; | ||
1762 | |||
1763 | if (hose == NULL) | ||
1764 | return; | ||
1765 | |||
1766 | if (rsrc->flags & IORESOURCE_IO) | ||
1767 | offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; | ||
1768 | |||
1769 | *start = rsrc->start + offset; | ||
1770 | *end = rsrc->end + offset; | ||
1771 | } | ||
1772 | |||
1773 | void __init | ||
1774 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | ||
1775 | int flags, char *name) | ||
1776 | { | ||
1777 | res->start = start; | ||
1778 | res->end = end; | ||
1779 | res->flags = flags; | ||
1780 | res->name = name; | ||
1781 | res->parent = NULL; | ||
1782 | res->sibling = NULL; | ||
1783 | res->child = NULL; | ||
1784 | } | ||
1785 | |||
1786 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
1787 | { | ||
1788 | unsigned long start = pci_resource_start(dev, bar); | ||
1789 | unsigned long len = pci_resource_len(dev, bar); | ||
1790 | unsigned long flags = pci_resource_flags(dev, bar); | ||
1791 | |||
1792 | if (!len) | ||
1793 | return NULL; | ||
1794 | if (max && len > max) | ||
1795 | len = max; | ||
1796 | if (flags & IORESOURCE_IO) | ||
1797 | return ioport_map(start, len); | ||
1798 | if (flags & IORESOURCE_MEM) | ||
1799 | /* Not checking IORESOURCE_CACHEABLE because PPC does | ||
1800 | * not currently distinguish between ioremap and | ||
1801 | * ioremap_nocache. | ||
1802 | */ | ||
1803 | return ioremap(start, len); | ||
1804 | /* What? */ | ||
1805 | return NULL; | ||
1806 | } | ||
1807 | |||
1808 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | ||
1809 | { | ||
1810 | /* Nothing to do */ | ||
1811 | } | ||
1812 | EXPORT_SYMBOL(pci_iomap); | ||
1813 | EXPORT_SYMBOL(pci_iounmap); | ||
1814 | |||
1815 | unsigned long pci_address_to_pio(phys_addr_t address) | ||
1816 | { | ||
1817 | struct pci_controller* hose = hose_head; | ||
1818 | |||
1819 | for (; hose; hose = hose->next) { | ||
1820 | unsigned int size = hose->io_resource.end - | ||
1821 | hose->io_resource.start + 1; | ||
1822 | if (address >= hose->io_base_phys && | ||
1823 | address < (hose->io_base_phys + size)) { | ||
1824 | unsigned long base = | ||
1825 | (unsigned long)hose->io_base_virt - _IO_BASE; | ||
1826 | return base + (address - hose->io_base_phys); | ||
1827 | } | ||
1828 | } | ||
1829 | return (unsigned int)-1; | ||
1830 | } | ||
1831 | EXPORT_SYMBOL(pci_address_to_pio); | ||
1832 | |||
1833 | /* | ||
1834 | * Null PCI config access functions, for the case when we can't | ||
1835 | * find a hose. | ||
1836 | */ | ||
1837 | #define NULL_PCI_OP(rw, size, type) \ | ||
1838 | static int \ | ||
1839 | null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \ | ||
1840 | { \ | ||
1841 | return PCIBIOS_DEVICE_NOT_FOUND; \ | ||
1842 | } | ||
1843 | |||
1844 | static int | ||
1845 | null_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
1846 | int len, u32 *val) | ||
1847 | { | ||
1848 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
1849 | } | ||
1850 | |||
1851 | static int | ||
1852 | null_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
1853 | int len, u32 val) | ||
1854 | { | ||
1855 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
1856 | } | ||
1857 | |||
1858 | static struct pci_ops null_pci_ops = | ||
1859 | { | ||
1860 | null_read_config, | ||
1861 | null_write_config | ||
1862 | }; | ||
1863 | |||
1864 | /* | ||
1865 | * These functions are used early on before PCI scanning is done | ||
1866 | * and all of the pci_dev and pci_bus structures have been created. | ||
1867 | */ | ||
1868 | static struct pci_bus * | ||
1869 | fake_pci_bus(struct pci_controller *hose, int busnr) | ||
1870 | { | ||
1871 | static struct pci_bus bus; | ||
1872 | |||
1873 | if (hose == 0) { | ||
1874 | hose = pci_bus_to_hose(busnr); | ||
1875 | if (hose == 0) | ||
1876 | printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); | ||
1877 | } | ||
1878 | bus.number = busnr; | ||
1879 | bus.sysdata = hose; | ||
1880 | bus.ops = hose? hose->ops: &null_pci_ops; | ||
1881 | return &bus; | ||
1882 | } | ||
1883 | |||
1884 | #define EARLY_PCI_OP(rw, size, type) \ | ||
1885 | int early_##rw##_config_##size(struct pci_controller *hose, int bus, \ | ||
1886 | int devfn, int offset, type value) \ | ||
1887 | { \ | ||
1888 | return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \ | ||
1889 | devfn, offset, value); \ | ||
1890 | } | ||
1891 | |||
1892 | EARLY_PCI_OP(read, byte, u8 *) | ||
1893 | EARLY_PCI_OP(read, word, u16 *) | ||
1894 | EARLY_PCI_OP(read, dword, u32 *) | ||
1895 | EARLY_PCI_OP(write, byte, u8) | ||
1896 | EARLY_PCI_OP(write, word, u16) | ||
1897 | EARLY_PCI_OP(write, dword, u32) | ||
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index d963a12ec640..7881ec96ef11 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -605,7 +605,8 @@ static void __init early_cmdline_parse(void) | |||
605 | opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel=")); | 605 | opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel=")); |
606 | if (opt) { | 606 | if (opt) { |
607 | opt += 12; | 607 | opt += 12; |
608 | RELOC(prom_crashk_size) = prom_memparse(opt, &opt); | 608 | RELOC(prom_crashk_size) = |
609 | prom_memparse(opt, (const char **)&opt); | ||
609 | 610 | ||
610 | if (ALIGN(RELOC(prom_crashk_size), 0x1000000) != | 611 | if (ALIGN(RELOC(prom_crashk_size), 0x1000000) != |
611 | RELOC(prom_crashk_size)) { | 612 | RELOC(prom_crashk_size)) { |
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index f40451da037c..7d4099a34f92 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c | |||
@@ -316,7 +316,6 @@ static int __init add_bridge(struct device_node *dev) | |||
316 | char* disp_name; | 316 | char* disp_name; |
317 | int *bus_range; | 317 | int *bus_range; |
318 | int primary = 1; | 318 | int primary = 1; |
319 | struct property *of_prop; | ||
320 | 319 | ||
321 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 320 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
322 | 321 | ||
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index a1cb4d236720..ec5c1e10c407 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
@@ -71,38 +71,60 @@ | |||
71 | #define DBG(fmt...) | 71 | #define DBG(fmt...) |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | static unsigned long maple_find_nvram_base(void) | ||
75 | { | ||
76 | struct device_node *rtcs; | ||
77 | unsigned long result = 0; | ||
78 | |||
79 | /* find NVRAM device */ | ||
80 | rtcs = of_find_compatible_node(NULL, "nvram", "AMD8111"); | ||
81 | if (rtcs) { | ||
82 | struct resource r; | ||
83 | if (of_address_to_resource(rtcs, 0, &r)) { | ||
84 | printk(KERN_EMERG "Maple: Unable to translate NVRAM" | ||
85 | " address\n"); | ||
86 | goto bail; | ||
87 | } | ||
88 | if (!(r.flags & IORESOURCE_IO)) { | ||
89 | printk(KERN_EMERG "Maple: NVRAM address isn't PIO!\n"); | ||
90 | goto bail; | ||
91 | } | ||
92 | result = r.start; | ||
93 | } else | ||
94 | printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); | ||
95 | bail: | ||
96 | of_node_put(rtcs); | ||
97 | return result; | ||
98 | } | ||
99 | |||
74 | static void maple_restart(char *cmd) | 100 | static void maple_restart(char *cmd) |
75 | { | 101 | { |
76 | unsigned int maple_nvram_base; | 102 | unsigned int maple_nvram_base; |
77 | unsigned int maple_nvram_offset; | 103 | unsigned int maple_nvram_offset; |
78 | unsigned int maple_nvram_command; | 104 | unsigned int maple_nvram_command; |
79 | struct device_node *rtcs; | 105 | struct device_node *sp; |
80 | 106 | ||
81 | /* find NVRAM device */ | 107 | maple_nvram_base = maple_find_nvram_base(); |
82 | rtcs = find_compatible_devices("nvram", "AMD8111"); | 108 | if (maple_nvram_base == 0) |
83 | if (rtcs && rtcs->addrs) { | 109 | goto fail; |
84 | maple_nvram_base = rtcs->addrs[0].address; | ||
85 | } else { | ||
86 | printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); | ||
87 | printk(KERN_EMERG "Maple: Manual Restart Required\n"); | ||
88 | return; | ||
89 | } | ||
90 | 110 | ||
91 | /* find service processor device */ | 111 | /* find service processor device */ |
92 | rtcs = find_devices("service-processor"); | 112 | sp = of_find_node_by_name(NULL, "service-processor"); |
93 | if (!rtcs) { | 113 | if (!sp) { |
94 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 114 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
95 | printk(KERN_EMERG "Maple: Manual Restart Required\n"); | 115 | goto fail; |
96 | return; | ||
97 | } | 116 | } |
98 | maple_nvram_offset = *(unsigned int*) get_property(rtcs, | 117 | maple_nvram_offset = *(unsigned int*) get_property(sp, |
99 | "restart-addr", NULL); | 118 | "restart-addr", NULL); |
100 | maple_nvram_command = *(unsigned int*) get_property(rtcs, | 119 | maple_nvram_command = *(unsigned int*) get_property(sp, |
101 | "restart-value", NULL); | 120 | "restart-value", NULL); |
121 | of_node_put(sp); | ||
102 | 122 | ||
103 | /* send command */ | 123 | /* send command */ |
104 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); | 124 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); |
105 | for (;;) ; | 125 | for (;;) ; |
126 | fail: | ||
127 | printk(KERN_EMERG "Maple: Manual Restart Required\n"); | ||
106 | } | 128 | } |
107 | 129 | ||
108 | static void maple_power_off(void) | 130 | static void maple_power_off(void) |
@@ -110,33 +132,29 @@ static void maple_power_off(void) | |||
110 | unsigned int maple_nvram_base; | 132 | unsigned int maple_nvram_base; |
111 | unsigned int maple_nvram_offset; | 133 | unsigned int maple_nvram_offset; |
112 | unsigned int maple_nvram_command; | 134 | unsigned int maple_nvram_command; |
113 | struct device_node *rtcs; | 135 | struct device_node *sp; |
114 | 136 | ||
115 | /* find NVRAM device */ | 137 | maple_nvram_base = maple_find_nvram_base(); |
116 | rtcs = find_compatible_devices("nvram", "AMD8111"); | 138 | if (maple_nvram_base == 0) |
117 | if (rtcs && rtcs->addrs) { | 139 | goto fail; |
118 | maple_nvram_base = rtcs->addrs[0].address; | ||
119 | } else { | ||
120 | printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); | ||
121 | printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); | ||
122 | return; | ||
123 | } | ||
124 | 140 | ||
125 | /* find service processor device */ | 141 | /* find service processor device */ |
126 | rtcs = find_devices("service-processor"); | 142 | sp = of_find_node_by_name(NULL, "service-processor"); |
127 | if (!rtcs) { | 143 | if (!sp) { |
128 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 144 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
129 | printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); | 145 | goto fail; |
130 | return; | ||
131 | } | 146 | } |
132 | maple_nvram_offset = *(unsigned int*) get_property(rtcs, | 147 | maple_nvram_offset = *(unsigned int*) get_property(sp, |
133 | "power-off-addr", NULL); | 148 | "power-off-addr", NULL); |
134 | maple_nvram_command = *(unsigned int*) get_property(rtcs, | 149 | maple_nvram_command = *(unsigned int*) get_property(sp, |
135 | "power-off-value", NULL); | 150 | "power-off-value", NULL); |
151 | of_node_put(sp); | ||
136 | 152 | ||
137 | /* send command */ | 153 | /* send command */ |
138 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); | 154 | outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); |
139 | for (;;) ; | 155 | for (;;) ; |
156 | fail: | ||
157 | printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); | ||
140 | } | 158 | } |
141 | 159 | ||
142 | static void maple_halt(void) | 160 | static void maple_halt(void) |
@@ -179,9 +197,6 @@ void __init maple_setup_arch(void) | |||
179 | */ | 197 | */ |
180 | static void __init maple_init_early(void) | 198 | static void __init maple_init_early(void) |
181 | { | 199 | { |
182 | unsigned int default_speed; | ||
183 | u64 physport; | ||
184 | |||
185 | DBG(" -> maple_init_early\n"); | 200 | DBG(" -> maple_init_early\n"); |
186 | 201 | ||
187 | /* Initialize hash table, from now on, we can take hash faults | 202 | /* Initialize hash table, from now on, we can take hash faults |
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c index 15846cc938ac..50bc4eb85353 100644 --- a/arch/powerpc/platforms/maple/time.c +++ b/arch/powerpc/platforms/maple/time.c | |||
@@ -168,11 +168,24 @@ unsigned long __init maple_get_boot_time(void) | |||
168 | struct rtc_time tm; | 168 | struct rtc_time tm; |
169 | struct device_node *rtcs; | 169 | struct device_node *rtcs; |
170 | 170 | ||
171 | rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); | 171 | rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00"); |
172 | if (rtcs && rtcs->addrs) { | 172 | if (rtcs) { |
173 | maple_rtc_addr = rtcs->addrs[0].address; | 173 | struct resource r; |
174 | printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr); | 174 | if (of_address_to_resource(rtcs, 0, &r)) { |
175 | } else { | 175 | printk(KERN_EMERG "Maple: Unable to translate RTC" |
176 | " address\n"); | ||
177 | goto bail; | ||
178 | } | ||
179 | if (!(r.flags & IORESOURCE_IO)) { | ||
180 | printk(KERN_EMERG "Maple: RTC address isn't PIO!\n"); | ||
181 | goto bail; | ||
182 | } | ||
183 | maple_rtc_addr = r.start; | ||
184 | printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n", | ||
185 | maple_rtc_addr); | ||
186 | } | ||
187 | bail: | ||
188 | if (maple_rtc_addr == 0) { | ||
176 | maple_rtc_addr = RTC_PORT(0); /* legacy address */ | 189 | maple_rtc_addr = RTC_PORT(0); /* legacy address */ |
177 | printk(KERN_INFO "Maple: No device node for RTC, assuming " | 190 | printk(KERN_INFO "Maple: No device node for RTC, assuming " |
178 | "legacy address (0x%x)\n", maple_rtc_addr); | 191 | "legacy address (0x%x)\n", maple_rtc_addr); |
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index d65810108bc3..11899f06bf06 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -58,11 +58,11 @@ config 6xx | |||
58 | help | 58 | help |
59 | There are four types of PowerPC chips supported. The more common | 59 | There are four types of PowerPC chips supported. The more common |
60 | types (601, 603, 604, 740, 750, 7400), the Motorola embedded | 60 | types (601, 603, 604, 740, 750, 7400), the Motorola embedded |
61 | versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM embedded | 61 | versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM |
62 | versions (403 and 405) and the high end 64 bit Power processors | 62 | embedded versions (403 and 405) and the POWER3 processor. |
63 | (POWER 3, POWER4, and IBM 970 also known as G5) | 63 | (For support for more recent 64-bit processors, set ARCH=powerpc.) |
64 | Unless you are building a kernel for one of the embedded processor | 64 | Unless you are building a kernel for one of the embedded processor |
65 | systems, 64 bit IBM RS/6000 or an Apple G5, choose 6xx. | 65 | systems or a POWER3-based IBM RS/6000, choose 6xx. |
66 | Note that the kernel runs in 32-bit mode even on 64-bit chips. | 66 | Note that the kernel runs in 32-bit mode even on 64-bit chips. |
67 | Also note that because the 52xx, 82xx, & 83xx family has a 603e core, | 67 | Also note that because the 52xx, 82xx, & 83xx family has a 603e core, |
68 | specific support for that chipset is asked later on. | 68 | specific support for that chipset is asked later on. |
@@ -77,10 +77,6 @@ config POWER3 | |||
77 | select PPC_FPU | 77 | select PPC_FPU |
78 | bool "POWER3" | 78 | bool "POWER3" |
79 | 79 | ||
80 | config POWER4 | ||
81 | select PPC_FPU | ||
82 | bool "POWER4 and 970 (G5)" | ||
83 | |||
84 | config 8xx | 80 | config 8xx |
85 | bool "8xx" | 81 | bool "8xx" |
86 | 82 | ||
@@ -123,7 +119,7 @@ config PHYS_64BIT | |||
123 | 119 | ||
124 | config ALTIVEC | 120 | config ALTIVEC |
125 | bool "AltiVec Support" | 121 | bool "AltiVec Support" |
126 | depends on 6xx || POWER4 | 122 | depends on 6xx |
127 | depends on !8260 && !83xx | 123 | depends on !8260 && !83xx |
128 | ---help--- | 124 | ---help--- |
129 | This option enables kernel support for the Altivec extensions to the | 125 | This option enables kernel support for the Altivec extensions to the |
@@ -235,18 +231,9 @@ config KEXEC | |||
235 | 231 | ||
236 | source "drivers/cpufreq/Kconfig" | 232 | source "drivers/cpufreq/Kconfig" |
237 | 233 | ||
238 | config CPU_FREQ_PMAC | ||
239 | bool "Support for Apple PowerBooks" | ||
240 | depends on CPU_FREQ && ADB_PMU | ||
241 | select CPU_FREQ_TABLE | ||
242 | help | ||
243 | This adds support for frequency switching on Apple PowerBooks, | ||
244 | this currently includes some models of iBook & Titanium | ||
245 | PowerBook. | ||
246 | |||
247 | config PPC601_SYNC_FIX | 234 | config PPC601_SYNC_FIX |
248 | bool "Workarounds for PPC601 bugs" | 235 | bool "Workarounds for PPC601 bugs" |
249 | depends on 6xx && (PPC_PREP || PPC_PMAC) | 236 | depends on 6xx && PPC_PREP |
250 | help | 237 | help |
251 | Some versions of the PPC601 (the first PowerPC chip) have bugs which | 238 | Some versions of the PPC601 (the first PowerPC chip) have bugs which |
252 | mean that extra synchronization instructions are required near | 239 | mean that extra synchronization instructions are required near |
@@ -258,26 +245,17 @@ config PPC601_SYNC_FIX | |||
258 | 245 | ||
259 | If in doubt, say Y here. | 246 | If in doubt, say Y here. |
260 | 247 | ||
261 | config HOTPLUG_CPU | ||
262 | bool "Support for enabling/disabling CPUs" | ||
263 | depends on SMP && HOTPLUG && EXPERIMENTAL && PPC_PMAC | ||
264 | ---help--- | ||
265 | Say Y here to be able to disable and re-enable individual | ||
266 | CPUs at runtime on SMP machines. | ||
267 | |||
268 | Say N if you are unsure. | ||
269 | |||
270 | source arch/ppc/platforms/4xx/Kconfig | 248 | source arch/ppc/platforms/4xx/Kconfig |
271 | source arch/ppc/platforms/85xx/Kconfig | 249 | source arch/ppc/platforms/85xx/Kconfig |
272 | 250 | ||
273 | config PPC64BRIDGE | 251 | config PPC64BRIDGE |
274 | bool | 252 | bool |
275 | depends on POWER3 || POWER4 | 253 | depends on POWER3 |
276 | default y | 254 | default y |
277 | 255 | ||
278 | config PPC_STD_MMU | 256 | config PPC_STD_MMU |
279 | bool | 257 | bool |
280 | depends on 6xx || POWER3 || POWER4 | 258 | depends on 6xx || POWER3 |
281 | default y | 259 | default y |
282 | 260 | ||
283 | config NOT_COHERENT_CACHE | 261 | config NOT_COHERENT_CACHE |
@@ -505,7 +483,7 @@ endchoice | |||
505 | 483 | ||
506 | choice | 484 | choice |
507 | prompt "Machine Type" | 485 | prompt "Machine Type" |
508 | depends on 6xx || POWER3 || POWER4 | 486 | depends on 6xx || POWER3 |
509 | default PPC_MULTIPLATFORM | 487 | default PPC_MULTIPLATFORM |
510 | ---help--- | 488 | ---help--- |
511 | Linux currently supports several different kinds of PowerPC-based | 489 | Linux currently supports several different kinds of PowerPC-based |
@@ -516,11 +494,15 @@ choice | |||
516 | Platform) machines (including all of the recent IBM RS/6000 and | 494 | Platform) machines (including all of the recent IBM RS/6000 and |
517 | pSeries machines), and several embedded PowerPC systems containing | 495 | pSeries machines), and several embedded PowerPC systems containing |
518 | 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the | 496 | 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the |
519 | default option is to build a kernel which works on the first three. | 497 | default option is to build a kernel which works on PReP and CHRP. |
520 | 498 | ||
521 | Select CHRP/PowerMac/PReP if configuring for an IBM RS/6000 or | 499 | Note that support for Apple machines is now only available with |
522 | pSeries machine, a Power Macintosh (including iMacs, iBooks and | 500 | ARCH=powerpc, and has been removed from this menu. If you wish |
523 | Powerbooks), or a PReP machine. | 501 | to build a kernel for an Apple machine, exit this configuration |
502 | process and re-run it with ARCH=powerpc. | ||
503 | |||
504 | Select CHRP/PReP if configuring for an IBM RS/6000 or | ||
505 | pSeries machine, or a PReP machine. | ||
524 | 506 | ||
525 | Select Gemini if configuring for a Synergy Microsystems' Gemini | 507 | Select Gemini if configuring for a Synergy Microsystems' Gemini |
526 | series Single Board Computer. More information is available at: | 508 | series Single Board Computer. More information is available at: |
@@ -530,7 +512,7 @@ choice | |||
530 | available at: <http://linux-apus.sourceforge.net/>. | 512 | available at: <http://linux-apus.sourceforge.net/>. |
531 | 513 | ||
532 | config PPC_MULTIPLATFORM | 514 | config PPC_MULTIPLATFORM |
533 | bool "CHRP/PowerMac/PReP" | 515 | bool "CHRP/PReP" |
534 | 516 | ||
535 | config APUS | 517 | config APUS |
536 | bool "Amiga-APUS" | 518 | bool "Amiga-APUS" |
@@ -768,25 +750,14 @@ config CPM2 | |||
768 | on it (826x, 827x, 8560). | 750 | on it (826x, 827x, 8560). |
769 | 751 | ||
770 | config PPC_CHRP | 752 | config PPC_CHRP |
771 | bool | 753 | bool "Support for CHRP (Common Hardware Reference Platform) machines" |
772 | depends on PPC_MULTIPLATFORM | 754 | depends on PPC_MULTIPLATFORM |
773 | select PPC_I8259 | 755 | select PPC_I8259 |
774 | select PPC_INDIRECT_PCI | 756 | select PPC_INDIRECT_PCI |
775 | default y | 757 | default y |
776 | 758 | ||
777 | config PPC_PMAC | ||
778 | bool | ||
779 | depends on PPC_MULTIPLATFORM | ||
780 | select PPC_INDIRECT_PCI | ||
781 | default y | ||
782 | |||
783 | config PPC_PMAC64 | ||
784 | bool | ||
785 | depends on PPC_PMAC && POWER4 | ||
786 | default y | ||
787 | |||
788 | config PPC_PREP | 759 | config PPC_PREP |
789 | bool | 760 | bool "Support for PReP (PowerPC Reference Platform) machines" |
790 | depends on PPC_MULTIPLATFORM | 761 | depends on PPC_MULTIPLATFORM |
791 | select PPC_I8259 | 762 | select PPC_I8259 |
792 | select PPC_INDIRECT_PCI | 763 | select PPC_INDIRECT_PCI |
@@ -794,7 +765,7 @@ config PPC_PREP | |||
794 | 765 | ||
795 | config PPC_OF | 766 | config PPC_OF |
796 | bool | 767 | bool |
797 | depends on PPC_PMAC || PPC_CHRP | 768 | depends on PPC_CHRP |
798 | default y | 769 | default y |
799 | 770 | ||
800 | config PPC_GEN550 | 771 | config PPC_GEN550 |
@@ -1166,7 +1137,7 @@ config ISA | |||
1166 | 1137 | ||
1167 | config GENERIC_ISA_DMA | 1138 | config GENERIC_ISA_DMA |
1168 | bool | 1139 | bool |
1169 | depends on POWER3 || POWER4 || 6xx && !CPM2 | 1140 | depends on POWER3 || 6xx && !CPM2 |
1170 | default y | 1141 | default y |
1171 | 1142 | ||
1172 | config PPC_I8259 | 1143 | config PPC_I8259 |
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile index 995f89bb049c..efd8ce515d5f 100644 --- a/arch/ppc/boot/Makefile +++ b/arch/ppc/boot/Makefile | |||
@@ -18,7 +18,7 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd | |||
18 | bootdir-y := simple | 18 | bootdir-y := simple |
19 | bootdir-$(CONFIG_PPC_OF) += openfirmware | 19 | bootdir-$(CONFIG_PPC_OF) += openfirmware |
20 | subdir-y := lib common images | 20 | subdir-y := lib common images |
21 | subdir-$(CONFIG_PPC_OF) += of1275 | 21 | subdir-$(CONFIG_PPC_MULTIPLATFORM) += of1275 |
22 | 22 | ||
23 | # for cleaning | 23 | # for cleaning |
24 | subdir- += simple openfirmware | 24 | subdir- += simple openfirmware |
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile index 83a6433459ce..2a411ec2e650 100644 --- a/arch/ppc/boot/openfirmware/Makefile +++ b/arch/ppc/boot/openfirmware/Makefile | |||
@@ -21,26 +21,16 @@ bootlib := $(boot)/lib | |||
21 | of1275 := $(boot)/of1275 | 21 | of1275 := $(boot)/of1275 |
22 | images := $(boot)/images | 22 | images := $(boot)/images |
23 | 23 | ||
24 | OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | ||
25 | COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \ | ||
26 | -Bstatic | ||
27 | CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000 | 24 | CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000 |
28 | NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000 | ||
29 | 25 | ||
30 | COMMONOBJS := start.o misc.o common.o | 26 | COMMONOBJS := start.o misc.o common.o |
31 | COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o | ||
32 | CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o | 27 | CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o |
33 | NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o | ||
34 | 28 | ||
35 | targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o | 29 | targets := $(CHRPOBJS) dummy.o |
36 | COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS)) | ||
37 | CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS)) | 30 | CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS)) |
38 | NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS)) | ||
39 | 31 | ||
40 | LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a | 32 | LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a |
41 | 33 | ||
42 | HACKCOFF := $(utils)/hack-coff | ||
43 | |||
44 | ifdef CONFIG_SMP | 34 | ifdef CONFIG_SMP |
45 | END := .smp | 35 | END := .smp |
46 | endif | 36 | endif |
@@ -72,56 +62,11 @@ targets += image.initrd.o | |||
72 | $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE | 62 | $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE |
73 | $(call if_changed,genimage-initrd) | 63 | $(call if_changed,genimage-initrd) |
74 | 64 | ||
75 | # Create the note section for New-World PowerMacs. | ||
76 | quiet_cmd_mknote = MKNOTE $@ | ||
77 | cmd_mknote = $(utils)/mknote > $@ | ||
78 | targets += note | ||
79 | $(obj)/note: $(utils)/mknote FORCE | ||
80 | $(call if_changed,mknote) | ||
81 | |||
82 | 65 | ||
83 | $(obj)/coffcrt0.o: EXTRA_AFLAGS := -DXCOFF | 66 | targets += crt0.o |
84 | targets += coffcrt0.o crt0.o | 67 | $(obj)/crt0.o: $(common)/crt0.S FORCE |
85 | $(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE | ||
86 | $(call if_changed_dep,as_o_S) | 68 | $(call if_changed_dep,as_o_S) |
87 | 69 | ||
88 | quiet_cmd_gencoffb = COFF $@ | ||
89 | cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \ | ||
90 | $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) | ||
91 | targets += coffboot | ||
92 | $(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE | ||
93 | $(call if_changed,gencoffb) | ||
94 | targets += coffboot.initrd | ||
95 | $(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \ | ||
96 | $(srctree)/$(boot)/ld.script FORCE | ||
97 | $(call if_changed,gencoffb) | ||
98 | |||
99 | |||
100 | quiet_cmd_gen-coff = COFF $@ | ||
101 | cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \ | ||
102 | $(HACKCOFF) $@ && \ | ||
103 | ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac | ||
104 | |||
105 | $(images)/vmlinux.coff: $(obj)/coffboot | ||
106 | $(call cmd,gen-coff) | ||
107 | |||
108 | $(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd | ||
109 | $(call cmd,gen-coff) | ||
110 | |||
111 | quiet_cmd_gen-elf-pmac = ELF $@ | ||
112 | cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \ | ||
113 | $(NEWWORLDOBJS) $(LIBS) $< && \ | ||
114 | $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \ | ||
115 | -R .comment $(del-ramdisk-sec) | ||
116 | |||
117 | $(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \ | ||
118 | $(obj)/note $(srctree)/$(boot)/ld.script | ||
119 | $(call cmd,gen-elf-pmac) | ||
120 | $(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \ | ||
121 | $(LIBS) $(obj)/note \ | ||
122 | $(srctree)/$(boot)/ld.script | ||
123 | $(call cmd,gen-elf-pmac) | ||
124 | |||
125 | quiet_cmd_gen-chrp = CHRP $@ | 70 | quiet_cmd_gen-chrp = CHRP $@ |
126 | cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \ | 71 | cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \ |
127 | $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) | 72 | $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) |
@@ -139,46 +84,23 @@ $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \ | |||
139 | %-rs6k: % | 84 | %-rs6k: % |
140 | $(call cmd,addnote) | 85 | $(call cmd,addnote) |
141 | 86 | ||
142 | quiet_cmd_gen-miboot = GEN $@ | ||
143 | cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \ | ||
144 | --add-section=$1=$(word 2, $^) $< $@ | ||
145 | $(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz | ||
146 | $(call cmd,gen-miboot,image) | ||
147 | |||
148 | $(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz | ||
149 | $(call cmd,gen-miboot,initrd) | ||
150 | |||
151 | # The targets used on the make command-line | 87 | # The targets used on the make command-line |
152 | 88 | ||
153 | .PHONY: zImage zImage.initrd | 89 | .PHONY: zImage zImage.initrd |
154 | zImage: $(images)/vmlinux.coff \ | 90 | zImage: $(images)/zImage.chrp \ |
155 | $(images)/vmlinux.elf-pmac \ | 91 | $(images)/zImage.chrp-rs6k |
156 | $(images)/zImage.chrp \ | ||
157 | $(images)/zImage.chrp-rs6k \ | ||
158 | $(images)/miboot.image | ||
159 | @echo ' kernel: $@ is ready ($<)' | 92 | @echo ' kernel: $@ is ready ($<)' |
160 | zImage.initrd: $(images)/vmlinux.initrd.coff \ | 93 | zImage.initrd: $(images)/zImage.initrd.chrp \ |
161 | $(images)/vmlinux.initrd.elf-pmac \ | 94 | $(images)/zImage.initrd.chrp-rs6k |
162 | $(images)/zImage.initrd.chrp \ | ||
163 | $(images)/zImage.initrd.chrp-rs6k \ | ||
164 | $(images)/miboot.initrd.image | ||
165 | @echo ' kernel: $@ is ready ($<)' | 95 | @echo ' kernel: $@ is ready ($<)' |
166 | 96 | ||
167 | TFTPIMAGE := /tftpboot/zImage | 97 | TFTPIMAGE := /tftpboot/zImage |
168 | 98 | ||
169 | .PHONY: znetboot znetboot.initrd | 99 | .PHONY: znetboot znetboot.initrd |
170 | znetboot: $(images)/vmlinux.coff \ | 100 | znetboot: $(images)/zImage.chrp |
171 | $(images)/vmlinux.elf-pmac \ | ||
172 | $(images)/zImage.chrp | ||
173 | cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END) | ||
174 | cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf | ||
175 | cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) | 101 | cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) |
176 | @echo ' kernel: $@ is ready ($<)' | 102 | @echo ' kernel: $@ is ready ($<)' |
177 | znetboot.initrd:$(images)/vmlinux.initrd.coff \ | 103 | znetboot.initrd:$(images)/zImage.initrd.chrp |
178 | $(images)/vmlinux.initrd.elf-pmac \ | ||
179 | $(images)/zImage.initrd.chrp | ||
180 | cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END) | ||
181 | cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf | ||
182 | cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END) | 104 | cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END) |
183 | @echo ' kernel: $@ is ready ($<)' | 105 | @echo ' kernel: $@ is ready ($<)' |
184 | 106 | ||
diff --git a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c deleted file mode 100644 index 2da8855e2be0..000000000000 --- a/arch/ppc/boot/openfirmware/coffmain.c +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #include <linux/string.h> | ||
10 | #include <asm/processor.h> | ||
11 | #include <asm/page.h> | ||
12 | |||
13 | #include "nonstdio.h" | ||
14 | #include "of1275.h" | ||
15 | |||
16 | /* Passed from the linker */ | ||
17 | extern char __image_begin, __image_end; | ||
18 | extern char __ramdisk_begin[], __ramdisk_end; | ||
19 | extern char _start, _end; | ||
20 | |||
21 | extern char image_data[], initrd_data[]; | ||
22 | extern int initrd_len, image_len; | ||
23 | extern unsigned int heap_max; | ||
24 | extern void flush_cache(void *start, unsigned int len); | ||
25 | extern void gunzip(void *, int, unsigned char *, int *); | ||
26 | extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach, | ||
27 | unsigned int progend); | ||
28 | extern void setup_bats(unsigned long start); | ||
29 | |||
30 | char *avail_ram; | ||
31 | char *begin_avail, *end_avail; | ||
32 | char *avail_high; | ||
33 | |||
34 | #define SCRATCH_SIZE (128 << 10) | ||
35 | |||
36 | static char heap[SCRATCH_SIZE]; | ||
37 | |||
38 | static unsigned long ram_start = 0; | ||
39 | static unsigned long ram_end = 0x1000000; | ||
40 | |||
41 | static unsigned long prog_start = 0x800000; | ||
42 | static unsigned long prog_size = 0x700000; | ||
43 | |||
44 | typedef void (*kernel_start_t)(int, int, void *); | ||
45 | |||
46 | void boot(int a1, int a2, void *prom) | ||
47 | { | ||
48 | unsigned sa, len; | ||
49 | void *dst; | ||
50 | unsigned char *im; | ||
51 | unsigned initrd_start, initrd_size; | ||
52 | |||
53 | printf("coffboot starting: loaded at 0x%p\n", &_start); | ||
54 | setup_bats(ram_start); | ||
55 | |||
56 | initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin); | ||
57 | if (initrd_size) { | ||
58 | initrd_start = (ram_end - initrd_size) & ~0xFFF; | ||
59 | a1 = initrd_start; | ||
60 | a2 = initrd_size; | ||
61 | claim(initrd_start, ram_end - initrd_start, 0); | ||
62 | printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r", | ||
63 | initrd_start, (char *)(&__ramdisk_begin), initrd_size); | ||
64 | memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size); | ||
65 | prog_size = initrd_start - prog_start; | ||
66 | } else | ||
67 | a2 = 0xdeadbeef; | ||
68 | |||
69 | im = (char *)(&__image_begin); | ||
70 | len = (char *)(&__image_end) - (char *)(&__image_begin); | ||
71 | /* claim 4MB starting at PROG_START */ | ||
72 | claim(prog_start, prog_size, 0); | ||
73 | map(prog_start, prog_start, prog_size); | ||
74 | dst = (void *) prog_start; | ||
75 | if (im[0] == 0x1f && im[1] == 0x8b) { | ||
76 | /* set up scratch space */ | ||
77 | begin_avail = avail_high = avail_ram = heap; | ||
78 | end_avail = heap + sizeof(heap); | ||
79 | printf("heap at 0x%p\n", avail_ram); | ||
80 | printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len); | ||
81 | gunzip(dst, prog_size, im, &len); | ||
82 | printf("done %u bytes\n", len); | ||
83 | printf("%u bytes of heap consumed, max in use %u\n", | ||
84 | avail_high - begin_avail, heap_max); | ||
85 | } else { | ||
86 | memmove(dst, im, len); | ||
87 | } | ||
88 | |||
89 | flush_cache(dst, len); | ||
90 | make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac, | ||
91 | (prog_start + prog_size)); | ||
92 | |||
93 | sa = (unsigned long)prog_start; | ||
94 | printf("start address = 0x%x\n", sa); | ||
95 | |||
96 | (*(kernel_start_t)sa)(a1, a2, prom); | ||
97 | |||
98 | printf("returned?\n"); | ||
99 | |||
100 | pause(); | ||
101 | } | ||
diff --git a/arch/ppc/boot/openfirmware/newworldmain.c b/arch/ppc/boot/openfirmware/newworldmain.c deleted file mode 100644 index fa8a8f9313f9..000000000000 --- a/arch/ppc/boot/openfirmware/newworldmain.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #include <linux/string.h> | ||
10 | #include "nonstdio.h" | ||
11 | #include "of1275.h" | ||
12 | #include <asm/processor.h> | ||
13 | #include <asm/page.h> | ||
14 | |||
15 | /* Passed from the linker */ | ||
16 | extern char __image_begin, __image_end; | ||
17 | extern char __ramdisk_begin[], __ramdisk_end; | ||
18 | extern char _start, _end; | ||
19 | |||
20 | extern unsigned int heap_max; | ||
21 | extern void flush_cache(void *start, unsigned int len); | ||
22 | extern void gunzip(void *, int, unsigned char *, int *); | ||
23 | extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach, | ||
24 | unsigned int progend); | ||
25 | |||
26 | char *avail_ram; | ||
27 | char *begin_avail, *end_avail; | ||
28 | char *avail_high; | ||
29 | |||
30 | |||
31 | #define RAM_END (16 << 20) | ||
32 | |||
33 | #define PROG_START 0x00010000 | ||
34 | #define PROG_SIZE 0x007f0000 | ||
35 | |||
36 | #define SCRATCH_SIZE (128 << 10) | ||
37 | |||
38 | typedef void (*kernel_start_t)(int, int, void *); | ||
39 | |||
40 | void boot(int a1, int a2, void *prom) | ||
41 | { | ||
42 | unsigned sa, len; | ||
43 | void *dst; | ||
44 | unsigned char *im; | ||
45 | unsigned initrd_start, initrd_size; | ||
46 | |||
47 | printf("chrpboot starting: loaded at 0x%p\n", &_start); | ||
48 | |||
49 | initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin); | ||
50 | if (initrd_size) { | ||
51 | initrd_start = (RAM_END - initrd_size) & ~0xFFF; | ||
52 | a1 = initrd_start; | ||
53 | a2 = initrd_size; | ||
54 | claim(initrd_start, RAM_END - initrd_start, 0); | ||
55 | printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r", | ||
56 | initrd_start, (char *)(&__ramdisk_begin), initrd_size); | ||
57 | memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size); | ||
58 | } else | ||
59 | a2 = 0xdeadbeef; | ||
60 | |||
61 | im = (char *)(&__image_begin); | ||
62 | len = (char *)(&__image_end) - (char *)(&__image_begin); | ||
63 | /* claim 3MB starting at PROG_START */ | ||
64 | claim(PROG_START, PROG_SIZE, 0); | ||
65 | dst = (void *) PROG_START; | ||
66 | if (im[0] == 0x1f && im[1] == 0x8b) { | ||
67 | /* claim some memory for scratch space */ | ||
68 | avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10); | ||
69 | begin_avail = avail_high = avail_ram; | ||
70 | end_avail = avail_ram + SCRATCH_SIZE; | ||
71 | printf("heap at 0x%p\n", avail_ram); | ||
72 | printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len); | ||
73 | gunzip(dst, PROG_SIZE, im, &len); | ||
74 | printf("done %u bytes\n", len); | ||
75 | printf("%u bytes of heap consumed, max in use %u\n", | ||
76 | avail_high - begin_avail, heap_max); | ||
77 | release(begin_avail, SCRATCH_SIZE); | ||
78 | } else { | ||
79 | memmove(dst, im, len); | ||
80 | } | ||
81 | |||
82 | flush_cache(dst, len); | ||
83 | make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_Pmac, | ||
84 | (PROG_START + PROG_SIZE)); | ||
85 | |||
86 | sa = (unsigned long)PROG_START; | ||
87 | printf("start address = 0x%x\n", sa); | ||
88 | |||
89 | (*(kernel_start_t)sa)(a1, a2, prom); | ||
90 | |||
91 | printf("returned?\n"); | ||
92 | |||
93 | pause(); | ||
94 | } | ||
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile index ca0201300868..e399bbb969a4 100644 --- a/arch/ppc/kernel/Makefile +++ b/arch/ppc/kernel/Makefile | |||
@@ -9,7 +9,6 @@ extra-$(CONFIG_44x) := head_44x.o | |||
9 | extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o | 9 | extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o |
10 | extra-$(CONFIG_8xx) := head_8xx.o | 10 | extra-$(CONFIG_8xx) := head_8xx.o |
11 | extra-$(CONFIG_6xx) += idle_6xx.o | 11 | extra-$(CONFIG_6xx) += idle_6xx.o |
12 | extra-$(CONFIG_POWER4) += idle_power4.o | ||
13 | extra-y += vmlinux.lds | 12 | extra-y += vmlinux.lds |
14 | 13 | ||
15 | obj-y := entry.o traps.o idle.o time.o misc.o \ | 14 | obj-y := entry.o traps.o idle.o time.o misc.o \ |
@@ -17,7 +16,6 @@ obj-y := entry.o traps.o idle.o time.o misc.o \ | |||
17 | ppc_htab.o | 16 | ppc_htab.o |
18 | obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o | 17 | obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o |
19 | obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o | 18 | obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o |
20 | obj-$(CONFIG_POWER4) += cpu_setup_power4.o | ||
21 | obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o | 19 | obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o |
22 | obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o | 20 | obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o |
23 | obj-$(CONFIG_PCI) += pci.o | 21 | obj-$(CONFIG_PCI) += pci.o |
@@ -42,7 +40,6 @@ obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o | |||
42 | obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o | 40 | obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o |
43 | obj-$(CONFIG_MODULES) += module.o | 41 | obj-$(CONFIG_MODULES) += module.o |
44 | obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o | 42 | obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o |
45 | obj-$(CONFIG_PCI) += pci.o | ||
46 | obj-$(CONFIG_KGDB) += ppc-stub.o | 43 | obj-$(CONFIG_KGDB) += ppc-stub.o |
47 | obj-$(CONFIG_TAU) += temp.o | 44 | obj-$(CONFIG_TAU) += temp.o |
48 | ifndef CONFIG_E200 | 45 | ifndef CONFIG_E200 |
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S index fb5658bba285..c3427eed8345 100644 --- a/arch/ppc/kernel/misc.S +++ b/arch/ppc/kernel/misc.S | |||
@@ -204,78 +204,6 @@ _GLOBAL(call_setup_cpu) | |||
204 | mtctr r5 | 204 | mtctr r5 |
205 | bctr | 205 | bctr |
206 | 206 | ||
207 | #if defined(CONFIG_CPU_FREQ_PMAC) && defined(CONFIG_6xx) | ||
208 | |||
209 | /* This gets called by via-pmu.c to switch the PLL selection | ||
210 | * on 750fx CPU. This function should really be moved to some | ||
211 | * other place (as most of the cpufreq code in via-pmu | ||
212 | */ | ||
213 | _GLOBAL(low_choose_750fx_pll) | ||
214 | /* Clear MSR:EE */ | ||
215 | mfmsr r7 | ||
216 | rlwinm r0,r7,0,17,15 | ||
217 | mtmsr r0 | ||
218 | |||
219 | /* If switching to PLL1, disable HID0:BTIC */ | ||
220 | cmplwi cr0,r3,0 | ||
221 | beq 1f | ||
222 | mfspr r5,SPRN_HID0 | ||
223 | rlwinm r5,r5,0,27,25 | ||
224 | sync | ||
225 | mtspr SPRN_HID0,r5 | ||
226 | isync | ||
227 | sync | ||
228 | |||
229 | 1: | ||
230 | /* Calc new HID1 value */ | ||
231 | mfspr r4,SPRN_HID1 /* Build a HID1:PS bit from parameter */ | ||
232 | rlwinm r5,r3,16,15,15 /* Clear out HID1:PS from value read */ | ||
233 | rlwinm r4,r4,0,16,14 /* Could have I used rlwimi here ? */ | ||
234 | or r4,r4,r5 | ||
235 | mtspr SPRN_HID1,r4 | ||
236 | |||
237 | /* Store new HID1 image */ | ||
238 | rlwinm r6,r1,0,0,18 | ||
239 | lwz r6,TI_CPU(r6) | ||
240 | slwi r6,r6,2 | ||
241 | addis r6,r6,nap_save_hid1@ha | ||
242 | stw r4,nap_save_hid1@l(r6) | ||
243 | |||
244 | /* If switching to PLL0, enable HID0:BTIC */ | ||
245 | cmplwi cr0,r3,0 | ||
246 | bne 1f | ||
247 | mfspr r5,SPRN_HID0 | ||
248 | ori r5,r5,HID0_BTIC | ||
249 | sync | ||
250 | mtspr SPRN_HID0,r5 | ||
251 | isync | ||
252 | sync | ||
253 | |||
254 | 1: | ||
255 | /* Return */ | ||
256 | mtmsr r7 | ||
257 | blr | ||
258 | |||
259 | _GLOBAL(low_choose_7447a_dfs) | ||
260 | /* Clear MSR:EE */ | ||
261 | mfmsr r7 | ||
262 | rlwinm r0,r7,0,17,15 | ||
263 | mtmsr r0 | ||
264 | |||
265 | /* Calc new HID1 value */ | ||
266 | mfspr r4,SPRN_HID1 | ||
267 | insrwi r4,r3,1,9 /* insert parameter into bit 9 */ | ||
268 | sync | ||
269 | mtspr SPRN_HID1,r4 | ||
270 | sync | ||
271 | isync | ||
272 | |||
273 | /* Return */ | ||
274 | mtmsr r7 | ||
275 | blr | ||
276 | |||
277 | #endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_6xx */ | ||
278 | |||
279 | /* | 207 | /* |
280 | * complement mask on the msr then "or" some values on. | 208 | * complement mask on the msr then "or" some values on. |
281 | * _nmask_and_or_msr(nmask, value_to_or) | 209 | * _nmask_and_or_msr(nmask, value_to_or) |
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 704c846b2b0f..04d04c5bfdd0 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Common pmac/prep/chrp pci routines. -- Cort | 2 | * Common prep/chrp pci routines. -- Cort |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | 5 | #include <linux/config.h> |
@@ -50,8 +50,7 @@ static void fixup_cpc710_pci64(struct pci_dev* dev); | |||
50 | static u8* pci_to_OF_bus_map; | 50 | static u8* pci_to_OF_bus_map; |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | /* By default, we don't re-assign bus numbers. We do this only on | 53 | /* By default, we don't re-assign bus numbers. |
54 | * some pmacs | ||
55 | */ | 54 | */ |
56 | int pci_assign_all_buses; | 55 | int pci_assign_all_buses; |
57 | 56 | ||
@@ -780,17 +779,6 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn) | |||
780 | return NULL; | 779 | return NULL; |
781 | 780 | ||
782 | /* Fixup bus number according to what OF think it is. */ | 781 | /* Fixup bus number according to what OF think it is. */ |
783 | #ifdef CONFIG_PPC_PMAC | ||
784 | /* The G5 need a special case here. Basically, we don't remap all | ||
785 | * busses on it so we don't create the pci-OF-map. However, we do | ||
786 | * remap the AGP bus and so have to deal with it. A future better | ||
787 | * fix has to be done by making the remapping per-host and always | ||
788 | * filling the pci_to_OF map. --BenH | ||
789 | */ | ||
790 | if (_machine == _MACH_Pmac && busnr >= 0xf0) | ||
791 | busnr -= 0xf0; | ||
792 | else | ||
793 | #endif | ||
794 | if (pci_to_OF_bus_map) | 782 | if (pci_to_OF_bus_map) |
795 | busnr = pci_to_OF_bus_map[busnr]; | 783 | busnr = pci_to_OF_bus_map[busnr]; |
796 | if (busnr == 0xff) | 784 | if (busnr == 0xff) |
@@ -1040,216 +1028,6 @@ void pcibios_add_platform_entries(struct pci_dev *pdev) | |||
1040 | } | 1028 | } |
1041 | 1029 | ||
1042 | 1030 | ||
1043 | #ifdef CONFIG_PPC_PMAC | ||
1044 | /* | ||
1045 | * This set of routines checks for PCI<->PCI bridges that have closed | ||
1046 | * IO resources and have child devices. It tries to re-open an IO | ||
1047 | * window on them. | ||
1048 | * | ||
1049 | * This is a _temporary_ fix to workaround a problem with Apple's OF | ||
1050 | * closing IO windows on P2P bridges when the OF drivers of cards | ||
1051 | * below this bridge don't claim any IO range (typically ATI or | ||
1052 | * Adaptec). | ||
1053 | * | ||
1054 | * A more complete fix would be to use drivers/pci/setup-bus.c, which | ||
1055 | * involves a working pcibios_fixup_pbus_ranges(), some more care about | ||
1056 | * ordering when creating the host bus resources, and maybe a few more | ||
1057 | * minor tweaks | ||
1058 | */ | ||
1059 | |||
1060 | /* Initialize bridges with base/limit values we have collected */ | ||
1061 | static void __init | ||
1062 | do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga) | ||
1063 | { | ||
1064 | struct pci_dev *bridge = bus->self; | ||
1065 | struct pci_controller* hose = (struct pci_controller *)bridge->sysdata; | ||
1066 | u32 l; | ||
1067 | u16 w; | ||
1068 | struct resource res; | ||
1069 | |||
1070 | if (bus->resource[0] == NULL) | ||
1071 | return; | ||
1072 | res = *(bus->resource[0]); | ||
1073 | |||
1074 | DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge)); | ||
1075 | res.start -= ((unsigned long) hose->io_base_virt - isa_io_base); | ||
1076 | res.end -= ((unsigned long) hose->io_base_virt - isa_io_base); | ||
1077 | DBG(" IO window: %08lx-%08lx\n", res.start, res.end); | ||
1078 | |||
1079 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | ||
1080 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); | ||
1081 | l &= 0xffff000f; | ||
1082 | l |= (res.start >> 8) & 0x00f0; | ||
1083 | l |= res.end & 0xf000; | ||
1084 | pci_write_config_dword(bridge, PCI_IO_BASE, l); | ||
1085 | |||
1086 | if ((l & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { | ||
1087 | l = (res.start >> 16) | (res.end & 0xffff0000); | ||
1088 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l); | ||
1089 | } | ||
1090 | |||
1091 | pci_read_config_word(bridge, PCI_COMMAND, &w); | ||
1092 | w |= PCI_COMMAND_IO; | ||
1093 | pci_write_config_word(bridge, PCI_COMMAND, w); | ||
1094 | |||
1095 | #if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */ | ||
1096 | if (enable_vga) { | ||
1097 | pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &w); | ||
1098 | w |= PCI_BRIDGE_CTL_VGA; | ||
1099 | pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w); | ||
1100 | } | ||
1101 | #endif | ||
1102 | } | ||
1103 | |||
1104 | /* This function is pretty basic and actually quite broken for the | ||
1105 | * general case, it's enough for us right now though. It's supposed | ||
1106 | * to tell us if we need to open an IO range at all or not and what | ||
1107 | * size. | ||
1108 | */ | ||
1109 | static int __init | ||
1110 | check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga) | ||
1111 | { | ||
1112 | struct pci_dev *dev; | ||
1113 | int i; | ||
1114 | int rc = 0; | ||
1115 | |||
1116 | #define push_end(res, size) do { unsigned long __sz = (size) ; \ | ||
1117 | res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \ | ||
1118 | } while (0) | ||
1119 | |||
1120 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
1121 | u16 class = dev->class >> 8; | ||
1122 | |||
1123 | if (class == PCI_CLASS_DISPLAY_VGA || | ||
1124 | class == PCI_CLASS_NOT_DEFINED_VGA) | ||
1125 | *found_vga = 1; | ||
1126 | if (class >> 8 == PCI_BASE_CLASS_BRIDGE && dev->subordinate) | ||
1127 | rc |= check_for_io_childs(dev->subordinate, res, found_vga); | ||
1128 | if (class == PCI_CLASS_BRIDGE_CARDBUS) | ||
1129 | push_end(res, 0xfff); | ||
1130 | |||
1131 | for (i=0; i<PCI_NUM_RESOURCES; i++) { | ||
1132 | struct resource *r; | ||
1133 | unsigned long r_size; | ||
1134 | |||
1135 | if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI | ||
1136 | && i >= PCI_BRIDGE_RESOURCES) | ||
1137 | continue; | ||
1138 | r = &dev->resource[i]; | ||
1139 | r_size = r->end - r->start; | ||
1140 | if (r_size < 0xfff) | ||
1141 | r_size = 0xfff; | ||
1142 | if (r->flags & IORESOURCE_IO && (r_size) != 0) { | ||
1143 | rc = 1; | ||
1144 | push_end(res, r_size); | ||
1145 | } | ||
1146 | } | ||
1147 | } | ||
1148 | |||
1149 | return rc; | ||
1150 | } | ||
1151 | |||
1152 | /* Here we scan all P2P bridges of a given level that have a closed | ||
1153 | * IO window. Note that the test for the presence of a VGA card should | ||
1154 | * be improved to take into account already configured P2P bridges, | ||
1155 | * currently, we don't see them and might end up configuring 2 bridges | ||
1156 | * with VGA pass through enabled | ||
1157 | */ | ||
1158 | static void __init | ||
1159 | do_fixup_p2p_level(struct pci_bus *bus) | ||
1160 | { | ||
1161 | struct pci_bus *b; | ||
1162 | int i, parent_io; | ||
1163 | int has_vga = 0; | ||
1164 | |||
1165 | for (parent_io=0; parent_io<4; parent_io++) | ||
1166 | if (bus->resource[parent_io] | ||
1167 | && bus->resource[parent_io]->flags & IORESOURCE_IO) | ||
1168 | break; | ||
1169 | if (parent_io >= 4) | ||
1170 | return; | ||
1171 | |||
1172 | list_for_each_entry(b, &bus->children, node) { | ||
1173 | struct pci_dev *d = b->self; | ||
1174 | struct pci_controller* hose = (struct pci_controller *)d->sysdata; | ||
1175 | struct resource *res = b->resource[0]; | ||
1176 | struct resource tmp_res; | ||
1177 | unsigned long max; | ||
1178 | int found_vga = 0; | ||
1179 | |||
1180 | memset(&tmp_res, 0, sizeof(tmp_res)); | ||
1181 | tmp_res.start = bus->resource[parent_io]->start; | ||
1182 | |||
1183 | /* We don't let low addresses go through that closed P2P bridge, well, | ||
1184 | * that may not be necessary but I feel safer that way | ||
1185 | */ | ||
1186 | if (tmp_res.start == 0) | ||
1187 | tmp_res.start = 0x1000; | ||
1188 | |||
1189 | if (!list_empty(&b->devices) && res && res->flags == 0 && | ||
1190 | res != bus->resource[parent_io] && | ||
1191 | (d->class >> 8) == PCI_CLASS_BRIDGE_PCI && | ||
1192 | check_for_io_childs(b, &tmp_res, &found_vga)) { | ||
1193 | u8 io_base_lo; | ||
1194 | |||
1195 | printk(KERN_INFO "Fixing up IO bus %s\n", b->name); | ||
1196 | |||
1197 | if (found_vga) { | ||
1198 | if (has_vga) { | ||
1199 | printk(KERN_WARNING "Skipping VGA, already active" | ||
1200 | " on bus segment\n"); | ||
1201 | found_vga = 0; | ||
1202 | } else | ||
1203 | has_vga = 1; | ||
1204 | } | ||
1205 | pci_read_config_byte(d, PCI_IO_BASE, &io_base_lo); | ||
1206 | |||
1207 | if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) | ||
1208 | max = ((unsigned long) hose->io_base_virt | ||
1209 | - isa_io_base) + 0xffffffff; | ||
1210 | else | ||
1211 | max = ((unsigned long) hose->io_base_virt | ||
1212 | - isa_io_base) + 0xffff; | ||
1213 | |||
1214 | *res = tmp_res; | ||
1215 | res->flags = IORESOURCE_IO; | ||
1216 | res->name = b->name; | ||
1217 | |||
1218 | /* Find a resource in the parent where we can allocate */ | ||
1219 | for (i = 0 ; i < 4; i++) { | ||
1220 | struct resource *r = bus->resource[i]; | ||
1221 | if (!r) | ||
1222 | continue; | ||
1223 | if ((r->flags & IORESOURCE_IO) == 0) | ||
1224 | continue; | ||
1225 | DBG("Trying to allocate from %08lx, size %08lx from parent" | ||
1226 | " res %d: %08lx -> %08lx\n", | ||
1227 | res->start, res->end, i, r->start, r->end); | ||
1228 | |||
1229 | if (allocate_resource(r, res, res->end + 1, res->start, max, | ||
1230 | res->end + 1, NULL, NULL) < 0) { | ||
1231 | DBG("Failed !\n"); | ||
1232 | continue; | ||
1233 | } | ||
1234 | do_update_p2p_io_resource(b, found_vga); | ||
1235 | break; | ||
1236 | } | ||
1237 | } | ||
1238 | do_fixup_p2p_level(b); | ||
1239 | } | ||
1240 | } | ||
1241 | |||
1242 | static void | ||
1243 | pcibios_fixup_p2p_bridges(void) | ||
1244 | { | ||
1245 | struct pci_bus *b; | ||
1246 | |||
1247 | list_for_each_entry(b, &pci_root_buses, node) | ||
1248 | do_fixup_p2p_level(b); | ||
1249 | } | ||
1250 | |||
1251 | #endif /* CONFIG_PPC_PMAC */ | ||
1252 | |||
1253 | static int __init | 1031 | static int __init |
1254 | pcibios_init(void) | 1032 | pcibios_init(void) |
1255 | { | 1033 | { |
@@ -1290,9 +1068,6 @@ pcibios_init(void) | |||
1290 | pcibios_allocate_bus_resources(&pci_root_buses); | 1068 | pcibios_allocate_bus_resources(&pci_root_buses); |
1291 | pcibios_allocate_resources(0); | 1069 | pcibios_allocate_resources(0); |
1292 | pcibios_allocate_resources(1); | 1070 | pcibios_allocate_resources(1); |
1293 | #ifdef CONFIG_PPC_PMAC | ||
1294 | pcibios_fixup_p2p_bridges(); | ||
1295 | #endif /* CONFIG_PPC_PMAC */ | ||
1296 | pcibios_assign_resources(); | 1071 | pcibios_assign_resources(); |
1297 | 1072 | ||
1298 | /* Call machine dependent post-init code */ | 1073 | /* Call machine dependent post-init code */ |
@@ -1722,17 +1497,6 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | |||
1722 | struct pci_controller* hose; | 1497 | struct pci_controller* hose; |
1723 | long result = -EOPNOTSUPP; | 1498 | long result = -EOPNOTSUPP; |
1724 | 1499 | ||
1725 | /* Argh ! Please forgive me for that hack, but that's the | ||
1726 | * simplest way to get existing XFree to not lockup on some | ||
1727 | * G5 machines... So when something asks for bus 0 io base | ||
1728 | * (bus 0 is HT root), we return the AGP one instead. | ||
1729 | */ | ||
1730 | #ifdef CONFIG_PPC_PMAC | ||
1731 | if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4")) | ||
1732 | if (bus == 0) | ||
1733 | bus = 0xf0; | ||
1734 | #endif /* CONFIG_PPC_PMAC */ | ||
1735 | |||
1736 | hose = pci_bus_to_hose(bus); | 1500 | hose = pci_bus_to_hose(bus); |
1737 | if (!hose) | 1501 | if (!hose) |
1738 | return -ENODEV; | 1502 | return -ENODEV; |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index fb0da7c209db..3a6e4bcb3c53 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | #include <asm/pci-bridge.h> | 35 | #include <asm/pci-bridge.h> |
36 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
37 | #include <asm/pmac_feature.h> | ||
38 | #include <asm/dma.h> | 37 | #include <asm/dma.h> |
39 | #include <asm/machdep.h> | 38 | #include <asm/machdep.h> |
40 | #include <asm/hw_irq.h> | 39 | #include <asm/hw_irq.h> |
@@ -58,7 +57,6 @@ extern void machine_check_exception(struct pt_regs *regs); | |||
58 | extern void alignment_exception(struct pt_regs *regs); | 57 | extern void alignment_exception(struct pt_regs *regs); |
59 | extern void program_check_exception(struct pt_regs *regs); | 58 | extern void program_check_exception(struct pt_regs *regs); |
60 | extern void single_step_exception(struct pt_regs *regs); | 59 | extern void single_step_exception(struct pt_regs *regs); |
61 | extern int pmac_newworld; | ||
62 | extern int sys_sigreturn(struct pt_regs *regs); | 60 | extern int sys_sigreturn(struct pt_regs *regs); |
63 | 61 | ||
64 | long long __ashrdi3(long long, int); | 62 | long long __ashrdi3(long long, int); |
@@ -213,10 +211,6 @@ EXPORT_SYMBOL(adb_try_handler_change); | |||
213 | EXPORT_SYMBOL(cuda_request); | 211 | EXPORT_SYMBOL(cuda_request); |
214 | EXPORT_SYMBOL(cuda_poll); | 212 | EXPORT_SYMBOL(cuda_poll); |
215 | #endif /* CONFIG_ADB_CUDA */ | 213 | #endif /* CONFIG_ADB_CUDA */ |
216 | #ifdef CONFIG_PPC_PMAC | ||
217 | EXPORT_SYMBOL(sys_ctrler); | ||
218 | EXPORT_SYMBOL(pmac_newworld); | ||
219 | #endif | ||
220 | #ifdef CONFIG_PPC_OF | 214 | #ifdef CONFIG_PPC_OF |
221 | EXPORT_SYMBOL(find_devices); | 215 | EXPORT_SYMBOL(find_devices); |
222 | EXPORT_SYMBOL(find_type_devices); | 216 | EXPORT_SYMBOL(find_type_devices); |
@@ -241,9 +235,6 @@ EXPORT_SYMBOL(of_node_put); | |||
241 | #if defined(CONFIG_BOOTX_TEXT) | 235 | #if defined(CONFIG_BOOTX_TEXT) |
242 | EXPORT_SYMBOL(btext_update_display); | 236 | EXPORT_SYMBOL(btext_update_display); |
243 | #endif | 237 | #endif |
244 | #if defined(CONFIG_SCSI) && defined(CONFIG_PPC_PMAC) | ||
245 | EXPORT_SYMBOL(note_scsi_host); | ||
246 | #endif | ||
247 | #ifdef CONFIG_VT | 238 | #ifdef CONFIG_VT |
248 | EXPORT_SYMBOL(kd_mksound); | 239 | EXPORT_SYMBOL(kd_mksound); |
249 | #endif | 240 | #endif |
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index e707c6f6e61b..c08ab432e958 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Common prep/pmac/chrp boot and setup code. | 2 | * Common prep/chrp boot and setup code. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | 5 | #include <linux/config.h> |
@@ -35,7 +35,6 @@ | |||
35 | #include <asm/machdep.h> | 35 | #include <asm/machdep.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <asm/system.h> | 37 | #include <asm/system.h> |
38 | #include <asm/pmac_feature.h> | ||
39 | #include <asm/sections.h> | 38 | #include <asm/sections.h> |
40 | #include <asm/nvram.h> | 39 | #include <asm/nvram.h> |
41 | #include <asm/xmon.h> | 40 | #include <asm/xmon.h> |
@@ -55,7 +54,6 @@ | |||
55 | 54 | ||
56 | extern void platform_init(unsigned long r3, unsigned long r4, | 55 | extern void platform_init(unsigned long r3, unsigned long r4, |
57 | unsigned long r5, unsigned long r6, unsigned long r7); | 56 | unsigned long r5, unsigned long r6, unsigned long r7); |
58 | extern void bootx_init(unsigned long r4, unsigned long phys); | ||
59 | extern void identify_cpu(unsigned long offset, unsigned long cpu); | 57 | extern void identify_cpu(unsigned long offset, unsigned long cpu); |
60 | extern void do_cpu_ftr_fixups(unsigned long offset); | 58 | extern void do_cpu_ftr_fixups(unsigned long offset); |
61 | extern void reloc_got2(unsigned long offset); | 59 | extern void reloc_got2(unsigned long offset); |
@@ -80,8 +78,6 @@ EXPORT_SYMBOL(_machine); | |||
80 | 78 | ||
81 | extern void prep_init(unsigned long r3, unsigned long r4, | 79 | extern void prep_init(unsigned long r3, unsigned long r4, |
82 | unsigned long r5, unsigned long r6, unsigned long r7); | 80 | unsigned long r5, unsigned long r6, unsigned long r7); |
83 | extern void pmac_init(unsigned long r3, unsigned long r4, | ||
84 | unsigned long r5, unsigned long r6, unsigned long r7); | ||
85 | extern void chrp_init(unsigned long r3, unsigned long r4, | 81 | extern void chrp_init(unsigned long r3, unsigned long r4, |
86 | unsigned long r5, unsigned long r6, unsigned long r7); | 82 | unsigned long r5, unsigned long r6, unsigned long r7); |
87 | 83 | ||
@@ -324,20 +320,15 @@ early_init(int r3, int r4, int r5) | |||
324 | identify_cpu(offset, 0); | 320 | identify_cpu(offset, 0); |
325 | do_cpu_ftr_fixups(offset); | 321 | do_cpu_ftr_fixups(offset); |
326 | 322 | ||
327 | #if defined(CONFIG_PPC_MULTIPLATFORM) | 323 | #if defined(CONFIG_PPC_OF) |
328 | reloc_got2(offset); | 324 | reloc_got2(offset); |
329 | 325 | ||
330 | /* If we came here from BootX, clear the screen, | ||
331 | * set up some pointers and return. */ | ||
332 | if ((r3 == 0x426f6f58) && (r5 == 0)) | ||
333 | bootx_init(r4, phys); | ||
334 | |||
335 | /* | 326 | /* |
336 | * don't do anything on prep | 327 | * don't do anything on prep |
337 | * for now, don't use bootinfo because it breaks yaboot 0.5 | 328 | * for now, don't use bootinfo because it breaks yaboot 0.5 |
338 | * and assume that if we didn't find a magic number, we have OF | 329 | * and assume that if we didn't find a magic number, we have OF |
339 | */ | 330 | */ |
340 | else if (*(unsigned long *)(0) != 0xdeadc0de) | 331 | if (*(unsigned long *)(0) != 0xdeadc0de) |
341 | phys = prom_init(r3, r4, (prom_entry)r5); | 332 | phys = prom_init(r3, r4, (prom_entry)r5); |
342 | 333 | ||
343 | reloc_got2(-offset); | 334 | reloc_got2(-offset); |
@@ -424,6 +415,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
424 | } | 415 | } |
425 | #endif | 416 | #endif |
426 | 417 | ||
418 | #ifdef CONFIG_PPC_OF | ||
427 | have_of = 1; | 419 | have_of = 1; |
428 | 420 | ||
429 | /* prom_init has already been called from __start */ | 421 | /* prom_init has already been called from __start */ |
@@ -495,19 +487,17 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
495 | #endif /* CONFIG_ADB */ | 487 | #endif /* CONFIG_ADB */ |
496 | 488 | ||
497 | switch (_machine) { | 489 | switch (_machine) { |
498 | #ifdef CONFIG_PPC_PMAC | ||
499 | case _MACH_Pmac: | ||
500 | pmac_init(r3, r4, r5, r6, r7); | ||
501 | break; | ||
502 | #endif | ||
503 | #ifdef CONFIG_PPC_CHRP | 490 | #ifdef CONFIG_PPC_CHRP |
504 | case _MACH_chrp: | 491 | case _MACH_chrp: |
505 | chrp_init(r3, r4, r5, r6, r7); | 492 | chrp_init(r3, r4, r5, r6, r7); |
506 | break; | 493 | break; |
507 | #endif | 494 | #endif |
508 | } | 495 | } |
496 | #endif /* CONFIG_PPC_OF */ | ||
509 | } | 497 | } |
498 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
510 | 499 | ||
500 | #ifdef CONFIG_PPC_OF | ||
511 | #ifdef CONFIG_SERIAL_CORE_CONSOLE | 501 | #ifdef CONFIG_SERIAL_CORE_CONSOLE |
512 | extern char *of_stdout_device; | 502 | extern char *of_stdout_device; |
513 | 503 | ||
@@ -564,7 +554,7 @@ static int __init set_preferred_console(void) | |||
564 | } | 554 | } |
565 | console_initcall(set_preferred_console); | 555 | console_initcall(set_preferred_console); |
566 | #endif /* CONFIG_SERIAL_CORE_CONSOLE */ | 556 | #endif /* CONFIG_SERIAL_CORE_CONSOLE */ |
567 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 557 | #endif /* CONFIG_PPC_OF */ |
568 | 558 | ||
569 | struct bi_record *find_bootinfo(void) | 559 | struct bi_record *find_bootinfo(void) |
570 | { | 560 | { |
@@ -747,14 +737,6 @@ void __init setup_arch(char **cmdline_p) | |||
747 | if (ppc_md.init_early) | 737 | if (ppc_md.init_early) |
748 | ppc_md.init_early(); | 738 | ppc_md.init_early(); |
749 | 739 | ||
750 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
751 | /* This could be called "early setup arch", it must be done | ||
752 | * now because xmon need it | ||
753 | */ | ||
754 | if (_machine == _MACH_Pmac) | ||
755 | pmac_feature_init(); /* New cool way */ | ||
756 | #endif | ||
757 | |||
758 | #ifdef CONFIG_XMON | 740 | #ifdef CONFIG_XMON |
759 | xmon_init(1); | 741 | xmon_init(1); |
760 | if (strstr(cmd_line, "xmon")) | 742 | if (strstr(cmd_line, "xmon")) |
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c index 9dbc4d28fa28..6d0a1838d94c 100644 --- a/arch/ppc/kernel/traps.c +++ b/arch/ppc/kernel/traps.c | |||
@@ -38,9 +38,6 @@ | |||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/reg.h> | 39 | #include <asm/reg.h> |
40 | #include <asm/xmon.h> | 40 | #include <asm/xmon.h> |
41 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
42 | #include <asm/backlight.h> | ||
43 | #endif | ||
44 | #include <asm/pmc.h> | 41 | #include <asm/pmc.h> |
45 | 42 | ||
46 | #ifdef CONFIG_XMON | 43 | #ifdef CONFIG_XMON |
@@ -85,12 +82,6 @@ int die(const char * str, struct pt_regs * fp, long err) | |||
85 | int nl = 0; | 82 | int nl = 0; |
86 | console_verbose(); | 83 | console_verbose(); |
87 | spin_lock_irq(&die_lock); | 84 | spin_lock_irq(&die_lock); |
88 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
89 | if (_machine == _MACH_Pmac) { | ||
90 | set_backlight_enable(1); | ||
91 | set_backlight_level(BACKLIGHT_MAX); | ||
92 | } | ||
93 | #endif | ||
94 | printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); | 85 | printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); |
95 | #ifdef CONFIG_PREEMPT | 86 | #ifdef CONFIG_PREEMPT |
96 | printk("PREEMPT "); | 87 | printk("PREEMPT "); |
@@ -159,7 +150,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) | |||
159 | */ | 150 | */ |
160 | static inline int check_io_access(struct pt_regs *regs) | 151 | static inline int check_io_access(struct pt_regs *regs) |
161 | { | 152 | { |
162 | #if defined CONFIG_PPC_PMAC || defined CONFIG_8xx | 153 | #if defined CONFIG_8xx |
163 | unsigned long msr = regs->msr; | 154 | unsigned long msr = regs->msr; |
164 | const struct exception_table_entry *entry; | 155 | const struct exception_table_entry *entry; |
165 | unsigned int *nip = (unsigned int *)regs->nip; | 156 | unsigned int *nip = (unsigned int *)regs->nip; |
@@ -196,7 +187,7 @@ static inline int check_io_access(struct pt_regs *regs) | |||
196 | return 1; | 187 | return 1; |
197 | } | 188 | } |
198 | } | 189 | } |
199 | #endif /* CONFIG_PPC_PMAC */ | 190 | #endif /* CONFIG_8xx */ |
200 | return 0; | 191 | return 0; |
201 | } | 192 | } |
202 | 193 | ||
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index 45f0782059f1..134db5c04203 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c | |||
@@ -67,10 +67,6 @@ unsigned long ppc_memoffset = PAGE_OFFSET; | |||
67 | int mem_init_done; | 67 | int mem_init_done; |
68 | int init_bootmem_done; | 68 | int init_bootmem_done; |
69 | int boot_mapsize; | 69 | int boot_mapsize; |
70 | #ifdef CONFIG_PPC_PMAC | ||
71 | unsigned long agp_special_page; | ||
72 | EXPORT_SYMBOL(agp_special_page); | ||
73 | #endif | ||
74 | 70 | ||
75 | extern char _end[]; | 71 | extern char _end[]; |
76 | extern char etext[], _stext[]; | 72 | extern char etext[], _stext[]; |
@@ -424,10 +420,6 @@ void __init mem_init(void) | |||
424 | addr += PAGE_SIZE) | 420 | addr += PAGE_SIZE) |
425 | SetPageReserved(virt_to_page(addr)); | 421 | SetPageReserved(virt_to_page(addr)); |
426 | #endif | 422 | #endif |
427 | #ifdef CONFIG_PPC_PMAC | ||
428 | if (agp_special_page) | ||
429 | SetPageReserved(virt_to_page(agp_special_page)); | ||
430 | #endif | ||
431 | for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory; | 423 | for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory; |
432 | addr += PAGE_SIZE) { | 424 | addr += PAGE_SIZE) { |
433 | if (!PageReserved(virt_to_page(addr))) | 425 | if (!PageReserved(virt_to_page(addr))) |
@@ -463,11 +455,6 @@ void __init mem_init(void) | |||
463 | initpages<< (PAGE_SHIFT-10), | 455 | initpages<< (PAGE_SHIFT-10), |
464 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 456 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); |
465 | 457 | ||
466 | #ifdef CONFIG_PPC_PMAC | ||
467 | if (agp_special_page) | ||
468 | printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page); | ||
469 | #endif | ||
470 | |||
471 | mem_init_done = 1; | 458 | mem_init_done = 1; |
472 | } | 459 | } |
473 | 460 | ||
@@ -512,22 +499,6 @@ set_phys_avail(unsigned long total_memory) | |||
512 | if (rtas_data) | 499 | if (rtas_data) |
513 | mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1); | 500 | mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1); |
514 | #endif | 501 | #endif |
515 | #ifdef CONFIG_PPC_PMAC | ||
516 | /* Because of some uninorth weirdness, we need a page of | ||
517 | * memory as high as possible (it must be outside of the | ||
518 | * bus address seen as the AGP aperture). It will be used | ||
519 | * by the r128 DRM driver | ||
520 | * | ||
521 | * FIXME: We need to make sure that page doesn't overlap any of the\ | ||
522 | * above. This could be done by improving mem_pieces_find to be able | ||
523 | * to do a backward search from the end of the list. | ||
524 | */ | ||
525 | if (_machine == _MACH_Pmac && find_devices("uni-north-agp")) { | ||
526 | agp_special_page = (total_memory - PAGE_SIZE); | ||
527 | mem_pieces_remove(&phys_avail, agp_special_page, PAGE_SIZE, 0); | ||
528 | agp_special_page = (unsigned long)__va(agp_special_page); | ||
529 | } | ||
530 | #endif /* CONFIG_PPC_PMAC */ | ||
531 | } | 502 | } |
532 | 503 | ||
533 | /* Mark some memory as reserved by removing it from phys_avail. */ | 504 | /* Mark some memory as reserved by removing it from phys_avail. */ |
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile index 7c5cdabf6f3c..51430e294b32 100644 --- a/arch/ppc/platforms/Makefile +++ b/arch/ppc/platforms/Makefile | |||
@@ -3,26 +3,18 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Extra CFLAGS so we don't have to do relative includes | 5 | # Extra CFLAGS so we don't have to do relative includes |
6 | CFLAGS_pmac_setup.o += -Iarch/$(ARCH)/mm | 6 | CFLAGS_chrp_setup.o += -Iarch/$(ARCH)/mm |
7 | 7 | ||
8 | obj-$(CONFIG_APUS) += apus_setup.o | 8 | obj-$(CONFIG_APUS) += apus_setup.o |
9 | ifeq ($(CONFIG_APUS),y) | 9 | ifeq ($(CONFIG_APUS),y) |
10 | obj-$(CONFIG_PCI) += apus_pci.o | 10 | obj-$(CONFIG_PCI) += apus_pci.o |
11 | endif | 11 | endif |
12 | obj-$(CONFIG_PPC_PMAC) += pmac_pic.o pmac_setup.o pmac_time.o \ | ||
13 | pmac_feature.o pmac_pci.o pmac_sleep.o \ | ||
14 | pmac_low_i2c.o pmac_cache.o | ||
15 | obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \ | 12 | obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \ |
16 | chrp_pegasos_eth.o | 13 | chrp_pegasos_eth.o |
17 | ifeq ($(CONFIG_PPC_CHRP),y) | 14 | ifeq ($(CONFIG_PPC_CHRP),y) |
18 | obj-$(CONFIG_NVRAM) += chrp_nvram.o | 15 | obj-$(CONFIG_NVRAM) += chrp_nvram.o |
19 | endif | 16 | endif |
20 | obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o | 17 | obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o |
21 | ifeq ($(CONFIG_PPC_PMAC),y) | ||
22 | obj-$(CONFIG_NVRAM) += pmac_nvram.o | ||
23 | obj-$(CONFIG_CPU_FREQ_PMAC) += pmac_cpufreq.o | ||
24 | endif | ||
25 | obj-$(CONFIG_PMAC_BACKLIGHT) += pmac_backlight.o | ||
26 | obj-$(CONFIG_PREP_RESIDUAL) += residual.o | 18 | obj-$(CONFIG_PREP_RESIDUAL) += residual.o |
27 | obj-$(CONFIG_PQ2ADS) += pq2ads.o | 19 | obj-$(CONFIG_PQ2ADS) += pq2ads.o |
28 | obj-$(CONFIG_TQM8260) += tqm8260_setup.o | 20 | obj-$(CONFIG_TQM8260) += tqm8260_setup.o |
@@ -47,6 +39,5 @@ obj-$(CONFIG_LITE5200) += lite5200.o | |||
47 | obj-$(CONFIG_EV64360) += ev64360.o | 39 | obj-$(CONFIG_EV64360) += ev64360.o |
48 | 40 | ||
49 | ifeq ($(CONFIG_SMP),y) | 41 | ifeq ($(CONFIG_SMP),y) |
50 | obj-$(CONFIG_PPC_PMAC) += pmac_smp.o | ||
51 | obj-$(CONFIG_PPC_CHRP) += chrp_smp.o | 42 | obj-$(CONFIG_PPC_CHRP) += chrp_smp.o |
52 | endif | 43 | endif |
diff --git a/arch/ppc/platforms/chrp_pci.c b/arch/ppc/platforms/chrp_pci.c index bd047aac01b1..c7fe6182bb77 100644 --- a/arch/ppc/platforms/chrp_pci.c +++ b/arch/ppc/platforms/chrp_pci.c | |||
@@ -275,7 +275,7 @@ chrp_find_bridges(void) | |||
275 | setup_python(hose, dev); | 275 | setup_python(hose, dev); |
276 | } else if (is_mot | 276 | } else if (is_mot |
277 | || strncmp(model, "Motorola, Grackle", 17) == 0) { | 277 | || strncmp(model, "Motorola, Grackle", 17) == 0) { |
278 | setup_grackle(hose); | 278 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000); |
279 | } else if (is_longtrail) { | 279 | } else if (is_longtrail) { |
280 | void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000); | 280 | void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000); |
281 | hose->ops = &gg2_pci_ops; | 281 | hose->ops = &gg2_pci_ops; |
diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c index 056ac2a7b5c1..48996b787378 100644 --- a/arch/ppc/platforms/chrp_setup.c +++ b/arch/ppc/platforms/chrp_setup.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <asm/i8259.h> | 53 | #include <asm/i8259.h> |
54 | #include <asm/open_pic.h> | 54 | #include <asm/open_pic.h> |
55 | #include <asm/xmon.h> | 55 | #include <asm/xmon.h> |
56 | #include "mem_pieces.h" | ||
56 | 57 | ||
57 | unsigned long chrp_get_rtc_time(void); | 58 | unsigned long chrp_get_rtc_time(void); |
58 | int chrp_set_rtc_time(unsigned long nowtime); | 59 | int chrp_set_rtc_time(unsigned long nowtime); |
@@ -65,7 +66,6 @@ void rtas_display_progress(char *, unsigned short); | |||
65 | void rtas_indicator_progress(char *, unsigned short); | 66 | void rtas_indicator_progress(char *, unsigned short); |
66 | void btext_progress(char *, unsigned short); | 67 | void btext_progress(char *, unsigned short); |
67 | 68 | ||
68 | extern unsigned long pmac_find_end_of_memory(void); | ||
69 | extern int of_show_percpuinfo(struct seq_file *, int); | 69 | extern int of_show_percpuinfo(struct seq_file *, int); |
70 | 70 | ||
71 | int _chrp_type; | 71 | int _chrp_type; |
@@ -467,6 +467,75 @@ chrp_init2(void) | |||
467 | ppc_md.progress(" Have fun! ", 0x7777); | 467 | ppc_md.progress(" Have fun! ", 0x7777); |
468 | } | 468 | } |
469 | 469 | ||
470 | static struct device_node *memory_node; | ||
471 | |||
472 | static int __init get_mem_prop(char *name, struct mem_pieces *mp) | ||
473 | { | ||
474 | struct reg_property *rp; | ||
475 | int i, s; | ||
476 | unsigned int *ip; | ||
477 | int nac = prom_n_addr_cells(memory_node); | ||
478 | int nsc = prom_n_size_cells(memory_node); | ||
479 | |||
480 | ip = (unsigned int *) get_property(memory_node, name, &s); | ||
481 | if (ip == NULL) { | ||
482 | printk(KERN_ERR "error: couldn't get %s property on /memory\n", | ||
483 | name); | ||
484 | return 0; | ||
485 | } | ||
486 | s /= (nsc + nac) * 4; | ||
487 | rp = mp->regions; | ||
488 | for (i = 0; i < s; ++i, ip += nac+nsc) { | ||
489 | if (nac >= 2 && ip[nac-2] != 0) | ||
490 | continue; | ||
491 | rp->address = ip[nac-1]; | ||
492 | if (nsc >= 2 && ip[nac+nsc-2] != 0) | ||
493 | rp->size = ~0U; | ||
494 | else | ||
495 | rp->size = ip[nac+nsc-1]; | ||
496 | ++rp; | ||
497 | } | ||
498 | mp->n_regions = rp - mp->regions; | ||
499 | |||
500 | /* Make sure the pieces are sorted. */ | ||
501 | mem_pieces_sort(mp); | ||
502 | mem_pieces_coalesce(mp); | ||
503 | return 1; | ||
504 | } | ||
505 | |||
506 | static unsigned long __init chrp_find_end_of_memory(void) | ||
507 | { | ||
508 | unsigned long a, total; | ||
509 | struct mem_pieces phys_mem; | ||
510 | |||
511 | /* | ||
512 | * Find out where physical memory is, and check that it | ||
513 | * starts at 0 and is contiguous. It seems that RAM is | ||
514 | * always physically contiguous on Power Macintoshes. | ||
515 | * | ||
516 | * Supporting discontiguous physical memory isn't hard, | ||
517 | * it just makes the virtual <-> physical mapping functions | ||
518 | * more complicated (or else you end up wasting space | ||
519 | * in mem_map). | ||
520 | */ | ||
521 | memory_node = find_devices("memory"); | ||
522 | if (memory_node == NULL || !get_mem_prop("reg", &phys_mem) | ||
523 | || phys_mem.n_regions == 0) | ||
524 | panic("No RAM??"); | ||
525 | a = phys_mem.regions[0].address; | ||
526 | if (a != 0) | ||
527 | panic("RAM doesn't start at physical address 0"); | ||
528 | total = phys_mem.regions[0].size; | ||
529 | |||
530 | if (phys_mem.n_regions > 1) { | ||
531 | printk("RAM starting at 0x%x is not contiguous\n", | ||
532 | phys_mem.regions[1].address); | ||
533 | printk("Using RAM from 0 to 0x%lx\n", total-1); | ||
534 | } | ||
535 | |||
536 | return total; | ||
537 | } | ||
538 | |||
470 | void __init | 539 | void __init |
471 | chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, | 540 | chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, |
472 | unsigned long r6, unsigned long r7) | 541 | unsigned long r6, unsigned long r7) |
@@ -525,7 +594,7 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
525 | ppc_md.get_rtc_time = chrp_get_rtc_time; | 594 | ppc_md.get_rtc_time = chrp_get_rtc_time; |
526 | ppc_md.calibrate_decr = chrp_calibrate_decr; | 595 | ppc_md.calibrate_decr = chrp_calibrate_decr; |
527 | 596 | ||
528 | ppc_md.find_end_of_memory = pmac_find_end_of_memory; | 597 | ppc_md.find_end_of_memory = chrp_find_end_of_memory; |
529 | 598 | ||
530 | if (rtas_data) { | 599 | if (rtas_data) { |
531 | struct device_node *rtas; | 600 | struct device_node *rtas; |
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c index 29d074c305f0..57753a55b580 100644 --- a/arch/ppc/platforms/chrp_time.c +++ b/arch/ppc/platforms/chrp_time.c | |||
@@ -163,13 +163,75 @@ unsigned long chrp_get_rtc_time(void) | |||
163 | return mktime(year, mon, day, hour, min, sec); | 163 | return mktime(year, mon, day, hour, min, sec); |
164 | } | 164 | } |
165 | 165 | ||
166 | /* | ||
167 | * Calibrate the decrementer frequency with the VIA timer 1. | ||
168 | */ | ||
169 | #define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */ | ||
170 | |||
171 | /* VIA registers */ | ||
172 | #define RS 0x200 /* skip between registers */ | ||
173 | #define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */ | ||
174 | #define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */ | ||
175 | #define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */ | ||
176 | #define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */ | ||
177 | #define ACR (11*RS) /* Auxiliary control register */ | ||
178 | #define IFR (13*RS) /* Interrupt flag register */ | ||
179 | |||
180 | /* Bits in ACR */ | ||
181 | #define T1MODE 0xc0 /* Timer 1 mode */ | ||
182 | #define T1MODE_CONT 0x40 /* continuous interrupts */ | ||
183 | |||
184 | /* Bits in IFR and IER */ | ||
185 | #define T1_INT 0x40 /* Timer 1 interrupt */ | ||
186 | |||
187 | static int __init chrp_via_calibrate_decr(void) | ||
188 | { | ||
189 | struct device_node *vias; | ||
190 | volatile unsigned char __iomem *via; | ||
191 | int count = VIA_TIMER_FREQ_6 / 100; | ||
192 | unsigned int dstart, dend; | ||
193 | |||
194 | vias = find_devices("via-cuda"); | ||
195 | if (vias == 0) | ||
196 | vias = find_devices("via"); | ||
197 | if (vias == 0 || vias->n_addrs == 0) | ||
198 | return 0; | ||
199 | via = ioremap(vias->addrs[0].address, vias->addrs[0].size); | ||
200 | |||
201 | /* set timer 1 for continuous interrupts */ | ||
202 | out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT); | ||
203 | /* set the counter to a small value */ | ||
204 | out_8(&via[T1CH], 2); | ||
205 | /* set the latch to `count' */ | ||
206 | out_8(&via[T1LL], count); | ||
207 | out_8(&via[T1LH], count >> 8); | ||
208 | /* wait until it hits 0 */ | ||
209 | while ((in_8(&via[IFR]) & T1_INT) == 0) | ||
210 | ; | ||
211 | dstart = get_dec(); | ||
212 | /* clear the interrupt & wait until it hits 0 again */ | ||
213 | in_8(&via[T1CL]); | ||
214 | while ((in_8(&via[IFR]) & T1_INT) == 0) | ||
215 | ; | ||
216 | dend = get_dec(); | ||
217 | |||
218 | tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100); | ||
219 | tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); | ||
220 | |||
221 | printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", | ||
222 | tb_ticks_per_jiffy, dstart - dend); | ||
223 | |||
224 | iounmap(via); | ||
225 | |||
226 | return 1; | ||
227 | } | ||
166 | 228 | ||
167 | void __init chrp_calibrate_decr(void) | 229 | void __init chrp_calibrate_decr(void) |
168 | { | 230 | { |
169 | struct device_node *cpu; | 231 | struct device_node *cpu; |
170 | unsigned int freq, *fp; | 232 | unsigned int freq, *fp; |
171 | 233 | ||
172 | if (via_calibrate_decr()) | 234 | if (chrp_via_calibrate_decr()) |
173 | return; | 235 | return; |
174 | 236 | ||
175 | /* | 237 | /* |
diff --git a/arch/ppc/platforms/pmac_backlight.c b/arch/ppc/platforms/pmac_backlight.c deleted file mode 100644 index 8be2f7d071f0..000000000000 --- a/arch/ppc/platforms/pmac_backlight.c +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | /* | ||
2 | * Miscellaneous procedures for dealing with the PowerMac hardware. | ||
3 | * Contains support for the backlight. | ||
4 | * | ||
5 | * Copyright (C) 2000 Benjamin Herrenschmidt | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/stddef.h> | ||
13 | #include <linux/reboot.h> | ||
14 | #include <linux/nvram.h> | ||
15 | #include <linux/console.h> | ||
16 | #include <asm/sections.h> | ||
17 | #include <asm/ptrace.h> | ||
18 | #include <asm/io.h> | ||
19 | #include <asm/pgtable.h> | ||
20 | #include <asm/system.h> | ||
21 | #include <asm/prom.h> | ||
22 | #include <asm/machdep.h> | ||
23 | #include <asm/nvram.h> | ||
24 | #include <asm/backlight.h> | ||
25 | |||
26 | #include <linux/adb.h> | ||
27 | #include <linux/pmu.h> | ||
28 | |||
29 | static struct backlight_controller *backlighter; | ||
30 | static void* backlighter_data; | ||
31 | static int backlight_autosave; | ||
32 | static int backlight_level = BACKLIGHT_MAX; | ||
33 | static int backlight_enabled = 1; | ||
34 | static int backlight_req_level = -1; | ||
35 | static int backlight_req_enable = -1; | ||
36 | |||
37 | static void backlight_callback(void *); | ||
38 | static DECLARE_WORK(backlight_work, backlight_callback, NULL); | ||
39 | |||
40 | void register_backlight_controller(struct backlight_controller *ctrler, | ||
41 | void *data, char *type) | ||
42 | { | ||
43 | struct device_node* bk_node; | ||
44 | char *prop; | ||
45 | int valid = 0; | ||
46 | |||
47 | /* There's already a matching controller, bail out */ | ||
48 | if (backlighter != NULL) | ||
49 | return; | ||
50 | |||
51 | bk_node = find_devices("backlight"); | ||
52 | |||
53 | #ifdef CONFIG_ADB_PMU | ||
54 | /* Special case for the old PowerBook since I can't test on it */ | ||
55 | backlight_autosave = machine_is_compatible("AAPL,3400/2400") | ||
56 | || machine_is_compatible("AAPL,3500"); | ||
57 | if ((backlight_autosave | ||
58 | || machine_is_compatible("AAPL,PowerBook1998") | ||
59 | || machine_is_compatible("PowerBook1,1")) | ||
60 | && !strcmp(type, "pmu")) | ||
61 | valid = 1; | ||
62 | #endif | ||
63 | if (bk_node) { | ||
64 | prop = get_property(bk_node, "backlight-control", NULL); | ||
65 | if (prop && !strncmp(prop, type, strlen(type))) | ||
66 | valid = 1; | ||
67 | } | ||
68 | if (!valid) | ||
69 | return; | ||
70 | backlighter = ctrler; | ||
71 | backlighter_data = data; | ||
72 | |||
73 | if (bk_node && !backlight_autosave) | ||
74 | prop = get_property(bk_node, "bklt", NULL); | ||
75 | else | ||
76 | prop = NULL; | ||
77 | if (prop) { | ||
78 | backlight_level = ((*prop)+1) >> 1; | ||
79 | if (backlight_level > BACKLIGHT_MAX) | ||
80 | backlight_level = BACKLIGHT_MAX; | ||
81 | } | ||
82 | |||
83 | #ifdef CONFIG_ADB_PMU | ||
84 | if (backlight_autosave) { | ||
85 | struct adb_request req; | ||
86 | pmu_request(&req, NULL, 2, 0xd9, 0); | ||
87 | while (!req.complete) | ||
88 | pmu_poll(); | ||
89 | backlight_level = req.reply[0] >> 4; | ||
90 | } | ||
91 | #endif | ||
92 | acquire_console_sem(); | ||
93 | if (!backlighter->set_enable(1, backlight_level, data)) | ||
94 | backlight_enabled = 1; | ||
95 | release_console_sem(); | ||
96 | |||
97 | printk(KERN_INFO "Registered \"%s\" backlight controller," | ||
98 | "level: %d/15\n", type, backlight_level); | ||
99 | } | ||
100 | EXPORT_SYMBOL(register_backlight_controller); | ||
101 | |||
102 | void unregister_backlight_controller(struct backlight_controller | ||
103 | *ctrler, void *data) | ||
104 | { | ||
105 | /* We keep the current backlight level (for now) */ | ||
106 | if (ctrler == backlighter && data == backlighter_data) | ||
107 | backlighter = NULL; | ||
108 | } | ||
109 | EXPORT_SYMBOL(unregister_backlight_controller); | ||
110 | |||
111 | static int __set_backlight_enable(int enable) | ||
112 | { | ||
113 | int rc; | ||
114 | |||
115 | if (!backlighter) | ||
116 | return -ENODEV; | ||
117 | acquire_console_sem(); | ||
118 | rc = backlighter->set_enable(enable, backlight_level, | ||
119 | backlighter_data); | ||
120 | if (!rc) | ||
121 | backlight_enabled = enable; | ||
122 | release_console_sem(); | ||
123 | return rc; | ||
124 | } | ||
125 | int set_backlight_enable(int enable) | ||
126 | { | ||
127 | if (!backlighter) | ||
128 | return -ENODEV; | ||
129 | backlight_req_enable = enable; | ||
130 | schedule_work(&backlight_work); | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | EXPORT_SYMBOL(set_backlight_enable); | ||
135 | |||
136 | int get_backlight_enable(void) | ||
137 | { | ||
138 | if (!backlighter) | ||
139 | return -ENODEV; | ||
140 | return backlight_enabled; | ||
141 | } | ||
142 | EXPORT_SYMBOL(get_backlight_enable); | ||
143 | |||
144 | static int __set_backlight_level(int level) | ||
145 | { | ||
146 | int rc = 0; | ||
147 | |||
148 | if (!backlighter) | ||
149 | return -ENODEV; | ||
150 | if (level < BACKLIGHT_MIN) | ||
151 | level = BACKLIGHT_OFF; | ||
152 | if (level > BACKLIGHT_MAX) | ||
153 | level = BACKLIGHT_MAX; | ||
154 | acquire_console_sem(); | ||
155 | if (backlight_enabled) | ||
156 | rc = backlighter->set_level(level, backlighter_data); | ||
157 | if (!rc) | ||
158 | backlight_level = level; | ||
159 | release_console_sem(); | ||
160 | if (!rc && !backlight_autosave) { | ||
161 | level <<=1; | ||
162 | if (level & 0x10) | ||
163 | level |= 0x01; | ||
164 | // -- todo: save to property "bklt" | ||
165 | } | ||
166 | return rc; | ||
167 | } | ||
168 | int set_backlight_level(int level) | ||
169 | { | ||
170 | if (!backlighter) | ||
171 | return -ENODEV; | ||
172 | backlight_req_level = level; | ||
173 | schedule_work(&backlight_work); | ||
174 | return 0; | ||
175 | } | ||
176 | |||
177 | EXPORT_SYMBOL(set_backlight_level); | ||
178 | |||
179 | int get_backlight_level(void) | ||
180 | { | ||
181 | if (!backlighter) | ||
182 | return -ENODEV; | ||
183 | return backlight_level; | ||
184 | } | ||
185 | EXPORT_SYMBOL(get_backlight_level); | ||
186 | |||
187 | static void backlight_callback(void *dummy) | ||
188 | { | ||
189 | int level, enable; | ||
190 | |||
191 | do { | ||
192 | level = backlight_req_level; | ||
193 | enable = backlight_req_enable; | ||
194 | mb(); | ||
195 | |||
196 | if (level >= 0) | ||
197 | __set_backlight_level(level); | ||
198 | if (enable >= 0) | ||
199 | __set_backlight_enable(enable); | ||
200 | } while(cmpxchg(&backlight_req_level, level, -1) != level || | ||
201 | cmpxchg(&backlight_req_enable, enable, -1) != enable); | ||
202 | } | ||
diff --git a/arch/ppc/platforms/pmac_cache.S b/arch/ppc/platforms/pmac_cache.S deleted file mode 100644 index fb977de6b704..000000000000 --- a/arch/ppc/platforms/pmac_cache.S +++ /dev/null | |||
@@ -1,359 +0,0 @@ | |||
1 | /* | ||
2 | * This file contains low-level cache management functions | ||
3 | * used for sleep and CPU speed changes on Apple machines. | ||
4 | * (In fact the only thing that is Apple-specific is that we assume | ||
5 | * that we can read from ROM at physical address 0xfff00000.) | ||
6 | * | ||
7 | * Copyright (C) 2004 Paul Mackerras (paulus@samba.org) and | ||
8 | * Benjamin Herrenschmidt (benh@kernel.crashing.org) | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/config.h> | ||
18 | #include <asm/processor.h> | ||
19 | #include <asm/ppc_asm.h> | ||
20 | #include <asm/cputable.h> | ||
21 | |||
22 | /* | ||
23 | * Flush and disable all data caches (dL1, L2, L3). This is used | ||
24 | * when going to sleep, when doing a PMU based cpufreq transition, | ||
25 | * or when "offlining" a CPU on SMP machines. This code is over | ||
26 | * paranoid, but I've had enough issues with various CPU revs and | ||
27 | * bugs that I decided it was worth beeing over cautious | ||
28 | */ | ||
29 | |||
30 | _GLOBAL(flush_disable_caches) | ||
31 | #ifndef CONFIG_6xx | ||
32 | blr | ||
33 | #else | ||
34 | BEGIN_FTR_SECTION | ||
35 | b flush_disable_745x | ||
36 | END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450) | ||
37 | BEGIN_FTR_SECTION | ||
38 | b flush_disable_75x | ||
39 | END_FTR_SECTION_IFSET(CPU_FTR_L2CR) | ||
40 | b __flush_disable_L1 | ||
41 | |||
42 | /* This is the code for G3 and 74[01]0 */ | ||
43 | flush_disable_75x: | ||
44 | mflr r10 | ||
45 | |||
46 | /* Turn off EE and DR in MSR */ | ||
47 | mfmsr r11 | ||
48 | rlwinm r0,r11,0,~MSR_EE | ||
49 | rlwinm r0,r0,0,~MSR_DR | ||
50 | sync | ||
51 | mtmsr r0 | ||
52 | isync | ||
53 | |||
54 | /* Stop DST streams */ | ||
55 | BEGIN_FTR_SECTION | ||
56 | DSSALL | ||
57 | sync | ||
58 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | ||
59 | |||
60 | /* Stop DPM */ | ||
61 | mfspr r8,SPRN_HID0 /* Save SPRN_HID0 in r8 */ | ||
62 | rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */ | ||
63 | sync | ||
64 | mtspr SPRN_HID0,r4 /* Disable DPM */ | ||
65 | sync | ||
66 | |||
67 | /* Disp-flush L1. We have a weird problem here that I never | ||
68 | * totally figured out. On 750FX, using the ROM for the flush | ||
69 | * results in a non-working flush. We use that workaround for | ||
70 | * now until I finally understand what's going on. --BenH | ||
71 | */ | ||
72 | |||
73 | /* ROM base by default */ | ||
74 | lis r4,0xfff0 | ||
75 | mfpvr r3 | ||
76 | srwi r3,r3,16 | ||
77 | cmplwi cr0,r3,0x7000 | ||
78 | bne+ 1f | ||
79 | /* RAM base on 750FX */ | ||
80 | li r4,0 | ||
81 | 1: li r4,0x4000 | ||
82 | mtctr r4 | ||
83 | 1: lwz r0,0(r4) | ||
84 | addi r4,r4,32 | ||
85 | bdnz 1b | ||
86 | sync | ||
87 | isync | ||
88 | |||
89 | /* Disable / invalidate / enable L1 data */ | ||
90 | mfspr r3,SPRN_HID0 | ||
91 | rlwinm r3,r3,0,~(HID0_DCE | HID0_ICE) | ||
92 | mtspr SPRN_HID0,r3 | ||
93 | sync | ||
94 | isync | ||
95 | ori r3,r3,(HID0_DCE|HID0_DCI|HID0_ICE|HID0_ICFI) | ||
96 | sync | ||
97 | isync | ||
98 | mtspr SPRN_HID0,r3 | ||
99 | xori r3,r3,(HID0_DCI|HID0_ICFI) | ||
100 | mtspr SPRN_HID0,r3 | ||
101 | sync | ||
102 | |||
103 | /* Get the current enable bit of the L2CR into r4 */ | ||
104 | mfspr r5,SPRN_L2CR | ||
105 | /* Set to data-only (pre-745x bit) */ | ||
106 | oris r3,r5,L2CR_L2DO@h | ||
107 | b 2f | ||
108 | /* When disabling L2, code must be in L1 */ | ||
109 | .balign 32 | ||
110 | 1: mtspr SPRN_L2CR,r3 | ||
111 | 3: sync | ||
112 | isync | ||
113 | b 1f | ||
114 | 2: b 3f | ||
115 | 3: sync | ||
116 | isync | ||
117 | b 1b | ||
118 | 1: /* disp-flush L2. The interesting thing here is that the L2 can be | ||
119 | * up to 2Mb ... so using the ROM, we'll end up wrapping back to memory | ||
120 | * but that is probbaly fine. We disp-flush over 4Mb to be safe | ||
121 | */ | ||
122 | lis r4,2 | ||
123 | mtctr r4 | ||
124 | lis r4,0xfff0 | ||
125 | 1: lwz r0,0(r4) | ||
126 | addi r4,r4,32 | ||
127 | bdnz 1b | ||
128 | sync | ||
129 | isync | ||
130 | lis r4,2 | ||
131 | mtctr r4 | ||
132 | lis r4,0xfff0 | ||
133 | 1: dcbf 0,r4 | ||
134 | addi r4,r4,32 | ||
135 | bdnz 1b | ||
136 | sync | ||
137 | isync | ||
138 | |||
139 | /* now disable L2 */ | ||
140 | rlwinm r5,r5,0,~L2CR_L2E | ||
141 | b 2f | ||
142 | /* When disabling L2, code must be in L1 */ | ||
143 | .balign 32 | ||
144 | 1: mtspr SPRN_L2CR,r5 | ||
145 | 3: sync | ||
146 | isync | ||
147 | b 1f | ||
148 | 2: b 3f | ||
149 | 3: sync | ||
150 | isync | ||
151 | b 1b | ||
152 | 1: sync | ||
153 | isync | ||
154 | /* Invalidate L2. This is pre-745x, we clear the L2I bit ourselves */ | ||
155 | oris r4,r5,L2CR_L2I@h | ||
156 | mtspr SPRN_L2CR,r4 | ||
157 | sync | ||
158 | isync | ||
159 | |||
160 | /* Wait for the invalidation to complete */ | ||
161 | 1: mfspr r3,SPRN_L2CR | ||
162 | rlwinm. r0,r3,0,31,31 | ||
163 | bne 1b | ||
164 | |||
165 | /* Clear L2I */ | ||
166 | xoris r4,r4,L2CR_L2I@h | ||
167 | sync | ||
168 | mtspr SPRN_L2CR,r4 | ||
169 | sync | ||
170 | |||
171 | /* now disable the L1 data cache */ | ||
172 | mfspr r0,SPRN_HID0 | ||
173 | rlwinm r0,r0,0,~(HID0_DCE|HID0_ICE) | ||
174 | mtspr SPRN_HID0,r0 | ||
175 | sync | ||
176 | isync | ||
177 | |||
178 | /* Restore HID0[DPM] to whatever it was before */ | ||
179 | sync | ||
180 | mfspr r0,SPRN_HID0 | ||
181 | rlwimi r0,r8,0,11,11 /* Turn back HID0[DPM] */ | ||
182 | mtspr SPRN_HID0,r0 | ||
183 | sync | ||
184 | |||
185 | /* restore DR and EE */ | ||
186 | sync | ||
187 | mtmsr r11 | ||
188 | isync | ||
189 | |||
190 | mtlr r10 | ||
191 | blr | ||
192 | |||
193 | /* This code is for 745x processors */ | ||
194 | flush_disable_745x: | ||
195 | /* Turn off EE and DR in MSR */ | ||
196 | mfmsr r11 | ||
197 | rlwinm r0,r11,0,~MSR_EE | ||
198 | rlwinm r0,r0,0,~MSR_DR | ||
199 | sync | ||
200 | mtmsr r0 | ||
201 | isync | ||
202 | |||
203 | /* Stop prefetch streams */ | ||
204 | DSSALL | ||
205 | sync | ||
206 | |||
207 | /* Disable L2 prefetching */ | ||
208 | mfspr r0,SPRN_MSSCR0 | ||
209 | rlwinm r0,r0,0,0,29 | ||
210 | mtspr SPRN_MSSCR0,r0 | ||
211 | sync | ||
212 | isync | ||
213 | lis r4,0 | ||
214 | dcbf 0,r4 | ||
215 | dcbf 0,r4 | ||
216 | dcbf 0,r4 | ||
217 | dcbf 0,r4 | ||
218 | dcbf 0,r4 | ||
219 | dcbf 0,r4 | ||
220 | dcbf 0,r4 | ||
221 | dcbf 0,r4 | ||
222 | |||
223 | /* Due to a bug with the HW flush on some CPU revs, we occasionally | ||
224 | * experience data corruption. I'm adding a displacement flush along | ||
225 | * with a dcbf loop over a few Mb to "help". The problem isn't totally | ||
226 | * fixed by this in theory, but at least, in practice, I couldn't reproduce | ||
227 | * it even with a big hammer... | ||
228 | */ | ||
229 | |||
230 | lis r4,0x0002 | ||
231 | mtctr r4 | ||
232 | li r4,0 | ||
233 | 1: | ||
234 | lwz r0,0(r4) | ||
235 | addi r4,r4,32 /* Go to start of next cache line */ | ||
236 | bdnz 1b | ||
237 | isync | ||
238 | |||
239 | /* Now, flush the first 4MB of memory */ | ||
240 | lis r4,0x0002 | ||
241 | mtctr r4 | ||
242 | li r4,0 | ||
243 | sync | ||
244 | 1: | ||
245 | dcbf 0,r4 | ||
246 | addi r4,r4,32 /* Go to start of next cache line */ | ||
247 | bdnz 1b | ||
248 | |||
249 | /* Flush and disable the L1 data cache */ | ||
250 | mfspr r6,SPRN_LDSTCR | ||
251 | lis r3,0xfff0 /* read from ROM for displacement flush */ | ||
252 | li r4,0xfe /* start with only way 0 unlocked */ | ||
253 | li r5,128 /* 128 lines in each way */ | ||
254 | 1: mtctr r5 | ||
255 | rlwimi r6,r4,0,24,31 | ||
256 | mtspr SPRN_LDSTCR,r6 | ||
257 | sync | ||
258 | isync | ||
259 | 2: lwz r0,0(r3) /* touch each cache line */ | ||
260 | addi r3,r3,32 | ||
261 | bdnz 2b | ||
262 | rlwinm r4,r4,1,24,30 /* move on to the next way */ | ||
263 | ori r4,r4,1 | ||
264 | cmpwi r4,0xff /* all done? */ | ||
265 | bne 1b | ||
266 | /* now unlock the L1 data cache */ | ||
267 | li r4,0 | ||
268 | rlwimi r6,r4,0,24,31 | ||
269 | sync | ||
270 | mtspr SPRN_LDSTCR,r6 | ||
271 | sync | ||
272 | isync | ||
273 | |||
274 | /* Flush the L2 cache using the hardware assist */ | ||
275 | mfspr r3,SPRN_L2CR | ||
276 | cmpwi r3,0 /* check if it is enabled first */ | ||
277 | bge 4f | ||
278 | oris r0,r3,(L2CR_L2IO_745x|L2CR_L2DO_745x)@h | ||
279 | b 2f | ||
280 | /* When disabling/locking L2, code must be in L1 */ | ||
281 | .balign 32 | ||
282 | 1: mtspr SPRN_L2CR,r0 /* lock the L2 cache */ | ||
283 | 3: sync | ||
284 | isync | ||
285 | b 1f | ||
286 | 2: b 3f | ||
287 | 3: sync | ||
288 | isync | ||
289 | b 1b | ||
290 | 1: sync | ||
291 | isync | ||
292 | ori r0,r3,L2CR_L2HWF_745x | ||
293 | sync | ||
294 | mtspr SPRN_L2CR,r0 /* set the hardware flush bit */ | ||
295 | 3: mfspr r0,SPRN_L2CR /* wait for it to go to 0 */ | ||
296 | andi. r0,r0,L2CR_L2HWF_745x | ||
297 | bne 3b | ||
298 | sync | ||
299 | rlwinm r3,r3,0,~L2CR_L2E | ||
300 | b 2f | ||
301 | /* When disabling L2, code must be in L1 */ | ||
302 | .balign 32 | ||
303 | 1: mtspr SPRN_L2CR,r3 /* disable the L2 cache */ | ||
304 | 3: sync | ||
305 | isync | ||
306 | b 1f | ||
307 | 2: b 3f | ||
308 | 3: sync | ||
309 | isync | ||
310 | b 1b | ||
311 | 1: sync | ||
312 | isync | ||
313 | oris r4,r3,L2CR_L2I@h | ||
314 | mtspr SPRN_L2CR,r4 | ||
315 | sync | ||
316 | isync | ||
317 | 1: mfspr r4,SPRN_L2CR | ||
318 | andis. r0,r4,L2CR_L2I@h | ||
319 | bne 1b | ||
320 | sync | ||
321 | |||
322 | BEGIN_FTR_SECTION | ||
323 | /* Flush the L3 cache using the hardware assist */ | ||
324 | 4: mfspr r3,SPRN_L3CR | ||
325 | cmpwi r3,0 /* check if it is enabled */ | ||
326 | bge 6f | ||
327 | oris r0,r3,L3CR_L3IO@h | ||
328 | ori r0,r0,L3CR_L3DO | ||
329 | sync | ||
330 | mtspr SPRN_L3CR,r0 /* lock the L3 cache */ | ||
331 | sync | ||
332 | isync | ||
333 | ori r0,r0,L3CR_L3HWF | ||
334 | sync | ||
335 | mtspr SPRN_L3CR,r0 /* set the hardware flush bit */ | ||
336 | 5: mfspr r0,SPRN_L3CR /* wait for it to go to zero */ | ||
337 | andi. r0,r0,L3CR_L3HWF | ||
338 | bne 5b | ||
339 | rlwinm r3,r3,0,~L3CR_L3E | ||
340 | sync | ||
341 | mtspr SPRN_L3CR,r3 /* disable the L3 cache */ | ||
342 | sync | ||
343 | ori r4,r3,L3CR_L3I | ||
344 | mtspr SPRN_L3CR,r4 | ||
345 | 1: mfspr r4,SPRN_L3CR | ||
346 | andi. r0,r4,L3CR_L3I | ||
347 | bne 1b | ||
348 | sync | ||
349 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) | ||
350 | |||
351 | 6: mfspr r0,SPRN_HID0 /* now disable the L1 data cache */ | ||
352 | rlwinm r0,r0,0,~HID0_DCE | ||
353 | mtspr SPRN_HID0,r0 | ||
354 | sync | ||
355 | isync | ||
356 | mtmsr r11 /* restore DR and EE */ | ||
357 | isync | ||
358 | blr | ||
359 | #endif /* CONFIG_6xx */ | ||
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c deleted file mode 100644 index fba7e4d7c0bf..000000000000 --- a/arch/ppc/platforms/pmac_cpufreq.c +++ /dev/null | |||
@@ -1,735 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/pmac_cpufreq.c | ||
3 | * | ||
4 | * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> | ||
5 | * Copyright (C) 2004 John Steele Scott <toojays@toojays.net> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * TODO: Need a big cleanup here. Basically, we need to have different | ||
12 | * cpufreq_driver structures for the different type of HW instead of the | ||
13 | * current mess. We also need to better deal with the detection of the | ||
14 | * type of machine. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/adb.h> | ||
26 | #include <linux/pmu.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/cpufreq.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/sysdev.h> | ||
31 | #include <linux/i2c.h> | ||
32 | #include <linux/hardirq.h> | ||
33 | #include <asm/prom.h> | ||
34 | #include <asm/machdep.h> | ||
35 | #include <asm/irq.h> | ||
36 | #include <asm/pmac_feature.h> | ||
37 | #include <asm/mmu_context.h> | ||
38 | #include <asm/sections.h> | ||
39 | #include <asm/cputable.h> | ||
40 | #include <asm/time.h> | ||
41 | #include <asm/system.h> | ||
42 | #include <asm/open_pic.h> | ||
43 | #include <asm/keylargo.h> | ||
44 | |||
45 | /* WARNING !!! This will cause calibrate_delay() to be called, | ||
46 | * but this is an __init function ! So you MUST go edit | ||
47 | * init/main.c to make it non-init before enabling DEBUG_FREQ | ||
48 | */ | ||
49 | #undef DEBUG_FREQ | ||
50 | |||
51 | /* | ||
52 | * There is a problem with the core cpufreq code on SMP kernels, | ||
53 | * it won't recalculate the Bogomips properly | ||
54 | */ | ||
55 | #ifdef CONFIG_SMP | ||
56 | #warning "WARNING, CPUFREQ not recommended on SMP kernels" | ||
57 | #endif | ||
58 | |||
59 | extern void low_choose_7447a_dfs(int dfs); | ||
60 | extern void low_choose_750fx_pll(int pll); | ||
61 | extern void low_sleep_handler(void); | ||
62 | |||
63 | /* | ||
64 | * Currently, PowerMac cpufreq supports only high & low frequencies | ||
65 | * that are set by the firmware | ||
66 | */ | ||
67 | static unsigned int low_freq; | ||
68 | static unsigned int hi_freq; | ||
69 | static unsigned int cur_freq; | ||
70 | static unsigned int sleep_freq; | ||
71 | |||
72 | /* | ||
73 | * Different models uses different mecanisms to switch the frequency | ||
74 | */ | ||
75 | static int (*set_speed_proc)(int low_speed); | ||
76 | static unsigned int (*get_speed_proc)(void); | ||
77 | |||
78 | /* | ||
79 | * Some definitions used by the various speedprocs | ||
80 | */ | ||
81 | static u32 voltage_gpio; | ||
82 | static u32 frequency_gpio; | ||
83 | static u32 slew_done_gpio; | ||
84 | static int no_schedule; | ||
85 | static int has_cpu_l2lve; | ||
86 | static int is_pmu_based; | ||
87 | |||
88 | /* There are only two frequency states for each processor. Values | ||
89 | * are in kHz for the time being. | ||
90 | */ | ||
91 | #define CPUFREQ_HIGH 0 | ||
92 | #define CPUFREQ_LOW 1 | ||
93 | |||
94 | static struct cpufreq_frequency_table pmac_cpu_freqs[] = { | ||
95 | {CPUFREQ_HIGH, 0}, | ||
96 | {CPUFREQ_LOW, 0}, | ||
97 | {0, CPUFREQ_TABLE_END}, | ||
98 | }; | ||
99 | |||
100 | static struct freq_attr* pmac_cpu_freqs_attr[] = { | ||
101 | &cpufreq_freq_attr_scaling_available_freqs, | ||
102 | NULL, | ||
103 | }; | ||
104 | |||
105 | static inline void local_delay(unsigned long ms) | ||
106 | { | ||
107 | if (no_schedule) | ||
108 | mdelay(ms); | ||
109 | else | ||
110 | msleep(ms); | ||
111 | } | ||
112 | |||
113 | static inline void wakeup_decrementer(void) | ||
114 | { | ||
115 | set_dec(tb_ticks_per_jiffy); | ||
116 | /* No currently-supported powerbook has a 601, | ||
117 | * so use get_tbl, not native | ||
118 | */ | ||
119 | last_jiffy_stamp(0) = tb_last_stamp = get_tbl(); | ||
120 | } | ||
121 | |||
122 | #ifdef DEBUG_FREQ | ||
123 | static inline void debug_calc_bogomips(void) | ||
124 | { | ||
125 | /* This will cause a recalc of bogomips and display the | ||
126 | * result. We backup/restore the value to avoid affecting the | ||
127 | * core cpufreq framework's own calculation. | ||
128 | */ | ||
129 | extern void calibrate_delay(void); | ||
130 | |||
131 | unsigned long save_lpj = loops_per_jiffy; | ||
132 | calibrate_delay(); | ||
133 | loops_per_jiffy = save_lpj; | ||
134 | } | ||
135 | #endif /* DEBUG_FREQ */ | ||
136 | |||
137 | /* Switch CPU speed under 750FX CPU control | ||
138 | */ | ||
139 | static int cpu_750fx_cpu_speed(int low_speed) | ||
140 | { | ||
141 | u32 hid2; | ||
142 | |||
143 | if (low_speed == 0) { | ||
144 | /* ramping up, set voltage first */ | ||
145 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05); | ||
146 | /* Make sure we sleep for at least 1ms */ | ||
147 | local_delay(10); | ||
148 | |||
149 | /* tweak L2 for high voltage */ | ||
150 | if (has_cpu_l2lve) { | ||
151 | hid2 = mfspr(SPRN_HID2); | ||
152 | hid2 &= ~0x2000; | ||
153 | mtspr(SPRN_HID2, hid2); | ||
154 | } | ||
155 | } | ||
156 | #ifdef CONFIG_6xx | ||
157 | low_choose_750fx_pll(low_speed); | ||
158 | #endif | ||
159 | if (low_speed == 1) { | ||
160 | /* tweak L2 for low voltage */ | ||
161 | if (has_cpu_l2lve) { | ||
162 | hid2 = mfspr(SPRN_HID2); | ||
163 | hid2 |= 0x2000; | ||
164 | mtspr(SPRN_HID2, hid2); | ||
165 | } | ||
166 | |||
167 | /* ramping down, set voltage last */ | ||
168 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04); | ||
169 | local_delay(10); | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static unsigned int cpu_750fx_get_cpu_speed(void) | ||
176 | { | ||
177 | if (mfspr(SPRN_HID1) & HID1_PS) | ||
178 | return low_freq; | ||
179 | else | ||
180 | return hi_freq; | ||
181 | } | ||
182 | |||
183 | /* Switch CPU speed using DFS */ | ||
184 | static int dfs_set_cpu_speed(int low_speed) | ||
185 | { | ||
186 | if (low_speed == 0) { | ||
187 | /* ramping up, set voltage first */ | ||
188 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05); | ||
189 | /* Make sure we sleep for at least 1ms */ | ||
190 | local_delay(1); | ||
191 | } | ||
192 | |||
193 | /* set frequency */ | ||
194 | #ifdef CONFIG_6xx | ||
195 | low_choose_7447a_dfs(low_speed); | ||
196 | #endif | ||
197 | udelay(100); | ||
198 | |||
199 | if (low_speed == 1) { | ||
200 | /* ramping down, set voltage last */ | ||
201 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04); | ||
202 | local_delay(1); | ||
203 | } | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static unsigned int dfs_get_cpu_speed(void) | ||
209 | { | ||
210 | if (mfspr(SPRN_HID1) & HID1_DFS) | ||
211 | return low_freq; | ||
212 | else | ||
213 | return hi_freq; | ||
214 | } | ||
215 | |||
216 | |||
217 | /* Switch CPU speed using slewing GPIOs | ||
218 | */ | ||
219 | static int gpios_set_cpu_speed(int low_speed) | ||
220 | { | ||
221 | int gpio, timeout = 0; | ||
222 | |||
223 | /* If ramping up, set voltage first */ | ||
224 | if (low_speed == 0) { | ||
225 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05); | ||
226 | /* Delay is way too big but it's ok, we schedule */ | ||
227 | local_delay(10); | ||
228 | } | ||
229 | |||
230 | /* Set frequency */ | ||
231 | gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0); | ||
232 | if (low_speed == ((gpio & 0x01) == 0)) | ||
233 | goto skip; | ||
234 | |||
235 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, frequency_gpio, | ||
236 | low_speed ? 0x04 : 0x05); | ||
237 | udelay(200); | ||
238 | do { | ||
239 | if (++timeout > 100) | ||
240 | break; | ||
241 | local_delay(1); | ||
242 | gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0); | ||
243 | } while((gpio & 0x02) == 0); | ||
244 | skip: | ||
245 | /* If ramping down, set voltage last */ | ||
246 | if (low_speed == 1) { | ||
247 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04); | ||
248 | /* Delay is way too big but it's ok, we schedule */ | ||
249 | local_delay(10); | ||
250 | } | ||
251 | |||
252 | #ifdef DEBUG_FREQ | ||
253 | debug_calc_bogomips(); | ||
254 | #endif | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | /* Switch CPU speed under PMU control | ||
260 | */ | ||
261 | static int pmu_set_cpu_speed(int low_speed) | ||
262 | { | ||
263 | struct adb_request req; | ||
264 | unsigned long save_l2cr; | ||
265 | unsigned long save_l3cr; | ||
266 | unsigned int pic_prio; | ||
267 | unsigned long flags; | ||
268 | |||
269 | preempt_disable(); | ||
270 | |||
271 | #ifdef DEBUG_FREQ | ||
272 | printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1)); | ||
273 | #endif | ||
274 | pmu_suspend(); | ||
275 | |||
276 | /* Disable all interrupt sources on openpic */ | ||
277 | pic_prio = openpic_get_priority(); | ||
278 | openpic_set_priority(0xf); | ||
279 | |||
280 | /* Make sure the decrementer won't interrupt us */ | ||
281 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
282 | /* Make sure any pending DEC interrupt occuring while we did | ||
283 | * the above didn't re-enable the DEC */ | ||
284 | mb(); | ||
285 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
286 | |||
287 | /* We can now disable MSR_EE */ | ||
288 | local_irq_save(flags); | ||
289 | |||
290 | /* Giveup the FPU & vec */ | ||
291 | enable_kernel_fp(); | ||
292 | |||
293 | #ifdef CONFIG_ALTIVEC | ||
294 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | ||
295 | enable_kernel_altivec(); | ||
296 | #endif /* CONFIG_ALTIVEC */ | ||
297 | |||
298 | /* Save & disable L2 and L3 caches */ | ||
299 | save_l3cr = _get_L3CR(); /* (returns -1 if not available) */ | ||
300 | save_l2cr = _get_L2CR(); /* (returns -1 if not available) */ | ||
301 | |||
302 | /* Send the new speed command. My assumption is that this command | ||
303 | * will cause PLL_CFG[0..3] to be changed next time CPU goes to sleep | ||
304 | */ | ||
305 | pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed); | ||
306 | while (!req.complete) | ||
307 | pmu_poll(); | ||
308 | |||
309 | /* Prepare the northbridge for the speed transition */ | ||
310 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1); | ||
311 | |||
312 | /* Call low level code to backup CPU state and recover from | ||
313 | * hardware reset | ||
314 | */ | ||
315 | low_sleep_handler(); | ||
316 | |||
317 | /* Restore the northbridge */ | ||
318 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0); | ||
319 | |||
320 | /* Restore L2 cache */ | ||
321 | if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0) | ||
322 | _set_L2CR(save_l2cr); | ||
323 | /* Restore L3 cache */ | ||
324 | if (save_l3cr != 0xffffffff && (save_l3cr & L3CR_L3E) != 0) | ||
325 | _set_L3CR(save_l3cr); | ||
326 | |||
327 | /* Restore userland MMU context */ | ||
328 | set_context(current->active_mm->context, current->active_mm->pgd); | ||
329 | |||
330 | #ifdef DEBUG_FREQ | ||
331 | printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1)); | ||
332 | #endif | ||
333 | |||
334 | /* Restore low level PMU operations */ | ||
335 | pmu_unlock(); | ||
336 | |||
337 | /* Restore decrementer */ | ||
338 | wakeup_decrementer(); | ||
339 | |||
340 | /* Restore interrupts */ | ||
341 | openpic_set_priority(pic_prio); | ||
342 | |||
343 | /* Let interrupts flow again ... */ | ||
344 | local_irq_restore(flags); | ||
345 | |||
346 | #ifdef DEBUG_FREQ | ||
347 | debug_calc_bogomips(); | ||
348 | #endif | ||
349 | |||
350 | pmu_resume(); | ||
351 | |||
352 | preempt_enable(); | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static int do_set_cpu_speed(int speed_mode, int notify) | ||
358 | { | ||
359 | struct cpufreq_freqs freqs; | ||
360 | unsigned long l3cr; | ||
361 | static unsigned long prev_l3cr; | ||
362 | |||
363 | freqs.old = cur_freq; | ||
364 | freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; | ||
365 | freqs.cpu = smp_processor_id(); | ||
366 | |||
367 | if (freqs.old == freqs.new) | ||
368 | return 0; | ||
369 | |||
370 | if (notify) | ||
371 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
372 | if (speed_mode == CPUFREQ_LOW && | ||
373 | cpu_has_feature(CPU_FTR_L3CR)) { | ||
374 | l3cr = _get_L3CR(); | ||
375 | if (l3cr & L3CR_L3E) { | ||
376 | prev_l3cr = l3cr; | ||
377 | _set_L3CR(0); | ||
378 | } | ||
379 | } | ||
380 | set_speed_proc(speed_mode == CPUFREQ_LOW); | ||
381 | if (speed_mode == CPUFREQ_HIGH && | ||
382 | cpu_has_feature(CPU_FTR_L3CR)) { | ||
383 | l3cr = _get_L3CR(); | ||
384 | if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) | ||
385 | _set_L3CR(prev_l3cr); | ||
386 | } | ||
387 | if (notify) | ||
388 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
389 | cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; | ||
390 | |||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static unsigned int pmac_cpufreq_get_speed(unsigned int cpu) | ||
395 | { | ||
396 | return cur_freq; | ||
397 | } | ||
398 | |||
399 | static int pmac_cpufreq_verify(struct cpufreq_policy *policy) | ||
400 | { | ||
401 | return cpufreq_frequency_table_verify(policy, pmac_cpu_freqs); | ||
402 | } | ||
403 | |||
404 | static int pmac_cpufreq_target( struct cpufreq_policy *policy, | ||
405 | unsigned int target_freq, | ||
406 | unsigned int relation) | ||
407 | { | ||
408 | unsigned int newstate = 0; | ||
409 | |||
410 | if (cpufreq_frequency_table_target(policy, pmac_cpu_freqs, | ||
411 | target_freq, relation, &newstate)) | ||
412 | return -EINVAL; | ||
413 | |||
414 | return do_set_cpu_speed(newstate, 1); | ||
415 | } | ||
416 | |||
417 | unsigned int pmac_get_one_cpufreq(int i) | ||
418 | { | ||
419 | /* Supports only one CPU for now */ | ||
420 | return (i == 0) ? cur_freq : 0; | ||
421 | } | ||
422 | |||
423 | static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | ||
424 | { | ||
425 | if (policy->cpu != 0) | ||
426 | return -ENODEV; | ||
427 | |||
428 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
429 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
430 | policy->cur = cur_freq; | ||
431 | |||
432 | cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu); | ||
433 | return cpufreq_frequency_table_cpuinfo(policy, pmac_cpu_freqs); | ||
434 | } | ||
435 | |||
436 | static u32 read_gpio(struct device_node *np) | ||
437 | { | ||
438 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | ||
439 | u32 offset; | ||
440 | |||
441 | if (reg == NULL) | ||
442 | return 0; | ||
443 | /* That works for all keylargos but shall be fixed properly | ||
444 | * some day... The problem is that it seems we can't rely | ||
445 | * on the "reg" property of the GPIO nodes, they are either | ||
446 | * relative to the base of KeyLargo or to the base of the | ||
447 | * GPIO space, and the device-tree doesn't help. | ||
448 | */ | ||
449 | offset = *reg; | ||
450 | if (offset < KEYLARGO_GPIO_LEVELS0) | ||
451 | offset += KEYLARGO_GPIO_LEVELS0; | ||
452 | return offset; | ||
453 | } | ||
454 | |||
455 | static int pmac_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg) | ||
456 | { | ||
457 | /* Ok, this could be made a bit smarter, but let's be robust for now. We | ||
458 | * always force a speed change to high speed before sleep, to make sure | ||
459 | * we have appropriate voltage and/or bus speed for the wakeup process, | ||
460 | * and to make sure our loops_per_jiffies are "good enough", that is will | ||
461 | * not cause too short delays if we sleep in low speed and wake in high | ||
462 | * speed.. | ||
463 | */ | ||
464 | no_schedule = 1; | ||
465 | sleep_freq = cur_freq; | ||
466 | if (cur_freq == low_freq && !is_pmu_based) | ||
467 | do_set_cpu_speed(CPUFREQ_HIGH, 0); | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | static int pmac_cpufreq_resume(struct cpufreq_policy *policy) | ||
472 | { | ||
473 | /* If we resume, first check if we have a get() function */ | ||
474 | if (get_speed_proc) | ||
475 | cur_freq = get_speed_proc(); | ||
476 | else | ||
477 | cur_freq = 0; | ||
478 | |||
479 | /* We don't, hrm... we don't really know our speed here, best | ||
480 | * is that we force a switch to whatever it was, which is | ||
481 | * probably high speed due to our suspend() routine | ||
482 | */ | ||
483 | do_set_cpu_speed(sleep_freq == low_freq ? | ||
484 | CPUFREQ_LOW : CPUFREQ_HIGH, 0); | ||
485 | |||
486 | no_schedule = 0; | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static struct cpufreq_driver pmac_cpufreq_driver = { | ||
491 | .verify = pmac_cpufreq_verify, | ||
492 | .target = pmac_cpufreq_target, | ||
493 | .get = pmac_cpufreq_get_speed, | ||
494 | .init = pmac_cpufreq_cpu_init, | ||
495 | .suspend = pmac_cpufreq_suspend, | ||
496 | .resume = pmac_cpufreq_resume, | ||
497 | .flags = CPUFREQ_PM_NO_WARN, | ||
498 | .attr = pmac_cpu_freqs_attr, | ||
499 | .name = "powermac", | ||
500 | .owner = THIS_MODULE, | ||
501 | }; | ||
502 | |||
503 | |||
504 | static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | ||
505 | { | ||
506 | struct device_node *volt_gpio_np = of_find_node_by_name(NULL, | ||
507 | "voltage-gpio"); | ||
508 | struct device_node *freq_gpio_np = of_find_node_by_name(NULL, | ||
509 | "frequency-gpio"); | ||
510 | struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, | ||
511 | "slewing-done"); | ||
512 | u32 *value; | ||
513 | |||
514 | /* | ||
515 | * Check to see if it's GPIO driven or PMU only | ||
516 | * | ||
517 | * The way we extract the GPIO address is slightly hackish, but it | ||
518 | * works well enough for now. We need to abstract the whole GPIO | ||
519 | * stuff sooner or later anyway | ||
520 | */ | ||
521 | |||
522 | if (volt_gpio_np) | ||
523 | voltage_gpio = read_gpio(volt_gpio_np); | ||
524 | if (freq_gpio_np) | ||
525 | frequency_gpio = read_gpio(freq_gpio_np); | ||
526 | if (slew_done_gpio_np) | ||
527 | slew_done_gpio = read_gpio(slew_done_gpio_np); | ||
528 | |||
529 | /* If we use the frequency GPIOs, calculate the min/max speeds based | ||
530 | * on the bus frequencies | ||
531 | */ | ||
532 | if (frequency_gpio && slew_done_gpio) { | ||
533 | int lenp, rc; | ||
534 | u32 *freqs, *ratio; | ||
535 | |||
536 | freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp); | ||
537 | lenp /= sizeof(u32); | ||
538 | if (freqs == NULL || lenp != 2) { | ||
539 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); | ||
540 | return 1; | ||
541 | } | ||
542 | ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL); | ||
543 | if (ratio == NULL) { | ||
544 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); | ||
545 | return 1; | ||
546 | } | ||
547 | |||
548 | /* Get the min/max bus frequencies */ | ||
549 | low_freq = min(freqs[0], freqs[1]); | ||
550 | hi_freq = max(freqs[0], freqs[1]); | ||
551 | |||
552 | /* Grrrr.. It _seems_ that the device-tree is lying on the low bus | ||
553 | * frequency, it claims it to be around 84Mhz on some models while | ||
554 | * it appears to be approx. 101Mhz on all. Let's hack around here... | ||
555 | * fortunately, we don't need to be too precise | ||
556 | */ | ||
557 | if (low_freq < 98000000) | ||
558 | low_freq = 101000000; | ||
559 | |||
560 | /* Convert those to CPU core clocks */ | ||
561 | low_freq = (low_freq * (*ratio)) / 2000; | ||
562 | hi_freq = (hi_freq * (*ratio)) / 2000; | ||
563 | |||
564 | /* Now we get the frequencies, we read the GPIO to see what is out current | ||
565 | * speed | ||
566 | */ | ||
567 | rc = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0); | ||
568 | cur_freq = (rc & 0x01) ? hi_freq : low_freq; | ||
569 | |||
570 | set_speed_proc = gpios_set_cpu_speed; | ||
571 | return 1; | ||
572 | } | ||
573 | |||
574 | /* If we use the PMU, look for the min & max frequencies in the | ||
575 | * device-tree | ||
576 | */ | ||
577 | value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL); | ||
578 | if (!value) | ||
579 | return 1; | ||
580 | low_freq = (*value) / 1000; | ||
581 | /* The PowerBook G4 12" (PowerBook6,1) has an error in the device-tree | ||
582 | * here */ | ||
583 | if (low_freq < 100000) | ||
584 | low_freq *= 10; | ||
585 | |||
586 | value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL); | ||
587 | if (!value) | ||
588 | return 1; | ||
589 | hi_freq = (*value) / 1000; | ||
590 | set_speed_proc = pmu_set_cpu_speed; | ||
591 | is_pmu_based = 1; | ||
592 | |||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | static int pmac_cpufreq_init_7447A(struct device_node *cpunode) | ||
597 | { | ||
598 | struct device_node *volt_gpio_np; | ||
599 | |||
600 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | ||
601 | return 1; | ||
602 | |||
603 | volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); | ||
604 | if (volt_gpio_np) | ||
605 | voltage_gpio = read_gpio(volt_gpio_np); | ||
606 | if (!voltage_gpio){ | ||
607 | printk(KERN_ERR "cpufreq: missing cpu-vcore-select gpio\n"); | ||
608 | return 1; | ||
609 | } | ||
610 | |||
611 | /* OF only reports the high frequency */ | ||
612 | hi_freq = cur_freq; | ||
613 | low_freq = cur_freq/2; | ||
614 | |||
615 | /* Read actual frequency from CPU */ | ||
616 | cur_freq = dfs_get_cpu_speed(); | ||
617 | set_speed_proc = dfs_set_cpu_speed; | ||
618 | get_speed_proc = dfs_get_cpu_speed; | ||
619 | |||
620 | return 0; | ||
621 | } | ||
622 | |||
623 | static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | ||
624 | { | ||
625 | struct device_node *volt_gpio_np; | ||
626 | u32 pvr, *value; | ||
627 | |||
628 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | ||
629 | return 1; | ||
630 | |||
631 | hi_freq = cur_freq; | ||
632 | value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL); | ||
633 | if (!value) | ||
634 | return 1; | ||
635 | low_freq = (*value) / 1000; | ||
636 | |||
637 | volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); | ||
638 | if (volt_gpio_np) | ||
639 | voltage_gpio = read_gpio(volt_gpio_np); | ||
640 | |||
641 | pvr = mfspr(SPRN_PVR); | ||
642 | has_cpu_l2lve = !((pvr & 0xf00) == 0x100); | ||
643 | |||
644 | set_speed_proc = cpu_750fx_cpu_speed; | ||
645 | get_speed_proc = cpu_750fx_get_cpu_speed; | ||
646 | cur_freq = cpu_750fx_get_cpu_speed(); | ||
647 | |||
648 | return 0; | ||
649 | } | ||
650 | |||
651 | /* Currently, we support the following machines: | ||
652 | * | ||
653 | * - Titanium PowerBook 1Ghz (PMU based, 667Mhz & 1Ghz) | ||
654 | * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz) | ||
655 | * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz) | ||
656 | * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz) | ||
657 | * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz) | ||
658 | * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage) | ||
659 | * - Recent MacRISC3 laptops | ||
660 | * - All new machines with 7447A CPUs | ||
661 | */ | ||
662 | static int __init pmac_cpufreq_setup(void) | ||
663 | { | ||
664 | struct device_node *cpunode; | ||
665 | u32 *value; | ||
666 | |||
667 | if (strstr(cmd_line, "nocpufreq")) | ||
668 | return 0; | ||
669 | |||
670 | /* Assume only one CPU */ | ||
671 | cpunode = find_type_devices("cpu"); | ||
672 | if (!cpunode) | ||
673 | goto out; | ||
674 | |||
675 | /* Get current cpu clock freq */ | ||
676 | value = (u32 *)get_property(cpunode, "clock-frequency", NULL); | ||
677 | if (!value) | ||
678 | goto out; | ||
679 | cur_freq = (*value) / 1000; | ||
680 | |||
681 | /* Check for 7447A based MacRISC3 */ | ||
682 | if (machine_is_compatible("MacRISC3") && | ||
683 | get_property(cpunode, "dynamic-power-step", NULL) && | ||
684 | PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { | ||
685 | pmac_cpufreq_init_7447A(cpunode); | ||
686 | /* Check for other MacRISC3 machines */ | ||
687 | } else if (machine_is_compatible("PowerBook3,4") || | ||
688 | machine_is_compatible("PowerBook3,5") || | ||
689 | machine_is_compatible("MacRISC3")) { | ||
690 | pmac_cpufreq_init_MacRISC3(cpunode); | ||
691 | /* Else check for iBook2 500/600 */ | ||
692 | } else if (machine_is_compatible("PowerBook4,1")) { | ||
693 | hi_freq = cur_freq; | ||
694 | low_freq = 400000; | ||
695 | set_speed_proc = pmu_set_cpu_speed; | ||
696 | is_pmu_based = 1; | ||
697 | } | ||
698 | /* Else check for TiPb 550 */ | ||
699 | else if (machine_is_compatible("PowerBook3,3") && cur_freq == 550000) { | ||
700 | hi_freq = cur_freq; | ||
701 | low_freq = 500000; | ||
702 | set_speed_proc = pmu_set_cpu_speed; | ||
703 | is_pmu_based = 1; | ||
704 | } | ||
705 | /* Else check for TiPb 400 & 500 */ | ||
706 | else if (machine_is_compatible("PowerBook3,2")) { | ||
707 | /* We only know about the 400 MHz and the 500Mhz model | ||
708 | * they both have 300 MHz as low frequency | ||
709 | */ | ||
710 | if (cur_freq < 350000 || cur_freq > 550000) | ||
711 | goto out; | ||
712 | hi_freq = cur_freq; | ||
713 | low_freq = 300000; | ||
714 | set_speed_proc = pmu_set_cpu_speed; | ||
715 | is_pmu_based = 1; | ||
716 | } | ||
717 | /* Else check for 750FX */ | ||
718 | else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) | ||
719 | pmac_cpufreq_init_750FX(cpunode); | ||
720 | out: | ||
721 | if (set_speed_proc == NULL) | ||
722 | return -ENODEV; | ||
723 | |||
724 | pmac_cpu_freqs[CPUFREQ_LOW].frequency = low_freq; | ||
725 | pmac_cpu_freqs[CPUFREQ_HIGH].frequency = hi_freq; | ||
726 | |||
727 | printk(KERN_INFO "Registering PowerMac CPU frequency driver\n"); | ||
728 | printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Boot: %d Mhz\n", | ||
729 | low_freq/1000, hi_freq/1000, cur_freq/1000); | ||
730 | |||
731 | return cpufreq_register_driver(&pmac_cpufreq_driver); | ||
732 | } | ||
733 | |||
734 | module_init(pmac_cpufreq_setup); | ||
735 | |||
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c deleted file mode 100644 index 6b7b3a150631..000000000000 --- a/arch/ppc/platforms/pmac_feature.c +++ /dev/null | |||
@@ -1,3023 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/pmac_feature.c | ||
3 | * | ||
4 | * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au) | ||
5 | * Ben. Herrenschmidt (benh@kernel.crashing.org) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * TODO: | ||
13 | * | ||
14 | * - Replace mdelay with some schedule loop if possible | ||
15 | * - Shorten some obfuscated delays on some routines (like modem | ||
16 | * power) | ||
17 | * - Refcount some clocks (see darwin) | ||
18 | * - Split split split... | ||
19 | * | ||
20 | */ | ||
21 | #include <linux/config.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/delay.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/sched.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/adb.h> | ||
29 | #include <linux/pmu.h> | ||
30 | #include <linux/ioport.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <asm/sections.h> | ||
33 | #include <asm/errno.h> | ||
34 | #include <asm/ohare.h> | ||
35 | #include <asm/heathrow.h> | ||
36 | #include <asm/keylargo.h> | ||
37 | #include <asm/uninorth.h> | ||
38 | #include <asm/io.h> | ||
39 | #include <asm/prom.h> | ||
40 | #include <asm/machdep.h> | ||
41 | #include <asm/pmac_feature.h> | ||
42 | #include <asm/dbdma.h> | ||
43 | #include <asm/pci-bridge.h> | ||
44 | #include <asm/pmac_low_i2c.h> | ||
45 | |||
46 | #undef DEBUG_FEATURE | ||
47 | |||
48 | #ifdef DEBUG_FEATURE | ||
49 | #define DBG(fmt,...) printk(KERN_DEBUG fmt) | ||
50 | #else | ||
51 | #define DBG(fmt,...) | ||
52 | #endif | ||
53 | |||
54 | #ifdef CONFIG_6xx | ||
55 | extern int powersave_lowspeed; | ||
56 | #endif | ||
57 | |||
58 | extern int powersave_nap; | ||
59 | extern struct device_node *k2_skiplist[2]; | ||
60 | |||
61 | |||
62 | /* | ||
63 | * We use a single global lock to protect accesses. Each driver has | ||
64 | * to take care of its own locking | ||
65 | */ | ||
66 | static DEFINE_SPINLOCK(feature_lock); | ||
67 | |||
68 | #define LOCK(flags) spin_lock_irqsave(&feature_lock, flags); | ||
69 | #define UNLOCK(flags) spin_unlock_irqrestore(&feature_lock, flags); | ||
70 | |||
71 | |||
72 | /* | ||
73 | * Instance of some macio stuffs | ||
74 | */ | ||
75 | struct macio_chip macio_chips[MAX_MACIO_CHIPS]; | ||
76 | |||
77 | struct macio_chip* macio_find(struct device_node* child, int type) | ||
78 | { | ||
79 | while(child) { | ||
80 | int i; | ||
81 | |||
82 | for (i=0; i < MAX_MACIO_CHIPS && macio_chips[i].of_node; i++) | ||
83 | if (child == macio_chips[i].of_node && | ||
84 | (!type || macio_chips[i].type == type)) | ||
85 | return &macio_chips[i]; | ||
86 | child = child->parent; | ||
87 | } | ||
88 | return NULL; | ||
89 | } | ||
90 | EXPORT_SYMBOL_GPL(macio_find); | ||
91 | |||
92 | static const char* macio_names[] = | ||
93 | { | ||
94 | "Unknown", | ||
95 | "Grand Central", | ||
96 | "OHare", | ||
97 | "OHareII", | ||
98 | "Heathrow", | ||
99 | "Gatwick", | ||
100 | "Paddington", | ||
101 | "Keylargo", | ||
102 | "Pangea", | ||
103 | "Intrepid", | ||
104 | "K2" | ||
105 | }; | ||
106 | |||
107 | |||
108 | |||
109 | /* | ||
110 | * Uninorth reg. access. Note that Uni-N regs are big endian | ||
111 | */ | ||
112 | |||
113 | #define UN_REG(r) (uninorth_base + ((r) >> 2)) | ||
114 | #define UN_IN(r) (in_be32(UN_REG(r))) | ||
115 | #define UN_OUT(r,v) (out_be32(UN_REG(r), (v))) | ||
116 | #define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v))) | ||
117 | #define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v))) | ||
118 | |||
119 | static struct device_node* uninorth_node; | ||
120 | static u32 __iomem * uninorth_base; | ||
121 | static u32 uninorth_rev; | ||
122 | static int uninorth_u3; | ||
123 | static void __iomem *u3_ht; | ||
124 | |||
125 | /* | ||
126 | * For each motherboard family, we have a table of functions pointers | ||
127 | * that handle the various features. | ||
128 | */ | ||
129 | |||
130 | typedef long (*feature_call)(struct device_node* node, long param, long value); | ||
131 | |||
132 | struct feature_table_entry { | ||
133 | unsigned int selector; | ||
134 | feature_call function; | ||
135 | }; | ||
136 | |||
137 | struct pmac_mb_def | ||
138 | { | ||
139 | const char* model_string; | ||
140 | const char* model_name; | ||
141 | int model_id; | ||
142 | struct feature_table_entry* features; | ||
143 | unsigned long board_flags; | ||
144 | }; | ||
145 | static struct pmac_mb_def pmac_mb; | ||
146 | |||
147 | /* | ||
148 | * Here are the chip specific feature functions | ||
149 | */ | ||
150 | |||
151 | static inline int | ||
152 | simple_feature_tweak(struct device_node* node, int type, int reg, u32 mask, int value) | ||
153 | { | ||
154 | struct macio_chip* macio; | ||
155 | unsigned long flags; | ||
156 | |||
157 | macio = macio_find(node, type); | ||
158 | if (!macio) | ||
159 | return -ENODEV; | ||
160 | LOCK(flags); | ||
161 | if (value) | ||
162 | MACIO_BIS(reg, mask); | ||
163 | else | ||
164 | MACIO_BIC(reg, mask); | ||
165 | (void)MACIO_IN32(reg); | ||
166 | UNLOCK(flags); | ||
167 | |||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | #ifndef CONFIG_POWER4 | ||
172 | |||
173 | static long | ||
174 | ohare_htw_scc_enable(struct device_node* node, long param, long value) | ||
175 | { | ||
176 | struct macio_chip* macio; | ||
177 | unsigned long chan_mask; | ||
178 | unsigned long fcr; | ||
179 | unsigned long flags; | ||
180 | int htw, trans; | ||
181 | unsigned long rmask; | ||
182 | |||
183 | macio = macio_find(node, 0); | ||
184 | if (!macio) | ||
185 | return -ENODEV; | ||
186 | if (!strcmp(node->name, "ch-a")) | ||
187 | chan_mask = MACIO_FLAG_SCCA_ON; | ||
188 | else if (!strcmp(node->name, "ch-b")) | ||
189 | chan_mask = MACIO_FLAG_SCCB_ON; | ||
190 | else | ||
191 | return -ENODEV; | ||
192 | |||
193 | htw = (macio->type == macio_heathrow || macio->type == macio_paddington | ||
194 | || macio->type == macio_gatwick); | ||
195 | /* On these machines, the HRW_SCC_TRANS_EN_N bit mustn't be touched */ | ||
196 | trans = (pmac_mb.model_id != PMAC_TYPE_YOSEMITE && | ||
197 | pmac_mb.model_id != PMAC_TYPE_YIKES); | ||
198 | if (value) { | ||
199 | #ifdef CONFIG_ADB_PMU | ||
200 | if ((param & 0xfff) == PMAC_SCC_IRDA) | ||
201 | pmu_enable_irled(1); | ||
202 | #endif /* CONFIG_ADB_PMU */ | ||
203 | LOCK(flags); | ||
204 | fcr = MACIO_IN32(OHARE_FCR); | ||
205 | /* Check if scc cell need enabling */ | ||
206 | if (!(fcr & OH_SCC_ENABLE)) { | ||
207 | fcr |= OH_SCC_ENABLE; | ||
208 | if (htw) { | ||
209 | /* Side effect: this will also power up the | ||
210 | * modem, but it's too messy to figure out on which | ||
211 | * ports this controls the tranceiver and on which | ||
212 | * it controls the modem | ||
213 | */ | ||
214 | if (trans) | ||
215 | fcr &= ~HRW_SCC_TRANS_EN_N; | ||
216 | MACIO_OUT32(OHARE_FCR, fcr); | ||
217 | fcr |= (rmask = HRW_RESET_SCC); | ||
218 | MACIO_OUT32(OHARE_FCR, fcr); | ||
219 | } else { | ||
220 | fcr |= (rmask = OH_SCC_RESET); | ||
221 | MACIO_OUT32(OHARE_FCR, fcr); | ||
222 | } | ||
223 | UNLOCK(flags); | ||
224 | (void)MACIO_IN32(OHARE_FCR); | ||
225 | mdelay(15); | ||
226 | LOCK(flags); | ||
227 | fcr &= ~rmask; | ||
228 | MACIO_OUT32(OHARE_FCR, fcr); | ||
229 | } | ||
230 | if (chan_mask & MACIO_FLAG_SCCA_ON) | ||
231 | fcr |= OH_SCCA_IO; | ||
232 | if (chan_mask & MACIO_FLAG_SCCB_ON) | ||
233 | fcr |= OH_SCCB_IO; | ||
234 | MACIO_OUT32(OHARE_FCR, fcr); | ||
235 | macio->flags |= chan_mask; | ||
236 | UNLOCK(flags); | ||
237 | if (param & PMAC_SCC_FLAG_XMON) | ||
238 | macio->flags |= MACIO_FLAG_SCC_LOCKED; | ||
239 | } else { | ||
240 | if (macio->flags & MACIO_FLAG_SCC_LOCKED) | ||
241 | return -EPERM; | ||
242 | LOCK(flags); | ||
243 | fcr = MACIO_IN32(OHARE_FCR); | ||
244 | if (chan_mask & MACIO_FLAG_SCCA_ON) | ||
245 | fcr &= ~OH_SCCA_IO; | ||
246 | if (chan_mask & MACIO_FLAG_SCCB_ON) | ||
247 | fcr &= ~OH_SCCB_IO; | ||
248 | MACIO_OUT32(OHARE_FCR, fcr); | ||
249 | if ((fcr & (OH_SCCA_IO | OH_SCCB_IO)) == 0) { | ||
250 | fcr &= ~OH_SCC_ENABLE; | ||
251 | if (htw && trans) | ||
252 | fcr |= HRW_SCC_TRANS_EN_N; | ||
253 | MACIO_OUT32(OHARE_FCR, fcr); | ||
254 | } | ||
255 | macio->flags &= ~(chan_mask); | ||
256 | UNLOCK(flags); | ||
257 | mdelay(10); | ||
258 | #ifdef CONFIG_ADB_PMU | ||
259 | if ((param & 0xfff) == PMAC_SCC_IRDA) | ||
260 | pmu_enable_irled(0); | ||
261 | #endif /* CONFIG_ADB_PMU */ | ||
262 | } | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static long | ||
267 | ohare_floppy_enable(struct device_node* node, long param, long value) | ||
268 | { | ||
269 | return simple_feature_tweak(node, macio_ohare, | ||
270 | OHARE_FCR, OH_FLOPPY_ENABLE, value); | ||
271 | } | ||
272 | |||
273 | static long | ||
274 | ohare_mesh_enable(struct device_node* node, long param, long value) | ||
275 | { | ||
276 | return simple_feature_tweak(node, macio_ohare, | ||
277 | OHARE_FCR, OH_MESH_ENABLE, value); | ||
278 | } | ||
279 | |||
280 | static long | ||
281 | ohare_ide_enable(struct device_node* node, long param, long value) | ||
282 | { | ||
283 | switch(param) { | ||
284 | case 0: | ||
285 | /* For some reason, setting the bit in set_initial_features() | ||
286 | * doesn't stick. I'm still investigating... --BenH. | ||
287 | */ | ||
288 | if (value) | ||
289 | simple_feature_tweak(node, macio_ohare, | ||
290 | OHARE_FCR, OH_IOBUS_ENABLE, 1); | ||
291 | return simple_feature_tweak(node, macio_ohare, | ||
292 | OHARE_FCR, OH_IDE0_ENABLE, value); | ||
293 | case 1: | ||
294 | return simple_feature_tweak(node, macio_ohare, | ||
295 | OHARE_FCR, OH_BAY_IDE_ENABLE, value); | ||
296 | default: | ||
297 | return -ENODEV; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | static long | ||
302 | ohare_ide_reset(struct device_node* node, long param, long value) | ||
303 | { | ||
304 | switch(param) { | ||
305 | case 0: | ||
306 | return simple_feature_tweak(node, macio_ohare, | ||
307 | OHARE_FCR, OH_IDE0_RESET_N, !value); | ||
308 | case 1: | ||
309 | return simple_feature_tweak(node, macio_ohare, | ||
310 | OHARE_FCR, OH_IDE1_RESET_N, !value); | ||
311 | default: | ||
312 | return -ENODEV; | ||
313 | } | ||
314 | } | ||
315 | |||
316 | static long | ||
317 | ohare_sleep_state(struct device_node* node, long param, long value) | ||
318 | { | ||
319 | struct macio_chip* macio = &macio_chips[0]; | ||
320 | |||
321 | if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0) | ||
322 | return -EPERM; | ||
323 | if (value == 1) { | ||
324 | MACIO_BIC(OHARE_FCR, OH_IOBUS_ENABLE); | ||
325 | } else if (value == 0) { | ||
326 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | ||
327 | } | ||
328 | |||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | static long | ||
333 | heathrow_modem_enable(struct device_node* node, long param, long value) | ||
334 | { | ||
335 | struct macio_chip* macio; | ||
336 | u8 gpio; | ||
337 | unsigned long flags; | ||
338 | |||
339 | macio = macio_find(node, macio_unknown); | ||
340 | if (!macio) | ||
341 | return -ENODEV; | ||
342 | gpio = MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1; | ||
343 | if (!value) { | ||
344 | LOCK(flags); | ||
345 | MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio); | ||
346 | UNLOCK(flags); | ||
347 | (void)MACIO_IN8(HRW_GPIO_MODEM_RESET); | ||
348 | mdelay(250); | ||
349 | } | ||
350 | if (pmac_mb.model_id != PMAC_TYPE_YOSEMITE && | ||
351 | pmac_mb.model_id != PMAC_TYPE_YIKES) { | ||
352 | LOCK(flags); | ||
353 | if (value) | ||
354 | MACIO_BIC(HEATHROW_FCR, HRW_SCC_TRANS_EN_N); | ||
355 | else | ||
356 | MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N); | ||
357 | UNLOCK(flags); | ||
358 | (void)MACIO_IN32(HEATHROW_FCR); | ||
359 | mdelay(250); | ||
360 | } | ||
361 | if (value) { | ||
362 | LOCK(flags); | ||
363 | MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1); | ||
364 | (void)MACIO_IN8(HRW_GPIO_MODEM_RESET); | ||
365 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
366 | MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio); | ||
367 | (void)MACIO_IN8(HRW_GPIO_MODEM_RESET); | ||
368 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
369 | MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1); | ||
370 | (void)MACIO_IN8(HRW_GPIO_MODEM_RESET); | ||
371 | UNLOCK(flags); mdelay(250); | ||
372 | } | ||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | static long | ||
377 | heathrow_floppy_enable(struct device_node* node, long param, long value) | ||
378 | { | ||
379 | return simple_feature_tweak(node, macio_unknown, | ||
380 | HEATHROW_FCR, | ||
381 | HRW_SWIM_ENABLE|HRW_BAY_FLOPPY_ENABLE, | ||
382 | value); | ||
383 | } | ||
384 | |||
385 | static long | ||
386 | heathrow_mesh_enable(struct device_node* node, long param, long value) | ||
387 | { | ||
388 | struct macio_chip* macio; | ||
389 | unsigned long flags; | ||
390 | |||
391 | macio = macio_find(node, macio_unknown); | ||
392 | if (!macio) | ||
393 | return -ENODEV; | ||
394 | LOCK(flags); | ||
395 | /* Set clear mesh cell enable */ | ||
396 | if (value) | ||
397 | MACIO_BIS(HEATHROW_FCR, HRW_MESH_ENABLE); | ||
398 | else | ||
399 | MACIO_BIC(HEATHROW_FCR, HRW_MESH_ENABLE); | ||
400 | (void)MACIO_IN32(HEATHROW_FCR); | ||
401 | udelay(10); | ||
402 | /* Set/Clear termination power */ | ||
403 | if (value) | ||
404 | MACIO_BIC(HEATHROW_MBCR, 0x04000000); | ||
405 | else | ||
406 | MACIO_BIS(HEATHROW_MBCR, 0x04000000); | ||
407 | (void)MACIO_IN32(HEATHROW_MBCR); | ||
408 | udelay(10); | ||
409 | UNLOCK(flags); | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static long | ||
415 | heathrow_ide_enable(struct device_node* node, long param, long value) | ||
416 | { | ||
417 | switch(param) { | ||
418 | case 0: | ||
419 | return simple_feature_tweak(node, macio_unknown, | ||
420 | HEATHROW_FCR, HRW_IDE0_ENABLE, value); | ||
421 | case 1: | ||
422 | return simple_feature_tweak(node, macio_unknown, | ||
423 | HEATHROW_FCR, HRW_BAY_IDE_ENABLE, value); | ||
424 | default: | ||
425 | return -ENODEV; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | static long | ||
430 | heathrow_ide_reset(struct device_node* node, long param, long value) | ||
431 | { | ||
432 | switch(param) { | ||
433 | case 0: | ||
434 | return simple_feature_tweak(node, macio_unknown, | ||
435 | HEATHROW_FCR, HRW_IDE0_RESET_N, !value); | ||
436 | case 1: | ||
437 | return simple_feature_tweak(node, macio_unknown, | ||
438 | HEATHROW_FCR, HRW_IDE1_RESET_N, !value); | ||
439 | default: | ||
440 | return -ENODEV; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | static long | ||
445 | heathrow_bmac_enable(struct device_node* node, long param, long value) | ||
446 | { | ||
447 | struct macio_chip* macio; | ||
448 | unsigned long flags; | ||
449 | |||
450 | macio = macio_find(node, 0); | ||
451 | if (!macio) | ||
452 | return -ENODEV; | ||
453 | if (value) { | ||
454 | LOCK(flags); | ||
455 | MACIO_BIS(HEATHROW_FCR, HRW_BMAC_IO_ENABLE); | ||
456 | MACIO_BIS(HEATHROW_FCR, HRW_BMAC_RESET); | ||
457 | UNLOCK(flags); | ||
458 | (void)MACIO_IN32(HEATHROW_FCR); | ||
459 | mdelay(10); | ||
460 | LOCK(flags); | ||
461 | MACIO_BIC(HEATHROW_FCR, HRW_BMAC_RESET); | ||
462 | UNLOCK(flags); | ||
463 | (void)MACIO_IN32(HEATHROW_FCR); | ||
464 | mdelay(10); | ||
465 | } else { | ||
466 | LOCK(flags); | ||
467 | MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE); | ||
468 | UNLOCK(flags); | ||
469 | } | ||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | static long | ||
474 | heathrow_sound_enable(struct device_node* node, long param, long value) | ||
475 | { | ||
476 | struct macio_chip* macio; | ||
477 | unsigned long flags; | ||
478 | |||
479 | /* B&W G3 and Yikes don't support that properly (the | ||
480 | * sound appear to never come back after beeing shut down). | ||
481 | */ | ||
482 | if (pmac_mb.model_id == PMAC_TYPE_YOSEMITE || | ||
483 | pmac_mb.model_id == PMAC_TYPE_YIKES) | ||
484 | return 0; | ||
485 | |||
486 | macio = macio_find(node, 0); | ||
487 | if (!macio) | ||
488 | return -ENODEV; | ||
489 | if (value) { | ||
490 | LOCK(flags); | ||
491 | MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE); | ||
492 | MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N); | ||
493 | UNLOCK(flags); | ||
494 | (void)MACIO_IN32(HEATHROW_FCR); | ||
495 | } else { | ||
496 | LOCK(flags); | ||
497 | MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N); | ||
498 | MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE); | ||
499 | UNLOCK(flags); | ||
500 | } | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | static u32 save_fcr[6]; | ||
505 | static u32 save_mbcr; | ||
506 | static u32 save_gpio_levels[2]; | ||
507 | static u8 save_gpio_extint[KEYLARGO_GPIO_EXTINT_CNT]; | ||
508 | static u8 save_gpio_normal[KEYLARGO_GPIO_CNT]; | ||
509 | static u32 save_unin_clock_ctl; | ||
510 | static struct dbdma_regs save_dbdma[13]; | ||
511 | static struct dbdma_regs save_alt_dbdma[13]; | ||
512 | |||
513 | static void | ||
514 | dbdma_save(struct macio_chip* macio, struct dbdma_regs* save) | ||
515 | { | ||
516 | int i; | ||
517 | |||
518 | /* Save state & config of DBDMA channels */ | ||
519 | for (i=0; i<13; i++) { | ||
520 | volatile struct dbdma_regs __iomem * chan = (void __iomem *) | ||
521 | (macio->base + ((0x8000+i*0x100)>>2)); | ||
522 | save[i].cmdptr_hi = in_le32(&chan->cmdptr_hi); | ||
523 | save[i].cmdptr = in_le32(&chan->cmdptr); | ||
524 | save[i].intr_sel = in_le32(&chan->intr_sel); | ||
525 | save[i].br_sel = in_le32(&chan->br_sel); | ||
526 | save[i].wait_sel = in_le32(&chan->wait_sel); | ||
527 | } | ||
528 | } | ||
529 | |||
530 | static void | ||
531 | dbdma_restore(struct macio_chip* macio, struct dbdma_regs* save) | ||
532 | { | ||
533 | int i; | ||
534 | |||
535 | /* Save state & config of DBDMA channels */ | ||
536 | for (i=0; i<13; i++) { | ||
537 | volatile struct dbdma_regs __iomem * chan = (void __iomem *) | ||
538 | (macio->base + ((0x8000+i*0x100)>>2)); | ||
539 | out_le32(&chan->control, (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16); | ||
540 | while (in_le32(&chan->status) & ACTIVE) | ||
541 | mb(); | ||
542 | out_le32(&chan->cmdptr_hi, save[i].cmdptr_hi); | ||
543 | out_le32(&chan->cmdptr, save[i].cmdptr); | ||
544 | out_le32(&chan->intr_sel, save[i].intr_sel); | ||
545 | out_le32(&chan->br_sel, save[i].br_sel); | ||
546 | out_le32(&chan->wait_sel, save[i].wait_sel); | ||
547 | } | ||
548 | } | ||
549 | |||
550 | static void | ||
551 | heathrow_sleep(struct macio_chip* macio, int secondary) | ||
552 | { | ||
553 | if (secondary) { | ||
554 | dbdma_save(macio, save_alt_dbdma); | ||
555 | save_fcr[2] = MACIO_IN32(0x38); | ||
556 | save_fcr[3] = MACIO_IN32(0x3c); | ||
557 | } else { | ||
558 | dbdma_save(macio, save_dbdma); | ||
559 | save_fcr[0] = MACIO_IN32(0x38); | ||
560 | save_fcr[1] = MACIO_IN32(0x3c); | ||
561 | save_mbcr = MACIO_IN32(0x34); | ||
562 | /* Make sure sound is shut down */ | ||
563 | MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N); | ||
564 | MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE); | ||
565 | /* This seems to be necessary as well or the fan | ||
566 | * keeps coming up and battery drains fast */ | ||
567 | MACIO_BIC(HEATHROW_FCR, HRW_IOBUS_ENABLE); | ||
568 | MACIO_BIC(HEATHROW_FCR, HRW_IDE0_RESET_N); | ||
569 | /* Make sure eth is down even if module or sleep | ||
570 | * won't work properly */ | ||
571 | MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE | HRW_BMAC_RESET); | ||
572 | } | ||
573 | /* Make sure modem is shut down */ | ||
574 | MACIO_OUT8(HRW_GPIO_MODEM_RESET, | ||
575 | MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1); | ||
576 | MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N); | ||
577 | MACIO_BIC(HEATHROW_FCR, OH_SCCA_IO|OH_SCCB_IO|HRW_SCC_ENABLE); | ||
578 | |||
579 | /* Let things settle */ | ||
580 | (void)MACIO_IN32(HEATHROW_FCR); | ||
581 | } | ||
582 | |||
583 | static void | ||
584 | heathrow_wakeup(struct macio_chip* macio, int secondary) | ||
585 | { | ||
586 | if (secondary) { | ||
587 | MACIO_OUT32(0x38, save_fcr[2]); | ||
588 | (void)MACIO_IN32(0x38); | ||
589 | mdelay(1); | ||
590 | MACIO_OUT32(0x3c, save_fcr[3]); | ||
591 | (void)MACIO_IN32(0x38); | ||
592 | mdelay(10); | ||
593 | dbdma_restore(macio, save_alt_dbdma); | ||
594 | } else { | ||
595 | MACIO_OUT32(0x38, save_fcr[0] | HRW_IOBUS_ENABLE); | ||
596 | (void)MACIO_IN32(0x38); | ||
597 | mdelay(1); | ||
598 | MACIO_OUT32(0x3c, save_fcr[1]); | ||
599 | (void)MACIO_IN32(0x38); | ||
600 | mdelay(1); | ||
601 | MACIO_OUT32(0x34, save_mbcr); | ||
602 | (void)MACIO_IN32(0x38); | ||
603 | mdelay(10); | ||
604 | dbdma_restore(macio, save_dbdma); | ||
605 | } | ||
606 | } | ||
607 | |||
608 | static long | ||
609 | heathrow_sleep_state(struct device_node* node, long param, long value) | ||
610 | { | ||
611 | if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0) | ||
612 | return -EPERM; | ||
613 | if (value == 1) { | ||
614 | if (macio_chips[1].type == macio_gatwick) | ||
615 | heathrow_sleep(&macio_chips[0], 1); | ||
616 | heathrow_sleep(&macio_chips[0], 0); | ||
617 | } else if (value == 0) { | ||
618 | heathrow_wakeup(&macio_chips[0], 0); | ||
619 | if (macio_chips[1].type == macio_gatwick) | ||
620 | heathrow_wakeup(&macio_chips[0], 1); | ||
621 | } | ||
622 | return 0; | ||
623 | } | ||
624 | |||
625 | static long | ||
626 | core99_scc_enable(struct device_node* node, long param, long value) | ||
627 | { | ||
628 | struct macio_chip* macio; | ||
629 | unsigned long flags; | ||
630 | unsigned long chan_mask; | ||
631 | u32 fcr; | ||
632 | |||
633 | macio = macio_find(node, 0); | ||
634 | if (!macio) | ||
635 | return -ENODEV; | ||
636 | if (!strcmp(node->name, "ch-a")) | ||
637 | chan_mask = MACIO_FLAG_SCCA_ON; | ||
638 | else if (!strcmp(node->name, "ch-b")) | ||
639 | chan_mask = MACIO_FLAG_SCCB_ON; | ||
640 | else | ||
641 | return -ENODEV; | ||
642 | |||
643 | if (value) { | ||
644 | int need_reset_scc = 0; | ||
645 | int need_reset_irda = 0; | ||
646 | |||
647 | LOCK(flags); | ||
648 | fcr = MACIO_IN32(KEYLARGO_FCR0); | ||
649 | /* Check if scc cell need enabling */ | ||
650 | if (!(fcr & KL0_SCC_CELL_ENABLE)) { | ||
651 | fcr |= KL0_SCC_CELL_ENABLE; | ||
652 | need_reset_scc = 1; | ||
653 | } | ||
654 | if (chan_mask & MACIO_FLAG_SCCA_ON) { | ||
655 | fcr |= KL0_SCCA_ENABLE; | ||
656 | /* Don't enable line drivers for I2S modem */ | ||
657 | if ((param & 0xfff) == PMAC_SCC_I2S1) | ||
658 | fcr &= ~KL0_SCC_A_INTF_ENABLE; | ||
659 | else | ||
660 | fcr |= KL0_SCC_A_INTF_ENABLE; | ||
661 | } | ||
662 | if (chan_mask & MACIO_FLAG_SCCB_ON) { | ||
663 | fcr |= KL0_SCCB_ENABLE; | ||
664 | /* Perform irda specific inits */ | ||
665 | if ((param & 0xfff) == PMAC_SCC_IRDA) { | ||
666 | fcr &= ~KL0_SCC_B_INTF_ENABLE; | ||
667 | fcr |= KL0_IRDA_ENABLE; | ||
668 | fcr |= KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE; | ||
669 | fcr |= KL0_IRDA_SOURCE1_SEL; | ||
670 | fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0); | ||
671 | fcr &= ~(KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND); | ||
672 | need_reset_irda = 1; | ||
673 | } else | ||
674 | fcr |= KL0_SCC_B_INTF_ENABLE; | ||
675 | } | ||
676 | MACIO_OUT32(KEYLARGO_FCR0, fcr); | ||
677 | macio->flags |= chan_mask; | ||
678 | if (need_reset_scc) { | ||
679 | MACIO_BIS(KEYLARGO_FCR0, KL0_SCC_RESET); | ||
680 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
681 | UNLOCK(flags); | ||
682 | mdelay(15); | ||
683 | LOCK(flags); | ||
684 | MACIO_BIC(KEYLARGO_FCR0, KL0_SCC_RESET); | ||
685 | } | ||
686 | if (need_reset_irda) { | ||
687 | MACIO_BIS(KEYLARGO_FCR0, KL0_IRDA_RESET); | ||
688 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
689 | UNLOCK(flags); | ||
690 | mdelay(15); | ||
691 | LOCK(flags); | ||
692 | MACIO_BIC(KEYLARGO_FCR0, KL0_IRDA_RESET); | ||
693 | } | ||
694 | UNLOCK(flags); | ||
695 | if (param & PMAC_SCC_FLAG_XMON) | ||
696 | macio->flags |= MACIO_FLAG_SCC_LOCKED; | ||
697 | } else { | ||
698 | if (macio->flags & MACIO_FLAG_SCC_LOCKED) | ||
699 | return -EPERM; | ||
700 | LOCK(flags); | ||
701 | fcr = MACIO_IN32(KEYLARGO_FCR0); | ||
702 | if (chan_mask & MACIO_FLAG_SCCA_ON) | ||
703 | fcr &= ~KL0_SCCA_ENABLE; | ||
704 | if (chan_mask & MACIO_FLAG_SCCB_ON) { | ||
705 | fcr &= ~KL0_SCCB_ENABLE; | ||
706 | /* Perform irda specific clears */ | ||
707 | if ((param & 0xfff) == PMAC_SCC_IRDA) { | ||
708 | fcr &= ~KL0_IRDA_ENABLE; | ||
709 | fcr &= ~(KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE); | ||
710 | fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0); | ||
711 | fcr &= ~(KL0_IRDA_SOURCE1_SEL|KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND); | ||
712 | } | ||
713 | } | ||
714 | MACIO_OUT32(KEYLARGO_FCR0, fcr); | ||
715 | if ((fcr & (KL0_SCCA_ENABLE | KL0_SCCB_ENABLE)) == 0) { | ||
716 | fcr &= ~KL0_SCC_CELL_ENABLE; | ||
717 | MACIO_OUT32(KEYLARGO_FCR0, fcr); | ||
718 | } | ||
719 | macio->flags &= ~(chan_mask); | ||
720 | UNLOCK(flags); | ||
721 | mdelay(10); | ||
722 | } | ||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | static long | ||
727 | core99_modem_enable(struct device_node* node, long param, long value) | ||
728 | { | ||
729 | struct macio_chip* macio; | ||
730 | u8 gpio; | ||
731 | unsigned long flags; | ||
732 | |||
733 | /* Hack for internal USB modem */ | ||
734 | if (node == NULL) { | ||
735 | if (macio_chips[0].type != macio_keylargo) | ||
736 | return -ENODEV; | ||
737 | node = macio_chips[0].of_node; | ||
738 | } | ||
739 | macio = macio_find(node, 0); | ||
740 | if (!macio) | ||
741 | return -ENODEV; | ||
742 | gpio = MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
743 | gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE; | ||
744 | gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA; | ||
745 | |||
746 | if (!value) { | ||
747 | LOCK(flags); | ||
748 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio); | ||
749 | UNLOCK(flags); | ||
750 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
751 | mdelay(250); | ||
752 | } | ||
753 | LOCK(flags); | ||
754 | if (value) { | ||
755 | MACIO_BIC(KEYLARGO_FCR2, KL2_ALT_DATA_OUT); | ||
756 | UNLOCK(flags); | ||
757 | (void)MACIO_IN32(KEYLARGO_FCR2); | ||
758 | mdelay(250); | ||
759 | } else { | ||
760 | MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT); | ||
761 | UNLOCK(flags); | ||
762 | } | ||
763 | if (value) { | ||
764 | LOCK(flags); | ||
765 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA); | ||
766 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
767 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
768 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio); | ||
769 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
770 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
771 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA); | ||
772 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
773 | UNLOCK(flags); mdelay(250); | ||
774 | } | ||
775 | return 0; | ||
776 | } | ||
777 | |||
778 | static long | ||
779 | pangea_modem_enable(struct device_node* node, long param, long value) | ||
780 | { | ||
781 | struct macio_chip* macio; | ||
782 | u8 gpio; | ||
783 | unsigned long flags; | ||
784 | |||
785 | /* Hack for internal USB modem */ | ||
786 | if (node == NULL) { | ||
787 | if (macio_chips[0].type != macio_pangea && | ||
788 | macio_chips[0].type != macio_intrepid) | ||
789 | return -ENODEV; | ||
790 | node = macio_chips[0].of_node; | ||
791 | } | ||
792 | macio = macio_find(node, 0); | ||
793 | if (!macio) | ||
794 | return -ENODEV; | ||
795 | gpio = MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
796 | gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE; | ||
797 | gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA; | ||
798 | |||
799 | if (!value) { | ||
800 | LOCK(flags); | ||
801 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio); | ||
802 | UNLOCK(flags); | ||
803 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
804 | mdelay(250); | ||
805 | } | ||
806 | LOCK(flags); | ||
807 | if (value) { | ||
808 | MACIO_OUT8(KL_GPIO_MODEM_POWER, | ||
809 | KEYLARGO_GPIO_OUTPUT_ENABLE); | ||
810 | UNLOCK(flags); | ||
811 | (void)MACIO_IN32(KEYLARGO_FCR2); | ||
812 | mdelay(250); | ||
813 | } else { | ||
814 | MACIO_OUT8(KL_GPIO_MODEM_POWER, | ||
815 | KEYLARGO_GPIO_OUTPUT_ENABLE | KEYLARGO_GPIO_OUTOUT_DATA); | ||
816 | UNLOCK(flags); | ||
817 | } | ||
818 | if (value) { | ||
819 | LOCK(flags); | ||
820 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA); | ||
821 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
822 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
823 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio); | ||
824 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
825 | UNLOCK(flags); mdelay(250); LOCK(flags); | ||
826 | MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA); | ||
827 | (void)MACIO_IN8(KL_GPIO_MODEM_RESET); | ||
828 | UNLOCK(flags); mdelay(250); | ||
829 | } | ||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | static long | ||
834 | core99_ata100_enable(struct device_node* node, long value) | ||
835 | { | ||
836 | unsigned long flags; | ||
837 | struct pci_dev *pdev = NULL; | ||
838 | u8 pbus, pid; | ||
839 | |||
840 | if (uninorth_rev < 0x24) | ||
841 | return -ENODEV; | ||
842 | |||
843 | LOCK(flags); | ||
844 | if (value) | ||
845 | UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100); | ||
846 | else | ||
847 | UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100); | ||
848 | (void)UN_IN(UNI_N_CLOCK_CNTL); | ||
849 | UNLOCK(flags); | ||
850 | udelay(20); | ||
851 | |||
852 | if (value) { | ||
853 | if (pci_device_from_OF_node(node, &pbus, &pid) == 0) | ||
854 | pdev = pci_find_slot(pbus, pid); | ||
855 | if (pdev == NULL) | ||
856 | return 0; | ||
857 | pci_enable_device(pdev); | ||
858 | pci_set_master(pdev); | ||
859 | } | ||
860 | return 0; | ||
861 | } | ||
862 | |||
863 | static long | ||
864 | core99_ide_enable(struct device_node* node, long param, long value) | ||
865 | { | ||
866 | /* Bus ID 0 to 2 are KeyLargo based IDE, busID 3 is U2 | ||
867 | * based ata-100 | ||
868 | */ | ||
869 | switch(param) { | ||
870 | case 0: | ||
871 | return simple_feature_tweak(node, macio_unknown, | ||
872 | KEYLARGO_FCR1, KL1_EIDE0_ENABLE, value); | ||
873 | case 1: | ||
874 | return simple_feature_tweak(node, macio_unknown, | ||
875 | KEYLARGO_FCR1, KL1_EIDE1_ENABLE, value); | ||
876 | case 2: | ||
877 | return simple_feature_tweak(node, macio_unknown, | ||
878 | KEYLARGO_FCR1, KL1_UIDE_ENABLE, value); | ||
879 | case 3: | ||
880 | return core99_ata100_enable(node, value); | ||
881 | default: | ||
882 | return -ENODEV; | ||
883 | } | ||
884 | } | ||
885 | |||
886 | static long | ||
887 | core99_ide_reset(struct device_node* node, long param, long value) | ||
888 | { | ||
889 | switch(param) { | ||
890 | case 0: | ||
891 | return simple_feature_tweak(node, macio_unknown, | ||
892 | KEYLARGO_FCR1, KL1_EIDE0_RESET_N, !value); | ||
893 | case 1: | ||
894 | return simple_feature_tweak(node, macio_unknown, | ||
895 | KEYLARGO_FCR1, KL1_EIDE1_RESET_N, !value); | ||
896 | case 2: | ||
897 | return simple_feature_tweak(node, macio_unknown, | ||
898 | KEYLARGO_FCR1, KL1_UIDE_RESET_N, !value); | ||
899 | default: | ||
900 | return -ENODEV; | ||
901 | } | ||
902 | } | ||
903 | |||
904 | static long | ||
905 | core99_gmac_enable(struct device_node* node, long param, long value) | ||
906 | { | ||
907 | unsigned long flags; | ||
908 | |||
909 | LOCK(flags); | ||
910 | if (value) | ||
911 | UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC); | ||
912 | else | ||
913 | UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC); | ||
914 | (void)UN_IN(UNI_N_CLOCK_CNTL); | ||
915 | UNLOCK(flags); | ||
916 | udelay(20); | ||
917 | |||
918 | return 0; | ||
919 | } | ||
920 | |||
921 | static long | ||
922 | core99_gmac_phy_reset(struct device_node* node, long param, long value) | ||
923 | { | ||
924 | unsigned long flags; | ||
925 | struct macio_chip* macio; | ||
926 | |||
927 | macio = &macio_chips[0]; | ||
928 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
929 | macio->type != macio_intrepid) | ||
930 | return -ENODEV; | ||
931 | |||
932 | LOCK(flags); | ||
933 | MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, KEYLARGO_GPIO_OUTPUT_ENABLE); | ||
934 | (void)MACIO_IN8(KL_GPIO_ETH_PHY_RESET); | ||
935 | UNLOCK(flags); | ||
936 | mdelay(10); | ||
937 | LOCK(flags); | ||
938 | MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, /*KEYLARGO_GPIO_OUTPUT_ENABLE | */ | ||
939 | KEYLARGO_GPIO_OUTOUT_DATA); | ||
940 | UNLOCK(flags); | ||
941 | mdelay(10); | ||
942 | |||
943 | return 0; | ||
944 | } | ||
945 | |||
946 | static long | ||
947 | core99_sound_chip_enable(struct device_node* node, long param, long value) | ||
948 | { | ||
949 | struct macio_chip* macio; | ||
950 | unsigned long flags; | ||
951 | |||
952 | macio = macio_find(node, 0); | ||
953 | if (!macio) | ||
954 | return -ENODEV; | ||
955 | |||
956 | /* Do a better probe code, screamer G4 desktops & | ||
957 | * iMacs can do that too, add a recalibrate in | ||
958 | * the driver as well | ||
959 | */ | ||
960 | if (pmac_mb.model_id == PMAC_TYPE_PISMO || | ||
961 | pmac_mb.model_id == PMAC_TYPE_TITANIUM) { | ||
962 | LOCK(flags); | ||
963 | if (value) | ||
964 | MACIO_OUT8(KL_GPIO_SOUND_POWER, | ||
965 | KEYLARGO_GPIO_OUTPUT_ENABLE | | ||
966 | KEYLARGO_GPIO_OUTOUT_DATA); | ||
967 | else | ||
968 | MACIO_OUT8(KL_GPIO_SOUND_POWER, | ||
969 | KEYLARGO_GPIO_OUTPUT_ENABLE); | ||
970 | (void)MACIO_IN8(KL_GPIO_SOUND_POWER); | ||
971 | UNLOCK(flags); | ||
972 | } | ||
973 | return 0; | ||
974 | } | ||
975 | |||
976 | static long | ||
977 | core99_airport_enable(struct device_node* node, long param, long value) | ||
978 | { | ||
979 | struct macio_chip* macio; | ||
980 | unsigned long flags; | ||
981 | int state; | ||
982 | |||
983 | macio = macio_find(node, 0); | ||
984 | if (!macio) | ||
985 | return -ENODEV; | ||
986 | |||
987 | /* Hint: we allow passing of macio itself for the sake of the | ||
988 | * sleep code | ||
989 | */ | ||
990 | if (node != macio->of_node && | ||
991 | (!node->parent || node->parent != macio->of_node)) | ||
992 | return -ENODEV; | ||
993 | state = (macio->flags & MACIO_FLAG_AIRPORT_ON) != 0; | ||
994 | if (value == state) | ||
995 | return 0; | ||
996 | if (value) { | ||
997 | /* This code is a reproduction of OF enable-cardslot | ||
998 | * and init-wireless methods, slightly hacked until | ||
999 | * I got it working. | ||
1000 | */ | ||
1001 | LOCK(flags); | ||
1002 | MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 5); | ||
1003 | (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf); | ||
1004 | UNLOCK(flags); | ||
1005 | mdelay(10); | ||
1006 | LOCK(flags); | ||
1007 | MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 4); | ||
1008 | (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf); | ||
1009 | UNLOCK(flags); | ||
1010 | |||
1011 | mdelay(10); | ||
1012 | |||
1013 | LOCK(flags); | ||
1014 | MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16); | ||
1015 | (void)MACIO_IN32(KEYLARGO_FCR2); | ||
1016 | udelay(10); | ||
1017 | MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xb, 0); | ||
1018 | (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xb); | ||
1019 | udelay(10); | ||
1020 | MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xa, 0x28); | ||
1021 | (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xa); | ||
1022 | udelay(10); | ||
1023 | MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xd, 0x28); | ||
1024 | (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xd); | ||
1025 | udelay(10); | ||
1026 | MACIO_OUT8(KEYLARGO_GPIO_0+0xd, 0x28); | ||
1027 | (void)MACIO_IN8(KEYLARGO_GPIO_0+0xd); | ||
1028 | udelay(10); | ||
1029 | MACIO_OUT8(KEYLARGO_GPIO_0+0xe, 0x28); | ||
1030 | (void)MACIO_IN8(KEYLARGO_GPIO_0+0xe); | ||
1031 | UNLOCK(flags); | ||
1032 | udelay(10); | ||
1033 | MACIO_OUT32(0x1c000, 0); | ||
1034 | mdelay(1); | ||
1035 | MACIO_OUT8(0x1a3e0, 0x41); | ||
1036 | (void)MACIO_IN8(0x1a3e0); | ||
1037 | udelay(10); | ||
1038 | LOCK(flags); | ||
1039 | MACIO_BIS(KEYLARGO_FCR2, KL2_CARDSEL_16); | ||
1040 | (void)MACIO_IN32(KEYLARGO_FCR2); | ||
1041 | UNLOCK(flags); | ||
1042 | mdelay(100); | ||
1043 | |||
1044 | macio->flags |= MACIO_FLAG_AIRPORT_ON; | ||
1045 | } else { | ||
1046 | LOCK(flags); | ||
1047 | MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16); | ||
1048 | (void)MACIO_IN32(KEYLARGO_FCR2); | ||
1049 | MACIO_OUT8(KL_GPIO_AIRPORT_0, 0); | ||
1050 | MACIO_OUT8(KL_GPIO_AIRPORT_1, 0); | ||
1051 | MACIO_OUT8(KL_GPIO_AIRPORT_2, 0); | ||
1052 | MACIO_OUT8(KL_GPIO_AIRPORT_3, 0); | ||
1053 | MACIO_OUT8(KL_GPIO_AIRPORT_4, 0); | ||
1054 | (void)MACIO_IN8(KL_GPIO_AIRPORT_4); | ||
1055 | UNLOCK(flags); | ||
1056 | |||
1057 | macio->flags &= ~MACIO_FLAG_AIRPORT_ON; | ||
1058 | } | ||
1059 | return 0; | ||
1060 | } | ||
1061 | |||
1062 | #ifdef CONFIG_SMP | ||
1063 | static long | ||
1064 | core99_reset_cpu(struct device_node* node, long param, long value) | ||
1065 | { | ||
1066 | unsigned int reset_io = 0; | ||
1067 | unsigned long flags; | ||
1068 | struct macio_chip* macio; | ||
1069 | struct device_node* np; | ||
1070 | const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0, | ||
1071 | KL_GPIO_RESET_CPU1, | ||
1072 | KL_GPIO_RESET_CPU2, | ||
1073 | KL_GPIO_RESET_CPU3 }; | ||
1074 | |||
1075 | macio = &macio_chips[0]; | ||
1076 | if (macio->type != macio_keylargo) | ||
1077 | return -ENODEV; | ||
1078 | |||
1079 | np = find_path_device("/cpus"); | ||
1080 | if (np == NULL) | ||
1081 | return -ENODEV; | ||
1082 | for (np = np->child; np != NULL; np = np->sibling) { | ||
1083 | u32* num = (u32 *)get_property(np, "reg", NULL); | ||
1084 | u32* rst = (u32 *)get_property(np, "soft-reset", NULL); | ||
1085 | if (num == NULL || rst == NULL) | ||
1086 | continue; | ||
1087 | if (param == *num) { | ||
1088 | reset_io = *rst; | ||
1089 | break; | ||
1090 | } | ||
1091 | } | ||
1092 | if (np == NULL || reset_io == 0) | ||
1093 | reset_io = dflt_reset_lines[param]; | ||
1094 | |||
1095 | LOCK(flags); | ||
1096 | MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE); | ||
1097 | (void)MACIO_IN8(reset_io); | ||
1098 | udelay(1); | ||
1099 | MACIO_OUT8(reset_io, 0); | ||
1100 | (void)MACIO_IN8(reset_io); | ||
1101 | UNLOCK(flags); | ||
1102 | |||
1103 | return 0; | ||
1104 | } | ||
1105 | #endif /* CONFIG_SMP */ | ||
1106 | |||
1107 | static long | ||
1108 | core99_usb_enable(struct device_node* node, long param, long value) | ||
1109 | { | ||
1110 | struct macio_chip* macio; | ||
1111 | unsigned long flags; | ||
1112 | char* prop; | ||
1113 | int number; | ||
1114 | u32 reg; | ||
1115 | |||
1116 | macio = &macio_chips[0]; | ||
1117 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
1118 | macio->type != macio_intrepid) | ||
1119 | return -ENODEV; | ||
1120 | |||
1121 | prop = (char *)get_property(node, "AAPL,clock-id", NULL); | ||
1122 | if (!prop) | ||
1123 | return -ENODEV; | ||
1124 | if (strncmp(prop, "usb0u048", 8) == 0) | ||
1125 | number = 0; | ||
1126 | else if (strncmp(prop, "usb1u148", 8) == 0) | ||
1127 | number = 2; | ||
1128 | else if (strncmp(prop, "usb2u248", 8) == 0) | ||
1129 | number = 4; | ||
1130 | else | ||
1131 | return -ENODEV; | ||
1132 | |||
1133 | /* Sorry for the brute-force locking, but this is only used during | ||
1134 | * sleep and the timing seem to be critical | ||
1135 | */ | ||
1136 | LOCK(flags); | ||
1137 | if (value) { | ||
1138 | /* Turn ON */ | ||
1139 | if (number == 0) { | ||
1140 | MACIO_BIC(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1)); | ||
1141 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1142 | UNLOCK(flags); | ||
1143 | mdelay(1); | ||
1144 | LOCK(flags); | ||
1145 | MACIO_BIS(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE); | ||
1146 | } else if (number == 2) { | ||
1147 | MACIO_BIC(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1)); | ||
1148 | UNLOCK(flags); | ||
1149 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1150 | mdelay(1); | ||
1151 | LOCK(flags); | ||
1152 | MACIO_BIS(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE); | ||
1153 | } else if (number == 4) { | ||
1154 | MACIO_BIC(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1)); | ||
1155 | UNLOCK(flags); | ||
1156 | (void)MACIO_IN32(KEYLARGO_FCR1); | ||
1157 | mdelay(1); | ||
1158 | LOCK(flags); | ||
1159 | MACIO_BIS(KEYLARGO_FCR1, KL1_USB2_CELL_ENABLE); | ||
1160 | } | ||
1161 | if (number < 4) { | ||
1162 | reg = MACIO_IN32(KEYLARGO_FCR4); | ||
1163 | reg &= ~(KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) | | ||
1164 | KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number)); | ||
1165 | reg &= ~(KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) | | ||
1166 | KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1)); | ||
1167 | MACIO_OUT32(KEYLARGO_FCR4, reg); | ||
1168 | (void)MACIO_IN32(KEYLARGO_FCR4); | ||
1169 | udelay(10); | ||
1170 | } else { | ||
1171 | reg = MACIO_IN32(KEYLARGO_FCR3); | ||
1172 | reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) | | ||
1173 | KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0)); | ||
1174 | reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) | | ||
1175 | KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1)); | ||
1176 | MACIO_OUT32(KEYLARGO_FCR3, reg); | ||
1177 | (void)MACIO_IN32(KEYLARGO_FCR3); | ||
1178 | udelay(10); | ||
1179 | } | ||
1180 | if (macio->type == macio_intrepid) { | ||
1181 | /* wait for clock stopped bits to clear */ | ||
1182 | u32 test0 = 0, test1 = 0; | ||
1183 | u32 status0, status1; | ||
1184 | int timeout = 1000; | ||
1185 | |||
1186 | UNLOCK(flags); | ||
1187 | switch (number) { | ||
1188 | case 0: | ||
1189 | test0 = UNI_N_CLOCK_STOPPED_USB0; | ||
1190 | test1 = UNI_N_CLOCK_STOPPED_USB0PCI; | ||
1191 | break; | ||
1192 | case 2: | ||
1193 | test0 = UNI_N_CLOCK_STOPPED_USB1; | ||
1194 | test1 = UNI_N_CLOCK_STOPPED_USB1PCI; | ||
1195 | break; | ||
1196 | case 4: | ||
1197 | test0 = UNI_N_CLOCK_STOPPED_USB2; | ||
1198 | test1 = UNI_N_CLOCK_STOPPED_USB2PCI; | ||
1199 | break; | ||
1200 | } | ||
1201 | do { | ||
1202 | if (--timeout <= 0) { | ||
1203 | printk(KERN_ERR "core99_usb_enable: " | ||
1204 | "Timeout waiting for clocks\n"); | ||
1205 | break; | ||
1206 | } | ||
1207 | mdelay(1); | ||
1208 | status0 = UN_IN(UNI_N_CLOCK_STOP_STATUS0); | ||
1209 | status1 = UN_IN(UNI_N_CLOCK_STOP_STATUS1); | ||
1210 | } while ((status0 & test0) | (status1 & test1)); | ||
1211 | LOCK(flags); | ||
1212 | } | ||
1213 | } else { | ||
1214 | /* Turn OFF */ | ||
1215 | if (number < 4) { | ||
1216 | reg = MACIO_IN32(KEYLARGO_FCR4); | ||
1217 | reg |= KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) | | ||
1218 | KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number); | ||
1219 | reg |= KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) | | ||
1220 | KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1); | ||
1221 | MACIO_OUT32(KEYLARGO_FCR4, reg); | ||
1222 | (void)MACIO_IN32(KEYLARGO_FCR4); | ||
1223 | udelay(1); | ||
1224 | } else { | ||
1225 | reg = MACIO_IN32(KEYLARGO_FCR3); | ||
1226 | reg |= KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) | | ||
1227 | KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0); | ||
1228 | reg |= KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) | | ||
1229 | KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1); | ||
1230 | MACIO_OUT32(KEYLARGO_FCR3, reg); | ||
1231 | (void)MACIO_IN32(KEYLARGO_FCR3); | ||
1232 | udelay(1); | ||
1233 | } | ||
1234 | if (number == 0) { | ||
1235 | if (macio->type != macio_intrepid) | ||
1236 | MACIO_BIC(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE); | ||
1237 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1238 | udelay(1); | ||
1239 | MACIO_BIS(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1)); | ||
1240 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1241 | } else if (number == 2) { | ||
1242 | if (macio->type != macio_intrepid) | ||
1243 | MACIO_BIC(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE); | ||
1244 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1245 | udelay(1); | ||
1246 | MACIO_BIS(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1)); | ||
1247 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1248 | } else if (number == 4) { | ||
1249 | udelay(1); | ||
1250 | MACIO_BIS(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1)); | ||
1251 | (void)MACIO_IN32(KEYLARGO_FCR1); | ||
1252 | } | ||
1253 | udelay(1); | ||
1254 | } | ||
1255 | UNLOCK(flags); | ||
1256 | |||
1257 | return 0; | ||
1258 | } | ||
1259 | |||
1260 | static long | ||
1261 | core99_firewire_enable(struct device_node* node, long param, long value) | ||
1262 | { | ||
1263 | unsigned long flags; | ||
1264 | struct macio_chip* macio; | ||
1265 | |||
1266 | macio = &macio_chips[0]; | ||
1267 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
1268 | macio->type != macio_intrepid) | ||
1269 | return -ENODEV; | ||
1270 | if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED)) | ||
1271 | return -ENODEV; | ||
1272 | |||
1273 | LOCK(flags); | ||
1274 | if (value) { | ||
1275 | UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW); | ||
1276 | (void)UN_IN(UNI_N_CLOCK_CNTL); | ||
1277 | } else { | ||
1278 | UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW); | ||
1279 | (void)UN_IN(UNI_N_CLOCK_CNTL); | ||
1280 | } | ||
1281 | UNLOCK(flags); | ||
1282 | mdelay(1); | ||
1283 | |||
1284 | return 0; | ||
1285 | } | ||
1286 | |||
1287 | static long | ||
1288 | core99_firewire_cable_power(struct device_node* node, long param, long value) | ||
1289 | { | ||
1290 | unsigned long flags; | ||
1291 | struct macio_chip* macio; | ||
1292 | |||
1293 | /* Trick: we allow NULL node */ | ||
1294 | if ((pmac_mb.board_flags & PMAC_MB_HAS_FW_POWER) == 0) | ||
1295 | return -ENODEV; | ||
1296 | macio = &macio_chips[0]; | ||
1297 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
1298 | macio->type != macio_intrepid) | ||
1299 | return -ENODEV; | ||
1300 | if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED)) | ||
1301 | return -ENODEV; | ||
1302 | |||
1303 | LOCK(flags); | ||
1304 | if (value) { | ||
1305 | MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 0); | ||
1306 | MACIO_IN8(KL_GPIO_FW_CABLE_POWER); | ||
1307 | udelay(10); | ||
1308 | } else { | ||
1309 | MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 4); | ||
1310 | MACIO_IN8(KL_GPIO_FW_CABLE_POWER); udelay(10); | ||
1311 | } | ||
1312 | UNLOCK(flags); | ||
1313 | mdelay(1); | ||
1314 | |||
1315 | return 0; | ||
1316 | } | ||
1317 | |||
1318 | static long | ||
1319 | intrepid_aack_delay_enable(struct device_node* node, long param, long value) | ||
1320 | { | ||
1321 | unsigned long flags; | ||
1322 | |||
1323 | if (uninorth_rev < 0xd2) | ||
1324 | return -ENODEV; | ||
1325 | |||
1326 | LOCK(flags); | ||
1327 | if (param) | ||
1328 | UN_BIS(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE); | ||
1329 | else | ||
1330 | UN_BIC(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE); | ||
1331 | UNLOCK(flags); | ||
1332 | |||
1333 | return 0; | ||
1334 | } | ||
1335 | |||
1336 | |||
1337 | #endif /* CONFIG_POWER4 */ | ||
1338 | |||
1339 | static long | ||
1340 | core99_read_gpio(struct device_node* node, long param, long value) | ||
1341 | { | ||
1342 | struct macio_chip* macio = &macio_chips[0]; | ||
1343 | |||
1344 | return MACIO_IN8(param); | ||
1345 | } | ||
1346 | |||
1347 | |||
1348 | static long | ||
1349 | core99_write_gpio(struct device_node* node, long param, long value) | ||
1350 | { | ||
1351 | struct macio_chip* macio = &macio_chips[0]; | ||
1352 | |||
1353 | MACIO_OUT8(param, (u8)(value & 0xff)); | ||
1354 | return 0; | ||
1355 | } | ||
1356 | |||
1357 | #ifdef CONFIG_POWER4 | ||
1358 | |||
1359 | static long | ||
1360 | g5_gmac_enable(struct device_node* node, long param, long value) | ||
1361 | { | ||
1362 | struct macio_chip* macio = &macio_chips[0]; | ||
1363 | unsigned long flags; | ||
1364 | u8 pbus, pid; | ||
1365 | |||
1366 | LOCK(flags); | ||
1367 | if (value) { | ||
1368 | MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE); | ||
1369 | mb(); | ||
1370 | k2_skiplist[0] = NULL; | ||
1371 | } else { | ||
1372 | k2_skiplist[0] = node; | ||
1373 | mb(); | ||
1374 | MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE); | ||
1375 | } | ||
1376 | |||
1377 | UNLOCK(flags); | ||
1378 | mdelay(1); | ||
1379 | |||
1380 | return 0; | ||
1381 | } | ||
1382 | |||
1383 | static long | ||
1384 | g5_fw_enable(struct device_node* node, long param, long value) | ||
1385 | { | ||
1386 | struct macio_chip* macio = &macio_chips[0]; | ||
1387 | unsigned long flags; | ||
1388 | |||
1389 | LOCK(flags); | ||
1390 | if (value) { | ||
1391 | MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE); | ||
1392 | mb(); | ||
1393 | k2_skiplist[1] = NULL; | ||
1394 | } else { | ||
1395 | k2_skiplist[1] = node; | ||
1396 | mb(); | ||
1397 | MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE); | ||
1398 | } | ||
1399 | |||
1400 | UNLOCK(flags); | ||
1401 | mdelay(1); | ||
1402 | |||
1403 | return 0; | ||
1404 | } | ||
1405 | |||
1406 | static long | ||
1407 | g5_mpic_enable(struct device_node* node, long param, long value) | ||
1408 | { | ||
1409 | unsigned long flags; | ||
1410 | |||
1411 | if (node->parent == NULL || strcmp(node->parent->name, "u3")) | ||
1412 | return 0; | ||
1413 | |||
1414 | LOCK(flags); | ||
1415 | UN_BIS(U3_TOGGLE_REG, U3_MPIC_RESET | U3_MPIC_OUTPUT_ENABLE); | ||
1416 | UNLOCK(flags); | ||
1417 | |||
1418 | return 0; | ||
1419 | } | ||
1420 | |||
1421 | #ifdef CONFIG_SMP | ||
1422 | static long | ||
1423 | g5_reset_cpu(struct device_node* node, long param, long value) | ||
1424 | { | ||
1425 | unsigned int reset_io = 0; | ||
1426 | unsigned long flags; | ||
1427 | struct macio_chip* macio; | ||
1428 | struct device_node* np; | ||
1429 | |||
1430 | macio = &macio_chips[0]; | ||
1431 | if (macio->type != macio_keylargo2) | ||
1432 | return -ENODEV; | ||
1433 | |||
1434 | np = find_path_device("/cpus"); | ||
1435 | if (np == NULL) | ||
1436 | return -ENODEV; | ||
1437 | for (np = np->child; np != NULL; np = np->sibling) { | ||
1438 | u32* num = (u32 *)get_property(np, "reg", NULL); | ||
1439 | u32* rst = (u32 *)get_property(np, "soft-reset", NULL); | ||
1440 | if (num == NULL || rst == NULL) | ||
1441 | continue; | ||
1442 | if (param == *num) { | ||
1443 | reset_io = *rst; | ||
1444 | break; | ||
1445 | } | ||
1446 | } | ||
1447 | if (np == NULL || reset_io == 0) | ||
1448 | return -ENODEV; | ||
1449 | |||
1450 | LOCK(flags); | ||
1451 | MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE); | ||
1452 | (void)MACIO_IN8(reset_io); | ||
1453 | udelay(1); | ||
1454 | MACIO_OUT8(reset_io, 0); | ||
1455 | (void)MACIO_IN8(reset_io); | ||
1456 | UNLOCK(flags); | ||
1457 | |||
1458 | return 0; | ||
1459 | } | ||
1460 | #endif /* CONFIG_SMP */ | ||
1461 | |||
1462 | /* | ||
1463 | * This can be called from pmac_smp so isn't static | ||
1464 | * | ||
1465 | * This takes the second CPU off the bus on dual CPU machines | ||
1466 | * running UP | ||
1467 | */ | ||
1468 | void g5_phy_disable_cpu1(void) | ||
1469 | { | ||
1470 | UN_OUT(U3_API_PHY_CONFIG_1, 0); | ||
1471 | } | ||
1472 | |||
1473 | #endif /* CONFIG_POWER4 */ | ||
1474 | |||
1475 | #ifndef CONFIG_POWER4 | ||
1476 | |||
1477 | static void | ||
1478 | keylargo_shutdown(struct macio_chip* macio, int sleep_mode) | ||
1479 | { | ||
1480 | u32 temp; | ||
1481 | |||
1482 | if (sleep_mode) { | ||
1483 | mdelay(1); | ||
1484 | MACIO_BIS(KEYLARGO_FCR0, KL0_USB_REF_SUSPEND); | ||
1485 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1486 | mdelay(1); | ||
1487 | } | ||
1488 | |||
1489 | MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE | | ||
1490 | KL0_SCC_CELL_ENABLE | | ||
1491 | KL0_IRDA_ENABLE | KL0_IRDA_CLK32_ENABLE | | ||
1492 | KL0_IRDA_CLK19_ENABLE); | ||
1493 | |||
1494 | MACIO_BIC(KEYLARGO_MBCR, KL_MBCR_MB0_DEV_MASK); | ||
1495 | MACIO_BIS(KEYLARGO_MBCR, KL_MBCR_MB0_IDE_ENABLE); | ||
1496 | |||
1497 | MACIO_BIC(KEYLARGO_FCR1, | ||
1498 | KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT | | ||
1499 | KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE | | ||
1500 | KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT | | ||
1501 | KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE | | ||
1502 | KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE | | ||
1503 | KL1_EIDE0_ENABLE | KL1_EIDE0_RESET_N | | ||
1504 | KL1_EIDE1_ENABLE | KL1_EIDE1_RESET_N | | ||
1505 | KL1_UIDE_ENABLE); | ||
1506 | |||
1507 | MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT); | ||
1508 | MACIO_BIC(KEYLARGO_FCR2, KL2_IOBUS_ENABLE); | ||
1509 | |||
1510 | temp = MACIO_IN32(KEYLARGO_FCR3); | ||
1511 | if (macio->rev >= 2) { | ||
1512 | temp |= KL3_SHUTDOWN_PLL2X; | ||
1513 | if (sleep_mode) | ||
1514 | temp |= KL3_SHUTDOWN_PLL_TOTAL; | ||
1515 | } | ||
1516 | |||
1517 | temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 | | ||
1518 | KL3_SHUTDOWN_PLLKW35; | ||
1519 | if (sleep_mode) | ||
1520 | temp |= KL3_SHUTDOWN_PLLKW12; | ||
1521 | temp &= ~(KL3_CLK66_ENABLE | KL3_CLK49_ENABLE | KL3_CLK45_ENABLE | ||
1522 | | KL3_CLK31_ENABLE | KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE); | ||
1523 | if (sleep_mode) | ||
1524 | temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_VIA_CLK16_ENABLE); | ||
1525 | MACIO_OUT32(KEYLARGO_FCR3, temp); | ||
1526 | |||
1527 | /* Flush posted writes & wait a bit */ | ||
1528 | (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1); | ||
1529 | } | ||
1530 | |||
1531 | static void | ||
1532 | pangea_shutdown(struct macio_chip* macio, int sleep_mode) | ||
1533 | { | ||
1534 | u32 temp; | ||
1535 | |||
1536 | MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE | | ||
1537 | KL0_SCC_CELL_ENABLE | | ||
1538 | KL0_USB0_CELL_ENABLE | KL0_USB1_CELL_ENABLE); | ||
1539 | |||
1540 | MACIO_BIC(KEYLARGO_FCR1, | ||
1541 | KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT | | ||
1542 | KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE | | ||
1543 | KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT | | ||
1544 | KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE | | ||
1545 | KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE | | ||
1546 | KL1_UIDE_ENABLE); | ||
1547 | if (pmac_mb.board_flags & PMAC_MB_MOBILE) | ||
1548 | MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N); | ||
1549 | |||
1550 | MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT); | ||
1551 | |||
1552 | temp = MACIO_IN32(KEYLARGO_FCR3); | ||
1553 | temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 | | ||
1554 | KL3_SHUTDOWN_PLLKW35; | ||
1555 | temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE | KL3_CLK31_ENABLE | ||
1556 | | KL3_I2S0_CLK18_ENABLE | KL3_I2S1_CLK18_ENABLE); | ||
1557 | if (sleep_mode) | ||
1558 | temp &= ~(KL3_VIA_CLK16_ENABLE | KL3_TIMER_CLK18_ENABLE); | ||
1559 | MACIO_OUT32(KEYLARGO_FCR3, temp); | ||
1560 | |||
1561 | /* Flush posted writes & wait a bit */ | ||
1562 | (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1); | ||
1563 | } | ||
1564 | |||
1565 | static void | ||
1566 | intrepid_shutdown(struct macio_chip* macio, int sleep_mode) | ||
1567 | { | ||
1568 | u32 temp; | ||
1569 | |||
1570 | MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE | | ||
1571 | KL0_SCC_CELL_ENABLE); | ||
1572 | |||
1573 | MACIO_BIC(KEYLARGO_FCR1, | ||
1574 | /*KL1_USB2_CELL_ENABLE |*/ | ||
1575 | KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT | | ||
1576 | KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE | | ||
1577 | KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE); | ||
1578 | if (pmac_mb.board_flags & PMAC_MB_MOBILE) | ||
1579 | MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N); | ||
1580 | |||
1581 | temp = MACIO_IN32(KEYLARGO_FCR3); | ||
1582 | temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE | | ||
1583 | KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE); | ||
1584 | if (sleep_mode) | ||
1585 | temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_IT_VIA_CLK32_ENABLE); | ||
1586 | MACIO_OUT32(KEYLARGO_FCR3, temp); | ||
1587 | |||
1588 | /* Flush posted writes & wait a bit */ | ||
1589 | (void)MACIO_IN32(KEYLARGO_FCR0); | ||
1590 | mdelay(10); | ||
1591 | } | ||
1592 | |||
1593 | |||
1594 | void pmac_tweak_clock_spreading(int enable) | ||
1595 | { | ||
1596 | struct macio_chip* macio = &macio_chips[0]; | ||
1597 | |||
1598 | /* Hack for doing clock spreading on some machines PowerBooks and | ||
1599 | * iBooks. This implements the "platform-do-clockspreading" OF | ||
1600 | * property as decoded manually on various models. For safety, we also | ||
1601 | * check the product ID in the device-tree in cases we'll whack the i2c | ||
1602 | * chip to make reasonably sure we won't set wrong values in there | ||
1603 | * | ||
1604 | * Of course, ultimately, we have to implement a real parser for | ||
1605 | * the platform-do-* stuff... | ||
1606 | */ | ||
1607 | |||
1608 | if (macio->type == macio_intrepid) { | ||
1609 | struct device_node *clock = | ||
1610 | of_find_node_by_path("/uni-n@f8000000/hw-clock"); | ||
1611 | if (clock && get_property(clock, "platform-do-clockspreading", | ||
1612 | NULL)) { | ||
1613 | printk(KERN_INFO "%sabling clock spreading on Intrepid" | ||
1614 | " ASIC\n", enable ? "En" : "Dis"); | ||
1615 | if (enable) | ||
1616 | UN_OUT(UNI_N_CLOCK_SPREADING, 2); | ||
1617 | else | ||
1618 | UN_OUT(UNI_N_CLOCK_SPREADING, 0); | ||
1619 | mdelay(40); | ||
1620 | } | ||
1621 | of_node_put(clock); | ||
1622 | } | ||
1623 | |||
1624 | while (machine_is_compatible("PowerBook5,2") || | ||
1625 | machine_is_compatible("PowerBook5,3") || | ||
1626 | machine_is_compatible("PowerBook6,2") || | ||
1627 | machine_is_compatible("PowerBook6,3")) { | ||
1628 | struct device_node *ui2c = of_find_node_by_type(NULL, "i2c"); | ||
1629 | struct device_node *dt = of_find_node_by_name(NULL, "device-tree"); | ||
1630 | u8 buffer[9]; | ||
1631 | u32 *productID; | ||
1632 | int i, rc, changed = 0; | ||
1633 | |||
1634 | if (dt == NULL) | ||
1635 | break; | ||
1636 | productID = (u32 *)get_property(dt, "pid#", NULL); | ||
1637 | if (productID == NULL) | ||
1638 | break; | ||
1639 | while(ui2c) { | ||
1640 | struct device_node *p = of_get_parent(ui2c); | ||
1641 | if (p && !strcmp(p->name, "uni-n")) | ||
1642 | break; | ||
1643 | ui2c = of_find_node_by_type(ui2c, "i2c"); | ||
1644 | } | ||
1645 | if (ui2c == NULL) | ||
1646 | break; | ||
1647 | DBG("Trying to bump clock speed for PID: %08x...\n", *productID); | ||
1648 | rc = pmac_low_i2c_open(ui2c, 1); | ||
1649 | if (rc != 0) | ||
1650 | break; | ||
1651 | pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined); | ||
1652 | rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9); | ||
1653 | DBG("read result: %d,", rc); | ||
1654 | if (rc != 0) { | ||
1655 | pmac_low_i2c_close(ui2c); | ||
1656 | break; | ||
1657 | } | ||
1658 | for (i=0; i<9; i++) | ||
1659 | DBG(" %02x", buffer[i]); | ||
1660 | DBG("\n"); | ||
1661 | |||
1662 | switch(*productID) { | ||
1663 | case 0x1182: /* AlBook 12" rev 2 */ | ||
1664 | case 0x1183: /* iBook G4 12" */ | ||
1665 | buffer[0] = (buffer[0] & 0x8f) | 0x70; | ||
1666 | buffer[2] = (buffer[2] & 0x7f) | 0x00; | ||
1667 | buffer[5] = (buffer[5] & 0x80) | 0x31; | ||
1668 | buffer[6] = (buffer[6] & 0x40) | 0xb0; | ||
1669 | buffer[7] = (buffer[7] & 0x00) | (enable ? 0xc0 : 0xba); | ||
1670 | buffer[8] = (buffer[8] & 0x00) | 0x30; | ||
1671 | changed = 1; | ||
1672 | break; | ||
1673 | case 0x3142: /* AlBook 15" (ATI M10) */ | ||
1674 | case 0x3143: /* AlBook 17" (ATI M10) */ | ||
1675 | buffer[0] = (buffer[0] & 0xaf) | 0x50; | ||
1676 | buffer[2] = (buffer[2] & 0x7f) | 0x00; | ||
1677 | buffer[5] = (buffer[5] & 0x80) | 0x31; | ||
1678 | buffer[6] = (buffer[6] & 0x40) | 0xb0; | ||
1679 | buffer[7] = (buffer[7] & 0x00) | (enable ? 0xd0 : 0xc0); | ||
1680 | buffer[8] = (buffer[8] & 0x00) | 0x30; | ||
1681 | changed = 1; | ||
1682 | break; | ||
1683 | default: | ||
1684 | DBG("i2c-hwclock: Machine model not handled\n"); | ||
1685 | break; | ||
1686 | } | ||
1687 | if (!changed) { | ||
1688 | pmac_low_i2c_close(ui2c); | ||
1689 | break; | ||
1690 | } | ||
1691 | printk(KERN_INFO "%sabling clock spreading on i2c clock chip\n", | ||
1692 | enable ? "En" : "Dis"); | ||
1693 | pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub); | ||
1694 | rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9); | ||
1695 | DBG("write result: %d,", rc); | ||
1696 | pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined); | ||
1697 | rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9); | ||
1698 | DBG("read result: %d,", rc); | ||
1699 | if (rc != 0) { | ||
1700 | pmac_low_i2c_close(ui2c); | ||
1701 | break; | ||
1702 | } | ||
1703 | for (i=0; i<9; i++) | ||
1704 | DBG(" %02x", buffer[i]); | ||
1705 | pmac_low_i2c_close(ui2c); | ||
1706 | break; | ||
1707 | } | ||
1708 | } | ||
1709 | |||
1710 | |||
1711 | static int | ||
1712 | core99_sleep(void) | ||
1713 | { | ||
1714 | struct macio_chip* macio; | ||
1715 | int i; | ||
1716 | |||
1717 | macio = &macio_chips[0]; | ||
1718 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
1719 | macio->type != macio_intrepid) | ||
1720 | return -ENODEV; | ||
1721 | |||
1722 | /* We power off the wireless slot in case it was not done | ||
1723 | * by the driver. We don't power it on automatically however | ||
1724 | */ | ||
1725 | if (macio->flags & MACIO_FLAG_AIRPORT_ON) | ||
1726 | core99_airport_enable(macio->of_node, 0, 0); | ||
1727 | |||
1728 | /* We power off the FW cable. Should be done by the driver... */ | ||
1729 | if (macio->flags & MACIO_FLAG_FW_SUPPORTED) { | ||
1730 | core99_firewire_enable(NULL, 0, 0); | ||
1731 | core99_firewire_cable_power(NULL, 0, 0); | ||
1732 | } | ||
1733 | |||
1734 | /* We make sure int. modem is off (in case driver lost it) */ | ||
1735 | if (macio->type == macio_keylargo) | ||
1736 | core99_modem_enable(macio->of_node, 0, 0); | ||
1737 | else | ||
1738 | pangea_modem_enable(macio->of_node, 0, 0); | ||
1739 | |||
1740 | /* We make sure the sound is off as well */ | ||
1741 | core99_sound_chip_enable(macio->of_node, 0, 0); | ||
1742 | |||
1743 | /* | ||
1744 | * Save various bits of KeyLargo | ||
1745 | */ | ||
1746 | |||
1747 | /* Save the state of the various GPIOs */ | ||
1748 | save_gpio_levels[0] = MACIO_IN32(KEYLARGO_GPIO_LEVELS0); | ||
1749 | save_gpio_levels[1] = MACIO_IN32(KEYLARGO_GPIO_LEVELS1); | ||
1750 | for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++) | ||
1751 | save_gpio_extint[i] = MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+i); | ||
1752 | for (i=0; i<KEYLARGO_GPIO_CNT; i++) | ||
1753 | save_gpio_normal[i] = MACIO_IN8(KEYLARGO_GPIO_0+i); | ||
1754 | |||
1755 | /* Save the FCRs */ | ||
1756 | if (macio->type == macio_keylargo) | ||
1757 | save_mbcr = MACIO_IN32(KEYLARGO_MBCR); | ||
1758 | save_fcr[0] = MACIO_IN32(KEYLARGO_FCR0); | ||
1759 | save_fcr[1] = MACIO_IN32(KEYLARGO_FCR1); | ||
1760 | save_fcr[2] = MACIO_IN32(KEYLARGO_FCR2); | ||
1761 | save_fcr[3] = MACIO_IN32(KEYLARGO_FCR3); | ||
1762 | save_fcr[4] = MACIO_IN32(KEYLARGO_FCR4); | ||
1763 | if (macio->type == macio_pangea || macio->type == macio_intrepid) | ||
1764 | save_fcr[5] = MACIO_IN32(KEYLARGO_FCR5); | ||
1765 | |||
1766 | /* Save state & config of DBDMA channels */ | ||
1767 | dbdma_save(macio, save_dbdma); | ||
1768 | |||
1769 | /* | ||
1770 | * Turn off as much as we can | ||
1771 | */ | ||
1772 | if (macio->type == macio_pangea) | ||
1773 | pangea_shutdown(macio, 1); | ||
1774 | else if (macio->type == macio_intrepid) | ||
1775 | intrepid_shutdown(macio, 1); | ||
1776 | else if (macio->type == macio_keylargo) | ||
1777 | keylargo_shutdown(macio, 1); | ||
1778 | |||
1779 | /* | ||
1780 | * Put the host bridge to sleep | ||
1781 | */ | ||
1782 | |||
1783 | save_unin_clock_ctl = UN_IN(UNI_N_CLOCK_CNTL); | ||
1784 | /* Note: do not switch GMAC off, driver does it when necessary, WOL must keep it | ||
1785 | * enabled ! | ||
1786 | */ | ||
1787 | UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl & | ||
1788 | ~(/*UNI_N_CLOCK_CNTL_GMAC|*/UNI_N_CLOCK_CNTL_FW/*|UNI_N_CLOCK_CNTL_PCI*/)); | ||
1789 | udelay(100); | ||
1790 | UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING); | ||
1791 | UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_SLEEP); | ||
1792 | mdelay(10); | ||
1793 | |||
1794 | /* | ||
1795 | * FIXME: A bit of black magic with OpenPIC (don't ask me why) | ||
1796 | */ | ||
1797 | if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) { | ||
1798 | MACIO_BIS(0x506e0, 0x00400000); | ||
1799 | MACIO_BIS(0x506e0, 0x80000000); | ||
1800 | } | ||
1801 | return 0; | ||
1802 | } | ||
1803 | |||
1804 | static int | ||
1805 | core99_wake_up(void) | ||
1806 | { | ||
1807 | struct macio_chip* macio; | ||
1808 | int i; | ||
1809 | |||
1810 | macio = &macio_chips[0]; | ||
1811 | if (macio->type != macio_keylargo && macio->type != macio_pangea && | ||
1812 | macio->type != macio_intrepid) | ||
1813 | return -ENODEV; | ||
1814 | |||
1815 | /* | ||
1816 | * Wakeup the host bridge | ||
1817 | */ | ||
1818 | UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL); | ||
1819 | udelay(10); | ||
1820 | UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING); | ||
1821 | udelay(10); | ||
1822 | |||
1823 | /* | ||
1824 | * Restore KeyLargo | ||
1825 | */ | ||
1826 | |||
1827 | if (macio->type == macio_keylargo) { | ||
1828 | MACIO_OUT32(KEYLARGO_MBCR, save_mbcr); | ||
1829 | (void)MACIO_IN32(KEYLARGO_MBCR); udelay(10); | ||
1830 | } | ||
1831 | MACIO_OUT32(KEYLARGO_FCR0, save_fcr[0]); | ||
1832 | (void)MACIO_IN32(KEYLARGO_FCR0); udelay(10); | ||
1833 | MACIO_OUT32(KEYLARGO_FCR1, save_fcr[1]); | ||
1834 | (void)MACIO_IN32(KEYLARGO_FCR1); udelay(10); | ||
1835 | MACIO_OUT32(KEYLARGO_FCR2, save_fcr[2]); | ||
1836 | (void)MACIO_IN32(KEYLARGO_FCR2); udelay(10); | ||
1837 | MACIO_OUT32(KEYLARGO_FCR3, save_fcr[3]); | ||
1838 | (void)MACIO_IN32(KEYLARGO_FCR3); udelay(10); | ||
1839 | MACIO_OUT32(KEYLARGO_FCR4, save_fcr[4]); | ||
1840 | (void)MACIO_IN32(KEYLARGO_FCR4); udelay(10); | ||
1841 | if (macio->type == macio_pangea || macio->type == macio_intrepid) { | ||
1842 | MACIO_OUT32(KEYLARGO_FCR5, save_fcr[5]); | ||
1843 | (void)MACIO_IN32(KEYLARGO_FCR5); udelay(10); | ||
1844 | } | ||
1845 | |||
1846 | dbdma_restore(macio, save_dbdma); | ||
1847 | |||
1848 | MACIO_OUT32(KEYLARGO_GPIO_LEVELS0, save_gpio_levels[0]); | ||
1849 | MACIO_OUT32(KEYLARGO_GPIO_LEVELS1, save_gpio_levels[1]); | ||
1850 | for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++) | ||
1851 | MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+i, save_gpio_extint[i]); | ||
1852 | for (i=0; i<KEYLARGO_GPIO_CNT; i++) | ||
1853 | MACIO_OUT8(KEYLARGO_GPIO_0+i, save_gpio_normal[i]); | ||
1854 | |||
1855 | /* FIXME more black magic with OpenPIC ... */ | ||
1856 | if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) { | ||
1857 | MACIO_BIC(0x506e0, 0x00400000); | ||
1858 | MACIO_BIC(0x506e0, 0x80000000); | ||
1859 | } | ||
1860 | |||
1861 | UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl); | ||
1862 | udelay(100); | ||
1863 | |||
1864 | return 0; | ||
1865 | } | ||
1866 | |||
1867 | static long | ||
1868 | core99_sleep_state(struct device_node* node, long param, long value) | ||
1869 | { | ||
1870 | /* Param == 1 means to enter the "fake sleep" mode that is | ||
1871 | * used for CPU speed switch | ||
1872 | */ | ||
1873 | if (param == 1) { | ||
1874 | if (value == 1) { | ||
1875 | UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING); | ||
1876 | UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_IDLE2); | ||
1877 | } else { | ||
1878 | UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL); | ||
1879 | udelay(10); | ||
1880 | UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING); | ||
1881 | udelay(10); | ||
1882 | } | ||
1883 | return 0; | ||
1884 | } | ||
1885 | if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0) | ||
1886 | return -EPERM; | ||
1887 | |||
1888 | if (value == 1) | ||
1889 | return core99_sleep(); | ||
1890 | else if (value == 0) | ||
1891 | return core99_wake_up(); | ||
1892 | return 0; | ||
1893 | } | ||
1894 | |||
1895 | #endif /* CONFIG_POWER4 */ | ||
1896 | |||
1897 | static long | ||
1898 | generic_dev_can_wake(struct device_node* node, long param, long value) | ||
1899 | { | ||
1900 | /* Todo: eventually check we are really dealing with on-board | ||
1901 | * video device ... | ||
1902 | */ | ||
1903 | |||
1904 | if (pmac_mb.board_flags & PMAC_MB_MAY_SLEEP) | ||
1905 | pmac_mb.board_flags |= PMAC_MB_CAN_SLEEP; | ||
1906 | return 0; | ||
1907 | } | ||
1908 | |||
1909 | static long | ||
1910 | generic_get_mb_info(struct device_node* node, long param, long value) | ||
1911 | { | ||
1912 | switch(param) { | ||
1913 | case PMAC_MB_INFO_MODEL: | ||
1914 | return pmac_mb.model_id; | ||
1915 | case PMAC_MB_INFO_FLAGS: | ||
1916 | return pmac_mb.board_flags; | ||
1917 | case PMAC_MB_INFO_NAME: | ||
1918 | /* hack hack hack... but should work */ | ||
1919 | *((const char **)value) = pmac_mb.model_name; | ||
1920 | return 0; | ||
1921 | } | ||
1922 | return -EINVAL; | ||
1923 | } | ||
1924 | |||
1925 | |||
1926 | /* | ||
1927 | * Table definitions | ||
1928 | */ | ||
1929 | |||
1930 | /* Used on any machine | ||
1931 | */ | ||
1932 | static struct feature_table_entry any_features[] = { | ||
1933 | { PMAC_FTR_GET_MB_INFO, generic_get_mb_info }, | ||
1934 | { PMAC_FTR_DEVICE_CAN_WAKE, generic_dev_can_wake }, | ||
1935 | { 0, NULL } | ||
1936 | }; | ||
1937 | |||
1938 | #ifndef CONFIG_POWER4 | ||
1939 | |||
1940 | /* OHare based motherboards. Currently, we only use these on the | ||
1941 | * 2400,3400 and 3500 series powerbooks. Some older desktops seem | ||
1942 | * to have issues with turning on/off those asic cells | ||
1943 | */ | ||
1944 | static struct feature_table_entry ohare_features[] = { | ||
1945 | { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable }, | ||
1946 | { PMAC_FTR_SWIM3_ENABLE, ohare_floppy_enable }, | ||
1947 | { PMAC_FTR_MESH_ENABLE, ohare_mesh_enable }, | ||
1948 | { PMAC_FTR_IDE_ENABLE, ohare_ide_enable}, | ||
1949 | { PMAC_FTR_IDE_RESET, ohare_ide_reset}, | ||
1950 | { PMAC_FTR_SLEEP_STATE, ohare_sleep_state }, | ||
1951 | { 0, NULL } | ||
1952 | }; | ||
1953 | |||
1954 | /* Heathrow desktop machines (Beige G3). | ||
1955 | * Separated as some features couldn't be properly tested | ||
1956 | * and the serial port control bits appear to confuse it. | ||
1957 | */ | ||
1958 | static struct feature_table_entry heathrow_desktop_features[] = { | ||
1959 | { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable }, | ||
1960 | { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable }, | ||
1961 | { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable }, | ||
1962 | { PMAC_FTR_IDE_RESET, heathrow_ide_reset }, | ||
1963 | { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable }, | ||
1964 | { 0, NULL } | ||
1965 | }; | ||
1966 | |||
1967 | /* Heathrow based laptop, that is the Wallstreet and mainstreet | ||
1968 | * powerbooks. | ||
1969 | */ | ||
1970 | static struct feature_table_entry heathrow_laptop_features[] = { | ||
1971 | { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable }, | ||
1972 | { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable }, | ||
1973 | { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable }, | ||
1974 | { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable }, | ||
1975 | { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable }, | ||
1976 | { PMAC_FTR_IDE_RESET, heathrow_ide_reset }, | ||
1977 | { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable }, | ||
1978 | { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable }, | ||
1979 | { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state }, | ||
1980 | { 0, NULL } | ||
1981 | }; | ||
1982 | |||
1983 | /* Paddington based machines | ||
1984 | * The lombard (101) powerbook, first iMac models, B&W G3 and Yikes G4. | ||
1985 | */ | ||
1986 | static struct feature_table_entry paddington_features[] = { | ||
1987 | { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable }, | ||
1988 | { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable }, | ||
1989 | { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable }, | ||
1990 | { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable }, | ||
1991 | { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable }, | ||
1992 | { PMAC_FTR_IDE_RESET, heathrow_ide_reset }, | ||
1993 | { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable }, | ||
1994 | { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable }, | ||
1995 | { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state }, | ||
1996 | { 0, NULL } | ||
1997 | }; | ||
1998 | |||
1999 | /* Core99 & MacRISC 2 machines (all machines released since the | ||
2000 | * iBook (included), that is all AGP machines, except pangea | ||
2001 | * chipset. The pangea chipset is the "combo" UniNorth/KeyLargo | ||
2002 | * used on iBook2 & iMac "flow power". | ||
2003 | */ | ||
2004 | static struct feature_table_entry core99_features[] = { | ||
2005 | { PMAC_FTR_SCC_ENABLE, core99_scc_enable }, | ||
2006 | { PMAC_FTR_MODEM_ENABLE, core99_modem_enable }, | ||
2007 | { PMAC_FTR_IDE_ENABLE, core99_ide_enable }, | ||
2008 | { PMAC_FTR_IDE_RESET, core99_ide_reset }, | ||
2009 | { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable }, | ||
2010 | { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset }, | ||
2011 | { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable }, | ||
2012 | { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable }, | ||
2013 | { PMAC_FTR_USB_ENABLE, core99_usb_enable }, | ||
2014 | { PMAC_FTR_1394_ENABLE, core99_firewire_enable }, | ||
2015 | { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power }, | ||
2016 | { PMAC_FTR_SLEEP_STATE, core99_sleep_state }, | ||
2017 | #ifdef CONFIG_SMP | ||
2018 | { PMAC_FTR_RESET_CPU, core99_reset_cpu }, | ||
2019 | #endif /* CONFIG_SMP */ | ||
2020 | { PMAC_FTR_READ_GPIO, core99_read_gpio }, | ||
2021 | { PMAC_FTR_WRITE_GPIO, core99_write_gpio }, | ||
2022 | { 0, NULL } | ||
2023 | }; | ||
2024 | |||
2025 | /* RackMac | ||
2026 | */ | ||
2027 | static struct feature_table_entry rackmac_features[] = { | ||
2028 | { PMAC_FTR_SCC_ENABLE, core99_scc_enable }, | ||
2029 | { PMAC_FTR_IDE_ENABLE, core99_ide_enable }, | ||
2030 | { PMAC_FTR_IDE_RESET, core99_ide_reset }, | ||
2031 | { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable }, | ||
2032 | { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset }, | ||
2033 | { PMAC_FTR_USB_ENABLE, core99_usb_enable }, | ||
2034 | { PMAC_FTR_1394_ENABLE, core99_firewire_enable }, | ||
2035 | { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power }, | ||
2036 | { PMAC_FTR_SLEEP_STATE, core99_sleep_state }, | ||
2037 | #ifdef CONFIG_SMP | ||
2038 | { PMAC_FTR_RESET_CPU, core99_reset_cpu }, | ||
2039 | #endif /* CONFIG_SMP */ | ||
2040 | { PMAC_FTR_READ_GPIO, core99_read_gpio }, | ||
2041 | { PMAC_FTR_WRITE_GPIO, core99_write_gpio }, | ||
2042 | { 0, NULL } | ||
2043 | }; | ||
2044 | |||
2045 | /* Pangea features | ||
2046 | */ | ||
2047 | static struct feature_table_entry pangea_features[] = { | ||
2048 | { PMAC_FTR_SCC_ENABLE, core99_scc_enable }, | ||
2049 | { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable }, | ||
2050 | { PMAC_FTR_IDE_ENABLE, core99_ide_enable }, | ||
2051 | { PMAC_FTR_IDE_RESET, core99_ide_reset }, | ||
2052 | { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable }, | ||
2053 | { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset }, | ||
2054 | { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable }, | ||
2055 | { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable }, | ||
2056 | { PMAC_FTR_USB_ENABLE, core99_usb_enable }, | ||
2057 | { PMAC_FTR_1394_ENABLE, core99_firewire_enable }, | ||
2058 | { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power }, | ||
2059 | { PMAC_FTR_SLEEP_STATE, core99_sleep_state }, | ||
2060 | { PMAC_FTR_READ_GPIO, core99_read_gpio }, | ||
2061 | { PMAC_FTR_WRITE_GPIO, core99_write_gpio }, | ||
2062 | { 0, NULL } | ||
2063 | }; | ||
2064 | |||
2065 | /* Intrepid features | ||
2066 | */ | ||
2067 | static struct feature_table_entry intrepid_features[] = { | ||
2068 | { PMAC_FTR_SCC_ENABLE, core99_scc_enable }, | ||
2069 | { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable }, | ||
2070 | { PMAC_FTR_IDE_ENABLE, core99_ide_enable }, | ||
2071 | { PMAC_FTR_IDE_RESET, core99_ide_reset }, | ||
2072 | { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable }, | ||
2073 | { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset }, | ||
2074 | { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable }, | ||
2075 | { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable }, | ||
2076 | { PMAC_FTR_USB_ENABLE, core99_usb_enable }, | ||
2077 | { PMAC_FTR_1394_ENABLE, core99_firewire_enable }, | ||
2078 | { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power }, | ||
2079 | { PMAC_FTR_SLEEP_STATE, core99_sleep_state }, | ||
2080 | { PMAC_FTR_READ_GPIO, core99_read_gpio }, | ||
2081 | { PMAC_FTR_WRITE_GPIO, core99_write_gpio }, | ||
2082 | { PMAC_FTR_AACK_DELAY_ENABLE, intrepid_aack_delay_enable }, | ||
2083 | { 0, NULL } | ||
2084 | }; | ||
2085 | |||
2086 | #else /* CONFIG_POWER4 */ | ||
2087 | |||
2088 | /* G5 features | ||
2089 | */ | ||
2090 | static struct feature_table_entry g5_features[] = { | ||
2091 | { PMAC_FTR_GMAC_ENABLE, g5_gmac_enable }, | ||
2092 | { PMAC_FTR_1394_ENABLE, g5_fw_enable }, | ||
2093 | { PMAC_FTR_ENABLE_MPIC, g5_mpic_enable }, | ||
2094 | #ifdef CONFIG_SMP | ||
2095 | { PMAC_FTR_RESET_CPU, g5_reset_cpu }, | ||
2096 | #endif /* CONFIG_SMP */ | ||
2097 | { PMAC_FTR_READ_GPIO, core99_read_gpio }, | ||
2098 | { PMAC_FTR_WRITE_GPIO, core99_write_gpio }, | ||
2099 | { 0, NULL } | ||
2100 | }; | ||
2101 | |||
2102 | #endif /* CONFIG_POWER4 */ | ||
2103 | |||
2104 | static struct pmac_mb_def pmac_mb_defs[] = { | ||
2105 | #ifndef CONFIG_POWER4 | ||
2106 | /* | ||
2107 | * Desktops | ||
2108 | */ | ||
2109 | |||
2110 | { "AAPL,8500", "PowerMac 8500/8600", | ||
2111 | PMAC_TYPE_PSURGE, NULL, | ||
2112 | 0 | ||
2113 | }, | ||
2114 | { "AAPL,9500", "PowerMac 9500/9600", | ||
2115 | PMAC_TYPE_PSURGE, NULL, | ||
2116 | 0 | ||
2117 | }, | ||
2118 | { "AAPL,7200", "PowerMac 7200", | ||
2119 | PMAC_TYPE_PSURGE, NULL, | ||
2120 | 0 | ||
2121 | }, | ||
2122 | { "AAPL,7300", "PowerMac 7200/7300", | ||
2123 | PMAC_TYPE_PSURGE, NULL, | ||
2124 | 0 | ||
2125 | }, | ||
2126 | { "AAPL,7500", "PowerMac 7500", | ||
2127 | PMAC_TYPE_PSURGE, NULL, | ||
2128 | 0 | ||
2129 | }, | ||
2130 | { "AAPL,ShinerESB", "Apple Network Server", | ||
2131 | PMAC_TYPE_ANS, NULL, | ||
2132 | 0 | ||
2133 | }, | ||
2134 | { "AAPL,e407", "Alchemy", | ||
2135 | PMAC_TYPE_ALCHEMY, NULL, | ||
2136 | 0 | ||
2137 | }, | ||
2138 | { "AAPL,e411", "Gazelle", | ||
2139 | PMAC_TYPE_GAZELLE, NULL, | ||
2140 | 0 | ||
2141 | }, | ||
2142 | { "AAPL,Gossamer", "PowerMac G3 (Gossamer)", | ||
2143 | PMAC_TYPE_GOSSAMER, heathrow_desktop_features, | ||
2144 | 0 | ||
2145 | }, | ||
2146 | { "AAPL,PowerMac G3", "PowerMac G3 (Silk)", | ||
2147 | PMAC_TYPE_SILK, heathrow_desktop_features, | ||
2148 | 0 | ||
2149 | }, | ||
2150 | { "PowerMac1,1", "Blue&White G3", | ||
2151 | PMAC_TYPE_YOSEMITE, paddington_features, | ||
2152 | 0 | ||
2153 | }, | ||
2154 | { "PowerMac1,2", "PowerMac G4 PCI Graphics", | ||
2155 | PMAC_TYPE_YIKES, paddington_features, | ||
2156 | 0 | ||
2157 | }, | ||
2158 | { "PowerMac2,1", "iMac FireWire", | ||
2159 | PMAC_TYPE_FW_IMAC, core99_features, | ||
2160 | PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99 | ||
2161 | }, | ||
2162 | { "PowerMac2,2", "iMac FireWire", | ||
2163 | PMAC_TYPE_FW_IMAC, core99_features, | ||
2164 | PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99 | ||
2165 | }, | ||
2166 | { "PowerMac3,1", "PowerMac G4 AGP Graphics", | ||
2167 | PMAC_TYPE_SAWTOOTH, core99_features, | ||
2168 | PMAC_MB_OLD_CORE99 | ||
2169 | }, | ||
2170 | { "PowerMac3,2", "PowerMac G4 AGP Graphics", | ||
2171 | PMAC_TYPE_SAWTOOTH, core99_features, | ||
2172 | PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99 | ||
2173 | }, | ||
2174 | { "PowerMac3,3", "PowerMac G4 AGP Graphics", | ||
2175 | PMAC_TYPE_SAWTOOTH, core99_features, | ||
2176 | PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99 | ||
2177 | }, | ||
2178 | { "PowerMac3,4", "PowerMac G4 Silver", | ||
2179 | PMAC_TYPE_QUICKSILVER, core99_features, | ||
2180 | PMAC_MB_MAY_SLEEP | ||
2181 | }, | ||
2182 | { "PowerMac3,5", "PowerMac G4 Silver", | ||
2183 | PMAC_TYPE_QUICKSILVER, core99_features, | ||
2184 | PMAC_MB_MAY_SLEEP | ||
2185 | }, | ||
2186 | { "PowerMac3,6", "PowerMac G4 Windtunnel", | ||
2187 | PMAC_TYPE_WINDTUNNEL, core99_features, | ||
2188 | PMAC_MB_MAY_SLEEP, | ||
2189 | }, | ||
2190 | { "PowerMac4,1", "iMac \"Flower Power\"", | ||
2191 | PMAC_TYPE_PANGEA_IMAC, pangea_features, | ||
2192 | PMAC_MB_MAY_SLEEP | ||
2193 | }, | ||
2194 | { "PowerMac4,2", "Flat panel iMac", | ||
2195 | PMAC_TYPE_FLAT_PANEL_IMAC, pangea_features, | ||
2196 | PMAC_MB_CAN_SLEEP | ||
2197 | }, | ||
2198 | { "PowerMac4,4", "eMac", | ||
2199 | PMAC_TYPE_EMAC, core99_features, | ||
2200 | PMAC_MB_MAY_SLEEP | ||
2201 | }, | ||
2202 | { "PowerMac5,1", "PowerMac G4 Cube", | ||
2203 | PMAC_TYPE_CUBE, core99_features, | ||
2204 | PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99 | ||
2205 | }, | ||
2206 | { "PowerMac6,1", "Flat panel iMac", | ||
2207 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2208 | PMAC_MB_MAY_SLEEP, | ||
2209 | }, | ||
2210 | { "PowerMac6,3", "Flat panel iMac", | ||
2211 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2212 | PMAC_MB_MAY_SLEEP, | ||
2213 | }, | ||
2214 | { "PowerMac6,4", "eMac", | ||
2215 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2216 | PMAC_MB_MAY_SLEEP, | ||
2217 | }, | ||
2218 | { "PowerMac10,1", "Mac mini", | ||
2219 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2220 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER, | ||
2221 | }, | ||
2222 | { "iMac,1", "iMac (first generation)", | ||
2223 | PMAC_TYPE_ORIG_IMAC, paddington_features, | ||
2224 | 0 | ||
2225 | }, | ||
2226 | |||
2227 | /* | ||
2228 | * Xserve's | ||
2229 | */ | ||
2230 | |||
2231 | { "RackMac1,1", "XServe", | ||
2232 | PMAC_TYPE_RACKMAC, rackmac_features, | ||
2233 | 0, | ||
2234 | }, | ||
2235 | { "RackMac1,2", "XServe rev. 2", | ||
2236 | PMAC_TYPE_RACKMAC, rackmac_features, | ||
2237 | 0, | ||
2238 | }, | ||
2239 | |||
2240 | /* | ||
2241 | * Laptops | ||
2242 | */ | ||
2243 | |||
2244 | { "AAPL,3400/2400", "PowerBook 3400", | ||
2245 | PMAC_TYPE_HOOPER, ohare_features, | ||
2246 | PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE | ||
2247 | }, | ||
2248 | { "AAPL,3500", "PowerBook 3500", | ||
2249 | PMAC_TYPE_KANGA, ohare_features, | ||
2250 | PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE | ||
2251 | }, | ||
2252 | { "AAPL,PowerBook1998", "PowerBook Wallstreet", | ||
2253 | PMAC_TYPE_WALLSTREET, heathrow_laptop_features, | ||
2254 | PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE | ||
2255 | }, | ||
2256 | { "PowerBook1,1", "PowerBook 101 (Lombard)", | ||
2257 | PMAC_TYPE_101_PBOOK, paddington_features, | ||
2258 | PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE | ||
2259 | }, | ||
2260 | { "PowerBook2,1", "iBook (first generation)", | ||
2261 | PMAC_TYPE_ORIG_IBOOK, core99_features, | ||
2262 | PMAC_MB_CAN_SLEEP | PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE | ||
2263 | }, | ||
2264 | { "PowerBook2,2", "iBook FireWire", | ||
2265 | PMAC_TYPE_FW_IBOOK, core99_features, | ||
2266 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | | ||
2267 | PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE | ||
2268 | }, | ||
2269 | { "PowerBook3,1", "PowerBook Pismo", | ||
2270 | PMAC_TYPE_PISMO, core99_features, | ||
2271 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | | ||
2272 | PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE | ||
2273 | }, | ||
2274 | { "PowerBook3,2", "PowerBook Titanium", | ||
2275 | PMAC_TYPE_TITANIUM, core99_features, | ||
2276 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2277 | }, | ||
2278 | { "PowerBook3,3", "PowerBook Titanium II", | ||
2279 | PMAC_TYPE_TITANIUM2, core99_features, | ||
2280 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2281 | }, | ||
2282 | { "PowerBook3,4", "PowerBook Titanium III", | ||
2283 | PMAC_TYPE_TITANIUM3, core99_features, | ||
2284 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2285 | }, | ||
2286 | { "PowerBook3,5", "PowerBook Titanium IV", | ||
2287 | PMAC_TYPE_TITANIUM4, core99_features, | ||
2288 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2289 | }, | ||
2290 | { "PowerBook4,1", "iBook 2", | ||
2291 | PMAC_TYPE_IBOOK2, pangea_features, | ||
2292 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2293 | }, | ||
2294 | { "PowerBook4,2", "iBook 2", | ||
2295 | PMAC_TYPE_IBOOK2, pangea_features, | ||
2296 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2297 | }, | ||
2298 | { "PowerBook4,3", "iBook 2 rev. 2", | ||
2299 | PMAC_TYPE_IBOOK2, pangea_features, | ||
2300 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE | ||
2301 | }, | ||
2302 | { "PowerBook5,1", "PowerBook G4 17\"", | ||
2303 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2304 | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2305 | }, | ||
2306 | { "PowerBook5,2", "PowerBook G4 15\"", | ||
2307 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2308 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2309 | }, | ||
2310 | { "PowerBook5,3", "PowerBook G4 17\"", | ||
2311 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2312 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2313 | }, | ||
2314 | { "PowerBook5,4", "PowerBook G4 15\"", | ||
2315 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2316 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2317 | }, | ||
2318 | { "PowerBook5,5", "PowerBook G4 17\"", | ||
2319 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2320 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2321 | }, | ||
2322 | { "PowerBook5,6", "PowerBook G4 15\"", | ||
2323 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2324 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2325 | }, | ||
2326 | { "PowerBook5,7", "PowerBook G4 17\"", | ||
2327 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2328 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2329 | }, | ||
2330 | { "PowerBook5,8", "PowerBook G4 15\"", | ||
2331 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2332 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2333 | }, | ||
2334 | { "PowerBook5,9", "PowerBook G4 17\"", | ||
2335 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2336 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2337 | }, | ||
2338 | { "PowerBook6,1", "PowerBook G4 12\"", | ||
2339 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2340 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2341 | }, | ||
2342 | { "PowerBook6,2", "PowerBook G4", | ||
2343 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2344 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2345 | }, | ||
2346 | { "PowerBook6,3", "iBook G4", | ||
2347 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2348 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2349 | }, | ||
2350 | { "PowerBook6,4", "PowerBook G4 12\"", | ||
2351 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2352 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2353 | }, | ||
2354 | { "PowerBook6,5", "iBook G4", | ||
2355 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2356 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2357 | }, | ||
2358 | { "PowerBook6,7", "iBook G4", | ||
2359 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2360 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2361 | }, | ||
2362 | { "PowerBook6,8", "PowerBook G4 12\"", | ||
2363 | PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, | ||
2364 | PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, | ||
2365 | }, | ||
2366 | #else /* CONFIG_POWER4 */ | ||
2367 | { "PowerMac7,2", "PowerMac G5", | ||
2368 | PMAC_TYPE_POWERMAC_G5, g5_features, | ||
2369 | 0, | ||
2370 | }, | ||
2371 | #endif /* CONFIG_POWER4 */ | ||
2372 | }; | ||
2373 | |||
2374 | /* | ||
2375 | * The toplevel feature_call callback | ||
2376 | */ | ||
2377 | long | ||
2378 | pmac_do_feature_call(unsigned int selector, ...) | ||
2379 | { | ||
2380 | struct device_node* node; | ||
2381 | long param, value; | ||
2382 | int i; | ||
2383 | feature_call func = NULL; | ||
2384 | va_list args; | ||
2385 | |||
2386 | if (pmac_mb.features) | ||
2387 | for (i=0; pmac_mb.features[i].function; i++) | ||
2388 | if (pmac_mb.features[i].selector == selector) { | ||
2389 | func = pmac_mb.features[i].function; | ||
2390 | break; | ||
2391 | } | ||
2392 | if (!func) | ||
2393 | for (i=0; any_features[i].function; i++) | ||
2394 | if (any_features[i].selector == selector) { | ||
2395 | func = any_features[i].function; | ||
2396 | break; | ||
2397 | } | ||
2398 | if (!func) | ||
2399 | return -ENODEV; | ||
2400 | |||
2401 | va_start(args, selector); | ||
2402 | node = (struct device_node*)va_arg(args, void*); | ||
2403 | param = va_arg(args, long); | ||
2404 | value = va_arg(args, long); | ||
2405 | va_end(args); | ||
2406 | |||
2407 | return func(node, param, value); | ||
2408 | } | ||
2409 | |||
2410 | static int __init | ||
2411 | probe_motherboard(void) | ||
2412 | { | ||
2413 | int i; | ||
2414 | struct macio_chip* macio = &macio_chips[0]; | ||
2415 | const char* model = NULL; | ||
2416 | struct device_node *dt; | ||
2417 | |||
2418 | /* Lookup known motherboard type in device-tree. First try an | ||
2419 | * exact match on the "model" property, then try a "compatible" | ||
2420 | * match is none is found. | ||
2421 | */ | ||
2422 | dt = find_devices("device-tree"); | ||
2423 | if (dt != NULL) | ||
2424 | model = (const char *) get_property(dt, "model", NULL); | ||
2425 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | ||
2426 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { | ||
2427 | pmac_mb = pmac_mb_defs[i]; | ||
2428 | goto found; | ||
2429 | } | ||
2430 | } | ||
2431 | for(i=0; i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | ||
2432 | if (machine_is_compatible(pmac_mb_defs[i].model_string)) { | ||
2433 | pmac_mb = pmac_mb_defs[i]; | ||
2434 | goto found; | ||
2435 | } | ||
2436 | } | ||
2437 | |||
2438 | /* Fallback to selection depending on mac-io chip type */ | ||
2439 | switch(macio->type) { | ||
2440 | #ifndef CONFIG_POWER4 | ||
2441 | case macio_grand_central: | ||
2442 | pmac_mb.model_id = PMAC_TYPE_PSURGE; | ||
2443 | pmac_mb.model_name = "Unknown PowerSurge"; | ||
2444 | break; | ||
2445 | case macio_ohare: | ||
2446 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_OHARE; | ||
2447 | pmac_mb.model_name = "Unknown OHare-based"; | ||
2448 | break; | ||
2449 | case macio_heathrow: | ||
2450 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_HEATHROW; | ||
2451 | pmac_mb.model_name = "Unknown Heathrow-based"; | ||
2452 | pmac_mb.features = heathrow_desktop_features; | ||
2453 | break; | ||
2454 | case macio_paddington: | ||
2455 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PADDINGTON; | ||
2456 | pmac_mb.model_name = "Unknown Paddington-based"; | ||
2457 | pmac_mb.features = paddington_features; | ||
2458 | break; | ||
2459 | case macio_keylargo: | ||
2460 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_CORE99; | ||
2461 | pmac_mb.model_name = "Unknown Keylargo-based"; | ||
2462 | pmac_mb.features = core99_features; | ||
2463 | break; | ||
2464 | case macio_pangea: | ||
2465 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PANGEA; | ||
2466 | pmac_mb.model_name = "Unknown Pangea-based"; | ||
2467 | pmac_mb.features = pangea_features; | ||
2468 | break; | ||
2469 | case macio_intrepid: | ||
2470 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_INTREPID; | ||
2471 | pmac_mb.model_name = "Unknown Intrepid-based"; | ||
2472 | pmac_mb.features = intrepid_features; | ||
2473 | break; | ||
2474 | #else /* CONFIG_POWER4 */ | ||
2475 | case macio_keylargo2: | ||
2476 | pmac_mb.model_id = PMAC_TYPE_UNKNOWN_K2; | ||
2477 | pmac_mb.model_name = "Unknown G5"; | ||
2478 | pmac_mb.features = g5_features; | ||
2479 | break; | ||
2480 | #endif /* CONFIG_POWER4 */ | ||
2481 | default: | ||
2482 | return -ENODEV; | ||
2483 | } | ||
2484 | found: | ||
2485 | #ifndef CONFIG_POWER4 | ||
2486 | /* Fixup Hooper vs. Comet */ | ||
2487 | if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { | ||
2488 | u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); | ||
2489 | if (!mach_id_ptr) | ||
2490 | return -ENODEV; | ||
2491 | /* Here, I used to disable the media-bay on comet. It | ||
2492 | * appears this is wrong, the floppy connector is actually | ||
2493 | * a kind of media-bay and works with the current driver. | ||
2494 | */ | ||
2495 | if (__raw_readl(mach_id_ptr) & 0x20000000UL) | ||
2496 | pmac_mb.model_id = PMAC_TYPE_COMET; | ||
2497 | iounmap(mach_id_ptr); | ||
2498 | } | ||
2499 | #endif /* CONFIG_POWER4 */ | ||
2500 | |||
2501 | #ifdef CONFIG_6xx | ||
2502 | /* Set default value of powersave_nap on machines that support it. | ||
2503 | * It appears that uninorth rev 3 has a problem with it, we don't | ||
2504 | * enable it on those. In theory, the flush-on-lock property is | ||
2505 | * supposed to be set when not supported, but I'm not very confident | ||
2506 | * that all Apple OF revs did it properly, I do it the paranoid way. | ||
2507 | */ | ||
2508 | while (uninorth_base && uninorth_rev > 3) { | ||
2509 | struct device_node* np = find_path_device("/cpus"); | ||
2510 | if (!np || !np->child) { | ||
2511 | printk(KERN_WARNING "Can't find CPU(s) in device tree !\n"); | ||
2512 | break; | ||
2513 | } | ||
2514 | np = np->child; | ||
2515 | /* Nap mode not supported on SMP */ | ||
2516 | if (np->sibling) | ||
2517 | break; | ||
2518 | /* Nap mode not supported if flush-on-lock property is present */ | ||
2519 | if (get_property(np, "flush-on-lock", NULL)) | ||
2520 | break; | ||
2521 | powersave_nap = 1; | ||
2522 | printk(KERN_INFO "Processor NAP mode on idle enabled.\n"); | ||
2523 | break; | ||
2524 | } | ||
2525 | |||
2526 | /* On CPUs that support it (750FX), lowspeed by default during | ||
2527 | * NAP mode | ||
2528 | */ | ||
2529 | powersave_lowspeed = 1; | ||
2530 | #endif /* CONFIG_6xx */ | ||
2531 | #ifdef CONFIG_POWER4 | ||
2532 | powersave_nap = 1; | ||
2533 | #endif | ||
2534 | /* Check for "mobile" machine */ | ||
2535 | if (model && (strncmp(model, "PowerBook", 9) == 0 | ||
2536 | || strncmp(model, "iBook", 5) == 0)) | ||
2537 | pmac_mb.board_flags |= PMAC_MB_MOBILE; | ||
2538 | |||
2539 | |||
2540 | printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); | ||
2541 | return 0; | ||
2542 | } | ||
2543 | |||
2544 | /* Initialize the Core99 UniNorth host bridge and memory controller | ||
2545 | */ | ||
2546 | static void __init | ||
2547 | probe_uninorth(void) | ||
2548 | { | ||
2549 | unsigned long actrl; | ||
2550 | |||
2551 | /* Locate core99 Uni-N */ | ||
2552 | uninorth_node = of_find_node_by_name(NULL, "uni-n"); | ||
2553 | /* Locate G5 u3 */ | ||
2554 | if (uninorth_node == NULL) { | ||
2555 | uninorth_node = of_find_node_by_name(NULL, "u3"); | ||
2556 | uninorth_u3 = 1; | ||
2557 | } | ||
2558 | if (uninorth_node && uninorth_node->n_addrs > 0) { | ||
2559 | unsigned long address = uninorth_node->addrs[0].address; | ||
2560 | uninorth_base = ioremap(address, 0x40000); | ||
2561 | uninorth_rev = in_be32(UN_REG(UNI_N_VERSION)); | ||
2562 | if (uninorth_u3) | ||
2563 | u3_ht = ioremap(address + U3_HT_CONFIG_BASE, 0x1000); | ||
2564 | } else | ||
2565 | uninorth_node = NULL; | ||
2566 | |||
2567 | if (!uninorth_node) | ||
2568 | return; | ||
2569 | |||
2570 | printk(KERN_INFO "Found %s memory controller & host bridge, revision: %d\n", | ||
2571 | uninorth_u3 ? "U3" : "UniNorth", uninorth_rev); | ||
2572 | printk(KERN_INFO "Mapped at 0x%08lx\n", (unsigned long)uninorth_base); | ||
2573 | |||
2574 | /* Set the arbitrer QAck delay according to what Apple does | ||
2575 | */ | ||
2576 | if (uninorth_rev < 0x11) { | ||
2577 | actrl = UN_IN(UNI_N_ARB_CTRL) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK; | ||
2578 | actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 : | ||
2579 | UNI_N_ARB_CTRL_QACK_DELAY) << UNI_N_ARB_CTRL_QACK_DELAY_SHIFT; | ||
2580 | UN_OUT(UNI_N_ARB_CTRL, actrl); | ||
2581 | } | ||
2582 | |||
2583 | /* Some more magic as done by them in recent MacOS X on UniNorth | ||
2584 | * revs 1.5 to 2.O and Pangea. Seem to toggle the UniN Maxbus/PCI | ||
2585 | * memory timeout | ||
2586 | */ | ||
2587 | if ((uninorth_rev >= 0x11 && uninorth_rev <= 0x24) || uninorth_rev == 0xc0) | ||
2588 | UN_OUT(0x2160, UN_IN(0x2160) & 0x00ffffff); | ||
2589 | } | ||
2590 | |||
2591 | static void __init | ||
2592 | probe_one_macio(const char* name, const char* compat, int type) | ||
2593 | { | ||
2594 | struct device_node* node; | ||
2595 | int i; | ||
2596 | volatile u32 __iomem * base; | ||
2597 | u32* revp; | ||
2598 | |||
2599 | node = find_devices(name); | ||
2600 | if (!node || !node->n_addrs) | ||
2601 | return; | ||
2602 | if (compat) | ||
2603 | do { | ||
2604 | if (device_is_compatible(node, compat)) | ||
2605 | break; | ||
2606 | node = node->next; | ||
2607 | } while (node); | ||
2608 | if (!node) | ||
2609 | return; | ||
2610 | for(i=0; i<MAX_MACIO_CHIPS; i++) { | ||
2611 | if (!macio_chips[i].of_node) | ||
2612 | break; | ||
2613 | if (macio_chips[i].of_node == node) | ||
2614 | return; | ||
2615 | } | ||
2616 | if (i >= MAX_MACIO_CHIPS) { | ||
2617 | printk(KERN_ERR "pmac_feature: Please increase MAX_MACIO_CHIPS !\n"); | ||
2618 | printk(KERN_ERR "pmac_feature: %s skipped\n", node->full_name); | ||
2619 | return; | ||
2620 | } | ||
2621 | base = ioremap(node->addrs[0].address, node->addrs[0].size); | ||
2622 | if (!base) { | ||
2623 | printk(KERN_ERR "pmac_feature: Can't map mac-io chip !\n"); | ||
2624 | return; | ||
2625 | } | ||
2626 | if (type == macio_keylargo) { | ||
2627 | u32* did = (u32 *)get_property(node, "device-id", NULL); | ||
2628 | if (*did == 0x00000025) | ||
2629 | type = macio_pangea; | ||
2630 | if (*did == 0x0000003e) | ||
2631 | type = macio_intrepid; | ||
2632 | } | ||
2633 | macio_chips[i].of_node = node; | ||
2634 | macio_chips[i].type = type; | ||
2635 | macio_chips[i].base = base; | ||
2636 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; | ||
2637 | macio_chips[i].name = macio_names[type]; | ||
2638 | revp = (u32 *)get_property(node, "revision-id", NULL); | ||
2639 | if (revp) | ||
2640 | macio_chips[i].rev = *revp; | ||
2641 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", | ||
2642 | macio_names[type], macio_chips[i].rev, macio_chips[i].base); | ||
2643 | } | ||
2644 | |||
2645 | static int __init | ||
2646 | probe_macios(void) | ||
2647 | { | ||
2648 | /* Warning, ordering is important */ | ||
2649 | probe_one_macio("gc", NULL, macio_grand_central); | ||
2650 | probe_one_macio("ohare", NULL, macio_ohare); | ||
2651 | probe_one_macio("pci106b,7", NULL, macio_ohareII); | ||
2652 | probe_one_macio("mac-io", "keylargo", macio_keylargo); | ||
2653 | probe_one_macio("mac-io", "paddington", macio_paddington); | ||
2654 | probe_one_macio("mac-io", "gatwick", macio_gatwick); | ||
2655 | probe_one_macio("mac-io", "heathrow", macio_heathrow); | ||
2656 | probe_one_macio("mac-io", "K2-Keylargo", macio_keylargo2); | ||
2657 | |||
2658 | /* Make sure the "main" macio chip appear first */ | ||
2659 | if (macio_chips[0].type == macio_gatwick | ||
2660 | && macio_chips[1].type == macio_heathrow) { | ||
2661 | struct macio_chip temp = macio_chips[0]; | ||
2662 | macio_chips[0] = macio_chips[1]; | ||
2663 | macio_chips[1] = temp; | ||
2664 | } | ||
2665 | if (macio_chips[0].type == macio_ohareII | ||
2666 | && macio_chips[1].type == macio_ohare) { | ||
2667 | struct macio_chip temp = macio_chips[0]; | ||
2668 | macio_chips[0] = macio_chips[1]; | ||
2669 | macio_chips[1] = temp; | ||
2670 | } | ||
2671 | macio_chips[0].lbus.index = 0; | ||
2672 | macio_chips[1].lbus.index = 1; | ||
2673 | |||
2674 | return (macio_chips[0].of_node == NULL) ? -ENODEV : 0; | ||
2675 | } | ||
2676 | |||
2677 | static void __init | ||
2678 | initial_serial_shutdown(struct device_node* np) | ||
2679 | { | ||
2680 | int len; | ||
2681 | struct slot_names_prop { | ||
2682 | int count; | ||
2683 | char name[1]; | ||
2684 | } *slots; | ||
2685 | char *conn; | ||
2686 | int port_type = PMAC_SCC_ASYNC; | ||
2687 | int modem = 0; | ||
2688 | |||
2689 | slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); | ||
2690 | conn = get_property(np, "AAPL,connector", &len); | ||
2691 | if (conn && (strcmp(conn, "infrared") == 0)) | ||
2692 | port_type = PMAC_SCC_IRDA; | ||
2693 | else if (device_is_compatible(np, "cobalt")) | ||
2694 | modem = 1; | ||
2695 | else if (slots && slots->count > 0) { | ||
2696 | if (strcmp(slots->name, "IrDA") == 0) | ||
2697 | port_type = PMAC_SCC_IRDA; | ||
2698 | else if (strcmp(slots->name, "Modem") == 0) | ||
2699 | modem = 1; | ||
2700 | } | ||
2701 | if (modem) | ||
2702 | pmac_call_feature(PMAC_FTR_MODEM_ENABLE, np, 0, 0); | ||
2703 | pmac_call_feature(PMAC_FTR_SCC_ENABLE, np, port_type, 0); | ||
2704 | } | ||
2705 | |||
2706 | static void __init | ||
2707 | set_initial_features(void) | ||
2708 | { | ||
2709 | struct device_node* np; | ||
2710 | |||
2711 | /* That hack appears to be necessary for some StarMax motherboards | ||
2712 | * but I'm not too sure it was audited for side-effects on other | ||
2713 | * ohare based machines... | ||
2714 | * Since I still have difficulties figuring the right way to | ||
2715 | * differenciate them all and since that hack was there for a long | ||
2716 | * time, I'll keep it around | ||
2717 | */ | ||
2718 | if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) { | ||
2719 | struct macio_chip* macio = &macio_chips[0]; | ||
2720 | MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); | ||
2721 | } else if (macio_chips[0].type == macio_ohare) { | ||
2722 | struct macio_chip* macio = &macio_chips[0]; | ||
2723 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | ||
2724 | } else if (macio_chips[1].type == macio_ohare) { | ||
2725 | struct macio_chip* macio = &macio_chips[1]; | ||
2726 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | ||
2727 | } | ||
2728 | |||
2729 | #ifdef CONFIG_POWER4 | ||
2730 | if (macio_chips[0].type == macio_keylargo2) { | ||
2731 | #ifndef CONFIG_SMP | ||
2732 | /* On SMP machines running UP, we have the second CPU eating | ||
2733 | * bus cycles. We need to take it off the bus. This is done | ||
2734 | * from pmac_smp for SMP kernels running on one CPU | ||
2735 | */ | ||
2736 | np = of_find_node_by_type(NULL, "cpu"); | ||
2737 | if (np != NULL) | ||
2738 | np = of_find_node_by_type(np, "cpu"); | ||
2739 | if (np != NULL) { | ||
2740 | g5_phy_disable_cpu1(); | ||
2741 | of_node_put(np); | ||
2742 | } | ||
2743 | #endif /* CONFIG_SMP */ | ||
2744 | /* Enable GMAC for now for PCI probing. It will be disabled | ||
2745 | * later on after PCI probe | ||
2746 | */ | ||
2747 | np = of_find_node_by_name(NULL, "ethernet"); | ||
2748 | while(np) { | ||
2749 | if (device_is_compatible(np, "K2-GMAC")) | ||
2750 | g5_gmac_enable(np, 0, 1); | ||
2751 | np = of_find_node_by_name(np, "ethernet"); | ||
2752 | } | ||
2753 | |||
2754 | /* Enable FW before PCI probe. Will be disabled later on | ||
2755 | * Note: We should have a batter way to check that we are | ||
2756 | * dealing with uninorth internal cell and not a PCI cell | ||
2757 | * on the external PCI. The code below works though. | ||
2758 | */ | ||
2759 | np = of_find_node_by_name(NULL, "firewire"); | ||
2760 | while(np) { | ||
2761 | if (device_is_compatible(np, "pci106b,5811")) { | ||
2762 | macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; | ||
2763 | g5_fw_enable(np, 0, 1); | ||
2764 | } | ||
2765 | np = of_find_node_by_name(np, "firewire"); | ||
2766 | } | ||
2767 | } | ||
2768 | #else /* CONFIG_POWER4 */ | ||
2769 | |||
2770 | if (macio_chips[0].type == macio_keylargo || | ||
2771 | macio_chips[0].type == macio_pangea || | ||
2772 | macio_chips[0].type == macio_intrepid) { | ||
2773 | /* Enable GMAC for now for PCI probing. It will be disabled | ||
2774 | * later on after PCI probe | ||
2775 | */ | ||
2776 | np = of_find_node_by_name(NULL, "ethernet"); | ||
2777 | while(np) { | ||
2778 | if (np->parent | ||
2779 | && device_is_compatible(np->parent, "uni-north") | ||
2780 | && device_is_compatible(np, "gmac")) | ||
2781 | core99_gmac_enable(np, 0, 1); | ||
2782 | np = of_find_node_by_name(np, "ethernet"); | ||
2783 | } | ||
2784 | |||
2785 | /* Enable FW before PCI probe. Will be disabled later on | ||
2786 | * Note: We should have a batter way to check that we are | ||
2787 | * dealing with uninorth internal cell and not a PCI cell | ||
2788 | * on the external PCI. The code below works though. | ||
2789 | */ | ||
2790 | np = of_find_node_by_name(NULL, "firewire"); | ||
2791 | while(np) { | ||
2792 | if (np->parent | ||
2793 | && device_is_compatible(np->parent, "uni-north") | ||
2794 | && (device_is_compatible(np, "pci106b,18") || | ||
2795 | device_is_compatible(np, "pci106b,30") || | ||
2796 | device_is_compatible(np, "pci11c1,5811"))) { | ||
2797 | macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; | ||
2798 | core99_firewire_enable(np, 0, 1); | ||
2799 | } | ||
2800 | np = of_find_node_by_name(np, "firewire"); | ||
2801 | } | ||
2802 | |||
2803 | /* Enable ATA-100 before PCI probe. */ | ||
2804 | np = of_find_node_by_name(NULL, "ata-6"); | ||
2805 | while(np) { | ||
2806 | if (np->parent | ||
2807 | && device_is_compatible(np->parent, "uni-north") | ||
2808 | && device_is_compatible(np, "kauai-ata")) { | ||
2809 | core99_ata100_enable(np, 1); | ||
2810 | } | ||
2811 | np = of_find_node_by_name(np, "ata-6"); | ||
2812 | } | ||
2813 | |||
2814 | /* Switch airport off */ | ||
2815 | np = find_devices("radio"); | ||
2816 | while(np) { | ||
2817 | if (np && np->parent == macio_chips[0].of_node) { | ||
2818 | macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; | ||
2819 | core99_airport_enable(np, 0, 0); | ||
2820 | } | ||
2821 | np = np->next; | ||
2822 | } | ||
2823 | } | ||
2824 | |||
2825 | /* On all machines that support sound PM, switch sound off */ | ||
2826 | if (macio_chips[0].of_node) | ||
2827 | pmac_do_feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, | ||
2828 | macio_chips[0].of_node, 0, 0); | ||
2829 | |||
2830 | /* While on some desktop G3s, we turn it back on */ | ||
2831 | if (macio_chips[0].of_node && macio_chips[0].type == macio_heathrow | ||
2832 | && (pmac_mb.model_id == PMAC_TYPE_GOSSAMER || | ||
2833 | pmac_mb.model_id == PMAC_TYPE_SILK)) { | ||
2834 | struct macio_chip* macio = &macio_chips[0]; | ||
2835 | MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE); | ||
2836 | MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N); | ||
2837 | } | ||
2838 | |||
2839 | /* Some machine models need the clock chip to be properly setup for | ||
2840 | * clock spreading now. This should be a platform function but we | ||
2841 | * don't do these at the moment | ||
2842 | */ | ||
2843 | pmac_tweak_clock_spreading(1); | ||
2844 | |||
2845 | #endif /* CONFIG_POWER4 */ | ||
2846 | |||
2847 | /* On all machines, switch modem & serial ports off */ | ||
2848 | np = find_devices("ch-a"); | ||
2849 | while(np) { | ||
2850 | initial_serial_shutdown(np); | ||
2851 | np = np->next; | ||
2852 | } | ||
2853 | np = find_devices("ch-b"); | ||
2854 | while(np) { | ||
2855 | initial_serial_shutdown(np); | ||
2856 | np = np->next; | ||
2857 | } | ||
2858 | } | ||
2859 | |||
2860 | void __init | ||
2861 | pmac_feature_init(void) | ||
2862 | { | ||
2863 | /* Detect the UniNorth memory controller */ | ||
2864 | probe_uninorth(); | ||
2865 | |||
2866 | /* Probe mac-io controllers */ | ||
2867 | if (probe_macios()) { | ||
2868 | printk(KERN_WARNING "No mac-io chip found\n"); | ||
2869 | return; | ||
2870 | } | ||
2871 | |||
2872 | /* Setup low-level i2c stuffs */ | ||
2873 | pmac_init_low_i2c(); | ||
2874 | |||
2875 | /* Probe machine type */ | ||
2876 | if (probe_motherboard()) | ||
2877 | printk(KERN_WARNING "Unknown PowerMac !\n"); | ||
2878 | |||
2879 | /* Set some initial features (turn off some chips that will | ||
2880 | * be later turned on) | ||
2881 | */ | ||
2882 | set_initial_features(); | ||
2883 | } | ||
2884 | |||
2885 | int __init | ||
2886 | pmac_feature_late_init(void) | ||
2887 | { | ||
2888 | struct device_node* np; | ||
2889 | |||
2890 | /* Request some resources late */ | ||
2891 | if (uninorth_node) | ||
2892 | request_OF_resource(uninorth_node, 0, NULL); | ||
2893 | np = find_devices("hammerhead"); | ||
2894 | if (np) | ||
2895 | request_OF_resource(np, 0, NULL); | ||
2896 | np = find_devices("interrupt-controller"); | ||
2897 | if (np) | ||
2898 | request_OF_resource(np, 0, NULL); | ||
2899 | return 0; | ||
2900 | } | ||
2901 | |||
2902 | device_initcall(pmac_feature_late_init); | ||
2903 | |||
2904 | #ifdef CONFIG_POWER4 | ||
2905 | |||
2906 | static void dump_HT_speeds(char *name, u32 cfg, u32 frq) | ||
2907 | { | ||
2908 | int freqs[16] = { 200,300,400,500,600,800,1000,0,0,0,0,0,0,0,0,0 }; | ||
2909 | int bits[8] = { 8,16,0,32,2,4,0,0 }; | ||
2910 | int freq = (frq >> 8) & 0xf; | ||
2911 | |||
2912 | if (freqs[freq] == 0) | ||
2913 | printk("%s: Unknown HT link frequency %x\n", name, freq); | ||
2914 | else | ||
2915 | printk("%s: %d MHz on main link, (%d in / %d out) bits width\n", | ||
2916 | name, freqs[freq], | ||
2917 | bits[(cfg >> 28) & 0x7], bits[(cfg >> 24) & 0x7]); | ||
2918 | } | ||
2919 | |||
2920 | void __init pmac_check_ht_link(void) | ||
2921 | { | ||
2922 | u32 ufreq, freq, ucfg, cfg; | ||
2923 | struct device_node *pcix_node; | ||
2924 | u8 px_bus, px_devfn; | ||
2925 | struct pci_controller *px_hose; | ||
2926 | |||
2927 | (void)in_be32(u3_ht + U3_HT_LINK_COMMAND); | ||
2928 | ucfg = cfg = in_be32(u3_ht + U3_HT_LINK_CONFIG); | ||
2929 | ufreq = freq = in_be32(u3_ht + U3_HT_LINK_FREQ); | ||
2930 | dump_HT_speeds("U3 HyperTransport", cfg, freq); | ||
2931 | |||
2932 | pcix_node = of_find_compatible_node(NULL, "pci", "pci-x"); | ||
2933 | if (pcix_node == NULL) { | ||
2934 | printk("No PCI-X bridge found\n"); | ||
2935 | return; | ||
2936 | } | ||
2937 | if (pci_device_from_OF_node(pcix_node, &px_bus, &px_devfn) != 0) { | ||
2938 | printk("PCI-X bridge found but not matched to pci\n"); | ||
2939 | return; | ||
2940 | } | ||
2941 | px_hose = pci_find_hose_for_OF_device(pcix_node); | ||
2942 | if (px_hose == NULL) { | ||
2943 | printk("PCI-X bridge found but not matched to host\n"); | ||
2944 | return; | ||
2945 | } | ||
2946 | early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg); | ||
2947 | early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq); | ||
2948 | dump_HT_speeds("PCI-X HT Uplink", cfg, freq); | ||
2949 | early_read_config_dword(px_hose, px_bus, px_devfn, 0xc8, &cfg); | ||
2950 | early_read_config_dword(px_hose, px_bus, px_devfn, 0xd0, &freq); | ||
2951 | dump_HT_speeds("PCI-X HT Downlink", cfg, freq); | ||
2952 | } | ||
2953 | |||
2954 | #endif /* CONFIG_POWER4 */ | ||
2955 | |||
2956 | /* | ||
2957 | * Early video resume hook | ||
2958 | */ | ||
2959 | |||
2960 | static void (*pmac_early_vresume_proc)(void *data); | ||
2961 | static void *pmac_early_vresume_data; | ||
2962 | |||
2963 | void pmac_set_early_video_resume(void (*proc)(void *data), void *data) | ||
2964 | { | ||
2965 | if (_machine != _MACH_Pmac) | ||
2966 | return; | ||
2967 | preempt_disable(); | ||
2968 | pmac_early_vresume_proc = proc; | ||
2969 | pmac_early_vresume_data = data; | ||
2970 | preempt_enable(); | ||
2971 | } | ||
2972 | EXPORT_SYMBOL(pmac_set_early_video_resume); | ||
2973 | |||
2974 | void pmac_call_early_video_resume(void) | ||
2975 | { | ||
2976 | if (pmac_early_vresume_proc) | ||
2977 | pmac_early_vresume_proc(pmac_early_vresume_data); | ||
2978 | } | ||
2979 | |||
2980 | /* | ||
2981 | * AGP related suspend/resume code | ||
2982 | */ | ||
2983 | |||
2984 | static struct pci_dev *pmac_agp_bridge; | ||
2985 | static int (*pmac_agp_suspend)(struct pci_dev *bridge); | ||
2986 | static int (*pmac_agp_resume)(struct pci_dev *bridge); | ||
2987 | |||
2988 | void pmac_register_agp_pm(struct pci_dev *bridge, | ||
2989 | int (*suspend)(struct pci_dev *bridge), | ||
2990 | int (*resume)(struct pci_dev *bridge)) | ||
2991 | { | ||
2992 | if (suspend || resume) { | ||
2993 | pmac_agp_bridge = bridge; | ||
2994 | pmac_agp_suspend = suspend; | ||
2995 | pmac_agp_resume = resume; | ||
2996 | return; | ||
2997 | } | ||
2998 | if (bridge != pmac_agp_bridge) | ||
2999 | return; | ||
3000 | pmac_agp_suspend = pmac_agp_resume = NULL; | ||
3001 | return; | ||
3002 | } | ||
3003 | EXPORT_SYMBOL(pmac_register_agp_pm); | ||
3004 | |||
3005 | void pmac_suspend_agp_for_card(struct pci_dev *dev) | ||
3006 | { | ||
3007 | if (pmac_agp_bridge == NULL || pmac_agp_suspend == NULL) | ||
3008 | return; | ||
3009 | if (pmac_agp_bridge->bus != dev->bus) | ||
3010 | return; | ||
3011 | pmac_agp_suspend(pmac_agp_bridge); | ||
3012 | } | ||
3013 | EXPORT_SYMBOL(pmac_suspend_agp_for_card); | ||
3014 | |||
3015 | void pmac_resume_agp_for_card(struct pci_dev *dev) | ||
3016 | { | ||
3017 | if (pmac_agp_bridge == NULL || pmac_agp_resume == NULL) | ||
3018 | return; | ||
3019 | if (pmac_agp_bridge->bus != dev->bus) | ||
3020 | return; | ||
3021 | pmac_agp_resume(pmac_agp_bridge); | ||
3022 | } | ||
3023 | EXPORT_SYMBOL(pmac_resume_agp_for_card); | ||
diff --git a/arch/ppc/platforms/pmac_low_i2c.c b/arch/ppc/platforms/pmac_low_i2c.c deleted file mode 100644 index 08583fce1692..000000000000 --- a/arch/ppc/platforms/pmac_low_i2c.c +++ /dev/null | |||
@@ -1,511 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/pmac_low_i2c.c | ||
3 | * | ||
4 | * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This file contains some low-level i2c access routines that | ||
12 | * need to be used by various bits of the PowerMac platform code | ||
13 | * at times where the real asynchronous & interrupt driven driver | ||
14 | * cannot be used. The API borrows some semantics from the darwin | ||
15 | * driver in order to ease the implementation of the platform | ||
16 | * properties parser | ||
17 | */ | ||
18 | |||
19 | #include <linux/config.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/adb.h> | ||
26 | #include <linux/pmu.h> | ||
27 | #include <asm/keylargo.h> | ||
28 | #include <asm/uninorth.h> | ||
29 | #include <asm/io.h> | ||
30 | #include <asm/prom.h> | ||
31 | #include <asm/machdep.h> | ||
32 | #include <asm/pmac_low_i2c.h> | ||
33 | |||
34 | #define MAX_LOW_I2C_HOST 4 | ||
35 | |||
36 | #if 1 | ||
37 | #define DBG(x...) do {\ | ||
38 | printk(KERN_DEBUG "KW:" x); \ | ||
39 | } while(0) | ||
40 | #else | ||
41 | #define DBGG(x...) | ||
42 | #endif | ||
43 | |||
44 | struct low_i2c_host; | ||
45 | |||
46 | typedef int (*low_i2c_func_t)(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len); | ||
47 | |||
48 | struct low_i2c_host | ||
49 | { | ||
50 | struct device_node *np; /* OF device node */ | ||
51 | struct semaphore mutex; /* Access mutex for use by i2c-keywest */ | ||
52 | low_i2c_func_t func; /* Access function */ | ||
53 | int is_open : 1; /* Poor man's access control */ | ||
54 | int mode; /* Current mode */ | ||
55 | int channel; /* Current channel */ | ||
56 | int num_channels; /* Number of channels */ | ||
57 | void __iomem * base; /* For keywest-i2c, base address */ | ||
58 | int bsteps; /* And register stepping */ | ||
59 | int speed; /* And speed */ | ||
60 | }; | ||
61 | |||
62 | static struct low_i2c_host low_i2c_hosts[MAX_LOW_I2C_HOST]; | ||
63 | |||
64 | /* No locking is necessary on allocation, we are running way before | ||
65 | * anything can race with us | ||
66 | */ | ||
67 | static struct low_i2c_host *find_low_i2c_host(struct device_node *np) | ||
68 | { | ||
69 | int i; | ||
70 | |||
71 | for (i = 0; i < MAX_LOW_I2C_HOST; i++) | ||
72 | if (low_i2c_hosts[i].np == np) | ||
73 | return &low_i2c_hosts[i]; | ||
74 | return NULL; | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | * | ||
79 | * i2c-keywest implementation (UniNorth, U2, U3, Keylargo's) | ||
80 | * | ||
81 | */ | ||
82 | |||
83 | /* | ||
84 | * Keywest i2c definitions borrowed from drivers/i2c/i2c-keywest.h, | ||
85 | * should be moved somewhere in include/asm-ppc/ | ||
86 | */ | ||
87 | /* Register indices */ | ||
88 | typedef enum { | ||
89 | reg_mode = 0, | ||
90 | reg_control, | ||
91 | reg_status, | ||
92 | reg_isr, | ||
93 | reg_ier, | ||
94 | reg_addr, | ||
95 | reg_subaddr, | ||
96 | reg_data | ||
97 | } reg_t; | ||
98 | |||
99 | |||
100 | /* Mode register */ | ||
101 | #define KW_I2C_MODE_100KHZ 0x00 | ||
102 | #define KW_I2C_MODE_50KHZ 0x01 | ||
103 | #define KW_I2C_MODE_25KHZ 0x02 | ||
104 | #define KW_I2C_MODE_DUMB 0x00 | ||
105 | #define KW_I2C_MODE_STANDARD 0x04 | ||
106 | #define KW_I2C_MODE_STANDARDSUB 0x08 | ||
107 | #define KW_I2C_MODE_COMBINED 0x0C | ||
108 | #define KW_I2C_MODE_MODE_MASK 0x0C | ||
109 | #define KW_I2C_MODE_CHAN_MASK 0xF0 | ||
110 | |||
111 | /* Control register */ | ||
112 | #define KW_I2C_CTL_AAK 0x01 | ||
113 | #define KW_I2C_CTL_XADDR 0x02 | ||
114 | #define KW_I2C_CTL_STOP 0x04 | ||
115 | #define KW_I2C_CTL_START 0x08 | ||
116 | |||
117 | /* Status register */ | ||
118 | #define KW_I2C_STAT_BUSY 0x01 | ||
119 | #define KW_I2C_STAT_LAST_AAK 0x02 | ||
120 | #define KW_I2C_STAT_LAST_RW 0x04 | ||
121 | #define KW_I2C_STAT_SDA 0x08 | ||
122 | #define KW_I2C_STAT_SCL 0x10 | ||
123 | |||
124 | /* IER & ISR registers */ | ||
125 | #define KW_I2C_IRQ_DATA 0x01 | ||
126 | #define KW_I2C_IRQ_ADDR 0x02 | ||
127 | #define KW_I2C_IRQ_STOP 0x04 | ||
128 | #define KW_I2C_IRQ_START 0x08 | ||
129 | #define KW_I2C_IRQ_MASK 0x0F | ||
130 | |||
131 | /* State machine states */ | ||
132 | enum { | ||
133 | state_idle, | ||
134 | state_addr, | ||
135 | state_read, | ||
136 | state_write, | ||
137 | state_stop, | ||
138 | state_dead | ||
139 | }; | ||
140 | |||
141 | #define WRONG_STATE(name) do {\ | ||
142 | printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s (isr: %02x)\n", \ | ||
143 | name, __kw_state_names[state], isr); \ | ||
144 | } while(0) | ||
145 | |||
146 | static const char *__kw_state_names[] = { | ||
147 | "state_idle", | ||
148 | "state_addr", | ||
149 | "state_read", | ||
150 | "state_write", | ||
151 | "state_stop", | ||
152 | "state_dead" | ||
153 | }; | ||
154 | |||
155 | static inline u8 __kw_read_reg(struct low_i2c_host *host, reg_t reg) | ||
156 | { | ||
157 | return in_8(host->base + (((unsigned)reg) << host->bsteps)); | ||
158 | } | ||
159 | |||
160 | static inline void __kw_write_reg(struct low_i2c_host *host, reg_t reg, u8 val) | ||
161 | { | ||
162 | out_8(host->base + (((unsigned)reg) << host->bsteps), val); | ||
163 | (void)__kw_read_reg(host, reg_subaddr); | ||
164 | } | ||
165 | |||
166 | #define kw_write_reg(reg, val) __kw_write_reg(host, reg, val) | ||
167 | #define kw_read_reg(reg) __kw_read_reg(host, reg) | ||
168 | |||
169 | |||
170 | /* Don't schedule, the g5 fan controller is too | ||
171 | * timing sensitive | ||
172 | */ | ||
173 | static u8 kw_wait_interrupt(struct low_i2c_host* host) | ||
174 | { | ||
175 | int i; | ||
176 | u8 isr; | ||
177 | |||
178 | for (i = 0; i < 200000; i++) { | ||
179 | isr = kw_read_reg(reg_isr) & KW_I2C_IRQ_MASK; | ||
180 | if (isr != 0) | ||
181 | return isr; | ||
182 | udelay(1); | ||
183 | } | ||
184 | return isr; | ||
185 | } | ||
186 | |||
187 | static int kw_handle_interrupt(struct low_i2c_host *host, int state, int rw, int *rc, u8 **data, int *len, u8 isr) | ||
188 | { | ||
189 | u8 ack; | ||
190 | |||
191 | if (isr == 0) { | ||
192 | if (state != state_stop) { | ||
193 | DBG("KW: Timeout !\n"); | ||
194 | *rc = -EIO; | ||
195 | goto stop; | ||
196 | } | ||
197 | if (state == state_stop) { | ||
198 | ack = kw_read_reg(reg_status); | ||
199 | if (!(ack & KW_I2C_STAT_BUSY)) { | ||
200 | state = state_idle; | ||
201 | kw_write_reg(reg_ier, 0x00); | ||
202 | } | ||
203 | } | ||
204 | return state; | ||
205 | } | ||
206 | |||
207 | if (isr & KW_I2C_IRQ_ADDR) { | ||
208 | ack = kw_read_reg(reg_status); | ||
209 | if (state != state_addr) { | ||
210 | kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); | ||
211 | WRONG_STATE("KW_I2C_IRQ_ADDR"); | ||
212 | *rc = -EIO; | ||
213 | goto stop; | ||
214 | } | ||
215 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { | ||
216 | *rc = -ENODEV; | ||
217 | DBG("KW: NAK on address\n"); | ||
218 | return state_stop; | ||
219 | } else { | ||
220 | if (rw) { | ||
221 | state = state_read; | ||
222 | if (*len > 1) | ||
223 | kw_write_reg(reg_control, KW_I2C_CTL_AAK); | ||
224 | } else { | ||
225 | state = state_write; | ||
226 | kw_write_reg(reg_data, **data); | ||
227 | (*data)++; (*len)--; | ||
228 | } | ||
229 | } | ||
230 | kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); | ||
231 | } | ||
232 | |||
233 | if (isr & KW_I2C_IRQ_DATA) { | ||
234 | if (state == state_read) { | ||
235 | **data = kw_read_reg(reg_data); | ||
236 | (*data)++; (*len)--; | ||
237 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
238 | if ((*len) == 0) | ||
239 | state = state_stop; | ||
240 | else if ((*len) == 1) | ||
241 | kw_write_reg(reg_control, 0); | ||
242 | } else if (state == state_write) { | ||
243 | ack = kw_read_reg(reg_status); | ||
244 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { | ||
245 | DBG("KW: nack on data write\n"); | ||
246 | *rc = -EIO; | ||
247 | goto stop; | ||
248 | } else if (*len) { | ||
249 | kw_write_reg(reg_data, **data); | ||
250 | (*data)++; (*len)--; | ||
251 | } else { | ||
252 | kw_write_reg(reg_control, KW_I2C_CTL_STOP); | ||
253 | state = state_stop; | ||
254 | *rc = 0; | ||
255 | } | ||
256 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
257 | } else { | ||
258 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
259 | WRONG_STATE("KW_I2C_IRQ_DATA"); | ||
260 | if (state != state_stop) { | ||
261 | *rc = -EIO; | ||
262 | goto stop; | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | |||
267 | if (isr & KW_I2C_IRQ_STOP) { | ||
268 | kw_write_reg(reg_isr, KW_I2C_IRQ_STOP); | ||
269 | if (state != state_stop) { | ||
270 | WRONG_STATE("KW_I2C_IRQ_STOP"); | ||
271 | *rc = -EIO; | ||
272 | } | ||
273 | return state_idle; | ||
274 | } | ||
275 | |||
276 | if (isr & KW_I2C_IRQ_START) | ||
277 | kw_write_reg(reg_isr, KW_I2C_IRQ_START); | ||
278 | |||
279 | return state; | ||
280 | |||
281 | stop: | ||
282 | kw_write_reg(reg_control, KW_I2C_CTL_STOP); | ||
283 | return state_stop; | ||
284 | } | ||
285 | |||
286 | static int keywest_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 subaddr, u8 *data, int len) | ||
287 | { | ||
288 | u8 mode_reg = host->speed; | ||
289 | int state = state_addr; | ||
290 | int rc = 0; | ||
291 | |||
292 | /* Setup mode & subaddress if any */ | ||
293 | switch(host->mode) { | ||
294 | case pmac_low_i2c_mode_dumb: | ||
295 | printk(KERN_ERR "low_i2c: Dumb mode not supported !\n"); | ||
296 | return -EINVAL; | ||
297 | case pmac_low_i2c_mode_std: | ||
298 | mode_reg |= KW_I2C_MODE_STANDARD; | ||
299 | break; | ||
300 | case pmac_low_i2c_mode_stdsub: | ||
301 | mode_reg |= KW_I2C_MODE_STANDARDSUB; | ||
302 | kw_write_reg(reg_subaddr, subaddr); | ||
303 | break; | ||
304 | case pmac_low_i2c_mode_combined: | ||
305 | mode_reg |= KW_I2C_MODE_COMBINED; | ||
306 | kw_write_reg(reg_subaddr, subaddr); | ||
307 | break; | ||
308 | } | ||
309 | |||
310 | /* Setup channel & clear pending irqs */ | ||
311 | kw_write_reg(reg_isr, kw_read_reg(reg_isr)); | ||
312 | kw_write_reg(reg_mode, mode_reg | (host->channel << 4)); | ||
313 | kw_write_reg(reg_status, 0); | ||
314 | |||
315 | /* Set up address and r/w bit */ | ||
316 | kw_write_reg(reg_addr, addr); | ||
317 | |||
318 | /* Start sending address & disable interrupt*/ | ||
319 | kw_write_reg(reg_ier, 0 /*KW_I2C_IRQ_MASK*/); | ||
320 | kw_write_reg(reg_control, KW_I2C_CTL_XADDR); | ||
321 | |||
322 | /* State machine, to turn into an interrupt handler */ | ||
323 | while(state != state_idle) { | ||
324 | u8 isr = kw_wait_interrupt(host); | ||
325 | state = kw_handle_interrupt(host, state, addr & 1, &rc, &data, &len, isr); | ||
326 | } | ||
327 | |||
328 | return rc; | ||
329 | } | ||
330 | |||
331 | static void keywest_low_i2c_add(struct device_node *np) | ||
332 | { | ||
333 | struct low_i2c_host *host = find_low_i2c_host(NULL); | ||
334 | unsigned long *psteps, *prate, steps, aoffset = 0; | ||
335 | struct device_node *parent; | ||
336 | |||
337 | if (host == NULL) { | ||
338 | printk(KERN_ERR "low_i2c: Can't allocate host for %s\n", | ||
339 | np->full_name); | ||
340 | return; | ||
341 | } | ||
342 | memset(host, 0, sizeof(*host)); | ||
343 | |||
344 | init_MUTEX(&host->mutex); | ||
345 | host->np = of_node_get(np); | ||
346 | psteps = (unsigned long *)get_property(np, "AAPL,address-step", NULL); | ||
347 | steps = psteps ? (*psteps) : 0x10; | ||
348 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) | ||
349 | steps >>= 1; | ||
350 | parent = of_get_parent(np); | ||
351 | host->num_channels = 1; | ||
352 | if (parent && parent->name[0] == 'u') { | ||
353 | host->num_channels = 2; | ||
354 | aoffset = 3; | ||
355 | } | ||
356 | /* Select interface rate */ | ||
357 | host->speed = KW_I2C_MODE_100KHZ; | ||
358 | prate = (unsigned long *)get_property(np, "AAPL,i2c-rate", NULL); | ||
359 | if (prate) switch(*prate) { | ||
360 | case 100: | ||
361 | host->speed = KW_I2C_MODE_100KHZ; | ||
362 | break; | ||
363 | case 50: | ||
364 | host->speed = KW_I2C_MODE_50KHZ; | ||
365 | break; | ||
366 | case 25: | ||
367 | host->speed = KW_I2C_MODE_25KHZ; | ||
368 | break; | ||
369 | } | ||
370 | host->mode = pmac_low_i2c_mode_std; | ||
371 | host->base = ioremap(np->addrs[0].address + aoffset, | ||
372 | np->addrs[0].size); | ||
373 | host->func = keywest_low_i2c_func; | ||
374 | } | ||
375 | |||
376 | /* | ||
377 | * | ||
378 | * PMU implementation | ||
379 | * | ||
380 | */ | ||
381 | |||
382 | |||
383 | #ifdef CONFIG_ADB_PMU | ||
384 | |||
385 | static int pmu_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len) | ||
386 | { | ||
387 | // TODO | ||
388 | return -ENODEV; | ||
389 | } | ||
390 | |||
391 | static void pmu_low_i2c_add(struct device_node *np) | ||
392 | { | ||
393 | struct low_i2c_host *host = find_low_i2c_host(NULL); | ||
394 | |||
395 | if (host == NULL) { | ||
396 | printk(KERN_ERR "low_i2c: Can't allocate host for %s\n", | ||
397 | np->full_name); | ||
398 | return; | ||
399 | } | ||
400 | memset(host, 0, sizeof(*host)); | ||
401 | |||
402 | init_MUTEX(&host->mutex); | ||
403 | host->np = of_node_get(np); | ||
404 | host->num_channels = 3; | ||
405 | host->mode = pmac_low_i2c_mode_std; | ||
406 | host->func = pmu_low_i2c_func; | ||
407 | } | ||
408 | |||
409 | #endif /* CONFIG_ADB_PMU */ | ||
410 | |||
411 | void __init pmac_init_low_i2c(void) | ||
412 | { | ||
413 | struct device_node *np; | ||
414 | |||
415 | /* Probe keywest-i2c busses */ | ||
416 | np = of_find_compatible_node(NULL, "i2c", "keywest-i2c"); | ||
417 | while(np) { | ||
418 | keywest_low_i2c_add(np); | ||
419 | np = of_find_compatible_node(np, "i2c", "keywest-i2c"); | ||
420 | } | ||
421 | |||
422 | #ifdef CONFIG_ADB_PMU | ||
423 | /* Probe PMU busses */ | ||
424 | np = of_find_node_by_name(NULL, "via-pmu"); | ||
425 | if (np) | ||
426 | pmu_low_i2c_add(np); | ||
427 | #endif /* CONFIG_ADB_PMU */ | ||
428 | |||
429 | /* TODO: Add CUDA support as well */ | ||
430 | } | ||
431 | |||
432 | int pmac_low_i2c_lock(struct device_node *np) | ||
433 | { | ||
434 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
435 | |||
436 | if (!host) | ||
437 | return -ENODEV; | ||
438 | down(&host->mutex); | ||
439 | return 0; | ||
440 | } | ||
441 | EXPORT_SYMBOL(pmac_low_i2c_lock); | ||
442 | |||
443 | int pmac_low_i2c_unlock(struct device_node *np) | ||
444 | { | ||
445 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
446 | |||
447 | if (!host) | ||
448 | return -ENODEV; | ||
449 | up(&host->mutex); | ||
450 | return 0; | ||
451 | } | ||
452 | EXPORT_SYMBOL(pmac_low_i2c_unlock); | ||
453 | |||
454 | |||
455 | int pmac_low_i2c_open(struct device_node *np, int channel) | ||
456 | { | ||
457 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
458 | |||
459 | if (!host) | ||
460 | return -ENODEV; | ||
461 | |||
462 | if (channel >= host->num_channels) | ||
463 | return -EINVAL; | ||
464 | |||
465 | down(&host->mutex); | ||
466 | host->is_open = 1; | ||
467 | host->channel = channel; | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | EXPORT_SYMBOL(pmac_low_i2c_open); | ||
472 | |||
473 | int pmac_low_i2c_close(struct device_node *np) | ||
474 | { | ||
475 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
476 | |||
477 | if (!host) | ||
478 | return -ENODEV; | ||
479 | |||
480 | host->is_open = 0; | ||
481 | up(&host->mutex); | ||
482 | |||
483 | return 0; | ||
484 | } | ||
485 | EXPORT_SYMBOL(pmac_low_i2c_close); | ||
486 | |||
487 | int pmac_low_i2c_setmode(struct device_node *np, int mode) | ||
488 | { | ||
489 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
490 | |||
491 | if (!host) | ||
492 | return -ENODEV; | ||
493 | WARN_ON(!host->is_open); | ||
494 | host->mode = mode; | ||
495 | |||
496 | return 0; | ||
497 | } | ||
498 | EXPORT_SYMBOL(pmac_low_i2c_setmode); | ||
499 | |||
500 | int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len) | ||
501 | { | ||
502 | struct low_i2c_host *host = find_low_i2c_host(np); | ||
503 | |||
504 | if (!host) | ||
505 | return -ENODEV; | ||
506 | WARN_ON(!host->is_open); | ||
507 | |||
508 | return host->func(host, addrdir, subaddr, data, len); | ||
509 | } | ||
510 | EXPORT_SYMBOL(pmac_low_i2c_xfer); | ||
511 | |||
diff --git a/arch/ppc/platforms/pmac_nvram.c b/arch/ppc/platforms/pmac_nvram.c deleted file mode 100644 index 8c9b008c7226..000000000000 --- a/arch/ppc/platforms/pmac_nvram.c +++ /dev/null | |||
@@ -1,584 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/pmac_nvram.c | ||
3 | * | ||
4 | * Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * Todo: - add support for the OF persistent properties | ||
12 | */ | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/stddef.h> | ||
17 | #include <linux/string.h> | ||
18 | #include <linux/nvram.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/adb.h> | ||
24 | #include <linux/pmu.h> | ||
25 | #include <linux/bootmem.h> | ||
26 | #include <linux/completion.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <asm/sections.h> | ||
29 | #include <asm/io.h> | ||
30 | #include <asm/system.h> | ||
31 | #include <asm/prom.h> | ||
32 | #include <asm/machdep.h> | ||
33 | #include <asm/nvram.h> | ||
34 | |||
35 | #define DEBUG | ||
36 | |||
37 | #ifdef DEBUG | ||
38 | #define DBG(x...) printk(x) | ||
39 | #else | ||
40 | #define DBG(x...) | ||
41 | #endif | ||
42 | |||
43 | #define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */ | ||
44 | |||
45 | #define CORE99_SIGNATURE 0x5a | ||
46 | #define CORE99_ADLER_START 0x14 | ||
47 | |||
48 | /* On Core99, nvram is either a sharp, a micron or an AMD flash */ | ||
49 | #define SM_FLASH_STATUS_DONE 0x80 | ||
50 | #define SM_FLASH_STATUS_ERR 0x38 | ||
51 | #define SM_FLASH_CMD_ERASE_CONFIRM 0xd0 | ||
52 | #define SM_FLASH_CMD_ERASE_SETUP 0x20 | ||
53 | #define SM_FLASH_CMD_RESET 0xff | ||
54 | #define SM_FLASH_CMD_WRITE_SETUP 0x40 | ||
55 | #define SM_FLASH_CMD_CLEAR_STATUS 0x50 | ||
56 | #define SM_FLASH_CMD_READ_STATUS 0x70 | ||
57 | |||
58 | /* CHRP NVRAM header */ | ||
59 | struct chrp_header { | ||
60 | u8 signature; | ||
61 | u8 cksum; | ||
62 | u16 len; | ||
63 | char name[12]; | ||
64 | u8 data[0]; | ||
65 | }; | ||
66 | |||
67 | struct core99_header { | ||
68 | struct chrp_header hdr; | ||
69 | u32 adler; | ||
70 | u32 generation; | ||
71 | u32 reserved[2]; | ||
72 | }; | ||
73 | |||
74 | /* | ||
75 | * Read and write the non-volatile RAM on PowerMacs and CHRP machines. | ||
76 | */ | ||
77 | static int nvram_naddrs; | ||
78 | static volatile unsigned char *nvram_addr; | ||
79 | static volatile unsigned char *nvram_data; | ||
80 | static int nvram_mult, is_core_99; | ||
81 | static int core99_bank = 0; | ||
82 | static int nvram_partitions[3]; | ||
83 | static DEFINE_SPINLOCK(nv_lock); | ||
84 | |||
85 | extern int pmac_newworld; | ||
86 | extern int system_running; | ||
87 | |||
88 | static int (*core99_write_bank)(int bank, u8* datas); | ||
89 | static int (*core99_erase_bank)(int bank); | ||
90 | |||
91 | static char *nvram_image; | ||
92 | |||
93 | |||
94 | static unsigned char core99_nvram_read_byte(int addr) | ||
95 | { | ||
96 | if (nvram_image == NULL) | ||
97 | return 0xff; | ||
98 | return nvram_image[addr]; | ||
99 | } | ||
100 | |||
101 | static void core99_nvram_write_byte(int addr, unsigned char val) | ||
102 | { | ||
103 | if (nvram_image == NULL) | ||
104 | return; | ||
105 | nvram_image[addr] = val; | ||
106 | } | ||
107 | |||
108 | |||
109 | static unsigned char direct_nvram_read_byte(int addr) | ||
110 | { | ||
111 | return in_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]); | ||
112 | } | ||
113 | |||
114 | static void direct_nvram_write_byte(int addr, unsigned char val) | ||
115 | { | ||
116 | out_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult], val); | ||
117 | } | ||
118 | |||
119 | |||
120 | static unsigned char indirect_nvram_read_byte(int addr) | ||
121 | { | ||
122 | unsigned char val; | ||
123 | unsigned long flags; | ||
124 | |||
125 | spin_lock_irqsave(&nv_lock, flags); | ||
126 | out_8(nvram_addr, addr >> 5); | ||
127 | val = in_8(&nvram_data[(addr & 0x1f) << 4]); | ||
128 | spin_unlock_irqrestore(&nv_lock, flags); | ||
129 | |||
130 | return val; | ||
131 | } | ||
132 | |||
133 | static void indirect_nvram_write_byte(int addr, unsigned char val) | ||
134 | { | ||
135 | unsigned long flags; | ||
136 | |||
137 | spin_lock_irqsave(&nv_lock, flags); | ||
138 | out_8(nvram_addr, addr >> 5); | ||
139 | out_8(&nvram_data[(addr & 0x1f) << 4], val); | ||
140 | spin_unlock_irqrestore(&nv_lock, flags); | ||
141 | } | ||
142 | |||
143 | |||
144 | #ifdef CONFIG_ADB_PMU | ||
145 | |||
146 | static void pmu_nvram_complete(struct adb_request *req) | ||
147 | { | ||
148 | if (req->arg) | ||
149 | complete((struct completion *)req->arg); | ||
150 | } | ||
151 | |||
152 | static unsigned char pmu_nvram_read_byte(int addr) | ||
153 | { | ||
154 | struct adb_request req; | ||
155 | DECLARE_COMPLETION(req_complete); | ||
156 | |||
157 | req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; | ||
158 | if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM, | ||
159 | (addr >> 8) & 0xff, addr & 0xff)) | ||
160 | return 0xff; | ||
161 | if (system_state == SYSTEM_RUNNING) | ||
162 | wait_for_completion(&req_complete); | ||
163 | while (!req.complete) | ||
164 | pmu_poll(); | ||
165 | return req.reply[0]; | ||
166 | } | ||
167 | |||
168 | static void pmu_nvram_write_byte(int addr, unsigned char val) | ||
169 | { | ||
170 | struct adb_request req; | ||
171 | DECLARE_COMPLETION(req_complete); | ||
172 | |||
173 | req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; | ||
174 | if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM, | ||
175 | (addr >> 8) & 0xff, addr & 0xff, val)) | ||
176 | return; | ||
177 | if (system_state == SYSTEM_RUNNING) | ||
178 | wait_for_completion(&req_complete); | ||
179 | while (!req.complete) | ||
180 | pmu_poll(); | ||
181 | } | ||
182 | |||
183 | #endif /* CONFIG_ADB_PMU */ | ||
184 | |||
185 | |||
186 | static u8 chrp_checksum(struct chrp_header* hdr) | ||
187 | { | ||
188 | u8 *ptr; | ||
189 | u16 sum = hdr->signature; | ||
190 | for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++) | ||
191 | sum += *ptr; | ||
192 | while (sum > 0xFF) | ||
193 | sum = (sum & 0xFF) + (sum>>8); | ||
194 | return sum; | ||
195 | } | ||
196 | |||
197 | static u32 core99_calc_adler(u8 *buffer) | ||
198 | { | ||
199 | int cnt; | ||
200 | u32 low, high; | ||
201 | |||
202 | buffer += CORE99_ADLER_START; | ||
203 | low = 1; | ||
204 | high = 0; | ||
205 | for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) { | ||
206 | if ((cnt % 5000) == 0) { | ||
207 | high %= 65521UL; | ||
208 | high %= 65521UL; | ||
209 | } | ||
210 | low += buffer[cnt]; | ||
211 | high += low; | ||
212 | } | ||
213 | low %= 65521UL; | ||
214 | high %= 65521UL; | ||
215 | |||
216 | return (high << 16) | low; | ||
217 | } | ||
218 | |||
219 | static u32 core99_check(u8* datas) | ||
220 | { | ||
221 | struct core99_header* hdr99 = (struct core99_header*)datas; | ||
222 | |||
223 | if (hdr99->hdr.signature != CORE99_SIGNATURE) { | ||
224 | DBG("Invalid signature\n"); | ||
225 | return 0; | ||
226 | } | ||
227 | if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) { | ||
228 | DBG("Invalid checksum\n"); | ||
229 | return 0; | ||
230 | } | ||
231 | if (hdr99->adler != core99_calc_adler(datas)) { | ||
232 | DBG("Invalid adler\n"); | ||
233 | return 0; | ||
234 | } | ||
235 | return hdr99->generation; | ||
236 | } | ||
237 | |||
238 | static int sm_erase_bank(int bank) | ||
239 | { | ||
240 | int stat, i; | ||
241 | unsigned long timeout; | ||
242 | |||
243 | u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; | ||
244 | |||
245 | DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank); | ||
246 | |||
247 | out_8(base, SM_FLASH_CMD_ERASE_SETUP); | ||
248 | out_8(base, SM_FLASH_CMD_ERASE_CONFIRM); | ||
249 | timeout = 0; | ||
250 | do { | ||
251 | if (++timeout > 1000000) { | ||
252 | printk(KERN_ERR "nvram: Sharp/Miron flash erase timeout !\n"); | ||
253 | break; | ||
254 | } | ||
255 | out_8(base, SM_FLASH_CMD_READ_STATUS); | ||
256 | stat = in_8(base); | ||
257 | } while (!(stat & SM_FLASH_STATUS_DONE)); | ||
258 | |||
259 | out_8(base, SM_FLASH_CMD_CLEAR_STATUS); | ||
260 | out_8(base, SM_FLASH_CMD_RESET); | ||
261 | |||
262 | for (i=0; i<NVRAM_SIZE; i++) | ||
263 | if (base[i] != 0xff) { | ||
264 | printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n"); | ||
265 | return -ENXIO; | ||
266 | } | ||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static int sm_write_bank(int bank, u8* datas) | ||
271 | { | ||
272 | int i, stat = 0; | ||
273 | unsigned long timeout; | ||
274 | |||
275 | u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; | ||
276 | |||
277 | DBG("nvram: Sharp/Micron Writing bank %d...\n", bank); | ||
278 | |||
279 | for (i=0; i<NVRAM_SIZE; i++) { | ||
280 | out_8(base+i, SM_FLASH_CMD_WRITE_SETUP); | ||
281 | udelay(1); | ||
282 | out_8(base+i, datas[i]); | ||
283 | timeout = 0; | ||
284 | do { | ||
285 | if (++timeout > 1000000) { | ||
286 | printk(KERN_ERR "nvram: Sharp/Micron flash write timeout !\n"); | ||
287 | break; | ||
288 | } | ||
289 | out_8(base, SM_FLASH_CMD_READ_STATUS); | ||
290 | stat = in_8(base); | ||
291 | } while (!(stat & SM_FLASH_STATUS_DONE)); | ||
292 | if (!(stat & SM_FLASH_STATUS_DONE)) | ||
293 | break; | ||
294 | } | ||
295 | out_8(base, SM_FLASH_CMD_CLEAR_STATUS); | ||
296 | out_8(base, SM_FLASH_CMD_RESET); | ||
297 | for (i=0; i<NVRAM_SIZE; i++) | ||
298 | if (base[i] != datas[i]) { | ||
299 | printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n"); | ||
300 | return -ENXIO; | ||
301 | } | ||
302 | return 0; | ||
303 | } | ||
304 | |||
305 | static int amd_erase_bank(int bank) | ||
306 | { | ||
307 | int i, stat = 0; | ||
308 | unsigned long timeout; | ||
309 | |||
310 | u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; | ||
311 | |||
312 | DBG("nvram: AMD Erasing bank %d...\n", bank); | ||
313 | |||
314 | /* Unlock 1 */ | ||
315 | out_8(base+0x555, 0xaa); | ||
316 | udelay(1); | ||
317 | /* Unlock 2 */ | ||
318 | out_8(base+0x2aa, 0x55); | ||
319 | udelay(1); | ||
320 | |||
321 | /* Sector-Erase */ | ||
322 | out_8(base+0x555, 0x80); | ||
323 | udelay(1); | ||
324 | out_8(base+0x555, 0xaa); | ||
325 | udelay(1); | ||
326 | out_8(base+0x2aa, 0x55); | ||
327 | udelay(1); | ||
328 | out_8(base, 0x30); | ||
329 | udelay(1); | ||
330 | |||
331 | timeout = 0; | ||
332 | do { | ||
333 | if (++timeout > 1000000) { | ||
334 | printk(KERN_ERR "nvram: AMD flash erase timeout !\n"); | ||
335 | break; | ||
336 | } | ||
337 | stat = in_8(base) ^ in_8(base); | ||
338 | } while (stat != 0); | ||
339 | |||
340 | /* Reset */ | ||
341 | out_8(base, 0xf0); | ||
342 | udelay(1); | ||
343 | |||
344 | for (i=0; i<NVRAM_SIZE; i++) | ||
345 | if (base[i] != 0xff) { | ||
346 | printk(KERN_ERR "nvram: AMD flash erase failed !\n"); | ||
347 | return -ENXIO; | ||
348 | } | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static int amd_write_bank(int bank, u8* datas) | ||
353 | { | ||
354 | int i, stat = 0; | ||
355 | unsigned long timeout; | ||
356 | |||
357 | u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; | ||
358 | |||
359 | DBG("nvram: AMD Writing bank %d...\n", bank); | ||
360 | |||
361 | for (i=0; i<NVRAM_SIZE; i++) { | ||
362 | /* Unlock 1 */ | ||
363 | out_8(base+0x555, 0xaa); | ||
364 | udelay(1); | ||
365 | /* Unlock 2 */ | ||
366 | out_8(base+0x2aa, 0x55); | ||
367 | udelay(1); | ||
368 | |||
369 | /* Write single word */ | ||
370 | out_8(base+0x555, 0xa0); | ||
371 | udelay(1); | ||
372 | out_8(base+i, datas[i]); | ||
373 | |||
374 | timeout = 0; | ||
375 | do { | ||
376 | if (++timeout > 1000000) { | ||
377 | printk(KERN_ERR "nvram: AMD flash write timeout !\n"); | ||
378 | break; | ||
379 | } | ||
380 | stat = in_8(base) ^ in_8(base); | ||
381 | } while (stat != 0); | ||
382 | if (stat != 0) | ||
383 | break; | ||
384 | } | ||
385 | |||
386 | /* Reset */ | ||
387 | out_8(base, 0xf0); | ||
388 | udelay(1); | ||
389 | |||
390 | for (i=0; i<NVRAM_SIZE; i++) | ||
391 | if (base[i] != datas[i]) { | ||
392 | printk(KERN_ERR "nvram: AMD flash write failed !\n"); | ||
393 | return -ENXIO; | ||
394 | } | ||
395 | return 0; | ||
396 | } | ||
397 | |||
398 | static void __init lookup_partitions(void) | ||
399 | { | ||
400 | u8 buffer[17]; | ||
401 | int i, offset; | ||
402 | struct chrp_header* hdr; | ||
403 | |||
404 | if (pmac_newworld) { | ||
405 | nvram_partitions[pmac_nvram_OF] = -1; | ||
406 | nvram_partitions[pmac_nvram_XPRAM] = -1; | ||
407 | nvram_partitions[pmac_nvram_NR] = -1; | ||
408 | hdr = (struct chrp_header *)buffer; | ||
409 | |||
410 | offset = 0; | ||
411 | buffer[16] = 0; | ||
412 | do { | ||
413 | for (i=0;i<16;i++) | ||
414 | buffer[i] = nvram_read_byte(offset+i); | ||
415 | if (!strcmp(hdr->name, "common")) | ||
416 | nvram_partitions[pmac_nvram_OF] = offset + 0x10; | ||
417 | if (!strcmp(hdr->name, "APL,MacOS75")) { | ||
418 | nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10; | ||
419 | nvram_partitions[pmac_nvram_NR] = offset + 0x110; | ||
420 | } | ||
421 | offset += (hdr->len * 0x10); | ||
422 | } while(offset < NVRAM_SIZE); | ||
423 | } else { | ||
424 | nvram_partitions[pmac_nvram_OF] = 0x1800; | ||
425 | nvram_partitions[pmac_nvram_XPRAM] = 0x1300; | ||
426 | nvram_partitions[pmac_nvram_NR] = 0x1400; | ||
427 | } | ||
428 | DBG("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]); | ||
429 | DBG("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]); | ||
430 | DBG("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]); | ||
431 | } | ||
432 | |||
433 | static void core99_nvram_sync(void) | ||
434 | { | ||
435 | struct core99_header* hdr99; | ||
436 | unsigned long flags; | ||
437 | |||
438 | if (!is_core_99 || !nvram_data || !nvram_image) | ||
439 | return; | ||
440 | |||
441 | spin_lock_irqsave(&nv_lock, flags); | ||
442 | if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE, | ||
443 | NVRAM_SIZE)) | ||
444 | goto bail; | ||
445 | |||
446 | DBG("Updating nvram...\n"); | ||
447 | |||
448 | hdr99 = (struct core99_header*)nvram_image; | ||
449 | hdr99->generation++; | ||
450 | hdr99->hdr.signature = CORE99_SIGNATURE; | ||
451 | hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr); | ||
452 | hdr99->adler = core99_calc_adler(nvram_image); | ||
453 | core99_bank = core99_bank ? 0 : 1; | ||
454 | if (core99_erase_bank) | ||
455 | if (core99_erase_bank(core99_bank)) { | ||
456 | printk("nvram: Error erasing bank %d\n", core99_bank); | ||
457 | goto bail; | ||
458 | } | ||
459 | if (core99_write_bank) | ||
460 | if (core99_write_bank(core99_bank, nvram_image)) | ||
461 | printk("nvram: Error writing bank %d\n", core99_bank); | ||
462 | bail: | ||
463 | spin_unlock_irqrestore(&nv_lock, flags); | ||
464 | |||
465 | #ifdef DEBUG | ||
466 | mdelay(2000); | ||
467 | #endif | ||
468 | } | ||
469 | |||
470 | void __init pmac_nvram_init(void) | ||
471 | { | ||
472 | struct device_node *dp; | ||
473 | |||
474 | nvram_naddrs = 0; | ||
475 | |||
476 | dp = find_devices("nvram"); | ||
477 | if (dp == NULL) { | ||
478 | printk(KERN_ERR "Can't find NVRAM device\n"); | ||
479 | return; | ||
480 | } | ||
481 | nvram_naddrs = dp->n_addrs; | ||
482 | is_core_99 = device_is_compatible(dp, "nvram,flash"); | ||
483 | if (is_core_99) { | ||
484 | int i; | ||
485 | u32 gen_bank0, gen_bank1; | ||
486 | |||
487 | if (nvram_naddrs < 1) { | ||
488 | printk(KERN_ERR "nvram: no address\n"); | ||
489 | return; | ||
490 | } | ||
491 | nvram_image = alloc_bootmem(NVRAM_SIZE); | ||
492 | if (nvram_image == NULL) { | ||
493 | printk(KERN_ERR "nvram: can't allocate ram image\n"); | ||
494 | return; | ||
495 | } | ||
496 | nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2); | ||
497 | nvram_naddrs = 1; /* Make sure we get the correct case */ | ||
498 | |||
499 | DBG("nvram: Checking bank 0...\n"); | ||
500 | |||
501 | gen_bank0 = core99_check((u8 *)nvram_data); | ||
502 | gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE); | ||
503 | core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0; | ||
504 | |||
505 | DBG("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1); | ||
506 | DBG("nvram: Active bank is: %d\n", core99_bank); | ||
507 | |||
508 | for (i=0; i<NVRAM_SIZE; i++) | ||
509 | nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE]; | ||
510 | |||
511 | ppc_md.nvram_read_val = core99_nvram_read_byte; | ||
512 | ppc_md.nvram_write_val = core99_nvram_write_byte; | ||
513 | ppc_md.nvram_sync = core99_nvram_sync; | ||
514 | /* | ||
515 | * Maybe we could be smarter here though making an exclusive list | ||
516 | * of known flash chips is a bit nasty as older OF didn't provide us | ||
517 | * with a useful "compatible" entry. A solution would be to really | ||
518 | * identify the chip using flash id commands and base ourselves on | ||
519 | * a list of known chips IDs | ||
520 | */ | ||
521 | if (device_is_compatible(dp, "amd-0137")) { | ||
522 | core99_erase_bank = amd_erase_bank; | ||
523 | core99_write_bank = amd_write_bank; | ||
524 | } else { | ||
525 | core99_erase_bank = sm_erase_bank; | ||
526 | core99_write_bank = sm_write_bank; | ||
527 | } | ||
528 | } else if (_machine == _MACH_chrp && nvram_naddrs == 1) { | ||
529 | nvram_data = ioremap(dp->addrs[0].address + isa_mem_base, | ||
530 | dp->addrs[0].size); | ||
531 | nvram_mult = 1; | ||
532 | ppc_md.nvram_read_val = direct_nvram_read_byte; | ||
533 | ppc_md.nvram_write_val = direct_nvram_write_byte; | ||
534 | } else if (nvram_naddrs == 1) { | ||
535 | nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size); | ||
536 | nvram_mult = (dp->addrs[0].size + NVRAM_SIZE - 1) / NVRAM_SIZE; | ||
537 | ppc_md.nvram_read_val = direct_nvram_read_byte; | ||
538 | ppc_md.nvram_write_val = direct_nvram_write_byte; | ||
539 | } else if (nvram_naddrs == 2) { | ||
540 | nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size); | ||
541 | nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size); | ||
542 | ppc_md.nvram_read_val = indirect_nvram_read_byte; | ||
543 | ppc_md.nvram_write_val = indirect_nvram_write_byte; | ||
544 | } else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) { | ||
545 | #ifdef CONFIG_ADB_PMU | ||
546 | nvram_naddrs = -1; | ||
547 | ppc_md.nvram_read_val = pmu_nvram_read_byte; | ||
548 | ppc_md.nvram_write_val = pmu_nvram_write_byte; | ||
549 | #endif /* CONFIG_ADB_PMU */ | ||
550 | } else { | ||
551 | printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n", | ||
552 | nvram_naddrs); | ||
553 | } | ||
554 | lookup_partitions(); | ||
555 | } | ||
556 | |||
557 | int pmac_get_partition(int partition) | ||
558 | { | ||
559 | return nvram_partitions[partition]; | ||
560 | } | ||
561 | |||
562 | u8 pmac_xpram_read(int xpaddr) | ||
563 | { | ||
564 | int offset = nvram_partitions[pmac_nvram_XPRAM]; | ||
565 | |||
566 | if (offset < 0) | ||
567 | return 0xff; | ||
568 | |||
569 | return ppc_md.nvram_read_val(xpaddr + offset); | ||
570 | } | ||
571 | |||
572 | void pmac_xpram_write(int xpaddr, u8 data) | ||
573 | { | ||
574 | int offset = nvram_partitions[pmac_nvram_XPRAM]; | ||
575 | |||
576 | if (offset < 0) | ||
577 | return; | ||
578 | |||
579 | ppc_md.nvram_write_val(xpaddr + offset, data); | ||
580 | } | ||
581 | |||
582 | EXPORT_SYMBOL(pmac_get_partition); | ||
583 | EXPORT_SYMBOL(pmac_xpram_read); | ||
584 | EXPORT_SYMBOL(pmac_xpram_write); | ||
diff --git a/arch/ppc/platforms/pmac_pci.c b/arch/ppc/platforms/pmac_pci.c deleted file mode 100644 index 786295b6ddd0..000000000000 --- a/arch/ppc/platforms/pmac_pci.c +++ /dev/null | |||
@@ -1,1124 +0,0 @@ | |||
1 | /* | ||
2 | * Support for PCI bridges found on Power Macintoshes. | ||
3 | * At present the "bandit" and "chaos" bridges are supported. | ||
4 | * Fortunately you access configuration space in the same | ||
5 | * way with either bridge. | ||
6 | * | ||
7 | * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/pci.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/init.h> | ||
20 | |||
21 | #include <asm/sections.h> | ||
22 | #include <asm/io.h> | ||
23 | #include <asm/prom.h> | ||
24 | #include <asm/pci-bridge.h> | ||
25 | #include <asm/machdep.h> | ||
26 | #include <asm/pmac_feature.h> | ||
27 | |||
28 | #undef DEBUG | ||
29 | |||
30 | #ifdef DEBUG | ||
31 | #ifdef CONFIG_XMON | ||
32 | extern void xmon_printf(const char *fmt, ...); | ||
33 | #define DBG(x...) xmon_printf(x) | ||
34 | #else | ||
35 | #define DBG(x...) printk(x) | ||
36 | #endif | ||
37 | #else | ||
38 | #define DBG(x...) | ||
39 | #endif | ||
40 | |||
41 | static int add_bridge(struct device_node *dev); | ||
42 | extern void pmac_check_ht_link(void); | ||
43 | |||
44 | /* XXX Could be per-controller, but I don't think we risk anything by | ||
45 | * assuming we won't have both UniNorth and Bandit */ | ||
46 | static int has_uninorth; | ||
47 | #ifdef CONFIG_POWER4 | ||
48 | static struct pci_controller *u3_agp; | ||
49 | #endif /* CONFIG_POWER4 */ | ||
50 | |||
51 | extern u8 pci_cache_line_size; | ||
52 | extern int pcibios_assign_bus_offset; | ||
53 | |||
54 | struct device_node *k2_skiplist[2]; | ||
55 | |||
56 | /* | ||
57 | * Magic constants for enabling cache coherency in the bandit/PSX bridge. | ||
58 | */ | ||
59 | #define BANDIT_DEVID_2 8 | ||
60 | #define BANDIT_REVID 3 | ||
61 | |||
62 | #define BANDIT_DEVNUM 11 | ||
63 | #define BANDIT_MAGIC 0x50 | ||
64 | #define BANDIT_COHERENT 0x40 | ||
65 | |||
66 | static int __init | ||
67 | fixup_one_level_bus_range(struct device_node *node, int higher) | ||
68 | { | ||
69 | for (; node != 0;node = node->sibling) { | ||
70 | int * bus_range; | ||
71 | unsigned int *class_code; | ||
72 | int len; | ||
73 | |||
74 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | ||
75 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | ||
76 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | ||
77 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | ||
78 | continue; | ||
79 | bus_range = (int *) get_property(node, "bus-range", &len); | ||
80 | if (bus_range != NULL && len > 2 * sizeof(int)) { | ||
81 | if (bus_range[1] > higher) | ||
82 | higher = bus_range[1]; | ||
83 | } | ||
84 | higher = fixup_one_level_bus_range(node->child, higher); | ||
85 | } | ||
86 | return higher; | ||
87 | } | ||
88 | |||
89 | /* This routine fixes the "bus-range" property of all bridges in the | ||
90 | * system since they tend to have their "last" member wrong on macs | ||
91 | * | ||
92 | * Note that the bus numbers manipulated here are OF bus numbers, they | ||
93 | * are not Linux bus numbers. | ||
94 | */ | ||
95 | static void __init | ||
96 | fixup_bus_range(struct device_node *bridge) | ||
97 | { | ||
98 | int * bus_range; | ||
99 | int len; | ||
100 | |||
101 | /* Lookup the "bus-range" property for the hose */ | ||
102 | bus_range = (int *) get_property(bridge, "bus-range", &len); | ||
103 | if (bus_range == NULL || len < 2 * sizeof(int)) { | ||
104 | printk(KERN_WARNING "Can't get bus-range for %s\n", | ||
105 | bridge->full_name); | ||
106 | return; | ||
107 | } | ||
108 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * Apple MacRISC (U3, UniNorth, Bandit, Chaos) PCI controllers. | ||
113 | * | ||
114 | * The "Bandit" version is present in all early PCI PowerMacs, | ||
115 | * and up to the first ones using Grackle. Some machines may | ||
116 | * have 2 bandit controllers (2 PCI busses). | ||
117 | * | ||
118 | * "Chaos" is used in some "Bandit"-type machines as a bridge | ||
119 | * for the separate display bus. It is accessed the same | ||
120 | * way as bandit, but cannot be probed for devices. It therefore | ||
121 | * has its own config access functions. | ||
122 | * | ||
123 | * The "UniNorth" version is present in all Core99 machines | ||
124 | * (iBook, G4, new IMacs, and all the recent Apple machines). | ||
125 | * It contains 3 controllers in one ASIC. | ||
126 | * | ||
127 | * The U3 is the bridge used on G5 machines. It contains an | ||
128 | * AGP bus which is dealt with the old UniNorth access routines | ||
129 | * and a HyperTransport bus which uses its own set of access | ||
130 | * functions. | ||
131 | */ | ||
132 | |||
133 | #define MACRISC_CFA0(devfn, off) \ | ||
134 | ((1 << (unsigned long)PCI_SLOT(dev_fn)) \ | ||
135 | | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \ | ||
136 | | (((unsigned long)(off)) & 0xFCUL)) | ||
137 | |||
138 | #define MACRISC_CFA1(bus, devfn, off) \ | ||
139 | ((((unsigned long)(bus)) << 16) \ | ||
140 | |(((unsigned long)(devfn)) << 8) \ | ||
141 | |(((unsigned long)(off)) & 0xFCUL) \ | ||
142 | |1UL) | ||
143 | |||
144 | static void volatile __iomem * | ||
145 | macrisc_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, u8 offset) | ||
146 | { | ||
147 | unsigned int caddr; | ||
148 | |||
149 | if (bus == hose->first_busno) { | ||
150 | if (dev_fn < (11 << 3)) | ||
151 | return NULL; | ||
152 | caddr = MACRISC_CFA0(dev_fn, offset); | ||
153 | } else | ||
154 | caddr = MACRISC_CFA1(bus, dev_fn, offset); | ||
155 | |||
156 | /* Uninorth will return garbage if we don't read back the value ! */ | ||
157 | do { | ||
158 | out_le32(hose->cfg_addr, caddr); | ||
159 | } while (in_le32(hose->cfg_addr) != caddr); | ||
160 | |||
161 | offset &= has_uninorth ? 0x07 : 0x03; | ||
162 | return hose->cfg_data + offset; | ||
163 | } | ||
164 | |||
165 | static int | ||
166 | macrisc_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
167 | int len, u32 *val) | ||
168 | { | ||
169 | struct pci_controller *hose = bus->sysdata; | ||
170 | void volatile __iomem *addr; | ||
171 | |||
172 | addr = macrisc_cfg_access(hose, bus->number, devfn, offset); | ||
173 | if (!addr) | ||
174 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
175 | /* | ||
176 | * Note: the caller has already checked that offset is | ||
177 | * suitably aligned and that len is 1, 2 or 4. | ||
178 | */ | ||
179 | switch (len) { | ||
180 | case 1: | ||
181 | *val = in_8(addr); | ||
182 | break; | ||
183 | case 2: | ||
184 | *val = in_le16(addr); | ||
185 | break; | ||
186 | default: | ||
187 | *val = in_le32(addr); | ||
188 | break; | ||
189 | } | ||
190 | return PCIBIOS_SUCCESSFUL; | ||
191 | } | ||
192 | |||
193 | static int | ||
194 | macrisc_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
195 | int len, u32 val) | ||
196 | { | ||
197 | struct pci_controller *hose = bus->sysdata; | ||
198 | void volatile __iomem *addr; | ||
199 | |||
200 | addr = macrisc_cfg_access(hose, bus->number, devfn, offset); | ||
201 | if (!addr) | ||
202 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
203 | /* | ||
204 | * Note: the caller has already checked that offset is | ||
205 | * suitably aligned and that len is 1, 2 or 4. | ||
206 | */ | ||
207 | switch (len) { | ||
208 | case 1: | ||
209 | out_8(addr, val); | ||
210 | (void) in_8(addr); | ||
211 | break; | ||
212 | case 2: | ||
213 | out_le16(addr, val); | ||
214 | (void) in_le16(addr); | ||
215 | break; | ||
216 | default: | ||
217 | out_le32(addr, val); | ||
218 | (void) in_le32(addr); | ||
219 | break; | ||
220 | } | ||
221 | return PCIBIOS_SUCCESSFUL; | ||
222 | } | ||
223 | |||
224 | static struct pci_ops macrisc_pci_ops = | ||
225 | { | ||
226 | macrisc_read_config, | ||
227 | macrisc_write_config | ||
228 | }; | ||
229 | |||
230 | /* | ||
231 | * Verifiy that a specific (bus, dev_fn) exists on chaos | ||
232 | */ | ||
233 | static int | ||
234 | chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | ||
235 | { | ||
236 | struct device_node *np; | ||
237 | u32 *vendor, *device; | ||
238 | |||
239 | np = pci_busdev_to_OF_node(bus, devfn); | ||
240 | if (np == NULL) | ||
241 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
242 | |||
243 | vendor = (u32 *)get_property(np, "vendor-id", NULL); | ||
244 | device = (u32 *)get_property(np, "device-id", NULL); | ||
245 | if (vendor == NULL || device == NULL) | ||
246 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
247 | |||
248 | if ((*vendor == 0x106b) && (*device == 3) && (offset >= 0x10) | ||
249 | && (offset != 0x14) && (offset != 0x18) && (offset <= 0x24)) | ||
250 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
251 | |||
252 | return PCIBIOS_SUCCESSFUL; | ||
253 | } | ||
254 | |||
255 | static int | ||
256 | chaos_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
257 | int len, u32 *val) | ||
258 | { | ||
259 | int result = chaos_validate_dev(bus, devfn, offset); | ||
260 | if (result == PCIBIOS_BAD_REGISTER_NUMBER) | ||
261 | *val = ~0U; | ||
262 | if (result != PCIBIOS_SUCCESSFUL) | ||
263 | return result; | ||
264 | return macrisc_read_config(bus, devfn, offset, len, val); | ||
265 | } | ||
266 | |||
267 | static int | ||
268 | chaos_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
269 | int len, u32 val) | ||
270 | { | ||
271 | int result = chaos_validate_dev(bus, devfn, offset); | ||
272 | if (result != PCIBIOS_SUCCESSFUL) | ||
273 | return result; | ||
274 | return macrisc_write_config(bus, devfn, offset, len, val); | ||
275 | } | ||
276 | |||
277 | static struct pci_ops chaos_pci_ops = | ||
278 | { | ||
279 | chaos_read_config, | ||
280 | chaos_write_config | ||
281 | }; | ||
282 | |||
283 | #ifdef CONFIG_POWER4 | ||
284 | |||
285 | /* | ||
286 | * These versions of U3 HyperTransport config space access ops do not | ||
287 | * implement self-view of the HT host yet | ||
288 | */ | ||
289 | |||
290 | #define U3_HT_CFA0(devfn, off) \ | ||
291 | ((((unsigned long)devfn) << 8) | offset) | ||
292 | #define U3_HT_CFA1(bus, devfn, off) \ | ||
293 | (U3_HT_CFA0(devfn, off) \ | ||
294 | + (((unsigned long)bus) << 16) \ | ||
295 | + 0x01000000UL) | ||
296 | |||
297 | static void volatile __iomem * | ||
298 | u3_ht_cfg_access(struct pci_controller* hose, u8 bus, u8 devfn, u8 offset) | ||
299 | { | ||
300 | if (bus == hose->first_busno) { | ||
301 | /* For now, we don't self probe U3 HT bridge */ | ||
302 | if (PCI_FUNC(devfn) != 0 || PCI_SLOT(devfn) > 7 || | ||
303 | PCI_SLOT(devfn) < 1) | ||
304 | return 0; | ||
305 | return hose->cfg_data + U3_HT_CFA0(devfn, offset); | ||
306 | } else | ||
307 | return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset); | ||
308 | } | ||
309 | |||
310 | static int | ||
311 | u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
312 | int len, u32 *val) | ||
313 | { | ||
314 | struct pci_controller *hose = bus->sysdata; | ||
315 | void volatile __iomem *addr; | ||
316 | int i; | ||
317 | |||
318 | struct device_node *np = pci_busdev_to_OF_node(bus, devfn); | ||
319 | if (np == NULL) | ||
320 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
321 | |||
322 | /* | ||
323 | * When a device in K2 is powered down, we die on config | ||
324 | * cycle accesses. Fix that here. | ||
325 | */ | ||
326 | for (i=0; i<2; i++) | ||
327 | if (k2_skiplist[i] == np) { | ||
328 | switch (len) { | ||
329 | case 1: | ||
330 | *val = 0xff; break; | ||
331 | case 2: | ||
332 | *val = 0xffff; break; | ||
333 | default: | ||
334 | *val = 0xfffffffful; break; | ||
335 | } | ||
336 | return PCIBIOS_SUCCESSFUL; | ||
337 | } | ||
338 | |||
339 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); | ||
340 | if (!addr) | ||
341 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
342 | /* | ||
343 | * Note: the caller has already checked that offset is | ||
344 | * suitably aligned and that len is 1, 2 or 4. | ||
345 | */ | ||
346 | switch (len) { | ||
347 | case 1: | ||
348 | *val = in_8(addr); | ||
349 | break; | ||
350 | case 2: | ||
351 | *val = in_le16(addr); | ||
352 | break; | ||
353 | default: | ||
354 | *val = in_le32(addr); | ||
355 | break; | ||
356 | } | ||
357 | return PCIBIOS_SUCCESSFUL; | ||
358 | } | ||
359 | |||
360 | static int | ||
361 | u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
362 | int len, u32 val) | ||
363 | { | ||
364 | struct pci_controller *hose = bus->sysdata; | ||
365 | void volatile __iomem *addr; | ||
366 | int i; | ||
367 | |||
368 | struct device_node *np = pci_busdev_to_OF_node(bus, devfn); | ||
369 | if (np == NULL) | ||
370 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
371 | /* | ||
372 | * When a device in K2 is powered down, we die on config | ||
373 | * cycle accesses. Fix that here. | ||
374 | */ | ||
375 | for (i=0; i<2; i++) | ||
376 | if (k2_skiplist[i] == np) | ||
377 | return PCIBIOS_SUCCESSFUL; | ||
378 | |||
379 | addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); | ||
380 | if (!addr) | ||
381 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
382 | /* | ||
383 | * Note: the caller has already checked that offset is | ||
384 | * suitably aligned and that len is 1, 2 or 4. | ||
385 | */ | ||
386 | switch (len) { | ||
387 | case 1: | ||
388 | out_8(addr, val); | ||
389 | (void) in_8(addr); | ||
390 | break; | ||
391 | case 2: | ||
392 | out_le16(addr, val); | ||
393 | (void) in_le16(addr); | ||
394 | break; | ||
395 | default: | ||
396 | out_le32(addr, val); | ||
397 | (void) in_le32(addr); | ||
398 | break; | ||
399 | } | ||
400 | return PCIBIOS_SUCCESSFUL; | ||
401 | } | ||
402 | |||
403 | static struct pci_ops u3_ht_pci_ops = | ||
404 | { | ||
405 | u3_ht_read_config, | ||
406 | u3_ht_write_config | ||
407 | }; | ||
408 | |||
409 | #endif /* CONFIG_POWER4 */ | ||
410 | |||
411 | /* | ||
412 | * For a bandit bridge, turn on cache coherency if necessary. | ||
413 | * N.B. we could clean this up using the hose ops directly. | ||
414 | */ | ||
415 | static void __init | ||
416 | init_bandit(struct pci_controller *bp) | ||
417 | { | ||
418 | unsigned int vendev, magic; | ||
419 | int rev; | ||
420 | |||
421 | /* read the word at offset 0 in config space for device 11 */ | ||
422 | out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + PCI_VENDOR_ID); | ||
423 | udelay(2); | ||
424 | vendev = in_le32(bp->cfg_data); | ||
425 | if (vendev == (PCI_DEVICE_ID_APPLE_BANDIT << 16) + | ||
426 | PCI_VENDOR_ID_APPLE) { | ||
427 | /* read the revision id */ | ||
428 | out_le32(bp->cfg_addr, | ||
429 | (1UL << BANDIT_DEVNUM) + PCI_REVISION_ID); | ||
430 | udelay(2); | ||
431 | rev = in_8(bp->cfg_data); | ||
432 | if (rev != BANDIT_REVID) | ||
433 | printk(KERN_WARNING | ||
434 | "Unknown revision %d for bandit\n", rev); | ||
435 | } else if (vendev != (BANDIT_DEVID_2 << 16) + PCI_VENDOR_ID_APPLE) { | ||
436 | printk(KERN_WARNING "bandit isn't? (%x)\n", vendev); | ||
437 | return; | ||
438 | } | ||
439 | |||
440 | /* read the word at offset 0x50 */ | ||
441 | out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + BANDIT_MAGIC); | ||
442 | udelay(2); | ||
443 | magic = in_le32(bp->cfg_data); | ||
444 | if ((magic & BANDIT_COHERENT) != 0) | ||
445 | return; | ||
446 | magic |= BANDIT_COHERENT; | ||
447 | udelay(2); | ||
448 | out_le32(bp->cfg_data, magic); | ||
449 | printk(KERN_INFO "Cache coherency enabled for bandit/PSX\n"); | ||
450 | } | ||
451 | |||
452 | |||
453 | /* | ||
454 | * Tweak the PCI-PCI bridge chip on the blue & white G3s. | ||
455 | */ | ||
456 | static void __init | ||
457 | init_p2pbridge(void) | ||
458 | { | ||
459 | struct device_node *p2pbridge; | ||
460 | struct pci_controller* hose; | ||
461 | u8 bus, devfn; | ||
462 | u16 val; | ||
463 | |||
464 | /* XXX it would be better here to identify the specific | ||
465 | PCI-PCI bridge chip we have. */ | ||
466 | if ((p2pbridge = find_devices("pci-bridge")) == 0 | ||
467 | || p2pbridge->parent == NULL | ||
468 | || strcmp(p2pbridge->parent->name, "pci") != 0) | ||
469 | return; | ||
470 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { | ||
471 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); | ||
472 | return; | ||
473 | } | ||
474 | /* Warning: At this point, we have not yet renumbered all busses. | ||
475 | * So we must use OF walking to find out hose | ||
476 | */ | ||
477 | hose = pci_find_hose_for_OF_device(p2pbridge); | ||
478 | if (!hose) { | ||
479 | DBG("Can't find hose for PCI<->PCI bridge\n"); | ||
480 | return; | ||
481 | } | ||
482 | if (early_read_config_word(hose, bus, devfn, | ||
483 | PCI_BRIDGE_CONTROL, &val) < 0) { | ||
484 | printk(KERN_ERR "init_p2pbridge: couldn't read bridge control\n"); | ||
485 | return; | ||
486 | } | ||
487 | val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; | ||
488 | early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * Some Apple desktop machines have a NEC PD720100A USB2 controller | ||
493 | * on the motherboard. Open Firmware, on these, will disable the | ||
494 | * EHCI part of it so it behaves like a pair of OHCI's. This fixup | ||
495 | * code re-enables it ;) | ||
496 | */ | ||
497 | static void __init | ||
498 | fixup_nec_usb2(void) | ||
499 | { | ||
500 | struct device_node *nec; | ||
501 | |||
502 | for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { | ||
503 | struct pci_controller *hose; | ||
504 | u32 data, *prop; | ||
505 | u8 bus, devfn; | ||
506 | |||
507 | prop = (u32 *)get_property(nec, "vendor-id", NULL); | ||
508 | if (prop == NULL) | ||
509 | continue; | ||
510 | if (0x1033 != *prop) | ||
511 | continue; | ||
512 | prop = (u32 *)get_property(nec, "device-id", NULL); | ||
513 | if (prop == NULL) | ||
514 | continue; | ||
515 | if (0x0035 != *prop) | ||
516 | continue; | ||
517 | prop = (u32 *)get_property(nec, "reg", NULL); | ||
518 | if (prop == NULL) | ||
519 | continue; | ||
520 | devfn = (prop[0] >> 8) & 0xff; | ||
521 | bus = (prop[0] >> 16) & 0xff; | ||
522 | if (PCI_FUNC(devfn) != 0) | ||
523 | continue; | ||
524 | hose = pci_find_hose_for_OF_device(nec); | ||
525 | if (!hose) | ||
526 | continue; | ||
527 | early_read_config_dword(hose, bus, devfn, 0xe4, &data); | ||
528 | if (data & 1UL) { | ||
529 | printk("Found NEC PD720100A USB2 chip with disabled EHCI, fixing up...\n"); | ||
530 | data &= ~1UL; | ||
531 | early_write_config_dword(hose, bus, devfn, 0xe4, data); | ||
532 | early_write_config_byte(hose, bus, devfn | 2, PCI_INTERRUPT_LINE, | ||
533 | nec->intrs[0].line); | ||
534 | } | ||
535 | } | ||
536 | } | ||
537 | |||
538 | void __init | ||
539 | pmac_find_bridges(void) | ||
540 | { | ||
541 | struct device_node *np, *root; | ||
542 | struct device_node *ht = NULL; | ||
543 | |||
544 | root = of_find_node_by_path("/"); | ||
545 | if (root == NULL) { | ||
546 | printk(KERN_CRIT "pmac_find_bridges: can't find root of device tree\n"); | ||
547 | return; | ||
548 | } | ||
549 | for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) { | ||
550 | if (np->name == NULL) | ||
551 | continue; | ||
552 | if (strcmp(np->name, "bandit") == 0 | ||
553 | || strcmp(np->name, "chaos") == 0 | ||
554 | || strcmp(np->name, "pci") == 0) { | ||
555 | if (add_bridge(np) == 0) | ||
556 | of_node_get(np); | ||
557 | } | ||
558 | if (strcmp(np->name, "ht") == 0) { | ||
559 | of_node_get(np); | ||
560 | ht = np; | ||
561 | } | ||
562 | } | ||
563 | of_node_put(root); | ||
564 | |||
565 | /* Probe HT last as it relies on the agp resources to be already | ||
566 | * setup | ||
567 | */ | ||
568 | if (ht && add_bridge(ht) != 0) | ||
569 | of_node_put(ht); | ||
570 | |||
571 | init_p2pbridge(); | ||
572 | fixup_nec_usb2(); | ||
573 | |||
574 | /* We are still having some issues with the Xserve G4, enabling | ||
575 | * some offset between bus number and domains for now when we | ||
576 | * assign all busses should help for now | ||
577 | */ | ||
578 | if (pci_assign_all_buses) | ||
579 | pcibios_assign_bus_offset = 0x10; | ||
580 | |||
581 | #ifdef CONFIG_POWER4 | ||
582 | /* There is something wrong with DMA on U3/HT. I haven't figured out | ||
583 | * the details yet, but if I set the cache line size to 128 bytes like | ||
584 | * it should, I'm getting memory corruption caused by devices like | ||
585 | * sungem (even without the MWI bit set, but maybe sungem doesn't | ||
586 | * care). Right now, it appears that setting up a 64 bytes line size | ||
587 | * works properly, 64 bytes beeing the max transfer size of HT, I | ||
588 | * suppose this is related the way HT/PCI are hooked together. I still | ||
589 | * need to dive into more specs though to be really sure of what's | ||
590 | * going on. --BenH. | ||
591 | * | ||
592 | * Ok, apparently, it's just that HT can't do more than 64 bytes | ||
593 | * transactions. MWI seem to be meaningless there as well, it may | ||
594 | * be worth nop'ing out pci_set_mwi too though I haven't done that | ||
595 | * yet. | ||
596 | * | ||
597 | * Note that it's a bit different for whatever is in the AGP slot. | ||
598 | * For now, I don't care, but this can become a real issue, we | ||
599 | * should probably hook pci_set_mwi anyway to make sure it sets | ||
600 | * the real cache line size in there. | ||
601 | */ | ||
602 | if (machine_is_compatible("MacRISC4")) | ||
603 | pci_cache_line_size = 16; /* 64 bytes */ | ||
604 | |||
605 | pmac_check_ht_link(); | ||
606 | #endif /* CONFIG_POWER4 */ | ||
607 | } | ||
608 | |||
609 | #define GRACKLE_CFA(b, d, o) (0x80 | ((b) << 8) | ((d) << 16) \ | ||
610 | | (((o) & ~3) << 24)) | ||
611 | |||
612 | #define GRACKLE_PICR1_STG 0x00000040 | ||
613 | #define GRACKLE_PICR1_LOOPSNOOP 0x00000010 | ||
614 | |||
615 | /* N.B. this is called before bridges is initialized, so we can't | ||
616 | use grackle_pcibios_{read,write}_config_dword. */ | ||
617 | static inline void grackle_set_stg(struct pci_controller* bp, int enable) | ||
618 | { | ||
619 | unsigned int val; | ||
620 | |||
621 | out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); | ||
622 | val = in_le32(bp->cfg_data); | ||
623 | val = enable? (val | GRACKLE_PICR1_STG) : | ||
624 | (val & ~GRACKLE_PICR1_STG); | ||
625 | out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); | ||
626 | out_le32(bp->cfg_data, val); | ||
627 | (void)in_le32(bp->cfg_data); | ||
628 | } | ||
629 | |||
630 | static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable) | ||
631 | { | ||
632 | unsigned int val; | ||
633 | |||
634 | out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); | ||
635 | val = in_le32(bp->cfg_data); | ||
636 | val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) : | ||
637 | (val & ~GRACKLE_PICR1_LOOPSNOOP); | ||
638 | out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8)); | ||
639 | out_le32(bp->cfg_data, val); | ||
640 | (void)in_le32(bp->cfg_data); | ||
641 | } | ||
642 | |||
643 | static int __init | ||
644 | setup_uninorth(struct pci_controller* hose, struct reg_property* addr) | ||
645 | { | ||
646 | pci_assign_all_buses = 1; | ||
647 | has_uninorth = 1; | ||
648 | hose->ops = ¯isc_pci_ops; | ||
649 | hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); | ||
650 | hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); | ||
651 | /* We "know" that the bridge at f2000000 has the PCI slots. */ | ||
652 | return addr->address == 0xf2000000; | ||
653 | } | ||
654 | |||
655 | static void __init | ||
656 | setup_bandit(struct pci_controller* hose, struct reg_property* addr) | ||
657 | { | ||
658 | hose->ops = ¯isc_pci_ops; | ||
659 | hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); | ||
660 | hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); | ||
661 | init_bandit(hose); | ||
662 | } | ||
663 | |||
664 | static void __init | ||
665 | setup_chaos(struct pci_controller* hose, struct reg_property* addr) | ||
666 | { | ||
667 | /* assume a `chaos' bridge */ | ||
668 | hose->ops = &chaos_pci_ops; | ||
669 | hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); | ||
670 | hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); | ||
671 | } | ||
672 | |||
673 | #ifdef CONFIG_POWER4 | ||
674 | |||
675 | static void __init | ||
676 | setup_u3_agp(struct pci_controller* hose, struct reg_property* addr) | ||
677 | { | ||
678 | /* On G5, we move AGP up to high bus number so we don't need | ||
679 | * to reassign bus numbers for HT. If we ever have P2P bridges | ||
680 | * on AGP, we'll have to move pci_assign_all_buses to the | ||
681 | * pci_controller structure so we enable it for AGP and not for | ||
682 | * HT childs. | ||
683 | * We hard code the address because of the different size of | ||
684 | * the reg address cell, we shall fix that by killing struct | ||
685 | * reg_property and using some accessor functions instead | ||
686 | */ | ||
687 | hose->first_busno = 0xf0; | ||
688 | hose->last_busno = 0xff; | ||
689 | has_uninorth = 1; | ||
690 | hose->ops = ¯isc_pci_ops; | ||
691 | hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); | ||
692 | hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000); | ||
693 | |||
694 | u3_agp = hose; | ||
695 | } | ||
696 | |||
697 | static void __init | ||
698 | setup_u3_ht(struct pci_controller* hose, struct reg_property *addr) | ||
699 | { | ||
700 | struct device_node *np = (struct device_node *)hose->arch_data; | ||
701 | int i, cur; | ||
702 | |||
703 | hose->ops = &u3_ht_pci_ops; | ||
704 | |||
705 | /* We hard code the address because of the different size of | ||
706 | * the reg address cell, we shall fix that by killing struct | ||
707 | * reg_property and using some accessor functions instead | ||
708 | */ | ||
709 | hose->cfg_data = ioremap(0xf2000000, 0x02000000); | ||
710 | |||
711 | /* | ||
712 | * /ht node doesn't expose a "ranges" property, so we "remove" regions that | ||
713 | * have been allocated to AGP. So far, this version of the code doesn't assign | ||
714 | * any of the 0xfxxxxxxx "fine" memory regions to /ht. | ||
715 | * We need to fix that sooner or later by either parsing all child "ranges" | ||
716 | * properties or figuring out the U3 address space decoding logic and | ||
717 | * then read its configuration register (if any). | ||
718 | */ | ||
719 | hose->io_base_phys = 0xf4000000; | ||
720 | hose->io_base_virt = ioremap(hose->io_base_phys, 0x00400000); | ||
721 | isa_io_base = (unsigned long) hose->io_base_virt; | ||
722 | hose->io_resource.name = np->full_name; | ||
723 | hose->io_resource.start = 0; | ||
724 | hose->io_resource.end = 0x003fffff; | ||
725 | hose->io_resource.flags = IORESOURCE_IO; | ||
726 | hose->pci_mem_offset = 0; | ||
727 | hose->first_busno = 0; | ||
728 | hose->last_busno = 0xef; | ||
729 | hose->mem_resources[0].name = np->full_name; | ||
730 | hose->mem_resources[0].start = 0x80000000; | ||
731 | hose->mem_resources[0].end = 0xefffffff; | ||
732 | hose->mem_resources[0].flags = IORESOURCE_MEM; | ||
733 | |||
734 | if (u3_agp == NULL) { | ||
735 | DBG("U3 has no AGP, using full resource range\n"); | ||
736 | return; | ||
737 | } | ||
738 | |||
739 | /* We "remove" the AGP resources from the resources allocated to HT, that | ||
740 | * is we create "holes". However, that code does assumptions that so far | ||
741 | * happen to be true (cross fingers...), typically that resources in the | ||
742 | * AGP node are properly ordered | ||
743 | */ | ||
744 | cur = 0; | ||
745 | for (i=0; i<3; i++) { | ||
746 | struct resource *res = &u3_agp->mem_resources[i]; | ||
747 | if (res->flags != IORESOURCE_MEM) | ||
748 | continue; | ||
749 | /* We don't care about "fine" resources */ | ||
750 | if (res->start >= 0xf0000000) | ||
751 | continue; | ||
752 | /* Check if it's just a matter of "shrinking" us in one direction */ | ||
753 | if (hose->mem_resources[cur].start == res->start) { | ||
754 | DBG("U3/HT: shrink start of %d, %08lx -> %08lx\n", | ||
755 | cur, hose->mem_resources[cur].start, res->end + 1); | ||
756 | hose->mem_resources[cur].start = res->end + 1; | ||
757 | continue; | ||
758 | } | ||
759 | if (hose->mem_resources[cur].end == res->end) { | ||
760 | DBG("U3/HT: shrink end of %d, %08lx -> %08lx\n", | ||
761 | cur, hose->mem_resources[cur].end, res->start - 1); | ||
762 | hose->mem_resources[cur].end = res->start - 1; | ||
763 | continue; | ||
764 | } | ||
765 | /* No, it's not the case, we need a hole */ | ||
766 | if (cur == 2) { | ||
767 | /* not enough resources to make a hole, we drop part of the range */ | ||
768 | printk(KERN_WARNING "Running out of resources for /ht host !\n"); | ||
769 | hose->mem_resources[cur].end = res->start - 1; | ||
770 | continue; | ||
771 | } | ||
772 | cur++; | ||
773 | DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", | ||
774 | cur-1, res->start - 1, cur, res->end + 1); | ||
775 | hose->mem_resources[cur].name = np->full_name; | ||
776 | hose->mem_resources[cur].flags = IORESOURCE_MEM; | ||
777 | hose->mem_resources[cur].start = res->end + 1; | ||
778 | hose->mem_resources[cur].end = hose->mem_resources[cur-1].end; | ||
779 | hose->mem_resources[cur-1].end = res->start - 1; | ||
780 | } | ||
781 | } | ||
782 | |||
783 | #endif /* CONFIG_POWER4 */ | ||
784 | |||
785 | void __init | ||
786 | setup_grackle(struct pci_controller *hose) | ||
787 | { | ||
788 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000); | ||
789 | if (machine_is_compatible("AAPL,PowerBook1998")) | ||
790 | grackle_set_loop_snoop(hose, 1); | ||
791 | #if 0 /* Disabled for now, HW problems ??? */ | ||
792 | grackle_set_stg(hose, 1); | ||
793 | #endif | ||
794 | } | ||
795 | |||
796 | /* | ||
797 | * We assume that if we have a G3 powermac, we have one bridge called | ||
798 | * "pci" (a MPC106) and no bandit or chaos bridges, and contrariwise, | ||
799 | * if we have one or more bandit or chaos bridges, we don't have a MPC106. | ||
800 | */ | ||
801 | static int __init | ||
802 | add_bridge(struct device_node *dev) | ||
803 | { | ||
804 | int len; | ||
805 | struct pci_controller *hose; | ||
806 | struct reg_property *addr; | ||
807 | char* disp_name; | ||
808 | int *bus_range; | ||
809 | int primary = 1; | ||
810 | |||
811 | DBG("Adding PCI host bridge %s\n", dev->full_name); | ||
812 | |||
813 | addr = (struct reg_property *) get_property(dev, "reg", &len); | ||
814 | if (addr == NULL || len < sizeof(*addr)) { | ||
815 | printk(KERN_WARNING "Can't use %s: no address\n", | ||
816 | dev->full_name); | ||
817 | return -ENODEV; | ||
818 | } | ||
819 | bus_range = (int *) get_property(dev, "bus-range", &len); | ||
820 | if (bus_range == NULL || len < 2 * sizeof(int)) { | ||
821 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", | ||
822 | dev->full_name); | ||
823 | } | ||
824 | |||
825 | hose = pcibios_alloc_controller(); | ||
826 | if (!hose) | ||
827 | return -ENOMEM; | ||
828 | hose->arch_data = dev; | ||
829 | hose->first_busno = bus_range ? bus_range[0] : 0; | ||
830 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | ||
831 | |||
832 | disp_name = NULL; | ||
833 | #ifdef CONFIG_POWER4 | ||
834 | if (device_is_compatible(dev, "u3-agp")) { | ||
835 | setup_u3_agp(hose, addr); | ||
836 | disp_name = "U3-AGP"; | ||
837 | primary = 0; | ||
838 | } else if (device_is_compatible(dev, "u3-ht")) { | ||
839 | setup_u3_ht(hose, addr); | ||
840 | disp_name = "U3-HT"; | ||
841 | primary = 1; | ||
842 | } else | ||
843 | #endif /* CONFIG_POWER4 */ | ||
844 | if (device_is_compatible(dev, "uni-north")) { | ||
845 | primary = setup_uninorth(hose, addr); | ||
846 | disp_name = "UniNorth"; | ||
847 | } else if (strcmp(dev->name, "pci") == 0) { | ||
848 | /* XXX assume this is a mpc106 (grackle) */ | ||
849 | setup_grackle(hose); | ||
850 | disp_name = "Grackle (MPC106)"; | ||
851 | } else if (strcmp(dev->name, "bandit") == 0) { | ||
852 | setup_bandit(hose, addr); | ||
853 | disp_name = "Bandit"; | ||
854 | } else if (strcmp(dev->name, "chaos") == 0) { | ||
855 | setup_chaos(hose, addr); | ||
856 | disp_name = "Chaos"; | ||
857 | primary = 0; | ||
858 | } | ||
859 | printk(KERN_INFO "Found %s PCI host bridge at 0x%08x. Firmware bus number: %d->%d\n", | ||
860 | disp_name, addr->address, hose->first_busno, hose->last_busno); | ||
861 | DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", | ||
862 | hose, hose->cfg_addr, hose->cfg_data); | ||
863 | |||
864 | /* Interpret the "ranges" property */ | ||
865 | /* This also maps the I/O region and sets isa_io/mem_base */ | ||
866 | pci_process_bridge_OF_ranges(hose, dev, primary); | ||
867 | |||
868 | /* Fixup "bus-range" OF property */ | ||
869 | fixup_bus_range(dev); | ||
870 | |||
871 | return 0; | ||
872 | } | ||
873 | |||
874 | static void __init | ||
875 | pcibios_fixup_OF_interrupts(void) | ||
876 | { | ||
877 | struct pci_dev* dev = NULL; | ||
878 | |||
879 | /* | ||
880 | * Open Firmware often doesn't initialize the | ||
881 | * PCI_INTERRUPT_LINE config register properly, so we | ||
882 | * should find the device node and apply the interrupt | ||
883 | * obtained from the OF device-tree | ||
884 | */ | ||
885 | for_each_pci_dev(dev) { | ||
886 | struct device_node *node; | ||
887 | node = pci_device_to_OF_node(dev); | ||
888 | /* this is the node, see if it has interrupts */ | ||
889 | if (node && node->n_intrs > 0) | ||
890 | dev->irq = node->intrs[0].line; | ||
891 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | ||
892 | } | ||
893 | } | ||
894 | |||
895 | void __init | ||
896 | pmac_pcibios_fixup(void) | ||
897 | { | ||
898 | /* Fixup interrupts according to OF tree */ | ||
899 | pcibios_fixup_OF_interrupts(); | ||
900 | } | ||
901 | |||
902 | int | ||
903 | pmac_pci_enable_device_hook(struct pci_dev *dev, int initial) | ||
904 | { | ||
905 | struct device_node* node; | ||
906 | int updatecfg = 0; | ||
907 | int uninorth_child; | ||
908 | |||
909 | node = pci_device_to_OF_node(dev); | ||
910 | |||
911 | /* We don't want to enable USB controllers absent from the OF tree | ||
912 | * (iBook second controller) | ||
913 | */ | ||
914 | if (dev->vendor == PCI_VENDOR_ID_APPLE | ||
915 | && (dev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10)) | ||
916 | && !node) { | ||
917 | printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n", | ||
918 | pci_name(dev)); | ||
919 | return -EINVAL; | ||
920 | } | ||
921 | |||
922 | if (!node) | ||
923 | return 0; | ||
924 | |||
925 | uninorth_child = node->parent && | ||
926 | device_is_compatible(node->parent, "uni-north"); | ||
927 | |||
928 | /* Firewire & GMAC were disabled after PCI probe, the driver is | ||
929 | * claiming them, we must re-enable them now. | ||
930 | */ | ||
931 | if (uninorth_child && !strcmp(node->name, "firewire") && | ||
932 | (device_is_compatible(node, "pci106b,18") || | ||
933 | device_is_compatible(node, "pci106b,30") || | ||
934 | device_is_compatible(node, "pci11c1,5811"))) { | ||
935 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, node, 0, 1); | ||
936 | pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1); | ||
937 | updatecfg = 1; | ||
938 | } | ||
939 | if (uninorth_child && !strcmp(node->name, "ethernet") && | ||
940 | device_is_compatible(node, "gmac")) { | ||
941 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1); | ||
942 | updatecfg = 1; | ||
943 | } | ||
944 | |||
945 | if (updatecfg) { | ||
946 | u16 cmd; | ||
947 | |||
948 | /* | ||
949 | * Make sure PCI is correctly configured | ||
950 | * | ||
951 | * We use old pci_bios versions of the function since, by | ||
952 | * default, gmac is not powered up, and so will be absent | ||
953 | * from the kernel initial PCI lookup. | ||
954 | * | ||
955 | * Should be replaced by 2.4 new PCI mechanisms and really | ||
956 | * register the device. | ||
957 | */ | ||
958 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
959 | cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; | ||
960 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
961 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 16); | ||
962 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_cache_line_size); | ||
963 | } | ||
964 | |||
965 | return 0; | ||
966 | } | ||
967 | |||
968 | /* We power down some devices after they have been probed. They'll | ||
969 | * be powered back on later on | ||
970 | */ | ||
971 | void __init | ||
972 | pmac_pcibios_after_init(void) | ||
973 | { | ||
974 | struct device_node* nd; | ||
975 | |||
976 | #ifdef CONFIG_BLK_DEV_IDE | ||
977 | struct pci_dev *dev = NULL; | ||
978 | |||
979 | /* OF fails to initialize IDE controllers on macs | ||
980 | * (and maybe other machines) | ||
981 | * | ||
982 | * Ideally, this should be moved to the IDE layer, but we need | ||
983 | * to check specifically with Andre Hedrick how to do it cleanly | ||
984 | * since the common IDE code seem to care about the fact that the | ||
985 | * BIOS may have disabled a controller. | ||
986 | * | ||
987 | * -- BenH | ||
988 | */ | ||
989 | for_each_pci_dev(dev) { | ||
990 | if ((dev->class >> 16) == PCI_BASE_CLASS_STORAGE) | ||
991 | pci_enable_device(dev); | ||
992 | } | ||
993 | #endif /* CONFIG_BLK_DEV_IDE */ | ||
994 | |||
995 | nd = find_devices("firewire"); | ||
996 | while (nd) { | ||
997 | if (nd->parent && (device_is_compatible(nd, "pci106b,18") || | ||
998 | device_is_compatible(nd, "pci106b,30") || | ||
999 | device_is_compatible(nd, "pci11c1,5811")) | ||
1000 | && device_is_compatible(nd->parent, "uni-north")) { | ||
1001 | pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); | ||
1002 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); | ||
1003 | } | ||
1004 | nd = nd->next; | ||
1005 | } | ||
1006 | nd = find_devices("ethernet"); | ||
1007 | while (nd) { | ||
1008 | if (nd->parent && device_is_compatible(nd, "gmac") | ||
1009 | && device_is_compatible(nd->parent, "uni-north")) | ||
1010 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); | ||
1011 | nd = nd->next; | ||
1012 | } | ||
1013 | } | ||
1014 | |||
1015 | void pmac_pci_fixup_cardbus(struct pci_dev* dev) | ||
1016 | { | ||
1017 | if (_machine != _MACH_Pmac) | ||
1018 | return; | ||
1019 | /* | ||
1020 | * Fix the interrupt routing on the various cardbus bridges | ||
1021 | * used on powerbooks | ||
1022 | */ | ||
1023 | if (dev->vendor != PCI_VENDOR_ID_TI) | ||
1024 | return; | ||
1025 | if (dev->device == PCI_DEVICE_ID_TI_1130 || | ||
1026 | dev->device == PCI_DEVICE_ID_TI_1131) { | ||
1027 | u8 val; | ||
1028 | /* Enable PCI interrupt */ | ||
1029 | if (pci_read_config_byte(dev, 0x91, &val) == 0) | ||
1030 | pci_write_config_byte(dev, 0x91, val | 0x30); | ||
1031 | /* Disable ISA interrupt mode */ | ||
1032 | if (pci_read_config_byte(dev, 0x92, &val) == 0) | ||
1033 | pci_write_config_byte(dev, 0x92, val & ~0x06); | ||
1034 | } | ||
1035 | if (dev->device == PCI_DEVICE_ID_TI_1210 || | ||
1036 | dev->device == PCI_DEVICE_ID_TI_1211 || | ||
1037 | dev->device == PCI_DEVICE_ID_TI_1410 || | ||
1038 | dev->device == PCI_DEVICE_ID_TI_1510) { | ||
1039 | u8 val; | ||
1040 | /* 0x8c == TI122X_IRQMUX, 2 says to route the INTA | ||
1041 | signal out the MFUNC0 pin */ | ||
1042 | if (pci_read_config_byte(dev, 0x8c, &val) == 0) | ||
1043 | pci_write_config_byte(dev, 0x8c, (val & ~0x0f) | 2); | ||
1044 | /* Disable ISA interrupt mode */ | ||
1045 | if (pci_read_config_byte(dev, 0x92, &val) == 0) | ||
1046 | pci_write_config_byte(dev, 0x92, val & ~0x06); | ||
1047 | } | ||
1048 | } | ||
1049 | |||
1050 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus); | ||
1051 | |||
1052 | void pmac_pci_fixup_pciata(struct pci_dev* dev) | ||
1053 | { | ||
1054 | u8 progif = 0; | ||
1055 | |||
1056 | /* | ||
1057 | * On PowerMacs, we try to switch any PCI ATA controller to | ||
1058 | * fully native mode | ||
1059 | */ | ||
1060 | if (_machine != _MACH_Pmac) | ||
1061 | return; | ||
1062 | /* Some controllers don't have the class IDE */ | ||
1063 | if (dev->vendor == PCI_VENDOR_ID_PROMISE) | ||
1064 | switch(dev->device) { | ||
1065 | case PCI_DEVICE_ID_PROMISE_20246: | ||
1066 | case PCI_DEVICE_ID_PROMISE_20262: | ||
1067 | case PCI_DEVICE_ID_PROMISE_20263: | ||
1068 | case PCI_DEVICE_ID_PROMISE_20265: | ||
1069 | case PCI_DEVICE_ID_PROMISE_20267: | ||
1070 | case PCI_DEVICE_ID_PROMISE_20268: | ||
1071 | case PCI_DEVICE_ID_PROMISE_20269: | ||
1072 | case PCI_DEVICE_ID_PROMISE_20270: | ||
1073 | case PCI_DEVICE_ID_PROMISE_20271: | ||
1074 | case PCI_DEVICE_ID_PROMISE_20275: | ||
1075 | case PCI_DEVICE_ID_PROMISE_20276: | ||
1076 | case PCI_DEVICE_ID_PROMISE_20277: | ||
1077 | goto good; | ||
1078 | } | ||
1079 | /* Others, check PCI class */ | ||
1080 | if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) | ||
1081 | return; | ||
1082 | good: | ||
1083 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); | ||
1084 | if ((progif & 5) != 5) { | ||
1085 | printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", pci_name(dev)); | ||
1086 | (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); | ||
1087 | if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || | ||
1088 | (progif & 5) != 5) | ||
1089 | printk(KERN_ERR "Rewrite of PROGIF failed !\n"); | ||
1090 | } | ||
1091 | } | ||
1092 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata); | ||
1093 | |||
1094 | |||
1095 | /* | ||
1096 | * Disable second function on K2-SATA, it's broken | ||
1097 | * and disable IO BARs on first one | ||
1098 | */ | ||
1099 | void pmac_pci_fixup_k2_sata(struct pci_dev* dev) | ||
1100 | { | ||
1101 | int i; | ||
1102 | u16 cmd; | ||
1103 | |||
1104 | if (PCI_FUNC(dev->devfn) > 0) { | ||
1105 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
1106 | cmd &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY); | ||
1107 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
1108 | for (i = 0; i < 6; i++) { | ||
1109 | dev->resource[i].start = dev->resource[i].end = 0; | ||
1110 | dev->resource[i].flags = 0; | ||
1111 | pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0); | ||
1112 | } | ||
1113 | } else { | ||
1114 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
1115 | cmd &= ~PCI_COMMAND_IO; | ||
1116 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
1117 | for (i = 0; i < 5; i++) { | ||
1118 | dev->resource[i].start = dev->resource[i].end = 0; | ||
1119 | dev->resource[i].flags = 0; | ||
1120 | pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0); | ||
1121 | } | ||
1122 | } | ||
1123 | } | ||
1124 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, pmac_pci_fixup_k2_sata); | ||
diff --git a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c deleted file mode 100644 index 4742bf609357..000000000000 --- a/arch/ppc/platforms/pmac_pic.c +++ /dev/null | |||
@@ -1,693 +0,0 @@ | |||
1 | /* | ||
2 | * Support for the interrupt controllers found on Power Macintosh, | ||
3 | * currently Apple's "Grand Central" interrupt controller in all | ||
4 | * it's incarnations. OpenPIC support used on newer machines is | ||
5 | * in a separate file | ||
6 | * | ||
7 | * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au) | ||
8 | * | ||
9 | * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org) | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/stddef.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/signal.h> | ||
23 | #include <linux/pci.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/sysdev.h> | ||
26 | #include <linux/adb.h> | ||
27 | #include <linux/pmu.h> | ||
28 | |||
29 | #include <asm/sections.h> | ||
30 | #include <asm/io.h> | ||
31 | #include <asm/smp.h> | ||
32 | #include <asm/prom.h> | ||
33 | #include <asm/pci-bridge.h> | ||
34 | #include <asm/time.h> | ||
35 | #include <asm/open_pic.h> | ||
36 | #include <asm/xmon.h> | ||
37 | #include <asm/pmac_feature.h> | ||
38 | #include <asm/machdep.h> | ||
39 | |||
40 | #include "pmac_pic.h" | ||
41 | |||
42 | /* | ||
43 | * XXX this should be in xmon.h, but putting it there means xmon.h | ||
44 | * has to include <linux/interrupt.h> (to get irqreturn_t), which | ||
45 | * causes all sorts of problems. -- paulus | ||
46 | */ | ||
47 | extern irqreturn_t xmon_irq(int, void *, struct pt_regs *); | ||
48 | |||
49 | struct pmac_irq_hw { | ||
50 | unsigned int event; | ||
51 | unsigned int enable; | ||
52 | unsigned int ack; | ||
53 | unsigned int level; | ||
54 | }; | ||
55 | |||
56 | /* Default addresses */ | ||
57 | static volatile struct pmac_irq_hw *pmac_irq_hw[4] = { | ||
58 | (struct pmac_irq_hw *) 0xf3000020, | ||
59 | (struct pmac_irq_hw *) 0xf3000010, | ||
60 | (struct pmac_irq_hw *) 0xf4000020, | ||
61 | (struct pmac_irq_hw *) 0xf4000010, | ||
62 | }; | ||
63 | |||
64 | #define GC_LEVEL_MASK 0x3ff00000 | ||
65 | #define OHARE_LEVEL_MASK 0x1ff00000 | ||
66 | #define HEATHROW_LEVEL_MASK 0x1ff00000 | ||
67 | |||
68 | static int max_irqs; | ||
69 | static int max_real_irqs; | ||
70 | static u32 level_mask[4]; | ||
71 | |||
72 | static DEFINE_SPINLOCK(pmac_pic_lock); | ||
73 | |||
74 | |||
75 | #define GATWICK_IRQ_POOL_SIZE 10 | ||
76 | static struct interrupt_info gatwick_int_pool[GATWICK_IRQ_POOL_SIZE]; | ||
77 | |||
78 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | ||
79 | static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | ||
80 | |||
81 | /* | ||
82 | * Mark an irq as "lost". This is only used on the pmac | ||
83 | * since it can lose interrupts (see pmac_set_irq_mask). | ||
84 | * -- Cort | ||
85 | */ | ||
86 | void | ||
87 | __set_lost(unsigned long irq_nr, int nokick) | ||
88 | { | ||
89 | if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) { | ||
90 | atomic_inc(&ppc_n_lost_interrupts); | ||
91 | if (!nokick) | ||
92 | set_dec(1); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | static void | ||
97 | pmac_mask_and_ack_irq(unsigned int irq_nr) | ||
98 | { | ||
99 | unsigned long bit = 1UL << (irq_nr & 0x1f); | ||
100 | int i = irq_nr >> 5; | ||
101 | unsigned long flags; | ||
102 | |||
103 | if ((unsigned)irq_nr >= max_irqs) | ||
104 | return; | ||
105 | |||
106 | clear_bit(irq_nr, ppc_cached_irq_mask); | ||
107 | if (test_and_clear_bit(irq_nr, ppc_lost_interrupts)) | ||
108 | atomic_dec(&ppc_n_lost_interrupts); | ||
109 | spin_lock_irqsave(&pmac_pic_lock, flags); | ||
110 | out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); | ||
111 | out_le32(&pmac_irq_hw[i]->ack, bit); | ||
112 | do { | ||
113 | /* make sure ack gets to controller before we enable | ||
114 | interrupts */ | ||
115 | mb(); | ||
116 | } while((in_le32(&pmac_irq_hw[i]->enable) & bit) | ||
117 | != (ppc_cached_irq_mask[i] & bit)); | ||
118 | spin_unlock_irqrestore(&pmac_pic_lock, flags); | ||
119 | } | ||
120 | |||
121 | static void pmac_set_irq_mask(unsigned int irq_nr, int nokicklost) | ||
122 | { | ||
123 | unsigned long bit = 1UL << (irq_nr & 0x1f); | ||
124 | int i = irq_nr >> 5; | ||
125 | unsigned long flags; | ||
126 | |||
127 | if ((unsigned)irq_nr >= max_irqs) | ||
128 | return; | ||
129 | |||
130 | spin_lock_irqsave(&pmac_pic_lock, flags); | ||
131 | /* enable unmasked interrupts */ | ||
132 | out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); | ||
133 | |||
134 | do { | ||
135 | /* make sure mask gets to controller before we | ||
136 | return to user */ | ||
137 | mb(); | ||
138 | } while((in_le32(&pmac_irq_hw[i]->enable) & bit) | ||
139 | != (ppc_cached_irq_mask[i] & bit)); | ||
140 | |||
141 | /* | ||
142 | * Unfortunately, setting the bit in the enable register | ||
143 | * when the device interrupt is already on *doesn't* set | ||
144 | * the bit in the flag register or request another interrupt. | ||
145 | */ | ||
146 | if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level)) | ||
147 | __set_lost((ulong)irq_nr, nokicklost); | ||
148 | spin_unlock_irqrestore(&pmac_pic_lock, flags); | ||
149 | } | ||
150 | |||
151 | /* When an irq gets requested for the first client, if it's an | ||
152 | * edge interrupt, we clear any previous one on the controller | ||
153 | */ | ||
154 | static unsigned int pmac_startup_irq(unsigned int irq_nr) | ||
155 | { | ||
156 | unsigned long bit = 1UL << (irq_nr & 0x1f); | ||
157 | int i = irq_nr >> 5; | ||
158 | |||
159 | if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0) | ||
160 | out_le32(&pmac_irq_hw[i]->ack, bit); | ||
161 | set_bit(irq_nr, ppc_cached_irq_mask); | ||
162 | pmac_set_irq_mask(irq_nr, 0); | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static void pmac_mask_irq(unsigned int irq_nr) | ||
168 | { | ||
169 | clear_bit(irq_nr, ppc_cached_irq_mask); | ||
170 | pmac_set_irq_mask(irq_nr, 0); | ||
171 | mb(); | ||
172 | } | ||
173 | |||
174 | static void pmac_unmask_irq(unsigned int irq_nr) | ||
175 | { | ||
176 | set_bit(irq_nr, ppc_cached_irq_mask); | ||
177 | pmac_set_irq_mask(irq_nr, 0); | ||
178 | } | ||
179 | |||
180 | static void pmac_end_irq(unsigned int irq_nr) | ||
181 | { | ||
182 | if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) | ||
183 | && irq_desc[irq_nr].action) { | ||
184 | set_bit(irq_nr, ppc_cached_irq_mask); | ||
185 | pmac_set_irq_mask(irq_nr, 1); | ||
186 | } | ||
187 | } | ||
188 | |||
189 | |||
190 | struct hw_interrupt_type pmac_pic = { | ||
191 | .typename = " PMAC-PIC ", | ||
192 | .startup = pmac_startup_irq, | ||
193 | .enable = pmac_unmask_irq, | ||
194 | .disable = pmac_mask_irq, | ||
195 | .ack = pmac_mask_and_ack_irq, | ||
196 | .end = pmac_end_irq, | ||
197 | }; | ||
198 | |||
199 | struct hw_interrupt_type gatwick_pic = { | ||
200 | .typename = " GATWICK ", | ||
201 | .startup = pmac_startup_irq, | ||
202 | .enable = pmac_unmask_irq, | ||
203 | .disable = pmac_mask_irq, | ||
204 | .ack = pmac_mask_and_ack_irq, | ||
205 | .end = pmac_end_irq, | ||
206 | }; | ||
207 | |||
208 | static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs) | ||
209 | { | ||
210 | int irq, bits; | ||
211 | |||
212 | for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) { | ||
213 | int i = irq >> 5; | ||
214 | bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; | ||
215 | /* We must read level interrupts from the level register */ | ||
216 | bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]); | ||
217 | bits &= ppc_cached_irq_mask[i]; | ||
218 | if (bits == 0) | ||
219 | continue; | ||
220 | irq += __ilog2(bits); | ||
221 | __do_IRQ(irq, regs); | ||
222 | return IRQ_HANDLED; | ||
223 | } | ||
224 | printk("gatwick irq not from gatwick pic\n"); | ||
225 | return IRQ_NONE; | ||
226 | } | ||
227 | |||
228 | int | ||
229 | pmac_get_irq(struct pt_regs *regs) | ||
230 | { | ||
231 | int irq; | ||
232 | unsigned long bits = 0; | ||
233 | |||
234 | #ifdef CONFIG_SMP | ||
235 | void psurge_smp_message_recv(struct pt_regs *); | ||
236 | |||
237 | /* IPI's are a hack on the powersurge -- Cort */ | ||
238 | if ( smp_processor_id() != 0 ) { | ||
239 | psurge_smp_message_recv(regs); | ||
240 | return -2; /* ignore, already handled */ | ||
241 | } | ||
242 | #endif /* CONFIG_SMP */ | ||
243 | for (irq = max_real_irqs; (irq -= 32) >= 0; ) { | ||
244 | int i = irq >> 5; | ||
245 | bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; | ||
246 | /* We must read level interrupts from the level register */ | ||
247 | bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]); | ||
248 | bits &= ppc_cached_irq_mask[i]; | ||
249 | if (bits == 0) | ||
250 | continue; | ||
251 | irq += __ilog2(bits); | ||
252 | break; | ||
253 | } | ||
254 | |||
255 | return irq; | ||
256 | } | ||
257 | |||
258 | /* This routine will fix some missing interrupt values in the device tree | ||
259 | * on the gatwick mac-io controller used by some PowerBooks | ||
260 | */ | ||
261 | static void __init | ||
262 | pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base) | ||
263 | { | ||
264 | struct device_node *node; | ||
265 | int count; | ||
266 | |||
267 | memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool)); | ||
268 | node = gw->child; | ||
269 | count = 0; | ||
270 | while(node) | ||
271 | { | ||
272 | /* Fix SCC */ | ||
273 | if (strcasecmp(node->name, "escc") == 0) | ||
274 | if (node->child) { | ||
275 | if (node->child->n_intrs < 3) { | ||
276 | node->child->intrs = &gatwick_int_pool[count]; | ||
277 | count += 3; | ||
278 | } | ||
279 | node->child->n_intrs = 3; | ||
280 | node->child->intrs[0].line = 15+irq_base; | ||
281 | node->child->intrs[1].line = 4+irq_base; | ||
282 | node->child->intrs[2].line = 5+irq_base; | ||
283 | printk(KERN_INFO "irq: fixed SCC on second controller (%d,%d,%d)\n", | ||
284 | node->child->intrs[0].line, | ||
285 | node->child->intrs[1].line, | ||
286 | node->child->intrs[2].line); | ||
287 | } | ||
288 | /* Fix media-bay & left SWIM */ | ||
289 | if (strcasecmp(node->name, "media-bay") == 0) { | ||
290 | struct device_node* ya_node; | ||
291 | |||
292 | if (node->n_intrs == 0) | ||
293 | node->intrs = &gatwick_int_pool[count++]; | ||
294 | node->n_intrs = 1; | ||
295 | node->intrs[0].line = 29+irq_base; | ||
296 | printk(KERN_INFO "irq: fixed media-bay on second controller (%d)\n", | ||
297 | node->intrs[0].line); | ||
298 | |||
299 | ya_node = node->child; | ||
300 | while(ya_node) | ||
301 | { | ||
302 | if (strcasecmp(ya_node->name, "floppy") == 0) { | ||
303 | if (ya_node->n_intrs < 2) { | ||
304 | ya_node->intrs = &gatwick_int_pool[count]; | ||
305 | count += 2; | ||
306 | } | ||
307 | ya_node->n_intrs = 2; | ||
308 | ya_node->intrs[0].line = 19+irq_base; | ||
309 | ya_node->intrs[1].line = 1+irq_base; | ||
310 | printk(KERN_INFO "irq: fixed floppy on second controller (%d,%d)\n", | ||
311 | ya_node->intrs[0].line, ya_node->intrs[1].line); | ||
312 | } | ||
313 | if (strcasecmp(ya_node->name, "ata4") == 0) { | ||
314 | if (ya_node->n_intrs < 2) { | ||
315 | ya_node->intrs = &gatwick_int_pool[count]; | ||
316 | count += 2; | ||
317 | } | ||
318 | ya_node->n_intrs = 2; | ||
319 | ya_node->intrs[0].line = 14+irq_base; | ||
320 | ya_node->intrs[1].line = 3+irq_base; | ||
321 | printk(KERN_INFO "irq: fixed ide on second controller (%d,%d)\n", | ||
322 | ya_node->intrs[0].line, ya_node->intrs[1].line); | ||
323 | } | ||
324 | ya_node = ya_node->sibling; | ||
325 | } | ||
326 | } | ||
327 | node = node->sibling; | ||
328 | } | ||
329 | if (count > 10) { | ||
330 | printk("WARNING !! Gatwick interrupt pool overflow\n"); | ||
331 | printk(" GATWICK_IRQ_POOL_SIZE = %d\n", GATWICK_IRQ_POOL_SIZE); | ||
332 | printk(" requested = %d\n", count); | ||
333 | } | ||
334 | } | ||
335 | |||
336 | /* | ||
337 | * The PowerBook 3400/2400/3500 can have a combo ethernet/modem | ||
338 | * card which includes an ohare chip that acts as a second interrupt | ||
339 | * controller. If we find this second ohare, set it up and fix the | ||
340 | * interrupt value in the device tree for the ethernet chip. | ||
341 | */ | ||
342 | static int __init enable_second_ohare(void) | ||
343 | { | ||
344 | unsigned char bus, devfn; | ||
345 | unsigned short cmd; | ||
346 | unsigned long addr; | ||
347 | struct device_node *irqctrler = find_devices("pci106b,7"); | ||
348 | struct device_node *ether; | ||
349 | |||
350 | if (irqctrler == NULL || irqctrler->n_addrs <= 0) | ||
351 | return -1; | ||
352 | addr = (unsigned long) ioremap(irqctrler->addrs[0].address, 0x40); | ||
353 | pmac_irq_hw[1] = (volatile struct pmac_irq_hw *)(addr + 0x20); | ||
354 | max_irqs = 64; | ||
355 | if (pci_device_from_OF_node(irqctrler, &bus, &devfn) == 0) { | ||
356 | struct pci_controller* hose = pci_find_hose_for_OF_device(irqctrler); | ||
357 | if (!hose) | ||
358 | printk(KERN_ERR "Can't find PCI hose for OHare2 !\n"); | ||
359 | else { | ||
360 | early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd); | ||
361 | cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; | ||
362 | cmd &= ~PCI_COMMAND_IO; | ||
363 | early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | /* Fix interrupt for the modem/ethernet combo controller. The number | ||
368 | in the device tree (27) is bogus (correct for the ethernet-only | ||
369 | board but not the combo ethernet/modem board). | ||
370 | The real interrupt is 28 on the second controller -> 28+32 = 60. | ||
371 | */ | ||
372 | ether = find_devices("pci1011,14"); | ||
373 | if (ether && ether->n_intrs > 0) { | ||
374 | ether->intrs[0].line = 60; | ||
375 | printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n", | ||
376 | ether->intrs[0].line); | ||
377 | } | ||
378 | |||
379 | /* Return the interrupt number of the cascade */ | ||
380 | return irqctrler->intrs[0].line; | ||
381 | } | ||
382 | |||
383 | #ifdef CONFIG_POWER4 | ||
384 | static irqreturn_t k2u3_action(int cpl, void *dev_id, struct pt_regs *regs) | ||
385 | { | ||
386 | int irq; | ||
387 | |||
388 | irq = openpic2_get_irq(regs); | ||
389 | if (irq != -1) | ||
390 | __do_IRQ(irq, regs); | ||
391 | return IRQ_HANDLED; | ||
392 | } | ||
393 | |||
394 | static struct irqaction k2u3_cascade_action = { | ||
395 | .handler = k2u3_action, | ||
396 | .flags = 0, | ||
397 | .mask = CPU_MASK_NONE, | ||
398 | .name = "U3->K2 Cascade", | ||
399 | }; | ||
400 | #endif /* CONFIG_POWER4 */ | ||
401 | |||
402 | #ifdef CONFIG_XMON | ||
403 | static struct irqaction xmon_action = { | ||
404 | .handler = xmon_irq, | ||
405 | .flags = 0, | ||
406 | .mask = CPU_MASK_NONE, | ||
407 | .name = "NMI - XMON" | ||
408 | }; | ||
409 | #endif | ||
410 | |||
411 | static struct irqaction gatwick_cascade_action = { | ||
412 | .handler = gatwick_action, | ||
413 | .flags = SA_INTERRUPT, | ||
414 | .mask = CPU_MASK_NONE, | ||
415 | .name = "cascade", | ||
416 | }; | ||
417 | |||
418 | void __init pmac_pic_init(void) | ||
419 | { | ||
420 | int i; | ||
421 | struct device_node *irqctrler = NULL; | ||
422 | struct device_node *irqctrler2 = NULL; | ||
423 | struct device_node *np; | ||
424 | unsigned long addr; | ||
425 | int irq_cascade = -1; | ||
426 | |||
427 | /* We first try to detect Apple's new Core99 chipset, since mac-io | ||
428 | * is quite different on those machines and contains an IBM MPIC2. | ||
429 | */ | ||
430 | np = find_type_devices("open-pic"); | ||
431 | while(np) { | ||
432 | if (np->parent && !strcmp(np->parent->name, "u3")) | ||
433 | irqctrler2 = np; | ||
434 | else | ||
435 | irqctrler = np; | ||
436 | np = np->next; | ||
437 | } | ||
438 | if (irqctrler != NULL) | ||
439 | { | ||
440 | if (irqctrler->n_addrs > 0) | ||
441 | { | ||
442 | unsigned char senses[128]; | ||
443 | |||
444 | printk(KERN_INFO "PowerMac using OpenPIC irq controller at 0x%08x\n", | ||
445 | irqctrler->addrs[0].address); | ||
446 | |||
447 | prom_get_irq_senses(senses, 0, 128); | ||
448 | OpenPIC_InitSenses = senses; | ||
449 | OpenPIC_NumInitSenses = 128; | ||
450 | ppc_md.get_irq = openpic_get_irq; | ||
451 | pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler, 0, 0); | ||
452 | OpenPIC_Addr = ioremap(irqctrler->addrs[0].address, | ||
453 | irqctrler->addrs[0].size); | ||
454 | openpic_init(0); | ||
455 | |||
456 | #ifdef CONFIG_POWER4 | ||
457 | if (irqctrler2 != NULL && irqctrler2->n_intrs > 0 && | ||
458 | irqctrler2->n_addrs > 0) { | ||
459 | printk(KERN_INFO "Slave OpenPIC at 0x%08x hooked on IRQ %d\n", | ||
460 | irqctrler2->addrs[0].address, | ||
461 | irqctrler2->intrs[0].line); | ||
462 | pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler2, 0, 0); | ||
463 | OpenPIC2_Addr = ioremap(irqctrler2->addrs[0].address, | ||
464 | irqctrler2->addrs[0].size); | ||
465 | prom_get_irq_senses(senses, PMAC_OPENPIC2_OFFSET, | ||
466 | PMAC_OPENPIC2_OFFSET+128); | ||
467 | OpenPIC_InitSenses = senses; | ||
468 | OpenPIC_NumInitSenses = 128; | ||
469 | openpic2_init(PMAC_OPENPIC2_OFFSET); | ||
470 | |||
471 | if (setup_irq(irqctrler2->intrs[0].line, | ||
472 | &k2u3_cascade_action)) | ||
473 | printk("Unable to get OpenPIC IRQ for cascade\n"); | ||
474 | } | ||
475 | #endif /* CONFIG_POWER4 */ | ||
476 | |||
477 | #ifdef CONFIG_XMON | ||
478 | { | ||
479 | struct device_node* pswitch; | ||
480 | int nmi_irq; | ||
481 | |||
482 | pswitch = find_devices("programmer-switch"); | ||
483 | if (pswitch && pswitch->n_intrs) { | ||
484 | nmi_irq = pswitch->intrs[0].line; | ||
485 | openpic_init_nmi_irq(nmi_irq); | ||
486 | setup_irq(nmi_irq, &xmon_action); | ||
487 | } | ||
488 | } | ||
489 | #endif /* CONFIG_XMON */ | ||
490 | return; | ||
491 | } | ||
492 | irqctrler = NULL; | ||
493 | } | ||
494 | |||
495 | /* Get the level/edge settings, assume if it's not | ||
496 | * a Grand Central nor an OHare, then it's an Heathrow | ||
497 | * (or Paddington). | ||
498 | */ | ||
499 | if (find_devices("gc")) | ||
500 | level_mask[0] = GC_LEVEL_MASK; | ||
501 | else if (find_devices("ohare")) { | ||
502 | level_mask[0] = OHARE_LEVEL_MASK; | ||
503 | /* We might have a second cascaded ohare */ | ||
504 | level_mask[1] = OHARE_LEVEL_MASK; | ||
505 | } else { | ||
506 | level_mask[0] = HEATHROW_LEVEL_MASK; | ||
507 | level_mask[1] = 0; | ||
508 | /* We might have a second cascaded heathrow */ | ||
509 | level_mask[2] = HEATHROW_LEVEL_MASK; | ||
510 | level_mask[3] = 0; | ||
511 | } | ||
512 | |||
513 | /* | ||
514 | * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts, | ||
515 | * 1998 G3 Series PowerBooks have 128, | ||
516 | * other powermacs have 32. | ||
517 | * The combo ethernet/modem card for the Powerstar powerbooks | ||
518 | * (2400/3400/3500, ohare based) has a second ohare chip | ||
519 | * effectively making a total of 64. | ||
520 | */ | ||
521 | max_irqs = max_real_irqs = 32; | ||
522 | irqctrler = find_devices("mac-io"); | ||
523 | if (irqctrler) | ||
524 | { | ||
525 | max_real_irqs = 64; | ||
526 | if (irqctrler->next) | ||
527 | max_irqs = 128; | ||
528 | else | ||
529 | max_irqs = 64; | ||
530 | } | ||
531 | for ( i = 0; i < max_real_irqs ; i++ ) | ||
532 | irq_desc[i].handler = &pmac_pic; | ||
533 | |||
534 | /* get addresses of first controller */ | ||
535 | if (irqctrler) { | ||
536 | if (irqctrler->n_addrs > 0) { | ||
537 | addr = (unsigned long) | ||
538 | ioremap(irqctrler->addrs[0].address, 0x40); | ||
539 | for (i = 0; i < 2; ++i) | ||
540 | pmac_irq_hw[i] = (volatile struct pmac_irq_hw*) | ||
541 | (addr + (2 - i) * 0x10); | ||
542 | } | ||
543 | |||
544 | /* get addresses of second controller */ | ||
545 | irqctrler = irqctrler->next; | ||
546 | if (irqctrler && irqctrler->n_addrs > 0) { | ||
547 | addr = (unsigned long) | ||
548 | ioremap(irqctrler->addrs[0].address, 0x40); | ||
549 | for (i = 2; i < 4; ++i) | ||
550 | pmac_irq_hw[i] = (volatile struct pmac_irq_hw*) | ||
551 | (addr + (4 - i) * 0x10); | ||
552 | irq_cascade = irqctrler->intrs[0].line; | ||
553 | if (device_is_compatible(irqctrler, "gatwick")) | ||
554 | pmac_fix_gatwick_interrupts(irqctrler, max_real_irqs); | ||
555 | } | ||
556 | } else { | ||
557 | /* older powermacs have a GC (grand central) or ohare at | ||
558 | f3000000, with interrupt control registers at f3000020. */ | ||
559 | addr = (unsigned long) ioremap(0xf3000000, 0x40); | ||
560 | pmac_irq_hw[0] = (volatile struct pmac_irq_hw *) (addr + 0x20); | ||
561 | } | ||
562 | |||
563 | /* PowerBooks 3400 and 3500 can have a second controller in a second | ||
564 | ohare chip, on the combo ethernet/modem card */ | ||
565 | if (machine_is_compatible("AAPL,3400/2400") | ||
566 | || machine_is_compatible("AAPL,3500")) | ||
567 | irq_cascade = enable_second_ohare(); | ||
568 | |||
569 | /* disable all interrupts in all controllers */ | ||
570 | for (i = 0; i * 32 < max_irqs; ++i) | ||
571 | out_le32(&pmac_irq_hw[i]->enable, 0); | ||
572 | /* mark level interrupts */ | ||
573 | for (i = 0; i < max_irqs; i++) | ||
574 | if (level_mask[i >> 5] & (1UL << (i & 0x1f))) | ||
575 | irq_desc[i].status = IRQ_LEVEL; | ||
576 | |||
577 | /* get interrupt line of secondary interrupt controller */ | ||
578 | if (irq_cascade >= 0) { | ||
579 | printk(KERN_INFO "irq: secondary controller on irq %d\n", | ||
580 | (int)irq_cascade); | ||
581 | for ( i = max_real_irqs ; i < max_irqs ; i++ ) | ||
582 | irq_desc[i].handler = &gatwick_pic; | ||
583 | setup_irq(irq_cascade, &gatwick_cascade_action); | ||
584 | } | ||
585 | printk("System has %d possible interrupts\n", max_irqs); | ||
586 | if (max_irqs != max_real_irqs) | ||
587 | printk(KERN_DEBUG "%d interrupts on main controller\n", | ||
588 | max_real_irqs); | ||
589 | |||
590 | #ifdef CONFIG_XMON | ||
591 | setup_irq(20, &xmon_action); | ||
592 | #endif /* CONFIG_XMON */ | ||
593 | } | ||
594 | |||
595 | #ifdef CONFIG_PM | ||
596 | /* | ||
597 | * These procedures are used in implementing sleep on the powerbooks. | ||
598 | * sleep_save_intrs() saves the states of all interrupt enables | ||
599 | * and disables all interrupts except for the nominated one. | ||
600 | * sleep_restore_intrs() restores the states of all interrupt enables. | ||
601 | */ | ||
602 | unsigned long sleep_save_mask[2]; | ||
603 | |||
604 | /* This used to be passed by the PMU driver but that link got | ||
605 | * broken with the new driver model. We use this tweak for now... | ||
606 | */ | ||
607 | static int pmacpic_find_viaint(void) | ||
608 | { | ||
609 | int viaint = -1; | ||
610 | |||
611 | #ifdef CONFIG_ADB_PMU | ||
612 | struct device_node *np; | ||
613 | |||
614 | if (pmu_get_model() != PMU_OHARE_BASED) | ||
615 | goto not_found; | ||
616 | np = of_find_node_by_name(NULL, "via-pmu"); | ||
617 | if (np == NULL) | ||
618 | goto not_found; | ||
619 | viaint = np->intrs[0].line; | ||
620 | #endif /* CONFIG_ADB_PMU */ | ||
621 | |||
622 | not_found: | ||
623 | return viaint; | ||
624 | } | ||
625 | |||
626 | static int pmacpic_suspend(struct sys_device *sysdev, pm_message_t state) | ||
627 | { | ||
628 | int viaint = pmacpic_find_viaint(); | ||
629 | |||
630 | sleep_save_mask[0] = ppc_cached_irq_mask[0]; | ||
631 | sleep_save_mask[1] = ppc_cached_irq_mask[1]; | ||
632 | ppc_cached_irq_mask[0] = 0; | ||
633 | ppc_cached_irq_mask[1] = 0; | ||
634 | if (viaint > 0) | ||
635 | set_bit(viaint, ppc_cached_irq_mask); | ||
636 | out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]); | ||
637 | if (max_real_irqs > 32) | ||
638 | out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]); | ||
639 | (void)in_le32(&pmac_irq_hw[0]->event); | ||
640 | /* make sure mask gets to controller before we return to caller */ | ||
641 | mb(); | ||
642 | (void)in_le32(&pmac_irq_hw[0]->enable); | ||
643 | |||
644 | return 0; | ||
645 | } | ||
646 | |||
647 | static int pmacpic_resume(struct sys_device *sysdev) | ||
648 | { | ||
649 | int i; | ||
650 | |||
651 | out_le32(&pmac_irq_hw[0]->enable, 0); | ||
652 | if (max_real_irqs > 32) | ||
653 | out_le32(&pmac_irq_hw[1]->enable, 0); | ||
654 | mb(); | ||
655 | for (i = 0; i < max_real_irqs; ++i) | ||
656 | if (test_bit(i, sleep_save_mask)) | ||
657 | pmac_unmask_irq(i); | ||
658 | |||
659 | return 0; | ||
660 | } | ||
661 | |||
662 | #endif /* CONFIG_PM */ | ||
663 | |||
664 | static struct sysdev_class pmacpic_sysclass = { | ||
665 | set_kset_name("pmac_pic"), | ||
666 | }; | ||
667 | |||
668 | static struct sys_device device_pmacpic = { | ||
669 | .id = 0, | ||
670 | .cls = &pmacpic_sysclass, | ||
671 | }; | ||
672 | |||
673 | static struct sysdev_driver driver_pmacpic = { | ||
674 | #ifdef CONFIG_PM | ||
675 | .suspend = &pmacpic_suspend, | ||
676 | .resume = &pmacpic_resume, | ||
677 | #endif /* CONFIG_PM */ | ||
678 | }; | ||
679 | |||
680 | static int __init init_pmacpic_sysfs(void) | ||
681 | { | ||
682 | if (max_irqs == 0) | ||
683 | return -ENODEV; | ||
684 | |||
685 | printk(KERN_DEBUG "Registering pmac pic with sysfs...\n"); | ||
686 | sysdev_class_register(&pmacpic_sysclass); | ||
687 | sysdev_register(&device_pmacpic); | ||
688 | sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic); | ||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | subsys_initcall(init_pmacpic_sysfs); | ||
693 | |||
diff --git a/arch/ppc/platforms/pmac_pic.h b/arch/ppc/platforms/pmac_pic.h deleted file mode 100644 index 664103dfeef9..000000000000 --- a/arch/ppc/platforms/pmac_pic.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef __PPC_PLATFORMS_PMAC_PIC_H | ||
2 | #define __PPC_PLATFORMS_PMAC_PIC_H | ||
3 | |||
4 | #include <linux/irq.h> | ||
5 | |||
6 | extern struct hw_interrupt_type pmac_pic; | ||
7 | |||
8 | void pmac_pic_init(void); | ||
9 | int pmac_get_irq(struct pt_regs *regs); | ||
10 | |||
11 | #endif /* __PPC_PLATFORMS_PMAC_PIC_H */ | ||
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c deleted file mode 100644 index 55d2beffe560..000000000000 --- a/arch/ppc/platforms/pmac_setup.c +++ /dev/null | |||
@@ -1,745 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/setup.c | ||
3 | * | ||
4 | * PowerPC version | ||
5 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
6 | * | ||
7 | * Adapted for Power Macintosh by Paul Mackerras | ||
8 | * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au) | ||
9 | * | ||
10 | * Derived from "arch/alpha/kernel/setup.c" | ||
11 | * Copyright (C) 1995 Linus Torvalds | ||
12 | * | ||
13 | * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org) | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version | ||
18 | * 2 of the License, or (at your option) any later version. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * bootup setup stuff.. | ||
24 | */ | ||
25 | |||
26 | #include <linux/config.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/sched.h> | ||
30 | #include <linux/kernel.h> | ||
31 | #include <linux/mm.h> | ||
32 | #include <linux/stddef.h> | ||
33 | #include <linux/unistd.h> | ||
34 | #include <linux/ptrace.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <linux/user.h> | ||
37 | #include <linux/a.out.h> | ||
38 | #include <linux/tty.h> | ||
39 | #include <linux/string.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/ioport.h> | ||
42 | #include <linux/major.h> | ||
43 | #include <linux/initrd.h> | ||
44 | #include <linux/vt_kern.h> | ||
45 | #include <linux/console.h> | ||
46 | #include <linux/ide.h> | ||
47 | #include <linux/pci.h> | ||
48 | #include <linux/adb.h> | ||
49 | #include <linux/cuda.h> | ||
50 | #include <linux/pmu.h> | ||
51 | #include <linux/seq_file.h> | ||
52 | #include <linux/root_dev.h> | ||
53 | #include <linux/bitops.h> | ||
54 | #include <linux/suspend.h> | ||
55 | |||
56 | #include <asm/reg.h> | ||
57 | #include <asm/sections.h> | ||
58 | #include <asm/prom.h> | ||
59 | #include <asm/system.h> | ||
60 | #include <asm/pgtable.h> | ||
61 | #include <asm/io.h> | ||
62 | #include <asm/pci-bridge.h> | ||
63 | #include <asm/ohare.h> | ||
64 | #include <asm/mediabay.h> | ||
65 | #include <asm/machdep.h> | ||
66 | #include <asm/dma.h> | ||
67 | #include <asm/bootx.h> | ||
68 | #include <asm/cputable.h> | ||
69 | #include <asm/btext.h> | ||
70 | #include <asm/pmac_feature.h> | ||
71 | #include <asm/time.h> | ||
72 | #include <asm/of_device.h> | ||
73 | #include <asm/mmu_context.h> | ||
74 | |||
75 | #include "pmac_pic.h" | ||
76 | #include "mem_pieces.h" | ||
77 | |||
78 | #undef SHOW_GATWICK_IRQS | ||
79 | |||
80 | extern long pmac_time_init(void); | ||
81 | extern unsigned long pmac_get_rtc_time(void); | ||
82 | extern int pmac_set_rtc_time(unsigned long nowtime); | ||
83 | extern void pmac_read_rtc_time(void); | ||
84 | extern void pmac_calibrate_decr(void); | ||
85 | extern void pmac_pcibios_fixup(void); | ||
86 | extern void pmac_find_bridges(void); | ||
87 | extern unsigned long pmac_ide_get_base(int index); | ||
88 | extern void pmac_ide_init_hwif_ports(hw_regs_t *hw, | ||
89 | unsigned long data_port, unsigned long ctrl_port, int *irq); | ||
90 | |||
91 | extern void pmac_nvram_update(void); | ||
92 | extern unsigned char pmac_nvram_read_byte(int addr); | ||
93 | extern void pmac_nvram_write_byte(int addr, unsigned char val); | ||
94 | extern int pmac_pci_enable_device_hook(struct pci_dev *dev, int initial); | ||
95 | extern void pmac_pcibios_after_init(void); | ||
96 | extern int of_show_percpuinfo(struct seq_file *m, int i); | ||
97 | |||
98 | struct device_node *memory_node; | ||
99 | |||
100 | unsigned char drive_info; | ||
101 | |||
102 | int ppc_override_l2cr = 0; | ||
103 | int ppc_override_l2cr_value; | ||
104 | int has_l2cache = 0; | ||
105 | |||
106 | static int current_root_goodness = -1; | ||
107 | |||
108 | extern int pmac_newworld; | ||
109 | |||
110 | #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */ | ||
111 | |||
112 | extern void zs_kgdb_hook(int tty_num); | ||
113 | static void ohare_init(void); | ||
114 | #ifdef CONFIG_BOOTX_TEXT | ||
115 | static void pmac_progress(char *s, unsigned short hex); | ||
116 | #endif | ||
117 | |||
118 | sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN; | ||
119 | |||
120 | #ifdef CONFIG_SMP | ||
121 | extern struct smp_ops_t psurge_smp_ops; | ||
122 | extern struct smp_ops_t core99_smp_ops; | ||
123 | #endif /* CONFIG_SMP */ | ||
124 | |||
125 | static int | ||
126 | pmac_show_cpuinfo(struct seq_file *m) | ||
127 | { | ||
128 | struct device_node *np; | ||
129 | char *pp; | ||
130 | int plen; | ||
131 | int mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, | ||
132 | NULL, PMAC_MB_INFO_MODEL, 0); | ||
133 | unsigned int mbflags = (unsigned int)pmac_call_feature(PMAC_FTR_GET_MB_INFO, | ||
134 | NULL, PMAC_MB_INFO_FLAGS, 0); | ||
135 | char* mbname; | ||
136 | |||
137 | if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0) | ||
138 | mbname = "Unknown"; | ||
139 | |||
140 | /* find motherboard type */ | ||
141 | seq_printf(m, "machine\t\t: "); | ||
142 | np = find_devices("device-tree"); | ||
143 | if (np != NULL) { | ||
144 | pp = (char *) get_property(np, "model", NULL); | ||
145 | if (pp != NULL) | ||
146 | seq_printf(m, "%s\n", pp); | ||
147 | else | ||
148 | seq_printf(m, "PowerMac\n"); | ||
149 | pp = (char *) get_property(np, "compatible", &plen); | ||
150 | if (pp != NULL) { | ||
151 | seq_printf(m, "motherboard\t:"); | ||
152 | while (plen > 0) { | ||
153 | int l = strlen(pp) + 1; | ||
154 | seq_printf(m, " %s", pp); | ||
155 | plen -= l; | ||
156 | pp += l; | ||
157 | } | ||
158 | seq_printf(m, "\n"); | ||
159 | } | ||
160 | } else | ||
161 | seq_printf(m, "PowerMac\n"); | ||
162 | |||
163 | /* print parsed model */ | ||
164 | seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname); | ||
165 | seq_printf(m, "pmac flags\t: %08x\n", mbflags); | ||
166 | |||
167 | /* find l2 cache info */ | ||
168 | np = find_devices("l2-cache"); | ||
169 | if (np == 0) | ||
170 | np = find_type_devices("cache"); | ||
171 | if (np != 0) { | ||
172 | unsigned int *ic = (unsigned int *) | ||
173 | get_property(np, "i-cache-size", NULL); | ||
174 | unsigned int *dc = (unsigned int *) | ||
175 | get_property(np, "d-cache-size", NULL); | ||
176 | seq_printf(m, "L2 cache\t:"); | ||
177 | has_l2cache = 1; | ||
178 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { | ||
179 | seq_printf(m, " %dK unified", *dc / 1024); | ||
180 | } else { | ||
181 | if (ic) | ||
182 | seq_printf(m, " %dK instruction", *ic / 1024); | ||
183 | if (dc) | ||
184 | seq_printf(m, "%s %dK data", | ||
185 | (ic? " +": ""), *dc / 1024); | ||
186 | } | ||
187 | pp = get_property(np, "ram-type", NULL); | ||
188 | if (pp) | ||
189 | seq_printf(m, " %s", pp); | ||
190 | seq_printf(m, "\n"); | ||
191 | } | ||
192 | |||
193 | /* find ram info */ | ||
194 | np = find_devices("memory"); | ||
195 | if (np != 0) { | ||
196 | int n; | ||
197 | struct reg_property *reg = (struct reg_property *) | ||
198 | get_property(np, "reg", &n); | ||
199 | |||
200 | if (reg != 0) { | ||
201 | unsigned long total = 0; | ||
202 | |||
203 | for (n /= sizeof(struct reg_property); n > 0; --n) | ||
204 | total += (reg++)->size; | ||
205 | seq_printf(m, "memory\t\t: %luMB\n", total >> 20); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /* Checks "l2cr-value" property in the registry */ | ||
210 | np = find_devices("cpus"); | ||
211 | if (np == 0) | ||
212 | np = find_type_devices("cpu"); | ||
213 | if (np != 0) { | ||
214 | unsigned int *l2cr = (unsigned int *) | ||
215 | get_property(np, "l2cr-value", NULL); | ||
216 | if (l2cr != 0) { | ||
217 | seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | /* Indicate newworld/oldworld */ | ||
222 | seq_printf(m, "pmac-generation\t: %s\n", | ||
223 | pmac_newworld ? "NewWorld" : "OldWorld"); | ||
224 | |||
225 | |||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static int | ||
230 | pmac_show_percpuinfo(struct seq_file *m, int i) | ||
231 | { | ||
232 | #ifdef CONFIG_CPU_FREQ_PMAC | ||
233 | extern unsigned int pmac_get_one_cpufreq(int i); | ||
234 | unsigned int freq = pmac_get_one_cpufreq(i); | ||
235 | if (freq != 0) { | ||
236 | seq_printf(m, "clock\t\t: %dMHz\n", freq/1000); | ||
237 | return 0; | ||
238 | } | ||
239 | #endif /* CONFIG_CPU_FREQ_PMAC */ | ||
240 | return of_show_percpuinfo(m, i); | ||
241 | } | ||
242 | |||
243 | static volatile u32 *sysctrl_regs; | ||
244 | |||
245 | void __init | ||
246 | pmac_setup_arch(void) | ||
247 | { | ||
248 | struct device_node *cpu; | ||
249 | int *fp; | ||
250 | unsigned long pvr; | ||
251 | |||
252 | pvr = PVR_VER(mfspr(SPRN_PVR)); | ||
253 | |||
254 | /* Set loops_per_jiffy to a half-way reasonable value, | ||
255 | for use until calibrate_delay gets called. */ | ||
256 | cpu = find_type_devices("cpu"); | ||
257 | if (cpu != 0) { | ||
258 | fp = (int *) get_property(cpu, "clock-frequency", NULL); | ||
259 | if (fp != 0) { | ||
260 | if (pvr == 4 || pvr >= 8) | ||
261 | /* 604, G3, G4 etc. */ | ||
262 | loops_per_jiffy = *fp / HZ; | ||
263 | else | ||
264 | /* 601, 603, etc. */ | ||
265 | loops_per_jiffy = *fp / (2*HZ); | ||
266 | } else | ||
267 | loops_per_jiffy = 50000000 / HZ; | ||
268 | } | ||
269 | |||
270 | /* this area has the CPU identification register | ||
271 | and some registers used by smp boards */ | ||
272 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); | ||
273 | ohare_init(); | ||
274 | |||
275 | /* Lookup PCI hosts */ | ||
276 | pmac_find_bridges(); | ||
277 | |||
278 | /* Checks "l2cr-value" property in the registry */ | ||
279 | if (cpu_has_feature(CPU_FTR_L2CR)) { | ||
280 | struct device_node *np = find_devices("cpus"); | ||
281 | if (np == 0) | ||
282 | np = find_type_devices("cpu"); | ||
283 | if (np != 0) { | ||
284 | unsigned int *l2cr = (unsigned int *) | ||
285 | get_property(np, "l2cr-value", NULL); | ||
286 | if (l2cr != 0) { | ||
287 | ppc_override_l2cr = 1; | ||
288 | ppc_override_l2cr_value = *l2cr; | ||
289 | _set_L2CR(0); | ||
290 | _set_L2CR(ppc_override_l2cr_value); | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | |||
295 | if (ppc_override_l2cr) | ||
296 | printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n", | ||
297 | ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000) | ||
298 | ? "enabled" : "disabled"); | ||
299 | |||
300 | #ifdef CONFIG_KGDB | ||
301 | zs_kgdb_hook(0); | ||
302 | #endif | ||
303 | |||
304 | #ifdef CONFIG_ADB_CUDA | ||
305 | find_via_cuda(); | ||
306 | #else | ||
307 | if (find_devices("via-cuda")) { | ||
308 | printk("WARNING ! Your machine is Cuda based but your kernel\n"); | ||
309 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); | ||
310 | } | ||
311 | #endif | ||
312 | #ifdef CONFIG_ADB_PMU | ||
313 | find_via_pmu(); | ||
314 | #else | ||
315 | if (find_devices("via-pmu")) { | ||
316 | printk("WARNING ! Your machine is PMU based but your kernel\n"); | ||
317 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); | ||
318 | } | ||
319 | #endif | ||
320 | #ifdef CONFIG_NVRAM | ||
321 | pmac_nvram_init(); | ||
322 | #endif | ||
323 | #ifdef CONFIG_BLK_DEV_INITRD | ||
324 | if (initrd_start) | ||
325 | ROOT_DEV = Root_RAM0; | ||
326 | else | ||
327 | #endif | ||
328 | ROOT_DEV = DEFAULT_ROOT_DEVICE; | ||
329 | |||
330 | #ifdef CONFIG_SMP | ||
331 | /* Check for Core99 */ | ||
332 | if (find_devices("uni-n") || find_devices("u3")) | ||
333 | smp_ops = &core99_smp_ops; | ||
334 | else | ||
335 | smp_ops = &psurge_smp_ops; | ||
336 | #endif /* CONFIG_SMP */ | ||
337 | |||
338 | pci_create_OF_bus_map(); | ||
339 | } | ||
340 | |||
341 | static void __init ohare_init(void) | ||
342 | { | ||
343 | /* | ||
344 | * Turn on the L2 cache. | ||
345 | * We assume that we have a PSX memory controller iff | ||
346 | * we have an ohare I/O controller. | ||
347 | */ | ||
348 | if (find_devices("ohare") != NULL) { | ||
349 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { | ||
350 | if (sysctrl_regs[4] & 0x10) | ||
351 | sysctrl_regs[4] |= 0x04000020; | ||
352 | else | ||
353 | sysctrl_regs[4] |= 0x04000000; | ||
354 | if(has_l2cache) | ||
355 | printk(KERN_INFO "Level 2 cache enabled\n"); | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | extern char *bootpath; | ||
361 | extern char *bootdevice; | ||
362 | void *boot_host; | ||
363 | int boot_target; | ||
364 | int boot_part; | ||
365 | extern dev_t boot_dev; | ||
366 | |||
367 | #ifdef CONFIG_SCSI | ||
368 | void __init | ||
369 | note_scsi_host(struct device_node *node, void *host) | ||
370 | { | ||
371 | int l; | ||
372 | char *p; | ||
373 | |||
374 | l = strlen(node->full_name); | ||
375 | if (bootpath != NULL && bootdevice != NULL | ||
376 | && strncmp(node->full_name, bootdevice, l) == 0 | ||
377 | && (bootdevice[l] == '/' || bootdevice[l] == 0)) { | ||
378 | boot_host = host; | ||
379 | /* | ||
380 | * There's a bug in OF 1.0.5. (Why am I not surprised.) | ||
381 | * If you pass a path like scsi/sd@1:0 to canon, it returns | ||
382 | * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0 | ||
383 | * That is, the scsi target number doesn't get preserved. | ||
384 | * So we pick the target number out of bootpath and use that. | ||
385 | */ | ||
386 | p = strstr(bootpath, "/sd@"); | ||
387 | if (p != NULL) { | ||
388 | p += 4; | ||
389 | boot_target = simple_strtoul(p, NULL, 10); | ||
390 | p = strchr(p, ':'); | ||
391 | if (p != NULL) | ||
392 | boot_part = simple_strtoul(p + 1, NULL, 10); | ||
393 | } | ||
394 | } | ||
395 | } | ||
396 | #endif | ||
397 | |||
398 | #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) | ||
399 | static dev_t __init | ||
400 | find_ide_boot(void) | ||
401 | { | ||
402 | char *p; | ||
403 | int n; | ||
404 | dev_t __init pmac_find_ide_boot(char *bootdevice, int n); | ||
405 | |||
406 | if (bootdevice == NULL) | ||
407 | return 0; | ||
408 | p = strrchr(bootdevice, '/'); | ||
409 | if (p == NULL) | ||
410 | return 0; | ||
411 | n = p - bootdevice; | ||
412 | |||
413 | return pmac_find_ide_boot(bootdevice, n); | ||
414 | } | ||
415 | #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */ | ||
416 | |||
417 | static void __init | ||
418 | find_boot_device(void) | ||
419 | { | ||
420 | #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) | ||
421 | boot_dev = find_ide_boot(); | ||
422 | #endif | ||
423 | } | ||
424 | |||
425 | static int initializing = 1; | ||
426 | /* TODO: Merge the suspend-to-ram with the common code !!! | ||
427 | * currently, this is a stub implementation for suspend-to-disk | ||
428 | * only | ||
429 | */ | ||
430 | |||
431 | #ifdef CONFIG_SOFTWARE_SUSPEND | ||
432 | |||
433 | static int pmac_pm_prepare(suspend_state_t state) | ||
434 | { | ||
435 | printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state); | ||
436 | |||
437 | return 0; | ||
438 | } | ||
439 | |||
440 | static int pmac_pm_enter(suspend_state_t state) | ||
441 | { | ||
442 | printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state); | ||
443 | |||
444 | /* Giveup the lazy FPU & vec so we don't have to back them | ||
445 | * up from the low level code | ||
446 | */ | ||
447 | enable_kernel_fp(); | ||
448 | |||
449 | #ifdef CONFIG_ALTIVEC | ||
450 | if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC) | ||
451 | enable_kernel_altivec(); | ||
452 | #endif /* CONFIG_ALTIVEC */ | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | static int pmac_pm_finish(suspend_state_t state) | ||
458 | { | ||
459 | printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state); | ||
460 | |||
461 | /* Restore userland MMU context */ | ||
462 | set_context(current->active_mm->context, current->active_mm->pgd); | ||
463 | |||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | static struct pm_ops pmac_pm_ops = { | ||
468 | .pm_disk_mode = PM_DISK_SHUTDOWN, | ||
469 | .prepare = pmac_pm_prepare, | ||
470 | .enter = pmac_pm_enter, | ||
471 | .finish = pmac_pm_finish, | ||
472 | }; | ||
473 | |||
474 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | ||
475 | |||
476 | static int pmac_late_init(void) | ||
477 | { | ||
478 | initializing = 0; | ||
479 | #ifdef CONFIG_SOFTWARE_SUSPEND | ||
480 | pm_set_ops(&pmac_pm_ops); | ||
481 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | ||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | late_initcall(pmac_late_init); | ||
486 | |||
487 | /* can't be __init - can be called whenever a disk is first accessed */ | ||
488 | void | ||
489 | note_bootable_part(dev_t dev, int part, int goodness) | ||
490 | { | ||
491 | static int found_boot = 0; | ||
492 | char *p; | ||
493 | |||
494 | if (!initializing) | ||
495 | return; | ||
496 | if ((goodness <= current_root_goodness) && | ||
497 | ROOT_DEV != DEFAULT_ROOT_DEVICE) | ||
498 | return; | ||
499 | p = strstr(saved_command_line, "root="); | ||
500 | if (p != NULL && (p == saved_command_line || p[-1] == ' ')) | ||
501 | return; | ||
502 | |||
503 | if (!found_boot) { | ||
504 | find_boot_device(); | ||
505 | found_boot = 1; | ||
506 | } | ||
507 | if (!boot_dev || dev == boot_dev) { | ||
508 | ROOT_DEV = dev + part; | ||
509 | boot_dev = 0; | ||
510 | current_root_goodness = goodness; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | static void | ||
515 | pmac_restart(char *cmd) | ||
516 | { | ||
517 | #ifdef CONFIG_ADB_CUDA | ||
518 | struct adb_request req; | ||
519 | #endif /* CONFIG_ADB_CUDA */ | ||
520 | |||
521 | switch (sys_ctrler) { | ||
522 | #ifdef CONFIG_ADB_CUDA | ||
523 | case SYS_CTRLER_CUDA: | ||
524 | cuda_request(&req, NULL, 2, CUDA_PACKET, | ||
525 | CUDA_RESET_SYSTEM); | ||
526 | for (;;) | ||
527 | cuda_poll(); | ||
528 | break; | ||
529 | #endif /* CONFIG_ADB_CUDA */ | ||
530 | #ifdef CONFIG_ADB_PMU | ||
531 | case SYS_CTRLER_PMU: | ||
532 | pmu_restart(); | ||
533 | break; | ||
534 | #endif /* CONFIG_ADB_PMU */ | ||
535 | default: ; | ||
536 | } | ||
537 | } | ||
538 | |||
539 | static void | ||
540 | pmac_power_off(void) | ||
541 | { | ||
542 | #ifdef CONFIG_ADB_CUDA | ||
543 | struct adb_request req; | ||
544 | #endif /* CONFIG_ADB_CUDA */ | ||
545 | |||
546 | switch (sys_ctrler) { | ||
547 | #ifdef CONFIG_ADB_CUDA | ||
548 | case SYS_CTRLER_CUDA: | ||
549 | cuda_request(&req, NULL, 2, CUDA_PACKET, | ||
550 | CUDA_POWERDOWN); | ||
551 | for (;;) | ||
552 | cuda_poll(); | ||
553 | break; | ||
554 | #endif /* CONFIG_ADB_CUDA */ | ||
555 | #ifdef CONFIG_ADB_PMU | ||
556 | case SYS_CTRLER_PMU: | ||
557 | pmu_shutdown(); | ||
558 | break; | ||
559 | #endif /* CONFIG_ADB_PMU */ | ||
560 | default: ; | ||
561 | } | ||
562 | } | ||
563 | |||
564 | static void | ||
565 | pmac_halt(void) | ||
566 | { | ||
567 | pmac_power_off(); | ||
568 | } | ||
569 | |||
570 | /* | ||
571 | * Read in a property describing some pieces of memory. | ||
572 | */ | ||
573 | |||
574 | static int __init | ||
575 | get_mem_prop(char *name, struct mem_pieces *mp) | ||
576 | { | ||
577 | struct reg_property *rp; | ||
578 | int i, s; | ||
579 | unsigned int *ip; | ||
580 | int nac = prom_n_addr_cells(memory_node); | ||
581 | int nsc = prom_n_size_cells(memory_node); | ||
582 | |||
583 | ip = (unsigned int *) get_property(memory_node, name, &s); | ||
584 | if (ip == NULL) { | ||
585 | printk(KERN_ERR "error: couldn't get %s property on /memory\n", | ||
586 | name); | ||
587 | return 0; | ||
588 | } | ||
589 | s /= (nsc + nac) * 4; | ||
590 | rp = mp->regions; | ||
591 | for (i = 0; i < s; ++i, ip += nac+nsc) { | ||
592 | if (nac >= 2 && ip[nac-2] != 0) | ||
593 | continue; | ||
594 | rp->address = ip[nac-1]; | ||
595 | if (nsc >= 2 && ip[nac+nsc-2] != 0) | ||
596 | rp->size = ~0U; | ||
597 | else | ||
598 | rp->size = ip[nac+nsc-1]; | ||
599 | ++rp; | ||
600 | } | ||
601 | mp->n_regions = rp - mp->regions; | ||
602 | |||
603 | /* Make sure the pieces are sorted. */ | ||
604 | mem_pieces_sort(mp); | ||
605 | mem_pieces_coalesce(mp); | ||
606 | return 1; | ||
607 | } | ||
608 | |||
609 | /* | ||
610 | * On systems with Open Firmware, collect information about | ||
611 | * physical RAM and which pieces are already in use. | ||
612 | * At this point, we have (at least) the first 8MB mapped with a BAT. | ||
613 | * Our text, data, bss use something over 1MB, starting at 0. | ||
614 | * Open Firmware may be using 1MB at the 4MB point. | ||
615 | */ | ||
616 | unsigned long __init | ||
617 | pmac_find_end_of_memory(void) | ||
618 | { | ||
619 | unsigned long a, total; | ||
620 | struct mem_pieces phys_mem; | ||
621 | |||
622 | /* | ||
623 | * Find out where physical memory is, and check that it | ||
624 | * starts at 0 and is contiguous. It seems that RAM is | ||
625 | * always physically contiguous on Power Macintoshes. | ||
626 | * | ||
627 | * Supporting discontiguous physical memory isn't hard, | ||
628 | * it just makes the virtual <-> physical mapping functions | ||
629 | * more complicated (or else you end up wasting space | ||
630 | * in mem_map). | ||
631 | */ | ||
632 | memory_node = find_devices("memory"); | ||
633 | if (memory_node == NULL || !get_mem_prop("reg", &phys_mem) | ||
634 | || phys_mem.n_regions == 0) | ||
635 | panic("No RAM??"); | ||
636 | a = phys_mem.regions[0].address; | ||
637 | if (a != 0) | ||
638 | panic("RAM doesn't start at physical address 0"); | ||
639 | total = phys_mem.regions[0].size; | ||
640 | |||
641 | if (phys_mem.n_regions > 1) { | ||
642 | printk("RAM starting at 0x%x is not contiguous\n", | ||
643 | phys_mem.regions[1].address); | ||
644 | printk("Using RAM from 0 to 0x%lx\n", total-1); | ||
645 | } | ||
646 | |||
647 | return total; | ||
648 | } | ||
649 | |||
650 | void __init | ||
651 | pmac_init(unsigned long r3, unsigned long r4, unsigned long r5, | ||
652 | unsigned long r6, unsigned long r7) | ||
653 | { | ||
654 | /* isa_io_base gets set in pmac_find_bridges */ | ||
655 | isa_mem_base = PMAC_ISA_MEM_BASE; | ||
656 | pci_dram_offset = PMAC_PCI_DRAM_OFFSET; | ||
657 | ISA_DMA_THRESHOLD = ~0L; | ||
658 | DMA_MODE_READ = 1; | ||
659 | DMA_MODE_WRITE = 2; | ||
660 | |||
661 | ppc_md.setup_arch = pmac_setup_arch; | ||
662 | ppc_md.show_cpuinfo = pmac_show_cpuinfo; | ||
663 | ppc_md.show_percpuinfo = pmac_show_percpuinfo; | ||
664 | ppc_md.init_IRQ = pmac_pic_init; | ||
665 | ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */ | ||
666 | |||
667 | ppc_md.pcibios_fixup = pmac_pcibios_fixup; | ||
668 | ppc_md.pcibios_enable_device_hook = pmac_pci_enable_device_hook; | ||
669 | ppc_md.pcibios_after_init = pmac_pcibios_after_init; | ||
670 | ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot; | ||
671 | |||
672 | ppc_md.restart = pmac_restart; | ||
673 | ppc_md.power_off = pmac_power_off; | ||
674 | ppc_md.halt = pmac_halt; | ||
675 | |||
676 | ppc_md.time_init = pmac_time_init; | ||
677 | ppc_md.set_rtc_time = pmac_set_rtc_time; | ||
678 | ppc_md.get_rtc_time = pmac_get_rtc_time; | ||
679 | ppc_md.calibrate_decr = pmac_calibrate_decr; | ||
680 | |||
681 | ppc_md.find_end_of_memory = pmac_find_end_of_memory; | ||
682 | |||
683 | ppc_md.feature_call = pmac_do_feature_call; | ||
684 | |||
685 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
686 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | ||
687 | ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports; | ||
688 | ppc_ide_md.default_io_base = pmac_ide_get_base; | ||
689 | #endif /* CONFIG_BLK_DEV_IDE_PMAC */ | ||
690 | #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */ | ||
691 | |||
692 | #ifdef CONFIG_BOOTX_TEXT | ||
693 | ppc_md.progress = pmac_progress; | ||
694 | #endif /* CONFIG_BOOTX_TEXT */ | ||
695 | |||
696 | if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0); | ||
697 | |||
698 | } | ||
699 | |||
700 | #ifdef CONFIG_BOOTX_TEXT | ||
701 | static void __init | ||
702 | pmac_progress(char *s, unsigned short hex) | ||
703 | { | ||
704 | if (boot_text_mapped) { | ||
705 | btext_drawstring(s); | ||
706 | btext_drawchar('\n'); | ||
707 | } | ||
708 | } | ||
709 | #endif /* CONFIG_BOOTX_TEXT */ | ||
710 | |||
711 | static int __init | ||
712 | pmac_declare_of_platform_devices(void) | ||
713 | { | ||
714 | struct device_node *np; | ||
715 | |||
716 | np = find_devices("uni-n"); | ||
717 | if (np) { | ||
718 | for (np = np->child; np != NULL; np = np->sibling) | ||
719 | if (strncmp(np->name, "i2c", 3) == 0) { | ||
720 | of_platform_device_create(np, "uni-n-i2c", | ||
721 | NULL); | ||
722 | break; | ||
723 | } | ||
724 | } | ||
725 | np = find_devices("u3"); | ||
726 | if (np) { | ||
727 | for (np = np->child; np != NULL; np = np->sibling) | ||
728 | if (strncmp(np->name, "i2c", 3) == 0) { | ||
729 | of_platform_device_create(np, "u3-i2c", | ||
730 | NULL); | ||
731 | break; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | np = find_devices("valkyrie"); | ||
736 | if (np) | ||
737 | of_platform_device_create(np, "valkyrie", NULL); | ||
738 | np = find_devices("platinum"); | ||
739 | if (np) | ||
740 | of_platform_device_create(np, "platinum", NULL); | ||
741 | |||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | device_initcall(pmac_declare_of_platform_devices); | ||
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S deleted file mode 100644 index 22b113d19b24..000000000000 --- a/arch/ppc/platforms/pmac_sleep.S +++ /dev/null | |||
@@ -1,396 +0,0 @@ | |||
1 | /* | ||
2 | * This file contains sleep low-level functions for PowerBook G3. | ||
3 | * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org) | ||
4 | * and Paul Mackerras (paulus@samba.org). | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | #include <asm/processor.h> | ||
15 | #include <asm/page.h> | ||
16 | #include <asm/ppc_asm.h> | ||
17 | #include <asm/cputable.h> | ||
18 | #include <asm/cache.h> | ||
19 | #include <asm/thread_info.h> | ||
20 | #include <asm/asm-offsets.h> | ||
21 | |||
22 | #define MAGIC 0x4c617273 /* 'Lars' */ | ||
23 | |||
24 | /* | ||
25 | * Structure for storing CPU registers on the stack. | ||
26 | */ | ||
27 | #define SL_SP 0 | ||
28 | #define SL_PC 4 | ||
29 | #define SL_MSR 8 | ||
30 | #define SL_SDR1 0xc | ||
31 | #define SL_SPRG0 0x10 /* 4 sprg's */ | ||
32 | #define SL_DBAT0 0x20 | ||
33 | #define SL_IBAT0 0x28 | ||
34 | #define SL_DBAT1 0x30 | ||
35 | #define SL_IBAT1 0x38 | ||
36 | #define SL_DBAT2 0x40 | ||
37 | #define SL_IBAT2 0x48 | ||
38 | #define SL_DBAT3 0x50 | ||
39 | #define SL_IBAT3 0x58 | ||
40 | #define SL_TB 0x60 | ||
41 | #define SL_R2 0x68 | ||
42 | #define SL_CR 0x6c | ||
43 | #define SL_R12 0x70 /* r12 to r31 */ | ||
44 | #define SL_SIZE (SL_R12 + 80) | ||
45 | |||
46 | .section .text | ||
47 | .align 5 | ||
48 | |||
49 | #if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC) | ||
50 | |||
51 | /* This gets called by via-pmu.c late during the sleep process. | ||
52 | * The PMU was already send the sleep command and will shut us down | ||
53 | * soon. We need to save all that is needed and setup the wakeup | ||
54 | * vector that will be called by the ROM on wakeup | ||
55 | */ | ||
56 | _GLOBAL(low_sleep_handler) | ||
57 | #ifndef CONFIG_6xx | ||
58 | blr | ||
59 | #else | ||
60 | mflr r0 | ||
61 | stw r0,4(r1) | ||
62 | stwu r1,-SL_SIZE(r1) | ||
63 | mfcr r0 | ||
64 | stw r0,SL_CR(r1) | ||
65 | stw r2,SL_R2(r1) | ||
66 | stmw r12,SL_R12(r1) | ||
67 | |||
68 | /* Save MSR & SDR1 */ | ||
69 | mfmsr r4 | ||
70 | stw r4,SL_MSR(r1) | ||
71 | mfsdr1 r4 | ||
72 | stw r4,SL_SDR1(r1) | ||
73 | |||
74 | /* Get a stable timebase and save it */ | ||
75 | 1: mftbu r4 | ||
76 | stw r4,SL_TB(r1) | ||
77 | mftb r5 | ||
78 | stw r5,SL_TB+4(r1) | ||
79 | mftbu r3 | ||
80 | cmpw r3,r4 | ||
81 | bne 1b | ||
82 | |||
83 | /* Save SPRGs */ | ||
84 | mfsprg r4,0 | ||
85 | stw r4,SL_SPRG0(r1) | ||
86 | mfsprg r4,1 | ||
87 | stw r4,SL_SPRG0+4(r1) | ||
88 | mfsprg r4,2 | ||
89 | stw r4,SL_SPRG0+8(r1) | ||
90 | mfsprg r4,3 | ||
91 | stw r4,SL_SPRG0+12(r1) | ||
92 | |||
93 | /* Save BATs */ | ||
94 | mfdbatu r4,0 | ||
95 | stw r4,SL_DBAT0(r1) | ||
96 | mfdbatl r4,0 | ||
97 | stw r4,SL_DBAT0+4(r1) | ||
98 | mfdbatu r4,1 | ||
99 | stw r4,SL_DBAT1(r1) | ||
100 | mfdbatl r4,1 | ||
101 | stw r4,SL_DBAT1+4(r1) | ||
102 | mfdbatu r4,2 | ||
103 | stw r4,SL_DBAT2(r1) | ||
104 | mfdbatl r4,2 | ||
105 | stw r4,SL_DBAT2+4(r1) | ||
106 | mfdbatu r4,3 | ||
107 | stw r4,SL_DBAT3(r1) | ||
108 | mfdbatl r4,3 | ||
109 | stw r4,SL_DBAT3+4(r1) | ||
110 | mfibatu r4,0 | ||
111 | stw r4,SL_IBAT0(r1) | ||
112 | mfibatl r4,0 | ||
113 | stw r4,SL_IBAT0+4(r1) | ||
114 | mfibatu r4,1 | ||
115 | stw r4,SL_IBAT1(r1) | ||
116 | mfibatl r4,1 | ||
117 | stw r4,SL_IBAT1+4(r1) | ||
118 | mfibatu r4,2 | ||
119 | stw r4,SL_IBAT2(r1) | ||
120 | mfibatl r4,2 | ||
121 | stw r4,SL_IBAT2+4(r1) | ||
122 | mfibatu r4,3 | ||
123 | stw r4,SL_IBAT3(r1) | ||
124 | mfibatl r4,3 | ||
125 | stw r4,SL_IBAT3+4(r1) | ||
126 | |||
127 | /* Backup various CPU config stuffs */ | ||
128 | bl __save_cpu_setup | ||
129 | |||
130 | /* The ROM can wake us up via 2 different vectors: | ||
131 | * - On wallstreet & lombard, we must write a magic | ||
132 | * value 'Lars' at address 4 and a pointer to a | ||
133 | * memory location containing the PC to resume from | ||
134 | * at address 0. | ||
135 | * - On Core99, we must store the wakeup vector at | ||
136 | * address 0x80 and eventually it's parameters | ||
137 | * at address 0x84. I've have some trouble with those | ||
138 | * parameters however and I no longer use them. | ||
139 | */ | ||
140 | lis r5,grackle_wake_up@ha | ||
141 | addi r5,r5,grackle_wake_up@l | ||
142 | tophys(r5,r5) | ||
143 | stw r5,SL_PC(r1) | ||
144 | lis r4,KERNELBASE@h | ||
145 | tophys(r5,r1) | ||
146 | addi r5,r5,SL_PC | ||
147 | lis r6,MAGIC@ha | ||
148 | addi r6,r6,MAGIC@l | ||
149 | stw r5,0(r4) | ||
150 | stw r6,4(r4) | ||
151 | /* Setup stuffs at 0x80-0x84 for Core99 */ | ||
152 | lis r3,core99_wake_up@ha | ||
153 | addi r3,r3,core99_wake_up@l | ||
154 | tophys(r3,r3) | ||
155 | stw r3,0x80(r4) | ||
156 | stw r5,0x84(r4) | ||
157 | /* Store a pointer to our backup storage into | ||
158 | * a kernel global | ||
159 | */ | ||
160 | lis r3,sleep_storage@ha | ||
161 | addi r3,r3,sleep_storage@l | ||
162 | stw r5,0(r3) | ||
163 | |||
164 | .globl low_cpu_die | ||
165 | low_cpu_die: | ||
166 | /* Flush & disable all caches */ | ||
167 | bl flush_disable_caches | ||
168 | |||
169 | /* Turn off data relocation. */ | ||
170 | mfmsr r3 /* Save MSR in r7 */ | ||
171 | rlwinm r3,r3,0,28,26 /* Turn off DR bit */ | ||
172 | sync | ||
173 | mtmsr r3 | ||
174 | isync | ||
175 | |||
176 | BEGIN_FTR_SECTION | ||
177 | /* Flush any pending L2 data prefetches to work around HW bug */ | ||
178 | sync | ||
179 | lis r3,0xfff0 | ||
180 | lwz r0,0(r3) /* perform cache-inhibited load to ROM */ | ||
181 | sync /* (caches are disabled at this point) */ | ||
182 | END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450) | ||
183 | |||
184 | /* | ||
185 | * Set the HID0 and MSR for sleep. | ||
186 | */ | ||
187 | mfspr r2,SPRN_HID0 | ||
188 | rlwinm r2,r2,0,10,7 /* clear doze, nap */ | ||
189 | oris r2,r2,HID0_SLEEP@h | ||
190 | sync | ||
191 | isync | ||
192 | mtspr SPRN_HID0,r2 | ||
193 | sync | ||
194 | |||
195 | /* This loop puts us back to sleep in case we have a spurrious | ||
196 | * wakeup so that the host bridge properly stays asleep. The | ||
197 | * CPU will be turned off, either after a known time (about 1 | ||
198 | * second) on wallstreet & lombard, or as soon as the CPU enters | ||
199 | * SLEEP mode on core99 | ||
200 | */ | ||
201 | mfmsr r2 | ||
202 | oris r2,r2,MSR_POW@h | ||
203 | 1: sync | ||
204 | mtmsr r2 | ||
205 | isync | ||
206 | b 1b | ||
207 | |||
208 | /* | ||
209 | * Here is the resume code. | ||
210 | */ | ||
211 | |||
212 | |||
213 | /* | ||
214 | * Core99 machines resume here | ||
215 | * r4 has the physical address of SL_PC(sp) (unused) | ||
216 | */ | ||
217 | _GLOBAL(core99_wake_up) | ||
218 | /* Make sure HID0 no longer contains any sleep bit and that data cache | ||
219 | * is disabled | ||
220 | */ | ||
221 | mfspr r3,SPRN_HID0 | ||
222 | rlwinm r3,r3,0,11,7 /* clear SLEEP, NAP, DOZE bits */ | ||
223 | rlwinm 3,r3,0,18,15 /* clear DCE, ICE */ | ||
224 | mtspr SPRN_HID0,r3 | ||
225 | sync | ||
226 | isync | ||
227 | |||
228 | /* sanitize MSR */ | ||
229 | mfmsr r3 | ||
230 | ori r3,r3,MSR_EE|MSR_IP | ||
231 | xori r3,r3,MSR_EE|MSR_IP | ||
232 | sync | ||
233 | isync | ||
234 | mtmsr r3 | ||
235 | sync | ||
236 | isync | ||
237 | |||
238 | /* Recover sleep storage */ | ||
239 | lis r3,sleep_storage@ha | ||
240 | addi r3,r3,sleep_storage@l | ||
241 | tophys(r3,r3) | ||
242 | lwz r1,0(r3) | ||
243 | |||
244 | /* Pass thru to older resume code ... */ | ||
245 | /* | ||
246 | * Here is the resume code for older machines. | ||
247 | * r1 has the physical address of SL_PC(sp). | ||
248 | */ | ||
249 | |||
250 | grackle_wake_up: | ||
251 | |||
252 | /* Restore the kernel's segment registers before | ||
253 | * we do any r1 memory access as we are not sure they | ||
254 | * are in a sane state above the first 256Mb region | ||
255 | */ | ||
256 | li r0,16 /* load up segment register values */ | ||
257 | mtctr r0 /* for context 0 */ | ||
258 | lis r3,0x2000 /* Ku = 1, VSID = 0 */ | ||
259 | li r4,0 | ||
260 | 3: mtsrin r3,r4 | ||
261 | addi r3,r3,0x111 /* increment VSID */ | ||
262 | addis r4,r4,0x1000 /* address of next segment */ | ||
263 | bdnz 3b | ||
264 | sync | ||
265 | isync | ||
266 | |||
267 | subi r1,r1,SL_PC | ||
268 | |||
269 | /* Restore various CPU config stuffs */ | ||
270 | bl __restore_cpu_setup | ||
271 | |||
272 | /* Make sure all FPRs have been initialized */ | ||
273 | bl reloc_offset | ||
274 | bl __init_fpu_registers | ||
275 | |||
276 | /* Invalidate & enable L1 cache, we don't care about | ||
277 | * whatever the ROM may have tried to write to memory | ||
278 | */ | ||
279 | bl __inval_enable_L1 | ||
280 | |||
281 | /* Restore the BATs, and SDR1. Then we can turn on the MMU. */ | ||
282 | lwz r4,SL_SDR1(r1) | ||
283 | mtsdr1 r4 | ||
284 | lwz r4,SL_SPRG0(r1) | ||
285 | mtsprg 0,r4 | ||
286 | lwz r4,SL_SPRG0+4(r1) | ||
287 | mtsprg 1,r4 | ||
288 | lwz r4,SL_SPRG0+8(r1) | ||
289 | mtsprg 2,r4 | ||
290 | lwz r4,SL_SPRG0+12(r1) | ||
291 | mtsprg 3,r4 | ||
292 | |||
293 | lwz r4,SL_DBAT0(r1) | ||
294 | mtdbatu 0,r4 | ||
295 | lwz r4,SL_DBAT0+4(r1) | ||
296 | mtdbatl 0,r4 | ||
297 | lwz r4,SL_DBAT1(r1) | ||
298 | mtdbatu 1,r4 | ||
299 | lwz r4,SL_DBAT1+4(r1) | ||
300 | mtdbatl 1,r4 | ||
301 | lwz r4,SL_DBAT2(r1) | ||
302 | mtdbatu 2,r4 | ||
303 | lwz r4,SL_DBAT2+4(r1) | ||
304 | mtdbatl 2,r4 | ||
305 | lwz r4,SL_DBAT3(r1) | ||
306 | mtdbatu 3,r4 | ||
307 | lwz r4,SL_DBAT3+4(r1) | ||
308 | mtdbatl 3,r4 | ||
309 | lwz r4,SL_IBAT0(r1) | ||
310 | mtibatu 0,r4 | ||
311 | lwz r4,SL_IBAT0+4(r1) | ||
312 | mtibatl 0,r4 | ||
313 | lwz r4,SL_IBAT1(r1) | ||
314 | mtibatu 1,r4 | ||
315 | lwz r4,SL_IBAT1+4(r1) | ||
316 | mtibatl 1,r4 | ||
317 | lwz r4,SL_IBAT2(r1) | ||
318 | mtibatu 2,r4 | ||
319 | lwz r4,SL_IBAT2+4(r1) | ||
320 | mtibatl 2,r4 | ||
321 | lwz r4,SL_IBAT3(r1) | ||
322 | mtibatu 3,r4 | ||
323 | lwz r4,SL_IBAT3+4(r1) | ||
324 | mtibatl 3,r4 | ||
325 | |||
326 | BEGIN_FTR_SECTION | ||
327 | li r4,0 | ||
328 | mtspr SPRN_DBAT4U,r4 | ||
329 | mtspr SPRN_DBAT4L,r4 | ||
330 | mtspr SPRN_DBAT5U,r4 | ||
331 | mtspr SPRN_DBAT5L,r4 | ||
332 | mtspr SPRN_DBAT6U,r4 | ||
333 | mtspr SPRN_DBAT6L,r4 | ||
334 | mtspr SPRN_DBAT7U,r4 | ||
335 | mtspr SPRN_DBAT7L,r4 | ||
336 | mtspr SPRN_IBAT4U,r4 | ||
337 | mtspr SPRN_IBAT4L,r4 | ||
338 | mtspr SPRN_IBAT5U,r4 | ||
339 | mtspr SPRN_IBAT5L,r4 | ||
340 | mtspr SPRN_IBAT6U,r4 | ||
341 | mtspr SPRN_IBAT6L,r4 | ||
342 | mtspr SPRN_IBAT7U,r4 | ||
343 | mtspr SPRN_IBAT7L,r4 | ||
344 | END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS) | ||
345 | |||
346 | /* Flush all TLBs */ | ||
347 | lis r4,0x1000 | ||
348 | 1: addic. r4,r4,-0x1000 | ||
349 | tlbie r4 | ||
350 | blt 1b | ||
351 | sync | ||
352 | |||
353 | /* restore the MSR and turn on the MMU */ | ||
354 | lwz r3,SL_MSR(r1) | ||
355 | bl turn_on_mmu | ||
356 | |||
357 | /* get back the stack pointer */ | ||
358 | tovirt(r1,r1) | ||
359 | |||
360 | /* Restore TB */ | ||
361 | li r3,0 | ||
362 | mttbl r3 | ||
363 | lwz r3,SL_TB(r1) | ||
364 | lwz r4,SL_TB+4(r1) | ||
365 | mttbu r3 | ||
366 | mttbl r4 | ||
367 | |||
368 | /* Restore the callee-saved registers and return */ | ||
369 | lwz r0,SL_CR(r1) | ||
370 | mtcr r0 | ||
371 | lwz r2,SL_R2(r1) | ||
372 | lmw r12,SL_R12(r1) | ||
373 | addi r1,r1,SL_SIZE | ||
374 | lwz r0,4(r1) | ||
375 | mtlr r0 | ||
376 | blr | ||
377 | |||
378 | turn_on_mmu: | ||
379 | mflr r4 | ||
380 | tovirt(r4,r4) | ||
381 | mtsrr0 r4 | ||
382 | mtsrr1 r3 | ||
383 | sync | ||
384 | isync | ||
385 | rfi | ||
386 | |||
387 | #endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */ | ||
388 | |||
389 | .section .data | ||
390 | .balign L1_CACHE_BYTES | ||
391 | sleep_storage: | ||
392 | .long 0 | ||
393 | .balign L1_CACHE_BYTES, 0 | ||
394 | |||
395 | #endif /* CONFIG_6xx */ | ||
396 | .section .text | ||
diff --git a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c deleted file mode 100644 index 26ff26238f03..000000000000 --- a/arch/ppc/platforms/pmac_smp.c +++ /dev/null | |||
@@ -1,692 +0,0 @@ | |||
1 | /* | ||
2 | * SMP support for power macintosh. | ||
3 | * | ||
4 | * We support both the old "powersurge" SMP architecture | ||
5 | * and the current Core99 (G4 PowerMac) machines. | ||
6 | * | ||
7 | * Note that we don't support the very first rev. of | ||
8 | * Apple/DayStar 2 CPUs board, the one with the funky | ||
9 | * watchdog. Hopefully, none of these should be there except | ||
10 | * maybe internally to Apple. I should probably still add some | ||
11 | * code to detect this card though and disable SMP. --BenH. | ||
12 | * | ||
13 | * Support Macintosh G4 SMP by Troy Benjegerdes (hozer@drgw.net) | ||
14 | * and Ben Herrenschmidt <benh@kernel.crashing.org>. | ||
15 | * | ||
16 | * Support for DayStar quad CPU cards | ||
17 | * Copyright (C) XLR8, Inc. 1994-2000 | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or | ||
20 | * modify it under the terms of the GNU General Public License | ||
21 | * as published by the Free Software Foundation; either version | ||
22 | * 2 of the License, or (at your option) any later version. | ||
23 | */ | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/sched.h> | ||
27 | #include <linux/smp.h> | ||
28 | #include <linux/smp_lock.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/kernel_stat.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/spinlock.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/hardirq.h> | ||
36 | #include <linux/cpu.h> | ||
37 | |||
38 | #include <asm/ptrace.h> | ||
39 | #include <asm/atomic.h> | ||
40 | #include <asm/irq.h> | ||
41 | #include <asm/page.h> | ||
42 | #include <asm/pgtable.h> | ||
43 | #include <asm/sections.h> | ||
44 | #include <asm/io.h> | ||
45 | #include <asm/prom.h> | ||
46 | #include <asm/smp.h> | ||
47 | #include <asm/residual.h> | ||
48 | #include <asm/machdep.h> | ||
49 | #include <asm/pmac_feature.h> | ||
50 | #include <asm/time.h> | ||
51 | #include <asm/open_pic.h> | ||
52 | #include <asm/cacheflush.h> | ||
53 | #include <asm/keylargo.h> | ||
54 | |||
55 | /* | ||
56 | * Powersurge (old powermac SMP) support. | ||
57 | */ | ||
58 | |||
59 | extern void __secondary_start_pmac_0(void); | ||
60 | |||
61 | /* Addresses for powersurge registers */ | ||
62 | #define HAMMERHEAD_BASE 0xf8000000 | ||
63 | #define HHEAD_CONFIG 0x90 | ||
64 | #define HHEAD_SEC_INTR 0xc0 | ||
65 | |||
66 | /* register for interrupting the primary processor on the powersurge */ | ||
67 | /* N.B. this is actually the ethernet ROM! */ | ||
68 | #define PSURGE_PRI_INTR 0xf3019000 | ||
69 | |||
70 | /* register for storing the start address for the secondary processor */ | ||
71 | /* N.B. this is the PCI config space address register for the 1st bridge */ | ||
72 | #define PSURGE_START 0xf2800000 | ||
73 | |||
74 | /* Daystar/XLR8 4-CPU card */ | ||
75 | #define PSURGE_QUAD_REG_ADDR 0xf8800000 | ||
76 | |||
77 | #define PSURGE_QUAD_IRQ_SET 0 | ||
78 | #define PSURGE_QUAD_IRQ_CLR 1 | ||
79 | #define PSURGE_QUAD_IRQ_PRIMARY 2 | ||
80 | #define PSURGE_QUAD_CKSTOP_CTL 3 | ||
81 | #define PSURGE_QUAD_PRIMARY_ARB 4 | ||
82 | #define PSURGE_QUAD_BOARD_ID 6 | ||
83 | #define PSURGE_QUAD_WHICH_CPU 7 | ||
84 | #define PSURGE_QUAD_CKSTOP_RDBK 8 | ||
85 | #define PSURGE_QUAD_RESET_CTL 11 | ||
86 | |||
87 | #define PSURGE_QUAD_OUT(r, v) (out_8(quad_base + ((r) << 4) + 4, (v))) | ||
88 | #define PSURGE_QUAD_IN(r) (in_8(quad_base + ((r) << 4) + 4) & 0x0f) | ||
89 | #define PSURGE_QUAD_BIS(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) | (v))) | ||
90 | #define PSURGE_QUAD_BIC(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) & ~(v))) | ||
91 | |||
92 | /* virtual addresses for the above */ | ||
93 | static volatile u8 __iomem *hhead_base; | ||
94 | static volatile u8 __iomem *quad_base; | ||
95 | static volatile u32 __iomem *psurge_pri_intr; | ||
96 | static volatile u8 __iomem *psurge_sec_intr; | ||
97 | static volatile u32 __iomem *psurge_start; | ||
98 | |||
99 | /* values for psurge_type */ | ||
100 | #define PSURGE_NONE -1 | ||
101 | #define PSURGE_DUAL 0 | ||
102 | #define PSURGE_QUAD_OKEE 1 | ||
103 | #define PSURGE_QUAD_COTTON 2 | ||
104 | #define PSURGE_QUAD_ICEGRASS 3 | ||
105 | |||
106 | /* what sort of powersurge board we have */ | ||
107 | static int psurge_type = PSURGE_NONE; | ||
108 | |||
109 | /* L2 and L3 cache settings to pass from CPU0 to CPU1 */ | ||
110 | volatile static long int core99_l2_cache; | ||
111 | volatile static long int core99_l3_cache; | ||
112 | |||
113 | /* Timebase freeze GPIO */ | ||
114 | static unsigned int core99_tb_gpio; | ||
115 | |||
116 | /* Sync flag for HW tb sync */ | ||
117 | static volatile int sec_tb_reset = 0; | ||
118 | static unsigned int pri_tb_hi, pri_tb_lo; | ||
119 | static unsigned int pri_tb_stamp; | ||
120 | |||
121 | static void __devinit core99_init_caches(int cpu) | ||
122 | { | ||
123 | if (!cpu_has_feature(CPU_FTR_L2CR)) | ||
124 | return; | ||
125 | |||
126 | if (cpu == 0) { | ||
127 | core99_l2_cache = _get_L2CR(); | ||
128 | printk("CPU0: L2CR is %lx\n", core99_l2_cache); | ||
129 | } else { | ||
130 | printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR()); | ||
131 | _set_L2CR(0); | ||
132 | _set_L2CR(core99_l2_cache); | ||
133 | printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache); | ||
134 | } | ||
135 | |||
136 | if (!cpu_has_feature(CPU_FTR_L3CR)) | ||
137 | return; | ||
138 | |||
139 | if (cpu == 0){ | ||
140 | core99_l3_cache = _get_L3CR(); | ||
141 | printk("CPU0: L3CR is %lx\n", core99_l3_cache); | ||
142 | } else { | ||
143 | printk("CPU%d: L3CR was %lx\n", cpu, _get_L3CR()); | ||
144 | _set_L3CR(0); | ||
145 | _set_L3CR(core99_l3_cache); | ||
146 | printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache); | ||
147 | } | ||
148 | } | ||
149 | |||
150 | /* | ||
151 | * Set and clear IPIs for powersurge. | ||
152 | */ | ||
153 | static inline void psurge_set_ipi(int cpu) | ||
154 | { | ||
155 | if (psurge_type == PSURGE_NONE) | ||
156 | return; | ||
157 | if (cpu == 0) | ||
158 | in_be32(psurge_pri_intr); | ||
159 | else if (psurge_type == PSURGE_DUAL) | ||
160 | out_8(psurge_sec_intr, 0); | ||
161 | else | ||
162 | PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_SET, 1 << cpu); | ||
163 | } | ||
164 | |||
165 | static inline void psurge_clr_ipi(int cpu) | ||
166 | { | ||
167 | if (cpu > 0) { | ||
168 | switch(psurge_type) { | ||
169 | case PSURGE_DUAL: | ||
170 | out_8(psurge_sec_intr, ~0); | ||
171 | case PSURGE_NONE: | ||
172 | break; | ||
173 | default: | ||
174 | PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, 1 << cpu); | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | /* | ||
180 | * On powersurge (old SMP powermac architecture) we don't have | ||
181 | * separate IPIs for separate messages like openpic does. Instead | ||
182 | * we have a bitmap for each processor, where a 1 bit means that | ||
183 | * the corresponding message is pending for that processor. | ||
184 | * Ideally each cpu's entry would be in a different cache line. | ||
185 | * -- paulus. | ||
186 | */ | ||
187 | static unsigned long psurge_smp_message[NR_CPUS]; | ||
188 | |||
189 | void psurge_smp_message_recv(struct pt_regs *regs) | ||
190 | { | ||
191 | int cpu = smp_processor_id(); | ||
192 | int msg; | ||
193 | |||
194 | /* clear interrupt */ | ||
195 | psurge_clr_ipi(cpu); | ||
196 | |||
197 | if (num_online_cpus() < 2) | ||
198 | return; | ||
199 | |||
200 | /* make sure there is a message there */ | ||
201 | for (msg = 0; msg < 4; msg++) | ||
202 | if (test_and_clear_bit(msg, &psurge_smp_message[cpu])) | ||
203 | smp_message_recv(msg, regs); | ||
204 | } | ||
205 | |||
206 | irqreturn_t psurge_primary_intr(int irq, void *d, struct pt_regs *regs) | ||
207 | { | ||
208 | psurge_smp_message_recv(regs); | ||
209 | return IRQ_HANDLED; | ||
210 | } | ||
211 | |||
212 | static void smp_psurge_message_pass(int target, int msg) | ||
213 | { | ||
214 | int i; | ||
215 | |||
216 | if (num_online_cpus() < 2) | ||
217 | return; | ||
218 | |||
219 | for (i = 0; i < NR_CPUS; i++) { | ||
220 | if (!cpu_online(i)) | ||
221 | continue; | ||
222 | if (target == MSG_ALL | ||
223 | || (target == MSG_ALL_BUT_SELF && i != smp_processor_id()) | ||
224 | || target == i) { | ||
225 | set_bit(msg, &psurge_smp_message[i]); | ||
226 | psurge_set_ipi(i); | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /* | ||
232 | * Determine a quad card presence. We read the board ID register, we | ||
233 | * force the data bus to change to something else, and we read it again. | ||
234 | * It it's stable, then the register probably exist (ugh !) | ||
235 | */ | ||
236 | static int __init psurge_quad_probe(void) | ||
237 | { | ||
238 | int type; | ||
239 | unsigned int i; | ||
240 | |||
241 | type = PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID); | ||
242 | if (type < PSURGE_QUAD_OKEE || type > PSURGE_QUAD_ICEGRASS | ||
243 | || type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID)) | ||
244 | return PSURGE_DUAL; | ||
245 | |||
246 | /* looks OK, try a slightly more rigorous test */ | ||
247 | /* bogus is not necessarily cacheline-aligned, | ||
248 | though I don't suppose that really matters. -- paulus */ | ||
249 | for (i = 0; i < 100; i++) { | ||
250 | volatile u32 bogus[8]; | ||
251 | bogus[(0+i)%8] = 0x00000000; | ||
252 | bogus[(1+i)%8] = 0x55555555; | ||
253 | bogus[(2+i)%8] = 0xFFFFFFFF; | ||
254 | bogus[(3+i)%8] = 0xAAAAAAAA; | ||
255 | bogus[(4+i)%8] = 0x33333333; | ||
256 | bogus[(5+i)%8] = 0xCCCCCCCC; | ||
257 | bogus[(6+i)%8] = 0xCCCCCCCC; | ||
258 | bogus[(7+i)%8] = 0x33333333; | ||
259 | wmb(); | ||
260 | asm volatile("dcbf 0,%0" : : "r" (bogus) : "memory"); | ||
261 | mb(); | ||
262 | if (type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID)) | ||
263 | return PSURGE_DUAL; | ||
264 | } | ||
265 | return type; | ||
266 | } | ||
267 | |||
268 | static void __init psurge_quad_init(void) | ||
269 | { | ||
270 | int procbits; | ||
271 | |||
272 | if (ppc_md.progress) ppc_md.progress("psurge_quad_init", 0x351); | ||
273 | procbits = ~PSURGE_QUAD_IN(PSURGE_QUAD_WHICH_CPU); | ||
274 | if (psurge_type == PSURGE_QUAD_ICEGRASS) | ||
275 | PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits); | ||
276 | else | ||
277 | PSURGE_QUAD_BIC(PSURGE_QUAD_CKSTOP_CTL, procbits); | ||
278 | mdelay(33); | ||
279 | out_8(psurge_sec_intr, ~0); | ||
280 | PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, procbits); | ||
281 | PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits); | ||
282 | if (psurge_type != PSURGE_QUAD_ICEGRASS) | ||
283 | PSURGE_QUAD_BIS(PSURGE_QUAD_CKSTOP_CTL, procbits); | ||
284 | PSURGE_QUAD_BIC(PSURGE_QUAD_PRIMARY_ARB, procbits); | ||
285 | mdelay(33); | ||
286 | PSURGE_QUAD_BIC(PSURGE_QUAD_RESET_CTL, procbits); | ||
287 | mdelay(33); | ||
288 | PSURGE_QUAD_BIS(PSURGE_QUAD_PRIMARY_ARB, procbits); | ||
289 | mdelay(33); | ||
290 | } | ||
291 | |||
292 | static int __init smp_psurge_probe(void) | ||
293 | { | ||
294 | int i, ncpus; | ||
295 | |||
296 | /* We don't do SMP on the PPC601 -- paulus */ | ||
297 | if (PVR_VER(mfspr(SPRN_PVR)) == 1) | ||
298 | return 1; | ||
299 | |||
300 | /* | ||
301 | * The powersurge cpu board can be used in the generation | ||
302 | * of powermacs that have a socket for an upgradeable cpu card, | ||
303 | * including the 7500, 8500, 9500, 9600. | ||
304 | * The device tree doesn't tell you if you have 2 cpus because | ||
305 | * OF doesn't know anything about the 2nd processor. | ||
306 | * Instead we look for magic bits in magic registers, | ||
307 | * in the hammerhead memory controller in the case of the | ||
308 | * dual-cpu powersurge board. -- paulus. | ||
309 | */ | ||
310 | if (find_devices("hammerhead") == NULL) | ||
311 | return 1; | ||
312 | |||
313 | hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); | ||
314 | quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); | ||
315 | psurge_sec_intr = hhead_base + HHEAD_SEC_INTR; | ||
316 | |||
317 | psurge_type = psurge_quad_probe(); | ||
318 | if (psurge_type != PSURGE_DUAL) { | ||
319 | psurge_quad_init(); | ||
320 | /* All released cards using this HW design have 4 CPUs */ | ||
321 | ncpus = 4; | ||
322 | } else { | ||
323 | iounmap(quad_base); | ||
324 | if ((in_8(hhead_base + HHEAD_CONFIG) & 0x02) == 0) { | ||
325 | /* not a dual-cpu card */ | ||
326 | iounmap(hhead_base); | ||
327 | psurge_type = PSURGE_NONE; | ||
328 | return 1; | ||
329 | } | ||
330 | ncpus = 2; | ||
331 | } | ||
332 | |||
333 | psurge_start = ioremap(PSURGE_START, 4); | ||
334 | psurge_pri_intr = ioremap(PSURGE_PRI_INTR, 4); | ||
335 | |||
336 | /* this is not actually strictly necessary -- paulus. */ | ||
337 | for (i = 1; i < ncpus; ++i) | ||
338 | smp_hw_index[i] = i; | ||
339 | |||
340 | if (ppc_md.progress) ppc_md.progress("smp_psurge_probe - done", 0x352); | ||
341 | |||
342 | return ncpus; | ||
343 | } | ||
344 | |||
345 | static void __init smp_psurge_kick_cpu(int nr) | ||
346 | { | ||
347 | unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8; | ||
348 | unsigned long a; | ||
349 | |||
350 | /* may need to flush here if secondary bats aren't setup */ | ||
351 | for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32) | ||
352 | asm volatile("dcbf 0,%0" : : "r" (a) : "memory"); | ||
353 | asm volatile("sync"); | ||
354 | |||
355 | if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353); | ||
356 | |||
357 | out_be32(psurge_start, start); | ||
358 | mb(); | ||
359 | |||
360 | psurge_set_ipi(nr); | ||
361 | udelay(10); | ||
362 | psurge_clr_ipi(nr); | ||
363 | |||
364 | if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354); | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * With the dual-cpu powersurge board, the decrementers and timebases | ||
369 | * of both cpus are frozen after the secondary cpu is started up, | ||
370 | * until we give the secondary cpu another interrupt. This routine | ||
371 | * uses this to get the timebases synchronized. | ||
372 | * -- paulus. | ||
373 | */ | ||
374 | static void __init psurge_dual_sync_tb(int cpu_nr) | ||
375 | { | ||
376 | int t; | ||
377 | |||
378 | set_dec(tb_ticks_per_jiffy); | ||
379 | set_tb(0, 0); | ||
380 | last_jiffy_stamp(cpu_nr) = 0; | ||
381 | |||
382 | if (cpu_nr > 0) { | ||
383 | mb(); | ||
384 | sec_tb_reset = 1; | ||
385 | return; | ||
386 | } | ||
387 | |||
388 | /* wait for the secondary to have reset its TB before proceeding */ | ||
389 | for (t = 10000000; t > 0 && !sec_tb_reset; --t) | ||
390 | ; | ||
391 | |||
392 | /* now interrupt the secondary, starting both TBs */ | ||
393 | psurge_set_ipi(1); | ||
394 | |||
395 | smp_tb_synchronized = 1; | ||
396 | } | ||
397 | |||
398 | static struct irqaction psurge_irqaction = { | ||
399 | .handler = psurge_primary_intr, | ||
400 | .flags = SA_INTERRUPT, | ||
401 | .mask = CPU_MASK_NONE, | ||
402 | .name = "primary IPI", | ||
403 | }; | ||
404 | |||
405 | static void __init smp_psurge_setup_cpu(int cpu_nr) | ||
406 | { | ||
407 | |||
408 | if (cpu_nr == 0) { | ||
409 | /* If we failed to start the second CPU, we should still | ||
410 | * send it an IPI to start the timebase & DEC or we might | ||
411 | * have them stuck. | ||
412 | */ | ||
413 | if (num_online_cpus() < 2) { | ||
414 | if (psurge_type == PSURGE_DUAL) | ||
415 | psurge_set_ipi(1); | ||
416 | return; | ||
417 | } | ||
418 | /* reset the entry point so if we get another intr we won't | ||
419 | * try to startup again */ | ||
420 | out_be32(psurge_start, 0x100); | ||
421 | if (setup_irq(30, &psurge_irqaction)) | ||
422 | printk(KERN_ERR "Couldn't get primary IPI interrupt"); | ||
423 | } | ||
424 | |||
425 | if (psurge_type == PSURGE_DUAL) | ||
426 | psurge_dual_sync_tb(cpu_nr); | ||
427 | } | ||
428 | |||
429 | void __init smp_psurge_take_timebase(void) | ||
430 | { | ||
431 | /* Dummy implementation */ | ||
432 | } | ||
433 | |||
434 | void __init smp_psurge_give_timebase(void) | ||
435 | { | ||
436 | /* Dummy implementation */ | ||
437 | } | ||
438 | |||
439 | static int __init smp_core99_probe(void) | ||
440 | { | ||
441 | #ifdef CONFIG_6xx | ||
442 | extern int powersave_nap; | ||
443 | #endif | ||
444 | struct device_node *cpus, *firstcpu; | ||
445 | int i, ncpus = 0, boot_cpu = -1; | ||
446 | u32 *tbprop = NULL; | ||
447 | |||
448 | if (ppc_md.progress) ppc_md.progress("smp_core99_probe", 0x345); | ||
449 | cpus = firstcpu = find_type_devices("cpu"); | ||
450 | while(cpus != NULL) { | ||
451 | u32 *regprop = (u32 *)get_property(cpus, "reg", NULL); | ||
452 | char *stateprop = (char *)get_property(cpus, "state", NULL); | ||
453 | if (regprop != NULL && stateprop != NULL && | ||
454 | !strncmp(stateprop, "running", 7)) | ||
455 | boot_cpu = *regprop; | ||
456 | ++ncpus; | ||
457 | cpus = cpus->next; | ||
458 | } | ||
459 | if (boot_cpu == -1) | ||
460 | printk(KERN_WARNING "Couldn't detect boot CPU !\n"); | ||
461 | if (boot_cpu != 0) | ||
462 | printk(KERN_WARNING "Boot CPU is %d, unsupported setup !\n", boot_cpu); | ||
463 | |||
464 | if (machine_is_compatible("MacRISC4")) { | ||
465 | extern struct smp_ops_t core99_smp_ops; | ||
466 | |||
467 | core99_smp_ops.take_timebase = smp_generic_take_timebase; | ||
468 | core99_smp_ops.give_timebase = smp_generic_give_timebase; | ||
469 | } else { | ||
470 | if (firstcpu != NULL) | ||
471 | tbprop = (u32 *)get_property(firstcpu, "timebase-enable", NULL); | ||
472 | if (tbprop) | ||
473 | core99_tb_gpio = *tbprop; | ||
474 | else | ||
475 | core99_tb_gpio = KL_GPIO_TB_ENABLE; | ||
476 | } | ||
477 | |||
478 | if (ncpus > 1) { | ||
479 | openpic_request_IPIs(); | ||
480 | for (i = 1; i < ncpus; ++i) | ||
481 | smp_hw_index[i] = i; | ||
482 | #ifdef CONFIG_6xx | ||
483 | powersave_nap = 0; | ||
484 | #endif | ||
485 | core99_init_caches(0); | ||
486 | } | ||
487 | |||
488 | return ncpus; | ||
489 | } | ||
490 | |||
491 | static void __devinit smp_core99_kick_cpu(int nr) | ||
492 | { | ||
493 | unsigned long save_vector, new_vector; | ||
494 | unsigned long flags; | ||
495 | |||
496 | volatile unsigned long *vector | ||
497 | = ((volatile unsigned long *)(KERNELBASE+0x100)); | ||
498 | if (nr < 0 || nr > 3) | ||
499 | return; | ||
500 | if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346); | ||
501 | |||
502 | local_irq_save(flags); | ||
503 | local_irq_disable(); | ||
504 | |||
505 | /* Save reset vector */ | ||
506 | save_vector = *vector; | ||
507 | |||
508 | /* Setup fake reset vector that does | ||
509 | * b __secondary_start_pmac_0 + nr*8 - KERNELBASE | ||
510 | */ | ||
511 | new_vector = (unsigned long) __secondary_start_pmac_0 + nr * 8; | ||
512 | *vector = 0x48000002 + new_vector - KERNELBASE; | ||
513 | |||
514 | /* flush data cache and inval instruction cache */ | ||
515 | flush_icache_range((unsigned long) vector, (unsigned long) vector + 4); | ||
516 | |||
517 | /* Put some life in our friend */ | ||
518 | pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0); | ||
519 | |||
520 | /* FIXME: We wait a bit for the CPU to take the exception, I should | ||
521 | * instead wait for the entry code to set something for me. Well, | ||
522 | * ideally, all that crap will be done in prom.c and the CPU left | ||
523 | * in a RAM-based wait loop like CHRP. | ||
524 | */ | ||
525 | mdelay(1); | ||
526 | |||
527 | /* Restore our exception vector */ | ||
528 | *vector = save_vector; | ||
529 | flush_icache_range((unsigned long) vector, (unsigned long) vector + 4); | ||
530 | |||
531 | local_irq_restore(flags); | ||
532 | if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347); | ||
533 | } | ||
534 | |||
535 | static void __devinit smp_core99_setup_cpu(int cpu_nr) | ||
536 | { | ||
537 | /* Setup L2/L3 */ | ||
538 | if (cpu_nr != 0) | ||
539 | core99_init_caches(cpu_nr); | ||
540 | |||
541 | /* Setup openpic */ | ||
542 | do_openpic_setup_cpu(); | ||
543 | |||
544 | if (cpu_nr == 0) { | ||
545 | #ifdef CONFIG_POWER4 | ||
546 | extern void g5_phy_disable_cpu1(void); | ||
547 | |||
548 | /* If we didn't start the second CPU, we must take | ||
549 | * it off the bus | ||
550 | */ | ||
551 | if (machine_is_compatible("MacRISC4") && | ||
552 | num_online_cpus() < 2) | ||
553 | g5_phy_disable_cpu1(); | ||
554 | #endif /* CONFIG_POWER4 */ | ||
555 | if (ppc_md.progress) ppc_md.progress("core99_setup_cpu 0 done", 0x349); | ||
556 | } | ||
557 | } | ||
558 | |||
559 | /* not __init, called in sleep/wakeup code */ | ||
560 | void smp_core99_take_timebase(void) | ||
561 | { | ||
562 | unsigned long flags; | ||
563 | |||
564 | /* tell the primary we're here */ | ||
565 | sec_tb_reset = 1; | ||
566 | mb(); | ||
567 | |||
568 | /* wait for the primary to set pri_tb_hi/lo */ | ||
569 | while (sec_tb_reset < 2) | ||
570 | mb(); | ||
571 | |||
572 | /* set our stuff the same as the primary */ | ||
573 | local_irq_save(flags); | ||
574 | set_dec(1); | ||
575 | set_tb(pri_tb_hi, pri_tb_lo); | ||
576 | last_jiffy_stamp(smp_processor_id()) = pri_tb_stamp; | ||
577 | mb(); | ||
578 | |||
579 | /* tell the primary we're done */ | ||
580 | sec_tb_reset = 0; | ||
581 | mb(); | ||
582 | local_irq_restore(flags); | ||
583 | } | ||
584 | |||
585 | /* not __init, called in sleep/wakeup code */ | ||
586 | void smp_core99_give_timebase(void) | ||
587 | { | ||
588 | unsigned long flags; | ||
589 | unsigned int t; | ||
590 | |||
591 | /* wait for the secondary to be in take_timebase */ | ||
592 | for (t = 100000; t > 0 && !sec_tb_reset; --t) | ||
593 | udelay(10); | ||
594 | if (!sec_tb_reset) { | ||
595 | printk(KERN_WARNING "Timeout waiting sync on second CPU\n"); | ||
596 | return; | ||
597 | } | ||
598 | |||
599 | /* freeze the timebase and read it */ | ||
600 | /* disable interrupts so the timebase is disabled for the | ||
601 | shortest possible time */ | ||
602 | local_irq_save(flags); | ||
603 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 4); | ||
604 | pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0); | ||
605 | mb(); | ||
606 | pri_tb_hi = get_tbu(); | ||
607 | pri_tb_lo = get_tbl(); | ||
608 | pri_tb_stamp = last_jiffy_stamp(smp_processor_id()); | ||
609 | mb(); | ||
610 | |||
611 | /* tell the secondary we're ready */ | ||
612 | sec_tb_reset = 2; | ||
613 | mb(); | ||
614 | |||
615 | /* wait for the secondary to have taken it */ | ||
616 | for (t = 100000; t > 0 && sec_tb_reset; --t) | ||
617 | udelay(10); | ||
618 | if (sec_tb_reset) | ||
619 | printk(KERN_WARNING "Timeout waiting sync(2) on second CPU\n"); | ||
620 | else | ||
621 | smp_tb_synchronized = 1; | ||
622 | |||
623 | /* Now, restart the timebase by leaving the GPIO to an open collector */ | ||
624 | pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 0); | ||
625 | pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0); | ||
626 | local_irq_restore(flags); | ||
627 | } | ||
628 | |||
629 | |||
630 | /* PowerSurge-style Macs */ | ||
631 | struct smp_ops_t psurge_smp_ops = { | ||
632 | .message_pass = smp_psurge_message_pass, | ||
633 | .probe = smp_psurge_probe, | ||
634 | .kick_cpu = smp_psurge_kick_cpu, | ||
635 | .setup_cpu = smp_psurge_setup_cpu, | ||
636 | .give_timebase = smp_psurge_give_timebase, | ||
637 | .take_timebase = smp_psurge_take_timebase, | ||
638 | }; | ||
639 | |||
640 | /* Core99 Macs (dual G4s) */ | ||
641 | struct smp_ops_t core99_smp_ops = { | ||
642 | .message_pass = smp_openpic_message_pass, | ||
643 | .probe = smp_core99_probe, | ||
644 | .kick_cpu = smp_core99_kick_cpu, | ||
645 | .setup_cpu = smp_core99_setup_cpu, | ||
646 | .give_timebase = smp_core99_give_timebase, | ||
647 | .take_timebase = smp_core99_take_timebase, | ||
648 | }; | ||
649 | |||
650 | #ifdef CONFIG_HOTPLUG_CPU | ||
651 | |||
652 | int __cpu_disable(void) | ||
653 | { | ||
654 | cpu_clear(smp_processor_id(), cpu_online_map); | ||
655 | |||
656 | /* XXX reset cpu affinity here */ | ||
657 | openpic_set_priority(0xf); | ||
658 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
659 | mb(); | ||
660 | udelay(20); | ||
661 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
662 | return 0; | ||
663 | } | ||
664 | |||
665 | extern void low_cpu_die(void) __attribute__((noreturn)); /* in pmac_sleep.S */ | ||
666 | static int cpu_dead[NR_CPUS]; | ||
667 | |||
668 | void cpu_die(void) | ||
669 | { | ||
670 | local_irq_disable(); | ||
671 | cpu_dead[smp_processor_id()] = 1; | ||
672 | mb(); | ||
673 | low_cpu_die(); | ||
674 | } | ||
675 | |||
676 | void __cpu_die(unsigned int cpu) | ||
677 | { | ||
678 | int timeout; | ||
679 | |||
680 | timeout = 1000; | ||
681 | while (!cpu_dead[cpu]) { | ||
682 | if (--timeout == 0) { | ||
683 | printk("CPU %u refused to die!\n", cpu); | ||
684 | break; | ||
685 | } | ||
686 | msleep(1); | ||
687 | } | ||
688 | cpu_callin_map[cpu] = 0; | ||
689 | cpu_dead[cpu] = 0; | ||
690 | } | ||
691 | |||
692 | #endif | ||
diff --git a/arch/ppc/platforms/pmac_time.c b/arch/ppc/platforms/pmac_time.c deleted file mode 100644 index edb9fcc64790..000000000000 --- a/arch/ppc/platforms/pmac_time.c +++ /dev/null | |||
@@ -1,291 +0,0 @@ | |||
1 | /* | ||
2 | * Support for periodic interrupts (100 per second) and for getting | ||
3 | * the current time from the RTC on Power Macintoshes. | ||
4 | * | ||
5 | * We use the decrementer register for our periodic interrupts. | ||
6 | * | ||
7 | * Paul Mackerras August 1996. | ||
8 | * Copyright (C) 1996 Paul Mackerras. | ||
9 | */ | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/param.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/time.h> | ||
19 | #include <linux/adb.h> | ||
20 | #include <linux/cuda.h> | ||
21 | #include <linux/pmu.h> | ||
22 | #include <linux/hardirq.h> | ||
23 | |||
24 | #include <asm/sections.h> | ||
25 | #include <asm/prom.h> | ||
26 | #include <asm/system.h> | ||
27 | #include <asm/io.h> | ||
28 | #include <asm/pgtable.h> | ||
29 | #include <asm/machdep.h> | ||
30 | #include <asm/time.h> | ||
31 | #include <asm/nvram.h> | ||
32 | |||
33 | /* Apparently the RTC stores seconds since 1 Jan 1904 */ | ||
34 | #define RTC_OFFSET 2082844800 | ||
35 | |||
36 | /* | ||
37 | * Calibrate the decrementer frequency with the VIA timer 1. | ||
38 | */ | ||
39 | #define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */ | ||
40 | |||
41 | /* VIA registers */ | ||
42 | #define RS 0x200 /* skip between registers */ | ||
43 | #define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */ | ||
44 | #define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */ | ||
45 | #define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */ | ||
46 | #define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */ | ||
47 | #define ACR (11*RS) /* Auxiliary control register */ | ||
48 | #define IFR (13*RS) /* Interrupt flag register */ | ||
49 | |||
50 | /* Bits in ACR */ | ||
51 | #define T1MODE 0xc0 /* Timer 1 mode */ | ||
52 | #define T1MODE_CONT 0x40 /* continuous interrupts */ | ||
53 | |||
54 | /* Bits in IFR and IER */ | ||
55 | #define T1_INT 0x40 /* Timer 1 interrupt */ | ||
56 | |||
57 | extern struct timezone sys_tz; | ||
58 | |||
59 | long __init | ||
60 | pmac_time_init(void) | ||
61 | { | ||
62 | #ifdef CONFIG_NVRAM | ||
63 | s32 delta = 0; | ||
64 | int dst; | ||
65 | |||
66 | delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16; | ||
67 | delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8; | ||
68 | delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb); | ||
69 | if (delta & 0x00800000UL) | ||
70 | delta |= 0xFF000000UL; | ||
71 | dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0); | ||
72 | printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60, | ||
73 | dst ? "on" : "off"); | ||
74 | return delta; | ||
75 | #else | ||
76 | return 0; | ||
77 | #endif | ||
78 | } | ||
79 | |||
80 | unsigned long | ||
81 | pmac_get_rtc_time(void) | ||
82 | { | ||
83 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) | ||
84 | struct adb_request req; | ||
85 | unsigned long now; | ||
86 | #endif | ||
87 | |||
88 | /* Get the time from the RTC */ | ||
89 | switch (sys_ctrler) { | ||
90 | #ifdef CONFIG_ADB_CUDA | ||
91 | case SYS_CTRLER_CUDA: | ||
92 | if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0) | ||
93 | return 0; | ||
94 | while (!req.complete) | ||
95 | cuda_poll(); | ||
96 | if (req.reply_len != 7) | ||
97 | printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n", | ||
98 | req.reply_len); | ||
99 | now = (req.reply[3] << 24) + (req.reply[4] << 16) | ||
100 | + (req.reply[5] << 8) + req.reply[6]; | ||
101 | return now - RTC_OFFSET; | ||
102 | #endif /* CONFIG_ADB_CUDA */ | ||
103 | #ifdef CONFIG_ADB_PMU | ||
104 | case SYS_CTRLER_PMU: | ||
105 | if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) | ||
106 | return 0; | ||
107 | while (!req.complete) | ||
108 | pmu_poll(); | ||
109 | if (req.reply_len != 4) | ||
110 | printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n", | ||
111 | req.reply_len); | ||
112 | now = (req.reply[0] << 24) + (req.reply[1] << 16) | ||
113 | + (req.reply[2] << 8) + req.reply[3]; | ||
114 | return now - RTC_OFFSET; | ||
115 | #endif /* CONFIG_ADB_PMU */ | ||
116 | default: ; | ||
117 | } | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | int | ||
122 | pmac_set_rtc_time(unsigned long nowtime) | ||
123 | { | ||
124 | #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) | ||
125 | struct adb_request req; | ||
126 | #endif | ||
127 | |||
128 | nowtime += RTC_OFFSET; | ||
129 | |||
130 | switch (sys_ctrler) { | ||
131 | #ifdef CONFIG_ADB_CUDA | ||
132 | case SYS_CTRLER_CUDA: | ||
133 | if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, | ||
134 | nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) | ||
135 | return 0; | ||
136 | while (!req.complete) | ||
137 | cuda_poll(); | ||
138 | if ((req.reply_len != 3) && (req.reply_len != 7)) | ||
139 | printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n", | ||
140 | req.reply_len); | ||
141 | return 1; | ||
142 | #endif /* CONFIG_ADB_CUDA */ | ||
143 | #ifdef CONFIG_ADB_PMU | ||
144 | case SYS_CTRLER_PMU: | ||
145 | if (pmu_request(&req, NULL, 5, PMU_SET_RTC, | ||
146 | nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) | ||
147 | return 0; | ||
148 | while (!req.complete) | ||
149 | pmu_poll(); | ||
150 | if (req.reply_len != 0) | ||
151 | printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n", | ||
152 | req.reply_len); | ||
153 | return 1; | ||
154 | #endif /* CONFIG_ADB_PMU */ | ||
155 | default: | ||
156 | return 0; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * Calibrate the decrementer register using VIA timer 1. | ||
162 | * This is used both on powermacs and CHRP machines. | ||
163 | */ | ||
164 | int __init | ||
165 | via_calibrate_decr(void) | ||
166 | { | ||
167 | struct device_node *vias; | ||
168 | volatile unsigned char __iomem *via; | ||
169 | int count = VIA_TIMER_FREQ_6 / 100; | ||
170 | unsigned int dstart, dend; | ||
171 | |||
172 | vias = find_devices("via-cuda"); | ||
173 | if (vias == 0) | ||
174 | vias = find_devices("via-pmu"); | ||
175 | if (vias == 0) | ||
176 | vias = find_devices("via"); | ||
177 | if (vias == 0 || vias->n_addrs == 0) | ||
178 | return 0; | ||
179 | via = ioremap(vias->addrs[0].address, vias->addrs[0].size); | ||
180 | |||
181 | /* set timer 1 for continuous interrupts */ | ||
182 | out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT); | ||
183 | /* set the counter to a small value */ | ||
184 | out_8(&via[T1CH], 2); | ||
185 | /* set the latch to `count' */ | ||
186 | out_8(&via[T1LL], count); | ||
187 | out_8(&via[T1LH], count >> 8); | ||
188 | /* wait until it hits 0 */ | ||
189 | while ((in_8(&via[IFR]) & T1_INT) == 0) | ||
190 | ; | ||
191 | dstart = get_dec(); | ||
192 | /* clear the interrupt & wait until it hits 0 again */ | ||
193 | in_8(&via[T1CL]); | ||
194 | while ((in_8(&via[IFR]) & T1_INT) == 0) | ||
195 | ; | ||
196 | dend = get_dec(); | ||
197 | |||
198 | tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100); | ||
199 | tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); | ||
200 | |||
201 | printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", | ||
202 | tb_ticks_per_jiffy, dstart - dend); | ||
203 | |||
204 | iounmap(via); | ||
205 | |||
206 | return 1; | ||
207 | } | ||
208 | |||
209 | #ifdef CONFIG_PM | ||
210 | /* | ||
211 | * Reset the time after a sleep. | ||
212 | */ | ||
213 | static int | ||
214 | time_sleep_notify(struct pmu_sleep_notifier *self, int when) | ||
215 | { | ||
216 | static unsigned long time_diff; | ||
217 | unsigned long flags; | ||
218 | unsigned long seq; | ||
219 | |||
220 | switch (when) { | ||
221 | case PBOOK_SLEEP_NOW: | ||
222 | do { | ||
223 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
224 | time_diff = xtime.tv_sec - pmac_get_rtc_time(); | ||
225 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
226 | break; | ||
227 | case PBOOK_WAKE: | ||
228 | write_seqlock_irqsave(&xtime_lock, flags); | ||
229 | xtime.tv_sec = pmac_get_rtc_time() + time_diff; | ||
230 | xtime.tv_nsec = 0; | ||
231 | last_rtc_update = xtime.tv_sec; | ||
232 | write_sequnlock_irqrestore(&xtime_lock, flags); | ||
233 | break; | ||
234 | } | ||
235 | return PBOOK_SLEEP_OK; | ||
236 | } | ||
237 | |||
238 | static struct pmu_sleep_notifier time_sleep_notifier = { | ||
239 | time_sleep_notify, SLEEP_LEVEL_MISC, | ||
240 | }; | ||
241 | #endif /* CONFIG_PM */ | ||
242 | |||
243 | /* | ||
244 | * Query the OF and get the decr frequency. | ||
245 | * This was taken from the pmac time_init() when merging the prep/pmac | ||
246 | * time functions. | ||
247 | */ | ||
248 | void __init | ||
249 | pmac_calibrate_decr(void) | ||
250 | { | ||
251 | struct device_node *cpu; | ||
252 | unsigned int freq, *fp; | ||
253 | |||
254 | #ifdef CONFIG_PM | ||
255 | pmu_register_sleep_notifier(&time_sleep_notifier); | ||
256 | #endif /* CONFIG_PM */ | ||
257 | |||
258 | /* We assume MacRISC2 machines have correct device-tree | ||
259 | * calibration. That's better since the VIA itself seems | ||
260 | * to be slightly off. --BenH | ||
261 | */ | ||
262 | if (!machine_is_compatible("MacRISC2") && | ||
263 | !machine_is_compatible("MacRISC3") && | ||
264 | !machine_is_compatible("MacRISC4")) | ||
265 | if (via_calibrate_decr()) | ||
266 | return; | ||
267 | |||
268 | /* Special case: QuickSilver G4s seem to have a badly calibrated | ||
269 | * timebase-frequency in OF, VIA is much better on these. We should | ||
270 | * probably implement calibration based on the KL timer on these | ||
271 | * machines anyway... -BenH | ||
272 | */ | ||
273 | if (machine_is_compatible("PowerMac3,5")) | ||
274 | if (via_calibrate_decr()) | ||
275 | return; | ||
276 | /* | ||
277 | * The cpu node should have a timebase-frequency property | ||
278 | * to tell us the rate at which the decrementer counts. | ||
279 | */ | ||
280 | cpu = find_type_devices("cpu"); | ||
281 | if (cpu == 0) | ||
282 | panic("can't find cpu node in time_init"); | ||
283 | fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL); | ||
284 | if (fp == 0) | ||
285 | panic("can't get cpu timebase frequency"); | ||
286 | freq = *fp; | ||
287 | printk("time_init: decrementer frequency = %u.%.6u MHz\n", | ||
288 | freq/1000000, freq%1000000); | ||
289 | tb_ticks_per_jiffy = freq / HZ; | ||
290 | tb_to_us = mulhwu_scale_factor(freq, 1000000); | ||
291 | } | ||
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 84ef03018d0e..159dcd92a6d1 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile | |||
@@ -39,8 +39,6 @@ obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \ | |||
39 | ppc_sys.o mpc8xx_devices.o mpc8xx_sys.o | 39 | ppc_sys.o mpc8xx_devices.o mpc8xx_sys.o |
40 | obj-$(CONFIG_PCI_QSPAN) += qspan_pci.o | 40 | obj-$(CONFIG_PCI_QSPAN) += qspan_pci.o |
41 | obj-$(CONFIG_PPC_OF) += prom_init.o prom.o | 41 | obj-$(CONFIG_PPC_OF) += prom_init.o prom.o |
42 | obj-$(CONFIG_PPC_PMAC) += open_pic.o | ||
43 | obj-$(CONFIG_POWER4) += open_pic2.o | ||
44 | obj-$(CONFIG_PPC_CHRP) += open_pic.o | 42 | obj-$(CONFIG_PPC_CHRP) += open_pic.o |
45 | obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o | 43 | obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o |
46 | obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o | 44 | obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o |
diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c index af4deace49e0..482f837fd373 100644 --- a/arch/ppc/syslib/prom.c +++ b/arch/ppc/syslib/prom.c | |||
@@ -70,8 +70,6 @@ int use_of_interrupt_tree; | |||
70 | struct device_node *dflt_interrupt_controller; | 70 | struct device_node *dflt_interrupt_controller; |
71 | int num_interrupt_controllers; | 71 | int num_interrupt_controllers; |
72 | 72 | ||
73 | int pmac_newworld; | ||
74 | |||
75 | extern unsigned int rtas_entry; /* physical pointer */ | 73 | extern unsigned int rtas_entry; /* physical pointer */ |
76 | 74 | ||
77 | extern struct device_node *allnodes; | 75 | extern struct device_node *allnodes; |
@@ -123,22 +121,13 @@ finish_device_tree(void) | |||
123 | unsigned long mem = (unsigned long) klimit; | 121 | unsigned long mem = (unsigned long) klimit; |
124 | struct device_node *np; | 122 | struct device_node *np; |
125 | 123 | ||
126 | /* All newworld pmac machines and CHRPs now use the interrupt tree */ | 124 | /* All CHRPs now use the interrupt tree */ |
127 | for (np = allnodes; np != NULL; np = np->allnext) { | 125 | for (np = allnodes; np != NULL; np = np->allnext) { |
128 | if (get_property(np, "interrupt-parent", NULL)) { | 126 | if (get_property(np, "interrupt-parent", NULL)) { |
129 | use_of_interrupt_tree = 1; | 127 | use_of_interrupt_tree = 1; |
130 | break; | 128 | break; |
131 | } | 129 | } |
132 | } | 130 | } |
133 | if (_machine == _MACH_Pmac && use_of_interrupt_tree) | ||
134 | pmac_newworld = 1; | ||
135 | |||
136 | #ifdef CONFIG_BOOTX_TEXT | ||
137 | if (boot_infos && pmac_newworld) { | ||
138 | prom_print("WARNING ! BootX/miBoot booting is not supported on this machine\n"); | ||
139 | prom_print(" You should use an Open Firmware bootloader\n"); | ||
140 | } | ||
141 | #endif /* CONFIG_BOOTX_TEXT */ | ||
142 | 131 | ||
143 | if (use_of_interrupt_tree) { | 132 | if (use_of_interrupt_tree) { |
144 | /* | 133 | /* |
@@ -434,16 +423,10 @@ finish_node_interrupts(struct device_node *np, unsigned long mem_start) | |||
434 | * those machines, we want to offset interrupts from the | 423 | * those machines, we want to offset interrupts from the |
435 | * second openpic by 128 -- BenH | 424 | * second openpic by 128 -- BenH |
436 | */ | 425 | */ |
437 | if (_machine != _MACH_Pmac && num_interrupt_controllers > 1 | 426 | if (num_interrupt_controllers > 1 |
438 | && ic != NULL | 427 | && ic != NULL |
439 | && get_property(ic, "interrupt-parent", NULL) == NULL) | 428 | && get_property(ic, "interrupt-parent", NULL) == NULL) |
440 | offset = 16; | 429 | offset = 16; |
441 | else if (_machine == _MACH_Pmac && num_interrupt_controllers > 1 | ||
442 | && ic != NULL && ic->parent != NULL) { | ||
443 | char *name = get_property(ic->parent, "name", NULL); | ||
444 | if (name && !strcmp(name, "u3")) | ||
445 | offset = 128; | ||
446 | } | ||
447 | 430 | ||
448 | np->intrs[i].line = irq[0] + offset; | 431 | np->intrs[i].line = irq[0] + offset; |
449 | if (n > 1) | 432 | if (n > 1) |
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c index c80177f8ec04..4344cbe9b5c5 100644 --- a/arch/ppc/xmon/start.c +++ b/arch/ppc/xmon/start.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/bootx.h> | 18 | #include <asm/bootx.h> |
19 | #include <asm/machdep.h> | 19 | #include <asm/machdep.h> |
20 | #include <asm/errno.h> | 20 | #include <asm/errno.h> |
21 | #include <asm/pmac_feature.h> | ||
22 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
23 | #include <asm/delay.h> | 22 | #include <asm/delay.h> |
24 | #include <asm/btext.h> | 23 | #include <asm/btext.h> |
@@ -27,11 +26,9 @@ static volatile unsigned char *sccc, *sccd; | |||
27 | unsigned int TXRDY, RXRDY, DLAB; | 26 | unsigned int TXRDY, RXRDY, DLAB; |
28 | static int xmon_expect(const char *str, unsigned int timeout); | 27 | static int xmon_expect(const char *str, unsigned int timeout); |
29 | 28 | ||
30 | static int use_serial; | ||
31 | static int use_screen; | 29 | static int use_screen; |
32 | static int via_modem; | 30 | static int via_modem; |
33 | static int xmon_use_sccb; | 31 | static int xmon_use_sccb; |
34 | static struct device_node *channel_node; | ||
35 | 32 | ||
36 | #define TB_SPEED 25000000 | 33 | #define TB_SPEED 25000000 |
37 | 34 | ||
@@ -112,96 +109,21 @@ xmon_map_scc(void) | |||
112 | #ifdef CONFIG_PPC_MULTIPLATFORM | 109 | #ifdef CONFIG_PPC_MULTIPLATFORM |
113 | volatile unsigned char *base; | 110 | volatile unsigned char *base; |
114 | 111 | ||
115 | if (_machine == _MACH_Pmac) { | ||
116 | struct device_node *np; | ||
117 | unsigned long addr; | ||
118 | #ifdef CONFIG_BOOTX_TEXT | ||
119 | if (!use_screen && !use_serial | ||
120 | && !machine_is_compatible("iMac")) { | ||
121 | /* see if there is a keyboard in the device tree | ||
122 | with a parent of type "adb" */ | ||
123 | for (np = find_devices("keyboard"); np; np = np->next) | ||
124 | if (np->parent && np->parent->type | ||
125 | && strcmp(np->parent->type, "adb") == 0) | ||
126 | break; | ||
127 | |||
128 | /* needs to be hacked if xmon_printk is to be used | ||
129 | from within find_via_pmu() */ | ||
130 | #ifdef CONFIG_ADB_PMU | ||
131 | if (np != NULL && boot_text_mapped && find_via_pmu()) | ||
132 | use_screen = 1; | ||
133 | #endif | ||
134 | #ifdef CONFIG_ADB_CUDA | ||
135 | if (np != NULL && boot_text_mapped && find_via_cuda()) | ||
136 | use_screen = 1; | ||
137 | #endif | ||
138 | } | ||
139 | if (!use_screen && (np = find_devices("escc")) != NULL) { | ||
140 | /* | ||
141 | * look for the device node for the serial port | ||
142 | * we're using and see if it says it has a modem | ||
143 | */ | ||
144 | char *name = xmon_use_sccb? "ch-b": "ch-a"; | ||
145 | char *slots; | ||
146 | int l; | ||
147 | |||
148 | np = np->child; | ||
149 | while (np != NULL && strcmp(np->name, name) != 0) | ||
150 | np = np->sibling; | ||
151 | if (np != NULL) { | ||
152 | /* XXX should parse this properly */ | ||
153 | channel_node = np; | ||
154 | slots = get_property(np, "slot-names", &l); | ||
155 | if (slots != NULL && l >= 10 | ||
156 | && strcmp(slots+4, "Modem") == 0) | ||
157 | via_modem = 1; | ||
158 | } | ||
159 | } | ||
160 | btext_drawstring("xmon uses "); | ||
161 | if (use_screen) | ||
162 | btext_drawstring("screen and keyboard\n"); | ||
163 | else { | ||
164 | if (via_modem) | ||
165 | btext_drawstring("modem on "); | ||
166 | btext_drawstring(xmon_use_sccb? "printer": "modem"); | ||
167 | btext_drawstring(" port\n"); | ||
168 | } | ||
169 | |||
170 | #endif /* CONFIG_BOOTX_TEXT */ | ||
171 | |||
172 | #ifdef CHRP_ESCC | ||
173 | addr = 0xc1013020; | ||
174 | #else | ||
175 | addr = 0xf3013020; | ||
176 | #endif | ||
177 | TXRDY = 4; | ||
178 | RXRDY = 1; | ||
179 | |||
180 | np = find_devices("mac-io"); | ||
181 | if (np && np->n_addrs) | ||
182 | addr = np->addrs[0].address + 0x13020; | ||
183 | base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE); | ||
184 | sccc = base + (addr & ~PAGE_MASK); | ||
185 | sccd = sccc + 0x10; | ||
186 | |||
187 | } | ||
188 | #ifdef CONFIG_PPC_CHRP | 112 | #ifdef CONFIG_PPC_CHRP |
189 | else { | 113 | base = (volatile unsigned char *) isa_io_base; |
190 | base = (volatile unsigned char *) isa_io_base; | 114 | if (_machine == _MACH_chrp) |
191 | if (_machine == _MACH_chrp) | 115 | base = (volatile unsigned char *) |
192 | base = (volatile unsigned char *) | 116 | ioremap(chrp_find_phys_io_base(), 0x1000); |
193 | ioremap(chrp_find_phys_io_base(), 0x1000); | 117 | |
194 | 118 | sccc = base + 0x3fd; | |
195 | sccc = base + 0x3fd; | 119 | sccd = base + 0x3f8; |
196 | sccd = base + 0x3f8; | 120 | if (xmon_use_sccb) { |
197 | if (xmon_use_sccb) { | 121 | sccc -= 0x100; |
198 | sccc -= 0x100; | 122 | sccd -= 0x100; |
199 | sccd -= 0x100; | ||
200 | } | ||
201 | TXRDY = 0x20; | ||
202 | RXRDY = 1; | ||
203 | DLAB = 0x80; | ||
204 | } | 123 | } |
124 | TXRDY = 0x20; | ||
125 | RXRDY = 1; | ||
126 | DLAB = 0x80; | ||
205 | #endif /* CONFIG_PPC_CHRP */ | 127 | #endif /* CONFIG_PPC_CHRP */ |
206 | #elif defined(CONFIG_GEMINI) | 128 | #elif defined(CONFIG_GEMINI) |
207 | /* should already be mapped by the kernel boot */ | 129 | /* should already be mapped by the kernel boot */ |
@@ -385,16 +307,6 @@ xmon_read_poll(void) | |||
385 | return *sccd; | 307 | return *sccd; |
386 | } | 308 | } |
387 | 309 | ||
388 | static unsigned char scc_inittab[] = { | ||
389 | 13, 0, /* set baud rate divisor */ | ||
390 | 12, 1, | ||
391 | 14, 1, /* baud rate gen enable, src=rtxc */ | ||
392 | 11, 0x50, /* clocks = br gen */ | ||
393 | 5, 0xea, /* tx 8 bits, assert DTR & RTS */ | ||
394 | 4, 0x46, /* x16 clock, 1 stop */ | ||
395 | 3, 0xc1, /* rx enable, 8 bits */ | ||
396 | }; | ||
397 | |||
398 | void | 310 | void |
399 | xmon_init_scc(void) | 311 | xmon_init_scc(void) |
400 | { | 312 | { |
@@ -407,43 +319,6 @@ xmon_init_scc(void) | |||
407 | sccd[3] = 3; eieio(); /* LCR = 8N1 */ | 319 | sccd[3] = 3; eieio(); /* LCR = 8N1 */ |
408 | sccd[1] = 0; eieio(); /* IER = 0 */ | 320 | sccd[1] = 0; eieio(); /* IER = 0 */ |
409 | } | 321 | } |
410 | else if ( _machine == _MACH_Pmac ) | ||
411 | { | ||
412 | int i, x; | ||
413 | |||
414 | if (channel_node != 0) | ||
415 | pmac_call_feature( | ||
416 | PMAC_FTR_SCC_ENABLE, | ||
417 | channel_node, | ||
418 | PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1); | ||
419 | printk(KERN_INFO "Serial port locked ON by debugger !\n"); | ||
420 | if (via_modem && channel_node != 0) { | ||
421 | unsigned int t0; | ||
422 | |||
423 | pmac_call_feature( | ||
424 | PMAC_FTR_MODEM_ENABLE, | ||
425 | channel_node, 0, 1); | ||
426 | printk(KERN_INFO "Modem powered up by debugger !\n"); | ||
427 | t0 = readtb(); | ||
428 | while (readtb() - t0 < 3*TB_SPEED) | ||
429 | eieio(); | ||
430 | } | ||
431 | /* use the B channel if requested */ | ||
432 | if (xmon_use_sccb) { | ||
433 | sccc = (volatile unsigned char *) | ||
434 | ((unsigned long)sccc & ~0x20); | ||
435 | sccd = sccc + 0x10; | ||
436 | } | ||
437 | for (i = 20000; i != 0; --i) { | ||
438 | x = *sccc; eieio(); | ||
439 | } | ||
440 | *sccc = 9; eieio(); /* reset A or B side */ | ||
441 | *sccc = ((unsigned long)sccc & 0x20)? 0x80: 0x40; eieio(); | ||
442 | for (i = 0; i < sizeof(scc_inittab); ++i) { | ||
443 | *sccc = scc_inittab[i]; | ||
444 | eieio(); | ||
445 | } | ||
446 | } | ||
447 | scc_initialized = 1; | 322 | scc_initialized = 1; |
448 | if (via_modem) { | 323 | if (via_modem) { |
449 | for (;;) { | 324 | for (;;) { |
@@ -632,19 +507,9 @@ xmon_fgets(char *str, int nb, void *f) | |||
632 | void | 507 | void |
633 | xmon_enter(void) | 508 | xmon_enter(void) |
634 | { | 509 | { |
635 | #ifdef CONFIG_ADB_PMU | ||
636 | if (_machine == _MACH_Pmac) { | ||
637 | pmu_suspend(); | ||
638 | } | ||
639 | #endif | ||
640 | } | 510 | } |
641 | 511 | ||
642 | void | 512 | void |
643 | xmon_leave(void) | 513 | xmon_leave(void) |
644 | { | 514 | { |
645 | #ifdef CONFIG_ADB_PMU | ||
646 | if (_machine == _MACH_Pmac) { | ||
647 | pmu_resume(); | ||
648 | } | ||
649 | #endif | ||
650 | } | 515 | } |
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c index 9075a7538e26..bdaf6597b4c2 100644 --- a/arch/ppc/xmon/xmon.c +++ b/arch/ppc/xmon/xmon.c | |||
@@ -16,9 +16,6 @@ | |||
16 | #include <asm/bootx.h> | 16 | #include <asm/bootx.h> |
17 | #include <asm/machdep.h> | 17 | #include <asm/machdep.h> |
18 | #include <asm/xmon.h> | 18 | #include <asm/xmon.h> |
19 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
20 | #include <asm/backlight.h> | ||
21 | #endif | ||
22 | #include "nonstdio.h" | 19 | #include "nonstdio.h" |
23 | #include "privinst.h" | 20 | #include "privinst.h" |
24 | 21 | ||
@@ -260,16 +257,6 @@ int xmon(struct pt_regs *excp) | |||
260 | */ | 257 | */ |
261 | #endif /* CONFIG_SMP */ | 258 | #endif /* CONFIG_SMP */ |
262 | remove_bpts(); | 259 | remove_bpts(); |
263 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
264 | if( setjmp(bus_error_jmp) == 0 ) { | ||
265 | debugger_fault_handler = handle_fault; | ||
266 | sync(); | ||
267 | set_backlight_enable(1); | ||
268 | set_backlight_level(BACKLIGHT_MAX); | ||
269 | sync(); | ||
270 | } | ||
271 | debugger_fault_handler = NULL; | ||
272 | #endif /* CONFIG_PMAC_BACKLIGHT */ | ||
273 | cmd = cmds(excp); | 260 | cmd = cmds(excp); |
274 | if (cmd == 's') { | 261 | if (cmd == 's') { |
275 | xmon_trace[smp_processor_id()] = SSTEP; | 262 | xmon_trace[smp_processor_id()] = SSTEP; |
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 7a1033d8e00f..c5ca2dc5d428 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -114,80 +114,108 @@ static unsigned int aes_encrypt_ecb(const struct cipher_desc *desc, u8 *out, | |||
114 | const u8 *in, unsigned int nbytes) | 114 | const u8 *in, unsigned int nbytes) |
115 | { | 115 | { |
116 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); | 116 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
117 | int ret; | ||
118 | |||
119 | /* only use complete blocks */ | ||
120 | nbytes &= ~(AES_BLOCK_SIZE - 1); | ||
117 | 121 | ||
118 | switch (sctx->key_len) { | 122 | switch (sctx->key_len) { |
119 | case 16: | 123 | case 16: |
120 | crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in, nbytes); | 124 | ret = crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in, nbytes); |
125 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
121 | break; | 126 | break; |
122 | case 24: | 127 | case 24: |
123 | crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in, nbytes); | 128 | ret = crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in, nbytes); |
129 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
124 | break; | 130 | break; |
125 | case 32: | 131 | case 32: |
126 | crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in, nbytes); | 132 | ret = crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in, nbytes); |
133 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
127 | break; | 134 | break; |
128 | } | 135 | } |
129 | return nbytes & ~(AES_BLOCK_SIZE - 1); | 136 | return nbytes; |
130 | } | 137 | } |
131 | 138 | ||
132 | static unsigned int aes_decrypt_ecb(const struct cipher_desc *desc, u8 *out, | 139 | static unsigned int aes_decrypt_ecb(const struct cipher_desc *desc, u8 *out, |
133 | const u8 *in, unsigned int nbytes) | 140 | const u8 *in, unsigned int nbytes) |
134 | { | 141 | { |
135 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); | 142 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
143 | int ret; | ||
144 | |||
145 | /* only use complete blocks */ | ||
146 | nbytes &= ~(AES_BLOCK_SIZE - 1); | ||
136 | 147 | ||
137 | switch (sctx->key_len) { | 148 | switch (sctx->key_len) { |
138 | case 16: | 149 | case 16: |
139 | crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in, nbytes); | 150 | ret = crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in, nbytes); |
151 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
140 | break; | 152 | break; |
141 | case 24: | 153 | case 24: |
142 | crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in, nbytes); | 154 | ret = crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in, nbytes); |
155 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
143 | break; | 156 | break; |
144 | case 32: | 157 | case 32: |
145 | crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in, nbytes); | 158 | ret = crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in, nbytes); |
159 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
146 | break; | 160 | break; |
147 | } | 161 | } |
148 | return nbytes & ~(AES_BLOCK_SIZE - 1); | 162 | return nbytes; |
149 | } | 163 | } |
150 | 164 | ||
151 | static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out, | 165 | static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out, |
152 | const u8 *in, unsigned int nbytes) | 166 | const u8 *in, unsigned int nbytes) |
153 | { | 167 | { |
154 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); | 168 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
169 | int ret; | ||
170 | |||
171 | /* only use complete blocks */ | ||
172 | nbytes &= ~(AES_BLOCK_SIZE - 1); | ||
155 | 173 | ||
156 | memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE); | 174 | memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE); |
157 | switch (sctx->key_len) { | 175 | switch (sctx->key_len) { |
158 | case 16: | 176 | case 16: |
159 | crypt_s390_kmc(KMC_AES_128_ENCRYPT, &sctx->iv, out, in, nbytes); | 177 | ret = crypt_s390_kmc(KMC_AES_128_ENCRYPT, &sctx->iv, out, in, nbytes); |
178 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
160 | break; | 179 | break; |
161 | case 24: | 180 | case 24: |
162 | crypt_s390_kmc(KMC_AES_192_ENCRYPT, &sctx->iv, out, in, nbytes); | 181 | ret = crypt_s390_kmc(KMC_AES_192_ENCRYPT, &sctx->iv, out, in, nbytes); |
182 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
163 | break; | 183 | break; |
164 | case 32: | 184 | case 32: |
165 | crypt_s390_kmc(KMC_AES_256_ENCRYPT, &sctx->iv, out, in, nbytes); | 185 | ret = crypt_s390_kmc(KMC_AES_256_ENCRYPT, &sctx->iv, out, in, nbytes); |
186 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
166 | break; | 187 | break; |
167 | } | 188 | } |
168 | memcpy(desc->info, &sctx->iv, AES_BLOCK_SIZE); | 189 | memcpy(desc->info, &sctx->iv, AES_BLOCK_SIZE); |
169 | 190 | ||
170 | return nbytes & ~(AES_BLOCK_SIZE - 1); | 191 | return nbytes; |
171 | } | 192 | } |
172 | 193 | ||
173 | static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out, | 194 | static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out, |
174 | const u8 *in, unsigned int nbytes) | 195 | const u8 *in, unsigned int nbytes) |
175 | { | 196 | { |
176 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); | 197 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
198 | int ret; | ||
199 | |||
200 | /* only use complete blocks */ | ||
201 | nbytes &= ~(AES_BLOCK_SIZE - 1); | ||
177 | 202 | ||
178 | memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE); | 203 | memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE); |
179 | switch (sctx->key_len) { | 204 | switch (sctx->key_len) { |
180 | case 16: | 205 | case 16: |
181 | crypt_s390_kmc(KMC_AES_128_DECRYPT, &sctx->iv, out, in, nbytes); | 206 | ret = crypt_s390_kmc(KMC_AES_128_DECRYPT, &sctx->iv, out, in, nbytes); |
207 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
182 | break; | 208 | break; |
183 | case 24: | 209 | case 24: |
184 | crypt_s390_kmc(KMC_AES_192_DECRYPT, &sctx->iv, out, in, nbytes); | 210 | ret = crypt_s390_kmc(KMC_AES_192_DECRYPT, &sctx->iv, out, in, nbytes); |
211 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
185 | break; | 212 | break; |
186 | case 32: | 213 | case 32: |
187 | crypt_s390_kmc(KMC_AES_256_DECRYPT, &sctx->iv, out, in, nbytes); | 214 | ret = crypt_s390_kmc(KMC_AES_256_DECRYPT, &sctx->iv, out, in, nbytes); |
215 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
188 | break; | 216 | break; |
189 | } | 217 | } |
190 | return nbytes & ~(AES_BLOCK_SIZE - 1); | 218 | return nbytes; |
191 | } | 219 | } |
192 | 220 | ||
193 | 221 | ||
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index a38bb2a3eef6..e3c37aa0a199 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -15,10 +15,8 @@ | |||
15 | */ | 15 | */ |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/mm.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <asm/scatterlist.h> | ||
21 | #include <linux/crypto.h> | 18 | #include <linux/crypto.h> |
19 | |||
22 | #include "crypt_s390.h" | 20 | #include "crypt_s390.h" |
23 | #include "crypto_des.h" | 21 | #include "crypto_des.h" |
24 | 22 | ||
@@ -46,38 +44,92 @@ struct crypt_s390_des3_192_ctx { | |||
46 | u8 key[DES3_192_KEY_SIZE]; | 44 | u8 key[DES3_192_KEY_SIZE]; |
47 | }; | 45 | }; |
48 | 46 | ||
49 | static int | 47 | static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, |
50 | des_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) | 48 | u32 *flags) |
51 | { | 49 | { |
52 | struct crypt_s390_des_ctx *dctx; | 50 | struct crypt_s390_des_ctx *dctx = ctx; |
53 | int ret; | 51 | int ret; |
54 | 52 | ||
55 | dctx = ctx; | 53 | /* test if key is valid (not a weak key) */ |
56 | //test if key is valid (not a weak key) | ||
57 | ret = crypto_des_check_key(key, keylen, flags); | 54 | ret = crypto_des_check_key(key, keylen, flags); |
58 | if (ret == 0){ | 55 | if (ret == 0) |
59 | memcpy(dctx->key, key, keylen); | 56 | memcpy(dctx->key, key, keylen); |
60 | } | ||
61 | return ret; | 57 | return ret; |
62 | } | 58 | } |
63 | 59 | ||
60 | static void des_encrypt(void *ctx, u8 *out, const u8 *in) | ||
61 | { | ||
62 | struct crypt_s390_des_ctx *dctx = ctx; | ||
63 | |||
64 | crypt_s390_km(KM_DEA_ENCRYPT, dctx->key, out, in, DES_BLOCK_SIZE); | ||
65 | } | ||
66 | |||
67 | static void des_decrypt(void *ctx, u8 *out, const u8 *in) | ||
68 | { | ||
69 | struct crypt_s390_des_ctx *dctx = ctx; | ||
70 | |||
71 | crypt_s390_km(KM_DEA_DECRYPT, dctx->key, out, in, DES_BLOCK_SIZE); | ||
72 | } | ||
73 | |||
74 | static unsigned int des_encrypt_ecb(const struct cipher_desc *desc, u8 *out, | ||
75 | const u8 *in, unsigned int nbytes) | ||
76 | { | ||
77 | struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
78 | int ret; | ||
79 | |||
80 | /* only use complete blocks */ | ||
81 | nbytes &= ~(DES_BLOCK_SIZE - 1); | ||
82 | ret = crypt_s390_km(KM_DEA_ENCRYPT, sctx->key, out, in, nbytes); | ||
83 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
84 | |||
85 | return nbytes; | ||
86 | } | ||
64 | 87 | ||
65 | static void | 88 | static unsigned int des_decrypt_ecb(const struct cipher_desc *desc, u8 *out, |
66 | des_encrypt(void *ctx, u8 *dst, const u8 *src) | 89 | const u8 *in, unsigned int nbytes) |
67 | { | 90 | { |
68 | struct crypt_s390_des_ctx *dctx; | 91 | struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
92 | int ret; | ||
93 | |||
94 | /* only use complete blocks */ | ||
95 | nbytes &= ~(DES_BLOCK_SIZE - 1); | ||
96 | ret = crypt_s390_km(KM_DEA_DECRYPT, sctx->key, out, in, nbytes); | ||
97 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
69 | 98 | ||
70 | dctx = ctx; | 99 | return nbytes; |
71 | crypt_s390_km(KM_DEA_ENCRYPT, dctx->key, dst, src, DES_BLOCK_SIZE); | ||
72 | } | 100 | } |
73 | 101 | ||
74 | static void | 102 | static unsigned int des_encrypt_cbc(const struct cipher_desc *desc, u8 *out, |
75 | des_decrypt(void *ctx, u8 *dst, const u8 *src) | 103 | const u8 *in, unsigned int nbytes) |
76 | { | 104 | { |
77 | struct crypt_s390_des_ctx *dctx; | 105 | struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm); |
106 | int ret; | ||
78 | 107 | ||
79 | dctx = ctx; | 108 | /* only use complete blocks */ |
80 | crypt_s390_km(KM_DEA_DECRYPT, dctx->key, dst, src, DES_BLOCK_SIZE); | 109 | nbytes &= ~(DES_BLOCK_SIZE - 1); |
110 | |||
111 | memcpy(sctx->iv, desc->info, DES_BLOCK_SIZE); | ||
112 | ret = crypt_s390_kmc(KMC_DEA_ENCRYPT, &sctx->iv, out, in, nbytes); | ||
113 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
114 | |||
115 | memcpy(desc->info, sctx->iv, DES_BLOCK_SIZE); | ||
116 | return nbytes; | ||
117 | } | ||
118 | |||
119 | static unsigned int des_decrypt_cbc(const struct cipher_desc *desc, u8 *out, | ||
120 | const u8 *in, unsigned int nbytes) | ||
121 | { | ||
122 | struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
123 | int ret; | ||
124 | |||
125 | /* only use complete blocks */ | ||
126 | nbytes &= ~(DES_BLOCK_SIZE - 1); | ||
127 | |||
128 | memcpy(&sctx->iv, desc->info, DES_BLOCK_SIZE); | ||
129 | ret = crypt_s390_kmc(KMC_DEA_DECRYPT, &sctx->iv, out, in, nbytes); | ||
130 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
131 | |||
132 | return nbytes; | ||
81 | } | 133 | } |
82 | 134 | ||
83 | static struct crypto_alg des_alg = { | 135 | static struct crypto_alg des_alg = { |
@@ -87,12 +139,19 @@ static struct crypto_alg des_alg = { | |||
87 | .cra_ctxsize = sizeof(struct crypt_s390_des_ctx), | 139 | .cra_ctxsize = sizeof(struct crypt_s390_des_ctx), |
88 | .cra_module = THIS_MODULE, | 140 | .cra_module = THIS_MODULE, |
89 | .cra_list = LIST_HEAD_INIT(des_alg.cra_list), | 141 | .cra_list = LIST_HEAD_INIT(des_alg.cra_list), |
90 | .cra_u = { .cipher = { | 142 | .cra_u = { |
91 | .cia_min_keysize = DES_KEY_SIZE, | 143 | .cipher = { |
92 | .cia_max_keysize = DES_KEY_SIZE, | 144 | .cia_min_keysize = DES_KEY_SIZE, |
93 | .cia_setkey = des_setkey, | 145 | .cia_max_keysize = DES_KEY_SIZE, |
94 | .cia_encrypt = des_encrypt, | 146 | .cia_setkey = des_setkey, |
95 | .cia_decrypt = des_decrypt } } | 147 | .cia_encrypt = des_encrypt, |
148 | .cia_decrypt = des_decrypt, | ||
149 | .cia_encrypt_ecb = des_encrypt_ecb, | ||
150 | .cia_decrypt_ecb = des_decrypt_ecb, | ||
151 | .cia_encrypt_cbc = des_encrypt_cbc, | ||
152 | .cia_decrypt_cbc = des_decrypt_cbc, | ||
153 | } | ||
154 | } | ||
96 | }; | 155 | }; |
97 | 156 | ||
98 | /* | 157 | /* |
@@ -107,20 +166,18 @@ static struct crypto_alg des_alg = { | |||
107 | * Implementers MUST reject keys that exhibit this property. | 166 | * Implementers MUST reject keys that exhibit this property. |
108 | * | 167 | * |
109 | */ | 168 | */ |
110 | static int | 169 | static int des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, |
111 | des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) | 170 | u32 *flags) |
112 | { | 171 | { |
113 | int i, ret; | 172 | int i, ret; |
114 | struct crypt_s390_des3_128_ctx *dctx; | 173 | struct crypt_s390_des3_128_ctx *dctx = ctx; |
115 | const u8* temp_key = key; | 174 | const u8* temp_key = key; |
116 | 175 | ||
117 | dctx = ctx; | ||
118 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) { | 176 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) { |
119 | |||
120 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; | 177 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; |
121 | return -EINVAL; | 178 | return -EINVAL; |
122 | } | 179 | } |
123 | for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) { | 180 | for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) { |
124 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); | 181 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); |
125 | if (ret < 0) | 182 | if (ret < 0) |
126 | return ret; | 183 | return ret; |
@@ -129,24 +186,85 @@ des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) | |||
129 | return 0; | 186 | return 0; |
130 | } | 187 | } |
131 | 188 | ||
132 | static void | 189 | static void des3_128_encrypt(void *ctx, u8 *dst, const u8 *src) |
133 | des3_128_encrypt(void *ctx, u8 *dst, const u8 *src) | ||
134 | { | 190 | { |
135 | struct crypt_s390_des3_128_ctx *dctx; | 191 | struct crypt_s390_des3_128_ctx *dctx = ctx; |
136 | 192 | ||
137 | dctx = ctx; | ||
138 | crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src, | 193 | crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src, |
139 | DES3_128_BLOCK_SIZE); | 194 | DES3_128_BLOCK_SIZE); |
140 | } | 195 | } |
141 | 196 | ||
142 | static void | 197 | static void des3_128_decrypt(void *ctx, u8 *dst, const u8 *src) |
143 | des3_128_decrypt(void *ctx, u8 *dst, const u8 *src) | ||
144 | { | 198 | { |
145 | struct crypt_s390_des3_128_ctx *dctx; | 199 | struct crypt_s390_des3_128_ctx *dctx = ctx; |
146 | 200 | ||
147 | dctx = ctx; | ||
148 | crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src, | 201 | crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src, |
149 | DES3_128_BLOCK_SIZE); | 202 | DES3_128_BLOCK_SIZE); |
203 | } | ||
204 | |||
205 | static unsigned int des3_128_encrypt_ecb(const struct cipher_desc *desc, | ||
206 | u8 *out, const u8 *in, | ||
207 | unsigned int nbytes) | ||
208 | { | ||
209 | struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
210 | int ret; | ||
211 | |||
212 | /* only use complete blocks */ | ||
213 | nbytes &= ~(DES3_128_BLOCK_SIZE - 1); | ||
214 | ret = crypt_s390_km(KM_TDEA_128_ENCRYPT, sctx->key, out, in, nbytes); | ||
215 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
216 | |||
217 | return nbytes; | ||
218 | } | ||
219 | |||
220 | static unsigned int des3_128_decrypt_ecb(const struct cipher_desc *desc, | ||
221 | u8 *out, const u8 *in, | ||
222 | unsigned int nbytes) | ||
223 | { | ||
224 | struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
225 | int ret; | ||
226 | |||
227 | /* only use complete blocks */ | ||
228 | nbytes &= ~(DES3_128_BLOCK_SIZE - 1); | ||
229 | ret = crypt_s390_km(KM_TDEA_128_DECRYPT, sctx->key, out, in, nbytes); | ||
230 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
231 | |||
232 | return nbytes; | ||
233 | } | ||
234 | |||
235 | static unsigned int des3_128_encrypt_cbc(const struct cipher_desc *desc, | ||
236 | u8 *out, const u8 *in, | ||
237 | unsigned int nbytes) | ||
238 | { | ||
239 | struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
240 | int ret; | ||
241 | |||
242 | /* only use complete blocks */ | ||
243 | nbytes &= ~(DES3_128_BLOCK_SIZE - 1); | ||
244 | |||
245 | memcpy(sctx->iv, desc->info, DES3_128_BLOCK_SIZE); | ||
246 | ret = crypt_s390_kmc(KMC_TDEA_128_ENCRYPT, &sctx->iv, out, in, nbytes); | ||
247 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
248 | |||
249 | memcpy(desc->info, sctx->iv, DES3_128_BLOCK_SIZE); | ||
250 | return nbytes; | ||
251 | } | ||
252 | |||
253 | static unsigned int des3_128_decrypt_cbc(const struct cipher_desc *desc, | ||
254 | u8 *out, const u8 *in, | ||
255 | unsigned int nbytes) | ||
256 | { | ||
257 | struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
258 | int ret; | ||
259 | |||
260 | /* only use complete blocks */ | ||
261 | nbytes &= ~(DES3_128_BLOCK_SIZE - 1); | ||
262 | |||
263 | memcpy(&sctx->iv, desc->info, DES3_128_BLOCK_SIZE); | ||
264 | ret = crypt_s390_kmc(KMC_TDEA_128_DECRYPT, &sctx->iv, out, in, nbytes); | ||
265 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
266 | |||
267 | return nbytes; | ||
150 | } | 268 | } |
151 | 269 | ||
152 | static struct crypto_alg des3_128_alg = { | 270 | static struct crypto_alg des3_128_alg = { |
@@ -156,12 +274,19 @@ static struct crypto_alg des3_128_alg = { | |||
156 | .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx), | 274 | .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx), |
157 | .cra_module = THIS_MODULE, | 275 | .cra_module = THIS_MODULE, |
158 | .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list), | 276 | .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list), |
159 | .cra_u = { .cipher = { | 277 | .cra_u = { |
160 | .cia_min_keysize = DES3_128_KEY_SIZE, | 278 | .cipher = { |
161 | .cia_max_keysize = DES3_128_KEY_SIZE, | 279 | .cia_min_keysize = DES3_128_KEY_SIZE, |
162 | .cia_setkey = des3_128_setkey, | 280 | .cia_max_keysize = DES3_128_KEY_SIZE, |
163 | .cia_encrypt = des3_128_encrypt, | 281 | .cia_setkey = des3_128_setkey, |
164 | .cia_decrypt = des3_128_decrypt } } | 282 | .cia_encrypt = des3_128_encrypt, |
283 | .cia_decrypt = des3_128_decrypt, | ||
284 | .cia_encrypt_ecb = des3_128_encrypt_ecb, | ||
285 | .cia_decrypt_ecb = des3_128_decrypt_ecb, | ||
286 | .cia_encrypt_cbc = des3_128_encrypt_cbc, | ||
287 | .cia_decrypt_cbc = des3_128_decrypt_cbc, | ||
288 | } | ||
289 | } | ||
165 | }; | 290 | }; |
166 | 291 | ||
167 | /* | 292 | /* |
@@ -177,50 +302,108 @@ static struct crypto_alg des3_128_alg = { | |||
177 | * property. | 302 | * property. |
178 | * | 303 | * |
179 | */ | 304 | */ |
180 | static int | 305 | static int des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, |
181 | des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) | 306 | u32 *flags) |
182 | { | 307 | { |
183 | int i, ret; | 308 | int i, ret; |
184 | struct crypt_s390_des3_192_ctx *dctx; | 309 | struct crypt_s390_des3_192_ctx *dctx = ctx; |
185 | const u8* temp_key; | 310 | const u8* temp_key = key; |
186 | 311 | ||
187 | dctx = ctx; | ||
188 | temp_key = key; | ||
189 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && | 312 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && |
190 | memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], | 313 | memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], |
191 | DES_KEY_SIZE))) { | 314 | DES_KEY_SIZE))) { |
192 | 315 | ||
193 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; | 316 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; |
194 | return -EINVAL; | 317 | return -EINVAL; |
195 | } | 318 | } |
196 | for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) { | 319 | for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) { |
197 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); | 320 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); |
198 | if (ret < 0){ | 321 | if (ret < 0) |
199 | return ret; | 322 | return ret; |
200 | } | ||
201 | } | 323 | } |
202 | memcpy(dctx->key, key, keylen); | 324 | memcpy(dctx->key, key, keylen); |
203 | return 0; | 325 | return 0; |
204 | } | 326 | } |
205 | 327 | ||
206 | static void | 328 | static void des3_192_encrypt(void *ctx, u8 *dst, const u8 *src) |
207 | des3_192_encrypt(void *ctx, u8 *dst, const u8 *src) | ||
208 | { | 329 | { |
209 | struct crypt_s390_des3_192_ctx *dctx; | 330 | struct crypt_s390_des3_192_ctx *dctx = ctx; |
210 | 331 | ||
211 | dctx = ctx; | ||
212 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, | 332 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, |
213 | DES3_192_BLOCK_SIZE); | 333 | DES3_192_BLOCK_SIZE); |
214 | } | 334 | } |
215 | 335 | ||
216 | static void | 336 | static void des3_192_decrypt(void *ctx, u8 *dst, const u8 *src) |
217 | des3_192_decrypt(void *ctx, u8 *dst, const u8 *src) | ||
218 | { | 337 | { |
219 | struct crypt_s390_des3_192_ctx *dctx; | 338 | struct crypt_s390_des3_192_ctx *dctx = ctx; |
220 | 339 | ||
221 | dctx = ctx; | ||
222 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, | 340 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, |
223 | DES3_192_BLOCK_SIZE); | 341 | DES3_192_BLOCK_SIZE); |
342 | } | ||
343 | |||
344 | static unsigned int des3_192_encrypt_ecb(const struct cipher_desc *desc, | ||
345 | u8 *out, const u8 *in, | ||
346 | unsigned int nbytes) | ||
347 | { | ||
348 | struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
349 | int ret; | ||
350 | |||
351 | /* only use complete blocks */ | ||
352 | nbytes &= ~(DES3_192_BLOCK_SIZE - 1); | ||
353 | ret = crypt_s390_km(KM_TDEA_192_ENCRYPT, sctx->key, out, in, nbytes); | ||
354 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
355 | |||
356 | return nbytes; | ||
357 | } | ||
358 | |||
359 | static unsigned int des3_192_decrypt_ecb(const struct cipher_desc *desc, | ||
360 | u8 *out, const u8 *in, | ||
361 | unsigned int nbytes) | ||
362 | { | ||
363 | struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
364 | int ret; | ||
365 | |||
366 | /* only use complete blocks */ | ||
367 | nbytes &= ~(DES3_192_BLOCK_SIZE - 1); | ||
368 | ret = crypt_s390_km(KM_TDEA_192_DECRYPT, sctx->key, out, in, nbytes); | ||
369 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
370 | |||
371 | return nbytes; | ||
372 | } | ||
373 | |||
374 | static unsigned int des3_192_encrypt_cbc(const struct cipher_desc *desc, | ||
375 | u8 *out, const u8 *in, | ||
376 | unsigned int nbytes) | ||
377 | { | ||
378 | struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
379 | int ret; | ||
380 | |||
381 | /* only use complete blocks */ | ||
382 | nbytes &= ~(DES3_192_BLOCK_SIZE - 1); | ||
383 | |||
384 | memcpy(sctx->iv, desc->info, DES3_192_BLOCK_SIZE); | ||
385 | ret = crypt_s390_kmc(KMC_TDEA_192_ENCRYPT, &sctx->iv, out, in, nbytes); | ||
386 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
387 | |||
388 | memcpy(desc->info, sctx->iv, DES3_192_BLOCK_SIZE); | ||
389 | return nbytes; | ||
390 | } | ||
391 | |||
392 | static unsigned int des3_192_decrypt_cbc(const struct cipher_desc *desc, | ||
393 | u8 *out, const u8 *in, | ||
394 | unsigned int nbytes) | ||
395 | { | ||
396 | struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm); | ||
397 | int ret; | ||
398 | |||
399 | /* only use complete blocks */ | ||
400 | nbytes &= ~(DES3_192_BLOCK_SIZE - 1); | ||
401 | |||
402 | memcpy(&sctx->iv, desc->info, DES3_192_BLOCK_SIZE); | ||
403 | ret = crypt_s390_kmc(KMC_TDEA_192_DECRYPT, &sctx->iv, out, in, nbytes); | ||
404 | BUG_ON((ret < 0) || (ret != nbytes)); | ||
405 | |||
406 | return nbytes; | ||
224 | } | 407 | } |
225 | 408 | ||
226 | static struct crypto_alg des3_192_alg = { | 409 | static struct crypto_alg des3_192_alg = { |
@@ -230,44 +413,43 @@ static struct crypto_alg des3_192_alg = { | |||
230 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), | 413 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), |
231 | .cra_module = THIS_MODULE, | 414 | .cra_module = THIS_MODULE, |
232 | .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), | 415 | .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), |
233 | .cra_u = { .cipher = { | 416 | .cra_u = { |
234 | .cia_min_keysize = DES3_192_KEY_SIZE, | 417 | .cipher = { |
235 | .cia_max_keysize = DES3_192_KEY_SIZE, | 418 | .cia_min_keysize = DES3_192_KEY_SIZE, |
236 | .cia_setkey = des3_192_setkey, | 419 | .cia_max_keysize = DES3_192_KEY_SIZE, |
237 | .cia_encrypt = des3_192_encrypt, | 420 | .cia_setkey = des3_192_setkey, |
238 | .cia_decrypt = des3_192_decrypt } } | 421 | .cia_encrypt = des3_192_encrypt, |
422 | .cia_decrypt = des3_192_decrypt, | ||
423 | .cia_encrypt_ecb = des3_192_encrypt_ecb, | ||
424 | .cia_decrypt_ecb = des3_192_decrypt_ecb, | ||
425 | .cia_encrypt_cbc = des3_192_encrypt_cbc, | ||
426 | .cia_decrypt_cbc = des3_192_decrypt_cbc, | ||
427 | } | ||
428 | } | ||
239 | }; | 429 | }; |
240 | 430 | ||
241 | 431 | static int init(void) | |
242 | |||
243 | static int | ||
244 | init(void) | ||
245 | { | 432 | { |
246 | int ret; | 433 | int ret = 0; |
247 | 434 | ||
248 | if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || | 435 | if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || |
249 | !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) || | 436 | !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) || |
250 | !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)){ | 437 | !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) |
251 | return -ENOSYS; | 438 | return -ENOSYS; |
252 | } | ||
253 | 439 | ||
254 | ret = 0; | 440 | ret |= (crypto_register_alg(&des_alg) == 0) ? 0:1; |
255 | ret |= (crypto_register_alg(&des_alg) == 0)? 0:1; | 441 | ret |= (crypto_register_alg(&des3_128_alg) == 0) ? 0:2; |
256 | ret |= (crypto_register_alg(&des3_128_alg) == 0)? 0:2; | 442 | ret |= (crypto_register_alg(&des3_192_alg) == 0) ? 0:4; |
257 | ret |= (crypto_register_alg(&des3_192_alg) == 0)? 0:4; | 443 | if (ret) { |
258 | if (ret){ | ||
259 | crypto_unregister_alg(&des3_192_alg); | 444 | crypto_unregister_alg(&des3_192_alg); |
260 | crypto_unregister_alg(&des3_128_alg); | 445 | crypto_unregister_alg(&des3_128_alg); |
261 | crypto_unregister_alg(&des_alg); | 446 | crypto_unregister_alg(&des_alg); |
262 | return -EEXIST; | 447 | return -EEXIST; |
263 | } | 448 | } |
264 | |||
265 | printk(KERN_INFO "crypt_s390: des_s390 loaded.\n"); | ||
266 | return 0; | 449 | return 0; |
267 | } | 450 | } |
268 | 451 | ||
269 | static void __exit | 452 | static void __exit fini(void) |
270 | fini(void) | ||
271 | { | 453 | { |
272 | crypto_unregister_alg(&des3_192_alg); | 454 | crypto_unregister_alg(&des3_192_alg); |
273 | crypto_unregister_alg(&des3_128_alg); | 455 | crypto_unregister_alg(&des3_128_alg); |
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c index b75bdbd476c7..1ec5e92b3454 100644 --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c | |||
@@ -51,6 +51,7 @@ static void sha256_update(void *ctx, const u8 *data, unsigned int len) | |||
51 | { | 51 | { |
52 | struct s390_sha256_ctx *sctx = ctx; | 52 | struct s390_sha256_ctx *sctx = ctx; |
53 | unsigned int index; | 53 | unsigned int index; |
54 | int ret; | ||
54 | 55 | ||
55 | /* how much is already in the buffer? */ | 56 | /* how much is already in the buffer? */ |
56 | index = sctx->count / 8 & 0x3f; | 57 | index = sctx->count / 8 & 0x3f; |
@@ -58,15 +59,29 @@ static void sha256_update(void *ctx, const u8 *data, unsigned int len) | |||
58 | /* update message bit length */ | 59 | /* update message bit length */ |
59 | sctx->count += len * 8; | 60 | sctx->count += len * 8; |
60 | 61 | ||
61 | /* process one block */ | 62 | if ((index + len) < SHA256_BLOCK_SIZE) |
62 | if ((index + len) >= SHA256_BLOCK_SIZE) { | 63 | goto store; |
64 | |||
65 | /* process one stored block */ | ||
66 | if (index) { | ||
63 | memcpy(sctx->buf + index, data, SHA256_BLOCK_SIZE - index); | 67 | memcpy(sctx->buf + index, data, SHA256_BLOCK_SIZE - index); |
64 | crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf, | 68 | ret = crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf, |
65 | SHA256_BLOCK_SIZE); | 69 | SHA256_BLOCK_SIZE); |
70 | BUG_ON(ret != SHA256_BLOCK_SIZE); | ||
66 | data += SHA256_BLOCK_SIZE - index; | 71 | data += SHA256_BLOCK_SIZE - index; |
67 | len -= SHA256_BLOCK_SIZE - index; | 72 | len -= SHA256_BLOCK_SIZE - index; |
68 | } | 73 | } |
69 | 74 | ||
75 | /* process as many blocks as possible */ | ||
76 | if (len >= SHA256_BLOCK_SIZE) { | ||
77 | ret = crypt_s390_kimd(KIMD_SHA_256, sctx->state, data, | ||
78 | len & ~(SHA256_BLOCK_SIZE - 1)); | ||
79 | BUG_ON(ret != (len & ~(SHA256_BLOCK_SIZE - 1))); | ||
80 | data += ret; | ||
81 | len -= ret; | ||
82 | } | ||
83 | |||
84 | store: | ||
70 | /* anything left? */ | 85 | /* anything left? */ |
71 | if (len) | 86 | if (len) |
72 | memcpy(sctx->buf + index , data, len); | 87 | memcpy(sctx->buf + index , data, len); |
@@ -119,9 +134,9 @@ static struct crypto_alg alg = { | |||
119 | .cra_list = LIST_HEAD_INIT(alg.cra_list), | 134 | .cra_list = LIST_HEAD_INIT(alg.cra_list), |
120 | .cra_u = { .digest = { | 135 | .cra_u = { .digest = { |
121 | .dia_digestsize = SHA256_DIGEST_SIZE, | 136 | .dia_digestsize = SHA256_DIGEST_SIZE, |
122 | .dia_init = sha256_init, | 137 | .dia_init = sha256_init, |
123 | .dia_update = sha256_update, | 138 | .dia_update = sha256_update, |
124 | .dia_final = sha256_final } } | 139 | .dia_final = sha256_final } } |
125 | }; | 140 | }; |
126 | 141 | ||
127 | static int init(void) | 142 | static int init(void) |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 2ff90a1a1056..008c74526fd3 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -58,10 +58,18 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); | |||
58 | */ | 58 | */ |
59 | unsigned long thread_saved_pc(struct task_struct *tsk) | 59 | unsigned long thread_saved_pc(struct task_struct *tsk) |
60 | { | 60 | { |
61 | struct stack_frame *sf; | 61 | struct stack_frame *sf, *low, *high; |
62 | 62 | ||
63 | sf = (struct stack_frame *) tsk->thread.ksp; | 63 | if (!tsk || !task_stack_page(tsk)) |
64 | sf = (struct stack_frame *) sf->back_chain; | 64 | return 0; |
65 | low = task_stack_page(tsk); | ||
66 | high = (struct stack_frame *) task_pt_regs(tsk); | ||
67 | sf = (struct stack_frame *) (tsk->thread.ksp & PSW_ADDR_INSN); | ||
68 | if (sf <= low || sf > high) | ||
69 | return 0; | ||
70 | sf = (struct stack_frame *) (sf->back_chain & PSW_ADDR_INSN); | ||
71 | if (sf <= low || sf > high) | ||
72 | return 0; | ||
65 | return sf->gprs[8]; | 73 | return sf->gprs[8]; |
66 | } | 74 | } |
67 | 75 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index b03847d100d9..de8784267473 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -268,7 +268,7 @@ static void do_machine_restart_nonsmp(char * __unused) | |||
268 | reipl_diag(); | 268 | reipl_diag(); |
269 | 269 | ||
270 | if (MACHINE_IS_VM) | 270 | if (MACHINE_IS_VM) |
271 | cpcmd ("IPL", NULL, 0); | 271 | cpcmd ("IPL", NULL, 0, NULL); |
272 | else | 272 | else |
273 | reipl (0x10000 | S390_lowcore.ipl_device); | 273 | reipl (0x10000 | S390_lowcore.ipl_device); |
274 | } | 274 | } |
@@ -276,14 +276,14 @@ static void do_machine_restart_nonsmp(char * __unused) | |||
276 | static void do_machine_halt_nonsmp(void) | 276 | static void do_machine_halt_nonsmp(void) |
277 | { | 277 | { |
278 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) | 278 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) |
279 | cpcmd(vmhalt_cmd, NULL, 0); | 279 | cpcmd(vmhalt_cmd, NULL, 0, NULL); |
280 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); | 280 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); |
281 | } | 281 | } |
282 | 282 | ||
283 | static void do_machine_power_off_nonsmp(void) | 283 | static void do_machine_power_off_nonsmp(void) |
284 | { | 284 | { |
285 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) | 285 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) |
286 | cpcmd(vmpoff_cmd, NULL, 0); | 286 | cpcmd(vmpoff_cmd, NULL, 0, NULL); |
287 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); | 287 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); |
288 | } | 288 | } |
289 | 289 | ||
@@ -315,6 +315,11 @@ void machine_power_off(void) | |||
315 | _machine_power_off(); | 315 | _machine_power_off(); |
316 | } | 316 | } |
317 | 317 | ||
318 | /* | ||
319 | * Dummy power off function. | ||
320 | */ | ||
321 | void (*pm_power_off)(void) = machine_power_off; | ||
322 | |||
318 | static void __init | 323 | static void __init |
319 | add_memory_hole(unsigned long start, unsigned long end) | 324 | add_memory_hole(unsigned long start, unsigned long end) |
320 | { | 325 | { |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index b0d8ca8e5eeb..7c0fe152a111 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -214,7 +214,7 @@ void account_ticks(struct pt_regs *regs) | |||
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 216 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
217 | account_user_vtime(current); | 217 | account_tick_vtime(current); |
218 | #else | 218 | #else |
219 | while (ticks--) | 219 | while (ticks--) |
220 | update_process_times(user_mode(regs)); | 220 | update_process_times(user_mode(regs)); |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 22a895ecb7a4..dfe6f0856617 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -32,7 +32,7 @@ DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); | |||
32 | * Update process times based on virtual cpu times stored by entry.S | 32 | * Update process times based on virtual cpu times stored by entry.S |
33 | * to the lowcore fields user_timer, system_timer & steal_clock. | 33 | * to the lowcore fields user_timer, system_timer & steal_clock. |
34 | */ | 34 | */ |
35 | void account_user_vtime(struct task_struct *tsk) | 35 | void account_tick_vtime(struct task_struct *tsk) |
36 | { | 36 | { |
37 | cputime_t cputime; | 37 | cputime_t cputime; |
38 | __u64 timer, clock; | 38 | __u64 timer, clock; |
@@ -76,6 +76,31 @@ void account_user_vtime(struct task_struct *tsk) | |||
76 | * Update process times based on virtual cpu times stored by entry.S | 76 | * Update process times based on virtual cpu times stored by entry.S |
77 | * to the lowcore fields user_timer, system_timer & steal_clock. | 77 | * to the lowcore fields user_timer, system_timer & steal_clock. |
78 | */ | 78 | */ |
79 | void account_vtime(struct task_struct *tsk) | ||
80 | { | ||
81 | cputime_t cputime; | ||
82 | __u64 timer; | ||
83 | |||
84 | timer = S390_lowcore.last_update_timer; | ||
85 | asm volatile (" STPT %0" /* Store current cpu timer value */ | ||
86 | : "=m" (S390_lowcore.last_update_timer) ); | ||
87 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; | ||
88 | |||
89 | cputime = S390_lowcore.user_timer >> 12; | ||
90 | S390_lowcore.user_timer -= cputime << 12; | ||
91 | S390_lowcore.steal_clock -= cputime << 12; | ||
92 | account_user_time(tsk, cputime); | ||
93 | |||
94 | cputime = S390_lowcore.system_timer >> 12; | ||
95 | S390_lowcore.system_timer -= cputime << 12; | ||
96 | S390_lowcore.steal_clock -= cputime << 12; | ||
97 | account_system_time(tsk, 0, cputime); | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * Update process times based on virtual cpu times stored by entry.S | ||
102 | * to the lowcore fields user_timer, system_timer & steal_clock. | ||
103 | */ | ||
79 | void account_system_vtime(struct task_struct *tsk) | 104 | void account_system_vtime(struct task_struct *tsk) |
80 | { | 105 | { |
81 | cputime_t cputime; | 106 | cputime_t cputime; |
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index d9b97b3c597f..f20b51ff1d86 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile | |||
@@ -4,5 +4,6 @@ | |||
4 | 4 | ||
5 | EXTRA_AFLAGS := -traditional | 5 | EXTRA_AFLAGS := -traditional |
6 | 6 | ||
7 | lib-y += delay.o string.o spinlock.o | 7 | lib-y += delay.o string.o |
8 | lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o) | 8 | lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o) |
9 | lib-$(CONFIG_SMP) += spinlock.o \ No newline at end of file | ||
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index 68d79c502081..60f80a4eed4e 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <asm/io.h> | 14 | #include <asm/io.h> |
15 | 15 | ||
16 | atomic_t spin_retry_counter; | ||
17 | int spin_retry = 1000; | 16 | int spin_retry = 1000; |
18 | 17 | ||
19 | /** | 18 | /** |
@@ -45,7 +44,6 @@ _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) | |||
45 | _diag44(); | 44 | _diag44(); |
46 | count = spin_retry; | 45 | count = spin_retry; |
47 | } | 46 | } |
48 | atomic_inc(&spin_retry_counter); | ||
49 | if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) | 47 | if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) |
50 | return; | 48 | return; |
51 | } | 49 | } |
@@ -58,7 +56,6 @@ _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc) | |||
58 | int count = spin_retry; | 56 | int count = spin_retry; |
59 | 57 | ||
60 | while (count-- > 0) { | 58 | while (count-- > 0) { |
61 | atomic_inc(&spin_retry_counter); | ||
62 | if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) | 59 | if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) |
63 | return 1; | 60 | return 1; |
64 | } | 61 | } |
@@ -77,7 +74,6 @@ _raw_read_lock_wait(raw_rwlock_t *rw) | |||
77 | _diag44(); | 74 | _diag44(); |
78 | count = spin_retry; | 75 | count = spin_retry; |
79 | } | 76 | } |
80 | atomic_inc(&spin_retry_counter); | ||
81 | old = rw->lock & 0x7fffffffU; | 77 | old = rw->lock & 0x7fffffffU; |
82 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | 78 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) |
83 | return; | 79 | return; |
@@ -92,7 +88,6 @@ _raw_read_trylock_retry(raw_rwlock_t *rw) | |||
92 | int count = spin_retry; | 88 | int count = spin_retry; |
93 | 89 | ||
94 | while (count-- > 0) { | 90 | while (count-- > 0) { |
95 | atomic_inc(&spin_retry_counter); | ||
96 | old = rw->lock & 0x7fffffffU; | 91 | old = rw->lock & 0x7fffffffU; |
97 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | 92 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) |
98 | return 1; | 93 | return 1; |
@@ -111,7 +106,6 @@ _raw_write_lock_wait(raw_rwlock_t *rw) | |||
111 | _diag44(); | 106 | _diag44(); |
112 | count = spin_retry; | 107 | count = spin_retry; |
113 | } | 108 | } |
114 | atomic_inc(&spin_retry_counter); | ||
115 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | 109 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) |
116 | return; | 110 | return; |
117 | } | 111 | } |
@@ -124,7 +118,6 @@ _raw_write_trylock_retry(raw_rwlock_t *rw) | |||
124 | int count = spin_retry; | 118 | int count = spin_retry; |
125 | 119 | ||
126 | while (count-- > 0) { | 120 | while (count-- > 0) { |
127 | atomic_inc(&spin_retry_counter); | ||
128 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | 121 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) |
129 | return 1; | 122 | return 1; |
130 | } | 123 | } |
diff --git a/arch/um/Makefile b/arch/um/Makefile index 322972fd064e..45435ff589c1 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -67,7 +67,8 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ | |||
67 | # in CFLAGS. Otherwise, it would cause ld to complain about the two different | 67 | # in CFLAGS. Otherwise, it would cause ld to complain about the two different |
68 | # errnos. | 68 | # errnos. |
69 | 69 | ||
70 | CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask | 70 | CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ |
71 | -Dmktime=kernel_mktime | ||
71 | CFLAGS += $(call cc-option,-fno-unit-at-a-time,) | 72 | CFLAGS += $(call cc-option,-fno-unit-at-a-time,) |
72 | 73 | ||
73 | include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) | 74 | include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) |
diff --git a/block/genhd.c b/block/genhd.c index f1ed83f3f083..db57546a709d 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -38,34 +38,100 @@ static inline int major_to_index(int major) | |||
38 | return major % MAX_PROBE_HASH; | 38 | return major % MAX_PROBE_HASH; |
39 | } | 39 | } |
40 | 40 | ||
41 | #ifdef CONFIG_PROC_FS | 41 | struct blkdev_info { |
42 | /* get block device names in somewhat random order */ | 42 | int index; |
43 | int get_blkdev_list(char *p, int used) | 43 | struct blk_major_name *bd; |
44 | }; | ||
45 | |||
46 | /* | ||
47 | * iterate over a list of blkdev_info structures. allows | ||
48 | * the major_names array to be iterated over from outside this file | ||
49 | * must be called with the block_subsys_sem held | ||
50 | */ | ||
51 | void *get_next_blkdev(void *dev) | ||
52 | { | ||
53 | struct blkdev_info *info; | ||
54 | |||
55 | if (dev == NULL) { | ||
56 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
57 | if (!info) | ||
58 | goto out; | ||
59 | info->index=0; | ||
60 | info->bd = major_names[info->index]; | ||
61 | if (info->bd) | ||
62 | goto out; | ||
63 | } else { | ||
64 | info = dev; | ||
65 | } | ||
66 | |||
67 | while (info->index < ARRAY_SIZE(major_names)) { | ||
68 | if (info->bd) | ||
69 | info->bd = info->bd->next; | ||
70 | if (info->bd) | ||
71 | goto out; | ||
72 | /* | ||
73 | * No devices on this chain, move to the next | ||
74 | */ | ||
75 | info->index++; | ||
76 | info->bd = (info->index < ARRAY_SIZE(major_names)) ? | ||
77 | major_names[info->index] : NULL; | ||
78 | if (info->bd) | ||
79 | goto out; | ||
80 | } | ||
81 | |||
82 | out: | ||
83 | return info; | ||
84 | } | ||
85 | |||
86 | void *acquire_blkdev_list(void) | ||
87 | { | ||
88 | down(&block_subsys_sem); | ||
89 | return get_next_blkdev(NULL); | ||
90 | } | ||
91 | |||
92 | void release_blkdev_list(void *dev) | ||
93 | { | ||
94 | up(&block_subsys_sem); | ||
95 | kfree(dev); | ||
96 | } | ||
97 | |||
98 | |||
99 | /* | ||
100 | * Count the number of records in the blkdev_list. | ||
101 | * must be called with the block_subsys_sem held | ||
102 | */ | ||
103 | int count_blkdev_list(void) | ||
44 | { | 104 | { |
45 | struct blk_major_name *n; | 105 | struct blk_major_name *n; |
46 | int i, len; | 106 | int i, count; |
47 | 107 | ||
48 | len = snprintf(p, (PAGE_SIZE-used), "\nBlock devices:\n"); | 108 | count = 0; |
49 | 109 | ||
50 | down(&block_subsys_sem); | ||
51 | for (i = 0; i < ARRAY_SIZE(major_names); i++) { | 110 | for (i = 0; i < ARRAY_SIZE(major_names); i++) { |
52 | for (n = major_names[i]; n; n = n->next) { | 111 | for (n = major_names[i]; n; n = n->next) |
53 | /* | 112 | count++; |
54 | * If the curent string plus the 5 extra characters | ||
55 | * in the line would run us off the page, then we're done | ||
56 | */ | ||
57 | if ((len + used + strlen(n->name) + 5) >= PAGE_SIZE) | ||
58 | goto page_full; | ||
59 | len += sprintf(p+len, "%3d %s\n", | ||
60 | n->major, n->name); | ||
61 | } | ||
62 | } | 113 | } |
63 | page_full: | ||
64 | up(&block_subsys_sem); | ||
65 | 114 | ||
66 | return len; | 115 | return count; |
67 | } | 116 | } |
68 | #endif | 117 | |
118 | /* | ||
119 | * extract the major and name values from a blkdev_info struct | ||
120 | * passed in as a void to *dev. Must be called with | ||
121 | * block_subsys_sem held | ||
122 | */ | ||
123 | int get_blkdev_info(void *dev, int *major, char **name) | ||
124 | { | ||
125 | struct blkdev_info *info = dev; | ||
126 | |||
127 | if (info->bd == NULL) | ||
128 | return 1; | ||
129 | |||
130 | *major = info->bd->major; | ||
131 | *name = info->bd->name; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
69 | 135 | ||
70 | int register_blkdev(unsigned int major, const char *name) | 136 | int register_blkdev(unsigned int major, const char *name) |
71 | { | 137 | { |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7e1a445955bc..3758b558d2b5 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -153,7 +153,7 @@ static int acpi_ec_polling_mode = EC_POLLING; | |||
153 | Transaction Management | 153 | Transaction Management |
154 | -------------------------------------------------------------------------- */ | 154 | -------------------------------------------------------------------------- */ |
155 | 155 | ||
156 | static inline u32 acpi_ec_read_status(union acpi_ec *ec) | 156 | static u32 acpi_ec_read_status(union acpi_ec *ec) |
157 | { | 157 | { |
158 | u32 status = 0; | 158 | u32 status = 0; |
159 | 159 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 3d384e3d34de..e97e911ebf7a 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -48,7 +48,7 @@ struct firmware_priv { | |||
48 | struct timer_list timeout; | 48 | struct timer_list timeout; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static inline void | 51 | static void |
52 | fw_load_abort(struct firmware_priv *fw_priv) | 52 | fw_load_abort(struct firmware_priv *fw_priv) |
53 | { | 53 | { |
54 | set_bit(FW_STATUS_ABORT, &fw_priv->status); | 54 | set_bit(FW_STATUS_ABORT, &fw_priv->status); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 864729046e22..5f6d1a5cce11 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -294,7 +294,7 @@ fail: | |||
294 | * This helper just factors out common code between do_lo_send_direct_write() | 294 | * This helper just factors out common code between do_lo_send_direct_write() |
295 | * and do_lo_send_write(). | 295 | * and do_lo_send_write(). |
296 | */ | 296 | */ |
297 | static inline int __do_lo_send_write(struct file *file, | 297 | static int __do_lo_send_write(struct file *file, |
298 | u8 __user *buf, const int len, loff_t pos) | 298 | u8 __user *buf, const int len, loff_t pos) |
299 | { | 299 | { |
300 | ssize_t bw; | 300 | ssize_t bw; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 51b7a5c5b77a..93affeeef7bd 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -247,7 +247,7 @@ static inline struct pkt_rb_node *pkt_rbtree_next(struct pkt_rb_node *node) | |||
247 | return rb_entry(n, struct pkt_rb_node, rb_node); | 247 | return rb_entry(n, struct pkt_rb_node, rb_node); |
248 | } | 248 | } |
249 | 249 | ||
250 | static inline void pkt_rbtree_erase(struct pktcdvd_device *pd, struct pkt_rb_node *node) | 250 | static void pkt_rbtree_erase(struct pktcdvd_device *pd, struct pkt_rb_node *node) |
251 | { | 251 | { |
252 | rb_erase(&node->rb_node, &pd->bio_queue); | 252 | rb_erase(&node->rb_node, &pd->bio_queue); |
253 | mempool_free(node, pd->rb_pool); | 253 | mempool_free(node, pd->rb_pool); |
@@ -315,7 +315,7 @@ static void pkt_rbtree_insert(struct pktcdvd_device *pd, struct pkt_rb_node *nod | |||
315 | /* | 315 | /* |
316 | * Add a bio to a single linked list defined by its head and tail pointers. | 316 | * Add a bio to a single linked list defined by its head and tail pointers. |
317 | */ | 317 | */ |
318 | static inline void pkt_add_list_last(struct bio *bio, struct bio **list_head, struct bio **list_tail) | 318 | static void pkt_add_list_last(struct bio *bio, struct bio **list_head, struct bio **list_tail) |
319 | { | 319 | { |
320 | bio->bi_next = NULL; | 320 | bio->bi_next = NULL; |
321 | if (*list_tail) { | 321 | if (*list_tail) { |
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 8fddfdfd0fbd..7bd4ef904115 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -494,7 +494,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char | |||
494 | } | 494 | } |
495 | } | 495 | } |
496 | 496 | ||
497 | static inline void bcsp_complete_rx_pkt(struct hci_uart *hu) | 497 | static void bcsp_complete_rx_pkt(struct hci_uart *hu) |
498 | { | 498 | { |
499 | struct bcsp_struct *bcsp = hu->priv; | 499 | struct bcsp_struct *bcsp = hu->priv; |
500 | int pass_up; | 500 | int pass_up; |
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c index caeecc2c36da..a080cdd6081e 100644 --- a/drivers/char/drm/r128_state.c +++ b/drivers/char/drm/r128_state.c | |||
@@ -220,7 +220,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) | |||
220 | ADVANCE_RING(); | 220 | ADVANCE_RING(); |
221 | } | 221 | } |
222 | 222 | ||
223 | static __inline__ void r128_emit_state(drm_r128_private_t * dev_priv) | 223 | static void r128_emit_state(drm_r128_private_t * dev_priv) |
224 | { | 224 | { |
225 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 225 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
226 | unsigned int dirty = sarea_priv->dirty; | 226 | unsigned int dirty = sarea_priv->dirty; |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index a6544790af60..c0dfcf273f0a 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -395,12 +395,38 @@ config MACHZ_WDT | |||
395 | To compile this driver as a module, choose M here: the | 395 | To compile this driver as a module, choose M here: the |
396 | module will be called machzwd. | 396 | module will be called machzwd. |
397 | 397 | ||
398 | config SBC_EPX_C3_WATCHDOG | ||
399 | tristate "Winsystems SBC EPX-C3 watchdog" | ||
400 | depends on WATCHDOG && X86 | ||
401 | ---help--- | ||
402 | This is the driver for the built-in watchdog timer on the EPX-C3 | ||
403 | Single-board computer made by Winsystems, Inc. | ||
404 | |||
405 | *Note*: This hardware watchdog is not probeable and thus there | ||
406 | is no way to know if writing to its IO address will corrupt | ||
407 | your system or have any real effect. The only way to be sure | ||
408 | that this driver does what you want is to make sure you | ||
409 | are runnning it on an EPX-C3 from Winsystems with the watchdog | ||
410 | timer at IO address 0x1ee and 0x1ef. It will write to both those | ||
411 | IO ports. Basically, the assumption is made that if you compile | ||
412 | this driver into your kernel and/or load it as a module, that you | ||
413 | know what you are doing and that you are in fact running on an | ||
414 | EPX-C3 board! | ||
415 | |||
416 | To compile this driver as a module, choose M here: the | ||
417 | module will be called sbc_epx_c3. | ||
418 | |||
419 | |||
398 | # PowerPC Architecture | 420 | # PowerPC Architecture |
399 | 421 | ||
400 | config 8xx_WDT | 422 | config 8xx_WDT |
401 | tristate "MPC8xx Watchdog Timer" | 423 | tristate "MPC8xx Watchdog Timer" |
402 | depends on WATCHDOG && 8xx | 424 | depends on WATCHDOG && 8xx |
403 | 425 | ||
426 | config 83xx_WDT | ||
427 | tristate "MPC83xx Watchdog Timer" | ||
428 | depends on WATCHDOG && PPC_83xx | ||
429 | |||
404 | config MV64X60_WDT | 430 | config MV64X60_WDT |
405 | tristate "MV64X60 (Marvell Discovery) Watchdog Timer" | 431 | tristate "MV64X60 (Marvell Discovery) Watchdog Timer" |
406 | depends on WATCHDOG && MV64X60 | 432 | depends on WATCHDOG && MV64X60 |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index cfd0a3987710..36c0b282b8ba 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -52,9 +52,11 @@ obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o | |||
52 | obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o | 52 | obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o |
53 | obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o | 53 | obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o |
54 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o | 54 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o |
55 | obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o | ||
55 | 56 | ||
56 | # PowerPC Architecture | 57 | # PowerPC Architecture |
57 | obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o | 58 | obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o |
59 | obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o | ||
58 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o | 60 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o |
59 | obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o | 61 | obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o |
60 | 62 | ||
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c new file mode 100644 index 000000000000..5d6f5061603a --- /dev/null +++ b/drivers/char/watchdog/mpc83xx_wdt.c | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * mpc83xx_wdt.c - MPC83xx watchdog userspace interface | ||
3 | * | ||
4 | * Authors: Dave Updegraff <dave@cray.org> | ||
5 | * Kumar Gala <galak@kernel.crashing.org> | ||
6 | * Attribution: from 83xx_wst: Florian Schirmer <jolt@tuxbox.org> | ||
7 | * ..and from sc520_wdt | ||
8 | * | ||
9 | * Note: it appears that you can only actually ENABLE or DISABLE the thing | ||
10 | * once after POR. Once enabled, you cannot disable, and vice versa. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/fs.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/miscdevice.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/watchdog.h> | ||
26 | #include <asm/io.h> | ||
27 | #include <asm/uaccess.h> | ||
28 | |||
29 | struct mpc83xx_wdt { | ||
30 | __be32 res0; | ||
31 | __be32 swcrr; /* System watchdog control register */ | ||
32 | #define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */ | ||
33 | #define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */ | ||
34 | #define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/ | ||
35 | #define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */ | ||
36 | __be32 swcnr; /* System watchdog count register */ | ||
37 | u8 res1[2]; | ||
38 | __be16 swsrr; /* System watchdog service register */ | ||
39 | u8 res2[0xF0]; | ||
40 | }; | ||
41 | |||
42 | static struct mpc83xx_wdt __iomem *wd_base; | ||
43 | |||
44 | static u16 timeout = 0xffff; | ||
45 | module_param(timeout, ushort, 0); | ||
46 | MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. (0<timeout<65536, default=65535"); | ||
47 | |||
48 | static int reset = 1; | ||
49 | module_param(reset, bool, 0); | ||
50 | MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset"); | ||
51 | |||
52 | /* | ||
53 | * We always prescale, but if someone really doesn't want to they can set this | ||
54 | * to 0 | ||
55 | */ | ||
56 | static int prescale = 1; | ||
57 | static unsigned int timeout_sec; | ||
58 | |||
59 | static unsigned long wdt_is_open; | ||
60 | static spinlock_t wdt_spinlock; | ||
61 | |||
62 | static void mpc83xx_wdt_keepalive(void) | ||
63 | { | ||
64 | /* Ping the WDT */ | ||
65 | spin_lock(&wdt_spinlock); | ||
66 | out_be16(&wd_base->swsrr, 0x556c); | ||
67 | out_be16(&wd_base->swsrr, 0xaa39); | ||
68 | spin_unlock(&wdt_spinlock); | ||
69 | } | ||
70 | |||
71 | static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf, | ||
72 | size_t count, loff_t *ppos) | ||
73 | { | ||
74 | if (count) | ||
75 | mpc83xx_wdt_keepalive(); | ||
76 | return count; | ||
77 | } | ||
78 | |||
79 | static int mpc83xx_wdt_open(struct inode *inode, struct file *file) | ||
80 | { | ||
81 | u32 tmp = SWCRR_SWEN; | ||
82 | if (test_and_set_bit(0, &wdt_is_open)) | ||
83 | return -EBUSY; | ||
84 | |||
85 | /* Once we start the watchdog we can't stop it */ | ||
86 | __module_get(THIS_MODULE); | ||
87 | |||
88 | /* Good, fire up the show */ | ||
89 | if (prescale) | ||
90 | tmp |= SWCRR_SWPR; | ||
91 | if (reset) | ||
92 | tmp |= SWCRR_SWRI; | ||
93 | |||
94 | tmp |= timeout << 16; | ||
95 | |||
96 | out_be32(&wd_base->swcrr, tmp); | ||
97 | |||
98 | return nonseekable_open(inode, file); | ||
99 | } | ||
100 | |||
101 | static int mpc83xx_wdt_release(struct inode *inode, struct file *file) | ||
102 | { | ||
103 | printk(KERN_CRIT "Unexpected close, not stopping watchdog!\n"); | ||
104 | mpc83xx_wdt_keepalive(); | ||
105 | clear_bit(0, &wdt_is_open); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file, | ||
110 | unsigned int cmd, unsigned long arg) | ||
111 | { | ||
112 | void __user *argp = (void __user *)arg; | ||
113 | int __user *p = argp; | ||
114 | static struct watchdog_info ident = { | ||
115 | .options = WDIOF_KEEPALIVEPING, | ||
116 | .firmware_version = 1, | ||
117 | .identity = "MPC83xx", | ||
118 | }; | ||
119 | |||
120 | switch (cmd) { | ||
121 | case WDIOC_GETSUPPORT: | ||
122 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; | ||
123 | case WDIOC_KEEPALIVE: | ||
124 | mpc83xx_wdt_keepalive(); | ||
125 | return 0; | ||
126 | case WDIOC_GETTIMEOUT: | ||
127 | return put_user(timeout_sec, p); | ||
128 | default: | ||
129 | return -ENOIOCTLCMD; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | static struct file_operations mpc83xx_wdt_fops = { | ||
134 | .owner = THIS_MODULE, | ||
135 | .llseek = no_llseek, | ||
136 | .write = mpc83xx_wdt_write, | ||
137 | .ioctl = mpc83xx_wdt_ioctl, | ||
138 | .open = mpc83xx_wdt_open, | ||
139 | .release = mpc83xx_wdt_release, | ||
140 | }; | ||
141 | |||
142 | static struct miscdevice mpc83xx_wdt_miscdev = { | ||
143 | .minor = WATCHDOG_MINOR, | ||
144 | .name = "watchdog", | ||
145 | .fops = &mpc83xx_wdt_fops, | ||
146 | }; | ||
147 | |||
148 | static int __devinit mpc83xx_wdt_probe(struct platform_device *dev) | ||
149 | { | ||
150 | struct resource *r; | ||
151 | int ret; | ||
152 | unsigned int *freq = dev->dev.platform_data; | ||
153 | |||
154 | /* get a pointer to the register memory */ | ||
155 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
156 | |||
157 | if (!r) { | ||
158 | ret = -ENODEV; | ||
159 | goto err_out; | ||
160 | } | ||
161 | |||
162 | wd_base = ioremap(r->start, sizeof (struct mpc83xx_wdt)); | ||
163 | |||
164 | if (wd_base == NULL) { | ||
165 | ret = -ENOMEM; | ||
166 | goto err_out; | ||
167 | } | ||
168 | |||
169 | ret = misc_register(&mpc83xx_wdt_miscdev); | ||
170 | if (ret) { | ||
171 | printk(KERN_ERR "cannot register miscdev on minor=%d " | ||
172 | "(err=%d)\n", | ||
173 | WATCHDOG_MINOR, ret); | ||
174 | goto err_unmap; | ||
175 | } | ||
176 | |||
177 | /* Calculate the timeout in seconds */ | ||
178 | if (prescale) | ||
179 | timeout_sec = (timeout * 0x10000) / (*freq); | ||
180 | else | ||
181 | timeout_sec = timeout / (*freq); | ||
182 | |||
183 | printk(KERN_INFO "WDT driver for MPC83xx initialized. " | ||
184 | "mode:%s timeout=%d (%d seconds)\n", | ||
185 | reset ? "reset":"interrupt", timeout, timeout_sec); | ||
186 | |||
187 | spin_lock_init(&wdt_spinlock); | ||
188 | |||
189 | return 0; | ||
190 | |||
191 | err_unmap: | ||
192 | iounmap(wd_base); | ||
193 | err_out: | ||
194 | return ret; | ||
195 | } | ||
196 | |||
197 | static int __devexit mpc83xx_wdt_remove(struct platform_device *dev) | ||
198 | { | ||
199 | misc_deregister(&mpc83xx_wdt_miscdev); | ||
200 | iounmap(wd_base); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static struct platform_driver mpc83xx_wdt_driver = { | ||
206 | .probe = mpc83xx_wdt_probe, | ||
207 | .remove = __devexit_p(mpc83xx_wdt_remove), | ||
208 | .driver = { | ||
209 | .name = "mpc83xx_wdt", | ||
210 | }, | ||
211 | }; | ||
212 | |||
213 | static int __init mpc83xx_wdt_init(void) | ||
214 | { | ||
215 | return platform_driver_register(&mpc83xx_wdt_driver); | ||
216 | } | ||
217 | |||
218 | static void __exit mpc83xx_wdt_exit(void) | ||
219 | { | ||
220 | platform_driver_unregister(&mpc83xx_wdt_driver); | ||
221 | } | ||
222 | |||
223 | module_init(mpc83xx_wdt_init); | ||
224 | module_exit(mpc83xx_wdt_exit); | ||
225 | |||
226 | MODULE_AUTHOR("Dave Updegraff, Kumar Gala"); | ||
227 | MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor"); | ||
228 | MODULE_LICENSE("GPL"); | ||
229 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index fb88b4041dca..b474ea52d6e8 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -74,7 +74,7 @@ static int sa1100dog_release(struct inode *inode, struct file *file) | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos) | 77 | static ssize_t sa1100dog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) |
78 | { | 78 | { |
79 | if (len) | 79 | if (len) |
80 | /* Refresh OSMR3 timer. */ | 80 | /* Refresh OSMR3 timer. */ |
@@ -96,20 +96,20 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
96 | 96 | ||
97 | switch (cmd) { | 97 | switch (cmd) { |
98 | case WDIOC_GETSUPPORT: | 98 | case WDIOC_GETSUPPORT: |
99 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | 99 | ret = copy_to_user((struct watchdog_info __user *)arg, &ident, |
100 | sizeof(ident)) ? -EFAULT : 0; | 100 | sizeof(ident)) ? -EFAULT : 0; |
101 | break; | 101 | break; |
102 | 102 | ||
103 | case WDIOC_GETSTATUS: | 103 | case WDIOC_GETSTATUS: |
104 | ret = put_user(0, (int *)arg); | 104 | ret = put_user(0, (int __user *)arg); |
105 | break; | 105 | break; |
106 | 106 | ||
107 | case WDIOC_GETBOOTSTATUS: | 107 | case WDIOC_GETBOOTSTATUS: |
108 | ret = put_user(boot_status, (int *)arg); | 108 | ret = put_user(boot_status, (int __user *)arg); |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case WDIOC_SETTIMEOUT: | 111 | case WDIOC_SETTIMEOUT: |
112 | ret = get_user(time, (int *)arg); | 112 | ret = get_user(time, (int __user *)arg); |
113 | if (ret) | 113 | if (ret) |
114 | break; | 114 | break; |
115 | 115 | ||
@@ -123,7 +123,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
123 | /*fall through*/ | 123 | /*fall through*/ |
124 | 124 | ||
125 | case WDIOC_GETTIMEOUT: | 125 | case WDIOC_GETTIMEOUT: |
126 | ret = put_user(pre_margin / OSCR_FREQ, (int *)arg); | 126 | ret = put_user(pre_margin / OSCR_FREQ, (int __user *)arg); |
127 | break; | 127 | break; |
128 | 128 | ||
129 | case WDIOC_KEEPALIVE: | 129 | case WDIOC_KEEPALIVE: |
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c new file mode 100644 index 000000000000..951764614ebf --- /dev/null +++ b/drivers/char/watchdog/sbc_epx_c3.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * SBC EPX C3 0.1 A Hardware Watchdog Device for the Winsystems EPX-C3 | ||
3 | * single board computer | ||
4 | * | ||
5 | * (c) Copyright 2006 Calin A. Culianu <calin@ajvar.org>, All Rights | ||
6 | * Reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * based on softdog.c by Alan Cox <alan@redhat.com> | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/fs.h> | ||
22 | #include <linux/mm.h> | ||
23 | #include <linux/miscdevice.h> | ||
24 | #include <linux/watchdog.h> | ||
25 | #include <linux/notifier.h> | ||
26 | #include <linux/reboot.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/io.h> | ||
30 | |||
31 | #define PFX "epx_c3: " | ||
32 | static int epx_c3_alive; | ||
33 | |||
34 | #define WATCHDOG_TIMEOUT 1 /* 1 sec default timeout */ | ||
35 | |||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
37 | module_param(nowayout, int, 0); | ||
38 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
39 | |||
40 | #define EPXC3_WATCHDOG_CTL_REG 0x1ee /* write 1 to enable, 0 to disable */ | ||
41 | #define EPXC3_WATCHDOG_PET_REG 0x1ef /* write anything to pet once enabled */ | ||
42 | |||
43 | static void epx_c3_start(void) | ||
44 | { | ||
45 | outb(1, EPXC3_WATCHDOG_CTL_REG); | ||
46 | } | ||
47 | |||
48 | static void epx_c3_stop(void) | ||
49 | { | ||
50 | |||
51 | outb(0, EPXC3_WATCHDOG_CTL_REG); | ||
52 | |||
53 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | ||
54 | } | ||
55 | |||
56 | static void epx_c3_pet(void) | ||
57 | { | ||
58 | outb(1, EPXC3_WATCHDOG_PET_REG); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * Allow only one person to hold it open | ||
63 | */ | ||
64 | static int epx_c3_open(struct inode *inode, struct file *file) | ||
65 | { | ||
66 | if (epx_c3_alive) | ||
67 | return -EBUSY; | ||
68 | |||
69 | if (nowayout) | ||
70 | __module_get(THIS_MODULE); | ||
71 | |||
72 | /* Activate timer */ | ||
73 | epx_c3_start(); | ||
74 | epx_c3_pet(); | ||
75 | |||
76 | epx_c3_alive = 1; | ||
77 | printk(KERN_INFO "Started watchdog timer.\n"); | ||
78 | |||
79 | return nonseekable_open(inode, file); | ||
80 | } | ||
81 | |||
82 | static int epx_c3_release(struct inode *inode, struct file *file) | ||
83 | { | ||
84 | /* Shut off the timer. | ||
85 | * Lock it in if it's a module and we defined ...NOWAYOUT */ | ||
86 | if (!nowayout) | ||
87 | epx_c3_stop(); /* Turn the WDT off */ | ||
88 | |||
89 | epx_c3_alive = 0; | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static ssize_t epx_c3_write(struct file *file, const char *data, | ||
95 | size_t len, loff_t *ppos) | ||
96 | { | ||
97 | /* Refresh the timer. */ | ||
98 | if (len) | ||
99 | epx_c3_pet(); | ||
100 | return len; | ||
101 | } | ||
102 | |||
103 | static int epx_c3_ioctl(struct inode *inode, struct file *file, | ||
104 | unsigned int cmd, unsigned long arg) | ||
105 | { | ||
106 | int options, retval = -EINVAL; | ||
107 | static struct watchdog_info ident = { | ||
108 | .options = WDIOF_KEEPALIVEPING | | ||
109 | WDIOF_MAGICCLOSE, | ||
110 | .firmware_version = 0, | ||
111 | .identity = "Winsystems EPX-C3 H/W Watchdog", | ||
112 | }; | ||
113 | |||
114 | switch (cmd) { | ||
115 | case WDIOC_GETSUPPORT: | ||
116 | if (copy_to_user((struct watchdog_info *)arg, | ||
117 | &ident, sizeof(ident))) | ||
118 | return -EFAULT; | ||
119 | return 0; | ||
120 | case WDIOC_GETSTATUS: | ||
121 | case WDIOC_GETBOOTSTATUS: | ||
122 | return put_user(0,(int *)arg); | ||
123 | case WDIOC_KEEPALIVE: | ||
124 | epx_c3_pet(); | ||
125 | return 0; | ||
126 | case WDIOC_GETTIMEOUT: | ||
127 | return put_user(WATCHDOG_TIMEOUT,(int *)arg); | ||
128 | case WDIOC_SETOPTIONS: { | ||
129 | if (get_user(options, (int *)arg)) | ||
130 | return -EFAULT; | ||
131 | |||
132 | if (options & WDIOS_DISABLECARD) { | ||
133 | epx_c3_stop(); | ||
134 | retval = 0; | ||
135 | } | ||
136 | |||
137 | if (options & WDIOS_ENABLECARD) { | ||
138 | epx_c3_start(); | ||
139 | retval = 0; | ||
140 | } | ||
141 | |||
142 | return retval; | ||
143 | } | ||
144 | default: | ||
145 | return -ENOIOCTLCMD; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | static int epx_c3_notify_sys(struct notifier_block *this, unsigned long code, | ||
150 | void *unused) | ||
151 | { | ||
152 | if (code == SYS_DOWN || code == SYS_HALT) | ||
153 | epx_c3_stop(); /* Turn the WDT off */ | ||
154 | |||
155 | return NOTIFY_DONE; | ||
156 | } | ||
157 | |||
158 | static struct file_operations epx_c3_fops = { | ||
159 | .owner = THIS_MODULE, | ||
160 | .llseek = no_llseek, | ||
161 | .write = epx_c3_write, | ||
162 | .ioctl = epx_c3_ioctl, | ||
163 | .open = epx_c3_open, | ||
164 | .release = epx_c3_release, | ||
165 | }; | ||
166 | |||
167 | static struct miscdevice epx_c3_miscdev = { | ||
168 | .minor = WATCHDOG_MINOR, | ||
169 | .name = "watchdog", | ||
170 | .fops = &epx_c3_fops, | ||
171 | }; | ||
172 | |||
173 | static struct notifier_block epx_c3_notifier = { | ||
174 | .notifier_call = epx_c3_notify_sys, | ||
175 | }; | ||
176 | |||
177 | static const char banner[] __initdata = | ||
178 | KERN_INFO PFX "Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n"; | ||
179 | |||
180 | static int __init watchdog_init(void) | ||
181 | { | ||
182 | int ret; | ||
183 | |||
184 | ret = register_reboot_notifier(&epx_c3_notifier); | ||
185 | if (ret) { | ||
186 | printk(KERN_ERR PFX "cannot register reboot notifier " | ||
187 | "(err=%d)\n", ret); | ||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | ret = misc_register(&epx_c3_miscdev); | ||
192 | if (ret) { | ||
193 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d " | ||
194 | "(err=%d)\n", WATCHDOG_MINOR, ret); | ||
195 | unregister_reboot_notifier(&epx_c3_notifier); | ||
196 | return ret; | ||
197 | } | ||
198 | |||
199 | printk(banner); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void __exit watchdog_exit(void) | ||
205 | { | ||
206 | misc_deregister(&epx_c3_miscdev); | ||
207 | unregister_reboot_notifier(&epx_c3_notifier); | ||
208 | } | ||
209 | |||
210 | module_init(watchdog_init); | ||
211 | module_exit(watchdog_exit); | ||
212 | |||
213 | MODULE_AUTHOR("Calin A. Culianu <calin@ajvar.org>"); | ||
214 | MODULE_DESCRIPTION("Hardware Watchdog Device for Winsystems EPX-C3 SBC. Note that there is no way to probe for this device -- so only use it if you are *sure* you are runnning on this specific SBC system from Winsystems! It writes to IO ports 0x1ee and 0x1ef!"); | ||
215 | MODULE_LICENSE("GPL"); | ||
216 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a9163d02983a..277a843a87a6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -41,7 +41,6 @@ static DEFINE_SPINLOCK(cpufreq_driver_lock); | |||
41 | /* internal prototypes */ | 41 | /* internal prototypes */ |
42 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 42 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); |
43 | static void handle_update(void *data); | 43 | static void handle_update(void *data); |
44 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci); | ||
45 | 44 | ||
46 | /** | 45 | /** |
47 | * Two notifier lists: the "policy" list is involved in the | 46 | * Two notifier lists: the "policy" list is involved in the |
@@ -127,7 +126,7 @@ static unsigned int debug_ratelimit = 1; | |||
127 | static unsigned int disable_ratelimit = 1; | 126 | static unsigned int disable_ratelimit = 1; |
128 | static DEFINE_SPINLOCK(disable_ratelimit_lock); | 127 | static DEFINE_SPINLOCK(disable_ratelimit_lock); |
129 | 128 | ||
130 | static inline void cpufreq_debug_enable_ratelimit(void) | 129 | static void cpufreq_debug_enable_ratelimit(void) |
131 | { | 130 | { |
132 | unsigned long flags; | 131 | unsigned long flags; |
133 | 132 | ||
@@ -137,7 +136,7 @@ static inline void cpufreq_debug_enable_ratelimit(void) | |||
137 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 136 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
138 | } | 137 | } |
139 | 138 | ||
140 | static inline void cpufreq_debug_disable_ratelimit(void) | 139 | static void cpufreq_debug_disable_ratelimit(void) |
141 | { | 140 | { |
142 | unsigned long flags; | 141 | unsigned long flags; |
143 | 142 | ||
@@ -206,7 +205,7 @@ static inline void cpufreq_debug_disable_ratelimit(void) { return; } | |||
206 | static unsigned long l_p_j_ref; | 205 | static unsigned long l_p_j_ref; |
207 | static unsigned int l_p_j_ref_freq; | 206 | static unsigned int l_p_j_ref_freq; |
208 | 207 | ||
209 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | 208 | static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) |
210 | { | 209 | { |
211 | if (ci->flags & CPUFREQ_CONST_LOOPS) | 210 | if (ci->flags & CPUFREQ_CONST_LOOPS) |
212 | return; | 211 | return; |
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index dfedb777d8c9..fdb8b042e64d 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -49,7 +49,7 @@ | |||
49 | MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); | 49 | MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); |
50 | MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); | 50 | MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); |
51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
52 | MODULE_VERSION("3.1"); | 52 | MODULE_VERSION("3.2"); |
53 | 53 | ||
54 | #define BIOS_SCAN_LIMIT 0xffffffff | 54 | #define BIOS_SCAN_LIMIT 0xffffffff |
55 | #define MAX_IMAGE_LENGTH 16 | 55 | #define MAX_IMAGE_LENGTH 16 |
@@ -564,12 +564,10 @@ static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, | |||
564 | 564 | ||
565 | static void callbackfn_rbu(const struct firmware *fw, void *context) | 565 | static void callbackfn_rbu(const struct firmware *fw, void *context) |
566 | { | 566 | { |
567 | int rc = 0; | 567 | rbu_data.entry_created = 0; |
568 | 568 | ||
569 | if (!fw || !fw->size) { | 569 | if (!fw || !fw->size) |
570 | rbu_data.entry_created = 0; | ||
571 | return; | 570 | return; |
572 | } | ||
573 | 571 | ||
574 | spin_lock(&rbu_data.lock); | 572 | spin_lock(&rbu_data.lock); |
575 | if (!strcmp(image_type, "mono")) { | 573 | if (!strcmp(image_type, "mono")) { |
@@ -592,15 +590,6 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
592 | } else | 590 | } else |
593 | pr_debug("invalid image type specified.\n"); | 591 | pr_debug("invalid image type specified.\n"); |
594 | spin_unlock(&rbu_data.lock); | 592 | spin_unlock(&rbu_data.lock); |
595 | |||
596 | rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, | ||
597 | "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); | ||
598 | if (rc) | ||
599 | printk(KERN_ERR | ||
600 | "dell_rbu:%s request_firmware_nowait failed" | ||
601 | " %d\n", __FUNCTION__, rc); | ||
602 | else | ||
603 | rbu_data.entry_created = 1; | ||
604 | } | 593 | } |
605 | 594 | ||
606 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | 595 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, |
@@ -735,14 +724,7 @@ static int __init dcdrbu_init(void) | |||
735 | sysfs_create_bin_file(&rbu_device->dev.kobj, | 724 | sysfs_create_bin_file(&rbu_device->dev.kobj, |
736 | &rbu_packet_size_attr); | 725 | &rbu_packet_size_attr); |
737 | 726 | ||
738 | rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, | 727 | rbu_data.entry_created = 0; |
739 | "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); | ||
740 | if (rc) | ||
741 | printk(KERN_ERR "dell_rbu:%s:request_firmware_nowait" | ||
742 | " failed %d\n", __FUNCTION__, rc); | ||
743 | else | ||
744 | rbu_data.entry_created = 1; | ||
745 | |||
746 | return rc; | 728 | return rc; |
747 | 729 | ||
748 | } | 730 | } |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index ef09a7ef2396..3325660f7248 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -980,7 +980,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector, | |||
980 | * and attempt to recover if there are problems. Returns 0 if everything's | 980 | * and attempt to recover if there are problems. Returns 0 if everything's |
981 | * ok; nonzero if the request has been terminated. | 981 | * ok; nonzero if the request has been terminated. |
982 | */ | 982 | */ |
983 | static inline | 983 | static |
984 | int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) | 984 | int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) |
985 | { | 985 | { |
986 | if (ireason == 2) | 986 | if (ireason == 2) |
@@ -1539,7 +1539,7 @@ int cdrom_queue_packet_command(ide_drive_t *drive, struct request *rq) | |||
1539 | /* | 1539 | /* |
1540 | * Write handling | 1540 | * Write handling |
1541 | */ | 1541 | */ |
1542 | static inline int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason) | 1542 | static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason) |
1543 | { | 1543 | { |
1544 | /* Two notes about IDE interrupt reason here - 0 means that | 1544 | /* Two notes about IDE interrupt reason here - 0 means that |
1545 | * the drive wants to receive data from us, 2 means that | 1545 | * the drive wants to receive data from us, 2 means that |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 245b508208df..ca25f9e3d0f4 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -477,7 +477,7 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id) | |||
477 | && id->lba_capacity_2; | 477 | && id->lba_capacity_2; |
478 | } | 478 | } |
479 | 479 | ||
480 | static inline void idedisk_check_hpa(ide_drive_t *drive) | 480 | static void idedisk_check_hpa(ide_drive_t *drive) |
481 | { | 481 | { |
482 | unsigned long long capacity, set_max; | 482 | unsigned long long capacity, set_max; |
483 | int lba48 = idedisk_supports_lba48(drive->id); | 483 | int lba48 = idedisk_supports_lba48(drive->id); |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 62ebefd6394a..9834dce4e20f 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -308,7 +308,7 @@ static void ide_pio_multi(ide_drive_t *drive, unsigned int write) | |||
308 | ide_pio_sector(drive, write); | 308 | ide_pio_sector(drive, write); |
309 | } | 309 | } |
310 | 310 | ||
311 | static inline void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | 311 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, |
312 | unsigned int write) | 312 | unsigned int write) |
313 | { | 313 | { |
314 | if (rq->bio) /* fs request */ | 314 | if (rq->bio) /* fs request */ |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index c06b18102b6a..2514de3480d8 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -856,7 +856,7 @@ static void cm_format_req(struct cm_req_msg *req_msg, | |||
856 | param->private_data_len); | 856 | param->private_data_len); |
857 | } | 857 | } |
858 | 858 | ||
859 | static inline int cm_validate_req_param(struct ib_cm_req_param *param) | 859 | static int cm_validate_req_param(struct ib_cm_req_param *param) |
860 | { | 860 | { |
861 | /* peer-to-peer not supported */ | 861 | /* peer-to-peer not supported */ |
862 | if (param->peer_to_peer) | 862 | if (param->peer_to_peer) |
@@ -1005,7 +1005,7 @@ static inline int cm_is_active_peer(__be64 local_ca_guid, __be64 remote_ca_guid, | |||
1005 | (be32_to_cpu(local_qpn) > be32_to_cpu(remote_qpn)))); | 1005 | (be32_to_cpu(local_qpn) > be32_to_cpu(remote_qpn)))); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | static inline void cm_format_paths_from_req(struct cm_req_msg *req_msg, | 1008 | static void cm_format_paths_from_req(struct cm_req_msg *req_msg, |
1009 | struct ib_sa_path_rec *primary_path, | 1009 | struct ib_sa_path_rec *primary_path, |
1010 | struct ib_sa_path_rec *alt_path) | 1010 | struct ib_sa_path_rec *alt_path) |
1011 | { | 1011 | { |
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index 5d8ee7368f7b..4abe5ff10e72 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c | |||
@@ -358,7 +358,7 @@ hdlc_fill_fifo(struct BCState *bcs) | |||
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | static inline void | 361 | static void |
362 | HDLC_irq(struct BCState *bcs, u_int stat) { | 362 | HDLC_irq(struct BCState *bcs, u_int stat) { |
363 | int len; | 363 | int len; |
364 | struct sk_buff *skb; | 364 | struct sk_buff *skb; |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index b62d6b30b72b..b0ff1cc97d7c 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
@@ -476,7 +476,7 @@ Memhscx_fill_fifo(struct BCState *bcs) | |||
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | static inline void | 479 | static void |
480 | Memhscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) | 480 | Memhscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) |
481 | { | 481 | { |
482 | u_char r; | 482 | u_char r; |
diff --git a/drivers/isdn/hisax/hscx_irq.c b/drivers/isdn/hisax/hscx_irq.c index 5fe9d42d03a3..7b1ad5e4ecda 100644 --- a/drivers/isdn/hisax/hscx_irq.c +++ b/drivers/isdn/hisax/hscx_irq.c | |||
@@ -119,7 +119,7 @@ hscx_fill_fifo(struct BCState *bcs) | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | static inline void | 122 | static void |
123 | hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) | 123 | hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) |
124 | { | 124 | { |
125 | u_char r; | 125 | u_char r; |
@@ -221,7 +221,7 @@ hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx) | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | static inline void | 224 | static void |
225 | hscx_int_main(struct IsdnCardState *cs, u_char val) | 225 | hscx_int_main(struct IsdnCardState *cs, u_char val) |
226 | { | 226 | { |
227 | 227 | ||
diff --git a/drivers/isdn/hisax/jade_irq.c b/drivers/isdn/hisax/jade_irq.c index 08563400e4fd..1f201af15a0f 100644 --- a/drivers/isdn/hisax/jade_irq.c +++ b/drivers/isdn/hisax/jade_irq.c | |||
@@ -110,7 +110,7 @@ jade_fill_fifo(struct BCState *bcs) | |||
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | static inline void | 113 | static void |
114 | jade_interrupt(struct IsdnCardState *cs, u_char val, u_char jade) | 114 | jade_interrupt(struct IsdnCardState *cs, u_char val, u_char jade) |
115 | { | 115 | { |
116 | u_char r; | 116 | u_char r; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 76a189ceb529..eae4473eadde 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -200,7 +200,7 @@ out: | |||
200 | /* if page is completely empty, put it back on the free list, or dealloc it */ | 200 | /* if page is completely empty, put it back on the free list, or dealloc it */ |
201 | /* if page was hijacked, unmark the flag so it might get alloced next time */ | 201 | /* if page was hijacked, unmark the flag so it might get alloced next time */ |
202 | /* Note: lock should be held when calling this */ | 202 | /* Note: lock should be held when calling this */ |
203 | static inline void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) | 203 | static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) |
204 | { | 204 | { |
205 | char *ptr; | 205 | char *ptr; |
206 | 206 | ||
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index a601a427885c..e7a650f9ca07 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -228,7 +228,7 @@ static struct crypt_iv_operations crypt_iv_essiv_ops = { | |||
228 | }; | 228 | }; |
229 | 229 | ||
230 | 230 | ||
231 | static inline int | 231 | static int |
232 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, | 232 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, |
233 | struct scatterlist *in, unsigned int length, | 233 | struct scatterlist *in, unsigned int length, |
234 | int write, sector_t sector) | 234 | int write, sector_t sector) |
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 561bda5011e0..1235135b384b 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -598,7 +598,7 @@ static int dev_create(struct dm_ioctl *param, size_t param_size) | |||
598 | /* | 598 | /* |
599 | * Always use UUID for lookups if it's present, otherwise use name or dev. | 599 | * Always use UUID for lookups if it's present, otherwise use name or dev. |
600 | */ | 600 | */ |
601 | static inline struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) | 601 | static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) |
602 | { | 602 | { |
603 | if (*param->uuid) | 603 | if (*param->uuid) |
604 | return __get_uuid_cell(param->uuid); | 604 | return __get_uuid_cell(param->uuid); |
@@ -608,7 +608,7 @@ static inline struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) | |||
608 | return dm_get_mdptr(huge_decode_dev(param->dev)); | 608 | return dm_get_mdptr(huge_decode_dev(param->dev)); |
609 | } | 609 | } |
610 | 610 | ||
611 | static inline struct mapped_device *find_device(struct dm_ioctl *param) | 611 | static struct mapped_device *find_device(struct dm_ioctl *param) |
612 | { | 612 | { |
613 | struct hash_cell *hc; | 613 | struct hash_cell *hc; |
614 | struct mapped_device *md = NULL; | 614 | struct mapped_device *md = NULL; |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 4b9dd8fb1e5c..87727d84dbba 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -691,7 +691,7 @@ static void copy_callback(int read_err, unsigned int write_err, void *context) | |||
691 | /* | 691 | /* |
692 | * Dispatches the copy operation to kcopyd. | 692 | * Dispatches the copy operation to kcopyd. |
693 | */ | 693 | */ |
694 | static inline void start_copy(struct pending_exception *pe) | 694 | static void start_copy(struct pending_exception *pe) |
695 | { | 695 | { |
696 | struct dm_snapshot *s = pe->snap; | 696 | struct dm_snapshot *s = pe->snap; |
697 | struct io_region src, dest; | 697 | struct io_region src, dest; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 097d1e540090..8c16359f8b01 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -293,7 +293,7 @@ struct dm_table *dm_get_table(struct mapped_device *md) | |||
293 | * Decrements the number of outstanding ios that a bio has been | 293 | * Decrements the number of outstanding ios that a bio has been |
294 | * cloned into, completing the original io if necc. | 294 | * cloned into, completing the original io if necc. |
295 | */ | 295 | */ |
296 | static inline void dec_pending(struct dm_io *io, int error) | 296 | static void dec_pending(struct dm_io *io, int error) |
297 | { | 297 | { |
298 | if (error) | 298 | if (error) |
299 | io->error = error; | 299 | io->error = error; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a06ff91f27e2..d39f584cd8b3 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -176,7 +176,7 @@ static void put_all_bios(conf_t *conf, r1bio_t *r1_bio) | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | static inline void free_r1bio(r1bio_t *r1_bio) | 179 | static void free_r1bio(r1bio_t *r1_bio) |
180 | { | 180 | { |
181 | conf_t *conf = mddev_to_conf(r1_bio->mddev); | 181 | conf_t *conf = mddev_to_conf(r1_bio->mddev); |
182 | 182 | ||
@@ -190,7 +190,7 @@ static inline void free_r1bio(r1bio_t *r1_bio) | |||
190 | mempool_free(r1_bio, conf->r1bio_pool); | 190 | mempool_free(r1_bio, conf->r1bio_pool); |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void put_buf(r1bio_t *r1_bio) | 193 | static void put_buf(r1bio_t *r1_bio) |
194 | { | 194 | { |
195 | conf_t *conf = mddev_to_conf(r1_bio->mddev); | 195 | conf_t *conf = mddev_to_conf(r1_bio->mddev); |
196 | int i; | 196 | int i; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 9e658e519a27..9130d051b474 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -176,7 +176,7 @@ static void put_all_bios(conf_t *conf, r10bio_t *r10_bio) | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | static inline void free_r10bio(r10bio_t *r10_bio) | 179 | static void free_r10bio(r10bio_t *r10_bio) |
180 | { | 180 | { |
181 | conf_t *conf = mddev_to_conf(r10_bio->mddev); | 181 | conf_t *conf = mddev_to_conf(r10_bio->mddev); |
182 | 182 | ||
@@ -190,7 +190,7 @@ static inline void free_r10bio(r10bio_t *r10_bio) | |||
190 | mempool_free(r10_bio, conf->r10bio_pool); | 190 | mempool_free(r10_bio, conf->r10bio_pool); |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void put_buf(r10bio_t *r10_bio) | 193 | static void put_buf(r10bio_t *r10_bio) |
194 | { | 194 | { |
195 | conf_t *conf = mddev_to_conf(r10_bio->mddev); | 195 | conf_t *conf = mddev_to_conf(r10_bio->mddev); |
196 | 196 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 54f4a9847e38..25976bfb6f9c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -69,7 +69,7 @@ | |||
69 | 69 | ||
70 | static void print_raid5_conf (raid5_conf_t *conf); | 70 | static void print_raid5_conf (raid5_conf_t *conf); |
71 | 71 | ||
72 | static inline void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) | 72 | static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) |
73 | { | 73 | { |
74 | if (atomic_dec_and_test(&sh->count)) { | 74 | if (atomic_dec_and_test(&sh->count)) { |
75 | if (!list_empty(&sh->lru)) | 75 | if (!list_empty(&sh->lru)) |
@@ -118,7 +118,7 @@ static inline void remove_hash(struct stripe_head *sh) | |||
118 | hlist_del_init(&sh->hash); | 118 | hlist_del_init(&sh->hash); |
119 | } | 119 | } |
120 | 120 | ||
121 | static inline void insert_hash(raid5_conf_t *conf, struct stripe_head *sh) | 121 | static void insert_hash(raid5_conf_t *conf, struct stripe_head *sh) |
122 | { | 122 | { |
123 | struct hlist_head *hp = stripe_hash(conf, sh->sector); | 123 | struct hlist_head *hp = stripe_hash(conf, sh->sector); |
124 | 124 | ||
@@ -178,7 +178,7 @@ static int grow_buffers(struct stripe_head *sh, int num) | |||
178 | 178 | ||
179 | static void raid5_build_block (struct stripe_head *sh, int i); | 179 | static void raid5_build_block (struct stripe_head *sh, int i); |
180 | 180 | ||
181 | static inline void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx) | 181 | static void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx) |
182 | { | 182 | { |
183 | raid5_conf_t *conf = sh->raid_conf; | 183 | raid5_conf_t *conf = sh->raid_conf; |
184 | int disks = conf->raid_disks, i; | 184 | int disks = conf->raid_disks, i; |
@@ -1415,7 +1415,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
1415 | } | 1415 | } |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | static inline void raid5_activate_delayed(raid5_conf_t *conf) | 1418 | static void raid5_activate_delayed(raid5_conf_t *conf) |
1419 | { | 1419 | { |
1420 | if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) { | 1420 | if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) { |
1421 | while (!list_empty(&conf->delayed_list)) { | 1421 | while (!list_empty(&conf->delayed_list)) { |
@@ -1431,7 +1431,7 @@ static inline void raid5_activate_delayed(raid5_conf_t *conf) | |||
1431 | } | 1431 | } |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | static inline void activate_bit_delay(raid5_conf_t *conf) | 1434 | static void activate_bit_delay(raid5_conf_t *conf) |
1435 | { | 1435 | { |
1436 | /* device_lock is held */ | 1436 | /* device_lock is held */ |
1437 | struct list_head head; | 1437 | struct list_head head; |
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 8c823d686a60..f618a53b98be 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -88,7 +88,7 @@ static inline int raid6_next_disk(int disk, int raid_disks) | |||
88 | 88 | ||
89 | static void print_raid6_conf (raid6_conf_t *conf); | 89 | static void print_raid6_conf (raid6_conf_t *conf); |
90 | 90 | ||
91 | static inline void __release_stripe(raid6_conf_t *conf, struct stripe_head *sh) | 91 | static void __release_stripe(raid6_conf_t *conf, struct stripe_head *sh) |
92 | { | 92 | { |
93 | if (atomic_dec_and_test(&sh->count)) { | 93 | if (atomic_dec_and_test(&sh->count)) { |
94 | if (!list_empty(&sh->lru)) | 94 | if (!list_empty(&sh->lru)) |
@@ -197,7 +197,7 @@ static int grow_buffers(struct stripe_head *sh, int num) | |||
197 | 197 | ||
198 | static void raid6_build_block (struct stripe_head *sh, int i); | 198 | static void raid6_build_block (struct stripe_head *sh, int i); |
199 | 199 | ||
200 | static inline void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx) | 200 | static void init_stripe(struct stripe_head *sh, sector_t sector, int pd_idx) |
201 | { | 201 | { |
202 | raid6_conf_t *conf = sh->raid_conf; | 202 | raid6_conf_t *conf = sh->raid_conf; |
203 | int disks = conf->raid_disks, i; | 203 | int disks = conf->raid_disks, i; |
@@ -1577,7 +1577,7 @@ static void handle_stripe(struct stripe_head *sh, struct page *tmp_page) | |||
1577 | } | 1577 | } |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static inline void raid6_activate_delayed(raid6_conf_t *conf) | 1580 | static void raid6_activate_delayed(raid6_conf_t *conf) |
1581 | { | 1581 | { |
1582 | if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) { | 1582 | if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) { |
1583 | while (!list_empty(&conf->delayed_list)) { | 1583 | while (!list_empty(&conf->delayed_list)) { |
@@ -1593,7 +1593,7 @@ static inline void raid6_activate_delayed(raid6_conf_t *conf) | |||
1593 | } | 1593 | } |
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | static inline void activate_bit_delay(raid6_conf_t *conf) | 1596 | static void activate_bit_delay(raid6_conf_t *conf) |
1597 | { | 1597 | { |
1598 | /* device_lock is held */ | 1598 | /* device_lock is held */ |
1599 | struct list_head head; | 1599 | struct list_head head; |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index e86b522938fd..9094fa9f2ecb 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -93,7 +93,7 @@ struct tvp5150 { | |||
93 | int sat; | 93 | int sat; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static inline int tvp5150_read(struct i2c_client *c, unsigned char addr) | 96 | static int tvp5150_read(struct i2c_client *c, unsigned char addr) |
97 | { | 97 | { |
98 | unsigned char buffer[1]; | 98 | unsigned char buffer[1]; |
99 | int rc; | 99 | int rc; |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index ea3288661a34..246e67cd8b51 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -995,7 +995,7 @@ test_interrupts (struct zoran *zr) | |||
995 | static int __devinit | 995 | static int __devinit |
996 | zr36057_init (struct zoran *zr) | 996 | zr36057_init (struct zoran *zr) |
997 | { | 997 | { |
998 | unsigned long mem; | 998 | u32 *mem; |
999 | void *vdev; | 999 | void *vdev; |
1000 | unsigned mem_needed; | 1000 | unsigned mem_needed; |
1001 | int j; | 1001 | int j; |
@@ -1058,10 +1058,10 @@ zr36057_init (struct zoran *zr) | |||
1058 | "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", | 1058 | "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", |
1059 | ZR_DEVNAME(zr)); | 1059 | ZR_DEVNAME(zr)); |
1060 | kfree(vdev); | 1060 | kfree(vdev); |
1061 | kfree((void *)mem); | 1061 | kfree(mem); |
1062 | return -ENOMEM; | 1062 | return -ENOMEM; |
1063 | } | 1063 | } |
1064 | zr->stat_com = (u32 *) mem; | 1064 | zr->stat_com = mem; |
1065 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | 1065 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { |
1066 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ | 1066 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ |
1067 | } | 1067 | } |
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index 0b1b72825ae2..73f59528212a 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c | |||
@@ -844,7 +844,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
844 | } | 844 | } |
845 | 845 | ||
846 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 846 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
847 | static inline void | 847 | static void |
848 | mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) | 848 | mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) |
849 | /* | 849 | /* |
850 | * @priority: 0 = put it on the timer queue, 1 = put it on the immediate queue | 850 | * @priority: 0 = put it on the timer queue, 1 = put it on the immediate queue |
@@ -866,7 +866,7 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) | |||
866 | } | 866 | } |
867 | 867 | ||
868 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 868 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
869 | static inline int | 869 | static int |
870 | mpt_lan_receive_skb(struct net_device *dev, struct sk_buff *skb) | 870 | mpt_lan_receive_skb(struct net_device *dev, struct sk_buff *skb) |
871 | { | 871 | { |
872 | struct mpt_lan_priv *priv = dev->priv; | 872 | struct mpt_lan_priv *priv = dev->priv; |
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 9b7c37e0e574..5b014c370e80 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -462,9 +462,10 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
462 | if (err) | 462 | if (err) |
463 | goto out; | 463 | goto out; |
464 | 464 | ||
465 | printk(KERN_INFO "%s: %s %s %luKiB %s\n", | 465 | printk(KERN_INFO "%s: %s %s %lluKiB %s\n", |
466 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), | 466 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), |
467 | get_capacity(md->disk) >> 1, md->read_only ? "(ro)" : ""); | 467 | (unsigned long long)(get_capacity(md->disk) >> 1), |
468 | md->read_only ? "(ro)" : ""); | ||
468 | 469 | ||
469 | mmc_set_drvdata(card, md); | 470 | mmc_set_drvdata(card, md); |
470 | add_disk(md->disk); | 471 | add_disk(md->disk); |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index be5e88b3888d..e4345cf744a2 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -138,7 +138,7 @@ static inline int DoC_WaitReady(struct DiskOnChip *doc) | |||
138 | bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is | 138 | bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is |
139 | required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */ | 139 | required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */ |
140 | 140 | ||
141 | static inline int DoC_Command(struct DiskOnChip *doc, unsigned char command, | 141 | static int DoC_Command(struct DiskOnChip *doc, unsigned char command, |
142 | unsigned char xtraflags) | 142 | unsigned char xtraflags) |
143 | { | 143 | { |
144 | void __iomem *docptr = doc->virtadr; | 144 | void __iomem *docptr = doc->virtadr; |
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c index fcb28a6fd89f..681a9c73a2a3 100644 --- a/drivers/mtd/devices/doc2001.c +++ b/drivers/mtd/devices/doc2001.c | |||
@@ -103,7 +103,7 @@ static inline int DoC_WaitReady(void __iomem * docptr) | |||
103 | with the internal pipeline. Each of 4 delay cycles (read from the NOP register) is | 103 | with the internal pipeline. Each of 4 delay cycles (read from the NOP register) is |
104 | required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */ | 104 | required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */ |
105 | 105 | ||
106 | static inline void DoC_Command(void __iomem * docptr, unsigned char command, | 106 | static void DoC_Command(void __iomem * docptr, unsigned char command, |
107 | unsigned char xtraflags) | 107 | unsigned char xtraflags) |
108 | { | 108 | { |
109 | /* Assert the CLE (Command Latch Enable) line to the flash chip */ | 109 | /* Assert the CLE (Command Latch Enable) line to the flash chip */ |
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 0595cc7324b2..5f57f29efee4 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -118,7 +118,7 @@ static inline void DoC_CheckASIC(void __iomem * docptr) | |||
118 | /* DoC_Command: Send a flash command to the flash chip through the Flash | 118 | /* DoC_Command: Send a flash command to the flash chip through the Flash |
119 | * command register. Need 2 Write Pipeline Terminates to complete send. | 119 | * command register. Need 2 Write Pipeline Terminates to complete send. |
120 | */ | 120 | */ |
121 | static inline void DoC_Command(void __iomem * docptr, unsigned char command, | 121 | static void DoC_Command(void __iomem * docptr, unsigned char command, |
122 | unsigned char xtraflags) | 122 | unsigned char xtraflags) |
123 | { | 123 | { |
124 | WriteDOC(command, docptr, Mplus_FlashCmd); | 124 | WriteDOC(command, docptr, Mplus_FlashCmd); |
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index 21d4e8f4b7af..ec5e45e4e4ef 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
@@ -1506,7 +1506,7 @@ static inline int __init doc2001plus_init(struct mtd_info *mtd) | |||
1506 | return 1; | 1506 | return 1; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | static inline int __init doc_probe(unsigned long physadr) | 1509 | static int __init doc_probe(unsigned long physadr) |
1510 | { | 1510 | { |
1511 | unsigned char ChipID; | 1511 | unsigned char ChipID; |
1512 | struct mtd_info *mtd; | 1512 | struct mtd_info *mtd; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index de46e75efb44..1421941487c4 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1387,7 +1387,7 @@ config FORCEDETH | |||
1387 | 1387 | ||
1388 | config CS89x0 | 1388 | config CS89x0 |
1389 | tristate "CS89x0 support" | 1389 | tristate "CS89x0 support" |
1390 | depends on NET_PCI && (ISA || ARCH_IXDP2X01 || ARCH_PNX010X) | 1390 | depends on NET_PCI && (ISA || MACH_IXDP2351 || ARCH_IXDP2X01 || ARCH_PNX010X) |
1391 | ---help--- | 1391 | ---help--- |
1392 | Support for CS89x0 chipset based Ethernet cards. If you have a | 1392 | Support for CS89x0 chipset based Ethernet cards. If you have a |
1393 | network (Ethernet) card of this type, say Y and read the | 1393 | network (Ethernet) card of this type, say Y and read the |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index e2cfde7e31ec..fab6586d87e9 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -87,6 +87,12 @@ | |||
87 | Deepak Saxena : dsaxena@plexity.net | 87 | Deepak Saxena : dsaxena@plexity.net |
88 | : Intel IXDP2x01 (XScale ixp2x00 NPU) platform support | 88 | : Intel IXDP2x01 (XScale ixp2x00 NPU) platform support |
89 | 89 | ||
90 | Dmitry Pervushin : dpervushin@ru.mvista.com | ||
91 | : PNX010X platform support | ||
92 | |||
93 | Deepak Saxena : dsaxena@plexity.net | ||
94 | : Intel IXDP2351 platform support | ||
95 | |||
90 | */ | 96 | */ |
91 | 97 | ||
92 | /* Always include 'config.h' first in case the user wants to turn on | 98 | /* Always include 'config.h' first in case the user wants to turn on |
@@ -171,6 +177,10 @@ static unsigned int cs8900_irq_map[] = {12,0,0,0}; | |||
171 | static unsigned int netcard_portlist[] __initdata = | 177 | static unsigned int netcard_portlist[] __initdata = |
172 | { 0x0300, 0}; | 178 | { 0x0300, 0}; |
173 | static unsigned int cs8900_irq_map[] = {1,0,0,0}; | 179 | static unsigned int cs8900_irq_map[] = {1,0,0,0}; |
180 | #elif defined(CONFIG_MACH_IXDP2351) | ||
181 | static unsigned int netcard_portlist[] __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | ||
182 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | ||
183 | #include <asm/irq.h> | ||
174 | #elif defined(CONFIG_ARCH_IXDP2X01) | 184 | #elif defined(CONFIG_ARCH_IXDP2X01) |
175 | #include <asm/irq.h> | 185 | #include <asm/irq.h> |
176 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 186 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
@@ -338,45 +348,55 @@ out: | |||
338 | } | 348 | } |
339 | #endif | 349 | #endif |
340 | 350 | ||
341 | #if defined(CONFIG_ARCH_IXDP2X01) | 351 | #if defined(CONFIG_MACH_IXDP2351) |
342 | static int | 352 | static u16 |
343 | readword(unsigned long base_addr, int portno) | 353 | readword(unsigned long base_addr, int portno) |
344 | { | 354 | { |
345 | return (u16)__raw_readl(base_addr + (portno << 1)); | 355 | return __raw_readw(base_addr + (portno << 1)); |
346 | } | 356 | } |
347 | 357 | ||
348 | static void | 358 | static void |
349 | writeword(unsigned long base_addr, int portno, int value) | 359 | writeword(unsigned long base_addr, int portno, u16 value) |
350 | { | 360 | { |
351 | __raw_writel((u16)value, base_addr + (portno << 1)); | 361 | __raw_writew(value, base_addr + (portno << 1)); |
352 | } | 362 | } |
353 | #else | 363 | #elif defined(CONFIG_ARCH_IXDP2X01) |
354 | #if defined(CONFIG_ARCH_PNX010X) | 364 | static u16 |
355 | static int | 365 | readword(unsigned long base_addr, int portno) |
366 | { | ||
367 | return __raw_readl(base_addr + (portno << 1)); | ||
368 | } | ||
369 | |||
370 | static void | ||
371 | writeword(unsigned long base_addr, int portno, u16 value) | ||
372 | { | ||
373 | __raw_writel(value, base_addr + (portno << 1)); | ||
374 | } | ||
375 | #elif defined(CONFIG_ARCH_PNX010X) | ||
376 | static u16 | ||
356 | readword(unsigned long base_addr, int portno) | 377 | readword(unsigned long base_addr, int portno) |
357 | { | 378 | { |
358 | return inw(base_addr + (portno << 1)); | 379 | return inw(base_addr + (portno << 1)); |
359 | } | 380 | } |
360 | 381 | ||
361 | static void | 382 | static void |
362 | writeword(unsigned long base_addr, int portno, int value) | 383 | writeword(unsigned long base_addr, int portno, u16 value) |
363 | { | 384 | { |
364 | outw(value, base_addr + (portno << 1)); | 385 | outw(value, base_addr + (portno << 1)); |
365 | } | 386 | } |
366 | #else | 387 | #else |
367 | static int | 388 | static u16 |
368 | readword(unsigned long base_addr, int portno) | 389 | readword(unsigned long base_addr, int portno) |
369 | { | 390 | { |
370 | return inw(base_addr + portno); | 391 | return inw(base_addr + portno); |
371 | } | 392 | } |
372 | 393 | ||
373 | static void | 394 | static void |
374 | writeword(unsigned long base_addr, int portno, int value) | 395 | writeword(unsigned long base_addr, int portno, u16 value) |
375 | { | 396 | { |
376 | outw(value, base_addr + portno); | 397 | outw(value, base_addr + portno); |
377 | } | 398 | } |
378 | #endif | 399 | #endif |
379 | #endif | ||
380 | 400 | ||
381 | static void | 401 | static void |
382 | readwords(unsigned long base_addr, int portno, void *buf, int length) | 402 | readwords(unsigned long base_addr, int portno, void *buf, int length) |
@@ -384,11 +404,11 @@ readwords(unsigned long base_addr, int portno, void *buf, int length) | |||
384 | u8 *buf8 = (u8 *)buf; | 404 | u8 *buf8 = (u8 *)buf; |
385 | 405 | ||
386 | do { | 406 | do { |
387 | u32 tmp32; | 407 | u16 tmp16; |
388 | 408 | ||
389 | tmp32 = readword(base_addr, portno); | 409 | tmp16 = readword(base_addr, portno); |
390 | *buf8++ = (u8)tmp32; | 410 | *buf8++ = (u8)tmp16; |
391 | *buf8++ = (u8)(tmp32 >> 8); | 411 | *buf8++ = (u8)(tmp16 >> 8); |
392 | } while (--length); | 412 | } while (--length); |
393 | } | 413 | } |
394 | 414 | ||
@@ -398,23 +418,23 @@ writewords(unsigned long base_addr, int portno, void *buf, int length) | |||
398 | u8 *buf8 = (u8 *)buf; | 418 | u8 *buf8 = (u8 *)buf; |
399 | 419 | ||
400 | do { | 420 | do { |
401 | u32 tmp32; | 421 | u16 tmp16; |
402 | 422 | ||
403 | tmp32 = *buf8++; | 423 | tmp16 = *buf8++; |
404 | tmp32 |= (*buf8++) << 8; | 424 | tmp16 |= (*buf8++) << 8; |
405 | writeword(base_addr, portno, tmp32); | 425 | writeword(base_addr, portno, tmp16); |
406 | } while (--length); | 426 | } while (--length); |
407 | } | 427 | } |
408 | 428 | ||
409 | static int | 429 | static u16 |
410 | readreg(struct net_device *dev, int regno) | 430 | readreg(struct net_device *dev, u16 regno) |
411 | { | 431 | { |
412 | writeword(dev->base_addr, ADD_PORT, regno); | 432 | writeword(dev->base_addr, ADD_PORT, regno); |
413 | return readword(dev->base_addr, DATA_PORT); | 433 | return readword(dev->base_addr, DATA_PORT); |
414 | } | 434 | } |
415 | 435 | ||
416 | static void | 436 | static void |
417 | writereg(struct net_device *dev, int regno, int value) | 437 | writereg(struct net_device *dev, u16 regno, u16 value) |
418 | { | 438 | { |
419 | writeword(dev->base_addr, ADD_PORT, regno); | 439 | writeword(dev->base_addr, ADD_PORT, regno); |
420 | writeword(dev->base_addr, DATA_PORT, value); | 440 | writeword(dev->base_addr, DATA_PORT, value); |
@@ -780,7 +800,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
780 | } else { | 800 | } else { |
781 | i = lp->isa_config & INT_NO_MASK; | 801 | i = lp->isa_config & INT_NO_MASK; |
782 | if (lp->chip_type == CS8900) { | 802 | if (lp->chip_type == CS8900) { |
783 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) | 803 | #if defined(CONFIG_MACH_IXDP2351) || defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) |
784 | i = cs8900_irq_map[0]; | 804 | i = cs8900_irq_map[0]; |
785 | #else | 805 | #else |
786 | /* Translate the IRQ using the IRQ mapping table. */ | 806 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -1012,7 +1032,7 @@ skip_this_frame: | |||
1012 | 1032 | ||
1013 | void __init reset_chip(struct net_device *dev) | 1033 | void __init reset_chip(struct net_device *dev) |
1014 | { | 1034 | { |
1015 | #ifndef CONFIG_ARCH_IXDP2X01 | 1035 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) |
1016 | struct net_local *lp = netdev_priv(dev); | 1036 | struct net_local *lp = netdev_priv(dev); |
1017 | int ioaddr = dev->base_addr; | 1037 | int ioaddr = dev->base_addr; |
1018 | #endif | 1038 | #endif |
@@ -1023,7 +1043,7 @@ void __init reset_chip(struct net_device *dev) | |||
1023 | /* wait 30 ms */ | 1043 | /* wait 30 ms */ |
1024 | msleep(30); | 1044 | msleep(30); |
1025 | 1045 | ||
1026 | #ifndef CONFIG_ARCH_IXDP2X01 | 1046 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) |
1027 | if (lp->chip_type != CS8900) { | 1047 | if (lp->chip_type != CS8900) { |
1028 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ | 1048 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ |
1029 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); | 1049 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); |
@@ -1287,7 +1307,7 @@ net_open(struct net_device *dev) | |||
1287 | else | 1307 | else |
1288 | #endif | 1308 | #endif |
1289 | { | 1309 | { |
1290 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) | 1310 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) |
1291 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1311 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1292 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1312 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1293 | dev->name, dev->irq, lp->irq_map); | 1313 | dev->name, dev->irq, lp->irq_map); |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 23de22631c64..4726722a0635 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -592,7 +592,7 @@ static inline void e100_write_flush(struct nic *nic) | |||
592 | (void)readb(&nic->csr->scb.status); | 592 | (void)readb(&nic->csr->scb.status); |
593 | } | 593 | } |
594 | 594 | ||
595 | static inline void e100_enable_irq(struct nic *nic) | 595 | static void e100_enable_irq(struct nic *nic) |
596 | { | 596 | { |
597 | unsigned long flags; | 597 | unsigned long flags; |
598 | 598 | ||
@@ -602,7 +602,7 @@ static inline void e100_enable_irq(struct nic *nic) | |||
602 | e100_write_flush(nic); | 602 | e100_write_flush(nic); |
603 | } | 603 | } |
604 | 604 | ||
605 | static inline void e100_disable_irq(struct nic *nic) | 605 | static void e100_disable_irq(struct nic *nic) |
606 | { | 606 | { |
607 | unsigned long flags; | 607 | unsigned long flags; |
608 | 608 | ||
@@ -791,7 +791,7 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count) | |||
791 | 791 | ||
792 | #define E100_WAIT_SCB_TIMEOUT 20000 /* we might have to wait 100ms!!! */ | 792 | #define E100_WAIT_SCB_TIMEOUT 20000 /* we might have to wait 100ms!!! */ |
793 | #define E100_WAIT_SCB_FAST 20 /* delay like the old code */ | 793 | #define E100_WAIT_SCB_FAST 20 /* delay like the old code */ |
794 | static inline int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr) | 794 | static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr) |
795 | { | 795 | { |
796 | unsigned long flags; | 796 | unsigned long flags; |
797 | unsigned int i; | 797 | unsigned int i; |
@@ -822,7 +822,7 @@ err_unlock: | |||
822 | return err; | 822 | return err; |
823 | } | 823 | } |
824 | 824 | ||
825 | static inline int e100_exec_cb(struct nic *nic, struct sk_buff *skb, | 825 | static int e100_exec_cb(struct nic *nic, struct sk_buff *skb, |
826 | void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) | 826 | void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) |
827 | { | 827 | { |
828 | struct cb *cb; | 828 | struct cb *cb; |
@@ -1567,7 +1567,7 @@ static void e100_watchdog(unsigned long data) | |||
1567 | mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD); | 1567 | mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD); |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | static inline void e100_xmit_prepare(struct nic *nic, struct cb *cb, | 1570 | static void e100_xmit_prepare(struct nic *nic, struct cb *cb, |
1571 | struct sk_buff *skb) | 1571 | struct sk_buff *skb) |
1572 | { | 1572 | { |
1573 | cb->command = nic->tx_command; | 1573 | cb->command = nic->tx_command; |
@@ -1617,7 +1617,7 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1617 | return 0; | 1617 | return 0; |
1618 | } | 1618 | } |
1619 | 1619 | ||
1620 | static inline int e100_tx_clean(struct nic *nic) | 1620 | static int e100_tx_clean(struct nic *nic) |
1621 | { | 1621 | { |
1622 | struct cb *cb; | 1622 | struct cb *cb; |
1623 | int tx_cleaned = 0; | 1623 | int tx_cleaned = 0; |
@@ -1728,7 +1728,7 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx) | |||
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) | 1730 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) |
1731 | static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | 1731 | static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) |
1732 | { | 1732 | { |
1733 | if(!(rx->skb = dev_alloc_skb(RFD_BUF_LEN + NET_IP_ALIGN))) | 1733 | if(!(rx->skb = dev_alloc_skb(RFD_BUF_LEN + NET_IP_ALIGN))) |
1734 | return -ENOMEM; | 1734 | return -ENOMEM; |
@@ -1762,7 +1762,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1762 | return 0; | 1762 | return 0; |
1763 | } | 1763 | } |
1764 | 1764 | ||
1765 | static inline int e100_rx_indicate(struct nic *nic, struct rx *rx, | 1765 | static int e100_rx_indicate(struct nic *nic, struct rx *rx, |
1766 | unsigned int *work_done, unsigned int work_to_do) | 1766 | unsigned int *work_done, unsigned int work_to_do) |
1767 | { | 1767 | { |
1768 | struct sk_buff *skb = rx->skb; | 1768 | struct sk_buff *skb = rx->skb; |
@@ -1822,7 +1822,7 @@ static inline int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1822 | return 0; | 1822 | return 0; |
1823 | } | 1823 | } |
1824 | 1824 | ||
1825 | static inline void e100_rx_clean(struct nic *nic, unsigned int *work_done, | 1825 | static void e100_rx_clean(struct nic *nic, unsigned int *work_done, |
1826 | unsigned int work_to_do) | 1826 | unsigned int work_to_do) |
1827 | { | 1827 | { |
1828 | struct rx *rx; | 1828 | struct rx *rx; |
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c index d6388e1533f0..76139478c3df 100644 --- a/drivers/net/sb1000.c +++ b/drivers/net/sb1000.c | |||
@@ -94,7 +94,7 @@ static inline int card_wait_for_busy_clear(const int ioaddr[], | |||
94 | const char* name); | 94 | const char* name); |
95 | static inline int card_wait_for_ready(const int ioaddr[], const char* name, | 95 | static inline int card_wait_for_ready(const int ioaddr[], const char* name, |
96 | unsigned char in[]); | 96 | unsigned char in[]); |
97 | static inline int card_send_command(const int ioaddr[], const char* name, | 97 | static int card_send_command(const int ioaddr[], const char* name, |
98 | const unsigned char out[], unsigned char in[]); | 98 | const unsigned char out[], unsigned char in[]); |
99 | 99 | ||
100 | /* SB1000 hardware routines to be used during frame rx interrupt */ | 100 | /* SB1000 hardware routines to be used during frame rx interrupt */ |
@@ -309,7 +309,7 @@ card_wait_for_ready(const int ioaddr[], const char* name, unsigned char in[]) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | /* Card Send Command (cannot be used during an interrupt) */ | 311 | /* Card Send Command (cannot be used during an interrupt) */ |
312 | static inline int | 312 | static int |
313 | card_send_command(const int ioaddr[], const char* name, | 313 | card_send_command(const int ioaddr[], const char* name, |
314 | const unsigned char out[], unsigned char in[]) | 314 | const unsigned char out[], unsigned char in[]) |
315 | { | 315 | { |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index ffac50899454..4b13b76425c1 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -435,7 +435,7 @@ static void hostap_rx_sta_beacon(local_info_t *local, struct sk_buff *skb, | |||
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | static inline int | 438 | static int |
439 | hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, | 439 | hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, |
440 | struct hostap_80211_rx_status *rx_stats, u16 type, | 440 | struct hostap_80211_rx_status *rx_stats, u16 type, |
441 | u16 stype) | 441 | u16 stype) |
@@ -499,7 +499,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, | |||
499 | 499 | ||
500 | 500 | ||
501 | /* Called only as a tasklet (software IRQ) */ | 501 | /* Called only as a tasklet (software IRQ) */ |
502 | static inline struct net_device *prism2_rx_get_wds(local_info_t *local, | 502 | static struct net_device *prism2_rx_get_wds(local_info_t *local, |
503 | u8 *addr) | 503 | u8 *addr) |
504 | { | 504 | { |
505 | struct hostap_interface *iface = NULL; | 505 | struct hostap_interface *iface = NULL; |
@@ -519,7 +519,7 @@ static inline struct net_device *prism2_rx_get_wds(local_info_t *local, | |||
519 | } | 519 | } |
520 | 520 | ||
521 | 521 | ||
522 | static inline int | 522 | static int |
523 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr, | 523 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr, |
524 | u16 fc, struct net_device **wds) | 524 | u16 fc, struct net_device **wds) |
525 | { | 525 | { |
@@ -615,7 +615,7 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) | |||
615 | 615 | ||
616 | 616 | ||
617 | /* Called only as a tasklet (software IRQ) */ | 617 | /* Called only as a tasklet (software IRQ) */ |
618 | static inline int | 618 | static int |
619 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, | 619 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, |
620 | struct ieee80211_crypt_data *crypt) | 620 | struct ieee80211_crypt_data *crypt) |
621 | { | 621 | { |
@@ -654,7 +654,7 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, | |||
654 | 654 | ||
655 | 655 | ||
656 | /* Called only as a tasklet (software IRQ) */ | 656 | /* Called only as a tasklet (software IRQ) */ |
657 | static inline int | 657 | static int |
658 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, | 658 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, |
659 | int keyidx, struct ieee80211_crypt_data *crypt) | 659 | int keyidx, struct ieee80211_crypt_data *crypt) |
660 | { | 660 | { |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index abfae7fedebc..b1f142d9e232 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -253,7 +253,7 @@ static void prism2_clear_cmd_queue(local_info_t *local) | |||
253 | * @dev: pointer to net_device | 253 | * @dev: pointer to net_device |
254 | * @entry: Prism2 command queue entry to be issued | 254 | * @entry: Prism2 command queue entry to be issued |
255 | */ | 255 | */ |
256 | static inline int hfa384x_cmd_issue(struct net_device *dev, | 256 | static int hfa384x_cmd_issue(struct net_device *dev, |
257 | struct hostap_cmd_queue *entry) | 257 | struct hostap_cmd_queue *entry) |
258 | { | 258 | { |
259 | struct hostap_interface *iface; | 259 | struct hostap_interface *iface; |
@@ -743,7 +743,7 @@ static void prism2_cmd_ev(struct net_device *dev) | |||
743 | } | 743 | } |
744 | 744 | ||
745 | 745 | ||
746 | static inline int hfa384x_wait_offset(struct net_device *dev, u16 o_off) | 746 | static int hfa384x_wait_offset(struct net_device *dev, u16 o_off) |
747 | { | 747 | { |
748 | int tries = HFA384X_BAP_BUSY_TIMEOUT; | 748 | int tries = HFA384X_BAP_BUSY_TIMEOUT; |
749 | int res = HFA384X_INW(o_off) & HFA384X_OFFSET_BUSY; | 749 | int res = HFA384X_INW(o_off) & HFA384X_OFFSET_BUSY; |
@@ -1904,7 +1904,7 @@ fail: | |||
1904 | * and will try to get the correct fid eventually. */ | 1904 | * and will try to get the correct fid eventually. */ |
1905 | #define EXTRA_FID_READ_TESTS | 1905 | #define EXTRA_FID_READ_TESTS |
1906 | 1906 | ||
1907 | static inline u16 prism2_read_fid_reg(struct net_device *dev, u16 reg) | 1907 | static u16 prism2_read_fid_reg(struct net_device *dev, u16 reg) |
1908 | { | 1908 | { |
1909 | #ifdef EXTRA_FID_READ_TESTS | 1909 | #ifdef EXTRA_FID_READ_TESTS |
1910 | u16 val, val2, val3; | 1910 | u16 val, val2, val3; |
@@ -2581,7 +2581,7 @@ static void prism2_ev_tick(struct net_device *dev) | |||
2581 | 2581 | ||
2582 | 2582 | ||
2583 | /* Called only from hardware IRQ */ | 2583 | /* Called only from hardware IRQ */ |
2584 | static inline void prism2_check_magic(local_info_t *local) | 2584 | static void prism2_check_magic(local_info_t *local) |
2585 | { | 2585 | { |
2586 | /* at least PCI Prism2.5 with bus mastering seems to sometimes | 2586 | /* at least PCI Prism2.5 with bus mastering seems to sometimes |
2587 | * return 0x0000 in SWSUPPORT0 for unknown reason, but re-reading the | 2587 | * return 0x0000 in SWSUPPORT0 for unknown reason, but re-reading the |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index cf05661fb1bd..7518384f34d9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -411,7 +411,7 @@ static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) | |||
411 | write_register(dev, IPW_REG_AUTOINCREMENT_DATA, val); | 411 | write_register(dev, IPW_REG_AUTOINCREMENT_DATA, val); |
412 | } | 412 | } |
413 | 413 | ||
414 | static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | 414 | static void write_nic_memory(struct net_device *dev, u32 addr, u32 len, |
415 | const u8 * buf) | 415 | const u8 * buf) |
416 | { | 416 | { |
417 | u32 aligned_addr; | 417 | u32 aligned_addr; |
@@ -449,7 +449,7 @@ static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, | |||
449 | *buf); | 449 | *buf); |
450 | } | 450 | } |
451 | 451 | ||
452 | static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, | 452 | static void read_nic_memory(struct net_device *dev, u32 addr, u32 len, |
453 | u8 * buf) | 453 | u8 * buf) |
454 | { | 454 | { |
455 | u32 aligned_addr; | 455 | u32 aligned_addr; |
@@ -657,7 +657,7 @@ static void printk_buf(int level, const u8 * data, u32 len) | |||
657 | 657 | ||
658 | #define MAX_RESET_BACKOFF 10 | 658 | #define MAX_RESET_BACKOFF 10 |
659 | 659 | ||
660 | static inline void schedule_reset(struct ipw2100_priv *priv) | 660 | static void schedule_reset(struct ipw2100_priv *priv) |
661 | { | 661 | { |
662 | unsigned long now = get_seconds(); | 662 | unsigned long now = get_seconds(); |
663 | 663 | ||
@@ -1130,7 +1130,7 @@ static inline void ipw2100_hw_set_gpio(struct ipw2100_priv *priv) | |||
1130 | write_register(priv->net_dev, IPW_REG_GPIO, reg); | 1130 | write_register(priv->net_dev, IPW_REG_GPIO, reg); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | static inline int rf_kill_active(struct ipw2100_priv *priv) | 1133 | static int rf_kill_active(struct ipw2100_priv *priv) |
1134 | { | 1134 | { |
1135 | #define MAX_RF_KILL_CHECKS 5 | 1135 | #define MAX_RF_KILL_CHECKS 5 |
1136 | #define RF_KILL_CHECK_DELAY 40 | 1136 | #define RF_KILL_CHECK_DELAY 40 |
@@ -2177,7 +2177,7 @@ static const char *frame_types[] = { | |||
2177 | }; | 2177 | }; |
2178 | #endif | 2178 | #endif |
2179 | 2179 | ||
2180 | static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv, | 2180 | static int ipw2100_alloc_skb(struct ipw2100_priv *priv, |
2181 | struct ipw2100_rx_packet *packet) | 2181 | struct ipw2100_rx_packet *packet) |
2182 | { | 2182 | { |
2183 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); | 2183 | packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); |
@@ -2201,7 +2201,7 @@ static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv, | |||
2201 | #define SEARCH_SNAPSHOT 1 | 2201 | #define SEARCH_SNAPSHOT 1 |
2202 | 2202 | ||
2203 | #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) | 2203 | #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) |
2204 | static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | 2204 | static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) |
2205 | { | 2205 | { |
2206 | int i; | 2206 | int i; |
2207 | if (priv->snapshot[0]) | 2207 | if (priv->snapshot[0]) |
@@ -2221,7 +2221,7 @@ static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | |||
2221 | return 1; | 2221 | return 1; |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv) | 2224 | static void ipw2100_snapshot_free(struct ipw2100_priv *priv) |
2225 | { | 2225 | { |
2226 | int i; | 2226 | int i; |
2227 | if (!priv->snapshot[0]) | 2227 | if (!priv->snapshot[0]) |
@@ -2231,7 +2231,7 @@ static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv) | |||
2231 | priv->snapshot[0] = NULL; | 2231 | priv->snapshot[0] = NULL; |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, | 2234 | static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, |
2235 | size_t len, int mode) | 2235 | size_t len, int mode) |
2236 | { | 2236 | { |
2237 | u32 i, j; | 2237 | u32 i, j; |
@@ -2288,7 +2288,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, | |||
2288 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; | 2288 | static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; |
2289 | #endif | 2289 | #endif |
2290 | 2290 | ||
2291 | static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) | 2291 | static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) |
2292 | { | 2292 | { |
2293 | #ifdef CONFIG_IPW2100_DEBUG_C3 | 2293 | #ifdef CONFIG_IPW2100_DEBUG_C3 |
2294 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2294 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
@@ -2346,7 +2346,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) | |||
2346 | schedule_reset(priv); | 2346 | schedule_reset(priv); |
2347 | } | 2347 | } |
2348 | 2348 | ||
2349 | static inline void isr_rx(struct ipw2100_priv *priv, int i, | 2349 | static void isr_rx(struct ipw2100_priv *priv, int i, |
2350 | struct ieee80211_rx_stats *stats) | 2350 | struct ieee80211_rx_stats *stats) |
2351 | { | 2351 | { |
2352 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2352 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
@@ -2425,7 +2425,7 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, | |||
2425 | priv->rx_queue.drv[i].host_addr = packet->dma_addr; | 2425 | priv->rx_queue.drv[i].host_addr = packet->dma_addr; |
2426 | } | 2426 | } |
2427 | 2427 | ||
2428 | static inline int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) | 2428 | static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) |
2429 | { | 2429 | { |
2430 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2430 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
2431 | struct ipw2100_rx *u = priv->rx_buffers[i].rxp; | 2431 | struct ipw2100_rx *u = priv->rx_buffers[i].rxp; |
@@ -2481,7 +2481,7 @@ static inline int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) | |||
2481 | * The WRITE index is cached in the variable 'priv->rx_queue.next'. | 2481 | * The WRITE index is cached in the variable 'priv->rx_queue.next'. |
2482 | * | 2482 | * |
2483 | */ | 2483 | */ |
2484 | static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | 2484 | static void __ipw2100_rx_process(struct ipw2100_priv *priv) |
2485 | { | 2485 | { |
2486 | struct ipw2100_bd_queue *rxq = &priv->rx_queue; | 2486 | struct ipw2100_bd_queue *rxq = &priv->rx_queue; |
2487 | struct ipw2100_status_queue *sq = &priv->status_queue; | 2487 | struct ipw2100_status_queue *sq = &priv->status_queue; |
@@ -2634,7 +2634,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2634 | * for use by future command and data packets. | 2634 | * for use by future command and data packets. |
2635 | * | 2635 | * |
2636 | */ | 2636 | */ |
2637 | static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) | 2637 | static int __ipw2100_tx_process(struct ipw2100_priv *priv) |
2638 | { | 2638 | { |
2639 | struct ipw2100_bd_queue *txq = &priv->tx_queue; | 2639 | struct ipw2100_bd_queue *txq = &priv->tx_queue; |
2640 | struct ipw2100_bd *tbd; | 2640 | struct ipw2100_bd *tbd; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index cdfe50207757..819be2b6b7df 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -813,7 +813,7 @@ static void ipw_bg_led_link_off(void *data) | |||
813 | up(&priv->sem); | 813 | up(&priv->sem); |
814 | } | 814 | } |
815 | 815 | ||
816 | static inline void __ipw_led_activity_on(struct ipw_priv *priv) | 816 | static void __ipw_led_activity_on(struct ipw_priv *priv) |
817 | { | 817 | { |
818 | u32 led; | 818 | u32 led; |
819 | 819 | ||
@@ -1508,7 +1508,7 @@ static ssize_t store_direct_dword(struct device *d, | |||
1508 | static DEVICE_ATTR(direct_dword, S_IWUSR | S_IRUGO, | 1508 | static DEVICE_ATTR(direct_dword, S_IWUSR | S_IRUGO, |
1509 | show_direct_dword, store_direct_dword); | 1509 | show_direct_dword, store_direct_dword); |
1510 | 1510 | ||
1511 | static inline int rf_kill_active(struct ipw_priv *priv) | 1511 | static int rf_kill_active(struct ipw_priv *priv) |
1512 | { | 1512 | { |
1513 | if (0 == (ipw_read32(priv, 0x30) & 0x10000)) | 1513 | if (0 == (ipw_read32(priv, 0x30) & 0x10000)) |
1514 | priv->status |= STATUS_RF_KILL_HW; | 1514 | priv->status |= STATUS_RF_KILL_HW; |
@@ -2359,7 +2359,7 @@ static inline void eeprom_write_reg(struct ipw_priv *p, u32 data) | |||
2359 | } | 2359 | } |
2360 | 2360 | ||
2361 | /* perform a chip select operation */ | 2361 | /* perform a chip select operation */ |
2362 | static inline void eeprom_cs(struct ipw_priv *priv) | 2362 | static void eeprom_cs(struct ipw_priv *priv) |
2363 | { | 2363 | { |
2364 | eeprom_write_reg(priv, 0); | 2364 | eeprom_write_reg(priv, 0); |
2365 | eeprom_write_reg(priv, EEPROM_BIT_CS); | 2365 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
@@ -2368,7 +2368,7 @@ static inline void eeprom_cs(struct ipw_priv *priv) | |||
2368 | } | 2368 | } |
2369 | 2369 | ||
2370 | /* perform a chip select operation */ | 2370 | /* perform a chip select operation */ |
2371 | static inline void eeprom_disable_cs(struct ipw_priv *priv) | 2371 | static void eeprom_disable_cs(struct ipw_priv *priv) |
2372 | { | 2372 | { |
2373 | eeprom_write_reg(priv, EEPROM_BIT_CS); | 2373 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
2374 | eeprom_write_reg(priv, 0); | 2374 | eeprom_write_reg(priv, 0); |
@@ -2475,7 +2475,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
2475 | IPW_DEBUG_TRACE("<<\n"); | 2475 | IPW_DEBUG_TRACE("<<\n"); |
2476 | } | 2476 | } |
2477 | 2477 | ||
2478 | static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) | 2478 | static void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) |
2479 | { | 2479 | { |
2480 | count >>= 2; | 2480 | count >>= 2; |
2481 | if (!count) | 2481 | if (!count) |
@@ -2772,7 +2772,7 @@ static inline int ipw_alive(struct ipw_priv *priv) | |||
2772 | return ipw_read32(priv, 0x90) == 0xd55555d5; | 2772 | return ipw_read32(priv, 0x90) == 0xd55555d5; |
2773 | } | 2773 | } |
2774 | 2774 | ||
2775 | static inline int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, | 2775 | static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, |
2776 | int timeout) | 2776 | int timeout) |
2777 | { | 2777 | { |
2778 | int i = 0; | 2778 | int i = 0; |
@@ -3150,7 +3150,7 @@ static int ipw_get_fw(struct ipw_priv *priv, | |||
3150 | 3150 | ||
3151 | #define IPW_RX_BUF_SIZE (3000) | 3151 | #define IPW_RX_BUF_SIZE (3000) |
3152 | 3152 | ||
3153 | static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | 3153 | static void ipw_rx_queue_reset(struct ipw_priv *priv, |
3154 | struct ipw_rx_queue *rxq) | 3154 | struct ipw_rx_queue *rxq) |
3155 | { | 3155 | { |
3156 | unsigned long flags; | 3156 | unsigned long flags; |
@@ -3608,7 +3608,7 @@ static void ipw_tx_queue_free(struct ipw_priv *priv) | |||
3608 | ipw_queue_tx_free(priv, &priv->txq[3]); | 3608 | ipw_queue_tx_free(priv, &priv->txq[3]); |
3609 | } | 3609 | } |
3610 | 3610 | ||
3611 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) | 3611 | static void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) |
3612 | { | 3612 | { |
3613 | /* First 3 bytes are manufacturer */ | 3613 | /* First 3 bytes are manufacturer */ |
3614 | bssid[0] = priv->mac_addr[0]; | 3614 | bssid[0] = priv->mac_addr[0]; |
@@ -3622,7 +3622,7 @@ static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) | |||
3622 | bssid[0] |= 0x02; /* set local assignment bit (IEEE802) */ | 3622 | bssid[0] |= 0x02; /* set local assignment bit (IEEE802) */ |
3623 | } | 3623 | } |
3624 | 3624 | ||
3625 | static inline u8 ipw_add_station(struct ipw_priv *priv, u8 * bssid) | 3625 | static u8 ipw_add_station(struct ipw_priv *priv, u8 * bssid) |
3626 | { | 3626 | { |
3627 | struct ipw_station_entry entry; | 3627 | struct ipw_station_entry entry; |
3628 | int i; | 3628 | int i; |
@@ -3655,7 +3655,7 @@ static inline u8 ipw_add_station(struct ipw_priv *priv, u8 * bssid) | |||
3655 | return i; | 3655 | return i; |
3656 | } | 3656 | } |
3657 | 3657 | ||
3658 | static inline u8 ipw_find_station(struct ipw_priv *priv, u8 * bssid) | 3658 | static u8 ipw_find_station(struct ipw_priv *priv, u8 * bssid) |
3659 | { | 3659 | { |
3660 | int i; | 3660 | int i; |
3661 | 3661 | ||
@@ -3794,7 +3794,7 @@ static void inline average_init(struct average *avg) | |||
3794 | memset(avg, 0, sizeof(*avg)); | 3794 | memset(avg, 0, sizeof(*avg)); |
3795 | } | 3795 | } |
3796 | 3796 | ||
3797 | static void inline average_add(struct average *avg, s16 val) | 3797 | static void average_add(struct average *avg, s16 val) |
3798 | { | 3798 | { |
3799 | avg->sum -= avg->entries[avg->pos]; | 3799 | avg->sum -= avg->entries[avg->pos]; |
3800 | avg->sum += val; | 3800 | avg->sum += val; |
@@ -3805,7 +3805,7 @@ static void inline average_add(struct average *avg, s16 val) | |||
3805 | } | 3805 | } |
3806 | } | 3806 | } |
3807 | 3807 | ||
3808 | static s16 inline average_value(struct average *avg) | 3808 | static s16 average_value(struct average *avg) |
3809 | { | 3809 | { |
3810 | if (!unlikely(avg->init)) { | 3810 | if (!unlikely(avg->init)) { |
3811 | if (avg->pos) | 3811 | if (avg->pos) |
@@ -3847,7 +3847,7 @@ static void ipw_reset_stats(struct ipw_priv *priv) | |||
3847 | 3847 | ||
3848 | } | 3848 | } |
3849 | 3849 | ||
3850 | static inline u32 ipw_get_max_rate(struct ipw_priv *priv) | 3850 | static u32 ipw_get_max_rate(struct ipw_priv *priv) |
3851 | { | 3851 | { |
3852 | u32 i = 0x80000000; | 3852 | u32 i = 0x80000000; |
3853 | u32 mask = priv->rates_mask; | 3853 | u32 mask = priv->rates_mask; |
@@ -4087,7 +4087,7 @@ static void ipw_bg_gather_stats(void *data) | |||
4087 | * roaming_threshold -> disassociate_threshold, scan and roam for better signal. | 4087 | * roaming_threshold -> disassociate_threshold, scan and roam for better signal. |
4088 | * Above disassociate threshold, give up and stop scanning. | 4088 | * Above disassociate threshold, give up and stop scanning. |
4089 | * Roaming is disabled if disassociate_threshold <= roaming_threshold */ | 4089 | * Roaming is disabled if disassociate_threshold <= roaming_threshold */ |
4090 | static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, | 4090 | static void ipw_handle_missed_beacon(struct ipw_priv *priv, |
4091 | int missed_count) | 4091 | int missed_count) |
4092 | { | 4092 | { |
4093 | priv->notif_missed_beacons = missed_count; | 4093 | priv->notif_missed_beacons = missed_count; |
@@ -4157,7 +4157,7 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, | |||
4157 | * Handle host notification packet. | 4157 | * Handle host notification packet. |
4158 | * Called from interrupt routine | 4158 | * Called from interrupt routine |
4159 | */ | 4159 | */ |
4160 | static inline void ipw_rx_notification(struct ipw_priv *priv, | 4160 | static void ipw_rx_notification(struct ipw_priv *priv, |
4161 | struct ipw_rx_notification *notif) | 4161 | struct ipw_rx_notification *notif) |
4162 | { | 4162 | { |
4163 | notif->size = le16_to_cpu(notif->size); | 4163 | notif->size = le16_to_cpu(notif->size); |
@@ -5095,7 +5095,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
5095 | return 1; | 5095 | return 1; |
5096 | } | 5096 | } |
5097 | 5097 | ||
5098 | static inline void ipw_copy_rates(struct ipw_supported_rates *dest, | 5098 | static void ipw_copy_rates(struct ipw_supported_rates *dest, |
5099 | const struct ipw_supported_rates *src) | 5099 | const struct ipw_supported_rates *src) |
5100 | { | 5100 | { |
5101 | u8 i; | 5101 | u8 i; |
@@ -5856,7 +5856,7 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
5856 | #define ipw_debug_config(x) do {} while (0) | 5856 | #define ipw_debug_config(x) do {} while (0) |
5857 | #endif | 5857 | #endif |
5858 | 5858 | ||
5859 | static inline void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) | 5859 | static void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) |
5860 | { | 5860 | { |
5861 | /* TODO: Verify that this works... */ | 5861 | /* TODO: Verify that this works... */ |
5862 | struct ipw_fixed_rate fr = { | 5862 | struct ipw_fixed_rate fr = { |
@@ -7634,7 +7634,7 @@ static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | |||
7634 | } | 7634 | } |
7635 | #endif | 7635 | #endif |
7636 | 7636 | ||
7637 | static inline int is_network_packet(struct ipw_priv *priv, | 7637 | static int is_network_packet(struct ipw_priv *priv, |
7638 | struct ieee80211_hdr_4addr *header) | 7638 | struct ieee80211_hdr_4addr *header) |
7639 | { | 7639 | { |
7640 | /* Filter incoming packets to determine if they are targetted toward | 7640 | /* Filter incoming packets to determine if they are targetted toward |
@@ -7672,7 +7672,7 @@ static inline int is_network_packet(struct ipw_priv *priv, | |||
7672 | 7672 | ||
7673 | #define IPW_PACKET_RETRY_TIME HZ | 7673 | #define IPW_PACKET_RETRY_TIME HZ |
7674 | 7674 | ||
7675 | static inline int is_duplicate_packet(struct ipw_priv *priv, | 7675 | static int is_duplicate_packet(struct ipw_priv *priv, |
7676 | struct ieee80211_hdr_4addr *header) | 7676 | struct ieee80211_hdr_4addr *header) |
7677 | { | 7677 | { |
7678 | u16 sc = le16_to_cpu(header->seq_ctl); | 7678 | u16 sc = le16_to_cpu(header->seq_ctl); |
@@ -9581,7 +9581,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
9581 | 9581 | ||
9582 | /* net device stuff */ | 9582 | /* net device stuff */ |
9583 | 9583 | ||
9584 | static inline void init_sys_config(struct ipw_sys_config *sys_config) | 9584 | static void init_sys_config(struct ipw_sys_config *sys_config) |
9585 | { | 9585 | { |
9586 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); | 9586 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); |
9587 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ | 9587 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ |
@@ -9627,7 +9627,7 @@ modify to send one tfd per fragment instead of using chunking. otherwise | |||
9627 | we need to heavily modify the ieee80211_skb_to_txb. | 9627 | we need to heavily modify the ieee80211_skb_to_txb. |
9628 | */ | 9628 | */ |
9629 | 9629 | ||
9630 | static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, | 9630 | static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, |
9631 | int pri) | 9631 | int pri) |
9632 | { | 9632 | { |
9633 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) | 9633 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index b0d8b5b03152..ff192e96268a 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -102,7 +102,7 @@ static inline void hacr_write(unsigned long ioaddr, u16 hacr) | |||
102 | * Write to card's Host Adapter Command Register. Include a delay for | 102 | * Write to card's Host Adapter Command Register. Include a delay for |
103 | * those times when it is needed. | 103 | * those times when it is needed. |
104 | */ | 104 | */ |
105 | static inline void hacr_write_slow(unsigned long ioaddr, u16 hacr) | 105 | static void hacr_write_slow(unsigned long ioaddr, u16 hacr) |
106 | { | 106 | { |
107 | hacr_write(ioaddr, hacr); | 107 | hacr_write(ioaddr, hacr); |
108 | /* delay might only be needed sometimes */ | 108 | /* delay might only be needed sometimes */ |
@@ -242,7 +242,7 @@ static void psa_write(unsigned long ioaddr, u16 hacr, int o, /* Offset in PSA */ | |||
242 | * The Windows drivers don't use the CRC, but the AP and the PtP tool | 242 | * The Windows drivers don't use the CRC, but the AP and the PtP tool |
243 | * depend on it. | 243 | * depend on it. |
244 | */ | 244 | */ |
245 | static inline u16 psa_crc(u8 * psa, /* The PSA */ | 245 | static u16 psa_crc(u8 * psa, /* The PSA */ |
246 | int size) | 246 | int size) |
247 | { /* Number of short for CRC */ | 247 | { /* Number of short for CRC */ |
248 | int byte_cnt; /* Loop on the PSA */ | 248 | int byte_cnt; /* Loop on the PSA */ |
@@ -310,7 +310,7 @@ static void update_psa_checksum(struct net_device * dev, unsigned long ioaddr, u | |||
310 | /* | 310 | /* |
311 | * Write 1 byte to the MMC. | 311 | * Write 1 byte to the MMC. |
312 | */ | 312 | */ |
313 | static inline void mmc_out(unsigned long ioaddr, u16 o, u8 d) | 313 | static void mmc_out(unsigned long ioaddr, u16 o, u8 d) |
314 | { | 314 | { |
315 | int count = 0; | 315 | int count = 0; |
316 | 316 | ||
@@ -326,7 +326,7 @@ static inline void mmc_out(unsigned long ioaddr, u16 o, u8 d) | |||
326 | * Routine to write bytes to the Modem Management Controller. | 326 | * Routine to write bytes to the Modem Management Controller. |
327 | * We start at the end because it is the way it should be! | 327 | * We start at the end because it is the way it should be! |
328 | */ | 328 | */ |
329 | static inline void mmc_write(unsigned long ioaddr, u8 o, u8 * b, int n) | 329 | static void mmc_write(unsigned long ioaddr, u8 o, u8 * b, int n) |
330 | { | 330 | { |
331 | o += n; | 331 | o += n; |
332 | b += n; | 332 | b += n; |
@@ -340,7 +340,7 @@ static inline void mmc_write(unsigned long ioaddr, u8 o, u8 * b, int n) | |||
340 | * Read a byte from the MMC. | 340 | * Read a byte from the MMC. |
341 | * Optimised version for 1 byte, avoid using memory. | 341 | * Optimised version for 1 byte, avoid using memory. |
342 | */ | 342 | */ |
343 | static inline u8 mmc_in(unsigned long ioaddr, u16 o) | 343 | static u8 mmc_in(unsigned long ioaddr, u16 o) |
344 | { | 344 | { |
345 | int count = 0; | 345 | int count = 0; |
346 | 346 | ||
@@ -587,7 +587,7 @@ static void wv_ack(struct net_device * dev) | |||
587 | * Set channel attention bit and busy wait until command has | 587 | * Set channel attention bit and busy wait until command has |
588 | * completed, then acknowledge completion of the command. | 588 | * completed, then acknowledge completion of the command. |
589 | */ | 589 | */ |
590 | static inline int wv_synchronous_cmd(struct net_device * dev, const char *str) | 590 | static int wv_synchronous_cmd(struct net_device * dev, const char *str) |
591 | { | 591 | { |
592 | net_local *lp = (net_local *) dev->priv; | 592 | net_local *lp = (net_local *) dev->priv; |
593 | unsigned long ioaddr = dev->base_addr; | 593 | unsigned long ioaddr = dev->base_addr; |
@@ -633,7 +633,7 @@ static inline int wv_synchronous_cmd(struct net_device * dev, const char *str) | |||
633 | * Configuration commands completion interrupt. | 633 | * Configuration commands completion interrupt. |
634 | * Check if done, and if OK. | 634 | * Check if done, and if OK. |
635 | */ | 635 | */ |
636 | static inline int | 636 | static int |
637 | wv_config_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp) | 637 | wv_config_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp) |
638 | { | 638 | { |
639 | unsigned short mcs_addr; | 639 | unsigned short mcs_addr; |
@@ -843,7 +843,7 @@ if (lp->tx_n_in_use > 0) | |||
843 | * wavelan_interrupt is not an option), so you may experience | 843 | * wavelan_interrupt is not an option), so you may experience |
844 | * delays sometimes. | 844 | * delays sometimes. |
845 | */ | 845 | */ |
846 | static inline void wv_82586_reconfig(struct net_device * dev) | 846 | static void wv_82586_reconfig(struct net_device * dev) |
847 | { | 847 | { |
848 | net_local *lp = (net_local *) dev->priv; | 848 | net_local *lp = (net_local *) dev->priv; |
849 | unsigned long flags; | 849 | unsigned long flags; |
@@ -1281,7 +1281,7 @@ static inline void wv_packet_info(u8 * p, /* Packet to dump */ | |||
1281 | * This is the information which is displayed by the driver at startup. | 1281 | * This is the information which is displayed by the driver at startup. |
1282 | * There are lots of flags for configuring it to your liking. | 1282 | * There are lots of flags for configuring it to your liking. |
1283 | */ | 1283 | */ |
1284 | static inline void wv_init_info(struct net_device * dev) | 1284 | static void wv_init_info(struct net_device * dev) |
1285 | { | 1285 | { |
1286 | short ioaddr = dev->base_addr; | 1286 | short ioaddr = dev->base_addr; |
1287 | net_local *lp = (net_local *) dev->priv; | 1287 | net_local *lp = (net_local *) dev->priv; |
@@ -1502,7 +1502,7 @@ static int wavelan_set_mac_address(struct net_device * dev, void *addr) | |||
1502 | * It's a bit complicated and you don't really want to look into it. | 1502 | * It's a bit complicated and you don't really want to look into it. |
1503 | * (called in wavelan_ioctl) | 1503 | * (called in wavelan_ioctl) |
1504 | */ | 1504 | */ |
1505 | static inline int wv_set_frequency(unsigned long ioaddr, /* I/O port of the card */ | 1505 | static int wv_set_frequency(unsigned long ioaddr, /* I/O port of the card */ |
1506 | iw_freq * frequency) | 1506 | iw_freq * frequency) |
1507 | { | 1507 | { |
1508 | const int BAND_NUM = 10; /* Number of bands */ | 1508 | const int BAND_NUM = 10; /* Number of bands */ |
@@ -1677,7 +1677,7 @@ static inline int wv_set_frequency(unsigned long ioaddr, /* I/O port of the card | |||
1677 | /* | 1677 | /* |
1678 | * Give the list of available frequencies. | 1678 | * Give the list of available frequencies. |
1679 | */ | 1679 | */ |
1680 | static inline int wv_frequency_list(unsigned long ioaddr, /* I/O port of the card */ | 1680 | static int wv_frequency_list(unsigned long ioaddr, /* I/O port of the card */ |
1681 | iw_freq * list, /* List of frequencies to fill */ | 1681 | iw_freq * list, /* List of frequencies to fill */ |
1682 | int max) | 1682 | int max) |
1683 | { /* Maximum number of frequencies */ | 1683 | { /* Maximum number of frequencies */ |
@@ -2489,7 +2489,7 @@ static iw_stats *wavelan_get_wireless_stats(struct net_device * dev) | |||
2489 | * Note: if any errors occur, the packet is "dropped on the floor". | 2489 | * Note: if any errors occur, the packet is "dropped on the floor". |
2490 | * (called by wv_packet_rcv()) | 2490 | * (called by wv_packet_rcv()) |
2491 | */ | 2491 | */ |
2492 | static inline void | 2492 | static void |
2493 | wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | 2493 | wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) |
2494 | { | 2494 | { |
2495 | net_local *lp = (net_local *) dev->priv; | 2495 | net_local *lp = (net_local *) dev->priv; |
@@ -2585,7 +2585,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2585 | * (called in wavelan_interrupt()). | 2585 | * (called in wavelan_interrupt()). |
2586 | * Note : the spinlock is already grabbed for us. | 2586 | * Note : the spinlock is already grabbed for us. |
2587 | */ | 2587 | */ |
2588 | static inline void wv_receive(struct net_device * dev) | 2588 | static void wv_receive(struct net_device * dev) |
2589 | { | 2589 | { |
2590 | unsigned long ioaddr = dev->base_addr; | 2590 | unsigned long ioaddr = dev->base_addr; |
2591 | net_local *lp = (net_local *) dev->priv; | 2591 | net_local *lp = (net_local *) dev->priv; |
@@ -2768,7 +2768,7 @@ static inline void wv_receive(struct net_device * dev) | |||
2768 | * | 2768 | * |
2769 | * (called in wavelan_packet_xmit()) | 2769 | * (called in wavelan_packet_xmit()) |
2770 | */ | 2770 | */ |
2771 | static inline int wv_packet_write(struct net_device * dev, void *buf, short length) | 2771 | static int wv_packet_write(struct net_device * dev, void *buf, short length) |
2772 | { | 2772 | { |
2773 | net_local *lp = (net_local *) dev->priv; | 2773 | net_local *lp = (net_local *) dev->priv; |
2774 | unsigned long ioaddr = dev->base_addr; | 2774 | unsigned long ioaddr = dev->base_addr; |
@@ -2964,7 +2964,7 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev) | |||
2964 | * Routine to initialize the Modem Management Controller. | 2964 | * Routine to initialize the Modem Management Controller. |
2965 | * (called by wv_hw_reset()) | 2965 | * (called by wv_hw_reset()) |
2966 | */ | 2966 | */ |
2967 | static inline int wv_mmc_init(struct net_device * dev) | 2967 | static int wv_mmc_init(struct net_device * dev) |
2968 | { | 2968 | { |
2969 | unsigned long ioaddr = dev->base_addr; | 2969 | unsigned long ioaddr = dev->base_addr; |
2970 | net_local *lp = (net_local *) dev->priv; | 2970 | net_local *lp = (net_local *) dev->priv; |
@@ -3136,7 +3136,7 @@ static inline int wv_mmc_init(struct net_device * dev) | |||
3136 | * Start the receive unit. | 3136 | * Start the receive unit. |
3137 | * (called by wv_hw_reset()) | 3137 | * (called by wv_hw_reset()) |
3138 | */ | 3138 | */ |
3139 | static inline int wv_ru_start(struct net_device * dev) | 3139 | static int wv_ru_start(struct net_device * dev) |
3140 | { | 3140 | { |
3141 | net_local *lp = (net_local *) dev->priv; | 3141 | net_local *lp = (net_local *) dev->priv; |
3142 | unsigned long ioaddr = dev->base_addr; | 3142 | unsigned long ioaddr = dev->base_addr; |
@@ -3228,7 +3228,7 @@ static inline int wv_ru_start(struct net_device * dev) | |||
3228 | * | 3228 | * |
3229 | * (called by wv_hw_reset()) | 3229 | * (called by wv_hw_reset()) |
3230 | */ | 3230 | */ |
3231 | static inline int wv_cu_start(struct net_device * dev) | 3231 | static int wv_cu_start(struct net_device * dev) |
3232 | { | 3232 | { |
3233 | net_local *lp = (net_local *) dev->priv; | 3233 | net_local *lp = (net_local *) dev->priv; |
3234 | unsigned long ioaddr = dev->base_addr; | 3234 | unsigned long ioaddr = dev->base_addr; |
@@ -3329,7 +3329,7 @@ static inline int wv_cu_start(struct net_device * dev) | |||
3329 | * | 3329 | * |
3330 | * (called by wv_hw_reset()) | 3330 | * (called by wv_hw_reset()) |
3331 | */ | 3331 | */ |
3332 | static inline int wv_82586_start(struct net_device * dev) | 3332 | static int wv_82586_start(struct net_device * dev) |
3333 | { | 3333 | { |
3334 | net_local *lp = (net_local *) dev->priv; | 3334 | net_local *lp = (net_local *) dev->priv; |
3335 | unsigned long ioaddr = dev->base_addr; | 3335 | unsigned long ioaddr = dev->base_addr; |
@@ -3641,7 +3641,7 @@ static void wv_82586_config(struct net_device * dev) | |||
3641 | * WaveLAN controller (i82586). | 3641 | * WaveLAN controller (i82586). |
3642 | * (called by wavelan_close()) | 3642 | * (called by wavelan_close()) |
3643 | */ | 3643 | */ |
3644 | static inline void wv_82586_stop(struct net_device * dev) | 3644 | static void wv_82586_stop(struct net_device * dev) |
3645 | { | 3645 | { |
3646 | net_local *lp = (net_local *) dev->priv; | 3646 | net_local *lp = (net_local *) dev->priv; |
3647 | unsigned long ioaddr = dev->base_addr; | 3647 | unsigned long ioaddr = dev->base_addr; |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 9c25654b1e75..ef4c687e7c01 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1635,7 +1635,7 @@ dasd_setup_queue(struct dasd_device * device) | |||
1635 | blk_queue_max_hw_segments(device->request_queue, -1L); | 1635 | blk_queue_max_hw_segments(device->request_queue, -1L); |
1636 | blk_queue_max_segment_size(device->request_queue, -1L); | 1636 | blk_queue_max_segment_size(device->request_queue, -1L); |
1637 | blk_queue_segment_boundary(device->request_queue, -1L); | 1637 | blk_queue_segment_boundary(device->request_queue, -1L); |
1638 | blk_queue_ordered(device->request_queue, 1); | 1638 | blk_queue_ordered(device->request_queue, QUEUE_ORDERED_TAG, NULL); |
1639 | } | 1639 | } |
1640 | 1640 | ||
1641 | /* | 1641 | /* |
diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c index 83e6a060668e..cd2cc28e16a7 100644 --- a/drivers/s390/cio/airq.c +++ b/drivers/s390/cio/airq.c | |||
@@ -2,12 +2,12 @@ | |||
2 | * drivers/s390/cio/airq.c | 2 | * drivers/s390/cio/airq.c |
3 | * S/390 common I/O routines -- support for adapter interruptions | 3 | * S/390 common I/O routines -- support for adapter interruptions |
4 | * | 4 | * |
5 | * $Revision: 1.12 $ | 5 | * $Revision: 1.15 $ |
6 | * | 6 | * |
7 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, | 7 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, |
8 | * IBM Corporation | 8 | * IBM Corporation |
9 | * Author(s): Ingo Adlung (adlung@de.ibm.com) | 9 | * Author(s): Ingo Adlung (adlung@de.ibm.com) |
10 | * Cornelia Huck (cohuck@de.ibm.com) | 10 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
11 | * Arnd Bergmann (arndb@de.ibm.com) | 11 | * Arnd Bergmann (arndb@de.ibm.com) |
12 | */ | 12 | */ |
13 | 13 | ||
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index daf21e03b21d..72f27c151c09 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/blacklist.c | 2 | * drivers/s390/cio/blacklist.c |
3 | * S/390 common I/O routines -- blacklisting of specific devices | 3 | * S/390 common I/O routines -- blacklisting of specific devices |
4 | * $Revision: 1.39 $ | 4 | * $Revision: 1.42 $ |
5 | * | 5 | * |
6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) | 8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | * Arnd Bergmann (arndb@de.ibm.com) | 10 | * Arnd Bergmann (arndb@de.ibm.com) |
11 | */ | 11 | */ |
12 | 12 | ||
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 503a568e47c3..6c077ad71edc 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/ccwgroup.c | 2 | * drivers/s390/cio/ccwgroup.c |
3 | * bus driver for ccwgroup | 3 | * bus driver for ccwgroup |
4 | * $Revision: 1.33 $ | 4 | * $Revision: 1.35 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) | 8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | */ | 10 | */ |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 7270808c02d1..2cbb724791a8 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/chsc.c | 2 | * drivers/s390/cio/chsc.c |
3 | * S/390 common I/O routines -- channel subsystem call | 3 | * S/390 common I/O routines -- channel subsystem call |
4 | * $Revision: 1.126 $ | 4 | * $Revision: 1.128 $ |
5 | * | 5 | * |
6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) | 8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | * Arnd Bergmann (arndb@de.ibm.com) | 10 | * Arnd Bergmann (arndb@de.ibm.com) |
11 | */ | 11 | */ |
12 | 12 | ||
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 7376bc87206d..6223b06d27d5 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/cio.c | 2 | * drivers/s390/cio/cio.c |
3 | * S/390 common I/O routines -- low level i/o calls | 3 | * S/390 common I/O routines -- low level i/o calls |
4 | * $Revision: 1.138 $ | 4 | * $Revision: 1.140 $ |
5 | * | 5 | * |
6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) | 8 | * Author(s): Ingo Adlung (adlung@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | * Arnd Bergmann (arndb@de.ibm.com) | 10 | * Arnd Bergmann (arndb@de.ibm.com) |
11 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 11 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
12 | */ | 12 | */ |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 2d319fb812ca..516108779f60 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/css.c | 2 | * drivers/s390/cio/css.c |
3 | * driver for channel subsystem | 3 | * driver for channel subsystem |
4 | * $Revision: 1.93 $ | 4 | * $Revision: 1.96 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) | 8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | */ | 10 | */ |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index aa5ab5d4547c..b6375861cb37 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -147,7 +147,7 @@ extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); | |||
147 | struct channel_subsystem { | 147 | struct channel_subsystem { |
148 | u8 cssid; | 148 | u8 cssid; |
149 | int valid; | 149 | int valid; |
150 | struct channel_path *chps[__MAX_CHPID]; | 150 | struct channel_path *chps[__MAX_CHPID + 1]; |
151 | struct device device; | 151 | struct device device; |
152 | struct pgid global_pgid; | 152 | struct pgid global_pgid; |
153 | }; | 153 | }; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index eb73605a0527..a67e7e60e330 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/device.c | 2 | * drivers/s390/cio/device.c |
3 | * bus driver for ccw devices | 3 | * bus driver for ccw devices |
4 | * $Revision: 1.137 $ | 4 | * $Revision: 1.140 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) | 8 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 10 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
11 | */ | 11 | */ |
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 23d12b65e5fa..b302779e7cff 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 5 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
6 | * IBM Corporation | 6 | * IBM Corporation |
7 | * Author(s): Cornelia Huck(cohuck@de.ibm.com) | 7 | * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) |
8 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 8 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
9 | */ | 9 | */ |
10 | 10 | ||
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index 04ceba343db8..e60b2d8103b8 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
5 | * IBM Corporation | 5 | * IBM Corporation |
6 | * Author(s): Cornelia Huck(cohuck@de.ibm.com) | 6 | * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) |
7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
8 | * | 8 | * |
9 | * Sense ID functions. | 9 | * Sense ID functions. |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index 143b6c25a4e6..8b0218949b62 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/device_ops.c | 2 | * drivers/s390/cio/device_ops.c |
3 | * | 3 | * |
4 | * $Revision: 1.58 $ | 4 | * $Revision: 1.61 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) | 8 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
9 | * Cornelia Huck (cohuck@de.ibm.com) | 9 | * Cornelia Huck (cornelia.huck@de.ibm.com) |
10 | */ | 10 | */ |
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index 052832d03d38..d2a5b04d7cba 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
5 | * IBM Corporation | 5 | * IBM Corporation |
6 | * Author(s): Cornelia Huck(cohuck@de.ibm.com) | 6 | * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) |
7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
8 | * | 8 | * |
9 | * Path Group ID functions. | 9 | * Path Group ID functions. |
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c index db09c209098b..dad4dd9887c9 100644 --- a/drivers/s390/cio/device_status.c +++ b/drivers/s390/cio/device_status.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 4 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
5 | * IBM Corporation | 5 | * IBM Corporation |
6 | * Author(s): Cornelia Huck(cohuck@de.ibm.com) | 6 | * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) |
7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 7 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
8 | * | 8 | * |
9 | * Status accumulation and basic sense functions. | 9 | * Status accumulation and basic sense functions. |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 30a836ffc31f..77be2c39bfe4 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Copyright 2000,2002 IBM Corporation | 8 | * Copyright 2000,2002 IBM Corporation |
9 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> | 9 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> |
10 | * 2.6 cio integration by Cornelia Huck <cohuck@de.ibm.com> | 10 | * 2.6 cio integration by Cornelia Huck <cornelia.huck@de.ibm.com> |
11 | * | 11 | * |
12 | * Restriction: only 63 iqdio subchannels would have its own indicator, | 12 | * Restriction: only 63 iqdio subchannels would have its own indicator, |
13 | * after that, subsequent subchannels share one indicator | 13 | * after that, subsequent subchannels share one indicator |
@@ -56,7 +56,7 @@ | |||
56 | #include "ioasm.h" | 56 | #include "ioasm.h" |
57 | #include "chsc.h" | 57 | #include "chsc.h" |
58 | 58 | ||
59 | #define VERSION_QDIO_C "$Revision: 1.114 $" | 59 | #define VERSION_QDIO_C "$Revision: 1.117 $" |
60 | 60 | ||
61 | /****************** MODULE PARAMETER VARIABLES ********************/ | 61 | /****************** MODULE PARAMETER VARIABLES ********************/ |
62 | MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>"); | 62 | MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>"); |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index 0db4f57a6a95..1901feef07d9 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ctcmain.c,v 1.78 2005/09/07 12:18:02 pavlic Exp $ | 2 | * $Id: ctcmain.c,v 1.79 2006/01/11 11:32:18 cohuck Exp $ |
3 | * | 3 | * |
4 | * CTC / ESCON network driver | 4 | * CTC / ESCON network driver |
5 | * | 5 | * |
@@ -8,7 +8,7 @@ | |||
8 | * Fixes by : Jochen Röhrig (roehrig@de.ibm.com) | 8 | * Fixes by : Jochen Röhrig (roehrig@de.ibm.com) |
9 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 9 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
10 | Peter Tiedemann (ptiedem@de.ibm.com) | 10 | Peter Tiedemann (ptiedem@de.ibm.com) |
11 | * Driver Model stuff by : Cornelia Huck <cohuck@de.ibm.com> | 11 | * Driver Model stuff by : Cornelia Huck <huckc@de.ibm.com> |
12 | * | 12 | * |
13 | * Documentation used: | 13 | * Documentation used: |
14 | * - Principles of Operation (IBM doc#: SA22-7201-06) | 14 | * - Principles of Operation (IBM doc#: SA22-7201-06) |
@@ -37,7 +37,7 @@ | |||
37 | * along with this program; if not, write to the Free Software | 37 | * along with this program; if not, write to the Free Software |
38 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 38 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
39 | * | 39 | * |
40 | * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.78 $ | 40 | * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.79 $ |
41 | * | 41 | * |
42 | */ | 42 | */ |
43 | #undef DEBUG | 43 | #undef DEBUG |
@@ -248,7 +248,7 @@ static void | |||
248 | print_banner(void) | 248 | print_banner(void) |
249 | { | 249 | { |
250 | static int printed = 0; | 250 | static int printed = 0; |
251 | char vbuf[] = "$Revision: 1.78 $"; | 251 | char vbuf[] = "$Revision: 1.79 $"; |
252 | char *version = vbuf; | 252 | char *version = vbuf; |
253 | 253 | ||
254 | if (printed) | 254 | if (printed) |
diff --git a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c index 77dacb465732..2014fb7a4881 100644 --- a/drivers/s390/net/cu3088.c +++ b/drivers/s390/net/cu3088.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cu3088.c,v 1.36 2005/10/25 14:37:17 cohuck Exp $ | 2 | * $Id: cu3088.c,v 1.38 2006/01/12 14:33:09 cohuck Exp $ |
3 | * | 3 | * |
4 | * CTC / LCS ccw_device driver | 4 | * CTC / LCS ccw_device driver |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation |
7 | * Author(s): Arnd Bergmann <arndb@de.ibm.com> | 7 | * Author(s): Arnd Bergmann <arndb@de.ibm.com> |
8 | * Cornelia Huck <cohuck@de.ibm.com> | 8 | * Cornelia Huck <cornelia.huck@de.ibm.com> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 69425a7a6e98..ac4c4b83fe17 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1,12 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: netiucv.c,v 1.66 2005/05/11 08:10:17 holzheu Exp $ | 2 | * $Id: netiucv.c,v 1.69 2006/01/12 14:33:09 cohuck Exp $ |
3 | * | 3 | * |
4 | * IUCV network driver | 4 | * IUCV network driver |
5 | * | 5 | * |
6 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation | 6 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation |
7 | * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com) | 7 | * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com) |
8 | * | 8 | * |
9 | * Driverfs integration and all bugs therein by Cornelia Huck(cohuck@de.ibm.com) | 9 | * Sysfs integration and all bugs therein by Cornelia Huck |
10 | * (cornelia.huck@de.ibm.com) | ||
10 | * | 11 | * |
11 | * Documentation used: | 12 | * Documentation used: |
12 | * the source of the original IUCV driver by: | 13 | * the source of the original IUCV driver by: |
@@ -30,7 +31,7 @@ | |||
30 | * along with this program; if not, write to the Free Software | 31 | * along with this program; if not, write to the Free Software |
31 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 32 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | * | 33 | * |
33 | * RELEASE-TAG: IUCV network driver $Revision: 1.66 $ | 34 | * RELEASE-TAG: IUCV network driver $Revision: 1.69 $ |
34 | * | 35 | * |
35 | */ | 36 | */ |
36 | 37 | ||
@@ -2076,7 +2077,7 @@ DRIVER_ATTR(remove, 0200, NULL, remove_write); | |||
2076 | static void | 2077 | static void |
2077 | netiucv_banner(void) | 2078 | netiucv_banner(void) |
2078 | { | 2079 | { |
2079 | char vbuf[] = "$Revision: 1.66 $"; | 2080 | char vbuf[] = "$Revision: 1.69 $"; |
2080 | char *version = vbuf; | 2081 | char *version = vbuf; |
2081 | 2082 | ||
2082 | if ((version = strchr(version, ':'))) { | 2083 | if ((version = strchr(version, ':'))) { |
diff --git a/drivers/s390/s390_rdev.c b/drivers/s390/s390_rdev.c index 566cc3d185b6..206518c7d332 100644 --- a/drivers/s390/s390_rdev.c +++ b/drivers/s390/s390_rdev.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/s390_rdev.c | 2 | * drivers/s390/s390_rdev.c |
3 | * s390 root device | 3 | * s390 root device |
4 | * $Revision: 1.2 $ | 4 | * $Revision: 1.4 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
8 | * Author(s): Cornelia Huck (cohuck@de.ibm.com) | 8 | * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) |
9 | * Carsten Otte (cotte@de.ibm.com) | 9 | * Carsten Otte (cotte@de.ibm.com) |
10 | */ | 10 | */ |
11 | 11 | ||
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 33d56c344944..770f1647e4d6 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -1290,7 +1290,7 @@ static void aic7xxx_check_scbs(struct aic7xxx_host *p, char *buffer); | |||
1290 | * | 1290 | * |
1291 | ***************************************************************************/ | 1291 | ***************************************************************************/ |
1292 | 1292 | ||
1293 | static inline unsigned char | 1293 | static unsigned char |
1294 | aic_inb(struct aic7xxx_host *p, long port) | 1294 | aic_inb(struct aic7xxx_host *p, long port) |
1295 | { | 1295 | { |
1296 | #ifdef MMAPIO | 1296 | #ifdef MMAPIO |
@@ -1309,7 +1309,7 @@ aic_inb(struct aic7xxx_host *p, long port) | |||
1309 | #endif | 1309 | #endif |
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | static inline void | 1312 | static void |
1313 | aic_outb(struct aic7xxx_host *p, unsigned char val, long port) | 1313 | aic_outb(struct aic7xxx_host *p, unsigned char val, long port) |
1314 | { | 1314 | { |
1315 | #ifdef MMAPIO | 1315 | #ifdef MMAPIO |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 1b495afe6d17..780bfcc67096 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1418,7 +1418,7 @@ iscsi_data_digest_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1418 | ctask->digest_count = 4; | 1418 | ctask->digest_count = 4; |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | static inline int | 1421 | static int |
1422 | iscsi_digest_final_send(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, | 1422 | iscsi_digest_final_send(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, |
1423 | struct iscsi_buf *buf, uint32_t *digest, int final) | 1423 | struct iscsi_buf *buf, uint32_t *digest, int final) |
1424 | { | 1424 | { |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index f55b9b3f7b37..99bae8369ab2 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1747,7 +1747,7 @@ static const struct { | |||
1747 | { ATA_SHIFT_PIO, XFER_PIO_0 }, | 1747 | { ATA_SHIFT_PIO, XFER_PIO_0 }, |
1748 | }; | 1748 | }; |
1749 | 1749 | ||
1750 | static inline u8 base_from_shift(unsigned int shift) | 1750 | static u8 base_from_shift(unsigned int shift) |
1751 | { | 1751 | { |
1752 | int i; | 1752 | int i; |
1753 | 1753 | ||
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index d18a4bc2498c..bf9f7f7ba354 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -1266,7 +1266,7 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter) | |||
1266 | * return the scb from the head of the free list. NULL if there are none | 1266 | * return the scb from the head of the free list. NULL if there are none |
1267 | * available | 1267 | * available |
1268 | **/ | 1268 | **/ |
1269 | static inline scb_t * | 1269 | static scb_t * |
1270 | megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp) | 1270 | megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp) |
1271 | { | 1271 | { |
1272 | struct list_head *head = &adapter->kscb_pool; | 1272 | struct list_head *head = &adapter->kscb_pool; |
@@ -1329,7 +1329,7 @@ megaraid_dealloc_scb(adapter_t *adapter, scb_t *scb) | |||
1329 | * | 1329 | * |
1330 | * prepare the scatter-gather list | 1330 | * prepare the scatter-gather list |
1331 | */ | 1331 | */ |
1332 | static inline int | 1332 | static int |
1333 | megaraid_mbox_mksgl(adapter_t *adapter, scb_t *scb) | 1333 | megaraid_mbox_mksgl(adapter_t *adapter, scb_t *scb) |
1334 | { | 1334 | { |
1335 | struct scatterlist *sgl; | 1335 | struct scatterlist *sgl; |
@@ -1402,7 +1402,7 @@ megaraid_mbox_mksgl(adapter_t *adapter, scb_t *scb) | |||
1402 | * | 1402 | * |
1403 | * post the command to the controller if mailbox is availble. | 1403 | * post the command to the controller if mailbox is availble. |
1404 | */ | 1404 | */ |
1405 | static inline int | 1405 | static int |
1406 | mbox_post_cmd(adapter_t *adapter, scb_t *scb) | 1406 | mbox_post_cmd(adapter_t *adapter, scb_t *scb) |
1407 | { | 1407 | { |
1408 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); | 1408 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); |
@@ -2070,7 +2070,7 @@ megaraid_mbox_prepare_epthru(adapter_t *adapter, scb_t *scb, | |||
2070 | * | 2070 | * |
2071 | * Returns: 1 if the interrupt is valid, 0 otherwise | 2071 | * Returns: 1 if the interrupt is valid, 0 otherwise |
2072 | */ | 2072 | */ |
2073 | static inline int | 2073 | static int |
2074 | megaraid_ack_sequence(adapter_t *adapter) | 2074 | megaraid_ack_sequence(adapter_t *adapter) |
2075 | { | 2075 | { |
2076 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); | 2076 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); |
@@ -2208,7 +2208,7 @@ megaraid_isr(int irq, void *devp, struct pt_regs *regs) | |||
2208 | * | 2208 | * |
2209 | * DMA sync if required. | 2209 | * DMA sync if required. |
2210 | */ | 2210 | */ |
2211 | static inline void | 2211 | static void |
2212 | megaraid_mbox_sync_scb(adapter_t *adapter, scb_t *scb) | 2212 | megaraid_mbox_sync_scb(adapter_t *adapter, scb_t *scb) |
2213 | { | 2213 | { |
2214 | mbox_ccb_t *ccb; | 2214 | mbox_ccb_t *ccb; |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index c0bb8061401f..511ed52a5807 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -81,7 +81,7 @@ static DEFINE_MUTEX(megasas_async_queue_mutex); | |||
81 | * | 81 | * |
82 | * Returns a free command from the pool | 82 | * Returns a free command from the pool |
83 | */ | 83 | */ |
84 | static inline struct megasas_cmd *megasas_get_cmd(struct megasas_instance | 84 | static struct megasas_cmd *megasas_get_cmd(struct megasas_instance |
85 | *instance) | 85 | *instance) |
86 | { | 86 | { |
87 | unsigned long flags; | 87 | unsigned long flags; |
@@ -263,7 +263,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, | |||
263 | * If successful, this function returns the number of SG elements. Otherwise, | 263 | * If successful, this function returns the number of SG elements. Otherwise, |
264 | * it returnes -1. | 264 | * it returnes -1. |
265 | */ | 265 | */ |
266 | static inline int | 266 | static int |
267 | megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, | 267 | megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, |
268 | union megasas_sgl *mfi_sgl) | 268 | union megasas_sgl *mfi_sgl) |
269 | { | 269 | { |
@@ -311,7 +311,7 @@ megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
311 | * If successful, this function returns the number of SG elements. Otherwise, | 311 | * If successful, this function returns the number of SG elements. Otherwise, |
312 | * it returnes -1. | 312 | * it returnes -1. |
313 | */ | 313 | */ |
314 | static inline int | 314 | static int |
315 | megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, | 315 | megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, |
316 | union megasas_sgl *mfi_sgl) | 316 | union megasas_sgl *mfi_sgl) |
317 | { | 317 | { |
@@ -360,7 +360,7 @@ megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
360 | * This function prepares CDB commands. These are typcially pass-through | 360 | * This function prepares CDB commands. These are typcially pass-through |
361 | * commands to the devices. | 361 | * commands to the devices. |
362 | */ | 362 | */ |
363 | static inline int | 363 | static int |
364 | megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, | 364 | megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, |
365 | struct megasas_cmd *cmd) | 365 | struct megasas_cmd *cmd) |
366 | { | 366 | { |
@@ -441,7 +441,7 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
441 | * | 441 | * |
442 | * Frames (and accompanying SGLs) for regular SCSI IOs use this function. | 442 | * Frames (and accompanying SGLs) for regular SCSI IOs use this function. |
443 | */ | 443 | */ |
444 | static inline int | 444 | static int |
445 | megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, | 445 | megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, |
446 | struct megasas_cmd *cmd) | 446 | struct megasas_cmd *cmd) |
447 | { | 447 | { |
@@ -563,7 +563,7 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
563 | * @scp: SCSI command | 563 | * @scp: SCSI command |
564 | * @frame_count: [OUT] Number of frames used to prepare this command | 564 | * @frame_count: [OUT] Number of frames used to prepare this command |
565 | */ | 565 | */ |
566 | static inline struct megasas_cmd *megasas_build_cmd(struct megasas_instance | 566 | static struct megasas_cmd *megasas_build_cmd(struct megasas_instance |
567 | *instance, | 567 | *instance, |
568 | struct scsi_cmnd *scp, | 568 | struct scsi_cmnd *scp, |
569 | int *frame_count) | 569 | int *frame_count) |
@@ -914,7 +914,7 @@ megasas_complete_abort(struct megasas_instance *instance, | |||
914 | * @instance: Adapter soft state | 914 | * @instance: Adapter soft state |
915 | * @cmd: Completed command | 915 | * @cmd: Completed command |
916 | */ | 916 | */ |
917 | static inline void | 917 | static void |
918 | megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd) | 918 | megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd) |
919 | { | 919 | { |
920 | dma_addr_t buf_h; | 920 | dma_addr_t buf_h; |
@@ -958,7 +958,7 @@ megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd) | |||
958 | * an alternate status (as in the case of aborted | 958 | * an alternate status (as in the case of aborted |
959 | * commands) | 959 | * commands) |
960 | */ | 960 | */ |
961 | static inline void | 961 | static void |
962 | megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | 962 | megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, |
963 | u8 alt_status) | 963 | u8 alt_status) |
964 | { | 964 | { |
@@ -1105,7 +1105,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
1105 | * SCSI mid-layer instead of the status | 1105 | * SCSI mid-layer instead of the status |
1106 | * returned by the FW | 1106 | * returned by the FW |
1107 | */ | 1107 | */ |
1108 | static inline int | 1108 | static int |
1109 | megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) | 1109 | megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) |
1110 | { | 1110 | { |
1111 | u32 status; | 1111 | u32 status; |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index dd8050392d01..997f8e30509b 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -151,7 +151,7 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk) | |||
151 | return cd; | 151 | return cd; |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline void scsi_cd_put(struct scsi_cd *cd) | 154 | static void scsi_cd_put(struct scsi_cd *cd) |
155 | { | 155 | { |
156 | struct scsi_device *sdev = cd->device; | 156 | struct scsi_device *sdev = cd->device; |
157 | 157 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index fb610c3634a4..d9ce8c549416 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2454,6 +2454,7 @@ static struct platform_driver serial8250_isa_driver = { | |||
2454 | .resume = serial8250_resume, | 2454 | .resume = serial8250_resume, |
2455 | .driver = { | 2455 | .driver = { |
2456 | .name = "serial8250", | 2456 | .name = "serial8250", |
2457 | .owner = THIS_MODULE, | ||
2457 | }, | 2458 | }, |
2458 | }; | 2459 | }; |
2459 | 2460 | ||
@@ -2594,21 +2595,30 @@ static int __init serial8250_init(void) | |||
2594 | if (ret) | 2595 | if (ret) |
2595 | goto out; | 2596 | goto out; |
2596 | 2597 | ||
2597 | serial8250_isa_devs = platform_device_register_simple("serial8250", | 2598 | ret = platform_driver_register(&serial8250_isa_driver); |
2598 | PLAT8250_DEV_LEGACY, NULL, 0); | 2599 | if (ret) |
2599 | if (IS_ERR(serial8250_isa_devs)) { | 2600 | goto unreg_uart_drv; |
2600 | ret = PTR_ERR(serial8250_isa_devs); | 2601 | |
2601 | goto unreg; | 2602 | serial8250_isa_devs = platform_device_alloc("serial8250", |
2603 | PLAT8250_DEV_LEGACY); | ||
2604 | if (!serial8250_isa_devs) { | ||
2605 | ret = -ENOMEM; | ||
2606 | goto unreg_plat_drv; | ||
2602 | } | 2607 | } |
2603 | 2608 | ||
2609 | ret = platform_device_add(serial8250_isa_devs); | ||
2610 | if (ret) | ||
2611 | goto put_dev; | ||
2612 | |||
2604 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); | 2613 | serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); |
2605 | 2614 | ||
2606 | ret = platform_driver_register(&serial8250_isa_driver); | 2615 | goto out; |
2607 | if (ret == 0) | ||
2608 | goto out; | ||
2609 | 2616 | ||
2610 | platform_device_unregister(serial8250_isa_devs); | 2617 | put_dev: |
2611 | unreg: | 2618 | platform_device_put(serial8250_isa_devs); |
2619 | unreg_plat_drv: | ||
2620 | platform_driver_unregister(&serial8250_isa_driver); | ||
2621 | unreg_uart_drv: | ||
2612 | uart_unregister_driver(&serial8250_reg); | 2622 | uart_unregister_driver(&serial8250_reg); |
2613 | out: | 2623 | out: |
2614 | return ret; | 2624 | return ret; |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 843717275d49..5e7199f7b59c 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -190,7 +190,6 @@ config SERIAL_8250_BOCA | |||
190 | To compile this driver as a module, choose M here: the module | 190 | To compile this driver as a module, choose M here: the module |
191 | will be called 8250_boca. | 191 | will be called 8250_boca. |
192 | 192 | ||
193 | |||
194 | config SERIAL_8250_HUB6 | 193 | config SERIAL_8250_HUB6 |
195 | tristate "Support Hub6 cards" | 194 | tristate "Support Hub6 cards" |
196 | depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS | 195 | depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS |
@@ -848,7 +847,7 @@ config SERIAL_M32R_SIO_CONSOLE | |||
848 | 847 | ||
849 | config SERIAL_M32R_PLDSIO | 848 | config SERIAL_M32R_PLDSIO |
850 | bool "M32R SIO I/F on a PLD" | 849 | bool "M32R SIO I/F on a PLD" |
851 | depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PALT_USRV || PLAT_M32700UT) | 850 | depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PLAT_USRV || PLAT_M32700UT) |
852 | default n | 851 | default n |
853 | help | 852 | help |
854 | Say Y here if you want to use the M32R serial controller | 853 | Say Y here if you want to use the M32R serial controller |
@@ -917,4 +916,12 @@ config SERIAL_SGI_IOC4 | |||
917 | and wish to use the serial ports on this card, say Y. | 916 | and wish to use the serial ports on this card, say Y. |
918 | Otherwise, say N. | 917 | Otherwise, say N. |
919 | 918 | ||
919 | config SERIAL_SGI_IOC3 | ||
920 | tristate "SGI Altix IOC3 serial support" | ||
921 | depends on (IA64_GENERIC || IA64_SGI_SN2) && SGI_IOC3 | ||
922 | select SERIAL_CORE | ||
923 | help | ||
924 | If you have an SGI Altix with an IOC3 serial card, | ||
925 | say Y or M. Otherwise, say N. | ||
926 | |||
920 | endmenu | 927 | endmenu |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 24a583e482bb..eaf8e01db198 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -56,4 +56,5 @@ obj-$(CONFIG_SERIAL_JSM) += jsm/ | |||
56 | obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o | 56 | obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o |
57 | obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o | 57 | obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o |
58 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o | 58 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o |
59 | obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o | ||
59 | obj-$(CONFIG_SERIAL_AT91) += at91_serial.o | 60 | obj-$(CONFIG_SERIAL_AT91) += at91_serial.o |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 5c098be9346b..587cc6a95114 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -499,7 +499,7 @@ imx_set_termios(struct uart_port *port, struct termios *termios, | |||
499 | ucr2 |= UCR2_STPB; | 499 | ucr2 |= UCR2_STPB; |
500 | if (termios->c_cflag & PARENB) { | 500 | if (termios->c_cflag & PARENB) { |
501 | ucr2 |= UCR2_PREN; | 501 | ucr2 |= UCR2_PREN; |
502 | if (!(termios->c_cflag & PARODD)) | 502 | if (termios->c_cflag & PARODD) |
503 | ucr2 |= UCR2_PROE; | 503 | ucr2 |= UCR2_PROE; |
504 | } | 504 | } |
505 | 505 | ||
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c new file mode 100644 index 000000000000..8097cd91f16b --- /dev/null +++ b/drivers/serial/ioc3_serial.c | |||
@@ -0,0 +1,2197 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * This file contains a module version of the ioc3 serial driver. This | ||
11 | * includes all the support functions needed (support functions, etc.) | ||
12 | * and the serial driver itself. | ||
13 | */ | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/tty.h> | ||
16 | #include <linux/serial.h> | ||
17 | #include <linux/circ_buf.h> | ||
18 | #include <linux/serial_reg.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/pci.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/ioc3.h> | ||
23 | |||
24 | /* | ||
25 | * Interesting things about the ioc3 | ||
26 | */ | ||
27 | |||
28 | #define LOGICAL_PORTS 2 /* rs232(0) and rs422(1) */ | ||
29 | #define PORTS_PER_CARD 2 | ||
30 | #define LOGICAL_PORTS_PER_CARD (PORTS_PER_CARD * LOGICAL_PORTS) | ||
31 | #define MAX_CARDS 8 | ||
32 | #define MAX_LOGICAL_PORTS (LOGICAL_PORTS_PER_CARD * MAX_CARDS) | ||
33 | |||
34 | /* determine given the sio_ir what port it applies to */ | ||
35 | #define GET_PORT_FROM_SIO_IR(_x) (_x & SIO_IR_SA) ? 0 : 1 | ||
36 | |||
37 | |||
38 | /* | ||
39 | * we have 2 logical ports (rs232, rs422) for each physical port | ||
40 | * evens are rs232, odds are rs422 | ||
41 | */ | ||
42 | #define GET_PHYSICAL_PORT(_x) ((_x) >> 1) | ||
43 | #define GET_LOGICAL_PORT(_x) ((_x) & 1) | ||
44 | #define IS_PHYSICAL_PORT(_x) !((_x) & 1) | ||
45 | #define IS_RS232(_x) !((_x) & 1) | ||
46 | |||
47 | static unsigned int Num_of_ioc3_cards; | ||
48 | static unsigned int Submodule_slot; | ||
49 | |||
50 | /* defining this will get you LOTS of great debug info */ | ||
51 | //#define DEBUG_INTERRUPTS | ||
52 | #define DPRINT_CONFIG(_x...) ; | ||
53 | //#define DPRINT_CONFIG(_x...) printk _x | ||
54 | #define NOT_PROGRESS() ; | ||
55 | //#define NOT_PROGRESS() printk("%s : fails %d\n", __FUNCTION__, __LINE__) | ||
56 | |||
57 | /* number of characters we want to transmit to the lower level at a time */ | ||
58 | #define MAX_CHARS 256 | ||
59 | #define FIFO_SIZE (MAX_CHARS-1) /* it's a uchar */ | ||
60 | |||
61 | /* Device name we're using */ | ||
62 | #define DEVICE_NAME "ttySIOC" | ||
63 | #define DEVICE_MAJOR 204 | ||
64 | #define DEVICE_MINOR 116 | ||
65 | |||
66 | /* flags for next_char_state */ | ||
67 | #define NCS_BREAK 0x1 | ||
68 | #define NCS_PARITY 0x2 | ||
69 | #define NCS_FRAMING 0x4 | ||
70 | #define NCS_OVERRUN 0x8 | ||
71 | |||
72 | /* cause we need SOME parameters ... */ | ||
73 | #define MIN_BAUD_SUPPORTED 1200 | ||
74 | #define MAX_BAUD_SUPPORTED 115200 | ||
75 | |||
76 | /* protocol types supported */ | ||
77 | #define PROTO_RS232 0 | ||
78 | #define PROTO_RS422 1 | ||
79 | |||
80 | /* Notification types */ | ||
81 | #define N_DATA_READY 0x01 | ||
82 | #define N_OUTPUT_LOWAT 0x02 | ||
83 | #define N_BREAK 0x04 | ||
84 | #define N_PARITY_ERROR 0x08 | ||
85 | #define N_FRAMING_ERROR 0x10 | ||
86 | #define N_OVERRUN_ERROR 0x20 | ||
87 | #define N_DDCD 0x40 | ||
88 | #define N_DCTS 0x80 | ||
89 | |||
90 | #define N_ALL_INPUT (N_DATA_READY | N_BREAK \ | ||
91 | | N_PARITY_ERROR | N_FRAMING_ERROR \ | ||
92 | | N_OVERRUN_ERROR | N_DDCD | N_DCTS) | ||
93 | |||
94 | #define N_ALL_OUTPUT N_OUTPUT_LOWAT | ||
95 | |||
96 | #define N_ALL_ERRORS (N_PARITY_ERROR | N_FRAMING_ERROR \ | ||
97 | | N_OVERRUN_ERROR) | ||
98 | |||
99 | #define N_ALL (N_DATA_READY | N_OUTPUT_LOWAT | N_BREAK \ | ||
100 | | N_PARITY_ERROR | N_FRAMING_ERROR \ | ||
101 | | N_OVERRUN_ERROR | N_DDCD | N_DCTS) | ||
102 | |||
103 | #define SER_CLK_SPEED(prediv) ((22000000 << 1) / prediv) | ||
104 | #define SER_DIVISOR(x, clk) (((clk) + (x) * 8) / ((x) * 16)) | ||
105 | #define DIVISOR_TO_BAUD(div, clk) ((clk) / 16 / (div)) | ||
106 | |||
107 | /* Some masks */ | ||
108 | #define LCR_MASK_BITS_CHAR (UART_LCR_WLEN5 | UART_LCR_WLEN6 \ | ||
109 | | UART_LCR_WLEN7 | UART_LCR_WLEN8) | ||
110 | #define LCR_MASK_STOP_BITS (UART_LCR_STOP) | ||
111 | |||
112 | #define PENDING(_a, _p) (readl(&(_p)->vma->sio_ir) & (_a)->ic_enable) | ||
113 | |||
114 | #define RING_BUF_SIZE 4096 | ||
115 | #define BUF_SIZE_BIT SBBR_L_SIZE | ||
116 | #define PROD_CONS_MASK PROD_CONS_PTR_4K | ||
117 | |||
118 | #define TOTAL_RING_BUF_SIZE (RING_BUF_SIZE * 4) | ||
119 | |||
120 | /* driver specific - one per card */ | ||
121 | struct ioc3_card { | ||
122 | struct { | ||
123 | /* uart ports are allocated here */ | ||
124 | struct uart_port icp_uart_port[LOGICAL_PORTS]; | ||
125 | /* the ioc3_port used for this port */ | ||
126 | struct ioc3_port *icp_port; | ||
127 | } ic_port[PORTS_PER_CARD]; | ||
128 | /* currently enabled interrupts */ | ||
129 | uint32_t ic_enable; | ||
130 | }; | ||
131 | |||
132 | /* Local port info for each IOC3 serial port */ | ||
133 | struct ioc3_port { | ||
134 | /* handy reference material */ | ||
135 | struct uart_port *ip_port; | ||
136 | struct ioc3_card *ip_card; | ||
137 | struct ioc3_driver_data *ip_idd; | ||
138 | struct ioc3_submodule *ip_is; | ||
139 | |||
140 | /* pci mem addresses for this port */ | ||
141 | struct ioc3_serialregs __iomem *ip_serial_regs; | ||
142 | struct ioc3_uartregs __iomem *ip_uart_regs; | ||
143 | |||
144 | /* Ring buffer page for this port */ | ||
145 | dma_addr_t ip_dma_ringbuf; | ||
146 | /* vaddr of ring buffer */ | ||
147 | struct ring_buffer *ip_cpu_ringbuf; | ||
148 | |||
149 | /* Rings for this port */ | ||
150 | struct ring *ip_inring; | ||
151 | struct ring *ip_outring; | ||
152 | |||
153 | /* Hook to port specific values */ | ||
154 | struct port_hooks *ip_hooks; | ||
155 | |||
156 | spinlock_t ip_lock; | ||
157 | |||
158 | /* Various rx/tx parameters */ | ||
159 | int ip_baud; | ||
160 | int ip_tx_lowat; | ||
161 | int ip_rx_timeout; | ||
162 | |||
163 | /* Copy of notification bits */ | ||
164 | int ip_notify; | ||
165 | |||
166 | /* Shadow copies of various registers so we don't need to PIO | ||
167 | * read them constantly | ||
168 | */ | ||
169 | uint32_t ip_sscr; | ||
170 | uint32_t ip_tx_prod; | ||
171 | uint32_t ip_rx_cons; | ||
172 | unsigned char ip_flags; | ||
173 | }; | ||
174 | |||
175 | /* tx low water mark. We need to notify the driver whenever tx is getting | ||
176 | * close to empty so it can refill the tx buffer and keep things going. | ||
177 | * Let's assume that if we interrupt 1 ms before the tx goes idle, we'll | ||
178 | * have no trouble getting in more chars in time (I certainly hope so). | ||
179 | */ | ||
180 | #define TX_LOWAT_LATENCY 1000 | ||
181 | #define TX_LOWAT_HZ (1000000 / TX_LOWAT_LATENCY) | ||
182 | #define TX_LOWAT_CHARS(baud) (baud / 10 / TX_LOWAT_HZ) | ||
183 | |||
184 | /* Flags per port */ | ||
185 | #define INPUT_HIGH 0x01 | ||
186 | /* used to signify that we have turned off the rx_high | ||
187 | * temporarily - we need to drain the fifo and don't | ||
188 | * want to get blasted with interrupts. | ||
189 | */ | ||
190 | #define DCD_ON 0x02 | ||
191 | /* DCD state is on */ | ||
192 | #define LOWAT_WRITTEN 0x04 | ||
193 | #define READ_ABORTED 0x08 | ||
194 | /* the read was aborted - used to avaoid infinate looping | ||
195 | * in the interrupt handler | ||
196 | */ | ||
197 | #define INPUT_ENABLE 0x10 | ||
198 | |||
199 | /* Since each port has different register offsets and bitmasks | ||
200 | * for everything, we'll store those that we need in tables so we | ||
201 | * don't have to be constantly checking the port we are dealing with. | ||
202 | */ | ||
203 | struct port_hooks { | ||
204 | uint32_t intr_delta_dcd; | ||
205 | uint32_t intr_delta_cts; | ||
206 | uint32_t intr_tx_mt; | ||
207 | uint32_t intr_rx_timer; | ||
208 | uint32_t intr_rx_high; | ||
209 | uint32_t intr_tx_explicit; | ||
210 | uint32_t intr_clear; | ||
211 | uint32_t intr_all; | ||
212 | char rs422_select_pin; | ||
213 | }; | ||
214 | |||
215 | static struct port_hooks hooks_array[PORTS_PER_CARD] = { | ||
216 | /* values for port A */ | ||
217 | { | ||
218 | .intr_delta_dcd = SIO_IR_SA_DELTA_DCD, | ||
219 | .intr_delta_cts = SIO_IR_SA_DELTA_CTS, | ||
220 | .intr_tx_mt = SIO_IR_SA_TX_MT, | ||
221 | .intr_rx_timer = SIO_IR_SA_RX_TIMER, | ||
222 | .intr_rx_high = SIO_IR_SA_RX_HIGH, | ||
223 | .intr_tx_explicit = SIO_IR_SA_TX_EXPLICIT, | ||
224 | .intr_clear = (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL | ||
225 | | SIO_IR_SA_RX_HIGH | ||
226 | | SIO_IR_SA_RX_TIMER | ||
227 | | SIO_IR_SA_DELTA_DCD | ||
228 | | SIO_IR_SA_DELTA_CTS | ||
229 | | SIO_IR_SA_INT | ||
230 | | SIO_IR_SA_TX_EXPLICIT | ||
231 | | SIO_IR_SA_MEMERR), | ||
232 | .intr_all = SIO_IR_SA, | ||
233 | .rs422_select_pin = GPPR_UARTA_MODESEL_PIN, | ||
234 | }, | ||
235 | |||
236 | /* values for port B */ | ||
237 | { | ||
238 | .intr_delta_dcd = SIO_IR_SB_DELTA_DCD, | ||
239 | .intr_delta_cts = SIO_IR_SB_DELTA_CTS, | ||
240 | .intr_tx_mt = SIO_IR_SB_TX_MT, | ||
241 | .intr_rx_timer = SIO_IR_SB_RX_TIMER, | ||
242 | .intr_rx_high = SIO_IR_SB_RX_HIGH, | ||
243 | .intr_tx_explicit = SIO_IR_SB_TX_EXPLICIT, | ||
244 | .intr_clear = (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL | ||
245 | | SIO_IR_SB_RX_HIGH | ||
246 | | SIO_IR_SB_RX_TIMER | ||
247 | | SIO_IR_SB_DELTA_DCD | ||
248 | | SIO_IR_SB_DELTA_CTS | ||
249 | | SIO_IR_SB_INT | ||
250 | | SIO_IR_SB_TX_EXPLICIT | ||
251 | | SIO_IR_SB_MEMERR), | ||
252 | .intr_all = SIO_IR_SB, | ||
253 | .rs422_select_pin = GPPR_UARTB_MODESEL_PIN, | ||
254 | } | ||
255 | }; | ||
256 | |||
257 | struct ring_entry { | ||
258 | union { | ||
259 | struct { | ||
260 | uint32_t alldata; | ||
261 | uint32_t allsc; | ||
262 | } all; | ||
263 | struct { | ||
264 | char data[4]; /* data bytes */ | ||
265 | char sc[4]; /* status/control */ | ||
266 | } s; | ||
267 | } u; | ||
268 | }; | ||
269 | |||
270 | /* Test the valid bits in any of the 4 sc chars using "allsc" member */ | ||
271 | #define RING_ANY_VALID \ | ||
272 | ((uint32_t)(RXSB_MODEM_VALID | RXSB_DATA_VALID) * 0x01010101) | ||
273 | |||
274 | #define ring_sc u.s.sc | ||
275 | #define ring_data u.s.data | ||
276 | #define ring_allsc u.all.allsc | ||
277 | |||
278 | /* Number of entries per ring buffer. */ | ||
279 | #define ENTRIES_PER_RING (RING_BUF_SIZE / (int) sizeof(struct ring_entry)) | ||
280 | |||
281 | /* An individual ring */ | ||
282 | struct ring { | ||
283 | struct ring_entry entries[ENTRIES_PER_RING]; | ||
284 | }; | ||
285 | |||
286 | /* The whole enchilada */ | ||
287 | struct ring_buffer { | ||
288 | struct ring TX_A; | ||
289 | struct ring RX_A; | ||
290 | struct ring TX_B; | ||
291 | struct ring RX_B; | ||
292 | }; | ||
293 | |||
294 | /* Get a ring from a port struct */ | ||
295 | #define RING(_p, _wh) &(((struct ring_buffer *)((_p)->ip_cpu_ringbuf))->_wh) | ||
296 | |||
297 | /* for Infinite loop detection */ | ||
298 | #define MAXITER 10000000 | ||
299 | |||
300 | |||
301 | /** | ||
302 | * set_baud - Baud rate setting code | ||
303 | * @port: port to set | ||
304 | * @baud: baud rate to use | ||
305 | */ | ||
306 | static int set_baud(struct ioc3_port *port, int baud) | ||
307 | { | ||
308 | int divisor; | ||
309 | int actual_baud; | ||
310 | int diff; | ||
311 | int lcr, prediv; | ||
312 | struct ioc3_uartregs __iomem *uart; | ||
313 | |||
314 | for (prediv = 6; prediv < 64; prediv++) { | ||
315 | divisor = SER_DIVISOR(baud, SER_CLK_SPEED(prediv)); | ||
316 | if (!divisor) | ||
317 | continue; /* invalid divisor */ | ||
318 | actual_baud = DIVISOR_TO_BAUD(divisor, SER_CLK_SPEED(prediv)); | ||
319 | |||
320 | diff = actual_baud - baud; | ||
321 | if (diff < 0) | ||
322 | diff = -diff; | ||
323 | |||
324 | /* if we're within 1% we've found a match */ | ||
325 | if (diff * 100 <= actual_baud) | ||
326 | break; | ||
327 | } | ||
328 | |||
329 | /* if the above loop completed, we didn't match | ||
330 | * the baud rate. give up. | ||
331 | */ | ||
332 | if (prediv == 64) { | ||
333 | NOT_PROGRESS(); | ||
334 | return 1; | ||
335 | } | ||
336 | |||
337 | uart = port->ip_uart_regs; | ||
338 | lcr = readb(&uart->iu_lcr); | ||
339 | |||
340 | writeb(lcr | UART_LCR_DLAB, &uart->iu_lcr); | ||
341 | writeb((unsigned char)divisor, &uart->iu_dll); | ||
342 | writeb((unsigned char)(divisor >> 8), &uart->iu_dlm); | ||
343 | writeb((unsigned char)prediv, &uart->iu_scr); | ||
344 | writeb((unsigned char)lcr, &uart->iu_lcr); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * get_ioc3_port - given a uart port, return the control structure | ||
351 | * @the_port: uart port to find | ||
352 | */ | ||
353 | static struct ioc3_port *get_ioc3_port(struct uart_port *the_port) | ||
354 | { | ||
355 | struct ioc3_driver_data *idd = dev_get_drvdata(the_port->dev); | ||
356 | struct ioc3_card *card_ptr = idd->data[Submodule_slot]; | ||
357 | int ii, jj; | ||
358 | |||
359 | if (!card_ptr) { | ||
360 | NOT_PROGRESS(); | ||
361 | return NULL; | ||
362 | } | ||
363 | for (ii = 0; ii < PORTS_PER_CARD; ii++) { | ||
364 | for (jj = 0; jj < LOGICAL_PORTS; jj++) { | ||
365 | if (the_port == &card_ptr->ic_port[ii].icp_uart_port[jj]) | ||
366 | return card_ptr->ic_port[ii].icp_port; | ||
367 | } | ||
368 | } | ||
369 | NOT_PROGRESS(); | ||
370 | return NULL; | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * port_init - Initialize the sio and ioc3 hardware for a given port | ||
375 | * called per port from attach... | ||
376 | * @port: port to initialize | ||
377 | */ | ||
378 | static int inline port_init(struct ioc3_port *port) | ||
379 | { | ||
380 | uint32_t sio_cr; | ||
381 | struct port_hooks *hooks = port->ip_hooks; | ||
382 | struct ioc3_uartregs __iomem *uart; | ||
383 | int reset_loop_counter = 0xfffff; | ||
384 | struct ioc3_driver_data *idd = port->ip_idd; | ||
385 | |||
386 | /* Idle the IOC3 serial interface */ | ||
387 | writel(SSCR_RESET, &port->ip_serial_regs->sscr); | ||
388 | |||
389 | /* Wait until any pending bus activity for this port has ceased */ | ||
390 | do { | ||
391 | sio_cr = readl(&idd->vma->sio_cr); | ||
392 | if (reset_loop_counter-- <= 0) { | ||
393 | printk(KERN_WARNING | ||
394 | "IOC3 unable to come out of reset" | ||
395 | " scr 0x%x\n", sio_cr); | ||
396 | return -1; | ||
397 | } | ||
398 | } while (!(sio_cr & SIO_CR_ARB_DIAG_IDLE) && | ||
399 | (((sio_cr &= SIO_CR_ARB_DIAG) == SIO_CR_ARB_DIAG_TXA) | ||
400 | || sio_cr == SIO_CR_ARB_DIAG_TXB | ||
401 | || sio_cr == SIO_CR_ARB_DIAG_RXA | ||
402 | || sio_cr == SIO_CR_ARB_DIAG_RXB)); | ||
403 | |||
404 | /* Finish reset sequence */ | ||
405 | writel(0, &port->ip_serial_regs->sscr); | ||
406 | |||
407 | /* Once RESET is done, reload cached tx_prod and rx_cons values | ||
408 | * and set rings to empty by making prod == cons | ||
409 | */ | ||
410 | port->ip_tx_prod = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK; | ||
411 | writel(port->ip_tx_prod, &port->ip_serial_regs->stpir); | ||
412 | port->ip_rx_cons = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; | ||
413 | writel(port->ip_rx_cons | SRCIR_ARM, &port->ip_serial_regs->srcir); | ||
414 | |||
415 | /* Disable interrupts for this 16550 */ | ||
416 | uart = port->ip_uart_regs; | ||
417 | writeb(0, &uart->iu_lcr); | ||
418 | writeb(0, &uart->iu_ier); | ||
419 | |||
420 | /* Set the default baud */ | ||
421 | set_baud(port, port->ip_baud); | ||
422 | |||
423 | /* Set line control to 8 bits no parity */ | ||
424 | writeb(UART_LCR_WLEN8 | 0, &uart->iu_lcr); | ||
425 | /* UART_LCR_STOP == 1 stop */ | ||
426 | |||
427 | /* Enable the FIFOs */ | ||
428 | writeb(UART_FCR_ENABLE_FIFO, &uart->iu_fcr); | ||
429 | /* then reset 16550 FIFOs */ | ||
430 | writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, | ||
431 | &uart->iu_fcr); | ||
432 | |||
433 | /* Clear modem control register */ | ||
434 | writeb(0, &uart->iu_mcr); | ||
435 | |||
436 | /* Clear deltas in modem status register */ | ||
437 | writel(0, &port->ip_serial_regs->shadow); | ||
438 | |||
439 | /* Only do this once per port pair */ | ||
440 | if (port->ip_hooks == &hooks_array[0]) { | ||
441 | unsigned long ring_pci_addr; | ||
442 | uint32_t __iomem *sbbr_l, *sbbr_h; | ||
443 | |||
444 | sbbr_l = &idd->vma->sbbr_l; | ||
445 | sbbr_h = &idd->vma->sbbr_h; | ||
446 | ring_pci_addr = (unsigned long __iomem)port->ip_dma_ringbuf; | ||
447 | DPRINT_CONFIG(("%s: ring_pci_addr 0x%p\n", | ||
448 | __FUNCTION__, (void *)ring_pci_addr)); | ||
449 | |||
450 | writel((unsigned int)((uint64_t) ring_pci_addr >> 32), sbbr_h); | ||
451 | writel((unsigned int)ring_pci_addr | BUF_SIZE_BIT, sbbr_l); | ||
452 | } | ||
453 | |||
454 | /* Set the receive timeout value to 10 msec */ | ||
455 | writel(SRTR_HZ / 100, &port->ip_serial_regs->srtr); | ||
456 | |||
457 | /* Set rx threshold, enable DMA */ | ||
458 | /* Set high water mark at 3/4 of full ring */ | ||
459 | port->ip_sscr = (ENTRIES_PER_RING * 3 / 4); | ||
460 | |||
461 | /* uart experiences pauses at high baud rate reducing actual | ||
462 | * throughput by 10% or so unless we enable high speed polling | ||
463 | * XXX when this hardware bug is resolved we should revert to | ||
464 | * normal polling speed | ||
465 | */ | ||
466 | port->ip_sscr |= SSCR_HIGH_SPD; | ||
467 | |||
468 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
469 | |||
470 | /* Disable and clear all serial related interrupt bits */ | ||
471 | port->ip_card->ic_enable &= ~hooks->intr_clear; | ||
472 | ioc3_disable(port->ip_is, idd, hooks->intr_clear); | ||
473 | ioc3_ack(port->ip_is, idd, hooks->intr_clear); | ||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * enable_intrs - enable interrupts | ||
479 | * @port: port to enable | ||
480 | * @mask: mask to use | ||
481 | */ | ||
482 | static void enable_intrs(struct ioc3_port *port, uint32_t mask) | ||
483 | { | ||
484 | if ((port->ip_card->ic_enable & mask) != mask) { | ||
485 | port->ip_card->ic_enable |= mask; | ||
486 | ioc3_enable(port->ip_is, port->ip_idd, mask); | ||
487 | } | ||
488 | } | ||
489 | |||
490 | /** | ||
491 | * local_open - local open a port | ||
492 | * @port: port to open | ||
493 | */ | ||
494 | static inline int local_open(struct ioc3_port *port) | ||
495 | { | ||
496 | int spiniter = 0; | ||
497 | |||
498 | port->ip_flags = INPUT_ENABLE; | ||
499 | |||
500 | /* Pause the DMA interface if necessary */ | ||
501 | if (port->ip_sscr & SSCR_DMA_EN) { | ||
502 | writel(port->ip_sscr | SSCR_DMA_PAUSE, | ||
503 | &port->ip_serial_regs->sscr); | ||
504 | while ((readl(&port->ip_serial_regs->sscr) | ||
505 | & SSCR_PAUSE_STATE) == 0) { | ||
506 | spiniter++; | ||
507 | if (spiniter > MAXITER) { | ||
508 | NOT_PROGRESS(); | ||
509 | return -1; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
514 | /* Reset the input fifo. If the uart received chars while the port | ||
515 | * was closed and DMA is not enabled, the uart may have a bunch of | ||
516 | * chars hanging around in its rx fifo which will not be discarded | ||
517 | * by rclr in the upper layer. We must get rid of them here. | ||
518 | */ | ||
519 | writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR, | ||
520 | &port->ip_uart_regs->iu_fcr); | ||
521 | |||
522 | writeb(UART_LCR_WLEN8, &port->ip_uart_regs->iu_lcr); | ||
523 | /* UART_LCR_STOP == 1 stop */ | ||
524 | |||
525 | /* Re-enable DMA, set default threshold to intr whenever there is | ||
526 | * data available. | ||
527 | */ | ||
528 | port->ip_sscr &= ~SSCR_RX_THRESHOLD; | ||
529 | port->ip_sscr |= 1; /* default threshold */ | ||
530 | |||
531 | /* Plug in the new sscr. This implicitly clears the DMA_PAUSE | ||
532 | * flag if it was set above | ||
533 | */ | ||
534 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
535 | port->ip_tx_lowat = 1; | ||
536 | return 0; | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * set_rx_timeout - Set rx timeout and threshold values. | ||
541 | * @port: port to use | ||
542 | * @timeout: timeout value in ticks | ||
543 | */ | ||
544 | static inline int set_rx_timeout(struct ioc3_port *port, int timeout) | ||
545 | { | ||
546 | int threshold; | ||
547 | |||
548 | port->ip_rx_timeout = timeout; | ||
549 | |||
550 | /* Timeout is in ticks. Let's figure out how many chars we | ||
551 | * can receive at the current baud rate in that interval | ||
552 | * and set the rx threshold to that amount. There are 4 chars | ||
553 | * per ring entry, so we'll divide the number of chars that will | ||
554 | * arrive in timeout by 4. | ||
555 | * So .... timeout * baud / 10 / HZ / 4, with HZ = 100. | ||
556 | */ | ||
557 | threshold = timeout * port->ip_baud / 4000; | ||
558 | if (threshold == 0) | ||
559 | threshold = 1; /* otherwise we'll intr all the time! */ | ||
560 | |||
561 | if ((unsigned)threshold > (unsigned)SSCR_RX_THRESHOLD) | ||
562 | return 1; | ||
563 | |||
564 | port->ip_sscr &= ~SSCR_RX_THRESHOLD; | ||
565 | port->ip_sscr |= threshold; | ||
566 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
567 | |||
568 | /* Now set the rx timeout to the given value | ||
569 | * again timeout * SRTR_HZ / HZ | ||
570 | */ | ||
571 | timeout = timeout * SRTR_HZ / 100; | ||
572 | if (timeout > SRTR_CNT) | ||
573 | timeout = SRTR_CNT; | ||
574 | writel(timeout, &port->ip_serial_regs->srtr); | ||
575 | return 0; | ||
576 | } | ||
577 | |||
578 | /** | ||
579 | * config_port - config the hardware | ||
580 | * @port: port to config | ||
581 | * @baud: baud rate for the port | ||
582 | * @byte_size: data size | ||
583 | * @stop_bits: number of stop bits | ||
584 | * @parenb: parity enable ? | ||
585 | * @parodd: odd parity ? | ||
586 | */ | ||
587 | static inline int | ||
588 | config_port(struct ioc3_port *port, | ||
589 | int baud, int byte_size, int stop_bits, int parenb, int parodd) | ||
590 | { | ||
591 | char lcr, sizebits; | ||
592 | int spiniter = 0; | ||
593 | |||
594 | DPRINT_CONFIG(("%s: line %d baud %d byte_size %d stop %d parenb %d " | ||
595 | "parodd %d\n", | ||
596 | __FUNCTION__, ((struct uart_port *)port->ip_port)->line, | ||
597 | baud, byte_size, stop_bits, parenb, parodd)); | ||
598 | |||
599 | if (set_baud(port, baud)) | ||
600 | return 1; | ||
601 | |||
602 | switch (byte_size) { | ||
603 | case 5: | ||
604 | sizebits = UART_LCR_WLEN5; | ||
605 | break; | ||
606 | case 6: | ||
607 | sizebits = UART_LCR_WLEN6; | ||
608 | break; | ||
609 | case 7: | ||
610 | sizebits = UART_LCR_WLEN7; | ||
611 | break; | ||
612 | case 8: | ||
613 | sizebits = UART_LCR_WLEN8; | ||
614 | break; | ||
615 | default: | ||
616 | return 1; | ||
617 | } | ||
618 | |||
619 | /* Pause the DMA interface if necessary */ | ||
620 | if (port->ip_sscr & SSCR_DMA_EN) { | ||
621 | writel(port->ip_sscr | SSCR_DMA_PAUSE, | ||
622 | &port->ip_serial_regs->sscr); | ||
623 | while ((readl(&port->ip_serial_regs->sscr) | ||
624 | & SSCR_PAUSE_STATE) == 0) { | ||
625 | spiniter++; | ||
626 | if (spiniter > MAXITER) | ||
627 | return -1; | ||
628 | } | ||
629 | } | ||
630 | |||
631 | /* Clear relevant fields in lcr */ | ||
632 | lcr = readb(&port->ip_uart_regs->iu_lcr); | ||
633 | lcr &= ~(LCR_MASK_BITS_CHAR | UART_LCR_EPAR | | ||
634 | UART_LCR_PARITY | LCR_MASK_STOP_BITS); | ||
635 | |||
636 | /* Set byte size in lcr */ | ||
637 | lcr |= sizebits; | ||
638 | |||
639 | /* Set parity */ | ||
640 | if (parenb) { | ||
641 | lcr |= UART_LCR_PARITY; | ||
642 | if (!parodd) | ||
643 | lcr |= UART_LCR_EPAR; | ||
644 | } | ||
645 | |||
646 | /* Set stop bits */ | ||
647 | if (stop_bits) | ||
648 | lcr |= UART_LCR_STOP /* 2 stop bits */ ; | ||
649 | |||
650 | writeb(lcr, &port->ip_uart_regs->iu_lcr); | ||
651 | |||
652 | /* Re-enable the DMA interface if necessary */ | ||
653 | if (port->ip_sscr & SSCR_DMA_EN) { | ||
654 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
655 | } | ||
656 | port->ip_baud = baud; | ||
657 | |||
658 | /* When we get within this number of ring entries of filling the | ||
659 | * entire ring on tx, place an EXPLICIT intr to generate a lowat | ||
660 | * notification when output has drained. | ||
661 | */ | ||
662 | port->ip_tx_lowat = (TX_LOWAT_CHARS(baud) + 3) / 4; | ||
663 | if (port->ip_tx_lowat == 0) | ||
664 | port->ip_tx_lowat = 1; | ||
665 | |||
666 | set_rx_timeout(port, 2); | ||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | /** | ||
671 | * do_write - Write bytes to the port. Returns the number of bytes | ||
672 | * actually written. Called from transmit_chars | ||
673 | * @port: port to use | ||
674 | * @buf: the stuff to write | ||
675 | * @len: how many bytes in 'buf' | ||
676 | */ | ||
677 | static inline int do_write(struct ioc3_port *port, char *buf, int len) | ||
678 | { | ||
679 | int prod_ptr, cons_ptr, total = 0; | ||
680 | struct ring *outring; | ||
681 | struct ring_entry *entry; | ||
682 | struct port_hooks *hooks = port->ip_hooks; | ||
683 | |||
684 | BUG_ON(!(len >= 0)); | ||
685 | |||
686 | prod_ptr = port->ip_tx_prod; | ||
687 | cons_ptr = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK; | ||
688 | outring = port->ip_outring; | ||
689 | |||
690 | /* Maintain a 1-entry red-zone. The ring buffer is full when | ||
691 | * (cons - prod) % ring_size is 1. Rather than do this subtraction | ||
692 | * in the body of the loop, I'll do it now. | ||
693 | */ | ||
694 | cons_ptr = (cons_ptr - (int)sizeof(struct ring_entry)) & PROD_CONS_MASK; | ||
695 | |||
696 | /* Stuff the bytes into the output */ | ||
697 | while ((prod_ptr != cons_ptr) && (len > 0)) { | ||
698 | int xx; | ||
699 | |||
700 | /* Get 4 bytes (one ring entry) at a time */ | ||
701 | entry = (struct ring_entry *)((caddr_t) outring + prod_ptr); | ||
702 | |||
703 | /* Invalidate all entries */ | ||
704 | entry->ring_allsc = 0; | ||
705 | |||
706 | /* Copy in some bytes */ | ||
707 | for (xx = 0; (xx < 4) && (len > 0); xx++) { | ||
708 | entry->ring_data[xx] = *buf++; | ||
709 | entry->ring_sc[xx] = TXCB_VALID; | ||
710 | len--; | ||
711 | total++; | ||
712 | } | ||
713 | |||
714 | /* If we are within some small threshold of filling up the | ||
715 | * entire ring buffer, we must place an EXPLICIT intr here | ||
716 | * to generate a lowat interrupt in case we subsequently | ||
717 | * really do fill up the ring and the caller goes to sleep. | ||
718 | * No need to place more than one though. | ||
719 | */ | ||
720 | if (!(port->ip_flags & LOWAT_WRITTEN) && | ||
721 | ((cons_ptr - prod_ptr) & PROD_CONS_MASK) | ||
722 | <= port->ip_tx_lowat * (int)sizeof(struct ring_entry)) { | ||
723 | port->ip_flags |= LOWAT_WRITTEN; | ||
724 | entry->ring_sc[0] |= TXCB_INT_WHEN_DONE; | ||
725 | } | ||
726 | |||
727 | /* Go on to next entry */ | ||
728 | prod_ptr += sizeof(struct ring_entry); | ||
729 | prod_ptr &= PROD_CONS_MASK; | ||
730 | } | ||
731 | |||
732 | /* If we sent something, start DMA if necessary */ | ||
733 | if (total > 0 && !(port->ip_sscr & SSCR_DMA_EN)) { | ||
734 | port->ip_sscr |= SSCR_DMA_EN; | ||
735 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
736 | } | ||
737 | |||
738 | /* Store the new producer pointer. If tx is disabled, we stuff the | ||
739 | * data into the ring buffer, but we don't actually start tx. | ||
740 | */ | ||
741 | if (!uart_tx_stopped(port->ip_port)) { | ||
742 | writel(prod_ptr, &port->ip_serial_regs->stpir); | ||
743 | |||
744 | /* If we are now transmitting, enable tx_mt interrupt so we | ||
745 | * can disable DMA if necessary when the tx finishes. | ||
746 | */ | ||
747 | if (total > 0) | ||
748 | enable_intrs(port, hooks->intr_tx_mt); | ||
749 | } | ||
750 | port->ip_tx_prod = prod_ptr; | ||
751 | |||
752 | return total; | ||
753 | } | ||
754 | |||
755 | /** | ||
756 | * disable_intrs - disable interrupts | ||
757 | * @port: port to enable | ||
758 | * @mask: mask to use | ||
759 | */ | ||
760 | static inline void disable_intrs(struct ioc3_port *port, uint32_t mask) | ||
761 | { | ||
762 | if (port->ip_card->ic_enable & mask) { | ||
763 | ioc3_disable(port->ip_is, port->ip_idd, mask); | ||
764 | port->ip_card->ic_enable &= ~mask; | ||
765 | } | ||
766 | } | ||
767 | |||
768 | /** | ||
769 | * set_notification - Modify event notification | ||
770 | * @port: port to use | ||
771 | * @mask: events mask | ||
772 | * @set_on: set ? | ||
773 | */ | ||
774 | static int set_notification(struct ioc3_port *port, int mask, int set_on) | ||
775 | { | ||
776 | struct port_hooks *hooks = port->ip_hooks; | ||
777 | uint32_t intrbits, sscrbits; | ||
778 | |||
779 | BUG_ON(!mask); | ||
780 | |||
781 | intrbits = sscrbits = 0; | ||
782 | |||
783 | if (mask & N_DATA_READY) | ||
784 | intrbits |= (hooks->intr_rx_timer | hooks->intr_rx_high); | ||
785 | if (mask & N_OUTPUT_LOWAT) | ||
786 | intrbits |= hooks->intr_tx_explicit; | ||
787 | if (mask & N_DDCD) { | ||
788 | intrbits |= hooks->intr_delta_dcd; | ||
789 | sscrbits |= SSCR_RX_RING_DCD; | ||
790 | } | ||
791 | if (mask & N_DCTS) | ||
792 | intrbits |= hooks->intr_delta_cts; | ||
793 | |||
794 | if (set_on) { | ||
795 | enable_intrs(port, intrbits); | ||
796 | port->ip_notify |= mask; | ||
797 | port->ip_sscr |= sscrbits; | ||
798 | } else { | ||
799 | disable_intrs(port, intrbits); | ||
800 | port->ip_notify &= ~mask; | ||
801 | port->ip_sscr &= ~sscrbits; | ||
802 | } | ||
803 | |||
804 | /* We require DMA if either DATA_READY or DDCD notification is | ||
805 | * currently requested. If neither of these is requested and | ||
806 | * there is currently no tx in progress, DMA may be disabled. | ||
807 | */ | ||
808 | if (port->ip_notify & (N_DATA_READY | N_DDCD)) | ||
809 | port->ip_sscr |= SSCR_DMA_EN; | ||
810 | else if (!(port->ip_card->ic_enable & hooks->intr_tx_mt)) | ||
811 | port->ip_sscr &= ~SSCR_DMA_EN; | ||
812 | |||
813 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | /** | ||
818 | * set_mcr - set the master control reg | ||
819 | * @the_port: port to use | ||
820 | * @mask1: mcr mask | ||
821 | * @mask2: shadow mask | ||
822 | */ | ||
823 | static inline int set_mcr(struct uart_port *the_port, | ||
824 | int mask1, int mask2) | ||
825 | { | ||
826 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
827 | uint32_t shadow; | ||
828 | int spiniter = 0; | ||
829 | char mcr; | ||
830 | |||
831 | if (!port) | ||
832 | return -1; | ||
833 | |||
834 | /* Pause the DMA interface if necessary */ | ||
835 | if (port->ip_sscr & SSCR_DMA_EN) { | ||
836 | writel(port->ip_sscr | SSCR_DMA_PAUSE, | ||
837 | &port->ip_serial_regs->sscr); | ||
838 | while ((readl(&port->ip_serial_regs->sscr) | ||
839 | & SSCR_PAUSE_STATE) == 0) { | ||
840 | spiniter++; | ||
841 | if (spiniter > MAXITER) | ||
842 | return -1; | ||
843 | } | ||
844 | } | ||
845 | shadow = readl(&port->ip_serial_regs->shadow); | ||
846 | mcr = (shadow & 0xff000000) >> 24; | ||
847 | |||
848 | /* Set new value */ | ||
849 | mcr |= mask1; | ||
850 | shadow |= mask2; | ||
851 | writeb(mcr, &port->ip_uart_regs->iu_mcr); | ||
852 | writel(shadow, &port->ip_serial_regs->shadow); | ||
853 | |||
854 | /* Re-enable the DMA interface if necessary */ | ||
855 | if (port->ip_sscr & SSCR_DMA_EN) { | ||
856 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
857 | } | ||
858 | return 0; | ||
859 | } | ||
860 | |||
861 | /** | ||
862 | * ioc3_set_proto - set the protocol for the port | ||
863 | * @port: port to use | ||
864 | * @proto: protocol to use | ||
865 | */ | ||
866 | static int ioc3_set_proto(struct ioc3_port *port, int proto) | ||
867 | { | ||
868 | struct port_hooks *hooks = port->ip_hooks; | ||
869 | |||
870 | switch (proto) { | ||
871 | default: | ||
872 | case PROTO_RS232: | ||
873 | /* Clear the appropriate GIO pin */ | ||
874 | DPRINT_CONFIG(("%s: rs232\n", __FUNCTION__)); | ||
875 | writel(0, (&port->ip_idd->vma->gppr[0] | ||
876 | + hooks->rs422_select_pin)); | ||
877 | break; | ||
878 | |||
879 | case PROTO_RS422: | ||
880 | /* Set the appropriate GIO pin */ | ||
881 | DPRINT_CONFIG(("%s: rs422\n", __FUNCTION__)); | ||
882 | writel(1, (&port->ip_idd->vma->gppr[0] | ||
883 | + hooks->rs422_select_pin)); | ||
884 | break; | ||
885 | } | ||
886 | return 0; | ||
887 | } | ||
888 | |||
889 | /** | ||
890 | * transmit_chars - upper level write, called with the_port->lock | ||
891 | * @the_port: port to write | ||
892 | */ | ||
893 | static void transmit_chars(struct uart_port *the_port) | ||
894 | { | ||
895 | int xmit_count, tail, head; | ||
896 | int result; | ||
897 | char *start; | ||
898 | struct tty_struct *tty; | ||
899 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
900 | struct uart_info *info; | ||
901 | |||
902 | if (!the_port) | ||
903 | return; | ||
904 | if (!port) | ||
905 | return; | ||
906 | |||
907 | info = the_port->info; | ||
908 | tty = info->tty; | ||
909 | |||
910 | if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { | ||
911 | /* Nothing to do or hw stopped */ | ||
912 | set_notification(port, N_ALL_OUTPUT, 0); | ||
913 | return; | ||
914 | } | ||
915 | |||
916 | head = info->xmit.head; | ||
917 | tail = info->xmit.tail; | ||
918 | start = (char *)&info->xmit.buf[tail]; | ||
919 | |||
920 | /* write out all the data or until the end of the buffer */ | ||
921 | xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail); | ||
922 | if (xmit_count > 0) { | ||
923 | result = do_write(port, start, xmit_count); | ||
924 | if (result > 0) { | ||
925 | /* booking */ | ||
926 | xmit_count -= result; | ||
927 | the_port->icount.tx += result; | ||
928 | /* advance the pointers */ | ||
929 | tail += result; | ||
930 | tail &= UART_XMIT_SIZE - 1; | ||
931 | info->xmit.tail = tail; | ||
932 | start = (char *)&info->xmit.buf[tail]; | ||
933 | } | ||
934 | } | ||
935 | if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS) | ||
936 | uart_write_wakeup(the_port); | ||
937 | |||
938 | if (uart_circ_empty(&info->xmit)) { | ||
939 | set_notification(port, N_OUTPUT_LOWAT, 0); | ||
940 | } else { | ||
941 | set_notification(port, N_OUTPUT_LOWAT, 1); | ||
942 | } | ||
943 | } | ||
944 | |||
945 | /** | ||
946 | * ioc3_change_speed - change the speed of the port | ||
947 | * @the_port: port to change | ||
948 | * @new_termios: new termios settings | ||
949 | * @old_termios: old termios settings | ||
950 | */ | ||
951 | static void | ||
952 | ioc3_change_speed(struct uart_port *the_port, | ||
953 | struct termios *new_termios, struct termios *old_termios) | ||
954 | { | ||
955 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
956 | unsigned int cflag; | ||
957 | int baud; | ||
958 | int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; | ||
959 | struct uart_info *info = the_port->info; | ||
960 | |||
961 | cflag = new_termios->c_cflag; | ||
962 | |||
963 | switch (cflag & CSIZE) { | ||
964 | case CS5: | ||
965 | new_data = 5; | ||
966 | break; | ||
967 | case CS6: | ||
968 | new_data = 6; | ||
969 | break; | ||
970 | case CS7: | ||
971 | new_data = 7; | ||
972 | break; | ||
973 | case CS8: | ||
974 | new_data = 8; | ||
975 | break; | ||
976 | default: | ||
977 | /* cuz we always need a default ... */ | ||
978 | new_data = 5; | ||
979 | break; | ||
980 | } | ||
981 | if (cflag & CSTOPB) { | ||
982 | new_stop = 1; | ||
983 | } | ||
984 | if (cflag & PARENB) { | ||
985 | new_parity_enable = 1; | ||
986 | if (cflag & PARODD) | ||
987 | new_parity = 1; | ||
988 | } | ||
989 | baud = uart_get_baud_rate(the_port, new_termios, old_termios, | ||
990 | MIN_BAUD_SUPPORTED, MAX_BAUD_SUPPORTED); | ||
991 | DPRINT_CONFIG(("%s: returned baud %d for line %d\n", __FUNCTION__, baud, | ||
992 | the_port->line)); | ||
993 | |||
994 | if (!the_port->fifosize) | ||
995 | the_port->fifosize = FIFO_SIZE; | ||
996 | uart_update_timeout(the_port, cflag, baud); | ||
997 | |||
998 | the_port->ignore_status_mask = N_ALL_INPUT; | ||
999 | |||
1000 | info->tty->low_latency = 1; | ||
1001 | |||
1002 | if (I_IGNPAR(info->tty)) | ||
1003 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR | ||
1004 | | N_FRAMING_ERROR); | ||
1005 | if (I_IGNBRK(info->tty)) { | ||
1006 | the_port->ignore_status_mask &= ~N_BREAK; | ||
1007 | if (I_IGNPAR(info->tty)) | ||
1008 | the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; | ||
1009 | } | ||
1010 | if (!(cflag & CREAD)) { | ||
1011 | /* ignore everything */ | ||
1012 | the_port->ignore_status_mask &= ~N_DATA_READY; | ||
1013 | } | ||
1014 | |||
1015 | if (cflag & CRTSCTS) { | ||
1016 | /* enable hardware flow control */ | ||
1017 | port->ip_sscr |= SSCR_HFC_EN; | ||
1018 | } | ||
1019 | else { | ||
1020 | /* disable hardware flow control */ | ||
1021 | port->ip_sscr &= ~SSCR_HFC_EN; | ||
1022 | } | ||
1023 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
1024 | |||
1025 | /* Set the configuration and proper notification call */ | ||
1026 | DPRINT_CONFIG(("%s : port 0x%p line %d cflag 0%o " | ||
1027 | "config_port(baud %d data %d stop %d penable %d " | ||
1028 | " parity %d), notification 0x%x\n", | ||
1029 | __FUNCTION__, (void *)port, the_port->line, cflag, baud, | ||
1030 | new_data, new_stop, new_parity_enable, new_parity, | ||
1031 | the_port->ignore_status_mask)); | ||
1032 | |||
1033 | if ((config_port(port, baud, /* baud */ | ||
1034 | new_data, /* byte size */ | ||
1035 | new_stop, /* stop bits */ | ||
1036 | new_parity_enable, /* set parity */ | ||
1037 | new_parity)) >= 0) { /* parity 1==odd */ | ||
1038 | set_notification(port, the_port->ignore_status_mask, 1); | ||
1039 | } | ||
1040 | } | ||
1041 | |||
1042 | /** | ||
1043 | * ic3_startup_local - Start up the serial port - returns >= 0 if no errors | ||
1044 | * @the_port: Port to operate on | ||
1045 | */ | ||
1046 | static inline int ic3_startup_local(struct uart_port *the_port) | ||
1047 | { | ||
1048 | struct ioc3_port *port; | ||
1049 | |||
1050 | if (!the_port) { | ||
1051 | NOT_PROGRESS(); | ||
1052 | return -1; | ||
1053 | } | ||
1054 | |||
1055 | port = get_ioc3_port(the_port); | ||
1056 | if (!port) { | ||
1057 | NOT_PROGRESS(); | ||
1058 | return -1; | ||
1059 | } | ||
1060 | |||
1061 | local_open(port); | ||
1062 | |||
1063 | /* set the protocol */ | ||
1064 | ioc3_set_proto(port, IS_RS232(the_port->line) ? PROTO_RS232 : | ||
1065 | PROTO_RS422); | ||
1066 | return 0; | ||
1067 | } | ||
1068 | |||
1069 | /* | ||
1070 | * ioc3_cb_output_lowat - called when the output low water mark is hit | ||
1071 | * @port: port to output | ||
1072 | */ | ||
1073 | static void ioc3_cb_output_lowat(struct ioc3_port *port) | ||
1074 | { | ||
1075 | unsigned long pflags; | ||
1076 | |||
1077 | /* the_port->lock is set on the call here */ | ||
1078 | if (port->ip_port) { | ||
1079 | spin_lock_irqsave(&port->ip_port->lock, pflags); | ||
1080 | transmit_chars(port->ip_port); | ||
1081 | spin_unlock_irqrestore(&port->ip_port->lock, pflags); | ||
1082 | } | ||
1083 | } | ||
1084 | |||
1085 | /* | ||
1086 | * ioc3_cb_post_ncs - called for some basic errors | ||
1087 | * @port: port to use | ||
1088 | * @ncs: event | ||
1089 | */ | ||
1090 | static void ioc3_cb_post_ncs(struct uart_port *the_port, int ncs) | ||
1091 | { | ||
1092 | struct uart_icount *icount; | ||
1093 | |||
1094 | icount = &the_port->icount; | ||
1095 | |||
1096 | if (ncs & NCS_BREAK) | ||
1097 | icount->brk++; | ||
1098 | if (ncs & NCS_FRAMING) | ||
1099 | icount->frame++; | ||
1100 | if (ncs & NCS_OVERRUN) | ||
1101 | icount->overrun++; | ||
1102 | if (ncs & NCS_PARITY) | ||
1103 | icount->parity++; | ||
1104 | } | ||
1105 | |||
1106 | /** | ||
1107 | * do_read - Read in bytes from the port. Return the number of bytes | ||
1108 | * actually read. | ||
1109 | * @the_port: port to use | ||
1110 | * @buf: place to put the stuff we read | ||
1111 | * @len: how big 'buf' is | ||
1112 | */ | ||
1113 | |||
1114 | static inline int do_read(struct uart_port *the_port, char *buf, int len) | ||
1115 | { | ||
1116 | int prod_ptr, cons_ptr, total; | ||
1117 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1118 | struct ring *inring; | ||
1119 | struct ring_entry *entry; | ||
1120 | struct port_hooks *hooks = port->ip_hooks; | ||
1121 | int byte_num; | ||
1122 | char *sc; | ||
1123 | int loop_counter; | ||
1124 | |||
1125 | BUG_ON(!(len >= 0)); | ||
1126 | BUG_ON(!port); | ||
1127 | |||
1128 | /* There is a nasty timing issue in the IOC3. When the rx_timer | ||
1129 | * expires or the rx_high condition arises, we take an interrupt. | ||
1130 | * At some point while servicing the interrupt, we read bytes from | ||
1131 | * the ring buffer and re-arm the rx_timer. However the rx_timer is | ||
1132 | * not started until the first byte is received *after* it is armed, | ||
1133 | * and any bytes pending in the rx construction buffers are not drained | ||
1134 | * to memory until either there are 4 bytes available or the rx_timer | ||
1135 | * expires. This leads to a potential situation where data is left | ||
1136 | * in the construction buffers forever - 1 to 3 bytes were received | ||
1137 | * after the interrupt was generated but before the rx_timer was | ||
1138 | * re-armed. At that point as long as no subsequent bytes are received | ||
1139 | * the timer will never be started and the bytes will remain in the | ||
1140 | * construction buffer forever. The solution is to execute a DRAIN | ||
1141 | * command after rearming the timer. This way any bytes received before | ||
1142 | * the DRAIN will be drained to memory, and any bytes received after | ||
1143 | * the DRAIN will start the TIMER and be drained when it expires. | ||
1144 | * Luckily, this only needs to be done when the DMA buffer is empty | ||
1145 | * since there is no requirement that this function return all | ||
1146 | * available data as long as it returns some. | ||
1147 | */ | ||
1148 | /* Re-arm the timer */ | ||
1149 | |||
1150 | writel(port->ip_rx_cons | SRCIR_ARM, &port->ip_serial_regs->srcir); | ||
1151 | |||
1152 | prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; | ||
1153 | cons_ptr = port->ip_rx_cons; | ||
1154 | |||
1155 | if (prod_ptr == cons_ptr) { | ||
1156 | int reset_dma = 0; | ||
1157 | |||
1158 | /* Input buffer appears empty, do a flush. */ | ||
1159 | |||
1160 | /* DMA must be enabled for this to work. */ | ||
1161 | if (!(port->ip_sscr & SSCR_DMA_EN)) { | ||
1162 | port->ip_sscr |= SSCR_DMA_EN; | ||
1163 | reset_dma = 1; | ||
1164 | } | ||
1165 | |||
1166 | /* Potential race condition: we must reload the srpir after | ||
1167 | * issuing the drain command, otherwise we could think the rx | ||
1168 | * buffer is empty, then take a very long interrupt, and when | ||
1169 | * we come back it's full and we wait forever for the drain to | ||
1170 | * complete. | ||
1171 | */ | ||
1172 | writel(port->ip_sscr | SSCR_RX_DRAIN, | ||
1173 | &port->ip_serial_regs->sscr); | ||
1174 | prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; | ||
1175 | |||
1176 | /* We must not wait for the DRAIN to complete unless there are | ||
1177 | * at least 8 bytes (2 ring entries) available to receive the | ||
1178 | * data otherwise the DRAIN will never complete and we'll | ||
1179 | * deadlock here. | ||
1180 | * In fact, to make things easier, I'll just ignore the flush if | ||
1181 | * there is any data at all now available. | ||
1182 | */ | ||
1183 | if (prod_ptr == cons_ptr) { | ||
1184 | loop_counter = 0; | ||
1185 | while (readl(&port->ip_serial_regs->sscr) & | ||
1186 | SSCR_RX_DRAIN) { | ||
1187 | loop_counter++; | ||
1188 | if (loop_counter > MAXITER) | ||
1189 | return -1; | ||
1190 | } | ||
1191 | |||
1192 | /* SIGH. We have to reload the prod_ptr *again* since | ||
1193 | * the drain may have caused it to change | ||
1194 | */ | ||
1195 | prod_ptr = readl(&port->ip_serial_regs->srpir) | ||
1196 | & PROD_CONS_MASK; | ||
1197 | } | ||
1198 | if (reset_dma) { | ||
1199 | port->ip_sscr &= ~SSCR_DMA_EN; | ||
1200 | writel(port->ip_sscr, &port->ip_serial_regs->sscr); | ||
1201 | } | ||
1202 | } | ||
1203 | inring = port->ip_inring; | ||
1204 | port->ip_flags &= ~READ_ABORTED; | ||
1205 | |||
1206 | total = 0; | ||
1207 | loop_counter = 0xfffff; /* to avoid hangs */ | ||
1208 | |||
1209 | /* Grab bytes from the hardware */ | ||
1210 | while ((prod_ptr != cons_ptr) && (len > 0)) { | ||
1211 | entry = (struct ring_entry *)((caddr_t) inring + cons_ptr); | ||
1212 | |||
1213 | if (loop_counter-- <= 0) { | ||
1214 | printk(KERN_WARNING "IOC3 serial: " | ||
1215 | "possible hang condition/" | ||
1216 | "port stuck on read (line %d).\n", | ||
1217 | the_port->line); | ||
1218 | break; | ||
1219 | } | ||
1220 | |||
1221 | /* According to the producer pointer, this ring entry | ||
1222 | * must contain some data. But if the PIO happened faster | ||
1223 | * than the DMA, the data may not be available yet, so let's | ||
1224 | * wait until it arrives. | ||
1225 | */ | ||
1226 | if ((entry->ring_allsc & RING_ANY_VALID) == 0) { | ||
1227 | /* Indicate the read is aborted so we don't disable | ||
1228 | * the interrupt thinking that the consumer is | ||
1229 | * congested. | ||
1230 | */ | ||
1231 | port->ip_flags |= READ_ABORTED; | ||
1232 | len = 0; | ||
1233 | break; | ||
1234 | } | ||
1235 | |||
1236 | /* Load the bytes/status out of the ring entry */ | ||
1237 | for (byte_num = 0; byte_num < 4 && len > 0; byte_num++) { | ||
1238 | sc = &(entry->ring_sc[byte_num]); | ||
1239 | |||
1240 | /* Check for change in modem state or overrun */ | ||
1241 | if ((*sc & RXSB_MODEM_VALID) | ||
1242 | && (port->ip_notify & N_DDCD)) { | ||
1243 | /* Notify upper layer if DCD dropped */ | ||
1244 | if ((port->ip_flags & DCD_ON) | ||
1245 | && !(*sc & RXSB_DCD)) { | ||
1246 | /* If we have already copied some data, | ||
1247 | * return it. We'll pick up the carrier | ||
1248 | * drop on the next pass. That way we | ||
1249 | * don't throw away the data that has | ||
1250 | * already been copied back to | ||
1251 | * the caller's buffer. | ||
1252 | */ | ||
1253 | if (total > 0) { | ||
1254 | len = 0; | ||
1255 | break; | ||
1256 | } | ||
1257 | port->ip_flags &= ~DCD_ON; | ||
1258 | |||
1259 | /* Turn off this notification so the | ||
1260 | * carrier drop protocol won't see it | ||
1261 | * again when it does a read. | ||
1262 | */ | ||
1263 | *sc &= ~RXSB_MODEM_VALID; | ||
1264 | |||
1265 | /* To keep things consistent, we need | ||
1266 | * to update the consumer pointer so | ||
1267 | * the next reader won't come in and | ||
1268 | * try to read the same ring entries | ||
1269 | * again. This must be done here before | ||
1270 | * the dcd change. | ||
1271 | */ | ||
1272 | |||
1273 | if ((entry->ring_allsc & RING_ANY_VALID) | ||
1274 | == 0) { | ||
1275 | cons_ptr += (int)sizeof | ||
1276 | (struct ring_entry); | ||
1277 | cons_ptr &= PROD_CONS_MASK; | ||
1278 | } | ||
1279 | writel(cons_ptr, | ||
1280 | &port->ip_serial_regs->srcir); | ||
1281 | port->ip_rx_cons = cons_ptr; | ||
1282 | |||
1283 | /* Notify upper layer of carrier drop */ | ||
1284 | if ((port->ip_notify & N_DDCD) | ||
1285 | && port->ip_port) { | ||
1286 | uart_handle_dcd_change | ||
1287 | (port->ip_port, 0); | ||
1288 | wake_up_interruptible | ||
1289 | (&the_port->info-> | ||
1290 | delta_msr_wait); | ||
1291 | } | ||
1292 | |||
1293 | /* If we had any data to return, we | ||
1294 | * would have returned it above. | ||
1295 | */ | ||
1296 | return 0; | ||
1297 | } | ||
1298 | } | ||
1299 | if (*sc & RXSB_MODEM_VALID) { | ||
1300 | /* Notify that an input overrun occurred */ | ||
1301 | if ((*sc & RXSB_OVERRUN) | ||
1302 | && (port->ip_notify & N_OVERRUN_ERROR)) { | ||
1303 | ioc3_cb_post_ncs(the_port, NCS_OVERRUN); | ||
1304 | } | ||
1305 | /* Don't look at this byte again */ | ||
1306 | *sc &= ~RXSB_MODEM_VALID; | ||
1307 | } | ||
1308 | |||
1309 | /* Check for valid data or RX errors */ | ||
1310 | if ((*sc & RXSB_DATA_VALID) && | ||
1311 | ((*sc & (RXSB_PAR_ERR | ||
1312 | | RXSB_FRAME_ERR | RXSB_BREAK)) | ||
1313 | && (port->ip_notify & (N_PARITY_ERROR | ||
1314 | | N_FRAMING_ERROR | ||
1315 | | N_BREAK)))) { | ||
1316 | /* There is an error condition on the next byte. | ||
1317 | * If we have already transferred some bytes, | ||
1318 | * we'll stop here. Otherwise if this is the | ||
1319 | * first byte to be read, we'll just transfer | ||
1320 | * it alone after notifying the | ||
1321 | * upper layer of its status. | ||
1322 | */ | ||
1323 | if (total > 0) { | ||
1324 | len = 0; | ||
1325 | break; | ||
1326 | } else { | ||
1327 | if ((*sc & RXSB_PAR_ERR) && | ||
1328 | (port-> | ||
1329 | ip_notify & N_PARITY_ERROR)) { | ||
1330 | ioc3_cb_post_ncs(the_port, | ||
1331 | NCS_PARITY); | ||
1332 | } | ||
1333 | if ((*sc & RXSB_FRAME_ERR) && | ||
1334 | (port-> | ||
1335 | ip_notify & N_FRAMING_ERROR)) { | ||
1336 | ioc3_cb_post_ncs(the_port, | ||
1337 | NCS_FRAMING); | ||
1338 | } | ||
1339 | if ((*sc & RXSB_BREAK) | ||
1340 | && (port->ip_notify & N_BREAK)) { | ||
1341 | ioc3_cb_post_ncs | ||
1342 | (the_port, NCS_BREAK); | ||
1343 | } | ||
1344 | len = 1; | ||
1345 | } | ||
1346 | } | ||
1347 | if (*sc & RXSB_DATA_VALID) { | ||
1348 | *sc &= ~RXSB_DATA_VALID; | ||
1349 | *buf = entry->ring_data[byte_num]; | ||
1350 | buf++; | ||
1351 | len--; | ||
1352 | total++; | ||
1353 | } | ||
1354 | } | ||
1355 | |||
1356 | /* If we used up this entry entirely, go on to the next one, | ||
1357 | * otherwise we must have run out of buffer space, so | ||
1358 | * leave the consumer pointer here for the next read in case | ||
1359 | * there are still unread bytes in this entry. | ||
1360 | */ | ||
1361 | if ((entry->ring_allsc & RING_ANY_VALID) == 0) { | ||
1362 | cons_ptr += (int)sizeof(struct ring_entry); | ||
1363 | cons_ptr &= PROD_CONS_MASK; | ||
1364 | } | ||
1365 | } | ||
1366 | |||
1367 | /* Update consumer pointer and re-arm rx timer interrupt */ | ||
1368 | writel(cons_ptr, &port->ip_serial_regs->srcir); | ||
1369 | port->ip_rx_cons = cons_ptr; | ||
1370 | |||
1371 | /* If we have now dipped below the rx high water mark and we have | ||
1372 | * rx_high interrupt turned off, we can now turn it back on again. | ||
1373 | */ | ||
1374 | if ((port->ip_flags & INPUT_HIGH) && (((prod_ptr - cons_ptr) | ||
1375 | & PROD_CONS_MASK) < | ||
1376 | ((port-> | ||
1377 | ip_sscr & | ||
1378 | SSCR_RX_THRESHOLD) | ||
1379 | << PROD_CONS_PTR_OFF))) { | ||
1380 | port->ip_flags &= ~INPUT_HIGH; | ||
1381 | enable_intrs(port, hooks->intr_rx_high); | ||
1382 | } | ||
1383 | return total; | ||
1384 | } | ||
1385 | |||
1386 | /** | ||
1387 | * receive_chars - upper level read. | ||
1388 | * @the_port: port to read from | ||
1389 | */ | ||
1390 | static int receive_chars(struct uart_port *the_port) | ||
1391 | { | ||
1392 | struct tty_struct *tty; | ||
1393 | unsigned char ch[MAX_CHARS]; | ||
1394 | int read_count = 0, read_room, flip = 0; | ||
1395 | struct uart_info *info = the_port->info; | ||
1396 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1397 | unsigned long pflags; | ||
1398 | |||
1399 | /* Make sure all the pointers are "good" ones */ | ||
1400 | if (!info) | ||
1401 | return 0; | ||
1402 | if (!info->tty) | ||
1403 | return 0; | ||
1404 | |||
1405 | if (!(port->ip_flags & INPUT_ENABLE)) | ||
1406 | return 0; | ||
1407 | |||
1408 | spin_lock_irqsave(&the_port->lock, pflags); | ||
1409 | tty = info->tty; | ||
1410 | |||
1411 | read_count = do_read(the_port, ch, MAX_CHARS); | ||
1412 | if (read_count > 0) { | ||
1413 | flip = 1; | ||
1414 | read_room = tty_buffer_request_room(tty, read_count); | ||
1415 | tty_insert_flip_string(tty, ch, read_room); | ||
1416 | the_port->icount.rx += read_count; | ||
1417 | } | ||
1418 | spin_unlock_irqrestore(&the_port->lock, pflags); | ||
1419 | |||
1420 | if (flip) | ||
1421 | tty_flip_buffer_push(tty); | ||
1422 | |||
1423 | return read_count; | ||
1424 | } | ||
1425 | |||
1426 | /** | ||
1427 | * ioc3uart_intr_one - lowest level (per port) interrupt handler. | ||
1428 | * @is : submodule | ||
1429 | * @idd: driver data | ||
1430 | * @pending: interrupts to handle | ||
1431 | * @regs: pt_regs | ||
1432 | */ | ||
1433 | |||
1434 | static int inline | ||
1435 | ioc3uart_intr_one(struct ioc3_submodule *is, | ||
1436 | struct ioc3_driver_data *idd, | ||
1437 | unsigned int pending, struct pt_regs *regs) | ||
1438 | { | ||
1439 | int port_num = GET_PORT_FROM_SIO_IR(pending); | ||
1440 | struct port_hooks *hooks; | ||
1441 | unsigned int rx_high_rd_aborted = 0; | ||
1442 | unsigned long flags; | ||
1443 | struct uart_port *the_port; | ||
1444 | struct ioc3_port *port; | ||
1445 | int loop_counter; | ||
1446 | struct ioc3_card *card_ptr; | ||
1447 | unsigned int sio_ir; | ||
1448 | |||
1449 | card_ptr = idd->data[is->id]; | ||
1450 | port = card_ptr->ic_port[port_num].icp_port; | ||
1451 | hooks = port->ip_hooks; | ||
1452 | |||
1453 | /* Possible race condition here: The tx_mt interrupt bit may be | ||
1454 | * cleared without the intervention of the interrupt handler, | ||
1455 | * e.g. by a write. If the top level interrupt handler reads a | ||
1456 | * tx_mt, then some other processor does a write, starting up | ||
1457 | * output, then we come in here, see the tx_mt and stop DMA, the | ||
1458 | * output started by the other processor will hang. Thus we can | ||
1459 | * only rely on tx_mt being legitimate if it is read while the | ||
1460 | * port lock is held. Therefore this bit must be ignored in the | ||
1461 | * passed in interrupt mask which was read by the top level | ||
1462 | * interrupt handler since the port lock was not held at the time | ||
1463 | * it was read. We can only rely on this bit being accurate if it | ||
1464 | * is read while the port lock is held. So we'll clear it for now, | ||
1465 | * and reload it later once we have the port lock. | ||
1466 | */ | ||
1467 | |||
1468 | sio_ir = pending & ~(hooks->intr_tx_mt); | ||
1469 | spin_lock_irqsave(&port->ip_lock, flags); | ||
1470 | |||
1471 | loop_counter = MAXITER; /* to avoid hangs */ | ||
1472 | |||
1473 | do { | ||
1474 | uint32_t shadow; | ||
1475 | |||
1476 | if (loop_counter-- <= 0) { | ||
1477 | printk(KERN_WARNING "IOC3 serial: " | ||
1478 | "possible hang condition/" | ||
1479 | "port stuck on interrupt (line %d).\n", | ||
1480 | ((struct uart_port *)port->ip_port)->line); | ||
1481 | break; | ||
1482 | } | ||
1483 | /* Handle a DCD change */ | ||
1484 | if (sio_ir & hooks->intr_delta_dcd) { | ||
1485 | ioc3_ack(is, idd, hooks->intr_delta_dcd); | ||
1486 | shadow = readl(&port->ip_serial_regs->shadow); | ||
1487 | |||
1488 | if ((port->ip_notify & N_DDCD) | ||
1489 | && (shadow & SHADOW_DCD) | ||
1490 | && (port->ip_port)) { | ||
1491 | the_port = port->ip_port; | ||
1492 | uart_handle_dcd_change(the_port, | ||
1493 | shadow & SHADOW_DCD); | ||
1494 | wake_up_interruptible | ||
1495 | (&the_port->info->delta_msr_wait); | ||
1496 | } else if ((port->ip_notify & N_DDCD) | ||
1497 | && !(shadow & SHADOW_DCD)) { | ||
1498 | /* Flag delta DCD/no DCD */ | ||
1499 | uart_handle_dcd_change(port->ip_port, | ||
1500 | shadow & SHADOW_DCD); | ||
1501 | port->ip_flags |= DCD_ON; | ||
1502 | } | ||
1503 | } | ||
1504 | |||
1505 | /* Handle a CTS change */ | ||
1506 | if (sio_ir & hooks->intr_delta_cts) { | ||
1507 | ioc3_ack(is, idd, hooks->intr_delta_cts); | ||
1508 | shadow = readl(&port->ip_serial_regs->shadow); | ||
1509 | |||
1510 | if ((port->ip_notify & N_DCTS) && (port->ip_port)) { | ||
1511 | the_port = port->ip_port; | ||
1512 | uart_handle_cts_change(the_port, shadow | ||
1513 | & SHADOW_CTS); | ||
1514 | wake_up_interruptible | ||
1515 | (&the_port->info->delta_msr_wait); | ||
1516 | } | ||
1517 | } | ||
1518 | |||
1519 | /* rx timeout interrupt. Must be some data available. Put this | ||
1520 | * before the check for rx_high since servicing this condition | ||
1521 | * may cause that condition to clear. | ||
1522 | */ | ||
1523 | if (sio_ir & hooks->intr_rx_timer) { | ||
1524 | ioc3_ack(is, idd, hooks->intr_rx_timer); | ||
1525 | if ((port->ip_notify & N_DATA_READY) | ||
1526 | && (port->ip_port)) { | ||
1527 | receive_chars(port->ip_port); | ||
1528 | } | ||
1529 | } | ||
1530 | |||
1531 | /* rx high interrupt. Must be after rx_timer. */ | ||
1532 | else if (sio_ir & hooks->intr_rx_high) { | ||
1533 | /* Data available, notify upper layer */ | ||
1534 | if ((port->ip_notify & N_DATA_READY) && port->ip_port) { | ||
1535 | receive_chars(port->ip_port); | ||
1536 | } | ||
1537 | |||
1538 | /* We can't ACK this interrupt. If receive_chars didn't | ||
1539 | * cause the condition to clear, we'll have to disable | ||
1540 | * the interrupt until the data is drained. | ||
1541 | * If the read was aborted, don't disable the interrupt | ||
1542 | * as this may cause us to hang indefinitely. An | ||
1543 | * aborted read generally means that this interrupt | ||
1544 | * hasn't been delivered to the cpu yet anyway, even | ||
1545 | * though we see it as asserted when we read the sio_ir. | ||
1546 | */ | ||
1547 | if ((sio_ir = PENDING(card_ptr, idd)) | ||
1548 | & hooks->intr_rx_high) { | ||
1549 | if (port->ip_flags & READ_ABORTED) { | ||
1550 | rx_high_rd_aborted++; | ||
1551 | } | ||
1552 | else { | ||
1553 | card_ptr->ic_enable &= ~hooks->intr_rx_high; | ||
1554 | port->ip_flags |= INPUT_HIGH; | ||
1555 | } | ||
1556 | } | ||
1557 | } | ||
1558 | |||
1559 | /* We got a low water interrupt: notify upper layer to | ||
1560 | * send more data. Must come before tx_mt since servicing | ||
1561 | * this condition may cause that condition to clear. | ||
1562 | */ | ||
1563 | if (sio_ir & hooks->intr_tx_explicit) { | ||
1564 | port->ip_flags &= ~LOWAT_WRITTEN; | ||
1565 | ioc3_ack(is, idd, hooks->intr_tx_explicit); | ||
1566 | if (port->ip_notify & N_OUTPUT_LOWAT) | ||
1567 | ioc3_cb_output_lowat(port); | ||
1568 | } | ||
1569 | |||
1570 | /* Handle tx_mt. Must come after tx_explicit. */ | ||
1571 | else if (sio_ir & hooks->intr_tx_mt) { | ||
1572 | /* If we are expecting a lowat notification | ||
1573 | * and we get to this point it probably means that for | ||
1574 | * some reason the tx_explicit didn't work as expected | ||
1575 | * (that can legitimately happen if the output buffer is | ||
1576 | * filled up in just the right way). | ||
1577 | * So send the notification now. | ||
1578 | */ | ||
1579 | if (port->ip_notify & N_OUTPUT_LOWAT) { | ||
1580 | ioc3_cb_output_lowat(port); | ||
1581 | |||
1582 | /* We need to reload the sio_ir since the lowat | ||
1583 | * call may have caused another write to occur, | ||
1584 | * clearing the tx_mt condition. | ||
1585 | */ | ||
1586 | sio_ir = PENDING(card_ptr, idd); | ||
1587 | } | ||
1588 | |||
1589 | /* If the tx_mt condition still persists even after the | ||
1590 | * lowat call, we've got some work to do. | ||
1591 | */ | ||
1592 | if (sio_ir & hooks->intr_tx_mt) { | ||
1593 | /* If we are not currently expecting DMA input, | ||
1594 | * and the transmitter has just gone idle, | ||
1595 | * there is no longer any reason for DMA, so | ||
1596 | * disable it. | ||
1597 | */ | ||
1598 | if (!(port->ip_notify | ||
1599 | & (N_DATA_READY | N_DDCD))) { | ||
1600 | BUG_ON(!(port->ip_sscr | ||
1601 | & SSCR_DMA_EN)); | ||
1602 | port->ip_sscr &= ~SSCR_DMA_EN; | ||
1603 | writel(port->ip_sscr, | ||
1604 | &port->ip_serial_regs->sscr); | ||
1605 | } | ||
1606 | /* Prevent infinite tx_mt interrupt */ | ||
1607 | card_ptr->ic_enable &= ~hooks->intr_tx_mt; | ||
1608 | } | ||
1609 | } | ||
1610 | sio_ir = PENDING(card_ptr, idd); | ||
1611 | |||
1612 | /* if the read was aborted and only hooks->intr_rx_high, | ||
1613 | * clear hooks->intr_rx_high, so we do not loop forever. | ||
1614 | */ | ||
1615 | |||
1616 | if (rx_high_rd_aborted && (sio_ir == hooks->intr_rx_high)) { | ||
1617 | sio_ir &= ~hooks->intr_rx_high; | ||
1618 | } | ||
1619 | } while (sio_ir & hooks->intr_all); | ||
1620 | |||
1621 | spin_unlock_irqrestore(&port->ip_lock, flags); | ||
1622 | ioc3_enable(is, idd, card_ptr->ic_enable); | ||
1623 | return 0; | ||
1624 | } | ||
1625 | |||
1626 | /** | ||
1627 | * ioc3uart_intr - field all serial interrupts | ||
1628 | * @is : submodule | ||
1629 | * @idd: driver data | ||
1630 | * @pending: interrupts to handle | ||
1631 | * @regs: pt_regs | ||
1632 | * | ||
1633 | */ | ||
1634 | |||
1635 | static int ioc3uart_intr(struct ioc3_submodule *is, | ||
1636 | struct ioc3_driver_data *idd, | ||
1637 | unsigned int pending, struct pt_regs *regs) | ||
1638 | { | ||
1639 | int ret = 0; | ||
1640 | |||
1641 | /* | ||
1642 | * The upper level interrupt handler sends interrupts for both ports | ||
1643 | * here. So we need to call for each port with its interrupts. | ||
1644 | */ | ||
1645 | |||
1646 | if (pending & SIO_IR_SA) | ||
1647 | ret |= ioc3uart_intr_one(is, idd, pending & SIO_IR_SA, regs); | ||
1648 | if (pending & SIO_IR_SB) | ||
1649 | ret |= ioc3uart_intr_one(is, idd, pending & SIO_IR_SB, regs); | ||
1650 | |||
1651 | return ret; | ||
1652 | } | ||
1653 | |||
1654 | /** | ||
1655 | * ic3_type | ||
1656 | * @port: Port to operate with (we ignore since we only have one port) | ||
1657 | * | ||
1658 | */ | ||
1659 | static const char *ic3_type(struct uart_port *the_port) | ||
1660 | { | ||
1661 | if (IS_RS232(the_port->line)) | ||
1662 | return "SGI IOC3 Serial [rs232]"; | ||
1663 | else | ||
1664 | return "SGI IOC3 Serial [rs422]"; | ||
1665 | } | ||
1666 | |||
1667 | /** | ||
1668 | * ic3_tx_empty - Is the transmitter empty? | ||
1669 | * @port: Port to operate on | ||
1670 | * | ||
1671 | */ | ||
1672 | static unsigned int ic3_tx_empty(struct uart_port *the_port) | ||
1673 | { | ||
1674 | unsigned int ret = 0; | ||
1675 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1676 | |||
1677 | if (readl(&port->ip_serial_regs->shadow) & SHADOW_TEMT) | ||
1678 | ret = TIOCSER_TEMT; | ||
1679 | return ret; | ||
1680 | } | ||
1681 | |||
1682 | /** | ||
1683 | * ic3_stop_tx - stop the transmitter | ||
1684 | * @port: Port to operate on | ||
1685 | * | ||
1686 | */ | ||
1687 | static void ic3_stop_tx(struct uart_port *the_port) | ||
1688 | { | ||
1689 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1690 | |||
1691 | if (port) | ||
1692 | set_notification(port, N_OUTPUT_LOWAT, 0); | ||
1693 | } | ||
1694 | |||
1695 | /** | ||
1696 | * ic3_stop_rx - stop the receiver | ||
1697 | * @port: Port to operate on | ||
1698 | * | ||
1699 | */ | ||
1700 | static void ic3_stop_rx(struct uart_port *the_port) | ||
1701 | { | ||
1702 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1703 | |||
1704 | if (port) | ||
1705 | port->ip_flags &= ~INPUT_ENABLE; | ||
1706 | } | ||
1707 | |||
1708 | /** | ||
1709 | * null_void_function | ||
1710 | * @port: Port to operate on | ||
1711 | * | ||
1712 | */ | ||
1713 | static void null_void_function(struct uart_port *the_port) | ||
1714 | { | ||
1715 | } | ||
1716 | |||
1717 | /** | ||
1718 | * ic3_shutdown - shut down the port - free irq and disable | ||
1719 | * @port: port to shut down | ||
1720 | * | ||
1721 | */ | ||
1722 | static void ic3_shutdown(struct uart_port *the_port) | ||
1723 | { | ||
1724 | unsigned long port_flags; | ||
1725 | struct ioc3_port *port; | ||
1726 | struct uart_info *info; | ||
1727 | |||
1728 | port = get_ioc3_port(the_port); | ||
1729 | if (!port) | ||
1730 | return; | ||
1731 | |||
1732 | info = the_port->info; | ||
1733 | wake_up_interruptible(&info->delta_msr_wait); | ||
1734 | |||
1735 | spin_lock_irqsave(&the_port->lock, port_flags); | ||
1736 | set_notification(port, N_ALL, 0); | ||
1737 | spin_unlock_irqrestore(&the_port->lock, port_flags); | ||
1738 | } | ||
1739 | |||
1740 | /** | ||
1741 | * ic3_set_mctrl - set control lines (dtr, rts, etc) | ||
1742 | * @port: Port to operate on | ||
1743 | * @mctrl: Lines to set/unset | ||
1744 | * | ||
1745 | */ | ||
1746 | static void ic3_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | ||
1747 | { | ||
1748 | unsigned char mcr = 0; | ||
1749 | |||
1750 | if (mctrl & TIOCM_RTS) | ||
1751 | mcr |= UART_MCR_RTS; | ||
1752 | if (mctrl & TIOCM_DTR) | ||
1753 | mcr |= UART_MCR_DTR; | ||
1754 | if (mctrl & TIOCM_OUT1) | ||
1755 | mcr |= UART_MCR_OUT1; | ||
1756 | if (mctrl & TIOCM_OUT2) | ||
1757 | mcr |= UART_MCR_OUT2; | ||
1758 | if (mctrl & TIOCM_LOOP) | ||
1759 | mcr |= UART_MCR_LOOP; | ||
1760 | |||
1761 | set_mcr(the_port, mcr, SHADOW_DTR); | ||
1762 | } | ||
1763 | |||
1764 | /** | ||
1765 | * ic3_get_mctrl - get control line info | ||
1766 | * @port: port to operate on | ||
1767 | * | ||
1768 | */ | ||
1769 | static unsigned int ic3_get_mctrl(struct uart_port *the_port) | ||
1770 | { | ||
1771 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1772 | uint32_t shadow; | ||
1773 | unsigned int ret = 0; | ||
1774 | |||
1775 | if (!port) | ||
1776 | return 0; | ||
1777 | |||
1778 | shadow = readl(&port->ip_serial_regs->shadow); | ||
1779 | if (shadow & SHADOW_DCD) | ||
1780 | ret |= TIOCM_CD; | ||
1781 | if (shadow & SHADOW_DR) | ||
1782 | ret |= TIOCM_DSR; | ||
1783 | if (shadow & SHADOW_CTS) | ||
1784 | ret |= TIOCM_CTS; | ||
1785 | return ret; | ||
1786 | } | ||
1787 | |||
1788 | /** | ||
1789 | * ic3_start_tx - Start transmitter. Called with the_port->lock | ||
1790 | * @port: Port to operate on | ||
1791 | * | ||
1792 | */ | ||
1793 | static void ic3_start_tx(struct uart_port *the_port) | ||
1794 | { | ||
1795 | struct ioc3_port *port = get_ioc3_port(the_port); | ||
1796 | |||
1797 | if (port) { | ||
1798 | set_notification(port, N_OUTPUT_LOWAT, 1); | ||
1799 | enable_intrs(port, port->ip_hooks->intr_tx_mt); | ||
1800 | } | ||
1801 | } | ||
1802 | |||
1803 | /** | ||
1804 | * ic3_break_ctl - handle breaks | ||
1805 | * @port: Port to operate on | ||
1806 | * @break_state: Break state | ||
1807 | * | ||
1808 | */ | ||
1809 | static void ic3_break_ctl(struct uart_port *the_port, int break_state) | ||
1810 | { | ||
1811 | } | ||
1812 | |||
1813 | /** | ||
1814 | * ic3_startup - Start up the serial port - always return 0 (We're always on) | ||
1815 | * @port: Port to operate on | ||
1816 | * | ||
1817 | */ | ||
1818 | static int ic3_startup(struct uart_port *the_port) | ||
1819 | { | ||
1820 | int retval; | ||
1821 | struct ioc3_port *port; | ||
1822 | struct ioc3_card *card_ptr; | ||
1823 | unsigned long port_flags; | ||
1824 | |||
1825 | if (!the_port) { | ||
1826 | NOT_PROGRESS(); | ||
1827 | return -ENODEV; | ||
1828 | } | ||
1829 | port = get_ioc3_port(the_port); | ||
1830 | if (!port) { | ||
1831 | NOT_PROGRESS(); | ||
1832 | return -ENODEV; | ||
1833 | } | ||
1834 | card_ptr = port->ip_card; | ||
1835 | port->ip_port = the_port; | ||
1836 | |||
1837 | if (!card_ptr) { | ||
1838 | NOT_PROGRESS(); | ||
1839 | return -ENODEV; | ||
1840 | } | ||
1841 | |||
1842 | /* Start up the serial port */ | ||
1843 | spin_lock_irqsave(&the_port->lock, port_flags); | ||
1844 | retval = ic3_startup_local(the_port); | ||
1845 | spin_unlock_irqrestore(&the_port->lock, port_flags); | ||
1846 | return retval; | ||
1847 | } | ||
1848 | |||
1849 | /** | ||
1850 | * ic3_set_termios - set termios stuff | ||
1851 | * @port: port to operate on | ||
1852 | * @termios: New settings | ||
1853 | * @termios: Old | ||
1854 | * | ||
1855 | */ | ||
1856 | static void | ||
1857 | ic3_set_termios(struct uart_port *the_port, | ||
1858 | struct termios *termios, struct termios *old_termios) | ||
1859 | { | ||
1860 | unsigned long port_flags; | ||
1861 | |||
1862 | spin_lock_irqsave(&the_port->lock, port_flags); | ||
1863 | ioc3_change_speed(the_port, termios, old_termios); | ||
1864 | spin_unlock_irqrestore(&the_port->lock, port_flags); | ||
1865 | } | ||
1866 | |||
1867 | /** | ||
1868 | * ic3_request_port - allocate resources for port - no op.... | ||
1869 | * @port: port to operate on | ||
1870 | * | ||
1871 | */ | ||
1872 | static int ic3_request_port(struct uart_port *port) | ||
1873 | { | ||
1874 | return 0; | ||
1875 | } | ||
1876 | |||
1877 | /* Associate the uart functions above - given to serial core */ | ||
1878 | static struct uart_ops ioc3_ops = { | ||
1879 | .tx_empty = ic3_tx_empty, | ||
1880 | .set_mctrl = ic3_set_mctrl, | ||
1881 | .get_mctrl = ic3_get_mctrl, | ||
1882 | .stop_tx = ic3_stop_tx, | ||
1883 | .start_tx = ic3_start_tx, | ||
1884 | .stop_rx = ic3_stop_rx, | ||
1885 | .enable_ms = null_void_function, | ||
1886 | .break_ctl = ic3_break_ctl, | ||
1887 | .startup = ic3_startup, | ||
1888 | .shutdown = ic3_shutdown, | ||
1889 | .set_termios = ic3_set_termios, | ||
1890 | .type = ic3_type, | ||
1891 | .release_port = null_void_function, | ||
1892 | .request_port = ic3_request_port, | ||
1893 | }; | ||
1894 | |||
1895 | /* | ||
1896 | * Boot-time initialization code | ||
1897 | */ | ||
1898 | |||
1899 | static struct uart_driver ioc3_uart = { | ||
1900 | .owner = THIS_MODULE, | ||
1901 | .driver_name = "ioc3_serial", | ||
1902 | .dev_name = DEVICE_NAME, | ||
1903 | .major = DEVICE_MAJOR, | ||
1904 | .minor = DEVICE_MINOR, | ||
1905 | .nr = MAX_LOGICAL_PORTS | ||
1906 | }; | ||
1907 | |||
1908 | /** | ||
1909 | * ioc3_serial_core_attach - register with serial core | ||
1910 | * This is done during pci probing | ||
1911 | * @is: submodule struct for this | ||
1912 | * @idd: handle for this card | ||
1913 | */ | ||
1914 | static inline int ioc3_serial_core_attach( struct ioc3_submodule *is, | ||
1915 | struct ioc3_driver_data *idd) | ||
1916 | { | ||
1917 | struct ioc3_port *port; | ||
1918 | struct uart_port *the_port; | ||
1919 | struct ioc3_card *card_ptr = idd->data[is->id]; | ||
1920 | int ii, phys_port; | ||
1921 | struct pci_dev *pdev = idd->pdev; | ||
1922 | |||
1923 | DPRINT_CONFIG(("%s: attach pdev 0x%p - card_ptr 0x%p\n", | ||
1924 | __FUNCTION__, pdev, (void *)card_ptr)); | ||
1925 | |||
1926 | if (!card_ptr) | ||
1927 | return -ENODEV; | ||
1928 | |||
1929 | /* once around for each logical port on this card */ | ||
1930 | for (ii = 0; ii < LOGICAL_PORTS_PER_CARD; ii++) { | ||
1931 | phys_port = GET_PHYSICAL_PORT(ii); | ||
1932 | the_port = &card_ptr->ic_port[phys_port]. | ||
1933 | icp_uart_port[GET_LOGICAL_PORT(ii)]; | ||
1934 | port = card_ptr->ic_port[phys_port].icp_port; | ||
1935 | port->ip_port = the_port; | ||
1936 | |||
1937 | DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p [%d/%d]\n", | ||
1938 | __FUNCTION__, (void *)the_port, (void *)port, | ||
1939 | phys_port, ii)); | ||
1940 | |||
1941 | /* membase, iobase and mapbase just need to be non-0 */ | ||
1942 | the_port->membase = (unsigned char __iomem *)1; | ||
1943 | the_port->iobase = (pdev->bus->number << 16) | ii; | ||
1944 | the_port->line = (Num_of_ioc3_cards << 2) | ii; | ||
1945 | the_port->mapbase = 1; | ||
1946 | the_port->type = PORT_16550A; | ||
1947 | the_port->fifosize = FIFO_SIZE; | ||
1948 | the_port->ops = &ioc3_ops; | ||
1949 | the_port->irq = idd->irq_io; | ||
1950 | the_port->dev = &pdev->dev; | ||
1951 | |||
1952 | if (uart_add_one_port(&ioc3_uart, the_port) < 0) { | ||
1953 | printk(KERN_WARNING | ||
1954 | "%s: unable to add port %d bus %d\n", | ||
1955 | __FUNCTION__, the_port->line, pdev->bus->number); | ||
1956 | } else { | ||
1957 | DPRINT_CONFIG(("IOC3 serial port %d irq %d bus %d\n", | ||
1958 | the_port->line, the_port->irq, pdev->bus->number)); | ||
1959 | } | ||
1960 | |||
1961 | /* all ports are rs232 for now */ | ||
1962 | if (IS_PHYSICAL_PORT(ii)) | ||
1963 | ioc3_set_proto(port, PROTO_RS232); | ||
1964 | } | ||
1965 | return 0; | ||
1966 | } | ||
1967 | |||
1968 | /** | ||
1969 | * ioc3uart_remove - register detach function | ||
1970 | * @is: submodule struct for this submodule | ||
1971 | * @idd: ioc3 driver data for this submodule | ||
1972 | */ | ||
1973 | |||
1974 | static int ioc3uart_remove(struct ioc3_submodule *is, | ||
1975 | struct ioc3_driver_data *idd) | ||
1976 | { | ||
1977 | struct ioc3_card *card_ptr = idd->data[is->id]; | ||
1978 | struct uart_port *the_port; | ||
1979 | struct ioc3_port *port; | ||
1980 | int ii; | ||
1981 | |||
1982 | if (card_ptr) { | ||
1983 | for (ii = 0; ii < LOGICAL_PORTS_PER_CARD; ii++) { | ||
1984 | the_port = &card_ptr->ic_port[GET_PHYSICAL_PORT(ii)]. | ||
1985 | icp_uart_port[GET_LOGICAL_PORT(ii)]; | ||
1986 | if (the_port) | ||
1987 | uart_remove_one_port(&ioc3_uart, the_port); | ||
1988 | port = card_ptr->ic_port[GET_PHYSICAL_PORT(ii)].icp_port; | ||
1989 | if (port && IS_PHYSICAL_PORT(ii) | ||
1990 | && (GET_PHYSICAL_PORT(ii) == 0)) { | ||
1991 | pci_free_consistent(port->ip_idd->pdev, | ||
1992 | TOTAL_RING_BUF_SIZE, | ||
1993 | (void *)port->ip_cpu_ringbuf, | ||
1994 | port->ip_dma_ringbuf); | ||
1995 | kfree(port); | ||
1996 | card_ptr->ic_port[GET_PHYSICAL_PORT(ii)]. | ||
1997 | icp_port = NULL; | ||
1998 | } | ||
1999 | } | ||
2000 | kfree(card_ptr); | ||
2001 | idd->data[is->id] = NULL; | ||
2002 | } | ||
2003 | return 0; | ||
2004 | } | ||
2005 | |||
2006 | /** | ||
2007 | * ioc3uart_probe - card probe function called from shim driver | ||
2008 | * @is: submodule struct for this submodule | ||
2009 | * @idd: ioc3 driver data for this card | ||
2010 | */ | ||
2011 | |||
2012 | static int __devinit | ||
2013 | ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd) | ||
2014 | { | ||
2015 | struct pci_dev *pdev = idd->pdev; | ||
2016 | struct ioc3_card *card_ptr; | ||
2017 | int ret = 0; | ||
2018 | struct ioc3_port *port; | ||
2019 | struct ioc3_port *ports[PORTS_PER_CARD]; | ||
2020 | int phys_port; | ||
2021 | |||
2022 | DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, is, idd)); | ||
2023 | |||
2024 | card_ptr = kmalloc(sizeof(struct ioc3_card), GFP_KERNEL); | ||
2025 | if (!card_ptr) { | ||
2026 | printk(KERN_WARNING "ioc3_attach_one" | ||
2027 | ": unable to get memory for the IOC3\n"); | ||
2028 | return -ENOMEM; | ||
2029 | } | ||
2030 | memset(card_ptr, 0, sizeof(struct ioc3_card)); | ||
2031 | idd->data[is->id] = card_ptr; | ||
2032 | Submodule_slot = is->id; | ||
2033 | |||
2034 | writel(((UARTA_BASE >> 3) << SIO_CR_SER_A_BASE_SHIFT) | | ||
2035 | ((UARTB_BASE >> 3) << SIO_CR_SER_B_BASE_SHIFT) | | ||
2036 | (0xf << SIO_CR_CMD_PULSE_SHIFT), &idd->vma->sio_cr); | ||
2037 | |||
2038 | pci_write_config_dword(pdev, PCI_LAT, 0xff00); | ||
2039 | |||
2040 | /* Enable serial port mode select generic PIO pins as outputs */ | ||
2041 | ioc3_gpcr_set(idd, GPCR_UARTA_MODESEL | GPCR_UARTB_MODESEL); | ||
2042 | |||
2043 | /* Create port structures for each port */ | ||
2044 | for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) { | ||
2045 | port = kmalloc(sizeof(struct ioc3_port), GFP_KERNEL); | ||
2046 | if (!port) { | ||
2047 | printk(KERN_WARNING | ||
2048 | "IOC3 serial memory not available for port\n"); | ||
2049 | goto out4; | ||
2050 | } | ||
2051 | memset(port, 0, sizeof(struct ioc3_port)); | ||
2052 | spin_lock_init(&port->ip_lock); | ||
2053 | |||
2054 | /* we need to remember the previous ones, to point back to | ||
2055 | * them farther down - setting up the ring buffers. | ||
2056 | */ | ||
2057 | ports[phys_port] = port; | ||
2058 | |||
2059 | /* init to something useful */ | ||
2060 | card_ptr->ic_port[phys_port].icp_port = port; | ||
2061 | port->ip_is = is; | ||
2062 | port->ip_idd = idd; | ||
2063 | port->ip_baud = 9600; | ||
2064 | port->ip_card = card_ptr; | ||
2065 | port->ip_hooks = &hooks_array[phys_port]; | ||
2066 | |||
2067 | /* Setup each port */ | ||
2068 | if (phys_port == 0) { | ||
2069 | port->ip_serial_regs = &idd->vma->port_a; | ||
2070 | port->ip_uart_regs = &idd->vma->sregs.uarta; | ||
2071 | |||
2072 | DPRINT_CONFIG(("%s : Port A ip_serial_regs 0x%p " | ||
2073 | "ip_uart_regs 0x%p\n", | ||
2074 | __FUNCTION__, | ||
2075 | (void *)port->ip_serial_regs, | ||
2076 | (void *)port->ip_uart_regs)); | ||
2077 | |||
2078 | /* setup ring buffers */ | ||
2079 | port->ip_cpu_ringbuf = pci_alloc_consistent(pdev, | ||
2080 | TOTAL_RING_BUF_SIZE, &port->ip_dma_ringbuf); | ||
2081 | |||
2082 | BUG_ON(!((((int64_t) port->ip_dma_ringbuf) & | ||
2083 | (TOTAL_RING_BUF_SIZE - 1)) == 0)); | ||
2084 | port->ip_inring = RING(port, RX_A); | ||
2085 | port->ip_outring = RING(port, TX_A); | ||
2086 | DPRINT_CONFIG(("%s : Port A ip_cpu_ringbuf 0x%p " | ||
2087 | "ip_dma_ringbuf 0x%p, ip_inring 0x%p " | ||
2088 | "ip_outring 0x%p\n", | ||
2089 | __FUNCTION__, | ||
2090 | (void *)port->ip_cpu_ringbuf, | ||
2091 | (void *)port->ip_dma_ringbuf, | ||
2092 | (void *)port->ip_inring, | ||
2093 | (void *)port->ip_outring)); | ||
2094 | } | ||
2095 | else { | ||
2096 | port->ip_serial_regs = &idd->vma->port_b; | ||
2097 | port->ip_uart_regs = &idd->vma->sregs.uartb; | ||
2098 | |||
2099 | DPRINT_CONFIG(("%s : Port B ip_serial_regs 0x%p " | ||
2100 | "ip_uart_regs 0x%p\n", | ||
2101 | __FUNCTION__, | ||
2102 | (void *)port->ip_serial_regs, | ||
2103 | (void *)port->ip_uart_regs)); | ||
2104 | |||
2105 | /* share the ring buffers */ | ||
2106 | port->ip_dma_ringbuf = | ||
2107 | ports[phys_port - 1]->ip_dma_ringbuf; | ||
2108 | port->ip_cpu_ringbuf = | ||
2109 | ports[phys_port - 1]->ip_cpu_ringbuf; | ||
2110 | port->ip_inring = RING(port, RX_B); | ||
2111 | port->ip_outring = RING(port, TX_B); | ||
2112 | DPRINT_CONFIG(("%s : Port B ip_cpu_ringbuf 0x%p " | ||
2113 | "ip_dma_ringbuf 0x%p, ip_inring 0x%p " | ||
2114 | "ip_outring 0x%p\n", | ||
2115 | __FUNCTION__, | ||
2116 | (void *)port->ip_cpu_ringbuf, | ||
2117 | (void *)port->ip_dma_ringbuf, | ||
2118 | (void *)port->ip_inring, | ||
2119 | (void *)port->ip_outring)); | ||
2120 | } | ||
2121 | |||
2122 | DPRINT_CONFIG(("%s : port %d [addr 0x%p] card_ptr 0x%p", | ||
2123 | __FUNCTION__, | ||
2124 | phys_port, (void *)port, (void *)card_ptr)); | ||
2125 | DPRINT_CONFIG((" ip_serial_regs 0x%p ip_uart_regs 0x%p\n", | ||
2126 | (void *)port->ip_serial_regs, | ||
2127 | (void *)port->ip_uart_regs)); | ||
2128 | |||
2129 | /* Initialize the hardware for IOC3 */ | ||
2130 | port_init(port); | ||
2131 | |||
2132 | DPRINT_CONFIG(("%s: phys_port %d port 0x%p inring 0x%p " | ||
2133 | "outring 0x%p\n", | ||
2134 | __FUNCTION__, | ||
2135 | phys_port, (void *)port, | ||
2136 | (void *)port->ip_inring, | ||
2137 | (void *)port->ip_outring)); | ||
2138 | |||
2139 | } | ||
2140 | |||
2141 | /* register port with the serial core */ | ||
2142 | |||
2143 | if ((ret = ioc3_serial_core_attach(is, idd))) | ||
2144 | goto out4; | ||
2145 | |||
2146 | Num_of_ioc3_cards++; | ||
2147 | |||
2148 | return ret; | ||
2149 | |||
2150 | /* error exits that give back resources */ | ||
2151 | out4: | ||
2152 | kfree(card_ptr); | ||
2153 | return ret; | ||
2154 | } | ||
2155 | |||
2156 | static struct ioc3_submodule ioc3uart_submodule = { | ||
2157 | .name = "IOC3uart", | ||
2158 | .probe = ioc3uart_probe, | ||
2159 | .remove = ioc3uart_remove, | ||
2160 | /* call .intr for both ports initially */ | ||
2161 | .irq_mask = SIO_IR_SA | SIO_IR_SB, | ||
2162 | .intr = ioc3uart_intr, | ||
2163 | .owner = THIS_MODULE, | ||
2164 | }; | ||
2165 | |||
2166 | /** | ||
2167 | * ioc3_detect - module init called, | ||
2168 | */ | ||
2169 | static int __devinit ioc3uart_init(void) | ||
2170 | { | ||
2171 | int ret; | ||
2172 | |||
2173 | /* register with serial core */ | ||
2174 | if ((ret = uart_register_driver(&ioc3_uart)) < 0) { | ||
2175 | printk(KERN_WARNING | ||
2176 | "%s: Couldn't register IOC3 uart serial driver\n", | ||
2177 | __FUNCTION__); | ||
2178 | return ret; | ||
2179 | } | ||
2180 | ret = ioc3_register_submodule(&ioc3uart_submodule); | ||
2181 | if (ret) | ||
2182 | uart_unregister_driver(&ioc3_uart); | ||
2183 | return ret; | ||
2184 | } | ||
2185 | |||
2186 | static void __devexit ioc3uart_exit(void) | ||
2187 | { | ||
2188 | ioc3_unregister_submodule(&ioc3uart_submodule); | ||
2189 | uart_unregister_driver(&ioc3_uart); | ||
2190 | } | ||
2191 | |||
2192 | module_init(ioc3uart_init); | ||
2193 | module_exit(ioc3uart_exit); | ||
2194 | |||
2195 | MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>"); | ||
2196 | MODULE_DESCRIPTION("Serial PCI driver module for SGI IOC3 card"); | ||
2197 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 5f52883e64d2..4e03a87f3fb4 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -69,7 +69,6 @@ | |||
69 | #include <asm/pmac_feature.h> | 69 | #include <asm/pmac_feature.h> |
70 | #include <asm/dbdma.h> | 70 | #include <asm/dbdma.h> |
71 | #include <asm/macio.h> | 71 | #include <asm/macio.h> |
72 | #include <asm/semaphore.h> | ||
73 | 72 | ||
74 | #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 73 | #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
75 | #define SUPPORT_SYSRQ | 74 | #define SUPPORT_SYSRQ |
@@ -1593,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) | |||
1593 | state = pmz_uart_reg.state + uap->port.line; | 1592 | state = pmz_uart_reg.state + uap->port.line; |
1594 | 1593 | ||
1595 | mutex_lock(&pmz_irq_mutex); | 1594 | mutex_lock(&pmz_irq_mutex); |
1596 | down(&state->sem); | 1595 | mutex_lock(&state->mutex); |
1597 | 1596 | ||
1598 | spin_lock_irqsave(&uap->port.lock, flags); | 1597 | spin_lock_irqsave(&uap->port.lock, flags); |
1599 | 1598 | ||
@@ -1624,7 +1623,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) | |||
1624 | /* Shut the chip down */ | 1623 | /* Shut the chip down */ |
1625 | pmz_set_scc_power(uap, 0); | 1624 | pmz_set_scc_power(uap, 0); |
1626 | 1625 | ||
1627 | up(&state->sem); | 1626 | mutex_unlock(&state->mutex); |
1628 | mutex_unlock(&pmz_irq_mutex); | 1627 | mutex_unlock(&pmz_irq_mutex); |
1629 | 1628 | ||
1630 | pmz_debug("suspend, switching complete\n"); | 1629 | pmz_debug("suspend, switching complete\n"); |
@@ -1653,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev) | |||
1653 | state = pmz_uart_reg.state + uap->port.line; | 1652 | state = pmz_uart_reg.state + uap->port.line; |
1654 | 1653 | ||
1655 | mutex_lock(&pmz_irq_mutex); | 1654 | mutex_lock(&pmz_irq_mutex); |
1656 | down(&state->sem); | 1655 | mutex_lock(&state->mutex); |
1657 | 1656 | ||
1658 | spin_lock_irqsave(&uap->port.lock, flags); | 1657 | spin_lock_irqsave(&uap->port.lock, flags); |
1659 | if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) { | 1658 | if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) { |
@@ -1685,7 +1684,7 @@ static int pmz_resume(struct macio_dev *mdev) | |||
1685 | } | 1684 | } |
1686 | 1685 | ||
1687 | bail: | 1686 | bail: |
1688 | up(&state->sem); | 1687 | mutex_unlock(&state->mutex); |
1689 | mutex_unlock(&pmz_irq_mutex); | 1688 | mutex_unlock(&pmz_irq_mutex); |
1690 | 1689 | ||
1691 | /* Right now, we deal with delay by blocking here, I'll be | 1690 | /* Right now, we deal with delay by blocking here, I'll be |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 2ca620900bcc..943770470b9d 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -638,7 +638,7 @@ static int uart_set_info(struct uart_state *state, | |||
638 | * module insertion/removal doesn't change anything | 638 | * module insertion/removal doesn't change anything |
639 | * under us. | 639 | * under us. |
640 | */ | 640 | */ |
641 | down(&state->sem); | 641 | mutex_lock(&state->mutex); |
642 | 642 | ||
643 | change_irq = new_serial.irq != port->irq; | 643 | change_irq = new_serial.irq != port->irq; |
644 | 644 | ||
@@ -797,7 +797,7 @@ static int uart_set_info(struct uart_state *state, | |||
797 | } else | 797 | } else |
798 | retval = uart_startup(state, 1); | 798 | retval = uart_startup(state, 1); |
799 | exit: | 799 | exit: |
800 | up(&state->sem); | 800 | mutex_unlock(&state->mutex); |
801 | return retval; | 801 | return retval; |
802 | } | 802 | } |
803 | 803 | ||
@@ -834,7 +834,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) | |||
834 | struct uart_port *port = state->port; | 834 | struct uart_port *port = state->port; |
835 | int result = -EIO; | 835 | int result = -EIO; |
836 | 836 | ||
837 | down(&state->sem); | 837 | mutex_lock(&state->mutex); |
838 | if ((!file || !tty_hung_up_p(file)) && | 838 | if ((!file || !tty_hung_up_p(file)) && |
839 | !(tty->flags & (1 << TTY_IO_ERROR))) { | 839 | !(tty->flags & (1 << TTY_IO_ERROR))) { |
840 | result = port->mctrl; | 840 | result = port->mctrl; |
@@ -843,7 +843,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) | |||
843 | result |= port->ops->get_mctrl(port); | 843 | result |= port->ops->get_mctrl(port); |
844 | spin_unlock_irq(&port->lock); | 844 | spin_unlock_irq(&port->lock); |
845 | } | 845 | } |
846 | up(&state->sem); | 846 | mutex_unlock(&state->mutex); |
847 | 847 | ||
848 | return result; | 848 | return result; |
849 | } | 849 | } |
@@ -856,13 +856,13 @@ uart_tiocmset(struct tty_struct *tty, struct file *file, | |||
856 | struct uart_port *port = state->port; | 856 | struct uart_port *port = state->port; |
857 | int ret = -EIO; | 857 | int ret = -EIO; |
858 | 858 | ||
859 | down(&state->sem); | 859 | mutex_lock(&state->mutex); |
860 | if ((!file || !tty_hung_up_p(file)) && | 860 | if ((!file || !tty_hung_up_p(file)) && |
861 | !(tty->flags & (1 << TTY_IO_ERROR))) { | 861 | !(tty->flags & (1 << TTY_IO_ERROR))) { |
862 | uart_update_mctrl(port, set, clear); | 862 | uart_update_mctrl(port, set, clear); |
863 | ret = 0; | 863 | ret = 0; |
864 | } | 864 | } |
865 | up(&state->sem); | 865 | mutex_unlock(&state->mutex); |
866 | return ret; | 866 | return ret; |
867 | } | 867 | } |
868 | 868 | ||
@@ -873,12 +873,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state) | |||
873 | 873 | ||
874 | BUG_ON(!kernel_locked()); | 874 | BUG_ON(!kernel_locked()); |
875 | 875 | ||
876 | down(&state->sem); | 876 | mutex_lock(&state->mutex); |
877 | 877 | ||
878 | if (port->type != PORT_UNKNOWN) | 878 | if (port->type != PORT_UNKNOWN) |
879 | port->ops->break_ctl(port, break_state); | 879 | port->ops->break_ctl(port, break_state); |
880 | 880 | ||
881 | up(&state->sem); | 881 | mutex_unlock(&state->mutex); |
882 | } | 882 | } |
883 | 883 | ||
884 | static int uart_do_autoconfig(struct uart_state *state) | 884 | static int uart_do_autoconfig(struct uart_state *state) |
@@ -894,7 +894,7 @@ static int uart_do_autoconfig(struct uart_state *state) | |||
894 | * changing, and hence any extra opens of the port while | 894 | * changing, and hence any extra opens of the port while |
895 | * we're auto-configuring. | 895 | * we're auto-configuring. |
896 | */ | 896 | */ |
897 | if (down_interruptible(&state->sem)) | 897 | if (mutex_lock_interruptible(&state->mutex)) |
898 | return -ERESTARTSYS; | 898 | return -ERESTARTSYS; |
899 | 899 | ||
900 | ret = -EBUSY; | 900 | ret = -EBUSY; |
@@ -920,7 +920,7 @@ static int uart_do_autoconfig(struct uart_state *state) | |||
920 | 920 | ||
921 | ret = uart_startup(state, 1); | 921 | ret = uart_startup(state, 1); |
922 | } | 922 | } |
923 | up(&state->sem); | 923 | mutex_unlock(&state->mutex); |
924 | return ret; | 924 | return ret; |
925 | } | 925 | } |
926 | 926 | ||
@@ -1074,7 +1074,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, | |||
1074 | if (ret != -ENOIOCTLCMD) | 1074 | if (ret != -ENOIOCTLCMD) |
1075 | goto out; | 1075 | goto out; |
1076 | 1076 | ||
1077 | down(&state->sem); | 1077 | mutex_lock(&state->mutex); |
1078 | 1078 | ||
1079 | if (tty_hung_up_p(filp)) { | 1079 | if (tty_hung_up_p(filp)) { |
1080 | ret = -EIO; | 1080 | ret = -EIO; |
@@ -1098,7 +1098,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, | |||
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | out_up: | 1100 | out_up: |
1101 | up(&state->sem); | 1101 | mutex_unlock(&state->mutex); |
1102 | out: | 1102 | out: |
1103 | return ret; | 1103 | return ret; |
1104 | } | 1104 | } |
@@ -1186,7 +1186,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1186 | 1186 | ||
1187 | DPRINTK("uart_close(%d) called\n", port->line); | 1187 | DPRINTK("uart_close(%d) called\n", port->line); |
1188 | 1188 | ||
1189 | down(&state->sem); | 1189 | mutex_lock(&state->mutex); |
1190 | 1190 | ||
1191 | if (tty_hung_up_p(filp)) | 1191 | if (tty_hung_up_p(filp)) |
1192 | goto done; | 1192 | goto done; |
@@ -1260,7 +1260,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1260 | wake_up_interruptible(&state->info->open_wait); | 1260 | wake_up_interruptible(&state->info->open_wait); |
1261 | 1261 | ||
1262 | done: | 1262 | done: |
1263 | up(&state->sem); | 1263 | mutex_unlock(&state->mutex); |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | static void uart_wait_until_sent(struct tty_struct *tty, int timeout) | 1266 | static void uart_wait_until_sent(struct tty_struct *tty, int timeout) |
@@ -1334,7 +1334,7 @@ static void uart_hangup(struct tty_struct *tty) | |||
1334 | BUG_ON(!kernel_locked()); | 1334 | BUG_ON(!kernel_locked()); |
1335 | DPRINTK("uart_hangup(%d)\n", state->port->line); | 1335 | DPRINTK("uart_hangup(%d)\n", state->port->line); |
1336 | 1336 | ||
1337 | down(&state->sem); | 1337 | mutex_lock(&state->mutex); |
1338 | if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { | 1338 | if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { |
1339 | uart_flush_buffer(tty); | 1339 | uart_flush_buffer(tty); |
1340 | uart_shutdown(state); | 1340 | uart_shutdown(state); |
@@ -1344,7 +1344,7 @@ static void uart_hangup(struct tty_struct *tty) | |||
1344 | wake_up_interruptible(&state->info->open_wait); | 1344 | wake_up_interruptible(&state->info->open_wait); |
1345 | wake_up_interruptible(&state->info->delta_msr_wait); | 1345 | wake_up_interruptible(&state->info->delta_msr_wait); |
1346 | } | 1346 | } |
1347 | up(&state->sem); | 1347 | mutex_unlock(&state->mutex); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | /* | 1350 | /* |
@@ -1447,9 +1447,9 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1447 | if (mctrl & TIOCM_CAR) | 1447 | if (mctrl & TIOCM_CAR) |
1448 | break; | 1448 | break; |
1449 | 1449 | ||
1450 | up(&state->sem); | 1450 | mutex_unlock(&state->mutex); |
1451 | schedule(); | 1451 | schedule(); |
1452 | down(&state->sem); | 1452 | mutex_lock(&state->mutex); |
1453 | 1453 | ||
1454 | if (signal_pending(current)) | 1454 | if (signal_pending(current)) |
1455 | break; | 1455 | break; |
@@ -1475,7 +1475,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1475 | 1475 | ||
1476 | mutex_lock(&port_mutex); | 1476 | mutex_lock(&port_mutex); |
1477 | state = drv->state + line; | 1477 | state = drv->state + line; |
1478 | if (down_interruptible(&state->sem)) { | 1478 | if (mutex_lock_interruptible(&state->mutex)) { |
1479 | state = ERR_PTR(-ERESTARTSYS); | 1479 | state = ERR_PTR(-ERESTARTSYS); |
1480 | goto out; | 1480 | goto out; |
1481 | } | 1481 | } |
@@ -1483,7 +1483,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1483 | state->count++; | 1483 | state->count++; |
1484 | if (!state->port) { | 1484 | if (!state->port) { |
1485 | state->count--; | 1485 | state->count--; |
1486 | up(&state->sem); | 1486 | mutex_unlock(&state->mutex); |
1487 | state = ERR_PTR(-ENXIO); | 1487 | state = ERR_PTR(-ENXIO); |
1488 | goto out; | 1488 | goto out; |
1489 | } | 1489 | } |
@@ -1504,7 +1504,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1504 | (unsigned long)state); | 1504 | (unsigned long)state); |
1505 | } else { | 1505 | } else { |
1506 | state->count--; | 1506 | state->count--; |
1507 | up(&state->sem); | 1507 | mutex_unlock(&state->mutex); |
1508 | state = ERR_PTR(-ENOMEM); | 1508 | state = ERR_PTR(-ENOMEM); |
1509 | } | 1509 | } |
1510 | } | 1510 | } |
@@ -1571,7 +1571,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1571 | if (tty_hung_up_p(filp)) { | 1571 | if (tty_hung_up_p(filp)) { |
1572 | retval = -EAGAIN; | 1572 | retval = -EAGAIN; |
1573 | state->count--; | 1573 | state->count--; |
1574 | up(&state->sem); | 1574 | mutex_unlock(&state->mutex); |
1575 | goto fail; | 1575 | goto fail; |
1576 | } | 1576 | } |
1577 | 1577 | ||
@@ -1591,7 +1591,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1591 | */ | 1591 | */ |
1592 | if (retval == 0) | 1592 | if (retval == 0) |
1593 | retval = uart_block_til_ready(filp, state); | 1593 | retval = uart_block_til_ready(filp, state); |
1594 | up(&state->sem); | 1594 | mutex_unlock(&state->mutex); |
1595 | 1595 | ||
1596 | /* | 1596 | /* |
1597 | * If this is the first open to succeed, adjust things to suit. | 1597 | * If this is the first open to succeed, adjust things to suit. |
@@ -1867,7 +1867,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
1867 | { | 1867 | { |
1868 | struct uart_state *state = drv->state + port->line; | 1868 | struct uart_state *state = drv->state + port->line; |
1869 | 1869 | ||
1870 | down(&state->sem); | 1870 | mutex_lock(&state->mutex); |
1871 | 1871 | ||
1872 | if (state->info && state->info->flags & UIF_INITIALIZED) { | 1872 | if (state->info && state->info->flags & UIF_INITIALIZED) { |
1873 | struct uart_ops *ops = port->ops; | 1873 | struct uart_ops *ops = port->ops; |
@@ -1896,7 +1896,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
1896 | 1896 | ||
1897 | uart_change_pm(state, 3); | 1897 | uart_change_pm(state, 3); |
1898 | 1898 | ||
1899 | up(&state->sem); | 1899 | mutex_unlock(&state->mutex); |
1900 | 1900 | ||
1901 | return 0; | 1901 | return 0; |
1902 | } | 1902 | } |
@@ -1905,7 +1905,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
1905 | { | 1905 | { |
1906 | struct uart_state *state = drv->state + port->line; | 1906 | struct uart_state *state = drv->state + port->line; |
1907 | 1907 | ||
1908 | down(&state->sem); | 1908 | mutex_lock(&state->mutex); |
1909 | 1909 | ||
1910 | uart_change_pm(state, 0); | 1910 | uart_change_pm(state, 0); |
1911 | 1911 | ||
@@ -1954,7 +1954,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
1954 | } | 1954 | } |
1955 | } | 1955 | } |
1956 | 1956 | ||
1957 | up(&state->sem); | 1957 | mutex_unlock(&state->mutex); |
1958 | 1958 | ||
1959 | return 0; | 1959 | return 0; |
1960 | } | 1960 | } |
@@ -2049,7 +2049,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state) | |||
2049 | if (info && info->tty) | 2049 | if (info && info->tty) |
2050 | tty_vhangup(info->tty); | 2050 | tty_vhangup(info->tty); |
2051 | 2051 | ||
2052 | down(&state->sem); | 2052 | mutex_lock(&state->mutex); |
2053 | 2053 | ||
2054 | state->info = NULL; | 2054 | state->info = NULL; |
2055 | 2055 | ||
@@ -2072,7 +2072,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state) | |||
2072 | kfree(info); | 2072 | kfree(info); |
2073 | } | 2073 | } |
2074 | 2074 | ||
2075 | up(&state->sem); | 2075 | mutex_unlock(&state->mutex); |
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | static struct tty_operations uart_ops = { | 2078 | static struct tty_operations uart_ops = { |
@@ -2161,7 +2161,7 @@ int uart_register_driver(struct uart_driver *drv) | |||
2161 | state->close_delay = 500; /* .5 seconds */ | 2161 | state->close_delay = 500; /* .5 seconds */ |
2162 | state->closing_wait = 30000; /* 30 seconds */ | 2162 | state->closing_wait = 30000; /* 30 seconds */ |
2163 | 2163 | ||
2164 | init_MUTEX(&state->sem); | 2164 | mutex_init(&state->mutex); |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | retval = tty_register_driver(normal); | 2167 | retval = tty_register_driver(normal); |
diff --git a/drivers/sn/Kconfig b/drivers/sn/Kconfig index 13b8d249da5c..d95265b187a3 100644 --- a/drivers/sn/Kconfig +++ b/drivers/sn/Kconfig | |||
@@ -17,4 +17,18 @@ config SGI_IOC4 | |||
17 | If you have an SGI Altix with an IOC4-based | 17 | If you have an SGI Altix with an IOC4-based |
18 | I/O controller say Y. Otherwise say N. | 18 | I/O controller say Y. Otherwise say N. |
19 | 19 | ||
20 | config SGI_IOC3 | ||
21 | tristate "SGI IOC3 Base IO support" | ||
22 | depends on (IA64_GENERIC || IA64_SGI_SN2) | ||
23 | default m | ||
24 | ---help--- | ||
25 | This option enables basic support for the SGI IOC3-based Base IO | ||
26 | controller card. This option does not enable any specific | ||
27 | functions on such a card, but provides necessary infrastructure | ||
28 | for other drivers to utilize. | ||
29 | |||
30 | If you have an SGI Altix with an IOC3-based | ||
31 | I/O controller or a PCI IOC3 serial card say Y. | ||
32 | Otherwise say N. | ||
33 | |||
20 | endmenu | 34 | endmenu |
diff --git a/drivers/sn/Makefile b/drivers/sn/Makefile index c2a284185372..2cda011597c0 100644 --- a/drivers/sn/Makefile +++ b/drivers/sn/Makefile | |||
@@ -4,3 +4,4 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-$(CONFIG_SGI_IOC4) += ioc4.o | 6 | obj-$(CONFIG_SGI_IOC4) += ioc4.o |
7 | obj-$(CONFIG_SGI_IOC3) += ioc3.o | ||
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c new file mode 100644 index 000000000000..aaa009f4a7bf --- /dev/null +++ b/drivers/sn/ioc3.c | |||
@@ -0,0 +1,851 @@ | |||
1 | /* | ||
2 | * SGI IOC3 master driver and IRQ demuxer | ||
3 | * | ||
4 | * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org> | ||
5 | * Heavily based on similar work by: | ||
6 | * Brent Casavant <bcasavan@sgi.com> - IOC4 master driver | ||
7 | * Pat Gefre <pfg@sgi.com> - IOC3 serial port IRQ demuxer | ||
8 | */ | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/ioc3.h> | ||
18 | #include <linux/rwsem.h> | ||
19 | |||
20 | #define IOC3_PCI_SIZE 0x100000 | ||
21 | |||
22 | static LIST_HEAD(ioc3_devices); | ||
23 | static int ioc3_counter; | ||
24 | static DECLARE_RWSEM(ioc3_devices_rwsem); | ||
25 | |||
26 | static struct ioc3_submodule *ioc3_submodules[IOC3_MAX_SUBMODULES]; | ||
27 | static struct ioc3_submodule *ioc3_ethernet; | ||
28 | static rwlock_t ioc3_submodules_lock = RW_LOCK_UNLOCKED; | ||
29 | |||
30 | /* NIC probing code */ | ||
31 | |||
32 | #define GPCR_MLAN_EN 0x00200000 /* enable MCR to pin 8 */ | ||
33 | |||
34 | static inline unsigned mcr_pack(unsigned pulse, unsigned sample) | ||
35 | { | ||
36 | return (pulse << 10) | (sample << 2); | ||
37 | } | ||
38 | |||
39 | static int nic_wait(struct ioc3_driver_data *idd) | ||
40 | { | ||
41 | volatile unsigned mcr; | ||
42 | |||
43 | do { | ||
44 | mcr = (volatile unsigned)idd->vma->mcr; | ||
45 | } while (!(mcr & 2)); | ||
46 | |||
47 | return mcr & 1; | ||
48 | } | ||
49 | |||
50 | static int nic_reset(struct ioc3_driver_data *idd) | ||
51 | { | ||
52 | int presence; | ||
53 | unsigned long flags; | ||
54 | |||
55 | local_irq_save(flags); | ||
56 | idd->vma->mcr = mcr_pack(500, 65); | ||
57 | presence = nic_wait(idd); | ||
58 | local_irq_restore(flags); | ||
59 | |||
60 | udelay(500); | ||
61 | |||
62 | return presence; | ||
63 | } | ||
64 | |||
65 | static inline int nic_read_bit(struct ioc3_driver_data *idd) | ||
66 | { | ||
67 | int result; | ||
68 | unsigned long flags; | ||
69 | |||
70 | local_irq_save(flags); | ||
71 | idd->vma->mcr = mcr_pack(6, 13); | ||
72 | result = nic_wait(idd); | ||
73 | local_irq_restore(flags); | ||
74 | |||
75 | udelay(500); | ||
76 | |||
77 | return result; | ||
78 | } | ||
79 | |||
80 | static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) | ||
81 | { | ||
82 | if (bit) | ||
83 | idd->vma->mcr = mcr_pack(6, 110); | ||
84 | else | ||
85 | idd->vma->mcr = mcr_pack(80, 30); | ||
86 | |||
87 | nic_wait(idd); | ||
88 | } | ||
89 | |||
90 | static unsigned nic_read_byte(struct ioc3_driver_data *idd) | ||
91 | { | ||
92 | unsigned result = 0; | ||
93 | int i; | ||
94 | |||
95 | for (i = 0; i < 8; i++) | ||
96 | result = (result >> 1) | (nic_read_bit(idd) << 7); | ||
97 | |||
98 | return result; | ||
99 | } | ||
100 | |||
101 | static void nic_write_byte(struct ioc3_driver_data *idd, int byte) | ||
102 | { | ||
103 | int i, bit; | ||
104 | |||
105 | for (i = 8; i; i--) { | ||
106 | bit = byte & 1; | ||
107 | byte >>= 1; | ||
108 | |||
109 | nic_write_bit(idd, bit); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | static unsigned long | ||
114 | nic_find(struct ioc3_driver_data *idd, int *last, unsigned long addr) | ||
115 | { | ||
116 | int a, b, index, disc; | ||
117 | |||
118 | nic_reset(idd); | ||
119 | |||
120 | /* Search ROM. */ | ||
121 | nic_write_byte(idd, 0xF0); | ||
122 | |||
123 | /* Algorithm from ``Book of iButton Standards''. */ | ||
124 | for (index = 0, disc = 0; index < 64; index++) { | ||
125 | a = nic_read_bit(idd); | ||
126 | b = nic_read_bit(idd); | ||
127 | |||
128 | if (a && b) { | ||
129 | printk(KERN_WARNING "IOC3 NIC search failed.\n"); | ||
130 | *last = 0; | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | if (!a && !b) { | ||
135 | if (index == *last) { | ||
136 | addr |= 1UL << index; | ||
137 | } else if (index > *last) { | ||
138 | addr &= ~(1UL << index); | ||
139 | disc = index; | ||
140 | } else if ((addr & (1UL << index)) == 0) | ||
141 | disc = index; | ||
142 | nic_write_bit(idd, (addr>>index)&1); | ||
143 | continue; | ||
144 | } else { | ||
145 | if (a) | ||
146 | addr |= 1UL << index; | ||
147 | else | ||
148 | addr &= ~(1UL << index); | ||
149 | nic_write_bit(idd, a); | ||
150 | continue; | ||
151 | } | ||
152 | } | ||
153 | *last = disc; | ||
154 | return addr; | ||
155 | } | ||
156 | |||
157 | static void nic_addr(struct ioc3_driver_data *idd, unsigned long addr) | ||
158 | { | ||
159 | int index; | ||
160 | |||
161 | nic_reset(idd); | ||
162 | nic_write_byte(idd, 0xF0); | ||
163 | for (index = 0; index < 64; index++) { | ||
164 | nic_read_bit(idd); | ||
165 | nic_read_bit(idd); | ||
166 | nic_write_bit(idd, (addr>>index)&1); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | static void crc16_byte(unsigned int *crc, unsigned char db) | ||
171 | { | ||
172 | int i; | ||
173 | |||
174 | for(i=0;i<8;i++) { | ||
175 | *crc <<= 1; | ||
176 | if((db^(*crc>>16)) & 1) | ||
177 | *crc ^= 0x8005; | ||
178 | db >>= 1; | ||
179 | } | ||
180 | *crc &= 0xFFFF; | ||
181 | } | ||
182 | |||
183 | static unsigned int crc16_area(unsigned char *dbs, int size, unsigned int crc) | ||
184 | { | ||
185 | while(size--) | ||
186 | crc16_byte(&crc, *(dbs++)); | ||
187 | return crc; | ||
188 | } | ||
189 | |||
190 | static void crc8_byte(unsigned int *crc, unsigned char db) | ||
191 | { | ||
192 | int i,f; | ||
193 | |||
194 | for(i=0;i<8;i++) { | ||
195 | f = (*crc ^ db) & 1; | ||
196 | *crc >>= 1; | ||
197 | db >>= 1; | ||
198 | if(f) | ||
199 | *crc ^= 0x8c; | ||
200 | } | ||
201 | *crc &= 0xff; | ||
202 | } | ||
203 | |||
204 | static unsigned int crc8_addr(unsigned long addr) | ||
205 | { | ||
206 | int i; | ||
207 | unsigned int crc = 0x00; | ||
208 | |||
209 | for(i=0;i<8;i++) | ||
210 | crc8_byte(&crc, addr>>(i<<3)); | ||
211 | return crc; | ||
212 | } | ||
213 | |||
214 | static void | ||
215 | read_redir_page(struct ioc3_driver_data *idd, unsigned long addr, int page, | ||
216 | unsigned char *redir, unsigned char *data) | ||
217 | { | ||
218 | int loops = 16, i; | ||
219 | |||
220 | while(redir[page] != 0xFF) { | ||
221 | page = redir[page]^0xFF; | ||
222 | loops--; | ||
223 | if(loops<0) { | ||
224 | printk(KERN_ERR "IOC3: NIC circular redirection\n"); | ||
225 | return; | ||
226 | } | ||
227 | } | ||
228 | loops = 3; | ||
229 | while(loops>0) { | ||
230 | nic_addr(idd, addr); | ||
231 | nic_write_byte(idd, 0xF0); | ||
232 | nic_write_byte(idd, (page << 5) & 0xE0); | ||
233 | nic_write_byte(idd, (page >> 3) & 0x1F); | ||
234 | for(i=0;i<0x20;i++) | ||
235 | data[i] = nic_read_byte(idd); | ||
236 | if(crc16_area(data, 0x20, 0x0000) == 0x800d) | ||
237 | return; | ||
238 | loops--; | ||
239 | } | ||
240 | printk(KERN_ERR "IOC3: CRC error in data page\n"); | ||
241 | for(i=0;i<0x20;i++) | ||
242 | data[i] = 0x00; | ||
243 | } | ||
244 | |||
245 | static void | ||
246 | read_redir_map(struct ioc3_driver_data *idd, unsigned long addr, | ||
247 | unsigned char *redir) | ||
248 | { | ||
249 | int i,j,loops = 3,crc_ok; | ||
250 | unsigned int crc; | ||
251 | |||
252 | while(loops>0) { | ||
253 | crc_ok = 1; | ||
254 | nic_addr(idd, addr); | ||
255 | nic_write_byte(idd, 0xAA); | ||
256 | nic_write_byte(idd, 0x00); | ||
257 | nic_write_byte(idd, 0x01); | ||
258 | for(i=0;i<64;i+=8) { | ||
259 | for(j=0;j<8;j++) | ||
260 | redir[i+j] = nic_read_byte(idd); | ||
261 | crc = crc16_area(redir+i, 8, (i==0)?0x8707:0x0000); | ||
262 | crc16_byte(&crc, nic_read_byte(idd)); | ||
263 | crc16_byte(&crc, nic_read_byte(idd)); | ||
264 | if(crc != 0x800d) | ||
265 | crc_ok = 0; | ||
266 | } | ||
267 | if(crc_ok) | ||
268 | return; | ||
269 | loops--; | ||
270 | } | ||
271 | printk(KERN_ERR "IOC3: CRC error in redirection page\n"); | ||
272 | for(i=0;i<64;i++) | ||
273 | redir[i] = 0xFF; | ||
274 | } | ||
275 | |||
276 | static void read_nic(struct ioc3_driver_data *idd, unsigned long addr) | ||
277 | { | ||
278 | unsigned char redir[64]; | ||
279 | unsigned char data[64],part[32]; | ||
280 | int i,j; | ||
281 | |||
282 | /* read redirections */ | ||
283 | read_redir_map(idd, addr, redir); | ||
284 | /* read data pages */ | ||
285 | read_redir_page(idd, addr, 0, redir, data); | ||
286 | read_redir_page(idd, addr, 1, redir, data+32); | ||
287 | /* assemble the part # */ | ||
288 | j=0; | ||
289 | for(i=0;i<19;i++) | ||
290 | if(data[i+11] != ' ') | ||
291 | part[j++] = data[i+11]; | ||
292 | for(i=0;i<6;i++) | ||
293 | if(data[i+32] != ' ') | ||
294 | part[j++] = data[i+32]; | ||
295 | part[j] = 0; | ||
296 | /* skip Octane power supplies */ | ||
297 | if(!strncmp(part, "060-0035-", 9)) | ||
298 | return; | ||
299 | if(!strncmp(part, "060-0038-", 9)) | ||
300 | return; | ||
301 | strcpy(idd->nic_part, part); | ||
302 | /* assemble the serial # */ | ||
303 | j=0; | ||
304 | for(i=0;i<10;i++) | ||
305 | if(data[i+1] != ' ') | ||
306 | idd->nic_serial[j++] = data[i+1]; | ||
307 | idd->nic_serial[j] = 0; | ||
308 | } | ||
309 | |||
310 | static void read_mac(struct ioc3_driver_data *idd, unsigned long addr) | ||
311 | { | ||
312 | int i, loops = 3; | ||
313 | unsigned char data[13]; | ||
314 | |||
315 | while(loops>0) { | ||
316 | nic_addr(idd, addr); | ||
317 | nic_write_byte(idd, 0xF0); | ||
318 | nic_write_byte(idd, 0x00); | ||
319 | nic_write_byte(idd, 0x00); | ||
320 | nic_read_byte(idd); | ||
321 | for(i=0;i<13;i++) | ||
322 | data[i] = nic_read_byte(idd); | ||
323 | if(crc16_area(data, 13, 0x0000) == 0x800d) { | ||
324 | for(i=10;i>4;i--) | ||
325 | idd->nic_mac[10-i] = data[i]; | ||
326 | return; | ||
327 | } | ||
328 | loops--; | ||
329 | } | ||
330 | printk(KERN_ERR "IOC3: CRC error in MAC address\n"); | ||
331 | for(i=0;i<6;i++) | ||
332 | idd->nic_mac[i] = 0x00; | ||
333 | } | ||
334 | |||
335 | static void probe_nic(struct ioc3_driver_data *idd) | ||
336 | { | ||
337 | int save = 0, loops = 3; | ||
338 | unsigned long first, addr; | ||
339 | |||
340 | idd->vma->gpcr_s = GPCR_MLAN_EN; | ||
341 | |||
342 | while(loops>0) { | ||
343 | idd->nic_part[0] = 0; | ||
344 | idd->nic_serial[0] = 0; | ||
345 | addr = first = nic_find(idd, &save, 0); | ||
346 | if(!first) | ||
347 | return; | ||
348 | while(1) { | ||
349 | if(crc8_addr(addr)) | ||
350 | break; | ||
351 | else { | ||
352 | switch(addr & 0xFF) { | ||
353 | case 0x0B: | ||
354 | read_nic(idd, addr); | ||
355 | break; | ||
356 | case 0x09: | ||
357 | case 0x89: | ||
358 | case 0x91: | ||
359 | read_mac(idd, addr); | ||
360 | break; | ||
361 | } | ||
362 | } | ||
363 | addr = nic_find(idd, &save, addr); | ||
364 | if(addr == first) | ||
365 | return; | ||
366 | } | ||
367 | loops--; | ||
368 | } | ||
369 | printk(KERN_ERR "IOC3: CRC error in NIC address\n"); | ||
370 | } | ||
371 | |||
372 | /* Interrupts */ | ||
373 | |||
374 | static inline void | ||
375 | write_ireg(struct ioc3_driver_data *idd, uint32_t val, int which) | ||
376 | { | ||
377 | unsigned long flags; | ||
378 | |||
379 | spin_lock_irqsave(&idd->ir_lock, flags); | ||
380 | switch (which) { | ||
381 | case IOC3_W_IES: | ||
382 | writel(val, &idd->vma->sio_ies); | ||
383 | break; | ||
384 | case IOC3_W_IEC: | ||
385 | writel(val, &idd->vma->sio_iec); | ||
386 | break; | ||
387 | } | ||
388 | spin_unlock_irqrestore(&idd->ir_lock, flags); | ||
389 | } | ||
390 | static inline uint32_t get_pending_intrs(struct ioc3_driver_data *idd) | ||
391 | { | ||
392 | unsigned long flag; | ||
393 | uint32_t intrs = 0; | ||
394 | |||
395 | spin_lock_irqsave(&idd->ir_lock, flag); | ||
396 | intrs = readl(&idd->vma->sio_ir); | ||
397 | intrs &= readl(&idd->vma->sio_ies); | ||
398 | spin_unlock_irqrestore(&idd->ir_lock, flag); | ||
399 | return intrs; | ||
400 | } | ||
401 | |||
402 | static irqreturn_t ioc3_intr_io(int irq, void *arg, struct pt_regs *regs) | ||
403 | { | ||
404 | unsigned long flags; | ||
405 | struct ioc3_driver_data *idd = (struct ioc3_driver_data *)arg; | ||
406 | int handled = 1, id; | ||
407 | unsigned int pending; | ||
408 | |||
409 | read_lock_irqsave(&ioc3_submodules_lock, flags); | ||
410 | |||
411 | if(idd->dual_irq && idd->vma->eisr) { | ||
412 | /* send Ethernet IRQ to the driver */ | ||
413 | if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && | ||
414 | ioc3_ethernet->intr) { | ||
415 | handled = handled && !ioc3_ethernet->intr(ioc3_ethernet, | ||
416 | idd, 0, regs); | ||
417 | } | ||
418 | } | ||
419 | pending = get_pending_intrs(idd); /* look at the IO IRQs */ | ||
420 | |||
421 | for(id=0;id<IOC3_MAX_SUBMODULES;id++) { | ||
422 | if(idd->active[id] && ioc3_submodules[id] | ||
423 | && (pending & ioc3_submodules[id]->irq_mask) | ||
424 | && ioc3_submodules[id]->intr) { | ||
425 | write_ireg(idd, ioc3_submodules[id]->irq_mask, | ||
426 | IOC3_W_IEC); | ||
427 | if(!ioc3_submodules[id]->intr(ioc3_submodules[id], | ||
428 | idd, pending & ioc3_submodules[id]->irq_mask, | ||
429 | regs)) | ||
430 | pending &= ~ioc3_submodules[id]->irq_mask; | ||
431 | if (ioc3_submodules[id]->reset_mask) | ||
432 | write_ireg(idd, ioc3_submodules[id]->irq_mask, | ||
433 | IOC3_W_IES); | ||
434 | } | ||
435 | } | ||
436 | read_unlock_irqrestore(&ioc3_submodules_lock, flags); | ||
437 | if(pending) { | ||
438 | printk(KERN_WARNING | ||
439 | "IOC3: Pending IRQs 0x%08x discarded and disabled\n",pending); | ||
440 | write_ireg(idd, pending, IOC3_W_IEC); | ||
441 | handled = 1; | ||
442 | } | ||
443 | return handled?IRQ_HANDLED:IRQ_NONE; | ||
444 | } | ||
445 | |||
446 | static irqreturn_t ioc3_intr_eth(int irq, void *arg, struct pt_regs *regs) | ||
447 | { | ||
448 | unsigned long flags; | ||
449 | struct ioc3_driver_data *idd = (struct ioc3_driver_data *)arg; | ||
450 | int handled = 1; | ||
451 | |||
452 | if(!idd->dual_irq) | ||
453 | return IRQ_NONE; | ||
454 | read_lock_irqsave(&ioc3_submodules_lock, flags); | ||
455 | if(ioc3_ethernet && idd->active[ioc3_ethernet->id] | ||
456 | && ioc3_ethernet->intr) | ||
457 | handled = handled && !ioc3_ethernet->intr(ioc3_ethernet, idd, 0, | ||
458 | regs); | ||
459 | read_unlock_irqrestore(&ioc3_submodules_lock, flags); | ||
460 | return handled?IRQ_HANDLED:IRQ_NONE; | ||
461 | } | ||
462 | |||
463 | void ioc3_enable(struct ioc3_submodule *is, | ||
464 | struct ioc3_driver_data *idd, unsigned int irqs) | ||
465 | { | ||
466 | write_ireg(idd, irqs & is->irq_mask, IOC3_W_IES); | ||
467 | } | ||
468 | |||
469 | void ioc3_ack(struct ioc3_submodule *is, struct ioc3_driver_data *idd, | ||
470 | unsigned int irqs) | ||
471 | { | ||
472 | writel(irqs & is->irq_mask, &idd->vma->sio_ir); | ||
473 | } | ||
474 | |||
475 | void ioc3_disable(struct ioc3_submodule *is, | ||
476 | struct ioc3_driver_data *idd, unsigned int irqs) | ||
477 | { | ||
478 | write_ireg(idd, irqs & is->irq_mask, IOC3_W_IEC); | ||
479 | } | ||
480 | |||
481 | void ioc3_gpcr_set(struct ioc3_driver_data *idd, unsigned int val) | ||
482 | { | ||
483 | unsigned long flags; | ||
484 | spin_lock_irqsave(&idd->gpio_lock, flags); | ||
485 | writel(val, &idd->vma->gpcr_s); | ||
486 | spin_unlock_irqrestore(&idd->gpio_lock, flags); | ||
487 | } | ||
488 | |||
489 | /* Keep it simple, stupid! */ | ||
490 | static int find_slot(void **tab, int max) | ||
491 | { | ||
492 | int i; | ||
493 | for(i=0;i<max;i++) | ||
494 | if(!(tab[i])) | ||
495 | return i; | ||
496 | return -1; | ||
497 | } | ||
498 | |||
499 | /* Register an IOC3 submodule */ | ||
500 | int ioc3_register_submodule(struct ioc3_submodule *is) | ||
501 | { | ||
502 | struct ioc3_driver_data *idd; | ||
503 | int alloc_id; | ||
504 | unsigned long flags; | ||
505 | |||
506 | write_lock_irqsave(&ioc3_submodules_lock, flags); | ||
507 | alloc_id = find_slot((void **)ioc3_submodules, IOC3_MAX_SUBMODULES); | ||
508 | if(alloc_id != -1) { | ||
509 | ioc3_submodules[alloc_id] = is; | ||
510 | if(is->ethernet) { | ||
511 | if(ioc3_ethernet==NULL) | ||
512 | ioc3_ethernet=is; | ||
513 | else | ||
514 | printk(KERN_WARNING | ||
515 | "IOC3 Ethernet module already registered!\n"); | ||
516 | } | ||
517 | } | ||
518 | write_unlock_irqrestore(&ioc3_submodules_lock, flags); | ||
519 | |||
520 | if(alloc_id == -1) { | ||
521 | printk(KERN_WARNING "Increase IOC3_MAX_SUBMODULES!\n"); | ||
522 | return -ENOMEM; | ||
523 | } | ||
524 | |||
525 | is->id=alloc_id; | ||
526 | |||
527 | /* Initialize submodule for each IOC3 */ | ||
528 | if (!is->probe) | ||
529 | return 0; | ||
530 | |||
531 | down_read(&ioc3_devices_rwsem); | ||
532 | list_for_each_entry(idd, &ioc3_devices, list) { | ||
533 | /* set to 1 for IRQs in probe */ | ||
534 | idd->active[alloc_id] = 1; | ||
535 | idd->active[alloc_id] = !is->probe(is, idd); | ||
536 | } | ||
537 | up_read(&ioc3_devices_rwsem); | ||
538 | |||
539 | return 0; | ||
540 | } | ||
541 | |||
542 | /* Unregister an IOC3 submodule */ | ||
543 | void ioc3_unregister_submodule(struct ioc3_submodule *is) | ||
544 | { | ||
545 | struct ioc3_driver_data *idd; | ||
546 | unsigned long flags; | ||
547 | |||
548 | write_lock_irqsave(&ioc3_submodules_lock, flags); | ||
549 | if(ioc3_submodules[is->id]==is) | ||
550 | ioc3_submodules[is->id]=NULL; | ||
551 | else | ||
552 | printk(KERN_WARNING | ||
553 | "IOC3 submodule %s has wrong ID.\n",is->name); | ||
554 | if(ioc3_ethernet==is) | ||
555 | ioc3_ethernet = NULL; | ||
556 | write_unlock_irqrestore(&ioc3_submodules_lock, flags); | ||
557 | |||
558 | /* Remove submodule for each IOC3 */ | ||
559 | down_read(&ioc3_devices_rwsem); | ||
560 | list_for_each_entry(idd, &ioc3_devices, list) | ||
561 | if(idd->active[is->id]) { | ||
562 | if(is->remove) | ||
563 | if(is->remove(is, idd)) | ||
564 | printk(KERN_WARNING | ||
565 | "%s: IOC3 submodule %s remove failed " | ||
566 | "for pci_dev %s.\n", | ||
567 | __FUNCTION__, module_name(is->owner), | ||
568 | pci_name(idd->pdev)); | ||
569 | idd->active[is->id] = 0; | ||
570 | if(is->irq_mask) | ||
571 | write_ireg(idd, is->irq_mask, IOC3_W_IEC); | ||
572 | } | ||
573 | up_read(&ioc3_devices_rwsem); | ||
574 | } | ||
575 | |||
576 | /********************* | ||
577 | * Device management * | ||
578 | *********************/ | ||
579 | |||
580 | static char * | ||
581 | ioc3_class_names[]={"unknown", "IP27 BaseIO", "IP30 system", "MENET 1/2/3", | ||
582 | "MENET 4", "CADduo", "Altix Serial"}; | ||
583 | |||
584 | static int ioc3_class(struct ioc3_driver_data *idd) | ||
585 | { | ||
586 | int res = IOC3_CLASS_NONE; | ||
587 | /* NIC-based logic */ | ||
588 | if(!strncmp(idd->nic_part, "030-0891-", 9)) | ||
589 | res = IOC3_CLASS_BASE_IP30; | ||
590 | if(!strncmp(idd->nic_part, "030-1155-", 9)) | ||
591 | res = IOC3_CLASS_CADDUO; | ||
592 | if(!strncmp(idd->nic_part, "030-1657-", 9)) | ||
593 | res = IOC3_CLASS_SERIAL; | ||
594 | if(!strncmp(idd->nic_part, "030-1664-", 9)) | ||
595 | res = IOC3_CLASS_SERIAL; | ||
596 | /* total random heuristics */ | ||
597 | #ifdef CONFIG_SGI_IP27 | ||
598 | if(!idd->nic_part[0]) | ||
599 | res = IOC3_CLASS_BASE_IP27; | ||
600 | #endif | ||
601 | /* print educational message */ | ||
602 | printk(KERN_INFO "IOC3 part: [%s], serial: [%s] => class %s\n", | ||
603 | idd->nic_part, idd->nic_serial, ioc3_class_names[res]); | ||
604 | return res; | ||
605 | } | ||
606 | /* Adds a new instance of an IOC3 card */ | ||
607 | static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | ||
608 | { | ||
609 | struct ioc3_driver_data *idd; | ||
610 | uint32_t pcmd; | ||
611 | int ret, id; | ||
612 | |||
613 | /* Enable IOC3 and take ownership of it */ | ||
614 | if ((ret = pci_enable_device(pdev))) { | ||
615 | printk(KERN_WARNING | ||
616 | "%s: Failed to enable IOC3 device for pci_dev %s.\n", | ||
617 | __FUNCTION__, pci_name(pdev)); | ||
618 | goto out; | ||
619 | } | ||
620 | pci_set_master(pdev); | ||
621 | |||
622 | #ifdef USE_64BIT_DMA | ||
623 | ret = pci_set_dma_mask(pdev, 0xffffffffffffffffULL); | ||
624 | if (!ret) { | ||
625 | ret = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL); | ||
626 | if (ret < 0) { | ||
627 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " | ||
628 | "for consistent allocations\n", | ||
629 | __FUNCTION__); | ||
630 | } | ||
631 | } | ||
632 | #endif | ||
633 | |||
634 | /* Set up per-IOC3 data */ | ||
635 | idd = kmalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL); | ||
636 | if (!idd) { | ||
637 | printk(KERN_WARNING | ||
638 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", | ||
639 | __FUNCTION__, pci_name(pdev)); | ||
640 | ret = -ENODEV; | ||
641 | goto out_idd; | ||
642 | } | ||
643 | memset(idd, 0, sizeof(struct ioc3_driver_data)); | ||
644 | spin_lock_init(&idd->ir_lock); | ||
645 | spin_lock_init(&idd->gpio_lock); | ||
646 | idd->pdev = pdev; | ||
647 | |||
648 | /* Map all IOC3 registers. These are shared between subdevices | ||
649 | * so the main IOC3 module manages them. | ||
650 | */ | ||
651 | idd->pma = pci_resource_start(pdev, 0); | ||
652 | if (!idd->pma) { | ||
653 | printk(KERN_WARNING | ||
654 | "%s: Unable to find IOC3 resource " | ||
655 | "for pci_dev %s.\n", | ||
656 | __FUNCTION__, pci_name(pdev)); | ||
657 | ret = -ENODEV; | ||
658 | goto out_pci; | ||
659 | } | ||
660 | if (!request_region(idd->pma, IOC3_PCI_SIZE, "ioc3")) { | ||
661 | printk(KERN_WARNING | ||
662 | "%s: Unable to request IOC3 region " | ||
663 | "for pci_dev %s.\n", | ||
664 | __FUNCTION__, pci_name(pdev)); | ||
665 | ret = -ENODEV; | ||
666 | goto out_pci; | ||
667 | } | ||
668 | idd->vma = ioremap(idd->pma, IOC3_PCI_SIZE); | ||
669 | if (!idd->vma) { | ||
670 | printk(KERN_WARNING | ||
671 | "%s: Unable to remap IOC3 region " | ||
672 | "for pci_dev %s.\n", | ||
673 | __FUNCTION__, pci_name(pdev)); | ||
674 | ret = -ENODEV; | ||
675 | goto out_misc_region; | ||
676 | } | ||
677 | |||
678 | /* Track PCI-device specific data */ | ||
679 | pci_set_drvdata(pdev, idd); | ||
680 | down_write(&ioc3_devices_rwsem); | ||
681 | list_add(&idd->list, &ioc3_devices); | ||
682 | idd->id = ioc3_counter++; | ||
683 | up_write(&ioc3_devices_rwsem); | ||
684 | |||
685 | idd->gpdr_shadow = idd->vma->gpdr; | ||
686 | |||
687 | /* Read IOC3 NIC contents */ | ||
688 | probe_nic(idd); | ||
689 | |||
690 | /* Detect IOC3 class */ | ||
691 | idd->class = ioc3_class(idd); | ||
692 | |||
693 | /* Initialize IOC3 */ | ||
694 | pci_read_config_dword(pdev, PCI_COMMAND, &pcmd); | ||
695 | pci_write_config_dword(pdev, PCI_COMMAND, | ||
696 | pcmd | PCI_COMMAND_MEMORY | | ||
697 | PCI_COMMAND_PARITY | PCI_COMMAND_SERR | | ||
698 | PCI_SCR_DROP_MODE_EN); | ||
699 | |||
700 | write_ireg(idd, ~0, IOC3_W_IEC); | ||
701 | writel(~0, &idd->vma->sio_ir); | ||
702 | |||
703 | /* Set up IRQs */ | ||
704 | if(idd->class == IOC3_CLASS_BASE_IP30 | ||
705 | || idd->class == IOC3_CLASS_BASE_IP27) { | ||
706 | writel(0, &idd->vma->eier); | ||
707 | writel(~0, &idd->vma->eisr); | ||
708 | |||
709 | idd->dual_irq = 1; | ||
710 | if (!request_irq(pdev->irq, ioc3_intr_eth, SA_SHIRQ, | ||
711 | "ioc3-eth", (void *)idd)) { | ||
712 | idd->irq_eth = pdev->irq; | ||
713 | } else { | ||
714 | printk(KERN_WARNING | ||
715 | "%s : request_irq fails for IRQ 0x%x\n ", | ||
716 | __FUNCTION__, pdev->irq); | ||
717 | } | ||
718 | if (!request_irq(pdev->irq+2, ioc3_intr_io, SA_SHIRQ, | ||
719 | "ioc3-io", (void *)idd)) { | ||
720 | idd->irq_io = pdev->irq+2; | ||
721 | } else { | ||
722 | printk(KERN_WARNING | ||
723 | "%s : request_irq fails for IRQ 0x%x\n ", | ||
724 | __FUNCTION__, pdev->irq+2); | ||
725 | } | ||
726 | } else { | ||
727 | if (!request_irq(pdev->irq, ioc3_intr_io, SA_SHIRQ, | ||
728 | "ioc3", (void *)idd)) { | ||
729 | idd->irq_io = pdev->irq; | ||
730 | } else { | ||
731 | printk(KERN_WARNING | ||
732 | "%s : request_irq fails for IRQ 0x%x\n ", | ||
733 | __FUNCTION__, pdev->irq); | ||
734 | } | ||
735 | } | ||
736 | |||
737 | /* Add this IOC3 to all submodules */ | ||
738 | read_lock(&ioc3_submodules_lock); | ||
739 | for(id=0;id<IOC3_MAX_SUBMODULES;id++) | ||
740 | if(ioc3_submodules[id] && ioc3_submodules[id]->probe) { | ||
741 | idd->active[id] = 1; | ||
742 | idd->active[id] = !ioc3_submodules[id]->probe | ||
743 | (ioc3_submodules[id], idd); | ||
744 | } | ||
745 | read_unlock(&ioc3_submodules_lock); | ||
746 | |||
747 | printk(KERN_INFO "IOC3 Master Driver loaded for %s\n", pci_name(pdev)); | ||
748 | |||
749 | return 0; | ||
750 | |||
751 | out_misc_region: | ||
752 | release_region(idd->pma, IOC3_PCI_SIZE); | ||
753 | out_pci: | ||
754 | kfree(idd); | ||
755 | out_idd: | ||
756 | pci_disable_device(pdev); | ||
757 | out: | ||
758 | return ret; | ||
759 | } | ||
760 | |||
761 | /* Removes a particular instance of an IOC3 card. */ | ||
762 | static void ioc3_remove(struct pci_dev *pdev) | ||
763 | { | ||
764 | int id; | ||
765 | struct ioc3_driver_data *idd; | ||
766 | |||
767 | idd = pci_get_drvdata(pdev); | ||
768 | |||
769 | /* Remove this IOC3 from all submodules */ | ||
770 | read_lock(&ioc3_submodules_lock); | ||
771 | for(id=0;id<IOC3_MAX_SUBMODULES;id++) | ||
772 | if(idd->active[id]) { | ||
773 | if(ioc3_submodules[id] && ioc3_submodules[id]->remove) | ||
774 | if(ioc3_submodules[id]->remove(ioc3_submodules[id], | ||
775 | idd)) | ||
776 | printk(KERN_WARNING | ||
777 | "%s: IOC3 submodule 0x%s remove failed " | ||
778 | "for pci_dev %s.\n", | ||
779 | __FUNCTION__, | ||
780 | module_name(ioc3_submodules[id]->owner), | ||
781 | pci_name(pdev)); | ||
782 | idd->active[id] = 0; | ||
783 | } | ||
784 | read_unlock(&ioc3_submodules_lock); | ||
785 | |||
786 | /* Clear and disable all IRQs */ | ||
787 | write_ireg(idd, ~0, IOC3_W_IEC); | ||
788 | writel(~0, &idd->vma->sio_ir); | ||
789 | |||
790 | /* Release resources */ | ||
791 | free_irq(idd->irq_io, (void *)idd); | ||
792 | if(idd->dual_irq) | ||
793 | free_irq(idd->irq_eth, (void *)idd); | ||
794 | iounmap(idd->vma); | ||
795 | release_region(idd->pma, IOC3_PCI_SIZE); | ||
796 | |||
797 | /* Disable IOC3 and relinquish */ | ||
798 | pci_disable_device(pdev); | ||
799 | |||
800 | /* Remove and free driver data */ | ||
801 | down_write(&ioc3_devices_rwsem); | ||
802 | list_del(&idd->list); | ||
803 | up_write(&ioc3_devices_rwsem); | ||
804 | kfree(idd); | ||
805 | } | ||
806 | |||
807 | static struct pci_device_id ioc3_id_table[] = { | ||
808 | {PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3, PCI_ANY_ID, PCI_ANY_ID}, | ||
809 | {0} | ||
810 | }; | ||
811 | |||
812 | static struct pci_driver ioc3_driver = { | ||
813 | .name = "IOC3", | ||
814 | .id_table = ioc3_id_table, | ||
815 | .probe = ioc3_probe, | ||
816 | .remove = ioc3_remove, | ||
817 | }; | ||
818 | |||
819 | MODULE_DEVICE_TABLE(pci, ioc3_id_table); | ||
820 | |||
821 | /********************* | ||
822 | * Module management * | ||
823 | *********************/ | ||
824 | |||
825 | /* Module load */ | ||
826 | static int __devinit ioc3_init(void) | ||
827 | { | ||
828 | if (ia64_platform_is("sn2")) | ||
829 | return pci_register_driver(&ioc3_driver); | ||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | /* Module unload */ | ||
834 | static void __devexit ioc3_exit(void) | ||
835 | { | ||
836 | pci_unregister_driver(&ioc3_driver); | ||
837 | } | ||
838 | |||
839 | module_init(ioc3_init); | ||
840 | module_exit(ioc3_exit); | ||
841 | |||
842 | MODULE_AUTHOR("Stanislaw Skowronek <skylark@linux-mips.org>"); | ||
843 | MODULE_DESCRIPTION("PCI driver for SGI IOC3"); | ||
844 | MODULE_LICENSE("GPL"); | ||
845 | |||
846 | EXPORT_SYMBOL(ioc3_register_submodule); | ||
847 | EXPORT_SYMBOL(ioc3_unregister_submodule); | ||
848 | EXPORT_SYMBOL(ioc3_ack); | ||
849 | EXPORT_SYMBOL(ioc3_gpcr_set); | ||
850 | EXPORT_SYMBOL(ioc3_disable); | ||
851 | EXPORT_SYMBOL(ioc3_enable); | ||
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 9baa6296fc95..7af1883d4bf9 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -207,7 +207,7 @@ static inline void usbatm_pop(struct atm_vcc *vcc, struct sk_buff *skb) | |||
207 | ** urbs ** | 207 | ** urbs ** |
208 | ************/ | 208 | ************/ |
209 | 209 | ||
210 | static inline struct urb *usbatm_pop_urb(struct usbatm_channel *channel) | 210 | static struct urb *usbatm_pop_urb(struct usbatm_channel *channel) |
211 | { | 211 | { |
212 | struct urb *urb; | 212 | struct urb *urb; |
213 | 213 | ||
@@ -224,7 +224,7 @@ static inline struct urb *usbatm_pop_urb(struct usbatm_channel *channel) | |||
224 | return urb; | 224 | return urb; |
225 | } | 225 | } |
226 | 226 | ||
227 | static inline int usbatm_submit_urb(struct urb *urb) | 227 | static int usbatm_submit_urb(struct urb *urb) |
228 | { | 228 | { |
229 | struct usbatm_channel *channel = urb->context; | 229 | struct usbatm_channel *channel = urb->context; |
230 | int ret; | 230 | int ret; |
diff --git a/drivers/video/68328fb.c b/drivers/video/68328fb.c index 3b0ddc55236b..78488bb41aeb 100644 --- a/drivers/video/68328fb.c +++ b/drivers/video/68328fb.c | |||
@@ -102,8 +102,7 @@ static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
102 | u_int transp, struct fb_info *info); | 102 | u_int transp, struct fb_info *info); |
103 | static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, | 103 | static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, |
104 | struct fb_info *info); | 104 | struct fb_info *info); |
105 | static int mc68x328fb_mmap(struct fb_info *info, struct file *file, | 105 | static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma); |
106 | struct vm_area_struct *vma); | ||
107 | 106 | ||
108 | static struct fb_ops mc68x328fb_ops = { | 107 | static struct fb_ops mc68x328fb_ops = { |
109 | .fb_check_var = mc68x328fb_check_var, | 108 | .fb_check_var = mc68x328fb_check_var, |
@@ -398,8 +397,7 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, | |||
398 | * Most drivers don't need their own mmap function | 397 | * Most drivers don't need their own mmap function |
399 | */ | 398 | */ |
400 | 399 | ||
401 | static int mc68x328fb_mmap(struct fb_info *info, struct file *file, | 400 | static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
402 | struct vm_area_struct *vma) | ||
403 | { | 401 | { |
404 | #ifndef MMU | 402 | #ifndef MMU |
405 | /* this is uClinux (no MMU) specific code */ | 403 | /* this is uClinux (no MMU) specific code */ |
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 750cebb18306..b058273527bb 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
@@ -883,7 +883,7 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
883 | * Note that we are entered with the kernel locked. | 883 | * Note that we are entered with the kernel locked. |
884 | */ | 884 | */ |
885 | static int | 885 | static int |
886 | acornfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 886 | acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
887 | { | 887 | { |
888 | unsigned long off, start; | 888 | unsigned long off, start; |
889 | u32 len; | 889 | u32 len; |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 0da4083ba908..b2187175d03f 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -307,7 +307,7 @@ static int clcdfb_blank(int blank_mode, struct fb_info *info) | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int clcdfb_mmap(struct fb_info *info, struct file *file, | 310 | static int clcdfb_mmap(struct fb_info *info, |
311 | struct vm_area_struct *vma) | 311 | struct vm_area_struct *vma) |
312 | { | 312 | { |
313 | struct clcd_fb *fb = to_clcd(info); | 313 | struct clcd_fb *fb = to_clcd(info); |
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 2c42a812655a..3033c72dea20 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -1131,9 +1131,7 @@ static void amifb_copyarea(struct fb_info *info, | |||
1131 | const struct fb_copyarea *region); | 1131 | const struct fb_copyarea *region); |
1132 | static void amifb_imageblit(struct fb_info *info, | 1132 | static void amifb_imageblit(struct fb_info *info, |
1133 | const struct fb_image *image); | 1133 | const struct fb_image *image); |
1134 | static int amifb_ioctl(struct inode *inode, struct file *file, | 1134 | static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); |
1135 | unsigned int cmd, unsigned long arg, | ||
1136 | struct fb_info *info); | ||
1137 | 1135 | ||
1138 | 1136 | ||
1139 | /* | 1137 | /* |
@@ -2172,9 +2170,8 @@ static void amifb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
2172 | * Amiga Frame Buffer Specific ioctls | 2170 | * Amiga Frame Buffer Specific ioctls |
2173 | */ | 2171 | */ |
2174 | 2172 | ||
2175 | static int amifb_ioctl(struct inode *inode, struct file *file, | 2173 | static int amifb_ioctl(struct fb_info *info, |
2176 | unsigned int cmd, unsigned long arg, | 2174 | unsigned int cmd, unsigned long arg) |
2177 | struct fb_info *info) | ||
2178 | { | 2175 | { |
2179 | union { | 2176 | union { |
2180 | struct fb_fix_cursorinfo fix; | 2177 | struct fb_fix_cursorinfo fix; |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 89060b2db8e5..df8e5667b348 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -399,9 +399,8 @@ static void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
399 | image->height); | 399 | image->height); |
400 | } | 400 | } |
401 | 401 | ||
402 | static int arcfb_ioctl(struct inode *inode, struct file *file, | 402 | static int arcfb_ioctl(struct fb_info *info, |
403 | unsigned int cmd, unsigned long arg, | 403 | unsigned int cmd, unsigned long arg) |
404 | struct fb_info *info) | ||
405 | { | 404 | { |
406 | void __user *argp = (void __user *)arg; | 405 | void __user *argp = (void __user *)arg; |
407 | struct arcfb_par *par = info->par; | 406 | struct arcfb_par *par = info->par; |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 15ec1295bc29..e69ab65f7843 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -2571,8 +2571,7 @@ atafb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info) | |||
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | static int | 2573 | static int |
2574 | atafb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 2574 | atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
2575 | unsigned long arg, int con, struct fb_info *info) | ||
2576 | { | 2575 | { |
2577 | switch (cmd) { | 2576 | switch (cmd) { |
2578 | #ifdef FBCMD_GET_CURRENTPAR | 2577 | #ifdef FBCMD_GET_CURRENTPAR |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index e686185a076d..bfc8a93b2c73 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -431,8 +431,7 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
431 | static int aty128fb_pan_display(struct fb_var_screeninfo *var, | 431 | static int aty128fb_pan_display(struct fb_var_screeninfo *var, |
432 | struct fb_info *fb); | 432 | struct fb_info *fb); |
433 | static int aty128fb_blank(int blank, struct fb_info *fb); | 433 | static int aty128fb_blank(int blank, struct fb_info *fb); |
434 | static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 434 | static int aty128fb_ioctl(struct fb_info *info, u_int cmd, unsigned long arg); |
435 | u_long arg, struct fb_info *info); | ||
436 | static int aty128fb_sync(struct fb_info *info); | 435 | static int aty128fb_sync(struct fb_info *info); |
437 | 436 | ||
438 | /* | 437 | /* |
@@ -2108,8 +2107,7 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
2108 | /* in param: u32* backlight value: 0 to 15 */ | 2107 | /* in param: u32* backlight value: 0 to 15 */ |
2109 | #define FBIO_ATY128_SET_MIRROR _IOW('@', 2, __u32) | 2108 | #define FBIO_ATY128_SET_MIRROR _IOW('@', 2, __u32) |
2110 | 2109 | ||
2111 | static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 2110 | static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
2112 | u_long arg, struct fb_info *info) | ||
2113 | { | 2111 | { |
2114 | struct aty128fb_par *par = info->par; | 2112 | struct aty128fb_par *par = info->par; |
2115 | u32 value; | 2113 | u32 value; |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index ed81005cbdba..485be386a8ff 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -238,13 +238,12 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
238 | u_int transp, struct fb_info *info); | 238 | u_int transp, struct fb_info *info); |
239 | static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | 239 | static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); |
240 | static int atyfb_blank(int blank, struct fb_info *info); | 240 | static int atyfb_blank(int blank, struct fb_info *info); |
241 | static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 241 | static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg); |
242 | u_long arg, struct fb_info *info); | ||
243 | extern void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); | 242 | extern void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
244 | extern void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); | 243 | extern void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
245 | extern void atyfb_imageblit(struct fb_info *info, const struct fb_image *image); | 244 | extern void atyfb_imageblit(struct fb_info *info, const struct fb_image *image); |
246 | #ifdef __sparc__ | 245 | #ifdef __sparc__ |
247 | static int atyfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma); | 246 | static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma); |
248 | #endif | 247 | #endif |
249 | static int atyfb_sync(struct fb_info *info); | 248 | static int atyfb_sync(struct fb_info *info); |
250 | 249 | ||
@@ -1739,8 +1738,7 @@ struct atyclk { | |||
1739 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) | 1738 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
1740 | #endif | 1739 | #endif |
1741 | 1740 | ||
1742 | static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 1741 | static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
1743 | u_long arg, struct fb_info *info) | ||
1744 | { | 1742 | { |
1745 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 1743 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
1746 | #ifdef __sparc__ | 1744 | #ifdef __sparc__ |
@@ -1845,7 +1843,7 @@ static int atyfb_sync(struct fb_info *info) | |||
1845 | } | 1843 | } |
1846 | 1844 | ||
1847 | #ifdef __sparc__ | 1845 | #ifdef __sparc__ |
1848 | static int atyfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 1846 | static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1849 | { | 1847 | { |
1850 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 1848 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
1851 | unsigned int size, page, map_size = 0; | 1849 | unsigned int size, page, map_size = 0; |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 156db84cb363..c9f0c5a07e6e 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -864,8 +864,8 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, | |||
864 | } | 864 | } |
865 | 865 | ||
866 | 866 | ||
867 | static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int cmd, | 867 | static int radeonfb_ioctl (struct fb_info *info, unsigned int cmd, |
868 | unsigned long arg, struct fb_info *info) | 868 | unsigned long arg) |
869 | { | 869 | { |
870 | struct radeonfb_info *rinfo = info->par; | 870 | struct radeonfb_info *rinfo = info->par; |
871 | unsigned int tmp; | 871 | unsigned int tmp; |
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 097d668c4fe5..556895e99645 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2734,7 +2734,7 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2734 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that | 2734 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that |
2735 | * reason. --BenH | 2735 | * reason. --BenH |
2736 | */ | 2736 | */ |
2737 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_OF) | 2737 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) |
2738 | if (_machine == _MACH_Pmac && rinfo->of_node) { | 2738 | if (_machine == _MACH_Pmac && rinfo->of_node) { |
2739 | if (rinfo->is_mobility && rinfo->pm_reg && | 2739 | if (rinfo->is_mobility && rinfo->pm_reg && |
2740 | rinfo->family <= CHIP_FAMILY_RV250) | 2740 | rinfo->family <= CHIP_FAMILY_RV250) |
@@ -2778,12 +2778,12 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2778 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); | 2778 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); |
2779 | #endif | 2779 | #endif |
2780 | } | 2780 | } |
2781 | #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */ | 2781 | #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) */ |
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) | 2784 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) |
2785 | { | 2785 | { |
2786 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_OF) | 2786 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) |
2787 | if (rinfo->pm_mode != radeon_pm_none) | 2787 | if (rinfo->pm_mode != radeon_pm_none) |
2788 | pmac_set_early_video_resume(NULL, NULL); | 2788 | pmac_set_early_video_resume(NULL, NULL); |
2789 | #endif | 2789 | #endif |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a5129806172f..2406899f1207 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -379,7 +379,7 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
379 | * Map video memory in user space. We don't use the generic fb_mmap method mainly | 379 | * Map video memory in user space. We don't use the generic fb_mmap method mainly |
380 | * to allow the use of the TLB streaming flag (CCA=6) | 380 | * to allow the use of the TLB streaming flag (CCA=6) |
381 | */ | 381 | */ |
382 | int au1100fb_fb_mmap(struct fb_info *fbi, struct file *file, struct vm_area_struct *vma) | 382 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
383 | { | 383 | { |
384 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 384 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); |
385 | unsigned int len; | 385 | unsigned int len; |
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 9248fe1fbb1a..c029db4646f6 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
@@ -35,9 +35,8 @@ | |||
35 | 35 | ||
36 | static int bw2_blank(int, struct fb_info *); | 36 | static int bw2_blank(int, struct fb_info *); |
37 | 37 | ||
38 | static int bw2_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 38 | static int bw2_mmap(struct fb_info *, struct vm_area_struct *); |
39 | static int bw2_ioctl(struct inode *, struct file *, unsigned int, | 39 | static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long); |
40 | unsigned long, struct fb_info *); | ||
41 | 40 | ||
42 | /* | 41 | /* |
43 | * Frame buffer operations | 42 | * Frame buffer operations |
@@ -169,7 +168,7 @@ static struct sbus_mmap_map bw2_mmap_map[] = { | |||
169 | { .size = 0 } | 168 | { .size = 0 } |
170 | }; | 169 | }; |
171 | 170 | ||
172 | static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 171 | static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) |
173 | { | 172 | { |
174 | struct bw2_par *par = (struct bw2_par *)info->par; | 173 | struct bw2_par *par = (struct bw2_par *)info->par; |
175 | 174 | ||
@@ -181,8 +180,7 @@ static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
181 | vma); | 180 | vma); |
182 | } | 181 | } |
183 | 182 | ||
184 | static int bw2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 183 | static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
185 | unsigned long arg, struct fb_info *info) | ||
186 | { | 184 | { |
187 | struct bw2_par *par = (struct bw2_par *) info->par; | 185 | struct bw2_par *par = (struct bw2_par *) info->par; |
188 | 186 | ||
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index a56147102abb..63b6c79c8a0a 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -31,9 +31,8 @@ | |||
31 | static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned, | 31 | static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned, |
32 | unsigned, struct fb_info *); | 32 | unsigned, struct fb_info *); |
33 | 33 | ||
34 | static int cg14_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 34 | static int cg14_mmap(struct fb_info *, struct vm_area_struct *); |
35 | static int cg14_ioctl(struct inode *, struct file *, unsigned int, | 35 | static int cg14_ioctl(struct fb_info *, unsigned int, unsigned long); |
36 | unsigned long, struct fb_info *); | ||
37 | static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 36 | static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
38 | 37 | ||
39 | /* | 38 | /* |
@@ -268,7 +267,7 @@ static int cg14_setcolreg(unsigned regno, | |||
268 | return 0; | 267 | return 0; |
269 | } | 268 | } |
270 | 269 | ||
271 | static int cg14_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 270 | static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma) |
272 | { | 271 | { |
273 | struct cg14_par *par = (struct cg14_par *) info->par; | 272 | struct cg14_par *par = (struct cg14_par *) info->par; |
274 | 273 | ||
@@ -277,8 +276,7 @@ static int cg14_mmap(struct fb_info *info, struct file *file, struct vm_area_str | |||
277 | par->iospace, vma); | 276 | par->iospace, vma); |
278 | } | 277 | } |
279 | 278 | ||
280 | static int cg14_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 279 | static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
281 | unsigned long arg, struct fb_info *info) | ||
282 | { | 280 | { |
283 | struct cg14_par *par = (struct cg14_par *) info->par; | 281 | struct cg14_par *par = (struct cg14_par *) info->par; |
284 | struct cg14_regs __iomem *regs = par->regs; | 282 | struct cg14_regs __iomem *regs = par->regs; |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 9fcd89608ed7..3de6e1b5ab2f 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
@@ -33,9 +33,8 @@ static int cg3_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
33 | unsigned, struct fb_info *); | 33 | unsigned, struct fb_info *); |
34 | static int cg3_blank(int, struct fb_info *); | 34 | static int cg3_blank(int, struct fb_info *); |
35 | 35 | ||
36 | static int cg3_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 36 | static int cg3_mmap(struct fb_info *, struct vm_area_struct *); |
37 | static int cg3_ioctl(struct inode *, struct file *, unsigned int, | 37 | static int cg3_ioctl(struct fb_info *, unsigned int, unsigned long); |
38 | unsigned long, struct fb_info *); | ||
39 | 38 | ||
40 | /* | 39 | /* |
41 | * Frame buffer operations | 40 | * Frame buffer operations |
@@ -230,7 +229,7 @@ static struct sbus_mmap_map cg3_mmap_map[] = { | |||
230 | { .size = 0 } | 229 | { .size = 0 } |
231 | }; | 230 | }; |
232 | 231 | ||
233 | static int cg3_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 232 | static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) |
234 | { | 233 | { |
235 | struct cg3_par *par = (struct cg3_par *)info->par; | 234 | struct cg3_par *par = (struct cg3_par *)info->par; |
236 | 235 | ||
@@ -240,8 +239,7 @@ static int cg3_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
240 | vma); | 239 | vma); |
241 | } | 240 | } |
242 | 241 | ||
243 | static int cg3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 242 | static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
244 | unsigned long arg, struct fb_info *info) | ||
245 | { | 243 | { |
246 | struct cg3_par *par = (struct cg3_par *) info->par; | 244 | struct cg3_par *par = (struct cg3_par *) info->par; |
247 | 245 | ||
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 050835e39aa3..7aab91ead681 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -36,9 +36,8 @@ static int cg6_blank(int, struct fb_info *); | |||
36 | static void cg6_imageblit(struct fb_info *, const struct fb_image *); | 36 | static void cg6_imageblit(struct fb_info *, const struct fb_image *); |
37 | static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *); | 37 | static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *); |
38 | static int cg6_sync(struct fb_info *); | 38 | static int cg6_sync(struct fb_info *); |
39 | static int cg6_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 39 | static int cg6_mmap(struct fb_info *, struct vm_area_struct *); |
40 | static int cg6_ioctl(struct inode *, struct file *, unsigned int, | 40 | static int cg6_ioctl(struct fb_info *, unsigned int, unsigned long); |
41 | unsigned long, struct fb_info *); | ||
42 | 41 | ||
43 | /* | 42 | /* |
44 | * Frame buffer operations | 43 | * Frame buffer operations |
@@ -524,7 +523,7 @@ static struct sbus_mmap_map cg6_mmap_map[] = { | |||
524 | { .size = 0 } | 523 | { .size = 0 } |
525 | }; | 524 | }; |
526 | 525 | ||
527 | static int cg6_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 526 | static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) |
528 | { | 527 | { |
529 | struct cg6_par *par = (struct cg6_par *)info->par; | 528 | struct cg6_par *par = (struct cg6_par *)info->par; |
530 | 529 | ||
@@ -534,8 +533,7 @@ static int cg6_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
534 | vma); | 533 | vma); |
535 | } | 534 | } |
536 | 535 | ||
537 | static int cg6_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 536 | static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
538 | unsigned long arg, struct fb_info *info) | ||
539 | { | 537 | { |
540 | struct cg6_par *par = (struct cg6_par *) info->par; | 538 | struct cg6_par *par = (struct cg6_par *) info->par; |
541 | 539 | ||
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 03798e9c882d..655301a8671c 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -128,7 +128,7 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, | |||
128 | static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 128 | static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
129 | u_int transp, struct fb_info *info); | 129 | u_int transp, struct fb_info *info); |
130 | static int controlfb_blank(int blank_mode, struct fb_info *info); | 130 | static int controlfb_blank(int blank_mode, struct fb_info *info); |
131 | static int controlfb_mmap(struct fb_info *info, struct file *file, | 131 | static int controlfb_mmap(struct fb_info *info, |
132 | struct vm_area_struct *vma); | 132 | struct vm_area_struct *vma); |
133 | static int controlfb_set_par (struct fb_info *info); | 133 | static int controlfb_set_par (struct fb_info *info); |
134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); | 134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); |
@@ -280,7 +280,7 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, | |||
280 | * for controlfb. | 280 | * for controlfb. |
281 | * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. | 281 | * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. |
282 | */ | 282 | */ |
283 | static int controlfb_mmap(struct fb_info *info, struct file *file, | 283 | static int controlfb_mmap(struct fb_info *info, |
284 | struct vm_area_struct *vma) | 284 | struct vm_area_struct *vma) |
285 | { | 285 | { |
286 | unsigned long off, start; | 286 | unsigned long off, start; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 32a9b69becc5..d2dede6ed3e5 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -957,7 +957,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
957 | default: | 957 | default: |
958 | if (fb->fb_ioctl == NULL) | 958 | if (fb->fb_ioctl == NULL) |
959 | return -EINVAL; | 959 | return -EINVAL; |
960 | return fb->fb_ioctl(inode, file, cmd, arg, info); | 960 | return fb->fb_ioctl(info, cmd, arg); |
961 | } | 961 | } |
962 | } | 962 | } |
963 | 963 | ||
@@ -1107,7 +1107,7 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1107 | 1107 | ||
1108 | default: | 1108 | default: |
1109 | if (fb->fb_compat_ioctl) | 1109 | if (fb->fb_compat_ioctl) |
1110 | ret = fb->fb_compat_ioctl(file, cmd, arg, info); | 1110 | ret = fb->fb_compat_ioctl(info, cmd, arg); |
1111 | break; | 1111 | break; |
1112 | } | 1112 | } |
1113 | unlock_kernel(); | 1113 | unlock_kernel(); |
@@ -1135,7 +1135,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1135 | if (fb->fb_mmap) { | 1135 | if (fb->fb_mmap) { |
1136 | int res; | 1136 | int res; |
1137 | lock_kernel(); | 1137 | lock_kernel(); |
1138 | res = fb->fb_mmap(info, file, vma); | 1138 | res = fb->fb_mmap(info, vma); |
1139 | unlock_kernel(); | 1139 | unlock_kernel(); |
1140 | return res; | 1140 | return res; |
1141 | } | 1141 | } |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index c4870d559afc..9c9b21d469a1 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -37,9 +37,8 @@ static void ffb_imageblit(struct fb_info *, const struct fb_image *); | |||
37 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); | 37 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); |
38 | static void ffb_copyarea(struct fb_info *, const struct fb_copyarea *); | 38 | static void ffb_copyarea(struct fb_info *, const struct fb_copyarea *); |
39 | static int ffb_sync(struct fb_info *); | 39 | static int ffb_sync(struct fb_info *); |
40 | static int ffb_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 40 | static int ffb_mmap(struct fb_info *, struct vm_area_struct *); |
41 | static int ffb_ioctl(struct inode *, struct file *, unsigned int, | 41 | static int ffb_ioctl(struct fb_info *, unsigned int, unsigned long); |
42 | unsigned long, struct fb_info *); | ||
43 | static int ffb_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 42 | static int ffb_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
44 | 43 | ||
45 | /* | 44 | /* |
@@ -839,7 +838,7 @@ static struct sbus_mmap_map ffb_mmap_map[] = { | |||
839 | { .size = 0 } | 838 | { .size = 0 } |
840 | }; | 839 | }; |
841 | 840 | ||
842 | static int ffb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 841 | static int ffb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
843 | { | 842 | { |
844 | struct ffb_par *par = (struct ffb_par *)info->par; | 843 | struct ffb_par *par = (struct ffb_par *)info->par; |
845 | 844 | ||
@@ -848,8 +847,7 @@ static int ffb_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
848 | 0, vma); | 847 | 0, vma); |
849 | } | 848 | } |
850 | 849 | ||
851 | static int ffb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 850 | static int ffb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
852 | unsigned long arg, struct fb_info *info) | ||
853 | { | 851 | { |
854 | struct ffb_par *par = (struct ffb_par *) info->par; | 852 | struct ffb_par *par = (struct ffb_par *) info->par; |
855 | 853 | ||
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index d744c51807b7..38d22729b129 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -979,7 +979,7 @@ static int gbefb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
979 | return 0; | 979 | return 0; |
980 | } | 980 | } |
981 | 981 | ||
982 | static int gbefb_mmap(struct fb_info *info, struct file *file, | 982 | static int gbefb_mmap(struct fb_info *info, |
983 | struct vm_area_struct *vma) | 983 | struct vm_area_struct *vma) |
984 | { | 984 | { |
985 | unsigned long size = vma->vm_end - vma->vm_start; | 985 | unsigned long size = vma->vm_end - vma->vm_start; |
@@ -1000,7 +1000,6 @@ static int gbefb_mmap(struct fb_info *info, struct file *file, | |||
1000 | pgprot_fb(pgprot_val(vma->vm_page_prot)); | 1000 | pgprot_fb(pgprot_val(vma->vm_page_prot)); |
1001 | 1001 | ||
1002 | vma->vm_flags |= VM_IO | VM_RESERVED; | 1002 | vma->vm_flags |= VM_IO | VM_RESERVED; |
1003 | vma->vm_file = file; | ||
1004 | 1003 | ||
1005 | /* look for the starting tile */ | 1004 | /* look for the starting tile */ |
1006 | tile = &gbe_tiles.cpu[offset >> TILE_SHIFT]; | 1005 | tile = &gbe_tiles.cpu[offset >> TILE_SHIFT]; |
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c index 8e8da7433994..20e69156d728 100644 --- a/drivers/video/geode/gx1fb_core.c +++ b/drivers/video/geode/gx1fb_core.c | |||
@@ -215,11 +215,11 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d | |||
215 | if (ret < 0) | 215 | if (ret < 0) |
216 | return ret; | 216 | return ret; |
217 | 217 | ||
218 | ret = pci_request_region(dev, 1, "gx1fb (video)"); | 218 | ret = pci_request_region(dev, 0, "gx1fb (video)"); |
219 | if (ret < 0) | 219 | if (ret < 0) |
220 | return ret; | 220 | return ret; |
221 | par->vid_regs = ioremap(pci_resource_start(dev, 1), | 221 | par->vid_regs = ioremap(pci_resource_start(dev, 0), |
222 | pci_resource_len(dev, 1)); | 222 | pci_resource_len(dev, 0)); |
223 | if (!par->vid_regs) | 223 | if (!par->vid_regs) |
224 | return -ENOMEM; | 224 | return -ENOMEM; |
225 | 225 | ||
@@ -229,12 +229,9 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d | |||
229 | if (!par->dc_regs) | 229 | if (!par->dc_regs) |
230 | return -ENOMEM; | 230 | return -ENOMEM; |
231 | 231 | ||
232 | ret = pci_request_region(dev, 0, "gx1fb (frame buffer)"); | ||
233 | if (ret < 0 ) | ||
234 | return -EBUSY; | ||
235 | if ((fb_len = gx1_frame_buffer_size()) < 0) | 232 | if ((fb_len = gx1_frame_buffer_size()) < 0) |
236 | return -ENOMEM; | 233 | return -ENOMEM; |
237 | info->fix.smem_start = pci_resource_start(dev, 0); | 234 | info->fix.smem_start = gx_base + 0x800000; |
238 | info->fix.smem_len = fb_len; | 235 | info->fix.smem_len = fb_len; |
239 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); | 236 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); |
240 | if (!info->screen_base) | 237 | if (!info->screen_base) |
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c index e326f44f652d..6b88050d21bf 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/igafb.c | |||
@@ -219,7 +219,7 @@ static void iga_blank_border(struct iga_par *par) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | #ifdef __sparc__ | 221 | #ifdef __sparc__ |
222 | static int igafb_mmap(struct fb_info *info, struct file *file, | 222 | static int igafb_mmap(struct fb_info *info, |
223 | struct vm_area_struct *vma) | 223 | struct vm_area_struct *vma) |
224 | { | 224 | { |
225 | struct iga_par *par = (struct iga_par *)info->par; | 225 | struct iga_par *par = (struct iga_par *)info->par; |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index a5d813050db5..ad416ae47596 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -1267,8 +1267,7 @@ imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1267 | #define FBIMSTT_GETIDXREG 0x545406 | 1267 | #define FBIMSTT_GETIDXREG 0x545406 |
1268 | 1268 | ||
1269 | static int | 1269 | static int |
1270 | imsttfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 1270 | imsttfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
1271 | u_long arg, struct fb_info *info) | ||
1272 | { | 1271 | { |
1273 | struct imstt_par *par = info->par; | 1272 | struct imstt_par *par = info->par; |
1274 | void __user *argp = (void __user *)arg; | 1273 | void __user *argp = (void __user *)arg; |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 0090544842f5..6b8bd3cdf9c0 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -157,9 +157,8 @@ static int intelfb_cursor(struct fb_info *info, | |||
157 | 157 | ||
158 | static int intelfb_sync(struct fb_info *info); | 158 | static int intelfb_sync(struct fb_info *info); |
159 | 159 | ||
160 | static int intelfb_ioctl(struct inode *inode, struct file *file, | 160 | static int intelfb_ioctl(struct fb_info *info, |
161 | unsigned int cmd, unsigned long arg, | 161 | unsigned int cmd, unsigned long arg); |
162 | struct fb_info *info); | ||
163 | 162 | ||
164 | static int __devinit intelfb_pci_register(struct pci_dev *pdev, | 163 | static int __devinit intelfb_pci_register(struct pci_dev *pdev, |
165 | const struct pci_device_id *ent); | 164 | const struct pci_device_id *ent); |
@@ -1380,8 +1379,7 @@ intelfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1380 | 1379 | ||
1381 | /* When/if we have our own ioctls. */ | 1380 | /* When/if we have our own ioctls. */ |
1382 | static int | 1381 | static int |
1383 | intelfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 1382 | intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
1384 | unsigned long arg, struct fb_info *info) | ||
1385 | { | 1383 | { |
1386 | int retval = 0; | 1384 | int retval = 0; |
1387 | 1385 | ||
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index bcd359b6d4ff..477ad297de4e 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -586,9 +586,8 @@ static int __init kyrofb_setup(char *options) | |||
586 | } | 586 | } |
587 | #endif | 587 | #endif |
588 | 588 | ||
589 | static int kyrofb_ioctl(struct inode *inode, struct file *file, | 589 | static int kyrofb_ioctl(struct fb_info *info, |
590 | unsigned int cmd, unsigned long arg, | 590 | unsigned int cmd, unsigned long arg) |
591 | struct fb_info *info) | ||
592 | { | 591 | { |
593 | overlay_create ol_create; | 592 | overlay_create ol_create; |
594 | overlay_viewport_set ol_viewport_set; | 593 | overlay_viewport_set ol_viewport_set; |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 494287f8f8bf..a23cfdb9d826 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
@@ -32,9 +32,8 @@ static int leo_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
32 | unsigned, struct fb_info *); | 32 | unsigned, struct fb_info *); |
33 | static int leo_blank(int, struct fb_info *); | 33 | static int leo_blank(int, struct fb_info *); |
34 | 34 | ||
35 | static int leo_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 35 | static int leo_mmap(struct fb_info *, struct vm_area_struct *); |
36 | static int leo_ioctl(struct inode *, struct file *, unsigned int, | 36 | static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); |
37 | unsigned long, struct fb_info *); | ||
38 | static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 37 | static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
39 | 38 | ||
40 | /* | 39 | /* |
@@ -363,7 +362,7 @@ static struct sbus_mmap_map leo_mmap_map[] = { | |||
363 | { .size = 0 } | 362 | { .size = 0 } |
364 | }; | 363 | }; |
365 | 364 | ||
366 | static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 365 | static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma) |
367 | { | 366 | { |
368 | struct leo_par *par = (struct leo_par *)info->par; | 367 | struct leo_par *par = (struct leo_par *)info->par; |
369 | 368 | ||
@@ -373,8 +372,7 @@ static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
373 | vma); | 372 | vma); |
374 | } | 373 | } |
375 | 374 | ||
376 | static int leo_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 375 | static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
377 | unsigned long arg, struct fb_info *info) | ||
378 | { | 376 | { |
379 | struct leo_par *par = (struct leo_par *) info->par; | 377 | struct leo_par *par = (struct leo_par *) info->par; |
380 | 378 | ||
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 1e74f4cca53b..4055ff6f5a81 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -865,9 +865,8 @@ static struct matrox_altout panellink_output = { | |||
865 | .name = "Panellink output", | 865 | .name = "Panellink output", |
866 | }; | 866 | }; |
867 | 867 | ||
868 | static int matroxfb_ioctl(struct inode *inode, struct file *file, | 868 | static int matroxfb_ioctl(struct fb_info *info, |
869 | unsigned int cmd, unsigned long arg, | 869 | unsigned int cmd, unsigned long arg) |
870 | struct fb_info *info) | ||
871 | { | 870 | { |
872 | void __user *argp = (void __user *)arg; | 871 | void __user *argp = (void __user *)arg; |
873 | MINFO_FROM_INFO(info); | 872 | MINFO_FROM_INFO(info); |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index d52d7d825c41..27eb4bb4f89f 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -419,11 +419,10 @@ static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, stru | |||
419 | return 0; | 419 | return 0; |
420 | } | 420 | } |
421 | 421 | ||
422 | static int matroxfb_dh_ioctl(struct inode* inode, | 422 | static int matroxfb_dh_ioctl(struct fb_info *info, |
423 | struct file* file, | ||
424 | unsigned int cmd, | 423 | unsigned int cmd, |
425 | unsigned long arg, | 424 | unsigned long arg) |
426 | struct fb_info* info) { | 425 | { |
427 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) | 426 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) |
428 | MINFO_FROM(m2info->primary_dev); | 427 | MINFO_FROM(m2info->primary_dev); |
429 | 428 | ||
@@ -457,7 +456,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, | |||
457 | case MATROXFB_GET_OUTPUT_MODE: | 456 | case MATROXFB_GET_OUTPUT_MODE: |
458 | case MATROXFB_GET_ALL_OUTPUTS: | 457 | case MATROXFB_GET_ALL_OUTPUTS: |
459 | { | 458 | { |
460 | return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(inode, file, cmd, arg, &ACCESS_FBINFO(fbcon)); | 459 | return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(&ACCESS_FBINFO(fbcon), cmd, arg); |
461 | } | 460 | } |
462 | case MATROXFB_SET_OUTPUT_CONNECTION: | 461 | case MATROXFB_SET_OUTPUT_CONNECTION: |
463 | { | 462 | { |
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index a1f2c5e8fc88..6019710dc298 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c | |||
@@ -968,7 +968,7 @@ static inline int maven_compute_timming(struct maven_data* md, | |||
968 | return 0; | 968 | return 0; |
969 | } | 969 | } |
970 | 970 | ||
971 | static inline int maven_program_timming(struct maven_data* md, | 971 | static int maven_program_timming(struct maven_data* md, |
972 | const struct mavenregs* m) { | 972 | const struct mavenregs* m) { |
973 | struct i2c_client* c = md->client; | 973 | struct i2c_client* c = md->client; |
974 | 974 | ||
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index e18c9f98a401..747602aa5615 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -853,7 +853,7 @@ static int neofb_set_par(struct fb_info *info) | |||
853 | /* If the user did not specify any display devices, then... */ | 853 | /* If the user did not specify any display devices, then... */ |
854 | if (par->PanelDispCntlReg1 == 0x00) { | 854 | if (par->PanelDispCntlReg1 == 0x00) { |
855 | /* Default to internal (i.e., LCD) only. */ | 855 | /* Default to internal (i.e., LCD) only. */ |
856 | par->PanelDispCntlReg1 |= 0x02; | 856 | par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; |
857 | } | 857 | } |
858 | 858 | ||
859 | /* If we are using a fixed mode, then tell the chip we are. */ | 859 | /* If we are using a fixed mode, then tell the chip we are. */ |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index b251e754e16c..0d1957505359 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -31,9 +31,8 @@ static int p9100_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
31 | unsigned, struct fb_info *); | 31 | unsigned, struct fb_info *); |
32 | static int p9100_blank(int, struct fb_info *); | 32 | static int p9100_blank(int, struct fb_info *); |
33 | 33 | ||
34 | static int p9100_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 34 | static int p9100_mmap(struct fb_info *, struct vm_area_struct *); |
35 | static int p9100_ioctl(struct inode *, struct file *, unsigned int, | 35 | static int p9100_ioctl(struct fb_info *, unsigned int, unsigned long); |
36 | unsigned long, struct fb_info *); | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * Frame buffer operations | 38 | * Frame buffer operations |
@@ -222,7 +221,7 @@ static struct sbus_mmap_map p9100_mmap_map[] = { | |||
222 | { 0, 0, 0 } | 221 | { 0, 0, 0 } |
223 | }; | 222 | }; |
224 | 223 | ||
225 | static int p9100_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 224 | static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) |
226 | { | 225 | { |
227 | struct p9100_par *par = (struct p9100_par *)info->par; | 226 | struct p9100_par *par = (struct p9100_par *)info->par; |
228 | 227 | ||
@@ -232,8 +231,8 @@ static int p9100_mmap(struct fb_info *info, struct file *file, struct vm_area_st | |||
232 | vma); | 231 | vma); |
233 | } | 232 | } |
234 | 233 | ||
235 | static int p9100_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 234 | static int p9100_ioctl(struct fb_info *info, unsigned int cmd, |
236 | unsigned long arg, struct fb_info *info) | 235 | unsigned long arg) |
237 | { | 236 | { |
238 | struct p9100_par *par = (struct p9100_par *) info->par; | 237 | struct p9100_par *par = (struct p9100_par *) info->par; |
239 | 238 | ||
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 2e11b601c488..0e78ddc81583 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -657,9 +657,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp, | |||
657 | static void pm3fb_detect(void); | 657 | static void pm3fb_detect(void); |
658 | static int pm3fb_pan_display(const struct fb_var_screeninfo *var, | 658 | static int pm3fb_pan_display(const struct fb_var_screeninfo *var, |
659 | struct fb_info_gen *info); | 659 | struct fb_info_gen *info); |
660 | static int pm3fb_ioctl(struct inode *inode, struct file *file, | 660 | static int pm3fb_ioctl(struct fb_info *info, u_int cmd, u_long arg); |
661 | u_int cmd, u_long arg, int con, | ||
662 | struct fb_info *info); | ||
663 | 661 | ||
664 | 662 | ||
665 | /* the struct that hold them together */ | 663 | /* the struct that hold them together */ |
@@ -3438,9 +3436,7 @@ static int pm3fb_pan_display(const struct fb_var_screeninfo *var, | |||
3438 | return 0; | 3436 | return 0; |
3439 | } | 3437 | } |
3440 | 3438 | ||
3441 | static int pm3fb_ioctl(struct inode *inode, struct file *file, | 3439 | static int pm3fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
3442 | u_int cmd, u_long arg, int con, | ||
3443 | struct fb_info *info) | ||
3444 | { | 3440 | { |
3445 | struct pm3fb_info *l_fb_info = (struct pm3fb_info *) info; | 3441 | struct pm3fb_info *l_fb_info = (struct pm3fb_info *) info; |
3446 | u32 cm, i; | 3442 | u32 cm, i; |
diff --git a/drivers/video/pmag-aa-fb.c b/drivers/video/pmag-aa-fb.c index 28d1fe5fe340..d92f352211ef 100644 --- a/drivers/video/pmag-aa-fb.c +++ b/drivers/video/pmag-aa-fb.c | |||
@@ -299,8 +299,7 @@ static int aafb_set_cmap(struct fb_cmap *cmap, int kspc, int con, | |||
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | } | 300 | } |
301 | 301 | ||
302 | static int aafb_ioctl(struct inode *inode, struct file *file, u32 cmd, | 302 | static int aafb_ioctl(struct fb_info *info, u32 cmd, unsigned long arg) |
303 | unsigned long arg, int con, struct fb_info *info) | ||
304 | { | 303 | { |
305 | /* TODO: Not yet implemented */ | 304 | /* TODO: Not yet implemented */ |
306 | return -ENOIOCTLCMD; | 305 | return -ENOIOCTLCMD; |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 9fc10b9e6f57..53ad61f1038c 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -395,7 +395,7 @@ static int pxafb_blank(int blank, struct fb_info *info) | |||
395 | return 0; | 395 | return 0; |
396 | } | 396 | } |
397 | 397 | ||
398 | static int pxafb_mmap(struct fb_info *info, struct file *file, | 398 | static int pxafb_mmap(struct fb_info *info, |
399 | struct vm_area_struct *vma) | 399 | struct vm_area_struct *vma) |
400 | { | 400 | { |
401 | struct pxafb_info *fbi = (struct pxafb_info *)info; | 401 | struct pxafb_info *fbi = (struct pxafb_info *)info; |
diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c index 600318f708f2..db9fb9074dbc 100644 --- a/drivers/video/radeonfb.c +++ b/drivers/video/radeonfb.c | |||
@@ -1497,8 +1497,8 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, | |||
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | 1499 | ||
1500 | static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int cmd, | 1500 | static int radeonfb_ioctl (struct fb_info *info, unsigned int cmd, |
1501 | unsigned long arg, struct fb_info *info) | 1501 | unsigned long arg) |
1502 | { | 1502 | { |
1503 | struct radeonfb_info *rinfo = (struct radeonfb_info *) info; | 1503 | struct radeonfb_info *rinfo = (struct radeonfb_info *) info; |
1504 | unsigned int tmp; | 1504 | unsigned int tmp; |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index 087e58689e4c..8a893ce7040d 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -815,7 +815,7 @@ static int sa1100fb_blank(int blank, struct fb_info *info) | |||
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
817 | 817 | ||
818 | static int sa1100fb_mmap(struct fb_info *info, struct file *file, | 818 | static int sa1100fb_mmap(struct fb_info *info, |
819 | struct vm_area_struct *vma) | 819 | struct vm_area_struct *vma) |
820 | { | 820 | { |
821 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; | 821 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 7054660767e4..2e6df1fcb2b9 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -115,7 +115,7 @@ static int sgivwfb_set_par(struct fb_info *info); | |||
115 | static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, | 115 | static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, |
116 | u_int blue, u_int transp, | 116 | u_int blue, u_int transp, |
117 | struct fb_info *info); | 117 | struct fb_info *info); |
118 | static int sgivwfb_mmap(struct fb_info *info, struct file *file, | 118 | static int sgivwfb_mmap(struct fb_info *info, |
119 | struct vm_area_struct *vma); | 119 | struct vm_area_struct *vma); |
120 | 120 | ||
121 | static struct fb_ops sgivwfb_ops = { | 121 | static struct fb_ops sgivwfb_ops = { |
@@ -706,7 +706,7 @@ static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, | |||
706 | return 0; | 706 | return 0; |
707 | } | 707 | } |
708 | 708 | ||
709 | static int sgivwfb_mmap(struct fb_info *info, struct file *file, | 709 | static int sgivwfb_mmap(struct fb_info *info, |
710 | struct vm_area_struct *vma) | 710 | struct vm_area_struct *vma) |
711 | { | 711 | { |
712 | unsigned long size = vma->vm_end - vma->vm_start; | 712 | unsigned long size = vma->vm_end - vma->vm_start; |
@@ -723,7 +723,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file, | |||
723 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, | 723 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, |
724 | size, vma->vm_page_prot)) | 724 | size, vma->vm_page_prot)) |
725 | return -EAGAIN; | 725 | return -EAGAIN; |
726 | vma->vm_file = file; | ||
727 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", | 726 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", |
728 | offset, vma->vm_start); | 727 | offset, vma->vm_start); |
729 | return 0; | 728 | return 0; |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index dea1a46c67c4..8adf5bf91eee 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1743,13 +1743,14 @@ sisfb_blank(int blank, struct fb_info *info) | |||
1743 | 1743 | ||
1744 | /* ----------- FBDev related routines for all series ---------- */ | 1744 | /* ----------- FBDev related routines for all series ---------- */ |
1745 | 1745 | ||
1746 | static int | 1746 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
1747 | sisfb_ioctl(struct inode *inode, struct file *file, | 1747 | static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, |
1748 | unsigned int cmd, unsigned long arg, | 1748 | unsigned long arg) |
1749 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | 1749 | #else |
1750 | int con, | 1750 | static int sisfb_ioctl(struct inode *inode, struct file *file, |
1751 | unsigned int cmd, unsigned long arg, | ||
1752 | struct fb_info *info) | ||
1751 | #endif | 1753 | #endif |
1752 | struct fb_info *info) | ||
1753 | { | 1754 | { |
1754 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; | 1755 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; |
1755 | struct sis_memreq sismemreq; | 1756 | struct sis_memreq sismemreq; |
@@ -1924,19 +1925,6 @@ sisfb_ioctl(struct inode *inode, struct file *file, | |||
1924 | return 0; | 1925 | return 0; |
1925 | } | 1926 | } |
1926 | 1927 | ||
1927 | #ifdef SIS_NEW_CONFIG_COMPAT | ||
1928 | static long | ||
1929 | sisfb_compat_ioctl(struct file *f, unsigned int cmd, unsigned long arg, struct fb_info *info) | ||
1930 | { | ||
1931 | int ret; | ||
1932 | |||
1933 | lock_kernel(); | ||
1934 | ret = sisfb_ioctl(NULL, f, cmd, arg, info); | ||
1935 | unlock_kernel(); | ||
1936 | return ret; | ||
1937 | } | ||
1938 | #endif | ||
1939 | |||
1940 | static int | 1928 | static int |
1941 | sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) | 1929 | sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) |
1942 | { | 1930 | { |
@@ -2007,7 +1995,7 @@ static struct fb_ops sisfb_ops = { | |||
2007 | #endif | 1995 | #endif |
2008 | .fb_sync = fbcon_sis_sync, | 1996 | .fb_sync = fbcon_sis_sync, |
2009 | #ifdef SIS_NEW_CONFIG_COMPAT | 1997 | #ifdef SIS_NEW_CONFIG_COMPAT |
2010 | .fb_compat_ioctl= sisfb_compat_ioctl, | 1998 | .fb_compat_ioctl= sisfb_ioctl, |
2011 | #endif | 1999 | #endif |
2012 | .fb_ioctl = sisfb_ioctl | 2000 | .fb_ioctl = sisfb_ioctl |
2013 | }; | 2001 | }; |
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h index 445bcbba03ae..70b6df371b8e 100644 --- a/drivers/video/sis/sis_main.h +++ b/drivers/video/sis/sis_main.h | |||
@@ -727,9 +727,14 @@ static int sisfb_ioctl(struct inode *inode, struct file *file, | |||
727 | #endif | 727 | #endif |
728 | 728 | ||
729 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | 729 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) |
730 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) | ||
731 | static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, | ||
732 | unsigned long arg); | ||
733 | #else | ||
730 | static int sisfb_ioctl(struct inode *inode, struct file *file, | 734 | static int sisfb_ioctl(struct inode *inode, struct file *file, |
731 | unsigned int cmd, unsigned long arg, | 735 | unsigned int cmd, unsigned long arg, |
732 | struct fb_info *info); | 736 | struct fb_info *info); |
737 | #endif | ||
733 | static int sisfb_set_par(struct fb_info *info); | 738 | static int sisfb_set_par(struct fb_info *info); |
734 | static int sisfb_blank(int blank, | 739 | static int sisfb_blank(int blank, |
735 | struct fb_info *info); | 740 | struct fb_info *info); |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 8a5ce210bb27..99921df35474 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -771,8 +771,7 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
771 | return 0; | 771 | return 0; |
772 | } | 772 | } |
773 | 773 | ||
774 | static int sstfb_ioctl(struct inode *inode, struct file *file, | 774 | static int sstfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
775 | u_int cmd, u_long arg, struct fb_info *info ) | ||
776 | { | 775 | { |
777 | struct sstfb_par *par = info->par; | 776 | struct sstfb_par *par = info->par; |
778 | struct pci_dev *sst_dev = par->dev; | 777 | struct pci_dev *sst_dev = par->dev; |
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 2b27b4474001..95b918229d9b 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
@@ -33,9 +33,8 @@ static int tcx_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
33 | unsigned, struct fb_info *); | 33 | unsigned, struct fb_info *); |
34 | static int tcx_blank(int, struct fb_info *); | 34 | static int tcx_blank(int, struct fb_info *); |
35 | 35 | ||
36 | static int tcx_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 36 | static int tcx_mmap(struct fb_info *, struct vm_area_struct *); |
37 | static int tcx_ioctl(struct inode *, struct file *, unsigned int, | 37 | static int tcx_ioctl(struct fb_info *, unsigned int, unsigned long); |
38 | unsigned long, struct fb_info *); | ||
39 | static int tcx_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 38 | static int tcx_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
40 | 39 | ||
41 | /* | 40 | /* |
@@ -302,7 +301,7 @@ static struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = { | |||
302 | { .size = 0 } | 301 | { .size = 0 } |
303 | }; | 302 | }; |
304 | 303 | ||
305 | static int tcx_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 304 | static int tcx_mmap(struct fb_info *info, struct vm_area_struct *vma) |
306 | { | 305 | { |
307 | struct tcx_par *par = (struct tcx_par *)info->par; | 306 | struct tcx_par *par = (struct tcx_par *)info->par; |
308 | 307 | ||
@@ -312,8 +311,8 @@ static int tcx_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
312 | vma); | 311 | vma); |
313 | } | 312 | } |
314 | 313 | ||
315 | static int tcx_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 314 | static int tcx_ioctl(struct fb_info *info, unsigned int cmd, |
316 | unsigned long arg, struct fb_info *info) | 315 | unsigned long arg) |
317 | { | 316 | { |
318 | struct tcx_par *par = (struct tcx_par *) info->par; | 317 | struct tcx_par *par = (struct tcx_par *) info->par; |
319 | 318 | ||
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index ffa1ad474226..53208cb58396 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -81,7 +81,7 @@ static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
81 | u_int transp, struct fb_info *info); | 81 | u_int transp, struct fb_info *info); |
82 | static int vfb_pan_display(struct fb_var_screeninfo *var, | 82 | static int vfb_pan_display(struct fb_var_screeninfo *var, |
83 | struct fb_info *info); | 83 | struct fb_info *info); |
84 | static int vfb_mmap(struct fb_info *info, struct file *file, | 84 | static int vfb_mmap(struct fb_info *info, |
85 | struct vm_area_struct *vma); | 85 | struct vm_area_struct *vma); |
86 | 86 | ||
87 | static struct fb_ops vfb_ops = { | 87 | static struct fb_ops vfb_ops = { |
@@ -368,7 +368,7 @@ static int vfb_pan_display(struct fb_var_screeninfo *var, | |||
368 | * Most drivers don't need their own mmap function | 368 | * Most drivers don't need their own mmap function |
369 | */ | 369 | */ |
370 | 370 | ||
371 | static int vfb_mmap(struct fb_info *info, struct file *file, | 371 | static int vfb_mmap(struct fb_info *info, |
372 | struct vm_area_struct *vma) | 372 | struct vm_area_struct *vma) |
373 | { | 373 | { |
374 | return -EINVAL; | 374 | return -EINVAL; |
diff --git a/fs/9p/conv.c b/fs/9p/conv.c index 55ccfa10ee9e..32a9f99154e2 100644 --- a/fs/9p/conv.c +++ b/fs/9p/conv.c | |||
@@ -56,7 +56,7 @@ static inline int buf_check_overflow(struct cbuf *buf) | |||
56 | return buf->p > buf->ep; | 56 | return buf->p > buf->ep; |
57 | } | 57 | } |
58 | 58 | ||
59 | static inline int buf_check_size(struct cbuf *buf, int len) | 59 | static int buf_check_size(struct cbuf *buf, int len) |
60 | { | 60 | { |
61 | if (buf->p + len > buf->ep) { | 61 | if (buf->p + len > buf->ep) { |
62 | if (buf->p < buf->ep) { | 62 | if (buf->p < buf->ep) { |
@@ -72,7 +72,7 @@ static inline int buf_check_size(struct cbuf *buf, int len) | |||
72 | return 1; | 72 | return 1; |
73 | } | 73 | } |
74 | 74 | ||
75 | static inline void *buf_alloc(struct cbuf *buf, int len) | 75 | static void *buf_alloc(struct cbuf *buf, int len) |
76 | { | 76 | { |
77 | void *ret = NULL; | 77 | void *ret = NULL; |
78 | 78 | ||
@@ -84,7 +84,7 @@ static inline void *buf_alloc(struct cbuf *buf, int len) | |||
84 | return ret; | 84 | return ret; |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline void buf_put_int8(struct cbuf *buf, u8 val) | 87 | static void buf_put_int8(struct cbuf *buf, u8 val) |
88 | { | 88 | { |
89 | if (buf_check_size(buf, 1)) { | 89 | if (buf_check_size(buf, 1)) { |
90 | buf->p[0] = val; | 90 | buf->p[0] = val; |
@@ -92,7 +92,7 @@ static inline void buf_put_int8(struct cbuf *buf, u8 val) | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | static inline void buf_put_int16(struct cbuf *buf, u16 val) | 95 | static void buf_put_int16(struct cbuf *buf, u16 val) |
96 | { | 96 | { |
97 | if (buf_check_size(buf, 2)) { | 97 | if (buf_check_size(buf, 2)) { |
98 | *(__le16 *) buf->p = cpu_to_le16(val); | 98 | *(__le16 *) buf->p = cpu_to_le16(val); |
@@ -100,7 +100,7 @@ static inline void buf_put_int16(struct cbuf *buf, u16 val) | |||
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline void buf_put_int32(struct cbuf *buf, u32 val) | 103 | static void buf_put_int32(struct cbuf *buf, u32 val) |
104 | { | 104 | { |
105 | if (buf_check_size(buf, 4)) { | 105 | if (buf_check_size(buf, 4)) { |
106 | *(__le32 *)buf->p = cpu_to_le32(val); | 106 | *(__le32 *)buf->p = cpu_to_le32(val); |
@@ -108,7 +108,7 @@ static inline void buf_put_int32(struct cbuf *buf, u32 val) | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | static inline void buf_put_int64(struct cbuf *buf, u64 val) | 111 | static void buf_put_int64(struct cbuf *buf, u64 val) |
112 | { | 112 | { |
113 | if (buf_check_size(buf, 8)) { | 113 | if (buf_check_size(buf, 8)) { |
114 | *(__le64 *)buf->p = cpu_to_le64(val); | 114 | *(__le64 *)buf->p = cpu_to_le64(val); |
@@ -116,7 +116,7 @@ static inline void buf_put_int64(struct cbuf *buf, u64 val) | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen) | 119 | static void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen) |
120 | { | 120 | { |
121 | if (buf_check_size(buf, slen + 2)) { | 121 | if (buf_check_size(buf, slen + 2)) { |
122 | buf_put_int16(buf, slen); | 122 | buf_put_int16(buf, slen); |
@@ -130,7 +130,7 @@ static inline void buf_put_string(struct cbuf *buf, const char *s) | |||
130 | buf_put_stringn(buf, s, strlen(s)); | 130 | buf_put_stringn(buf, s, strlen(s)); |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline u8 buf_get_int8(struct cbuf *buf) | 133 | static u8 buf_get_int8(struct cbuf *buf) |
134 | { | 134 | { |
135 | u8 ret = 0; | 135 | u8 ret = 0; |
136 | 136 | ||
@@ -142,7 +142,7 @@ static inline u8 buf_get_int8(struct cbuf *buf) | |||
142 | return ret; | 142 | return ret; |
143 | } | 143 | } |
144 | 144 | ||
145 | static inline u16 buf_get_int16(struct cbuf *buf) | 145 | static u16 buf_get_int16(struct cbuf *buf) |
146 | { | 146 | { |
147 | u16 ret = 0; | 147 | u16 ret = 0; |
148 | 148 | ||
@@ -154,7 +154,7 @@ static inline u16 buf_get_int16(struct cbuf *buf) | |||
154 | return ret; | 154 | return ret; |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline u32 buf_get_int32(struct cbuf *buf) | 157 | static u32 buf_get_int32(struct cbuf *buf) |
158 | { | 158 | { |
159 | u32 ret = 0; | 159 | u32 ret = 0; |
160 | 160 | ||
@@ -166,7 +166,7 @@ static inline u32 buf_get_int32(struct cbuf *buf) | |||
166 | return ret; | 166 | return ret; |
167 | } | 167 | } |
168 | 168 | ||
169 | static inline u64 buf_get_int64(struct cbuf *buf) | 169 | static u64 buf_get_int64(struct cbuf *buf) |
170 | { | 170 | { |
171 | u64 ret = 0; | 171 | u64 ret = 0; |
172 | 172 | ||
@@ -178,7 +178,7 @@ static inline u64 buf_get_int64(struct cbuf *buf) | |||
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | 180 | ||
181 | static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr) | 181 | static void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr) |
182 | { | 182 | { |
183 | vstr->len = buf_get_int16(buf); | 183 | vstr->len = buf_get_int16(buf); |
184 | if (!buf_check_overflow(buf) && buf_check_size(buf, vstr->len)) { | 184 | if (!buf_check_overflow(buf) && buf_check_size(buf, vstr->len)) { |
@@ -190,7 +190,7 @@ static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr) | |||
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid) | 193 | static void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid) |
194 | { | 194 | { |
195 | qid->type = buf_get_int8(bufp); | 195 | qid->type = buf_get_int8(bufp); |
196 | qid->version = buf_get_int32(bufp); | 196 | qid->version = buf_get_int32(bufp); |
@@ -254,7 +254,7 @@ static int v9fs_size_wstat(struct v9fs_wstat *wstat, int extended) | |||
254 | * | 254 | * |
255 | */ | 255 | */ |
256 | 256 | ||
257 | static inline void | 257 | static void |
258 | buf_get_stat(struct cbuf *bufp, struct v9fs_stat *stat, int extended) | 258 | buf_get_stat(struct cbuf *bufp, struct v9fs_stat *stat, int extended) |
259 | { | 259 | { |
260 | stat->size = buf_get_int16(bufp); | 260 | stat->size = buf_get_int16(bufp); |
@@ -427,7 +427,7 @@ static inline void v9fs_put_int64(struct cbuf *bufp, u64 val, u64 * p) | |||
427 | buf_put_int64(bufp, val); | 427 | buf_put_int64(bufp, val); |
428 | } | 428 | } |
429 | 429 | ||
430 | static inline void | 430 | static void |
431 | v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str) | 431 | v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str) |
432 | { | 432 | { |
433 | if (data) { | 433 | if (data) { |
@@ -441,7 +441,7 @@ v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str) | |||
441 | buf_put_stringn(bufp, data, str->len); | 441 | buf_put_stringn(bufp, data, str->len); |
442 | } | 442 | } |
443 | 443 | ||
444 | static inline int | 444 | static int |
445 | v9fs_put_user_data(struct cbuf *bufp, const char __user * data, int count, | 445 | v9fs_put_user_data(struct cbuf *bufp, const char __user * data, int count, |
446 | unsigned char **pdata) | 446 | unsigned char **pdata) |
447 | { | 447 | { |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index e93a7ae467c9..62d8d4acb8bb 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -195,6 +195,8 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) | |||
195 | if (!empty) | 195 | if (!empty) |
196 | d_invalidate(dentry); | 196 | d_invalidate(dentry); |
197 | 197 | ||
198 | nd.dentry = dentry; | ||
199 | nd.mnt = mnt; | ||
198 | nd.flags = LOOKUP_DIRECTORY; | 200 | nd.flags = LOOKUP_DIRECTORY; |
199 | status = (dentry->d_op->d_revalidate)(dentry, &nd); | 201 | status = (dentry->d_op->d_revalidate)(dentry, &nd); |
200 | 202 | ||
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f979ebbce49c..1b117a441298 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1218,7 +1218,7 @@ static int writenote(struct memelfnote *men, struct file *file) | |||
1218 | if (!dump_seek(file, (off))) \ | 1218 | if (!dump_seek(file, (off))) \ |
1219 | goto end_coredump; | 1219 | goto end_coredump; |
1220 | 1220 | ||
1221 | static inline void fill_elf_header(struct elfhdr *elf, int segs) | 1221 | static void fill_elf_header(struct elfhdr *elf, int segs) |
1222 | { | 1222 | { |
1223 | memcpy(elf->e_ident, ELFMAG, SELFMAG); | 1223 | memcpy(elf->e_ident, ELFMAG, SELFMAG); |
1224 | elf->e_ident[EI_CLASS] = ELF_CLASS; | 1224 | elf->e_ident[EI_CLASS] = ELF_CLASS; |
@@ -1243,7 +1243,7 @@ static inline void fill_elf_header(struct elfhdr *elf, int segs) | |||
1243 | return; | 1243 | return; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset) | 1246 | static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset) |
1247 | { | 1247 | { |
1248 | phdr->p_type = PT_NOTE; | 1248 | phdr->p_type = PT_NOTE; |
1249 | phdr->p_offset = offset; | 1249 | phdr->p_offset = offset; |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 9ccc7d8275b8..6a7b730c206b 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -264,7 +264,7 @@ static int unquote(char *from) | |||
264 | return p - from; | 264 | return p - from; |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline char * check_special_flags (char * sfs, Node * e) | 267 | static char * check_special_flags (char * sfs, Node * e) |
268 | { | 268 | { |
269 | char * p = sfs; | 269 | char * p = sfs; |
270 | int cont = 1; | 270 | int cont = 1; |
@@ -123,7 +123,7 @@ static void bio_fs_destructor(struct bio *bio) | |||
123 | bio_free(bio, fs_bio_set); | 123 | bio_free(bio, fs_bio_set); |
124 | } | 124 | } |
125 | 125 | ||
126 | inline void bio_init(struct bio *bio) | 126 | void bio_init(struct bio *bio) |
127 | { | 127 | { |
128 | bio->bi_next = NULL; | 128 | bio->bi_next = NULL; |
129 | bio->bi_bdev = NULL; | 129 | bio->bi_bdev = NULL; |
@@ -253,7 +253,7 @@ inline int bio_hw_segments(request_queue_t *q, struct bio *bio) | |||
253 | * the actual data it points to. Reference count of returned | 253 | * the actual data it points to. Reference count of returned |
254 | * bio will be one. | 254 | * bio will be one. |
255 | */ | 255 | */ |
256 | inline void __bio_clone(struct bio *bio, struct bio *bio_src) | 256 | void __bio_clone(struct bio *bio, struct bio *bio_src) |
257 | { | 257 | { |
258 | request_queue_t *q = bdev_get_queue(bio_src->bi_bdev); | 258 | request_queue_t *q = bdev_get_queue(bio_src->bi_bdev); |
259 | 259 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index b9bb7ad6897b..7cdf48a9a501 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1165,7 +1165,7 @@ failed: | |||
1165 | * some of those buffers may be aliases of filesystem data. | 1165 | * some of those buffers may be aliases of filesystem data. |
1166 | * grow_dev_page() will go BUG() if this happens. | 1166 | * grow_dev_page() will go BUG() if this happens. |
1167 | */ | 1167 | */ |
1168 | static inline int | 1168 | static int |
1169 | grow_buffers(struct block_device *bdev, sector_t block, int size) | 1169 | grow_buffers(struct block_device *bdev, sector_t block, int size) |
1170 | { | 1170 | { |
1171 | struct page *page; | 1171 | struct page *page; |
@@ -1391,7 +1391,7 @@ static void bh_lru_install(struct buffer_head *bh) | |||
1391 | /* | 1391 | /* |
1392 | * Look up the bh in this cpu's LRU. If it's there, move it to the head. | 1392 | * Look up the bh in this cpu's LRU. If it's there, move it to the head. |
1393 | */ | 1393 | */ |
1394 | static inline struct buffer_head * | 1394 | static struct buffer_head * |
1395 | lookup_bh_lru(struct block_device *bdev, sector_t block, int size) | 1395 | lookup_bh_lru(struct block_device *bdev, sector_t block, int size) |
1396 | { | 1396 | { |
1397 | struct buffer_head *ret = NULL; | 1397 | struct buffer_head *ret = NULL; |
@@ -1541,7 +1541,7 @@ EXPORT_SYMBOL(set_bh_page); | |||
1541 | /* | 1541 | /* |
1542 | * Called when truncating a buffer on a page completely. | 1542 | * Called when truncating a buffer on a page completely. |
1543 | */ | 1543 | */ |
1544 | static inline void discard_buffer(struct buffer_head * bh) | 1544 | static void discard_buffer(struct buffer_head * bh) |
1545 | { | 1545 | { |
1546 | lock_buffer(bh); | 1546 | lock_buffer(bh); |
1547 | clear_buffer_dirty(bh); | 1547 | clear_buffer_dirty(bh); |
diff --git a/fs/char_dev.c b/fs/char_dev.c index 3b1b1eefdbb0..21195c481637 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -35,7 +35,7 @@ static struct char_device_struct { | |||
35 | unsigned int major; | 35 | unsigned int major; |
36 | unsigned int baseminor; | 36 | unsigned int baseminor; |
37 | int minorct; | 37 | int minorct; |
38 | const char *name; | 38 | char name[64]; |
39 | struct file_operations *fops; | 39 | struct file_operations *fops; |
40 | struct cdev *cdev; /* will die */ | 40 | struct cdev *cdev; /* will die */ |
41 | } *chrdevs[MAX_PROBE_HASH]; | 41 | } *chrdevs[MAX_PROBE_HASH]; |
@@ -46,34 +46,84 @@ static inline int major_to_index(int major) | |||
46 | return major % MAX_PROBE_HASH; | 46 | return major % MAX_PROBE_HASH; |
47 | } | 47 | } |
48 | 48 | ||
49 | /* get char device names in somewhat random order */ | 49 | struct chrdev_info { |
50 | int get_chrdev_list(char *page) | 50 | int index; |
51 | { | ||
52 | struct char_device_struct *cd; | 51 | struct char_device_struct *cd; |
53 | int i, len; | 52 | }; |
54 | 53 | ||
55 | len = sprintf(page, "Character devices:\n"); | 54 | void *get_next_chrdev(void *dev) |
55 | { | ||
56 | struct chrdev_info *info; | ||
56 | 57 | ||
58 | if (dev == NULL) { | ||
59 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
60 | if (!info) | ||
61 | goto out; | ||
62 | info->index=0; | ||
63 | info->cd = chrdevs[info->index]; | ||
64 | if (info->cd) | ||
65 | goto out; | ||
66 | } else { | ||
67 | info = dev; | ||
68 | } | ||
69 | |||
70 | while (info->index < ARRAY_SIZE(chrdevs)) { | ||
71 | if (info->cd) | ||
72 | info->cd = info->cd->next; | ||
73 | if (info->cd) | ||
74 | goto out; | ||
75 | /* | ||
76 | * No devices on this chain, move to the next | ||
77 | */ | ||
78 | info->index++; | ||
79 | info->cd = (info->index < ARRAY_SIZE(chrdevs)) ? | ||
80 | chrdevs[info->index] : NULL; | ||
81 | if (info->cd) | ||
82 | goto out; | ||
83 | } | ||
84 | |||
85 | out: | ||
86 | return info; | ||
87 | } | ||
88 | |||
89 | void *acquire_chrdev_list(void) | ||
90 | { | ||
57 | down(&chrdevs_lock); | 91 | down(&chrdevs_lock); |
92 | return get_next_chrdev(NULL); | ||
93 | } | ||
94 | |||
95 | void release_chrdev_list(void *dev) | ||
96 | { | ||
97 | up(&chrdevs_lock); | ||
98 | kfree(dev); | ||
99 | } | ||
100 | |||
101 | |||
102 | int count_chrdev_list(void) | ||
103 | { | ||
104 | struct char_device_struct *cd; | ||
105 | int i, count; | ||
106 | |||
107 | count = 0; | ||
108 | |||
58 | for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { | 109 | for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { |
59 | for (cd = chrdevs[i]; cd; cd = cd->next) { | 110 | for (cd = chrdevs[i]; cd; cd = cd->next) |
60 | /* | 111 | count++; |
61 | * if the current name, plus the 5 extra characters | ||
62 | * in the device line for this entry | ||
63 | * would run us off the page, we're done | ||
64 | */ | ||
65 | if ((len+strlen(cd->name) + 5) >= PAGE_SIZE) | ||
66 | goto page_full; | ||
67 | |||
68 | |||
69 | len += sprintf(page+len, "%3d %s\n", | ||
70 | cd->major, cd->name); | ||
71 | } | ||
72 | } | 112 | } |
73 | page_full: | ||
74 | up(&chrdevs_lock); | ||
75 | 113 | ||
76 | return len; | 114 | return count; |
115 | } | ||
116 | |||
117 | int get_chrdev_info(void *dev, int *major, char **name) | ||
118 | { | ||
119 | struct chrdev_info *info = dev; | ||
120 | |||
121 | if (info->cd == NULL) | ||
122 | return 1; | ||
123 | |||
124 | *major = info->cd->major; | ||
125 | *name = info->cd->name; | ||
126 | return 0; | ||
77 | } | 127 | } |
78 | 128 | ||
79 | /* | 129 | /* |
@@ -121,7 +171,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, | |||
121 | cd->major = major; | 171 | cd->major = major; |
122 | cd->baseminor = baseminor; | 172 | cd->baseminor = baseminor; |
123 | cd->minorct = minorct; | 173 | cd->minorct = minorct; |
124 | cd->name = name; | 174 | strncpy(cd->name,name, 64); |
125 | 175 | ||
126 | i = major_to_index(major); | 176 | i = major_to_index(major); |
127 | 177 | ||
diff --git a/fs/compat.c b/fs/compat.c index 271b75d1597f..2468ac1df2f0 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1537,7 +1537,7 @@ out_ret: | |||
1537 | * Ooo, nasty. We need here to frob 32-bit unsigned longs to | 1537 | * Ooo, nasty. We need here to frob 32-bit unsigned longs to |
1538 | * 64-bit unsigned longs. | 1538 | * 64-bit unsigned longs. |
1539 | */ | 1539 | */ |
1540 | static inline | 1540 | static |
1541 | int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, | 1541 | int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, |
1542 | unsigned long *fdset) | 1542 | unsigned long *fdset) |
1543 | { | 1543 | { |
@@ -1570,7 +1570,7 @@ int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, | |||
1570 | return 0; | 1570 | return 0; |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | static inline | 1573 | static |
1574 | void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, | 1574 | void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, |
1575 | unsigned long *fdset) | 1575 | unsigned long *fdset) |
1576 | { | 1576 | { |
diff --git a/fs/dcache.c b/fs/dcache.c index 134d6775183f..86bdb93789c6 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -94,7 +94,7 @@ static void d_free(struct dentry *dentry) | |||
94 | * d_iput() operation if defined. | 94 | * d_iput() operation if defined. |
95 | * Called with dcache_lock and per dentry lock held, drops both. | 95 | * Called with dcache_lock and per dentry lock held, drops both. |
96 | */ | 96 | */ |
97 | static inline void dentry_iput(struct dentry * dentry) | 97 | static void dentry_iput(struct dentry * dentry) |
98 | { | 98 | { |
99 | struct inode *inode = dentry->d_inode; | 99 | struct inode *inode = dentry->d_inode; |
100 | if (inode) { | 100 | if (inode) { |
@@ -575,7 +575,7 @@ static int exec_mmap(struct mm_struct *mm) | |||
575 | * disturbing other processes. (Other processes might share the signal | 575 | * disturbing other processes. (Other processes might share the signal |
576 | * table via the CLONE_SIGHAND option to clone().) | 576 | * table via the CLONE_SIGHAND option to clone().) |
577 | */ | 577 | */ |
578 | static inline int de_thread(struct task_struct *tsk) | 578 | static int de_thread(struct task_struct *tsk) |
579 | { | 579 | { |
580 | struct signal_struct *sig = tsk->signal; | 580 | struct signal_struct *sig = tsk->signal; |
581 | struct sighand_struct *newsighand, *oldsighand = tsk->sighand; | 581 | struct sighand_struct *newsighand, *oldsighand = tsk->sighand; |
@@ -780,7 +780,7 @@ no_thread_group: | |||
780 | * so that a new one can be started | 780 | * so that a new one can be started |
781 | */ | 781 | */ |
782 | 782 | ||
783 | static inline void flush_old_files(struct files_struct * files) | 783 | static void flush_old_files(struct files_struct * files) |
784 | { | 784 | { |
785 | long j = -1; | 785 | long j = -1; |
786 | struct fdtable *fdt; | 786 | struct fdtable *fdt; |
@@ -964,7 +964,7 @@ int prepare_binprm(struct linux_binprm *bprm) | |||
964 | 964 | ||
965 | EXPORT_SYMBOL(prepare_binprm); | 965 | EXPORT_SYMBOL(prepare_binprm); |
966 | 966 | ||
967 | static inline int unsafe_exec(struct task_struct *p) | 967 | static int unsafe_exec(struct task_struct *p) |
968 | { | 968 | { |
969 | int unsafe = 0; | 969 | int unsafe = 0; |
970 | if (p->ptrace & PT_PTRACED) { | 970 | if (p->ptrace & PT_PTRACED) { |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index c5513953c825..ad1432a2a62e 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -83,10 +83,7 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str | |||
83 | if (!inode) | 83 | if (!inode) |
84 | return ERR_PTR(-EACCES); | 84 | return ERR_PTR(-EACCES); |
85 | } | 85 | } |
86 | if (inode) | 86 | return d_splice_alias(inode, dentry); |
87 | return d_splice_alias(inode, dentry); | ||
88 | d_add(dentry, inode); | ||
89 | return NULL; | ||
90 | } | 87 | } |
91 | 88 | ||
92 | struct dentry *ext2_get_parent(struct dentry *child) | 89 | struct dentry *ext2_get_parent(struct dentry *child) |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index af193a304ee5..8bd8ac077704 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1005,10 +1005,7 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str | |||
1005 | if (!inode) | 1005 | if (!inode) |
1006 | return ERR_PTR(-EACCES); | 1006 | return ERR_PTR(-EACCES); |
1007 | } | 1007 | } |
1008 | if (inode) | 1008 | return d_splice_alias(inode, dentry); |
1009 | return d_splice_alias(inode, dentry); | ||
1010 | d_add(dentry, inode); | ||
1011 | return NULL; | ||
1012 | } | 1009 | } |
1013 | 1010 | ||
1014 | 1011 | ||
diff --git a/fs/fcntl.c b/fs/fcntl.c index d0767fe58362..5f96786d1c73 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -36,7 +36,7 @@ void fastcall set_close_on_exec(unsigned int fd, int flag) | |||
36 | spin_unlock(&files->file_lock); | 36 | spin_unlock(&files->file_lock); |
37 | } | 37 | } |
38 | 38 | ||
39 | static inline int get_close_on_exec(unsigned int fd) | 39 | static int get_close_on_exec(unsigned int fd) |
40 | { | 40 | { |
41 | struct files_struct *files = current->files; | 41 | struct files_struct *files = current->files; |
42 | struct fdtable *fdt; | 42 | struct fdtable *fdt; |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ab4c3a9d51b8..f568102da1e8 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -402,7 +402,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
402 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; | 402 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; |
403 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 403 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
404 | info = HUGETLBFS_I(inode); | 404 | info = HUGETLBFS_I(inode); |
405 | mpol_shared_policy_init(&info->policy); | 405 | mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL); |
406 | switch (mode & S_IFMT) { | 406 | switch (mode & S_IFMT) { |
407 | default: | 407 | default: |
408 | init_special_inode(inode, mode, dev); | 408 | init_special_inode(inode, mode, dev); |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index e37e82b7cbf0..e7ba0c30e071 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -185,8 +185,5 @@ struct dentry *isofs_lookup(struct inode * dir, struct dentry * dentry, struct n | |||
185 | } | 185 | } |
186 | } | 186 | } |
187 | unlock_kernel(); | 187 | unlock_kernel(); |
188 | if (inode) | 188 | return d_splice_alias(inode, dentry); |
189 | return d_splice_alias(inode, dentry); | ||
190 | d_add(dentry, inode); | ||
191 | return NULL; | ||
192 | } | 189 | } |
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index fff108bb118b..70f7a896c04a 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
@@ -47,7 +47,7 @@ next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) | |||
47 | ic = next_inode(&i, ic, (c))) | 47 | ic = next_inode(&i, ic, (c))) |
48 | 48 | ||
49 | 49 | ||
50 | static inline void jffs2_build_inode_pass1(struct jffs2_sb_info *c, | 50 | static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, |
51 | struct jffs2_inode_cache *ic) | 51 | struct jffs2_inode_cache *ic) |
52 | { | 52 | { |
53 | struct jffs2_full_dirent *fd; | 53 | struct jffs2_full_dirent *fd; |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index c79eebb8ab32..b635e167a3fa 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -134,7 +134,7 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_ | |||
134 | /* | 134 | /* |
135 | * Allocate and initializes a new fragment. | 135 | * Allocate and initializes a new fragment. |
136 | */ | 136 | */ |
137 | static inline struct jffs2_node_frag * new_fragment(struct jffs2_full_dnode *fn, uint32_t ofs, uint32_t size) | 137 | static struct jffs2_node_frag * new_fragment(struct jffs2_full_dnode *fn, uint32_t ofs, uint32_t size) |
138 | { | 138 | { |
139 | struct jffs2_node_frag *newfrag; | 139 | struct jffs2_node_frag *newfrag; |
140 | 140 | ||
@@ -513,7 +513,7 @@ free_out: | |||
513 | * | 513 | * |
514 | * Checks the node if we are in the checking stage. | 514 | * Checks the node if we are in the checking stage. |
515 | */ | 515 | */ |
516 | static inline int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn) | 516 | static int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn) |
517 | { | 517 | { |
518 | int ret; | 518 | int ret; |
519 | 519 | ||
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index f01e9c0d2677..200fbda2c6d1 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -44,7 +44,7 @@ loff_t_to_s32(loff_t offset) | |||
44 | /* | 44 | /* |
45 | * XDR functions for basic NLM types | 45 | * XDR functions for basic NLM types |
46 | */ | 46 | */ |
47 | static inline u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) | 47 | static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) |
48 | { | 48 | { |
49 | unsigned int len; | 49 | unsigned int len; |
50 | 50 | ||
@@ -79,7 +79,7 @@ nlm_encode_cookie(u32 *p, struct nlm_cookie *c) | |||
79 | return p; | 79 | return p; |
80 | } | 80 | } |
81 | 81 | ||
82 | static inline u32 * | 82 | static u32 * |
83 | nlm_decode_fh(u32 *p, struct nfs_fh *f) | 83 | nlm_decode_fh(u32 *p, struct nfs_fh *f) |
84 | { | 84 | { |
85 | unsigned int len; | 85 | unsigned int len; |
@@ -119,7 +119,7 @@ nlm_encode_oh(u32 *p, struct xdr_netobj *oh) | |||
119 | return xdr_encode_netobj(p, oh); | 119 | return xdr_encode_netobj(p, oh); |
120 | } | 120 | } |
121 | 121 | ||
122 | static inline u32 * | 122 | static u32 * |
123 | nlm_decode_lock(u32 *p, struct nlm_lock *lock) | 123 | nlm_decode_lock(u32 *p, struct nlm_lock *lock) |
124 | { | 124 | { |
125 | struct file_lock *fl = &lock->fl; | 125 | struct file_lock *fl = &lock->fl; |
diff --git a/fs/mbcache.c b/fs/mbcache.c index 0f1e4530670f..f5bbe4c97c58 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c | |||
@@ -126,7 +126,7 @@ __mb_cache_entry_is_hashed(struct mb_cache_entry *ce) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | 128 | ||
129 | static inline void | 129 | static void |
130 | __mb_cache_entry_unhash(struct mb_cache_entry *ce) | 130 | __mb_cache_entry_unhash(struct mb_cache_entry *ce) |
131 | { | 131 | { |
132 | int n; | 132 | int n; |
@@ -139,7 +139,7 @@ __mb_cache_entry_unhash(struct mb_cache_entry *ce) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | static inline void | 142 | static void |
143 | __mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask) | 143 | __mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask) |
144 | { | 144 | { |
145 | struct mb_cache *cache = ce->e_cache; | 145 | struct mb_cache *cache = ce->e_cache; |
@@ -158,7 +158,7 @@ __mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask) | |||
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | static inline void | 161 | static void |
162 | __mb_cache_entry_release_unlock(struct mb_cache_entry *ce) | 162 | __mb_cache_entry_release_unlock(struct mb_cache_entry *ce) |
163 | { | 163 | { |
164 | /* Wake up all processes queuing for this cache entry. */ | 164 | /* Wake up all processes queuing for this cache entry. */ |
diff --git a/fs/namei.c b/fs/namei.c index 1e5746eb1380..33fb5bd34a81 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -113,7 +113,7 @@ | |||
113 | * POSIX.1 2.4: an empty pathname is invalid (ENOENT). | 113 | * POSIX.1 2.4: an empty pathname is invalid (ENOENT). |
114 | * PATH_MAX includes the nul terminator --RR. | 114 | * PATH_MAX includes the nul terminator --RR. |
115 | */ | 115 | */ |
116 | static inline int do_getname(const char __user *filename, char *page) | 116 | static int do_getname(const char __user *filename, char *page) |
117 | { | 117 | { |
118 | int retval; | 118 | int retval; |
119 | unsigned long len = PATH_MAX; | 119 | unsigned long len = PATH_MAX; |
@@ -396,7 +396,7 @@ static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, | |||
396 | * short-cut DAC fails, then call permission() to do more | 396 | * short-cut DAC fails, then call permission() to do more |
397 | * complete permission check. | 397 | * complete permission check. |
398 | */ | 398 | */ |
399 | static inline int exec_permission_lite(struct inode *inode, | 399 | static int exec_permission_lite(struct inode *inode, |
400 | struct nameidata *nd) | 400 | struct nameidata *nd) |
401 | { | 401 | { |
402 | umode_t mode = inode->i_mode; | 402 | umode_t mode = inode->i_mode; |
@@ -486,7 +486,7 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, s | |||
486 | static int __emul_lookup_dentry(const char *, struct nameidata *); | 486 | static int __emul_lookup_dentry(const char *, struct nameidata *); |
487 | 487 | ||
488 | /* SMP-safe */ | 488 | /* SMP-safe */ |
489 | static inline int | 489 | static __always_inline int |
490 | walk_init_root(const char *name, struct nameidata *nd) | 490 | walk_init_root(const char *name, struct nameidata *nd) |
491 | { | 491 | { |
492 | read_lock(¤t->fs->lock); | 492 | read_lock(¤t->fs->lock); |
@@ -504,7 +504,7 @@ walk_init_root(const char *name, struct nameidata *nd) | |||
504 | return 1; | 504 | return 1; |
505 | } | 505 | } |
506 | 506 | ||
507 | static inline int __vfs_follow_link(struct nameidata *nd, const char *link) | 507 | static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link) |
508 | { | 508 | { |
509 | int res = 0; | 509 | int res = 0; |
510 | char *name; | 510 | char *name; |
@@ -544,7 +544,7 @@ struct path { | |||
544 | struct dentry *dentry; | 544 | struct dentry *dentry; |
545 | }; | 545 | }; |
546 | 546 | ||
547 | static inline int __do_follow_link(struct path *path, struct nameidata *nd) | 547 | static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) |
548 | { | 548 | { |
549 | int error; | 549 | int error; |
550 | void *cookie; | 550 | void *cookie; |
@@ -690,7 +690,7 @@ int follow_down(struct vfsmount **mnt, struct dentry **dentry) | |||
690 | return 0; | 690 | return 0; |
691 | } | 691 | } |
692 | 692 | ||
693 | static inline void follow_dotdot(struct nameidata *nd) | 693 | static __always_inline void follow_dotdot(struct nameidata *nd) |
694 | { | 694 | { |
695 | while(1) { | 695 | while(1) { |
696 | struct vfsmount *parent; | 696 | struct vfsmount *parent; |
@@ -1294,7 +1294,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode) | |||
1294 | * 10. We don't allow removal of NFS sillyrenamed files; it's handled by | 1294 | * 10. We don't allow removal of NFS sillyrenamed files; it's handled by |
1295 | * nfs_async_unlink(). | 1295 | * nfs_async_unlink(). |
1296 | */ | 1296 | */ |
1297 | static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir) | 1297 | static int may_delete(struct inode *dir,struct dentry *victim,int isdir) |
1298 | { | 1298 | { |
1299 | int error; | 1299 | int error; |
1300 | 1300 | ||
@@ -2315,7 +2315,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2315 | return error; | 2315 | return error; |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | static inline int do_rename(const char * oldname, const char * newname) | 2318 | static int do_rename(const char * oldname, const char * newname) |
2319 | { | 2319 | { |
2320 | int error = 0; | 2320 | int error = 0; |
2321 | struct dentry * old_dir, * new_dir; | 2321 | struct dentry * old_dir, * new_dir; |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 8c8839203cd5..d277a58bd128 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -716,10 +716,8 @@ static void ncp_put_super(struct super_block *sb) | |||
716 | fput(server->ncp_filp); | 716 | fput(server->ncp_filp); |
717 | kill_proc(server->m.wdog_pid, SIGTERM, 1); | 717 | kill_proc(server->m.wdog_pid, SIGTERM, 1); |
718 | 718 | ||
719 | if (server->priv.data) | 719 | kfree(server->priv.data); |
720 | ncp_kfree_s(server->priv.data, server->priv.len); | 720 | kfree(server->auth.object_name); |
721 | if (server->auth.object_name) | ||
722 | ncp_kfree_s(server->auth.object_name, server->auth.object_name_len); | ||
723 | vfree(server->packet); | 721 | vfree(server->packet); |
724 | sb->s_fs_info = NULL; | 722 | sb->s_fs_info = NULL; |
725 | kfree(server); | 723 | kfree(server); |
@@ -958,11 +956,6 @@ out: | |||
958 | return result; | 956 | return result; |
959 | } | 957 | } |
960 | 958 | ||
961 | #ifdef DEBUG_NCP_MALLOC | ||
962 | int ncp_malloced; | ||
963 | int ncp_current_malloced; | ||
964 | #endif | ||
965 | |||
966 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, | 959 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, |
967 | int flags, const char *dev_name, void *data) | 960 | int flags, const char *dev_name, void *data) |
968 | { | 961 | { |
@@ -981,10 +974,6 @@ static int __init init_ncp_fs(void) | |||
981 | int err; | 974 | int err; |
982 | DPRINTK("ncpfs: init_module called\n"); | 975 | DPRINTK("ncpfs: init_module called\n"); |
983 | 976 | ||
984 | #ifdef DEBUG_NCP_MALLOC | ||
985 | ncp_malloced = 0; | ||
986 | ncp_current_malloced = 0; | ||
987 | #endif | ||
988 | err = init_inodecache(); | 977 | err = init_inodecache(); |
989 | if (err) | 978 | if (err) |
990 | goto out1; | 979 | goto out1; |
@@ -1003,10 +992,6 @@ static void __exit exit_ncp_fs(void) | |||
1003 | DPRINTK("ncpfs: cleanup_module called\n"); | 992 | DPRINTK("ncpfs: cleanup_module called\n"); |
1004 | unregister_filesystem(&ncp_fs_type); | 993 | unregister_filesystem(&ncp_fs_type); |
1005 | destroy_inodecache(); | 994 | destroy_inodecache(); |
1006 | #ifdef DEBUG_NCP_MALLOC | ||
1007 | PRINTK("ncp_malloced: %d\n", ncp_malloced); | ||
1008 | PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced); | ||
1009 | #endif | ||
1010 | } | 995 | } |
1011 | 996 | ||
1012 | module_init(init_ncp_fs) | 997 | module_init(init_ncp_fs) |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index d6e0c089e1b1..eb3813ad136f 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -518,10 +518,11 @@ outrel: | |||
518 | if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) | 518 | if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) |
519 | return -ENOMEM; | 519 | return -ENOMEM; |
520 | if (user.object_name_len) { | 520 | if (user.object_name_len) { |
521 | newname = ncp_kmalloc(user.object_name_len, GFP_USER); | 521 | newname = kmalloc(user.object_name_len, GFP_USER); |
522 | if (!newname) return -ENOMEM; | 522 | if (!newname) |
523 | return -ENOMEM; | ||
523 | if (copy_from_user(newname, user.object_name, user.object_name_len)) { | 524 | if (copy_from_user(newname, user.object_name, user.object_name_len)) { |
524 | ncp_kfree_s(newname, user.object_name_len); | 525 | kfree(newname); |
525 | return -EFAULT; | 526 | return -EFAULT; |
526 | } | 527 | } |
527 | } else { | 528 | } else { |
@@ -540,8 +541,8 @@ outrel: | |||
540 | server->priv.len = 0; | 541 | server->priv.len = 0; |
541 | server->priv.data = NULL; | 542 | server->priv.data = NULL; |
542 | /* leave critical section */ | 543 | /* leave critical section */ |
543 | if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); | 544 | kfree(oldprivate); |
544 | if (oldname) ncp_kfree_s(oldname, oldnamelen); | 545 | kfree(oldname); |
545 | return 0; | 546 | return 0; |
546 | } | 547 | } |
547 | case NCP_IOC_GETPRIVATEDATA: | 548 | case NCP_IOC_GETPRIVATEDATA: |
@@ -581,10 +582,11 @@ outrel: | |||
581 | if (user.len > NCP_PRIVATE_DATA_MAX_LEN) | 582 | if (user.len > NCP_PRIVATE_DATA_MAX_LEN) |
582 | return -ENOMEM; | 583 | return -ENOMEM; |
583 | if (user.len) { | 584 | if (user.len) { |
584 | new = ncp_kmalloc(user.len, GFP_USER); | 585 | new = kmalloc(user.len, GFP_USER); |
585 | if (!new) return -ENOMEM; | 586 | if (!new) |
587 | return -ENOMEM; | ||
586 | if (copy_from_user(new, user.data, user.len)) { | 588 | if (copy_from_user(new, user.data, user.len)) { |
587 | ncp_kfree_s(new, user.len); | 589 | kfree(new); |
588 | return -EFAULT; | 590 | return -EFAULT; |
589 | } | 591 | } |
590 | } else { | 592 | } else { |
@@ -596,7 +598,7 @@ outrel: | |||
596 | server->priv.len = user.len; | 598 | server->priv.len = user.len; |
597 | server->priv.data = new; | 599 | server->priv.data = new; |
598 | /* leave critical section */ | 600 | /* leave critical section */ |
599 | if (old) ncp_kfree_s(old, oldlen); | 601 | kfree(old); |
600 | return 0; | 602 | return 0; |
601 | } | 603 | } |
602 | 604 | ||
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index aa7bb41b293d..e3a0797dd56b 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -37,7 +37,7 @@ static u32 nfs_ftypes[] = { | |||
37 | /* | 37 | /* |
38 | * XDR functions for basic NFS types | 38 | * XDR functions for basic NFS types |
39 | */ | 39 | */ |
40 | static inline u32 * | 40 | static u32 * |
41 | decode_fh(u32 *p, struct svc_fh *fhp) | 41 | decode_fh(u32 *p, struct svc_fh *fhp) |
42 | { | 42 | { |
43 | fh_init(fhp, NFS_FHSIZE); | 43 | fh_init(fhp, NFS_FHSIZE); |
@@ -151,7 +151,7 @@ decode_sattr(u32 *p, struct iattr *iap) | |||
151 | return p; | 151 | return p; |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline u32 * | 154 | static u32 * |
155 | encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | 155 | encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, |
156 | struct kstat *stat) | 156 | struct kstat *stat) |
157 | { | 157 | { |
@@ -50,7 +50,7 @@ void pipe_wait(struct inode * inode) | |||
50 | mutex_lock(PIPE_MUTEX(*inode)); | 50 | mutex_lock(PIPE_MUTEX(*inode)); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline int | 53 | static int |
54 | pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len) | 54 | pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len) |
55 | { | 55 | { |
56 | unsigned long copy; | 56 | unsigned long copy; |
@@ -70,7 +70,7 @@ pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len) | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | static inline int | 73 | static int |
74 | pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len) | 74 | pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len) |
75 | { | 75 | { |
76 | unsigned long copy; | 76 | unsigned long copy; |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 63bf6c00fa0c..8f8014285a34 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/kernel_stat.h> | 22 | #include <linux/kernel_stat.h> |
23 | #include <linux/fs.h> | ||
23 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/mman.h> | 26 | #include <linux/mman.h> |
@@ -62,7 +63,6 @@ | |||
62 | */ | 63 | */ |
63 | extern int get_hardware_list(char *); | 64 | extern int get_hardware_list(char *); |
64 | extern int get_stram_list(char *); | 65 | extern int get_stram_list(char *); |
65 | extern int get_chrdev_list(char *); | ||
66 | extern int get_filesystem_list(char *); | 66 | extern int get_filesystem_list(char *); |
67 | extern int get_exec_domain_list(char *); | 67 | extern int get_exec_domain_list(char *); |
68 | extern int get_dma_list(char *); | 68 | extern int get_dma_list(char *); |
@@ -248,6 +248,154 @@ static int cpuinfo_open(struct inode *inode, struct file *file) | |||
248 | { | 248 | { |
249 | return seq_open(file, &cpuinfo_op); | 249 | return seq_open(file, &cpuinfo_op); |
250 | } | 250 | } |
251 | |||
252 | enum devinfo_states { | ||
253 | CHR_HDR, | ||
254 | CHR_LIST, | ||
255 | BLK_HDR, | ||
256 | BLK_LIST, | ||
257 | DEVINFO_DONE | ||
258 | }; | ||
259 | |||
260 | struct devinfo_state { | ||
261 | void *chrdev; | ||
262 | void *blkdev; | ||
263 | unsigned int num_records; | ||
264 | unsigned int cur_record; | ||
265 | enum devinfo_states state; | ||
266 | }; | ||
267 | |||
268 | static void *devinfo_start(struct seq_file *f, loff_t *pos) | ||
269 | { | ||
270 | struct devinfo_state *info = f->private; | ||
271 | |||
272 | if (*pos) { | ||
273 | if ((info) && (*pos <= info->num_records)) | ||
274 | return info; | ||
275 | return NULL; | ||
276 | } | ||
277 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
278 | f->private = info; | ||
279 | info->chrdev = acquire_chrdev_list(); | ||
280 | info->blkdev = acquire_blkdev_list(); | ||
281 | info->state = CHR_HDR; | ||
282 | info->num_records = count_chrdev_list(); | ||
283 | info->num_records += count_blkdev_list(); | ||
284 | info->num_records += 2; /* Character and Block headers */ | ||
285 | *pos = 1; | ||
286 | info->cur_record = *pos; | ||
287 | return info; | ||
288 | } | ||
289 | |||
290 | static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos) | ||
291 | { | ||
292 | int idummy; | ||
293 | char *ndummy; | ||
294 | struct devinfo_state *info = f->private; | ||
295 | |||
296 | switch (info->state) { | ||
297 | case CHR_HDR: | ||
298 | info->state = CHR_LIST; | ||
299 | (*pos)++; | ||
300 | /*fallthrough*/ | ||
301 | case CHR_LIST: | ||
302 | if (get_chrdev_info(info->chrdev,&idummy,&ndummy)) { | ||
303 | /* | ||
304 | * The character dev list is complete | ||
305 | */ | ||
306 | info->state = BLK_HDR; | ||
307 | } else { | ||
308 | info->chrdev = get_next_chrdev(info->chrdev); | ||
309 | } | ||
310 | (*pos)++; | ||
311 | break; | ||
312 | case BLK_HDR: | ||
313 | info->state = BLK_LIST; | ||
314 | (*pos)++; | ||
315 | break; | ||
316 | case BLK_LIST: | ||
317 | if (get_blkdev_info(info->blkdev,&idummy,&ndummy)) { | ||
318 | /* | ||
319 | * The block dev list is complete | ||
320 | */ | ||
321 | info->state = DEVINFO_DONE; | ||
322 | } else { | ||
323 | info->blkdev = get_next_blkdev(info->blkdev); | ||
324 | } | ||
325 | (*pos)++; | ||
326 | break; | ||
327 | case DEVINFO_DONE: | ||
328 | (*pos)++; | ||
329 | info->cur_record = *pos; | ||
330 | info = NULL; | ||
331 | break; | ||
332 | default: | ||
333 | break; | ||
334 | } | ||
335 | if (info) | ||
336 | info->cur_record = *pos; | ||
337 | return info; | ||
338 | } | ||
339 | |||
340 | static void devinfo_stop(struct seq_file *f, void *v) | ||
341 | { | ||
342 | struct devinfo_state *info = f->private; | ||
343 | |||
344 | if (info) { | ||
345 | release_chrdev_list(info->chrdev); | ||
346 | release_blkdev_list(info->blkdev); | ||
347 | f->private = NULL; | ||
348 | kfree(info); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | static int devinfo_show(struct seq_file *f, void *arg) | ||
353 | { | ||
354 | int major; | ||
355 | char *name; | ||
356 | struct devinfo_state *info = f->private; | ||
357 | |||
358 | switch(info->state) { | ||
359 | case CHR_HDR: | ||
360 | seq_printf(f,"Character devices:\n"); | ||
361 | /* fallthrough */ | ||
362 | case CHR_LIST: | ||
363 | if (!get_chrdev_info(info->chrdev,&major,&name)) | ||
364 | seq_printf(f,"%3d %s\n",major,name); | ||
365 | break; | ||
366 | case BLK_HDR: | ||
367 | seq_printf(f,"\nBlock devices:\n"); | ||
368 | /* fallthrough */ | ||
369 | case BLK_LIST: | ||
370 | if (!get_blkdev_info(info->blkdev,&major,&name)) | ||
371 | seq_printf(f,"%3d %s\n",major,name); | ||
372 | break; | ||
373 | default: | ||
374 | break; | ||
375 | } | ||
376 | |||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static struct seq_operations devinfo_op = { | ||
381 | .start = devinfo_start, | ||
382 | .next = devinfo_next, | ||
383 | .stop = devinfo_stop, | ||
384 | .show = devinfo_show, | ||
385 | }; | ||
386 | |||
387 | static int devinfo_open(struct inode *inode, struct file *file) | ||
388 | { | ||
389 | return seq_open(file, &devinfo_op); | ||
390 | } | ||
391 | |||
392 | static struct file_operations proc_devinfo_operations = { | ||
393 | .open = devinfo_open, | ||
394 | .read = seq_read, | ||
395 | .llseek = seq_lseek, | ||
396 | .release = seq_release, | ||
397 | }; | ||
398 | |||
251 | static struct file_operations proc_cpuinfo_operations = { | 399 | static struct file_operations proc_cpuinfo_operations = { |
252 | .open = cpuinfo_open, | 400 | .open = cpuinfo_open, |
253 | .read = seq_read, | 401 | .read = seq_read, |
@@ -450,14 +598,6 @@ static struct file_operations proc_stat_operations = { | |||
450 | .release = single_release, | 598 | .release = single_release, |
451 | }; | 599 | }; |
452 | 600 | ||
453 | static int devices_read_proc(char *page, char **start, off_t off, | ||
454 | int count, int *eof, void *data) | ||
455 | { | ||
456 | int len = get_chrdev_list(page); | ||
457 | len += get_blkdev_list(page+len, len); | ||
458 | return proc_calc_metrics(page, start, off, count, eof, len); | ||
459 | } | ||
460 | |||
461 | /* | 601 | /* |
462 | * /proc/interrupts | 602 | * /proc/interrupts |
463 | */ | 603 | */ |
@@ -582,7 +722,6 @@ void __init proc_misc_init(void) | |||
582 | #ifdef CONFIG_STRAM_PROC | 722 | #ifdef CONFIG_STRAM_PROC |
583 | {"stram", stram_read_proc}, | 723 | {"stram", stram_read_proc}, |
584 | #endif | 724 | #endif |
585 | {"devices", devices_read_proc}, | ||
586 | {"filesystems", filesystems_read_proc}, | 725 | {"filesystems", filesystems_read_proc}, |
587 | {"cmdline", cmdline_read_proc}, | 726 | {"cmdline", cmdline_read_proc}, |
588 | {"locks", locks_read_proc}, | 727 | {"locks", locks_read_proc}, |
@@ -598,6 +737,7 @@ void __init proc_misc_init(void) | |||
598 | entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); | 737 | entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); |
599 | if (entry) | 738 | if (entry) |
600 | entry->proc_fops = &proc_kmsg_operations; | 739 | entry->proc_fops = &proc_kmsg_operations; |
740 | create_seq_entry("devices", 0, &proc_devinfo_operations); | ||
601 | create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); | 741 | create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); |
602 | create_seq_entry("partitions", 0, &proc_partitions_operations); | 742 | create_seq_entry("partitions", 0, &proc_partitions_operations); |
603 | create_seq_entry("stat", 0, &proc_stat_operations); | 743 | create_seq_entry("stat", 0, &proc_stat_operations); |
diff --git a/fs/quota_v2.c b/fs/quota_v2.c index 7afcbb1b9376..a4ef91bb4f3b 100644 --- a/fs/quota_v2.c +++ b/fs/quota_v2.c | |||
@@ -35,7 +35,8 @@ static int v2_check_quota_file(struct super_block *sb, int type) | |||
35 | 35 | ||
36 | size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); | 36 | size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); |
37 | if (size != sizeof(struct v2_disk_dqheader)) { | 37 | if (size != sizeof(struct v2_disk_dqheader)) { |
38 | printk("failed read\n"); | 38 | printk("quota_v2: failed read expected=%d got=%d\n", |
39 | sizeof(struct v2_disk_dqheader), size); | ||
39 | return 0; | 40 | return 0; |
40 | } | 41 | } |
41 | if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] || | 42 | if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] || |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 3549067c42d9..8f8d8d01107c 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -375,11 +375,7 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry, | |||
375 | return ERR_PTR(-EIO); | 375 | return ERR_PTR(-EIO); |
376 | } | 376 | } |
377 | 377 | ||
378 | if (inode) | 378 | return d_splice_alias(inode, dentry); |
379 | return d_splice_alias(inode, dentry); | ||
380 | |||
381 | d_add(dentry, inode); | ||
382 | return NULL; | ||
383 | } | 379 | } |
384 | 380 | ||
385 | /* | 381 | /* |
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile index 93246b7dd6fb..6673ee82cb4c 100644 --- a/fs/smbfs/Makefile +++ b/fs/smbfs/Makefile | |||
@@ -13,7 +13,6 @@ smbfs-objs := proc.o dir.o cache.o sock.o inode.o file.o ioctl.o getopt.o \ | |||
13 | EXTRA_CFLAGS += -DSMBFS_PARANOIA | 13 | EXTRA_CFLAGS += -DSMBFS_PARANOIA |
14 | #EXTRA_CFLAGS += -DSMBFS_DEBUG | 14 | #EXTRA_CFLAGS += -DSMBFS_DEBUG |
15 | #EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE | 15 | #EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE |
16 | #EXTRA_CFLAGS += -DDEBUG_SMB_MALLOC | ||
17 | #EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP | 16 | #EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP |
18 | #EXTRA_CFLAGS += -Werror | 17 | #EXTRA_CFLAGS += -Werror |
19 | 18 | ||
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 6ec88bf59b2d..02e3e82d465c 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -487,11 +487,11 @@ smb_put_super(struct super_block *sb) | |||
487 | if (server->conn_pid) | 487 | if (server->conn_pid) |
488 | kill_proc(server->conn_pid, SIGTERM, 1); | 488 | kill_proc(server->conn_pid, SIGTERM, 1); |
489 | 489 | ||
490 | smb_kfree(server->ops); | 490 | kfree(server->ops); |
491 | smb_unload_nls(server); | 491 | smb_unload_nls(server); |
492 | sb->s_fs_info = NULL; | 492 | sb->s_fs_info = NULL; |
493 | smb_unlock_server(server); | 493 | smb_unlock_server(server); |
494 | smb_kfree(server); | 494 | kfree(server); |
495 | } | 495 | } |
496 | 496 | ||
497 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | 497 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) |
@@ -519,11 +519,10 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
519 | sb->s_op = &smb_sops; | 519 | sb->s_op = &smb_sops; |
520 | sb->s_time_gran = 100; | 520 | sb->s_time_gran = 100; |
521 | 521 | ||
522 | server = smb_kmalloc(sizeof(struct smb_sb_info), GFP_KERNEL); | 522 | server = kzalloc(sizeof(struct smb_sb_info), GFP_KERNEL); |
523 | if (!server) | 523 | if (!server) |
524 | goto out_no_server; | 524 | goto out_no_server; |
525 | sb->s_fs_info = server; | 525 | sb->s_fs_info = server; |
526 | memset(server, 0, sizeof(struct smb_sb_info)); | ||
527 | 526 | ||
528 | server->super_block = sb; | 527 | server->super_block = sb; |
529 | server->mnt = NULL; | 528 | server->mnt = NULL; |
@@ -542,8 +541,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
542 | /* FIXME: move these to the smb_sb_info struct */ | 541 | /* FIXME: move these to the smb_sb_info struct */ |
543 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + | 542 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + |
544 | sizeof(struct smb_mount_data_kernel)); | 543 | sizeof(struct smb_mount_data_kernel)); |
545 | mem = smb_kmalloc(sizeof(struct smb_ops) + | 544 | mem = kmalloc(sizeof(struct smb_ops) + |
546 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); | 545 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); |
547 | if (!mem) | 546 | if (!mem) |
548 | goto out_no_mem; | 547 | goto out_no_mem; |
549 | 548 | ||
@@ -621,12 +620,12 @@ out_no_root: | |||
621 | out_no_smbiod: | 620 | out_no_smbiod: |
622 | smb_unload_nls(server); | 621 | smb_unload_nls(server); |
623 | out_bad_option: | 622 | out_bad_option: |
624 | smb_kfree(mem); | 623 | kfree(mem); |
625 | out_no_mem: | 624 | out_no_mem: |
626 | if (!server->mnt) | 625 | if (!server->mnt) |
627 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); | 626 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); |
628 | sb->s_fs_info = NULL; | 627 | sb->s_fs_info = NULL; |
629 | smb_kfree(server); | 628 | kfree(server); |
630 | goto out_fail; | 629 | goto out_fail; |
631 | out_wrong_data: | 630 | out_wrong_data: |
632 | printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver); | 631 | printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver); |
@@ -782,12 +781,6 @@ out: | |||
782 | return error; | 781 | return error; |
783 | } | 782 | } |
784 | 783 | ||
785 | #ifdef DEBUG_SMB_MALLOC | ||
786 | int smb_malloced; | ||
787 | int smb_current_kmalloced; | ||
788 | int smb_current_vmalloced; | ||
789 | #endif | ||
790 | |||
791 | static struct super_block *smb_get_sb(struct file_system_type *fs_type, | 784 | static struct super_block *smb_get_sb(struct file_system_type *fs_type, |
792 | int flags, const char *dev_name, void *data) | 785 | int flags, const char *dev_name, void *data) |
793 | { | 786 | { |
@@ -807,12 +800,6 @@ static int __init init_smb_fs(void) | |||
807 | int err; | 800 | int err; |
808 | DEBUG1("registering ...\n"); | 801 | DEBUG1("registering ...\n"); |
809 | 802 | ||
810 | #ifdef DEBUG_SMB_MALLOC | ||
811 | smb_malloced = 0; | ||
812 | smb_current_kmalloced = 0; | ||
813 | smb_current_vmalloced = 0; | ||
814 | #endif | ||
815 | |||
816 | err = init_inodecache(); | 803 | err = init_inodecache(); |
817 | if (err) | 804 | if (err) |
818 | goto out_inode; | 805 | goto out_inode; |
@@ -837,11 +824,6 @@ static void __exit exit_smb_fs(void) | |||
837 | unregister_filesystem(&smb_fs_type); | 824 | unregister_filesystem(&smb_fs_type); |
838 | smb_destroy_request_cache(); | 825 | smb_destroy_request_cache(); |
839 | destroy_inodecache(); | 826 | destroy_inodecache(); |
840 | #ifdef DEBUG_SMB_MALLOC | ||
841 | printk(KERN_DEBUG "smb_malloced: %d\n", smb_malloced); | ||
842 | printk(KERN_DEBUG "smb_current_kmalloced: %d\n",smb_current_kmalloced); | ||
843 | printk(KERN_DEBUG "smb_current_vmalloced: %d\n",smb_current_vmalloced); | ||
844 | #endif | ||
845 | } | 827 | } |
846 | 828 | ||
847 | module_init(init_smb_fs) | 829 | module_init(init_smb_fs) |
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c index a0f296d9928a..c71c375863cc 100644 --- a/fs/smbfs/request.c +++ b/fs/smbfs/request.c | |||
@@ -68,7 +68,7 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server, | |||
68 | goto out; | 68 | goto out; |
69 | 69 | ||
70 | if (bufsize > 0) { | 70 | if (bufsize > 0) { |
71 | buf = smb_kmalloc(bufsize, GFP_NOFS); | 71 | buf = kmalloc(bufsize, GFP_NOFS); |
72 | if (!buf) { | 72 | if (!buf) { |
73 | kmem_cache_free(req_cachep, req); | 73 | kmem_cache_free(req_cachep, req); |
74 | return NULL; | 74 | return NULL; |
@@ -124,9 +124,8 @@ static void smb_free_request(struct smb_request *req) | |||
124 | { | 124 | { |
125 | atomic_dec(&req->rq_server->nr_requests); | 125 | atomic_dec(&req->rq_server->nr_requests); |
126 | if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC)) | 126 | if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC)) |
127 | smb_kfree(req->rq_buffer); | 127 | kfree(req->rq_buffer); |
128 | if (req->rq_trans2buffer) | 128 | kfree(req->rq_trans2buffer); |
129 | smb_kfree(req->rq_trans2buffer); | ||
130 | kmem_cache_free(req_cachep, req); | 129 | kmem_cache_free(req_cachep, req); |
131 | } | 130 | } |
132 | 131 | ||
@@ -183,8 +182,7 @@ static int smb_setup_request(struct smb_request *req) | |||
183 | req->rq_err = 0; | 182 | req->rq_err = 0; |
184 | req->rq_errno = 0; | 183 | req->rq_errno = 0; |
185 | req->rq_fragment = 0; | 184 | req->rq_fragment = 0; |
186 | if (req->rq_trans2buffer) | 185 | kfree(req->rq_trans2buffer); |
187 | smb_kfree(req->rq_trans2buffer); | ||
188 | 186 | ||
189 | return 0; | 187 | return 0; |
190 | } | 188 | } |
@@ -647,10 +645,9 @@ static int smb_recv_trans2(struct smb_sb_info *server, struct smb_request *req) | |||
647 | goto out_too_long; | 645 | goto out_too_long; |
648 | 646 | ||
649 | req->rq_trans2bufsize = buf_len; | 647 | req->rq_trans2bufsize = buf_len; |
650 | req->rq_trans2buffer = smb_kmalloc(buf_len, GFP_NOFS); | 648 | req->rq_trans2buffer = kzalloc(buf_len, GFP_NOFS); |
651 | if (!req->rq_trans2buffer) | 649 | if (!req->rq_trans2buffer) |
652 | goto out_no_mem; | 650 | goto out_no_mem; |
653 | memset(req->rq_trans2buffer, 0, buf_len); | ||
654 | 651 | ||
655 | req->rq_parm = req->rq_trans2buffer; | 652 | req->rq_parm = req->rq_trans2buffer; |
656 | req->rq_data = req->rq_trans2buffer + parm_tot; | 653 | req->rq_data = req->rq_trans2buffer + parm_tot; |
diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h index 8cf70ff160af..2b57f91b4ebd 100644 --- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h +++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h | |||
@@ -26,6 +26,8 @@ | |||
26 | * fc000000 da000000 16M PCI CFG0 | 26 | * fc000000 da000000 16M PCI CFG0 |
27 | * fd000000 d8000000 16M PCI I/O | 27 | * fd000000 d8000000 16M PCI I/O |
28 | * fe[0-7]00000 8M per-platform mappings | 28 | * fe[0-7]00000 8M per-platform mappings |
29 | * fe900000 80000000 1M SRAM #0 (first MB) | ||
30 | * fea00000 cb400000 1M SCRATCH ring get/put | ||
29 | * feb00000 c8000000 1M MSF | 31 | * feb00000 c8000000 1M MSF |
30 | * fec00000 df000000 1M PCI CSRs | 32 | * fec00000 df000000 1M PCI CSRs |
31 | * fed00000 de000000 1M PCI CREG | 33 | * fed00000 de000000 1M PCI CREG |
@@ -91,6 +93,14 @@ | |||
91 | #define IXP2000_MSF_VIRT_BASE 0xfeb00000 | 93 | #define IXP2000_MSF_VIRT_BASE 0xfeb00000 |
92 | #define IXP2000_MSF_SIZE 0x00100000 | 94 | #define IXP2000_MSF_SIZE 0x00100000 |
93 | 95 | ||
96 | #define IXP2000_SCRATCH_RING_PHYS_BASE 0xcb400000 | ||
97 | #define IXP2000_SCRATCH_RING_VIRT_BASE 0xfea00000 | ||
98 | #define IXP2000_SCRATCH_RING_SIZE 0x00100000 | ||
99 | |||
100 | #define IXP2000_SRAM0_PHYS_BASE 0x80000000 | ||
101 | #define IXP2000_SRAM0_VIRT_BASE 0xfe900000 | ||
102 | #define IXP2000_SRAM0_SIZE 0x00100000 | ||
103 | |||
94 | #define IXP2000_PCI_IO_PHYS_BASE 0xd8000000 | 104 | #define IXP2000_PCI_IO_PHYS_BASE 0xd8000000 |
95 | #define IXP2000_PCI_IO_VIRT_BASE 0xfd000000 | 105 | #define IXP2000_PCI_IO_VIRT_BASE 0xfd000000 |
96 | #define IXP2000_PCI_IO_SIZE 0x01000000 | 106 | #define IXP2000_PCI_IO_SIZE 0x01000000 |
diff --git a/include/asm-arm/arch-versatile/entry-macro.S b/include/asm-arm/arch-versatile/entry-macro.S index 58f0d71759f6..feff771c0a0a 100644 --- a/include/asm-arm/arch-versatile/entry-macro.S +++ b/include/asm-arm/arch-versatile/entry-macro.S | |||
@@ -8,6 +8,7 @@ | |||
8 | * warranty of any kind, whether express or implied. | 8 | * warranty of any kind, whether express or implied. |
9 | */ | 9 | */ |
10 | #include <asm/hardware.h> | 10 | #include <asm/hardware.h> |
11 | #include <asm/hardware/vic.h> | ||
11 | 12 | ||
12 | .macro disable_fiq | 13 | .macro disable_fiq |
13 | .endm | 14 | .endm |
diff --git a/include/asm-arm/arch-versatile/platform.h b/include/asm-arm/arch-versatile/platform.h index cbdd9fb96332..72ef874567d5 100644 --- a/include/asm-arm/arch-versatile/platform.h +++ b/include/asm-arm/arch-versatile/platform.h | |||
@@ -293,26 +293,7 @@ | |||
293 | * VERSATILE_SYS_IC | 293 | * VERSATILE_SYS_IC |
294 | * | 294 | * |
295 | */ | 295 | */ |
296 | #define VIC_IRQ_STATUS 0 | 296 | /* VIC definitions in include/asm-arm/hardware/vic.h */ |
297 | #define VIC_FIQ_STATUS 0x04 | ||
298 | #define VIC_IRQ_RAW_STATUS 0x08 | ||
299 | #define VIC_INT_SELECT 0x0C /* 1 = FIQ, 0 = IRQ */ | ||
300 | #define VIC_IRQ_ENABLE 0x10 /* 1 = enable, 0 = disable */ | ||
301 | #define VIC_IRQ_ENABLE_CLEAR 0x14 | ||
302 | #define VIC_IRQ_SOFT 0x18 | ||
303 | #define VIC_IRQ_SOFT_CLEAR 0x1C | ||
304 | #define VIC_PROTECT 0x20 | ||
305 | #define VIC_VECT_ADDR 0x30 | ||
306 | #define VIC_DEF_VECT_ADDR 0x34 | ||
307 | #define VIC_VECT_ADDR0 0x100 /* 0 to 15 */ | ||
308 | #define VIC_VECT_CNTL0 0x200 /* 0 to 15 */ | ||
309 | #define VIC_ITCR 0x300 /* VIC test control register */ | ||
310 | |||
311 | #define VIC_FIQ_RAW_STATUS 0x08 | ||
312 | #define VIC_FIQ_ENABLE 0x10 /* 1 = enable, 0 = disable */ | ||
313 | #define VIC_FIQ_ENABLE_CLEAR 0x14 | ||
314 | #define VIC_FIQ_SOFT 0x18 | ||
315 | #define VIC_FIQ_SOFT_CLEAR 0x1C | ||
316 | 297 | ||
317 | #define SIC_IRQ_STATUS 0 | 298 | #define SIC_IRQ_STATUS 0 |
318 | #define SIC_IRQ_RAW_STATUS 0x04 | 299 | #define SIC_IRQ_RAW_STATUS 0x04 |
@@ -325,8 +306,6 @@ | |||
325 | #define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */ | 306 | #define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */ |
326 | #define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */ | 307 | #define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */ |
327 | 308 | ||
328 | #define VICVectCntl_Enable (1 << 5) | ||
329 | |||
330 | /* ------------------------------------------------------------------------ | 309 | /* ------------------------------------------------------------------------ |
331 | * Interrupts - bit assignment (primary) | 310 | * Interrupts - bit assignment (primary) |
332 | * ------------------------------------------------------------------------ | 311 | * ------------------------------------------------------------------------ |
diff --git a/include/asm-arm/hardware/vic.h b/include/asm-arm/hardware/vic.h new file mode 100644 index 000000000000..81825eb54c9e --- /dev/null +++ b/include/asm-arm/hardware/vic.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/hardware/vic.h | ||
3 | * | ||
4 | * Copyright (c) ARM Limited 2003. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_HARDWARE_VIC_H | ||
21 | #define __ASM_ARM_HARDWARE_VIC_H | ||
22 | |||
23 | #define VIC_IRQ_STATUS 0x00 | ||
24 | #define VIC_FIQ_STATUS 0x04 | ||
25 | #define VIC_RAW_STATUS 0x08 | ||
26 | #define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */ | ||
27 | #define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */ | ||
28 | #define VIC_INT_ENABLE_CLEAR 0x14 | ||
29 | #define VIC_INT_SOFT 0x18 | ||
30 | #define VIC_INT_SOFT_CLEAR 0x1c | ||
31 | #define VIC_PROTECT 0x20 | ||
32 | #define VIC_VECT_ADDR 0x30 | ||
33 | #define VIC_DEF_VECT_ADDR 0x34 | ||
34 | |||
35 | #define VIC_VECT_ADDR0 0x100 /* 0 to 15 */ | ||
36 | #define VIC_VECT_CNTL0 0x200 /* 0 to 15 */ | ||
37 | #define VIC_ITCR 0x300 /* VIC test control register */ | ||
38 | |||
39 | #define VIC_VECT_CNTL_ENABLE (1 << 5) | ||
40 | |||
41 | #ifndef __ASSEMBLY__ | ||
42 | void vic_init(void __iomem *base, u32 vic_sources); | ||
43 | #endif | ||
44 | |||
45 | #endif | ||
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h index eb262e078c46..2cd57b4d64d9 100644 --- a/include/asm-arm/mach/arch.h +++ b/include/asm-arm/mach/arch.h | |||
@@ -10,6 +10,8 @@ | |||
10 | 10 | ||
11 | #ifndef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
12 | 12 | ||
13 | #include <linux/compiler.h> | ||
14 | |||
13 | struct tag; | 15 | struct tag; |
14 | struct meminfo; | 16 | struct meminfo; |
15 | struct sys_timer; | 17 | struct sys_timer; |
@@ -20,7 +22,7 @@ struct machine_desc { | |||
20 | * by assembler code in head-armv.S | 22 | * by assembler code in head-armv.S |
21 | */ | 23 | */ |
22 | unsigned int nr; /* architecture number */ | 24 | unsigned int nr; /* architecture number */ |
23 | unsigned int phys_ram; /* start of physical ram */ | 25 | unsigned int __deprecated phys_ram; /* start of physical ram */ |
24 | unsigned int phys_io; /* start of physical io */ | 26 | unsigned int phys_io; /* start of physical io */ |
25 | unsigned int io_pg_offst; /* byte offset for io | 27 | unsigned int io_pg_offst; /* byte offset for io |
26 | * page tabe entry */ | 28 | * page tabe entry */ |
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 4da1d532cbeb..416320d95419 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h | |||
@@ -170,6 +170,13 @@ extern pmd_t *top_pmd; | |||
170 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 170 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
171 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 171 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
172 | 172 | ||
173 | /* | ||
174 | * With EABI on ARMv5 and above we must have 64-bit aligned slab pointers. | ||
175 | */ | ||
176 | #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) | ||
177 | #define ARCH_SLAB_MINALIGN 8 | ||
178 | #endif | ||
179 | |||
173 | #endif /* __KERNEL__ */ | 180 | #endif /* __KERNEL__ */ |
174 | 181 | ||
175 | #include <asm-generic/page.h> | 182 | #include <asm-generic/page.h> |
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index 31290694648b..04f4d34c6317 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h | |||
@@ -49,6 +49,12 @@ struct thread_struct { | |||
49 | 49 | ||
50 | #define INIT_THREAD { } | 50 | #define INIT_THREAD { } |
51 | 51 | ||
52 | #ifdef CONFIG_MMU | ||
53 | #define nommu_start_thread(regs) do { } while (0) | ||
54 | #else | ||
55 | #define nommu_start_thread(regs) regs->ARM_r10 = current->mm->start_data | ||
56 | #endif | ||
57 | |||
52 | #define start_thread(regs,pc,sp) \ | 58 | #define start_thread(regs,pc,sp) \ |
53 | ({ \ | 59 | ({ \ |
54 | unsigned long *stack = (unsigned long *)sp; \ | 60 | unsigned long *stack = (unsigned long *)sp; \ |
@@ -65,6 +71,7 @@ struct thread_struct { | |||
65 | regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ | 71 | regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ |
66 | regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ | 72 | regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ |
67 | regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ | 73 | regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ |
74 | nommu_start_thread(regs); \ | ||
68 | }) | 75 | }) |
69 | 76 | ||
70 | /* Forward declaration, a strange C thing */ | 77 | /* Forward declaration, a strange C thing */ |
diff --git a/include/asm-arm/ptrace.h b/include/asm-arm/ptrace.h index 4377e22b7e1a..77adb7fa169b 100644 --- a/include/asm-arm/ptrace.h +++ b/include/asm-arm/ptrace.h | |||
@@ -23,6 +23,9 @@ | |||
23 | #define PTRACE_OLDSETOPTIONS 21 | 23 | #define PTRACE_OLDSETOPTIONS 21 |
24 | 24 | ||
25 | #define PTRACE_GET_THREAD_AREA 22 | 25 | #define PTRACE_GET_THREAD_AREA 22 |
26 | |||
27 | #define PTRACE_SET_SYSCALL 23 | ||
28 | |||
26 | /* | 29 | /* |
27 | * PSR bits | 30 | * PSR bits |
28 | */ | 31 | */ |
@@ -60,9 +63,11 @@ | |||
60 | 63 | ||
61 | #ifndef __ASSEMBLY__ | 64 | #ifndef __ASSEMBLY__ |
62 | 65 | ||
63 | /* this struct defines the way the registers are stored on the | 66 | /* |
64 | stack during a system call. */ | 67 | * This struct defines the way the registers are stored on the |
65 | 68 | * stack during a system call. Note that sizeof(struct pt_regs) | |
69 | * has to be a multiple of 8. | ||
70 | */ | ||
66 | struct pt_regs { | 71 | struct pt_regs { |
67 | long uregs[18]; | 72 | long uregs[18]; |
68 | }; | 73 | }; |
diff --git a/include/asm-arm/stat.h b/include/asm-arm/stat.h index ec4e2c2e3b47..42c0c13999d5 100644 --- a/include/asm-arm/stat.h +++ b/include/asm-arm/stat.h | |||
@@ -70,14 +70,7 @@ struct stat64 { | |||
70 | 70 | ||
71 | long long st_size; | 71 | long long st_size; |
72 | unsigned long st_blksize; | 72 | unsigned long st_blksize; |
73 | 73 | unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ | |
74 | #if defined(__ARMEB__) | ||
75 | unsigned long __pad4; /* Future possible st_blocks hi bits */ | ||
76 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
77 | #else /* Must be little */ | ||
78 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
79 | unsigned long __pad4; /* Future possible st_blocks hi bits */ | ||
80 | #endif | ||
81 | 74 | ||
82 | unsigned long st_atime; | 75 | unsigned long st_atime; |
83 | unsigned long st_atime_nsec; | 76 | unsigned long st_atime_nsec; |
@@ -89,6 +82,6 @@ struct stat64 { | |||
89 | unsigned long st_ctime_nsec; | 82 | unsigned long st_ctime_nsec; |
90 | 83 | ||
91 | unsigned long long st_ino; | 84 | unsigned long long st_ino; |
92 | } __attribute__((packed)); | 85 | }; |
93 | 86 | ||
94 | #endif | 87 | #endif |
diff --git a/include/asm-arm/statfs.h b/include/asm-arm/statfs.h index e81f82783b87..a02e6a8c3d70 100644 --- a/include/asm-arm/statfs.h +++ b/include/asm-arm/statfs.h | |||
@@ -1,6 +1,42 @@ | |||
1 | #ifndef _ASMARM_STATFS_H | 1 | #ifndef _ASMARM_STATFS_H |
2 | #define _ASMARM_STATFS_H | 2 | #define _ASMARM_STATFS_H |
3 | 3 | ||
4 | #include <asm-generic/statfs.h> | 4 | #ifndef __KERNEL_STRICT_NAMES |
5 | # include <linux/types.h> | ||
6 | typedef __kernel_fsid_t fsid_t; | ||
7 | #endif | ||
8 | |||
9 | struct statfs { | ||
10 | __u32 f_type; | ||
11 | __u32 f_bsize; | ||
12 | __u32 f_blocks; | ||
13 | __u32 f_bfree; | ||
14 | __u32 f_bavail; | ||
15 | __u32 f_files; | ||
16 | __u32 f_ffree; | ||
17 | __kernel_fsid_t f_fsid; | ||
18 | __u32 f_namelen; | ||
19 | __u32 f_frsize; | ||
20 | __u32 f_spare[5]; | ||
21 | }; | ||
22 | |||
23 | /* | ||
24 | * With EABI there is 4 bytes of padding added to this structure. | ||
25 | * Let's pack it so the padding goes away to simplify dual ABI support. | ||
26 | * Note that user space does NOT have to pack this structure. | ||
27 | */ | ||
28 | struct statfs64 { | ||
29 | __u32 f_type; | ||
30 | __u32 f_bsize; | ||
31 | __u64 f_blocks; | ||
32 | __u64 f_bfree; | ||
33 | __u64 f_bavail; | ||
34 | __u64 f_files; | ||
35 | __u64 f_ffree; | ||
36 | __kernel_fsid_t f_fsid; | ||
37 | __u32 f_namelen; | ||
38 | __u32 f_frsize; | ||
39 | __u32 f_spare[5]; | ||
40 | } __attribute__ ((packed,aligned(4))); | ||
5 | 41 | ||
6 | #endif | 42 | #endif |
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index d626e70faded..77430d6178ae 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h | |||
@@ -15,10 +15,12 @@ | |||
15 | 15 | ||
16 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
17 | 17 | ||
18 | #if defined(__thumb__) | 18 | #define __NR_OABI_SYSCALL_BASE 0x900000 |
19 | |||
20 | #if defined(__thumb__) || defined(__ARM_EABI__) | ||
19 | #define __NR_SYSCALL_BASE 0 | 21 | #define __NR_SYSCALL_BASE 0 |
20 | #else | 22 | #else |
21 | #define __NR_SYSCALL_BASE 0x900000 | 23 | #define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE |
22 | #endif | 24 | #endif |
23 | 25 | ||
24 | /* | 26 | /* |
@@ -373,13 +375,13 @@ | |||
373 | #define __sys1(x) __sys2(x) | 375 | #define __sys1(x) __sys2(x) |
374 | 376 | ||
375 | #ifndef __syscall | 377 | #ifndef __syscall |
376 | #if defined(__thumb__) | 378 | #if defined(__thumb__) || defined(__ARM_EABI__) |
377 | #define __syscall(name) \ | 379 | #define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; |
378 | "push {r7}\n\t" \ | 380 | #define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs |
379 | "mov r7, #" __sys1(__NR_##name) "\n\t" \ | 381 | #define __syscall(name) "swi\t0" |
380 | "swi 0\n\t" \ | ||
381 | "pop {r7}" | ||
382 | #else | 382 | #else |
383 | #define __SYS_REG(name) | ||
384 | #define __SYS_REG_LIST(regs...) regs | ||
383 | #define __syscall(name) "swi\t" __sys1(__NR_##name) "" | 385 | #define __syscall(name) "swi\t" __sys1(__NR_##name) "" |
384 | #endif | 386 | #endif |
385 | #endif | 387 | #endif |
@@ -395,33 +397,34 @@ do { \ | |||
395 | 397 | ||
396 | #define _syscall0(type,name) \ | 398 | #define _syscall0(type,name) \ |
397 | type name(void) { \ | 399 | type name(void) { \ |
400 | __SYS_REG(name) \ | ||
398 | register long __res_r0 __asm__("r0"); \ | 401 | register long __res_r0 __asm__("r0"); \ |
399 | long __res; \ | 402 | long __res; \ |
400 | __asm__ __volatile__ ( \ | 403 | __asm__ __volatile__ ( \ |
401 | __syscall(name) \ | 404 | __syscall(name) \ |
402 | : "=r" (__res_r0) \ | 405 | : "=r" (__res_r0) \ |
403 | : \ | 406 | : __SYS_REG_LIST() ); \ |
404 | : "lr"); \ | ||
405 | __res = __res_r0; \ | 407 | __res = __res_r0; \ |
406 | __syscall_return(type,__res); \ | 408 | __syscall_return(type,__res); \ |
407 | } | 409 | } |
408 | 410 | ||
409 | #define _syscall1(type,name,type1,arg1) \ | 411 | #define _syscall1(type,name,type1,arg1) \ |
410 | type name(type1 arg1) { \ | 412 | type name(type1 arg1) { \ |
413 | __SYS_REG(name) \ | ||
411 | register long __r0 __asm__("r0") = (long)arg1; \ | 414 | register long __r0 __asm__("r0") = (long)arg1; \ |
412 | register long __res_r0 __asm__("r0"); \ | 415 | register long __res_r0 __asm__("r0"); \ |
413 | long __res; \ | 416 | long __res; \ |
414 | __asm__ __volatile__ ( \ | 417 | __asm__ __volatile__ ( \ |
415 | __syscall(name) \ | 418 | __syscall(name) \ |
416 | : "=r" (__res_r0) \ | 419 | : "=r" (__res_r0) \ |
417 | : "r" (__r0) \ | 420 | : __SYS_REG_LIST( "0" (__r0) ) ); \ |
418 | : "lr"); \ | ||
419 | __res = __res_r0; \ | 421 | __res = __res_r0; \ |
420 | __syscall_return(type,__res); \ | 422 | __syscall_return(type,__res); \ |
421 | } | 423 | } |
422 | 424 | ||
423 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ | 425 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ |
424 | type name(type1 arg1,type2 arg2) { \ | 426 | type name(type1 arg1,type2 arg2) { \ |
427 | __SYS_REG(name) \ | ||
425 | register long __r0 __asm__("r0") = (long)arg1; \ | 428 | register long __r0 __asm__("r0") = (long)arg1; \ |
426 | register long __r1 __asm__("r1") = (long)arg2; \ | 429 | register long __r1 __asm__("r1") = (long)arg2; \ |
427 | register long __res_r0 __asm__("r0"); \ | 430 | register long __res_r0 __asm__("r0"); \ |
@@ -429,8 +432,7 @@ type name(type1 arg1,type2 arg2) { \ | |||
429 | __asm__ __volatile__ ( \ | 432 | __asm__ __volatile__ ( \ |
430 | __syscall(name) \ | 433 | __syscall(name) \ |
431 | : "=r" (__res_r0) \ | 434 | : "=r" (__res_r0) \ |
432 | : "r" (__r0),"r" (__r1) \ | 435 | : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) ); \ |
433 | : "lr"); \ | ||
434 | __res = __res_r0; \ | 436 | __res = __res_r0; \ |
435 | __syscall_return(type,__res); \ | 437 | __syscall_return(type,__res); \ |
436 | } | 438 | } |
@@ -438,6 +440,7 @@ type name(type1 arg1,type2 arg2) { \ | |||
438 | 440 | ||
439 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ | 441 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ |
440 | type name(type1 arg1,type2 arg2,type3 arg3) { \ | 442 | type name(type1 arg1,type2 arg2,type3 arg3) { \ |
443 | __SYS_REG(name) \ | ||
441 | register long __r0 __asm__("r0") = (long)arg1; \ | 444 | register long __r0 __asm__("r0") = (long)arg1; \ |
442 | register long __r1 __asm__("r1") = (long)arg2; \ | 445 | register long __r1 __asm__("r1") = (long)arg2; \ |
443 | register long __r2 __asm__("r2") = (long)arg3; \ | 446 | register long __r2 __asm__("r2") = (long)arg3; \ |
@@ -446,8 +449,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \ | |||
446 | __asm__ __volatile__ ( \ | 449 | __asm__ __volatile__ ( \ |
447 | __syscall(name) \ | 450 | __syscall(name) \ |
448 | : "=r" (__res_r0) \ | 451 | : "=r" (__res_r0) \ |
449 | : "r" (__r0),"r" (__r1),"r" (__r2) \ | 452 | : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) ); \ |
450 | : "lr"); \ | ||
451 | __res = __res_r0; \ | 453 | __res = __res_r0; \ |
452 | __syscall_return(type,__res); \ | 454 | __syscall_return(type,__res); \ |
453 | } | 455 | } |
@@ -455,6 +457,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \ | |||
455 | 457 | ||
456 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ | 458 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ |
457 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | 459 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ |
460 | __SYS_REG(name) \ | ||
458 | register long __r0 __asm__("r0") = (long)arg1; \ | 461 | register long __r0 __asm__("r0") = (long)arg1; \ |
459 | register long __r1 __asm__("r1") = (long)arg2; \ | 462 | register long __r1 __asm__("r1") = (long)arg2; \ |
460 | register long __r2 __asm__("r2") = (long)arg3; \ | 463 | register long __r2 __asm__("r2") = (long)arg3; \ |
@@ -464,8 +467,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | |||
464 | __asm__ __volatile__ ( \ | 467 | __asm__ __volatile__ ( \ |
465 | __syscall(name) \ | 468 | __syscall(name) \ |
466 | : "=r" (__res_r0) \ | 469 | : "=r" (__res_r0) \ |
467 | : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \ | 470 | : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) ); \ |
468 | : "lr"); \ | ||
469 | __res = __res_r0; \ | 471 | __res = __res_r0; \ |
470 | __syscall_return(type,__res); \ | 472 | __syscall_return(type,__res); \ |
471 | } | 473 | } |
@@ -473,6 +475,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | |||
473 | 475 | ||
474 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ | 476 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ |
475 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ | 477 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ |
478 | __SYS_REG(name) \ | ||
476 | register long __r0 __asm__("r0") = (long)arg1; \ | 479 | register long __r0 __asm__("r0") = (long)arg1; \ |
477 | register long __r1 __asm__("r1") = (long)arg2; \ | 480 | register long __r1 __asm__("r1") = (long)arg2; \ |
478 | register long __r2 __asm__("r2") = (long)arg3; \ | 481 | register long __r2 __asm__("r2") = (long)arg3; \ |
@@ -483,14 +486,15 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ | |||
483 | __asm__ __volatile__ ( \ | 486 | __asm__ __volatile__ ( \ |
484 | __syscall(name) \ | 487 | __syscall(name) \ |
485 | : "=r" (__res_r0) \ | 488 | : "=r" (__res_r0) \ |
486 | : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \ | 489 | : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ |
487 | : "lr"); \ | 490 | "r" (__r3), "r" (__r4) ) ); \ |
488 | __res = __res_r0; \ | 491 | __res = __res_r0; \ |
489 | __syscall_return(type,__res); \ | 492 | __syscall_return(type,__res); \ |
490 | } | 493 | } |
491 | 494 | ||
492 | #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ | 495 | #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ |
493 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ | 496 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ |
497 | __SYS_REG(name) \ | ||
494 | register long __r0 __asm__("r0") = (long)arg1; \ | 498 | register long __r0 __asm__("r0") = (long)arg1; \ |
495 | register long __r1 __asm__("r1") = (long)arg2; \ | 499 | register long __r1 __asm__("r1") = (long)arg2; \ |
496 | register long __r2 __asm__("r2") = (long)arg3; \ | 500 | register long __r2 __asm__("r2") = (long)arg3; \ |
@@ -502,30 +506,33 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 | |||
502 | __asm__ __volatile__ ( \ | 506 | __asm__ __volatile__ ( \ |
503 | __syscall(name) \ | 507 | __syscall(name) \ |
504 | : "=r" (__res_r0) \ | 508 | : "=r" (__res_r0) \ |
505 | : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \ | 509 | : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ |
506 | : "lr"); \ | 510 | "r" (__r3), "r" (__r4), "r" (__r5) ) ); \ |
507 | __res = __res_r0; \ | 511 | __res = __res_r0; \ |
508 | __syscall_return(type,__res); \ | 512 | __syscall_return(type,__res); \ |
509 | } | 513 | } |
510 | 514 | ||
511 | #ifdef __KERNEL__ | 515 | #ifdef __KERNEL__ |
512 | #define __ARCH_WANT_IPC_PARSE_VERSION | 516 | #define __ARCH_WANT_IPC_PARSE_VERSION |
513 | #define __ARCH_WANT_OLD_READDIR | ||
514 | #define __ARCH_WANT_STAT64 | 517 | #define __ARCH_WANT_STAT64 |
515 | #define __ARCH_WANT_SYS_ALARM | ||
516 | #define __ARCH_WANT_SYS_GETHOSTNAME | 518 | #define __ARCH_WANT_SYS_GETHOSTNAME |
517 | #define __ARCH_WANT_SYS_PAUSE | 519 | #define __ARCH_WANT_SYS_PAUSE |
518 | #define __ARCH_WANT_SYS_TIME | ||
519 | #define __ARCH_WANT_SYS_UTIME | ||
520 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
521 | #define __ARCH_WANT_SYS_GETPGRP | 520 | #define __ARCH_WANT_SYS_GETPGRP |
522 | #define __ARCH_WANT_SYS_LLSEEK | 521 | #define __ARCH_WANT_SYS_LLSEEK |
523 | #define __ARCH_WANT_SYS_NICE | 522 | #define __ARCH_WANT_SYS_NICE |
524 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
525 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
526 | #define __ARCH_WANT_SYS_SIGPENDING | 523 | #define __ARCH_WANT_SYS_SIGPENDING |
527 | #define __ARCH_WANT_SYS_SIGPROCMASK | 524 | #define __ARCH_WANT_SYS_SIGPROCMASK |
528 | #define __ARCH_WANT_SYS_RT_SIGACTION | 525 | #define __ARCH_WANT_SYS_RT_SIGACTION |
526 | |||
527 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
528 | #define __ARCH_WANT_SYS_TIME | ||
529 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
530 | #define __ARCH_WANT_SYS_ALARM | ||
531 | #define __ARCH_WANT_SYS_UTIME | ||
532 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
533 | #define __ARCH_WANT_OLD_READDIR | ||
534 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
535 | #endif | ||
529 | #endif | 536 | #endif |
530 | 537 | ||
531 | #ifdef __KERNEL_SYSCALLS__ | 538 | #ifdef __KERNEL_SYSCALLS__ |
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 0fada8f16dc6..42a95d9a0641 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -35,7 +35,7 @@ static inline void atomic_long_set(atomic_long_t *l, long i) | |||
35 | { | 35 | { |
36 | atomic64_t *v = (atomic64_t *)l; | 36 | atomic64_t *v = (atomic64_t *)l; |
37 | 37 | ||
38 | atomic_set(v, i); | 38 | atomic64_set(v, i); |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline void atomic_long_inc(atomic_long_t *l) | 41 | static inline void atomic_long_inc(atomic_long_t *l) |
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index fe0819fe9c64..88e6ca248cd7 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h | |||
@@ -247,7 +247,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long* addr) | |||
247 | static int test_bit(int nr, const volatile void * addr); | 247 | static int test_bit(int nr, const volatile void * addr); |
248 | #endif | 248 | #endif |
249 | 249 | ||
250 | static inline int constant_test_bit(int nr, const volatile unsigned long *addr) | 250 | static __always_inline int constant_test_bit(int nr, const volatile unsigned long *addr) |
251 | { | 251 | { |
252 | return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0; | 252 | return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0; |
253 | } | 253 | } |
diff --git a/include/asm-i386/current.h b/include/asm-i386/current.h index d97328951f5f..3cbbecd79016 100644 --- a/include/asm-i386/current.h +++ b/include/asm-i386/current.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | struct task_struct; | 6 | struct task_struct; |
7 | 7 | ||
8 | static inline struct task_struct * get_current(void) | 8 | static __always_inline struct task_struct * get_current(void) |
9 | { | 9 | { |
10 | return current_thread_info()->task; | 10 | return current_thread_info()->task; |
11 | } | 11 | } |
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 02c8f5d22065..bb5f88a27f7a 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h | |||
@@ -201,7 +201,7 @@ __asm__ __volatile__( | |||
201 | return __res; | 201 | return __res; |
202 | } | 202 | } |
203 | 203 | ||
204 | static inline void * __memcpy(void * to, const void * from, size_t n) | 204 | static __always_inline void * __memcpy(void * to, const void * from, size_t n) |
205 | { | 205 | { |
206 | int d0, d1, d2; | 206 | int d0, d1, d2; |
207 | __asm__ __volatile__( | 207 | __asm__ __volatile__( |
@@ -223,7 +223,7 @@ return (to); | |||
223 | * This looks ugly, but the compiler can optimize it totally, | 223 | * This looks ugly, but the compiler can optimize it totally, |
224 | * as the count is constant. | 224 | * as the count is constant. |
225 | */ | 225 | */ |
226 | static inline void * __constant_memcpy(void * to, const void * from, size_t n) | 226 | static __always_inline void * __constant_memcpy(void * to, const void * from, size_t n) |
227 | { | 227 | { |
228 | long esi, edi; | 228 | long esi, edi; |
229 | if (!n) return to; | 229 | if (!n) return to; |
@@ -367,7 +367,7 @@ return s; | |||
367 | * things 32 bits at a time even when we don't know the size of the | 367 | * things 32 bits at a time even when we don't know the size of the |
368 | * area at compile-time.. | 368 | * area at compile-time.. |
369 | */ | 369 | */ |
370 | static inline void * __constant_c_memset(void * s, unsigned long c, size_t count) | 370 | static __always_inline void * __constant_c_memset(void * s, unsigned long c, size_t count) |
371 | { | 371 | { |
372 | int d0, d1; | 372 | int d0, d1; |
373 | __asm__ __volatile__( | 373 | __asm__ __volatile__( |
@@ -416,7 +416,7 @@ extern char *strstr(const char *cs, const char *ct); | |||
416 | * This looks horribly ugly, but the compiler can optimize it totally, | 416 | * This looks horribly ugly, but the compiler can optimize it totally, |
417 | * as we by now know that both pattern and count is constant.. | 417 | * as we by now know that both pattern and count is constant.. |
418 | */ | 418 | */ |
419 | static inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count) | 419 | static __always_inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count) |
420 | { | 420 | { |
421 | switch (count) { | 421 | switch (count) { |
422 | case 0: | 422 | case 0: |
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index 89ab7e2bc5aa..3f1337c34208 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h | |||
@@ -411,7 +411,7 @@ unsigned long __must_check __copy_from_user_ll(void *to, | |||
411 | * Returns number of bytes that could not be copied. | 411 | * Returns number of bytes that could not be copied. |
412 | * On success, this will be zero. | 412 | * On success, this will be zero. |
413 | */ | 413 | */ |
414 | static inline unsigned long __must_check | 414 | static __always_inline unsigned long __must_check |
415 | __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) | 415 | __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) |
416 | { | 416 | { |
417 | if (__builtin_constant_p(n)) { | 417 | if (__builtin_constant_p(n)) { |
@@ -432,7 +432,7 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) | |||
432 | return __copy_to_user_ll(to, from, n); | 432 | return __copy_to_user_ll(to, from, n); |
433 | } | 433 | } |
434 | 434 | ||
435 | static inline unsigned long __must_check | 435 | static __always_inline unsigned long __must_check |
436 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 436 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
437 | { | 437 | { |
438 | might_sleep(); | 438 | might_sleep(); |
@@ -456,7 +456,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) | |||
456 | * If some data could not be copied, this function will pad the copied | 456 | * If some data could not be copied, this function will pad the copied |
457 | * data to the requested size using zero bytes. | 457 | * data to the requested size using zero bytes. |
458 | */ | 458 | */ |
459 | static inline unsigned long | 459 | static __always_inline unsigned long |
460 | __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) | 460 | __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) |
461 | { | 461 | { |
462 | if (__builtin_constant_p(n)) { | 462 | if (__builtin_constant_p(n)) { |
@@ -477,7 +477,7 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) | |||
477 | return __copy_from_user_ll(to, from, n); | 477 | return __copy_from_user_ll(to, from, n); |
478 | } | 478 | } |
479 | 479 | ||
480 | static inline unsigned long | 480 | static __always_inline unsigned long |
481 | __copy_from_user(void *to, const void __user *from, unsigned long n) | 481 | __copy_from_user(void *to, const void __user *from, unsigned long n) |
482 | { | 482 | { |
483 | might_sleep(); | 483 | might_sleep(); |
diff --git a/include/asm-ia64/sn/ioc3.h b/include/asm-ia64/sn/ioc3.h new file mode 100644 index 000000000000..95ed6cc83cf1 --- /dev/null +++ b/include/asm-ia64/sn/ioc3.h | |||
@@ -0,0 +1,241 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Silicon Graphics, Inc. | ||
3 | */ | ||
4 | #ifndef IA64_SN_IOC3_H | ||
5 | #define IA64_SN_IOC3_H | ||
6 | |||
7 | /* serial port register map */ | ||
8 | struct ioc3_serialregs { | ||
9 | uint32_t sscr; | ||
10 | uint32_t stpir; | ||
11 | uint32_t stcir; | ||
12 | uint32_t srpir; | ||
13 | uint32_t srcir; | ||
14 | uint32_t srtr; | ||
15 | uint32_t shadow; | ||
16 | }; | ||
17 | |||
18 | /* SUPERIO uart register map */ | ||
19 | struct ioc3_uartregs { | ||
20 | char iu_lcr; | ||
21 | union { | ||
22 | char iir; /* read only */ | ||
23 | char fcr; /* write only */ | ||
24 | } u3; | ||
25 | union { | ||
26 | char ier; /* DLAB == 0 */ | ||
27 | char dlm; /* DLAB == 1 */ | ||
28 | } u2; | ||
29 | union { | ||
30 | char rbr; /* read only, DLAB == 0 */ | ||
31 | char thr; /* write only, DLAB == 0 */ | ||
32 | char dll; /* DLAB == 1 */ | ||
33 | } u1; | ||
34 | char iu_scr; | ||
35 | char iu_msr; | ||
36 | char iu_lsr; | ||
37 | char iu_mcr; | ||
38 | }; | ||
39 | |||
40 | #define iu_rbr u1.rbr | ||
41 | #define iu_thr u1.thr | ||
42 | #define iu_dll u1.dll | ||
43 | #define iu_ier u2.ier | ||
44 | #define iu_dlm u2.dlm | ||
45 | #define iu_iir u3.iir | ||
46 | #define iu_fcr u3.fcr | ||
47 | |||
48 | struct ioc3_sioregs { | ||
49 | char fill[0x170]; | ||
50 | struct ioc3_uartregs uartb; | ||
51 | struct ioc3_uartregs uarta; | ||
52 | }; | ||
53 | |||
54 | /* PCI IO/mem space register map */ | ||
55 | struct ioc3 { | ||
56 | uint32_t pci_id; | ||
57 | uint32_t pci_scr; | ||
58 | uint32_t pci_rev; | ||
59 | uint32_t pci_lat; | ||
60 | uint32_t pci_addr; | ||
61 | uint32_t pci_err_addr_l; | ||
62 | uint32_t pci_err_addr_h; | ||
63 | |||
64 | uint32_t sio_ir; | ||
65 | /* these registers are read-only for general kernel code. To | ||
66 | * modify them use the functions in ioc3.c | ||
67 | */ | ||
68 | uint32_t sio_ies; | ||
69 | uint32_t sio_iec; | ||
70 | uint32_t sio_cr; | ||
71 | uint32_t int_out; | ||
72 | uint32_t mcr; | ||
73 | uint32_t gpcr_s; | ||
74 | uint32_t gpcr_c; | ||
75 | uint32_t gpdr; | ||
76 | uint32_t gppr[9]; | ||
77 | char fill[0x4c]; | ||
78 | |||
79 | /* serial port registers */ | ||
80 | uint32_t sbbr_h; | ||
81 | uint32_t sbbr_l; | ||
82 | |||
83 | struct ioc3_serialregs port_a; | ||
84 | struct ioc3_serialregs port_b; | ||
85 | char fill1[0x1ff10]; | ||
86 | /* superio registers */ | ||
87 | struct ioc3_sioregs sregs; | ||
88 | }; | ||
89 | |||
90 | /* These don't exist on the ioc3 serial card... */ | ||
91 | #define eier fill1[8] | ||
92 | #define eisr fill1[4] | ||
93 | |||
94 | #define PCI_LAT 0xc /* Latency Timer */ | ||
95 | #define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */ | ||
96 | #define UARTA_BASE 0x178 | ||
97 | #define UARTB_BASE 0x170 | ||
98 | |||
99 | |||
100 | /* bitmasks for serial RX status byte */ | ||
101 | #define RXSB_OVERRUN 0x01 /* char(s) lost */ | ||
102 | #define RXSB_PAR_ERR 0x02 /* parity error */ | ||
103 | #define RXSB_FRAME_ERR 0x04 /* framing error */ | ||
104 | #define RXSB_BREAK 0x08 /* break character */ | ||
105 | #define RXSB_CTS 0x10 /* state of CTS */ | ||
106 | #define RXSB_DCD 0x20 /* state of DCD */ | ||
107 | #define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */ | ||
108 | #define RXSB_DATA_VALID 0x80 /* FRAME_ERR PAR_ERR & BREAK valid */ | ||
109 | |||
110 | /* bitmasks for serial TX control byte */ | ||
111 | #define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */ | ||
112 | #define TXCB_INVALID 0x00 /* byte is invalid */ | ||
113 | #define TXCB_VALID 0x40 /* byte is valid */ | ||
114 | #define TXCB_MCR 0x80 /* data<7:0> to modem cntrl register */ | ||
115 | #define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */ | ||
116 | |||
117 | /* bitmasks for SBBR_L */ | ||
118 | #define SBBR_L_SIZE 0x00000001 /* 0 1KB rings, 1 4KB rings */ | ||
119 | |||
120 | /* bitmasks for SSCR_<A:B> */ | ||
121 | #define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */ | ||
122 | #define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */ | ||
123 | #define SSCR_HFC_EN 0x00020000 /* h/w flow cntrl enabled */ | ||
124 | #define SSCR_RX_RING_DCD 0x00040000 /* postRX record on delta-DCD */ | ||
125 | #define SSCR_RX_RING_CTS 0x00080000 /* postRX record on delta-CTS */ | ||
126 | #define SSCR_HIGH_SPD 0x00100000 /* 4X speed */ | ||
127 | #define SSCR_DIAG 0x00200000 /* bypass clock divider */ | ||
128 | #define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */ | ||
129 | #define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */ | ||
130 | #define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */ | ||
131 | #define SSCR_PAUSE_STATE 0x40000000 /* set when PAUSE takes effect*/ | ||
132 | #define SSCR_RESET 0x80000000 /* reset DMA channels */ | ||
133 | |||
134 | /* all producer/comsumer pointers are the same bitfield */ | ||
135 | #define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */ | ||
136 | #define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */ | ||
137 | #define PROD_CONS_PTR_OFF 3 | ||
138 | |||
139 | /* bitmasks for SRCIR_<A:B> */ | ||
140 | #define SRCIR_ARM 0x80000000 /* arm RX timer */ | ||
141 | |||
142 | /* bitmasks for SHADOW_<A:B> */ | ||
143 | #define SHADOW_DR 0x00000001 /* data ready */ | ||
144 | #define SHADOW_OE 0x00000002 /* overrun error */ | ||
145 | #define SHADOW_PE 0x00000004 /* parity error */ | ||
146 | #define SHADOW_FE 0x00000008 /* framing error */ | ||
147 | #define SHADOW_BI 0x00000010 /* break interrupt */ | ||
148 | #define SHADOW_THRE 0x00000020 /* transmit holding reg empty */ | ||
149 | #define SHADOW_TEMT 0x00000040 /* transmit shift reg empty */ | ||
150 | #define SHADOW_RFCE 0x00000080 /* char in RX fifo has error */ | ||
151 | #define SHADOW_DCTS 0x00010000 /* delta clear to send */ | ||
152 | #define SHADOW_DDCD 0x00080000 /* delta data carrier detect */ | ||
153 | #define SHADOW_CTS 0x00100000 /* clear to send */ | ||
154 | #define SHADOW_DCD 0x00800000 /* data carrier detect */ | ||
155 | #define SHADOW_DTR 0x01000000 /* data terminal ready */ | ||
156 | #define SHADOW_RTS 0x02000000 /* request to send */ | ||
157 | #define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */ | ||
158 | #define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */ | ||
159 | #define SHADOW_LOOP 0x10000000 /* loopback enabled */ | ||
160 | |||
161 | /* bitmasks for SRTR_<A:B> */ | ||
162 | #define SRTR_CNT 0x00000fff /* reload value for RX timer */ | ||
163 | #define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */ | ||
164 | #define SRTR_CNT_VAL_SHIFT 16 | ||
165 | #define SRTR_HZ 16000 /* SRTR clock frequency */ | ||
166 | |||
167 | /* bitmasks for SIO_IR, SIO_IEC and SIO_IES */ | ||
168 | #define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */ | ||
169 | #define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */ | ||
170 | #define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */ | ||
171 | #define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */ | ||
172 | #define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */ | ||
173 | #define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */ | ||
174 | #define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */ | ||
175 | #define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */ | ||
176 | #define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */ | ||
177 | #define SIO_IR_SB_TX_MT 0x00000200 | ||
178 | #define SIO_IR_SB_RX_FULL 0x00000400 | ||
179 | #define SIO_IR_SB_RX_HIGH 0x00000800 | ||
180 | #define SIO_IR_SB_RX_TIMER 0x00001000 | ||
181 | #define SIO_IR_SB_DELTA_DCD 0x00002000 | ||
182 | #define SIO_IR_SB_DELTA_CTS 0x00004000 | ||
183 | #define SIO_IR_SB_INT 0x00008000 | ||
184 | #define SIO_IR_SB_TX_EXPLICIT 0x00010000 | ||
185 | #define SIO_IR_SB_MEMERR 0x00020000 | ||
186 | #define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */ | ||
187 | #define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */ | ||
188 | #define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */ | ||
189 | #define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */ | ||
190 | #define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */ | ||
191 | #define SIO_IR_RT_INT 0x08000000 /* RT output pulse */ | ||
192 | #define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */ | ||
193 | #define SIO_IR_GEN_INT_SHIFT 28 | ||
194 | |||
195 | /* per device interrupt masks */ | ||
196 | #define SIO_IR_SA (SIO_IR_SA_TX_MT | \ | ||
197 | SIO_IR_SA_RX_FULL | \ | ||
198 | SIO_IR_SA_RX_HIGH | \ | ||
199 | SIO_IR_SA_RX_TIMER | \ | ||
200 | SIO_IR_SA_DELTA_DCD | \ | ||
201 | SIO_IR_SA_DELTA_CTS | \ | ||
202 | SIO_IR_SA_INT | \ | ||
203 | SIO_IR_SA_TX_EXPLICIT | \ | ||
204 | SIO_IR_SA_MEMERR) | ||
205 | |||
206 | #define SIO_IR_SB (SIO_IR_SB_TX_MT | \ | ||
207 | SIO_IR_SB_RX_FULL | \ | ||
208 | SIO_IR_SB_RX_HIGH | \ | ||
209 | SIO_IR_SB_RX_TIMER | \ | ||
210 | SIO_IR_SB_DELTA_DCD | \ | ||
211 | SIO_IR_SB_DELTA_CTS | \ | ||
212 | SIO_IR_SB_INT | \ | ||
213 | SIO_IR_SB_TX_EXPLICIT | \ | ||
214 | SIO_IR_SB_MEMERR) | ||
215 | |||
216 | #define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \ | ||
217 | SIO_IR_PP_INTB | SIO_IR_PP_MEMERR) | ||
218 | #define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1) | ||
219 | |||
220 | /* bitmasks for SIO_CR */ | ||
221 | #define SIO_CR_CMD_PULSE_SHIFT 15 | ||
222 | #define SIO_CR_SER_A_BASE_SHIFT 1 | ||
223 | #define SIO_CR_SER_B_BASE_SHIFT 8 | ||
224 | #define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */ | ||
225 | #define SIO_CR_ARB_DIAG_TXA 0x00000000 | ||
226 | #define SIO_CR_ARB_DIAG_RXA 0x00080000 | ||
227 | #define SIO_CR_ARB_DIAG_TXB 0x00100000 | ||
228 | #define SIO_CR_ARB_DIAG_RXB 0x00180000 | ||
229 | #define SIO_CR_ARB_DIAG_PP 0x00200000 | ||
230 | #define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */ | ||
231 | |||
232 | /* defs for some of the generic I/O pins */ | ||
233 | #define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */ | ||
234 | #define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */ | ||
235 | #define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */ | ||
236 | |||
237 | #define GPPR_PHY_RESET_PIN 5 /* GIO pin controlling phy reset */ | ||
238 | #define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin cntrling uartb modeselect */ | ||
239 | #define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin cntrling uarta modeselect */ | ||
240 | |||
241 | #endif /* IA64_SN_IOC3_H */ | ||
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h index fffdf690b840..640a6459f2f4 100644 --- a/include/asm-powerpc/kexec.h +++ b/include/asm-powerpc/kexec.h | |||
@@ -31,12 +31,80 @@ | |||
31 | #define KEXEC_ARCH KEXEC_ARCH_PPC | 31 | #define KEXEC_ARCH KEXEC_ARCH_PPC |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #define HAVE_ARCH_COPY_OLDMEM_PAGE | ||
35 | |||
36 | #ifndef __ASSEMBLY__ | ||
37 | |||
38 | #ifdef CONFIG_KEXEC | 34 | #ifdef CONFIG_KEXEC |
39 | 35 | ||
36 | #ifdef __powerpc64__ | ||
37 | /* | ||
38 | * This function is responsible for capturing register states if coming | ||
39 | * via panic or invoking dump using sysrq-trigger. | ||
40 | */ | ||
41 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
42 | struct pt_regs *oldregs) | ||
43 | { | ||
44 | if (oldregs) | ||
45 | memcpy(newregs, oldregs, sizeof(*newregs)); | ||
46 | else { | ||
47 | /* FIXME Merge this with xmon_save_regs ?? */ | ||
48 | unsigned long tmp1, tmp2; | ||
49 | __asm__ __volatile__ ( | ||
50 | "std 0,0(%2)\n" | ||
51 | "std 1,8(%2)\n" | ||
52 | "std 2,16(%2)\n" | ||
53 | "std 3,24(%2)\n" | ||
54 | "std 4,32(%2)\n" | ||
55 | "std 5,40(%2)\n" | ||
56 | "std 6,48(%2)\n" | ||
57 | "std 7,56(%2)\n" | ||
58 | "std 8,64(%2)\n" | ||
59 | "std 9,72(%2)\n" | ||
60 | "std 10,80(%2)\n" | ||
61 | "std 11,88(%2)\n" | ||
62 | "std 12,96(%2)\n" | ||
63 | "std 13,104(%2)\n" | ||
64 | "std 14,112(%2)\n" | ||
65 | "std 15,120(%2)\n" | ||
66 | "std 16,128(%2)\n" | ||
67 | "std 17,136(%2)\n" | ||
68 | "std 18,144(%2)\n" | ||
69 | "std 19,152(%2)\n" | ||
70 | "std 20,160(%2)\n" | ||
71 | "std 21,168(%2)\n" | ||
72 | "std 22,176(%2)\n" | ||
73 | "std 23,184(%2)\n" | ||
74 | "std 24,192(%2)\n" | ||
75 | "std 25,200(%2)\n" | ||
76 | "std 26,208(%2)\n" | ||
77 | "std 27,216(%2)\n" | ||
78 | "std 28,224(%2)\n" | ||
79 | "std 29,232(%2)\n" | ||
80 | "std 30,240(%2)\n" | ||
81 | "std 31,248(%2)\n" | ||
82 | "mfmsr %0\n" | ||
83 | "std %0, 264(%2)\n" | ||
84 | "mfctr %0\n" | ||
85 | "std %0, 280(%2)\n" | ||
86 | "mflr %0\n" | ||
87 | "std %0, 288(%2)\n" | ||
88 | "bl 1f\n" | ||
89 | "1: mflr %1\n" | ||
90 | "std %1, 256(%2)\n" | ||
91 | "mtlr %0\n" | ||
92 | "mfxer %0\n" | ||
93 | "std %0, 296(%2)\n" | ||
94 | : "=&r" (tmp1), "=&r" (tmp2) | ||
95 | : "b" (newregs)); | ||
96 | } | ||
97 | } | ||
98 | #else | ||
99 | /* | ||
100 | * Provide a dummy definition to avoid build failures. Will remain | ||
101 | * empty till crash dump support is enabled. | ||
102 | */ | ||
103 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
104 | struct pt_regs *oldregs) { } | ||
105 | #endif /* !__powerpc64 __ */ | ||
106 | |||
107 | #ifndef __ASSEMBLY__ | ||
40 | #define MAX_NOTE_BYTES 1024 | 108 | #define MAX_NOTE_BYTES 1024 |
41 | 109 | ||
42 | #ifdef __powerpc64__ | 110 | #ifdef __powerpc64__ |
@@ -53,14 +121,7 @@ extern void default_machine_kexec(struct kimage *image); | |||
53 | extern int default_machine_kexec_prepare(struct kimage *image); | 121 | extern int default_machine_kexec_prepare(struct kimage *image); |
54 | extern void default_machine_crash_shutdown(struct pt_regs *regs); | 122 | extern void default_machine_crash_shutdown(struct pt_regs *regs); |
55 | 123 | ||
56 | #endif /* !CONFIG_KEXEC */ | ||
57 | |||
58 | /* | ||
59 | * Provide a dummy definition to avoid build failures. Will remain | ||
60 | * empty till crash dump support is enabled. | ||
61 | */ | ||
62 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
63 | struct pt_regs *oldregs) { } | ||
64 | #endif /* ! __ASSEMBLY__ */ | 124 | #endif /* ! __ASSEMBLY__ */ |
125 | #endif /* CONFIG_KEXEC */ | ||
65 | #endif /* __KERNEL__ */ | 126 | #endif /* __KERNEL__ */ |
66 | #endif /* _ASM_POWERPC_KEXEC_H */ | 127 | #endif /* _ASM_POWERPC_KEXEC_H */ |
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h index eb317a0806e4..6d431d6fb022 100644 --- a/include/asm-ppc/prom.h +++ b/include/asm-ppc/prom.h | |||
@@ -167,6 +167,14 @@ extern int of_address_to_resource(struct device_node *dev, int index, | |||
167 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 167 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
168 | struct resource *r); | 168 | struct resource *r); |
169 | 169 | ||
170 | #ifndef CONFIG_PPC_OF | ||
171 | /* | ||
172 | * Fallback definitions for builds where we don't have prom.c included. | ||
173 | */ | ||
174 | #define machine_is_compatible(x) 0 | ||
175 | #define of_find_compatible_node(f, t, c) NULL | ||
176 | #define get_property(p, n, l) NULL | ||
177 | #endif | ||
170 | 178 | ||
171 | #endif /* _PPC_PROM_H */ | 179 | #endif /* _PPC_PROM_H */ |
172 | #endif /* __KERNEL__ */ | 180 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-s390/s390_rdev.h b/include/asm-s390/s390_rdev.h index 3ad78f2b9c48..6fa20442a48c 100644 --- a/include/asm-s390/s390_rdev.h +++ b/include/asm-s390/s390_rdev.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * include/asm-s390/ccwdev.h | 2 | * include/asm-s390/ccwdev.h |
3 | * | 3 | * |
4 | * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation | 4 | * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation |
5 | * Author(s): Cornelia Huck <cohuck@de.ibm.com> | 5 | * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> |
6 | * Carsten Otte <cotte@de.ibm.com> | 6 | * Carsten Otte <cotte@de.ibm.com> |
7 | * | 7 | * |
8 | * Interface for s390 root device | 8 | * Interface for s390 root device |
diff --git a/include/asm-s390/sigcontext.h b/include/asm-s390/sigcontext.h index 803545351dd8..aeb6e0b13329 100644 --- a/include/asm-s390/sigcontext.h +++ b/include/asm-s390/sigcontext.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #ifndef _ASM_S390_SIGCONTEXT_H | 8 | #ifndef _ASM_S390_SIGCONTEXT_H |
9 | #define _ASM_S390_SIGCONTEXT_H | 9 | #define _ASM_S390_SIGCONTEXT_H |
10 | 10 | ||
11 | #include <linux/compiler.h> | ||
12 | |||
11 | #define __NUM_GPRS 16 | 13 | #define __NUM_GPRS 16 |
12 | #define __NUM_FPRS 16 | 14 | #define __NUM_FPRS 16 |
13 | #define __NUM_ACRS 16 | 15 | #define __NUM_ACRS 16 |
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index c7c3a9ad593f..b2e65e8bf812 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -115,13 +115,14 @@ static inline void sched_cacheflush(void) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 117 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
118 | extern void account_user_vtime(struct task_struct *); | 118 | extern void account_vtime(struct task_struct *); |
119 | extern void account_tick_vtime(struct task_struct *); | ||
119 | extern void account_system_vtime(struct task_struct *); | 120 | extern void account_system_vtime(struct task_struct *); |
120 | #endif | 121 | #endif |
121 | 122 | ||
122 | #define finish_arch_switch(prev) do { \ | 123 | #define finish_arch_switch(prev) do { \ |
123 | set_fs(current->thread.mm_segment); \ | 124 | set_fs(current->thread.mm_segment); \ |
124 | account_system_vtime(prev); \ | 125 | account_vtime(prev); \ |
125 | } while (0) | 126 | } while (0) |
126 | 127 | ||
127 | #define nop() __asm__ __volatile__ ("nop") | 128 | #define nop() __asm__ __volatile__ ("nop") |
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h index a582cfcf2231..7b286bd21d1d 100644 --- a/include/asm-x86_64/fixmap.h +++ b/include/asm-x86_64/fixmap.h | |||
@@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist(void); | |||
76 | * directly without translation, we catch the bug with a NULL-deference | 76 | * directly without translation, we catch the bug with a NULL-deference |
77 | * kernel oops. Illegal ranges of incoming indices are caught too. | 77 | * kernel oops. Illegal ranges of incoming indices are caught too. |
78 | */ | 78 | */ |
79 | static inline unsigned long fix_to_virt(const unsigned int idx) | 79 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) |
80 | { | 80 | { |
81 | /* | 81 | /* |
82 | * this branch gets completely eliminated after inlining, | 82 | * this branch gets completely eliminated after inlining, |
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index 2892c4b7a28b..bddffcb591b8 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h | |||
@@ -244,7 +244,7 @@ extern unsigned long copy_to_user(void __user *to, const void *from, unsigned le | |||
244 | extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); | 244 | extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); |
245 | extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); | 245 | extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); |
246 | 246 | ||
247 | static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) | 247 | static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) |
248 | { | 248 | { |
249 | int ret = 0; | 249 | int ret = 0; |
250 | if (!__builtin_constant_p(size)) | 250 | if (!__builtin_constant_p(size)) |
@@ -273,7 +273,7 @@ static inline int __copy_from_user(void *dst, const void __user *src, unsigned s | |||
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) | 276 | static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) |
277 | { | 277 | { |
278 | int ret = 0; | 278 | int ret = 0; |
279 | if (!__builtin_constant_p(size)) | 279 | if (!__builtin_constant_p(size)) |
@@ -305,7 +305,7 @@ static inline int __copy_to_user(void __user *dst, const void *src, unsigned siz | |||
305 | } | 305 | } |
306 | 306 | ||
307 | 307 | ||
308 | static inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) | 308 | static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) |
309 | { | 309 | { |
310 | int ret = 0; | 310 | int ret = 0; |
311 | if (!__builtin_constant_p(size)) | 311 | if (!__builtin_constant_p(size)) |
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h index 4209082ee934..1698b845761f 100644 --- a/include/linux/compiler-gcc3.h +++ b/include/linux/compiler-gcc3.h | |||
@@ -13,3 +13,4 @@ | |||
13 | #define __must_check __attribute__((warn_unused_result)) | 13 | #define __must_check __attribute__((warn_unused_result)) |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #define __always_inline inline __attribute__((always_inline)) | ||
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index e913e9beaf69..6f5cc6f0e7a6 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -3,7 +3,16 @@ | |||
3 | /* These definitions are for GCC v4.x. */ | 3 | /* These definitions are for GCC v4.x. */ |
4 | #include <linux/compiler-gcc.h> | 4 | #include <linux/compiler-gcc.h> |
5 | 5 | ||
6 | #ifdef CONFIG_FORCED_INLINING | ||
7 | # undef inline | ||
8 | # undef __inline__ | ||
9 | # undef __inline | ||
10 | # define inline inline __attribute__((always_inline)) | ||
11 | # define __inline__ __inline__ __attribute__((always_inline)) | ||
12 | # define __inline __inline __attribute__((always_inline)) | ||
13 | #endif | ||
14 | |||
6 | #define __attribute_used__ __attribute__((__used__)) | 15 | #define __attribute_used__ __attribute__((__used__)) |
7 | #define __must_check __attribute__((warn_unused_result)) | 16 | #define __must_check __attribute__((warn_unused_result)) |
8 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) | 17 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) |
9 | 18 | #define __always_inline inline __attribute__((always_inline)) | |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index c472f972bd6d..3bc606927116 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -48,6 +48,9 @@ extern void __cpuset_memory_pressure_bump(void); | |||
48 | extern struct file_operations proc_cpuset_operations; | 48 | extern struct file_operations proc_cpuset_operations; |
49 | extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); | 49 | extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); |
50 | 50 | ||
51 | extern void cpuset_lock(void); | ||
52 | extern void cpuset_unlock(void); | ||
53 | |||
51 | #else /* !CONFIG_CPUSETS */ | 54 | #else /* !CONFIG_CPUSETS */ |
52 | 55 | ||
53 | static inline int cpuset_init_early(void) { return 0; } | 56 | static inline int cpuset_init_early(void) { return 0; } |
@@ -93,6 +96,9 @@ static inline char *cpuset_task_status_allowed(struct task_struct *task, | |||
93 | return buffer; | 96 | return buffer; |
94 | } | 97 | } |
95 | 98 | ||
99 | static inline void cpuset_lock(void) {} | ||
100 | static inline void cpuset_unlock(void) {} | ||
101 | |||
96 | #endif /* !CONFIG_CPUSETS */ | 102 | #endif /* !CONFIG_CPUSETS */ |
97 | 103 | ||
98 | #endif /* _LINUX_CPUSET_H */ | 104 | #endif /* _LINUX_CPUSET_H */ |
diff --git a/include/linux/fb.h b/include/linux/fb.h index a973be2cfe61..2cb19e6503aa 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -608,15 +608,15 @@ struct fb_ops { | |||
608 | int (*fb_sync)(struct fb_info *info); | 608 | int (*fb_sync)(struct fb_info *info); |
609 | 609 | ||
610 | /* perform fb specific ioctl (optional) */ | 610 | /* perform fb specific ioctl (optional) */ |
611 | int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd, | 611 | int (*fb_ioctl)(struct fb_info *info, unsigned int cmd, |
612 | unsigned long arg, struct fb_info *info); | 612 | unsigned long arg); |
613 | 613 | ||
614 | /* Handle 32bit compat ioctl (optional) */ | 614 | /* Handle 32bit compat ioctl (optional) */ |
615 | long (*fb_compat_ioctl)(struct file *f, unsigned cmd, unsigned long arg, | 615 | int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd, |
616 | struct fb_info *info); | 616 | unsigned long arg); |
617 | 617 | ||
618 | /* perform fb specific mmap */ | 618 | /* perform fb specific mmap */ |
619 | int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); | 619 | int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma); |
620 | 620 | ||
621 | /* save current hardware state */ | 621 | /* save current hardware state */ |
622 | void (*fb_save_state)(struct fb_info *info); | 622 | void (*fb_save_state)(struct fb_info *info); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index d1e370d25f7b..552cedfa6064 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1383,6 +1383,12 @@ extern int register_chrdev(unsigned int, const char *, | |||
1383 | extern int unregister_chrdev(unsigned int, const char *); | 1383 | extern int unregister_chrdev(unsigned int, const char *); |
1384 | extern void unregister_chrdev_region(dev_t, unsigned); | 1384 | extern void unregister_chrdev_region(dev_t, unsigned); |
1385 | extern int chrdev_open(struct inode *, struct file *); | 1385 | extern int chrdev_open(struct inode *, struct file *); |
1386 | extern int get_chrdev_list(char *); | ||
1387 | extern void *acquire_chrdev_list(void); | ||
1388 | extern int count_chrdev_list(void); | ||
1389 | extern void *get_next_chrdev(void *); | ||
1390 | extern int get_chrdev_info(void *, int *, char **); | ||
1391 | extern void release_chrdev_list(void *); | ||
1386 | 1392 | ||
1387 | /* fs/block_dev.c */ | 1393 | /* fs/block_dev.c */ |
1388 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 1394 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
@@ -1391,6 +1397,11 @@ extern const char *bdevname(struct block_device *bdev, char *buffer); | |||
1391 | extern struct block_device *lookup_bdev(const char *); | 1397 | extern struct block_device *lookup_bdev(const char *); |
1392 | extern struct block_device *open_bdev_excl(const char *, int, void *); | 1398 | extern struct block_device *open_bdev_excl(const char *, int, void *); |
1393 | extern void close_bdev_excl(struct block_device *); | 1399 | extern void close_bdev_excl(struct block_device *); |
1400 | extern void *acquire_blkdev_list(void); | ||
1401 | extern int count_blkdev_list(void); | ||
1402 | extern void *get_next_blkdev(void *); | ||
1403 | extern int get_blkdev_info(void *, int *, char **); | ||
1404 | extern void release_blkdev_list(void *); | ||
1394 | 1405 | ||
1395 | extern void init_special_inode(struct inode *, umode_t, dev_t); | 1406 | extern void init_special_inode(struct inode *, umode_t, dev_t); |
1396 | 1407 | ||
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 71d2b8a723b9..eab537091f2a 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -93,10 +93,6 @@ extern void synchronize_irq(unsigned int irq); | |||
93 | struct task_struct; | 93 | struct task_struct; |
94 | 94 | ||
95 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 95 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
96 | static inline void account_user_vtime(struct task_struct *tsk) | ||
97 | { | ||
98 | } | ||
99 | |||
100 | static inline void account_system_vtime(struct task_struct *tsk) | 96 | static inline void account_system_vtime(struct task_struct *tsk) |
101 | { | 97 | { |
102 | } | 98 | } |
diff --git a/include/linux/ioc3.h b/include/linux/ioc3.h new file mode 100644 index 000000000000..e7906a72a4f1 --- /dev/null +++ b/include/linux/ioc3.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org> | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_IOC3_H | ||
10 | #define _LINUX_IOC3_H | ||
11 | |||
12 | #include <asm/sn/ioc3.h> | ||
13 | |||
14 | #define IOC3_MAX_SUBMODULES 32 | ||
15 | |||
16 | #define IOC3_CLASS_NONE 0 | ||
17 | #define IOC3_CLASS_BASE_IP27 1 | ||
18 | #define IOC3_CLASS_BASE_IP30 2 | ||
19 | #define IOC3_CLASS_MENET_123 3 | ||
20 | #define IOC3_CLASS_MENET_4 4 | ||
21 | #define IOC3_CLASS_CADDUO 5 | ||
22 | #define IOC3_CLASS_SERIAL 6 | ||
23 | |||
24 | /* One of these per IOC3 */ | ||
25 | struct ioc3_driver_data { | ||
26 | struct list_head list; | ||
27 | int id; /* IOC3 sequence number */ | ||
28 | /* PCI mapping */ | ||
29 | unsigned long pma; /* physical address */ | ||
30 | struct __iomem ioc3 *vma; /* pointer to registers */ | ||
31 | struct pci_dev *pdev; /* PCI device */ | ||
32 | /* IRQ stuff */ | ||
33 | int dual_irq; /* set if separate IRQs are used */ | ||
34 | int irq_io, irq_eth; /* IRQ numbers */ | ||
35 | /* GPIO magic */ | ||
36 | spinlock_t gpio_lock; | ||
37 | unsigned int gpdr_shadow; | ||
38 | /* NIC identifiers */ | ||
39 | char nic_part[32]; | ||
40 | char nic_serial[16]; | ||
41 | char nic_mac[6]; | ||
42 | /* submodule set */ | ||
43 | int class; | ||
44 | void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */ | ||
45 | int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */ | ||
46 | /* is_ir_lock must be held while | ||
47 | * modifying sio_ie values, so | ||
48 | * we can be sure that sio_ie is | ||
49 | * not changing when we read it | ||
50 | * along with sio_ir. | ||
51 | */ | ||
52 | spinlock_t ir_lock; /* SIO_IE[SC] mod lock */ | ||
53 | }; | ||
54 | |||
55 | /* One per submodule */ | ||
56 | struct ioc3_submodule { | ||
57 | char *name; /* descriptive submodule name */ | ||
58 | struct module *owner; /* owning kernel module */ | ||
59 | int ethernet; /* set for ethernet drivers */ | ||
60 | int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *); | ||
61 | int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *); | ||
62 | int id; /* assigned by IOC3, index for the "data" array */ | ||
63 | /* IRQ stuff */ | ||
64 | unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */ | ||
65 | int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */ | ||
66 | int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int, struct pt_regs *); | ||
67 | /* private submodule data */ | ||
68 | void *data; /* assigned by submodule */ | ||
69 | }; | ||
70 | |||
71 | /********************************** | ||
72 | * Functions needed by submodules * | ||
73 | **********************************/ | ||
74 | |||
75 | #define IOC3_W_IES 0 | ||
76 | #define IOC3_W_IEC 1 | ||
77 | |||
78 | /* registers a submodule for all existing and future IOC3 chips */ | ||
79 | extern int ioc3_register_submodule(struct ioc3_submodule *); | ||
80 | /* unregisters a submodule */ | ||
81 | extern void ioc3_unregister_submodule(struct ioc3_submodule *); | ||
82 | /* enables IRQs indicated by irq_mask for a specified IOC3 chip */ | ||
83 | extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | ||
84 | /* ackowledges specified IRQs */ | ||
85 | extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | ||
86 | /* disables IRQs indicated by irq_mask for a specified IOC3 chip */ | ||
87 | extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | ||
88 | /* atomically sets GPCR bits */ | ||
89 | extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int); | ||
90 | /* general ireg writer */ | ||
91 | extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg); | ||
92 | |||
93 | #endif | ||
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index c7ac77e873b3..d6a53ed6ab6c 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -132,12 +132,8 @@ struct shared_policy { | |||
132 | spinlock_t lock; | 132 | spinlock_t lock; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static inline void mpol_shared_policy_init(struct shared_policy *info) | 135 | void mpol_shared_policy_init(struct shared_policy *info, int policy, |
136 | { | 136 | nodemask_t *nodes); |
137 | info->root = RB_ROOT; | ||
138 | spin_lock_init(&info->lock); | ||
139 | } | ||
140 | |||
141 | int mpol_set_shared_policy(struct shared_policy *info, | 137 | int mpol_set_shared_policy(struct shared_policy *info, |
142 | struct vm_area_struct *vma, | 138 | struct vm_area_struct *vma, |
143 | struct mempolicy *new); | 139 | struct mempolicy *new); |
@@ -211,7 +207,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info, | |||
211 | return -EINVAL; | 207 | return -EINVAL; |
212 | } | 208 | } |
213 | 209 | ||
214 | static inline void mpol_shared_policy_init(struct shared_policy *info) | 210 | static inline void mpol_shared_policy_init(struct shared_policy *info, |
211 | int policy, nodemask_t *nodes) | ||
215 | { | 212 | { |
216 | } | 213 | } |
217 | 214 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index c643016499a1..85854b867463 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -512,7 +512,7 @@ static inline void set_page_links(struct page *page, unsigned long zone, | |||
512 | extern struct page *mem_map; | 512 | extern struct page *mem_map; |
513 | #endif | 513 | #endif |
514 | 514 | ||
515 | static inline void *lowmem_page_address(struct page *page) | 515 | static __always_inline void *lowmem_page_address(struct page *page) |
516 | { | 516 | { |
517 | return __va(page_to_pfn(page) << PAGE_SHIFT); | 517 | return __va(page_to_pfn(page) << PAGE_SHIFT); |
518 | } | 518 | } |
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 7297e4372c0f..e01342568530 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h | |||
@@ -201,34 +201,6 @@ static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode) | |||
201 | return container_of(inode, struct ncp_inode_info, vfs_inode); | 201 | return container_of(inode, struct ncp_inode_info, vfs_inode); |
202 | } | 202 | } |
203 | 203 | ||
204 | #ifdef DEBUG_NCP_MALLOC | ||
205 | |||
206 | #include <linux/slab.h> | ||
207 | |||
208 | extern int ncp_malloced; | ||
209 | extern int ncp_current_malloced; | ||
210 | |||
211 | static inline void * | ||
212 | ncp_kmalloc(unsigned int size, int priority) | ||
213 | { | ||
214 | ncp_malloced += 1; | ||
215 | ncp_current_malloced += 1; | ||
216 | return kmalloc(size, priority); | ||
217 | } | ||
218 | |||
219 | static inline void ncp_kfree_s(void *obj, int size) | ||
220 | { | ||
221 | ncp_current_malloced -= 1; | ||
222 | kfree(obj); | ||
223 | } | ||
224 | |||
225 | #else /* DEBUG_NCP_MALLOC */ | ||
226 | |||
227 | #define ncp_kmalloc(s,p) kmalloc(s,p) | ||
228 | #define ncp_kfree_s(o,s) kfree(o) | ||
229 | |||
230 | #endif /* DEBUG_NCP_MALLOC */ | ||
231 | |||
232 | /* linux/fs/ncpfs/inode.c */ | 204 | /* linux/fs/ncpfs/inode.c */ |
233 | int ncp_notify_change(struct dentry *, struct iattr *); | 205 | int ncp_notify_change(struct dentry *, struct iattr *); |
234 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); | 206 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index a72e17135421..2df1a1a2fee5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -160,6 +160,7 @@ extern unsigned long nr_iowait(void); | |||
160 | #define SCHED_NORMAL 0 | 160 | #define SCHED_NORMAL 0 |
161 | #define SCHED_FIFO 1 | 161 | #define SCHED_FIFO 1 |
162 | #define SCHED_RR 2 | 162 | #define SCHED_RR 2 |
163 | #define SCHED_BATCH 3 | ||
163 | 164 | ||
164 | struct sched_param { | 165 | struct sched_param { |
165 | int sched_priority; | 166 | int sched_priority; |
@@ -470,9 +471,9 @@ struct signal_struct { | |||
470 | 471 | ||
471 | /* | 472 | /* |
472 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT | 473 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT |
473 | * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are | 474 | * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH |
474 | * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values | 475 | * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority |
475 | * are inverted: lower p->prio value means higher priority. | 476 | * values are inverted: lower p->prio value means higher priority. |
476 | * | 477 | * |
477 | * The MAX_USER_RT_PRIO value allows the actual maximum | 478 | * The MAX_USER_RT_PRIO value allows the actual maximum |
478 | * RT priority to be separate from the value exported to | 479 | * RT priority to be separate from the value exported to |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a8187c3c8a7b..ec351005bf9d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -136,6 +136,7 @@ | |||
136 | #include <linux/spinlock.h> | 136 | #include <linux/spinlock.h> |
137 | #include <linux/sched.h> | 137 | #include <linux/sched.h> |
138 | #include <linux/tty.h> | 138 | #include <linux/tty.h> |
139 | #include <linux/mutex.h> | ||
139 | 140 | ||
140 | struct uart_port; | 141 | struct uart_port; |
141 | struct uart_info; | 142 | struct uart_info; |
@@ -284,7 +285,7 @@ struct uart_state { | |||
284 | struct uart_info *info; | 285 | struct uart_info *info; |
285 | struct uart_port *port; | 286 | struct uart_port *port; |
286 | 287 | ||
287 | struct semaphore sem; | 288 | struct mutex mutex; |
288 | }; | 289 | }; |
289 | 290 | ||
290 | #define UART_XMIT_SIZE PAGE_SIZE | 291 | #define UART_XMIT_SIZE PAGE_SIZE |
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index c3e598276e78..c057f0b32318 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -26,6 +26,8 @@ struct shmem_sb_info { | |||
26 | unsigned long free_blocks; /* How many are left for allocation */ | 26 | unsigned long free_blocks; /* How many are left for allocation */ |
27 | unsigned long max_inodes; /* How many inodes are allowed */ | 27 | unsigned long max_inodes; /* How many inodes are allowed */ |
28 | unsigned long free_inodes; /* How many are left for allocation */ | 28 | unsigned long free_inodes; /* How many are left for allocation */ |
29 | int policy; /* Default NUMA memory alloc policy */ | ||
30 | nodemask_t policy_nodes; /* nodemask for preferred and bind */ | ||
29 | spinlock_t stat_lock; | 31 | spinlock_t stat_lock; |
30 | }; | 32 | }; |
31 | 33 | ||
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index c4153120ade6..621a3d3662f3 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h | |||
@@ -58,53 +58,6 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode) | |||
58 | /* where to find the base of the SMB packet proper */ | 58 | /* where to find the base of the SMB packet proper */ |
59 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) | 59 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) |
60 | 60 | ||
61 | #ifdef DEBUG_SMB_MALLOC | ||
62 | |||
63 | #include <linux/slab.h> | ||
64 | |||
65 | extern int smb_malloced; | ||
66 | extern int smb_current_vmalloced; | ||
67 | extern int smb_current_kmalloced; | ||
68 | |||
69 | static inline void * | ||
70 | smb_vmalloc(unsigned int size) | ||
71 | { | ||
72 | smb_malloced += 1; | ||
73 | smb_current_vmalloced += 1; | ||
74 | return vmalloc(size); | ||
75 | } | ||
76 | |||
77 | static inline void | ||
78 | smb_vfree(void *obj) | ||
79 | { | ||
80 | smb_current_vmalloced -= 1; | ||
81 | vfree(obj); | ||
82 | } | ||
83 | |||
84 | static inline void * | ||
85 | smb_kmalloc(size_t size, int flags) | ||
86 | { | ||
87 | smb_malloced += 1; | ||
88 | smb_current_kmalloced += 1; | ||
89 | return kmalloc(size, flags); | ||
90 | } | ||
91 | |||
92 | static inline void | ||
93 | smb_kfree(void *obj) | ||
94 | { | ||
95 | smb_current_kmalloced -= 1; | ||
96 | kfree(obj); | ||
97 | } | ||
98 | |||
99 | #else /* DEBUG_SMB_MALLOC */ | ||
100 | |||
101 | #define smb_kmalloc(s,p) kmalloc(s,p) | ||
102 | #define smb_kfree(o) kfree(o) | ||
103 | #define smb_vmalloc(s) vmalloc(s) | ||
104 | #define smb_vfree(o) vfree(o) | ||
105 | |||
106 | #endif /* DEBUG_SMB_MALLOC */ | ||
107 | |||
108 | /* | 61 | /* |
109 | * Flags for the in-memory inode | 62 | * Flags for the in-memory inode |
110 | */ | 63 | */ |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 389d1c382e20..e92054d6530b 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -180,6 +180,11 @@ extern int isolate_lru_page(struct page *p); | |||
180 | extern int putback_lru_pages(struct list_head *l); | 180 | extern int putback_lru_pages(struct list_head *l); |
181 | extern int migrate_pages(struct list_head *l, struct list_head *t, | 181 | extern int migrate_pages(struct list_head *l, struct list_head *t, |
182 | struct list_head *moved, struct list_head *failed); | 182 | struct list_head *moved, struct list_head *failed); |
183 | #else | ||
184 | static inline int isolate_lru_page(struct page *p) { return -ENOSYS; } | ||
185 | static inline int putback_lru_pages(struct list_head *l) { return 0; } | ||
186 | static inline int migrate_pages(struct list_head *l, struct list_head *t, | ||
187 | struct list_head *moved, struct list_head *failed) { return -ENOSYS; } | ||
183 | #endif | 188 | #endif |
184 | 189 | ||
185 | #ifdef CONFIG_MMU | 190 | #ifdef CONFIG_MMU |
diff --git a/init/main.c b/init/main.c index e092b1979a90..7c79da57d3a2 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -54,20 +54,18 @@ | |||
54 | #include <asm/sections.h> | 54 | #include <asm/sections.h> |
55 | #include <asm/cacheflush.h> | 55 | #include <asm/cacheflush.h> |
56 | 56 | ||
57 | /* | ||
58 | * This is one of the first .c files built. Error out early | ||
59 | * if we have compiler trouble.. | ||
60 | */ | ||
61 | |||
62 | #ifdef CONFIG_X86_LOCAL_APIC | 57 | #ifdef CONFIG_X86_LOCAL_APIC |
63 | #include <asm/smp.h> | 58 | #include <asm/smp.h> |
64 | #endif | 59 | #endif |
65 | 60 | ||
66 | /* | 61 | /* |
67 | * Versions of gcc older than that listed below may actually compile | 62 | * This is one of the first .c files built. Error out early if we have compiler |
68 | * and link okay, but the end product can have subtle run time bugs. | 63 | * trouble. |
69 | * To avoid associated bogus bug reports, we flatly refuse to compile | 64 | * |
70 | * with a gcc that is known to be too old from the very beginning. | 65 | * Versions of gcc older than that listed below may actually compile and link |
66 | * okay, but the end product can have subtle run time bugs. To avoid associated | ||
67 | * bogus bug reports, we flatly refuse to compile with a gcc that is known to be | ||
68 | * too old from the very beginning. | ||
71 | */ | 69 | */ |
72 | #if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2) | 70 | #if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2) |
73 | #error Sorry, your GCC is too old. It builds incorrect kernels. | 71 | #error Sorry, your GCC is too old. It builds incorrect kernels. |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 2a75e44e1a41..fe2f71f92ae0 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1554,7 +1554,7 @@ struct ctr_struct { | |||
1554 | * when reading out p->cpuset, as we don't really care if it changes | 1554 | * when reading out p->cpuset, as we don't really care if it changes |
1555 | * on the next cycle, and we are not going to try to dereference it. | 1555 | * on the next cycle, and we are not going to try to dereference it. |
1556 | */ | 1556 | */ |
1557 | static inline int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs) | 1557 | static int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs) |
1558 | { | 1558 | { |
1559 | int n = 0; | 1559 | int n = 0; |
1560 | struct task_struct *g, *p; | 1560 | struct task_struct *g, *p; |
@@ -2150,6 +2150,33 @@ int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) | |||
2150 | } | 2150 | } |
2151 | 2151 | ||
2152 | /** | 2152 | /** |
2153 | * cpuset_lock - lock out any changes to cpuset structures | ||
2154 | * | ||
2155 | * The out of memory (oom) code needs to lock down cpusets | ||
2156 | * from being changed while it scans the tasklist looking for a | ||
2157 | * task in an overlapping cpuset. Expose callback_sem via this | ||
2158 | * cpuset_lock() routine, so the oom code can lock it, before | ||
2159 | * locking the task list. The tasklist_lock is a spinlock, so | ||
2160 | * must be taken inside callback_sem. | ||
2161 | */ | ||
2162 | |||
2163 | void cpuset_lock(void) | ||
2164 | { | ||
2165 | down(&callback_sem); | ||
2166 | } | ||
2167 | |||
2168 | /** | ||
2169 | * cpuset_unlock - release lock on cpuset changes | ||
2170 | * | ||
2171 | * Undo the lock taken in a previous cpuset_lock() call. | ||
2172 | */ | ||
2173 | |||
2174 | void cpuset_unlock(void) | ||
2175 | { | ||
2176 | up(&callback_sem); | ||
2177 | } | ||
2178 | |||
2179 | /** | ||
2153 | * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors? | 2180 | * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors? |
2154 | * @p: pointer to task_struct of some other task. | 2181 | * @p: pointer to task_struct of some other task. |
2155 | * | 2182 | * |
@@ -2158,7 +2185,7 @@ int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) | |||
2158 | * determine if task @p's memory usage might impact the memory | 2185 | * determine if task @p's memory usage might impact the memory |
2159 | * available to the current task. | 2186 | * available to the current task. |
2160 | * | 2187 | * |
2161 | * Acquires callback_sem - not suitable for calling from a fast path. | 2188 | * Call while holding callback_sem. |
2162 | **/ | 2189 | **/ |
2163 | 2190 | ||
2164 | int cpuset_excl_nodes_overlap(const struct task_struct *p) | 2191 | int cpuset_excl_nodes_overlap(const struct task_struct *p) |
@@ -2166,8 +2193,6 @@ int cpuset_excl_nodes_overlap(const struct task_struct *p) | |||
2166 | const struct cpuset *cs1, *cs2; /* my and p's cpuset ancestors */ | 2193 | const struct cpuset *cs1, *cs2; /* my and p's cpuset ancestors */ |
2167 | int overlap = 0; /* do cpusets overlap? */ | 2194 | int overlap = 0; /* do cpusets overlap? */ |
2168 | 2195 | ||
2169 | down(&callback_sem); | ||
2170 | |||
2171 | task_lock(current); | 2196 | task_lock(current); |
2172 | if (current->flags & PF_EXITING) { | 2197 | if (current->flags & PF_EXITING) { |
2173 | task_unlock(current); | 2198 | task_unlock(current); |
@@ -2186,8 +2211,6 @@ int cpuset_excl_nodes_overlap(const struct task_struct *p) | |||
2186 | 2211 | ||
2187 | overlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed); | 2212 | overlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed); |
2188 | done: | 2213 | done: |
2189 | up(&callback_sem); | ||
2190 | |||
2191 | return overlap; | 2214 | return overlap; |
2192 | } | 2215 | } |
2193 | 2216 | ||
diff --git a/kernel/exit.c b/kernel/exit.c index f8e609ff1893..93cee3671332 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -193,7 +193,7 @@ int is_orphaned_pgrp(int pgrp) | |||
193 | return retval; | 193 | return retval; |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline int has_stopped_jobs(int pgrp) | 196 | static int has_stopped_jobs(int pgrp) |
197 | { | 197 | { |
198 | int retval = 0; | 198 | int retval = 0; |
199 | struct task_struct *p; | 199 | struct task_struct *p; |
@@ -230,7 +230,7 @@ static inline int has_stopped_jobs(int pgrp) | |||
230 | * | 230 | * |
231 | * NOTE that reparent_to_init() gives the caller full capabilities. | 231 | * NOTE that reparent_to_init() gives the caller full capabilities. |
232 | */ | 232 | */ |
233 | static inline void reparent_to_init(void) | 233 | static void reparent_to_init(void) |
234 | { | 234 | { |
235 | write_lock_irq(&tasklist_lock); | 235 | write_lock_irq(&tasklist_lock); |
236 | 236 | ||
@@ -244,7 +244,9 @@ static inline void reparent_to_init(void) | |||
244 | /* Set the exit signal to SIGCHLD so we signal init on exit */ | 244 | /* Set the exit signal to SIGCHLD so we signal init on exit */ |
245 | current->exit_signal = SIGCHLD; | 245 | current->exit_signal = SIGCHLD; |
246 | 246 | ||
247 | if ((current->policy == SCHED_NORMAL) && (task_nice(current) < 0)) | 247 | if ((current->policy == SCHED_NORMAL || |
248 | current->policy == SCHED_BATCH) | ||
249 | && (task_nice(current) < 0)) | ||
248 | set_user_nice(current, 0); | 250 | set_user_nice(current, 0); |
249 | /* cpus_allowed? */ | 251 | /* cpus_allowed? */ |
250 | /* rt_priority? */ | 252 | /* rt_priority? */ |
@@ -367,7 +369,7 @@ void daemonize(const char *name, ...) | |||
367 | 369 | ||
368 | EXPORT_SYMBOL(daemonize); | 370 | EXPORT_SYMBOL(daemonize); |
369 | 371 | ||
370 | static inline void close_files(struct files_struct * files) | 372 | static void close_files(struct files_struct * files) |
371 | { | 373 | { |
372 | int i, j; | 374 | int i, j; |
373 | struct fdtable *fdt; | 375 | struct fdtable *fdt; |
@@ -541,7 +543,7 @@ static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_re | |||
541 | p->real_parent = reaper; | 543 | p->real_parent = reaper; |
542 | } | 544 | } |
543 | 545 | ||
544 | static inline void reparent_thread(task_t *p, task_t *father, int traced) | 546 | static void reparent_thread(task_t *p, task_t *father, int traced) |
545 | { | 547 | { |
546 | /* We don't want people slaying init. */ | 548 | /* We don't want people slaying init. */ |
547 | if (p->exit_signal != -1) | 549 | if (p->exit_signal != -1) |
@@ -605,7 +607,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced) | |||
605 | * group, and if no such member exists, give it to | 607 | * group, and if no such member exists, give it to |
606 | * the global child reaper process (ie "init") | 608 | * the global child reaper process (ie "init") |
607 | */ | 609 | */ |
608 | static inline void forget_original_parent(struct task_struct * father, | 610 | static void forget_original_parent(struct task_struct * father, |
609 | struct list_head *to_release) | 611 | struct list_head *to_release) |
610 | { | 612 | { |
611 | struct task_struct *p, *reaper = father; | 613 | struct task_struct *p, *reaper = father; |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 9e66e614862a..197208b3aa2a 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -192,7 +192,7 @@ static inline int common_clock_set(const clockid_t which_clock, | |||
192 | return do_sys_settimeofday(tp, NULL); | 192 | return do_sys_settimeofday(tp, NULL); |
193 | } | 193 | } |
194 | 194 | ||
195 | static inline int common_timer_create(struct k_itimer *new_timer) | 195 | static int common_timer_create(struct k_itimer *new_timer) |
196 | { | 196 | { |
197 | hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock); | 197 | hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock); |
198 | new_timer->it.real.timer.data = new_timer; | 198 | new_timer->it.real.timer.data = new_timer; |
@@ -361,7 +361,7 @@ static int posix_timer_fn(void *data) | |||
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||
364 | static inline struct task_struct * good_sigevent(sigevent_t * event) | 364 | static struct task_struct * good_sigevent(sigevent_t * event) |
365 | { | 365 | { |
366 | struct task_struct *rtn = current->group_leader; | 366 | struct task_struct *rtn = current->group_leader; |
367 | 367 | ||
@@ -687,7 +687,7 @@ sys_timer_getoverrun(timer_t timer_id) | |||
687 | 687 | ||
688 | /* Set a POSIX.1b interval timer. */ | 688 | /* Set a POSIX.1b interval timer. */ |
689 | /* timr->it_lock is taken. */ | 689 | /* timr->it_lock is taken. */ |
690 | static inline int | 690 | static int |
691 | common_timer_set(struct k_itimer *timr, int flags, | 691 | common_timer_set(struct k_itimer *timr, int flags, |
692 | struct itimerspec *new_setting, struct itimerspec *old_setting) | 692 | struct itimerspec *new_setting, struct itimerspec *old_setting) |
693 | { | 693 | { |
@@ -829,7 +829,7 @@ retry_delete: | |||
829 | /* | 829 | /* |
830 | * return timer owned by the process, used by exit_itimers | 830 | * return timer owned by the process, used by exit_itimers |
831 | */ | 831 | */ |
832 | static inline void itimer_delete(struct k_itimer *timer) | 832 | static void itimer_delete(struct k_itimer *timer) |
833 | { | 833 | { |
834 | unsigned long flags; | 834 | unsigned long flags; |
835 | 835 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index c9dec2aa1976..788ecce1e0e4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -521,7 +521,7 @@ static inline void sched_info_dequeued(task_t *t) | |||
521 | * long it was waiting to run. We also note when it began so that we | 521 | * long it was waiting to run. We also note when it began so that we |
522 | * can keep stats on how long its timeslice is. | 522 | * can keep stats on how long its timeslice is. |
523 | */ | 523 | */ |
524 | static inline void sched_info_arrive(task_t *t) | 524 | static void sched_info_arrive(task_t *t) |
525 | { | 525 | { |
526 | unsigned long now = jiffies, diff = 0; | 526 | unsigned long now = jiffies, diff = 0; |
527 | struct runqueue *rq = task_rq(t); | 527 | struct runqueue *rq = task_rq(t); |
@@ -748,10 +748,14 @@ static int recalc_task_prio(task_t *p, unsigned long long now) | |||
748 | unsigned long long __sleep_time = now - p->timestamp; | 748 | unsigned long long __sleep_time = now - p->timestamp; |
749 | unsigned long sleep_time; | 749 | unsigned long sleep_time; |
750 | 750 | ||
751 | if (__sleep_time > NS_MAX_SLEEP_AVG) | 751 | if (unlikely(p->policy == SCHED_BATCH)) |
752 | sleep_time = NS_MAX_SLEEP_AVG; | 752 | sleep_time = 0; |
753 | else | 753 | else { |
754 | sleep_time = (unsigned long)__sleep_time; | 754 | if (__sleep_time > NS_MAX_SLEEP_AVG) |
755 | sleep_time = NS_MAX_SLEEP_AVG; | ||
756 | else | ||
757 | sleep_time = (unsigned long)__sleep_time; | ||
758 | } | ||
755 | 759 | ||
756 | if (likely(sleep_time > 0)) { | 760 | if (likely(sleep_time > 0)) { |
757 | /* | 761 | /* |
@@ -1003,7 +1007,7 @@ void kick_process(task_t *p) | |||
1003 | * We want to under-estimate the load of migration sources, to | 1007 | * We want to under-estimate the load of migration sources, to |
1004 | * balance conservatively. | 1008 | * balance conservatively. |
1005 | */ | 1009 | */ |
1006 | static inline unsigned long __source_load(int cpu, int type, enum idle_type idle) | 1010 | static unsigned long __source_load(int cpu, int type, enum idle_type idle) |
1007 | { | 1011 | { |
1008 | runqueue_t *rq = cpu_rq(cpu); | 1012 | runqueue_t *rq = cpu_rq(cpu); |
1009 | unsigned long running = rq->nr_running; | 1013 | unsigned long running = rq->nr_running; |
@@ -1866,7 +1870,7 @@ void sched_exec(void) | |||
1866 | * pull_task - move a task from a remote runqueue to the local runqueue. | 1870 | * pull_task - move a task from a remote runqueue to the local runqueue. |
1867 | * Both runqueues must be locked. | 1871 | * Both runqueues must be locked. |
1868 | */ | 1872 | */ |
1869 | static inline | 1873 | static |
1870 | void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p, | 1874 | void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p, |
1871 | runqueue_t *this_rq, prio_array_t *this_array, int this_cpu) | 1875 | runqueue_t *this_rq, prio_array_t *this_array, int this_cpu) |
1872 | { | 1876 | { |
@@ -1888,7 +1892,7 @@ void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p, | |||
1888 | /* | 1892 | /* |
1889 | * can_migrate_task - may task p from runqueue rq be migrated to this_cpu? | 1893 | * can_migrate_task - may task p from runqueue rq be migrated to this_cpu? |
1890 | */ | 1894 | */ |
1891 | static inline | 1895 | static |
1892 | int can_migrate_task(task_t *p, runqueue_t *rq, int this_cpu, | 1896 | int can_migrate_task(task_t *p, runqueue_t *rq, int this_cpu, |
1893 | struct sched_domain *sd, enum idle_type idle, | 1897 | struct sched_domain *sd, enum idle_type idle, |
1894 | int *all_pinned) | 1898 | int *all_pinned) |
@@ -2374,7 +2378,7 @@ out_balanced: | |||
2374 | * idle_balance is called by schedule() if this_cpu is about to become | 2378 | * idle_balance is called by schedule() if this_cpu is about to become |
2375 | * idle. Attempts to pull tasks from other CPUs. | 2379 | * idle. Attempts to pull tasks from other CPUs. |
2376 | */ | 2380 | */ |
2377 | static inline void idle_balance(int this_cpu, runqueue_t *this_rq) | 2381 | static void idle_balance(int this_cpu, runqueue_t *this_rq) |
2378 | { | 2382 | { |
2379 | struct sched_domain *sd; | 2383 | struct sched_domain *sd; |
2380 | 2384 | ||
@@ -2758,7 +2762,7 @@ static inline void wakeup_busy_runqueue(runqueue_t *rq) | |||
2758 | resched_task(rq->idle); | 2762 | resched_task(rq->idle); |
2759 | } | 2763 | } |
2760 | 2764 | ||
2761 | static inline void wake_sleeping_dependent(int this_cpu, runqueue_t *this_rq) | 2765 | static void wake_sleeping_dependent(int this_cpu, runqueue_t *this_rq) |
2762 | { | 2766 | { |
2763 | struct sched_domain *tmp, *sd = NULL; | 2767 | struct sched_domain *tmp, *sd = NULL; |
2764 | cpumask_t sibling_map; | 2768 | cpumask_t sibling_map; |
@@ -2812,7 +2816,7 @@ static inline unsigned long smt_slice(task_t *p, struct sched_domain *sd) | |||
2812 | return p->time_slice * (100 - sd->per_cpu_gain) / 100; | 2816 | return p->time_slice * (100 - sd->per_cpu_gain) / 100; |
2813 | } | 2817 | } |
2814 | 2818 | ||
2815 | static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq) | 2819 | static int dependent_sleeper(int this_cpu, runqueue_t *this_rq) |
2816 | { | 2820 | { |
2817 | struct sched_domain *tmp, *sd = NULL; | 2821 | struct sched_domain *tmp, *sd = NULL; |
2818 | cpumask_t sibling_map; | 2822 | cpumask_t sibling_map; |
@@ -3560,7 +3564,7 @@ void set_user_nice(task_t *p, long nice) | |||
3560 | * The RT priorities are set via sched_setscheduler(), but we still | 3564 | * The RT priorities are set via sched_setscheduler(), but we still |
3561 | * allow the 'normal' nice value to be set - but as expected | 3565 | * allow the 'normal' nice value to be set - but as expected |
3562 | * it wont have any effect on scheduling until the task is | 3566 | * it wont have any effect on scheduling until the task is |
3563 | * not SCHED_NORMAL: | 3567 | * not SCHED_NORMAL/SCHED_BATCH: |
3564 | */ | 3568 | */ |
3565 | if (rt_task(p)) { | 3569 | if (rt_task(p)) { |
3566 | p->static_prio = NICE_TO_PRIO(nice); | 3570 | p->static_prio = NICE_TO_PRIO(nice); |
@@ -3706,10 +3710,16 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) | |||
3706 | BUG_ON(p->array); | 3710 | BUG_ON(p->array); |
3707 | p->policy = policy; | 3711 | p->policy = policy; |
3708 | p->rt_priority = prio; | 3712 | p->rt_priority = prio; |
3709 | if (policy != SCHED_NORMAL) | 3713 | if (policy != SCHED_NORMAL && policy != SCHED_BATCH) { |
3710 | p->prio = MAX_RT_PRIO-1 - p->rt_priority; | 3714 | p->prio = MAX_RT_PRIO-1 - p->rt_priority; |
3711 | else | 3715 | } else { |
3712 | p->prio = p->static_prio; | 3716 | p->prio = p->static_prio; |
3717 | /* | ||
3718 | * SCHED_BATCH tasks are treated as perpetual CPU hogs: | ||
3719 | */ | ||
3720 | if (policy == SCHED_BATCH) | ||
3721 | p->sleep_avg = 0; | ||
3722 | } | ||
3713 | } | 3723 | } |
3714 | 3724 | ||
3715 | /** | 3725 | /** |
@@ -3733,29 +3743,35 @@ recheck: | |||
3733 | if (policy < 0) | 3743 | if (policy < 0) |
3734 | policy = oldpolicy = p->policy; | 3744 | policy = oldpolicy = p->policy; |
3735 | else if (policy != SCHED_FIFO && policy != SCHED_RR && | 3745 | else if (policy != SCHED_FIFO && policy != SCHED_RR && |
3736 | policy != SCHED_NORMAL) | 3746 | policy != SCHED_NORMAL && policy != SCHED_BATCH) |
3737 | return -EINVAL; | 3747 | return -EINVAL; |
3738 | /* | 3748 | /* |
3739 | * Valid priorities for SCHED_FIFO and SCHED_RR are | 3749 | * Valid priorities for SCHED_FIFO and SCHED_RR are |
3740 | * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0. | 3750 | * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL and |
3751 | * SCHED_BATCH is 0. | ||
3741 | */ | 3752 | */ |
3742 | if (param->sched_priority < 0 || | 3753 | if (param->sched_priority < 0 || |
3743 | (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || | 3754 | (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || |
3744 | (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) | 3755 | (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) |
3745 | return -EINVAL; | 3756 | return -EINVAL; |
3746 | if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) | 3757 | if ((policy == SCHED_NORMAL || policy == SCHED_BATCH) |
3758 | != (param->sched_priority == 0)) | ||
3747 | return -EINVAL; | 3759 | return -EINVAL; |
3748 | 3760 | ||
3749 | /* | 3761 | /* |
3750 | * Allow unprivileged RT tasks to decrease priority: | 3762 | * Allow unprivileged RT tasks to decrease priority: |
3751 | */ | 3763 | */ |
3752 | if (!capable(CAP_SYS_NICE)) { | 3764 | if (!capable(CAP_SYS_NICE)) { |
3753 | /* can't change policy */ | 3765 | /* |
3754 | if (policy != p->policy && | 3766 | * can't change policy, except between SCHED_NORMAL |
3755 | !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | 3767 | * and SCHED_BATCH: |
3768 | */ | ||
3769 | if (((policy != SCHED_NORMAL && p->policy != SCHED_BATCH) && | ||
3770 | (policy != SCHED_BATCH && p->policy != SCHED_NORMAL)) && | ||
3771 | !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | ||
3756 | return -EPERM; | 3772 | return -EPERM; |
3757 | /* can't increase priority */ | 3773 | /* can't increase priority */ |
3758 | if (policy != SCHED_NORMAL && | 3774 | if ((policy != SCHED_NORMAL && policy != SCHED_BATCH) && |
3759 | param->sched_priority > p->rt_priority && | 3775 | param->sched_priority > p->rt_priority && |
3760 | param->sched_priority > | 3776 | param->sched_priority > |
3761 | p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | 3777 | p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) |
@@ -4233,6 +4249,7 @@ asmlinkage long sys_sched_get_priority_max(int policy) | |||
4233 | ret = MAX_USER_RT_PRIO-1; | 4249 | ret = MAX_USER_RT_PRIO-1; |
4234 | break; | 4250 | break; |
4235 | case SCHED_NORMAL: | 4251 | case SCHED_NORMAL: |
4252 | case SCHED_BATCH: | ||
4236 | ret = 0; | 4253 | ret = 0; |
4237 | break; | 4254 | break; |
4238 | } | 4255 | } |
@@ -4256,6 +4273,7 @@ asmlinkage long sys_sched_get_priority_min(int policy) | |||
4256 | ret = 1; | 4273 | ret = 1; |
4257 | break; | 4274 | break; |
4258 | case SCHED_NORMAL: | 4275 | case SCHED_NORMAL: |
4276 | case SCHED_BATCH: | ||
4259 | ret = 0; | 4277 | ret = 0; |
4260 | } | 4278 | } |
4261 | return ret; | 4279 | return ret; |
@@ -5990,7 +6008,7 @@ next_sg: | |||
5990 | * Detach sched domains from a group of cpus specified in cpu_map | 6008 | * Detach sched domains from a group of cpus specified in cpu_map |
5991 | * These cpus will now be attached to the NULL domain | 6009 | * These cpus will now be attached to the NULL domain |
5992 | */ | 6010 | */ |
5993 | static inline void detach_destroy_domains(const cpumask_t *cpu_map) | 6011 | static void detach_destroy_domains(const cpumask_t *cpu_map) |
5994 | { | 6012 | { |
5995 | int i; | 6013 | int i; |
5996 | 6014 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 1da2e74beb97..5dafbd36d62e 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -476,7 +476,7 @@ unblock_all_signals(void) | |||
476 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); | 476 | spin_unlock_irqrestore(¤t->sighand->siglock, flags); |
477 | } | 477 | } |
478 | 478 | ||
479 | static inline int collect_signal(int sig, struct sigpending *list, siginfo_t *info) | 479 | static int collect_signal(int sig, struct sigpending *list, siginfo_t *info) |
480 | { | 480 | { |
481 | struct sigqueue *q, *first = NULL; | 481 | struct sigqueue *q, *first = NULL; |
482 | int still_pending = 0; | 482 | int still_pending = 0; |
@@ -1881,7 +1881,7 @@ do_signal_stop(int signr) | |||
1881 | * We return zero if we still hold the siglock and should look | 1881 | * We return zero if we still hold the siglock and should look |
1882 | * for another signal without checking group_stop_count again. | 1882 | * for another signal without checking group_stop_count again. |
1883 | */ | 1883 | */ |
1884 | static inline int handle_group_stop(void) | 1884 | static int handle_group_stop(void) |
1885 | { | 1885 | { |
1886 | int stop_count; | 1886 | int stop_count; |
1887 | 1887 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 62d4d9566876..f5d69b6e29f5 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -648,7 +648,7 @@ static ctl_table kern_table[] = { | |||
648 | .mode = 0644, | 648 | .mode = 0644, |
649 | .proc_handler = &proc_dointvec, | 649 | .proc_handler = &proc_dointvec, |
650 | }, | 650 | }, |
651 | #if defined(CONFIG_S390) | 651 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) |
652 | { | 652 | { |
653 | .ctl_name = KERN_SPIN_RETRY, | 653 | .ctl_name = KERN_SPIN_RETRY, |
654 | .procname = "spin_retry", | 654 | .procname = "spin_retry", |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 82c4fa70595c..b052e2c4c710 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -147,7 +147,7 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq, | |||
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline void run_workqueue(struct cpu_workqueue_struct *cwq) | 150 | static void run_workqueue(struct cpu_workqueue_struct *cwq) |
151 | { | 151 | { |
152 | unsigned long flags; | 152 | unsigned long flags; |
153 | 153 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index a609235a517f..a314e663d517 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -195,6 +195,20 @@ config FRAME_POINTER | |||
195 | some architectures or if you use external debuggers. | 195 | some architectures or if you use external debuggers. |
196 | If you don't debug the kernel, you can say N. | 196 | If you don't debug the kernel, you can say N. |
197 | 197 | ||
198 | config FORCED_INLINING | ||
199 | bool "Force gcc to inline functions marked 'inline'" | ||
200 | depends on DEBUG_KERNEL | ||
201 | default y | ||
202 | help | ||
203 | This option determines if the kernel forces gcc to inline the functions | ||
204 | developers have marked 'inline'. Doing so takes away freedom from gcc to | ||
205 | do what it thinks is best, which is desirable for the gcc 3.x series of | ||
206 | compilers. The gcc 4.x series have a rewritten inlining algorithm and | ||
207 | disabling this option will generate a smaller kernel there. Hopefully | ||
208 | this algorithm is so good that allowing gcc4 to make the decision can | ||
209 | become the default in the future, until then this option is there to | ||
210 | test gcc for this. | ||
211 | |||
198 | config RCU_TORTURE_TEST | 212 | config RCU_TORTURE_TEST |
199 | tristate "torture tests for RCU" | 213 | tristate "torture tests for RCU" |
200 | depends on DEBUG_KERNEL | 214 | depends on DEBUG_KERNEL |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b62cab575a84..3171f884d245 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1359,6 +1359,30 @@ restart: | |||
1359 | return 0; | 1359 | return 0; |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | void mpol_shared_policy_init(struct shared_policy *info, int policy, | ||
1363 | nodemask_t *policy_nodes) | ||
1364 | { | ||
1365 | info->root = RB_ROOT; | ||
1366 | spin_lock_init(&info->lock); | ||
1367 | |||
1368 | if (policy != MPOL_DEFAULT) { | ||
1369 | struct mempolicy *newpol; | ||
1370 | |||
1371 | /* Falls back to MPOL_DEFAULT on any error */ | ||
1372 | newpol = mpol_new(policy, policy_nodes); | ||
1373 | if (!IS_ERR(newpol)) { | ||
1374 | /* Create pseudo-vma that contains just the policy */ | ||
1375 | struct vm_area_struct pvma; | ||
1376 | |||
1377 | memset(&pvma, 0, sizeof(struct vm_area_struct)); | ||
1378 | /* Policy covers entire file */ | ||
1379 | pvma.vm_end = TASK_SIZE; | ||
1380 | mpol_set_shared_policy(info, &pvma, newpol); | ||
1381 | mpol_free(newpol); | ||
1382 | } | ||
1383 | } | ||
1384 | } | ||
1385 | |||
1362 | int mpol_set_shared_policy(struct shared_policy *info, | 1386 | int mpol_set_shared_policy(struct shared_policy *info, |
1363 | struct vm_area_struct *vma, struct mempolicy *npol) | 1387 | struct vm_area_struct *vma, struct mempolicy *npol) |
1364 | { | 1388 | { |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 4748b906aff2..14bd4ec79597 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -274,6 +274,7 @@ void out_of_memory(gfp_t gfp_mask, int order) | |||
274 | show_mem(); | 274 | show_mem(); |
275 | } | 275 | } |
276 | 276 | ||
277 | cpuset_lock(); | ||
277 | read_lock(&tasklist_lock); | 278 | read_lock(&tasklist_lock); |
278 | retry: | 279 | retry: |
279 | p = select_bad_process(); | 280 | p = select_bad_process(); |
@@ -284,6 +285,7 @@ retry: | |||
284 | /* Found nothing?!?! Either we hang forever, or we panic. */ | 285 | /* Found nothing?!?! Either we hang forever, or we panic. */ |
285 | if (!p) { | 286 | if (!p) { |
286 | read_unlock(&tasklist_lock); | 287 | read_unlock(&tasklist_lock); |
288 | cpuset_unlock(); | ||
287 | panic("Out of memory and no killable processes...\n"); | 289 | panic("Out of memory and no killable processes...\n"); |
288 | } | 290 | } |
289 | 291 | ||
@@ -293,6 +295,7 @@ retry: | |||
293 | 295 | ||
294 | out: | 296 | out: |
295 | read_unlock(&tasklist_lock); | 297 | read_unlock(&tasklist_lock); |
298 | cpuset_unlock(); | ||
296 | if (mm) | 299 | if (mm) |
297 | mmput(mm); | 300 | mmput(mm); |
298 | 301 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 343b3c0937e5..ce501bce1c2e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1316,7 +1316,8 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev) | |||
1316 | case S_IFREG: | 1316 | case S_IFREG: |
1317 | inode->i_op = &shmem_inode_operations; | 1317 | inode->i_op = &shmem_inode_operations; |
1318 | inode->i_fop = &shmem_file_operations; | 1318 | inode->i_fop = &shmem_file_operations; |
1319 | mpol_shared_policy_init(&info->policy); | 1319 | mpol_shared_policy_init(&info->policy, sbinfo->policy, |
1320 | &sbinfo->policy_nodes); | ||
1320 | break; | 1321 | break; |
1321 | case S_IFDIR: | 1322 | case S_IFDIR: |
1322 | inode->i_nlink++; | 1323 | inode->i_nlink++; |
@@ -1330,7 +1331,8 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev) | |||
1330 | * Must not load anything in the rbtree, | 1331 | * Must not load anything in the rbtree, |
1331 | * mpol_free_shared_policy will not be called. | 1332 | * mpol_free_shared_policy will not be called. |
1332 | */ | 1333 | */ |
1333 | mpol_shared_policy_init(&info->policy); | 1334 | mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, |
1335 | NULL); | ||
1334 | break; | 1336 | break; |
1335 | } | 1337 | } |
1336 | } else if (sbinfo->max_inodes) { | 1338 | } else if (sbinfo->max_inodes) { |
@@ -1843,7 +1845,9 @@ static struct inode_operations shmem_symlink_inode_operations = { | |||
1843 | .put_link = shmem_put_link, | 1845 | .put_link = shmem_put_link, |
1844 | }; | 1846 | }; |
1845 | 1847 | ||
1846 | static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, unsigned long *blocks, unsigned long *inodes) | 1848 | static int shmem_parse_options(char *options, int *mode, uid_t *uid, |
1849 | gid_t *gid, unsigned long *blocks, unsigned long *inodes, | ||
1850 | int *policy, nodemask_t *policy_nodes) | ||
1847 | { | 1851 | { |
1848 | char *this_char, *value, *rest; | 1852 | char *this_char, *value, *rest; |
1849 | 1853 | ||
@@ -1897,6 +1901,19 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, | |||
1897 | *gid = simple_strtoul(value,&rest,0); | 1901 | *gid = simple_strtoul(value,&rest,0); |
1898 | if (*rest) | 1902 | if (*rest) |
1899 | goto bad_val; | 1903 | goto bad_val; |
1904 | } else if (!strcmp(this_char,"mpol")) { | ||
1905 | if (!strcmp(value,"default")) | ||
1906 | *policy = MPOL_DEFAULT; | ||
1907 | else if (!strcmp(value,"preferred")) | ||
1908 | *policy = MPOL_PREFERRED; | ||
1909 | else if (!strcmp(value,"bind")) | ||
1910 | *policy = MPOL_BIND; | ||
1911 | else if (!strcmp(value,"interleave")) | ||
1912 | *policy = MPOL_INTERLEAVE; | ||
1913 | else | ||
1914 | goto bad_val; | ||
1915 | } else if (!strcmp(this_char,"mpol_nodelist")) { | ||
1916 | nodelist_parse(value, *policy_nodes); | ||
1900 | } else { | 1917 | } else { |
1901 | printk(KERN_ERR "tmpfs: Bad mount option %s\n", | 1918 | printk(KERN_ERR "tmpfs: Bad mount option %s\n", |
1902 | this_char); | 1919 | this_char); |
@@ -1917,12 +1934,14 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1917 | struct shmem_sb_info *sbinfo = SHMEM_SB(sb); | 1934 | struct shmem_sb_info *sbinfo = SHMEM_SB(sb); |
1918 | unsigned long max_blocks = sbinfo->max_blocks; | 1935 | unsigned long max_blocks = sbinfo->max_blocks; |
1919 | unsigned long max_inodes = sbinfo->max_inodes; | 1936 | unsigned long max_inodes = sbinfo->max_inodes; |
1937 | int policy = sbinfo->policy; | ||
1938 | nodemask_t policy_nodes = sbinfo->policy_nodes; | ||
1920 | unsigned long blocks; | 1939 | unsigned long blocks; |
1921 | unsigned long inodes; | 1940 | unsigned long inodes; |
1922 | int error = -EINVAL; | 1941 | int error = -EINVAL; |
1923 | 1942 | ||
1924 | if (shmem_parse_options(data, NULL, NULL, NULL, | 1943 | if (shmem_parse_options(data, NULL, NULL, NULL, &max_blocks, |
1925 | &max_blocks, &max_inodes)) | 1944 | &max_inodes, &policy, &policy_nodes)) |
1926 | return error; | 1945 | return error; |
1927 | 1946 | ||
1928 | spin_lock(&sbinfo->stat_lock); | 1947 | spin_lock(&sbinfo->stat_lock); |
@@ -1948,6 +1967,8 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1948 | sbinfo->free_blocks = max_blocks - blocks; | 1967 | sbinfo->free_blocks = max_blocks - blocks; |
1949 | sbinfo->max_inodes = max_inodes; | 1968 | sbinfo->max_inodes = max_inodes; |
1950 | sbinfo->free_inodes = max_inodes - inodes; | 1969 | sbinfo->free_inodes = max_inodes - inodes; |
1970 | sbinfo->policy = policy; | ||
1971 | sbinfo->policy_nodes = policy_nodes; | ||
1951 | out: | 1972 | out: |
1952 | spin_unlock(&sbinfo->stat_lock); | 1973 | spin_unlock(&sbinfo->stat_lock); |
1953 | return error; | 1974 | return error; |
@@ -1972,6 +1993,8 @@ static int shmem_fill_super(struct super_block *sb, | |||
1972 | struct shmem_sb_info *sbinfo; | 1993 | struct shmem_sb_info *sbinfo; |
1973 | unsigned long blocks = 0; | 1994 | unsigned long blocks = 0; |
1974 | unsigned long inodes = 0; | 1995 | unsigned long inodes = 0; |
1996 | int policy = MPOL_DEFAULT; | ||
1997 | nodemask_t policy_nodes = node_online_map; | ||
1975 | 1998 | ||
1976 | #ifdef CONFIG_TMPFS | 1999 | #ifdef CONFIG_TMPFS |
1977 | /* | 2000 | /* |
@@ -1984,8 +2007,8 @@ static int shmem_fill_super(struct super_block *sb, | |||
1984 | inodes = totalram_pages - totalhigh_pages; | 2007 | inodes = totalram_pages - totalhigh_pages; |
1985 | if (inodes > blocks) | 2008 | if (inodes > blocks) |
1986 | inodes = blocks; | 2009 | inodes = blocks; |
1987 | if (shmem_parse_options(data, &mode, &uid, &gid, | 2010 | if (shmem_parse_options(data, &mode, &uid, &gid, &blocks, |
1988 | &blocks, &inodes)) | 2011 | &inodes, &policy, &policy_nodes)) |
1989 | return -EINVAL; | 2012 | return -EINVAL; |
1990 | } | 2013 | } |
1991 | #else | 2014 | #else |
@@ -2003,6 +2026,8 @@ static int shmem_fill_super(struct super_block *sb, | |||
2003 | sbinfo->free_blocks = blocks; | 2026 | sbinfo->free_blocks = blocks; |
2004 | sbinfo->max_inodes = inodes; | 2027 | sbinfo->max_inodes = inodes; |
2005 | sbinfo->free_inodes = inodes; | 2028 | sbinfo->free_inodes = inodes; |
2029 | sbinfo->policy = policy; | ||
2030 | sbinfo->policy_nodes = policy_nodes; | ||
2006 | 2031 | ||
2007 | sb->s_fs_info = sbinfo; | 2032 | sb->s_fs_info = sbinfo; |
2008 | sb->s_maxbytes = SHMEM_MAX_BYTES; | 2033 | sb->s_maxbytes = SHMEM_MAX_BYTES; |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 321287bc887f..90d18b72da3d 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -62,7 +62,7 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION); | |||
62 | MODULE_AUTHOR(DRV_COPYRIGHT); | 62 | MODULE_AUTHOR(DRV_COPYRIGHT); |
63 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
64 | 64 | ||
65 | static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) | 65 | static int ieee80211_networks_allocate(struct ieee80211_device *ieee) |
66 | { | 66 | { |
67 | if (ieee->networks) | 67 | if (ieee->networks) |
68 | return 0; | 68 | return 0; |
@@ -90,7 +90,7 @@ static inline void ieee80211_networks_free(struct ieee80211_device *ieee) | |||
90 | ieee->networks = NULL; | 90 | ieee->networks = NULL; |
91 | } | 91 | } |
92 | 92 | ||
93 | static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) | 93 | static void ieee80211_networks_initialize(struct ieee80211_device *ieee) |
94 | { | 94 | { |
95 | int i; | 95 | int i; |
96 | 96 | ||
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 5e3380388046..7a121802faa9 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include <net/ieee80211.h> | 36 | #include <net/ieee80211.h> |
37 | 37 | ||
38 | static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, | 38 | static void ieee80211_monitor_rx(struct ieee80211_device *ieee, |
39 | struct sk_buff *skb, | 39 | struct sk_buff *skb, |
40 | struct ieee80211_rx_stats *rx_stats) | 40 | struct ieee80211_rx_stats *rx_stats) |
41 | { | 41 | { |
@@ -165,7 +165,7 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | |||
165 | * Responsible for handling management control frames | 165 | * Responsible for handling management control frames |
166 | * | 166 | * |
167 | * Called by ieee80211_rx */ | 167 | * Called by ieee80211_rx */ |
168 | static inline int | 168 | static int |
169 | ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | 169 | ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, |
170 | struct ieee80211_rx_stats *rx_stats, u16 type, | 170 | struct ieee80211_rx_stats *rx_stats, u16 type, |
171 | u16 stype) | 171 | u16 stype) |
@@ -266,7 +266,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | |||
266 | } | 266 | } |
267 | 267 | ||
268 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 268 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
269 | static inline int | 269 | static int |
270 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | 270 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, |
271 | struct ieee80211_crypt_data *crypt) | 271 | struct ieee80211_crypt_data *crypt) |
272 | { | 272 | { |
@@ -297,7 +297,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
297 | } | 297 | } |
298 | 298 | ||
299 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 299 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
300 | static inline int | 300 | static int |
301 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | 301 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, |
302 | struct sk_buff *skb, int keyidx, | 302 | struct sk_buff *skb, int keyidx, |
303 | struct ieee80211_crypt_data *crypt) | 303 | struct ieee80211_crypt_data *crypt) |
@@ -1156,7 +1156,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee | |||
1156 | 1156 | ||
1157 | /***************************************************/ | 1157 | /***************************************************/ |
1158 | 1158 | ||
1159 | static inline int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response | 1159 | static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response |
1160 | *beacon, | 1160 | *beacon, |
1161 | struct ieee80211_network *network, | 1161 | struct ieee80211_network *network, |
1162 | struct ieee80211_rx_stats *stats) | 1162 | struct ieee80211_rx_stats *stats) |
@@ -1235,7 +1235,7 @@ static inline int is_same_network(struct ieee80211_network *src, | |||
1235 | !memcmp(src->ssid, dst->ssid, src->ssid_len)); | 1235 | !memcmp(src->ssid, dst->ssid, src->ssid_len)); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | static inline void update_network(struct ieee80211_network *dst, | 1238 | static void update_network(struct ieee80211_network *dst, |
1239 | struct ieee80211_network *src) | 1239 | struct ieee80211_network *src) |
1240 | { | 1240 | { |
1241 | int qos_active; | 1241 | int qos_active; |
@@ -1294,7 +1294,7 @@ static inline int is_beacon(int fc) | |||
1294 | return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); | 1294 | return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | static inline void ieee80211_process_probe_response(struct ieee80211_device | 1297 | static void ieee80211_process_probe_response(struct ieee80211_device |
1298 | *ieee, struct | 1298 | *ieee, struct |
1299 | ieee80211_probe_response | 1299 | ieee80211_probe_response |
1300 | *beacon, struct ieee80211_rx_stats | 1300 | *beacon, struct ieee80211_rx_stats |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index e5b33c8d5dbc..8fdd943ebe8e 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -127,7 +127,7 @@ payload of each frame is reduced to 492 bytes. | |||
127 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; | 127 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; |
128 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; | 128 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; |
129 | 129 | ||
130 | static inline int ieee80211_copy_snap(u8 * data, u16 h_proto) | 130 | static int ieee80211_copy_snap(u8 * data, u16 h_proto) |
131 | { | 131 | { |
132 | struct ieee80211_snap_hdr *snap; | 132 | struct ieee80211_snap_hdr *snap; |
133 | u8 *oui; | 133 | u8 *oui; |
@@ -150,7 +150,7 @@ static inline int ieee80211_copy_snap(u8 * data, u16 h_proto) | |||
150 | return SNAP_SIZE + sizeof(u16); | 150 | return SNAP_SIZE + sizeof(u16); |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, | 153 | static int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, |
154 | struct sk_buff *frag, int hdr_len) | 154 | struct sk_buff *frag, int hdr_len) |
155 | { | 155 | { |
156 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; | 156 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; |
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 406d5b964905..23e1630f50b7 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -42,7 +42,7 @@ static const char *ieee80211_modes[] = { | |||
42 | }; | 42 | }; |
43 | 43 | ||
44 | #define MAX_CUSTOM_LEN 64 | 44 | #define MAX_CUSTOM_LEN 64 |
45 | static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | 45 | static char *ipw2100_translate_scan(struct ieee80211_device *ieee, |
46 | char *start, char *stop, | 46 | char *start, char *stop, |
47 | struct ieee80211_network *network) | 47 | struct ieee80211_network *network) |
48 | { | 48 | { |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 5b25fc0d980c..4e3d3811dea2 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -289,13 +289,13 @@ static int inet_check_attr(struct rtmsg *r, struct rtattr **rta) | |||
289 | { | 289 | { |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | for (i=1; i<=RTA_MAX; i++) { | 292 | for (i=1; i<=RTA_MAX; i++, rta++) { |
293 | struct rtattr *attr = rta[i-1]; | 293 | struct rtattr *attr = *rta; |
294 | if (attr) { | 294 | if (attr) { |
295 | if (RTA_PAYLOAD(attr) < 4) | 295 | if (RTA_PAYLOAD(attr) < 4) |
296 | return -EINVAL; | 296 | return -EINVAL; |
297 | if (i != RTA_MULTIPATH && i != RTA_METRICS) | 297 | if (i != RTA_MULTIPATH && i != RTA_METRICS) |
298 | rta[i-1] = (struct rtattr*)RTA_DATA(attr); | 298 | *rta = (struct rtattr*)RTA_DATA(attr); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | return 0; | 301 | return 0; |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 95fdf04f1d88..f6063e8f0050 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -212,7 +212,7 @@ int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | /* Process one complete nfnetlink message. */ | 214 | /* Process one complete nfnetlink message. */ |
215 | static inline int nfnetlink_rcv_msg(struct sk_buff *skb, | 215 | static int nfnetlink_rcv_msg(struct sk_buff *skb, |
216 | struct nlmsghdr *nlh, int *errp) | 216 | struct nlmsghdr *nlh, int *errp) |
217 | { | 217 | { |
218 | struct nfnl_callback *nc; | 218 | struct nfnl_callback *nc; |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6647204e4636..b9f8d9731c3d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1019,7 +1019,7 @@ static inline int dentry_has_perm(struct task_struct *tsk, | |||
1019 | has the same SID as the process. If av is zero, then | 1019 | has the same SID as the process. If av is zero, then |
1020 | access to the file is not checked, e.g. for cases | 1020 | access to the file is not checked, e.g. for cases |
1021 | where only the descriptor is affected like seek. */ | 1021 | where only the descriptor is affected like seek. */ |
1022 | static inline int file_has_perm(struct task_struct *tsk, | 1022 | static int file_has_perm(struct task_struct *tsk, |
1023 | struct file *file, | 1023 | struct file *file, |
1024 | u32 av) | 1024 | u32 av) |
1025 | { | 1025 | { |
diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c index a4ecab2f0522..849b59f67ef5 100644 --- a/sound/oss/esssolo1.c +++ b/sound/oss/esssolo1.c | |||
@@ -515,7 +515,7 @@ static inline int prog_dmabuf_adc(struct solo1_state *s) | |||
515 | return 0; | 515 | return 0; |
516 | } | 516 | } |
517 | 517 | ||
518 | static inline int prog_dmabuf_dac(struct solo1_state *s) | 518 | static int prog_dmabuf_dac(struct solo1_state *s) |
519 | { | 519 | { |
520 | unsigned long va; | 520 | unsigned long va; |
521 | int c; | 521 | int c; |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 9ffb600321cb..3747a436f0cd 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -727,7 +727,7 @@ static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 dat | |||
727 | apu_data_set(chip, data); | 727 | apu_data_set(chip, data); |
728 | } | 728 | } |
729 | 729 | ||
730 | static inline void apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 data) | 730 | static void apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 data) |
731 | { | 731 | { |
732 | unsigned long flags; | 732 | unsigned long flags; |
733 | spin_lock_irqsave(&chip->reg_lock, flags); | 733 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -743,7 +743,7 @@ static u16 __apu_get_register(struct es1968 *chip, u16 channel, u8 reg) | |||
743 | return __maestro_read(chip, IDR0_DATA_PORT); | 743 | return __maestro_read(chip, IDR0_DATA_PORT); |
744 | } | 744 | } |
745 | 745 | ||
746 | static inline u16 apu_get_register(struct es1968 *chip, u16 channel, u8 reg) | 746 | static u16 apu_get_register(struct es1968 *chip, u16 channel, u8 reg) |
747 | { | 747 | { |
748 | unsigned long flags; | 748 | unsigned long flags; |
749 | u16 v; | 749 | u16 v; |